From patchwork Fri Apr 6 18:51:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10327487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 934B660545 for ; Fri, 6 Apr 2018 18:53:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E907B286F6 for ; Fri, 6 Apr 2018 18:52:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC1C028715; Fri, 6 Apr 2018 18:52:51 +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=BAD_ENC_HEADER,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 2BEBA286F6 for ; Fri, 6 Apr 2018 18:52:50 +0000 (UTC) Received: from localhost ([::1]:47382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4WTh-0001Rn-4U for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 Apr 2018 14:52:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4WSm-0000ld-Od for qemu-devel@nongnu.org; Fri, 06 Apr 2018 14:51:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4WSj-0002ga-LD for qemu-devel@nongnu.org; Fri, 06 Apr 2018 14:51:52 -0400 Received: from mail-by2nam01on0061.outbound.protection.outlook.com ([104.47.34.61]:22880 helo=NAM01-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4WSj-0002fh-4b for qemu-devel@nongnu.org; Fri, 06 Apr 2018 14:51:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qgHrc2WB3suiO/Ntf5PtYGBzUGW1RmNGk//oZENl/7A=; b=KLHNGy9f4PayE0FeB+8RLVYhlNwEcjd9J3cqAusN+t0pHEJFnjxEecYJZVzOtVejACUv0qFF9CA8ExFcUlXkqArDaM+kv7UwWICVAKlvntBtVNtDml7BnvF+W9fiUE7ColllqjptuLKpgESKzbRY0Tokxkdbcl+0LRS06ckLeDk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0153.namprd12.prod.outlook.com (2a01:111:e400:50ce::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Fri, 6 Apr 2018 18:51:43 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 13:51:25 -0500 Message-Id: <20180406185125.12536-1-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR03CA0017.namprd03.prod.outlook.com (2603:10b6:404:23::27) To DM2PR12MB0153.namprd12.prod.outlook.com (2a01:111:e400:50ce::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1a67bef-f7b2-4df7-ca6b-08d59bef7101 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0153; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0153; 3:mu6ymLzCreN8112DUSM/1faEf5ucI8xF3W65QQACpCMDtIP+WsenLJu+c1ts5OkEPYHPDolvsYgiWRN1HQyLCn/ndRANy7dJ/eI+DJBGFXAa/PQY3Lz2Q7WcfIiRnOFhD9gpA0eKs/JVByDFwcTThLLW2M8+jJq8MaeZ/h76ZrQbVjRjfUJgworSdEJF47SopBKIw3W/uOh1URkbjWbbElkTWMTzvhXaSemp5IEooGangGWCHZRe8gn0+R2mwM22; 25:27oKPmmMGfBg/xlnJJ1C/05DLNTZGE0IUUdRzZroNWkJbTQ51Sdp9DNmuxtzpH4aJzk+oV9RpbMq6byxIjCL4VQfrjJoAlbWR3XC4/RJ6Bwmwi62xa8DmQNsvxY2semgxlChAZZ/G1WbO+zOoj3Rtpx8VjroY4W7TsuFxOdKiPfsXzDJ0B+Fb/ykhtu3wo6IeaWeGOgOosS+th0hR3NzlsTXRjgYS9WpfF/p0X+rLfdqlSbgonKbOTKD+3/bSQKAP6wvleQ1fiiCKN5kmzyJJlpfxuRVlnhEtdwma4hq4IpGm88Ib3ABSCeN5zijfqY12UZJgJkQknGNuB9kQfSvKA==; 31:XRTs7lfl1IsA5bi8iU+AEKOm7S3PAz9co5clzVXTsm3hxzWAGHG8L7mPYrsFiJs48PLf4csNSdg4BRBbhjzzXOEQ4CPSf/p7rKimFXKVz5qoV95dNOGn/5GGp5dKN4PKi7Wq4HdqimCfSwgvxsz2+j/1i++Co1hGWLoU+76zFUNZ/1kNr4mltj4pcaT0rdglWNpdRE9ALytqt99Bg7JV6qqQkg+Dl3Wpc+Mo604BWVE= X-MS-TrafficTypeDiagnostic: DM2PR12MB0153: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0153; 20:ilbkCcJPaCUgv2/J+VfHfndRENA0TQfgEKHfmohZfWG0J7v1yiB7t1oO4DNOe7ayrnLXDmhSaKbSEvwUEqWqKjf5QIqpDxKzuC7GZ/fQ+DDo4ZN+4P7iQJEN7j1SDqai3jGweCcE/BZOWFXztAg9xN5wM8Kbg5WPPfle2++YfFrhYwuKOCktE5bcycez3KsQtVPcxvipl3nxu1B2Vr7iPUnsE0catCcI5njdgsPanVtuHvtxWdnpDYiPVp05VwzuoLAIkOR3rDHX5YZYzfN5JI72HcpQvx5MvJwDUM0NzOnDrNCqd4lzK3omn+L7lPgyF26B7KIwBgSqKqm+BbaT/Ubvaqp86T2BekFPriHY8Jmk5PoUTBslPfsGorfJLtBnRnuL9QPeRWGy3CKflYOIxIq9kCc3nQqqXPs3CS6CWJDCfawTlQQl8xM14joG6bUv99gy02o6EYpbtQHZDkVOIsIdZE5eHncCEpvsWQUMOGX3bRL62GEIF0i8oikjYCVQ; 4:/mirJ80wFdaHUKczL2uf76gTqw/rK5IJH6bmj1woo09CXtJcKuYHpHOa6WO6w7/DjjxVoWxfd+gsQ/3aVopHIu5PO+dasvvThJLwR8cmKLrR4M6YTau8omPqPjWDxvZrVMLp/p7kHHh5Q+WbsGRqtnbB1XG74Q6DgiNi+ApdSBigGU9X3tYdrs76truf8Bo/MUN3MNoPjYM3Z2TRmmC5USdid8ejj8Omu82euldwaRy1Wok+LhI/ejM7YN3q0ztvCH5m5C02zssjaFjHVyy0YhJvgLOOcFJpJdYDtrVYr3E23h9gHBIXcJUyyRNlx2TN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231221)(944501327)(52105095)(6055026)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR12MB0153; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0153; X-Forefront-PRVS: 0634F37BFF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(346002)(396003)(376002)(199004)(189003)(2616005)(6666003)(16586007)(52116002)(51416003)(86362001)(7696005)(575784001)(6486002)(316002)(6916009)(53936002)(105586002)(53416004)(54906003)(48376002)(2906002)(386003)(8936002)(50226002)(5660300001)(106356001)(50466002)(4326008)(305945005)(2361001)(81156014)(8676002)(68736007)(2351001)(25786009)(66066001)(478600001)(476003)(47776003)(81166006)(36756003)(956004)(7736002)(26005)(16526019)(186003)(3846002)(486006)(6116002)(97736004)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0153; H:wsp141597wss.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0153; 23:nCJ3AbYn4FJikbAnjK5r4eBkEQkFeE9Zl5cOnbMai?= =?us-ascii?Q?Q/nlAj98SxBMUj/1jTK3Bq0+5fBncugrKad/EyFFr+DppuiZXOgjgILOSDxA?= =?us-ascii?Q?OKyKxVEblnelho5TJfUH2quYbBPVEGe7nA6mdQSNH63rijZ71rtkL9/QSgku?= =?us-ascii?Q?jpUawbvW5dNpqVYFwCG3q9bv14MeWbieawQhqNlQwU/fUu79w29pWxuAE7tM?= =?us-ascii?Q?iHM2tes7ooUUUtfRzoX2CNM5IqoC4kPHQOW4g8i/H9sPwtvuiixgb0kqqo+q?= =?us-ascii?Q?OcAXUpfBchAVyElOQvR8THDAiMxYbHKBlGKG8CvkR8g/nFm7dBWl9mwBvJC+?= =?us-ascii?Q?53N8aDzRJ9WJZ+7OEaCQpXsyTreXUVoiN1wYxbnmt2z2STMq4dDipNqWDVlH?= =?us-ascii?Q?NUOyCwEaZTimQcmWxoMSWg7tqphudI/E06ya86tMqIvo/Kq+veq+R+A48dPC?= =?us-ascii?Q?k0TPM03HynFsxLJc7YnQbOt8y0wRnWiOkqrtYq4OsofebIrkT9nHScdv8Lnh?= =?us-ascii?Q?tEexCVKYIfwy1HqbDHWJmoMH4WgryhVcS7upn8++MgFNdQlZfLCP3AAUP9oc?= =?us-ascii?Q?4JL1zYUJ24FQKG8t/tCvtetN3DjyuAzB7CDe+J4pMzfJABoRAv7BIn27YIAO?= =?us-ascii?Q?C1mvPUQKmLX0atLcXjKky9aJcbuio1wT3YjQy5dJompUEcV4PxK4+fXpIOls?= =?us-ascii?Q?6JxAQ8JVu2Nd4tiGJKCokhQ6xb7SCIYEKjaUD1tzm4X/tAsOnDky/Al1jkc4?= =?us-ascii?Q?6JlI7RTmUlIXwwFRBmRMGtZKyEnZ9bPGoXUeN7dI0iZmFUKEYxhDXZT/ovtC?= =?us-ascii?Q?IgqCGgipZmfzxZmlWriUSI+mL4oFBfZU1REv3tdfeCKJAs5spdQCq7l6CClx?= =?us-ascii?Q?esZ7eqFmBZ1xxOSwAtrMRd1mtbLA315XKa7904DL2WB42RravCzuXxgFHgCu?= =?us-ascii?Q?g+ffURcEH+YeTYQHI7dBu5VYni5rhtoGEKtnRq2K8ulncV2J9KP+xDQfJ3sx?= =?us-ascii?Q?A5LgfX4frE/3g4JbCYfqfFk7qkAc0IB9L9ID5bUF9/VKaNbLGI9YQbT/VeVy?= =?us-ascii?Q?g8aXt6Ku5O4XUa1JjEepoThPu/0FsYkEFtMjdNuaWqIcZCfdqZJtbudKFEP3?= =?us-ascii?Q?i8T3u48rXqDuLMT6LthLXLbTkNDCxAE3Ig2MCjAiF/LG3rycwfutxPuhH0fR?= =?us-ascii?Q?346E0yrOfnC9V7qZKc630O4N3amlkxMO5Wmitt0BZBh65aEImisFecVwg=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: YdoPUOcoP7bILlUdxaqVtcrDR3kNvpcE+VGLpapp4c1MAfTFuTL7irbucrb3T41tUR+IIINiEmCCW8QsnszWWsydlHPX8P2NbD+nJaGNyGnmuaOhBuuKk2wmwGQXlfFrIS02UtiGjl+byuaeQClzzh7bcN7InlE1pIo+8SYYiJzYo1gn5s//LpRDnCiAuJRg X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0153; 6:htA0Q8Xwouv0wO+QoMQkp+ZZ4GQAtqA91GYqyo3q0aheQEx4BMHNWawtFwBZxkz26kOP5qIIdxSH2f7DhGQvlXDXvE3RcqY1AHdAQPcwF6XV2PmbPMoTBqLisAK2VsMNy8tlE5BWlkYbZ5nCyE7rbu4oo+WAaIWJEGf1wVDwa4cJo6nfh6qhxYZLpkE0xtJh3LPKBBmiEMA6D3epDucaNtp82j446eHcgJMOLVvCkFY82FLrS//0w/ZIzC+POwvbI/2UnkBDFuORWNpgHWaS5cGFiQFJKxPLcfPRzDIygi18pWi96380LaesMK3OyTgyyghEBMYHnwrwiOMCjK9zR09nAjUMVIaUtyt+VP5//NJSPX0xLks3sUoLt9hl0BH6MtVCPLgkRfzNSK3gZJfzJDmmGpmMpcpIwIvCHT+T8xAT4K7VbCyKQVSKqBAme9XUhZIk+2gxuHX6M/y2Pk3VRQ==; 5:JVG1L+WN0xVeM11Rjwksm4Qyw/UPJxoLdAmM7cMwpbLMzgkmsFTCsFX2yME5HSak5F7vNrT2gDtUtHoEAh1Y5mcCAtslai+IAFcmFykzaMCALTrOVyOpNcI7QMRW2frv55dqn70vSjH6haSn6VKbPO40W3IDGDWUfbQ4Ra0ab0E=; 24:az0gTenlaRXZtivLPqEkJXMLGDb2srouHvedWhvh1HPSNH7umTYhEGLfdx5A+H9rn8d23sdKQ4RCz6F25bJfUcPbmXu7fPMXDUCQGY0hpE4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0153; 7:/gaKGFuk1NmYQ3x+m3L2NTlqHMnfi37TBprSho8oOoLX+76JbF3cg6SjuC0lJo4SINXSfwy5QrEJhupd4oP2e1JJ93Y21rRFqO57QrxWqoiYOp1VlHH/i9a00ZmiWq3kqFpOTU1D4TdFSSnLvStvKA9f2EUM/0PoJh6ngNBWeWHZDim4/ufbGRJdLgakFUdv3mntm4CFEZukphWQjzaqgxUu1/HfxbXXvKZ/aqnIrs6dbgQH96EhTPUWce2z7mbv; 20:wZDFnysInXeYi985NVfJ49esTqw+ZyU+4EvPX91PaBuN0Q6hUwhTl6wL5QvM9Y7UIMDOOigSN8TdGod10nroGmLouuIlTHSpIkZA2nP0xXlJESa9M0MhYxKNmAWZcz3vFfMU7mmOePqwW6GCjRo6ZsceknD3gWcqcC2pGhuppL9vD9xeLwNgbSGAo4u37E4amhX4Ll77Or2ORmdUSG0n1Q3PW1MubroXjeYNAMrblK6AfbeCa/DlpTnq4iRMkhJS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2018 18:51:43.2131 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1a67bef-f7b2-4df7-ca6b-08d59bef7101 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0153 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.61 Subject: [Qemu-devel] [PATCH v2 for-2.12] 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: Thomas.Lendacky@amd.com, Jason Wang , Brijesh Singh , "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 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: Michael S. Tsirkin Cc: Jason Wang Signed-off-by: Brijesh Singh Reviewed-by: Michael S. Tsirkin --- Changes since v1: - use qemu_set_nonblock() instead of fcntl(..) net/tap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tap.c b/net/tap.c index 2b3a36f9b50d..89c4e19162a2 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) {