Skip to contentSkip to conversation

fix pit delay accounting in timer_interrupt()

PATCH New Avi Kivity 1 participant 1 message Feb 28, 2005

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 fix pit delay accounting in timer_interrupt()

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)

arch/x86_64/kernel/time.c renamed from arch/x86_64/kernel/time.c~time +1 -1
@@ -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)