[DTrace-devel] DTrace-V1-ized 5.10.4 pushed to github

Nick Alcock nick.alcock at oracle.com
Wed Dec 30 13:07:25 PST 2020


Tests passed on x86-64 and AArch64 with https://github.com/oracle/dtrace-utils
(master branch). (Non-stress tests only: one stress test currently
fails on x86-64. This is unlikely to affect normal use unless you do
something most unusual like chill()ing on all fbt probes at once.)

Pushed to <https://github.com/oracle/dtrace-linux-kernel>, as a branch
with v1 in the name.

This push is of DTrace v1, using a specialized kernel module rather than BPF.


Changes since 5.9.3 were pretty minimal, with much of the change being
accounted for by squashing back the last three commits in the last series:

 1:  244de8221ebc !  1:  593a6d11204b ctf: generate CTF information for the kernel
    @@ Makefile: endif # CONFIG_MODULES
      
      # Directories & files removed with 'make clean'
     -CLEAN_FILES += include/ksym vmlinux.symvers \
    --	       modules.builtin modules.builtin.modinfo modules.nsdeps
    +-	       modules.builtin modules.builtin.modinfo modules.nsdeps \
    +-	       compile_commands.json
     +CLEAN_FILES += include/ksym .ctf vmlinux.symvers \
    -+	       modules.builtin modules.builtin.modinfo objects.builtin modules.nsdeps .ctf.filelist .ctf.filelist.raw
    ++	       modules.builtin modules.builtin.modinfo objects.builtin \
    ++	       modules.nsdeps compile_commands.json \
    ++	       .ctf.filelist .ctf.filelist.raw
      
      # Directories & files removed with 'make mrproper'
      MRPROPER_FILES += include/config include/generated          \
    @@ scripts/Kbuild.include: ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && ec
      # Usage:
     
      ## scripts/Makefile ##
    -@@ scripts/Makefile: hostprogs += unifdef
    +@@ scripts/Makefile: targets += module.lds
      
      subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
      subdir-$(CONFIG_MODVERSIONS) += genksyms
    @@ scripts/Makefile.modfinal: quiet_cmd_cc_o_c = CC [M]  $@
     +
     +$(ctf-filelist-raw): $(ctf-builtins-prereq) $(ctf-modules)
     +	@rm -f $(ctf-filelist-raw);
    -+	@if [[ -n "$(ctf-dir-mk)" ]]; then \
    ++	@if [ -n "$(ctf-dir-mk)" ]; then \
     +		mkdir -p "$(ctf-dir-mk)"; \
     +	fi
     +	$(call xargs, at printf "%s\n" >> $(ctf-filelist-raw),$^)
    @@ scripts/Makefile.modfinal: quiet_cmd_cc_o_c = CC [M]  $@
      ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
      
      quiet_cmd_ld_ko_o = LD [M]  $@
    -@@ scripts/Makefile.modfinal: quiet_cmd_ld_ko_o = LD [M]  $@
    +       cmd_ld_ko_o =                                                     \
      	$(LD) -r $(KBUILD_LDFLAGS)					\
      		$(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE)		\
    - 		$(addprefix -T , $(KBUILD_LDS_MODULE))			\
    --		-o $@ $(filter %.o, $^);				\
    -+                 $(LDFLAGS_$(modname)) -o $@.tmp            		\
    -+		-o $@.tmp $(patsubst $(ctf-dir)/%,,$(filter %.o, $^)) && \
    +-		-T scripts/module.lds -o $@ $(filter %.o, $^);		\
    ++		-T scripts/module.lds $(LDFLAGS_$(modname)) -o $@.tmp	\
    ++		$(patsubst $(ctf-dir)/%,,$(filter %.o, $^)) &&		\
     +        $(OBJCOPY) $(module-ctf-flags) $@.tmp $@ && rm -f $@.tmp ;	\
      	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
      
    --$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) FORCE
    -+$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) $(module-ctfs-modular-prereq) FORCE
    +-$(modules): %.ko: %.o %.mod.o scripts/module.lds FORCE
    ++$(modules): %.ko: %.o %.mod.o scripts/module.lds $(module-ctfs-modular-prereq) FORCE
     +	$(call cmd_touch_ctf)
      	+$(call if_changed,ld_ko_o)
      
 2:  7eb0f029ad3b !  2:  8494b519fdf8 kallsyms: introduce new /proc/kallmodsyms including builtin modules too
    @@ kernel/kallsyms.c
      extern const u8 kallsyms_names[] __weak;
      
      /*
    -@@ kernel/kallsyms.c: __attribute__((weak, section(".rodata")));
    +@@ kernel/kallsyms.c: __section(".rodata") __attribute__((weak));
      
      extern const char kallsyms_token_table[] __weak;
      extern const u16 kallsyms_token_index[] __weak;
    @@ scripts/link-vmlinux.sh: vmlinux_link()
      
      		${CC} ${CFLAGS_vmlinux}				\
     @@ scripts/link-vmlinux.sh: kallsyms()
    - 	info KSYM ${2}
    + {
      	local kallsymopt;
      
     +	# read the linker map to identify ranges of addresses:
    @@ scripts/link-vmlinux.sh: kallsyms()
      		kallsymopt="${kallsymopt} --base-relative"
      	fi
      
    -+	# set up compilation
    - 	local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
    - 		      ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
    - 
    - 	local afile="`basename ${2} .o`.S"
    - 
    --	${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${afile}
     +	# "nm -S" does not print symbol size when size is 0
     +	# Therefore use awk to regularize the data:
     +	#   - when there are only three fields, add an explicit "0"
     +	#   - when there are already four fields, pass through as is
    + 	info KSYMS ${2}
    +-	${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${2}
     +	${NM} -n -S ${1} | ${AWK} 'NF==3 {print $1, 0, $2, $3}; NF==4' | \
    -+	    scripts/kallsyms ${kallsymopt} > ${afile}
    - 	${CC} ${aflags} -c -o ${2} ${afile}
    ++	    scripts/kallsyms ${kallsymopt} > ${2}
      }
      
    -
    - ## scripts/namespace.pl ##
    -@@ scripts/namespace.pl: my %nameexception = (
    -     'kallsyms_addresses'=> 1,
    -     'kallsyms_offsets'	=> 1,
    -     'kallsyms_relative_base'=> 1,
    -+    'kallsyms_sizes'	=> 1,
    -+    'kallsyms_token_table'=> 1,
    -+    'kallsyms_token_index'=> 1,
    -+    'kallsyms_markers'	=> 1,
    -+    'kallsyms_modules'	=> 1,
    -+    'kallsyms_symbol_modules'=> 1,
    -     '__this_module'	=> 1,
    -     '_etext'		=> 1,
    -     '_edata'		=> 1,
    + # Perform one step in kallsyms generation, including temporary linking of
 3:  aa2742716035 !  3:  b4a590200acc waitfd: new syscall implementing waitpid() over fds
    @@ Commit message
     
      ## arch/x86/entry/syscalls/syscall_32.tbl ##
     @@
    - 437	i386	openat2			sys_openat2
      438	i386	pidfd_getfd		sys_pidfd_getfd
      439	i386	faccessat2		sys_faccessat2
    + 440	i386	process_madvise		sys_process_madvise
     +# This one is a temporary number, designed for no clashes.
     +# Nothing but DTrace should use it.
     +473	i386	waitfd			sys_waitfd
     
      ## arch/x86/entry/syscalls/syscall_64.tbl ##
     @@
    - 437	common	openat2			sys_openat2
      438	common	pidfd_getfd		sys_pidfd_getfd
      439	common	faccessat2		sys_faccessat2
    + 440	common	process_madvise		sys_process_madvise
     +# This one is a temporary number, designed for no clashes.
     +# Nothing but DTrace should use it.
     +473	common	waitfd			sys_waitfd
      
      #
    - # x32-specific system call numbers start at 512 to avoid cache impact
    + # Due to a historical design error, certain syscalls are numbered differently
     
      ## drivers/vfio/virqfd.c ##
     @@ drivers/vfio/virqfd.c: static int virqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void
    @@ include/linux/syscalls.h: long ksys_old_shmctl(int shmid, int cmd, struct shmid_
      		int __user *optlen);
     
      ## include/uapi/asm-generic/unistd.h ##
    -@@ include/uapi/asm-generic/unistd.h: __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
    - #define __NR_faccessat2 439
    - __SYSCALL(__NR_faccessat2, sys_faccessat2)
    +@@ include/uapi/asm-generic/unistd.h: __SYSCALL(__NR_faccessat2, sys_faccessat2)
    + #define __NR_process_madvise 440
    + __SYSCALL(__NR_process_madvise, sys_process_madvise)
      
     +#define __NR_waitfd 473
     +__SYSCALL(__NR_waitfd, sys_waitfd)
     +
      #undef __NR_syscalls
    --#define __NR_syscalls 440
    +-#define __NR_syscalls 441
     +#define __NR_syscalls 474
      
      /*
 4:  4521d80af3e9 !  4:  0b9dc3dc879f dtrace: core and x86
    @@ kernel/dtrace/dtrace_os.c (new)
     + * our own version for lock-free access from within a probe context.
     + */
     +static struct dtrace_time_fast {
    -+	seqcount_t	dtwf_seq;
    -+	ktime_t		dtwf_offsreal[2];
    ++	seqcount_latch_t	dtwf_seq;
    ++	ktime_t			dtwf_offsreal[2];
     +} dtrace_time ____cacheline_aligned;
     +
     +/*
    @@ kernel/dtrace/dtrace_os.c (new)
     +	do {
     +		seq = raw_read_seqcount_latch(&dtrace_time.dtwf_seq);
     +		offset = dtrace_time.dtwf_offsreal[seq & 0x1];
    -+	} while (read_seqcount_retry(&dtrace_time.dtwf_seq, seq));
    ++	} while (read_seqcount_latch_retry(&dtrace_time.dtwf_seq, seq));
     +
     +	return ktime_add_ns(offset, nsec);
     +}
 5:  5ff6fe455274 =  5:  405f43e8fd66 dtrace: modular components and x86 support
 6:  c6582c50ec2b =  6:  97847b65bf46 dtrace: systrace provider core components
 7:  492a66b9a231 =  7:  a015a9359dcb dtrace: systrace provider
 8:  e89ae4981ac3 !  8:  c755394f66e8 dtrace: sdt provider core components
    @@ Commit message
      ## .gitignore ##
     @@ .gitignore: x509.genkey
      
    - # Clang's compilation database file
    - /compile_commands.json
    -+
    + # Documentation toolchain
    + sphinx_*/
     +#
     +# Generated DTrace SDT files
     +#
     +*.sdtinfo.c
    ++*.sdtinfo.h
     +*.sdtstub.S
     
      ## Makefile ##
    @@ Makefile: clean: $(clean-dirs)
      		-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
      		-o -name '*.dwo' -o -name '*.lst' \
      		-o -name '*.su' -o -name '*.mod' \
    -+		-o -name '*.sdtinfo.c' -o -name '*.sdtstub.S' \
    ++		-o -name '*.sdtinfo.c' -o -name '*.sdtinfo.h' -o -name '*.sdtstub.S' \
      		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
      		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
      		-o -name '*.asn1.[ch]' \
    @@ include/linux/sdt_internal.h (new)
     
      ## include/linux/tracepoint.h ##
     @@
    - #include <linux/cpumask.h>
      #include <linux/rcupdate.h>
      #include <linux/tracepoint-defs.h>
    + #include <linux/static_call.h>
     +#include <linux/sdt.h>
      
      struct module;
    @@ include/linux/tracepoint.h: static inline struct tracepoint *tracepoint_ptr_dere
     +		DTRACE_PROBE_TRACEPOINT(name, args);			\
     +		DTRACE_PROTO_TRACEPOINT(name, proto);			\
      		if (static_key_false(&__tracepoint_##name.key))		\
    - 			__DO_TRACE(&__tracepoint_##name,		\
    + 			__DO_TRACE(name,				\
      				TP_PROTO(data_proto),			\
     @@ include/linux/tracepoint.h: static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
      #else /* !TRACEPOINTS_ENABLED */
    @@ kernel/module.c: static int complete_formation(struct module *mod, struct load_i
      	/* Find duplicate symbols (must be called under lock). */
     
      ## scripts/.gitignore ##
    -@@ scripts/.gitignore: asn1_compiler
    - extract-cert
    +@@ scripts/.gitignore: extract-cert
      sign-file
      insert-sys-cert
    + /module.lds
     +kmodsdt
     
      ## scripts/Makefile ##
    @@ scripts/Makefile.modfinal: modname = $(notdir $(@:.mod.o=))
     +sdtgen = $(srctree)/scripts/dtrace_sdt.sh
     +
     +quiet_cmd_sdtinfo = SDTINF  $@
    -+      cmd_sdtinfo = $(sdtgen) sdtinfo $@ $< kmod
    ++      cmd_sdtinfo = $(sdtgen) sdtinfo $@ $< kmod $(@:.c=.h)
     +
     +quiet_cmd_sdtstub = SDTSTB  $@
     +      cmd_sdtstub = $(sdtgen) sdtstub $@ $<
    @@ scripts/Makefile.modfinal: modname = $(notdir $(@:.mod.o=))
     +$(modules:.ko=.sdtstub.S) : %.sdtstub.S: %.o %.sdtinfo.c
     +	$(call cmd,sdtstub)
     +
    ++%.sdtinfo.o : %.sdtinfo.c
    ++	$(call if_changed_dep,cc_o_c)
    ++
     +%.mod.o: %.mod.c %.sdtinfo.c FORCE
     +	$(call if_changed_dep,cc_o_c)
     +
    @@ scripts/Makefile.modfinal: $(1) $(wordlist 1,1024,$(2))
     -$(ctf-filelist-raw): $(ctf-builtins-prereq) $(ctf-modules)
     +$(ctf-filelist-raw): $(ctf-builtins-prereq) $(ctf-modules) | $(sdtinfo-prereq)
      	@rm -f $(ctf-filelist-raw);
    - 	@if [[ -n "$(ctf-dir-mk)" ]]; then \
    + 	@if [ -n "$(ctf-dir-mk)" ]; then \
      		mkdir -p "$(ctf-dir-mk)"; \
     @@ scripts/Makefile.modfinal: vmlinux.ctfa: $(ctf-filelist)
      else
    @@ scripts/Makefile.modfinal: quiet_cmd_ld_ko_o = LD [M]  $@
              $(OBJCOPY) $(module-ctf-flags) $@.tmp $@ && rm -f $@.tmp ;	\
      	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
      
    --$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) $(module-ctfs-modular-prereq) FORCE
    -+$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) $(module-sdt-modular-prereq) $(module-ctfs-modular-prereq) FORCE
    +-$(modules): %.ko: %.o %.mod.o scripts/module.lds $(module-ctfs-modular-prereq) FORCE
    ++$(modules): %.ko: %.o %.mod.o %.sdtinfo.o scripts/module.lds $(module-sdt-modular-prereq) $(module-ctfs-modular-prereq) FORCE
      	$(call cmd_touch_ctf)
      	+$(call if_changed,ld_ko_o)
      
    @@ scripts/dtrace_sdt.sh (new)
     +#	dtrace_sdt.sh sdtstub <S-file> <o-file>+
     +#		This is used to generate DTrace SDT probe stubs based on one
     +#		or more object file(s).  The stubs are written to <S-file>.
    -+#	dtrace_sdt.sh sdtinfo <c-file> <o-file> kmod
    ++#	dtrace_sdt.sh sdtinfo <c-file> <o-file> kmod <h-file>
     +#		This is used to generate DTrace SDT probe definitions for a
    -+#		kmod .o file.  The output is written to <c-file>.
    ++#		kmod .o file.  The output is written to <c-file> and <h-file>.
     +#	dtrace_sdt.sh sdtinfo <S-file> <l-file>
     +#		This is used to generate DTrace SDT probe definitions for a
     +#		linked kernel image file <l-file>.  The output is written to
    @@ scripts/dtrace_sdt.sh (new)
     +
     +if [ "$opr" = "sdtstub" ]; then
     +    ${NM} -u $* | grep -E '__dtrace_(probe|isenabled)_' | sort | uniq | \
    -+	${AWK} -v arch=${ARCH} \
    ++	gawk -v arch=${ARCH} \
     +	       '{
     +		    printf("\t.globl %s\n\t.type %s, at function\n%s:\n",
     +			   $2, $2, $2);
    @@ scripts/dtrace_sdt.sh (new)
     +fi
     +
     +if [ "$tok" = "kmod" ]; then
    ++    hfile="$3"
    ++
     +    # Pre-process the object file to handle any local functions that contain
     +    # SDT probes.
     +    scripts/kmodsdt ${ofn}
    @@ scripts/dtrace_sdt.sh (new)
     +    #        (See STAGE 3b below.)
     +    #
     +    ${OBJDUMP} -tr ${ofn} | \
    -+    awk '/^RELOC/ {
    ++    gawk '/^RELOC/ {
     +	     sect = substr($4, 2, length($4) - 3);
     +	     if (sect ~ /^\.(exit|init|meminit)\.text/)
     +		 sect = 0;
    @@ scripts/dtrace_sdt.sh (new)
     +		 print $4 " " $1 " F " $6;
     +	 }' | \
     +    sort -k1,2 | \
    -+    awk -v arch=${ARCH} \
    ++    gawk -v arch=${ARCH} -v hfile=${hfile} \
     +	'function subl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
     +             tmp = $0;
     +             if (length(v0) > 8) {
    @@ scripts/dtrace_sdt.sh (new)
     +
     +	 BEGIN {
     +	     print "#include <linux/sdt.h>";
    -+	     print "#include <linux/fs.h>";
     +
     +	     probec = 0;
     +	 }
    @@ scripts/dtrace_sdt.sh (new)
     +	 }
     +
     +	 END {
    -+	     if (probec > 0) {
    -+		 for (alias in protom)
    -+		     if (alias != "locks_start_grace" && alias != "locks_end_grace")
    -+			 printf "extern void %s(void);\n", alias;
    -+		 print "\nstatic struct sdt_probedesc\t_sdt_probes[] = {";
    -+		 for (i = 0; i < probec; i++)
    -+		     print probev[i];
    -+		 print "};\n";
    -+	     } else
    -+		print "#define _sdt_probes\tNULL";
    -+
    -+	     print "#define _sdt_probec\t" probec;
    ++	     for (alias in protom)
    ++		 printf "extern void %s(void);\n", alias;
    ++	     print "\nstruct sdt_probedesc\t_sdt_probes[] = {";
    ++	     for (i = 0; i < probec; i++)
    ++		 print probev[i];
    ++	     print "};\n";
    ++
    ++	     print "#define _sdt_probec\t" probec > hfile;
    ++	     print "extern struct sdt_probedesc _sdt_probes[];" >> hfile;
     +
     +	     exit(errc == 0 ? 0 : 1);
     +	 }' > $tfn
    @@ scripts/dtrace_sdt.sh (new)
     +    #        Relocation within a section at a specific address
     +    #
     +    ${OBJDUMP} -htr ${ofn} | \
    -+    awk 'function addl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
    ++    gawk 'function addl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
     +	     tmp = $0;
     +	     if (length(v0) > 8 || length(v1) > 8) {
     +		 d = length(v0);
    @@ scripts/dtrace_sdt.sh (new)
     +		 print $4 " " $1 " F " $6;
     +	 }' | \
     +    sort -k2 | \
    -+    awk -v arch=${ARCH} \
    ++    gawk -v arch=${ARCH} \
     +	'function subl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
     +             tmp = $0;
     +             if (length(v0) > 8) {
    @@ scripts/link-vmlinux.sh: vmlinux_link()
      			${objects}				\
      			-lutil -lrt -lpthread
     @@ scripts/link-vmlinux.sh: kallsyms_step()
    - 	kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1}
      	kallsymso=${kallsyms_vmlinux}.o
    + 	kallsyms_S=${kallsyms_vmlinux}.S
      
     -	vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
     +	vmlinux_link ${kallsyms_vmlinux} "${2:-}" "${kallsymso_prev}" ${btf_vmlinux_bin_o} ${sdtstubo} ${sdtinfoo}
    - 	kallsyms ${kallsyms_vmlinux} ${kallsymso}
    - }
    + 	kallsyms ${kallsyms_vmlinux} ${kallsyms_S}
      
    + 	info AS ${kallsyms_S}
     @@ scripts/link-vmlinux.sh: cleanup()
      {
      	rm -f .btf.*
    @@ scripts/link-vmlinux.sh: if [ -n "${CONFIG_KALLSYMS}" ]; then
     +vmlinux_link vmlinux "" "${kallsymso}" ${btf_vmlinux_bin_o} ${sdtstubo} ${sdtinfoo}
      
      # fill in BTF IDs
    - if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
    + if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then
     
      ## scripts/mod/modpost.c ##
     @@ scripts/mod/modpost.c: static int check_exports(struct module *mod)
    @@ scripts/mod/modpost.c: static void add_header(struct buffer *b, struct module *m
      	buf_printf(b, "#include <linux/compiler.h>\n");
      	buf_printf(b, "\n");
     +	buf_printf(b, "#ifdef CONFIG_DTRACE\n");
    -+	buf_printf(b, "# include \"%s.sdtinfo.c\"\n", modname);
    ++	buf_printf(b, "# include \"%s.sdtinfo.h\"\n", modname);
     +	buf_printf(b, "#endif\n");
     +	buf_printf(b, "\n");
      	buf_printf(b, "BUILD_SALT;\n");
 9:  2aab3c565ba0 =  9:  45506d43a1f8 dtrace: sdt provider for x86
10:  6a1ab51438cd = 10:  4b9166c34e7a dtrace: profile provider and test probe core components
11:  fb3a4f8f53b4 = 11:  82e4d72a8dd7 dtrace: profile and tick providers built on cyclics
12:  be7aa9a95675 = 12:  6cd1535eb497 dtrace: USDT and pid provider core and x86 components
13:  fe7e28c7a973 = 13:  95c596b4be21 dtrace: USDT and pid providers
14:  582ef8833519 ! 14:  743a93e65935 dtrace: function boundary tracing (FBT) core and x86 components
    @@ arch/x86/include/asm/idtentry.h: static __always_inline void __##func(struct pt_
     -	__visible void noist_##func(struct pt_regs *regs)
     +	__visible int noist_##func(struct pt_regs *regs)
      
    + /**
    +  * DECLARE_IDTENTRY_VC - Declare functions for the VC entry point
    +@@ arch/x86/include/asm/idtentry.h: static __always_inline void __##func(struct pt_regs *regs)
    +  */
    + #define DECLARE_IDTENTRY_VC(vector, func)				\
    + 	DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func);			\
    +-	__visible noinstr void ist_##func(struct pt_regs *regs, unsigned long error_code);	\
    +-	__visible noinstr void safe_stack_##func(struct pt_regs *regs, unsigned long error_code)
    ++	__visible noinstr int ist_##func(struct pt_regs *regs, unsigned long error_code);	\
    ++	__visible noinstr int safe_stack_##func(struct pt_regs *regs, unsigned long error_code)
    + 
      /**
       * DEFINE_IDTENTRY_IST - Emit code for IST entry points
     @@ arch/x86/include/asm/idtentry.h: static __always_inline void __##func(struct pt_regs *regs)
    @@ arch/x86/kernel/cpu/mshyperv.c: DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback)
     +	return 0;
      }
      
    - void hv_setup_vmbus_irq(void (*handler)(void))
    + int hv_setup_vmbus_irq(int irq, void (*handler)(void))
     @@ arch/x86/kernel/cpu/mshyperv.c: DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_stimer0)
      	ack_APIC_irq();
      
    @@ arch/x86/kernel/irq_work.c: DEFINE_IDTENTRY_SYSVEC(sysvec_irq_work)
      
      void arch_irq_work_raise(void)
     
    + ## arch/x86/kernel/kvm.c ##
    +@@ arch/x86/kernel/kvm.c: DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt)
    + 	}
    + 
    + 	set_irq_regs(old_regs);
    ++	return 0;
    + }
    + 
    + static void __init paravirt_ops_setup(void)
    +
      ## arch/x86/kernel/nmi.c ##
     @@ arch/x86/kernel/nmi.c: DEFINE_IDTENTRY_RAW(exc_nmi)
    - 	bool irq_state;
    + 	sev_es_nmi_complete();
      
      	if (IS_ENABLED(CONFIG_SMP) && arch_cpu_is_offline(smp_processor_id()))
     -		return;
    @@ arch/x86/kernel/nmi.c: DEFINE_IDTENTRY_RAW(exc_nmi)
      
      void stop_nmi(void)
     
    + ## arch/x86/kernel/sev-es.c ##
    +@@ arch/x86/kernel/sev-es.c: DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
    + 	 */
    + 	if (error_code == SVM_EXIT_EXCP_BASE + X86_TRAP_DB) {
    + 		vc_handle_trap_db(regs);
    +-		return;
    ++		return 0;
    + 	}
    + 
    + 	instrumentation_begin();
    +@@ arch/x86/kernel/sev-es.c: DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
    + out:
    + 	instrumentation_end();
    + 
    +-	return;
    ++	return 0;
    + 
    + fail:
    + 	if (user_mode(regs)) {
    +@@ arch/x86/kernel/sev-es.c: DEFINE_IDTENTRY_VC_IST(exc_vmm_communication)
    + 	instrumentation_begin();
    + 	panic("Can't handle #VC exception from unsupported context\n");
    + 	instrumentation_end();
    ++	return 0;
    + }
    + 
    + DEFINE_IDTENTRY_VC(exc_vmm_communication)
    +@@ arch/x86/kernel/sev-es.c: DEFINE_IDTENTRY_VC(exc_vmm_communication)
    + 		safe_stack_exc_vmm_communication(regs, error_code);
    + 	else
    + 		ist_exc_vmm_communication(regs, error_code);
    ++	return 0;
    + }
    + 
    + bool __init handle_vc_boot_ghcb(struct pt_regs *regs)
    +
      ## arch/x86/kernel/smp.c ##
     @@ arch/x86/kernel/smp.c: DEFINE_IDTENTRY_SYSVEC(sysvec_reboot)
      	ack_APIC_irq();
    @@ arch/x86/kernel/traps.c: DEFINE_IDTENTRY_ERRORCODE(exc_alignment_check)
      	if (!user_mode(regs))
      		die("Split lock detected\n", regs, error_code);
     @@ arch/x86/kernel/traps.c: DEFINE_IDTENTRY_ERRORCODE(exc_alignment_check)
    - 	local_irq_enable();
    - 
    - 	if (handle_user_split_lock(regs, error_code))
    --		return;
    -+		return 0;
    - 
    - 	do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs,
    - 		error_code, BUS_ADRALN, NULL);
      
    + out:
      	local_irq_disable();
     +	return 0;
      }
    @@ arch/x86/mm/fault.c: DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
     +	return 0;
      }
     
    - ## arch/x86/platform/uv/tlb_uv.c ##
    -@@ arch/x86/platform/uv/tlb_uv.c: DEFINE_IDTENTRY_SYSVEC(sysvec_uv_bau_message)
    - 		stat->d_nomsg++;
    - 	else if (count > 1)
    - 		stat->d_multmsg++;
    -+	return 0;
    - }
    - 
    - /*
    -
      ## arch/x86/xen/enlighten_hvm.c ##
     @@ arch/x86/xen/enlighten_hvm.c: DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)
      	xen_hvm_evtchn_do_upcall();
    @@ kernel/dtrace/dtrace_os.c: void __init dtrace_os_init(void)
     
      ## kernel/kprobes.c ##
     @@
    - #include <linux/jump_label.h>
      #include <linux/perf_event.h>
    + #include <linux/static_call.h>
      
     +#ifdef CONFIG_DTRACE
     +#include <linux/dtrace_fbt.h>
15:  ec718dc20396 = 15:  62173655c4e7 dtrace: fbt provider, modular components
16:  64fa0d2f10bc ! 16:  6b00dfe870f2 dtrace, arm: arm64 port
    @@ arch/arm64/dtrace/sdt_arm64.c (new)
     
      ## arch/arm64/include/asm/brk-imm.h ##
     @@
    -  * #imm16 values used for BRK instruction generation
       * 0x004: for installing kprobes
       * 0x005: for installing uprobes
    -+ * 0x006: for installing DTrace SDT probes
    -+ * 0x007: for installing DTrace function-boundary tracing entry probes
    -+ * 0x008: for installing DTrace function-boundary tracing return probes
    +  * 0x006: for kprobe software single-step
    ++ * 0x007: for installing DTrace SDT probes
    ++ * 0x008: for installing DTrace function-boundary tracing entry probes
    ++ * 0x009: for installing DTrace function-boundary tracing return probes
       * Allowed values for kgdb are 0x400 - 0x7ff
       * 0x100: for triggering a fault on purpose (reserved)
       * 0x400: for dynamic BRK instruction
     @@
    -  */
      #define KPROBES_BRK_IMM			0x004
      #define UPROBES_BRK_IMM			0x005
    -+#define DPROBES_SDT_BRK_IMM		0x006
    -+#define DPROBES_FBE_BRK_IMM		0x007
    -+#define DPROBES_FBR_BRK_IMM		0x008
    + #define KPROBES_BRK_SS_IMM		0x006
    ++#define DPROBES_SDT_BRK_IMM		0x007
    ++#define DPROBES_FBE_BRK_IMM		0x008
    ++#define DPROBES_FBR_BRK_IMM		0x009
      #define FAULT_BRK_IMM			0x100
      #define KGDB_DYN_DBG_BRK_IMM		0x400
      #define KGDB_COMPILED_DBG_BRK_IMM	0x401
    @@ arch/arm64/include/asm/cpu.h: struct cpuinfo_arm64 {
     
      ## arch/arm64/include/asm/debug-monitors.h ##
     @@
    - #define BRK64_OPCODE_KPROBES	(AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5))
    + #define BRK64_OPCODE_KPROBES_SS	(AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5))
      /* uprobes BRK opcodes with ESR encoding  */
      #define BRK64_OPCODE_UPROBES	(AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5))
     +/* DTrace probes BRK opcodes with ESR encoding  */
    @@ arch/arm64/kernel/dtrace_util.c (new)
     +}
     
      ## arch/arm64/kernel/entry-common.c ##
    -@@ arch/arm64/kernel/entry-common.c: static void notrace el1_dbg(struct pt_regs *regs, unsigned long esr)
    +@@ arch/arm64/kernel/entry-common.c: static void noinstr el1_fpac(struct pt_regs *regs, unsigned long esr)
    + 	local_daif_mask();
    + 	exit_to_kernel_mode(regs);
      }
    - NOKPROBE_SYMBOL(el1_dbg);
    - 
    --asmlinkage void notrace el1_sync_handler(struct pt_regs *regs)
    -+asmlinkage int notrace el1_sync_handler(struct pt_regs *regs)
    +-
    +-asmlinkage void noinstr el1_sync_handler(struct pt_regs *regs)
    ++asmlinkage int noinstr el1_sync_handler(struct pt_regs *regs)
      {
      	unsigned long esr = read_sysreg(esr_el1);
      
    -@@ arch/arm64/kernel/entry-common.c: asmlinkage void notrace el1_sync_handler(struct pt_regs *regs)
    +@@ arch/arm64/kernel/entry-common.c: asmlinkage void noinstr el1_sync_handler(struct pt_regs *regs)
      	case ESR_ELx_EC_WATCHPT_CUR:
      	case ESR_ELx_EC_BRK64:
      		el1_dbg(regs, esr);
     -		break;
     +		return 1;
    + 	case ESR_ELx_EC_FPAC:
    + 		el1_fpac(regs, esr);
    + 		break;
      	default:
      		el1_inv(regs, esr);
      	}
     +	return 0;
      }
    - NOKPROBE_SYMBOL(el1_sync_handler);
      
    + asmlinkage void noinstr enter_from_user_mode(void)
     
      ## arch/arm64/kernel/entry.S ##
     @@
    @@ arch/arm64/kernel/entry.S
     +#include <asm/debug-monitors.h>
      
      /*
    -  * Context tracking subsystem.  Used to instrument transitions
    +  * Context tracking and irqflag tracing need to instrument transitions between
     @@ arch/arm64/kernel/entry.S: alternative_else_nop_endif
      	*/
      	.endm
    @@ scripts/dtrace_sdt_arm64.sh (new)
     +    objdump -ht ${lfn}
     +    objdump -tr ${ofn}
     +) | \
    -+    awk 'function subl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
    ++    gawk 'function subl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
     +	     tmp = $0;
     +	     if (length(v0) > 8) {
     +		 d = length(v0);
    @@ scripts/dtrace_sdt_arm64.sh (new)
     +	     next;
     +	 }' | \
     +    sort -u | \
    -+    awk 'function addl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
    ++    gawk 'function addl(v0, v1, v0h, v0l, v1h, v1l, d, tmp) {
     +	     tmp = $0;
     +	     if (length(v0) > 8 || length(v1) > 8) {
     +		 d = length(v0);
17:  231c240c25a3 ! 17:  bd4b479f60f2 dtrace: add SDT probes
    @@ fs/nfs/internal.h: static inline void nfs_set_port(struct sockaddr *sap, int *po
     +	if (DTRACE_IO_ENABLED(name)) {				\
     +		struct bio bio __maybe_unused = {		\
     +			.bi_opf = rw,				\
    -+			.bi_flags = (1 << BIO_USER_MAPPED),	\
     +			.bi_iter.bi_size = size,		\
     +			.bi_iter.bi_sector = NFS_FILEID(inode),	\
     +		};						\
    @@ fs/xfs/xfs_buf.c: static kmem_zone_t *xfs_buf_zone;
     +			  struct file * : fileinfo_t *, NULL);		\
     +	}
     +
    + static int __xfs_buf_submit(struct xfs_buf *bp, bool wait);
    + 
      static inline int
    - xfs_buf_is_vmapped(
    - 	struct xfs_buf	*bp)
     @@ fs/xfs/xfs_buf.c: static int
      xfs_buf_iowait(
      	struct xfs_buf	*bp)
    @@ kernel/fork.c
      #include <linux/dtrace_task_impl.h>
      
      #include <asm/pgalloc.h>
    -@@ kernel/fork.c: long _do_fork(struct kernel_clone_args *args)
    +@@ kernel/fork.c: pid_t kernel_clone(struct kernel_clone_args *args)
      	}
      
      	put_pid(pid);
    @@ kernel/sched/core.c: void set_user_nice(struct task_struct *p, long nice)
      		enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
      	if (running)
     @@ kernel/sched/core.c: static void do_sched_yield(void)
    - 	rq_unlock(rq, &rf);
    + 	rq_unlock_irq(rq, &rf);
      	sched_preempt_enable_no_resched();
      
     +	DTRACE_SCHED(surrender,
    @@ kernel/time/timer.c
      #include <linux/uaccess.h>
      #include <asm/unistd.h>
     @@ kernel/time/timer.c: void update_process_times(int user_tick)
    - {
      	struct task_struct *p = current;
      
    + 	PRANDOM_ADD_NOISE(jiffies, user_tick, p, 0);
     +	DTRACE_SCHED(tick, struct task_struct * : (lwpsinfo_t *, psinfo_t *),
     +		     p);
    -+
    + 
      	/* Note: this timer irq context must be accounted for as well. */
      	account_process_tick(p, user_tick);
    - 	run_local_timers();
     
      ## net/ipv4/ip_input.c ##
     @@
    @@ net/ipv4/ip_output.c: static int __ip_append_data(struct sock *sk,
      	skb = skb_peek_tail(queue);
      
     @@ net/ipv4/ip_output.c: static int __ip_append_data(struct sock *sk,
    - 	maxnonfragsize = ip_sk_ignore_df(sk) ? 0xFFFF : mtu;
    + 	maxnonfragsize = ip_sk_ignore_df(sk) ? IP_MAX_MTU : mtu;
      
      	if (cork->length + length > maxnonfragsize - fragheaderlen) {
     +		struct iphdr *iph __attribute__((unused)) = ip_hdr(skb);
    @@ net/ipv4/tcp_input.c: int tcp_rcv_state_process(struct sock *sk, struct sk_buff
      		sk->sk_state_change(sk);
      
     @@ net/ipv4/tcp_input.c: int tcp_conn_request(struct request_sock_ops *rsk_ops,
    - 		af_ops->send_synack(sk, dst, &fl, req, &foc,
      				    !want_cookie ? TCP_SYNACK_NORMAL :
    - 						   TCP_SYNACK_COOKIE);
    + 						   TCP_SYNACK_COOKIE,
    + 				    skb);
     +		/* Do not pass in tcp sock as ports/addresses are not yet
     +		 * populated - instead translators will fill them in from
     +		 * skb data.
    @@ net/ipv4/tcp_ipv4.c: static void tcp_v4_send_ack(const struct sock *sk,
      			      skb, &TCP_SKB_CB(skb)->header.h4.opt,
      			      ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
     @@ net/ipv4/tcp_ipv4.c: static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst,
    - 	if (skb) {
    - 		__tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);
    + 		    tcp_bpf_ca_needs_ecn((struct sock *)req))
    + 			tos |= INET_ECN_ECT_0;
      
     +		if (DTRACE_TCP_ENABLED(send)) {
     +			struct iphdr iph;
    @@ net/ipv6/ip6_output.c: int ip6_forward(struct sk_buff *skb)
      	}
      
     @@ net/ipv6/ip6_output.c: int ip6_forward(struct sk_buff *skb)
    - 	if (hdr->hop_limit <= 1) {
    - 		/* Force OUTPUT device used as source address */
    - 		skb->dev = dst->dev;
    -+
      		icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 0);
      		__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);
      
    @@ net/ipv6/tcp_ipv6.c: static int tcp_v6_send_synack(const struct sock *sk, struct
     +					   int, DTRACE_NET_PROBE_OUTBOUND);
     +		}
     +
    - 		err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt, np->tclass,
    - 			       sk->sk_priority);
    + 		err = ip6_xmit(sk, skb, fl6, sk->sk_mark, opt,
    + 			       tclass, sk->sk_priority);
      		rcu_read_unlock();
     @@ net/ipv6/tcp_ipv6.c: static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
      	dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL);
      	if (!IS_ERR(dst)) {
      		skb_dst_set(buff, dst);
    ++
     +		if (DTRACE_TCP_ENABLED(send) ||
     +		    DTRACE_TCP_ENABLED(accept__refused)) {
     +			struct ipv6hdr ip6h;
    @@ net/ipv6/tcp_ipv6.c: static void tcp_v6_send_response(const struct sock *sk, str
     +						   DTRACE_NET_PROBE_OUTBOUND);
     +		}
     +
    - 		ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, tclass,
    - 			 priority);
    + 		ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL,
    + 			 tclass & ~INET_ECN_MASK, priority);
      		TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
     @@ net/ipv6/tcp_ipv6.c: INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
      	const struct tcphdr *th;
18:  20d378e5ba7d = 18:  b17a33505728 dtrace: add sample script for building DTrace on Fedora
19:  c50a2647137b = 19:  e91c22eba927 locking: publicize mutex_owner and mutex_owned again
20:  19d11e414075 <  -:  ------------ dtrace, sdt: use gawk everywhere, not awk
21:  90487031ad45 <  -:  ------------ dtrace: move _sdt_probes array into a separately-compiled file
22:  3fa35bf340e2 <  -:  ------------ ctf: fix bashism



More information about the DTrace-devel mailing list