mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] memblock tests: cover low-address allocations
@ 2026-09-09 23:55 Tianyi Chen
  2026-09-09 23:55 ` [PATCH v3 1/2] memblock tests: model the low allocation limit within dummy memory Tianyi Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tianyi Chen @ 2026-09-09 23:55 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, linux-mm, linux-kernel, hi

Model a low allocation limit within the memory registered by the simulator,
then exercise memblock_alloc_low() in both allocation directions.

Changes in v3:
- Describe the low limit and simulated RAM alignment directly in comments
  and README.
- Use Assisted-by: LLM in both patches.
- Start a separate thread for this revision.

The pointer casts remain unchanged. With BUILD=32, pointers are 32-bit and
phys_addr_t is 64-bit: the tested compiler sign-extends a direct cast, while
the conversion through uintptr_t zero-extends it. The direct casts also
introduce compiler warnings, so this revision preserves the existing
conversion behavior. There are no executable code changes from v2.

Validation with ASan and UBSan enabled:
- Default and 32BIT_PHYS_ADDR_T=1: 189 tests pass in each runtime mode.
- NUMA=1, 32BIT_PHYS_ADDR_T=1 with NUMA=1, and MEMBLOCK_DEBUG=1 with NUMA=1:
  272 tests pass in each runtime mode.
- Both ./main -v and ./main -v -m were run for those configurations.
- BUILD=32 builds without warnings from alloc_low_api.c. Its runtime still
  hits the pre-existing basic_api.c memblock_free_near_max_check assertion
  before reaching the low-allocation tests.

v2: https://lore.kernel.org/r/178874362959.1415955.18132997964995947947.memblock-v2-0@tychen.cc

Tianyi Chen (2):
  memblock tests: model the low allocation limit within dummy memory
  memblock tests: cover allocations below the low address limit

 tools/testing/memblock/Makefile              |   3 +-
 tools/testing/memblock/README                |  12 +-
 tools/testing/memblock/TODO                  |   5 -
 tools/testing/memblock/asm/dma.h             |   6 +
 tools/testing/memblock/main.c                |   2 +
 tools/testing/memblock/tests/alloc_low_api.c | 148 +++++++++++++++++++
 tools/testing/memblock/tests/alloc_low_api.h |   9 ++
 tools/testing/memblock/tests/common.c        |   6 +
 8 files changed, 178 insertions(+), 13 deletions(-)
 delete mode 100644 tools/testing/memblock/TODO
 create mode 100644 tools/testing/memblock/tests/alloc_low_api.c
 create mode 100644 tools/testing/memblock/tests/alloc_low_api.h

-- 
2.55.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-10  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 23:55 [PATCH v3 0/2] memblock tests: cover low-address allocations Tianyi Chen
2026-09-09 23:55 ` [PATCH v3 1/2] memblock tests: model the low allocation limit within dummy memory Tianyi Chen
2026-09-09 23:55 ` [PATCH v3 2/2] memblock tests: cover allocations below the low address limit Tianyi Chen
2026-09-10  9:58 ` [PATCH v3 0/2] memblock tests: cover low-address allocations Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®