From owner-freebsd-alpha Tue Nov 12 13:45: 2 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1758137B401 for ; Tue, 12 Nov 2002 13:45:00 -0800 (PST) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F7EB43E91 for ; Tue, 12 Nov 2002 13:44:59 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 29979 invoked from network); 12 Nov 2002 21:45:07 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail16.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 12 Nov 2002 21:45:07 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id gACLiv2D005734; Tue, 12 Nov 2002 16:44:57 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <1037135718.27957.17.camel@focaccia.> Date: Tue, 12 Nov 2002 16:44:59 -0500 (EST) From: John Baldwin To: "Michael A. Mackey" Subject: Re: Extreme time drift in SMP mode Cc: freebsd-alpha@freebsd.org Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On 12-Nov-2002 Michael A. Mackey wrote: > Well, I guess I got really lucky.... > > I seem to have fixed the time drift problem, based on a hunch. > > Drew, after what you said about the boot processor alone driving the > timing, I decided to allow both processors to drive the timer. So, I > changed the code in the function 'alpha_clock_interrupt ()' in > /usr/src/sys/alpha/alpha/interrupt.c (actually I only added an #undef > SMP statement on line 467 and redefined it before the 'critical_exit()' > call). > > And now, the SMP system keeps proper track of the time. > > In a couple of days, I have two more processors arriving. Then I can > really test if this fix works. > > Thanks for your help - and I hope others can verify my results. Well, that's not really an ideal fix for the problem. :( Adjusting the timer frequency in the SMP case instead would be preferred. > On Tue, 2002-11-12 at 11:13, Andrew Gallatin wrote: >> >> Andrew Gallatin writes: >> > >> > Roberto de Iriarte writes: >> > >> > > Hmmm. my dmesg reads differently >> > > BTW, my system has only one CPU, and the clock has never > drifted. >> > > >> > >> > That's the thing. The 2100 is unlike all other alphas, and handles >> > clocks differently in MP mode. >> >> To elaborate on the above, I think most MP alphas tie the clock >> interrupt to the boot cpu, and it ticks at hz. >> >> I think the 2100 round-robins the clock interrupt to all running cpus, >> therefore the boot cpu only ticks at hz/mp_ncpus. >> >> Currently, we pay attention only to the boot CPU. From >> alpha_clock_interrupt() in sys/alpha/alpha/interrupt.c >> <...> >> critical_enter(); >> #ifdef SMP >> /* >> * Only one processor drives the actual timer. >> */ >> if (PCPU_GET(cpuid) == boot_cpu_id) { >> #endif >> (*platform.clockintr)(framep); >> /* divide hz (1024) by 8 to get stathz (128) > */ >> if ((++schedclk2 & 0x7) == 0) >> statclock((struct clockframe > *)framep); >> #ifdef SMP >> } else { >> mtx_lock_spin(&sched_lock); >> hardclock_process(curthread, > TRAPF_USERMODE(framep)); >> if ((schedclk2 & 0x7) == 0) >> statclock_process(curkse, > TRAPF_PC(framep), >> TRAPF_USERMODE(framep)); >> mtx_unlock_spin(&sched_lock); >> } >> #endif >> critical_exit(); >> <...> >> >> >> Given that I know zippo about how timekeeping works, I don't know >> what a good fix might be. If I had a machine in front of me, >> I'd be tempted to try dividing the a frequency by 2 in > sys/alpha/alpha/clock.c, >> but I'm not sure which one, or if it can be adjusted as additional > processors >> are found and started. (which would be slightly less wrong..). >> >> Drew > > > -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message