From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
Anthony Perard <anthony.perard@citrix.com>,
Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH v2] x86+libxl: correct p2m (shadow) memory pool size calculation
Date: Mon, 25 Apr 2022 15:51:36 +0200 [thread overview]
Message-ID: <YmanaIcSMviCmuf4@Air-de-Roger> (raw)
In-Reply-To: <039010e6-523f-851d-a432-d7f1a2fe5eca@suse.com>
On Mon, Apr 25, 2022 at 03:19:46PM +0200, Jan Beulich wrote:
> On 25.04.2022 14:59, Roger Pau Monné wrote:
> > On Mon, Apr 25, 2022 at 10:49:34AM +0200, Jan Beulich wrote:
> >> char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid)
> >> --- a/xen/arch/x86/dom0_build.c
> >> +++ b/xen/arch/x86/dom0_build.c
> >> @@ -317,9 +317,12 @@ unsigned long __init dom0_paging_pages(c
> >> /* Copied from: libxl_get_required_shadow_memory() */
> >
> > Could you also update the comment, maybe better would be:
> >
> > /* Keep in sync with libxl__get_required_paging_memory(). */
>
> Oh, of course.
>
> >> unsigned long memkb = nr_pages * (PAGE_SIZE / 1024);
> >>
> >> - memkb = 4 * (256 * d->max_vcpus + 2 * (memkb / 1024));
> >> + memkb = 4 * (256 * d->max_vcpus +
> >> + (paging_mode_enabled(d) +
> >> + (opt_dom0_shadow || opt_pv_l1tf_hwdom)) *
> >
> > opt_pv_l1tf_hwdom is only relevant for PV guests, so maybe it would be
> > best to use:
> >
> > paging_mode_enabled(d) ? 1 + opt_dom0_shadow
> > : 0 + (opt_dom0_shadow || opt_pv_l1tf_hwdom)
> >
> > Or something similar.
>
> Originally I was thinking that people simply shouldn't use the option
> when Dom0 isn't PV. But meanwhile I've figured that late-hwdom may be
> PV even if domain 0 is PVH. So yes.
>
> > Maybe placing this inside the sum will make the
> > expression too complex, so we could use a separate is_shadow boolean
> > to signal whether the domain will use shadow pagetables?
>
> I think
>
> memkb = 4 * (256 * d->max_vcpus +
> (is_pv_domain(d) ? opt_dom0_shadow || opt_pv_l1tf_hwdom
> : 1 + opt_dom0_shadow) *
> (memkb / 1024));
>
> is still okay-ish. Note that I've switched to is_pv_domain() to be
> independent of the point in time when shadow mode would be enabled
> for a PV Dom0.
Thanks, LGTM.
prev parent reply other threads:[~2022-04-25 13:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 8:49 [PATCH v2] x86+libxl: correct p2m (shadow) memory pool size calculation Jan Beulich
2022-04-25 12:59 ` Roger Pau Monné
2022-04-25 13:19 ` Jan Beulich
2022-04-25 13:51 ` Roger Pau Monné [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=YmanaIcSMviCmuf4@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=wl@xen.org \
--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.