All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tina.yang" <tina.yang@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Kosina <jkosina@suse.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysrq: add debug message to reboot event
Date: Wed, 19 Aug 2009 19:22:16 -0700	[thread overview]
Message-ID: <4A8CB358.4090001@oracle.com> (raw)
In-Reply-To: <20090819135827.168621d8.akpm@linux-foundation.org>

Add debug message to detect keyboard vs non-keyboard triggered sysrq-b events.
This is to assist postmortem debugging on complicated computing setup with
large number of applications involved where reboot event had occurred, but 
unclear of its origin.

Signed-off-by: Tina Yang <Tina.Yang@oracle.com>
Signed-off-by: Zach Brown <Zach.Brown@oracle.com>

---

--- linux-2.6.18.i686/drivers/char/sysrq.c.orig	2009-08-13 10:55:57.526459000 -0700
+++ linux-2.6.18.i686/drivers/char/sysrq.c	2009-08-13 10:58:10.798739000 -0700
@@ -112,18 +112,23 @@ static struct sysrq_key_op sysrq_crashdu
 	.enable_mask	= SYSRQ_ENABLE_DUMP,
 };
 
-static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs,
+static void sysrq_handle_reboot(int check_mask, int key, struct pt_regs *pt_regs,
 				struct tty_struct *tty)
 {
+	if (check_mask)
+		printk("<keyboard-invoked>\n");
+	else
+		printk("<non-keyboard-invoked: PID %d COMMAND %s>\n",
+			current->pid, current->comm);
 	lockdep_off();
 	local_irq_enable();
 	emergency_restart();
 }
 static struct sysrq_key_op sysrq_reboot_op = {
-	.handler	= sysrq_handle_reboot,
-	.help_msg	= "reBoot",
-	.action_msg	= "Resetting",
-	.enable_mask	= SYSRQ_ENABLE_BOOT,
+	.handler_with_mask	= sysrq_handle_reboot,
+	.help_msg		= "reBoot",
+	.action_msg		= "Resetting",
+	.enable_mask		= SYSRQ_ENABLE_BOOT,
 };
 
 static void sysrq_handle_sync(int key, struct pt_regs *pt_regs,
@@ -411,7 +416,10 @@ void __handle_sysrq(int key, struct pt_r
 			}
 			printk("%s\n", op_p->action_msg);
 			console_loglevel = orig_log_level;
-			op_p->handler(key, pt_regs, tty);
+			if (op_p->handler_with_mask)
+				op_p->handler_with_mask(check_mask, key, pt_regs, tty);
+			else
+				op_p->handler(key, pt_regs, tty);
 		} else {
 			printk("This sysrq operation is disabled.\n");
 		}
--- linux-2.6.18.i686/include/linux/sysrq.h.orig	2009-08-13 10:58:29.779925000 -0700
+++ linux-2.6.18.i686/include/linux/sysrq.h	2009-08-13 11:05:30.723865000 -0700
@@ -28,6 +28,7 @@ struct tty_struct;
 
 struct sysrq_key_op {
 	void (*handler)(int, struct pt_regs *, struct tty_struct *);
+	void (*handler_with_mask)(int check_mask, int, struct pt_regs *, struct tty_struct *);
 	char *help_msg;
 	char *action_msg;
 	int enable_mask;


Andrew Morton wrote:
>
> The changelog had no description of why the change should be applied
> and I was unable to understand the motivation from reading the patch,
> so I skipped it.
>
> Also the patch was wordwrapped and had all its tabs replaced by spaces.
>   


  reply	other threads:[~2009-08-20  2:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 19:16 [PATCH] sysrq: add debug message to reboot event tina.yang
2009-08-18 11:40 ` Jiri Kosina
2009-08-19 20:58   ` Andrew Morton
2009-08-20  2:22     ` tina.yang [this message]
2009-08-20 22:10       ` Andrew Morton
2009-08-21  5:14         ` tina.yang

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=4A8CB358.4090001@oracle.com \
    --to=tina.yang@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jkosina@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.