From: shuah <shuah@kernel.org>
To: Dmitry Safonov <dima@arista.com>, linux-kernel@vger.kernel.org
Cc: Dmitry Safonov <0x7f454c46@gmail.com>,
Andrei Vagin <avagin@gmail.com>, Adrian Reber <adrian@lisas.de>,
Andrei Vagin <avagin@openvz.org>,
Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Christian Brauner <christian.brauner@ubuntu.com>,
Cyrill Gorcunov <gorcunov@openvz.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Jann Horn <jannh@google.com>, Jeff Dike <jdike@addtoit.com>,
Oleg Nesterov <oleg@redhat.com>,
Pavel Emelyanov <xemul@virtuozzo.com>,
Thomas Gleixner <tglx@linutronix.de>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
containers@lists.linux-foundation.org, criu@openvz.org,
linux-api@vger.kernel.org, x86@kernel.org,
shuah <shuah@kernel.org>
Subject: Re: [PATCHv6 35/36] selftests/timens: Add a simple perf test for clock_gettime()
Date: Thu, 15 Aug 2019 17:29:31 -0600 [thread overview]
Message-ID: <0992df9a-d3b3-5ca1-e1fd-b5d9d365b32e@kernel.org> (raw)
In-Reply-To: <20190815163836.2927-36-dima@arista.com>
On 8/15/19 10:38 AM, Dmitry Safonov wrote:
> From: Andrei Vagin <avagin@gmail.com>
>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> Co-developed-by: Dmitry Safonov <dima@arista.com>
> Signed-off-by: Dmitry Safonov <dima@arista.com>
> ---
> tools/testing/selftests/timens/.gitignore | 2 +
> tools/testing/selftests/timens/Makefile | 10 +-
> tools/testing/selftests/timens/gettime_perf.c | 101 +++++++++++
> .../selftests/timens/gettime_perf_cold.c | 160 ++++++++++++++++++
> 4 files changed, 271 insertions(+), 2 deletions(-)
> create mode 100644 tools/testing/selftests/timens/gettime_perf.c
> create mode 100644 tools/testing/selftests/timens/gettime_perf_cold.c
>
> diff --git a/tools/testing/selftests/timens/.gitignore b/tools/testing/selftests/timens/.gitignore
> index 3b7eda8f35ce..16292e4d08a5 100644
> --- a/tools/testing/selftests/timens/.gitignore
> +++ b/tools/testing/selftests/timens/.gitignore
> @@ -1,4 +1,6 @@
> clock_nanosleep
> +gettime_perf
> +gettime_perf_cold
> procfs
> timens
> timer
> diff --git a/tools/testing/selftests/timens/Makefile b/tools/testing/selftests/timens/Makefile
> index ae1ffd24cc43..97e0460eaf48 100644
> --- a/tools/testing/selftests/timens/Makefile
> +++ b/tools/testing/selftests/timens/Makefile
> @@ -1,6 +1,12 @@
> -TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs
> +TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs gettime_perf
> +
> +uname_M := $(shell uname -m 2>/dev/null || echo not)
> +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
> +ifeq ($(ARCH),x86_64)
> +TEST_GEN_PROGS += gettime_perf_cold
> +endif
>
> CFLAGS := -Wall -Werror
> -LDFLAGS := -lrt
> +LDFLAGS := -lrt -ldl
>
> include ../lib.mk
> diff --git a/tools/testing/selftests/timens/gettime_perf.c b/tools/testing/selftests/timens/gettime_perf.c
> new file mode 100644
> index 000000000000..f7d7832c0293
> --- /dev/null
> +++ b/tools/testing/selftests/timens/gettime_perf.c
> @@ -0,0 +1,101 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#define _GNU_SOURCE
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <errno.h>
> +#include <fcntl.h>
> +#include <sched.h>
> +#include <time.h>
> +#include <stdio.h>
> +#include <unistd.h>
> +#include <sys/syscall.h>
> +#include <dlfcn.h>
> +
> +#include "log.h"
> +#include "timens.h"
> +
> +//#define TEST_SYSCALL
> +
How is this supposed to be used? When does TEST_SYSCALL
get defined?
> +typedef int (*vgettime_t)(clockid_t, struct timespec *);
> +
> +vgettime_t vdso_clock_gettime;
> +
> +static void fill_function_pointers(void)
> +{
> + void *vdso = dlopen("linux-vdso.so.1",
> + RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
> + if (!vdso)
> + vdso = dlopen("linux-gate.so.1",
> + RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
> + if (!vdso) {
> + pr_err("[WARN]\tfailed to find vDSO\n");
> + return;
> + }
> +
> + vdso_clock_gettime = (vgettime_t)dlsym(vdso, "__vdso_clock_gettime");
> + if (!vdso_clock_gettime)
> + pr_err("Warning: failed to find clock_gettime in vDSO\n");
> +
> +}
> +
> +static void test(clock_t clockid, char *clockstr, bool in_ns)
> +{
> + struct timespec tp, start;
> + long i = 0;
> + const int timeout = 3;
> +
> +#ifndef TEST_SYSCALL
> + vdso_clock_gettime(clockid, &start);
> +#else
> + syscall(__NR_clock_gettime, clockid, &start);
> +#endif
Hmm. This doesn't look right. Does this test need to be compiled
with TEST_SYSCALL. Please find a way to do this without ifdef.
thanks,
-- Shuah
next prev parent reply other threads:[~2019-08-15 23:29 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 16:38 [PATCHv6 00/36] kernel: Introduce Time Namespace Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 01/36] ns: " Dmitry Safonov
2019-08-15 17:19 ` Thomas Gleixner
2019-08-16 6:11 ` Andrei Vagin
2019-08-16 6:34 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 02/36] timens: Add timens_offsets Dmitry Safonov
2019-08-15 17:21 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 03/36] posix-clocks: Rename the clock_get() into clock_get_timespec() Dmitry Safonov
2019-08-15 17:24 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 04/36] posix-clocks: Rename .clock_get_timespec() callbacks accordingly Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 05/36] alarmtimer: Rename gettime() callback to get_ktime() Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 06/36] alarmtimer: Provide get_timespec() callback Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 07/36] posix-clocks: Introduce clock_get_ktime() callback Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 08/36] posix-timers: Use clock_get_ktime() in common_timer_get() Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 09/36] posix-clocks: Wire up clock_gettime() with timens offsets Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 10/36] kernel: Add do_timens_ktime_to_host() helper Dmitry Safonov
2019-08-15 17:38 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 11/36] timerfd: Make timerfd_settime() time namespace aware Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 12/36] posix-timers: Make timer_settime() " Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 13/36] alarmtimer: Make nanosleep " Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 14/36] hrtimers: Prepare hrtimer_nanosleep() for time namespaces Dmitry Safonov
2019-08-15 17:44 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 15/36] posix-timers: Make clock_nanosleep() time namespace aware Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 16/36] fd/proc: Respect boottime inside time namespace for /proc/uptime Dmitry Safonov
2019-08-16 0:46 ` Randy Dunlap
2019-08-15 16:38 ` [PATCHv6 17/36] x86/vdso2c: Correct err messages on file opening Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 18/36] x86/vdso2c: Convert iterator to unsigned Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 19/36] x86/vdso/Makefile: Add vobjs32 Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 20/36] x86/vdso: Restrict splitting VVAR VMA Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 21/36] x86/vdso: Rename vdso_image {.data=>.text} Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 22/36] x86/vdso: Add offsets page in vvar Dmitry Safonov
2019-08-15 19:21 ` Thomas Gleixner
2019-08-16 20:20 ` Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 23/36] x86/vdso: Allocate timens vdso Dmitry Safonov
2019-08-16 15:23 ` Andy Lutomirski
2019-08-16 20:10 ` Thomas Gleixner
2019-08-16 22:47 ` Dmitry Safonov
2019-08-18 16:21 ` Thomas Gleixner
2019-08-18 16:24 ` Thomas Gleixner
2019-08-18 16:29 ` Thomas Gleixner
2019-08-19 14:15 ` Dmitry Safonov
2019-08-19 14:44 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 24/36] x86/vdso: Switch image on setns()/clone() Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 25/36] vdso: Introduce vdso_static_branch_unlikely() Dmitry Safonov
2019-08-15 18:03 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 26/36] x86/vdso2c: Process jump tables Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 27/36] x86/vdso: Enable static branches for the timens vdso Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 28/36] posix-clocks: Add align for timens_offsets Dmitry Safonov
2019-08-15 19:22 ` Thomas Gleixner
2019-08-16 6:36 ` Thomas Gleixner
2019-08-15 16:38 ` [PATCHv6 29/36] fs/proc: Introduce /proc/pid/timens_offsets Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 30/36] selftest/timens: Add Time Namespace test for supported clocks Dmitry Safonov
2019-08-15 23:18 ` shuah
2019-08-16 6:20 ` Andrei Vagin
2019-08-15 16:38 ` [PATCHv6 31/36] selftest/timens: Add a test for timerfd Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 32/36] selftest/timens: Add a test for clock_nanosleep() Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 33/36] selftest/timens: Add procfs selftest Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 34/36] selftest/timens: Add timer offsets test Dmitry Safonov
2019-08-15 16:38 ` [PATCHv6 35/36] selftests/timens: Add a simple perf test for clock_gettime() Dmitry Safonov
2019-08-15 23:29 ` shuah [this message]
2019-08-15 16:38 ` [PATCHv6 36/36] selftest/timens: Check that a right vdso is mapped after fork and exec Dmitry Safonov
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=0992df9a-d3b3-5ca1-e1fd-b5d9d365b32e@kernel.org \
--to=shuah@kernel.org \
--cc=0x7f454c46@gmail.com \
--cc=adrian@lisas.de \
--cc=arnd@arndb.de \
--cc=avagin@gmail.com \
--cc=avagin@openvz.org \
--cc=christian.brauner@ubuntu.com \
--cc=containers@lists.linux-foundation.org \
--cc=criu@openvz.org \
--cc=dima@arista.com \
--cc=ebiederm@xmission.com \
--cc=gorcunov@openvz.org \
--cc=hpa@zytor.com \
--cc=jannh@google.com \
--cc=jdike@addtoit.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=x86@kernel.org \
--cc=xemul@virtuozzo.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
all inboxes | Powered by JetHome®