Stable userspace driver API for Linux

I’ve just read some interesting news of what will be coming with Linux kernel 2.6.23. In short, as you can read in Gmane:

This interface allows the ability to write the majority of a driver in userspace with only a very small shell of a driver in the kernel itself. It uses a char device and sysfs to interact with a userspace process to process interrupts and control memory accesses.

You can have the full details of what I read at liquidat’s site.

I think this is awesome, and it was about time. It turns out this was announced a year ago by Greg Kroah-Hartman, who obviously knows his stuff since he’s been developing kernel drivers like forever.

As I was saying, these are wonderful news. It would be great if every hardware vendor developed open source drivers, but this hasn’t been going on, and being pragmatic it’s a lot better having a closed-source driver that not having a driver at all. I think this API will be a good thing for several reasons:

  • Firstly, Linux kernel internals aren’t really that stable as they frequently suffer interface changes -for better or worse-. There aren’t many companies that develop drivers for Linux, and far too many of those spend close to nothing in maintenance. By providing a stable API there’s a chance that closed-source drivers won’t become obsolete so fast, and these could even be marginally more portable.
  • A second reason would be the advantage of being able to use this as a testbed platform while developing the drivers. Tinkering in kernel space is a tricky question. Developing the same code in userspace with an API to link over eliminates many of the possible ways of trashing the system. By allowing most of the code to be run in userspace, poorly designed code is less likely to screw everything up. Which also brings us to the closed-source drivers’ subject. As long as these remain closed-source there’s no telling how bad the code can be. There’s no peer reviewing, no community bug fixes and so on. So hey, what the Hell! If it has to be run, at least let us be somehow protected.

To anyone interested in developing kernel modules there’s an excellent book by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman that is licensed under Creative Commons: Linux Device Drivers, Third Edition. I’m currently going through it and it’s making wonders to what little knowledge I had on the subject.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>