From: Ian Campbell Subject: Re: [PATCH v5 1/6] xen: Add convenient macro boot_cpu Date: Thu, 8 May 2014 11:19:59 +0100 Message-ID: <1399544399.9513.38.camel@kazak.uk.xensource.com> References: <1399045930-17364-1-git-send-email-julien.grall@linaro.org> <1399045930-17364-2-git-send-email-julien.grall@linaro.org> <5363C07F.8040603@citrix.com> <1399542924.9513.23.camel@kazak.uk.xensource.com> <536B71E00200007800010661@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WiLQr-0006ui-5Q for xen-devel@lists.xenproject.org; Thu, 08 May 2014 10:20:05 +0000 In-Reply-To: <536B71E00200007800010661@mail.emea.novell.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: Jan Beulich Cc: Keir Fraser , Andrew Cooper , Julien Grall , Ian Jackson , tim@xen.org, stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-05-08 at 11:00 +0100, Jan Beulich wrote: > >>> On 08.05.14 at 11:55, wrote: > > On Fri, 2014-05-02 at 16:57 +0100, Andrew Cooper wrote: > >> On 02/05/14 16:52, Julien Grall wrote: > >> > The macro boot_cpu will be used to get CPU variable from the boot CPU. > >> > > >> > Signed-off-by: Julien Grall > >> > Suggested-by: Ian Campbell > >> > Cc: Ian Jackson > >> > Cc: Jan Beulich > >> > Cc: Keir Fraser > >> > --- > >> > xen/include/xen/percpu.h | 3 +++ > >> > 1 file changed, 3 insertions(+) > >> > > >> > diff --git a/xen/include/xen/percpu.h b/xen/include/xen/percpu.h > >> > index abe0b11..0e848bf 100644 > >> > --- a/xen/include/xen/percpu.h > >> > +++ b/xen/include/xen/percpu.h > >> > @@ -16,6 +16,9 @@ > >> > /* Preferred on Xen. Also see arch-defined per_cpu(). */ > >> > #define this_cpu(var) __get_cpu_var(var) > >> > > >> > +/* Access variable on boot CPU */ > >> > +#define boot_cpu(var) per_cpu(var, 0) > >> > + > >> > >> What is this actually used for? > >> > >> In x86 with arbitrary cpu hotplug, we are trying to move away from the > >> false assumption than cpu0 is the boot cpu. Actual boot data is stored > >> sideways as boot_$FOO variables, and not accessed with the per-cpu > >> mechanism. > > > > Presumably in that case you would want it to expand into > > per_cpu(var, somevar_with_boot_cpu_nr_in_it) > > and being able to write that as boot_cpu would be preferable to open > > coding, especially since people would forever be writing 0, at least > > this way its in one place. > > Except that in the general case you shouldn't even assume that the > boot CPU is still online, i.e. such a macro might "point" into nowhere. That's a good argument. Ian.