1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM fs_dax
5 #if !defined(_TRACE_FS_DAX_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_FS_DAX_H
8 #include <linux/tracepoint.h>
10 DECLARE_EVENT_CLASS(dax_pmd_fault_class
,
11 TP_PROTO(struct inode
*inode
, struct vm_fault
*vmf
,
12 pgoff_t max_pgoff
, int result
),
13 TP_ARGS(inode
, vmf
, max_pgoff
, result
),
15 __field(unsigned long, ino
)
16 __field(unsigned long, vm_start
)
17 __field(unsigned long, vm_end
)
18 __field(unsigned long, vm_flags
)
19 __field(unsigned long, address
)
20 __field(pgoff_t
, pgoff
)
21 __field(pgoff_t
, max_pgoff
)
23 __field(unsigned int, flags
)
27 __entry
->dev
= inode
->i_sb
->s_dev
;
28 __entry
->ino
= inode
->i_ino
;
29 __entry
->vm_start
= vmf
->vma
->vm_start
;
30 __entry
->vm_end
= vmf
->vma
->vm_end
;
31 __entry
->vm_flags
= vmf
->vma
->vm_flags
;
32 __entry
->address
= vmf
->address
;
33 __entry
->flags
= vmf
->flags
;
34 __entry
->pgoff
= vmf
->pgoff
;
35 __entry
->max_pgoff
= max_pgoff
;
36 __entry
->result
= result
;
38 TP_printk("dev %d:%d ino %#lx %s %s address %#lx vm_start "
39 "%#lx vm_end %#lx pgoff %#lx max_pgoff %#lx %s",
43 __entry
->vm_flags
& VM_SHARED
? "shared" : "private",
44 __print_flags(__entry
->flags
, "|", FAULT_FLAG_TRACE
),
50 __print_flags(__entry
->result
, "|", VM_FAULT_RESULT_TRACE
)
54 #define DEFINE_PMD_FAULT_EVENT(name) \
55 DEFINE_EVENT(dax_pmd_fault_class, name, \
56 TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
57 pgoff_t max_pgoff, int result), \
58 TP_ARGS(inode, vmf, max_pgoff, result))
60 DEFINE_PMD_FAULT_EVENT(dax_pmd_fault
);
61 DEFINE_PMD_FAULT_EVENT(dax_pmd_fault_done
);
63 DECLARE_EVENT_CLASS(dax_pmd_load_hole_class
,
64 TP_PROTO(struct inode
*inode
, struct vm_fault
*vmf
,
65 struct page
*zero_page
,
67 TP_ARGS(inode
, vmf
, zero_page
, radix_entry
),
69 __field(unsigned long, ino
)
70 __field(unsigned long, vm_flags
)
71 __field(unsigned long, address
)
72 __field(struct page
*, zero_page
)
73 __field(void *, radix_entry
)
77 __entry
->dev
= inode
->i_sb
->s_dev
;
78 __entry
->ino
= inode
->i_ino
;
79 __entry
->vm_flags
= vmf
->vma
->vm_flags
;
80 __entry
->address
= vmf
->address
;
81 __entry
->zero_page
= zero_page
;
82 __entry
->radix_entry
= radix_entry
;
84 TP_printk("dev %d:%d ino %#lx %s address %#lx zero_page %p "
89 __entry
->vm_flags
& VM_SHARED
? "shared" : "private",
92 (unsigned long)__entry
->radix_entry
96 #define DEFINE_PMD_LOAD_HOLE_EVENT(name) \
97 DEFINE_EVENT(dax_pmd_load_hole_class, name, \
98 TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
99 struct page *zero_page, void *radix_entry), \
100 TP_ARGS(inode, vmf, zero_page, radix_entry))
102 DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole
);
103 DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback
);
105 DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class
,
106 TP_PROTO(struct inode
*inode
, struct vm_fault
*vmf
,
107 long length
, pfn_t pfn
, void *radix_entry
),
108 TP_ARGS(inode
, vmf
, length
, pfn
, radix_entry
),
110 __field(unsigned long, ino
)
111 __field(unsigned long, vm_flags
)
112 __field(unsigned long, address
)
113 __field(long, length
)
114 __field(u64
, pfn_val
)
115 __field(void *, radix_entry
)
120 __entry
->dev
= inode
->i_sb
->s_dev
;
121 __entry
->ino
= inode
->i_ino
;
122 __entry
->vm_flags
= vmf
->vma
->vm_flags
;
123 __entry
->address
= vmf
->address
;
124 __entry
->write
= vmf
->flags
& FAULT_FLAG_WRITE
;
125 __entry
->length
= length
;
126 __entry
->pfn_val
= pfn
.val
;
127 __entry
->radix_entry
= radix_entry
;
129 TP_printk("dev %d:%d ino %#lx %s %s address %#lx length %#lx "
130 "pfn %#llx %s radix_entry %#lx",
134 __entry
->vm_flags
& VM_SHARED
? "shared" : "private",
135 __entry
->write
? "write" : "read",
138 __entry
->pfn_val
& ~PFN_FLAGS_MASK
,
139 __print_flags_u64(__entry
->pfn_val
& PFN_FLAGS_MASK
, "|",
141 (unsigned long)__entry
->radix_entry
145 #define DEFINE_PMD_INSERT_MAPPING_EVENT(name) \
146 DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \
147 TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
148 long length, pfn_t pfn, void *radix_entry), \
149 TP_ARGS(inode, vmf, length, pfn, radix_entry))
151 DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping
);
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
),
157 __field(unsigned long, ino
)
158 __field(unsigned long, vm_flags
)
159 __field(unsigned long, address
)
160 __field(pgoff_t
, pgoff
)
162 __field(unsigned int, flags
)
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
;
174 TP_printk("dev %d:%d ino %#lx %s %s address %#lx pgoff %#lx %s",
178 __entry
->vm_flags
& VM_SHARED
? "shared" : "private",
179 __print_flags(__entry
->flags
, "|", FAULT_FLAG_TRACE
),
182 __print_flags(__entry
->result
, "|", VM_FAULT_RESULT_TRACE
)
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))
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 DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite_no_entry
);
195 DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite
);
197 TRACE_EVENT(dax_insert_mapping
,
198 TP_PROTO(struct inode
*inode
, struct vm_fault
*vmf
, void *radix_entry
),
199 TP_ARGS(inode
, vmf
, radix_entry
),
201 __field(unsigned long, ino
)
202 __field(unsigned long, vm_flags
)
203 __field(unsigned long, address
)
204 __field(void *, radix_entry
)
209 __entry
->dev
= inode
->i_sb
->s_dev
;
210 __entry
->ino
= inode
->i_ino
;
211 __entry
->vm_flags
= vmf
->vma
->vm_flags
;
212 __entry
->address
= vmf
->address
;
213 __entry
->write
= vmf
->flags
& FAULT_FLAG_WRITE
;
214 __entry
->radix_entry
= radix_entry
;
216 TP_printk("dev %d:%d ino %#lx %s %s address %#lx radix_entry %#lx",
220 __entry
->vm_flags
& VM_SHARED
? "shared" : "private",
221 __entry
->write
? "write" : "read",
223 (unsigned long)__entry
->radix_entry
227 DECLARE_EVENT_CLASS(dax_writeback_range_class
,
228 TP_PROTO(struct inode
*inode
, pgoff_t start_index
, pgoff_t end_index
),
229 TP_ARGS(inode
, start_index
, end_index
),
231 __field(unsigned long, ino
)
232 __field(pgoff_t
, start_index
)
233 __field(pgoff_t
, end_index
)
237 __entry
->dev
= inode
->i_sb
->s_dev
;
238 __entry
->ino
= inode
->i_ino
;
239 __entry
->start_index
= start_index
;
240 __entry
->end_index
= end_index
;
242 TP_printk("dev %d:%d ino %#lx pgoff %#lx-%#lx",
246 __entry
->start_index
,
251 #define DEFINE_WRITEBACK_RANGE_EVENT(name) \
252 DEFINE_EVENT(dax_writeback_range_class, name, \
253 TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),\
254 TP_ARGS(inode, start_index, end_index))
256 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range
);
257 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range_done
);
259 TRACE_EVENT(dax_writeback_one
,
260 TP_PROTO(struct inode
*inode
, pgoff_t pgoff
, pgoff_t pglen
),
261 TP_ARGS(inode
, pgoff
, pglen
),
263 __field(unsigned long, ino
)
264 __field(pgoff_t
, pgoff
)
265 __field(pgoff_t
, pglen
)
269 __entry
->dev
= inode
->i_sb
->s_dev
;
270 __entry
->ino
= inode
->i_ino
;
271 __entry
->pgoff
= pgoff
;
272 __entry
->pglen
= pglen
;
274 TP_printk("dev %d:%d ino %#lx pgoff %#lx pglen %#lx",
283 #endif /* _TRACE_FS_DAX_H */
285 /* This part must be outside protection */
286 #include <trace/define_trace.h>