Module Name: src Committed By: riastradh Date: Sun Dec 19 11:52:16 UTC 2021
Modified Files: src/sys/external/bsd/drm2/dist/drm: drm_vblank.c Log Message: drm: Fix lock order reversal in merge botch. Add a note reminding myself what the lock order is. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/drm_vblank.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/dist/drm/drm_vblank.c diff -u src/sys/external/bsd/drm2/dist/drm/drm_vblank.c:1.8 src/sys/external/bsd/drm2/dist/drm/drm_vblank.c:1.9 --- src/sys/external/bsd/drm2/dist/drm/drm_vblank.c:1.8 Sun Dec 19 11:48:42 2021 +++ src/sys/external/bsd/drm2/dist/drm/drm_vblank.c Sun Dec 19 11:52:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_vblank.c,v 1.8 2021/12/19 11:48:42 riastradh Exp $ */ +/* $NetBSD: drm_vblank.c,v 1.9 2021/12/19 11:52:16 riastradh Exp $ */ /* * drm_irq.c IRQ and vblank support @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: drm_vblank.c,v 1.8 2021/12/19 11:48:42 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: drm_vblank.c,v 1.9 2021/12/19 11:52:16 riastradh Exp $"); #include <linux/export.h> #include <linux/moduleparam.h> @@ -75,6 +75,8 @@ __KERNEL_RCSID(0, "$NetBSD: drm_vblank.c * &drm_driver.max_vblank_count. In that case the vblank core only disables the * vblanks after a timer has expired, which can be configured through the * ``vblankoffdelay`` module parameter. + * + * Lock order: event_lock -> vbl_lock -> vblank_time_lock */ /* Retry timestamp calculation up to 3 times to satisfy @@ -1875,14 +1877,14 @@ bool drm_handle_vblank(struct drm_device 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 * or corrupted timestamps and vblank counts. */ spin_lock(&dev->vblank_time_lock); - spin_lock(&dev->vbl_lock); - /* Vblank irq handling disabled. Nothing to do. */ if (!vblank->enabled) { spin_unlock(&dev->vbl_lock);