freebsd-src/sys/conf/files.arm
Mark Johnston ddf0ed09bd sdt: Implement SDT probes using hot-patching
The idea here is to avoid a memory access and conditional branch per
probe site.  Instead, the probe is represented by an "unreachable"
unconditional function call.  asm goto is used to store the address of
the probe site (represented by a no-op sled) and the address of the
function call into a tracepoint record.  Each SDT probe carries a list
of tracepoints.

When the probe is enabled, the no-op sled corresponding to each
tracepoint is overwritten with a jmp to the corresponding label.  The
implementation uses smp_rendezvous() to park all other CPUs while the
instruction is being overwritten, as this can't be done atomically in
general.  The compiler moves argument marshalling code and the
sdt_probe() function call out-of-line, i.e., to the end of the function.

Per gallatin@ in D43504, this approach has less overhead when probes are
disabled.  To make the implementation a bit simpler, I removed support
for probes with 7 arguments; nothing makes use of this except a
regression test case.  It could be re-added later if need be.

The approach taken in this patch enables some more improvements:
1. We can now automatically fill out the "function" field of SDT probe
   names.  The SDT macros let the programmer specify the function and
   module names, but this is really a bug and shouldn't have been
   allowed.  The intent was to be able to have the same probe in
   multiple functions and to let the user restrict which probes actually
   get enabled by specifying a function name or glob.
2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability
   to include blocks of code in the out-of-line path.  For example:

	if (SDT_PROBES_ENABLED()) {
		int reason = CLD_EXITED;

		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
		SDT_PROBE1(proc, , , exit, reason);
	}

could be written

	SDT_PROBE1_EXT(proc, , , exit, reason,
		int reason;

		reason = CLD_EXITED;
		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
	);

In the future I would like to use this mechanism more generally, e.g.,
to remove branches and marshalling code used by hwpmc, and generally to
make it easier to add new tracepoint consumers without having to add
more conditional branches to hot code paths.

Reviewed by:	Domagoj Stolfa, avg
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D44483
2024-06-19 16:57:41 -04:00

160 lines
6 KiB
Plaintext

arm/arm/autoconf.c standard
arm/arm/bcopy_page.S standard
arm/arm/bcopyinout.S standard
arm/arm/blockio.S standard
arm/arm/bus_space_asm_generic.S standard
arm/arm/bus_space_base.c optional fdt
arm/arm/bus_space_generic.c standard
arm/arm/busdma_machdep.c standard
arm/arm/copystr.S standard
arm/arm/cpufunc.c standard
arm/arm/cpufunc_asm.S standard
arm/arm/cpufunc_asm_arm11x6.S optional cpu_arm1176
arm/arm/cpufunc_asm_armv7.S optional cpu_cortexa | cpu_krait | cpu_mv_pj4b
arm/arm/cpufunc_asm_pj4b.S optional cpu_mv_pj4b
arm/arm/cpuinfo.c standard
arm/arm/cpu_asm-v6.S standard
arm/arm/db_disasm.c optional ddb
arm/arm/db_interface.c optional ddb
arm/arm/db_trace.c optional ddb
arm/arm/debug_monitor.c optional ddb | gdb
arm/arm/disassem.c optional ddb
arm/arm/dump_machdep.c standard
arm/arm/elf_machdep.c standard
arm/arm/elf_note.S standard
arm/arm/exception.S standard
arm/arm/exec_machdep.c standard
arm/arm/fusu.S standard
arm/arm/gdb_machdep.c optional gdb
arm/arm/generic_timer.c optional generic_timer
arm/arm/gic.c optional gic
arm/arm/gic_fdt.c optional gic fdt
arm/arm/gic_if.m optional gic
arm/arm/identcpu-v6.c standard
arm/arm/in_cksum_arm.S optional inet | inet6
arm/arm/in_cksum_machdep.c optional inet | inet6
kern/subr_intr.c standard
arm/arm/locore.S standard no-obj
arm/arm/hypervisor-stub.S standard
arm/arm/machdep.c standard
arm/arm/machdep_boot.c standard
arm/arm/machdep_kdb.c standard
arm/arm/machdep_intr.c standard
arm/arm/machdep_ptrace.c standard
arm/arm/mem.c optional mem
arm/arm/minidump_machdep.c standard
arm/arm/mp_machdep.c optional smp
arm/arm/mpcore_timer.c optional mpcore_timer
arm/arm/nexus.c standard
arm/arm/ofw_machdep.c optional fdt
arm/arm/pl190.c optional pl190
arm/arm/pl310.c optional pl310
arm/arm/platform.c optional platform
arm/arm/platform_if.m optional platform
arm/arm/platform_pl310_if.m optional platform pl310
arm/arm/pmap-v6.c standard
arm/arm/pmu.c optional pmu | hwpmc
arm/arm/pmu_fdt.c optional fdt pmu | fdt hwpmc
arm/arm/ptrace_machdep.c standard
arm/arm/sc_machdep.c optional sc
arm/arm/sdt_machdep.c optional kdtrace_hooks
arm/arm/setcpsr.S standard
arm/arm/setstack.S standard
arm/arm/stack_machdep.c optional ddb | stack
arm/arm/stdatomic.c standard \
compile-with "${NORMAL_C:N-Wmissing-prototypes}"
arm/arm/support.S standard
arm/arm/swtch.S standard
arm/arm/swtch-v6.S standard
arm/arm/sys_machdep.c standard
arm/arm/syscall.c standard
arm/arm/trap-v6.c standard
arm/arm/uio_machdep.c standard
arm/arm/undefined.c standard
arm/arm/unwind.c optional ddb | kdtrace_hooks | stack
arm/arm/vm_machdep.c standard
arm/arm/vfp.c optional vfp
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}"
# zfs sha2 hash support
contrib/openzfs/module/icp/asm-arm/sha2/sha256-armv7.S optional zfs compile-with "${ZFS_S}"
contrib/openzfs/module/icp/asm-arm/sha2/sha512-armv7.S optional zfs compile-with "${ZFS_S}"
crypto/des/des_enc.c optional netsmb
dev/cpufreq/cpufreq_dt.c optional cpufreq fdt
dev/fb/fb.c optional sc
dev/fdt/fdt_arm_platform.c optional platform fdt
dev/video/crtc_if.m optional vt
dev/hwpmc/hwpmc_arm.c optional hwpmc
dev/hwpmc/hwpmc_armv7.c optional hwpmc
dev/iicbus/controller/twsi/twsi.c optional twsi
dev/ofw/ofw_pcib.c optional fdt pci
dev/pci/pci_host_generic.c optional pci_host_generic pci
dev/pci/pci_host_generic_fdt.c optional pci_host_generic pci fdt
dev/psci/psci.c optional psci
dev/psci/smccc_arm.S optional psci
dev/syscons/scgfbrndr.c optional sc
dev/uart/uart_cpu_fdt.c optional uart fdt
dev/usb/controller/dwc3/dwc3.c optional fdt dwc3
dev/usb/controller/generic_xhci.c optional xhci
dev/usb/controller/generic_xhci_fdt.c optional xhci fdt
kern/msi_if.m optional intrng
kern/pic_if.m optional intrng
kern/subr_busdma_bufalloc.c standard
kern/subr_devmap.c standard
kern/subr_physmem.c standard
kern/subr_sfbuf.c standard
libkern/arm/aeabi_unwind.c standard
libkern/arm/divsi3.S standard
libkern/arm/ldivmod.S standard
libkern/arm/ldivmod_helper.c standard
libkern/arm/memclr.S standard
libkern/arm/memcpy.S standard
libkern/arm/memset.S standard
libkern/arm/muldi3.c standard
libkern/ashldi3.c standard
libkern/ashrdi3.c standard
libkern/divdi3.c standard
libkern/lshrdi3.c standard
libkern/moddi3.c standard
libkern/qdivrem.c standard
libkern/strcmp.c standard
libkern/strlen.c standard
libkern/strncmp.c standard
libkern/ucmpdi2.c standard
libkern/udivdi3.c standard
libkern/umoddi3.c standard
crypto/openssl/ossl_arm.c optional ossl
crypto/openssl/arm/ossl_aes_gcm.c optional ossl
crypto/openssl/arm/aes-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/bsaes-armv7.S optional ossl \
compile-with "${CC} -D__KERNEL__ -c ${CFLAGS:N-mgeneral-regs-only} -I${SRCTOP}/sys/crypto/openssl ${WERROR} ${.IMPSRC}"
crypto/openssl/arm/chacha-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/ghash-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/poly1305-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/sha1-armv4-large.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/sha256-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
crypto/openssl/arm/sha512-armv4.S optional ossl \
compile-with "${NORMAL_C} -I${SRCTOP}/sys/crypto/openssl"
# Annapurna support
arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt
arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt
arm/annapurna/alpine/alpine_pci.c optional al_pci fdt
arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt
arm/annapurna/alpine/alpine_serdes.c optional al_serdes fdt \
no-depend \
compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${.IMPSRC}"