From abce96f1e080da8d15d4697483fa86671e748aca Mon Sep 17 00:00:00 2001 From: Red Bear OS Builder Date: Sun, 7 Jun 2026 15:05:29 +0300 Subject: [PATCH] quirks/dmi: warn once when /scheme/acpi/dmi is absent (Gap 17) The Phase R10 audit found that dmi::read_dmi_info() returns Err(()) silently when acpid is not yet serving the DMI endpoint (the deep Blocker 2 work that wires acpid SMBIOS Type 0/1/2 parsing into a kernel-exposed scheme). Without an explicit log, every DMI lookup in every driver fails opaquely, masking the root cause for anyone triaging missing quirk rules. The log is rate-limited to a single warn! per process lifetime via a static AtomicBool, so the boot log is not flooded even when many drivers call read_dmi_info() during enumeration. The 120/120 unit tests in redox-driver-sys continue to pass. --- .../redox-driver-sys/source/src/quirks/dmi.rs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/local/recipes/drivers/redox-driver-sys/source/src/quirks/dmi.rs b/local/recipes/drivers/redox-driver-sys/source/src/quirks/dmi.rs index 304ad73069..8b0758ab96 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/quirks/dmi.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/quirks/dmi.rs @@ -171,13 +171,28 @@ pub struct DmiXhciQuirkRule { /// Read DMI/SMBIOS data from the ACPI scheme. /// -/// Returns `Err(())` if DMI data is not available (e.g., early boot, -/// no SMBIOS table, or acpid not running). +/// Returns `Err(())` if DMI data is not available. Phase R10 audit +/// (2026-06-07) — emits a single `log::warn!` per process on the first +/// failure, so the absence of `/scheme/acpi/dmi` is visible in the +/// boot log instead of silently producing empty DMI matches on every +/// lookup. pub fn read_dmi_info() -> Result { + use std::sync::atomic::{AtomicBool, Ordering}; + static WARNED: AtomicBool = AtomicBool::new(false); + let dmi_path = "/scheme/acpi/dmi"; match std::fs::read_to_string(dmi_path) { Ok(data) => parse_dmi_data(&data), - Err(_) => Err(()), + Err(e) => { + if !WARNED.swap(true, Ordering::Relaxed) { + log::warn!( + "quirks: cannot read DMI from {dmi_path}: {e}; \ + acpid DMI producer is not serving data, \ + all DMI-based rules are inert" + ); + } + Err(()) + } } }