Re: Patch to detect 8254 timer munging in BIOS calls (needs testing)

:Seems to work, but the correction seems to be one hour off.
:Without the patch my clock was pretty exactly running at twice the expected
:speed (especially noticable when i benchmarked some of my programms and got
:double of the expected times), now it runs aligned with the wall clock and
:the benchmarks are back to what was expected.
:
:This happened within 20 minutes and demonstrates the one hour off problem:
:
:----8<---- messages ----8<----
:Nov 20 18:08:28 tower sudo: ah : TTY=ttyv0 ; PWD=/usr/home/ah ; USER=root ; COMMAND=/bin/date 1709
:Nov 20 17:09:00 tower date: date set by ah
:Nov 20 18:11:15 tower kernel: Warning: BIOS messed around with the 8254, resetting it
:Nov 20 18:11:15 tower kernel: Warning: BIOS messed around with the 8254, resetting it
:Nov 20 19:15:32 tower kernel: Warning: BIOS messed around with the 8254, resetting it
:Nov 20 19:15:32 tower kernel: Warning: BIOS messed around with the 8254, resetting it
:Nov 20 19:23:08 tower sudo: ah : TTY=ttyp9 ; PWD=/usr/home/ah ; USER=root ; COMMAND=/usr/bin/su -
:Nov 20 17:23:00 tower date: date set by ah
:---->8---- messages ---->8----
:
:Andy
Ok, I believe I have fixed both problems now, and I've committed the
work and slipped the Stable tag for it.
The one-hour-off issue was due to an earlier attempt to correct the
problem. The restoreclocks() function was reverse-indexing callout
timers and hardclock causing the delta to go negative, but since it
is an unsigned value it actually went very positive and jumped the
seconds field by 4 billion 8254 clocks == 1 hour.
The jumping is also likely responsible for Jonathon McKitrick's last
bit of PIIX4 timeout problems as it caused the callout timeouts to
prematurely fire.
-Matt
Matthew Dillon
<dillon@xxxxxxxxxxxxx>