From: "Jan Beulich" Subject: Re: [PATCH v3 12/19] hvmloader: retrieve vNUMA information from hypervisor Date: Tue, 13 Jan 2015 16:50:11 +0000 Message-ID: <54B55AD3020000780005487E@mail.emea.novell.com> References: <1421151107-20842-1-git-send-email-wei.liu2@citrix.com> <1421151107-20842-13-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1421151107-20842-13-git-send-email-wei.liu2@citrix.com> Content-Disposition: inline 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 Cc: dario.faggioli@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 13.01.15 at 13:11, wrote: > +void init_vnuma_info(void) > +{ > + int rc, retry = 0; > + struct xen_vnuma_topology_info vnuma_topo; > + > + vcpu_to_vnode = scratch_alloc(sizeof(uint32_t) * hvm_info->nr_vcpus, 0); sizeof(*vcpu_to_vnode) please. > + rc = -EAGAIN; > + while ( rc == -EAGAIN && retry < 10 ) What's the justification for 10 here? A sane tool stack shouldn't alter the values while starting the domain. > + { > + 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); > + > + rc = hypercall_memory_op(XENMEM_get_vnumainfo, &vnuma_topo); > + > + if ( rc == -EOPNOTSUPP ) > + return; > + > + if ( rc != -ENOBUFS ) > + break; > + > + ASSERT(vnuma_topo.nr_vcpus == hvm_info->nr_vcpus); I also wonder whether we shouldn't make the hypervisor return back the (modified) values in the -EAGAIN error case, so that you could move above first half of the loop body out of the loop. Jan