xen-devel.lists.xenproject.org archive mirror
 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 1/2] x86/dom0: rename paging function
Date: Wed, 12 Dec 2018 11:04:07 +0100	[thread overview]
Message-ID: <20181212100407.j5hg4vqi2l4kjvsk@mac> (raw)
In-Reply-To: <5C10DA96020000780020560C@prv1-mh.provo.novell.com>

On Wed, Dec 12, 2018 at 02:53:26AM -0700, Jan Beulich wrote:
> >>> On 12.12.18 at 10:14, <roger.pau@citrix.com> wrote:
> > On Tue, Dec 11, 2018 at 08:33:08AM -0700, Jan Beulich wrote:
> >> >>> On 11.12.18 at 16:19, <roger.pau@citrix.com> wrote:
> >> > On Tue, Dec 11, 2018 at 08:08:51AM -0700, Jan Beulich wrote:
> >> >> >>> On 05.12.18 at 15:54, <roger.pau@citrix.com> wrote:
> >> >> > To note it's calculating the approximate amount of memory required by
> >> >> > shadow paging.
> >> >> 
> >> >> I don't understand this logic, and ...
> >> >> 
> >> >> > @@ -325,7 +325,7 @@ unsigned long __init dom0_compute_nr_pages(
> >> >> >              break;
> >> >> >  
> >> >> >          /* Reserve memory for shadow or HAP. */
> >> >> > -        avail -= dom0_paging_pages(d, nr_pages);
> >> >> > +        avail -= dom0_shadow_pages(d, nr_pages);
> >> >> >      }
> >> >> 
> >> >> ... the comment here (and lack of conditional restricting the
> >> >> code to shadow mode) appear to support me: Have you
> >> >> been mislead by the function having a comment referring
> >> >> to libxl_get_required_shadow_memory()? I think if anything
> >> >> that libxl function would want to be renamed (to replace
> >> >> "shadow" by something more generic in its name).
> >> > 
> >> > But the logic in dom0_shadow_pages to calculate the size of the paging
> >> > memory pool is specifically for shadow AFAICT, I don't think HAP needs
> >> > to take the number of vCPUs into account, since there's only a
> >> > single p2m for the whole domain. OTOH shadow needs to take the number
> >> > of vCPUs into account because each one will have a different shadow.
> >> 
> >> Yes, the vCPU count aspect is indeed shadow specific. However,
> >> as said in reply to the other patch, the calculation here was at
> >> least supposed to also take into account the P2M part of the
> >> needed allocations. Yet the P2M part ought to be similar between
> >> both modes.
> >> 
> >> > Note that patch 2 in this series adds a function to calculate the size
> >> > of the paging memory pool for HAP, and a conditional is added to the
> >> > expression above that takes into account whether shadow or HAP is in
> >> > use when subtracting from the amount of available memory.
> >> 
> >> Well, assuming we can settle on what shape patch 2 should take
> >> I can see the point in doing the rename here, but then with an
> >> adjusted description: Especially in light of the code comment still
> >> visible above you'll want to point out that the rename is in
> >> preparation of splitting the calculations. Since I question the split,
> >> though, the rename (in a separate patch) is questionable to me
> >> too. If we used uniform P2M calculations and added just shadow's
> >> per-vCPU extra on top, no rename in a separate patch would
> >> seem warranted.
> > 
> > The current calculations in dom0_paging_pages assume 1 page is needed
> > for each 1MB of guest memory for the p2m, do you think this is OK?
> > (and suitable to be used for HAP/IOMMU page tables also)
> 
> Well, 1 page per 1Mb means the same as your current 8 bytes
> per page times 2 (for separate P2M and IOMMU tables), afaict.

I was planning to use 1 page per 1Mb for the p2m, and then 1 page per
1Mb for the IOMMU, so 16 bytes per page.

You mentioned there's some code (for PV?) to calculate the size of the
page tables but I'm having trouble finding it (mainly because I'm not
that familiar with PV), could you point me to it?

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:05 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é [this message]
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é
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=20181212100407.j5hg4vqi2l4kjvsk@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 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).