How the PCI Hot Plug Driver Filesystem Works

Greg describes how the PCI Hot Plug core implements a RAM-based filesystem and how you can do the same for your drivers.
Acknowledgements

I would like to thank Pat Mochel for writing the ddfs/driverfs code upon which a lot of the pcihpfs code was originally based. driverfs is a new filesystem in the 2.5 kernel that will also help driver authors in exporting driver-specific information into user space, as well as provide a tree of all devices, making power management tools much easier.

I would also like to thank Al Viro for answering a lot of VFS-related questions and for enabling a filesystem to be written with such a small amount of code.

Resources

Greg Kroah-Hartman is currently the Linux USB and PCI Hot Plug kernel maintainer. He works for IBM, doing various Linux kernel-related things and can be reached at greg@kroah.com.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: How the PCI Hot Plug Driver Filesystem Works

Anonymous's picture

How do users mount the pcihpfs mount? Where is it located?

Re: How the PCI Hot Plug Driver Filesystem Works

gregkh's picture

To answer the second question first, it can be mounted where ever you want to.

To mount the filesystem do the following:

mount -t pcihpfs none /place/to/mount/pci_hotplug_filesystem

Re: How the PCI Hot Plug Driver Filesystem Works

tho_x_tran's picture

First, I've just switched from Unix to Linux and willing to be educated. So please bear with my comments. Many systems that support Hot Plug PCI probably will have Doorbells and Latches. A hot plug operation on such a system should mostly be automatic, all user has to do is to insert the new card.

For such a system, I guess there should be some kind of a PCI hot-plug daemon running to intercept the "event" and does many things under the nose of the user.

Re: How the PCI Hot Plug Driver Filesystem Works

gregkh's picture

Yes, the individual PCI Hotplug drivers have a thread that watches to see if a latch has been opened or closed. If it changes state, it then goes through the power up (or down) sequence automatically, without user interaction.

Hope this helps.

Re: How the PCI Hot Plug Driver Filesystem Works

Anonymous's picture

Why goe to all the effort to write a new virtual filesystem. procfs was created a long time ago and can do everything you have created.

Is this not reinventing the wheel and making the kernel larger?

Re: How the PCI Hot Plug Driver Filesystem Works

gregkh's picture

procfs is a mess and it is not recommended to put new files into it.

As for making the kernel larger, in the 2.5 kernel, the libfs code that is already present, caused almost all of the filesystem specific code in pci_hotplug_core.c to go away, with only the PCI hotplug specific portions remaining. So there would not be any size savings by using procfs.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix