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 10/12] arm: smp: use generic SMP stop common code Date: Thu, 19 Dec 2019 12:19:03 +0000 [thread overview] Message-ID: <20191219121905.26905-11-cristian.marussi@arm.com> (raw) In-Reply-To: <20191219121905.26905-1-cristian.marussi@arm.com> Make arm use the generic SMP-stop logic provided by common code unified smp_send_stop() function. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- v2 --> v3 - conflicts - added missing barriers --- arch/arm/Kconfig | 1 + arch/arm/kernel/smp.c | 22 ++++++---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ba75e3661a41..40f6961c449c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -35,6 +35,7 @@ config ARM select ARCH_USE_CMPXCHG_LOCKREF select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_USE_COMMON_SMP_STOP select BINFMT_FLAT_ARGVP_ENVP_ON_STACK select BUILDTIME_EXTABLE_SORT if MMU select CLONE_BACKWARDS diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 46e1be9e57a8..f03e9bbf4116 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -598,6 +598,8 @@ static void ipi_cpu_stop(unsigned int cpu) } set_cpu_online(cpu, false); + /* ensure all writes are globally visible before cpu parks */ + wmb(); local_fiq_disable(); local_irq_disable(); @@ -705,23 +707,9 @@ void smp_send_reschedule(int cpu) smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); } -void smp_send_stop(void) +void arch_smp_stop_call(cpumask_t *cpus, unsigned int __unused) { - unsigned long timeout; - struct cpumask mask; - - cpumask_copy(&mask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &mask); - if (!cpumask_empty(&mask)) - smp_cross_call(&mask, IPI_CPU_STOP); - - /* Wait up to one second for other CPUs to stop */ - timeout = USEC_PER_SEC; - while (num_online_cpus() > 1 && timeout--) - udelay(1); - - if (num_online_cpus() > 1) - pr_warn("SMP: failed to stop secondary CPUs\n"); + smp_cross_call(cpus, IPI_CPU_STOP); } /* In case panic() and panic() called at the same time on CPU1 and CPU2, @@ -735,6 +723,8 @@ void panic_smp_self_stop(void) pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", smp_processor_id()); set_cpu_online(smp_processor_id(), false); + /* ensure all writes visible before parking */ + wmb(); while (1) cpu_relax(); } -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
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, 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, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v3 10/12] arm: smp: use generic SMP stop common code Date: Thu, 19 Dec 2019 12:19:03 +0000 [thread overview] Message-ID: <20191219121905.26905-11-cristian.marussi@arm.com> (raw) In-Reply-To: <20191219121905.26905-1-cristian.marussi@arm.com> Make arm use the generic SMP-stop logic provided by common code unified smp_send_stop() function. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- v2 --> v3 - conflicts - added missing barriers --- arch/arm/Kconfig | 1 + arch/arm/kernel/smp.c | 22 ++++++---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ba75e3661a41..40f6961c449c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -35,6 +35,7 @@ config ARM select ARCH_USE_CMPXCHG_LOCKREF select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_USE_COMMON_SMP_STOP select BINFMT_FLAT_ARGVP_ENVP_ON_STACK select BUILDTIME_EXTABLE_SORT if MMU select CLONE_BACKWARDS diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 46e1be9e57a8..f03e9bbf4116 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -598,6 +598,8 @@ static void ipi_cpu_stop(unsigned int cpu) } set_cpu_online(cpu, false); + /* ensure all writes are globally visible before cpu parks */ + wmb(); local_fiq_disable(); local_irq_disable(); @@ -705,23 +707,9 @@ void smp_send_reschedule(int cpu) smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); } -void smp_send_stop(void) +void arch_smp_stop_call(cpumask_t *cpus, unsigned int __unused) { - unsigned long timeout; - struct cpumask mask; - - cpumask_copy(&mask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &mask); - if (!cpumask_empty(&mask)) - smp_cross_call(&mask, IPI_CPU_STOP); - - /* Wait up to one second for other CPUs to stop */ - timeout = USEC_PER_SEC; - while (num_online_cpus() > 1 && timeout--) - udelay(1); - - if (num_online_cpus() > 1) - pr_warn("SMP: failed to stop secondary CPUs\n"); + smp_cross_call(cpus, IPI_CPU_STOP); } /* In case panic() and panic() called at the same time on CPU1 and CPU2, @@ -735,6 +723,8 @@ void panic_smp_self_stop(void) pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", smp_processor_id()); set_cpu_online(smp_processor_id(), false); + /* ensure all writes visible before parking */ + wmb(); while (1) cpu_relax(); } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-19 12:19 UTC|newest] Thread overview: 34+ 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 ` 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 ` 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 ` 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 ` Cristian Marussi 2019-12-19 12:18 ` 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 ` 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 ` Cristian Marussi 2019-12-19 12:18 ` [RFC PATCH v3 06/12] arm64: smp: use SMP crash-stop " Cristian Marussi 2019-12-19 12:18 ` Cristian Marussi 2019-12-19 12:18 ` 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 ` 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 ` Cristian Marussi 2019-12-19 12:19 ` 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 ` Cristian Marussi 2019-12-19 12:19 ` Cristian Marussi [this message] 2019-12-19 12:19 ` [RFC PATCH v3 10/12] arm: smp: use generic SMP stop " Cristian Marussi 2019-12-19 12:19 ` [RFC PATCH v3 11/12] arm: smp: use SMP crash-stop " Cristian Marussi 2019-12-19 12:19 ` Cristian Marussi 2019-12-19 12:19 ` [RFC PATCH v3 12/12] sparc64: smp: use generic SMP stop " Cristian Marussi 2019-12-19 12:19 ` Cristian Marussi 2019-12-19 12:19 ` Cristian Marussi 2020-01-13 16:40 ` [RFC PATCH v3 00/12] Unify SMP stop generic logic to " Will Deacon 2020-01-13 16:40 ` Will Deacon 2020-01-13 17:05 ` Cristian Marussi 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-11-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.