lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1331481472.17316.1.camel@offbook>
Date:	Sun, 11 Mar 2012 16:57:52 +0100
From:	Davidlohr Bueso <dave@....org>
To:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>
Cc:	lkml <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: [PATCH] KVM: VMX: add tracepoint for vpids

From: Davidlohr Bueso <dave@....org>

Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.

Signed-off-by: Davidlohr Bueso <dave@....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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ