path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2021-12-22 16:56:22 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2021-12-23 12:30:27 +0100
commit6cb12fbda1c2e2fcb6d3adfe01f18eef6812e278 (patch)
tree2421af963bdeee00ea0f3a5f9bd543d47a8b9376 /drivers/gpu/drm/i915/i915_drv.h
parentdrm/i915: Require the vm mutex for i915_vma_bind() (diff)
drm/i915: Use trylock instead of blocking lock for __i915_gem_free_objects.
Convert free_work into delayed_work, similar to ttm to allow converting the blocking lock in __i915_gem_free_objects to a trylock. Unlike ttm, the object should already be idle, as it's kept alive by a reference through struct i915_vma->active, which is dropped after all vma's are idle. Because of this, we can use a no wait by default, or when the lock is contested, we use ttm's 10 ms. The trylock should only fail when the object is sharing it's resv with other objects, and typically objects are not kept locked for a long time, so we can safely retry on failure. Fixes: be7612fd6665 ("drm/i915: Require object lock when freeing pages during destruction") Testcase: igt/gem_exec_alignment/pi* Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211222155622.2960379-1-maarten.lankhorst@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ec6dc5080991..cb4cf6786bd3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -601,7 +601,7 @@ struct i915_gem_mm {
* List of objects which are pending destruction.
struct llist_head free_list;
- struct work_struct free_work;
+ struct delayed_work free_work;
* Count of objects pending destructions. Used to skip needlessly
* waiting on an RCU barrier if no objects are waiting to be freed.
@@ -1835,7 +1835,7 @@ static inline void i915_gem_drain_freed_objects(struct drm_i915_private *i915)
* armed the work again.
while (atomic_read(&i915->mm.free_count)) {
- flush_work(&i915->mm.free_work);
+ flush_delayed_work(&i915->mm.free_work);