Re: spinlock

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Tue, 30 Nov 1999 13:37:18 +0100


David Wragg wrote:
> Pavel Machek <pavel@suse.cz> writes:
> > We should not do such tricks. gcc 2.95 may not be clever enough, but
> > gcc 3.05? egcs people are doing subtle tricks, and we should be very
> > carefull.
>
> I thought that the trick was only there to work around a bug in older
> versions of gcc. The proper use of volatile should be enough to get
> the compiler to do the right thing, but at one point gcc didn't.

AFAIK volatile is not enough to get _asm_ to do the right thing.
volatile guarantees visibility, but in this case it's atomicity that has
to be guaranteed.

If volatile causes asm "m" constraints to always use the original memory
location, that would be quite useful but it is not documented to do so.

-- Jamie

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