[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20070216.133322.48797866.nemoto@toshiba-tops.co.jp>
Date: Fri, 16 Feb 2007 13:33:22 +0900 (JST)
From: Atsushi Nemoto <anemo@....ocn.ne.jp>
To: linux-kernel@...r.kernel.org
Cc: mingo@...e.hu, romieu@...zoreil.com, jeff@...zik.org,
torvalds@...l.org, akpm@...l.org, davem@...emloft.net,
tglx@...utronix.de
Subject: Re: [patch] net, 8139too.c: fix netpoll deadlock
On Wed, 14 Feb 2007 11:30:25 +0900 (JST), Atsushi Nemoto <anemo@....ocn.ne.jp> wrote:
> > hm, this isnt really about NAPI polling, but about the
> > netconsole/netpoll/netdump poll_controller() handler.
> >
> > with netconsole, printk can be called from IRQ context (and is
> > frequently from IRQ context during bootup or module initialization), so
> > a BH rule isnt enough for them.
>
> I see NAPI poll routine might be called with interrupt disabled.
>
> Many (all?) NAPI drivers call netif_receive_skb() from its poll
> routine (as described in NAPI-HOWTO.txt), but I thought
> netif_receive_skb() cannot be called from irq context or irq disabled.
> So it seems the problem is not solved completely. Or am I missing
> something?
Any comments for this issue? If my understanding was correct, I think
add some checking to netif_receive_skb() is better then fixing all
poll routines. Is this patch acceptable?
Subject: fix irq problem with NAPI + NETPOLL
It seems netif_receive_skb() was designed not to call from irq
context, but NAPI + NETPOLL break this rule. If netif_receive_skb()
was called from irq context, redirect to netif_rx() instead of
processing the skb in that context.
Signed-off-by: Atsushi Nemoto <anemo@....ocn.ne.jp>
---
--- linux-2.6.20/net/core/dev.c 2007-02-05 03:44:54.000000000 +0900
+++ linux/net/core/dev.c 2007-02-16 13:19:06.000000000 +0900
@@ -1769,8 +1769,15 @@ int netif_receive_skb(struct sk_buff *sk
__be16 type;
/* if we've gotten here through NAPI, check netpoll */
- if (skb->dev->poll && netpoll_rx(skb))
- return NET_RX_DROP;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ if (skb->dev->poll && skb->dev->poll_controller) {
+ /* NAPI poll might be called in irq context on NETPOLL */
+ if (in_irq() || irqs_disabled())
+ return netif_rx(skb);
+ if (netpoll_rx(skb))
+ return NET_RX_DROP;
+ }
+#endif
if (!skb->tstamp.off_sec)
net_timestamp(skb);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists