Skip to content

Commit

Permalink
swiotlb: fix debugfs reporting of reserved memory pools
Browse files Browse the repository at this point in the history
For io_tlb_nslabs, the debugfs code reports the correct value for a
specific reserved memory pool.  But for io_tlb_used, the value reported
is always for the default pool, not the specific reserved pool. Fix this.

Fixes: 5c850d3 ("swiotlb: fix passing local variable to debugfs_create_ulong()")
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
kelleymh authored and Christoph Hellwig committed Apr 16, 2023
1 parent a90922f commit 5499d01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,9 @@ EXPORT_SYMBOL_GPL(is_swiotlb_active);

static int io_tlb_used_get(void *data, u64 *val)
{
*val = mem_used(&io_tlb_default_mem);
struct io_tlb_mem *mem = data;

*val = mem_used(mem);
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_io_tlb_used, io_tlb_used_get, NULL, "%llu\n");
Expand All @@ -943,7 +945,7 @@ static void swiotlb_create_debugfs_files(struct io_tlb_mem *mem,
return;

debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs);
debugfs_create_file("io_tlb_used", 0400, mem->debugfs, NULL,
debugfs_create_file("io_tlb_used", 0400, mem->debugfs, mem,
&fops_io_tlb_used);
}

Expand Down

0 comments on commit 5499d01

Please sign in to comment.