From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Peng Subject: Re: [PATCH v4 02/12] x86: improve psr scheduling code Date: Fri, 10 Apr 2015 15:24:41 +0800 Message-ID: <20150410072441.GA3417@pengc-linux.bj.intel.com> References: <1428571105-3604-1-git-send-email-chao.p.peng@linux.intel.com> <1428571105-3604-3-git-send-email-chao.p.peng@linux.intel.com> <5526E8C1.3060302@citrix.com> Reply-To: Chao Peng Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <5526E8C1.3060302@citrix.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: Andrew Cooper Cc: keir@xen.org, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, will.auld@intel.com, JBeulich@suse.com, wei.liu2@citrix.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org On Thu, Apr 09, 2015 at 10:01:53PM +0100, Andrew Cooper wrote: > On 09/04/2015 10:18, Chao Peng wrote: > > +static inline void psr_assoc_init(unsigned int cpu) > > +{ > > + struct psr_assoc *psra = &per_cpu(psr_assoc, cpu); > > + > > + if ( psr_cmt_enabled() ) > > + rdmsrl(MSR_IA32_PSR_ASSOC, psra->val); > > +} > > On further consideration, this would probably be better as a void > function which used this_cpu() rather than per_cpu(). > > Absolutely nothing good can come of calling it with cpu != > smp_processor_id(), so we should avoid that situation arising in the > first place. Agreed. > > +static void psr_cpu_init(unsigned int cpu) > > +{ > > + psr_assoc_init(cpu); > > +} > > This can also turn into a void helper. This is, however, a little different. The next patch will add cat_cpu_init() which will make use of this 'cpu' parameter. So do you mean calling smp_processor_id() in cat_cpu_init() as well? Thanks, Chao