From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 6 09:26:26 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 820B96EF for ; Thu, 6 Dec 2012 09:26:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 553F08FC15 for ; Thu, 6 Dec 2012 09:26:26 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id CE23246B2D; Thu, 6 Dec 2012 04:26:25 -0500 (EST) Date: Thu, 6 Dec 2012 09:26:25 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Vijay Singh Subject: Re: KVERIFY for non-debug invariants? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2012 09:26:26 -0000 On Wed, 5 Dec 2012, Vijay Singh wrote: > All. KASSERT() is a really need way of expressing invariants when INVARIANTS > is defined. However for regular, non-INVARIANTS code folks have the typical > if() panic() combos, or private macros. Would a KVERIFY() that does this in > non-INVARIANTS code make sense? I'd certainly be fine with something like this. It might be worth posting to arch@ with a code example, as hackers@ has a subset of the potentially interested audience. INVARIANTS has got a bit heavier-weight over the years -- the main thing I run into in higher-performance scenarios is its additional UMA debugging, which causes a global lock to be acquired during sanity checks. It might be worth our pondering adding a new configure option for particularly slow invariant tests -- e.g., INVARIANTS_SLOW ... or maybe just INVARIANTS_UMA. However, that's a different issue. (I sort of feel that things labeled "assert" should be something we can turn on in production... so maybe INVARIANTS/KASSERT mission-creep is the issue.) Robert