[3/4] drm/i915: Reload PD tables after semaphore wait on gen8

Submitted by Chris Wilson on April 9, 2016, 10:14 a.m.

Details

Message ID 1460196886-15760-4-git-send-email-chris@chris-wilson.co.uk
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Chris Wilson April 9, 2016, 10:14 a.m.
When the engine idles waiting upon a semaphore, it loses its
pagetables and we must reload them before executing the batch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 62d09cf2ea8f..a4bab6466388 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1446,6 +1446,7 @@  gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
 {
 	struct intel_engine_cs *waiter = waiter_req->engine;
 	struct drm_i915_private *dev_priv = waiter->dev->dev_private;
+	struct i915_hw_ppgtt *ppgtt;
 	int ret;
 
 	ret = intel_ring_begin(waiter_req, 4);
@@ -1461,6 +1462,15 @@  gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
 	intel_ring_emit(waiter,
 			upper_32_bits(GEN8_WAIT_OFFSET(waiter, signaller->id)));
 	intel_ring_advance(waiter);
+
+	/* When the engine idles waiting upon a semaphore, it loses its
+	 * pagetables and we must reload them before executing the batch.
+	 * We do this on the i915_switch_context() following the wait and
+	 * before the dispatch.
+	 */
+	ppgtt = waiter_req->ctx->ppgtt;
+	if (ppgtt)
+		ppgtt->pd_dirty_rings |= intel_engine_flag(waiter_req->engine);
 	return 0;
 }
 

Comments

On Sat, Apr 09, 2016 at 11:14:45AM +0100, Chris Wilson wrote:
> When the engine idles waiting upon a semaphore, it loses its
> pagetables and we must reload them before executing the batch.

RCS shouldn't lose them IIRC, other engines yes. As I recall the
other way to avoid this would be to prevent the engine from
entering some power save mode during the wait, but I suppose
that might come at a power cost.

> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 62d09cf2ea8f..a4bab6466388 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -1446,6 +1446,7 @@ gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
>  {
>  	struct intel_engine_cs *waiter = waiter_req->engine;
>  	struct drm_i915_private *dev_priv = waiter->dev->dev_private;
> +	struct i915_hw_ppgtt *ppgtt;
>  	int ret;
>  
>  	ret = intel_ring_begin(waiter_req, 4);
> @@ -1461,6 +1462,15 @@ gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
>  	intel_ring_emit(waiter,
>  			upper_32_bits(GEN8_WAIT_OFFSET(waiter, signaller->id)));
>  	intel_ring_advance(waiter);
> +
> +	/* When the engine idles waiting upon a semaphore, it loses its
> +	 * pagetables and we must reload them before executing the batch.
> +	 * We do this on the i915_switch_context() following the wait and
> +	 * before the dispatch.
> +	 */
> +	ppgtt = waiter_req->ctx->ppgtt;
> +	if (ppgtt)
> +		ppgtt->pd_dirty_rings |= intel_engine_flag(waiter_req->engine);
>  	return 0;
>  }
>  
> -- 
> 2.8.0.rc3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Mon, Apr 11, 2016 at 10:34:14AM +0300, Ville Syrjälä wrote:
> On Sat, Apr 09, 2016 at 11:14:45AM +0100, Chris Wilson wrote:
> > When the engine idles waiting upon a semaphore, it loses its
> > pagetables and we must reload them before executing the batch.
> 
> RCS shouldn't lose them IIRC, other engines yes. As I recall the
> other way to avoid this would be to prevent the engine from
> entering some power save mode during the wait, but I suppose
> that might come at a power cost.

Right, this only affects !RCS.
Just changing to if (ppgtt && waiter_req->engine->id != RCS)
would be enough. Care to give a r-b with that in place since you've
checked bspec? :)
-Chris
On Mon, Apr 11, 2016 at 09:16:21AM +0100, Chris Wilson wrote:
> On Mon, Apr 11, 2016 at 10:34:14AM +0300, Ville Syrjälä wrote:
> > On Sat, Apr 09, 2016 at 11:14:45AM +0100, Chris Wilson wrote:
> > > When the engine idles waiting upon a semaphore, it loses its
> > > pagetables and we must reload them before executing the batch.
> > 
> > RCS shouldn't lose them IIRC, other engines yes. As I recall the
> > other way to avoid this would be to prevent the engine from
> > entering some power save mode during the wait, but I suppose
> > that might come at a power cost.
> 
> Right, this only affects !RCS.
> Just changing to if (ppgtt && waiter_req->engine->id != RCS)
> would be enough. Care to give a r-b with that in place since you've
> checked bspec? :)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>