[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87r0a8wo0t.fsf@jogness.linutronix.de>
Date: Wed, 28 Aug 2024 19:39:22 +0206
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>
Subject: Re: [PATCH printk v4 06/17] printk: nbcon: Introduce printer kthreads
On 2024-08-27, Petr Mladek <pmladek@...e.com> wrote:
>> +/**
>> + * nbcon_kthread_create - Create a console printer thread
>> + * @con: Console to operate on
>> + *
>> + * Return: True if the kthread was started or already exists.
>> + * Otherwise false and @con must not be registered.
>> + *
>> + * If @con was already registered, it must be unregistered before
>> + * the global state variable @printk_kthreads_running can be set.
>
> This paragraph is quite confusing without more context.
Agreed.
> I would either remove it completely or write something like:
>
> <proposal>
> * This function is called when nbcon consoles are supposed to be flushed
> * using the kthread. The messages printed with NBCON_PRIO_NORMAL are not
> * longer flushed by the legacy loop. This is why the failure is considered
> * fatal leading to the console unregistration.
> </proposal>
For v5 I am keeping both, slightly modified:
* This function is called when it will be expected that nbcon consoles are
* flushed using the kthread. The messages printed with NBCON_PRIO_NORMAL
* will be no longer flushed by the legacy loop. This is why failure must
* be fatal for console registration.
*
* If @con was already registered and this function fails, @con must be
* unregistered before the global state variable @printk_kthreads_running
* can be set.
>> @@ -1419,6 +1644,13 @@ bool nbcon_alloc(struct console *con)
>> con_printk(KERN_ERR, con, "failed to allocate printing buffer\n");
>> return false;
>> }
>> +
>> + if (printk_kthreads_running) {
>> + if (!nbcon_kthread_create(con)) {
>> + kfree(con->pbufs);
>
> It probably is not much important but I would rather do here:
>
> con->pbufs = NULL;
Sure.
I'll leave off your Reviewed-by since the comment changes are a bit
different than you suggested.
John
Powered by blists - more mailing lists