diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-06-18 10:47:27 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:33:03 -0400 |
commit | 46f43c6ee022c3aeb9686b104234b9f27fac03c2 (patch) | |
tree | cd7187419d488518983935fe68496d5adc5f3763 /arch/powerpc/kvm | |
parent | ed85c0685321a139cefd6622b21467643f0159e1 (diff) |
KVM: powerpc: convert marker probes to event trace
[avi: make it build]
[avi: fold trace-arch.h into trace.h]
CC: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/44x_tlb.c | 11 | ||||
-rw-r--r-- | arch/powerpc/kvm/Makefile | 4 | ||||
-rw-r--r-- | arch/powerpc/kvm/e500_tlb.c | 16 | ||||
-rw-r--r-- | arch/powerpc/kvm/emulate.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kvm/trace.h | 104 |
6 files changed, 126 insertions, 15 deletions
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index 4a16f472cc18..ff3cb63b8117 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "timing.h" | 30 | #include "timing.h" |
31 | 31 | ||
32 | #include "44x_tlb.h" | 32 | #include "44x_tlb.h" |
33 | #include "trace.h" | ||
33 | 34 | ||
34 | #ifndef PPC44x_TLBE_SIZE | 35 | #ifndef PPC44x_TLBE_SIZE |
35 | #define PPC44x_TLBE_SIZE PPC44x_TLB_4K | 36 | #define PPC44x_TLBE_SIZE PPC44x_TLB_4K |
@@ -263,7 +264,7 @@ static void kvmppc_44x_shadow_release(struct kvmppc_vcpu_44x *vcpu_44x, | |||
263 | 264 | ||
264 | /* XXX set tlb_44x_index to stlb_index? */ | 265 | /* XXX set tlb_44x_index to stlb_index? */ |
265 | 266 | ||
266 | KVMTRACE_1D(STLB_INVAL, &vcpu_44x->vcpu, stlb_index, handler); | 267 | trace_kvm_stlb_inval(stlb_index); |
267 | } | 268 | } |
268 | 269 | ||
269 | void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) | 270 | void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) |
@@ -365,8 +366,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr, | |||
365 | /* Insert shadow mapping into hardware TLB. */ | 366 | /* Insert shadow mapping into hardware TLB. */ |
366 | kvmppc_44x_tlbe_set_modified(vcpu_44x, victim); | 367 | kvmppc_44x_tlbe_set_modified(vcpu_44x, victim); |
367 | kvmppc_44x_tlbwe(victim, &stlbe); | 368 | kvmppc_44x_tlbwe(victim, &stlbe); |
368 | KVMTRACE_5D(STLB_WRITE, vcpu, victim, stlbe.tid, stlbe.word0, stlbe.word1, | 369 | trace_kvm_stlb_write(victim, stlbe.tid, stlbe.word0, stlbe.word1, |
369 | stlbe.word2, handler); | 370 | stlbe.word2); |
370 | } | 371 | } |
371 | 372 | ||
372 | /* For a particular guest TLB entry, invalidate the corresponding host TLB | 373 | /* For a particular guest TLB entry, invalidate the corresponding host TLB |
@@ -485,8 +486,8 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws) | |||
485 | kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index); | 486 | kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index); |
486 | } | 487 | } |
487 | 488 | ||
488 | KVMTRACE_5D(GTLB_WRITE, vcpu, gtlb_index, tlbe->tid, tlbe->word0, | 489 | trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1, |
489 | tlbe->word1, tlbe->word2, handler); | 490 | tlbe->word2); |
490 | 491 | ||
491 | kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS); | 492 | kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS); |
492 | return EMULATE_DONE; | 493 | return EMULATE_DONE; |
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile index 459c7ee580f7..4f407f2662f7 100644 --- a/arch/powerpc/kvm/Makefile +++ b/arch/powerpc/kvm/Makefile | |||
@@ -10,6 +10,10 @@ common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) | |||
10 | 10 | ||
11 | common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o) | 11 | common-objs-$(CONFIG_KVM_TRACE) += $(addprefix ../../../virt/kvm/, kvm_trace.o) |
12 | 12 | ||
13 | CFLAGS_44x_tlb.o := -I. | ||
14 | CFLAGS_e500_tlb.o := -I. | ||
15 | CFLAGS_emulate.o := -I. | ||
16 | |||
13 | kvm-objs := $(common-objs-y) powerpc.o emulate.o | 17 | kvm-objs := $(common-objs-y) powerpc.o emulate.o |
14 | obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o | 18 | obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o |
15 | obj-$(CONFIG_KVM) += kvm.o | 19 | obj-$(CONFIG_KVM) += kvm.o |
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c index a2048ac095ab..fb1e1dc11ba5 100644 --- a/arch/powerpc/kvm/e500_tlb.c +++ b/arch/powerpc/kvm/e500_tlb.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "../mm/mmu_decl.h" | 23 | #include "../mm/mmu_decl.h" |
24 | #include "e500_tlb.h" | 24 | #include "e500_tlb.h" |
25 | #include "trace.h" | ||
25 | 26 | ||
26 | #define to_htlb1_esel(esel) (tlb1_entry_num - (esel) - 1) | 27 | #define to_htlb1_esel(esel) (tlb1_entry_num - (esel) - 1) |
27 | 28 | ||
@@ -224,9 +225,8 @@ static void kvmppc_e500_stlbe_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500, | |||
224 | 225 | ||
225 | kvmppc_e500_shadow_release(vcpu_e500, tlbsel, esel); | 226 | kvmppc_e500_shadow_release(vcpu_e500, tlbsel, esel); |
226 | stlbe->mas1 = 0; | 227 | stlbe->mas1 = 0; |
227 | KVMTRACE_5D(STLB_INVAL, &vcpu_e500->vcpu, index_of(tlbsel, esel), | 228 | trace_kvm_stlb_inval(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2, |
228 | stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7, | 229 | stlbe->mas3, stlbe->mas7); |
229 | handler); | ||
230 | } | 230 | } |
231 | 231 | ||
232 | static void kvmppc_e500_tlb1_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500, | 232 | static void kvmppc_e500_tlb1_invalidate(struct kvmppc_vcpu_e500 *vcpu_e500, |
@@ -319,9 +319,8 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, | |||
319 | vcpu_e500->vcpu.arch.msr & MSR_PR); | 319 | vcpu_e500->vcpu.arch.msr & MSR_PR); |
320 | stlbe->mas7 = (hpaddr >> 32) & MAS7_RPN; | 320 | stlbe->mas7 = (hpaddr >> 32) & MAS7_RPN; |
321 | 321 | ||
322 | KVMTRACE_5D(STLB_WRITE, &vcpu_e500->vcpu, index_of(tlbsel, esel), | 322 | trace_kvm_stlb_write(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2, |
323 | stlbe->mas1, stlbe->mas2, stlbe->mas3, stlbe->mas7, | 323 | stlbe->mas3, stlbe->mas7); |
324 | handler); | ||
325 | } | 324 | } |
326 | 325 | ||
327 | /* XXX only map the one-one case, for now use TLB0 */ | 326 | /* XXX only map the one-one case, for now use TLB0 */ |
@@ -535,9 +534,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu) | |||
535 | gtlbe->mas3 = vcpu_e500->mas3; | 534 | gtlbe->mas3 = vcpu_e500->mas3; |
536 | gtlbe->mas7 = vcpu_e500->mas7; | 535 | gtlbe->mas7 = vcpu_e500->mas7; |
537 | 536 | ||
538 | KVMTRACE_5D(GTLB_WRITE, vcpu, vcpu_e500->mas0, | 537 | trace_kvm_gtlb_write(vcpu_e500->mas0, gtlbe->mas1, gtlbe->mas2, |
539 | gtlbe->mas1, gtlbe->mas2, gtlbe->mas3, gtlbe->mas7, | 538 | gtlbe->mas3, gtlbe->mas7); |
540 | handler); | ||
541 | 539 | ||
542 | /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */ | 540 | /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */ |
543 | if (tlbe_is_host_safe(vcpu, gtlbe)) { | 541 | if (tlbe_is_host_safe(vcpu, gtlbe)) { |
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index 28a8237fe78b..7737146af3fb 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/kvm_ppc.h> | 29 | #include <asm/kvm_ppc.h> |
30 | #include <asm/disassemble.h> | 30 | #include <asm/disassemble.h> |
31 | #include "timing.h" | 31 | #include "timing.h" |
32 | #include "trace.h" | ||
32 | 33 | ||
33 | #define OP_TRAP 3 | 34 | #define OP_TRAP 3 |
34 | 35 | ||
@@ -419,7 +420,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) | |||
419 | } | 420 | } |
420 | } | 421 | } |
421 | 422 | ||
422 | KVMTRACE_3D(PPC_INSTR, vcpu, inst, (int)vcpu->arch.pc, emulated, entryexit); | 423 | trace_kvm_ppc_instr(inst, vcpu->arch.pc, emulated); |
423 | 424 | ||
424 | if (advance) | 425 | if (advance) |
425 | vcpu->arch.pc += 4; /* Advance past emulated instruction. */ | 426 | vcpu->arch.pc += 4; /* Advance past emulated instruction. */ |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 7ad30e0a1b9a..0341391eff12 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -31,6 +31,9 @@ | |||
31 | #include "timing.h" | 31 | #include "timing.h" |
32 | #include "../mm/mmu_decl.h" | 32 | #include "../mm/mmu_decl.h" |
33 | 33 | ||
34 | #define CREATE_TRACE_POINTS | ||
35 | #include "trace.h" | ||
36 | |||
34 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) | 37 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) |
35 | { | 38 | { |
36 | return gfn; | 39 | return gfn; |
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h new file mode 100644 index 000000000000..67f219de0455 --- /dev/null +++ b/arch/powerpc/kvm/trace.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define _TRACE_KVM_H | ||
3 | |||
4 | #include <linux/tracepoint.h> | ||
5 | |||
6 | #undef TRACE_SYSTEM | ||
7 | #define TRACE_SYSTEM kvm | ||
8 | #define TRACE_INCLUDE_PATH . | ||
9 | #define TRACE_INCLUDE_FILE trace | ||
10 | |||
11 | /* | ||
12 | * Tracepoint for guest mode entry. | ||
13 | */ | ||
14 | TRACE_EVENT(kvm_ppc_instr, | ||
15 | TP_PROTO(unsigned int inst, unsigned long pc, unsigned int emulate), | ||
16 | TP_ARGS(inst, pc, emulate), | ||
17 | |||
18 | TP_STRUCT__entry( | ||
19 | __field( unsigned int, inst ) | ||
20 | __field( unsigned long, pc ) | ||
21 | __field( unsigned int, emulate ) | ||
22 | ), | ||
23 | |||
24 | TP_fast_assign( | ||
25 | __entry->inst = inst; | ||
26 | __entry->pc = pc; | ||
27 | __entry->emulate = emulate; | ||
28 | ), | ||
29 | |||
30 | TP_printk("inst %u pc 0x%lx emulate %u\n", | ||
31 | __entry->inst, __entry->pc, __entry->emulate) | ||
32 | ); | ||
33 | |||
34 | TRACE_EVENT(kvm_stlb_inval, | ||
35 | TP_PROTO(unsigned int stlb_index), | ||
36 | TP_ARGS(stlb_index), | ||
37 | |||
38 | TP_STRUCT__entry( | ||
39 | __field( unsigned int, stlb_index ) | ||
40 | ), | ||
41 | |||
42 | TP_fast_assign( | ||
43 | __entry->stlb_index = stlb_index; | ||
44 | ), | ||
45 | |||
46 | TP_printk("stlb_index %u", __entry->stlb_index) | ||
47 | ); | ||
48 | |||
49 | TRACE_EVENT(kvm_stlb_write, | ||
50 | TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0, | ||
51 | unsigned int word1, unsigned int word2), | ||
52 | TP_ARGS(victim, tid, word0, word1, word2), | ||
53 | |||
54 | TP_STRUCT__entry( | ||
55 | __field( unsigned int, victim ) | ||
56 | __field( unsigned int, tid ) | ||
57 | __field( unsigned int, word0 ) | ||
58 | __field( unsigned int, word1 ) | ||
59 | __field( unsigned int, word2 ) | ||
60 | ), | ||
61 | |||
62 | TP_fast_assign( | ||
63 | __entry->victim = victim; | ||
64 | __entry->tid = tid; | ||
65 | __entry->word0 = word0; | ||
66 | __entry->word1 = word1; | ||
67 | __entry->word2 = word2; | ||
68 | ), | ||
69 | |||
70 | TP_printk("victim %u tid %u w0 %u w1 %u w2 %u", | ||
71 | __entry->victim, __entry->tid, __entry->word0, | ||
72 | __entry->word1, __entry->word2) | ||
73 | ); | ||
74 | |||
75 | TRACE_EVENT(kvm_gtlb_write, | ||
76 | TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0, | ||
77 | unsigned int word1, unsigned int word2), | ||
78 | TP_ARGS(gtlb_index, tid, word0, word1, word2), | ||
79 | |||
80 | TP_STRUCT__entry( | ||
81 | __field( unsigned int, gtlb_index ) | ||
82 | __field( unsigned int, tid ) | ||
83 | __field( unsigned int, word0 ) | ||
84 | __field( unsigned int, word1 ) | ||
85 | __field( unsigned int, word2 ) | ||
86 | ), | ||
87 | |||
88 | TP_fast_assign( | ||
89 | __entry->gtlb_index = gtlb_index; | ||
90 | __entry->tid = tid; | ||
91 | __entry->word0 = word0; | ||
92 | __entry->word1 = word1; | ||
93 | __entry->word2 = word2; | ||
94 | ), | ||
95 | |||
96 | TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u", | ||
97 | __entry->gtlb_index, __entry->tid, __entry->word0, | ||
98 | __entry->word1, __entry->word2) | ||
99 | ); | ||
100 | |||
101 | #endif /* _TRACE_KVM_H */ | ||
102 | |||
103 | /* This part must be outside protection */ | ||
104 | #include <trace/define_trace.h> | ||