From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Peng Subject: Re: [PATCH v2 3/4] tools: add tools support for Intel CDP Date: Wed, 9 Sep 2015 17:17:57 +0800 Message-ID: <20150909091757.GR19417@pengc-linux.bj.intel.com> References: <1441775808-29766-1-git-send-email-he.chen@linux.intel.com> <1441775808-29766-4-git-send-email-he.chen@linux.intel.com> <20150909073211.GP19417@pengc-linux.bj.intel.com> <20150909081009.GB933@HE> <55F00BF002000078000A1244@prv-mh.provo.novell.com> Reply-To: Chao Peng Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 1ZZbZJ-0004zN-46 for xen-devel@lists.xenproject.org; Wed, 09 Sep 2015 09:21:29 +0000 Content-Disposition: inline In-Reply-To: <55F00BF002000078000A1244@prv-mh.provo.novell.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: Jan Beulich Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, He Chen , ian.jackson@eu.citrix.com, xen-devel@lists.xenproject.org, keir@xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Sep 09, 2015 at 02:37:36AM -0600, Jan Beulich wrote: > >>> On 09.09.15 at 10:10, wrote: > > On Wed, Sep 09, 2015 at 03:32:11PM +0800, Chao Peng wrote: > >> On Wed, Sep 09, 2015 at 01:16:47PM +0800, He Chen wrote: > >> > @@ -304,14 +305,41 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid, > >> > goto out; > >> > } > >> > > >> > + rc = libxl_psr_cat_get_l3_info(ctx, &info, &nr_sockets); > >> > + if (rc) { > >> > + LOGE(ERROR, "Failed to get cat info"); > >> > + goto out; > >> > + } > >> > + > >> > + if (!info->cdp_enabled && > >> > + (type == LIBXL_PSR_CBM_TYPE_L3_CODE || > >> > + type == LIBXL_PSR_CBM_TYPE_L3_DATA)) > >> > + { > >> > + LOGE(ERROR, "Unable to set Code/Data CBM with CDP disabled"); > >> > + rc = EINVAL; > >> > + free(info); > >> > + goto out; > >> > + } > >> > + > >> > libxl_for_each_set_bit(socketid, *target_map) { > >> > if (socketid >= nr_sockets) > >> > break; > >> > - if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) { > >> > + if (info->cdp_enabled && type == LIBXL_PSR_CBM_TYPE_L3_CBM) > >> > + { > >> > + if(xc_psr_cat_set_domain_data(ctx->xch, domid, > >> > + LIBXL_PSR_CBM_TYPE_L3_CODE, socketid, cbm) || > >> > + xc_psr_cat_set_domain_data(ctx->xch, domid, > >> > + LIBXL_PSR_CBM_TYPE_L3_DATA, socketid, cbm)) > >> > + { > >> > + libxl__psr_cat_log_err_msg(gc, errno); > >> > + rc = ERROR_FAIL; > >> > + } > >> > >> Will you merge the two if's? > > > > Surely. > > Surely not you mean, or else how will this ... > > >> > + } else if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) { > > ... work? Indeed. Then just ignore it. > > Looking at this I'm surprised though that consumers is required to do > two calls (and know whether CDP is enabled) when they want to set > things up without caring for the code/data distinction. I think this > should be taken care of in the hypervisor. Agreed, hypervisor should take care of it for this case. Chao