The cpu frequency of hikey960


#1

I run multi-threaded programs, such as 8 threads, 16 threads, 32 threads, I found that the large core’s CPU frequency are 903 MHz, the small core are 533 MHz, how can I increase cpu performance. Thank you.
I have already tried:
echo 99999999> / sys / class / thermal / thermal_zone0 / sustainable_power
Almost no change.

root@linaro-developer:~# uname -a
Linux linaro-developer 4.14.0-rc7-linaro-hikey960


#2

If I’m not wrong the CPU frequency is decided by ‘governor’ which is by default configured to ‘ondemand’, meaning that 903MHz is a ‘normal’ frequency when board is idle, actually this is the minimum ‘limit’ for the A73 core.

There are two cpufreq policies available in sysfs (/sys/devices/system/cpu/cpufreq/policy*) one for the LITTLE cores (Cortex-A53) and one for the big cores (Cortex-A73). Two governors are available, the default ‘ondemand’ and the ‘performance’ one. You can change the governor by echoing into ‘scaling_governor’ file (e.g echo performance > scaling_governor). Changing the governor to ‘performance’ will set the cores to the maximum frequency available.

Note that ‘ondemand’ governor sets the CPU frequency depending on the current system load. Although requesting some latency to switch core frequency, it is known to be well adapted in most cases.

The “performance” governor sets the CPU statically to the highest frequency (scaling_max_freq), however if the core reaches dangerous temperature limits, frequency can be throttled based on the mentioned sustainable_power value, need @leo-yan confirmation on this point . If all software limits/barriers are removed, ‘hardware’ forces cpu to degraded mode in case of exceeding limits. So I assume you can end with a less efficient system with performance governor… especially with the original little heatsink.

It depends on what is performed by the threads, if threads spend time sleeping (syscall, semaphore,…) this is not so much load.


#3

Yeah, @Loic is correct.

Exactly. And the SoC cannot dissipate heat when all CPUs run at higher frequency; the high temperature will increase power static leakage, and then will increase to higher termperature… so this is why the CPU frequency must be limited to low frequency.


#4

Is there a way to force the hikey 960 cores to 533/903 Mhz regardless of the demand? We’re experiencing thermal issues with our prototype and are seeking ways to let it heat up less quickly by locking down the clocks.

When the core temperatures are above 75 degrees, the cores are already clocked to their lowest frequencies, but by locking it down, we hope to reach that point somewhat later in time.

Unfortunately we don’t have a lot of space for heatsinks and big fans. The 2.5mm heatsink plus 3mm microfan we now have sandwiched between our mezzanine PCB and the CPU doesn’t make a big difference.


#5

At runtime you can limit max freq with cpufreq tool for or sysfs.

e.g.

echo 533000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 533000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 533000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 533000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo 903000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
echo 903000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq
echo 903000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq
echo 903000 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq

You can also deactivate a core by moving them offline:

echo 0 > /sys/devices/system/cpu/cpu7/online

#6

Thanks, i’ll try these to see how much we can use these to keep things cool…or better, less hot


#7

Except Loic mentioned to set maximum cpu frequency, you also could use ‘userspace’ governor:

echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 533000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo userspace > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo 903000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed