Re: [patch] x86, mm: avoid stale tlb entries by clearing prevmm_cpumask after switching mm
From: Linus Torvalds
Date: Wed Feb 02 2011 - 23:13:22 EST
On Wed, Feb 2, 2011 at 6:15 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/