summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kelley <mikelley@microsoft.com>2023-04-13 08:37:30 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-11 23:11:29 +0900
commiteceb1cd49c67debc7887c306d2d8efee3d95d04f (patch)
tree08616b619933c3bc6c7108a1c915a30b9e4ef1da
parentbe138dfeba5264ffb4273fd6b4f7ec8b9b2c2878 (diff)
swiotlb: fix debugfs reporting of reserved memory pools
[ Upstream commit 5499d01c029069044a3b3e50501c77b474c96178 ] 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: 5c850d31880e ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--kernel/dma/swiotlb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 465cd2b5481f..81f40821084e 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -935,7 +935,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");
@@ -948,7 +950,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);
}