diff --git a/assets/hardware_db.toml b/assets/hardware_db.toml new file mode 100644 index 0000000..3f5e480 --- /dev/null +++ b/assets/hardware_db.toml @@ -0,0 +1,117 @@ +[metadata] +version = "1.0.0" +updated = "2026-02-26" +description = "Hardware and Conflict Database for ember-tune Thermal Engine" + +# service collision + +[[conflicts]] +id = "tlp_vs_ppd" +services = ["tlp.service", "power-profiles-daemon.service"] +contention = "ACPI Platform Profile / EPP" +severity = "Critical" +fix_action = "MaskBoth" +help_text = "TLP and Power-Profiles-Daemon fight over power envelopes. Mask both to allow ember-tune deterministic control." + +[[conflicts]] +id = "thermal_logic_collision" +services = ["thermald.service", "throttled.service"] +contention = "RAPL / MSR / BD-PROCHOT" +severity = "High" +fix_action = "SuspendService" +help_text = "Thermald and Throttled create a 'register ping-pong' loop. Disable throttled; ember-tune will manage RAPL limits." + +[[conflicts]] +id = "freq_scaling_collision" +services = ["auto-cpufreq.service"] +contention = "CPU Scaling Governor" +severity = "Medium" +fix_action = "SuspendService" +help_text = "Auto-cpufreq interferes with deterministic Silicon Knee identification." + +# manufacturer wide logic + +[ecosystems.dell] +vendor_regex = "(Dell.*|Precision.*|Latitude.*|XPS.*)" +polling_cap_ms = 1000 +drivers = ["dell_smm_hwmon"] +fan_manual_mode_cmd = "dell-bios-fan-control 0" +fan_auto_mode_cmd = "dell-bios-fan-control 1" +safety_register = "0x1FC" # BD PROCHOT MSR + +[ecosystems.lenovo] +vendor_regex = "LENOVO" +lap_mode_path = "/sys/devices/platform/thinkpad_acpi/dytc_lapmode" +profiles_path = "/sys/firmware/acpi/platform_profile" +ec_write_required = false # Varies by model + +[ecosystems.asus] +vendor_regex = "ASUSTeK.*" +thermal_policy_path = "/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy" +policy_map = { Balanced = 0, Turbo = 1, Silent = 2 } + +[ecosystems.hp] +vendor_regex = "HP" +msr_lock_register = "0x610" +msr_lock_bit = 63 +fan_boost_path = "/sys/devices/platform/hp-wmi/hwmon/hwmon*/pwm1_enable" + +[ecosystems.framework] +vendor_regex = "Framework" +ec_tool = "ectool" +optimization = "Direct-FFI-SMC" + +# quirks: model quirks and fixes + +[[quirks]] +model_regex = "XPS 13 93.*" +id = "dell_bd_prochot_fix" +issue = "False Positive 400MHz Lock" +monitor_msr = "0x1FC" +reset_bit = 0 +action = "ClearBitOnSafeTemp" + +[[quirks]] +model_regex = "ThinkPad T14.*" +id = "lenovo_lap_throttling" +issue = "11W TDP Lock in Lap Mode" +trigger_path = "/sys/devices/platform/thinkpad_acpi/dytc_lapmode" +trigger_value = "1" +action = "AbortOnLapMode" + +[[quirks]] +model_regex = "ROG Zephyrus G14" +id = "asus_fan_hex_support" +issue = "Custom Hex Curve Interface" +target_path = "/sys/devices/platform/asus-nb-wmi/fan_curve" +format = "HexPair16" + +[[quirks]] +model_regex = "Spectre x360" +id = "hp_rapl_lockout" +issue = "Hardware MSR Lockout" +action = "WarnUserMSRLocked" + +# heuristic discovery + +[discovery.sensors] +temp_labels = ["Package id 0", "Tdie", "Tctl", "CPU Temperature"] +fan_labels = ["CPU Fan", "GPU Fan", "System Fan"] +hwmon_priority = ["coretemp", "zenpower", "k10temp", "dell_smm"] + +[discovery.actuators] +rapl_paths = ["intel-rapl:0", "package-0"] +amd_energy_paths = ["zenpower/energy1_input", "k10temp/energy1_input"] +governor_files = ["energy_performance_preference", "energy_performance_hint", "scaling_governor"] + +# env health verification + +[[preflight_checks]] +name = "MSR Write Access" +check_cmd = "grep -q 'msr.allow_writes=on' /proc/cmdline" +fail_help = "Add 'msr.allow_writes=on' to kernel parameters to allow power limit manipulation." + +[[preflight_checks]] +name = "Kernel Lockdown Status" +check_cmd = "cat /sys/kernel/security/lockdown | grep -q '\\[none\\]'" +fail_help = "Kernel Lockdown is enabled. MMIO/MSR actuators are restricted by the Linux Security Module." diff --git a/src/cli.rs b/src/cli.rs index 1716968..dcc3e5b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -40,7 +40,7 @@ pub struct Cli { #[arg( short, long, - help = "Writes high-resolution diagnostic logs to /tmp/ember-tune.log" + help = "Writes high-resolution diagnostic logs to /var/log/ember-tune.log" )] pub verbose: bool, diff --git a/src/main.rs b/src/main.rs index 987f8a8..e0f690a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,7 @@ fn print_summary_report(result: &OptimizationResult) { } fn setup_logging(verbose: bool) -> tracing_appender::non_blocking::WorkerGuard { - let file_appender = tracing_appender::rolling::never("/tmp", "ember-tune.log"); + let file_appender = tracing_appender::rolling::never("/var/log", "ember-tune.log"); let (non_blocking, guard) = tracing_appender::non_blocking(file_appender); let level = if verbose { tracing::Level::DEBUG } else { tracing::Level::INFO };