Docks, Bays, and Ports : Not just for oceans any more

A Presentation by Kristen Carlson Accardi

For many years, the only devices the Linux user could reliably hot plug were
USB and PCI. 2006 was the year that users of Linux on a laptop finally realized
the dream of being able to hit the eject button on their dock station and have
it actually do something other than crash or hang. As if that wasn't
exciting enough, later in 2006, thanks to the addition of hot plug support to
the SATA layer, removable drive bay support became a reality as well. This
paper will discuss in a generic way how we insert and remove devices into a
system, the subsystem interactions required, and the user space notification
process. We will discuss the new dock station driver as a specific example of
a set of removable devices, and also show how the bay driver was ported from
the dock driver to at last allow users to dynamically swap out the drive bay on
their laptop.

All removable devices have generically the same behavior - detect that the
device state has changed, and then create or destroy the device structures that
represent the device to the OS. They all must alert their respective
subsystems that a new device exists, and handle user notification as
applicable. Some subsystems easily accommodate hot plug (such as PCI), while
others are not quite ready for removable devices (such as PATA). Some
removable devices are required to work with multiple subsystems (such as the
dock station driver). For the devices that we will cover, we will show how the
drivers interact with the different subsystems. In some cases we will show
specific workarounds that we have had to do in the driver to accommodate lack
of hot plug support in the subsystem. We will also delve into some of the
lower level system support that is required in order to physically remove a
device without damaging the system. We will discuss how ACPI is used to assist
this process, and show how different system manufactures can implement the same
feature in many different ways. Finally, we will describe the common software
tasks that are required to insert and remove these devices at the kernel level
as well as give an overview of each device driver's unique implementation

Not only is kernel support required for removable devices to be inserted or
removed from a running system without catastrophic results, but support in user
space is also essential. User space notification of removable devices isn't
standardized, and there are a variety of strategies that are employed by kernel
drivers to communicate to user space. We will discuss how each separate device
communicates events to user space and demonstrate how user space applications
can obtain knowledge of the insertion and removal, and how they might take
advantage of this knowledge.

Direct link to video