From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Peng Subject: Re: [PATCH v7 07/14] x86: dynamically get/set CBM for a domain Date: Fri, 15 May 2015 09:35:59 +0800 Message-ID: <20150515013559.GC3367@pengc-linux.bj.intel.com> References: <1431075415-21917-1-git-send-email-chao.p.peng@linux.intel.com> <1431075415-21917-8-git-send-email-chao.p.peng@linux.intel.com> <1431595157.2978.153.camel@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: <1431595157.2978.153.camel@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: Dario Faggioli Cc: keir@xen.org, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@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, May 14, 2015 at 11:19:17AM +0200, Dario Faggioli wrote: > On Fri, 2015-05-08 at 16:56 +0800, Chao Peng wrote: > > For CAT, COS is maintained in hypervisor only while CBM is exposed to > > user space directly to allow getting/setting domain's cache capacity. > > For each specified CBM, hypervisor will either use a existed COS which > > has the same CBM or allocate a new one if the same CBM is not found. If > > the allocation fails because of no enough COS available then error is > > returned. The getting/setting are always operated on a specified socket. > > For multiple sockets system, the interface may be called several times. > > > > Signed-off-by: Chao Peng > > > Reviewed-by: Dario Faggioli > > Just, one minor thing, only if you end up resending... > > > diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c > > index 1feb2f6..385807b 100644 > > --- a/xen/arch/x86/psr.c > > +++ b/xen/arch/x86/psr.c > > @@ -49,6 +49,14 @@ static unsigned int opt_cos_max = 255; > > static uint64_t rmid_mask; > > static DEFINE_PER_CPU(struct psr_assoc, psr_assoc); > > > > +static unsigned int get_socket_cpu(unsigned int socket) > > +{ > > + if ( socket < nr_sockets ) > > + return cpumask_any(socket_to_cpumask[socket]); > > + > ... What about > > if ( likely(socket < nr_sockets) ) Agreed, it can be an optimization chance. Let's see what others think. Thanks for review. Chao