diff mbox series

[v1,3/5] tools: Add KVM exit reason for the Idle HLT

Message ID 20240307054623.13632-4-manali.shukla@amd.com (mailing list archive)
State New, archived
Headers show
Series Add support for the Idle HLT intercept feature | expand

Commit Message

Manali Shukla March 7, 2024, 5:46 a.m. UTC
From: Manali Shukla <Manali.Shukla@amd.com>

The Idle HLT intercept feature allows for the HLT instruction execution
by a vCPU to be intercepted by hypervisor only if there are no pending
V_INR and V_NMI events for the vCPU. The Idle HLT intercept will not be
triggerred when vCPU is expected to service pending events (V_INTR and
V_NMI).

The new SVM_EXIT_IDLE_HLT is introduced as part of the Idle HLT
intercept feature. Add it to SVM_EXIT_REASONS, so that the
SVM_EXIT_IDLE_HLT type of VMEXIT is recognized by tools like perf etc.

Signed-off-by: Manali Shukla <Manali.Shukla@amd.com>
---
 tools/arch/x86/include/uapi/asm/svm.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sean Christopherson March 7, 2024, 2:30 p.m. UTC | #1
On Thu, Mar 07, 2024, Manali Shukla wrote:
> From: Manali Shukla <Manali.Shukla@amd.com>
> 
> The Idle HLT intercept feature allows for the HLT instruction execution
> by a vCPU to be intercepted by hypervisor only if there are no pending
> V_INR and V_NMI events for the vCPU. The Idle HLT intercept will not be
> triggerred when vCPU is expected to service pending events (V_INTR and
> V_NMI).
> 
> The new SVM_EXIT_IDLE_HLT is introduced as part of the Idle HLT
> intercept feature. Add it to SVM_EXIT_REASONS, so that the
> SVM_EXIT_IDLE_HLT type of VMEXIT is recognized by tools like perf etc.
> 
> Signed-off-by: Manali Shukla <Manali.Shukla@amd.com>
> ---
>  tools/arch/x86/include/uapi/asm/svm.h | 2 ++

Please drop the tools/ uapi headers update.  Nothing KVM-related in tools/
actually relies on the headers being copied into tools/, e.g. KVM selftests
pulls KVM's headers from the .../usr/include/ directory that's populated by
`make headers_install`.

Perf's tooling is what actually "needs" the headers to be copied into tools/;
let the tools/perf maintainers deal with the headache of keeping everything up-to-date.
Manali Shukla March 12, 2024, 6:10 a.m. UTC | #2
Hi Sean,
Thank you for reviewing my patches

On 3/7/2024 8:00 PM, Sean Christopherson wrote:
> On Thu, Mar 07, 2024, Manali Shukla wrote:
>> From: Manali Shukla <Manali.Shukla@amd.com>
>>
>> The Idle HLT intercept feature allows for the HLT instruction execution
>> by a vCPU to be intercepted by hypervisor only if there are no pending
>> V_INR and V_NMI events for the vCPU. The Idle HLT intercept will not be
>> triggerred when vCPU is expected to service pending events (V_INTR and
>> V_NMI).
>>
>> The new SVM_EXIT_IDLE_HLT is introduced as part of the Idle HLT
>> intercept feature. Add it to SVM_EXIT_REASONS, so that the
>> SVM_EXIT_IDLE_HLT type of VMEXIT is recognized by tools like perf etc.
>>
>> Signed-off-by: Manali Shukla <Manali.Shukla@amd.com>
>> ---
>>  tools/arch/x86/include/uapi/asm/svm.h | 2 ++
> 
> Please drop the tools/ uapi headers update.  Nothing KVM-related in tools/
> actually relies on the headers being copied into tools/, e.g. KVM selftests
> pulls KVM's headers from the .../usr/include/ directory that's populated by
> `make headers_install`.
> 
> Perf's tooling is what actually "needs" the headers to be copied into tools/;
> let the tools/perf maintainers deal with the headache of keeping everything up-to-date.

Sure I will drop this patch in V2.

-Manali
diff mbox series

Patch

diff --git a/tools/arch/x86/include/uapi/asm/svm.h b/tools/arch/x86/include/uapi/asm/svm.h
index 80e1df482337..5bf1ad15e1ee 100644
--- a/tools/arch/x86/include/uapi/asm/svm.h
+++ b/tools/arch/x86/include/uapi/asm/svm.h
@@ -95,6 +95,7 @@ 
 #define SVM_EXIT_CR14_WRITE_TRAP		0x09e
 #define SVM_EXIT_CR15_WRITE_TRAP		0x09f
 #define SVM_EXIT_INVPCID       0x0a2
+#define SVM_EXIT_IDLE_HLT      0x0a6
 #define SVM_EXIT_NPF           0x400
 #define SVM_EXIT_AVIC_INCOMPLETE_IPI		0x401
 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS	0x402
@@ -224,6 +225,7 @@ 
 	{ SVM_EXIT_CR8_WRITE_TRAP,	"write_cr8_trap" }, \
 	{ SVM_EXIT_INVPCID,     "invpcid" }, \
 	{ SVM_EXIT_NPF,         "npf" }, \
+	{ SVM_EXIT_IDLE_HLT,         "idle-halt" }, \
 	{ SVM_EXIT_AVIC_INCOMPLETE_IPI,		"avic_incomplete_ipi" }, \
 	{ SVM_EXIT_AVIC_UNACCELERATED_ACCESS,   "avic_unaccelerated_access" }, \
 	{ SVM_EXIT_VMGEXIT,		"vmgexit" }, \