From: Wolfram Sang <wsa@kernel.org>
To: Benjamin Bara <bbara93@gmail.com>
Cc: Lee Jones <lee@kernel.org>,
Dmitry Osipenko <dmitry.osipenko@collabora.com>,
peterz@infradead.org, mwalle@kernel.org,
Tor Vic <torvic9@mailbox.org>,
Erhard Furtner <erhard_f@mailbox.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Benjamin Bara <benjamin.bara@skidata.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] i2c: core: Fix atomic xfer check for non-preempt config
Date: Thu, 4 Jan 2024 18:04:08 +0100 [thread overview]
Message-ID: <ZZblCO9li-TMSOKV@shikoro> (raw)
In-Reply-To: <20240104-i2c-atomic-v1-1-a3a186f21c36@skidata.com>
[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]
On Thu, Jan 04, 2024 at 09:17:08AM +0100, Benjamin Bara wrote:
> From: Benjamin Bara <benjamin.bara@skidata.com>
>
> Since commit aa49c90894d0 ("i2c: core: Run atomic i2c xfer when
> !preemptible"), the whole reboot/power off sequence on non-preempt kernels
> is using atomic i2c xfer, as !preemptible() always results to 1.
>
> During device_shutdown(), the i2c might be used a lot and not all busses
> have implemented an atomic xfer handler. This results in a lot of
> avoidable noise, like:
>
> [ 12.687169] No atomic I2C transfer handler for 'i2c-0'
> [ 12.692313] WARNING: CPU: 6 PID: 275 at drivers/i2c/i2c-core.h:40 i2c_smbus_xfer+0x100/0x118
> ...
>
> Fix this by allowing non-atomic xfer when the interrupts are enabled, as
> it was before.
>
> Fixes: aa49c90894d0 ("i2c: core: Run atomic i2c xfer when !preemptible")
> Cc: stable@vger.kernel.org # v5.2+
> Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Thanks! The code looks what I also would have suggested reading the bug
reports. So:
Applied to for-current, thanks!
> + /*
> + * non-atomic xfers often use wait_for_completion*() calls to wait
> + * efficiently (schedule out voluntarily) on the completion of the xfer,
> + * which are then "completed" by an IRQ. If the constraints are not
> + * satisfied, fall back to an atomic xfer.
> + */
> + return system_state > SYSTEM_RUNNING &&
> + (IS_ENABLED(CONFIG_PREEMPT_COUNT) ? !preemptible() : irqs_disabled());
I removed the comment, though. I don't think it explains the following
code well enough, i.e. why we have a decision based on a Kconfig
symbol. We can (and should) fix this incrementally, though. I hope this
is OK with everyone.
Thanks to everyone putting work into this. Much appreciated!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-01-04 17:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 8:17 [PATCH] i2c: core: Fix atomic xfer check for non-preempt config Benjamin Bara
2024-01-04 9:18 ` Michael Walle
2024-01-04 9:33 ` Tor Vic
2024-01-04 17:04 ` Wolfram Sang [this message]
2024-02-19 4:14 ` Askar Safin
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=ZZblCO9li-TMSOKV@shikoro \
--to=wsa@kernel.org \
--cc=bbara93@gmail.com \
--cc=benjamin.bara@skidata.com \
--cc=dmitry.osipenko@collabora.com \
--cc=erhard_f@mailbox.org \
--cc=lee@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mwalle@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=torvic9@mailbox.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 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.