Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, mark.rutland@arm.com,
	sparclinux@vger.kernel.org, dzickus@redhat.com,
	ehabkost@redhat.com, peterz@infradead.org,
	catalin.marinas@arm.com, x86@kernel.org, linux@armlinux.org.uk,
	davem@davemloft.net, hch@infradead.org,
	takahiro.akashi@linaro.org, mingo@redhat.com,
	james.morse@arm.com, hidehiro.kawai.ez@hitachi.com,
	tglx@linutronix.de, will@kernel.org, dave.martin@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 11/12] arm: smp: use SMP crash-stop common code
Date: Fri, 13 Sep 2019 19:19:52 +0100
Message-ID: <20190913181953.45748-12-cristian.marussi@arm.com> (raw)
In-Reply-To: <20190913181953.45748-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 | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 76300f3813e8..d53973cae362 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,21 @@ void machine_crash_nonpanic_core(void *unused)
 	crash_save_cpu(&regs, 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;
+	smp_call_function_many(cpus, machine_crash_nonpanic_core, NULL, false);
 }
 
 static void machine_kexec_mask_interrupts(void)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 18:19 [RFC PATCH v2 00/12] Unify SMP stop generic logic to " Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 01/12] smp: add generic SMP-stop support " Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 02/12] smp: unify crash_ and smp_send_stop() logic Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 03/12] smp: coordinate concurrent crash/smp stop calls Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 04/12] smp: address races of starting CPUs while stopping Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 05/12] arm64: smp: use generic SMP stop common code Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 06/12] arm64: smp: use SMP crash-stop " Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 07/12] arm64: smp: add arch specific cpu parking helper Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 08/12] x86: smp: use generic SMP stop common code Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 09/12] x86: smp: use SMP crash-stop " Cristian Marussi
2019-09-13 18:19 ` [RFC PATCH v2 10/12] arm: smp: use generic SMP stop " Cristian Marussi
2019-09-13 18:19 ` Cristian Marussi [this message]
2019-09-13 18:19 ` [RFC PATCH v2 12/12] sparc64: " Cristian Marussi
2019-09-13 18:27 ` [RFC PATCH v2 00/12] Unify SMP stop generic logic to " Russell King - ARM Linux admin
2019-09-16  9:38   ` Cristian Marussi

Reply instructions:

You may reply publically 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=20190913181953.45748-12-cristian.marussi@arm.com \
    --to=cristian.marussi@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.martin@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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox