Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 20:39:34 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329666 - head/sys/kern
Message-ID:  <201802202039.w1KKdYXx058003@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Tue Feb 20 20:39:34 2018
New Revision: 329666
URL: https://svnweb.freebsd.org/changeset/base/329666

Log:
  mtx: add debug assertions to mtx_spin_wait_unlocked

Modified:
  head/sys/kern/kern_mutex.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Tue Feb 20 20:37:01 2018	(r329665)
+++ head/sys/kern/kern_mutex.c	Tue Feb 20 20:39:34 2018	(r329666)
@@ -1231,6 +1231,14 @@ mtx_spin_wait_unlocked(struct mtx *m)
 {
 	struct lock_delay_arg lda;
 
+	KASSERT(m->mtx_lock != MTX_DESTROYED,
+	    ("%s() of destroyed mutex %p", __func__, m));
+	KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin,
+	    ("%s() of sleep mutex %p (%s)", __func__, m,
+	    m->lock_object.lo_name));
+	KASSERT(!mtx_owned(m), ("%s() waiting on myself on lock %p (%s)", __func__, m,
+	    m->lock_object.lo_name));
+
 	lda.spin_cnt = 0;
 
 	while (atomic_load_acq_ptr(&m->mtx_lock) != MTX_UNOWNED) {



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