Hi, I'm looking into what happens if fbdev has open file handles when drm_dev_unplug() is called. udl is the only user of drm_dev_unplug(), but AFAICT it will keel over if unplugged with a /dev/fb handle open since fbdev is torn down during drm_driver->unload. My first attempt was to rely on the drm_device ref counting and tear down fbdev in drm_driver->release. This requires that a ref is taken on drm_device in &fb_ops.fb_open and dropped in &fb_ops.fb_release. The problem is that .fb_release is called under console_lock(), which means that unregister_framebuffer() will deadlock (assuming last ref on drm_device here). Trying to do trickery with console_lock to get this through is bound to be painful, so a straightforward solution is to fork of fbdev teardown to a worker. Since we are already in drm_driver->release, this won't work. My next idea is to refcount struct drm_fb_helper, take one ref on drm_device and handle the lifetime of fbdev that way. Now it's possible to do teardown in a worker and when that's done, drop the ref on drm_device. The plan was to make this ref counting optional for drivers. Is ref counting drm_fb_helper a good/bad idea, or is there another solution to this? Noralf. _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel