diff mbox

KVM: x86: Check KVM_REQ_IMMEDIATE_EXIT after enable_irq_window

Message ID 517CCE8E.6010805@web.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka April 28, 2013, 7:23 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

The VMX implementation of enable_irq_window will raise
KVM_REQ_IMMEDIATE_EXIT if an interrupt window shall be opened during
nested vmrun. We have to transfer this request into the local variable
to avoid looping over a continuously re-asserted request on vmentry.

This issue only affects nested VMX scenarios.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/x86.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Gleb Natapov April 28, 2013, 8:29 a.m. UTC | #1
On Sun, Apr 28, 2013 at 09:23:58AM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> The VMX implementation of enable_irq_window will raise
> KVM_REQ_IMMEDIATE_EXIT if an interrupt window shall be opened during
> nested vmrun. We have to transfer this request into the local variable
> to avoid looping over a continuously re-asserted request on vmentry.
> 
> This issue only affects nested VMX scenarios.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
So KVM_REQ_IMMEDIATE_EXIT does not behave like request bit should. What
about dropping it and letting enable_irq_window() return true if
immediate exit is needed.

> ---
>  arch/x86/kvm/x86.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 2a434bf..57ff14a 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5759,6 +5759,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
>  		else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
>  			kvm_x86_ops->enable_irq_window(vcpu);
>  
> +		req_immediate_exit =
> +			kvm_check_request(KVM_REQ_IMMEDIATE_EXIT, vcpu);
> +
The code will become:
   req_immediate_exit = kvm_x86_ops->enable_irq_window(vcpu);

>  		if (kvm_lapic_enabled(vcpu)) {
>  			/*
>  			 * Update architecture specific hints for APIC
> -- 
> 1.7.3.4

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2a434bf..57ff14a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5759,6 +5759,9 @@  static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 		else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
 			kvm_x86_ops->enable_irq_window(vcpu);
 
+		req_immediate_exit =
+			kvm_check_request(KVM_REQ_IMMEDIATE_EXIT, vcpu);
+
 		if (kvm_lapic_enabled(vcpu)) {
 			/*
 			 * Update architecture specific hints for APIC