Bug 207587

Summary: perf fails to parse event name it generated
Product: Tracing/Profiling Reporter: yshuiv7
Component: Perf toolAssignee: Arnaldo Carvalho de Melo (acme)
Status: ASSIGNED ---    
Severity: normal CC: irogers, jolsa
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.7-rc4 Subsystem:
Regression: No Bisected commit-id:

Description yshuiv7 2020-05-05 16:11:21 UTC
to reproduce:

1. # sudo perf probe 'ext4_bmap%return $retval'
2. # sudo perf probe -l

error:

Semantic error :Failed to parse event name: r64:probe/ext4_bmap__return
  Error: Failed to show event list.
Comment 1 Arnaldo Carvalho de Melo 2020-05-05 16:24:03 UTC
[root@five ~]# perf -vv
perf version 5.7.rc2.g31701c81b27b
                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                 glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
                  gtk2: [ on  ]  # HAVE_GTK2_SUPPORT
         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                   aio: [ on  ]  # HAVE_AIO_SUPPORT
                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
[root@five ~]# perf probe -l
[root@five ~]# perf probe 'ext4_bmap%return $retval'
Added new event:
  probe:ext4_bmap__return (on ext4_bmap%return with $retval)

You can now use it in all perf tools, such as:

	perf record -e probe:ext4_bmap__return -aR sleep 1

[root@five ~]# perf probe -l
  probe:ext4_bmap__return (on ext4_bmap%return@fs/ext4/inode.c with arg1)
[root@five ~]# perf trace -e probe:ext4_bmap__return --max-events 1
     0.000 jbd2/dm-2-8/1090 probe:ext4_bmap__return(__probe_func: -1237405728, __probe_ret_ip: -1237086525, arg1: 19461697)
[root@five ~]# perf trace -e probe:ext4_bmap__return/max-stack=32/ --max-events 1
     0.000 jbd2/dm-2-8/1090 probe:ext4_bmap__return(__probe_func: -1237405728, __probe_ret_ip: -1237086525, arg1: 19461771)
                                       kretprobe_trampoline ([kernel.kallsyms])
[root@five ~]#

Masami, the only problem I see there is that the backtrace stops at kretprobe_trampoline :-\

Also he reported it in 5.7-rc4 which is after what I have now in perf/core, so perhaps something that I'll be able to reproduce after I merge that, also here the kernel is:

[acme@five perf]$ uname -a
Linux five 5.5.17-200.fc31.x86_64 #1 SMP Mon Apr 13 15:29:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Comment 2 yshuiv7 2020-05-05 17:54:58 UTC
For some reason kernel started using 'r64:' as prefix for return probes, and perf doesn't like that.

> the only problem I see there is that the backtrace stops at
> kretprobe_trampoline :-\

Yeah, I noticed that as well, and assumed that's just how things are.