linux-stable/drivers/gpu/drm/i915/gem
Thomas Hellström 068396bb21 drm/i915/ttm: Rework object initialization slightly
We may end up in i915_ttm_bo_destroy() in an error path before the
object is fully initialized. In that case it's not correct to call
__i915_gem_free_object(), because that function
a) Assumes the gem object refcount is 0, which it isn't.
b) frees the placements which are owned by the caller until the
init_object() region ops returns successfully. Fix this by providing
a lightweight cleanup function __i915_gem_object_fini() which is also
called by __i915_gem_free_object().

While doing this, also make sure we call dma_resv_fini() as part of
ordinary object destruction and not from the RCU callback that frees
the object. This will help track down bugs where the object is incorrectly
locked from an RCU lookup.

Finally, make sure the object isn't put on the region list until it's
either locked or fully initialized in order to block list processing of
partially initialized objects.

v2:
- The TTM object backend memory was freed before the gem pages were
  put. Separate this functionality into __i915_gem_object_pages_fini()
  and call it from the TTM delete_mem_notify() callback.
v3:
- Include i915_gem_object_free_mmaps() in __i915_gem_object_pages_fini()
  to make sure we don't inadvertedly introduce a race.

Fixes: 48b0961269 ("drm/i915: Move __i915_gem_free_object to ttm_bo_destroy")
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com> #v1
Link: https://patchwork.freedesktop.org/patch/msgid/20210930113236.583531-1-thomas.hellstrom@linux.intel.com
2021-10-01 13:11:58 +02:00
..
selftests drm/i915/selftests: exercise shmem_writeback with THP 2021-09-24 09:35:34 +01:00
i915_gem_busy.c dma-buf: drop the _rcu postfix on function names v3 2021-06-06 11:19:51 +02:00
i915_gem_clflush.c drm/i915: Drop error handling from dma_fence_work 2021-07-16 21:47:39 +02:00
i915_gem_clflush.h
i915_gem_context.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
i915_gem_context.h drm/i915: Drop __rcu from gem_context->vm 2021-09-06 11:11:32 +02:00
i915_gem_context_types.h drm/i915: Drop __rcu from gem_context->vm 2021-09-06 11:11:32 +02:00
i915_gem_create.c drm/i915: Add pci ids and uapi for DG1 2021-08-13 09:46:58 +02:00
i915_gem_dmabuf.c drm/i915/gem: Migrate to system at dma-buf attach time (v7) 2021-07-26 16:37:38 +01:00
i915_gem_domain.c drm/i915/uapi: reject set_domain for discrete 2021-07-23 11:55:32 +01:00
i915_gem_execbuffer.c Merge drm/drm-next into drm-intel-gt-next 2021-09-15 13:23:27 +03:00
i915_gem_internal.c Merge branch 'stable/for-linus-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb 2021-09-03 10:34:44 -07:00
i915_gem_ioctls.h drm/i915/uapi: introduce drm_i915_gem_create_ext 2021-05-04 10:58:56 +01:00
i915_gem_lmem.c drm/i915/gem: Fix a lockdep warning the __i915_gem_is_lmem() function 2021-09-24 08:17:39 +02:00
i915_gem_lmem.h drm/i915/guc: put all guc objects in lmem when available 2021-09-20 12:35:41 -07:00
i915_gem_mman.c drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC 2021-07-22 10:07:23 -07:00
i915_gem_mman.h
i915_gem_object.c drm/i915/ttm: Rework object initialization slightly 2021-10-01 13:11:58 +02:00
i915_gem_object.h drm/i915/ttm: Rework object initialization slightly 2021-10-01 13:11:58 +02:00
i915_gem_object_types.h drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
i915_gem_pages.c drm/i915: Remove allow_alloc from i915_gem_object_get_sg* 2021-07-16 21:47:07 +02:00
i915_gem_phys.c drm/i915: Update object placement flags to be mutable 2021-06-24 18:50:56 +01:00
i915_gem_pm.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
i915_gem_pm.h drm/i915 Implement LMEM backup and restore for suspend / resume 2021-09-24 08:19:11 +02:00
i915_gem_region.c drm/i915/gem: Implement a function to process all gem objects of a region 2021-09-24 08:19:09 +02:00
i915_gem_region.h drm/i915/gem: Implement a function to process all gem objects of a region 2021-09-24 08:19:09 +02:00
i915_gem_shmem.c drm/i915/ehl: unconditionally flush the pages on acquire 2021-07-27 09:16:46 +01:00
i915_gem_shrinker.c drm/i915: Fix runtime pm handling in i915_gem_shrink 2021-09-29 10:50:59 +02:00
i915_gem_shrinker.h drm/i915: Finally remove obj->mm.lock. 2021-03-24 17:47:20 +01:00
i915_gem_stolen.c Merge tag 'drm-intel-next-2021-08-10-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-08-12 11:20:17 +10:00
i915_gem_stolen.h drm/i915/ttm Initialize the ttm device and memory managers 2021-06-02 13:21:24 +01:00
i915_gem_throttle.c
i915_gem_tiling.c drm/i915/gem: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:43 -07:00
i915_gem_ttm.c drm/i915/ttm: Rework object initialization slightly 2021-10-01 13:11:58 +02:00
i915_gem_ttm.h drm/i915 Implement LMEM backup and restore for suspend / resume 2021-09-24 08:19:11 +02:00
i915_gem_ttm_pm.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
i915_gem_ttm_pm.h drm/i915 Implement LMEM backup and restore for suspend / resume 2021-09-24 08:19:11 +02:00
i915_gem_userptr.c RDMA v5.15 merge window Pull Request 2021-09-02 14:47:21 -07:00
i915_gem_wait.c drm/i915/gem: Implement object migration 2021-06-30 11:32:11 +01:00
i915_gemfs.c drm/i915: Use Transparent Hugepages when IOMMU is enabled 2021-09-10 14:29:19 +01:00
i915_gemfs.h