[lkml]   [2006]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [patch] spinlocks: remove 'volatile'
    Chase Venters <> writes:

    > Locks are supposed to be syncronization points, which is why they
    > ALREADY HAVE "memory" on the clobber list! "memory" IS NECESSARY. The
    > fact that "=m" is changing to "+m" in Linus's patches is because "=m"
    > is in fact insufficient, because it would let the compiler believe
    > we're just going to over-write the value. "volatile" merely hides that
    > bug -- once that bug is _fixed_ (by going to "+m"), "volatile" is no
    > longer useful.

    This is a completely different story. "volatile", barrier() and "+m"/"=m"
    aren't sync points. If the variable access isn't atomic you must use
    locking even with volatiles, barriers etc.

    > If "volatile" is in use elsewhere (other than locks), it's still
    > probably wrong. In these cases, you can use a barrier, a volatile
    > cast, or an inline asm with a specific clobber.

    A volatile cast is just a volatile, moved from data declaration to
    all access points. It doesn't buy you anything.
    barrier() is basically "all-volatile". All of them operate on the same,
    compiler level.

    If the "volatile" is used the wrong way (which is probably true for most
    cases), then volatile cast and barrier() will be wrong as well. You need
    locks or atomic access, meaningful on hardware level.
    Krzysztof Halasa
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-07-08 12:03    [W:0.023 / U:10.584 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site