kexec: optimize crash hotplug by filtering redundant FDT updates
Subsystems (5)
RFC PATCH 1/1 kexec: optimize crash hotplug by filtering redundant FDT updates
The arch_crash_handle_hotplug_event() interface currently lacks the CPU index associated with hotplug events. This forces architecture handlers, specifically on PowerPC, to unconditionally update the crash Flattened Device Tree (FDT) for every CPU online event which should only be done in case of DLPAR operations which add/remove new device tree node under the /cpus. On large systems with crash kernel loaded, this behavior causes a significant performance bottleneck. For example, during SMT switch operations involving 1400 CPUs, the redundant execution of update_crash_fdt() adds over half an hour of overhead
As shown in the ftrace function graph:
83) bash-14351 | $ 2283891 us | } /* update_cpus_node */
This patch passes the CPU index to the arch-specific handlers and modifies the PowerPC implementation to check cpus_booted_once_mask. If a CPU has been previously initialized, its FDT node is already present, allowing the handler to skip the redundant update_crash_fdt() call.
--- arch/powerpc/include/asm/kexec.h | 2 +- arch/powerpc/kexec/crash.c | 5 +++-- arch/x86/include/asm/kexec.h | 2 +- arch/x86/kernel/crash.c | 2 +- include/linux/crash_core.h | 2 +- kernel/crash_core.c | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/kexec.h +1 -1
@@ -137,7 +137,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs, }#ifdef CONFIG_CRASH_HOTPLUG -void arch_crash_handle_hotplug_event (struct kimage *image,void *arg); +void arch_crash_handle_hotplug_event (struct kimage *image,int cpu,void *arg);#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_eventint arch_crash_hotplug_support (struct kimage *image,unsigned long kexec_flags);
arch/powerpc/kexec/crash.c +3 -2
@@ -568,7 +568,7 @@ int arch_crash_hotplug_support(struct kimage *image, unsigned long kexec_flags)* part of the FDT. * Memory add/remove: No action is taken as this is not yet supported. */ -void arch_crash_handle_hotplug_event (struct kimage *image,void *arg) +void arch_crash_handle_hotplug_event (struct kimage *image,int cpu,void *arg) {struct memory_notify *mn;
@@ -577,7 +577,8 @@ void arch_crash_handle_hotplug_event(struct kimage *image, void *arg)return ;case KEXEC_CRASH_HP_ADD_CPU : -update_crash_fdt (image); +if (!cpumask_test_cpu (cpu, &cpus_booted_once_mask)) +update_crash_fdt (image);break ;case KEXEC_CRASH_HP_REMOVE_MEMORY :
arch/x86/include/asm/kexec.h +1 -1
@@ -222,7 +222,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image);extern void kdump_nmi_shootdown_cpus (void );#ifdef CONFIG_CRASH_HOTPLUG -void arch_crash_handle_hotplug_event (struct kimage *image,void *arg); +void arch_crash_handle_hotplug_event (struct kimage *image,int cpu,void *arg);#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_eventint arch_crash_hotplug_support (struct kimage *image,unsigned long kexec_flags);
arch/x86/kernel/crash.c +1 -1
@@ -508,7 +508,7 @@ unsigned int arch_crash_get_elfcorehdr_size(void)* * Prepare the new elfcorehdr and replace the existing elfcorehdr. */ -void arch_crash_handle_hotplug_event (struct kimage *image,void *arg) +void arch_crash_handle_hotplug_event (struct kimage *image,int cpu,void *arg) {void *elfbuf =NULL , *old_elfcorehdr;unsigned long nr_mem_ranges;
include/linux/crash_core.h +1 -1
@@ -42,7 +42,7 @@ static inline int crash_load_dm_crypt_keys(struct kimage *image) {return 0; }#endif #ifndef arch_crash_handle_hotplug_event -static inline void arch_crash_handle_hotplug_event (struct kimage *image,void *arg) { } +static inline void arch_crash_handle_hotplug_event (struct kimage *image,int cpu,void *arg) { }#endif int crash_check_hotplug_support (void );
kernel/crash_core.c +1 -1
@@ -634,7 +634,7 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu, image->hp_action = hp_action;/* Now invoke arch-specific update handler */ -arch_crash_handle_hotplug_event (image, arg); +arch_crash_handle_hotplug_event (image, cpu, arg);/* No longer handling a hotplug event */ image->hp_action =KEXEC_CRASH_HP_NONE ;
Signature · 1 line
2.53.0
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Vishal,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next]
[also build test WARNING on powerpc/fixes tip/x86/core akpm-mm/mm-everything linus/master v6.19 next-20260216] [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/Vishal-Chourasia/kexec-optimize-crash-hotplug-by-filtering-redundant-FDT-updates/20260217-012054 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next patch link: https://lore.kernel.org/r/20260216171456.527608-2-vishalc%40linux.ibm.com patch subject: [RFC PATCH v1] kexec: optimize crash hotplug by filtering redundant FDT updates config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20260217/[email protected]/config) compiler: powerpc64-linux-gcc (GCC) 15.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260217/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: arch/powerpc/kexec/crash.c:571 function parameter 'cpu' not described in 'arch_crash_handle_hotplug_event' >> Warning: arch/powerpc/kexec/crash.c:571 function parameter 'cpu' not described in 'arch_crash_handle_hotplug_event'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Vishal,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next]
[also build test WARNING on powerpc/fixes tip/x86/core akpm-mm/mm-everything linus/master v6.19 next-20260216] [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/Vishal-Chourasia/kexec-optimize-crash-hotplug-by-filtering-redundant-FDT-updates/20260217-012054 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next patch link: https://lore.kernel.org/r/20260216171456.527608-2-vishalc%40linux.ibm.com patch subject: [RFC PATCH v1] kexec: optimize crash hotplug by filtering redundant FDT updates config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20260217/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260217/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: arch/x86/kernel/crash.c:511 function parameter 'cpu' not described in 'arch_crash_handle_hotplug_event' >> Warning: arch/x86/kernel/crash.c:511 function parameter 'cpu' not described in 'arch_crash_handle_hotplug_event'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki