mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Rui Qi <qirui.001@bytedance.com>,
	palmer@dabbelt.com, pjw@kernel.org, aou@eecs.berkeley.edu,
	alex@ghiti.fr
Cc: oe-kbuild-all@lists.linux.dev, Rui Qi <qirui.001@bytedance.com>,
	Deepak Gupta <debug@rivosinc.com>, Kees Cook <kees@kernel.org>,
	Charles Mirabile <cmirabil@redhat.com>,
	Drew Fustini <fustini@kernel.org>,
	Martin Kaiser <martin@kaiser.cx>,
	"open list:RISC-V ARCHITECTURE" <linux-riscv@lists.infradead.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] riscv: crash: Add crash hotplug support
Date: Thu, 10 Sep 2026 05:30:19 +0800	[thread overview]
Message-ID: <202609100553.E6HUYviI-lkp@intel.com> (raw)
In-Reply-To: <20260908125155.1777895-1-qirui.001@bytedance.com>

Hi Rui,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/kspp]
[also build test ERROR on linus/master kees/for-next/pstore v7.3-rc2 next-20260909]
[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/Rui-Qi/riscv-crash-Add-crash-hotplug-support/20260908-205143
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/kspp
patch link:    https://lore.kernel.org/r/20260908125155.1777895-1-qirui.001%40bytedance.com
patch subject: [PATCH] riscv: crash: Add crash hotplug support
config: riscv-randconfig-r071-20260910 (https://download.01.org/0day-ci/archive/20260910/202609100553.E6HUYviI-lkp@intel.com/config)
compiler: clang version 21.1.8 (https://github.com/llvm/llvm-project 2078da43e25a4623cab2d0d60decddf709aaea28)
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260910/202609100553.E6HUYviI-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/202609100553.E6HUYviI-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from kernel/crash_reserve.c:12:
   In file included from include/linux/kexec.h:38:
>> arch/riscv/include/asm/kexec.h:79:45: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |                                             ^
   arch/riscv/include/asm/kexec.h:82:39: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |                                       ^
   2 warnings generated.
--
   In file included from kernel/kexec.c:13:
   In file included from include/linux/kexec.h:38:
>> arch/riscv/include/asm/kexec.h:79:45: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |                                             ^
   arch/riscv/include/asm/kexec.h:82:39: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |                                       ^
>> kernel/kexec.c:138:61: error: incompatible pointer types passing 'struct kimage *' to parameter of type 'struct kimage *' [-Werror,-Wincompatible-pointer-types]
     138 |         if ((flags & KEXEC_ON_CRASH) && arch_crash_hotplug_support(image, flags))
         |                                                                    ^~~~~
   arch/riscv/include/asm/kexec.h:82:47: note: passing argument to parameter 'image' here
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |                                               ^
   2 warnings and 1 error generated.
--
   In file included from kernel/crash_core.c:14:
   In file included from include/linux/kexec.h:38:
>> arch/riscv/include/asm/kexec.h:79:45: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |                                             ^
   arch/riscv/include/asm/kexec.h:82:39: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |                                       ^
>> kernel/crash_core.c:718:34: error: incompatible pointer types passing 'struct kimage *' to parameter of type 'struct kimage *' [-Werror,-Wincompatible-pointer-types]
     718 |         arch_crash_handle_hotplug_event(image, arg);
         |                                         ^~~~~
   arch/riscv/include/asm/kexec.h:79:53: note: passing argument to parameter 'image' here
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |                                                     ^
   2 warnings and 1 error generated.
--
   In file included from arch/riscv/kernel/crash.c:8:
   In file included from include/linux/kexec.h:38:
>> arch/riscv/include/asm/kexec.h:79:45: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |                                             ^
   arch/riscv/include/asm/kexec.h:82:39: warning: declaration of 'struct kimage' will not be visible outside of this function [-Wvisibility]
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |                                       ^
>> arch/riscv/kernel/crash.c:18:5: error: conflicting types for 'arch_crash_hotplug_support'
      18 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags)
         |     ^
   arch/riscv/include/asm/kexec.h:83:36: note: expanded from macro 'arch_crash_hotplug_support'
      83 | #define arch_crash_hotplug_support arch_crash_hotplug_support
         |                                    ^
   arch/riscv/include/asm/kexec.h:82:5: note: previous declaration is here
      82 | int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags);
         |     ^
>> arch/riscv/kernel/crash.c:53:6: error: conflicting types for 'arch_crash_handle_hotplug_event'
      53 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg)
         |      ^
   arch/riscv/include/asm/kexec.h:80:41: note: expanded from macro 'arch_crash_handle_hotplug_event'
      80 | #define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_event
         |                                         ^
   arch/riscv/include/asm/kexec.h:79:6: note: previous declaration is here
      79 | void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
         |      ^
   2 warnings and 2 errors generated.


vim +/arch_crash_hotplug_support +18 arch/riscv/kernel/crash.c

    17	
  > 18	int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags)
    19	{
    20	#ifdef CONFIG_KEXEC_FILE
    21		if (image->file_mode)
    22			return 1;
    23	#endif
    24		/*
    25		 * For the kexec_load() syscall path, the user space kexec tool
    26		 * needs to indicate that the elfcorehdr segment is excluded from
    27		 * SHA verification by setting the appropriate flags.
    28		 */
    29		return (kexec_flags & KEXEC_UPDATE_ELFCOREHDR ||
    30			kexec_flags & KEXEC_CRASH_HOTPLUG_SUPPORT);
    31	}
    32	
    33	unsigned int arch_crash_get_elfcorehdr_size(void)
    34	{
    35		unsigned int sz;
    36	
    37		/* kernel_map, VMCOREINFO and maximum CPUs */
    38		sz = 2 + CONFIG_NR_CPUS;
    39		if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
    40			sz += CONFIG_CRASH_MAX_MEMORY_RANGES;
    41		sz *= sizeof(Elf64_Phdr);
    42		return sz;
    43	}
    44	
    45	/**
    46	 * arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes
    47	 * @image: a pointer to kexec_crash_image
    48	 * @arg: struct memory_notify handler for memory hotplug case and
    49	 *       NULL for CPU hotplug case.
    50	 *
    51	 * Prepare the new elfcorehdr and replace the existing elfcorehdr.
    52	 */
  > 53	void arch_crash_handle_hotplug_event(struct kimage *image, void *arg)
    54	{
    55		void *elfbuf = NULL, *old_elfcorehdr;
    56		unsigned long mem, memsz;
    57		unsigned long elfsz = 0;
    58	
    59		/*
    60		 * As crash_prepare_elf64_headers() has already described all
    61		 * possible CPUs, there is no need to update the elfcorehdr
    62		 * for additional CPU changes.
    63		 */
    64		if ((image->file_mode || image->elfcorehdr_updated) &&
    65			((image->hp_action == KEXEC_CRASH_HP_ADD_CPU) ||
    66			(image->hp_action == KEXEC_CRASH_HP_REMOVE_CPU)))
    67			return;
    68	
    69		/*
    70		 * Create the new elfcorehdr reflecting the changes to CPU and/or
    71		 * memory resources.
    72		 */
    73		if (crash_prepare_headers(true, &elfbuf, &elfsz, NULL)) {
    74			pr_err("unable to create new elfcorehdr");
    75			goto out;
    76		}
    77	
    78		/*
    79		 * Obtain address and size of the elfcorehdr segment, and
    80		 * check it against the new elfcorehdr buffer.
    81		 */
    82		mem = image->segment[image->elfcorehdr_index].mem;
    83		memsz = image->segment[image->elfcorehdr_index].memsz;
    84		if (elfsz > memsz) {
    85			pr_err("update elfcorehdr elfsz %lu > memsz %lu",
    86				elfsz, memsz);
    87			goto out;
    88		}
    89	
    90		/*
    91		 * Copy new elfcorehdr over the old elfcorehdr at destination.
    92		 */
    93		old_elfcorehdr = kmap_local_page(pfn_to_page(mem >> PAGE_SHIFT));
    94		if (!old_elfcorehdr) {
    95			pr_err("mapping elfcorehdr segment failed\n");
    96			goto out;
    97		}
    98	
    99		/*
   100		 * Temporarily invalidate the crash image while the
   101		 * elfcorehdr is updated.
   102		 */
   103		xchg(&kexec_crash_image, NULL);
   104		memcpy_flushcache(old_elfcorehdr, elfbuf, elfsz);
   105		xchg(&kexec_crash_image, image);
   106		kunmap_local(old_elfcorehdr);
   107		pr_debug("updated elfcorehdr\n");
   108	
   109	out:
   110		vfree(elfbuf);
   111	}
   112	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      reply	other threads:[~2026-09-09 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 12:51 Rui Qi
2026-09-09 21:30 ` kernel test robot [this message]

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=202609100553.E6HUYviI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=cmirabil@redhat.com \
    --cc=debug@rivosinc.com \
    --cc=fustini@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=martin@kaiser.cx \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=qirui.001@bytedance.com \
    /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

all inboxes | Powered by JetHome®