All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
@ 2019-05-21  5:28 Sam Bobroff
  2019-05-21  8:10 ` Gerd Hoffmann
  2019-05-21  8:10 ` Gerd Hoffmann
  0 siblings, 2 replies; 8+ messages in thread
From: Sam Bobroff @ 2019-05-21  5:28 UTC (permalink / raw)
  To: kraxel, airlied, daniel, virtualization, dri-devel, linux-kernel

When unloading the bochs-drm driver, a warning message is printed by
drm_mode_config_cleanup() because a reference is still held to one of
the drm_connector structs.

Correct this by calling drm_atomic_helper_shutdown() in
bochs_pci_remove().

The issue is caused by the interaction of two previous commits. Both
together are required to cause it:
Fixes: 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
Fixes: 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
---
Hello,

This seems to be similar to an issue I recently fixed for the AST driver:
1e613f3c630c ("drm/ast: Fix connector leak during driver unload")
Which is similar to at least one other recent fix:
192b4af6cd28 ("drm/tegra: Shutdown on driver unbind")

The fix seems to be the same, but this time I've tried to dig a little deeper
and use an appropriate Fixes tag to assist backporting.

Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
... but the issue also seems to be due to a change in the generic drm code
(reverting it separately fixes the issue):
846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
... so I've included both in the commit.  Is that the right thing to do?

I couldn't help wondering if we should also update the comment for
drm_fbdev_generic_setup(), because it says:
"The fbdev is destroyed by drm_dev_unregister()"
... which implies to me that cleanup only requires that call, but actually
since 846c7dfc1193 you will always(?) need to use drm_atomic_helper_shutdown()
as well. (Is it actually always the case?)

Cheers,
Sam.

 drivers/gpu/drm/bochs/bochs_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index 6b6e037258c3..7031f0168795 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_atomic_helper.h>
 
 #include "bochs.h"
 
@@ -174,6 +175,7 @@ static void bochs_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
+	drm_atomic_helper_shutdown(dev);
 	drm_dev_unregister(dev);
 	bochs_unload(dev);
 	drm_dev_put(dev);
-- 
2.19.0.2.gcad72f5712


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
  2019-05-21  5:28 [PATCH 1/1] drm/bochs: Fix connector leak during driver unload Sam Bobroff
  2019-05-21  8:10 ` Gerd Hoffmann
@ 2019-05-21  8:10 ` Gerd Hoffmann
  2019-06-17  1:20     ` Sam Bobroff
  1 sibling, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2019-05-21  8:10 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: airlied, daniel, virtualization, dri-devel, linux-kernel

  Hi,

The bug is in the driver, so ...

> Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> ... but the issue also seems to be due to a change in the generic drm code

... this one is the culprit and should be listed.

> (reverting it separately fixes the issue):
> 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> ... so I've included both in the commit.  Is that the right thing to do?

That only triggers the driver bug.

I'll fix it up on commit,
  Gerd


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
  2019-05-21  5:28 [PATCH 1/1] drm/bochs: Fix connector leak during driver unload Sam Bobroff
@ 2019-05-21  8:10 ` Gerd Hoffmann
  2019-05-21  8:10 ` Gerd Hoffmann
  1 sibling, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2019-05-21  8:10 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: airlied, linux-kernel, dri-devel, daniel, virtualization

  Hi,

The bug is in the driver, so ...

> Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> ... but the issue also seems to be due to a change in the generic drm code

... this one is the culprit and should be listed.

> (reverting it separately fixes the issue):
> 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> ... so I've included both in the commit.  Is that the right thing to do?

That only triggers the driver bug.

I'll fix it up on commit,
  Gerd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [EXTERNAL] Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
  2019-05-21  8:10 ` Gerd Hoffmann
@ 2019-06-17  1:20     ` Sam Bobroff
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Bobroff @ 2019-06-17  1:20 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: airlied, linux-kernel, dri-devel, daniel, virtualization

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

On Tue, May 21, 2019 at 10:10:29AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> The bug is in the driver, so ...
> 
> > Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> > 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> > ... but the issue also seems to be due to a change in the generic drm code
> 
> ... this one is the culprit and should be listed.
> 
> > (reverting it separately fixes the issue):
> > 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> > ... so I've included both in the commit.  Is that the right thing to do?
> 
> That only triggers the driver bug.
> 
> I'll fix it up on commit,
>   Gerd

Sorry if I misunderstood, but were you going to take the patch and fix
it up or would you like me to post a v2?

Cheers,
Sam.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [EXTERNAL] Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
@ 2019-06-17  1:20     ` Sam Bobroff
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Bobroff @ 2019-06-17  1:20 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: airlied, daniel, linux-kernel, dri-devel, virtualization


[-- Attachment #1.1: Type: text/plain, Size: 863 bytes --]

On Tue, May 21, 2019 at 10:10:29AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> The bug is in the driver, so ...
> 
> > Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> > 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> > ... but the issue also seems to be due to a change in the generic drm code
> 
> ... this one is the culprit and should be listed.
> 
> > (reverting it separately fixes the issue):
> > 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> > ... so I've included both in the commit.  Is that the right thing to do?
> 
> That only triggers the driver bug.
> 
> I'll fix it up on commit,
>   Gerd

Sorry if I misunderstood, but were you going to take the patch and fix
it up or would you like me to post a v2?

Cheers,
Sam.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [EXTERNAL] Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
  2019-06-17  1:20     ` Sam Bobroff
@ 2019-06-17  5:45       ` Gerd Hoffmann
  -1 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2019-06-17  5:45 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: airlied, linux-kernel, dri-devel, daniel, virtualization

On Mon, Jun 17, 2019 at 11:20:34AM +1000, Sam Bobroff wrote:
> On Tue, May 21, 2019 at 10:10:29AM +0200, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > The bug is in the driver, so ...
> > 
> > > Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> > > 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> > > ... but the issue also seems to be due to a change in the generic drm code
> > 
> > ... this one is the culprit and should be listed.
> > 
> > > (reverting it separately fixes the issue):
> > > 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> > > ... so I've included both in the commit.  Is that the right thing to do?
> > 
> > That only triggers the driver bug.
> > 
> > I'll fix it up on commit,
> >   Gerd
> 
> Sorry if I misunderstood, but were you going to take the patch and fix
> it up or would you like me to post a v2?

Patch is in drm-misc-next, I fixed it on commit.

cheers,
  Gerd


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [EXTERNAL] Re: [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
@ 2019-06-17  5:45       ` Gerd Hoffmann
  0 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2019-06-17  5:45 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: airlied, daniel, linux-kernel, dri-devel, virtualization

On Mon, Jun 17, 2019 at 11:20:34AM +1000, Sam Bobroff wrote:
> On Tue, May 21, 2019 at 10:10:29AM +0200, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > The bug is in the driver, so ...
> > 
> > > Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
> > > 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
> > > ... but the issue also seems to be due to a change in the generic drm code
> > 
> > ... this one is the culprit and should be listed.
> > 
> > > (reverting it separately fixes the issue):
> > > 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
> > > ... so I've included both in the commit.  Is that the right thing to do?
> > 
> > That only triggers the driver bug.
> > 
> > I'll fix it up on commit,
> >   Gerd
> 
> Sorry if I misunderstood, but were you going to take the patch and fix
> it up or would you like me to post a v2?

Patch is in drm-misc-next, I fixed it on commit.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/1] drm/bochs: Fix connector leak during driver unload
@ 2019-05-21  5:28 Sam Bobroff
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Bobroff @ 2019-05-21  5:28 UTC (permalink / raw)
  To: kraxel, airlied, daniel, virtualization, dri-devel, linux-kernel

When unloading the bochs-drm driver, a warning message is printed by
drm_mode_config_cleanup() because a reference is still held to one of
the drm_connector structs.

Correct this by calling drm_atomic_helper_shutdown() in
bochs_pci_remove().

The issue is caused by the interaction of two previous commits. Both
together are required to cause it:
Fixes: 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
Fixes: 6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
---
Hello,

This seems to be similar to an issue I recently fixed for the AST driver:
1e613f3c630c ("drm/ast: Fix connector leak during driver unload")
Which is similar to at least one other recent fix:
192b4af6cd28 ("drm/tegra: Shutdown on driver unbind")

The fix seems to be the same, but this time I've tried to dig a little deeper
and use an appropriate Fixes tag to assist backporting.

Bisecting the issue for commits to drivers/gpu/drm/bochs/ points to:
6579c39594ae ("drm/bochs: atomic: switch planes to atomic, wire up helpers.")
... but the issue also seems to be due to a change in the generic drm code
(reverting it separately fixes the issue):
846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.")
... so I've included both in the commit.  Is that the right thing to do?

I couldn't help wondering if we should also update the comment for
drm_fbdev_generic_setup(), because it says:
"The fbdev is destroyed by drm_dev_unregister()"
... which implies to me that cleanup only requires that call, but actually
since 846c7dfc1193 you will always(?) need to use drm_atomic_helper_shutdown()
as well. (Is it actually always the case?)

Cheers,
Sam.

 drivers/gpu/drm/bochs/bochs_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index 6b6e037258c3..7031f0168795 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_atomic_helper.h>
 
 #include "bochs.h"
 
@@ -174,6 +175,7 @@ static void bochs_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
+	drm_atomic_helper_shutdown(dev);
 	drm_dev_unregister(dev);
 	bochs_unload(dev);
 	drm_dev_put(dev);
-- 
2.19.0.2.gcad72f5712

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-17  5:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  5:28 [PATCH 1/1] drm/bochs: Fix connector leak during driver unload Sam Bobroff
2019-05-21  8:10 ` Gerd Hoffmann
2019-05-21  8:10 ` Gerd Hoffmann
2019-06-17  1:20   ` [EXTERNAL] " Sam Bobroff
2019-06-17  1:20     ` Sam Bobroff
2019-06-17  5:45     ` Gerd Hoffmann
2019-06-17  5:45       ` Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2019-05-21  5:28 Sam Bobroff

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.