Re: [PATCH] printk: Update @console_may_schedule in console_trylock_spinning()

From: Mukesh Ojha
Date: Tue Feb 27 2024 - 11:38:14 EST




On 2/26/2024 6:32 PM, John Ogness wrote:
On 2024-02-26, Mukesh Ojha <quic_mojha@xxxxxxxxxxx> wrote:
what if console_trylock_spinning() gets the lock which makes
console_may_schedule =1 and it is still schedulable ?

I am afraid I do not understand the question.

console_trylock_spinning() is only called from the printk caller
context. In this context, console_may_schedule is always set to 0.

Only if another context acquires the console lock per sleeping wait,
console_lock(), can console_may_schedule be set to 1.

Note that the value of console_may_schedule is only relevant for the
console lock owner when console_unlock() is called. That is why its
value is set when locking the console (or, with this patch, when
transferring console lock ownerhip).

I overlooked it, thanks.
Patch LGTM.

Reviewed-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx>

-Mukesh

John