diff options
| author | Thomas Renninger <trenn@suse.de> | 2010-08-06 10:11:02 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:16:42 -0400 |
| commit | a648ec05bb950fae2f35d0490ddd6cf15010af72 (patch) | |
| tree | cde3ca36db486e51d85c31619bf67f8d60215179 | |
| parent | fd89cfb8718753459fcea3fe6103d19de5e86c9b (diff) | |
Dynamic Debug: Introduce ddebug_query= boot parameter
Dynamic debug lacks the ability to enable debug messages at boot time.
One could patch initramfs or service startup scripts to write to
/sys/../dynamic_debug/control, but this sucks.
This patch makes it possible to pass a query in the same format one can
write to /sys/../dynamic_debug/control via boot param.
When dynamic debug gets initialized, this query will automatically be
applied.
Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: jbaron@redhat.com
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | Documentation/dynamic-debug-howto.txt | 22 | ||||
| -rw-r--r-- | Documentation/kernel-parameters.txt | 7 | ||||
| -rw-r--r-- | lib/dynamic_debug.c | 25 |
3 files changed, 52 insertions, 2 deletions
diff --git a/Documentation/dynamic-debug-howto.txt b/Documentation/dynamic-debug-howto.txt index 674c5663d346..58ea64a96165 100644 --- a/Documentation/dynamic-debug-howto.txt +++ b/Documentation/dynamic-debug-howto.txt | |||
| @@ -24,7 +24,7 @@ Dynamic debug has even more useful features: | |||
| 24 | read to display the complete list of known debug statements, to help guide you | 24 | read to display the complete list of known debug statements, to help guide you |
| 25 | 25 | ||
| 26 | Controlling dynamic debug Behaviour | 26 | Controlling dynamic debug Behaviour |
| 27 | =============================== | 27 | =================================== |
| 28 | 28 | ||
| 29 | The behaviour of pr_debug()/dev_debug()s are controlled via writing to a | 29 | The behaviour of pr_debug()/dev_debug()s are controlled via writing to a |
| 30 | control file in the 'debugfs' filesystem. Thus, you must first mount the debugfs | 30 | control file in the 'debugfs' filesystem. Thus, you must first mount the debugfs |
| @@ -212,6 +212,26 @@ Note the regexp ^[-+=][scp]+$ matches a flags specification. | |||
| 212 | Note also that there is no convenient syntax to remove all | 212 | Note also that there is no convenient syntax to remove all |
| 213 | the flags at once, you need to use "-psc". | 213 | the flags at once, you need to use "-psc". |
| 214 | 214 | ||
| 215 | |||
| 216 | Debug messages during boot process | ||
| 217 | ================================== | ||
| 218 | |||
| 219 | To be able to activate debug messages during the boot process, | ||
| 220 | even before userspace and debugfs exists, use the boot parameter: | ||
| 221 | ddebug_query="QUERY" | ||
| 222 | |||
| 223 | QUERY follows the syntax described above, but must not exceed 1023 | ||
| 224 | characters. The enablement of debug messages is done as an arch_initcall. | ||
| 225 | Thus you can enable debug messages in all code processed after this | ||
| 226 | arch_initcall via this boot parameter. | ||
| 227 | On an x86 system for example ACPI enablement is a subsys_initcall and | ||
| 228 | ddebug_query="file ec.c +p" | ||
| 229 | will show early Embedded Controller transactions during ACPI setup if | ||
| 230 | your machine (typically a laptop) has an Embedded Controller. | ||
| 231 | PCI (or other devices) initialization also is a hot candidate for using | ||
| 232 | this boot parameter for debugging purposes. | ||
| 233 | |||
| 234 | |||
| 215 | Examples | 235 | Examples |
| 216 | ======== | 236 | ======== |
| 217 | 237 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 8dd7248508a9..3d854c9ae53a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -43,10 +43,11 @@ parameter is applicable: | |||
| 43 | AVR32 AVR32 architecture is enabled. | 43 | AVR32 AVR32 architecture is enabled. |
| 44 | AX25 Appropriate AX.25 support is enabled. | 44 | AX25 Appropriate AX.25 support is enabled. |
| 45 | BLACKFIN Blackfin architecture is enabled. | 45 | BLACKFIN Blackfin architecture is enabled. |
| 46 | DRM Direct Rendering Management support is enabled. | ||
| 47 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled | 46 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled |
| 48 | EFI EFI Partitioning (GPT) is enabled | 47 | EFI EFI Partitioning (GPT) is enabled |
| 49 | EIDE EIDE/ATAPI support is enabled. | 48 | EIDE EIDE/ATAPI support is enabled. |
| 49 | DRM Direct Rendering Management support is enabled. | ||
| 50 | DYNAMIC_DEBUG Build in debug messages and enable them at runtime | ||
| 50 | FB The frame buffer device is enabled. | 51 | FB The frame buffer device is enabled. |
| 51 | GCOV GCOV profiling is enabled. | 52 | GCOV GCOV profiling is enabled. |
| 52 | HW Appropriate hardware is enabled. | 53 | HW Appropriate hardware is enabled. |
| @@ -570,6 +571,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 570 | Format: <port#>,<type> | 571 | Format: <port#>,<type> |
| 571 | See also Documentation/input/joystick-parport.txt | 572 | See also Documentation/input/joystick-parport.txt |
| 572 | 573 | ||
| 574 | ddebug_query= [KNL,DYNAMIC_DEBUG] Enable debug messages at early boot | ||
| 575 | time. See Documentation/dynamic-debug-howto.txt for | ||
| 576 | details. | ||
| 577 | |||
| 573 | debug [KNL] Enable kernel debugging (events log level). | 578 | debug [KNL] Enable kernel debugging (events log level). |
| 574 | 579 | ||
| 575 | debug_locks_verbose= | 580 | debug_locks_verbose= |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 84d103c474e4..44ce66bdb211 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
| @@ -450,6 +450,19 @@ static int ddebug_exec_query(char *query_string) | |||
| 450 | return 0; | 450 | return 0; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static __initdata char ddebug_setup_string[1024]; | ||
| 454 | static __init int ddebug_setup_query(char *str) | ||
| 455 | { | ||
| 456 | if (strlen(str) >= 1024) { | ||
| 457 | pr_warning("ddebug boot param string too large\n"); | ||
| 458 | return 0; | ||
| 459 | } | ||
| 460 | strcpy(ddebug_setup_string, str); | ||
| 461 | return 1; | ||
| 462 | } | ||
| 463 | |||
| 464 | __setup("ddebug_query=", ddebug_setup_query); | ||
| 465 | |||
| 453 | /* | 466 | /* |
| 454 | * File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the | 467 | * File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the |
| 455 | * command text from userspace, parses and executes it. | 468 | * command text from userspace, parses and executes it. |
| @@ -769,6 +782,18 @@ static int __init dynamic_debug_init(void) | |||
| 769 | } | 782 | } |
| 770 | ret = ddebug_add_module(iter_start, n, modname); | 783 | ret = ddebug_add_module(iter_start, n, modname); |
| 771 | } | 784 | } |
| 785 | |||
| 786 | /* ddebug_query boot param got passed -> set it up */ | ||
| 787 | if (ddebug_setup_string[0] != '\0') { | ||
| 788 | ret = ddebug_exec_query(ddebug_setup_string); | ||
| 789 | if (ret) | ||
| 790 | pr_warning("Invalid ddebug boot param %s", | ||
| 791 | ddebug_setup_string); | ||
| 792 | else | ||
| 793 | pr_info("ddebug initialized with string %s", | ||
| 794 | ddebug_setup_string); | ||
| 795 | } | ||
| 796 | |||
| 772 | out_free: | 797 | out_free: |
| 773 | if (ret) { | 798 | if (ret) { |
| 774 | ddebug_remove_all_tables(); | 799 | ddebug_remove_all_tables(); |
