xref: /openbmc/linux/include/trace/events/fs_dax.h (revision 6aa7de05)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM fs_dax
3 
4 #if !defined(_TRACE_FS_DAX_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_FS_DAX_H
6 
7 #include <linux/tracepoint.h>
8 
9 DECLARE_EVENT_CLASS(dax_pmd_fault_class,
10 	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
11 		pgoff_t max_pgoff, int result),
12 	TP_ARGS(inode, vmf, max_pgoff, result),
13 	TP_STRUCT__entry(
14 		__field(unsigned long, ino)
15 		__field(unsigned long, vm_start)
16 		__field(unsigned long, vm_end)
17 		__field(unsigned long, vm_flags)
18 		__field(unsigned long, address)
19 		__field(pgoff_t, pgoff)
20 		__field(pgoff_t, max_pgoff)
21 		__field(dev_t, dev)
22 		__field(unsigned int, flags)
23 		__field(int, result)
24 	),
25 	TP_fast_assign(
26 		__entry->dev = inode->i_sb->s_dev;
27 		__entry->ino = inode->i_ino;
28 		__entry->vm_start = vmf->vma->vm_start;
29 		__entry->vm_end = vmf->vma->vm_end;
30 		__entry->vm_flags = vmf->vma->vm_flags;
31 		__entry->address = vmf->address;
32 		__entry->flags = vmf->flags;
33 		__entry->pgoff = vmf->pgoff;
34 		__entry->max_pgoff = max_pgoff;
35 		__entry->result = result;
36 	),
37 	TP_printk("dev %d:%d ino %#lx %s %s address %#lx vm_start "
38 			"%#lx vm_end %#lx pgoff %#lx max_pgoff %#lx %s",
39 		MAJOR(__entry->dev),
40 		MINOR(__entry->dev),
41 		__entry->ino,
42 		__entry->vm_flags & VM_SHARED ? "shared" : "private",
43 		__print_flags(__entry->flags, "|", FAULT_FLAG_TRACE),
44 		__entry->address,
45 		__entry->vm_start,
46 		__entry->vm_end,
47 		__entry->pgoff,
48 		__entry->max_pgoff,
49 		__print_flags(__entry->result, "|", VM_FAULT_RESULT_TRACE)
50 	)
51 )
52 
53 #define DEFINE_PMD_FAULT_EVENT(name) \
54 DEFINE_EVENT(dax_pmd_fault_class, name, \
55 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
56 		pgoff_t max_pgoff, int result), \
57 	TP_ARGS(inode, vmf, max_pgoff, result))
58 
59 DEFINE_PMD_FAULT_EVENT(dax_pmd_fault);
60 DEFINE_PMD_FAULT_EVENT(dax_pmd_fault_done);
61 
62 DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
63 	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
64 		struct page *zero_page,
65 		void *radix_entry),
66 	TP_ARGS(inode, vmf, zero_page, radix_entry),
67 	TP_STRUCT__entry(
68 		__field(unsigned long, ino)
69 		__field(unsigned long, vm_flags)
70 		__field(unsigned long, address)
71 		__field(struct page *, zero_page)
72 		__field(void *, radix_entry)
73 		__field(dev_t, dev)
74 	),
75 	TP_fast_assign(
76 		__entry->dev = inode->i_sb->s_dev;
77 		__entry->ino = inode->i_ino;
78 		__entry->vm_flags = vmf->vma->vm_flags;
79 		__entry->address = vmf->address;
80 		__entry->zero_page = zero_page;
81 		__entry->radix_entry = radix_entry;
82 	),
83 	TP_printk("dev %d:%d ino %#lx %s address %#lx zero_page %p "
84 			"radix_entry %#lx",
85 		MAJOR(__entry->dev),
86 		MINOR(__entry->dev),
87 		__entry->ino,
88 		__entry->vm_flags & VM_SHARED ? "shared" : "private",
89 		__entry->address,
90 		__entry->zero_page,
91 		(unsigned long)__entry->radix_entry
92 	)
93 )
94 
95 #define DEFINE_PMD_LOAD_HOLE_EVENT(name) \
96 DEFINE_EVENT(dax_pmd_load_hole_class, name, \
97 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
98 		struct page *zero_page, void *radix_entry), \
99 	TP_ARGS(inode, vmf, zero_page, radix_entry))
100 
101 DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole);
102 DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback);
103 
104 DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
105 	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
106 		long length, pfn_t pfn, void *radix_entry),
107 	TP_ARGS(inode, vmf, length, pfn, radix_entry),
108 	TP_STRUCT__entry(
109 		__field(unsigned long, ino)
110 		__field(unsigned long, vm_flags)
111 		__field(unsigned long, address)
112 		__field(long, length)
113 		__field(u64, pfn_val)
114 		__field(void *, radix_entry)
115 		__field(dev_t, dev)
116 		__field(int, write)
117 	),
118 	TP_fast_assign(
119 		__entry->dev = inode->i_sb->s_dev;
120 		__entry->ino = inode->i_ino;
121 		__entry->vm_flags = vmf->vma->vm_flags;
122 		__entry->address = vmf->address;
123 		__entry->write = vmf->flags & FAULT_FLAG_WRITE;
124 		__entry->length = length;
125 		__entry->pfn_val = pfn.val;
126 		__entry->radix_entry = radix_entry;
127 	),
128 	TP_printk("dev %d:%d ino %#lx %s %s address %#lx length %#lx "
129 			"pfn %#llx %s radix_entry %#lx",
130 		MAJOR(__entry->dev),
131 		MINOR(__entry->dev),
132 		__entry->ino,
133 		__entry->vm_flags & VM_SHARED ? "shared" : "private",
134 		__entry->write ? "write" : "read",
135 		__entry->address,
136 		__entry->length,
137 		__entry->pfn_val & ~PFN_FLAGS_MASK,
138 		__print_flags_u64(__entry->pfn_val & PFN_FLAGS_MASK, "|",
139 			PFN_FLAGS_TRACE),
140 		(unsigned long)__entry->radix_entry
141 	)
142 )
143 
144 #define DEFINE_PMD_INSERT_MAPPING_EVENT(name) \
145 DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \
146 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
147 		long length, pfn_t pfn, void *radix_entry), \
148 	TP_ARGS(inode, vmf, length, pfn, radix_entry))
149 
150 DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping);
151 DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);
152 
153 DECLARE_EVENT_CLASS(dax_pte_fault_class,
154 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result),
155 	TP_ARGS(inode, vmf, result),
156 	TP_STRUCT__entry(
157 		__field(unsigned long, ino)
158 		__field(unsigned long, vm_flags)
159 		__field(unsigned long, address)
160 		__field(pgoff_t, pgoff)
161 		__field(dev_t, dev)
162 		__field(unsigned int, flags)
163 		__field(int, result)
164 	),
165 	TP_fast_assign(
166 		__entry->dev = inode->i_sb->s_dev;
167 		__entry->ino = inode->i_ino;
168 		__entry->vm_flags = vmf->vma->vm_flags;
169 		__entry->address = vmf->address;
170 		__entry->flags = vmf->flags;
171 		__entry->pgoff = vmf->pgoff;
172 		__entry->result = result;
173 	),
174 	TP_printk("dev %d:%d ino %#lx %s %s address %#lx pgoff %#lx %s",
175 		MAJOR(__entry->dev),
176 		MINOR(__entry->dev),
177 		__entry->ino,
178 		__entry->vm_flags & VM_SHARED ? "shared" : "private",
179 		__print_flags(__entry->flags, "|", FAULT_FLAG_TRACE),
180 		__entry->address,
181 		__entry->pgoff,
182 		__print_flags(__entry->result, "|", VM_FAULT_RESULT_TRACE)
183 	)
184 )
185 
186 #define DEFINE_PTE_FAULT_EVENT(name) \
187 DEFINE_EVENT(dax_pte_fault_class, name, \
188 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), \
189 	TP_ARGS(inode, vmf, result))
190 
191 DEFINE_PTE_FAULT_EVENT(dax_pte_fault);
192 DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);
193 DEFINE_PTE_FAULT_EVENT(dax_load_hole);
194 
195 TRACE_EVENT(dax_insert_mapping,
196 	TP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry),
197 	TP_ARGS(inode, vmf, radix_entry),
198 	TP_STRUCT__entry(
199 		__field(unsigned long, ino)
200 		__field(unsigned long, vm_flags)
201 		__field(unsigned long, address)
202 		__field(void *, radix_entry)
203 		__field(dev_t, dev)
204 		__field(int, write)
205 	),
206 	TP_fast_assign(
207 		__entry->dev = inode->i_sb->s_dev;
208 		__entry->ino = inode->i_ino;
209 		__entry->vm_flags = vmf->vma->vm_flags;
210 		__entry->address = vmf->address;
211 		__entry->write = vmf->flags & FAULT_FLAG_WRITE;
212 		__entry->radix_entry = radix_entry;
213 	),
214 	TP_printk("dev %d:%d ino %#lx %s %s address %#lx radix_entry %#lx",
215 		MAJOR(__entry->dev),
216 		MINOR(__entry->dev),
217 		__entry->ino,
218 		__entry->vm_flags & VM_SHARED ? "shared" : "private",
219 		__entry->write ? "write" : "read",
220 		__entry->address,
221 		(unsigned long)__entry->radix_entry
222 	)
223 )
224 
225 DECLARE_EVENT_CLASS(dax_writeback_range_class,
226 	TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),
227 	TP_ARGS(inode, start_index, end_index),
228 	TP_STRUCT__entry(
229 		__field(unsigned long, ino)
230 		__field(pgoff_t, start_index)
231 		__field(pgoff_t, end_index)
232 		__field(dev_t, dev)
233 	),
234 	TP_fast_assign(
235 		__entry->dev = inode->i_sb->s_dev;
236 		__entry->ino = inode->i_ino;
237 		__entry->start_index = start_index;
238 		__entry->end_index = end_index;
239 	),
240 	TP_printk("dev %d:%d ino %#lx pgoff %#lx-%#lx",
241 		MAJOR(__entry->dev),
242 		MINOR(__entry->dev),
243 		__entry->ino,
244 		__entry->start_index,
245 		__entry->end_index
246 	)
247 )
248 
249 #define DEFINE_WRITEBACK_RANGE_EVENT(name) \
250 DEFINE_EVENT(dax_writeback_range_class, name, \
251 	TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),\
252 	TP_ARGS(inode, start_index, end_index))
253 
254 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range);
255 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range_done);
256 
257 TRACE_EVENT(dax_writeback_one,
258 	TP_PROTO(struct inode *inode, pgoff_t pgoff, pgoff_t pglen),
259 	TP_ARGS(inode, pgoff, pglen),
260 	TP_STRUCT__entry(
261 		__field(unsigned long, ino)
262 		__field(pgoff_t, pgoff)
263 		__field(pgoff_t, pglen)
264 		__field(dev_t, dev)
265 	),
266 	TP_fast_assign(
267 		__entry->dev = inode->i_sb->s_dev;
268 		__entry->ino = inode->i_ino;
269 		__entry->pgoff = pgoff;
270 		__entry->pglen = pglen;
271 	),
272 	TP_printk("dev %d:%d ino %#lx pgoff %#lx pglen %#lx",
273 		MAJOR(__entry->dev),
274 		MINOR(__entry->dev),
275 		__entry->ino,
276 		__entry->pgoff,
277 		__entry->pglen
278 	)
279 )
280 
281 #endif /* _TRACE_FS_DAX_H */
282 
283 /* This part must be outside protection */
284 #include <trace/define_trace.h>
285