Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3686357pxb; Mon, 24 Jan 2022 15:20:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHAOASMBKc+2CFIEKvOzLa08zafm5Vq2fOZm4bbbWE4Hswu468CO2ZpDrkS72GgsolR6MO X-Received: by 2002:a63:2164:: with SMTP id s36mr13250608pgm.71.1643066333767; Mon, 24 Jan 2022 15:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066333; cv=none; d=google.com; s=arc-20160816; b=xy/jTujKUpSC6BRwqpKRHFKlG9VKdIlVLnIKWrlZ6QFiFD6fcSx+HQRjrdo3OG3S67 AgKGcdO/71HAkf75Uu/90lv3V50QHX/cZL5ThF1zGIjY73u2DDJlreLCxtdViwLRWxDC n1KOTOIsAwvxz7oTqKxwoDypfA1fTe0Gx2Cu3hEY7KXACC5CqKIw4/LMUcW2cyu/4ffq YxM/snoiTr8mCWW8oF1gTSF/00bH/udzkXP8kN6m2ix2IowZws2fvcMv7qR/CLBvchqT 1l8Mbtu7+uEYfP6FzdS8WuzXmMIUjGvPaFiubl5omq558c32QubT0nN1oybPRfAX5u3X UHEA== 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=LsJ5K0Fx22/lPZ2LB/mnQqsSvShJ33qJvWdDmkMtJdY=; b=QyYymM4nAJ67XkV/AZfLvuMlIVDlUgfRypHUVyqmkX81uTw6E24n7Bmssd3pluVrui bZWXexbjzBPOdAuptDBhCIMSk5GBNYiTGy2MqpMXQjz8p4DzhswGlYuzj7tfxKqTuPqN ohvEJyGwLV4ONRlHdn8267kxh28z87NHCQooTSFMqw1eJo/fPDA06n+0EC6iwMtQ+gKL oxM1Ih8X03jXws6JQBC9wuY2NlIn7g/o5X3InUmLNt5T02CYXJeT4+M9DX4/WV9uQzSu VloiXfj2oOuCJw3RJSdOtV7v6vi4bFU7qC2HR3DOgsH68VVul+u/cTZcmgoOgXfsSemn AbGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QTuT5t5/"; 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 kb17si635330pjb.76.2022.01.24.15.18.42; Mon, 24 Jan 2022 15:18:53 -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="QTuT5t5/"; 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 S1846662AbiAXXQj (ORCPT + 99 others); Mon, 24 Jan 2022 18:16:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1583236AbiAXWR1 (ORCPT ); Mon, 24 Jan 2022 17:17:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D417C061390; Mon, 24 Jan 2022 12:48:36 -0800 (PST) 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 A345DB810A8; Mon, 24 Jan 2022 20:48:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C402BC340E5; Mon, 24 Jan 2022 20:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057313; bh=O9UZ6orK0i01+YGguOA8n40pLZzoN4UWhLL+LLIUQ+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTuT5t5/mJnULA8fWv0TZvHU+UtIkzWEP22/z8OpqO3z5H+zyKtWq1wYY3+kYzkUu NJs8Qw25hhoaNE+0s2DVxqO8JwuFBmPeNKAQJTyXyCvuc99JeNojoUiqowv8/ULe5F K1djdxVCjsLl+MC8SF31xYGu2gmsfQbNn/QZXHJc= 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.15 754/846] Revert "net/mlx5: Add retry mechanism to the command entry index allocation" Date: Mon, 24 Jan 2022 19:44:31 +0100 Message-Id: <20220124184126.984714868@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 @@ -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) {