From patchwork Wed Mar 20 11:26:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861411 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 D80581390 for ; Wed, 20 Mar 2019 11:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B436929B4E for ; Wed, 20 Mar 2019 11:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A886429B50; Wed, 20 Mar 2019 11:28:40 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2CC2129B4E for ; Wed, 20 Mar 2019 11:28:40 +0000 (UTC) Received: from localhost ([127.0.0.1]:46401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZOh-00008L-Ea for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:28:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNY-0007jS-IZ for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNX-0003oV-Du for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:28 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:45753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNX-0003o5-2V for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:27 -0400 Received: by mail-pf1-x442.google.com with SMTP id v21so1704881pfm.12 for ; Wed, 20 Mar 2019 04:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eX8ddzsNtHLK642MPr1RzE+GTBi36YMIFONSfsubNPA=; b=peZp1rXS3K9xst2IlpcPS6A1RlP7ntdhs2weSlDaoMePeGPWHzGBloE/xqieEefnik kzICGcud51apronhvzIrbWSYF0bBiDpJfOaMAlmnk7tSXI/6uuxVXToqFfet2ADjUzC9 1V4TxkJ8nqIelkh21aPygl9GVT8Mw4M9UNIiWmGujZNhGHEONzgXRsMO5T+6phxsiPii ANNDmKCxEyThjOum0ZoTuNX4kL1n1lo1BZXQ+XUPRpIGkGmMOuo/u+5aAaN48No14py1 gpmlJ6X54A+OZC7DwQKSJfjIcCr2yYdfbtJPkPVMFIIoB2uOQM4OpEFDWeXUDGFZ0nhK 51ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eX8ddzsNtHLK642MPr1RzE+GTBi36YMIFONSfsubNPA=; b=uT52vSe3EJjUaaBw/HdlRoj11QYXwxPMe+r2FKOJo/JtNo6kD7Agm9bkU4wLL6cDyb aXkLtMYTVeCRK5gOSsLyeRsVoGcKOX9gE0elBRTXbJDfZilupVaUY0SV8nt6QTrC6Gh1 lMMGG/m5OZHFR8BHHcYx1Rn6f71zHkujk+epxjRRugAxntBgPhZcJzngPbMsoc67+Nm9 gt6Pv/4c2AsGS73NhxHuHmekVnmMKZ9TkxPonZJzZkpZ+f39odsSTWQOYEYIl47zu2xg JHhvV8pLdyKpm+w6s/RvKL5jAvFpP3hwEKC5Q0JF7SLXMb4loUB4Gl/Pyvxb2DtvrlbZ 1fcA== X-Gm-Message-State: APjAAAWfKj4NJHVCLs/noMBO8X/MhEq5DXCbh/FBSosO3bkyKyNSwS1d CzlG2x96r3vASyK2XdmdoNo= X-Google-Smtp-Source: APXvYqzuR9W+7UhwQTimIfMB2UxS4ghGhIPTgxRn17JZhW3f4r7zLqQlqaAVYf4K3VGJUdldZsqgXA== X-Received: by 2002:a17:902:728b:: with SMTP id d11mr7537078pll.257.1553081246323; Wed, 20 Mar 2019 04:27:26 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id w123sm3265360pfw.72.2019.03.20.04.27.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:25 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:40 +0800 Message-Id: <20190320112646.3712-2-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v8 1/7] virtio: Introduce started flag to VirtioDevice 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji The virtio 1.0 transitional devices support driver uses the device before setting the DRIVER_OK status bit. So we introduce a started flag to indicate whether driver has started the device or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/virtio/virtio.c | 52 ++++++++++++++++++++++++++++++++++++-- include/hw/virtio/virtio.h | 2 ++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 2626a895cb..af7b59b4ae 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1162,10 +1162,16 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val) } } } + vdev->started = val & VIRTIO_CONFIG_S_DRIVER_OK; + if (unlikely(vdev->start_on_kick && vdev->started)) { + vdev->start_on_kick = false; + } + if (k->set_status) { k->set_status(vdev, val); } vdev->status = val; + return 0; } @@ -1208,6 +1214,9 @@ void virtio_reset(void *opaque) k->reset(vdev); } + vdev->start_on_kick = (virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)); + vdev->started = false; vdev->broken = false; vdev->guest_features = 0; vdev->queue_sel = 0; @@ -1518,14 +1527,21 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align) static bool virtio_queue_notify_aio_vq(VirtQueue *vq) { + bool ret = false; + if (vq->vring.desc && vq->handle_aio_output) { VirtIODevice *vdev = vq->vdev; trace_virtio_queue_notify(vdev, vq - vdev->vq, vq); - return vq->handle_aio_output(vdev, vq); + ret = vq->handle_aio_output(vdev, vq); + + if (unlikely(vdev->start_on_kick)) { + vdev->started = true; + vdev->start_on_kick = false; + } } - return false; + return ret; } static void virtio_queue_notify_vq(VirtQueue *vq) @@ -1539,6 +1555,11 @@ static void virtio_queue_notify_vq(VirtQueue *vq) trace_virtio_queue_notify(vdev, vq - vdev->vq, vq); vq->handle_output(vdev, vq); + + if (unlikely(vdev->start_on_kick)) { + vdev->started = true; + vdev->start_on_kick = false; + } } } @@ -1556,6 +1577,11 @@ void virtio_queue_notify(VirtIODevice *vdev, int n) } else if (vq->handle_output) { vq->handle_output(vdev, vq); } + + if (unlikely(vdev->start_on_kick)) { + vdev->started = true; + vdev->start_on_kick = false; + } } uint16_t virtio_queue_vector(VirtIODevice *vdev, int n) @@ -1770,6 +1796,13 @@ static bool virtio_broken_needed(void *opaque) return vdev->broken; } +static bool virtio_started_needed(void *opaque) +{ + VirtIODevice *vdev = opaque; + + return vdev->started; +} + static const VMStateDescription vmstate_virtqueue = { .name = "virtqueue_state", .version_id = 1, @@ -1898,6 +1931,17 @@ static const VMStateDescription vmstate_virtio_broken = { } }; +static const VMStateDescription vmstate_virtio_started = { + .name = "virtio/started", + .version_id = 1, + .minimum_version_id = 1, + .needed = &virtio_started_needed, + .fields = (VMStateField[]) { + VMSTATE_BOOL(started, VirtIODevice), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_virtio = { .name = "virtio", .version_id = 1, @@ -1913,6 +1957,7 @@ static const VMStateDescription vmstate_virtio = { &vmstate_virtio_ringsize, &vmstate_virtio_broken, &vmstate_virtio_extra_state, + &vmstate_virtio_started, NULL } }; @@ -2286,6 +2331,9 @@ void virtio_init(VirtIODevice *vdev, const char *name, g_malloc0(sizeof(*vdev->vector_queues) * nvectors); } + vdev->start_on_kick = (virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)); + vdev->started = false; vdev->device_id = device_id; vdev->status = 0; atomic_set(&vdev->isr, 0); diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index ce9516236a..fea08bcc44 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -105,6 +105,8 @@ struct VirtIODevice uint16_t device_id; bool vm_running; bool broken; /* device in invalid state, needs reset */ + bool started; + bool start_on_kick; /* virtio 1.0 transitional devices support that */ VMChangeStateEntry *vmstate; char *bus_name; uint8_t device_endian; From patchwork Wed Mar 20 11:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861425 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 06FA317E0 for ; Wed, 20 Mar 2019 11:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD01E28C7B for ; Wed, 20 Mar 2019 11:30:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D090129B4F; Wed, 20 Mar 2019 11:30:47 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 891B528C7B for ; Wed, 20 Mar 2019 11:30:47 +0000 (UTC) Received: from localhost ([127.0.0.1]:46449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZQk-000225-QA for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:30:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNc-0007l5-8c for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNb-0003qJ-G8 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:32 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35743) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNb-0003pw-45 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:31 -0400 Received: by mail-pf1-x441.google.com with SMTP id t21so975923pfe.2 for ; Wed, 20 Mar 2019 04:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W4cUgpfE75IMflSgjXyGbJgkhVbCyuywlDtwxjb+vZo=; b=omYO66n/nb2qU3pFeCqncOg4fuXQ20V2UM2ey3bgeOeFPQNJR9EHvCiDkCBBlVmYTy FJLEIK97xA8JmR4I/EpnlAJBhTCyT3Hp0omW2Qr589T79JvGALcw1U6g+rb8K0wjaxY3 uOtiGU2q86/Rd03IOD1vtdByehSMxmZIVXno51om6tjrEyUPpftPN7KANbpDYJ8T+7mn b0z+sperfibg2oi29ZznPgqjfJoyShFrh+ukW9IyAwRn6ut93IB6TOqdKtd4KxQcnOhU aDeGIb56bZs47nGigSTG/34MK8gAG4dKgpRX0wjvMWqwkQi5qyXTE60m2ZvLOjnM/tEM 0vzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W4cUgpfE75IMflSgjXyGbJgkhVbCyuywlDtwxjb+vZo=; b=qJwzupHc4FTJREcBk0Rsc1g0Ug0eobCKIrx294i2eZ6DRr8xgtlY6wJ4+RTBXelHsm MO3PeyOi0qiPB5KQIPTtvjefBViYpybdAqCBjFscAbJXm3Fqjmj62gruyEjBxSnaYznT EGFZjrHV+eu7UujCq94ZbNTy6Q94l53i/M+DERPj361Mzfbzo+kAdmOClrH/Q/q+T1b4 MDGNSoICH0mv3M+87X0n384EOjLLFU79oI89E077b7G3O2NrRyLtWec3vsIG6In0hZEU Q8/EVsireVFT9LAjKVoC3CBGSBQa8UCxqhd1s3HQ75GwTa31kioOyfbnRd21Ip2ED1l8 XTlw== X-Gm-Message-State: APjAAAUIScb1z8jC+QQQ7NN0hfonHfMybvTeREPw1odit6BnvvbN6bQp UNEax9cvoNI3PhjuzxMzw/M= X-Google-Smtp-Source: APXvYqwRB+uO48vDRImwsnzMAUzD5hLCoLzCvQgNOELZLT4KrX1gACsnUhl7hxu93MCV//xBCi9K6w== X-Received: by 2002:a63:bd51:: with SMTP id d17mr6847471pgp.117.1553081250233; Wed, 20 Mar 2019 04:27:30 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id k8sm2014797pgq.37.2019.03.20.04.27.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:29 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:41 +0800 Message-Id: <20190320112646.3712-3-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v8 2/7] virtio: Use started flag in virtio_vmstate_change() 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Currently, we use DRIVER_OK status bit to check whether guest driver has started the device in virtio_vmstate_change(). But it's not the case for virtio 1.0 transitional devices. If migration completes between kicking virtqueue and setting VIRTIO_CONFIG_S_DRIVER_OK, guest may be hung. So here we use started flag to check guest state instead. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index af7b59b4ae..b8d36cd4b7 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2291,7 +2291,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) VirtIODevice *vdev = opaque; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK); + bool backend_run = running && vdev->started; vdev->vm_running = running; if (backend_run) { From patchwork Wed Mar 20 11:26:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861413 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 986FA15AC for ; Wed, 20 Mar 2019 11:28:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ADEF29B4E for ; Wed, 20 Mar 2019 11:28:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E80A29B50; Wed, 20 Mar 2019 11:28:48 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1DAD129B4E for ; Wed, 20 Mar 2019 11:28:47 +0000 (UTC) Received: from localhost ([127.0.0.1]:46403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZOp-0000FV-6G for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:28:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNf-0007nN-5R for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNe-0003rn-Ap for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:35 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:37534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNd-0003rf-V6 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:34 -0400 Received: by mail-pf1-x443.google.com with SMTP id 8so1735254pfr.4 for ; Wed, 20 Mar 2019 04:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V+tk2Ez3eDPbL7SQZx8XRpdn5sQlO+TtF+TNfF2ImnU=; b=VBXDZcBj2r1uL6in6yls+DhgFaQYfIHxy+KKCbI5I9lAo5RlL0fR51B7cbniVC7X+8 hHdyN9lUPCFvzmdgSv8xC61l3ijNRVGe7RpA7pUfMDcPRVtDN9+5xlmabjPUitmkIHTB Jjt2eegb3zYWWE1fMiet60fSTgiA3QAtm2EG0ee+Z1ZAYbITXWlF9T1u2W1+rQsIOhgI yWtcgCPtN4ndP/olR1x2jakdb5AKiGmCSnLxZ+UIuZS8tRcEW+KdurBmQCKRdJ3Dhbbc 5UjEvV2GkUPMybGnWykA2LVeHz496jCcBoGGJqyAgoPX5tvvBKGouIKp1IrDDKPORt5B 2RJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V+tk2Ez3eDPbL7SQZx8XRpdn5sQlO+TtF+TNfF2ImnU=; b=kePfyimJ58TzB7bwCmOYrfbF3xsWf8HA/Uj2FJKtJgAJSlmYdD1f0YrKNLGv8LWtY4 iyw4/evnF/9OQGJSzmQ6x/qxnF8FEPwH8YfFB8cWWMIeF2tQhA5tbU78Tz/xiMq1+H9O mM0GUSY4xdf0Ra72JQIKnSKvdDq+Wa6Xnrgaae/kZK0ypxN8VN7DjZJIXJfVy+uuI9YD vpYiBjD3mnDNRnEcx3Fg+5LC/sBCLY7lZ7BgCio01PrCLL+z4HFCv5tyRvoso3+bBhgn yD3KK/9r+IakcKPiZ4197Gzo6CHQ9hKNgj8MmY1ba40FzkFPAhk9GW/9LMRaBVn3CbfQ BKJw== X-Gm-Message-State: APjAAAVLU9uQmgYI1nPmAsCnjTS8No885YOzdQMhRr8vo2+1u0ZU5NqY jITemB6jEybyRhyGvVYNVs8= X-Google-Smtp-Source: APXvYqxdeVIZXRaGyBAUyhuCusq89yvfaFVPTVC8A4QDOpyjkGua3sTFvG4TSEpBWRmnfqZ9JwZdGw== X-Received: by 2002:a63:fd12:: with SMTP id d18mr27115045pgh.88.1553081253129; Wed, 20 Mar 2019 04:27:33 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id o5sm6722720pgc.16.2019.03.20.04.27.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:32 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:42 +0800 Message-Id: <20190320112646.3712-4-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v8 3/7] vhost-user-blk: Use started flag in vhost_user_blk_set_status() 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Use started flag in vhost_user_blk_set_status() to decide if starting vhost-user backend or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 28b81368f7..700c1dd111 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -190,7 +190,7 @@ static void vhost_user_blk_stop(VirtIODevice *vdev) static void vhost_user_blk_set_status(VirtIODevice *vdev, uint8_t status) { VHostUserBlk *s = VHOST_USER_BLK(vdev); - bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK; + bool should_start = vdev->started; if (!vdev->vm_running) { should_start = false; @@ -350,7 +350,7 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) VHostUserBlk *s = VHOST_USER_BLK(dev); struct vhost_virtqueue *vqs = s->dev.vqs; - vhost_user_blk_set_status(vdev, 0); + virtio_set_status(vdev, 0); vhost_dev_cleanup(&s->dev); vhost_dev_free_inflight(s->inflight); g_free(vqs); From patchwork Wed Mar 20 11:26:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861429 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 86D4315AC for ; Wed, 20 Mar 2019 11:31:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C9C298E6 for ; Wed, 20 Mar 2019 11:31:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B0CD29B51; Wed, 20 Mar 2019 11:31:00 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C9B4298E6 for ; Wed, 20 Mar 2019 11:31:00 +0000 (UTC) Received: from localhost ([127.0.0.1]:46451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZQx-0002Bz-Bs for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:30:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNi-0007pl-Gp for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNh-0003tX-Nc for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:38 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:44185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNh-0003t6-CJ for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:37 -0400 Received: by mail-pf1-x444.google.com with SMTP id a3so1703218pff.11 for ; Wed, 20 Mar 2019 04:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EbPLfyFegwraFvXszMNR0JA56wbGdOH6VgYSV24TTnM=; b=NQOPivmuoA3Cu8i4uIHs0dnpQxIRx/SanZ8IhOTppVpqmFeV4FQO53opyhE89NusqJ ZQV2C51HtdX8OC3UhVcQoIkZno0AV0wTIVOK0AsgAJFK//zDCdGOADJl9L8RDK7sJlnI TK7xH7kpIxlx+CroF6RU8uYkbawLDRs215q9uVqZz36zeD9wdCTxmX1DFzR0mPLR/VGm 6WiLLOD3gYwrbEea3MN7hg2RcrdWz6vTbLyS/DwM1SqhADh527EBRsvwNN8doqEGZbJ9 EARxbPr9WAfPVQJ8HPS/RKz1c2Zts/Q0zPKSfqf5VJ26Idj8SXm5utn9pgXfVGqext80 5E0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EbPLfyFegwraFvXszMNR0JA56wbGdOH6VgYSV24TTnM=; b=ojeAhxRAFPcI7BxX1Pf6NDidiBH2qYZMDE9//iiU10KQnEsYjt+TYXWl43PnEZ0b6L 131WWPMhnRqnQg9EuQBwvY1+tSBHAMJA0OvsHWck1H1sgVp6HYmoM2lA1vLsyXrY68bU lmjGJbssJAg5i4aI9cChj/IHGEolqInHDTeK+JcXlLVoZ9gUdmMq+CZiR4wfMwjdc+rm oV6WK3l6VO/oOtUGhMZ4lGBPvlMIxQ8jpPiwpvXbAkndwH9P4BaH0VgCBhM0JZweQkPU wIq1PO0CRHZaDhrj13lrAD9ghIxTSnYd5QebTwle+XzAJgVh1drf9XUF9/uPwnpmnKG6 a8Yg== X-Gm-Message-State: APjAAAXdtIR9ODJSujfl38NuT21/NqtrOYEvbb920fAhkCsjnL4WWmjX 2n+6wdnzXaKz9Sv6Vt1qwM8= X-Google-Smtp-Source: APXvYqzoRJmYPspSqbdZzI8/gt3priilWgksSroOgw8aYDnqLwynujUXmDJZwfVGPd+PLUr0tg1xVQ== X-Received: by 2002:a63:36cb:: with SMTP id d194mr7399974pga.426.1553081256329; Wed, 20 Mar 2019 04:27:36 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id d23sm4884862pfn.69.2019.03.20.04.27.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:35 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:43 +0800 Message-Id: <20190320112646.3712-5-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v8 4/7] vhost-user-blk: Only start vhost-user backend with the first kick 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji We should only start vhost-user backend at the first kick for virtio 1.0 transitional devices. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 700c1dd111..39e1adc60a 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -239,8 +239,7 @@ static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) VHostUserBlk *s = VHOST_USER_BLK(vdev); int i; - if (!(virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) && - !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1))) { + if (!vdev->start_on_kick) { return; } From patchwork Wed Mar 20 11:26:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861435 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 A4E9317E0 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8587E29B54 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79E5429B56; Wed, 20 Mar 2019 11:33: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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C70129B54 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: from localhost ([127.0.0.1]:46475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZTh-0003zd-9n for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:33:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNl-0007r1-8G for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNk-0003wR-HE for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:41 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:42947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNk-0003vH-4A for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:40 -0400 Received: by mail-pg1-x543.google.com with SMTP id p6so1585208pgh.9 for ; Wed, 20 Mar 2019 04:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4B3BH1ILWujJPaM/a9P3rPutgoh2mf8u1LXdt6dGLB8=; b=ZeTf3Ilu8M+T/GrmeWT+l0X2TlHXjWksAcgpaKemSeT2hLYi0uJE5VjvZdqQxsRZeB 4Lu2hCIAYdkR7lusq/INinOnzl6iwksVKwdZ+zxtEfKIDKdsejtmUkGUhxPijERSwQNf /5wXFGu47ukNH8UL1gy5xOyDwV9p5N6v+bkl0Gfw4lGi7I9G5/quVGZ6jP+LPMzZ9/v1 xJfiNtEPW5KEjRnNBEbr77sUkbTifKwLKuDt5un9BSQPI1cOEA/WQAODR9es1iPnMzO4 DjOCieyrPs9wG10b5h/+IS6HCzm1T77stHvLWPvkHcQajBXyG+8jt0gbRidWp5hA5LFD oYow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4B3BH1ILWujJPaM/a9P3rPutgoh2mf8u1LXdt6dGLB8=; b=S1PcFSRq6tW8OR+43WSKsway+SCkTijlXyg5PGeut1jHiMvpsInHLRN+XE7+8B4uk/ W65K3mOURBIs1/DRI2eu44lmFY8fUWyZrZAop7IsOJLLYxmOm49wM3GTg/1WaEvNwz5Z dZLFGIewhlT0JHfZvVIoYJ6U6Tw+x5X0V3s0py/uJBgeDUcHvAn2LrUcJPTwIHK+Q2Jj Lph6dQnkn6+9PyobAGii4og4vwmysFjLiuT2B1Jy6GuP6XkrLfup0pM5yqNsbqrSWOP4 oas251rhDrpBR8ciBxBD1REUHfBIeZ2SYXt+vZE6NmuFm07ih/rkTTlOiGTNqAnN0QaH N9ew== X-Gm-Message-State: APjAAAVVjLbZqc7kQp3wuqFy6J3CpZjoujqU1I0JHhnBC2JtYxyx5z8G aybBnio0A/D0HiVWeQeDcK8= X-Google-Smtp-Source: APXvYqz3jXLiak0jSmjg34g6SSW0YF+Cck0veDa1sbj0Qa4BLHmzG1+rDbHCJeNpRCUGt8prqVWudg== X-Received: by 2002:a63:190d:: with SMTP id z13mr4270470pgl.432.1553081259298; Wed, 20 Mar 2019 04:27:39 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id x23sm2195666pgf.10.2019.03.20.04.27.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:38 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:44 +0800 Message-Id: <20190320112646.3712-6-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v8 5/7] vhost-user-blk: Add return value for vhost_user_blk_start() 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Add a return value for vhost_user_blk_start() to check whether we start vhost-user backend successfully or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 39e1adc60a..6802c19d65 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -103,7 +103,7 @@ const VhostDevConfigOps blk_ops = { .vhost_dev_config_notifier = vhost_user_blk_handle_config_change, }; -static void vhost_user_blk_start(VirtIODevice *vdev) +static int vhost_user_blk_start(VirtIODevice *vdev) { VHostUserBlk *s = VHOST_USER_BLK(vdev); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); @@ -112,13 +112,13 @@ static void vhost_user_blk_start(VirtIODevice *vdev) if (!k->set_guest_notifiers) { error_report("binding does not support guest notifiers"); - return; + return -ENOSYS; } ret = vhost_dev_enable_notifiers(&s->dev, vdev); if (ret < 0) { error_report("Error enabling host notifiers: %d", -ret); - return; + return ret; } ret = k->set_guest_notifiers(qbus->parent, s->dev.nvqs, true); @@ -157,12 +157,13 @@ static void vhost_user_blk_start(VirtIODevice *vdev) vhost_virtqueue_mask(&s->dev, vdev, i, false); } - return; + return ret; err_guest_notifiers: k->set_guest_notifiers(qbus->parent, s->dev.nvqs, false); err_host_notifiers: vhost_dev_disable_notifiers(&s->dev, vdev); + return ret; } static void vhost_user_blk_stop(VirtIODevice *vdev) From patchwork Wed Mar 20 11:26:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861431 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 D017315AC for ; Wed, 20 Mar 2019 11:31:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD5B028C7B for ; Wed, 20 Mar 2019 11:31:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E08129B4F; Wed, 20 Mar 2019 11:31:12 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F061228C7B for ; Wed, 20 Mar 2019 11:31:11 +0000 (UTC) Received: from localhost ([127.0.0.1]:46453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZR7-0002KV-Ew for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:31:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNp-0007ua-DS for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNo-000412-43 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:45 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:38636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNn-0003zv-Mf for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:44 -0400 Received: by mail-pg1-x542.google.com with SMTP id v1so1596110pgi.5 for ; Wed, 20 Mar 2019 04:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zow+oGvpqEYFuGtHHvCnboKR4dsoTq+1kTv8H8eXYt8=; b=C1sobIZI+9r52NrsoA4LrvdT+DCkjmvj8sUQcohOjcgaOEUjTFNY8wJSSA6W3MQpkr sZjx8xsczxbq8xRoa1NQe2cAzeSjve2v1P76iMYPOo9FE9yaDRvTPH3qbc5pitkgxQhQ XfHRq4Cy5eUgmDtZWQtStswbr5/wnAIMwQpqlTvyY0YYmMf+KMajFVxtW6KHBVJa+/p2 mNxvKYvucv+L7KeQE6QxPHfSMYAM7cV7lxak4AcSmegfHOzumUImXrRMqoR4OkS/0mvi 4tNOS3erW3x6cy2D7MPc366ni+qAs4xw1svh/hRHk2Tx6Ou6PnPKwkgIKNbreoOj8ZV7 XSDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zow+oGvpqEYFuGtHHvCnboKR4dsoTq+1kTv8H8eXYt8=; b=qZbVGLQY5Ly1vbYObmZCP2+YyF0QEGxAdcO+0+KBJHACmLkd/DixO5SBXT3ITP5WMj SAj6hCtUlXiZAYSDl7Tb7C74XtzuZlVH5G1T6TA37vDp+gl0wzRMvCv3ARPQrRJnOy09 V9kYGyDYYvYyFT1Xshtn2NYVzTNzZghBOO5vZvYYn2k2GJEUHcKJXI+XoXDZi4um0C19 9FCT8lVrJyhgh9PPS7I1nO2BNzSp4iArizPXMBGX5lUoSvmzJbHDIIdHYDZAu078IepS QwSpRWmztUGKDQQYBHmnroLUtVg8TdjYuQ4qhY+Hrz/1a0hcds7pNcIbj8MO9pRkSrWd BPeA== X-Gm-Message-State: APjAAAUEifpfBLUi+1RjzUiO6tWiCYY2AWjW3OH4ajhrarXNnpX8DcHp bEnSIVyP1/TiLf5qjC/dN4xr2m+Y X-Google-Smtp-Source: APXvYqyQVaLq4fR8N1m5qDfYh5NTA7tA4xgC251pRAHd9e9zNEJoRXm9LdQ8zoKlBI1nQoJprF6TaA== X-Received: by 2002:a63:e303:: with SMTP id f3mr942451pgh.374.1553081262730; Wed, 20 Mar 2019 04:27:42 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id y34sm5347282pgl.35.2019.03.20.04.27.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:42 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:45 +0800 Message-Id: <20190320112646.3712-7-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v8 6/7] vhost-user-blk: Add support to reconnect backend 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie Yongji Signed-off-by: Ni Xun Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 159 ++++++++++++++++++++++++----- include/hw/virtio/vhost-user-blk.h | 3 + 2 files changed, 139 insertions(+), 23 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 6802c19d65..9cb61336a6 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -192,17 +192,27 @@ static void vhost_user_blk_set_status(VirtIODevice *vdev, uint8_t status) { VHostUserBlk *s = VHOST_USER_BLK(vdev); bool should_start = vdev->started; + int ret; if (!vdev->vm_running) { should_start = false; } + if (!s->connected) { + return; + } + if (s->dev.started == should_start) { return; } if (should_start) { - vhost_user_blk_start(vdev); + ret = vhost_user_blk_start(vdev); + if (ret < 0) { + error_report("vhost-user-blk: vhost start failed: %s", + strerror(-ret)); + qemu_chr_fe_disconnect(&s->chardev); + } } else { vhost_user_blk_stop(vdev); } @@ -238,12 +248,16 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev, static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) { VHostUserBlk *s = VHOST_USER_BLK(vdev); - int i; + int i, ret; if (!vdev->start_on_kick) { return; } + if (!s->connected) { + return; + } + if (s->dev.started) { return; } @@ -251,7 +265,13 @@ static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) /* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start * vhost here instead of waiting for .set_status(). */ - vhost_user_blk_start(vdev); + ret = vhost_user_blk_start(vdev); + if (ret < 0) { + error_report("vhost-user-blk: vhost start failed: %s", + strerror(-ret)); + qemu_chr_fe_disconnect(&s->chardev); + return; + } /* Kick right away to begin processing requests already in vring */ for (i = 0; i < s->dev.nvqs; i++) { @@ -271,11 +291,103 @@ static void vhost_user_blk_reset(VirtIODevice *vdev) vhost_dev_free_inflight(s->inflight); } +static int vhost_user_blk_connect(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserBlk *s = VHOST_USER_BLK(vdev); + int ret = 0; + + if (s->connected) { + return 0; + } + s->connected = true; + + s->dev.nvqs = s->num_queues; + s->dev.vqs = s->vqs; + s->dev.vq_index = 0; + s->dev.backend_features = 0; + + vhost_dev_set_config_notifier(&s->dev, &blk_ops); + + ret = vhost_dev_init(&s->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0); + if (ret < 0) { + error_report("vhost-user-blk: vhost initialization failed: %s", + strerror(-ret)); + return ret; + } + + /* restore vhost state */ + if (vdev->started) { + ret = vhost_user_blk_start(vdev); + if (ret < 0) { + error_report("vhost-user-blk: vhost start failed: %s", + strerror(-ret)); + return ret; + } + } + + return 0; +} + +static void vhost_user_blk_disconnect(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserBlk *s = VHOST_USER_BLK(vdev); + + if (!s->connected) { + return; + } + s->connected = false; + + if (s->dev.started) { + vhost_user_blk_stop(vdev); + } + + vhost_dev_cleanup(&s->dev); +} + +static gboolean vhost_user_blk_watch(GIOChannel *chan, GIOCondition cond, + void *opaque) +{ + DeviceState *dev = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserBlk *s = VHOST_USER_BLK(vdev); + + qemu_chr_fe_disconnect(&s->chardev); + + return true; +} + +static void vhost_user_blk_event(void *opaque, int event) +{ + DeviceState *dev = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserBlk *s = VHOST_USER_BLK(vdev); + + switch (event) { + case CHR_EVENT_OPENED: + if (vhost_user_blk_connect(dev) < 0) { + qemu_chr_fe_disconnect(&s->chardev); + return; + } + s->watch = qemu_chr_fe_add_watch(&s->chardev, G_IO_HUP, + vhost_user_blk_watch, dev); + break; + case CHR_EVENT_CLOSED: + vhost_user_blk_disconnect(dev); + if (s->watch) { + g_source_remove(s->watch); + s->watch = 0; + } + break; + } +} + static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBlk *s = VHOST_USER_BLK(vdev); - struct vhost_virtqueue *vqs = NULL; + Error *err = NULL; int i, ret; if (!s->chardev.chr) { @@ -306,27 +418,29 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp) } s->inflight = g_new0(struct vhost_inflight, 1); + s->vqs = g_new(struct vhost_virtqueue, s->num_queues); + s->watch = 0; + s->connected = false; - s->dev.nvqs = s->num_queues; - s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs); - s->dev.vq_index = 0; - s->dev.backend_features = 0; - vqs = s->dev.vqs; - - vhost_dev_set_config_notifier(&s->dev, &blk_ops); + qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_event, + NULL, (void *)dev, NULL, true); - ret = vhost_dev_init(&s->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0); - if (ret < 0) { - error_setg(errp, "vhost-user-blk: vhost initialization failed: %s", - strerror(-ret)); +reconnect: + if (qemu_chr_fe_wait_connected(&s->chardev, &err) < 0) { + error_report_err(err); goto virtio_err; } + /* check whether vhost_user_blk_connect() failed or not */ + if (!s->connected) { + goto reconnect; + } + ret = vhost_dev_get_config(&s->dev, (uint8_t *)&s->blkcfg, - sizeof(struct virtio_blk_config)); + sizeof(struct virtio_blk_config)); if (ret < 0) { - error_setg(errp, "vhost-user-blk: get block config failed"); - goto vhost_err; + error_report("vhost-user-blk: get block config failed"); + goto reconnect; } if (s->blkcfg.num_queues != s->num_queues) { @@ -335,10 +449,8 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp) return; -vhost_err: - vhost_dev_cleanup(&s->dev); virtio_err: - g_free(vqs); + g_free(s->vqs); g_free(s->inflight); virtio_cleanup(vdev); vhost_user_cleanup(&s->vhost_user); @@ -348,12 +460,13 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBlk *s = VHOST_USER_BLK(dev); - struct vhost_virtqueue *vqs = s->dev.vqs; virtio_set_status(vdev, 0); + qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, NULL, + NULL, NULL, NULL, false); vhost_dev_cleanup(&s->dev); vhost_dev_free_inflight(s->inflight); - g_free(vqs); + g_free(s->vqs); g_free(s->inflight); virtio_cleanup(vdev); vhost_user_cleanup(&s->vhost_user); diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h index 68634bee61..51457fb857 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -38,6 +38,9 @@ typedef struct VHostUserBlk { struct vhost_dev dev; struct vhost_inflight *inflight; VhostUserState vhost_user; + struct vhost_virtqueue *vqs; + guint watch; + bool connected; } VHostUserBlk; #endif From patchwork Wed Mar 20 11:26:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861433 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 DB0B515AC for ; Wed, 20 Mar 2019 11:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2A7229B54 for ; Wed, 20 Mar 2019 11:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A74E329B57; Wed, 20 Mar 2019 11:33:35 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51E4429B54 for ; Wed, 20 Mar 2019 11:33:35 +0000 (UTC) Received: from localhost ([127.0.0.1]:46473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZTS-0003pp-DE for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:33:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNr-0007wG-J7 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNq-00043t-Pp for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:47 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:45756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNq-000432-ES for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:46 -0400 Received: by mail-pf1-x443.google.com with SMTP id v21so1705475pfm.12 for ; Wed, 20 Mar 2019 04:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eKXI+nTrVO5bzrZScLYB5tSJp0wzkrrEgJ96mqBPxXE=; b=SdKhJqvLnTJsQ6j1j8H2XGsfp/Ug9E+Jr8HNW+pXvOm/BwYTZ1VFitZKAt0E+X8f6I BxCl33Scu/gDnklmLM+lPoth2L0CmjJtvHq2gS1SsDZQ7aLsxkdRs1PHIDT75ZuwVw87 koZkRSc7MOjmChevekDBrenefcsaUXc3+tylxORwFiiDtmShX+Hg/bNysQcqBLeFHJbu puA/9tTFACrOZtzB+a898W2qZWtwopURwdy7OOdT6U2WxhJQo2Cn+pZ1F5H+N6aQ7mNF fYTJfvZuJBrcIhzcG9rAHPcPCx04plFxGbBySEMNkIGSvij57HR85m4f1om1/ci27uVj eDSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eKXI+nTrVO5bzrZScLYB5tSJp0wzkrrEgJ96mqBPxXE=; b=Ef9v2W8hM4N5JR/4cHOcEfJ+Db3aQaVGDzdQi+3kJ13QNpHeqACHGNE+AvC1L8kqxL CrsTiBoaBByUwWpnfveB46co+9iUqaMryFHTQcdimjRO3FBKpNysGEFp9WFOJEYJPs+W m/0Pfwn74mi+mkKsrA6z0pGSyelf7ILMS9W5mxfHpiU7o3xbM/H5j5qKwjXNrO2V7VU3 GfujWQqhJpoJ+CP3eWCNXT3iaM75DxZ+gmUxP9vKS82NzyntZnwbFq6b8RpxLIC7a47b QAN7CW1cAYzNv7umRBhZF4tkYEc7X4or/Am0uAUwcpQF5ArkydgWuzP/95BB/IwDbOit G/3A== X-Gm-Message-State: APjAAAX+xPGsGkf1U1knRIQVsL1Ky46EHqnInLr9ID8G9Hcz69oywLy+ oQ+W71qZeUSEucxOifjuzVo= X-Google-Smtp-Source: APXvYqzW6vGflHQzr+nIBm4I25Y4zKmIjRX3nVAn5+CSWml7OgbXvlPhiFyKzR8aQx0z9tkE1F7rfA== X-Received: by 2002:a62:480d:: with SMTP id v13mr4270072pfa.125.1553081265716; Wed, 20 Mar 2019 04:27:45 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id k9sm4001872pfc.57.2019.03.20.04.27.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:45 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:46 +0800 Message-Id: <20190320112646.3712-8-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v8 7/7] contrib/vhost-user-blk: enable inflight I/O tracking 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index 43583f2659..86a3987744 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -398,7 +398,8 @@ vub_get_features(VuDev *dev) static uint64_t vub_get_protocol_features(VuDev *dev) { - return 1ull << VHOST_USER_PROTOCOL_F_CONFIG; + return 1ull << VHOST_USER_PROTOCOL_F_CONFIG | + 1ull << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD; } static int