From patchwork Fri Jan 13 01:14:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 9514467 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 6BF6B60762 for ; Fri, 13 Jan 2017 01:14:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75BDF237A5 for ; Fri, 13 Jan 2017 01:14:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 674E628712; Fri, 13 Jan 2017 01:14:43 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 3D957237A5 for ; Fri, 13 Jan 2017 01:14:41 +0000 (UTC) Received: from localhost ([::1]:38490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRqS0-0008Vk-BK for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Jan 2017 20:14:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRqRj-0008UK-JP for qemu-devel@nongnu.org; Thu, 12 Jan 2017 20:14:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRqRf-0002vh-Fq for qemu-devel@nongnu.org; Thu, 12 Jan 2017 20:14:23 -0500 Received: from 206-15-90-246.static.twtelecom.net ([206.15.90.246]:46032 helo=felipe-franciosi.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRqRf-0002vU-8B for qemu-devel@nongnu.org; Thu, 12 Jan 2017 20:14:19 -0500 Received: by felipe-franciosi.localdomain (Postfix, from userid 500) id B930A1034F6; Thu, 12 Jan 2017 17:14:10 -0800 (PST) From: Felipe Franciosi To: "Michael S. Tsirkin" , Paolo Bonzini , Stefan Hajnoczi , Marc-Andre Lureau Date: Thu, 12 Jan 2017 17:14:07 -0800 Message-Id: <1484270047-24579-1-git-send-email-felipe@nutanix.com> X-Mailer: git-send-email 1.9.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 206.15.90.246 Subject: [Qemu-devel] [PATCH] libvhost-user: Start VQs on SET_VRING_CALL 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: Peter Maydell , "qemu-devel@nongnu.org" , Markus Armbruster , Felipe Franciosi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently, VQs are started as soon as a SET_VRING_KICK is received. That is too early in the VQ setup process, as the backend might not yet have a callfd to notify in case it received a kick and fully processed the request/command. This patch only starts a VQ when a SET_VRING_CALL is received. Signed-off-by: Felipe Franciosi --- contrib/libvhost-user/libvhost-user.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index af4faad..a46ef90 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -607,19 +607,6 @@ vu_set_vring_kick_exec(VuDev *dev, VhostUserMsg *vmsg) DPRINT("Got kick_fd: %d for vq: %d\n", vmsg->fds[0], index); } - dev->vq[index].started = true; - if (dev->iface->queue_set_started) { - dev->iface->queue_set_started(dev, index, true); - } - - if (dev->vq[index].kick_fd != -1 && dev->vq[index].handler) { - dev->set_watch(dev, dev->vq[index].kick_fd, VU_WATCH_IN, - vu_kick_cb, (void *)(long)index); - - DPRINT("Waiting for kicks on fd: %d for vq: %d\n", - dev->vq[index].kick_fd, index); - } - return false; } @@ -661,6 +648,19 @@ vu_set_vring_call_exec(VuDev *dev, VhostUserMsg *vmsg) DPRINT("Got call_fd: %d for vq: %d\n", vmsg->fds[0], index); + dev->vq[index].started = true; + if (dev->iface->queue_set_started) { + dev->iface->queue_set_started(dev, index, true); + } + + if (dev->vq[index].kick_fd != -1 && dev->vq[index].handler) { + dev->set_watch(dev, dev->vq[index].kick_fd, VU_WATCH_IN, + vu_kick_cb, (void *)(long)index); + + DPRINT("Waiting for kicks on fd: %d for vq: %d\n", + dev->vq[index].kick_fd, index); + } + return false; }