[PATCH 2.6.25-rc6 resubmit] Add a "show workqueues" SYSRQ knob.

Previous thread: vfree with spin_lock_bh by Jan Engelhardt on Monday, March 17, 2008 - 4:30 pm. (2 messages)

Next thread: ACPI regression in 2.6.25-rc6 (function keys stop working) by Guillaume Chazarain on Monday, March 17, 2008 - 5:13 pm. (10 messages)
From: Frank Mayhar
Date: Monday, March 17, 2008 - 4:50 pm

Per Randy, I've added an update to Documentation/sysrq.txt and am
resubmitting the patch in the proper style.

This patch adds a convenient function to show all workqueues using the
magic SYSRQ handling.  It uses the 'z' key to invoke the function as the
'w' key was already gone.

I've found this very useful in debugging; hopefully others will find it
as useful.

diffstat wq.patch 
 drivers/char/sysrq.c      |   14 +++++++++++++-
 include/linux/workqueue.h |    1 +
 kernel/workqueue.c        |   26 ++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

Signed-off-by:  Frank Mayhar <fmayhar@google.com>


diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 10c8f69..bc5d6cc 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -110,6 +110,8 @@ On all -  write a character to /proc/sysrq-trigger.  e.g.:
 
 'x'	- Used by xmon interface on ppc/powerpc platforms.
 
+'z'	- Will dump the contents of the workqueues by workqueue and CPU.
+
 '0'-'9' - Sets the console log level, controlling which kernel messages
           will be printed to your console. ('0', for example would make
           it so that only emergency messages like PANICs or OOPSes would
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index de60e1e..733d625 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -243,6 +243,18 @@ static struct sysrq_key_op sysrq_showmem_op = {
 	.enable_mask	= SYSRQ_ENABLE_DUMP,
 };
 
+static void sysrq_handle_showwq(int key, struct pt_regs *pt_regs,
+				   struct tty_struct *tty)
+{
+	show_workqueues();
+}
+static struct sysrq_key_op sysrq_showwq_op = {
+	.handler	= sysrq_handle_showwq,
+	.help_msg	= "showworkqueueZ",
+	.action_msg	= "Show Workqueues",
+	.enable_mask	= SYSRQ_ENABLE_DUMP,
+};
+
 /*
  * Signal sysrq helper function.  Sends a signal to all user processes.
  */
@@ -358,7 +370,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
 	/* x: May be registered on ppc/powerpc for ...
Previous thread: vfree with spin_lock_bh by Jan Engelhardt on Monday, March 17, 2008 - 4:30 pm. (2 messages)

Next thread: ACPI regression in 2.6.25-rc6 (function keys stop working) by Guillaume Chazarain on Monday, March 17, 2008 - 5:13 pm. (10 messages)