Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1194176ybl; Fri, 24 Jan 2020 17:43:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzwfrOn2HkF97vKOHLgSzbQpGBW3QDoJR/qyNQ7Yl2hENvXuJx0d6sylsIXTMUSl6iAussF X-Received: by 2002:a05:6830:1185:: with SMTP id u5mr4589277otq.147.1579916632884; Fri, 24 Jan 2020 17:43:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579916632; cv=none; d=google.com; s=arc-20160816; b=ZUUUmHCOMjyHucyG3cLS4BS/aZgiJEqYYN6ycGzOVU81Khk5jISHcELXXNt5O7ImP2 pPAYJ1oi5m2JYzuqnl9jnyjj/kmwiI9RaS0UTKm0JvLP7GoTB/iEDQZcge7Y9ShqclM9 JPoz7TOX5uvwKP471lYhpM8Q+2t4TaL0YY9NpL7g4J/CZoHaE4ZpPzXPsgMlivAAC3mp IRxgDfSuYF8Fme6k7TA5PEmBA6/y78qVeyHOuei7Stk6WyGM8OmpdPcA0y/ZtkaHQkEF /LrJXoNhCjUYi0I8sMN5y2kvTqNH57E1q9+xmnOuMJQYEj4Zf5ix9n1ZPUy5vjNTI5Ck 9FEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=tlFaD//BvBZv3xMn475Kee1Ktpmgh8PdbAcukkFkcZk=; b=DsgxRCa036QMi4tU3bGcPFt7F4Xfhtm/WrRTcXUnYftnEdbE/wGCRxDmxDbrBrsJZU tG5ZG8DN15LQaWy9rT0YXGJm+yrMeSGTI8uTZzLK/hFvq/KmCLsOZC3Ou0Z5BD5hxKtZ zHU48ZyttCuTHhkaV/yoeWtEOZ06unYzMggL+vodb5d05dBQzE9uQ+uDuAr1MEH1QhiX YJaCQj2P8JSwAWEEQ6RbUyfCuChEoUhBias2HNu3cfzGTkS3veJJTniF6KT1U0bhUk6y E+j4fBxzsc9/9dr8Jl5b/hdYv2bRHkMFa84dL1j/sCFlqmjkR451Ovr0jz/dgtgRf5L7 JoTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="FKFao3/v"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si3677278otq.203.2020.01.24.17.43.39; Fri, 24 Jan 2020 17:43:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="FKFao3/v"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387629AbgAYBml (ORCPT + 99 others); Fri, 24 Jan 2020 20:42:41 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:37542 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387601AbgAYBmk (ORCPT ); Fri, 24 Jan 2020 20:42:40 -0500 Received: by mail-pj1-f65.google.com with SMTP id m13so610292pjb.2 for ; Fri, 24 Jan 2020 17:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tlFaD//BvBZv3xMn475Kee1Ktpmgh8PdbAcukkFkcZk=; b=FKFao3/vBoD6gBdGn/A1bfmgaHYMK7YAgelnIVuBpEG8ZuvRp77moVXqR+i9VeLph1 IjGqumeDHzLyhQ2ok076w/2lhWeZqlcVHAKpamYkke+XuN7qcrInusYq+NBAGAxnRJtz ujxIASjG7ecf9qW2DXodQbKE3AVXZzUZUrozc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=tlFaD//BvBZv3xMn475Kee1Ktpmgh8PdbAcukkFkcZk=; b=LFGpw00D/bdoLE3woGzkGoJkBEnT5iMsJYzVsGjQQF5v+4QfCfAgHwSpSQNnwj83EE q3mF1IKXYyfqYkwV0EreFonS4u/YP614MrFz2sajBGT+lpgYOVnrmFAwO4ijpLd4a3Lf gzD5sC7tdDlq0hTBFn0WWc8oPpnz+ZOpK8zg4SnrqxX6L3kP1sxyhYATVj60d++ld72v aaJBhI7r/bQPHtfNtukfaQQ5ExJii8k8mCt87+TM8pF7bpiBbMdp2R+/6sD1ejOUJCRB K2C6eGMFqABAELR7NiurAQ41VsWyWH0lAoHneEm0hdUFij75JmVTuArHrLQZpk3jEv3s g70w== X-Gm-Message-State: APjAAAWDFEAeZLFeWnv8Znih49qdsAniDOBt7HOY8h3YWq1Wi21jVV3I DemHw+VDr4oZw07zudX/gUd4bVMoAP699FWwlyvD5DNEmjCf/QDstwddlad8s5/XLmzxCAsRvw1 sVAAMHhlKCQnF+8G2KhoQ+PTjnBNnmQTX3MzKW7nTu6Lyke7lP3ik4xLhOIrOzlmPDV5XoZZaHx AyG5DRTXLnaw== X-Received: by 2002:a17:90b:941:: with SMTP id dw1mr2403404pjb.21.1579916559059; Fri, 24 Jan 2020 17:42:39 -0800 (PST) Received: from [192.168.1.3] (ip68-111-84-250.oc.oc.cox.net. [68.111.84.250]) by smtp.gmail.com with ESMTPSA id t1sm8075530pgq.23.2020.01.24.17.42.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jan 2020 17:42:38 -0800 (PST) Subject: Re: [PATCH net-next] net: systemport: Do not block interrupts in TX reclaim To: Eric Dumazet , Florian Fainelli , netdev@vger.kernel.org Cc: kuba@kernel.org, edumazet@google.com, "David S. Miller" , "open list:BROADCOM SYSTEMPORT ETHERNET DRIVER" , open list References: <20200124235930.640-1-f.fainelli@gmail.com> From: Florian Fainelli Autocrypt: addr=florian.fainelli@broadcom.com; keydata= mQENBFPAG8ABCAC3EO02urEwipgbUNJ1r6oI2Vr/+uE389lSEShN2PmL3MVnzhViSAtrYxeT M0Txqn1tOWoIc4QUl6Ggqf5KP6FoRkCrgMMTnUAINsINYXK+3OLe7HjP10h2jDRX4Ajs4Ghs JrZOBru6rH0YrgAhr6O5gG7NE1jhly+EsOa2MpwOiXO4DE/YKZGuVe6Bh87WqmILs9KvnNrQ PcycQnYKTVpqE95d4M824M5cuRB6D1GrYovCsjA9uxo22kPdOoQRAu5gBBn3AdtALFyQj9DQ KQuc39/i/Kt6XLZ/RsBc6qLs+p+JnEuPJngTSfWvzGjpx0nkwCMi4yBb+xk7Hki4kEslABEB AAG0MEZsb3JpYW4gRmFpbmVsbGkgPGZsb3JpYW4uZmFpbmVsbGlAYnJvYWRjb20uY29tPokB xAQQAQgArgUCXJvPrRcKAAG/SMv+fS3xUQWa0NryPuoRGjsA3SAUAAAAAAAWAAFrZXktdXNh Z2UtbWFza0BwZ3AuY29tjDAUgAAAAAAgAAdwcmVmZXJyZWQtZW1haWwtZW5jb2RpbmdAcGdw LmNvbXBncG1pbWUICwkIBwMCAQoFF4AAAAAZGGxkYXA6Ly9rZXlzLmJyb2FkY29tLmNvbQUb AwAAAAMWAgEFHgEAAAAEFQgJCgAKCRCBMbXEKbxmoE4DB/9JySDRt/ArjeOHOwGA2sLR1DV6 Mv6Ru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c9dUOr68 7hA+Z0L5IQAKCRCBMbXEKbxmoLoHCACXeRGHuijOmOkbyOk7x6fkIG1OXcb46kokr2ptDLN0 Ky4nQrWp7XBk9ls/9j5W2apKCcTEHONK2312uMUEryWI9BlqWnawyVL1LtyxLLpwwsXVq5m5 sBkSqma2ldqBu2BHXZg6jntF5vzcXkqG3DCJZ2hOldFPH+czRwe2OOsiY42E/w7NUyaN6b8H rw1j77+q3QXldOw/bON361EusWHdbhcRwu3WWFiY2ZslH+Xr69VtYAoMC1xtDxIvZ96ps9ZX pUPJUqHJr8QSrTG1/zioQH7j/4iMJ07MMPeQNkmj4kGQOdTcsFfDhYLDdCE5dj5WeE6fYRxE Q3up0ArDSP1L Message-ID: <36eea933-d30b-344b-1f29-d8e5959f27fd@broadcom.com> Date: Fri, 24 Jan 2020 17:42:37 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/2020 5:35 PM, Eric Dumazet wrote: > > > On 1/24/20 3:59 PM, Florian Fainelli wrote: >> There is no need to disable interrupts with a spin_lock_irqsave() in >> bcm_sysport_tx_poll() since we are in softIRQ context already. Leave >> interrupts enabled, thus giving a chance for the RX interrupts to be >> processed. >> >> This now makes bcm_sysport_tx_reclaim() equivalent to >> bcm_sysport_tx_clean(), thus remove the former, and make >> bcm_sysport_tx_reclaim_all() to use the latter. >> >> Signed-off-by: Florian Fainelli >> --- >> drivers/net/ethernet/broadcom/bcmsysport.c | 30 ++++++---------------- >> 1 file changed, 8 insertions(+), 22 deletions(-) >> >> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c >> index f07ac0e0af59..dfff0657ce8f 100644 >> --- a/drivers/net/ethernet/broadcom/bcmsysport.c >> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c >> @@ -925,26 +925,6 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv, >> return pkts_compl; >> } >> >> -/* Locked version of the per-ring TX reclaim routine */ >> -static unsigned int bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv, >> - struct bcm_sysport_tx_ring *ring) >> -{ >> - struct netdev_queue *txq; >> - unsigned int released; >> - unsigned long flags; >> - >> - txq = netdev_get_tx_queue(priv->netdev, ring->index); >> - >> - spin_lock_irqsave(&ring->lock, flags); >> - released = __bcm_sysport_tx_reclaim(priv, ring); >> - if (released) >> - netif_tx_wake_queue(txq); >> - >> - spin_unlock_irqrestore(&ring->lock, flags); >> - >> - return released; >> -} >> - >> /* Locked version of the per-ring TX reclaim, but does not wake the queue */ >> static void bcm_sysport_tx_clean(struct bcm_sysport_priv *priv, >> struct bcm_sysport_tx_ring *ring) >> @@ -960,9 +940,15 @@ static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget) >> { >> struct bcm_sysport_tx_ring *ring = >> container_of(napi, struct bcm_sysport_tx_ring, napi); >> + struct bcm_sysport_priv *priv = ring->priv; >> unsigned int work_done = 0; >> >> - work_done = bcm_sysport_tx_reclaim(ring->priv, ring); >> + spin_lock(&ring->lock); >> + work_done = __bcm_sysport_tx_reclaim(priv, ring); >> + if (work_done) >> + netif_tx_wake_queue(netdev_get_tx_queue(priv->netdev, >> + ring->index)); >> + spin_unlock(&ring->lock); >> >> if (work_done == 0) { >> napi_complete(napi); >> @@ -984,7 +970,7 @@ static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv) >> unsigned int q; >> >> for (q = 0; q < priv->netdev->num_tx_queues; q++) >> - bcm_sysport_tx_reclaim(priv, &priv->tx_rings[q]); >> + bcm_sysport_tx_clean(priv, &priv->tx_rings[q]); >> } >> >> static int bcm_sysport_poll(struct napi_struct *napi, int budget) >> > > I am a bit confused by this patch, the changelog mixes hard and soft irqs. > > This driver seems to call bcm_sysport_tx_reclaim_all() from hard irq handler > (INTRL2_0_TX_RING_FULL condition) > > So it looks you need to acquire ring->lock with some _irqsave() variant when > bcm_sysport_tx_poll() is running (from BH context) You are right, I completely missed that path and the very reason why this is spin_lock_irqsave() in the first place... time to get some sleep. Thanks! -- Florian