The incident: mid-session on battery the pstate held turbo down (~2.5 GHz, 60°C,
CPU pressure ~0 — the set never needed more). Plugging in on AC at 4% silently
lifted that limit; the SAME workload jumped to 4.4–4.5 GHz and 85–93°C with fans
maxed. Nothing was working harder — the platform just reset the frequency cap
underneath our "cool" mode, and the tooling never noticed. set_mode() was
fire-and-forget: it wrote the cap once and moved on.
Fix: treat the perf mode as DESIRED STATE and reconcile it whenever the platform
can drift it (AC/battery flip, resume-from-suspend), with a periodic drift check
as the safety net.
perf.py
- write_desired()/read_desired(): persist the user-chosen mode (~/.cache/
parvagues/perf-desired). "normal"/absent == maintenance off, so we never
fight a deliberate switch back to platform defaults.
- set_mode() records intent on every successful switch.
- on_ac(): mains state from /sys/class/power_supply/A*/online.
- reconcile(force): reassert desired if detect_mode() drifted (idempotent —
"cool holding" when already in force, so no thrash).
- run_watcher(): daemon loop. Reasserts (force) on a power-source edge and on
resume (detected via a monotonic-clock gap), settling 2s for the platform;
periodic force=False drift check otherwise. Seeds desired from the live mode
on startup so an already-cool session is maintained immediately.
bridge.py: launch run_watcher() as a daemon thread from `serve` (the always-on
--user service is the right home; the tray is just a face).
perf-tray.py: record intent (write_desired) on a successful tray switch too, so
both faces agree and the watcher respects tray-initiated changes.
Bonus: because "cool" also RT-schedules scsynth/sclang/Ardour/PipeWire, every
reassert re-guarantees audio-chain priority after a power event — cheap insurance
against post-transition xruns.
Validated: compiles; reconcile idempotent; force reassert exercises the real
perf-audio path (cool->cool, no disturbance); watcher thread confirmed live in
the daemon with "on_ac=True desired=cool". Real power-transition proof lands on
the next unplug/replug (logged to the bridge journal).
| Name |
Last commit
|
Last update |
|---|---|---|
| .gitea/workflows | Loading commit data... | |
| armada | Loading commit data... | |
| blocks | Loading commit data... | |
| blog | Loading commit data... | |
| copycat | Loading commit data... | |
| docs | Loading commit data... | |
| gifts | Loading commit data... | |
| lib-parvagues | Loading commit data... | |
| live | Loading commit data... | |
| output | Loading commit data... | |
| releases | Loading commit data... | |
| sandbox | Loading commit data... | |
| study | Loading commit data... | |
| test | Loading commit data... | |
| tools | Loading commit data... | |
| utils | Loading commit data... | |
| viz | Loading commit data... | |
| .gitignore | Loading commit data... | |
| BootTidal.hs | Loading commit data... | |
| BootTidal.hs.broken | Loading commit data... | |
| BootTidal.visuals.broken.hs | Loading commit data... | |
| CLAUDE.md | Loading commit data... | |
| LICENSE | Loading commit data... | |
| PatchBay_MultiChannel.xml | Loading commit data... | |
| PatchBay_Perf.xml | Loading commit data... | |
| PatchBay_Perf5.1.xml | Loading commit data... | |
| README.md | Loading commit data... | |
| backlog.md | Loading commit data... | |
| bullet_train.tidal | Loading commit data... | |
| collide.sh | Loading commit data... | |
| debug.tidal | Loading commit data... | |
| didacticpatternvisualizer.pde | Loading commit data... | |
| hello.sc | Loading commit data... | |
| init_midi.sh | Loading commit data... | |
| intro.md | Loading commit data... | |
| library.txt | Loading commit data... | |
| link_jack.sh | Loading commit data... | |
| link_samples.sh | Loading commit data... | |
| link_samples_all.txt | Loading commit data... | |
| main_fairbanks.scd | Loading commit data... | |
| notes.md | Loading commit data... | |
| perf-tray.py | Loading commit data... | |
| perf.sh | Loading commit data... | |
| samples.txt | Loading commit data... | |
| start_and_midi.scd | Loading commit data... | |
| test.tidal | Loading commit data... |