Skip to content

Commit 15b9cbb

Browse files
icklejlahtine-intel
authored andcommitted
Revert "drm/i915/gt: Wait for new requests in intel_gt_retire_requests()"
From inside an active timeline in the execbuf ioctl, we may try to reclaim some space in the GGTT. We need GGTT space for all objects on !full-ppgtt platforms, and for context images everywhere. However, to free up space in the GGTT we may need to remove some pinned objects (e.g. context images) that require flushing the idle barriers to remove. For this we use the big hammer of intel_gt_wait_for_idle() However, commit 7936a22 ("drm/i915/gt: Wait for new requests in intel_gt_retire_requests()") will continue spinning on the wait if a timeline is active but lacks requests, as is the case during execbuf reservation. Spinning forever is quite time consuming, so revert that commit and start again. In practice, the effect commit 7936a22 was trying to achieve is accomplished by commit 1683d24 ("drm/i915/gt: Move new timelines to the end of active_list"), so there is no immediate rush to replace the looping. Testcase: igt/gem_exec_reloc/basic-range Fixes: a46bfdc ("drm/i915/gt: Wait for new requests in intel_gt_retire_requests()") References: 1683d24 ("drm/i915/gt: Move new timelines to the end of active_list") Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Joonas Lahtinen <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 689122d) [Joonas: Corrected Fixes: tag ref to match drm-intel-next-fixes] Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 0122baa commit 15b9cbb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/gpu/drm/i915/gt/intel_gt_requests.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
3333
{
3434
struct intel_gt_timelines *timelines = &gt->timelines;
3535
struct intel_timeline *tl, *tn;
36+
unsigned long active_count = 0;
3637
unsigned long flags;
3738
bool interruptible;
3839
LIST_HEAD(free);
@@ -45,8 +46,10 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
4546

4647
spin_lock_irqsave(&timelines->lock, flags);
4748
list_for_each_entry_safe(tl, tn, &timelines->active_list, link) {
48-
if (!mutex_trylock(&tl->mutex))
49+
if (!mutex_trylock(&tl->mutex)) {
50+
active_count++; /* report busy to caller, try again? */
4951
continue;
52+
}
5053

5154
intel_timeline_get(tl);
5255
GEM_BUG_ON(!tl->active_count);
@@ -73,6 +76,8 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
7376
list_safe_reset_next(tl, tn, link);
7477
if (!--tl->active_count)
7578
list_del(&tl->link);
79+
else
80+
active_count += !!rcu_access_pointer(tl->last_request.fence);
7681

7782
mutex_unlock(&tl->mutex);
7883

@@ -87,7 +92,7 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
8792
list_for_each_entry_safe(tl, tn, &free, link)
8893
__intel_timeline_free(&tl->kref);
8994

90-
return list_empty(&timelines->active_list) ? 0 : timeout;
95+
return active_count ? timeout : 0;
9196
}
9297

9398
int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout)

0 commit comments

Comments
 (0)