From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] x86/pv: limit GDT and LDT mappings areas to max number of vCPUs
Date: Thu, 21 Nov 2024 18:11:22 +0100 [thread overview]
Message-ID: <Zz9pumdfsaBUP_27@macbook> (raw)
In-Reply-To: <b2d3a42f-b599-455f-ad15-716dd7552208@suse.com>
On Thu, Nov 21, 2024 at 05:03:21PM +0100, Jan Beulich wrote:
> On 21.11.2024 16:56, Roger Pau Monné wrote:
> > On Thu, Nov 21, 2024 at 12:12:18PM +0100, Roger Pau Monne wrote:
> >> The allocation of the paging structures in the per-domain area for mapping the
> >> guest GDT and LDT can be limited to the maximum number of vCPUs the guest can
> >> have. The maximum number of vCPUs is available at domain creation since commit
> >> 4737fa52ce86.
> >>
> >> Limiting to the actual number of vCPUs avoids wasting memory for paging
> >> structures that will never be used. Current logic unconditionally uses 513
> >> pages, one page for the L3, plus 512 L1 pages.
> >
> > This is not true, I was confused with the logic in
> > create_perdomain_mapping(). When create_perdomain_mapping() is called
> > with pl1tab == NULL and ppg == NULL it just allocates the L2, but not
> > the L1 tables.
> >
> > So the purpose of the create_perdomain_mapping(d, GDT_LDT_VIRT_START,
> > ...) in pv_domain_initialise() is even more dubious now - as it just
> > allocates a page to use as L2. I'm tempted to just remove it if you
> > agree, since I don't consider this useful. The allocation will
> > already be done at vCPU initialization.
>
> If it's done implicitly there, removing is likely fine. It feels like it may
> have been necessary to do this explicitly earlier on.
Possibly before you introduced the create_perdomain_mapping() the
initialization and allocation of the L2 was needed in
pv_domain_initialise().
I have a patch to remove it, and as expected nothing seems to explode,
so I will send it.
Thanks, Roger.
prev parent reply other threads:[~2024-11-21 17:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 11:12 [PATCH] x86/pv: limit GDT and LDT mappings areas to max number of vCPUs Roger Pau Monne
2024-11-21 11:26 ` Andrew Cooper
2024-11-21 11:39 ` Roger Pau Monné
2024-11-21 11:32 ` Jan Beulich
2024-11-21 15:56 ` Roger Pau Monné
2024-11-21 16:03 ` Jan Beulich
2024-11-21 17:11 ` 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=Zz9pumdfsaBUP_27@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.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.