From: Manali Shukla <manali.shukla@amd.com>
To: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org,
nikunj@amd.com, thomas.lendacky@amd.com, vkuznets@redhat.com,
bp@alien8.de, babu.moger@amd.com
Subject: Re: [PATCH v4 0/4] Add support for the Idle HLT intercept feature
Date: Thu, 28 Nov 2024 20:39:30 +0530 [thread overview]
Message-ID: <5331cf45-230d-4d27-abc9-e5d92e5a6c11@amd.com> (raw)
In-Reply-To: <20241022054810.23369-1-manali.shukla@amd.com>
On 10/22/2024 11:18 AM, Manali Shukla wrote:
> The upcoming new Idle HLT Intercept feature allows for the HLT
> instruction execution by a vCPU to be intercepted by the hypervisor
> only if there are no pending V_INTR and V_NMI events for the vCPU.
> When the vCPU is expected to service the pending V_INTR and V_NMI
> events, the Idle HLT intercept won’t trigger. The feature allows the
> hypervisor to determine if the vCPU is actually idle and reduces
> wasteful VMEXITs.
>
> The idle HLT intercept feature is used for enlightened guests who wish
> to securely handle the events. When an enlightened guest does a HLT
> while an interrupt is pending, hypervisor will not have a way to
> figure out whether the guest needs to be re-entered or not. The Idle
> HLT intercept feature allows the HLT execution only if there are no
> pending V_INTR and V_NMI events.
>
> Presence of the Idle HLT Intercept feature is indicated via CPUID
> function Fn8000_000A_EDX[30].
>
> Document for the Idle HLT intercept feature is available at [1].
>
> This series is based on kvm-next/next (64dbb3a771a1) + [2].
>
> Experiments done:
> ----------------
>
> kvm_amd.avic is set to '0' for this experiment.
>
> The below numbers represent the average of 10 runs.
>
> Normal guest (L1)
> The below netperf command was run on the guest with smp = 1 (pinned).
>
> netperf -H <host ip> -t TCP_RR -l 60
> ----------------------------------------------------------------
> |with Idle HLT(transactions/Sec)|w/o Idle HLT(transactions/Sec)|
> ----------------------------------------------------------------
> | 25645.7136 | 25773.2796 |
> ----------------------------------------------------------------
>
> Number of transactions/sec with and without idle HLT intercept feature
> are almost same.
>
> Nested guest (L2)
> The below netperf command was run on L2 guest with smp = 1 (pinned).
>
> netperf -H <host ip> -t TCP_RR -l 60
> ----------------------------------------------------------------
> |with Idle HLT(transactions/Sec)|w/o Idle HLT(transactions/Sec)|
> ----------------------------------------------------------------
> | 5655.4468 | 5755.2189 |
> ----------------------------------------------------------------
>
> Number of transactions/sec with and without idle HLT intercept feature
> are almost same.
>
> Testing Done:
> - Tested the functionality for the Idle HLT intercept feature
> using selftest svm_idle_hlt_test.
> - Tested SEV and SEV-ES guest for the Idle HLT intercept functionality.
> - Tested the Idle HLT intercept functionality on nested guest.
>
> v3 -> v4
> - Drop the patches to add vcpu_get_stat() into a new series [2].
> - Added nested Idle HLT intercept support.
>
> v2 -> v3
> - Incorporated Andrew's suggestion to structure vcpu_stat_types in
> a way that each architecture can share the generic types and also
> provide its own.
>
> v1 -> v2
> - Done changes in svm_idle_hlt_test based on the review comments from Sean.
> - Added an enum based approach to get binary stats in vcpu_get_stat() which
> doesn't use string to get stat data based on the comments from Sean.
> - Added self_halt() and cli() helpers based on the comments from Sean.
>
> [1]: AMD64 Architecture Programmer's Manual Pub. 24593, April 2024,
> Vol 2, 15.9 Instruction Intercepts (Table 15-7: IDLE_HLT).
> https://bugzilla.kernel.org/attachment.cgi?id=306250
>
> [2]: https://lore.kernel.org/kvm/20241021062226.108657-1-manali.shukla@amd.com/T/#t
>
> Manali Shukla (4):
> x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept
> KVM: SVM: Add Idle HLT intercept support
> KVM: nSVM: implement the nested idle halt intercept
> KVM: selftests: KVM: SVM: Add Idle HLT intercept test
>
> arch/x86/include/asm/cpufeatures.h | 1 +
> arch/x86/include/asm/svm.h | 1 +
> arch/x86/include/uapi/asm/svm.h | 2 +
> arch/x86/kvm/governed_features.h | 1 +
> arch/x86/kvm/svm/nested.c | 7 ++
> arch/x86/kvm/svm/svm.c | 15 +++-
> tools/testing/selftests/kvm/Makefile | 1 +
> .../selftests/kvm/include/x86_64/processor.h | 1 +
> .../selftests/kvm/x86_64/svm_idle_hlt_test.c | 89 +++++++++++++++++++
> 9 files changed, 115 insertions(+), 3 deletions(-)
> create mode 100644 tools/testing/selftests/kvm/x86_64/svm_idle_hlt_test.c
>
>
> base-commit: c8d430db8eec7d4fd13a6bea27b7086a54eda6da
> prerequisite-patch-id: ca912571db5c004f77b70843b8dd35517ff1267f
> prerequisite-patch-id: 164ea3b4346f9e04bc69819278d20f5e1b5df5ed
> prerequisite-patch-id: 90d870f426ebc2cec43c0dd89b701ee998385455
> prerequisite-patch-id: 45812b799c517a4521782a1fdbcda881237e1eda
A gentle reminder.
-Manali
next prev parent reply other threads:[~2024-11-28 15:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 5:48 [PATCH v4 0/4] Add support for the Idle HLT intercept feature Manali Shukla
2024-10-22 5:48 ` [PATCH v4 1/4] x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept Manali Shukla
2024-10-22 9:32 ` Borislav Petkov
2024-10-22 15:08 ` Sean Christopherson
2024-10-22 5:48 ` [PATCH v4 2/4] KVM: SVM: Add Idle HLT intercept support Manali Shukla
2024-10-22 5:48 ` [PATCH v4 3/4] KVM: nSVM: implement the nested idle halt intercept Manali Shukla
2024-12-20 1:01 ` Sean Christopherson
2024-12-30 7:05 ` Manali Shukla
2024-12-30 7:14 ` Manali Shukla
2024-10-22 5:48 ` [PATCH v4 4/4] KVM: selftests: KVM: SVM: Add Idle HLT intercept test Manali Shukla
2024-12-20 1:24 ` Sean Christopherson
2024-12-30 7:10 ` Manali Shukla
2024-11-28 15:09 ` Manali Shukla [this message]
2024-12-12 16:37 ` [PATCH v4 0/4] Add support for the Idle HLT intercept feature Manali Shukla
2024-12-23 9:13 ` Manali Shukla
2024-12-23 9:27 ` Manali Shukla
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=5331cf45-230d-4d27-abc9-e5d92e5a6c11@amd.com \
--to=manali.shukla@amd.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=thomas.lendacky@amd.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