OpenCloudOS-Kernel/drivers/gpu/drm/i915/selftests
Chris Wilson d19d71fc2b drm/i915: Mark i915_request.timeline as a volatile, rcu pointer
The request->timeline is only valid until the request is retired (i.e.
before it is completed). Upon retiring the request, the context may be
unpinned and freed, and along with it the timeline may be freed. We
therefore need to be very careful when chasing rq->timeline that the
pointer does not disappear beneath us. The vast majority of users are in
a protected context, either during request construction or retirement,
where the timeline->mutex is held and the timeline cannot disappear. It
is those few off the beaten path (where we access a second timeline) that
need extra scrutiny -- to be added in the next patch after first adding
the warnings about dangerous access.

One complication, where we cannot use the timeline->mutex itself, is
during request submission onto hardware (under spinlocks). Here, we want
to check on the timeline to finalize the breadcrumb, and so we need to
impose a second rule to ensure that the request->timeline is indeed
valid. As we are submitting the request, it's context and timeline must
be pinned, as it will be used by the hardware. Since it is pinned, we
know the request->timeline must still be valid, and we cannot submit the
idle barrier until after we release the engine->active.lock, ergo while
submitting and holding that spinlock, a second thread cannot release the
timeline.

v2: Don't be lazy inside selftests; hold the timeline->mutex for as long
as we need it, and tidy up acquiring the timeline with a bit of
refactoring (i915_active_add_request)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190919111912.21631-1-chris@chris-wilson.co.uk
2019-09-20 10:24:09 +01:00
..
i915_active.c drm/i915: Mark i915_request.timeline as a volatile, rcu pointer 2019-09-20 10:24:09 +01:00
i915_buddy.c drm/i915/selftests: cond_resched() within the longer buddy tests 2019-08-29 19:19:50 +01:00
i915_gem.c drm/i915: Perform GGTT restore much earlier during resume 2019-09-10 11:49:11 +01:00
i915_gem_evict.c drm/i915: cleanup cache-coloring 2019-09-09 21:00:20 +01:00
i915_gem_gtt.c drm/i915/selftests: Exercise CS TLB invalidation 2019-09-19 15:49:31 +01:00
i915_live_selftests.h drm/i915: Defer final intel_wakeref_put to process context 2019-08-08 21:28:51 +01:00
i915_mock_selftests.h drm/i915: buddy allocator 2019-08-10 19:47:40 +01:00
i915_random.c drm/i915: Share per-timeline HWSP using a slab suballocator 2019-01-28 19:07:06 +00:00
i915_random.h drm/i915: Share per-timeline HWSP using a slab suballocator 2019-01-28 19:07:06 +00:00
i915_request.c drm/i915/selftests: Fixup a couple of missing serialisation with vma 2019-08-21 22:21:57 +01:00
i915_selftest.c drm/i915: Use drm_i915_private directly from drv_get_drvdata() 2019-08-06 09:36:22 +01:00
i915_sw_fence.c drm/i915/selftests: Disable preemption while setting up fence-timers 2019-03-14 11:47:06 +00:00
i915_syncmap.c
i915_vma.c drm/i915: s/for_each_sgt_dma/for_each_sgt_daddr/ 2019-08-29 21:59:16 +01:00
igt_atomic.h drm/i915/selftests: Split igt_atomic_reset testcase 2019-05-23 21:53:26 +01:00
igt_flush_test.c drm/i915/gt: Use intel_gt as the primary object for handling resets 2019-07-12 21:06:56 +01:00
igt_flush_test.h drm/i915/selftests: Refactor common flush_test() 2018-05-08 12:44:31 +01:00
igt_live_test.c drm/i915: Drop fake breadcrumb irq 2019-01-29 21:45:30 +00:00
igt_live_test.h drm/i915/selftests: Refactor common live_test framework 2019-01-22 13:01:20 +00:00
igt_reset.c drm/i915/gt: Use intel_gt as the primary object for handling resets 2019-07-12 21:06:56 +01:00
igt_reset.h drm/i915/gt: Use intel_gt as the primary object for handling resets 2019-07-12 21:06:56 +01:00
igt_spinner.c drm/i915: Mark i915_request.timeline as a volatile, rcu pointer 2019-09-20 10:24:09 +01:00
igt_spinner.h drm/i915/selftests: Pass intel_context to igt_spinner 2019-07-31 09:45:27 +01:00
intel_uncore.c drm/i915/tgl: Introduce gen12 forcewake ranges 2019-09-13 20:07:36 +01:00
lib_sw_fence.c drm/i915: Propagate fence errors 2019-08-18 12:38:09 +01:00
lib_sw_fence.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
mock_drm.c
mock_drm.h
mock_gem_device.c drm/i915: Hook up GT power management 2019-09-06 20:29:58 +01:00
mock_gem_device.h
mock_gtt.c drm/i915: Make i915_vma.flags atomic_t for mutex reduction 2019-09-11 13:39:42 +01:00
mock_gtt.h drm/i915: Rename i915_hw_ppgtt to i915_ppgtt 2019-06-11 11:44:32 +01:00
mock_request.c drm/i915/selftests: Pass intel_context to mock_request 2019-08-08 13:44:31 +01:00
mock_request.h drm/i915/selftests: Pass intel_context to mock_request 2019-08-08 13:44:31 +01:00
mock_uncore.c drm/i915: use vfuncs for reg_read/write_fw_domains 2019-06-20 16:34:52 +01:00
mock_uncore.h drm/i915: make more uncore function work on intel_uncore 2019-03-20 21:12:42 +00:00
scatterlist.c drm/i915: Pull scatterlist utils out of i915_gem.h 2019-05-28 12:45:29 +01:00