2002-09-26 02:39:16

by David Brownell

[permalink] [raw]
Subject: Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb


> I also found the unload USB module problem. The driver core was calling
> hotplug after the device was already removed. Made it a bit difficult
> to be able to describe the device that way :)

On the other hand, since there's no internal "this is an ex-device"
state, that's also insurance that nothing could use "usbfs" to try
to re-activate the device. I seem to recall oopses going away by
reporting the hotplug "remove" events after the usbfs path could
no longer be used. Not that I ever liked that consequence, but
a fix adding such a "zombie" state would have taken a bit of time.

The real "module unload problem" has a lot to do with not having any
way to track how many devices a module is bound to ... that aren't
necessarily opened at the moment. (Does Rusty's patch set touch
any of that?)

Without having a way to answer that question, today's un-helpful
"driver is in active use" refcount would encourage rmmodding drivers
that users will expect to still be available. Plug in two devices,
look at one, decide to use the other, unplug the first ... and just
because you hadn't yet opened the second device, its driver module
vanishes. As you start to use it ... huge frustration quotient! :)

- Dave





2002-09-26 04:23:28

by Greg KH

[permalink] [raw]
Subject: Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb

On Wed, Sep 25, 2002 at 07:44:47PM -0700, David Brownell wrote:
>
> >I also found the unload USB module problem. The driver core was calling
> >hotplug after the device was already removed. Made it a bit difficult
> >to be able to describe the device that way :)
>
> On the other hand, since there's no internal "this is an ex-device"
> state, that's also insurance that nothing could use "usbfs" to try
> to re-activate the device. I seem to recall oopses going away by
> reporting the hotplug "remove" events after the usbfs path could
> no longer be used. Not that I ever liked that consequence, but
> a fix adding such a "zombie" state would have taken a bit of time.

Yes, Pat and I have talked a lot about the need for a driver "state". I
think the current goal was to see how far we can get without needing it.
I was certainly cursing the lack of it today when trying to debug this
problem, but in the end, having it would have only masked over the
real problem that was there.

So personally, I keep going back and forth on if it is really necessary
or not to have. Right now, the USB drivers and developers are very used
to the fact that when the device disappears from the system, they can
not access it anymore, and that this needs to be constantly checked. I
think that as time goes on, and more subsystems become "hot-pluggable"
either this paranoia will have to spread to the other subsystems, or we
will have to create the notion of a device "state" to make things
easier on everyone.

> The real "module unload problem" has a lot to do with not having any
> way to track how many devices a module is bound to ... that aren't
> necessarily opened at the moment. (Does Rusty's patch set touch
> any of that?)

As far as I know, it doesn't, but I'm not sure.

> Without having a way to answer that question, today's un-helpful
> "driver is in active use" refcount would encourage rmmodding drivers
> that users will expect to still be available. Plug in two devices,
> look at one, decide to use the other, unplug the first ... and just
> because you hadn't yet opened the second device, its driver module
> vanishes. As you start to use it ... huge frustration quotient! :)

Well, that's a driver unload issue, which I think everyone agrees on the
fact that it's not ok to do automatic driver unload when a device is
removed, because of this very problem.

thanks,

greg k-h