Scaling governor always resets to "interactive"

Moderators: odroid, mdrjr

Scaling governor always resets to "interactive"

Unread postby Jojo » Tue Jan 30, 2018 1:51 am

Hi,

I just recognized a really strange behaviour of the CPU frequency scaling governor.

My system:
- ODROID C2 with eMMC
- official Ubuntu (latest version)
- OS is fully updated/upgraded
- number of actice CPUs is set to "2"
- f_max is 1,7 GHz

Initialy I observed, that CPU clock was always at full speed.
Looking into the "/etc/init.d/cpufrequtils", the scaling governor "should" be set to "ondemand"...

Then I created the file "/etc/default/cpufrequtils", where I've put in "GOVERNOR=ondemand".

Now I observe something really strange: directly after booting into the desktop environment, the governor is actually "ondemand" and CPU frequency is going going up/down.
But after a few seconds (ten or so) the scaling governor is magically set to "interactive" :shock: !

What is going on here? Has anyone observed that, too, and how can I solve that?

Thanks and greetings!
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Wed Jan 31, 2018 5:38 pm

Is there anything unclear about my problem?
My current workaround is to add a CPU-frequency-monitor icon to my panel, wait until the governor becomes magically set from "ondemand" to "interactive", and then set it manually back to "ondemand". But obviously this it not a solution ;) .

Sorry, usually I am not one of these "bump" guys... :roll:

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Wed Jan 31, 2018 5:42 pm

We've used only "performance" governor with all four cores at stock 1.5Ghz.
Can you find any clue in "dmesg" output?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Wed Jan 31, 2018 8:01 pm

Thank you for the reply!
odroid wrote:We've used only "performance" governor with all four cores at stock 1.5Ghz.

Hm... this is strange... IIRC, the governor was set to "interactive" from the beginning on, although it is mentioned nowhere. So I thought it might have something to do with the default settings when the Kernel was compiled...

odroid wrote:Can you find any clue in "dmesg" output?

Honestly, I don't know what to look for :oops: . Any hints or something with "grep"?

Thanks!
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Wed Jan 31, 2018 10:30 pm

Did you flash "ubuntu64-16.04.3-mate-odroid-c2-20170927.img"?
https://wiki.odroid.com/odroid-c2/os_im ... own_issues

Is there any thermal related things in dmesg output?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Thu Feb 01, 2018 2:09 am

@odroid
Thank you again for caring, this is highly appreciated!

I flashed the latest official LTS Ubuntu image. The problem is NOT, that the systems feels slow. In fact, even the "interactive" governor keeps the CPU clock at max at all times.
There is also no thermal-related throttling of the CPU clock (I deactivated two cores anyway).

The problem is, that at the very beginning, the governor is set to my desired value ("ondemand" in this case), but after some time (10-20 seconds) the governor gets set to "interactive", although I didn't even touch the device!

1. Boot up the system
2. check governor and frequency ("ondemand", 200MHz - 1650 MHz)
3. do nothing for about 20 seconds
4. check governor and frequency again ("interactive", 1650MHz) -> WTH?!

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Thu Feb 01, 2018 10:35 am

What happens if you use four cores without over-clocking?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Thu Feb 01, 2018 6:14 pm

odroid wrote:What happens if you use four cores without over-clocking?

Exactly the same: the governor is at "ondemand" at first (defined by my configuration of cpufrequtils) and gets set to "interactive" after some time. Since then, the clock stays constantly at max frequency (which is 1540MHz now) on all four cores.
I can easily observe the CPU speed and governor by a "CPU Frequency Scaling Monitor" icon in my panel.

Can you (or maybe anyone else) reproduce this?

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Thu Feb 01, 2018 6:31 pm

I've just booted my C2.
Code: Select all
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor                                       
performance                                                                                                         
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq                                       
1536000
odroid@odroid64:~$ uname -a                                                                                         
Linux odroid64 3.14.79-117 #1 SMP PREEMPT Tue Jan 2 23:46:30 BRST 2018 aarch64 aarch64 aarch64 GNU/Linux           

I will check the CPU governor and frequency again one hour later.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Thu Feb 01, 2018 6:37 pm

Oh~~ it is "interactive" now even the frequency is still constant 1.5Ghz :o
Code: Select all
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor                                       
interactive
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq                                       
1536000


We will look into this issue more carefully tomorrow since it is already 19:00 in Korea.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Thu Feb 01, 2018 6:50 pm

odroid wrote:Oh~~ it is "interactive" now even the frequency is still constant 1.5Ghz :o
Yes, thats it ;) . But my main problem is, that the governor gets changed form xxx to interactive without that I touched the system :) .

odroid wrote:
Code: Select all
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor                                       
interactive
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq                                       
1536000
*sign*

odroid wrote:We will look into this issue more carefully tomorrow since it is already 19:00 in Korea.
Totally fine, have a nice evening!
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Tue Feb 13, 2018 3:24 pm

We've tried to find a solution but we couldn't find a real root cause.

Fortunately, it seems to be a simple cosmetic issue since the scaling_cur_freq value is always 1536000 even though the scaling_governor shows "interactive".
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Tue Feb 13, 2018 8:53 pm

@odroid
Thank for for looking into that issue.

I agree, that this is only a cosmetic issue between "interactive" and "performance".

But: my problem is, that I want to have the "ondemand" governor! And immediately after boot, it is indeed set to "ondemand", but then it gets set to "interactive" by command of king of heaven!

Jojo wrote:The problem is, that at the very beginning, the governor is set to my desired value ("ondemand" in this case), but after some time (10-20 seconds) the governor gets set to "interactive", although I didn't even touch the device!

1. Boot up the system
2. check governor and frequency ("ondemand", 200MHz - 1650 MHz) -> OK
3. do nothing for about 20 seconds
4. check governor and frequency again ("interactive", 1650MHz) -> WTH?!


I kindly ask you: could you try to set the default scaling governor for your system to "ondemand" as well? As I said, I tried it by a command in the rc.local as well as be setting up cpufreq-utils accordingly.

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Wed Feb 14, 2018 12:05 pm

Something is wrong in the cpufreq drivers.
We will investigate this issue more carefully.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Wed Feb 14, 2018 6:43 pm

odroid wrote:Something is wrong in the cpufreq drivers.
We will investigate this issue more carefully.

Ok, that would be really nice, thanks a lot!

Can you please tell me if you could reproduce this behaviour? I don't want you to invest hours of work, when the error is just 50 cm in front of my PC ;) .

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Wed Feb 14, 2018 10:59 pm

Yes, we could reproduce the issue.
The CPU clock was set to 1.5Ghz with interactive governor within a minute after booting regardless what we set the governor.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Wed Feb 14, 2018 11:07 pm

odroid wrote:Yes, we could reproduce the issue.
The CPU clock was set to 1.5Ghz with interactive governor within a minute after booting regardless what we set the governor.

Ok, then the problem seems not to be exclusively on my side ;). I am wondering, that nobody else has noticed that yet... maybe because most people like to run at fullspeed all the time...

Anyway, please let me know if I can help somehow!

Thanks!
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby moon.linux » Thu Feb 15, 2018 8:10 pm

Amlogic have some proprietary cpufreq-hotpug module.

https://github.com/hardkernel/linux/com ... 3d7cfd5c29­0e95eed6

this module will probably hotplug the cpu frequency-govenor

so best way to set cpu frequency-governer is to update the /etc/rc.local with
Code: Select all
cpufreq-set -g ondemand

This seem to update the cpufreq-governor correctly for sure at my end.
moon.linux
 
Posts: 1161
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Thu Feb 15, 2018 10:45 pm

@moon.linux
Thank you for your reply. Sadly this approach did not work in my case. I added this command to my rc.local (it actually is there atm), but some time after boot, the governor switches from "ondemand" to "interactive".
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby mad_ady » Fri Feb 16, 2018 12:40 am

A brute force approach would be to use a delayed setting in rc.local (sleep 120; cpufreq-set -g ondemand)&, but it's a temporary hack and not a fix.
User avatar
mad_ady
 
Posts: 4917
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Fri Feb 16, 2018 2:00 am

@mad_ady
indeed, I must say, that I already had something like that in my rc.local. But I hated this dirty hack that much, that I removed it again. As you say... this is far away from being a "solution" ;) .

Lets wait and hear what @odroid finds out...

Greetings
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby moon.linux » Thu Mar 01, 2018 1:48 pm

@jojo. Could your try the following command

Code: Select all
sudo apt-get install cpufrequtils
echo 'GOVERNOR="ondemand"' | sudo tee /etc/default/cpufrequtils
sudo update-rc.d ondemand disable


The last step disables the "ondemand" daemon, which would otherwise overwrite the changes created by cpufrequtils.

Code: Select all
root@odroid64:~# uname -a
Linux odroid64 3.14.79-117 #1 SMP PREEMPT Tue Jan 2 23:46:30 BRST 2018 aarch64 aarch64 aarch64 GNU/Linux
root@odroid64:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: meson_cpufreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 200 us.
  hardware limits: 100.0 MHz - 1.54 GHz
  available frequency steps: 100.0 MHz, 250 MHz, 500 MHz, 1000 MHz, 1.30 GHz, 1.54 GHz
  available cpufreq governors: hotplug, interactive, conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 100.0 MHz and 1.54 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 250 MHz (asserted by call to hardware).
  cpufreq stats: 100.0 MHz:49.15%, 250 MHz:1.04%, 500 MHz:49.15%, 1000 MHz:0.18%, 1.30 GHz:0.04%, 1.54 GHz:0.44%  (11156)
moon.linux
 
Posts: 1161
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Scaling governor always resets to "interactive"

Unread postby tkaiser » Thu Mar 01, 2018 8:36 pm

moon.linux wrote:
Code: Select all
sudo update-rc.d ondemand disable


The last step disables the "ondemand" daemon, which would otherwise overwrite the changes created by cpufrequtils.


Well, I wouldn't call this 'ondemand' ubuntu thingy a daemon but a broken script instead: https://github.com/armbian/build/issues ... -253460957

I would better use the following just to be sure:
Code: Select all
systemctl mask ondemand


And of course this package should be excluded already at image creation time...
tkaiser
 
Posts: 593
Joined: Mon Nov 09, 2015 12:30 am
languages_spoken: english
ODROIDs: C1+, C2, XU4, HC1

Re: Scaling governor always resets to "interactive"

Unread postby tkaiser » Thu Mar 01, 2018 9:21 pm

odroid wrote:Something is wrong in the cpufreq drivers.


Nope, it's a weird script contained in an Ubuntu package that does the wrong things if the platform is neither x86 nor amd64: https://github.com/armbian/build/issues/499
tkaiser
 
Posts: 593
Joined: Mon Nov 09, 2015 12:30 am
languages_spoken: english
ODROIDs: C1+, C2, XU4, HC1

Re: Scaling governor always resets to "interactive"

Unread postby Jojo » Thu Mar 01, 2018 11:11 pm

moon.linux wrote:@jojo. Could your try the following command
Code: Select all
sudo apt-get install cpufrequtils
echo 'GOVERNOR="ondemand"' | sudo tee /etc/default/cpufrequtils
I had already done so, thats why I was even more confused, that it didn't work...

moon.linux wrote:
Code: Select all
sudo update-rc.d ondemand disable

The last step disables the "ondemand" daemon, which would otherwise overwrite the changes created by cpufrequtils.
This finally did the trick, thanks!!
I think it is REALLY confusing, that we need to DEactivate the "ondemand-daemon", to get the ondemand-governor working... :roll: .

@tkaiser
What you say is sadly a little bit beyond my knowledge horizon :oops: . But at least this seems to be a known issue, and maybe this thread helps by pointing to an issue that is worth to be investigated.

I'd like to mark this thread as [SOLVED], but this is not a real "solution" but not more than a workaround. Anyway, deactivating the "ondemand-daemon" worked for me.

Thanks to all of you!
How to ask questions the smart way:
http://www.catb.org/esr/faqs/smart-questions.html
Jojo
 
Posts: 524
Joined: Mon May 18, 2015 12:13 am
Location: Germany
languages_spoken: english, german
ODROIDs: C1, C1+, C2, HC1, HC2, VU8C

Re: Scaling governor always resets to "interactive"

Unread postby tkaiser » Thu Mar 01, 2018 11:45 pm

Jojo wrote:I think it is REALLY confusing, that we need to DEactivate the "ondemand-daemon", to get the ondemand-governor working... :roll: .


This is nothing you should need to do since this is the distro's job: https://github.com/armbian/build/blob/m ... ns.sh#L210
tkaiser
 
Posts: 593
Joined: Mon Nov 09, 2015 12:30 am
languages_spoken: english
ODROIDs: C1+, C2, XU4, HC1

Re: Scaling governor always resets to "interactive"

Unread postby odroid » Fri Mar 02, 2018 11:59 am

User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Scaling governor always resets to "interactive"

Unread postby tkaiser » Fri Mar 02, 2018 10:28 pm

odroid wrote:We've added a note to the WiKi page

Code: Select all
root@rock64:~# apt-file list initscripts | grep ondemand
initscripts: /etc/init.d/ondemand


Did you test whether your recommendation survives an update of initscripts package on Ubuntu?
tkaiser
 
Posts: 593
Joined: Mon Nov 09, 2015 12:30 am
languages_spoken: english
ODROIDs: C1+, C2, XU4, HC1

Re: Scaling governor always resets to "interactive"

Unread postby moon.linux » Sat Mar 10, 2018 2:15 pm

I feel Odrod XU4 has the same issue with setting of cpufreq governor.
@tkasier thank you for correct command.

Code: Select all
sudo apt-get install cpufrequtils
echo 'GOVERNOR="ondemand"' | sudo tee /etc/default/cpufrequtils
systemctl mask ondemand
moon.linux
 
Posts: 1161
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english


Return to Issues

Who is online

Users browsing this forum: No registered users and 1 guest