tree:
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
memblock/iterators-cleanup/v3
head: f0d593460d044672ca2ea065efc283e30dd23ef1
commit: f0d593460d044672ca2ea065efc283e30dd23ef1 [17/17] memblock: use separate iterators
for memory and reserved regions
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 f0d593460d044672ca2ea065efc283e30dd23ef1
# 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 'get_crash_memory_ranges':
> arch/powerpc/kexec/file_load_64.c:145:2: error: implicit
declaration of function 'for_each_memblock'; did you mean
'for_each_mem_range'? [-Werror=implicit-function-declaration]
145 |
for_each_memblock(memory, reg) {
| ^~~~~~~~~~~~~~~~~
| for_each_mem_range
> arch/powerpc/kexec/file_load_64.c:145:20: error: 'memory'
undeclared (first use in this function); did you mean 'memcpy'?
145 |
for_each_memblock(memory, reg) {
| ^~~~~~
| memcpy
arch/powerpc/kexec/file_load_64.c:145:20: note: each undeclared identifier is reported
only once for each function it appears in
arch/powerpc/kexec/file_load_64.c:145:32: error: expected ';' before
'{' token
145 | for_each_memblock(memory, reg) {
| ^~
| ;
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:208: note: macro "for_each_mem_range" defined here
208 | #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: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 +145 arch/powerpc/kexec/file_load_64.c
7c64e21a1c5a5b Hari Bathini 2020-07-29 130
cb350c1f1f867d Hari Bathini 2020-07-29 131 /**
cb350c1f1f867d Hari Bathini 2020-07-29 132 * get_crash_memory_ranges - Get crash memory
ranges. This list includes
cb350c1f1f867d Hari Bathini 2020-07-29 133 * first/crashing
kernel's memory regions that
cb350c1f1f867d Hari Bathini 2020-07-29 134 * would be
exported via an elfcore.
cb350c1f1f867d Hari Bathini 2020-07-29 135 * @mem_ranges: Range list to
add the memory ranges to.
cb350c1f1f867d Hari Bathini 2020-07-29 136 *
cb350c1f1f867d Hari Bathini 2020-07-29 137 * Returns 0 on success, negative errno on
error.
cb350c1f1f867d Hari Bathini 2020-07-29 138 */
cb350c1f1f867d Hari Bathini 2020-07-29 139 static int get_crash_memory_ranges(struct
crash_mem **mem_ranges)
cb350c1f1f867d Hari Bathini 2020-07-29 140 {
cb350c1f1f867d Hari Bathini 2020-07-29 141 struct memblock_region *reg;
cb350c1f1f867d Hari Bathini 2020-07-29 142 struct crash_mem *tmem;
cb350c1f1f867d Hari Bathini 2020-07-29 143 int ret;
cb350c1f1f867d Hari Bathini 2020-07-29 144
cb350c1f1f867d Hari Bathini 2020-07-29 @145 for_each_memblock(memory, reg) {
cb350c1f1f867d Hari Bathini 2020-07-29 146 u64 base, size;
cb350c1f1f867d Hari Bathini 2020-07-29 147
cb350c1f1f867d Hari Bathini 2020-07-29 148 base = (u64)reg->base;
cb350c1f1f867d Hari Bathini 2020-07-29 149 size = (u64)reg->size;
cb350c1f1f867d Hari Bathini 2020-07-29 150
cb350c1f1f867d Hari Bathini 2020-07-29 151 /* Skip backup memory region, which needs a
separate entry */
cb350c1f1f867d Hari Bathini 2020-07-29 152 if (base == BACKUP_SRC_START) {
cb350c1f1f867d Hari Bathini 2020-07-29 153 if (size > BACKUP_SRC_SIZE) {
cb350c1f1f867d Hari Bathini 2020-07-29 154 base = BACKUP_SRC_END + 1;
cb350c1f1f867d Hari Bathini 2020-07-29 155 size -= BACKUP_SRC_SIZE;
cb350c1f1f867d Hari Bathini 2020-07-29 156 } else
cb350c1f1f867d Hari Bathini 2020-07-29 157 continue;
cb350c1f1f867d Hari Bathini 2020-07-29 158 }
cb350c1f1f867d Hari Bathini 2020-07-29 159
cb350c1f1f867d Hari Bathini 2020-07-29 160 ret = add_mem_range(mem_ranges, base,
size);
cb350c1f1f867d Hari Bathini 2020-07-29 161 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 162 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 163
cb350c1f1f867d Hari Bathini 2020-07-29 164 /* Try merging adjacent ranges before
reallocation attempt */
cb350c1f1f867d Hari Bathini 2020-07-29 165 if ((*mem_ranges)->nr_ranges ==
(*mem_ranges)->max_nr_ranges)
cb350c1f1f867d Hari Bathini 2020-07-29 166 sort_memory_ranges(*mem_ranges, true);
cb350c1f1f867d Hari Bathini 2020-07-29 167 }
cb350c1f1f867d Hari Bathini 2020-07-29 168
cb350c1f1f867d Hari Bathini 2020-07-29 169 /* Reallocate memory ranges if there is no
space to split ranges */
cb350c1f1f867d Hari Bathini 2020-07-29 170 tmem = *mem_ranges;
cb350c1f1f867d Hari Bathini 2020-07-29 171 if (tmem && (tmem->nr_ranges ==
tmem->max_nr_ranges)) {
cb350c1f1f867d Hari Bathini 2020-07-29 172 tmem = realloc_mem_ranges(mem_ranges);
cb350c1f1f867d Hari Bathini 2020-07-29 173 if (!tmem)
cb350c1f1f867d Hari Bathini 2020-07-29 174 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 175 }
cb350c1f1f867d Hari Bathini 2020-07-29 176
cb350c1f1f867d Hari Bathini 2020-07-29 177 /* Exclude crashkernel region */
cb350c1f1f867d Hari Bathini 2020-07-29 178 ret = crash_exclude_mem_range(tmem,
crashk_res.start, crashk_res.end);
cb350c1f1f867d Hari Bathini 2020-07-29 179 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 180 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 181
cb350c1f1f867d Hari Bathini 2020-07-29 182 /*
cb350c1f1f867d Hari Bathini 2020-07-29 183 * FIXME: For now, stay in parity with
kexec-tools but if RTAS/OPAL
cb350c1f1f867d Hari Bathini 2020-07-29 184 * regions are exported to save their
context at the time of
cb350c1f1f867d Hari Bathini 2020-07-29 185 * crash, they should actually be
backed up just like the
cb350c1f1f867d Hari Bathini 2020-07-29 186 * first 64K bytes of memory.
cb350c1f1f867d Hari Bathini 2020-07-29 187 */
cb350c1f1f867d Hari Bathini 2020-07-29 188 ret = add_rtas_mem_range(mem_ranges);
cb350c1f1f867d Hari Bathini 2020-07-29 189 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 190 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 191
cb350c1f1f867d Hari Bathini 2020-07-29 192 ret = add_opal_mem_range(mem_ranges);
cb350c1f1f867d Hari Bathini 2020-07-29 193 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 194 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 195
cb350c1f1f867d Hari Bathini 2020-07-29 196 /* create a separate program header for the
backup region */
cb350c1f1f867d Hari Bathini 2020-07-29 197 ret = add_mem_range(mem_ranges,
BACKUP_SRC_START, BACKUP_SRC_SIZE);
cb350c1f1f867d Hari Bathini 2020-07-29 198 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 199 goto out;
cb350c1f1f867d Hari Bathini 2020-07-29 200
cb350c1f1f867d Hari Bathini 2020-07-29 201 sort_memory_ranges(*mem_ranges, false);
cb350c1f1f867d Hari Bathini 2020-07-29 202 out:
cb350c1f1f867d Hari Bathini 2020-07-29 203 if (ret)
cb350c1f1f867d Hari Bathini 2020-07-29 204 pr_err("Failed to setup crash memory
ranges\n");
cb350c1f1f867d Hari Bathini 2020-07-29 205 return ret;
cb350c1f1f867d Hari Bathini 2020-07-29 206 }
cb350c1f1f867d Hari Bathini 2020-07-29 207
:::::: The code at line 145 was first introduced by commit
:::::: cb350c1f1f867db16725f1bb06be033ece19e998 powerpc/kexec_file: Prepare elfcore header
for crashing kernel
:::::: 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