x86/mce: Grade new machine errors for AMD MCEs and include messages for panic cases
Subsystems (3)
v2 cover x86/mce: Grade new machine errors for AMD MCEs and include messages for panic cases
This patchset includes grading of new types of machine errors on AMD's MCE grading logic mce_severity_amd(), which helps the MCE handler determine what actions to take. If the error is graded as a PANIC, the EDAC driver will not decode; so we also include new error messages to describe the MCE and help debugging critical errors.
Changes since v1:
On patch 1/2, follow a simplified approach for severity.c, that resembles the available PPR more closely. This also simplifies patch 2/2, as less panic error messages are added.
Carlos Bilbao (2):
x86/mce: Extend AMD severity grading function with new types of errors x86/mce: Add messages to describe panic machine errors on AMD's MCEs grading
arch/x86/include/asm/mce.h | 6 + arch/x86/kernel/cpu/mce/severity.c | 203 ++++++++++++++++++++++++----- 2 files changed, 174 insertions(+), 35 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/2 x86/mce: Extend AMD severity grading function with new types of errors
The MCE handler needs to understand the severity of the machine errors to act accordingly. In the case of AMD, very few errors are covered in the grading logic.
Extend the MCEs severity grading of AMD to cover new types of machine errors.
--- arch/x86/kernel/cpu/mce/severity.c | 104 ++++++++++------------------- 1 file changed, 37 insertions(+), 67 deletions(-)
arch/x86/kernel/cpu/mce/severity.c +37 -67
@@ -301,85 +301,55 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs) } } -static __always_inline int mce_severity_amd_smca(struct mce *m, enum context err_ctx) -{ -u64 mcx_cfg; - -/* -* We need to look at the following bits: -* - "succor" bit (data poisoning support), and -* - TCC bit (Task Context Corrupt) -* in MCi_STATUS to determine error severity. -*/ -if (!mce_flags.succor) -return MCE_PANIC_SEVERITY ; - - mcx_cfg =mce_rdmsrl (MSR_AMD64_SMCA_MCx_CONFIG (m->bank)); - -/* TCC (Task context corrupt). If set and if IN_KERNEL, panic. */ -if ((mcx_cfg &MCI_CONFIG_MCAX ) && - (m->status &MCI_STATUS_TCC ) && - (err_ctx ==IN_KERNEL )) -return MCE_PANIC_SEVERITY ; - -/* ...otherwise invoke hwpoison handler. */ -return MCE_AR_SEVERITY ; -} -/* -* See AMD Error Scope Hierarchy table in a newer BKDG. For example -* 49125_15h_Models_30h-3Fh_BKDG.pdf, section "RAS Features" +* See AMD PPR(s) section 3.1 Machine Check Architecture */ static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **msg, bool is_excp) { -enum context ctx =error_context (m, regs); +int ret; + +/* +* Default return value: Action required, the error must be handled +* immediately. +*/ + ret =MCE_AR_SEVERITY ;/* Processor Context Corrupt, no need to fumble too much, die! */ -if (m->status &MCI_STATUS_PCC ) -return MCE_PANIC_SEVERITY ; +if (m->status &MCI_STATUS_PCC ) { + ret =MCE_PANIC_SEVERITY ; + goto amd_severity; + } -if (m->status &MCI_STATUS_UC ) { +/* +* Evaluate the severity of deferred errors for AMD systems, for which only +* scrub error is interesting to notify an action requirement. The poll +* handler catches deferred errors and adds to mce_ring so memorty-failure +* can take recovery actions. +*/ +if (m->status &MCI_STATUS_DEFERRED ) { + ret =MCE_DEFERRED_SEVERITY ; + goto amd_severity; + } -if (ctx ==IN_KERNEL ) -return MCE_PANIC_SEVERITY ; +/* If the UC bit is not set, the error has been corrected */ +if (!(m->status &MCI_STATUS_UC )) { + ret =MCE_KEEP_SEVERITY ; + goto amd_severity; + } -/* -* On older systems where overflow_recov flag is not present, we -* should simply panic if an error overflow occurs. If -* overflow_recov flag is present and set, then software can try -* to at least kill process to prolong system operation. -*/ -if (mce_flags.overflow_recov) { -if (mce_flags.smca) -return mce_severity_amd_smca (m, ctx); - -/* kill current process */ -return MCE_AR_SEVERITY ; - }else { -/* at least one error was not logged */ -if (m->status &MCI_STATUS_OVER ) -return MCE_PANIC_SEVERITY ; - } - -/* -* For any other case, return MCE_UC_SEVERITY so that we log the -* error and exit #MC handler. -*/ -return MCE_UC_SEVERITY ; +if (((m->status &MCI_STATUS_OVER ) && !mce_flags.overflow_recov) + || !mce_flags.succor) { + ret =MCE_PANIC_SEVERITY ; + goto amd_severity; } -/* -* deferred error: poll handler catches these and adds to mce_ring so -* memory-failure can take recovery actions. -*/ -if (m->status &MCI_STATUS_DEFERRED ) -return MCE_DEFERRED_SEVERITY ; +if (error_context (m, regs) ==IN_KERNEL ) { + ret =MCE_PANIC_SEVERITY ; + } -/* -* corrected error: poll handler catches these and passes responsibility -* of decoding the error to EDAC -*/ -return MCE_KEEP_SEVERITY ; +amd_severity: + +return ret; } static noinstr int mce_severity_intel(struct mce *m, struct pt_regs *regs, char **msg, bool is_excp)
Signature · 1 line
2.31.1
PATCH v2 2/2 x86/mce: Add messages to describe panic machine errors on AMD's MCEs grading
In reply to Carlos BilbaoWhen a machine error is graded as PANIC by 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.
Fix the above issue including messages on AMD's grading logic for machine errors graded as PANIC.
--- arch/x86/kernel/cpu/mce/severity.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/cpu/mce/severity.c +7 -0
@@ -307,6 +307,7 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs) static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **msg, bool is_excp) {int ret; +char *panic_msg;/* * Default return value: Action required, the error must be handled
@@ -316,6 +317,7 @@ static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **/* Processor Context Corrupt, no need to fumble too much, die! */ if (m->status &MCI_STATUS_PCC ) { + panic_msg ="Processor Context Corrupt" ; ret =MCE_PANIC_SEVERITY ; goto amd_severity; }
@@ -339,16 +341,21 @@ static noinstr int mce_severity_amd(struct mce *m, struct pt_regs *regs, char **if (((m->status &MCI_STATUS_OVER ) && !mce_flags.overflow_recov) || !mce_flags.succor) { + panic_msg ="Uncorrected unrecoverable error" ; ret =MCE_PANIC_SEVERITY ; goto amd_severity; }if (error_context (m, regs) ==IN_KERNEL ) { + panic_msg ="Uncorrected error in kernel context" ; ret =MCE_PANIC_SEVERITY ; } amd_severity: +if (msg && panic_msg) + *msg = panic_msg; +return ret; }
Signature · 1 line
2.31.1
Quoted 6 lines · Carlos Bilbao
This patchset includes grading of new types of machine errors on AMD's MCE grading logic
mce_severity_amd(), which helps the MCE handler determine what actions to take. If the error is graded as a PANIC, the EDAC driver will not decode; so we also include new error messages to describe the MCE and help debugging critical errors.
Quoted 9 lines
Changes since v1:
On patch 1/2, follow a simplified approach forseverity.c, that resembles the available PPR more closely. This also simplifies patch 2/2, as less panic error messages are added.Carlos Bilbao (2):
x86/mce: Extend AMD severity grading function with new types of errors x86/mce: Add messages to describe panic machine errors on AMD's MCEs grading
Oops...
Quoted 3 lines
arch/x86/include/asm/mce.h | 6 + arch/x86/kernel/cpu/mce/severity.c | 203 ++++++++++++++++++++++++----- 2 files changed, 174 insertions(+), 35 deletions(-)
I forgot to update this, my apologies! resending...
Quoted 1 line
Thanks,
Carlos