Optimizing BeagleBone CPU Load


#1

When I run the ROV for a longer time, I always recognize that the video gets jerky, making it diffcult to control the ROV. CPU load of the BeagleBone seems to be rather high in the cockpit software (around 80%), so I can imagine that the choppy video is due to a high cpu load.

When I SSH to the ROV, the top command shows me something like this:


The cpu load by mjpeg streamer is typically around 30%, but it it always accompnied by to other processes (kworker/u:0 and kworker/u:1) which eat up another 40% of cpu.

With some googling I found out that many people have similar issues with kworker, especially when operating USB media devices like webcams or audio speakers. It seems as it has to do with USB DMA access. The solution I heard most often is to recompile the linux kernel with the config option 'CONFIG_MUSB_PIO_ONLY=y' which disables DMA for USB devices and reduces the load generated by kworker to almost zero.

However, I'm stuck with recompiling the kernel the rigth way (don't know how to get the source files, how to recompile, how to echange the current kernel by the new one). Maybe someone can help here? Has anyone experienced the same?

-Stefan


#2

Hm. Thanks for recommending a possible solution. Your right on as far as the cause goes. This site http://cateee.net/lkddb/web-lkddb/MUSB_PIO_ONLY.html says you may be able to disable in runtime

"When DMA is enabled at compile time, you can still disable it at run time using the "use_dma=n" module parameter."


#3

Brian, thanks for pointing me in this direction. So far I found that the Beaglebone uses a (dedicated) musb-ti81xx driver for USB. As far as I understand with my limited linux system experience, it is compiled into the kernel and the compilation time config cannot be overridden at run time or boot time.

Seems that a freshly compiled kernel with the CONFIG_MUSB_PIO_ONLY=y config setting is the only way to disable DMA for USB. But I'm struggling with finding the right way to do that (where to get the sources, setting up an ARM cross compiler toolchain etc.). Maybe someone can give me directions?


-Stefan


#4

Hey Stefan,

The current https://github.com/OpenROV/openrov-image project does compile everything from source and would be one way to alter the Kernel. It also supports setting up the cross compiler and other pre-reqs.

I also assume there is a easy way to simply recompile the Kernel directly from the beagle bone, but I'd need to do some reading to remind myself how to recompile the kernel from the command line again.