]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ia32 jiffy wrapping fixes
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 07:40:23 +0000 (23:40 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 07:40:23 +0000 (23:40 -0800)
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>)

arch/i386/kernel/timers/timer_cyclone.c
arch/i386/kernel/timers/timer_hpet.c
arch/i386/kernel/timers/timer_tsc.c

index d081539d5693feafaac7448d85fc4eab2a400100..4c55a649d3e538cb30639c8093323dd7a5054740 100644 (file)
@@ -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)
index ccd3c43a3ac3fe5d4f939a2778eee351de044756..15035a5631b409d6c64c8dc42b458344c39afebd 100644 (file)
@@ -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;
 
index ffb1afb1b9a3951957229e17714546226bd32749..95b915cc14b8f03728d477d4faea3d96e78527fb 100644 (file)
@@ -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;