Re: [patch] net: dev_watchdog() locking fix

From: Andrew Morton
Date: Mon Dec 11 2006 - 02:53:16 EST


On Sat, 09 Dec 2006 14:02:05 -0800 (PST)
David Miller <davem@xxxxxxxxxxxxx> wrote:

> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Date: Sat, 9 Dec 2006 10:59:52 +1100
>
> > On Fri, Dec 08, 2006 at 03:19:02PM -0800, Andrew Morton wrote:
> > >
> > > Like this?
> > >
> > > /* don't get messages out of order, and no recursion */
> > > if (skb_queue_len(&npinfo->txq) == 0 &&
> > > npinfo->poll_owner != smp_processor_id()) {
> > > local_bh_disable(); /* Where's netif_tx_trylock_bh()? */
> > > if (netif_tx_trylock(dev)) {
> > > /* try until next clock tick */
> > > for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
> > > tries > 0; --tries) {
> > > if (!netif_queue_stopped(dev))
> > > status = dev->hard_start_xmit(skb, dev);
> > >
> > > if (status == NETDEV_TX_OK)
> > > break;
> > >
> > > /* tickle device maybe there is some cleanup */
> > > netpoll_poll(np);
> > >
> > > udelay(USEC_PER_POLL);
> > > }
> > > netif_tx_unlock(dev);
> > > }
> > > local_bh_enable();
> > > }
> >
> > Looks good to me. Thanks Andrew!
>
> I've applied this patch, thanks a lot.

It spits a nasty during bringup

e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
forcedeth.c: Reverse Engineered nForce ethernet driver. Version 0.59.
netconsole: device eth0 not up yet, forcing it
e1000: eth0: e1000_watchdog: NIC Link is Up 100 Mbps Full Duplex
WARNING (!__warned) at kernel/softirq.c:137 local_bh_enable()

Call Trace:
[<ffffffff80235baf>] local_bh_enable+0x41/0xa3
[<ffffffff8045ab8e>] netpoll_send_skb+0x116/0x144
[<ffffffff8045b1ee>] netpoll_send_udp+0x263/0x271
[<ffffffff803d41ec>] write_msg+0x42/0x5e
[<ffffffff80230c9b>] __call_console_drivers+0x5f/0x70
[<ffffffff80230d19>] _call_console_drivers+0x6d/0x71
[<ffffffff802313f0>] release_console_sem+0x148/0x1ec
[<ffffffff802316ce>] register_console+0x1b1/0x1ba
[<ffffffff803d4178>] init_netconsole+0x54/0x68
[<ffffffff802071ae>] init+0x152/0x308
[<ffffffff804dac8b>] _spin_unlock_irq+0x14/0x30
[<ffffffff8022c15e>] schedule_tail+0x43/0x9f
[<ffffffff8020a758>] child_rip+0xa/0x12
[<ffffffff8020705c>] init+0x0/0x308
[<ffffffff8020a74e>] child_rip+0x0/0x12

because local irqs are disabled.
-
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/