2000-11-23 10:30:36

by Michael Elkins

[permalink] [raw]
Subject: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

[1.] One line summary of the problem:

kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

[2.] Full description of the problem/report:

If I load the emu10k1.o module prior to loading the usb-uhci.o module, the
system will completely hang with no oops. 3-finger-salute has no effect,
had to soft-reset the system.

To figure out which modules were the problem, I booted into single-user mode.
First, emu10k1.o is loaded. The usbcore.o module loads with no problems. But
I get a complete hang every time when usb-uhci.o is loaded.

If I load the usb-uhci.o module before emu10k1.o, there is no problem.

[3.] Keywords (i.e., modules, networking, kernel): kernel usb sound emu10k1
[4.] Kernel version (from /proc/version):

Linux version 2.4.0-test11-ac1 (root@we-24-130-82-118) (gcc driver version 2.95.3 19991030 (prerelease) executing gcc version egcs-2.91.66) #1 Wed Nov 22 17:38:15 PST 2000

[5.] Output of Oops.. message (if applicable) with symbolic information
resolved (see Documentation/oops-tracing.txt)

No oops, complete system hang.

[6.] A small shell script or example program which triggers the
problem (if possible)

Boot into single user mode, then:
modprobe emu10k1
modprobe usb-uhci

[7.] Environment

Hardware: Dell Dimension XPS T700r
Distribution: Linux Mandrake 7.2

[7.1.] Software (add the output of the ver_linux script here)

Linux ns.linux.bogus 2.4.0-test11-ac1 #1 Wed Nov 22 17:38:15 PST 2000 i686 unknown
Kernel modules 2.3.21
Gnu C 2.95.3
Gnu Make 3.79.1
Binutils 2.10.0.24
Linux C Library 2.1.3
Dynamic linker ldd (GNU libc) 2.1.3
Procps 2.0.7
Mount 2.10o
Net-tools 1.57
Console-tools 0.2.3
Sh-utils 2.0
Modules Loaded ne 8390 3c59x emu10k1 soundcore dc2xx usb-uhci usbcore st ide-scsi scsi_mod

[7.2.] Processor information (from /proc/cpuinfo):

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 3
cpu MHz : 698.000399
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
features : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 1392.64

[7.3.] Module information (from /proc/modules):

ne 7024 1 (autoclean)
8390 6240 0 (autoclean) [ne]
3c59x 22864 1 (autoclean)
emu10k1 44992 0
soundcore 3888 4 [emu10k1]
dc2xx 3056 0 (unused)
usb-uhci 22160 0 (unused)
usbcore 47328 1 [dc2xx usb-uhci]
st 26816 0 (unused)
ide-scsi 7920 0
scsi_mod 86608 2 [st ide-scsi]

[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)

(linux)% cat /proc/ioports
0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0080-008f : dma page reg
00a0-00bf : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
0320-033f : eth1
0376-0376 : ide1
03c0-03df : vga+
03f8-03ff : serial(auto)
0cf8-0cff : PCI conf1
1000-107f : 3Com Corporation 3c900B-TPC [Etherlink XL TPC]
1000-107f : eth0
1080-10bf : Promise Technology, Inc. 20262
10c0-10df : Intel Corporation 82371AB PIIX4 USB
10c0-10df : usb-uhci
10e0-10ff : Creative Labs SB Live! EMU10000
10e0-10ff : EMU10K1
1400-140f : Intel Corporation 82371AB PIIX4 IDE
1410-1413 : Promise Technology, Inc. 20262
1414-1417 : Promise Technology, Inc. 20262
1416-1416 : ide2
1418-141f : Promise Technology, Inc. 20262
1420-1427 : Promise Technology, Inc. 20262
1420-1427 : ide2
1428-142f : Creative Labs SB Live!
7000-701f : Intel Corporation 82371AB PIIX4 ACPI
8000-803f : Intel Corporation 82371AB PIIX4 ACPI

(linux)% cat /proc/iomem
00000000-0009e7ff : System RAM
0009e800-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000c7fff : Video ROM
000c9000-000ca7ff : Extension ROM
000e0000-000effff : Extension ROM
000f0000-000fffff : System ROM
00100000-040fd7ff : System RAM
00100000-001ef2d7 : Kernel code
001ef2d8-00200d47 : Kernel data
040fd800-040ff7ff : ACPI Tables
040ff800-040ffbff : ACPI Non-volatile Storage
040ffc00-0fffffff : System RAM
f4000000-f401ffff : Promise Technology, Inc. 20262
f4020000-f402007f : 3Com Corporation 3c900B-TPC [Etherlink XL TPC]
f5000000-f5ffffff : PCI Bus #01
f5000000-f5ffffff : nVidia Corporation Vanta [NV6]
f8000000-fbffffff : Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge
fc000000-fdffffff : PCI Bus #01
fc000000-fdffffff : nVidia Corporation Vanta [NV6]
fff80000-ffffffff : reserved

[7.5.] PCI information ('lspci -vvv' as root)
00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03)
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR-
Latency: 64
Region 0: Memory at f8000000 (32-bit, prefetchable) [size=64M]
Capabilities: [a0] AGP version 1.0
Status: RQ=31 SBA+ 64bit- FW- Rate=x1,x2
Command: RQ=0 SBA- AGP- 64bit- FW- Rate=<none>

00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap- 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 128
Bus: primary=00, secondary=01, subordinate=01, sec-latency=64
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: f5000000-f5ffffff
Prefetchable memory behind bridge: fc000000-fdffffff
BridgeCtl: Parity- SERR- NoISA+ VGA+ MAbort- >Reset- FastB2B+

00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02)
Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0

00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) (prog-if 80 [Master])
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Region 4: I/O ports at 1400 [size=16]

00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) (prog-if 00 [UHCI])
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Interrupt: pin D routed to IRQ 9
Region 4: I/O ports at 10c0 [size=32]

00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

00:0d.0 Ethernet controller: 3Com Corporation 3c900B-TPC [Etherlink XL TPC] (rev 04)
Subsystem: 3Com Corporation 3c900B-TPC [Etherlink XL TPC]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 80 (2500ns min, 12000ns max), cache line size 08
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at 1000 [size=128]
Region 1: Memory at f4020000 (32-bit, non-prefetchable) [size=128]
Expansion ROM at <unassigned> [disabled] [size=128K]
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:0e.0 Unknown mass storage controller: Promise Technology, Inc. 20262 (rev 01)
Subsystem: Promise Technology, Inc.: Unknown device 4d33
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Interrupt: pin A routed to IRQ 3
Region 0: I/O ports at 1420 [size=8]
Region 1: I/O ports at 1414 [size=4]
Region 2: I/O ports at 1418 [size=8]
Region 3: I/O ports at 1410 [size=4]
Region 4: I/O ports at 1080 [size=64]
Region 5: Memory at f4000000 (32-bit, non-prefetchable) [size=128K]
Expansion ROM at <unassigned> [disabled] [size=64K]
Capabilities: [58] Power Management version 1
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:10.0 Multimedia audio controller: Creative Labs SB Live! EMU10000 (rev 07)
Subsystem: Creative Labs CT4780 SBLive! Value
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64 (500ns min, 5000ns max)
Interrupt: pin A routed to IRQ 9
Region 0: I/O ports at 10e0 [size=32]
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:10.1 Input device controller: Creative Labs SB Live! (rev 07)
Subsystem: Creative Labs Gameport Joystick
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64
Region 0: I/O ports at 1428 [size=8]
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

01:00.0 VGA compatible controller: nVidia Corporation Vanta [NV6] (rev 15) (prog-if 00 [VGA])
Subsystem: nVidia Corporation: Unknown device 0001
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64 (1250ns min, 250ns max)
Interrupt: pin A routed to IRQ 11
Region 0: Memory at f5000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at fc000000 (32-bit, prefetchable) [size=32M]
Expansion ROM at <unassigned> [disabled] [size=64K]
Capabilities: [60] Power Management version 1
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [44] AGP version 2.0
Status: RQ=31 SBA- 64bit- FW- Rate=x1,x2
Command: RQ=0 SBA- AGP- 64bit- FW- Rate=<none>

[7.6.] SCSI information (from /proc/scsi/scsi)

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: COLORADO 14GB Rev: 4.01
Type: Sequential-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: SONY Model: CD-RW CRX140E Rev: 1.0n
Type: CD-ROM ANSI SCSI revision: 02

[7.7.] Other information that might be relevant to the problem
(please look in /proc and include all information that you
think to be relevant):

[root@ns linux]# cat /proc/bus/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB UHCI Root Hub
S: SerialNumber=10c0
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=040a ProdID=0132 Rev= 1.00
S: Manufacturer=Eastman Kodak Company
S: Product=KODAK DC3400 ZOOM Digital Camera
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=dc2xx
E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl= 0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl= 0ms

[root@ns linux]# cat /proc/bus/usb/drivers
80- 95: dc2xx
hub
usbdevfs

[X.] Other notes, patches, fixes, workarounds:

Loading the usb-uhci module before the emu10k1 driver seems to work. I tested
playing audio while accessing images from my digital camera via USB with
no errors.


2000-11-23 16:04:51

by Rui Sousa

[permalink] [raw]
Subject: Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

On Thu, 23 Nov 2000, Michael Elkins wrote:

Usb controller is sharing a interrupt with the emu10k1.
For what I know the emu10k1 driver doesn't have any problem
sharing irq's, so I would blame the usb driver...

Rui Sousa

> 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) (prog-if 00 [UHCI])
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
> Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
> Latency: 64
> Interrupt: pin D routed to IRQ 9
> Region 4: I/O ports at 10c0 [size=32]
>
...
>
> 00:10.0 Multimedia audio controller: Creative Labs SB Live! EMU10000 (rev 07)
> Subsystem: Creative Labs CT4780 SBLive! Value
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
> Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
> Latency: 64 (500ns min, 5000ns max)
> Interrupt: pin A routed to IRQ 9
> Region 0: I/O ports at 10e0 [size=32]
> Capabilities: [dc] Power Management version 1
> Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
> Status: D0 PME-Enable- DSel=0 DScale=0 PME-
>
> 00:10.1 Input device controller: Creative Labs SB Live! (rev 07)
> Subsystem: Creative Labs Gameport Joystick
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
> Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
> Latency: 64
> Region 0: I/O ports at 1428 [size=8]
> Capabilities: [dc] Power Management version 1
> Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
> Status: D0 PME-Enable- DSel=0 DScale=0 PME-
>
...
>
> [X.] Other notes, patches, fixes, workarounds:
>
> Loading the usb-uhci module before the emu10k1 driver seems to work. I tested
> playing audio while accessing images from my digital camera via USB with
> no errors.
>

2000-11-23 17:22:15

by Georg Acher

[permalink] [raw]
Subject: Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

On Thu, Nov 23, 2000 at 04:35:33PM +0000, Rui Sousa wrote:
> On Thu, 23 Nov 2000, Michael Elkins wrote:
>
> Usb controller is sharing a interrupt with the emu10k1.
> For what I know the emu10k1 driver doesn't have any problem
> sharing irq's, so I would blame the usb driver...

usb-uhci doesn't also have any problem with sharing irqs:

> cat /proc/interrupts
10: 5597981 XT-PIC aic7xxx, eth0, usb-uhci

Hm, no one left to blame...
I would debug it as follows:
Place various printks in the initialization code (reset_hc(), start_hc() and
alloc_uhci) and find out after which printk it hangs. Then it would be
possible to investigate this further...

--
Georg Acher, [email protected]
http://www.in.tum.de/~acher/
"Oh no, not again !" The bowl of petunias

2000-11-23 23:13:55

by Michael Elkins

[permalink] [raw]
Subject: Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

On Thu, Nov 23, 2000 at 05:49:52PM +0100, Georg Acher wrote:
> On Thu, Nov 23, 2000 at 04:35:33PM +0000, Rui Sousa wrote:
> > On Thu, 23 Nov 2000, Michael Elkins wrote:
> >
> > Usb controller is sharing a interrupt with the emu10k1.
> > For what I know the emu10k1 driver doesn't have any problem
> > sharing irq's, so I would blame the usb driver...
>
> usb-uhci doesn't also have any problem with sharing irqs:
>
> > cat /proc/interrupts
> 10: 5597981 XT-PIC aic7xxx, eth0, usb-uhci
>
> Hm, no one left to blame...
> I would debug it as follows:
> Place various printks in the initialization code (reset_hc(), start_hc() and
> alloc_uhci) and find out after which printk it hangs. Then it would be
> possible to investigate this further...

It hangs in start_uhci():

/* disable legacy emulation */
pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);

The loop that the call is in gets iterated 5 times. For i < 4, the
if (!(dev->resource[i].flags & 1))
is TRUE, but on i==4, it drops into the bottom of the loop to execute
check_region() and then pci_write_config_word(), where it hangs.

This only seems to be a problem for initialization. If I load the
usb-uhci.o module before the emu10k1.o module, everything works perfectly
(no lockups).

me

2000-11-23 23:39:09

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH] Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

Index: drivers/usb/usb-uhci.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/usb/usb-uhci.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 usb-uhci.c
--- drivers/usb/usb-uhci.c 2000/10/22 23:25:12 1.1.1.9
+++ drivers/usb/usb-uhci.c 2000/11/23 23:04:37
@@ -2886,7 +2886,7 @@
unsigned int io_addr = dev->resource[i].start;
unsigned int io_size =
dev->resource[i].end - dev->resource[i].start + 1;
- if (!(dev->resource[i].flags & 1))
+ if (!(dev->resource[i].flags & IORESOURCE_IO))
continue;

/* Is it already in use? */


Attachments:
usb.patch (606.00 B)

2000-11-24 00:24:14

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1



On Thu, 23 Nov 2000, Jeff Garzik wrote:
> >
> > It hangs in start_uhci():
> >
> > /* disable legacy emulation */
> > pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);

Try changing the thing around a bit: make the above place say

/* disable legacy emulation */
pci_write_config_word (dev, USBLEGSUP, 0);

and then AFTER we have successfully done a request_irq() call, we
can enable PCI interrupts with

/* Enable PIRQ */
pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);

Does that make it happier?

Linus

2000-11-24 07:34:44

by Michael Elkins

[permalink] [raw]
Subject: Re: [PATCH] Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1

On Thu, Nov 23, 2000 at 06:06:31PM -0500, Jeff Garzik wrote:
> Michael Elkins wrote:
> >
> > On Thu, Nov 23, 2000 at 05:49:52PM +0100, Georg Acher wrote:
> > It hangs in start_uhci():
> >
> > /* disable legacy emulation */
> > pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);
> >
> > The loop that the call is in gets iterated 5 times. For i < 4, the
> > if (!(dev->resource[i].flags & 1))
> > is TRUE, but on i==4, it drops into the bottom of the loop to execute
> > check_region() and then pci_write_config_word(), where it hangs.
>
> It may not make a difference, but that check is flat out wrong.

The loop still exhibits the same behavior.

/usr/include/linux/ioport.h:#define IORESOURCE_IO 0x00000100 /* Resource type */

Definitely a different value, however.

> Apply this patch... (untested, you may need to include ioport.h)

fyi, ioport.h isn't required.

On Thu, Nov 23, 2000 at 03:53:27PM -0800, Linus Torvalds wrote:
> Try changing the thing around a bit: make the above place say
>
> /* disable legacy emulation */
> pci_write_config_word (dev, USBLEGSUP, 0);
>
> and then AFTER we have successfully done a request_irq() call, we
> can enable PCI interrupts with
>
> /* Enable PIRQ */
> pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);
>
> Does that make it happier?

Yep! That seems to have fixed it. Added the pci_write_config_word() after
the request_irq() in alloc_uhci().

me

2000-11-24 14:19:27

by Tigran Aivazian

[permalink] [raw]
Subject: [patch-2.4.0-test11] various small fixes

Hi Linus,

This patch does:

a) cleans up the show_mem() function on various architectures wrt
page_count() macro and the 'free' variable

b) corrects the comment above paging_init() about 0-8M page tables

c) changes the name of kflushd to bdflush. All kernel data structures
around this thread are called bdflush* so kflushd is a wrong name and
bdflush is right.

d) corrects the comments in fs/file.c about __get_free_page() usage; it
should say "vmalloc or kmalloc" for these two are used for array and fd
set allocation

e) corrects the comment in asm-i386/spinlock.h about semaphore.S

f) adds a free_mm() macro to kernel/fork.c to be symmetric to allocate_mm

g) optimizes the vmlist_lock usage by dropping it in vfree() before
freeing the 'tmp' element which was unlinked from vmlist but _after_ the
pages have been freed.

(another thing I wanted to do, but was in doubt, was to force the old lock
nfsservctl request to do do_exit(0) like we do in sys_bdlflush() for old
2.2.x userspace update to self-terminate. This way current rpc.lockd would
not spew out an error but quietly (and successfully, i.e. errcode=0) die,
just like update)

diff -urN -X dontdiff linux/arch/alpha/mm/init.c work/arch/alpha/mm/init.c
--- linux/arch/alpha/mm/init.c Mon Oct 16 23:38:41 2000
+++ work/arch/alpha/mm/init.c Fri Nov 24 12:40:52 2000
@@ -185,7 +185,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!atomic_read(&mem_map[i].count))
+ else if (!page_count(mem_map+i))
free++;
else
shared += atomic_read(&mem_map[i].count) - 1;
diff -urN -X dontdiff linux/arch/i386/mm/init.c work/arch/i386/mm/init.c
--- linux/arch/i386/mm/init.c Mon Oct 23 22:42:33 2000
+++ work/arch/i386/mm/init.c Fri Nov 24 12:37:56 2000
@@ -198,7 +198,7 @@

void show_mem(void)
{
- int i,free = 0, total = 0, reserved = 0;
+ int i, total = 0, reserved = 0;
int shared = 0, cached = 0;
int highmem = 0;

@@ -214,9 +214,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!page_count(mem_map+i))
- free++;
- else
+ else if (page_count(mem_map+i))
shared += page_count(mem_map+i) - 1;
}
printk("%d pages of RAM\n", total);
@@ -437,7 +435,7 @@
}

/*
- * paging_init() sets up the page tables - note that the first 4MB are
+ * paging_init() sets up the page tables - note that the first 8MB are
* already mapped by head.S.
*
* This routines also unmaps the page at virtual kernel address 0, so
diff -urN -X dontdiff linux/arch/ia64/mm/init.c work/arch/ia64/mm/init.c
--- linux/arch/ia64/mm/init.c Tue Oct 10 01:54:56 2000
+++ work/arch/ia64/mm/init.c Fri Nov 24 12:38:20 2000
@@ -245,7 +245,7 @@
void
show_mem (void)
{
- int i,free = 0,total = 0,reserved = 0;
+ int i, total = 0, reserved = 0;
int shared = 0, cached = 0;

printk("Mem-info:\n");
@@ -258,9 +258,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!page_count(mem_map + i))
- free++;
- else
+ else if (page_count(mem_map + i))
shared += page_count(mem_map + i) - 1;
}
printk("%d pages of RAM\n", total);
diff -urN -X dontdiff linux/arch/ppc/mm/init.c work/arch/ppc/mm/init.c
--- linux/arch/ppc/mm/init.c Thu Nov 9 03:01:34 2000
+++ work/arch/ppc/mm/init.c Fri Nov 24 12:41:53 2000
@@ -293,7 +293,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!atomic_read(&mem_map[i].count))
+ else if (!page_count(mem_map+i))
free++;
else
shared += atomic_read(&mem_map[i].count) - 1;
diff -urN -X dontdiff linux/arch/s390/mm/init.c work/arch/s390/mm/init.c
--- linux/arch/s390/mm/init.c Mon Oct 16 20:58:51 2000
+++ work/arch/s390/mm/init.c Fri Nov 24 12:42:08 2000
@@ -192,7 +192,7 @@

void show_mem(void)
{
- int i,free = 0,total = 0,reserved = 0;
+ int i, total = 0, reserved = 0;
int shared = 0, cached = 0;

printk("Mem-info:\n");
@@ -205,9 +205,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!atomic_read(&mem_map[i].count))
- free++;
- else
+ else if (page_count(mem_map+i))
shared += atomic_read(&mem_map[i].count) - 1;
}
printk("%d pages of RAM\n",total);
diff -urN -X dontdiff linux/arch/sh/mm/init.c work/arch/sh/mm/init.c
--- linux/arch/sh/mm/init.c Mon Oct 16 20:58:51 2000
+++ work/arch/sh/mm/init.c Fri Nov 24 12:42:13 2000
@@ -150,7 +150,7 @@

void show_mem(void)
{
- int i,free = 0,total = 0,reserved = 0;
+ int i, total = 0, reserved = 0;
int shared = 0, cached = 0;

printk("Mem-info:\n");
@@ -163,9 +163,7 @@
reserved++;
else if (PageSwapCache(mem_map+i))
cached++;
- else if (!page_count(mem_map+i))
- free++;
- else
+ else if (page_count(mem_map+i))
shared += page_count(mem_map+i) - 1;
}
printk("%d pages of RAM\n",total);
diff -urN -X dontdiff linux/fs/buffer.c work/fs/buffer.c
--- linux/fs/buffer.c Sun Nov 12 02:31:12 2000
+++ work/fs/buffer.c Fri Nov 24 12:35:53 2000
@@ -2481,9 +2481,9 @@
return;
}

- /* kflushd can wakeup us before we have a chance to
+ /* bdflush can wakeup us before we have a chance to
go to sleep so we must be smart in handling
- this wakeup event from kflushd to avoid deadlocking in SMP
+ this wakeup event from bdflush to avoid deadlocking in SMP
(we are not holding any lock anymore in these two paths). */
__set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&bdflush_done, &wait);
@@ -2646,7 +2646,7 @@

tsk->session = 1;
tsk->pgrp = 1;
- strcpy(tsk->comm, "kflushd");
+ strcpy(tsk->comm, "bdflush");
bdflush_tsk = tsk;

/* avoid getting signals */
diff -urN -X dontdiff linux/fs/file.c work/fs/file.c
--- linux/fs/file.c Fri Jul 7 20:20:04 2000
+++ work/fs/file.c Fri Nov 24 12:32:26 2000
@@ -16,7 +16,7 @@


/*
- * Allocate an fd array, using __get_free_page() if possible.
+ * Allocate an fd array, using kmalloc or vmalloc.
* Note: the array isn't cleared at allocation time.
*/
struct file ** alloc_fd_array(int num)
@@ -125,7 +125,7 @@
}

/*
- * Allocate an fdset array, using __get_free_page() if possible.
+ * Allocate an fdset array, using kmalloc or vmalloc.
* Note: the array isn't cleared at allocation time.
*/
fd_set * alloc_fdset(int num)
diff -urN -X dontdiff linux/include/asm-i386/spinlock.h work/include/asm-i386/spinlock.h
--- linux/include/asm-i386/spinlock.h Sun Nov 19 04:56:59 2000
+++ work/include/asm-i386/spinlock.h Fri Nov 24 12:42:55 2000
@@ -141,7 +141,7 @@
* Changed to use the same technique as rw semaphores. See
* semaphore.h for details. -ben
*/
-/* the spinlock helpers are in arch/i386/kernel/semaphore.S */
+/* the spinlock helpers are in arch/i386/kernel/semaphore.c */

static inline void read_lock(rwlock_t *rw)
{
diff -urN -X dontdiff linux/kernel/fork.c work/kernel/fork.c
--- linux/kernel/fork.c Wed Nov 15 23:13:40 2000
+++ work/kernel/fork.c Fri Nov 24 12:35:23 2000
@@ -196,6 +196,7 @@
}

#define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
+#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm)))

static struct mm_struct * mm_init(struct mm_struct * mm)
{
@@ -206,7 +207,7 @@
mm->pgd = pgd_alloc();
if (mm->pgd)
return mm;
- kmem_cache_free(mm_cachep, mm);
+ free_mm(mm);
return NULL;
}

@@ -236,7 +237,7 @@
if (mm == &init_mm) BUG();
pgd_free(mm->pgd);
destroy_context(mm);
- kmem_cache_free(mm_cachep, mm);
+ free_mm(mm);
}

/*
diff -urN -X dontdiff linux/mm/vmalloc.c work/mm/vmalloc.c
--- linux/mm/vmalloc.c Thu Nov 9 01:03:09 2000
+++ work/mm/vmalloc.c Fri Nov 24 12:30:34 2000
@@ -215,8 +215,8 @@
if (tmp->addr == addr) {
*p = tmp->next;
vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);
- kfree(tmp);
write_unlock(&vmlist_lock);
+ kfree(tmp);
return;
}
}

2000-11-24 17:01:41

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Re: PROBLEM: kernel 2.4.0-test11-ac1 hang with usb-uhci and emu10k1



On Thu, 23 Nov 2000, Michael Elkins wrote:
>
> On Thu, Nov 23, 2000 at 03:53:27PM -0800, Linus Torvalds wrote:
> > Try changing the thing around a bit: make the above place say
> >
> > /* disable legacy emulation */
> > pci_write_config_word (dev, USBLEGSUP, 0);
> >
> > and then AFTER we have successfully done a request_irq() call, we
> > can enable PCI interrupts with
> >
> > /* Enable PIRQ */
> > pci_write_config_word (dev, USBLEGSUP, USBLEGSUP_DEFAULT);
> >
> > Does that make it happier?
>
> Yep! That seems to have fixed it. Added the pci_write_config_word() after
> the request_irq() in alloc_uhci().

Johannes, can you get in touch with the right people and make sure this
gets fixed in both uhci drivers? They both look like they have the same
bug, and I'd prefer not to do it by hand as I don't have that much in the
form of USB..

Linus