All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  0:36     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:36 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

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@intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  0:36     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:36 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

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@intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  0:37     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:37 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
> Guard against uninitalized (NULL) ips_mchdev before
> dereferencing.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  0:37     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:37 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
> Guard against uninitalized (NULL) ips_mchdev before
> dereferencing.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] drm/i915: Remove unwanted rcu_read_lock/unlock
@ 2019-11-06  0:42     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:42 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

Quoting Niranjana Vishwanathapura (2019-11-06 00:02:03)
> We don't need rcu read side critical section to call pid_nr(),
> remove it.
> 
> Cc: Chris P Wilson <chris.p.wilson@intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index e8b67f5e521d..1f2f266f26af 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1230,10 +1230,7 @@ static void record_request(const struct i915_request *request,
>         erq->start = i915_ggtt_offset(request->ring->vma);
>         erq->head = request->head;
>         erq->tail = request->tail;
> -
> -       rcu_read_lock();
>         erq->pid = ctx->pid ? pid_nr(ctx->pid) : 0;
> -       rcu_read_unlock();

Ok, that was just cut'n'paste from pid_task()
Reviewed-by: Chris Wilson <chris.p.wilson@intel.com>
-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.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] drm/i915: Remove unwanted rcu_read_lock/unlock
@ 2019-11-06  0:42     ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  0:42 UTC (permalink / raw)
  To: Niranjana Vishwanathapura, intel-gfx

Quoting Niranjana Vishwanathapura (2019-11-06 00:02:03)
> We don't need rcu read side critical section to call pid_nr(),
> remove it.
> 
> Cc: Chris P Wilson <chris.p.wilson@intel.com>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index e8b67f5e521d..1f2f266f26af 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1230,10 +1230,7 @@ static void record_request(const struct i915_request *request,
>         erq->start = i915_ggtt_offset(request->ring->vma);
>         erq->head = request->head;
>         erq->tail = request->tail;
> -
> -       rcu_read_lock();
>         erq->pid = ctx->pid ? pid_nr(ctx->pid) : 0;
> -       rcu_read_unlock();

Ok, that was just cut'n'paste from pid_task()
Reviewed-by: Chris Wilson <chris.p.wilson@intel.com>
-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.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  2:14       ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-06  2:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 12:37:14AM +0000, Chris Wilson wrote:
>Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
>> Guard against uninitalized (NULL) ips_mchdev before
>> dereferencing.
>
>Because?

I am seeing some exported functions like i915_read_mch_val() that try to
dereference ips_mchdev via mchdev_get(). I don't know full usage here,
but probably make these APIs fail safe?

Niranjana

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  2:14       ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-06  2:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 12:37:14AM +0000, Chris Wilson wrote:
>Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
>> Guard against uninitalized (NULL) ips_mchdev before
>> dereferencing.
>
>Because?

I am seeing some exported functions like i915_read_mch_val() that try to
dereference ips_mchdev via mchdev_get(). I don't know full usage here,
but probably make these APIs fail safe?

Niranjana

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  2:16       ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-06  2:16 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
>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@intel.com>
>> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.

Ok, is this worth fixing the sparse warning?

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  2:16       ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-06  2:16 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
>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@intel.com>
>> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.

Ok, is this worth fixing the sparse warning?

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  8:40         ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  8:40 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-06 02:14:45)
> On Wed, Nov 06, 2019 at 12:37:14AM +0000, Chris Wilson wrote:
> >Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
> >> Guard against uninitalized (NULL) ips_mchdev before
> >> dereferencing.
> >
> >Because?
> 
> I am seeing some exported functions like i915_read_mch_val() that try to
> dereference ips_mchdev via mchdev_get(). I don't know full usage here,
> but probably make these APIs fail safe?

Are you also going to make those functions safe when the module isn't
there? If that module interface is used outside of the registration
period, then the binding with the caller went horribly astray.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL
@ 2019-11-06  8:40         ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  8:40 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-06 02:14:45)
> On Wed, Nov 06, 2019 at 12:37:14AM +0000, Chris Wilson wrote:
> >Quoting Niranjana Vishwanathapura (2019-11-06 00:02:04)
> >> Guard against uninitalized (NULL) ips_mchdev before
> >> dereferencing.
> >
> >Because?
> 
> I am seeing some exported functions like i915_read_mch_val() that try to
> dereference ips_mchdev via mchdev_get(). I don't know full usage here,
> but probably make these APIs fail safe?

Are you also going to make those functions safe when the module isn't
there? If that module interface is used outside of the registration
period, then the binding with the caller went horribly astray.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  8:52         ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  8:52 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-06 02:16:42)
> On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
> >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@intel.com>
> >> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
> 
> Ok, is this worth fixing the sparse warning?

  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_context.c:2087:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2088:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2089:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2090:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2091:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2092:17: error: bad integer constant expression

Odd.

Sure, for correctness see clone_vm().
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-06  8:52         ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-06  8:52 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-06 02:16:42)
> On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
> >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@intel.com>
> >> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
> 
> Ok, is this worth fixing the sparse warning?

  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_context.c:2087:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2088:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2089:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2090:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2091:17: error: bad integer constant expression
drivers/gpu/drm/i915/gem/i915_gem_context.c:2092:17: error: bad integer constant expression

Odd.

Sure, for correctness see clone_vm().
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-07  5:05           ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-07  5:05 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 08:52:58AM +0000, Chris Wilson wrote:
>Quoting Niranjan Vishwanathapura (2019-11-06 02:16:42)
>> On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
>> >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@intel.com>
>> >> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
>>
>> Ok, is this worth fixing the sparse warning?
>
>  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2087:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2088:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2089:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2090:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2091:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2092:17: error: bad integer constant expression
>
>Odd.

I am seeing,

  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29:    expected struct i915_address_space *vm
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29:    got struct i915_address_space [noderef] <asn:4> *vm
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25:    expected struct i915_gem_engines *e
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25:    got struct i915_gem_engines [noderef] <asn:4> *engines
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15: warning: incorrect type in assignment (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15:    expected struct i915_gem_engines *clone
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15:    got struct i915_gem_engines [noderef] <asn:4> *engines

>
>Sure, for correctness see clone_vm().

Ok, I can put a common helper function like vm_get_rcu_safe(ctx).

Niranjana

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-07  5:05           ` Niranjan Vishwanathapura
  0 siblings, 0 replies; 18+ messages in thread
From: Niranjan Vishwanathapura @ 2019-11-07  5:05 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 06, 2019 at 08:52:58AM +0000, Chris Wilson wrote:
>Quoting Niranjan Vishwanathapura (2019-11-06 02:16:42)
>> On Wed, Nov 06, 2019 at 12:36:47AM +0000, Chris Wilson wrote:
>> >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@intel.com>
>> >> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@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.
>>
>> Ok, is this worth fixing the sparse warning?
>
>  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2087:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2088:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2089:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2090:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2091:17: error: bad integer constant expression
>drivers/gpu/drm/i915/gem/i915_gem_context.c:2092:17: error: bad integer constant expression
>
>Odd.

I am seeing,

  CHECK   drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29:    expected struct i915_address_space *vm
drivers/gpu/drm/i915/gem/i915_gem_context.c:1009:29:    got struct i915_address_space [noderef] <asn:4> *vm
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25:    expected struct i915_gem_engines *e
drivers/gpu/drm/i915/gem/i915_gem_context.c:1958:25:    got struct i915_gem_engines [noderef] <asn:4> *engines
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15: warning: incorrect type in assignment (different address spaces)
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15:    expected struct i915_gem_engines *clone
drivers/gpu/drm/i915/gem/i915_gem_context.c:1993:15:    got struct i915_gem_engines [noderef] <asn:4> *engines

>
>Sure, for correctness see clone_vm().

Ok, I can put a common helper function like vm_get_rcu_safe(ctx).

Niranjana

>-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-07  9:49             ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-07  9:49 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-07 05:05:26)
> On Wed, Nov 06, 2019 at 08:52:58AM +0000, Chris Wilson wrote:
> >Sure, for correctness see clone_vm().
> 
> Ok, I can put a common helper function like vm_get_rcu_safe(ctx).

https://patchwork.freedesktop.org/patch/339110/?series=69044&rev=1
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer
@ 2019-11-07  9:49             ` Chris Wilson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Wilson @ 2019-11-07  9:49 UTC (permalink / raw)
  To: Niranjan Vishwanathapura; +Cc: intel-gfx

Quoting Niranjan Vishwanathapura (2019-11-07 05:05:26)
> On Wed, Nov 06, 2019 at 08:52:58AM +0000, Chris Wilson wrote:
> >Sure, for correctness see clone_vm().
> 
> Ok, I can put a common helper function like vm_get_rcu_safe(ctx).

https://patchwork.freedesktop.org/patch/339110/?series=69044&rev=1
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-11-07  9:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191106000205.22480-1-niranjana.vishwanathapura@intel.com>
     [not found] ` <20191106000205.22480-4-niranjana.vishwanathapura@intel.com>
2019-11-06  0:36   ` [PATCH 3/3] drm/i915: Use rcu_dereference for rcu protected pointer Chris Wilson
2019-11-06  0:36     ` [Intel-gfx] " Chris Wilson
2019-11-06  2:16     ` Niranjan Vishwanathapura
2019-11-06  2:16       ` [Intel-gfx] " Niranjan Vishwanathapura
2019-11-06  8:52       ` Chris Wilson
2019-11-06  8:52         ` [Intel-gfx] " Chris Wilson
2019-11-07  5:05         ` Niranjan Vishwanathapura
2019-11-07  5:05           ` [Intel-gfx] " Niranjan Vishwanathapura
2019-11-07  9:49           ` Chris Wilson
2019-11-07  9:49             ` [Intel-gfx] " Chris Wilson
     [not found] ` <20191106000205.22480-3-niranjana.vishwanathapura@intel.com>
2019-11-06  0:37   ` [PATCH 2/3] drm/i915: Check for ips_mchdev being NULL Chris Wilson
2019-11-06  0:37     ` [Intel-gfx] " Chris Wilson
2019-11-06  2:14     ` Niranjan Vishwanathapura
2019-11-06  2:14       ` [Intel-gfx] " Niranjan Vishwanathapura
2019-11-06  8:40       ` Chris Wilson
2019-11-06  8:40         ` [Intel-gfx] " Chris Wilson
     [not found] ` <20191106000205.22480-2-niranjana.vishwanathapura@intel.com>
2019-11-06  0:42   ` [PATCH 1/3] drm/i915: Remove unwanted rcu_read_lock/unlock Chris Wilson
2019-11-06  0:42     ` [Intel-gfx] " Chris Wilson

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.