From: Wei Gao via ltp <ltp@lists.linux.it>
To: Jan Stancek <jstancek@redhat.com>
Cc: samir@linux.vnet.ibm.com, "Michal Koutný" <mkoutny@suse.com>,
emunson@mgebm.net, ltp@lists.linux.it
Subject: Re: [LTP] Question on hugemmap34
Date: Tue, 10 Dec 2024 09:22:10 -0500 [thread overview]
Message-ID: <Z1hOkq0qPs+ZCdIR@wegao> (raw)
In-Reply-To: <CAASaF6xzh3uObN3dxcLxPkyVjb-W1eZ2hLmQb6ke9a8=ezVrzw@mail.gmail.com>
On Tue, Dec 10, 2024 at 02:25:06PM +0100, Jan Stancek wrote:
> On Tue, Dec 10, 2024 at 1:54 PM Jan Stancek <jstancek@redhat.com> wrote:
> >
> > On Tue, Dec 10, 2024 at 12:53 PM Wei Gao <wegao@suse.com> wrote:
> > >
> > > 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)
> >
> > There's missing exit() in do_child(), but that's not the only issue
> > with the test.
>
> Could you give this patch a try?
>
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34.c
> b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34.c
> index a7a88fbb2..818697be8 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34.c
> @@ -51,16 +51,23 @@ void do_child(void *stop_address)
> x = alloca(STACK_ALLOCATION_SIZE);
> *x = 1;
> } while ((void *)x >= stop_address);
> + exit(0);
> }
>
> static void run_test(void)
> {
> int pid, status;
> void *stack_address, *mmap_address, *heap_address, *map;
> + char tmp[128];
>
> stack_address = alloca(0);
> heap_address = sbrk(0);
>
> + tst_res(TINFO, "heap is at: %p", heap_address);
> + tst_res(TINFO, "stack is at: %p", stack_address);
> + sprintf(tmp, "cat /proc/%d/maps", getpid());
> + TST_EXP_PASS_SILENT(system(tmp));
> +
> /*
> * paranoia: start mapping two hugepages below the start of the stack,
> * in case the alignment would cause us to map over something if we
> @@ -70,6 +77,9 @@ static void run_test(void)
> do {
> map = mmap(mmap_address, hpage_size, PROT_READ|PROT_WRITE,
> MAP_SHARED | MAP_FIXED_NOREPLACE, fd, 0);
> + if (map == mmap_address)
> + break;
> +
> if (map == MAP_FAILED) {
> if (errno == ENOMEM) {
> tst_res(TCONF, "There is no enough
> memory in the system to do mmap");
> @@ -80,7 +90,12 @@ static void run_test(void)
> /*
> * if we get all the way down to the heap, stop trying
> */
> - } while (mmap_address <= heap_address);
> + } while (mmap_address > heap_address);
> +
> + if (map == MAP_FAILED)
> + tst_brk(TBROK, "failed to map hpage_size area before
> hitting heap");
> + tst_res(TINFO, "mapped at %p", mmap);
> +
> pid = SAFE_FORK();
> if (pid == 0)
> do_child(mmap_address);
>
Test will timeout if use default timeout so i do quick hack change for setup:
.forks_child = 1,
+ .max_runtime = 3600,
Test result:
make -C "/root/ltp/lib" -f "/root/ltp/lib/Makefile" all
make[1]: Entering directory '/root/ltp/lib'
GEN ltp-version.h
make[2]: Nothing to be done for 'all'.
make[2]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/ltp/lib'
hugemmap34.c:150:1: warning: missing initializer for field ‘needs_cmds’ of ‘struct tst_test’ [-Wmissing-field-initializers]
};
^
In file included from /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/../lib/hugetlb.h:19:0,
from hugemmap34.c:24:
../../../../../include/tst_test.h:593:21: note: ‘needs_cmds’ declared here
const char *const *needs_cmds;
^~~~~~~~~~
CC testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
tst_hugepage.c:84: TINFO: 1 hugepage(s) reserved
tst_tmpdir.c:317: TINFO: Using /tmp/LTP_hugkoiPEG as tmpdir (btrfs filesystem)
tst_test.c:1100: TINFO: Mounting none to /tmp/LTP_hugkoiPEG/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 1h 00m 30s
hugemmap34.c:66: TINFO: heap is at: 0x1002af30000
hugemmap34.c:67: TINFO: stack is at: 0x7ffff97cab30
10000000-10040000 r-xp 00000000 00:29 11656 /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
10040000-10050000 r--p 00030000 00:29 11656 /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
10050000-10060000 rw-p 00040000 00:29 11656 /root/ltp/testcases/kernel/mem/hugetlb/hugemmap/hugemmap34
10060000-10070000 rw-p 00000000 00:00 0
1002af00000-1002af30000 rw-p 00000000 00:00 0 [heap]
7fff94b20000-7fff94d20000 r-xp 00000000 00:29 11464 /lib64/libc-2.31.so
7fff94d20000-7fff94d30000 r--p 001f0000 00:29 11464 /lib64/libc-2.31.so
7fff94d30000-7fff94d40000 rw-p 00200000 00:29 11464 /lib64/libc-2.31.so
7fff94d40000-7fff94d70000 r-xp 00000000 00:29 11482 /lib64/libpthread-2.31.so
7fff94d70000-7fff94d80000 r--p 00020000 00:29 11482 /lib64/libpthread-2.31.so
7fff94d80000-7fff94d90000 rw-p 00030000 00:29 11482 /lib64/libpthread-2.31.so
7fff94da0000-7fff94db0000 rw-s 00000000 00:17 9 /dev/shm/ltp_hugemmap34_7730 (deleted)
7fff94db0000-7fff94dd0000 r--p 00000000 00:00 0 [vvar]
7fff94dd0000-7fff94de0000 r-xp 00000000 00:00 0 [vdso]
7fff94de0000-7fff94e20000 r-xp 00000000 00:29 11457 /lib64/ld-2.31.so
7fff94e20000-7fff94e30000 r--p 00030000 00:29 11457 /lib64/ld-2.31.so
7fff94e30000-7fff94e40000 rw-p 00040000 00:29 11457 /lib64/ld-2.31.so
7ffff97a0000-7ffff97d0000 rw-p 00000000 00:00 0 [stack]
hugemmap34.c:97: TINFO: mapped at 0x7fff94c51e80
tst_coredump.c:32: TINFO: Avoid dumping corefile for process(pid=7752)
hugemmap34.c:105: TPASS: Child killed by SIGSEGV as expected
Summary:
passed 1
failed 0
broken 0
skipped 0
warnings 0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-12-10 14:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 11:53 [LTP] Question on hugemmap34 Wei Gao via ltp
2024-12-10 12:54 ` Jan Stancek
2024-12-10 13:25 ` Jan Stancek
2024-12-10 14:22 ` Wei Gao via ltp [this message]
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=Z1hOkq0qPs+ZCdIR@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 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.