All of lore.kernel.org
 help / color / mirror / Atom feed
* Debugging activated during runtime
@ 2007-10-28 15:15 Roel Kluin
  2007-10-28 15:23 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2007-10-28 15:15 UTC (permalink / raw)
  To: lkml

Wouldn't it be nice to be able to specify upon loading, or during runtime
to modules whether debug messages should be printed?
- No kernel recompile needed for debugging.
- Less *_DEBUG options required in menuconfig.

How I think this could work:
Add to the module struct a bool to denote debugging state. If set, pr_debug
forwards messages to printk.

Another advantage:
- A module could be loaded after an unexpected conditions (e.g. after a BUG_ON).

Caveats I can see right now:
- For modules often loaded during boot this may not be a good solution.

Alternatively, instead of a bool for the debug state, the module struct could
also get a log-level flag: messages below that level won't be printed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging activated during runtime
  2007-10-28 15:15 Debugging activated during runtime Roel Kluin
@ 2007-10-28 15:23 ` Jan Engelhardt
  2007-10-28 16:07   ` Roel Kluin
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2007-10-28 15:23 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml


On Oct 28 2007 16:15, Roel Kluin wrote:
>
>Wouldn't it be nice to be able to specify upon loading, or during runtime
>to modules whether debug messages should be printed?

modprobe ark3116 debug=1

Nothing new.

>- No kernel recompile needed for debugging.
>- Less *_DEBUG options required in menuconfig.
>
>How I think this could work:
>Add to the module struct a bool to denote debugging state. If set, pr_debug
>forwards messages to printk.
>
>Another advantage:
>- A module could be loaded after an unexpected conditions (e.g. after a BUG_ON).

After a BUG_ON, you are probably next to a panic.

>Caveats I can see right now:
>- For modules often loaded during boot this may not be a good solution.
>
>Alternatively, instead of a bool for the debug state, the module struct could
>also get a log-level flag: messages below that level won't be printed.

What problem are you trying to solve? YOu can pass the module
a parameter that can control how printk-verbose it will act. That is 
entirely in your hands, and it does not need to extend struct module.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging activated during runtime
  2007-10-28 15:23 ` Jan Engelhardt
@ 2007-10-28 16:07   ` Roel Kluin
  2007-10-28 16:18     ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2007-10-28 16:07 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: lkml

Jan Engelhardt wrote:
> On Oct 28 2007 16:15, Roel Kluin wrote:
>> Wouldn't it be nice to be able to specify upon loading, or during runtime
>> to modules whether debug messages should be printed?
> 
> modprobe ark3116 debug=1
> 
> Nothing new.

Ok, thanks and sorry, I didn't know that.

>> - A module could be loaded after an unexpected conditions (e.g. after a BUG_ON).
> 
> After a BUG_ON, you are probably next to a panic.

Not always, it appears.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging activated during runtime
  2007-10-28 16:07   ` Roel Kluin
@ 2007-10-28 16:18     ` Jan Engelhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2007-10-28 16:18 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml


On Oct 28 2007 17:07, Roel Kluin wrote:
>Jan Engelhardt wrote:
>> On Oct 28 2007 16:15, Roel Kluin wrote:
>>> Wouldn't it be nice to be able to specify upon loading, or during runtime
>>> to modules whether debug messages should be printed?
>> 
>> modprobe ark3116 debug=1
>> 
>> Nothing new.
>
>Ok, thanks and sorry, I didn't know that.

Loading debug info at runtime is more complex, and I doubt it is worth
the time. If writing a module, carefully consider when to print what.
When pr_*() comes in, this might be a bit relaxed.

>>> - A module could be loaded after an unexpected conditions (e.g. after a BUG_ON).
>> 
>> After a BUG_ON, you are probably next to a panic.
>
>Not always, it appears.
>

But anything can happen. It might end in a panic. Or it might eat your data.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-28 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-28 15:15 Debugging activated during runtime Roel Kluin
2007-10-28 15:23 ` Jan Engelhardt
2007-10-28 16:07   ` Roel Kluin
2007-10-28 16:18     ` Jan Engelhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.