2023-09-28 10:38:41

by Maxim Levitsky

[permalink] [raw]
Subject: [PATCH v3 3/4] KVM: x86: add information about pending requests to kvm_exit tracepoint

This allows to gather information on how often kvm interrupts vCPUs due
to specific requests.

Signed-off-by: Maxim Levitsky <[email protected]>
---
arch/x86/kvm/trace.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 28e8a63368cc02..e275a02a21e523 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -316,12 +316,14 @@ TRACE_EVENT(name, \
__field( u32, intr_info ) \
__field( u32, error_code ) \
__field( unsigned int, vcpu_id ) \
+ __field( u64, requests ) \
), \
\
TP_fast_assign( \
__entry->guest_rip = kvm_rip_read(vcpu); \
__entry->isa = isa; \
__entry->vcpu_id = vcpu->vcpu_id; \
+ __entry->requests = READ_ONCE(vcpu->requests); \
static_call(kvm_x86_get_exit_info)(vcpu, \
&__entry->exit_reason, \
&__entry->info1, \
@@ -331,11 +333,13 @@ TRACE_EVENT(name, \
), \
\
TP_printk("vcpu %u reason %s%s%s rip 0x%lx info1 0x%016llx " \
- "info2 0x%016llx intr_info 0x%08x error_code 0x%08x", \
+ "info2 0x%016llx intr_info 0x%08x error_code 0x%08x " \
+ "requests 0x%016llx", \
__entry->vcpu_id, \
kvm_print_exit_reason(__entry->exit_reason, __entry->isa), \
__entry->guest_rip, __entry->info1, __entry->info2, \
- __entry->intr_info, __entry->error_code) \
+ __entry->intr_info, __entry->error_code, \
+ __entry->requests) \
)

/*
--
2.26.3


2023-11-24 16:08:59

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v3 3/4] KVM: x86: add information about pending requests to kvm_exit tracepoint

On 9/28/23 12:36, Maxim Levitsky wrote:
> This allows to gather information on how often kvm interrupts vCPUs due
> to specific requests.
>
> Signed-off-by: Maxim Levitsky <[email protected]>
> ---
> arch/x86/kvm/trace.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index 28e8a63368cc02..e275a02a21e523 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -316,12 +316,14 @@ TRACE_EVENT(name, \
> __field( u32, intr_info ) \
> __field( u32, error_code ) \
> __field( unsigned int, vcpu_id ) \
> + __field( u64, requests ) \
> ), \
> \
> TP_fast_assign( \
> __entry->guest_rip = kvm_rip_read(vcpu); \
> __entry->isa = isa; \
> __entry->vcpu_id = vcpu->vcpu_id; \
> + __entry->requests = READ_ONCE(vcpu->requests); \
> static_call(kvm_x86_get_exit_info)(vcpu, \
> &__entry->exit_reason, \
> &__entry->info1, \
> @@ -331,11 +333,13 @@ TRACE_EVENT(name, \
> ), \
> \
> TP_printk("vcpu %u reason %s%s%s rip 0x%lx info1 0x%016llx " \
> - "info2 0x%016llx intr_info 0x%08x error_code 0x%08x", \
> + "info2 0x%016llx intr_info 0x%08x error_code 0x%08x " \
> + "requests 0x%016llx", \
> __entry->vcpu_id, \
> kvm_print_exit_reason(__entry->exit_reason, __entry->isa), \
> __entry->guest_rip, __entry->info1, __entry->info2, \
> - __entry->intr_info, __entry->error_code) \
> + __entry->intr_info, __entry->error_code, \
> + __entry->requests) \
> )
>
> /*

Reviewed-by: Paolo Bonzini <[email protected]>