From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B152AC64E7A for ; Tue, 1 Dec 2020 18:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D45C20870 for ; Tue, 1 Dec 2020 18:06:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LIOLsPOC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5BFZps99" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731216AbgLASGh (ORCPT ); Tue, 1 Dec 2020 13:06:37 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:56990 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731200AbgLASGg (ORCPT ); Tue, 1 Dec 2020 13:06:36 -0500 Date: Tue, 01 Dec 2020 18:05:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606845955; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b5EDvSPHvskDxUgyAC2Rw9tH9IB/qoZKyzedWH6Khf4=; b=LIOLsPOCe9NY2Uh9MOrAVLaomZ6jEh4/CxMavZ9RIe419hqua+xkX7Aw+mT8AcZwJx7wEd dLMLavo867OG9AnF+NwTZ/R/RZCiJQAg8+9Xi0MsU+DFFO4jDQDqgIMcKyTGi373SqsWcU onl1ErA78rqNRwZwugN2BHtTuA9OADeNwoB7yoNfhr7X3OvRksukEs1Fqh8P0pMmw5+bYZ 7lU1ZJUFocx78eJ1Su7q/5gb+FvMRSkA+9I2RgYkt5K5qb1g7T2/VgNyE/Pf24wQ81rtMk VwtloacV/bW5c2AwFknRDX2PdBw+obQulwiOaVNwRikArHqCWDNKYQvPeR7JAw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606845955; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b5EDvSPHvskDxUgyAC2Rw9tH9IB/qoZKyzedWH6Khf4=; b=5BFZps99XGvuzvtdE9oPyA8LlAo9/e7oLAp+X3bZEYFHe8BdOl74wc0yfQVch8uSanpupX ByU1N5AbZGQ3CvDg== From: "tip-bot2 for Gabriele Paoloni" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: ras/core] x86/mce: Move the mce_panic() call and 'kill_it' assignments to the right places Cc: Gabriele Paoloni , Borislav Petkov , Tony Luck , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201127161819.3106432-3-gabriele.paoloni@intel.com> References: <20201127161819.3106432-3-gabriele.paoloni@intel.com> MIME-Version: 1.0 Message-ID: <160684595453.3364.1024480763721674702.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the ras/core branch of tip: Commit-ID: e273e6e12ab1db3eb57712bd60655744d0091fa3 Gitweb: https://git.kernel.org/tip/e273e6e12ab1db3eb57712bd60655744d0091fa3 Author: Gabriele Paoloni AuthorDate: Fri, 27 Nov 2020 16:18:16 Committer: Borislav Petkov CommitterDate: Tue, 01 Dec 2020 18:45:56 +01:00 x86/mce: Move the mce_panic() call and 'kill_it' assignments to the right places Right now, for local MCEs the machine calls panic(), if needed, right after lmce is set. For MCE broadcasting, mce_reign() takes care of calling mce_panic(). Hence: - improve readability by moving the conditional evaluation of tolerant up to when kill_it is set first; - move the mce_panic() call up into the statement where mce_end() fails. [ bp: Massage, remove comment in the mce_end() failure case because it is superfluous; use local ptr 'cfg' in both tests. ] Signed-off-by: Gabriele Paoloni Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Link: https://lkml.kernel.org/r/20201127161819.3106432-3-gabriele.paoloni@intel.com --- arch/x86/kernel/cpu/mce/core.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index f319bed..ebaa52a 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1351,8 +1351,7 @@ noinstr void do_machine_check(struct pt_regs *regs) * severity is MCE_AR_SEVERITY we have other options. */ if (!(m.mcgstatus & MCG_STATUS_RIPV)) - kill_it = 1; - + kill_it = (cfg->tolerant == 3) ? 0 : 1; /* * Check if this MCE is signaled to only this logical processor, * on Intel, Zhaoxin only. @@ -1388,6 +1387,9 @@ noinstr void do_machine_check(struct pt_regs *regs) if (mce_end(order) < 0) { if (!no_way_out) no_way_out = worst >= MCE_PANIC_SEVERITY; + + if (no_way_out && cfg->tolerant < 3) + mce_panic("Fatal machine check on current CPU", &m, msg); } } else { /* @@ -1404,15 +1406,6 @@ noinstr void do_machine_check(struct pt_regs *regs) } } - /* - * If tolerant is at an insane level we drop requests to kill - * processes and continue even when there is no way out. - */ - if (cfg->tolerant == 3) - kill_it = 0; - else if (no_way_out) - mce_panic("Fatal machine check on current CPU", &m, msg); - if (worst > 0) irq_work_queue(&mce_irq_work);