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 1/3] printk: introduce new macros pr_<level>_cont()
Date: Fri, 2 Dec 2022 13:21:34 +0100 [thread overview]
Message-ID: <Y4ntzmsvsr7gU8x0@alley> (raw)
In-Reply-To: <42950773-aac6-4ec6-8cbe-543489afe316@t-8ch.de>
On Wed 2022-11-30 15:50:55, Thomas Weißschuh wrote:
> On 2022-11-30 14:59+0100, Petr Mladek wrote:
> > On Fri 2022-11-25 21:33:40, Thomas Weißschuh wrote:
> >> On 2022-11-25 12:18-0800, Joe Perches wrote:
> >>> On Fri, 2022-11-25 at 20:09 +0100, Thomas Weißschuh wrote:
> >>>> These macros emit continuation messages with explicit levels.
> >>>> In case the continuation is logged separately from the original message
> >>>> it will retain its level instead of falling back to KERN_DEFAULT.
> >>>>
> >>>> This remedies the issue that logs filtered by level contain stray
> >>>> continuation messages without context.
> >>>>
> >>>> --- a/include/linux/printk.h
> >>>> +++ b/include/linux/printk.h
> >>>> @@ -701,6 +703,27 @@ do { \
> >>>> no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> >>>> #endif
> >>>>
> >>>> +/*
> >>>> + * Print a continuation message with level. In case the continuation is split
> >>>> + * from the main message it preserves the level.
> >>>> + */
> >>>> +
> >>>> +#define pr_emerg_cont(fmt, ...) \
> >>>> + printk(KERN_EMERG KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
> >>>
> >>> Aren't this rather backwards?
> >>> KERN_CONT KERN_<LEVEL> seems to make more sense to me.
> >>
> >> If nobody else disagrees I'll do this for v3.
> >
> > I slightly prefer the way how it is now. IMHO, it makes it easier
> > to check the related levels in /sys/kernel/debug/printk/index/vmlinux [*]:
> >
> > <6> kernel/power/process.c:227 thaw_kernel_threads "Restarting kernel threads ... "
> > <6,c> kernel/power/process.c:218 thaw_processes "done.\n"
> > <6> kernel/power/process.c:197 thaw_processes "Restarting tasks ... "
> > <6,c> kernel/power/process.c:176 freeze_kernel_threads "\n"
> > <6,c> kernel/power/process.c:174 freeze_kernel_threads "done."
> > <6> kernel/power/process.c:169 freeze_kernel_threads "Freezing remaining freezable tasks ... "
> > <6,c> kernel/power/process.c:140 freeze_processes "\n"
> > <6,c> kernel/power/process.c:138 freeze_processes "done."
> > <6> kernel/power/process.c:133 freeze_processes "Freezing user space processes ... "
> > <6,c> kernel/power/process.c:105 try_to_freeze_tasks "(elapsed %d.%03d seconds) "
>
> I did not test it (will do so later) but it seems to me that the code in
> kernel/printk/index.c should do this correctly in either case. At least it
> tries to:
>
> if (flags & LOG_CONT) {
> /*
> * LOGLEVEL_DEFAULT here means "use the same level as the
> * message we're continuing from", not the default message
> * loglevel, so don't display it as such.
> */
> if (level == LOGLEVEL_DEFAULT)
> seq_puts(s, "<c>");
> else
> seq_printf(s, "<%d,c>", level);
> } else
> seq_printf(s, "<%d>", level);
> }
Great. It makes the index consistent. I should have checked the code ;-)
I do not mind then about the ordering in the macro definitions.
It really seems to be only an implementation detail.
Best Regards,
Petr
next prev parent reply other threads:[~2022-12-02 12:21 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 [this message]
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
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=Y4ntzmsvsr7gU8x0@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