From patchwork Mon Sep 25 07:44:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1045021vqu; Mon, 25 Sep 2023 00:58:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoczeTc9GDsGC61OXdbAk062s8Dj99e4jTdQ5HXLjgfOHDPYtF6ErY8zF30ARtcdMeUAyK X-Received: by 2002:a05:6a00:14cc:b0:68f:cbd3:5b01 with SMTP id w12-20020a056a0014cc00b0068fcbd35b01mr16169006pfu.13.1695628735800; Mon, 25 Sep 2023 00:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695628735; cv=none; d=google.com; s=arc-20160816; b=zYgBGZrZO6mVV5zv/l3slRVdjBVfsAyn2V6OwGmVGQmcFlbhRaN1t0vW71UCNz8NPF nriHXzNyg2Uy+QKEvENDa2qHTKU5jAdmENWCvigfQAScajbTeI6egyxdnQRyHP4DQdYH 8AUzlBniUjAQTjDD41DJVkc6doBmI3wc0s1l3JYJeWLm3wD894oedFOnajX7Gf5wgndd uHdPJE+V9VQ0FWmfRDTfm+Dfem789/MMM7b84r9x/azgRgMX2XFHnpqP09Ih4pGKvgXR +4t0jVoGi8HIqiRUne1B6dl6Uol01BPzz2k51HclILds8qc/Hq1WUy8gTF0ZhP0HHThh a/ZQ== 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=luepcWIOq11Tj83EMNBB7SiwW/Igtjbae4eTlbz6RvE=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=JSsCreXFsnFvY8yQ6f5CB5zrtf5Am52HvdcffUN1Jv99KJu6PusWISFNFK5fHcb1r0 S1vWvjfn29xwpSVxHCZHqkdpu2GCSKbdFckt6pfhzecfCEYsaFtt9aGlE4oEuoTKB2qS DNMGvnAmm2XMM8GaLHbhfzw8U7qVbsCOEnHjiEe9iJMjJfIwl9ChW+DQbHW55C+vN3l9 lrc2+k0B3mZnkOfI9bnQTgwhdWSkPwVMZQ4vVcGYBfP/ur+ASIIAjKknvD45XVQepjFh DldWpSZPVff88NxSvx4v+5fnNgKfH3Qd9DpdnyUQV1j42fFK4r74tVJDd0vKJ1xhTMZb DfiQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id cf4-20020a056a02084400b00578b2728aa4si9037409pgb.129.2023.09.25.00.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 906DC805F2F4; Mon, 25 Sep 2023 00:45:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbjIYHpV (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbjIYHpQ (ORCPT ); Mon, 25 Sep 2023 03:45:16 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69EB196; Mon, 25 Sep 2023 00:44:49 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R451e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt1q_1695627884; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt1q_1695627884) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:45 +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 7/9] ACPI: APEI: ESRT: kick ghes_report_chain notifier to report serialized memory errors Date: Mon, 25 Sep 2023 15:44:24 +0800 Message-Id: <20230925074426.97856-8-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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777995597213188930 X-GMAIL-MSGID: 1777995597213188930 Introduce a new pstore_record type, PSTORE_TYPE_CPER_MEM, so that serialized memory errors can be retrieved and saved as a file in pstore file system. While the serialized errors is retrieved from ERST backend, kick ghes_report_chain notifier. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 5 +++++ fs/pstore/platform.c | 1 + include/linux/pstore.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 82f57aaf89ad..786d46c767ee 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -26,6 +26,7 @@ #include #include /* kvfree() */ #include +#include #ifdef CONFIG_X86_MCE /* only define CREATE_TRACE_POINTS once */ #include @@ -1072,6 +1073,10 @@ static ssize_t erst_reader(struct pstore_record *record) trace_mce_record((struct mce *)rcd->data); #endif record->type = PSTORE_TYPE_MCE; + } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SEC_PLATFORM_MEM)) { + record->type = PSTORE_TYPE_CPER_MEM; + arch_apei_report_mem_error(0x2, (struct cper_sec_mem_err *)rcd->data); + atomic_notifier_call_chain(&ghes_report_chain, 0x2, rcd->data); } else record->type = PSTORE_TYPE_MAX; diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index e5bca9a004cc..4e63ac8be755 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -51,6 +51,7 @@ static const char * const pstore_type_names[] = { "powerpc-common", "pmsg", "powerpc-opal", + "cper-mem", }; static int pstore_new_entry; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index ad44b3baf10e..d18ecaacd1b5 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -40,6 +40,9 @@ enum pstore_type_id { PSTORE_TYPE_PMSG = 7, PSTORE_TYPE_PPC_OPAL = 8, + /* APEI section */ + PSTORE_TYPE_CPER_MEM = 9, + /* End of the list */ PSTORE_TYPE_MAX };