lkml.org 
[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] PM: fix dynamic debug within pm_pr_debug()
On Sat, Mar 19, 2022 at 2:54 AM David Cohen <dacohen@pm.me> wrote:
>
> On Thu, Mar 17, 2022 at 02:45:11PM +0100, Rafael J. Wysocki wrote:
> > On Sat, Mar 12, 2022 at 5:37 AM David Cohen <dacohen@pm.me> 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():
>
> Yeah, I apologize for the typo. I meant pm_pr_dbg(). I can fix that if
> you're ok with the patch as per comments below.
>
> >
> > #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().
>
> The problem is not about __pm_pr_dbg() calling printk(). The problem is
> the pm files that used to call pr_debug() were modified to call
> pm_pr_dbg() in order to be behing the pm_debug_messages_on flag, as per
> this commit:
> 8d8b2441db96 PM / sleep: Do not print debug messages by default

So what's the problem with setting pm_debug_messages_on in addition to
enabling dynamic debug for a given file?

> That's the moment dynamic debug was no longer available for kernel pm files.
>
> >
> > pm_pr_dbg() is not dynamic printk() on purpose, so they both can be
> > controlled independently.
>
> The current solution is all or nothing (using pm_debug_messages_on). The
> patch I'm sending is making dynamic debug available on the kernel pm
> files, while still allowing the pm_debug_messages_on flag to work
> independently.

If you need a combination of pm_debug_messages_on and the pr_debug()
type of dynamic debug, I would suggest adding a new macro, say
pm_pr_dbg_dyn() or similar, for this purpose and use it as needed
instead of attempting to modify the existing behavior everywhere.

\
 
 \ /
  Last update: 2022-03-21 15:31    [W:1.141 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site