Re: [PATCH] x86: fix ordering constraints on crX read/writes

From: Avi Kivity
Date: Thu Jul 15 2010 - 03:08:13 EST


On 07/15/2010 03:28 AM, Zachary Amsden wrote:
static inline void native_write_cr2(unsigned long val)
{
- asm volatile("mov %0,%%cr2": : "r" (val), "m" (__force_order));
+ asm volatile("mov %1,%%cr2": "+m" (__force_order) : "r" (val) : "memory");
}


You don't need the memory clobber there. Technically, this should never be used, however.

kvm writes cr2 in order to present the correct value to the guest. It doesn't use native_write_cr2(), however.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

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