1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/tracepoint.h>
7 #include <asm/clocksource.h>
8 #include <asm/pvclock-abi.h>
11 #define TRACE_SYSTEM kvm
14 * Tracepoint for guest mode entry.
16 TRACE_EVENT(kvm_entry,
17 TP_PROTO(unsigned int vcpu_id),
21 __field( unsigned int, vcpu_id )
25 __entry->vcpu_id = vcpu_id;
28 TP_printk("vcpu %u", __entry->vcpu_id)
32 * Tracepoint for hypercall.
34 TRACE_EVENT(kvm_hypercall,
35 TP_PROTO(unsigned long nr, unsigned long a0, unsigned long a1,
36 unsigned long a2, unsigned long a3),
37 TP_ARGS(nr, a0, a1, a2, a3),
40 __field( unsigned long, nr )
41 __field( unsigned long, a0 )
42 __field( unsigned long, a1 )
43 __field( unsigned long, a2 )
44 __field( unsigned long, a3 )
55 TP_printk("nr 0x%lx a0 0x%lx a1 0x%lx a2 0x%lx a3 0x%lx",
56 __entry->nr, __entry->a0, __entry->a1, __entry->a2,
61 * Tracepoint for hypercall.
63 TRACE_EVENT(kvm_hv_hypercall,
64 TP_PROTO(__u16 code, bool fast, __u16 rep_cnt, __u16 rep_idx,
65 __u64 ingpa, __u64 outgpa),
66 TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa),
69 __field( __u16, rep_cnt )
70 __field( __u16, rep_idx )
71 __field( __u64, ingpa )
72 __field( __u64, outgpa )
73 __field( __u16, code )
78 __entry->rep_cnt = rep_cnt;
79 __entry->rep_idx = rep_idx;
80 __entry->ingpa = ingpa;
81 __entry->outgpa = outgpa;
86 TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx",
87 __entry->code, __entry->fast ? "fast" : "slow",
88 __entry->rep_cnt, __entry->rep_idx, __entry->ingpa,
100 TP_PROTO(unsigned int rw, unsigned int port, unsigned int size,
101 unsigned int count, void *data),
102 TP_ARGS(rw, port, size, count, data),
105 __field( unsigned int, rw )
106 __field( unsigned int, port )
107 __field( unsigned int, size )
108 __field( unsigned int, count )
109 __field( unsigned int, val )
114 __entry->port = port;
115 __entry->size = size;
116 __entry->count = count;
118 __entry->val = *(unsigned char *)data;
120 __entry->val = *(unsigned short *)data;
122 __entry->val = *(unsigned int *)data;
125 TP_printk("pio_%s at 0x%x size %d count %d val 0x%x %s",
126 __entry->rw ? "write" : "read",
127 __entry->port, __entry->size, __entry->count, __entry->val,
128 __entry->count > 1 ? "(...)" : "")
132 * Tracepoint for cpuid.
134 TRACE_EVENT(kvm_cpuid,
135 TP_PROTO(unsigned int function, unsigned long rax, unsigned long rbx,
136 unsigned long rcx, unsigned long rdx),
137 TP_ARGS(function, rax, rbx, rcx, rdx),
140 __field( unsigned int, function )
141 __field( unsigned long, rax )
142 __field( unsigned long, rbx )
143 __field( unsigned long, rcx )
144 __field( unsigned long, rdx )
148 __entry->function = function;
155 TP_printk("func %x rax %lx rbx %lx rcx %lx rdx %lx",
156 __entry->function, __entry->rax,
157 __entry->rbx, __entry->rcx, __entry->rdx)
160 #define AREG(x) { APIC_##x, "APIC_" #x }
162 #define kvm_trace_symbol_apic \
163 AREG(ID), AREG(LVR), AREG(TASKPRI), AREG(ARBPRI), AREG(PROCPRI), \
164 AREG(EOI), AREG(RRR), AREG(LDR), AREG(DFR), AREG(SPIV), AREG(ISR), \
165 AREG(TMR), AREG(IRR), AREG(ESR), AREG(ICR), AREG(ICR2), AREG(LVTT), \
166 AREG(LVTTHMR), AREG(LVTPC), AREG(LVT0), AREG(LVT1), AREG(LVTERR), \
167 AREG(TMICT), AREG(TMCCT), AREG(TDCR), AREG(SELF_IPI), AREG(EFEAT), \
170 * Tracepoint for apic access.
172 TRACE_EVENT(kvm_apic,
173 TP_PROTO(unsigned int rw, unsigned int reg, unsigned int val),
174 TP_ARGS(rw, reg, val),
177 __field( unsigned int, rw )
178 __field( unsigned int, reg )
179 __field( unsigned int, val )
188 TP_printk("apic_%s %s = 0x%x",
189 __entry->rw ? "write" : "read",
190 __print_symbolic(__entry->reg, kvm_trace_symbol_apic),
194 #define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val)
195 #define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val)
197 #define KVM_ISA_VMX 1
198 #define KVM_ISA_SVM 2
201 * Tracepoint for kvm guest exit:
203 TRACE_EVENT(kvm_exit,
204 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
205 TP_ARGS(exit_reason, vcpu, isa),
208 __field( unsigned int, exit_reason )
209 __field( unsigned long, guest_rip )
211 __field( u64, info1 )
212 __field( u64, info2 )
216 __entry->exit_reason = exit_reason;
217 __entry->guest_rip = kvm_rip_read(vcpu);
219 kvm_x86_ops->get_exit_info(vcpu, &__entry->info1,
223 TP_printk("reason %s rip 0x%lx info %llx %llx",
224 (__entry->isa == KVM_ISA_VMX) ?
225 __print_symbolic(__entry->exit_reason, VMX_EXIT_REASONS) :
226 __print_symbolic(__entry->exit_reason, SVM_EXIT_REASONS),
227 __entry->guest_rip, __entry->info1, __entry->info2)
231 * Tracepoint for kvm interrupt injection:
233 TRACE_EVENT(kvm_inj_virq,
234 TP_PROTO(unsigned int irq),
238 __field( unsigned int, irq )
245 TP_printk("irq %u", __entry->irq)
248 #define EXS(x) { x##_VECTOR, "#" #x }
250 #define kvm_trace_sym_exc \
251 EXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM), \
252 EXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), \
256 * Tracepoint for kvm interrupt injection:
258 TRACE_EVENT(kvm_inj_exception,
259 TP_PROTO(unsigned exception, bool has_error, unsigned error_code),
260 TP_ARGS(exception, has_error, error_code),
263 __field( u8, exception )
264 __field( u8, has_error )
265 __field( u32, error_code )
269 __entry->exception = exception;
270 __entry->has_error = has_error;
271 __entry->error_code = error_code;
274 TP_printk("%s (0x%x)",
275 __print_symbolic(__entry->exception, kvm_trace_sym_exc),
276 /* FIXME: don't print error_code if not present */
277 __entry->has_error ? __entry->error_code : 0)
281 * Tracepoint for page fault.
283 TRACE_EVENT(kvm_page_fault,
284 TP_PROTO(unsigned long fault_address, unsigned int error_code),
285 TP_ARGS(fault_address, error_code),
288 __field( unsigned long, fault_address )
289 __field( unsigned int, error_code )
293 __entry->fault_address = fault_address;
294 __entry->error_code = error_code;
297 TP_printk("address %lx error_code %x",
298 __entry->fault_address, __entry->error_code)
302 * Tracepoint for guest MSR access.
305 TP_PROTO(unsigned write, u32 ecx, u64 data, bool exception),
306 TP_ARGS(write, ecx, data, exception),
309 __field( unsigned, write )
312 __field( u8, exception )
316 __entry->write = write;
318 __entry->data = data;
319 __entry->exception = exception;
322 TP_printk("msr_%s %x = 0x%llx%s",
323 __entry->write ? "write" : "read",
324 __entry->ecx, __entry->data,
325 __entry->exception ? " (#GP)" : "")
328 #define trace_kvm_msr_read(ecx, data) trace_kvm_msr(0, ecx, data, false)
329 #define trace_kvm_msr_write(ecx, data) trace_kvm_msr(1, ecx, data, false)
330 #define trace_kvm_msr_read_ex(ecx) trace_kvm_msr(0, ecx, 0, true)
331 #define trace_kvm_msr_write_ex(ecx, data) trace_kvm_msr(1, ecx, data, true)
334 * Tracepoint for guest CR access.
337 TP_PROTO(unsigned int rw, unsigned int cr, unsigned long val),
338 TP_ARGS(rw, cr, val),
341 __field( unsigned int, rw )
342 __field( unsigned int, cr )
343 __field( unsigned long, val )
352 TP_printk("cr_%s %x = 0x%lx",
353 __entry->rw ? "write" : "read",
354 __entry->cr, __entry->val)
357 #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val)
358 #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val)
360 TRACE_EVENT(kvm_pic_set_irq,
361 TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, bool coalesced),
362 TP_ARGS(chip, pin, elcr, imr, coalesced),
365 __field( __u8, chip )
367 __field( __u8, elcr )
369 __field( bool, coalesced )
373 __entry->chip = chip;
375 __entry->elcr = elcr;
377 __entry->coalesced = coalesced;
380 TP_printk("chip %u pin %u (%s%s)%s",
381 __entry->chip, __entry->pin,
382 (__entry->elcr & (1 << __entry->pin)) ? "level":"edge",
383 (__entry->imr & (1 << __entry->pin)) ? "|masked":"",
384 __entry->coalesced ? " (coalesced)" : "")
387 #define kvm_apic_dst_shorthand \
391 {0x3, "all-but-self"}
393 TRACE_EVENT(kvm_apic_ipi,
394 TP_PROTO(__u32 icr_low, __u32 dest_id),
395 TP_ARGS(icr_low, dest_id),
398 __field( __u32, icr_low )
399 __field( __u32, dest_id )
403 __entry->icr_low = icr_low;
404 __entry->dest_id = dest_id;
407 TP_printk("dst %x vec %u (%s|%s|%s|%s|%s)",
408 __entry->dest_id, (u8)__entry->icr_low,
409 __print_symbolic((__entry->icr_low >> 8 & 0x7),
411 (__entry->icr_low & (1<<11)) ? "logical" : "physical",
412 (__entry->icr_low & (1<<14)) ? "assert" : "de-assert",
413 (__entry->icr_low & (1<<15)) ? "level" : "edge",
414 __print_symbolic((__entry->icr_low >> 18 & 0x3),
415 kvm_apic_dst_shorthand))
418 TRACE_EVENT(kvm_apic_accept_irq,
419 TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
420 TP_ARGS(apicid, dm, tm, vec),
423 __field( __u32, apicid )
430 __entry->apicid = apicid;
436 TP_printk("apicid %x vec %u (%s|%s)",
437 __entry->apicid, __entry->vec,
438 __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode),
439 __entry->tm ? "level" : "edge")
443 TP_PROTO(struct kvm_lapic *apic, int vector),
444 TP_ARGS(apic, vector),
447 __field( __u32, apicid )
448 __field( int, vector )
452 __entry->apicid = apic->vcpu->vcpu_id;
453 __entry->vector = vector;
456 TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector)
459 TRACE_EVENT(kvm_pv_eoi,
460 TP_PROTO(struct kvm_lapic *apic, int vector),
461 TP_ARGS(apic, vector),
464 __field( __u32, apicid )
465 __field( int, vector )
469 __entry->apicid = apic->vcpu->vcpu_id;
470 __entry->vector = vector;
473 TP_printk("apicid %x vector %d", __entry->apicid, __entry->vector)
477 * Tracepoint for nested VMRUN
479 TRACE_EVENT(kvm_nested_vmrun,
480 TP_PROTO(__u64 rip, __u64 vmcb, __u64 nested_rip, __u32 int_ctl,
481 __u32 event_inj, bool npt),
482 TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt),
485 __field( __u64, rip )
486 __field( __u64, vmcb )
487 __field( __u64, nested_rip )
488 __field( __u32, int_ctl )
489 __field( __u32, event_inj )
495 __entry->vmcb = vmcb;
496 __entry->nested_rip = nested_rip;
497 __entry->int_ctl = int_ctl;
498 __entry->event_inj = event_inj;
502 TP_printk("rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x "
503 "event_inj: 0x%08x npt: %s",
504 __entry->rip, __entry->vmcb, __entry->nested_rip,
505 __entry->int_ctl, __entry->event_inj,
506 __entry->npt ? "on" : "off")
509 TRACE_EVENT(kvm_nested_intercepts,
510 TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions, __u64 intercept),
511 TP_ARGS(cr_read, cr_write, exceptions, intercept),
514 __field( __u16, cr_read )
515 __field( __u16, cr_write )
516 __field( __u32, exceptions )
517 __field( __u64, intercept )
521 __entry->cr_read = cr_read;
522 __entry->cr_write = cr_write;
523 __entry->exceptions = exceptions;
524 __entry->intercept = intercept;
527 TP_printk("cr_read: %04x cr_write: %04x excp: %08x intercept: %016llx",
528 __entry->cr_read, __entry->cr_write, __entry->exceptions,
532 * Tracepoint for #VMEXIT while nested
534 TRACE_EVENT(kvm_nested_vmexit,
535 TP_PROTO(__u64 rip, __u32 exit_code,
536 __u64 exit_info1, __u64 exit_info2,
537 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa),
538 TP_ARGS(rip, exit_code, exit_info1, exit_info2,
539 exit_int_info, exit_int_info_err, isa),
542 __field( __u64, rip )
543 __field( __u32, exit_code )
544 __field( __u64, exit_info1 )
545 __field( __u64, exit_info2 )
546 __field( __u32, exit_int_info )
547 __field( __u32, exit_int_info_err )
548 __field( __u32, isa )
553 __entry->exit_code = exit_code;
554 __entry->exit_info1 = exit_info1;
555 __entry->exit_info2 = exit_info2;
556 __entry->exit_int_info = exit_int_info;
557 __entry->exit_int_info_err = exit_int_info_err;
560 TP_printk("rip: 0x%016llx reason: %s ext_inf1: 0x%016llx "
561 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
563 (__entry->isa == KVM_ISA_VMX) ?
564 __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) :
565 __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS),
566 __entry->exit_info1, __entry->exit_info2,
567 __entry->exit_int_info, __entry->exit_int_info_err)
571 * Tracepoint for #VMEXIT reinjected to the guest
573 TRACE_EVENT(kvm_nested_vmexit_inject,
574 TP_PROTO(__u32 exit_code,
575 __u64 exit_info1, __u64 exit_info2,
576 __u32 exit_int_info, __u32 exit_int_info_err, __u32 isa),
577 TP_ARGS(exit_code, exit_info1, exit_info2,
578 exit_int_info, exit_int_info_err, isa),
581 __field( __u32, exit_code )
582 __field( __u64, exit_info1 )
583 __field( __u64, exit_info2 )
584 __field( __u32, exit_int_info )
585 __field( __u32, exit_int_info_err )
586 __field( __u32, isa )
590 __entry->exit_code = exit_code;
591 __entry->exit_info1 = exit_info1;
592 __entry->exit_info2 = exit_info2;
593 __entry->exit_int_info = exit_int_info;
594 __entry->exit_int_info_err = exit_int_info_err;
598 TP_printk("reason: %s ext_inf1: 0x%016llx "
599 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
600 (__entry->isa == KVM_ISA_VMX) ?
601 __print_symbolic(__entry->exit_code, VMX_EXIT_REASONS) :
602 __print_symbolic(__entry->exit_code, SVM_EXIT_REASONS),
603 __entry->exit_info1, __entry->exit_info2,
604 __entry->exit_int_info, __entry->exit_int_info_err)
608 * Tracepoint for nested #vmexit because of interrupt pending
610 TRACE_EVENT(kvm_nested_intr_vmexit,
615 __field( __u64, rip )
622 TP_printk("rip: 0x%016llx", __entry->rip)
626 * Tracepoint for nested #vmexit because of interrupt pending
628 TRACE_EVENT(kvm_invlpga,
629 TP_PROTO(__u64 rip, int asid, u64 address),
630 TP_ARGS(rip, asid, address),
633 __field( __u64, rip )
635 __field( __u64, address )
640 __entry->asid = asid;
641 __entry->address = address;
644 TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx",
645 __entry->rip, __entry->asid, __entry->address)
649 * Tracepoint for nested #vmexit because of interrupt pending
651 TRACE_EVENT(kvm_skinit,
652 TP_PROTO(__u64 rip, __u32 slb),
656 __field( __u64, rip )
657 __field( __u32, slb )
665 TP_printk("rip: 0x%016llx slb: 0x%08x",
666 __entry->rip, __entry->slb)
669 #define KVM_EMUL_INSN_F_CR0_PE (1 << 0)
670 #define KVM_EMUL_INSN_F_EFL_VM (1 << 1)
671 #define KVM_EMUL_INSN_F_CS_D (1 << 2)
672 #define KVM_EMUL_INSN_F_CS_L (1 << 3)
674 #define kvm_trace_symbol_emul_flags \
676 { KVM_EMUL_INSN_F_CR0_PE \
677 | KVM_EMUL_INSN_F_EFL_VM, "vm16" }, \
678 { KVM_EMUL_INSN_F_CR0_PE, "prot16" }, \
679 { KVM_EMUL_INSN_F_CR0_PE \
680 | KVM_EMUL_INSN_F_CS_D, "prot32" }, \
681 { KVM_EMUL_INSN_F_CR0_PE \
682 | KVM_EMUL_INSN_F_CS_L, "prot64" }
684 #define kei_decode_mode(mode) ({ \
687 case X86EMUL_MODE_REAL: \
690 case X86EMUL_MODE_VM86: \
691 flags = KVM_EMUL_INSN_F_EFL_VM; \
693 case X86EMUL_MODE_PROT16: \
694 flags = KVM_EMUL_INSN_F_CR0_PE; \
696 case X86EMUL_MODE_PROT32: \
697 flags = KVM_EMUL_INSN_F_CR0_PE \
698 | KVM_EMUL_INSN_F_CS_D; \
700 case X86EMUL_MODE_PROT64: \
701 flags = KVM_EMUL_INSN_F_CR0_PE \
702 | KVM_EMUL_INSN_F_CS_L; \
708 TRACE_EVENT(kvm_emulate_insn,
709 TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed),
710 TP_ARGS(vcpu, failed),
713 __field( __u64, rip )
714 __field( __u32, csbase )
716 __array( __u8, insn, 15 )
717 __field( __u8, flags )
718 __field( __u8, failed )
722 __entry->csbase = kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS);
723 __entry->len = vcpu->arch.emulate_ctxt.fetch.ptr
724 - vcpu->arch.emulate_ctxt.fetch.data;
725 __entry->rip = vcpu->arch.emulate_ctxt._eip - __entry->len;
726 memcpy(__entry->insn,
727 vcpu->arch.emulate_ctxt.fetch.data,
729 __entry->flags = kei_decode_mode(vcpu->arch.emulate_ctxt.mode);
730 __entry->failed = failed;
733 TP_printk("%x:%llx:%s (%s)%s",
734 __entry->csbase, __entry->rip,
735 __print_hex(__entry->insn, __entry->len),
736 __print_symbolic(__entry->flags,
737 kvm_trace_symbol_emul_flags),
738 __entry->failed ? " failed" : ""
742 #define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0)
743 #define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1)
747 TP_PROTO(gva_t gva, gpa_t gpa, bool write, bool gpa_match),
748 TP_ARGS(gva, gpa, write, gpa_match),
754 __field(bool, gpa_match)
760 __entry->write = write;
761 __entry->gpa_match = gpa_match
764 TP_printk("gva %#lx gpa %#llx %s %s", __entry->gva, __entry->gpa,
765 __entry->write ? "Write" : "Read",
766 __entry->gpa_match ? "GPA" : "GVA")
769 TRACE_EVENT(kvm_write_tsc_offset,
770 TP_PROTO(unsigned int vcpu_id, __u64 previous_tsc_offset,
771 __u64 next_tsc_offset),
772 TP_ARGS(vcpu_id, previous_tsc_offset, next_tsc_offset),
775 __field( unsigned int, vcpu_id )
776 __field( __u64, previous_tsc_offset )
777 __field( __u64, next_tsc_offset )
781 __entry->vcpu_id = vcpu_id;
782 __entry->previous_tsc_offset = previous_tsc_offset;
783 __entry->next_tsc_offset = next_tsc_offset;
786 TP_printk("vcpu=%u prev=%llu next=%llu", __entry->vcpu_id,
787 __entry->previous_tsc_offset, __entry->next_tsc_offset)
792 #define host_clocks \
793 {VCLOCK_NONE, "none"}, \
794 {VCLOCK_TSC, "tsc"}, \
795 {VCLOCK_HPET, "hpet"} \
797 TRACE_EVENT(kvm_update_master_clock,
798 TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched),
799 TP_ARGS(use_master_clock, host_clock, offset_matched),
802 __field( bool, use_master_clock )
803 __field( unsigned int, host_clock )
804 __field( bool, offset_matched )
808 __entry->use_master_clock = use_master_clock;
809 __entry->host_clock = host_clock;
810 __entry->offset_matched = offset_matched;
813 TP_printk("masterclock %d hostclock %s offsetmatched %u",
814 __entry->use_master_clock,
815 __print_symbolic(__entry->host_clock, host_clocks),
816 __entry->offset_matched)
819 TRACE_EVENT(kvm_track_tsc,
820 TP_PROTO(unsigned int vcpu_id, unsigned int nr_matched,
821 unsigned int online_vcpus, bool use_master_clock,
822 unsigned int host_clock),
823 TP_ARGS(vcpu_id, nr_matched, online_vcpus, use_master_clock,
827 __field( unsigned int, vcpu_id )
828 __field( unsigned int, nr_vcpus_matched_tsc )
829 __field( unsigned int, online_vcpus )
830 __field( bool, use_master_clock )
831 __field( unsigned int, host_clock )
835 __entry->vcpu_id = vcpu_id;
836 __entry->nr_vcpus_matched_tsc = nr_matched;
837 __entry->online_vcpus = online_vcpus;
838 __entry->use_master_clock = use_master_clock;
839 __entry->host_clock = host_clock;
842 TP_printk("vcpu_id %u masterclock %u offsetmatched %u nr_online %u"
844 __entry->vcpu_id, __entry->use_master_clock,
845 __entry->nr_vcpus_matched_tsc, __entry->online_vcpus,
846 __print_symbolic(__entry->host_clock, host_clocks))
849 #endif /* CONFIG_X86_64 */
852 * Tracepoint for PML full VMEXIT.
854 TRACE_EVENT(kvm_pml_full,
855 TP_PROTO(unsigned int vcpu_id),
859 __field( unsigned int, vcpu_id )
863 __entry->vcpu_id = vcpu_id;
866 TP_printk("vcpu %d: PML full", __entry->vcpu_id)
869 TRACE_EVENT(kvm_ple_window,
870 TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old),
871 TP_ARGS(grow, vcpu_id, new, old),
874 __field( bool, grow )
875 __field( unsigned int, vcpu_id )
881 __entry->grow = grow;
882 __entry->vcpu_id = vcpu_id;
887 TP_printk("vcpu %u: ple_window %d (%s %d)",
890 __entry->grow ? "grow" : "shrink",
894 #define trace_kvm_ple_window_grow(vcpu_id, new, old) \
895 trace_kvm_ple_window(true, vcpu_id, new, old)
896 #define trace_kvm_ple_window_shrink(vcpu_id, new, old) \
897 trace_kvm_ple_window(false, vcpu_id, new, old)
899 TRACE_EVENT(kvm_pvclock_update,
900 TP_PROTO(unsigned int vcpu_id, struct pvclock_vcpu_time_info *pvclock),
901 TP_ARGS(vcpu_id, pvclock),
904 __field( unsigned int, vcpu_id )
905 __field( __u32, version )
906 __field( __u64, tsc_timestamp )
907 __field( __u64, system_time )
908 __field( __u32, tsc_to_system_mul )
909 __field( __s8, tsc_shift )
910 __field( __u8, flags )
914 __entry->vcpu_id = vcpu_id;
915 __entry->version = pvclock->version;
916 __entry->tsc_timestamp = pvclock->tsc_timestamp;
917 __entry->system_time = pvclock->system_time;
918 __entry->tsc_to_system_mul = pvclock->tsc_to_system_mul;
919 __entry->tsc_shift = pvclock->tsc_shift;
920 __entry->flags = pvclock->flags;
923 TP_printk("vcpu_id %u, pvclock { version %u, tsc_timestamp 0x%llx, "
924 "system_time 0x%llx, tsc_to_system_mul 0x%x, tsc_shift %d, "
928 __entry->tsc_timestamp,
929 __entry->system_time,
930 __entry->tsc_to_system_mul,
935 TRACE_EVENT(kvm_wait_lapic_expire,
936 TP_PROTO(unsigned int vcpu_id, s64 delta),
937 TP_ARGS(vcpu_id, delta),
940 __field( unsigned int, vcpu_id )
941 __field( s64, delta )
945 __entry->vcpu_id = vcpu_id;
946 __entry->delta = delta;
949 TP_printk("vcpu %u: delta %lld (%s)",
952 __entry->delta < 0 ? "early" : "late")
955 TRACE_EVENT(kvm_enter_smm,
956 TP_PROTO(unsigned int vcpu_id, u64 smbase, bool entering),
957 TP_ARGS(vcpu_id, smbase, entering),
960 __field( unsigned int, vcpu_id )
961 __field( u64, smbase )
962 __field( bool, entering )
966 __entry->vcpu_id = vcpu_id;
967 __entry->smbase = smbase;
968 __entry->entering = entering;
971 TP_printk("vcpu %u: %s SMM, smbase 0x%llx",
973 __entry->entering ? "entering" : "leaving",
977 #endif /* _TRACE_KVM_H */
979 #undef TRACE_INCLUDE_PATH
980 #define TRACE_INCLUDE_PATH arch/x86/kvm
981 #undef TRACE_INCLUDE_FILE
982 #define TRACE_INCLUDE_FILE trace
984 /* This part must be outside protection */
985 #include <trace/define_trace.h>