From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Li Date: Tue, 12 Mar 2019 09:19:32 +0000 Subject: Re: Is it possible to reset graphics controller on reboot in a framebuffer driver? Message-Id: <20190312091932.GA17859@localhost.localdomain> List-Id: References: <20190307051641.GA7012@localhost.localdomain> <871s3jm532.fsf@intel.com> <20190307213759.GA14798@localhost.localdomain> <20190308103536.GA17258@localhost.localdomain> In-Reply-To: <20190308103536.GA17258@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Geert Uytterhoeven Cc: Jani Nikula , Linux Fbdev development list , DRI Development , Linux Kernel Mailing List , Bartlomiej Zolnierkiewicz , Sudip Mukherjee , Teddy Wang 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 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