Skip to content

Commit

Permalink
kgdb: clocksource watchdog
Browse files Browse the repository at this point in the history
In order to not trip the clocksource watchdog, kgdb must touch the
clocksource watchdog on the return to normal system run state.

Signed-off-by: Jason Wessel <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
jwessel authored and Ingo Molnar committed Apr 17, 2008
1 parent d359752 commit 7c3078b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/clocksource.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
/* used to install a new clocksource */
extern int clocksource_register(struct clocksource*);
extern void clocksource_unregister(struct clocksource*);
extern void clocksource_touch_watchdog(void);
extern struct clocksource* clocksource_get_next(void);
extern void clocksource_change_rating(struct clocksource *cs, int rating);
extern void clocksource_resume(void);
Expand Down
4 changes: 4 additions & 0 deletions kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* kind, whether express or implied.
*/
#include <linux/pid_namespace.h>
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/console.h>
Expand Down Expand Up @@ -574,6 +575,7 @@ static void kgdb_wait(struct pt_regs *regs)

/* Signal the primary CPU that we are done: */
atomic_set(&cpu_in_kgdb[cpu], 0);
clocksource_touch_watchdog();
local_irq_restore(flags);
}
#endif
Expand Down Expand Up @@ -1396,6 +1398,7 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)
atomic_read(&kgdb_cpu_doing_single_step) != cpu) {

atomic_set(&kgdb_active, -1);
clocksource_touch_watchdog();
local_irq_restore(flags);

goto acquirelock;
Expand Down Expand Up @@ -1487,6 +1490,7 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)
kgdb_restore:
/* Free kgdb_active */
atomic_set(&kgdb_active, -1);
clocksource_touch_watchdog();
local_irq_restore(flags);

return error;
Expand Down
12 changes: 12 additions & 0 deletions kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ void clocksource_resume(void)
spin_unlock_irqrestore(&clocksource_lock, flags);
}

/**
* clocksource_touch_watchdog - Update watchdog
*
* Update the watchdog after exception contexts such as kgdb so as not
* to incorrectly trip the watchdog.
*
*/
void clocksource_touch_watchdog(void)
{
clocksource_resume_watchdog();
}

/**
* clocksource_get_next - Returns the selected clocksource
*
Expand Down

0 comments on commit 7c3078b

Please sign in to comment.