From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964949AbdKGKTj (ORCPT ); Tue, 7 Nov 2017 05:19:39 -0500 Received: from terminus.zytor.com ([65.50.211.136]:34181 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752139AbdKGKTg (ORCPT ); Tue, 7 Nov 2017 05:19:36 -0500 Date: Tue, 7 Nov 2017 02:15:46 -0800 From: tip-bot for Yazen Ghannam Message-ID: Cc: tony.luck@intel.com, bp@suse.de, yazen.ghannam@amd.com, peterz@infradead.org, linux-kernel@vger.kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, linux-edac@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org Reply-To: mingo@kernel.org, torvalds@linux-foundation.org, linux-edac@vger.kernel.org, tglx@linutronix.de, yazen.ghannam@amd.com, peterz@infradead.org, linux-kernel@vger.kernel.org, hpa@zytor.com, bp@suse.de, tony.luck@intel.com In-Reply-To: <20171106174633.13576-1-bp@alien8.de> References: <20171106174633.13576-1-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:ras/core] x86/MCE/AMD: Always give panic severity for UC errors in kernel context Git-Commit-ID: d65dfc81bb3894fdb68cbc74bbf5fb48d2354071 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d65dfc81bb3894fdb68cbc74bbf5fb48d2354071 Gitweb: https://git.kernel.org/tip/d65dfc81bb3894fdb68cbc74bbf5fb48d2354071 Author: Yazen Ghannam AuthorDate: Mon, 6 Nov 2017 18:46:32 +0100 Committer: Ingo Molnar CommitDate: Tue, 7 Nov 2017 11:07:50 +0100 x86/MCE/AMD: Always give panic severity for UC errors in kernel context The AMD severity grading function was introduced in kernel 4.1. The current logic can possibly give MCE_AR_SEVERITY for uncorrectable errors in kernel context. The system may then get stuck in a loop as memory_failure() will try to handle the bad kernel memory and find it busy. Return MCE_PANIC_SEVERITY for all UC errors IN_KERNEL context on AMD systems. After: b2f9d678e28c ("x86/mce: Check for faults tagged in EXTABLE_CLASS_FAULT exception table entries") was accepted in v4.6, this issue was masked because of the tail-end attempt at kernel mode recovery in the #MC handler. However, uncorrectable errors IN_KERNEL context should always be considered unrecoverable and cause a panic. Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov Cc: # 4.9.x Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tony Luck Cc: linux-edac Fixes: bf80bbd7dcf5 (x86/mce: Add an AMD severities-grading function) Link: http://lkml.kernel.org/r/20171106174633.13576-1-bp@alien8.de Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/mcheck/mce-severity.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c index 87cc9ab..4b81876 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c @@ -245,6 +245,9 @@ static int mce_severity_amd(struct mce *m, int tolerant, char **msg, bool is_exc if (m->status & MCI_STATUS_UC) { + if (ctx == IN_KERNEL) + return MCE_PANIC_SEVERITY; + /* * On older systems where overflow_recov flag is not present, we * should simply panic if an error overflow occurs. If @@ -255,10 +258,6 @@ static int mce_severity_amd(struct mce *m, int tolerant, char **msg, bool is_exc if (mce_flags.smca) return mce_severity_amd_smca(m, ctx); - /* software can try to contain */ - if (!(m->mcgstatus & MCG_STATUS_RIPV) && (ctx == IN_KERNEL)) - return MCE_PANIC_SEVERITY; - /* kill current process */ return MCE_AR_SEVERITY; } else {