pmaports/device/testing/linux-valve-jupiter/0001-ACPICA-Limit-error-message-flood-caused-by-firmware-.patch

118 lines
4 KiB
Diff
Raw Normal View History

From 5a57e80db401b841cc6f57832cf95d2830fc3350 Mon Sep 17 00:00:00 2001
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Date: Fri, 4 Mar 2022 21:20:39 +0000
Subject: [PATCH 01/21] ACPICA: Limit error message flood caused by firmware
bug
The following error messages are generated because of an infinite
recursion in the latest production BIOS:
ACPI Error: Method reached maximum reentrancy limit (255) (20210331/dsmethod-309)
ACPI Error: Aborting method \_SB.PCI0.LPC0.EC0.VFCD.PDVL due to previous error (AE_AML_METHOD_LIMIT) (20210331/psparse-529)
[...]
ACPI Error: Aborting method \_SB.PCI0.LPC0.EC0.VFCD.PDVL due to previous error (AE_AML_METHOD_LIMIT) (20210331/psparse-529)
Let's detect this and limit the amount of errors generated.
Additionally, add a kernel parameter 'acpi_no_msg_flood_detect' to
disable the detection for debugging purposes.
https://gitlab.steamos.cloud/jupiter/linux-integration/-/issues/11
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/acpi/acpica/dsmethod.c | 5 ++--
drivers/acpi/acpica/uterror.c | 53 ++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index e809c2aed78a..66267b1a3170 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -306,8 +306,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
/* Prevent wraparound of thread count */
if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
- ACPI_ERROR((AE_INFO,
- "Method reached maximum reentrancy limit (255)"));
+ /* Suppressing this due to firmware bug flooding the logs */
+ /*ACPI_ERROR((AE_INFO,
+ "Method reached maximum reentrancy limit (255)"));*/
return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
}
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
index 918aca7c4db4..4a482de2e55d 100644
--- a/drivers/acpi/acpica/uterror.c
+++ b/drivers/acpi/acpica/uterror.c
@@ -278,6 +278,56 @@ acpi_ut_namespace_error(const char *module_name,
}
#endif
+/*******************************************************************************
+ *
+ * Limit the error message flood caused by a firmware bug:
+ *
+ * ACPI Error: Method reached maximum reentrancy limit (255) (20210331/dsmethod-309)
+ * ACPI Error: Aborting method \_SB.PCI0.LPC0.EC0.VFCD.PDVL due to previous error (AE_AML_METHOD_LIMIT) (20210331/psparse-529)
+ * [...]
+ * ACPI Error: Aborting method \_SB.PCI0.LPC0.EC0.VFCD.PDVL due to previous error (AE_AML_METHOD_LIMIT) (20210331/psparse-529)
+ *
+ ******************************************************************************/
+
+static bool acpi_disable_msg_flood_detect;
+
+static int __init acpi_no_msg_flood_detect_setup(char *s)
+{
+ acpi_disable_msg_flood_detect = true;
+ pr_info("ACPI error message flood detection disabled\n");
+
+ return 0;
+}
+
+early_param("acpi_no_msg_flood_detect", acpi_no_msg_flood_detect_setup);
+
+static bool acpi_skip_print_node(struct acpi_namespace_node *node)
+{
+ static bool skip_print = false;
+ struct acpi_buffer buffer;
+ acpi_status status;
+
+ if (acpi_disable_msg_flood_detect || !node)
+ return false;
+
+ if (!skip_print) {
+ /* Convert handle to full pathname */
+ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ status = acpi_ns_handle_to_pathname(node, &buffer, TRUE);
+ if (ACPI_SUCCESS(status)) {
+ skip_print = !strcmp((const char *)buffer.pointer,
+ "\\_SB.PCI0.LPC0.EC0.VFCD.PDVL");
+ ACPI_FREE(buffer.pointer);
+
+ if (skip_print)
+ return false; /* print once */
+ }
+ }
+
+ return skip_print;
+}
+
/*******************************************************************************
*
* FUNCTION: acpi_ut_method_error
@@ -305,6 +355,9 @@ acpi_ut_method_error(const char *module_name,
acpi_status status;
struct acpi_namespace_node *node = prefix_node;
+ if (acpi_skip_print_node(node))
+ return;
+
ACPI_MSG_REDIRECT_BEGIN;
acpi_os_printf(ACPI_MSG_ERROR);
--
2.44.0