drm/i915: Remove waiting & retiring from shrinker paths
i915_gem_wait_for_idle() and i915_retire_requests() introduce a dependency on the timeline->mutex. This is problematic as we want to later perform allocations underneath i915_active.mutex, forming a link between the shrinker, the timeline and active mutexes. Nip this cycle in the bud by removing the acquisition of the timeline mutex (i.e. retiring) from inside the shrinker. 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/20190621183801.23252-1-chris@chris-wilson.co.uk
This commit is contained in:
parent
2ae70d28f2
commit
9e9539800d
4 changed files with 4 additions and 14 deletions
|
@ -169,7 +169,6 @@ i915_gem_shrink(struct drm_i915_private *i915,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
trace_i915_gem_shrink(i915, target, shrink);
|
trace_i915_gem_shrink(i915, target, shrink);
|
||||||
i915_retire_requests(i915);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unbinding of objects will require HW access; Let us not wake the
|
* Unbinding of objects will require HW access; Let us not wake the
|
||||||
|
@ -269,8 +268,6 @@ i915_gem_shrink(struct drm_i915_private *i915,
|
||||||
if (shrink & I915_SHRINK_BOUND)
|
if (shrink & I915_SHRINK_BOUND)
|
||||||
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
|
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
|
||||||
|
|
||||||
i915_retire_requests(i915);
|
|
||||||
|
|
||||||
shrinker_unlock(i915, unlock);
|
shrinker_unlock(i915, unlock);
|
||||||
|
|
||||||
if (nr_scanned)
|
if (nr_scanned)
|
||||||
|
@ -427,12 +424,6 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
|
||||||
if (!shrinker_lock(i915, 0, &unlock))
|
if (!shrinker_lock(i915, 0, &unlock))
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
|
||||||
/* Force everything onto the inactive lists */
|
|
||||||
if (i915_gem_wait_for_idle(i915,
|
|
||||||
I915_WAIT_LOCKED,
|
|
||||||
MAX_SCHEDULE_TIMEOUT))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
|
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
|
||||||
freed_pages += i915_gem_shrink(i915, -1UL, NULL,
|
freed_pages += i915_gem_shrink(i915, -1UL, NULL,
|
||||||
I915_SHRINK_BOUND |
|
I915_SHRINK_BOUND |
|
||||||
|
@ -455,7 +446,6 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
|
||||||
}
|
}
|
||||||
mutex_unlock(&i915->ggtt.vm.mutex);
|
mutex_unlock(&i915->ggtt.vm.mutex);
|
||||||
|
|
||||||
out:
|
|
||||||
shrinker_unlock(i915, unlock);
|
shrinker_unlock(i915, unlock);
|
||||||
|
|
||||||
*(unsigned long *)ptr += freed_pages;
|
*(unsigned long *)ptr += freed_pages;
|
||||||
|
|
|
@ -427,6 +427,9 @@ create_test_object(struct i915_gem_context *ctx,
|
||||||
u64 size;
|
u64 size;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
/* Keep in GEM's good graces */
|
||||||
|
i915_retire_requests(ctx->i915);
|
||||||
|
|
||||||
size = min(vm->total / 2, 1024ull * DW_PER_PAGE * PAGE_SIZE);
|
size = min(vm->total / 2, 1024ull * DW_PER_PAGE * PAGE_SIZE);
|
||||||
size = round_down(size, DW_PER_PAGE * PAGE_SIZE);
|
size = round_down(size, DW_PER_PAGE * PAGE_SIZE);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct intel_gt {
|
||||||
struct i915_ggtt *ggtt;
|
struct i915_ggtt *ggtt;
|
||||||
|
|
||||||
struct intel_gt_timelines {
|
struct intel_gt_timelines {
|
||||||
struct mutex mutex; /* protects list, tainted by GPU */
|
struct mutex mutex; /* protects list */
|
||||||
struct list_head active_list;
|
struct list_head active_list;
|
||||||
|
|
||||||
/* Pack multiple timelines' seqnos into the same page */
|
/* Pack multiple timelines' seqnos into the same page */
|
||||||
|
|
|
@ -268,9 +268,6 @@ static void timelines_init(struct intel_gt *gt)
|
||||||
|
|
||||||
spin_lock_init(&timelines->hwsp_lock);
|
spin_lock_init(&timelines->hwsp_lock);
|
||||||
INIT_LIST_HEAD(&timelines->hwsp_free_list);
|
INIT_LIST_HEAD(&timelines->hwsp_free_list);
|
||||||
|
|
||||||
/* via i915_gem_wait_for_idle() */
|
|
||||||
i915_gem_shrinker_taints_mutex(gt->i915, &timelines->mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_timelines_init(struct drm_i915_private *i915)
|
void intel_timelines_init(struct drm_i915_private *i915)
|
||||||
|
|
Loading…
Add table
Reference in a new issue