Document/kexec: generalize crash hotplug description
Commit 79365026f8
("crash: add a new kexec flag for hotplug support")
generalizes the crash hotplug support to allow architectures to update
multiple kexec segments on CPU/Memory hotplug and not just elfcorehdr.
Therefore, update the relevant kernel documentation to reflect the same.
No functional change.
Link: https://lkml.kernel.org/r/20240812041651.703156-1-sourabhjain@linux.ibm.com
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Reviewed-by: Petr Tesarik <ptesarik@suse.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Petr Tesarik <petr@tesarici.cz>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
caaab56609
commit
c91c6062d6
@ -115,6 +115,6 @@ What: /sys/devices/system/memory/crash_hotplug
|
|||||||
Date: Aug 2023
|
Date: Aug 2023
|
||||||
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
|
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
|
||||||
Description:
|
Description:
|
||||||
(RO) indicates whether or not the kernel directly supports
|
(RO) indicates whether or not the kernel updates relevant kexec
|
||||||
modifying the crash elfcorehdr for memory hot un/plug and/or
|
segments on memory hot un/plug and/or on/offline events, avoiding the
|
||||||
on/offline changes.
|
need to reload kdump kernel.
|
||||||
|
@ -704,9 +704,9 @@ What: /sys/devices/system/cpu/crash_hotplug
|
|||||||
Date: Aug 2023
|
Date: Aug 2023
|
||||||
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
|
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
|
||||||
Description:
|
Description:
|
||||||
(RO) indicates whether or not the kernel directly supports
|
(RO) indicates whether or not the kernel updates relevant kexec
|
||||||
modifying the crash elfcorehdr for CPU hot un/plug and/or
|
segments on memory hot un/plug and/or on/offline events, avoiding the
|
||||||
on/offline changes.
|
need to reload kdump kernel.
|
||||||
|
|
||||||
What: /sys/devices/system/cpu/enabled
|
What: /sys/devices/system/cpu/enabled
|
||||||
Date: Nov 2022
|
Date: Nov 2022
|
||||||
|
@ -294,8 +294,9 @@ The following files are currently defined:
|
|||||||
``crash_hotplug`` read-only: when changes to the system memory map
|
``crash_hotplug`` read-only: when changes to the system memory map
|
||||||
occur due to hot un/plug of memory, this file contains
|
occur due to hot un/plug of memory, this file contains
|
||||||
'1' if the kernel updates the kdump capture kernel memory
|
'1' if the kernel updates the kdump capture kernel memory
|
||||||
map itself (via elfcorehdr), or '0' if userspace must update
|
map itself (via elfcorehdr and other relevant kexec
|
||||||
the kdump capture kernel memory map.
|
segments), or '0' if userspace must update the kdump
|
||||||
|
capture kernel memory map.
|
||||||
|
|
||||||
Availability depends on the CONFIG_MEMORY_HOTPLUG kernel
|
Availability depends on the CONFIG_MEMORY_HOTPLUG kernel
|
||||||
configuration option.
|
configuration option.
|
||||||
|
@ -737,8 +737,9 @@ can process the event further.
|
|||||||
|
|
||||||
When changes to the CPUs in the system occur, the sysfs file
|
When changes to the CPUs in the system occur, the sysfs file
|
||||||
/sys/devices/system/cpu/crash_hotplug contains '1' if the kernel
|
/sys/devices/system/cpu/crash_hotplug contains '1' if the kernel
|
||||||
updates the kdump capture kernel list of CPUs itself (via elfcorehdr),
|
updates the kdump capture kernel list of CPUs itself (via elfcorehdr and
|
||||||
or '0' if userspace must update the kdump capture kernel list of CPUs.
|
other relevant kexec segment), or '0' if userspace must update the kdump
|
||||||
|
capture kernel list of CPUs.
|
||||||
|
|
||||||
The availability depends on the CONFIG_HOTPLUG_CPU kernel configuration
|
The availability depends on the CONFIG_HOTPLUG_CPU kernel configuration
|
||||||
option.
|
option.
|
||||||
@ -750,8 +751,9 @@ file can be used in a udev rule as follows:
|
|||||||
SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
|
SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
|
||||||
|
|
||||||
For a CPU hot un/plug event, if the architecture supports kernel updates
|
For a CPU hot un/plug event, if the architecture supports kernel updates
|
||||||
of the elfcorehdr (which contains the list of CPUs), then the rule skips
|
of the elfcorehdr (which contains the list of CPUs) and other relevant
|
||||||
the unload-then-reload of the kdump capture kernel.
|
kexec segments, then the rule skips the unload-then-reload of the kdump
|
||||||
|
capture kernel.
|
||||||
|
|
||||||
Kernel Inline Documentations Reference
|
Kernel Inline Documentations Reference
|
||||||
======================================
|
======================================
|
||||||
|
@ -505,7 +505,7 @@ int crash_check_hotplug_support(void)
|
|||||||
crash_hotplug_lock();
|
crash_hotplug_lock();
|
||||||
/* Obtain lock while reading crash information */
|
/* Obtain lock while reading crash information */
|
||||||
if (!kexec_trylock()) {
|
if (!kexec_trylock()) {
|
||||||
pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n");
|
pr_info("kexec_trylock() failed, kdump image may be inaccurate\n");
|
||||||
crash_hotplug_unlock();
|
crash_hotplug_unlock();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -520,18 +520,25 @@ int crash_check_hotplug_support(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To accurately reflect hot un/plug changes of cpu and memory resources
|
* To accurately reflect hot un/plug changes of CPU and Memory resources
|
||||||
* (including onling and offlining of those resources), the elfcorehdr
|
* (including onling and offlining of those resources), the relevant
|
||||||
* (which is passed to the crash kernel via the elfcorehdr= parameter)
|
* kexec segments must be updated with latest CPU and Memory resources.
|
||||||
* must be updated with the new list of CPUs and memories.
|
|
||||||
*
|
*
|
||||||
* In order to make changes to elfcorehdr, two conditions are needed:
|
* Architectures must ensure two things for all segments that need
|
||||||
* First, the segment containing the elfcorehdr must be large enough
|
* updating during hotplug events:
|
||||||
* to permit a growing number of resources; the elfcorehdr memory size
|
*
|
||||||
* is based on NR_CPUS_DEFAULT and CRASH_MAX_MEMORY_RANGES.
|
* 1. Segments must be large enough to accommodate a growing number of
|
||||||
* Second, purgatory must explicitly exclude the elfcorehdr from the
|
* resources.
|
||||||
* list of segments it checks (since the elfcorehdr changes and thus
|
* 2. Exclude the segments from SHA verification.
|
||||||
* would require an update to purgatory itself to update the digest).
|
*
|
||||||
|
* For example, on most architectures, the elfcorehdr (which is passed
|
||||||
|
* to the crash kernel via the elfcorehdr= parameter) must include the
|
||||||
|
* new list of CPUs and memory. To make changes to the elfcorehdr, it
|
||||||
|
* should be large enough to permit a growing number of CPU and Memory
|
||||||
|
* resources. One can estimate the elfcorehdr memory size based on
|
||||||
|
* NR_CPUS_DEFAULT and CRASH_MAX_MEMORY_RANGES. The elfcorehdr is
|
||||||
|
* excluded from SHA verification by default if the architecture
|
||||||
|
* supports crash hotplug.
|
||||||
*/
|
*/
|
||||||
static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu, void *arg)
|
static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu, void *arg)
|
||||||
{
|
{
|
||||||
@ -540,7 +547,7 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu,
|
|||||||
crash_hotplug_lock();
|
crash_hotplug_lock();
|
||||||
/* Obtain lock while changing crash information */
|
/* Obtain lock while changing crash information */
|
||||||
if (!kexec_trylock()) {
|
if (!kexec_trylock()) {
|
||||||
pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n");
|
pr_info("kexec_trylock() failed, kdump image may be inaccurate\n");
|
||||||
crash_hotplug_unlock();
|
crash_hotplug_unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user