From: Sean Christopherson <seanjc@google.com>
To: Manali Shukla <manali.shukla@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
nikunj@amd.com
Subject: Re: [PATCH 5/5] KVM: x86: Add fastpath handling of HLT VM-Exits
Date: Tue, 8 Oct 2024 10:39:05 -0700 [thread overview]
Message-ID: <ZwVuOcRujpzo9yTb@google.com> (raw)
In-Reply-To: <13d192bf-8151-415f-b508-7a4ebe4766f2@amd.com>
On Tue, Oct 08, 2024, Manali Shukla wrote:
> Hi Sean,
>
> On 8/3/2024 1:21 AM, Sean Christopherson wrote:
> > Add a fastpath for HLT VM-Exits by immediately re-entering the guest if
> > it has a pending wake event. When virtual interrupt delivery is enabled,
> > i.e. when KVM doesn't need to manually inject interrupts, this allows KVM
> > to stay in the fastpath run loop when a vIRQ arrives between the guest
> > doing CLI and STI;HLT. Without AMD's Idle HLT-intercept support, the CPU
> > generates a HLT VM-Exit even though KVM will immediately resume the guest.
> >
> > Note, on bare metal, it's relatively uncommon for a modern guest kernel to
> > actually trigger this scenario, as the window between the guest checking
> > for a wake event and committing to HLT is quite small. But in a nested
> > environment, the timings change significantly, e.g. rudimentary testing
> > showed that ~50% of HLT exits where HLT-polling was successful would be
> > serviced by this fastpath, i.e. ~50% of the time that a nested vCPU gets
> > a wake event before KVM schedules out the vCPU, the wake event was pending
> > even before the VM-Exit.
> >
>
> Could you please help me with the test case that resulted in an approximately
> 50% improvement for the nested scenario?
It's not a 50% improvement, it was simply an observation that ~50% of the time
_that HLT-polling is successful_, the wake event was already pending when the
VM-Exit occurred. That is _wildly_ different than a "50% improvement".
As for the test case, it's simply running a lightly loaded VM as L2.
next prev parent reply other threads:[~2024-10-08 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 19:51 [PATCH 0/5] KVM: x86: Fastpath cleanup, fix, and enhancement Sean Christopherson
2024-08-02 19:51 ` [PATCH 1/5] KVM: x86: Re-enter guest if WRMSR(X2APIC_ICR) fastpath is successful Sean Christopherson
2024-09-02 9:58 ` Paolo Bonzini
2024-09-03 15:09 ` Sean Christopherson
2024-09-03 16:49 ` Paolo Bonzini
2024-09-03 16:58 ` Sean Christopherson
2024-08-02 19:51 ` [PATCH 2/5] KVM: x86: Dedup fastpath MSR post-handling logic Sean Christopherson
2024-08-02 19:51 ` [PATCH 3/5] KVM: x86: Exit to userspace if fastpath triggers one on instruction skip Sean Christopherson
2024-08-02 19:51 ` [PATCH 4/5] KVM: x86: Reorganize code in x86.c to co-locate vCPU blocking/running helpers Sean Christopherson
2024-08-02 19:51 ` [PATCH 5/5] KVM: x86: Add fastpath handling of HLT VM-Exits Sean Christopherson
2024-10-08 5:22 ` Manali Shukla
2024-10-08 17:39 ` Sean Christopherson [this message]
2024-08-31 0:20 ` [PATCH 0/5] KVM: x86: Fastpath cleanup, fix, and enhancement Sean Christopherson
2024-09-02 10:00 ` Paolo Bonzini
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=ZwVuOcRujpzo9yTb@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manali.shukla@amd.com \
--cc=nikunj@amd.com \
--cc=pbonzini@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