From: Ian Campbell Subject: Re: [PATCH 16/38] arm: Add simple cpu_{sibling, core}_mask Date: Wed, 13 Jun 2012 16:18:55 +0100 Message-ID: <1339600735.24104.230.camel@zakaz.uk.xensource.com> References: <1338565113.17466.141.camel@zakaz.uk.xensource.com> <1338565207-2888-1-git-send-email-ian.campbell@citrix.com> <1338565207-2888-16-git-send-email-ian.campbell@citrix.com> <20120607090808.GD70339@ocelot.phlegethon.org> <1339068947.18523.10.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1339068947.18523.10.camel@zakaz.uk.xensource.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: "Tim (Xen.org)" Cc: "Keir (Xen.org)" , Jan Beulich , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Keir, Jan: Any objection/ack for the generic part of this commit? > 8<------------------------------------------------------ > > From e980ca1ec9bf92b2f1255ac5222b1da1292f9f72 Mon Sep 17 00:00:00 2001 > From: Ian Campbell > Date: Mon, 14 May 2012 12:25:31 +0100 > Subject: [PATCH] arm: Add simple cpu_{sibling,core}_mask > > This needs to be done for all cpus. The allocations require smp_prepare_cpus > to be called a bit later on. > > In a previous version of this patch these maps were being zeroed (instead of > setting the CPU itself in them). This in turn causes cpumask_first to return > NR_CPUS, which in turn was causing default_vcpu0_location to misbehave and > read off the end of its cnt array. Add a couple of asserts to catch this in > the future. > > Signed-off-by: Ian Campbell > --- > xen/arch/arm/dummy.S | 2 -- > xen/arch/arm/setup.c | 4 ++-- > xen/arch/arm/smpboot.c | 21 +++++++++++++++++++++ > xen/common/domctl.c | 2 ++ > 4 files changed, 25 insertions(+), 4 deletions(-) [...] > diff --git a/xen/common/domctl.c b/xen/common/domctl.c > index 9f1a9ad..c1acd1d 100644 > --- a/xen/common/domctl.c > +++ b/xen/common/domctl.c > @@ -190,10 +190,12 @@ static unsigned int default_vcpu0_location(cpumask_t *online) > */ > cpumask_copy(&cpu_exclude_map, per_cpu(cpu_sibling_mask, 0)); > cpu = cpumask_first(&cpu_exclude_map); > + ASSERT(cpu < nr_cpus); > if ( cpumask_weight(&cpu_exclude_map) > 1 ) > cpu = cpumask_next(cpu, &cpu_exclude_map); > for_each_cpu(i, online) > { > + ASSERT(i < nr_cpus); > if ( cpumask_test_cpu(i, &cpu_exclude_map) ) > continue; > if ( (i == cpumask_first(per_cpu(cpu_sibling_mask, i))) &&