From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Mingwei Zhang <mizhang@google.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>, Like Xu <likexu@tencent.com>,
Kan Liang <kan.liang@intel.com>,
Dapeng1 Mi <dapeng1.mi@intel.com>, Xin Li <xin@zytor.com>
Subject: Re: [PATCH v2] KVM: x86: Service NMI requests after PMI requests in VM-Enter path
Date: Fri, 20 Oct 2023 15:56:29 -0700 [thread overview]
Message-ID: <169766419668.1911126.2774635531681023250.b4-ty@google.com> (raw)
In-Reply-To: <20231002040839.2630027-1-mizhang@google.com>
On Mon, 02 Oct 2023 04:08:39 +0000, Mingwei Zhang wrote:
> Service NMI requests after PMI requests in vcpu_enter_guest() so that KVM
> does not need to cancel and redo the VM-Enter. Because APIC emulation
> "injects" NMIs via KVM_REQ_NMI, handling PMI requests after NMI requests
> means KVM won't detect the pending NMI request until the final check for
> outstanding requests. Detecting requests at the final stage is costly as
> KVM has already loaded guest state, potentially queued events for
> injection, disabled IRQs, dropped SRCU, etc., most of which needs to be
> unwound.
>
> [...]
Applied to kvm-x86 pmu, thanks!
I made a tweak to the code and massaged one part of the changelog. For the
code, I hoisted PMU/PMI above SMI too, mainly to keep SMI+NMI together, but
also because *technically* the guest could configure LVTPC to send an SMI (LOL).
Regarding the changelog, I replaced the justification about correctness with
this:
Note that changing the order of request processing doesn't change the end
result, as KVM's final check for outstanding requests prevents entering
the guest until all requests are serviced. I.e. KVM will ultimately
coalesce events (or not) regardless of the ordering.
The architectural behavior of NMIs and KVM's unintuitive simultaneous NMI
handling simply doesn't matter as far as this patch is concerned, especially
when considering the SMI technicality. E.g. the net effect would be the same
even if KVM allowed only a single NMIs.
Please holler if you disagree with either/both of the above changes.
[1/1] KVM: x86: Service NMI requests after PMI requests in VM-Enter path
https://github.com/kvm-x86/linux/commit/4b09cc132a59
--
https://github.com/kvm-x86/linux/tree/next
next prev parent reply other threads:[~2023-10-20 22:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 4:08 Mingwei Zhang
2023-10-20 22:56 ` Sean Christopherson [this message]
2023-10-21 2:36 ` Mingwei Zhang
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=169766419668.1911126.2774635531681023250.b4-ty@google.com \
--to=seanjc@google.com \
--cc=dapeng1.mi@intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=kan.liang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=likexu@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=xin@zytor.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
all inboxes | Powered by JetHome®