xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: Tim Deegan <tim@xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Frediano Ziglio <freddy77@gmail.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] xen/arm: Workaround for memory problem >1gb
Date: Thu, 2 Oct 2014 15:09:39 +0100	[thread overview]
Message-ID: <1412258979.17146.14.camel@citrix.com> (raw)
In-Reply-To: <542D3108.4080506@linaro.org>

On Thu, 2014-10-02 at 12:03 +0100, Julien Grall wrote:
> Hello Frediano,
> 
> On 10/01/2014 03:27 PM, Frediano Ziglio wrote:
> > setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
> > On system with large memory is possible that there are no blocks of memory
> > smaller than 1gb leading xenheap_pages to be more than 1gb.
> > This cause memory errors trying to access heap after the 1gb limit.
> > 
> > Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
> > ---
> >  xen/arch/arm/setup.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> > index 446de8a..b1a43e6 100644
> > --- a/xen/arch/arm/setup.c
> > +++ b/xen/arch/arm/setup.c
> > @@ -524,6 +524,9 @@ static void __init setup_mm(unsigned long
> > dtb_paddr, size_t dtb_size)
> >      if ( ! e )
> >          panic("Not not enough space for xenheap");
> > 
> > +    if ( xenheap_pages > 1<<(30-PAGE_SHIFT) )
> > +        xenheap_pages = 1<<(30-PAGE_SHIFT);
> > +
> 
> Looking closer to the code, can't we add a new constraint before the
> loop when we are looking for the maximum heap size?
> 
> smth like:
> 
> xenheap_pages = (heap_pages/8 + ...)
> xenheap_pages = max(xenheap_pages, 128UL<<(20 - PAGE_SHIFT)
> xenheap_pages = max(xenheap_pages, 1UL<<(30-PAGE_SHIFT))

I think that would work, and it would have the additional benefit that
for some memory layouts it might cause us to place the xenheap in a
higher block of memory than we would otherwise, which is generally
desirable.

Ian.

      parent reply	other threads:[~2014-10-02 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 14:27 [PATCH] xen/arm: Workaround for memory problem >1gb on last section Frediano Ziglio
2014-10-02 11:03 ` Julien Grall
2014-10-02 14:07   ` Frediano Ziglio
2014-10-02 14:30     ` Julien Grall
2014-10-02 14:09   ` Ian Campbell [this message]

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=1412258979.17146.14.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=freddy77@gmail.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --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).