From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Jie Deng <jie.deng@intel.com>, "wsa@kernel.org" <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 2/2] i2c: virtio: fix completion handling
Date: Fri, 29 Oct 2021 13:54:46 +0200 [thread overview]
Message-ID: <20211029115446.GA24060@axis.com> (raw)
In-Reply-To: <20211020104709.k6oqo2gmegiwfre4@vireshk-i7>
On Wed, Oct 20, 2021 at 12:47:09PM +0200, Viresh Kumar wrote:
> On 20-10-21, 12:38, Vincent Whitchurch wrote:
> > I don't quite understand how that would be safe since
> > virtqueue_add_sgs() can fail after a few iterations and all queued
> > request buffers can have FAIL_NEXT set. In such a case, we would end up
> > waiting forever with your proposed change, wouldn't we?
>
> Good point. I didn't think of that earlier.
>
> I think a good simple way of handling this is counting the number of
> buffers sent and received. Once they match, we are done. That
> shouldn't break anything else I believe.
That could work, but it's not so straightforward since you would have to
introduce locking to prevent races since the final count is only known
after virtio_i2c_prepare_reqs() completes, while the callback could be
called before that. Please do not hesitate to send out a patch to fix
it that way if that is what you prefer.
WARNING: multiple messages have this Message-ID (diff)
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"wsa@kernel.org" <wsa@kernel.org>, kernel <kernel@axis.com>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH 2/2] i2c: virtio: fix completion handling
Date: Fri, 29 Oct 2021 13:54:46 +0200 [thread overview]
Message-ID: <20211029115446.GA24060@axis.com> (raw)
In-Reply-To: <20211020104709.k6oqo2gmegiwfre4@vireshk-i7>
On Wed, Oct 20, 2021 at 12:47:09PM +0200, Viresh Kumar wrote:
> On 20-10-21, 12:38, Vincent Whitchurch wrote:
> > I don't quite understand how that would be safe since
> > virtqueue_add_sgs() can fail after a few iterations and all queued
> > request buffers can have FAIL_NEXT set. In such a case, we would end up
> > waiting forever with your proposed change, wouldn't we?
>
> Good point. I didn't think of that earlier.
>
> I think a good simple way of handling this is counting the number of
> buffers sent and received. Once they match, we are done. That
> shouldn't break anything else I believe.
That could work, but it's not so straightforward since you would have to
introduce locking to prevent races since the final count is only known
after virtio_i2c_prepare_reqs() completes, while the callback could be
called before that. Please do not hesitate to send out a patch to fix
it that way if that is what you prefer.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-10-29 11:54 UTC|newest]
Thread overview: 67+ 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 ` Vincent Whitchurch
2021-10-19 7:46 ` [PATCH 1/2] i2c: virtio: disable timeout handling Vincent Whitchurch
2021-10-19 7:46 ` Vincent Whitchurch
2021-10-19 8:09 ` Viresh Kumar
2021-10-19 8:09 ` Viresh Kumar
2021-10-19 9:36 ` Greg KH
2021-10-19 9:36 ` Greg KH
2021-10-19 9:42 ` Viresh Kumar
2021-10-19 9:42 ` Viresh Kumar
2021-10-19 11:15 ` Wolfram Sang
2021-10-19 14:14 ` Viresh Kumar
2021-10-19 14:14 ` Viresh Kumar
2021-10-19 11:16 ` Greg KH
2021-10-19 11:16 ` Greg KH
2021-10-19 14:37 ` Viresh Kumar
2021-10-19 14:37 ` Viresh Kumar
2021-10-19 18:14 ` Wolfram Sang
2021-10-20 4:20 ` Jie Deng
2021-10-20 4:20 ` Jie Deng
2021-10-20 5:36 ` Greg KH
2021-10-20 5:36 ` Greg KH
2021-10-20 6:35 ` Jie Deng
2021-10-20 6:35 ` Jie Deng
2021-10-20 6:41 ` Viresh Kumar
2021-10-20 6:41 ` Viresh Kumar
2021-10-20 7:04 ` Jie Deng
2021-10-20 7:04 ` Jie Deng
2021-10-20 10:55 ` Vincent Whitchurch
2021-10-20 10:55 ` Vincent Whitchurch
2021-10-20 11:03 ` Viresh Kumar
2021-10-20 11:03 ` Viresh Kumar
2021-10-21 3:30 ` Jie Deng
2021-10-21 3:30 ` Jie Deng
2021-10-29 12:24 ` Vincent Whitchurch
2021-10-29 12:24 ` Vincent Whitchurch
2021-11-01 5:23 ` Jie Deng
2021-11-01 5:23 ` Jie Deng
2021-11-03 6:18 ` Chen, Conghui
2021-11-03 6:37 ` Viresh Kumar
2021-11-03 6:37 ` Viresh Kumar
2021-11-03 14:42 ` Vincent Whitchurch
2021-11-03 14:42 ` Vincent Whitchurch
2021-11-09 4:52 ` Viresh Kumar
2021-11-09 4:52 ` Viresh Kumar
2021-10-20 3:36 ` Jie Deng
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 7:46 ` Vincent Whitchurch
2021-10-19 8:22 ` Viresh Kumar
2021-10-19 8:22 ` Viresh Kumar
2021-10-20 8:54 ` Jie Deng
2021-10-20 8:54 ` Jie Deng
2021-10-20 9:17 ` Viresh Kumar
2021-10-20 9:17 ` Viresh Kumar
2021-10-20 10:38 ` Vincent Whitchurch
2021-10-20 10:38 ` Vincent Whitchurch
2021-10-20 10:47 ` Viresh Kumar
2021-10-20 10:47 ` Viresh Kumar
2021-10-29 11:54 ` Vincent Whitchurch [this message]
2021-10-29 11:54 ` Vincent Whitchurch
2021-10-21 5:55 ` Jie Deng
2021-10-21 5:55 ` Jie Deng
2021-10-21 5:58 ` Viresh Kumar
2021-10-21 5:58 ` Viresh Kumar
2021-11-02 4:32 ` 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=20211029115446.GA24060@axis.com \
--to=vincent.whitchurch@axis.com \
--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 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.