Skip to content

⚡️kernel: feed task-liveness watchdog every 3 s instead of every second#1660

Open
Coral-coder wants to merge 2 commits into
coredevices:mainfrom
Coral-coder:pr/watchdog-cadence
Open

⚡️kernel: feed task-liveness watchdog every 3 s instead of every second#1660
Coral-coder wants to merge 2 commits into
coredevices:mainfrom
Coral-coder:pr/watchdog-cadence

Conversation

@Coral-coder

@Coral-coder Coral-coder commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Power tweak — one of a series of idle-wakeup reductions that let the SoC spend more time in deep sleep. Companion PRs: #1658 · #1659 · #1660 · #1661 · #1662 · #1663.

What

Two related cadence changes, one per commit:

  1. Task-liveness watchdog feeds: 1 s → 3 s. The hardware watchdog timeout is 8–10 s depending on platform; feeding the liveness bits every second is 3× more often than needed. At 3 s cadence a genuinely-hung task is still detected with ≥5 s of margin before the hardware timeout.
  2. KernelMain idle event timeout: 1 s → 3 s. KernelMain's event loop woke every second just to check in with the watchdog; with feeds at 3 s it only needs to wake at the same cadence.

Why

On an otherwise-idle watch these two are a steady 2 wakeups/second that serve no purpose beyond watchdog bookkeeping. This cuts them to ~0.7/s combined.

Testing

Full unit suite passes; field-tested on SF32LB52 (Obelix) alongside the other idle-wakeup changes — no watchdog resets over multi-day soak, hang detection verified still working via a deliberately-stalled task.

Coral-coder and others added 2 commits July 3, 2026 13:53
…cond

Three always-on per-second callbacks existed purely to set task liveness
bits (NewTimers, KernelBG idle, PULSE idle) for the task watchdog. The
hardware watchdog allows 10s between feeds on SF32LB52 and 8s on nRF52,
and the bit-gated feed only needs every watched task to check in within
that window, so a 3-second cadence keeps at least ~5s of margin while
cutting these callbacks' wakeups by two thirds. Busy tasks still check
in far more often as a side effect of doing work; this only changes the
idle cadence.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ara Michelle <coral-coder@proton.me>
(cherry picked from commit 454fb05)
The launcher event loop woke every second even with no events pending,
purely so the loop iteration could refresh KernelMain's watchdog bit.
Events wake the loop immediately regardless of the timeout, so stretch
the idle timeout to 3 seconds, matching the other task liveness feeds
and keeping ~5s of margin against the shortest (8s, nRF52) hardware
watchdog window.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ara Michelle <coral-coder@proton.me>
(cherry picked from commit a246fbf)
@Coral-coder Coral-coder changed the title Pr/watchdog cadence kernel: feed task-liveness watchdog every 3 s instead of every second Jul 3, 2026
@Coral-coder Coral-coder changed the title kernel: feed task-liveness watchdog every 3 s instead of every second ⚡️kernel: feed task-liveness watchdog every 3 s instead of every second Jul 9, 2026
Comment on lines +596 to +599
// The timeout exists only to refresh the watchdog bit above; events wake
// the loop immediately. 3s keeps ~5s of margin against the shortest (8s)
// hardware watchdog while letting an idle KernelMain sleep 3x longer.
if (event_take_timeout(&e, 3000)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not touch this (yet), task watchdog needs a bit of love first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It very well did, but it seems to work fine these past 2 weeks.

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.

2 participants