All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH] x86/pv: limit GDT and LDT mappings areas to max number of vCPUs
Date: Thu, 21 Nov 2024 16:56:35 +0100	[thread overview]
Message-ID: <Zz9YM_MB1AoLqSIE@macbook> (raw)
In-Reply-To: <20241121111218.50984-1-roger.pau@citrix.com>

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.

Thanks, Roger.


  parent reply	other threads:[~2024-11-21 15:57 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é [this message]
2024-11-21 16:03   ` Jan Beulich
2024-11-21 17:11     ` 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=Zz9YM_MB1AoLqSIE@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.