All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xenproject.org, andrei.semenov@bertin.fr,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v2 2/2] x86/dom0: improve paging memory usage calculations
Date: Mon, 10 Dec 2018 11:33:28 +0100	[thread overview]
Message-ID: <20181210103328.pcahadza7dqustrq@mac> (raw)
In-Reply-To: <20181206124215.ofcmc4litd4l4753@zion.uk.xensource.com>

On Thu, Dec 06, 2018 at 12:42:15PM +0000, Wei Liu wrote:
> On Wed, Dec 05, 2018 at 03:55:00PM +0100, Roger Pau Monne wrote:
> > Current approximation of paging memory usage is based on the required
> > amount when running in shadow mode and doesn't take into account the
> > memory required by the IOMMU page tables.
> > 
> > Fix this by introducing a function to calculate the amount of memory
> > required by HAP/IOMMU page tables. The formula used to calculate such
> > approximation is based on the pessimistic approach that each 4KB
> > memory chunk will use 8 bytes of page table memory. Note that this
> > approximation might need further tuning based on testing on different
> > systems.
> > 
> > Also fix the calculation of the required paging related memory in
> > dom0_compute_nr_pages to take into account the paging implementation
> > (shadow or HAP) and whether the IOMMU pages tables are shared with the
> > HAP page tables.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Jan Beulich <jbeulich@suse.com>
> > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > Cc: Wei Liu <wei.liu2@citrix.com>
> > Cc: andrei.semenov@bertin.fr
> > ---
> >  xen/arch/x86/dom0_build.c        | 31 +++++++++++++++++++++++++++----
> >  xen/arch/x86/hvm/dom0_build.c    |  6 ++++--
> >  xen/include/asm-x86/dom0_build.h |  2 ++
> >  3 files changed, 33 insertions(+), 6 deletions(-)
> > 
> > diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
> > index ba9aa85611..3a8e138f23 100644
> > --- a/xen/arch/x86/dom0_build.c
> > +++ b/xen/arch/x86/dom0_build.c
> > @@ -267,6 +267,25 @@ unsigned long __init dom0_shadow_pages(const struct domain *d,
> >      return ((memkb + 1023) / 1024) << (20 - PAGE_SHIFT);
> >  }
> >  
> > +unsigned long __init dom0_hap_pages(const struct domain *d,
> > +                                    unsigned long nr_pages)
> > +{
> > +    /*
> > +     * Attempt to account for at least some of the MMIO regions by adding the
> > +     * size of the holes in the memory map to the amount of pages to map. Note
> > +     * this will obviously not account for MMIO regions that are past the last
> > +     * RAM range in the memory map.
> > +     */
> > +    nr_pages += max_page - total_pages;
> 
> Do those regions past end of RAM range show up in E820 map?

No, BARs for example don't need to be in reserved regions. I've got
one box with a 16GB Tesla card that has the 16GB BAR placed way past
the last entry in the memory map, without any reserved region.

So while this approach is not perfect, it's better than what we
currently do, and we can always improve from there if it's clear what
limitations we currently have.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-12-10 10:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 14:54 [PATCH v2 0/2] x86/dom0: improve PVH paging memory calculation Roger Pau Monne
2018-12-05 14:54 ` [PATCH v2 1/2] x86/dom0: rename paging function Roger Pau Monne
2018-12-06 12:31   ` Wei Liu
2018-12-11 15:08   ` Jan Beulich
2018-12-11 15:19     ` Roger Pau Monné
2018-12-11 15:33       ` Jan Beulich
2018-12-12  9:14         ` Roger Pau Monné
2018-12-12  9:53           ` Jan Beulich
2018-12-12 10:04             ` Roger Pau Monné
2018-12-12 10:32               ` Jan Beulich
2018-12-12 15:56                 ` Roger Pau Monné
2018-12-12 16:15                   ` Jan Beulich
2018-12-12 17:05                     ` Roger Pau Monné
     [not found]                       ` <3F7E1F6E020000A10063616D@prv1-mh.provo.novell.com>
2018-12-13  7:45                         ` Jan Beulich
2018-12-13  9:14                           ` Roger Pau Monné
     [not found]                             ` <12305AED020000300063616D@prv1-mh.provo.novell.com>
2018-12-13 10:17                               ` Jan Beulich
2018-12-13 14:20                                 ` Roger Pau Monné
     [not found]                                   ` <7320EEF8020000C00063616D@prv1-mh.provo.novell.com>
2018-12-13 14:47                                     ` Jan Beulich
2019-01-29 15:02                                       ` Roger Pau Monné
     [not found]                                         ` <812B19D1020000B00063616D@prv1-mh.provo.novell.com>
2019-01-29 15:38                                           ` Jan Beulich
2018-12-05 14:55 ` [PATCH v2 2/2] x86/dom0: improve paging memory usage calculations Roger Pau Monne
2018-12-06 12:42   ` Wei Liu
2018-12-10 10:33     ` Roger Pau Monné [this message]
2018-12-11 12:17       ` Wei Liu
2018-12-11 15:19   ` Jan Beulich
2018-12-11 15:36     ` Roger Pau Monné
2018-12-11 16:21       ` Jan Beulich
2018-12-12  9:37         ` Roger Pau Monné
2018-12-12  9:59           ` Jan Beulich
2018-12-12 10:16             ` Roger Pau Monné
2018-12-12 10:57               ` Jan Beulich
2018-12-12 11:14                 ` Roger Pau Monné
2018-12-12 11:19                   ` Roger Pau Monné

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=20181210103328.pcahadza7dqustrq@mac \
    --to=roger.pau@citrix.com \
    --cc=andrei.semenov@bertin.fr \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.