Skip to content

fix: correctly map amd zen cpu core temps#1583

Open
unlimitedsola wants to merge 1 commit intoaristocratos:mainfrom
sola-contrib:amd-temp-fix
Open

fix: correctly map amd zen cpu core temps#1583
unlimitedsola wants to merge 1 commit intoaristocratos:mainfrom
sola-contrib:amd-temp-fix

Conversation

@unlimitedsola
Copy link
Copy Markdown

Fixes: #1582, more detail in the linked issue.

Note: original code generated by AI, all code has been reviewed, vetted, and tested by me.

The approach is to divide core ids evenly by sensor count, taken from htop.

Before (incorrect temp on the core with load):
image

After:
image

On AMD multi-CCD CPUs (e.g. Ryzen 5950X), btop++ incorrectly maps
per-CCD temperature sensors to CPU cores. `Tccd1` is shown for
even-numbered cores (0, 2, 4, 6, ...) and `Tccd2` for odd-numbered cores
(1, 3, 5, 7, ...), when the correct mapping is `Tccd1` → cores 0–7 (and
their SMT siblings 16–23) and `Tccd2` → cores 8–15 (and their SMT
siblings 24–31).
@aristocratos
Copy link
Copy Markdown
Owner

And how does this fair on non AMD cpus?
Considering this is changing the implementation for all cpus.

@unlimitedsola
Copy link
Copy Markdown
Author

unlimitedsola commented Mar 24, 2026

And how does this fair on non AMD cpus? Considering this is changing the implementation for all cpus.

@aristocratos I'm expecting this won't change the behavior of CPUs that reports core_sensors.size() == core_map.size() or CPUs that only reports one sensor. Because in those cases core_map[cpu_id] = core_id * num_sensors / (max_core + 1); should always equal to the core_id or always be zero.

I'm not aware of CPUs that alternates the core temps, would be happy to know if that's an actual case that we need to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect AMD Zen CPU core temps

2 participants