Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/dma/amd-gart: Stop resizing dma_debug_entry pool

dma-debug is now capable of adding new entries to its pool on-demand if
the initial preallocation was insufficient, so the IOMMU_LEAK logic no
longer needs to explicitly change the pool size. This does lose it the
ability to save a couple of megabytes of RAM by reducing the pool size
below its default, but it seems unlikely that that is a realistic
concern these days (or indeed that anyone is actively debugging AGP
drivers' DMA usage any more). Getting rid of dma_debug_resize_entries()
will make room for further streamlining in the dma-debug code itself.

Removing the call reveals quite a lot of cruft which has been useless
for nearly a decade since commit 19c1a6f5764d ("x86 gart: reimplement
IOMMU_LEAK feature by using DMA_API_DEBUG"), including the entire
'iommu=leak' parameter, which controlled nothing except whether
dma_debug_resize_entries() was called or not.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Robin Murphy and committed by
Christoph Hellwig
a8a4c98f ceb51173

+1 -27
+1 -4
Documentation/x86/x86_64/boot-options.txt
··· 209 209 mapping with memory protection, etc. 210 210 Kernel boot message: "PCI-DMA: Using Calgary IOMMU" 211 211 212 - iommu=[<size>][,noagp][,off][,force][,noforce][,leak[=<nr_of_leak_pages>] 212 + iommu=[<size>][,noagp][,off][,force][,noforce] 213 213 [,memaper[=<order>]][,merge][,fullflush][,nomerge] 214 214 [,noaperture][,calgary] 215 215 ··· 228 228 allowed Overwrite iommu off workarounds for specific chipsets. 229 229 fullflush Flush IOMMU on each allocation (default). 230 230 nofullflush Don't use IOMMU fullflush. 231 - leak Turn on simple iommu leak tracing (only when 232 - CONFIG_IOMMU_LEAK is on). Default number of leak pages 233 - is 20. 234 231 memaper[=<order>] Allocate an own aperture over RAM with size 32MB<<order. 235 232 (default: order=1, i.e. 64MB) 236 233 merge Do scatter-gather (SG) merging. Implies "force"
-23
arch/x86/kernel/amd_gart_64.c
··· 151 151 152 152 #ifdef CONFIG_IOMMU_LEAK 153 153 /* Debugging aid for drivers that don't free their IOMMU tables */ 154 - static int leak_trace; 155 - static int iommu_leak_pages = 20; 156 - 157 154 static void dump_leak(void) 158 155 { 159 156 static int dump; ··· 752 755 if (!iommu_gart_bitmap) 753 756 panic("Cannot allocate iommu bitmap\n"); 754 757 755 - #ifdef CONFIG_IOMMU_LEAK 756 - if (leak_trace) { 757 - int ret; 758 - 759 - ret = dma_debug_resize_entries(iommu_pages); 760 - if (ret) 761 - pr_debug("PCI-DMA: Cannot trace all the entries\n"); 762 - } 763 - #endif 764 - 765 758 pr_info("PCI-DMA: Reserving %luMB of IOMMU area in the AGP aperture\n", 766 759 iommu_size >> 20); 767 760 ··· 812 825 { 813 826 int arg; 814 827 815 - #ifdef CONFIG_IOMMU_LEAK 816 - if (!strncmp(p, "leak", 4)) { 817 - leak_trace = 1; 818 - p += 4; 819 - if (*p == '=') 820 - ++p; 821 - if (isdigit(*p) && get_option(&p, &arg)) 822 - iommu_leak_pages = arg; 823 - } 824 - #endif 825 828 if (isdigit(*p) && get_option(&p, &arg)) 826 829 iommu_size = arg; 827 830 if (!strncmp(p, "fullflush", 9))