5

I'm testing the new amd-pstate driver on my laptop, I've installed the latest kernel 5.18 via ppa:tuxinvader/lts-mainline, changed some boot options and everything works flawlessly.

Unfortunately when I run the command cpupower, I'm getting:

WARNING: cpupower not found for kernel 5.18.5-051805

  You may need to install the following packages for this specific kernel:
    linux-tools-5.18.5-051805-generic
    linux-cloud-tools-5.18.5-051805-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic

linux-tools-generic is already installed and can't find linux-tools-5.18.5-051805-generic, the latest version on my system is linux-tools-5.13.0-25-generic. I can't find a way to install cpupower.

2
  • Ubuntu puts a dependency wrapper around the actual program. You could find the actual program and run it directly. However, it likely will not be up to date with respect to the NEW amd-pstate driver. You could compile yourself from the master linux tree and use that. I do not use cpupower. I use direct primitive commands, and that is what I suggest you do. Commented Jun 22, 2022 at 20:07
  • @DougSmythies By primitive commands, you mean changing values on each cpu core (for example /sys/devices/system/cpu/cpu0/cpufreq/) ? I'm testing amd-pstate to extend battery life. if you can share how you use those commands and/or if there is a tool to change the governor/frequencies... I would gladly accept it as an answer.
    – Razor
    Commented Jun 22, 2022 at 21:08

3 Answers 3

4

If you do not have access to the most recent cpupower, or even if you do, you can just use the basic commands to make changes to the operating parameters of the CPU frequency scaling driver:

Examples:

Just look at what is available:

doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu0/cpufreq/*
/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus:0
/sys/devices/system/cpu/cpu0/cpufreq/base_frequency:4100000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq:4800000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency:20000
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences:default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference:balance_performance
/sys/devices/system/cpu/cpu0/cpufreq/related_cpus:0
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:schedutil
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:4800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed:<unsupported>

O.K. I would rather use the ondemand CPU frequency scaling governor, so change it and then check it:

doug@s19:~/kernel/linux$ echo ondemand | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
ondemand
doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu10/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu11/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu8/cpufreq/scaling_governor:ondemand
/sys/devices/system/cpu/cpu9/cpufreq/scaling_governor:ondemand

I think I would like to limit my max CPU frequency, so change it and check it:

doug@s19:~/kernel/linux$ echo 4400000 | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
4400000
doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu10/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu11/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu8/cpufreq/scaling_max_freq:4400000
/sys/devices/system/cpu/cpu9/cpufreq/scaling_max_freq:4400000

I wonder if the frequency is actually limiting? put a heavy load on the CPUs and then check:

doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu*/cpufreq

/scaling_cur_freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:4399985
/sys/devices/system/cpu/cpu10/cpufreq/scaling_cur_freq:4400002
/sys/devices/system/cpu/cpu11/cpufreq/scaling_cur_freq:4400022
/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq:4399980
/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq:4400004
/sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq:4400007
/sys/devices/system/cpu/cpu4/cpufreq/scaling_cur_freq:4399988
/sys/devices/system/cpu/cpu5/cpufreq/scaling_cur_freq:4400017
/sys/devices/system/cpu/cpu6/cpufreq/scaling_cur_freq:4399985
/sys/devices/system/cpu/cpu7/cpufreq/scaling_cur_freq:4400003
/sys/devices/system/cpu/cpu8/cpufreq/scaling_cur_freq:4400006
/sys/devices/system/cpu/cpu9/cpufreq/scaling_cur_freq:4399997

I think I would like to go back to max CPU frquency:

doug@s19:~/kernel/linux$ echo 4800000 | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
4800000
doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:4800002
/sys/devices/system/cpu/cpu10/cpufreq/scaling_cur_freq:4799995
/sys/devices/system/cpu/cpu11/cpufreq/scaling_cur_freq:4799998
/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq:4800010
/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq:4800016
/sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq:4799994
/sys/devices/system/cpu/cpu4/cpufreq/scaling_cur_freq:4799987
/sys/devices/system/cpu/cpu5/cpufreq/scaling_cur_freq:4800012
/sys/devices/system/cpu/cpu6/cpufreq/scaling_cur_freq:4800000
/sys/devices/system/cpu/cpu7/cpufreq/scaling_cur_freq:4799985
/sys/devices/system/cpu/cpu8/cpufreq/scaling_cur_freq:4800022
/sys/devices/system/cpu/cpu9/cpufreq/scaling_cur_freq:4799989
2

On AWS Ubuntu 20.04, the command for installation is a bit different: Use sudo apt install -y linux-tools-5.13.0-1031-aws linux-tools-common.

Usually, installing sudo apt-get install -y linux-tools-common and then trying to run cpupower on the commandline, makes the program display what you need to install to get cpupower running.

There's also sudo apt-get install cpufrequtils.

0

How to install cpupower:

# apt install linux-tools-$(uname -r) linux-cloud-tools-$(uname -r)
1
  • 2
    It is better to use the 'sudo' way than being root. Commented Sep 18, 2023 at 12:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .