All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Juergen Gross <juergen.gross@ts.fujitsu.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>,
	Jan Beulich <JBeulich@suse.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH 2/4] libxc: report how much memory a domain has on each NUMA node
Date: Wed, 5 Mar 2014 15:05:15 +0000	[thread overview]
Message-ID: <53173D2B.1030405@citrix.com> (raw)
In-Reply-To: <20140305143635.6984.34422.stgit@Solace>

On 05/03/14 14:36, Dario Faggioli wrote:
> by means of a new interface: xc_domain_numainfo().
>
> The caller is expected to allocate an array for the call to fill,
> with the results of the XEN_DOMCTL_numainfo hypercall. The size of
> the array is also passed to the function, which then returns back
> the number of elements that have actually been filled by Xen.
>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> ---
>  tools/libxc/xc_domain.c |   28 ++++++++++++++++++++++++++++
>  tools/libxc/xenctrl.h   |   18 ++++++++++++++++++
>  2 files changed, 46 insertions(+)
>
> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
> index 369c3f3..a2b3c07 100644
> --- a/tools/libxc/xc_domain.c
> +++ b/tools/libxc/xc_domain.c
> @@ -362,6 +362,34 @@ int xc_domain_getinfo(xc_interface *xch,
>      return nr_doms;
>  }
>  
> +int xc_domain_numainfo(xc_interface *xch, uint32_t domid,
> +                       int *max_nodes, uint64_t *memkbs)

max_nodes is an unsigned quantity.  libxc is quite fast and loose with
this, but lets not propage wrongness.

> +{
> +    DECLARE_DOMCTL;
> +    DECLARE_HYPERCALL_BOUNCE(memkbs, sizeof(uint64_t) * (*max_nodes),
> +                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);
> +    int ret = 0;

Don't need the initialiser.

> +
> +    if ( xc_hypercall_bounce_pre(xch, memkbs) )
> +    {
> +        PERROR("Could not allocate bounce buffer for DOMCTL_domain_numainfo");
> +        return -1;
> +    }
> +
> +    domctl.cmd = XEN_DOMCTL_numainfo;
> +    domctl.domain = (domid_t)domid;
> +    domctl.u.numainfo.max_node_index = *max_nodes - 1;
> +    set_xen_guest_handle(domctl.u.numainfo.memkb_on_node, memkbs);
> +
> +    ret = do_domctl(xch, &domctl);
> +
> +    *max_nodes = domctl.u.numainfo.max_node_index + 1;

If the domctl fails, this should not be written back to *max_nodes.

~Andrew

> +
> +    xc_hypercall_bounce_post(xch, memkbs);
> +
> +    return ret;
> +}
> +
>  int xc_domain_getinfolist(xc_interface *xch,
>                            uint32_t first_domain,
>                            unsigned int max_domains,
> diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
> index 13f816b..845d183 100644
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -657,6 +657,24 @@ int xc_domain_getinfolist(xc_interface *xch,
>                            xc_domaininfo_t *info);
>  
>  /**
> + * This function tells how much memory a domain has allocated on each
> + * online NUMA node of the host. The information is stored in an array
> + * that the caller provides, along with its size. The function updates
> + * the latter parameter with the number of elements in the array that
> + * have been actually filled.
> + *
> + * @param xch a handle to an open hypervisor interface
> + * @param domid the domain id for which we want the information
> + * @param max_nodes as an input, the size of the memkbs array; as an
> + *                  output, the number of filled elements in it
> + * @param memkbs an array with, in the i-eth element, the memory, in
> + *               Kb, allocated for the domain on the i-eth NUMA node
> + * @return 0 on success, -1 on failure
> + */
> +int xc_domain_numainfo(xc_interface *xch, uint32_t domid,
> +                       int *max_nodes, uint64_t *memkbs);
> +
> +/**
>   * This function set p2m for broken page
>   * &parm xch a handle to an open hypervisor interface
>   * @parm domid the domain id which broken page belong to
>

  reply	other threads:[~2014-03-05 15:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 14:36 [PATCH 0/4] report how much memory a domain has on each NUMA node Dario Faggioli
2014-03-05 14:36 ` [PATCH 1/4] xen: " Dario Faggioli
2014-03-05 14:50   ` Juergen Gross
2014-03-05 16:31     ` Dario Faggioli
2014-03-05 16:49       ` Jan Beulich
2014-03-05 17:14         ` Dario Faggioli
2014-03-05 15:04   ` Jan Beulich
2014-03-05 16:13     ` Dario Faggioli
2014-03-05 16:44       ` Jan Beulich
2014-03-05 14:36 ` [PATCH 2/4] libxc: " Dario Faggioli
2014-03-05 15:05   ` Andrew Cooper [this message]
2014-03-05 15:40     ` Dario Faggioli
2014-03-10 16:39   ` Ian Jackson
2014-03-10 17:07     ` Dario Faggioli
2014-03-10 17:09       ` Andrew Cooper
2014-03-10 17:20       ` Ian Jackson
2014-03-10 17:35         ` Dario Faggioli
2014-03-11 11:15           ` Ian Jackson
2014-03-11 17:37             ` Dario Faggioli
2014-03-11 18:16               ` Ian Jackson
2014-03-11 19:04                 ` Dario Faggioli
2014-03-13 11:54                   ` George Dunlap
2014-03-05 14:36 ` [PATCH 3/4] libxl: " Dario Faggioli
2014-03-10 16:40   ` Ian Jackson
2014-03-10 17:28     ` Dario Faggioli
2014-03-13 17:26       ` Ian Jackson
2014-03-05 14:36 ` [PATCH 4/4] xl: " Dario Faggioli
2014-03-10 16:42   ` Ian Jackson
2014-03-10 17:09     ` Dario Faggioli
2014-03-05 14:40 ` [PATCH 0/4] " Juergen Gross
2014-03-05 14:44   ` Dario Faggioli
2014-03-10 16:37 ` Ian Jackson
2014-03-10 17:12   ` Dario Faggioli

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=53173D2B.1030405@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dario.faggioli@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=juergen.gross@ts.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.