Commit 14adf855 authored by Chuck Ebbert's avatar Chuck Ebbert Committed by Ingo Molnar

x86: move prefill_possible_map calling early, fix, V2

Commit 4a701737 ("x86: move prefill_possible_map calling early, fix")
is the wrong fix: prefill_possible_map() needs to be available
even when CONFIG_HOTPLUG_CPU is not set. A followon patch will do that.

Fix this correctly by making prefill_possible_map() available even when
CONFIG_HOTPLUG_CPU is not set. The function is needed so that
the number of possible CPUs can be determined.

Tested on uniprocessor machine with CPU hotplug disabled.

From boot log:
  Before: NR_CPUS: 512, nr_cpu_ids: 512, nr_node_ids 1
  After: NR_CPUS: 512, nr_cpu_ids: 1, nr_node_ids 1
Signed-off-by: default avatarChuck Ebbert <cebbert@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 69d45dd1
...@@ -1261,39 +1261,8 @@ void __init native_smp_cpus_done(unsigned int max_cpus) ...@@ -1261,39 +1261,8 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
check_nmi_watchdog(); check_nmi_watchdog();
} }
#ifdef CONFIG_HOTPLUG_CPU
static void remove_siblinginfo(int cpu)
{
int sibling;
struct cpuinfo_x86 *c = &cpu_data(cpu);
for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) {
cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
/*/
* last thread sibling in this cpu core going down
*/
if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
cpu_data(sibling).booted_cores--;
}
for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu))
cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
cpus_clear(per_cpu(cpu_sibling_map, cpu));
cpus_clear(per_cpu(cpu_core_map, cpu));
c->phys_proc_id = 0;
c->cpu_core_id = 0;
cpu_clear(cpu, cpu_sibling_setup_map);
}
static int additional_cpus __initdata = -1; static int additional_cpus __initdata = -1;
static __init int setup_additional_cpus(char *s)
{
return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL;
}
early_param("additional_cpus", setup_additional_cpus);
/* /*
* cpu_possible_map should be static, it cannot change as cpu's * cpu_possible_map should be static, it cannot change as cpu's
* are onlined, or offlined. The reason is per-cpu data-structures * are onlined, or offlined. The reason is per-cpu data-structures
...@@ -1340,6 +1309,37 @@ __init void prefill_possible_map(void) ...@@ -1340,6 +1309,37 @@ __init void prefill_possible_map(void)
nr_cpu_ids = possible; nr_cpu_ids = possible;
} }
#ifdef CONFIG_HOTPLUG_CPU
static void remove_siblinginfo(int cpu)
{
int sibling;
struct cpuinfo_x86 *c = &cpu_data(cpu);
for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) {
cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
/*/
* last thread sibling in this cpu core going down
*/
if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
cpu_data(sibling).booted_cores--;
}
for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu))
cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
cpus_clear(per_cpu(cpu_sibling_map, cpu));
cpus_clear(per_cpu(cpu_core_map, cpu));
c->phys_proc_id = 0;
c->cpu_core_id = 0;
cpu_clear(cpu, cpu_sibling_setup_map);
}
static __init int setup_additional_cpus(char *s)
{
return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL;
}
early_param("additional_cpus", setup_additional_cpus);
static void __ref remove_cpu_from_maps(int cpu) static void __ref remove_cpu_from_maps(int cpu)
{ {
cpu_clear(cpu, cpu_online_map); cpu_clear(cpu, cpu_online_map);
......
...@@ -141,6 +141,8 @@ void play_dead_common(void); ...@@ -141,6 +141,8 @@ void play_dead_common(void);
void native_send_call_func_ipi(cpumask_t mask); void native_send_call_func_ipi(cpumask_t mask);
void native_send_call_func_single_ipi(int cpu); void native_send_call_func_single_ipi(int cpu);
extern void prefill_possible_map(void);
void smp_store_cpu_info(int id); void smp_store_cpu_info(int id);
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
...@@ -149,15 +151,11 @@ static inline int num_booting_cpus(void) ...@@ -149,15 +151,11 @@ static inline int num_booting_cpus(void)
{ {
return cpus_weight(cpu_callout_map); return cpus_weight(cpu_callout_map);
} }
#endif /* CONFIG_SMP */
#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_CPU)
extern void prefill_possible_map(void);
#else #else
static inline void prefill_possible_map(void) static inline void prefill_possible_map(void)
{ {
} }
#endif #endif /* CONFIG_SMP */
extern unsigned disabled_cpus __cpuinitdata; extern unsigned disabled_cpus __cpuinitdata;
......
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