Skip to content

Commit

Permalink
[PATCH] x86_64: fix last_tsc calculation of PM timer
Browse files Browse the repository at this point in the history
From: "Jan Beulich" <jbeulich@novell.com>

The PM timer code updates vxtime.last_tsc, but this update was done
incorrectly in two ways:
- offset_delay being in microseconds requires multiplying with cpu_mhz
  rather than cpu_khz
- the multiplication of offset_delay and cpu_khz (both being 32-bit
  values) on most current CPUs would overflow (observed value of the
  delay was approximately 4000us, yielding an overflow for frequencies
  starting a little above 1GHz)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jan Beulich authored and Linus Torvalds committed May 31, 2006
1 parent 2ba567c commit b2468e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86_64/kernel/pmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int pmtimer_mark_offset(void)
offset_delay = delta % (USEC_PER_SEC / HZ);

rdtscll(tsc);
vxtime.last_tsc = tsc - offset_delay * cpu_khz;
vxtime.last_tsc = tsc - offset_delay * (u64)cpu_khz / 1000;

/* don't calculate delay for first run,
or if we've got less then a tick */
Expand Down

0 comments on commit b2468e5

Please sign in to comment.