From mboxrd@z Thu Jan 1 00:00:00 1970 From: He Chen Subject: Re: [PATCH 3/5] x86: add domctl cmd to set/get CDP code/data CBM Date: Sun, 6 Sep 2015 15:15:12 +0800 Message-ID: <20150906071512.GB29010@HE> References: <1441182482-7688-1-git-send-email-he.chen@linux.intel.com> <1441182482-7688-4-git-send-email-he.chen@linux.intel.com> <55E6E48B.5060305@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZYUA5-00011h-Sw for xen-devel@lists.xenproject.org; Sun, 06 Sep 2015 07:14:49 +0000 Content-Disposition: inline In-Reply-To: <55E6E48B.5060305@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: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, xen-devel@lists.xenproject.org, keir@xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Sep 02, 2015 at 12:59:07PM +0100, Andrew Cooper wrote: > On 02/09/15 09:28, He Chen wrote: > > CDP extends CAT and provides the capacity to control L3 code & data > > cache. With CDP, one COS correspond to two CMBs(code & data). cbm_type > > is added to support distinguish different CBM operation. Besides, new > > domctl cmds are introdunced to support set/get CDP CBM. Some CAT > > functions to operation CBMs are extended to support CDP. > > > > Signed-off-by: He Chen > > --- > > xen/arch/x86/domctl.c | 33 +++++++++- > > xen/arch/x86/psr.c | 142 ++++++++++++++++++++++++++++++++------------ > > xen/include/asm-x86/psr.h | 12 +++- > > xen/include/public/domctl.h | 4 ++ > > 4 files changed, 150 insertions(+), 41 deletions(-) > > > > diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c > > index 26596dd..8e92d24 100644 > > --- a/xen/arch/x86/psr.c > > +++ b/xen/arch/x86/psr.c > > +static int pick_avail_cos(struct psr_cat_cbm *map, int cos_max, int old_cos) > > +{ > > + int cos; > > + > > + /* If old cos is referred only by the domain, then use it. */ > > + if ( map[old_cos].ref == 1 ) > > + return old_cos; > > + > > + /* Then we pick an unused one, never pick 0 */ > > + for ( cos = 1; cos <= cos_max; cos++ ) > > + if ( map[cos].ref == 0 ) > > + return cos; > > + > > + return -EOVERFLOW; > > ENOENT surely, or use EOVERFLOW consistently. > I am not sure I got your point here. pick_avail_cos is to get an unused COS, if succeed, it returns a positive number which means COS, but when fail, it should return a negative number to indicate an error. As far as I know, ENOENT is 2 and EOVERFLOW is 75, if I return ENOENT directly, the function which call pick_avail_cos could not tell the value is a valid COS or an error number. Would you mind explaining in more detail for me and thanks.