Re: [patch] net, 8139too.c: fix netpoll deadlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Feb 2007 11:30:25 +0900 (JST), Atsushi Nemoto <[email protected]> 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 <[email protected]>
---
--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux