[PATCH] prevent 'BUG: sleeping function called from invalid context' in arch_reset()
u.kleine-koenig at pengutronix.de
Mon Dec 6 11:13:43 EST 2010
[extended the audience, some context: arch/arm/plat-mxc currently uses
a clk_enable in arch_reset which might sleep]
On Mon, Nov 29, 2010 at 10:58:33AM +0100, Uwe Kleine-König wrote:
> Hello Lothar,
> On Mon, Nov 29, 2010 at 10:25:34AM +0100, Lothar Waßmann wrote:
> > arch_reset() may be called from interrupt context (e.g. induced by
> > SYSRQ-B), thus clk_get() and clk_enable() must not be called from
> > within arch_reset(). Move these calls to mxc_arch_reset_init().
> I wonder if SYSRQ-B is the only way to trigger that. And if yes if that
> could be "fixed" to allow sleeping?!
Hmmm, the comment for emergency_restart() says:
* emergency_restart - reboot the system
* Without shutting down any hardware or taking any locks
* reboot the system. This is called when we know we are in
* trouble so this is our best effort to reboot. This is
* safe to call in interrupt context.
emergency_restart has several callers apart from sysrq (watchdog, ocfs2,
kdb, panic), so I think allowing to sleep isn't that easy.
Moreover the sysrq function is called with the uart port's lock hold,
that would need fixing in the serial driver. I found the same problem
in amba-pl011 (the only driver I checked), so this seems to be a big
task. Sysrq holds a lock, too, while calling the handler.
I still think it's wrong to enable the watchdog clock unconditionally
during boot and wonder if that sleep in atomic can just be ignored?!
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-arm-kernel