Re: [PATCH v2] PM: fix dynamic debug within pm_pr_debug()

From: Rafael J. Wysocki
Date: Thu Mar 17 2022 - 09:45:26 EST


On Sat, Mar 12, 2022 at 5:37 AM David Cohen <dacohen@xxxxx> wrote:
>
> Currently, pm_pr_debug() and pm_deferred_pr_debug() use __pm_pr_debug()
> to filter pm debug messages based on pm_debug_messages_on flag.
> According to __pm_pr_debug() implementation, pm_deferred_pr_debug()
> indirectly calls printk_deferred() within __pm_pr_debug() which doesn't
> support dynamic debug, but pm_pr_debug() indirectly calls pr_debug()

I'm not sure what you mean by pm_pr_debug(). There's no such thing in
the kernel tree.

Assuming that it means pm_pr_dbg(), it doesn't call pr_debug():

#define pm_pr_dbg(fmt, ...) __pm_pr_dbg(false, fmt, ##__VA_ARGS__)

and

void __pm_pr_dbg(bool defer, const char *fmt, ...)
{
...
if (defer)
printk_deferred(KERN_DEBUG "PM: %pV", &vaf);
else
printk(KERN_DEBUG "PM: %pV", &vaf);

And as I said printk(KERN_DEBUG ...) is not equivalent to
pr_debug(...), because it is not dynamic printk().

pm_pr_dbg() is not dynamic printk() on purpose, so they both can be
controlled independently.