From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: 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 printk 5/5] printk: remove nmi safe buffers
Date: Wed, 23 Sep 2020 18:36:35 +0200 [thread overview]
Message-ID: <20200923163635.GE6442@alley> (raw)
In-Reply-To: <20200922153816.5883-6-john.ogness@linutronix.de>
On Tue 2020-09-22 17:44:16, John Ogness wrote:
> Since the ringbuffer is now lockless, new records can be inserted
> directly from NMI context. There is no need for the NMI safe
> buffers. Handle all NMI printk() calls using defer_console_output()
> to avoid calling console drivers that might have their own locks.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
> kernel/printk/printk_safe.c | 47 ++++---------------------------------
> 1 file changed, 4 insertions(+), 43 deletions(-)
>
> diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c
> index 7c186cefdb50..720935d19a3e 100644
> --- a/kernel/printk/printk_safe.c
> +++ b/kernel/printk/printk_safe.c
> @@ -355,10 +324,11 @@ __printf(1, 0) int vprintk_func(const char *fmt, va_list args)
> #endif
>
> /*
> - * Try to use the main logbuf even in NMI. But avoid calling console
> + * Use the main ringbuffer in NMI. But avoid calling console
> * drivers that might have their own locks.
> */
> - if ((this_cpu_read(printk_context) & PRINTK_NMI_DIRECT_CONTEXT_MASK)) {
> + if ((this_cpu_read(printk_context) &
> + (PRINTK_NMI_CONTEXT_MASK | PRINTK_NMI_DIRECT_CONTEXT_MASK))) {
> int len;
>
> len = vprintk_store(0, LOGLEVEL_DEFAULT, NULL, fmt, args);
> @@ -366,10 +336,6 @@ __printf(1, 0) int vprintk_func(const char *fmt, va_list args)
> return len;
> }
>
> - /* Use extra buffer in NMI. */
> - if (this_cpu_read(printk_context) & PRINTK_NMI_CONTEXT_MASK)
> - return vprintk_nmi(fmt, args);
> -
> /* Use extra buffer to prevent a recursion deadlock in safe mode. */
> if (this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK)
> return vprintk_safe(fmt, args);
I still hope that we will be able to get rid of printk_safe completely.
I would expect that only two situations would need special handling
with the lockless ringbuffer:
+ call vkdb_printf() in kdb context
+ defer console in NMI context
Eventually we should prevent too big level of recursion.
Best Regards,
Petr
prev parent reply other threads:[~2020-09-23 16:36 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 15:38 [PATCH printk 0/5] printk: remove logbuf_lock John Ogness
2020-09-22 15:38 ` [PATCH printk 1/5] printk: get new seq before enabling interrupts John Ogness
2020-09-23 14:17 ` Petr Mladek
2020-09-23 14:36 ` John Ogness
2020-09-22 15:38 ` [PATCH printk 2/5] printk: kmsg_dump_rewind_nolock: start from first record John Ogness
2020-09-23 14:52 ` Petr Mladek
2020-09-23 15:39 ` John Ogness
2020-09-22 15:38 ` [PATCH printk 3/5] printk: use buffer pool for sprint buffers John Ogness
2020-09-23 15:11 ` Petr Mladek
2020-09-23 15:21 ` David Laight
2020-09-23 16:41 ` Petr Mladek
2020-09-24 5:40 ` Sergey Senozhatsky
2020-09-24 8:45 ` Petr Mladek
2020-09-24 8:53 ` Sergey Senozhatsky
2020-09-24 9:49 ` Rasmus Villemoes
2020-09-25 8:15 ` Petr Mladek
2020-09-24 9:54 ` Rasmus Villemoes
2020-09-24 12:32 ` Rasmus Villemoes
2020-09-25 8:28 ` Petr Mladek
2020-09-30 8:06 ` Rasmus Villemoes
2020-09-30 8:51 ` Petr Mladek
2020-09-30 8:57 ` John Ogness
2020-09-30 13:35 ` Steven Rostedt
2020-09-30 14:32 ` David Laight
2020-10-01 7:15 ` Rasmus Villemoes
2020-10-01 7:58 ` Petr Mladek
2020-09-24 1:21 ` Sergey Senozhatsky
2020-09-24 6:17 ` Sergey Senozhatsky
2020-09-24 8:54 ` Petr Mladek
2020-09-24 9:06 ` Sergey Senozhatsky
2020-09-25 8:13 ` Petr Mladek
2020-09-22 15:38 ` [PATCH printk 4/5] printk: remove logbuf_lock, add syslog_lock John Ogness
2020-09-23 16:30 ` Petr Mladek
2020-09-24 8:45 ` Sergey Senozhatsky
2020-09-24 9:21 ` John Ogness
2020-09-22 15:38 ` [PATCH printk 5/5] printk: remove nmi safe buffers John Ogness
2020-09-23 16:36 ` Petr Mladek [this message]
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=20200923163635.GE6442@alley \
--to=pmladek@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--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 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®