Message ID | 20191114225736.616885-5-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() | expand |
On 14/11/2019 22:57, Chris Wilson wrote: > Inside the constructor, while cloning, we need to replace the > dst->engines. Having forgotten that dst->engines is marked as RCU > protected, we need to add the appropriate annotations to make sparse > happy. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- > drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c > index 1284f47303fa..6f1e6181f67a 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c > @@ -2009,7 +2009,8 @@ static int clone_engines(struct i915_gem_context *dst, > user_engines = i915_gem_context_user_engines(src); > i915_gem_context_unlock_engines(src); > > - free_engines(dst->engines); > + /* Serialised by constructor */ > + free_engines(__context_engines_static(dst)); > RCU_INIT_POINTER(dst->engines, clone); > if (user_engines) > i915_gem_context_set_user_engines(dst); > @@ -2044,7 +2045,8 @@ static int clone_sseu(struct i915_gem_context *dst, > unsigned long n; > int err; > > - clone = dst->engines; /* no locking required; sole access */ > + /* no locking required; sole access under constructor*/ > + clone = __context_engines_static(dst); > if (e->num_engines != clone->num_engines) { > err = -EINVAL; > goto unlock; > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Regards, Tvrtko
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index 1284f47303fa..6f1e6181f67a 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -2009,7 +2009,8 @@ static int clone_engines(struct i915_gem_context *dst, user_engines = i915_gem_context_user_engines(src); i915_gem_context_unlock_engines(src); - free_engines(dst->engines); + /* Serialised by constructor */ + free_engines(__context_engines_static(dst)); RCU_INIT_POINTER(dst->engines, clone); if (user_engines) i915_gem_context_set_user_engines(dst); @@ -2044,7 +2045,8 @@ static int clone_sseu(struct i915_gem_context *dst, unsigned long n; int err; - clone = dst->engines; /* no locking required; sole access */ + /* no locking required; sole access under constructor*/ + clone = __context_engines_static(dst); if (e->num_engines != clone->num_engines) { err = -EINVAL; goto unlock;
Inside the constructor, while cloning, we need to replace the dst->engines. Having forgotten that dst->engines is marked as RCU protected, we need to add the appropriate annotations to make sparse happy. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)