lkml.org 
[lkml]   [2013]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: perf events ring buffer memory barrier on powerpc
    On Thu, Oct 31, 2013 at 10:04:57AM +0100, Peter Zijlstra wrote:
    > On Wed, Oct 30, 2013 at 09:32:58PM -0700, Paul E. McKenney wrote:
    > > Before C/C++11, the closest thing to such a prohibition is use of
    > > volatile, for example, ACCESS_ONCE(). Even in C/C++11, you have to
    > > use atomics to get anything resembing this prohibition.
    > >
    > > If you just use normal variables, the compiler is within its rights
    > > to transform something like the following:
    > >
    > > if (a)
    > > b = 1;
    > > else
    > > b = 42;
    > >
    > > Into:
    > >
    > > b = 42;
    > > if (a)
    > > b = 1;
    > >
    > > Many other similar transformations are permitted. Some are used to all
    > > vector instructions to be used -- the compiler can do a write with an
    > > overly wide vector instruction, then clean up the clobbered variables
    > > later, if it wishes. Again, if the variables are not marked volatile,
    > > or, in C/C++11, atomic.
    >
    > While I've heard you tell this story before, my mind keeps boggling how
    > we've been able to use shared memory at all, all these years.
    >
    > It seems to me stuff should have broken left, right and center if
    > compilers were really aggressive about this.

    Sometimes having stupid compilers is a good thing. But they really are
    getting more aggressive.

    Thanx, Paul



    \
     
     \ /
      Last update: 2013-10-31 17:01    [W:3.415 / U:0.408 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site