Skip to contentSkip to conversation

VMX, apicv: add boot parameter to enable/disable APIC-v dynamically

PATCH In review Yang Zhang 3 participants 7 messages Aug 9, 2013

lore
Share & tools
lore

Yang Zhang

author
#0 lore raw

PATCH 1/1 VMX, apicv: add boot parameter to enable/disable APIC-v dynamically

From: Yang Zhang <[email protected]>

Add a boot parameter to enable/disable the APIC-v dynamically. APIC-v is enabled by default. User can use apicv=0 to disable it.

---
 xen/arch/x86/hvm/vmx/vmcs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +5 -2
index de9f592..b52408d 100644
@@ -46,6 +46,9 @@ boolean_param("vpid", opt_vpid_enabled);
 static bool_t __read_mostly opt_unrestricted_guest_enabled = 1;
 boolean_param("unrestricted_guest", opt_unrestricted_guest_enabled);
 
+static bool_t __read_mostly opt_apicv_enabled = 1;
+boolean_param("apicv", opt_apicv_enabled);
+
 /*
  * These two parameters are used to config the controls for Pause-Loop Exiting:
  * ple_gap:    upper bound on the amount of time between two successive
@@ -196,12 +199,12 @@ static int vmx_init_vmcs_config(void)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
          * can be set only when "use TPR shadow" is set
          */
-        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
+        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW &&
+                opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 
-
         _vmx_secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 7 lines · Yang Zhang

From: Yang Zhang <[email protected]>

Add a boot parameter to enable/disable the APIC-v dynamically. APIC-v is enabled by default. User can use apicv=0 to disable it.

---

Please patch docs/misc/xen-command-line.markdown as well.

Quoted 19 lines
 xen/arch/x86/hvm/vmx/vmcs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +3 -0
index de9f592..b52408d 100644
@@ -46,6 +46,9 @@ boolean_param("vpid", opt_vpid_enabled);
 static bool_t __read_mostly opt_unrestricted_guest_enabled = 1;
 boolean_param("unrestricted_guest", opt_unrestricted_guest_enabled);
 
+static bool_t __read_mostly opt_apicv_enabled = 1;
+boolean_param("apicv", opt_apicv_enabled);
+
 /*
  * These two parameters are used to config the controls for Pause-Loop Exiting:
  * ple_gap:    upper bound on the amount of time between two successive
@@ -196,12 +199,12 @@ static int vmx_init_vmcs_config(void)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"

xen/arch/x86/hvm/vmx/vmcs.c static int vmx_init_vmcs_config(void) · line 204

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmcs.c +2 -2
          * can be set only when "use TPR shadow" is set
          */
-        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
+        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW &&
+                opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 
-

Unrelated whitespace alteration.

~Andrew

Quoted 3 lines
xen/arch/x86/hvm/vmx/vmcs.c +0 -0
         _vmx_secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
#2 lore raw

Andrew Cooper wrote on 2013-08-09:

Quoted 10 lines · Yang Zhang
Quoted 7 lines

From: Yang Zhang <[email protected]>

Add a boot parameter to enable/disable the APIC-v dynamically. APIC-v is enabled by default. User can use apicv=0 to disable it.

---

Please patch docs/misc/xen-command-line.markdown as well.

Sure.

Quoted 20 lines
Quoted 16 lines
 xen/arch/x86/hvm/vmx/vmcs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/xen/arch/x86/hvm/vmx/vmcs.c index de9f592..b52408d 100644

xen/arch/x86/hvm/vmx/vmcs.c +3 -0
@@ -46,6 +46,9 @@ boolean_param("vpid", opt_vpid_enabled);  static
 bool_t __read_mostly opt_unrestricted_guest_enabled = 1;
 boolean_param("unrestricted_guest", opt_unrestricted_guest_enabled);
 
+static bool_t __read_mostly opt_apicv_enabled = 1;
+boolean_param("apicv", opt_apicv_enabled);
+
 /*
  * These two parameters are used to config the controls for
Quoted 1 line

Pause-Loop

Exiting:

Quoted 1 line

* ple_gap: upper bound on the amount of time between two

successive

Quoted 13 lines

xen/arch/x86/hvm/vmx/vmcs.c static int vmx_init_vmcs_config(void) · line 205

Quoted 11 lines
xen/arch/x86/hvm/vmx/vmcs.c +0 -2
@@ -196,12 +199,12 @@ static int vmx_init_vmcs_config(void)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
          * can be set only when "use TPR shadow" is set
          */
-        if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW ) +   
    if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW && +       
        opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
-

Unrelated whitespace alteration.

The whitespace is redundant. It is introduced by my previous patch of enabling APIC-v, so I remove it here.

Quoted 5 lines

~Andrew

Quoted 3 lines
xen/arch/x86/hvm/vmx/vmcs.c +0 -0
         _vmx_secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);

Best regards,
Yang

#3 lore raw
Quoted 3 lines · Yang Z

-

Quoted 1 line

Unrelated whitespace alteration.

The whitespace is redundant. It is introduced by my previous patch of enabling APIC-v, so I remove it here.

Then please correct your previous patch not to introduce it in the first place.

~Andrew

#4 lore raw

Andrew Cooper wrote on 2013-08-09:

Quoted 8 lines · Yang Z
Quoted 4 lines

-

Quoted 1 line

Unrelated whitespace alteration.

The whitespace is redundant. It is introduced by my previous patch of

enabling APIC-v, so I remove it here.

Then please correct your previous patch not to introduce it in the first place.

No, those patches already got applied in last year. Anyway, I can send out a separate patch to do this.

Best regards,
Yang

#5 lore raw
Quoted 6 lines · Yang Z

Andrew Cooper wrote on 2013-08-09:

Quoted 5 lines · Yang Z
Quoted 4 lines

-

Quoted 1 line

Unrelated whitespace alteration.

The whitespace is redundant. It is introduced by my previous patch of

Quoted 9 lines
Quoted 3 lines

enabling APIC-v, so I remove it here.

Then please correct your previous patch not to introduce it in the first place.

No, those patches already got applied in last year. Anyway, I can send out a separate patch to do this.

Best regards,
Yang

Ah ok.

~Andrew

#6 lore raw
In reply to Zhang, Yang Z
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Yang Z

Andrew Cooper wrote on 2013-08-09:

Quoted 3 lines · Yang Z
Quoted 2 lines

-

Quoted 1 line

Unrelated whitespace alteration.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The whitespace is redundant. It is introduced by my previous patch of

enabling APIC-v, so I remove it here.

Then please correct your previous patch not to introduce it in the first

place.
No, those patches already got applied in last year. Anyway, I can send out a separate patch to do this.

No, let's keep it here. The patch itself is simple enough to warrant that cleanup being included.

Jan