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

[Xen-changelog] [xen-unstable] [SVM] Don't free HSA and root vmcb when disabling SVM



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1173440719 0
# Node ID b46a92ba0b614647debe57e53efc1a023e85bb74
# Parent  c75d1acd18c837ee7fb63bf410a56efbe80b86fe
[SVM] Don't free HSA and root vmcb when disabling SVM
since we're no longer allowed to free pages in an interrupt context.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c         |   22 ++++++----------------
 xen/arch/x86/hvm/svm/vmcb.c        |    5 -----
 xen/include/asm-x86/hvm/svm/vmcb.h |    1 -
 3 files changed, 6 insertions(+), 22 deletions(-)

diff -r c75d1acd18c8 -r b46a92ba0b61 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Mar 09 11:14:03 2007 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Mar 09 11:45:19 2007 +0000
@@ -107,22 +107,10 @@ static void stop_svm(void)
 static void stop_svm(void)
 {
     u32 eax, edx;    
-    int cpu = smp_processor_id();
-
     /* We turn off the EFER_SVME bit. */
     rdmsr(MSR_EFER, eax, edx);
     eax &= ~EFER_SVME;
     wrmsr(MSR_EFER, eax, edx);
- 
-    /* release the HSA */
-    free_host_save_area(hsa[cpu]);
-    hsa[cpu] = NULL;
-    wrmsr(MSR_K8_VM_HSAVE_PA, 0, 0 );
-
-    /* free up the root vmcb */
-    free_vmcb(root_vmcb[cpu]);
-    root_vmcb[cpu] = NULL;
-    root_vmcb_pa[cpu] = 0;
 }
 
 static void svm_store_cpu_guest_regs(
@@ -1058,8 +1046,9 @@ int start_svm(void)
         return 0;
     }
 
-    if (!(hsa[cpu] = alloc_host_save_area()))
-        return 0;
+    if (!hsa[cpu])
+        if (!(hsa[cpu] = alloc_host_save_area()))
+            return 0;
     
     rdmsr(MSR_EFER, eax, edx);
     eax |= EFER_SVME;
@@ -1074,8 +1063,9 @@ int start_svm(void)
     phys_hsa_hi = (u32) (phys_hsa >> 32);    
     wrmsr(MSR_K8_VM_HSAVE_PA, phys_hsa_lo, phys_hsa_hi);
   
-    if (!(root_vmcb[cpu] = alloc_vmcb())) 
-        return 0;
+    if (!root_vmcb[cpu])
+        if (!(root_vmcb[cpu] = alloc_vmcb())) 
+            return 0;
     root_vmcb_pa[cpu] = virt_to_maddr(root_vmcb[cpu]);
 
     if (cpu == 0)
diff -r c75d1acd18c8 -r b46a92ba0b61 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Fri Mar 09 11:14:03 2007 +0000
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Fri Mar 09 11:45:19 2007 +0000
@@ -77,11 +77,6 @@ struct host_save_area *alloc_host_save_a
 
     memset(hsa, 0, PAGE_SIZE);
     return hsa;
-}
-
-void free_host_save_area(struct host_save_area *hsa)
-{
-    free_xenheap_page(hsa);
 }
 
 static int construct_vmcb(struct vcpu *v)
diff -r c75d1acd18c8 -r b46a92ba0b61 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h        Fri Mar 09 11:14:03 2007 +0000
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h        Fri Mar 09 11:45:19 2007 +0000
@@ -460,7 +460,6 @@ struct vmcb_struct *alloc_vmcb(void);
 struct vmcb_struct *alloc_vmcb(void);
 struct host_save_area *alloc_host_save_area(void);
 void free_vmcb(struct vmcb_struct *vmcb);
-void free_host_save_area(struct host_save_area *hsa);
 
 int  svm_create_vmcb(struct vcpu *v);
 void svm_destroy_vmcb(struct vcpu *v);

_______________________________________________
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®.