Skip to contentSkip to conversation

x86, mce: reset kernel for no-match exception errors

PATCH In review Jin Dongming 2 participants 2 messages Aug 27, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, mce: reset kernel for no-match exception errors

The last case of severity table is used for no match exception error. Maybe such kind of error could not happen. But I think when the error really happened, the kernel should be reset. Because such error is unknown and unexpected. So I make this patch for fixing this problem.

This patch is based on tip/x86/mce.

---
 arch/x86/kernel/cpu/mcheck/mce-severity.c |    2 +-
 arch/x86/kernel/cpu/mcheck/mce.c          |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/mcheck/mce-severity.c +1 -1
index bc35a07..092755b 100644
@@ -97,7 +97,7 @@ static struct severity {
 	     "Action optional with lost events", SER),
 	BITSET(MCI_STATUS_UC|MCI_STATUS_OVER, PANIC, "Overflowed uncorrected"),
 	BITSET(MCI_STATUS_UC, UC, "Uncorrected"),
-	BITSET(0, SOME, "No match")	/* always matches. keep at end */
+	BITSET(0, PANIC, "Unknown Error")     /* always matches. keep at end */
 };
 
 /*
arch/x86/kernel/cpu/mcheck/mce.c +6 -0
index 2c3bcd1..cc6e9cb 100644
@@ -245,6 +245,12 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
 		struct mce *m = &mcelog.entry[i];
 		if (!(m->status & MCI_STATUS_VAL))
 			continue;
+		/*
+		 * When no-match error happened, it is a corrected error and
+		 * logged as final one. Prevents it from being printed twice.
+		 */
+		if (final && !memcmp(m, final, sizeof(struct mce)))
+			continue;
 		if (!(m->status & MCI_STATUS_UC))
 			print_mce(m);
 	}
Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 4 lines · Jin Dongming

The last case of severity table is used for no match exception error. Maybe such kind of error could not happen. But I think when the error really happened, the kernel should be reset. Because such error is unknown and unexpected. So I make this patch for fixing this problem.

I don't think panicing for a non-signalled error is the correct action.

In general I tried to be conservative regarding panics, this seems to be too liberal with them.

-Andi