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]
Date:   Thu, 15 Dec 2016 08:56:51 +0000
From:   Nicholas Mc Guire <der.herr@...r.at>
To:     Jani Nikula <jani.nikula@...ux.intel.com>
Cc:     Nicholas Mc Guire <hofrat@...dl.org>,
        Daniel Vetter <daniel.vetter@...el.com>,
        ymohanma <yogesh.mohan.marimuthu@...el.com>,
        David Airlie <airlied@...ux.ie>,
        intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/i915: use udelay for very small delays

On Thu, Dec 15, 2016 at 10:47:57AM +0200, Jani Nikula wrote:
> On Thu, 15 Dec 2016, Nicholas Mc Guire <hofrat@...dl.org> wrote:
> > usleep_range() is intended for delays in the 10us to 10ms range that need
> > good precision. a useleep_range(1, will effectively be no more than an
> > imprecise udelay with some added cache disruption as it will fire more or
> > less immediately - use udelay() here.
> >
> > Fixes: commit be4fc046bed3 ("drm/i915: add VLV DSI PLL Calculations")
> > Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
> > ---
> >
> > Problem located by coccinelle
> >
> > The requirement of waiting at least 0.5 us is assured with the udelay(1)
> > here which should be more effective than a usleep_range() - would 
> > ndelay(500) make sense here ?
> 
> This is in the modeset path, i.e. pretty slow anyway. In this case, the
> point is not to try hard to minimize the wait, the point is to guarantee
> "at least 0.5 us" has passed. If the CPU can do something else,
> including dozing off, in the mean time, great. I think we should stick
> with usleep_range().

well in that case maybe an acceptable solution would be to set it to 
some suitable range 10,20 us ? or if not critical preferably even with a large
upper limit.

> 
> I think the question is, how do we express this in code? IMO udelay() is
> not the answer.

if the delay need to be kept short then no - then its not the answer
but usleep_ranges(1,2) I think is effectively just an inefficient version
of udelay(1), by the time the timer is setup and the task gives
up the cpu the timer would fire.

> 
> And why doesn't usleep_range() kernel-doc mention anything about the
> ranges?
> 

interesting - that might be part of the reason there are many findings
Documentation/timers/timers-howto.txt does

        SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms):
                * Use usleep_range

thx!
hofrat

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ