20.5 - V high CPU use when TV on standby

After updating my Vero 4K+ to the latest version I’m seeing very high CPU usage by the kodi.bin process when the attached TV is on standby. The load average measured by top jumps from 0.2 to 1.3, SSH logins take 30 seconds to complete and the Tvheadend UI (running on the same device) responds very much slower than normal.

My logs are at https://paste.osmc.tv/qexovofowu

I think the issue might be that Kodi is repeatedly trying to connect to a TVHeadend instance which seems unavailable.

See

2024-04-25 13:44:05.410 T:3118 error : AddOnLog: pvr.hts: unable to connect to 127.0.0.1:9982

This is probably causing the high CPU load.

The Tvheadend error log lines were caused by restarting Kodi without Tvheadend running, they don’t appear in a normal boot.

I suspect the problem is that OSMC is now aggressively throttling the CPUs when the TV is off. Using
sudo watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
it seems the CPUs are running at a constant 100MHz using the powersave govenor, while with TV on they switch to the ondemand govenor which runs between 500MHz and 1.5GHz. I only have one Vero device so I can’t confirm what the previous behaviour was.

Yes, we drop CPU down during standby.

But we actually removed some of the lower frequencies in the latest update.

Comparing the Kodi log from the previous version with the current one, the old log includes this line:
2024-03-15 10:45:41.078 T:2795 error <general>: AML: no rw on /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
but the new one doesn’t. In directory /sys/devices/system/cpu/cpu0/cpufreq/ the file scaling_governor is currently RW for group video; unfortunately I don’t know what the permissions were before.

Is it possible that changing the governor on standby didn’t work in previous versions because kodi.bin didn’t have write access to the file, but due to a change somewhere else it has now started working?

Locking the CPUs to 100MHz when the TV is off makes the Vero unusable for any other tasks. In my case I run TVHeadend for off-air recording and also run rsnapshot overnight to back up the other nodes on my LAN.

For my use case I see there is a file ~/.kodi/userdata/standby.py which I could perhaps use to reset the governor after kodi has changed it.

No – it always worked.

I’ll check this out shortly.

Hi! I just wanted to mention that I have the same issue on my 4k+

If it helps, my logs are at https://paste.osmc.tv/fipetilaka

My workaround is to create a file standby.py in /home/osmc/.kodi/userdata/ containing:

import subprocess

subprocess.call(["/usr/bin/echo ondemand | /usr/bin/tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"],shell=True)

This resets the CPU speed after the TV has been turned off, however there is a 5 second delay for some reason before it takes effect.

This issue seems to have been fixed in version 2024.05-1.

Correct.