Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3661528pxb; Mon, 24 Jan 2022 14:44:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyawjs2t+/zAPF7Wz7ppvwD4GimYj8e0mvFGDOZSg6WPYddw9mBXAdlwNELkYCJvt/zEBEL X-Received: by 2002:a05:6a00:8cb:b0:4bc:3def:b616 with SMTP id s11-20020a056a0008cb00b004bc3defb616mr15994032pfu.18.1643064278000; Mon, 24 Jan 2022 14:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064277; cv=none; d=google.com; s=arc-20160816; b=bWbwdPcxF7QhWy0u99KkZh9oD3dja1k8dz646m/ew9z0mKKUFP65YQOgKpAcTNkk+u Ii4silCl5ZxOy/R2y6JOVRkKRwrZER3N7Fci4jmwKdx6R1VNOSnbBRR/DbC0cPuOwBQN hZZcqRUnojFnor7f2eEHS7wfSvrnSDU/X2L4XFbxA/sOwrpiKRKSDhCo6IESPU535H1N IW6KFWsu6CLWMPlOjdVtRJX4aXo1RoxQzTAbyMPpmhcPlt0/PHWmWAgNNfspc37zzDnX KnCm30t1wXeDr/3MSSsAAXd6TPBsABq8Z/IcLhHIrjhyv51Nvat6wxAHZCe5QeCFxuPm 44Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XarpLa7cgNrOhhhf0fQZKK2AXVtP40hE1oXBJTq75GY=; b=YZxipu4e+CNJBEKczbVghwv7tijgzgORqGOdAK5Zufa0DGldsBtaWfVrdSaI82tVEf /FQ9BqAQm/PGgFb3TZUh5unH24ZUe42ISr6QedXC5ou9Av9Po/z8CHqX9RnawrNJxnvH 2XVR6AS7qUljOOHZWIVBe3Gzd3XYIPISGEYj9gvRo2Nw3zcEf6OqXQovPWRIbnzbFCTB tct9k/zlem0LsyuDvjePpopxnIrCsS/SadoDlgvo42tK86T9MdJyl+OxaT2ei37AFyIE pyrqjHDQ18zD/a1R0PJmNpWNtEEnfj9JiI9Ey0oWqgpqyBCKApZaXSoTUrkOgR4VRDmO 6WUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uZ7fi2g/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si14500480pga.254.2022.01.24.14.44.26; Mon, 24 Jan 2022 14:44:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uZ7fi2g/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381999AbiAXWnD (ORCPT + 99 others); Mon, 24 Jan 2022 17:43:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51242 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456632AbiAXVjl (ORCPT ); Mon, 24 Jan 2022 16:39:41 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3612EB811A2; Mon, 24 Jan 2022 21:39:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D679C340E7; Mon, 24 Jan 2022 21:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060379; bh=NXbbOAqjxfM9TnfaMkieLXY3+VHi8vLOfRI3YaR4YCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZ7fi2g/B+UxNdkQU96oFS4+OGp+nBeohKR4rbsFPi4ih703pgCFWGR3oW9tYDALx 1zS0R1aeNroBq9xIokTtpz5GWIEwpWO37NxfRsWtV7/w8KH25bLJmZZf7BkMeuMSWu EOq+Zyo8ANi+wpsOiNRxAW+L/0tCA04o5AisC6mY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed Subject: [PATCH 5.16 0928/1039] Revert "net/mlx5: Add retry mechanism to the command entry index allocation" Date: Mon, 24 Jan 2022 19:45:17 +0100 Message-Id: <20220124184156.482053296@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Moshe Shemesh 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 Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- 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 @@ -904,25 +904,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) || @@ -950,7 +931,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) {