linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: Enough to disable preemption in printk deferred context
Date: Wed, 19 Apr 2023 15:51:56 +0206	[thread overview]
Message-ID: <87edog56jv.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <ZD_Yka6MJ_-HOKpj@alley>

On 2023-04-19, Petr Mladek <pmladek@suse.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@linutronix.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


      parent reply	other threads:[~2023-04-19 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  7:42 Petr Mladek
2023-04-19  8:23 ` Sergey Senozhatsky
2023-04-19  8:23 ` Michal Hocko
2023-04-19 10:31   ` Petr Mladek
2023-04-19  9:05 ` John Ogness
2023-04-19 12:03   ` Petr Mladek
2023-04-19 12:14     ` Michal Hocko
2023-04-19 13:45     ` John Ogness [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edog56jv.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox