kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections
@ 2010-05-11 13:16 Jan Kiszka
  2010-05-11 13:46 ` Gleb Natapov
  2010-05-12 20:05 ` Marcelo Tosatti
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2010-05-11 13:16 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Gleb Natapov

As the processor may not consider GUEST_INTR_STATE_STI as a reason for
blocking NMI, it could return immediately with EXIT_REASON_NMI_WINDOW
when we asked for it. But as we consider this state as NMI-blocking, we
can run into an endless loop.

Resolve this by allowing NMI injection if just GUEST_INTR_STATE_STI is
active (originally suggested by Gleb). Intel confirmed that this is
safe, the processor will never complain about NMI injection in this
state.

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

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 777e00d..fa3959b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2824,8 +2824,7 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
 		return 0;
 
 	return	!(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
-			(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS |
-				GUEST_INTR_STATE_NMI));
+			(GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_NMI));
 }
 
 static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu)


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

* Re: [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections
  2010-05-11 13:16 [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections Jan Kiszka
@ 2010-05-11 13:46 ` Gleb Natapov
  2010-05-12 20:05 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2010-05-11 13:46 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Tue, May 11, 2010 at 03:16:46PM +0200, Jan Kiszka wrote:
> As the processor may not consider GUEST_INTR_STATE_STI as a reason for
> blocking NMI, it could return immediately with EXIT_REASON_NMI_WINDOW
> when we asked for it. But as we consider this state as NMI-blocking, we
> can run into an endless loop.
> 
> Resolve this by allowing NMI injection if just GUEST_INTR_STATE_STI is
> active (originally suggested by Gleb). Intel confirmed that this is
> safe, the processor will never complain about NMI injection in this
> state.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Gleb Natapov<gleb@redhat.com>

> KVM-Stable-Tag
> ---
>  arch/x86/kvm/vmx.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 777e00d..fa3959b 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2824,8 +2824,7 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
>  		return 0;
>  
>  	return	!(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
> -			(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS |
> -				GUEST_INTR_STATE_NMI));
> +			(GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_NMI));
>  }
>  
>  static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu)

--
			Gleb.

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

* Re: [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections
  2010-05-11 13:16 [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections Jan Kiszka
  2010-05-11 13:46 ` Gleb Natapov
@ 2010-05-12 20:05 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2010-05-12 20:05 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, kvm, Gleb Natapov

On Tue, May 11, 2010 at 03:16:46PM +0200, Jan Kiszka wrote:
> As the processor may not consider GUEST_INTR_STATE_STI as a reason for
> blocking NMI, it could return immediately with EXIT_REASON_NMI_WINDOW
> when we asked for it. But as we consider this state as NMI-blocking, we
> can run into an endless loop.
> 
> Resolve this by allowing NMI injection if just GUEST_INTR_STATE_STI is
> active (originally suggested by Gleb). Intel confirmed that this is
> safe, the processor will never complain about NMI injection in this
> state.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> KVM-Stable-Tag
> ---
>  arch/x86/kvm/vmx.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)

Applied, thanks.


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

end of thread, other threads:[~2010-05-12 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 13:16 [PATCH] KVM: VMX: blocked-by-sti must not defer NMI injections Jan Kiszka
2010-05-11 13:46 ` Gleb Natapov
2010-05-12 20:05 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).