Re: [PATCH v5] driver core: Add timeout for device shutdown

From: Daniel Lezcano
Date: Thu Jun 13 2024 - 07:58:23 EST


On 13/06/2024 10:43, Greg KH wrote:
On Thu, Jun 13, 2024 at 08:32:26AM +0000, Soumya Khasnis wrote:
The device shutdown callbacks invoked during shutdown/reboot
are prone to errors depending on the device state or mishandling
by one or more driver. In order to prevent a device hang in such
scenarios, we bail out after a timeout while dumping a meaningful
call trace of the shutdown callback to kernel logs, which blocks
the shutdown or reboot process.

Again, this is not a "device shutdown" timeout, it is a "the whole
system has not shutdown this fast" timeout.

And in looking at my system, it doesn't shutdown in 10 seconds as it is
madly flushing a ton of stuff out to the disks, and they are slow
beasts. So your 10 second default would cause me data loss on my
workstation, not good!

Thanks for pointing this out. It is exactly what I was worried about ...

[ ... ]

Isn't this just a bug in your drivers? Why not fix them? Or if you
really have to have 10 seconds to shut down, use a watchdog timer that
you trigger from userspace and stop petting once you want to shut down.
Then, if it expires it will reset the machine, all of your policy
decisions would have been done in userspace, no need to get the kernel
involved at all.

+1


--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog