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]
Message-Id: <1396644430-70649-3-git-send-email-dzickus@redhat.com>
Date:	Fri,  4 Apr 2014 16:47:08 -0400
From:	Don Zickus <dzickus@...hat.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	akpm@...ux-foundation.org, x86@...nel.org, davem@...emloft.net,
	sparclinux@...r.kernel.org, mguzik@...hat.com,
	Aaron Tomlin <atomlin@...hat.com>,
	Don Zickus <dzickus@...hat.com>
Subject: [PATCH 2/4 v2] x86, nmi: Add more flexible NMI back trace support

From: Aaron Tomlin <atomlin@...hat.com>

This patch introduces the x86 specific implementation
changes to the arch_trigger_all_cpu_backtrace() routine.
Now users have the ability to choose whether or not to
issue an NMI back trace which includes current.

[Don't print message in single processor case - dcz]

Signed-off-by: Aaron Tomlin <atomlin@...hat.com>
Signed-off-by: Don Zickus <dzickus@...hat.com>
---
 arch/x86/include/asm/irq.h    |    2 +-
 arch/x86/kernel/apic/hw_nmi.c |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index cb6cfcd..a80cbb8 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -43,7 +43,7 @@ extern int vector_used_by_percpu_irq(unsigned int vector);
 extern void init_ISA_irqs(void);
 
 #ifdef CONFIG_X86_LOCAL_APIC
-void arch_trigger_all_cpu_backtrace(void);
+void arch_trigger_all_cpu_backtrace(bool);
 #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
 #endif
 
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index a698d71..3614e34 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -33,7 +33,7 @@ static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
 /* "in progress" flag of arch_trigger_all_cpu_backtrace */
 static unsigned long backtrace_flag;
 
-void arch_trigger_all_cpu_backtrace(void)
+void arch_trigger_all_cpu_backtrace(bool include_self)
 {
 	int i;
 
@@ -46,8 +46,18 @@ void arch_trigger_all_cpu_backtrace(void)
 
 	cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask);
 
-	printk(KERN_INFO "sending NMI to all CPUs:\n");
-	apic->send_IPI_all(NMI_VECTOR);
+	if (include_self) {
+		printk(KERN_INFO "sending NMI to all CPUs:\n");
+		apic->send_IPI_all(NMI_VECTOR);
+	} else {
+		cpumask_clear_cpu(smp_processor_id(),
+			to_cpumask(backtrace_mask));
+
+		if (!cpumask_empty(to_cpumask(backtrace_mask))) {
+			printk(KERN_INFO "sending NMI to other CPUs:\n");
+			apic->send_IPI_allbutself(NMI_VECTOR);
+		}
+	}
 
 	/* Wait for up to 10 seconds for all CPUs to do the backtrace */
 	for (i = 0; i < 10 * 1000; i++) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ