summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gt/intel_timeline_types.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-08-15 21:57:08 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-08-15 23:21:13 +0100
commitccb23d2dcc300d3fa176de654610ea82f635915d (patch)
treec77c3f9c88b5960c5961ecd379d9f9682be2ad6a /drivers/gpu/drm/i915/gt/intel_timeline_types.h
parent338aade97c061da0403dbb00128d938782f30dbd (diff)
drm/i915/gt: Guard timeline pinning without relying on struct_mutex
In preparation for removing struct_mutex from around context retirement, we need to make timeline pinning and unpinning safe. Since multiple engines/contexts can share a single timeline, we cannot rely on borrowing the context mutex (otherwise we could state that the timeline is only pinned/unpinned inside the context pin/unpin and so guarded by it). However, we only perform a sequence of atomic operations inside the timeline pin/unpin and the sequence of those operations is safe for a concurrent unpin / pin, so we can relax the struct_mutex requirement. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190815205709.24285-3-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gt/intel_timeline_types.h')
-rw-r--r--drivers/gpu/drm/i915/gt/intel_timeline_types.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_timeline_types.h b/drivers/gpu/drm/i915/gt/intel_timeline_types.h
index b1a9f0c54bf0..2b1baf2fcc8e 100644
--- a/drivers/gpu/drm/i915/gt/intel_timeline_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_timeline_types.h
@@ -41,7 +41,7 @@ struct intel_timeline {
* but the pin_count is protected by a combination of serialisation
* from the intel_context caller plus internal atomicity.
*/
- unsigned int pin_count;
+ atomic_t pin_count;
unsigned int active_count;
const u32 *hwsp_seqno;