From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: John Ogness <john.ogness@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] printk: More consistent loglevel for continuous lines
Date: Mon, 6 Dec 2021 18:34:14 +0100 [thread overview]
Message-ID: <Ya5JlkdRDFjPj/1X@alley> (raw)
In-Reply-To: <YZ7enboRQprct49o@google.com>
On Thu 2021-11-25 09:53:49, Sergey Senozhatsky wrote:
> On (21/11/24 16:48), Petr Mladek wrote:
> >
> > Anyway, it looks a bit non-practical to update all existing pr_cont()
> > callers:
> >
> > $> git grep "pr_cont" | wc -l
> > 2054
>
> Another question is how many pr_cont()-s are getting compiled with
> the "average" production kernel config. A number of pr_cont() is in
> debugging code - lockdep, kasan, etc. - which is not compiled for prod.
It is still >500 for x86_64 default configuration as mentioned in
the reply by Joe.
> Let's assume something like this
>
> foo()
> {
> char *s;
>
> pr_cont("Blah ");
> s = arch_foo();
> pr_cont("%s \n", s);
> }
>
> Suppose that arch_foo() errs and pr_warn()-s. Are we going to use WARN
> level for trailing pr_cont()?
>
> pr_cont("Blah ") -> printk_write_loglevel_ctx(default)
> pr_warn() -> printk_write_loglevel_ctx(warn)
> pr_cont("%s \n"") <- printk_read_loglevel_ctx(warn)
Yes, the proposed solution will not work when there is a nested
message in the same context. It was even mentioned in the commit
message.
But nested messages break the continuous lines completely. They
primary break the text.
pr_cont()/KERN_CONT approach could work reasonably only for
self-contained code. Though even these lines might still get
interleaved by messages from another context/CPU. But it has
a solution. caller_id allows to connect the right pieces.
The proposed patch allows to preserve the loglevel and
actually see all the pieces.
pr_cont()/KERN_CONT is bad API for situations where the pieces
are printed by complicated and/or external code. Such code
should use its own buffer or avoid continuous lines at all.
By other words. The patch solves one fundamental problem when
pr_cont() is used reasonably. It does not help in situations
where pr_cont() should not be used at all.
Best Regards,
Petr
prev parent reply other threads:[~2021-12-06 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 15:48 Petr Mladek
2021-11-25 0:53 ` Sergey Senozhatsky
2021-11-25 1:45 ` Joe Perches
2021-12-06 16:19 ` Petr Mladek
2021-12-06 17:34 ` 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=Ya5JlkdRDFjPj/1X@alley \
--to=pmladek@suse.com \
--cc=joe@perches.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®