From: Hannes Reinecke <hare@suse.com>
To: Steven Rostedt <rostedt@goodmis.org>, Mark Brown <broonie@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
"ksummit-discuss@lists.linuxfoundation.org"
<ksummit-discuss@lists.linuxfoundation.org>
Subject: Re: [Ksummit-discuss] [TECH TOPIC] printk redesign
Date: Wed, 21 Jun 2017 09:17:03 +0200 [thread overview]
Message-ID: <6d5d0115-6a6a-ecf0-5dc2-d359bb2c10a8@suse.com> (raw)
In-Reply-To: <20170620192858.142a43ff@gandalf.local.home>
On 06/21/2017 01:28 AM, Steven Rostedt wrote:
> On Tue, 20 Jun 2017 18:27:38 +0100
> Mark Brown <broonie@kernel.org> wrote:
>
>> On Wed, Jun 21, 2017 at 02:11:34AM +0900, Sergey Senozhatsky wrote:
>>
>>> another thing that I found useful is a CPU number of the processor
>>> that stored a particular line to the logbuf.
>>
>> At some point we start reinventing ftrace... there's issues with
>> joining the two up but there should at least be lessons we can learn.
>
> I've thought about this a little too.
>
Of course you would :-)
> I would like printk to have per-cpu buffers. Then we don't even need to
> store the CPU number, that would be explicit by which buffer the data
> is stored in.
>
> The one thing that is needed, is the consumer. In ftrace, it's whatever
> reads the buffer, which is usually user space, but can be the kernel
> (see sysctl-z). But there's only one consumer at a time.
>
> I was thinking about a new design for printk. Similar to ftrace, but
> different.
>
> 1) have per cpu buffers, that are lockless. Writes happen immediately,
> but the output happens later.
>> 2) have two types of console interfaces. A normal and a critical.
>
> 3) have a thread that is woken whenever there is data in any of the
> buffers, and reads the buffers, again lockless. But to do this in a
> reasonable manner, unless you break the printks up in sub buffers like
> ftrace, if the consumer isn't fast enough, newer messages are dropped.
>
I'd rather have the _older_ messages dropped. Or make this a policy.
But in general one should be able to adjust the buffer size so that this
doesn't occur.
> 4) If a critical print is needed (and here's why we have two console
> interfaces), the normal console interface gets turned off, and the
> buffers stop being output through them. What ever called the critical
> print, will take over, and flush out all the contents of the current
> buffers. Then anything printed during the critical section will go out
> immediately (no buffering). The printk thread, will stop having access
> to the buffers, and shutdown till the critical section is complete.
>
Hmm. Ideally the critical print will be shipped out _without_ having to
wait for the normal buffer contents.
(Adding the message _at the tail_ and rewinding the buffer to that?)
Remember, there might be _lots_ of 'normal' buffer entries (like system
screaming just before OOM kicks in), so we might not have enough time
shipping out all entries, and the really critical one might never be seen.
_If_ all messages are proper prefixed with a timestamp (and possibly CPU
number) it doesn't really matter if messages are printed out of order;
one can always sort them later on.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.com +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2017-06-21 7:17 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 5:21 Sergey Senozhatsky
2017-06-19 6:22 ` Hannes Reinecke
2017-06-19 14:39 ` Steven Rostedt
2017-06-19 15:20 ` Andrew Lunn
2017-06-19 15:54 ` Hannes Reinecke
2017-06-19 16:17 ` Andrew Lunn
2017-06-19 16:23 ` Mark Brown
2017-06-20 15:58 ` Sergey Senozhatsky
2017-06-20 16:44 ` Luck, Tony
2017-06-20 17:11 ` Sergey Senozhatsky
2017-06-20 17:27 ` Mark Brown
2017-06-20 23:28 ` Steven Rostedt
2017-06-21 7:17 ` Hannes Reinecke [this message]
2017-06-21 11:12 ` Sergey Senozhatsky
2017-06-22 14:06 ` Steven Rostedt
2017-06-23 5:43 ` Sergey Senozhatsky
2017-06-23 13:09 ` Steven Rostedt
2017-06-21 12:23 ` Petr Mladek
2017-06-21 14:18 ` Andrew Lunn
2017-06-23 8:46 ` Petr Mladek
2017-06-21 16:09 ` Andrew Lunn
2017-06-23 8:49 ` Petr Mladek
2017-07-19 7:35 ` David Woodhouse
2017-07-20 7:53 ` Sergey Senozhatsky
2017-06-20 16:09 ` Sergey Senozhatsky
2017-06-19 16:26 ` Steven Rostedt
2017-06-19 16:35 ` Andrew Lunn
2017-06-24 11:14 ` Mauro Carvalho Chehab
2017-06-24 14:06 ` Andrew Lunn
2017-06-24 22:42 ` Steven Rostedt
2017-06-24 23:21 ` Andrew Lunn
2017-06-24 23:26 ` Linus Torvalds
2017-06-24 23:40 ` Steven Rostedt
2017-06-26 11:16 ` Sergey Senozhatsky
2017-06-24 23:48 ` Al Viro
2017-06-25 1:29 ` Andrew Lunn
2017-06-25 2:41 ` Linus Torvalds
2017-06-26 8:46 ` Jiri Kosina
2017-07-19 7:59 ` David Woodhouse
2017-06-20 15:56 ` Sergey Senozhatsky
2017-06-20 18:45 ` Daniel Vetter
2017-06-21 9:29 ` Petr Mladek
2017-06-21 10:15 ` Sergey Senozhatsky
2017-06-22 13:42 ` Daniel Vetter
2017-06-22 13:48 ` Daniel Vetter
2017-06-23 9:07 ` Bartlomiej Zolnierkiewicz
2017-06-27 13:06 ` Sergey Senozhatsky
2017-06-23 5:20 ` Sergey Senozhatsky
2017-06-19 23:46 ` Josh Triplett
2017-06-20 8:24 ` Arnd Bergmann
2017-06-20 14:36 ` Steven Rostedt
2017-06-20 15:26 ` Sergey Senozhatsky
2017-06-22 16:35 ` David Howells
2017-07-19 6:24 ` Sergey Senozhatsky
2017-07-19 6:25 ` Sergey Senozhatsky
2017-07-19 7:26 ` Daniel Vetter
2017-07-20 5:19 ` 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=6d5d0115-6a6a-ecf0-5dc2-d359bb2c10a8@suse.com \
--to=hare@suse.com \
--cc=broonie@kernel.org \
--cc=ksummit-discuss@lists.linuxfoundation.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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