Skip to content

xen/mm: Host-side integration test environment for page_alloc.c

Bernhard Kaindl xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

1. Refactored the test environment for minimalism:
- Improved separation of concerns.
- Moved extensions to later patch series.
- Simplified code with targeted assertions and concise comments.
2. Fixed file names to avoid underscores.
3. Updated include guards to comply with CODING_STYLE.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tools/tests/alloc: Add Page Allocator Test Environmenttools/tests/Makefile tools/tests/alloc/.gitignore tools/tests/alloc/Makefile +8 more+1411 -00 replies
2/4tools/tests/alloc: Add integration test suite to for NUMA memory claimstools/tests/alloc/test-claims-basic.c tools/tests/alloc/test-claims-numa-redeem.c+280 -00 replies
3/4tools/tests/alloc: Add tests for offlining with claims presenttools/tests/alloc/test-offlining-claims.c+75 -00 replies
4/4xen/mm: Recall claims when offlining pages if neededtools/tests/alloc/test-offlining-claims.c xen/common/page_alloc.c+42 -41 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] xen/mm: Host-side integration test environment for page_alloc.c

Hi all,

This patch series introduces a host-side integration test environment for Xen's page allocator in xen/common/page_alloc.c, reduced in size by 60% from 2257 to 1411 new lines with v2.

Using this environment, it also introduces integration tests for claims, including NUMA-aware claim sets, complementing the functional system tests submitted as part of the NUMA-aware claims v6 series.

The claim tests verify the page allocator's behaviour with multi-node claim sets in scenarios that are easier to isolate and validate using a synthetic Xen heap and domain state, offering full control and visibility into claim states as claims are made and redeemed during heap allocation.

For these tests, this series depends on the NUMA claims v6 series, which introduced NUMA-aware claim sets:

[PATCH v6 0/7] xen/mm: Introduce NUMA-aware claim sets for domains
https://lists.xen.org/archives/html/xen-devel/2026-04/msg00587.html
https://patchwork.kernel.org/project/xen-devel/list/?series=1081139

Its design is described in this document:

[PATCH v2] docs: Draft Design Document for NUMA-aware claim sets
https://lists.xen.org/archives/html/xen-devel/2026-04/msg00569.html
https://patchwork.kernel.org/project/xen-devel/list/?series=1081047

Patch summary:

1. tools/tests/alloc: Add a test environment for the page allocator
2. tools/tests/alloc: Add integration tests for claims and claim sets
3. tools/tests/alloc: Add tests for offlining with claims present
4. xen/mm: Recall claims when offlining pages if needed

Thanks,

Bernhard Kaindl

---
Changes since v1:
1. Refactored the test environment for minimalism:
- Improved separation of concerns.
- Moved extensions to later patch series.
- Simplified code with targeted assertions and concise comments.
2. Fixed file names to avoid underscores.
3. Updated include guards to comply with CODING_STYLE.

---
PS: The bug fixed in the last commit also affects the global claims in Xen master when offlining pages.

While offlining has known limitations, the bug fixed in this series also affects global claims in Xen master when pages are offlined. I will submit a follow-up series to address offlining itself. In the meantime, this test framework enables targeted testing on a synthetic Xen heap and simplifies validation by letting the tests observe heap-state changes during offlining.

Bernhard Kaindl (4):
tools/tests/alloc: Add Page Allocator Test Environment tools/tests/alloc: Add integration test suite to for NUMA memory
claims
tools/tests/alloc: Add tests for offlining with claims present xen/mm: Recall claims when offlining pages if needed

 tools/tests/Makefile                        |   1 +
 tools/tests/alloc/.gitignore                |   7 +
 tools/tests/alloc/Makefile                  | 141 +++++++
 tools/tests/alloc/README.rst                |  98 +++++
 tools/tests/alloc/check-asserts.h           | 225 +++++++++++
 tools/tests/alloc/harness.h                 |  57 +++
 tools/tests/alloc/hypervisor-macros.h       |  95 +++++
 tools/tests/alloc/libtest-page-alloc.h      | 145 +++++++
 tools/tests/alloc/mock-page-list.h          | 167 ++++++++
 tools/tests/alloc/page-alloc-shim.h         | 411 ++++++++++++++++++++
 tools/tests/alloc/page-alloc-wrapper.h      |  64 +++
 tools/tests/alloc/test-claims-basic.c       | 108 +++++
 tools/tests/alloc/test-claims-numa-redeem.c | 172 ++++++++
 tools/tests/alloc/test-offlining-claims.c   |  71 ++++
 xen/common/page_alloc.c                     |  42 ++
 15 files changed, 1804 insertions(+)
 create mode 100644 tools/tests/alloc/.gitignore
 create mode 100644 tools/tests/alloc/Makefile
 create mode 100644 tools/tests/alloc/README.rst
 create mode 100644 tools/tests/alloc/check-asserts.h
 create mode 100644 tools/tests/alloc/harness.h
 create mode 100644 tools/tests/alloc/hypervisor-macros.h
 create mode 100644 tools/tests/alloc/libtest-page-alloc.h
 create mode 100644 tools/tests/alloc/mock-page-list.h
 create mode 100644 tools/tests/alloc/page-alloc-shim.h
 create mode 100644 tools/tests/alloc/page-alloc-wrapper.h
 create mode 100644 tools/tests/alloc/test-claims-basic.c
 create mode 100644 tools/tests/alloc/test-claims-numa-redeem.c
 create mode 100644 tools/tests/alloc/test-offlining-claims.c
Signature · 1 line
2.39.5