Is the amd-pstate driver included in 5.17-rc1 kernel?

Everything seems to be fine
I’ve got a question. Maybe wrong place to ask, if so - forgive me
Is amd-pstate driver included in 5.17-rc1 kernel? I don’t quite understand how to change cpu scaling driver to amd_pstate that was introduced in mainline kernel 5.17
Thank you

Yes it is, see

How to enable I have no clue though. I would hope it’s done automatically on detection.
When you find out, would you mind telling?

2 Likes

I don’t know how much different the driver is in 5.17 than the community patch form the TKG Kernel build but according to that patch “Support for most non-Epyc processors has been disabled by default”. Personally I’ve tried it with amd_pstate.shared_mem=1 but I couldn’t get it working at all while using the community patch.

seems that u’re right because I couldn’t turn on the amd-pstate scaling driver even with amd_pstate.shared_mem=1

I just tried rc2 and it still uses acpi:

# cpupower frequency-info 
analyzing CPU 0:
  driver: acpi-cpufreq
...

It seems that the kernel was built with amd-pstate support:

zless /proc/config.gz

contains a line

CONFIG_X86_AMD_PSTATE=y

yes i checked this either and it seems like amd pstate driver should be included in the kernel but there is no amd-pstate driver tho :frowning:

What computer are you using? I think the BIOS needs to expose some interface of the CPU [1]. I have an Lenovo L14 (AMD) Gen 1 with an 4750U.

From the documentation [2]:

+The amd-pstate initialization will fail if the _CPC in ACPI SBIOS is
+not existed at the detected processor, and it uses acpi_cpc_valid to
+check the _CPC existence.

So at this point I think the most likely explanation is that Lenovo just needlessly locked down some necessary interface.

[1] AMD P-State Driver To Premiere In Linux 5.17 With Aim To Deliver Better Power Efficiency - Phoronix
[2] LKML: Huang Rui: [PATCH v7 13/14] Documentation: amd-pstate: Add AMD P-State driver introduction

Kernel documentation states option for shared memory support is currently disabled to address a performance issue:

amd-pstate CPU Performance Scaling Driver — The Linux Kernel documentation

Kernel Module Options for amd-pstate

shared_mem Use a module param (shared_mem) to enable related processors manually with amd_pstate.shared_mem=1. Due to the performance issue on the processors with Shared Memory Support, so we disable it for the moment and will enable this by default once we address performance issue on this solution.

The way to check whether current processor is Full MSR Support or Shared Memory Support :

lscpu | grep cppc

If CPU Flags have cppc, then this processor supports Full MSR Support. Otherwise it supports Shared Memory Support.

lscpu says cppc and msr:

  Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_go
                       od nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy sv
                       m extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate
                        ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc 
                       cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter 
                       pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca

I did some more digging and found that modinfo amd_pstate says “shared_mem:enable” and I can’t even disable it by setting the kernel parameter amd_pstate.shared_mem=0.

amd_pstate.shared_mem also does not appear in sysctl and modprobe amd_pstate shared_mem=1 does nothing.

It seems necessary to add AMD to the configuration file of mkinitcpio_ Pstate kernel module, but AMD_ The benefit of pstate seems to be very low. Even if the CPU runs at 550MHz, the power consumption will not be reduced much. Even if all hard disks are turned off, the minimum power consumption of 5800x and b550 platforms is about 75W (measured by hardware power meter).

I enabled amd_pstate.shared_mem=1 in grub config and checked:

sudo cpupower frequency-info        
analyzing CPU 0:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 131 us
  hardware limits: 550 MHz - 4.21 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 550 MHz and 4.21 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 647 MHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  2800MHz
    Pstate-P2:  2200MHz

But I got the two error messages in the log:

journalctl --no-pager -p 3 -b                                                                                                                                                                                            8s
Mai 20 17:50:22 zesko systemd-udevd[425]: could not read from '/sys/module/pcc_cpufreq/initstate': No such device
Mai 20 17:50:23 zesko systemd-udevd[436]: could not read from '/sys/module/pcc_cpufreq/initstate': No such device

I think these error messages are related to amd-pstate or not?

Linux Kernel:

5.17.9-1-MANJARO

I disabled amd-pstate, these error messages are gone.

Seems Manjaro’s (also Arch’s?) 5.18 kernel comes with CONFIG_X86_AMD_PSTATE=m, so using amd_pstate takes some extra steps now.