| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] arm: handle dom0_max_vcpus=0 case properly
 # HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1331718424 0
# Node ID f01efbb36d1288d21fc512a52746eac28865f03b
# Parent  e1578914bfd6d4a01276786396b7d0faf4fd3153
arm: handle dom0_max_vcpus=0 case properly
Also use xzalloc_array.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
diff -r e1578914bfd6 -r f01efbb36d12 xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c       Wed Mar 14 09:47:03 2012 +0000
+++ b/xen/arch/arm/domain_build.c       Wed Mar 14 09:47:04 2012 +0000
@@ -15,13 +15,14 @@
 
 struct vcpu *__init alloc_dom0_vcpu0(void)
 {
-    dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus);
+    if ( opt_dom0_max_vcpus == 0 )
+        opt_dom0_max_vcpus = num_online_cpus();
+    if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
+        opt_dom0_max_vcpus = MAX_VIRT_CPUS;
+
+    dom0->vcpu = xzalloc_array(struct vcpu *, opt_dom0_max_vcpus);
     if ( !dom0->vcpu )
-    {
-            printk("failed to alloc dom0->vccpu\n");
         return NULL;
-    }
-    memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu));
     dom0->max_vcpus = opt_dom0_max_vcpus;
 
     return alloc_vcpu(dom0, 0, 0);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |