mirror_ubuntu-kernels/drivers/gpu/drm/i915/gem
Daniel Vetter c238980efd drm/i915: Release ctx->syncobj on final put, not on ctx close
gem context refcounting is another exercise in least locking design it
seems, where most things get destroyed upon context closure (which can
race with anything really). Only the actual memory allocation and the
locks survive while holding a reference.

This tripped up Jason when reimplementing the single timeline feature
in

commit 00dae4d3d3
Author: Jason Ekstrand <jason@jlekstrand.net>
Date:   Thu Jul 8 10:48:12 2021 -0500

    drm/i915: Implement SINGLE_TIMELINE with a syncobj (v4)

We could fix the bug by holding ctx->mutex in execbuf and clear the
pointer (again while holding the mutex) context_close, but it's
cleaner to just make the context object actually invariant over its
_entire_ lifetime. This way any other ioctl that's potentially racing,
but holding a full reference, can still rely on ctx->syncobj being
an immutable pointer. Which without this change, is not the case.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Fixes: 00dae4d3d3 ("drm/i915: Implement SINGLE_TIMELINE with a syncobj (v4)")
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210902142057.929669-2-daniel.vetter@ffwll.ch
2021-09-06 10:45:40 +02:00
..
selftests drm/i915: Release i915_gem_context from a worker 2021-09-06 10:45:29 +02: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_types.h drm/i915: Release i915_gem_context from a worker 2021-09-06 10:45:29 +02:00
i915_gem_context.c drm/i915: Release ctx->syncobj on final put, not on ctx close 2021-09-06 10:45:40 +02:00
i915_gem_context.h drm/i915: move gem_context slab to direct module init/exit 2021-07-28 16:45:58 +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 drm/i915: delete gpu reloc code 2021-08-05 00:25:48 +02:00
i915_gem_internal.c drm/i915: Update object placement flags to be mutable 2021-06-24 18:50:56 +01: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: support forcing the page size with lmem 2021-06-30 13:24:29 +01:00
i915_gem_lmem.h drm/i915: support forcing the page size with lmem 2021-06-30 13:24:29 +01: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 drm/i915/gem: Only revoke mmap handlers if active 2020-07-02 20:46:08 +01:00
i915_gem_object_types.h drm/i915/ehl: unconditionally flush the pages on acquire 2021-07-27 09:16:46 +01:00
i915_gem_object.c drm/i915: move gem_objects slab to direct module init/exit 2021-07-28 16:45:58 +02:00
i915_gem_object.h drm/i915: move gem_objects slab to direct module init/exit 2021-07-28 16:45:58 +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: Finally remove obj->mm.lock. 2021-03-24 17:47:20 +01:00
i915_gem_pm.h drm/i915/gem: Move freeze/freeze_late next to suspend/suspend_late 2021-02-08 16:56:49 -05:00
i915_gem_region.c drm/i915: support forcing the page size with lmem 2021-06-30 13:24:29 +01:00
i915_gem_region.h drm/i915: support forcing the page size with lmem 2021-06-30 13:24:29 +01: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: Use trylock in shrinker for ggtt on bsw vt-d and bxt, v2. 2021-04-29 11:32:32 +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 drm/i915: support forcing the page size with lmem 2021-06-30 13:24:29 +01: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 drm/i915/gem: Remove disordered per-file request list for throttling 2020-09-07 13:13:50 +03:00
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/ttm, drm/i915: Update ttm_move_memcpy for async use 2021-08-25 16:05:47 +02:00
i915_gem_ttm.h drm/i915: support forcing the page size with lmem 2021-06-30 13:24:29 +01:00
i915_gem_userptr.c drm/i915/userptr: Probe existence of backing struct pages upon creation 2021-08-05 11:34:00 +02:00
i915_gem_wait.c drm/i915/gem: Implement object migration 2021-06-30 11:32:11 +01:00
i915_gemfs.c
i915_gemfs.h