All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Joe Perches <joe@perches.com>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	"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 2/3] checkpatch: handle new pr_<level>_cont macros
Date: Wed, 30 Nov 2022 15:51:08 +0100	[thread overview]
Message-ID: <Y4dt3IMYKYnufHg5@alley> (raw)
In-Reply-To: <39f687f7c71b162eb8caefbec939fa2ad74fcdfc.camel@perches.com>

On Fri 2022-11-25 12:17:05, Joe Perches wrote:
> On Fri, 2022-11-25 at 20:09 +0100, Thomas Weißschuh wrote:
> > These new macros from include/linux/printk.h replace the usage of plain
> > pr_cont().
> []
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -590,7 +590,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
> > +# check for logging continuations without explicit level
> > +		if ($line =~ /\bpr_cont\s*\(/) {
> > +			WARN("LOGGING_CONTINUATION_WITHOUT_LEVEL",
> > +			     "Avoid logging continuation without level\n" . $herecurr);
> > +		}
> > +
> 
> Not so sure about this one.
> 
> I think relatively few situations are going to require interleaving avoidance.

Well, the problem is generic and any pr_cont() is affected except for
NMI context on single CPU system.

I though about a generic solution. We could store the last used printk
log level per-process and per-CPU context. But it does not solve
the situation when an unrelated printk() is printed by a nested
function.

It is exactly the case with try_to_freeze_tasks() in the 3rd patch.
Simplified code:

int freeze_processes(void)
{
	pr_info("Freezing user space processes ... ");
	try_to_freeze_tasks(true);
	pr_info_cont("done.");
}

, where

static int try_to_freeze_tasks(bool user_only)
{
[...]
	if (todo) {
		pr_err("Freezing of tasks %s after %d.%03d seconds "
[...]
}


I would personally add this check into checkpatch.pl. It might help
to make people aware about that pr_cont() is just the best effort.

Best Regards,
Petr

  reply	other threads:[~2022-11-30 14:51 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 [this message]
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
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=Y4dt3IMYKYnufHg5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.