X15 – Progress report – 2018Q1

It’s been a while since I’ve written about the progress on X15. As an open source project I work on in my free time, its development pace is unsurprisingly not constant, but despite that, a lot of progress was made since it was seriously restarted in 2017.

Among the biggest changes are the new build system, xbuild, and the integration of kconfig, the configuration tool used by the Linux kernel. Together they make the kernel configuration highly scalable, allowing X15 to run and scale on potentially any 32-bit or 64-bit target. This work was mainly motivated by the ARM port, as this architecture includes a huge diversity of hardware, which couldn’t cleanly be supported with a non-scalable configuration system.

Another major change is time, and in particular real-time. At long last, low resolution timers were introduced, along with timed variants for many synchronization tools, and the existing code is being reworked to make use of them where appropriate, instead of counting ticks or using tight loops. Real-time has become a primary goal of the project, and much of the current work aims at fixing the existing code to make it comply with the rules of real-time, i.e. make all non-preemptible critical sections short and time-bounded. Mutexes with a complete priority inheritance algorithm were added, and spinlocks have been rewritten to use queues, guaranteeing fairness among threads.

The current code of the kernel no longer uses memory barriers, relying instead on C11-style atomic operations. Instead of stdatomic.h, the kernel provides its own more compact interface, which can be implemented with CPU-local atomic operations on single-processor machines. This makes it possible to run X15 on single-processor targets with no atomic instructions, such as classic ARM7 or ARM9 processors.

Lockless synchronization was completely rewritten, with the introduction of a true, preemptible RCU implementation, an effort also motivated in large part by the real-time goal. This RCU implementation is original in that it is built on top of SMP-scalable reference counters, which were too similar to the previous lockless synchronization implementation. This removes redundancy, makes the code more elegant, and the resulting binaries smaller.

An ARM port has been started, and in particular, a portable page table based MMU driver, although the work is currently on hold because of missing dependencies, but it is promising.

Other additions include a build script that tests lots of option combinations, as well as Asciidoc documentation.