RTDM and user space hardware drivers
Hi everybody,
the RTDM API is really very good as API for drivers.
I have a real time (Xenomai) application in user space that has to access PCI boards.
The "classical" approach is now to use a kernel driver and to use RTDM as interface
between the user space application an the kernel space driver.
However, for performance issues, I prefer to write a pure user mode driver.
As the memory of the PCI board can be accesses from user space (using /dev/mem)
I want to write a pure user space driver as this seems to me more efficient (and easier to debug) than a kernel driver.
Also, only one application is accessing the driver at a time, I can link the driver directly to my application.
My questions are now:
1. Is it possible to use the RTDM API also for pure user space drivers?
2. Is there any experience concerning the performance of a user space driver versus a kernel space driver?
In my use case, I have to write and read about 60 byte (each direction) of (block) data to/from the PCI I/O system.
Thanks for any ideas or hints on that!
Regards
Mathias
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Hi,
I think you need only a standard kernel driver that mmaps the memory area of your pci board.
Thus, from user space program , you mmap it and can do whatever you want in userspace world
Best Regards
steph
Quoted 24 lines · M. Koehrer
Hi everybody,
the RTDM API is really very good as API for drivers. I have a real time (Xenomai) application in user space that has to access PCI boards.
The "classical" approach is now to use a kernel driver and to use RTDM as interface
between the user space application an the kernel space driver.
However, for performance issues, I prefer to write a pure user mode driver.
As the memory of the PCI board can be accesses from user space (using/dev/mem) I want to write a pure user space driver as this seems to me more efficient (and easier to debug) than a kernel driver.
Also, only one application is accessing the driver at a time, I can link the driver directly to my application.My questions are now:
1. Is it possible to use the RTDM API also for pure user space drivers?2. Is there any experience concerning the performance of a user space driver versus a kernel space driver?
In my use case, I have to write and read about 60 byte (each direction) of (block) data to/from the PCI I/O system.Thanks for any ideas or hints on that!
Regards
Mathias
Quoted 12 lines · M. Koehrer
Hi everybody,
the RTDM API is really very good as API for drivers.
I have a real time (Xenomai) application in user space that has to access PCI boards.
The "classical" approach is now to use a kernel driver and to use RTDM as interface
between the user space application an the kernel space driver.
However, for performance issues, I prefer to write a pure user mode driver.
As the memory of the PCI board can be accesses from user space (using/dev/mem)
I want to write a pure user space driver as this seems to me more efficient (and easier to debug) than a kernel driver.
Also, only one application is accessing the driver at a time, I can link the driver directly to my application.
Quoted 2 lines
My questions are now:
1. Is it possible to use the RTDM API also for pure user space drivers?
There is no RTDM driver API exported to user space yet, it's still just a plan for the future.
Quoted 4 lines
2. Is there any experience concerning the performance of a user space driver versus a kernel space driver?
In my use case, I have to write and read about 60 byte (each direction) of (block) data to/from the PCI I/O system.
User space drivers can improve performance if you transfer a lot of data and save potential user/kernel copy-steps this way (though, zero-copy can also be realised with kernel drivers) or if you do a lot of driver calls and the call-overhead becomes noticeable. This works fairly well for exclusive devices (only one user process at a time). But once you have to share/multiplex a devices, performance quickly becomes worse.
When going for a user space driver design, make sure you keep a clean separation between driver and application. [It will be one major goal of an RTDM for user space to support driver writers in this regard.]
Jan