QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Alexey Dobriyan <adobriyan@yandex-team.ru>
Cc: qemu-devel@nongnu.org, adobriyan@gmail.com, mst@redhat.com,
	 vsementsov@yandex-team.ru
Subject: Re: [PATCH RESEND] virtio-net: fix bug 1451 aka "assert(!virtio_net_get_subqueue(nc)->async_tx.elem); "
Date: Mon, 6 May 2024 17:20:10 +0800	[thread overview]
Message-ID: <CACGkMEvH9MNSyk3QdbY0ie4_Wbd9tp-pmq41QVyLA-06QYk2nQ@mail.gmail.com> (raw)
In-Reply-To: <20240430105333.23377-1-adobriyan@yandex-team.ru>

On Tue, Apr 30, 2024 at 6:54 PM Alexey Dobriyan
<adobriyan@yandex-team.ru> wrote:
>
> Reproducer from https://gitlab.com/qemu-project/qemu/-/issues/1451
> creates small packet (1 segment, len = 10 == n->guest_hdr_len),
> then destroys queue.
>
> "if (n->host_hdr_len != n->guest_hdr_len)" is triggered, if body creates
> zero length/zero segment packet as there is nothing after guest header.
>
> qemu_sendv_packet_async() tries to send it.
>
> slirp discards it because it is smaller than Ethernet header,
> but returns 0 because tx hooks are supposed to return total length of data.
>
> 0 is propagated upwards and is interpreted as "packet has been sent"
> which is terrible because queue is being destroyed, nobody is waiting for TX
> to complete and assert it triggered.
>
> Fix is discard such empty packets instead of sending them.
>
> Length 1 packets will go via different codepath:
>
>         virtqueue_push(q->tx_vq, elem, 0);
>         virtio_notify(vdev, q->tx_vq);
>         g_free(elem);
>
> and aren't problematic.
>
> Signed-off-by: Alexey Dobriyan <adobriyan@yandex-team.ru>
> ---
>
>         hopefully better changelog.
>         use "if (out_num < 1)" so that discard doesn't calculate iov length
>
>  hw/net/virtio-net.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>

I tweak the title to "drop too short packets early".

And queued.

Thanks



      reply	other threads:[~2024-05-06  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 10:53 [PATCH RESEND] virtio-net: fix bug 1451 aka "assert(!virtio_net_get_subqueue(nc)->async_tx.elem); " Alexey Dobriyan
2024-05-06  9:20 ` Jason Wang [this message]

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=CACGkMEvH9MNSyk3QdbY0ie4_Wbd9tp-pmq41QVyLA-06QYk2nQ@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=adobriyan@yandex-team.ru \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).