WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 9 of 9] libxl: proper accounting for the videoram

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 9 of 9] libxl: proper accounting for the videoram
From: stefano.stabellini@xxxxxxxxxxxxx
Date: Fri, 27 Aug 2010 14:53:27 +0100
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 27 Aug 2010 07:07:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1008271440231.2545@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1008271440231.2545@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Remove the videoram from the memory target of the domains consistently,
leave the total amount of memory in maxmem.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff -r d740144dfc1c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Aug 26 18:56:19 2010 +0100
+++ b/tools/libxl/libxl.c       Thu Aug 26 18:56:47 2010 +0100
@@ -2865,11 +2865,12 @@ retry_transaction:
         libxl_xs_write(&gc, t, libxl_sprintf(&gc, "%s/memory/static-max", 
dompath), "%"PRIu32, target_memkb);
     }
 
-    rc = xc_domain_memory_set_pod_target(ctx->xch, domid, (target_memkb - 
videoram) / 4, NULL, NULL, NULL);
+    target_memkb -= videoram;
+    rc = xc_domain_memory_set_pod_target(ctx->xch, domid, target_memkb / 4, 
NULL, NULL, NULL);
     if (rc != 0) {
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
                 "xc_domain_memory_set_pod_target domid=%d, memkb=%d "
-                "failed rc=%d\n", domid, (target_memkb - videoram) / 4,
+                "failed rc=%d\n", domid, target_memkb / 4,
                 rc);
         abort = 1;
         goto out;
@@ -2977,11 +2978,12 @@ retry_transaction:
         libxl_xs_write(&gc, t, libxl_sprintf(&gc, "%s/memory/static-max", 
dompath), "%"PRIu32, memorykb);
     }
 
-    rc = xc_domain_memory_set_pod_target(ctx->xch, domid, (new_target_memkb - 
videoram) / 4, NULL, NULL, NULL);
+    new_target_memkb -= videoram;
+    rc = xc_domain_memory_set_pod_target(ctx->xch, domid, new_target_memkb / 
4, NULL, NULL, NULL);
     if (rc != 0) {
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
                 "xc_domain_memory_set_pod_target domid=%d, memkb=%d "
-                "failed rc=%d\n", domid, (new_target_memkb - videoram) / 4,
+                "failed rc=%d\n", domid, new_target_memkb / 4,
                 rc);
         abort = 1;
         goto out;
diff -r d740144dfc1c tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Thu Aug 26 18:56:19 2010 +0100
+++ b/tools/libxl/libxl_dom.c   Thu Aug 26 18:56:47 2010 +0100
@@ -100,7 +100,7 @@ int build_post(libxl_ctx *ctx, uint32_t 
     ents[0] = "memory/static-max";
     ents[1] = libxl_sprintf(&gc, "%d", info->max_memkb);
     ents[2] = "memory/target";
-    ents[3] = libxl_sprintf(&gc, "%d", info->target_memkb);
+    ents[3] = libxl_sprintf(&gc, "%d", info->target_memkb - info->video_memkb);
     ents[4] = "memory/videoram";
     ents[5] = libxl_sprintf(&gc, "%d", info->video_memkb);
     ents[6] = "domid";
@@ -230,7 +230,7 @@ int build_hvm(libxl_ctx *ctx, uint32_t d
     ret = xc_hvm_build_target_mem(
         ctx->xch,
         domid,
-        (info->max_memkb - info->video_memkb) / 1024,
+        info->max_memkb / 1024,
         (info->target_memkb - info->video_memkb) / 1024,
         libxl_abs_path(&gc, (char *)info->kernel.path,
                        libxl_xenfirmwaredir_path()));

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel