From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Mårten Lindahl" <marten.lindahl@axis.com>,
"Russell King" <rmk+kernel@armlinux.org.uk>,
"Sasha Levin" <sashal@kernel.org>,
linux@armlinux.org.uk, bhe@redhat.com, gpiccoli@igalia.com,
chenlifu@huawei.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 6.5 08/11] ARM: 9317/1: kexec: Make smp stop calls asynchronous
Date: Fri, 8 Sep 2023 20:22:01 -0400 [thread overview]
Message-ID: <20230909002205.3578068-8-sashal@kernel.org> (raw)
In-Reply-To: <20230909002205.3578068-1-sashal@kernel.org>
From: Mårten Lindahl <marten.lindahl@axis.com>
[ Upstream commit 8922ba71c969d2a0c01a94372a71477d879470de ]
If a panic is triggered by a hrtimer interrupt all online cpus will be
notified and set offline. But as highlighted by commit 19dbdcb8039c
("smp: Warn on function calls from softirq context") this call should
not be made synchronous with disabled interrupts:
softdog: Initiating panic
Kernel panic - not syncing: Software Watchdog Timer expired
WARNING: CPU: 1 PID: 0 at kernel/smp.c:753 smp_call_function_many_cond
unwind_backtrace:
show_stack
dump_stack_lvl
__warn
warn_slowpath_fmt
smp_call_function_many_cond
smp_call_function
crash_smp_send_stop.part.0
machine_crash_shutdown
__crash_kexec
panic
softdog_fire
__hrtimer_run_queues
hrtimer_interrupt
Make the smp call for machine_crash_nonpanic_core() asynchronous.
Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/kernel/machine_kexec.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 46364b699cc30..5d07cf9e0044d 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -94,16 +94,28 @@ static void machine_crash_nonpanic_core(void *unused)
}
}
+static DEFINE_PER_CPU(call_single_data_t, cpu_stop_csd) =
+ CSD_INIT(machine_crash_nonpanic_core, NULL);
+
void crash_smp_send_stop(void)
{
static int cpus_stopped;
unsigned long msecs;
+ call_single_data_t *csd;
+ int cpu, this_cpu = raw_smp_processor_id();
if (cpus_stopped)
return;
atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
- smp_call_function(machine_crash_nonpanic_core, NULL, false);
+ for_each_online_cpu(cpu) {
+ if (cpu == this_cpu)
+ continue;
+
+ csd = &per_cpu(cpu_stop_csd, cpu);
+ smp_call_function_single_async(cpu, csd);
+ }
+
msecs = 1000; /* Wait at most a second for the other cpus to stop */
while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
mdelay(1);
--
2.40.1
next prev parent reply other threads:[~2023-09-09 0:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 0:21 [PATCH AUTOSEL 6.5 01/11] fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount() Sasha Levin
2023-09-09 0:21 ` [PATCH AUTOSEL 6.5 02/11] jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount Sasha Levin
2023-09-09 0:21 ` [PATCH AUTOSEL 6.5 03/11] PCI: Make quirk using inw() depend on HAS_IOPORT Sasha Levin
2023-09-09 0:21 ` [PATCH AUTOSEL 6.5 04/11] ext4: add two helper functions extent_logical_end() and pa_logical_end() Sasha Levin
2023-09-09 0:21 ` [PATCH AUTOSEL 6.5 05/11] ext4: avoid overlapping preallocations due to overflow Sasha Levin
2023-09-09 0:21 ` [PATCH AUTOSEL 6.5 06/11] PCI: dwc: Provide deinit callback for i.MX Sasha Levin
2023-09-09 0:22 ` [PATCH AUTOSEL 6.5 07/11] ARM: 9316/1: hw_breakpoint: fix single-stepping when using bpf_overflow_handler Sasha Levin
2023-09-09 0:22 ` Sasha Levin [this message]
2023-09-09 0:22 ` [PATCH AUTOSEL 6.5 09/11] powerpc/pseries: fix possible memory leak in ibmebus_bus_init() Sasha Levin
2023-09-09 0:22 ` [PATCH AUTOSEL 6.5 10/11] PCI: vmd: Disable bridge window for domain reset Sasha Levin
2023-09-09 0:22 ` [PATCH AUTOSEL 6.5 11/11] PCI: fu740: Set the number of MSI vectors 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=20230909002205.3578068-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bhe@redhat.com \
--cc=chenlifu@huawei.com \
--cc=gpiccoli@igalia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marten.lindahl@axis.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=stable@vger.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
all inboxes | Powered by JetHome®