Chase Venters <[email protected]> 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [patch] spinlocks: remove 'volatile'
- From: Chase Venters <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- References:
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Andrew Morton <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Andrew Morton <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- [patch] spinlocks: remove 'volatile'
- From: Ingo Molnar <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Krzysztof Halasa <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Chase Venters <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- Prev by Date: RE: [patch] spinlocks: remove 'volatile'
- Next by Date: Re: [Suspend2-devel] Re: uswsusp history lesson
- Previous by thread: Re: [patch] spinlocks: remove 'volatile'
- Next by thread: Re: [patch] spinlocks: remove 'volatile'
- Index(es):