[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230916130316.65815-8-xueshuai@linux.alibaba.com>
Date: Sat, 16 Sep 2023 21:03:14 +0800
From: Shuai Xue <xueshuai@...ux.alibaba.com>
To: keescook@...omium.org, tony.luck@...el.com, gpiccoli@...lia.com,
rafael@...nel.org, lenb@...nel.org, james.morse@....com,
bp@...en8.de, tglx@...utronix.de, mingo@...hat.com,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
ardb@...nel.org, robert.moore@...el.com
Cc: linux-hardening@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-edac@...r.kernel.org,
linux-efi@...r.kernel.org, acpica-devel@...ts.linuxfoundation.org,
xueshuai@...ux.alibaba.com, baolin.wang@...ux.alibaba.com
Subject: [RFC PATCH 7/9] ACPI: APEI: ESRT: kick ghes_report_chain notifier to report serialized memory errors
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 <xueshuai@...ux.alibaba.com>
---
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 f789e3df73a9..665b8f93dab3 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -26,6 +26,7 @@
#include <linux/vmalloc.h>
#include <linux/mm.h> /* kvfree() */
#include <acpi/apei.h>
+#include <acpi/ghes.h>
/* only define CREATE_TRACE_POINTS once */
#include <trace/events/mce.h>
@@ -1068,6 +1069,10 @@ static ssize_t erst_reader(struct pstore_record *record)
else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) {
trace_mce_record((struct mce *)rcd->data);
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
};
--
2.41.0
Powered by blists - more mailing lists