From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <yahui.cao@intel.com> Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 94D092B9A for <stable@dpdk.org>; Fri, 7 Dec 2018 08:00:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2018 23:00:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,324,1539673200"; d="scan'208";a="98800172" Received: from jim-aorus.sh.intel.com ([10.67.102.207]) by orsmga006.jf.intel.com with ESMTP; 06 Dec 2018 23:00:15 -0800 From: Yahui Cao <yahui.cao@intel.com> To: tiwei.bie@intel.com, Yuanhan Liu <yliu@fridaylinux.org>, Maxime Coquelin <maxime.coquelin@redhat.com> Cc: stable@dpdk.org, zhihong.wang@intel.com Date: Fri, 7 Dec 2018 14:58:50 +0800 Message-Id: <20181207065850.14518-1-yahui.cao@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [17.11] net/virtio-user: do not reset owner when driver resets X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches <stable.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/stable>, <mailto:stable-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/stable/> List-Post: <mailto:stable@dpdk.org> List-Help: <mailto:stable-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/stable>, <mailto:stable-request@dpdk.org?subject=subscribe> X-List-Received-Date: Fri, 07 Dec 2018 07:00:18 -0000 [ backported from 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 <tiwei.bie@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: Yahui Cao <yahui.cao@intel.com> --- .../net/virtio/virtio_user/virtio_user_dev.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 7ce512c76..b13e77f5f 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -166,17 +166,27 @@ virtio_user_start_device(struct virtio_user_dev *dev) int virtio_user_stop_device(struct virtio_user_dev *dev) { + struct vhost_vring_state state; uint32_t i; + int error = 0; for (i = 0; i < dev->max_queue_pairs; ++i) 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"); - 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; + } } - return 0; +out: + return error; } static inline void -- 2.17.1