From: Nikolas Wipper <nikwip@amazon.de>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Nicolas Saenz Julienne <nsaenz@amazon.com>,
Alexander Graf <graf@amazon.de>,
James Gowans <jgowans@amazon.com>, <nh-open-source@amazon.com>,
Sean Christopherson <seanjc@google.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Nikolas Wipper <nik.wipper@gmx.de>,
<linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>,
<x86@kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>,
"Nikolas Wipper" <nikwip@amazon.de>
Subject: [PATCH 6/7] KVM: x86: Add trace events to track Hyper-V suspensions
Date: Fri, 4 Oct 2024 14:08:09 +0000 [thread overview]
Message-ID: <20241004140810.34231-7-nikwip@amazon.de> (raw)
In-Reply-To: <20241004140810.34231-1-nikwip@amazon.de>
Add trace events to track suspensions and unsuspensions vCPUs, because of
Hyper-V mechanisms.
Signed-off-by: Nikolas Wipper <nikwip@amazon.de>
---
arch/x86/kvm/hyperv.c | 4 ++++
arch/x86/kvm/trace.h | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 40ea8340838f..55b8f88a91cb 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -2944,6 +2944,8 @@ void kvm_hv_vcpu_suspend_tlb_flush(struct kvm_vcpu *vcpu, int vcpu_id)
/* waiting_on's store should happen before suspended's */
WRITE_ONCE(vcpu->arch.hyperv->waiting_on, vcpu_id);
WRITE_ONCE(vcpu->arch.hyperv->suspended, true);
+
+ trace_kvm_hv_vcpu_suspend_tlb_flush(vcpu->vcpu_id, vcpu_id);
}
void kvm_hv_vcpu_unsuspend_tlb_flush(struct kvm_vcpu *vcpu)
@@ -2962,6 +2964,8 @@ void kvm_hv_vcpu_unsuspend_tlb_flush(struct kvm_vcpu *vcpu)
WRITE_ONCE(v->arch.hyperv->waiting_on, -1);
WRITE_ONCE(v->arch.hyperv->suspended, false);
__set_bit(i, vcpu_mask);
+
+ trace_kvm_hv_vcpu_unsuspend_tlb_flush(v->vcpu_id);
}
}
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index d3aeffd6ae75..5564ef52fd9d 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -1871,6 +1871,45 @@ TRACE_EVENT(kvm_rmp_fault,
__entry->error_code, __entry->rmp_level, __entry->psmash_ret)
);
+/*
+ * Tracepoint for Hyper-V TlbFlushInhibit suspension
+ */
+TRACE_EVENT(kvm_hv_vcpu_suspend_tlb_flush,
+ TP_PROTO(int vcpu_id, int waiting_on),
+ TP_ARGS(vcpu_id, waiting_on),
+
+ TP_STRUCT__entry(
+ __field(int, vcpu_id)
+ __field(int, waiting_on)
+ ),
+
+ TP_fast_assign(
+ __entry->vcpu_id = vcpu_id;
+ __entry->waiting_on = waiting_on;
+ ),
+
+ TP_printk("suspending vcpu %u waiting on %u",
+ __entry->vcpu_id, __entry->waiting_on)
+);
+
+/*
+ * Tracepoint for Hyper-V TlbFlushInhibit unsuspension
+ */
+TRACE_EVENT(kvm_hv_vcpu_unsuspend_tlb_flush,
+ TP_PROTO(int vcpu_id),
+ TP_ARGS(vcpu_id),
+ TP_STRUCT__entry(
+ __field(int, vcpu_id)
+ ),
+
+ TP_fast_assign(
+ __entry->vcpu_id = vcpu_id;
+ ),
+
+ TP_printk("unsuspending vcpu %u",
+ __entry->vcpu_id)
+);
+
#endif /* _TRACE_KVM_H */
#undef TRACE_INCLUDE_PATH
--
2.40.1
Amazon Web Services Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
next prev parent reply other threads:[~2024-10-04 14:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 14:08 [PATCH 0/7] KVM: x86: Introduce new ioctl KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Nikolas Wipper
2024-10-04 14:08 ` [PATCH 1/7] KVM: Add API documentation for KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Nikolas Wipper
2024-10-10 8:57 ` Vitaly Kuznetsov
2024-10-04 14:08 ` [PATCH 2/7] KVM: x86: Implement Hyper-V's vCPU suspended state Nikolas Wipper
2024-10-10 8:57 ` Vitaly Kuznetsov
2024-10-14 17:50 ` Nikolas Wipper
2024-10-15 8:18 ` Vitaly Kuznetsov
2024-10-15 15:58 ` Sean Christopherson
2024-10-15 17:16 ` Nicolas Saenz Julienne
2024-10-15 17:51 ` Sean Christopherson
2024-10-15 17:40 ` Nikolas Wipper
2024-10-15 18:10 ` Sean Christopherson
2024-10-04 14:08 ` [PATCH 3/7] KVM: x86: Check vCPUs before enqueuing TLB flushes in kvm_hv_flush_tlb() Nikolas Wipper
2024-10-04 14:08 ` [PATCH 4/7] KVM: Introduce KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Nikolas Wipper
2024-10-10 8:57 ` Vitaly Kuznetsov
2024-10-04 14:08 ` [PATCH 5/7] KVM: x86: Implement KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Nikolas Wipper
2024-10-10 8:57 ` Vitaly Kuznetsov
2024-10-14 18:02 ` Nikolas Wipper
2024-10-04 14:08 ` Nikolas Wipper [this message]
2024-10-04 14:08 ` [PATCH 7/7] KVM: selftests: Add tests for KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Nikolas Wipper
2024-10-14 23:36 ` [PATCH 0/7] KVM: x86: Introduce new ioctl KVM_HYPERV_SET_TLB_FLUSH_INHIBIT Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241004140810.34231-7-nikwip@amazon.de \
--to=nikwip@amazon.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=graf@amazon.de \
--cc=jgowans@amazon.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=nik.wipper@gmx.de \
--cc=nsaenz@amazon.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox