Received: with ECARTIS (v1.0.0; list netdev); Tue, 19 Apr 2005 06:54:07 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id j3JDrvOa016563 for ; Tue, 19 Apr 2005 06:54:00 -0700 Received: from hermes.suse.de (hermes-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A67DC75B8; Tue, 19 Apr 2005 15:53:51 +0200 (CEST) Date: Tue, 19 Apr 2005 15:53:50 +0200 From: Andi Kleen To: netdev@oss.sgi.com, mpm@selenic.com, davem@redhat.com Subject: [PATCH] Fix deadlock in netconsole with no carrier Message-ID: <20050419135350.GH7715@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: ClamAV 0.83/840/Mon Apr 18 18:42:09 2005 on oss.sgi.com X-Virus-Status: Clean X-archive-position: 1856 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: ak@suse.de Precedence: bulk X-list: netdev Content-Length: 901 Lines: 37 I got a deadlock at boot with netconsole when the netword card did not have a cable connected. This patch fixes this by limiting the number of retries. Also when we run into the device spinlock dont poll all the time, just spin. Signed-off-by: Andi Kleen diff -u net/core/netpoll.c-o net/core/netpoll.c --- net/core/netpoll.c-o 2005-03-02 08:38:32.000000000 +0100 +++ net/core/netpoll.c 2005-04-19 15:50:42.959142733 +0200 @@ -190,9 +190,10 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { int status; + int try = 5; repeat: - if(!np || !np->dev || !netif_running(np->dev)) { + if(try-- == 0 || !np || !np->dev || !netif_running(np->dev)) { __kfree_skb(skb); return; } @@ -218,6 +219,10 @@ /* transmit busy */ if(status) { + if (status == NETDEV_TX_LOCKED) { + try++; + goto repeat; + } netpoll_poll(np); goto repeat; }