public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: akpm@linux-foundation.org, joe@perches.com, greg@kroah.com,
	nick@nick-andrew.net, randy.dunlap@oracle.com
Cc: linux-kernel@vger.kernel.org
Subject: [patch 0/8] debug printk infrastructure
Date: Thu, 22 May 2008 17:13:31 -0400	[thread overview]
Message-ID: <20080522211331.GA28070@redhat.com> (raw)

hi,

So i've attempted to make this infrastrucutre general enough to be used by the
kernel as a whole. The basic interfaces i'm using are the basic, 'pr_debug()',
and 'dev_dbg()' calls. And then i've added:

-register_dev_dbg_handler(parent, type, max, init)
This registers a handler that can support level, or flag printks. 'type' is
either 'TYPE_LEVEL' or 'TYPE_FLAG'. The 'parent' field can be used to support
a hierarchical debugging between modules, for example where we want to share
the same levels across modules. 'init' is the initial setting for the flag
or level. 'max' is currently unused and probably should be discarded.

-dev_dbg_level(value, dev, format, ...)
This call is used by code in the core driver as its interface into 'printk'.
'value' is the level or flag value for the particular printk. So modules can
do: #define dprintk dev_dbg_level(value, dev, format, ...)

-dev_dbg_enabled(value)
This call is used to allow the infrastructure to be more flexible and handle
blocks of printks or even blocks of other debugging code.

-'pr_debug' and 'dev_dbg' can continue to be used as before (no API change),
but this infrastructure automatically detects where these calls are and displays
the modules that have them in a debugfs file: debug/dynamic_printk/modules

The debugfs file, then lists all the modules that can be 'enabled' for dynamic
printk calls. Currently, the file has a 4 column format (excerpt from my system:

<module_name> <enabled/disabled> <current level/flag setting> <# of call sites>

8250 0 0 2
acpi_cpufreq 0 0 1
aio 0 0 24
backlight 0 0 3

I've converted a few subsysmts to this infrastructure to provide some examples
of what it can do: module.c bonding aio and cpufreq (including sub-drivers).

I realize the code is a bit rough around the edges, but the basic idea is here, 
and i'm looking for feedback on the approach.

todo:

*free memory used in text sections to detect call sites
*provide potential level settings in the debugfs file
*convert more modules/subsystems
*tidy up lib/dynamic_printk.c

thanks,

-Jason




             reply	other threads:[~2008-05-22 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 21:13 Jason Baron [this message]
2008-05-23  0:21 ` [patch 0/8] debug printk infrastructure Nick Andrew
2008-05-23 16:39   ` Jason Baron
2008-05-27 21:39 ` Andrew Morton

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=20080522211331.GA28070@redhat.com \
    --to=jbaron@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick@nick-andrew.net \
    --cc=randy.dunlap@oracle.com \
    /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