[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0h2ppT4jXpnMWCqhBjwHHmkGQfXZ5BBid3VND+_tGv7wg@mail.gmail.com>
Date: Mon, 21 Mar 2022 16:12:24 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: David Cohen <dacohen@...me>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
Linux PM <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] PM: fix dynamic debug within pm_pr_debug()
On Mon, Mar 21, 2022 at 3:51 PM David Cohen <dacohen@...me> wrote:
>
> On Mon, Mar 21, 2022 at 03:20:20PM +0100, Rafael J. Wysocki wrote:
> > On Sat, Mar 19, 2022 at 2:54 AM David Cohen <dacohen@...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@...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?
>
> Let me be a bit more detailed:
>
> Before "8d8b2441db96 PM / sleep: Do not print debug messages by default":
> - pr_debug() was used
> - The kernel pm files had dynamic debug support
> - All the instances using pr_debug() are visible on
> /sys/kernel/debug/dynamic_debug/control
> - pm_debug_messages_on flag was not supported
>
> After "8d8b2441db96 PM / sleep: Do not print debug messages by default":
> - pr_debug() was replaced with pm_pr_dbg()
Just for some PM-related messages, not in general.
> - The kernel pm files where pm_pr_dbg() replaced pr_debug() *lost* dynamic
> debug support and they are no longer visible on
> /sys/kernel/debug/dynamic_debug/control
Again, some of them.
> - pm_debug_messages_on flag was introduced
So what exactly is the problem you are trying to address?
> What my patch is doing:
> - Reintroducing dynamic debug support to the same files who lost it
> after the patch mentioned above
Why is this necessary?
> - The instances using pr_pm_dbg() (which originally came from pr_debug())
> are reintroduced to /sys/kernel/debug/dynamic_debug/control
> - pm_debug_messages_on flag is unaltered
I think that you really want to turn off some PM messages by default
when pm_debug_messages_on is set.
OTOH I want to be able to see pr_pm_dbg() messages in the log when
pm_debug_messages_on is set without having to turn on dynamic debug
for every file in which pr_pm_dbg() is used. Your patch breaks this.
Powered by blists - more mailing lists