提交 8f89441b 编写于 作者: T Thomas Gleixner 提交者: Linus Torvalds

clocksource: fix lock order in the resume path

lockdep complains about the lock nesting of clocksource and watchdog lock
in the resume path.

Change the resume marker to a bit operation and remove the lock from this
path.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3c46bdca
...@@ -74,7 +74,7 @@ static struct clocksource *watchdog; ...@@ -74,7 +74,7 @@ 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 int watchdog_resumed; static unsigned long watchdog_resumed;
/* /*
* Interval: 0.5sec Threshold: 0.0625s * Interval: 0.5sec Threshold: 0.0625s
...@@ -104,9 +104,7 @@ static void clocksource_watchdog(unsigned long data) ...@@ -104,9 +104,7 @@ static void clocksource_watchdog(unsigned long data)
spin_lock(&watchdog_lock); spin_lock(&watchdog_lock);
resumed = watchdog_resumed; resumed = test_and_clear_bit(0, &watchdog_resumed);
if (unlikely(resumed))
watchdog_resumed = 0;
wdnow = watchdog->read(); wdnow = watchdog->read();
wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask); wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask);
...@@ -151,9 +149,7 @@ static void clocksource_watchdog(unsigned long data) ...@@ -151,9 +149,7 @@ static void clocksource_watchdog(unsigned long data)
} }
static void clocksource_resume_watchdog(void) static void clocksource_resume_watchdog(void)
{ {
spin_lock(&watchdog_lock); set_bit(0, &watchdog_resumed);
watchdog_resumed = 1;
spin_unlock(&watchdog_lock);
} }
static void clocksource_check_watchdog(struct clocksource *cs) static void clocksource_check_watchdog(struct clocksource *cs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册