[Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer

Chris Wilson chris.p.wilson at intel.com
Wed Nov 6 00:36:47 UTC 2019


Quoting Niranjana Vishwanathapura (2019-11-06 00:02:05)
> 'ctx\->vm' is rcu protected, so use rcu_dereference inside
> read side critical section. It fixes a sparse warning.
> 
> Cc: Chris P Wilson <chris.p.wilson at intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_context.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index de6e55af82cf..d3a622f60fd9 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -1002,12 +1002,13 @@ static int get_ppgtt(struct drm_i915_file_private *file_priv,
>         struct i915_address_space *vm;
>         int ret;
>  
> -       if (!rcu_access_pointer(ctx->vm))
> -               return -ENODEV;

This is correctly serialised by the caller.
-Chris
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the Intel-gfx mailing list