From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org
Cc: kuba@kernel.org, edumazet@google.com,
"David S. Miller" <davem@davemloft.net>,
"open list:BROADCOM SYSTEMPORT ETHERNET DRIVER"
<bcm-kernel-feedback-list@broadcom.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: systemport: Do not block interrupts in TX reclaim
Date: Fri, 24 Jan 2020 17:42:37 -0800 [thread overview]
Message-ID: <36eea933-d30b-344b-1f29-d8e5959f27fd@broadcom.com> (raw)
In-Reply-To: <de50408a-37db-e55e-57af-54574c7b5e42@gmail.com>
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 <f.fainelli@gmail.com>
>> ---
>> 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
prev parent reply other threads:[~2020-01-25 1:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 23:59 [PATCH net-next] net: systemport: Do not block interrupts in TX reclaim Florian Fainelli
2020-01-25 1:35 ` Eric Dumazet
2020-01-25 1:42 ` Florian Fainelli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36eea933-d30b-344b-1f29-d8e5959f27fd@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox