From owner-freebsd-current@FreeBSD.ORG Sat Apr 5 09:42:31 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A24637B401 for ; Sat, 5 Apr 2003 09:42:31 -0800 (PST) Received: from srv2.resnet.ohio-state.edu (srv2.resnet.ohio-state.edu [164.107.3.56]) by mx1.FreeBSD.org (Postfix) with SMTP id 09E4743F85 for ; Sat, 5 Apr 2003 09:42:28 -0800 (PST) (envelope-from mistry.7@osu.edu) Received: (qmail 28315 invoked by uid 506); 5 Apr 2003 18:10:40 -0000 Received: from mistry.7@osu.edu by srv2.resnet.ohio-state.edu by uid 503 with qmail-scanner-1.14 ( Clear:. Processed in 0.251886 secs); 05 Apr 2003 18:10:40 -0000 Received: from rdrt-164-107-205-53.resnet.ohio-state.edu (HELO 192.168.1.100) (164.107.205.53) by srv2.resnet.ohio-state.edu with SMTP; 5 Apr 2003 18:10:39 -0000 From: Anish Mistry To: freebsd-current@freebsd.org Date: Sat, 5 Apr 2003 12:38:52 -0500 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_sSxj+tsz7Vihhss" Message-Id: <200304051238.52084.mistry.7@osu.edu> X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: USB Ohci Suspend/Resume X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Apr 2003 17:42:31 -0000 --Boundary-00=_sSxj+tsz7Vihhss Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've been working on some usb suspend/resume code for my laptop since the USB ports stop working after a resume. After a lot of trial and error I finally got it to "work" sorta. Behavior with my code: 1) If I remove any type of device, suspend the laptop and then resume any usb device that I plug in will start working correctly, etc. attach -> detach -> suspend -> resume -> attach (OK) 2) When I leave a device plugged in and remove it while it is suspended, then resume it, the laptop will resume properly, but when I plug the device back it will show a detaching message then panic. attach -> suspend -> detach -> resume -> attach (Panic) 3) If I leave the device plugged in then suspend and resume with the device plugged in it will panic. attach -> suspend -> resume -> (Panic) 4) If I suspend the laptop, plug in the device, and then resume, then it's ok. suspend -> attach -> resume -> (Ok) Now for the weird part, at least for me. Panics for numbers (2) and (3) only happen with certain classes of devices (ums,ukbd), but with devices like (uhid,umass,uscanner,ugen) there was no panic and the devices reattached just fine. These were the only type of devices that I was able to test, so the lists probably includes other device types. If anyone has any suggestions it would be appreciated. This is my first attempt at any kernel code. Attached is my dmesg, and usb code patch. Thanks, This is where it panics: ohci_device_intr_close This GDB was configured as "i386-undermydesk-freebsd"... panic: page fault panic messages: --- Fatal trap 12: page fault while in kernel mode fault virtual address = 0x10 fault code = supervisor write, page not present instruction pointer = 0x8:0xc266605f stack pointer = 0x10:0xcd357be4 frame pointer = 0x10:0xcd357c00 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 = 337 (usb0) trap number = 12 panic: page fault syncing disks, buffers remaining... 1414 1414 1413 1413 1413 1413 1413 1413 1413 1413 1413 1413 1413 1413 1413 wakeup from sleeping state (slept 00:00:09) ata0: resetting devices .. done ata1: resetting devices .. done 1413 1413 1413 1413 1413 1413 1413 giving up on 1326 buffers Uptime: 1m39s Dumping 239 MB ata0: resetting devices .. done 16 32 48 64 80 96 112 128 144 160 176 192 208 224 --- Reading symbols from /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/ acpi/acpi.ko.debug...done. pi/acpi.ko.debug Reading symbols from /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/ usb/usb.ko.debug...done. Loaded symbols for /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/us b/usb.ko.debug Reading symbols from /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/ linux/linux.ko.debug...done. Loaded symbols for /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/li nux/linux.ko.debug Reading symbols from /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/ ums/ums.ko.debug...done. Loaded symbols for /usr/obj/usr/src/sys/LITTLEGUY/modules/usr/src/sys/modules/um s/ums.ko.debug #0 doadump () at /usr/src/sys/kern/kern_shutdown.c:239 239 dumping++; (kgdb) bt #0 doadump () at /usr/src/sys/kern/kern_shutdown.c:239 #1 0xc01e5a98 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:371 #2 0xc01e5d43 in panic () at /usr/src/sys/kern/kern_shutdown.c:542 #3 0xc02fa7e2 in trap_fatal (frame=0xcd357ba4, eva=0) at /usr/src/sys/i386/i386/trap.c:843 #4 0xc02fa4c2 in trap_pfault (frame=0xcd357ba4, usermode=0, eva=16) at /usr/src/sys/i386/i386/trap.c:757 #5 0xc02fa03d in trap (frame= {tf_fs = 24, tf_es = 16, tf_ds = 16, tf_edi = 4, tf_esi = -1033428992, tf_ ebp = -852132864, tf_isp = -852132912, tf_ebx = -1033431168, tf_edx = 0, tf_ecx = -1033444956, tf_eax = -1033429216, tf_trapno = 12, tf_err = 2, tf_eip = -10334 78049, tf_cs = 8, tf_eflags = 66118, tf_esp = -1033351552, tf_ss = -852132872}) at /usr/src/sys/i386/i386/trap.c:444 #6 0xc02eaa08 in calltrap () at {standard input}:96 #7 0xc265c148 in usbd_close_pipe (pipe=0xc2671780) at /usr/src/sys/dev/usb/usbdi.c:272 #8 0xc26b3c4d in ums_disable (priv=0xc2671780) at /usr/src/sys/dev/usb/ums.c:582 #9 0xc26b36d2 in ums_detach (self=0x0) at /usr/src/sys/dev/usb/ums.c:371 #10 0xc01f9d57 in device_detach (dev=0xc2672000) at device_if.h:48 #11 0xc01f90ef in device_delete_child (dev=0x0, child=0xc28390a0) at /usr/src/sys/kern/subr_bus.c:976 #12 0xc265be93 in usb_disconnect_port (up=0x4, parent=0x0) ---Type to continue, or q to quit--- at /usr/src/sys/dev/usb/usb_subr.c:1364 #13 0xc265919e in uhub_explore (dev=0xc262e100) at /usr/src/sys/dev/usb/uhub.c:428 #14 0xc2659f65 in usb_discover (v=0xc242c1a0) at /usr/src/sys/dev/usb/usb.c:702 #15 0xc2659958 in usb_event_thread (arg=0xc242c1a0) at /usr/src/sys/dev/usb/usb.c:399 #16 0xc01d3912 in fork_exit (callout=0xc26598f0 , arg=0x0, frame=0x0) at /usr/src/sys/kern/kern_fork.c:791 (kgdb) -- Anish Mistry --Boundary-00=_sSxj+tsz7Vihhss Content-Type: text/plain; charset="us-ascii"; name="dmesg.littleguy" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dmesg.littleguy" Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.0-CURRENT #5: Thu Apr 3 17:07:28 EST 2003 root@littleguy.resnet.ohio-state.edu:/usr/obj/usr/src/sys/LITTLEGUY Preloaded elf kernel "/boot/kernel/kernel" at 0xc046b000. Preloaded elf module "/boot/kernel/acpi.ko" at 0xc046b0a8. Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 859336263 Hz CPU: Transmeta(tm) Crusoe(tm) Processor TM5800 (859.34-MHz 586-class CPU) Origin = "GenuineTMx86" Id = 0x543 real memory = 251527168 (239 MB) avail memory = 239439872 (228 MB) Allocating major#253 to "net" Allocating major#252 to "g_ctl" Allocating major#251 to "pci" npx0: on motherboard npx0: INT 16 interface acpi0: on motherboard ACPI-0625: *** Info: GPE Block0 defined as GPE0 to GPE63 pcibios: BIOS version 2.10 Using $PIR table, 9 entries at 0xc00fdf30 acpi0: power button is handled as a fixed feature programming model. Timecounter "ACPI-safe" frequency 3579545 Hz acpi_timer0: <24-bit timer at 3.579545MHz> port 0xff08-0xff0b on acpi0 acpi_cpu0: port 0x530-0x537 on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pci0: at device 0.1 (no driver attached) pci0: at device 0.2 (no driver attached) pci0: at device 2.0 (no driver attached) pcm0: port 0x1000-0x10ff mem 0xfc005000-0xfc005fff irq 9 at device 4.0 on pci0 pcm0: alpm0: at device 6.0 on pci0 alpm0: Could not allocate Bus space device_probe_and_attach: alpm0 attach returned 6 isab0: at device 7.0 on pci0 isa0: on isab0 pci0: at device 12.0 (no driver attached) atapci0: port 0x1800-0x180f at device 15.0 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 rl0: port 0x8000-0x80ff mem 0xfc007800-0xfc0078ff irq 9 at device 16.0 on pci0 rl0: Realtek 8139B detected. Warning, this may be unstable in autoselect mode rl0: Ethernet address: 00:e0:00:ae:45:08 miibus0: on rl0 rlphy0: on miibus0 rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto pci0: at device 19.0 (no driver attached) pci0: at device 20.0 (no driver attached) acpi_button0: on acpi0 acpi_acad0: on acpi0 acpi_cmbat0: on acpi0 acpi_cmbat1: on acpi0 acpi_lid0: on acpi0 atkbdc0: port 0x64,0x60 irq 1 on acpi0 atkbd0: flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 psm0: irq 12 on atkbdc0 psm0: model Generic PS/2 mouse, device ID 0 acpi_ec0: port 0x66,0x62 on acpi0 orm0: