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/linux drm: In ww_mutex_unlock, do lock...



details:   https://anonhg.NetBSD.org/src/rev/1ded78827627
branches:  trunk
changeset: 363952:1ded78827627
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Mar 18 23:33:41 2022 +0000

description:
drm: In ww_mutex_unlock, do lockdebug check first.

This way we get a full lockdebug dump when LOCKDEBUG is enabled,
instead of just the panic message (which includes the lock address
you could pass to `show lock' in ddb, but let's get the dump by
default even if you don't enter ddb).

Also in the KASSERT print the mutex.

diffstat:

 sys/external/bsd/drm2/linux/linux_ww_mutex.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r fd87d33f980d -r 1ded78827627 sys/external/bsd/drm2/linux/linux_ww_mutex.c
--- a/sys/external/bsd/drm2/linux/linux_ww_mutex.c      Fri Mar 18 23:32:59 2022 +0000
+++ b/sys/external/bsd/drm2/linux/linux_ww_mutex.c      Fri Mar 18 23:33:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ww_mutex.c,v 1.13 2021/12/26 16:14:34 riastradh Exp $    */
+/*     $NetBSD: linux_ww_mutex.c,v 1.14 2022/03/18 23:33:41 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.13 2021/12/26 16:14:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.14 2022/03/18 23:33:41 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -1041,7 +1041,8 @@
        struct ww_acquire_ctx *ctx;
 
        mutex_enter(&mutex->wwm_lock);
-       KASSERT(mutex->wwm_state != WW_UNLOCKED);
+       WW_UNLOCKED(mutex);
+       KASSERTMSG(mutex->wwm_state != WW_UNLOCKED, "mutex %p", mutex);
        switch (mutex->wwm_state) {
        case WW_UNLOCKED:
                panic("unlocking unlocked wait/wound mutex: %p", mutex);
@@ -1070,7 +1071,6 @@
                mutex->wwm_state = WW_UNLOCKED;
                break;
        }
-       WW_UNLOCKED(mutex);
        cv_broadcast(&mutex->wwm_cv);
        mutex_exit(&mutex->wwm_lock);
 }



Home | Main Index | Thread Index | Old Index