* [PATCH] KVM: VMX: add tracepoint for vpids
@ 2012-03-11 15:57 Davidlohr Bueso
2012-03-12 8:22 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2012-03-11 15:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: lkml, KVM
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: VMX: add tracepoint for vpids
2012-03-11 15:57 [PATCH] KVM: VMX: add tracepoint for vpids Davidlohr Bueso
@ 2012-03-12 8:22 ` Avi Kivity
2012-03-12 11:29 ` Davidlohr Bueso
0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2012-03-12 8:22 UTC (permalink / raw)
To: dave; +Cc: Marcelo Tosatti, lkml, KVM
On 03/11/2012 05:57 PM, Davidlohr Bueso wrote:
> From: Davidlohr Bueso <dave@gnu.org>
>
> Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
>
Why?
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: VMX: add tracepoint for vpids
2012-03-12 11:29 ` Davidlohr Bueso
@ 2012-03-12 10:34 ` Avi Kivity
2012-03-13 10:58 ` Davidlohr Bueso
0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2012-03-12 10:34 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: Marcelo Tosatti, lkml, KVM
On 03/12/2012 01:29 PM, Davidlohr Bueso wrote:
> On Mon, 2012-03-12 at 10:22 +0200, Avi Kivity wrote:
> > On 03/11/2012 05:57 PM, Davidlohr Bueso wrote:
> > > From: Davidlohr Bueso <dave@gnu.org>
> > >
> > > Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
> > >
> >
> > Why?
> >
>
> We have been using this tracepoint for some time now to help debug vpids
> and simulating tagged TLB behavior and performance. This gets to be non
> trivial when working with large amounts of guests and vCPUs.
I don't follow. Can you give an example of when this tracepoint would
be useful?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: VMX: add tracepoint for vpids
2012-03-12 8:22 ` Avi Kivity
@ 2012-03-12 11:29 ` Davidlohr Bueso
2012-03-12 10:34 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2012-03-12 11:29 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, lkml, KVM
On Mon, 2012-03-12 at 10:22 +0200, Avi Kivity wrote:
> On 03/11/2012 05:57 PM, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <dave@gnu.org>
> >
> > Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
> >
>
> Why?
>
We have been using this tracepoint for some time now to help debug vpids
and simulating tagged TLB behavior and performance. This gets to be non
trivial when working with large amounts of guests and vCPUs.
Thanks,
Davidlohr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: VMX: add tracepoint for vpids
2012-03-13 10:58 ` Davidlohr Bueso
@ 2012-03-13 10:10 ` Avi Kivity
0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2012-03-13 10:10 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: Marcelo Tosatti, lkml, KVM
On 03/13/2012 12:58 PM, Davidlohr Bueso wrote:
> On Mon, 2012-03-12 at 12:34 +0200, Avi Kivity wrote:
> > On 03/12/2012 01:29 PM, Davidlohr Bueso wrote:
> > > On Mon, 2012-03-12 at 10:22 +0200, Avi Kivity wrote:
> > > > On 03/11/2012 05:57 PM, Davidlohr Bueso wrote:
> > > > > From: Davidlohr Bueso <dave@gnu.org>
> > > > >
> > > > > Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
> > > > >
> > > >
> > > > Why?
> > > >
> > >
> > > We have been using this tracepoint for some time now to help debug vpids
> > > and simulating tagged TLB behavior and performance. This gets to be non
> > > trivial when working with large amounts of guests and vCPUs.
> >
> > I don't follow. Can you give an example of when this tracepoint would
> > be useful?
> >
>
> For example when running lots of guests with many different hardware
> configurations (ept on/off, vpid on/off) I trace what vcpu has or
> doesn't have a corresponding vpid associated. Perhaps this is more
> useful for experimental things than actual KVM development.
So it seems. Tracepoints should be useful for production deployments,
not development.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: VMX: add tracepoint for vpids
2012-03-12 10:34 ` Avi Kivity
@ 2012-03-13 10:58 ` Davidlohr Bueso
2012-03-13 10:10 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2012-03-13 10:58 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, lkml, KVM
On Mon, 2012-03-12 at 12:34 +0200, Avi Kivity wrote:
> On 03/12/2012 01:29 PM, Davidlohr Bueso wrote:
> > On Mon, 2012-03-12 at 10:22 +0200, Avi Kivity wrote:
> > > On 03/11/2012 05:57 PM, Davidlohr Bueso wrote:
> > > > From: Davidlohr Bueso <dave@gnu.org>
> > > >
> > > > Add a new tracepoint for vpid allocation and freeing associated to all vCPUs.
> > > >
> > >
> > > Why?
> > >
> >
> > We have been using this tracepoint for some time now to help debug vpids
> > and simulating tagged TLB behavior and performance. This gets to be non
> > trivial when working with large amounts of guests and vCPUs.
>
> I don't follow. Can you give an example of when this tracepoint would
> be useful?
>
For example when running lots of guests with many different hardware
configurations (ept on/off, vpid on/off) I trace what vcpu has or
doesn't have a corresponding vpid associated. Perhaps this is more
useful for experimental things than actual KVM development.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-13 10:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11 15:57 [PATCH] KVM: VMX: add tracepoint for vpids Davidlohr Bueso
2012-03-12 8:22 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox