Commit f2cf3160 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ia32 jiffy wrapping fixes

From: john stultz <johnstul@us.ibm.com>

Converts all uses of jiffies to jiffies_64 in x86 time sources to avoid
jiffies overflow problems.

(Contributions from Tim Schmielau <tim@physik3.uni-rostock.de>)
parent ea114bac
......@@ -71,7 +71,7 @@ static void mark_offset_cyclone(void)
lost = delta/(1000000/HZ);
delay = delta%(1000000/HZ);
if (lost >= 2)
jiffies += lost-1;
jiffies_64 += lost-1;
/* update the monotonic base value */
this_offset = ((unsigned long long)last_cyclone_high<<32)|last_cyclone_low;
......@@ -88,7 +88,7 @@ static void mark_offset_cyclone(void)
* usec delta is > 90% # of usecs/tick)
*/
if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ))
jiffies++;
jiffies_64++;
}
static unsigned long get_offset_cyclone(void)
......
......@@ -108,7 +108,7 @@ static void mark_offset_hpet(void)
offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
int lost_ticks = (offset - hpet_last) / hpet_tick;
jiffies += lost_ticks;
jiffies_64 += lost_ticks;
}
hpet_last = offset;
......
......@@ -30,7 +30,6 @@ struct timer_opts timer_tsc;
int tsc_disable __initdata = 0;
extern spinlock_t i8253_lock;
extern volatile unsigned long jiffies;
static int use_tsc;
/* Number of usecs that the last interrupt was delayed */
......@@ -141,7 +140,7 @@ unsigned long long sched_clock(void)
#ifndef CONFIG_NUMA
if (!use_tsc)
#endif
return (unsigned long long)jiffies * (1000000000 / HZ);
return (unsigned long long)get_jiffies_64() * (1000000000 / HZ);
/* Read the Time Stamp Counter */
rdtscll(this_offset);
......@@ -215,7 +214,7 @@ static void mark_offset_tsc(void)
lost = delta/(1000000/HZ);
delay = delta%(1000000/HZ);
if (lost >= 2) {
jiffies += lost-1;
jiffies_64 += lost-1;
/* sanity check to ensure we're not always losing ticks */
if (lost_count++ > 100) {
......@@ -241,7 +240,7 @@ static void mark_offset_tsc(void)
* usec delta is > 90% # of usecs/tick)
*/
if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ))
jiffies++;
jiffies_64++;
}
static void delay_tsc(unsigned long loops)
......@@ -283,7 +282,7 @@ static void mark_offset_tsc_hpet(void)
offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
if (unlikely(((offset - hpet_last) > hpet_tick) && (hpet_last != 0))) {
int lost_ticks = (offset - hpet_last) / hpet_tick;
jiffies += lost_ticks;
jiffies_64 += lost_ticks;
}
hpet_last = hpet_current;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment