From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>,
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>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH next v3 3/3] printk: remove logbuf_lock protection for ringbuffer
Date: Wed, 9 Dec 2020 05:35:39 +0900 [thread overview]
Message-ID: <20201208203539.GB1667627@google.com> (raw)
In-Reply-To: <20201207222020.2923-4-john.ogness@linutronix.de>
On (20/12/07 23:26), John Ogness wrote:
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index e1f068677a74..f3c0fcc3163f 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1068,7 +1068,6 @@ void __init setup_log_buf(int early)
> struct printk_record r;
> size_t new_descs_size;
> size_t new_infos_size;
> - unsigned long flags;
> char *new_log_buf;
> unsigned int free;
> u64 seq;
> @@ -1126,8 +1125,6 @@ void __init setup_log_buf(int early)
> new_descs, ilog2(new_descs_count),
> new_infos);
>
> - logbuf_lock_irqsave(flags);
> -
> log_buf_len = new_log_buf_len;
> log_buf = new_log_buf;
> new_log_buf_len = 0;
> @@ -1143,8 +1140,6 @@ void __init setup_log_buf(int early)
> */
> prb = &printk_rb_dynamic;
>
> - logbuf_unlock_irqrestore(flags);
logbuf_lock_irqsave() does two things - it locks the logbuf lock and
enables the printk_safe gating. While we can drop the former, the
latter one must stay until we have a complete replacement.
Looking more:
> ---
> logbuf_lock_irqsave(flags);
>
> log_buf_len = new_log_buf_len;
> log_buf = new_log_buf;
> new_log_buf_len = 0;
>
> free = __LOG_BUF_LEN;
> prb_for_each_record(0, &printk_rb_static, seq, &r)
> free -= add_to_rb(&printk_rb_dynamic, &r);
>
> /*
> * This is early enough that everything is still running on the
> * boot CPU and interrupts are disabled. So no new messages will
> * appear during the transition to the dynamic buffer.
> */
> prb = &printk_rb_dynamic;
>
> logbuf_unlock_irqrestore(flags);
---
I'd say that I'd prefer to keep logbuf initialisation under printk_safe(),
per-CPU buffer can be already initialised at this point. Strictly speaking
we can have new message during transition to the dynamic buffer - there are
functions there that can pr_err/warn while we prb_for_each_record/add_to_rb.
> -ss
next prev parent reply other threads:[~2020-12-08 20:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-07 22:20 [PATCH next v3 0/3] printk: remove logbuf_lock protection of ringbuffer John Ogness
2020-12-07 22:20 ` [PATCH next v3 1/3] printk: inline log_output(),log_store() in vprintk_store() John Ogness
2020-12-07 23:33 ` Joe Perches
2020-12-07 22:20 ` [PATCH next v3 2/3] printk: define CONSOLE_LOG_MAX in printk.h John Ogness
2020-12-08 7:42 ` John Ogness
2020-12-08 14:04 ` Petr Mladek
2020-12-07 22:20 ` [PATCH next v3 3/3] printk: remove logbuf_lock protection for ringbuffer John Ogness
2020-12-08 7:45 ` John Ogness
2020-12-08 14:03 ` Petr Mladek
2020-12-08 20:35 ` Sergey Senozhatsky [this message]
2020-12-08 14:13 ` [PATCH next v3 0/3] printk: remove logbuf_lock protection of ringbuffer Petr Mladek
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=20201208203539.GB1667627@google.com \
--to=sergey.senozhatsky.work@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®