Skip to contentSkip to conversation

reboot: Add timeout for device shutdown

PATCH Superseded Soumya Khasnis 2 participants 2 messages May 29, 2024 Driver core

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reboot: Add timeout for device shutdown

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 which blocks the shutdown or reboot process.

Change-Id Ibfc63ca8f8aa45866cbe6b90401d438d95eca742
---
 drivers/base/Kconfig | 15 +++++++++++++++
 kernel/reboot.c      | 46 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 60 insertions(+), 1 deletion(-)
drivers/base/Kconfig +15 -0
index 2b8fd6bb7da0..d06e379b6281 100644
@@ -243,3 +243,18 @@ config FW_DEVLINK_SYNC_STATE_TIMEOUT
 	  work on.
 
 endmenu
+
+config DEVICE_SHUTDOWN_TIMEOUT
+	bool "device shutdown timeout"
+	default n
+	help
+	   Enable timeout for device shutdown. Helps in case device shutdown
+	   is hung during shoutdonw and reboot.
+
+
+config DEVICE_SHUTDOWN_TIMEOUT_SEC
+	int "device shutdown timeout in seconds"
+	default 5
+	depends on DEVICE_SHUTDOWN_TIMEOUT
+	help
+	  sets time for device shutdown timeout in seconds
kernel/reboot.c +45 -1

77 lines not on this page · raw message

Signature · 1 line
2.40.0
maintainer
#1 lore raw
Quoted 8 lines · Soumya Khasnis

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 which blocks the shutdown or reboot process.

Change-Id: Ibfc63ca8f8aa45866cbe6b90401d438d95eca742

Any reason you didn't run this through checkpatch.pl first?

:(