[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Reduce restrictions on dom0_max_vcpus.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1218190964 -3600
# Node ID d31546a3883e9635f5c8322e688c4ca3e6322e8c
# Parent  f62a61cd95f54358bc20a86411771acf6ed74ea0
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@xxxxxxxxxx>
---
 xen/arch/x86/domain_build.c |    6 +-----
 xen/arch/x86/mm.c           |    6 ++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff -r f62a61cd95f5 -r d31546a3883e xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Fri Aug 08 10:53:40 2008 +0100
+++ b/xen/arch/x86/domain_build.c       Fri Aug 08 11:22:44 2008 +0100
@@ -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 -r f62a61cd95f5 -r d31546a3883e xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Aug 08 10:53:40 2008 +0100
+++ b/xen/arch/x86/mm.c Fri Aug 08 11:22:44 2008 +0100
@@ -2218,6 +2218,12 @@ static inline cpumask_t vcpumask_to_pcpu
     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);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.