From: Richard Palethorpe <rpalethorpe@suse.de>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5 3/3] max_map_count: replace ifdefs by tst_arch
Date: Wed, 17 Nov 2021 10:33:57 +0000 [thread overview]
Message-ID: <87v90r9idn.fsf@suse.de> (raw)
In-Reply-To: <20211117070708.2174932-3-liwang@redhat.com>
Hello Li,
Li Wang <liwang@redhat.com> writes:
> Signed-off-by: Li Wang <liwang@redhat.com>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
> ---
> testcases/kernel/mem/tunable/max_map_count.c | 46 ++++++++++----------
> 1 file changed, 24 insertions(+), 22 deletions(-)
>
> diff --git a/testcases/kernel/mem/tunable/max_map_count.c b/testcases/kernel/mem/tunable/max_map_count.c
> index 4f0ad0037..a4c3dbf8e 100644
> --- a/testcases/kernel/mem/tunable/max_map_count.c
> +++ b/testcases/kernel/mem/tunable/max_map_count.c
> @@ -55,7 +55,6 @@
>
> static long old_max_map_count = -1;
> static long old_overcommit = -1;
> -static struct utsname un;
>
> static void setup(void)
> {
> @@ -66,9 +65,6 @@ static void setup(void)
> old_max_map_count = get_sys_tune("max_map_count");
> old_overcommit = get_sys_tune("overcommit_memory");
> set_sys_tune("overcommit_memory", 0, 1);
> -
> - if (uname(&un) != 0)
> - tst_brk(TBROK | TERRNO, "uname error");
> }
>
> static void cleanup(void)
> @@ -91,24 +87,30 @@ static bool filter_map(const char *line)
> if (ret != 1)
> return false;
>
> -#if defined(__x86_64__) || defined(__x86__)
> - /* On x86, there's an old compat vsyscall page */
> - if (!strcmp(buf, "[vsyscall]"))
> - return true;
> -#elif defined(__ia64__)
> - /* On ia64, the vdso is not a proper mapping */
> - if (!strcmp(buf, "[vdso]"))
> - return true;
> -#elif defined(__arm__)
> - /* Skip it when run it in aarch64 */
> - if ((!strcmp(un.machine, "aarch64"))
> - || (!strcmp(un.machine, "aarch64_be")))
> - return false;
> -
> - /* Older arm kernels didn't label their vdso maps */
> - if (!strncmp(line, "ffff0000-ffff1000", 17))
> - return true;
> -#endif
> + switch (tst_arch.type) {
> + case TST_X86:
> + case TST_X86_64:
> + /* On x86, there's an old compat vsyscall page */
> + if (!strcmp(buf, "[vsyscall]"))
> + return true;
> + break;
> + case TST_IA64:
> + /* On ia64, the vdso is not a proper mapping */
> + if (!strcmp(buf, "[vdso]"))
> + return true;
> + break;
> + case TST_ARM:
> + /* Skip it when run it in aarch64 */
This should not be possible. If TST_ARM is set then how can we be on
aarch64? We also have TST_AARCH64.
> + if (tst_kernel_bits() == 64)
> + return false;
> +
> + /* Older arm kernels didn't label their vdso maps */
> + if (!strncmp(line, "ffff0000-ffff1000", 17))
> + return true;
> + break;
> + default:
> + break;
> + };
>
> return false;
> }
> --
> 2.31.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-11-17 10:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 7:07 [LTP] [PATCH v5 1/3] lib: adding .supported_archs field in tst_test structure Li Wang
2021-11-17 7:07 ` [LTP] [PATCH v5 2/3] testcase: make use of .supported_archs Li Wang
2021-11-17 7:07 ` [LTP] [PATCH v5 3/3] max_map_count: replace ifdefs by tst_arch Li Wang
2021-11-17 10:33 ` Richard Palethorpe [this message]
2021-11-17 13:28 ` Li Wang
2021-11-17 13:58 ` Richard Palethorpe
2021-11-17 9:58 ` [LTP] [PATCH v5 1/3] lib: adding .supported_archs field in tst_test structure Richard Palethorpe
2021-11-17 13:51 ` Li Wang
2021-11-17 14:01 ` Richard Palethorpe
2021-11-18 11:42 ` Cyril Hrubis
2021-11-17 13:59 ` Joerg Vehlow
2021-11-17 14:25 ` Richard Palethorpe
2021-11-18 5:50 ` Li Wang
2021-11-18 12:07 ` Cyril Hrubis
2021-11-22 2:21 ` Li Wang
2021-11-22 13:27 ` Richard Palethorpe
2021-11-22 14:21 ` Cyril Hrubis
2021-11-23 4:13 ` Li Wang
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=87v90r9idn.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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.