Message ID | 3190c9a0b45411eb9d6024267c264825c9faa32e.1632386756.git.jstancek@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2] hugeshmat04: try to find unmapped range for test | expand |
On Thu, Sep 23, 2021 at 4:50 PM Jan Stancek <jstancek@redhat.com> wrote: > The test intermittently fails on ppc64le, when heap > happens to overlap with segment that the test is trying > to attach at 1GB boundary. > > Try to find unmapped range. In my testing, address above 1GB appears > to be needed for reproducer to work. Also add kernel commit that fixed > it to metadata. > > Signed-off-by: Jan Stancek <jstancek@redhat.com> > Reviewed-by: Li Wang <liwang@redhat.com>
Hi!
Great work.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
On Thu, Sep 23, 2021 at 5:07 PM Cyril Hrubis <chrubis@suse.cz> wrote: > Hi! > Great work. > > Reviewed-by: Cyril Hrubis <chrubis@suse.cz> I'm going to start a round of test for the latest branch before the release. So this patch merged. Thanks!
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c index e9bb9fbf7b4b..b76da93a197e 100644 --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c @@ -23,6 +23,7 @@ #define SIZE (1024 * 1024 * 1024) #define BOUNDARY (1024 * 1024 * 1024) +#define BOUNDARY_MAX (3U * 1024 * 1024 * 1024) static long huge_free; static long huge_free2; @@ -49,12 +50,20 @@ static void shared_hugepage(void) int status, shmid; size_t size = (size_t)SIZE; void *buf; + unsigned long boundary = BOUNDARY; shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | 0777); if (shmid < 0) tst_brk(TBROK | TERRNO, "shmget"); - buf = shmat(shmid, (void *)BOUNDARY, SHM_RND | 0777); + while (boundary <= BOUNDARY_MAX + && range_is_mapped(boundary, boundary+SIZE)) + boundary += 128*1024*1024; + if (boundary > BOUNDARY_MAX) + tst_brk(TCONF, "failed to find free unmapped range"); + + tst_res(TINFO, "attaching at 0x%lx", boundary); + buf = shmat(shmid, (void *)boundary, SHM_RND | 0777); if (buf == (void *)-1) { shmctl(shmid, IPC_RMID, NULL); tst_brk(TBROK | TERRNO, "shmat"); @@ -104,6 +113,10 @@ static void cleanup(void) } static struct tst_test test = { + .tags = (const struct tst_tag[]) { + {"linux-git", "c5c99429fa57"}, + {} + }, .needs_root = 1, .forks_child = 1, .needs_tmpdir = 1,
The test intermittently fails on ppc64le, when heap happens to overlap with segment that the test is trying to attach at 1GB boundary. Try to find unmapped range. In my testing, address above 1GB appears to be needed for reproducer to work. Also add kernel commit that fixed it to metadata. Signed-off-by: Jan Stancek <jstancek@redhat.com> --- .../kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)