[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87edog56jv.fsf@jogness.linutronix.de>
Date: Wed, 19 Apr 2023 15:51:56 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Michal Hocko <mhocko@...e.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] printk: Enough to disable preemption in printk deferred
context
On 2023-04-19, Petr Mladek <pmladek@...e.com> wrote:
> A solution would be to make this more clear in the comment.
> Something like:
>
> /*
> * The printk_deferred_enter/exit macros are available only as a hack.
> * They define a per-CPU context where all printk console printing
> * is deferred because it might cause a deadlock otherwise.
> *
> * The API user is responsible for calling the corresponding enter/exit
> * pair on the same CPU. It is highly recommended to use them only in
> * a context with interrupts disabled. Otherwise, other unrelated
> * printk() calls might be deferred when they interrupt/preempt
> * the deferred code section.
> */
I an happy with this comment. I saw Michal's follow-up suggestion, but
would prefer this one. It is a more technical desciption of the issue
and clearly recommends that the user should disable interrupts.
If you use this comment:
Reviewed-by: John Ogness <john.ogness@...utronix.de>
> Another solution would be to stay on the "safe" side and keep the
> comment as is or even enforce disabling interrupts by the API.
>
> I would personally just improve the comment. It is good to describe
> the situation correctly. We could always add restrictions when
> there are problems in practice.
Agreed.
John
Powered by blists - more mailing lists