Re: [PATCH 1/3] x86, intel: Output microcode revision v2

From: Andy Lutomirski
Date: Wed May 25 2011 - 19:58:37 EST


On 05/25/2011 03:32 PM, Andi Kleen wrote:
From: Andi Kleen<ak@xxxxxxxxxxxxxxx>


[...]


I had to add a memory barrier to native_cpuid to prevent it being
optimized away when the result is not used.


[...]

@@ -179,7 +181,8 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
- : "0" (*eax), "2" (*ecx));
+ : "0" (*eax), "2" (*ecx)
+ : "memory");
}


[...]

+ cpuid_eax(1);

I'm confused. Doesn't "asm volatile" (in native_cpuid) mean "don't optimize me out"?

I can't reproduce the disappearance of the cpuid instruction when I copied and pasted all the macros.

--Andy
--
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/