Kodi Community Forum

Full Version: Unusual spikes in CPU usage leading to audio problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I'm experiencing a somewhat perplexing CPU usage issue with the following setup:

Gigabyte Brix GB-BXA8-5545 (AMD Richland A8-5545M APU)
G.Skill 8GB (2x4GB) DDR3 1333 SO-DIMM
Plextor M5M PX-128M5M 128GB SSD

Connection Method:
HDMI from Gigabyte Brix to Pioneer Elite SC-37.

Network Environment:
Gigabit wired

Music and Images source:
Shared on Windows 8.1 system on the same physical network and subnet.

Operating System:
Ubuntu 14.04 LTS - XBMCbuntu (GNU/Linux 3.13.0-27-generic x86_64)

XBMC Version:
Installed: 2:13.1~git20140526.0650-gotham~rc1-0trusty

The issue is easily reproduced by playing a flac or m4a file over a SMB share and then navigating to pictures and selecting a SMB share that contains 10,000 images of various size and dimensions. The issue usually presents itself as severe static in the audio playback immediately following the display of the folder contents in the UI. To be more specific, while the folder is loading or while media scanning of the folder contents is taking place, XBMC CPU usage is over 70% according to the debug output, but as soon as the folder is finished loading the XBMC CPU usage spikes to as high as 160% and the audio playback starts breaking up.

It appears the reason for this is CPU usage on one of the four cores.

If this is done multiple times in a row, it's possible to into a state where one of the CPUs will become wedged at 100%, making audio playback completely intolerable until you reboot. Interestingly, the 100% load appaers to float around between CPUs, meaning it's not always CPU0 at 100%.

Example top output with threads view enabled:
top - 13:50:57 up 37 min, 2 users, load average: 1.73, 1.22, 0.85
Threads: 232 total, 3 running, 229 sleeping, 0 stopped, 0 zombie
%Cpu(s): 14.3 us, 3.3 sy, 24.8 ni, 57.5 id, 0.0 wa, 0.1 hi, 0.0 si, 0.0 st
KiB Mem: 7280304 total, 974952 used, 6305352 free, 123904 buffers
KiB Swap: 7542780 total, 0 used, 7542780 free. 396948 cached Mem

1790 john 21 1 1752948 290760 31424 R 99.9 4.0 3:20.25 JobWorker
1219 john 20 0 1752948 290760 31424 S 57.9 4.0 10:31.51 xbmc.bin

1151 root 20 0 195192 20172 9620 S 5.6 0.3 2:04.56 Xorg
1497 john 20 0 1752948 290760 31424 S 2.6 4.0 0:53.25 xbmc.bin

Debug log and snapshot of the hardware info screen here:

I imagine the debug log is going to be useless. What would really pin this down is if I went through the trouble to work some oprofile magic, but I really don't think I have the chops for it.

Lastly, these are the only huge CPU spikes I have seen. I am able to get perfect playback of blu-ray quality video and audio. Only if I start navigating around the UI while listening to music do things begin to fall apart.

Any tuning suggestions or troubleshooting steps would be greatly appreciated.
You may need some kernel and mesa patches for this hardware. read http://forum.xbmc.org/showthread.php?tid=174854
I'll give that a try. Thanks very much for the help!
I've seen a few posts by fritsch saying that if someone already has xbmcbuntu v13 installed, they don't have much to do.

Am I correct in saying that only your PPA (for hevc and ffmpeg 2.2.x), and maybe updating the kernel to 3.15-rc6 are necessary? It doesn't appear that there are other AMD-related patches that would apply to xbmcbuntu v13, but I'm probably very wrong.