From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79B5BA04FD; Wed, 22 Jun 2022 10:37:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A4784069C; Wed, 22 Jun 2022 10:37:52 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5C13040689 for ; Wed, 22 Jun 2022 10:37:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655887070; x=1687423070; h=from:to:cc:subject:date:message-id; bh=4oGz6pL28sjG81y25LSevwuIlrmYU2BYzSpG8eHrsq8=; b=FfJZhh5c/LKg13lvviimTetIbiyBq+SO0zosM0kaCk6uMY87HhxL3Y86 PX4w9HaX11TddROJBgHKRoKlRUQQXWDh7xoiOtOVPdKHOV2p8DEnb4VI1 +te9oLoqD54mBgEGaUSqnoUwqTXH6RDRdy/QmnDFUXxtU0AiXz0WkcWht QiFlTl99dFHokLHATbsZGLUCc9d7F0WIRZYKO9NiDWEqsHgSOAyrEiCgN NvQzxajjO+QCDQlTvAKLNTRk07PwD5nf3dx5yMhn2fmaA1TjdzlDZXO1f fqQxwSvQqBcoWSPY0S3E6bVgtLn5LpZZ6hMNCtWY+urY2/bjB8jf1DkVY w==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="260177248" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="260177248" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 01:37:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="644078042" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by fmsmga008.fm.intel.com with ESMTP; 22 Jun 2022 01:37:47 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, rosen.xu@intel.com, qimaix.xiao@intel.com Subject: [PATCH] vhost: fix virtio blk vDPA live migration IO drop Date: Wed, 22 Jun 2022 15:47:08 +0800 Message-Id: <1655884028-193120-1-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In the virtio blk vDPA live migration use case, before the live migration process, QEMU will set call fd to vDPA back-end. QEMU and vDPA back-end stand by until live migration starts. During live migration process, QEMU sets kick fd and a new call fd. However, after the kick fd is set to the vDPA back-end, the vDPA back-end configures device and data path starts. The new call fd will cause some kind of "re-configuration", this kind of "re-configuration" cause IO drop. After this patch, vDPA back-end configures device after kick fd and call fd are well set and make sure no IO drops. This patch only impact virtio blk vDPA device and does not impact net device. Fixes: 7015b6577178 ("vdpa/ifc: add block device SW live-migration") Signed-off-by: Andy Pei --- lib/vhost/vhost_user.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 2b9a3b6..cc03f67 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2946,6 +2946,7 @@ static int is_vring_iotlb(struct virtio_net *dev, int ret; int unlock_required = 0; bool handled; + uint32_t vdpa_type = 0; uint32_t request; uint32_t i; @@ -3152,6 +3153,20 @@ static int is_vring_iotlb(struct virtio_net *dev, if (!vdpa_dev) goto out; + if (vdpa_dev->ops->get_dev_type) { + ret = vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type); + if (ret) { + VHOST_LOG_CONFIG(ERR, "failed to get vdpa dev type.\n"); + ret = -1; + goto out; + } + } else { + vdpa_type = RTE_VHOST_VDPA_DEVICE_TYPE_NET; + } + if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK + && request != VHOST_USER_SET_VRING_CALL) + goto out; + if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { if (vdpa_dev->ops->dev_conf(dev->vid)) VHOST_LOG_CONFIG(ERR, "(%s) failed to configure vDPA device\n", -- 1.8.3.1