diff --git a/UPDATING b/UPDATING index 0be5b891930..d6f02812eb6 100644 --- a/UPDATING +++ b/UPDATING @@ -31,6 +31,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: disable the most expensive debugging functionality run "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 diff --git a/sys/cddl/compat/opensolaris/sys/debug_compat.h b/sys/cddl/compat/opensolaris/sys/debug_compat.h new file mode 100644 index 00000000000..72756a91274 --- /dev/null +++ b/sys/cddl/compat/opensolaris/sys/debug_compat.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2013 Andriy Gapon + * 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 diff --git a/sys/cddl/compat/opensolaris/sys/mutex.h b/sys/cddl/compat/opensolaris/sys/mutex.h index eff4166aacd..b1982e7245b 100644 --- a/sys/cddl/compat/opensolaris/sys/mutex.h +++ b/sys/cddl/compat/opensolaris/sys/mutex.h @@ -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) diff --git a/sys/cddl/compat/opensolaris/sys/rwlock.h b/sys/cddl/compat/opensolaris/sys/rwlock.h index 996a426357b..37241369790 100644 --- a/sys/cddl/compat/opensolaris/sys/rwlock.h +++ b/sys/cddl/compat/opensolaris/sys/rwlock.h @@ -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) diff --git a/sys/cddl/dev/dtrace/dtrace_load.c b/sys/cddl/dev/dtrace/dtrace_load.c index 672945c739e..9c5681a6e82 100644 --- a/sys/cddl/dev/dtrace/dtrace_load.c +++ b/sys/cddl/dev/dtrace/dtrace_load.c @@ -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); diff --git a/sys/cddl/dev/dtrace/dtrace_unload.c b/sys/cddl/dev/dtrace/dtrace_unload.c index 2ebb52d83ff..33d7c403f97 100644 --- a/sys/cddl/dev/dtrace/dtrace_unload.c +++ b/sys/cddl/dev/dtrace/dtrace_unload.c @@ -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(); diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 516dbc41f49..b01d5061aec 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -139,6 +139,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \ # 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} diff --git a/sys/conf/options b/sys/conf/options index c32b4578691..ed37a8e513d 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -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 diff --git a/sys/modules/cyclic/Makefile b/sys/modules/cyclic/Makefile index e0e3b40b090..054f3c35cef 100644 --- a/sys/modules/cyclic/Makefile +++ b/sys/modules/cyclic/Makefile @@ -11,9 +11,10 @@ CFLAGS+= -I${.CURDIR}/../../cddl/compat/opensolaris \ -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 + +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtio/Makefile b/sys/modules/dtrace/dtio/Makefile index ff68ce456cc..2b777ef1051 100644 --- a/sys/modules/dtrace/dtio/Makefile +++ b/sys/modules/dtrace/dtio/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtmalloc/Makefile b/sys/modules/dtrace/dtmalloc/Makefile index efb260763fa..3034b46642d 100644 --- a/sys/modules/dtrace/dtmalloc/Makefile +++ b/sys/modules/dtrace/dtmalloc/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtnfscl/Makefile b/sys/modules/dtrace/dtnfscl/Makefile index 0296232ca37..6c40e625867 100644 --- a/sys/modules/dtrace/dtnfscl/Makefile +++ b/sys/modules/dtrace/dtnfscl/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtnfsclient/Makefile b/sys/modules/dtrace/dtnfsclient/Makefile index 5e26bba65c5..b19cc3f17cb 100644 --- a/sys/modules/dtrace/dtnfsclient/Makefile +++ b/sys/modules/dtrace/dtnfsclient/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile index e6aaba7963e..3299a1edbf6 100644 --- a/sys/modules/dtrace/dtrace/Makefile +++ b/sys/modules/dtrace/dtrace/Makefile @@ -40,7 +40,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -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 +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h + CWARNFLAGS+= -Wno-parentheses CWARNFLAGS+= -Wno-uninitialized CWARNFLAGS+= -Wno-cast-qual +CWARNFLAGS+= -Wno-unused diff --git a/sys/modules/dtrace/dtrace_test/Makefile b/sys/modules/dtrace/dtrace_test/Makefile index b03fe1781fd..c5bb169d42b 100644 --- a/sys/modules/dtrace/dtrace_test/Makefile +++ b/sys/modules/dtrace/dtrace_test/Makefile @@ -13,3 +13,5 @@ CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -D_KERNEL .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/dtraceall/Makefile b/sys/modules/dtrace/dtraceall/Makefile index 6def76ec498..d57e41e9db2 100644 --- a/sys/modules/dtrace/dtraceall/Makefile +++ b/sys/modules/dtrace/dtraceall/Makefile @@ -13,3 +13,5 @@ opt_compat.h: .endif .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/fasttrap/Makefile b/sys/modules/dtrace/fasttrap/Makefile index cf93c153099..6008498a6b9 100644 --- a/sys/modules/dtrace/fasttrap/Makefile +++ b/sys/modules/dtrace/fasttrap/Makefile @@ -15,6 +15,9 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/intel .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/uts/intel/dtrace .endif -CFLAGS+= -DSMP -DDEBUG +CFLAGS+= -DSMP .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h +CWARNFLAGS+= -Wno-unused diff --git a/sys/modules/dtrace/fbt/Makefile b/sys/modules/dtrace/fbt/Makefile index 8b0014867e5..7c03d3182e6 100644 --- a/sys/modules/dtrace/fbt/Makefile +++ b/sys/modules/dtrace/fbt/Makefile @@ -15,3 +15,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/lockstat/Makefile b/sys/modules/dtrace/lockstat/Makefile index d00a0ec37a2..c87a65ab804 100644 --- a/sys/modules/dtrace/lockstat/Makefile +++ b/sys/modules/dtrace/lockstat/Makefile @@ -12,3 +12,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/profile/Makefile b/sys/modules/dtrace/profile/Makefile index 22cd10d6c9e..daa5d2ca6da 100644 --- a/sys/modules/dtrace/profile/Makefile +++ b/sys/modules/dtrace/profile/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/prototype/Makefile b/sys/modules/dtrace/prototype/Makefile index 49cc0a89b27..cad750a20dc 100644 --- a/sys/modules/dtrace/prototype/Makefile +++ b/sys/modules/dtrace/prototype/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/sdt/Makefile b/sys/modules/dtrace/sdt/Makefile index d531d789b80..96605e11152 100644 --- a/sys/modules/dtrace/sdt/Makefile +++ b/sys/modules/dtrace/sdt/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/systrace/Makefile b/sys/modules/dtrace/systrace/Makefile index d85a365705e..f495d550cda 100644 --- a/sys/modules/dtrace/systrace/Makefile +++ b/sys/modules/dtrace/systrace/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/systrace_freebsd32/Makefile b/sys/modules/dtrace/systrace_freebsd32/Makefile index 284d99f5468..ec72d0bd8b5 100644 --- a/sys/modules/dtrace/systrace_freebsd32/Makefile +++ b/sys/modules/dtrace/systrace_freebsd32/Makefile @@ -11,3 +11,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. -DFREEBSD32_SYSTRACE .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/dtrace/systrace_linux32/Makefile b/sys/modules/dtrace/systrace_linux32/Makefile index c950aacd39f..a2bfc812308 100644 --- a/sys/modules/dtrace/systrace_linux32/Makefile +++ b/sys/modules/dtrace/systrace_linux32/Makefile @@ -16,3 +16,5 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../.. -DLINUX_SYSTRACE .include + +CFLAGS+= -include ${.CURDIR}/../../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/opensolaris/Makefile b/sys/modules/opensolaris/Makefile index 54dcfe6c9d4..a49462ac4c2 100644 --- a/sys/modules/opensolaris/Makefile +++ b/sys/modules/opensolaris/Makefile @@ -27,3 +27,5 @@ CFLAGS+= -I${.CURDIR}/../../cddl/compat/opensolaris \ IGNORE_PRAGMA= 1 .include + +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index b0ef51c5340..63da0ce2cce 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -96,6 +96,8 @@ CFLAGS+=-mminimal-toc .include +CFLAGS+= -include ${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h + CWARNFLAGS+=-Wno-unknown-pragmas CWARNFLAGS+=-Wno-missing-prototypes CWARNFLAGS+=-Wno-undef