From owner-freebsd-stable@FreeBSD.ORG Fri Mar 2 19:25:46 2012 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 948CE106564A; Fri, 2 Mar 2012 19:25:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-stable@FreeBSD.org Date: Fri, 2 Mar 2012 14:25:32 -0500 User-Agent: KMail/1.6.2 References: <20120227152238.GA2940@regency.nsu.ru> <201203011655.05964.jkim@FreeBSD.org> <20120302085012.GA25811@regency.nsu.ru> In-Reply-To: <20120302085012.GA25811@regency.nsu.ru> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_u6RUPjiXMRgeD5V" Message-Id: <201203021425.34456.jkim@FreeBSD.org> Cc: Alexey Dokuchaev , Hans Petter Selasky Subject: Re: Resume broken in 8.3-PRERELEASE X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2012 19:25:46 -0000 --Boundary-00=_u6RUPjiXMRgeD5V Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 02 March 2012 03:50 am, Alexey Dokuchaev wrote: > On Thu, Mar 01, 2012 at 04:55:03PM -0500, Jung-uk Kim wrote: > > It does not make a difference for me (i.e., usb suspend/resume > > still broken) but I think I found a typo: > > > > --- sys/dev/usb/controller/usb_controller.c (revision 232365) > > +++ sys/dev/usb/controller/usb_controller.c (working copy) > > @@ -407,7 +407,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) > > > > USB_BUS_UNLOCK(bus); > > > > - bus_generic_shutdown(bus->bdev); > > + bus_generic_suspend(bus->bdev); > > > > usbd_enum_lock(udev); > > Same thing here, does not seem to improve anything. It might > suspend, resume (with keyboard working), then die on next suspend > completely. Or it may die on the first suspend (without suspending > -- fans are spinning, screen is black and no response to anything > except hard power-off), this actually happens more often. Try the attached patch. At least, it fixed my problem. > ./danfe > > P.S. Also, doing "ps" in debugger shows that acpiconf(8) is > running in the userland upon resume (and hang). Not sure if it > helps or not though. It usually means a device driver couldn't resume (and hang). Jung-uk Kim --Boundary-00=_u6RUPjiXMRgeD5V Content-Type: text/plain; charset="iso-8859-1"; name="usb.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usb.diff" Index: sys/dev/usb/controller/usb_controller.c =================================================================== --- sys/dev/usb/controller/usb_controller.c (revision 232401) +++ sys/dev/usb/controller/usb_controller.c (working copy) @@ -89,10 +89,15 @@ TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wa SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0, "No USB device enumerate waiting at boot."); +static int usb_no_suspend_wait = 0; +TUNABLE_INT("hw.usb.no_suspend_wait", &usb_no_suspend_wait); +SYSCTL_INT(_hw_usb, OID_AUTO, no_suspend_wait, CTLFLAG_RW|CTLFLAG_TUN, + &usb_no_suspend_wait, 0, "No USB device waiting at system suspend."); + static int usb_no_shutdown_wait = 0; TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait); -SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RW|CTLFLAG_TUN, &usb_no_shutdown_wait, 0, - "No USB device waiting at system shutdown."); +SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RW|CTLFLAG_TUN, + &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown."); static devclass_t usb_devclass; @@ -240,6 +245,11 @@ usb_suspend(device_t dev) USB_BUS_LOCK(bus); usb_proc_msignal(&bus->explore_proc, &bus->suspend_msg[0], &bus->suspend_msg[1]); + if (usb_no_suspend_wait == 0) { + /* wait for suspend callback to be executed */ + usb_proc_mwait(&bus->explore_proc, + &bus->suspend_msg[0], &bus->suspend_msg[1]); + } USB_BUS_UNLOCK(bus); return (0); @@ -407,7 +417,7 @@ usb_bus_suspend(struct usb_proc_msg *pm) USB_BUS_UNLOCK(bus); - bus_generic_shutdown(bus->bdev); + bus_generic_suspend(bus->bdev); usbd_enum_lock(udev); --Boundary-00=_u6RUPjiXMRgeD5V--