Files
RedBear-OS/local
vasilito bbb7c60777 driver-manager: v2.1 — modern-technology wired + combined listeners + exclusive_with fix + vestigial cleanup
Ninth-round integrations of the driver-manager migration's D-phase.
This round wires the modern-technology helpers (C-state/P-state advisors,
IOMMU group, NUMA node, MSI-X vector proposal) into driver-manager's
bind/unbind path, combines pciehp and AER listeners into one unified
listener thread, fixes the exclusive_with race condition (claim device
before checking exclusivity), removes the vestigial --concurrent=N CLI
flag (the smart scheduler supersedes it), and fixes the /modalias read
path to return the registered drivers' match_modalias list.

modern_tech.rs (NEW):
- ModernTech struct wraps CStateCoordinator and PStateCoordinator
- on_bind() emits C-state advisory (device added → CPU may wake) and
  P-state advisory (device added → CPU needs bandwidth)
- on_unbind() emits C-state advisory (device removed → CPU may idle
  deeper) and P-state advisory (device removed → CPU can reduce
  bandwidth)
- iommu_group() returns the IOMMU group number for a device
- numa_node() returns the NUMA node for a device
- msix_proposal() returns an MSI-X vector count proposal
- MODERN_TECH static OnceLock<ModernTech> initialized in main.rs
- 3 unit tests cover on_bind_skips_non_pci, on_bind_emits_advisories_for_pci,
  and default_constructor_works

main.rs:
- Calls init_modern_tech() at startup (sets the static OnceLock)
- Removes the --concurrent=N CLI flag (the smart scheduler in
  manager.rs::enumerate() supersedes it)
- Calls unified_events::spawn_unified_listener() instead of separate
  aer::spawn_aer_listener() and pciehp::spawn_pciehp_listener()
  (combines both into one thread)

config.rs:
- probe() now claims the device BEFORE checking exclusive_with
  (fixing the race where another probe could claim the device between
  the exclusivity check and the claim)
- exclusive_with is now atomic because the claim is atomic
- Adds on_bind() call to modern_tech with iommu_group, numa_node, and
  msix_proposal logged
- Adds on_unbind() call to modern_tech when a driver exits cleanly

unified_events.rs (NEW):
- UnifiedEvent enum wraps AerEvent and PciehpEvent
- spawn_unified_listener polls /scheme/acpi/aer and /scheme/pci/pciehp
  every 500ms from one thread (replaces the two separate polling loops)
- 2 unit tests cover event wrapping

scheme.rs:
- /modalias read path now returns the registered drivers'
  match_modalias list instead of a static hint message
- write() method now takes buf: &mut [u8] (mutable) for the write path
- openat allows O_RDONLY, libc::O_WRONLY, and libc::O_RDWR for the
  modalias write path

Docs:
- DRIVER-MANAGER-MIGRATION-PLAN.md v2.1 status table
- D5-AUDIT.md v2.1 update
- HARDWARE-VALIDATION-MATRIX.md driver-manager rows updated
- AGENTS.md + docs/README.md pointers to v2.1

Test totals: 51 tests across 4 crates, all passing.
§ 0.5 audit gate: 0 violations across 38 files.
2026-07-23 00:05:26 +09:00
..
2026-07-22 22:18:27 +09:00