diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-01 10:44:06 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-01 10:44:06 -0800 |
commit | bdd846678387d1313f689c9d341bd9743c9aa451 (patch) | |
tree | 312585e17b3fbf2f334f892db1a487e1716ae6ab | |
parent | 935cc9323ac33bb9b6cb853815e5c86f77e50607 (diff) | |
parent | 7b7422a566aa0dc1e582ce263d4c7ff4a772700a (diff) | |
download | linux-3.10-bdd846678387d1313f689c9d341bd9743c9aa451.tar.gz linux-3.10-bdd846678387d1313f689c9d341bd9743c9aa451.tar.bz2 linux-3.10-bdd846678387d1313f689c9d341bd9743c9aa451.zip |
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
clocksource: Prevent potential kgdb dead lock
-rw-r--r-- | kernel/time/clocksource.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index e85c23404d3..13700833c18 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -343,7 +343,19 @@ static void clocksource_resume_watchdog(void) { unsigned long flags; - spin_lock_irqsave(&watchdog_lock, flags); + /* + * We use trylock here to avoid a potential dead lock when + * kgdb calls this code after the kernel has been stopped with + * watchdog_lock held. When watchdog_lock is held we just + * return and accept, that the watchdog might trigger and mark + * the monitored clock source (usually TSC) unstable. + * + * This does not affect the other caller clocksource_resume() + * because at this point the kernel is UP, interrupts are + * disabled and nothing can hold watchdog_lock. + */ + if (!spin_trylock_irqsave(&watchdog_lock, flags)) + return; clocksource_reset_watchdog(); spin_unlock_irqrestore(&watchdog_lock, flags); } @@ -458,8 +470,8 @@ void clocksource_resume(void) * clocksource_touch_watchdog - Update watchdog * * Update the watchdog after exception contexts such as kgdb so as not - * to incorrectly trip the watchdog. - * + * to incorrectly trip the watchdog. This might fail when the kernel + * was stopped in code which holds watchdog_lock. */ void clocksource_touch_watchdog(void) { |