[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202208311724.SVcJV3az-lkp@intel.com>
Date: Wed, 31 Aug 2022 17:17:44 +0800
From: kernel test robot <lkp@...el.com>
To: Yu Zhao <yuzhao@...gle.com>, Christoph Hellwig <hch@...radead.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Dongli Zhang <dongli.zhang@...cle.com>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
Yu Zhao <yuzhao@...gle.com>
Subject: Re: [PATCH] Revert "swiotlb: panic if nslabs is too small"
Hi Yu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on c40e8341e3b3bb27e3a65b06b5b454626234c4f0]
url: https://github.com/intel-lab-lkp/linux/commits/Yu-Zhao/Revert-swiotlb-panic-if-nslabs-is-too-small/20220830-073123
base: c40e8341e3b3bb27e3a65b06b5b454626234c4f0
config: s390-randconfig-r044-20220830
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4c106463674a6f6de085d9a91510c385be4a620d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/b253fbc6b9640aeebffc73d72bf0177c2a1ede1e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yu-Zhao/Revert-swiotlb-panic-if-nslabs-is-too-small/20220830-073123
git checkout b253fbc6b9640aeebffc73d72bf0177c2a1ede1e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from kernel/dma/swiotlb.c:27:
In file included from include/linux/dma-direct.h:9:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
In file included from kernel/dma/swiotlb.c:27:
In file included from include/linux/dma-direct.h:9:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
In file included from kernel/dma/swiotlb.c:27:
In file included from include/linux/dma-direct.h:9:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> kernel/dma/swiotlb.c:318:6: warning: variable 'nslabs' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (swiotlb_force_disable)
^~~~~~~~~~~~~~~~~~~~~
kernel/dma/swiotlb.c:334:21: note: uninitialized use occurs here
bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT);
^~~~~~
include/linux/mm.h:223:32: note: expanded from macro 'PAGE_ALIGN'
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
^~~~
include/linux/align.h:8:38: note: expanded from macro 'ALIGN'
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
^
include/uapi/linux/const.h:31:51: note: expanded from macro '__ALIGN_KERNEL'
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
^
include/uapi/linux/const.h:32:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
^
kernel/dma/swiotlb.c:318:2: note: remove the 'if' if its condition is always true
if (swiotlb_force_disable)
^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/dma/swiotlb.c:311:22: note: initialize the variable 'nslabs' to silence this warning
unsigned long nslabs;
^
= 0
13 warnings generated.
vim +318 kernel/dma/swiotlb.c
0a65579cdd28be kernel/dma/swiotlb.c Claire Chang 2021-06-19 302
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 303 /*
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 304 * Statically reserve bounce buffer space and initialize bounce buffer data
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 305 * structures for the software IO TLB used to implement the DMA API.
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 306 */
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 307 void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 308 int (*remap)(void *tlb, unsigned long nslabs))
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 309 {
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 310 struct io_tlb_mem *mem = &io_tlb_default_mem;
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 311 unsigned long nslabs;
a5e891321a2196 kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 312 size_t alloc_size;
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 313 size_t bytes;
2d29960af0bee8 kernel/dma/swiotlb.c Christoph Hellwig 2021-03-18 314 void *tlb;
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 315
c6af2aa9ffc976 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-29 316 if (!addressing_limit && !swiotlb_force_bounce)
c6af2aa9ffc976 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-29 317 return;
c6af2aa9ffc976 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-29 @318 if (swiotlb_force_disable)
2726bf3ff2520d kernel/dma/swiotlb.c Florian Fainelli 2021-03-22 319 return;
2726bf3ff2520d kernel/dma/swiotlb.c Florian Fainelli 2021-03-22 320
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 321 /*
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 322 * default_nslabs maybe changed when adjust area number.
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 323 * So allocate bounce buffer after adjusting area number.
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 324 */
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 325 if (!default_nareas)
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 326 swiotlb_adjust_nareas(num_possible_cpus());
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 327
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 328 /*
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 329 * By default allocate the bounce buffer memory from low memory, but
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 330 * allow to pick a location everywhere for hypervisors with guest
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 331 * memory encryption.
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 332 */
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 333 retry:
a5e891321a2196 kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 334 bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT);
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 335 if (flags & SWIOTLB_ANY)
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 336 tlb = memblock_alloc(bytes, PAGE_SIZE);
8ba2ed1be90fc2 kernel/dma/swiotlb.c Christoph Hellwig 2022-02-28 337 else
2d29960af0bee8 kernel/dma/swiotlb.c Christoph Hellwig 2021-03-18 338 tlb = memblock_alloc_low(bytes, PAGE_SIZE);
1521c607cabe7c kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 339 if (!tlb) {
b253fbc6b9640a kernel/dma/swiotlb.c Yu Zhao 2022-08-29 340 pr_warn("%s: failed to allocate tlb structure\n", __func__);
1521c607cabe7c kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 341 return;
1521c607cabe7c kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 342 }
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 343
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 344 if (remap && remap(tlb, nslabs) < 0) {
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 345 memblock_free(tlb, PAGE_ALIGN(bytes));
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 346
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 347 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE);
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 348 if (nslabs < IO_TLB_MIN_SLABS)
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 349 panic("%s: Failed to remap %zu bytes\n",
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 350 __func__, bytes);
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 351 goto retry;
7374153d294eb5 kernel/dma/swiotlb.c Christoph Hellwig 2022-03-14 352 }
abbceff7d7a884 lib/swiotlb.c FUJITA Tomonori 2010-05-10 353
a5e891321a2196 kernel/dma/swiotlb.c Christoph Hellwig 2022-05-11 354 alloc_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), nslabs));
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 355 mem->slots = memblock_alloc(alloc_size, PAGE_SIZE);
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 356 if (!mem->slots)
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 357 panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 358 __func__, alloc_size, PAGE_SIZE);
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 359
72311809031217 kernel/dma/swiotlb.c Tianyu Lan 2022-07-21 360 mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
72311809031217 kernel/dma/swiotlb.c Tianyu Lan 2022-07-21 361 default_nareas), SMP_CACHE_BYTES);
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 362 if (!mem->areas)
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 363 panic("%s: Failed to allocate mem->areas.\n", __func__);
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 364
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 365 swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false,
20347fca71a387 kernel/dma/swiotlb.c Tianyu Lan 2022-07-08 366 default_nareas);
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 367
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 368 if (flags & SWIOTLB_VERBOSE)
6424e31b1c050a kernel/dma/swiotlb.c Christoph Hellwig 2022-03-15 369 swiotlb_print_info();
^1da177e4c3f41 arch/ia64/lib/swiotlb.c Linus Torvalds 2005-04-16 370 }
^1da177e4c3f41 arch/ia64/lib/swiotlb.c Linus Torvalds 2005-04-16 371
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (58712 bytes)
Powered by blists - more mailing lists