Skip to contentSkip to conversation

NMI: continue in case of PCI SERR erros

PATCH In review Stefano Stabellini 3 participants 6 messages Feb 25, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NMI: continue in case of PCI SERR erros

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing.

---

xen/arch/x86/traps.c +5 -16
diff -r 598d1fc295b6 xen/arch/x86/traps.c
@@ -3075,23 +3075,12 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
-        fatal_trap(TRAP_nmi, regs);
-    }
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");
 
-    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable parity check */
-    mdelay(1);
-    outb((inb(0x61) & 0x0b) | 0x00, 0x61); /* enable parity check */
+    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3154,7 +3143,7 @@ asmlinkage void do_nmi(struct cpu_user_r
     {
         reason = inb(0x61);
         if ( reason & 0x80 )
-            mem_parity_error(regs);
+            pci_serr_error(regs);
         else if ( reason & 0x40 )
             io_check_error(regs);
         else if ( !nmi_watchdog )
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 25.02.11 at 11:53, Stefano Stabellini <[email protected]>

Quoted 24 lines · wrote:

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing.

---

diff -r 598d1fc295b6 xen/arch/x86/traps.c

xen/arch/x86/traps.c +1 -4
@@ -3075,23 +3075,12 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */

xen/arch/x86/traps.c static void nmi_dom0_report(unsigned int · line 3081

Quoted 10 lines
xen/arch/x86/traps.c +2 -8
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
-        fatal_trap(TRAP_nmi, regs);
-    }
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");

Why do you remove the reporting of the event to Dom0? I'd rather see this part stay and the public headers getting adjusted in a compatible way.

Jan

Quoted 23 lines
xen/arch/x86/traps.c +1 -3
-    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable parity check */
-    mdelay(1);
-    outb((inb(0x61) & 0x0b) | 0x00, 0x61); /* enable parity check */
+    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR 

error line. */
}

static void io_check_error(struct cpu_user_regs *regs)

xen/arch/x86/traps.c +1 -1
@@ -3154,7 +3143,7 @@ asmlinkage void do_nmi(struct cpu_user_r
     {
         reason = inb(0x61);
         if ( reason & 0x80 )
-            mem_parity_error(regs);
+            pci_serr_error(regs);
         else if ( reason & 0x40 )
             io_check_error(regs);
         else if ( !nmi_watchdog )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 32 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 25.02.11 at 11:53, Stefano Stabellini <[email protected]>

Quoted 30 lines · wrote:

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing.

---

diff -r 598d1fc295b6 xen/arch/x86/traps.c

xen/arch/x86/traps.c +1 -10
@@ -3075,23 +3075,12 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
Quoted 9 lines

xen/arch/x86/traps.c static void nmi_dom0_report(unsigned int · line 3081

Quoted 4 lines
xen/arch/x86/traps.c +2 -2
-        fatal_trap(TRAP_nmi, regs);
-    }
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");

Why do you remove the reporting of the event to Dom0? I'd rather see this part stay and the public headers getting adjusted in a compatible way.

Because it might not have anything to do with dom0: I wrote this patch to fix http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1744, that is due to Xen trying to mask an MSI-X of a device assigned to a guest on shutdown. The device seems to be in a state in which it refuses any interactions so it sends a PCI SERR that becomes an NMI and used to crash Xen.

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 25.02.11 at 12:27, Stefano Stabellini <[email protected]>

Quoted 43 lines · wrote:
Quoted 32 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 25.02.11 at 11:53, Stefano Stabellini <[email protected]>

Quoted 30 lines · wrote:

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing.

---

diff -r 598d1fc295b6 xen/arch/x86/traps.c

xen/arch/x86/traps.c +1 -10
@@ -3075,23 +3075,12 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
Quoted 9 lines

xen/arch/x86/traps.c static void nmi_dom0_report(unsigned int · line 3081

Quoted 4 lines
xen/arch/x86/traps.c +2 -2
-        fatal_trap(TRAP_nmi, regs);
-    }
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");

Why do you remove the reporting of the event to Dom0? I'd rather see this part stay and the public headers getting adjusted in a compatible way.

Quoted 1 line

Because it might not have anything to do with dom0: I wrote this patch

As you say: might.

Quoted 5 lines

to fix http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1744, that is due to Xen trying to mask an MSI-X of a device assigned to a guest on shutdown. The device seems to be in a state in which it refuses any interactions so it sends a PCI SERR that becomes an NMI and used to crash Xen.

I'm certainly agreeing to the part that avoids the crash.

Jan

#4 lore raw
Quoted 4 lines · Jan Beulich
Quoted 1 line

Because it might not have anything to do with dom0: I wrote this patch

As you say: might.

Ok.

---

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing (it is common to receive PCI SERR errors for performing operations on a device in the wrong power state).

xen/arch/x86/traps.c +6 -16
diff -r 598d1fc295b6 xen/arch/x86/traps.c
@@ -3075,23 +3075,13 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
-        fatal_trap(TRAP_nmi, regs);
-    }
+    nmi_dom0_report(_XEN_NMIREASON_pci_serr_error);
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");
 
-    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable parity check */
-    mdelay(1);
-    outb((inb(0x61) & 0x0b) | 0x00, 0x61); /* enable parity check */
+    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3154,7 +3144,7 @@ asmlinkage void do_nmi(struct cpu_user_r
     {
         reason = inb(0x61);
         if ( reason & 0x80 )
-            mem_parity_error(regs);
+            pci_serr_error(regs);
         else if ( reason & 0x40 )
             io_check_error(regs);
         else if ( !nmi_watchdog )
xen/include/public/nmi.h +3 -0
diff -r 598d1fc295b6 xen/include/public/nmi.h
@@ -39,6 +39,9 @@
  /* Parity error reported via ISA port 0x61, bit 7. */
 #define _XEN_NMIREASON_parity_error 1
 #define XEN_NMIREASON_parity_error  (1UL << _XEN_NMIREASON_parity_error)
+ /* PCI SERR error reported via ISA port 0x61, bit 7. */
+#define _XEN_NMIREASON_pci_serr_error 1
+#define XEN_NMIREASON_pci_serr_error (1UL << _XEN_NMIREASON_pci_serr_error)
  /* Unknown hardware-generated NMI. */
 #define _XEN_NMIREASON_unknown      2
 #define XEN_NMIREASON_unknown       (1UL << _XEN_NMIREASON_unknown)
#5 lore raw
Quoted 7 lines · Stefano Stabellini
Quoted 4 lines · Jan Beulich
Quoted 1 line

Because it might not have anything to do with dom0: I wrote this patch

As you say: might.

Ok.

I already applied the original patch.

-- Keir

Quoted 75 lines

---

Memory parity error is only valid for IBM PC-AT, newer machines use bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are usually reported via MCE.

Rename the memory parity error handler to pci serr handler and print a warning and continue instead of crashing (it is common to receive PCI SERR errors for performing operations on a device in the wrong power state).

diff -r 598d1fc295b6 xen/arch/x86/traps.c

xen/arch/x86/traps.c Fri Feb 25 14:04:08 2011 +0000 renamed from xen/arch/x86/traps.c Thu Feb 24 09:33:19 2011 +0000 +5 -15
@@ -3075,23 +3075,13 @@ static void nmi_dom0_report(unsigned int
     send_guest_trap(d, 0, TRAP_nmi);
 }
 
-static void mem_parity_error(struct cpu_user_regs *regs)
+static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    switch ( opt_nmi[0] )
-    {
-    case 'd': /* 'dom0' */
-        nmi_dom0_report(_XEN_NMIREASON_parity_error);
-    case 'i': /* 'ignore' */
-        break;
-    default:  /* 'fatal' */
-        console_force_unlock();
-        printk("\n\nNMI - MEMORY ERROR\n");
-        fatal_trap(TRAP_nmi, regs);
-    }
+    nmi_dom0_report(_XEN_NMIREASON_pci_serr_error);
+    console_force_unlock();
+    printk("\n\nNMI - PCI system error (SERR)\n");
 
-    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable parity check
 */
-    mdelay(1);
-    outb((inb(0x61) & 0x0b) | 0x00, 0x61); /* enable parity check */
+    outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR

error line. */
}

static void io_check_error(struct cpu_user_regs *regs)

xen/arch/x86/traps.c Fri Feb 25 14:04:08 2011 +0000 renamed from xen/arch/x86/traps.c Thu Feb 24 09:33:19 2011 +0000 +1 -1
@@ -3154,7 +3144,7 @@ asmlinkage void do_nmi(struct cpu_user_r
     {
         reason = inb(0x61);
         if ( reason & 0x80 )
-            mem_parity_error(regs);
+            pci_serr_error(regs);
         else if ( reason & 0x40 )
             io_check_error(regs);
         else if ( !nmi_watchdog )

diff -r 598d1fc295b6 xen/include/public/nmi.h

xen/include/public/nmi.h Fri Feb 25 14:04:08 2011 +0000 renamed from xen/include/public/nmi.h Thu Feb 24 09:33:19 2011 +0000 +3 -0
@@ -39,6 +39,9 @@
  /* Parity error reported via ISA port 0x61, bit 7. */
 #define _XEN_NMIREASON_parity_error 1
 #define XEN_NMIREASON_parity_error  (1UL << _XEN_NMIREASON_parity_error)
+ /* PCI SERR error reported via ISA port 0x61, bit 7. */
+#define _XEN_NMIREASON_pci_serr_error 1
+#define XEN_NMIREASON_pci_serr_error (1UL << _XEN_NMIREASON_pci_serr_error)
  /* Unknown hardware-generated NMI. */
 #define _XEN_NMIREASON_unknown      2
 #define XEN_NMIREASON_unknown       (1UL << _XEN_NMIREASON_unknown)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel