All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxc: correct memory range check in domain builder
@ 2016-02-08 14:23 Juergen Gross
  2016-02-08 15:20 ` Anthony PERARD
  0 siblings, 1 reply; 3+ messages in thread
From: Juergen Gross @ 2016-02-08 14:23 UTC (permalink / raw)
  To: xen-devel, Ian.Campbell, ian.jackson, stefano.stabellini,
	wei.liu2, anthony.perard
  Cc: Juergen Gross

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

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

* Re: [PATCH] libxc: correct memory range check in domain builder
  2016-02-08 14:23 [PATCH] libxc: correct memory range check in domain builder Juergen Gross
@ 2016-02-08 15:20 ` Anthony PERARD
  2016-02-08 15:45   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony PERARD @ 2016-02-08 15:20 UTC (permalink / raw)
  To: Juergen Gross
  Cc: wei.liu2, stefano.stabellini, ian.jackson, Ian.Campbell, xen-devel

On Mon, Feb 08, 2016 at 03:23:52PM +0100, Juergen Gross wrote:
> 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>

It works for me, using xl. I have not try with the full stack
(openstack/libvirt), but I expect it to work.

Tested-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,

-- 
Anthony PERARD

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

* Re: [PATCH] libxc: correct memory range check in domain builder
  2016-02-08 15:20 ` Anthony PERARD
@ 2016-02-08 15:45   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2016-02-08 15:45 UTC (permalink / raw)
  To: Anthony PERARD, Juergen Gross
  Cc: wei.liu2, stefano.stabellini, ian.jackson, xen-devel

On Mon, 2016-02-08 at 15:20 +0000, Anthony PERARD wrote:
> On Mon, Feb 08, 2016 at 03:23:52PM +0100, Juergen Gross wrote:
> > 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>
> 
> It works for me, using xl. I have not try with the full stack
> (openstack/libvirt), but I expect it to work.
> 
> Tested-by: Anthony PERARD <anthony.perard@citrix.com>

thanks, acked + applied.

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

end of thread, other threads:[~2016-02-08 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 14:23 [PATCH] libxc: correct memory range check in domain builder Juergen Gross
2016-02-08 15:20 ` Anthony PERARD
2016-02-08 15:45   ` Ian Campbell

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.