Date: Sun, 20 May 2007 18:59:10 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: Victor Balada Diaz <victor@bsdes.net> Cc: Peter Jeremy <peterjeremy@optushome.com.au>, stable@freebsd.org Subject: Re: RTC clock doesn't generate interrupts Message-ID: <20070520235910.GC13345@dan.emsphone.com> In-Reply-To: <20070520193808.GA857@pato.euesrg02.net> References: <20070520162630.GA1481@pato.euesrg02.net> <20070520191123.GR1164@turion.vk2pj.dyndns.org> <20070520193808.GA857@pato.euesrg02.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (May 20), Victor Balada Diaz said:
> On Mon, May 21, 2007 at 05:11:23AM +1000, Peter Jeremy wrote:
> > On 2007-May-20 18:26:30 +0200, Victor Balada Diaz <victor@bsdes.net> wrote:
> > >I have a server with FreeBSD 6.2 that is not generating RTC IRQs.
> > >When the system boots everything it's working fine and I get 128
> > >interrupts per second but after a few hours the system starts
> > >losing RTC interrupts. If I enable powerd it happens much faster
> > >than without it.
> >
> > The RTC has a "feature" that if you ever lose an RTC interrupt
> > (because the interrupt handler wasn't called fast enough), you
> > don't get any more interrupts because the RTC knows it has an
> > interrupt pending and so doesn't generate any more interrupts.
> >
> > I have also bumped into this problem whilst trying to work around a
> > problem with a TurionX2 CPU. I just got the correct fix to work
> > and ignored the work-around.
> >
> > I did find that you can restart the RTC interrupts by setting
> > machdep.adjkerntz (you can leave the value the same, it's the
> > assignment that's important).
>
> Thanks for your fast reply!
>
> I tried the machdep.adjkerntz trick and didn't work very well.
> If i'm on 0 irqs per second after changing the value i get 1
> irq per second. If i'm on 20 i get 21, and so on.
>
> Do you know of any other workaround/patch that i can try?
Here's what I use on a couple of Dell 2400's. I put it in cron to fire
every 5 minutes:
#! /bin/sh
# fixrtc - kick the RTC if it stops running
# get the interrupt rate for the stat clock over one second
getticks() {
( vmstat -i ; sleep 1 ; vmstat -i ) |
awk '/rtc/ { if (sum) sum+=$3; else sum-=$3 } END { print sum }'
}
ticks=$( getticks )
# It should be firing at 128 hz. If not, kick it
if [ $ticks -lt 64 ] ; then
echo "Stat clock has died. Attempting to reset."
echo
/etc/rc.d/ntpd stop
echo
/usr/sbin/ntpdate -b pool.ntp.org
echo
/etc/rc.d/ntpd start
echo
echo "RTC interrupt rate is now $(getticks)"
fi
--
Dan Nelson
dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070520235910.GC13345>
