Commit | Line | Data |
---|---|---|
9bbf98da MD |
1 | #if !defined(LTTNG_TRACE_KVM_MMU_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define LTTNG_TRACE_KVM_MMU_H | |
b3c40230 | 3 | |
3bc29f0a | 4 | #include "../../../../../../probes/lttng-tracepoint-event.h" |
b3c40230 MG |
5 | #include <linux/ftrace_event.h> |
6 | ||
7 | #undef TRACE_SYSTEM | |
9bbf98da | 8 | #define TRACE_SYSTEM kvm_mmu |
b3c40230 | 9 | |
f127e61e MD |
10 | #define LTTNG_KVM_MMU_PAGE_FIELDS \ |
11 | ctf_integer(__u64, gfn, (sp)->gfn) \ | |
12 | ctf_integer(__u32, role, (sp)->role.word) \ | |
13 | ctf_integer(__u32, root_count, (sp)->root_count) \ | |
14 | ctf_integer(bool, unsync, (sp)->unsync) | |
b3c40230 MG |
15 | |
16 | /* | |
17 | * A pagetable walk has started | |
18 | */ | |
3bc29f0a | 19 | LTTNG_TRACEPOINT_EVENT( |
b3c40230 MG |
20 | kvm_mmu_pagetable_walk, |
21 | TP_PROTO(u64 addr, u32 pferr), | |
22 | TP_ARGS(addr, pferr), | |
23 | ||
f127e61e MD |
24 | TP_FIELDS( |
25 | ctf_integer(__u64, addr, addr) | |
26 | ctf_integer(__u32, pferr, pferr) | |
27 | ) | |
b3c40230 MG |
28 | ) |
29 | ||
30 | ||
31 | /* We just walked a paging element */ | |
3bc29f0a | 32 | LTTNG_TRACEPOINT_EVENT( |
b3c40230 MG |
33 | kvm_mmu_paging_element, |
34 | TP_PROTO(u64 pte, int level), | |
35 | TP_ARGS(pte, level), | |
36 | ||
f127e61e MD |
37 | TP_FIELDS( |
38 | ctf_integer(__u64, pte, pte) | |
39 | ctf_integer(__u32, level, level) | |
40 | ) | |
b3c40230 MG |
41 | ) |
42 | ||
3bc29f0a | 43 | LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_set_bit_class, |
b3c40230 MG |
44 | |
45 | TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size), | |
46 | ||
47 | TP_ARGS(table_gfn, index, size), | |
48 | ||
f127e61e MD |
49 | TP_FIELDS( |
50 | ctf_integer(__u64, gpa, | |
51 | ((u64)table_gfn << PAGE_SHIFT) + index * size) | |
52 | ) | |
b3c40230 MG |
53 | ) |
54 | ||
55 | /* We set a pte accessed bit */ | |
3bc29f0a | 56 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_set_bit_class, kvm_mmu_set_accessed_bit, |
b3c40230 MG |
57 | |
58 | TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size), | |
59 | ||
60 | TP_ARGS(table_gfn, index, size) | |
61 | ) | |
62 | ||
63 | /* We set a pte dirty bit */ | |
3bc29f0a | 64 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_set_bit_class, kvm_mmu_set_dirty_bit, |
b3c40230 MG |
65 | |
66 | TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size), | |
67 | ||
68 | TP_ARGS(table_gfn, index, size) | |
69 | ) | |
70 | ||
3bc29f0a | 71 | LTTNG_TRACEPOINT_EVENT( |
b3c40230 MG |
72 | kvm_mmu_walker_error, |
73 | TP_PROTO(u32 pferr), | |
74 | TP_ARGS(pferr), | |
75 | ||
f127e61e MD |
76 | TP_FIELDS( |
77 | ctf_integer(__u32, pferr, pferr) | |
78 | ) | |
b3c40230 MG |
79 | ) |
80 | ||
3bc29f0a | 81 | LTTNG_TRACEPOINT_EVENT( |
b3c40230 MG |
82 | kvm_mmu_get_page, |
83 | TP_PROTO(struct kvm_mmu_page *sp, bool created), | |
84 | TP_ARGS(sp, created), | |
85 | ||
f127e61e MD |
86 | TP_FIELDS( |
87 | LTTNG_KVM_MMU_PAGE_FIELDS | |
88 | ctf_integer(bool, created, created) | |
89 | ) | |
b3c40230 MG |
90 | ) |
91 | ||
3bc29f0a | 92 | LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_page_class, |
b3c40230 MG |
93 | |
94 | TP_PROTO(struct kvm_mmu_page *sp), | |
95 | TP_ARGS(sp), | |
96 | ||
f127e61e MD |
97 | TP_FIELDS( |
98 | LTTNG_KVM_MMU_PAGE_FIELDS | |
99 | ) | |
b3c40230 MG |
100 | ) |
101 | ||
3bc29f0a | 102 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_sync_page, |
b3c40230 MG |
103 | TP_PROTO(struct kvm_mmu_page *sp), |
104 | ||
105 | TP_ARGS(sp) | |
106 | ) | |
107 | ||
3bc29f0a | 108 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_unsync_page, |
b3c40230 MG |
109 | TP_PROTO(struct kvm_mmu_page *sp), |
110 | ||
111 | TP_ARGS(sp) | |
112 | ) | |
113 | ||
3bc29f0a | 114 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page, |
b3c40230 MG |
115 | TP_PROTO(struct kvm_mmu_page *sp), |
116 | ||
117 | TP_ARGS(sp) | |
118 | ) | |
119 | ||
9bbf98da | 120 | LTTNG_TRACEPOINT_EVENT_MAP( |
b3c40230 | 121 | mark_mmio_spte, |
9bbf98da MD |
122 | |
123 | kvm_mmu_mark_mmio_spte, | |
124 | ||
b3c40230 MG |
125 | TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access), |
126 | TP_ARGS(sptep, gfn, access), | |
127 | ||
f127e61e MD |
128 | TP_FIELDS( |
129 | ctf_integer(void *, sptep, sptep) | |
130 | ctf_integer(gfn_t, gfn, gfn) | |
131 | ctf_integer(unsigned, access, access) | |
132 | ) | |
b3c40230 MG |
133 | ) |
134 | ||
9bbf98da | 135 | LTTNG_TRACEPOINT_EVENT_MAP( |
b3c40230 | 136 | handle_mmio_page_fault, |
9bbf98da MD |
137 | |
138 | kvm_mmu_handle_mmio_page_fault, | |
139 | ||
b3c40230 MG |
140 | TP_PROTO(u64 addr, gfn_t gfn, unsigned access), |
141 | TP_ARGS(addr, gfn, access), | |
142 | ||
f127e61e MD |
143 | TP_FIELDS( |
144 | ctf_integer(u64, addr, addr) | |
145 | ctf_integer(gfn_t, gfn, gfn) | |
146 | ctf_integer(unsigned, access, access) | |
147 | ) | |
b3c40230 MG |
148 | ) |
149 | ||
9bbf98da | 150 | LTTNG_TRACEPOINT_EVENT_MAP( |
b3c40230 | 151 | fast_page_fault, |
9bbf98da MD |
152 | |
153 | kvm_mmu_fast_page_fault, | |
154 | ||
b3c40230 MG |
155 | TP_PROTO(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code, |
156 | u64 *sptep, u64 old_spte, bool retry), | |
157 | TP_ARGS(vcpu, gva, error_code, sptep, old_spte, retry), | |
158 | ||
f127e61e MD |
159 | TP_FIELDS( |
160 | ctf_integer(int, vcpu_id, vcpu->vcpu_id) | |
161 | ctf_integer(gva_t, gva, gva) | |
162 | ctf_integer(u32, error_code, error_code) | |
163 | ctf_integer(u64 *, sptep, sptep) | |
164 | ctf_integer(u64, old_spte, old_spte) | |
165 | ctf_integer(u64, new_spte, *sptep) | |
166 | ctf_integer(bool, retry, retry) | |
b3c40230 MG |
167 | ) |
168 | ) | |
9bbf98da | 169 | #endif /* LTTNG_TRACE_KVM_MMU_H */ |
b3c40230 MG |
170 | |
171 | #undef TRACE_INCLUDE_PATH | |
172 | #define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module/arch/x86/kvm | |
173 | #undef TRACE_INCLUDE_FILE | |
174 | #define TRACE_INCLUDE_FILE mmutrace | |
175 | ||
176 | /* This part must be outside protection */ | |
177 | #include "../../../../../../probes/define_trace.h" |