[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 00/65] ASI: HVM, functionally complete


  • To: George Dunlap <gwd@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Date: Thu, 3 Dec 2026 18:00:38 +0100
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Autocrypt: addr=teddy.astie@xxxxxxxxxx; keydata= xsDNBGn5sK8BDACuzSrrTjpVf4ay06OYB6yY0J1PqKffihoNMtrQRZjAHxoAPC7LTBVHV/XO Zw5HJc+9R71z1JV+iYg6z3jPziGKzX8Fj3ZXlzJPmpf1PuETH3KdbvtJT4ny+OGntnJntUoR KRPhTirr6yNeBk/637O3CQXjtqFUPZnko8OI/o1yawIBhJJAWicutjkkUgd28Bh6HV9EIumH tCBgn5/1A/fpm9624MMgYLsA8qjC4XsoovQvFCaO8HEhvfzrrTZHjn/nPeB9SigxIxXW8YaT VqMdqul07o72m3eA2mf+LMu9a04FX/d4wbxBLtELm+1jIrbtyaFZEMOLv/haSiS/Lj3btJH/ EoucejoZ5SH49ksmVAmKOLktOaTQ8b2gEvP7iaKiIiszCCtOSRohr+2GvDsDeLvVZnlR3I+S PhHar7TPKjFz0G3DPNolyjXywNqOAMpomSPi8lSwjAFsxOtQbcck/qRGRSNk4DAmH70pA+89 MXfQXZ3qt1Q01B1+sU0I8xsAEQEAAc0kVGVkZHkgQXN0aWUgPHRlZGR5LmFzdGllQHZhdGVz LnRlY2g+wsENBBMBCAA3FiEEGAIew9LzHY3pdrqtZg+p0QLLz9AFAmn5sK8FCQWjmoACGwME CwkIBwUVCAkKCwUWAgMBAAAKCRBmD6nRAsvP0ID6DACGOktArFbLKHNzuyOVCskwfUZPla6Z pd3GZ8r61SrAKePI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Lz9DncQwAg76IehTemLIfrB8T9WIBZrI4kUV7G7a4rjiVoUiHYN5QwhnbZnsa JDlt+Ezoqy/510eo2bCSzvW5xXYPgyjcuOPwgQo1Qp764QxyX6rld2f2RcWkDuBHun55ZWXj by8o21ginPRwruBVYY5rVf3DV1iBu4NurUeHtyFk/dS0XTOQi2wVUb17sW/+ybCEokdVacZG zOqP/OmwHrF8ylXlXnhQq6e3r+J+T8fuoGJelm/CJiMwyP6cEWE8sxVqX/iqwjwUYkuOCpE+ lOWSvdNHgoEkWR0RXBPQjnGmLKbfTl/QDXLk6NP2/r9uxm2HL6Ei3QJKSEdrp+XZaVnk/Off O485NOTKwGOxyWb006cTMh53xPkAJFQu4Tvdj+odsHz88jqw5wfPG0BYWx0I/FspYj7N9kZR 8ULR9nX0LvpzJ/kB4NgHIUt8YtIL6ZSfM2dbF7fKzvx1UqFfvozJZwFzfEieJLXa4nlGgR6D x9fhaZEsniw8/bYgC3igkk5YJiOa
  • Delivery-date: Thu, 03 Dec 2026 17:00:49 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Le 02/12/2026 à 12:20, George Dunlap a écrit :
This is a functionally complete series to implement address space
isolation.  It does not include any low-hanging optimizations.

The approach is the same since v3: Start by focusing on just getting
ASI and intra-domain isolation for HVM guests.  PV support is added
where it's simple to do.

The main difference in v8:

   Two patches from v7 have been checked in, and comments on 3/ have
   been addressed.

   Include PH2, allowing HVM domains with per-vCPU areas to map only
   the stack of the pCPU on which they're running.

Included in this version:

   Additional safety precautions for a previously posted patch (01).

- X1 (02-06): Add a vCPU state window to the per-domain area (both for
   PV and HVM).  Move SVM VMCB structures and VMX guest MSR areas into
   it.

- X2 (07-10): Move every vCPU's saved register frame (PV and HVM), and
   the HVM emulator's operand caches, into the vCPU state window.  10
   also clears the vCPU's copy of an emulated I/O request once it has
   been consumed.

- X3 (11-13): Introduce map_domain_pages(), which maps several pages
   in the calling vCPU's per-domain area, and use it in place of vmap()
   for the shadow code's cross-page emulated writes and the HVM
   emulator's multi-frame accesses.

- X4 (14-20): Move the guest XSAVE areas into the vCPU state window.

- VH (21-29): Give each vCPU of an HVM guest its own per-domain area
   and its own mapcache.

- DV (30-38): Maintain two "views" of the directmap: A full directmap,
   and a sparse directmap.  The full directmap is what we have now; the
   sparse directmap removes non-xenheap heap memory.

- PH1 (39-49): Preparation for per-pCPU stacks,
   modifying rendezvous and call-function IPIs to not use the stack.

- PH2 (50-65), new in this version: Moving pCPU stacks into the
   perdomain area, allocating them from the domheap

Implemented but not yet posted:

- O: A number of optimizations to improve performance

The functionality of 01-38 (X, VH, and DV) is the bare minimum that
XenServer needs to make it into 4.23.

v7 can be found here:

https://lore.kernel.org/xen-devel/20261119-asi-hvm-v7-0-6551b6d5c879@xxxxxxxxxxxxxx/

v8 is based on staging 091d3c200281.  v7's 01-02 are in staging
(9f9e2532c20d, ff9c79ec370c); v7's 03-50 are v8's 02-49.

Changes in v8:

- 01 is new, after Andrew's reply to v7's 01:
   populate_perdomain_mapping() asserts that _PAGE_AVAIL0 is clear in the
   flags it is given, and masks it out.

- Following Jan's review of v7's 03: 02 asserts v == current in
   svm_guest_x86_mode(), gives svm_set_tsc_offset() one exit path, and
   maps the VMCB through pointers-to-const where it only reads it; 04
   maps it through a pointer-to-const too.

- "No functional change" is gone from four messages: 07 and 33 drop it,
   18 says that the new error paths cannot be taken yet, and 44 says what
   does change (the smp_rmb() on Arm).

- PH2 (50-65) is new.

Some more details:

10 also limits exposure of ioreq state: Completely isolating each
vCPU's I/O requests from being read by other vCPUs of the same domain
is complicated; as a mitigation, this patch clears the emulated I/O
request once it has been consumed, reducing the window available to
read the payload.

14-17 are Alejandro's patches from "x86: Address Space Isolation FPU
preparations" (v3, January 2025), revived.

State is moved from the xenheap into the per-domain area for both ASI
and non-ASI domains: VMCB, MSR List, vCPU register frame, and
XSAVE/FPU areas.  Same is true for users of map_domain_pages.  This
protects non-ASI domains from ASI domains.

One key thing to get feedback on, still open from v6, is the question
below 20's "---": xstate_init() now panics on hardware whose XSAVE
area needs more than the three pages reserved for it in the vCPU state
window.  No current hardware does.  Should it do more, for instance
size the reservation from the size found at boot, or fall back to
xenheap areas on such hardware?

In PH1, the data that rendezvous and call-function IPIs hand to other
CPUs moves off the initiating CPU's stack.  44 adds by-value payloads
for call-function IPIs, which 46-48 use, and 49 asserts that a payload
passed by pointer is not on the stack.

In PH2, with the new cpu-stack sub-option of asi= (54), each pCPU's
stack is mapped at an address of its own in the per-domain area, and
the pCPU runs on it there (58-59); an HVM vCPU's page-tables then map
only the stack of the pCPU it runs on (60), and the stacks come from
the domain heap, which the sparse directmap does not map (61).  62
zeroes the stack on context switch.  54, 56-59 and 62 are Roger's, from
"x86: adventures in Address Space Isolation" (v2, January 2025),
reworked HVM-first; their changelogs say what changed since.  50 fixes
a bug in staging under FRED and applies on its own; 63-65 add checks
that could be dropped.

Note that at the end of this series, PV guests can be given the sparse
directmap; this isolates them from other domains, but doesn't isolate
vCPUs within a domain.  With this series, a PV domain's register
frames and XSAVE areas are also out of reach of domains on the sparse
directmap, whether or not the PV domain itself is on it.

Testing of v8, on the series as posted (staging 091d3c200281):

- Builds of xen/ at each of the 65 patches, in seven configurations:
   debug and release, !HVM, !PV, the PV shim, and shadow paging, debug
   and release; from 32, which adds CONFIG_SPARSE_DIRECTMAP, also with
   it, debug and release.  No warnings or errors beyond those staging
   itself gives.  arm64 builds of 65, debug and release.

- On an Intel NUC: whole-tree builds (xen, tools, stubdom, docs) at
   each of the 65, with tools/tests/vpci run.

- QEMU (TCG) boots at each of the 65: PV dom0s without asi=, with
   asi=1, with asi=1,dom0=0 and with xpti=1; PVH dom0s without asi=,
   with asi=1 and with asi=1,dom0=0, on HAP and on shadow; and XTF's
   32-bit PV and 32-bit HVM selftests as dom0 (asi= arrives with 22).
   Each boot gets to dom0's userspace (or the test's result) with no
   crash, assertion or WARN() in Xen's log.

- On the NUC: boots of 65 with asi=1.  In each, a 64-bit PV guest is
   live-migrated to the same host in shadow log-dirty mode under a
   verified workload, with an HVM guest beside it, and XTF's full suite,
   32-bit PV included, passes twice (the usual four skips).

- GitLab CI
   https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/3142304689

A dependency graph of the above functionality can be found here:

https://xenbits.xenproject.org/people/gdunlap/asi-series-deps.html

(...)


base-commit: 091d3c200281ea44846ccdf1e5d39985321c643e

Tested-by: Teddy Astie <teddy.astie@xxxxxxxxxx>

Tested various workloads on both Intel and AMD hardware with both asi=0 and asi=1 with PV Dom0 and PV (XTF) and PVH DomUs; with various tests (save/restore HVM, stress-testing, ...).
I haven't tested asi-specific properties though (side channels, ...).

So far, everything survived, and no issue in sight.

Teddy

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.