From: John Fastabend <john.fastabend@gmail•com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel•com>
Cc: davem@davemloft•net, John Fastabend <john.r.fastabend@intel•com>,
netdev@vger•kernel.org, gospo@redhat•com, sassmann@redhat•com,
Veaceslav Falico <vfalico@redhat•com>
Subject: Re: [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held
Date: Tue, 19 Nov 2013 09:18:42 -0800 [thread overview]
Message-ID: <528B9D72.1090004@gmail.com> (raw)
In-Reply-To: <1384875654-7795-2-git-send-email-jeffrey.t.kirsher@intel.com>
On 11/19/2013 07:40 AM, Jeff Kirsher wrote:
> From: John Fastabend <john.r.fastabend@intel•com>
>
> It is useful to be able to walk all upper devices when bringing
> a device online where the RTNL lock is held. In this case it
> is safe to walk the all_adj_list because the RTNL lock is used
> to protect the write side as well.
>
> Here we rearrange the netdev_all_upper_get_next_dev_rcu into three
> routines:
>
> netdev_all_upper_get_next_dev_rcu()
> netdev_all_upper_get_next_dev_rtnl()
> netdev_all_upper_get_next_dev()
>
> One for RCU callers, one for RTNL callers and a final routine
> to implement the work. Both the _rcu and _rtnl variants are
> exposed. Where the net/ethernet/intel/ixgbe driver is a consumer
> of the _rtnl variant. netdev_all_upper_get_next_dev() is static.
>
> CC: Veaceslav Falico <vfalico@redhat•com>
> Signed-off-by: John Fastabend <john.r.fastabend@intel•com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel•com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel•com>
> ---
[...]
NAK, lockdep_rtnl_is_held() is wrapped in CONFIG_PROVE_LOCKING,
#ifdef CONFIG_PROVE_LOCKING
extern int lockdep_rtnl_is_held(void);
#endif /* #ifdef CONFIG_PROVE_LOCKING */
[...]
> +struct net_device *netdev_all_upper_get_next_dev_rtnl(struct net_device *dev,
> + struct list_head **iter)
> +{
> + WARN_ON_ONCE(!lockdep_rtnl_is_held());
so this can cause a build error without CONFIG_PROVE_LOCKING. I can
either wrap this in a CONFIG_PROVE_LOCKING or do something like this,
extern int rtnl_is_locked(void);
#ifdef CONFIG_PROVE_LOCKING
extern int lockdep_rtnl_is_held(void);
+#else
+static inline int lockdep_rtnl_is_held(void)
+{
+ return 0;
+}
#endif /* #ifdef CONFIG_PROVE_LOCKING */
The lazy way to do this is to wrap the call site in rcu_read_{un}lock
but I would prefer not to do that.
> + return netdev_all_upper_get_next_dev(dev, iter);
> +}
Sorry for the noise I'll spin a new version.
John
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2013-11-19 17:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 15:40 [net 0/3][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
2013-11-19 17:18 ` John Fastabend [this message]
2013-11-19 15:40 ` [net 2/3] igb: Fixed Wake On Lan support Jeff Kirsher
2013-11-19 15:40 ` [net 3/3] igb: Update queue reinit function to call dev_close when init of queues fails Jeff Kirsher
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=528B9D72.1090004@gmail.com \
--to=john.fastabend@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=gospo@redhat$(echo .)com \
--cc=jeffrey.t.kirsher@intel$(echo .)com \
--cc=john.r.fastabend@intel$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sassmann@redhat$(echo .)com \
--cc=vfalico@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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