[Intel-gfx] [PATCH] drm/i915/gt: Check carefully for an idle engine in wait-for-idle
Chris Wilson
chris at chris-wilson.co.uk
Thu Apr 23 06:38:30 UTC 2020
Quoting Chris Wilson (2020-04-23 07:29:05)
> intel_gt_wait_for_idle() tries to wait until all the outstanding requests
> are retired and the GPU is idle. As a side effect of retiring requests,
> we may submit more work to flush any pm barriers, and so the
> wait-for-idle tries to flush the background pm work and catch the new
> requests. However, if the work completed in the background before we
> were able to flush, it would queue the extra barrier request without us
> noticing -- and so we would return from wait-for-idle with one request
> remaining. (This breaks e.g. record_default_state where we need to wait
> until that barrier is retired, and it may slow suspend down by causing
> us to wait on the background retirement worker as opposed to immediately
> retiring the barrier.)
>
> However, since we track if there has been a submission since the engine
> pm barrier, we can very quickly detect if the idle barrier is still
> outstanding.
>
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1763
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_gt_requests.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> index dec96a731a77..1781f176886a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> @@ -26,6 +26,11 @@ static bool retire_requests(struct intel_timeline *tl)
> return !i915_active_fence_isset(&tl->last_request);
> }
>
> +static bool engine_active(const struct intel_engine_cs *engine)
> +{
> + return READ_ONCE(engine->wakeref_serial) != READ_ONCE(engine->serial);
This will be false when we have submitted but not yet retired. I was
better with checking the timeline.
-Chris
More information about the Intel-gfx
mailing list