Linux Power Management development
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: process: use explicit levels for printk continuations
Date: Mon, 21 Nov 2022 17:09:21 +0100	[thread overview]
Message-ID: <Y3uisbm9NEqF7EOM@alley> (raw)
In-Reply-To: <20221121050946.3540-1-linux@weissschuh.net>

On Mon 2022-11-21 06:09:46, 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.

Yup, it is a known printk() limitation and this is the most reliable
solution.

> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  kernel/power/process.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/power/process.c b/kernel/power/process.c
> index ddd9988327fe..0a828edc6d30 100644
> --- a/kernel/power/process.c
> +++ b/kernel/power/process.c
> @@ -101,7 +101,7 @@ static int try_to_freeze_tasks(bool user_only)
>  			read_unlock(&tasklist_lock);
>  		}
>  	} else {
> -		pr_cont("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
> +		pr_info(KERN_CONT "(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,

It looks a bit ugly. Feel free to provide separate patch introducing
pr_<level>_cont() wrappers. Then you could use pr_info_cont() here.

We already have pr_<level>_once() and pr_<level>_ratelimited().
So pr_<level>_cont() would fit the existing pattern.


>  			elapsed_msecs % 1000);
>  	}
>  

Best Regards,
Petr

      reply	other threads:[~2022-11-21 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21  5:09 [PATCH] power: process: use explicit levels for printk continuations Thomas Weißschuh
2022-11-21 16:09 ` Petr Mladek [this message]

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=Y3uisbm9NEqF7EOM@alley \
    --to=pmladek@suse.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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