Re: [PATCH printk v3 15/15] printk: remove @console_locked

Petr Mladek
2022-04-21T12:46:12Z

On Wed 2022-04-20 01:52:37, John Ogness wrote:
> The static global variable @console_locked is used to help debug
> VT code to make sure that certain code paths are running with
> the console_lock held. However, this information is also available
> with the static global variable @console_kthreads_blocked (for
> locking via console_lock()), and the static global variable
> @console_kthreads_active (for locking via console_trylock()).
>
> Remove @console_locked and update is_console_locked() to use the
> alternative variables.
>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2705,13 +2696,11 @@ void console_lock_single_hold(struct console *con)
> might_sleep();
> down_console_sem();
> mutex_lock(&con->lock);
> - console_locked = 1;

is_console_locked() is not able to detect that a given console
is locked by console_lock_single_hold().

> console_may_schedule = 1;
> }
>

Best Regards,
Petr