[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 11/21] hvmloader: retrieve vNUMA information from hypervisor



>>> On 23.01.15 at 12:13, <wei.liu2@xxxxxxxxxx> 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.

> +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?

> +    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?

> +
> +    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".

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.