kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: svm: Introduce GA Log tracepoint for AVIC
@ 2020-03-12 10:39 Suravee Suthikulpanit
  2020-03-14 10:58 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Suravee Suthikulpanit @ 2020-03-12 10:39 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: pbonzini, joro, jon.grimm, Suravee Suthikulpanit

GA Log tracepoint is useful when debugging AVIC performance
issue as it can be used with perf to count the number of times
IOMMU AVIC injects interrupts through the slow-path instead of
directly inject interrupts to the target vcpu.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 arch/x86/kvm/svm.c   |  1 +
 arch/x86/kvm/trace.h | 18 ++++++++++++++++++
 arch/x86/kvm/x86.c   |  1 +
 3 files changed, 20 insertions(+)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 24c0b2b..504f2cb 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1208,6 +1208,7 @@ static int avic_ga_log_notifier(u32 ga_tag)
 	u32 vcpu_id = AVIC_GATAG_TO_VCPUID(ga_tag);
 
 	pr_debug("SVM: %s: vm_id=%#x, vcpu_id=%#x\n", __func__, vm_id, vcpu_id);
+	trace_kvm_avic_ga_log(vm_id, vcpu_id);
 
 	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
 	hash_for_each_possible(svm_vm_data_hash, kvm_svm, hnode, vm_id) {
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index f194dd0..023de6c 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -1367,6 +1367,24 @@
 		  __entry->vec)
 );
 
+TRACE_EVENT(kvm_avic_ga_log,
+	    TP_PROTO(u32 vmid, u32 vcpuid),
+	    TP_ARGS(vmid, vcpuid),
+
+	TP_STRUCT__entry(
+		__field(u32, vmid)
+		__field(u32, vcpuid)
+	),
+
+	TP_fast_assign(
+		__entry->vmid = vmid;
+		__entry->vcpuid = vcpuid;
+	),
+
+	TP_printk("vmid=%u, vcpuid=%u",
+		  __entry->vmid, __entry->vcpuid)
+);
+
 TRACE_EVENT(kvm_hv_timer_state,
 		TP_PROTO(unsigned int vcpu_id, unsigned int hv_timer_in_use),
 		TP_ARGS(vcpu_id, hv_timer_in_use),
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5de2006..ef38b82 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10514,4 +10514,5 @@ u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu)
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pi_irte_update);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_unaccelerated_access);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_incomplete_ipi);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_ga_log);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_apicv_update_request);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm: svm: Introduce GA Log tracepoint for AVIC
  2020-03-12 10:39 [PATCH] kvm: svm: Introduce GA Log tracepoint for AVIC Suravee Suthikulpanit
@ 2020-03-14 10:58 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-03-14 10:58 UTC (permalink / raw)
  To: Suravee Suthikulpanit, linux-kernel, kvm; +Cc: joro, jon.grimm

On 12/03/20 11:39, Suravee Suthikulpanit wrote:
> GA Log tracepoint is useful when debugging AVIC performance
> issue as it can be used with perf to count the number of times
> IOMMU AVIC injects interrupts through the slow-path instead of
> directly inject interrupts to the target vcpu.
> 
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
>  arch/x86/kvm/svm.c   |  1 +
>  arch/x86/kvm/trace.h | 18 ++++++++++++++++++
>  arch/x86/kvm/x86.c   |  1 +
>  3 files changed, 20 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 24c0b2b..504f2cb 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -1208,6 +1208,7 @@ static int avic_ga_log_notifier(u32 ga_tag)
>  	u32 vcpu_id = AVIC_GATAG_TO_VCPUID(ga_tag);
>  
>  	pr_debug("SVM: %s: vm_id=%#x, vcpu_id=%#x\n", __func__, vm_id, vcpu_id);
> +	trace_kvm_avic_ga_log(vm_id, vcpu_id);
>  
>  	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
>  	hash_for_each_possible(svm_vm_data_hash, kvm_svm, hnode, vm_id) {
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index f194dd0..023de6c 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -1367,6 +1367,24 @@
>  		  __entry->vec)
>  );
>  
> +TRACE_EVENT(kvm_avic_ga_log,
> +	    TP_PROTO(u32 vmid, u32 vcpuid),
> +	    TP_ARGS(vmid, vcpuid),
> +
> +	TP_STRUCT__entry(
> +		__field(u32, vmid)
> +		__field(u32, vcpuid)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->vmid = vmid;
> +		__entry->vcpuid = vcpuid;
> +	),
> +
> +	TP_printk("vmid=%u, vcpuid=%u",
> +		  __entry->vmid, __entry->vcpuid)
> +);
> +
>  TRACE_EVENT(kvm_hv_timer_state,
>  		TP_PROTO(unsigned int vcpu_id, unsigned int hv_timer_in_use),
>  		TP_ARGS(vcpu_id, hv_timer_in_use),
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5de2006..ef38b82 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -10514,4 +10514,5 @@ u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu)
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_pi_irte_update);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_unaccelerated_access);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_incomplete_ipi);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_ga_log);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_apicv_update_request);
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-15  3:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 10:39 [PATCH] kvm: svm: Introduce GA Log tracepoint for AVIC Suravee Suthikulpanit
2020-03-14 10:58 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).