Re: [PATCH printk v3 01/19] printk: nbcon: Clarify nbcon_get_default_prio() context

From: Petr Mladek
Date: Fri Jul 26 2024 - 04:57:40 EST


On Mon 2024-07-22 19:25:21, John Ogness wrote:
> Correct the kerneldoc and code comments that claimed migration must
> be disabled for nbcon_get_default_prio(). This is not true.
>
> Add the explation in the kerneldoc.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> ---
> kernel/printk/nbcon.c | 5 ++++-
> kernel/printk/printk.c | 2 --
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
> index ef6e76db0f5a..d8388faa6500 100644
> --- a/kernel/printk/nbcon.c
> +++ b/kernel/printk/nbcon.c
> @@ -970,9 +970,12 @@ static __ref unsigned int *nbcon_get_cpu_emergency_nesting(void)
> * nbcon_get_default_prio - The appropriate nbcon priority to use for nbcon
> * printing on the current CPU
> *
> - * Context: Any context which could not be migrated to another CPU.
> + * Context: Any context.
> * Return: The nbcon_prio to use for acquiring an nbcon console in this
> * context for printing.
> + *
> + * Allowing migration enabled relies on the fact that a context cannot be
> + * migrated to panic or emergency state CPUs.

The sentence sounds really cryptic to me. I personally prefer
straightforward descriptions for dummies ;-) What about the following?

* The function reads per-CPU variables but it is safe in any context.
* The CPU migration is disabled in panic or emergency CPU context
* by definition.

> */
> enum nbcon_prio nbcon_get_default_prio(void)
> {

I do not resist on the comment update. Feel free to use:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr