Subject: kern/34855: Panic trying to restart apcupsd using a Prolific USB -> Serial adapter
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <mark.r.cullen@gmail.com>
List: netbsd-bugs
Date: 10/18/2006 22:20:00
>Number:         34855
>Category:       kern
>Synopsis:       Panic trying to restart apcupsd using a Prolific USB -> Serial adapter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 18 22:20:00 +0000 2006
>Originator:     Markie
>Release:        NetBSD 3.0.1
>Organization:
N/A
>Environment:
System: NetBSD bone.bone.servebeer.com 3.0.1 NetBSD 3.0.1 (BONE) #21: Thu Jul 27
 12:49:08 BST 2006 mrboo@bone.bone.servebeer.com:/usr/obj/sys/arch/i386/compile/
BONE i386
Architecture: i386
Machine: i386
>Description:


I have a kernel core dump available, and don't really know how to use it :-) dmesg and backtrace:

--- DMESG ---
NetBSD 3.0.1 (BONE) #21: Thu Jul 27 12:49:08 BST 2006
        mrboo@bone.bone.servebeer.com:/usr/obj/sys/arch/i386/compile/BONE
total memory = 253 MB
avail memory = 243 MB
BIOS32 rev. 0 found at 0xfb090
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: Intel Celeron (686-class), 1002.34 MHz, id 0x68a
cpu0: features 383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 383f9ff<PGE,MCA,CMOV,PAT,PSE36,MMX>
cpu0: features 383f9ff<FXSR,SSE>
cpu0: I-cache 16 KB 32B/line 4-way, D-cache 16 KB 32B/line 4-way
cpu0: L2 cache 128 KB 32B/line 4-way
cpu0: ITLB 32 4 KB entries 4-way, 2 4 MB entries fully associative
cpu0: DTLB 64 4 KB entries 4-way, 8 4 MB entries 4-way
cpu0: 8 page colors
acpi0 at mainbus0
acpi0: using Intel ACPI CA subsystem version 20040211
acpi0: X/RSDT: OemId <VIA601,MSI ACPI,42302e31>, AslId <AWRD,00000000>
acpi0: SCI interrupting at int 9
acpi0: fixed-feature power button present
ACPI Object Type 'Processor' (0x0c) at acpi0 not configured
acpibut0 at acpi0 (PNP0C0C): ACPI Power Button
acpibut1 at acpi0 (PNP0C0E): ACPI Sleep Button
PNP0C01 at acpi0 not configured
PNP0A03 at acpi0 not configured
PNP0C0F at acpi0 not configured
PNP0C0F at acpi0 not configured
PNP0C0F at acpi0 not configured
PNP0C02 at acpi0 not configured
PNP0000 at acpi0 not configured
PNP0200 at acpi0 not configured
PNP0100 at acpi0 not configured
PNP0B00 at acpi0 not configured
PNP0800 at acpi0 not configured
PNP0C04 at acpi0 not configured
PNP0700 at acpi0 not configured
PNP0501 at acpi0 not configured
PNP0501 at acpi0 not configured
PNP0401 at acpi0 not configured
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: VIA Technologies product 0x0601 (rev. 0x05)
agp0 at pchb0: aperture at 0xd4000000, size 0xe800000
ppb0 at pci0 dev 1 function 0: VIA Technologies product 0x8601 (rev. 0x00)
pci1 at ppb0 bus 1
pci1: i/o space, memory space enabled
vga1 at pci1 dev 0 function 0: Trident Microsystems product 0x8500 (rev. 0x6a)
wsdisplay0 at vga1 kbdmux 1
wsmux1: connecting to wsdisplay0
pcib0 at pci0 dev 7 function 0
pcib0: VIA Technologies VT82C686A PCI-ISA Bridge (rev. 0x40)
viaide0 at pci0 dev 7 function 1
viaide0: VIA Technologies VT82C686A (Apollo KX133) ATA100 controller
viaide0: bus-master DMA support present
viaide0: primary channel configured to compatibility mode
viaide0: primary channel interrupting at irq 14
atabus0 at viaide0 channel 0
viaide0: secondary channel configured to compatibility mode
viaide0: secondary channel interrupting at irq 15
atabus1 at viaide0 channel 1
uhci0 at pci0 dev 7 function 2: VIA Technologies VT83C572 USB Controller (rev. 0x16)
uhci0: interrupting at irq 12
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: VIA Technologies UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1 at pci0 dev 7 function 3: VIA Technologies VT83C572 USB Controller (rev. 0x16)
uhci1: interrupting at irq 12
usb1 at uhci1: USB revision 1.0
uhub1 at usb1
uhub1: VIA Technologies UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
viapm0 at pci0 dev 7 function 4
viaenv0 at viapm0
fxp0 at pci0 dev 8 function 0: i82559 Ethernet, rev 8
fxp0: interrupting at irq 10
fxp0: Ethernet address 00:06:29:6f:12:85
inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 4
inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp1 at pci0 dev 9 function 0: i82559 Ethernet, rev 8
fxp1: interrupting at irq 11
fxp1: Ethernet address 00:04:ac:23:02:77
inphy1 at fxp1 phy 1: i82555 10/100 media interface, rev. 4
inphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
isa0 at pcib0
lpt0 at isa0 port 0x378-0x37b irq 7
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com0: console
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker
spkr0 at pcppi0
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
isapnp0: no ISA Plug 'n Play devices found
Kernelized RAIDframe activated
wd0 at atabus0 drive 0: <FUJITSU MPF3102AT>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 9773 MB, 19857 cyl, 16 head, 63 sec, 512 bytes/sect x 20015856 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 4 (Ultra/66)
wd1 at atabus0 drive 1: <ST3802110A>
wd1: drive supports 16-sector PIO transfers, LBA48 addressing
wd1: 76319 MB, 155061 cyl, 16 head, 63 sec, 512 bytes/sect x 156301488 sectors
wd1: 32-bit data port
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(viaide0:0:0): using PIO mode 4, Ultra-DMA mode 4 (Ultra/66) (using DMA)
wd1(viaide0:0:1): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
wd2 at atabus1 drive 0: <ST310211A>
wd2: drive supports 16-sector PIO transfers, LBA addressing
wd2: 9541 MB, 19386 cyl, 16 head, 63 sec, 512 bytes/sect x 19541088 sectors
wd2: 32-bit data port
wd2: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd3 at atabus1 drive 1: <ST3160812A>
wd3: drive supports 16-sector PIO transfers, LBA48 addressing
wd3: 149 GB, 310101 cyl, 16 head, 63 sec, 512 bytes/sect x 312581808 sectors
wd3: 32-bit data port
wd3: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd2(viaide0:1:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
wd3(viaide0:1:1): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
uplcom0 at uhub1 port 2
uplcom0: Prolific Technology Inc. USB-Serial Controller, rev 1.10/3.00, addr 2
ucom0 at uplcom0
raid1: RAID Level 1
raid1: Components: /dev/wd0a /dev/wd2a
raid1: Total Sectors: 19540864 (9541 MB)
raid0: RAID Level 1
raid0: Components: /dev/wd3a /dev/wd1a
raid0: Total Sectors: 156301312 (76319 MB)
boot device: raid1
root on raid1a dumps on raid1b
root file system type: ffs
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)
--- END DMESG ---

--- BT ---
(gdb) bt
#0  0x0fcf0000 in ?? ()
#1  0xc037b1ee in cpu_reboot (howto=260, bootstr=0x0)
    at /usr/src/sys/arch/i386/i386/machdep.c:751
#2  0xc02ec384 in panic (fmt=0xc04881ca "trap")
    at /usr/src/sys/kern/subr_prf.c:242
#3  0xc03859f9 in trap (frame=0xc05cfb34)
    at /usr/src/sys/arch/i386/i386/trap.c:336
#4  0xc0102cfb in calltrap ()
#5  0xc01f20cd in uhci_softintr (v=0xc0b2c000)
    at /usr/src/sys/dev/usb/uhci.c:1303
#6  0xc03764d4 in softintr_dispatch (which=1)
    at /usr/src/sys/arch/x86/x86/softintr.c:104
#7  0xc01029cd in Xsoftnet ()
#8  0xc03764e5 in softintr_dispatch (which=0) at x86/intr.h:160
#9  0xc01029fe in Xsoftclock ()
#10 0xc0310d06 in vfs_shutdown () at x86/intr.h:160
#11 0xc037b202 in cpu_reboot (howto=256, bootstr=0x0)
    at /usr/src/sys/arch/i386/i386/machdep.c:737
#12 0xc02ec384 in panic (fmt=0xc04881ca "trap")
    at /usr/src/sys/kern/subr_prf.c:242
#13 0xc03859f9 in trap (frame=0xc05cfd2c)
    at /usr/src/sys/arch/i386/i386/trap.c:336
#14 0xc0102cfb in calltrap ()
---Type <return> to continue, or q <return> to quit---
#15 0xc03f93fe in ucomstartread (sc=0xc0b97d00)
    at /usr/src/sys/dev/usb/ucom.c:1034
#16 0xc03f9543 in ucomreadcb (xfer=0xc134f300, p=0xc0b97d00,
    status=USBD_NORMAL_COMPLETION) at /usr/src/sys/dev/usb/ucom.c:1094
#17 0xc03f47be in usb_transfer_complete (xfer=0xc134f300)
    at /usr/src/sys/dev/usb/usbdi.c:838
#18 0xc01f20cd in uhci_softintr (v=0xc0b2c000)
    at /usr/src/sys/dev/usb/uhci.c:1303
#19 0xc03764d4 in softintr_dispatch (which=1)
    at /usr/src/sys/arch/x86/x86/softintr.c:104
#20 0xc01029cd in Xsoftnet ()


(gdb) frame 18
#18 0xc01f20cd in uhci_softintr (v=0xc0b2c000)
    at /usr/src/sys/dev/usb/uhci.c:1303
1303                    uhci_check_intr(sc, ii);
(gdb) list
1298             * We scan all interrupt descriptors to see if any have
1299             * completed.
1300             */
1301            for (ii = LIST_FIRST(&sc->sc_intrhead); ii; ii = nextii) {
1302                    nextii = LIST_NEXT(ii, list);
1303                    uhci_check_intr(sc, ii);
1304            }
1305
1306    #ifdef USB_USE_SOFTINTR
1307            if (sc->sc_softwake) {
(gdb) frame 17
#17 0xc03f47be in usb_transfer_complete (xfer=0xc134f300)
    at /usr/src/sys/dev/usb/usbdi.c:838
838                     xfer->callback(xfer, xfer->priv, xfer->status);
(gdb) list
833                                  xfer->actlen, xfer->length));
834                     xfer->status = USBD_SHORT_XFER;
835             }
836
837             if (xfer->callback)
838                     xfer->callback(xfer, xfer->priv, xfer->status);
839
840     #ifdef DIAGNOSTIC
841             if (pipe->methods->done != NULL)
842                     pipe->methods->done(xfer);
(gdb) frame 16
#16 0xc03f9543 in ucomreadcb (xfer=0xc134f300, p=0xc0b97d00,
    status=USBD_NORMAL_COMPLETION) at /usr/src/sys/dev/usb/ucom.c:1094
1094            err = ucomstartread(sc);
(gdb) list
1089                            break;
1090                    }
1091            }
1092            splx(s);
1093
1094            err = ucomstartread(sc);
1095            if (err) {
1096                    printf("%s: read start failed\n", USBDEVNAME(sc->sc_dev));
1097                    /* XXX what should we dow now? */
1098            }
(gdb) frame 15
#15 0xc03f93fe in ucomstartread (sc=0xc0b97d00)
    at /usr/src/sys/dev/usb/ucom.c:1034
1034            err = usbd_transfer(sc->sc_ixfer);
(gdb) list
1029            usbd_setup_xfer(sc->sc_ixfer, sc->sc_bulkin_pipe,
1030                            (usbd_private_handle)sc,
1031                            sc->sc_ibuf, sc->sc_ibufsize,
1032                            USBD_SHORT_XFER_OK | USBD_NO_COPY,
1033                            USBD_NO_TIMEOUT, ucomreadcb);
1034            err = usbd_transfer(sc->sc_ixfer);
1035            if (err != USBD_IN_PROGRESS) {
1036                    DPRINTF(("ucomstartread: err=%s\n", usbd_errstr(err)));
1037                    return (err);
1038            }
(gdb) frame 14
#14 0xc0102cfb in calltrap ()
(gdb) list
1039            return (USBD_NORMAL_COMPLETION);
1040    }
1041
1042    Static void
1043    ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status)
1044    {
1045            struct ucom_softc *sc = (struct ucom_softc *)p;
1046            struct tty *tp = sc->sc_tty;
1047            int (*rint)(int c, struct tty *tp) = tp->t_linesw->l_rint;
1048            usbd_status err;
(gdb)
--- END BT ---

>How-To-Repeat:
I'm not sure if it's repeatable yet, but all I ran was `/usr/pkg/etc/rc.d/apcupsd restart` over SSH, with an APC UPS on a Prolific USB to Serial adapter, and it paniced. There was an error spat out by apcupsd milliseconds before the panic, something about an 'input / output' error I think. I didn't quite catch it :-(

If no one else had any success reproducing the problem I could give a developer SSH access to the machine if that's any use?
>Fix: