[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X8phf/jITFd7nV38@alley>
Date: Fri, 4 Dec 2020 17:19:11 +0100
From: Petr Mladek <pmladek@...e.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: consoles: was: [PATCH next v2 3/3] printk: remove logbuf_lock, add
syslog_lock
On Tue 2020-12-01 21:59:41, John Ogness wrote:
> Since the ringbuffer is lockless, there is no need for it to be
> protected by @logbuf_lock. Remove @logbuf_lock.
>
> --- a/kernel/printk/internal.h
> +++ b/kernel/printk/internal.h
> @@ -59,7 +57,7 @@ void defer_console_output(void);
> __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
>
> /*
> - * In !PRINTK builds we still export logbuf_lock spin_lock, console_sem
> + * In !PRINTK builds we still export console_sem
> * semaphore and some of console functions (console_unlock()/etc.), so
> * printk-safe must preserve the existing local IRQ guarantees.
We should revisit whether it is still needed just for console_sem.
Well, I wonder why we need printk_safe at all.
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2432,7 +2490,6 @@ void console_unlock(void)
> size_t len;
>
> printk_safe_enter_irqsave(flags);
Why do we actually need to use the printk_safe context here?
There is not longer a risk of deadlock caused by logbuf_lock.
All other recursions should be prevented by console_trylock()
in printk(). Do I miss anything?
Note that we still need to disable interrupts around
console_lock_spinning_enable();
console_lock_spinning_disable_and_check();
to make sure that printk() could busy wait for passing
the console lock.
> - raw_spin_lock(&logbuf_lock);
> skip:
> if (!prb_read_valid(prb, console_seq, &r))
> break;
Best Regards,
Petr
Powered by blists - more mailing lists