From: Wei Gao via ltp <ltp@lists.linux.it>
To: jstancek@redhat.com, emunson@mgebm.net, samir@linux.vnet.ibm.com
Cc: "Michal Koutný" <mkoutny@suse.com>, ltp@lists.linux.it
Subject: [LTP] Question on hugemmap34
Date: Tue, 10 Dec 2024 06:53:26 -0500 [thread overview]
Message-ID: <Z1grtnHIJz//u4kB@wegao> (raw)
Hi ALL
Is there any special config needed for this test case? Since the test failed with the following output on my test setup(opensuse15.5 with 6.12 kernel):
tst_hugepage.c:84: TINFO: 1 hugepage(s) reserved
tst_tmpdir.c:317: TINFO: Using /tmp/LTP_hugLSJb7r as tmpdir (btrfs filesystem)
tst_test.c:1100: TINFO: Mounting none to /tmp/LTP_hugLSJb7r/hugetlbfs fstyp=hugetlbfs flags=0
tst_test.c:1890: TINFO: LTP version: 20240930
tst_test.c:1894: TINFO: Tested kernel: 6.12.3-lp155.11.g78b0030-vanilla #1 SMP Fri Dec 6 08:56:39 UTC 2024 (78b0030) ppc64le
tst_test.c:1727: TINFO: Timeout per run is 0h 00m 30s
tst_coredump.c:32: TINFO: Avoid dumping corefile for process(pid=6671)
hugemmap34.c:88: TBROK: waitpid(0,0x7fffd8baa220,0) failed: ECHILD (10)
hugemmap34.c:92: TFAIL: Child: exited with 2
The root cause is the mmap call encounter failure with EBUSY.
LTP mmap call
https://github.com/linux-test-project/ltp/blob/7bb960cc4f736d8860b6b266119e71e761e22b32/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34.c#L71
hit kernel code
https://elixir.bootlin.com/linux/v6.12/source/arch/powerpc/mm/book3s64/slice.c#L568
Let me give an example to explain why this happens base pmap of process in my test system:
Address Kbytes RSS PSS Dirty Swap Mode Mapping
0000000010000000 256 256 128 256 0 r-xp- /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
0000000010040000 64 64 32 64 0 r--p- /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
0000000010050000 64 64 64 64 0 rw-p- /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
0000000010060000 64 64 64 64 0 rw-p- [ anon ]
0000010010090000 192 64 64 64 0 rw-p- [ anon ]
00007fff8f3b0000 2368 1408 0 0 0 r-xp- /lib64/libc.so.6
00007fff8f600000 64 64 32 64 0 r--p- /lib64/libc.so.6
00007fff8f610000 64 64 64 64 0 rw-p- /lib64/libc.so.6
00007fff8f620000 64 64 32 64 0 rw-s- /dev/shm/ltp_hugemmap34_15513 (deleted)
00007fff8f630000 128 0 0 0 0 r--p- [ anon ]
00007fff8f650000 64 0 0 0 0 r-xp- [ anon ]
00007fff8f660000 320 128 0 0 0 r-xp- /lib64/ld64.so.2
00007fff8f6b0000 64 64 32 64 0 r--p- /lib64/ld64.so.2
00007fff8f6c0000 64 64 64 64 0 rw-p- /lib64/ld64.so.2
00007fffc6740000 192 64 64 64 0 rw-p- [ stack ] <<<<
---------------- ------- ------- ------- ------- -------
total kB 20416 2432 1318 896 0
Test power system config:
#getconf PAGE_SIZE
65536
#grep Hugepagesize /proc/meminfo
Hugepagesize: 16384 kB
Kenel split VM space into:
16 low_slice(64KB page size), each slice size is 256MB
4096 high_slice(64K page size), each slice size is 1TB
00007fffc6740000(stack) is belong 127th high_slice(range is 00007f0000000000 - 00007fffffffffff)
When mmap try to allocate a 16M space(with page size MMU_PAGE_16M) near stack address(00007fffc6740000),
kernel will first check good_mask but failed, since the all slices is MMU_PAGE_64K
but mmap request page size is MMU_PAGE_16M.
https://elixir.bootlin.com/linux/v6.12/source/arch/powerpc/mm/book3s64/slice.c#L531
Next kernel start check potential_mask(seach all slice which has no any VM mapped), obviously
the 127th slice is occupied and 126th is the good candidate one but address range not match
the mmap's request address(0x00007fffc6740000 - 2 * hpage_size), so finally EBUSY returned.
https://elixir.bootlin.com/linux/v6.12/source/arch/powerpc/mm/book3s64/slice.c#L559
BTW: I have tested a scenario which disables MAP_FIXED_NOREPLACE, the kernel will
allocate successfully within the range of 126th high slice.
Thanks.
Regards
Wei Gao
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2024-12-10 11:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 11:53 Wei Gao via ltp [this message]
2024-12-10 12:54 ` [LTP] Question on hugemmap34 Jan Stancek
2024-12-10 13:25 ` Jan Stancek
2024-12-10 14:22 ` Wei Gao via ltp
2024-12-11 3:20 ` Wei Gao via ltp
2024-12-11 6:46 ` Jan Stancek
2024-12-11 10:49 ` Jan Stancek
2024-12-12 9:29 ` [LTP] [PATCH] hugemmap34: change how test finds suitable huge page and stack for test Jan Stancek
2024-12-12 13:04 ` Cyril Hrubis
2024-12-13 4:09 ` Wei Gao via ltp
2024-12-13 7:27 ` Jan Stancek
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=Z1grtnHIJz//u4kB@wegao \
--to=ltp@lists.linux.it \
--cc=emunson@mgebm.net \
--cc=jstancek@redhat.com \
--cc=mkoutny@suse.com \
--cc=samir@linux.vnet.ibm.com \
--cc=wegao@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox