From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel <xen-devel@lists.xen.org>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Juergen Gross <juergen.gross@ts.fujitsu.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>,
Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: [PATCH 3/4] libxl: report how much memory a domain has on each NUMA node
Date: Wed, 5 Mar 2014 15:36:44 +0100 [thread overview]
Message-ID: <20140305143644.6984.6243.stgit@Solace> (raw)
In-Reply-To: <20140305143357.6984.7729.stgit@Solace>
by calling xc_domain_numainfo(). A new data type, libxl_domain_numainfo
is being introduced. For now it only holds how much memory a domain has
allocated on each NUMA node, but it can be useful for, in future,
reporting more per-domain NUMA related information.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
tools/libxl/libxl.c | 30 ++++++++++++++++++++++++++++++
tools/libxl/libxl.h | 2 ++
tools/libxl/libxl_types.idl | 4 ++++
3 files changed, 36 insertions(+)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 730f6e1..e5a1cb0 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4631,6 +4631,36 @@ int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
return 0;
}
+libxl_domain_numainfo *libxl_domain_get_numainfo(libxl_ctx *ctx,
+ uint32_t domid)
+{
+ GC_INIT(ctx);
+ int max_nodes;
+ libxl_domain_numainfo *ret = NULL;
+
+ max_nodes = libxl_get_max_nodes(ctx);
+ if (max_nodes < 0)
+ {
+ LOG(ERROR, "Unable to determine the number of NUMA nodes");
+ goto out;
+ }
+
+ ret = libxl__zalloc(NOGC, sizeof(libxl_domain_numainfo));
+ ret->memkbs = libxl__calloc(NOGC, max_nodes, sizeof(uint64_t));
+
+ if (xc_domain_numainfo(ctx->xch, domid, &max_nodes, ret->memkbs)) {
+ LOGE(ERROR, "getting domain NUMA info");
+ libxl_domain_numainfo_dispose(ret);
+ ret = NULL;
+ goto out;
+ }
+ ret->num_memkbs = max_nodes;
+
+ out:
+ GC_FREE;
+ return ret;
+}
+
static int libxl__set_vcpuonline_xenstore(libxl__gc *gc, uint32_t domid,
libxl_bitmap *cpumap)
{
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 06bbca6..f452752 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1067,6 +1067,8 @@ int libxl_domain_set_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
libxl_bitmap *nodemap);
int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
libxl_bitmap *nodemap);
+libxl_domain_numainfo *libxl_domain_get_numainfo(libxl_ctx *ctx,
+ uint32_t domid);
int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap);
libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 649ce50..76158d7 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -515,6 +515,10 @@ libxl_vcpuinfo = Struct("vcpuinfo", [
("cpumap", libxl_bitmap), # current cpu's affinities
], dir=DIR_OUT)
+libxl_domain_numainfo = Struct("domain_numainfo", [
+ ("memkbs", Array(uint64, "num_memkbs")),
+ ], dir=DIR_OUT)
+
libxl_physinfo = Struct("physinfo", [
("threads_per_core", uint32),
("cores_per_socket", uint32),
next prev parent reply other threads:[~2014-03-05 14:36 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
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 ` Dario Faggioli [this message]
2014-03-10 16:40 ` [PATCH 3/4] libxl: " 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=20140305143644.6984.6243.stgit@Solace \
--to=dario.faggioli@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@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 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).