Commit 5cc6c682 authored by James Morse's avatar James Morse Committed by Rafael J. Wysocki

ACPI / APEI: Don't update struct ghes' flags in read/clear estatus

ghes_read_estatus() sets a flag in struct ghes if the buffer of
CPER records needs to be cleared once the records have been
processed. This flag value is a problem if a struct ghes can be
processed concurrently, as happens at probe time if an NMI arrives
for the same error source. The NMI clears the flag, meaning the
interrupted handler may never do the ghes_estatus_clear() work.

The GHES_TO_CLEAR flags is only set at the same time as
buffer_paddr, which is now owned by the caller and passed to
ghes_clear_estatus(). Use this value as the flag.

A non-zero buf_paddr returned by ghes_read_estatus() means
ghes_clear_estatus() should clear this address. ghes_read_estatus()
already checks for a read of error_status_address being zero,
so CPER records cannot be written here.
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7d49f2c7
...@@ -329,8 +329,6 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr) ...@@ -329,8 +329,6 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr)
return -ENOENT; return -ENOENT;
} }
ghes->flags |= GHES_TO_CLEAR;
rc = -EIO; rc = -EIO;
len = cper_estatus_len(ghes->estatus); len = cper_estatus_len(ghes->estatus);
if (len < sizeof(*ghes->estatus)) if (len < sizeof(*ghes->estatus))
...@@ -357,15 +355,12 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr) ...@@ -357,15 +355,12 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr)
static void ghes_clear_estatus(struct ghes *ghes, u64 buf_paddr) static void ghes_clear_estatus(struct ghes *ghes, u64 buf_paddr)
{ {
ghes->estatus->block_status = 0; ghes->estatus->block_status = 0;
if (!(ghes->flags & GHES_TO_CLEAR))
return;
if (!buf_paddr) if (!buf_paddr)
return; return;
ghes_copy_tofrom_phys(ghes->estatus, buf_paddr, ghes_copy_tofrom_phys(ghes->estatus, buf_paddr,
sizeof(ghes->estatus->block_status), 0); sizeof(ghes->estatus->block_status), 0);
ghes->flags &= ~GHES_TO_CLEAR;
} }
static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int sev) static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int sev)
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* estatus: memory buffer for error status block, allocated during * estatus: memory buffer for error status block, allocated during
* HEST parsing. * HEST parsing.
*/ */
#define GHES_TO_CLEAR 0x0001
#define GHES_EXITING 0x0002 #define GHES_EXITING 0x0002
struct ghes { struct ghes {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment