drm/i915: Mark the GEM context link as RCU protected
The only protection for intel_context.gem_cotext is granted by RCU, so
annotate it as a rcu protected pointer and carefully dereference it in
the few occasions we need to use it.
Fixes: 9f3ccd40ac
("drm/i915: Drop GEM context as a direct link from i915_request")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Acked-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191222233558.2201901-1-chris@chris-wilson.co.uk
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <linux/dma-fence.h>
|
||||
#include <linux/lockdep.h>
|
||||
|
||||
#include "gem/i915_gem_context_types.h"
|
||||
#include "gt/intel_context_types.h"
|
||||
#include "gt/intel_engine_types.h"
|
||||
#include "gt/intel_timeline_types.h"
|
||||
@@ -463,6 +464,13 @@ i915_request_timeline(struct i915_request *rq)
|
||||
lockdep_is_held(&rcu_access_pointer(rq->timeline)->mutex));
|
||||
}
|
||||
|
||||
static inline struct i915_gem_context *
|
||||
i915_request_gem_context(struct i915_request *rq)
|
||||
{
|
||||
/* Valid only while the request is being constructed (or retired). */
|
||||
return rcu_dereference_protected(rq->context->gem_context, true);
|
||||
}
|
||||
|
||||
static inline struct intel_timeline *
|
||||
i915_request_active_timeline(struct i915_request *rq)
|
||||
{
|
||||
|
Reference in New Issue
Block a user