Linus Torvalds wrote:
> Change it to something like
>
> __asm__("":"=r" (x):"0" (x));
>
> and the "volatile" should matter.
Yes it does. Without "volatile", the asm disappears :-)
> Not for memory references, perhaps. But for the movement issues.
The compiler isn't moving memory references around "asm volatile", but
it is doing CSE around them to _eliminate_ memory references.
Thus spin_lock needs the memory clobber, to prevent CSE of non-volatile
memory references between the critical region and outside the critical
region.
Maybe spin_unlock doesn't need one because CSE doesn't work the other
way. (I'd put that clobber in anyway, to be sure).
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/
- Re: spin_lock forgets to clobber memory and other sm... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and other smp fix... Jamie Lokier
- Re: spin_lock forgets to clobber memory and other sm... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and othe... Jamie Lokier
- Re: spin_lock forgets to clobber memory and ... Linus Torvalds
- Re: spin_lock forgets to clobber memory ... Jamie Lokier
- Re: spin_lock forgets to clobber memory and ... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory ... Jamie Lokier
- Re: spin_lock forgets to clobber memory ... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and other sm... Linus Torvalds
- Re: spin_lock forgets to clobber memory and othe... Jamie Lokier
- Re: spin_lock forgets to clobber memory and other smp fix... Linus Torvalds
- Re: spin_lock forgets to clobber memory and other sm... Jamie Lokier
- Re: spin_lock forgets to clobber memory and othe... Linus Torvalds
- Re: spin_lock forgets to clobber memory and othe... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and ... Jamie Lokier
- Re: spin_lock forgets to clobber memory ... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and ... David Woodhouse
- Re: spin_lock forgets to clobber memory ... Andrea Arcangeli
- Re: spin_lock forgets to clobber memory and other smp fix... kuznet
- Re: spin_lock forgets to clobber memory and other sm... Andrea Arcangeli

