Commit 344bf5a0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix handling of spares physical APIC ids

From: William Lee Irwin III <wli@holomorphy.com>

To handle sparse physical APIC ID's properly the phys_cpu_present_map must
be scanned beyond bit NR_CPUS while ensuring no more than NR_CPUS are woken
in order not to attempt to wake non-addressible cpus.

The following patch adds that logic to smp_boot_cpus() and corrects the
failure to wake secondaries reported by dhowells, with successful wakeup,
runtime, reboot, and halting reported after it was applied.
parent 944da977
...@@ -935,7 +935,7 @@ int cpu_sibling_map[NR_CPUS] __cacheline_aligned; ...@@ -935,7 +935,7 @@ int cpu_sibling_map[NR_CPUS] __cacheline_aligned;
static void __init smp_boot_cpus(unsigned int max_cpus) static void __init smp_boot_cpus(unsigned int max_cpus)
{ {
int apicid, cpu, bit; int apicid, cpu, bit, kicked;
/* /*
* Setup boot CPU information * Setup boot CPU information
...@@ -1018,7 +1018,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus) ...@@ -1018,7 +1018,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
*/ */
Dprintk("CPU present map: %lx\n", phys_cpu_present_map); Dprintk("CPU present map: %lx\n", phys_cpu_present_map);
for (bit = 0; bit < NR_CPUS; bit++) { kicked = 1;
for (bit = 0; kicked < NR_CPUS && bit < BITS_PER_LONG; bit++) {
apicid = cpu_present_to_apicid(bit); apicid = cpu_present_to_apicid(bit);
/* /*
* Don't even attempt to start the boot CPU! * Don't even attempt to start the boot CPU!
...@@ -1034,6 +1035,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus) ...@@ -1034,6 +1035,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
if (do_boot_cpu(apicid)) if (do_boot_cpu(apicid))
printk("CPU #%d not responding - cannot use it.\n", printk("CPU #%d not responding - cannot use it.\n",
apicid); apicid);
else
++kicked;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment