From: Dmitry Antipov <dmitry.antipov@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>,
linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org
Subject: Re: clock_getres() and real resolution
Date: Thu, 09 Feb 2012 07:26:32 -0800 [thread overview]
Message-ID: <4F33E5A8.2030904@linaro.org> (raw)
In-Reply-To: <alpine.LFD.2.02.1202091051310.2794@ionos>
On 02/09/2012 02:12 AM, Thomas Gleixner wrote:
> It would be possible to return the real resolution of the clock event
> device, but we have systems, where the clockevent device is
> dynamically changing. So which resolution do we expose to an
> application? The one of the current active device or some magic number
> of a device which might not even be initialized? That's more confusing
> than telling user space that high resolution timers are active and the
> kernel is trying to achieve the 1ns accuracy.
First of all, it's not necessary to make unrealizable promises to
an application programmer. If it's known that _any_ hardware configuration
can't guarantee, for example, <20ns precision, it's better to return
{0, 20} than {0, 1} from clock_getres(...). If high-res subsystem
isn't active, just return -1 and set errno to EINVAL, regardless of
an arguments passed.
Second, it's very hard to deny that some applications really needs
precise time measurements. So, if the clockevent device is dynamically
changing, it would be nice to have a method to prevent the loss of
precision for such an application. For example, an application may
issue prctl(PR_SET_CLOCK_STABLE, 1) to make sure that hrtimer's resolution
isn't changed (or at least not changed with the loss of precision)
until prctl(PR_SET_CLOCK_STABLE, 0) or exit(); if some system-wide
event decreases hrtimer accuracy, such an application might receive
a signal, etc.
Dmitry
prev parent reply other threads:[~2012-02-09 15:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 16:31 clock_getres() and real resolution Dmitry Antipov
2012-02-09 5:12 ` Richard Cochran
2012-02-09 9:25 ` Dmitry Antipov
2012-02-09 18:40 ` Richard Cochran
2012-02-09 19:32 ` Dmitry Antipov
2012-02-11 7:39 ` Richard Cochran
2012-02-09 10:12 ` Thomas Gleixner
2012-02-09 15:26 ` Dmitry Antipov [this message]
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=4F33E5A8.2030904@linaro.org \
--to=dmitry.antipov@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.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).