From: Ian Campbell Subject: Re: [PATCH v3 3/6] xen/arm: gic: Use the correct CPU ID Date: Fri, 20 Sep 2013 14:36:23 +0100 Message-ID: <1379684183.8994.6.camel@hastur.hellion.org.uk> References: <1379510122-9467-1-git-send-email-julien.grall@linaro.org> <1379510122-9467-4-git-send-email-julien.grall@linaro.org> <523C433B.7030404@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <523C433B.7030404@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: stefano.stabellini@eu.citrix.com, patches@linaro.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, 2013-09-20 at 13:44 +0100, Julien Grall wrote: > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > > index b969d23..4061691 100644 > > --- a/xen/arch/arm/gic.c > > +++ b/xen/arch/arm/gic.c > > @@ -57,6 +57,29 @@ static DEFINE_PER_CPU(uint64_t, lr_mask); > > > > static unsigned nr_lrs; > > > > +/* The GIC mapping of CPU interfaces does not necessarily match the > > + * logical CPU numbering. Let's use mapping as returned by the GIC > > + * itself > > + */ > > +static DEFINE_PER_CPU(u8, gic_cpu_id); > > + > > Following the discussion on another thread > (http://lists.xen.org/archives/html/xen-devel/2013-09/msg02072.html), we > need to initialize each CPU ID to 0xff by default, to be able to bring > up secondary CPUs with an SGI (send_SGI_mask). We may as well use the send_SGI_allbutself mechanism, which doesn't rely on knowing and target ids. > But as I understand, per_cpu area for a give area is initialized in > cpu_up and there is no way to give a default value. So user could call > send_SGI_mask to early function and use an invalid CPU area. If we need to go down this path then I would write something like cpu_online(cpu) ? this_cpu(thing, cpu) : 0xff but I don't think we need to because we can easily avoid the problem. > IMHO, this solution is too fragile and I would like to use the same > solution as my first version (ie with an array of 8 cells). I think cpu bring up should use allbutself and the other callers can reasonable be restricted to only operate on cpus which are up and therefore have a valid mask already allocated and initialised. Ian.