On 1/18/2025 7:11 PM, Manali Shukla wrote: > On 1/3/2025 1:48 PM, 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-x86/next (13e98294d7ce) + [2] + [3]. >> >> Testing Done: >> - Tested the functionality for the Idle HLT intercept feature >> using selftest ipi_hlt_test. >> - Tested on normal, SEV, SEV-ES, SEV-SNP guest for the Idle HLT intercept >> functionality. >> - Tested the Idle HLT intercept functionality on nested guest. >> >> v4 -> v5 >> - Incorporated Sean's review comments on nested Idle HLT intercept support. >> - Make svm_idle_hlt_test independent of the Idle HLT to run on all hardware. >> >> 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 safe_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/20241220013906.3518334-1-seanjc@xxxxxxxxxx/T/#u >> >> [3]: https://lore.kernel.org/kvm/20241220012617.3513898-1-seanjc@xxxxxxxxxx/T/#u >> >> --- >> >> V4: https://lore.kernel.org/kvm/20241022054810.23369-1-manali.shukla@xxxxxxx/ >> V3: https://lore.kernel.org/kvm/20240528041926.3989-4-manali.shukla@xxxxxxx/T/ >> V2: https://lore.kernel.org/kvm/20240501145433.4070-1-manali.shukla@xxxxxxx/ >> V1: https://lore.kernel.org/kvm/20240307054623.13632-1-manali.shukla@xxxxxxx/ >> >> Manali Shukla (3): >> x86/cpufeatures: Add CPUID feature bit for Idle HLT intercept >> KVM: SVM: Add Idle HLT intercept support >> KVM: selftests: Add self IPI HLT 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 | 13 ++- >> tools/testing/selftests/kvm/Makefile.kvm | 1 + >> .../selftests/kvm/include/x86/processor.h | 1 + >> tools/testing/selftests/kvm/ipi_hlt_test.c | 85 +++++++++++++++++++ >> 7 files changed, 101 insertions(+), 3 deletions(-) >> create mode 100644 tools/testing/selftests/kvm/ipi_hlt_test.c >> >> >> base-commit: 13e98294d7cec978e31138d16824f50556a62d17 >> prerequisite-patch-id: cb345fc0d814a351df2b5788b76eee0eef9de549 >> prerequisite-patch-id: 71806f400cffe09f47d6231cb072cbdbd540de1b >> prerequisite-patch-id: 9ea0412aab7ecd8555fcee3e9609dbfe8456d47b >> prerequisite-patch-id: 3504df50cdd33958456f2e56139d76867273525c >> prerequisite-patch-id: 674e56729a56cc487cb85be1a64ef561eb7bac8a >> prerequisite-patch-id: 48e87354f9d6e6bd121ca32ab73cd0d7f1dce74f >> prerequisite-patch-id: 74daffd7677992995f37e5a5cb784b8d4357e342 >> prerequisite-patch-id: 509018dc2fc1657debc641544e86f5a92d04bc1a >> prerequisite-patch-id: 4a50c6a4dc3b3c8c8c640a86072faafb7bae4384 > > > A gentle reminder for the review. > > -Manali A gentle reminder for the review. -Manali