]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Use trylock instead of blocking lock for __i915_gem_free_objects.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 22 Dec 2021 15:56:22 +0000 (16:56 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thu, 23 Dec 2021 11:30:27 +0000 (12:30 +0100)
commit18c675bff7f2a92763264eea0be02e0ada6094aa
tree2421af963bdeee00ea0f3a5f9bd543d47a8b9376
parent53eb13af3523d13ffe778e03a498b421ed7ca3e1
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: fb7c93594a2e ("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
drivers/gpu/drm/i915/gem/i915_gem_object.c
drivers/gpu/drm/i915/i915_drv.h