kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>,
	"Christopherson, Sean J" <sean.j.christopherson@intel.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Po-Hsu Lin <po-hsu.lin@canonical.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [kvm-unit-tests PATCHv2] unittests.cfg: Increase timeout for apic test
Date: Tue, 20 Oct 2020 10:48:24 +0200	[thread overview]
Message-ID: <d1277875-6b7a-f7fe-8a58-78ba5ae0ba1d@redhat.com> (raw)
In-Reply-To: <C67F3473-32FE-4099-BBB1-8BB31B1ED95D@gmail.com>

On 19/10/20 18:52, Nadav Amit wrote:
> IIRC, this test failed on VMware, and according to our previous discussions,
> does not follow the SDM as NMIs might be collapsed [1].
> 
> [1] https://marc.info/?l=kvm&m=145876994031502&w=2

So should KVM be changed to always collapse NMIs, like this?

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 105261402921..4032336ecba3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -668,7 +668,7 @@ EXPORT_SYMBOL_GPL(kvm_inject_emulated_page_fault);

 void kvm_inject_nmi(struct kvm_vcpu *vcpu)
 {
-	atomic_inc(&vcpu->arch.nmi_queued);
+	atomic_set(&vcpu->arch.nmi_queued, 1);
 	kvm_make_request(KVM_REQ_NMI, vcpu);
 }
 EXPORT_SYMBOL_GPL(kvm_inject_nmi);
@@ -8304,18 +8304,7 @@ static void inject_pending_event(struct kvm_vcpu
*vcpu, bool *req_immediate_exit

 static void process_nmi(struct kvm_vcpu *vcpu)
 {
-	unsigned limit = 2;
-
-	/*
-	 * x86 is limited to one NMI running, and one NMI pending after it.
-	 * If an NMI is already in progress, limit further NMIs to just one.
-	 * Otherwise, allow two (and we'll inject the first one immediately).
-	 */
-	if (kvm_x86_ops.get_nmi_mask(vcpu) || vcpu->arch.nmi_injected)
-		limit = 1;
-
-	vcpu->arch.nmi_pending += atomic_xchg(&vcpu->arch.nmi_queued, 0);
-	vcpu->arch.nmi_pending = min(vcpu->arch.nmi_pending, limit);
+	vcpu->arch.nmi_pending |= atomic_xchg(&vcpu->arch.nmi_queued, 0);
 	kvm_make_request(KVM_REQ_EVENT, vcpu);
 }


Paolo


  reply	other threads:[~2020-10-20  8:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13  9:12 [kvm-unit-tests PATCHv2] unittests.cfg: Increase timeout for apic test Po-Hsu Lin
2020-10-15 15:59 ` Vitaly Kuznetsov
2020-10-15 16:35   ` Sean Christopherson
2020-10-16 17:02     ` Paolo Bonzini
2020-10-16 17:40       ` Andrew Jones
2020-10-20  5:53         ` Thomas Huth
2020-10-20  8:49           ` Andrew Jones
2020-10-19 11:32     ` Vitaly Kuznetsov
2020-10-19 16:37       ` Christopherson, Sean J
2020-10-19 16:52         ` Nadav Amit
2020-10-20  8:48           ` Paolo Bonzini [this message]
2020-10-20 15:05             ` Christopherson, Sean J
2020-10-30  8:15   ` Po-Hsu Lin

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=d1277875-6b7a-f7fe-8a58-78ba5ae0ba1d@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=po-hsu.lin@canonical.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.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).