a comparative study of the linux and windows device driver architectures with a focus on ieee1394...
TRANSCRIPT
A Comparative Study of the Linux A Comparative Study of the Linux and Windows Device Driver and Windows Device Driver Architectures with a focus on Architectures with a focus on
IEEE1394 (high speed serial bus) IEEE1394 (high speed serial bus) driversdrivers
Melekam TsegayeMelekam [email protected]@campus.ru.ac.za
Supervisors Prof. Richard Foss, Bradley Klinkradt
OverviewOverview
The Linux and Windows driver The Linux and Windows driver architecturesarchitectures
The Linux and Windows IEEE 1394 The Linux and Windows IEEE 1394 driver stacksdriver stacks
Driver development on the two platformsDriver development on the two platforms
Results of the studyResults of the study
Why the study was conducted ?Why the study was conducted ?
Microsoft Windows and Linux Microsoft Windows and Linux Two of the most popular operating systemsTwo of the most popular operating systems No previous comparisons of their driver No previous comparisons of their driver
architectures done by other researchersarchitectures done by other researchers
IEEE 1394 (firewire)IEEE 1394 (firewire) Popular bus offering high data transfer ratesPopular bus offering high data transfer rates Active research area for the CS department’s Active research area for the CS department’s
Audio Engineering GroupAudio Engineering Group
IEEE 1394IEEE 1394
Data Transfer rates of 100, 200 and 400 Data Transfer rates of 100, 200 and 400 MbpsMbps
Isochronous mode of transferIsochronous mode of transfer Guaranteed bandwidth (80%)Guaranteed bandwidth (80%)
Asynchronous mode of transferAsynchronous mode of transfer Guaranteed packet delivery (20% or more) Guaranteed packet delivery (20% or more)
Fully plug ‘n playFully plug ‘n play
IEEE 1394 Consumer ProductsIEEE 1394 Consumer Products
Device DriversDevice Drivers
A driver is a piece of software that extends a A driver is a piece of software that extends a kernel’s functionality kernel’s functionality
Drivers enable applications (through the kernel)Drivers enable applications (through the kernel) to transfer data to and from a deviceto transfer data to and from a device to control the a device to allow modification of its to control the a device to allow modification of its
attributesattributes
Composed of a set of routines that a kernel calls Composed of a set of routines that a kernel calls at appropriate times e.g. read/writeat appropriate times e.g. read/write
Typical driver routinesTypical driver routines
A driver would implementA driver would implement InitialisationInitialisation CleanupCleanup OpenOpen ReadRead WriteWrite I/O Control (ioctl)I/O Control (ioctl) CloseClose
The Windows driver architectureThe Windows driver architectureStandard model Standard model The Windows Driver The Windows Driver
Model (WDM)Model (WDM)bus, functional & bus, functional & filter driversfilter drivers
PnP & Power PnP & Power managementmanagement
CommunicationCommunication I/O request packets I/O request packets (IRPs)(IRPs)
The Linux driver architectureThe Linux driver architectureNo standard driver No standard driver model model Drivers are modulesDrivers are modules No PnP & Power No PnP & Power
management management message message dispatchingdispatching
Communication Communication through direct through direct function callsfunction calls
Side by side comparison of the two driver Side by side comparison of the two driver architecturesarchitectures
LinuxLinuxWindowsWindows
IEEE 1394 driver stacksIEEE 1394 driver stacks
The Windows IEEE 1394 stack The Windows IEEE 1394 stack closed sourceclosed source maintained by Microsoftmaintained by Microsoft stablestable
The Linux IEEE 1394 stack The Linux IEEE 1394 stack open sourceopen source maintained by the Linux 1394 community maintained by the Linux 1394 community
(private individuals)(private individuals) tagged experimentaltagged experimental
The Windows IEEE 1394 stackThe Windows IEEE 1394 stack
Host controllerHost controller
Bus driverBus driver
Client driversClient drivers
Communication Communication I/O request I/O request
block (IRB)block (IRB)
The Linux IEEE 1394 stackThe Linux IEEE 1394 stack
Host controllerHost controller
Bus driversBus drivers
Client driversClient drivers
CommunicationCommunication direct function callsdirect function calls
Direct driver Direct driver possiblepossible
Side by side comparison of the two Side by side comparison of the two
IEEE 1394 stacksIEEE 1394 stacksLinuxLinuxWindowsWindows
The Windows IEEE 1394 The Windows IEEE 1394 implementationimplementation
The Linux IEEE 1394 The Linux IEEE 1394 implementationimplementation
What operations should IEEE 1394 What operations should IEEE 1394 client drivers provide ?client drivers provide ?
Asynchronous OperationsAsynchronous Operations ReadRead WriteWrite LockLock ListenListen Register Asynchronous ListeningRegister Asynchronous Listening Deregister Asynchronous ListeningDeregister Asynchronous Listening
Isochronous operationsIsochronous operations ListenListen TalkTalk Asynchronous streamingAsynchronous streaming
What operations should IEEE 1394 What operations should IEEE 1394 client drivers provide ? (Continued)client drivers provide ? (Continued)
Bus reset handlingBus reset handling Register Bus Reset HandlerRegister Bus Reset Handler Generate Soft Bus ResetGenerate Soft Bus Reset
Obtain Bus Information (e.g. node count)Obtain Bus Information (e.g. node count)
Local configuration ROM manipulationLocal configuration ROM manipulation
Network troubleshooting Network troubleshooting Pinging of nodes Pinging of nodes
Device Driver Development Device Driver Development EnvironmentsEnvironments
Issues to be considered when Issues to be considered when creating driverscreating drivers
Memory managementMemory management The kernel provides memory allocation/de-The kernel provides memory allocation/de-
allocation routinesallocation routines Has two pools of memory (swappable, non-Has two pools of memory (swappable, non-
swappable)swappable)
Data structuresData structures The kernel provides implementations for The kernel provides implementations for
queues, lists, stacksqueues, lists, stacks Synchronisation with spin locks, mutexes, Synchronisation with spin locks, mutexes,
semaphores, signal objectssemaphores, signal objects
Issues to be considered when Issues to be considered when creating drivers (Continued)creating drivers (Continued)
Drivers routines Drivers routines must be re-entrant i.e. should be executable must be re-entrant i.e. should be executable
by multiple threads with no problemsby multiple threads with no problems avoid recursionavoid recursion
Hardware Abstraction LayerHardware Abstraction Layer use HAL routines provided by the kernel to use HAL routines provided by the kernel to
access hardwareaccess hardware
Map of software produced during Map of software produced during this studythis study
Windows raw1394 driverWindows raw1394 driver
Linux raw1394-2 driverLinux raw1394-2 driver
Linux Ieee1394diagLinux Ieee1394diag
Driver TestsDriver Tests
Tests were run to determineTests were run to determine highest data transfer rates that can be achieved by highest data transfer rates that can be achieved by
each of the IEEE 1394 driverseach of the IEEE 1394 drivers how close these came to the theoretical maximum of how close these came to the theoretical maximum of
50MB/s50MB/s
Bus analyser used to measure Bus analyser used to measure the duration of data transfers the duration of data transfers the amount of data transferredthe amount of data transferred
Calculated Calculated the data transfer rate in MB/sthe data transfer rate in MB/s
Test resultsTest results
Isochronous mode Isochronous mode Windows raw1394Windows raw1394
8.9 MB/s 8.9 MB/s packet size 1024 bytespacket size 1024 bytes
Linux raw1394Linux raw13944.5 MB/s 4.5 MB/s packet size 512 bytespacket size 512 bytes
Isochronous mode (buffered)Isochronous mode (buffered) Linux raw1394-2Linux raw1394-2
8.9 MB/s 8.9 MB/s packet size 1024 bytespacket size 1024 bytes
Windows raw1394Windows raw139417.7 MB/s17.7 MB/spacket size 2048 bytespacket size 2048 bytes
Test results (continued)Test results (continued)
Drivers from both Linux and Windows do Drivers from both Linux and Windows do not transfer data at a rate close to the not transfer data at a rate close to the theoretical theoretical 50MB/s50MB/s They achieve almost half that They achieve almost half that
due to the PCI bus bottleneck (theoretical due to the PCI bus bottleneck (theoretical 132MB/s) 132MB/s)
In practice have that availableIn practice have that available shared by all I/O devices attached to the PCI busshared by all I/O devices attached to the PCI bus The PCI bus has latency problemsThe PCI bus has latency problems
driver implementation may not be efficientdriver implementation may not be efficient
ConclusionConclusion
A comparison of the Windows and Linux driver A comparison of the Windows and Linux driver architectures has shown thatarchitectures has shown that Drivers for the two platform have similar componentsDrivers for the two platform have similar components
composed of routines for performingcomposed of routines for performing I/O and device controlI/O and device control
drivers are modules which are loadable at runtimedrivers are modules which are loadable at runtime Windows has a formally defined driver model, Linux Windows has a formally defined driver model, Linux
does not.does not. PnP and power management support integrated in PnP and power management support integrated in
the Windows architecture, not so in Linuxthe Windows architecture, not so in Linux
Conclusion (continued)Conclusion (continued)
A comparison of the Windows and Linux IEEE A comparison of the Windows and Linux IEEE 1394 stacks has shown that1394 stacks has shown that Their IEEE 1394 driver stacks are broken up into Their IEEE 1394 driver stacks are broken up into
similar layerssimilar layers host controller, bus and client driver layershost controller, bus and client driver layers
Each stack provides the standard IEEE 1394 Each stack provides the standard IEEE 1394 operations (both asynchronous and isochronous)operations (both asynchronous and isochronous)
The Linux IEEE 1394 stack is open source while The Linux IEEE 1394 stack is open source while the Windows stack is proprietarythe Windows stack is proprietary Easier to create IEEE 1394 drivers for Linux than Easier to create IEEE 1394 drivers for Linux than
Windows since all source code is availableWindows since all source code is available
Future workFuture work
IEEE 1394.1 bridge awarenessIEEE 1394.1 bridge awarenessIEEE 1394.1 IEEE 1394.1
allows extending the no. of nodes to 64K instead of the current 63allows extending the no. of nodes to 64K instead of the current 63 still in draft phasestill in draft phase
The Windows and Linux IEEE 1394 driver developers did not take The Windows and Linux IEEE 1394 driver developers did not take into account IEEE1394.1 bridging in their designinto account IEEE1394.1 bridging in their designThis study identified bridge awareness requirementsThis study identified bridge awareness requirements
implementation possible for the Linux 1394 stackimplementation possible for the Linux 1394 stack not for the Windows 1394 stack (closed source)not for the Windows 1394 stack (closed source)
Full IEEE 1394.1 implementation and testing not done during this Full IEEE 1394.1 implementation and testing not done during this studystudy
no IEEE 1394.1 bridging hardware availableno IEEE 1394.1 bridging hardware available the standard may changethe standard may change
Questions ?Questions ?