Skip to content

Commit fa619f5

Browse files
Zildj1ansuryasaimadhu
authored andcommitted
x86/mce: Add messages for panic errors in AMD's MCE grading
When a machine error is graded as PANIC by the AMD grading logic, the MCE handler calls mce_panic(). The notification chain does not come into effect so the AMD EDAC driver does not decode the errors. In these cases, the messages displayed to the user are more cryptic and miss information that might be relevant, like the context in which the error took place. Add messages to the grading logic for machine errors so that it is clear what error it was. [ bp: Massage commit message. ] Signed-off-by: Carlos Bilbao <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Yazen Ghannam <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 70c459d commit fa619f5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arch/x86/kernel/cpu/mce/severity.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs)
304304
/* See AMD PPR(s) section Machine Check Error Handling. */
305305
static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **msg, bool is_excp)
306306
{
307+
char *panic_msg = NULL;
307308
int ret;
308309

309310
/*
@@ -314,6 +315,7 @@ static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **
314315

315316
/* Processor Context Corrupt, no need to fumble too much, die! */
316317
if (m->status & MCI_STATUS_PCC) {
318+
panic_msg = "Processor Context Corrupt";
317319
ret = MCE_PANIC_SEVERITY;
318320
goto out;
319321
}
@@ -337,19 +339,26 @@ static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **
337339
* system will not be able to recover, panic.
338340
*/
339341
if ((m->status & MCI_STATUS_OVER) && !mce_flags.overflow_recov) {
342+
panic_msg = "Overflowed uncorrected error without MCA Overflow Recovery";
340343
ret = MCE_PANIC_SEVERITY;
341344
goto out;
342345
}
343346

344347
if (!mce_flags.succor) {
348+
panic_msg = "Uncorrected error without MCA Recovery";
345349
ret = MCE_PANIC_SEVERITY;
346350
goto out;
347351
}
348352

349-
if (error_context(m, regs) == IN_KERNEL)
353+
if (error_context(m, regs) == IN_KERNEL) {
354+
panic_msg = "Uncorrected unrecoverable error in kernel context";
350355
ret = MCE_PANIC_SEVERITY;
356+
}
351357

352358
out:
359+
if (msg && panic_msg)
360+
*msg = panic_msg;
361+
353362
return ret;
354363
}
355364

0 commit comments

Comments
 (0)