[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191219121905.26905-12-cristian.marussi@arm.com>
Date: Thu, 19 Dec 2019 12:19:04 +0000
From: Cristian Marussi <cristian.marussi@....com>
To: linux-kernel@...r.kernel.org
Cc: linux-arch@...r.kernel.org, mark.rutland@....com,
peterz@...radead.org, catalin.marinas@....com,
takahiro.akashi@...aro.org, james.morse@....com,
hidehiro.kawai.ez@...achi.com, tglx@...utronix.de, will@...nel.org,
linux-arm-kernel@...ts.infradead.org, mingo@...hat.com,
x86@...nel.org, dzickus@...hat.com, ehabkost@...hat.com,
linux@...linux.org.uk, davem@...emloft.net,
sparclinux@...r.kernel.org, hch@...radead.org
Subject: [RFC PATCH v3 11/12] arm: smp: use SMP crash-stop common code
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@....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
Powered by blists - more mailing lists