All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
	Aniket Randive <aniket.randive@oss.qualcomm.com>,
	Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Wolfram Sang <wsa@kernel.org>
Subject: Re: [PATCH v6 1/2] i2c: core: Add i2c_update_timeout() helper for dynamic transfer timeouts
Date: Tue, 28 Jul 2026 11:42:47 +0200	[thread overview]
Message-ID: <amh5l4Yvwemws6Cx@shikoro> (raw)
In-Reply-To: <cb1e00ea-658a-416b-aef6-46c151d15685@oss.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]

Hi,

> My thinking was that we are trying to derive a timeout for transfer
> completion, so the transfer length and bus frequency should already give
> us the theoretical on-the-wire transfer time.

With my experience in all these years with I2C, this is exactly true. It
is a _theoretical_ value, and the practical value is at least board(!)
dependant. It may also depend on the environment in other cases. So, the
theoretical value may supply a minimum but IMO this doesn't help.
Because we want a precise value, but we don't know it.

> On top of that, we could add a fixed margin to account for interrupt and
> system scheduling latency before converting the result to jiffies.
> 
> The exact margin is open for discussion. I was considering something on
> the order of a few hundred milliseconds (e.g. 500 ms), but perhaps that
> is still too optimistic on some systems?

See, you simply cannot know. So, why not leaving it to those who do know
for their system?

> Alternatively, the core could provide a calculated baseline timeout
> (transfer time + fixed margin) and allow userspace to add an optional
> extra offset when needed. That way the default behavior remains automatic
> and works for most clients, while systems with unusual latency
> requirements can still increase the timeout without every userspace client
> having to determine an appropriate value itself.

We already have a mechanism for userspace to set a timeout.

> Do you see cases where a transfer-time-based timeout with a generous
> system-latency margin would still be insufficient?

Regressions. You could time out too early on boards which worked before.

Happy hacking,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-07-28  9:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 11:41 [PATCH v6 0/2] i2c: Add dynamic transfer timeout based on message length and frequency Aniket Randive
2026-07-20 11:41 ` [PATCH v6 1/2] i2c: core: Add i2c_update_timeout() helper for dynamic transfer timeouts Aniket Randive
2026-07-22  5:25   ` Mukesh Savaliya
2026-07-24 11:46     ` Aniket RANDIVE
2026-07-26 20:11   ` Andi Shyti
2026-07-27  4:15     ` Mukesh Savaliya
2026-07-27 20:42       ` Andi Shyti
2026-07-28  4:56         ` Mukesh Savaliya
2026-07-28  9:42           ` Wolfram Sang [this message]
2026-07-28 10:14             ` Mukesh Savaliya
2026-07-29 15:19               ` Wolfram Sang
2026-07-30 11:53                 ` Aniket RANDIVE
2026-07-30 20:23                   ` Wolfram Sang
2026-07-20 11:41 ` [PATCH v6 2/2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency Aniket Randive
2026-07-22  5:26   ` Mukesh Savaliya
2026-07-24 11:51     ` Aniket RANDIVE
2026-07-22  5:25 ` [PATCH v6 0/2] i2c: Add dynamic transfer timeout based on message " Mukesh Savaliya
2026-07-24 11:56   ` Aniket RANDIVE

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=amh5l4Yvwemws6Cx@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=andi.shyti@kernel.org \
    --cc=aniket.randive@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.savaliya@oss.qualcomm.com \
    --cc=viken.dadhaniya@oss.qualcomm.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 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.