Skip to content

Auto-derive HOT_THRESHOLD_C / THROTTLE_ENTER_C from caps.cpu_class #6

@zzallirog

Description

@zzallirog

Context

coolstep/daemon.py hard-codes thermal thresholds that were calibrated for
the dev target (ASUS TUF A15 / Ryzen 9 7940HS):

HOT_THRESHOLD_C = float(os.environ.get("COOLSTEP_HOT_THRESHOLD_C", 82.0))
THROTTLE_ENTER_C = float(os.environ.get("COOLSTEP_THROTTLE_ENTER_C", 90.0))
THROTTLE_EXIT_C = float(os.environ.get("COOLSTEP_THROTTLE_EXIT_C", 85.0))

The comments call this out explicitly: «82°C is conservative for AMD 7940HS
post-knee zone», «AMD 7940HS thermal trip ~95°C, knee ~85°C».

Env overrides work, but the user has to know what knee/trip mean for their
silicon and manually edit a drop-in. On Intel 13th-gen the picture is
different (e.g. i5-13500 has a Tjunction around 100°C, knee ~80-85°C
P-cores). Server Xeons / EPYC are different again.

What to do

Add a caps-derived default that respects manual env overrides:

def _default_hot_threshold_c(caps: PlatformCaps) -> float:
    """Conservative ~5-10°C below the vendor knee."""
    cpu_class = caps.cpu_class  # 'amd_ryzen_apu', 'intel_alder_lake', 'arm', ...
    return {
        "amd_ryzen_apu": 82.0,
        "amd_ryzen_desktop": 85.0,
        "intel_alder_lake": 80.0,
        "intel_raptor_lake": 82.0,
        "intel_xeon_server": 75.0,
        "amd_epyc_server": 75.0,
        "arm": 75.0,
    }.get(cpu_class, 80.0)  # generic fallback

User env override always wins. Two-line change in daemon startup + a small
mapping table in coolstep/compat/core.json (since we already centralise
hwmon driver sets and DMI hints there — same shape).

Acceptance

  • Threshold defaults derived from caps.cpu_class
  • Env override still wins
  • CI: each platform fixture asserts the threshold it would get
  • CHANGELOG note

Difficulty: small. ~40 LOC + per-fixture assertions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions