[v3,05/16] kvm: x86: Add APICv activate/deactivate request trace points
diff mbox series

Message ID 1568401242-260374-6-git-send-email-suravee.suthikulpanit@amd.com
State New
Headers show
Series
  • kvm: x86: Support AMD SVM AVIC w/ in-kernel irqchip mode
Related show

Commit Message

Suravee Suthikulpanit Sept. 13, 2019, 7 p.m. UTC
Add trace points when sending request to activate/deactivate APICv.

Suggested-by: Alexander Graf <graf@amazon.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 arch/x86/kvm/trace.h | 30 ++++++++++++++++++++++++++++++
 arch/x86/kvm/x86.c   |  7 +++++++
 2 files changed, 37 insertions(+)

Patch
diff mbox series

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index b5c831e..e3f745a 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -1297,6 +1297,36 @@ 
 		  __entry->vcpu_id, __entry->timer_index)
 );
 
+TRACE_EVENT(kvm_apicv_activate_request,
+	    TP_PROTO(u32 vcpu),
+	    TP_ARGS(vcpu),
+
+	TP_STRUCT__entry(__field(u32, vcpu)),
+
+	TP_fast_assign(__entry->vcpu = vcpu;),
+
+	TP_printk("vcpu=%u", __entry->vcpu)
+);
+
+TRACE_EVENT(kvm_apicv_deactivate_request,
+	    TP_PROTO(u32 vcpu, bool disable),
+	    TP_ARGS(vcpu, disable),
+
+	TP_STRUCT__entry(
+		__field(u32, vcpu)
+		__field(bool, disable)
+	),
+
+	TP_fast_assign(
+		__entry->vcpu = vcpu;
+		__entry->disable = disable;
+	),
+
+	TP_printk("vcpu=%u, disable=%s",
+		  __entry->vcpu,
+		  __entry->disable ? "disabled" : "suspended")
+);
+
 /*
  * Tracepoint for AMD AVIC
  */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 446df2b..bc74876 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7756,6 +7756,8 @@  void kvm_make_apicv_activate_request(struct kvm_vcpu *vcpu)
 	struct kvm_vcpu *v;
 	struct kvm *kvm = vcpu->kvm;
 
+	trace_kvm_apicv_activate_request(vcpu->vcpu_id);
+
 	mutex_lock(&kvm->arch.apicv_lock);
 	if (kvm->arch.apicv_state != APICV_SUSPENDED) {
 		mutex_unlock(&kvm->arch.apicv_lock);
@@ -7782,6 +7784,8 @@  void kvm_make_apicv_deactivate_request(struct kvm_vcpu *vcpu, bool disable)
 	struct kvm_vcpu *v;
 	struct kvm *kvm = vcpu->kvm;
 
+	trace_kvm_apicv_deactivate_request(vcpu->vcpu_id, disable);
+
 	mutex_lock(&kvm->arch.apicv_lock);
 	if (kvm->arch.apicv_state != APICV_ACTIVATED) {
 		mutex_unlock(&kvm->arch.apicv_lock);
@@ -10194,3 +10198,6 @@  bool kvm_arch_no_poll(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_apicv_activate_request);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_apicv_deactivate_request);
+