From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com, ian.campbell@citrix.com,
ian.jackson@eu.citrix.com
Cc: George.Dunlap@eu.citrix.com, dan.magenheimer@oracle.com,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 6/6] xl: 'xl claims' print outstanding per domain claims if enabled (claim_mode=1 in xl.conf)
Date: Wed, 10 Apr 2013 15:59:58 -0400 [thread overview]
Message-ID: <1365623998-13710-7-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1365623998-13710-1-git-send-email-konrad.wilk@oracle.com>
This is similar to "xl: 'xl info' print outstanding claims if enabled
(claim_mode=1 in xl.conf)" which exposes the global claim value.
This patch provides the value of the currently outstanding pages
claimed for each domains. This is per domain value which is added
to the global claim value which influences the hypervisors' MM system.
When a claim call is done, a reservation for a specific amount of pages
is set (and this patch lists said number) 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 (libxc) also sets the domain's claim to zero when the population
of memory has completed as an extra step. Any call to destroy the domain
will also set the domain's claim to zero.
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). The 'man xl' shows the details of this item.
The output is close to what 'xl list' looks like:
Name ID Mem VCPUs State Time(s) Claim
Domain-0 0 2048 4 r----- 15.7 0
OL5 2 321 1 --p--- 0.0 1717
OL6 3 217 1 --p--- 0.0 797
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
docs/man/xl.pod.1 | 17 +++++++++++++++++
tools/libxl/xl.h | 1 +
tools/libxl/xl_cmdimpl.c | 35 +++++++++++++++++++++++++++++++++--
tools/libxl/xl_cmdtable.c | 6 ++++++
4 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
index d8783e8..18415b1 100644
--- a/docs/man/xl.pod.1
+++ b/docs/man/xl.pod.1
@@ -780,6 +780,23 @@ explanatory.
Prints the current uptime of the domains running.
+=item B<claim-list>
+
+Prints information about outstanding claims by the guests. This provides the
+per-domain outstanding claims and memory allocated to the guests. These
+values added up reflect the global outstanding claim information provided via
+the I<info> argument, B<outstanding_claims> value.
+
+B<EXAMPLE>
+
+An example format for the list is as follows:
+
+ Name ID Mem VCPUs State Time(s) Claim
+ Domain-0 0 2047 4 r----- 19.7 0
+ OL5 2 1191 1 --p--- 0.0 847
+ OL6 3 1024 4 r----- 5.9 0
+ Windows_XP 4 49 1 --p--- 0.0 1989
+
=back
=head1 SCHEDULER SUBCOMMANDS
diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h
index 4c5e5d1..771b4af 100644
--- a/tools/libxl/xl.h
+++ b/tools/libxl/xl.h
@@ -83,6 +83,7 @@ int main_vtpmattach(int argc, char **argv);
int main_vtpmlist(int argc, char **argv);
int main_vtpmdetach(int argc, char **argv);
int main_uptime(int argc, char **argv);
+int main_claims(int argc, char **argv);
int main_tmem_list(int argc, char **argv);
int main_tmem_freeze(int argc, char **argv);
int main_tmem_thaw(int argc, char **argv);
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c9b71e6..f702aaf 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3061,7 +3061,8 @@ out:
}
}
-static void list_domains(int verbose, int context, const libxl_dominfo *info, int nb_domain)
+static void list_domains(int verbose, int context, int claim,
+ const libxl_dominfo *info, int nb_domain)
{
int i;
static const char shutdown_reason_letters[]= "-rscw";
@@ -3069,6 +3070,7 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, in
printf("Name ID Mem VCPUs\tState\tTime(s)");
if (verbose) printf(" UUID Reason-Code\tSecurity Label");
if (context && !verbose) printf(" Security Label");
+ if (claim) printf(" Claim");
printf("\n");
for (i = 0; i < nb_domain; i++) {
char *domname;
@@ -3095,6 +3097,8 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, in
if (info[i].shutdown) printf(" %8x", shutdown_reason);
else printf(" %8s", "-");
}
+ if (claim)
+ printf(" %5lu", (unsigned long)info[i].outstanding_memkb / 1024);
if (verbose || context) {
int rc;
size_t size;
@@ -4029,7 +4033,7 @@ int main_list(int argc, char **argv)
if (details)
list_domains_details(info, nb_domain);
else
- list_domains(verbose, context, info, nb_domain);
+ list_domains(verbose, context, 0 /* claim */, info, nb_domain);
if (info_free)
libxl_dominfo_list_free(info, nb_domain);
@@ -5927,6 +5931,33 @@ static char *uptime_to_string(unsigned long uptime, int short_mode)
return time_string;
}
+int main_claims(int argc, char **argv)
+{
+ libxl_dominfo *info;
+ int opt;
+ int nb_domain;
+
+ SWITCH_FOREACH_OPT(opt, "", NULL, "claims", 0) {
+ /* No options */
+ }
+
+ if (!libxl_defbool_val(claim_mode)) {
+ fprintf(stderr, "claim_mode not enabled (see man xl.conf).\n");
+ return 1;
+ }
+ info = libxl_list_domain(ctx, &nb_domain);
+ if (!info) {
+ fprintf(stderr, "libxl_domain_infolist failed.\n");
+ return 1;
+ }
+
+ list_domains(0 /* verbose */, 0 /* context */, 1 /* claim */,
+ info, nb_domain);
+
+ libxl_dominfo_list_free(info, nb_domain);
+ return 0;
+}
+
static char *current_time_to_string(time_t now)
{
char now_str[100];
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index b4a87ca..00899f5 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -362,6 +362,12 @@ struct cmd_spec cmd_table[] = {
"Print uptime for all/some domains",
"[-s] [Domain]",
},
+ { "claims",
+ &main_claims, 0, 0,
+ "List outstanding claim information about all domains",
+ "",
+ "",
+ },
{ "tmem-list",
&main_tmem_list, 0, 0,
"List tmem pools",
--
1.8.1.4
next prev parent reply other threads:[~2013-04-10 19:59 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 19:59 [PATCH v15] claim and its friends for allocating multiple self-ballooning guests Konrad Rzeszutek Wilk
2013-04-10 19:59 ` [PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation Konrad Rzeszutek Wilk
2013-04-12 15:16 ` Ian Jackson
2013-04-10 19:59 ` [PATCH 2/6] xl: Implement XENMEM_claim_pages support via 'claim_mode' global config Konrad Rzeszutek Wilk
2013-04-12 15:17 ` Ian Jackson
2013-04-12 17:18 ` Ian Jackson
2013-04-12 18:03 ` Ian Jackson
2013-04-12 18:04 ` Ian Jackson
2013-04-12 19:51 ` Konrad Rzeszutek Wilk
2013-04-12 20:07 ` Konrad Rzeszutek Wilk
2013-04-15 9:26 ` Ian Campbell
2013-04-15 9:34 ` Ian Campbell
2013-04-15 23:20 ` konrad wilk
2013-04-16 8:50 ` Ian Campbell
2013-04-10 19:59 ` [PATCH 3/6] xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf) Konrad Rzeszutek Wilk
2013-04-12 15:18 ` Ian Jackson
2013-04-10 19:59 ` [PATCH 4/6] xc: export outstanding_pages value in xc_dominfo structure Konrad Rzeszutek Wilk
2013-04-12 15:18 ` Ian Jackson
2013-04-10 19:59 ` [PATCH 5/6] xl: export 'outstanding_pages' value from xcinfo Konrad Rzeszutek Wilk
2013-04-12 15:19 ` Ian Jackson
2013-04-10 19:59 ` Konrad Rzeszutek Wilk [this message]
2013-04-10 20:08 ` [PATCH 6/6] xl: 'xl claims' print outstanding per domain claims if enabled (claim_mode=1 in xl.conf) Konrad Rzeszutek Wilk
2013-04-12 15:24 ` Ian Jackson
2013-04-12 16:49 ` Konrad Rzeszutek Wilk
2013-04-12 17:10 ` Ian Jackson
2013-04-12 10:55 ` [PATCH v15] claim and its friends for allocating multiple self-ballooning guests George Dunlap
2013-04-12 13:44 ` Konrad Rzeszutek Wilk
2013-04-12 17:20 ` Ian Jackson
2013-04-16 10:19 ` George Dunlap
2013-04-16 10:57 ` Ian Jackson
2013-04-16 10:58 ` 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=1365623998-13710-7-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=George.Dunlap@eu.citrix.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).