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 4E9CEA0093; Tue, 23 Aug 2022 07:25:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE31942B70; Tue, 23 Aug 2022 07:25:04 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 724BA42B6F for ; Tue, 23 Aug 2022 07:25:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661232303; x=1692768303; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=58gDnf8ey0Q8kguTYs8CrVnN3GCNq7cMGJ9BV4Hrs1w=; b=nTHoRhfYGV/TyRnH0csKjN+sSxI/R/M4pu5bwVKYBjM0sQbcGe//TQDx cMMoYSCf7ioY4m8Sg92nHhQpcW+c2SxDIlfjiirZi4FkdSA1bjEHCC0wb tN/ho+1DzoprJA1o58gsuw+1I/mmRxGKLAkzI1iTkEaWxHH5oVb32eDWY oiBSxMlZ60t/HyPvUjACw0yR3r+yArLuoUB2O/WAiv9LQ8p9EatnUapjF UQ/QJnxRHy0vyMnIyXO24GwSs1+C41F8wPF1QoohQTawXrXGcjYcUpqi+ EFI6cSuwAmLb4GIQqVtEBPD9t0fxqDmmk+F12WcgbUxnAyx0LucxMSCH0 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="355325335" X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="355325335" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2022 22:25:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="669864808" Received: from dpdk-dipei.sh.intel.com ([10.67.110.251]) by fmsmga008.fm.intel.com with ESMTP; 22 Aug 2022 22:25:01 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, rosen.xu@intel.com, wei.huang@intel.com, gang.cao@intel.com, maxime.coquelin@redhat.com Subject: [PATCH 8/8] vhost: vDPA BLK devices configure device when all queue callfds are set Date: Tue, 23 Aug 2022 12:35:05 +0800 Message-Id: <1661229305-240952-9-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1661229305-240952-1-git-send-email-andy.pei@intel.com> References: <1661229305-240952-1-git-send-email-andy.pei@intel.com> 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. Signed-off-by: Andy Pei --- lib/vhost/vhost_user.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index b65fba3..568030a 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2994,6 +2994,7 @@ static int is_vring_iotlb(struct virtio_net *dev, uint32_t vdpa_type = 0; uint32_t request; uint32_t i; + uint16_t blk_call_fd; dev = get_device(vid); if (dev == NULL) @@ -3227,9 +3228,15 @@ static int is_vring_iotlb(struct virtio_net *dev, if (!vdpa_dev) goto out; - if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK - && request != VHOST_USER_SET_VRING_CALL) - goto out; + if (vdpa_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) { + if (request == VHOST_USER_SET_VRING_CALL) { + blk_call_fd = ctx.msg.payload.u64 & VHOST_USER_VRING_IDX_MASK; + if (blk_call_fd != dev->nr_vring - 1) + goto out; + } else { + goto out; + } + } if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { if (vdpa_dev->ops->dev_conf(dev->vid)) -- 1.8.3.1