From owner-freebsd-current@FreeBSD.ORG Sun Mar 4 12:27:52 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2C0516A401; Sun, 4 Mar 2007 12:27:52 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2-3.pacific.net.au [61.8.2.226]) by mx1.freebsd.org (Postfix) with ESMTP id 73FF613C4A5; Sun, 4 Mar 2007 12:27:52 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id 7ADD3109996; Sun, 4 Mar 2007 23:27:47 +1100 (EST) Received: from besplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 22BAA27406; Sun, 4 Mar 2007 23:27:50 +1100 (EST) Date: Sun, 4 Mar 2007 23:27:48 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Stefan Ehmann In-Reply-To: <200703021619.33755.shoesoft@gmx.net> Message-ID: <20070304230346.O7298@besplex.bde.org> References: <200703011612.07110.shoesoft@gmx.net> <200703021619.33755.shoesoft@gmx.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Sun, 04 Mar 2007 13:15:21 +0000 Cc: freebsd-current@freebsd.org, bde@freebsd.org Subject: Re: notebook freezes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 04 Mar 2007 12:27:52 -0000 On Fri, 2 Mar 2007, Stefan Ehmann wrote: > On Thursday 01 March 2007 16:12, Stefan Ehmann wrote: >> My few days old -current freezes if I press Fn-F6 (this is the combination >> to adjust display brightness) if I've done a suspend/resume before. >> Directly after boot it works fine. > ... > So I did a binary search. > > src/sys/i386/isa/clock.c r1.231 causes my notebook to freeze. > > Reverting this change in a CURRENT from today fixes the problem. > > The notebook is still pingable in this state. I experienced some other random > hangs recently but don't know yet if those are related. Oops. If suspend/resume clobbers the RTC state (which we already have code to restore), then it can clobber the RTC index (which even the restoral code assumes is unclobbered). Try this fix. %%% Index: clock.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/clock.c,v retrieving revision 1.234 diff -u -2 -r1.234 clock.c --- clock.c 4 Mar 2007 04:55:19 -0000 1.234 +++ clock.c 4 Mar 2007 11:58:00 -0000 @@ -580,4 +582,5 @@ /* Restore all of the RTC's "status" (actually, control) registers. */ /* XXX locking is needed for RTC access. */ + rtc_reg = -1; writertc(RTC_STATUSB, RTCSB_24HR); writertc(RTC_STATUSA, rtc_statusa); %%% A similar fix might be needed for amd64, but amd64 doesn't have a resume hook for putting it in. The RTC index might get clobbered even if the data registers aren't. I don't know how any of this works with ACPI. AFAIK (not far), the resume hook is only called for APM. I think the resume hook is not actually called on your system since it would fix up the RTC index as a side effect of accessing 2 different RTC registers. At worst, if it is called then it might do the following: - write garbage to the current RTC register, and fail to mask interrupts. This only happens if on resume rtc_reg is RTC_STATUSB but the physical index is different. If RTC interrupts are used (which is normal if ACPI timer interrups are not used), then rtc_reg is normally RTC_INTR so there is no problem. Otherwise, there might be no problem because the last RTC access might be to RTC_YEAR for inittodr(). - write the correct value to RTC_STATUSA, but lose if the RTC interrupt disabling in the previous access was critical. - write the correct value to RTC_STATUSB. disabling in the previous access was critical, and end up with a consistent index. Bruce