BeagleBone Black CPU Speed Governor Settings


#1

Hello

I have a question about setting the CPU Governor, as i have done in the past (might of bin Debian) with php and a full mariadb installed, using python to run a LCD 20x4 screen, i set the governor to ‘conservative’ because it was powered by a battery threw the 5v plug, the BBB would run 300MHz at idol no problem (saving power), then when needed it would ramp up the CPU speed step by step until it reached the max 1000MHz or when what ever event/process was finished it would return back to 300MHz.

This is a clean install and up to date.
I’m using the latest Ubuntu rcn-ee.com/rootfs/2018-12-10/flasher/ image.
using the cpufreq-info to check it,
as well as editing the file /etc/init.d/cpufrequtils to set the Governor at boot, and rebooting.

ENABLE=“true”
GOVERNOR=“conservative”
MAX_SPEED=“0”
MIN_SPEED=“0”

results:
“powersave” runs at 300MHz always (very slow)
“ondemand” runs at 1000MHz always
“conservative” runs at 1000MHz always

is it maybe this distro is a bit to heavy for the desired results or am i missing something?
it seams i cant get it to dynamically change the CPU speed as needed.

any way any information in regards to setting the Governor would be greatly appreciated.

Thank You.


#2

@milesbdyson, correct in most cases you’ll see the am335x bounce between minimal 300Mhz and max 1000Mhz. You can manually adjust the sampling rate to change the frequency changes thru sysfs…

https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt

Regards,


#3

the only time i see the 300MHz is by using the “powersave” Governor, it does not seam to work as it use to for some reason, (I know I’m missing something) what i described above is how it worked before but with the Ubuntu distro, now at idle it stays at 1000MHz when using “ondemand” or “conservative”, i am not seeing lower cpu speeds at idol and it is a clean install without mariadb or php installed


#4

It’s working just fine, in those default images, we have a lot of default applications running to appease a wide audience base. Use systemctl and start disabling services you aren’t using…

Regards,


#5

i will look into this … thank you for your time


#6

Hello

I downloaded a fresh copy of BBB-eMMC-flasher-ubuntu-18.04.1-console-armhf-2018-12-10-2gb.img.xz

I created a bootable Mircro-SD card and flashed a spare BBB

at first boot i ran
sudo apt update; sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt remove nginx nginx-common avahi-daemon

rebooted BBB

service --status-all

[ - ] acpid
[ - ] alsa-utils
[ - ] avahi-daemon
[ - ] bluetooth
[ + ] connman
[ - ] console-setup.sh
[ + ] cpufrequtils
[ + ] cron
[ - ] cryptdisks
[ - ] cryptdisks-early
[ + ] dbus
[ + ] dnsmasq
[ + ] fake-hwclock
[ + ] grub-common
[ + ] haveged
[ - ] hostapd
[ - ] hwclock.sh
[ - ] keyboard-setup.sh
[ + ] kmod
[ + ] loadcpufreq
[ + ] networking
[ - ] nginx
[ - ] plymouth
[ - ] plymouth-log
[ - ] pppd-dns
[ + ] procps
[ - ] rsync
[ + ] rsyslog
[ + ] ssh
[ + ] udev
[ - ] udhcpd

edited /etc/init.d/cpufrequtils

ENABLE=“true”
GOVERNOR=“conservative”
MAX_SPEED=“0”
MIN_SPEED=“0”

saved it and exited nano
rebooted BBB

sudo cpufreq-info

analyzing CPU 0:
driver: cpufreq-dt
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 300 us.
hardware limits: 300 MHz - 1000 MHz
available frequency steps: 300 MHz, 600 MHz, 720 MHz, 800 MHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 300 MHz and 1000 MHz.
The governor “ondemand” may decide which speed to use
within this range.
current CPU frequency is 1000 MHz (asserted by call to hardware).
cpufreq stats: 300 MHz:88.72%, 600 MHz:1.43%, 720 MHz:0.11%, 800 MHz:0.15%, 1000 MHz:9.60% (279)

the above output is showing ‘ondemand’ governor is in use and not ‘conservative’

if i go back to the /etc/init.d/cpufrequtils

ENABLE=“true”
GOVERNOR=“conservative”
MAX_SPEED=“1000”
MIN_SPEED=“300”

reboot BBB

then run cpufreq-info

analyzing CPU 0:
driver: cpufreq-dt
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 300 us.
hardware limits: 300 MHz - 1000 MHz
available frequency steps: 300 MHz, 600 MHz, 720 MHz, 800 MHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 300 MHz and 300 MHz.
The governor “conservative” may decide which speed to use
within this range.
current CPU frequency is 300 MHz (asserted by call to hardware).
cpufreq stats: 300 MHz:56.08%, 600 MHz:0.00%, 720 MHz:0.00%, 800 MHz:0.00%, 1000 MHz:43.92% (1)

it now shows that it is using the ‘conservative’ governor however when i put a load on it … i open 3 more ssh terminals and run cmatrix on them all and open another ssh terminal and run htop

htop reports cpu at 97.2%

cpufreq-info

analyzing CPU 0:
driver: cpufreq-dt
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 300 us.
hardware limits: 300 MHz - 1000 MHz
available frequency steps: 300 MHz, 600 MHz, 720 MHz, 800 MHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 300 MHz and 300 MHz.
The governor “conservative” may decide which speed to use
within this range.
current CPU frequency is 300 MHz (asserted by call to hardware).
cpufreq stats: 300 MHz:92.52%, 600 MHz:0.00%, 720 MHz:0.00%, 800 MHz:0.00%, 1000 MHz:7.48% (1)

once again edit the /etc/init.d/cpufrequtils

ENABLE=“true”
GOVERNOR=“conservative”
MAX_SPEED=“1000”
MIN_SPEED=“0”

save and exit nano

rebooted BBB

cpufreq-info

analyzing CPU 0:
driver: cpufreq-dt
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 300 us.
hardware limits: 300 MHz - 1000 MHz
available frequency steps: 300 MHz, 600 MHz, 720 MHz, 800 MHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 300 MHz and 1000 MHz.
The governor “ondemand” may decide which speed to use
within this range.
current CPU frequency is 1000 MHz (asserted by call to hardware).
cpufreq stats: 300 MHz:60.50%, 600 MHz:2.38%, 720 MHz:0.14%, 800 MHz:0.17%, 1000 MHz:36.80% (123)

i am still unable to get the desired outcome for an idle CPU at 300 MHz and ramp up dynamically as needed until all events/processes are finished and returning back to 300 MHz

i recreated this as i wrote this post so as to not be misleading i hope this helps.

maybe its me missing something but it seams that the cpufreq-dt driver might not be applying the ‘conservative’ governor properly

if there is any other information you need please let me know and i will do my best, i am at a loss for other options to try.

PS. it would be soooooo nice to regain access to the CPU temp sensor …


then i could use it to control a fan with a heat sink

once again thank you for your time. :smiley:


#7

after revisiting this issue this morning, using cat

sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

i am seeing that the cpu does in fact drop to 300000 (300 mhz) …

not sure if the updates changed any thing or if the command cpufreq-info ramps the cpu while gathering the info to be reported and not to mention it shows the wrong governor in use… any way it does seam to be working at the moment when using cat to read the file.:thinking:


#8

There more sysfs entries you can use to better tune the state changes, but there is still a lot of work going on to make cpufreq changes better. One interesting new option is Schedutil, which claims to have better integration with the kernel’s scheduler.

Regards,


#9

Thank you for the reply… I will definitely do some reading about Schedutil.

it seams that Canonical may have there hands full with rushing out the new updates due to the security issue as i have updated my cluster again today, now the governor is not working at all, in addition my nfs-kernel-server wont start now so i guess I’m back to square one in getting my python cluster working properly … i will just have to be patient i guess and wait for things to get ironed out… its kinda frustrating when something works one day and not the next that’s all… hope your day goes better then mine.:frowning:

any way thanks again for your time.


#10

That’s Ubuntu! They like to break things way too often, even if it’s labeled as “LTS”… I’ve found it’s best to have a 2nd machine that you use for staging purpose to test their “stable” updates…

When updates do arrive you can force apt to only apply certain ones via:

sudo apt install --only-upgrade <pkg>

Then “lock” others via:

sudo apt-mark hold <pkg>

Regards,


#11

wonder if i should test out the 18.10 or do you think that would open a new can of worms !! any way just a thought and yes i understand i should of updated my spare BBB first … lesson learned.

thank you