diff mbox

drm: Show leaked connectors upon unload

Message ID 20170119090513.4154-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Jan. 19, 2017, 9:05 a.m. UTC
After warning that the connector list is not empty on device
unregistration (i.e. module unload) also print out which connectors are
still hanging around to aide finding the leak.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_mode_config.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Joonas Lahtinen Jan. 19, 2017, 1:36 p.m. UTC | #1
On to, 2017-01-19 at 09:05 +0000, Chris Wilson wrote:
> After warning that the connector list is not empty on device
> unregistration (i.e. module unload) also print out which connectors are
> still hanging around to aide finding the leak.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
Maarten Lankhorst Jan. 19, 2017, 2:17 p.m. UTC | #2
Op 19-01-17 om 10:05 schreef Chris Wilson:
> After warning that the connector list is not empty on device
> unregistration (i.e. module unload) also print out which connectors are
> still hanging around to aide finding the leak.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/drm_mode_config.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index ed1ee5a44a7b..884cc4d26fb5 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -421,7 +421,12 @@ void drm_mode_config_cleanup(struct drm_device *dev)
>  		drm_connector_unreference(connector);
>  	}
>  	drm_connector_list_iter_put(&conn_iter);
> -	WARN_ON(!list_empty(&dev->mode_config.connector_list));
> +	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
> +		drm_connector_list_iter_get(dev, &conn_iter);
> +		drm_for_each_connector_iter(connector, &conn_iter)
> +			DRM_ERROR("connector %s leaked!\n", connector->name);
> +		drm_connector_list_iter_put(&conn_iter);
> +	}
>  
>  	list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
>  				 head) {

Bikeshed perhaps, but maybe change to [CONNECTOR:%d:%s] connector leaked on cleanup?

~Maarten
Chris Wilson Jan. 23, 2017, 10:06 a.m. UTC | #3
On Thu, Jan 19, 2017 at 03:17:36PM +0100, Maarten Lankhorst wrote:
> Op 19-01-17 om 10:05 schreef Chris Wilson:
> > After warning that the connector list is not empty on device
> > unregistration (i.e. module unload) also print out which connectors are
> > still hanging around to aide finding the leak.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/drm_mode_config.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > index ed1ee5a44a7b..884cc4d26fb5 100644
> > --- a/drivers/gpu/drm/drm_mode_config.c
> > +++ b/drivers/gpu/drm/drm_mode_config.c
> > @@ -421,7 +421,12 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> >  		drm_connector_unreference(connector);
> >  	}
> >  	drm_connector_list_iter_put(&conn_iter);
> > -	WARN_ON(!list_empty(&dev->mode_config.connector_list));
> > +	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
> > +		drm_connector_list_iter_get(dev, &conn_iter);
> > +		drm_for_each_connector_iter(connector, &conn_iter)
> > +			DRM_ERROR("connector %s leaked!\n", connector->name);
> > +		drm_connector_list_iter_put(&conn_iter);
> > +	}
> >  
> >  	list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
> >  				 head) {
> 
> Bikeshed perhaps, but maybe change to [CONNECTOR:%d:%s] connector leaked on cleanup?

This patch isn't in my tree, so if a drm-misc maintainer would pick it
and make the minor change, please do so :)
-Chris
Daniel Vetter Jan. 23, 2017, 10:12 a.m. UTC | #4
On Mon, Jan 23, 2017 at 10:06:07AM +0000, Chris Wilson wrote:
> On Thu, Jan 19, 2017 at 03:17:36PM +0100, Maarten Lankhorst wrote:
> > Op 19-01-17 om 10:05 schreef Chris Wilson:
> > > After warning that the connector list is not empty on device
> > > unregistration (i.e. module unload) also print out which connectors are
> > > still hanging around to aide finding the leak.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/drm_mode_config.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > > index ed1ee5a44a7b..884cc4d26fb5 100644
> > > --- a/drivers/gpu/drm/drm_mode_config.c
> > > +++ b/drivers/gpu/drm/drm_mode_config.c
> > > @@ -421,7 +421,12 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> > >  		drm_connector_unreference(connector);
> > >  	}
> > >  	drm_connector_list_iter_put(&conn_iter);
> > > -	WARN_ON(!list_empty(&dev->mode_config.connector_list));
> > > +	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
> > > +		drm_connector_list_iter_get(dev, &conn_iter);
> > > +		drm_for_each_connector_iter(connector, &conn_iter)
> > > +			DRM_ERROR("connector %s leaked!\n", connector->name);
> > > +		drm_connector_list_iter_put(&conn_iter);
> > > +	}
> > >  
> > >  	list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
> > >  				 head) {
> > 
> > Bikeshed perhaps, but maybe change to [CONNECTOR:%d:%s] connector leaked on cleanup?
> 
> This patch isn't in my tree, so if a drm-misc maintainer would pick it
> and make the minor change, please do so :)

Hm, drm-misc maintainer picked it, but failed to do the minor bikeshed :(
-Daniel
Chris Wilson Jan. 23, 2017, 10:28 a.m. UTC | #5
On Mon, Jan 23, 2017 at 11:12:31AM +0100, Daniel Vetter wrote:
> On Mon, Jan 23, 2017 at 10:06:07AM +0000, Chris Wilson wrote:
> > On Thu, Jan 19, 2017 at 03:17:36PM +0100, Maarten Lankhorst wrote:
> > > Op 19-01-17 om 10:05 schreef Chris Wilson:
> > > > After warning that the connector list is not empty on device
> > > > unregistration (i.e. module unload) also print out which connectors are
> > > > still hanging around to aide finding the leak.
> > > >
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > ---
> > > >  drivers/gpu/drm/drm_mode_config.c | 7 ++++++-
> > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > > > index ed1ee5a44a7b..884cc4d26fb5 100644
> > > > --- a/drivers/gpu/drm/drm_mode_config.c
> > > > +++ b/drivers/gpu/drm/drm_mode_config.c
> > > > @@ -421,7 +421,12 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> > > >  		drm_connector_unreference(connector);
> > > >  	}
> > > >  	drm_connector_list_iter_put(&conn_iter);
> > > > -	WARN_ON(!list_empty(&dev->mode_config.connector_list));
> > > > +	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
> > > > +		drm_connector_list_iter_get(dev, &conn_iter);
> > > > +		drm_for_each_connector_iter(connector, &conn_iter)
> > > > +			DRM_ERROR("connector %s leaked!\n", connector->name);
> > > > +		drm_connector_list_iter_put(&conn_iter);
> > > > +	}
> > > >  
> > > >  	list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
> > > >  				 head) {
> > > 
> > > Bikeshed perhaps, but maybe change to [CONNECTOR:%d:%s] connector leaked on cleanup?
> > 
> > This patch isn't in my tree, so if a drm-misc maintainer would pick it
> > and make the minor change, please do so :)
> 
> Hm, drm-misc maintainer picked it, but failed to do the minor bikeshed :(

Ah, I was worried I had actually squashed it into a random patch and was
starting to go mad.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index ed1ee5a44a7b..884cc4d26fb5 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -421,7 +421,12 @@  void drm_mode_config_cleanup(struct drm_device *dev)
 		drm_connector_unreference(connector);
 	}
 	drm_connector_list_iter_put(&conn_iter);
-	WARN_ON(!list_empty(&dev->mode_config.connector_list));
+	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
+		drm_connector_list_iter_get(dev, &conn_iter);
+		drm_for_each_connector_iter(connector, &conn_iter)
+			DRM_ERROR("connector %s leaked!\n", connector->name);
+		drm_connector_list_iter_put(&conn_iter);
+	}
 
 	list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
 				 head) {