From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 3/5] x86: add domctl cmd to set/get CDP code/data CBM Date: Sun, 6 Sep 2015 17:29:07 +0100 Message-ID: <55EC69D3.4000808@citrix.com> 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> <20150906071512.GB29010@HE> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZYcog-0000rU-Na for xen-devel@lists.xenproject.org; Sun, 06 Sep 2015 16:29:18 +0000 In-Reply-To: <20150906071512.GB29010@HE> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org On 06/09/15 08:15, He Chen wrote: > 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. You are mixing at matching use of ENOENT and EOVERFLOW for the same kind of failure from different subroutines. Please be consistent (and negative). ~Andrew