mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Owens <kaos@sgi.com>
To: Joel Becker <joel.becker@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: [patch 2.4.12-rc4] Add skip_hangcheck_timer()
Date: Sun, 08 May 2005 13:56:44 +1000	[thread overview]
Message-ID: <1679.1115524604@ocs3.ocs.com.au> (raw)

There are at least two cases where the existing hangcheck
code falls down :-

(1) Some kernel events such as dumping or debugging will legitimately
    disable interrupts for long periods.  Restarting after these events
    must ignore the hangcheck.

(2) During hotplug cpu changes, the hangcheck timer can move from one
    cpu to another, see migrate_timers().  There is no guarantee that
    the clock on the new cpu is in sync with the old clock so hangcheck
    may trip with a spurious error.

Like the NMI watchdog, hangcheck-timer needs a facility to ignore the
timeout for special cases.  Add touch_hangcheck_timer().

Signed-off-by: Keith Owens <kaos@sgi.com>

Index: linux/include/linux/hangcheck.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux/include/linux/hangcheck.h	2005-05-08 12:50:00.407071808 +1000
@@ -0,0 +1,17 @@
+#ifndef LINUX_HANGCHECK_H
+#define LINUX_HANGCHECK_H
+
+/**
+ * touch_hangcheck_timer - restart HANGCHECK timer timeout.
+ *
+ * If the kernel supports the HANGCHECK code, touch_hangcheck_timer() may be
+ * used to reset the timeout - for code which intentionally disables interrupts
+ * for a long time. This call is stateless.
+ */
+#ifdef CONFIG_HANGCHECK_TIMER
+extern void touch_hangcheck_timer(void);
+#else
+#define touch_hangcheck_timer() do { } while(0)
+#endif
+
+#endif
Index: linux/drivers/char/hangcheck-timer.c
===================================================================
--- linux.orig/drivers/char/hangcheck-timer.c	2005-05-08 12:47:19.785980026 +1000
+++ linux/drivers/char/hangcheck-timer.c	2005-05-08 13:18:44.928535058 +1000
@@ -143,6 +143,14 @@ static inline unsigned long long monoton
 }
 #endif  /* HAVE_MONOTONIC */
 
+/* Allow single shot ignore of the timer check */
+static int skip_hangcheck_timer;
+
+void touch_hangcheck_timer(void)
+{
+	skip_hangcheck_timer = 1;
+}
+EXPORT_SYMBOL(touch_hangcheck_timer);
 
 /* Last time scheduled */
 static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
@@ -164,6 +172,11 @@ static void hangcheck_fire(unsigned long
 	else
 		tsc_diff = (cur_tsc + (~0ULL - hangcheck_tsc)); /* or something */
 
+	if (skip_hangcheck_timer) {
+		skip_hangcheck_timer = 0;
+		tsc_diff = 0;
+	}
+
 	if (tsc_diff > hangcheck_tsc_margin) {
 		if (hangcheck_dump_tasks) {
 			printk(KERN_CRIT "Hangcheck: Task state:\n");


             reply	other threads:[~2005-05-08  3:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-08  3:56 Keith Owens [this message]
2005-05-20  3:35 Keith Owens

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=1679.1115524604@ocs3.ocs.com.au \
    --to=kaos@sgi.com \
    --cc=joel.becker@oracle.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

Powered by JetHome