public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 3/21] KGDB: Soft lockup fixes to kgdb core
Date: Mon, 15 Oct 2007 13:32:42 -0500	[thread overview]
Message-ID: <4713B24A.9050700@windriver.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 57 bytes --]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

[-- Attachment #2: softlockup.patch --]
[-- Type: text/x-patch, Size: 2828 bytes --]

softlockup.patch

From: Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH] Soft lockup fixes to kgdb core

Modify the softlockup code not to trap when the debugger exits after
having had the system running with the interrupts off for more than
the number of cycles that trip the softlockup detection.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

---
 include/linux/kgdb.h |    1 +
 kernel/kgdb.c        |    4 ++++
 kernel/softlockup.c  |    9 +++++++++
 3 files changed, 14 insertions(+)

--- linux-2.6-kgdb.orig/include/linux/kgdb.h
+++ linux-2.6-kgdb/include/linux/kgdb.h
@@ -45,6 +45,7 @@ extern struct tasklet_struct kgdb_taskle
 
 extern atomic_t kgdb_setting_breakpoint;
 extern atomic_t cpu_doing_single_step;
+extern int kgdb_softlock_skip[NR_CPUS];
 
 extern struct task_struct *kgdb_usethread, *kgdb_contthread;
 
--- linux-2.6-kgdb.orig/kernel/kgdb.c
+++ linux-2.6-kgdb/kernel/kgdb.c
@@ -136,6 +136,7 @@ struct debuggerinfo_struct {
 
 /* to keep track of the CPU which is doing the single stepping*/
 atomic_t cpu_doing_single_step = ATOMIC_INIT(-1);
+int kgdb_softlock_skip[NR_CPUS];
 
 /* reboot notifier block */
 static struct notifier_block kgdb_reboot_notifier = {
@@ -664,6 +665,7 @@ static void kgdb_wait(struct pt_regs *re
 	atomic_set(&procindebug[processor], 0);
 	spin_unlock(&slavecpulocks[processor]);
 	clocksource_touch_watchdog();
+	kgdb_softlock_skip[processor] = 1;
 	local_irq_restore(flags);
 }
 #endif
@@ -1005,6 +1007,7 @@ int kgdb_handle_exception(int ex_vector,
 		atomic_set(&debugger_active, 0);
 		atomic_set(&kgdb_sync, -1);
 		clocksource_touch_watchdog();
+		kgdb_softlock_skip[procid] = 1;
 		local_irq_restore(flags);
 		goto acquirelock;
 	}
@@ -1553,6 +1556,7 @@ default_handle:
 	atomic_set(&debugger_active, 0);
 	atomic_set(&kgdb_sync, -1);
 	clocksource_touch_watchdog();
+	kgdb_softlock_skip[processor] = 1;
 	local_irq_restore(flags);
 
 	return error;
--- linux-2.6-kgdb.orig/kernel/softlockup.c
+++ linux-2.6-kgdb/kernel/softlockup.c
@@ -14,6 +14,7 @@
 #include <linux/kthread.h>
 #include <linux/notifier.h>
 #include <linux/module.h>
+#include <linux/kgdb.h>
 
 static DEFINE_SPINLOCK(print_lock);
 
@@ -47,6 +48,10 @@ static unsigned long get_timestamp(void)
 
 void touch_softlockup_watchdog(void)
 {
+#ifdef CONFIG_KGDB
+	if (unlikely(kgdb_softlock_skip[smp_processor_id()]))
+		kgdb_softlock_skip[smp_processor_id()] = 0;
+#endif
 	__raw_get_cpu_var(touch_timestamp) = get_timestamp();
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
@@ -99,6 +104,10 @@ void softlockup_tick(void)
 
 	/* Warn about unreasonable 10+ seconds delays: */
 	if (now > (touch_timestamp + 10)) {
+#ifdef CONFIG_KGDB
+		if (unlikely(kgdb_softlock_skip[this_cpu]))
+			return;
+#endif
 		per_cpu(print_timestamp, this_cpu) = touch_timestamp;
 
 		spin_lock(&print_lock);

                 reply	other threads:[~2007-10-15 18:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4713B24A.9050700@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox