diff options
author | Dongli Zhang <dongli.zhang@oracle.com> | 2022-06-11 01:25:14 -0700 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-06-22 12:42:09 +0200 |
commit | 0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1 (patch) | |
tree | 8905b87243769254b100497f5aa3b506cf4460cf /kernel/dma | |
parent | 04c14e8e38b06edf934e9bb0cc504afd94d593fb (diff) | |
download | linux-stable-0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1.tar.gz linux-stable-0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1.tar.bz2 linux-stable-0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1.zip |
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>
Diffstat (limited to 'kernel/dma')
-rw-r--r-- | kernel/dma/swiotlb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index fd21f4162f4b..1758b724c7a8 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags, if (swiotlb_force_disable) return; + if (nslabs < IO_TLB_MIN_SLABS) + panic("%s: nslabs = %lu too small\n", __func__, nslabs); + /* * By default allocate the bounce buffer memory from low memory, but * allow to pick a location everywhere for hypervisors with guest @@ -254,7 +257,8 @@ retry: else tlb = memblock_alloc_low(bytes, PAGE_SIZE); if (!tlb) { - pr_warn("%s: failed to allocate tlb structure\n", __func__); + pr_warn("%s: Failed to allocate %zu bytes tlb structure\n", + __func__, bytes); return; } |