Kodi Community Forum
Linux High CPU usage on Xubuntu 19.10 while Idle - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Linux High CPU usage on Xubuntu 19.10 while Idle (/showthread.php?tid=350652)

Pages: 1 2 3


High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-04

Hi there,

I'm new here. I never had to post anything since all the problems I've ran into on Kodi have been easily solve with a quick Google search. But I'm definitely stuck now.

Basically, if I leave Kodi open (foreground or background), whether playing video or just sitting at the home screen, Kodi can use anywhere from 70% to 120% of the CPU thread that it's on, and of course, my laptop starts sounding like a jumbo-jet. I've tried renaming my .kodi folder to simulate a fresh install, including actually reinstalling kodi, but nothing changes.

I'm aware my hardware it fairly new, so it could be Xubuntu not being able to run perfectly on it, but apart from a non-functioning mic, I haven't noticed anything else.

Anyway, logs are here: https://pastebin.com/GfApvUv9
Also, if starting kodi from the command line, I see this output:
Quote:libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
So it looks like video hardware acceleration isn't working. But like I said, even sitting at the home screen of a  fresh install is stressing my system.

Any troubleshooting tips would be greatly appreciated.

thanks


RE: High CPU usage on Xubuntu 19.10 while Idle - fritsch - 2020-01-04

Howto say it politely :-)

The OS you have installed does not support your hardware:

a) VAAPI acceleration is broken and not existent (additionally you have some vdpau to vaapi wrapper installed, which is for sure not the default on a freshly installed system - remove it)
b) Your mesa opengl acceleration is not working properly
Quote:2020-01-03 10:38:54.673 T:140558415661760  NOTICE: GL: No pixel shader, fixed pipeline in use

Fix the OS first and then try kodi again.


RE: High CPU usage on Xubuntu 19.10 while Idle - yasij - 2020-01-04

(2020-01-04, 00:43)s2hsieh Wrote: Hi there,

I'm new here. I never had to post anything since all the problems I've ran into on Kodi have been easily solve with a quick Google search. But I'm definitely stuck now.

Basically, if I leave Kodi open (foreground or background), whether playing video or just sitting at the home screen, Kodi can use anywhere from 70% to 120% of the CPU thread that it's on, and of course, my laptop starts sounding like a jumbo-jet. I've tried renaming my .kodi folder to simulate a fresh install, including actually reinstalling kodi, but nothing changes.

I'm aware my hardware it fairly new, so it could be Xubuntu not being able to run perfectly on it, but apart from a non-functioning mic, I haven't noticed anything else.

Anyway, logs are here: https://pastebin.com/GfApvUv9
Also, if starting kodi from the command line, I see this output:
Quote:libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
So it looks like video hardware acceleration isn't working. But like I said, even sitting at the home screen of a  fresh install is stressing my system.

Any troubleshooting tips would be greatly appreciated.

thanks 
For VAAPI, i965-va-driver doesn't and won't support Ice Lake. You'll need to use the newer intel-media-driver. You can try installing the version that ships with Ubuntu 19.10 (19.2.1):
sh:
sudo apt install intel-media-va-driver-non-free

You'll need to set the environment variable LIBVA_DRIVER_NAME=iHD to switch to it.

For your hardware, you're going to need a newer version of Mesa (at least 19.3), and potentially a newer version of the intel-media-driver.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-05

new log: https://pastebin.com/PHvuLVNM

Thanks yasij , you save me quite a bit of research time. I had just started looking into intel-media-va-driver and newer mesa versions. I should probably let Xubuntu know that their hardware detection is buggy.

Sadly, even though va-api is now working, Kodi is still using a lot of cpu. As I said, even leaving Kodi open at the home screen (so nothing is playing) for a few minutes ramps up the cpu.

kodi now outputs this when run from the command line
Quote:libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
However, when run from the gui desktop, it does not seem to enable va-api. I'll have to confirm this though, not 100% sure on that,

Any thoughts?


RE: High CPU usage on Xubuntu 19.10 while Idle - fritsch - 2020-01-05

For your home screen issue: You don't have proper 3D acceleration yet as you were told in both replies you got. You need to upgrade mesa. You can use the oibaf ppa for testing and (ppa-purge if it breaks).
I overlooked that you have 19.3.1 already.

For Home-Screen CPU load: Enable visualize dirty regions via advancedsettings.xml and check what is constantly redrawn.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-05

hey fritsch,  it looks like kodi is redrawing the whole screen, but do you really think it's a rendering issue? I mean, this happens even when kodi isn't in the foreground, so in theory nothing to render.
Also, according to the visualizer, kodi only redraws when you are interacting with it right? So I opened Kodi and just left it there for a few minutes, and sure enough, my fans starts kicking in, indicating the CPU is under a constant medium to high load. It seems like something in the backend is taxing the CPU, am I wrong in thinking that?

Thoughts?


RE: High CPU usage on Xubuntu 19.10 while Idle - fritsch - 2020-01-05

Find out out. You have all the tools Linux provides. Start with "top" and press "H" in top to find which kodi thread produces the load.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-05

Sorry, I actually already knew it was the kodi-x11 process. But that basically means everything that kodi needs to run on x11.


RE: High CPU usage on Xubuntu 19.10 while Idle - fritsch - 2020-01-05

"H" shows the threads within kodi - that's why I asked for that.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-06

Ah, my apologies. I see PeripBusUSBUdev at the top of the list, hogging 80%+ of that thread.
So, maybe the usb hub that links my laptop to my monitor is the issue, but under the direction of Kodi.


RE: High CPU usage on Xubuntu 19.10 while Idle - fritsch - 2020-01-06

You can disable CEC within kodi, then this will stop. Btw. it should stop after around 60 seconds.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-06

So, as I have a monitor not a TV attached, the CEC option does not show up in Peripherals, in fact that list is empty. Is there another way to turn off CEC?
I've also disabled JoyStick support by setting the joystick driver to none. That seems to have brought the PeripBusUSBUdev process down a bit.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-10

Turns out it's a linux kernel bug. I came across this article. https://news.softpedia.com/news/canonical-outs-major-linux-kernel-update-for-all-supported-ubuntu-releases-528781.shtml

Ran the update, Kodi now uses less then 10% CPU.

Will update if this turns out to be a fluke.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-10

Hum, after a reboot after the kernel update, the high cpu usage of PeripBusUSBUdev when Kodi is running has returned. Not sure what was disabled after the kernel update before the reboot.


RE: High CPU usage on Xubuntu 19.10 while Idle - s2hsieh - 2020-01-11

Ok, I've given up fixing this properly. I know now that the issue is mostly due to the fact that linux is not respecting the power saving mode set in my BIOS that keeps my CPU at 15W, but the funny thing is that it does respect it for the first linux boot after I boot into Windows where Lenovo Ventage apparently sets the CPU power profile again. For some reason, PeripBusUSBUdev goes crazy if the CPU profile isn't set to power saving, so I've resorted to using the cpulimit command to enforce a cap on the kodi-x11 process. If anyone want to use this hack, just launch this script instead of kodi directly, you'll have to play with the cpu_percent_limit value to make sure it doesn't effect the smoothness of the gui too much, and also the wait_for_kodi value depending on how fast kodi starts on your system.
Quote: cpu_percent_limit=30
wait_for_kodi=1
kodi -fs &
sleep $wait_for_kodi
cpulimit -l $cpu_percent_limit -p $(pgrep kodi-x11)
Oh, and of course you need to have the cpulimit package, my system did not have that installed by default.