Fix: Add granularity to RHEL kernel version checks
[lttng-modules.git] / instrumentation / events / lttng-module / kvm.h
CommitLineData
3bc29f0a
MD
1#if !defined(LTTNG_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2#define LTTNG_TRACE_KVM_MAIN_H
f62b389e 3
6ec43db8 4#include <probes/lttng-tracepoint-event.h>
d53870e8 5#include <linux/version.h>
f62b389e
MD
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvm
9
7c68b363
AG
10#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
11
3bc29f0a 12LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit,
f62b389e
MD
13 TP_PROTO(__u32 reason, int errno),
14 TP_ARGS(reason, errno),
15
f127e61e
MD
16 TP_FIELDS(
17 ctf_integer(__u32, reason, reason)
18 ctf_integer(int, errno, errno)
19 )
f62b389e 20)
7c68b363 21#endif
f62b389e 22
7c68b363 23#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
f62b389e 24#if defined(__KVM_HAVE_IOAPIC)
7c68b363
AG
25#undef __KVM_HAVE_IRQ_LINE
26#define __KVM_HAVE_IRQ_LINE
27#endif
28#endif
29
30#if defined(__KVM_HAVE_IRQ_LINE)
3bc29f0a 31LTTNG_TRACEPOINT_EVENT(kvm_set_irq,
f62b389e
MD
32 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
33 TP_ARGS(gsi, level, irq_source_id),
34
f127e61e
MD
35 TP_FIELDS(
36 ctf_integer(unsigned int, gsi, gsi)
37 ctf_integer(int, level, level)
38 ctf_integer(int, irq_source_id, irq_source_id)
39 )
f62b389e 40)
7c68b363 41#endif
f62b389e 42
7c68b363 43#if defined(__KVM_HAVE_IOAPIC)
f62b389e 44
3bc29f0a 45LTTNG_TRACEPOINT_EVENT(kvm_ioapic_set_irq,
f62b389e
MD
46 TP_PROTO(__u64 e, int pin, bool coalesced),
47 TP_ARGS(e, pin, coalesced),
48
f127e61e
MD
49 TP_FIELDS(
50 ctf_integer(__u64, e, e)
51 ctf_integer(int, pin, pin)
52 ctf_integer(bool, coalesced, coalesced)
53 )
f62b389e
MD
54)
55
3bc29f0a 56LTTNG_TRACEPOINT_EVENT(kvm_msi_set_irq,
f62b389e
MD
57 TP_PROTO(__u64 address, __u64 data),
58 TP_ARGS(address, data),
59
f127e61e
MD
60 TP_FIELDS(
61 ctf_integer(__u64, address, address)
62 ctf_integer(__u64, data, data)
63 )
f62b389e
MD
64)
65
3bc29f0a 66LTTNG_TRACEPOINT_EVENT(kvm_ack_irq,
f62b389e
MD
67 TP_PROTO(unsigned int irqchip, unsigned int pin),
68 TP_ARGS(irqchip, pin),
69
f127e61e
MD
70 TP_FIELDS(
71 ctf_integer(unsigned int, irqchip, irqchip)
72 ctf_integer(unsigned int, pin, pin)
73 )
f62b389e
MD
74)
75
f62b389e
MD
76#endif /* defined(__KVM_HAVE_IOAPIC) */
77
78#define KVM_TRACE_MMIO_READ_UNSATISFIED 0
79#define KVM_TRACE_MMIO_READ 1
80#define KVM_TRACE_MMIO_WRITE 2
81
82#define kvm_trace_symbol_mmio \
83 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
84 { KVM_TRACE_MMIO_READ, "read" }, \
85 { KVM_TRACE_MMIO_WRITE, "write" }
86
3bc29f0a 87LTTNG_TRACEPOINT_EVENT(kvm_mmio,
f62b389e
MD
88 TP_PROTO(int type, int len, u64 gpa, u64 val),
89 TP_ARGS(type, len, gpa, val),
90
f127e61e
MD
91 TP_FIELDS(
92 ctf_integer(u32, type, type)
93 ctf_integer(u32, len, len)
94 ctf_integer(u64, gpa, gpa)
95 ctf_integer(u64, val, val)
96 )
f62b389e
MD
97)
98
7c68b363
AG
99#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
100
f62b389e
MD
101#define kvm_fpu_load_symbol \
102 {0, "unload"}, \
103 {1, "load"}
104
3bc29f0a 105LTTNG_TRACEPOINT_EVENT(kvm_fpu,
f62b389e
MD
106 TP_PROTO(int load),
107 TP_ARGS(load),
108
f127e61e
MD
109 TP_FIELDS(
110 ctf_integer(u32, load, load)
111 )
f62b389e
MD
112)
113
1ae35e0d 114#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) \
53c4007f 115 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,327,0,0, 3,11,0,0,0,0))
6f0af264
AGR
116
117LTTNG_TRACEPOINT_EVENT(kvm_age_page,
118 TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),
119 TP_ARGS(gfn, level, slot, ref),
120
c94b360d
MD
121 TP_FIELDS(
122 ctf_integer(u64, hva,
123 ((gfn - slot->base_gfn) << PAGE_SHIFT) + slot->userspace_addr)
124 ctf_integer(u64, gfn, gfn)
125 ctf_integer(u8, level, level)
126 ctf_integer(u8, referenced, ref)
127 )
6f0af264
AGR
128)
129
130#else
131
3bc29f0a 132LTTNG_TRACEPOINT_EVENT(kvm_age_page,
f62b389e
MD
133 TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref),
134 TP_ARGS(hva, slot, ref),
135
f127e61e
MD
136 TP_FIELDS(
137 ctf_integer(u64, hva, hva)
138 ctf_integer(u64, gfn,
139 slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT))
140 ctf_integer(u8, referenced, ref)
141 )
f62b389e 142)
7c68b363 143#endif
6f0af264 144#endif
7c68b363
AG
145
146#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
f62b389e
MD
147
148#ifdef CONFIG_KVM_ASYNC_PF
3bc29f0a 149LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class,
f62b389e
MD
150
151 TP_PROTO(u64 gva, u64 gfn),
152
153 TP_ARGS(gva, gfn),
154
f127e61e
MD
155 TP_FIELDS(
156 ctf_integer(__u64, gva, gva)
157 ctf_integer(u64, gfn, gfn)
158 )
f62b389e
MD
159)
160
3bc29f0a 161LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class, kvm_try_async_get_page,
f62b389e
MD
162
163 TP_PROTO(u64 gva, u64 gfn),
164
165 TP_ARGS(gva, gfn)
166)
167
3bc29f0a 168LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class, kvm_async_pf_doublefault,
f62b389e
MD
169
170 TP_PROTO(u64 gva, u64 gfn),
171
172 TP_ARGS(gva, gfn)
173)
174
3bc29f0a 175LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_pf_nopresent_ready,
f62b389e
MD
176
177 TP_PROTO(u64 token, u64 gva),
178
179 TP_ARGS(token, gva),
180
f127e61e
MD
181 TP_FIELDS(
182 ctf_integer(__u64, token, token)
183 ctf_integer(__u64, gva, gva)
184 )
f62b389e
MD
185)
186
3bc29f0a 187LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present,
f62b389e
MD
188
189 TP_PROTO(u64 token, u64 gva),
190
191 TP_ARGS(token, gva)
192)
193
3bc29f0a 194LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
f62b389e
MD
195
196 TP_PROTO(u64 token, u64 gva),
197
198 TP_ARGS(token, gva)
199)
200
f30ae671 201#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) \
53c4007f 202 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
0d019e70 203
3bc29f0a 204LTTNG_TRACEPOINT_EVENT(
0d019e70
MD
205 kvm_async_pf_completed,
206 TP_PROTO(unsigned long address, u64 gva),
207 TP_ARGS(address, gva),
208
f127e61e
MD
209 TP_FIELDS(
210 ctf_integer(unsigned long, address, address)
211 ctf_integer(u64, gva, gva)
212 )
0d019e70
MD
213)
214
215#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
216
3bc29f0a 217LTTNG_TRACEPOINT_EVENT(
f62b389e
MD
218 kvm_async_pf_completed,
219 TP_PROTO(unsigned long address, struct page *page, u64 gva),
220 TP_ARGS(address, page, gva),
221
f127e61e
MD
222 TP_FIELDS(
223 ctf_integer(unsigned long, address, address)
224 ctf_integer(pfn_t, pfn, page ? page_to_pfn(page) : 0)
225 ctf_integer(u64, gva, gva)
226 )
f62b389e
MD
227)
228
0d019e70
MD
229#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
230
f62b389e
MD
231#endif
232
7c68b363
AG
233#endif
234
3bc29f0a 235#endif /* LTTNG_TRACE_KVM_MAIN_H */
f62b389e
MD
236
237/* This part must be outside protection */
6ec43db8 238#include <probes/define_trace.h>
This page took 0.043163 seconds and 4 git commands to generate.