From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 17 00:20:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3C76F71 for ; Fri, 17 Jan 2014 00:20:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6301117C5 for ; Fri, 17 Jan 2014 00:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0H0K0OC081291 for ; Fri, 17 Jan 2014 00:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0H0K0WU081290; Fri, 17 Jan 2014 00:20:00 GMT (envelope-from gnats) Resent-Date: Fri, 17 Jan 2014 00:20:00 GMT Resent-Message-Id: <201401170020.s0H0K0WU081290@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alfred Perlstein Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1A8FF44 for ; Fri, 17 Jan 2014 00:17:20 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC5CB17A9 for ; Fri, 17 Jan 2014 00:17:20 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0H0HKj7038818 for ; Fri, 17 Jan 2014 00:17:20 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0H0HKOe038804; Fri, 17 Jan 2014 00:17:20 GMT (envelope-from nobody) Message-Id: <201401170017.s0H0HKOe038804@oldred.freebsd.org> Date: Fri, 17 Jan 2014 00:17:20 GMT From: Alfred Perlstein To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/185831: bumping maxcpu causes witness to panic at boot X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 00:20:00 -0000 >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: