Add deadman: prime a forced reboot before risky PCIe ops#47
Merged
Conversation
The dpv1 wedge class that needs a power cycle is a driver/PCIe hang where the kernel and systemd stay alive and keep petting the hardware watchdog, so systemd's RuntimeWatchdog never fires, yet a clean reboot hangs on the stuck device. Arm schedules a sysrq-b (emergency_restart) as a cancellable transient systemd timer that survives the SSH session; disarm cancels it on clean completion. Complements systemd's watchdog, which still catches a full kernel lock.
Contributor
disarm now confirms the timer is inactive via systemctl is-active before reporting success, and raises DeadmanError otherwise, so a failed stop (auth/D-Bus) can no longer leave a healthy host to reboot. arm refuses to replace an already-armed timer, so concurrent callers cannot silently cancel each other's protection. A query that cannot confirm inactive is treated as still-armed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites the reboot-priming safety net for dpv1 board operations (rescan/flash/register-probe) that was never committed.
Mechanism
The wedge class that needed manual power cycles is a driver/PCIe hang where the kernel and systemd stay alive — they keep petting the hardware watchdog, so systemd's
RuntimeWatchdogSecnever fires, yetsystemctl reboothangs on the stuck device. Recovery issysrq-b(emergency_restart()), which resets past the wedged driver.armschedules the reset as a cancellable transientsystemd-runtimer (survives the controlling SSH session);disarmcancels it. A full kernel lock (systemd dead) is still caught by systemd's own hardware watchdog, so the two are complementary.dau-utils-deadman {arm,disarm,status}plus anarmed()context manager.Verified live on the dpv1 host: arm creates a pending timer, disarm removes it, no reboot triggered. Pure command-builders are unit-tested; sudo/systemd side effects are exercised only via
--dry-runin tests.