[LTP] [PATCH v2] hugemmap24: Restrict the 1TB slice layout to 64-bit powerpc
Victor Cheng-Yen Yang
cyyang772@andestech.com
Mon Sep 7 03:45:17 CEST 2026
The 1TB-slice branch of init_slice_boundary() is guarded by __LP64__
minus a blocklist of architectures that do not have powerpc slices.
Every new 64-bit architecture has to be added to that blocklist, and rv64
is the next one to trip over it.
The virtual address space of an rv64 kernel in Sv39 MMU mode is split in
half between user and kernel, leaving TASK_SIZE = 0x4000000000 (256 GB).
Every candidate boundary from 1 TB up is above the end of the user
address space, so the MAP_FIXED mmap() fails with ENOMEM on all
iterations and the test reports a bogus failure:
hugemmap24.c:62: TINFO: can't use slice_boundary: 0x100000000000: ENOMEM (12)
hugemmap24.c:71: TFAIL: couldn't find 2 free neighbour slices: ENOMEM (12)
Invert the check instead of extending the blocklist. 1 TB slices only
exist on 64-bit powerpc. Every other architecture falls back to the
256 MB layout at low addresses. Sv48 and Sv57 do provide a large enough
user range, but the test must also pass on Sv39, so RISC-V takes the
fallback unconditionally.
Suggested-by: Andrea Cervesato <andrea.cervesato@suse.com>
Signed-off-by: Victor Cheng-Yen Yang <cyyang772@andestech.com>
---
v2: Invert the exclusion into a 64-bit powerpc allowlist, per Andrea.
Link to v1: https://lore.kernel.org/ltp/20260824082350.70245-1-cyyang772@andestech.com/
---
testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
index 0de44d58a..9e23c253f 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
@@ -28,12 +28,12 @@ static int init_slice_boundary(int fd)
unsigned long slice_size;
void *p, *heap;
int i;
-#if defined(__LP64__) && !defined(__aarch64__) && !defined(__loongarch__)
+#if defined(__powerpc64__) || (defined(__powerpc__) && defined(__LP64__))
/* powerpc: 1TB slices starting at 1 TB */
slice_boundary = 0x10000000000;
slice_size = 0x10000000000;
#else
- /* powerpc: 256MB slices up to 4GB */
+ /* powerpc (32-bit) and other arches: 256MB slices up to 4GB */
slice_boundary = 0x00000000;
slice_size = 0x10000000;
#endif
--
2.55.0
More information about the ltp
mailing list