All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Willy Tarreau <w@1wt.eu>
Subject: Re: [PATCH v3] auxdisplay: Remove in_interrupt() usage.
Date: Tue, 16 Feb 2021 13:42:19 +0100	[thread overview]
Message-ID: <CANiq72mge40Uvqf3mb4uof2gi8ktvhjoodfyJY7uLW4guTnvDw@mail.gmail.com> (raw)
In-Reply-To: <20210216102856.dnaycukt3oqxoszp@linutronix.de>

On Tue, Feb 16, 2021 at 11:28 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> Could we please avoid documenting the obvious? It is more or less common
> knowledge that the write callback (like any other) is preemptible user
> context (in which write occurs). The same is true for register/probe
> functions. The non-preemptible / atomic is mostly the exception because
> of the callback. Like from a timer or an interrupt.

It is not so much about documenting the obvious, but about stating
that 1) the precondition was properly taken into account and that 2)
nothing non-obvious is undocumented. When code is changed later on, it
is much more likely assumptions are broken if not documented.

In fact, from a quick git blame, that seems to be what happened here:
originally the function could be called from a public function
intended to be used from inside the kernel; so I assume it was the
intention to allow calls from softirq contexts. Then it was refactored
and the check never removed. In this case, the extra check is not a
big deal, but going in the opposite direction can happen too, and then
we will have a bug.

In general, when a patch for a fix is needed, it's usually a good idea
to add a comment right in the code. Even if only to avoid someone else
having to backtrack the calls to see it is only called form fs_ops
etc.

Cheers,
Miguel

  reply	other threads:[~2021-02-16 12:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 17:58 [PATCH] auxdisplay: Remove in_interrupt() usage Sebastian Andrzej Siewior
2021-02-08 18:38 ` Miguel Ojeda
2021-02-08 19:07   ` Sebastian Andrzej Siewior
2021-02-08 20:14     ` Miguel Ojeda
2021-02-08 20:41       ` Sebastian Andrzej Siewior
2021-02-08 22:26         ` Miguel Ojeda
2021-02-09  9:01           ` Sebastian Andrzej Siewior
2021-02-10 21:46             ` Miguel Ojeda
2021-02-13 16:50               ` [PATCH v3] " Sebastian Andrzej Siewior
2021-02-16  9:32                 ` Miguel Ojeda
2021-02-16 10:28                   ` Sebastian Andrzej Siewior
2021-02-16 12:42                     ` Miguel Ojeda [this message]
2021-02-16 18:26                       ` Sebastian Andrzej Siewior
2021-02-16 18:27                         ` [PATCH v4] " Sebastian Andrzej Siewior
2021-02-16 20:21                         ` [PATCH v3] " Miguel Ojeda
2021-03-10 17:51                           ` Sebastian Andrzej Siewior
2021-03-10 18:04                             ` Miguel Ojeda
2021-02-08 19:37   ` [PATCH v2] " Sebastian Andrzej Siewior

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=CANiq72mge40Uvqf3mb4uof2gi8ktvhjoodfyJY7uLW4guTnvDw@mail.gmail.com \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=w@1wt.eu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.