David S. Miller 50fd4407b8 [NET]: Use local_irq_{save,restore}() in napi_complete().
Based upon a lockdep report.

Since ->poll() can be invoked from netpoll with interrupts
disabled, we must not unconditionally enable interrupts
in napi_complete().

Instead we must use local_irq_{save,restore}().

Noticed by Peter Zijlstra:

<irqs disabled>

  netpoll_poll()
    poll_napi()
      spin_trylock(&napi->poll_lock)
      poll_one_napi()
        napi->poll() := sky2_poll()
          napi_complete()
            local_irq_disable()
            local_irq_enable() <--- *BUG*

  <irq>
    irq_exit()
      do_softirq()
        net_rx_action()
          spin_lock(&napi->poll_lock) <--- Deadlock!

Because we still hold the lock....

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-27 17:42:50 -07:00
..
2008-03-06 12:18:25 +00:00
2008-02-13 14:44:03 +01:00
2008-03-06 08:13:47 -08:00
2008-03-07 08:42:28 -06:00
2008-03-07 16:56:54 -06:00
2008-03-06 17:23:15 +09:00
2008-03-11 17:11:55 +01:00
2008-03-26 16:51:09 -07:00
2008-02-06 10:41:16 -08:00