S912 limited to 1200 MHz with multithreaded loads

A lot here to digest, so using multiple cores the Cpu clock will be 1.2 max, and also this means that using the hardware encryption has a lot to do with this as well.

@numbqq It’s been two years, and still the issue persists. CPU scheduler assigns the tasks randomly to the small cores sometimes, therefore making the board much slower than it should be.

There are two possible solutions to this:

  • Ask Amlogic for some boot binary that equals all the eight core frequencies to 1.5 Ghz
  • Improve the CPU scheduling, so demanding tasks are always assigned to the fast cores, as in all big.LITTLE implementations.

Would you please look into this? That would be very kind of you, and would prove that Khadas is a company that cares for their customers.

I stumbled accross this thread when looking for something else, and the issue of making workloads prefer the higher-clocked cores over lower-clocked is easily solved, see:

@numbqq if you can run some tests and confirm back to me, I will send this upstream to the kernel.

4 Likes
6 Likes

Confirmed to work!

Here are some numbers, using the small but handy tool ‘mhz’ (GitHub - wtarreau/mhz: CPU frequency measurement utility), and also 7-zip single-core benchmark.

Before your patch:

root@kvim2:~/src/mhz# taskset -c 1 ./mhz 1 100000
count=645643 us50=22849 us250=114250 diff=91401 cpu_MHz=1412.770

root@kvim2:~/src/mhz# taskset -c 5 ./mhz 1 100000
count=413212 us50=20725 us250=103619 diff=82894 cpu_MHz=996.965

root@kvim2:~/src/mhz# ./mhz 1 100000
count=413212 us50=20725 us250=103700 diff=82975 cpu_MHz=995.992
root@kvim2:~/src/mhz# ./mhz 1 100000
count=413212 us50=20726 us250=103645 diff=82919 cpu_MHz=996.664
root@kvim2:~/src/mhz# ./mhz 1 100000
count=413212 us50=20713 us250=103631 diff=82918 cpu_MHz=996.676
root@kvim2:~/src/mhz# ./mhz 1 100000

root@kvim2:~/src/mhz# taskset -c 1 7z b -mmt1
Tot: 99 1094 1085
root@kvim2:~/src/mhz# taskset -c 5 7z b -mmt1
Tot: 99 819 812
root@kvim2:~/src/mhz# 7z b -mmt1
Tot: 99 818 811
root@kvim2:~/src/mhz# 7z b -mmt1
Tot: 99 819 812

As can be seen, the results of both ‘mhz’ and ‘7-zip’ are the same when forced to run on the small cores with taskset, and when the kernel schedules the task freely.

After your patch:

root@kvim2:~/mhz# ./mhz 1 100000
count=516515 us50=18383 us250=91477 diff=73094 cpu_MHz=1413.290
root@kvim2:~/mhz# ./mhz 1 100000
count=516515 us50=18296 us250=91448 diff=73152 cpu_MHz=1412.169
root@kvim2:~/mhz# ./mhz 1 100000
count=516515 us50=18289 us250=91441 diff=73152 cpu_MHz=1412.169

root@kvim2:~/mhz# 7z b -mmt1 ;  7z b -mmt1 ; 7z b -mmt1
Tot:              99   1072   1063
Tot:              99   1079   1070
Tot:              99   1076   1067

I cut out the 7-zip output, for cleanness sake.

@chewitt Thank you so much, man! It is time to take this piece of hardware out of the drawer where it has been laying for the last two years.


P.S: It would be nice to hear something from the Khadas staff about this issue too, just so they show that they care.

2 Likes

Hello @chewitt @huantxo

Thanks for your patch, we will check on our side, too.

Good finding.

I will test this patch and get back to some feedback.

Thanks

2 Likes

I got the same results as @huantxo. Thank you @chewitt.

2 Likes

Great job.
Now I may have to re-review this board.
It was disappointing for an octa-core. Now I might boinc the board :slight_smile:

1 Like