[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0h6vtmf.fsf@jogness.linutronix.de>
Date: Wed, 21 Feb 2024 14:29:20 +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
Subject: Re: [PATCH printk v2 06/26] printk: nbcon: Ensure ownership release
on failed emit
On 2024-02-20, John Ogness <john.ogness@...utronix.de> wrote:
>> Is there a valid reason when con->write_atomic() would return false
>> and still own the context?
>
> This is driver code, so you must use your imagination. But I thought
> maybe there might be some reason why the driver cannot print the
> message (due to other driver-internal reasons). In this case, it would
> return false even though it never lost ownership.
I have been thinking about this. I think there is nothing useful that
write_atomic() can return. I suggest making it a void return. Then the
driver must print the message if ownership was not lost. This is already
how write() works and I think it is fine.
This simplifies nbcon_emit_next_record() because it can assume
write_atomic() was successful and try to enter the unsafe section for
the @seq update. If ownership was lost, it will be detected here. If
not, the message will be considered handled and @seq is updated.
>> if (WARN_ON_ONCE(!con->write_atomic)) {
>> /*
>> * This function should never be called for legacy consoles.
>> * Handle it as if write_atomic() have lost the ownership
>> * and try to continue.
>> */
>> nbcon_context_release(ctxt);
>> return false;
>> }
I will keep the WARN with a comment similar to your suggestion.
John
Powered by blists - more mailing lists