Skip to contentSkip to conversation

drm: drm_vblank_cleanup: WARN when refcount is more than 0

RFC In review PrasannaKumar Muralidharan 4 participants 6 messages Oct 12, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 drm: drm_vblank_cleanup: WARN when refcount is more than 0

Warn when refcount > 0 in drm_vblank_cleanup.

In i915 driver unload drm_vblank_get is added to test whether this patch is working. This will be removed once the patch gets tested.

---
 drivers/gpu/drm/drm_vblank.c    | 2 ++
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 2 files changed, 3 insertions(+)
drivers/gpu/drm/drm_vblank.c +2 -0
index 70f2b95..2a6630a 100644
@@ -402,6 +402,8 @@ void drm_vblank_cleanup(struct drm_device *dev)
 	if (dev->num_crtcs == 0)
 		return;
 
+	WARN_ON(atomic_read(&vblank->refcount) > 0);
+
 	for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
 		struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 9f45cfe..c7a93a9 100644
@@ -1373,6 +1373,7 @@ void i915_driver_unload(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct pci_dev *pdev = dev_priv->drm.pdev;
 
+	drm_vblank_get(dev_priv, 0);
 	i915_driver_unregister(dev_priv);
 
 	if (i915_gem_suspend(dev_priv))
Signature · 6 lines
2.10.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting PrasannaKumar Muralidharan (2017-10-12 18:00:06)

Quoted 4 lines

Warn when refcount > 0 in drm_vblank_cleanup.

In i915 driver unload drm_vblank_get is added to test whether this patch is working. This will be removed once the patch gets tested.

You want to send it as two patches. The first to add the debug infrastructure, then the second to trigger it. We obviously don't want to commit a patch that itself warns about the bug it introduces! ;) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Hi Chris,

Quoted 10 lines · Chris Wilson

Quoting PrasannaKumar Muralidharan (2017-10-12 18:00:06)

Quoted 4 lines

Warn when refcount > 0 in drm_vblank_cleanup.

In i915 driver unload drm_vblank_get is added to test whether this patch is working. This will be removed once the patch gets tested.

You want to send it as two patches. The first to add the debug infrastructure, then the second to trigger it. We obviously don't want to commit a patch that itself warns about the bug it introduces! ;) -Chris

True. That's why I marked it as RFC. I hope this will trigger Intel graphics driver CI so I can wait for the outcome and send a single patch based on the result. Will that work?

Thanks,
PrasannaKumar
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ Fi.CI.BAT: failure for drm: drm_vblank_cleanup: WARN when refcount is more than 0

In reply to PrasannaKumar Muralidharan
== Series Details ==

== Series Details ==

Series: drm: drm_vblank_cleanup: WARN when refcount is more than 0
URL : https://patchwork.freedesktop.org/series/31838/
State : failure

== Summary ==

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC      drivers/gpu/drm/drm_vblank.o
In file included from ./arch/x86/include/asm/bug.h:81:0,
                 from ./include/linux/bug.h:4,
                 from ./include/linux/thread_info.h:11,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from ./include/linux/preempt.h:80,
                 from ./include/linux/spinlock.h:50,
                 from ./include/linux/seqlock.h:35,
                 from ./include/drm/drm_vblank.h:27,
                 from drivers/gpu/drm/drm_vblank.c:27:
drivers/gpu/drm/drm_vblank.c: In function ‘drm_vblank_cleanup’:
drivers/gpu/drm/drm_vblank.c:405:23: error: ‘vblank’ undeclared (first use in this function)
  WARN_ON(atomic_read(&vblank->refcount) > 0);
                       ^
./include/asm-generic/bug.h:107:25: note: in definition of macro ‘WARN_ON’
  int __ret_warn_on = !!(condition);    \
                         ^~~~~~~~~
drivers/gpu/drm/drm_vblank.c:405:23: note: each undeclared identifier is reported only once for each function it appears in
  WARN_ON(atomic_read(&vblank->refcount) > 0);
                       ^
./include/asm-generic/bug.h:107:25: note: in definition of macro ‘WARN_ON’
  int __ret_warn_on = !!(condition);    \
                         ^~~~~~~~~

scripts/Makefile.build:313: recipe for target 'drivers/gpu/drm/drm_vblank.o' failed make[3]: *** [drivers/gpu/drm/drm_vblank.o] Error 1 scripts/Makefile.build:572: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:572: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1019: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to PrasannaKumar Muralidharan
Quoted 16 lines · PrasannaKumar Muralidharan

Warn when refcount > 0 in drm_vblank_cleanup.

In i915 driver unload drm_vblank_get is added to test whether this patch is working. This will be removed once the patch gets tested.

---
 drivers/gpu/drm/drm_vblank.c    | 2 ++
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 2 files changed, 3 insertions(+)
drivers/gpu/drm/drm_vblank.c +0 -0
index 70f2b95..2a6630a 100644

drivers/gpu/drm/drm_vblank.c void drm_vblank_cleanup(struct drm_device *dev) · line 406

Quoted 5 lines
drivers/gpu/drm/drm_vblank.c +2 -0
@@ -402,6 +402,8 @@ void drm_vblank_cleanup(struct drm_device *dev)
 	if (dev->num_crtcs == 0)
 		return;
 
+	WARN_ON(atomic_read(&vblank->refcount) > 0);
+

That won't even compile. Always at least compile + sparse check + checkpatch your stuff, otherwise you're just going to be wasting other people's or the CI systems's time.

Quoted 22 lines
drivers/gpu/drm/drm_vblank.c +0 -0
 	for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
 		struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 9f45cfe..c7a93a9 100644
@@ -1373,6 +1373,7 @@ void i915_driver_unload(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct pci_dev *pdev = dev_priv->drm.pdev;
 
+	drm_vblank_get(dev_priv, 0);
 	i915_driver_unregister(dev_priv);
 
 	if (i915_gem_suspend(dev_priv))
Signature · 6 lines
2.10.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Hi Ville,

Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · PrasannaKumar Muralidharan

Warn when refcount > 0 in drm_vblank_cleanup.

In i915 driver unload drm_vblank_get is added to test whether this patch is working. This will be removed once the patch gets tested.

---
 drivers/gpu/drm/drm_vblank.c    | 2 ++
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 2 files changed, 3 insertions(+)
drivers/gpu/drm/drm_vblank.c +0 -0
index 70f2b95..2a6630a 100644
@@ -402,6 +402,8 @@ void drm_vblank_cleanup(struct drm_device *dev)
      if (dev->num_crtcs == 0)
              return;
 
Quoted 6 lines

drivers/gpu/drm/drm_vblank.c void drm_vblank_cleanup(struct drm_device *dev) · line 406

Quoted 2 lines
drivers/gpu/drm/drm_vblank.c +2 -0
+     WARN_ON(atomic_read(&vblank->refcount) > 0);
+

That won't even compile. Always at least compile + sparse check + checkpatch your stuff, otherwise you're just going to be wasting other people's or the CI systems's time.

CI just told me this. I will keep this in mind even for simple patches.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_vblank.c +0 -0
      for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
              struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 9f45cfe..c7a93a9 100644
@@ -1373,6 +1373,7 @@ void i915_driver_unload(struct drm_device *dev)
      struct drm_i915_private *dev_priv = to_i915(dev);
      struct pci_dev *pdev = dev_priv->drm.pdev;
 
+     drm_vblank_get(dev_priv, 0);
      i915_driver_unregister(dev_priv);
 
      if (i915_gem_suspend(dev_priv))
--

2.10.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx