Pi 3B+ CPU governor/frequency readout not working?

I’m having a problem with CPU frequency scaling on my Pi 3B+ with DietPi 8.0.2

When I run the CPU command, it says " Governor | N/A" and doesn’t list any CPU frequencies, just temperature. It used to also display the current CPU frequency.

When I try to change the governor in dietpi-config, it says: “Your processor, or kernel, does not support this feature.” and “scaling_available_governors does not exist”.
Also when I run the stress test and check with “vcgencmd measure_clock arm”, it’s always showing 600 MHz, and the CPU isn’t heating up like it used to. When I run “vcgencmd get_throttled” however, it says “throttled=0x0” even though the CPU is running at 600 MHz.

Also, in /sys/devices/system/cpu/cpu0, I only have:
“cpu_capacity of_node power regs subsystem topology uevent”
I believe there should be a “cpufreq” among others there?

I think it’s a driver/software problem rather than a hardware or power supply issue, given that I can’t even select a governor any more. I’m using a 2.5A PSU and it was working fine in the past. Not exactly sure when or why it stopped working.

AdvancedFollower
can you share some more system details pls

Required Information

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • Kernel version | uname -a
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)

MichaIng
could you have a look pls

Dietpi Version:
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=0
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

Distro version:
bullseye 0

Kernel version:
Linux DietPi 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux

SBC model:
RPi 3 Model B+ (aarch64)

Very strange, of course the full CPUFreq API should be available. Can you check for kernel errors, at best paste the whole kernel output:

dmesg -l emerg,alert,crit,err
dmesg

output of dmesg might be to long to post on a single post. Feel free to store it on a text file (*.txt) and attach it to the post.

https://pastebin.com/YhBUbqmU

Looks fine, dmesg -l emerg,alert,crit,err didn’t output anything, did it?

No idea, the CPUFreq driver is builtin into the kernel, hence always available and automatically loaded, on all RPi models. Try to reinstall kernel and bootloader packages:

apt install --reinstall raspberrypi-kernel raspberrypi-bootloader

Nope, that printed nothing.

Just tried reinstalling the kernel/bootloader, shut down and restarted but no luck unfortunately.
Might have to bite the bullet and try with a fresh install, though it would be useful to know what caused it first so it doesn’t happen again.

Ok, clean install.
I used DietPi_RPi-ARMv8-Bullseye.img which auto-updated to 8.0.2 during install.

After the initial setup when I’m dumped to the shell for the first time, the CPU governor works as it should. The CPU scales up under load, and the CPU command shows all the information like clock speeds etc.

However after a reboot, this message briefly flashes at the top of the screen when connected via HDMI:
DietPi-PreBoot [277]: DietPi-CPU_set | CPU governors are not available on this system. This is probably a virtual machine. Aborting…

From then on, the CPU governors stop working permanently again and the system is locked to 600 MHz.

I did a second clean install, and it was the same - CPU governors only work for the very first boot, then after the first reboot it stops working again with the error message above.

I would say there is an issue with the medium where you store the system on or with the Pi itself.
If your download of the image would be corrupted, the error had shown up on first boot, I think.

Would be interesting to know if Rasperry Pi OS (or any other OS for your Pi) has the same issue on your machine.

Just installed the latest version of Raspberry Pi OS.

CPU governor works just fine. Installed all the updates, did several soft and hard reboots. CPU governor and clock scaling still work perfectly, always hitting 1.4 GHz under load and going down to 600 MHz when idle.

Seems there’s some kind of bug in DietPi with the 3B+.

hmm could be the device is not detected correctly and therefore CPU governor is not set. Could you try following and share the output

rm /boot/dietpi/.hw_model
/boot/dietpi/func/dietpi-obtain_hw_model
cat /boot/dietpi/.hw_model

BTW: this is working fine on my RPi3B+

root@DietPi3:~# cat /boot/dietpi/.hw_model
G_HW_MODEL=3
G_HW_MODEL_NAME='RPi 3 Model B+ (armv7l)'
G_HW_ARCH=2
G_HW_ARCH_NAME='armv7l'
G_HW_CPUID=0
G_HW_CPU_CORES=4
G_DISTRO=6
G_DISTRO_NAME='bullseye'
G_ROOTFS_DEV='/dev/sda2'
G_HW_UUID='4xx'
G_RASPBIAN=1
G_HW_ONBOARD_WIFI=1
G_HW_REVISION='a020d3'
G_HW_PCB_REVISION=3
G_HW_MEMORY_SIZE=1024
G_HW_MANUFACTURER='Sony UK'
root@DietPi3:~#



root@DietPi3:~# /boot/dietpi/func/dietpi-set_cpu

 DietPi-CPU_set
─────────────────────────────────────────────────────
 Mode: Applying CPU governor settings: ondemand

[ INFO ] DietPi-CPU_set | Setting up_threshold: 50 %
[ INFO ] DietPi-CPU_set | Setting sampling_rate: 25000 microseconds
[ INFO ] DietPi-CPU_set | Setting sampling_down_factor: 40 x
[  OK  ] DietPi-CPU_set | Applied CPU governor settings: ondemand
root@DietPi3:~#
root@DietPi:~# rm /boot/dietpi/.hw_model
root@DietPi:~# /boot/dietpi/func/dietpi-obtain_hw_model
root@DietPi:~# cat /boot/dietpi/.hw_model
G_HW_MODEL=3
G_HW_MODEL_NAME='RPi 3 Model B+ (aarch64)'
G_HW_ARCH=3
G_HW_ARCH_NAME='aarch64'
G_HW_CPUID=0
G_HW_CPU_CORES=4
G_DISTRO=6
G_DISTRO_NAME='bullseye'
G_ROOTFS_DEV='/dev/mmcblk0p2'
G_HW_UUID='f98c179a-a620-47de-a789-a46af87bf052'
G_RASPBIAN=0
G_HW_ONBOARD_WIFI=1
G_HW_REVISION='a020d3'
G_HW_PCB_REVISION=3
G_HW_MEMORY_SIZE=1024
G_HW_MANUFACTURER='Sony UK'

and the output of following

/boot/dietpi/func/dietpi-set_cpu

I can’t confirm this, I testet on RPi 3 B+ with dietpi 8.0.2 and cpu command works fine, still after several reboots.
Same for dietpi 8.1.2.

32- or 64-bit? I’m starting to think it’s because I used the 64-bit image.



root@DietPi:~# /boot/dietpi/func/dietpi-set_cpu
DietPi-CPU_set | CPU governors are not available on this system. This is probably a virtual machine. Aborting...

Just poked around in that script a bit and it’s just checking whether there’s a “/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors” available. Since I don’t even have a cpufreq folder under /sys/devices/system/cpu/cpu0/, just “cpu_capacity of_node power regs subsystem topology uevent”, the check fails.

I also used 64 bit image

just for testing, I fleshed a 64bit image

root@DietPi3:~# cat /boot/dietpi/.hw_model
G_HW_MODEL=3
G_HW_MODEL_NAME='RPi 3 Model B+ (aarch64)'
G_HW_ARCH=3
G_HW_ARCH_NAME='aarch64'
G_HW_CPUID=0
G_HW_CPU_CORES=4
G_DISTRO=6
G_DISTRO_NAME='bullseye'
G_ROOTFS_DEV='/dev/sda2'
G_HW_UUID='3xx'
G_RASPBIAN=0
G_HW_ONBOARD_WIFI=1
G_HW_REVISION='a020d3'
G_HW_PCB_REVISION=3
G_HW_MEMORY_SIZE=1024
G_HW_MANUFACTURER='Sony UK'

and it’s working well

root@DietPi3:~# /boot/dietpi/func/dietpi-set_cpu

 DietPi-CPU_set
─────────────────────────────────────────────────────
 Mode: Applying CPU governor settings: ondemand

[ INFO ] DietPi-CPU_set | Setting up_threshold: 50 %
[ INFO ] DietPi-CPU_set | Setting sampling_rate: 25000 microseconds
[ INFO ] DietPi-CPU_set | Setting sampling_down_factor: 40 x
[  OK  ] DietPi-CPU_set | Applied CPU governor settings: ondemand

Or it is an issue with the latest kernel (it is upgraded automatically on first boot) and the RPi 3+ :thinking:. Since there are no kernel errors, I cannot imagine filesystem corruption to be the issue.

Can you try to downgrade firmware:

cd /tmp
curl -O 'https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20211118-1_armhf.deb'
curl -O 'https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-bootloader_1.20211118-1_armhf.deb'
dpkg -i raspberrypi-*_1.20211118-1_armhf.deb
rm raspberrypi-*_1.20211118-1_armhf.deb
reboot
root@DietPi:/tmp# dpkg -i raspberrypi-*_1.20211118-1_armhf.deb
dpkg: error processing archive raspberrypi-bootloader_1.20211118-1_armhf.deb (--install):
 package architecture (armhf) does not match system (arm64)
dpkg: error processing archive raspberrypi-kernel_1.20211118-1_armhf.deb (--install):
 package architecture (armhf) does not match system (arm64)
Errors were encountered while processing:
 raspberrypi-bootloader_1.20211118-1_armhf.deb
 raspberrypi-kernel_1.20211118-1_armhf.deb

Edit:
Replaced “armhf” with “arm64” everywhere and it worked.

CPU scaling also works! So for anyone above who currently has a working CPU governor, maybe don’t update to the latest kernel :thinking: