All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, mst@redhat.com, arnd@arndb.de,
	jasowang@redhat.com, andriy.shevchenko@linux.intel.com,
	yu1.wang@intel.com, shuo.a.liu@intel.com, conghui.chen@intel.com,
	stefanha@redhat.com
Subject: Re: [PATCH v11] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 2 Jul 2021 14:52:11 +0800	[thread overview]
Message-ID: <409b6cc3-3339-61b2-7f42-0c69b6486bb3@intel.com> (raw)
In-Reply-To: <20210702045512.u4dvbapoc5a2a4jb@vireshk-i7>


On 2021/7/2 12:55, Viresh Kumar wrote:
> On 01-07-21, 21:24, Wolfram Sang wrote:
>>> I just noticed this now, but this function even tries to send data
>>> partially, which isn't right. If the caller (i2c device's driver)
>>> calls this for 5 struct i2c_msg instances, then all 5 need to get
>>> through or none.. where as we try to send as many as possible here.
>>>
>>> This looks broken to me. Rather return an error value here on success,
>>> or make it complete failure.
>>>
>>> Though to be fair I see i2c-core also returns number of messages
>>> processed from i2c_transfer().
>>>
>>> Wolfram, what's expected here ? Shouldn't all message transfer or
>>> none?
>> Well, on a physical bus, it can simply happen that after message 3 of 5,
>> the bus is stalled, so we need to bail out.
> Right, and in that case the transfer will have any meaning left? I believe it
> needs to be fully retried as the requests may have been dependent on each other.
>
>> Again, I am missing details of a virtqueue, but I'd think it is
>> different. If adding to the queue fails, then it probably make sense to
>> drop the whole transfer.
> Exactly my point.
>

This is not efficient. If adding the ith request to the queue fails, we 
can still send

the requests before it. We don't need to know if it fails here (adding 
to the queue)

or there (later in the host). The "master_xfer" just need to return 
final number of

messages successfully processed.




WARNING: multiple messages have this Message-ID (diff)
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, mst@redhat.com, arnd@arndb.de,
	jasowang@redhat.com, andriy.shevchenko@linux.intel.com,
	yu1.wang@intel.com, shuo.a.liu@intel.com, conghui.chen@intel.com,
	stefanha@redhat.com
Subject: Re: [PATCH v11] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 2 Jul 2021 14:52:11 +0800	[thread overview]
Message-ID: <409b6cc3-3339-61b2-7f42-0c69b6486bb3@intel.com> (raw)
In-Reply-To: <20210702045512.u4dvbapoc5a2a4jb@vireshk-i7>


On 2021/7/2 12:55, Viresh Kumar wrote:
> On 01-07-21, 21:24, Wolfram Sang wrote:
>>> I just noticed this now, but this function even tries to send data
>>> partially, which isn't right. If the caller (i2c device's driver)
>>> calls this for 5 struct i2c_msg instances, then all 5 need to get
>>> through or none.. where as we try to send as many as possible here.
>>>
>>> This looks broken to me. Rather return an error value here on success,
>>> or make it complete failure.
>>>
>>> Though to be fair I see i2c-core also returns number of messages
>>> processed from i2c_transfer().
>>>
>>> Wolfram, what's expected here ? Shouldn't all message transfer or
>>> none?
>> Well, on a physical bus, it can simply happen that after message 3 of 5,
>> the bus is stalled, so we need to bail out.
> Right, and in that case the transfer will have any meaning left? I believe it
> needs to be fully retried as the requests may have been dependent on each other.
>
>> Again, I am missing details of a virtqueue, but I'd think it is
>> different. If adding to the queue fails, then it probably make sense to
>> drop the whole transfer.
> Exactly my point.
>

This is not efficient. If adding the ith request to the queue fails, we 
can still send

the requests before it. We don't need to know if it fails here (adding 
to the queue)

or there (later in the host). The "master_xfer" just need to return 
final number of

messages successfully processed.



_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-07-02  6:52 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  3:24 [PATCH v11] i2c: virtio: add a virtio i2c frontend driver Jie Deng
2021-07-01  3:24 ` Jie Deng
2021-07-01  4:04 ` Viresh Kumar
2021-07-01  4:04   ` Viresh Kumar
2021-07-01  6:10   ` Jie Deng
2021-07-01  6:10     ` Jie Deng
2021-07-01  6:18     ` Viresh Kumar
2021-07-01  6:18       ` Viresh Kumar
2021-07-02  3:36       ` Jie Deng
2021-07-02  3:36         ` Jie Deng
2021-07-02  4:56         ` Viresh Kumar
2021-07-02  4:56           ` Viresh Kumar
2021-07-01 19:24   ` Wolfram Sang
2021-07-02  4:55     ` Viresh Kumar
2021-07-02  4:55       ` Viresh Kumar
2021-07-02  6:22       ` Wolfram Sang
2021-07-02  6:52       ` Jie Deng [this message]
2021-07-02  6:52         ` Jie Deng
2021-07-02  6:56         ` Viresh Kumar
2021-07-02  6:56           ` Viresh Kumar
2021-07-02  7:11           ` Wolfram Sang
2021-07-02  7:15           ` Jie Deng
2021-07-02  7:15             ` Jie Deng
2021-07-02  7:21             ` Viresh Kumar
2021-07-02  7:21               ` Viresh Kumar
2021-07-02  7:36               ` Wolfram Sang
2021-07-01  8:50 ` kernel test robot
2021-07-01  8:50   ` kernel test robot
2021-07-01  8:50   ` kernel test robot
2021-07-01 10:00 ` kernel test robot
2021-07-01 10:00   ` kernel test robot
2021-07-01 10:00   ` kernel test robot
2021-07-02  3:12   ` Jie Deng
2021-07-02  3:12     ` Jie Deng
2021-07-02  3:12     ` Jie Deng
2021-07-02  6:38     ` [kbuild-all] " Rong Chen
2021-07-02  6:38       ` Rong Chen
2021-07-01 10:45 ` Andy Shevchenko
2021-07-01 10:45   ` Andy Shevchenko
2021-07-02  1:05   ` Jie Deng
2021-07-02  1:05     ` Jie Deng

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=409b6cc3-3339-61b2-7f42-0c69b6486bb3@intel.com \
    --to=jie.deng@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=conghui.chen@intel.com \
    --cc=jasowang@redhat.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=shuo.a.liu@intel.com \
    --cc=stefanha@redhat.com \
    --cc=viresh.kumar@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wsa@kernel.org \
    --cc=yu1.wang@intel.com \
    /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.