From patchwork Fri Jan 12 14:56:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 860002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zJ5hW4p1Wz9t3G for ; Sat, 13 Jan 2018 02:07:39 +1100 (AEDT) Received: from localhost ([::1]:46685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea0vh-0000vI-Og for incoming@patchwork.ozlabs.org; Fri, 12 Jan 2018 10:07:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea0mO-00088a-AR for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:58:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ea0mK-0001Ap-De for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:58:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54104) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ea0mK-00019i-7T for qemu-devel@nongnu.org; Fri, 12 Jan 2018 09:57:56 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42D2862E8B; Fri, 12 Jan 2018 14:57:50 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D27F171B7; Fri, 12 Jan 2018 14:57:10 +0000 (UTC) From: Maxime Coquelin To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 15:56:54 +0100 Message-Id: <20180112145658.17121-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 12 Jan 2018 14:57:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 0/4] vhost-user: notify backend with number of queues setup 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: mst@redhat.com, Maxime Coquelin , zhengxiang9@huawei.com, mlureau@redhat.com, pbonzini@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This series introduces a new vhost-user protocol request for QEMU to notify the backend with the number of queues setup by the guest driver. When the user backend cannot add queues dynamically (i.e. once the port is running), it waits for all queues to be initialized. Problem is that QEMU sends messages for all queues declared in command line, even the ones no setup by the guest driver. Without fix from Zheng Xiang [0] that doesn't start queues that haven't been setup by the guest, it ends up corrupting memory around GPA 0 as SET_VRING_ADDR is sent with uninitialized ring addresses. With the fix, the DPDK backend would be stuck forever, waiting for unused queues to be setup, which won't happen. Note that these problems are met neither with virtio-net Linux driver, nor DPDK's Virtio PMD, because these drivers always setup all queues provided by QEMU, even if they doesn't use all of them. However, the problem can be reproduced with Windows guest, when QEMU declares more queue pairs than vcpus. In this case, the Windows virtio-net driver only setup as much queue pairs as vcpus. [0]: https://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg02484.html Maxime Coquelin (4): vhost-user: fix multiple queue specification vhost-user: specify and implement VHOST_USER_SET_QUEUE_NUM request vhost-net: add vhost_net_set_queue_num helper virtio-net: notify backend with number of queue pairs setup docs/interop/vhost-user.txt | 22 +++++++++++++++++++--- hw/net/vhost_net.c | 17 +++++++++++++++++ hw/net/virtio-net.c | 5 +++++ hw/virtio/vhost-user.c | 24 ++++++++++++++++++++++++ include/hw/virtio/vhost-backend.h | 3 +++ include/net/vhost_net.h | 1 + 6 files changed, 69 insertions(+), 3 deletions(-)