Re: [PATCH] [POWERPC] Improve (in|out)_beXX() asm code

From: Trent Piepho
Date: Thu May 22 2008 - 19:03:58 EST


On Fri, 23 May 2008, Benjamin Herrenschmidt wrote:
On Tue, 2008-05-20 at 15:53 -0700, David Miller wrote:
From: Scott Wood <scottwood@xxxxxxxxxxxxx>
Date: Tue, 20 May 2008 17:43:58 -0500
David Miller wrote:
The __volatile__ in the asm construct disallows movement of the
inline asm relative to statements surrounding it.

The only reason barrier() in kernel.h needs a memory clobber is
because of a bug in ancient versions of gcc. In fact, I think
that memory clobber might even be removable.

Current versions of GCC seem quite happy to move non-asm memory accesses
around a volatile asm without a memory clobber; see the test Trent posted.

Indeed, and even the GCC manual is clear about this.

So what is the scope of that problem ?

IE. Take an x86 version of that test, writing to memory, doing a writel
to some MMIO, then another memory write, can those be re-ordered with
the current x86 version of writel ?

Yes, the same thing can happen on x86. As far as I could tell, this is
something that all other arches can have happen. Usually aliasing prevents
it, but it's not hard to constuct a test case where it doesn't.
--
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/