linrunner / TLP

TLP - Optimize Linux Laptop Battery Life
https://linrunner.de/tlp
GNU General Public License v2.0
2.66k stars 128 forks source link

Add support for the new AMD P-state performance scaling driver #630

Closed eternal-sorrow closed 1 year ago

eternal-sorrow commented 2 years ago

Is your feature request related to a problem? Please describe.

Linux 5.17 was released with a new AMD P-state driver.

Describe the solution you'd like

Add support of this driver in TLP.

Describe alternatives you've considered

There is a possibility that it does not add anything on top of the current acpi-cpufrec driver, so this is unneeded. I don't know about that.

Additional context

Kernel documentation

linrunner commented 2 years ago

Hi,

the linked specification is extremely scarce. I can neither see what is to be controlled here how, nor which value ranges the attributes have and if they are rw or ro.

Since I don't own AMD hardware, I can't implement anything here without much more input and sample output from your side.

eternal-sorrow commented 2 years ago

Okay, what do you need me to do?

linrunner commented 2 years ago

Let's begin with:

ls -Rl /sys/devices/system/cpu/
grep . $(find /sys/devices/system/cpu/ -type f)

Since this is going to be a long output, please post it via https://gist.github.com/

linrunner commented 2 years ago

Also

  sudo tlp-stat -s -p

please.

eternal-sorrow commented 2 years ago

I'm having problems trying to do that. I have amd-pstate built as a module. I tried to load this module with modprobe amd-pstate, and the command did not print any errors, but module does not show up in lsmod and rmmod amd-pstate prints "rmmod: ERROR: Module amd_pstate is not currently loaded`. I can still upload output of those commands, but I don't think it will be useful.

linrunner commented 2 years ago

Then let's see if there are additional contributors or even someone provides a working pull request.

adomixaszvers commented 2 years ago

Output of the commands on a machine with Ryzen 7 Pro 5850U https://gist.github.com/adomixaszvers/62fc4dd221de463f5b7d101db7328268

tribals commented 2 years ago

@linrunner Hello!

I'm interested in advancing this feature. I can report any needed information and do tests. I have Ryzen 3-based laptop.

Cold you please provide some guidance? What needs to be done for this to work?

linrunner commented 2 years ago

@tribals Fortunately, an AMD ThinkPad has found its way to my premises in the meantime. I'll be happy to get back to you as soon as there's something to test.

tribals commented 2 years ago

Great news! 🙂

harrykipper commented 2 years ago

afaik amd-pstate uses the same governors as acpi-cpufreq. I guess there's not much to change from tlp's perspective.

linrunner commented 2 years ago

Hi,

from what I read in the kernel docs there are only r/o attributes. I've added them to thetlp-stat -p output.

@harrykipper @adomixaszvers @eternal-sorrow @tribals Please test with the main branch and produce the output of

tlp-stat -s -p

Thanks in advance.

harrykipper commented 2 years ago
--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = LENOVO ThinkPad E14 Gen 3 20YECTO1WW
BIOS           = R1OET34W (1.13 )
OS Release     = Arch Linux
Kernel         = 5.19.0-S #1 SMP PREEMPT Thu Aug 11 11:18:32 BST 2022 x86_64
/proc/cmdline  = root=/dev/nvme0n1p2 resume=/dev/nvme0n1p3 thinkpad_acpi.fan_control=Y zswap.enabled=1 nmi_watchdog=0 drm.vblankoffdelay=1 snd_hda_intel.power_save=1 snd_hda_intel.power_save_controller=Y snd_ac97_codec.power_save=1 drm_kms_helper.poll=0 amdgpu.aspm=1 amdgpu.bapm=1 amdgpu.dpm=1 amdgpu.dc=1 amdgpu.dcfeaturemask=0x1 amdgpu.dcfeaturemask=0x80 amdgpu.dcfeaturemask=0x8 amdgpu.runpm=1 usbcore.autosuspend=2 btusb.enable_autosuspend=Y nvme_core.streams=Y nvme_core.force_apst=Y nvme_core.default_ps_max_latency_us=11276000 iwlmvm.power_scheme=3 amdgpu.ppfeaturemask=0xffffffff amdgpu.deep_color=1 iwlwifi.power_save=Y iwlwifi.power_level=5 iwlwifi.uapsd_disable=0 mitigations=off msr.allow_writes=on cryptomgr.notests no_timer_check noreplace-smp page_alloc.shuffle=1 rcu_nocbs=0-15 rcupdate.rcu_expedited=1 tsc=reliable rootfstype=f2fs
Init system    = systemd 
Boot mode      = UEFI
Sleep mode     = deep

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 16:35:13,    521 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 5800U with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = amd-pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  4507000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf          =      166 [%]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq              =  4507000 [kHz]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq =  1112000 [kHz]

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = (not available)

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = low-power
/sys/firmware/acpi/platform_profile_choices            = low-power balanced performance
/sys/devices/platform/thinkpad_acpi/dytc_lapmode       = 0
adomixaszvers commented 2 years ago
--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = LENOVO ThinkPad T14 Gen 2a 20XK007DMH
BIOS           = R1MET47W (1.17 )
OS Release     = NixOS 22.05 (Quokka)
Kernel         = 5.18.15 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jul 29 15:28:18 UTC 2022 x86_64
/proc/cmdline  = initrd=\efi\nixos\pldnpfk4ag4bc49fxnhd07q1q1mv7jh2-initrd-linux-5.18.15-initrd.efi init=/nix/store/6wmwnfmq8yrg1i4z8f4n77h63aqrd7lx-nixos-system-adomo-t14-22.05.20220803.478f3cb/init acpi_backlight=native initcall_blacklist=acpi_cpufreq_init nohibernate loglevel=4
Init system    = systemd 
Boot mode      = UEFI
Sleep mode     = s2idle deep

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 19:56:54,    824 sec(s) ago
Mode           = AC
Power source   = AC

+++ Processor
CPU model      = AMD Ryzen 7 PRO 5850U with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = amd-pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  4507000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf          =      166 [%]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq              =  4507000 [kHz]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq =  1112000 [kHz]

/sys/module/workqueue/parameters/power_efficient       = N
/proc/sys/kernel/nmi_watchdog                          = (not available)

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = balanced
/sys/firmware/acpi/platform_profile_choices            = low-power balanced performance
/sys/devices/platform/thinkpad_acpi/dytc_lapmode       = 0
kikislater commented 2 years ago
--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = HP  HP EliteBook 845 G8 Notebook PC
BIOS           = T82 Ver. 01.10.00
OS Release     = Manjaro Linux
Kernel         = 5.19.0-2-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Aug 2 18:25:43 UTC 2022 x86_64
/proc/cmdline  = BOOT_IMAGE=/@/boot/vmlinuz-5.19-x86_64 root=UUID=b67b7b03-d01d-46ae-b0bd-b409de2d7195 rw rootflags=subvol=@ amd_pstate.shared_mem=1 quiet apparmor=1 security=apparmor udev.log_priority=3 resume=/dev/disk/by-uuid/aafa4122-12b3-4577-9f3b-413d3fe59733
Init system    = systemd 
Boot mode      = UEFI
Sleep mode     = s2idle

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 22:36:36,     19 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 PRO 5850U with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = acpi-cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =  1600000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  1900000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies = 1900000 1800000 1600000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = 0

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = (not available)
/sys/firmware/acpi/platform_profile_choices            = (not available)
tribals commented 2 years ago
--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = LENOVO IdeaPad 5 Pro 16ACH6 82L5
BIOS           = GSCN29WW
OS Release     = Solus 4.3 Fortitude
Kernel         = 5.18.7-2.stable #1 SMP PREEMPT_DYNAMIC Thu Jun 30 21:13:13 UTC 2022 x86_64
/proc/cmdline  = root=UUID=f63e5944-834d-498a-bd59-0a6587ce000e quiet loglevel=3 splash systemd.show_status=false rw radeon.si_support=0 radeon.cik_support=0 amdgpu.si_support=1 amdgpu.cik_support=1 module_blacklist=nouveau,k10temp vfio_pci.ids=10de:25a2
Init system    = systemd v250 (250)
Boot mode      = UEFI
Sleep mode     = s2idle

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 13:02:11,     91 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 5800H with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = amd-pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = ondemand performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  3201000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 0
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf          =      166 [%]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq              =  4463000 [kHz]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq =  1100000 [kHz]

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = 0

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = balanced
/sys/firmware/acpi/platform_profile_choices            = low-power balanced performance
linrunner commented 2 years ago

Thank you all.

@kikislater : you may want to use the kernel boot option amd_pstate.enable=1 to activate the _amdpstate driver.

kikislater commented 2 years ago

even with this option, I couldn't enable it !

--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = HP  HP EliteBook 845 G8 Notebook PC
BIOS           = T82 Ver. 01.10.00
OS Release     = Manjaro Linux
Kernel         = 5.19.0-2-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Aug 2 18:25:43 UTC 2022 x86_64
/proc/cmdline  = BOOT_IMAGE=/@/boot/vmlinuz-5.19-x86_64 root=UUID=b67b7b03-d01d-46ae-b0bd-b409de2d7195 rw rootflags=subvol=@ amd_pstate.enable=1 iommu=pt quiet apparmor=1 security=apparmor udev.log_priority=3 resume=/dev/disk/by-uuid/aafa4122-12b3-4577-9f3b-413d3fe59733
Init system    = systemd 
Boot mode      = UEFI
Sleep mode     = s2idle

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 09:44:17,     22 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 PRO 5850U with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = acpi-cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =  1600000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  1900000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies = 1900000 1800000 1600000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = 0

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = (not available)
/sys/firmware/acpi/platform_profile_choices            = (not available)

Edit: Hum it seems more complicated to activate it now, but I have some things working playing with grub options and mkinitcpio=>

--- TLP 1.6.0-alpha.0 --------------------------------------------

+++ System Info
System         = HP  HP EliteBook 845 G8 Notebook PC
BIOS           = T82 Ver. 01.10.00
OS Release     = Manjaro Linux
Kernel         = 5.19.0-2-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Aug 2 18:25:43 UTC 2022 x86_64
/proc/cmdline  = BOOT_IMAGE=/@/boot/vmlinuz-5.19-x86_64 root=UUID=b67b7b03-d01d-46ae-b0bd-b409de2d7195 rw rootflags=subvol=@ amd_pstate.enable=1 amd_pstate.shared_mem=1 amd_iommu=on iommu=pt quiet apparmor=1 security=apparmor udev.log_priority=3 resume=/dev/disk/by-uuid/aafa4122-12b3-4577-9f3b-413d3fe59733
Init system    = systemd 
Boot mode      = UEFI
Sleep mode     = s2idle

+++ TLP Status
State          = enabled
RDW state      = enabled
Last run       = 09:59:21,     14 sec(s) ago
Mode           = battery
Power source   = battery

+++ Processor
CPU model      = AMD Ryzen 7 PRO 5850U with Radeon Graphics

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = amd-pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  4507000 [kHz]

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/cpufreq/boost                  = 1
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf          =      166 [%]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq              =  4507000 [kHz]
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq =  1112000 [kHz]

/sys/module/workqueue/parameters/power_efficient       = Y
/proc/sys/kernel/nmi_watchdog                          = 0

+++ Platform Profile
/sys/firmware/acpi/platform_profile                    = (not available)
/sys/firmware/acpi/platform_profile_choices            = (not available)
amorozov commented 2 years ago

Is usage of TLP from master really required? I have 1.5.0 installed (Manjaro)

I've got amd_pstate working and actually can change power profiles using cpupower. If 1.5.0 is enough I can provide required outputs in different modes with different governors and frequency limits

linrunner commented 2 years ago

@amorozov Yes, there is nothing to parametrize on _amdpstate so far that TLP couldn't already do with 1.5. Btw. the creator of the issue already anticipated that.

But no, I added some of _amdpstate's readonly parameters to tlp-stat's output. This extension I wanted to have tested with the main branch. In the meantime I have enough results, so you don't have to bother.

harrykipper commented 2 years ago

It seems that the amd-pstate driver is finally adding a parameter to adjust power/performance in a similar way to intel-pstate. https://lore.kernel.org/lkml/20220909164534.71864-4-Perry.Yuan@amd.com/

TLP will definitely have to manage this, once implemented, however it's still a RFC, so plenty of time to prepare. I am already using the new driver version (a patch against the mainline kernel is offered here: https://github.com/sirlucjan/kernel-patches/blob/master/6.0-rc/cpufreq-epp-cachyos-patches/0001-cpufreq-epp-cachyos-patches.patch) so I can test things if needed.

linrunner commented 2 years ago

@harrykipper : that was to be expected. Thanks for the heads up.

brotfessor commented 1 year ago

I am currently already using the amd_pstate-epp patches metioned above (PATCH v2 atm) and the sysfs interface seems to be exactly the same as with intel, so supporting this seems relatively straightforward.

I am guessing this has to wait until it is accepted in the kernel, but if anyone wants to test it out, here is a quick patch adding support for TLP and it seems to work as expected on my Ryzen 5825U.

Patch: https://github.com/brotfessor/TLP/commit/add1819c67b1a26fe23c9ad36d29d619aae39312

linrunner commented 1 year ago

@brotfessor : interesting news. Please provide a pull request as soon as its accepted in the kernel. Thank you.

linrunner commented 1 year ago

Patch v4 and working on v5 ...

amorozov commented 1 year ago

Actually, the v5 has been published already and likely there will be v6 (see Wyes Karny's suggestion and Perry's reply).

linrunner commented 1 year ago

Here we go again: Patch v7. Not likely to meet v6.2.

linrunner commented 1 year ago

@harrykipper @brotfessor @amorozov and @all: I finally took the time to build a kernel with patch v7 and completed the implementation in TLP:

  • CPU_ENERGY_PERF_POLICY_ON_AC/BAT, CPU_HWP_DYN_BOOST_ON_AC/BAT: support AMD Zen 2 or newer CPUs EXPERIMENTAL requires amd_pstate scaling driver in active mode provided by a yet unreleased kernel 6.x

You're invited to test with my main branch and provide the output of

tlp-stat -s -p

ps. amd_pstate active mode requires kernel cmdline option amd_pstate=active

My outputs: https://gist.github.com/linrunner/28cafe1fa3bfacc44630d7b5600c0306

amorozov commented 1 year ago

Thanks, I'll give it a try as soon as I can.

BTW, do you have a PKGBUILD for the experimental kernel?

brotfessor commented 1 year ago

Thank you, I just tried it out, seems to work fine with patch v7:

My output: https://gist.github.com/brotfessor/5f60fe2f079981f6a8f4e7914ca56415

linrunner commented 1 year ago

For me suspend and reboot hang with the patched kernel. I would not recommend the driver for production use yet.

@amorozov try this one (without any support)

linrunner commented 1 year ago

Btw: _amdpstate (in active mode) has no option to control frequency boost yet, see Perrys answer. This means for TLP that CPU_BOOST_ON_AC/BAT has no function.

harrykipper commented 1 year ago

Hi, using v8 (https://lore.kernel.org/lkml/20221219064042.661122-1-perry.yuan@amd.com/T/#md63cce4f471ea449904f5f87307cfdddb262e6e4), output's here

https://gist.github.com/harrykipper/96d352e6cfb2f72b67790d5579b73ae4

Notice that the boost bit has now been removed.

linrunner commented 1 year ago

Notice that the boost bit has now been removed.

This was to be expected: https://lore.kernel.org/lkml/Y5b%2FIvbeIq4d56nd@amd.com/

Btw: there is currently no frequency boost either: https://lore.kernel.org/lkml/DM4PR12MB527891F1ABD8226CEB424BBD9CE59@DM4PR12MB5278.namprd12.prod.outlook.com/

amorozov commented 1 year ago

Mine (6.1.1 v8) is https://gist.github.com/amorozov/c817354c94338e03c253d96c62ee76de

BTW, the power consumption on 6.x kernel seems to be slightly higher than ≈6 months ago (about 1W, 6W+ instead of 5W+) with no notable changes in the desktop environment and applications set. Did anyone else experience anything like that?

linrunner commented 1 year ago

The patchset seems to be nearing completion https://lore.kernel.org/all/20230131090016.3970625-1-perry.yuan@amd.com/ (v12)

linrunner commented 1 year ago

v12 queued for 6.3: https://lore.kernel.org/all/CAJZ5v0gks1z-GkS=3oY1sn0N-sjK_Vh9bXgygqoE71hnKU5B2w@mail.gmail.com/

linrunner commented 1 year ago

TLP adapted for v12 patchset

brotfessor commented 1 year ago

Thanks, it is working fine for me on Linux-6.2 with the branch "bleeding-edge" from linux-pm merged: https://gist.github.com/brotfessor/7b794a2cb612b12a18e57a6c36996d32

FYI, regarding suspend issues, I had it working fine on v6.1 with PATCH v7 manually applied, but v6.2 with the current PATCH v12 occasionally had resume failures for me where the integrated graphics wouldn't come back up and fail resume with a "Error waiting for DMUB idle". This seems to be caused by the old (2021) amdgpu firmware I had installed before. After updating to the current version, the error has gone away. So if anyone runs into something like that, try updating your gpu firmware and power cycle the machine to apply the new firmware.

Edit: Apparently the amdgpu firmware is not completely replaced on a warm reboot, so it was just the firmware, not my patch-applying skills.

harrykipper commented 1 year ago

Resume issues seem to be all over the place for Ryzen 5000 series. See i.e. here https://gitlab.freedesktop.org/drm/amd/-/issues/2403

snakeroot commented 1 year ago

Seems to work fine with just-released kernel 6.3.

linrunner commented 1 year ago

Works here too.

ysooqe commented 1 year ago

One quick question, on the latest release (1.5.0), setting energy_performance_preference (TLP settings CPU_ENERGY_PERF_POLICY_ON_AC / CPU_ENERGY_PERF_POLICY_ON_BAT) does not seem to work when using amd_pstate=active (amd_pstate_epp) on linux 6.3.1. It can be changed manually, but TLP does not seem to be able to change it on AC or on BATTERY. Is this already addressed through 5248ad1a4e7076c68b3e581dbb4f26fc4c414495?

linrunner commented 1 year ago

@ysooqe CPU_ENERGY_PERF_POLICY_ON_AC/BAT for _amdpstate will be released with 1.6. Feel free to try the alpha packages: https://download.linrunner.de/packages/

ysooqe commented 1 year ago

@ysooqe CPU_ENERGY_PERF_POLICY_ON_AC/BAT for _amdpstate will be released with 1.6. Feel free to try the alpha packages: https://download.linrunner.de/packages/

Amazing, thank you!

siddhpant commented 1 year ago

AMD driver also added support for a guided autonomous mode since 6.4.

https://lore.kernel.org/linux-pm/20230307112740.132338-1-wyes.karny@amd.com/

siddhpant commented 1 year ago

Relevant patches to cpupower: https://lore.kernel.org/lkml/20230619190503.4061-1-wyes.karny@amd.com/

linrunner commented 1 year ago

@siddhpant 6.4 crashed on my machine but 6.4.1 works. I'll look into the new mode.

linrunner commented 1 year ago

@siddhpant to be honest, I don't understand what the difference is between passive and guided in practical use. Can you explain?

@all I've added the new setting CPU_DRIVER_OPMODE_ON_AC/BAT. With it may change the operation mode (active, passive, guided) at runtime - i.e. without boot options/reboot - for _intelpstate too. Please test and post your results.

siddhpant commented 1 year ago

@siddhpant to be honest, I don't understand what the difference is between passive and guided in practical use. Can you explain?

The governor just specifies the range of frequencies in guided mode. In passive mode, the governor dictates the frequencies.

Guided mode, as apparently has been marketed, leads to better power utilization on average. The processor can choose and adjust the operating frequency itself in the specified range.

In active mode, the powersave governor with powersave epp can also lead to max frequency. With guided mode, the governor can specify the max and min frequency, and the processor will choose the operating frequency inside the range. Guided is basically active mode with range enforced, as far as I could understand.


These AMD P-State additions should help enhance the performance-per-Watt / power efficiency and also address some corner cases where the long-standing ACPI CPUFreq driver at times have worked out better than the AMD P-State driver over the past year and a half.

[...]

I'll be conducting some AMD P-State Guided Autonomous Mode benchmarks soon as well.

https://www.phoronix.com/news/AMD-P-State-GAM-Linux-6.4