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