rpms/kernel/F-8 linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch, NONE, 1.1 kernel.spec, 1.495, 1.496

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Fri Jul 18 16:53:12 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12368

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch 
Log Message:
* Fri Jul 18 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.11-56
- Add "show backtrace on all CPUs" (SysRq-l).


linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch:

--- NEW FILE linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch ---
From: Linux Kernel Mailing List <linux-kernel at vger.kernel.org>
To: git-commits-head at vger.kernel.org
Subject: sysrq: add show-backtrace-on-all-cpus function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Git-Commit: 5045bcae0fb466a1dbb6af0036e56901fd7aafb7
X-Git-Parent: 6e574195b75543bc6a6240306313988b1952470c
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.3
X-Spam-Checker-Version: 	SpamAssassin 3.2.3 (2007-08-08) on hera.kernel.org
Sender: git-commits-head-owner at vger.kernel.org
Precedence: bulk
List-ID: <git-commits-head.vger.kernel.org>
X-Mailing-List: 	git-commits-head at vger.kernel.org
X-RedHat-Spam-Score: -3.865 
X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254
X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5045bcae0fb466a1dbb6af0036e56901fd7aafb7
Commit:     5045bcae0fb466a1dbb6af0036e56901fd7aafb7
Parent:     6e574195b75543bc6a6240306313988b1952470c
Author:     Rik van Riel <riel at redhat.com>
AuthorDate: Tue Apr 29 00:59:21 2008 -0700
Committer:  Linus Torvalds <torvalds at linux-foundation.org>
CommitDate: Tue Apr 29 08:06:03 2008 -0700

    sysrq: add show-backtrace-on-all-cpus function
    
    SysRQ-P is not always useful on SMP systems, since it usually ends up showing
    the backtrace of a CPU that is doing just fine, instead of the backtrace of
    the CPU that is having problems.
    
    This patch adds SysRQ show-all-cpus(L), which shows the backtrace of every
    active CPU in the system.  It skips idle CPUs because some SMP systems are
    just too large and we already know what the backtrace of the idle task looks
    like.
    
    [akpm at linux-foundation.org: coding-style fixes]
    Signed-off-by: Rik van Riel <riel at redhat.com>
    Randy Dunlap <randy.dunlap at oracle.com>
    Cc: <lwoodman at redhat.com>
    Cc: Ingo Molnar <mingo at elte.hu>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 Documentation/sysrq.txt |    2 ++
 drivers/char/sysrq.c    |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 10c8f69..5ce0952 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -85,6 +85,8 @@ On all -  write a character to /proc/sysrq-trigger.  e.g.:
 'k'     - Secure Access Key (SAK) Kills all programs on the current virtual
           console. NOTE: See important comments below in SAK section.
 
+'l'     - Shows a stack backtrace for all active CPUs.
+
 'm'     - Will dump current memory info to your console.
 
 'n'	- Used to make RT tasks nice-able
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 1ade193..9e9bad8 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -196,6 +196,48 @@ static struct sysrq_key_op sysrq_showlocks_op = {
 #define sysrq_showlocks_op (*(struct sysrq_key_op *)0)
 #endif
 
+#ifdef CONFIG_SMP
+static DEFINE_SPINLOCK(show_lock);
+
+static void showacpu(void *dummy)
+{
+	unsigned long flags;
+
+	/* Idle CPUs have no interesting backtrace. */
+	if (idle_cpu(smp_processor_id()))
+		return;
+
+	spin_lock_irqsave(&show_lock, flags);
+	printk(KERN_INFO "CPU%d:\n", smp_processor_id());
+	show_stack(NULL, NULL);
+	spin_unlock_irqrestore(&show_lock, flags);
+}
+
+static void sysrq_showregs_othercpus(struct work_struct *dummy)
+{
+	smp_call_function(showacpu, NULL, 0, 0);
+}
+
+static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
+
+static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
+{
+	struct pt_regs *regs = get_irq_regs();
+	if (regs) {
+		printk(KERN_INFO "CPU%d:\n", smp_processor_id());
+		show_regs(regs);
+	}
+	schedule_work(&sysrq_showallcpus);
+}
+
+static struct sysrq_key_op sysrq_showallcpus_op = {
+	.handler	= sysrq_handle_showallcpus,
+	.help_msg	= "aLlcpus",
+	.action_msg	= "Show backtrace of all active CPUs",
+	.enable_mask	= SYSRQ_ENABLE_DUMP,
+};
+#endif
+
 static void sysrq_handle_showregs(int key, struct tty_struct *tty)
 {
 	struct pt_regs *regs = get_irq_regs();
@@ -340,7 +382,11 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
 	&sysrq_kill_op,			/* i */
 	NULL,				/* j */
 	&sysrq_SAK_op,			/* k */
+#ifdef CONFIG_SMP
+	&sysrq_showallcpus_op,		/* l */
+#else
 	NULL,				/* l */
+#endif
 	&sysrq_showmem_op,		/* m */
 	&sysrq_unrt_op,			/* n */
 	/* o: This will often be registered as 'Off' at init time */


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.495
retrieving revision 1.496
diff -u -r1.495 -r1.496
--- kernel.spec	16 Jul 2008 15:59:42 -0000	1.495
+++ kernel.spec	18 Jul 2008 16:52:22 -0000	1.496
@@ -634,6 +634,7 @@
 Patch460: linux-2.6-serial-460800.patch
 Patch510: linux-2.6-silence-noise.patch
 Patch570: linux-2.6-selinux-mprotect-checks.patch
+Patch580: linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch
 Patch600: linux-2.6-vm-silence-atomic-alloc-failures.patch
 
 Patch610: linux-2.6-defaults-fat-utf8.patch
@@ -1139,6 +1140,9 @@
 # Fix the SELinux mprotect checks on executable mappings
 ApplyPatch linux-2.6-selinux-mprotect-checks.patch
 
+# add "show backtrace on all cpus" (sysrq-l)
+ApplyPatch linux-2.6-sysrq-add-show-backtrace-on-all-cpus-function.patch
+
 #
 # VM related fixes.
 #
@@ -1836,6 +1840,9 @@
 
 
 %changelog
+* Fri Jul 18 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.11-56
+- Add "show backtrace on all CPUs" (SysRq-l).
+
 * Mon Jul 14 2008 Kyle McMartin <kmcmartin at redhat.com>
 - Disable CONFIG_ACPI_SYSFS_POWER, which still seems to be confusing hal.
 




More information about the scm-commits mailing list