All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/i915/gem: Silence sparse for RCU protection inside the constructor
Date: Fri, 15 Nov 2019 12:55:04 +0000	[thread overview]
Message-ID: <9e701baf-a597-222a-01fa-78f570518a39@linux.intel.com> (raw)
In-Reply-To: <20191114225736.616885-5-chris@chris-wilson.co.uk>


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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915/gem: Silence sparse for RCU protection inside the constructor
Date: Fri, 15 Nov 2019 12:55:04 +0000	[thread overview]
Message-ID: <9e701baf-a597-222a-01fa-78f570518a39@linux.intel.com> (raw)
Message-ID: <20191115125504.QjfqucajgyanRh_snCRNgdlDwjRgfDVVNg6l6yieTJk@z> (raw)
In-Reply-To: <20191114225736.616885-5-chris@chris-wilson.co.uk>


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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-11-15 12:55 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 22:57 [PATCH 1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() Chris Wilson
2019-11-14 22:57 ` [Intel-gfx] " Chris Wilson
2019-11-14 22:57 ` [PATCH 2/5] drm/i915/selftests: Exercise rc6 handling Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-14 22:57 ` [PATCH 3/5] drm/i915/selftests: Be explicit in ERR_PTR handling Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:47   ` Tvrtko Ursulin
2019-11-15 12:47     ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 12:55     ` [PATCH] " Chris Wilson
2019-11-15 12:55       ` [Intel-gfx] " Chris Wilson
2019-11-14 22:57 ` [PATCH 4/5] drm/i915/selftests: Exercise long preemption chains Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:50   ` Tvrtko Ursulin
2019-11-15 12:50     ` [Intel-gfx] " Tvrtko Ursulin
2019-11-14 22:57 ` [PATCH 5/5] drm/i915/gem: Silence sparse for RCU protection inside the constructor Chris Wilson
2019-11-14 22:57   ` [Intel-gfx] " Chris Wilson
2019-11-15 12:55   ` Tvrtko Ursulin [this message]
2019-11-15 12:55     ` Tvrtko Ursulin
2019-11-15  0:12 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() Patchwork
2019-11-15  0:12   ` [Intel-gfx] " Patchwork
2019-11-15  0:34 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-15  0:34   ` [Intel-gfx] " Patchwork
2019-11-15 12:45 ` [PATCH 1/5] " Tvrtko Ursulin
2019-11-15 12:45   ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 12:49   ` Chris Wilson
2019-11-15 12:49     ` [Intel-gfx] " Chris Wilson
2019-11-15 12:56     ` Tvrtko Ursulin
2019-11-15 12:56       ` [Intel-gfx] " Tvrtko Ursulin
2019-11-15 17:18 ` ✗ Fi.CI.BUILD: failure for series starting with [1/5] drm/i915/gt: Wait for new requests in intel_gt_retire_requests() (rev2) Patchwork
2019-11-15 17:18   ` [Intel-gfx] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e701baf-a597-222a-01fa-78f570518a39@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.