Subject: Re: how to avoid re-ordering?
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Luke Mewburn <lukem@wasabisystems.com>
List: tech-kern
Date: 12/17/2001 12:16:30
On Mon, Dec 17, 2001 at 05:19:59AM +0900, YAMAMOTO Takashi wrote:
> From: Jason R Thorpe <thorpej@wasabisystems.com>
> >  > From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
> >  > > I noticed that spl*/splx are inlined and re-orderd
> >  > > with "-O3 -march=pentium", and it produce bad codes as a result.
> >  > > I actually experienced panics due to this.
> >  > 
> >  > I'll commit attached patch some days later if no objection.
> >  > thanks.
> > 
> > Should't we just declare "cpl" as __volatile?
> 
> cpl is already volatile, isn't it?
> am I missing something important?

(Note: I am not a gcc guru.)

What if ncpl or ocpl (local variables to the appropriate functions)
are marked volatile as well, because as far as I can tell, it's the
reordering of access to those variables which is what's causing the
problem, not the access to the volatile cpl.

Luke.