hugemmap24: Restrict the 1TB slice layout to 64-bit powerpc
PATCH v2 1/1 hugemmap24: Restrict the 1TB slice layout to 64-bit powerpc
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.
---
v2: Invert the exclusion into a 64-bit powerpc allowlist, per Andrea. Link to v1: https://lore.kernel.org/ltp/[email protected]/
--- testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c +2 -2
@@ -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
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp