Debugging activated during runtime
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.
Quoted 3 lines · Roel Kluin
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.
Quoted 9 lines
- No kernel recompile needed for debugging.
- Less*_DEBUGoptions required in menuconfig.How I think this could work:
Add to the module struct a bool to denote debugging state. If set,pr_debugforwards messages to printk.Another advantage:
- A module could be loaded after an unexpected conditions (e.g. after aBUG_ON).
After a BUG_ON, you are probably next to a panic.
Quoted 5 lines
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.
Quoted 7 lines · Jan Engelhardt
Quoted 2 lines · Roel Kluin
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.
Quoted 3 lines
Quoted 1 line
- 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.
Quoted 10 lines · Roel Kluin
Quoted 7 lines · Jan Engelhardt
Quoted 2 lines · Roel Kluin
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.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
- 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.