Userdev: A Framework For User Level Device Drivers In Linux

by
Hari Krishna Vemuri

Overview

The Userdev framework allows implementation of device drivers as user processes. It consists of the Userdev kernel driver and the Userdev library. The kernel driver provides the usual device driver interface for the user level device drivers, so that exisiting applications that use the device can continue to work without any modifications, re-compilations or even relinking. The Userdev library hides the protocol details and exports a simple interface that is similar to the usual device driver interface, so that driver development is easier. The framework supports drivers for both character and block devices.

The Userdev framework has built-in mechanisms for providing interrupt and direct memory access (DMA) support for the user level device drivers. It also interacts with the kernel code so that a file system residing on a block device can be mounted and used.

To demonstrate the feasibility of using the framework to develop user level device drivers, we have developed three prototype drivers. These are for a parallel port line printer, a floppy disk drive, and a RAM disk. Experiments show that these drivers perform almost as efficient as their kernel counterparts.

Implementation

The Userdev kernel driver is implemented as a Linux kernel module that can be dynamically loaded into the kernel. The kernel driver relays requests at the device driver interface to user level driver processes that have registered with it. The user level device drivers directly interact with the hardware and return back the result of the operation. Application processes talk to the user level device drivers via the system call interface of the kernel Userdev driver. More details can be obtained from the Master's thesis of Hari Krishna Vemuri.

Source code organization

On uncompressing the above source code file, a directory by the name userdev is created that encapsulates the whole software. The userdev directory contains the module, driver and apps sub-directories. The module directory has the sources for the kernel driver. The driver directory has lib, floppy, lp and ramdisk sub-directories that contain sources for the Userdev and Parport librares, user level floppy driver, user level parallel port line printer driver and the user level RAM disk driver respectively. The apps directory contains sample application programs that can used to test the user level device drivers. Each directory has a README file that gives a brief description of the contents of the directory.

Installation instructions

The sequence to steps required to be done to install the Userdev software are as follows:
  1. Untar the downloaded file in the directory where you want to place the userdev software.
  2. Change directory to the userdev sub-directory created.
  3. Then execute the make utility. The make utility executes recursively to build the whole software, including the kernel driver, Userdev library and the user level device drivers.
  4. Next, run the installation script installscript in the userdev directory as a super-user, in order to create the required device files for the kernel userdev driver and the user level device drivers. The script can be tailored to once requirements bearing the following in the mind:
  5. Change to the module sub-directory. Install the module using insmod command or using make install which does the same with the default module parameters.
  6. Now one can run any user level device driver process.