From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: xen-devel@lists.xenproject.org
Cc: "Alejandro Vallejo" <alejandro.vallejo@cloud.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Juergen Gross" <jgross@suse.com>
Subject: [PATCH v7 00/10] x86: Expose consistent topology to guests
Date: Mon, 21 Oct 2024 16:45:50 +0100 [thread overview]
Message-ID: <20241021154600.11745-1-alejandro.vallejo@cloud.com> (raw)
Current topology handling is close to non-existent. As things stand, APIC IDs
are allocated through the apic_id=vcpu_id*2 relation without giving any hints
to the OS on how to parse the x2APIC ID of a given CPU and assuming the guest
will assume 2 threads per core.
This series involves bringing x2APIC IDs into the migration stream, so older
guests keep operating as they used to and enhancing Xen+toolstack so new guests
get topology information consistent with their x2APIC IDs. As a side effect of
this, x2APIC IDs are now packed and don't have (unless under a pathological
case) gaps.
Further work ought to allow combining this topology configurations with
gang-scheduling of guest hyperthreads into affine physical hyperthreads. For
the time being it purposefully keeps the configuration of "1 socket" + "1
thread per core" + "1 core per vCPU".
===
Other minor changes highlighted in each individual patch.
Hypervisor prerequisites:
patch 1: lib/x86: Bump max basic leaf in {pv,hvm}_max_policy
* Conceptually similar to v6/patch1 ("Relax checks about policy
compatibility"), but operates on the max policies instead.
patch 2: xen/x86: Add initial x2APIC ID to the per-vLAPIC save area
patch 3: xen/x86: Add supporting code for uploading LAPIC contexts during
domain create
hvmloader prerequisites
patch 4: tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves
Toolstack prerequisites:
patch 5: tools/libacpi: Use LUT of APIC IDs rather than function pointer
patch 6: tools/libguest: Always set vCPU context in vcpu_hvm()
No functional changes:
patch 7: xen/lib: Add topology generator for x86
* Tweaked the behaviour of the cache leaves on overflow and added stronger
checks.
patch 8: xen/x86: Derive topologically correct x2APIC IDs from the policy
Final toolstack/xen stitching:
patch 9: tools/libguest: Set distinct x2APIC IDs for each vCPU
patch 10: xen/x86: Synthesise domain topologies
v6: https://lore.kernel.org/xen-devel/20241001123807.605-1-alejandro.vallejo@cloud.com
v5: https://lore.kernel.org/xen-devel/20240808134251.29995-1-alejandro.vallejo@cloud.com/
v4: https://lore.kernel.org/xen-devel/cover.1719416329.git.alejandro.vallejo@cloud.com/
v3: https://lore.kernel.org/xen-devel/cover.1716976271.git.alejandro.vallejo@cloud.com/
v2: https://lore.kernel.org/xen-devel/cover.1715102098.git.alejandro.vallejo@cloud.com/
v1: https://lore.kernel.org/xen-devel/20240109153834.4192-1-alejandro.vallejo@cloud.com/
Alejandro Vallejo (10):
lib/x86: Bump max basic leaf in {pv,hvm}_max_policy
xen/x86: Add initial x2APIC ID to the per-vLAPIC save area
xen/x86: Add supporting code for uploading LAPIC contexts during
domain create
tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves
tools/libacpi: Use LUT of APIC IDs rather than function pointer
tools/libguest: Always set vCPU context in vcpu_hvm()
xen/lib: Add topology generator for x86
xen/x86: Derive topologically correct x2APIC IDs from the policy
tools/libguest: Set distinct x2APIC IDs for each vCPU
tools/x86: Synthesise domain topologies
tools/firmware/hvmloader/config.h | 5 +-
tools/firmware/hvmloader/hvmloader.c | 6 +-
tools/firmware/hvmloader/mp_tables.c | 4 +-
tools/firmware/hvmloader/smp.c | 57 +++++--
tools/firmware/hvmloader/util.c | 7 +-
tools/include/xen-tools/common-macros.h | 5 +
tools/include/xenguest.h | 8 +
tools/libacpi/build.c | 6 +-
tools/libacpi/libacpi.h | 2 +-
tools/libs/guest/xg_cpuid_x86.c | 29 +++-
tools/libs/guest/xg_dom_x86.c | 93 +++++++----
tools/libs/light/libxl_dom.c | 25 +++
tools/libs/light/libxl_x86_acpi.c | 7 +-
tools/tests/cpu-policy/test-cpu-policy.c | 201 +++++++++++++++++++++++
xen/arch/x86/cpu-policy.c | 15 +-
xen/arch/x86/cpuid.c | 18 +-
xen/arch/x86/hvm/vlapic.c | 42 ++++-
xen/arch/x86/include/asm/hvm/vlapic.h | 1 +
xen/include/public/arch-x86/hvm/save.h | 2 +
xen/include/xen/lib/x86/cpu-policy.h | 27 +++
xen/lib/x86/policy.c | 169 +++++++++++++++++++
xen/lib/x86/private.h | 4 +
22 files changed, 649 insertions(+), 84 deletions(-)
base-commit: 081683ea578da56dd20b9dc22a64d03c893b47ba
--
2.47.0
next reply other threads:[~2024-10-21 15:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 15:45 Alejandro Vallejo [this message]
2024-10-21 15:45 ` [PATCH v7 01/10] lib/x86: Bump max basic leaf in {pv,hvm}_max_policy Alejandro Vallejo
2024-10-29 17:57 ` Andrew Cooper
2024-10-21 15:45 ` [PATCH v7 02/10] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area Alejandro Vallejo
2024-10-29 20:30 ` Andrew Cooper
2024-10-30 6:37 ` Jan Beulich
2024-10-30 12:03 ` Alejandro Vallejo
2024-10-30 12:05 ` Jan Beulich
2024-10-30 12:25 ` Andrew Cooper
2024-10-30 12:00 ` Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 03/10] xen/x86: Add supporting code for uploading LAPIC contexts during domain create Alejandro Vallejo
2024-12-02 9:27 ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 04/10] tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves Alejandro Vallejo
2024-10-30 11:31 ` Andrew Cooper
2024-10-30 12:04 ` Jan Beulich
2024-11-11 11:20 ` Alejandro Vallejo
2024-11-11 12:07 ` Jan Beulich
2024-12-02 9:36 ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 05/10] tools/libacpi: Use LUT of APIC IDs rather than function pointer Alejandro Vallejo
2024-10-30 14:56 ` Andrew Cooper
2024-12-02 9:40 ` Jan Beulich
2024-10-21 15:45 ` [PATCH v7 06/10] tools/libguest: Always set vCPU context in vcpu_hvm() Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 07/10] xen/lib: Add topology generator for x86 Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 08/10] xen/x86: Derive topologically correct x2APIC IDs from the policy Alejandro Vallejo
2024-10-21 15:45 ` [PATCH v7 09/10] tools/libguest: Set distinct x2APIC IDs for each vCPU Alejandro Vallejo
2024-10-21 15:46 ` [PATCH v7 10/10] tools/x86: Synthesise domain topologies Alejandro Vallejo
2024-12-02 9:18 ` Jan Beulich
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=20241021154600.11745-1-alejandro.vallejo@cloud.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=roger.pau@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 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.