4th RTL Workshop: Calling Plain Linux Device Drivers Functions from Hard Real Time Tasks
Dec 19, 1997 — by LinuxDevices Staff — from the LinuxDevices Archive — viewsAbstract
Processes running under plain Linux usually access I/O devices through device drivers implemented monolithically in the kernel or as loadable kernel modules. This has the advantage of exposing standard interfaces for all I/O devices and enables processes running without root privileges to access I/O. Unfortunately, hard real time tasks can not use the standard kernel interfaces to I/O devices, since that would force an execution of kernel code, which does not comply with the hard real time requirements. This problem has been dealt with by implementing special device drivers to be used by real time tasks. Nonetheless, those special device drivers adhere more to the concept of a library than to the concept of a device driver. Each special device driver exposes his own set of functions that can be called by real time tasks, but there is not a common set of functions among all special device drivers. In other words, the concept of uniformity is not implemented. Obviously, it is highly desirable to use the same device driver for programs running under plain Linux or under real time. If soft real time is enough for the application, LXRT can be used. LXRT tasks runs in user space but under control of the real time linux scheduler. By running under user space, LXRT tasks can use standard C library calls to access I/O through standard device drivers. However, to access the device driver a portion of the plain Linux kernel code is executed on behalf of the LXRT task. Since the temporal behavior of the kernel code is not deterministic, the real time scheduler is force to switch the LXRT task to soft real time mode while it is executing kernel code. This paper addresses that problem and shows that under some assumptions it is possible to avoid the switch to soft real time mode while accessing device drivers and therefore the hard real time properties of the task are retained. By using the method proposed in this paper, the very same device driver can be used by plain Linux processes, by hard real time tasks running in kernel space, by LXRT tasks running in soft real time mode and by LXRT tasks running in hard real time mode. The effectiveness of the method is demostrated by the implementation of a device driver for a robot controller. Test programs written in C++ as plain Linux programs, as real time kernel modules, as LXRT soft real time tasks and as LXRT hard real time task, all accessing the controller through the device driver have their temporal behavior discussed.
(Paper not available)
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.