From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: use hrtimer in wait for vblank Date: Mon, 24 Mar 2014 11:00:50 +0100 Message-ID: <20140324100050.GF26878@phenom.ffwll.local> References: <1395648818-14310-1-git-send-email-arun.r.murthy@intel.com> <20140324085134.GJ4366@nuc-i3427.alporthouse.com> <8761n4vtjl.fsf@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 32B826E937 for ; Mon, 24 Mar 2014 03:00:57 -0700 (PDT) Received: by mail-ee0-f48.google.com with SMTP id b57so4182886eek.21 for ; Mon, 24 Mar 2014 03:00:55 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "Murthy, Arun R" Cc: "airlied@linux.ie" , "daniel.vetter@ffwll.ch" , "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org 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. > > 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. > 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. Can you please do proper quoting when replying? It makes it fairly hard to figure out what's your response when you reply in-line, especially in more complicated threads. And top-posting isn't an option either, especially for more in-depth discussions where the different issues need to be treated as separate points. You need a real mail client for this, Outlook won't cut it. Jesse is floating slides internal with all the details and tons of links to resources. Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch