drm/i915/gt: Convert timeline tracking to spinlock
Convert the active_list manipulation of timelines to use spinlocks so that we can perform the updates from underneath a quick interrupt callback, if need be. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190815205709.24285-2-chris@chris-wilson.co.uk
This commit is contained in:
@@ -897,18 +897,18 @@ static long
|
||||
wait_for_timelines(struct drm_i915_private *i915,
|
||||
unsigned int flags, long timeout)
|
||||
{
|
||||
struct intel_gt_timelines *gt = &i915->gt.timelines;
|
||||
struct intel_gt_timelines *timelines = &i915->gt.timelines;
|
||||
struct intel_timeline *tl;
|
||||
|
||||
mutex_lock(>->mutex);
|
||||
list_for_each_entry(tl, >->active_list, link) {
|
||||
spin_lock(&timelines->lock);
|
||||
list_for_each_entry(tl, &timelines->active_list, link) {
|
||||
struct i915_request *rq;
|
||||
|
||||
rq = i915_active_request_get_unlocked(&tl->last_request);
|
||||
if (!rq)
|
||||
continue;
|
||||
|
||||
mutex_unlock(>->mutex);
|
||||
spin_unlock(&timelines->lock);
|
||||
|
||||
/*
|
||||
* "Race-to-idle".
|
||||
@@ -928,10 +928,10 @@ wait_for_timelines(struct drm_i915_private *i915,
|
||||
return timeout;
|
||||
|
||||
/* restart after reacquiring the lock */
|
||||
mutex_lock(>->mutex);
|
||||
tl = list_entry(>->active_list, typeof(*tl), link);
|
||||
spin_lock(&timelines->lock);
|
||||
tl = list_entry(&timelines->active_list, typeof(*tl), link);
|
||||
}
|
||||
mutex_unlock(>->mutex);
|
||||
spin_unlock(&timelines->lock);
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
Reference in New Issue
Block a user