ACPI: debug cleanup and documentation
cover ACPI: debug cleanup and documentation
This series of mostly documentation updates makes the ACPI debug system usable by mere mortals.
Comments welcome.
Bjorn
PATCH 1/5 ACPI: consolidate ACPI_*_COMPONENT definitions in acpi_drivers.h
Move all the component definitions for drivers to a single shared place, include/acpi/acpi_drivers.h.
--- drivers/acpi/ac.c | 1 - drivers/acpi/acpi_memhotplug.c | 1 - drivers/acpi/battery.c | 1 - drivers/acpi/button.c | 1 - drivers/acpi/cm_sbs.c | 1 - drivers/acpi/container.c | 1 - drivers/acpi/fan.c | 1 - drivers/acpi/power.c | 3 +-- drivers/acpi/processor_core.c | 1 - drivers/acpi/processor_idle.c | 1 - drivers/acpi/processor_perflib.c | 2 +- drivers/acpi/processor_thermal.c | 1 - drivers/acpi/processor_throttling.c | 2 +- drivers/acpi/thermal.c | 1 - drivers/acpi/video.c | 1 - include/acpi/acpi_drivers.h | 13 ++++++++++++- 16 files changed, 15 insertions(+), 17 deletions(-)
drivers/acpi/ac.c +0 -1
@@ -37,7 +37,6 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define ACPI_AC_COMPONENT 0x00020000#define ACPI_AC_CLASS "ac_adapter"#define ACPI_AC_DEVICE_NAME "AC Adapter"#define ACPI_AC_FILE_STATE "state"
drivers/acpi/acpi_memhotplug.c +0 -1
@@ -32,7 +32,6 @@#include <linux/memory_hotplug.h> #include <acpi/acpi_drivers.h> -#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL#define ACPI_MEMORY_DEVICE_CLASS "memory"#define ACPI_MEMORY_DEVICE_HID "PNP0C80"#define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device"
drivers/acpi/battery.c +0 -1
@@ -46,7 +46,6 @@#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF -#define ACPI_BATTERY_COMPONENT 0x00040000#define ACPI_BATTERY_CLASS "battery"#define ACPI_BATTERY_DEVICE_NAME "Battery"#define ACPI_BATTERY_NOTIFY_STATUS 0x80
drivers/acpi/button.c +0 -1
@@ -33,7 +33,6 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define ACPI_BUTTON_COMPONENT 0x00080000#define ACPI_BUTTON_CLASS "button"#define ACPI_BUTTON_FILE_INFO "info"#define ACPI_BUTTON_FILE_STATE "state"
drivers/acpi/cm_sbs.c +0 -1
@@ -34,7 +34,6 @@ACPI_MODULE_NAME ("cm_sbs" );#define ACPI_AC_CLASS "ac_adapter"#define ACPI_BATTERY_CLASS "battery" -#define ACPI_SBS_COMPONENT 0x00080000#define _COMPONENT ACPI_SBS_COMPONENTstatic struct proc_dir_entry *acpi_ac_dir;static struct proc_dir_entry *acpi_battery_dir;
drivers/acpi/container.c +0 -1
@@ -41,7 +41,6 @@#define INSTALL_NOTIFY_HANDLER 1#define UNINSTALL_NOTIFY_HANDLER 2 -#define ACPI_CONTAINER_COMPONENT 0x01000000#define _COMPONENT ACPI_CONTAINER_COMPONENTACPI_MODULE_NAME ("container" );
drivers/acpi/fan.c +0 -1
@@ -34,7 +34,6 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define ACPI_FAN_COMPONENT 0x00200000#define ACPI_FAN_CLASS "fan"#define ACPI_FAN_FILE_STATE "state"
drivers/acpi/power.c +1 -2
@@ -44,9 +44,8 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define _COMPONENT ACPI_POWER_COMPONENT +#define _COMPONENT ACPI_POWER_COMPONENTACPI_MODULE_NAME ("power" ); -#define ACPI_POWER_COMPONENT 0x00800000#define ACPI_POWER_CLASS "power_resource"#define ACPI_POWER_DEVICE_NAME "Power Resource"#define ACPI_POWER_FILE_INFO "info"
drivers/acpi/processor_core.c +0 -1
@@ -59,7 +59,6 @@#include <acpi/acpi_drivers.h> #include <acpi/processor.h> -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_PROCESSOR_CLASS "processor"#define ACPI_PROCESSOR_DEVICE_NAME "Processor"#define ACPI_PROCESSOR_FILE_INFO "info"
drivers/acpi/processor_idle.c +0 -1
@@ -59,7 +59,6 @@#include <acpi/processor.h> #include <asm/processor.h> -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_PROCESSOR_CLASS "processor"#define _COMPONENT ACPI_PROCESSOR_COMPONENTACPI_MODULE_NAME ("processor_idle" );
drivers/acpi/processor_perflib.c +1 -1
@@ -44,9 +44,9 @@#endif #include <acpi/acpi_bus.h> +#include <acpi/acpi_drivers.h> #include <acpi/processor.h> -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_PROCESSOR_CLASS "processor"#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"#define _COMPONENT ACPI_PROCESSOR_COMPONENT
drivers/acpi/processor_thermal.c +0 -1
@@ -40,7 +40,6 @@#include <acpi/processor.h> #include <acpi/acpi_drivers.h> -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_PROCESSOR_CLASS "processor"#define _COMPONENT ACPI_PROCESSOR_COMPONENTACPI_MODULE_NAME ("processor_thermal" );
drivers/acpi/processor_throttling.c +1 -1
@@ -38,9 +38,9 @@#include <asm/uaccess.h> #include <acpi/acpi_bus.h> +#include <acpi/acpi_drivers.h> #include <acpi/processor.h> -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_PROCESSOR_CLASS "processor"#define _COMPONENT ACPI_PROCESSOR_COMPONENTACPI_MODULE_NAME ("processor_throttling" );
drivers/acpi/thermal.c +0 -1
@@ -47,7 +47,6 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define ACPI_THERMAL_COMPONENT 0x04000000#define ACPI_THERMAL_CLASS "thermal_zone"#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"#define ACPI_THERMAL_FILE_STATE "state"
drivers/acpi/video.c +0 -1
@@ -41,7 +41,6 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> -#define ACPI_VIDEO_COMPONENT 0x08000000#define ACPI_VIDEO_CLASS "video"#define ACPI_VIDEO_BUS_NAME "Video Bus"#define ACPI_VIDEO_DEVICE_NAME "Video Device"
include/acpi/acpi_drivers.h +12 -1
@@ -32,7 +32,19 @@#define ACPI_MAX_STRING 80#define ACPI_BUS_COMPONENT 0x00010000 +#define ACPI_AC_COMPONENT 0x00020000 +#define ACPI_BATTERY_COMPONENT 0x00040000 +#define ACPI_BUTTON_COMPONENT 0x00080000 +#define ACPI_SBS_COMPONENT 0x00080000 +#define ACPI_FAN_COMPONENT 0x00200000 +#define ACPI_PCI_COMPONENT 0x00400000 +#define ACPI_POWER_COMPONENT 0x00800000 +#define ACPI_CONTAINER_COMPONENT 0x01000000 +#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_SYSTEM_COMPONENT 0x02000000 +#define ACPI_THERMAL_COMPONENT 0x04000000 +#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 +#define ACPI_VIDEO_COMPONENT 0x08000000/* * _HID definitions
@@ -54,7 +66,6 @@PCI -------------------------------------------------------------------------- */ -#define ACPI_PCI_COMPONENT 0x00400000/* ACPI PCI Interrupt Link (pci_link.c) */
PATCH 2/5 ACPI: fix conflicting component definitions
In reply to Bjorn HelgaasSome of the component definitions that were previous scattered around the drivers conflict with each other. That doesn't hurt anything except that setting one bit in the debug_layer mask would turn on debugging in two different modules. This patch fixes the conflicts.
--- include/acpi/acpi_drivers.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
include/acpi/acpi_drivers.h +3 -3
@@ -35,16 +35,16 @@#define ACPI_AC_COMPONENT 0x00020000#define ACPI_BATTERY_COMPONENT 0x00040000#define ACPI_BUTTON_COMPONENT 0x00080000 -#define ACPI_SBS_COMPONENT 0x00080000 +#define ACPI_SBS_COMPONENT 0x00100000#define ACPI_FAN_COMPONENT 0x00200000#define ACPI_PCI_COMPONENT 0x00400000#define ACPI_POWER_COMPONENT 0x00800000#define ACPI_CONTAINER_COMPONENT 0x01000000 -#define ACPI_PROCESSOR_COMPONENT 0x01000000#define ACPI_SYSTEM_COMPONENT 0x02000000#define ACPI_THERMAL_COMPONENT 0x04000000#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 -#define ACPI_VIDEO_COMPONENT 0x08000000 +#define ACPI_VIDEO_COMPONENT 0x10000000 +#define ACPI_PROCESSOR_COMPONENT 0x20000000/* * _HID definitions
PATCH 3/5 ACPI: add driver component definitions to sysfs debug_layers
In reply to Bjorn Helgaas/sys/module/acpi/parameters/debug_layers used to contain only the debug layers defined by the ACPI CA. This patch adds the additional layer definitions for ACPI drivers.
--- drivers/acpi/debug.c | 15 +++++++++++++++ include/acpi/acpi_drivers.h | 4 ++++ 2 files changed, 19 insertions(+), 0 deletions(-)
drivers/acpi/debug.c +15 -0
@@ -44,6 +44,21 @@ static const struct acpi_dlayer acpi_debug_layers[] = {ACPI_DEBUG_INIT (ACPI_CA_DISASSEMBLER ),ACPI_DEBUG_INIT (ACPI_COMPILER ),ACPI_DEBUG_INIT (ACPI_TOOLS ), + +ACPI_DEBUG_INIT (ACPI_BUS_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_AC_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_BATTERY_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_BUTTON_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_SBS_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_FAN_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_PCI_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_POWER_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_CONTAINER_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_SYSTEM_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_THERMAL_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_MEMORY_DEVICE_COMPONENT ), +ACPI_DEBUG_INIT (ACPI_VIDEO_COMPONENT ), + ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT), };static const struct acpi_dlevel acpi_debug_levels[] = {
include/acpi/acpi_drivers.h +4 -0
@@ -31,6 +31,10 @@#define ACPI_MAX_STRING 80 +/* +* Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt +* if you add to this list. +*/ #define ACPI_BUS_COMPONENT 0x00010000#define ACPI_AC_COMPONENT 0x00020000#define ACPI_BATTERY_COMPONENT 0x00040000
PATCH 4/5 ACPI: turn off all debug output by default
In reply to Bjorn HelgaasWhen CONFIG_ACPI_DEBUG=y, the default acpi_dbg_layer and acpi_dbg_level values built into the ACPI CA have some debug output enabled. We'd rather be quiet unless the user actually specified the acpi.debug_level argument.
This enables distros to ship with CONFIG_ACPI_DEBUG=y without inundating users with debug output.
--- drivers/acpi/bus.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/acpi/bus.c +8 -0
@@ -688,6 +688,14 @@ void __init acpi_early_init(void)if (acpi_disabled)return ; +/* +* ACPI CA initializes acpi_dbg_level to non-zero, which means +* we get debug output merely by turning on CONFIG_ACPI_DEBUG. +* Turn it off so we don't get output unless the user specifies +* acpi.debug_level. +*/ + acpi_dbg_level =0 ; + printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);/* enable workarounds, unless strict ACPI spec. compliance */
PATCH 5/5 ACPI: update debug parameter documentation
In reply to Bjorn HelgaasReformat acpi.debug_layer and acpi.debug_level documentation so it's more readable, add some clues about how to figure out the mask bits that enable a specific ACPI_DEBUG_PRINT statement, and include some useful examples.
Move the list of masks to Documentation/acpi/debug.txt (these are copies of the authoritative values in acoutput.h and acpi_drivers.h).
--- Documentation/acpi/debug.txt | 148 +++++++++++++++++++++++++++++++++++ Documentation/kernel-parameters.txt | 75 +++++------------- drivers/acpi/Kconfig | 10 ++ 3 files changed, 178 insertions(+), 55 deletions(-) create mode 100644 Documentation/acpi/debug.txt
Documentation/acpi/debug.txt new file +148 -0
@@ -0,0 +1,148 @@ + ACPI Debug Output + + +The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug +output. This document describes how to use this facility. + +Compile-time configuration +-------------------------- + +ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config +option is turned off, the debug messages are not even built into the +kernel. + +Boot- and run-time configuration +-------------------------------- + +When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages +you're interested in. At boot-time, use the acpi.debug_layer and +acpi.debug_level kernel command line options. After boot, you can use the +debug_layer and debug_level files in /sys/module/acpi/parameters/ to control +the debug messages. + +debug_layer (component) +----------------------- + +The "debug_layer" is a mask that selects components of interest, e.g., a +specific driver or part of the ACPI interpreter. To build the debug_layer +bitmask, look for the "#define _COMPONENT" in an ACPI source file. + +You can set the debug_layer mask at boot-time using the acpi.debug_layer +command line argument, and you can change it after boot by writing values +to /sys/module/acpi/parameters/debug_layer. + +The possible components are defined in include/acpi/acoutput.h and +include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer +shows the supported mask values, currently these: + + ACPI_UTILITIES 0x00000001 + ACPI_HARDWARE 0x00000002 + ACPI_EVENTS 0x00000004 + ACPI_TABLES 0x00000008 + ACPI_NAMESPACE 0x00000010 + ACPI_PARSER 0x00000020 + ACPI_DISPATCHER 0x00000040 + ACPI_EXECUTER 0x00000080 + ACPI_RESOURCES 0x00000100 + ACPI_CA_DEBUGGER 0x00000200 + ACPI_OS_SERVICES 0x00000400 + ACPI_CA_DISASSEMBLER 0x00000800 + ACPI_COMPILER 0x00001000 + ACPI_TOOLS 0x00002000 + ACPI_BUS_COMPONENT 0x00010000 + ACPI_AC_COMPONENT 0x00020000 + ACPI_BATTERY_COMPONENT 0x00040000 + ACPI_BUTTON_COMPONENT 0x00080000 + ACPI_SBS_COMPONENT 0x00100000 + ACPI_FAN_COMPONENT 0x00200000 + ACPI_PCI_COMPONENT 0x00400000 + ACPI_POWER_COMPONENT 0x00800000 + ACPI_CONTAINER_COMPONENT 0x01000000 + ACPI_SYSTEM_COMPONENT 0x02000000 + ACPI_THERMAL_COMPONENT 0x04000000 + ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 + ACPI_VIDEO_COMPONENT 0x10000000 + ACPI_PROCESSOR_COMPONENT 0x20000000 + +debug_level +----------- + +The "debug_level" is a mask that selects different types of messages, e.g., +those related to initialization, method execution, informational messages, etc. +To build debug_level, look at the level specified in an ACPI_DEBUG_PRINT() +statement. + +The ACPI interpreter uses several different levels, but the Linux +ACPI core and ACPI drivers generally only use ACPI_LV_INFO. + +You can set the debug_level mask at boot-time using the acpi.debug_level +command line argument, and you can change it after boot by writing values +to /sys/module/acpi/parameters/debug_level. + +The possible levels are defined in include/acpi/acoutput.h. Reading +/sys/module/acpi/parameters/debug_level shows the supported mask values, +currently these: + + ACPI_LV_INIT 0x00000001 + ACPI_LV_DEBUG_OBJECT 0x00000002 + ACPI_LV_INFO 0x00000004 + ACPI_LV_INIT_NAMES 0x00000020 + ACPI_LV_PARSE 0x00000040 + ACPI_LV_LOAD 0x00000080 + ACPI_LV_DISPATCH 0x00000100 + ACPI_LV_EXEC 0x00000200 + ACPI_LV_NAMES 0x00000400 + ACPI_LV_OPREGION 0x00000800 + ACPI_LV_BFIELD 0x00001000 + ACPI_LV_TABLES 0x00002000 + ACPI_LV_VALUES 0x00004000 + ACPI_LV_OBJECTS 0x00008000 + ACPI_LV_RESOURCES 0x00010000 + ACPI_LV_USER_REQUESTS 0x00020000 + ACPI_LV_PACKAGE 0x00040000 + ACPI_LV_ALLOCATIONS 0x00100000 + ACPI_LV_FUNCTIONS 0x00200000 + ACPI_LV_OPTIMIZATIONS 0x00400000 + ACPI_LV_MUTEX 0x01000000 + ACPI_LV_THREADS 0x02000000 + ACPI_LV_IO 0x04000000 + ACPI_LV_INTERRUPTS 0x08000000 + ACPI_LV_AML_DISASSEMBLE 0x10000000 + ACPI_LV_VERBOSE_INFO 0x20000000 + ACPI_LV_FULL_TABLES 0x40000000 + ACPI_LV_EVENTS 0x80000000 + +Examples +-------- + +For example, drivers/acpi/bus.c contains this: + + #define _COMPONENT ACPI_BUS_COMPONENT + ... + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n")); + +To turn on this message, set the ACPI_BUS_COMPONENT bit in acpi.debug_layer +and the ACPI_LV_INFO bit in acpi.debug_level. (The ACPI_DEBUG_PRINT +statement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO +definition.) + +Enable all AML "Debug" output (stores to the Debug object while interpreting +AML) during boot: + + acpi.debug_layer=0xffffffff acpi.debug_level=0x2 + +Enable PCI and PCI interrupt routing debug messages: + + acpi.debug_layer=0x400000 acpi.debug_level=0x4 + +Enable all ACPI hardware-related messages: + + acpi.debug_layer=0x2 acpi.debug_level=0xffffffff + +Enable all ACPI_DB_INFO messages after boot: + + # echo 0x4 > /sys/module/acpi/parameters/debug_level + +Show all valid component values: + + # cat /sys/module/acpi/parameters/debug_layer
Documentation/kernel-parameters.txt +23 -52
82 lines not on this page · raw message
drivers/acpi/Kconfig +7 -3
@@ -312,9 +312,13 @@ config ACPI_DEBUG bool "Debug Statements" default n help - The ACPI driver can optionally report errors with a great deal - of verbosity. Saying Y enables these statements. This will increase - your kernel size by around 50K. + The ACPI subsystem can produce debug output. Saying Y enables this + output and increases the kernel size by around 50K. + + Use the acpi.debug_layer and acpi.debug_level kernel command-line + parameters documented in Documentation/acpi/debug.txt and + Documentation/kernel-parameters.txt to control the type and + amount of debug output. config ACPI_DEBUG_FUNC_TRACE bool "Additionally enable ACPI function tracing"
Quoted 2 lines · Bjorn Helgaas
This series of mostly documentation updates makes the ACPI debug system usable by mere mortals.
thanks for the quick update bjorn, very nice.
applied,
-len