aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2015-06-10 15:53:39 +0000
committerRuslan Bukin <br@FreeBSD.org>2015-06-10 15:53:39 +0000
commit4f4d15f0d010320df2ca4c83a10c773bf05aaa3c (patch)
tree35c70864268bed022a78e62157c50403d10dbe93 /sys
parent6871c7c3f134b2959f9267447ef42a8adf48fef2 (diff)
downloadsrc-4f4d15f0d010320df2ca4c83a10c773bf05aaa3c.tar.gz
src-4f4d15f0d010320df2ca4c83a10c773bf05aaa3c.zip
Allow DTrace to be compiled-in to the kernel.
This will require for AArch64 as we dont have modules yet. Sponsored by: HEIF5 Sponsored by: ARM Ltd. Differential Revision: https://reviews.freebsd.org/D1997
Notes
Notes: svn path=/head/; revision=284227
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/conf/NOTES17
-rw-r--r--sys/arm/conf/NOTES23
-rw-r--r--sys/conf/files23
-rw-r--r--sys/conf/files.amd647
-rw-r--r--sys/conf/files.arm5
-rw-r--r--sys/conf/files.i3867
-rw-r--r--sys/conf/files.powerpc7
-rw-r--r--sys/conf/kern.post.mk20
-rw-r--r--sys/conf/kern.pre.mk25
-rw-r--r--sys/i386/conf/NOTES17
-rw-r--r--sys/powerpc/conf/NOTES22
11 files changed, 150 insertions, 23 deletions
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index e0fe46577fd7..97eefbfd7c13 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -17,6 +17,23 @@ profile 2
#
options KDTRACE_HOOKS
+# DTrace core
+# NOTE: introduces CDDL-licensed components into the kernel
+#device dtrace
+
+# DTrace modules
+#device dtrace_lockstat
+#device dtrace_profile
+#device dtrace_sdt
+#device dtrace_fbt
+#device dtrace_systrace
+#device dtrace_prototype
+#device dtnfscl
+#device dtmalloc
+
+# Alternatively include all the DTrace modules
+#device dtraceall
+
#####################################################################
# SMP OPTIONS:
diff --git a/sys/arm/conf/NOTES b/sys/arm/conf/NOTES
index 85a4c16b903a..885bfd17b042 100644
--- a/sys/arm/conf/NOTES
+++ b/sys/arm/conf/NOTES
@@ -86,3 +86,26 @@ nodevice cxgbe
nodevice pcii
nodevice snd_cmi
nodevice tnt4882
+
+#
+# Enable the kernel DTrace hooks which are required to load the DTrace
+# kernel modules.
+#
+options KDTRACE_HOOKS
+
+# DTrace core
+# NOTE: introduces CDDL-licensed components into the kernel
+#device dtrace
+
+# DTrace modules
+#device dtrace_lockstat
+#device dtrace_profile
+#device dtrace_sdt
+#device dtrace_fbt
+#device dtrace_systrace
+#device dtrace_prototype
+#device dtnfscl
+#device dtmalloc
+
+# Alternatively include all the DTrace modules
+#device dtraceall
diff --git a/sys/conf/files b/sys/conf/files
index aa97dde244cc..0217e46bd1d7 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -104,11 +104,12 @@ cam/scsi/scsi_targ_bh.c optional targbh
cam/scsi/scsi_target.c optional targ
cam/scsi/smp_all.c optional scbus
# shared between zfs and dtrace
-cddl/compat/opensolaris/kern/opensolaris.c optional zfs compile-with "${ZFS_C}"
-cddl/compat/opensolaris/kern/opensolaris_cmn_err.c optional zfs compile-with "${ZFS_C}"
-cddl/compat/opensolaris/kern/opensolaris_kmem.c optional zfs compile-with "${ZFS_C}"
-cddl/compat/opensolaris/kern/opensolaris_misc.c optional zfs compile-with "${ZFS_C}"
-cddl/compat/opensolaris/kern/opensolaris_sunddi.c optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/compat/opensolaris/kern/opensolaris_cmn_err.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/compat/opensolaris/kern/opensolaris_kmem.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/compat/opensolaris/kern/opensolaris_misc.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/compat/opensolaris/kern/opensolaris_sunddi.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/compat/opensolaris/kern/opensolaris_taskq.c optional zfs | dtrace compile-with "${CDDL_C}"
# zfs specific
cddl/compat/opensolaris/kern/opensolaris_acl.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_dtrace.c optional zfs compile-with "${ZFS_C}"
@@ -118,7 +119,6 @@ cddl/compat/opensolaris/kern/opensolaris_lookup.c optional zfs compile-with "$
cddl/compat/opensolaris/kern/opensolaris_policy.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_string.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_sysevent.c optional zfs compile-with "${ZFS_C}"
-cddl/compat/opensolaris/kern/opensolaris_taskq.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_uio.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_vfs.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_vm.c optional zfs compile-with "${ZFS_C}"
@@ -242,6 +242,17 @@ cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs compile-with "${
cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs compile-with "${ZFS_C}"
+# dtrace specific
+cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c optional dtrace compile-with "${DTRACE_C}" \
+ warning "kernel contains CDDL licensed DTRACE"
+cddl/dev/dtmalloc/dtmalloc.c optional dtmalloc | dtraceall compile-with "${CDDL_C}"
+cddl/dev/lockstat/lockstat.c optional dtrace_lockstat | dtraceall compile-with "${CDDL_C}"
+cddl/dev/profile/profile.c optional dtrace_profile | dtraceall compile-with "${CDDL_C}"
+cddl/dev/sdt/sdt.c optional dtrace_sdt | dtraceall compile-with "${CDDL_C}"
+cddl/dev/fbt/fbt.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
+cddl/dev/systrace/systrace.c optional dtrace_systrace | dtraceall compile-with "${CDDL_C}"
+cddl/dev/prototype.c optional dtrace_prototype | dtraceall compile-with "${CDDL_C}"
+fs/nfsclient/nfs_clkdtrace.c optional dtnfscl nfscl | dtraceall nfscl compile-with "${CDDL_C}"
compat/freebsd32/freebsd32_capability.c optional compat_freebsd32
compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32
compat/freebsd32/freebsd32_misc.c optional compat_freebsd32
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index f1a4e97a25aa..08fb59b50aa4 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -138,7 +138,12 @@ amd64/amd64/uio_machdep.c standard
amd64/amd64/uma_machdep.c standard
amd64/amd64/vm_machdep.c standard
amd64/pci/pci_cfgreg.c optional pci
-cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}"
+cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}"
+cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
+cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
+cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
+cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
+cddl/dev/dtrace/amd64/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
crypto/aesni/aeskeys_amd64.S optional aesni
crypto/aesni/aesni.c optional aesni
aesni_ghash.o optional aesni \
diff --git a/sys/conf/files.arm b/sys/conf/files.arm
index a406d331fb60..f49f455155a8 100644
--- a/sys/conf/files.arm
+++ b/sys/conf/files.arm
@@ -78,7 +78,10 @@ board_id.h standard \
compile-with "${AWK} -f $S/arm/conf/genboardid.awk $S/arm/conf/mach-types > board_id.h" \
no-obj no-implicit-rule before-depend \
clean "board_id.h"
-cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs | dtrace compile-with "${CDDL_C}"
+cddl/dev/dtrace/arm/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
+cddl/dev/dtrace/arm/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
+cddl/dev/fbt/arm/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
crypto/blowfish/bf_enc.c optional crypto | ipsec
crypto/des/des_enc.c optional crypto | ipsec | netsmb
dev/fb/fb.c optional sc
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index 928b10d098f0..ebfce07280ff 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -78,7 +78,12 @@ hptrr_lib.o optional hptrr \
compile-with "uudecode < $S/dev/hptrr/i386-elf.hptrr_lib.o.uu" \
no-implicit-rule
#
-cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}"
+cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}"
+cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
+cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
+cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
+cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
+cddl/dev/dtrace/i386/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
compat/linprocfs/linprocfs.c optional linprocfs
compat/linsysfs/linsysfs.c optional linsysfs
compat/linux/linux_event.c optional compat_linux
diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc
index 4158f2cb7ab1..167fa4236310 100644
--- a/sys/conf/files.powerpc
+++ b/sys/conf/files.powerpc
@@ -15,8 +15,11 @@ font.h optional sc \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
# There is only an asm version on ppc64.
-cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S optional zfs powerpc64 compile-with "${ZFS_S}"
+cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc | dtrace powerpc compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S optional zfs powerpc64 | dtrace powerpc64 compile-with "${ZFS_S}"
+cddl/dev/dtrace/powerpc/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
+cddl/dev/dtrace/powerpc/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
+cddl/dev/fbt/powerpc/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
crypto/blowfish/bf_enc.c optional crypto | ipsec
crypto/des/des_enc.c optional crypto | ipsec | netsmb
dev/bm/if_bm.c optional bm powermac
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index 8f7abaf36063..28ea4530c887 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -184,11 +184,11 @@ genassym.o: $S/$M/$M/genassym.c
${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
-# We have "special" -I include paths for opensolaris/zfs files in 'depend'.
-CFILES_NOZFS= ${CFILES:N*/opensolaris/*}
-SFILES_NOZFS= ${SFILES:N*/opensolaris/*}
-CFILES_ZFS= ${CFILES:M*/opensolaris/*}
-SFILES_ZFS= ${SFILES:M*/opensolaris/*}
+# We have "special" -I include paths for zfs/dtrace files in 'depend'.
+CFILES_NOCDDL= ${CFILES:N*/cddl/*:N*fs/nfsclient/nfs_clkdtrace*}
+SFILES_NOCDDL= ${SFILES:N*/cddl/*}
+CFILES_CDDL= ${CFILES:M*/cddl/*}
+SFILES_CDDL= ${SFILES:M*/cddl/*}
kernel-depend: .depend
# The argument list can be very long, so use make -V and xargs to
@@ -198,13 +198,13 @@ SRCS= assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \
${MFILES:T:S/.m$/.h/}
.depend: .PRECIOUS ${SRCS}
rm -f .newdep
- ${MAKE} -V CFILES_NOZFS -V SYSTEM_CFILES -V GEN_CFILES | \
+ ${MAKE} -V CFILES_NOCDDL -V SYSTEM_CFILES -V GEN_CFILES | \
MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${CFLAGS}
- ${MAKE} -V CFILES_ZFS | \
- MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${ZFS_CFLAGS}
- ${MAKE} -V SFILES_NOZFS | \
+ ${MAKE} -V CFILES_CDDL | \
+ MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${ZFS_CFLAGS} ${FBT_CFLAGS} ${DTRACE_CFLAGS}
+ ${MAKE} -V SFILES_NOCDDL | \
MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ASM_CFLAGS}
- ${MAKE} -V SFILES_ZFS | \
+ ${MAKE} -V SFILES_CDDL | \
MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ZFS_ASM_CFLAGS}
rm -f .depend
mv .newdep .depend
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 8c3b9c6e942f..3081edcaae64 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -139,13 +139,34 @@ NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC}
NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \
-o ${.TARGET} ${.ALLSRC:M*.fw}
+# Common for dtrace / zfs
+CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -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
+CDDL_CFLAGS+= -include $S/cddl/compat/opensolaris/sys/debug_compat.h
+CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
+
# 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_CFLAGS= -DBUILDING_ZFS -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs -I$S/cddl/contrib/opensolaris/uts/common/zmod -I$S/cddl/contrib/opensolaris/common/zfs ${CDDL_CFLAGS}
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}
+# Special flags for managing the compat compiles for DTrace
+DTRACE_CFLAGS= -DBUILDING_DTRACE ${CDDL_CFLAGS} -I$S/cddl/dev/dtrace -I$S/cddl/dev/dtrace/${MACHINE_CPUARCH}
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/intel -I$S/cddl/dev/dtrace/x86
+.endif
+DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/util -I$S -DDIS_MEM -DSMP
+DTRACE_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${DTRACE_CFLAGS}
+DTRACE_C= ${CC} -c ${DTRACE_CFLAGS} ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
+DTRACE_S= ${CC} -c ${DTRACE_ASM_CFLAGS} ${CDDL_CFLAGS} ${WERROR} ${.IMPSRC}
+
+# Special flags for managing the compat compiles for DTrace/FBT
+FBT_CFLAGS= -DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} -I$S/cddl/dev/fbt -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S ${CDDL_CFLAGS}
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+FBT_CFLAGS+= -I$S/cddl/dev/fbt/x86
+.endif
+FBT_C= ${CC} -c ${FBT_CFLAGS} ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
+
.if ${MK_CTF} != "no"
NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.elif ${MAKE_VERSION} >= 5201111300
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index e5710bfb86e3..1bf81639f057 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -17,6 +17,23 @@ profile 2
#
options KDTRACE_HOOKS
+# DTrace core
+# NOTE: introduces CDDL-licensed components into the kernel
+#device dtrace
+
+# DTrace modules
+#device dtrace_lockstat
+#device dtrace_profile
+#device dtrace_sdt
+#device dtrace_fbt
+#device dtrace_systrace
+#device dtrace_prototype
+#device dtnfscl
+#device dtmalloc
+
+# Alternatively include all the DTrace modules
+#device dtraceall
+
#####################################################################
# SMP OPTIONS:
diff --git a/sys/powerpc/conf/NOTES b/sys/powerpc/conf/NOTES
index 974c91ba00cd..9bfe6a956e04 100644
--- a/sys/powerpc/conf/NOTES
+++ b/sys/powerpc/conf/NOTES
@@ -3,6 +3,28 @@
# This file contains machine dependent kernel configuration notes. For
# machine independent notes, look in /sys/conf/NOTES.
+#
+# Enable the kernel DTrace hooks which are required to load the DTrace
+# kernel modules.
+#
+options KDTRACE_HOOKS
+
+# DTrace core
+# NOTE: introduces CDDL-licensed components into the kernel
+#device dtrace
+
+# DTrace modules
+#device dtrace_lockstat
+#device dtrace_profile
+#device dtrace_sdt
+#device dtrace_fbt
+#device dtrace_systrace
+#device dtrace_prototype
+#device dtnfscl
+#device dtmalloc
+
+# Alternatively include all the DTrace modules
+#device dtraceall
#####################################################################