How to use AMD P-State in Linux

Still seems to be present for me.

Is this just a Manjaro change?

with manjaro kernel 5.17.12 , this is ok , still amd-pstate
( can change from start acpi-cpufreq to amd-pstate )

with blacklist acpi_cpufreq on boot , nor more acpi-cpufreq with 5.18.1 ( manjaro or archlinux )
cannot boot directly , and so cant change to amd-pstate

solution :
add amd_pstate in module in file mkinitcpio.conf → ok manjaro 5.18.1

I’m not getting this to work:

MODULES=(amd_pstate)

then sudo mkinitcpio -P

After reboot:

$ cpupower frequency-info 
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  CPUs which run at the same hardware frequency: Not Available
  CPUs which need to have their frequency coordinated by software: Not Available
  maximum transition latency:  Cannot determine or is not supported.
Not Available
  available cpufreq governors: Not Available
  Unable to determine current policy
  current CPU frequency: Unable to call hardware
  current CPU frequency:  Unable to call to kernel
  boost state support:
    Supported: yes
    Active: no

Have I missed any step?

Edit:

Trying to load amd_pstate manually:

# sudo modprobe -r acpi_cpufreq
# sudo modprobe amd_pstate
modprobe: ERROR: could not insert 'amd_pstate': No such device

What processor do you have?

Try loading the module like this for some more verbose output:

sudo modprobe amd_pstate dyndbg==pmf -v

Then check dmesg for any messages…

1 Like

you need to boot on current kernel or zen kernel , not LTS ( no amd_pstate module inside )
check also for boot grub kernel & UEFI motherboard ( CPPC on auto or enable )
ā€œamd_pstate.enable=1 amd_pstate.shared_mem=1ā€

sudo cpupower frequency-info
sudo turbostat
cat  /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
1 Like

The only thing I had to do was add amd_pstate.shared_mem=1 to the GRUB boot line, no messing around with modules or anything else.

1 Like
System:
  Kernel: 5.18.1-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.1.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-linux-zen
    root=UUID=920fc5a6-a736-43bf-a799-127e270776f0 rw
    lsm=landlock,lockdown,yama,apparmor,bpf loglevel=3
  Console: pty pts/6 wm: gnome-shell DM: GDM v: 42.0 Distro: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 82A2 v: Yoga Slim 7 14ARE05
    serial: <filter> Chassis: type: 10 v: Yoga Slim 7 14ARE05 serial: <filter>
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN serial: <filter>
    UEFI: LENOVO v: DMCN41WW date: 02/11/2022

Thanks @moson and @Stephane for the replies!

I’ll take your suggestions one at the time.

CPU:
  Info: model: AMD Ryzen 7 4800U with Radeon Graphics socket: FP6 bits: 64
    type: MT MCP arch: Zen 2 family: 0x17 (23) model-id: 0x60 (96) stepping: 1
    microcode: 0x8600106
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 8 MiB desc: 2x4 MiB
  Speed (MHz): avg: 1776 high: 1797 min/max: N/A base/boost: 1800/4300
    volts: 1.2 V ext-clock: 100 MHz cores: 1: 1466 2: 1797 3: 1797 4: 1797
    5: 1797 6: 1797 7: 1797 8: 1797 9: 1797 10: 1797 11: 1797 12: 1797
    13: 1797 14: 1797 15: 1797 16: 1797 bogomips: 57496

Here is the output of:

sudo modprobe amd_pstate dyndbg==pmf -v

# modprobe amd_pstate dyndbg==pmf -v 
     insmod /lib/modules/5.18.1-zen1-1-zen/kernel/drivers/cpufreq/amd_pstate.ko.zst dyndbg==pmf
modprobe: ERROR: could not insert 'amd_pstate': No such device

and this is what I get from dmesg:

[ 687.287933] amd_pstate:amd_pstate_init: amd_pstate: the _CPC object is not present in SBIOS

and also from journalctl:

arch kernel: amd_pstate:amd_pstate_init: amd_pstate: the _CPC object is not present in SBIOS

From the output posted above, does it mean that amd_pstat is not supported on this motherboard? I haven’t seen anything in the settings related to CPPC.

@jonathon
Would you be kind and have a look at my previous post?

Looks related to this:

Your UEFI might not support it, or doesn’t expose the option?

1 Like

I am inclined to the former.

If it is supported, I am not sure how I should make it visible.

I should reboot into --frimware-setup and have a look.

Yepp, the Lenovo’s don’t seem to have this options available in the BIOS and it seems to be disabled currently. You’d need to wait for another firmware/BIOS version.

I’ve actually created a thread on the lenovo forum’s about this some time ago.
You might want to add a post there hoping that this gets a bit more attention :wink:

https://forums.lenovo.com/t5/Other-Linux-Discussions/amd-pstate-driver-support-for-AMD-laptops/m-p/5135917

This tool might be useful:

But be warned, it exposes some very dangerous options! :smiling_imp:

3 Likes

That explains the whole thing then. It’ a pitty!

That’s great!

Thanks for the link! I’ll have a look.

My current firmware version:

UEFI: LENOVO v: DMCN41WW date: 02/11/2022

Hopefully / wishfully they release one soon with CPPC support.

Thanks @jonathon for the tips!
I’ll have a look!
Let’s see if can gather enough courage to implement such a thing :grimacing:

The current state of affairs on the system:

 cpupower frequency-info 
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  CPUs which run at the same hardware frequency: Not Available
  CPUs which need to have their frequency coordinated by software: Not Available
  maximum transition latency:  Cannot determine or is not supported.
Not Available
  available cpufreq governors: Not Available
  Unable to determine current policy
  current CPU frequency: Unable to call hardware
  current CPU frequency:  Unable to call to kernel
  boost state support:
    Supported: yes
    Active: no
 sudo turbostat 
turbostat version 21.05.04 - Len Brown <lenb@kernel.org>
CPUID(0): AuthenticAMD 0x10 CPUID levels
CPUID(1): family:model:stepping 0x17:60:1 (23:96:1) microcode 0x0
CPUID(0x80000000): max_extended_levels: 0x80000020
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX
RAPL: 234 sec. Joule Counter Range, at 280 Watts
/dev/cpu_dma_latency: 2000000000 usec (default)
current_driver: acpi_idle
current_governor: menu
current_governor_ro: menu
cpu6: POLL: CPUIDLE CORE POLL IDLE
cpu6: C1: ACPI FFH MWAIT 0x0
cpu6: C2: ACPI IOPORT 0x414
cpu6: C3: ACPI IOPORT 0x415
NSFOD /sys/devices/system/cpu/cpu6/cpufreq/scaling_driver
cpu0: MSR_RAPL_PWR_UNIT: 0x000a1003 (0.125000 Watts, 0.000015 Joules, 0.000977 sec.)
Core	CPU	Avg_MHz	Busy%	Bzy_MHz	TSC_MHz	IPC	IRQ	POLL	C1	C2	C3	POLL%	C1%	C2%	C3%	CorWatt	PkgWatt
-	-	15	0.72	2053	1797	1.01	2799	1	507	252	1622	0.00	0.36	0.73	98.22	0.08	0.31
0	0	6	0.39	1606	1797	0.26	368	0	42	6	317	0.00	0.23	0.11	99.33	0.00	0.31
0	1	4	0.23	1658	1797	0.20	180	0	29	41	116	0.00	0.30	7.71	91.79
1	2	75	3.15	2380	1797	1.38	263	1	59	29	40	0.00	0.62	0.54	95.70	0.03
1	3	5	0.32	1602	1797	0.58	78	0	12	11	41	0.00	0.14	0.22	99.34
2	4	9	0.42	2030	1797	0.38	99	0	10	7	64	0.00	0.14	0.14	99.31	0.00
2	5	7	0.36	2028	1797	0.30	73	0	4	10	35	0.00	0.06	0.20	99.39
3	6	2	0.11	1588	1797	0.24	79	0	17	16	41	0.00	0.30	0.30	99.30	0.00
3	7	2	0.12	1676	1797	0.22	96	0	7	7	76	0.00	0.13	0.14	99.62
4	8	11	0.71	1563	1797	1.23	161	0	15	7	105	0.00	0.15	0.13	99.03	0.00
4	9	4	0.24	1559	1797	0.29	141	0	56	51	29	0.00	0.83	0.97	97.98
5	10	2	0.14	1426	1797	0.24	105	0	18	9	76	0.00	0.18	0.14	99.56	0.00
5	11	3	0.21	1397	1797	0.53	133	0	68	14	55	0.00	0.95	0.26	98.60
6	12	28	1.37	2076	1797	1.12	174	0	26	6	76	0.00	0.32	0.12	98.22	0.01
6	13	14	0.83	1735	1797	0.23	159	0	46	4	96	0.00	0.34	0.08	98.78
7	14	55	2.30	2384	1797	1.26	265	0	78	32	62	0.00	0.82	0.57	96.35	0.02
7	15	9	0.59	1500	1797	0.22	425	0	20	2	393	0.00	0.20	0.04	99.30
cat  /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 
cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver: No such file or directory

Should I insert back acpi_cpufreq?

IMG_20220604_143206_DRO

Works here - CPPC settings are available using the universal browser thingy.

1 Like

Thanks for following up @jonathon!

That looks really promising!

I’ll have a read at the link you posted and hopefully I might be able to try it later this evening.

I had no idea this existed! I wasn’t able to turn on CPPC (Lenovo Flex14-API) but I was able to:

  • Undervolt the CPU
  • Switch the power mode from the stock 15-25w mode to 35w mode (45 and even 54w modes exist but scare me, considering this is a very thin device lol)
  • Actually allow the RAM to run at it’s rated clock speed instead of a locked lower frequency
  • Turn PCI-E power mode from ā€œpower saveā€ to balanced or performance which increased my WiFi download speed from ~260mbps to ~480mbps

Very neat tool :sunglasses:

2 Likes

I haven’t been able to get it to work on my HP laptop either with Ryzen 4700U

Edit: I don’t think it works on my lenovo either. It’s strange because i do see cppc in the output as a flag.

1 Like

Ifwe can get more confirmation about it I’ll add to the OP that certain lenovo and HP systems that ā€œshouldā€ support it don’t due to current BIOS limitations.

That lenovo thread looks good, does this apply to many systems from lenovo that generation?