KGDB: Add clocksource_touch_watchdog
PATCH 2/21 KGDB: Add clocksource_touch_watchdog
Signed-off-by Jason Wessel <[email protected]>
clocksource_watchdog.patch
From: Jason Wessel <[email protected]>
CC: [email protected]
Subject: [PATCH] Add clocksource_touch_watchdog
Add a call to the clocksource watchdog API for touching the watchdog such that the watchdog does not trip on a context resume from a kernel debugger.
Add in the hooks to KGDB to make use of the API.
Original implementation by Konstantin Baydarov <[email protected]>
Signed-off-by Konstantin Baydarov <[email protected]>
Signed-off-by Jason Wessel <[email protected]>
--- include/linux/clocksource.h | 1 + kernel/kgdb.c | 4 ++++ kernel/time/clocksource.c | 12 ++++++++++++ 3 files changed, 17 insertions(+)
include/linux/clocksource.h +1 -0
@@ -218,6 +218,7 @@ extern int clocksource_register(struct cextern struct clocksource *clocksource_get_next (void );extern void clocksource_change_rating (struct clocksource *cs,int rating);extern void clocksource_resume (void ); +extern void clocksource_touch_watchdog (void );#ifdef CONFIG_GENERIC_TIME_VSYSCALL extern void update_vsyscall (struct timespec *ts,struct clocksource *c);
kernel/kgdb.c +4 -0
@@ -51,6 +51,7 @@#include <linux/sched.h> #include <linux/pid_namespace.h> #include <asm/byteorder.h> +#include <linux/clocksource.h> extern int pid_max;/* How many times to count all of the waiting CPUs */
@@ -662,6 +663,7 @@ static void kgdb_wait(struct pt_regs *re/* Signal the master processor that we are done */ atomic_set (&procindebug[processor],0 );spin_unlock (&slavecpulocks[processor]); +clocksource_touch_watchdog (); local_irq_restore(flags); }#endif
@@ -1002,6 +1004,7 @@ int kgdb_handle_exception(int ex_vector, atomic_read(&cpu_doing_single_step) != procid) {atomic_set (&debugger_active,0 );atomic_set (&kgdb_sync,-1 ); +clocksource_touch_watchdog ();local_irq_restore (flags); goto acquirelock; }
@@ -1549,6 +1552,7 @@ default_handle:/* Free debugger_active */ atomic_set (&debugger_active,0 );atomic_set (&kgdb_sync,-1 ); +clocksource_touch_watchdog ();local_irq_restore (flags);return error;
kernel/time/clocksource.c +12 -0
@@ -226,6 +226,18 @@ 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. +* +*/ +void clocksource_touch_watchdog (void ) +{ +clocksource_resume_watchdog (); +} + +/** * clocksource_get_next - Returns the selected clocksource * */