Skip to content

Commit

Permalink
dma-debug: Expose nr_total_entries in debugfs
Browse files Browse the repository at this point in the history
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.

Suggested-by: John Garry <john.garry@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
rmurphy-arm authored and Christoph Hellwig committed Dec 11, 2018
1 parent 7c703e5 commit 9f19155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/DMA-API.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions kernel/dma/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,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 */
Expand Down Expand Up @@ -926,6 +927,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)
Expand Down

0 comments on commit 9f19155

Please sign in to comment.