All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] kvm : vmx : Remove yield_on_hlt
@ 2012-02-07 17:49 Raghavendra K T
  2012-02-07 18:04 ` Anthony Liguori
  2012-02-07 21:15 ` Marcelo Tosatti
  0 siblings, 2 replies; 3+ messages in thread
From: Raghavendra K T @ 2012-02-07 17:49 UTC (permalink / raw)
  To: Anthony Liguori, KVM, H. Peter Anvin, Thomas Gleixner,
	Marcelo Tosatti, X86, Ingo Molnar, Avi Kivity, LKML
  Cc: Srivatsa Vaddagiri, Raghavendra K T, Gleb Natapov

  yield_on_hlt was introduced for CPU bandwidth capping. now it is redundant
with CFS hardlimit.

yield_on_hlt also complicates the scenario in paravirtual environment, that
needs to trap halt. for e.g. paravirtualized ticket spinlocks.

Changelog:
Remove the support for yield_on_hlt.

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
---
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index d29216c..2fb3009 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -70,9 +70,6 @@ module_param(emulate_invalid_guest_state, bool, S_IRUGO);
 static bool __read_mostly vmm_exclusive = 1;
 module_param(vmm_exclusive, bool, S_IRUGO);
 
-static bool __read_mostly yield_on_hlt = 1;
-module_param(yield_on_hlt, bool, S_IRUGO);
-
 static bool __read_mostly fasteoi = 1;
 module_param(fasteoi, bool, S_IRUGO);
 
@@ -1655,17 +1652,6 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 	vmx_set_interrupt_shadow(vcpu, 0);
 }
 
-static void vmx_clear_hlt(struct kvm_vcpu *vcpu)
-{
-	/* Ensure that we clear the HLT state in the VMCS.  We don't need to
-	 * explicitly skip the instruction because if the HLT state is set, then
-	 * the instruction is already executing and RIP has already been
-	 * advanced. */
-	if (!yield_on_hlt &&
-	    vmcs_read32(GUEST_ACTIVITY_STATE) == GUEST_ACTIVITY_HLT)
-		vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE);
-}
-
 /*
  * KVM wants to inject page-faults which it got to the guest. This function
  * checks whether in a nested guest, we need to inject them to L1 or L2.
@@ -1718,7 +1704,6 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
 		intr_info |= INTR_TYPE_HARD_EXCEPTION;
 
 	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr_info);
-	vmx_clear_hlt(vcpu);
 }
 
 static bool vmx_rdtscp_supported(void)
@@ -2399,7 +2384,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
 				&_pin_based_exec_control) < 0)
 		return -EIO;
 
-	min =
+	min = CPU_BASED_HLT_EXITING |
 #ifdef CONFIG_X86_64
 	      CPU_BASED_CR8_LOAD_EXITING |
 	      CPU_BASED_CR8_STORE_EXITING |
@@ -2414,9 +2399,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
 	      CPU_BASED_INVLPG_EXITING |
 	      CPU_BASED_RDPMC_EXITING;
 
-	if (yield_on_hlt)
-		min |= CPU_BASED_HLT_EXITING;
-
 	opt = CPU_BASED_TPR_SHADOW |
 	      CPU_BASED_USE_MSR_BITMAPS |
 	      CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
@@ -4003,7 +3985,6 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu)
 	} else
 		intr |= INTR_TYPE_EXT_INTR;
 	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr);
-	vmx_clear_hlt(vcpu);
 }
 
 static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
@@ -4035,7 +4016,6 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
 	}
 	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
 			INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
-	vmx_clear_hlt(vcpu);
 }
 
 static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] kvm : vmx : Remove yield_on_hlt
  2012-02-07 17:49 [PATCH 1/1] kvm : vmx : Remove yield_on_hlt Raghavendra K T
@ 2012-02-07 18:04 ` Anthony Liguori
  2012-02-07 21:15 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2012-02-07 18:04 UTC (permalink / raw)
  To: Raghavendra K T
  Cc: KVM, H. Peter Anvin, Thomas Gleixner, Marcelo Tosatti, X86,
	Ingo Molnar, Avi Kivity, LKML, Srivatsa Vaddagiri, Gleb Natapov

On 02/07/2012 11:49 AM, Raghavendra K T wrote:
>    yield_on_hlt was introduced for CPU bandwidth capping. now it is redundant
> with CFS hardlimit.
>
> yield_on_hlt also complicates the scenario in paravirtual environment, that
> needs to trap halt. for e.g. paravirtualized ticket spinlocks.
>
> Changelog:
> Remove the support for yield_on_hlt.
>
> Signed-off-by: Raghavendra K T<raghavendra.kt@linux.vnet.ibm.com>

Acked-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index d29216c..2fb3009 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -70,9 +70,6 @@ module_param(emulate_invalid_guest_state, bool, S_IRUGO);
>   static bool __read_mostly vmm_exclusive = 1;
>   module_param(vmm_exclusive, bool, S_IRUGO);
>
> -static bool __read_mostly yield_on_hlt = 1;
> -module_param(yield_on_hlt, bool, S_IRUGO);
> -
>   static bool __read_mostly fasteoi = 1;
>   module_param(fasteoi, bool, S_IRUGO);
>
> @@ -1655,17 +1652,6 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
>   	vmx_set_interrupt_shadow(vcpu, 0);
>   }
>
> -static void vmx_clear_hlt(struct kvm_vcpu *vcpu)
> -{
> -	/* Ensure that we clear the HLT state in the VMCS.  We don't need to
> -	 * explicitly skip the instruction because if the HLT state is set, then
> -	 * the instruction is already executing and RIP has already been
> -	 * advanced. */
> -	if (!yield_on_hlt&&
> -	    vmcs_read32(GUEST_ACTIVITY_STATE) == GUEST_ACTIVITY_HLT)
> -		vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE);
> -}
> -
>   /*
>    * KVM wants to inject page-faults which it got to the guest. This function
>    * checks whether in a nested guest, we need to inject them to L1 or L2.
> @@ -1718,7 +1704,6 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
>   		intr_info |= INTR_TYPE_HARD_EXCEPTION;
>
>   	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr_info);
> -	vmx_clear_hlt(vcpu);
>   }
>
>   static bool vmx_rdtscp_supported(void)
> @@ -2399,7 +2384,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
>   				&_pin_based_exec_control)<  0)
>   		return -EIO;
>
> -	min =
> +	min = CPU_BASED_HLT_EXITING |
>   #ifdef CONFIG_X86_64
>   	      CPU_BASED_CR8_LOAD_EXITING |
>   	      CPU_BASED_CR8_STORE_EXITING |
> @@ -2414,9 +2399,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
>   	      CPU_BASED_INVLPG_EXITING |
>   	      CPU_BASED_RDPMC_EXITING;
>
> -	if (yield_on_hlt)
> -		min |= CPU_BASED_HLT_EXITING;
> -
>   	opt = CPU_BASED_TPR_SHADOW |
>   	      CPU_BASED_USE_MSR_BITMAPS |
>   	      CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
> @@ -4003,7 +3985,6 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu)
>   	} else
>   		intr |= INTR_TYPE_EXT_INTR;
>   	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr);
> -	vmx_clear_hlt(vcpu);
>   }
>
>   static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
> @@ -4035,7 +4016,6 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
>   	}
>   	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
>   			INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
> -	vmx_clear_hlt(vcpu);
>   }
>
>   static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] kvm : vmx : Remove yield_on_hlt
  2012-02-07 17:49 [PATCH 1/1] kvm : vmx : Remove yield_on_hlt Raghavendra K T
  2012-02-07 18:04 ` Anthony Liguori
@ 2012-02-07 21:15 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2012-02-07 21:15 UTC (permalink / raw)
  To: Raghavendra K T
  Cc: Anthony Liguori, KVM, H. Peter Anvin, Thomas Gleixner, X86,
	Ingo Molnar, Avi Kivity, LKML, Srivatsa Vaddagiri, Gleb Natapov

On Tue, Feb 07, 2012 at 11:19:20PM +0530, Raghavendra K T wrote:
>   yield_on_hlt was introduced for CPU bandwidth capping. now it is redundant
> with CFS hardlimit.
> 
> yield_on_hlt also complicates the scenario in paravirtual environment, that
> needs to trap halt. for e.g. paravirtualized ticket spinlocks.
> 
> Changelog:
> Remove the support for yield_on_hlt.
> 
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>

Applied, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-07 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 17:49 [PATCH 1/1] kvm : vmx : Remove yield_on_hlt Raghavendra K T
2012-02-07 18:04 ` Anthony Liguori
2012-02-07 21:15 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.