McMechan's patch collection

A assortment of patches to deal with problems I have had, and to also add features I have felt the need for.

User Mode Linux

User Mode Linux is the linux kernel rehosted to the user environment i.e. glibc so that it runs as a regular user program, this allows any user to have their own complete linux system where they can safely have root access to the uml guest system without requireing any special privlages on the host (real hardware) machine.


A interesting recent addation is the seperate kernel address space (skas) which greatly increases the speed of the UML system. With the requirement of updateing the host with either the host-skas (currently at version 3) patch or by the use of Roger Binns's nifty new skas module, the skas module allows the use of vendor supplied kernels without dealing with the problems of patching a kernel already patched by your vendor.

USB host controller

Originally written by Johan Verrept (Johan.Verrept at advalvas.be) this is a implementaion of a USB host controller he originally made for linux-2.4.0-test6 that uses the /proc/bus/usb/ usbdevfs files on the host instead of real hardware. I found this especially interesting due to some of the USB drivers crashing my host kernel. Johan Verrept kindly forward ported his patch to linux-2.4.18 with uml-patch-2.4.18-29 before sending it to me, it appears that he has little time at the moment to continue work on it.

I had kept it following along with the uml patches but as of 2.5.39 and 2.4.20 the usb host controller model has changed in ways that break the uml-hcd.

umusb-2.4.18-29um-0.1b-2.patch .bz2 for linux-2.4.18 with uml-patch-2.4.18-29

I then continued to keep trying to track the kernel updates

umusb-2.4.18-52 .bz2 for linux-2.4.18 with uml-patch-2.4.18-52

umusb-2.4.19-39 .bz2 for linux-2.4.19 with uml-patch-2.4.19-39 which was first tested on linux-2.4.19-36um I have also applied it to later uml-2.4.19 kernels with little problem.

umusb-2.4.20-4 .bz2 for linux-2.4.20 with uml-patch-2.4.20-4 it appears that that the new version of the host contoller model has been backported from 2.5 and since it breaks the umusb/uml-hcd host controller this does not work at the moment, if you can get it working please inform me and I will add it to this page.

A discussion with Jeff Dike (UML maintinater) and Greg Kroh (USB maintainer) led to moving from the arch/um/drivers to drivers/usb/host However I have not yet mastered the new 2.5 usb structure it will enumerate the devices but does not create them in the UML /proc/bus/usb/ directory.

uml-hcd.2.5.32 .bz2 for linux-2.5.32

uml-hcd.2.5.34-1 .bz2 for linux-2.5.34 with uml-patch-2.5.34-1 this has some bits of my other uml work attached

uml-hcd.2.5.35 .bz2 for linux-2.5.35 it still have bits from when I was tinkering to get 2.5.35 working

uml-hcd.2.5.41-1 .bz2 for linux-2.5.41 with uml-patch-2.5.41-1 it still has bits from when I was tinkering with ubd_kern

uml-hcd.2.5.43-3 .bz2 for linux-2.5.43 with uml-patch-2.5.43-3 it still has bits from ubd_kern tinkering

uml-hcd.2.5.44-1 .bz2 for linux-2.5.44 with uml-patch-2.5.44-1

uml-hcd.2.5.50-1 .bz2 for linux-2.5.50 with uml-patch-2.5.50-1 I still have problems with modules even with Rusty Russel's new modutils.

uml-hcd.2.5.59-1 .bz2 for linux-2.5.59 with uml-patch-2.5.59-1 This version is alas still broken wrt USB I have not yet mastered the host controller model.

uml-hcd.2.6.17.txt .bz2 for linux-2.6.17.6 This version is sort of working with USB.it will work with one device specified by the module parameter usb_device_name=/proc/bus/usb/002/002 which is the default.

Operation of the user mode linux host controller requires that the host system has /proc/bus/usb mounted and writable by the user running the user mode linux kernel. This version may also have locking problems. It can be used as a module (I normally run this way) or built in. I have seen problems when rmmod and modprobe again.

User Mode Linux Block device

I have felt that the ubd block device was lacking in several areas as of 5-27-2003 many of these have been addressed.

COW file creation

COW files had suffered from the O(N) nature of the creation process where each word of the copy on write bitmap was written seperately to zero in a loop.

For large disks this bitmap creation can easily come to dominate the COW file creation process. For example a 512GiB disk will loop ~32,000,000 times whereas now it is but a single system call.

Many ubd disks & Stacked COW files

I have wanted to have many ubd disks at once, so I have patched both 2.4 and 2.5 to remove the limition on disks. I did this by useing dynamic major number allocation and linking each major number to the next.

Previously only one layer of COW file was created. With these patches layers of COW files can be stacked one on top of another, and any or all may be listed in the ubdX= specification e.g. ubd1=COW2,COW1,COW,root_fs or ubd1=COW2,COW1 will both create a COW2 file on top of a file named COW1. But will not create COW1 itself since it would not able to be written in either case.

COW-many-2.5.69-1 .bz2 for linux-2.5.69 with uml-patch-2.5.69-1 it will also apply to the 2.5.70-jm patch below.

COW-many-2.4.20-5 .bz2 for linux-2.4.20 with uml-patch-2.4.20-5

The file arch/um/drivers/cow_util.c can be compiled with gcc -DTEST -o cow_user cow_user.c and then used like uml_moo.

Included is my take on a V3 COW file format complete with offset/length for the file name, and automatic padding so that reading the COW header will not fail the device when the backing file is a raw device.

This version has become much simpler in some respects and I have attempted to clean up/merge the 2.4.20/2.5.69 ubd_kern.c files I have removed the proc stuff since I did not hear any reports of its use and I do not know how to check that it is correct. However the fake major number I know how to test and so it works, The 2.5.69-1 version can even boot from a fake major number device. e.g. ubd=3 root=/dev/hda worked when I tested it.

These versions have been tested with stacks of COW files up to 25 deep and also up to 512 disks each 512GiB in size, though that test had only one COW file for each of the 512 disks and they shared the 512GiB backing file I dont actaully have the 256TiB of disk space.

It will not be too many years however before I can have that much :) moore's law is nice for consumers.

Note that only the first 16 ubd devices should be specified on the command line. It is however fun to try out insane stacks of COW files and huge disk arrays.

UML kernel patchs

uml-patch-2.5.70-jm.bz2 for linux-2.5.70 this is a fore patch of 2.5.69-1 to 2.5.70 cupon