mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
smp: Allow booting a specific subset of CPUs
In a heterogenous multiprocessor system, specifying the 'maxcpus' parameter on the kernel command line does not provide sufficient control over which CPUs are brought online at kernel boot time, since CPUs may have nonuniform performance characteristics. Thus, we introduce a 'boot_cpus' command line argument, allowing the user to explicitly specify the list of CPUs that shall be brought online during kernel boot. Change-Id: I7bf5efa94785bc6cf1236aa71f4d7364e859fc37 Signed-off-by: Channagoud Kadabi <ckadabi@codeaurora.org> Signed-off-by: Elliot Berman <eberman@codeaurora.org>
This commit is contained in:
parent
243513a690
commit
0e84930fa5
2 changed files with 36 additions and 1 deletions
|
|
@ -432,6 +432,10 @@
|
|||
embedded devices based on command line input.
|
||||
See Documentation/block/cmdline-partition.txt
|
||||
|
||||
boot_cpus= [SMP]
|
||||
Rather than attempting to online all possible CPUs at
|
||||
boot time, only online the specified set of CPUs.
|
||||
|
||||
boot_delay= Milliseconds to delay each printk during boot.
|
||||
Values larger than 10 seconds (10000) are changed to
|
||||
no delay (0).
|
||||
|
|
|
|||
33
kernel/smp.c
33
kernel/smp.c
|
|
@ -39,6 +39,9 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
|
|||
static DEFINE_PER_CPU_SHARED_ALIGNED(struct llist_head, call_single_queue);
|
||||
|
||||
static void flush_smp_call_function_queue(bool warn_cpu_offline);
|
||||
/* CPU mask indicating which CPUs to bring online during smp_init() */
|
||||
static bool have_boot_cpu_mask;
|
||||
static cpumask_var_t boot_cpu_mask;
|
||||
|
||||
int smpcfd_prepare_cpu(unsigned int cpu)
|
||||
{
|
||||
|
|
@ -550,6 +553,19 @@ static int __init maxcpus(char *str)
|
|||
|
||||
early_param("maxcpus", maxcpus);
|
||||
|
||||
static int __init boot_cpus(char *str)
|
||||
{
|
||||
alloc_bootmem_cpumask_var(&boot_cpu_mask);
|
||||
if (cpulist_parse(str, boot_cpu_mask) < 0) {
|
||||
pr_warn("SMP: Incorrect boot_cpus cpumask\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
have_boot_cpu_mask = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
early_param("boot_cpus", boot_cpus);
|
||||
|
||||
/* Setup number of possible processor ids */
|
||||
unsigned int nr_cpu_ids __read_mostly = NR_CPUS;
|
||||
EXPORT_SYMBOL(nr_cpu_ids);
|
||||
|
|
@ -560,6 +576,20 @@ void __init setup_nr_cpu_ids(void)
|
|||
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
|
||||
}
|
||||
|
||||
static inline bool boot_cpu(int cpu)
|
||||
{
|
||||
if (!have_boot_cpu_mask)
|
||||
return true;
|
||||
|
||||
return cpumask_test_cpu(cpu, boot_cpu_mask);
|
||||
}
|
||||
|
||||
static inline void free_boot_cpu_mask(void)
|
||||
{
|
||||
if (have_boot_cpu_mask) /* Allocated from boot_cpus() */
|
||||
free_bootmem_cpumask_var(boot_cpu_mask);
|
||||
}
|
||||
|
||||
/* Called by boot processor to activate the rest. */
|
||||
void __init smp_init(void)
|
||||
{
|
||||
|
|
@ -575,9 +605,10 @@ void __init smp_init(void)
|
|||
for_each_present_cpu(cpu) {
|
||||
if (num_online_cpus() >= setup_max_cpus)
|
||||
break;
|
||||
if (!cpu_online(cpu))
|
||||
if (!cpu_online(cpu) && boot_cpu(cpu))
|
||||
cpu_up(cpu);
|
||||
}
|
||||
free_boot_cpu_mask();
|
||||
|
||||
num_nodes = num_online_nodes();
|
||||
num_cpus = num_online_cpus();
|
||||
|
|
|
|||
Loading…
Reference in a new issue