linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* compiled-in (non-modular) USB initialization bug
@ 2001-09-17 19:34 David Acklam
  2001-09-17 21:05 ` Greg KH
  2001-09-17 22:41 ` Eric Lammerts
  0 siblings, 2 replies; 5+ messages in thread
From: David Acklam @ 2001-09-17 19:34 UTC (permalink / raw)
  To: linux-kernel

A few months ago I posted a bug report about the Pegasus driver not
initializing  (or not initializing fast enough to work with NFS-Root) when
compiled-in. I've found that this is not specific to the
pegasus, as I have recently noticed that the kernel 'driver-initialized'
messages for my USB mouse and keyboard (i.e. HID devices) come up AFTER
init has been started. These drivers are also 'compiled-in'

The problem this poses is that some applications (like NFSRoot) need
access to USB devices BEFORE the kernel mounts filesystems/starts init.




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

* Re: compiled-in (non-modular) USB initialization bug
  2001-09-17 19:34 compiled-in (non-modular) USB initialization bug David Acklam
@ 2001-09-17 21:05 ` Greg KH
       [not found]   ` <Pine.LNX.4.30.0109171717200.2285-300000@Enterprise.udcnet.dyn.dhs.org>
  2001-09-17 22:41 ` Eric Lammerts
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2001-09-17 21:05 UTC (permalink / raw)
  To: David Acklam; +Cc: linux-kernel

On Mon, Sep 17, 2001 at 02:34:42PM -0500, David Acklam wrote:
> A few months ago I posted a bug report about the Pegasus driver not
> initializing  (or not initializing fast enough to work with NFS-Root) when
> compiled-in. I've found that this is not specific to the
> pegasus, as I have recently noticed that the kernel 'driver-initialized'
> messages for my USB mouse and keyboard (i.e. HID devices) come up AFTER
> init has been started. These drivers are also 'compiled-in'
> 
> The problem this poses is that some applications (like NFSRoot) need
> access to USB devices BEFORE the kernel mounts filesystems/starts init.

Could you send me / the list the kernel boot messages when this happens?
Along with the .config that you used?

thanks,

greg k-h

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

* Re: compiled-in (non-modular) USB initialization bug
       [not found]   ` <Pine.LNX.4.30.0109171717200.2285-300000@Enterprise.udcnet.dyn.dhs.org>
@ 2001-09-17 22:26     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2001-09-17 22:26 UTC (permalink / raw)
  To: David Acklam; +Cc: linux-kernel

On Mon, Sep 17, 2001 at 05:19:05PM -0500, David Acklam wrote:
> 
> I've edited the dmesg output to put a 'marker' between what's modular and
> what's compiled-in. You will note the input0 init is post-FS-mount.

I think you have a timing issue.
The USB input driver is loaded and started before init starts, but it
takes an ammount of time before the USB device is seen by the USB core
and initialized.  This seems to happen _after_ init starts up :)

Other than simply sitting and spinning in the USB init code for all of
the devices to be found before continuing on, I don't know what could be
done for this.

Anyone else have any ideas?

thanks,

greg k-h

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

* Re: compiled-in (non-modular) USB initialization bug
  2001-09-17 19:34 compiled-in (non-modular) USB initialization bug David Acklam
  2001-09-17 21:05 ` Greg KH
@ 2001-09-17 22:41 ` Eric Lammerts
  2001-09-18 19:19   ` Eric Lammerts
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Lammerts @ 2001-09-17 22:41 UTC (permalink / raw)
  To: David Acklam; +Cc: linux-kernel, netdev


On Mon, 17 Sep 2001, David Acklam wrote:
> A few months ago I posted a bug report about the Pegasus driver not
> initializing  (or not initializing fast enough to work with NFS-Root) when
> compiled-in. I've found that this is not specific to the
> pegasus, as I have recently noticed that the kernel 'driver-initialized'
> messages for my USB mouse and keyboard (i.e. HID devices) come up AFTER
> init has been started. These drivers are also 'compiled-in'
>
> The problem this poses is that some applications (like NFSRoot) need
> access to USB devices BEFORE the kernel mounts filesystems/starts init.

I had the same problem a while ago. I haven't really looked into the
usb code, but it appears USB devices are detected from a kernel
thread, i.e., asynchronously. When the USB thread has discovered the
device, the dhcp/bootp code has already failed.

The following patch adds the "ip=wait" option. It makes ipconfig.c
retry forever until is has found a suitable device to do
dhcp/bootp/rarp.

This is untested! (I don't have a USB netdevice at home). But at least
it boots ok with a PCI network card (and waits forever if I remove
support for that card from the kernel).

Of course, in the long run, a better solution is an initrd with
dhcp/bootp/rarp client in userspace. But AFAIK there is no Debian
package that does that yet ;-).

Eric


--- linux-2.4.9-ac7/net/ipv4/ipconfig.c.orig	Wed May  2 05:59:24 2001
+++ linux-2.4.9-ac7/net/ipv4/ipconfig.c	Tue Sep 18 00:19:03 2001
@@ -102,6 +102,8 @@

 int ic_enable __initdata = 0;			/* IP config enabled? */

+int ic_wait __initdata = 0;			/* wait until a device appears? */
+
 /* Protocol choice */
 int ic_proto_enabled __initdata = 0
 #ifdef IPCONFIG_BOOTP
@@ -1105,8 +1107,12 @@
 		;

 	/* Setup all network devices */
-	if (ic_open_devs() < 0)
-		return -1;
+	if (ic_open_devs() < 0) {
+		if(!ic_wait) return -1;
+
+		printk("IP-Config: Retrying forever...\n");
+		goto try_try_again;		// wait a while and try again
+	}

 	/* Give drivers a chance to settle */
 	jiff = jiffies + CONF_POST_OPEN;
@@ -1281,6 +1287,8 @@
 		(strcmp(addrs, "none") != 0));
 	if (!ic_enable)
 		return 1;
+
+	ic_wait = *addrs && (strcmp(addrs, "wait") == 0);

 	if (ic_proto_name(addrs))
 		return 1;


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

* Re: compiled-in (non-modular) USB initialization bug
  2001-09-17 22:41 ` Eric Lammerts
@ 2001-09-18 19:19   ` Eric Lammerts
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Lammerts @ 2001-09-18 19:19 UTC (permalink / raw)
  To: David Acklam; +Cc: linux-kernel, netdev, greg


On Tue, 18 Sep 2001, Eric Lammerts wrote:
>
> The following patch adds the "ip=wait" option. It makes ipconfig.c
> retry forever until is has found a suitable device to do
> dhcp/bootp/rarp.

This was a dumb patch. It didn't schedule so the USB kernel thread
could not do anything. This is fixed in the patch below. The ip=wait
parameter is gone now: it'll always wait for a net device if you're
doing nfsroot.

I've tested it with a Pegasus USB ethernet adapter and it works ok.

You can even boot the kernel without any adapter plugged in. It will
patiently wait for you to plug one in. Then it'll start the
dhcp/bootp/rarp stuff.

Eric


--- linux-2.4.9-ac7/net/ipv4/ipconfig.c.orig	Wed May  2 05:59:24 2001
+++ linux-2.4.9-ac7/net/ipv4/ipconfig.c	Tue Sep 18 17:16:07 2001
@@ -80,6 +80,8 @@
 #define CONF_PRE_OPEN		(HZ/2)	/* Before opening: 1/2 second */
 #define CONF_POST_OPEN		(1*HZ)	/* After opening: 1 second */

+#define CONF_DEV_WAIT		(1*HZ)
+
 /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
 #define CONF_OPEN_RETRIES 	2	/* (Re)open devices twice */
 #define CONF_SEND_RETRIES 	6	/* Send six requests per open */
@@ -1105,8 +1107,20 @@
 		;

 	/* Setup all network devices */
-	if (ic_open_devs() < 0)
+	while (ic_open_devs() < 0) {
+#ifdef CONFIG_ROOT_NFS
+		if (ROOT_DEV == MKDEV(UNNAMED_MAJOR, 255)) {
+			printk(KERN_ERR
+				"IP-Config: Retrying forever (NFS root)...\n");
+
+			// wait a while and try again
+		        current->state = TASK_INTERRUPTIBLE;
+                	schedule_timeout(CONF_DEV_WAIT);
+                	continue;
+		}
+#endif
 		return -1;
+        }

 	/* Give drivers a chance to settle */
 	jiff = jiffies + CONF_POST_OPEN;


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

end of thread, other threads:[~2001-09-18 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-17 19:34 compiled-in (non-modular) USB initialization bug David Acklam
2001-09-17 21:05 ` Greg KH
     [not found]   ` <Pine.LNX.4.30.0109171717200.2285-300000@Enterprise.udcnet.dyn.dhs.org>
2001-09-17 22:26     ` Greg KH
2001-09-17 22:41 ` Eric Lammerts
2001-09-18 19:19   ` Eric Lammerts

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).