Date: Tue, 6 Aug 2013 15:51:56 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253996 - in head: . sys/cddl/compat/opensolaris/sys sys/cddl/dev/dtrace sys/conf sys/modules/cyclic sys/modules/dtrace/dtio sys/modules/dtrace/dtmalloc sys/modules/dtrace/dtnfscl sys/m... Message-ID: <201308061551.r76FpuY7056153@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Tue Aug 6 15:51:56 2013 New Revision: 253996 URL: http://svnweb.freebsd.org/changeset/base/253996 Log: 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. MFC after: 17 days Added: head/sys/cddl/compat/opensolaris/sys/debug_compat.h (contents, props changed) Modified: head/UPDATING head/sys/cddl/compat/opensolaris/sys/mutex.h head/sys/cddl/compat/opensolaris/sys/rwlock.h head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/dtrace_unload.c head/sys/conf/kern.pre.mk head/sys/conf/options head/sys/modules/cyclic/Makefile head/sys/modules/dtrace/dtio/Makefile head/sys/modules/dtrace/dtmalloc/Makefile head/sys/modules/dtrace/dtnfscl/Makefile head/sys/modules/dtrace/dtnfsclient/Makefile head/sys/modules/dtrace/dtrace/Makefile head/sys/modules/dtrace/dtrace_test/Makefile head/sys/modules/dtrace/dtraceall/Makefile head/sys/modules/dtrace/fasttrap/Makefile head/sys/modules/dtrace/fbt/Makefile head/sys/modules/dtrace/lockstat/Makefile head/sys/modules/dtrace/profile/Makefile head/sys/modules/dtrace/prototype/Makefile head/sys/modules/dtrace/sdt/Makefile head/sys/modules/dtrace/systrace/Makefile head/sys/modules/dtrace/systrace_freebsd32/Makefile head/sys/modules/dtrace/systrace_linux32/Makefile head/sys/modules/opensolaris/Makefile head/sys/modules/zfs/Makefile Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Aug 6 15:49:18 2013 (r253995) +++ head/UPDATING Tue Aug 6 15:51:56 2013 (r253996) @@ -32,6 +32,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20130806: + INVARIANTS option now enables DEBUG for code with OpenSolaris and + Illumos origin, including ZFS. If you have INVARIANTS in your + kernel configuration, then there is no need to set DEBUG or ZFS_DEBUG + explicitly. + DEBUG used to enable witness(9) tracking of OpenSolaris (mostly ZFS) + locks if WITNESS option was set. Because that generated a lot of + witness(9) reports and all of them were believed to be false + positives, this is no longer done. New option OPENSOLARIS_WITNESS + can be used to achieve the previous behavior. + +20130806: Timer values in IPv6 data structures now use time_uptime instead of time_second. Although this is not a user-visible functional change, userland utilities which directly use them---ndp(8), Added: head/sys/cddl/compat/opensolaris/sys/debug_compat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/sys/debug_compat.h Tue Aug 6 15:51:56 2013 (r253996) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2013 Andriy Gapon <avg@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This is a special file that SHOULD NOT be included using #include directive. + */ + +#if defined(INVARIANTS) +#ifndef DEBUG +#define DEBUG +#endif +#endif Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/mutex.h Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/cddl/compat/opensolaris/sys/mutex.h Tue Aug 6 15:51:56 2013 (r253996) @@ -46,7 +46,7 @@ typedef enum { typedef struct sx kmutex_t; -#ifndef DEBUG +#ifndef OPENSOLARIS_WITNESS #define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS) #else #define MUTEX_FLAGS (SX_DUPOK) Modified: head/sys/cddl/compat/opensolaris/sys/rwlock.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/rwlock.h Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/cddl/compat/opensolaris/sys/rwlock.h Tue Aug 6 15:51:56 2013 (r253996) @@ -47,7 +47,7 @@ typedef enum { typedef struct sx krwlock_t; -#ifndef DEBUG +#ifndef OPENSOLARIS_WITNESS #define RW_FLAGS (SX_DUPOK | SX_NOWITNESS) #else #define RW_FLAGS (SX_DUPOK) Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Tue Aug 6 15:51:56 2013 (r253996) @@ -67,7 +67,9 @@ dtrace_load(void *dummy) mutex_init(&dtrace_lock,"dtrace probe state", MUTEX_DEFAULT, NULL); mutex_init(&dtrace_provider_lock,"dtrace provider state", MUTEX_DEFAULT, NULL); mutex_init(&dtrace_meta_lock,"dtrace meta-provider state", MUTEX_DEFAULT, NULL); +#ifdef DEBUG mutex_init(&dtrace_errlock,"dtrace error lock", MUTEX_DEFAULT, NULL); +#endif mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock); Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_unload.c Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/cddl/dev/dtrace/dtrace_unload.c Tue Aug 6 15:51:56 2013 (r253996) @@ -121,7 +121,9 @@ dtrace_unload() mutex_destroy(&dtrace_meta_lock); mutex_destroy(&dtrace_provider_lock); mutex_destroy(&dtrace_lock); +#ifdef DEBUG mutex_destroy(&dtrace_errlock); +#endif /* Reset our hook for exceptions. */ dtrace_invop_uninit(); Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/conf/kern.pre.mk Tue Aug 6 15:51:56 2013 (r253996) @@ -139,6 +139,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mi # Special flags for managing the compat compiles for ZFS ZFS_CFLAGS= -DFREEBSD_NAMECACHE -DBUILDING_ZFS -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs -I$S/cddl/contrib/opensolaris/uts/common/zmod -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common/zfs -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas +ZFS_CFLAGS+= -include $S/cddl/compat/opensolaris/sys/debug_compat.h ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} ZFS_C= ${CC} -c ${ZFS_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} ZFS_S= ${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC} Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/conf/options Tue Aug 6 15:51:56 2013 (r253996) @@ -681,6 +681,7 @@ WITNESS opt_global.h WITNESS_KDB opt_witness.h WITNESS_NO_VNODE opt_witness.h WITNESS_SKIPSPIN opt_witness.h +OPENSOLARIS_WITNESS opt_global.h # options for ACPI support ACPI_DEBUG opt_acpi.h Modified: head/sys/modules/cyclic/Makefile ============================================================================== --- head/sys/modules/cyclic/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/cyclic/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,9 +11,10 @@ CFLAGS+= -I${.CURDIR}/../../cddl/compat/ -I${.CURDIR}/../../cddl/contrib/opensolaris/uts/common \ -I${.CURDIR}/../.. \ -I${.CURDIR}/../../cddl/dev/cyclic/i386 - -CFLAGS+= -DDEBUG=1 +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h IGNORE_PRAGMA= 1 .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtio/Makefile ============================================================================== --- head/sys/modules/dtrace/dtio/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtio/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtmalloc/Makefile ============================================================================== --- head/sys/modules/dtrace/dtmalloc/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtmalloc/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtnfscl/Makefile ============================================================================== --- head/sys/modules/dtrace/dtnfscl/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtnfscl/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtnfsclient/Makefile ============================================================================== --- head/sys/modules/dtrace/dtnfsclient/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtnfsclient/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtrace/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -40,7 +40,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/common \ -I${.CURDIR}/../../.. -DDIS_MEM -CFLAGS+= -DSMP -DDEBUG +CFLAGS+= -DSMP EXPORT_SYMS= dtrace_register \ dtrace_unregister \ @@ -50,6 +50,9 @@ dtrace_asm.o: assym.s .include <bsd.kmod.mk> +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h + CWARNFLAGS+= -Wno-parentheses CWARNFLAGS+= -Wno-uninitialized CWARNFLAGS+= -Wno-cast-qual +CWARNFLAGS+= -Wno-unused Modified: head/sys/modules/dtrace/dtrace_test/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace_test/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtrace_test/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -13,3 +13,5 @@ CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -D_KERNEL .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/dtraceall/Makefile ============================================================================== --- head/sys/modules/dtrace/dtraceall/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/dtraceall/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -13,3 +13,5 @@ opt_compat.h: .endif .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/fasttrap/Makefile ============================================================================== --- head/sys/modules/dtrace/fasttrap/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/fasttrap/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -15,6 +15,9 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/cont .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/uts/intel/dtrace .endif -CFLAGS+= -DSMP -DDEBUG +CFLAGS+= -DSMP .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h +CWARNFLAGS+= -Wno-unused Modified: head/sys/modules/dtrace/fbt/Makefile ============================================================================== --- head/sys/modules/dtrace/fbt/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/fbt/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -15,3 +15,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/lockstat/Makefile ============================================================================== --- head/sys/modules/dtrace/lockstat/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/lockstat/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -12,3 +12,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/profile/Makefile ============================================================================== --- head/sys/modules/dtrace/profile/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/profile/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/prototype/Makefile ============================================================================== --- head/sys/modules/dtrace/prototype/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/prototype/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/sdt/Makefile ============================================================================== --- head/sys/modules/dtrace/sdt/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/sdt/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/systrace/Makefile ============================================================================== --- head/sys/modules/dtrace/systrace/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/systrace/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/systrace_freebsd32/Makefile ============================================================================== --- head/sys/modules/dtrace/systrace_freebsd32/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/systrace_freebsd32/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. -DFREEBSD32_SYSTRACE .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/dtrace/systrace_linux32/Makefile ============================================================================== --- head/sys/modules/dtrace/systrace_linux32/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/dtrace/systrace_linux32/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -16,3 +16,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/comp -I${.CURDIR}/../../.. -DLINUX_SYSTRACE .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/opensolaris/Makefile ============================================================================== --- head/sys/modules/opensolaris/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/opensolaris/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -27,3 +27,5 @@ CFLAGS+= -I${.CURDIR}/../../cddl/compat/ IGNORE_PRAGMA= 1 .include <bsd.kmod.mk> + +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Tue Aug 6 15:49:18 2013 (r253995) +++ head/sys/modules/zfs/Makefile Tue Aug 6 15:51:56 2013 (r253996) @@ -96,6 +96,8 @@ CFLAGS+=-mminimal-toc .include <bsd.kmod.mk> +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h + CWARNFLAGS+=-Wno-unknown-pragmas CWARNFLAGS+=-Wno-missing-prototypes CWARNFLAGS+=-Wno-undef
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308061551.r76FpuY7056153>