From: Paolo Bonzini <pbonzini@redhat.com>
To: Yuki Shibuya <shibuya.yk@ncos.nec.co.jp>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Nobuo Yoshida <yoshida.nb@ncos.nec.co.jp>
Subject: Re: [PATCH v2] KVM: x86: Inject pending interrupt even if pending nmi exist
Date: Wed, 23 Mar 2016 14:18:31 +0100 [thread overview]
Message-ID: <56F297A7.1030309@redhat.com> (raw)
In-Reply-To: <7CC7D3013F4B10479273CE019E6A8C7A3ED90C@BPXM15GP.gisp.nec.co.jp>
On 23/03/2016 06:08, Yuki Shibuya wrote:
> + /* If nmi pending > 0 and injectable interrupts exist,
> + * nmi pending counter is cleared to prevent skipping
> + * injectable pending interrupts.
> + */
> + if (vcpu->arch.nmi_pending && kvm_cpu_has_injectable_intr(vcpu)
> + && kvm_x86_ops->interrupt_allowed(vcpu))
> + vcpu->arch.nmi_pending = 0;
I am not sure I understand this. Why is it safe to drop nmi_pending?
Can we instead do something like this in vcpu_enter_guest?
It would be nice to have a testcase for this in kvm-unit-tests.
Paolo
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7236bd3a4c3d..6c73cbc8e19a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6561,10 +6561,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
if (inject_pending_event(vcpu, req_int_win) != 0)
req_immediate_exit = true;
/* enable NMI/IRQ window open exits if needed */
- else if (vcpu->arch.nmi_pending)
- kvm_x86_ops->enable_nmi_window(vcpu);
- else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
- kvm_x86_ops->enable_irq_window(vcpu);
+ else {
+ if (vcpu->arch.nmi_pending)
+ kvm_x86_ops->enable_nmi_window(vcpu);
+ if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
+ kvm_x86_ops->enable_irq_window(vcpu);
+ }
if (kvm_lapic_enabled(vcpu)) {
update_cr8_intercept(vcpu);
Paolo
next prev parent reply other threads:[~2016-03-23 13:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-23 5:08 [PATCH v2] KVM: x86: Inject pending interrupt even if pending nmi exist Yuki Shibuya
2016-03-23 13:18 ` Paolo Bonzini [this message]
2016-03-23 17:21 ` Radim Krčmář
2016-03-23 18:22 ` Paolo Bonzini
2016-03-23 19:04 ` Radim Krčmář
2016-03-23 21:00 ` Paolo Bonzini
2016-03-23 21:06 ` Jan Kiszka
2016-03-23 21:11 ` Paolo Bonzini
2016-03-23 21:55 ` Radim Krčmář
2016-03-24 5:08 ` Yuki Shibuya
2016-03-24 11:09 ` Paolo Bonzini
2016-03-23 21:52 ` Radim Krčmář
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=56F297A7.1030309@redhat.com \
--to=pbonzini@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=shibuya.yk@ncos.nec.co.jp \
--cc=yoshida.nb@ncos.nec.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.