thebeanogamer / rpms / qemu-kvm

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