Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	"Murthy, Arun R" <arun.r.murthy@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"airlied@linux.ie" <airlied@linux.ie>
Subject: Re: [PATCH] drm/i915: use hrtimer in wait for vblank
Date: Mon, 24 Mar 2014 10:55:44 +0100	[thread overview]
Message-ID: <20140324095544.GE26878@phenom.ffwll.local> (raw)
In-Reply-To: <20140324094809.GP4366@nuc-i3427.alporthouse.com>

On Mon, Mar 24, 2014 at 09:48:09AM +0000, Chris Wilson wrote:
> On Mon, Mar 24, 2014 at 09:34:35AM +0000, Murthy, Arun R wrote:
> > >> diff --git a/drivers/gpu/drm/i915/intel_drv.h 
> > >> b/drivers/gpu/drm/i915/intel_drv.h
> > >> index 44067bc..079280a 100644
> > >> --- a/drivers/gpu/drm/i915/intel_drv.h
> > >> +++ b/drivers/gpu/drm/i915/intel_drv.h
> > >> @@ -52,7 +52,7 @@
> > >>  			break;						\
> > >>  		}							\
> > >>  		if (W && drm_can_sleep())  {				\
> > >> -			msleep(W);					\
> > >> +			usleep_range(W * 1000, W * 2 * 1000);		\
> > >>  		} else {						\
> > >>  			cpu_relax();					\
> > >>  		}							\
> > >
> > > Ok. But W is still just a random value we picked for being the mininum 
> > > legal value for msleep(). So just usleep_range(500, 2000) or somesuch 
> > > will be fine. We can rename W to CAN_SLEEP it that helps.
> > 
> > We do use _wait_for directly from intel_dp.c with W == 10 to not retry so many times on what's expected to be a long wait.
> 
> Hmm, missed that. We can fallback to the fallback plan of switching
> based on W between msleep and usleep_range. Using -1, would be best.
> 
>  if (W && drm_can_sleep()) {
>   if (__builtin_constant_p(W) && W < 0)
>      usleep_range(500, 2000);
>   else
>      msleep(W);
>  }
>  
> > Its not expected to be too long, we tend to get vblank every 16ms.  With using usleep_range
> > with min and max as 1-2ms, we have observed that this function consuming 4ms to 17ms.
> 
> vs msleep()? That would be nice information to capture in the changelog.
> We expect the average wait here to be 8ms, ofc.
> 
> > Having 10ms sleep timer, we might tend to be blocking for 6ms in some cases.(from the above data)
> > Moreover 10ms usleep doesn't guarantee that we get a chance to execute after 10ms, it might
> > get increased due to scheduling. So ideal solution would be to use useep_range which uses hrtimers.
> 
> Ideal for what? We only use the sleeping path where we do not care too
> great about the latency, otherwise we use the busy-wait path. Improving
> the latency of the sleep without adversely affecting overall system
> performance/power is ideal.

We've used it in a few places where we'd care a bit more about latency
(like edid reads) but on most platforms those switched to interrupts now.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-03-24  9:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24  8:13 [PATCH] drm/i915: use hrtimer in wait for vblank Arun R Murthy
2014-03-24  8:51 ` Chris Wilson
2014-03-24  9:22   ` Murthy, Arun R
2014-03-24  9:23   ` Jani Nikula
2014-03-24  9:34     ` Murthy, Arun R
2014-03-24  9:48       ` Chris Wilson
2014-03-24  9:55         ` Daniel Vetter [this message]
2014-03-24  9:59           ` Murthy, Arun R
2014-03-24 10:00       ` Daniel Vetter
2014-03-24 10:14         ` Murthy, Arun R

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=20140324095544.GE26878@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=arun.r.murthy@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    /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