linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Joe Perches <joe@perches.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andy Whitcroft <apw@canonical.com>,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH v2 3/3] power: process: use explicit levels for printk continuations
Date: Wed, 30 Nov 2022 16:06:19 +0100	[thread overview]
Message-ID: <Y4dxa3YMsfhOZpPZ@alley> (raw)
In-Reply-To: <ad4e4785-c6f8-4ae1-a281-ff9dc5720db2@t-8ch.de>

On Fri 2022-11-25 21:41:55, Thomas Weißschuh wrote:
> On 2022-11-25 11:53-0800, Joe Perches wrote:
> > On Fri, 2022-11-25 at 20:09 +0100, Thomas Weißschuh wrote:
> >> Many of the printk messages emitted during suspend and resume are
> >> emitted in fragments using pr_cont()/KERN_CONT.
> >> 
> >> As during suspend and resume a lot of operations are happing in the
> >> kernel the chances are high that the fragments are interspersed with
> >> unrelated messages.
> >> 
> >> In this case if no explicit level is specified for the fragments the
> >> standard level is applied, which by default is KERN_WARNING.
> >> 
> >> If the user is only observing KERN_WARNING and *not* KERN_INFO messages
> >> they will see incomplete message fragments.
> >> 
> >> By specifing the correct printk level also with the continuations this
> >> mismatch can be avoided.
> >> Also it reduces the amount of false-positive KERN_WARNING messages.
> >> 
> >> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> >> ---
> >>  kernel/power/process.c | 18 +++++++++---------
> >>  1 file changed, 9 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/kernel/power/process.c b/kernel/power/process.c
> > []
> >> @@ -82,7 +82,7 @@ static int try_to_freeze_tasks(bool user_only)
> >>  	elapsed_msecs = ktime_to_ms(elapsed);
> >>  
> >>  	if (todo) {
> >> -		pr_cont("\n");
> >> +		pr_info_cont("\n");
> > 
> > I think this isn't needed because of the immediately following pr_err.

Great catch.


> The pr_cont() itself or the conversion to pr_info_cont() is not needed?

The pr_cont() was needed before the commit 4bcc595ccd80decb42450
("printk: reinstate KERN_CONT for printing continuation lines").

Before this commit, lines were appended even without KERN_CONT
when the previous line did not end with "\n".

The above commit caused that only lines with KERN_CONT will be
appended.

We have the code:

		pr_cont("\n");
		pr_err("Freezing of tasks %s after %d.%03d seconds "

The pr_cont() is not needed here because pr_err() does not have
KERN_CONT. It will always start on a new line.

> Personally I would prefer to keep the patch as is.
> 
> If only the conversion is not needed for consistency with the rest of the file.
> If the pr_cont() in general is not needed it should be changed in a dedicated
> patch (by somebody who knows this code better).

I agree that it should be removed in a separate patch. The commit
message should mention the commit that modified the KERN_CONT
handling.

Best Regards,
Petr

  reply	other threads:[~2022-11-30 15:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 19:09 [PATCH v2 0/3] printk: introduce new macros pr_<level>_cont() Thomas Weißschuh
2022-11-25 19:09 ` [PATCH v2 1/3] " Thomas Weißschuh
2022-11-25 20:18   ` Joe Perches
2022-11-25 20:33     ` Thomas Weißschuh
2022-11-30 13:59       ` Petr Mladek
2022-11-30 14:50         ` Thomas Weißschuh
2022-12-02 12:21           ` Petr Mladek
2022-11-30 14:23   ` Petr Mladek
2022-11-30 14:56     ` Thomas Weißschuh
2022-12-02 12:27       ` Petr Mladek
2022-11-25 19:09 ` [PATCH v2 2/3] checkpatch: handle new pr_<level>_cont macros Thomas Weißschuh
2022-11-25 20:17   ` Joe Perches
2022-11-30 14:51     ` Petr Mladek
2022-11-25 19:09 ` [PATCH v2 3/3] power: process: use explicit levels for printk continuations Thomas Weißschuh
2022-11-25 19:53   ` Joe Perches
2022-11-25 20:41     ` Thomas Weißschuh
2022-11-30 15:06       ` Petr Mladek [this message]
2022-11-30 17:57 ` [PATCH v2 0/3] printk: introduce new macros pr_<level>_cont() Rafael J. Wysocki
2022-11-30 23:37   ` Thomas Weißschuh
2022-12-01 10:32     ` Petr Mladek

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=Y4dxa3YMsfhOZpPZ@alley \
    --to=pmladek@suse.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=lukas.bulwahn@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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;
as well as URLs for NNTP newsgroup(s).