From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.142]) by sourceware.org (Postfix) with ESMTPS id D4F613858D28 for ; Thu, 16 Dec 2021 17:39:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D4F613858D28 Received: (wp-smtpd smtp.tlen.pl 7942 invoked from network); 16 Dec 2021 18:38:57 +0100 Received: from public-gprs410873.centertel.pl (HELO localhost) (vibrys@o2.pl@[37.47.236.58]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 16 Dec 2021 18:38:57 +0100 References: User-agent: mu4e 1.4.13; emacs 27.2 From: Matt Vibrys To: systemtap@sourceware.org Subject: Re: non-working .return probepoint from modules In-reply-to: Message-ID: Date: Thu, 16 Dec 2021 18:38:56 +0100 MIME-Version: 1.0 Content-Type: text/plain X-WP-MailID: 23151eb8589bb8ca47c13c4fc8afb200 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [4bNU] X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_LOTSOFHASH, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Dec 2021 17:39:05 -0000 Matt Vibrys via Systemtap writes: > Hi Systemtap Team > > my drm.stp script looks like following: > #+begin_src systemtap > probe module("mymod").function("mymod_getparam_ioctl") > { > printf("-->. %s %s %s\n", thread_indent(0), ppfunc(), $$parms); > } > > probe module("mymod").function("mymod_getparam_ioctl").return > { > printf("<--\n"); > } > #+end_src > > roughly it traces call/return of ~mymod_getparam_ioctl~ symbol. > > The symbol is non-static one: > #+begin_src C > int mymod_getparam_ioctl(struct drm_device *dev, void *data, > struct drm_file *file_priv); > #+end_src > > used like: > #+begin_src C > DRM_IOCTL_DEF_DRV(MYMOD_GET_PARAMETER, mymod_getparam_ioctl, 0), > #+end_src > > symbol is defined within module: > #+begin_src bash > gmm@MY-HOST:~/user$ nm /lib/modules/5.13.0-22-generic/extra/mymod.ko | grep mymod_getparam_ioctl > 0000000000001010 T mymod_getparam_ioctl > #+end_src > > > The output below provides function calls, but it's silent about it's returns. Why so?: > #+begin_quote > gmm@MY-HOST:~/user$ sudo /opt/systemtap-4.6/bin/stap -vv /home/gmm/user/scripts/drm.stp > Systemtap translator/driver (version 4.6/0.176, non-git sources) > Copyright (C) 2005-2021 Red Hat, Inc. and others > This is free software; see the source for copying conditions. > tested kernel versions: 2.6.32 ... 5.15.0-rc7 > enabled features: BPF PYTHON3 LIBVIRT LIBXML2 NLS > Created temporary directory "/tmp/stapCRebKu" > Session arch: x86_64 release: 5.13.0-22-generic > Build tree: "/lib/modules/5.13.0-22-generic/build" > Kernel symbol table /lib/modules/5.13.0-22-generic/build/System.map unavailable, (No such file or directory) > Searched for library macro files: "/opt/systemtap-4.6/share/systemtap/tapset/linux", found: 7, processed: 7 > Searched for library macro files: "/opt/systemtap-4.6/share/systemtap/tapset", found: 11, processed: 11 > Searched: "/opt/systemtap-4.6/share/systemtap/tapset/linux/x86_64", found: 20, processed: 20 > Searched: "/opt/systemtap-4.6/share/systemtap/tapset/linux", found: 407, processed: 407 > Searched: "/opt/systemtap-4.6/share/systemtap/tapset/x86_64", found: 1, processed: 1 > Searched: "/opt/systemtap-4.6/share/systemtap/tapset", found: 34, processed: 34 > Pass 1: parsed user script and 480 library scripts using 121144virt/100392res/6124shr/94364data kb, in 100usr/10sys/113real ms. > derive-probes (location #0): module("mymod").function("mymod_getparam_ioctl") of keyword at /home/gmm/user/scripts/drm.stp:6:1 > probe mymod_getparam_ioctl@/home/gmm/user/git/char-misc-mymod/drivers/gpu/drm/mymod/ioctl.c:142 module=mymod reloc=.text pc=0x11070 > derive-probes (location #0): module("mymod").function("mymod_getparam_ioctl").return of keyword at /home/gmm/user/scripts/drm.stp:11:1 > probe mymod_getparam_ioctl@/home/gmm/user/git/char-misc-mymod/drivers/gpu/drm/mymod/ioctl.c:142 module=mymod reloc=.text pc=0x11070 > Pass 2: analyzed script: 2 probes, 12 functions, 1 embed, 2 globals using 123568virt/103804res/7068shr/96788data kb, in 10usr/10sys/22real ms. > function recursion-analysis: max-nesting 4 non-recursive > probe 0 ('module("mymod").function("mymod_getparam_ioctl@/home/gmm/user/git/char-misc-mymod/drivers/gpu/drm/mymod/ioctl.c:142")') locks __private__opt_systemtap_4_6_share_systemtap_tapset_indent_stp__indent_counters[rw] __private__opt_systemtap_4_6_share_systemtap_tapset_indent_stp__indent_timestamps[rw] > 5 statements for probe probe_6335 > probe 1 ('module("mymod").function("mymod_getparam_ioctl@/home/gmm/user/git/char-misc-mymod/drivers/gpu/drm/mymod/ioctl.c:142").return') locks nothing > 1 statements for probe probe_6337 > dump_unwindsyms mymod index=0 base=0x10000 > Found build-id in mymod, length 20, start at 0x10 > Pass 3: translated to C into "/tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617_src.c" using 123568virt/103944res/7208shr/96788data kb, in 10usr/0sys/8real ms. > Pass 4: using cached /root/.systemtap/cache/14/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h > Running env -uARCH -uKBUILD_EXTMOD -uCROSS_COMPILE -uKBUILD_IMAGE -uKCONFIG_CONFIG -uINSTALL_PATH -uLD_LIBRARY_PATH PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin make -C /lib/modules/5.13.0-22-generic/build M=/tmp/stapCRebKu modules CONFIG_DEBUG_INFO= CONFIG_DEBUG_INFO_BTF_MODULES= ARCH=x86_64 --no-print-directory -j21 > CC [M] /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617_src.o > CC [M] /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617_aux_0.o > CC [M] /tmp/stapCRebKu/stap_symbols.o > LD [M] /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.o > MODPOST /tmp/stapCRebKu/Module.symvers > CC [M] /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.mod.o > LD [M] /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko > Spawn waitpid result (0x0): 0 > Pass 4: compiled C into "stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko" in 1680usr/400sys/2072real ms. > Cleaning cache, interval reached 9711 s > 300 s. > Copying /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko to /root/.systemtap/cache/b4/stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko > Copying /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617_src.c to /root/.systemtap/cache/b4/stap_b4ca169e028eeab49ab6872384de1d4f_4617.c > Copying /tmp/stapCRebKu/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h to /root/.systemtap/cache/14/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h > Pass 5: starting run. > Running /opt/systemtap-4.6/bin/staprun -v -R /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko > staprun:insert_module:191 Module stap_b4ca169e028eeab49ab6872384de1d4f_3902 inserted from file /tmp/stapCRebKu/stap_b4ca169e028eeab49ab6872384de1d4f_4617.ko > -->. 0 mymod-test(3936): mymod_getparam_ioctl dev=0xffff9942117f5000 data=0xffffa452047dfd48 file_priv=0xffff994209352a00 > -->. 0 mymod-test(3936): mymod_getparam_ioctl dev=0xffff9942117f5000 data=0xffffa452047dfd48 file_priv=0xffff994209352a00 > -->. 0 mymod-test(3936): mymod_getparam_ioctl dev=0xffff9942117f5000 data=0xffffa452047dfe18 file_priv=0xffff994209352a00 > -->. 0 mymod-test(3936): mymod_getparam_ioctl dev=0xffff9942117f5000 data=0xffffa452047dfdf8 file_priv=0xffff994209352a00 > -->. 0 mymod-test(3936): mymod_getparam_ioctl dev=0xffff9942117f5000 data=0xffffa452047dfdf8 file_priv=0xffff994209352a00 > C-c C-cstapio:cleanup_and_exit:352 detach=0 > stapio:cleanup_and_exit:369 closing control channel > staprun:remove_module:292 Module stap_b4ca169e028eeab49ab6872384de1d4f_3902 removed. > Spawn waitpid result (0x0): 0 > Pass 5: run completed in 0usr/160sys/463082real ms. > Running rm -rf /tmp/stapCRebKu > Spawn waitpid result (0x0): 0 > Removed temporary directory "/tmp/stapCRebKu" > #+end_quote > > > some info about config: > prompt$ cat /etc/os-release > NAME="Ubuntu" > VERSION="20.04.1 LTS (Focal Fossa)" > ID=ubuntu > > > systemtap is compiled from sources: > prompt$ /opt/systemtap-4.6/bin/stap --version > Systemtap translator/driver (version 4.6/0.176, non-git sources) > Copyright (C) 2005-2021 Red Hat, Inc. and others > This is free software; see the source for copying conditions. > tested kernel versions: 2.6.32 ... 5.15.0-rc7 > enabled features: BPF PYTHON3 LIBVIRT LIBXML2 NLS > > prompt$ uname -a > Linux MY-HOST 5.13.0-22-generic #22~20.04.1-Ubuntu SMP Tue Nov 9 15:07:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux > > > prompt$ dpkg --list | grep kernel | grep 5.13 > ii linux-headers-5.13.0-22-generic 5.13.0-22.22~20.04.1 amd64 Linux kernel headers for version 5.13.0 on 64 bit x86 SMP > ii linux-hwe-5.13-headers-5.13.0-22 5.13.0-22.22~20.04.1 all Header files related to Linux kernel version 5.13.0 > ii linux-image-5.13.0-22-generic-dbgsym 5.13.0-22.22~20.04.1 amd64 Signed kernel image generic > ii linux-image-unsigned-5.13.0-22-generic 5.13.0-22.22~20.04.1 amd64 Linux kernel image for version 5.13.0 on 64 bit x86 SMP > ii linux-image-unsigned-5.13.0-22-generic-dbgsym 5.13.0-22.22~20.04.1 amd64 Linux kernel debug image for version 5.13.0 on 64 bit x86 SMP > ii linux-modules-5.13.0-22-generic 5.13.0-22.22~20.04.1 amd64 Linux kernel extra modules for version 5.13.0 on 64 bit x86 SMP > ii linux-modules-extra-5.13.0-22-generic 5.13.0-22.22~20.04.1 amd64 Linux kernel extra modules for version 5.13.0 on 64 bit x86 SMP > > > prompt$ apt-cache show linux-image-unsigned-5.13.0-22-generic > Package: linux-image-unsigned-5.13.0-22-generic > Architecture: amd64 > Version: 5.13.0-22.22~20.04.1 > Priority: optional > Section: kernel > Source: linux-hwe-5.13 > Origin: Ubuntu > Maintainer: Ubuntu Kernel Team > Bugs: https://bugs.launchpad.net/ubuntu/+filebug > Installed-Size: 10132 > Provides: aufs-dkms, fuse-module, ivtv-modules, kvm-api-4, linux-image, redhat-cluster-modules, spl-dkms, spl-modules, virtualbox-guest-modules, zfs-dkms, zfs-modules > Depends: kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.13.0-22-generic > Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub | lilo, initramfs-tools | linux-initramfs-tool > Suggests: fdutils, linux-doc | linux-hwe-5.13-source-5.13.0, linux-hwe-5.13-tools, linux-headers-5.13.0-22-generic, linux-modules-extra-5.13.0-22-generic > Conflicts: linux-image-5.13.0-22-generic > Filename: pool/main/l/linux-hwe-5.13/linux-image-unsigned-5.13.0-22-generic_5.13.0-22.22~20.04.1_amd64.deb > Size: 10039156 > MD5sum: eea929b583136567362a8439e976bcad > SHA1: 890c47a0a351dfa5b0cb024a1ff174735ab909c1 > SHA256: 0bd9e89d9fd063b26f6aba7bba02311411f90826f71080fc31674dfd1b996739 > SHA512: 5e1e33075767261d45b1219e3d2d6eb2388ed24cd06eda86f3c7fcb3a9519407a8b79721c77a00ac6a63293c16bb02265aea78f41686a69b41a2a0fb6f01a237 > Description-en: Linux kernel image for version 5.13.0 on 64 bit x86 SMP > This package contains the unsigned Linux kernel image for version 5.13.0 on > 64 bit x86 SMP. > . > Supports Generic processors. > . > Geared toward desktop and server systems. > . > You likely do not want to install this package directly. Instead, install > the linux-generic meta-package, which will ensure that upgrades work > correctly, and that supporting packages are also installed. > Description-md5: 467b5f7a4ed1e24f7128afd6453df516 > > what am I missing? > > regards, > Matt For better insight I've used drm module drm_ioctl function instead. The problem persists, ie .return "locks nothing": #+begin_src systemtap probe module("drm").function("drm_ioctl") { printf("-->. %s %s %s\n", thread_indent(0), ppfunc(), $$parms); } probe module("drm").function("drm_ioctl").return { printf("<--\n"); } #+end_src result: #+begin_src bash prompt$ sudo /opt/systemtap-4.6/bin/stap -vv ~/user/scripts/drm.stp Systemtap translator/driver (version 4.6/0.176, non-git sources) Copyright (C) 2005-2021 Red Hat, Inc. and others This is free software; see the source for copying conditions. tested kernel versions: 2.6.32 ... 5.15.0-rc7 enabled features: BPF PYTHON3 LIBVIRT LIBXML2 NLS Created temporary directory "/tmp/stapYIXn3K" Session arch: x86_64 release: 5.13.0-22-generic Build tree: "/lib/modules/5.13.0-22-generic/build" Kernel symbol table /lib/modules/5.13.0-22-generic/build/System.map unavailable, (No such file or directory) Searched for library macro files: "/opt/systemtap-4.6/share/systemtap/tapset/linux", found: 7, processed: 7 Searched for library macro files: "/opt/systemtap-4.6/share/systemtap/tapset", found: 11, processed: 11 Searched: "/opt/systemtap-4.6/share/systemtap/tapset/linux/x86_64", found: 20, processed: 20 Searched: "/opt/systemtap-4.6/share/systemtap/tapset/linux", found: 407, processed: 407 Searched: "/opt/systemtap-4.6/share/systemtap/tapset/x86_64", found: 1, processed: 1 Searched: "/opt/systemtap-4.6/share/systemtap/tapset", found: 34, processed: 34 Pass 1: parsed user script and 480 library scripts using 121152virt/100400res/6124shr/94372data kb, in 90usr/20sys/113real ms. derive-probes (location #0): module("drm").function("drm_ioctl") of keyword at /home/gmm/user/scripts/drm.stp:16:1 probe drm_ioctl@/build/linux-hwe-5.13-ADyN9x/linux-hwe-5.13-5.13.0/drivers/gpu/drm/drm_ioctl.c:811 module=drm reloc=.text pc=0x143b0 derive-probes (location #0): module("drm").function("drm_ioctl").return of keyword at /home/gmm/user/scripts/drm.stp:21:1 probe drm_ioctl@/build/linux-hwe-5.13-ADyN9x/linux-hwe-5.13-5.13.0/drivers/gpu/drm/drm_ioctl.c:811 module=drm reloc=.text pc=0x143b0 Pass 2: analyzed script: 2 probes, 12 functions, 1 embed, 2 globals using 124920virt/105184res/7108shr/98140data kb, in 130usr/10sys/159real ms. function recursion-analysis: max-nesting 4 non-recursive probe 0 ('module("drm").function("drm_ioctl@/build/linux-hwe-5.13-ADyN9x/linux-hwe-5.13-5.13.0/drivers/gpu/drm/drm_ioctl.c:811")') locks __private__opt_systemtap_4_6_share_systemtap_tapset_indent_stp__indent_counters[rw] __private__opt_systemtap_4_6_share_systemtap_tapset_indent_stp__indent_timestamps[rw] 5 statements for probe probe_6335 probe 1 ('module("drm").function("drm_ioctl@/build/linux-hwe-5.13-ADyN9x/linux-hwe-5.13-5.13.0/drivers/gpu/drm/drm_ioctl.c:811").return') locks nothing 1 statements for probe probe_6337 dump_unwindsyms drm index=0 base=0x10000 Found build-id in drm, length 20, start at 0x10 Pass 3: translated to C into "/tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630_src.c" using 124920virt/105312res/7236shr/98140data kb, in 110usr/10sys/118real ms. Pass 4: using cached /root/.systemtap/cache/14/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h Running env -uARCH -uKBUILD_EXTMOD -uCROSS_COMPILE -uKBUILD_IMAGE -uKCONFIG_CONFIG -uINSTALL_PATH -uLD_LIBRARY_PATH PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin make -C /lib/modules/5.13.0-22-generic/build M=/tmp/stapYIXn3K modules CONFIG_DEBUG_INFO= CONFIG_DEBUG_INFO_BTF_MODULES= ARCH=x86_64 --no-print-directory -j21 CC [M] /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630_src.o CC [M] /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630_aux_0.o CC [M] /tmp/stapYIXn3K/stap_symbols.o LD [M] /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.o MODPOST /tmp/stapYIXn3K/Module.symvers CC [M] /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.mod.o LD [M] /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.ko Spawn waitpid result (0x0): 0 Pass 4: compiled C into "stap_27791b5d9addbd4c9df8f411264ee992_4630.ko" in 1420usr/380sys/1689real ms. Cleaning cache, interval reached 8726 s > 300 s. Copying /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.ko to /root/.systemtap/cache/27/stap_27791b5d9addbd4c9df8f411264ee992_4630.ko Copying /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630_src.c to /root/.systemtap/cache/27/stap_27791b5d9addbd4c9df8f411264ee992_4630.c Copying /tmp/stapYIXn3K/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h to /root/.systemtap/cache/14/stapconf_14af95633f25eea4f38d1eb6ef710bb1_799.h Pass 5: starting run. Running /opt/systemtap-4.6/bin/staprun -v -R /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.ko staprun:insert_module:191 Module stap_27791b5d9addbd4c9df8f411264ee992_8956 inserted from file /tmp/stapYIXn3K/stap_27791b5d9addbd4c9df8f411264ee992_4630.ko -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0406400 arg=0x25c4740 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0406400 arg=0x25c4740 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0106401 arg=0x7ffdad907b70 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0106401 arg=0x7ffdad907b70 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0086441 arg=0x25c4898 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0086441 arg=0x25c4818 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0086441 arg=0x25c4858 -->. 0 myapp-test(9005): drm_ioctl filp=0xffff994270c00200 cmd=0xc0086441 arg=0x25c47d8 C-c C-cstapio:cleanup_and_exit:352 detach=0 stapio:cleanup_and_exit:369 closing control channel staprun:remove_module:292 Module stap_27791b5d9addbd4c9df8f411264ee992_8956 removed. Spawn waitpid result (0x0): 0 Pass 5: run completed in 20usr/110sys/207272real ms. Running rm -rf /tmp/stapYIXn3K Spawn waitpid result (0x0): 0 Removed temporary directory "/tmp/stapYIXn3K" #+end_src