From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Borislav Petkov <bp@alien8.de>, Petr Mladek <pmladek@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] printk: increase devkmsg write() ratelimit
Date: Fri, 21 Dec 2018 16:32:15 +0900 [thread overview]
Message-ID: <20181221073215.GA8951@jagdpanzerIV> (raw)
In-Reply-To: <20181220085803.4c5853e8@gandalf.local.home>
On (12/20/18 08:58), Steven Rostedt wrote:
> > > Userspace processes should never be able to overwrite messages
> > > from the kernel.
> >
> > I would agree.
> >
> > It's a bit funny that kernel people first take the patch in and then,
> > when user-space begins to use the feature, start to object and ratelimit.
>
> Please note the "kernel people" to first take it in, were also systemd
> developers.
Good point.
> Honestly, it should have been a separate buffer to begin with, and I
> wish I pushed for that when it was first added. It's not too late. We
> can still make it a separate buffer.
Ideally, yes, separating them will make sense.
[..]
> When the system is up and running, it works. But I believe systemd can
> still only use ksmsg for initial boot up messages before it does the
> chroot.
[..]
> Do you get systemd messages before chroot with this patch compared to
> what you get without it?
You are right.
systemd cannot log anything really early - there should be /dev/kmsg char
device so they can open() it and write() to it. IOW only after chr_dev_init()
they can append messages to devkmsg. Which is still early enough, perhaps
earlier than UART init. systemd can log to tty, but unlike logbuf messages,
messages written to tty cannot be re-played:
+-> chr_dev_init() create /dev/kmsg
| persistent storage is not mounted yet
| writes to /dev/kmsg work
| ...
| chroot
| mount /dev/sdX
+-> journald starts
pulls logbuf (devkmsg)
syslog now works
"systemd[1]: Starting Flush Journal to Persistent Storage..."
So without devkmsg some early systemd messages can be lost (between
chr_dev_init() and exec(journald)), just like you said; or (best case)
will go to serial log. Messages before chr_dev_init() will be lost
because there is no /dev/kmsg; messages after exec(journald) do not
necessarily depend on /dev/kmsg and can be logged via syslog/journal
interface.
-ss
next prev parent reply other threads:[~2018-12-21 7:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 9:18 [RFC][PATCH] printk: increase devkmsg write() ratelimit Sergey Senozhatsky
2018-12-18 10:48 ` Peter Zijlstra
2018-12-18 11:17 ` Sergey Senozhatsky
2018-12-18 11:29 ` Peter Zijlstra
2018-12-18 13:09 ` Sergey Senozhatsky
2018-12-18 11:47 ` Borislav Petkov
2018-12-18 13:07 ` Sergey Senozhatsky
2018-12-18 14:26 ` Borislav Petkov
2018-12-18 14:55 ` Sergey Senozhatsky
2018-12-18 15:03 ` Borislav Petkov
2018-12-18 15:14 ` Sergey Senozhatsky
2018-12-18 15:24 ` Borislav Petkov
2018-12-18 16:52 ` Sergey Senozhatsky
2018-12-18 17:21 ` Peter Zijlstra
2018-12-18 17:37 ` Steven Rostedt
2018-12-19 8:50 ` Petr Mladek
2018-12-20 11:35 ` Sergey Senozhatsky
2018-12-20 13:58 ` Steven Rostedt
2018-12-21 7:32 ` Sergey Senozhatsky [this message]
2018-12-18 17:47 ` Borislav Petkov
2018-12-19 1:46 ` Sergey Senozhatsky
2018-12-18 14:02 ` Sergey Senozhatsky
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=20181221073215.GA8951@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox