d9d03003fe99bdd58e381dd9ce7a0607caa4f9ed
[lttng-modules.git] / instrumentation / events / lttng-module / kvm.h
1 #if !defined(LTTNG_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define LTTNG_TRACE_KVM_MAIN_H
3
4 #include <probes/lttng-tracepoint-event.h>
5 #include <linux/version.h>
6
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM kvm
9
10 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
11
12 LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit,
13 TP_PROTO(__u32 reason, int errno),
14 TP_ARGS(reason, errno),
15
16 TP_FIELDS(
17 ctf_integer(__u32, reason, reason)
18 ctf_integer(int, errno, errno)
19 )
20 )
21 #endif
22
23 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
24 #if defined(__KVM_HAVE_IOAPIC)
25 #undef __KVM_HAVE_IRQ_LINE
26 #define __KVM_HAVE_IRQ_LINE
27 #endif
28 #endif
29
30 #if defined(__KVM_HAVE_IRQ_LINE)
31 LTTNG_TRACEPOINT_EVENT(kvm_set_irq,
32 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
33 TP_ARGS(gsi, level, irq_source_id),
34
35 TP_FIELDS(
36 ctf_integer(unsigned int, gsi, gsi)
37 ctf_integer(int, level, level)
38 ctf_integer(int, irq_source_id, irq_source_id)
39 )
40 )
41 #endif
42
43 #if defined(__KVM_HAVE_IOAPIC)
44
45 LTTNG_TRACEPOINT_EVENT(kvm_ioapic_set_irq,
46 TP_PROTO(__u64 e, int pin, bool coalesced),
47 TP_ARGS(e, pin, coalesced),
48
49 TP_FIELDS(
50 ctf_integer(__u64, e, e)
51 ctf_integer(int, pin, pin)
52 ctf_integer(bool, coalesced, coalesced)
53 )
54 )
55
56 LTTNG_TRACEPOINT_EVENT(kvm_msi_set_irq,
57 TP_PROTO(__u64 address, __u64 data),
58 TP_ARGS(address, data),
59
60 TP_FIELDS(
61 ctf_integer(__u64, address, address)
62 ctf_integer(__u64, data, data)
63 )
64 )
65
66 LTTNG_TRACEPOINT_EVENT(kvm_ack_irq,
67 TP_PROTO(unsigned int irqchip, unsigned int pin),
68 TP_ARGS(irqchip, pin),
69
70 TP_FIELDS(
71 ctf_integer(unsigned int, irqchip, irqchip)
72 ctf_integer(unsigned int, pin, pin)
73 )
74 )
75
76 #endif /* defined(__KVM_HAVE_IOAPIC) */
77
78 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
79 #define KVM_TRACE_MMIO_READ 1
80 #define KVM_TRACE_MMIO_WRITE 2
81
82 #define kvm_trace_symbol_mmio \
83 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
84 { KVM_TRACE_MMIO_READ, "read" }, \
85 { KVM_TRACE_MMIO_WRITE, "write" }
86
87 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) \
88 || LTTNG_KERNEL_RANGE(3,16,52, 3,17,0) \
89 || LTTNG_KERNEL_RANGE(3,2,97, 3,3,0) \
90 || LTTNG_DEBIAN_KERNEL_RANGE(4,9,65,0,3,0, 4,10,0,0,0,0))
91
92 LTTNG_TRACEPOINT_EVENT(kvm_mmio,
93 TP_PROTO(int type, int len, u64 gpa, void *val),
94 TP_ARGS(type, len, gpa, val),
95
96 TP_FIELDS(
97 ctf_integer(u32, type, type)
98 ctf_integer(u32, len, len)
99 ctf_integer(u64, gpa, gpa)
100 ctf_sequence_hex(unsigned char, val, val, u32, len)
101 )
102 )
103
104 #else
105
106 LTTNG_TRACEPOINT_EVENT(kvm_mmio,
107 TP_PROTO(int type, int len, u64 gpa, u64 val),
108 TP_ARGS(type, len, gpa, val),
109
110 TP_FIELDS(
111 ctf_integer(u32, type, type)
112 ctf_integer(u32, len, len)
113 ctf_integer(u64, gpa, gpa)
114 ctf_integer(u64, val, val)
115 )
116 )
117
118 #endif
119
120 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
121
122 #define kvm_fpu_load_symbol \
123 {0, "unload"}, \
124 {1, "load"}
125
126 LTTNG_TRACEPOINT_EVENT(kvm_fpu,
127 TP_PROTO(int load),
128 TP_ARGS(load),
129
130 TP_FIELDS(
131 ctf_integer(u32, load, load)
132 )
133 )
134
135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) \
136 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,327,0,0, 3,11,0,0,0,0))
137
138 LTTNG_TRACEPOINT_EVENT(kvm_age_page,
139 TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),
140 TP_ARGS(gfn, level, slot, ref),
141
142 TP_FIELDS(
143 ctf_integer(u64, hva,
144 ((gfn - slot->base_gfn) << PAGE_SHIFT) + slot->userspace_addr)
145 ctf_integer(u64, gfn, gfn)
146 ctf_integer(u8, level, level)
147 ctf_integer(u8, referenced, ref)
148 )
149 )
150
151 #else
152
153 LTTNG_TRACEPOINT_EVENT(kvm_age_page,
154 TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref),
155 TP_ARGS(hva, slot, ref),
156
157 TP_FIELDS(
158 ctf_integer(u64, hva, hva)
159 ctf_integer(u64, gfn,
160 slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT))
161 ctf_integer(u8, referenced, ref)
162 )
163 )
164 #endif
165 #endif
166
167 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
168
169 #ifdef CONFIG_KVM_ASYNC_PF
170 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class,
171
172 TP_PROTO(u64 gva, u64 gfn),
173
174 TP_ARGS(gva, gfn),
175
176 TP_FIELDS(
177 ctf_integer(__u64, gva, gva)
178 ctf_integer(u64, gfn, gfn)
179 )
180 )
181
182 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class, kvm_try_async_get_page,
183
184 TP_PROTO(u64 gva, u64 gfn),
185
186 TP_ARGS(gva, gfn)
187 )
188
189 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class, kvm_async_pf_doublefault,
190
191 TP_PROTO(u64 gva, u64 gfn),
192
193 TP_ARGS(gva, gfn)
194 )
195
196 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_pf_nopresent_ready,
197
198 TP_PROTO(u64 token, u64 gva),
199
200 TP_ARGS(token, gva),
201
202 TP_FIELDS(
203 ctf_integer(__u64, token, token)
204 ctf_integer(__u64, gva, gva)
205 )
206 )
207
208 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present,
209
210 TP_PROTO(u64 token, u64 gva),
211
212 TP_ARGS(token, gva)
213 )
214
215 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
216
217 TP_PROTO(u64 token, u64 gva),
218
219 TP_ARGS(token, gva)
220 )
221
222 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) \
223 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
224
225 LTTNG_TRACEPOINT_EVENT(
226 kvm_async_pf_completed,
227 TP_PROTO(unsigned long address, u64 gva),
228 TP_ARGS(address, gva),
229
230 TP_FIELDS(
231 ctf_integer(unsigned long, address, address)
232 ctf_integer(u64, gva, gva)
233 )
234 )
235
236 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
237
238 LTTNG_TRACEPOINT_EVENT(
239 kvm_async_pf_completed,
240 TP_PROTO(unsigned long address, struct page *page, u64 gva),
241 TP_ARGS(address, page, gva),
242
243 TP_FIELDS(
244 ctf_integer(unsigned long, address, address)
245 ctf_integer(pfn_t, pfn, page ? page_to_pfn(page) : 0)
246 ctf_integer(u64, gva, gva)
247 )
248 )
249
250 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
251
252 #endif
253
254 #endif
255
256 #endif /* LTTNG_TRACE_KVM_MAIN_H */
257
258 /* This part must be outside protection */
259 #include <probes/define_trace.h>
This page took 0.037163 seconds and 3 git commands to generate.