From: Davidlohr Bueso <dave@gnu.org>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: [PATCH] KVM: VMX: add tracepoint for vpids
Date: Sun, 11 Mar 2012 16:57:52 +0100 [thread overview]
Message-ID: <1331481472.17316.1.camel@offbook> (raw)
From: Davidlohr Bueso <dave@gnu.org>
Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
arch/x86/kvm/trace.h | 23 +++++++++++++++++++++++
arch/x86/kvm/vmx.c | 5 ++++-
arch/x86/kvm/x86.c | 1 +
3 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 911d264..2106a37 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -27,6 +27,29 @@ TRACE_EVENT(kvm_entry,
);
/*
+ * Tracepoint for VMX vpid management
+ */
+TRACE_EVENT(kvm_vpid,
+ TP_PROTO(int vpid, bool allocate),
+ TP_ARGS(vpid, allocate),
+
+ TP_STRUCT__entry(
+ __field( int, vpid )
+ __field( bool, allocate )
+ ),
+
+ TP_fast_assign(
+ __entry->vpid = vpid;
+ __entry->allocate = allocate;
+ ),
+
+ TP_printk("%s vpid %d", __entry->allocate ?
+ "allocate" : "free", __entry->vpid)
+);
+#define trace_kvm_free_vpid(vpid) trace_kvm_vpid(vpid, 0)
+#define trace_kvm_alloc_vpid(vpid) trace_kvm_vpid(vpid, 1)
+
+/*
* Tracepoint for hypercall.
*/
TRACE_EVENT(kvm_hypercall,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2c22fc7..5647805 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3571,6 +3571,7 @@ static void allocate_vpid(struct vcpu_vmx *vmx)
vmx->vpid = vpid;
__set_bit(vpid, vmx_vpid_bitmap);
}
+ trace_kvm_alloc_vpid(vpid);
spin_unlock(&vmx_vpid_lock);
}
@@ -3579,8 +3580,10 @@ static void free_vpid(struct vcpu_vmx *vmx)
if (!enable_vpid)
return;
spin_lock(&vmx_vpid_lock);
- if (vmx->vpid != 0)
+ if (vmx->vpid != 0) {
+ trace_kvm_free_vpid(vmx->vpid);
__clear_bit(vmx->vpid, vmx_vpid_bitmap);
+ }
spin_unlock(&vmx_vpid_lock);
}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7ce5878..8a20512 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6606,3 +6606,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intr_vmexit);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);
EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vpid);
--
1.7.4.1
next reply other threads:[~2012-03-11 15:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-11 15:57 Davidlohr Bueso [this message]
2012-03-12 8:22 ` [PATCH] KVM: VMX: add tracepoint for vpids Avi Kivity
2012-03-12 11:29 ` Davidlohr Bueso
2012-03-12 10:34 ` Avi Kivity
2012-03-13 10:58 ` Davidlohr Bueso
2012-03-13 10:10 ` Avi Kivity
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=1331481472.17316.1.camel@offbook \
--to=dave@gnu.org \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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