Re: [PATCH] macb: Add support of the netpoll API

Haavard Skinnemoen
2009-04-16T10:31:09Z

Thomas Petazzoni wrote:
> Le Thu, 16 Apr 2009 11:07:53 +0200,
> Haavard Skinnemoen <haavard.skinnemoen@atmel.com> a écrit :
>
> > Hmm...is this safe? What if printk() is called from the macb interrupt
> > handler?
>
> I'm not sure, but that strategy is used in most drivers supporting the
> netpoll API (3c509.c, 8139cp.c, 8139too.c, b44.c, bfin_mac.c,
> bnx2x_main.c, etc.). It also seems to be the way suggested by netpoll
> author, http://oss.sgi.com/archives/netdev/2003-10/msg00800.html.
>
> disable_irq() only disables the macb IRQ line. Is that an issue for
> printk() execution ?

I'm worried about this potential deadlock:
macb_interrupt()
calls printk()
calls macb_poll_controller()
calls disable_irq()
calls synchronize_irq()
waits until macb_interrupt() returns, which will never happen

So I think it's safer to just use local_irq_save(). The interrupt
handler shouldn't run for long anyway since it uses NAPI for RX
processing, and it probably ought to use NAPI for TX processing too,
eventually.

Haavard