Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#910 - Raspberry Pi 3 keeps attempting to change CPU frequency and failing #5857

Open
openwrt-bot opened this issue Jul 16, 2017 · 3 comments
Labels
flyspray kernel pull request/issue with Linux kernel related changes

Comments

@openwrt-bot
Copy link

jburgess777:

I recently updated a Raspberry Pi 3 to a recent LEDE git master build: Reboot (SNAPSHOT, r4576-9fe9175)

The kernel keeps logging the following errors:

[ 103.041158] bcm2835-cpufreq:bcm2835_cpufreq_set_clock:84: Failed to set clock: 600000 (-12)
[ 103.044492] bcm2835-cpufreq:bcm2835_cpufreq_driver_target_index:183: Error occurred setting a new frequency (600000)
[ 103.047857] cpufreq: __target_index: Failed to change cpu frequency: -22
[ 103.401167] bcm2835-cpufreq:bcm2835_cpufreq_set_clock:84: Failed to set clock: 600000 (-12)
[ 103.404517] bcm2835-cpufreq:bcm2835_cpufreq_driver_target_index:183: Error occurred setting a new frequency (600000)
[ 103.407890] cpufreq: __target_index: Failed to change cpu frequency: -22
[ 103.761155] bcm2835-cpufreq:bcm2835_cpufreq_set_clock:84: Failed to set clock: 600000 (-12)
[ 103.764491] bcm2835-cpufreq:bcm2835_cpufreq_driver_target_index:183: Error occurred setting a new frequency (600000)
[ 103.767870] cpufreq: __target_index: Failed to change cpu frequency: -22

I am seeing ~10ms latency spikes for traffic through the device and I believe these errors are the reason. If I force the scheduler to only run the CPU at its maximum speed with the command below then then errors cease and the latency spikes disappear:

echo 1200000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq

I looked into the kernel sources and the messages above appear to be saying that there was an error when asking the Pi firmware to change the CPU speed.

I know there is a HW quirk in the RPi3 which means the UART is effected by the CPU speed. I wonder whether this has anything to do with the firmware rejecting the speed change:
RPi-Distro/repo#22

@openwrt-bot
Copy link
Author

Rixerx:

The problem persists in the OpenWrt SNAPSHOT r6395-6c19407

@openwrt-bot
Copy link
Author

tobbe:

FYI this bug still exists on latest 18.06 release

@openwrt-bot
Copy link
Author

nathhad:

Digging up this older bug report to leave a partial solution that may be useful to others, but this is still an active issue for me with Raspberry Pi 3 Model B Rev 1.2 running GoldenOrb_2020-05-16 (OpenWrt 18.06.7).

I've seen in other places on Raspberry Pi references that this tends to be tied to something related to USB. For whatever reason, eliminating CPU frequency switching by any of several possible means does solve the problem. You can either set the frequency manually to a single frequency in /boot/config.txt, or (as I've chosen to do) you can change the governor after boot using /etc/rc.local to one of the two governors that only uses a single frequency (either performance or powersave). In my case, I've locked mine to powersave, since my Pi is rarely heavily loaded.

In /etc/rc.local, add the line:
echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

Or, of course, use performance if you need full speed.

If you need something in between, it's relatively easy to set a fixed frequency anywhere from 100 to 1200 (on the 3B) in config.txt, as well, and there is ample info on how to do that on the Pi forums (including tons of fairly advanced info in the Advanced users > Overclocking thread, which is 46 pages long and includes participation from one of the main board engineers for the Pi).

@aparcar aparcar added the kernel pull request/issue with Linux kernel related changes label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray kernel pull request/issue with Linux kernel related changes
Projects
None yet
Development

No branches or pull requests

2 participants