lkml.org 
[lkml]   [2008]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/3] dynamic_printk: core
On Tue, 29 Apr 2008 14:41:43 -0400 Jason Baron wrote:

>
> Add the ability to dynamically enable/disable pr_debug()/dev_dbg() in the
> kernel. Yes, these calls could be converted to printk(KERN_DEBUG), but there
> are enough to cause overhead. Additionally, the logs become difficult to read.
> Here, one can turn these messages on/off per module via:
>
> echo "add module_name" > <debugfs>/dynamic_printk/modules
> echo "remove module_name" > <debugfs>/dynamic_printk/modules
>
> There is also a special 'all' value that turns on all the debugging messages.
> ---

> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 623ef24..63e5229 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -632,6 +632,46 @@ config FIREWIRE_OHCI_REMOTE_DMA
>
> If unsure, say N.
>
> +config DYNAMIC_PRINTK
> + bool "Enable dynamic printk() call support"
> + default n
> + depends on PRINTK

and depends on DEBUG_FS ??

We shouldn't advertise this option unless the kernel can actually
enable those pr_debug/dev_dbg calls...


> + help
> +
> + Allows pr_debug() and dev_dbg() calls to be dynamically enabled based
> + upon their source module. Traditionally, these calls are only
> + enabled if one set #define DEBUG and recompiled the kernel. This
> + option obviates time consuming re-compiles.
> +
> + The impact of this compile option is a larger kerenl text size ~1%.
> + However, if CONFIG_IMMEDIATE is set, the run-time impact is
> + negligible. Without CONFIG_IMMEDIATE set, a global variable is
> + referenced for each pr_debug() and dev_dbg() calls.
> +
> + Usage:
> +
> + The printing of pr_debug() and dev_dbg() is controlled by the
> + debugfs file, dynamic_printk/modules. This file contains a list of
> + the active modules. To add and remove modules:
> +
> + echo "add <module_name>" > dynamic_printk/modules
> + echo "remove <module_name>" > dynamic_printk/modules
> +
> + For example:
> +
> + echo "add kobject" > dynamic_printk/modules
> + /sbin/modprobe <module>
> +
> + This will cause kobject debug messages to spew out. Also, a special
> + "all" value will print all pr_debug() and dev_dbg() calls. I.e.:
> +
> + echo "add all" > dynamic_printk/modules
> + echo "remove all" > dynamic_printk/modules
> +
> + Finally, passing "dynamic_printk" at the command line enables all
> + pr_debug() and dev_dbg() call to come out (same as "all"). This mode
> + can be disabled via a "remove all".
> +
> source "samples/Kconfig"
>
> source "lib/Kconfig.kgdb"


---
~Randy


\
 
 \ /
  Last update: 2008-05-21 22:41    [W:0.032 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site