Skip to contentSkip to conversation

2.5.5-pre1 rmmod usb-uhci hangs

DISCUSSION Dan Hopper 4 participants 9 messages Feb 24, 2002 – Feb 26, 2002 1 message not in the archive USB

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dan Hopper

author
#1 lore raw

Greg KH <[email protected]> remarked:

Quoted 17 lines · Patrick Mochel
Quoted 7 lines · Patrick Mochel
Quoted 5 lines
Quoted 4 lines

no, it doesn't solve the problem. i would like to test it whith preemtible kernel not set but it doesn't boot.

Quoted 7 lines
Quoted 2 lines

While Greg's patch did fix part of the problem, the rest of it was on my end. Could you try this patch, and see if helps?

Actually, the patch that I sent is against my current tree, which includes some changes that I've already pushed to Linus. If you're using BK, you should be able to pull his current tree (if you're into that kinda thing). Or, wait until -pre2. Sorry about that.

Quoted 4 lines

Your current tree, + this patch, + my patch solves all of the unloading, removing, and loading problems that I had been seeing.

Thanks for finding this.

I wonder if anyone might look at doing the same sort of fix to the 2.4.18 working tree? I experience the same sort of behavior with usb-uhci on my KT266A board (VT82C586B USB) on 2.4.18-rc1 (and previous 2.4.x kernels, too). I'd do it myself, but the patch from Patrick on inode.c makes me too nervous to do it, since I have no experience with the filesystem drivers.

Thanks,
Dan Hopper

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Dan Hopper

I wonder if anyone might look at doing the same sort of fix to the 2.4.18 working tree? I experience the same sort of behavior with usb-uhci on my KT266A board (VT82C586B USB) on 2.4.18-rc1 (and previous 2.4.x kernels, too). I'd do it myself, but the patch from Patrick on inode.c makes me too nervous to do it, since I have no experience with the filesystem drivers.

These patches will not apply for the 2.4 tree, even if you tried :)

What problems are you having with 2.4.18-rc1 and previous? Any oops messages?

thanks,

greg k-h

#3 lore raw
In reply to a message not in the archive

Greg KH <[email protected]> remarked:

Quoted 4 lines

These patches will not apply for the 2.4 tree, even if you tried :)

What problems are you having with 2.4.18-rc1 and previous? Any oops messages?

Hi,

Well, basically if I use usb-uhci instead of uhci, the computer locks during the shutdown process. I believe I've used the stock Mandrake 8.1 kernel as well as 2.4.17 and 2.4.18-rc1 with similar results. Mandrake even seems to make a note of the issue:

http://www.linux-mandrake.com/en/errata.php3

"Error scenario: The computer locks up when shutting down or when
stopping the usb service.
Why: In certain cases, the usb-uhci module is broken for some usb
devices.
Solution: Modify your /etc/modules.conf file and change the line
"alias usb-interface usb-uhci" to "alias usb-interface uhci". The change will take effect after the next shutdown and will prevent the usb service from locking up the computer."

I have a Brother HL-1450 Postscript printer and an HP Scanjet 6300C attached, FWIW.

The reason I'd like to switch back to usb-uhci instead of uhci is
twfold: Vmware seems to want to only use usb-uhci and not uhci (dummies!). And uhci seems to be unable to get the scanner going such that it doesn't "stutter" all the way down the page. usb-uhci seems to be able to keep up so that it just sweeps on down the page.

I saw the thread on usb-uhci on 2.5, and it looked so similar that I (incorrectly) assumed them to be one and the same problem.

Thanks,
Dan

#4 lore raw
In reply to a message not in the archive
Quoted 6 lines · Dan Hopper

The reason I'd like to switch back to usb-uhci instead of uhci is
twfold: Vmware seems to want to only use usb-uhci and not uhci (dummies!). And uhci seems to be unable to get the scanner going such that it doesn't "stutter" all the way down the page. usb-uhci seems to be able to keep up so that it just sweeps on down the page.

I noticed that Vmware does that, and was wondering why.

If you get a chance, can you try the uhci patches that were posted on linux-usb-devel last week, or all of them rolled up at:

	http://www.kernel.org/pub/linux/kernel/people/gregkh/usb/linux-2.4.18-rc2-gregkh-1.patch.gz

and let me know if that solves your problem with uhci or not?

thanks,

greg k-h

#5 lore raw
In reply to a message not in the archive

Greg KH <[email protected]> remarked:

Quoted 8 lines · Dan Hopper
Quoted 6 lines

The reason I'd like to switch back to usb-uhci instead of uhci is
twfold: Vmware seems to want to only use usb-uhci and not uhci (dummies!). And uhci seems to be unable to get the scanner going such that it doesn't "stutter" all the way down the page. usb-uhci seems to be able to keep up so that it just sweeps on down the page.

Quoted 6 lines

I noticed that Vmware does that, and was wondering why.

If you get a chance, can you try the uhci patches that were posted on linux-usb-devel last week, or all of them rolled up at:

	http://www.kernel.org/pub/linux/kernel/people/gregkh/usb/linux-2.4.18-rc2-gregkh-1.patch.gz

and let me know if that solves your problem with uhci or not?

Well, that was interesting. I upgraded to rc2 and applied that patch. uhci still behaved the same (can't keep up with scanner). But usb-uhci now doesn't lock up the system on a shutdown. And it was the patch that did it, not rc2, because I tried a pristine rc2 build, too, and it still locks up. I note that there's nothing in the patch that directly touches usb-uhci, so it must be a side affect of some other fix.

(I'd still like to eventually get uhci working, since the docs indicate it's the newer, cooler driver. And the ipaq driver indicates uhci is preferred over the usb-uhci driver.)

Thanks, Greg! That was quite useful.

Dan

#6 lore raw
In reply to a message not in the archive
Quoted 16 lines · Dan Hopper

Greg KH <[email protected]> remarked:

Quoted 8 lines · Dan Hopper
Quoted 6 lines

The reason I'd like to switch back to usb-uhci instead of uhci is
twfold: Vmware seems to want to only use usb-uhci and not uhci (dummies!). And uhci seems to be unable to get the scanner going such that it doesn't "stutter" all the way down the page. usb-uhci seems to be able to keep up so that it just sweeps on down the page.

Quoted 6 lines

I noticed that Vmware does that, and was wondering why.

If you get a chance, can you try the uhci patches that were posted on linux-usb-devel last week, or all of them rolled up at:

	http://www.kernel.org/pub/linux/kernel/people/gregkh/usb/linux-2.4.18-rc2-gregkh-1.patch.gz

and let me know if that solves your problem with uhci or not?

Quoted 7 lines

Well, that was interesting. I upgraded to rc2 and applied that patch. uhci still behaved the same (can't keep up with scanner). But usb-uhci now doesn't lock up the system on a shutdown. And it was the patch that did it, not rc2, because I tried a pristine rc2 build, too, and it still locks up. I note that there's nothing in the patch that directly touches usb-uhci, so it must be a side affect of some other fix.

Hmm, that is interesting. I wonder what is going on with it. Are you using the scanner kernel driver?

JE

#7 lore raw
In reply to a message not in the archive

Johannes Erdfelt <[email protected]> remarked:

Quoted 2 lines

Hmm, that is interesting. I wonder what is going on with it. Are you using the scanner kernel driver?

Yes. And sane 1.0.5. FWIW, the command I'm using that stutters with uhci and not usb-uhci is:

scanimage --mode lineart --resolution 600 -x 203.2 -y 271.0 \
	--contrast 0 --brightness 0  > /tmp/copy.pbm

That results in a 3848837 byte file in about 37 seconds with usb-uhci. Not exactly pushing the USB 1.1 bandwidth. (unless there's a significant discrepancy between the bits coming from the scanner and those scanimage dumps to the file, I suppose)

(Incidentally, I still haven't worked out how to get it to properly autoload the scanner driver at startup. It loads the USB printer driver fine, but not the scanner, which I have to manually modprobe myself. I've started fiddling with post-install scripts with sleeps, but haven't worked out the magic yet.)

Dan

#8 lore raw
In reply to a message not in the archive
Quoted 7 lines · Dan Hopper

Johannes Erdfelt <[email protected]> remarked:

Quoted 2 lines

Hmm, that is interesting. I wonder what is going on with it. Are you using the scanner kernel driver?

Yes. And sane 1.0.5. FWIW, the command I'm using that stutters with uhci and not usb-uhci is:

Quoted 7 lines
scanimage --mode lineart --resolution 600 -x 203.2 -y 271.0 \
	--contrast 0 --brightness 0  > /tmp/copy.pbm

That results in a 3848837 byte file in about 37 seconds with usb-uhci. Not exactly pushing the USB 1.1 bandwidth. (unless there's a significant discrepancy between the bits coming from the scanner and those scanimage dumps to the file, I suppose)

Can you give this patch a whirl? It's relative to 2.4.18-rc2-gregkh-1

JE

drivers/usb/uhci.c +8 -3
diff -ur linux-2.4.18-rc2-gregkh-1.orig/drivers/usb/uhci.c linux-2.4.18-rc2-gregkh-1/drivers/usb/uhci.c
@@ -57,7 +57,6 @@
 
 #include <linux/pm.h>
 
-
 /*
  * Version Information
  */
@@ -65,7 +64,6 @@
 #define DRIVER_AUTHOR "Linus 'Frodo Rabbit' Torvalds, Johannes Erdfelt, Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber"
 #define DRIVER_DESC "USB Universal Host Controller Interface driver"
 
-
 /*
  * debug = 0, no debugging messages
  * debug = 1, dump failed URB's except for stalls
@@ -100,6 +98,7 @@
 
 /* If a transfer is still active after this much time, turn off FSBR */
 #define IDLE_TIMEOUT	(HZ / 20)	/* 50 ms */
+#define FSBR_DELAY	(HZ / 20)	/* 50 ms */
 
 #define MAX_URB_LOOP	2048		/* Maximum number of linked URB's */
 
@@ -766,7 +765,7 @@
 	if ((!(urb->transfer_flags & USB_NO_FSBR)) && urbp->fsbr) {
 		urbp->fsbr = 0;
 		if (!--uhci->fsbr)
-			uhci->skel_term_qh->link = UHCI_PTR_TERM;
+			uhci->fsbrtimeout = jiffies + FSBR_DELAY;
 	}
 
 	spin_unlock_irqrestore(&uhci->frame_list_lock, flags);
@@ -2021,6 +2020,12 @@
 
 		u->transfer_flags |= USB_ASYNC_UNLINK | USB_TIMEOUT_KILLED;
 		uhci_unlink_urb(u);
+	}
+
+	/* Really disable FSBR */
+	if (!uhci->fsbr && uhci->fsbrtimeout && time_after_eq(jiffies, uhci->fsbrtimeout)) {
+		uhci->fsbrtimeout = 0;
+		uhci->skel_term_qh->link = UHCI_PTR_TERM;
 	}
 
 	/* enter global suspend if nothing connected */
drivers/usb/uhci.h +1 -0
diff -ur linux-2.4.18-rc2-gregkh-1.orig/drivers/usb/uhci.h linux-2.4.18-rc2-gregkh-1/drivers/usb/uhci.h
@@ -309,6 +309,7 @@
 	spinlock_t frame_list_lock;
 	struct uhci_frame_list *fl;		/* P: uhci->frame_list_lock */
 	int fsbr;				/* Full speed bandwidth reclamation */
+	unsigned long fsbrtimeout;		/* FSBR delay */
 	int is_suspended;
 
 	/* Main list of URB's currently controlled by this HC */
#9 lore raw
In reply to a message not in the archive

Johannes Erdfelt <[email protected]> remarked:

Quoted 1 line

Can you give this patch a whirl? It's relative to 2.4.18-rc2-gregkh-1

Sorry, didn't make any difference to the scanner.

Now, in case it wasn't clear, the scanner does work, it just bumps and grinds it's way down the page in the process with uhci, taking considerably longer than with usb-uhci. Very curious.

Thanks for the patch, though!

Dan