From: Wei Liu Subject: Re: [PATCH v4 11/21] hvmloader: retrieve vNUMA information from hypervisor Date: Fri, 23 Jan 2015 14:17:16 +0000 Message-ID: <20150123141715.GB1801@zion.uk.xensource.com> References: <1422011632-22018-1-git-send-email-wei.liu2@citrix.com> <1422011632-22018-12-git-send-email-wei.liu2@citrix.com> <54C25A4F0200007800058D1A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <54C25A4F0200007800058D1A@mail.emea.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 Liu , ian.campbell@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org On Fri, Jan 23, 2015 at 01:27:27PM +0000, Jan Beulich wrote: > >>> On 23.01.15 at 12:13, wrote: > > Changes in v4: > > 1. Use *vnode_to_pnode to calculate size. > > 2. Remove loop. > > 3. TBD: rebase onto Jan's errno ABI change. > > Which went in already. > I will wait until it shows up in master and rebase. > > +void init_vnuma_info(void) > > +{ > > + int rc; > > + struct xen_vnuma_topology_info vnuma_topo; > > + > > + vcpu_to_vnode = > > + scratch_alloc(sizeof(*vcpu_to_vnode) * hvm_info->nr_vcpus, 0); > > Why is this not done together with the other two allocs below, > avoiding it when the probing hypercall fails? > OK. I will group them together. > > + vnuma_topo.domid = DOMID_SELF; > > + vnuma_topo.pad = 0; > > + vnuma_topo.nr_vcpus = 0; > > + vnuma_topo.nr_vnodes = 0; > > + vnuma_topo.nr_vmemranges = 0; > > + > > + set_xen_guest_handle(vnuma_topo.vdistance.h, NULL); > > + set_xen_guest_handle(vnuma_topo.vcpu_to_vnode.h, NULL); > > + set_xen_guest_handle(vnuma_topo.vmemrange.h, NULL); > > Perhaps easier to just memset() the whole thing to zero, and the > set .domid? > Done. > > + > > + rc = hypercall_memory_op(XENMEM_get_vnumainfo, &vnuma_topo); > > + > > + if ( rc != -XEN_ENOBUFS ) > > + return; > > + > > + ASSERT(vnuma_topo.nr_vcpus == hvm_info->nr_vcpus); > > + > > + vdistance = scratch_alloc(sizeof(uint32_t) * vnuma_topo.nr_vnodes * > > + vnuma_topo.nr_vnodes, 0); > > + vmemrange = scratch_alloc(sizeof(xen_vmemrange_t) * > > + vnuma_topo.nr_vmemranges, 0); > > + > > + set_xen_guest_handle(vnuma_topo.vdistance.h, vdistance); > > + set_xen_guest_handle(vnuma_topo.vcpu_to_vnode.h, vcpu_to_vnode); > > + set_xen_guest_handle(vnuma_topo.vmemrange.h, vmemrange); > > + > > + rc = hypercall_memory_op(XENMEM_get_vnumainfo, &vnuma_topo); > > + > > + if ( rc < 0 ) > > + { > > + printf("Failed to retrieve vNUMA information, rc = %d\n", rc); > > + return; > > + } > > + > > + nr_vnodes = vnuma_topo.nr_vnodes; > > + nr_vmemranges = vnuma_topo.nr_vmemranges; > > + > > + return; > > +} > > Please drop this pointless "return". > Done. Wei. > Jan