From: John Stultz <john.stultz@linaro.org>
To: David Ahern <dsahern@gmail.com>, linux-kernel@vger.kernel.org
Cc: Pawel Moll <pawel.moll@arm.com>, Ingo Molnar <mingo@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Mike Galbraith <efault@gmx.de>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Stephane Eranian <eranian@google.com>,
Sonny Rao <sonnyrao@chromium.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] perf: POSIX CLOCK_PERF to report current time value
Date: Tue, 10 Dec 2013 12:44:42 -0800 [thread overview]
Message-ID: <52A77D3A.8080407@linaro.org> (raw)
In-Reply-To: <1386707259-21725-1-git-send-email-dsahern@gmail.com>
On 12/10/2013 12:27 PM, David Ahern wrote:
> From: Pawel Moll <pawel.moll@arm.com>
>
> To co-relate user space events with the perf events stream
> a current (as in: "what time(stamp) is it now?") time value
> must be made available.
>
> This patch adds a POSIX clock returning the perf_clock()
> value and accesible from userspace:
>
> #include <time.h>
>
> struct timespec ts;
>
> clock_gettime(CLOCK_PERF, &ts);
As stated earlier on a few occasions, I really don't like exposing the
perf clock directly to userland like this, because the perf clock is not
a well defined time domain. Instead its basically defined as "whatever
sched_clock does". Over the last few years, the behavior of sched_clock
has changed, so I'm not confident it won't change in the future.
I do understand the desire, but to export a poorly defined clockid to
userland has ABI stability concerns for me. Particularly when the
performance characteristics will make it prone to abuse.
I'd much rather see perf export CLOCK_MONOTONIC_RAW timestamps, since
that clockid is well defined. Even if the underlying clocksource is
different, I suspect the perf clock could interpolate fairly closely to
CLOCK_MONOTONIC_RAW, as it already does similar interpolation on top of
CLOCK_MONOTONIC in some cases.
Other then this, I've said I'd not object other approaches, such as the
ioctl method or the dynamic clockid. These solutions also have the same
ABI stability concern, but the responsibility for that can be kept
outside the timekeeping code, so the perf folks can handle the potential
ABI stability downside. Additionally the few extra steps required to get
to the time stamping method make it less likely to be abused.
Again, I really do understand the need, and I don't mean to be a pain
here, but as a maintainer I have to push back here.
thanks
-john
next prev parent reply other threads:[~2013-12-10 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 20:27 [PATCH] perf: POSIX CLOCK_PERF to report current time value David Ahern
2013-12-10 20:44 ` John Stultz [this message]
2013-12-11 12:07 ` Ingo Molnar
2013-12-11 19:37 ` John Stultz
2013-12-11 11:25 ` Ingo Molnar
2013-12-11 11:40 ` Ingo Molnar
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=52A77D3A.8080407@linaro.org \
--to=john.stultz@linaro.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=pawel.moll@arm.com \
--cc=sonnyrao@chromium.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).