diff mbox

[GIT] : Networking

Message ID 20090805071411.GA9217@elte.hu
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Ingo Molnar Aug. 5, 2009, 7:14 a.m. UTC
* Ingo Molnar <mingo@elte.hu> wrote:

> FYI, -tip testing found that these bits trigger a missing lockdep 
> annotation warning:

it's apparently using an zero-initialized spinlock. This is a 
side-effect of:

        dev_unicast_init(dev);

in alloc_netdev_mq() making use of dev->addr_list_lock.

Wouldnt the patch below be the right fix? The device has just been 
allocated freshly, it's not accessible anywhere yet so no locking is 
needed at all - in fact it's wrong to lock it here (the lock isnt 
initialized yet).

This bug was apparently introduced via:

| commit a6ac65db2329e7685299666f5f7b6093c7b0f3a0
| Author: Jiri Pirko <jpirko@redhat.com>
| Date:   Thu Jul 30 01:06:12 2009 +0000
|
|     net: restore the original spinlock to protect unicast list

it needlessly added new locking and apparently nobody ran this patch 
with lockdep.

	Ingo

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Dumazet Aug. 5, 2009, 7:19 a.m. UTC | #1
Ingo Molnar a écrit :
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
>> FYI, -tip testing found that these bits trigger a missing lockdep 
>> annotation warning:
> 
> it's apparently using an zero-initialized spinlock. This is a 
> side-effect of:
> 
>         dev_unicast_init(dev);
> 
> in alloc_netdev_mq() making use of dev->addr_list_lock.
> 
> Wouldnt the patch below be the right fix? The device has just been 
> allocated freshly, it's not accessible anywhere yet so no locking is 
> needed at all - in fact it's wrong to lock it here (the lock isnt 
> initialized yet).
> 
> This bug was apparently introduced via:
> 
> | commit a6ac65db2329e7685299666f5f7b6093c7b0f3a0
> | Author: Jiri Pirko <jpirko@redhat.com>
> | Date:   Thu Jul 30 01:06:12 2009 +0000
> |
> |     net: restore the original spinlock to protect unicast list
> 
> it needlessly added new locking and apparently nobody ran this patch 
> with lockdep.
> 
> 	Ingo
> 
> Index: linux2/net/core/dev.c
> ===================================================================
> --- linux2.orig/net/core/dev.c
> +++ linux2/net/core/dev.c
> @@ -4007,9 +4007,7 @@ static void dev_unicast_flush(struct net
>  
>  static void dev_unicast_init(struct net_device *dev)
>  {
> -	netif_addr_lock_bh(dev);
>  	__hw_addr_init(&dev->uc);
> -	netif_addr_unlock_bh(dev);
>  }
>  
>  


Indeed, this function is static and thus only called from alloc_netdev_mq()

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux2/net/core/dev.c
===================================================================
--- linux2.orig/net/core/dev.c
+++ linux2/net/core/dev.c
@@ -4007,9 +4007,7 @@  static void dev_unicast_flush(struct net
 
 static void dev_unicast_init(struct net_device *dev)
 {
-	netif_addr_lock_bh(dev);
 	__hw_addr_init(&dev->uc);
-	netif_addr_unlock_bh(dev);
 }