Re: [PATCH] Define wc_wmb, a write barrier for PCI write combining

From: Bryan O'Sullivan
Date: Sat Feb 25 2006 - 02:32:25 EST


On Sat, 2006-02-25 at 05:43 +0100, Andi Kleen wrote:
> On Saturday 25 February 2006 05:20, Bryan O'Sullivan wrote:
> > On some platforms, a regular wmb() is not sufficient to guarantee that
> > PCI writes have been flushed to the bus if write combining is in effect.
>
> On what platforms?

On x86_64 in particular, if CONFIG_UNORDERED_IO is defined. Regular
wmb() is implemented as a compiler memory barrier then, which isn't
sufficient for PCI write combining.

> linux/system.h looks unnatural to me.

I used this for symmetry with <asm/system.h> where other barriers are
defined. It could obviously go into io.h instead, since it's an
MMIO-related barrier, but I didn't want to separate it from other
barriers.

If you have a location you'd prefer, please let me know.

> > We also define a version of wc_wmb() with the required semantics
> > on x86_64.
>
> Leaving i386 out in the cold?

Looks like it should be defined there, too, something like this perhaps:

#define wc_wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)

Does that look right?

<b

-
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/