From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 20:43:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 176E11065673; Fri, 13 Aug 2010 20:43:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 064AB8FC0C; Fri, 13 Aug 2010 20:43:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DKhJg4006569; Fri, 13 Aug 2010 20:43:19 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DKhJKI006566; Fri, 13 Aug 2010 20:43:19 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008132043.o7DKhJKI006566@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Aug 2010 20:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211288 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 20:43:20 -0000 Author: jkim Date: Fri Aug 13 20:43:19 2010 New Revision: 211288 URL: http://svn.freebsd.org/changeset/base/211288 Log: Enforce ACPI timer as the timecounter hardware before we change sleep state unless it is the current timer. When we have resumed successfully, restore the previous timecounter hardware if it was changed earlier. Only the ACPI timer is guaranteed to increase monotonically between S-state changes. Modified: head/etc/rc.resume head/etc/rc.suspend Modified: head/etc/rc.resume ============================================================================== --- head/etc/rc.resume Fri Aug 13 20:29:43 2010 (r211287) +++ head/etc/rc.resume Fri Aug 13 20:43:19 2010 (r211288) @@ -43,6 +43,12 @@ if [ -r /var/run/rc.suspend.pid ]; then echo 'rc.resume: killed rc.suspend that was still around' fi +if [ -r /var/run/rc.suspend.tch ]; then + _t=`cat /var/run/rc.suspend.tch` + /sbin/sysctl -n kern.timecounter.hardware=$_t > /dev/null 2>&1 + /bin/rm -f /var/run/rc.suspend.tch +fi + # Turns on a power supply of a card in the slot inactivated. # See also contrib/pccardq.c (only for PAO users). # pccardq | awk -F '~' '$5 == "inactive" \ Modified: head/etc/rc.suspend ============================================================================== --- head/etc/rc.suspend Fri Aug 13 20:29:43 2010 (r211287) +++ head/etc/rc.suspend Fri Aug 13 20:43:19 2010 (r211288) @@ -43,6 +43,18 @@ fi echo $$ 2> /dev/null > /var/run/rc.suspend.pid +_t=`/sbin/sysctl -n kern.timecounter.hardware 2> /dev/null` +case ${_t#ACPI-} in +fast|safe) + /bin/rm -f /var/run/rc.suspend.tch + ;; +*) + ( /sbin/sysctl -n kern.timecounter.hardware=ACPI-fast || \ + /sbin/sysctl -n kern.timecounter.hardware=ACPI-safe ) \ + > /dev/null 2>&1 && echo $_t > /var/run/rc.suspend.tch + ;; +esac + # If you have troubles on suspending with PC-CARD modem, try this. # See also contrib/pccardq.c (Only for PAO users). # pccardq | awk -F '~' '$5 == "filled" && $4 ~ /uart/ \