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

swiotlb: panic if nslabs is too small

Panic on purpose if nslabs is too small, in order to sync with the remap
retry logic.

In addition, print the number of bytes for tlb alloc failure.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Dongli Zhang and committed by
Christoph Hellwig
0bf28fc4 04c14e8e

+5 -1
+5 -1
kernel/dma/swiotlb.c
··· 242 242 if (swiotlb_force_disable) 243 243 return; 244 244 245 + if (nslabs < IO_TLB_MIN_SLABS) 246 + panic("%s: nslabs = %lu too small\n", __func__, nslabs); 247 + 245 248 /* 246 249 * By default allocate the bounce buffer memory from low memory, but 247 250 * allow to pick a location everywhere for hypervisors with guest ··· 257 254 else 258 255 tlb = memblock_alloc_low(bytes, PAGE_SIZE); 259 256 if (!tlb) { 260 - pr_warn("%s: failed to allocate tlb structure\n", __func__); 257 + pr_warn("%s: Failed to allocate %zu bytes tlb structure\n", 258 + __func__, bytes); 261 259 return; 262 260 } 263 261