mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: accumulate the queued flag across error sections
@ 2026-09-25 15:09 Breno Leitao
  2026-09-29  1:59 ` Shuai Xue
  0 siblings, 1 reply; 2+ messages in thread
From: Breno Leitao @ 2026-09-25 15:09 UTC (permalink / raw)
  To: Rafael J. Wysocki, Tony Luck, Borislav Petkov, Hanjun Guo,
	Mauro Carvalho Chehab, Shuai Xue, Len Brown, James Morse,
	Xiaofei Tan
  Cc: Rafael J. Wysocki, linux-acpi, linux-kernel, linux-mm,
	kernel-team, stable, Breno Leitao

ghes_do_proc() walks every error section of a CPER record, and
ghes_handle_arm_hw_error() walks every error-info entry of an ARM
processor section.  Both assign to "queued" instead of OR-ing into it,
so only the last iteration counts: a later section or entry that queues
no memory-failure work clears the flag an earlier one set.

Instead of reassigning the variable at every time, just do an `OR`, so,
if there was a single match, it will return "queued" as set.

The comment above the check says "If no memory failure
work is queued", which is the semantics this patch implements. I.e, only
SIGBUS if there are queue was not handled at all. If we want to SIGBUS
if any event was not handled/queued at all, we will need something more
sophisticated.

Fixes: 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors")
Fixes: ccb5ecdc2dde ("ACPI: APEI: fix synchronous external aborts in user-mode")
Cc: stable@vger.kernel.org
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/acpi/apei/ghes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index fe10ab0e02f68..ec2d5ca51db02 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -603,7 +603,7 @@ static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata,
 		 * and don't filter out 'corrected' error here.
 		 */
 		if (is_cache && has_pa) {
-			queued = ghes_do_memory_failure(err_info->physical_fault_addr, flags);
+			queued |= ghes_do_memory_failure(err_info->physical_fault_addr, flags);
 			p += err_info->length;
 			continue;
 		}
@@ -951,11 +951,11 @@ static void ghes_do_proc(struct ghes *ghes,
 			atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);
 
 			arch_apei_report_mem_error(sev, mem_err);
-			queued = ghes_handle_memory_failure(gdata, sev, sync);
+			queued |= ghes_handle_memory_failure(gdata, sev, sync);
 		} else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
 			ghes_handle_aer(gdata);
 		} else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
-			queued = ghes_handle_arm_hw_error(gdata, sev, sync);
+			queued |= ghes_handle_arm_hw_error(gdata, sev, sync);
 		} else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) {
 			struct cxl_cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata);
 

---
base-commit: 587858367581b9c55c3690f4e63382ad622719d4
change-id: 20260925-ghes-queued-accumulate-591c8ac3b32d

Best regards,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: APEI: accumulate the queued flag across error sections
  2026-09-25 15:09 [PATCH] ACPI: APEI: accumulate the queued flag across error sections Breno Leitao
@ 2026-09-29  1:59 ` Shuai Xue
  0 siblings, 0 replies; 2+ messages in thread
From: Shuai Xue @ 2026-09-29  1:59 UTC (permalink / raw)
  To: Breno Leitao, Rafael J. Wysocki, Tony Luck, Borislav Petkov,
	Hanjun Guo, Mauro Carvalho Chehab, Len Brown, James Morse,
	Xiaofei Tan
  Cc: Rafael J. Wysocki, linux-acpi, linux-kernel, linux-mm,
	kernel-team, stable



On 9/25/26 11:09 PM, Breno Leitao wrote:
> ghes_do_proc() walks every error section of a CPER record, and
> ghes_handle_arm_hw_error() walks every error-info entry of an ARM
> processor section.  Both assign to "queued" instead of OR-ing into it,
> so only the last iteration counts: a later section or entry that queues
> no memory-failure work clears the flag an earlier one set.
> 
> Instead of reassigning the variable at every time, just do an `OR`, so,
> if there was a single match, it will return "queued" as set.
> 
> The comment above the check says "If no memory failure
> work is queued", which is the semantics this patch implements. I.e, only
> SIGBUS if there are queue was not handled at all. If we want to SIGBUS
> if any event was not handled/queued at all, we will need something more
> sophisticated.
> 
> Fixes: 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors")
> Fixes: ccb5ecdc2dde ("ACPI: APEI: fix synchronous external aborts in user-mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>   drivers/acpi/apei/ghes.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index fe10ab0e02f68..ec2d5ca51db02 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -603,7 +603,7 @@ static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata,
>   		 * and don't filter out 'corrected' error here.
>   		 */
>   		if (is_cache && has_pa) {
> -			queued = ghes_do_memory_failure(err_info->physical_fault_addr, flags);
> +			queued |= ghes_do_memory_failure(err_info->physical_fault_addr, flags);
>   			p += err_info->length;
>   			continue;
>   		}
> @@ -951,11 +951,11 @@ static void ghes_do_proc(struct ghes *ghes,
>   			atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);
>   
>   			arch_apei_report_mem_error(sev, mem_err);
> -			queued = ghes_handle_memory_failure(gdata, sev, sync);
> +			queued |= ghes_handle_memory_failure(gdata, sev, sync);
>   		} else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
>   			ghes_handle_aer(gdata);
>   		} else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
> -			queued = ghes_handle_arm_hw_error(gdata, sev, sync);
> +			queued |= ghes_handle_arm_hw_error(gdata, sev, sync);
>   		} else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) {
>   			struct cxl_cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata);
>   
> 
> ---
> base-commit: 587858367581b9c55c3690f4e63382ad622719d4
> change-id: 20260925-ghes-queued-accumulate-591c8ac3b32d
> 
> Best regards,
> --
> Breno Leitao <leitao@debian.org>

Good catch, thanks for the fix.

Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>

Thanks.

Shuai


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-29  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 15:09 [PATCH] ACPI: APEI: accumulate the queued flag across error sections Breno Leitao
2026-09-29  1:59 ` Shuai Xue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®