Re: alpha 2.4.13: cycle detection sanity checks

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Fri Oct 26 2001 - 05:14:10 EST


On Fri, Oct 26, 2001 at 01:41:33AM -0700, Richard Henderson wrote:
> The following adds some knowledge about what sort of hardware
> actually exists, so that we can determine that the computed
> value is completely out of line.

Ouch, we've forgotten one important thing. Due to frequency deviation
of the reference generator actual clock speed, say, 599.8 MHz of the
600 MHz CPU would be perfectly valid. However, validate_cc_value()
would fail in this case for no reason.
The 10 MHz is more than enough to cover this.
Patch applies on the top of Richard's one.

Ivan.

--- linux/arch/alpha/kernel/time.c.orig Fri Oct 26 13:56:32 2001
+++ linux/arch/alpha/kernel/time.c Fri Oct 26 13:58:54 2001
@@ -176,6 +176,8 @@ common_init_rtc(void)
 
    Return 0 if the result cannot be trusted, otherwise return the argument. */
 
+#define FREQ_DEVIATION 10000000
+
 static unsigned long __init
 validate_cc_value(unsigned long cc)
 {
@@ -206,7 +208,8 @@ validate_cc_value(unsigned long cc)
         if (index >= sizeof(cpu_hz)/sizeof(cpu_hz[0]))
                 return cc;
 
- if (cc < cpu_hz[index].min || cc > cpu_hz[index].max)
+ if (cc < (cpu_hz[index].min - FREQ_DEVIATION)
+ || cc > (cpu_hz[index].max + FREQ_DEVIATION)
                 return 0;
 
         return cc;
-
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/



This archive was generated by hypermail 2b29 : Wed Oct 31 2001 - 21:00:30 EST