public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang@intel.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: [RFC][PATCH 3/4] KVM: VMX: Enable NMI with in-kernel irqchip
Date: Tue, 13 May 2008 14:42:17 +0800	[thread overview]
Message-ID: <200805131442.17666.sheng.yang@intel.com> (raw)
In-Reply-To: <4827F798.7040208@qumranet.com>

On Monday 12 May 2008 15:54:00 Avi Kivity wrote:
> Yang, Sheng wrote:
> > On Friday 09 May 2008 23:49:13 Avi Kivity wrote:
> >> Yang, Sheng wrote:
> >>> From 4942a5c35c97e5edb6fe1303e04fb86f25cac345 Mon Sep 17 00:00:00 2001
> >>> From: Sheng Yang <sheng.yang@intel.com>
> >>> Date: Thu, 8 May 2008 16:00:57 +0800
> >>> Subject: [PATCH 3/4] KVM: VMX: Enable NMI with in-kernel irqchip
> >>>
> >>>
> >>>  static void kvm_do_inject_irq(struct kvm_vcpu *vcpu)
> >>>  {
> >>>  	int word_index = __ffs(vcpu->arch.irq_summary);
> >>> @@ -2146,9 +2159,11 @@ static void do_interrupt_requests(struct
> >>> kvm_vcpu *vcpu,
> >>>  		/*
> >>>  		 * Interrupts blocked.  Wait for unblock.
> >>>  		 */
> >>> -		cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
> >>> +		cpu_based_vm_exec_control |=
> >>> +			CPU_BASED_VIRTUAL_INTR_PENDING;
> >>>  	else
> >>> -		cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
> >>> +		cpu_based_vm_exec_control &=
> >>> +			~CPU_BASED_VIRTUAL_INTR_PENDING;
> >>
> >> This seems spurious.
> >
> > Sorry, seems I am too anxious to keep it in hand... I would like to check
> > it much careful in the future.
> >
> >>>  	/* We need to handle NMIs before interrupts are enabled */
> >>> -	if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) { /* nmi */
> >>> +	if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == 0x200) {
> >>>  		KVMTRACE_0D(NMI, vcpu, handler);
> >>> -		asm("int $2");
> >>> +		if (!cpu_has_virtual_nmis())
> >>> +			asm("int $2");
> >>>  	}
> >>>  }
> >>
> >> That's a host nmi.  So does the PIN_BASED_VIRTUAL_NMI mean NMIs are
> >> handled like unacked host interrupts?
> >
> > Not exactly. No host NMI here if Virtual_NMI is set. Copy from SDM 3B
> > table 20-5:
> >
> > "If this control(Virtual NMIs) is 1, NMIs are never blocked and the
> > “blocking by NMI” bit (bit 3) in the interruptibility-state field
> > indicates “virtual-NMI blocking” (see Table 20-3). This control also
> > interacts with the “NMI-window exiting” VM-execution control (see Section
> > 20.6.2)."
>
> I still don't understand.  What does "NMIs are never blocked" mean?
> what happens if an NMI occurs while in guest mode?  Obviously we don't
> want it to be delivered to the guest.

Oops, I neglected it... When virtual_nmi is set, the host NMI would routed to 
handle_exception. And we would handle it there, by judged the vector number.

I will posted the updated patchset soon. 

-- 
Thanks
Yang, Sheng

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  reply	other threads:[~2008-05-13  6:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  8:55 [RFC][PATCH 3/4] KVM: VMX: Enable NMI with in-kernel irqchip Yang, Sheng
2008-05-09 15:49 ` Avi Kivity
2008-05-12  5:19   ` Yang, Sheng
2008-05-12  7:54     ` Avi Kivity
2008-05-13  6:42       ` Yang, Sheng [this message]
2008-05-13  7:24         ` Yang, Sheng

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=200805131442.17666.sheng.yang@intel.com \
    --to=sheng.yang@intel.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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