1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) 3 #define _TRACE_KVM_H 4 5 #include <linux/tracepoint.h> 6 #include <asm/vmx.h> 7 #include <asm/svm.h> 8 #include <asm/clocksource.h> 9 #include <asm/pvclock-abi.h> 10 11 #undef TRACE_SYSTEM 12 #define TRACE_SYSTEM kvm 13 14 /* 15 * Tracepoint for guest mode entry. 16 */ 17 TRACE_EVENT(kvm_entry, 18 TP_PROTO(unsigned int vcpu_id), 19 TP_ARGS(vcpu_id), 20 21 TP_STRUCT__entry( 22 __field( unsigned int, vcpu_id ) 23 ), 24 25 TP_fast_assign( 26 __entry->vcpu_id = vcpu_id; 27 ), 28 29 TP_printk("vcpu %u", __entry->vcpu_id) 30 ); 31 32 /* 33 * Tracepoint for hypercall. 34 */ 35 TRACE_EVENT(kvm_hypercall, 36 TP_PROTO(unsigned long nr, unsigned long a0, unsigned long a1, 37 unsigned long a2, unsigned long a3), 38 TP_ARGS(nr, a0, a1, a2, a3), 39 40 TP_STRUCT__entry( 41 __field( unsigned long, nr ) 42 __field( unsigned long, a0 ) 43 __field( unsigned long, a1 ) 44 __field( unsigned long, a2 ) 45 __field( unsigned long, a3 ) 46 ), 47 48 TP_fast_assign( 49 __entry->nr = nr; 50 __entry->a0 = a0; 51 __entry->a1 = a1; 52 __entry->a2 = a2; 53 __entry->a3 = a3; 54 ), 55 56 TP_printk("nr 0x%lx a0 0x%lx a1 0x%lx a2 0x%lx a3 0x%lx", 57 __entry->nr, __entry->a0, __entry->a1, __entry->a2, 58 __entry->a3) 59 ); 60 61 /* 62 * Tracepoint for hypercall. 63 */ 64 TRACE_EVENT(kvm_hv_hypercall, 65 TP_PROTO(__u16 code, bool fast, __u16 rep_cnt, __u16 rep_idx, 66 __u64 ingpa, __u64 outgpa), 67 TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa), 68 69 TP_STRUCT__entry( 70 __field( __u16, rep_cnt ) 71 __field( __u16, rep_idx ) 72 __field( __u64, ingpa ) 73 __field( __u64, outgpa ) 74 __field( __u16, code ) 75 __field( bool, fast ) 76 ), 77 78 TP_fast_assign( 79 __entry->rep_cnt = rep_cnt; 80 __entry->rep_idx = rep_idx; 81 __entry->ingpa = ingpa; 82 __entry->outgpa = outgpa; 83 __entry->code = code; 84 __entry->fast = fast; 85 ), 86 87 TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx", 88 __entry->code, __entry->fast ? "fast" : "slow", 89 __entry->rep_cnt, __entry->rep_idx, __entry->ingpa, 90 __entry->outgpa) 91 ); 92 93 /* 94 * Tracepoint for PIO. 95 */ 96 97 #define KVM_PIO_IN 0 98 #define KVM_PIO_OUT 1 99 100 TRACE_EVENT(kvm_pio, 101 TP_PROTO(unsigned int rw, unsigned int port, unsigned int size, 102 unsigned int count, void *data), 103 TP_ARGS(rw, port, size, count, data), 104 105 TP_STRUCT__entry( 106 __field( unsigned int, rw ) 107 __field( unsigned int, port ) 108 __field( unsigned int, size ) 109 __field( unsigned int, count ) 110 __field( unsigned int, val ) 111 ), 112 113 TP_fast_assign( 114 __entry->rw = rw; 115 __entry->port = port; 116 __entry->size = size; 117 __entry->count = count; 118 if (size == 1) 119 __entry->val = *(unsigned char *)data; 120 else if (size == 2) 121 __entry->val = *(unsigned short *)data; 122 else 123 __entry->val = *(unsigned int *)data; 124 ), 125 126 TP_printk("pio_%s at 0x%x size %d count %d val 0x%x %s", 127 __entry->rw ? "write" : "read", 128 __entry->port, __entry->size, __entry->count, __entry->val, 129 __entry->count > 1 ? "(...)" : "") 130 ); 131 132 /* 133 * Tracepoint for fast mmio. 134 */ 135 TRACE_EVENT(kvm_fast_mmio, 136 TP_PROTO(u64 gpa), 137 TP_ARGS(gpa), 138 139 TP_STRUCT__entry( 140 __field(u64, gpa) 141 ), 142 143 TP_fast_assign( 144 __entry->gpa = gpa; 145 ), 146 147 TP_printk("fast mmio at gpa 0x%llx", __entry->gpa) 148 ); 149 150 /* 151 * Tracepoint for cpuid. 152 */ 153 TRACE_EVENT(kvm_cpuid, 154 TP_PROTO(unsigned int function, unsigned long rax, unsigned long rbx, 155 unsigned long rcx, unsigned long rdx, bool found), 156 TP_ARGS(function, rax, rbx, rcx, rdx, found), 157 158 TP_STRUCT__entry( 159 __field( unsigned int, function ) 160 __field( unsigned long, rax ) 161 __field( unsigned long, rbx ) 162 __field( unsigned long, rcx ) 163 __field( unsigned long, rdx ) 164 __field( bool, found ) 165 ), 166 167 TP_fast_assign( 168 __entry->function = function; 169 __entry->rax = rax; 170 __entry->rbx = rbx; 171 __entry->rcx = rcx; 172 __entry->rdx = rdx; 173 __entry->found = found; 174 ), 175 176 TP_printk("func %x rax %lx rbx %lx rcx %lx rdx %lx, cpuid entry %s", 177 __entry->function, __entry->rax, 178 __entry->rbx, __entry->rcx, __entry->rdx, 179 __entry->found ? "found" : "not found") 180 ); 181 182 #define AREG(x) { APIC_##x, "APIC_" #x } 183 184 #define kvm_trace_symbol_apic \ 185 AREG(ID), AREG(LVR), AREG(TASKPRI), AREG(ARBPRI), AREG(PROCPRI), \ 186 AREG(EOI), AREG(RRR), AREG(LDR), AREG(DFR), AREG(SPIV), AREG(ISR), \ 187 AREG(TMR), AREG(IRR), AREG(ESR), AREG(ICR), AREG(ICR2), AREG(LVTT), \ 188 AREG(LVTTHMR), AREG(LVTPC), AREG(LVT0), AREG(LVT1), AREG(LVTERR), \ 189 AREG(TMICT), AREG(TMCCT), AREG(TDCR), AREG(SELF_IPI), AREG(EFEAT), \ 190 AREG(ECTRL) 191 /* 192 * Tracepoint for apic access. 193 */ 194 TRACE_EVENT(kvm_apic, 195 TP_PROTO(unsigned int rw, unsigned int reg, unsigned int val), 196 TP_ARGS(rw, reg, val), 197 198 TP_STRUCT__entry( 199 __field( unsigned int, rw ) 200 __field( unsigned int, reg ) 201 __field( unsigned int, val ) 202 ), 203 204 TP_fast_assign( 205 __entry->rw = rw; 206 __entry->reg = reg; 207 __entry->val = val; 208 ), 209 210 TP_printk("apic_%s %s = 0x%x", 211 __entry->rw ? "write" : "read", 212 __print_symbolic(__entry->reg, kvm_trace_symbol_apic), 213 __entry->val) 214 ); 215 216 #define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val) 217 #define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val) 218 219 #define KVM_ISA_VMX 1 220 #define KVM_ISA_SVM 2 221 222 /* 223 * Tracepoint for kvm guest exit: 224 */ 225 TRACE_EVENT(kvm_exit, 226 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa), 227 TP_ARGS(exit_reason, vcpu, isa), 228 229 TP_STRUCT__entry( 230 __field( unsigned int, exit_reason ) 231 __field( unsigned long, guest_rip ) 232 __field( u32, isa ) 233 __field( u64, info1 ) 234 __field( u64, info2 ) 235 ), 236 237 TP_fast_assign( 238 __entry->exit_reason = exit_reason; 239 __entry->guest_rip = kvm_rip_read(vcpu); 240 __entry->isa = isa; 241 kvm_x86_ops->get_exit_info(vcpu, &__entry->info1, 242 &__entry->info2); 243 ), 244 245 TP_printk("reason %s rip 0x%lx info %llx %llx", 246 (__entry->isa == KVM_ISA_VMX) ? 247 __print_symbolic(__entry->exit_reason, VMX_EXIT_REASONS) : 248 __print_symbolic(__entry->exit_reason, SVM_EXIT_REASONS), 249 __entry->guest_rip, __entry->info1, __entry->info2) 250 ); 251 252 /* 253 * Tracepoint for kvm interrupt injection: 254 */ 255 TRACE_EVENT(kvm_inj_virq, 256 TP_PROTO(unsigned int irq), 257 TP_ARGS(irq), 258 259 TP_STRUCT__entry( 260 __field( unsigned int, irq ) 261 ), 262 263 TP_fast_assign( 264 __entry->irq = irq; 265 ), 266 267 TP_printk("irq %u", __entry->irq) 268 ); 269 270 #define EXS(x) { x##_VECTOR, "#" #x } 271 272 #define kvm_trace_sym_exc \ 273 EXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM), \ 274 EXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), \ 275 EXS(MF), EXS(AC), EXS(MC) 276 277 /* 278 * Tracepoint for kvm interrupt injection: 279 */ 280 TRACE_EVENT(kvm_inj_exception, 281 TP_PROTO(unsigned exception, bool has_error, unsigned error_code), 282 TP_ARGS(exception, has_error, error_code), 283 284 TP_STRUCT__entry( 285 __field( u8, exception ) 286 __field( u8, has_error ) 287 __field( u32, error_code ) 288 ), 289 290 TP_fast_assign( 291 __entry->exception = exception; 292 __entry->has_error = has_error; 293 __entry->error_code = error_code; 294 ), 295 296 TP_printk("%s (0x%x)", 297 __print_symbolic(__entry->exception, kvm_trace_sym_exc), 298 /* FIXME: don't print error_code if not present */ 299 __entry->has_error ? __entry->error_code : 0) 300 ); 301 302 /* 303 * Tracepoint for page fault. 304 */ 305 TRACE_EVENT(kvm_page_fault, 306 TP_PROTO(unsigned long fault_address, unsigned int error_code), 307 TP_ARGS(fault_address, error_code), 308 309 TP_STRUCT__entry( 310 __field( unsigned long, fault_address ) 311 __field( unsigned int, error_code ) 312 ), 313 314 TP_fast_assign( 315 __entry->fault_address = fault_address; 316 __entry->error_code = error_code; 317 ), 318 319 TP_printk("address %lx error_code %x", 320 __entry->fault_address, __entry->error_code) 321 ); 322 323 /* 324 * Tracepoint for guest MSR access. 325 */ 326 TRACE_EVENT(kvm_msr, 327 TP_PROTO(unsigned write, u32 ecx, u64 data, bool exception), 328 TP_ARGS(write, ecx, data, exception), 329 330 TP_STRUCT__entry( 331 __field( unsigned, write ) 332 __field( u32, ecx ) 333 __field( u64, data ) 334 __field( u8, exception ) 335 ), 336 337 TP_fast_assign( 338 __entry->write = write; 339 __entry->ecx = ecx; 340 __entry->data = data; 341 __entry->exception = exception; 342 ), 343 344 TP_printk("msr_%s %x = 0x%llx%s", 345 __entry->write ? "write" : "read", 346 __entry->ecx, __entry->data, 347 __entry->exception ? " (#GP)" : "") 348 ); 349 350 #define trace_kvm_msr_read(ecx, data) trace_kvm_msr(0, ecx, data, false) 351 #define trace_kvm_msr_write(ecx, data) trace_kvm_msr(1, ecx, data, false) 352 #define trace_kvm_msr_read_ex(ecx) trace_kvm_msr(0, ecx, 0, true) 353 #define trace_kvm_msr_write_ex(ecx, data) trace_kvm_msr(1, ecx, data, true) 354 355 /* 356 * Tracepoint for guest CR access. 357 */ 358 TRACE_EVENT(kvm_cr, 359 TP_PROTO(unsigned int rw, unsigned int cr, unsigned long val), 360 TP_ARGS(rw, cr, val), 361 362 TP_STRUCT__entry( 363 __field( unsigned int, rw ) 364 __field( unsigned int, cr ) 365 __field( unsigned long, val ) 366 ), 367 368 TP_fast_assign( 369 __entry->rw = rw; 370 __entry->cr = cr; 371 __entry->val = val; 372 ), 373 374 TP_printk("cr_%s %x = 0x%lx", 375 __entry->rw ? "write" : "read", 376 __entry->cr, __entry->val) 377 ); 378 379 #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val) 380 #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val) 381 382 TRACE_EVENT(kvm_pic_set_irq, 383 TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced), 384 TP_ARGS(chip, pin, elcr, imr, coalesced), 385 386 TP_STRUCT__entry( 387 __field( __u8, chip ) 388 __field( __u8, pin ) 389 __field( __u8, elcr ) 390 __field( __u8, imr ) 391 __field( bool, coalesced ) 392 ), 393 394 TP_fast_assign( 395 __entry->chip = chip; 396 __entry->pin = pin; 397 __entry->elcr = elcr; 398 __entry->imr = imr; 399 __entry->coalesced = coalesced; 400 ), 401 402 TP_printk("chip %u pin %u (%s%s)%s", 403 __entry->chip, __entry->pin, 404 (__entry->elcr & (1 << __entry->pin)) ? "level":"edge", 405 (__entry->imr & (1 << __entry->pin)) ? "|masked":"", 406 __entry->coalesced ? " (coalesced)" : "") 407 ); 408 409 #define kvm_apic_dst_shorthand \ 410 {0x0, "dst"}, \ 411 {0x1, "self"}, \ 412 {0x2, "all"}, \ 413 {0x3, "all-but-self"} 414 415 TRACE_EVENT(kvm_apic_ipi, 416 TP_PROTO(__u32 icr_low, __u32 dest_id), 417 TP_ARGS(icr_low, dest_id), 418 419 TP_STRUCT__entry( 420 __field( __u32, icr_low ) 421 __field( __u32, dest_id ) 422 ), 423 424 TP_fast_assign( 425 __entry->icr_low = icr_low; 426 __entry->dest_id = dest_id; 427 ), 428 429 TP_printk("dst %x vec %u (%s|%s|%s|%s|%s)", 430 __entry->dest_id, (u8)__entry->icr_low, 431 __print_symbolic((__entry->icr_low >> 8 & 0x7), 432 kvm_deliver_mode), 433 (__entry->icr_low & (1<<11)) ? "logical" : "physical", 434 (__entry->icr_low & (1<<14)) ? "assert" : "de-assert", 435 (__entry->icr_low & (1<<15)) ? "level" : "edge", 436 __print_symbolic((__entry->icr_low >> 18 & 0x3), 437 kvm_apic_dst_shorthand)) 438 ); 439 440 TRACE_EVENT(kvm_apic_accept_irq, 441 TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec), 442 TP_ARGS(apicid, dm, tm, vec), 443 444 TP_STRUCT__entry( 445 __field( __u32, apicid ) 446 __field( __u16, dm ) 447 __field( __u16, tm ) 448 __field( __u8, vec ) 449 ), 450 451 TP_fast_assign( 452 __entry->apicid = apicid; 453 __entry->dm = dm; 454 __entry->tm = tm; 455 __entry->vec = vec; 456 ), 457 458 TP_printk("apicid %x vec %u (%s|%s)", 459 __entry->apicid, __entry->vec, 460 __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode), 461 __entry->tm ? "level" : "edge") 462 ); 463 464 TRACE_EVENT(kvm_eoi, 465 TP_PROTO(struct kvm_lapic *apic, int vector), 466 TP_ARGS(apic, vector), 467 468 TP_STRUCT__entry( 469 __field( __u32, apicid ) 470 __field( int, vector ) 471 ), 472 473 TP_fast_assign( 474 __entry->apicid = apic->vcpu->vcpu_id; 475 __entry->vector = vector; 476 ), 477 478 TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector) 479 ); 480 481 TRACE_EVENT(kvm_pv_eoi, 482 TP_PROTO(struct kvm_lapic *apic, int vector), 483 TP_ARGS(apic, vector), 484 485 TP_STRUCT__entry( 486 __field( __u32, apicid ) 487 __field( int, vector ) 488 ), 489 490 TP_fast_assign( 491 __entry->apicid = apic->vcpu->vcpu_id; 492 __entry->vector = vector; 493 ), 494 495 TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector) 496 ); 497 498 /* 499 * Tracepoint for nested VMRUN 500 */ 501 TRACE_EVENT(kvm_nested_vmrun, 502 TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl, 503 __u32 event_inj, bool npt), 504 TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt), 505 506 TP_STRUCT__entry( 507 __field( __u64, rip ) 508 __field( __u64, vmcb ) 509 __field( __u64, nested_rip ) 510 __field( __u32, int_ctl ) 511 __field( __u32, event_inj ) 512 __field( bool, npt ) 513 ), 514 515 TP_fast_assign( 516 __entry->rip = rip; 517 __entry->vmcb = vmcb; 518 __entry->nested_rip = nested_rip; 519 __entry->int_ctl = int_ctl; 520 __entry->event_inj = event_inj; 521 __entry->npt = npt; 522 ), 523 524 TP_printk("rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x " 525 "event_inj: 0x%08x npt: %s", 526 __entry->rip, __entry->vmcb, __entry->nested_rip, 527 __entry->int_ctl, __entry->event_inj, 528 __entry->npt ? "on" : "off") 529 ); 530 531 TRACE_EVENT(kvm_nested_intercepts, 532 TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions, __u64 intercept), 533 TP_ARGS(cr_read, cr_write, exceptions, intercept), 534 535 TP_STRUCT__entry( 536 __field( __u16, cr_read ) 537 __field( __u16, cr_write ) 538 __field( __u32, exceptions ) 539 __field( __u64, intercept ) 540 ), 541 542 TP_fast_assign( 543 __entry->cr_read = cr_read; 544 __entry->cr_write = cr_write; 545 __entry->exceptions = exceptions; 546 __entry->intercept = intercept; 547 ), 548 549 TP_printk("cr_read: %04x cr_write: %04x excp: %08x intercept: %016llx", 550 __entry->cr_read, __entry->cr_write, __entry->exceptions, 551 __entry->intercept) 552 ); 553 /* 554 * Tracepoint for #VMEXIT while nested 555 */ 556 TRACE_EVENT(kvm_nested_vmexit, 557 TP_PROTO(__u64 rip, __u32 exit_code, 558 __u64 exit_info1, __u64 exit_info2, 559 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa), 560 TP_ARGS(rip, exit_code, exit_info1, exit_info2, 561 exit_int_info, exit_int_info_err, isa), 562 563 TP_STRUCT__entry( 564 __field( __u64, rip ) 565 __field( __u32, exit_code ) 566 __field( __u64, exit_info1 ) 567 __field( __u64, exit_info2 ) 568 __field( __u32, exit_int_info ) 569 __field( __u32, exit_int_info_err ) 570 __field( __u32, isa ) 571 ), 572 573 TP_fast_assign( 574 __entry->rip = rip; 575 __entry->exit_code = exit_code; 576 __entry->exit_info1 = exit_info1; 577 __entry->exit_info2 = exit_info2; 578 __entry->exit_int_info = exit_int_info; 579 __entry->exit_int_info_err = exit_int_info_err; 580 __entry->isa = isa; 581 ), 582 TP_printk("rip: 0x%016llx reason: %s ext_inf1: 0x%016llx " 583 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", 584 __entry->rip, 585 (__entry->isa == KVM_ISA_VMX) ? 586 __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) : 587 __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS), 588 __entry->exit_info1, __entry->exit_info2, 589 __entry->exit_int_info, __entry->exit_int_info_err) 590 ); 591 592 /* 593 * Tracepoint for #VMEXIT reinjected to the guest 594 */ 595 TRACE_EVENT(kvm_nested_vmexit_inject, 596 TP_PROTO(__u32 exit_code, 597 __u64 exit_info1, __u64 exit_info2, 598 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa), 599 TP_ARGS(exit_code, exit_info1, exit_info2, 600 exit_int_info, exit_int_info_err, isa), 601 602 TP_STRUCT__entry( 603 __field( __u32, exit_code ) 604 __field( __u64, exit_info1 ) 605 __field( __u64, exit_info2 ) 606 __field( __u32, exit_int_info ) 607 __field( __u32, exit_int_info_err ) 608 __field( __u32, isa ) 609 ), 610 611 TP_fast_assign( 612 __entry->exit_code = exit_code; 613 __entry->exit_info1 = exit_info1; 614 __entry->exit_info2 = exit_info2; 615 __entry->exit_int_info = exit_int_info; 616 __entry->exit_int_info_err = exit_int_info_err; 617 __entry->isa = isa; 618 ), 619 620 TP_printk("reason: %s ext_inf1: 0x%016llx " 621 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x", 622 (__entry->isa == KVM_ISA_VMX) ? 623 __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) : 624 __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS), 625 __entry->exit_info1, __entry->exit_info2, 626 __entry->exit_int_info, __entry->exit_int_info_err) 627 ); 628 629 /* 630 * Tracepoint for nested #vmexit because of interrupt pending 631 */ 632 TRACE_EVENT(kvm_nested_intr_vmexit, 633 TP_PROTO(__u64 rip), 634 TP_ARGS(rip), 635 636 TP_STRUCT__entry( 637 __field( __u64, rip ) 638 ), 639 640 TP_fast_assign( 641 __entry->rip = rip 642 ), 643 644 TP_printk("rip: 0x%016llx", __entry->rip) 645 ); 646 647 /* 648 * Tracepoint for nested #vmexit because of interrupt pending 649 */ 650 TRACE_EVENT(kvm_invlpga, 651 TP_PROTO(__u64 rip, int asid, u64 address), 652 TP_ARGS(rip, asid, address), 653 654 TP_STRUCT__entry( 655 __field( __u64, rip ) 656 __field( int, asid ) 657 __field( __u64, address ) 658 ), 659 660 TP_fast_assign( 661 __entry->rip = rip; 662 __entry->asid = asid; 663 __entry->address = address; 664 ), 665 666 TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx", 667 __entry->rip, __entry->asid, __entry->address) 668 ); 669 670 /* 671 * Tracepoint for nested #vmexit because of interrupt pending 672 */ 673 TRACE_EVENT(kvm_skinit, 674 TP_PROTO(__u64 rip, __u32 slb), 675 TP_ARGS(rip, slb), 676 677 TP_STRUCT__entry( 678 __field( __u64, rip ) 679 __field( __u32, slb ) 680 ), 681 682 TP_fast_assign( 683 __entry->rip = rip; 684 __entry->slb = slb; 685 ), 686 687 TP_printk("rip: 0x%016llx slb: 0x%08x", 688 __entry->rip, __entry->slb) 689 ); 690 691 #define KVM_EMUL_INSN_F_CR0_PE (1 << 0) 692 #define KVM_EMUL_INSN_F_EFL_VM (1 << 1) 693 #define KVM_EMUL_INSN_F_CS_D (1 << 2) 694 #define KVM_EMUL_INSN_F_CS_L (1 << 3) 695 696 #define kvm_trace_symbol_emul_flags \ 697 { 0, "real" }, \ 698 { KVM_EMUL_INSN_F_CR0_PE \ 699 | KVM_EMUL_INSN_F_EFL_VM, "vm16" }, \ 700 { KVM_EMUL_INSN_F_CR0_PE, "prot16" }, \ 701 { KVM_EMUL_INSN_F_CR0_PE \ 702 | KVM_EMUL_INSN_F_CS_D, "prot32" }, \ 703 { KVM_EMUL_INSN_F_CR0_PE \ 704 | KVM_EMUL_INSN_F_CS_L, "prot64" } 705 706 #define kei_decode_mode(mode) ({ \ 707 u8 flags = 0xff; \ 708 switch (mode) { \ 709 case X86EMUL_MODE_REAL: \ 710 flags = 0; \ 711 break; \ 712 case X86EMUL_MODE_VM86: \ 713 flags = KVM_EMUL_INSN_F_EFL_VM; \ 714 break; \ 715 case X86EMUL_MODE_PROT16: \ 716 flags = KVM_EMUL_INSN_F_CR0_PE; \ 717 break; \ 718 case X86EMUL_MODE_PROT32: \ 719 flags = KVM_EMUL_INSN_F_CR0_PE \ 720 | KVM_EMUL_INSN_F_CS_D; \ 721 break; \ 722 case X86EMUL_MODE_PROT64: \ 723 flags = KVM_EMUL_INSN_F_CR0_PE \ 724 | KVM_EMUL_INSN_F_CS_L; \ 725 break; \ 726 } \ 727 flags; \ 728 }) 729 730 TRACE_EVENT(kvm_emulate_insn, 731 TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed), 732 TP_ARGS(vcpu, failed), 733 734 TP_STRUCT__entry( 735 __field( __u64, rip ) 736 __field( __u32, csbase ) 737 __field( __u8, len ) 738 __array( __u8, insn, 15 ) 739 __field( __u8, flags ) 740 __field( __u8, failed ) 741 ), 742 743 TP_fast_assign( 744 __entry->csbase = kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS); 745 __entry->len = vcpu->arch.emulate_ctxt.fetch.ptr 746 - vcpu->arch.emulate_ctxt.fetch.data; 747 __entry->rip = vcpu->arch.emulate_ctxt._eip - __entry->len; 748 memcpy(__entry->insn, 749 vcpu->arch.emulate_ctxt.fetch.data, 750 15); 751 __entry->flags = kei_decode_mode(vcpu->arch.emulate_ctxt.mode); 752 __entry->failed = failed; 753 ), 754 755 TP_printk("%x:%llx:%s (%s)%s", 756 __entry->csbase, __entry->rip, 757 __print_hex(__entry->insn, __entry->len), 758 __print_symbolic(__entry->flags, 759 kvm_trace_symbol_emul_flags), 760 __entry->failed ? " failed" : "" 761 ) 762 ); 763 764 #define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0) 765 #define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1) 766 767 TRACE_EVENT( 768 vcpu_match_mmio, 769 TP_PROTO(gva_t gva, gpa_t gpa, bool write, bool gpa_match), 770 TP_ARGS(gva, gpa, write, gpa_match), 771 772 TP_STRUCT__entry( 773 __field(gva_t, gva) 774 __field(gpa_t, gpa) 775 __field(bool, write) 776 __field(bool, gpa_match) 777 ), 778 779 TP_fast_assign( 780 __entry->gva = gva; 781 __entry->gpa = gpa; 782 __entry->write = write; 783 __entry->gpa_match = gpa_match 784 ), 785 786 TP_printk("gva %#lx gpa %#llx %s %s", __entry->gva, __entry->gpa, 787 __entry->write ? "Write" : "Read", 788 __entry->gpa_match ? "GPA" : "GVA") 789 ); 790 791 TRACE_EVENT(kvm_write_tsc_offset, 792 TP_PROTO(unsigned int vcpu_id, __u64 previous_tsc_offset, 793 __u64 next_tsc_offset), 794 TP_ARGS(vcpu_id, previous_tsc_offset, next_tsc_offset), 795 796 TP_STRUCT__entry( 797 __field( unsigned int, vcpu_id ) 798 __field( __u64, previous_tsc_offset ) 799 __field( __u64, next_tsc_offset ) 800 ), 801 802 TP_fast_assign( 803 __entry->vcpu_id = vcpu_id; 804 __entry->previous_tsc_offset = previous_tsc_offset; 805 __entry->next_tsc_offset = next_tsc_offset; 806 ), 807 808 TP_printk("vcpu=%u prev=%llu next=%llu", __entry->vcpu_id, 809 __entry->previous_tsc_offset, __entry->next_tsc_offset) 810 ); 811 812 #ifdef CONFIG_X86_64 813 814 #define host_clocks \ 815 {VCLOCK_NONE, "none"}, \ 816 {VCLOCK_TSC, "tsc"} \ 817 818 TRACE_EVENT(kvm_update_master_clock, 819 TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched), 820 TP_ARGS(use_master_clock, host_clock, offset_matched), 821 822 TP_STRUCT__entry( 823 __field( bool, use_master_clock ) 824 __field( unsigned int, host_clock ) 825 __field( bool, offset_matched ) 826 ), 827 828 TP_fast_assign( 829 __entry->use_master_clock = use_master_clock; 830 __entry->host_clock = host_clock; 831 __entry->offset_matched = offset_matched; 832 ), 833 834 TP_printk("masterclock %d hostclock %s offsetmatched %u", 835 __entry->use_master_clock, 836 __print_symbolic(__entry->host_clock, host_clocks), 837 __entry->offset_matched) 838 ); 839 840 TRACE_EVENT(kvm_track_tsc, 841 TP_PROTO(unsigned int vcpu_id, unsigned int nr_matched, 842 unsigned int online_vcpus, bool use_master_clock, 843 unsigned int host_clock), 844 TP_ARGS(vcpu_id, nr_matched, online_vcpus, use_master_clock, 845 host_clock), 846 847 TP_STRUCT__entry( 848 __field( unsigned int, vcpu_id ) 849 __field( unsigned int, nr_vcpus_matched_tsc ) 850 __field( unsigned int, online_vcpus ) 851 __field( bool, use_master_clock ) 852 __field( unsigned int, host_clock ) 853 ), 854 855 TP_fast_assign( 856 __entry->vcpu_id = vcpu_id; 857 __entry->nr_vcpus_matched_tsc = nr_matched; 858 __entry->online_vcpus = online_vcpus; 859 __entry->use_master_clock = use_master_clock; 860 __entry->host_clock = host_clock; 861 ), 862 863 TP_printk("vcpu_id %u masterclock %u offsetmatched %u nr_online %u" 864 " hostclock %s", 865 __entry->vcpu_id, __entry->use_master_clock, 866 __entry->nr_vcpus_matched_tsc, __entry->online_vcpus, 867 __print_symbolic(__entry->host_clock, host_clocks)) 868 ); 869 870 #endif /* CONFIG_X86_64 */ 871 872 /* 873 * Tracepoint for PML full VMEXIT. 874 */ 875 TRACE_EVENT(kvm_pml_full, 876 TP_PROTO(unsigned int vcpu_id), 877 TP_ARGS(vcpu_id), 878 879 TP_STRUCT__entry( 880 __field( unsigned int, vcpu_id ) 881 ), 882 883 TP_fast_assign( 884 __entry->vcpu_id = vcpu_id; 885 ), 886 887 TP_printk("vcpu %d: PML full", __entry->vcpu_id) 888 ); 889 890 TRACE_EVENT(kvm_ple_window, 891 TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old), 892 TP_ARGS(grow, vcpu_id, new, old), 893 894 TP_STRUCT__entry( 895 __field( bool, grow ) 896 __field( unsigned int, vcpu_id ) 897 __field( int, new ) 898 __field( int, old ) 899 ), 900 901 TP_fast_assign( 902 __entry->grow = grow; 903 __entry->vcpu_id = vcpu_id; 904 __entry->new = new; 905 __entry->old = old; 906 ), 907 908 TP_printk("vcpu %u: ple_window %d (%s %d)", 909 __entry->vcpu_id, 910 __entry->new, 911 __entry->grow ? "grow" : "shrink", 912 __entry->old) 913 ); 914 915 #define trace_kvm_ple_window_grow(vcpu_id, new, old) \ 916 trace_kvm_ple_window(true, vcpu_id, new, old) 917 #define trace_kvm_ple_window_shrink(vcpu_id, new, old) \ 918 trace_kvm_ple_window(false, vcpu_id, new, old) 919 920 TRACE_EVENT(kvm_pvclock_update, 921 TP_PROTO(unsigned int vcpu_id, struct pvclock_vcpu_time_info *pvclock), 922 TP_ARGS(vcpu_id, pvclock), 923 924 TP_STRUCT__entry( 925 __field( unsigned int, vcpu_id ) 926 __field( __u32, version ) 927 __field( __u64, tsc_timestamp ) 928 __field( __u64, system_time ) 929 __field( __u32, tsc_to_system_mul ) 930 __field( __s8, tsc_shift ) 931 __field( __u8, flags ) 932 ), 933 934 TP_fast_assign( 935 __entry->vcpu_id = vcpu_id; 936 __entry->version = pvclock->version; 937 __entry->tsc_timestamp = pvclock->tsc_timestamp; 938 __entry->system_time = pvclock->system_time; 939 __entry->tsc_to_system_mul = pvclock->tsc_to_system_mul; 940 __entry->tsc_shift = pvclock->tsc_shift; 941 __entry->flags = pvclock->flags; 942 ), 943 944 TP_printk("vcpu_id %u, pvclock { version %u, tsc_timestamp 0x%llx, " 945 "system_time 0x%llx, tsc_to_system_mul 0x%x, tsc_shift %d, " 946 "flags 0x%x }", 947 __entry->vcpu_id, 948 __entry->version, 949 __entry->tsc_timestamp, 950 __entry->system_time, 951 __entry->tsc_to_system_mul, 952 __entry->tsc_shift, 953 __entry->flags) 954 ); 955 956 TRACE_EVENT(kvm_wait_lapic_expire, 957 TP_PROTO(unsigned int vcpu_id, s64 delta), 958 TP_ARGS(vcpu_id, delta), 959 960 TP_STRUCT__entry( 961 __field( unsigned int, vcpu_id ) 962 __field( s64, delta ) 963 ), 964 965 TP_fast_assign( 966 __entry->vcpu_id = vcpu_id; 967 __entry->delta = delta; 968 ), 969 970 TP_printk("vcpu %u: delta %lld (%s)", 971 __entry->vcpu_id, 972 __entry->delta, 973 __entry->delta < 0 ? "early" : "late") 974 ); 975 976 TRACE_EVENT(kvm_enter_smm, 977 TP_PROTO(unsigned int vcpu_id, u64 smbase, bool entering), 978 TP_ARGS(vcpu_id, smbase, entering), 979 980 TP_STRUCT__entry( 981 __field( unsigned int, vcpu_id ) 982 __field( u64, smbase ) 983 __field( bool, entering ) 984 ), 985 986 TP_fast_assign( 987 __entry->vcpu_id = vcpu_id; 988 __entry->smbase = smbase; 989 __entry->entering = entering; 990 ), 991 992 TP_printk("vcpu %u: %s SMM, smbase 0x%llx", 993 __entry->vcpu_id, 994 __entry->entering ? "entering" : "leaving", 995 __entry->smbase) 996 ); 997 998 /* 999 * Tracepoint for VT-d posted-interrupts. 1000 */ 1001 TRACE_EVENT(kvm_pi_irte_update, 1002 TP_PROTO(unsigned int host_irq, unsigned int vcpu_id, 1003 unsigned int gsi, unsigned int gvec, 1004 u64 pi_desc_addr, bool set), 1005 TP_ARGS(host_irq, vcpu_id, gsi, gvec, pi_desc_addr, set), 1006 1007 TP_STRUCT__entry( 1008 __field( unsigned int, host_irq ) 1009 __field( unsigned int, vcpu_id ) 1010 __field( unsigned int, gsi ) 1011 __field( unsigned int, gvec ) 1012 __field( u64, pi_desc_addr ) 1013 __field( bool, set ) 1014 ), 1015 1016 TP_fast_assign( 1017 __entry->host_irq = host_irq; 1018 __entry->vcpu_id = vcpu_id; 1019 __entry->gsi = gsi; 1020 __entry->gvec = gvec; 1021 __entry->pi_desc_addr = pi_desc_addr; 1022 __entry->set = set; 1023 ), 1024 1025 TP_printk("VT-d PI is %s for irq %u, vcpu %u, gsi: 0x%x, " 1026 "gvec: 0x%x, pi_desc_addr: 0x%llx", 1027 __entry->set ? "enabled and being updated" : "disabled", 1028 __entry->host_irq, 1029 __entry->vcpu_id, 1030 __entry->gsi, 1031 __entry->gvec, 1032 __entry->pi_desc_addr) 1033 ); 1034 1035 /* 1036 * Tracepoint for kvm_hv_notify_acked_sint. 1037 */ 1038 TRACE_EVENT(kvm_hv_notify_acked_sint, 1039 TP_PROTO(int vcpu_id, u32 sint), 1040 TP_ARGS(vcpu_id, sint), 1041 1042 TP_STRUCT__entry( 1043 __field(int, vcpu_id) 1044 __field(u32, sint) 1045 ), 1046 1047 TP_fast_assign( 1048 __entry->vcpu_id = vcpu_id; 1049 __entry->sint = sint; 1050 ), 1051 1052 TP_printk("vcpu_id %d sint %u", __entry->vcpu_id, __entry->sint) 1053 ); 1054 1055 /* 1056 * Tracepoint for synic_set_irq. 1057 */ 1058 TRACE_EVENT(kvm_hv_synic_set_irq, 1059 TP_PROTO(int vcpu_id, u32 sint, int vector, int ret), 1060 TP_ARGS(vcpu_id, sint, vector, ret), 1061 1062 TP_STRUCT__entry( 1063 __field(int, vcpu_id) 1064 __field(u32, sint) 1065 __field(int, vector) 1066 __field(int, ret) 1067 ), 1068 1069 TP_fast_assign( 1070 __entry->vcpu_id = vcpu_id; 1071 __entry->sint = sint; 1072 __entry->vector = vector; 1073 __entry->ret = ret; 1074 ), 1075 1076 TP_printk("vcpu_id %d sint %u vector %d ret %d", 1077 __entry->vcpu_id, __entry->sint, __entry->vector, 1078 __entry->ret) 1079 ); 1080 1081 /* 1082 * Tracepoint for kvm_hv_synic_send_eoi. 1083 */ 1084 TRACE_EVENT(kvm_hv_synic_send_eoi, 1085 TP_PROTO(int vcpu_id, int vector), 1086 TP_ARGS(vcpu_id, vector), 1087 1088 TP_STRUCT__entry( 1089 __field(int, vcpu_id) 1090 __field(u32, sint) 1091 __field(int, vector) 1092 __field(int, ret) 1093 ), 1094 1095 TP_fast_assign( 1096 __entry->vcpu_id = vcpu_id; 1097 __entry->vector = vector; 1098 ), 1099 1100 TP_printk("vcpu_id %d vector %d", __entry->vcpu_id, __entry->vector) 1101 ); 1102 1103 /* 1104 * Tracepoint for synic_set_msr. 1105 */ 1106 TRACE_EVENT(kvm_hv_synic_set_msr, 1107 TP_PROTO(int vcpu_id, u32 msr, u64 data, bool host), 1108 TP_ARGS(vcpu_id, msr, data, host), 1109 1110 TP_STRUCT__entry( 1111 __field(int, vcpu_id) 1112 __field(u32, msr) 1113 __field(u64, data) 1114 __field(bool, host) 1115 ), 1116 1117 TP_fast_assign( 1118 __entry->vcpu_id = vcpu_id; 1119 __entry->msr = msr; 1120 __entry->data = data; 1121 __entry->host = host 1122 ), 1123 1124 TP_printk("vcpu_id %d msr 0x%x data 0x%llx host %d", 1125 __entry->vcpu_id, __entry->msr, __entry->data, __entry->host) 1126 ); 1127 1128 /* 1129 * Tracepoint for stimer_set_config. 1130 */ 1131 TRACE_EVENT(kvm_hv_stimer_set_config, 1132 TP_PROTO(int vcpu_id, int timer_index, u64 config, bool host), 1133 TP_ARGS(vcpu_id, timer_index, config, host), 1134 1135 TP_STRUCT__entry( 1136 __field(int, vcpu_id) 1137 __field(int, timer_index) 1138 __field(u64, config) 1139 __field(bool, host) 1140 ), 1141 1142 TP_fast_assign( 1143 __entry->vcpu_id = vcpu_id; 1144 __entry->timer_index = timer_index; 1145 __entry->config = config; 1146 __entry->host = host; 1147 ), 1148 1149 TP_printk("vcpu_id %d timer %d config 0x%llx host %d", 1150 __entry->vcpu_id, __entry->timer_index, __entry->config, 1151 __entry->host) 1152 ); 1153 1154 /* 1155 * Tracepoint for stimer_set_count. 1156 */ 1157 TRACE_EVENT(kvm_hv_stimer_set_count, 1158 TP_PROTO(int vcpu_id, int timer_index, u64 count, bool host), 1159 TP_ARGS(vcpu_id, timer_index, count, host), 1160 1161 TP_STRUCT__entry( 1162 __field(int, vcpu_id) 1163 __field(int, timer_index) 1164 __field(u64, count) 1165 __field(bool, host) 1166 ), 1167 1168 TP_fast_assign( 1169 __entry->vcpu_id = vcpu_id; 1170 __entry->timer_index = timer_index; 1171 __entry->count = count; 1172 __entry->host = host; 1173 ), 1174 1175 TP_printk("vcpu_id %d timer %d count %llu host %d", 1176 __entry->vcpu_id, __entry->timer_index, __entry->count, 1177 __entry->host) 1178 ); 1179 1180 /* 1181 * Tracepoint for stimer_start(periodic timer case). 1182 */ 1183 TRACE_EVENT(kvm_hv_stimer_start_periodic, 1184 TP_PROTO(int vcpu_id, int timer_index, u64 time_now, u64 exp_time), 1185 TP_ARGS(vcpu_id, timer_index, time_now, exp_time), 1186 1187 TP_STRUCT__entry( 1188 __field(int, vcpu_id) 1189 __field(int, timer_index) 1190 __field(u64, time_now) 1191 __field(u64, exp_time) 1192 ), 1193 1194 TP_fast_assign( 1195 __entry->vcpu_id = vcpu_id; 1196 __entry->timer_index = timer_index; 1197 __entry->time_now = time_now; 1198 __entry->exp_time = exp_time; 1199 ), 1200 1201 TP_printk("vcpu_id %d timer %d time_now %llu exp_time %llu", 1202 __entry->vcpu_id, __entry->timer_index, __entry->time_now, 1203 __entry->exp_time) 1204 ); 1205 1206 /* 1207 * Tracepoint for stimer_start(one-shot timer case). 1208 */ 1209 TRACE_EVENT(kvm_hv_stimer_start_one_shot, 1210 TP_PROTO(int vcpu_id, int timer_index, u64 time_now, u64 count), 1211 TP_ARGS(vcpu_id, timer_index, time_now, count), 1212 1213 TP_STRUCT__entry( 1214 __field(int, vcpu_id) 1215 __field(int, timer_index) 1216 __field(u64, time_now) 1217 __field(u64, count) 1218 ), 1219 1220 TP_fast_assign( 1221 __entry->vcpu_id = vcpu_id; 1222 __entry->timer_index = timer_index; 1223 __entry->time_now = time_now; 1224 __entry->count = count; 1225 ), 1226 1227 TP_printk("vcpu_id %d timer %d time_now %llu count %llu", 1228 __entry->vcpu_id, __entry->timer_index, __entry->time_now, 1229 __entry->count) 1230 ); 1231 1232 /* 1233 * Tracepoint for stimer_timer_callback. 1234 */ 1235 TRACE_EVENT(kvm_hv_stimer_callback, 1236 TP_PROTO(int vcpu_id, int timer_index), 1237 TP_ARGS(vcpu_id, timer_index), 1238 1239 TP_STRUCT__entry( 1240 __field(int, vcpu_id) 1241 __field(int, timer_index) 1242 ), 1243 1244 TP_fast_assign( 1245 __entry->vcpu_id = vcpu_id; 1246 __entry->timer_index = timer_index; 1247 ), 1248 1249 TP_printk("vcpu_id %d timer %d", 1250 __entry->vcpu_id, __entry->timer_index) 1251 ); 1252 1253 /* 1254 * Tracepoint for stimer_expiration. 1255 */ 1256 TRACE_EVENT(kvm_hv_stimer_expiration, 1257 TP_PROTO(int vcpu_id, int timer_index, int direct, int msg_send_result), 1258 TP_ARGS(vcpu_id, timer_index, direct, msg_send_result), 1259 1260 TP_STRUCT__entry( 1261 __field(int, vcpu_id) 1262 __field(int, timer_index) 1263 __field(int, direct) 1264 __field(int, msg_send_result) 1265 ), 1266 1267 TP_fast_assign( 1268 __entry->vcpu_id = vcpu_id; 1269 __entry->timer_index = timer_index; 1270 __entry->direct = direct; 1271 __entry->msg_send_result = msg_send_result; 1272 ), 1273 1274 TP_printk("vcpu_id %d timer %d direct %d send result %d", 1275 __entry->vcpu_id, __entry->timer_index, 1276 __entry->direct, __entry->msg_send_result) 1277 ); 1278 1279 /* 1280 * Tracepoint for stimer_cleanup. 1281 */ 1282 TRACE_EVENT(kvm_hv_stimer_cleanup, 1283 TP_PROTO(int vcpu_id, int timer_index), 1284 TP_ARGS(vcpu_id, timer_index), 1285 1286 TP_STRUCT__entry( 1287 __field(int, vcpu_id) 1288 __field(int, timer_index) 1289 ), 1290 1291 TP_fast_assign( 1292 __entry->vcpu_id = vcpu_id; 1293 __entry->timer_index = timer_index; 1294 ), 1295 1296 TP_printk("vcpu_id %d timer %d", 1297 __entry->vcpu_id, __entry->timer_index) 1298 ); 1299 1300 /* 1301 * Tracepoint for AMD AVIC 1302 */ 1303 TRACE_EVENT(kvm_avic_incomplete_ipi, 1304 TP_PROTO(u32 vcpu, u32 icrh, u32 icrl, u32 id, u32 index), 1305 TP_ARGS(vcpu, icrh, icrl, id, index), 1306 1307 TP_STRUCT__entry( 1308 __field(u32, vcpu) 1309 __field(u32, icrh) 1310 __field(u32, icrl) 1311 __field(u32, id) 1312 __field(u32, index) 1313 ), 1314 1315 TP_fast_assign( 1316 __entry->vcpu = vcpu; 1317 __entry->icrh = icrh; 1318 __entry->icrl = icrl; 1319 __entry->id = id; 1320 __entry->index = index; 1321 ), 1322 1323 TP_printk("vcpu=%u, icrh:icrl=%#010x:%08x, id=%u, index=%u\n", 1324 __entry->vcpu, __entry->icrh, __entry->icrl, 1325 __entry->id, __entry->index) 1326 ); 1327 1328 TRACE_EVENT(kvm_avic_unaccelerated_access, 1329 TP_PROTO(u32 vcpu, u32 offset, bool ft, bool rw, u32 vec), 1330 TP_ARGS(vcpu, offset, ft, rw, vec), 1331 1332 TP_STRUCT__entry( 1333 __field(u32, vcpu) 1334 __field(u32, offset) 1335 __field(bool, ft) 1336 __field(bool, rw) 1337 __field(u32, vec) 1338 ), 1339 1340 TP_fast_assign( 1341 __entry->vcpu = vcpu; 1342 __entry->offset = offset; 1343 __entry->ft = ft; 1344 __entry->rw = rw; 1345 __entry->vec = vec; 1346 ), 1347 1348 TP_printk("vcpu=%u, offset=%#x(%s), %s, %s, vec=%#x\n", 1349 __entry->vcpu, 1350 __entry->offset, 1351 __print_symbolic(__entry->offset, kvm_trace_symbol_apic), 1352 __entry->ft ? "trap" : "fault", 1353 __entry->rw ? "write" : "read", 1354 __entry->vec) 1355 ); 1356 1357 TRACE_EVENT(kvm_hv_timer_state, 1358 TP_PROTO(unsigned int vcpu_id, unsigned int hv_timer_in_use), 1359 TP_ARGS(vcpu_id, hv_timer_in_use), 1360 TP_STRUCT__entry( 1361 __field(unsigned int, vcpu_id) 1362 __field(unsigned int, hv_timer_in_use) 1363 ), 1364 TP_fast_assign( 1365 __entry->vcpu_id = vcpu_id; 1366 __entry->hv_timer_in_use = hv_timer_in_use; 1367 ), 1368 TP_printk("vcpu_id %x hv_timer %x\n", 1369 __entry->vcpu_id, 1370 __entry->hv_timer_in_use) 1371 ); 1372 1373 /* 1374 * Tracepoint for kvm_hv_flush_tlb. 1375 */ 1376 TRACE_EVENT(kvm_hv_flush_tlb, 1377 TP_PROTO(u64 processor_mask, u64 address_space, u64 flags), 1378 TP_ARGS(processor_mask, address_space, flags), 1379 1380 TP_STRUCT__entry( 1381 __field(u64, processor_mask) 1382 __field(u64, address_space) 1383 __field(u64, flags) 1384 ), 1385 1386 TP_fast_assign( 1387 __entry->processor_mask = processor_mask; 1388 __entry->address_space = address_space; 1389 __entry->flags = flags; 1390 ), 1391 1392 TP_printk("processor_mask 0x%llx address_space 0x%llx flags 0x%llx", 1393 __entry->processor_mask, __entry->address_space, 1394 __entry->flags) 1395 ); 1396 1397 /* 1398 * Tracepoint for kvm_hv_flush_tlb_ex. 1399 */ 1400 TRACE_EVENT(kvm_hv_flush_tlb_ex, 1401 TP_PROTO(u64 valid_bank_mask, u64 format, u64 address_space, u64 flags), 1402 TP_ARGS(valid_bank_mask, format, address_space, flags), 1403 1404 TP_STRUCT__entry( 1405 __field(u64, valid_bank_mask) 1406 __field(u64, format) 1407 __field(u64, address_space) 1408 __field(u64, flags) 1409 ), 1410 1411 TP_fast_assign( 1412 __entry->valid_bank_mask = valid_bank_mask; 1413 __entry->format = format; 1414 __entry->address_space = address_space; 1415 __entry->flags = flags; 1416 ), 1417 1418 TP_printk("valid_bank_mask 0x%llx format 0x%llx " 1419 "address_space 0x%llx flags 0x%llx", 1420 __entry->valid_bank_mask, __entry->format, 1421 __entry->address_space, __entry->flags) 1422 ); 1423 1424 /* 1425 * Tracepoints for kvm_hv_send_ipi. 1426 */ 1427 TRACE_EVENT(kvm_hv_send_ipi, 1428 TP_PROTO(u32 vector, u64 processor_mask), 1429 TP_ARGS(vector, processor_mask), 1430 1431 TP_STRUCT__entry( 1432 __field(u32, vector) 1433 __field(u64, processor_mask) 1434 ), 1435 1436 TP_fast_assign( 1437 __entry->vector = vector; 1438 __entry->processor_mask = processor_mask; 1439 ), 1440 1441 TP_printk("vector %x processor_mask 0x%llx", 1442 __entry->vector, __entry->processor_mask) 1443 ); 1444 1445 TRACE_EVENT(kvm_hv_send_ipi_ex, 1446 TP_PROTO(u32 vector, u64 format, u64 valid_bank_mask), 1447 TP_ARGS(vector, format, valid_bank_mask), 1448 1449 TP_STRUCT__entry( 1450 __field(u32, vector) 1451 __field(u64, format) 1452 __field(u64, valid_bank_mask) 1453 ), 1454 1455 TP_fast_assign( 1456 __entry->vector = vector; 1457 __entry->format = format; 1458 __entry->valid_bank_mask = valid_bank_mask; 1459 ), 1460 1461 TP_printk("vector %x format %llx valid_bank_mask 0x%llx", 1462 __entry->vector, __entry->format, 1463 __entry->valid_bank_mask) 1464 ); 1465 #endif /* _TRACE_KVM_H */ 1466 1467 #undef TRACE_INCLUDE_PATH 1468 #define TRACE_INCLUDE_PATH ../../arch/x86/kvm 1469 #undef TRACE_INCLUDE_FILE 1470 #define TRACE_INCLUDE_FILE trace 1471 1472 /* This part must be outside protection */ 1473 #include <trace/define_trace.h> 1474