misc/185831: bumping maxcpu causes witness to panic at boot

Alfred Perlstein alfred at FreeBSD.org
Fri Jan 17 00:20:00 UTC 2014


>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:


More information about the freebsd-bugs mailing list