From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH for 4.6 v2 2/3] libxc: introduce xc_domain_getvnuma Date: Thu, 10 Sep 2015 12:01:59 +0100 Message-ID: <1441882919.24450.375.camel@citrix.com> References: <1441818218-5414-1-git-send-email-wei.liu2@citrix.com> <1441818218-5414-3-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZZzcC-0000E3-79 for xen-devel@lists.xenproject.org; Thu, 10 Sep 2015 11:02:04 +0000 In-Reply-To: <1441818218-5414-3-git-send-email-wei.liu2@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: Wei Liu , Xen-devel Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org On Wed, 2015-09-09 at 18:03 +0100, Wei Liu wrote: > A simple wrapper for XENMEM_get_vnumainfo. > > Signed-off-by: Wei Liu Acked-by: Ian Campbell Some comments which are not specific to this patch: > +int xc_domain_getvnuma(xc_interface *xch, > + uint32_t domid, > + uint32_t *nr_vnodes, > + uint32_t *nr_vmemranges, > + uint32_t *nr_vcpus, > + xen_vmemrange_t *vmemrange, > + unsigned int *vdistance, > + unsigned int *vcpu_to_vnode) > +{ > + int rc; > + DECLARE_HYPERCALL_BOUNCE(vmemrange, sizeof(*vmemrange) * *nr_vmemranges, > + XC_HYPERCALL_BUFFER_BOUNCE_OUT); > + DECLARE_HYPERCALL_BOUNCE(vdistance, sizeof(*vdistance) * > + *nr_vnodes * *nr_vnodes, > + XC_HYPERCALL_BUFFER_BOUNCE_OUT); > + DECLARE_HYPERCALL_BOUNCE(vcpu_to_vnode, sizeof(*vcpu_to_vnode) * *nr_vcpus, > + XC_HYPERCALL_BUFFER_BOUNCE_OUT); > + > + struct xen_vnuma_topology_info vnuma_topo; > + > + if ( xc_hypercall_bounce_pre(xch, vmemrange) || > + xc_hypercall_bounce_pre(xch, vdistance) || > + xc_hypercall_bounce_pre(xch, vcpu_to_vnode) ) > + { > + rc = -1; > + errno = ENOMEM; xc_hypercall_bounce_pre really ought to set errno, but it (to my surprise) doesn't appear to do so... > + goto vnumaget_fail; > + } > + > + set_xen_guest_handle(vnuma_topo.vmemrange.h, vmemrange); > + set_xen_guest_handle(vnuma_topo.vdistance.h, vdistance); > + set_xen_guest_handle(vnuma_topo.vcpu_to_vnode.h, vcpu_to_vnode); > + > + vnuma_topo.nr_vnodes = *nr_vnodes; > + vnuma_topo.nr_vcpus = *nr_vcpus; > + vnuma_topo.nr_vmemranges = *nr_vmemranges; > + vnuma_topo.domid = domid; > + vnuma_topo.pad = 0; > + > + rc = do_memory_op(xch, XENMEM_get_vnumainfo, &vnuma_topo, > + sizeof(vnuma_topo)); > + > + *nr_vnodes = vnuma_topo.nr_vnodes; > + *nr_vcpus = vnuma_topo.nr_vcpus; > + *nr_vmemranges = vnuma_topo.nr_vmemranges; We're a bit inconsistent, it seems, about a) tolerating such parameters being NULL and b) whether or not we update them when the hypercall failed. Anyway, neither of those are anything to block this patch over, so ack as above. > + > + vnumaget_fail: > + xc_hypercall_bounce_post(xch, vmemrange); > + xc_hypercall_bounce_post(xch, vdistance); > + xc_hypercall_bounce_post(xch, vcpu_to_vnode); > + > + return rc; > +} > + > /* > * Local variables: > * mode: C,