net/mlx5: optimize critical section in device free
authorMichael Baum <michaelba@mellanox.com>
Tue, 21 Jul 2020 12:03:38 +0000 (12:03 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 29 Jul 2020 22:41:23 +0000 (00:41 +0200)
commitf4a08731978050e1eebb8936db7d41c41fdd5526
tree9707ffaab2e5fccce78e74ff66fa3596e521762a
parent63d1db710fbc0a05d187fef37fbc4417cf7388b1
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