All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Elver <elver@google.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Andrea Parri <parri.andrea@gmail.com>,
	Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Paul McKenney <paulmck@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v5 4/4] printk: use the lockless ringbuffer
Date: Sat, 18 Jul 2020 14:10:53 +0200	[thread overview]
Message-ID: <20200718121053.GA691245@elver.google.com> (raw)
In-Reply-To: <20200709132344.760-5-john.ogness@linutronix.de>

On Thu, Jul 09, 2020 at 03:29PM +0206, John Ogness wrote:
> Replace the existing ringbuffer usage and implementation with
> lockless ringbuffer usage. Even though the new ringbuffer does not
> require locking, all existing locking is left in place. Therefore,
> this change is purely replacing the underlining ringbuffer.
> 
> Changes that exist due to the ringbuffer replacement:
> 
> - The VMCOREINFO has been updated for the new structures.
> 
> - Dictionary data is now stored in a separate data buffer from the
>   human-readable messages. The dictionary data buffer is set to the
>   same size as the message buffer. Therefore, the total required
>   memory for both dictionary and message data is
>   2 * (2 ^ CONFIG_LOG_BUF_SHIFT) for the initial static buffers and
>   2 * log_buf_len (the kernel parameter) for the dynamic buffers.
> 
> - Record meta-data is now stored in a separate array of descriptors.
>   This is an additional 72 * (2 ^ (CONFIG_LOG_BUF_SHIFT - 5)) bytes
>   for the static array and 72 * (log_buf_len >> 5) bytes for the
>   dynamic array.
> 
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> Reviewed-by: Petr Mladek <pmladek@suse.com>

It seems this causes a regression observed at least with newline-only
printks. I noticed this during -next testing because various debugging
tools (K*SAN, lockdep, etc.) use e.g. pr_{err,warn,info}("\n") to format
reports.

Without wanting to wait for a report from one of these debugging tools,
a simple reproducer is below. Without this patch, the expected newline
is printed.

Thanks,
-- Marco

------ >8 ------

--- a/init/main.c
+++ b/init/main.c
@@ -1039,6 +1039,10 @@ asmlinkage __visible void __init start_kernel(void)
 	sfi_init_late();
 	kcsan_init();
 
+	pr_info("EXPECT BLANK LINE --vv\n");
+	pr_info("\n");
+	pr_info("EXPECT BLANK LINE --^^\n");
+
 	/* Do the rest non-__init'ed, we're now alive */
 	arch_call_rest_init();
 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Marco Elver <elver@google.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrea Parri <parri.andrea@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Paul McKenney <paulmck@kernel.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/4] printk: use the lockless ringbuffer
Date: Sat, 18 Jul 2020 14:10:53 +0200	[thread overview]
Message-ID: <20200718121053.GA691245@elver.google.com> (raw)
In-Reply-To: <20200709132344.760-5-john.ogness@linutronix.de>

On Thu, Jul 09, 2020 at 03:29PM +0206, John Ogness wrote:
> Replace the existing ringbuffer usage and implementation with
> lockless ringbuffer usage. Even though the new ringbuffer does not
> require locking, all existing locking is left in place. Therefore,
> this change is purely replacing the underlining ringbuffer.
> 
> Changes that exist due to the ringbuffer replacement:
> 
> - The VMCOREINFO has been updated for the new structures.
> 
> - Dictionary data is now stored in a separate data buffer from the
>   human-readable messages. The dictionary data buffer is set to the
>   same size as the message buffer. Therefore, the total required
>   memory for both dictionary and message data is
>   2 * (2 ^ CONFIG_LOG_BUF_SHIFT) for the initial static buffers and
>   2 * log_buf_len (the kernel parameter) for the dynamic buffers.
> 
> - Record meta-data is now stored in a separate array of descriptors.
>   This is an additional 72 * (2 ^ (CONFIG_LOG_BUF_SHIFT - 5)) bytes
>   for the static array and 72 * (log_buf_len >> 5) bytes for the
>   dynamic array.
> 
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> Reviewed-by: Petr Mladek <pmladek@suse.com>

It seems this causes a regression observed at least with newline-only
printks. I noticed this during -next testing because various debugging
tools (K*SAN, lockdep, etc.) use e.g. pr_{err,warn,info}("\n") to format
reports.

Without wanting to wait for a report from one of these debugging tools,
a simple reproducer is below. Without this patch, the expected newline
is printed.

Thanks,
-- Marco

------ >8 ------

--- a/init/main.c
+++ b/init/main.c
@@ -1039,6 +1039,10 @@ asmlinkage __visible void __init start_kernel(void)
 	sfi_init_late();
 	kcsan_init();
 
+	pr_info("EXPECT BLANK LINE --vv\n");
+	pr_info("\n");
+	pr_info("EXPECT BLANK LINE --^^\n");
+
 	/* Do the rest non-__init'ed, we're now alive */
 	arch_call_rest_init();
 

  parent reply	other threads:[~2020-07-18 12:11 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 13:23 [PATCH v5 0/4] printk: replace ringbuffer John Ogness
2020-07-09 13:23 ` John Ogness
2020-07-09 13:23 ` [PATCH v5 1/4] crash: add VMCOREINFO macro to define offset in a struct declared by typedef John Ogness
2020-07-09 13:23   ` John Ogness
2020-07-09 13:23 ` [PATCH v5 2/4] printk: add lockless ringbuffer John Ogness
2020-07-09 13:23   ` John Ogness
2020-07-10  8:43   ` Sergey Senozhatsky
2020-07-10  8:43     ` Sergey Senozhatsky
2020-07-10  8:47     ` Sergey Senozhatsky
2020-07-10  8:47       ` Sergey Senozhatsky
2020-07-09 13:23 ` [PATCH v5 3/4] Revert "printk: lock/unlock console only for new logbuf entries" John Ogness
2020-07-09 13:23   ` John Ogness
2020-07-09 13:23 ` [PATCH v5 4/4] printk: use the lockless ringbuffer John Ogness
2020-07-09 13:23   ` John Ogness
2020-07-14  5:26   ` [printk] 96d5c61b1f: stress-ng.timerfd.ops_per_sec 8.3% improvement kernel test robot
2020-07-14  5:26     ` kernel test robot
2020-07-18 12:10   ` Marco Elver [this message]
2020-07-18 12:10     ` [PATCH v5 4/4] printk: use the lockless ringbuffer Marco Elver
2020-07-19  3:43     ` Sergey Senozhatsky
2020-07-19  3:43       ` Sergey Senozhatsky
2020-07-20  6:43       ` Marco Elver
2020-07-20  6:43         ` Marco Elver
2020-07-20  8:22         ` Andy Shevchenko
2020-07-20  8:22           ` Andy Shevchenko
2020-07-20  8:34         ` Sergey Senozhatsky
2020-07-20  8:34           ` Sergey Senozhatsky
2020-07-20  8:41         ` Sergey Senozhatsky
2020-07-20  8:41           ` Sergey Senozhatsky
2020-07-20  9:40           ` Marco Elver
2020-07-20  9:40             ` Marco Elver
2020-07-20 10:01             ` Dmitry Vyukov
2020-07-20 10:01               ` Dmitry Vyukov
2020-07-20 10:20     ` John Ogness
2020-07-20 10:20       ` John Ogness
2020-07-20 10:32       ` Marco Elver
2020-07-20 10:32         ` Marco Elver
2020-08-11 20:47   ` Nick Desaulniers
2020-08-11 20:47     ` Nick Desaulniers
2020-08-12 16:40     ` John Ogness
2020-08-12 16:40       ` John Ogness
2021-01-22 23:52   ` Issue in dmesg time with lockless ring buffer J. Avila
2021-01-22 23:52     ` J. Avila
2021-01-25 13:32     ` John Ogness
2021-01-25 13:32       ` John Ogness
2021-01-26  0:00       ` J. Avila
2021-01-26  0:00         ` J. Avila
2021-01-29  1:46         ` J. Avila
2021-01-29  1:46           ` J. Avila
2020-07-10  8:28 ` [PATCH v5 0/4] printk: replace ringbuffer Petr Mladek
2020-07-10  8:28   ` Petr Mladek
2020-07-13  2:23   ` Sergey Senozhatsky
2020-07-13  2:23     ` 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=20200718121053.GA691245@elver.google.com \
    --to=elver@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --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 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.