Messages in this thread | | | Date | Thu, 3 Feb 2011 03:15:10 +0100 | From | Andi Kleen <> | Subject | Re: [patch] x86, mm: avoid stale tlb entries by clearing prev mm_cpumask after switching mm |
| |
> I thought "asm volatile" is going to take care of that.
asm volatile just prevents deletion:
>> The `volatile' keyword indicates that the instruction has important side-effects. GCC will not delete a volatile `asm' if it is reachable. (The instruction can still be deleted if GCC can prove that control-flow will never reach the location of the instruction.) Note that even a volatile `asm' instruction can be moved relative to other code, including across jump instructions. <<
> If not, then we have issues even today. no?
Well yes. It depends on the compiler if it actually moves something. So most likely nothing was reordered yet, but it's safer to prevent it.
I normally go by the rule that if correctness requires a specific order without explicit side effects I add memory barriers.
-Andi
-- ak@linux.intel.com -- Speaking for myself only.
| |