mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Jason Baron <jbaron@redhat.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] dynamic_printk: core
Date: Wed, 21 May 2008 13:35:19 -0700	[thread overview]
Message-ID: <20080521133519.0a262954.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20080429184143.GB8717@redhat.com>

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

      parent reply	other threads:[~2008-05-21 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29 18:41 Jason Baron
2008-04-29 19:09 ` Tom Spink
2008-05-21 20:35 ` Randy Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080521133519.0a262954.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®