From patchwork Mon Jul 23 20:16:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10540957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73FE117FD for ; Mon, 23 Jul 2018 20:53:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 658AE284EE for ; Mon, 23 Jul 2018 20:53:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63C312852E; Mon, 23 Jul 2018 20:53:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 02598284EE for ; Mon, 23 Jul 2018 20:53:49 +0000 (UTC) Received: from localhost ([::1]:36545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhq1-0006QF-3v for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jul 2018 16:53:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhJS-0002d2-GT for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhJO-0004Mf-RV for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:10 -0400 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:36723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhJO-0004M3-MA; Mon, 23 Jul 2018 16:20:06 -0400 Received: by mail-oi0-x242.google.com with SMTP id n21-v6so3493205oig.3; Mon, 23 Jul 2018 13:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=oFetfdEOU0uKduTpnbpl0Jkjyaf3a5ZwXgwo2CKFotE=; b=ln+E0vP/YCdfFdbNpFXpZwhwymXuPoCih14hMdCw5bNrwdhpUtrxcYbnheXJiI4gn6 awZchvPeNHjFCltnkSQo1uC1PRclMAdwFjFHvtD1vrdwV8DMAwVfNH514OtWTmwfxGwJ 1epUkDom4mX2UEbzrckoJUt7zABYybb8pgw7xNfNWJw5WnIHeu8BZGpqOR4Sclr4Z0C4 izWXyfcA6yGKDjpNHT9fF1D0zGuuJEx3Dd/ilpKhgK6hJwX9ZF688Zddrsk+AKo7W+Bc Rif5g45+kerlJrActRLYtOJ4knv/cZt6pra+EvOEgzS+5qx3Wh50BKzOAyszcOEBDJP8 fF+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=oFetfdEOU0uKduTpnbpl0Jkjyaf3a5ZwXgwo2CKFotE=; b=so3PmpHttgQXgNUgxXAZRt36Vymu81C7US1c/AC9h4PhaZZyrsJmXkkMHlCqyzW+Xf JyxQIJlJDpfdhByf+fL+I7S/5LTZdaLcuSpz1SWJFzSX/uqr5RpzcgyQWlF/ELCIBTNi 2Cd7gfSwMecrgxa6jYqZvGyx+jF5Pqb3bN2Cg+DDowatMxCjsWNkZcHPbnlx1stuMhkP 2kMpZHFZVOv5w/YZDOB5Lhw0w4ieLjnWSE3gKbLI95n5gMgm+o7iawGfVjFCklGji1zM VH2h/QCiuD6omO/ZyIcmSmxUFmDDcMeQzkT404lHMygGofSfIdGap04awTf+r0b3m+Xs V6Mg== X-Gm-Message-State: AOUpUlHlpZDqjIYr9TQ874kPC+X91JZz0MEeakqyIZrrbN3ALwRuvoSr JKWr0mx7dWj0Az500u0Od5pBWPsdfJ4= X-Google-Smtp-Source: AAOMgpdYBosOvo0luNCXyya73/W4PVlKePRnkG9syWPICQbeAaiy8RGvly0T7I/BFmE3eQm18gIWOQ== X-Received: by 2002:aca:d4d7:: with SMTP id l206-v6mr317891oig.52.1532377205600; Mon, 23 Jul 2018 13:20:05 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id v202-v6sm9028501oie.47.2018.07.23.13.20.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:04 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:16:54 -0500 Message-Id: <20180723201748.25573-46-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::242 Subject: [Qemu-devel] [PATCH 45/99] tap: set vhostfd passed from qemu cli to non-blocking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Brijesh Singh , qemu-stable@nongnu.org, "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Brijesh Singh A guest boot hangs while probing the network interface when iommu_platform=on is used. The following qemu cli hangs without this patch: # $QEMU \ -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \ -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \ ... Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of setting vhostfd to non-blocking when QEMU opens /dev/host-net but if the fd is passed from qemu cli then we need to ensure that fd is set to non-blocking. Fixes: c471ad0e9bd46 ("vhost_net: device IOTLB support") Cc: qemu-stable@nongnu.org Cc: Michael S. Tsirkin Cc: Jason Wang Signed-off-by: Brijesh Singh Signed-off-by: Jason Wang (cherry picked from commit d542800d1edc62f63f8a29cfa6bdd1a9536ae11c) Signed-off-by: Michael Roth --- net/tap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tap.c b/net/tap.c index 2b3a36f9b5..89c4e19162 100644 --- a/net/tap.c +++ b/net/tap.c @@ -40,6 +40,7 @@ #include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/error-report.h" +#include "qemu/sockets.h" #include "net/tap.h" @@ -693,6 +694,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } return; } + qemu_set_nonblock(vhostfd); } else { vhostfd = open("/dev/vhost-net", O_RDWR); if (vhostfd < 0) {