diff options
Diffstat (limited to 'kernel/time/clocksource.c')
| -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 bd246660902..1f663d23e85 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -343,7 +343,19 @@ static void clocksource_resume_watchdog(void) | |||
| 343 | { | 343 | { |
| 344 | unsigned long flags; | 344 | unsigned long flags; |
| 345 | 345 | ||
| 346 | spin_lock_irqsave(&watchdog_lock, flags); | 346 | /* |
| 347 | * We use trylock here to avoid a potential dead lock when | ||
| 348 | * kgdb calls this code after the kernel has been stopped with | ||
| 349 | * watchdog_lock held. When watchdog_lock is held we just | ||
| 350 | * return and accept, that the watchdog might trigger and mark | ||
| 351 | * the monitored clock source (usually TSC) unstable. | ||
| 352 | * | ||
| 353 | * This does not affect the other caller clocksource_resume() | ||
| 354 | * because at this point the kernel is UP, interrupts are | ||
| 355 | * disabled and nothing can hold watchdog_lock. | ||
| 356 | */ | ||
| 357 | if (!spin_trylock_irqsave(&watchdog_lock, flags)) | ||
| 358 | return; | ||
| 347 | clocksource_reset_watchdog(); | 359 | clocksource_reset_watchdog(); |
| 348 | spin_unlock_irqrestore(&watchdog_lock, flags); | 360 | spin_unlock_irqrestore(&watchdog_lock, flags); |
| 349 | } | 361 | } |
| @@ -470,8 +482,8 @@ void clocksource_resume(void) | |||
| 470 | * clocksource_touch_watchdog - Update watchdog | 482 | * clocksource_touch_watchdog - Update watchdog |
| 471 | * | 483 | * |
| 472 | * Update the watchdog after exception contexts such as kgdb so as not | 484 | * Update the watchdog after exception contexts such as kgdb so as not |
| 473 | * to incorrectly trip the watchdog. | 485 | * to incorrectly trip the watchdog. This might fail when the kernel |
| 474 | * | 486 | * was stopped in code which holds watchdog_lock. |
| 475 | */ | 487 | */ |
| 476 | void clocksource_touch_watchdog(void) | 488 | void clocksource_touch_watchdog(void) |
| 477 | { | 489 | { |
