Skip to content

Commit e639ea0

Browse files
committed
Merge tag 'drm-intel-next-fixes-2019-11-22' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
- Reverts a patch to avoid spinning forever when context's timeline is active but has no requests Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 17eee66 + 15b9cbb commit e639ea0

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)