Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 May 2025 22:33:58 -0400
From:      Dennis Clarke <dclarke@blastwave.org>
To:        current@freebsd.org
Subject:   Just a question about sys/kern/subr_witness.c where witness_watch may be flipped to -1
Message-ID:  <044f6767-01d2-40a5-a8fd-b5568658c9c0@blastwave.org>

index | next in thread | raw e-mail


Just an odd message to see on the console :

     # witness_lock_list_get: witness exhausted

Looking at https://cgit.freebsd.org/src/tree/sys/kern/subr_witness.c it
seems that the comment at line 370 is very clear :

/*
  * If set to 0, lock order checking is disabled.  If set to -1,
  * witness is completely disabled.  Otherwise witness performs full
  * lock order checking for all locks.  At runtime, lock order checking
  * may be toggled.  However, witness cannot be reenabled once it is
  * completely disabled.
  */
static int witness_watch = 1;

So I wonder how I managed to get that message "witness exhausted" ?

At line 2203 I see :

static struct lock_list_entry *
witness_lock_list_get(void)
{
	struct lock_list_entry *lle;

	if (witness_watch == -1)
		return (NULL);
	mtx_lock_spin(&w_mtx);
	lle = w_lock_list_free;
	if (lle == NULL) {
		witness_watch = -1;
		mtx_unlock_spin(&w_mtx);
		printf("%s: witness exhausted\n", __func__);
		return (NULL);
	}
	w_lock_list_free = lle->ll_next;
	mtx_unlock_spin(&w_mtx);
	bzero(lle, sizeof(*lle));
	return (lle);
}

Where it seems that indeed witness_watch has been flipped to -1 and that 
functionality is now gone?



-- 
--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken

ps: the comment at line 43 is just plain silly.



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?044f6767-01d2-40a5-a8fd-b5568658c9c0>