[PATCH] KVM: VMX: add tracepoint for vpids
From: Davidlohr Bueso
Date: Sun Mar 11 2012 - 11:58:05 EST
From: Davidlohr Bueso <dave@xxxxxxx>
Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/