From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79D7C12BF08; Tue, 14 May 2024 11:47:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715687259; cv=none; b=L9hGP8Pi4UJ9c5mHwmcfkOyXzQgva7eyqzJllQzCI5OzS4F/kqpnjdvsJ40jKJmdscqxJFEqroCAMGdskrUcgUoIZGbkp1W+soH/JvllreG3w8wTE+eEcTHlWkkeASu3Y0j8nx8QJKSrZbuJ/b+JtBYMXeRs812RtuRLiFk4+qE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715687259; c=relaxed/simple; bh=mdE2v2gzmVWIBOeTAKtiI3QbICZVI49kXQ32qsspuxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lyo2KcPTDNVnmvGbkgAVGlydDFErQIwYTb/dNXOyBFFx964gZzT6akJL3wem4Aq/Tx34tqxMrPIJZxx6PMLXqvQ+7Yj799OSx1HT+OorgsjtxWVa7s7KhpGY7a89dKlhhMlISVqhOHU2s+sNDgLMyaq0pK5wv1ZzsiC+15rHDH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EECiFMaK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EECiFMaK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2762C2BD10; Tue, 14 May 2024 11:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715687259; bh=mdE2v2gzmVWIBOeTAKtiI3QbICZVI49kXQ32qsspuxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EECiFMaKY1AzcXX3uQ3WJK93Zsc5MwtMhRL+9GT3PkceSrScyoLfH/RsgQ03icuQ5 3IYMsKh8Oc9N3YWfDplgSjQ1yBLE3FZr6VPTd6KkjaTw4RA7bMVTripXMAh5IqpfB3 8L/TA8BR2TrZToqHdQHuKsCHgjPJ8l8Lkph0tAo8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "John B. Wyatt IV" , Sebastian Andrzej Siewior , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 035/111] cxgb4: Properly lock TX queue for the selftest. Date: Tue, 14 May 2024 12:19:33 +0200 Message-ID: <20240514100958.459735239@linuxfoundation.org> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514100957.114746054@linuxfoundation.org> References: <20240514100957.114746054@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior [ Upstream commit 9067eccdd7849dd120d5495dbd5a686fa6ed2c1a ] The selftest for the driver sends a dummy packet and checks if the packet will be received properly as it should be. The regular TX path and the selftest can use the same network queue so locking is required and was missing in the selftest path. This was addressed in the commit cited below. Unfortunately locking the TX queue requires BH to be disabled which is not the case in selftest path which is invoked in process context. Lockdep should be complaining about this. Use __netif_tx_lock_bh() for TX queue locking. Fixes: c650e04898072 ("cxgb4: Fix race between loopback and normal Tx path") Reported-by: "John B. Wyatt IV" Closes: https://lore.kernel.org/all/Zic0ot5aGgR-V4Ks@thinkpad2021/ Signed-off-by: Sebastian Andrzej Siewior Link: https://lore.kernel.org/r/20240429091147.YWAaal4v@linutronix.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4/sge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index ccb6bd002b20d..89917dde0e223 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c @@ -2678,12 +2678,12 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev) lb->loopback = 1; q = &adap->sge.ethtxq[pi->first_qset]; - __netif_tx_lock(q->txq, smp_processor_id()); + __netif_tx_lock_bh(q->txq); reclaim_completed_tx(adap, &q->q, -1, true); credits = txq_avail(&q->q) - ndesc; if (unlikely(credits < 0)) { - __netif_tx_unlock(q->txq); + __netif_tx_unlock_bh(q->txq); return -ENOMEM; } @@ -2718,7 +2718,7 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev) init_completion(&lb->completion); txq_advance(&q->q, ndesc); cxgb4_ring_tx_db(adap, &q->q, ndesc); - __netif_tx_unlock(q->txq); + __netif_tx_unlock_bh(q->txq); /* wait for the pkt to return */ ret = wait_for_completion_timeout(&lb->completion, 10 * HZ); -- 2.43.0