[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090417112553.21e1f2e5@hskinnemoen-d830>
Date: Fri, 17 Apr 2009 11:25:53 +0200
From: Haavard Skinnemoen <haavard.skinnemoen@...el.com>
To: David Miller <davem@...emloft.net>
Cc: thomas.petazzoni@...e-electrons.com, netdev@...r.kernel.org,
michael@...e-electrons.com
Subject: Re: [PATCH] macb: Add support of the netpoll API
David Miller wrote:
> From: Haavard Skinnemoen <haavard.skinnemoen@...el.com>
> Date: Fri, 17 Apr 2009 11:07:03 +0200
>
> > David Miller wrote:
> >> And in response to this Haavard explained the potential deadlock
> >> (sorry I deleted that email) and suggested to use local_irq_save()
> >>
> >> But that won't work either, because it doesn't prevent the interrupt
> >> handler from running on other cpus, it only prevents that on the
> >> local cpu.
> >
> > The interrupt handler takes bp->lock. Isn't that sufficient to prevent
> > it from running on other cpus?
>
> We don't necessarily hold bp->lock here, we could be called from
> the netpoll code. Another cpu could easily hold bp->lock and be
> in the middle of the interrupt handler.
Yes, but we're about to take it. poll_controller() disables interrupts
and calls the interrupt handler, which takes the lock. That's
essentially an open-coded spin_lock_irqsave().
Now, that will obviously deadlock too if we're called from within the
interrupt handler or some other place holding bp->lock...
I guess you're right -- we just have to be careful about calling
printk() from within the driver. But it seems a lot easier to just drop
the lock before dumping an error message than it is to work around that
disable_irq() deadlock. And if you're running with verbose debugging
enabled, you probably shouldn't be using netconsole anyway.
Haavard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists