aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/setup.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-10-21 09:17:42 +0200
committerJan Beulich <jbeulich@suse.com>2011-10-21 09:17:42 +0200
commit20307695e5c22a58b4cce35fba5333375da5a7fa (patch)
tree65584141fd42e108c6feca25eec190526cb01eac /xen/arch/x86/setup.c
parenta8a8a52a27513b35d1c6aa2d542074f99849ac3d (diff)
downloadxen-20307695e5c22a58b4cce35fba5333375da5a7fa.tar.gz
xen-20307695e5c22a58b4cce35fba5333375da5a7fa.tar.bz2
xen-20307695e5c22a58b4cce35fba5333375da5a7fa.zip
introduce and use nr_cpu_ids and nr_cpumask_bits
The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS, where necessary, get adjusted accordingly), while the latter is for the sole use of determining the allocation size when dynamically allocating CPU masks (done later in this series). Adjust accessors to use either of the two to bound their bitmap operations - which one gets used depends on whether accessing the bits in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more efficient. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/setup.c')
-rw-r--r--xen/arch/x86/setup.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5880e9e8b3..8bc77b0fc8 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -51,7 +51,7 @@ static bool_t __initdata opt_nosmp;
boolean_param("nosmp", opt_nosmp);
/* maxcpus: maximum number of CPUs to activate. */
-static unsigned int __initdata max_cpus = NR_CPUS;
+static unsigned int __initdata max_cpus;
integer_param("maxcpus", max_cpus);
/* opt_watchdog: If true, run a watchdog NMI on each processor. */
@@ -230,7 +230,7 @@ static void __init normalise_cpu_order(void)
* Among identical longest-prefix matches, pick the smallest APIC ID.
*/
for ( j = next_cpu(i, cpu_present_map);
- j < NR_CPUS;
+ j < nr_cpu_ids;
j = next_cpu(j, cpu_present_map) )
{
diff = x86_cpu_to_apicid[j] ^ apicid;
@@ -246,9 +246,9 @@ static void __init normalise_cpu_order(void)
}
/* If no match then there must be no CPUs remaining to consider. */
- if ( min_cpu >= NR_CPUS )
+ if ( min_cpu >= nr_cpu_ids )
{
- BUG_ON(next_cpu(i, cpu_present_map) < NR_CPUS);
+ BUG_ON(next_cpu(i, cpu_present_map) < nr_cpu_ids);
break;
}
@@ -1203,6 +1203,17 @@ void __init __start_xen(unsigned long mbi_p)
if ( smp_found_config )
get_smp_config();
+ if ( opt_nosmp )
+ {
+ max_cpus = 0;
+ set_nr_cpu_ids(1);
+ }
+ else
+ {
+ set_nr_cpu_ids(max_cpus);
+ max_cpus = nr_cpu_ids;
+ }
+
#ifdef CONFIG_X86_64
/* Low mappings were only needed for some BIOS table parsing. */
zap_low_mappings();
@@ -1254,9 +1265,6 @@ void __init __start_xen(unsigned long mbi_p)
acpi_mmcfg_init();
#endif
- if ( opt_nosmp )
- max_cpus = 0;
-
iommu_setup(); /* setup iommu if available */
smp_prepare_cpus(max_cpus);