DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: Michael Baum <michaelba@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Matan Azrad <matan@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: optimize critical section in device	free
Date: Wed, 22 Jul 2020 15:30:50 +0000	[thread overview]
Message-ID: <AM0PR05MB6707C002D56F9AF0C0885574C2790@AM0PR05MB6707.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1595333018-7119-1-git-send-email-michaelba@mellanox.com>

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Michael Baum
> Sent: Tuesday, July 21, 2020 3:04 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: optimize critical section in device free
> 
> When PMD releases shared IB device context, It locks the
> mlx5_ibv_list_mutex lock throughout the function so that it does not
> happen while removing a device from the list, another process will try
> to insert another device into it.
> On the other hand, having removed the device from the list even if it
> has not yet released all of its resources, it should not care about
> other processes and can release the lock.
> 
> However, the PMD does not release the lock even though it can, and
> performs a number of operations, some of which include sleep and may be
> long.
> To improve this, shorten the lock time to the minimum necessary.
> 
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 846398d..70338e5 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -939,6 +939,7 @@ struct mlx5_dev_ctx_shared *
>  	mlx5_mr_release_cache(&sh->share_cache);
>  	/* Remove context from the global device list. */
>  	LIST_REMOVE(sh, next);
> +	pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex);
>  	/*
>  	 *  Ensure there is no async event handler installed.
>  	 *  Only primary process handles async device events.
> @@ -968,6 +969,7 @@ struct mlx5_dev_ctx_shared *
>  		mlx5_flow_id_pool_release(sh->flow_id_pool);
>  	pthread_mutex_destroy(&sh->txpp.mutex);
>  	mlx5_free(sh);
> +	return;
>  exit:
>  	pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex);
>  }
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

      reply	other threads:[~2020-07-22 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 12:03 Michael Baum
2020-07-22 15:30 ` 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=AM0PR05MB6707C002D56F9AF0C0885574C2790@AM0PR05MB6707.eurprd05.prod.outlook.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=michaelba@mellanox.com \
    --cc=viacheslavo@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).