All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Kaindl <bernhard.kaindl@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: "Bernhard Kaindl" <bernhard.kaindl@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Christian Lindig" <christian.lindig@citrix.com>,
	"David Scott" <dave@recoil.org>
Subject: [PATCH v4 0/10] xen: Add NUMA-aware memory claims for domains
Date: Thu, 26 Feb 2026 14:29:14 +0000	[thread overview]
Message-ID: <cover.1772098423.git.bernhard.kaindl@citrix.com> (raw)


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



             reply	other threads:[~2026-02-26 14:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 14:29 Bernhard Kaindl [this message]
2026-02-26 14:29 ` [PATCH v4 01/10] xen/page_alloc: Extract code for consuming claims into inline function Bernhard Kaindl
2026-03-04 16:20   ` Jan Beulich
2026-03-04 18:04     ` Bernhard Kaindl
2026-03-05  8:21   ` Roger Pau Monné
2026-02-26 14:29 ` [PATCH v4 02/10] xen/page_alloc: Optimize getting per-NUMA-node free page counts Bernhard Kaindl
2026-03-04 16:31   ` Jan Beulich
2026-03-04 18:21     ` Bernhard Kaindl
2026-03-05  7:22       ` Jan Beulich
2026-02-26 14:29 ` [PATCH v4 03/10] xen/page_alloc: Implement NUMA-node-specific claims Bernhard Kaindl
2026-03-05 10:53   ` Jan Beulich
2026-03-05 13:12     ` Bernhard Kaindl
2026-03-05 13:36       ` Jan Beulich
2026-03-05 14:54         ` Bernhard Kaindl
2026-03-05 17:00           ` Jan Beulich
2026-02-26 14:29 ` [PATCH v4 04/10] xen/page_alloc: Consolidate per-node counters into avail[] array Bernhard Kaindl
2026-02-26 14:29 ` [PATCH v4 05/10] xen/domain: Add DOMCTL handler for claiming memory with NUMA awareness Bernhard Kaindl
2026-02-26 21:19   ` Teddy Astie
2026-02-26 23:16     ` Bernhard Kaindl
2026-02-27  9:39       ` Teddy Astie
2026-02-27 18:16         ` Bernhard Kaindl
2026-03-05 11:31   ` Jan Beulich
2026-04-14 15:17     ` Bernhard Kaindl
2026-04-16  6:46       ` Jan Beulich
2026-04-16 23:48         ` Bernhard Kaindl
2026-03-05 12:38   ` Roger Pau Monné
2026-03-05 12:44   ` Jan Beulich
2026-02-26 14:29 ` [PATCH v4 06/10] xsm/flask: Add XEN_DOMCTL_claim_memory to flask Bernhard Kaindl
2026-03-05 13:42   ` Jan Beulich
2026-02-26 14:29 ` [PATCH v4 07/10] tools/lib/ctrl/xc: Add xc_domain_claim_memory() to libxenctrl Bernhard Kaindl
2026-02-26 14:29 ` [PATCH v4 08/10] tools/ocaml/libs/xc: add OCaml domain_claim_memory binding Bernhard Kaindl
2026-02-26 14:29 ` [PATCH v4 09/10] tools/tests: Update the claims test to test claim_memory hypercall Bernhard Kaindl
2026-02-26 14:29 ` [PATCH v4 10/10] docs/guest-guide: document the memory claim hypercalls Bernhard Kaindl
2026-03-04 16:07 ` [PATCH v4 0/10] xen: Add NUMA-aware memory claims for domains Jan Beulich
2026-03-04 17:27   ` Bernhard Kaindl

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=cover.1772098423.git.bernhard.kaindl@citrix.com \
    --to=bernhard.kaindl@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --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.