Linus Torvalds wrote:
On Thu, 6 Jul 2006, Mark Lord wrote:
A volatile declaration may be used to describe an object corresponding to a memory-mapped input/output port or an object accessed by an aysnchronously interrupting function. Actions on objects so declared shall not be "optimized out" by an implementation or reordered except as permitted by the rules for evaluating expressions.Note that the "reordered" is totally pointless.The _hardware_ will re-order accesses. Which is the whole point. "volatile" is basically never sufficient in itself.
The "reordered" thing really only matters on SMP machines, no? In which case (for userspace) the locking mechanisms (mutexes, etc.) should do The Right Thing to ensure visibility between cpus.
The C standard requires the use of volatile for signal handlers and setjmp.For userspace at least the whole discussion of "barriers" is sort of moot--there are no memory barriers defined in the C language, which makes it kind of hard to write portable code that uses them.
Only a couple months ago Dave Miller mentioned setting variables modified in signal handlers as "volatile", and you didn't complain. If fact you added that they should be of type "sigatomic_t".
(Pardon the long URL) http://groups.google.com/group/linux.kernel/browse_frm/thread/18a59e3c9d8f6310/84881a7e53038b0e?lnk=st&q=sigatomic_t&rnum=8&hl=en#84881a7e53038b0e Chris - 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: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Jeff Garzik <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Måns Rullgård <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Arjan van de Ven <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Mark Lord <[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: Arjan van de Ven <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Mark Lord <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- Prev by Date: Re: [patch] spinlocks: remove 'volatile'
- Next by Date: Re: [patch] spinlocks: remove 'volatile'
- Previous by thread: Re: [patch] spinlocks: remove 'volatile'
- Next by thread: Re: [patch] spinlocks: remove 'volatile'
- Index(es):