As I kept watching some DotA videos online, Cherry (cherry@) was hard at work trying to integrate the uvm_hotplug(9) changes into the branch that was at the time the NetBSD-CURRENT to merge his changes into the code upstream so that, both uvm_hotplug(9) and the legacy memory segment handler co-exist side by side.

The uvm_hotplug(9) being a fundamental change in the way NetBSD’s virtual memory works, we needed to make sure that the existing system works as is, while hot-plug be enabled in the kernel separately when it is build with that option enabled. This means that the uvm_hotplug(9) is mutually exclusive with the current static array implementation.

Once Cherry was done with most of the merging with strategically paritioning the code with UVM_HOTPLUG macros and conditionally defining mutually exclusive parts of the code. Cherry’s greatest challenge was making sure that the new changes were written in such a way that the MD part of the code used up all the new API so that UVM_HOTPLUG is not needed to separation of code within the MD parts of NetBSD, because that would involve changing code in 79 different ports (the number of ports that existed for NetBSD at the time of writing this post), and he had already spend considerable amount of time on the MD parts rewriting sections that referenced the old vm_physseg[] as well as struct vm_physseg*, which he tells me is the experience equivalent of “yak shaving”.

My job was to make sure that I could conditionally compile these mutually exclusive parts in the ATF tests making sure the ATF compiles are not broken depending on which implementation that is being tested.

During the test development we made sure that the tests itself were implementation agnostic and this was very important so that the same tests could be run on either of the implementations to see what failed and why. Except for some minor pre-conditions for the tests which I had to segregate using the UVM_HOTPLUG macro, most of the tests worked out of the box as expected after the merge.

By the end of the merge we had the options enabled in the sys/arch/<arch>/conf file by adding in one single line to the GENERIC file. Me being lazy as usual made a GENERIC_HOTPLUG for ease of building and put it in my conf folder.

1
2
3
4
5
# $NetBSD$

include "arch/i386/conf/GENERIC"

options         UVM_HOTPLUG     # Experimental uvm_hotplug(9) api.

After this merge our work mostly focused on this merged branch making our code much closer to the release into NetBSD-CURRENT. But all was not done, we still had to benchmark how well our API performed with respect to the old one.