Commit 8f89441b37536fea92b1ed7004e5e2dda011473d
Committed by
Linus Torvalds
1 parent
3c46bdcaec
Exists in
master
and in
7 other branches
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: Thomas Gleixner <tglx@linutronix.de> Cc: john stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 3 additions and 7 deletions Side-by-side Diff
kernel/time/clocksource.c
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | static struct timer_list watchdog_timer; |
75 | 75 | static DEFINE_SPINLOCK(watchdog_lock); |
76 | 76 | static cycle_t watchdog_last; |
77 | -static int watchdog_resumed; | |
77 | +static unsigned long watchdog_resumed; | |
78 | 78 | |
79 | 79 | /* |
80 | 80 | * Interval: 0.5sec Threshold: 0.0625s |
... | ... | @@ -104,9 +104,7 @@ |
104 | 104 | |
105 | 105 | spin_lock(&watchdog_lock); |
106 | 106 | |
107 | - resumed = watchdog_resumed; | |
108 | - if (unlikely(resumed)) | |
109 | - watchdog_resumed = 0; | |
107 | + resumed = test_and_clear_bit(0, &watchdog_resumed); | |
110 | 108 | |
111 | 109 | wdnow = watchdog->read(); |
112 | 110 | wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask); |
... | ... | @@ -151,9 +149,7 @@ |
151 | 149 | } |
152 | 150 | static void clocksource_resume_watchdog(void) |
153 | 151 | { |
154 | - spin_lock(&watchdog_lock); | |
155 | - watchdog_resumed = 1; | |
156 | - spin_unlock(&watchdog_lock); | |
152 | + set_bit(0, &watchdog_resumed); | |
157 | 153 | } |
158 | 154 | |
159 | 155 | static void clocksource_check_watchdog(struct clocksource *cs) |