From patchwork Mon Sep 25 07:44:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1052109vqu; Mon, 25 Sep 2023 01:14:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRoWIcSXgXxJKeMFgjmD8ScsI8mjzcSm1KjVDyVVgMtSMrHevNZ/moxT2Cj+5KvkJvWhKI X-Received: by 2002:a05:6a00:1d18:b0:68f:be13:6c16 with SMTP id a24-20020a056a001d1800b0068fbe136c16mr7181974pfx.2.1695629694187; Mon, 25 Sep 2023 01:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629694; cv=none; d=google.com; s=arc-20160816; b=dF4VoW/lq+v0S9rCHEB35ety8wDAMXwqS9KYl3HMlgKkTSCcMQrvB1w1mJtSUvmWAB ejbXKoA9YucO37QfDgmIIHK24pLQUW6hbKNs5/n30zknOXzxUEOjD42Jc/ZmPBC8A5jd Z49lfEH3Lf/CW9HhSZsqqm42Q7GLKzo2fszlxdvL5z+eXiWaIa+YxWkRjGiSrplauq+I 3bCZaeJHZm8NXlX2H3xXTdx5yqLMooE1pOS0sV320vFkVh2AwJwaU74Ryl7imvnYBSPO 5OM1DndroNBTAl2rwH0pGORXE7YjOpw6Ednr4ZBBtgevcfbANyZK41Z59ajCLzObjVdu +yJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=57fH6m3mujKBOG6QFM7l0e+IGEzQP3AdayBX+e2YKQU=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=UE8qZieSiMc8wbRHW6s4OKiEtoVHUGvmtq8x8YOorARk+fO70heLUjw54J3dpi27G4 20dtVZ3rWNHzy7v2ZWm2bFgyDFpznEs9x0Uwa5JTUvjC/2DP+iMjFQKB/NaH2AbaVgzg X4CoV8meDq36I9RagpmboulbhyOLTwIlQdbTCF3kjjFpPutX1U9ORqpyPu4WdMPxmAzB 8lW8SKxLhjQ4OB7z8Pia/gGNX9F/+Ayc6CnrNMdWrPAYqVuXuxCNkK1TQDW3PKa+PFlg pfaYrWASr05xtfaUYpCdNqPDYnMaego/eD0p6OoghycTtZH83O2IN7OGDoO8FVHBJiCs CBJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m8-20020a056a00080800b0068fa8499af1si9973866pfk.11.2023.09.25.01.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:14:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6800A82A41FA; Mon, 25 Sep 2023 00:45:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbjIYHpD (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232466AbjIYHov (ORCPT ); Mon, 25 Sep 2023 03:44:51 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CB2DA; Mon, 25 Sep 2023 00:44:42 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R831e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt-0_1695627876; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt-0_1695627876) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:37 +0800 From: Shuai Xue To: keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com, rafael@kernel.org, lenb@kernel.org, james.morse@arm.com, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, robert.moore@intel.com Cc: linux-hardening@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-efi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, xueshuai@linux.alibaba.com, baolin.wang@linux.alibaba.com Subject: [RFC PATCH v2 3/9] ACPI: APEI: ERST: Emit the mce_record tracepoint Date: Mon, 25 Sep 2023 15:44:20 +0800 Message-Id: <20230925074426.97856-4-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230925074426.97856-1-xueshuai@linux.alibaba.com> References: <20230925074426.97856-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996602066168960 X-GMAIL-MSGID: 1777996602066168960 After /dev/mcelog character device deprecated by commit 5de97c9f6d85 ("x86/mce: Factor out and deprecate the /dev/mcelog driver"), the serialized hardware error log, a.k.a MCE record, of previous boot in persistent storage is not collected via APEI ERST. Emit the mce_record tracepoint so that it can consumed by the new generation rasdaemon. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 528ac5eb4871..82f57aaf89ad 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -26,6 +26,10 @@ #include #include /* kvfree() */ #include +#ifdef CONFIG_X86_MCE +/* only define CREATE_TRACE_POINTS once */ +#include +#endif #include "apei-internal.h" @@ -1063,8 +1067,12 @@ static ssize_t erst_reader(struct pstore_record *record) record->compressed = true; } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG)) record->type = PSTORE_TYPE_DMESG; - else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) + else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) { +#ifdef CONFIG_X86_MCE + trace_mce_record((struct mce *)rcd->data); +#endif record->type = PSTORE_TYPE_MCE; + } else record->type = PSTORE_TYPE_MAX;