Daily Log - 17th May 2020

This is a combined update of the 16th and the 17th of May 2020.

1. Beagles and RPis out of the bags

I brushed off my BeagleBoards and Raspberry Pi 4B boards and got them loaded and up with the latest software images. It was mostly smooth. RPi unattended setup was done through enabling SSH and WiFi configuration on first boot using instructions provided here. BeagleBone needed internet connection sharing which I was able to successfully achieve on both Mac and Linux and I will shortly create a blog post about it, but what I can say about it is that it has been made relatively simple on Linux, last I did this I had to create a bunch of iptables forwarding rules, now the Ubuntu seems to do it automatically in the background. The flow is now largely the same on all 3 platforms.

Next up: Forward port BeagleLogic to kernel version 4.19 (for the AI) and 5.4 for the regular BeagleBones.

2. IIO, libiio, splice, vmsplice and Zero Copy in Linux

I am planning to do a rewrite of BeagleLogic to make it more mainline-friendly. I’ve been referred to the Industrial I/O (IIO) subsystem in the past and mentioned that this is the way to go - BeagleLogic would have probably used this subsystem if I had known about it while I was writing it. In my exploration of IIO, I came to know that my current employer has made various contributions to the IIO subsystem, and in one of the articles, they mentioned vmsplice and splice as ways to accelerate the data flow through “Zero Copy” as future plans. Out of various references I found online, the best one was a YouTube talk from 2011 LinuxConf AU at https://www.youtube.com/watch?v=dbH3OPfbv0M which has examples at the very end on how to use it in C code. I’ll be implementing this in the BeagleLogic web client backend - which I’d like to rewrite in Rust(?) and have tests for the protocol as well to ensure correct data transport.

3. Kernel Compilation Benchmarks

In the past few days I have tried compiling and recompiling the Linux kernel several times. It seems it takes me around ~20-30 minutes to compile the BeagleBoard.org 5.4 kernel. When I was trying to do this in a VM on my Mac, it causes thermal throttling to kick in and slow down the compilation process. I next hired a VPS to try out compiling the kernel on another more powerful CPU (probably an AMD EPYC processor) and it takes more or less the same time as my laptop does. So I seem to be better off using my laptop and saving on VPS costs and maybe invest in a nice build rig sometime in the future.

4. Laptop Thermal Throttling

This has been going on and off. My 2018 MacBook Pro seems to work well on regular light work (internet browsing, music, coding) but throttles very badly, to the point of being unresponsive on high CPU loads (VM, YouTube 4K on Firefox), especially when I connect an external display - even Sidecar (strange). It’s interesting how CPU+GPU usage as seen via the Intel Power Gadget causes more throttling than just the CPU itself and in a warm environment like here in India, the situation gets much worse. I can work around by keeping the window where I compile minimized or not on Sidecar (minimize GPU display updates) or keep any graphics intensive workload on the Mac’s screen itself but it gets very frustrating sometimes and I wonder how Apple can fix this (which it probably wouldn’t, or it thinks it has with the new 2019 MacBooks which have a better thermal design). I may get fed up one day and build myself an AMD Ryzen box, but I am waiting it out for the 4th generation Ryzen high performance parts as I hear a lot of good things about them - hopefully they can help me compile the kernel (or any project I throw at it) faster :) .

I am now of the opinion that one should have two machines - one that has a nice aesthetic, display and keyboard (looking at you Apple and Dell XPS 13" models) for general work and the other machine a beast that should never be thermally challenged. You SSH into the beast and do your job primarily there. It’d be nice if one machine can do both but the MacBook Pro has terribly disappointed me so far as the last machine you’d ever need to buy - maybe it was just bad timing but anyway.

That’s it for today’s update.