* [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations.
@ 2012-01-09 16:18 Jiri Pirko
2012-01-09 16:18 ` [patch net-next 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate Jiri Pirko
2012-01-09 20:47 ` [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations David Miller
0 siblings, 2 replies; 7+ messages in thread
From: Jiri Pirko @ 2012-01-09 16:18 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
net/core/dev_addr_lists.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index febba51..c34ce9f 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -427,7 +427,7 @@ EXPORT_SYMBOL(dev_uc_del);
*
* Add newly added addresses to the destination device and release
* addresses that have no users left. The source device must be
- * locked by netif_tx_lock_bh.
+ * locked by netif_addr_lock_bh.
*
* This function is intended to be called from the dev->set_rx_mode
* function of layered software devices.
@@ -590,7 +590,7 @@ EXPORT_SYMBOL(dev_mc_del_global);
*
* Add newly added addresses to the destination device and release
* addresses that have no users left. The source device must be
- * locked by netif_tx_lock_bh.
+ * locked by netif_addr_lock_bh.
*
* This function is intended to be called from the ndo_set_rx_mode
* function of layered software devices.
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch net-next 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate
2012-01-09 16:18 [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations Jiri Pirko
@ 2012-01-09 16:18 ` Jiri Pirko
2012-01-09 16:36 ` [patch net-next v2 " Jiri Pirko
2012-01-09 20:47 ` [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations David Miller
1 sibling, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2012-01-09 16:18 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet
dev_uc_sync() and dev_mc_sync() are acquiring netif_addr_lock for
destination device of synchronization. Since netif_addr_lock is already
held at the time for source device, this triggers depmod deathlock
warning.
There's no way this deathlock can happen so use spin_lock_nested() to
silence the warning.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
include/linux/netdevice.h | 5 +++++
net/core/dev_addr_lists.c | 12 ++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a1d1095..656fade 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
spin_lock(&dev->addr_list_lock);
}
+static inline void netif_addr_lock_nested(struct net_device *dev)
+{
+ spin_lock_nested(&dev->addr_list_lock, DENTRY_D_LOCK_NESTED);
+}
+
static inline void netif_addr_lock_bh(struct net_device *dev)
{
spin_lock_bh(&dev->addr_list_lock);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index c34ce9f..29c07fe 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -439,11 +439,11 @@ int dev_uc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_bh(to);
+ netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
- netif_addr_unlock_bh(to);
+ netif_addr_unlock(to);
return err;
}
EXPORT_SYMBOL(dev_uc_sync);
@@ -463,7 +463,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock(to);
+ netif_addr_lock_nested(to);
__hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
@@ -602,11 +602,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_bh(to);
+ netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
- netif_addr_unlock_bh(to);
+ netif_addr_unlock(to);
return err;
}
EXPORT_SYMBOL(dev_mc_sync);
@@ -626,7 +626,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock(to);
+ netif_addr_lock_nested(to);
__hw_addr_unsync(&to->mc, &from->mc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch net-next v2 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate
2012-01-09 16:18 ` [patch net-next 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate Jiri Pirko
@ 2012-01-09 16:36 ` Jiri Pirko
2012-01-09 19:07 ` Ben Hutchings
0 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2012-01-09 16:36 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet
dev_uc_sync() and dev_mc_sync() are acquiring netif_addr_lock for
destination device of synchronization. Since netif_addr_lock is already
held at the time for source device, this triggers depmod deathlock
warning.
There's no way this deathlock can happen so use spin_lock_nested() to
silence the warning.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
v1->v2:
use SINGLE_DEPTH_NESTING instead of wrongly c&p'ed DENTRY_D_LOCK_NESTED
---
include/linux/netdevice.h | 5 +++++
net/core/dev_addr_lists.c | 12 ++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a1d1095..d0522bb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
spin_lock(&dev->addr_list_lock);
}
+static inline void netif_addr_lock_nested(struct net_device *dev)
+{
+ spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
+}
+
static inline void netif_addr_lock_bh(struct net_device *dev)
{
spin_lock_bh(&dev->addr_list_lock);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index c34ce9f..29c07fe 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -439,11 +439,11 @@ int dev_uc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_bh(to);
+ netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
- netif_addr_unlock_bh(to);
+ netif_addr_unlock(to);
return err;
}
EXPORT_SYMBOL(dev_uc_sync);
@@ -463,7 +463,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock(to);
+ netif_addr_lock_nested(to);
__hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
@@ -602,11 +602,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_bh(to);
+ netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
- netif_addr_unlock_bh(to);
+ netif_addr_unlock(to);
return err;
}
EXPORT_SYMBOL(dev_mc_sync);
@@ -626,7 +626,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock(to);
+ netif_addr_lock_nested(to);
__hw_addr_unsync(&to->mc, &from->mc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch net-next v2 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate
2012-01-09 16:36 ` [patch net-next v2 " Jiri Pirko
@ 2012-01-09 19:07 ` Ben Hutchings
2012-01-09 20:47 ` David Miller
2012-01-09 23:47 ` Jiri Pirko
0 siblings, 2 replies; 7+ messages in thread
From: Ben Hutchings @ 2012-01-09 19:07 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, eric.dumazet
On Mon, 2012-01-09 at 17:36 +0100, Jiri Pirko wrote:
> dev_uc_sync() and dev_mc_sync() are acquiring netif_addr_lock for
> destination device of synchronization. Since netif_addr_lock is already
> held at the time for source device, this triggers depmod deathlock
> warning.
[...]
I think you mean '...lockdep deadlock warning'?
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations.
2012-01-09 16:18 [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations Jiri Pirko
2012-01-09 16:18 ` [patch net-next 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate Jiri Pirko
@ 2012-01-09 20:47 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2012-01-09 20:47 UTC (permalink / raw)
To: jpirko; +Cc: netdev, eric.dumazet
From: Jiri Pirko <jpirko@redhat.com>
Date: Mon, 9 Jan 2012 17:18:34 +0100
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch net-next v2 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate
2012-01-09 19:07 ` Ben Hutchings
@ 2012-01-09 20:47 ` David Miller
2012-01-09 23:47 ` Jiri Pirko
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2012-01-09 20:47 UTC (permalink / raw)
To: bhutchings; +Cc: jpirko, netdev, eric.dumazet
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 9 Jan 2012 19:07:08 +0000
> On Mon, 2012-01-09 at 17:36 +0100, Jiri Pirko wrote:
>> dev_uc_sync() and dev_mc_sync() are acquiring netif_addr_lock for
>> destination device of synchronization. Since netif_addr_lock is already
>> held at the time for source device, this triggers depmod deathlock
>> warning.
> [...]
>
> I think you mean '...lockdep deadlock warning'?
Applied with this wording fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch net-next v2 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate
2012-01-09 19:07 ` Ben Hutchings
2012-01-09 20:47 ` David Miller
@ 2012-01-09 23:47 ` Jiri Pirko
1 sibling, 0 replies; 7+ messages in thread
From: Jiri Pirko @ 2012-01-09 23:47 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, davem, eric.dumazet
Mon, Jan 09, 2012 at 08:07:08PM CET, bhutchings@solarflare.com wrote:
>On Mon, 2012-01-09 at 17:36 +0100, Jiri Pirko wrote:
>> dev_uc_sync() and dev_mc_sync() are acquiring netif_addr_lock for
>> destination device of synchronization. Since netif_addr_lock is already
>> held at the time for source device, this triggers depmod deathlock
>> warning.
>[...]
>
>I think you mean '...lockdep deadlock warning'?
That's him :) I mixed that up a bit. Sorry :(
Jirka
>
>Ben.
>
>--
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-01-09 23:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 16:18 [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations Jiri Pirko
2012-01-09 16:18 ` [patch net-next 2/2] net: introduce netif_addr_lock_nested() and call if when appropriate Jiri Pirko
2012-01-09 16:36 ` [patch net-next v2 " Jiri Pirko
2012-01-09 19:07 ` Ben Hutchings
2012-01-09 20:47 ` David Miller
2012-01-09 23:47 ` Jiri Pirko
2012-01-09 20:47 ` [patch net-next 1/2] net: correct lock name in dev_[uc/mc]_sync documentations David Miller
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).