Skip to contentSkip to conversation

disconnect warp check from hrtimers

PATCH In review Daniel Walker 2 participants 5 messages Dec 27, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disconnect warp check from hrtimers

These calls were getting inconsistent wrt. the xtime_lock. The xtime_lock should be held when doing the warp check update, and interrupts should be off.

In some places the warp update was getting called twice, once under the xtime_lock then again right outside the xtime_lock.

---
 include/linux/hrtimer.h |    2 +-
 kernel/hrtimer.c        |    2 --
 kernel/time/ntp.c       |    2 ++
 kernel/timer.c          |    1 +
 4 files changed, 4 insertions(+), 3 deletions(-)
include/linux/hrtimer.h +1 -1
Index: linux-2.6.19/include/linux/hrtimer.h
===================================================================
@@ -262,7 +262,7 @@ static inline ktime_t hrtimer_cb_get_tim
  * is expired in the next softirq when the clock was advanced.
  * (we still call the warp-check debugging code)
  */
-static inline void clock_was_set(void) { warp_check_clock_was_changed(); }
+static inline void clock_was_set(void) { }
 static inline void hrtimer_clock_notify(void) { }
 
 /*
kernel/hrtimer.c +0 -2
Index: linux-2.6.19/kernel/hrtimer.c
===================================================================
@@ -452,8 +452,6 @@ static void retrigger_next_event(void *a
  */
 void clock_was_set(void)
 {
-	warp_check_clock_was_changed();
-
 	/* Retrigger the CPU local events everywhere */
 	on_each_cpu(retrigger_next_event, NULL, 0, 1);
 }
kernel/time/ntp.c +2 -0
Index: linux-2.6.19/kernel/time/ntp.c
===================================================================
@@ -116,6 +116,7 @@ void second_overflow(void)
 			 */
 			time_interpolator_update(-NSEC_PER_SEC);
 			time_state = TIME_OOP;
+			warp_check_clock_was_changed();
 			clock_was_set();
 			printk(KERN_NOTICE "Clock: inserting leap second "
 					"23:59:60 UTC\n");
@@ -131,6 +132,7 @@ void second_overflow(void)
 			 */
 			time_interpolator_update(NSEC_PER_SEC);
 			time_state = TIME_WAIT;
+			warp_check_clock_was_changed();
 			clock_was_set();
 			printk(KERN_NOTICE "Clock: deleting leap second "
 					"23:59:59 UTC\n");
kernel/timer.c +1 -0
Index: linux-2.6.19/kernel/timer.c
===================================================================
@@ -1162,6 +1162,7 @@ static int timekeeping_resume(struct sys
 	clock->cycle_last = clocksource_read(clock);
 	clock->error = 0;
 	timekeeping_suspended = 0;
+	warp_check_clock_was_changed();
 	write_sequnlock_irqrestore(&xtime_lock, flags);
 
 	hrtimer_notify_resume();

--

#1 lore raw
Quoted 3 lines · Daniel Walker

These calls were getting inconsistent wrt. the xtime_lock. The xtime_lock should be held when doing the warp check update, and interrupts should be off.

thanks, applied. Does this solve some warnings that you saw trigger?

Ingo

#2 lore raw
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Daniel Walker

These calls were getting inconsistent wrt. the xtime_lock. The xtime_lock should be held when doing the warp check update, and interrupts should be off.

thanks, applied. Does this solve some warnings that you saw trigger?

I saw some unexplained time warping while using the source at this url,

http://www.atnf.csiro.au/people/rgooch/benchmarks/linux-scheduler.html

it was on an older 2.6.18 based -rt .. The system would print the time warp warning, then hang .. I applied something similar to the patch I just sent, and the time warp warning was gone but the system still hung.

New -rt version don't hang, and I don't see the warning .. However, I suspect the time warp warning was a side effect of the hang..

The system hang was resolved by changing the irq threads to all prio 50 ..

Daniel

#3 lore raw
Quoted 2 lines · Daniel Walker

The system hang was resolved by changing the irq threads to all prio 50 ..

Guess I was wrong about this.. The hang was resolved, but I's not sure how yet ..

Daniel

#4 lore raw
Quoted 7 lines · Daniel Walker
Quoted 2 lines · Daniel Walker

The system hang was resolved by changing the irq threads to all prio 50 ..

Guess I was wrong about this.. The hang was resolved, but I's not sure how yet ..

Looks like it was the irq thread priority _and_ the softirq prio needed to be raised. softirq was at SCHED_FIFO 1 which caused the hang (or that's how it looks).

Daniel