[PATCH for-4.19? v3 0/6] x86: Make MAX_ALTP2M configurable

Petr Beneš posted 6 patches 6 months, 1 week ago
Failed in applying to current master (apply log)
There is a newer version of this series
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      | 10 ++++
tools/libs/light/libxl_types.idl     |  1 +
tools/ocaml/libs/xc/xenctrl.ml       |  1 +
tools/ocaml/libs/xc/xenctrl.mli      |  1 +
tools/ocaml/libs/xc/xenctrl_stubs.c  | 11 ++--
tools/xl/xl_parse.c                  |  4 ++
xen/arch/x86/domain.c                | 12 +++++
xen/arch/x86/hvm/hvm.c               |  8 ++-
xen/arch/x86/hvm/vmx/vmx.c           |  2 +-
xen/arch/x86/include/asm/domain.h    |  7 ++-
xen/arch/x86/include/asm/p2m.h       |  4 +-
xen/arch/x86/mm/altp2m.c             | 23 +++++++-
xen/arch/x86/mm/hap/hap.c            |  6 +--
xen/arch/x86/mm/mem_access.c         | 23 ++++----
xen/arch/x86/mm/mem_sharing.c        |  2 +-
xen/arch/x86/mm/p2m-ept.c            | 10 ++--
xen/arch/x86/mm/p2m.c                | 80 ++++++++++++++--------------
xen/common/domain.c                  |  1 +
xen/include/public/domctl.h          |  5 +-
xen/include/xen/sched.h              |  2 +
24 files changed, 161 insertions(+), 77 deletions(-)
[PATCH for-4.19? v3 0/6] x86: Make MAX_ALTP2M configurable
Posted by Petr Beneš 6 months, 1 week ago
From: Petr Beneš <w1benny@gmail.com>

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.

Adjustments include:
- "Prepare" commits with style changes.
- Adding a new `altp2m_count` parameter to xl.
- Adding a new `altp2m_count` parameter to the OCaml bindings.
- Adding a new `altp2m_count` parameter to the xl.cfg manual.
- Adding a new `nr_altp2m` field into the `xen_domctl_createdomain`, which,
  after sanity checks, is stored in newly introduced `nr_altp2m` field of
  `struct domain` - leaving room for other architectures to implement the
  altp2m feature.
- Replacing MAX_ALTP2M macro occurrences with `domain->nr_altp2m`.

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

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š (6):
  x86/p2m: Add braces for better code clarity
  tools/xl: Add altp2m_count parameter
  docs/man: Add altp2m_count parameter to the xl.cfg manual
  x86: Make the maximum number of altp2m views configurable
  tools/libxl: Activate the altp2m_count feature
  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      | 10 ++++
 tools/libs/light/libxl_types.idl     |  1 +
 tools/ocaml/libs/xc/xenctrl.ml       |  1 +
 tools/ocaml/libs/xc/xenctrl.mli      |  1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c  | 11 ++--
 tools/xl/xl_parse.c                  |  4 ++
 xen/arch/x86/domain.c                | 12 +++++
 xen/arch/x86/hvm/hvm.c               |  8 ++-
 xen/arch/x86/hvm/vmx/vmx.c           |  2 +-
 xen/arch/x86/include/asm/domain.h    |  7 ++-
 xen/arch/x86/include/asm/p2m.h       |  4 +-
 xen/arch/x86/mm/altp2m.c             | 23 +++++++-
 xen/arch/x86/mm/hap/hap.c            |  6 +--
 xen/arch/x86/mm/mem_access.c         | 23 ++++----
 xen/arch/x86/mm/mem_sharing.c        |  2 +-
 xen/arch/x86/mm/p2m-ept.c            | 10 ++--
 xen/arch/x86/mm/p2m.c                | 80 ++++++++++++++--------------
 xen/common/domain.c                  |  1 +
 xen/include/public/domctl.h          |  5 +-
 xen/include/xen/sched.h              |  2 +
 24 files changed, 161 insertions(+), 77 deletions(-)

--
2.34.1