All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: hch@lst.de
Cc: m.szyprowski@samsung.com, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, cai@gmx.us, salil.mehta@huawei.com,
	john.garry@huawei.com
Subject: [PATCH v3 2/7] dma-debug: Expose nr_total_entries in debugfs
Date: Mon, 10 Dec 2018 14:00:28 +0000	[thread overview]
Message-ID: <06146c16a9c9af8b363d9e5faa73e9952b4f0865.1544447601.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1544447601.git.robin.murphy@arm.com>

Expose nr_total_entries in debugfs, so that {num,min}_free_entries
become even more meaningful to users interested in current/maximum
utilisation. This becomes even more relevant once nr_total_entries
may change at runtime beyond just the existing AMD GART debug code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Suggested-by: John Garry <john.garry@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

v3: Add Christoph's review tag

 Documentation/DMA-API.txt | 3 +++
 kernel/dma/debug.c        | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index ac66ae2509a9..6bdb095393b0 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -723,6 +723,9 @@ dma-api/min_free_entries	This read-only file can be read to get the
 dma-api/num_free_entries	The current number of free dma_debug_entries
 				in the allocator.
 
+dma-api/nr_total_entries	The total number of dma_debug_entries in the
+				allocator, both free and used.
+
 dma-api/driver-filter		You can write a name of a driver into this file
 				to limit the debug output to requests from that
 				particular driver. Write an empty string to
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 91b84140e4a5..29486eb9d1dc 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -144,6 +144,7 @@ static struct dentry *show_all_errors_dent  __read_mostly;
 static struct dentry *show_num_errors_dent  __read_mostly;
 static struct dentry *num_free_entries_dent __read_mostly;
 static struct dentry *min_free_entries_dent __read_mostly;
+static struct dentry *nr_total_entries_dent __read_mostly;
 static struct dentry *filter_dent           __read_mostly;
 
 /* per-driver filter related state */
@@ -928,6 +929,12 @@ static int dma_debug_fs_init(void)
 	if (!min_free_entries_dent)
 		goto out_err;
 
+	nr_total_entries_dent = debugfs_create_u32("nr_total_entries", 0444,
+			dma_debug_dent,
+			&nr_total_entries);
+	if (!nr_total_entries_dent)
+		goto out_err;
+
 	filter_dent = debugfs_create_file("driver_filter", 0644,
 					  dma_debug_dent, NULL, &filter_fops);
 	if (!filter_dent)
-- 
2.19.1.dirty


  parent reply	other threads:[~2018-12-10 14:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 14:00 [PATCH v3 0/7] dma-debug cleanup and dynamic allocation Robin Murphy
2018-12-10 14:00 ` Robin Murphy
2018-12-10 14:00 ` [PATCH v3 1/7] dma-debug: Use pr_fmt() Robin Murphy
2018-12-10 14:00 ` Robin Murphy [this message]
2018-12-10 14:00 ` [PATCH v3 3/7] dma-debug: Dynamically expand the dma_debug_entry pool Robin Murphy
2018-12-10 14:00   ` Robin Murphy
2018-12-10 14:00 ` [PATCH v3 4/7] dma-debug: Make leak-like behaviour apparent Robin Murphy
2018-12-10 14:00 ` [PATCH v3 5/7] x86/dma/amd-gart: Stop resizing dma_debug_entry pool Robin Murphy
2018-12-10 21:26   ` Thomas Gleixner
2018-12-10 21:26     ` Thomas Gleixner
2018-12-10 14:00 ` [PATCH v3 6/7] dma/debug: Remove dma_debug_resize_entries() Robin Murphy
2018-12-10 14:00 ` [PATCH v3 7/7] dma-debug: Batch dma_debug_entry allocation Robin Murphy
2018-12-10 15:50 ` [PATCH v3 0/7] dma-debug cleanup and dynamic allocation Qian Cai
2018-12-11 13:43 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06146c16a9c9af8b363d9e5faa73e9952b4f0865.1544447601.git.robin.murphy@arm.com \
    --to=robin.murphy@arm.com \
    --cc=cai@gmx.us \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=salil.mehta@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.