Repository navigation
v2 supervisor: observation, tick and loop on the Kernel trait - #33
Conversation
Implements the spp3 open-loop thermal path from the behaviour specification: look-ahead delay, protected-drive power with the shunt topology, the coupled two-node backward-Euler model, the power-ceiling target, group minimum, attack/release smoothing and the 20 dB hard path and fail-safes. The model updates on the unit's own block clock, so its state and audio are bit-identical for any host slicing. Adds NEON kernels with scalar references (split-invariant lane accumulators), an alias-safe look-ahead line, an SPSC telemetry ring, a V/I sense front end with a program-to-sense delay estimator, and a placeholder gain unit for graph tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plugin now builds the unit the blob names (spp3, or the fail-safe for a missing, corrupt or mismatched blob), maps the supervisor's engine page for the heartbeat and a lock-free telemetry ring, reports the sense delay, and generates its .ttl from the variant table. spp3 follows the revised specification: a zero feed-forward speed-up factor holds the feed-forward reduction at unity, disabled thermal protection and CPMS closed-loop control are refused, and channels with CL thermal feedback run the open-loop kernel. sgv2-bench reports the cost per channel per quantum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Map the Kernel trait onto the kernel's speaker ownership contract: the owner holds the element lock on the card's "Speaker Protection" control, grants or renews protection by writing a lease length (30 ms, three ticks), withdraws it by writing 0, and loses it at once when its file closes. A lease that ran out is reported as Lapsed. Each V/I amp reports its faults through "<amp> Amp Fault Status"; over temperature, over current and a forced-off SDZ group are hard faults. Macaudio implements it with raw ioctls on /dev/snd/controlC<n>, with no alsa-lib. The tests check the ioctl numbers and structure sizes against the kernel UAPI on 64-bit Linux, the fault classification and the test double. The service may open only ALSA devices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test-blob writes a blob with synthetic spp3 values; engine-probe creates an engine page and prints the plugin's heartbeat and telemetry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Black-box reference runs show the unit adds no audio delay (output equals input bit-exactly at unity and the reported latency is 0): the look-ahead line now feeds the power meter, not the audio. The thermal start state is a parameter until the reference start state is settled, the published measured-power meter reads 0 W without a calibration overlay (the in-phase V/I power stays available to the supervisor), and a nonzero Rampout is refused until its behaviour is specified. The bring-up graph forces a 512-frame quantum so every unit block reaches the telemetry ring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows the specification's resolved engine choices: the thermal gain is a per-sample one-pole in linear gain (evaluated in closed form per block frame, so slicing invariance holds), and the model meters the undelayed protected drive. The audio stays undelayed. The hard path applies the unit's 20 dB at once at the controller cadence. kv-blob and rig-render are development tools for the differential rig. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements the specified parts of lsm2 for the Neo's model-only configuration: the exact 2x filterbank + look-ahead latency, the one-resonator current, displacement and velocity models (bilinear), coil power and the per-sample two-node thermal recurrence, four power averages with square-root budgets and the attenuation cap, sample-peak, displacement and velocity ratio candidates, the min combiner with fast and slow gain paths and slow-gain linking, and the 256-frame controller cadence. The unspecified filterbank, velocity masking and temperature knee use stand-ins that are never less restrictive than the specification permits, each marked TODO(SPEC). The plugin loads lsm2 blobs and the bench reports its cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements atsp from the behaviour specification: three speaker-type slots with channel masks, v^2/Rdc power of the protected drive, the coupled backward-Euler model, the infinite-ratio ceiling from the current magnet state against the unprotected drive, per-sample attack/release in linear gain, slot and global gain linking, and the 20 dB panic above the limit plus headroom, on the split-invariant block clock. Bypass and unclaimed channels are refused. The plugin loads atsp blobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # Cargo.lock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Observer turns the plugin's engine page, the speaker PCM's /proc status and the session helper's report into the lease observation, failing closed on every unknown: a running stream needs an advancing heartbeat no older than two unit quanta plus a tick, the PCM's owner must be the plugin's host, the plugin must run the published parameters without its fail-safe. Supervisor renews only on clean ticks, releases at once on any fault, latches released on a hard amp fault, treats a lapse as a faulted tick and exits on losing ownership. The binary publishes the blob, creates the engine page, takes the card's Speaker Protection control and runs the loop on absolute 10 ms deadlines; on a kernel without the control it exits without touching anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements the resolved thermal controller: 256-frame thermal updates with the trapezoidal-input, linear-decay coil and magnet filters, the feed-forward virtual coil with tau_ff = ThermalFFSpeedupFactor * tau_Tvc, the candidate sqrt(clamp((Tlim - ambient - theta_mg)/(theta_ff + 1), 0.01, 1)) smoothed per update with the 99 %-settling coefficient law, the latched hard path (arm above limit + headroom, disarm below the limit) selected by minimum, and two cascaded 5 ms per-sample dezipper stages. The model meters the protected drive through the 2 ms alignment history; pilot-enabled channels reserve the program headroom 1 - A_hi; Rampout is series resistance. Two readings settled against the reference traces and marked TODO(SPEC): the virtual coil sees the unprotected program (the spec's steady-state law, and the reference's 137 C pilot-mode equilibrium), and the smoother's state is the selected gain after a hard-path event. On the AID35 1 kHz thermal ramp (16 875 slices) the worst errors are 0.22 C / 0.69 C (woofer / tweeter T_OL), and 0.01-0.02 dB in sustained limiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atsp: block_frames = 0 means the graph has no reblocker, and the model updates once per host call, as the AID3-family graphs run it. lsm2: property 64008's runtime CPMS budgets are a blob input; when present they replace the four preset power hard limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the graph from voicing to amps per machine (J316, J616, J413, J700), generated by packaging/session/gen.py from machines.json: - PipeWire: the amps' ALSA sink and the sense source on the speaker card's PCMs 1 and 2, named hw:CARD=<card>,DEV=<n> so no aurora-audio rule matches them. They are internal, share one node.group, and run at a 512-frame quantum. The protect filter-chain sits around one sgv2 LV2 instance, with the program and the sense as its input channels. - WirePlumber: the monitor's own speaker and sense nodes are disabled. The machine's voicing goes in front of the protect stage, whose input takes the name the voicing graphs target. speakerguardd-session, a user service, links the amps and the sense into the graph only while the kernel grants protection, and unlinks them when it does not, so the amps' sink never starts before the grant. It checks the link set and the carrier and reports both to the supervisor every 50 ms. Tests cover the checks on synthetic graphs for every machine. The supervisor's unit takes its arguments from /etc/speakerguardd/speakerguardd.conf and gets the capabilities its loop needs. The SELinux module grants the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creates the user's session report file (empty, owned by the user, 0600) next to the engine page, so the unprivileged session helper rewrites it in place; writes /run/speakerguardd/granted as "<0|1> <mono_ns>" every tick and removes it on exit; sends READY=1 after the first tick and WATCHDOG=1 every 200 ms to NOTIFY_SOCKET. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per channel with CL feedback configured and a calibration record inside its ranges: V and I mean squares per sense window with the independent floors, the smoothed sqrt(V_ms/I_ms) resistance accepted in RebRange, T_CL from the calibration with alpha interpolated linearly between the 20 and 35 C coefficients, and the corrected limit clamp(Tlim + T_OL - T_CL, Tlim, Tlim + cap) smoothed over TlimErrDecayTime, returning to the plain limit on rejection. The feed-forward candidate and the hard path use the corrected limit. The calibration (SpTS, bound by data source) is a blob input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proptest properties for spp3, atsp, lsm2 and the fail-safe, on synthetic parameter sets only: 1. output bound: |out[n]| <= |in[n - latency]|, non-finite input leaves as 0 2. finite output and finite model state for NaN, Inf, subnormal and large input 3. bit-identical output and state across random 1..4096-frame host slicings, and reset returns a unit to its initial state 4. hard path: once the coil is past the hard limit at a block boundary, the group's next block leaves at least 20 dB down (spp3, atsp); the lsm2 temperature axis reaches its floor 5. truncated, corrupted, wrong-CRC and hostile blobs never panic, and what loads obeys 1 and 2 6. sense dropouts (missing, short, NaN, Inf, implausible) never raise the gain 7. no allocation in process() or telemetry(), per-thread counting allocator Ignored regression tests document five defects for lane B (huge finite input poisons the thermal state; FailSafe::process panics on short buffers and passes NaN/Inf; accepted blobs that disable protection; lsm2 never enforces TemperatureHardLimit; the non-finite fail-safe region depends on host slicing). Run them with --ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proven end to end on a J616s with digital silence: the supervisor grants, the session helper links the amps and the sense, and the amps' sink drives the group at a 512-frame quantum. - speakerguardd-session writes its report before it changes any link, and runs pw-link without waiting for it. Waiting for eighteen pw-link runs had let the report go stale, and the supervisor released. - Program links into the protect stage may come from any node, channel for channel, but never from the sense: whatever plays into the stage is protected. A tuning A/B sink beside the voicing is therefore not a fault. - The protect stage runs from the start (node.always-process). The plugin is instantiated only when its node runs, and the grant waits for the plugin's heartbeat, which would otherwise never come. - supervisor: the heartbeat is fresh if the sequence advanced within the staleness bound. The plugin beats once per 512-frame quantum (10.7 ms), longer than the 10 ms tick, so requiring an advance on every tick released the lease about once a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed at commit a47ae90. This is a COMMENT review.
I reviewed the supervisor crate (observe.rs, supervise.rs, lease.rs, main.rs) and the unit file against the kernel contract in aurora-silicon/linux#922. The kernel half of this branch is #35, which I commented on separately. cargo test passes on my host. I wrote small repro tests in a scratch copy (not pushed) for items 1, 3 and 4 below and for the clock race, and reran them on this commit.
What is sound.
- The lease value is a constant and never comes from input.
- Any exit, including SIGKILL and the OOM killer, closes the control file, and the kernel floors at once.
- A stalled supervisor is caught by the 30 ms lease. Assuming the kernel's lease work runs on time, the time to safe is about 42 ms worst case, inside the 53 ms budget. The kernel review explains why that assumption does not hold under RT load.
- A dead engine with a running PCM is released within two ticks.
- Hard amp faults latch released for the life of the process.
- A restart starts from a zeroed page and needs two clean ticks before it grants.
- Since the last round the session file is created for the user, and READY=1 and WATCHDOG=1 are sent from the loop.
Things that need to change before this can be qualified.
-
The heartbeat check fires on a healthy engine.
advancedin observe.rs (line 90) requires seq to grow between two consecutive 10 ms ticks, but the engine beats once per quantum.- With a healthy engine my test sees 6 faulted ticks per second at 512 frames, and 53 at 1024, the period the architecture calls proven. Each one withdraws protection and XRUN-stops the stream.
stale_nsis also fixed at 512 frames (main.rs line 227).- Please judge the age of
mono_nsagainst a bound derived from the real quantum, either published in the page or taken from the change inframes.
-
The PCM check trusts
--pcmand watches only sub0 of one FE (main.rs line 224). If--pcmnames an existing PCM that is not the speaker FE, it readsclosedforever. That counts as clean, so the lease renews whatever the engine does. The kernel gates every FE that drives the speaker back-end. Please enumerate every playback substream on the card, or get the speaker FE list from the kernel, and refuse to grant when the configured one is not the speaker FE. -
While the PCM is Closed, or Open by the stored pid, the lease renews with no evidence the engine is alive (observe.rs lines 95 to 97). The page magic survives the engine's death. Any opener's start passes the kernel trigger, and a raw
hw:client plays at operating gain until the next tick, about 10 ms. The robust fix is kernel side, binding the grant to an allowed tgid. Short of that, please consider not renewing while Closed, and letting PipeWire retry after the EPERM on start. -
The session report is the only proof that the plugin is in the path, and as written it is weak (main.rs lines 73 to 84).
- A future
mono_nsis fresh forever because ofsaturating_sub, for example a CLOCK_BOOTTIME stamp after any suspend. - The 250 ms staleness window breaks the stated bound of 2 quanta plus 10 ms.
- The report is not tied to the engine pid or the graph.
- Now that the helper has to rewrite the file in place, the supervisor can read it half written. An empty read releases spuriously, and a mixed read can parse as a report the helper never wrote.
Please reject future stamps, tighten the window, and add a sequence number, a checksum and the engine pid. Or give the helper a directory of its own so it can rename atomically.
- A future
-
The operating-point and machine checks are missing. KERNEL.md 2.3 says the supervisor checks the amps' operating point against the tuning before the first grant, and nothing does that check.
--paramsis also accepted on its CRC alone (main.rs lines 150 to 156), with no check that the blob is for this Mac, so a blob from another Mac with the same geometry is granted.
Smaller items.
- main.rs line 233 reads the clock before the page. A beat landing between the two reads as
mono_ns > nowand releases the lease spuriously. owner_pidin/procis the opening thread's id (task_pid(current)), while the page stores the process id. Map the tid to its Tgid before comparing.- The unit file still has no arguments in ExecStart, so the binary exits 78 and never restarts. RuntimeDirectory is still removed on every restart, which strands the plugin on an unlinked page until PipeWire reloads. Preserving it instead would truncate a live mapping in
EnginePage::create, which risks SIGBUS in the RT thread. - A missing control device at start, or EACCES, exits 78 as "not a v2 kernel" and is never retried. A card that registers late at boot leaves the speakers floored for that boot.
- An empty fault list counts as no fault. On SN012776 Macs please require the expected number of fault controls.
- The new
grantedfile is written and renamed every tick, with an allocation inside the real-time loop. It is left behind on SIGKILL, and it shows the supervisor's own belief rather than the kernel's state. Please keep it out of anything that decides routing, or move it off the tick path. - Please refuse an expected CRC of 0.
- The SELinux policy needs chown, fowner, setsched and ipc_lock for what main.rs now does.
The protect stage fed physical channel c to unit channel c and sense PCM
channel k to sense port k. That holds on the J616s, and nowhere else:
- J316: the speaker PCM is [LW1, RW1, LT, RT, LW2, RW2] (each amp's
TDM_CFG3 RX slot, read from regmap: 0 1 2 3 4 5 in that order, and the
order asahi-audio's j316 graph writes), but AID9's input lanes put the
unit in [L W, R W, L W, R W, L T, R T]. Unit channels 2 and 3 carry the
woofer thermal model and 4 and 5 the tweeter's, so the tweeters were metered with the woofers' parameters
and the second woofer pair with the tweeters'.
- J316 and J413 (MCA): each amp's sense is [I, V] on the sense PCM, the
DT's imon slot being below its vmon slot. Measured silently on sgv2k3
(digital silence, sense switches only): with every VSENSE switch off,
the odd channels go to a fixed idle pattern (J316 rms 2.0 against
7.4-9.3, J413 a -32/-128 square), and with one amp's ISENSE off, that
amp's even channel reads 0 (J316 Left Tweeter: ch 4; J413 Left
Tweeter: ch 4, Right Woofer: ch 2). The unit's bus is [V0, I0, ...],
so V and I were swapped on every channel.
machines.json now states both per machine: unit_channels (the unit
channel of each physical channel; default the same order) and
sense_pairs ("vi", the default, or "iv"). gen.py orders the filter-chain
inputs and outputs from them; the ALSA nodes, the AUX positions and the
session helper's channel-for-channel checks are unchanged. J616s and J700
generate the same files as before. The J413's speaker PCM is already in
AID13's lane order [LW, RW, LT, RT] (RX slots 0 1 2 3), so only its
pairs change.
Both also take the J616s sense headroom of 512 frames. Their sense is
period-batched MCA DMA (512-frame periods), and with no headroom the
follower (target 544, threshold 512) resynced on a single late cycle:
J316, about 8 times in a 10 min steady grant (delay 1024-1078); J413,
5 times in 10 cold starts (delay 904-1024). With 512, over 10 cold
starts each: 0 resyncs and 0 XRUNs on both. Over 10 min steady grants:
J413 0 and 0; J316 0 and 0 in one, and in another one XRUN (then its
restart resync) at the same instant as a crash-looping container's
network teardown on that machine.
The speaker keeps no headroom on J316: with the J616s' 256 frames it
underran 4 times in a 10 min steady grant and once in 10 cold starts,
against none in 10 min without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… headroom Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne generation Lane B6 on the M1 Pro: with the helper stopped and PipeWire restarted, the supervisor granted once, for 10 ms, on the stopped helper's last report, which was still inside its 100 ms window. - The helper names itself in every report (pid and its /proc start time). The supervisor's normal-priority reader thread checks that process every 1 ms: alive, not a zombie, started at that time, owned by the session user. The RT loop takes that verdict under a seqlock, and a check older than 12 ms vouches for nothing. A report without a writer (an older helper) is absent. - A report counts only if it was written after the current engine generation was first seen: the page's process changed, the page became valid, or its sequence restarted. The supervisor's own start begins a generation too. - The helper deletes its report on SIGTERM and SIGINT. - The helper subscribes to the card's control events and links or unlinks as soon as the grant changes, instead of at its next 50 ms period. That cuts the EPERM start retries the sink makes after each withdrawal (B6: about 40 per stall). A test replays B6's sequence: grant, the helper stops, PipeWire restarts with a new engine within the old report's window, both with the dead helper and with a pid that passes the liveness check. Nothing grants until a new helper writes after the new engine began. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…per reports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
ca0e414 is on v2-D/session. It is merged into v2-B/supervisor as b9cdc39, and into v2-B/live as 393e3e7 together with fa51878. Bug (lane B6, M1 Pro). The helper was stopped, then PipeWire was restarted. The supervisor then granted once, for 10 ms, on the stopped helper's last report, because that report was still within its freshness window. Fixes
Tests
Not yet run on hardware. Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com |
On law-restore-cl-reset the reference's pilot restarts after the reset: envelope at zero, phase from the reset frame, the low level. With the generator kept the output differs by 0.029; restarted, by 5.7e-7. The slice-invariance property sizes its fixed calls by the rate's update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
B2 on the J616s (393e3e7): on SIGTERM the helper deleted its report, so the supervisor released, but the amps stayed linked, and the sink retried its refused start about 13 times until PipeWire restarted. On SIGTERM and SIGINT the helper now also removes its amp and sense links. It waits at most 1 s in all, killing any pw-link still running, so it never hangs a shutdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…live Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rig law 6a: the reference re-seeds all three nodes to the hot split when its feed-forward node passes 1000 K, snapping T_OL down to about the limit while the drive continues (law-clip: 163 -> 140.7 C, repeating); full- scale drive on AID35 reaches it. By policy (coordinator) the engine keeps integrating the real state, holds the hard path while the node is out of range and flags Health::MODEL_RANGE. A test drives an AID35-like woofer at full scale for 20 s: flagged, held down, and T_OL never drops abruptly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note from lane B5 (spp3 engine, PR #37): spp3 now raises a new health bit, What it means. The spp3 feed-forward node is above 1000 K. In that state macOS re-seeds its thermal nodes to the hot split, which snaps T_OL down to about the limit (rig law 6a). The engine doesn't copy that. It keeps integrating the real state and holds the hard path while the flag is set. For the supervisor: treat MODEL_RANGE as informational. The engine is still protecting, so it must not trigger a release or a mode change. Log it, rate-limited. It clears by itself once the node is back in range. MODEL_FAULT (1 << 4) is unchanged: it still means the latched fail-safe. 🤖 Generated with Claude Code |
fb6db50 to
435dee0
Compare
spp3.rs takes the B5 side (the Goertzel pilot estimator replaces the broadband window). The sense diagnostics now carry the pilot-band powers before the gates (sense_v_ms, sense_i_ms) and the window resistance (sense_r_ohm). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SAFETY. In the J616s live test with real music over full scale (Tokyo Drifting at volume 0.99, about 36 W woofer drive, T_OL 129 C) accepted pilot windows read the coil cooler while it heated (T_CL 89 -> 33 C, window R 3.90 -> 3.46 ohm) and the correction relaxed the limit by up to +38.9 C, an effective limit near 179 C. Until that is understood against the reference, CL_RELAXATION is off: the closed loop runs, accepts windows and publishes T_CL, but never raises the limit above the base. TODO(SPEC). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the J616s, at full volume on YouTube with a busy browser, the Python helper missed its 50 ms window. Its report went past the 100 ms bound and the supervisor released, then re-granted 20 ms later, which is an audible dropout. - The report's staleness bound is now 500 ms. It bounds only the links and carrier checks, which guard against a foreign link. These stay strict: the writer's liveness (pid and start time, re-checked every 1 ms), the engine heartbeat, the PCM state and the owner. - The helper writes its report as soon as the link set or the carrier changes, as well as every 50 ms. It asks for SCHED_FIFO 5, or a lower nice, when the user's limits allow it, and runs at normal priority otherwise (as on the M1 Pro's default limits). Test: a live helper stalls 150 ms while the engine runs, and nothing releases. A report past 500 ms still releases, and a dead helper releases on the next tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te) and the engine, for persisting the hand-off across restarts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the J616s a PipeWire restart mid-playback reset the thermal model to its
cold 50 degC start while the woofer coils had just been at about 140-150 degC
modelled. The engine's hand-off record (B5) lived only in its own process.
- Engine page layout 3 adds two hand-off slots, stamped with
CLOCK_BOOTTIME (which counts a suspend): `saved` and `provided`.
- The plugin publishes every trusted record into `saved`. It skips any
run whose health is FAILSAFE, NO_PARAMS, CHANNEL_MISMATCH or
MODEL_FAULT, and save_state itself refuses a latched fault.
- The supervisor fills `provided`, tagged with the blob CRC.
- At stream start the plugin uses its own process slot first. A new
process, whose slot is empty, restores `provided` instead, if the CRC
matches its blob and the record is at most 10 minutes old.
`restore_state` ages it by the elapsed time with the model's own decay,
so the restored state is never colder than the aged value.
- The supervisor's thermal thread runs at normal priority, off the RT
loop, every 100 ms:
- It keeps a record only if it fits the blob's unit, channels and rate,
the page runs that blob, and the engine reports no fault (MODEL_RANGE
still protects, so it counts as trusted).
- It writes the record into `provided`.
- At most once a second it persists the record to
/run/speakerguardd/<uid>/thermal: root's, 0600, CRC-checked, and
bound to the boot id, the board, the blob CRC and the geometry.
- At start it offers that file only if all of those match and it is at
most 10 minutes old. A reboot or anything older falls back to the
parameters' start state.
- SELinux: read the kernel sysctls, for the boot id.
Tests:
- A full hot-to-restore path through the page: a new process restores
hot, the cold start plays louder, another blob gets nothing, a record
past 10 minutes starts cold, and an older record is aged by the unit's
decay.
- The persisted file: round trip, corruption, and every binding and age
refusal.
- Faulted, foreign or non-finite records are never kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on cap (CL_RELAXATION=false) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not starved B2 on the J616s (75797c0, 16 minutes of loud browser playback): one release with only links_ok and carrier_ok false, re-granted 18 ms later, while the helper reported nothing wrong. The report had read as absent. The likeliest cause is the writer-liveness verdict. It was a seqlock written by a normal-priority thread, so a checker preempted inside its write left the seqlock odd for all three of the RT loop's tries, and the loop counted the writer as not vouched. - The verdict is one word (pid, the low 31 bits of its start time, alive) plus the check time. The checker stores the verdict before the time, and the loop loads the time first. - The /proc reader thread asks for SCHED_FIFO 10, below the loop's 70. Desktop load can then no longer age its PCM or helper snapshots past 12 ms. A blocked /proc read only puts that thread to sleep. - A release now logs why the session report did not hold: no report, writer not vouched, written before this engine generation, dated in the future, stale, or the helper's own links/carrier 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged into |
This adds the supervisor's observation and tick logic, and the 10 ms loop, on lane D's
Kerneltrait. The branch is built on lane D'sv2-D/kernel-interface(07278ac) plusv2-B/engine(#31), so merge those first.What it does
observebuilds each tick's leaseObservationfrom three sources, each behind a trait:/procstatus (state andowner_pid);hw:access by any other process is treated as a bypass.superviseruns on the clean contract:ETIMEDOUTcounts as a faulted tick, so the lease is granted again only after two clean ticks.EPERMand any other kernel error end the loop. The exit closes the control file, which withdraws protection.speakerguardddoes the setup and runs the loop:/run/speakerguardd/params.binby atomic rename.Not yet
session. Until it exists, the supervisor never grants, which is the safe direction.Tests
16 supervisor tests run against the kernel double:
/procparsing.clippy is clean with
-D warningson aarch64 Linux and macOS.🤖 Generated with Claude Code