summaryrefslogtreecommitdiff
path: root/include/trace/events/fs_dax.h
blob: c566ddc87f73e5885841204d5ae7d160374545a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#undef TRACE_SYSTEM
#define TRACE_SYSTEM fs_dax

#if !defined(_TRACE_FS_DAX_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_FS_DAX_H

#include <linux/tracepoint.h>

DECLARE_EVENT_CLASS(dax_pmd_fault_class,
	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
		pgoff_t max_pgoff, int result),
	TP_ARGS(inode, vmf, max_pgoff, result),
	TP_STRUCT__entry(
		__field(unsigned long, ino)
		__field(unsigned long, vm_start)
		__field(unsigned long, vm_end)
		__field(unsigned long, vm_flags)
		__field(unsigned long, address)
		__field(pgoff_t, pgoff)
		__field(pgoff_t, max_pgoff)
		__field(dev_t, dev)
		__field(unsigned int, flags)
		__field(int, result)
	),
	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->vm_start = vmf->vma->vm_start;
		__entry->vm_end = vmf->vma->vm_end;
		__entry->vm_flags = vmf->vma->vm_flags;
		__entry->address = vmf->address;
		__entry->flags = vmf->flags;
		__entry->pgoff = vmf->pgoff;
		__entry->max_pgoff = max_pgoff;
		__entry->result = result;
	),
	TP_printk("dev %d:%d ino %#lx %s %s address %#lx vm_start "
			"%#lx vm_end %#lx pgoff %#lx max_pgoff %#lx %s",
		MAJOR(__entry->dev),
		MINOR(__entry->dev),
		__entry->ino,
		__entry->vm_flags & VM_SHARED ? "shared" : "private",
		__print_flags(__entry->flags, "|", FAULT_FLAG_TRACE),
		__entry->address,
		__entry->vm_start,
		__entry->vm_end,
		__entry->pgoff,
		__entry->max_pgoff,
		__print_flags(__entry->result, "|", VM_FAULT_RESULT_TRACE)
	)
)

#define DEFINE_PMD_FAULT_EVENT(name) \
DEFINE_EVENT(dax_pmd_fault_class, name, \
	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
		pgoff_t max_pgoff, int result), \
	TP_ARGS(inode, vmf, max_pgoff, result))

DEFINE_PMD_FAULT_EVENT(dax_pmd_fault);
DEFINE_PMD_FAULT_EVENT(dax_pmd_fault_done);

DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
		struct page *zero_page,
		void *radix_entry),
	TP_ARGS(inode, vmf, zero_page, radix_entry),
	TP_STRUCT__entry(
		__field(unsigned long, ino)
		__field(unsigned long, vm_flags)
		__field(unsigned long, address)
		__field(struct page *, zero_page)
		__field(void *, radix_entry)
		__field(dev_t, dev)
	),
	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->vm_flags = vmf->vma->vm_flags;
		__entry->address = vmf->address;
		__entry->zero_page = zero_page;
		__entry->radix_entry = radix_entry;
	),
	TP_printk("dev %d:%d ino %#lx %s address %#lx zero_page %p "
			"radix_entry %#lx",
		MAJOR(__entry->dev),
		MINOR(__entry->dev),
		__entry->ino,
		__entry->vm_flags & VM_SHARED ? "shared" : "private",
		__entry->address,
		__entry->zero_page,
		(unsigned long)__entry->radix_entry
	)
)

#define DEFINE_PMD_LOAD_HOLE_EVENT(name) \
DEFINE_EVENT(dax_pmd_load_hole_class, name, \
	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
		struct page *zero_page, void *radix_entry), \
	TP_ARGS(inode, vmf, zero_page, radix_entry))

DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole);
DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback);

DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
	TP_PROTO(struct inode *inode, struct vm_fault *vmf,
		long length, pfn_t pfn, void *radix_entry),
	TP_ARGS(inode, vmf, length, pfn, radix_entry),
	TP_STRUCT__entry(
		__field(unsigned long, ino)
		__field(unsigned long, vm_flags)
		__field(unsigned long, address)
		__field(long, length)
		__field(u64, pfn_val)
		__field(void *, radix_entry)
		__field(dev_t, dev)
		__field(int, write)
	),
	TP_fast_assign(
		__entry->dev = inode->i_sb->s_dev;
		__entry->ino = inode->i_ino;
		__entry->vm_flags = vmf->vma->vm_flags;
		__entry->address = vmf->address;
		__entry->write = vmf->flags & FAULT_FLAG_WRITE;
		__entry->length = length;
		__entry->pfn_val = pfn.val;
		__entry->radix_entry = radix_entry;
	),
	TP_printk("dev %d:%d ino %#lx %s %s address %#lx length %#lx "
			"pfn %#llx %s radix_entry %#lx",
		MAJOR(__entry->dev),
		MINOR(__entry->dev),
		__entry->ino,
		__entry->vm_flags & VM_SHARED ? "shared" : "private",
		__entry->write ? "write" : "read",
		__entry->address,
		__entry->length,
		__entry->pfn_val & ~PFN_FLAGS_MASK,
		__print_flags_u64(__entry->pfn_val & PFN_FLAGS_MASK, "|",
			PFN_FLAGS_TRACE),
		(unsigned long)__entry->radix_entry
	)
)

#define DEFINE_PMD_INSERT_MAPPING_EVENT(name) \
DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \
	TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
		long length, pfn_t pfn, void *radix_entry), \
	TP_ARGS(inode, vmf, length, pfn, radix_entry))

DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping);
DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);

#endif /* _TRACE_FS_DAX_H */

/* This part must be outside protection */
#include <trace/define_trace.h>