tree:
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
memblock/iterators-cleanup/v3
head: f0d593460d044672ca2ea065efc283e30dd23ef1
commit: 3efd016ce3025d16da91568f97de6f0006281657 [10/17] memblock: reduce number of
parameters in for_each_mem_range()
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
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
git checkout 3efd016ce3025d16da91568f97de6f0006281657
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
arch/powerpc/kexec/file_load_64.c: In function '__locate_mem_hole_bottom_up':
> arch/powerpc/kexec/file_load_64.c:354:40: error: macro
"for_each_mem_range" passed 8 arguments, but takes just 3
354 |
MEMBLOCK_NONE, &start, &end, NULL) {
| ^
In file included from arch/powerpc/kexec/file_load_64.c:21:
include/linux/memblock.h:211: note: macro "for_each_mem_range" defined here
211 | #define for_each_mem_range(i, p_start, p_end) \
|
> arch/powerpc/kexec/file_load_64.c:353:2: error:
'for_each_mem_range' undeclared (first use in this function); did you mean
'crash_mem_range'?
353 | for_each_mem_range(i, &memblock.memory,
NULL, NUMA_NO_NODE,
| ^~~~~~~~~~~~~~~~~~
| crash_mem_range
arch/powerpc/kexec/file_load_64.c:353:2: note: each undeclared identifier is reported
only once for each function it appears in
> arch/powerpc/kexec/file_load_64.c:353:20: error: expected
';' before '{' token
353 | for_each_mem_range(i,
&memblock.memory, NULL, NUMA_NO_NODE,
| ^
| ;
354 | MEMBLOCK_NONE, &start, &end, NULL) {
| ~
> arch/powerpc/kexec/file_load_64.c:351:6: error: unused variable
'i' [-Werror=unused-variable]
351 | u64 i;
| ^
> arch/powerpc/kexec/file_load_64.c:350:21: error: unused variable
'end' [-Werror=unused-variable]
350 | phys_addr_t start, end;
| ^~~
> arch/powerpc/kexec/file_load_64.c:350:14: error: unused variable
'start' [-Werror=unused-variable]
350 | phys_addr_t start, end;
| ^~~~~
> arch/powerpc/kexec/file_load_64.c:349:6: error: unused variable
'ret' [-Werror=unused-variable]
349 | int ret = -EADDRNOTAVAIL;
| ^~~
arch/powerpc/kexec/file_load_64.c:385:1: error: no return statement in function
returning non-void [-Werror=return-type]
385 | }
| ^
cc1: all warnings being treated as errors
vim +/for_each_mem_range +354 arch/powerpc/kexec/file_load_64.c
b8e55a3e5c2088 Hari Bathini 2020-07-29 335
b8e55a3e5c2088 Hari Bathini 2020-07-29 336 /**
b8e55a3e5c2088 Hari Bathini 2020-07-29 337 * __locate_mem_hole_bottom_up - Looks bottom
up for a large enough memory hole
b8e55a3e5c2088 Hari Bathini 2020-07-29 338 * in the
memory regions between buf_min & buf_max
b8e55a3e5c2088 Hari Bathini 2020-07-29 339 * for the
buffer. If found, sets kbuf->mem.
b8e55a3e5c2088 Hari Bathini 2020-07-29 340 * @kbuf: Buffer
contents and memory parameters.
b8e55a3e5c2088 Hari Bathini 2020-07-29 341 * @buf_min: Minimum
address for the buffer.
b8e55a3e5c2088 Hari Bathini 2020-07-29 342 * @buf_max: Maximum
address for the buffer.
b8e55a3e5c2088 Hari Bathini 2020-07-29 343 *
b8e55a3e5c2088 Hari Bathini 2020-07-29 344 * Returns 0 on success, negative errno on
error.
b8e55a3e5c2088 Hari Bathini 2020-07-29 345 */
b8e55a3e5c2088 Hari Bathini 2020-07-29 346 static int __locate_mem_hole_bottom_up(struct
kexec_buf *kbuf,
b8e55a3e5c2088 Hari Bathini 2020-07-29 347 u64 buf_min, u64 buf_max)
b8e55a3e5c2088 Hari Bathini 2020-07-29 348 {
b8e55a3e5c2088 Hari Bathini 2020-07-29 @349 int ret = -EADDRNOTAVAIL;
b8e55a3e5c2088 Hari Bathini 2020-07-29 @350 phys_addr_t start, end;
b8e55a3e5c2088 Hari Bathini 2020-07-29 @351 u64 i;
b8e55a3e5c2088 Hari Bathini 2020-07-29 352
b8e55a3e5c2088 Hari Bathini 2020-07-29 @353 for_each_mem_range(i, &memblock.memory,
NULL, NUMA_NO_NODE,
b8e55a3e5c2088 Hari Bathini 2020-07-29 @354 MEMBLOCK_NONE, &start, &end,
NULL) {
b8e55a3e5c2088 Hari Bathini 2020-07-29 355 /*
b8e55a3e5c2088 Hari Bathini 2020-07-29 356 * memblock uses [start, end) convention
while it is
b8e55a3e5c2088 Hari Bathini 2020-07-29 357 * [start, end] here. Fix the off-by-one to
have the
b8e55a3e5c2088 Hari Bathini 2020-07-29 358 * same convention.
b8e55a3e5c2088 Hari Bathini 2020-07-29 359 */
b8e55a3e5c2088 Hari Bathini 2020-07-29 360 end -= 1;
b8e55a3e5c2088 Hari Bathini 2020-07-29 361
b8e55a3e5c2088 Hari Bathini 2020-07-29 362 if (end < buf_min)
b8e55a3e5c2088 Hari Bathini 2020-07-29 363 continue;
b8e55a3e5c2088 Hari Bathini 2020-07-29 364
b8e55a3e5c2088 Hari Bathini 2020-07-29 365 /* Memory hole not found */
b8e55a3e5c2088 Hari Bathini 2020-07-29 366 if (start > buf_max)
b8e55a3e5c2088 Hari Bathini 2020-07-29 367 break;
b8e55a3e5c2088 Hari Bathini 2020-07-29 368
b8e55a3e5c2088 Hari Bathini 2020-07-29 369 /* Adjust memory region based on the given
range */
b8e55a3e5c2088 Hari Bathini 2020-07-29 370 if (start < buf_min)
b8e55a3e5c2088 Hari Bathini 2020-07-29 371 start = buf_min;
b8e55a3e5c2088 Hari Bathini 2020-07-29 372 if (end > buf_max)
b8e55a3e5c2088 Hari Bathini 2020-07-29 373 end = buf_max;
b8e55a3e5c2088 Hari Bathini 2020-07-29 374
b8e55a3e5c2088 Hari Bathini 2020-07-29 375 start = ALIGN(start, kbuf->buf_align);
b8e55a3e5c2088 Hari Bathini 2020-07-29 376 if (start < end && (end - start
+ 1) >= kbuf->memsz) {
b8e55a3e5c2088 Hari Bathini 2020-07-29 377 /* Suitable memory range found. Set
kbuf->mem */
b8e55a3e5c2088 Hari Bathini 2020-07-29 378 kbuf->mem = start;
b8e55a3e5c2088 Hari Bathini 2020-07-29 379 ret = 0;
b8e55a3e5c2088 Hari Bathini 2020-07-29 380 break;
b8e55a3e5c2088 Hari Bathini 2020-07-29 381 }
b8e55a3e5c2088 Hari Bathini 2020-07-29 382 }
b8e55a3e5c2088 Hari Bathini 2020-07-29 383
b8e55a3e5c2088 Hari Bathini 2020-07-29 384 return ret;
b8e55a3e5c2088 Hari Bathini 2020-07-29 385 }
b8e55a3e5c2088 Hari Bathini 2020-07-29 386
:::::: The code at line 354 was first introduced by commit
:::::: b8e55a3e5c208862eacded5aad822184f89f85d9 powerpc/kexec_file: Avoid stomping memory
used by special regions
:::::: TO: Hari Bathini <hbathini(a)linux.ibm.com>
:::::: CC: Michael Ellerman <mpe(a)ellerman.id.au>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org