Re: Is it possible to reset graphics controller on reboot in a framebuffer driver?
From: Tom Li
Date: Tue Mar 12 2019 - 05:19:48 EST
On Fri, Mar 08, 2019 at 06:35:36PM +0800, Tom Li wrote:
> On Fri, Mar 08, 2019 at 10:13:58AM +0100, Geert Uytterhoeven wrote:
> > On Thu, Mar 7, 2019 at 10:38 PM Tom Li <tomli@xxxxxxxx> wrote:
> > > Nevertheless, does it mean there's no way to prevent it from happening if the
> > > user issues a emergency reboot? Like an automatic reboot after a kernel panic,
> > > or a SysRq-B reboot.
> >
> > If Linux performs a reboot, it calls the shutdown handlers.
> > I think that includes reboot on panic, or SysRq-B, but I'd have to check to
> > be 100% sure.
>
> Okay, glad to hear that. If it works for SysRq-B or panic reboot, I think
> it would be enough. After all, hard kernel crashes are rare nowadays, and
> most crashes are hard lockups. In case it happens, the user just presses
> the power button to halt.
As I suspected, emergency reboot via SysRq-B is a hard reboot and none of the
reboot handler will be called. I've put a for (;;) {} loop in .shutdown(), the
kernel would hang during a normal reboot, but a SysRq-B reboot will reset the
machine immediately.
Fortunately, I've found a way to stop trigger the bug in the driver, so no
shutdown handler is needed anymore.
Cheers,
Tom Li