mbox series

[0/2] Protect vma destruction with the object lock

Message ID 20220704135249.8241-1-thomas.hellstrom@linux.intel.com (mailing list archive)
Headers show
Series Protect vma destruction with the object lock | expand

Message

Thomas Hellstrom July 4, 2022, 1:52 p.m. UTC
Protecting vma destruction with the object lock is already
implemented everywhere as part of the "Remove short-term pinning" work,
except in the vm destructor where the reasoning was that most code that
needs to keep vmas alive also holds a vm reference.

However this complicates lifetime rules for vmas, so take the
object lock around vma destruction also in the vm destructor, trying
first with trylock to avoid having to unnecessarily release and
re-take the vm mutex that protects the vma lists.

As a follow up remove the now unnecessary taking of the vm reference in
i915_gem_object_unbind(), and the "BARRIER" retry when taking that
reference fails.

Thomas Hellström (2):
  drm/i915: Take the object lock when destroying vmas from vm
    destruction
  drm/i915/gem: Rework i915_gem_object_unbind to rely on the object lock

 drivers/gpu/drm/i915/gem/i915_gem_domain.c |  4 +---
 drivers/gpu/drm/i915/gt/intel_gtt.c        | 17 +++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h            |  7 +++----
 drivers/gpu/drm/i915/i915_gem.c            | 18 ------------------
 4 files changed, 21 insertions(+), 25 deletions(-)