From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com, ian.campbell@citrix.com,
ian.jackson@eu.citrix.com, dan.magenheimer@oracle.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 6/6] xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)
Date: Wed, 27 Mar 2013 13:55:39 -0700 (PDT) [thread overview]
Message-ID: <1364417739-10121-7-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1364417739-10121-1-git-send-email-konrad.wilk@oracle.com>
This patch provides the value of the currently outstanding pages
claimed for all domains. This is a total global value that influences
the hypervisors' MM system.
When a claim call is done, a reservation for a specific amount of pages
is set and also a global value is incremented. This global value is then
reduced as the domain's memory is populated and eventually reaches zero.
The toolstack can also choose to set the domain's claim to zero which
cancels the reservation and decrements the global value by the amount
of claim that has not been satisfied.
If the reservation cannot be meet the guest creation fails immediately
instead of taking seconds or minutes (depending on the size of the guest)
while the toolstack populates memory.
See patch: "xl: Implement XENMEM_claim_pages support via 'claim_mode'
global config" for details on how it is implemented.
The value fluctuates quite often so the value is stale once it is provided
to the user-space. However it is useful for diagnostic purposes.
It is only printed when the global "claim_mode" option in xl.conf(5)
is set to enabled (1).
[v1: s/unclaimed/outstanding/]
[v2: Made libxl_get_claiminfo return just MemKB suggested by Ian]
[v3: Made libxl_get_claininfo return MemMB to conform to the other values printed]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
tools/libxl/libxl.c | 12 ++++++++++++
tools/libxl/libxl.h | 1 +
tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1f5dc3f..5a91d66 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4058,6 +4058,18 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)
return ret;
}
+uint64_t libxl_get_claiminfo(libxl_ctx *ctx)
+{
+ long l;
+
+ l = xc_domain_get_outstanding_pages(ctx->xch);
+ if (l < 0)
+ return l;
+
+ /* In MB */
+ return (l >> 8);
+}
+
const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
{
union {
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index c4ad58b..5dab24b 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -579,6 +579,7 @@ int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_k
/* wait for the memory target of a domain to be reached */
int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs);
+uint64_t libxl_get_claiminfo(libxl_ctx *ctx);
int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass);
int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type);
/* libxl_primary_console_exec finds the domid and console number
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 880905e..a5f0f56 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4650,6 +4650,29 @@ static void output_topologyinfo(void)
return;
}
+static void output_claim(void)
+{
+ long l;
+
+ /*
+ * Note that the xl.c (which calls us) has already read from the
+ * global configuration the 'claim_mode' value.
+ */
+ if (!global_claim_mode)
+ return;
+
+ l = libxl_get_claiminfo(ctx);
+ if (l < 0) {
+ fprintf(stderr, "libxl_get_claiminfo failed. errno: %d (%s)\n",
+ errno, strerror(errno));
+ return;
+ }
+
+ printf("outstanding_claims : %ld\n", l);
+
+ return;
+}
+
static void print_info(int numa)
{
output_nodeinfo();
@@ -4660,6 +4683,7 @@ static void print_info(int numa)
output_topologyinfo();
output_numainfo();
}
+ output_claim();
output_xeninfo();
--
1.8.0.2
next prev parent reply other threads:[~2013-03-27 20:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-27 20:55 [PATCH v13] claim and its friends for allocating multiple self-ballooning guests Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation Konrad Rzeszutek Wilk
2013-03-28 16:23 ` Ian Jackson
2013-03-29 13:12 ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 2/6] xl: Implement XENMEM_claim_pages support via 'claim_mode' global config Konrad Rzeszutek Wilk
2013-03-28 16:39 ` Ian Jackson
2013-03-29 19:30 ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 3/6] xend: Implement XENMEM_claim_pages support via 'claim-mode' " Konrad Rzeszutek Wilk
2013-03-28 16:41 ` Ian Jackson
2013-03-29 13:27 ` Konrad Rzeszutek Wilk
2013-03-29 20:17 ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 4/6] xc: export outstanding_pages value in xc_dominfo structure Konrad Rzeszutek Wilk
2013-03-28 16:43 ` Ian Jackson
2013-03-27 20:55 ` [PATCH 5/6] xl: export 'outstanding_pages' value from xcinfo Konrad Rzeszutek Wilk
2013-03-28 16:44 ` Ian Jackson
2013-03-29 20:07 ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` Konrad Rzeszutek Wilk [this message]
2013-03-28 16:47 ` [PATCH 6/6] xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf) Ian Jackson
2013-03-29 13:31 ` Konrad Rzeszutek Wilk
2013-03-28 16:17 ` [PATCH v13] claim and its friends for allocating multiple self-ballooning guests Ian Jackson
2013-03-28 16:50 ` Ian Jackson
2013-04-02 11:10 ` George Dunlap
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=1364417739-10121-7-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=dan.magenheimer@oracle.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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).