ACPICA: Add ACPI_MSG_DEBUG to set KERN_DEBUG for debug output
Subsystems (2)
PATCH 1/1 ACPICA: Add ACPI_MSG_DEBUG to set KERN_DEBUG for debug output
acpi_debug_print() emits ACPI debug output using multi-part acpi_os_printf() and acpi_os_vprintf() calls without any loglevel prefix.
When acpi_os_vprintf() processes a chunk without a loglevel prefix (printk_get_level() returns 0), it prepends KERN_CONT. Because the initial header chunk lacks a loglevel prefix, it either attaches to a preceding unfinalized log message (inheriting its level) or, when split across printk buffer records, falls back to the default message loglevel rather than KERN_DEBUG. This can cause dmesg to misinterpret and colorize debug messages as errors.
Define ACPI_MSG_DEBUG as KERN_DEBUG in aclinux.h (with an empty fallback in acutils.h for ACPICA OS-independence) and prefix debug message headers and context switch output in acpi_debug_print() with ACPI_MSG_DEBUG so that printk records are properly tagged with KERN_DEBUG.
---
Given this is purely for Linux - it's not obvious to me if it should go upstream to ACPICA or directly to Linux. Sending here for now.
--- drivers/acpi/acpica/acutils.h | 3 +++ drivers/acpi/acpica/utdebug.c | 4 ++-- include/acpi/platform/aclinux.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/acpica/acutils.h +3 -0
@@ -100,6 +100,9 @@ extern const char *acpi_gbl_clock_input_scale[];#ifndef ACPI_MSG_BIOS_WARNING #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "#endif +#ifndef ACPI_MSG_DEBUG +#define ACPI_MSG_DEBUG "" +#endif /* * Common message suffix
drivers/acpi/acpica/utdebug.c +2 -2
@@ -156,7 +156,7 @@ acpi_debug_print(u32 requested_debug_level,if (thread_id != acpi_gbl_previous_thread_id) {if (ACPI_LV_THREADS & acpi_dbg_level) {acpi_os_printf - ("\n**** Context Switch from TID %u to TID %u ****\n\n" , + (ACPI_MSG_DEBUG "\n**** Context Switch from TID %u to TID %u ****\n\n" , (u32 )acpi_gbl_previous_thread_id, (u32 )thread_id); }
@@ -168,7 +168,7 @@ acpi_debug_print(u32 requested_debug_level,* Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ -acpi_os_printf ("%9s-%04d " , module_name, line_number); +acpi_os_printf (ACPI_MSG_DEBUG "%9s-%04d " , module_name, line_number);#ifdef ACPI_APPLICATION /*
include/acpi/platform/aclinux.h +1 -0
@@ -169,6 +169,7 @@#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " +#define ACPI_MSG_DEBUG KERN_DEBUG/* * Linux wants to use designated initializers for function pointer structs.
Signature · 1 line
2.53.0
Rafael J. Wysocki (Intel)
maintainerQuoted 18 lines · Mario Limonciello (AMD)
acpi_debug_print()emits ACPI debug output using multi-partacpi_os_printf()andacpi_os_vprintf()calls without any loglevel prefix.When
acpi_os_vprintf()processes a chunk without a loglevel prefix (printk_get_level()returns 0), it prependsKERN_CONT. Because the initial header chunk lacks a loglevel prefix, it either attaches to a preceding unfinalized log message (inheriting its level) or, when split across printk buffer records, falls back to the default message loglevel rather thanKERN_DEBUG. This can cause dmesg to misinterpret and colorize debug messages as errors.Define
ACPI_MSG_DEBUGasKERN_DEBUGinaclinux.h(with an empty fallback inacutils.hfor ACPICA OS-independence) and prefix debug message headers and context switch output inacpi_debug_print()withACPI_MSG_DEBUGso that printk records are properly tagged withKERN_DEBUG.
Quoted 4 lines
Signed-off-by Mario Limonciello (AMD) <[email protected]>---
Given this is purely for Linux - it's not obvious to me if it should go upstream to ACPICA or directly to Linux. Sending here for now.
Defining ACPI_MSG_DEBUG upstream would make sense in my view, so why don't you submit it there?
Quoted 57 lines
--- drivers/acpi/acpica/acutils.h | 3 +++ drivers/acpi/acpica/utdebug.c | 4 ++-- include/acpi/platform/aclinux.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)drivers/acpi/acpica/acutils.h +3
-0@@ -100,6 +100,9 @@ extern const char *acpi_gbl_clock_input_scale[];#ifndef ACPI_MSG_BIOS_WARNING #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "#endif +#ifndef ACPI_MSG_DEBUG +#define ACPI_MSG_DEBUG "" +#endif /* * Common message suffix drivers/acpi/acpica/utdebug.c +2
-2@@ -156,7 +156,7 @@ acpi_debug_print(u32 requested_debug_level,if (thread_id != acpi_gbl_previous_thread_id) {if (ACPI_LV_THREADS & acpi_dbg_level) {acpi_os_printf - ("\n**** Context Switch from TID %u to TID %u ****\n\n" , + (ACPI_MSG_DEBUG "\n**** Context Switch from TID %u to TID %u ****\n\n" , (u32 )acpi_gbl_previous_thread_id, (u32 )thread_id); }@@ -168,7 +168,7 @@ acpi_debug_print(u32 requested_debug_level,* Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ -acpi_os_printf ("%9s-%04d " , module_name, line_number); +acpi_os_printf (ACPI_MSG_DEBUG "%9s-%04d " , module_name, line_number);#ifdef ACPI_APPLICATION /* include/acpi/platform/aclinux.h +1
-1@@ -169,6 +169,7 @@#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " +#define ACPI_MSG_DEBUG KERN_DEBUG/* * Linux wants to use designated initializers for function pointer structs. -- 2.53.0
Quoted 20 lines · Rafael J. Wysocki (Intel)
Quoted 18 lines · Mario Limonciello (AMD)
acpi_debug_print()emits ACPI debug output using multi-partacpi_os_printf()andacpi_os_vprintf()calls without any loglevel prefix.When
acpi_os_vprintf()processes a chunk without a loglevel prefix (printk_get_level()returns 0), it prependsKERN_CONT. Because the initial header chunk lacks a loglevel prefix, it either attaches to a preceding unfinalized log message (inheriting its level) or, when split across printk buffer records, falls back to the default message loglevel rather thanKERN_DEBUG. This can cause dmesg to misinterpret and colorize debug messages as errors.Define
ACPI_MSG_DEBUGasKERN_DEBUGinaclinux.h(with an empty fallback inacutils.hfor ACPICA OS-independence) and prefix debug message headers and context switch output inacpi_debug_print()withACPI_MSG_DEBUGso that printk records are properly tagged withKERN_DEBUG.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Mario Limonciello (AMD) <[email protected]>---
Given this is purely for Linux - it's not obvious to me if it should go upstream to ACPICA or directly to Linux. Sending here for now.Defining
ACPI_MSG_DEBUGupstream would make sense in my view, so why don't you submit it there?
OK - No problem. I've submitted there.
https://github.com/open-acpica/acpica/pull/1231
Quoted 58 lines
Quoted 58 lines
--- drivers/acpi/acpica/acutils.h | 3 +++ drivers/acpi/acpica/utdebug.c | 4 ++-- include/acpi/platform/aclinux.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)drivers/acpi/acpica/acutils.h +3
-0@@ -100,6 +100,9 @@ extern const char *acpi_gbl_clock_input_scale[];#ifndef ACPI_MSG_BIOS_WARNING #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "#endif +#ifndef ACPI_MSG_DEBUG +#define ACPI_MSG_DEBUG "" +#endif /* * Common message suffix drivers/acpi/acpica/utdebug.c +2
-2@@ -156,7 +156,7 @@ acpi_debug_print(u32 requested_debug_level,if (thread_id != acpi_gbl_previous_thread_id) {if (ACPI_LV_THREADS & acpi_dbg_level) {acpi_os_printf - ("\n**** Context Switch from TID %u to TID %u ****\n\n" , + (ACPI_MSG_DEBUG "\n**** Context Switch from TID %u to TID %u ****\n\n" , (u32 )acpi_gbl_previous_thread_id, (u32 )thread_id); }@@ -168,7 +168,7 @@ acpi_debug_print(u32 requested_debug_level,* Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ -acpi_os_printf ("%9s-%04d " , module_name, line_number); +acpi_os_printf (ACPI_MSG_DEBUG "%9s-%04d " , module_name, line_number);#ifdef ACPI_APPLICATION /* include/acpi/platform/aclinux.h +1
-1@@ -169,6 +169,7 @@#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " +#define ACPI_MSG_DEBUG KERN_DEBUG/* * Linux wants to use designated initializers for function pointer structs. -- 2.53.0