[Intel-gfx] [PATCH] drm/i915: "Race-to-idle" on switching to the kernel context

Mika Kuoppala mika.kuoppala at linux.intel.com
Mon Aug 21 09:17:52 UTC 2017


Chris Wilson <chris at chris-wilson.co.uk> writes:

> During suspend we want to flush out all active contexts and their
> rendering. To do so we queue a request from the kernel's context, once
> we know that request is done, we know the GPU is completely idle. To
> speed up that switch bump the GPU clocks.
>
> Switching to the kernel context prior to idling is also used to enforce
> a barrier before changing OA properties, and when evicting active
> rendering from the global GTT. All cases where we do want to
> race-to-idle.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: David Weinehall <david.weinehall at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 58a2a44f88bd..ca1423ad2708 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -895,6 +895,7 @@ int i915_gem_switch_to_kernel_context(struct drm_i915_private *dev_priv)
>  
>  	for_each_engine(engine, dev_priv, id) {
>  		struct drm_i915_gem_request *req;
> +		bool active = false;
>  		int ret;
>  
>  		if (engine_has_kernel_context(engine))
> @@ -913,13 +914,17 @@ int i915_gem_switch_to_kernel_context(struct drm_i915_private *dev_priv)
>  			prev = i915_gem_active_raw(&tl->last_request,
>  						   &dev_priv->drm.struct_mutex);
>  			if (prev)
> -				i915_sw_fence_await_sw_fence_gfp(&req->submit,
> -								 &prev->submit,
> -								 GFP_KERNEL);
> +				active |= i915_sw_fence_await_sw_fence_gfp(&req->submit,
> +									   &prev->submit,
> +									   GFP_KERNEL) > 0;

There is no point of kicking the clocks if we are the only request left?

Well logical as the request is empty, just pondering if the actual ctx
save/restore would finish quicker.

-Mika

>  		}
>  
>  		ret = i915_switch_context(req);
> +
> +		if (active)
> +			gen6_rps_boost(req, NULL);
>  		i915_add_request(req);
> +
>  		if (ret)
>  			return ret;
>  	}
> -- 
> 2.14.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list