drm/i915: Add locking to i915_gem_evict_vm(), v3.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 17 Jan 2022 07:56:04 +0000 (08:56 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 18 Jan 2022 11:00:30 +0000 (12:00 +0100)
commit6945c53bc712cf4a28a46fe46c2bd8526ea261d1
tree7b958600148f5b806cd6170e66ceb11b1930cc12
parente849f7e708600a9d7567ae22f945b5b01d7f7401
drm/i915: Add locking to i915_gem_evict_vm(), v3.

i915_gem_evict_vm will need to be able to evict objects that are
locked by the current ctx. By testing if the current context already
locked the object, we can do this correctly. This allows us to
evict the entire vm even if we already hold some objects' locks.

Previously, this was spread over several commits, but it makes
more sense to commit the changes to i915_gem_evict_vm separately
from the changes to i915_gem_evict_something() and
i915_gem_evict_for_node().

Changes since v1:
- Handle evicting dead objects better.
Changes since v2:
- Use for_i915_gem_ww in igt_evict_vm. (Thomas)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
[mlankhorst: Fix up doc warning.]
Link: https://patchwork.freedesktop.org/patch/msgid/20220117075604.131477-1-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem_evict.c
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/i915/selftests/i915_gem_evict.c