netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] post-sysfs netdev cleanup
@ 2003-05-23  0:41 Jeff Muizelaar
  2003-05-23  0:44 ` David S. Miller
  2003-05-26  2:22 ` David S. Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Muizelaar @ 2003-05-23  0:41 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

The attached patch removes the struct device from struct net_device and 
sets net_device.class_dev.dev directly.
The class_dev memset is removed because all of struct net_device should 
already be memset to 0 or there will be other problems.

-Jeff

[-- Attachment #2: netdev-cleanup.patch --]
[-- Type: text/plain, Size: 1408 bytes --]

diff -urN linux-2.5.69-bk15/include/linux/netdevice.h linux-2.5.69-bk15-netdev-cleanup/include/linux/netdevice.h
--- linux-2.5.69-bk15/include/linux/netdevice.h	2003-05-22 20:14:06.000000000 -0400
+++ linux-2.5.69-bk15-netdev-cleanup/include/linux/netdevice.h	2003-05-22 20:15:56.000000000 -0400
@@ -441,9 +441,6 @@
 	struct divert_blk	*divert;
 #endif /* CONFIG_NET_DIVERT */
 
-	/* generic device structure used in constructing class */
-	struct device		*dev;
-
 	/* class/net/name entry */
 	struct class_device	class_dev;
 
@@ -455,7 +452,7 @@
 /* Set the sysfs physical device reference for the network logical device
  * if set prior to registration will cause a symlink during initialization.
  */
-#define SET_NETDEV_DEV(net, pdev)	((net)->dev = (pdev))
+#define SET_NETDEV_DEV(net, pdev)	((net)->class_dev.dev = (pdev))
 
 
 struct packet_type 
diff -urN linux-2.5.69-bk15/net/core/net-sysfs.c linux-2.5.69-bk15-netdev-cleanup/net/core/net-sysfs.c
--- linux-2.5.69-bk15/net/core/net-sysfs.c	2003-05-22 20:14:08.000000000 -0400
+++ linux-2.5.69-bk15-netdev-cleanup/net/core/net-sysfs.c	2003-05-22 20:15:56.000000000 -0400
@@ -291,9 +291,7 @@
 	struct class_device_attribute *attr;
 	int ret;
 
-	memset(class_dev, 0, sizeof(struct class_device)); 
 	class_dev->class = &net_class;
-	class_dev->dev = net->dev;
 	class_dev->class_data = net;
 
 	snprintf(class_dev->class_id, BUS_ID_SIZE, net->name);

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

* Re: [PATCH] post-sysfs netdev cleanup
  2003-05-23  0:41 [PATCH] post-sysfs netdev cleanup Jeff Muizelaar
@ 2003-05-23  0:44 ` David S. Miller
       [not found]   ` <3ECEB317.5020407@osdl.org>
  2003-05-26  2:22 ` David S. Miller
  1 sibling, 1 reply; 6+ messages in thread
From: David S. Miller @ 2003-05-23  0:44 UTC (permalink / raw)
  To: muizelaar; +Cc: shemminger, netdev

   From: Jeff Muizelaar <muizelaar@rogers.com>
   Date: Thu, 22 May 2003 20:41:17 -0400

   The attached patch removes the struct device from struct net_device
   and sets net_device.class_dev.dev directly.
   The class_dev memset is removed because all of struct net_device
   should already be memset to 0 or there will be other problems.

Looks fine to me, Stephen?

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

* Re: [PATCH] post-sysfs netdev cleanup
  2003-05-23  0:41 [PATCH] post-sysfs netdev cleanup Jeff Muizelaar
  2003-05-23  0:44 ` David S. Miller
@ 2003-05-26  2:22 ` David S. Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David S. Miller @ 2003-05-26  2:22 UTC (permalink / raw)
  To: muizelaar; +Cc: shemminger, netdev

   From: Jeff Muizelaar <muizelaar@rogers.com>
   Date: Thu, 22 May 2003 20:41:17 -0400

   The attached patch removes the struct device from struct net_device
   and sets net_device.class_dev.dev directly.

Applied, thanks.

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

* Re: [PATCH] post-sysfs netdev cleanup
       [not found]   ` <3ECEB317.5020407@osdl.org>
@ 2003-05-26  2:24     ` David S. Miller
  2003-05-27 16:51       ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2003-05-26  2:24 UTC (permalink / raw)
  To: shemminger; +Cc: muizelaar, netdev

   From: Stephen Hemminger <shemminger@osdl.org>
   Date: Fri, 23 May 2003 16:47:35 -0700

   Seems like a good idea too.
   
Ok, great.

Stephen, I think we need to find a way to put the device
registration call outside of the RTNL semaphore.  I removed
in the unregister case, but to be complete we have to push it out in
the register path too.

The reason for all of these issues is that link_watch grabs the RTNL
semaphore, and this runs via keventd.  Thus, trying to invoke any
usermode helper (/sbin/hotplug etc.) while holding the RTNL semaphore
can deadlock.

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

* Re: [PATCH] post-sysfs netdev cleanup
  2003-05-26  2:24     ` David S. Miller
@ 2003-05-27 16:51       ` Stephen Hemminger
  2003-05-28  8:33         ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2003-05-27 16:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: muizelaar, netdev

On Sun, 25 May 2003 19:24:17 -0700 (PDT)
"David S. Miller" <davem@redhat.com> wrote:

>    From: Stephen Hemminger <shemminger@osdl.org>
>    Date: Fri, 23 May 2003 16:47:35 -0700
> 
>    Seems like a good idea too.
>    
> Ok, great.
> 
> Stephen, I think we need to find a way to put the device
> registration call outside of the RTNL semaphore.  I removed
> in the unregister case, but to be complete we have to push it out in
> the register path too.
> 
> The reason for all of these issues is that link_watch grabs the RTNL
> semaphore, and this runs via keventd.  Thus, trying to invoke any
> usermode helper (/sbin/hotplug etc.) while holding the RTNL semaphore
> can deadlock.

There needs to be some locking in the registration path doesn't there
to prevent two calls to register the same name and other possible conflicts.
So do you want to use dev_base lock or some other locking?

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

* Re: [PATCH] post-sysfs netdev cleanup
  2003-05-27 16:51       ` Stephen Hemminger
@ 2003-05-28  8:33         ` David S. Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2003-05-28  8:33 UTC (permalink / raw)
  To: shemminger; +Cc: muizelaar, netdev

   From: Stephen Hemminger <shemminger@osdl.org>
   Date: Tue, 27 May 2003 09:51:29 -0700
   
   There needs to be some locking in the registration path doesn't there
   to prevent two calls to register the same name and other possible conflicts.
   So do you want to use dev_base lock or some other locking?
   
Good point.  We can't be as "fast and loose" with this as we
can with the hotplug invocation...

I can't come up with a usable solution at this moment. :(

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

end of thread, other threads:[~2003-05-28  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-23  0:41 [PATCH] post-sysfs netdev cleanup Jeff Muizelaar
2003-05-23  0:44 ` David S. Miller
     [not found]   ` <3ECEB317.5020407@osdl.org>
2003-05-26  2:24     ` David S. Miller
2003-05-27 16:51       ` Stephen Hemminger
2003-05-28  8:33         ` David S. Miller
2003-05-26  2:22 ` David S. 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).