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.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState