Re: PCI hotplug question.

Greg KH
2003-03-05T06:14:21Z

On Tue, Mar 04, 2003 at 05:10:16PM -0600, Cameron, Steve wrote:
>
> So, the question is this. For HBA drivers, block storage drivers in
> particular, are there plans to make hot-unplugging behave similarly to
> rmmod (checking that nobody has the device open before kicking
> the driver out and so on) or, is it the driver's duty to defend
> against incoming i/o's to devices which may be yanked out from
> underneath it whenever somebody presses the pushbutton?

I can't find my copy of the PCI Hotplug spec right now (and it's not
free for download anymore...), but I think that once a user presses the
latch button, the OS _has_ to power down that slot within a reasonable
amount of time. So there's no way that a driver could return an error
to the remove() callback and have a chance to still be around in a
moment or so. And some systems (ACPI controlled PCI Hotplug), we don't
have a choice, as the BIOS is about to do the powerdown anyway, and we
can't stop it.

So no, we can't rely on the same module count type mechanism that rmmod
can use, so the driver has to do everything it possibly can to shutdown
that device, and clean up after itself when remove() is called.

I'll try to find my copy of the spec to verify this, but it might take a
while to dig it up. Anyone else with access to it right now?

thanks,

greg k-h