mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][x86-64] fix pit delay accounting in timer_interrupt()
@ 2005-02-28 13:46 Avi Kivity
  0 siblings, 0 replies; only message in thread
From: Avi Kivity @ 2005-02-28 13:46 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

timer_interrupt() measures the delay from an interrupt to its handling
in a variable called 'delay', but accounts every unit of delay as 1/HZ
seconds, instead of 1/CLOCK_TICK_RATE seconds.

on ordinary cpus this doesn't matter as delay is usually zero, but on my
10MHz bochs cpu this causes divide overflows later on.

(patch against 2.6.9 but should apply)

Signed-off-by: Avi Kivity <avi@argo.co.il>



[-- Attachment #2: pit-delay.patch --]
[-- Type: text/plain, Size: 470 bytes --]

--- linux-2.6.9/arch/x86_64/kernel/time.c~time	2005-02-28 14:26:52.000000000 +0200
+++ linux-2.6.9/arch/x86_64/kernel/time.c	2005-02-28 14:28:46.000000000 +0200
@@ -409,7 +409,7 @@
 
 		monotonic_base += (tsc - vxtime.last_tsc)*1000000/cpu_khz ;
 
-		vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot;
+		vxtime.last_tsc = tsc - vxtime.quot * delay / (LATCH * vxtime.tsc_quot);
 
 		if ((((tsc - vxtime.last_tsc) *
 		      vxtime.tsc_quot) >> 32) < offset)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-28 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-28 13:46 [PATCH][x86-64] fix pit delay accounting in timer_interrupt() Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®