From: George Dunlap <dunlapg@umich.edu>
To: xen-devel@lists.xenproject.org
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Alejandro Vallejo" <agarciav@amd.com>,
"Teddy Astie" <teddy.astie@vates.tech>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"George Dunlap" <gwd@xenproject.org>
Subject: [PATCH v2 06/14] x86/pv: remove stashing of GDT/LDT L1 page-tables
Date: Wed, 2 Sep 2026 10:43:50 +0100 [thread overview]
Message-ID: <20260901-asi-part2-6-ecc269f268b7@xenproject.org> (raw)
In-Reply-To: <20260901-asi-part2-0-ecc269f268b7@xenproject.org>
From: Roger Pau Monné <roger.pau@citrix.com>
There are no remaining users of the stashed L1 page-tables in
pv_domain.gdt_ldt_l1tab. Remove it, and all helpers. This removes a
globally-mapped xenheap allocation, and sets the stage for per-vCPU
root page tables.
pv_create_gdt_ldt_l1tab() now passes NIL() rather than the stash
array. This will cause create_perdomain_mapping() to still eagerly
allocate the L1 tables covering the GDT/LDT range; but their addresses
are no longer handed back. Doing this is necessary because
populate_perdomain_mapping() only fills existing tables, and treats
missing structure as a bug.
Another side effect of passing NIL() rather than a pointer is that the
L1 tables move from the xenheap to the domheap. Residing in the
xenheap was only ever a requirement when the stashed pointer had to
stay usable; with that requirement dropped, we can relax the
allocation requirement as well.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: George Dunlap <gwd@xenproject.org>
---
Changes in v2:
- With "x86/mm: allocate the per-domain page-tables from the xenheap"
dropped from the series, passing NIL() now does move the GDT/LDT L1
tables to the domheap (upstream's allocation for non-capture mode);
in v1 they stayed in the xenheap in all modes. Reword the commit
message accordingly.
Changes since the previously posted version:
- Note the implications of changing from pointer to NIL() in
pv_create_gdt_ldt_l1tab(). In v2 this also changed where new
GDT/LDT L1 tables were allocated from: upstream's capture mode
takes them from the xenheap (the stashed pointer has to stay
usable), the NIL() mode from the domheap. Here they come from the
xenheap in all modes ("x86/mm: allocate the per-domain page-tables
from the xenheap"), so the switch only stops the addresses being
handed back.
---
xen/arch/x86/include/asm/domain.h | 9 ---------
xen/arch/x86/pv/domain.c | 10 +---------
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 61a9fe00f0..5c7fad26a6 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -287,8 +287,6 @@ struct time_scale {
struct pv_domain
{
- l1_pgentry_t **gdt_ldt_l1tab;
-
atomic_t nr_l4_pages;
/* Is a 32-bit PV guest? */
@@ -524,13 +522,6 @@ struct arch_domain
#define has_pirq(d) (!!((d)->arch.emulation_flags & X86_EMU_USE_PIRQ))
#define has_vpci(d) (!!((d)->arch.emulation_flags & X86_EMU_VPCI))
-#define gdt_ldt_pt_idx(v) \
- ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))
-#define pv_gdt_ptes(v) \
- ((v)->domain->arch.pv.gdt_ldt_l1tab[gdt_ldt_pt_idx(v)] + \
- (((v)->vcpu_id << GDT_LDT_VCPU_SHIFT) & (L1_PAGETABLE_ENTRIES - 1)))
-#define pv_ldt_ptes(v) (pv_gdt_ptes(v) + 16)
-
struct pv_vcpu
{
/* map_domain_page() mapping cache. */
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 7ddab1949f..35d1761c9c 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -315,7 +315,7 @@ static int pv_create_gdt_ldt_l1tab(struct vcpu *v)
{
return create_perdomain_mapping(v->domain, GDT_VIRT_START(v),
1U << GDT_LDT_VCPU_SHIFT,
- v->domain->arch.pv.gdt_ldt_l1tab,
+ NIL(l1_pgentry_t *),
NULL);
}
@@ -389,8 +389,6 @@ void pv_domain_destroy(struct domain *d)
GDT_LDT_MBYTES << (20 - PAGE_SHIFT));
XFREE(d->arch.pv.cpuidmasks);
-
- FREE_XENHEAP_PAGE(d->arch.pv.gdt_ldt_l1tab);
}
void noreturn cf_check continue_pv_domain(void);
@@ -406,12 +404,6 @@ int pv_domain_initialise(struct domain *d)
pv_l1tf_domain_init(d);
- d->arch.pv.gdt_ldt_l1tab =
- alloc_xenheap_pages(0, MEMF_node(domain_to_node(d)));
- if ( !d->arch.pv.gdt_ldt_l1tab )
- goto fail;
- clear_page(d->arch.pv.gdt_ldt_l1tab);
-
if ( levelling_caps & ~LCAP_faulting &&
(d->arch.pv.cpuidmasks = xmemdup(&cpuidmask_defaults)) == NULL )
goto fail;
--
2.55.0
next prev parent reply other threads:[~2026-09-02 9:44 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 9:43 [PATCH v2 00/14] x86: Address Space Isolation, part 2: asi= option and per-vCPU page tables George Dunlap
2026-09-02 9:43 ` [PATCH v2 01/14] x86/domain_page: introduce IRQs-off variants of {,un}map_domain_page() George Dunlap
2026-09-03 14:07 ` Jan Beulich
2026-09-03 19:56 ` George Dunlap
2026-09-02 9:43 ` [PATCH v2 02/14] x86/mm: introduce populate_perdomain_mapping() George Dunlap
2026-09-03 15:57 ` Jan Beulich
2026-09-03 21:27 ` George Dunlap
2026-09-04 5:58 ` Jan Beulich
2026-09-04 5:47 ` Jan Beulich
2026-09-02 9:43 ` [PATCH v2 03/14] x86/pv: use populate_perdomain_mapping() to map the Xen GDT George Dunlap
2026-09-03 16:11 ` Jan Beulich
2026-09-03 22:35 ` George Dunlap
2026-09-04 6:00 ` Jan Beulich
2026-09-04 6:54 ` Jürgen Groß
2026-09-04 8:06 ` George Dunlap
2026-09-04 8:29 ` Jan Beulich
2026-09-04 8:50 ` George Dunlap
2026-09-04 10:11 ` Jan Beulich
2026-09-04 10:34 ` Roger Pau Monné
2026-09-07 13:58 ` George Dunlap
2026-09-02 9:43 ` [PATCH v2 04/14] x86/pv: set/clear guest GDT mappings using populate_perdomain_mapping() George Dunlap
2026-09-07 12:50 ` Jan Beulich
2026-09-07 13:51 ` George Dunlap
2026-09-07 14:57 ` Jan Beulich
2026-09-02 9:43 ` [PATCH v2 05/14] x86/pv: update guest LDT mappings using {populate,destroy}_perdomain_mapping() George Dunlap
2026-09-07 16:06 ` Jan Beulich
2026-09-09 19:29 ` George Dunlap
2026-09-02 9:43 ` George Dunlap [this message]
2026-09-08 14:29 ` [PATCH v2 06/14] x86/pv: remove stashing of GDT/LDT L1 page-tables Jan Beulich
2026-09-02 9:43 ` [PATCH v2 07/14] x86/mm: simplify create_perdomain_mapping() interface George Dunlap
2026-09-08 14:39 ` Jan Beulich
2026-09-02 9:43 ` [PATCH v2 08/14] x86/mm: purge unneeded destroy_perdomain_mapping() George Dunlap
2026-09-08 15:03 ` Jan Beulich
2026-09-02 9:43 ` [PATCH v2 09/14] x86/mm: prepare destroy_perdomain_mapping() for per-vCPU perdomain areas George Dunlap
2026-09-08 15:36 ` Jan Beulich
2026-09-10 11:38 ` George Dunlap
2026-09-10 11:54 ` Jan Beulich
2026-09-02 9:43 ` [PATCH v2 10/14] x86/domain_page: drop redundant create_perdomain_mapping() call George Dunlap
2026-09-08 15:55 ` Jan Beulich
2026-09-10 11:52 ` George Dunlap
2026-09-02 9:43 ` [PATCH v2 11/14] x86/mm: prepare create_perdomain_mapping() for per-vCPU perdomain areas George Dunlap
2026-09-02 9:43 ` [PATCH v2 12/14] x86/spec-ctrl: introduce Address Space Isolation command line option George Dunlap
2026-09-02 9:43 ` [PATCH v2 13/14] x86/pv: clear the XPTI root_pgt per-domain slot on context-switch out George Dunlap
2026-09-02 9:43 ` [PATCH v2 14/14] x86/mm: introduce per-vCPU L3 page-table George Dunlap
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=20260901-asi-part2-6-ecc269f268b7@xenproject.org \
--to=dunlapg@umich.edu \
--cc=agarciav@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=gwd@xenproject.org \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--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.