From: Qais Yousef <qais.yousef@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Qais Yousef <qais.yousef@arm.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Jiri Kosina <jkosina@suse.cz>,
Nicholas Piggin <npiggin@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Ingo Molnar <mingo@kernel.org>,
Eiichi Tsukata <devel@etsukata.com>,
Zhenzhong Duan <zhenzhong.duan@oracle.com>,
Nadav Amit <namit@vmware.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 11/12] smp: Create a new function to bringup nonboot cpus online
Date: Wed, 30 Oct 2019 15:38:36 +0000 [thread overview]
Message-ID: <20191030153837.18107-12-qais.yousef@arm.com> (raw)
In-Reply-To: <20191030153837.18107-1-qais.yousef@arm.com>
This is the last direct user of cpu_up() before we can hide it now as
internal implementation detail of the cpu subsystem.
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Josh Poimboeuf <jpoimboe@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Jiri Kosina <jkosina@suse.cz>
CC: Nicholas Piggin <npiggin@gmail.com>
CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Eiichi Tsukata <devel@etsukata.com>
CC: Zhenzhong Duan <zhenzhong.duan@oracle.com>
CC: Nadav Amit <namit@vmware.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
CC: linux-kernel@vger.kernel.org
---
include/linux/cpu.h | 1 +
kernel/cpu.c | 13 +++++++++++++
kernel/smp.c | 9 +--------
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 3b1fbe192989..b1c7b788b8e9 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -88,6 +88,7 @@ void notify_cpu_starting(unsigned int cpu);
extern void cpu_maps_update_begin(void);
extern void cpu_maps_update_done(void);
extern int hibernation_bringup_sleep_cpu(unsigned int sleep_cpu);
+extern void smp_bringup_nonboot_cpus(unsigned int setup_max_cpus);
#else /* CONFIG_SMP */
#define cpuhp_tasks_frozen 0
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 219f9033f438..e16695b841de 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1211,6 +1211,19 @@ int hibernation_bringup_sleep_cpu(unsigned int sleep_cpu)
}
}
+void smp_bringup_nonboot_cpus(unsigned int setup_max_cpus)
+{
+ unsigned int cpu;
+
+ /* FIXME: This should be done in userspace --RR */
+ for_each_present_cpu(cpu) {
+ if (num_online_cpus() >= setup_max_cpus)
+ break;
+ if (!cpu_online(cpu))
+ cpu_up(cpu);
+ }
+}
+
#ifdef CONFIG_PM_SLEEP_SMP
static cpumask_var_t frozen_cpus;
diff --git a/kernel/smp.c b/kernel/smp.c
index 7dbcb402c2fc..74134272b5aa 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -578,20 +578,13 @@ void __init setup_nr_cpu_ids(void)
void __init smp_init(void)
{
int num_nodes, num_cpus;
- unsigned int cpu;
idle_threads_init();
cpuhp_threads_init();
pr_info("Bringing up secondary CPUs ...\n");
- /* FIXME: This should be done in userspace --RR */
- for_each_present_cpu(cpu) {
- if (num_online_cpus() >= setup_max_cpus)
- break;
- if (!cpu_online(cpu))
- cpu_up(cpu);
- }
+ smp_bringup_nonboot_cpus(setup_max_cpus);
num_nodes = num_online_nodes();
num_cpus = num_online_cpus();
--
2.17.1
next prev parent reply other threads:[~2019-10-30 15:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191030153837.18107-1-qais.yousef@arm.com>
2019-10-30 15:38 ` [PATCH 01/12] arm64: hibernate.c: create a new function to handle cpu_up(sleep_cpu) Qais Yousef
2019-11-19 22:31 ` Thomas Gleixner
2019-11-19 22:51 ` Qais Yousef
2019-11-19 23:01 ` Thomas Gleixner
2019-11-19 23:21 ` Qais Yousef
2019-10-30 15:38 ` [PATCH 02/12] x86: Replace cpu_up/down with devcie_online/offline Qais Yousef
2019-10-30 15:38 ` [PATCH 03/12] powerpc: Replace cpu_up/down with device_online/offline Qais Yousef
2019-11-19 1:19 ` Michael Ellerman
2019-11-19 9:47 ` Qais Yousef
2019-10-30 15:38 ` [PATCH 04/12] ia64: Replace cpu_down with freeze_secondary_cpus Qais Yousef
2019-11-02 4:59 ` kbuild test robot
2019-11-19 22:21 ` Thomas Gleixner
2019-11-19 22:32 ` Qais Yousef
2019-11-19 22:59 ` Thomas Gleixner
2019-11-19 23:19 ` Qais Yousef
2019-11-20 8:46 ` Thomas Gleixner
2019-11-20 10:49 ` Qais Yousef
2019-10-30 15:38 ` [PATCH 05/12] sparc: Replace cpu_up/down with device_online/offline Qais Yousef
2019-10-30 19:33 ` David Miller
2019-10-30 15:38 ` [PATCH 06/12] parisc: " Qais Yousef
2019-11-20 11:09 ` Qais Yousef
2019-11-22 19:51 ` Helge Deller
2019-11-24 10:20 ` Qais Yousef
2019-10-30 15:38 ` [PATCH 07/12] driver: base: cpu: export device_online/offline Qais Yousef
2019-11-02 17:17 ` Greg Kroah-Hartman
2019-10-30 15:38 ` [PATCH 08/12] driver: xen: Replace cpu_up/down with device_online/offline Qais Yousef
2019-10-30 15:38 ` [PATCH 09/12] firmware: psci: " Qais Yousef
2019-10-30 15:38 ` [PATCH 10/12] torture: " Qais Yousef
2019-10-30 15:38 ` Qais Yousef [this message]
2019-11-19 22:42 ` [PATCH 11/12] smp: Create a new function to bringup nonboot cpus online Thomas Gleixner
2019-10-30 15:38 ` [PATCH 12/12] cpu: Hide cpu_up/down Qais Yousef
2019-11-19 22:25 ` Thomas Gleixner
2019-11-19 22:36 ` Qais Yousef
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=20191030153837.18107-12-qais.yousef@arm.com \
--to=qais.yousef@arm.com \
--cc=daniel.lezcano@linaro.org \
--cc=devel@etsukata.com \
--cc=gregkh@linuxfoundation.org \
--cc=jkosina@suse.cz \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namit@vmware.com \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=zhenzhong.duan@oracle.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).