Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4549719ybb; Tue, 7 Apr 2020 09:35:24 -0700 (PDT) X-Google-Smtp-Source: APiQypIOg4q0Fp+cufvrvBhZlcDBzFdgUVNYH/SiKK/40tZLRE8Ett3oLUt4sGnU56u3hEtepc3u X-Received: by 2002:a05:6830:16cc:: with SMTP id l12mr2322699otr.172.1586277323859; Tue, 07 Apr 2020 09:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586277323; cv=none; d=google.com; s=arc-20160816; b=acBjAsuGqkI/1pBITbQw3GIHq7KH/5hKlnTWV5FFzgX2nr0aHuRb7rZ4oFLmt5o4V1 8eQk/23V/zeUb85bO6kuOO3qyzv+D3b4A90j2Mbu9kP4mL6H4hfcZHUbfjDyd57y+Xyy XJhKurocn9RKZswiUmhu6txm2US9fYR1tdFUthyR61851Y+AKdfieF0V2pynbKmeRreu +uFKlTKLm3qSZGw0Y+BVNjLc3ln8psbqePhjTc1+Fjq86ZeGaAib8uYZlwyzULw+PqRh 4XaU+LaGMp8fsYo3npWzYCUCSpOxTN3KDndPGHZZlrT28B5/Q3sV/lnjiGZxIJ++6ZFr cPxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qu6nhacTkj3XLSwwbnceRykoEnFbvqIecSTSJvAabgI=; b=AtpnfPqYEjvTQXGZMNHzuPwYzbvs6YLW7tK5YIv775oI3nEUoSibrw5b1sh0pZGmo6 sRQCSZmxFujbQ1SwtjKm05Fz0J29b9tRpFuV2eY0bWOAsZCPt1X9cqsmhb5Aad2Wn0kv R2KU0vG9Pm4Y+TXtuAxd7hpWYk4fJ1hlB2i9BZC0V0o8Em+zGxIXMv3jAamNoPLhKRMd BDqN/7vL8qbcs+/S8r4Rxq/aRMUa85SPtJoADlunI9kL7dp6iZLikR4qH9gwwo7iEYi4 k6huvD4DnSUHVJqzZC8+3LLfguSdunO9YOxIDdE9gViO1GhmtaQEdzEu7GvKBuVM4Mhy XO8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TxL8D42D; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si1465548otl.78.2020.04.07.09.35.11; Tue, 07 Apr 2020 09:35:23 -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=@alien8.de header.s=dkim header.b=TxL8D42D; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728480AbgDGQe1 (ORCPT + 99 others); Tue, 7 Apr 2020 12:34:27 -0400 Received: from mail.skyhub.de ([5.9.137.197]:53930 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728259AbgDGQeZ (ORCPT ); Tue, 7 Apr 2020 12:34:25 -0400 Received: from zn.tnic (p200300EC2F0B2700A94266E658FF3DDD.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:2700:a942:66e6:58ff:3ddd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 175DA1EC0CE2; Tue, 7 Apr 2020 18:34:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1586277265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qu6nhacTkj3XLSwwbnceRykoEnFbvqIecSTSJvAabgI=; b=TxL8D42DIubIxCwqJ8nG7KXoAU7vDrIxKBOFQOfQSDrdxeMCPZM2gw3X9KwRgQPlNLiLhk 0P9zPBRKBXD+cqwg7DfFeoLhxXzwzoNlHCxXYFwAROmhKWxvQQjYQnveJFv5kJlJ38+240 LpIPH0PI26u4UYB6YL8SOmLZbhPWAjY= From: Borislav Petkov To: Tony Luck Cc: Yazen Ghannam , X86 ML , LKML Subject: [PATCH 6/9] x86/mce: Change default MCE logger to check mce->kflags Date: Tue, 7 Apr 2020 18:34:11 +0200 Message-Id: <20200407163414.18058-7-bp@alien8.de> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200407163414.18058-1-bp@alien8.de> References: <20200212204652.1489-1-tony.luck@intel.com> <20200407163414.18058-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Luck Instead of keeping count of how many handlers are registered on the MCE notifier chain and printing if below some magic value, look at mce->kflags to see if anyone claims to have handled/logged this error. [ bp: Do not print ->kflags in __print_mce(). ] Signed-off-by: Tony Luck Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20200214222720.13168-6-tony.luck@intel.com --- arch/x86/kernel/cpu/mce/core.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 5666a48a4bc9..fc879b6669d5 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -158,29 +158,17 @@ void mce_log(struct mce *m) } EXPORT_SYMBOL_GPL(mce_log); -/* - * We run the default notifier if we have only the UC, the first and the - * default notifier registered. I.e., the mandatory NUM_DEFAULT_NOTIFIERS - * notifiers registered on the chain. - */ -#define NUM_DEFAULT_NOTIFIERS 3 -static atomic_t num_notifiers; - void mce_register_decode_chain(struct notifier_block *nb) { if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC)) return; - atomic_inc(&num_notifiers); - blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); } EXPORT_SYMBOL_GPL(mce_register_decode_chain); void mce_unregister_decode_chain(struct notifier_block *nb) { - atomic_dec(&num_notifiers); - blocking_notifier_chain_unregister(&x86_mce_decoder_chain, nb); } EXPORT_SYMBOL_GPL(mce_unregister_decode_chain); @@ -263,6 +251,7 @@ static void __print_mce(struct mce *m) } pr_cont("\n"); + /* * Note this output is parsed by external tools and old fields * should not be changed. @@ -602,10 +591,8 @@ static int mce_default_notifier(struct notifier_block *nb, unsigned long val, if (!m) return NOTIFY_DONE; - if (atomic_read(&num_notifiers) > NUM_DEFAULT_NOTIFIERS) - return NOTIFY_DONE; - - __print_mce(m); + if (!m->kflags) + __print_mce(m); return NOTIFY_DONE; } -- 2.21.0