From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org, Ian.Campbell@citrix.com,
ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com,
wei.liu2@citrix.com, anthony.perard@citrix.com
Cc: Juergen Gross <jgross@suse.com>
Subject: [PATCH] libxc: correct memory range check in domain builder
Date: Mon, 8 Feb 2016 15:23:52 +0100 [thread overview]
Message-ID: <1454941432-24262-1-git-send-email-jgross@suse.com> (raw)
Commit 81a76e4b12961a9f54f5021809074196dfe6dbba ("libxc: rework of
domain builder's page table handler") introduced a regression with
checking the required memory size of the domain. The needed maximum pfn
of the initial kernel mapping was added to the currently last used pfn
resulting in doubling the estimated memory need.
Correct the calculation of the last needed pfn to enable booting of
small domains again.
Reported-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/libxc/xc_dom_x86.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 2a3f64b..ac4dae5 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -164,7 +164,7 @@ static int count_pgtables(struct xc_dom_image *dom, xen_vaddr_t from,
for ( l = domx86->params->levels - 1; l >= 0; l-- )
{
- map->lvls[l].pfn = pfn + map->area.pgtables;
+ map->lvls[l].pfn = dom->pfn_alloc_end + map->area.pgtables;
if ( l == domx86->params->levels - 1 )
{
/* Top level page table in first mapping only. */
@@ -238,8 +238,7 @@ static int alloc_pgtables(struct xc_dom_image *dom)
try_virt_end = round_up(dom->virt_alloc_end + pages * PAGE_SIZE_X86,
bits_to_mask(22)); /* 4MB alignment */
- if ( count_pgtables(dom, dom->parms.virt_base, try_virt_end,
- dom->pfn_alloc_end) )
+ if ( count_pgtables(dom, dom->parms.virt_base, try_virt_end, 0) )
return -1;
pages = map->area.pgtables + extra_pages;
--
2.6.2
next reply other threads:[~2016-02-08 14:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 14:23 Juergen Gross [this message]
2016-02-08 15:20 ` [PATCH] libxc: correct memory range check in domain builder Anthony PERARD
2016-02-08 15:45 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454941432-24262-1-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=Ian.Campbell@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).