From patchwork Mon Jan 4 13:49:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 42065 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.180.67]) by ozlabs.org (Postfix) with ESMTP id AD45CB7BE7 for ; Tue, 5 Jan 2010 00:49:19 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752326Ab0ADNtN (ORCPT ); Mon, 4 Jan 2010 08:49:13 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752215Ab0ADNtN (ORCPT ); Mon, 4 Jan 2010 08:49:13 -0500 Received: from mail-fx0-f225.google.com ([209.85.220.225]:61623 "EHLO mail-fx0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752158Ab0ADNtM (ORCPT ); Mon, 4 Jan 2010 08:49:12 -0500 Received: by fxm25 with SMTP id 25so8698184fxm.21 for ; Mon, 04 Jan 2010 05:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=6sOJLhzDSyZ6YIoq+d4RGadEw2hhQcUAoS71ZoIMCoM=; b=Oen319+wvojgnYkR9WUkBtDr85aTUkLBoZiWXHwa21agGA9k/RxyYD3waPrUxYMPuT OLlcsli13yuefSvbNssXMMZ8d6MZK1DG7pp+QbBECCBxBCSDmfmg+LmIAqE/xqPjGfur H209J/LA0ejPqIx3vKvvmZyfUEgZInWDrcj1c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=tbZSzv3zekZJJIXKfpWoBd3+KwlUg5aYOhOdfJ8j4N6sGYzCDEQhIl61fk0r0pcfA1 KB8Zp9rXeFANMi3uF9V+IfjbepDonPOegllX7ylwxIOjUN/HXDS9JxDEJkAOV11Bp6EY yARN+BTJ/cyqDcubYNB2GiLCtyOJtC7WF+A8Y= Received: by 10.87.17.20 with SMTP id u20mr4450223fgi.32.1262612950156; Mon, 04 Jan 2010 05:49:10 -0800 (PST) Received: from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170]) by mx.google.com with ESMTPS id d6sm51219319fga.14.2010.01.04.05.49.07 (version=SSLv3 cipher=RC4-MD5); Mon, 04 Jan 2010 05:49:08 -0800 (PST) Date: Mon, 4 Jan 2010 13:49:04 +0000 From: Jarek Poplawski To: David Miller Cc: "Berck E. Nash" , Mike McCormack , Stephen Hemminger , netdev@vger.kernel.org, dhazelton@enter.net, mbreuer@majjas.com Subject: [PATCH] sky2: Fix oops in sky2_xmit_frame() after TX timeout Message-ID: <20100104134904.GA18583@ff.dom.local> References: <4B3C8323.1080301@ring3k.org> <4B3CF2C4.5070203@gmail.com> <4B3D38FB.40105@ring3k.org> <20100101183155.GA8519@del.dom.local> <4B41560C.4040500@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B41560C.4040500@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Jan 03, 2010 at 07:44:28PM -0700, Berck E. Nash wrote: > Jarek Poplawski wrote: > > Yes, it seems this lock might be needed around this place, but I'd > > like to check another idea: if it's not about awakening too early. > > Berck, could you try this patch? > > Okay, after running with that for several days I have not gotten the > oops. That doesn't mean that I won't tomorrow, but I've gotten several > of these: > > [45621.704025] sky2 eth0: hung mac 124:21 fifo 195 (127:122) > [45621.704027] sky2 eth0: receiver hang detected > [45621.708524] sky2 eth0: disabling interface > [45621.715229] sky2 eth0: enabling interface > [45624.862111] sky2 eth0: Link is up at 1000 Mbps, full duplex, flow > control both > [61024.704036] sky2 eth0: hung mac 124:75 fifo 195 (133:128) > [61024.704039] sky2 eth0: receiver hang detected > [61024.708487] sky2 eth0: disabling interface > [61024.714791] sky2 eth0: enabling interface > [61027.864288] sky2 eth0: Link is up at 1000 Mbps, full duplex, flow > control both > > And it hasn't crashed. The "receiver hang detected" would often (but > not always) be followed by the oops before. > > Berck OK, here it is with some cosmetics; let David decide if it needs more testing. Thanks everybody, Jarek P. -------------> During TX timeout procedure dev could be awaken too early, e.g. by sky2_complete_tx() called from sky2_down(). Then sky2_xmit_frame() can run while buffers are freed causing an oops. This patch fixes it by adding netif_device_present() test in sky2_tx_complete(). Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=14925 With debugging by: Mike McCormack Reported-by: Berck E. Nash Tested-by: Berck E. Nash Signed-off-by: Jarek Poplawski --- drivers/net/sky2.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) -- 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/sky2.c b/drivers/net/sky2.c index 1c01b96..2f32fab 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -1844,7 +1844,9 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) sky2->tx_cons = idx; smp_mb(); - if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) + /* Wake unless it's detached, and called e.g. from sky2_down() */ + if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && + likely(netif_device_present(dev))) netif_wake_queue(dev); }