linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Bara <bbara93@gmail.com>
To: peterz@infradead.org
Cc: bbara93@gmail.com, benjamin.bara@skidata.com,
	dmitry.osipenko@collabora.com, jonathanh@nvidia.com,
	lee@kernel.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	rafael.j.wysocki@intel.com, richard.leitner@linux.dev,
	stable@vger.kernel.org, treding@nvidia.com, wsa@kernel.org
Subject: Re: [PATCH v3 2/4] i2c: core: run atomic i2c xfer when !preemptible
Date: Tue,  4 Apr 2023 16:06:42 +0200	[thread overview]
Message-ID: <20230404140642.550919-1-bbara93@gmail.com> (raw)
In-Reply-To: <20230404082255.GU4253@hirez.programming.kicks-ass.net>

On Tue, 4 Apr 2023 at 10:23, Peter Zijlstra <peterz@infradead.org> wrote:
> You can mostly forget about CONFIG_PREEMPT=n (or more specifically
> CONFIG_PREMPT_COUNT=n) things that work for PREEMPT typically also work
> for !PREEMPT.

Thanks for the clarification!

> The question here seems to be if i2c_in_atomic_xfer_mode() should have
> an in_atomic() / !preemptible() check, right? IIUC Wolfram doesn't like
> it being used outside of extra special cicumstances?

Sorry for expressing things more complicated than needed.
Yes, exactly. Wolfram expressed considerations of adding preemptible() as
check, as the now existing irq_disabled() check is lost with !PREEMPT. I tried
to clarify that the check seems to be there for "performance reasons" and that
the check essentially was !preemptible() before v5.2, so nothing should break.

However, what came to my mind during my "research", is that it might make sense
to handle all i2c transfers atomically when in a post RUNNING state (namely
HALT, POWER_OFF, RESTART, SUSPEND). The outcome would basically be the same as
with this patch series applied, but I guess the reasoning behind it would be
simplified: If in a restart handler, the i2c transfer is atomic, independent of
current IRQ or preemption state. Currently, the state depends on from where the
handler is triggered. As you have stated, most of the i2c transfers in the
mentioned states will just update single bits for power-off/sleep/suspend, so
IMHO nothing where not using a DMA would matter from a performance point of
view. But there might be other reasons for not doing so - I guess in this case
the provided patch is fine (at least from my side).

  reply	other threads:[~2023-04-04 14:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 13:57 [PATCH v3 0/4] mfd: tps6586x: register restart handler Benjamin Bara
2023-03-27 13:57 ` [PATCH v3 1/4] kernel/reboot: emergency_restart: set correct system_state Benjamin Bara
2023-03-27 13:57 ` [PATCH v3 2/4] i2c: core: run atomic i2c xfer when !preemptible Benjamin Bara
2023-03-27 14:54   ` Wolfram Sang
2023-03-27 16:23     ` Benjamin Bara
2023-03-29 19:50       ` Wolfram Sang
2023-04-02 10:04         ` Benjamin Bara
2023-04-04  8:22           ` Peter Zijlstra
2023-04-04 14:06             ` Benjamin Bara [this message]
2023-03-27 13:57 ` [PATCH v3 3/4] mfd: tps6586x: use devm-based power off handler Benjamin Bara
2023-04-02 22:28   ` Dmitry Osipenko
2023-03-27 13:57 ` [PATCH v3 4/4] mfd: tps6586x: register restart handler Benjamin Bara
2023-04-02 22:30   ` Dmitry Osipenko
2023-04-03  6:50     ` Benjamin Bara
2023-04-03 15:44       ` Dmitry Osipenko

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=20230404140642.550919-1-bbara93@gmail.com \
    --to=bbara93@gmail.com \
    --cc=benjamin.bara@skidata.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=jonathanh@nvidia.com \
    --cc=lee@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=richard.leitner@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=treding@nvidia.com \
    --cc=wsa@kernel.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;
as well as URLs for NNTP newsgroup(s).