From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, mark.rutland@arm.com,
peterz@infradead.org, catalin.marinas@arm.com,
takahiro.akashi@linaro.org, james.morse@arm.com,
hidehiro.kawai.ez@hitachi.com, tglx@linutronix.de,
will@kernel.org, linux-arm-kernel@lists.infradead.org,
mingo@redhat.com, x86@kernel.org, dzickus@redhat.com,
ehabkost@redhat.com, linux@armlinux.org.uk, davem@davemloft.net,
sparclinux@vger.kernel.org, hch@infradead.org
Subject: [RFC PATCH v3 11/12] arm: smp: use SMP crash-stop common code
Date: Thu, 19 Dec 2019 12:19:04 +0000 [thread overview]
Message-ID: <20191219121905.26905-12-cristian.marussi@arm.com> (raw)
In-Reply-To: <20191219121905.26905-1-cristian.marussi@arm.com>
Make arm use the SMP common implementation of crash_smp_send_stop() and
its generic logic, by removing the arm crash_smp_send_stop() definition
and providing the needed arch specific helpers.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
arch/arm/kernel/machine_kexec.c | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 76300f3813e8..5289984e3941 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -29,8 +29,6 @@ extern unsigned long kexec_indirection_page;
extern unsigned long kexec_mach_type;
extern unsigned long kexec_boot_atags;
-static atomic_t waiting_for_crash_ipi;
-
/*
* Provide a dummy crash_notes definition while crash dump arrives to arm.
* This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
@@ -89,34 +87,23 @@ void machine_crash_nonpanic_core(void *unused)
crash_save_cpu(®s, smp_processor_id());
flush_cache_all();
+ /* ensure saved regs writes are visible before going offline */
+ smp_wmb();
set_cpu_online(smp_processor_id(), false);
- atomic_dec(&waiting_for_crash_ipi);
+ /* ensure all writes visible before parking */
+ wmb();
while (1) {
cpu_relax();
wfe();
}
}
-void crash_smp_send_stop(void)
+void arch_smp_crash_call(cpumask_t *cpus, unsigned int __unused)
{
- static int cpus_stopped;
- unsigned long msecs;
-
- if (cpus_stopped)
- return;
-
- atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
- smp_call_function(machine_crash_nonpanic_core, NULL, false);
- msecs = 1000; /* Wait at most a second for the other cpus to stop */
- while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
- mdelay(1);
- msecs--;
- }
- if (atomic_read(&waiting_for_crash_ipi) > 0)
- pr_warn("Non-crashing CPUs did not react to IPI\n");
-
- cpus_stopped = 1;
+ preempt_disable();
+ smp_call_function_many(cpus, machine_crash_nonpanic_core, NULL, false);
+ preempt_enable();
}
static void machine_kexec_mask_interrupts(void)
--
2.17.1
next prev parent reply other threads:[~2019-12-19 12:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 12:18 [RFC PATCH v3 00/12] Unify SMP stop generic logic to common code Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 01/12] smp: add generic SMP-stop support " Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 02/12] smp: unify crash_ and smp_send_stop() logic Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 03/12] smp: coordinate concurrent crash/smp stop calls Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 04/12] smp: address races of starting CPUs while stopping Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 05/12] arm64: smp: use generic SMP stop common code Cristian Marussi
2019-12-19 12:18 ` [RFC PATCH v3 06/12] arm64: smp: use SMP crash-stop " Cristian Marussi
2019-12-19 12:19 ` [RFC PATCH v3 07/12] arm64: smp: add arch specific cpu parking helper Cristian Marussi
2019-12-19 12:19 ` [RFC PATCH v3 08/12] x86: smp: use generic SMP stop common code Cristian Marussi
2019-12-19 12:19 ` [RFC PATCH v3 09/12] x86: smp: use SMP crash-stop " Cristian Marussi
2019-12-19 12:19 ` [RFC PATCH v3 10/12] arm: smp: use generic SMP stop " Cristian Marussi
2019-12-19 12:19 ` Cristian Marussi [this message]
2019-12-19 12:19 ` [RFC PATCH v3 12/12] sparc64: " Cristian Marussi
2020-01-13 16:40 ` [RFC PATCH v3 00/12] Unify SMP stop generic logic to " Will Deacon
2020-01-13 17:05 ` Cristian Marussi
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=20191219121905.26905-12-cristian.marussi@arm.com \
--to=cristian.marussi@arm.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=dzickus@redhat.com \
--cc=ehabkost@redhat.com \
--cc=hch@infradead.org \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=james.morse@arm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sparclinux@vger.kernel.org \
--cc=takahiro.akashi@linaro.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--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).