Skip to content

Add deadman: prime a forced reboot before risky PCIe ops#47

Merged
timkpaine merged 2 commits into
mainfrom
tkp/deadman
Jul 19, 2026
Merged

Add deadman: prime a forced reboot before risky PCIe ops#47
timkpaine merged 2 commits into
mainfrom
tkp/deadman

Conversation

@timkpaine

Copy link
Copy Markdown
Member

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 RuntimeWatchdogSec never fires, yet systemctl reboot hangs on the stuck device. Recovery is sysrq-b (emergency_restart()), which resets past the wedged driver.

  • arm schedules the reset as a cancellable transient systemd-run timer (survives the controlling SSH session); disarm cancels it. A full kernel lock (systemd dead) is still caught by systemd's own hardware watchdog, so the two are complementary.
  • CLI dau-utils-deadman {arm,disarm,status} plus an armed() 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-run in tests.

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.
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Test Results

20 tests  +14   20 ✅ +14   0s ⏱️ ±0s
 1 suites ± 0    0 💤 ± 0 
 1 files   ± 0    0 ❌ ± 0 

Results for commit 5e75ab0. ± Comparison against base commit e10d111.

♻️ This comment has been updated with latest results.

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.
@timkpaine
timkpaine merged commit ad80f75 into main Jul 19, 2026
2 checks passed
@timkpaine
timkpaine deleted the tkp/deadman branch July 19, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant