Commit 0f8e8ef7 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Thomas Gleixner

clocksource: Simplify clocksource watchdog resume logic

To resume the clocksource watchdog just remove the CLOCK_SOURCE_WATCHDOG
bit from the watched clocksource.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: default avatarJohn Stultz <johnstul@us.ibm.com>
Cc: Daniel Walker <dwalker@fifo99.com>
LKML-Reference: <20090814134808.880925790@de.ibm.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 8cf4e750
...@@ -145,7 +145,6 @@ static struct clocksource *watchdog; ...@@ -145,7 +145,6 @@ static struct clocksource *watchdog;
static struct timer_list watchdog_timer; static struct timer_list watchdog_timer;
static DEFINE_SPINLOCK(watchdog_lock); static DEFINE_SPINLOCK(watchdog_lock);
static cycle_t watchdog_last; static cycle_t watchdog_last;
static unsigned long watchdog_resumed;
/* /*
* Interval: 0.5sec Threshold: 0.0625s * Interval: 0.5sec Threshold: 0.0625s
...@@ -167,12 +166,9 @@ static void clocksource_watchdog(unsigned long data) ...@@ -167,12 +166,9 @@ static void clocksource_watchdog(unsigned long data)
struct clocksource *cs, *tmp; struct clocksource *cs, *tmp;
cycle_t csnow, wdnow; cycle_t csnow, wdnow;
int64_t wd_nsec, cs_nsec; int64_t wd_nsec, cs_nsec;
int resumed;
spin_lock(&watchdog_lock); spin_lock(&watchdog_lock);
resumed = test_and_clear_bit(0, &watchdog_resumed);
wdnow = watchdog->read(watchdog); wdnow = watchdog->read(watchdog);
wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask); wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask);
watchdog_last = wdnow; watchdog_last = wdnow;
...@@ -223,14 +219,26 @@ static void clocksource_watchdog(unsigned long data) ...@@ -223,14 +219,26 @@ static void clocksource_watchdog(unsigned long data)
} }
spin_unlock(&watchdog_lock); spin_unlock(&watchdog_lock);
} }
static inline void clocksource_reset_watchdog(void)
{
struct clocksource *cs;
list_for_each_entry(cs, &watchdog_list, wd_list)
cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
}
static void clocksource_resume_watchdog(void) static void clocksource_resume_watchdog(void)
{ {
set_bit(0, &watchdog_resumed); unsigned long flags;
spin_lock_irqsave(&watchdog_lock, flags);
clocksource_reset_watchdog();
spin_unlock_irqrestore(&watchdog_lock, flags);
} }
static void clocksource_check_watchdog(struct clocksource *cs) static void clocksource_check_watchdog(struct clocksource *cs)
{ {
struct clocksource *cse;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&watchdog_lock, flags); spin_lock_irqsave(&watchdog_lock, flags);
...@@ -256,8 +264,7 @@ static void clocksource_check_watchdog(struct clocksource *cs) ...@@ -256,8 +264,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
watchdog_timer.function = clocksource_watchdog; watchdog_timer.function = clocksource_watchdog;
/* Reset watchdog cycles */ /* Reset watchdog cycles */
list_for_each_entry(cse, &watchdog_list, wd_list) clocksource_reset_watchdog();
cse->flags &= ~CLOCK_SOURCE_WATCHDOG;
/* Start if list is not empty */ /* Start if list is not empty */
if (!list_empty(&watchdog_list)) { if (!list_empty(&watchdog_list)) {
watchdog_last = watchdog->read(watchdog); watchdog_last = watchdog->read(watchdog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment