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 4/4] xl: report how much memory a domain has on each NUMA node
Date: Wed, 5 Mar 2014 15:36:54 +0100 [thread overview]
Message-ID: <20140305143653.6984.67803.stgit@Solace> (raw)
In-Reply-To: <20140305143357.6984.7729.stgit@Solace>
by introducing a new subcommant: `xl numainfo <domain>'.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
tools/libxl/xl.h | 1 +
tools/libxl/xl_cmdimpl.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c | 5 ++++
3 files changed, 64 insertions(+)
diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h
index f188708..f519242 100644
--- a/tools/libxl/xl.h
+++ b/tools/libxl/xl.h
@@ -33,6 +33,7 @@ struct cmd_spec {
int main_vcpulist(int argc, char **argv);
int main_info(int argc, char **argv);
int main_sharing(int argc, char **argv);
+int main_numainfo(int argc, char **argv);
int main_cd_eject(int argc, char **argv);
int main_cd_insert(int argc, char **argv);
int main_console(int argc, char **argv);
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 4fc46eb..07a3504 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4721,6 +4721,64 @@ int main_vcpupin(int argc, char **argv)
return vcpupin(find_domain(argv[optind]), argv[optind+1] , argv[optind+2]);
}
+static void print_domain_numainfo(uint32_t domid)
+{
+ libxl_domain_numainfo *info;
+ libxl_bitmap nodemap;
+ libxl_physinfo physinfo;
+ int i;
+
+ libxl_bitmap_init(&nodemap);
+ libxl_physinfo_init(&physinfo);
+
+ if (libxl_node_bitmap_alloc(ctx, &nodemap, 0)) {
+ fprintf(stderr, "libxl_node_bitmap_alloc_failed.\n");
+ goto out;
+ }
+ if (libxl_get_physinfo(ctx, &physinfo) != 0) {
+ fprintf(stderr, "libxl_physinfo failed.\n");
+ goto out;
+ }
+
+ if (libxl_domain_get_nodeaffinity(ctx, domid, &nodemap)) {
+ fprintf(stderr, "libxl_domain_get_nodeaffinity failed.\n");
+ goto out;
+ }
+ printf("NODE Affinity: ");
+ print_bitmap(nodemap.map, physinfo.nr_nodes, stdout);
+ printf("\n");
+
+ info = libxl_domain_get_numainfo(ctx, domid);
+ if (!info) {
+ fprintf(stderr, "libxl_domain_get_numainfo failed.\n");
+ goto out;
+ }
+ printf("Memory:\n");
+ for (i = 0; i < info->num_memkbs; i++) {
+ if (info->memkbs[i])
+ printf(" Node %d: %"PRIu64" Kb\n", i, info->memkbs[i]);
+ }
+
+ out:
+ libxl_bitmap_dispose(&nodemap);
+ libxl_physinfo_dispose(&physinfo);
+}
+
+int main_numainfo(int argc, char **argv)
+{
+ uint32_t domid;
+ int opt = 0;
+
+ SWITCH_FOREACH_OPT(opt, "", NULL, "numainfo", 1) {
+ /* No options */
+ }
+
+ domid = find_domain(argv[optind]);
+ print_domain_numainfo(domid);
+
+ return 0;
+}
+
static void vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
{
char *endptr;
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index e8ab93a..4b040dd 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -201,6 +201,11 @@ struct cmd_spec cmd_table[] = {
"Set the current memory usage for a domain",
"<Domain> <MemMB['b'[bytes]|'k'[KB]|'m'[MB]|'g'[GB]|'t'[TB]]>",
},
+ { "numainfo",
+ &main_numainfo, 0, 0,
+ "Print NUMA related information for a domain",
+ "<Domain>",
+ },
{ "button-press",
&main_button_press, 0, 1,
"Indicate an ACPI button press to the domain",
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 ` [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 ` Dario Faggioli [this message]
2014-03-10 16:42 ` [PATCH 4/4] xl: " 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=20140305143653.6984.67803.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).