lkml.org 
[lkml]   [2012]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] driver core: fix shutdown races with probe/remove
On Wed, 6 Jun 2012, Paul E. McKenney wrote:

> On Wed, Jun 06, 2012 at 11:44:50AM -0400, Alan Stern wrote:
> > On Wed, 6 Jun 2012, Paul E. McKenney wrote:
> >
> > > > That just seems wrong. By the same reasoning, the compiler is within
> > > > its rights to transform either the original code or the code using
> > > > ACCESS_ONCE into:
> > > >
> > > > b = 999;
> > > > if (a)
> > > > b = 9;
> > > > else
> > > > b = 42;
> > > >
> > > > and again, other code would be confused. The simple fact is that
> > > > SMP-safe code is not likely to be produced by a compiler that assumes
> > > > everything is single-threaded.
> > >
> > > If you use ACCESS_ONCE(), the compiler is prohibited from inserting
> > > the "b = 999".
> >
> > What prohibits it?
>
> The compiler cannot move a volatile access across a sequence point, for
> example, across a statement boundary.

How does inserting a store to a non-volatile value qualify as moving a
volatile access?

Alan Stern



\
 
 \ /
  Last update: 2012-06-06 19:41    [from the cache]
©2003-2011 Jasper Spaans