Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19357
b: refs/heads/master
c: bfaa1de
h: refs/heads/master
i:
  19355: eb9fd47
v: v3
  • Loading branch information
john stultz authored and Linus Torvalds committed Feb 1, 2006
1 parent 1c16bce commit 7488fd9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f7016d917faef8f1e016b4a7bd7f594694480b6
refs/heads/master: bfaa1deeb982c985d8e0435e835baeaae63b57fd
14 changes: 12 additions & 2 deletions trunk/arch/i386/kernel/timers/timer_tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */
static unsigned long long monotonic_base;
static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED;

/* Avoid compensating for lost ticks before TSCs are synched */
static int detect_lost_ticks;
static int __init start_lost_tick_compensation(void)
{
detect_lost_ticks = 1;
return 0;
}
late_initcall(start_lost_tick_compensation);

/* convert from cycles(64bits) => nanoseconds (64bits)
* basic equation:
* ns = cycles / (freq / ns_per_sec)
Expand Down Expand Up @@ -196,7 +205,8 @@ static void mark_offset_tsc_hpet(void)

/* lost tick compensation */
offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))
&& detect_lost_ticks) {
int lost_ticks = (offset - hpet_last) / hpet_tick;
jiffies_64 += lost_ticks;
}
Expand Down Expand Up @@ -421,7 +431,7 @@ static void mark_offset_tsc(void)
delta += delay_at_last_interrupt;
lost = delta/(1000000/HZ);
delay = delta%(1000000/HZ);
if (lost >= 2) {
if (lost >= 2 && detect_lost_ticks) {
jiffies_64 += lost-1;

/* sanity check to ensure we're not always losing ticks */
Expand Down

0 comments on commit 7488fd9

Please sign in to comment.