lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F33E5A8.2030904@linaro.org>
Date:	Thu, 09 Feb 2012 07:26:32 -0800
From:	Dmitry Antipov <dmitry.antipov@...aro.org>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	John Stultz <john.stultz@...aro.org>, linux-kernel@...r.kernel.org,
	linaro-dev@...ts.linaro.org
Subject: Re: clock_getres() and real resolution

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ