2017-02-23 02:39:50 +03:00
|
|
|
#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,
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf,
|
|
|
|
pgoff_t max_pgoff, int result),
|
|
|
|
TP_ARGS(inode, vmf, max_pgoff, result),
|
2017-02-23 02:39:50 +03:00
|
|
|
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;
|
2017-02-23 02:40:06 +03:00
|
|
|
__entry->vm_start = vmf->vma->vm_start;
|
|
|
|
__entry->vm_end = vmf->vma->vm_end;
|
|
|
|
__entry->vm_flags = vmf->vma->vm_flags;
|
2017-02-23 02:40:03 +03:00
|
|
|
__entry->address = vmf->address;
|
|
|
|
__entry->flags = vmf->flags;
|
|
|
|
__entry->pgoff = vmf->pgoff;
|
2017-02-23 02:39:50 +03:00
|
|
|
__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, \
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
|
2017-02-23 02:39:50 +03:00
|
|
|
pgoff_t max_pgoff, int result), \
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_ARGS(inode, vmf, max_pgoff, result))
|
2017-02-23 02:39:50 +03:00
|
|
|
|
|
|
|
DEFINE_PMD_FAULT_EVENT(dax_pmd_fault);
|
|
|
|
DEFINE_PMD_FAULT_EVENT(dax_pmd_fault_done);
|
|
|
|
|
2017-02-23 02:39:57 +03:00
|
|
|
DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf,
|
|
|
|
struct page *zero_page,
|
2017-02-23 02:39:57 +03:00
|
|
|
void *radix_entry),
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_ARGS(inode, vmf, zero_page, radix_entry),
|
2017-02-23 02:39:57 +03:00
|
|
|
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;
|
2017-02-23 02:40:06 +03:00
|
|
|
__entry->vm_flags = vmf->vma->vm_flags;
|
|
|
|
__entry->address = vmf->address;
|
2017-02-23 02:39:57 +03:00
|
|
|
__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, \
|
2017-02-23 02:40:06 +03:00
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf, \
|
|
|
|
struct page *zero_page, void *radix_entry), \
|
|
|
|
TP_ARGS(inode, vmf, zero_page, radix_entry))
|
2017-02-23 02:39:57 +03:00
|
|
|
|
|
|
|
DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole);
|
|
|
|
DEFINE_PMD_LOAD_HOLE_EVENT(dax_pmd_load_hole_fallback);
|
2017-02-23 02:39:50 +03:00
|
|
|
|
2017-02-23 02:40:00 +03:00
|
|
|
DECLARE_EVENT_CLASS(dax_pmd_insert_mapping_class,
|
2017-02-23 02:40:06 +03:00
|
|
|
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),
|
2017-02-23 02:40:00 +03:00
|
|
|
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;
|
2017-02-23 02:40:06 +03:00
|
|
|
__entry->vm_flags = vmf->vma->vm_flags;
|
|
|
|
__entry->address = vmf->address;
|
|
|
|
__entry->write = vmf->flags & FAULT_FLAG_WRITE;
|
2017-02-23 02:40:00 +03:00
|
|
|
__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, \
|
2017-02-23 02:40:06 +03:00
|
|
|
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))
|
2017-02-23 02:40:00 +03:00
|
|
|
|
|
|
|
DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping);
|
|
|
|
DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);
|
|
|
|
|
dax: add tracepoints to dax_iomap_pte_fault()
Patch series "second round of tracepoints for DAX".
This second round of DAX tracepoint patches adds tracing to the PTE
fault path (dax_iomap_pte_fault(), dax_pfn_mkwrite(), dax_load_hole(),
dax_insert_mapping()) and to the writeback path
(dax_writeback_mapping_range(), dax_writeback_one()).
The purpose of this tracing is to give us a high level view of what DAX
is doing, whether faults are being serviced by PMDs or PTEs, and by real
storage or by zero pages covering holes.
I do have some patches nearly ready which also add tracing to
grab_mapping_entry() and dax_insert_mapping_entry(). These are more
targeted at logging how we are interacting with the radix tree, how we
use empty entries for locking, whether we "downgrade" huge zero pages to
4k PTE sized allocations, etc. In the end it seemed to me that this
might be too detailed to have as constantly present tracepoints, but if
anyone sees value in having tracepoints like this in the DAX code
permanently (Jan?), please let me know and I'll add those last two
patches.
All these tracepoints were done to be consistent with the style of the
XFS tracepoints and with the existing DAX PMD tracepoints.
This patch (of 6):
Add tracepoints to dax_iomap_pte_fault(), following the same logging
conventions as the rest of DAX.
Here is an example fault that initially tries to be serviced by the PMD
fault handler but which falls back to PTEs because the VMA isn't large
enough to hold a PMD:
small-1086 [005] ....
71.140014: xfs_filemap_huge_fault: dev 259:0 ino 0x1003
small-1086 [005] ....
71.140027: dax_pmd_fault: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 vm_start 0x10200000 vm_end 0x10500000 pgoff 0x220 max_pgoff 0x1400
small-1086 [005] ....
71.140028: dax_pmd_fault_done: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 vm_start 0x10200000 vm_end 0x10500000 pgoff 0x220 max_pgoff 0x1400 FALLBACK
small-1086 [005] ....
71.140035: dax_pte_fault: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff 0x220
small-1086 [005] ....
71.140396: dax_pte_fault_done: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff 0x220 MAJOR|NOPAGE
Link: http://lkml.kernel.org/r/20170221195116.13278-2-ross.zwisler@linux.intel.com
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-05-09 02:00:00 +03:00
|
|
|
DECLARE_EVENT_CLASS(dax_pte_fault_class,
|
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result),
|
|
|
|
TP_ARGS(inode, vmf, result),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned long, ino)
|
|
|
|
__field(unsigned long, vm_flags)
|
|
|
|
__field(unsigned long, address)
|
|
|
|
__field(pgoff_t, 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_flags = vmf->vma->vm_flags;
|
|
|
|
__entry->address = vmf->address;
|
|
|
|
__entry->flags = vmf->flags;
|
|
|
|
__entry->pgoff = vmf->pgoff;
|
|
|
|
__entry->result = result;
|
|
|
|
),
|
|
|
|
TP_printk("dev %d:%d ino %#lx %s %s address %#lx 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->pgoff,
|
|
|
|
__print_flags(__entry->result, "|", VM_FAULT_RESULT_TRACE)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
#define DEFINE_PTE_FAULT_EVENT(name) \
|
|
|
|
DEFINE_EVENT(dax_pte_fault_class, name, \
|
|
|
|
TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), \
|
|
|
|
TP_ARGS(inode, vmf, result))
|
|
|
|
|
|
|
|
DEFINE_PTE_FAULT_EVENT(dax_pte_fault);
|
|
|
|
DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);
|
2017-05-09 02:00:03 +03:00
|
|
|
DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite_no_entry);
|
|
|
|
DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite);
|
2017-05-09 02:00:07 +03:00
|
|
|
DEFINE_PTE_FAULT_EVENT(dax_load_hole);
|
dax: add tracepoints to dax_iomap_pte_fault()
Patch series "second round of tracepoints for DAX".
This second round of DAX tracepoint patches adds tracing to the PTE
fault path (dax_iomap_pte_fault(), dax_pfn_mkwrite(), dax_load_hole(),
dax_insert_mapping()) and to the writeback path
(dax_writeback_mapping_range(), dax_writeback_one()).
The purpose of this tracing is to give us a high level view of what DAX
is doing, whether faults are being serviced by PMDs or PTEs, and by real
storage or by zero pages covering holes.
I do have some patches nearly ready which also add tracing to
grab_mapping_entry() and dax_insert_mapping_entry(). These are more
targeted at logging how we are interacting with the radix tree, how we
use empty entries for locking, whether we "downgrade" huge zero pages to
4k PTE sized allocations, etc. In the end it seemed to me that this
might be too detailed to have as constantly present tracepoints, but if
anyone sees value in having tracepoints like this in the DAX code
permanently (Jan?), please let me know and I'll add those last two
patches.
All these tracepoints were done to be consistent with the style of the
XFS tracepoints and with the existing DAX PMD tracepoints.
This patch (of 6):
Add tracepoints to dax_iomap_pte_fault(), following the same logging
conventions as the rest of DAX.
Here is an example fault that initially tries to be serviced by the PMD
fault handler but which falls back to PTEs because the VMA isn't large
enough to hold a PMD:
small-1086 [005] ....
71.140014: xfs_filemap_huge_fault: dev 259:0 ino 0x1003
small-1086 [005] ....
71.140027: dax_pmd_fault: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 vm_start 0x10200000 vm_end 0x10500000 pgoff 0x220 max_pgoff 0x1400
small-1086 [005] ....
71.140028: dax_pmd_fault_done: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 vm_start 0x10200000 vm_end 0x10500000 pgoff 0x220 max_pgoff 0x1400 FALLBACK
small-1086 [005] ....
71.140035: dax_pte_fault: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff 0x220
small-1086 [005] ....
71.140396: dax_pte_fault_done: dev 259:0 ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff 0x220 MAJOR|NOPAGE
Link: http://lkml.kernel.org/r/20170221195116.13278-2-ross.zwisler@linux.intel.com
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-05-09 02:00:00 +03:00
|
|
|
|
2017-05-09 02:00:10 +03:00
|
|
|
DECLARE_EVENT_CLASS(dax_writeback_range_class,
|
|
|
|
TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),
|
|
|
|
TP_ARGS(inode, start_index, end_index),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned long, ino)
|
|
|
|
__field(pgoff_t, start_index)
|
|
|
|
__field(pgoff_t, end_index)
|
|
|
|
__field(dev_t, dev)
|
|
|
|
),
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->dev = inode->i_sb->s_dev;
|
|
|
|
__entry->ino = inode->i_ino;
|
|
|
|
__entry->start_index = start_index;
|
|
|
|
__entry->end_index = end_index;
|
|
|
|
),
|
|
|
|
TP_printk("dev %d:%d ino %#lx pgoff %#lx-%#lx",
|
|
|
|
MAJOR(__entry->dev),
|
|
|
|
MINOR(__entry->dev),
|
|
|
|
__entry->ino,
|
|
|
|
__entry->start_index,
|
|
|
|
__entry->end_index
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
#define DEFINE_WRITEBACK_RANGE_EVENT(name) \
|
|
|
|
DEFINE_EVENT(dax_writeback_range_class, name, \
|
|
|
|
TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),\
|
|
|
|
TP_ARGS(inode, start_index, end_index))
|
|
|
|
|
|
|
|
DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range);
|
|
|
|
DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range_done);
|
|
|
|
|
2017-02-23 02:39:50 +03:00
|
|
|
#endif /* _TRACE_FS_DAX_H */
|
|
|
|
|
|
|
|
/* This part must be outside protection */
|
|
|
|
#include <trace/define_trace.h>
|