fix: KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint (v5.10)
[lttng-modules.git] / include / instrumentation / events / arch / x86 / kvm / trace.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #if !defined(LTTNG_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define LTTNG_TRACE_KVM_H
4
5 #include <lttng/tracepoint-event.h>
6 #include <asm/vmx.h>
7 #include <asm/svm.h>
8 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
9 #include <asm/clocksource.h>
10 #endif
11 #include <linux/version.h>
12 #include <../arch/x86/kvm/lapic.h>
13 #include <../arch/x86/kvm/kvm_cache_regs.h>
14
15 #undef TRACE_SYSTEM
16 #define TRACE_SYSTEM kvm_x86
17
18 /*
19 * Tracepoint for guest mode entry.
20 */
21 LTTNG_TRACEPOINT_EVENT_MAP(kvm_entry, kvm_x86_entry,
22 TP_PROTO(unsigned int vcpu_id),
23 TP_ARGS(vcpu_id),
24
25 TP_FIELDS(
26 ctf_integer(unsigned int, vcpu_id, vcpu_id)
27 )
28 )
29
30 /*
31 * Tracepoint for hypercall.
32 */
33 LTTNG_TRACEPOINT_EVENT_MAP(kvm_hypercall, kvm_x86_hypercall,
34 TP_PROTO(unsigned long nr, unsigned long a0, unsigned long a1,
35 unsigned long a2, unsigned long a3),
36 TP_ARGS(nr, a0, a1, a2, a3),
37
38 TP_FIELDS(
39 ctf_integer(unsigned long, nr, nr)
40 ctf_integer(unsigned long, a0, a0)
41 ctf_integer(unsigned long, a1, a1)
42 ctf_integer(unsigned long, a2, a2)
43 ctf_integer(unsigned long, a3, a3)
44 )
45 )
46
47 /*
48 * Tracepoint for hypercall.
49 */
50 LTTNG_TRACEPOINT_EVENT_MAP(kvm_hv_hypercall, kvm_x86_hv_hypercall,
51 TP_PROTO(__u16 code, bool fast, __u16 rep_cnt, __u16 rep_idx,
52 __u64 ingpa, __u64 outgpa),
53 TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa),
54
55 TP_FIELDS(
56 ctf_integer(__u16, rep_cnt, rep_cnt)
57 ctf_integer(__u16, rep_idx, rep_idx)
58 ctf_integer(__u64, ingpa, ingpa)
59 ctf_integer(__u64, outgpa, outgpa)
60 ctf_integer(__u16, code, code)
61 ctf_integer(bool, fast, fast)
62 )
63 )
64
65 /*
66 * Tracepoint for PIO.
67 */
68 LTTNG_TRACEPOINT_EVENT_MAP(kvm_pio, kvm_x86_pio,
69 TP_PROTO(unsigned int rw, unsigned int port, unsigned int size,
70 unsigned int count),
71 TP_ARGS(rw, port, size, count),
72
73 TP_FIELDS(
74 ctf_integer(unsigned int, rw, rw)
75 ctf_integer(unsigned int, port, port)
76 ctf_integer(unsigned int, size, size)
77 ctf_integer(unsigned int, count, count)
78 )
79 )
80
81 /*
82 * Tracepoint for cpuid.
83 */
84 LTTNG_TRACEPOINT_EVENT_MAP(kvm_cpuid, kvm_x86_cpuid,
85 TP_PROTO(unsigned int function, unsigned long rax, unsigned long rbx,
86 unsigned long rcx, unsigned long rdx),
87 TP_ARGS(function, rax, rbx, rcx, rdx),
88
89 TP_FIELDS(
90 ctf_integer(unsigned int, function, function)
91 ctf_integer(unsigned long, rax, rax)
92 ctf_integer(unsigned long, rbx, rbx)
93 ctf_integer(unsigned long, rcx, rcx)
94 ctf_integer(unsigned long, rdx, rdx)
95 )
96 )
97
98 /*
99 * Tracepoint for apic access.
100 */
101 LTTNG_TRACEPOINT_EVENT_MAP(kvm_apic, kvm_x86_apic,
102 TP_PROTO(unsigned int rw, unsigned int reg, unsigned int val),
103 TP_ARGS(rw, reg, val),
104
105 TP_FIELDS(
106 ctf_integer(unsigned int, rw, rw)
107 ctf_integer(unsigned int, reg, reg)
108 ctf_integer(unsigned int, val, val)
109 )
110 )
111
112 #define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val)
113 #define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val)
114
115 /*
116 * Tracepoint for kvm guest exit:
117 */
118 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
119 LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
120 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
121 TP_ARGS(exit_reason, vcpu, isa),
122
123 TP_locvar(
124 u64 info1, info2;
125 u32 intr_info, error_code;
126 ),
127
128 TP_code_pre(
129 kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1,
130 &tp_locvar->info2,
131 &tp_locvar->intr_info,
132 &tp_locvar->error_code);
133 ),
134
135 TP_FIELDS(
136 ctf_integer(unsigned int, exit_reason, exit_reason)
137 ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu))
138 ctf_integer(u32, isa, isa)
139 ctf_integer(u64, info1, tp_locvar->info1)
140 ctf_integer(u64, info2, tp_locvar->info2)
141 ctf_integer(u32, intr_info, tp_locvar->intr_info)
142 ctf_integer(u32, error_code, tp_locvar->error_code)
143 ctf_integer(unsigned int, vcpu_id, vcpu->vcpu_id)
144 ),
145
146 TP_code_post()
147 )
148 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
149 LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
150 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
151 TP_ARGS(exit_reason, vcpu, isa),
152
153 TP_locvar(
154 u64 info1, info2;
155 ),
156
157 TP_code_pre(
158 kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1,
159 &tp_locvar->info2);
160 ),
161
162 TP_FIELDS(
163 ctf_integer(unsigned int, exit_reason, exit_reason)
164 ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu))
165 ctf_integer(u32, isa, isa)
166 ctf_integer(u64, info1, tp_locvar->info1)
167 ctf_integer(u64, info2, tp_locvar->info2)
168 ),
169
170 TP_code_post()
171 )
172 #else
173 LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
174 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
175 TP_ARGS(exit_reason, vcpu, isa),
176
177 TP_locvar(
178 u64 info1, info2;
179 ),
180
181 TP_code_pre(
182 kvm_x86_ops->get_exit_info(vcpu, &tp_locvar->info1,
183 &tp_locvar->info2);
184 ),
185
186 TP_FIELDS(
187 ctf_integer(unsigned int, exit_reason, exit_reason)
188 ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu))
189 ctf_integer(u32, isa, isa)
190 ctf_integer(u64, info1, tp_locvar->info1)
191 ctf_integer(u64, info2, tp_locvar->info2)
192 ),
193
194 TP_code_post()
195 )
196 #endif
197
198 /*
199 * Tracepoint for kvm interrupt injection:
200 */
201 LTTNG_TRACEPOINT_EVENT_MAP(kvm_inj_virq, kvm_x86_inj_virq,
202 TP_PROTO(unsigned int irq),
203 TP_ARGS(irq),
204
205 TP_FIELDS(
206 ctf_integer(unsigned int, irq, irq)
207 )
208 )
209
210 /*
211 * Tracepoint for kvm interrupt injection:
212 */
213 LTTNG_TRACEPOINT_EVENT_MAP(kvm_inj_exception, kvm_x86_inj_exception,
214 TP_PROTO(unsigned exception, bool has_error, unsigned error_code),
215 TP_ARGS(exception, has_error, error_code),
216
217 TP_FIELDS(
218 ctf_integer(u8, exception, exception)
219 ctf_integer(u8, has_error, has_error)
220 ctf_integer(u32, error_code, error_code)
221 )
222 )
223
224 /*
225 * Tracepoint for page fault.
226 */
227 LTTNG_TRACEPOINT_EVENT_MAP(kvm_page_fault, kvm_x86_page_fault,
228 TP_PROTO(unsigned long fault_address, unsigned int error_code),
229 TP_ARGS(fault_address, error_code),
230
231 TP_FIELDS(
232 ctf_integer_hex(unsigned long, fault_address, fault_address)
233 ctf_integer(unsigned int, error_code, error_code)
234 )
235 )
236
237 /*
238 * Tracepoint for guest MSR access.
239 */
240 LTTNG_TRACEPOINT_EVENT_MAP(kvm_msr, kvm_x86_msr,
241 TP_PROTO(unsigned write, u32 ecx, u64 data, bool exception),
242 TP_ARGS(write, ecx, data, exception),
243
244 TP_FIELDS(
245 ctf_integer(unsigned, write, write)
246 ctf_integer(u32, ecx, ecx)
247 ctf_integer(u64, data, data)
248 ctf_integer(u8, exception, exception)
249 )
250 )
251
252 #define trace_kvm_msr_read(ecx, data) trace_kvm_msr(0, ecx, data, false)
253 #define trace_kvm_msr_write(ecx, data) trace_kvm_msr(1, ecx, data, false)
254 #define trace_kvm_msr_read_ex(ecx) trace_kvm_msr(0, ecx, 0, true)
255 #define trace_kvm_msr_write_ex(ecx, data) trace_kvm_msr(1, ecx, data, true)
256
257 /*
258 * Tracepoint for guest CR access.
259 */
260 LTTNG_TRACEPOINT_EVENT_MAP(kvm_cr, kvm_x86_cr,
261 TP_PROTO(unsigned int rw, unsigned int cr, unsigned long val),
262 TP_ARGS(rw, cr, val),
263
264 TP_FIELDS(
265 ctf_integer(unsigned int, rw, rw)
266 ctf_integer(unsigned int, cr, cr)
267 ctf_integer(unsigned long, val, val)
268 )
269 )
270
271 #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val)
272 #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val)
273
274 LTTNG_TRACEPOINT_EVENT_MAP(kvm_pic_set_irq, kvm_x86_pic_set_irq,
275 TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced),
276 TP_ARGS(chip, pin, elcr, imr, coalesced),
277
278 TP_FIELDS(
279 ctf_integer(__u8, chip, chip)
280 ctf_integer(__u8, pin, pin)
281 ctf_integer(__u8, elcr, elcr)
282 ctf_integer(__u8, imr, imr)
283 ctf_integer(bool, coalesced, coalesced)
284 )
285 )
286
287 LTTNG_TRACEPOINT_EVENT_MAP(kvm_apic_ipi, kvm_x86_apic_ipi,
288 TP_PROTO(__u32 icr_low, __u32 dest_id),
289 TP_ARGS(icr_low, dest_id),
290
291 TP_FIELDS(
292 ctf_integer(__u32, icr_low, icr_low)
293 ctf_integer(__u32, dest_id, dest_id)
294 )
295 )
296
297 LTTNG_TRACEPOINT_EVENT_MAP(kvm_apic_accept_irq, kvm_x86_apic_accept_irq,
298 TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec, bool coalesced),
299 TP_ARGS(apicid, dm, tm, vec, coalesced),
300
301 TP_FIELDS(
302 ctf_integer(__u32, apicid, apicid)
303 ctf_integer(__u16, dm, dm)
304 ctf_integer(__u8, tm, tm)
305 ctf_integer(__u8, vec, vec)
306 ctf_integer(bool, coalesced, coalesced)
307 )
308 )
309
310 LTTNG_TRACEPOINT_EVENT_MAP(kvm_eoi, kvm_x86_eoi,
311 TP_PROTO(struct kvm_lapic *apic, int vector),
312 TP_ARGS(apic, vector),
313
314 TP_FIELDS(
315 ctf_integer(__u32, apicid, apic->vcpu->vcpu_id)
316 ctf_integer(int, vector, vector)
317 )
318 )
319
320 LTTNG_TRACEPOINT_EVENT_MAP(kvm_pv_eoi, kvm_x86_pv_eoi,
321 TP_PROTO(struct kvm_lapic *apic, int vector),
322 TP_ARGS(apic, vector),
323
324 TP_FIELDS(
325 ctf_integer(__u32, apicid, apic->vcpu->vcpu_id)
326 ctf_integer(int, vector, vector)
327 )
328 )
329
330 /*
331 * Tracepoint for nested VMRUN
332 */
333 LTTNG_TRACEPOINT_EVENT_MAP(kvm_nested_vmrun, kvm_x86_nested_vmrun,
334 TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl,
335 __u32 event_inj, bool npt),
336 TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt),
337
338 TP_FIELDS(
339 ctf_integer(__u64, rip, rip)
340 ctf_integer(__u64, vmcb, vmcb)
341 ctf_integer(__u64, nested_rip, nested_rip)
342 ctf_integer(__u32, int_ctl, int_ctl)
343 ctf_integer(__u32, event_inj, event_inj)
344 ctf_integer(bool, npt, npt)
345 )
346 )
347
348 LTTNG_TRACEPOINT_EVENT_MAP(kvm_nested_intercepts, kvm_x86_nested_intercepts,
349 TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions, __u64 intercept),
350 TP_ARGS(cr_read, cr_write, exceptions, intercept),
351
352 TP_FIELDS(
353 ctf_integer(__u16, cr_read, cr_read)
354 ctf_integer(__u16, cr_write, cr_write)
355 ctf_integer(__u32, exceptions, exceptions)
356 ctf_integer(__u64, intercept, intercept)
357 )
358 )
359 /*
360 * Tracepoint for #VMEXIT while nested
361 */
362 LTTNG_TRACEPOINT_EVENT_MAP(kvm_nested_vmexit, kvm_x86_nested_vmexit,
363 TP_PROTO(__u64 rip, __u32 exit_code,
364 __u64 exit_info1, __u64 exit_info2,
365 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa),
366 TP_ARGS(rip, exit_code, exit_info1, exit_info2,
367 exit_int_info, exit_int_info_err, isa),
368
369 TP_FIELDS(
370 ctf_integer(__u64, rip, rip)
371 ctf_integer(__u32, exit_code, exit_code)
372 ctf_integer(__u64, exit_info1, exit_info1)
373 ctf_integer(__u64, exit_info2, exit_info2)
374 ctf_integer(__u32, exit_int_info, exit_int_info)
375 ctf_integer(__u32, exit_int_info_err, exit_int_info_err)
376 ctf_integer(__u32, isa, isa)
377 )
378 )
379
380 /*
381 * Tracepoint for #VMEXIT reinjected to the guest
382 */
383 LTTNG_TRACEPOINT_EVENT_MAP(kvm_nested_vmexit_inject, kvm_x86_nested_vmexit_inject,
384 TP_PROTO(__u32 exit_code,
385 __u64 exit_info1, __u64 exit_info2,
386 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa),
387 TP_ARGS(exit_code, exit_info1, exit_info2,
388 exit_int_info, exit_int_info_err, isa),
389
390 TP_FIELDS(
391 ctf_integer(__u32, exit_code, exit_code)
392 ctf_integer(__u64, exit_info1, exit_info1)
393 ctf_integer(__u64, exit_info2, exit_info2)
394 ctf_integer(__u32, exit_int_info, exit_int_info)
395 ctf_integer(__u32, exit_int_info_err, exit_int_info_err)
396 ctf_integer(__u32, isa, isa)
397 )
398 )
399
400 /*
401 * Tracepoint for nested #vmexit because of interrupt pending
402 */
403 LTTNG_TRACEPOINT_EVENT_MAP(kvm_nested_intr_vmexit, kvm_x86_nested_intr_vmexit,
404 TP_PROTO(__u64 rip),
405 TP_ARGS(rip),
406
407 TP_FIELDS(
408 ctf_integer(__u64, rip, rip)
409 )
410 )
411
412 /*
413 * Tracepoint for nested #vmexit because of interrupt pending
414 */
415 LTTNG_TRACEPOINT_EVENT_MAP(kvm_invlpga, kvm_x86_invlpga,
416 TP_PROTO(__u64 rip, int asid, u64 address),
417 TP_ARGS(rip, asid, address),
418
419 TP_FIELDS(
420 ctf_integer(__u64, rip, rip)
421 ctf_integer(int, asid, asid)
422 ctf_integer_hex(__u64, address, address)
423 )
424 )
425
426 /*
427 * Tracepoint for nested #vmexit because of interrupt pending
428 */
429 LTTNG_TRACEPOINT_EVENT_MAP(kvm_skinit, kvm_x86_skinit,
430 TP_PROTO(__u64 rip, __u32 slb),
431 TP_ARGS(rip, slb),
432
433 TP_FIELDS(
434 ctf_integer(__u64, rip, rip)
435 ctf_integer(__u32, slb, slb)
436 )
437 )
438
439 #define KVM_EMUL_INSN_F_CR0_PE (1 << 0)
440 #define KVM_EMUL_INSN_F_EFL_VM (1 << 1)
441 #define KVM_EMUL_INSN_F_CS_D (1 << 2)
442 #define KVM_EMUL_INSN_F_CS_L (1 << 3)
443
444 #define kvm_trace_symbol_emul_flags \
445 { 0, "real" }, \
446 { KVM_EMUL_INSN_F_CR0_PE \
447 | KVM_EMUL_INSN_F_EFL_VM, "vm16" }, \
448 { KVM_EMUL_INSN_F_CR0_PE, "prot16" }, \
449 { KVM_EMUL_INSN_F_CR0_PE \
450 | KVM_EMUL_INSN_F_CS_D, "prot32" }, \
451 { KVM_EMUL_INSN_F_CR0_PE \
452 | KVM_EMUL_INSN_F_CS_L, "prot64" }
453
454 #define kei_decode_mode(mode) ({ \
455 u8 flags = 0xff; \
456 switch (mode) { \
457 case X86EMUL_MODE_REAL: \
458 flags = 0; \
459 break; \
460 case X86EMUL_MODE_VM86: \
461 flags = KVM_EMUL_INSN_F_EFL_VM; \
462 break; \
463 case X86EMUL_MODE_PROT16: \
464 flags = KVM_EMUL_INSN_F_CR0_PE; \
465 break; \
466 case X86EMUL_MODE_PROT32: \
467 flags = KVM_EMUL_INSN_F_CR0_PE \
468 | KVM_EMUL_INSN_F_CS_D; \
469 break; \
470 case X86EMUL_MODE_PROT64: \
471 flags = KVM_EMUL_INSN_F_CR0_PE \
472 | KVM_EMUL_INSN_F_CS_L; \
473 break; \
474 } \
475 flags; \
476 })
477
478 LTTNG_TRACEPOINT_EVENT_MAP(kvm_emulate_insn, kvm_x86_emulate_insn,
479 TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed),
480 TP_ARGS(vcpu, failed),
481
482 TP_FIELDS(
483 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
484 ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.decode.fetch.start)
485 ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS))
486 ctf_integer(__u8, len, vcpu->arch.emulate_ctxt.decode.eip
487 - vcpu->arch.emulate_ctxt.decode.fetch.start)
488 ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.decode.fetch.data, 15)
489 ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
490 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
491 ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt.fetch.start)
492 ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS))
493 ctf_integer(__u8, len, vcpu->arch.emulate_ctxt._eip
494 - vcpu->arch.emulate_ctxt.fetch.start)
495 ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15)
496 ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
497 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0))
498 ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt._eip -
499 (vcpu->arch.emulate_ctxt.fetch.ptr -
500 vcpu->arch.emulate_ctxt.fetch.data))
501 ctf_integer(__u32, csbase, kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS))
502 ctf_integer(__u8, len, vcpu->arch.emulate_ctxt.fetch.ptr -
503 vcpu->arch.emulate_ctxt.fetch.data)
504 ctf_array(__u8, insn, vcpu->arch.emulate_ctxt.fetch.data, 15)
505 ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt.mode))
506 #else
507 ctf_integer(__u64, rip, vcpu->arch.emulate_ctxt->_eip -
508 (vcpu->arch.emulate_ctxt->fetch.ptr -
509 vcpu->arch.emulate_ctxt->fetch.data))
510 ctf_integer(__u32, csbase, kvm_x86_ops.get_segment_base(vcpu, VCPU_SREG_CS))
511 ctf_integer(__u8, len, vcpu->arch.emulate_ctxt->fetch.ptr -
512 vcpu->arch.emulate_ctxt->fetch.data)
513 ctf_array(__u8, insn, vcpu->arch.emulate_ctxt->fetch.data, 15)
514 ctf_integer(__u8, flags, kei_decode_mode(vcpu->arch.emulate_ctxt->mode))
515 #endif
516 ctf_integer(__u8, failed, failed)
517 )
518 )
519
520 #define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0)
521 #define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1)
522
523 LTTNG_TRACEPOINT_EVENT_MAP(
524 vcpu_match_mmio, kvm_x86_vcpu_match_mmio,
525 TP_PROTO(gva_t gva, gpa_t gpa, bool write, bool gpa_match),
526 TP_ARGS(gva, gpa, write, gpa_match),
527
528 TP_FIELDS(
529 ctf_integer(gva_t, gva, gva)
530 ctf_integer(gpa_t, gpa, gpa)
531 ctf_integer(bool, write, write)
532 ctf_integer(bool, gpa_match, gpa_match)
533 )
534 )
535
536 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
537 LTTNG_TRACEPOINT_EVENT_MAP(kvm_write_tsc_offset, kvm_x86_write_tsc_offset,
538 TP_PROTO(unsigned int vcpu_id, __u64 previous_tsc_offset,
539 __u64 next_tsc_offset),
540 TP_ARGS(vcpu_id, previous_tsc_offset, next_tsc_offset),
541
542 TP_FIELDS(
543 ctf_integer(unsigned int, vcpu_id, vcpu_id)
544 ctf_integer(__u64, previous_tsc_offset, previous_tsc_offset)
545 ctf_integer(__u64, next_tsc_offset, next_tsc_offset)
546 )
547 )
548 #endif
549
550 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
551 #ifdef CONFIG_X86_64
552
553 LTTNG_TRACEPOINT_EVENT_MAP(kvm_update_master_clock, kvm_x86_update_master_clock,
554 TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched),
555 TP_ARGS(use_master_clock, host_clock, offset_matched),
556
557 TP_FIELDS(
558 ctf_integer(bool, use_master_clock, use_master_clock)
559 ctf_integer(unsigned int, host_clock, host_clock)
560 ctf_integer(bool, offset_matched, offset_matched)
561 )
562 )
563
564 LTTNG_TRACEPOINT_EVENT_MAP(kvm_track_tsc, kvm_x86_track_tsc,
565 TP_PROTO(unsigned int vcpu_id, unsigned int nr_matched,
566 unsigned int online_vcpus, bool use_master_clock,
567 unsigned int host_clock),
568 TP_ARGS(vcpu_id, nr_matched, online_vcpus, use_master_clock,
569 host_clock),
570
571 TP_FIELDS(
572 ctf_integer(unsigned int, vcpu_id, vcpu_id)
573 ctf_integer(unsigned int, nr_vcpus_matched_tsc, nr_matched)
574 ctf_integer(unsigned int, online_vcpus, online_vcpus)
575 ctf_integer(bool, use_master_clock, use_master_clock)
576 ctf_integer(unsigned int, host_clock, host_clock)
577 )
578 )
579
580 #endif /* CONFIG_X86_64 */
581 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) */
582
583 #endif /* LTTNG_TRACE_KVM_H */
584
585 #undef TRACE_INCLUDE_PATH
586 #define TRACE_INCLUDE_PATH instrumentation/events/arch/x86/kvm
587 #undef TRACE_INCLUDE_FILE
588 #define TRACE_INCLUDE_FILE trace
589
590 /* This part must be outside protection */
591 #include <lttng/define_trace.h>
This page took 0.04147 seconds and 4 git commands to generate.