All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reserve vtd_mem on guest restore
@ 2010-09-02  8:32 Miroslav Rezanina
  2010-09-02 16:06 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Miroslav Rezanina @ 2010-09-02  8:32 UTC (permalink / raw)
  To: xen-devel

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:
--
diff -r 9f49667fec71 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py	Fri Jul 30 15:22:39 2010 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py	Thu Sep 02 10:30:23 2010 +0200
@@ -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
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] reserve vtd_mem on guest restore
  2010-09-02  8:32 [PATCH] reserve vtd_mem on guest restore Miroslav Rezanina
@ 2010-09-02 16:06 ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2010-09-02 16:06 UTC (permalink / raw)
  To: Miroslav Rezanina; +Cc: xen-devel

Miroslav Rezanina writes ("[Xen-devel] [PATCH] 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.

This patch has a syntax error:

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

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] reserve vtd_mem on guest restore
       [not found] <388842698.18991283495247231.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
@ 2010-09-03  6:28 ` Miroslav Rezanina
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Rezanina @ 2010-09-03  6:28 UTC (permalink / raw)
  To: xen-devel

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.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

diff -r 9f49667fec71 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py	Fri Jul 30 15:22:39 2010 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py	Thu Sep 02 18:21:35 2010 +0200
@@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] reserve vtd_mem on guest restore
  2010-09-02 16:23 ` Miroslav Rezanina
@ 2010-09-02 16:31   ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2010-09-02 16:31 UTC (permalink / raw)
  To: Miroslav Rezanina; +Cc: xen-devel

Miroslav Rezanina writes ("Re: [Xen-devel] [PATCH] reserve vtd_mem on guest restore"):
> 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:
   Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
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.

>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.

--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] reserve vtd_mem on guest restore
       [not found] <364688843.1952251283444477164.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
@ 2010-09-02 16:23 ` Miroslav Rezanina
  2010-09-02 16:31   ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Miroslav Rezanina @ 2010-09-02 16:23 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel


----- "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:

> From: "Ian Jackson" <Ian.Jackson@eu.citrix.com>
> To: "Miroslav Rezanina" <mrezanin@redhat.com>
> Cc: "xen-devel" <xen-devel@lists.xensource.com>
> 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"):
> > 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.

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:
--
diff -r 9f49667fec71 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py	Fri Jul 30 15:22:39 2010 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py	Thu Sep 02 18:21:35 2010 +0200
@@ -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
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-03  6:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02  8:32 [PATCH] reserve vtd_mem on guest restore Miroslav Rezanina
2010-09-02 16:06 ` Ian Jackson
     [not found] <364688843.1952251283444477164.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-02 16:23 ` Miroslav Rezanina
2010-09-02 16:31   ` Ian Jackson
     [not found] <388842698.18991283495247231.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-03  6:28 ` Miroslav Rezanina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.