From: Tim Deegan Subject: Re: [PATCH] arm: use a per-VCPU stack Date: Sat, 18 Feb 2012 13:52:44 +0000 Message-ID: <20120218135244.GA1531@ocelot.phlegethon.org> References: <1329324592-12589-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1329324592-12589-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org At 16:49 +0000 on 15 Feb (1329324592), Ian Campbell wrote: > +struct pcpu_info { > + unsigned int processor_id; > + struct vcpu *current_vcpu; > +}; > + > +DECLARE_PER_CPU(struct pcpu_info, pcpu_info); > +static inline struct pcpu_info *get_pcpu_info(void) > +{ > + return &this_cpu(pcpu_info); > +} > + I don't think it's worth declaring a struct and accessors for this; we should just have current_vcpu as an ordinary per-cpu variable. Storing the CPU ID in the per-pcpu area only happens to work because per-cpu areas are a noop right now. I have a patch that re-enables them properly but for that we'll need a proper way of getting the CPU id. In the meantime I think it would be less confusing just to hard-code it as zero than to do this. :) We could use the physical CPU ID register; I don't know whether it would be faster to stash the ID on the (per-vcpu) stack and update it during context switch. Aside from that, this patch looks OK to me. Cheers, Tim.