[PATCH 2/3] drm/i915: Fix unintended submission flush after retire times out

From: Janusz Krzysztofik
Date: Wed Nov 09 2022 - 14:11:08 EST


If wait on request DMA fence times out while we are retiring requests,
-ETIME is stored as remaining time. Then, flush_submission() called
thereafter proceeds with its work instead of returning immediately due to
the value of timeout passed to it not equal 0. That's probably not what
was intended.

Fix it by replacing -ETIME value of the argument with 0.

Fixes: 09137e945437 ("drm/i915/gem: Unpin idle contexts from kswapd reclaim")
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@xxxxxxxxxxxxxxx>
---
drivers/gpu/drm/i915/gt/intel_gt_requests.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
index 6c3b8ac3055c3..309d5937d6910 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
@@ -204,7 +204,7 @@ out_active: spin_lock(&timelines->lock);
list_for_each_entry_safe(tl, tn, &free, link)
__intel_timeline_free(&tl->kref);

- if (flush_submission(gt, timeout)) /* Wait, there's more! */
+ if (flush_submission(gt, timeout > 0)) /* Wait, there's more! */
active_count++;

if (remaining_timeout)
--
2.25.1