Hello,
I noticed that using my custom kernel build following Gentoo’s guide on customizing linux kernel for Ryzen, I was able to get more accurate temperature readings from btop.
I think this might be related to one of the kernel configurations, but I’m unable to pin point which one. I have tried to use the default the default kernel and load k10temp module at boot time, but it doesn’t seem to change the temperature reading.
Would like to have some help on figure this out to be able to eventually upstream this to NixOS or nixos-hardware.
NixOS linux kernel overlay configuration
final: prev: let
inherit (final) lib;
in {
linuxPackages = final.linuxPackagesFor (
prev.linuxPackages.kernel.override {
# TODO: The error message is quite unintuitive, maybe improve it?
# https://github.com/NixOS/nixpkgs/issues/82951
structuredExtraConfig = with lib.kernel; {
# optimisation for ryzen 7
# https://wiki.gentoo.org/wiki/Ryzen
SMP = yes;
X86_X2APIC = yes;
X86_AMD_PLATFORM_DEVICE = yes;
# Cherry pick my CPU support
PROCESSOR_SELECT = yes;
CPU_SUP_AMD = yes;
# Disable intel CPU support
CPU_SUP_INTEL = no;
INTEL_HFI_THERMAL = lib.mkForce unset;
INTEL_IDLE = lib.mkForce unset;
INTEL_TDX_GUEST = lib.mkForce unset;
POWER_RESET_GPIO = lib.mkForce unset;
POWER_RESET_GPIO_RESTART = lib.mkForce unset;
TDX_GUEST_DRIVER = lib.mkForce unset;
X86_INTEL_TSX_MODE_AUTO = lib.mkForce unset;
X86_SGX = lib.mkForce unset;
X86_SGX_KVM = lib.mkForce unset;
SCHED_MC = yes;
X86_MCE = yes;
X86_MCE_AMD = yes;
PERF_EVENTS_INTEL_RAPL = yes;
X86_AMD_PSTATE = yes;
X86_POWERNOW_K8 = no;
# With amd_pstate=active ondemand won't be available anyway.
# Without more testing, we should accept the claim that its more power efficient and stick to it
CPU_FREQ = yes;
X86_INTEL_PSTATE = lib.mkForce no;
CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = lib.mkForce no;
CPU_FREQ_DEFAULT_GOV_ONDEMAND = yes;
# ERROR: could not insert 'amd_freq_sensitivity': No such device
X86_AMD_FREQ_SENSITIVITY = module;
# skipping firmware loading section since it's handled by other parts of nixos options
SENSORS_K10TEMP = yes;
IOMMU_SUPPORT = yes;
AMD_IOMMU = yes;
# additional chipset drivers
I2C_PIIX4 = yes;
PINCTRL = yes;
PINCTRL_AMD = yes;
CRYPTO = yes;
CRYPTO_HW = yes;
CRYPTO_DEV_CCP = yes;
CRYPTO_DEV_SP_CCP = yes;
CRYPTO_DEV_CCP_CRYPTO = yes;
CRYPTO_DEV_CCP_DD = yes;
CRYPTO_DEV_SP_PSP = yes;
# Power management controller
X86_PLATFORM_DEVICES = yes;
AMD_PMC = yes;
# Below is my config
DRM_AMDGPU = yes; # Recent AMD GPU
# Disable hypervisor guest
HYPERVISOR_GUEST = lib.mkForce no;
HYPERV = lib.mkForce unset;
DRM_HYPERV = lib.mkForce unset;
FB_HYPERV = lib.mkForce unset;
HVC_XEN = lib.mkForce unset;
HVC_XEN_FRONTEND = lib.mkForce unset;
KVM_GUEST = lib.mkForce unset;
MOUSE_PS2_VMMOUSE = lib.mkForce unset;
PARAVIRT = lib.mkForce unset;
PARAVIRT_SPINLOCKS = lib.mkForce unset;
PARAVIRT_TIME_ACCOUNTING = lib.mkForce unset;
PCI_XEN = lib.mkForce unset;
SWIOTLB_XEN = lib.mkForce unset;
XEN = lib.mkForce unset;
XEN_BACKEND = lib.mkForce unset;
XEN_BALLOON = lib.mkForce unset;
XEN_BALLOON_MEMORY_HOTPLUG = lib.mkForce unset;
XEN_DOM0 = lib.mkForce unset;
XEN_EFI = lib.mkForce unset;
XEN_HAVE_PVMMU = lib.mkForce unset;
XEN_MCE_LOG = lib.mkForce unset;
XEN_PVH = lib.mkForce unset;
XEN_PVHVM = lib.mkForce unset;
XEN_SAVE_RESTORE = lib.mkForce unset;
XEN_SYS_HYPERVISOR = lib.mkForce unset;
};
}
);
}
Which Linux distro are you using?
- host os:
Linux 6.12.54, NixOS, 25.05 (Warbler), 4d9bd66e - multi-user?:
yes - sandbox:
yes - version: `nix-env (Lix, like Nix) 2.93.3
Which BIOS version are you using?
0.0.3.9
Which Framework Laptop 13 model are you using?
AMD Ryzen™ 7040 Series