Messages in this thread Patches in this message | | | Date | Tue, 6 Jan 2004 18:11:57 +0100 (CET) | From | Tim Schmielau <> | Subject | Re: [PATCH] fix get_jiffies_64 to work on voyager |
| |
On Tue, 6 Jan 2004, Linus Torvalds wrote:
> Augh. If you cast it to "unsigned long long" anyway, why not just use the > right value? It's "jiffies_64".
Lessons in straight thinking...
We then need to make jiffies_64 volatile, since we violate the rule to never read it.
Tim
--- linux-2.6.1-rc1/arch/i386/kernel/timers/timer_tsc.c 2003-12-31 14:21:19.000000000 +0100 +++ linux-2.6.1-rc1-j64/arch/i386/kernel/timers/timer_tsc.c 2004-01-06 18:05:24.000000000 +0100 @@ -140,7 +140,8 @@ #ifndef CONFIG_NUMA if (!use_tsc) #endif - return (unsigned long long)get_jiffies_64() * (1000000000 / HZ); + /* no locking but a rare wrong value is not a big deal */ + return (unsigned long long)jiffies_64 * (1000000000 / HZ); /* Read the Time Stamp Counter */ rdtscll(this_offset); --- linux-2.6.1-rc1/include/linux/jiffies.h 2003-12-31 14:22:05.000000000 +0100 +++ linux-2.6.1-rc1-j64/include/linux/jiffies.h 2004-01-06 17:56:15.000000000 +0100 @@ -9,11 +9,11 @@ #include <asm/param.h> /* for HZ */ /* - * The 64-bit value is not volatile - you MUST NOT read it - * without sampling the sequence number in xtime_lock. + * NEVER EVER read jiffies_64 without sampling the sequence number + * in xtime_lock. * get_jiffies_64() will do this for you as appropriate. */ -extern u64 jiffies_64; +extern u64 volatile jiffies_64; extern unsigned long volatile jiffies; #if (BITS_PER_LONG < 64) @@ -21,7 +21,7 @@ #else static inline u64 get_jiffies_64(void) { - return (u64)jiffies; + return jiffies_64; } #endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |