Skip to content

Commit f6ec01d

Browse files
aeglrafaeljw
authored andcommitted
ACPI: extlog: Handle multiple records
If there is no user space consumer of extlog_mem trace records, then Linux properly handles multiple error records in an ELOG block extlog_print() print_extlog_rcd() __print_extlog_rcd() cper_estatus_print() apei_estatus_for_each_section() But the other code path hard codes looking for a single record to output a trace record. Fix by using the same apei_estatus_for_each_section() iterator to step over all records. Fixes: 2dfb7d5 ("trace, RAS: Add eMCA trace event interface") Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 3a1e24f commit f6ec01d

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

drivers/acpi/acpi_extlog.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/ratelimit.h>
1313
#include <linux/edac.h>
1414
#include <linux/ras.h>
15+
#include <acpi/ghes.h>
1516
#include <asm/cpu.h>
1617
#include <asm/mce.h>
1718

@@ -138,8 +139,8 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
138139
int cpu = mce->extcpu;
139140
struct acpi_hest_generic_status *estatus, *tmp;
140141
struct acpi_hest_generic_data *gdata;
141-
const guid_t *fru_id = &guid_null;
142-
char *fru_text = "";
142+
const guid_t *fru_id;
143+
char *fru_text;
143144
guid_t *sec_type;
144145
static u32 err_seq;
145146

@@ -160,17 +161,23 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
160161

161162
/* log event via trace */
162163
err_seq++;
163-
gdata = (struct acpi_hest_generic_data *)(tmp + 1);
164-
if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
165-
fru_id = (guid_t *)gdata->fru_id;
166-
if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
167-
fru_text = gdata->fru_text;
168-
sec_type = (guid_t *)gdata->section_type;
169-
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
170-
struct cper_sec_mem_err *mem = (void *)(gdata + 1);
171-
if (gdata->error_data_length >= sizeof(*mem))
172-
trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
173-
(u8)gdata->error_severity);
164+
apei_estatus_for_each_section(tmp, gdata) {
165+
if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
166+
fru_id = (guid_t *)gdata->fru_id;
167+
else
168+
fru_id = &guid_null;
169+
if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
170+
fru_text = gdata->fru_text;
171+
else
172+
fru_text = "";
173+
sec_type = (guid_t *)gdata->section_type;
174+
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
175+
struct cper_sec_mem_err *mem = (void *)(gdata + 1);
176+
177+
if (gdata->error_data_length >= sizeof(*mem))
178+
trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
179+
(u8)gdata->error_severity);
180+
}
174181
}
175182

176183
out:

0 commit comments

Comments
 (0)