thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-tap-set-vhostfd-passed-from-qemu-cli-to-non-blocking.patch

b38b0f
From 689a30f211939282ce6de9d3597c0fc6ad674a6e Mon Sep 17 00:00:00 2001
b38b0f
From: Laszlo Ersek <lersek@redhat.com>
b38b0f
Date: Fri, 26 Jul 2019 11:29:51 +0100
b38b0f
Subject: [PATCH 13/14] tap: set vhostfd passed from qemu cli to non-blocking
b38b0f
b38b0f
RH-Author: Laszlo Ersek <lersek@redhat.com>
b38b0f
Message-id: <20190726112951.11834-2-lersek@redhat.com>
b38b0f
Patchwork-id: 89734
b38b0f
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/1] tap: set vhostfd passed from qemu cli to non-blocking
b38b0f
Bugzilla: 1732642
b38b0f
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
b38b0f
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
b38b0f
RH-Acked-by: John Snow <jsnow@redhat.com>
b38b0f
b38b0f
From: Brijesh Singh <brijesh.singh@amd.com>
b38b0f
b38b0f
A guest boot hangs while probing the network interface when
b38b0f
iommu_platform=on is used.
b38b0f
b38b0f
The following qemu cli hangs without this patch:
b38b0f
b38b0f
# $QEMU \
b38b0f
  -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \
b38b0f
  -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \
b38b0f
  ...
b38b0f
b38b0f
Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of
b38b0f
setting vhostfd to non-blocking when QEMU opens /dev/host-net but if
b38b0f
the fd is passed from qemu cli then we need to ensure that fd is set
b38b0f
to non-blocking.
b38b0f
b38b0f
Fixes: c471ad0e9bd46 ("vhost_net: device IOTLB support")
b38b0f
Cc: qemu-stable@nongnu.org
b38b0f
Cc: Michael S. Tsirkin <mst@redhat.com>
b38b0f
Cc: Jason Wang <jasowang@redhat.com>
b38b0f
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
b38b0f
Signed-off-by: Jason Wang <jasowang@redhat.com>
b38b0f
(cherry picked from commit d542800d1edc62f63f8a29cfa6bdd1a9536ae11c)
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 net/tap.c | 2 ++
b38b0f
 1 file changed, 2 insertions(+)
b38b0f
b38b0f
diff --git a/net/tap.c b/net/tap.c
b38b0f
index 2b3a36f..89c4e19 100644
b38b0f
--- a/net/tap.c
b38b0f
+++ b/net/tap.c
b38b0f
@@ -40,6 +40,7 @@
b38b0f
 #include "qemu-common.h"
b38b0f
 #include "qemu/cutils.h"
b38b0f
 #include "qemu/error-report.h"
b38b0f
+#include "qemu/sockets.h"
b38b0f
 
b38b0f
 #include "net/tap.h"
b38b0f
 
b38b0f
@@ -693,6 +694,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
b38b0f
                 }
b38b0f
                 return;
b38b0f
             }
b38b0f
+            qemu_set_nonblock(vhostfd);
b38b0f
         } else {
b38b0f
             vhostfd = open("/dev/vhost-net", O_RDWR);
b38b0f
             if (vhostfd < 0) {
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f