This is a note to let you know that I've just added the patch titled Revert "net/mlx5: Add retry mechanism to the command entry index allocation" to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-net-mlx5-add-retry-mechanism-to-the-command-entry-index-allocation.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a Mon Sep 17 00:00:00 2001 From: Moshe Shemesh <moshe@xxxxxxxxxx> Date: Sun, 5 Dec 2021 11:20:59 +0200 Subject: Revert "net/mlx5: Add retry mechanism to the command entry index allocation" From: Moshe Shemesh <moshe@xxxxxxxxxx> commit 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a upstream. This reverts commit 410bd754cd73c4a2ac3856d9a03d7b08f9c906bf. The reverted commit had added a retry mechanism to the command entry index allocation. The previous patch ensures that there is a free command entry index once the command work handler holds the command semaphore. Thus the retry mechanism is not needed. Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry index allocation") Signed-off-by: Moshe Shemesh <moshe@xxxxxxxxxx> Reviewed-by: Eran Ben Elisha <eranbe@xxxxxxxxxx> Signed-off-by: Saeed Mahameed <saeedm@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -899,25 +899,6 @@ static bool opcode_allowed(struct mlx5_c return cmd->allowed_opcode == opcode; } -static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) -{ - unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); - int idx; - -retry: - idx = cmd_alloc_index(cmd); - if (idx < 0 && time_before(jiffies, alloc_end)) { - /* Index allocation can fail on heavy load of commands. This is a temporary - * situation as the current command already holds the semaphore, meaning that - * another command completion is being handled and it is expected to release - * the entry index soon. - */ - cpu_relax(); - goto retry; - } - return idx; -} - bool mlx5_cmd_is_down(struct mlx5_core_dev *dev) { return pci_channel_offline(dev->pdev) || @@ -942,7 +923,7 @@ static void cmd_work_handler(struct work sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); if (!ent->page_queue) { - alloc_ret = cmd_alloc_index_retry(cmd); + alloc_ret = cmd_alloc_index(cmd); if (alloc_ret < 0) { mlx5_core_err_rl(dev, "failed to allocate command entry\n"); if (ent->callback) { Patches currently in stable-queue which might be from moshe@xxxxxxxxxx are queue-5.15/revert-net-mlx5-add-retry-mechanism-to-the-command-entry-index-allocation.patch queue-5.15/net-mlx5-set-command-entry-semaphore-up-once-got-ind.patch