Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1189880ybl; Fri, 24 Jan 2020 17:36:51 -0800 (PST) X-Google-Smtp-Source: APXvYqw+KEsXVgX96I711A+FuxPAYHbNWtwBAJ7I7++Z0eCSbe6l8fFm1BcNiCD+NI4qKynPjlNX X-Received: by 2002:aca:56ce:: with SMTP id k197mr1238915oib.99.1579916210899; Fri, 24 Jan 2020 17:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579916210; cv=none; d=google.com; s=arc-20160816; b=sMc7IqivnyoluTFqRR8qQCJr0MC6sAmkz5Eoe2GDyCPhjyk2SzXrdjNkRrVd7kA/zW hNzDobS1Ye7uCddYZ7PUWx5Udze4qj52SQNPl9c3bogwWu2jPLIgc3206OwzVAASI5fS K04H/fgEMEsDdOXL0rRfj+L4MfDnWP9VgflSI93dN7jaVYQuhHbPIu+w6ad0Bezk83cm ZGTPpCdDBM3L0SuM8kEgMOkUNV8G1XFzijdUTxHc9BQ6poyK1QBNFPJWNr78aCGqlUzR YT6abwiwF7oIe3wPOw8r6VjC1wDJaKufK1z0dzBCu3HgnNQmFIbffkPqqBoSHHos0SKJ y3Ug== 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:from:references:cc:to:subject:dkim-signature; bh=6d0QvcR0leGd4wcUqGcNGh1VcTAtJHNYWWsnf4qfAso=; b=zs/8UO0pu30yUcAZNrgYcvK81st1Osl6PaGWVjcP5mjclnu8u1v75KOEWO6JQipWQb SsDnirb017997Wdv7+fLe1ecjCINTzQw4tpp1ZoYztNp1LMaYUwWJJRQ1Jtmn/C0h8kn 7f1ZvH1uC92Y54JpMdgmXNpqRnVD+K09rB/5FldWYkVKvwIdx0cAzP+r3wNJyU22pYuC pGDqG8sj1X0aUIuYVC3IIrZ+y4v6a8E8CG04Q6Pc6kWl/6+d1Crame2AJqHe6idXXIIr DrXbuPagPBaXGs6WOADJf0VWCO1vkRjXcb4SGCQ6zgZImRM9kAeP2bDyh43BRgxbx/5k pJJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yhjgbw2e; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h15si664376oih.130.2020.01.24.17.36.35; Fri, 24 Jan 2020 17:36:50 -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=@gmail.com header.s=20161025 header.b=Yhjgbw2e; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729708AbgAYBff (ORCPT + 99 others); Fri, 24 Jan 2020 20:35:35 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34049 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729195AbgAYBfe (ORCPT ); Fri, 24 Jan 2020 20:35:34 -0500 Received: by mail-pg1-f194.google.com with SMTP id r11so2034291pgf.1; Fri, 24 Jan 2020 17:35:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6d0QvcR0leGd4wcUqGcNGh1VcTAtJHNYWWsnf4qfAso=; b=Yhjgbw2e8a5r0TlVh8TKKQ/fbUrWMak2zONW5BxfIcHr/m9egxKNe+wpNLsTgBzawK Ls6zqD/SKUju2TNKCfqYi6uIQa44C28DgnWI4W3RM6ZOZgEZSbqQNgFoeJnB9+sL5HG2 Vq0wr8xv+dEaUF3HthYIuk17VuEuqVRw3uD8PtygN1rPSgA3+wYlktowZ3bsdpOt4mZo oDi+3LaUrhr98XaY4mF0mldLlFUFVT6I/kUmDuQfWRvKYFDzpLk79AhXpEDZ2MEUF8zL fq7NOVmatfmgT1LN9iz1CmSjiNlrEQhTy0X7jHS5sT69z8G70KtWz3ahbWspp5xbn6+g 5++g== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6d0QvcR0leGd4wcUqGcNGh1VcTAtJHNYWWsnf4qfAso=; b=VGeYxlZDD38aFEhW7NZYUeyqeMqGHfLkTUnmvPnfURqJlNmnN5yLLwSWRj4EfGtwNK 9s2RHs/QUbZsS4/4S7XEPaduwlZl7SNrgWfjqEIpb3o3VPlZdLaynZagA1rF5h2GAAnC 8L99SrK4YmRUpvoWlEV+gdVo3zG7Brcc5cB39PvgE7qeW2MclL6PxcS/1EM+Yjblfial jfUBvRynJ30rC/8f+VvxuXy0mOUy8HzW5YGFCq1TkCZjIQMxM5ouLMZT6IFCJzX0Ygyi CPY/chUcYGvWXdEGJBoDbo9qh/71i2iiba8A7bo/PsMdc64Y2Hm4QlsRaooShfoyZi9n omlQ== X-Gm-Message-State: APjAAAVIOHoblRXSnogJVptTmevVk9sX+Im/U4P2aE4Ls6hhAKcTvRBn XUa/AZZpBZ3tmccf4Yz9+Senfjfj X-Received: by 2002:a62:1548:: with SMTP id 69mr6058157pfv.239.1579916133829; Fri, 24 Jan 2020 17:35:33 -0800 (PST) Received: from [192.168.86.235] (c-73-241-150-58.hsd1.ca.comcast.net. [73.241.150.58]) by smtp.gmail.com with ESMTPSA id b4sm7630036pfd.18.2020.01.24.17.35.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jan 2020 17:35:33 -0800 (PST) Subject: Re: [PATCH net-next] net: systemport: Do not block interrupts in TX reclaim To: 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: Eric Dumazet Message-ID: Date: Fri, 24 Jan 2020 17:35:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200124235930.640-1-f.fainelli@gmail.com> 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/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)