[v2,1/5] vhost: skip access lock when vDPA is configured

Message ID 1593092298-52257-2-git-send-email-matan@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: improve ready state |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad June 25, 2020, 1:38 p.m. UTC
  No need to take access lock in the vhost-user message handler when
vDPA driver controls all the data-path of the vhost device.

It allows the vDPA set_vring_state operation callback to configure
guest notifications.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Chenbo Xia June 28, 2020, 3:06 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Thursday, June 25, 2020 9:38 PM
> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: [dpdk-dev] [PATCH v2 1/5] vhost: skip access lock when vDPA is
> configured
> 
> No need to take access lock in the vhost-user message handler when vDPA
> driver controls all the data-path of the vhost device.
> 
> It allows the vDPA set_vring_state operation callback to configure guest
> notifications.
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost_user.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index
> 4e1af91..8d8050b 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2690,8 +2690,10 @@ typedef int (*vhost_message_handler_t)(struct
> virtio_net **pdev,
>  	case VHOST_USER_SEND_RARP:
>  	case VHOST_USER_NET_SET_MTU:
>  	case VHOST_USER_SET_SLAVE_REQ_FD:
> -		vhost_user_lock_all_queue_pairs(dev);
> -		unlock_required = 1;
> +		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
> +			vhost_user_lock_all_queue_pairs(dev);
> +			unlock_required = 1;
> +		}
>  		break;
>  	default:
>  		break;
> --
> 1.8.3.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  

Patch

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 4e1af91..8d8050b 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2690,8 +2690,10 @@  typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,
 	case VHOST_USER_SEND_RARP:
 	case VHOST_USER_NET_SET_MTU:
 	case VHOST_USER_SET_SLAVE_REQ_FD:
-		vhost_user_lock_all_queue_pairs(dev);
-		unlock_required = 1;
+		if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
+			vhost_user_lock_all_queue_pairs(dev);
+			unlock_required = 1;
+		}
 		break;
 	default:
 		break;