Re: [PATCH] ipv6: sit: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

2014-08-27 Thread David Miller
From: Andreea-Cristina Bernat 
Date: Tue, 26 Aug 2014 16:46:32 +0300

> According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
> "3.   The referenced data structure has already been exposed to readers either
> at compile time or via rcu_assign_pointer() -and-
>  a.   You have not made -any- reader-visible changes to this structure since
> then".
> 
> This case fulfills the conditions above because between the rtnl_dereference()
> call and the rcu_assign_pointer() call there is no update of that value.
> Therefore, this patch makes the replacement.
> 
> The following Coccinelle semantic patch was used:
> @@
> @@
> 
> - rcu_assign_pointer
> + RCU_INIT_POINTER
>   (...,
> (
>  rtnl_dereference(...)
> |
>  rcu_dereference_protected(...)
> ) )
> 
> Signed-off-by: Andreea-Cristina Bernat 

These changes are not correct.

We need the memory barrier added by rcu_assign_pointer(), which occurs
before the assignment, otherwise the RCU pointer update might be visible
before the stores that initialize the rest of the structure in question.

I'm not applying any of these patches, sorry.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ipv6: sit: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

2014-08-27 Thread David Miller
From: Andreea-Cristina Bernat bernat@gmail.com
Date: Tue, 26 Aug 2014 16:46:32 +0300

 According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
 3.   The referenced data structure has already been exposed to readers either
 at compile time or via rcu_assign_pointer() -and-
  a.   You have not made -any- reader-visible changes to this structure since
 then.
 
 This case fulfills the conditions above because between the rtnl_dereference()
 call and the rcu_assign_pointer() call there is no update of that value.
 Therefore, this patch makes the replacement.
 
 The following Coccinelle semantic patch was used:
 @@
 @@
 
 - rcu_assign_pointer
 + RCU_INIT_POINTER
   (...,
 (
  rtnl_dereference(...)
 |
  rcu_dereference_protected(...)
 ) )
 
 Signed-off-by: Andreea-Cristina Bernat bernat@gmail.com

These changes are not correct.

We need the memory barrier added by rcu_assign_pointer(), which occurs
before the assignment, otherwise the RCU pointer update might be visible
before the stores that initialize the rest of the structure in question.

I'm not applying any of these patches, sorry.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ipv6: sit: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

2014-08-26 Thread Andreea-Cristina Bernat
According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
"3.   The referenced data structure has already been exposed to readers either
at compile time or via rcu_assign_pointer() -and-
 a.   You have not made -any- reader-visible changes to this structure since
then".

This case fulfills the conditions above because between the rtnl_dereference()
call and the rcu_assign_pointer() call there is no update of that value.
Therefore, this patch makes the replacement.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (...,
(
 rtnl_dereference(...)
|
 rcu_dereference_protected(...)
) )

Signed-off-by: Andreea-Cristina Bernat 
---
 net/ipv6/sit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 4f40817..24c2dba 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -167,7 +167,7 @@ static void ipip6_tunnel_link(struct sit_net *sitn, struct 
ip_tunnel *t)
 {
struct ip_tunnel __rcu **tp = ipip6_bucket(sitn, t);
 
-   rcu_assign_pointer(t->next, rtnl_dereference(*tp));
+   RCU_INIT_POINTER(t->next, rtnl_dereference(*tp));
rcu_assign_pointer(*tp, t);
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ipv6: sit: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

2014-08-26 Thread Andreea-Cristina Bernat
According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
3.   The referenced data structure has already been exposed to readers either
at compile time or via rcu_assign_pointer() -and-
 a.   You have not made -any- reader-visible changes to this structure since
then.

This case fulfills the conditions above because between the rtnl_dereference()
call and the rcu_assign_pointer() call there is no update of that value.
Therefore, this patch makes the replacement.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (...,
(
 rtnl_dereference(...)
|
 rcu_dereference_protected(...)
) )

Signed-off-by: Andreea-Cristina Bernat bernat@gmail.com
---
 net/ipv6/sit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 4f40817..24c2dba 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -167,7 +167,7 @@ static void ipip6_tunnel_link(struct sit_net *sitn, struct 
ip_tunnel *t)
 {
struct ip_tunnel __rcu **tp = ipip6_bucket(sitn, t);
 
-   rcu_assign_pointer(t-next, rtnl_dereference(*tp));
+   RCU_INIT_POINTER(t-next, rtnl_dereference(*tp));
rcu_assign_pointer(*tp, t);
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/