[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Nested SVM: fix race in remote shootdown.



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxx>
# Date 1302085359 -3600
# Node ID 86f87da1445a0a9bf3094917bc98c64e9b82799b
# Parent  2a39222f0071295bdae703c928403d30c63674cc
Nested SVM: fix race in remote shootdown.

nestedhvm_flushtlb_ipi() can run between nsvm_vcpu_switch() and CLGI,
which would leave the VMCB pointing at the wrong p2m table.
Check for this after CLGI.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---


diff -r 2a39222f0071 -r 86f87da1445a xen/arch/x86/hvm/svm/entry.S
--- a/xen/arch/x86/hvm/svm/entry.S      Wed Apr 06 11:22:39 2011 +0100
+++ b/xen/arch/x86/hvm/svm/entry.S      Wed Apr 06 11:22:39 2011 +0100
@@ -65,6 +65,12 @@
         testl $~0,(r(dx),r(ax),1)
         jnz  .Lsvm_process_softirqs
 
+        mov  VCPU_nhvm_p2m(r(bx)),r(ax)
+        test r(ax),r(ax)
+        sete %al
+        andb VCPU_nhvm_guestmode(r(bx)),%al
+        jnz  .Lsvm_nsvm_no_p2m
+
         call svm_asid_handle_vmrun
 
         cmpb $0,addr_of(tb_init_done)
@@ -174,3 +180,9 @@
 .Lsvm_trace:
         call svm_trace_vmentry
         jmp  .Lsvm_trace_done
+
+.Lsvm_nsvm_no_p2m:
+        /* Someone shot down our nested p2m table; go round again
+         * and nsvm_vcpu_switch() will fix it for us. */
+        STGI
+        jmp  svm_asm_do_resume
diff -r 2a39222f0071 -r 86f87da1445a xen/arch/x86/x86_32/asm-offsets.c
--- a/xen/arch/x86/x86_32/asm-offsets.c Wed Apr 06 11:22:39 2011 +0100
+++ b/xen/arch/x86/x86_32/asm-offsets.c Wed Apr 06 11:22:39 2011 +0100
@@ -93,6 +93,10 @@
     OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm_vcpu.guest_cr[2]);
     BLANK();
 
+    OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm_vcpu.nvcpu.nv_guestmode);
+    OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm_vcpu.nvcpu.nv_p2m);
+    BLANK();
+
     OFFSET(VMCB_rax, struct vmcb_struct, rax);
     OFFSET(VMCB_rip, struct vmcb_struct, rip);
     OFFSET(VMCB_rsp, struct vmcb_struct, rsp);
diff -r 2a39222f0071 -r 86f87da1445a xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c Wed Apr 06 11:22:39 2011 +0100
+++ b/xen/arch/x86/x86_64/asm-offsets.c Wed Apr 06 11:22:39 2011 +0100
@@ -115,6 +115,10 @@
     OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm_vcpu.guest_cr[2]);
     BLANK();
 
+    OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm_vcpu.nvcpu.nv_guestmode);
+    OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm_vcpu.nvcpu.nv_p2m);
+    BLANK();
+
     OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.is_32bit_pv);
     BLANK();
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.