Re: [PATCH printk v3 4/7] printk: nbcon: Add ownership state functions

From: John Ogness
Date: Fri Sep 08 2023 - 09:20:39 EST


On 2023-09-06, Petr Mladek <pmladek@xxxxxxxx> wrote:
>> +static bool nbcon_context_can_proceed(struct nbcon_context *ctxt, struct nbcon_state *cur)
>> +{

[...]

>> + /*
>> + * It is not known whether the handover succeeded. The outermost
>
> It was not immediately clear to me what exactly "handover succeeded" did mean.
> I would write:
>
> * It is not clear whether the waiter really took the lock
> * and re-printed the record. The outermost calsite...

It is not just about printing. A console is locked by drivers for other
purposes as well. And that is the situation that this comment is mostly
targetting. For v4 I change it to:

/*
* It is not clear whether the waiter really took over ownership. The
* outermost callsite must make the final decision whether console
* ownership is needed for it to proceed. If yes, it must reacquire
* ownership (possibly hostile) before carefully proceeding.
*
* The calling context no longer owns the console so go back all the
* way instead of trying to implement reacquire heuristics in tons of
* places.
*/

John Ogness