From: Michael Ellerman <mpe@ellerman.id.au>
To: Sourabh Jain <sourabhjain@linux.ibm.com>, bhe@redhat.com
Cc: x86@kernel.org, kexec@lists.infradead.org,
linux-kernel@vger.kernel.org,
Sourabh Jain <sourabhjain@linux.ibm.com>,
Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org,
Hari Bathini <hbathini@linux.ibm.com>
Subject: Re: [PATCH] kexec/crash: no crash update when kexec in progress
Date: Thu, 01 Aug 2024 12:34:10 +1000 [thread overview]
Message-ID: <87v80lnf8d.fsf@mail.lhotse> (raw)
In-Reply-To: <20240731152738.194893-1-sourabhjain@linux.ibm.com>
Sourabh Jain <sourabhjain@linux.ibm.com> writes:
> 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.
Are they actually errors though? Do they block the actual kexec from
happening? Or are they just warnings in dmesg?
Because the fix looks like it could be racy.
cheers
> 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@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: kexec@lists.infradead.org
> Cc: linuxppc-dev@ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Cc: x86@kernel.org
> Reported-by: Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>
> Signed-off-by: Sourabh Jain <sourabhjain@linux.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
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
next parent reply other threads:[~2024-08-01 2:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240731152738.194893-1-sourabhjain@linux.ibm.com>
2024-08-01 2:34 ` Michael Ellerman [this message]
2024-08-01 6:51 ` [PATCH] kexec/crash: no crash update when kexec in progress Sourabh Jain
2024-08-19 4:15 ` Sourabh Jain
2024-08-19 6:15 ` Baoquan He
2024-08-20 6:40 ` Sourabh Jain
2024-08-30 11:17 ` Baoquan He
2024-09-04 9:25 ` Sourabh Jain
2024-09-05 3:23 ` Baoquan He
2024-09-05 8:37 ` Sourabh Jain
2024-09-08 10:30 ` Baoquan He
2024-09-09 5:05 ` Sourabh Jain
2024-09-09 5:23 ` Baoquan He
2024-09-09 5:31 ` Sourabh Jain
[not found] ` <Zqs8veRya7v/pXEt@MiWiFi-R3L-srv>
2024-08-01 8:06 ` Sourabh Jain
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=87v80lnf8d.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=bhe@redhat.com \
--cc=hbathini@linux.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=sachinpb@linux.vnet.ibm.com \
--cc=sourabhjain@linux.ibm.com \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).