sysfs: Remove support for tagged directories with untagged members (again)
[linux-btrfs-devel.git] / include / trace / events / kvm.h
blob46e3cd8e197a54d2616bf8d3587b525d5f438f16
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)
18 TRACE_EVENT(kvm_userspace_exit,
19 TP_PROTO(__u32 reason, int errno),
20 TP_ARGS(reason, errno),
22 TP_STRUCT__entry(
23 __field( __u32, reason )
24 __field( int, errno )
27 TP_fast_assign(
28 __entry->reason = reason;
29 __entry->errno = errno;
32 TP_printk("reason %s (%d)",
33 __entry->errno < 0 ?
34 (__entry->errno == -EINTR ? "restart" : "error") :
35 __print_symbolic(__entry->reason, kvm_trace_exit_reason),
36 __entry->errno < 0 ? -__entry->errno : __entry->reason)
39 #if defined(__KVM_HAVE_IOAPIC)
40 TRACE_EVENT(kvm_set_irq,
41 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
42 TP_ARGS(gsi, level, irq_source_id),
44 TP_STRUCT__entry(
45 __field( unsigned int, gsi )
46 __field( int, level )
47 __field( int, irq_source_id )
50 TP_fast_assign(
51 __entry->gsi = gsi;
52 __entry->level = level;
53 __entry->irq_source_id = irq_source_id;
56 TP_printk("gsi %u level %d source %d",
57 __entry->gsi, __entry->level, __entry->irq_source_id)
60 #define kvm_deliver_mode \
61 {0x0, "Fixed"}, \
62 {0x1, "LowPrio"}, \
63 {0x2, "SMI"}, \
64 {0x3, "Res3"}, \
65 {0x4, "NMI"}, \
66 {0x5, "INIT"}, \
67 {0x6, "SIPI"}, \
68 {0x7, "ExtINT"}
70 TRACE_EVENT(kvm_ioapic_set_irq,
71 TP_PROTO(__u64 e, int pin, bool coalesced),
72 TP_ARGS(e, pin, coalesced),
74 TP_STRUCT__entry(
75 __field( __u64, e )
76 __field( int, pin )
77 __field( bool, coalesced )
80 TP_fast_assign(
81 __entry->e = e;
82 __entry->pin = pin;
83 __entry->coalesced = coalesced;
86 TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s",
87 __entry->pin, (u8)(__entry->e >> 56), (u8)__entry->e,
88 __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode),
89 (__entry->e & (1<<11)) ? "logical" : "physical",
90 (__entry->e & (1<<15)) ? "level" : "edge",
91 (__entry->e & (1<<16)) ? "|masked" : "",
92 __entry->coalesced ? " (coalesced)" : "")
95 TRACE_EVENT(kvm_msi_set_irq,
96 TP_PROTO(__u64 address, __u64 data),
97 TP_ARGS(address, data),
99 TP_STRUCT__entry(
100 __field( __u64, address )
101 __field( __u64, data )
104 TP_fast_assign(
105 __entry->address = address;
106 __entry->data = data;
109 TP_printk("dst %u vec %x (%s|%s|%s%s)",
110 (u8)(__entry->address >> 12), (u8)__entry->data,
111 __print_symbolic((__entry->data >> 8 & 0x7), kvm_deliver_mode),
112 (__entry->address & (1<<2)) ? "logical" : "physical",
113 (__entry->data & (1<<15)) ? "level" : "edge",
114 (__entry->address & (1<<3)) ? "|rh" : "")
117 #define kvm_irqchips \
118 {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \
119 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \
120 {KVM_IRQCHIP_IOAPIC, "IOAPIC"}
122 TRACE_EVENT(kvm_ack_irq,
123 TP_PROTO(unsigned int irqchip, unsigned int pin),
124 TP_ARGS(irqchip, pin),
126 TP_STRUCT__entry(
127 __field( unsigned int, irqchip )
128 __field( unsigned int, pin )
131 TP_fast_assign(
132 __entry->irqchip = irqchip;
133 __entry->pin = pin;
136 TP_printk("irqchip %s pin %u",
137 __print_symbolic(__entry->irqchip, kvm_irqchips),
138 __entry->pin)
143 #endif /* defined(__KVM_HAVE_IOAPIC) */
145 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
146 #define KVM_TRACE_MMIO_READ 1
147 #define KVM_TRACE_MMIO_WRITE 2
149 #define kvm_trace_symbol_mmio \
150 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
151 { KVM_TRACE_MMIO_READ, "read" }, \
152 { KVM_TRACE_MMIO_WRITE, "write" }
154 TRACE_EVENT(kvm_mmio,
155 TP_PROTO(int type, int len, u64 gpa, u64 val),
156 TP_ARGS(type, len, gpa, val),
158 TP_STRUCT__entry(
159 __field( u32, type )
160 __field( u32, len )
161 __field( u64, gpa )
162 __field( u64, val )
165 TP_fast_assign(
166 __entry->type = type;
167 __entry->len = len;
168 __entry->gpa = gpa;
169 __entry->val = val;
172 TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx",
173 __print_symbolic(__entry->type, kvm_trace_symbol_mmio),
174 __entry->len, __entry->gpa, __entry->val)
177 #define kvm_fpu_load_symbol \
178 {0, "unload"}, \
179 {1, "load"}
181 TRACE_EVENT(kvm_fpu,
182 TP_PROTO(int load),
183 TP_ARGS(load),
185 TP_STRUCT__entry(
186 __field( u32, load )
189 TP_fast_assign(
190 __entry->load = load;
193 TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol))
196 TRACE_EVENT(kvm_age_page,
197 TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref),
198 TP_ARGS(hva, slot, ref),
200 TP_STRUCT__entry(
201 __field( u64, hva )
202 __field( u64, gfn )
203 __field( u8, referenced )
206 TP_fast_assign(
207 __entry->hva = hva;
208 __entry->gfn =
209 slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT);
210 __entry->referenced = ref;
213 TP_printk("hva %llx gfn %llx %s",
214 __entry->hva, __entry->gfn,
215 __entry->referenced ? "YOUNG" : "OLD")
218 #ifdef CONFIG_KVM_ASYNC_PF
219 DECLARE_EVENT_CLASS(kvm_async_get_page_class,
221 TP_PROTO(u64 gva, u64 gfn),
223 TP_ARGS(gva, gfn),
225 TP_STRUCT__entry(
226 __field(__u64, gva)
227 __field(u64, gfn)
230 TP_fast_assign(
231 __entry->gva = gva;
232 __entry->gfn = gfn;
235 TP_printk("gva = %#llx, gfn = %#llx", __entry->gva, __entry->gfn)
238 DEFINE_EVENT(kvm_async_get_page_class, kvm_try_async_get_page,
240 TP_PROTO(u64 gva, u64 gfn),
242 TP_ARGS(gva, gfn)
245 DEFINE_EVENT(kvm_async_get_page_class, kvm_async_pf_doublefault,
247 TP_PROTO(u64 gva, u64 gfn),
249 TP_ARGS(gva, gfn)
252 DECLARE_EVENT_CLASS(kvm_async_pf_nopresent_ready,
254 TP_PROTO(u64 token, u64 gva),
256 TP_ARGS(token, gva),
258 TP_STRUCT__entry(
259 __field(__u64, token)
260 __field(__u64, gva)
263 TP_fast_assign(
264 __entry->token = token;
265 __entry->gva = gva;
268 TP_printk("token %#llx gva %#llx", __entry->token, __entry->gva)
272 DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present,
274 TP_PROTO(u64 token, u64 gva),
276 TP_ARGS(token, gva)
279 DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
281 TP_PROTO(u64 token, u64 gva),
283 TP_ARGS(token, gva)
286 TRACE_EVENT(
287 kvm_async_pf_completed,
288 TP_PROTO(unsigned long address, struct page *page, u64 gva),
289 TP_ARGS(address, page, gva),
291 TP_STRUCT__entry(
292 __field(unsigned long, address)
293 __field(pfn_t, pfn)
294 __field(u64, gva)
297 TP_fast_assign(
298 __entry->address = address;
299 __entry->pfn = page ? page_to_pfn(page) : 0;
300 __entry->gva = gva;
303 TP_printk("gva %#llx address %#lx pfn %#llx", __entry->gva,
304 __entry->address, __entry->pfn)
307 #endif
309 #endif /* _TRACE_KVM_MAIN_H */
311 /* This part must be outside protection */
312 #include <trace/define_trace.h>