1 #if !defined(LTTNG_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define LTTNG_TRACE_KVM_MAIN_H
4 #include <probes/lttng-tracepoint-event.h>
5 #include <linux/version.h>
8 #define TRACE_SYSTEM kvm
10 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
12 LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit
,
13 TP_PROTO(__u32 reason
, int errno
),
14 TP_ARGS(reason
, errno
),
17 ctf_integer(__u32
, reason
, reason
)
18 ctf_integer(int, errno
, errno
)
23 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
24 #if defined(__KVM_HAVE_IOAPIC)
25 #undef __KVM_HAVE_IRQ_LINE
26 #define __KVM_HAVE_IRQ_LINE
30 #if defined(__KVM_HAVE_IRQ_LINE)
31 LTTNG_TRACEPOINT_EVENT(kvm_set_irq
,
32 TP_PROTO(unsigned int gsi
, int level
, int irq_source_id
),
33 TP_ARGS(gsi
, level
, irq_source_id
),
36 ctf_integer(unsigned int, gsi
, gsi
)
37 ctf_integer(int, level
, level
)
38 ctf_integer(int, irq_source_id
, irq_source_id
)
43 #if defined(__KVM_HAVE_IOAPIC)
45 LTTNG_TRACEPOINT_EVENT(kvm_ioapic_set_irq
,
46 TP_PROTO(__u64 e
, int pin
, bool coalesced
),
47 TP_ARGS(e
, pin
, coalesced
),
50 ctf_integer(__u64
, e
, e
)
51 ctf_integer(int, pin
, pin
)
52 ctf_integer(bool, coalesced
, coalesced
)
56 LTTNG_TRACEPOINT_EVENT(kvm_msi_set_irq
,
57 TP_PROTO(__u64 address
, __u64 data
),
58 TP_ARGS(address
, data
),
61 ctf_integer(__u64
, address
, address
)
62 ctf_integer(__u64
, data
, data
)
66 LTTNG_TRACEPOINT_EVENT(kvm_ack_irq
,
67 TP_PROTO(unsigned int irqchip
, unsigned int pin
),
68 TP_ARGS(irqchip
, pin
),
71 ctf_integer(unsigned int, irqchip
, irqchip
)
72 ctf_integer(unsigned int, pin
, pin
)
76 #endif /* defined(__KVM_HAVE_IOAPIC) */
78 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
79 #define KVM_TRACE_MMIO_READ 1
80 #define KVM_TRACE_MMIO_WRITE 2
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" }
87 LTTNG_TRACEPOINT_EVENT(kvm_mmio
,
88 TP_PROTO(int type
, int len
, u64 gpa
, u64 val
),
89 TP_ARGS(type
, len
, gpa
, val
),
92 ctf_integer(u32
, type
, type
)
93 ctf_integer(u32
, len
, len
)
94 ctf_integer(u64
, gpa
, gpa
)
95 ctf_integer(u64
, val
, val
)
99 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
101 #define kvm_fpu_load_symbol \
105 LTTNG_TRACEPOINT_EVENT(kvm_fpu
,
110 ctf_integer(u32
, load
, load
)
114 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) \
115 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,327,0,0, 3,11,0,0,0,0))
117 LTTNG_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
),
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
)
132 LTTNG_TRACEPOINT_EVENT(kvm_age_page
,
133 TP_PROTO(ulong hva
, struct kvm_memory_slot
*slot
, int ref
),
134 TP_ARGS(hva
, slot
, ref
),
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
)
146 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
148 #ifdef CONFIG_KVM_ASYNC_PF
149 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class
,
151 TP_PROTO(u64 gva
, u64 gfn
),
156 ctf_integer(__u64
, gva
, gva
)
157 ctf_integer(u64
, gfn
, gfn
)
161 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class
, kvm_try_async_get_page
,
163 TP_PROTO(u64 gva
, u64 gfn
),
168 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_get_page_class
, kvm_async_pf_doublefault
,
170 TP_PROTO(u64 gva
, u64 gfn
),
175 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_pf_nopresent_ready
,
177 TP_PROTO(u64 token
, u64 gva
),
182 ctf_integer(__u64
, token
, token
)
183 ctf_integer(__u64
, gva
, gva
)
187 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready
, kvm_async_pf_not_present
,
189 TP_PROTO(u64 token
, u64 gva
),
194 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_async_pf_nopresent_ready
, kvm_async_pf_ready
,
196 TP_PROTO(u64 token
, u64 gva
),
201 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) \
202 || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
204 LTTNG_TRACEPOINT_EVENT(
205 kvm_async_pf_completed
,
206 TP_PROTO(unsigned long address
, u64 gva
),
207 TP_ARGS(address
, gva
),
210 ctf_integer(unsigned long, address
, address
)
211 ctf_integer(u64
, gva
, gva
)
215 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
217 LTTNG_TRACEPOINT_EVENT(
218 kvm_async_pf_completed
,
219 TP_PROTO(unsigned long address
, struct page
*page
, u64 gva
),
220 TP_ARGS(address
, page
, gva
),
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
)
229 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
235 #endif /* LTTNG_TRACE_KVM_MAIN_H */
237 /* This part must be outside protection */
238 #include <probes/define_trace.h>