Skip to content

Commit

Permalink
arm64: Fix behavior of maxcpus=N
Browse files Browse the repository at this point in the history
maxcpu=n sets the number of CPUs activated at boot time to a max of n,
but allowing the remaining CPUs to be brought up later if the user
decides to do so. However, on arm64 due to various reasons, we disallowed
hotplugging CPUs beyond n, by marking them not present. Now that
we have checks in place to make sure the hotplugged CPUs have compatible
features with system and requires no new errata, relax the restriction.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: James Morse <james.morse@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Suzuki K Poulose authored and Will Deacon committed Apr 25, 2016
1 parent 6a6efbb commit 44dbcc9
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions arch/arm64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,33 +689,18 @@ void __init smp_init_cpus(void)
void __init smp_prepare_cpus(unsigned int max_cpus)
{
int err;
unsigned int cpu, ncores = num_possible_cpus();
unsigned int cpu;

init_cpu_topology();

smp_store_cpu_info(smp_processor_id());

/*
* are we trying to boot more cores than exist?
*/
if (max_cpus > ncores)
max_cpus = ncores;

/* Don't bother if we're effectively UP */
if (max_cpus <= 1)
return;

/*
* Initialise the present map (which describes the set of CPUs
* actually populated at the present time) and release the
* secondaries from the bootloader.
*
* Make sure we online at most (max_cpus - 1) additional CPUs.
*/
max_cpus--;
for_each_possible_cpu(cpu) {
if (max_cpus == 0)
break;

if (cpu == smp_processor_id())
continue;
Expand All @@ -728,7 +713,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
continue;

set_cpu_present(cpu, true);
max_cpus--;
}
}

Expand Down

0 comments on commit 44dbcc9

Please sign in to comment.