Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2865919rwe; Mon, 29 Aug 2022 01:23:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR64LmtrLOJO829p/QqhEDEA2rvqtsrRpTSUtmJtHBBAgqS0yxK2N9wv8hk7L4MiP+Xv1A/V X-Received: by 2002:a17:902:9887:b0:172:7090:6485 with SMTP id s7-20020a170902988700b0017270906485mr15348347plp.63.1661761395779; Mon, 29 Aug 2022 01:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661761395; cv=none; d=google.com; s=arc-20160816; b=EEcufkbCEhyZLB7sKBVw0fSjeXb9R1OOUviL9so4UK6LA4CEwx6viT8ZFcCmvmoijk oQqjV0sVscaaPUnon7IOvTHVL+38fkZnVDu1Q1zSayHnDQZRwDZLg0xYAZtTR9Bo9vSb OVo0dLiwTsfxmP6YtuWVSHdB0d8i63ATb3uiyxzyO90zugzjCyd9HrHSnNfdnOk/t4eT 3Mzp8qMrHyse5vhlGoW2o7ZbS3AciTyy7+xO/3VNnVbloCLteaTQS8u44+1Vq+BwFYnF mAy+ZpRq47B3Dr8tZM6r3Ge0x3v/ZPWD33lwnVIBZmg/iz+tS6yUXgudyv/TwvvCmKnH SEvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=FNkj2Cwu39FkpzSR+XX6CPYsrzYX8zE8OPeMOPRN6zk=; b=kKLxV+LkbX2KCKpiuATm4YFi6of0XX+4cBi1ImZLsETvBpcuQPSIr98kgrUu7HusQQ ZaDSrJpjFHfDozLd1sRKLXKE927BGKizZSTPNhjTre3dw24QZGTmLaL5sbi1Yc6RYjgk dyMG5ZjrlwTEiwRSs0vs9pr8xxhGJIEAwcPn1R1FnI5CtIPoTxzfNRCwrup8Jl8ttKG4 jtMzRKTsX3zvrHvrrmvrrzT+D08PQ+JdFQRAiEFA2NQFy8pz8YhU0zP5y79ss6aHznzo GFfXBUTQcO2Rpc70puDNX0PTj3rgmuPpbdoZmc9MGuADwo0F5DBtWWlA2HpMjJvho/C+ HqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EbWhfMiz; dkim=neutral (no key) header.i=@linutronix.de header.b=4XTY+mnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a170902758600b0016c40f8cb7dsi7870239pll.176.2022.08.29.01.23.04; Mon, 29 Aug 2022 01:23:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EbWhfMiz; dkim=neutral (no key) header.i=@linutronix.de header.b=4XTY+mnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbiH2ILi (ORCPT + 99 others); Mon, 29 Aug 2022 04:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiH2ILV (ORCPT ); Mon, 29 Aug 2022 04:11:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14BC50729; Mon, 29 Aug 2022 01:11:13 -0700 (PDT) Date: Mon, 29 Aug 2022 08:11:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1661760670; 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=FNkj2Cwu39FkpzSR+XX6CPYsrzYX8zE8OPeMOPRN6zk=; b=EbWhfMiz+xN1kQjsKbPWHLcYMupeeVHRinv36mP8dUEzRhJyOtbq9O9YfuAYgMQp3skCE/ gkozx3Cc+Pb736/c37e/LE8Q3LQ2brYuRY4ga22nIMvGRC7xe/klI1cBuS74Z3IzUhn7Sq bszLUJLUljPOtpXvgANEOMa06zdKHnMiIUF0QlOlFq6KVZ/7W98b3W2aOEr0U9mMKxVL5f MqoXnPYowDJy3cga5NMH1uVwyfCZrmcuK5hSgp1b86AvxoywaW9idTKtsSNmJ5gdTY7bPw TlJe6rPcxcjUo4YK6A0nZTQ3jnz5DfCFy0lGwY1NIoXFmPjslB2aalPXOPELTw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1661760670; 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=FNkj2Cwu39FkpzSR+XX6CPYsrzYX8zE8OPeMOPRN6zk=; b=4XTY+mnl7rG9LZI8CwixYx8SKUsNiesE+lDMolP65RxOjM2ePy3xlkAC5Wjbk20yJ53/AV 36TpDURbG8txy0Cw== From: "tip-bot2 for Jane Chu" 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: Retrieve poison range from hardware Cc: Jane Chu , Borislav Petkov , Dan Williams , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <7ed50fd8-521e-cade-77b1-738b8bfb8502@oracle.com> References: <7ed50fd8-521e-cade-77b1-738b8bfb8502@oracle.com> MIME-Version: 1.0 Message-ID: <166176066946.401.17043823201433426666.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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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: f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 Gitweb: https://git.kernel.org/tip/f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 Author: Jane Chu AuthorDate: Fri, 26 Aug 2022 17:38:51 -06:00 Committer: Borislav Petkov CommitterDate: Mon, 29 Aug 2022 09:33:42 +02:00 x86/mce: Retrieve poison range from hardware When memory poison consumption machine checks fire, MCE notifier handlers like nfit_handle_mce() record the impacted physical address range which is reported by the hardware in the MCi_MISC MSR. The error information includes data about blast radius, i.e. how many cachelines did the hardware determine are impacted. A recent change 7917f9cdb503 ("acpi/nfit: rely on mce->misc to determine poison granularity") updated nfit_handle_mce() to stop hard coding the blast radius value of 1 cacheline, and instead rely on the blast radius reported in 'struct mce' which can be up to 4K (64 cachelines). It turns out that apei_mce_report_mem_error() had a similar problem in that it hard coded a blast radius of 4K rather than reading the blast radius from the error information. Fix apei_mce_report_mem_error() to convey the proper poison granularity. Signed-off-by: Jane Chu Signed-off-by: Borislav Petkov Reviewed-by: Dan Williams Reviewed-by: Ingo Molnar Link: https://lore.kernel.org/r/7ed50fd8-521e-cade-77b1-738b8bfb8502@oracle.com Link: https://lore.kernel.org/r/20220826233851.1319100-1-jane.chu@oracle.com --- arch/x86/kernel/cpu/mce/apei.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c index 7171929..8ed3417 100644 --- a/arch/x86/kernel/cpu/mce/apei.c +++ b/arch/x86/kernel/cpu/mce/apei.c @@ -29,15 +29,26 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) { struct mce m; + int lsb; if (!(mem_err->validation_bits & CPER_MEM_VALID_PA)) return; + /* + * Even if the ->validation_bits are set for address mask, + * to be extra safe, check and reject an error radius '0', + * and fall back to the default page size. + */ + if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) + lsb = find_first_bit((void *)&mem_err->physical_addr_mask, PAGE_SHIFT); + else + lsb = PAGE_SHIFT; + mce_setup(&m); m.bank = -1; /* Fake a memory read error with unknown channel */ m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | MCI_STATUS_MISCV | 0x9f; - m.misc = (MCI_MISC_ADDR_PHYS << 6) | PAGE_SHIFT; + m.misc = (MCI_MISC_ADDR_PHYS << 6) | lsb; if (severity >= GHES_SEV_RECOVERABLE) m.status |= MCI_STATUS_UC;