ia64/xen-unstable

changeset 8789:bc2ac5e87f99

Rationalise initialisation of cpu_possible_map.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Feb 08 11:10:52 2006 +0100 (2006-02-08)
parents dcc2beb8a1d2
children c9edeb3bd652
files linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Wed Feb 08 00:30:50 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Wed Feb 08 11:10:52 2006 +0100
     1.3 @@ -85,6 +85,9 @@ void __init prefill_possible_map(void)
     1.4  {
     1.5  	int i, rc;
     1.6  
     1.7 +	if (!cpus_empty(cpu_possible_map))
     1.8 +		return;
     1.9 +
    1.10  	for (i = 0; i < NR_CPUS; i++) {
    1.11  		rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
    1.12  		if (rc == -ENOENT)
    1.13 @@ -208,7 +211,7 @@ void vcpu_prepare(int vcpu)
    1.14  
    1.15  void __init smp_prepare_cpus(unsigned int max_cpus)
    1.16  {
    1.17 -	int cpu, rc;
    1.18 +	int cpu;
    1.19  	struct task_struct *idle;
    1.20  
    1.21  	cpu_data[0] = boot_cpu_data;
    1.22 @@ -223,11 +226,9 @@ void __init smp_prepare_cpus(unsigned in
    1.23  	if (max_cpus != 0)
    1.24  		xen_smp_intr_init(0);
    1.25  
    1.26 -	for (cpu = 1; cpu < max_cpus; cpu++) {
    1.27 -		rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL);
    1.28 -		if (rc == -ENOENT)
    1.29 -			break;
    1.30 -		BUG_ON(rc != 0);
    1.31 +	for_each_cpu_mask (cpu, cpu_possible_map) {
    1.32 +		if (cpu == 0)
    1.33 +			continue;
    1.34  
    1.35  		cpu_data[cpu] = boot_cpu_data;
    1.36  		cpu_2_logical_apicid[cpu] = cpu;
    1.37 @@ -257,7 +258,6 @@ void __init smp_prepare_cpus(unsigned in
    1.38  			(void *)cpu_gdt_descr[cpu].address,
    1.39  			XENFEAT_writable_descriptor_tables);
    1.40  
    1.41 -		cpu_set(cpu, cpu_possible_map);
    1.42  #ifdef CONFIG_HOTPLUG_CPU
    1.43  		if (xen_start_info->flags & SIF_INITDOMAIN)
    1.44  			cpu_set(cpu, cpu_present_map);
    1.45 @@ -286,7 +286,7 @@ void __init smp_prepare_cpus(unsigned in
    1.46  
    1.47  void __devinit smp_prepare_boot_cpu(void)
    1.48  {
    1.49 -	cpu_possible_map = cpumask_of_cpu(0);
    1.50 +	prefill_possible_map();
    1.51  	cpu_present_map  = cpumask_of_cpu(0);
    1.52  	cpu_online_map   = cpumask_of_cpu(0);
    1.53  }