All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] macvlan: silence RCU list debugging warning
@ 2020-04-22  2:11 Wei Yongjun
  2020-04-23  2:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2020-04-22  2:11 UTC (permalink / raw)
  To: Eric Dumazet, Gustavo A. R. Silva, Taehee Yoo, Richard Cochran
  Cc: Wei Yongjun, netdev

macvlan_hash_lookup() uses list_for_each_entry_rcu() for traversing
should either under RCU in fast path or the protection of rtnl_mutex.

In the case of holding RTNL, we should add the corresponding lockdep
expression to silence the following false-positive warning:

=============================
WARNING: suspicious RCU usage
5.7.0-rc1-next-20200416-00003-ga3b8d28bc #1 Not tainted
-----------------------------
drivers/net/macvlan.c:126 RCU-list traversed in non-reader section!!

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 - > v2: update the changelogs
---
 drivers/net/macvlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index e7289d67268f..654c1fa11826 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -123,7 +123,8 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
 	struct macvlan_dev *vlan;
 	u32 idx = macvlan_eth_hash(addr);
 
-	hlist_for_each_entry_rcu(vlan, &port->vlan_hash[idx], hlist) {
+	hlist_for_each_entry_rcu(vlan, &port->vlan_hash[idx], hlist,
+				 lockdep_rtnl_is_held()) {
 		if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr))
 			return vlan;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2] macvlan: silence RCU list debugging warning
  2020-04-22  2:11 [PATCH net-next v2] macvlan: silence RCU list debugging warning Wei Yongjun
@ 2020-04-23  2:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-23  2:34 UTC (permalink / raw)
  To: weiyongjun1; +Cc: edumazet, gustavo, ap420073, richardcochran, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Wed, 22 Apr 2020 10:11:35 +0800

> macvlan_hash_lookup() uses list_for_each_entry_rcu() for traversing
> should either under RCU in fast path or the protection of rtnl_mutex.
> 
> In the case of holding RTNL, we should add the corresponding lockdep
> expression to silence the following false-positive warning:
> 
> =============================
> WARNING: suspicious RCU usage
> 5.7.0-rc1-next-20200416-00003-ga3b8d28bc #1 Not tainted
> -----------------------------
> drivers/net/macvlan.c:126 RCU-list traversed in non-reader section!!
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied, thanks Wei.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  2:11 [PATCH net-next v2] macvlan: silence RCU list debugging warning Wei Yongjun
2020-04-23  2:34 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.