public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: David Miller <davem@davemloft.net>
Cc: anders.roxell@linaro.org, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: ipmr: fix suspicious RCU warning
Date: Tue, 19 Nov 2019 17:12:17 -0800	[thread overview]
Message-ID: <20191120011217.GM2889@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20191119.145048.487849503145486152.davem@davemloft.net>

On Tue, Nov 19, 2019 at 02:50:48PM -0800, David Miller wrote:
> From: Anders Roxell <anders.roxell@linaro.org>
> Date: Mon, 18 Nov 2019 10:09:25 +0100
> 
> > @@ -108,9 +108,18 @@ static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt);
> >  static void mroute_clean_tables(struct mr_table *mrt, int flags);
> >  static void ipmr_expire_process(struct timer_list *t);
> >  
> > +#ifdef CONFIG_PROVE_LOCKING
> > +int ip_mr_initialized;
> > +void ip_mr_now_initialized(void) { ip_mr_initialized = 1; }
> > +#else
> > +const int ip_mr_initialized = 1;
> > +void ip_mr_now_initialized(void) { }
> > +#endif
> 
> This seems excessive and a bit not so pretty.
> 
> > +
> >  #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
> >  #define ipmr_for_each_table(mrt, net) \
> > -	list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list)
> > +	list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \
> > +			(lockdep_rtnl_is_held() || !ip_mr_initialized))
> >  
> >  static struct mr_table *ipmr_mr_table_iter(struct net *net,
> >  					   struct mr_table *mrt)
> 
> The problematic code path is ipmr_rules_init() done during ipmr_net_init().
> 
> You can just wrap this call around RCU locking or take the RTNL mutex.

Agreed, that would work quite well.

							Thanx, Paul

> That way you don't need to rediculous ip_mr_initialized knob which frankly
> doesn't even seem accurate to me.  It's a centralized global variable
> which is holding state about multiple network namespace objects which makes
> absolutely no sense at all, it's wrong.

      reply	other threads:[~2019-11-20  1:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  9:09 [PATCH] net: ipmr: fix suspicious RCU warning Anders Roxell
2019-11-19 22:50 ` David Miller
2019-11-20  1:12   ` Paul E. McKenney [this message]

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=20191120011217.GM2889@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=anders.roxell@linaro.org \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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