Skip to contentSkip to conversation

perf test: Fix perf probe testsuite

PATCH In review Namhyung Kim 3 participants 5 messages Nov 5 – Nov 6 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf test: Fix perf probe testsuite

The perf probe test suite fails on my machine. It seems it's because the kernel debug info is not available. Actually NO_DEBUGINFO is to check the condition and skip affected tests.

But it didn't work well as the skip_if_no_debuginfo function misses a new error string for v7.0+ kernels. Internally it uses the add_probe_vfs_getname() to check if perf probe handles debuginfo and check the error string. But it didn't add the new error string.

"Could not find probeable line"

With that added, it now passes like below:

  $ sudo perf test -vv 189
  Not taking turns using the perf mlock budget: nothing can exhaust it
  189: perftool-testsuite_probe:
  ---- start ----
  test child forked, pid 26135
  Probing warn_thunk_thunk
  -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding blacklisted function warn_thunk_thunk
  -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing blacklisted probe (should NOT be listed)
  ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission ::
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -a
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: --add
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf list
  -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added probe
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing removed probe (should NOT be listed)
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run :: adding probe
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: first probe adding
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (without force)
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (with force)
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes
  Regexp not found: "probe:vfs_mknod"
  Regexp not found: "probe:vfs_create"
  Regexp not found: "probe:vfs_rmdir"
  Regexp not found: "probe:vfs_link"
  Regexp not found: "probe:vfs_write"
  -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
  Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
  Regexp not found: "in this function|at this address"
  -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: add
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: record
  -- [ PASS ] -- perf_probe :: test_adding_kernel :: function argument probing :: script
  ## [ PASS ] ## perf_probe :: test_adding_kernel SUMMARY
  -- [ SKIP ] -- perf_probe :: test_basic :: help message :: testcase skipped
  -- [ PASS ] -- perf_probe :: test_basic :: usage message
  -- [ PASS ] -- perf_probe :: test_basic :: quiet switch
  ## [ PASS ] ## perf_probe :: test_basic SUMMARY
  -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -a
  -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -d
  -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -L
  -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -V
  -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -F
  -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -l
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -d xxx
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -L foo
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -V foo
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -l
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -F
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -L foo
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -V foo
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -l
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -F
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -l
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -F
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -l
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -F
  -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -l -F
  ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:10
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:0-10
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:2+10
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]:1
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1+1
  -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1-10
  -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:foo
  -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1-foo
  -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1+foo
  -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func;lazy\*pattern
  ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY
  ---- end(0) ----
  189: perftool-testsuite_probe                                                          : Ok
Fixes 92b664dcefab ("perf test probe_vfs_getname: Skip if no suitable line detected")
Cc Jakub Brnak <[email protected]>
Cc Michael Petlan <[email protected]>
---
 tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/lib/probe_vfs_getname.sh +1 -1
index 57a59ae7d4ae3d71..c091cd208beec056 100644
@@ -64,7 +64,7 @@ add_probe_vfs_getname() {
 }
 
 skip_if_no_debuginfo() {
-	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
+	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information|Could not find probeable line)" && return 2
 	return 1
 }
 
Signature · 1 line
2.56.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] perf test: skip_if_no_debuginfo() falsely skips tests when debuginfo is present --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf test: skip_if_no_debuginfo() falsely skips tests when debuginfo is present --

commit c8d75c8c4279c6a4cb8737397d31f026d6424692
Author: Namhyung Kim <[email protected]>

perf test: Fix perf probe testsuite

This commit updates skip_if_no_debuginfo() in tools/perf/tests/shell/lib/probe_vfs_getname.sh to match the "Could not find probeable line" message emitted by add_probe_vfs_getname() when checking whether kernel debuginfo is available.

tools/perf/tests/shell/lib/probe_vfs_getname.sh add_probe_vfs_getname() { · line 42

Quoted 10 lines
tools/perf/tests/shell/lib/probe_vfs_getname.sh +1 -1
index 88cd0e26d5f67..3a78f1d6eb165 100644
@@ -39,7 +39,7 @@ add_probe_vfs_getname() {
 }
 
 skip_if_no_debuginfo() {
-	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
+	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information|Could not find probeable line)" && return 2

[Severity: Medium]
Does matching "Could not find probeable line" here cause skip_if_no_debuginfo() to report missing debuginfo even when full kernel debuginfo is present?

In tools/perf/tests/shell/lib/probe_vfs_getname.sh, add_probe_vfs_getname() pipes stderr from perf probe -L getname_flags into grep when searching for source lines matching initname, result->uptr, or result->aname:

    result_initname_re="[[:space:]]+([[:digit:]]+)[[:space:]]+initname.*"
    line=$(perf probe -L getname_flags 2>&1 | grep -E "$result_initname_re" | sed -r "s/$result_initname_re/\1/")
    ...
    if [ -z "$line" ] ; then
            echo "Could not find probeable line"
            return 2
    fi

Because stderr from perf probe -L is filtered through grep, any actual debuginfo error message is discarded and add_probe_vfs_getname() prints "Could not find probeable line" whenever line is empty.

However, line is also empty on current kernels with full debuginfo and sources available because commit 9fa3ec84587c ("allow incomplete imports of filenames") moved initname(result) into do_getname(), leaving getname_flags() in fs/namei.c as a wrapper:

    struct filename *
    getname_flags(const char __user *filename, int flags)
    {
            return do_getname(filename, flags, false);
    }

It is also empty when compiler optimizations omit probeable line numbers in getname_flags() (which commit 92b664dcefab handled), or when vmlinux DWARF debuginfo is installed without kernel source files on disk.

When tools/perf/tests/shell/base_probe/test_adding_kernel.sh calls skip_if_no_debuginfo():

    skip_if_no_debuginfo
    if [ $? -eq 2 ]; then
            NO_DEBUGINFO=1
    fi

wouldn't this change cause NO_DEBUGINFO=1 to be set unconditionally on current kernels regardless of whether DWARF debuginfo is installed, skipping the DWARF testcases in test_adding_kernel.sh that do not depend on getname_flags()?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
reviewer
#2 lore raw
In reply to Namhyung Kim
Quoted 105 lines · Namhyung Kim

The perf probe test suite fails on my machine. It seems it's because the kernel debug info is not available. Actually NO_DEBUGINFO is to check the condition and skip affected tests.

But it didn't work well as the skip_if_no_debuginfo function misses a new error string for v7.0+ kernels. Internally it uses the add_probe_vfs_getname() to check if perf probe handles debuginfo and check the error string. But it didn't add the new error string.

"Could not find probeable line"

With that added, it now passes like below:

   $ sudo perf test -vv 189
   Not taking turns using the perf mlock budget: nothing can exhaust it
   189: perftool-testsuite_probe:
   ---- start ----
   test child forked, pid 26135
   Probing warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding blacklisted function warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing blacklisted probe (should NOT be listed)
   ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission ::
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -a
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: --add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf list
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing removed probe (should NOT be listed)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run :: adding probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: first probe adding
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (without force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (with force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes
   Regexp not found: "probe:vfs_mknod"
   Regexp not found: "probe:vfs_create"
   Regexp not found: "probe:vfs_rmdir"
   Regexp not found: "probe:vfs_link"
   Regexp not found: "probe:vfs_write"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
   Regexp not found: "in this function|at this address"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: record
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function argument probing :: script
   ## [ PASS ] ## perf_probe :: test_adding_kernel SUMMARY
   -- [ SKIP ] -- perf_probe :: test_basic :: help message :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_basic :: usage message
   -- [ PASS ] -- perf_probe :: test_basic :: quiet switch
   ## [ PASS ] ## perf_probe :: test_basic SUMMARY
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -a
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -d
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -L
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -V
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -d xxx
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -l -F
   ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:0-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:2+10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1+1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1-foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1+foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func;lazy\*pattern
   ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY
   ---- end(0) ----
   189: perftool-testsuite_probe                                                          : Ok
Fixes 92b664dcefab ("perf test probe_vfs_getname: Skip if no suitable line detected")
Cc Jakub Brnak <[email protected]>
Cc Michael Petlan <[email protected]>
---
  tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/lib/probe_vfs_getname.sh +0 -0
index 57a59ae7d4ae3d71..c091cd208beec056 100644

tools/perf/tests/shell/lib/probe_vfs_getname.sh add_probe_vfs_getname() { · line 70

Quoted 8 lines
tools/perf/tests/shell/lib/probe_vfs_getname.sh +1 -1
@@ -64,7 +64,7 @@ add_probe_vfs_getname() {
  }
 
  skip_if_no_debuginfo() {
-	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
+	add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information|Could not find probeable line)" && return 2
  	return 1
  }
 

I was just about to send a fix for the same thing, but I had something slightly different. I think adding "Could not find probeable line" allows for false skips in the future even when debug symbols are present, like when that function was re-worked other times. And that seems to be what Sashiko mentions as well.

If you just try to do a dry run probe of getname_flags() which has always existed, then its a pretty stable equivalent for whether debug info exists or not:

perf probe -n -v 'getname_flags $params' 2>&1 | grep -E -q "^(Failed
to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2

reviewer
#3 lore raw
Quoted 119 lines · James Clark
Quoted 108 lines · Namhyung Kim

The perf probe test suite fails on my machine.  It seems it's because the kernel debug info is not available.  Actually NO_DEBUGINFO is to check the condition and skip affected tests.

But it didn't work well as the skip_if_no_debuginfo function misses a new error string for v7.0+ kernels.  Internally it uses the add_probe_vfs_getname() to check if perf probe handles debuginfo and check the error string.  But it didn't add the new error string.

   "Could not find probeable line"

With that added, it now passes like below:

   $ sudo perf test -vv 189
   Not taking turns using the perf mlock budget: nothing can exhaust it
   189: perftool-testsuite_probe:
   ---- start ----
   test child forked, pid 26135
   Probing warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding blacklisted function warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing blacklisted probe (should NOT be listed)
   ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission ::
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -a
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: --add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf list
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing removed probe (should NOT be listed)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run :: adding probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: first probe adding
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (without force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (with force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes
   Regexp not found: "probe:vfs_mknod"
   Regexp not found: "probe:vfs_create"
   Regexp not found: "probe:vfs_rmdir"
   Regexp not found: "probe:vfs_link"
   Regexp not found: "probe:vfs_write"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
   Regexp not found: "in this function|at this address"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: record
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function argument probing :: script
   ## [ PASS ] ## perf_probe :: test_adding_kernel SUMMARY
   -- [ SKIP ] -- perf_probe :: test_basic :: help message :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_basic :: usage message
   -- [ PASS ] -- perf_probe :: test_basic :: quiet switch
   ## [ PASS ] ## perf_probe :: test_basic SUMMARY
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -a
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -d
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -L
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -V
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -d xxx
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -l -F
   ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:0-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:2+10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: [email protected]:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1+1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1-foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1+foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func;lazy\*pattern
   ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY
   ---- end(0) ----
   189: perftool- testsuite_probe                                                          : Ok
Fixes 92b664dcefab ("perf test probe_vfs_getname: Skip if no suitable line detected")
Cc Jakub Brnak <[email protected]>
Cc Michael Petlan <[email protected]>

---
  tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/lib/probe_vfs_getname.sh +0 -1
index 57a59ae7d4ae3d71..c091cd208beec056 100644
@@ -64,7 +64,7 @@ add_probe_vfs_getname() {
   }
   skip_if_no_debuginfo() {
-    add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the 
Quoted 5 lines

path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
+    add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the
path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information|Could not find probeable line)" && return 2 return 1
  }

I was just about to send a fix for the same thing, but I had something slightly different. I think adding "Could not find probeable line" allows for false skips in the future even when debug symbols are present, like when that function was re-worked other times. And that seems to be what Sashiko mentions as well.

Quoted 5 lines

If you just try to do a dry run probe of getname_flags() which has always existed, then its a pretty stable equivalent for whether debug info exists or not:

  perf probe -n -v 'getname_flags $params' 2>&1 | grep -E -q "^(Failed
to find the path for the kernel|Debuginfo-analysis is not supported)| (file has no debug information)" && return 2

I included it here: https://lore.kernel.org/linux-perf-users/[email protected]/T/#t

author maintainer
#4 lore raw

Hello James,

Quoted 191 lines · James Clark
Quoted 188 lines · James Clark
Quoted 167 lines · Namhyung Kim

The perf probe test suite fails on my machine.  It seems it's because the kernel debug info is not available.  Actually NO_DEBUGINFO is to check the condition and skip affected tests.

But it didn't work well as the skip_if_no_debuginfo function misses a new error string for v7.0+ kernels.  Internally it uses the add_probe_vfs_getname() to check if perf probe handles debuginfo and check the error string.  But it didn't add the new error string.

   "Could not find probeable line"

With that added, it now passes like below:

   $ sudo perf test -vv 189
   Not taking turns using the perf mlock budget: nothing can exhaust it
   189: perftool-testsuite_probe:
   ---- start ----
   test child forked, pid 26135
   Probing warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding
blacklisted function warn_thunk_thunk
   -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing
blacklisted probe (should NOT be listed)
   ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe
inode_permission ::
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe
inode_permission :: -a
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe
inode_permission :: --add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added
probe :: perf list
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped
due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added
probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing
removed probe (should NOT be listed)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run ::
adding probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding
probes :: first probe adding
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding
probes :: second probe adding (without force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding
probes :: second probe adding (with force)
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing
multiple probes
   Regexp not found: "probe:vfs_mknod"
   Regexp not found: "probe:vfs_create"
   Regexp not found: "probe:vfs_rmdir"
   Regexp not found: "probe:vfs_link"
   Regexp not found: "probe:vfs_write"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped
due to missing debuginfo :: testcase skipped
   Regexp not found:
"somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
   Regexp not found: "in this function|at this address"
   -- [ SKIP ] -- perf_probe :: test_adding_kernel :: 1 1 Skipped
due to missing debuginfo :: testcase skipped
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with
retval :: add
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with
retval :: record
   -- [ PASS ] -- perf_probe :: test_adding_kernel :: function
argument probing :: script
   ## [ PASS ] ## perf_probe :: test_adding_kernel SUMMARY
   -- [ SKIP ] -- perf_probe :: test_basic :: help message ::
testcase skipped
   -- [ PASS ] -- perf_probe :: test_basic :: usage message
   -- [ PASS ] -- perf_probe :: test_basic :: quiet switch
   ## [ PASS ] ## perf_probe :: test_basic SUMMARY
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing
argument for -a
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing
argument for -d
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing
argument for -L
   -- [ PASS ] -- perf_probe :: test_invalid_options :: missing
argument for -V
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary
argument for -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary
argument for -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -a xxx -d xxx
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -a xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -a xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -a xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -a xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -d xxx -L foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -d xxx -V foo
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -d xxx -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -d xxx -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -L foo -V bar
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -L foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -L foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -V foo -l
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -V foo -F
   -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually
exclusive options :: -l -F
   ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: func
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: func:10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: func:0-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: func:2+10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: [email protected]
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: [email protected]:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: source.c:1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: source.c:1+1
   -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable
descriptions :: source.c:1-10
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable
descriptions :: func:foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable
descriptions :: func:1-foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable
descriptions :: func:1+foo
   -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable
descriptions :: func;lazy\*pattern
   ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY
   ---- end(0) ----
   189: perftool-
testsuite_probe                                                         
: Ok
Fixes 92b664dcefab ("perf test probe_vfs_getname: Skip if no

suitable line detected")

Cc Jakub Brnak <[email protected]>
Cc Michael Petlan <[email protected]>

---
  tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/tools/ perf/tests/shell/lib/probe_vfs_getname.sh index 57a59ae7d4ae3d71..c091cd208beec056 100644

tools/perf/tests/shell/lib/probe_vfs_getname.sh +0 -1
@@ -64,7 +64,7 @@ add_probe_vfs_getname() {
   }
   skip_if_no_debuginfo() {
-    add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find
Quoted 7 lines

the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
+    add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information|Could not find probeable line)" && return 2 return 1
  }

I was just about to send a fix for the same thing, but I had something slightly different. I think adding "Could not find probeable line" allows for false skips in the future even when debug symbols are present, like when that function was re-worked other times. And that seems to be what Sashiko mentions as well.

If you just try to do a dry run probe of getname_flags() which has always existed, then its a pretty stable equivalent for whether debug info exists or not:

Quoted 6 lines
Quoted 4 lines

  perf probe -n -v 'getname_flags $params' 2>&1 | grep -E -q "^(Failed
to find the path for the kernel|Debuginfo-analysis is not supported)| (file has no debug information)" && return 2

I included it here: https://lore.kernel.org/linux-perf-users/[email protected]/T/#t

Thanks, looks good.
Namhyung