Messages in this thread | | | Date | Fri, 7 Jul 2006 16:48:56 -0500 (CDT) | From | Chase Venters <> | Subject | Re: [patch] spinlocks: remove 'volatile' |
| |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |