Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Apr 2025 18:30:44 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d9ce37179a2f - stable/14 - mtx: Include the mutex pointer in the panic message for destroyed locks
Message-ID:  <202504291830.53TIUiKd022768@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=d9ce37179a2f738feacf5eb9af0d394fc5882543

commit d9ce37179a2f738feacf5eb9af0d394fc5882543
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-03-12 14:26:50 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-04-29 14:43:48 +0000

    mtx: Include the mutex pointer in the panic message for destroyed locks
    
    Reviewed by:    olce, kib, markj
    Sponsored by:   AFRL, DARPA
    Differential Revision:  https://reviews.freebsd.org/D49315
    
    (cherry picked from commit 43a15a22c62345091fc4a2ea2bec529acda7c61f)
---
 sys/kern/kern_mutex.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 9bb059f13d64..3a8afdcad338 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -269,7 +269,7 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line)
 	    ("mtx_lock() by idle thread %p on mutex %p @ %s:%d",
 	    curthread, m, file, line));
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_lock() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_lock() of destroyed mutex %p @ %s:%d", m, file, line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_spin,
 	    ("mtx_lock() of spin mutex %s @ %s:%d", m->lock_object.lo_name,
 	    file, line));
@@ -298,7 +298,7 @@ __mtx_unlock_flags(volatile uintptr_t *c, int opts, const char *file, int line)
 	m = mtxlock2mtx(c);
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_unlock() of destroyed mutex %p @ %s:%d", m, file, line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_spin,
 	    ("mtx_unlock() of spin mutex %s @ %s:%d", m->lock_object.lo_name,
 	    file, line));
@@ -327,7 +327,7 @@ __mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
 	m = mtxlock2mtx(c);
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_lock_spin() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_lock_spin() of destroyed mutex %p @ %s:%d", m, file, line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_sleep,
 	    ("mtx_lock_spin() of sleep mutex %s @ %s:%d",
 	    m->lock_object.lo_name, file, line));
@@ -368,7 +368,8 @@ __mtx_trylock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
 	m = mtxlock2mtx(c);
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_trylock_spin() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_trylock_spin() of destroyed mutex %p @ %s:%d", m, file,
+	    line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_sleep,
 	    ("mtx_trylock_spin() of sleep mutex %s @ %s:%d",
 	    m->lock_object.lo_name, file, line));
@@ -393,7 +394,8 @@ __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
 	m = mtxlock2mtx(c);
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_unlock_spin() of destroyed mutex %p @ %s:%d", m, file,
+	    line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_sleep,
 	    ("mtx_unlock_spin() of sleep mutex %s @ %s:%d",
 	    m->lock_object.lo_name, file, line));
@@ -431,7 +433,7 @@ _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF)
 	    ("mtx_trylock() by idle thread %p on mutex %p @ %s:%d",
 	    curthread, m, file, line));
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("mtx_trylock() of destroyed mutex @ %s:%d", file, line));
+	    ("mtx_trylock() of destroyed mutex %p @ %s:%d", m, file, line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_spin,
 	    ("mtx_trylock() of spin mutex %s @ %s:%d", m->lock_object.lo_name,
 	    file, line));
@@ -805,7 +807,7 @@ thread_lock_validate(struct mtx *m, int opts, const char *file, int line)
 {
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,
-	    ("thread_lock() of destroyed mutex @ %s:%d", file, line));
+	    ("thread_lock() of destroyed mutex %p @ %s:%d", m, file, line));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_sleep,
 	    ("thread_lock() of sleep mutex %s @ %s:%d",
 	    m->lock_object.lo_name, file, line));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504291830.53TIUiKd022768>