Re: 2.6.14-rc4-rt7

From: Rui Nuno Capela
Date: Thu Oct 27 2005 - 18:18:56 EST


Steven Rostedt wrote:
On Thu, 2005-10-27 at 09:01 +0100, Rui Nuno Capela wrote:


Don't really know if its consistent, but it does occur on several times, on only on boot.


Rui,

Have you tried the last patch that I sent John? It may just be a race
condition in the checking that causes a false positive. My last patch
fixes that.

-- Steve


So far so good.

Tks.
--
rncbc aka Rui Nuno Capela
rncbc@xxxxxxxxx
--- linux-2.6.14-rc5-rt7.0/kernel/time/timeofday.c 2005-10-26 16:57:03.000000000 -0400
+++ linux-2.6.14-rc5-rt7.1/kernel/time/timeofday.c 2005-10-26 22:10:32.000000000 -0400
@@ -232,6 +232,12 @@
unsigned long seq;
ktime_t prev, now;
nsec_t mc, prev_st, curr_st;
+ unsigned long flags;
+
+ raw_local_irq_save(flags);
+ prev = per_cpu(prev_mono_time, cpu);
+ prev_st = per_cpu(prev_system_time, cpu);
+ raw_local_irq_restore(flags);

/* atomically read __get_monotonic_clock_ns() */
do {
@@ -242,11 +248,7 @@
} while (read_seqretry(&system_time_lock, seq));

ns_to_timespec(ts, mc);
-
now = timespec_to_ktime(*ts);
- prev = per_cpu(prev_mono_time, cpu);
-
- prev_st = per_cpu(prev_system_time, cpu);
curr_st = system_time;

if (ktime_cmp(now, <, prev)) {
@@ -264,8 +266,12 @@
ktime_to_timespec(ts, prev);
return;
}
+
+ raw_local_irq_save(flags);
per_cpu(prev_mono_time, cpu) = now;
per_cpu(prev_system_time, cpu) = system_time;
+ raw_local_irq_restore(flags);
+
put_cpu();
}