From: John Ogness <john.ogness@linutronix.de>
To: Doug Anderson <dianders@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
Jason Wessel <jason.wessel@windriver.com>,
Daniel Thompson <daniel.thompson@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
kgdb-bugreport@lists.sourceforge.net,
linux-serial@vger.kernel.org
Subject: Re: [PATCH printk v5 38/40] tty: serial: kgdboc: use console_list_lock to trap exit
Date: Thu, 17 Nov 2022 12:14:09 +0106 [thread overview]
Message-ID: <87mt8pon3a.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <CAD=FV=VouG3ihFCg4gC3dNFs7TqzpDgowHd38y8fR8qiTfRw_A@mail.gmail.com>
On 2022-11-16, Doug Anderson <dianders@chromium.org> wrote:
>> /*
>> - * Hold the console_lock to guarantee that no consoles are
>> + * Hold the console_list_lock to guarantee that no consoles are
>> * unregistered until the kgdboc_earlycon setup is complete.
>> * Trapping the exit() callback relies on exit() not being
>> * called until the trap is setup. This also allows safe
>> * traversal of the console list and race-free reading of @flags.
>> */
>> - console_lock();
>> + console_list_lock();
>> for_each_console(con) {
>> if (con->write && con->read &&
>> (con->flags & (CON_BOOT | CON_ENABLED)) &&
>
> Officially don't we need both the list lock and normal lock here since
> we're reaching into the consoles?
AFAICT the only synchronization we need here is iterating the console
list, reading con->flags of a registered console, and modifying
con->exit of a registered console. The console_list_lock provides
synchronization for all of these things. By the end of this series the
console_lock does not provide synchronization for any of these things.
Is there something else that requires synchronization here?
After this series the console_lock is still responsible for:
- serializing console->write() callbacks
- stopping console->write() callbacks
- stopping console->device() callbacks
- synchronizing console->seq
- synchronizing console->dropped
- synchronizing the global @console_suspended
- providing various unclear protection for vt consoles
- some bizarre misuses in bcache
The scope may be larger than the above list. The investigation is still
ongoing.
John
next prev parent reply other threads:[~2022-11-17 11:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 16:21 [PATCH printk v5 00/40] reduce console_lock scope John Ogness
2022-11-16 16:21 ` [PATCH printk v5 01/40] serial: kgdboc: Lock console list in probe function John Ogness
2022-11-16 16:21 ` [PATCH printk v5 08/40] tty: serial: kgdboc: document console_lock usage John Ogness
2022-11-16 16:21 ` [PATCH printk v5 22/40] serial_core: replace uart_console_enabled() with uart_console_registered() John Ogness
2022-11-16 16:21 ` [PATCH printk v5 26/40] tty: serial: earlycon: use console_is_registered() John Ogness
2022-11-16 16:21 ` [PATCH printk v5 27/40] tty: serial: pic32_uart: " John Ogness
2022-11-16 16:21 ` [PATCH printk v5 28/40] tty: serial: samsung_tty: " John Ogness
2022-11-16 16:21 ` [PATCH printk v5 29/40] tty: serial: xilinx_uartps: " John Ogness
2022-11-16 16:21 ` [PATCH printk v5 35/40] tty: serial: kgdboc: use srcu console list iterator John Ogness
2022-11-17 0:59 ` Doug Anderson
2022-11-17 9:32 ` John Ogness
2022-11-16 16:21 ` [PATCH printk v5 36/40] tty: serial: kgdboc: use console_list_lock for list traversal John Ogness
2022-11-17 0:59 ` Doug Anderson
2022-11-16 16:21 ` [PATCH printk v5 37/40] tty: serial: kgdboc: synchronize tty_find_polling_driver() and register_console() John Ogness
2022-11-17 0:59 ` Doug Anderson
2022-11-17 10:00 ` John Ogness
2022-11-16 16:21 ` [PATCH printk v5 38/40] tty: serial: kgdboc: use console_list_lock to trap exit John Ogness
2022-11-17 0:56 ` Doug Anderson
2022-11-17 11:08 ` John Ogness [this message]
2022-11-16 16:21 ` [PATCH printk v5 40/40] tty: serial: sh-sci: use setup() callback for early console John Ogness
2022-11-18 11:22 ` [PATCH printk v5 00/40] reduce console_lock scope Petr Mladek
2022-11-18 14:55 ` Petr Mladek
2022-11-22 16:43 ` Greg Kroah-Hartman
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=87mt8pon3a.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jason.wessel@windriver.com \
--cc=jirislaby@kernel.org \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tglx@linutronix.de \
/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).