xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] libxl: create PVH guests with max memory assigned
Date: Thu, 17 Jul 2014 13:02:22 +0200	[thread overview]
Message-ID: <1405594942-20760-1-git-send-email-roger.pau@citrix.com> (raw)

Since PVH guests are very similar to HVM guests in terms of memory
management, start the guest with the maximum memory assigned and let
it balloon down.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Mukesh Rathor <mukesh.rathor@oracle.com>
---
 tools/libxl/libxl_dom.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 661999c..eada87d 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -233,6 +233,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     libxl_domain_build_info *const info = &d_config->b_info;
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *xs_domid, *con_domid;
+    unsigned long mem;
     int rc;
 
     if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
@@ -263,8 +264,12 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     libxl_domain_set_nodeaffinity(ctx, domid, &info->nodemap);
     libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
 
-    if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
-        LIBXL_MAXMEM_CONSTANT) < 0) {
+    if (info->type == LIBXL_DOMAIN_TYPE_PV)
+        mem = libxl_defbool_val(d_config->c_info.pvh) ? info->max_memkb :
+                                                        info->target_memkb;
+    else
+        mem = info->target_memkb;
+    if (xc_domain_setmaxmem(ctx->xch, domid, mem + LIBXL_MAXMEM_CONSTANT) < 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't set max memory");
         return ERROR_FAIL;
     }
@@ -370,6 +375,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     struct xc_dom_image *dom;
+    unsigned long mem;
     int ret;
     int flags = 0;
 
@@ -440,7 +446,8 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
         LOGE(ERROR, "libxl__arch_domain_init_hw_description failed");
         goto out;
     }
-    if ( (ret = xc_dom_mem_init(dom, info->target_memkb / 1024)) != 0 ) {
+    mem = state->pvh_enabled ? info->max_memkb : info->target_memkb;
+    if ( (ret = xc_dom_mem_init(dom, mem / 1024)) != 0 ) {
         LOGE(ERROR, "xc_dom_mem_init failed");
         goto out;
     }
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2014-07-17 11:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 11:02 Roger Pau Monne [this message]
2014-07-18 16:49 ` [PATCH] libxl: create PVH guests with max memory assigned Konrad Rzeszutek Wilk
2014-07-18 17:00   ` Roger Pau Monné
2014-07-18 17:11     ` Andrew Cooper
2014-07-21 10:16       ` Ian Campbell
2014-07-18 20:53     ` Konrad Rzeszutek Wilk
2014-08-05  8:57       ` Ian Campbell
2014-07-18 17:19   ` Olaf Hering
2014-07-18 19:33     ` Konrad Rzeszutek Wilk
2014-08-01 15:34 ` Roger Pau Monné
2014-08-04 18:44   ` Konrad Rzeszutek Wilk
2014-08-05  8:55 ` Ian Campbell
2014-08-05  9:34   ` David Vrabel
2014-08-05 11:08     ` Roger Pau Monné
2014-08-05 14:06       ` Ian Campbell
2014-08-05 14:10       ` George Dunlap
2014-08-05 21:22         ` Mukesh Rathor
2014-08-05 14:18       ` Is: PVH - how to solve maxmem != memory scenario? Was:Re: " Konrad Rzeszutek Wilk
2014-08-05 14:36         ` Jan Beulich
2014-08-05 14:48           ` Konrad Rzeszutek Wilk
2014-08-05 15:12             ` Jan Beulich
2014-08-05 15:41               ` Konrad Rzeszutek Wilk
2014-08-05 15:05         ` David Vrabel
2014-08-05 15:40           ` Konrad Rzeszutek Wilk
2014-08-05 15:51             ` Jan Beulich
2014-08-05 15:56               ` Konrad Rzeszutek Wilk
2014-08-05 16:07                 ` Jan Beulich
2014-08-05 19:45           ` Tim Deegan
2014-08-05 21:36         ` Mukesh Rathor

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=1405594942-20760-1-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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).