lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c535725c5e4761e6f16ff4016affe8ddcc79d88.camel@ew.tq-group.com>
Date: Wed, 14 Jan 2026 09:28:48 +0100
From: Matthias Schiffer <matthias.schiffer@...tq-group.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Peter Korsgaard <peter@...sgaard.com>, Andi Shyti
 <andi.shyti@...nel.org>,  linux-i2c@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux@...tq-group.com,  Wolfram Sang
 <wsa+renesas@...g-engineering.com>
Subject: Re: [PATCH v2 1/2] i2c: ocores: increase poll timeout to total
 transfer timeout

On Tue, 2026-01-13 at 15:21 +0100, Andrew Lunn wrote:
> On Tue, Jan 13, 2026 at 02:02:07PM +0100, Wolfram Sang wrote:
> > 
> > > The behavior in the regular case is unchanged, spinning for up to 1ms,
> > > but the open-coded poll loop is replaced with read_poll_timeout_atomic()
> > > as suggested by Andrew Lunn.
> > 
> > Hmm, spinning 1ms is still a lot. Can't we just use read_poll_timeout()
> > for the whole timeout? I can't see that it will cause a regression. But
> > please correct me if I am wrong.
> 
> I've forgotten the context, but
> 
> /**
>  * ocores_poll_wait() - Wait until is possible to process some data
>  * @i2c: ocores I2C device instance
>  *
>  * Used when the device is in polling mode (interrupts disabled).
> 
> If interrupts are disabled, you cannot use read_poll_timeout().  You
> have to use read_poll_timeout_atomic(). And that spins anyway.
> 
>      Andrew


This code does not have interrupts disabled, we could not fall back from
read_poll_timeout_atomic() to read_poll_timeout() otherwise. My understanding is
that a sleeping wait would make it more likely for a switch to a different task
to happen after every byte, negatively impacting I2C performance; this is not
something I have verified however.

It is spinning for 1ms because that's what the old code did (which only spun
without fallback to sleeping). Reducing this to the time needed to transfer 1
byte in the absence of clock stretching should not cause issues (200us for
50kHz; could also be made to depend on the clock rate, so it would be even less
spinning at higher frequencies).

Best,
Matthias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ