Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2014 00:17:20 GMT
From:      Alfred Perlstein <alfred@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/185831: bumping maxcpu causes witness to panic at boot
Message-ID:  <201401170017.s0H0HKOe038804@oldred.freebsd.org>
Resent-Message-ID: <201401170020.s0H0K0WU081290@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         185831
>Category:       misc
>Synopsis:       bumping maxcpu causes witness to panic at boot
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 17 00:20:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Alfred Perlstein
>Release:        11
>Organization:
Norse Corporation
>Environment:
>Description:
If we bump maxcpu on our machine we get a panic at boot about running out of witness pending objects.



The following patch fixes it:
(https://github.com/alfredperlstein/freebsd/compare/witness_scaling)

diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 9315133..e1c8d1b 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -132,10 +132,19 @@
 /* Define this to check for blessed mutexes */
 #undef BLESSING
 
-#define	WITNESS_COUNT 		1024
-#define	WITNESS_CHILDCOUNT 	(WITNESS_COUNT * 4)
+/*
+ * Each cpu requires early locks so scale WITNESS_COUNT & WITNESS_PENDLIST
+ * based on MAXCPU
+ */
+#ifndef	WITNESS_COUNT
+#define	WITNESS_COUNT		(MAXCPU <= 64 ? 1024 : MAXCPU * 16)
+#endif
+
 #define	WITNESS_HASH_SIZE	251	/* Prime, gives load factor < 2 */
-#define	WITNESS_PENDLIST	1024
+
+#ifndef	WITNESS_PENDLIST
+#define	WITNESS_PENDLIST	(MAXCPU <= 64 ? 1024 : MAXCPU * 16)
+#endif
 
 /* Allocate 256 KB of stack data space */
 #define	WITNESS_LO_DATA_COUNT	2048
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



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