From patchwork Wed Jan 6 17:41:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 12001983 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=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 2DB0BC433DB for ; Wed, 6 Jan 2021 17:42:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED8022312C for ; Wed, 6 Jan 2021 17:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbhAFRlo (ORCPT ); Wed, 6 Jan 2021 12:41:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727372AbhAFRln (ORCPT ); Wed, 6 Jan 2021 12:41:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 743C220657; Wed, 6 Jan 2021 17:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609954862; bh=5mBzpcki8s13JoLZB9q1DzsiGE9pAlVtbJL3csiyLlk=; h=Date:From:To:Cc:Subject:Reply-To:From; b=RZix4m1or5LxS71QbCslkQcSrXjcL3Aefbty6iy5F4p8HTvEtVVJV32XQmhMnkUks BUrZt8Nxm6NHbaACmAPMvrv3aqvJg0cKocZHU8pOY2963YgIeuJ4Gi6j2BqYa+0HBW gQAT0zCIqLprqSSou0XCbyFkCSn5dl+8LXaheEu5PGu4Hqmc9Cjf4lenDmrHSRMOPG Ls7zLd75bt+bLEc5oj8sgYCMVZrszlx2SBu0SQQPlWi8VLrXiEbZAsth2aeaifYsU5 9lLJz3dQRfTXUmpos02buSM8cAnQfsnHY2NNd2lkobGJlm9kBfVagF4SMVjbYWYx87 n6WE8wn1oA+sQ== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 3C0FA35225EC; Wed, 6 Jan 2021 09:41:02 -0800 (PST) Date: Wed, 6 Jan 2021 09:41:02 -0800 From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-edac@vger.kernel.org Cc: tony.luck@intel.com, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, kernel-team@fb.com Subject: [PATCH RFC x86/mce] Make mce_timed_out() identify holdout CPUs Message-ID: <20210106174102.GA23874@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The "Timeout: Not all CPUs entered broadcast exception handler" message will appear from time to time given enough systems, but this message does not identify which CPUs failed to enter the broadcast exception handler. This information would be valuable if available, for example, in order to correlated with other hardware-oriented error messages. This commit therefore maintains a cpumask_t of CPUs that have entered this handler, and prints out which ones failed to enter in the event of a timeout. Build-tested only. Cc: Tony Luck Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Cc: Reported-by: Jonathan Lemon Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney Tested-by: Tony Luck diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 13d3f1c..44d2b99 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -878,6 +878,12 @@ static atomic_t mce_executing; static atomic_t mce_callin; /* + * Track which CPUs entered and not in order to print holdouts. + */ +static cpumask_t mce_present_cpus; +static cpumask_t mce_missing_cpus; + +/* * Check if a timeout waiting for other CPUs happened. */ static int mce_timed_out(u64 *t, const char *msg) @@ -894,8 +900,12 @@ static int mce_timed_out(u64 *t, const char *msg) if (!mca_cfg.monarch_timeout) goto out; if ((s64)*t < SPINUNIT) { - if (mca_cfg.tolerant <= 1) + if (mca_cfg.tolerant <= 1) { + if (!cpumask_andnot(&mce_missing_cpus, cpu_online_mask, &mce_present_cpus)) + pr_info("%s: MCE holdout CPUs: %*pbl\n", + __func__, cpumask_pr_args(&mce_missing_cpus)); mce_panic(msg, NULL, NULL); + } cpu_missing = 1; return 1; } @@ -1006,6 +1016,7 @@ static int mce_start(int *no_way_out) * is updated before mce_callin. */ order = atomic_inc_return(&mce_callin); + cpumask_set_cpu(smp_processor_id(), &mce_present_cpus); /* * Wait for everyone. @@ -1114,6 +1125,7 @@ static int mce_end(int order) reset: atomic_set(&global_nwo, 0); atomic_set(&mce_callin, 0); + cpumask_clear(&mce_present_cpus); barrier(); /* @@ -2712,6 +2724,7 @@ static void mce_reset(void) atomic_set(&mce_executing, 0); atomic_set(&mce_callin, 0); atomic_set(&global_nwo, 0); + cpumask_clear(&mce_present_cpus); } static int fake_panic_get(void *data, u64 *val)