[email protected] (Jacob Meuser), 2010.11.26 (Fri) 18:29 (CET):
> On Fri, Nov 26, 2010 at 01:39:24PM +0100, MERIGHI Marcus wrote:
> > [email protected] (Jacob Meuser), 2010.11.25 (Thu) 20:29 (CET):
> > > hub interrupts is, well, sloppy. we totally ignore the status bit
> > > field, which tells us which port had a status change, or whether the
> > > hub had a status change. uhub_explore() only deals with port status
> > > changes, so we only need to run it when there is a port status
> > > change. uhub_explore() should also use the status bit field to know
> > > what ports need to be checked, instead of checking every port, but
> > > I'll leave that for later.
> > >
> > > I'm also interested if you see the following kernel messages when
> > > running with this diff:
> > >
> > > uhub_intr: no change
> > > uhub_intr: hub changed but not ports
> >
> > not yet. You mean on unplugging the pcmcia uhub, don't you?
>
> yes. well, at any time actually.
>
> > below output of the session, see "# unplug pcmcia uhub".
>
> > # unplug pcmcia uhub
> > uhci3: host system error
> > uhci3: host controller process error
> > uhci3: host controller halted
> > uhci4: host system error
> > uhci4: host controller process error
> > uhci4: host controller halted
> > ehci0: unrecoverable error, controller halted
> > ehci0: blocking intrs 0x10
> > uhub3 detached
> > usb3 detached
> > uhci3 detached
> > uhub4 detached
> > usb4 detached
> > uhci4 detached
> > uhub5 detached
> > uvm_fault(0xd09f8080, 0xeffff000, 0, 1) -> d
> > kernel: page fault trap, code=0
> > Stopped at usbd_do_request_flags_pipe+0x18: movl
> > 0x258(%eax),%ec
> > x
> > ddb> trace
> > usbd_do_request_flags_pipe(d1f34c80,efff0062,dc16aef8,0,0) at
> > usbd_do_request_f
> > lags_pipe+0x18
> > usbd_do_request_flags(d1f34c80,dc16aef8,0,0,0) at usbd_do_request_flags+0x3c
> > usbd_do_request(d1f34c80,dc16aef8,0,d079adad,d0a0f200) at
> > usbd_do_request+0x37
> > usbd_reset_port(d1f34c80,1,d1f34100,d03e20f7,40) at usbd_reset_port+0x42
> > uhub_explore(d1f34c80,d1f3484c,dc16af8c,d0797b46,d1f34800) at
> > uhub_explore+0x16
> > f
> > usb_explore(d1f34800,20,d097eaf6,0,d6d7f768) at usb_explore+0x3f
> > usb_task_thread(d6d7f768) at usb_task_thread+0x76
>
> hmm. well, uhci doesn't stop hub interrupts before it detaches.
> can you try the following?
>
> Index: uhci.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/uhci.c,v
> retrieving revision 1.86
> diff -u -p uhci.c
> --- uhci.c 21 Nov 2010 01:29:07 -0000 1.86
> +++ uhci.c 26 Nov 2010 17:21:11 -0000
> @@ -608,6 +608,11 @@ uhci_detach(struct uhci_softc *sc, int flags)
> if (sc->sc_shutdownhook != NULL)
> shutdownhook_disestablish(sc->sc_shutdownhook);
>
> + if (sc->sc_intr_xfer != NULL) {
> + timeout_del(&sc->sc_poll_handle);
> + sc->sc_intr_xfer = NULL;
> + }
> +
> /* Free all xfers associated with this HC. */
> for (;;) {
> xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
> @@ -923,6 +928,9 @@ uhci_poll_hub(void *addr)
> u_char *p;
>
> DPRINTFN(20, ("uhci_poll_hub\n"));
> +
> + if (sc->sc_dying)
> + return;
>
> timeout_del(&sc->sc_poll_handle);
> timeout_set(&sc->sc_poll_handle, uhci_poll_hub, xfer);
I applied this patch to a clean -current src/sys/dev/usb.
output below, see "# unplug pcmcia uhub".
>> OpenBSD/i386 BOOT 3.02
boot>
booting hd0a:/bsd: 8186428+1091240 [61+369728+355632]=0x98a430
entry point at 0x200120
[ using 725836 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2010 OpenBSD. All rights reserved. http://www.OpenBSD.org
OpenBSD 4.8-current (GENERIC) #4: Fri Nov 26 19:29:50 CET 2010
[email protected]:/mnt/openbsd/src/sys/arch/i386/compile/GENERIC
cpu0: Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz ("GenuineIntel" 686-class) 2
GHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,
DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,CNXT-ID,xTPR
real mem = 1072721920 (1023MB)
avail mem = 1045123072 (996MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 06/12/03, BIOS32 rev. 0 @ 0xfd7e0, SMBIOS
rev. 2.31 @ 0xe0010 (48 entries)
bios0: vendor IBM version "1IET66WW (2.05 )" date 06/12/2003
bios0: IBM 2366EG9
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT TCPA BOOT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) PCI0(S4) PCI1(S4) DOCK(S4) USB0
(S3) USB1(S3) USB2(S3) AC97(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCI1)
acpicpu0 at acpi0: C3, C2, FVS, 2000, 1200 MHz
acpipwrres0 at acpi0: PUBS
acpitz0 at acpi0: critical temperature 94 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "IBM-COMPATIBLE" serial 20884 type LION oem "GW"
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: DOCK not docked (0)
bios0: ROM list: 0xc0000/0x10000 0xdc000/0x4000! 0xe0000/0x10000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82845 Host" rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe0000000, size 0x4000000
ppb0 at pci0 dev 1 function 0 "Intel 82845 AGP" rev 0x04
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "ATI Radeon Mobility M7" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
radeondrm0 at vga1: irq 11
drm0 at radeondrm0
uhci0 at pci0 dev 29 function 0 "Intel 82801CA/CAM USB" rev 0x02: irq 11
uhci1 at pci0 dev 29 function 1 "Intel 82801CA/CAM USB" rev 0x02: irq 11
uhci2 at pci0 dev 29 function 2 "Intel 82801CA/CAM USB" rev 0x02: irq 11
ppb1 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0x42
pci2 at ppb1 bus 2
mem address conflict 0x50000000/0x1000
mem address conflict 0x51000000/0x1000
cbb0 at pci2 dev 0 function 0 "TI PCI1520 CardBus" rev 0x01: irq 11
cbb1 at pci2 dev 0 function 1 "TI PCI1520 CardBus" rev 0x01: irq 11
fxp0 at pci2 dev 8 function 0 "Intel PRO/100 VE" rev 0x42, i82562: irq 11, addre
ss 00:09:6b:3f:67:a8
inphy0 at fxp0 phy 1: i82562ET 10/100 PHY, rev. 0
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 3 device 0 cacheline 0x8, lattimer 0xb0
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 6 device 0 cacheline 0x8, lattimer 0xb0
pcmcia1 at cardslot1
ichpcib0 at pci0 dev 31 function 0 "Intel 82801CAM LPC" rev 0x02
pciide0 at pci0 dev 31 function 1 "Intel 82801CAM IDE" rev 0x02: DMA, channel 0
configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <WDC WD3200BEVE-00A0HT0>
wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
wd1 at pciide0 channel 1 drive 0: <WDC WD1600BEVE-00WZT0>
wd1: 16-sector PIO, LBA48, 152627MB, 312581808 sectors
wd1(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 5
ichiic0 at pci0 dev 31 function 3 "Intel 82801CA/CAM SMBus" rev 0x02: irq 11
iic0 at ichiic0
auich0 at pci0 dev 31 function 5 "Intel 82801CA/CAM AC97" rev 0x02: irq 11, ICH3
AC97
ac97: codec id 0x41445348 (Analog Devices AD1881A)
ac97: codec features headphone, Analog Devices Phat Stereo
audio0 at auich0
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb1 at uhci1: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci2: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at ichpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
biomask eded netmask eded ttymask ffff
mtrr: Pentium Pro MTRR support
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
Automatic boot in progress: starting file system checks.
/dev/wd0a (10a8ab1121377141.a): file system is clean; not checking
/dev/wd0j (10a8ab1121377141.j): file system is clean; not checking
/dev/wd0e (10a8ab1121377141.e): file system is clean; not checking
/dev/wd0f (10a8ab1121377141.f): file system is clean; not checking
/dev/wd0g (10a8ab1121377141.g): file system is clean; not checking
/dev/wd0h (10a8ab1121377141.h): file system is clean; not checking
/dev/wd0k (10a8ab1121377141.k): file system is clean; not checking
setting tty flags
kbd: keyboard mapping set to de
keyboard.encoding -> de
pf enabled
ddb.console: 0 -> 1
machdep.allowaperture: 0 -> 2
machdep.kbdreset: 0 -> 1
machdep.lidsuspend: 0 -> 0
starting network
starting system logger
starting initial daemons: portmap amd ntpd.
savecore: no core dump
checking quotas: done.
building ps databases: kvm dev.
clearing /tmp
starting pre-securelevel daemons:.
setting kernel security level: kern.securelevel: 0 -> 1
turning on accounting
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd ifstated lpd ldapd smtpd inetd.
starting local daemons: smartdmount_ffs: 1b7ba332f009b306.a on /mnt/asfer: No su
ch file or directory
freedt squid.
standard daemons: apmd sensorsd hotplugd cron.
Sat Nov 27 11:03:39 CET 2010
starting xdm...
# plug pcmcia uhub
uhci3 at cardbus0 dev 0 function 0 "VIA VT83C572 USB" rev 0x62: irq 11
usb3 at uhci3: USB revision 1.0
uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
uhci4 at cardbus0 dev 0 function 1 "VIA VT83C572 USB" rev 0x62: irq 11
usb4 at uhci4: USB revision 1.0
uhub4 at usb4 "VIA UHCI root hub" rev 1.00/1.00 addr 1
ehci0 at cardbus0 dev 0 function 2 "VIA VT6202 USB" rev 0x65: irq 11
usb5 at ehci0: USB revision 2.0
uhub5 at usb5 "VIA EHCI root hub" rev 2.00/1.00 addr 1
# plug usb stick
umass0 at uhub5 port 2 configuration 1 interface 0 " " rev 2.00/1.41 addr 2
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd0 at scsibus1 targ 1 lun 0: <Generic, Flash Disk, 8.10> SCSI2 0/direct removab
le
sd0: 3992MB, 512 bytes/sec, 8175616 sec total
# unplug usb stick
sd0 detached
scsibus1 detached
umass0 detached
# unplug pcmcia uhub
uhci3: host system error
uhci3: host controller process error
uhci3: host controller halted
uhci4: host system error
uhci4: host controller process error
uhci4: host controller halted
ehci0: unrecoverable error, controller halted
ehci0: blocking intrs 0x10
uhub3 detached
usb3 detached
uhci3 detached
uhub4 detached
usb4 detached
uhci4 detached
uhub5 detached
uvm_fault(0xd0a1a040, 0x0, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at usbd_do_request_flags_pipe+0x18: movl 0x258(%eax),%ec
x
ddb>
ddb> trace
usbd_do_request_flags_pipe(d1f33d00,0,dc16aef8,0,0) at usbd_do_request_flags_pi
pe+0x18
usbd_do_request_flags(d1f33d00,dc16aef8,0,0,0) at usbd_do_request_flags+0x3c
usbd_do_request(d1f33d00,dc16aef8,0,d079aded,d0a0f200) at usbd_do_request+0x37
usbd_reset_port(d1f33d00,1,d1f33100,d03e2137,40) at usbd_reset_port+0x42
uhub_explore(d1f33d00,d1f33a4c,dc16af8c,d0797b86,d1f33a00) at uhub_explore+0x16
f
usb_explore(d1f33a00,20,d097ea96,0,d6d7f768) at usb_explore+0x3f
usb_task_thread(d6d7f768) at usb_task_thread+0x76
Bad frame pointer: 0xd0b8ce48
ddb> ps
PID PPID PGRP UID S FLAGS WAIT COMMAND
1561 5363 26673 0 3 0x4080 nanosleep sleep
24156 23929 26673 0 3 0x4080 nanosleep sleep
12737 30043 26673 0 3 0x4080 nanosleep sleep
4674 10184 26673 0 3 0x4080 nanosleep sleep
26541 1107 26673 0 3 0x4080 nanosleep sleep
17208 22059 26673 0 3 0x4080 nanosleep sleep
26564 19127 26673 0 3 0x4080 nanosleep sleep
21884 1 26673 0 3 0x4080 piperd logger
23929 1 26673 0 3 0x80 pause ksh
7259 1 26673 0 3 0x4080 piperd logger
1107 1 26673 0 3 0x80 pause ksh
32192 1 26673 0 3 0x4080 piperd logger
5363 1 26673 0 3 0x80 pause ksh
20438 1 26673 0 3 0x4080 piperd logger
30043 1 26673 0 3 0x80 pause ksh
13911 1 26673 0 3 0x4080 piperd logger
10184 1 26673 0 3 0x80 pause ksh
28550 1 26673 0 3 0x4080 piperd logger
22059 1 26673 0 3 0x80 pause ksh
2460 1 26673 0 3 0x4080 piperd logger
19127 1 26673 0 3 0x80 pause ksh
15337 5350 15337 0 3 0x80 poll xdm
17086 19854 19854 0 3 0x40180 netio Xorg
19854 5350 19854 35 3 0x44180 select Xorg
18536 1 18536 0 3 0x4080 ttyin getty
31094 1 31094 0 3 0x4080 ttyin getty
22849 1 22849 0 3 0x4080 ttyin getty
14656 1 14656 0 3 0x4080 ttyin getty
10853 1 10853 0 3 0x4080 ttyin getty
5350 1 5350 0 3 0x80 pause xdm
14592 13826 8057 515 3 0x4080 piperd unlinkd
26676 13826 8057 515 3 0x4080 poll ncsa_auth
14487 13826 8057 515 3 0x4080 poll ncsa_auth
9579 1 9579 0 3 0x80 select cron
26673 1 26673 0 3 0x80 htplev hotplugd
16006 1 16006 0 3 0x80080 nanosleep sensorsd
14295 1 14295 0 3 0x80 kqread apmd
13826 8057 8057 515 3 0x4180 poll squid
8057 1 8057 0 3 0x80 poll squid
21288 1 11505 0 3 0x80 nanosleep smartd
6378 5923 6378 510 3 0x4080 piperd logger
5923 1461 1461 0 3 0x4080 select supervise
32607 163 32607 510 3 0x4180 poll pdnsd
163 1461 1461 0 3 0x4080 select supervise
1461 1 1461 0 3 0x4080 nanosleep svscan
29895 1 29895 99 3 0x180 poll aucat
893 1 893 0 3 0x180 select inetd
335 17280 17280 95 3 0x180 kqread smtpd
2633 17280 17280 95 3 0x180 kqread smtpd
22737 17280 17280 95 3 0x180 kqread smtpd
19966 17280 17280 95 3 0x180 kqread smtpd
31287 17280 17280 95 3 0x180 kqread smtpd
18719 17280 17280 95 3 0x180 kqread smtpd
45 17280 17280 95 3 0x180 kqread smtpd
20620 17280 17280 95 3 0x180 kqread smtpd
17280 1 17280 0 3 0x80 kqread smtpd
14599 2165 2165 100 3 0x180 kqread ldapd
2165 1 2165 0 3 0x80 kqread ldapd
18940 1 18940 0 3 0x40180 select lpd
27834 1 27834 0 3 0x80 kqread ifstated
5321 1 5321 0 3 0x80 select sshd
11003 0 0 0 3 0x100200 acct acct
7031 6221 4859 83 3 0x180 poll ntpd
6221 4859 4859 83 3 0x180 poll ntpd
4859 1 4859 0 3 0x80 poll ntpd
15163 0 0 0 3 0x100280 nfsidl nfsio
2188 0 0 0 3 0x100280 nfsidl nfsio
20982 0 0 0 3 0x100280 nfsidl nfsio
21150 0 0 0 3 0x100280 nfsidl nfsio
1851 1 32627 0 3 0x80 select amd
9156 1 9156 28 3 0x180 poll portmap
30250 20863 20863 74 3 0x180 bpf pflogd
20863 1 20863 0 3 0x80 netio pflogd
7876 10659 10659 73 2 0x180 syslogd
10659 1 10659 0 3 0x88 netio syslogd
14 0 0 0 3 0x100200 aiodoned aiodoned
13 0 0 0 3 0x100200 syncer update
12 0 0 0 3 0x100200 cleaner cleaner
11 0 0 0 3 0x100200 reaper reaper
10 0 0 0 3 0x100200 pgdaemon pagedaemon
9 0 0 0 3 0x100200 bored crypto
8 0 0 0 3 0x100200 pftm pfpurge
* 7 0 0 0 7 0x100200 usbtask
6 0 0 0 3 0x100200 usbatsk usbatsk
5 0 0 0 3 0x100200 acpi0 acpi0
4 0 0 0 3 0x100200 endtask syswq
3 0 0 0 3 0x40100200 idle0
2 0 0 0 3 0x100200 kmalloc kmthread
1 0 1 0 3 0x4080 wait init
0 -1 0 0 3 0x80200 scheduler swapper
ddb> boot sync
syncing disks... done
WARNING: not updating battery clock
rebooting...