From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Dmitry Safonov <dima@arista.com>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>, Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Subject: Re: [RFC] printk/sysrq: Don't play with console_loglevel
Date: Tue, 28 May 2019 13:15:00 +0900 [thread overview]
Message-ID: <20190528041500.GB26865@jagdpanzerIV> (raw)
In-Reply-To: <20190528002412.1625-1-dima@arista.com>
On (05/28/19 01:24), Dmitry Safonov wrote:
[..]
> While handling sysrq the console_loglevel is bumped to default to print
> sysrq headers. It's done to print sysrq messages with WARNING level for
> consumers of /proc/kmsg, though it sucks by the following reasons:
> - changing console_loglevel may produce tons of messages (especially on
> bloated with debug/info prints systems)
> - it doesn't guarantee that the message will be printed as printk may
> deffer the actual console output from buffer (see the comment near
> printk() in kernel/printk/printk.c)
>
> Provide KERN_UNSUPPRESSED printk() annotation for such legacy places.
> Make sysrq print the headers unsuppressed instead of changing
> console_loglevel.
I've been thinking about this a while ago... So what I thought back
then was that affected paths are atomic: sysrq, irqs, NMI, etc. Well
at leasted it seemed to be so. Hence we can use per-CPU flag to tell
printk that whatever comes from this-CPU is important and printk should
eventually print it (next time it hits console_unlock()). One candidate
for such per-CPU flag was this_cpu(printk_context). We can steal high
bit (next to NMI printk_safe bit). So the intended use case was something
like this
sysrq/etc /* atomic context */
{
printk_blah_enter();
for (...)
printk();
...
dump_bar();
prinkt_blah_exit();
}
printk_blah_enter() would set that special - printk_safe_mask_blah - bit,
and prinkt_blah_exit() would clear it. Whenever prinkt->vprintk_store()
would see printk_safe_mask_blah bit set it would mark the log_stored message
as "important, always print!", and console_unlock() would always print those
"important" messages.
-ss
next prev parent reply other threads:[~2019-05-28 4:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 0:24 [RFC] printk/sysrq: Don't play with console_loglevel Dmitry Safonov
2019-05-28 3:21 ` Tetsuo Handa
2019-05-28 4:22 ` Sergey Senozhatsky
2019-05-28 8:02 ` Tetsuo Handa
2019-05-28 8:51 ` Sergey Senozhatsky
2019-05-28 10:15 ` Tetsuo Handa
2019-05-28 13:49 ` Petr Mladek
2019-06-07 17:09 ` Pavel Machek
2019-06-08 2:45 ` Tetsuo Handa
2019-06-11 15:10 ` Petr Mladek
2019-06-12 10:06 ` Tetsuo Handa
2019-05-28 4:15 ` Sergey Senozhatsky [this message]
2019-05-28 4:46 ` Sergey Senozhatsky
2019-05-28 13:42 ` Petr Mladek
2019-05-28 14:21 ` Tetsuo Handa
2019-05-28 15:03 ` Petr Mladek
2019-05-28 15:21 ` Tetsuo Handa
2019-05-28 15:58 ` Dmitry Safonov
2019-05-31 14:11 ` Tetsuo Handa
2019-06-02 6:13 ` [RFC] printk: Introduce per context console loglevel Tetsuo Handa
2019-06-02 6:13 ` Tetsuo Handa
2019-06-06 7:59 ` Petr Mladek
2019-06-06 7:59 ` Petr Mladek
2019-06-03 6:51 ` [RFC] printk/sysrq: Don't play with console_loglevel Sergey Senozhatsky
2019-06-06 7:10 ` Petr Mladek
2019-06-12 8:36 ` Sergey Senozhatsky
2019-06-12 12:00 ` Petr Mladek
2019-06-12 14:47 ` Dmitry Safonov
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=20190528041500.GB26865@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=dima@arista.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
/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.