lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 29 Feb 2016 16:40:22 -0500
From:	Chris Metcalf <cmetcalf@...hip.com>
To:	Russell King <linux@....linux.org.uk>,
	"Thomas Gleixner <tglx@...utronix.de> Aaron Tomlin" 
	<atomlin@...hat.com>, Ingo Molnar <mingo@...hat.com>,
	Andrew Morton <akpm@...l.org>, <linux-kernel@...r.kernel.org>
CC:	Chris Metcalf <cmetcalf@...hip.com>
Subject: [PATCH 2/4] nmi_backtrace: generate one-line reports for idle cpus

When doing an nmi backtrace of many cores, and most of them are idle,
the output is a little overwhelming and very uninformative.  Suppress
messages for cpus that are idling when they are interrupted and
just emit one line, "NMI backtrace for N skipped: idle".

Signed-off-by: Chris Metcalf <cmetcalf@...hip.com>
---
 lib/nmi_backtrace.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index db63ac75eba0..f878efc9e851 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -142,6 +142,15 @@ static int nmi_vprintk(const char *fmt, va_list args)
 	return seq_buf_used(&s->seq) - len;
 }
 
+static bool idling(void)
+{
+	if (!is_idle_task(current))
+		return false;
+
+	/* Account for nmi_enter() having been called once. */
+	return hardirq_count() == HARDIRQ_OFFSET && !in_softirq();
+}
+
 bool nmi_cpu_backtrace(struct pt_regs *regs)
 {
 	int cpu = smp_processor_id();
@@ -151,11 +160,16 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
 
 		/* Replace printk to write into the NMI seq */
 		this_cpu_write(printk_func, nmi_vprintk);
-		pr_warn("NMI backtrace for cpu %d\n", cpu);
-		if (regs)
-			show_regs(regs);
-		else
-			dump_stack();
+		if (idling()) {
+			pr_warn("NMI backtrace for cpu %d skipped: idle\n",
+				cpu);
+		} else {
+			pr_warn("NMI backtrace for cpu %d\n", cpu);
+			if (regs)
+				show_regs(regs);
+			else
+				dump_stack();
+		}
 		this_cpu_write(printk_func, printk_func_save);
 
 		cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
-- 
2.1.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ