From: Gleb Natapov <gleb@qumranet.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Yang, Sheng" <sheng.yang@intel.com>,
kvm-devel <kvm@vger.kernel.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [PATCH 10/11] VMX: work around lacking VNMI support
Date: Wed, 24 Sep 2008 15:50:57 +0300 [thread overview]
Message-ID: <20080924125057.GF3072@minantech.com> (raw)
In-Reply-To: <48DA3532.9040306@siemens.com>
On Wed, Sep 24, 2008 at 02:40:18PM +0200, Jan Kiszka wrote:
> Yang, Sheng wrote:
> > On Tuesday 23 September 2008 17:45:44 Gleb Natapov wrote:
> >> On Tue, Sep 23, 2008 at 05:42:02PM +0800, Yang, Sheng wrote:
> >>>>> That is exactly what I am using. Run it with SMP hal and do
> >>>>> hibernate.
> >>>> Oh... Finally found how to enable that hibernate option....
> >>>>
> >>>> And this hibernate works on my virtual_nmi supported box, with smp hal
> >>>> and 2 cpus.
> >>> However, for this hibernate won't success if there is no NMI support,
> >>> maybe we can say it's not a "regression"...
> >> I am not saying it's a regression, but it would be nice to have it
> >> working :)
> >>
> > Yeah, of course. :)
>
> OK, I've a 2003 server up and running now, I'm able to reproduce
>
> kvm_handle_exit: unexpected, valid vectoring info and exit reason is 0x9
>
> but not via hibernate (it suspends and powers off normally, but then
> hangs after resume), rather by manually injecting an NMI on CPU0.
>
I found out today that on regular windows 2003 the problem does not
exist (on hibernate at least). The image I have was used to run WLK
tests (windows logo kit) and this kit changes something in windows
kernel to do additional stuff after hibernation and that is where we
crash.
>
> After Windows' graphical installation phase I had a hanging guest. At
> the same time I got
>
> kvm_handle_exit: unexpected, valid vectoring info and exit reason is 0x9
> kvm_handle_exit: Breaking out of NMI-blocked state on VCPU 0 after 1 s
> timeout
>
> in the kernel log as well. Something is borken. Will retest the
> installation with vanilla KVM. Anyone any ideas on the task switch
> thing? Just a false positive or an indication for the real problem in
> that domain?
>
Nothing is broken IMO. The IDT entry for NMI is set up as task gate so
we get a task switch exit after NMI injection.
We should do something like this:
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 046a91b..860e66d 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2826,10 +2826,20 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
unsigned long exit_qualification;
u16 tss_selector;
int reason;
+ struct vcpu_vmx *vmx = to_vmx(vcpu);
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;
+ vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
+ GUEST_INTR_STATE_NMI);
+ printk(KERN_DEBUG"NMI cause task switch. No need to reinject\n");
+ }
tss_selector = exit_qualification;
return kvm_task_switch(vcpu, tss_selector, reason);
@@ -3002,7 +3012,8 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
(exit_reason != EXIT_REASON_EXCEPTION_NMI &&
- exit_reason != EXIT_REASON_EPT_VIOLATION))
+ exit_reason != EXIT_REASON_EPT_VIOLATION &&
+ exit_reason != EXIT_REASON_TASK_SWITCH))
printk(KERN_WARNING "%s: unexpected, valid vectoring info and "
"exit reason is 0x%x\n", __func__, exit_reason);
if (exit_reason < kvm_vmx_max_exit_handlers
--
Gleb.
next prev parent reply other threads:[~2008-09-24 12:50 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-22 7:44 [PATCH 0/11] Fix&Enhance NMI support for KVM - v3 Jan Kiszka
2008-09-22 7:58 ` [PATCH 1/11] VMX: include all IRQ window exits in statistics Jan Kiszka
2008-09-22 7:58 ` [PATCH 2/11] VMX: refactor/fix IRQ and NMI injectability determination Jan Kiszka
2008-09-22 7:58 ` [PATCH 3/11] VMX: refactor IRQ and NMI window enabling Jan Kiszka
2008-09-22 7:58 ` [PATCH 5/11] kvm-x86: Enable NMI Watchdog via in-kernel PIT source Jan Kiszka
2008-09-22 7:58 ` [PATCH 6/11] kvm-x86: VCPU with pending NMI is runnabled Jan Kiszka
2008-09-22 7:58 ` [PATCH 7/11] kvm: kick NMI receiving VCPU Jan Kiszka
2008-09-22 7:58 ` [PATCH 8/11] kvm-x86: Support for user space injected NMIs Jan Kiszka
2008-09-22 7:59 ` [PATCH 9/11] VMX: Provide support " Jan Kiszka
2008-09-23 6:28 ` Yang, Sheng
2008-09-23 15:42 ` Jan Kiszka
2008-09-22 7:59 ` [PATCH 10/11] VMX: work around lacking VNMI support Jan Kiszka
2008-09-22 14:15 ` Gleb Natapov
2008-09-23 8:46 ` Jan Kiszka
2008-09-23 8:50 ` Gleb Natapov
2008-09-23 8:57 ` Jan Kiszka
2008-09-23 9:00 ` Gleb Natapov
2008-09-23 9:08 ` Yang, Sheng
2008-09-23 9:15 ` Gleb Natapov
2008-09-23 9:24 ` Yang, Sheng
2008-09-23 9:26 ` Gleb Natapov
2008-09-23 9:37 ` Yang, Sheng
2008-09-23 9:42 ` Yang, Sheng
2008-09-23 9:45 ` Gleb Natapov
2008-09-23 9:50 ` Yang, Sheng
2008-09-24 12:40 ` Jan Kiszka
2008-09-24 12:44 ` Avi Kivity
2008-09-24 12:50 ` Gleb Natapov [this message]
2008-09-24 12:56 ` Jan Kiszka
2008-09-24 13:02 ` Gleb Natapov
2008-09-24 13:08 ` Jan Kiszka
2008-09-24 13:24 ` Gleb Natapov
2008-09-24 13:33 ` Jan Kiszka
2008-09-24 13:35 ` Gleb Natapov
2008-09-24 13:35 ` Avi Kivity
2008-09-24 14:07 ` Jan Kiszka
2008-09-24 14:19 ` Avi Kivity
2008-09-24 13:11 ` Jan Kiszka
2008-09-24 13:17 ` Gleb Natapov
2008-09-24 13:20 ` Gleb Natapov
2008-09-24 13:39 ` Jan Kiszka
2008-09-24 14:48 ` Gleb Natapov
2008-09-23 9:27 ` Yang, Sheng
2008-09-23 15:15 ` Jan Kiszka
2008-09-25 9:41 ` Jan Kiszka
2008-09-25 10:31 ` Avi Kivity
2008-09-25 14:22 ` Jan Kiszka
2008-09-27 10:57 ` Avi Kivity
2008-09-22 7:59 ` [PATCH 11/11] kvm: Enable NMI support for userspace irqchip Jan Kiszka
2008-09-22 8:00 ` [PATCH 4/11] VMX: fix real-mode NMI support Jan Kiszka
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=20080924125057.GF3072@minantech.com \
--to=gleb@qumranet.com \
--cc=avi@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).