[PATCH v7 18/18] vhost: make sure each queue callfd is configured

Xia, Chenbo chenbo.xia at intel.com
Fri May 13 05:10:40 CEST 2022


> -----Original Message-----
> From: Pei, Andy <andy.pei at intel.com>
> Sent: Wednesday, April 27, 2022 4:30 PM
> To: dev at dpdk.org
> Cc: Xia, Chenbo <chenbo.xia at intel.com>; maxime.coquelin at redhat.com; Cao,
> Gang <gang.cao at intel.com>; Liu, Changpeng <changpeng.liu at intel.com>
> Subject: [PATCH v7 18/18] 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.

I don't understand the problem. If callfd reset, we should re-configure
in the set_vring_state callback, and issue can be handled there.

Thanks,
Chenbo

> 
> Signed-off-by: Andy Pei <andy.pei at intel.com>
> ---
>  lib/vhost/vhost_user.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index e925428..82122b6 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -3230,12 +3230,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, "(%s) failed to configure vDPA
> device\n",
>  					dev->ifname);
>  		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:
> --
> 1.8.3.1



More information about the dev mailing list