lkml.org 
[lkml]   [2022]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH printk v5 38/40] tty: serial: kgdboc: use console_list_lock to trap exit
Date
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

\
 
 \ /
  Last update: 2022-11-17 12:11    [W:0.066 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site