drm/i915: Add i915_vma_unbind_unlocked, and take obj lock for i915_vma_unbind, v2.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fri, 14 Jan 2022 13:23:18 +0000 (14:23 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 18 Jan 2022 11:19:29 +0000 (12:19 +0100)
commit0f341974cbc2a4efe074dd24c153e439b8430afe
tree7c9ed3185dabe919f60df320dafe4112adcc9658
parent7e00897be8bf13ef9c68c95a8e386b714c29ad95
drm/i915: Add i915_vma_unbind_unlocked, and take obj lock for i915_vma_unbind, v2.

We want to remove more members of i915_vma, which requires the locking to
be held more often.

Start requiring gem object lock for i915_vma_unbind, as it's one of the
callers that may unpin pages.

Some special care is needed when evicting, because the last reference to
the object may be held by the VMA, so after __i915_vma_unbind, vma may be
garbage, and we need to cache vma->obj before unlocking.

Changes since v1:
- Make trylock failing a WARN. (Matt)
- Remove double i915_vma_wait_for_bind() (Matt)
- Move atomic_set to right before mutex_unlock(), to make it more clear
  they belong together. (Matt)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220114132320.109030-5-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/i915/display/intel_fb_pin.c
drivers/gpu/drm/i915/gem/selftests/huge_pages.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
drivers/gpu/drm/i915/gt/intel_ggtt.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/i915/i915_vma.h
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
drivers/gpu/drm/i915/selftests/i915_vma.c