Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3551262ioa; Tue, 26 Apr 2022 05:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz40iaiFKOvxhJpgAwv/vV266A5gH33RT/96gkhDqeeHf1vMutucwpTB19yV7NlvAFvkxxj X-Received: by 2002:a17:907:9710:b0:6f3:6e7e:d5bd with SMTP id jg16-20020a170907971000b006f36e7ed5bdmr16013118ejc.252.1650977936578; Tue, 26 Apr 2022 05:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650977936; cv=none; d=google.com; s=arc-20160816; b=na4X2tQoM1P1C1fJHX2c9dqTrIPglpiXbyp8igU5pJsnOVM584iY8UIvdyXHR+kkFv kVMAc7nS6uvMpY24dhhKjCBPpym6yBBX4IxnqNIiz/D5floR8CmsxqP7dABEZMnkZ0Ui RRq4GHZcuWrxXbGLSEJ4W6IMPz10GFW2CqE8nuTIGFtgMEfNDvUuz3Ix1zLJsNwG2KZd pQeMWfJh7VOxK6xLqZPi4g2py872QYg3BR5StS0QYI6elV6cXjO9OTDQfGomWPe3bg2Z S5VZwBTmrMPWKJ2DsmS52M2Phij9J2bTx9bA6oLQGyWDvYRPIdvY8To0QH7wjA7VW/s+ rMRg== 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=VaL2cYKG4O5CUweYynsmLUL+Z2glmRMyP2Q4ahlZ1Ac=; b=OwQ0C5iEylFaMjcJD2sUScT+9UgBUAztgMQDb6ZXtF7qOcYsFkAs1Cd+SXfSh/igiQ BI6sd2X2Zh1diaSwK2nn1eTrn4XqzbaBSEitzZbA9/GGq0fckr3TqDu5lXdAusxpDEA4 AFseTB/5UMPnicMLiN6evxOB/ED10d9S2ySiE9LJMu435GgN2THev7sYrAJJtQbUSAjH +t+3SeBlwSVDLh3hp//1yO2Qq0kRHFJhohlVMw4q0DNwts+nX/gzVsqQHApVZ0Ovdljl PUVgimZwRLsIePGxiMk03s1gVl9ajow2cq2i5SeZd1llLa9BdKc784fEKNktIVeJnSbk 42Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wdvzUHLn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a50ed04000000b00425d81a432asi6616236eds.319.2022.04.26.05.58.32; Tue, 26 Apr 2022 05:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wdvzUHLn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1348225AbiDZJPV (ORCPT + 99 others); Tue, 26 Apr 2022 05:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346985AbiDZIu6 (ORCPT ); Tue, 26 Apr 2022 04:50:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDCF171C19; Tue, 26 Apr 2022 01:39:18 -0700 (PDT) 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 391ACB81D18; Tue, 26 Apr 2022 08:39:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8492C385A4; Tue, 26 Apr 2022 08:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962356; bh=dzVjioPkyw1/WFLU5VKNi3YYW0V1cEYT1JMw1y3d9TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdvzUHLn1Aah9/Ej6XRYq7Fpkh3oYk1py0ZEEfN6wXT6STKYr8lt3/pQnf5EiI3WK y8Yjo4Ll69BZAGVxQAw75cxwyQoWgXFob94c7HzcEKfQ4jW+w0ukqSs/m7Ns+8kq0q DHIBNySPtFtSRK8aGXpjf7v695tRNTIteIlkTx7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomas Melin , Claudiu Beznea , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 067/124] net: macb: Restart tx only if queue pointer is lagging Date: Tue, 26 Apr 2022 10:21:08 +0200 Message-Id: <20220426081749.205909953@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomas Melin [ Upstream commit 5ad7f18cd82cee8e773d40cc7a1465a526f2615c ] commit 4298388574da ("net: macb: restart tx after tx used bit read") added support for restarting transmission. Restarting tx does not work in case controller asserts TXUBR interrupt and TQBP is already at the end of the tx queue. In that situation, restarting tx will immediately cause assertion of another TXUBR interrupt. The driver will end up in an infinite interrupt loop which it cannot break out of. For cases where TQBP is at the end of the tx queue, instead only clear TX_USED interrupt. As more data gets pushed to the queue, transmission will resume. This issue was observed on a Xilinx Zynq-7000 based board. During stress test of the network interface, driver would get stuck on interrupt loop within seconds or minutes causing CPU to stall. Signed-off-by: Tomas Melin Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220407161659.14532-1-tomas.melin@vaisala.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 9705c49655ad..217c1a0f8940 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1689,6 +1689,7 @@ static void macb_tx_restart(struct macb_queue *queue) unsigned int head = queue->tx_head; unsigned int tail = queue->tx_tail; struct macb *bp = queue->bp; + unsigned int head_idx, tbqp; if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) queue_writel(queue, ISR, MACB_BIT(TXUBR)); @@ -1696,6 +1697,13 @@ static void macb_tx_restart(struct macb_queue *queue) if (head == tail) return; + tbqp = queue_readl(queue, TBQP) / macb_dma_desc_get_size(bp); + tbqp = macb_adj_dma_desc_idx(bp, macb_tx_ring_wrap(bp, tbqp)); + head_idx = macb_adj_dma_desc_idx(bp, macb_tx_ring_wrap(bp, head)); + + if (tbqp == head_idx) + return; + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); } -- 2.35.1