mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] x86, NMI: die_notifier and default_do_nmi cleanups
@ 2011-01-06 21:18 Don Zickus
  2011-01-06 21:18 ` [PATCH 1/6] x86, NMI: Add NMI symbol constants and rename memory parity to PCI SERR Don Zickus
                   ` (7 more replies)
  0 siblings, 8 replies; 31+ messages in thread
From: Don Zickus @ 2011-01-06 21:18 UTC (permalink / raw)
  To: x86
  Cc: Peter Zijlstra, Robert Richter, ying.huang, gorcunov, LKML, Don Zickus

This is another version of the NMI rewrite patches I sent previously.  I
take it those patches were too thick to be reviewed easily, so I broke out
the patches differently to make it easier to review.  Hopefully it doesn't
look as scary.

The bulk of the patch adds priorities to the die_chain notifiers for NMI
events and removes the DIE_NMI_IPI event.  There are some other cleanups
too, which include removing the restriction of the BSP cpu to process 
external NMIs.

Cheers,
Don

Don Zickus (5):
  x86: Convert some devices to use DIE_NMIUNKNOWN
  x86, NMI: Add priorities to handlers
  x86, NMI: Remove DIE_NMI_IPI
  x86, NMI: Allow NMI reason io port (0x61) to be processed on any CPU
  x86, NMI: Clean-up default_do_nmi()

Huang Ying (1):
  x86, NMI: Add NMI symbol constants and rename memory parity to PCI
    SERR

 arch/x86/include/asm/kdebug.h           |    1 -
 arch/x86/include/asm/mach_traps.h       |   12 +++-
 arch/x86/include/asm/nmi.h              |   20 ++++++
 arch/x86/kernel/apic/hw_nmi.c           |    3 +-
 arch/x86/kernel/apic/x2apic_uv_x.c      |    2 +-
 arch/x86/kernel/cpu/mcheck/mce-inject.c |    5 +-
 arch/x86/kernel/cpu/perf_event.c        |    3 +-
 arch/x86/kernel/kgdb.c                  |    6 +--
 arch/x86/kernel/reboot.c                |    5 +-
 arch/x86/kernel/traps.c                 |  102 +++++++++++++++---------------
 arch/x86/oprofile/nmi_int.c             |    3 +-
 arch/x86/oprofile/nmi_timer_int.c       |    2 +-
 drivers/char/ipmi/ipmi_watchdog.c       |    2 +-
 drivers/watchdog/hpwdt.c                |    2 +-
 14 files changed, 97 insertions(+), 71 deletions(-)

-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH 4/5] x86, NMI: Allow NMI reason io port (0x61) to be processed on any CPU
@ 2010-10-16  2:22 Don Zickus
  2010-10-16 16:37 ` [tip:perf/core] " tip-bot for Huang Ying
  0 siblings, 1 reply; 31+ messages in thread
From: Don Zickus @ 2010-10-16  2:22 UTC (permalink / raw)
  To: mingo; +Cc: andi, robert.richter, linux-kernel, peterz, ying.huang, Don Zickus

From: Huang Ying <ying.huang@intel.com>

In original NMI handler, NMI reason io port (0x61) is only processed
on BSP. This makes it impossible to hot-remove BSP. To solve the
issue, a raw spinlock is used to make the port can be processed on any
CPU.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 arch/x86/kernel/traps.c |   45 +++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index d8acab3..accb2f4 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -83,6 +83,12 @@ EXPORT_SYMBOL_GPL(used_vectors);
 
 static int ignore_nmis;
 
+/*
+ * Prevent NMI reason port (0x61) being accessed simultaneously, can
+ * only be used in NMI handler.
+ */
+static DEFINE_RAW_SPINLOCK(nmi_reason_lock);
+
 static inline void conditional_sti(struct pt_regs *regs)
 {
 	if (regs->flags & X86_EFLAGS_IF)
@@ -383,7 +389,6 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 {
 	unsigned char reason = 0;
-	int cpu;
 
 	/*
 	 * CPU-specific NMI must be processed before non-CPU-specific
@@ -400,28 +405,28 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 		return;
 
 	/* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
-	cpu = smp_processor_id();
-	/* Only the BSP gets external NMIs from the system. */
-	if (!cpu) {
-		reason = get_nmi_reason();
-		if (reason & NMI_REASON_MASK) {
-			if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
-			    == NOTIFY_STOP)
-				return;
-			if (reason & NMI_REASON_SERR)
-				pci_serr_error(reason, regs);
-			else if (reason & NMI_REASON_IOCHK)
-				io_check_error(reason, regs);
+	raw_spin_lock(&nmi_reason_lock);
+	reason = get_nmi_reason();
+	if (reason & NMI_REASON_MASK) {
+		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
+		    == NOTIFY_STOP)
+			goto unlock_return;
+		if (reason & NMI_REASON_SERR)
+			pci_serr_error(reason, regs);
+		else if (reason & NMI_REASON_IOCHK)
+			io_check_error(reason, regs);
 #ifdef CONFIG_X86_32
-			/*
-			 * Reassert NMI in case it became active
-			 * meanwhile as it's edge-triggered:
-			 */
-			reassert_nmi();
+		/*
+		 * Reassert NMI in case it became active
+		 * meanwhile as it's edge-triggered:
+		 */
+		reassert_nmi();
 #endif
-			return;
-		}
+unlock_return:
+		raw_spin_unlock(&nmi_reason_lock);
+		return;
 	}
+	raw_spin_unlock(&nmi_reason_lock);
 
 	if (notify_die(DIE_NMI, "nmi", regs, 0, 2, SIGINT) == NOTIFY_STOP)
 		return;
-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2011-02-28 18:48 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-06 21:18 [PATCH 0/6] x86, NMI: die_notifier and default_do_nmi cleanups Don Zickus
2011-01-06 21:18 ` [PATCH 1/6] x86, NMI: Add NMI symbol constants and rename memory parity to PCI SERR Don Zickus
2011-01-07 15:33   ` [tip:perf/core] " tip-bot for Huang Ying
2011-01-06 21:18 ` [PATCH 2/6] x86: Convert some devices to use DIE_NMIUNKNOWN Don Zickus
2011-01-07 15:34   ` [tip:perf/core] " tip-bot for Don Zickus
2011-01-06 21:18 ` [PATCH 3/6] x86, NMI: Add priorities to handlers Don Zickus
2011-01-07 13:09   ` Peter Zijlstra
2011-01-07 14:43     ` Don Zickus
2011-01-07 14:50       ` Peter Zijlstra
2011-01-07 17:48         ` Don Zickus
2011-01-07 15:34   ` [tip:perf/core] " tip-bot for Don Zickus
2011-01-06 21:18 ` [PATCH 4/6] x86, NMI: Remove DIE_NMI_IPI Don Zickus
2011-01-07 15:34   ` [tip:perf/core] " tip-bot for Don Zickus
2011-01-06 21:18 ` [PATCH 5/6] x86, NMI: Allow NMI reason io port (0x61) to be processed on any CPU Don Zickus
2011-01-07 15:34   ` [tip:perf/core] " tip-bot for Don Zickus
2011-02-23  2:39   ` [PATCH 5/6] " Maciej W. Rozycki
2011-02-25 21:45     ` Don Zickus
2011-02-26  8:02     ` Cyrill Gorcunov
2011-02-26 11:19       ` huang ying
2011-02-26 12:34         ` Cyrill Gorcunov
2011-02-26 14:07           ` huang ying
2011-02-26 15:09             ` Cyrill Gorcunov
2011-02-27  1:01               ` huang ying
2011-02-27 11:19                 ` Cyrill Gorcunov
2011-02-28 18:37                   ` Don Zickus
2011-02-28 18:48                     ` Cyrill Gorcunov
2011-01-06 21:18 ` [PATCH 6/6] x86, NMI: Clean-up default_do_nmi() Don Zickus
2011-01-07 15:35   ` [tip:perf/core] " tip-bot for Don Zickus
2011-01-07  9:53 ` [PATCH 0/6] x86, NMI: die_notifier and default_do_nmi cleanups Cyrill Gorcunov
2011-01-07  9:55 ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2010-10-16  2:22 [PATCH 4/5] x86, NMI: Allow NMI reason io port (0x61) to be processed on any CPU Don Zickus
2010-10-16 16:37 ` [tip:perf/core] " tip-bot for Huang Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome