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(-) -- 2.36.1