Linux Power Management development
 help / color / mirror / Atom feed
From: David Cohen <dacohen@pm.me>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] PM: fix dynamic debug within pm_pr_debug()
Date: Sat, 19 Mar 2022 01:54:09 +0000	[thread overview]
Message-ID: <YjU3sfYLcEqK1Usd@jiban.lan> (raw)
In-Reply-To: <CAJZ5v0gqpQTuNN0WpnEd4dAQmnR=BXSoH_w7kkAxOG7xkftW6Q@mail.gmail.com>

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

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.

Regards, David


  reply	other threads:[~2022-03-19  1:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12  4:36 [PATCH v2] PM: fix dynamic debug within pm_pr_debug() David Cohen
2022-03-17 13:45 ` Rafael J. Wysocki
2022-03-19  1:54   ` David Cohen [this message]
2022-03-21 14:20     ` Rafael J. Wysocki
2022-03-21 14:51       ` David Cohen
2022-03-21 15:12         ` Rafael J. Wysocki
2022-03-21 15:57           ` David Cohen
2022-03-21 17:09             ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjU3sfYLcEqK1Usd@jiban.lan \
    --to=dacohen@pm.me \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox