From: Dongli Zhang Date: Tue, 16 Apr 2019 23:48:19 +0000 (+0800) Subject: swiotlb: dump used and total slots when swiotlb buffer is full X-Git-Tag: v4.1.12-124.31.3~165 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9d79d0b6bd1953f3929df876452e62c92b269b33;p=users%2Fjedix%2Flinux-maple.git swiotlb: dump used and total slots when swiotlb buffer is full So far the kernel only prints the requested size if swiotlb buffer if full. It is not possible to know whether it is simply an out of buffer, or it is because swiotlb cannot allocate buffer with the requested size due to fragmentation. As 'io_tlb_used' is available since commit 71602fe6d4e9 ("swiotlb: add debugfs to track swiotlb buffer usage"), both 'io_tlb_used' and 'io_tlb_nslabs' are printed when swiotlb buffer is full. Signed-off-by: Dongli Zhang Signed-off-by: Konrad Rzeszutek Wilk Orabug: 29637525 (cherry picked from commit 83ca259489409a1fe8a83dad83a82f32174d4f31) Signed-off-by: Brian Maly Conflicts: kernel/dma/swiotlb.c does not exist. Signed-off-by: Dongli Zhang Reviewed-By: Joe Jin Signed-off-by: Brian Maly --- diff --git a/lib/swiotlb.c b/lib/swiotlb.c index c9d2b32c70b5..d08ce286e1d2 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -526,7 +526,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, not_found: spin_unlock_irqrestore(&io_tlb_lock, flags); if (printk_ratelimit()) - dev_warn(hwdev, "swiotlb buffer is full (sz: %zd bytes)\n", size); + dev_warn(hwdev, "swiotlb buffer is full (sz: %zd bytes), total %lu, used %lu\n", + size, io_tlb_nslabs, io_tlb_used); return SWIOTLB_MAP_ERROR; found: io_tlb_used += nslots;