[parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb

Grant Grundler grundler at parisc-linux.org
Sun Aug 22 22:31:05 MDT 2004


On Sat, Aug 21, 2004 at 09:45:00AM -0400, James Bottomley wrote:
> On Sat, 2004-08-21 at 03:27, Grant Grundler wrote:
> > I consider 2 and 3 the same thing basically.
> > Maybe on other arches this distinction matters?
> > (as noted below, I think I'm still missing something here...I need
> > to re-read the thread in January two or three more times)
> 
> But the compiler doesn't...that's the point.

Ah ok. I'll re-read the three points then.

> > The "memory" is what prevents gcc from re-ordering instructions.
> 
> No, no.
> 
> volatile prevents gcc from doing instruction reordering across the asm
> statement.
>
> The "memory" clobber tells gcc that all cached memory references have to
> be dropped after the asm code is executed.

Ah! (light goes on).

> Well, the bug is very subtle, and it's minimised by the fact that
> local_irq_save/restore *is* an instruction barrier and memory clobber,
> so the only issue is non-irq spinlocks.
> 
> And even for them, gcc doesn't make spurious memory loads, so some code
> has to occur immediately prior to the spinlock to cause gcc to load a
> value from memory that it will later reuse after the spinlock.

thanks - I think I understand it much better now.

thanks (for both the clarifications and finding the bug),
grant


More information about the parisc-linux-cvs mailing list