Re: Memory barriers and spin_unlock safety

From: Linus Torvalds
Date: Tue Mar 07 2006 - 13:27:00 EST




On Tue, 7 Mar 2006, Alan Cox wrote:
>
> What kind of mb/rmb/wmb goes with ioread/iowrite ? It seems we actually
> need one that can work out what to do for the general io API ?

The ioread/iowrite things only guarantee the laxer MMIO rules, since it
_might_ be mmio. So you'd use the mmio barriers.

In fact, I would suggest that architectures that can do PIO in a more
relaxed manner (x86 cannot, since all the serialization is in hardware)
would do even a PIO in the more relaxed ordering (ie writes can at least
be posted, but obviously not merged, since that would be against PCI
specs).

x86 tends to serialize PIO too much (I think at least Intel CPU's will
actually wait for the PIO write to be acknowledged by _something_ on the
bus, although it obviously can't wait for the device to have acted on it).

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/