Re: [PATCH printk v2 12/38] tty: serial: kgdboc: use console_is_enabled()

From: Petr Mladek
Date: Mon Nov 07 2022 - 03:47:48 EST


On Fri 2022-11-04 17:29:15, John Ogness wrote:
> On 2022-10-24, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
> > It actually only holds console_list_lock() even at the end of the
> > series. Still, it seems weird that we're declaring the `data_race` on
> > CON_ENABLED but not CON_BOOT ?
>
> For my upcoming v3 I decided to drop this patch and will keep the
> existing direct reading of @flags. Instead of this patch, for v3 the
> comment will additionally mention why @flags is allowed to be directly
> read:
>
> /*
> * Hold the console_lock to guarantee that no consoles are
^^^^^^^^^^^^
> * unregistered until the kgdboc_earlycon setup is complete.

My understanding is that this is synchronized by console_list_lock.
Or do I miss something?

> * 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.
> */

Best Regards,
Petr