Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3895878yba; Tue, 23 Apr 2019 11:21:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQm+OdwpHKxIMIJZ+1yBgE7IL9PfOxvQnUY/q2jdyUnImFbYsy8/73VDUARLF688q65Aa5 X-Received: by 2002:a63:c302:: with SMTP id c2mr26355457pgd.235.1556043666429; Tue, 23 Apr 2019 11:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556043666; cv=none; d=google.com; s=arc-20160816; b=Rg07wAzeS6XLdXD28F6L+pN0E6H/h4XISA4pmJVPtUjiAh2Us6IHsTZnrP7oMYvGfB EfxL2J7Yp6eg9mnMdA1BSpefFzama5ROZXKXAJUB4Azndrk0yn+PlGY4cT8aENWI7BGJ 3twQh7waVvA203qqZe9jVwWpNmmBgV2LTZ912DnWcKoIx1Mh2CkyorB/GNzIelBFHIls CgmteJpIfsKYXTQUcNCHDhaoI8t6ujp7FK9vDWAjTNt0h+IG8bj+li0j5Jnsx+OpawiB JzTLyXjgF8A9nvGz2LGAuJWwgfx24a9Kvh14RRVotvt0ELw66/JHnpUMyx47pkPY5Py+ f9Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=BSsOEMwVxZx0AA71pToWRkMowGhYUoQwJsg7muj5cqc=; b=PAlKGwfSQCBoMy4c4sLnViuD0LNFYKvkpxxEORZGzZ75oFyok9mZy6IPqSMBQZ+Ke2 cUgnBtTBUUkK2EWySvYgy6QVWAy592BFOA853Hj8O6kteW9T/78pYmJCSltEGlIRz2sX rqijXFu3kX8vqQXpONPvLa7L1B+QaVbJVKMKfJglOhCu9OUMmxE7/ynzCaJ5++tCjckM n7NSxODJ26orCEx3hAoMFndDPR21k6syQ0AGRXWvYg0Nc5Nho3/02egIkcQ0AWTc3Lr+ 7u8z9PXD3C56ElE7wLJ2k7jrdwn29hchGSpcLJbSLHh+roaY2iR7/A4vF9hyXGe8J0WT 82Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=Ambwp4oD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si15372116pgh.448.2019.04.23.11.20.51; Tue, 23 Apr 2019 11:21:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=Ambwp4oD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726075AbfDWSUC (ORCPT + 99 others); Tue, 23 Apr 2019 14:20:02 -0400 Received: from terminus.zytor.com ([198.137.202.136]:39113 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfDWSUB (ORCPT ); Tue, 23 Apr 2019 14:20:01 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x3NIJ9Zq2224630 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 23 Apr 2019 11:19:09 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x3NIJ9Zq2224630 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019041745; t=1556043550; bh=BSsOEMwVxZx0AA71pToWRkMowGhYUoQwJsg7muj5cqc=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=Ambwp4oDZ82jZEKihOVByVjera0e5qNW4mnWN4lUCUwlJnqEm1N6E/CE+GbsfDrOh dyHaVBtAJVP7UsOc76E/tDIAQzMpQCli+6Gq4+IP6hoz3liRR7TwrntkiJPf/UVcV2 1btUU/WRq91oTbjFZTXfaBHhAqD+ChHJfEkn63XITpo2mI1eNY+clphFP+QIBJ6LZp A0h8fiRJn/HPDivU6/gskMh1rytOKbT6kcbs+02qVheZBtndqxTa6vUnJR833o0wbE +NOjo9pTtpcKyZAKMG65ShP58qADVH1fQA2CDj74idhnEzwOq0ELZLyP/crVmXNyON /cpXKeBxdYr6w== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x3NIJ7022224625; Tue, 23 Apr 2019 11:19:07 -0700 Date: Tue, 23 Apr 2019 11:19:07 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Yazen Ghannam Message-ID: Cc: x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, rafal@milecki.pl, tglx@linutronix.de, mingo@kernel.org, tony.luck@intel.com, hpa@zytor.com, Shirish.S@amd.com, arnd@arndb.de, vishal.l.verma@intel.com, puwen@hygon.cn, qiuxu.zhuo@intel.com, bp@suse.de, yazen.ghannam@amd.com, clemej@gmail.com Reply-To: x86@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, rafal@milecki.pl, mingo@kernel.org, tglx@linutronix.de, tony.luck@intel.com, hpa@zytor.com, Shirish.S@amd.com, vishal.l.verma@intel.com, puwen@hygon.cn, arnd@arndb.de, qiuxu.zhuo@intel.com, yazen.ghannam@amd.com, bp@suse.de, clemej@gmail.com In-Reply-To: <20190325163410.171021-1-Yazen.Ghannam@amd.com> References: <20190325163410.171021-1-Yazen.Ghannam@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:ras/core] x86/MCE: Add an MCE-record filtering function Git-Commit-ID: 45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f 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 X-Spam-Status: No, score=1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF,FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f Gitweb: https://git.kernel.org/tip/45d4b7b9cb88526f6d5bd4c03efab88d75d10e4f Author: Yazen Ghannam AuthorDate: Mon, 25 Mar 2019 16:34:22 +0000 Committer: Borislav Petkov CommitDate: Tue, 23 Apr 2019 18:04:47 +0200 x86/MCE: Add an MCE-record filtering function Some systems may report spurious MCA errors. In general, spurious MCA errors may be disabled by clearing a particular bit in MCA_CTL. However, clearing a bit in MCA_CTL may not be recommended for some errors, so the only option is to ignore them. An MCA error is printed and handled after it has been added to the MCE event pool. So an MCA error can be ignored by not adding it to that pool in the first place. Add such a filtering function. [ bp: Move function prototype to the internal header and massage. ] Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov Cc: Arnd Bergmann Cc: "clemej@gmail.com" Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Pu Wen Cc: Qiuxu Zhuo Cc: "rafal@milecki.pl" Cc: Shirish S Cc: # 5.0.x Cc: Thomas Gleixner Cc: Tony Luck Cc: Vishal Verma Cc: x86-ml Link: https://lkml.kernel.org/r/20190325163410.171021-1-Yazen.Ghannam@amd.com --- arch/x86/kernel/cpu/mce/core.c | 5 +++++ arch/x86/kernel/cpu/mce/genpool.c | 3 +++ arch/x86/kernel/cpu/mce/internal.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 3e081428117c..80b8c6bff8ed 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1775,6 +1775,11 @@ static void __mcheck_cpu_init_timer(void) mce_start_timer(t); } +bool filter_mce(struct mce *m) +{ + return false; +} + /* Handle unconfigured int18 (should never happen) */ static void unexpected_machine_check(struct pt_regs *regs, long error_code) { diff --git a/arch/x86/kernel/cpu/mce/genpool.c b/arch/x86/kernel/cpu/mce/genpool.c index 3395549c51d3..64d1d5a00f39 100644 --- a/arch/x86/kernel/cpu/mce/genpool.c +++ b/arch/x86/kernel/cpu/mce/genpool.c @@ -99,6 +99,9 @@ int mce_gen_pool_add(struct mce *mce) { struct mce_evt_llist *node; + if (filter_mce(mce)) + return -EINVAL; + if (!mce_evt_pool) return -EINVAL; diff --git a/arch/x86/kernel/cpu/mce/internal.h b/arch/x86/kernel/cpu/mce/internal.h index af5eab1e65e2..b822a645395d 100644 --- a/arch/x86/kernel/cpu/mce/internal.h +++ b/arch/x86/kernel/cpu/mce/internal.h @@ -173,4 +173,7 @@ struct mca_msr_regs { extern struct mca_msr_regs msr_ops; +/* Decide whether to add MCE record to MCE event pool or filter it out. */ +extern bool filter_mce(struct mce *m); + #endif /* __X86_MCE_INTERNAL_H__ */