Re: naming: Re: [PATCH printk v1 05/18] printk: Add non-BKL console basic infrastructure

From: John Ogness
Date: Fri Mar 17 2023 - 09:41:01 EST


On 2023-03-09, Petr Mladek <pmladek@xxxxxxxx> wrote:
> So, this patch adds:
>
> [...]
>
> All the above names seem to be used only by the NOBLK consoles.
> And they use "cons", "NO_BKL", "nobkl", "cons_atomic", "atomic", "console".
>
> I wonder if there is a system or if the names just evolved during several
> reworks.

Yes. And because we didn't really know how to name these different yet
related pieces.

Note that the "atomic" usage is really only referring to the things
related to the atomic part of the console. The console also has a
threaded component.

> ... an easy to distinguish shortcat would be nice
> as a common prefix. The following comes to my mind:
>
> + nbcon - aka nobkl/noblk consoles API
> + acon - atomic console API

"acon" is not really appropriate because they are threaded+atomic
consoles, not just atomic consoles. But it probably isn't necessary to
have separate atomic and threaded API forms. The atomic can still be
used as (for example) nbcon_atomic_enter().

> It would look like:
>
> a) variant with nbcom:
>
>
> CON_NB = BIT(8),
>
> struct nbcon_state {
> atomic_long_t __private atomic_nbcon_state[2];
>
> include/linux/console.h
> kernel/printk/nbcon.c
>
> enum nbcon_state_selector {
> NBCON_STATE_CUR,
>
> nbcon_state_set()
> nbcon_state_try_cmpxchg()
>
> nbcon_init()
> nbcon_cleanup()
>
> nbcon_can_proceed(struct cons_write_context *wctxt);
> nbcon_enter_unsafe(struct cons_write_context *wctxt);
>
> nbcon_enter()
> nbcon_flush_all();
>
> nbcon_emit_next_record()
>
> I would prefer the variant with "nbcon" because
>
> $> git grep nbcon | wc -l
> 0

I also prefer "nbcon". Thanks for finding a name and unique string for
this new code. I will also rename the file to printk_nbcon.c.

John