libxl: proper accounting for the videoram
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 22 Sep 2010 17:03:41 +0000 (18:03 +0100)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 22 Sep 2010 17:03:41 +0000 (18:03 +0100)
Remove the videoram from the memory target of the domains consistently,
leave the total amount of memory in maxmem.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_dom.c

index 83830d1dbd0c82c0046bee8e0db8381a2bb47c94..31535af7882f63bfc3124a4f3292870b6de10f4d 100644 (file)
@@ -2952,12 +2952,13 @@ retry_transaction:
         }
     }
 
+    new_target_memkb -= videoram;
     rc = xc_domain_memory_set_pod_target(ctx->xch, domid,
-            (new_target_memkb - videoram) / 4, NULL, NULL, NULL);
+            new_target_memkb / 4, NULL, NULL, NULL);
     if (rc != 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__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;
index 9f5d98552f054f1b80b605da048a9518d889f8f4..13cdab5fd5478d82005514bccd0e95b03f8d45b2 100644 (file)
@@ -110,7 +110,7 @@ int libxl__build_post(libxl_ctx *ctx, uint32_t domid,
     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";