From: Daniel Vetter Subject: Re: [PATCH 3/7] drm/i915/vlv: Not reallocating VLV PCTX upon every suspend/resume Date: Thu, 9 Jan 2014 08:03:47 +0100 Message-ID: <20140109070346.GX4770@phenom.ffwll.local> References: <1389245442-10947-1-git-send-email-akash.goel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f179.google.com (mail-ea0-f179.google.com [209.85.215.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CC4A105E8B for ; Wed, 8 Jan 2014 23:02:30 -0800 (PST) Received: by mail-ea0-f179.google.com with SMTP id r15so1250259ead.38 for ; Wed, 08 Jan 2014 23:02:29 -0800 (PST) Content-Disposition: inline In-Reply-To: <1389245442-10947-1-git-send-email-akash.goel@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: akash.goel@intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Jan 09, 2014 at 11:00:42AM +0530, akash.goel@intel.com wrote: > From: Akash Goel > > VLV PCTX will come from stolen memory. Upon every suspend/resume cycle, > this is being deallocated/reallocated. Given that PCTX has to be there > at a constant stolen memory offset, doing this is not required. Also > there is a chance of it getting corrupted, if this range gets used for > some other allocation(on resume), which can result in GPU hangs. > > Signed-off-by: Akash Goel > --- > drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +++++ > drivers/gpu/drm/i915/intel_pm.c | 9 ++++----- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c > index 29b3693..5cf97d6 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -213,6 +213,11 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) > if (!drm_mm_initialized(&dev_priv->mm.stolen)) > return; > > + if (dev_priv->vlv_pctx) { > + drm_gem_object_unreference(&dev_priv->vlv_pctx->base); > + dev_priv->vlv_pctx = NULL; > + } This should be extracted into a intel_pm_teardown to mirror intel_pm_setup. I know that we already cleanup the fbc allocations here, but for sane driver teardown code we should move all those deallocations out eventually and just have a WARN_ON(drm_mm_not_empty) in here before tearing down the stolen mem subsystem. -Daniel > + > i915_gem_stolen_cleanup_compression(dev); > drm_mm_takedown(&dev_priv->mm.stolen); > } > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c > index 469170c..369cc73 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -3138,11 +3138,6 @@ static void valleyview_disable_rps(struct drm_device *dev) > I915_WRITE(GEN6_RC_CONTROL, 0); > > gen6_disable_rps_interrupts(dev); > - > - if (dev_priv->vlv_pctx) { > - drm_gem_object_unreference(&dev_priv->vlv_pctx->base); > - dev_priv->vlv_pctx = NULL; > - } > } > > static void intel_print_rc6_info(struct drm_device *dev, u32 mode) > @@ -3508,6 +3503,10 @@ static void valleyview_setup_pctx(struct drm_device *dev) > u32 pcbr; > int pctx_size = 24*1024; > > + /* If PC Context is already there, then bail out*/ > + if (dev_priv->vlv_pctx) > + return; > + > pcbr = I915_READ(VLV_PCBR); > if (pcbr) { > /* BIOS set it up already, grab the pre-alloc'd space */ > -- > 1.8.5.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch