Skip to contentSkip to conversation

tools/libxl: modify static-max in xenstore when setting maxmem

PATCH In review Juergen Gross 2 participants 4 messages Jan 18, 2017 – Jan 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxl: modify static-max in xenstore when setting maxmem

xl mem-max is setting the hypervisor memory limit of a domain, but not the memory/static-max value in Xenstore. This prohibits setting the memory size above the old maximum size.

Set the new maximum value in Xenstore.

---
 tools/libxl/libxl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxl/libxl.c +3 -0
index 0622311..f59ec42 100644
@@ -4077,6 +4077,9 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb)
         goto out;
     }
 
+    libxl__xs_printf(gc, XBT_NULL, GCSPRINTF("%s/memory/static-max", dompath),
+                     "%"PRIu64, max_memkb);
+
     rc = 0;
 out:
     libxl_domain_config_dispose(&d_config);
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 7 lines · Juergen Gross

xl mem-max is setting the hypervisor memory limit of a domain, but not the memory/static-max value in Xenstore. This prohibits setting the memory size above the old maximum size.

Set the new maximum value in Xenstore.

This looks sensible. But memory accounting is a thorny area.

Could you try to do local migration test for both PV and HVM guests with this patch applied (with or w/out changing maxmem)?

Quoted 21 lines
---
 tools/libxl/libxl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxl/libxl.c +3 -0
index 0622311..f59ec42 100644
@@ -4077,6 +4077,9 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb)
         goto out;
     }
 
+    libxl__xs_printf(gc, XBT_NULL, GCSPRINTF("%s/memory/static-max", dompath),
+                     "%"PRIu64, max_memkb);
+
     rc = 0;
 out:
     libxl_domain_config_dispose(&d_config);
Signature · 1 line
2.10.2

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 5 lines · Wei Liu
Quoted 4 lines · Juergen Gross

xl mem-max is setting the hypervisor memory limit of a domain, but not the memory/static-max value in Xenstore. This prohibits setting the memory size above the old maximum size.

Quoted 8 lines
Quoted 3 lines

Set the new maximum value in Xenstore.

This looks sensible. But memory accounting is a thorny area.

Could you try to do local migration test for both PV and HVM guests with this patch applied (with or w/out changing maxmem)?

PV: works (both with or without maxmem changed)
HVM: works only with unchanged maxmem

HVM with changed maxmem will trigger an assertion in qemu for the incoming domain:

xen_ram_alloc: do not alloc 37c00000 bytes of ram at 0 when runstate is INMIGRATE
xen_ram_alloc: do not alloc 800000 bytes of ram at 37c00000 when runstate is INMIGRATE
qemu-system-i386:
/home/gross/xen/tools/qemu-xen-dir/include/exec/ram_addr.h:49:
ramblock_ptr: Assertion `offset_in_ramblock(block, offset)' failed.

Without my patch this is working, but the migrated domain has the old maxmem in hypervisor data as can be seen via "xl debug-keys q".

Juergen

Quoted 13 lines
Quoted 13 lines
---
 tools/libxl/libxl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxl/libxl.c +0 -0
index 0622311..f59ec42 100644
@@ -4077,6 +4077,9 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb)
         goto out;
     }
 
Quoted 10 lines
Quoted 9 lines
tools/libxl/libxl.c +3 -0
+    libxl__xs_printf(gc, XBT_NULL, GCSPRINTF("%s/memory/static-max", dompath),
+                     "%"PRIu64, max_memkb);
+
     rc = 0;
 out:
     libxl_domain_config_dispose(&d_config);
Signature · 1 line
2.10.2

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 29 lines · Juergen Gross
Quoted 5 lines · Wei Liu
Quoted 4 lines · Juergen Gross

xl mem-max is setting the hypervisor memory limit of a domain, but not the memory/static-max value in Xenstore. This prohibits setting the memory size above the old maximum size.

Quoted 8 lines
Quoted 3 lines

Set the new maximum value in Xenstore.

This looks sensible. But memory accounting is a thorny area.

Could you try to do local migration test for both PV and HVM guests with this patch applied (with or w/out changing maxmem)?

PV: works (both with or without maxmem changed)
HVM: works only with unchanged maxmem

HVM with changed maxmem will trigger an assertion in qemu for the incoming domain:

xen_ram_alloc: do not alloc 37c00000 bytes of ram at 0 when runstate is INMIGRATE
xen_ram_alloc: do not alloc 800000 bytes of ram at 37c00000 when runstate is INMIGRATE
qemu-system-i386:
/home/gross/xen/tools/qemu-xen-dir/include/exec/ram_addr.h:49:
ramblock_ptr: Assertion `offset_in_ramblock(block, offset)' failed.

Quoted 2 lines

Without my patch this is working, but the migrated domain has the old maxmem in hypervisor data as can be seen via "xl debug-keys q".

This is all very strange:

Starting a HVM domain with maxmem=1124 and memory=1024 will place the correct size in Xenstore, but max_pages in the hypervisor is showing 1025 MB only.

Can anybody tell me how the sizes should be set?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel