netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Arend van Spriel <arend@broadcom.com>
Cc: Monam Agarwal <monamagarwal123@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	eddie.wai@broadcom.com
Subject: Re: [PATCH 0/9] Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x,NULL)
Date: Thu, 20 Mar 2014 08:06:01 -0700	[thread overview]
Message-ID: <20140320150601.GK4405@linux.vnet.ibm.com> (raw)
In-Reply-To: <532B022C.8010505@broadcom.com>

On Thu, Mar 20, 2014 at 03:58:52PM +0100, Arend van Spriel wrote:
> On 20/03/14 15:37, Monam Agarwal wrote:
> >This patchset uses following coccinelle script to replace
> >rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x,NULL)
> >
> >@@
> >expression E;
> >@@
> >- rcu_assign_pointer(
> >+ RCU_INIT_POINTER(
> >E, NULL)
> 
> I am not very familiar with rcu functionality nor coccinelle, but it
> looks too generic. I would think only NULL assignments during
> initialization should use RCU_INIT_POINTER(). The first patch in the
> series does it in a function called unregister_...(). Is it really
> ok to do there?

Hello, Arend,

The thing that rcu_assign_pointer() is doing is ensuring that the
initialization of a structure is carried out before storing a pointer
to that structure.  In the case of the NULL pointer, there is no
structure to initialize, so nothing need be ordered.

So, yes, rcu_assign_pointer(p, NULL) can always safely be converted to
RCU_INIT_POINTER(p, NULL).  ;-)

							Thanx, Paul

  reply	other threads:[~2014-03-20 15:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 14:37 [PATCH 0/9] Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x,NULL) Monam Agarwal
2014-03-20 14:38 ` [PATCH 1/9] net/ethernet: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/net/ethernet/broadcom/bnx2.c Monam Agarwal
2014-03-20 14:39 ` [PATCH 2/9] net/ethernet: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c Monam Agarwal
2014-03-20 14:40 ` [PATCH 3/9] net: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/net/macvtap.c Monam Agarwal
2014-03-20 14:41 ` [PATCH 4/9] net: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/net/ppp/pptp.c Monam Agarwal
2014-03-20 14:42 ` [PATCH 5/9] net/wireless: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/net/wireless/ath/carl9170/main.c Monam Agarwal
2014-03-20 14:44 ` [PATCH 6/9] scsi: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/scsi/libfc/fc_libfc.c Monam Agarwal
2014-03-20 14:45 ` [PATCH 7/9] target: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/target/tcm_fc/tfc_sess.c Monam Agarwal
2014-03-20 14:46 ` [PATCH 8/9] vhost: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in drivers/vhost/net.c Monam Agarwal
2014-03-20 14:46 ` [PATCH 9/9] vhost: Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL) in test.c Monam Agarwal
2014-03-20 14:58 ` [PATCH 0/9] Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x,NULL) Arend van Spriel
2014-03-20 15:06   ` Paul E. McKenney [this message]
2014-03-20 16:26     ` Arend van Spriel
2014-03-20 21:04 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2014-03-18 22:39 Monam Agarwal

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=20140320150601.GK4405@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=arend@broadcom.com \
    --cc=eddie.wai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monamagarwal123@gmail.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).