[PATCH 0/2] net: fix abort and busy loop when the tap device is deleted

Denis V. Lunev posted 2 patches 2 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261106200309.122830-1-den@openvz.org
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowangio@gmail.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
hw/net/virtio-net.c           |  25 +++--
net/tap.c                     |   8 ++
tests/qtest/virtio-net-test.c | 174 ++++++++++++++++++++++++++++++++++
3 files changed, 200 insertions(+), 7 deletions(-)
[PATCH 0/2] net: fix abort and busy loop when the tap device is deleted
Posted by Denis V. Lunev 2 weeks, 2 days ago
Management can delete the host tap device of a running VM while QEMU
still holds its fds, e.g. OpenStack unplugs the VIF of an instance it is
deleting before the domain is gone. QEMU should carry on with a dead
link. Instead:

- a multiqueue virtio-net NIC aborts on an assert as soon as the guest
  changes the number of queue pairs or resets the device (patch 1);
- every tap netdev makes the main loop spin at full CPU in tap_send()
  (patch 2).

The two patches are independent. Each adds a case to
tests/qtest/virtio-net-test.c that fails without its fix. Creating the
tap needs CAP_NET_ADMIN, so both cases are skipped when not run as root.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowangio@gmail.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: Fabiano Rosas <farosas@suse.de>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>

Denis V. Lunev (2):
  virtio-net: fix abort in virtio_net_set_queue_pairs() on a deleted tap
  net/tap: fix busy loop in tap_send() after the tap device is deleted

 hw/net/virtio-net.c           |  25 +++--
 net/tap.c                     |   8 ++
 tests/qtest/virtio-net-test.c | 174 ++++++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+), 7 deletions(-)


base-commit: 76fdb3373c9a27b3f50ecc9e012cbdeb90af7151
-- 
2.53.0
Re: [PATCH 0/2] net: fix abort and busy loop when the tap device is deleted
Posted by Denis V. Lunev 5 days, 8 hours ago
On 11/6/26 21:03, Denis V. Lunev wrote:
> This email originated from an IP that might not be authorized by the domain it was sent from.
> Do not click links or open attachments unless it is an email you expected to receive.
> Management can delete the host tap device of a running VM while QEMU
> still holds its fds, e.g. OpenStack unplugs the VIF of an instance it is
> deleting before the domain is gone. QEMU should carry on with a dead
> link. Instead:
>
> - a multiqueue virtio-net NIC aborts on an assert as soon as the guest
>   changes the number of queue pairs or resets the device (patch 1);
> - every tap netdev makes the main loop spin at full CPU in tap_send()
>   (patch 2).
>
> The two patches are independent. Each adds a case to
> tests/qtest/virtio-net-test.c that fails without its fix. Creating the
> tap needs CAP_NET_ADMIN, so both cases are skipped when not run as root.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowangio@gmail.com>
> Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> Cc: Fabiano Rosas <farosas@suse.de>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
>
> Denis V. Lunev (2):
>   virtio-net: fix abort in virtio_net_set_queue_pairs() on a deleted tap
>   net/tap: fix busy loop in tap_send() after the tap device is deleted
>
>  hw/net/virtio-net.c           |  25 +++--
>  net/tap.c                     |   8 ++
>  tests/qtest/virtio-net-test.c | 174 ++++++++++++++++++++++++++++++++++
>  3 files changed, 200 insertions(+), 7 deletions(-)
>
>
> base-commit: 76fdb3373c9a27b3f50ecc9e012cbdeb90af7151
ping