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

[Xen-devel] [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once



These routines are first called via CPU_UP_PREPARE notifier by the BSP
and then by the booting ASP from vmx_cpu_up()/_svm_cpu_up().

Avoid the unnecessary second call.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
V2:
* Call *cpu_up_prepare() on BSP from start_svm/vmx()

 xen/arch/x86/hvm/svm/svm.c  | 6 +-----
 xen/arch/x86/hvm/vmx/vmcs.c | 3 ---
 xen/arch/x86/hvm/vmx/vmx.c  | 2 +-
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0dc9442..2b51e4d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1526,7 +1526,6 @@ static int svm_handle_osvw(struct vcpu *v, uint32_t msr, 
uint64_t *val, bool_t r
 static int _svm_cpu_up(bool bsp)
 {
     uint64_t msr_content;
-    int rc;
     unsigned int cpu = smp_processor_id();
     const struct cpuinfo_x86 *c = &cpu_data[cpu];
  
@@ -1538,9 +1537,6 @@ static int _svm_cpu_up(bool bsp)
         return -EINVAL;
     }
 
-    if ( (rc = svm_cpu_up_prepare(cpu)) != 0 )
-        return rc;
-
     write_efer(read_efer() | EFER_SVME);
 
     /* Initialize the HSA for this core. */
@@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)
 
     svm_host_osvw_reset();
 
-    if ( _svm_cpu_up(true) )
+    if ( svm_cpu_up_prepare(smp_processor_id()) || _svm_cpu_up(true) )
     {
         printk("SVM: failed to initialise.\n");
         return NULL;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 7854802..73b4731 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -652,9 +652,6 @@ int vmx_cpu_up(void)
 
     INIT_LIST_HEAD(&this_cpu(active_vmcs_list));
 
-    if ( (rc = vmx_cpu_up_prepare(cpu)) != 0 )
-        return rc;
-
     switch ( __vmxon(this_cpu(vmxon_region)) )
     {
     case -2: /* #UD or #GP */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 67fc85b..f8c2d01 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2433,7 +2433,7 @@ const struct hvm_function_table * __init start_vmx(void)
 {
     set_in_cr4(X86_CR4_VMXE);
 
-    if ( vmx_cpu_up() )
+    if ( vmx_cpu_up_prepare(smp_processor_id()) || vmx_cpu_up() )
     {
         printk("VMX: failed to initialise.\n");
         return NULL;
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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