aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-08-08 11:22:44 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-08-08 11:22:44 +0100
commit36444aeb04312f204bac7d1caa39aad62eadea4c (patch)
tree66c93a354a8a07739144d365971e6a2d7b278efa
parent8a067f68b1e730524c21981e438587665fd95a6a (diff)
downloadxen-36444aeb04312f204bac7d1caa39aad62eadea4c.tar.gz
xen-36444aeb04312f204bac7d1caa39aad62eadea4c.tar.bz2
xen-36444aeb04312f204bac7d1caa39aad62eadea4c.zip
x86: Reduce restrictions on dom0_max_vcpus.
Place a BUILD_BUG_ON() in mm.c to replace one of the restrictions. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--xen/arch/x86/domain_build.c6
-rw-r--r--xen/arch/x86/mm.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
index 8bb24c9dd6..d4388a6669 100644
--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -704,16 +704,12 @@ int __init construct_dom0(
if ( opt_dom0_max_vcpus == 0 )
opt_dom0_max_vcpus = num_online_cpus();
- if ( opt_dom0_max_vcpus > num_online_cpus() )
- opt_dom0_max_vcpus = num_online_cpus();
if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
opt_dom0_max_vcpus = MAX_VIRT_CPUS;
- if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) )
- opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d);
printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
for ( i = 1; i < opt_dom0_max_vcpus; i++ )
- (void)alloc_vcpu(d, i, i);
+ (void)alloc_vcpu(d, i, i % num_online_cpus());
/* Set up CR3 value for write_ptbase */
if ( paging_mode_enabled(v->domain) )
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 9aa18a9c3c..c6855d76d6 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2218,6 +2218,12 @@ static inline cpumask_t vcpumask_to_pcpumask(
cpumask_t pmask = CPU_MASK_NONE;
struct vcpu *v;
+ /*
+ * Callers copy only a single guest-sized longword from the guest.
+ * This must be wide enough to reference all VCPUs. Worst case is 32 bits.
+ */
+ BUILD_BUG_ON(MAX_VIRT_CPUS > 32);
+
while ( vmask != 0 )
{
vcpu_id = find_first_set_bit(vmask);