[lkml]   [2000]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: spin_lock forgets to clobber memory and other smp fixes [was Re: [patch] waitqueue optimization, 2.4.0-test7]

On Thu, 7 Sep 2000, Jamie Lokier wrote:

> asm *__volatile__* seems to make no difference. I've tried a few things.
> Andrea Arcangeli wrote:
> > Maybe we can rely on the __volatile__ statement of the asm that will
> > enforce that if we write:
> >
> > *p = 0;
> > __asm__ __volatile__("" : :);
> > *p = 1;
> >
> > in the assembler we'll then find both a write of 0 and then a write of 1
> > to memory.
> That does 2 writes with gcc-2.96 and also egcs-2.91.66/19990314
> (Red Hat's kgcc), with or without -fstrict-aliasing.
> It also does 2 writes without __volatile__.

Your test is broken.

Read the gcc documentation. A inline asm with no outputs is implicitly
considered volatile. So _both_ your tests had volatile there.

Now, that may not matter that much fo ryour test-case: gcc gets careful
around inline asm anyway, even without the volatile.

Change it to something like

__asm__("":"=r" (x):"0" (x));

and the "volatile" should matter.

Not for memory references, perhaps. But for the movement issues.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.112 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site