* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
[not found] <20221123102207.451527-1-asmetanin@yandex-team.ru>
@ 2022-12-01 9:01 ` Jason Wang
2022-12-19 7:39 ` Michael S. Tsirkin
2023-04-21 7:04 ` Michael S. Tsirkin
0 siblings, 2 replies; 6+ messages in thread
From: Jason Wang @ 2022-12-01 9:01 UTC (permalink / raw)
To: Andrey Smetanin
Cc: kvm, Michael S. Tsirkin, netdev, linux-kernel, virtualization,
yc-core
On Wed, Nov 23, 2022 at 6:24 PM Andrey Smetanin
<asmetanin@yandex-team.ru> wrote:
>
> Fix possible virtqueue used buffers leak and corresponding stuck
> in case of temporary -EIO from sendmsg() which is produced by
> tun driver while backend device is not up.
>
> In case of no-retriable error and zcopy do not revert upend_idx
> to pass packet data (that is update used_idx in corresponding
> vhost_zerocopy_signal_used()) as if packet data has been
> transferred successfully.
Should we mark head.len as VHOST_DMA_DONE_LEN in this case?
Thanks
>
> Signed-off-by: Andrey Smetanin <asmetanin@yandex-team.ru>
> ---
> drivers/vhost/net.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 20265393aee7..93e9166039b9 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -934,13 +934,16 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock)
>
> err = sock->ops->sendmsg(sock, &msg, len);
> if (unlikely(err < 0)) {
> + bool retry = err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS;
> +
> if (zcopy_used) {
> if (vq->heads[ubuf->desc].len == VHOST_DMA_IN_PROGRESS)
> vhost_net_ubuf_put(ubufs);
> - nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> - % UIO_MAXIOV;
> + if (retry)
> + nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> + % UIO_MAXIOV;
> }
> - if (err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS) {
> + if (retry) {
> vhost_discard_vq_desc(vq, 1);
> vhost_net_enable_vq(net, vq);
> break;
> --
> 2.25.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
2022-12-01 9:01 ` [PATCH] vhost_net: revert upend_idx only on retriable error Jason Wang
@ 2022-12-19 7:39 ` Michael S. Tsirkin
[not found] ` <62621671437948@mail.yandex-team.ru>
2023-04-21 7:04 ` Michael S. Tsirkin
1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2022-12-19 7:39 UTC (permalink / raw)
To: Jason Wang
Cc: kvm, netdev, linux-kernel, virtualization, Andrey Smetanin,
yc-core
On Thu, Dec 01, 2022 at 05:01:58PM +0800, Jason Wang wrote:
> On Wed, Nov 23, 2022 at 6:24 PM Andrey Smetanin
> <asmetanin@yandex-team.ru> wrote:
> >
> > Fix possible virtqueue used buffers leak and corresponding stuck
> > in case of temporary -EIO from sendmsg() which is produced by
> > tun driver while backend device is not up.
> >
> > In case of no-retriable error and zcopy do not revert upend_idx
> > to pass packet data (that is update used_idx in corresponding
> > vhost_zerocopy_signal_used()) as if packet data has been
> > transferred successfully.
>
> Should we mark head.len as VHOST_DMA_DONE_LEN in this case?
>
> Thanks
Any response here?
> >
> > Signed-off-by: Andrey Smetanin <asmetanin@yandex-team.ru>
> > ---
> > drivers/vhost/net.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 20265393aee7..93e9166039b9 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -934,13 +934,16 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock)
> >
> > err = sock->ops->sendmsg(sock, &msg, len);
> > if (unlikely(err < 0)) {
> > + bool retry = err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS;
> > +
> > if (zcopy_used) {
> > if (vq->heads[ubuf->desc].len == VHOST_DMA_IN_PROGRESS)
> > vhost_net_ubuf_put(ubufs);
> > - nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > - % UIO_MAXIOV;
> > + if (retry)
> > + nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > + % UIO_MAXIOV;
> > }
> > - if (err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS) {
> > + if (retry) {
> > vhost_discard_vq_desc(vq, 1);
> > vhost_net_enable_vq(net, vq);
> > break;
> > --
> > 2.25.1
> >
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
[not found] ` <62621671437948@mail.yandex-team.ru>
@ 2023-01-27 8:19 ` Michael S. Tsirkin
[not found] ` <278011674821181@mail.yandex-team.ru>
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-01-27 8:19 UTC (permalink / raw)
To: Andrey Smetanin
Cc: kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, yc-core@yandex-team.ru
On Mon, Dec 19, 2022 at 11:24:26AM +0300, Andrey Smetanin wrote:
> Sorry for the delay.
> I will send update on this week after some tests.
> 19.12.2022, 10:39, "Michael S. Tsirkin" <mst@redhat.com>:
Do you still plan to send something? Dropping this for now.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
[not found] ` <278011674821181@mail.yandex-team.ru>
@ 2023-03-10 8:55 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-03-10 8:55 UTC (permalink / raw)
To: Andrey Smetanin
Cc: kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, yc-core@yandex-team.ru
On Fri, Jan 27, 2023 at 03:08:18PM +0300, Andrey Smetanin wrote:
> Yes, I plan. I need some time, currently I'm very busy in another direction,
> but I will return.
Jason you want to take this up maybe?
> 27.01.2023, 11:19, "Michael S. Tsirkin" <mst@redhat.com>:
>
>
> On Mon, Dec 19, 2022 at 11:24:26AM +0300, Andrey Smetanin wrote:
>
> Sorry for the delay.
> I will send update on this week after some tests.
> 19.12.2022, 10:39, "Michael S. Tsirkin" <mst@redhat.com>:
>
>
> Do you still plan to send something? Dropping this for now.
>
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
2022-12-01 9:01 ` [PATCH] vhost_net: revert upend_idx only on retriable error Jason Wang
2022-12-19 7:39 ` Michael S. Tsirkin
@ 2023-04-21 7:04 ` Michael S. Tsirkin
2023-04-21 7:11 ` Jason Wang
1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2023-04-21 7:04 UTC (permalink / raw)
To: Jason Wang
Cc: kvm, netdev, linux-kernel, virtualization, Andrey Smetanin,
yc-core
On Thu, Dec 01, 2022 at 05:01:58PM +0800, Jason Wang wrote:
> On Wed, Nov 23, 2022 at 6:24 PM Andrey Smetanin
> <asmetanin@yandex-team.ru> wrote:
> >
> > Fix possible virtqueue used buffers leak and corresponding stuck
> > in case of temporary -EIO from sendmsg() which is produced by
> > tun driver while backend device is not up.
> >
> > In case of no-retriable error and zcopy do not revert upend_idx
> > to pass packet data (that is update used_idx in corresponding
> > vhost_zerocopy_signal_used()) as if packet data has been
> > transferred successfully.
>
> Should we mark head.len as VHOST_DMA_DONE_LEN in this case?
>
> Thanks
Jason do you want to take over this work? It's been stuck
in my inbox for a while.
> >
> > Signed-off-by: Andrey Smetanin <asmetanin@yandex-team.ru>
> > ---
> > drivers/vhost/net.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 20265393aee7..93e9166039b9 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -934,13 +934,16 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock)
> >
> > err = sock->ops->sendmsg(sock, &msg, len);
> > if (unlikely(err < 0)) {
> > + bool retry = err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS;
> > +
> > if (zcopy_used) {
> > if (vq->heads[ubuf->desc].len == VHOST_DMA_IN_PROGRESS)
> > vhost_net_ubuf_put(ubufs);
> > - nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > - % UIO_MAXIOV;
> > + if (retry)
> > + nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > + % UIO_MAXIOV;
> > }
> > - if (err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS) {
> > + if (retry) {
> > vhost_discard_vq_desc(vq, 1);
> > vhost_net_enable_vq(net, vq);
> > break;
> > --
> > 2.25.1
> >
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vhost_net: revert upend_idx only on retriable error
2023-04-21 7:04 ` Michael S. Tsirkin
@ 2023-04-21 7:11 ` Jason Wang
0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2023-04-21 7:11 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: kvm, netdev, linux-kernel, virtualization, Andrey Smetanin,
yc-core
On Fri, Apr 21, 2023 at 3:04 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Dec 01, 2022 at 05:01:58PM +0800, Jason Wang wrote:
> > On Wed, Nov 23, 2022 at 6:24 PM Andrey Smetanin
> > <asmetanin@yandex-team.ru> wrote:
> > >
> > > Fix possible virtqueue used buffers leak and corresponding stuck
> > > in case of temporary -EIO from sendmsg() which is produced by
> > > tun driver while backend device is not up.
> > >
> > > In case of no-retriable error and zcopy do not revert upend_idx
> > > to pass packet data (that is update used_idx in corresponding
> > > vhost_zerocopy_signal_used()) as if packet data has been
> > > transferred successfully.
> >
> > Should we mark head.len as VHOST_DMA_DONE_LEN in this case?
> >
> > Thanks
>
> Jason do you want to take over this work? It's been stuck
> in my inbox for a while.
Andrey,
Any update on this patch?
Btw, if we haven't heard from Andrey for a week, I can do that.
Thanks
>
> > >
> > > Signed-off-by: Andrey Smetanin <asmetanin@yandex-team.ru>
> > > ---
> > > drivers/vhost/net.c | 9 ++++++---
> > > 1 file changed, 6 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > > index 20265393aee7..93e9166039b9 100644
> > > --- a/drivers/vhost/net.c
> > > +++ b/drivers/vhost/net.c
> > > @@ -934,13 +934,16 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock)
> > >
> > > err = sock->ops->sendmsg(sock, &msg, len);
> > > if (unlikely(err < 0)) {
> > > + bool retry = err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS;
> > > +
> > > if (zcopy_used) {
> > > if (vq->heads[ubuf->desc].len == VHOST_DMA_IN_PROGRESS)
> > > vhost_net_ubuf_put(ubufs);
> > > - nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > > - % UIO_MAXIOV;
> > > + if (retry)
> > > + nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
> > > + % UIO_MAXIOV;
> > > }
> > > - if (err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS) {
> > > + if (retry) {
> > > vhost_discard_vq_desc(vq, 1);
> > > vhost_net_enable_vq(net, vq);
> > > break;
> > > --
> > > 2.25.1
> > >
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-04-21 7:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221123102207.451527-1-asmetanin@yandex-team.ru>
2022-12-01 9:01 ` [PATCH] vhost_net: revert upend_idx only on retriable error Jason Wang
2022-12-19 7:39 ` Michael S. Tsirkin
[not found] ` <62621671437948@mail.yandex-team.ru>
2023-01-27 8:19 ` Michael S. Tsirkin
[not found] ` <278011674821181@mail.yandex-team.ru>
2023-03-10 8:55 ` Michael S. Tsirkin
2023-04-21 7:04 ` Michael S. Tsirkin
2023-04-21 7:11 ` Jason Wang
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).