Skip to content
Commit a1255cca authored by Dexuan Cui's avatar Dexuan Cui Committed by Christoph Hellwig
Browse files

swiotlb: do not set total_used to 0 in swiotlb_create_debugfs_files()

Sometimes the readout of /sys/kernel/debug/swiotlb/io_tlb_used and
io_tlb_used_hiwater can be a huge number (e.g. 18446744073709551615),
which is actually a negative number if we use "%ld" to print the number.

When swiotlb_create_default_debugfs() is running from late_initcall,
mem->total_used may already be non-zero, because the storage driver
may have already started to perform I/O operations: if the storage
driver is built-in, its probe() callback is called before late_initcall.

swiotlb_create_debugfs_files() should not blindly set mem->total_used
and mem->used_hiwater to 0; actually it doesn't have to initialize the
fields at all, because the fields, as part of the global struct
io_tlb_default_mem, have been implicitly initialized to zero.

Also don't explicitly set mem->transient_nslabs to 0.

Fixes: 8b0977ec ("swiotlb: track and report io_tlb_used high water marks in debugfs")
Fixes: 02e76569

 ("swiotlb: add debugfs to track swiotlb transient pool usage")
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Reviewed-by: default avatarMichael Kelley <mhklinux@outlook.com>
Reviewed-by: default avatarZhangPeng <zhangpeng362@huawei.com>
Reviewed-by: default avatarPetr Tesarik <petr.tesarik1@huawei-partners.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent e8068f2d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment