public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: ZAK Magnus <zakmagnus@google.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Mandeep Singh Baines <msb@chromium.org>
Subject: Re: [PATCH v3 2/2] Make hard lockup detection use timestamps
Date: Mon, 1 Aug 2011 15:24:07 -0400	[thread overview]
Message-ID: <20110801192407.GE2581@redhat.com> (raw)
In-Reply-To: <CAAuSN92UAjuJXprBAj9z0sekk=iBWGe3PP88z8NmrZ5fExOyjg@mail.gmail.com>

On Mon, Aug 01, 2011 at 11:33:24AM -0700, ZAK Magnus wrote:
> Okay... So this is a problem we need to solve. Does there exist a good
> way to output a stack trace to, say, a file in /proc? I think that
> would be an appealing solution, if doable.

One idea I thought of to workaround this is to save the timestamp and the
watchdog bool and restore after the stack dump.  It's a cheap hack and I
am not to sure about the locking as it might race with
touch_nmi_watchdog().  But it gives you an idea what I was thinking.

Being in the nmi context, no one can normally touch these variables,
except for another cpu using touch_nmi_watchdog() (or watchdog_enable()
but that should never race in these scenarios).

Cheers,
Don

compile tested only.


diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 17bcded..2dcedb3 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -214,6 +214,9 @@ void touch_softlockup_watchdog_sync(void)
 static void update_hardstall(unsigned long stall, int this_cpu)
 {
 	int update_stall = 0;
+	int ts;
+	bool touched;
+
 	if (stall > hardstall_thresh &&
 			stall > worst_hardstall + hardstall_diff_thresh) {
 		unsigned long flags;
@@ -225,10 +228,14 @@ static void update_hardstall(unsigned long stall, int this_cpu)
 	}
 
 	if (update_stall) {
+		ts = __this_cpu_read(watchdog_touch_ts);
+		touched = __this_cpu_read(watchdog_nmi_touch);
 		printk(KERN_WARNING "LOCKUP may be in progress!"
 			"Worst hard stall seen on CPU#%d: %lums\n",
 			this_cpu, stall);
 		dump_stack();
+		__this_cpu_write(watchdog_touch_ts, ts);
+		__this_cpu_write(watchdog_nmi_touch, touched);
 	}
 }
 
@@ -262,6 +269,9 @@ static int is_hardlockup(int this_cpu)
 static void update_softstall(unsigned long stall, int this_cpu)
 {
 	int update_stall = 0;
+	int ts;
+	bool touched;
+
 	if (stall > get_softstall_thresh() &&
 			stall > worst_softstall + softstall_diff_thresh) {
 		unsigned long flags;
@@ -273,10 +283,14 @@ static void update_softstall(unsigned long stall, int this_cpu)
 	}
 
 	if (update_stall) {
+		ts = __this_cpu_read(watchdog_touch_ts);
+		touched = __this_cpu_read(watchdog_nmi_touch);
 		printk(KERN_WARNING "LOCKUP may be in progress!"
 				"Worst soft stall seen on CPU#%d: %lums\n",
 				this_cpu, stall);
 		dump_stack();
+		__this_cpu_write(watchdog_touch_ts, ts);
+		__this_cpu_write(watchdog_nmi_touch, touched);
 	}
 }
 

  reply	other threads:[~2011-08-01 19:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 18:11 [PATCH v3 2/2] Make hard lockup detection use timestamps Alex Neronskiy
2011-07-22 19:53 ` Don Zickus
2011-07-22 22:34   ` ZAK Magnus
2011-07-25 12:44     ` Don Zickus
2011-07-29  0:16       ` ZAK Magnus
2011-07-29 13:10         ` Don Zickus
2011-07-29 20:55         ` Don Zickus
2011-07-29 23:12           ` ZAK Magnus
2011-08-01 12:52             ` Don Zickus
2011-08-01 18:33               ` ZAK Magnus
2011-08-01 19:24                 ` Don Zickus [this message]
2011-08-01 20:11                   ` ZAK Magnus
2011-08-03 18:27                     ` ZAK Magnus
2011-08-03 19:44                       ` Don Zickus
2011-08-03 19:11                     ` Don Zickus

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=20110801192407.GE2581@redhat.com \
    --to=dzickus@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=msb@chromium.org \
    --cc=zakmagnus@google.com \
    /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