Skip to main content

Module level_liveness

Module level_liveness 

Source
Expand description

phase-509 P7 (RFC-0108 D8.1, D8.2) – which level an executor is, and whether every level of the image is alive.

A supervisor that owns a route per level, or feeds a hardware watchdog, needs two facts the executor alone knows:

  • Identity. Each executor runs one level (Executor::level): 0, the most urgent, unless its runner set another (Executor::set_level). The generated entry names each node’s level at build time (NROS_ENTRY_LEVEL_OF_<node> in nros_priority_plan.h) by the same rule the runner applies: a level’s index is its tier’s urgency order among the image’s tiers (until phase-509 P9 a level is a tier).
  • Liveness. Every spin of an executor checks its level in here, with the time (level_last_spin_us) and a spin count. The watchdog feed is take_every_level_alive: true only when every level of the image (0..level_count()) has checked in since the last true, which it then clears. A level blocked behind a stuck callback stops checking in, so the feed stops even while another level spins on (RFC-0108 D8.2).

The registry is per image (a static): the levels are separate executors on separate threads until P9, and the watchdog is per image. Lock-free, 32-bit atomics only, so it works on a core without 64-bit atomics; a time is the low 32 bits of the executor’s microsecond clock, so a consumer compares two of them with a wrapping difference (71 minutes of range).

Constants§

MAX_LEVELS
Levels one image can have: CONFIG_NROS_EXECUTOR_MAX_LEVELS’s upper end, one bit each in the check-in word.

Functions§

every_level_alive
Whether every level of the image has checked in since the last take_every_level_alive that returned true.
level_count
How many levels the image runs.
level_last_spin_us
The low 32 bits of the executor clock, in microseconds, at level’s latest spin; None when it has not spun (or spins with no clock).
level_spins
How many times level has spun.
set_level_count
State how many levels the image runs (its runner does, once, before the levels spin). false, and nothing changed, for 0 or more than MAX_LEVELS. An image that never states it has one level.
take_every_level_alive
The watchdog feed: true when every level has checked in since the last true, and the check-ins are then cleared; false, and nothing cleared, while any level has not.
tier_level
tier_level_by over a slice of priorities.
tier_level_by
The level of tier index of an image whose n tiers have the kernel priorities priority_of(0..n): its urgency order, 0 the most urgent, equal priorities in array order. Until phase-509 P9 a level is a tier, so this is how a runner places each tier’s executor (Executor::set_level). nros codegen entry writes NROS_ENTRY_LEVEL_OF_<node> by the same rule, over the same array. None when index is out of range.