[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240731152738.194893-1-sourabhjain@linux.ibm.com>
Date: Wed, 31 Jul 2024 20:57:38 +0530
From: Sourabh Jain <sourabhjain@...ux.ibm.com>
To: bhe@...hat.com
Cc: Sourabh Jain <sourabhjain@...ux.ibm.com>,
Hari Bathini <hbathini@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, kexec@...ts.infradead.org,
linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org, x86@...nel.org,
Sachin P Bappalige <sachinpb@...ux.vnet.ibm.com>
Subject: [PATCH] kexec/crash: no crash update when kexec in progress
The following errors are observed when kexec is done with SMT=off on
powerpc.
[ 358.458385] Removing IBM Power 842 compression device
[ 374.795734] kexec_core: Starting new kernel
[ 374.795748] kexec: Waking offline cpu 1.
[ 374.875695] crash hp: kexec_trylock() failed, elfcorehdr may be inaccurate
[ 374.935833] kexec: Waking offline cpu 2.
[ 375.015664] crash hp: kexec_trylock() failed, elfcorehdr may be inaccurate
snip..
[ 375.515823] kexec: Waking offline cpu 6.
[ 375.635667] crash hp: kexec_trylock() failed, elfcorehdr may be inaccurate
[ 375.695836] kexec: Waking offline cpu 7.
During kexec, the offline CPUs are brought online, which triggers the
crash hotplug handler `crash_handle_hotplug_event()` to update the kdump
image. Given that the system is on the kexec path and the kexec lock is
taken, the `crash_handle_hotplug_event()` function fails to take the
same lock to update the kdump image, resulting in the above error
messages.
To fix this, let's return from `crash_handle_hotplug_event()` if kexec
is in progress.
The same applies to the `crash_check_hotplug_support()` function.
Return 0 if kexec is in progress.
Cc: Hari Bathini <hbathini@...ux.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: kexec@...ts.infradead.org
Cc: linuxppc-dev@...abs.org
Cc: linux-kernel@...r.kernel.org
Cc: x86@...nel.org
Reported-by: Sachin P Bappalige <sachinpb@...ux.vnet.ibm.com>
Signed-off-by: Sourabh Jain <sourabhjain@...ux.ibm.com>
---
kernel/crash_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 63cf89393c6e..d37a16d5c3a1 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -502,6 +502,9 @@ int crash_check_hotplug_support(void)
{
int rc = 0;
+ if (kexec_in_progress)
+ return 0;
+
crash_hotplug_lock();
/* Obtain lock while reading crash information */
if (!kexec_trylock()) {
@@ -537,6 +540,9 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu,
{
struct kimage *image;
+ if (kexec_in_progress)
+ return;
+
crash_hotplug_lock();
/* Obtain lock while changing crash information */
if (!kexec_trylock()) {
--
2.45.2
Powered by blists - more mailing lists