From: Ian Campbell Subject: Re: [PATCH v2 3/5] arm: set the default dom0 max_vcpus value to 1 (currently is 0) Date: Fri, 24 Feb 2012 10:40:47 +0000 Message-ID: <1330080047.8557.167.camel@zakaz.uk.xensource.com> References: <1330021293-21554-3-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1330021293-21554-3-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "xen-devel@lists.xensource.com" , David Vrabel , "Tim Deegan (3P)" List-Id: xen-devel@lists.xenproject.org On Thu, 2012-02-23 at 18:21 +0000, Stefano Stabellini wrote: > Signed-off-by: Stefano Stabellini Why is this needed? It makes it impossible to distinguish the "use all CPUs" default from the "only use 1 CPU" case. I think we want this instead, it's approx what x86 does, modulo not using cpupool0: 8<---------------------------------------------- >From 7c66c893c5fbf485bc9071b9ef14680475b91670 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 24 Feb 2012 10:36:42 +0000 Subject: [PATCH] arm: handle dom0_max_vcpus=0 case properly Also use xzalloc_array. Signed-off-by: Ian Campbell --- xen/arch/arm/domain_build.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index ec5a9f3..4efe07d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -15,13 +15,14 @@ integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); 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); -- 1.7.2.5