[Kgdb-bugreport] 276014

2007-08-07 Thread olly Blackport
1d6AEf6F
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport


Re: [Kgdb-bugreport] [PATCH] fix of unnecessary clocksource change

2007-08-07 Thread Jason Wessel
Konstantin Baydarov wrote:
 Hi,
 Here is the problem that I've faced:
 When kernel leaves KGDB, kernel considers current clocksource as unstable and
 changes it. Here is log:

 [EMAIL PROTECTED]:~# Clocksource tsc unstable (delta = 9373898438 ns)
 Time: acpi_pm clocksource has been installed.

 [EMAIL PROTECTED]:~#

 Patch fixes it by calling clocksource_resume_watchdog() everytime KGDB 
 reenable interrupts.

 Signed-off-by: Konstantin Baydarov [EMAIL PROTECTED]
   

Greetings Konstantin,

The patch you provided works nicely to solve the problem. In this case I 
think it would be best to add to the clocksource watchdog API.

I slightly changed your patch, and wanted to see if that is ok by you. 
If so, I'll go ahead and merge it and submit it upstream as well. The 
change is to add in a global call for clocksource_touch_watchdog(). That 
way the implementation can be changed over time if needed as it 
specifically relates to a debugger or other kernel tool that needs to 
touch the state of the watchdog.

Thanks,
Jason.

I can send you the patch directly if you like, as I am reasonably 
certain tabs will be eaten, but do not worry because they are most 
certainly in the copy that will be checked into cvs.

new patch
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(+)

Index: linux-2.6.21-standard/include/linux/clocksource.h
===
--- linux-2.6.21-standard.orig/include/linux/clocksource.h
+++ linux-2.6.21-standard/include/linux/clocksource.h
@@ -201,6 +201,7 @@ extern int clocksource_register(struct c
extern 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);
Index: linux-2.6.21-standard/kernel/kgdb.c
===
--- linux-2.6.21-standard.orig/kernel/kgdb.c
+++ linux-2.6.21-standard/kernel/kgdb.c
@@ -52,6 +52,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 */
@@ -648,6 +649,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
@@ -955,6 +957,7 @@ int kgdb_handle_exception(int ex_vector,
if (atomic_read(cpu_doing_single_step) != -1 
atomic_read(cpu_doing_single_step) != procid) {
atomic_set(debugger_active, 0);
+ clocksource_touch_watchdog();
local_irq_restore(flags);
goto acquirelock;
}
@@ -1490,6 +1493,7 @@ int kgdb_handle_exception(int ex_vector,
kgdb_restore:
/* Free debugger_active */
atomic_set(debugger_active, 0);
+ clocksource_touch_watchdog();
local_irq_restore(flags);

return error;
Index: linux-2.6.21-standard/kernel/time/clocksource.c
===
--- linux-2.6.21-standard.orig/kernel/time/clocksource.c
+++ linux-2.6.21-standard/kernel/time/clocksource.c
@@ -152,6 +152,18 @@ static void clocksource_resume_watchdog(
set_bit(0, watchdog_resumed);
}

+/**
+ * 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();
+}
+
static void clocksource_check_watchdog(struct clocksource *cs)
{
struct clocksource *cse;


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport