From: Yinghai Lu <yinghai@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@elte.hu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] add command line init_start_cpus
Date: Sat, 13 Dec 2008 22:06:49 -0800 [thread overview]
Message-ID: <4944A279.5020009@kernel.org> (raw)
Impact: new command line
so could select cpus to be started during init stage
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
Documentation/kernel-parameters.txt | 14 ++++++++++++++
init/main.c | 29 ++++++++++++++++++++++++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
Index: linux-2.6/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.orig/Documentation/kernel-parameters.txt
+++ linux-2.6/Documentation/kernel-parameters.txt
@@ -918,6 +918,20 @@ and is between 256 and 4096 characters.
forcesac
soft
+ init_start_cpus= [KNL,SMP] set CPUs that will be started during
+ init stage.
+ Format:
+ <cpu number>,...,<cpu number>
+ or
+ <cpu number>-<cpu number>
+ (must be a positive range in ascending order)
+ or a mixture
+ <cpu number>,...,<cpu number>-<cpu number>
+
+ This option can be used to specify one or more CPUs
+ to be started during init stage.
+ <cpu number> begins at 0 and the maximum value is
+ "number of CPUs in system - 1".
intel_iommu= [DMAR] Intel IOMMU driver (DMAR) option
off
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -413,11 +413,35 @@ static void __init setup_per_cpu_areas(v
}
#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
+static __initdata cpumask_var_t cpu_init_start_mask;
+
+/* Setup the mask of cpus configured for init start */
+static int __init init_start_cpu_setup(char *str)
+{
+ cpulist_parse(str, *cpu_init_start_mask);
+
+ return 1;
+}
+
+__setup("init_start_cpus=", init_start_cpu_setup);
+
/* Called by boot processor to activate the rest. */
static void __init smp_init(void)
{
unsigned int cpu;
+ struct cpumask *start_mask;
+
+ if (cpumask_empty(cpu_init_start_mask))
+ start_mask = &cpu_present_map;
+ else {
+ start_mask = kmalloc(cpumask_size(), GFP_KERNEL);
+ if (!start_mask)
+ start_mask = &cpu_present_map;
+ else
+ cpumask_and(start_mask, cpu_init_start_mask,
+ &cpu_present_map);
+ }
/*
* Set up the current CPU as possible to migrate to.
* The other ones will be done by cpu_up/cpu_down()
@@ -426,13 +450,16 @@ static void __init smp_init(void)
cpu_set(cpu, cpu_active_map);
/* FIXME: This should be done in userspace --RR */
- for_each_present_cpu(cpu) {
+ for_each_cpu_mask_nr(cpu, *start_mask) {
if (num_online_cpus() >= setup_max_cpus)
break;
if (!cpu_online(cpu))
cpu_up(cpu);
}
+ if (start_mask != &cpu_present_map)
+ kfree(start_mask);
+
/* Any cleanup work */
printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
smp_cpus_done(setup_max_cpus);
next reply other threads:[~2008-12-14 6:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-14 6:06 Yinghai Lu [this message]
2008-12-14 6:18 ` [PATCH] add command line init_start_cpus Andrew Morton
2008-12-14 7:28 ` [PATCH] add init_start_cpus to config boot cpus -v2 Yinghai Lu
2008-12-14 9:55 ` Andrew Morton
2008-12-15 0:11 ` [PATCH] add command line init_start_cpus Andi Kleen
2008-12-15 3:39 ` Yinghai Lu
2008-12-16 21:18 ` Ingo Molnar
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=4944A279.5020009@kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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