Hi all, Background ========== I have a laptop (Compaq R3480EA, AMD 64 3400+ with NForce3) and reported multiple problems related to timer issues. In a nutshell, sometimes, the PIT/TSC timer runs 3x too fast [1]. That causes many issues, including DMA errors, MCE, and clock running way too fast (making the laptop unusable for any software development). So far, no BIOS update was able to fix the issue for me. As I first reported this the LKML back in march [2], the only reliable time source on this laptop seems to be the PM timer. However, the time in Linux is tick based and forcing the PM timer doesn't help. Also, the PIT timer being used to calibrate the lpj, the wrong LP was causing the nasty errors I had with DMA and other MCE. Although the lpj can be forced at boot, having it right in the first place even on such broken hardware as my laptop can save quite a lot of time and investigations for novice users. Many similar reports can be found on the web for the Compaq R3000 and HP zv5000 laptops, either with 64 or 32 bit CPU [3]. Similar bug reports with no fix can be also found in SuSE and Red Hat bugzilla databases. What the patch does =================== Basically, the patch adjusts the PIT/TSC passed values based on the PM timer rate. The PM timer is compared to the TSC/PIT rate and a a multiplier is computed. On a "normal" system, the ratio is 1. On my broken laptop, the ratio is 3. That ration is then applied to all values passed to the PIT timer. For example, instead of using: outb_p(LATCH & 0xff, PIT_CH0); outb(LATCH >> 8, PIT_CH0); The patch uses : outb_p((LATCH * timer_mult) & 0xff, PIT_CH0); outb((LATCH * timer_mult) >> 8, PIT_CH0); Also, the ratio is computed/used only if the user has specified the "clock=pmtmr" boot option on i386 or "pmtmr" on x86_64. If the user has not explicitly asked for the PM timer to be used, and if there is a delta of more than 5% between the PM timer and the PIT, then the PM timer is not used (just like it is in the current implementation for i386 arch). What is included in the patch ============================= The patch includes the code that implements the workaround described above for x86_64 and i386 arch. The patch applies in Linux 2.6.12.3. Documentation is also updated. ================================================================================== Please let me know if there are some fixes or improvements to add and if such a patch could be suitable in the kernel. As a side note, this patch is very useful for me as it makes the laptop usable under Linux and I plan to keep it available somewhere on xfce.org so that other Compaq R3000 and HP zv5000 owners can use it. Ref. [1] http://kerneltrap.org/mailarchive/1/message/43741/thread [2] http://lkml.org/lkml/2005/3/29/265 [3] http://lists.pcxperience.com/pipermail/linuxr3000/2004- September/003678.html http://lists.pcxperience.com/pipermail/linuxr3000/2004- September/003788.html http://lists.pcxperience.com/pipermail/linuxr3000/2005- July/006763.html http://lists.pcxperience.com/pipermail/linuxr3000/2005- January/004650.html Thanks, Regards, Olivier.