[v2] vdpa/mlx5: fix event queue number query

Message ID 1595928159-10346-1-git-send-email-xuemingl@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series [v2] vdpa/mlx5: fix event queue number query |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Xueming Li July 28, 2020, 9:22 a.m. UTC
  With latest rte api, vdpa example failed on vq setup, the api to get
event queue of specified core failed.

After
commit 67ae5936c4fc36 ("eal: fix lcore accessors for non-EAL threads"),
code of "vhost-event" thread to get current cpu id returns -1.

On the other hand, internal api devx_query_eqn expects index of event
queue vectors, no need to use cpu id. As the doorbell handling thread is
per device, it's sufficient to use default event queue.

This patch uses the default id(0) as event queue index.

Fixes: 8395927cdfaf ("vdpa/mlx5: prepare HW queues")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

David Marchand July 28, 2020, 12:05 p.m. UTC | #1
On Tue, Jul 28, 2020 at 11:23 AM Xueming Li <xuemingl@mellanox.com> wrote:
>
> With latest rte api, vdpa example failed on vq setup, the api to get
> event queue of specified core failed.
>
> After
> commit 67ae5936c4fc36 ("eal: fix lcore accessors for non-EAL threads"),
> code of "vhost-event" thread to get current cpu id returns -1.
>

This is how you figured this problem, but the first part of the
commitlog gives the impression there is a regression in the EAL.
I would prefer it is removed (maybe simply when applying?).


> On the other hand, internal api devx_query_eqn expects index of event
> queue vectors, no need to use cpu id. As the doorbell handling thread is
> per device, it's sufficient to use default event queue.
>
> This patch uses the default id(0) as event queue index.
>
> Fixes: 8395927cdfaf ("vdpa/mlx5: prepare HW queues")
>
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>


Thanks.
  
Xueming Li July 28, 2020, 12:26 p.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, July 28, 2020 8:05 PM
> To: Xueming(Steven) Li <xuemingl@mellanox.com>
> Cc: dev <dev@dpdk.org>; Asaf@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>
> Subject: Re: [dpdk-dev] [v2] vdpa/mlx5: fix event queue number query
> 
> On Tue, Jul 28, 2020 at 11:23 AM Xueming Li <xuemingl@mellanox.com> wrote:
> >
> > With latest rte api, vdpa example failed on vq setup, the api to get
> > event queue of specified core failed.
> >
> > After
> > commit 67ae5936c4fc36 ("eal: fix lcore accessors for non-EAL
> > threads"), code of "vhost-event" thread to get current cpu id returns -1.
> >
> 
> This is how you figured this problem, but the first part of the commitlog gives
> the impression there is a regression in the EAL.
> I would prefer it is removed (maybe simply when applying?).

NP, sorry for the confusing.

> 
> 
> > On the other hand, internal api devx_query_eqn expects index of event
> > queue vectors, no need to use cpu id. As the doorbell handling thread
> > is per device, it's sufficient to use default event queue.
> >
> > This patch uses the default id(0) as event queue index.
> >
> > Fixes: 8395927cdfaf ("vdpa/mlx5: prepare HW queues")
> >
> > Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> > Acked-by: Matan Azrad <matan@mellanox.com>
> 
> 
> Thanks.
> 
> --
> David Marchand
  

Patch

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 13ad43611e..159831920f 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -51,12 +51,9 @@  mlx5_vdpa_event_qp_global_release(struct mlx5_vdpa_priv *priv)
 static int
 mlx5_vdpa_event_qp_global_prepare(struct mlx5_vdpa_priv *priv)
 {
-	uint32_t lcore;
-
 	if (priv->eventc)
 		return 0;
-	lcore = (uint32_t)rte_lcore_to_cpu_id(-1);
-	if (mlx5_glue->devx_query_eqn(priv->ctx, lcore, &priv->eqn)) {
+	if (mlx5_glue->devx_query_eqn(priv->ctx, 0, &priv->eqn)) {
 		rte_errno = errno;
 		DRV_LOG(ERR, "Failed to query EQ number %d.", rte_errno);
 		return -1;