From patchwork Tue Oct 28 00:13:54 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Friesen X-Patchwork-Id: 6003 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 5D424DDE04 for ; Tue, 28 Oct 2008 11:14:18 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbYJ1AON (ORCPT ); Mon, 27 Oct 2008 20:14:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751985AbYJ1AON (ORCPT ); Mon, 27 Oct 2008 20:14:13 -0400 Received: from zcars04f.nortel.com ([47.129.242.57]:55697 "EHLO zcars04f.nortel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751919AbYJ1AON (ORCPT ); Mon, 27 Oct 2008 20:14:13 -0400 Received: from zcarhxs1.corp.nortel.com (zcarhxs1.corp.nortel.com [47.129.230.89]) by zcars04f.nortel.com (Switch-2.2.6/Switch-2.2.0) with ESMTP id m9S0E5t27801; Tue, 28 Oct 2008 00:14:05 GMT Received: from [47.130.66.14] ([47.130.66.14] RDNS failed) by zcarhxs1.corp.nortel.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Oct 2008 20:13:58 -0400 Message-ID: <49065942.4040300@nortel.com> Date: Mon, 27 Oct 2008 18:13:54 -0600 From: "Chris Friesen" User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Miller CC: linuxppc-dev@ozlabs.org, romieu@fr.zoreil.com, jesse.brandeburg@intel.com, netdev@vger.kernel.org Subject: Re: [BUG] oops in net_rx_action on 64-bit powerpc References: <49025C94.60406@nortel.com> <20081024.164128.113131091.davem@davemloft.net> <4902B1D8.8070800@nortel.com> <20081025.001703.261277154.davem@davemloft.net> In-Reply-To: <20081025.001703.261277154.davem@davemloft.net> X-OriginalArrivalTime: 28 Oct 2008 00:13:58.0393 (UTC) FILETIME=[12861E90:01C93892] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller wrote: > Probably the simplest fix is to get rid of the rx_not_empty label and > protect the entire: > > /* Receive descriptor is empty now */ > spin_lock_irqsave(&lp->lock, flags); > __netif_rx_complete(dev, napi); > writel(VAL0|RINTEN0, mmio + INTEN0); > writel(VAL2 | RDMD0, mmio + CMD0); > spin_unlock_irqrestore(&lp->lock, flags); > > code block with a test such as: > > if (rx_pkt_limit > 0) > > (yes, greater than zero, not >= 0) > > then replace the rx_not_empty goto with a simple break. Are you sure about that? Doing that, if we "--rx_pkt_limit < 0" we'll only break out of the inner while loop. We then check then interrupt status register and potentially loop through the do/while loop again (maybe decrementing rx_pkt_limit again) even though we've used up our budget. If I leave the label and jump and just add the "rx_pkt_limit > 0" test, it seems to work. Chris From: Chris Friesen Subject: [PATCH] fix amd8111e rx return code The amd8111e rx poll routine currently mishandles the case when we process exactly the number of packets specified in the budget. This patch is basically as suggested by David Miller. Signed-off-by: Chris Friesen return num_rx_pkt; --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index c54967f..ba1be0b 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -833,12 +833,14 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget) } while(intr0 & RINT0); - /* Receive descriptor is empty now */ - spin_lock_irqsave(&lp->lock, flags); - __netif_rx_complete(dev, napi); - writel(VAL0|RINTEN0, mmio + INTEN0); - writel(VAL2 | RDMD0, mmio + CMD0); - spin_unlock_irqrestore(&lp->lock, flags); + if (rx_pkt_limit > 0) { + /* Receive descriptor is empty now */ + spin_lock_irqsave(&lp->lock, flags); + __netif_rx_complete(dev, napi); + writel(VAL0|RINTEN0, mmio + INTEN0); + writel(VAL2 | RDMD0, mmio + CMD0); + spin_unlock_irqrestore(&lp->lock, flags); + } rx_not_empty: