git: 0ed104978ce5 - main - mtx: Make idle thread assertions more robust

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 12 Mar 2025 14:47:38 UTC
The branch main has been updated by jhb:

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

commit 0ed104978ce55ecacf42bde4458acda0cc773940
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-03-12 14:25:13 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-03-12 14:39:26 +0000

    mtx: Make idle thread assertions more robust
    
    Just print the pointer to the mutex instead of the name in case the
    mutex is corrupted.
    
    Reviewed by:    olce, kib
    Sponsored by:   AFRL, DARPA
    Differential Revision:  https://reviews.freebsd.org/D49314
---
 sys/kern/kern_mutex.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 3ada9246326f..0a873cf139c4 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -284,8 +284,8 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line)
 
 	KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() ||
 	    !TD_IS_IDLETHREAD(curthread),
-	    ("mtx_lock() by idle thread %p on sleep mutex %s @ %s:%d",
-	    curthread, m->lock_object.lo_name, file, 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));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_spin,
@@ -446,8 +446,8 @@ _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF)
 		return (1);
 
 	KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(td),
-	    ("mtx_trylock() by idle thread %p on sleep mutex %s @ %s:%d",
-	    curthread, m->lock_object.lo_name, file, line));
+	    ("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));
 	KASSERT(LOCK_CLASS(&m->lock_object) != &lock_class_mtx_spin,