Skip to contentSkip to conversation

ACPICA: Log Exceptions and Errors as warning while loading extra tables

PATCH New Hans de Goede 1 participant 3 messages Jan 11, 2018 – Jan 12, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ACPICA: Log Exceptions and Errors as warning while loading extra tables

Hi All,

So this is a rebased resend of an old patch of mine, which back then was rejected because all the ugly ACPI errors scaring the user during boot would need to be resolved in either the ACPICA code or in the BIOS / firmware in question.

It is a year later now and as all the people commenting on:
https://bugzilla.kernel.org/show_bug.cgi?id=198167
show (33 comments and counting in a short time), people experience these kinda errors as a real problem. Note this bug is (mostly) about a new bunch of ACPI error messages which are not fixed by this patch actually, but it does nicely illustrate that people experience these errors as a real problem / a real nuisance and I agree with them.

https://bugzilla.kernel.org/show_bug.cgi?id=198167#c33
also shows that the chances of ever getting these errors fixed in the case where the problem is in the DSDT is very close to 0, so rejecting this patch with an "ask your vendor to fix the firmware" is really not a useful answer, people have tried and this is simply not going to happen.

Given all the effort distros have done with splash-screens to give users a nice clean boot experience, we really want dmesg --level=err to not print anything unless there is a real problem with either the hardware or the kernel. And in this case neither is not true and these unfixable and therefor useless errors only lead to a very jarring boot experience (hence all the users complaining in bug 198167).

Note this patch does not silence or removes the messages about these problems in the ACPI tables, it merely lowers their log level from error to warning so that the messages do not show on the console, they will still show in dmesg and other logs.

Regards,

Hans

#1 lore raw

PATCH 1/1 ACPICA: Log Exceptions and Errors as warning while loading extra tables

Honor the "Ignore errors while loading tables, get as many as possible" comment in the tbxfload.c code and log any exceptions and errors during loading extra tables as warnings.

This is important because many desktop and embedded applicance Linux use-cases have a hard requirement of not showing any (scary) text messages during system bootup, which get broken by errors reported by attempts to load the extra tables, as messaged logged at a KERN_ERR level are always shown even if the quiet kernel cmdline option is used.

Ideally all ACPI tables would be free of errors, but in practice that is just not the case and vendors are not always willing / responsive to fixing issues.

Note this commit only lowers the loglevel while loading extra / optional tables from acpi_tb_load_namespace() all other parsing errors are still logged with a loglevel of error.

Related: https://bugzilla.kernel.org/show_bug.cgi?id=198167

---
 drivers/acpi/acpica/acglobal.h  |  1 +
 drivers/acpi/acpica/tbxfload.c  |  4 +++-
 drivers/acpi/acpica/uterror.c   | 10 ++++++++--
 drivers/acpi/acpica/utxferror.c | 19 ++++++++++---------
 4 files changed, 22 insertions(+), 12 deletions(-)
drivers/acpi/acpica/acglobal.h +1 -0
index 95eed442703f..7cb2ee8ce945 100644
@@ -146,6 +146,7 @@ ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache);
 ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_log_errors_exceptions_as_warnings, FALSE);
 
 /* Global handlers */
 
drivers/acpi/acpica/tbxfload.c +3 -1
index d81f442228b8..a1eaa69d0749 100644
@@ -217,6 +217,7 @@ acpi_status acpi_tb_load_namespace(void)
 		}
 
 		/* Ignore errors while loading tables, get as many as possible */
+		acpi_gbl_log_errors_exceptions_as_warnings = TRUE;
 
 		(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
 		status = acpi_ns_load_table(i, acpi_gbl_root_node);
@@ -237,11 +238,12 @@ acpi_status acpi_tb_load_namespace(void)
 			tables_loaded++;
 		}
 	}
+	acpi_gbl_log_errors_exceptions_as_warnings = FALSE;
 
 	if (!tables_failed) {
 		ACPI_INFO(("%u ACPI AML tables successfully acquired and loaded", tables_loaded));
 	} else {
-		ACPI_ERROR((AE_INFO,
+		ACPI_WARNING((AE_INFO,
 			    "%u table load failures, %u successful",
 			    tables_failed, tables_loaded));
 
drivers/acpi/acpica/uterror.c +8 -2
index e3368186e1c1..fc3794c1c324 100644
@@ -205,7 +205,10 @@ acpi_ut_namespace_error(const char *module_name,
 	char *name = NULL;
 
 	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
 	if (lookup_status == AE_BAD_CHARACTER) {
 
@@ -269,7 +272,10 @@ acpi_ut_method_error(const char *module_name,
 	struct acpi_namespace_node *node = prefix_node;
 
 	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
 	if (path) {
 		status = acpi_ns_get_node(prefix_node, path,
drivers/acpi/acpica/utxferror.c +10 -9
index 950a1e500bfa..553b4eee8cec 100644
@@ -73,7 +73,10 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...)
 	va_list arg_list;
 
 	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
 	va_start(arg_list, format);
 	acpi_os_vprintf(format, arg_list);
@@ -107,16 +110,14 @@ acpi_exception(const char *module_name,
 	va_list arg_list;
 
 	ACPI_MSG_REDIRECT_BEGIN;
-
-	/* For AE_OK, just print the message */
-
-	if (ACPI_SUCCESS(status)) {
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
 		acpi_os_printf(ACPI_MSG_EXCEPTION);
 
-	} else {
-		acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
-			       acpi_format_exception(status));
-	}
+	/* For failures append the formatted exception */
+	if (ACPI_FAILURE(status))
+		acpi_os_printf("%s, ", acpi_format_exception(status));
 
 	va_start(arg_list, format);
 	acpi_os_vprintf(format, arg_list);
Signature · 1 line
2.14.3
#2 lore raw

Hi,

Quoted 14 lines · Hans de Goede

Honor the "Ignore errors while loading tables, get as many as possible" comment in the tbxfload.c code and log any exceptions and errors during loading extra tables as warnings.

This is important because many desktop and embedded applicance Linux use-cases have a hard requirement of not showing any (scary) text messages during system bootup, which get broken by errors reported by attempts to load the extra tables, as messaged logged at a KERN_ERR level are always shown even if the quiet kernel cmdline option is used.

Ideally all ACPI tables would be free of errors, but in practice that is just not the case and vendors are not always willing / responsive to fixing issues.

Quoted 8 lines

Note this commit only lowers the loglevel while loading extra / optional tables from acpi_tb_load_namespace() all other parsing errors are still logged with a loglevel of error.

Related: https://bugzilla.kernel.org/show_bug.cgi?id=198167

I ended up looking at this again today and specifically also at fixing https://bugzilla.kernel.org/show_bug.cgi?id=198167.

I believe I've a cleaner fix without the global flag for this, I will post a new series replacing this patch later today,

Regards,

Hans

Quoted 113 lines
---
  drivers/acpi/acpica/acglobal.h  |  1 +
  drivers/acpi/acpica/tbxfload.c  |  4 +++-
  drivers/acpi/acpica/uterror.c   | 10 ++++++++--
  drivers/acpi/acpica/utxferror.c | 19 ++++++++++---------
  4 files changed, 22 insertions(+), 12 deletions(-)
drivers/acpi/acpica/acglobal.h +1 -0
index 95eed442703f..7cb2ee8ce945 100644
@@ -146,6 +146,7 @@ ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache);
  ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0);
  ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE);
  ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_log_errors_exceptions_as_warnings, FALSE);
 
  /* Global handlers */
 
drivers/acpi/acpica/tbxfload.c +3 -1
index d81f442228b8..a1eaa69d0749 100644
@@ -217,6 +217,7 @@ acpi_status acpi_tb_load_namespace(void)
  		}
 
  		/* Ignore errors while loading tables, get as many as possible */
+		acpi_gbl_log_errors_exceptions_as_warnings = TRUE;
 
  		(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
  		status = acpi_ns_load_table(i, acpi_gbl_root_node);
@@ -237,11 +238,12 @@ acpi_status acpi_tb_load_namespace(void)
  			tables_loaded++;
  		}
  	}
+	acpi_gbl_log_errors_exceptions_as_warnings = FALSE;
 
  	if (!tables_failed) {
  		ACPI_INFO(("%u ACPI AML tables successfully acquired and loaded", tables_loaded));
  	} else {
-		ACPI_ERROR((AE_INFO,
+		ACPI_WARNING((AE_INFO,
  			    "%u table load failures, %u successful",
  			    tables_failed, tables_loaded));
 
drivers/acpi/acpica/uterror.c +8 -2
index e3368186e1c1..fc3794c1c324 100644
@@ -205,7 +205,10 @@ acpi_ut_namespace_error(const char *module_name,
  	char *name = NULL;
 
  	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
  	if (lookup_status == AE_BAD_CHARACTER) {
 
@@ -269,7 +272,10 @@ acpi_ut_method_error(const char *module_name,
  	struct acpi_namespace_node *node = prefix_node;
 
  	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
  	if (path) {
  		status = acpi_ns_get_node(prefix_node, path,
drivers/acpi/acpica/utxferror.c +10 -9
index 950a1e500bfa..553b4eee8cec 100644
@@ -73,7 +73,10 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...)
  	va_list arg_list;
 
  	ACPI_MSG_REDIRECT_BEGIN;
-	acpi_os_printf(ACPI_MSG_ERROR);
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
+		acpi_os_printf(ACPI_MSG_ERROR);
 
  	va_start(arg_list, format);
  	acpi_os_vprintf(format, arg_list);
@@ -107,16 +110,14 @@ acpi_exception(const char *module_name,
  	va_list arg_list;
 
  	ACPI_MSG_REDIRECT_BEGIN;
-
-	/* For AE_OK, just print the message */
-
-	if (ACPI_SUCCESS(status)) {
+	if (acpi_gbl_log_errors_exceptions_as_warnings)
+		acpi_os_printf(ACPI_MSG_WARNING);
+	else
  		acpi_os_printf(ACPI_MSG_EXCEPTION);
 
-	} else {
-		acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
-			       acpi_format_exception(status));
-	}
+	/* For failures append the formatted exception */
+	if (ACPI_FAILURE(status))
+		acpi_os_printf("%s, ", acpi_format_exception(status));
 
  	va_start(arg_list, format);
  	acpi_os_vprintf(format, arg_list);