From: Paul Blakey Date: Thu, 7 May 2020 09:01:39 +0000 (+0300) Subject: net/mlx5: Wait for inactive autogroups X-Git-Tag: v5.8-rc1~165^2~174^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49c0355d301b4e0e01e0f19ddbb023bd7d0ee48c;p=thirdparty%2Fkernel%2Flinux.git net/mlx5: Wait for inactive autogroups Currently, if one thread tries to add an entry to an autogrouped table with no free matching group, while another thread is in the process of creating a new matching autogroup, it doesn't wait for the new group creation, and creates an unnecessary new autogroup. Instead of skipping inactive, wait on the write lock of those groups. Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan Reviewed-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 2da45e9b9b6d0..52af6023a4b47 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1755,11 +1755,13 @@ skip_search: list_for_each_entry(iter, match_head, list) { g = iter->g; - if (!g->node.active) - continue; - nested_down_write_ref_node(&g->node, FS_LOCK_PARENT); + if (!g->node.active) { + up_write_ref_node(&g->node, false); + continue; + } + err = insert_fte(g, fte); if (err) { up_write_ref_node(&g->node, false);