linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <mladek.petr@gmail.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Subject: Re: [GIT PULL] printk for 5.10 (includes lockless ringbuffer)
Date: Thu, 15 Oct 2020 10:03:00 +0200	[thread overview]
Message-ID: <20201015080300.GE13775@alley> (raw)
In-Reply-To: <49292e1a-7e46-b078-d15d-fb2f406317db@rasmusvillemoes.dk>

On Wed 2020-10-14 16:58:27, Rasmus Villemoes wrote:
> On 14/10/2020 16.16, Geert Uytterhoeven wrote:
> > Hi Petr,
> > 
> > On Mon, Oct 12, 2020 at 4:50 PM Petr Mladek <pmladek@suse.com> wrote:
> >> - Fully lockless ringbuffer implementation, including the support for
> >>   continuous lines. It will allow to store and read messages in any
> >>   situation wihtout the risk of deadlocks and without the need
> >>   of temporary per-CPU buffers.
> > 
> >     linux-m68k-atari_defconfig$ bloat-o-meter vmlinux.old
> > vmlinux.lockless_ringbuffer
> >     add/remove: 39/16 grow/shrink: 9/15 up/down: 214075/-4362 (209713)
> >     Function                                     old     new   delta
> >     _printk_rb_static_infos                        -  180224 +180224
> >     _printk_rb_static_descs                        -   24576  +24576
> >     [...]
> > 
> > Seriously?!? Or am I being misled by the tools?
> > 
> >     linux-m68k-atari_defconfig$ size vmlinux.old vmlinux.lockless_ringbuffer
> >        text    data     bss     dec     hex filename
> >     3559108 941716 177772 4678596 4763c4 vmlinux.old
> >     3563922 1152496 175276 4891694 4aa42e vmlinux.lockless_ringbuffer
> > 
> > Apparently not...
> 
> Hm, that's quite a lot. And the only reason the buffers don't live
> entirely in .bss is because a few of their entries have non-zero
> initializers.
> 
> Perhaps one could add a .init.text.initialize_static_data section of
> function pointers, with the _DEFINE_PRINTKRB macro growing something like
> 
> static void __init __initialize_printkrb_##name(void) { \
>   _##name##_descs[_DESCS_COUNT(descbits) - 1] = ...; \
>   _##name##_infos[0] = ...; \
>   _##name##_infos[_DESCS_COUNT(descbits) - 1] = ...; \
> } \
> static_data_initializer(__initialize_printkrb_##name);
> 
> with static_data_initalizer being the obvious yoga for putting a
> function pointer in the .init.text.initialize_static_data section. Then
> very early in start_kernel(), probably first thing, iterate that section
> and call all the functions. But maybe that's not even early enough?

A solution might be to initialize the buffer during the first
printk() call. We could make sure that it is done in
setup_log_buf() at latest. It is called when only one CPU is
running so it should be safe. The only problem might be NMI.

Best Regards,
Petr

  parent reply	other threads:[~2020-10-15  8:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 14:49 [GIT PULL] printk for 5.10 (includes lockless ringbuffer) Petr Mladek
2020-10-13 23:49 ` pr-tracker-bot
2020-10-14 14:16 ` Geert Uytterhoeven
2020-10-14 14:58   ` Rasmus Villemoes
2020-10-14 15:07     ` Geert Uytterhoeven
2020-10-15  8:03     ` Petr Mladek [this message]
2020-10-14 20:55   ` John Ogness
2020-10-15  7:52     ` Petr Mladek
2020-10-16 15:05 Petr Mladek
2020-10-16 19:54 ` pr-tracker-bot
2020-11-27 13:47 Petr Mladek
2020-11-27 19:19 ` pr-tracker-bot

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=20201015080300.GE13775@alley \
    --to=mladek.petr@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel.thompson@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).