DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vdpa/mlx5: fix event channel setup
@ 2020-08-20 14:32 Xueming Li
  2020-08-25  9:17 ` [dpdk-dev] [v1] " Xueming Li
  0 siblings, 1 reply; 7+ messages in thread
From: Xueming Li @ 2020-08-20 14:32 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Asaf Penso, Xueming Li

From: Xueming Li <xuemingl@mellanox.com>

During vdap device setup, if some error happens, event channel release
stuck at polling event channel.

Event channel fd is set to nonblocking in cqe setup, so if any error
happens before this function and after event channel created, the
pooling before releasing resources will stuck.

This patch moves event channel to non-blocking mode right after
creation.

Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
Cc: matan@nvidia.com

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 5a2d4fb1ec..bda547ffe0 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -51,6 +51,8 @@ mlx5_vdpa_event_qp_global_release(struct mlx5_vdpa_priv *priv)
 static int
 mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 {
+	int flags, ret;
+
 	if (priv->eventc)
 		return 0;
 	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) {
@@ -66,6 +68,12 @@ mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 			rte_errno);
 		goto error;
 	}
+	flags = fcntl(priv->eventc->fd, F_GETFL);
+	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
+	if (ret) {
+		DRV_LOG(ERR, "Failed to change event channel FD.");
+		goto error;
+	}
 	priv->uar = mlx5_glue->devx_alloc_uar(priv->ctx, 0);
 	if (!priv->uar) {
 		rte_errno = errno;
@@ -376,7 +384,6 @@ mlx5_vdpa_interrupt_handler(void *cb_arg)
 int
 mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 {
-	int flags;
 	int ret;
 
 	if (!priv->eventc)
@@ -393,12 +400,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			return -1;
 		}
 	}
-	flags = fcntl(priv->eventc->fd, F_GETFL);
-	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
-	if (ret) {
-		DRV_LOG(ERR, "Failed to change event channel FD.");
-		goto error;
-	}
 	priv->intr_handle.fd = priv->eventc->fd;
 	priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
 	if (rte_intr_callback_register(&priv->intr_handle,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
  2020-08-20 14:32 [dpdk-dev] [PATCH] vdpa/mlx5: fix event channel setup Xueming Li
@ 2020-08-25  9:17 ` Xueming Li
  2020-08-30  8:17   ` Matan Azrad
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xueming Li @ 2020-08-25  9:17 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Asaf Penso

During vdap device setup, if some error happens, event channel release
stuck at polling event channel.

Event channel fd is set to nonblocking in cqe setup, so if any error
happens before this function and after event channel created, the
pooling before releasing resources will stuck.

This patch moves event channel to non-blocking mode right after
creation.

Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
Cc: matan@nvidia.com

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 5a2d4fb1ec..bda547ffe0 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -51,6 +51,8 @@ mlx5_vdpa_event_qp_global_release(struct mlx5_vdpa_priv *priv)
 static int
 mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 {
+	int flags, ret;
+
 	if (priv->eventc)
 		return 0;
 	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) {
@@ -66,6 +68,12 @@ mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 			rte_errno);
 		goto error;
 	}
+	flags = fcntl(priv->eventc->fd, F_GETFL);
+	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
+	if (ret) {
+		DRV_LOG(ERR, "Failed to change event channel FD.");
+		goto error;
+	}
 	priv->uar = mlx5_glue->devx_alloc_uar(priv->ctx, 0);
 	if (!priv->uar) {
 		rte_errno = errno;
@@ -376,7 +384,6 @@ mlx5_vdpa_interrupt_handler(void *cb_arg)
 int
 mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 {
-	int flags;
 	int ret;
 
 	if (!priv->eventc)
@@ -393,12 +400,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			return -1;
 		}
 	}
-	flags = fcntl(priv->eventc->fd, F_GETFL);
-	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
-	if (ret) {
-		DRV_LOG(ERR, "Failed to change event channel FD.");
-		goto error;
-	}
 	priv->intr_handle.fd = priv->eventc->fd;
 	priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
 	if (rte_intr_callback_register(&priv->intr_handle,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
  2020-08-25  9:17 ` [dpdk-dev] [v1] " Xueming Li
@ 2020-08-30  8:17   ` Matan Azrad
  2020-09-18  9:41   ` Maxime Coquelin
  2020-09-18 12:28   ` Maxime Coquelin
  2 siblings, 0 replies; 7+ messages in thread
From: Matan Azrad @ 2020-08-30  8:17 UTC (permalink / raw)
  To: Xueming(Steven) Li, Slava Ovsiienko; +Cc: dev, Asaf Penso



From: Xueming Li <xuemingl@nvidia.com>
> During vdap device setup, if some error happens, event channel release
> stuck at polling event channel.
> 
> Event channel fd is set to nonblocking in cqe setup, so if any error happens
> before this function and after event channel created, the pooling before
> releasing resources will stuck.
> 
> This patch moves event channel to non-blocking mode right after creation.
> 
> Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
> Cc: matan@nvidia.com
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
  2020-08-25  9:17 ` [dpdk-dev] [v1] " Xueming Li
  2020-08-30  8:17   ` Matan Azrad
@ 2020-09-18  9:41   ` Maxime Coquelin
  2020-09-18 11:14     ` Xueming(Steven) Li
  2020-09-18 12:28   ` Maxime Coquelin
  2 siblings, 1 reply; 7+ messages in thread
From: Maxime Coquelin @ 2020-09-18  9:41 UTC (permalink / raw)
  To: Xueming Li, Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Asaf Penso



On 8/25/20 11:17 AM, Xueming Li wrote:
> During vdap device setup, if some error happens, event channel release

s/vdap/vDPA/

> stuck at polling event channel.
> 
> Event channel fd is set to nonblocking in cqe setup, so if any error

non-blocking

> happens before this function and after event channel created, the
> pooling before releasing resources will stuck.
> 
> This patch moves event channel to non-blocking mode right after
> creation.
> 
> Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
> Cc: matan@nvidia.com
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> index 5a2d4fb1ec..bda547ffe0 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> @@ -51,6 +51,8 @@ mlx5_vdpa_event_qp_global_release(struct mlx5_vdpa_priv *priv)
>  static int
>  mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
>  {
> +	int flags, ret;
> +
>  	if (priv->eventc)
>  		return 0;
>  	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) {
> @@ -66,6 +68,12 @@ mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
>  			rte_errno);
>  		goto error;
>  	}
> +	flags = fcntl(priv->eventc->fd, F_GETFL);
> +	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
> +	if (ret) {
> +		DRV_LOG(ERR, "Failed to change event channel FD.");
> +		goto error;
> +	}
>  	priv->uar = mlx5_glue->devx_alloc_uar(priv->ctx, 0);
>  	if (!priv->uar) {
>  		rte_errno = errno;
> @@ -376,7 +384,6 @@ mlx5_vdpa_interrupt_handler(void *cb_arg)
>  int
>  mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
>  {
> -	int flags;
>  	int ret;
>  
>  	if (!priv->eventc)
> @@ -393,12 +400,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
>  			return -1;
>  		}
>  	}
> -	flags = fcntl(priv->eventc->fd, F_GETFL);
> -	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
> -	if (ret) {
> -		DRV_LOG(ERR, "Failed to change event channel FD.");
> -		goto error;
> -	}
>  	priv->intr_handle.fd = priv->eventc->fd;
>  	priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
>  	if (rte_intr_callback_register(&priv->intr_handle,
> 

Looks good to me, I'll fix the typos while applying.

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
  2020-09-18  9:41   ` Maxime Coquelin
@ 2020-09-18 11:14     ` Xueming(Steven) Li
  0 siblings, 0 replies; 7+ messages in thread
From: Xueming(Steven) Li @ 2020-09-18 11:14 UTC (permalink / raw)
  To: Maxime Coquelin, Matan Azrad, Slava Ovsiienko; +Cc: dev, Asaf Penso



> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Friday, September 18, 2020 5:42 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Asaf Penso <asafp@nvidia.com>
> Subject: Re: [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
> 
> 
> 
> On 8/25/20 11:17 AM, Xueming Li wrote:
> > During vdap device setup, if some error happens, event channel release
> 
> s/vdap/vDPA/
> 
> > stuck at polling event channel.
> >
> > Event channel fd is set to nonblocking in cqe setup, so if any error
> 
> non-blocking
> 
> > happens before this function and after event channel created, the
> > pooling before releasing resources will stuck.
> >
> > This patch moves event channel to non-blocking mode right after
> > creation.
> >
> > Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
> > Cc: matan@nvidia.com
> >
> > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> > ---
> >  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> > b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> > index 5a2d4fb1ec..bda547ffe0 100644
> > --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> > +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> > @@ -51,6 +51,8 @@ mlx5_vdpa_event_qp_global_release(struct
> > mlx5_vdpa_priv *priv)  static int
> > mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)  {
> > +	int flags, ret;
> > +
> >  	if (priv->eventc)
> >  		return 0;
> >  	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) { @@ -66,6
> > +68,12 @@ mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv
> *priv)
> >  			rte_errno);
> >  		goto error;
> >  	}
> > +	flags = fcntl(priv->eventc->fd, F_GETFL);
> > +	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
> > +	if (ret) {
> > +		DRV_LOG(ERR, "Failed to change event channel FD.");
> > +		goto error;
> > +	}
> >  	priv->uar = mlx5_glue->devx_alloc_uar(priv->ctx, 0);
> >  	if (!priv->uar) {
> >  		rte_errno = errno;
> > @@ -376,7 +384,6 @@ mlx5_vdpa_interrupt_handler(void *cb_arg)  int
> > mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)  {
> > -	int flags;
> >  	int ret;
> >
> >  	if (!priv->eventc)
> > @@ -393,12 +400,6 @@ mlx5_vdpa_cqe_event_setup(struct
> mlx5_vdpa_priv *priv)
> >  			return -1;
> >  		}
> >  	}
> > -	flags = fcntl(priv->eventc->fd, F_GETFL);
> > -	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
> > -	if (ret) {
> > -		DRV_LOG(ERR, "Failed to change event channel FD.");
> > -		goto error;
> > -	}
> >  	priv->intr_handle.fd = priv->eventc->fd;
> >  	priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
> >  	if (rte_intr_callback_register(&priv->intr_handle,
> >
> 
> Looks good to me, I'll fix the typos while applying.
> 
Appreciate!

> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [v1] vdpa/mlx5: fix event channel setup
  2020-08-25  9:17 ` [dpdk-dev] [v1] " Xueming Li
  2020-08-30  8:17   ` Matan Azrad
  2020-09-18  9:41   ` Maxime Coquelin
@ 2020-09-18 12:28   ` Maxime Coquelin
  2 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2020-09-18 12:28 UTC (permalink / raw)
  To: Xueming Li, Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Asaf Penso



On 8/25/20 11:17 AM, Xueming Li wrote:
> During vdap device setup, if some error happens, event channel release
> stuck at polling event channel.
> 
> Event channel fd is set to nonblocking in cqe setup, so if any error
> happens before this function and after event channel created, the
> pooling before releasing resources will stuck.
> 
> This patch moves event channel to non-blocking mode right after
> creation.
> 
> Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
> Cc: matan@nvidia.com
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH] vdpa/mlx5: fix event channel setup
@ 2020-08-20 13:15 Xueming Li
  0 siblings, 0 replies; 7+ messages in thread
From: Xueming Li @ 2020-08-20 13:15 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Asaf Penso, Xueming Li

During vdap device setup, if some error happens, event channel release
stuck at polling event channel.

Event channel fd is set to nonblocking in cqe setup, so if any error
happens before this function and after event channel created, the
pooling before releasing resources will stuck.

This patch moves event channel to non-blocking mode right after
creation.

Fixes: 8395927cdf ("vdpa/mlx5: prepare HW queues")
Cc: matan@nvidia.com

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 5a2d4fb1ec..bda547ffe0 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -51,6 +51,8 @@ mlx5_vdpa_event_qp_global_release(struct mlx5_vdpa_priv *priv)
 static int
 mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 {
+	int flags, ret;
+
 	if (priv->eventc)
 		return 0;
 	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) {
@@ -66,6 +68,12 @@ mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 			rte_errno);
 		goto error;
 	}
+	flags = fcntl(priv->eventc->fd, F_GETFL);
+	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
+	if (ret) {
+		DRV_LOG(ERR, "Failed to change event channel FD.");
+		goto error;
+	}
 	priv->uar = mlx5_glue->devx_alloc_uar(priv->ctx, 0);
 	if (!priv->uar) {
 		rte_errno = errno;
@@ -376,7 +384,6 @@ mlx5_vdpa_interrupt_handler(void *cb_arg)
 int
 mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 {
-	int flags;
 	int ret;
 
 	if (!priv->eventc)
@@ -393,12 +400,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
 			return -1;
 		}
 	}
-	flags = fcntl(priv->eventc->fd, F_GETFL);
-	ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK);
-	if (ret) {
-		DRV_LOG(ERR, "Failed to change event channel FD.");
-		goto error;
-	}
 	priv->intr_handle.fd = priv->eventc->fd;
 	priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
 	if (rte_intr_callback_register(&priv->intr_handle,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-18 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 14:32 [dpdk-dev] [PATCH] vdpa/mlx5: fix event channel setup Xueming Li
2020-08-25  9:17 ` [dpdk-dev] [v1] " Xueming Li
2020-08-30  8:17   ` Matan Azrad
2020-09-18  9:41   ` Maxime Coquelin
2020-09-18 11:14     ` Xueming(Steven) Li
2020-09-18 12:28   ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2020-08-20 13:15 [dpdk-dev] [PATCH] " Xueming Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).