From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH v4] drm/i915: use hrtimer in wait for vblank Date: Tue, 1 Apr 2014 09:29:46 +0200 Message-ID: <20140401072946.GD22327@phenom.ffwll.local> References: <1395737902-11984-1-git-send-email-arun.r.murthy@intel.com> <20140325090703.GY4366@nuc-i3427.alporthouse.com> <87eh1qvd20.fsf@intel.com> <53315074.6050502@gmail.com> <5333AD9E.2000800@gmail.com> <533A441C.4040309@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id BC4236E4D7 for ; Tue, 1 Apr 2014 00:29:51 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id x13so7029335wgg.14 for ; Tue, 01 Apr 2014 00:29:50 -0700 (PDT) Content-Disposition: inline In-Reply-To: <533A441C.4040309@gmail.com> 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" , "Murthy, Arun R" List-Id: intel-gfx@lists.freedesktop.org On Tue, Apr 01, 2014 at 10:14:12AM +0530, Murthy, Arun R wrote: > On Thursday 27 March 2014 10:18 AM, Murthy, Arun R wrote: > >On Tuesday 25 March 2014 03:16 PM, Murthy, Arun R wrote: > >>On Tuesday 25 March 2014 03:02 PM, Jani Nikula wrote: > >>>On Tue, 25 Mar 2014, Chris Wilson wrote: > >>>>On Tue, Mar 25, 2014 at 02:28:22PM +0530, Arun R Murthy wrote: > >>>>>In wait for vblank use usleep_range, which will use hrtimers instead of > >>>>>msleep. Using msleep(1~20) there are more chances of sleeping for 20ms. > >>>>>Using usleep_range uses hrtimers and hence are precise, worst case will > >>>>>trigger an interrupt at the higher/max timeout. > >>>>> > >>>>>As per kernel document "Documentation/timers/timers-howto.txt" sleeping > >>>>>for 10us to 20ms its recomended to use usleep_range. > >>>>> > >>>>>Signed-off-by: Arun R Murthy > >>>>Lgtm, I still feel that our use of W=1 is fairly arbitrary and worth > >>>>tweaking in future. > >>>With the current code, this is essentially the same as the original > >>>patch. We never have W > 20, and thus we always take the usleep_range() > >>>path. So W is definitely worth tweaking if we go with this now. > >>> > >>>Nitpick, the macro params should be parenthesized. This will now break > >>>for _wait_for(cond, 10, 2 + 1) and such. > >>wait_for(COND, TIMEOUT, ATOMIC, MS) > >>and remove all wait_for_X > >> > >>function will look like > >>_wait_for(COND< TIMEOUT, ATOMIC, MS) > >>{ > >> /* loop */ > >> /* check condition */ > >> if (atomic) > >> cpu_relax() > >> else > >> if (ms > 20) > >> msleep > >> else > >> usleep_range > >>} > >> > >>caller for wait_for will be setting all the parameters and hence no tweaks. > >Any comments on this? > Gentle reminder! See my other mail somewhere in one your patch resends: http://www.spinics.net/lists/intel-gfx/msg42439.html If this is really just to optimize vblank waits we can do much better. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch