Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>,
	corbet@lwn.net, skhan@linuxfoundation.org,
	catalin.marinas@arm.com, will@kernel.org, chenhuacai@kernel.org,
	kernel@xen0n.name, maddy@linux.ibm.com, mpe@ellerman.id.au,
	npiggin@gmail.com, chleroy@kernel.org, pjw@kernel.org,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, robh@kernel.org,
	saravanak@kernel.org, akpm@linux-foundation.org, bhe@redhat.com,
	vgoyal@redhat.com, dyoung@redhat.com, pmladek@suse.com,
	rdunlap@infradead.org, dapeng1.mi@linux.intel.com,
	kees@kernel.org, paulmck@kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation
Date: Fri, 27 Feb 2026 04:34:14 +0800	[thread overview]
Message-ID: <202602270403.GagykAb8-lkp@intel.com> (raw)
In-Reply-To: <20260226130437.1867658-5-ruanjinjie@huawei.com>

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

       reply	other threads:[~2026-02-26 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260226130437.1867658-5-ruanjinjie@huawei.com>
2026-02-26 20:34 ` kernel test robot [this message]
2026-02-27  2:13   ` [PATCH v7 4/5] arm64: kexec: Add support for crashkernel CMA reservation Jinjie Ruan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202602270403.GagykAb8-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kees@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=llvm@lists.linux.dev \
    --cc=maddy@linux.ibm.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=palmer@dabbelt.com \
    --cc=paulmck@kernel.org \
    --cc=pjw@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=ruanjinjie@huawei.com \
    --cc=saravanak@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=vgoyal@redhat.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox