LWN: Porting Device Drivers to the 2.6 Kernel

LWN: Porting Device Drivers to the 2.6 Kernel

LWN: Porting device drivers to the 2.6 kernel Home Weekly edition Kernel Security Distributions Archives Search Penguin Gallery Calendar LWN.net FAQ Subscriptions Advertise Write for LWN Contact us Privacy Porting device drivers to the 2.6 kernel The 2.6 kernel contains a long list of changes which affect device driver writers. As part of the task of porting the Linux Device Drivers sample code to 2.6, your humble LWN Kernel Page author is producing a set of articles describing the changes which must be made. The articles are Kernel Page as they are written; they will also be collected here. With luck, this page will be a useful reference for those who must port drivers to the new kernel. The creation of these articles is funded by LWN.net subscribers. If you find this material useful, please consider subscribing to LWN to help ensure that more of it gets written. Except when otherwise specified, all of the articles below are written by LWN editor Jonathan Corbet. The date and kernel version attached to each article notes when the article was last updated. Recent changes The most recent changes to this series are: • (November 25, 2003) The entire set of articles has been updated to reflect the 2.6.0−test10 kernel. • (Oct. 29, 2003) Examining a kobject hierarchy added. • (Oct. 23, 2003) kobject and sysfs added. • (Oct. 7, 2003) kobjects and hotplug events added. • (Oct. 1, 2003) The zen of kobjects added. • Getting started Porting 'hello world' (February, 2003); which covers the changes required to update the simplest possible module to the 2.5 kernel. Compiling external modules (November, 2003; 2.6.0−test9); how to build modules with the new module loader and kernel build scheme. More module changes (November, 2003, 2.6.0−test9) covers other changes to the module loading subsystem, including module parameters, use count management, exporting symbols, and more. Miscellaneous changes is a collection point for changes which are too small to justify their own article. Currently covered topics include kdev_t, designated initializers, and min() and max(). It was last updated on November 3, 2003 (2.6.0−test9). Porting device drivers to the 2.6 kernel 1 LWN: Porting device drivers to the 2.6 kernel Support interfaces Char drivers and large dev_t (November 2003, 2.6.0−test9); registration and management of char drivers in the new, large dev_t environment. The seq_file interface (September 2003; 2.6.0−test6); the easy way to implement virtual files correctly. A standalone example module is provided to demonstrate the use of this interface. Low−level memory allocation (November, 2003; 2.6.0−test9); changes to functions for allocating chunks of memory and pages, and a description of the new mempool interface. Per−CPU variables (November, 2003; 2.6.0−test9); the 2.6 interface for maintaining per−CPU data structures. Timekeeping changes (November, 2003; 2.6.0−test9); changes to how the kernel manages time and time−related events. The workqueue interface (November, 2003; 2.6.0−test9); a description of the new deferred execution mechanism which replaces task queues (and bottom halves in general). Creating virtual filesystems with libfs (November, 2003; 2.6.0−test9). This article, which looks at how a kernel module can create its own virtual filesystem, predates the driver porting series but fits in well with it. DMA Changes (November, 2003, 2.6.0−test9); changes to the DMA support layer. There is also a quick reference page for the new generic DMA API. Sleeping and mutual exclusion Mutual exclusion with seqlocks (November, 2003, 2.6.0−test9); a description of how to use the seqlock (formerly frlock) capability which was merged into 2.5.60. The preemptible kernel (November, 2003; 2.6.0−test9); a look at how kernel preemption affects driver code and what can be done to work safely in the preemptible environment. Sleeping and waking up (November, 2003; 2.6.0−test9); new ways of putting processes to sleep with better performance and without race conditions. Completion events (November, 2003; 2.6.0−test9); documentation for the completion event mechanism. Using read−copy−update (November, 2003; 2.6.0−test9); working with the read−copy−update mutual exclusion scheme. Advanced driver tasks Dealing with interrupts (November, 2003; 2.6.0−test9); interrupt handling changes which are visible to device drivers. Supporting asynchronous I/O (November, 2003; 2.6.0−test9); how to write drivers which support the 2.6 asynchronous I/O interface. Support interfaces 2 LWN: Porting device drivers to the 2.6 kernel Network drivers (November 2003, 2.6.0−test9); porting network drivers, with an emphasis on the new dynamic net_device allocation functions and NAPI support. USB driver API changes (July 2003; 2.5.75); how USB drivers have changed in the 2.5 development series. This article was contributed by USB maintainer Greg Kroah−Hartman. Block drivers Block layer overview (November, 2003; 2.6.0−test9). The block layer has seen extensive changes in the 2.5 development series; this article gives an overview of what has been done while deferring the details for subsequent articles. A simple block driver (November, 2003; 2.6.0−test9); this article presents the simplest possible block driver (a basic ramdisk implementation) with discussion of how the basic block interfaces have changed in 2.6. Full source to a working driver is included. The gendisk interface (November, 2003; 2.6.0−test9); how to work with the new generic disk interface, which takes on a rather larger role in 2.6. The BIO structure (November, 2003; 2.6.0−test9); the new low−level structure representing block I/O operations. Request queues I (November, 2003; 2.6.0−test9); the basics of block request queues in 2.6, including request processing, request preparation control, and DMA support. Request queues II (November, 2003, 2.6.0−test9); advanced request queue topics, including command preparation, tagged command queueing, and the "make request" mode of operation. Memory management Supporting mmap() (November, 2003 − 2.6.0−test9); changes in how device drivers support the mmap() system call. Zero−copy user−space access (November, 2003 − 2.6.0−test9); how to get direct−access to user space to perform zero−copy I/O. If you used the kiobuf interface for this purpose in 2.4, you'll want to look here for the 2.6 equivalent. Atomic kmaps (November, 2003; 2.6.0−test9); quick access to high−memory via kmap_atomic(). Device model A device model overview (November, 2003; 2.6.0−test10); an introductory look at the Linux device model and sysfs, with definitions of some commonly encountered terms. The zen of kobjects (October, 2003; 2.6.0−test6); an attempt to demystify the kobject abstraction and its use in the kernel. kobjects and sysfs (October, 2003; 2.6.0−test8); a description of the interaction between the kobject type and its representation in sysfs. Block drivers 3 LWN: Porting device drivers to the 2.6 kernel kobjects and hotplug events (October, 2003; 2.6.0−test6); an explanation of the kset hotplug operations and how they can be used to control how hotplug events are reported to user space. This article was written by Greg Kroah−Hartman. Examining a kobject hierarchy (October, 2003; 2.6.0−test9); a visual exploration of the device model data structures behind /sys/block. Device classes (November, 2003; 2.6.0−test10); how the device class mechanism works. Post a comment Porting device drivers to the 2.5 kernel (Posted Feb 12, 2003 1:55 UTC (Wed) by fdesloges) (Post reply) Wow! This is highly valuable stuff. Are you certain you want to give this away for free after only a few days ? This alone would be a very good reason to subscribe. And as reference stuff it will still be valuable many months down the road. Maybe it could fit in a "available to non−subsciber 4 months later" category ? Or make only a few articles available (and the index of course to hook subscribers) ? Whatever you do, thanks! FD Porting device drivers to the 2.5 kernel (Posted Feb 12, 2003 9:58 UTC (Wed) by KotH) (Post reply) I wouldnt do that. LWN has a very good reputation as information source around the open source community. A "closed for all but subscribed ppl" policy would surely destroy that reputation. Yes, i know that LWN doesnt have as much subscribers as it should have :( but this is IMHO not the right way to get more. Porting device drivers to the 2.5 kernel (Posted Feb 12, 2003 11:00 UTC (Wed) by bruno) (Post reply) Do you work for nothing? Do you give all your time to other in exchange of nothing? You can't pretend that other people do that, the people have childrens, wives, mortgages... and work in exchange of money to pay their bills. Sometimes you have a bussiness plan that lets you to give away your work and get money from other sources, sometimes you need to put a price or close the shop. Block drivers 4 LWN: Porting device drivers to the 2.6 kernel Porting device drivers to the 2.5 kernel (Posted Feb 12, 2003 14:14 UTC (Wed) by Webexcess) (Post reply) Do you work for nothing? Do you give all your time to other in exchange of nothing? I think you're oversimplifying a bit. The excellent writing at lwn.net is both its product and its advertising. How will potential subscribers be enticed if they can't see what lwn.net has to offer? Also, the target audience largely consists of enthusiasts, many of whom are students and/or live in parts of the world where american dollars are very expensive.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    142 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us