DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: Suanming Mou <suanmingm@mellanox.com>,
	Matan Azrad <matan@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Bill Zhou <dongz@mellanox.com>,
	Wisam Monther <wisamm@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix Verbs counter pool allocation
Date: Sun, 17 May 2020 08:34:14 +0000	[thread overview]
Message-ID: <AM0PR05MB6707D717C6B4E464B17D8024C2BB0@AM0PR05MB6707.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1589503695-120616-1-git-send-email-suanmingm@mellanox.com>

Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@mellanox.com>
> Sent: Friday, May 15, 2020 3:48 AM
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>; Bill Zhou
> <dongz@mellanox.com>; Wisam Monther <wisamm@mellanox.com>
> Subject: [PATCH] net/mlx5: fix Verbs counter pool allocation
> 
> When create the Verbs flows with counter, randomly SEGSEV will also
> comes. The reason is that the counter pool memory is not allocated
> sufficiently and initialized correctly in Verbs case.
> 
> As the mlx5_flow_counter array member is moved out of the counter pool
> struct, the counter pool memory layout currently contain implicitly
> with mlx5_flow_counter, mlx5_age_param(if the pool is an age pool),
> mlx5_flow_counter_ext(if the pool is a none batch pool). When allocate
> the pool memory, the pool size should be calculated based on the pool
> type accordingly.
> 
> Currently, for Verbs counter pool, both mlx5_flow_counter and
> mlx5_flow_counter_ext need to be taken into account in the pool size.
> And the pool type should also be initialized as CNT_POOL_TYPE_EXT.
> 
> This patch add the missing size and type for the Verbs counter pool.
> 
> Fixes: 8d93c830e450 ("net/mlx5: modify ext-counter memory allocation")
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 01eec31..c266e56 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -201,11 +201,12 @@
>  			cont->n += MLX5_CNT_CONTAINER_RESIZE;
>  		}
>  		/* Allocate memory for new pool*/
> -		size = sizeof(*pool) + sizeof(*cnt_ext) *
> +		size = sizeof(*pool) + (sizeof(*cnt_ext) + sizeof(*cnt)) *
>  		       MLX5_COUNTERS_PER_POOL;
>  		pool = rte_calloc(__func__, 1, size, 0);
>  		if (!pool)
>  			return 0;
> +		pool->type |= CNT_POOL_TYPE_EXT;
>  		for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) {
>  			cnt = MLX5_POOL_GET_CNT(pool, i);
>  			TAILQ_INSERT_HEAD(&pool->counters, cnt, next);
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

      reply	other threads:[~2020-05-17  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  0:48 Suanming Mou
2020-05-17  8:34 ` Raslan Darawsheh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR05MB6707D717C6B4E464B17D8024C2BB0@AM0PR05MB6707.eurprd05.prod.outlook.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=dongz@mellanox.com \
    --cc=matan@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=suanmingm@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    --cc=wisamm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).