From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D113C43603 for ; Thu, 19 Dec 2019 12:19:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68DEA24672 for ; Thu, 19 Dec 2019 12:19:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727102AbfLSMTv (ORCPT ); Thu, 19 Dec 2019 07:19:51 -0500 Received: from foss.arm.com ([217.140.110.172]:38014 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727039AbfLSMTt (ORCPT ); Thu, 19 Dec 2019 07:19:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D23631B; Thu, 19 Dec 2019 04:19:49 -0800 (PST) Received: from e120937-lin.cambridge.arm.com (e120937-lin.cambridge.arm.com [10.1.197.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D60563F719; Thu, 19 Dec 2019 04:19:46 -0800 (PST) From: Cristian Marussi 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 Message-Id: <20191219121905.26905-11-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219121905.26905-1-cristian.marussi@arm.com> References: <20191219121905.26905-1-cristian.marussi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make arm use the generic SMP-stop logic provided by common code unified smp_send_stop() function. Signed-off-by: Cristian Marussi --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2F6C43603 for ; Thu, 19 Dec 2019 12:22:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3F2E2068F for ; Thu, 19 Dec 2019 12:22:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cIBu85EP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3F2E2068F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WpFUj9WrasLgsCWFf6qEZTk3+iSPP9j4/7yVDCwgHeQ=; b=cIBu85EPEMx6z8L9AlMtQspV2I IP3xYJvABVBVnmUGGNAPVm88QlkHGErfB3BUr55o9gNvCIiTSHIL2FUL2y+1zYXMWOqaNDnVDIzKK yiE/H/AWz/CV55M7Q69yy2BitwIY5gv8pSMyDuqrWqr96tdE8Z0GJrBMzhkJ+MLV+OzP2rLaLYSeg 5bGMkjMjC96p3+Ir1zE88toDDCdNMKMnBDC4kIM3jNP3FoGIFNvO2obsjRuU86wxZXy1PEfCxWEG4 EjoqeSxei03Ip48KAqANZDoIGZ6yBt+dF50EAlGkAKj3cnETGm+ufgWQVbQSTdTPMYf2XjM550hEx YE25oktQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ihupF-000602-LR; Thu, 19 Dec 2019 12:22:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ihumT-0002OI-Ok for linux-arm-kernel@lists.infradead.org; Thu, 19 Dec 2019 12:19:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D23631B; Thu, 19 Dec 2019 04:19:49 -0800 (PST) Received: from e120937-lin.cambridge.arm.com (e120937-lin.cambridge.arm.com [10.1.197.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D60563F719; Thu, 19 Dec 2019 04:19:46 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v3 10/12] arm: smp: use generic SMP stop common code Date: Thu, 19 Dec 2019 12:19:03 +0000 Message-Id: <20191219121905.26905-11-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219121905.26905-1-cristian.marussi@arm.com> References: <20191219121905.26905-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191219_041949_982627_C43480CC X-CRM114-Status: GOOD ( 12.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make arm use the generic SMP-stop logic provided by common code unified smp_send_stop() function. Signed-off-by: Cristian Marussi --- 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