All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	andrei.semenov@bertin.fr, Wei Liu <wei.liu2@citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 2/2] x86/dom0: improve paging memory usage calculations
Date: Wed, 12 Dec 2018 11:16:48 +0100	[thread overview]
Message-ID: <20181212101648.fqww462x7jiwsjpp@mac> (raw)
In-Reply-To: <5C10DC0E020000780020561B@prv1-mh.provo.novell.com>

On Wed, Dec 12, 2018 at 02:59:42AM -0700, Jan Beulich wrote:
> >>> On 12.12.18 at 10:37, <roger.pau@citrix.com> wrote:
> > OK, I will iterate over all the devices in order to size the BARs, and
> > then add the sum of BARs MMIO regions to the amount of guest memory,
> > so that each 1MB of BAR MMIO will require 1 page for the p2m.
> 
> Don't you construct a rangeset for all of the BARs already
> anyway? For ones which have an address assigned and are
> enabled, also taking the address into account would seem
> desirable, as then you could do with less than double over-
> estimating (in the common case) the amount of space needed.

That's a chicken and egg problem, the current accounting of BAR sizes
is done in init_bars, which will also setup the identity p2m
mappings, so the call to paging_set_allocation (and thus the amount of
memory required by the p2m) needs to happen before mapping any BARs.

> > Note that ATM I will not account for VF BARs.
> 
> Hmm, yes, this is perhaps indeed too much to ask for at this
> point. But ultimately we need a clean approach there too.

Well, since there's no support for SR-IOV for PVH Dom0 ATM I guess I
could add this once it's supported. It's not overly complicated, at
the end is just BAR sizings at a different position in the config
space.

> > OK, so for shadow we also need to account for the IOMMU page table
> > size, which is not done now AFAICT.
> 
> As said (or perhaps implied) in the other reply, the calculation
> there may imply half of the space for the IOMMU, but it may
> also mean the other half to be for higher level tables on the
> CPU side. It's all guesswork without suitable comments.

My guess was that the other half of the space was supposed to be used
by higher level tables, and that the accounting for IOMMU page tables
is completely missing. Note that on PV there's no accounting for IOMMU
page tables either AFAICT.

There are also further issues that I wanted to discuss in a separate
thread, what about foreign mappings? Dom0 will likely map a non
trivial amount of grants and foreign mappings, which will also require
p2m/IOMMU page table entries.

Should we maybe size Dom0 p2m/iommu internal paging structures to be
able to map up to max_page at least?

Thanks, Roger.

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

  reply	other threads:[~2018-12-12 10:16 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é
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é [this message]
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=20181212101648.fqww462x7jiwsjpp@mac \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrei.semenov@bertin.fr \
    --cc=andrew.cooper3@citrix.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.