linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Chen, Conghui" <conghui.chen@intel.com>,
	"Deng, Jie" <jie.deng@intel.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Wolfram Sang <wsa@kernel.org>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kernel <kernel@axis.com>
Subject: Re: [PATCH 1/2] i2c: virtio: disable timeout handling
Date: Wed, 3 Nov 2021 15:42:41 +0100	[thread overview]
Message-ID: <20211103144241.GA27285@axis.com> (raw)
In-Reply-To: <20211103063745.utpphthou4angs4s@vireshk-i7>

On Wed, Nov 03, 2021 at 07:37:45AM +0100, Viresh Kumar wrote:
> On 03-11-21, 06:18, Chen, Conghui wrote:
> > >>> Over the long term, I think the backend should provide that timeout
> > >>> value and guarantee that its processing time should not exceed that
> > >>> value.
> > >> If you mean that the spec should be changed to allow the virtio driver
> > >> to be able to program a certain timeout for I2C transactions in the
> > >> virtio device, yes, that does sound reasonable.
> > >
> > >
> > >Due to changes in my work, I will pass my virtio-i2c maintenance to Conghui.
> > >
> > >She may work on this in the future.
> > >
> > 
> > I'll try to update the spec first.
> 
> I don't think the spec should be changed for timeout. Timeout-interval
> here isn't the property of just the host firmware/kernel, but the
> entire setup plays a role here.
> 
> Host have its own timeframe to take care of things (I think HZ should
> really be enough for that, since kernel can manage it for busses
> normally with just that). Then comes the virtualization, context
> switches, guest OS, backend, etc, which add to this delay. All this is
> not part of the virtio protocol and so shouldn't be made part of it.

The suggested timeout is not meant to take into account the overhead of
virtualization, but to be used by the virtio device as a timeout for the
transaction on the I2C bus (presumably by programming this value to the
physical I2C controller, if one exists).

Assume that userspace (or an I2C client driver) asks for a timeout of 20
ms for a particular transfer because it, say, knows that the particular
connected I2C peripheral either responds within 10 ms to a particular
register read or never responds, so it doesn't want to waste time
waiting unnecessarily long for the transfer to complete.

If the virtio device end does not have any information on what timeout
is required (as in the current spec), it must assume some high value
which will never cause I2C transactions to spuriously timeout, say 10
seconds.  

Even if the virtio driver is fixed to copy and hold all buffers to avoid
memory corruption and to time out and return to the caller after the
requested 20 ms, the next I2C transfer can not be issued until 10
seconds have passed, since the virtio device end will still be waiting
for the hardcoded 10 second timeout and may not respond to new requests
until that transfer has timed out.

  reply	other threads:[~2021-11-03 14:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  7:46 [PATCH 0/2] virtio-i2c: Fix buffer handling Vincent Whitchurch
2021-10-19  7:46 ` [PATCH 1/2] i2c: virtio: disable timeout handling Vincent Whitchurch
2021-10-19  8:09   ` Viresh Kumar
2021-10-19  9:36     ` Greg KH
2021-10-19  9:42       ` Viresh Kumar
2021-10-19 11:15         ` Wolfram Sang
2021-10-19 14:14           ` Viresh Kumar
2021-10-19 11:16         ` Greg KH
2021-10-19 14:37           ` Viresh Kumar
2021-10-19 18:14             ` Wolfram Sang
2021-10-20  4:20               ` Jie Deng
2021-10-20  5:36                 ` Greg KH
2021-10-20  6:35                   ` Jie Deng
2021-10-20  6:41                     ` Viresh Kumar
2021-10-20  7:04                       ` Jie Deng
2021-10-20 10:55                         ` Vincent Whitchurch
2021-10-20 11:03                           ` Viresh Kumar
2021-10-21  3:30                             ` Jie Deng
2021-10-29 12:24                               ` Vincent Whitchurch
2021-11-01  5:23                                 ` Jie Deng
2021-11-03  6:18                                   ` Chen, Conghui
2021-11-03  6:37                                     ` Viresh Kumar
2021-11-03 14:42                                       ` Vincent Whitchurch [this message]
2021-11-09  4:52                                         ` Viresh Kumar
2021-10-20  3:36     ` Jie Deng
2021-10-19  7:46 ` [PATCH 2/2] i2c: virtio: fix completion handling Vincent Whitchurch
2021-10-19  8:22   ` Viresh Kumar
2021-10-20  8:54     ` Jie Deng
2021-10-20  9:17       ` Viresh Kumar
2021-10-20 10:38         ` Vincent Whitchurch
2021-10-20 10:47           ` Viresh Kumar
2021-10-29 11:54             ` Vincent Whitchurch
2021-10-21  5:55   ` Jie Deng
2021-10-21  5:58     ` Viresh Kumar
2021-11-02  4:32   ` Viresh Kumar

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=20211103144241.GA27285@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=conghui.chen@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jie.deng@intel.com \
    --cc=kernel@axis.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --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).