netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Cc: Jiri Pirko <jiri@mellanox.com>, Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [Patch net-next] act_mirred: get rid of mirred_list_lock spinlock
Date: Thu, 30 Nov 2017 15:12:04 -0800	[thread overview]
Message-ID: <1512083524.19682.29.camel@gmail.com> (raw)
In-Reply-To: <20171130225335.6957-2-xiyou.wangcong@gmail.com>

On Thu, 2017-11-30 at 14:53 -0800, Cong Wang wrote:
> TC actions are no longer freed in RCU callbacks and we should
> always have RTNL lock, so this spinlock is no longer needed.
> 
> Cc: Jiri Pirko <jiri@mellanox.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>  net/sched/act_mirred.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
> index fe6489f9c3cf..2c51952bf2d4 100644
> --- a/net/sched/act_mirred.c
> +++ b/net/sched/act_mirred.c
> @@ -29,7 +29,6 @@
>  #include <net/tc_act/tc_mirred.h>
>  
>  static LIST_HEAD(mirred_list);
> -static DEFINE_SPINLOCK(mirred_list_lock);
>  
>  static bool tcf_mirred_is_act_redirect(int action)
>  {
> @@ -55,13 +54,10 @@ static void tcf_mirred_release(struct tc_action
> *a, int bind)
>  	struct tcf_mirred *m = to_mirred(a);
>  	struct net_device *dev;
>  
> -	/* We could be called either in a RCU callback or with RTNL
> lock held. */
> -	spin_lock_bh(&mirred_list_lock);
>  	list_del(&m->tcfm_list);
>  	dev = rcu_dereference_protected(m->tcfm_dev, 1);

If RTNL is held at this point, I suggest to use
rtnl_dereference() instead of rcu_dereference_protected() to get proper
lockdep coverage.


>  	if (dev)
>  		dev_put(dev);
> -	spin_unlock_bh(&mirred_list_lock);
>  }
>  

  reply	other threads:[~2017-11-30 23:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 22:53 [Patch net-next] act_mirred: use tcfm_dev in tcf_mirred_get_dev() Cong Wang
2017-11-30 22:53 ` [Patch net-next] act_mirred: get rid of mirred_list_lock spinlock Cong Wang
2017-11-30 23:12   ` Eric Dumazet [this message]
2017-12-01  1:02     ` Cong Wang
2017-12-01 17:56 ` [Patch net-next] act_mirred: use tcfm_dev in tcf_mirred_get_dev() Jiri Pirko
2017-12-01 21:46   ` Cong Wang
2017-12-02  6:56     ` Jiri Pirko
2017-12-02  8:57 ` Jiri Pirko
2017-12-02 19:47   ` Cong Wang
2017-12-02 19:53     ` Cong Wang
2017-12-03  6:39       ` Jiri Pirko

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=1512083524.19682.29.camel@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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).