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

Re: [Xen-devel] [PATCH 16/38] arm: Add simple cpu_{sibling, core}_mask



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 <ian.campbell@xxxxxxxxxx>
> 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 <ian.campbell@xxxxxxxxxx>
> ---
>  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))) &&



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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