Skip to contentSkip to conversation

reserve vtd_mem on guest restore

PATCH In review Miroslav Rezanina 2 participants 2 messages Sep 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reserve vtd_mem on guest restore

There's need for free vtd_mem more memory for guest with xen-unstable c/s 17529. This memory is freed when guest is created, but is not freed when guest is restored. So restore guest fails due to not enough of memory for guest.

Following patch uses same calculation of memory to free in guest restore as is in guest creation.

Patch:
--

tools/python/xen/xend/XendCheckpoint.py +9 -1
diff -r 9f49667fec71 tools/python/xen/xend/XendCheckpoint.py
@@ -277,7 +277,15 @@
         # set memory limit
         xc.domain_setmaxmem(dominfo.getDomid(), maxmem)
 
-        balloon.free(memory + shadow, dominfo)
+            vtd_mem = 0
+            info = xc.physinfo()
+            if 'hvm_directio' in info['virt_caps']:
+                # Reserve 1 page per MiB of RAM for separate VT-d page table.
+                vtd_mem = 4 * (dominfo.info['memory_static_max'] / 1024 / 1024)
+                # Round vtd_mem up to a multiple of a MiB.
+                vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
+
+        balloon.free(memory + shadow + vtd_mem, dominfo)
 
         shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow / 1024)
         dominfo.info['shadow_memory'] = shadow_cur
Signature · 2 lines
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN
#1 lore raw

Miroslav Rezanina writes ("[Xen-devel] [PATCH] reserve vtd_mem on guest restore"):

Quoted 7 lines

There's need for free vtd_mem more memory for guest with xen-unstable c/s 17529. This memory is freed when guest is created, but is not freed when guest is restored. So restore guest fails due to not enough of memory for guest.

Following patch uses same calculation of memory to free in guest restore as is in guest creation.

This patch has a syntax error:

    File "tools/python/xen/xend/XendCheckpoint.py", line 280
      vtd_mem = 0
      ^

IndentationError: unexpected indent

Ian.