Skip to contentSkip to conversation

reserve vtd_mem on guest restore

PATCH Miroslav Rezanina 2 participants 2 messages Sep 2, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 364688843.1952251283444477164.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com

#1 lore raw
Quoted 17 lines · ----- "Ian Jackson

From: "Ian Jackson" <[email protected]>
To: "Miroslav Rezanina" <[email protected]>
Cc: "xen-devel" <[email protected]>
Sent: Thursday, September 2, 2010 6:06:15 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: Re: [Xen-devel] [PATCH] reserve vtd_mem on guest restore

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

Quoted 2 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,

Quoted 5 lines

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.

Quoted 8 lines

This patch has a syntax error:

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

IndentationError: unexpected indent

Ian.

Oh, you're right..I do not know how I could miss it - now I see it even in mail. Indentation problem cause by different level in XendDomainInfo.py.

Correct version is:
--

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 kernel
#2 lore raw

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

Quoted 5 lines

Oh, you're right..I do not know how I could miss it - now I see it even in mail. Indentation problem cause by different level in XendDomainInfo.py.

Correct version is:

Thanks. Can you sign it off properly please ? It's just slightly too big to accept without that I think.

You do it like this:

except with your name and email address. This indicates that you are certifying the code as suitable (copyright-wise and so on) for inclusion in Xen. You can find the precise meaning in the Linux upstream kernel tree (Documentation/SubmittingPatches, copy below).

Thanks,
Ian.

Quoted 1 line

From Documentation/SubmittingPatches:

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.

--