From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7d074d7874b8d3363a1f853ce63c4e5b@plan9.bell-labs.com> From: David Presotto To: 9fans@cse.psu.edu Subject: Re: [9fans] rio and acme scrolling In-Reply-To: <78e57cf1aaa73ca03a1e3a5df2385bd8@hamnavoe.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-fbzydrivhufubortqkbsoesntm" Date: Sat, 27 Mar 2004 10:38:08 -0500 Topicbox-Message-UUID: 44e78672-eacd-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-fbzydrivhufubortqkbsoesntm Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Too many of the laptops systems have clock scaling for power conservarion. I used to use the TSC everywhere I could but it's even more of a problem with laptops. People kept complaining that when plugging/unplugging their machines into power supplies or when their batteries ran down, time would speed up or slow down. I use it on my own laptop. I agree that timesync doesn't notice anywhere near fast enough. I'll add ytour hack too. --upas-fbzydrivhufubortqkbsoesntm Content-Type: message/rfc822 Content-Disposition: inline Received: from plan9.cs.bell-labs.com ([135.104.9.2]) by plan9; Sat Mar 27 10:23:41 EST 2004 Received: from mail.cse.psu.edu ([130.203.4.6]) by plan9; Sat Mar 27 10:23:38 EST 2004 Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 1AD4019F96; Sat, 27 Mar 2004 10:23:31 -0500 (EST) Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.4.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 5B14C19CCC; Sat, 27 Mar 2004 10:23:26 -0500 (EST) X-Original-To: 9fans@cse.psu.edu Delivered-To: 9fans@cse.psu.edu Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id C389C19F46; Sat, 27 Mar 2004 10:22:57 -0500 (EST) Received: from hamnavoe.gotadsl.co.uk (hamnavoe.gotadsl.co.uk [213.208.117.150]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 40FBC19CCC for <9fans@cse.psu.edu>; Sat, 27 Mar 2004 10:22:56 -0500 (EST) Message-ID: <78e57cf1aaa73ca03a1e3a5df2385bd8@hamnavoe.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] rio and acme scrolling From: Richard Miller In-Reply-To: <466a2993c3a0232a58065be590e2a716@plan9.bell-labs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.11 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Sat, 27 Mar 2004 15:22:57 0000 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on psuvax1.cse.psu.edu X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Level: > The clock (timer 2) speeds up by a factor of 5 or so. > I can only assume that the firmware uses it for something > to do with detecting the lid opening again. This seems to be a particular problem with thinkpads - and it's not just closing the lid: screen blanking will reset the clock period as well. Fixing it with timesync is not good enough, because bad things can still happen while the clock is racing until timesync notices. In particular, the timeout waiting for a spun-down hard drive to come up is much too short, resulting in spurious "disk errors" - I've lost my fossil fs twice because of this. (Thanks to venti, this was an irritation rather than a disaster.) Here's the workaround I use to detect the loss of the clock period and repair it as soon as it happens. You'll still lose the odd millisecond but it's better than an ongoing 5x clock overrun: term% diff /sys/src/9/pc/i8253.c i8253.c 268c269 < else --- > else { 269a271,278 > if (x > 3*MaxPeriod) { > outb(Tmode, Load2|Square); > outb(T2cntr, 0); /* low byte */ > outb(T2cntr, 0); /* high byte */ > y = 0xFFFF; > x = i8253.period; > } > } Alternatively, why not use the TSC when there is one? I note that this is the default for the MP architecture, but only for CPU server kernels -- does anyone know why? Here's a one-line fix which also seems to work on my thinkpad: term% diff /sys/src/9/pc/devarch.c devarch.c 692a693 > archgeneric.fastclock = tscticks; -- Richard --upas-fbzydrivhufubortqkbsoesntm--