On Fri, 7 Jul 2006, linux-os \(Dick Johnson\) wrote:
Again, I didn't propose to do that. In fact, your spin-lock code already inserts "rep nops" and I never implied that they should be removed. I said only that "volatile" still needs to be used, not some macro that tells the compiler that everything in memory probably got trashed. Read what I said, not what you think some idiot might have said.
Dude, are you even paying attention? "volatile" very much does not need to be used (and as Linus points out, it is _wrong_). Since we're using GCC's inline asm syntax _already_, it is perfectly sufficient to use the same syntax to tell GCC that memory should be considered invalid.
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. (It wasn't useful before, it just _papered over_ a problem).
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.
Thanks, Chase - 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: Krzysztof Halasa <[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] uninline init_waitqueue_*() functions
- Prev by Date: Re: [BUG] 2.6.18-rc1 broke resume from APM suspend on Latitude CPi
- Next by Date: Re: [PATCH 4/19] UML - timer initialization cleanup
- Previous by thread: Re: [patch] spinlocks: remove 'volatile'
- Next by thread: Re: [patch] spinlocks: remove 'volatile'
- Index(es):