[v2,15/15] vhost: make sure each queue callfd is configured

Message ID 1643103437-118618-16-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series add virtio_blk device support to vdpa/ifc |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/github-robot: build fail github build: failed
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-aarch64-compile-testing fail Testing issues
ci/iol-abi-testing warning Testing issues

Commit Message

Pei, Andy Jan. 25, 2022, 9:37 a.m. UTC
  During the vhost data path building process, qemu will create
a call fd at first, and create another call fd in the end.
The final call fd will be used to relay notify.
In the original code, after kick fd is set, dev_conf will
set the first call fd. Even though the actual call fd will set,
the data path will not work correctly.

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 lib/vhost/vhost_user.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Comments

Chenbo Xia Jan. 27, 2022, 7:13 a.m. UTC | #1
Hi Andy,

> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Tuesday, January 25, 2022 5:37 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao, Gang
> <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> Subject: [PATCH v2 15/15] vhost: make sure each queue callfd is configured
> 
> During the vhost data path building process, qemu will create
> a call fd at first, and create another call fd in the end.
> The final call fd will be used to relay notify.
> In the original code, after kick fd is set, dev_conf will
> set the first call fd. Even though the actual call fd will set,
> the data path will not work correctly.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  lib/vhost/vhost_user.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 1.8.3.1

Please fix all reported error on patchwork first.

http://patchwork.dpdk.org/project/dpdk/patch/1643103437-118618-16-git-send-email-andy.pei@intel.com/

Thanks,
Chenbo
  
Pei, Andy Jan. 29, 2022, 3:11 a.m. UTC | #2
Hi Chenbo,

Thanks for your reply.
I will send out a V3 patch set to address that.


-----Original Message-----
From: Xia, Chenbo <chenbo.xia@intel.com> 
Sent: Thursday, January 27, 2022 3:13 PM
To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
Subject: RE: [PATCH v2 15/15] vhost: make sure each queue callfd is configured

Hi Andy,

> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Tuesday, January 25, 2022 5:37 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; 
> Cao, Gang <gang.cao@intel.com>; Liu, Changpeng 
> <changpeng.liu@intel.com>
> Subject: [PATCH v2 15/15] vhost: make sure each queue callfd is 
> configured
> 
> During the vhost data path building process, qemu will create a call 
> fd at first, and create another call fd in the end.
> The final call fd will be used to relay notify.
> In the original code, after kick fd is set, dev_conf will set the 
> first call fd. Even though the actual call fd will set, the data path 
> will not work correctly.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  lib/vhost/vhost_user.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 1.8.3.1

Please fix all reported error on patchwork first.

http://patchwork.dpdk.org/project/dpdk/patch/1643103437-118618-16-git-send-email-andy.pei@intel.com/

Thanks,
Chenbo
  

Patch

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 5eb1dd6..b25b25f 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -3137,12 +3137,26 @@  typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,
 	if (!vdpa_dev)
 		goto out;
 
+	if (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,
 					 "Failed to configure vDPA device\n");
 		else
 			dev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;
+	} else {
+		/* when VIRTIO_DEV_VDPA_CONFIGURED already configured
+		 * close the device and config the device again,
+		 * make sure the call fd of each queue is configured correctly.
+		 */
+		if (vdpa_dev->ops->dev_close(dev->vid))
+			VHOST_LOG_CONFIG(ERR,
+					 "Failed to close vDPA device\n");
+		if (vdpa_dev->ops->dev_conf(dev->vid))
+			VHOST_LOG_CONFIG(ERR,
+					 "Failed to re-config vDPA device\n");
 	}
 
 out: