fs_dax.h 8.3 KB

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