perf hists: Move sort__has_sym into struct perf_hpp_list
[linux/fpc-iii.git] / include / trace / events / kvm.h
blobaa69253ecc7dd94df775361ac6c6f5b70c6e0dfc
1 #if !defined(_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_MAIN_H
4 #include <linux/tracepoint.h>
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM kvm
9 #define ERSN(x) { KVM_EXIT_##x, "KVM_EXIT_" #x }
11 #define kvm_trace_exit_reason \
12 ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \
13 ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \
14 ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \
15 ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
16 ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL), \
17 ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)
19 TRACE_EVENT(kvm_userspace_exit,
20 TP_PROTO(__u32 reason, int errno),
21 TP_ARGS(reason, errno),
23 TP_STRUCT__entry(
24 __field( __u32, reason )
25 __field( int, errno )
28 TP_fast_assign(
29 __entry->reason = reason;
30 __entry->errno = errno;
33 TP_printk("reason %s (%d)",
34 __entry->errno < 0 ?
35 (__entry->errno == -EINTR ? "restart" : "error") :
36 __print_symbolic(__entry->reason, kvm_trace_exit_reason),
37 __entry->errno < 0 ? -__entry->errno : __entry->reason)
40 TRACE_EVENT(kvm_vcpu_wakeup,
41 TP_PROTO(__u64 ns, bool waited),
42 TP_ARGS(ns, waited),
44 TP_STRUCT__entry(
45 __field( __u64, ns )
46 __field( bool, waited )
49 TP_fast_assign(
50 __entry->ns = ns;
51 __entry->waited = waited;
54 TP_printk("%s time %lld ns",
55 __entry->waited ? "wait" : "poll",
56 __entry->ns)
59 #if defined(CONFIG_HAVE_KVM_IRQFD)
60 TRACE_EVENT(kvm_set_irq,
61 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
62 TP_ARGS(gsi, level, irq_source_id),
64 TP_STRUCT__entry(
65 __field( unsigned int, gsi )
66 __field( int, level )
67 __field( int, irq_source_id )
70 TP_fast_assign(
71 __entry->gsi = gsi;
72 __entry->level = level;
73 __entry->irq_source_id = irq_source_id;
76 TP_printk("gsi %u level %d source %d",
77 __entry->gsi, __entry->level, __entry->irq_source_id)
79 #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
81 #if defined(__KVM_HAVE_IOAPIC)
82 #define kvm_deliver_mode \
83 {0x0, "Fixed"}, \
84 {0x1, "LowPrio"}, \
85 {0x2, "SMI"}, \
86 {0x3, "Res3"}, \
87 {0x4, "NMI"}, \
88 {0x5, "INIT"}, \
89 {0x6, "SIPI"}, \
90 {0x7, "ExtINT"}
92 TRACE_EVENT(kvm_ioapic_set_irq,
93 TP_PROTO(__u64 e, int pin, bool coalesced),
94 TP_ARGS(e, pin, coalesced),
96 TP_STRUCT__entry(
97 __field( __u64, e )
98 __field( int, pin )
99 __field( bool, coalesced )
102 TP_fast_assign(
103 __entry->e = e;
104 __entry->pin = pin;
105 __entry->coalesced = coalesced;
108 TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s",
109 __entry->pin, (u8)(__entry->e >> 56), (u8)__entry->e,
110 __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode),
111 (__entry->e & (1<<11)) ? "logical" : "physical",
112 (__entry->e & (1<<15)) ? "level" : "edge",
113 (__entry->e & (1<<16)) ? "|masked" : "",
114 __entry->coalesced ? " (coalesced)" : "")
117 TRACE_EVENT(kvm_ioapic_delayed_eoi_inj,
118 TP_PROTO(__u64 e),
119 TP_ARGS(e),
121 TP_STRUCT__entry(
122 __field( __u64, e )
125 TP_fast_assign(
126 __entry->e = e;
129 TP_printk("dst %x vec=%u (%s|%s|%s%s)",
130 (u8)(__entry->e >> 56), (u8)__entry->e,
131 __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode),
132 (__entry->e & (1<<11)) ? "logical" : "physical",
133 (__entry->e & (1<<15)) ? "level" : "edge",
134 (__entry->e & (1<<16)) ? "|masked" : "")
137 TRACE_EVENT(kvm_msi_set_irq,
138 TP_PROTO(__u64 address, __u64 data),
139 TP_ARGS(address, data),
141 TP_STRUCT__entry(
142 __field( __u64, address )
143 __field( __u64, data )
146 TP_fast_assign(
147 __entry->address = address;
148 __entry->data = data;
151 TP_printk("dst %u vec %x (%s|%s|%s%s)",
152 (u8)(__entry->address >> 12), (u8)__entry->data,
153 __print_symbolic((__entry->data >> 8 & 0x7), kvm_deliver_mode),
154 (__entry->address & (1<<2)) ? "logical" : "physical",
155 (__entry->data & (1<<15)) ? "level" : "edge",
156 (__entry->address & (1<<3)) ? "|rh" : "")
159 #define kvm_irqchips \
160 {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \
161 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \
162 {KVM_IRQCHIP_IOAPIC, "IOAPIC"}
164 #endif /* defined(__KVM_HAVE_IOAPIC) */
166 #if defined(CONFIG_HAVE_KVM_IRQFD)
168 #ifdef kvm_irqchips
169 #define kvm_ack_irq_string "irqchip %s pin %u"
170 #define kvm_ack_irq_parm __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin
171 #else
172 #define kvm_ack_irq_string "irqchip %d pin %u"
173 #define kvm_ack_irq_parm __entry->irqchip, __entry->pin
174 #endif
176 TRACE_EVENT(kvm_ack_irq,
177 TP_PROTO(unsigned int irqchip, unsigned int pin),
178 TP_ARGS(irqchip, pin),
180 TP_STRUCT__entry(
181 __field( unsigned int, irqchip )
182 __field( unsigned int, pin )
185 TP_fast_assign(
186 __entry->irqchip = irqchip;
187 __entry->pin = pin;
190 TP_printk(kvm_ack_irq_string, kvm_ack_irq_parm)
193 #endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
197 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
198 #define KVM_TRACE_MMIO_READ 1
199 #define KVM_TRACE_MMIO_WRITE 2
201 #define kvm_trace_symbol_mmio \
202 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
203 { KVM_TRACE_MMIO_READ, "read" }, \
204 { KVM_TRACE_MMIO_WRITE, "write" }
206 TRACE_EVENT(kvm_mmio,
207 TP_PROTO(int type, int len, u64 gpa, u64 val),
208 TP_ARGS(type, len, gpa, val),
210 TP_STRUCT__entry(
211 __field( u32, type )
212 __field( u32, len )
213 __field( u64, gpa )
214 __field( u64, val )
217 TP_fast_assign(
218 __entry->type = type;
219 __entry->len = len;
220 __entry->gpa = gpa;
221 __entry->val = val;
224 TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx",
225 __print_symbolic(__entry->type, kvm_trace_symbol_mmio),
226 __entry->len, __entry->gpa, __entry->val)
229 #define kvm_fpu_load_symbol \
230 {0, "unload"}, \
231 {1, "load"}
233 TRACE_EVENT(kvm_fpu,
234 TP_PROTO(int load),
235 TP_ARGS(load),
237 TP_STRUCT__entry(
238 __field( u32, load )
241 TP_fast_assign(
242 __entry->load = load;
245 TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol))
248 TRACE_EVENT(kvm_age_page,
249 TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),
250 TP_ARGS(gfn, level, slot, ref),
252 TP_STRUCT__entry(
253 __field( u64, hva )
254 __field( u64, gfn )
255 __field( u8, level )
256 __field( u8, referenced )
259 TP_fast_assign(
260 __entry->gfn = gfn;
261 __entry->level = level;
262 __entry->hva = ((gfn - slot->base_gfn) <<
263 PAGE_SHIFT) + slot->userspace_addr;
264 __entry->referenced = ref;
267 TP_printk("hva %llx gfn %llx level %u %s",
268 __entry->hva, __entry->gfn, __entry->level,
269 __entry->referenced ? "YOUNG" : "OLD")
272 #ifdef CONFIG_KVM_ASYNC_PF
273 DECLARE_EVENT_CLASS(kvm_async_get_page_class,
275 TP_PROTO(u64 gva, u64 gfn),
277 TP_ARGS(gva, gfn),
279 TP_STRUCT__entry(
280 __field(__u64, gva)
281 __field(u64, gfn)
284 TP_fast_assign(
285 __entry->gva = gva;
286 __entry->gfn = gfn;
289 TP_printk("gva = %#llx, gfn = %#llx", __entry->gva, __entry->gfn)
292 DEFINE_EVENT(kvm_async_get_page_class, kvm_try_async_get_page,
294 TP_PROTO(u64 gva, u64 gfn),
296 TP_ARGS(gva, gfn)
299 DEFINE_EVENT(kvm_async_get_page_class, kvm_async_pf_doublefault,
301 TP_PROTO(u64 gva, u64 gfn),
303 TP_ARGS(gva, gfn)
306 DECLARE_EVENT_CLASS(kvm_async_pf_nopresent_ready,
308 TP_PROTO(u64 token, u64 gva),
310 TP_ARGS(token, gva),
312 TP_STRUCT__entry(
313 __field(__u64, token)
314 __field(__u64, gva)
317 TP_fast_assign(
318 __entry->token = token;
319 __entry->gva = gva;
322 TP_printk("token %#llx gva %#llx", __entry->token, __entry->gva)
326 DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present,
328 TP_PROTO(u64 token, u64 gva),
330 TP_ARGS(token, gva)
333 DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
335 TP_PROTO(u64 token, u64 gva),
337 TP_ARGS(token, gva)
340 TRACE_EVENT(
341 kvm_async_pf_completed,
342 TP_PROTO(unsigned long address, u64 gva),
343 TP_ARGS(address, gva),
345 TP_STRUCT__entry(
346 __field(unsigned long, address)
347 __field(u64, gva)
350 TP_fast_assign(
351 __entry->address = address;
352 __entry->gva = gva;
355 TP_printk("gva %#llx address %#lx", __entry->gva,
356 __entry->address)
359 #endif
361 TRACE_EVENT(kvm_halt_poll_ns,
362 TP_PROTO(bool grow, unsigned int vcpu_id, unsigned int new,
363 unsigned int old),
364 TP_ARGS(grow, vcpu_id, new, old),
366 TP_STRUCT__entry(
367 __field(bool, grow)
368 __field(unsigned int, vcpu_id)
369 __field(unsigned int, new)
370 __field(unsigned int, old)
373 TP_fast_assign(
374 __entry->grow = grow;
375 __entry->vcpu_id = vcpu_id;
376 __entry->new = new;
377 __entry->old = old;
380 TP_printk("vcpu %u: halt_poll_ns %u (%s %u)",
381 __entry->vcpu_id,
382 __entry->new,
383 __entry->grow ? "grow" : "shrink",
384 __entry->old)
387 #define trace_kvm_halt_poll_ns_grow(vcpu_id, new, old) \
388 trace_kvm_halt_poll_ns(true, vcpu_id, new, old)
389 #define trace_kvm_halt_poll_ns_shrink(vcpu_id, new, old) \
390 trace_kvm_halt_poll_ns(false, vcpu_id, new, old)
392 #endif /* _TRACE_KVM_MAIN_H */
394 /* This part must be outside protection */
395 #include <trace/define_trace.h>