netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Mark Broadbent <markb@wetlettuce.com>,
	linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: Lockup with 2.6.9-ac15 related to netconsole
Date: Mon, 20 Dec 2004 16:55:21 -0800	[thread overview]
Message-ID: <20041221005521.GD5974@waste.org> (raw)
In-Reply-To: <20041221002218.GA1487@electric-eye.fr.zoreil.com>

On Tue, Dec 21, 2004 at 01:22:18AM +0100, Francois Romieu wrote:
> Matt Mackall <mpm@selenic.com> :
> > On Mon, Dec 20, 2004 at 09:42:08AM -0000, Mark Broadbent wrote:
> > > 
> > > Exactly the same happens, I still get a 'NMI Watchdog detected LOCKUP'
> > > with the r8169 device using the above patch on top of 2.6.10-rc3-bk10.
> > 
> > Ok, that suggests a problem localized to netpoll itself. Do you have
> > spinlock debugging turned on by any chance? 
> 
> Any chance of:
> 1 dev_queue_xmit
> 2 dev->xmit_lock taken
> 3 interruption
> 4 printk
> 5 netconsole write
> 6 dev->xmit_lock again
> 7 lockup
> 
> ?
> 
> This is probably the silly question of the day.

Maybe, but the answer isn't obvious to me at the moment as I haven't
been thinking about such stuff enough lately. Silly response of the
day:

Mark, can you try this (again completely untested, but at least
compiles) patch? I'm afraid I don't have a proper test rig to
reproduce this at the moment. This will attempt to grab the lock, and
if it fails, will check for recursion. Then it will try to print a
message on the local console, temporarily disabling netconsole to
allow the printk to get through..

Index: l/net/core/netpoll.c
===================================================================
--- l.orig/net/core/netpoll.c	2004-11-04 10:53:23.388610000 -0800
+++ l/net/core/netpoll.c	2004-12-20 16:45:40.212709000 -0800
@@ -31,6 +31,8 @@
 #define MAX_SKBS 32
 #define MAX_UDP_CHUNK 1460
 
+static int netpoll_kill;
+
 static spinlock_t skb_list_lock = SPIN_LOCK_UNLOCKED;
 static int nr_skbs;
 static struct sk_buff *skbs;
@@ -183,13 +185,24 @@
 	int status;
 
 repeat:
-	if(!np || !np->dev || !netif_running(np->dev)) {
+	if(!np || !np->dev || !netif_running(np->dev) || netpoll_kill) {
 		__kfree_skb(skb);
 		return;
 	}
 
-	spin_lock(&np->dev->xmit_lock);
-	np->dev->xmit_lock_owner = smp_processor_id();
+	if(spin_trylock(&np->dev->xmit_lock))
+		np->dev->xmit_lock_owner = smp_processor_id();
+	else {
+		if(np->dev->xmit_lock_owner == smp_processor_id()) {
+			netpoll_kill = 1;
+			__kfree_skb(skb);
+			printk("Tried to recursively get dev->xmit_lock");
+			netpoll_kill = 0;
+			return;
+		}
+		spin_lock(&np->dev->xmit_lock);
+
+	}
 
 	/*
 	 * network drivers do not expect to be called if the queue is


-- 
Mathematics is the supreme nostalgia of our time.

  reply	other threads:[~2004-12-21  0:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <59719.192.102.214.6.1103214002.squirrel@webmail.wetlettuce.com>
     [not found] ` <20041216211024.GK2767@waste.org>
     [not found]   ` <34721.192.102.214.6.1103274614.squirrel@webmail.wetlettuce.com>
     [not found]     ` <20041217215752.GP2767@waste.org>
     [not found]       ` <20041217233524.GA11202@electric-eye.fr.zoreil.com>
2004-12-20  9:42         ` Lockup with 2.6.9-ac15 related to netconsole Mark Broadbent
2004-12-20 21:14           ` Matt Mackall
2004-12-21  0:22             ` Francois Romieu
2004-12-21  0:55               ` Matt Mackall [this message]
2004-12-21 10:23                 ` Mark Broadbent
2004-12-21 12:37                   ` Francois Romieu
2004-12-21 13:29                     ` Mark Broadbent
2004-12-21 20:48                       ` Francois Romieu
2004-12-21 21:27                         ` Matt Mackall
2004-12-21 22:58                           ` Francois Romieu
2004-12-22  9:34                             ` Patrick McHardy
2004-12-22 10:54                               ` Patrick McHardy
2004-12-22 12:39                                 ` Francois Romieu
2004-12-22 13:33                                   ` jamal
2004-12-22 14:57                                   ` Patrick McHardy
2004-12-22 17:18                                     ` Matt Mackall
2004-12-25 11:26                                       ` Wish you all a Merry Christmas Pranav
2004-12-25 11:30                                         ` Jan Engelhardt
2004-12-28 13:45                                       ` Lockup with 2.6.9-ac15 related to netconsole jamal
2004-12-22 14:37                                 ` Mark Broadbent

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=20041221005521.GD5974@waste.org \
    --to=mpm@selenic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markb@wetlettuce.com \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.com \
    /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;
as well as URLs for NNTP newsgroup(s).