All of lore.kernel.org
 help / color / mirror / Atom feed
From: Victor Cheng-Yen Yang via ltp <ltp@lists.linux.it>
To: <ltp@lists.linux.it>
Subject: [LTP] [PATCH v2] hugemmap24: Restrict the 1TB slice layout to 64-bit powerpc
Date: Mon, 7 Sep 2026 09:45:17 +0800	[thread overview]
Message-ID: <20260907014516.450196-2-cyyang772@andestech.com> (raw)

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-09-07  1:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  1:45 Victor Cheng-Yen Yang via ltp [this message]
2026-09-07  6:32 ` [LTP] [PATCH v2] hugemmap24: Restrict the 1TB slice layout to 64-bit powerpc Andrea Cervesato via ltp
2026-09-07  6:32 ` Andrea Cervesato via ltp

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=20260907014516.450196-2-cyyang772@andestech.com \
    --to=ltp@lists.linux.it \
    --cc=cyyang772@andestech.com \
    /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.