mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
crash: forward memory_notify arg to arch crash hotplug handler
In the event of memory hotplug or online/offline events, the crash memory hotplug notifier `crash_memhp_notifier()` receives a `memory_notify` object but doesn't forward that object to the generic and architecture-specific crash hotplug handler. The `memory_notify` object contains the starting PFN (Page Frame Number) and the number of pages in the hot-removed memory. This information is necessary for architectures like PowerPC to update/recreate the kdump image, specifically `elfcorehdr`. So update the function signature of `crash_handle_hotplug_event()` and `arch_crash_handle_hotplug_event()` to accept the `memory_notify` object as an argument from crash memory hotplug notifier. Since no such object is available in the case of CPU hotplug event, the crash CPU hotplug notifier `crash_cpuhp_online()` passes NULL to the crash hotplug handler. Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> Acked-by: Baoquan He <bhe@redhat.com> Acked-by: Hari Bathini <hbathini@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240326055413.186534-2-sourabhjain@linux.ibm.com
This commit is contained in:
parent
39cd87c4eb
commit
118005713e
@ -207,7 +207,7 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image);
|
|||||||
extern void kdump_nmi_shootdown_cpus(void);
|
extern void kdump_nmi_shootdown_cpus(void);
|
||||||
|
|
||||||
#ifdef CONFIG_CRASH_HOTPLUG
|
#ifdef CONFIG_CRASH_HOTPLUG
|
||||||
void arch_crash_handle_hotplug_event(struct kimage *image);
|
void arch_crash_handle_hotplug_event(struct kimage *image, void *arg);
|
||||||
#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_event
|
#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_event
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
@ -432,10 +432,12 @@ unsigned int arch_crash_get_elfcorehdr_size(void)
|
|||||||
/**
|
/**
|
||||||
* arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes
|
* arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes
|
||||||
* @image: a pointer to kexec_crash_image
|
* @image: a pointer to kexec_crash_image
|
||||||
|
* @arg: struct memory_notify handler for memory hotplug case and
|
||||||
|
* NULL for CPU hotplug case.
|
||||||
*
|
*
|
||||||
* Prepare the new elfcorehdr and replace the existing elfcorehdr.
|
* Prepare the new elfcorehdr and replace the existing elfcorehdr.
|
||||||
*/
|
*/
|
||||||
void arch_crash_handle_hotplug_event(struct kimage *image)
|
void arch_crash_handle_hotplug_event(struct kimage *image, void *arg)
|
||||||
{
|
{
|
||||||
void *elfbuf = NULL, *old_elfcorehdr;
|
void *elfbuf = NULL, *old_elfcorehdr;
|
||||||
unsigned long nr_mem_ranges;
|
unsigned long nr_mem_ranges;
|
||||||
|
@ -37,7 +37,7 @@ static inline void arch_kexec_unprotect_crashkres(void) { }
|
|||||||
|
|
||||||
|
|
||||||
#ifndef arch_crash_handle_hotplug_event
|
#ifndef arch_crash_handle_hotplug_event
|
||||||
static inline void arch_crash_handle_hotplug_event(struct kimage *image) { }
|
static inline void arch_crash_handle_hotplug_event(struct kimage *image, void *arg) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int crash_check_update_elfcorehdr(void);
|
int crash_check_update_elfcorehdr(void);
|
||||||
|
@ -534,7 +534,7 @@ int crash_check_update_elfcorehdr(void)
|
|||||||
* list of segments it checks (since the elfcorehdr changes and thus
|
* list of segments it checks (since the elfcorehdr changes and thus
|
||||||
* would require an update to purgatory itself to update the digest).
|
* would require an update to purgatory itself to update the digest).
|
||||||
*/
|
*/
|
||||||
static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu)
|
static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu, void *arg)
|
||||||
{
|
{
|
||||||
struct kimage *image;
|
struct kimage *image;
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu)
|
|||||||
image->hp_action = hp_action;
|
image->hp_action = hp_action;
|
||||||
|
|
||||||
/* Now invoke arch-specific update handler */
|
/* Now invoke arch-specific update handler */
|
||||||
arch_crash_handle_hotplug_event(image);
|
arch_crash_handle_hotplug_event(image, arg);
|
||||||
|
|
||||||
/* No longer handling a hotplug event */
|
/* No longer handling a hotplug event */
|
||||||
image->hp_action = KEXEC_CRASH_HP_NONE;
|
image->hp_action = KEXEC_CRASH_HP_NONE;
|
||||||
@ -612,17 +612,17 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu)
|
|||||||
crash_hotplug_unlock();
|
crash_hotplug_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int crash_memhp_notifier(struct notifier_block *nb, unsigned long val, void *v)
|
static int crash_memhp_notifier(struct notifier_block *nb, unsigned long val, void *arg)
|
||||||
{
|
{
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case MEM_ONLINE:
|
case MEM_ONLINE:
|
||||||
crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_MEMORY,
|
crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_MEMORY,
|
||||||
KEXEC_CRASH_HP_INVALID_CPU);
|
KEXEC_CRASH_HP_INVALID_CPU, arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MEM_OFFLINE:
|
case MEM_OFFLINE:
|
||||||
crash_handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_MEMORY,
|
crash_handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_MEMORY,
|
||||||
KEXEC_CRASH_HP_INVALID_CPU);
|
KEXEC_CRASH_HP_INVALID_CPU, arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return NOTIFY_OK;
|
return NOTIFY_OK;
|
||||||
@ -635,13 +635,13 @@ static struct notifier_block crash_memhp_nb = {
|
|||||||
|
|
||||||
static int crash_cpuhp_online(unsigned int cpu)
|
static int crash_cpuhp_online(unsigned int cpu)
|
||||||
{
|
{
|
||||||
crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_CPU, cpu);
|
crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_CPU, cpu, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int crash_cpuhp_offline(unsigned int cpu)
|
static int crash_cpuhp_offline(unsigned int cpu)
|
||||||
{
|
{
|
||||||
crash_handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_CPU, cpu);
|
crash_handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_CPU, cpu, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user