Files
RedBear-OS/drivers/acpid
Red Bear OS 8dd8fb3b20 acpid: harden AML handler — bounded stall, mutex owner-check, static cache, panic-free path, observability
Five daemon-local hardening items on top of the AML-mutex fix. acpid is
single-threaded and serves the `acpi` scheme on the same thread that
evaluates AML, so any way it can stall or die stalls or kills every
consumer. These reduce or bound each such way (verified against
local/reference/linux-7.1 ACPICA):

- stall(): refuse >255us and warn >100us instead of an unbounded CPU
  busy-spin on the serving thread (ACPICA exsystem.c:129-147). The spec
  caps Stall at 100us; a long busy-spin here would delay scheme requests.

- AML mutex release(): a release of a not-currently-held mutex, or by a
  non-owning thread, is now logged (ACPICA AE_NOT_ACQUIRED / owner
  mismatch, exmutex.c:287,376) rather than silently decrementing depth.

- Static processor-method cache: _PSS/_PSD/_CST/_CPC are fixed after boot
  but cpufreqd polls them; cache the first evaluation so later reads never
  re-run the AML interpreter under the global lock. Removes acpid's
  dominant recurring head-of-line source. Dynamic methods are not cached.

- Panic-free scheme path: every release_global_lock().expect(...) on the
  AML-evaluation path is now log-and-continue, and a result.ok()?.unwrap()
  that panicked on Ok(None) (absent method) is now `?`. A scheme-daemon
  panic kills the `acpi` scheme and wedges every consumer.

- Observability: log AML evaluations >=50ms and mutex-acquire timeouts —
  the early-warning signal before a stall becomes a wedge.

Context: the residual under-load boot wedge is NOT in acpid (a mutex-only
baseline wedges identically under load); it is head-of-line blocking in
the single-threaded initnsmgr. See
local/docs/INIT-NAMESPACE-MANAGER-SCALABILITY-PLAN.md and
local/docs/INITNSMGR-CONCURRENCY-DESIGN.md.
2026-07-21 08:33:26 +09:00
..
2026-04-27 15:57:46 +07:00