Move headers under include/
[lttng-modules.git] / include / instrumentation / events / lttng-module / arch / x86 / kvm / mmutrace.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #if !defined(LTTNG_TRACE_KVM_MMU_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define LTTNG_TRACE_KVM_MMU_H
4
5 #include <lttng/lttng-tracepoint-event.h>
6
7 #include <linux/trace_events.h>
8
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM kvm_mmu
11
12 #define LTTNG_KVM_MMU_PAGE_FIELDS \
13 ctf_integer(__u64, gfn, (sp)->gfn) \
14 ctf_integer(__u32, role, (sp)->role.word) \
15 ctf_integer(__u32, root_count, (sp)->root_count) \
16 ctf_integer(bool, unsync, (sp)->unsync)
17
18 /*
19 * A pagetable walk has started
20 */
21 LTTNG_TRACEPOINT_EVENT(
22 kvm_mmu_pagetable_walk,
23 TP_PROTO(u64 addr, u32 pferr),
24 TP_ARGS(addr, pferr),
25
26 TP_FIELDS(
27 ctf_integer_hex(__u64, addr, addr)
28 ctf_integer(__u32, pferr, pferr)
29 )
30 )
31
32 /* We just walked a paging element */
33 LTTNG_TRACEPOINT_EVENT(
34 kvm_mmu_paging_element,
35 TP_PROTO(u64 pte, int level),
36 TP_ARGS(pte, level),
37
38 TP_FIELDS(
39 ctf_integer(__u64, pte, pte)
40 ctf_integer(__u32, level, level)
41 )
42 )
43
44 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_set_bit_class,
45
46 TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size),
47
48 TP_ARGS(table_gfn, index, size),
49
50 TP_FIELDS(
51 ctf_integer(__u64, gpa,
52 ((u64)table_gfn << PAGE_SHIFT) + index * size)
53 )
54 )
55
56 /* We set a pte accessed bit */
57 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_set_bit_class, kvm_mmu_set_accessed_bit,
58
59 TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size),
60
61 TP_ARGS(table_gfn, index, size)
62 )
63
64 /* We set a pte dirty bit */
65 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_set_bit_class, kvm_mmu_set_dirty_bit,
66
67 TP_PROTO(unsigned long table_gfn, unsigned index, unsigned size),
68
69 TP_ARGS(table_gfn, index, size)
70 )
71
72 LTTNG_TRACEPOINT_EVENT(
73 kvm_mmu_walker_error,
74 TP_PROTO(u32 pferr),
75 TP_ARGS(pferr),
76
77 TP_FIELDS(
78 ctf_integer(__u32, pferr, pferr)
79 )
80 )
81
82 LTTNG_TRACEPOINT_EVENT(
83 kvm_mmu_get_page,
84 TP_PROTO(struct kvm_mmu_page *sp, bool created),
85 TP_ARGS(sp, created),
86
87 TP_FIELDS(
88 LTTNG_KVM_MMU_PAGE_FIELDS
89 ctf_integer(bool, created, created)
90 )
91 )
92
93 LTTNG_TRACEPOINT_EVENT_CLASS(kvm_mmu_page_class,
94
95 TP_PROTO(struct kvm_mmu_page *sp),
96 TP_ARGS(sp),
97
98 TP_FIELDS(
99 LTTNG_KVM_MMU_PAGE_FIELDS
100 )
101 )
102
103 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_sync_page,
104 TP_PROTO(struct kvm_mmu_page *sp),
105
106 TP_ARGS(sp)
107 )
108
109 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_unsync_page,
110 TP_PROTO(struct kvm_mmu_page *sp),
111
112 TP_ARGS(sp)
113 )
114
115 LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
116 TP_PROTO(struct kvm_mmu_page *sp),
117
118 TP_ARGS(sp)
119 )
120
121 LTTNG_TRACEPOINT_EVENT_MAP(
122 mark_mmio_spte,
123
124 kvm_mmu_mark_mmio_spte,
125
126 TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access, unsigned int gen),
127 TP_ARGS(sptep, gfn, access, gen),
128
129 TP_FIELDS(
130 ctf_integer_hex(void *, sptep, sptep)
131 ctf_integer(gfn_t, gfn, gfn)
132 ctf_integer(unsigned, access, access)
133 ctf_integer(unsigned int, gen, gen)
134 )
135 )
136
137 LTTNG_TRACEPOINT_EVENT_MAP(
138 handle_mmio_page_fault,
139
140 kvm_mmu_handle_mmio_page_fault,
141
142 TP_PROTO(u64 addr, gfn_t gfn, unsigned access),
143 TP_ARGS(addr, gfn, access),
144
145 TP_FIELDS(
146 ctf_integer_hex(u64, addr, addr)
147 ctf_integer(gfn_t, gfn, gfn)
148 ctf_integer(unsigned, access, access)
149 )
150 )
151
152 LTTNG_TRACEPOINT_EVENT_MAP(
153 fast_page_fault,
154
155 kvm_mmu_fast_page_fault,
156
157 TP_PROTO(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u32 error_code,
158 u64 *sptep, u64 old_spte, bool retry),
159 TP_ARGS(vcpu, cr2_or_gpa, error_code, sptep, old_spte, retry),
160
161 TP_FIELDS(
162 ctf_integer(int, vcpu_id, vcpu->vcpu_id)
163 ctf_integer(gpa_t, cr2_or_gpa, cr2_or_gpa)
164 ctf_integer(u32, error_code, error_code)
165 ctf_integer_hex(u64 *, sptep, sptep)
166 ctf_integer(u64, old_spte, old_spte)
167 ctf_integer(u64, new_spte, *sptep)
168 ctf_integer(bool, retry, retry)
169 )
170 )
171
172 #endif /* LTTNG_TRACE_KVM_MMU_H */
173
174 #undef TRACE_INCLUDE_PATH
175 #define TRACE_INCLUDE_PATH instrumentation/events/lttng-module/arch/x86/kvm
176 #undef TRACE_INCLUDE_FILE
177 #define TRACE_INCLUDE_FILE mmutrace
178
179 /* This part must be outside protection */
180 #include <lttng/define_trace.h>
This page took 0.032785 seconds and 4 git commands to generate.