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

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