Linux Kernel Selftest development
 help / color / mirror / Atom feed
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>, <manali.shukla@amd.com>, <bp@alien8.de>,
	<ajones@ventanamicro.com>
Subject: [PATCH v3 0/5] Add support for the Idle HLT intercept feature
Date: Tue, 28 May 2024 04:19:21 +0000	[thread overview]
Message-ID: <20240528041926.3989-1-manali.shukla@amd.com> (raw)

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.

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].

[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

Testing Done:
- Added a selftest to test the Idle HLT intercept functionality.
- Compile and functionality testing for the Idle HLT intercept selftest
  are only done for x86_64.
- Tested SEV and SEV-ES guest for the Idle HLT intercept functionality.

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.

Manali Shukla (5):
  x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept
  KVM: SVM: Add Idle HLT intercept support
  KVM: selftests: Add safe_halt() and cli() helpers to common code
  KVM: selftests: Add an interface to read the data of named vcpu stat
  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/svm/svm.c                        | 11 ++-
 tools/testing/selftests/kvm/Makefile          |  1 +
 .../testing/selftests/kvm/include/kvm_util.h  | 44 +++++++++
 .../kvm/include/x86_64/kvm_util_arch.h        | 40 +++++++++
 .../selftests/kvm/include/x86_64/processor.h  | 18 ++++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 32 +++++++
 .../selftests/kvm/x86_64/svm_idle_hlt_test.c  | 89 +++++++++++++++++++
 10 files changed, 236 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/svm_idle_hlt_test.c


base-commit: d91a9cc16417b8247213a0144a1f0fd61dc855dd
-- 
2.34.1


             reply	other threads:[~2024-05-28  4:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  4:19 Manali Shukla [this message]
2024-05-28  4:19 ` [PATCH v3 1/5] x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept Manali Shukla
2024-05-28  7:42   ` Borislav Petkov
2024-05-28  4:19 ` [PATCH v3 2/5] KVM: SVM: Add Idle HLT intercept support Manali Shukla
2024-05-28  4:19 ` [PATCH v3 3/5] KVM: selftests: Add safe_halt() and cli() helpers to common code Manali Shukla
2024-05-28  4:19 ` [PATCH v3 4/5] KVM: selftests: Add an interface to read the data of named vcpu stat Manali Shukla
2024-08-13 16:37   ` Sean Christopherson
2024-10-22  5:49     ` Manali Shukla
2024-05-28  4:19 ` [PATCH v3 5/5] KVM: selftests: KVM: SVM: Add Idle HLT intercept test Manali Shukla
2024-05-28  7:46   ` Chao Gao
2024-05-30 13:19     ` Manali Shukla
2024-05-31  6:49       ` Chao Gao
2024-06-19 17:09         ` Manali Shukla
2024-08-13 15:38         ` Sean Christopherson
2024-08-13 16:03           ` Sean Christopherson
2024-05-28 10:22 ` [PATCH v3 0/5] Add support for the Idle HLT intercept feature Paolo Bonzini
2024-06-04  0:47   ` Sean Christopherson
2024-06-04 13:21     ` Manali Shukla
2024-06-04 12:23   ` Manali Shukla
2024-08-13 16:19     ` Sean Christopherson
2024-10-22 10:35       ` 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=20240528041926.3989-1-manali.shukla@amd.com \
    --to=manali.shukla@amd.com \
    --cc=ajones@ventanamicro.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