From nobody Sun Feb 8 09:17:03 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90564EB64DB for ; Thu, 15 Jun 2023 10:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239402AbjFOKfa (ORCPT ); Thu, 15 Jun 2023 06:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343784AbjFOKfB (ORCPT ); Thu, 15 Jun 2023 06:35:01 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4317F297D for ; Thu, 15 Jun 2023 03:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1686825275; x=1718361275; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=N5F0WUYU45IWqZJe9HXUkJMQ38Qcy4Sg2+BO0tEm4Qs=; b=FYHeF9NwzM/p4dVKidwQhPUmDD/nZM5ekKh8oxQXtecn63FE9wnF0Psj Jbae6v3xz+vOYrfwOQMnR0kfYuBHvrriyOND6nNXKBfAG3K2Djg5w1yuo rB9Z13/+PRY/UjaYX4qcDjYas58kaquLlb1paf/1bLkuCrAOF9uhxegW1 G4T87fIAElMiGyZ+6buTOl1RmTPjVy7qMLI36KPshC4KtNc+QwoZcYq1j n/2XYs1T7kKxwpbdzJp0D81lKz4/70iwOip1rj2AQ6hFikjnTtF0nwXyn 1pPJ6BKzwgNk5TG55VIi7gZ/Rkbd9DtoFCRV6GHNgQudC++tIuPEf/iOa w==; From: =?utf-8?q?M=C3=A5rten_Lindahl?= Date: Thu, 15 Jun 2023 12:34:32 +0200 Subject: [PATCH] ARM: kexec: Make smp stop calls asynchronous MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20230615-arm-smp-call-async-v1-1-58f4afb20f0f@axis.com> X-B4-Tracking: v=1; b=H4sIADfpimQC/x2N0QrCMAwAf2Xk2UDX2qH+iviQ1dQF1joSEWXs3 +18PI7jVjBWYYNLt4LyW0yetUF/6CBNVB+Mcm8M3vnghj4iaUErCyaaZyT71oThNMSQ89Gdo4c WjmSMo1JN054WshfrLhblLJ//7Xrbth9wJlWrfQAAAA== To: Russell King CC: , , , =?utf-8?q?M=C3=A5rten_Lindahl?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686825272; l=2227; i=marten.lindahl@axis.com; s=20230329; h=from:subject:message-id; bh=r9H1QenBlIqwCnqnJ1Ys0LmHkHkdbbmsh2aKm0880Qk=; b=hlv5yW7GghIo24kUv304csMkuZHhJiBvtd5jLD345B60Z/owvNGmbfKlJWRNOI72WcBWSXQEo 6E8H3gHyfSZAMG70puG5VssQa+o0K2/uOt0RF+qx9I5Ec1KJ3f2jtrT X-Developer-Key: i=marten.lindahl@axis.com; a=ed25519; pk=JfbjqFPJnIDIQOkJBeatC8+S3Ax3N0RIdmN+fL3wXgw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a panic is triggered by a hrtimer interrupt all online cpus will be noitfied 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=C3=A5rten Lindahl --- 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_kexe= c.c index 46364b699cc3..5d07cf9e0044 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) } } =20 +static DEFINE_PER_CPU(call_single_data_t, cpu_stop_csd) =3D + 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 =3D raw_smp_processor_id(); =20 if (cpus_stopped) return; =20 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 =3D=3D this_cpu) + continue; + + csd =3D &per_cpu(cpu_stop_csd, cpu); + smp_call_function_single_async(cpu, csd); + } + msecs =3D 1000; /* Wait at most a second for the other cpus to stop */ while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { mdelay(1); --- base-commit: 858fd168a95c5b9669aac8db6c14a9aeab446375 change-id: 20230615-arm-smp-call-async-38653ff40952 Best regards, --=20 M=C3=A5rten Lindahl