[Devel] [PATCH rh7 2/2] Revert "x86/NMI: introduce dumps via nmi"

Vladimir Davydov vdavydov at parallels.com
Thu Jun 18 06:54:48 PDT 2015


This reverts commit d0f4641de70c7417cf2822221dbc845d8671540c.

This is used to dump registers from all CPUs by sending them IPIs. This
is called automatically on a BUG or manually by hitting sysrq-p. In
either case it is useless, because BUG results in a vmcore, which
contains full registers dump, while sysrq-p is rarely used since the
NMI it is supposed to send on PCS6 can lead to our hypervisor crash.
Instead we use sysrq-w for debugging instead.

https://jira.sw.ru/browse/PSBM-17989

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 arch/x86/kernel/dumpstack.c |  1 -
 arch/x86/kernel/smp.c       |  5 ----
 include/linux/nmi.h         |  3 +--
 kernel/printk.c             | 62 ---------------------------------------------
 4 files changed, 1 insertion(+), 70 deletions(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 6ae29cfacdeb..deb6421c9e69 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -267,7 +267,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
 
 	print_modules();
 	show_regs(regs);
-	nmi_show_regs(regs, 1);
 #ifdef CONFIG_X86_32
 	if (user_mode_vm(regs)) {
 		sp = regs->sp;
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index bb0785b40c93..cdaa347dfcad 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -333,11 +333,6 @@ void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
 	exiting_irq();
 }
 
-void send_nmi_ipi_allbutself(void)
-{
-	apic->send_IPI_allbutself(NMI_VECTOR);
-}
-
 static int __init nonmi_ipi_setup(char *str)
 {
 	smp_no_nmi_ipi = true;
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 3b4ff0c24192..6a45fb583ff1 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -52,6 +52,5 @@ struct ctl_table;
 extern int proc_dowatchdog(struct ctl_table *, int ,
 			   void __user *, size_t *, loff_t *);
 #endif
-extern void nmi_show_regs(struct pt_regs *regs, int in_nmi);
-extern int do_nmi_show_regs(struct pt_regs *regs, int cpu);
+
 #endif
diff --git a/kernel/printk.c b/kernel/printk.c
index afb7cf8c1d4e..5488a59309cd 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -3127,65 +3127,3 @@ void show_regs_print_info(const char *log_lvl)
 }
 
 #endif
-
-static cpumask_t nmi_show_regs_cpus = CPU_MASK_NONE;
-static unsigned long nmi_show_regs_timeout;
-
-void __attribute__((weak)) send_nmi_ipi_allbutself(void)
-{
-	cpus_clear(nmi_show_regs_cpus);
-}
-
-static void busted_show_regs(struct pt_regs *regs, int in_nmi)
-{
-	if (!regs || (in_nmi && raw_spin_is_locked(&logbuf_lock)))
-		return;
-
-	bust_spinlocks(1);
-	printk("----------- IPI show regs -----------\n");
-	show_regs(regs);
-	bust_spinlocks(0);
-}
-
-void nmi_show_regs(struct pt_regs *regs, int in_nmi)
-{
-	if (cpus_empty(nmi_show_regs_cpus))
-		goto doit;
-
-	/* Previous request still in progress */
-	if (time_before(jiffies, nmi_show_regs_timeout))
-		return;
-
-	if (!in_nmi || !raw_spin_is_locked(&logbuf_lock)) {
-		int cpu;
-
-		bust_spinlocks(1);
-		printk("previous show regs lost IPI to: ");
-		for_each_cpu_mask(cpu, nmi_show_regs_cpus)
-			printk("%d ", cpu);
-		printk("\n");
-		bust_spinlocks(0);
-	}
-
-doit:
-	nmi_show_regs_timeout = jiffies + HZ/10;
-	nmi_show_regs_cpus = *(cpumask_t *)cpu_online_mask;
-	cpu_clear(raw_smp_processor_id(), nmi_show_regs_cpus);
-	busted_show_regs(regs, in_nmi);
-	send_nmi_ipi_allbutself();
-}
-
-/* call only from nmi handler */
-int do_nmi_show_regs(struct pt_regs *regs, int cpu)
-{
-	static DEFINE_SPINLOCK(nmi_show_regs_lock);
-
-	if (!cpu_isset(cpu, nmi_show_regs_cpus))
-		return 0;
-
-	spin_lock(&nmi_show_regs_lock);
-	busted_show_regs(regs, 1);
-	cpu_clear(cpu, nmi_show_regs_cpus);
-	spin_unlock(&nmi_show_regs_lock);
-	return 1;
-}
-- 
2.1.4




More information about the Devel mailing list