Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542575

Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays

From Daniel Vetter <daniel@ffwll.ch>
Newsgroups linux.kernel
Subject Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays
Date 2016-12-15 10:30 +0100
Message-ID <sOAwq-42f-7@gated-at.bofh.it> (permalink)
References <sOvQ5-19P-9@gated-at.bofh.it> <sOAd4-3Wj-17@gated-at.bofh.it> <sOAwq-42f-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 15, 2016 at 10:25:19AM +0100, Daniel Vetter wrote:
> On Thu, Dec 15, 2016 at 11:08:49AM +0200, Jani Nikula wrote:
> > On Thu, 15 Dec 2016, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> > > Even on fast systems a 2 microsecond delay is most likely more efficient
> > > as a busy-wait loop. The overhead of a hrtimer does not seem warranted -
> > > change this to a udelay(2).
> > 
> > Similar concerns as in [1]. We don't need the accuracy of udelay() here,
> > so this boils down to which is the better use of CPU. We could probably
> > relax the max delay more if that was helpful. But I'm not immediately
> > sold on "is most likely more efficient" which sounds like a gut feeling.
> > 
> > I'm sorry it's not clear in my other reply that I do appreciate
> > addressing incorrect/silly use of usleep_range(); I'm just not (yet)
> > convinced udelay() is the answer.
> 
> So one reason why we unconditionally use *sleep variants is the
> might_sleep check. Because in the past people have used udelay and mdelay,
> those delays had to be increased a lot because hw, and at the same time
> someone added users of these functions to our irq helper, resulting in irq
> handling times measures in multiple ms. That's not good.
> 
> So until someone can demonstrate that there's a real benefit (which let's
> be honest, for modeset code, will never be the case) I very highly prefer
> to use *sleep* functions. They prevent some silly things from happening by
> accident. Micro-optimizing modeset code and hampering maitainability in
> the process is not good.

Also, the entire premise seems backwards: usleep_range is inefficient for
certain parameter ranges and better replaced with udelay. That makes
sense.

But why exactly do we not fix udelay_range then, but instead do a cocci
job crawling through all the thousands of callers? Just fix usleep(_range)
to use udelay for very small values (and still keep the might_sleep check
ofc) if that's more efficient!
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] drm/i915: use udelay for very short delays Nicholas Mc Guire <hofrat@osadl.org> - 2016-12-15 05:30 +0100
  Re: [PATCH] drm/i915: use udelay for very short delays Jani Nikula <jani.nikula@linux.intel.com> - 2016-12-15 10:10 +0100
    Re: [PATCH] drm/i915: use udelay for very short delays Nicholas Mc Guire <der.herr@hofr.at> - 2016-12-15 10:30 +0100
      Re: [PATCH] drm/i915: use udelay for very short delays Jani Nikula <jani.nikula@linux.intel.com> - 2016-12-15 11:00 +0100
        Re: [PATCH] drm/i915: use udelay for very short delays Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-12-15 11:20 +0100
          Re: [PATCH] drm/i915: use udelay for very short delays Jani Nikula <jani.nikula@linux.intel.com> - 2016-12-15 11:30 +0100
            Re: [PATCH] drm/i915: use udelay for very short delays Nicholas Mc Guire <der.herr@hofr.at> - 2016-12-15 12:00 +0100
              Re: [PATCH] drm/i915: use udelay for very short delays Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-12-15 13:00 +0100
              Re: [PATCH] drm/i915: use udelay for very short delays Jani Nikula <jani.nikula@linux.intel.com> - 2016-12-15 13:10 +0100
    Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays Daniel Vetter <daniel@ffwll.ch> - 2016-12-15 10:30 +0100
      Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays Nicholas Mc Guire <der.herr@hofr.at> - 2016-12-15 12:00 +0100
        Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays Daniel Vetter <daniel@ffwll.ch> - 2016-12-15 12:40 +0100
    Re: [Intel-gfx] [PATCH] drm/i915: use udelay for very short delays Daniel Vetter <daniel@ffwll.ch> - 2016-12-15 10:30 +0100

csiph-web