Skip to content

debug printk infrastructure

Jason Baron lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8debug printk infrastructure -base patchinclude/asm-generic/vmlinux.lds.h include/linux/device.h include/linux/dynamic_printk.h +6 more+488 -01 reply
2/8debug printk infrastructure -implement level controlsinclude/linux/device.h include/linux/dynamic_printk.h lib/dynamic_printk.c+99 -41 reply
3/8debug printk infrastructure -compile fixesnet/netfilter/nf_conntrack_pptp.c+1 -11 reply
4/8debug printk infrastructure -dynamic printk docsDocumentation/kernel-parameters.txt+5 -01 reply
5/8debug printk infrastructure -convert DEBUGP calls to pr_debug module.ckernel/module.c+17 -230 replies
6/8debug printk infrastructure -convert bonding to dynamic printkdrivers/net/bonding/bonding.h+1 -60 replies
7/8debug printk infrastructure -convert aio dprintk -> pr_debugfs/aio.c+14 -200 replies
8/8debug printk infrastructure -convert cpufreqarch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c arch/x86/kernel/cpu/cpufreq/gx-suspmod.c +15 more+21 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [patch 0/8] debug printk infrastructure

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