[patch] netpoll: fix netpoll lockup

From: Ingo Molnar
Date: Tue Dec 12 2006 - 11:24:26 EST



* Linus Torvalds <torvalds@xxxxxxxx> wrote:

> On Tue, 12 Dec 2006, Ingo Molnar wrote:
> >
> > current -git doesnt boot on my laptop due to the following netpoll
> > breakages:
> >
> > - unlock the tx lock in the else branch too ...
> > - use irq-safe locking instead of bh-safe locking, netpoll is
> > often called from irq context.
>
> This one doesn't apply for me any more, probably because David checked
> in the patch from Andrew that fixed at least _part_ of the problem.
>
> Davem, Ingo, Herbert, can you verify whether the fixes in the current
> -git tree replace this patch from Ingo, or whether Ingo's patch is
> still needed and just needs to be refreshed.

the first half of it is still needed - find the delta patch ontop of
current -git below.

Ingo

------------------------>
Subject: [patch] netpoll: fix netpoll lockup
From: Ingo Molnar <mingo@xxxxxxx>

current -git doesnt boot on my laptop due to netpoll
not unlocking the tx lock in the else branch.

booted this up on my laptop with lockdep enabled and there are
no locking complaints and it works fine.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
net/core/netpoll.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-hres-timers.q/net/core/netpoll.c
===================================================================
--- linux-hres-timers.q.orig/net/core/netpoll.c
+++ linux-hres-timers.q/net/core/netpoll.c
@@ -55,6 +55,7 @@ static void queue_process(struct work_st
struct netpoll_info *npinfo =
container_of(work, struct netpoll_info, tx_work.work);
struct sk_buff *skb;
+ unsigned long flags;

while ((skb = skb_dequeue(&npinfo->txq))) {
struct net_device *dev = skb->dev;
@@ -64,15 +65,19 @@ static void queue_process(struct work_st
continue;
}

- netif_tx_lock_bh(dev);
+ local_irq_save(flags);
+ netif_tx_lock(dev);
if (netif_queue_stopped(dev) ||
dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) {
skb_queue_head(&npinfo->txq, skb);
- netif_tx_unlock_bh(dev);
+ netif_tx_unlock(dev);
+ local_irq_restore(flags);

schedule_delayed_work(&npinfo->tx_work, HZ/10);
return;
}
+ netif_tx_unlock(dev);
+ local_irq_restore(flags);
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/