Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm Fix scope of locks in drm_han...



details:   https://anonhg.NetBSD.org/src/rev/d849967e05f0
branches:  trunk
changeset: 366299:d849967e05f0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:43:15 2018 +0000

description:
Fix scope of locks in drm_handle_vblank.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_irq.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r a785ac9d628d -r d849967e05f0 sys/external/bsd/drm2/dist/drm/drm_irq.c
--- a/sys/external/bsd/drm2/dist/drm/drm_irq.c  Mon Aug 27 14:43:00 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_irq.c  Mon Aug 27 14:43:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_irq.c,v 1.13 2018/08/27 14:42:43 riastradh Exp $   */
+/*     $NetBSD: drm_irq.c,v 1.14 2018/08/27 14:43:15 riastradh Exp $   */
 
 /*
  * drm_irq.c IRQ and vblank support
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_irq.c,v 1.13 2018/08/27 14:42:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_irq.c,v 1.14 2018/08/27 14:43:15 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include "drm_trace.h"
@@ -2092,6 +2092,7 @@
                return false;
 
        spin_lock_irqsave(&dev->event_lock, irqflags);
+       spin_lock(&dev->vbl_lock);
 
        /* Need timestamp lock to prevent concurrent execution with
         * vblank enable/disable, as this would cause inconsistent
@@ -2102,6 +2103,7 @@
        /* Vblank irq handling disabled. Nothing to do. */
        if (!vblank->enabled) {
                spin_unlock(&dev->vblank_time_lock);
+               spin_unlock(&dev->vbl_lock);
                spin_unlock_irqrestore(&dev->event_lock, irqflags);
                return false;
        }
@@ -2111,9 +2113,7 @@
        spin_unlock(&dev->vblank_time_lock);
 
 #ifdef __NetBSD__
-       spin_lock(&dev->vbl_lock);
        DRM_SPIN_WAKEUP_ONE(&vblank->queue, &dev->vbl_lock);
-       spin_unlock(&dev->vbl_lock);
 #else
        wake_up(&vblank->queue);
 #endif
@@ -2127,8 +2127,9 @@
        if (dev->vblank_disable_immediate &&
            drm_vblank_offdelay > 0 &&
            !atomic_read(&vblank->refcount))
-               vblank_disable_fn((unsigned long)vblank);
+               vblank_disable_locked(vblank, dev, pipe);
 
+       spin_unlock(&dev->vbl_lock);
        spin_unlock_irqrestore(&dev->event_lock, irqflags);
 
        return true;



Home | Main Index | Thread Index | Old Index