diff options
author | Avi Kivity <avi@redhat.com> | 2011-05-15 10:13:12 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 11:45:00 +0300 |
commit | 5e520e62787afd8fc28626fd8d4f77491135119d (patch) | |
tree | 44641116820afb0b14f05ce643889c60ed024dab /arch/x86/kvm/vmx.c | |
parent | 7b105ca2903b84f023c49965d9a511c5e55256dc (diff) | |
download | lwn-5e520e62787afd8fc28626fd8d4f77491135119d.tar.gz lwn-5e520e62787afd8fc28626fd8d4f77491135119d.zip |
KVM: VMX: Move VMREAD cleanup to exception handler
We clean up a failed VMREAD by clearing the output register. Do
it in the exception handler instead of unconditionally. This is
worthwhile since there are more than a hundred call sites.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d48ec60ea421..7d22d6c6734d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -43,6 +43,8 @@ #include "trace.h" #define __ex(x) __kvm_handle_fault_on_reboot(x) +#define __ex_clear(x, reg) \ + ____kvm_handle_fault_on_reboot(x, "xor " reg " , " reg) MODULE_AUTHOR("Qumranet"); MODULE_LICENSE("GPL"); @@ -587,10 +589,10 @@ static inline void ept_sync_individual_addr(u64 eptp, gpa_t gpa) static unsigned long vmcs_readl(unsigned long field) { - unsigned long value = 0; + unsigned long value; - asm volatile (__ex(ASM_VMX_VMREAD_RDX_RAX) - : "+a"(value) : "d"(field) : "cc"); + asm volatile (__ex_clear(ASM_VMX_VMREAD_RDX_RAX, "%0") + : "=a"(value) : "d"(field) : "cc"); return value; } |