diff mbox

[3/3] drm/i915: don't rewrite the GTT on resume

Message ID 1350267038-3599-3-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes Oct. 15, 2012, 2:10 a.m. UTC
The BIOS shouldn't be touching this memory across suspend/resume, so
just leave it alone.  This saves us ~50ms on resume on my T420.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_drv.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Oct. 15, 2012, 7:41 a.m. UTC | #1
On Sun, Oct 14, 2012 at 07:10:38PM -0700, Jesse Barnes wrote:
> The BIOS shouldn't be touching this memory across suspend/resume, so
> just leave it alone.  This saves us ~50ms on resume on my T420.

Is that 50ms still accurate with wc gtt ptes?
-Daniel

> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 824e3c8..95e2b8b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -119,6 +119,10 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
>  MODULE_PARM_DESC(i915_enable_ppgtt,
>  		"Enable PPGTT (default: true)");
>  
> +int i915_needs_gtt_restore __read_mostly = 0;
> +module_param_named(gtt_restore, i915_needs_gtt_restore, int, 0600);
> +MODULE_PARM_DESC(gtt_restore, "Rewrite GTT on resume (default: false)");
> +
>  static struct drm_driver driver;
>  extern int intel_agp_enabled;
>  
> @@ -537,7 +541,8 @@ static int i915_drm_thaw(struct drm_device *dev)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int error = 0;
>  
> -	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
> +	    i915_needs_gtt_restore) {
>  		mutex_lock(&dev->struct_mutex);
>  		i915_gem_restore_gtt_mappings(dev);
>  		mutex_unlock(&dev->struct_mutex);
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Oct. 15, 2012, 8:37 a.m. UTC | #2
On Sun, 14 Oct 2012 19:10:38 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> The BIOS shouldn't be touching this memory across suspend/resume, so
> just leave it alone.  This saves us ~50ms on resume on my T420.
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 824e3c8..95e2b8b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -119,6 +119,10 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
>  MODULE_PARM_DESC(i915_enable_ppgtt,
>  		"Enable PPGTT (default: true)");
>  
> +int i915_needs_gtt_restore __read_mostly = 0;
> +module_param_named(gtt_restore, i915_needs_gtt_restore, int, 0600);
> +MODULE_PARM_DESC(gtt_restore, "Rewrite GTT on resume (default: false)");

Wrong way around. This code exists purely because KMS resume was broken
on a number of machines without reinitialising the GTT, ergo this is a
regression.
-Chris
Chris Wilson Oct. 15, 2012, 9:42 a.m. UTC | #3
On Mon, 15 Oct 2012 09:37:00 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Sun, 14 Oct 2012 19:10:38 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > The BIOS shouldn't be touching this memory across suspend/resume, so
> > just leave it alone.  This saves us ~50ms on resume on my T420.
> > 
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 824e3c8..95e2b8b 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -119,6 +119,10 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
> >  MODULE_PARM_DESC(i915_enable_ppgtt,
> >  		"Enable PPGTT (default: true)");
> >  
> > +int i915_needs_gtt_restore __read_mostly = 0;
> > +module_param_named(gtt_restore, i915_needs_gtt_restore, int, 0600);
> > +MODULE_PARM_DESC(gtt_restore, "Rewrite GTT on resume (default: false)");
> 
> Wrong way around. This code exists purely because KMS resume was broken
> on a number of machines without reinitialising the GTT, ergo this is a
> regression.

Looking into the history, at the time we wrote the GTT reinit, I believe
we did not have a GFX_FLUSH_CNTL in the resume path. Now we do, so I'd
be more inclined to believe that we have fixed a bug in the meantime. If
so, we only need to be extra careful for gen2.
-Chris
Jesse Barnes Oct. 15, 2012, 3:49 p.m. UTC | #4
On Mon, 15 Oct 2012 09:41:33 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Sun, Oct 14, 2012 at 07:10:38PM -0700, Jesse Barnes wrote:
> > The BIOS shouldn't be touching this memory across suspend/resume, so
> > just leave it alone.  This saves us ~50ms on resume on my T420.
> 
> Is that 50ms still accurate with wc gtt ptes?

No, I haven't done timings since we switched.  If we determine that the
tlb invalidate is sufficient to fix the problems we saw earlier that
made us do the rewrite, then maybe we can just remove it in favor of a
debug option to CRC the GTT PTEs per my previous patch, and remove this
code altogether.

Jesse
Jesse Barnes Oct. 15, 2012, 3:49 p.m. UTC | #5
On Mon, 15 Oct 2012 10:42:03 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Mon, 15 Oct 2012 09:37:00 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > On Sun, 14 Oct 2012 19:10:38 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > > The BIOS shouldn't be touching this memory across suspend/resume, so
> > > just leave it alone.  This saves us ~50ms on resume on my T420.
> > > 
> > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > > ---
> > >  drivers/gpu/drm/i915/i915_drv.c |    7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > > index 824e3c8..95e2b8b 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.c
> > > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > > @@ -119,6 +119,10 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
> > >  MODULE_PARM_DESC(i915_enable_ppgtt,
> > >  		"Enable PPGTT (default: true)");
> > >  
> > > +int i915_needs_gtt_restore __read_mostly = 0;
> > > +module_param_named(gtt_restore, i915_needs_gtt_restore, int, 0600);
> > > +MODULE_PARM_DESC(gtt_restore, "Rewrite GTT on resume (default: false)");
> > 
> > Wrong way around. This code exists purely because KMS resume was broken
> > on a number of machines without reinitialising the GTT, ergo this is a
> > regression.
> 
> Looking into the history, at the time we wrote the GTT reinit, I believe
> we did not have a GFX_FLUSH_CNTL in the resume path. Now we do, so I'd
> be more inclined to believe that we have fixed a bug in the meantime. If
> so, we only need to be extra careful for gen2.

Yeah good point, do we have victims who can check this for us?

Jesse
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 824e3c8..95e2b8b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -119,6 +119,10 @@  module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
 MODULE_PARM_DESC(i915_enable_ppgtt,
 		"Enable PPGTT (default: true)");
 
+int i915_needs_gtt_restore __read_mostly = 0;
+module_param_named(gtt_restore, i915_needs_gtt_restore, int, 0600);
+MODULE_PARM_DESC(gtt_restore, "Rewrite GTT on resume (default: false)");
+
 static struct drm_driver driver;
 extern int intel_agp_enabled;
 
@@ -537,7 +541,8 @@  static int i915_drm_thaw(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int error = 0;
 
-	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
+	    i915_needs_gtt_restore) {
 		mutex_lock(&dev->struct_mutex);
 		i915_gem_restore_gtt_mappings(dev);
 		mutex_unlock(&dev->struct_mutex);