Re: [PATCH 2/8] dynamic debug - core infrastructure

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jason Baron <jbaron@...>
Cc: <akpm@...>, <linux-kernel@...>, <greg@...>, <nick@...>, <randy.dunlap@...>
Date: Friday, June 13, 2008 - 6:30 pm

On Fri, 2008-06-13 at 15:00 -0400, Jason Baron wrote:

Some general and specific comments.


I don't understand why you use NR_CPUS.

Also, I think the major use cases are 1 or 2 modules enabled,
no modules enabled, or all modules enabled, so the hashing of
module names is particularly not useful.

Any pr_debug or dev_dbg is in a slow path.

I think a list and a direct comparison to KBUILD_MODNAME
would be simpler and as fast as necessary.


I think that set level=<#> should also work for "all"

Perhaps a simpler interface would be to use
	enable <module> <level>
where <level> not specified is 0.


[]


Because the return values aren't used,
the functions might as well be declared void

You should probably add a sprinkling of "const"
to the argument lists.

+extern void dynamic_printk(char *, char *, ...);

+	dynamic_printk(KBUILD_MODNAME,                     \
+			KERN_DEBUG KBUILD_MODNAME ": " fmt,\

Instead of prefixing every fmt with KBUILD_MODNAME ": ",
why not change this to something like:

extern void dynamic_printk(const char *level, const char *module,
			   const char *fmt, ...);

and just do the printk in 2 parts?

	if (module_enabled) {
		printk("%s%s: ", level, module);
		vprintk(fmt, args);
	}

If not that, why should dynamic_printk prefix a KBUILD_MODNAME
at all?  Why not just check if the module is enabled, then
output what the code specifies?

trivial:  The dynamic versions of the dev_dbg and pr_debug macros
don't return the number of chars output, but always return 0.


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/8] dynamic debug - core infrastructure, Jason Baron, (Fri Jun 13, 3:00 pm)
Re: [PATCH 2/8] dynamic debug - core infrastructure, Pavel Machek, (Wed Jun 18, 4:52 pm)
Re: [PATCH 2/8] dynamic debug - core infrastructure, Jason Baron, (Fri Jun 20, 11:38 am)
Re: [PATCH 2/8] dynamic debug - core infrastructure, Joe Perches, (Fri Jun 13, 6:30 pm)
Re: [PATCH 2/8] dynamic debug - core infrastructure, Jason Baron, (Mon Jun 16, 3:15 pm)