Since 2.3.20: APIC timer calibration race + patch

Maciej W. Rozycki (macro@ds2.pg.gda.pl)
Wed, 15 Dec 1999 14:16:09 +0100 (MET)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-33463914-945262019=:2620
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.GSO.3.96.991215134717.2620J@delta.ds2.pg.gda.pl>

Linus, Ingo,

Got it, finally! Since APIC code rewrite in 2.3.20, there was an
annoying problem with APIC timer calibration, which tended to
underestimate the clock heavily (such as getting half of its real value),
which in turn ended in APIC timer interrupts being asserted too frequently
(with all nasty effects resulting).

It turned out that there is a race condition in get_8254_timer_count(),
which accesses 8254's ports directly, using no mutex means even though
interrupts are enabled on all CPUS at this stage, and regardless of
timer_interrupt() accessing the very same port. Looks like a simple
overlook, though, as timer_interrupt() has all necessary bits already in
place.

With the attached patch, get_8254_timer_count() has them too. Apart from
being "obviously correct", the patch has been tested across several
reboots and the calibrated APIC clock rates were within 1e-5 accuracy.
The same accuracy was observed when comparing NMI and LOC interrupt
counters after about two days of uptime. All tests were performed on a
dual-P5MMX/233 system using the i430HX chipset, running 2.3.31.

Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

---559023410-33463914-945262019=:2620 Content-Type: APPLICATION/OCTET-STREAM; NAME="patch-2.3.31-8254-0.gz" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.GSO.3.96.991215134659.2620H@delta.ds2.pg.gda.pl> Content-Description:

H4sIAAAAAAACA42R4U6DMBSFf9OnuImJmUKhDDZhTrMfxhfwARrsuu1GKLO0 G4n67hbI1KlL9oeQc+79zrmwxNUKqAVKtRRWN7iT7l3JPV1hKaFEZVs6DpMw icOqELqOCi02ESbZNHqRWskyaqptKI4mT8wQSun5RO9RIzxIATEDls4SNktz iPM8J77vnxPnPRVmAMTA4tl4MkvTAbBYAI3jYAq+e97AYkHgApUo7VLCvCdH qNCEm3sCf62q6gz/t9xsUZW1eOm3fptDL96Ywvzru8L85DLq107vWk+TLHDn +NMkD+Ksbw7XEYEOjAKsanCt5BJQGeC8OwLW0vBsPEm5wUpqLmqrzGhX4/KK wBvxPdkaVw70vsvnBtpuri9z69wvYlmrNazKYt04mYB3FNVDb93H8r29RjOs c9e7KXZydPmNDAbE1cCorXnm2xFrGQuAtWnidPB6GNw58GCm7If8fqTDfA5Z xzrkWnVI1rIxtT4R7v6qp6Wx7u5D9Q/yCbml7nYLAwAA ---559023410-33463914-945262019=:2620--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/