Skip to contentSkip to conversation

drm: Wake up all waiters for the vblank

PATCH In review Chris Wilson 2 participants 3 messages Aug 17, 2017

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

PATCH 1/1 drm: Wake up all waiters for the vblank

As we have a single list for vblank waiters (not sorted by the vblank they are waiting for), make sure we wake up all waiters rather than just the first as we may have multiple consumers for this vblank event.

Cc Maarten Lankhorst <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +2 -2
index 70f2b9593edc..930e3ed5234b 100644
@@ -1118,7 +1118,7 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset)
 		drm_vblank_disable_and_save(dev, pipe);
 
-	wake_up(&vblank->queue);
+	wake_up_all(&vblank->queue);
 
 	/*
 	 * Prevent subsequent drm_vblank_get() from re-enabling
@@ -1572,7 +1572,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 
 	spin_unlock(&dev->vblank_time_lock);
 
-	wake_up(&vblank->queue);
+	wake_up_all(&vblank->queue);
 
 	/* With instant-off, we defer disabling the interrupt until after
 	 * we finish processing the following vblank after all events have
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Chris Wilson

As we have a single list for vblank waiters (not sorted by the vblank they are waiting for), make sure we wake up all waiters rather than just the first as we may have multiple consumers for this vblank event.

Cc Maarten Lankhorst <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +0 -0
index 70f2b9593edc..930e3ed5234b 100644

drivers/gpu/drm/drm_vblank.c void drm_crtc_vblank_off(struct drm_crtc *crtc) · line 1121

Quoted 5 lines
drivers/gpu/drm/drm_vblank.c +1 -1
@@ -1118,7 +1118,7 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)
 	if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset)
 		drm_vblank_disable_and_save(dev, pipe);
 
-	wake_up(&vblank->queue);
+	wake_up_all(&vblank->queue);

I don't think we have any exclusive waiters currently so this shouldn't actually change anything. I guess given the unordered nature of vblank waiters exclusive waiters wouldn't really work anyway.

I guess it might be a reasonable measure to avoid bugs if someone accidentally adds eclusive waiters so

Quoted 14 lines
drivers/gpu/drm/drm_vblank.c +1 -1
 	/*
 	 * Prevent subsequent drm_vblank_get() from re-enabling
@@ -1572,7 +1572,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 
 	spin_unlock(&dev->vblank_time_lock);
 
-	wake_up(&vblank->queue);
+	wake_up_all(&vblank->queue);
 
 	/* With instant-off, we defer disabling the interrupt until after
 	 * we finish processing the following vblank after all events have
Signature · 1 line
2.14.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Quoting Ville Syrjälä (2017-08-17 15:56:19)

Quoted 21 lines · Chris Wilson
Quoted 20 lines

As we have a single list for vblank waiters (not sorted by the vblank they are waiting for), make sure we wake up all waiters rather than just the first as we may have multiple consumers for this vblank event.

Cc Maarten Lankhorst <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_vblank.c +0 -0
index 70f2b9593edc..930e3ed5234b 100644
@@ -1118,7 +1118,7 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)
      if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset)
              drm_vblank_disable_and_save(dev, pipe);
 
Quoted 6 lines

drivers/gpu/drm/drm_vblank.c void drm_crtc_vblank_off(struct drm_crtc *crtc) · line 1121

Quoted 2 lines
drivers/gpu/drm/drm_vblank.c +1 -1
-     wake_up(&vblank->queue);
+     wake_up_all(&vblank->queue);

I don't think we have any exclusive waiters currently so this shouldn't actually change anything. I guess given the unordered nature of vblank waiters exclusive waiters wouldn't really work anyway.

Gah, I had it in my head as they were two separate modes of working - one for the waiter as to whether it should be treated exclusively (for an exclusive wakeup), and the other for the waker to control how many it should wake up. My fingers were crossed that we had some small bugs given the multiple drmWaitVblank clients (plus more users in the kernel) springing up that would miraculously be resolved. I hope we don't find ourselves in a position where we do need to kill a thundering herd of vblank waiters.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel