From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v4 02/12] x86: improve psr scheduling code Date: Fri, 10 Apr 2015 10:28:59 +0100 Message-ID: <552797DB.5030307@citrix.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> <20150410072441.GA3417@pengc-linux.bj.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150410072441.GA3417@pengc-linux.bj.intel.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: Chao Peng 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 10/04/15 08:24, Chao Peng wrote: > 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? Yes - that is probably best. While cat_cpu_init() doesn't actually interact with any MSRs, we still never want to be in a position to execute it against the "wrong" cpu. ~Andrew