From: Daniel Vetter Subject: Re: [PATCH 3/6] drm/i915: Optimize the VLV Punit wait a bit Date: Wed, 26 Jun 2013 12:17:55 +0200 Message-ID: <20130626101755.GB18285@phenom.ffwll.local> References: <1372177266-2665-1-git-send-email-ville.syrjala@linux.intel.com> <1372177266-2665-4-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com [209.85.215.173]) by gabe.freedesktop.org (Postfix) with ESMTP id DF0B4E62D6 for ; Wed, 26 Jun 2013 03:17:59 -0700 (PDT) Received: by mail-ea0-f173.google.com with SMTP id g15so7468052eak.4 for ; Wed, 26 Jun 2013 03:17:58 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1372177266-2665-4-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Jun 25, 2013 at 07:21:03PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > Don't do needless udelay() calls if the Punit already completed > the frequency change. > = > Also double check things after the timeout to make sure the timeout > wasn't just caused by some scheduling delays. > = > Signed-off-by: Ville Syrj=E4l=E4 > --- > drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel= _pm.c > index 6dbcad7..6b98d45 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -3078,14 +3078,20 @@ static void vlv_update_rps_cur_delay(struct drm_i= 915_private *dev_priv) > = > WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); > = > - do { > - pval =3D vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); > + pval =3D vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); > + > + while (pval & 1) { > if (time_after(jiffies, timeout)) { > - DRM_DEBUG_DRIVER("timed out waiting for Punit\n"); > + pval =3D vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); > break; > } > + > udelay(10); > - } while (pval & 1); > + pval =3D vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS); > + } > + > + if (pval & 1) > + DRM_DEBUG_DRIVER("timed out waiting for Punit\n"); Since we notoriously get these suckers wrong and this check isn't really in the critical path any more (the punit should have complete the last change already) and furthermore in a work item: Can we just use one of our bog-standard wait_for macros here now? -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch