[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v8iz5ww3.fsf@jogness.linutronix.de>
Date: Fri, 17 Mar 2023 14:35:32 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-fsdevel@...r.kernel.org
Subject: Re: global states: was: Re: [PATCH printk v1 05/18] printk: Add
non-BKL console basic infrastructure
On 2023-03-09, Petr Mladek <pmladek@...e.com> wrote:
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -3472,6 +3492,14 @@ void register_console(struct console *newcon)
>> newcon->dropped = 0;
>> console_init_seq(newcon, bootcon_registered);
>>
>> + if (!(newcon->flags & CON_NO_BKL))
>> + have_bkl_console = true;
>
> We never clear this value even when the console gets unregistered.
OK. I'll allow it to be cleared on unregister by checking the registered
list.
>> @@ -3515,6 +3543,9 @@ void register_console(struct console *newcon)
>> if (con->flags & CON_BOOT)
>> unregister_console_locked(con);
>> }
>> +
>> + /* All boot consoles have been unregistered. */
>> + have_boot_console = false;
>
> The boot consoles can be removed also by printk_late_init().
>
> I would prefer to make this more error-proof and update both
> have_bkl_console and have_boot_console in unregister_console().
OK.
> A solution would be to use a reference counter instead of the boolean.
> I am not sure if it is worth it. But it seems that refcount_read()
> is just simple atomic read, aka READ_ONCE().
Well, we are holding the console_list_lock, so we can just iterate over
the list. Iteration happens later in the series anyway, in order to
create/run the NOBKL threads.
John
Powered by blists - more mailing lists