xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Elena Ufimtseva <ufimtseva@gmail.com>
Cc: keir@xen.org, stefano.stabellini@eu.citrix.com, msw@linux.com,
	dario.faggioli@citrix.com, lccycc123@gmail.com,
	xen-devel@lists.xen.org, JBeulich@suse.com
Subject: Re: [PATCH v2 1/7] xen: vNUMA support for guests.
Date: Thu, 14 Nov 2013 21:59:28 +0000	[thread overview]
Message-ID: <528547C0.3020007@eu.citrix.com> (raw)
In-Reply-To: <1384399569-23969-1-git-send-email-ufimtseva@gmail.com>

On 11/14/2013 03:26 AM, Elena Ufimtseva wrote:
> Defines interface, structures and hypercalls for guests that wish
> to retreive vNUMA topology from Xen.
> Two subop hypercalls introduced by patch:
> XEN_DOMCTL_setvnumainfo to define vNUMA domain topology per domain
> and XENMEM_get_vnuma_info to retreive that topology by guest.
>
> Signed-off-by: Elena Ufimtseva <ufimtseva@gmail.com>

Thanks, Elena -- this looks like it's much closer to being ready to be 
checked in.  A few comments:

> @@ -871,6 +872,87 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>       }
>       break;
>
> +    case XEN_DOMCTL_setvnumainfo:
> +    {
> +        unsigned int i = 0, dist_size;
> +        uint nr_vnodes;
> +        ret = -EFAULT;
> +
> +        /* Already set? */
> +        if ( d->vnuma.nr_vnodes > 0 )
> +            return 0;
> +
> +        nr_vnodes = op->u.vnuma.nr_vnodes;
> +
> +        if ( nr_vnodes == 0 )
> +            return ret;
> +        if ( nr_vnodes * nr_vnodes > UINT_MAX )
> +            return ret;
> +
> +        /*
> +         * If null, vnode_numamap will set default to
> +         * point to allocation mechanism to dont use
> +         * per physical node allocation or this is for
> +         * cases when there is no physical NUMA.
> +         */
> +        if ( guest_handle_is_null(op->u.vnuma.vdistance) ||
> +             guest_handle_is_null(op->u.vnuma.vmemrange) ||
> +             guest_handle_is_null(op->u.vnuma.vcpu_to_vnode) )
> +            goto err_dom;
> +
> +        dist_size = nr_vnodes * nr_vnodes;
> +
> +        d->vnuma.vdistance = xmalloc_array(unsigned int, dist_size);
> +        d->vnuma.vmemrange = xmalloc_array(vmemrange_t, nr_vnodes);
> +        d->vnuma.vcpu_to_vnode = xmalloc_array(unsigned int, d->max_vcpus);
> +        d->vnuma.vnode_numamap = xmalloc_array(unsigned int, nr_vnodes);

Is there a risk here that you'll leak memory if a buggy toolstack calls 
setvnuma_info multiple times?

> diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
> index d4e479f..da458d3 100644
> --- a/xen/include/public/domctl.h
> +++ b/xen/include/public/domctl.h
> @@ -35,6 +35,7 @@
>   #include "xen.h"
>   #include "grant_table.h"
>   #include "hvm/save.h"
> +#include "vnuma.h"
>
>   #define XEN_DOMCTL_INTERFACE_VERSION 0x00000009
>
> @@ -863,6 +864,27 @@ struct xen_domctl_set_max_evtchn {
>   typedef struct xen_domctl_set_max_evtchn xen_domctl_set_max_evtchn_t;
>   DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_max_evtchn_t);
>
> +/*
> + * XEN_DOMCTL_setvnumainfo: sets the vNUMA topology
> + * parameters a guest may request.
> + */
> +struct xen_domctl_vnuma {
> +    uint32_t nr_vnodes;
> +    uint32_t __pad;
> +    XEN_GUEST_HANDLE_64(uint) vdistance;
> +    XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
> +    /* domain memory mapping map to physical NUMA nodes */
> +    XEN_GUEST_HANDLE_64(uint) vnode_numamap;

What is this for?  We don't pass this to the guest or seem to use it in 
any way.

  -George

  parent reply	other threads:[~2013-11-14 21:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14  3:26 [PATCH v2 1/7] xen: vNUMA support for guests Elena Ufimtseva
2013-11-14 11:18 ` Dario Faggioli
2013-11-14 21:43   ` George Dunlap
2013-11-15  8:28   ` Jan Beulich
2013-11-14 11:48 ` David Vrabel
2013-11-14 12:11   ` Dario Faggioli
2013-11-14 14:09     ` Elena Ufimtseva
2013-11-14 21:59 ` George Dunlap [this message]
2013-11-14 22:51   ` Elena Ufimtseva
2013-11-14 23:51     ` George Dunlap
2013-11-15  8:50 ` Jan Beulich
2013-11-15 14:14   ` Elena Ufimtseva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528547C0.3020007@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dario.faggioli@citrix.com \
    --cc=keir@xen.org \
    --cc=lccycc123@gmail.com \
    --cc=msw@linux.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=ufimtseva@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).