Re: [PATCH 03/25] dynamic_debug: use pr_debug instead of pr_info

From: Jim Cromie
Date: Wed Jul 27 2011 - 17:34:50 EST


On Tue, Jul 26, 2011 at 1:08 AM, Bart Van Assche <bvanassche@xxxxxxx> wrote:
> On Mon, Jul 25, 2011 at 11:42 PM, Jim Cromie <jim.cromie@xxxxxxxxx> wrote:
>> Replace almost all occurrences of "if (verbose) pr_info()" with
>> pr_debug(), and get full control of output at each callsite.
>> Leave a few sites unaltered:
>>
>> 1st also uses pr_cont(), and theres no pr_debug_cont().
>> 2nd is in ddebug_add_module(), which is called during arch_init,
>> too early for callsite to be enabled when called.
>>
>> 3rd, pr_debug doesnt work in dynamic_debug_init(), its too early.
>> Also move the print ddebug_setup_string prior to parsing, since
>> afterwards it's been chopped up with '\0's, and only 1st word is seen.
>>

>
> Changing pr_info() into pr_debug() inside the dynamic_debug
> implementation seems like a really bad idea to me. Such changes make
> it hard to find out via source code reading whether or not there is a
> risk that invoking one of these pr_debug() macros will cause infinite
> recursion.
>
> Bart.
>

By inspection, all the pr_debug-ish code macros down to

430int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
431{
432 va_list args

which uses raw printk, KERN_DEBUG, KERN_CONT only.
This is the "print-path" that Jason mentioned.

IOW, this is more like "eating your own dogfood" than "eating your own tail"

WRT earlier discussion (Joe, Jason):

> I think these should be pr_debug.
> I know you're only using the current style.
>
> Jason, any reason these can not be converted?
>

it should be ok, although we have to be careful not to use them in the
printing path, since that will cause a recursion.

Also, if there is an issue with the dynamic debug code, it makes it more
of a pain to debug :)


All conversions were to flag-management code
The conversion was painless, and just worked,
except for init code, where I used pr_info.

wrt "pain to debug", Id suggest that "eating your own dogfood"
provides an early test, especially when combined with following
to enable the selftest at boot.

ddebug_query="module dynamic_debug +p ; module dynamic_debug line
815-940 =_"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/