From owner-freebsd-dtrace@FreeBSD.ORG Mon Jul 29 14:25:50 2013 Return-Path: Delivered-To: dtrace@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 29707A96; Mon, 29 Jul 2013 14:25:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CD6D329B8; Mon, 29 Jul 2013 14:25:48 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA06580; Mon, 29 Jul 2013 17:25:40 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1V3oOJ-00072l-ND; Mon, 29 Jul 2013 17:25:39 +0300 Message-ID: <51F67B2A.3040302@FreeBSD.org> Date: Mon, 29 Jul 2013 17:24:42 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130708 Thunderbird/17.0.7 MIME-Version: 1.0 To: freebsd-arch@FreeBSD.org Subject: translate INVARIANTS to DEBUG for code from OpenSolaris X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=X-VIET-VPS Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 29 Jul 2013 17:39:27 +0000 X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2013 14:25:50 -0000 [zfs-devel@, fs@, dtrace@ are Bcc-ed] In OpenSolaris and its descendants DEBUG is used in a fashion similar to our INVARIANTS. For example, ASSERT macros are enabled by it. In our kernel code DEBUG has a different meaning and enables far too verbose or far too obscure code and, as such, it is very rarely enabled. The idea of a change that I would like to propose is to translate INVARIANTS kernel option into DEBUG for the files that originated from OpenSolaris (and hopefully only for them). The change: opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG do this by forcing inclusion of sys/cddl/compat/opensolaris/sys/debug_compat.h via -include option into all source files from OpenSolaris. Note that this -include option must always be after -include opt_global.h. Additionally, remove forced definition of DEBUG for some modules and fix their build without DEBUG. Also, meaning of DEBUG was overloaded to enable WITNESS support for some OpenSolaris (primarily ZFS) locks. Now this overloading is removed and that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS. http://people.freebsd.org/~avg/osol-invariants-debug.diff I would like to ask for your feedback on the soundness of the whole idea. Also on the name, location and style of inclusion for sys/cddl/compat/opensolaris/sys/debug_compat.h. And on any other details of the proposed change. Testing is also welcome, of course. Thank you very much. -- Andriy Gapon