diff mbox

[1/2] drm/i915: Balance context pinning on reset cleanup

Message ID 1421141545-14233-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Jan. 13, 2015, 9:32 a.m. UTC
We pin when we submit to execlist queue. Balance
the pinning when the submitted queue is cleaned on reset.

Cc: Dave Gordon <david.s.gordon@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c  | 4 ++++
 drivers/gpu/drm/i915/intel_lrc.c | 1 +
 2 files changed, 5 insertions(+)

Comments

Thomas Daniel Jan. 20, 2015, 4:14 p.m. UTC | #1
> -----Original Message-----

> From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Mika Kuoppala

> Sent: Tuesday, January 13, 2015 9:32 AM

> To: intel-gfx@lists.freedesktop.org

> Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Balance context pinning on reset

> cleanup

> 

> We pin when we submit to execlist queue. Balance the pinning when the

> submitted queue is cleaned on reset.

> 

> Cc: Dave Gordon <david.s.gordon@intel.com>

> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

> ---

>  drivers/gpu/drm/i915/i915_gem.c  | 4 ++++

> drivers/gpu/drm/i915/intel_lrc.c | 1 +

>  2 files changed, 5 insertions(+)

> 

> diff --git a/drivers/gpu/drm/i915/i915_gem.c

> b/drivers/gpu/drm/i915/i915_gem.c index 6c40365..68ea67d 100644

> --- a/drivers/gpu/drm/i915/i915_gem.c

> +++ b/drivers/gpu/drm/i915/i915_gem.c

> @@ -2657,6 +2657,10 @@ static void i915_gem_reset_ring_cleanup(struct

> drm_i915_private *dev_priv,

>  				execlist_link);

>  		list_del(&submit_req->execlist_link);

>  		intel_runtime_pm_put(dev_priv);

> +

> +		if (submit_req->ctx != ring->default_context)

> +			intel_lr_context_unpin(ring, submit_req->ctx);

> +

>  		i915_gem_context_unreference(submit_req->ctx);

>  		kfree(submit_req);

>  	}

> diff --git a/drivers/gpu/drm/i915/intel_lrc.c

> b/drivers/gpu/drm/i915/intel_lrc.c

> index 7670a0f..56a3625 100644

> --- a/drivers/gpu/drm/i915/intel_lrc.c

> +++ b/drivers/gpu/drm/i915/intel_lrc.c

> @@ -1774,6 +1774,7 @@ void intel_lr_context_free(struct intel_context

> *ctx)

>  				intel_unpin_ringbuffer_obj(ringbuf);

>  				i915_gem_object_ggtt_unpin(ctx_obj);

>  			}

> +			WARN_ON(ctx->engine[ring->id].unpin_count);

>  			intel_destroy_ringbuffer_obj(ringbuf);

>  			kfree(ringbuf);

>  			drm_gem_object_unreference(&ctx_obj->base);


Assuming this still patch still applies after Nick Hoath's recent changes,
Reviewed-by: Thomas Daniel <thomas.daniel@intel.com>


Note that there is still a bug in reset_ring_cleanup where neither the ring buffers nor the contexts head and tail are updated in execlists mode but the requests are cleaned out.  I will post a separate patch for that soon.

Thomas.
Daniel Vetter Jan. 21, 2015, 8:31 a.m. UTC | #2
On Tue, Jan 20, 2015 at 04:14:58PM +0000, Daniel, Thomas wrote:
> > -----Original Message-----
> > From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf
> > Of Mika Kuoppala
> > Sent: Tuesday, January 13, 2015 9:32 AM
> > To: intel-gfx@lists.freedesktop.org
> > Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Balance context pinning on reset
> > cleanup
> > 
> > We pin when we submit to execlist queue. Balance the pinning when the
> > submitted queue is cleaned on reset.
> > 
> > Cc: Dave Gordon <david.s.gordon@intel.com>
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c  | 4 ++++
> > drivers/gpu/drm/i915/intel_lrc.c | 1 +
> >  2 files changed, 5 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c
> > b/drivers/gpu/drm/i915/i915_gem.c index 6c40365..68ea67d 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -2657,6 +2657,10 @@ static void i915_gem_reset_ring_cleanup(struct
> > drm_i915_private *dev_priv,
> >  				execlist_link);
> >  		list_del(&submit_req->execlist_link);
> >  		intel_runtime_pm_put(dev_priv);
> > +
> > +		if (submit_req->ctx != ring->default_context)
> > +			intel_lr_context_unpin(ring, submit_req->ctx);
> > +
> >  		i915_gem_context_unreference(submit_req->ctx);
> >  		kfree(submit_req);
> >  	}
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c
> > b/drivers/gpu/drm/i915/intel_lrc.c
> > index 7670a0f..56a3625 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -1774,6 +1774,7 @@ void intel_lr_context_free(struct intel_context
> > *ctx)
> >  				intel_unpin_ringbuffer_obj(ringbuf);
> >  				i915_gem_object_ggtt_unpin(ctx_obj);
> >  			}
> > +			WARN_ON(ctx->engine[ring->id].unpin_count);
> >  			intel_destroy_ringbuffer_obj(ringbuf);
> >  			kfree(ringbuf);
> >  			drm_gem_object_unreference(&ctx_obj->base);
> 
> Assuming this still patch still applies after Nick Hoath's recent changes,
> Reviewed-by: Thomas Daniel <thomas.daniel@intel.com>

Both merged, thanks for patches&review.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6c40365..68ea67d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2657,6 +2657,10 @@  static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
 				execlist_link);
 		list_del(&submit_req->execlist_link);
 		intel_runtime_pm_put(dev_priv);
+
+		if (submit_req->ctx != ring->default_context)
+			intel_lr_context_unpin(ring, submit_req->ctx);
+
 		i915_gem_context_unreference(submit_req->ctx);
 		kfree(submit_req);
 	}
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 7670a0f..56a3625 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1774,6 +1774,7 @@  void intel_lr_context_free(struct intel_context *ctx)
 				intel_unpin_ringbuffer_obj(ringbuf);
 				i915_gem_object_ggtt_unpin(ctx_obj);
 			}
+			WARN_ON(ctx->engine[ring->id].unpin_count);
 			intel_destroy_ringbuffer_obj(ringbuf);
 			kfree(ringbuf);
 			drm_gem_object_unreference(&ctx_obj->base);