Re: Correct use of ap->lock versus ap->host->lock ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Garzik wrote:
Mark Lord wrote:
Jeff Garzik wrote:
Mark Lord wrote:
Jeff / Tejun / Alan,

I'm trying to sort out the spinlocks in sata_mv.

In some places, the existing code uses ap->lock.
But in others, notably the interrupt handling, it uses ap->host->lock.

This looks buggy to me, and I'm wondering how to make it bulletproof.

Look closely, there is only one lock. ata_port does not have a spinlock, just a pointer...
..

Ahh.. in ata_port_alloc().  Thanks.

Mmmm... so this reduces potential parallelism in libata,
meaning we could probably achieve better SMP performance
if the ap->locks were unique for each port.

But at the expense of very tricky and difficult coding
around shared host resources.

Not worth it today for spinning media, but this could be
a big limitation for solid-state media in the near future.

Its questionable whether it is worth it even for RAM-based ATA devices like gigabyte i-Ram.

The only thing being locked is software state involved in submission and completion (either host-wide or port-wide) and a couple register writes, which is a very tiny piece of the whole puzzle.

You have a long, long list of bottlenecks before you ever get there...
..

There are definitely other fish to fry elsewhere,
but don't discount the effect of "a couple register writes",
which are frequently done with readbacks to flush them,
at a cost equivalent to several thousand CPU cycles per readback.

This prevents new command issue from overlapping interrupt handling
for any ports of the same host.  Again, not a biggie today,
but tomorrow perhaps..

And still probably not worth the fuss on any hardware that has
registers shared across multiple ports (eg. Marvell controllers).

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux