From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id EFE251B4FC for ; Fri, 23 Nov 2018 11:29:44 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6397783F42; Fri, 23 Nov 2018 10:29:44 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id F144A18A51; Fri, 23 Nov 2018 10:29:42 +0000 (UTC) From: Kevin Traynor To: Tiwei Bie Cc: Maxime Coquelin , dpdk stable Date: Fri, 23 Nov 2018 10:26:37 +0000 Message-Id: <20181123102713.17309-33-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 23 Nov 2018 10:29:44 +0000 (UTC) Subject: [dpdk-stable] patch 'net/virtio-user: do not reset owner when driver resets' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 10:29:45 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/29/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From e08b77f3ffdbcfad32bbbe69c6f2c998ee700c69 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Mon, 29 Oct 2018 13:28:05 +0800 Subject: [PATCH] net/virtio-user: do not reset owner when driver resets [ upstream commit 74dc6746a0f195907ec487df7de18a856108482f ] When driver resets the device, virtio-user just needs to send GET_VRING_BASE messages to stop the vhost backend, and that's what QEMU does. With this change, we won't need to set owner when starting virtio-user device anymore. This will help us to get rid of below error message on startup: vhost_kernel_ioctl(): VHOST_SET_OWNER failed: Device or resource busy Fixes: bce7e9050f9b ("net/virtio-user: fix start with kernel vhost") Fixes: 0d6a8752ac9d ("net/virtio-user: fix crash as features change") Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- .../net/virtio/virtio_user/virtio_user_dev.c | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index bef253488..85c35246b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -135,7 +135,4 @@ virtio_user_start_device(struct virtio_user_dev *dev) goto error; - /* Do not check return as already done in init, or reset in stop */ - dev->ops->send_request(dev, VHOST_USER_SET_OWNER, NULL); - /* Step 0: tell vhost to create queues */ if (virtio_user_queue_setup(dev, virtio_user_create_queue) < 0) @@ -182,5 +179,7 @@ error: int virtio_user_stop_device(struct virtio_user_dev *dev) { + struct vhost_vring_state state; uint32_t i; + int error = 0; pthread_mutex_lock(&dev->mutex); @@ -191,14 +190,21 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) dev->ops->enable_qp(dev, i, 0); - if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) { - PMD_DRV_LOG(INFO, "Failed to reset the device\n"); - pthread_mutex_unlock(&dev->mutex); - return -1; + /* Stop the backend. */ + for (i = 0; i < dev->max_queue_pairs * 2; ++i) { + state.index = i; + if (dev->ops->send_request(dev, VHOST_USER_GET_VRING_BASE, + &state) < 0) { + PMD_DRV_LOG(ERR, "get_vring_base failed, index=%u\n", + i); + error = -1; + goto out; + } } + dev->started = false; out: pthread_mutex_unlock(&dev->mutex); - return 0; + return error; } -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-23 10:22:55.113234621 +0000 +++ 0033-net-virtio-user-do-not-reset-owner-when-driver-reset.patch 2018-11-23 10:22:54.000000000 +0000 @@ -1,8 +1,10 @@ -From 74dc6746a0f195907ec487df7de18a856108482f Mon Sep 17 00:00:00 2001 +From e08b77f3ffdbcfad32bbbe69c6f2c998ee700c69 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Mon, 29 Oct 2018 13:28:05 +0800 Subject: [PATCH] net/virtio-user: do not reset owner when driver resets +[ upstream commit 74dc6746a0f195907ec487df7de18a856108482f ] + When driver resets the device, virtio-user just needs to send GET_VRING_BASE messages to stop the vhost backend, and that's what QEMU does. With this change, we won't need to set owner @@ -13,7 +15,6 @@ Fixes: bce7e9050f9b ("net/virtio-user: fix start with kernel vhost") Fixes: 0d6a8752ac9d ("net/virtio-user: fix crash as features change") -Cc: stable@dpdk.org Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin @@ -22,7 +23,7 @@ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c -index 0e3563051..0eb0f244b 100644 +index bef253488..85c35246b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -135,7 +135,4 @@ virtio_user_start_device(struct virtio_user_dev *dev)