Skip to content

x86: Make MAX_ALTP2M configurable

Petr Beneš xen-devel 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest9 patches 18 repliesIn review
  2. v510 patches 18 repliesSuperseded
  3. v46 patches 6 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v36 patches2 repliesSuperseded
v27 patches10 repliesSuperseded
v17 patches8 repliesSuperseded

Changes in v6 from the cover letter

- Reverted "Introduction of accessor functions for altp2m arrays and refactoring the code to use them."
- Reason is minimizing the code changes, and save the code consistency.
- I've addressed (hopefully all) issues with long lines and mismatched _nospec replacements mentioned in previous reviews.
- Removed "struct domain *d" from altp2m_vcpu_initialise/destroy.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9tools/ocaml: Fix mixed tabs/spacestools/ocaml/libs/xc/xenctrl_stubs.c+9 -90 replies
2/9tools/ocaml: Add missing ocaml bindings for altp2m_optstools/ocaml/libs/xc/xenctrl.ml tools/ocaml/libs/xc/xenctrl.mli tools/ocaml/libs/xc/xenctrl_stubs.c+8 -30 replies
3/9xen: Refactor altp2m options into a structured formattools/libs/light/libxl_create.c tools/ocaml/libs/xc/xenctrl_stubs.c xen/arch/arm/domain.c +3 more+13 -98 replies
4/9tools/xl: Add altp2m_count parametertools/golang/xenlight/helpers.gen.go tools/golang/xenlight/types.gen.go tools/include/libxl.h +3 more+30 -01 reply
5/9docs/man: Add altp2m_count parameter to the xl.cfg manualdocs/man/xl.cfg.5.pod.in+14 -01 reply
6/9xen: Make the maximum number of altp2m views configurable for x86xen/arch/arm/domain.c xen/arch/x86/domain.c xen/arch/x86/hvm/hvm.c +13 more+121 -585 replies
7/9tools/libxl: Activate the altp2m_count featuretools/libs/light/libxl_create.c+4 -01 reply
8/9xen/x86: Disallow creating domains with altp2m enabled and altp2m.nr == 0xen/arch/x86/domain.c+3 -20 replies
9/9tools/ocaml: Add altp2m_count parametertools/ocaml/libs/xc/xenctrl.ml tools/ocaml/libs/xc/xenctrl.mli tools/ocaml/libs/xc/xenctrl_stubs.c+17 -40 replies

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchChristian LindigJan BeulichJulien GrallAnthony PERARD
1/9A-b
2/9A-b
3/9R-b A-b A-b
4/9
5/9A-b
6/9
7/9A-b
8/9A-b
9/9A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v6 thread

Cover letter [PATCH for-4.19? v6 0/9] x86: Make MAX_ALTP2M configurable

From: Petr Beneš <[email protected]>

This series introduces the ability to configure the maximum number of altp2m tables during domain creation. Previously, the limits were hardcoded to a maximum of 10. This change allows for greater flexibility in environments that require more or fewer altp2m views.

This enhancement is particularly relevant for users leveraging Xen's features for virtual machine introspection.

Changes since v5:
- Reverted "Introduction of accessor functions for altp2m arrays and refactoring the code to use them."
- Reason is minimizing the code changes, and save the code consistency.
- I've addressed (hopefully all) issues with long lines and mismatched _nospec replacements mentioned in previous reviews.
- Removed "struct domain *d" from altp2m_vcpu_initialise/destroy.

Changes since v4:
- Rebased on top of staging (applying Roger's changes).
- Fix mixed tabs/spaces in xenctrl_stubs.c.
- Add missing OCaml bindings for altp2m_opts.
- Substitute altp2m_opts into an unnamed structure. (This is a preparation for the next patch that will introduce the nr field.)
- altp2m.opts is then shortened to uint16_t and a new field altp2m.nr is added - also uint16_t. This value is then verified by libxl to not exceed the maximum uint16_t value.

This puts a hard limit to number of altp2m to 65535, which is enough, at least for the time being. Also, altp2m.opts currently uses only 2 bits. Therefore I believe this change is justified.
- Introduction of accessor functions for altp2m arrays and refactoring the code to use them.
- Added a check to arm/arch_sanitise_domain_config() to disallow creating domains with altp2m.nr != 0.
- Added dummy hvm_altp2m_supported() to avoid build errors when CONFIG_HVM is disabled.
- Finally, expose altp2m_count to OCaml bindings (and verify both altp2m_opts and altp2m_count fit uint16_t).
- I also removed Christian Lindig from the Acked-by, since I think this change is significant enough to require a re-review.

Changes since v3:
- Rebased on top of staging (some functions were moved to altp2m.c).
- Re-added the array_index_nospec() where it was removed.

Changes since v2:
- Changed max_altp2m to nr_altp2m.
- Moved arch-dependent check from xen/common/domain.c to xen/arch/x86/domain.c.
- Replaced min(d->nr_altp2m, MAX_EPTP) occurences for just d->nr_altp2m.
- Replaced array_index_nospec(altp2m_idx, ...) for just altp2m_idx.
- Shortened long lines.
- Removed unnecessary comments in altp2m_vcpu_initialise/destroy.
- Moved nr_altp2m field after max_ fields in xen_domctl_createdomain.
- Removed the commit that adjusted the initial allocation of pages from 256 to 1024. This means that after these patches, technically, the nr_altp2m will be capped to (256 - 1 - vcpus - MAX_NESTEDP2M) instead of MAX_EPTP (512). Future work will be needed to fix this.

Petr Beneš (9):
tools/ocaml: Fix mixed tabs/spaces
tools/ocaml: Add missing ocaml bindings for altp2m_opts
xen: Refactor altp2m options into a structured format tools/xl: Add altp2m_count parameter
docs/man: Add altp2m_count parameter to the xl.cfg manual
xen: Make the maximum number of altp2m views configurable for x86 tools/libxl: Activate the altp2m_count feature
xen/x86: Disallow creating domains with altp2m enabled and altp2m.nr

    == 0

tools/ocaml: Add altp2m_count parameter

 docs/man/xl.cfg.5.pod.in             | 14 ++++++
 tools/golang/xenlight/helpers.gen.go |  2 +
 tools/golang/xenlight/types.gen.go   |  1 +
 tools/include/libxl.h                |  8 ++++
 tools/libs/light/libxl_create.c      | 19 +++++++--
 tools/libs/light/libxl_types.idl     |  1 +
 tools/ocaml/libs/xc/xenctrl.ml       |  2 +
 tools/ocaml/libs/xc/xenctrl.mli      |  2 +
 tools/ocaml/libs/xc/xenctrl_stubs.c  | 40 +++++++++++------
 tools/xl/xl_parse.c                  |  9 ++++
 xen/arch/arm/domain.c                |  2 +-
 xen/arch/x86/domain.c                | 45 +++++++++++++++----
 xen/arch/x86/hvm/hvm.c               | 10 ++++-
 xen/arch/x86/hvm/vmx/vmx.c           |  2 +-
 xen/arch/x86/include/asm/domain.h    |  9 ++--
 xen/arch/x86/include/asm/hvm/hvm.h   |  5 +++
 xen/arch/x86/include/asm/p2m.h       |  4 +-
 xen/arch/x86/mm/altp2m.c             | 64 ++++++++++++++++++----------
 xen/arch/x86/mm/hap/hap.c            |  6 +--
 xen/arch/x86/mm/mem_access.c         | 14 +++---
 xen/arch/x86/mm/mem_sharing.c        |  2 +-
 xen/arch/x86/mm/p2m-ept.c            |  7 +--
 xen/arch/x86/mm/p2m.c                |  8 ++--
 xen/common/domain.c                  |  1 +
 xen/include/public/domctl.h          |  7 ++-
 xen/include/xen/sched.h              |  2 +
 26 files changed, 210 insertions(+), 76 deletions(-)

--
2.34.1