aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2009-02-05 11:51:38 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:38:26 -0400
commite9d376f0fa66bd630fe27403669c6ae6c22a868f (patch)
tree6eadef32eb421647ae98d88341b9aceb259aaf22 /kernel/module.c
parent095160aee954688a9bad225952c4bee546541e19 (diff)
dynamic debug: combine dprintk and dynamic printk
This patch combines Greg Bank's dprintk() work with the existing dynamic printk patchset, we are now calling it 'dynamic debug'. The new feature of this patchset is a richer /debugfs control file interface, (an example output from my system is at the bottom), which allows fined grained control over the the debug output. The output can be controlled by function, file, module, format string, and line number. for example, enabled all debug messages in module 'nf_conntrack': echo -n 'module nf_conntrack +p' > /mnt/debugfs/dynamic_debug/control to disable them: echo -n 'module nf_conntrack -p' > /mnt/debugfs/dynamic_debug/control A further explanation can be found in the documentation patch. Signed-off-by: Greg Banks <gnb@sgi.com> Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 1196f5d11700..77672233387f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -822,7 +822,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
822 mutex_lock(&module_mutex); 822 mutex_lock(&module_mutex);
823 /* Store the name of the last unloaded module for diagnostic purposes */ 823 /* Store the name of the last unloaded module for diagnostic purposes */
824 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 824 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
825 unregister_dynamic_debug_module(mod->name); 825 ddebug_remove_module(mod->name);
826 free_module(mod); 826 free_module(mod);
827 827
828 out: 828 out:
@@ -1827,19 +1827,13 @@ static inline void add_kallsyms(struct module *mod,
1827} 1827}
1828#endif /* CONFIG_KALLSYMS */ 1828#endif /* CONFIG_KALLSYMS */
1829 1829
1830static void dynamic_printk_setup(struct mod_debug *debug, unsigned int num) 1830static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num)
1831{ 1831{
1832#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG 1832#ifdef CONFIG_DYNAMIC_DEBUG
1833 unsigned int i; 1833 if (ddebug_add_module(debug, num, debug->modname))
1834 1834 printk(KERN_ERR "dynamic debug error adding module: %s\n",
1835 for (i = 0; i < num; i++) { 1835 debug->modname);
1836 register_dynamic_debug_module(debug[i].modname, 1836#endif
1837 debug[i].type,
1838 debug[i].logical_modname,
1839 debug[i].flag_names,
1840 debug[i].hash, debug[i].hash2);
1841 }
1842#endif /* CONFIG_DYNAMIC_PRINTK_DEBUG */
1843} 1837}
1844 1838
1845static void *module_alloc_update_bounds(unsigned long size) 1839static void *module_alloc_update_bounds(unsigned long size)
@@ -2213,12 +2207,13 @@ static noinline struct module *load_module(void __user *umod,
2213 add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); 2207 add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
2214 2208
2215 if (!mod->taints) { 2209 if (!mod->taints) {
2216 struct mod_debug *debug; 2210 struct _ddebug *debug;
2217 unsigned int num_debug; 2211 unsigned int num_debug;
2218 2212
2219 debug = section_objs(hdr, sechdrs, secstrings, "__verbose", 2213 debug = section_objs(hdr, sechdrs, secstrings, "__verbose",
2220 sizeof(*debug), &num_debug); 2214 sizeof(*debug), &num_debug);
2221 dynamic_printk_setup(debug, num_debug); 2215 if (debug)
2216 dynamic_debug_setup(debug, num_debug);
2222 } 2217 }
2223 2218
2224 /* sechdrs[0].sh_size is always zero */ 2219 /* sechdrs[0].sh_size is always zero */