linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] second round of tracepoints for DAX
@ 2017-02-21 19:51 Ross Zwisler
  2017-02-21 19:51 ` [PATCH 1/6] dax: add tracepoints to dax_iomap_pte_fault() Ross Zwisler
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Ross Zwisler, Jan Kara, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

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 series applies cleanly to the current mmots/master:

commit 35aa45ffe8d9 ("pci: test for unexpectedly disabled bridges")

and I'm hoping that it'll end up going to Linus through akpm's -mm tree.

Thanks,
- Ross

Ross Zwisler (6):
  dax: add tracepoints to dax_iomap_pte_fault()
  dax: add tracepoints to dax_pfn_mkwrite()
  dax: add tracepoints to dax_load_hole()
  dax: add tracepoints to dax_writeback_mapping_range()
  dax: add tracepoint to dax_writeback_one()
  dax: add tracepoint to dax_insert_mapping()

 fs/dax.c                      |  44 ++++++++++----
 include/trace/events/fs_dax.h | 130 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+), 11 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] dax: add tracepoints to dax_iomap_pte_fault()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-21 19:51 ` [PATCH 2/6] dax: add tracepoints to dax_pfn_mkwrite() Ross Zwisler
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Ross Zwisler, Jan Kara, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

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

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      | 15 +++++++++++----
 include/trace/events/fs_dax.h | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 8cf4f41..bf70d4d 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1132,13 +1132,16 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
 	int vmf_ret = 0;
 	void *entry;
 
+	trace_dax_pte_fault(inode, vmf, vmf_ret);
 	/*
 	 * Check whether offset isn't beyond end of file now. Caller is supposed
 	 * to hold locks serializing us with truncate / punch hole so this is
 	 * a reliable test.
 	 */
-	if (pos >= i_size_read(inode))
-		return VM_FAULT_SIGBUS;
+	if (pos >= i_size_read(inode)) {
+		vmf_ret = VM_FAULT_SIGBUS;
+		goto out;
+	}
 
 	if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page)
 		flags |= IOMAP_WRITE;
@@ -1149,8 +1152,10 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
 	 * that we never have to deal with more than a single extent here.
 	 */
 	error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap);
-	if (error)
-		return dax_fault_return(error);
+	if (error) {
+		vmf_ret = dax_fault_return(error);
+		goto out;
+	}
 	if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) {
 		vmf_ret = dax_fault_return(-EIO);	/* fs corruption? */
 		goto finish_iomap;
@@ -1234,6 +1239,8 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
 		 */
 		ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap);
 	}
+out:
+	trace_dax_pte_fault_done(inode, vmf, vmf_ret);
 	return vmf_ret;
 }
 
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index c566ddc..cbcd7d6 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -150,6 +150,47 @@ DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \
 DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping);
 DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);
 
+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);
+
 #endif /* _TRACE_FS_DAX_H */
 
 /* This part must be outside protection */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] dax: add tracepoints to dax_pfn_mkwrite()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
  2017-02-21 19:51 ` [PATCH 1/6] dax: add tracepoints to dax_iomap_pte_fault() Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-21 19:51 ` [PATCH 3/6] dax: add tracepoints to dax_load_hole() Ross Zwisler
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Ross Zwisler, Alexander Viro, Dan Williams, Ingo Molnar,
	Matthew Wilcox, Steven Rostedt, linux-fsdevel, linux-nvdimm,
	Jan Kara

Add tracepoints to dax_pfn_mkwrite(), following the same logging
conventions as the rest of DAX.

Here is an example PTE fault followed by a pfn_mkwrite:

small_aligned-1094  [002] ....   374.084998: dax_pte_fault: dev 259:0 ino
0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10400000 pgoff
0x200

small_aligned-1094  [002] ....   374.085145: dax_pte_fault_done: dev 259:0
ino 0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10400000 pgoff
0x200 MAJOR|NOPAGE

small_aligned-1094  [002] ....   374.085165: dax_pfn_mkwrite: dev 259:0 ino
0x1003 shared WRITE|MKWRITE|ALLOW_RETRY|KILLABLE|USER address 0x10400000
pgoff 0x200 NOPAGE

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      | 3 +++
 include/trace/events/fs_dax.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/fs/dax.c b/fs/dax.c
index bf70d4d..b52732fb 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -931,6 +931,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
 {
 	struct file *file = vmf->vma->vm_file;
 	struct address_space *mapping = file->f_mapping;
+	struct inode *inode = mapping->host;
 	void *entry, **slot;
 	pgoff_t index = vmf->pgoff;
 
@@ -940,6 +941,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
 		if (entry)
 			put_unlocked_mapping_entry(mapping, index, entry);
 		spin_unlock_irq(&mapping->tree_lock);
+		trace_dax_pfn_mkwrite_no_entry(inode, vmf, VM_FAULT_NOPAGE);
 		return VM_FAULT_NOPAGE;
 	}
 	radix_tree_tag_set(&mapping->page_tree, index, PAGECACHE_TAG_DIRTY);
@@ -952,6 +954,7 @@ int dax_pfn_mkwrite(struct vm_fault *vmf)
 	 */
 	finish_mkwrite_fault(vmf);
 	put_locked_mapping_entry(mapping, index, entry);
+	trace_dax_pfn_mkwrite(inode, vmf, VM_FAULT_NOPAGE);
 	return VM_FAULT_NOPAGE;
 }
 EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index cbcd7d6..b5a5209 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -190,6 +190,8 @@ DEFINE_EVENT(dax_pte_fault_class, name, \
 
 DEFINE_PTE_FAULT_EVENT(dax_pte_fault);
 DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);
+DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite_no_entry);
+DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite);
 
 #endif /* _TRACE_FS_DAX_H */
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] dax: add tracepoints to dax_load_hole()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
  2017-02-21 19:51 ` [PATCH 1/6] dax: add tracepoints to dax_iomap_pte_fault() Ross Zwisler
  2017-02-21 19:51 ` [PATCH 2/6] dax: add tracepoints to dax_pfn_mkwrite() Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-21 19:51 ` [PATCH 4/6] dax: add tracepoints to dax_writeback_mapping_range() Ross Zwisler
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Jan Kara, Ross Zwisler, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

Add tracepoints to dax_load_hole(), following the same logging conventions
as the rest of DAX.

Here is the logging generated by a PTE read from a hole:

read-1075  [002] ....    62.362108: dax_pte_fault: dev 259:0 ino 0x1003
shared ALLOW_RETRY|KILLABLE|USER address 0x10480000 pgoff 0x280

read-1075  [002] ....    62.362140: dax_load_hole: dev 259:0 ino 0x1003
shared ALLOW_RETRY|KILLABLE|USER address 0x10480000 pgoff 0x280 NOPAGE

read-1075  [002] ....    62.362141: dax_pte_fault_done: dev 259:0 ino
0x1003 shared ALLOW_RETRY|KILLABLE|USER address 0x10480000 pgoff 0x280
NOPAGE

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      | 16 +++++++++++-----
 include/trace/events/fs_dax.h |  1 +
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index b52732fb..bcfa11a 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -545,21 +545,25 @@ int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
 static int dax_load_hole(struct address_space *mapping, void **entry,
 			 struct vm_fault *vmf)
 {
+	struct inode *inode = mapping->host;
 	struct page *page;
 	int ret;
 
 	/* Hole page already exists? Return it...  */
 	if (!radix_tree_exceptional_entry(*entry)) {
 		page = *entry;
-		goto out;
+		goto finish_fault;
 	}
 
 	/* This will replace locked radix tree entry with a hole page */
 	page = find_or_create_page(mapping, vmf->pgoff,
 				   vmf->gfp_mask | __GFP_ZERO);
-	if (!page)
-		return VM_FAULT_OOM;
- out:
+	if (!page) {
+		ret = VM_FAULT_OOM;
+		goto out;
+	}
+
+finish_fault:
 	vmf->page = page;
 	ret = finish_fault(vmf);
 	vmf->page = NULL;
@@ -567,8 +571,10 @@ static int dax_load_hole(struct address_space *mapping, void **entry,
 	if (!ret) {
 		/* Grab reference for PTE that is now referencing the page */
 		get_page(page);
-		return VM_FAULT_NOPAGE;
+		ret = VM_FAULT_NOPAGE;
 	}
+out:
+	trace_dax_load_hole(inode, vmf, ret);
 	return ret;
 }
 
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index b5a5209..2f15dfe 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -192,6 +192,7 @@ DEFINE_PTE_FAULT_EVENT(dax_pte_fault);
 DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);
 DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite_no_entry);
 DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite);
+DEFINE_PTE_FAULT_EVENT(dax_load_hole);
 
 #endif /* _TRACE_FS_DAX_H */
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] dax: add tracepoints to dax_writeback_mapping_range()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
                   ` (2 preceding siblings ...)
  2017-02-21 19:51 ` [PATCH 3/6] dax: add tracepoints to dax_load_hole() Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-21 19:51 ` [PATCH 5/6] dax: add tracepoint to dax_writeback_one() Ross Zwisler
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Jan Kara, Ross Zwisler, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

Add tracepoints to dax_writeback_mapping_range(), following the same
logging conventions as the rest of DAX.

Here is an example writeback call:

msync-1085  [006] ....   200.902565: dax_writeback_range: dev 259:0 ino
0x1003 pgoff 0x200-0x2ff

msync-1085  [006] ....   200.902579: dax_writeback_range_done: dev 259:0
ino 0x1003 pgoff 0x200-0x2ff

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      |  8 ++++++--
 include/trace/events/fs_dax.h | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index bcfa11a..7ca1989 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -878,6 +878,8 @@ int dax_writeback_mapping_range(struct address_space *mapping,
 	start_index = wbc->range_start >> PAGE_SHIFT;
 	end_index = wbc->range_end >> PAGE_SHIFT;
 
+	trace_dax_writeback_range(inode, start_index, end_index);
+
 	tag_pages_for_writeback(mapping, start_index, end_index);
 
 	pagevec_init(&pvec, 0);
@@ -898,10 +900,12 @@ int dax_writeback_mapping_range(struct address_space *mapping,
 			ret = dax_writeback_one(bdev, mapping, indices[i],
 					pvec.pages[i]);
 			if (ret < 0)
-				return ret;
+				goto out;
 		}
 	}
-	return 0;
+out:
+	trace_dax_writeback_range_done(inode, start_index, end_index);
+	return ret;
 }
 EXPORT_SYMBOL_GPL(dax_writeback_mapping_range);
 
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index 2f15dfe..9afe8c8 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -194,6 +194,38 @@ DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite_no_entry);
 DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite);
 DEFINE_PTE_FAULT_EVENT(dax_load_hole);
 
+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);
+
 #endif /* _TRACE_FS_DAX_H */
 
 /* This part must be outside protection */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] dax: add tracepoint to dax_writeback_one()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
                   ` (3 preceding siblings ...)
  2017-02-21 19:51 ` [PATCH 4/6] dax: add tracepoints to dax_writeback_mapping_range() Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-21 19:51 ` [PATCH 6/6] dax: add tracepoint to dax_insert_mapping() Ross Zwisler
  2017-02-22 10:51 ` [PATCH 0/6] second round of tracepoints for DAX Jan Kara
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Jan Kara, Ross Zwisler, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

Add a tracepoint to dax_writeback_one(), following the same logging
conventions as the rest of DAX.

Here is an example range writeback which ends up flushing one PMD and one
PTE:

test-1265  [003] ....   496.615250: dax_writeback_range: dev 259:0 ino 0x1003
pgoff 0x0-0x7ffffffffffff

test-1265  [003] ....   496.616263: dax_writeback_one: dev 259:0 ino 0x1003
pgoff 0x0 pglen 0x200

test-1265  [003] ....   496.616270: dax_writeback_one: dev 259:0 ino 0x1003
pgoff 0x305 pglen 0x1

test-1265  [003] ....   496.616272: dax_writeback_range_done: dev 259:0 ino
0x1003 pgoff 0x0-0x7ffffffffffff

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      |  1 +
 include/trace/events/fs_dax.h | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/fs/dax.c b/fs/dax.c
index 7ca1989..d340389 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -843,6 +843,7 @@ static int dax_writeback_one(struct block_device *bdev,
 	spin_lock_irq(&mapping->tree_lock);
 	radix_tree_tag_clear(page_tree, index, PAGECACHE_TAG_DIRTY);
 	spin_unlock_irq(&mapping->tree_lock);
+	trace_dax_writeback_one(mapping->host, index, dax.size >> PAGE_SHIFT);
  unmap:
 	dax_unmap_atomic(bdev, &dax);
 	put_locked_mapping_entry(mapping, index, entry);
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index 9afe8c8..292a471 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -226,6 +226,30 @@ DEFINE_EVENT(dax_writeback_range_class, name, \
 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range);
 DEFINE_WRITEBACK_RANGE_EVENT(dax_writeback_range_done);
 
+TRACE_EVENT(dax_writeback_one,
+	TP_PROTO(struct inode *inode, pgoff_t pgoff, pgoff_t pglen),
+	TP_ARGS(inode, pgoff, pglen),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(pgoff_t, pgoff)
+		__field(pgoff_t, pglen)
+		__field(dev_t, dev)
+	),
+	TP_fast_assign(
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->ino = inode->i_ino;
+		__entry->pgoff = pgoff;
+		__entry->pglen = pglen;
+	),
+	TP_printk("dev %d:%d ino %#lx pgoff %#lx pglen %#lx",
+		MAJOR(__entry->dev),
+		MINOR(__entry->dev),
+		__entry->ino,
+		__entry->pgoff,
+		__entry->pglen
+	)
+)
+
 #endif /* _TRACE_FS_DAX_H */
 
 /* This part must be outside protection */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] dax: add tracepoint to dax_insert_mapping()
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
                   ` (4 preceding siblings ...)
  2017-02-21 19:51 ` [PATCH 5/6] dax: add tracepoint to dax_writeback_one() Ross Zwisler
@ 2017-02-21 19:51 ` Ross Zwisler
  2017-02-22 10:51 ` [PATCH 0/6] second round of tracepoints for DAX Jan Kara
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Zwisler @ 2017-02-21 19:51 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Jan Kara, Ross Zwisler, Alexander Viro, Dan Williams,
	Ingo Molnar, Matthew Wilcox, Steven Rostedt, linux-fsdevel,
	linux-nvdimm

Add a tracepoint to dax_insert_mapping(), following the same logging
conventions as the rest of DAX.  This tracepoint, along with the one in
dax_load_hole(), lets us know how a DAX PTE fault was serviced.

Here is an example DAX fault that inserts a PTE mapping:

small-1126  [007] ....   145.451604: dax_pte_fault: dev 259:0 ino 0x1003
shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff 0x220

small-1126  [007] ....   145.452317: dax_insert_mapping: dev 259:0 ino
0x1003 shared write address 0x10420000 radix_entry 0x100006

small-1126  [007] ....   145.452399: dax_pte_fault_done: dev 259:0 ino
0x1003 shared WRITE|ALLOW_RETRY|KILLABLE|USER address 0x10420000 pgoff
0x220 MAJOR|NOPAGE

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/dax.c                      |  1 +
 include/trace/events/fs_dax.h | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/fs/dax.c b/fs/dax.c
index d340389..ed53ce9 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -931,6 +931,7 @@ static int dax_insert_mapping(struct address_space *mapping,
 		return PTR_ERR(ret);
 	*entryp = ret;
 
+	trace_dax_insert_mapping(mapping->host, vmf, ret);
 	return vm_insert_mixed(vma, vaddr, dax.pfn);
 }
 
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index 292a471..08bb3ed 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -194,6 +194,36 @@ DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite_no_entry);
 DEFINE_PTE_FAULT_EVENT(dax_pfn_mkwrite);
 DEFINE_PTE_FAULT_EVENT(dax_load_hole);
 
+TRACE_EVENT(dax_insert_mapping,
+	TP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry),
+	TP_ARGS(inode, vmf, radix_entry),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(unsigned long, vm_flags)
+		__field(unsigned long, address)
+		__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->radix_entry = radix_entry;
+	),
+	TP_printk("dev %d:%d ino %#lx %s %s address %#lx radix_entry %#lx",
+		MAJOR(__entry->dev),
+		MINOR(__entry->dev),
+		__entry->ino,
+		__entry->vm_flags & VM_SHARED ? "shared" : "private",
+		__entry->write ? "write" : "read",
+		__entry->address,
+		(unsigned long)__entry->radix_entry
+	)
+)
+
 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),
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] second round of tracepoints for DAX
  2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
                   ` (5 preceding siblings ...)
  2017-02-21 19:51 ` [PATCH 6/6] dax: add tracepoint to dax_insert_mapping() Ross Zwisler
@ 2017-02-22 10:51 ` Jan Kara
  6 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2017-02-22 10:51 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Andrew Morton, linux-kernel, Jan Kara, Alexander Viro,
	Dan Williams, Ingo Molnar, Matthew Wilcox, Steven Rostedt,
	linux-fsdevel, linux-nvdimm

On Tue 21-02-17 12:51:10, Ross Zwisler wrote:
> 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.

Yeah, for now I think it is too detailed and high-level logging is good
enough. As we will debug problems, we may find places that are useful for
more detailed tracepoints but for now what you added looks fine.

> All these tracepoints were done to be consistent with the style of the XFS
> tracepoints and with the existing DAX PMD tracepoints.
> 
> This series applies cleanly to the current mmots/master:
> 
> commit 35aa45ffe8d9 ("pci: test for unexpectedly disabled bridges")
> 
> and I'm hoping that it'll end up going to Linus through akpm's -mm tree.

I like the patches and they look fine to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-22 10:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 19:51 [PATCH 0/6] second round of tracepoints for DAX Ross Zwisler
2017-02-21 19:51 ` [PATCH 1/6] dax: add tracepoints to dax_iomap_pte_fault() Ross Zwisler
2017-02-21 19:51 ` [PATCH 2/6] dax: add tracepoints to dax_pfn_mkwrite() Ross Zwisler
2017-02-21 19:51 ` [PATCH 3/6] dax: add tracepoints to dax_load_hole() Ross Zwisler
2017-02-21 19:51 ` [PATCH 4/6] dax: add tracepoints to dax_writeback_mapping_range() Ross Zwisler
2017-02-21 19:51 ` [PATCH 5/6] dax: add tracepoint to dax_writeback_one() Ross Zwisler
2017-02-21 19:51 ` [PATCH 6/6] dax: add tracepoint to dax_insert_mapping() Ross Zwisler
2017-02-22 10:51 ` [PATCH 0/6] second round of tracepoints for DAX Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).