From: Gleb Natapov <gleb@qumranet.com>
To: jan.kiszka@siemens.com
Cc: kvm@vger.kernel.org, sheng.yang@intel.com, avi@redhat.com,
gleb@redhat.com
Subject: Re: [PATCH 03/14] KVM: VMX: Support for NMI task gates
Date: Sun, 28 Sep 2008 13:53:10 +0300 [thread overview]
Message-ID: <20080928105310.GB32558@minantech.com> (raw)
In-Reply-To: <20080926073045.057397411@mchn012c.ww002.siemens.net>
On Fri, Sep 26, 2008 at 09:30:47AM +0200, jan.kiszka@siemens.com wrote:
> Properly set GUEST_INTR_STATE_NMI and reset nmi_injected when a
> task-switch vmexit happened due to a task gate being used for handling
> NMIs. Also avoid the false warning about valid vectoring info in
> kvm_handle_exit.
>
> Based on original patch by Gleb Natapov.
>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> arch/x86/kvm/vmx.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> Index: b/arch/x86/kvm/vmx.c
> ===================================================================
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2819,6 +2819,7 @@ static int handle_apic_access(struct kvm
>
> static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> {
> + struct vcpu_vmx *vmx = to_vmx(vcpu);
> unsigned long exit_qualification;
> u16 tss_selector;
> int reason;
> @@ -2826,6 +2827,15 @@ static int handle_task_switch(struct kvm
> exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
>
> reason = (u32)exit_qualification >> 30;
> + if (reason == TASK_SWITCH_GATE && vmx->vcpu.arch.nmi_injected &&
> + (vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK) &&
> + (vmx->idt_vectoring_info & VECTORING_INFO_TYPE_MASK)
> + == INTR_TYPE_NMI_INTR) {
> + vcpu->arch.nmi_injected = false;
> + if (cpu_has_virtual_nmis())
> + vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
> + GUEST_INTR_STATE_NMI);
> + }
> tss_selector = exit_qualification;
>
> return kvm_task_switch(vcpu, tss_selector, reason);
> @@ -2998,9 +3008,11 @@ static int kvm_handle_exit(struct kvm_ru
>
> if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
> (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
> - exit_reason != EXIT_REASON_EPT_VIOLATION))
> - printk(KERN_WARNING "%s: unexpected, valid vectoring info and "
> - "exit reason is 0x%x\n", __func__, exit_reason);
> + exit_reason != EXIT_REASON_EPT_VIOLATION &&
> + exit_reason != EXIT_REASON_TASK_SWITCH))
> + printk(KERN_WARNING "%s: unexpected, valid vectoring info "
> + "(0x%x) and exit reason is 0x%x\n",
> + __func__, vectoring_info, exit_reason);
> if (exit_reason < kvm_vmx_max_exit_handlers
> && kvm_vmx_exit_handlers[exit_reason])
> return kvm_vmx_exit_handlers[exit_reason](vcpu, kvm_run);
--
Gleb.
next prev parent reply other threads:[~2008-09-28 10:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 7:30 [PATCH 00/14] Fix & enhance NMI support for KVM - v4 jan.kiszka
2008-09-26 7:30 ` [PATCH 01/14] KVM: VMX: include all IRQ window exits in statistics jan.kiszka
2008-09-26 7:30 ` [PATCH 02/14] KVM: VMX: Use INTR_TYPE_NMI_INTR instead of magic value jan.kiszka
2008-09-26 7:30 ` [PATCH 03/14] KVM: VMX: Support for NMI task gates jan.kiszka
2008-09-28 10:53 ` Gleb Natapov [this message]
2008-09-26 7:30 ` [PATCH 04/14] KVM: x86: Reset pending/inject NMI state on CPU reset jan.kiszka
2008-09-28 10:53 ` Gleb Natapov
2008-09-26 7:30 ` [PATCH 05/14] KVM: VMX: refactor/fix IRQ and NMI injectability determination jan.kiszka
2008-09-26 7:30 ` [PATCH 06/14] KVM: VMX: refactor IRQ and NMI window enabling jan.kiszka
2008-09-26 7:30 ` [PATCH 07/14] KVM: VMX: fix real-mode NMI support jan.kiszka
2008-09-26 7:30 ` [PATCH 08/14] KVM: x86: Enable NMI Watchdog via in-kernel PIT source jan.kiszka
2008-09-28 9:40 ` Avi Kivity
2008-09-28 10:01 ` Jan Kiszka
2008-09-26 7:30 ` [PATCH 09/14] KVM: x86: VCPU with pending NMI is runnabled jan.kiszka
2008-09-26 7:30 ` [PATCH 10/14] KVM: Kick NMI receiving VCPU jan.kiszka
2008-09-26 7:30 ` [PATCH 11/14] KVM: x86: Support for user space injected NMIs jan.kiszka
2008-09-26 7:30 ` [PATCH 12/14] KVM: VMX: Provide support " jan.kiszka
2008-09-26 7:30 ` [PATCH 13/14] KVM: VMX: work around lacking VNMI support jan.kiszka
2008-09-26 7:30 ` [PATCH 14/14] kvm-userspace: Enable NMI support for user space irqchip jan.kiszka
2008-09-28 9:45 ` [PATCH 00/14] Fix & enhance NMI support for KVM - v4 Avi Kivity
2008-09-28 10:00 ` Jan Kiszka
2008-09-28 10:05 ` Gleb Natapov
2008-09-28 10:57 ` Gleb Natapov
2008-09-30 17:00 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080928105310.GB32558@minantech.com \
--to=gleb@qumranet.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=sheng.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).