drm: Fixup hang when unregistering drm dev with open_count 0
Subsystems (2)
PATCH 1/1 drm: Fixup hang when unregistering drm dev with open_count 0
My previous patch (c5d8fac2bf drm: Unplug drm device when unregistering it) calls drm_unplug_dev when unregistering drm dev. But if open_count is 0, the unplug will try to unregister the drm dev again and cause deadlock.
Fix it by dropping drm_unplug_dev and use drm_device_set_plug_state directly.
---
drivers/gpu/drm/drm_drv.c | 15 +-------------- include/drm/drm_drv.h | 1 - 2 files changed, 1 insertion(+), 15 deletions(-)
drivers/gpu/drm/drm_drv.c +1 -14
@@ -355,19 +355,6 @@ void drm_put_dev(struct drm_device *dev) }EXPORT_SYMBOL (drm_put_dev); -void drm_unplug_dev (struct drm_device *dev) -{ -mutex_lock (&drm_global_mutex); - -drm_device_set_plug_state (dev, false); - -if (dev->open_count ==0 ) { -drm_put_dev (dev); - } -mutex_unlock (&drm_global_mutex); -} -EXPORT_SYMBOL (drm_unplug_dev); -/* * DRM internal mount * We want to be able to allocate our own "struct address_space" to control
@@ -825,7 +812,7 @@ void drm_dev_unregister(struct drm_device *dev)drm_lastclose (dev); dev->registered = false; -drm_unplug_dev (dev); +drm_device_set_plug_state (dev, false);if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_modeset_unregister_all (dev);
include/drm/drm_drv.h +0 -1
@@ -544,7 +544,6 @@ void drm_dev_unregister(struct drm_device *dev);void drm_dev_ref (struct drm_device *dev);void drm_dev_unref (struct drm_device *dev);void drm_put_dev (struct drm_device *dev); -void drm_unplug_dev (struct drm_device *dev);int drm_dev_set_unique (struct drm_device *dev,const char *name);
Signature · 1 line
2.1.4
Quoted 7 lines · Jeffy Chen
My previous patch (
c5d8fac2bfdrm: Unplug drm device when unregistering it) callsdrm_unplug_devwhen unregistering drm dev. But ifopen_countis 0, the unplug will try to unregister the drm dev again and cause deadlock.Fix it by dropping
drm_unplug_devand usedrm_device_set_plug_statedirectly.
Hi Jeffy,
That patch was not applied anywhere, the test robot just picked it up from the mailing list.
Please squash this into the original patch and re-send.
Thanks,
Sean
Quoted 57 lines
Signed-off-by Jeffy Chen <[email protected]>---
drivers/gpu/drm/drm_drv.c | 15 +-------------- include/drm/drm_drv.h | 1 - 2 files changed, 1 insertion(+), 15 deletions(-)drivers/gpu/drm/drm_drv.c +1
-14@@ -355,19 +355,6 @@ void drm_put_dev(struct drm_device *dev) }EXPORT_SYMBOL (drm_put_dev); -void drm_unplug_dev (struct drm_device *dev) -{ -mutex_lock (&drm_global_mutex); - -drm_device_set_plug_state (dev, false); - -if (dev->open_count ==0 ) { -drm_put_dev (dev); - } -mutex_unlock (&drm_global_mutex); -} -EXPORT_SYMBOL (drm_unplug_dev); -/* * DRM internal mount * We want to be able to allocate our own "struct address_space" to control @@ -825,7 +812,7 @@ void drm_dev_unregister(struct drm_device *dev)drm_lastclose (dev); dev->registered = false; -drm_unplug_dev (dev); +drm_device_set_plug_state (dev, false);if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_modeset_unregister_all (dev);include/drm/drm_drv.h +0
-1@@ -544,7 +544,6 @@ void drm_dev_unregister(struct drm_device *dev);void drm_dev_ref (struct drm_device *dev);void drm_dev_unref (struct drm_device *dev);void drm_put_dev (struct drm_device *dev); -void drm_unplug_dev (struct drm_device *dev);int drm_dev_set_unique (struct drm_device *dev,const char *name);Signature · 1 line
2.1.4
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS