From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
ego@linux.vnet.ibm.com, kernel test robot <lkp@intel.com>,
parth@linux.ibm.com, npiggin@gmail.com, clg@kaod.org,
yukuai3@huawei.com, linuxppc-dev@lists.ozlabs.org,
robh@kernel.org, Hari Bathini <hbathini@linux.ibm.com>,
srikar@linux.vnet.ibm.com
Subject: [PATCH AUTOSEL 5.10 23/34] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option
Date: Mon, 17 Jan 2022 12:03:13 -0500 [thread overview]
Message-ID: <20220117170326.1471712-23-sashal@kernel.org> (raw)
In-Reply-To: <20220117170326.1471712-1-sashal@kernel.org>
From: Hari Bathini <hbathini@linux.ibm.com>
[ Upstream commit 219572d2fc4135b5ce65c735d881787d48b10e71 ]
Kdump can be triggered after panic_notifers since commit f06e5153f4ae2
("kernel/panic.c: add "crash_kexec_post_notifiers" option for kdump
after panic_notifers") introduced crash_kexec_post_notifiers option.
But using this option would mean smp_send_stop(), that marks all other
CPUs as offline, gets called before kdump is triggered. As a result,
kdump routines fail to save other CPUs' registers. To fix this, kdump
friendly crash_smp_send_stop() function was introduced with kernel
commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump
friendly version in panic path"). Override this kdump friendly weak
function to handle crash_kexec_post_notifiers option appropriately
on powerpc.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
[Fixed signature of crash_stop_this_cpu() - reported by lkp@intel.com]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211207103719.91117-1-hbathini@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/smp.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 50aeef08aa470..d993f28107afa 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -594,6 +594,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
}
#endif
+#ifdef CONFIG_NMI_IPI
+static void crash_stop_this_cpu(struct pt_regs *regs)
+#else
+static void crash_stop_this_cpu(void *dummy)
+#endif
+{
+ /*
+ * Just busy wait here and avoid marking CPU as offline to ensure
+ * register data is captured appropriately.
+ */
+ while (1)
+ cpu_relax();
+}
+
+void crash_smp_send_stop(void)
+{
+ static bool stopped = false;
+
+ if (stopped)
+ return;
+
+ stopped = true;
+
+#ifdef CONFIG_NMI_IPI
+ smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000);
+#else
+ smp_call_function(crash_stop_this_cpu, NULL, 0);
+#endif /* CONFIG_NMI_IPI */
+}
+
#ifdef CONFIG_NMI_IPI
static void nmi_stop_this_cpu(struct pt_regs *regs)
{
--
2.34.1
next prev parent reply other threads:[~2022-01-17 17:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220117170326.1471712-1-sashal@kernel.org>
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 03/34] powerpc/6xx: add missing of_node_put Sasha Levin
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 04/34] powerpc/powernv: " Sasha Levin
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 05/34] powerpc/cell: " Sasha Levin
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 06/34] powerpc/btext: " Sasha Levin
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 07/34] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Sasha Levin
2022-01-17 17:02 ` [PATCH AUTOSEL 5.10 09/34] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 12/34] powerpc/powermac: Add missing lockdep_register_key() Sasha Levin
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 13/34] KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots Sasha Levin
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 14/34] KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST Sasha Levin
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 21/34] powerpc/40x: Map 32Mbytes of memory at startup Sasha Levin
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 22/34] selftests/powerpc/spectre_v2: Return skip code when miss_percent is high Sasha Levin
2022-01-17 17:03 ` Sasha Levin [this message]
2022-01-17 17:03 ` [PATCH AUTOSEL 5.10 24/34] powerpc/fadump: Fix inaccurate CPU state info in vmcore generated with panic Sasha Levin
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=20220117170326.1471712-23-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=clg@kaod.org \
--cc=ego@linux.vnet.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=npiggin@gmail.com \
--cc=parth@linux.ibm.com \
--cc=robh@kernel.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=stable@vger.kernel.org \
--cc=yukuai3@huawei.com \
/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).