From owner-svn-src-stable@FreeBSD.ORG Fri Jun 1 12:47:14 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89C17106564A; Fri, 1 Jun 2012 12:47:14 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A66C8FC0C; Fri, 1 Jun 2012 12:47:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q51ClEVW019595; Fri, 1 Jun 2012 12:47:14 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q51ClEmY019593; Fri, 1 Jun 2012 12:47:14 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206011247.q51ClEmY019593@svn.freebsd.org> From: Mitsuru IWASAKI Date: Fri, 1 Jun 2012 12:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236395 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2012 12:47:14 -0000 Author: iwasaki Date: Fri Jun 1 12:47:13 2012 New Revision: 236395 URL: http://svn.freebsd.org/changeset/base/236395 Log: MFC r236220,236221: - Fix the problem acpi_sleep_force() hang. - Reorder resume procedures to avoid hang during AcpiLeaveSleepState() execution. Modified: stable/9/sys/dev/acpica/acpi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Fri Jun 1 11:42:50 2012 (r236394) +++ stable/9/sys/dev/acpica/acpi.c Fri Jun 1 12:47:13 2012 (r236395) @@ -2438,15 +2438,29 @@ acpi_SetSleepState(struct acpi_softc *sc #if defined(__amd64__) || defined(__i386__) static void +acpi_sleep_force_task(void *context) +{ + struct acpi_softc *sc = (struct acpi_softc *)context; + + if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate))) + device_printf(sc->acpi_dev, "force sleep state S%d failed\n", + sc->acpi_next_sstate); +} + +static void acpi_sleep_force(void *arg) { struct acpi_softc *sc = (struct acpi_softc *)arg; device_printf(sc->acpi_dev, "suspend request timed out, forcing sleep now\n"); - if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate))) - device_printf(sc->acpi_dev, "force sleep state S%d failed\n", - sc->acpi_next_sstate); + /* + * XXX Suspending from callout cause the freeze in DEVICE_SUSPEND(). + * Suspend from acpi_task thread in stead. + */ + if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER, + acpi_sleep_force_task, sc))) + device_printf(sc->acpi_dev, "AcpiOsExecute() for sleeping failed\n"); } #endif @@ -2745,10 +2759,10 @@ backout: acpi_wake_prep_walk(state); sc->acpi_sstate = ACPI_STATE_S0; } - if (slp_state >= ACPI_SS_SLP_PREP) - AcpiLeaveSleepState(state); if (slp_state >= ACPI_SS_DEV_SUSPEND) DEVICE_RESUME(root_bus); + if (slp_state >= ACPI_SS_SLP_PREP) + AcpiLeaveSleepState(state); if (slp_state >= ACPI_SS_SLEPT) { acpi_resync_clock(sc); acpi_enable_fixed_events(sc);