[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240705102517.79689-1-junichi.nomura@nec.com>
Date: Fri, 5 Jul 2024 10:25:20 +0000
From: NOMURA JUNICHI(野村 淳一)
<junichi.nomura@....com>
To: "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>
CC: "rafael@...nel.org" <rafael@...nel.org>, "lenb@...nel.org"
<lenb@...nel.org>, "james.morse@....com" <james.morse@....com>,
"bp@...en8.de" <bp@...en8.de>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
NOMURA JUNICHI(野村 淳一)
<junichi.nomura@....com>
Subject: ACPI: APEI: ERST: Don't retry read when "Record Store Empty"
"ERST: [Firmware Warn]: too many record IDs!" is logged on some platforms
when there is no record. That happens because erst_reader() retries read
when erst_get_record_id_next() returns valid ID and erst_read_record()
fails with -ENOENT. On those platforms, ACPI_ERST_GET_RECORD_ID returns
ID 0x0 even if record store is empty. Reading record ID 0x0 on
empty store fails with status code 0x4 (Record Store Empty). However, both
"Record Store Empty" and "Record Not Found" are translated to -ENOENT,
the reader cannot distinguish between them and tries to read the next id,
which is again 0x0, and repeat that until it fills up the record cache with
invalid entries.
While such firmware might be buggy, we could make the reading loop more
robust by returning different error codes for "Record Not Found" and
"Record Store Empty".
Signed-off-by: Jun'ichi Nomura <junichi.nomura@....com>
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index bf65e3461531..ce186f8d7a15 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -95,6 +95,7 @@ static inline int erst_errno(int command_status)
case ERST_STATUS_NOT_ENOUGH_SPACE:
return -ENOSPC;
case ERST_STATUS_RECORD_STORE_EMPTY:
+ return -ENODATA;
case ERST_STATUS_RECORD_NOT_FOUND:
return -ENOENT;
default:
Powered by blists - more mailing lists