From: Jason Wessel <jason.wessel@windriver.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Folkert van Heusden <folkert@vanheusden.com>,
linux-kernel@vger.kernel.org, Jarek Poplawski <jarkao2@o2.pl>,
Thomas Gleixner <tglx@linutronix.de>,
stable@kernel.org
Subject: [PATCH] Re: [2.6.21.1] soft lockup when removing netconsole module
Date: Wed, 30 May 2007 08:28:09 -0500 [thread overview]
Message-ID: <465D7BE9.70702@windriver.com> (raw)
In-Reply-To: <20070529005628.f7f3abc6.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 341 bytes --]
Attached is a patch to fix the soft lockup problem when removing the
netconsole module.
It looks different than the original patch I posted because the context
had to change to maintain 80 column code. For reference the original
e-mail + patch was "[BUG] 2.6.21 hang in
cancel_rearming_delayed_workqueue()" sent on 5/25/07.
Jason.
[-- Attachment #2: netpoll_cleanup_fix.patch --]
[-- Type: text/plain, Size: 2109 bytes --]
>From 102a018d601e954f658d272d4daeef139ae40e0e Mon Sep 17 00:00:00 2001
From: Jason Wessel <jason.wessel@windriver.com>
Date: Wed, 30 May 2007 08:03:52 -0500
Subject: [PATCH] The netpoll_cleanup handler can hang the kernel if there is no work in
the work queue because a call to cancel_rearming_delayed_work() with
no work goes into an infinite loop.
The typical case where this is a problem is on removing a kernel
module such as the netconsole driver or kgdboe.
To maintain 80 column code, the function had to have one level of braces
dropped.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
net/core/netpoll.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 4581ece..28fa50e 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -766,30 +766,32 @@ void netpoll_cleanup(struct netpoll *np)
struct netpoll_info *npinfo;
unsigned long flags;
- if (np->dev) {
- npinfo = np->dev->npinfo;
- if (npinfo) {
- if (npinfo->rx_np == np) {
- spin_lock_irqsave(&npinfo->rx_lock, flags);
- npinfo->rx_np = NULL;
- npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
- spin_unlock_irqrestore(&npinfo->rx_lock, flags);
- }
+ if (!np->dev)
+ return;
+
+ npinfo = np->dev->npinfo;
+ if (npinfo) {
+ if (npinfo->rx_np == np) {
+ spin_lock_irqsave(&npinfo->rx_lock, flags);
+ npinfo->rx_np = NULL;
+ npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
+ spin_unlock_irqrestore(&npinfo->rx_lock, flags);
+ }
- np->dev->npinfo = NULL;
- if (atomic_dec_and_test(&npinfo->refcnt)) {
- skb_queue_purge(&npinfo->arp_tx);
- skb_queue_purge(&npinfo->txq);
+ np->dev->npinfo = NULL;
+ if (atomic_dec_and_test(&npinfo->refcnt)) {
+ skb_queue_purge(&npinfo->arp_tx);
+ skb_queue_purge(&npinfo->txq);
+ if (delayed_work_pending(&npinfo->tx_work)) {
cancel_rearming_delayed_work(&npinfo->tx_work);
flush_scheduled_work();
-
- kfree(npinfo);
}
- }
- dev_put(np->dev);
+ kfree(npinfo);
+ }
}
+ dev_put(np->dev);
np->dev = NULL;
}
--
1.5.0.6
next prev parent reply other threads:[~2007-05-30 13:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-26 15:40 [2.6.21.1] soft lockup when removing netconsole module Folkert van Heusden
2007-05-26 15:53 ` Parag Warudkar
2007-05-26 16:12 ` Thomas Gleixner
2007-05-26 16:17 ` Folkert van Heusden
2007-05-26 16:35 ` Thomas Gleixner
2007-05-26 16:49 ` Folkert van Heusden
2007-05-26 17:06 ` Thomas Gleixner
2007-05-26 17:12 ` Folkert van Heusden
2007-05-27 20:32 ` Matt Mackall
2007-05-29 7:56 ` Andrew Morton
2007-05-30 13:28 ` Jason Wessel [this message]
2007-05-30 20:38 ` [PATCH] " Folkert van Heusden
2007-06-12 11:02 ` Jarek Poplawski
2007-06-13 9:25 ` [PATCH] " Jarek Poplawski
2007-06-26 23:07 ` Andrew Morton
2007-06-27 0:46 ` Wessel, Jason
2007-06-27 1:00 ` Andrew Morton
2007-06-27 7:24 ` Jarek Poplawski
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=465D7BE9.70702@windriver.com \
--to=jason.wessel@windriver.com \
--cc=akpm@linux-foundation.org \
--cc=folkert@vanheusden.com \
--cc=jarkao2@o2.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
/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