Messages in this thread | | | From | Linus Torvalds <> | Date | Wed, 2 Feb 2011 20:12:56 -0800 | Subject | Re: [patch] x86, mm: avoid stale tlb entries by clearing prev mm_cpumask after switching mm |
| |
On Wed, Feb 2, 2011 at 6:15 PM, Andi Kleen <andi@firstfloor.org> wrote: >> I thought "asm volatile" is going to take care of that. > > asm volatile just prevents deletion:
No. We also assume that gcc does the sane thing.
If "asm volatile" means that the asm can still be moved around arbitrarily (including across other asm volatiles etc), then the whole "volatile" has no meaning at all.
So there's no point in pointing to known-bogus gcc documentation. Afaik, there's at least one bugzilla entry about that bogus documentation by hpa, and the traditional meaning - and documentation - of "volatile" on asms was that they wouldn't be moved around "significantly".
For example, from the previous time we talked about asm volatiles, hpa said:
"The other thing that the documentation *does* specifically make clear is that an "asm volatile" has an implicit dependency on all memory (as an input, as opposed to an output/clobber.)"
(quoting some C++ documentation), and the fact is that without rules like that, "volatile" really is totally meaningless on asm's, and it would be a totally pointless keyword (since EVERY SINGLE USE would have to be replaced by a memory clobber).
So right now, we pretty much depend on "asm volatile" (a) not being re-ordered wrt other asm volatiles and (b) having that dependency on memory.
Iirc, the gcc people even agreed on this. Peter may remember details better..
Linus
| |