* [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
@ 2016-04-30 19:00 Muhammad Falak R Wani
2016-05-01 15:26 ` Christian König
0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Falak R Wani @ 2016-04-30 19:00 UTC (permalink / raw)
To: David Airlie
Cc: Chunming Zhou, Alex Deucher, Christian König, dri-devel,
linux-kernel
The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structre. It is always
safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
rcu_assign_pointer().
This results in slightly smaller/faster code.
The following semantic patch was used:
<smpl>
@@
@@
- rcu_assign_pointer
+ RCU_INIT_POINTER
(..., NULL)
</smpl>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index d81f1f4..4500ff1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
/* There is always exactly one thread signaling this fence slot */
fence = rcu_dereference_protected(*ptr, 1);
- rcu_assign_pointer(*ptr, NULL);
+ RCU_INIT_POINTER(*ptr, NULL);
BUG_ON(!fence);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
2016-04-30 19:00 [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Muhammad Falak R Wani
@ 2016-05-01 15:26 ` Christian König
0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2016-05-01 15:26 UTC (permalink / raw)
To: Muhammad Falak R Wani, David Airlie
Cc: Chunming Zhou, Alex Deucher, dri-devel, linux-kernel
Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
> The rcu_assign_pointer() ensures that the initialization of a structure
> is carried out before storing a pointer to that structre. It is always
> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.
Thanks for the detailed explanation, I was already wondering what the
difference is between the two.
>
> The following semantic patch was used:
> <smpl>
>
> @@
> @@
>
> - rcu_assign_pointer
> + RCU_INIT_POINTER
> (..., NULL)
>
> </smpl>
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index d81f1f4..4500ff1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>
> /* There is always exactly one thread signaling this fence slot */
> fence = rcu_dereference_protected(*ptr, 1);
> - rcu_assign_pointer(*ptr, NULL);
> + RCU_INIT_POINTER(*ptr, NULL);
>
> BUG_ON(!fence);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
@ 2016-05-01 15:26 ` Christian König
0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2016-05-01 15:26 UTC (permalink / raw)
To: Muhammad Falak R Wani, David Airlie; +Cc: Alex Deucher, linux-kernel, dri-devel
Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
> The rcu_assign_pointer() ensures that the initialization of a structure
> is carried out before storing a pointer to that structre. It is always
> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.
Thanks for the detailed explanation, I was already wondering what the
difference is between the two.
>
> The following semantic patch was used:
> <smpl>
>
> @@
> @@
>
> - rcu_assign_pointer
> + RCU_INIT_POINTER
> (..., NULL)
>
> </smpl>
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index d81f1f4..4500ff1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>
> /* There is always exactly one thread signaling this fence slot */
> fence = rcu_dereference_protected(*ptr, 1);
> - rcu_assign_pointer(*ptr, NULL);
> + RCU_INIT_POINTER(*ptr, NULL);
>
> BUG_ON(!fence);
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
2016-05-01 15:26 ` Christian König
@ 2016-05-02 14:46 ` Alex Deucher
-1 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2016-05-02 14:46 UTC (permalink / raw)
To: Christian König
Cc: Muhammad Falak R Wani, David Airlie, Alex Deucher, LKML,
Maling list - DRI developers
On Sun, May 1, 2016 at 11:26 AM, Christian König
<christian.koenig@amd.com> wrote:
> Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
>>
>> The rcu_assign_pointer() ensures that the initialization of a structure
>> is carried out before storing a pointer to that structre. It is always
>> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
>> rcu_assign_pointer().
>> This results in slightly smaller/faster code.
>
>
> Thanks for the detailed explanation, I was already wondering what the
> difference is between the two.
>
>>
>> The following semantic patch was used:
>> <smpl>
>>
>> @@
>> @@
>>
>> - rcu_assign_pointer
>> + RCU_INIT_POINTER
>> (..., NULL)
>>
>> </smpl>
>>
>> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
Applied. thanks!
Alex
>
> Regards,
> Christian.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> index d81f1f4..4500ff1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>> /* There is always exactly one thread signaling this fence
>> slot */
>> fence = rcu_dereference_protected(*ptr, 1);
>> - rcu_assign_pointer(*ptr, NULL);
>> + RCU_INIT_POINTER(*ptr, NULL);
>> BUG_ON(!fence);
>>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
@ 2016-05-02 14:46 ` Alex Deucher
0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2016-05-02 14:46 UTC (permalink / raw)
To: Christian König
Cc: Alex Deucher, Muhammad Falak R Wani, Maling list - DRI developers, LKML
On Sun, May 1, 2016 at 11:26 AM, Christian König
<christian.koenig@amd.com> wrote:
> Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
>>
>> The rcu_assign_pointer() ensures that the initialization of a structure
>> is carried out before storing a pointer to that structre. It is always
>> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
>> rcu_assign_pointer().
>> This results in slightly smaller/faster code.
>
>
> Thanks for the detailed explanation, I was already wondering what the
> difference is between the two.
>
>>
>> The following semantic patch was used:
>> <smpl>
>>
>> @@
>> @@
>>
>> - rcu_assign_pointer
>> + RCU_INIT_POINTER
>> (..., NULL)
>>
>> </smpl>
>>
>> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
Applied. thanks!
Alex
>
> Regards,
> Christian.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> index d81f1f4..4500ff1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>> /* There is always exactly one thread signaling this fence
>> slot */
>> fence = rcu_dereference_protected(*ptr, 1);
>> - rcu_assign_pointer(*ptr, NULL);
>> + RCU_INIT_POINTER(*ptr, NULL);
>> BUG_ON(!fence);
>>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-02 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-30 19:00 [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Muhammad Falak R Wani
2016-05-01 15:26 ` Christian König
2016-05-01 15:26 ` Christian König
2016-05-02 14:46 ` Alex Deucher
2016-05-02 14:46 ` Alex Deucher
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.