Skip to content

Commit

Permalink
ARC: [SMP] avoid overriding present cpumask
Browse files Browse the repository at this point in the history
At smp_prepare_cpus() we set present cpu mask as part of init
for all CPUs at range [0-max_cpus].
This is done without checking if this mask is already being set.
At platform of eznps this mask is already being initialized at
smp_init_cpus() by using hook plat_smp_ops.init_early_smp().
So to avoid overriding of present cpu mask we check the number of
bits which are set in this mask. At the begin only bit for boot CPU
is set so if number of bits already set is no more than one we can be
assure that there is no overriding of this mask.

Signed-off-by: Noam Camus <[email protected]>
Signed-off-by: Vineet Gupta <[email protected]>
  • Loading branch information
Noam Camus authored and vineetgarc committed Nov 1, 2016
1 parent 6227e9f commit 8f6d9eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/arc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
int i;

/*
* Initialise the present map, which describes the set of CPUs
* actually populated at the present time.
* if platform didn't set the present map already, do it now
* boot cpu is set to present already by init/main.c
*/
for (i = 0; i < max_cpus; i++)
set_cpu_present(i, true);
if (num_present_cpus() <= 1) {
for (i = 0; i < max_cpus; i++)
set_cpu_present(i, true);
}
}

void __init smp_cpus_done(unsigned int max_cpus)
Expand Down

0 comments on commit 8f6d9eb

Please sign in to comment.