Miroslav Rezanina
2010-Sep-02 08:32 UTC
[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. 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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Sep-02 16:06 UTC
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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Miroslav Rezanina
2010-Sep-02 16:23 UTC
Re: [Xen-devel] [PATCH] reserve vtd_mem on guest restore
----- "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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Sep-02 16:31 UTC
Re: [Xen-devel] [PATCH] reserve vtd_mem on guest restore
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. -- _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Miroslav Rezanina
2010-Sep-03 06:28 UTC
[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. 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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel