public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org, Hollis Blanchard <hollisb@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/3] KVM: PPC: convert marker probes to event trace
Date: Thu, 18 Jun 2009 11:47:27 -0300	[thread overview]
Message-ID: <20090618144819.392195778@localhost.localdomain> (raw)
In-Reply-To: 20090618144726.270388200@localhost.localdomain

[-- Attachment #1: convert-ppc-to-eventtrace --]
[-- Type: text/plain, Size: 7895 bytes --]

CC: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: kvm/arch/powerpc/kvm/44x_tlb.c
===================================================================
--- kvm.orig/arch/powerpc/kvm/44x_tlb.c
+++ kvm/arch/powerpc/kvm/44x_tlb.c
@@ -31,6 +31,9 @@
 
 #include "44x_tlb.h"
 
+#define CREATE_TRACE_POINTS
+#include "trace-arch.h"
+
 #ifndef PPC44x_TLBE_SIZE
 #define PPC44x_TLBE_SIZE	PPC44x_TLB_4K
 #endif
@@ -263,7 +266,7 @@ static void kvmppc_44x_shadow_release(st
 
 	/* XXX set tlb_44x_index to stlb_index? */
 
-	KVMTRACE_1D(STLB_INVAL, &vcpu_44x->vcpu, stlb_index, handler);
+	trace_kvm_stlb_inval(stlb_index);
 }
 
 void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
@@ -365,8 +368,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcp
 	/* Insert shadow mapping into hardware TLB. */
 	kvmppc_44x_tlbe_set_modified(vcpu_44x, victim);
 	kvmppc_44x_tlbwe(victim, &stlbe);
-	KVMTRACE_5D(STLB_WRITE, vcpu, victim, stlbe.tid, stlbe.word0, stlbe.word1,
-	            stlbe.word2, handler);
+	trace_kvm_stlb_write(victim, stlbe.tid, stlbe.word0, stlbe.word1,
+			     stlbe.word2);
 }
 
 /* For a particular guest TLB entry, invalidate the corresponding host TLB
@@ -485,8 +488,8 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcp
 		kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index);
 	}
 
-	KVMTRACE_5D(GTLB_WRITE, vcpu, gtlb_index, tlbe->tid, tlbe->word0,
-	            tlbe->word1, tlbe->word2, handler);
+	trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1,
+			     tlbe->word2);
 
 	kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS);
 	return EMULATE_DONE;
Index: kvm/arch/powerpc/kvm/trace-arch.h
===================================================================
--- /dev/null
+++ kvm/arch/powerpc/kvm/trace-arch.h
@@ -0,0 +1,84 @@
+#if !defined(_TRACE_KVM_ARCH_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_KVM_ARCH_H
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM kvm
+#define TRACE_INCLUDE_PATH arch/powerpc/kvm
+#define TRACE_INCLUDE_FILE trace-arch
+
+/*
+ * Tracepoint for kvm guest exit:
+ */
+TRACE_EVENT(kvm_stlb_inval,
+	TP_PROTO(unsigned int stlb_index),
+	TP_ARGS(stlb_index),
+
+	TP_STRUCT__entry(
+		__field(	unsigned int,	stlb_index	)
+	),
+
+	TP_fast_assign(
+		__entry->stlb_index	= stlb_index;
+	),
+
+	TP_printk("stlb_index %u", __entry->stlb_index)
+);
+
+TRACE_EVENT(kvm_stlb_write,
+	TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0,
+		 unsigned int word1, unsigned int word2),
+	TP_ARGS(victim, tid, word0, word1, word2),
+
+	TP_STRUCT__entry(
+		__field(	unsigned int,	victim		)
+		__field(	unsigned int,	tid		)
+		__field(	unsigned int,	word0		)
+		__field(	unsigned int,	word1		)
+		__field(	unsigned int,	word2		)
+	),
+
+	TP_fast_assign(
+		__entry->victim		= victim;
+		__entry->tid		= tid;
+		__entry->word0		= word0;
+		__entry->word1		= word1;
+		__entry->word2		= word2;
+	),
+
+	TP_printk("victim %u tid %u w0 %u w1 %u w2 %u",
+		__entry->victim, __entry->tid, __entry->word0,
+		__entry->word1, __entry->word2)
+);
+
+TRACE_EVENT(kvm_gtlb_write,
+	TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0,
+		 unsigned int word1, unsigned int word2),
+	TP_ARGS(gtlb_index, tid, word0, word1, word2),
+
+	TP_STRUCT__entry(
+		__field(	unsigned int,	gtlb_index	)
+		__field(	unsigned int,	tid		)
+		__field(	unsigned int,	word0		)
+		__field(	unsigned int,	word1		)
+		__field(	unsigned int,	word2		)
+	),
+
+	TP_fast_assign(
+		__entry->gtlb_index	= gtlb_index;
+		__entry->tid		= tid;
+		__entry->word0		= word0;
+		__entry->word1		= word1;
+		__entry->word2		= word2;
+	),
+
+	TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u",
+		__entry->gtlb_index, __entry->tid, __entry->word0,
+		__entry->word1, __entry->word2)
+);
+
+#endif /* _TRACE_KVM_ARCH */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
Index: kvm/arch/powerpc/kvm/Makefile
===================================================================
--- kvm.orig/arch/powerpc/kvm/Makefile
+++ kvm/arch/powerpc/kvm/Makefile
@@ -8,6 +8,10 @@ common-objs-y = $(addprefix ../../../vir
 
 common-objs-$(CONFIG_KVM_TRACE)  += $(addprefix ../../../virt/kvm/, kvm_trace.o)
 
+CFLAGS_44x_tlb.o  := -I.
+CFLAGS_e500_tlb.o := -I.
+CFLAGS_emulate.o  := -I.
+
 kvm-objs := $(common-objs-y) powerpc.o emulate.o
 obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
 obj-$(CONFIG_KVM) += kvm.o
Index: kvm/arch/powerpc/kvm/e500_tlb.c
===================================================================
--- kvm.orig/arch/powerpc/kvm/e500_tlb.c
+++ kvm/arch/powerpc/kvm/e500_tlb.c
@@ -23,6 +23,9 @@
 #include "../mm/mmu_decl.h"
 #include "e500_tlb.h"
 
+#define CREATE_TRACE_POINTS
+#include "trace-arch.h"
+
 #define to_htlb1_esel(esel) (tlb1_entry_num - (esel) - 1)
 
 static unsigned int tlb1_entry_num;
@@ -224,9 +227,8 @@ static void kvmppc_e500_stlbe_invalidate
 
 	kvmppc_e500_shadow_release(vcpu_e500, tlbsel, esel);
 	stlbe->mas1 = 0;
-	KVMTRACE_5D(STLB_INVAL, &vcpu_e500->vcpu, index_of(tlbsel, esel),
-			stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7,
-			handler);
+	trace_kvm_stlb_inval(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2,
+			     stlbe->mas3, stlbe->mas7);
 }
 
 static void kvmppc_e500_tlb1_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500,
@@ -319,9 +321,8 @@ static inline void kvmppc_e500_shadow_ma
 				vcpu_e500->vcpu.arch.msr & MSR_PR);
 	stlbe->mas7 = (hpaddr >> 32) & MAS7_RPN;
 
-	KVMTRACE_5D(STLB_WRITE, &vcpu_e500->vcpu, index_of(tlbsel, esel),
-			stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7,
-			handler);
+	trace_kvm_stlb_write(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2,
+			     stlbe->mas3, stlbe->mas7);
 }
 
 /* XXX only map the one-one case, for now use TLB0 */
@@ -535,9 +536,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vc
 	gtlbe->mas3 = vcpu_e500->mas3;
 	gtlbe->mas7 = vcpu_e500->mas7;
 
-	KVMTRACE_5D(GTLB_WRITE, vcpu, vcpu_e500->mas0,
-			gtlbe->mas1, gtlbe->mas2, gtlbe->mas3, gtlbe->mas7,
-			handler);
+	trace_kvm_gtlb_write(vcpu_e500->mas0, gtlbe->mas1, gtlbe->mas2,
+			     gtlbe->mas3, gtlbe->mas7);
 
 	/* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */
 	if (tlbe_is_host_safe(vcpu, gtlbe)) {
Index: kvm/arch/powerpc/kvm/emulate.c
===================================================================
--- kvm.orig/arch/powerpc/kvm/emulate.c
+++ kvm/arch/powerpc/kvm/emulate.c
@@ -30,6 +30,9 @@
 #include <asm/disassemble.h>
 #include "timing.h"
 
+#define CREATE_TRACE_POINTS
+#include "trace.h"
+
 #define OP_TRAP 3
 
 #define OP_31_XOP_LWZX      23
@@ -419,7 +422,7 @@ int kvmppc_emulate_instruction(struct kv
 		}
 	}
 
-	KVMTRACE_3D(PPC_INSTR, vcpu, inst, (int)vcpu->arch.pc, emulated, entryexit);
+	trace_kvm_ppc_instr(inst, vcpu->arch.pc, emulated);
 
 	if (advance)
 		vcpu->arch.pc += 4; /* Advance past emulated instruction. */
Index: kvm/arch/powerpc/kvm/trace.h
===================================================================
--- /dev/null
+++ kvm/arch/powerpc/kvm/trace.h
@@ -0,0 +1,37 @@
+#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_KVM_H
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM kvm
+#define TRACE_INCLUDE_PATH arch/powerpc/kvm
+#define TRACE_INCLUDE_FILE trace
+
+/*
+ * Tracepoint for guest mode entry.
+ */
+TRACE_EVENT(kvm_ppc_instr
+	TP_PROTO(unsigned int inst, unsigned long pc, unsigned int emulate),
+	TP_ARGS(inst, pc, emulate),
+
+	TP_STRUCT__entry(
+		__field(	unsigned int,	inst		)
+		__field(	unsigned long,	pc		)
+		__field(	unsigned int,	emulate		)
+	),
+
+	TP_fast_assign(
+		__entry->inst		= inst;
+		__entry->pc		= pc;
+		__entry->emulate	= emulate;
+	),
+
+	TP_printk("inst %u pc 0x%lx emulate %u\n",
+		  __entry->inst, __entry->pc, __entry->emulate);
+);
+
+#endif /* _TRACE_KVM_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>

-- 


  reply	other threads:[~2009-06-18 14:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 18:31 [patch 0/2] replace kvmtrace with event traces Marcelo Tosatti
2009-06-15 18:31 ` [patch 1/2] KVM: convert custom marker based tracing to " Marcelo Tosatti
2009-06-15 20:03   ` Steven Rostedt
2009-06-16 12:44     ` Marcelo Tosatti
2009-06-16 13:40       ` Steven Rostedt
2009-06-16 22:13         ` [patch 0/2] replace kvmtrace with event traces v2 Marcelo Tosatti
2009-06-16 22:13           ` [patch 1/2] KVM: convert custom marker based tracing to event traces Marcelo Tosatti
2009-06-17 11:52             ` Avi Kivity
2009-06-17 12:22               ` [patch 0/2] replace kvmtrace with event traces rebased Marcelo Tosatti
2009-06-17 12:22                 ` [patch 1/2] KVM: convert custom marker based tracing to event traces Marcelo Tosatti
2009-06-17 12:22                 ` [patch 2/2] KVM: remove old KVMTRACE support code Marcelo Tosatti
2009-06-17 13:33                   ` Avi Kivity
2009-06-18 14:47                     ` [patch 0/3] " Marcelo Tosatti
2009-06-18 14:47                       ` Marcelo Tosatti [this message]
2009-06-18 14:47                       ` [patch 2/3] KVM: " Marcelo Tosatti
2009-06-18 14:47                       ` [patch 3/3] kvm-kmod: dummy event trace hooks Marcelo Tosatti
2009-06-28 15:57                       ` [patch 0/3] remove old KVMTRACE support code Avi Kivity
2009-06-17 12:35                 ` [patch 0/2] replace kvmtrace with event traces rebased Avi Kivity
2009-06-16 22:13           ` [patch 2/2] KVM: remove old KVMTRACE support code Marcelo Tosatti
2009-06-17 11:53             ` Avi Kivity
2009-06-15 18:31 ` Marcelo Tosatti

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=20090618144819.392195778@localhost.localdomain \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=hollisb@us.ibm.com \
    --cc=kvm@vger.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