From: Ian Campbell Subject: Re: [PATCH v10 6/6] tools: enable Cache QoS Monitoring feature for libxl/libxc Date: Thu, 27 Mar 2014 15:13:54 +0000 Message-ID: <1395933234.22909.145.camel@kazak.uk.xensource.com> References: <1395815722-143165-1-git-send-email-dongxiao.xu@intel.com> <1395815722-143165-7-git-send-email-dongxiao.xu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395815722-143165-7-git-send-email-dongxiao.xu@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: Dongxiao Xu Cc: keir@xen.org, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, JBeulich@suse.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org On Wed, 2014-03-26 at 14:35 +0800, Dongxiao Xu wrote: [...] > +int libxl_pqos_attach(libxl_ctx *ctx, uint32_t domid, libxl_pqos_type qos_type); > +int libxl_pqos_detach(libxl_ctx *ctx, uint32_t domid, libxl_pqos_type qos_type); > +libxl_cqminfo * libxl_getcqminfo(libxl_ctx *ctx, unsigned int *l3c_total, > + unsigned int *nr_domains, unsigned int *nr_rmids, unsigned int *nr_sockets); [...] > +libxl_cqminfo = Struct("cqminfo", [ > + ("valid", uint32), > + ("l3c", uint64), > + ]) libxl_getcqminfo seems to have a strange mixture of returning an info struct and returning things via pointers passed as integers. why is that? > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 8389468..664a34d 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -7381,6 +7381,115 @@ out: > return ret; > } > > +int main_pqosattach(int argc, char **argv) > +{ > + uint32_t domid; > + int opt, rc; > + libxl_pqos_type qos_type; > + > + SWITCH_FOREACH_OPT(opt, "", NULL, "pqos-attach", 2) { > + /* No options */ > + } > + > + /* libxl_pqos_attach will handle the parameter check. */ > + libxl_pqos_type_from_string(argv[optind], &qos_type); This can fail, I think you need to check the return value. > + domid = find_domain(argv[optind + 1]); > + > + rc = libxl_pqos_attach(ctx, domid, qos_type); > + > + return rc; > +} > + > +int main_pqosdetach(int argc, char **argv) > +{ > + uint32_t domid; > + int opt, rc; > + libxl_pqos_type qos_type; > + > + SWITCH_FOREACH_OPT(opt, "", NULL, "pqos-detach", 2) { > + /* No options */ > + } > + > + /* libxl_pqos_detach will handle the parameter check. */ > + libxl_pqos_type_from_string(argv[optind], &qos_type); Same again. Ian.