From patchwork Sun Feb 23 19:29:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399019 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5599417D5 for ; Sun, 23 Feb 2020 19:30:00 +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 2FF7620836 for ; Sun, 23 Feb 2020 19:30:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ci/apPeS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FF7620836 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+patchwork-linux-arm=patchwork.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=NjlxLi5dccRdW7yAl12oCeNxN5D5L3jLGXEK9cI/14g=; b=ci/apPeSoriiukptGCeGeX+aaT BQ70BhJkiaEma7zLKmKN31R/+XSq8I6pRYMtJSki6erPRQXmgqHDOSOGoxwWWvlYy5tGrUj4l+cZt 2zw6DviE9OMt20ascL3FWijwqvPFT3s7/tNGPQJEVg7m57mTzXPcPkt8+YT6iG8482dhIgKCpgAtG 6ZaG3fL+8Lv9fSMF5yxuV3TWc6eo5S9p7CWxSFjQXTRrQ3PujO1vRS+btEvKc5jvJGpAr1volW0KT ebOrgrS6q6hpbqzf8Q5SgIAN71hKPsieWJtsyOXofylz34Y8WfOcOdGS0FK9gannzpEwWiSeh40lq zBnJS+BQ==; 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 1j5www-0001Ez-Io; Sun, 23 Feb 2020 19:29:58 +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 1j5wwt-0001EF-Gf for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:29:56 +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 3D692101E; Sun, 23 Feb 2020 11:29:54 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 437293F6CF; Sun, 23 Feb 2020 11:29:52 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 01/15] cpu: Add new {add,remove}_cpu() functions Date: Sun, 23 Feb 2020 19:29:28 +0000 Message-Id: <20200223192942.18420-2-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_112955_594013_5C037643 X-CRM114-Status: GOOD ( 10.62 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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: Juergen Gross , Mark Rutland , Lorenzo Pieralisi , linux-parisc@vger.kernel.org, "Paul E . McKenney" , Michael Ellerman , Helge Deller , x86@kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, linuxppc-dev@lists.ozlabs.org, Qais Yousef , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The new functions use device_{online,offline}() which are userspace safe. This is in preparation to move cpu_{up, down} kernel users to use a safer interface that is not racy with userspace. Suggested-by: "Paul E. McKenney" Signed-off-by: Qais Yousef CC: Thomas Gleixner CC: "Paul E. McKenney" CC: Helge Deller CC: Michael Ellerman CC: "David S. Miller" CC: Juergen Gross CC: Mark Rutland CC: Lorenzo Pieralisi CC: xen-devel@lists.xenproject.org CC: linux-parisc@vger.kernel.org CC: sparclinux@vger.kernel.org CC: linuxppc-dev@lists.ozlabs.org CC: linux-arm-kernel@lists.infradead.org CC: x86@kernel.org CC: linux-kernel@vger.kernel.org --- include/linux/cpu.h | 2 ++ kernel/cpu.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 1ca2baf817ed..cf8cf38dca43 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -89,6 +89,7 @@ extern ssize_t arch_cpu_release(const char *, size_t); #ifdef CONFIG_SMP extern bool cpuhp_tasks_frozen; int cpu_up(unsigned int cpu); +int add_cpu(unsigned int cpu); void notify_cpu_starting(unsigned int cpu); extern void cpu_maps_update_begin(void); extern void cpu_maps_update_done(void); @@ -118,6 +119,7 @@ extern void cpu_hotplug_disable(void); extern void cpu_hotplug_enable(void); void clear_tasks_mm_cpumask(int cpu); int cpu_down(unsigned int cpu); +int remove_cpu(unsigned int cpu); #else /* CONFIG_HOTPLUG_CPU */ diff --git a/kernel/cpu.c b/kernel/cpu.c index 9c706af713fb..069802f7010f 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1057,6 +1057,18 @@ int cpu_down(unsigned int cpu) } EXPORT_SYMBOL(cpu_down); +int remove_cpu(unsigned int cpu) +{ + int ret; + + lock_device_hotplug(); + ret = device_offline(get_cpu_device(cpu)); + unlock_device_hotplug(); + + return ret; +} +EXPORT_SYMBOL_GPL(remove_cpu); + #else #define takedown_cpu NULL #endif /*CONFIG_HOTPLUG_CPU*/ @@ -1209,6 +1221,18 @@ int cpu_up(unsigned int cpu) } EXPORT_SYMBOL_GPL(cpu_up); +int add_cpu(unsigned int cpu) +{ + int ret; + + lock_device_hotplug(); + ret = device_online(get_cpu_device(cpu)); + unlock_device_hotplug(); + + return ret; +} +EXPORT_SYMBOL_GPL(add_cpu); + #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; From patchwork Sun Feb 23 19:29:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399023 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0558314BC for ; Sun, 23 Feb 2020 19:30:21 +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 D31CE20836 for ; Sun, 23 Feb 2020 19:30:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZvDhEUDj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D31CE20836 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+patchwork-linux-arm=patchwork.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=80T1CupzbeXCAOCoCJAn0GRSik9efg7IbZgFo28fDrQ=; b=ZvDhEUDjyFUWgiVkB4PwtsfeVG FTnu5FFfOA7WMx1vFN6gyercHQ8sDfv/AQkln4jr9mI9Puy6sJvLxCs4ognzdVN3P0vtkRUoqxjL3 HCPKpTy78waCqefkYZMKfm+9lyRh68RoyLNJjUHZElGtfLswC0hWt/1LFBfRZVuFWcf2IRKDDeP8E Hmu/LQZ7c1meUjJAR3aspf926uAfjwLc1CIAnqIOHifREcJfdlkKYI9glMl12FNePVCytnldavMG8 V3XdXEk1hypEYRAwojjQi7ZkcKiooA19ZsmnGUKQARpI27fM3r8GZ0C2eHAwptU0p1dpftgGnsiHg OCdE/lgA==; 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 1j5wxI-0002fw-2c; Sun, 23 Feb 2020 19:30:20 +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 1j5www-0001Eu-Gh for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:30:00 +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 19161106F; Sun, 23 Feb 2020 11:29:57 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 739D33F6CF; Sun, 23 Feb 2020 11:29:54 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 02/15] smp: Create a new function to shutdown nonboot cpus Date: Sun, 23 Feb 2020 19:29:29 +0000 Message-Id: <20200223192942.18420-3-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_112958_643074_4DFFB5B7 X-CRM114-Status: GOOD ( 16.42 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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: Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, "Rafael J. Wysocki" , Catalin Marinas , "Paul E . McKenney" , Greg Kroah-Hartman , "Peter Zijlstra \(Intel\)" , Jiri Kosina , Daniel Lezcano , linux-kernel@vger.kernel.org, Zhenzhong Duan , Nicholas Piggin , Ingo Molnar , Eiichi Tsukata , Nadav Amit , Josh Poimboeuf , Russell King , Will Deacon , Qais Yousef , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This function will be used later in machine_shutdown() for some archs. disable_nonboot_cpus() is not safe to use when doing machine_down(), because it relies on freeze_secondary_cpus() which in turn is a suspend/resume related freeze and could abort if the logic detects any pending activities that can prevent finishing the offlining process. Signed-off-by: Qais Yousef CC: Thomas Gleixner CC: Josh Poimboeuf CC: "Peter Zijlstra (Intel)" CC: Jiri Kosina CC: Nicholas Piggin CC: Daniel Lezcano CC: Ingo Molnar CC: Eiichi Tsukata CC: Zhenzhong Duan CC: Nadav Amit CC: Greg Kroah-Hartman CC: "Rafael J. Wysocki" CC: Tony Luck CC: Fenghua Yu CC: Russell King CC: Catalin Marinas CC: Will Deacon CC: linux-arm-kernel@lists.infradead.org CC: linux-ia64@vger.kernel.org CC: linux-kernel@vger.kernel.org --- include/linux/cpu.h | 2 ++ kernel/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index cf8cf38dca43..64a246e9c8db 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -120,6 +120,7 @@ extern void cpu_hotplug_enable(void); void clear_tasks_mm_cpumask(int cpu); int cpu_down(unsigned int cpu); int remove_cpu(unsigned int cpu); +extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu); #else /* CONFIG_HOTPLUG_CPU */ @@ -131,6 +132,7 @@ static inline int cpus_read_trylock(void) { return true; } static inline void lockdep_assert_cpus_held(void) { } static inline void cpu_hotplug_disable(void) { } static inline void cpu_hotplug_enable(void) { } +static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } #endif /* !CONFIG_HOTPLUG_CPU */ /* Wrappers which go away once all code is converted */ diff --git a/kernel/cpu.c b/kernel/cpu.c index 069802f7010f..03c727195b65 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1069,6 +1069,48 @@ int remove_cpu(unsigned int cpu) } EXPORT_SYMBOL_GPL(remove_cpu); +void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) +{ + unsigned int cpu; + int error; + + cpu_maps_update_begin(); + + /* + * Make certain the cpu I'm about to reboot on is online. + * + * This is inline to what migrate_to_reboot_cpu() already do. + */ + if (!cpu_online(primary_cpu)) + primary_cpu = cpumask_first(cpu_online_mask); + + for_each_online_cpu(cpu) { + if (cpu == primary_cpu) + continue; + + error = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); + if (error) { + pr_err("Failed to offline CPU%d - error=%d", + cpu, error); + break; + } + } + + /* + * Ensure all but the reboot CPU are offline. + */ + BUG_ON(num_online_cpus() > 1); + + /* + * Make sure the CPUs won't be enabled by someone else after this + * point. Kexec will reboot to a new kernel shortly resetting + * everything along the way. + */ + cpu_hotplug_disabled++; + + cpu_maps_update_done(); +} + #else #define takedown_cpu NULL #endif /*CONFIG_HOTPLUG_CPU*/ From patchwork Sun Feb 23 19:29:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49C2814BC for ; Sun, 23 Feb 2020 19:30:39 +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 23A3020836 for ; Sun, 23 Feb 2020 19:30:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V/2rARWm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23A3020836 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+patchwork-linux-arm=patchwork.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=MdhYFslMCs5wrZQlILz4Sc/GtiDdKS0qOGzlcJkxKfM=; b=V/2rARWm/skVmAMzfUYSiOodei eqh3NeoXV/A2Nrj4p+VCl3+tseDfnKLDqN9KO49FpXWOYbsQvaAYXGSJDf++7lvuon5cnRt7zBWNy SqQ0qxGwcJJMgn5akU8NkvcL9f34YU2Cj71gKaOouCWHE3DRYVflGQCBMKWAXjE5EOpxbeQ11z9RU Agi8Oa2aO+MvYWAfAfG7oEUMTGX/w2YVHczMnz/QlDZ91nxmfzO+q4c1AFLLXLSBs53ogwWiB32pC 2lXAODpmC2okUicO6TOTVgYAsIom8iEH9HoerqHNOPSKUI4wjltD+55qhKGILlpunJQpBy56mg0Ck vWVOOHMw==; 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 1j5wxZ-0002vy-EQ; Sun, 23 Feb 2020 19:30:37 +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 1j5wwy-0001HM-GB for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:30:02 +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 490CF1396; Sun, 23 Feb 2020 11:29:59 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7F4973F6CF; Sun, 23 Feb 2020 11:29:58 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 04/15] arm: Don't use disable_nonboot_cpus() Date: Sun, 23 Feb 2020 19:29:31 +0000 Message-Id: <20200223192942.18420-5-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_113000_598766_428091D6 X-CRM114-Status: GOOD ( 13.99 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Qais Yousef , "Paul E . McKenney" , Russell King MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org disable_nonboot_cpus() is not safe to use when doing machine_down(), because it relies on freeze_secondary_cpus() which in turn is a suspend/resume related freeze and could abort if the logic detects any pending activities that can prevent finishing the offlining process. Beside disable_nonboot_cpus() is dependent on CONFIG_PM_SLEEP_SMP which is an othogonal config to rely on to ensure this function works correctly. Use `reboot_cpu` variable instead of hardcoding 0 as the reboot cpu. Signed-off-by: Qais Yousef CC: Russell King CC: linux-arm-kernel@lists.infradead.org CC: linux-kernel@vger.kernel.org --- arch/arm/kernel/reboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index bb18ed0539f4..0ce388f15422 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c @@ -88,11 +88,11 @@ void soft_restart(unsigned long addr) * to execute e.g. a RAM-based pin loop is not sufficient. This allows the * kexec'd kernel to use any and all RAM as it sees fit, without having to * avoid any code or data used by any SW CPU pin loop. The CPU hotplug - * functionality embodied in disable_nonboot_cpus() to achieve this. + * functionality embodied in smp_shutdown_nonboot_cpus() to achieve this. */ void machine_shutdown(void) { - disable_nonboot_cpus(); + smp_shutdown_nonboot_cpus(reboot_cpu); } /* From patchwork Sun Feb 23 19:29:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399027 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 527B314BC for ; Sun, 23 Feb 2020 19:30:52 +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 21A0320836 for ; Sun, 23 Feb 2020 19:30:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rgdcAgxr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21A0320836 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+patchwork-linux-arm=patchwork.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=X+5DJk3nBVs8P3MDoJjG8/pUKy2pcoj24bpOrXXulY8=; b=rgdcAgxrslFTsLPsaBnUnlSL2w lI9NelWwUtI5jRFScOQF18FYteR51olAWvCSQ7CHPYV9SxYqlhSxTgLxgSSj69PRASiYCA4+3BNGr MjkY6M4FD+G3Zff1Jw7XI7ry+GAJfGxrqOOTXwuocSRnhT1imXN+XJUnz2eUiB8nBYJ1ues8WiP+Y UfUNiVjNzi0tE5HxlqnKCk5bKoLf1lknSTybnSj4EZeZVLj1M8rHpJcpptUb5YGspDMpa9PNEYX8R mCTuhp/vmx/q5YOzBgJWBfaoZZEiu7EHdrZoskEJ2sTB8KP0aXkjbcyLVDfVFZ4paM18y1kw6iXIy axhKn1lw==; 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 1j5wxn-0003Bp-Ay; Sun, 23 Feb 2020 19:30:51 +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 1j5wwz-0001IJ-7n for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:30:03 +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 7C03A139F; Sun, 23 Feb 2020 11:30:00 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7D2473F6CF; Sun, 23 Feb 2020 11:29:59 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 05/15] arm64: Don't use disable_nonboot_cpus() Date: Sun, 23 Feb 2020 19:29:32 +0000 Message-Id: <20200223192942.18420-6-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_113001_760085_3CCFE96D X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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: "Paul E . McKenney" , Catalin Marinas , linux-kernel@vger.kernel.org, Will Deacon , Qais Yousef , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org disable_nonboot_cpus() is not safe to use when doing machine_down(), because it relies on freeze_secondary_cpus() which in turn is a suspend/resume related freeze and could abort if the logic detects any pending activities that can prevent finishing the offlining process. Beside disable_nonboot_cpus() is dependent on CONFIG_PM_SLEEP_SMP which is an othogonal config to rely on to ensure this function works correctly. Use `reboot_cpu` variable instead of hardcoding 0 as the reboot cpu. Signed-off-by: Qais Yousef CC: Catalin Marinas CC: Will Deacon CC: linux-arm-kernel@lists.infradead.org CC: linux-kernel@vger.kernel.org Acked-by: Catalin Marinas --- arch/arm64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index bbb0f0c145f6..b33b415fb32e 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -141,11 +141,11 @@ void arch_cpu_idle_dead(void) * to execute e.g. a RAM-based pin loop is not sufficient. This allows the * kexec'd kernel to use any and all RAM as it sees fit, without having to * avoid any code or data used by any SW CPU pin loop. The CPU hotplug - * functionality embodied in disable_nonboot_cpus() to achieve this. + * functionality embodied in smpt_shutdown_nonboot_cpus() to achieve this. */ void machine_shutdown(void) { - disable_nonboot_cpus(); + smp_shutdown_nonboot_cpus(reboot_cpu); } /* From patchwork Sun Feb 23 19:29:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F19014E3 for ; Sun, 23 Feb 2020 19:31:09 +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 EDAA120836 for ; Sun, 23 Feb 2020 19:31:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kPJ6UD/+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDAA120836 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+patchwork-linux-arm=patchwork.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=bGyJXWL/6fRWxzoL1qIEFxcOLLOEDBjoSztt9eJNUxY=; b=kPJ6UD/+3YmFJHVgZ4dTbwzTTF 7olVxuM2wbhJ5+2sYLdrC+c/qxjJxfj66Ln4o71LPiDevOnt0bjiRNkZqPZMAYXM3touV6ALd1Mkb cP79mflTdmB6oAIvoFnxA+B61LE5cHv95nk44BZKRmsQQwJSuOLB6ox7B40FlpYv3gLpTm0AsT9hX +A6p5L7vJI0uVzXpyyQRd1BpweK5t2lSiHbmFhFDh8817PRYHEkn5D2HwxK3IIMOSTVX1PdY8v4wa siHGnmkcYyeb1jH2un6pjdyPHjfuVcG/UoYxn4tDNRD35j3Zu0yjoXiyjn5M9U2zjOM1wH0TpPgc6 XRVUw3Jw==; 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 1j5wy2-0003T0-DC; Sun, 23 Feb 2020 19:31:06 +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 1j5wx2-0001RL-1s for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:30:05 +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 0D69A30E; Sun, 23 Feb 2020 11:30:03 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1E333F6CF; Sun, 23 Feb 2020 11:30:00 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 06/15] arm64: hibernate.c: Create a new function to handle cpu_up(sleep_cpu) Date: Sun, 23 Feb 2020 19:29:33 +0000 Message-Id: <20200223192942.18420-7-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_113004_393157_64B4CF85 X-CRM114-Status: GOOD ( 14.83 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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: Mark Rutland , linux-kernel@vger.kernel.org, "Paul E . McKenney" , Steve Capper , "Peter Zijlstra \(Intel\)" , Catalin Marinas , Daniel Lezcano , Pavankumar Kondeti , Zhenzhong Duan , Nicholas Piggin , Ingo Molnar , Richard Fontana , James Morse , Josh Poimboeuf , Jiri Kosina , Will Deacon , Qais Yousef , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation to make cpu_up/down private - move the user in arm64 hibernate.c to use a new generic function that provides what arm64 needs. Signed-off-by: Qais Yousef CC: Catalin Marinas CC: Will Deacon CC: Steve Capper CC: Richard Fontana CC: James Morse CC: Mark Rutland CC: Thomas Gleixner CC: Josh Poimboeuf CC: Ingo Molnar CC: "Peter Zijlstra (Intel)" CC: Nicholas Piggin CC: Daniel Lezcano CC: Jiri Kosina CC: Pavankumar Kondeti CC: Zhenzhong Duan CC: linux-arm-kernel@lists.infradead.org CC: linux-kernel@vger.kernel.org Acked-by: Catalin Marinas --- arch/arm64/kernel/hibernate.c | 13 +++++-------- include/linux/cpu.h | 1 + kernel/cpu.c | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 590963c9c609..5b73e92c99e3 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -166,14 +166,11 @@ int arch_hibernation_header_restore(void *addr) sleep_cpu = -EINVAL; return -EINVAL; } - if (!cpu_online(sleep_cpu)) { - pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n"); - ret = cpu_up(sleep_cpu); - if (ret) { - pr_err("Failed to bring hibernate-CPU up!\n"); - sleep_cpu = -EINVAL; - return ret; - } + + ret = bringup_hibernate_cpu(sleep_cpu); + if (ret) { + sleep_cpu = -EINVAL; + return ret; } resume_hdr = *hdr; diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 64a246e9c8db..aebe8186cb07 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -93,6 +93,7 @@ int add_cpu(unsigned int cpu); void notify_cpu_starting(unsigned int cpu); extern void cpu_maps_update_begin(void); extern void cpu_maps_update_done(void); +extern int bringup_hibernate_cpu(unsigned int sleep_cpu); #else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 diff --git a/kernel/cpu.c b/kernel/cpu.c index 03c727195b65..bf39c5bfb6d9 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1275,6 +1275,30 @@ int add_cpu(unsigned int cpu) } EXPORT_SYMBOL_GPL(add_cpu); +/** + * bringup_hibernate_cpu - Bring up the CPU that we hibernated on + * @sleep_cpu: The cpu we hibernated on and should be brought up. + * + * On some archs like arm64, we can hibernate on any CPU, but on wake up the + * CPU we hibernated on might be offline as a side effect of using maxcpus= for + * example. + */ +int bringup_hibernate_cpu(unsigned int sleep_cpu) +{ + int ret; + + if (!cpu_online(sleep_cpu)) { + pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n"); + ret = cpu_up(sleep_cpu); + if (ret) { + pr_err("Failed to bring hibernate-CPU up!\n"); + return ret; + } + } + + return 0; +} + #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; From patchwork Sun Feb 23 19:29:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 11399031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EBBF14E3 for ; Sun, 23 Feb 2020 19:31:25 +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 50CE320836 for ; Sun, 23 Feb 2020 19:31:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BAFLpJ3s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50CE320836 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+patchwork-linux-arm=patchwork.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=O8bc9bZX2SsSMjCfjmGQlaCVz4RxY8NvSqQgXgD/g2Q=; b=BAFLpJ3shHNAHBJRYAnMSTgdwP E/zTSlC3ze/5FOp7uT1/UclPxzEwiT8+teNhuvSHE4iBPuLZ/aXLh6IFFN33dHWH9vjk+gZEO5lTY eFPPZkOjGfiaDNRF0xSNegv7i3l2RprvQrtTNWUHGSb8i2TSXZUs4n7w2CqUN9Ex5F5KuCzTJZxqM 2wW9wd8OafxuA7tRuLCLnerNLCdF/W8l4RyVH6ISHor8AWevtgHn83oDY6BbzLnXZmTuWdPeKhXro Ojkz+TLDN81zT7sAxXPkyP4Jg0AfYDaTvPYQbnRhuJP/YkAuukNZUEUbpBXWEA0kXA/kH+tayv9RW isxSw6Bg==; 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 1j5wyI-0003jb-1H; Sun, 23 Feb 2020 19:31:22 +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 1j5wxB-0002SI-4h for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2020 19:30:17 +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 D23E330E; Sun, 23 Feb 2020 11:30:11 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D28083F6CF; Sun, 23 Feb 2020 11:30:10 -0800 (PST) From: Qais Yousef To: Thomas Gleixner Subject: [PATCH v3 12/15] firmware: psci: Replace cpu_up/down with add/remove_cpu Date: Sun, 23 Feb 2020 19:29:39 +0000 Message-Id: <20200223192942.18420-13-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223192942.18420-1-qais.yousef@arm.com> References: <20200223192942.18420-1-qais.yousef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_113013_298543_C0D0A1BB X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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: Mark Rutland , Lorenzo Pieralisi , "Paul E . McKenney" , linux-kernel@vger.kernel.org, Qais Yousef , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The core device API performs extra housekeeping bits that are missing from directly calling cpu_up/down. See commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM") for an example description of what might go wrong. This also prepares to make cpu_up/down a private interface for anything but the cpu subsystem. Signed-off-by: Qais Yousef CC: Mark Rutland CC: Lorenzo Pieralisi CC: linux-arm-kernel@lists.infradead.org CC: linux-kernel@vger.kernel.org --- drivers/firmware/psci/psci_checker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c index 6a445397771c..873841af8d57 100644 --- a/drivers/firmware/psci/psci_checker.c +++ b/drivers/firmware/psci/psci_checker.c @@ -84,7 +84,7 @@ static unsigned int down_and_up_cpus(const struct cpumask *cpus, /* Try to power down all CPUs in the mask. */ for_each_cpu(cpu, cpus) { - int ret = cpu_down(cpu); + int ret = remove_cpu(cpu); /* * cpu_down() checks the number of online CPUs before the TOS @@ -116,7 +116,7 @@ static unsigned int down_and_up_cpus(const struct cpumask *cpus, /* Try to power up all the CPUs that have been offlined. */ for_each_cpu(cpu, offlined_cpus) { - int ret = cpu_up(cpu); + int ret = add_cpu(cpu); if (ret != 0) { pr_err("Error occurred (%d) while trying "