* Re: [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation
[not found] <20260226130437.1867658-5-ruanjinjie@huawei.com>
@ 2026-02-26 20:34 ` kernel test robot
2026-02-27 2:13 ` Jinjie Ruan
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-02-26 20:34 UTC (permalink / raw)
To: Jinjie Ruan, corbet, skhan, catalin.marinas, will, chenhuacai,
kernel, maddy, mpe, npiggin, chleroy, pjw, palmer, aou, alex,
tglx, mingo, bp, dave.hansen, hpa, robh, saravanak, akpm, bhe,
vgoyal, dyoung, pmladek, rdunlap, dapeng1.mi, kees, paulmck
Cc: llvm, oe-kbuild-all
Hi Jinjie,
kernel test robot noticed the following build warnings:
[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on robh/for-next linus/master v7.0-rc1 next-20260226]
[cannot apply to powerpc/next powerpc/fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jinjie-Ruan/powerpc-crash-sort-crash-memory-ranges-before-preparing-elfcorehdr/20260226-222516
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link: https://lore.kernel.org/r/20260226130437.1867658-5-ruanjinjie%40huawei.com
patch subject: [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation
config: x86_64-buildonly-randconfig-004-20260226 (https://download.01.org/0day-ci/archive/20260227/202602270403.GagykAb8-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260227/202602270403.GagykAb8-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602270403.GagykAb8-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/of/kexec.c:312:29: warning: unused variable 'i' [-Wunused-variable]
312 | int ret, chosen_node, len, i;
| ^
1 warning generated.
vim +/i +312 drivers/of/kexec.c
294
295 /*
296 * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree
297 *
298 * @image: kexec image being loaded.
299 * @initrd_load_addr: Address where the next initrd will be loaded.
300 * @initrd_len: Size of the next initrd, or 0 if there will be none.
301 * @cmdline: Command line for the next kernel, or NULL if there will
302 * be none.
303 * @extra_fdt_size: Additional size for the new FDT buffer.
304 *
305 * Return: fdt on success, or NULL errno on error.
306 */
307 void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
308 unsigned long initrd_load_addr,
309 unsigned long initrd_len,
310 const char *cmdline, size_t extra_fdt_size)
311 {
> 312 int ret, chosen_node, len, i;
313 const void *prop;
314 size_t fdt_size;
315 void *fdt;
316
317 fdt_size = fdt_totalsize(initial_boot_params) +
318 (cmdline ? strlen(cmdline) : 0) +
319 FDT_EXTRA_SPACE +
320 extra_fdt_size;
321 fdt = kvmalloc(fdt_size, GFP_KERNEL);
322 if (!fdt)
323 return NULL;
324
325 ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
326 if (ret < 0) {
327 pr_err("Error %d setting up the new device tree.\n", ret);
328 goto out;
329 }
330
331 /* Remove memory reservation for the current device tree. */
332 ret = fdt_find_and_del_mem_rsv(fdt, initial_boot_params_pa,
333 fdt_totalsize(initial_boot_params));
334 if (ret == -EINVAL) {
335 pr_err("Error removing memory reservation.\n");
336 goto out;
337 }
338
339 chosen_node = fdt_path_offset(fdt, "/chosen");
340 if (chosen_node == -FDT_ERR_NOTFOUND)
341 chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
342 "chosen");
343 if (chosen_node < 0) {
344 ret = chosen_node;
345 goto out;
346 }
347
348 ret = fdt_delprop(fdt, chosen_node, "linux,elfcorehdr");
349 if (ret && ret != -FDT_ERR_NOTFOUND)
350 goto out;
351 ret = fdt_delprop(fdt, chosen_node, "linux,usable-memory-range");
352 if (ret && ret != -FDT_ERR_NOTFOUND)
353 goto out;
354
355 /* Did we boot using an initrd? */
356 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", &len);
357 if (prop) {
358 u64 tmp_start, tmp_end, tmp_size;
359
360 tmp_start = of_read_number(prop, len / 4);
361
362 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", &len);
363 if (!prop) {
364 ret = -EINVAL;
365 goto out;
366 }
367
368 tmp_end = of_read_number(prop, len / 4);
369
370 /*
371 * kexec reserves exact initrd size, while firmware may
372 * reserve a multiple of PAGE_SIZE, so check for both.
373 */
374 tmp_size = tmp_end - tmp_start;
375 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size);
376 if (ret == -ENOENT)
377 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start,
378 round_up(tmp_size, PAGE_SIZE));
379 if (ret == -EINVAL)
380 goto out;
381 }
382
383 /* add initrd-* */
384 if (initrd_load_addr) {
385 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-start",
386 initrd_load_addr);
387 if (ret)
388 goto out;
389
390 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end",
391 initrd_load_addr + initrd_len);
392 if (ret)
393 goto out;
394
395 ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
396 if (ret)
397 goto out;
398
399 } else {
400 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-start");
401 if (ret && (ret != -FDT_ERR_NOTFOUND))
402 goto out;
403
404 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end");
405 if (ret && (ret != -FDT_ERR_NOTFOUND))
406 goto out;
407 }
408
409 if (image->type == KEXEC_TYPE_CRASH) {
410 /* add linux,elfcorehdr */
411 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
412 "linux,elfcorehdr", image->elf_load_addr,
413 image->elf_headers_sz);
414 if (ret)
415 goto out;
416
417 /*
418 * Avoid elfcorehdr from being stomped on in kdump kernel by
419 * setting up memory reserve map.
420 */
421 ret = fdt_add_mem_rsv(fdt, image->elf_load_addr,
422 image->elf_headers_sz);
423 if (ret)
424 goto out;
425
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation
2026-02-26 20:34 ` [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation kernel test robot
@ 2026-02-27 2:13 ` Jinjie Ruan
0 siblings, 0 replies; 2+ messages in thread
From: Jinjie Ruan @ 2026-02-27 2:13 UTC (permalink / raw)
To: kernel test robot, corbet, skhan, catalin.marinas, will,
chenhuacai, kernel, maddy, mpe, npiggin, chleroy, pjw, palmer,
aou, alex, tglx, mingo, bp, dave.hansen, hpa, robh, saravanak,
akpm, bhe, vgoyal, dyoung, pmladek, rdunlap, dapeng1.mi, kees,
paulmck
Cc: llvm, oe-kbuild-all
On 2026/2/27 4:34, kernel test robot wrote:
> Hi Jinjie,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on arm64/for-next/core]
> [also build test WARNING on robh/for-next linus/master v7.0-rc1 next-20260226]
> [cannot apply to powerpc/next powerpc/fixes]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Jinjie-Ruan/powerpc-crash-sort-crash-memory-ranges-before-preparing-elfcorehdr/20260226-222516
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
> patch link: https://lore.kernel.org/r/20260226130437.1867658-5-ruanjinjie%40huawei.com
> patch subject: [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation
> config: x86_64-buildonly-randconfig-004-20260226 (https://download.01.org/0day-ci/archive/20260227/202602270403.GagykAb8-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260227/202602270403.GagykAb8-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202602270403.GagykAb8-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/of/kexec.c:312:29: warning: unused variable 'i' [-Wunused-variable]
> 312 | int ret, chosen_node, len, i;
> | ^
> 1 warning generated.
>
>
> vim +/i +312 drivers/of/kexec.c
>
> 294
> 295 /*
> 296 * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree
> 297 *
> 298 * @image: kexec image being loaded.
> 299 * @initrd_load_addr: Address where the next initrd will be loaded.
> 300 * @initrd_len: Size of the next initrd, or 0 if there will be none.
> 301 * @cmdline: Command line for the next kernel, or NULL if there will
> 302 * be none.
> 303 * @extra_fdt_size: Additional size for the new FDT buffer.
> 304 *
> 305 * Return: fdt on success, or NULL errno on error.
> 306 */
> 307 void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
> 308 unsigned long initrd_load_addr,
> 309 unsigned long initrd_len,
> 310 const char *cmdline, size_t extra_fdt_size)
> 311 {
> > 312 int ret, chosen_node, len, i;
> 313 const void *prop;
> 314 size_t fdt_size;
> 315 void *fdt;
If this patch is acceptable for merging, could you please help move the
loop variable i to a different location as below to avoid resending a
new version?
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -309,10 +309,10 @@ void *of_kexec_alloc_and_setup_fdt(const struct
kimage *image,
unsigned long initrd_len,
const char *cmdline, size_t
extra_fdt_size)
{
- void *fdt;
int ret, chosen_node, len;
const void *prop;
size_t fdt_size;
+ void *fdt;
fdt_size = fdt_totalsize(initial_boot_params) +
(cmdline ? strlen(cmdline) : 0) +
@@ -431,6 +431,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct
kimage *image,
if (ret)
goto out;
+ for (int i = 0; i < crashk_cma_cnt; i++) {
+ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
+ "linux,usable-memory-range",
+ crashk_cma_ranges[i].start,
+ crashk_cma_ranges[i].end -
crashk_cma_ranges[i].start + 1);
+ if (ret)
+ goto out;
+ }
+
if (crashk_low_res.end) {
ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
"linux,usable-memory-range",
> 316
> 317 fdt_size = fdt_totalsize(initial_boot_params) +
> 318 (cmdline ? strlen(cmdline) : 0) +
> 319 FDT_EXTRA_SPACE +
> 320 extra_fdt_size;
> 321 fdt = kvmalloc(fdt_size, GFP_KERNEL);
> 322 if (!fdt)
> 323 return NULL;
> 324
> 325 ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
> 326 if (ret < 0) {
> 327 pr_err("Error %d setting up the new device tree.\n", ret);
> 328 goto out;
> 329 }
> 330
> 331 /* Remove memory reservation for the current device tree. */
> 332 ret = fdt_find_and_del_mem_rsv(fdt, initial_boot_params_pa,
> 333 fdt_totalsize(initial_boot_params));
> 334 if (ret == -EINVAL) {
> 335 pr_err("Error removing memory reservation.\n");
> 336 goto out;
> 337 }
> 338
> 339 chosen_node = fdt_path_offset(fdt, "/chosen");
> 340 if (chosen_node == -FDT_ERR_NOTFOUND)
> 341 chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
> 342 "chosen");
> 343 if (chosen_node < 0) {
> 344 ret = chosen_node;
> 345 goto out;
> 346 }
> 347
> 348 ret = fdt_delprop(fdt, chosen_node, "linux,elfcorehdr");
> 349 if (ret && ret != -FDT_ERR_NOTFOUND)
> 350 goto out;
> 351 ret = fdt_delprop(fdt, chosen_node, "linux,usable-memory-range");
> 352 if (ret && ret != -FDT_ERR_NOTFOUND)
> 353 goto out;
> 354
> 355 /* Did we boot using an initrd? */
> 356 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", &len);
> 357 if (prop) {
> 358 u64 tmp_start, tmp_end, tmp_size;
> 359
> 360 tmp_start = of_read_number(prop, len / 4);
> 361
> 362 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", &len);
> 363 if (!prop) {
> 364 ret = -EINVAL;
> 365 goto out;
> 366 }
> 367
> 368 tmp_end = of_read_number(prop, len / 4);
> 369
> 370 /*
> 371 * kexec reserves exact initrd size, while firmware may
> 372 * reserve a multiple of PAGE_SIZE, so check for both.
> 373 */
> 374 tmp_size = tmp_end - tmp_start;
> 375 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size);
> 376 if (ret == -ENOENT)
> 377 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start,
> 378 round_up(tmp_size, PAGE_SIZE));
> 379 if (ret == -EINVAL)
> 380 goto out;
> 381 }
> 382
> 383 /* add initrd-* */
> 384 if (initrd_load_addr) {
> 385 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-start",
> 386 initrd_load_addr);
> 387 if (ret)
> 388 goto out;
> 389
> 390 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end",
> 391 initrd_load_addr + initrd_len);
> 392 if (ret)
> 393 goto out;
> 394
> 395 ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
> 396 if (ret)
> 397 goto out;
> 398
> 399 } else {
> 400 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-start");
> 401 if (ret && (ret != -FDT_ERR_NOTFOUND))
> 402 goto out;
> 403
> 404 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end");
> 405 if (ret && (ret != -FDT_ERR_NOTFOUND))
> 406 goto out;
> 407 }
> 408
> 409 if (image->type == KEXEC_TYPE_CRASH) {
> 410 /* add linux,elfcorehdr */
> 411 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
> 412 "linux,elfcorehdr", image->elf_load_addr,
> 413 image->elf_headers_sz);
> 414 if (ret)
> 415 goto out;
> 416
> 417 /*
> 418 * Avoid elfcorehdr from being stomped on in kdump kernel by
> 419 * setting up memory reserve map.
> 420 */
> 421 ret = fdt_add_mem_rsv(fdt, image->elf_load_addr,
> 422 image->elf_headers_sz);
> 423 if (ret)
> 424 goto out;
> 425
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-27 2:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260226130437.1867658-5-ruanjinjie@huawei.com>
2026-02-26 20:34 ` [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation kernel test robot
2026-02-27 2:13 ` Jinjie Ruan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox