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

[PATCH v4 0/10] xen: Add NUMA-aware memory claims for domains



This series introduces NUMA-aware memory claims. Xen allocates the claimed
memory only for allocations from domains with a claim for this memory.

The new hypercall API is designed to support staking claims on multiple NUMA
nodes for a domain. It provides a foundation that can be extended to support
multi-node claims without changing the hypercall API.

Patch Structure:

 1. xen/page_alloc:  Extract claim consumption on allocation into static inline
 2. xen/page_alloc:  Add per-node free page counts; make counters unsigned long
 3. xen/page_alloc:  Add the implementation of NUMA-node-specific claims
 4. xen/page_alloc:  Consolidate per-node counters into avail[node][maxzone+x]
                     Is optional: transparent, no functional change, not needed
 5. xen/domain:      Add the XEN_DOMCTL_claim_memory hypercall handler
 6. xsm/flask:       Add a Flask security policy for the new hypercall
 7. libs/ctrl/xc:    Add the libxenctrl API xc_domain_claim_memory()
 8. ocaml/libx/xc:   Add the OCaml binding for xc_domain_claim_memory()
 9. tools/tests:     Add testing per-node claims and claims protection
10. doc/guest-guide: Add comprehensive API documentation

The updated guest-guide is deployed here for reviewing the created output:
https://bernhardk-xen-review.readthedocs.io/v4.22-claims.v4/guest-guide/

Changes in v4:

- The logic for adjusting claimed pages on allocation has been completely
  reworked to align with recent upstream changes. (Roger Pau Monné)

- The check for node memory availability has been replaced with a corrected
  implementation. (Marcus Granado, Roger Pau Monné, Bernhard Kaindl)

- The new hypercall API patch has been refactored and split into separate
  patches for the DOMCTL, Flask policy, and libxenctrl implementation.

- Added initial tests and Sphinx documentation for the new API.

- With improvements and rebasing on upstream changes, this series has changed
  very much. Reviewing it as a whole is recommended over an incremental review.

Credits:

- Alejandro Vallejo developed the initial version
- Roger Pau Monné updated the implementation and upstreamed key improvements
- Marcus Granado contributed analysis and suggestions during development
- Bernhard Kaindl developed the new domctl API, extended tests and documentation
  and developed the refactored handler for consuming claims on allocation.

Comments and feedback welcome.

Bernhard Kaindl (10):
  xen/page_alloc: Extract code for consuming claims into inline function
  xen/page_alloc: Optimize getting per-NUMA-node free page counts
  xen/page_alloc: Implement NUMA-node-specific claims
  xen/page_alloc: Consolidate per-node counters into avail[] array
  xen/domain: Add DOMCTL handler for claiming memory with NUMA awareness
  xsm/flask: Add XEN_DOMCTL_claim_memory to flask
  tools/lib/ctrl/xc: Add xc_domain_claim_memory() to libxenctrl
  tools/ocaml/libs/xc: add OCaml domain_claim_memory binding
  tools/tests: Update the claims test to test claim_memory hypercall
  docs/guest-guide: document the memory claim hypercalls

 .readthedocs.yaml                             |  13 +-
 docs/conf.py                                  |   6 +-
 .../dom/DOMCTL_claim_memory-classes.mmd       |  51 ++++
 .../dom/DOMCTL_claim_memory-seqdia.mmd        |  23 ++
 .../dom/DOMCTL_claim_memory-workflow.mmd      |  23 ++
 docs/guest-guide/dom/DOMCTL_claim_memory.rst  | 125 ++++++++
 docs/guest-guide/dom/index.rst                |  14 +
 docs/guest-guide/index.rst                    |  23 ++
 docs/guest-guide/mem/XENMEM_claim_pages.rst   |  68 +++++
 docs/guest-guide/mem/index.rst                |  12 +
 docs/hypervisor-guide/index.rst               |   5 +
 docs/hypervisor-guide/mm/claims.rst           | 114 +++++++
 docs/hypervisor-guide/mm/index.rst            |  10 +
 tools/flask/policy/modules/dom0.te            |   1 +
 tools/flask/policy/modules/xen.if             |   1 +
 tools/include/xenctrl.h                       |   4 +
 tools/libs/ctrl/xc_domain.c                   |  27 ++
 tools/ocaml/libs/xc/xenctrl.ml                |  11 +
 tools/ocaml/libs/xc/xenctrl.mli               |  11 +
 tools/ocaml/libs/xc/xenctrl_stubs.c           |  43 +++
 tools/tests/mem-claim/test-mem-claim.c        | 277 ++++++++++++++++--
 xen/common/domain.c                           |  32 +-
 xen/common/domctl.c                           |   9 +
 xen/common/memory.c                           |   3 +-
 xen/common/page_alloc.c                       | 254 +++++++++++++---
 xen/include/public/domctl.h                   |  38 +++
 xen/include/xen/domain.h                      |   2 +
 xen/include/xen/mm.h                          |   4 +-
 xen/include/xen/sched.h                       |   1 +
 xen/xsm/flask/hooks.c                         |   3 +
 xen/xsm/flask/policy/access_vectors           |   2 +
 31 files changed, 1134 insertions(+), 76 deletions(-)
 create mode 100644 docs/guest-guide/dom/DOMCTL_claim_memory-classes.mmd
 create mode 100644 docs/guest-guide/dom/DOMCTL_claim_memory-seqdia.mmd
 create mode 100644 docs/guest-guide/dom/DOMCTL_claim_memory-workflow.mmd
 create mode 100644 docs/guest-guide/dom/DOMCTL_claim_memory.rst
 create mode 100644 docs/guest-guide/dom/index.rst
 create mode 100644 docs/guest-guide/mem/XENMEM_claim_pages.rst
 create mode 100644 docs/guest-guide/mem/index.rst
 create mode 100644 docs/hypervisor-guide/mm/claims.rst
 create mode 100644 docs/hypervisor-guide/mm/index.rst

-- 
2.39.5




 


Rackspace

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