From owner-freebsd-current@FreeBSD.ORG Wed Apr 22 07:29:35 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C551106566B; Wed, 22 Apr 2009 07:29:35 +0000 (UTC) (envelope-from vova@sw.ru) Received: from relay.sw.ru (mailhub.sw.ru [195.214.232.25]) by mx1.freebsd.org (Postfix) with ESMTP id BE9948FC08; Wed, 22 Apr 2009 07:29:34 +0000 (UTC) (envelope-from vova@sw.ru) Received: from vbook.fbsd.ru ([10.30.1.111]) (authenticated bits=0) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id n3M7TV32019686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Apr 2009 11:29:32 +0400 (MSD) Received: from vova by vbook.fbsd.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1LwWtf-0000WE-G8; Wed, 22 Apr 2009 11:29:31 +0400 From: Vladimir Grebenschikov To: current Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: SWsoft Date: Wed, 22 Apr 2009 11:29:31 +0400 Message-Id: <1240385371.1716.35.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.0 FreeBSD GNOME Team Port Sender: Vladimir Grebenschikov Cc: usb Subject: Recent changes in USB stack broke dock disconnection - panic X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vova@fbsd.ru List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 07:29:35 -0000 Hi Some recent changes in USB2 stack make panic on IBM dock disconnection. As far as I understand USB controller in dock seen by notebook through PCIe bus. On dock disconnection all USB devices should be safely disconnected. This works before with old USB stack and with early versions of new USB stack. # kgdb /boot/kernel/kernel /var/crash/vmcore.4 ... Unread portion of the kernel message buffer: ugen4.2: at usbus4 (disconnected) uhub5: at uhub4, port 6, addr 2 (disconnected) Fatal trap 12: page fault while in kernel mode fault virtual address = 0xd0 fault code = supervisor read, page not present instruction pointer = 0x20:0xc0987301 stack pointer = 0x28:0xe55c8a50 frame pointer = 0x28:0xe55c8a64 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 30 (usbus4) Physical memory: 2038 MB Dumping 213 MB: 198 182 166 150 134 118 102 86 70 54 38 22 6 (kgdb) bt #0 doadump () at pcpu.h:246 #1 0xc04784d9 in db_fncall (dummy1=1, dummy2=0, dummy3=-1065664320, dummy4=0xe55c87f4 "") at /usr/src/sys/ddb/db_command.c:548 #2 0xc04788d1 in db_command (last_cmdp=0xc075991c, cmd_table=0x0, dopager=1) at /usr/src/sys/ddb/db_command.c:445 #3 0xc0478a2a in db_command_loop () at /usr/src/sys/ddb/db_command.c:498 #4 0xc047a86d in db_trap (type=12, code=0) at /usr/src/sys/ddb/db_main.c:229 #5 0xc05799d4 in kdb_trap (type=12, code=0, tf=0xe55c8a10) at /usr/src/sys/kern/subr_kdb.c:534 #6 0xc06bd3ff in trap_fatal (frame=0xe55c8a10, eva=208) at /usr/src/sys/i386/i386/trap.c:917 #7 0xc06bd6a0 in trap_pfault (frame=0xe55c8a10, usermode=0, eva=208) at /usr/src/sys/i386/i386/trap.c:839 #8 0xc06be002 in trap (frame=0xe55c8a10) at /usr/src/sys/i386/i386/trap.c:521 #9 0xc06a4ebb in calltrap () at /usr/src/sys/i386/i386/exception.s:165 #10 0xc0987301 in usb2_intr_schedule_adjust (udev=0xc5050000, len=-32, slot=5 '\005') at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:1120 #11 0xc0a038b5 in ehci_device_intr_close (xfer=0xc5010cb0) at /usr/src/sys/modules/usb/ehci/../../../dev/usb/controller/ehci.c:2317 #12 0xc098afb3 in usb2_transfer_stop (xfer=0xc5010cb0) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_transfer.c:1639 #13 0xc09b432e in ums_stop_read (fifo=0xc5038400) at /usr/src/sys/modules/usb/ums/../../../dev/usb/input/ums.c:653 #14 0xc097b08e in usb2_fifo_close (f=0xc5038400, fflags=1) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:787 #15 0xc097c63c in usb2_fifo_free (f=0xc5038400) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:582 #16 0xc097c6a3 in usb2_fifo_detach (f_sc=0xc5056800) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:1737 #17 0xc09b42c5 in ums_detach (self=0xc504ca00) at /usr/src/sys/modules/usb/ums/../../../dev/usb/input/ums.c:629 #18 0xc05743d8 in device_detach (dev=0xc504ca00) at device_if.h:212 #19 0xc0574599 in bus_generic_detach (dev=0xc4e31580) at /usr/src/sys/kern/subr_bus.c:3033 #20 0xc0985437 in uhub_detach (dev=0xc4e31580) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:868 #21 0xc05743d8 in device_detach (dev=0xc4e31580) at device_if.h:212 #22 0xc097e19e in usb2_detach_device (udev=0xc5051000, iface_index=32 ' ', flag=3 '\003') at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:978 #23 0xc097e3ca in usb2_unconfigure (udev=0xc5051000, flag=Variable "flag" is not available. ) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:382 #24 0xc097e68a in usb2_free_device (udev=0xc5051000, flag=Variable "flag" is not available. ) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1958 #25 0xc0986083 in uhub_explore (udev=0xc4e38c00) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:303 #26 0xc09776c9 in usb2_bus_explore (pm=0xc4dd9d14) at /usr/src/sys/modules/usb/usb/../../../dev/usb/controller/usb_controller.c:211 #27 0xc098851a in usb2_process (arg=0xc4dd9c70) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_process.c:139 #28 0xc052db00 in fork_exit (callout=0xc0988440 , arg=0xc4dd9c70, frame=0xe55c8d38) at /usr/src/sys/kern/kern_fork.c:821 #29 0xc06a4f30 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:270 (kgdb) fr 10 #10 0xc0987301 in usb2_intr_schedule_adjust (udev=0xc5050000, len=-32, slot=5 '\005') at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:1120 1120 hub = bus->devices[udev->hs_hub_addr]->hub; (kgdb) p udev->hs_hub_addr $1 = 2 '\002' (kgdb) p bus->devices[udev->hs_hub_addr]->hub Cannot access memory at address 0xd0 (kgdb) Parts of dmesg: ... pcib2: irq 20 at device 28.0 on pci0 pci2: on pcib2 pcib3: irq 21 at device 28.1 on pci0 pci3: on pcib3 pci3: at device 0.0 (no driver attached) pcib4: irq 22 at device 28.2 on pci0 pci4: on pcib4 pcib5: irq 23 at device 28.3 on pci0 pci12: on pcib5 uhci0: port 0x1800-0x181f irq 16 at device 29.0 on pci0 uhci0: [ITHREAD] usbus0: on uhci0 uhci1: port 0x1820-0x183f irq 17 at device 29.1 on pci0 uhci1: [ITHREAD] usbus1: on uhci1 uhci2: port 0x1840-0x185f irq 18 at device 29.2 on pci0 uhci2: [ITHREAD] usbus2: on uhci2 uhci3: port 0x1860-0x187f irq 19 at device 29.3 on pci0 uhci3: [ITHREAD] usbus3: on uhci3 ehci0: mem 0xee404000-0xee4043ff irq 19 at device 29.7 on pci0 ehci0: [ITHREAD] usbus4: EHCI version 1.0 usbus4: on ehci0 pcib6: at device 30.0 on pci0 pci21: on pcib6 ... usbus0: 12Mbps Full Speed USB v1.0 usbus1: 12Mbps Full Speed USB v1.0 usbus2: 12Mbps Full Speed USB v1.0 usbus3: 12Mbps Full Speed USB v1.0 usbus4: 480Mbps High Speed USB v2.0 ugen0.1: at usbus0 uhub0: on usbus0 ugen1.1: at usbus1 uhub1: on usbus1 ugen2.1: at usbus2 uhub2: on usbus2 ugen3.1: at usbus3 uhub3: on usbus3 ugen4.1: at usbus4 uhub4: on usbus4 ... uhub0: 2 ports with 2 removable, self powered uhub1: 2 ports with 2 removable, self powered uhub2: 2 ports with 2 removable, self powered uhub3: 2 ports with 2 removable, self powered ... uhub4: 8 ports with 8 removable, self powered ugen4.2: at usbus4 uhub5: on usbus4 uhub5: 7 ports with 7 removable, self powered ugen4.3: at usbus4 ums0: on usbus4 ums0: 5 buttons and [XYZ] coordinates ID=0 ugen3.2: at usbus3 ubt0: on usbus3 ugen3.3: at usbus3 ... after dock disconnect, it shows before panic: ugen4.2: at usbus4 (disconnected) uhub5: at uhub4, port 6, addr 2 (disconnected) USB configuration with dock: # usbconfig ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON ugen1.1: at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON ugen2.1: at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON ugen3.1: at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON ugen4.1: at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON ugen4.2: at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE ugen4.3: at usbus4, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON ugen3.2: at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON ugen3.3: at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON # -- Vladimir B. Grebenschikov vova@fbsd.ru