All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test shell: Fix check open filename arg using 'perf trace'
@ 2017-11-29 17:27 Michael Petlan
  2017-11-30 10:28 ` Thomas-Mich Richter
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Petlan @ 2017-11-29 17:27 UTC (permalink / raw)
  To: linux-perf-users; +Cc: Jiri Olsa, Arnaldo de Melo

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

Hi Arnaldo, Jiri and others!

Posting a fix for perf test "Check open filename arg using perf trace + vfs_getname".

The commit f231af789b11a2f1a3795acc3228a3e178a80c21 adds an exception for s390x to
use openat() syscall instead of open(). This exception is not s390x-only, thus I
adjusted the test to accept both open and openat syscalls, no matter which arch it
runs on. Does it sound reasonable to you?


When testing on 4.15.0-rc1, I also hit the following issue:

# perf probe "vfs_getname=getname_flags:72 pathname=result->name:string"
Failed to find 'result' in this function.
  Error: Failed to add events.

# perf probe -L getname_flags 
[...]
     72         result->uptr = filename;
     73         result->aname = NULL;
[...]

# perf probe "vfs_getname=getname_flags:72 pathname=result->uptr:string"
Failed to find 'result' in this function.
  Error: Failed to add events.

... When the probed var is changed to "filename", it seems to work:

# perf probe "vfs_getname=getname_flags:72 pathname=filename:string"
Added new event:
  probe:vfs_getname    (on getname_flags:72 with pathname=filename:string)

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

	perf record -e probe:vfs_getname -aR sleep 1


So maybe the second attached patch is necessary too, not sure. Just thinking
that "filename" might be less change-prone, as a func. arg... ?

Thank you.

Cheers,
Michael

[-- Attachment #2: Type: text/plain, Size: 1675 bytes --]

commit 526f2201254f8da750e722b893af19b7d4f2640d
Author: Michael Petlan <mpetlan@redhat.com>
Date:   Tue Nov 28 17:47:49 2017 +0100

    perf test shell: Fix check open filename arg using 'perf trace'
    
    The following commit added an exception for s390x to use openat()
    instead of open() in the test:
    
    commit f231af789b11a2f1a3795acc3228a3e178a80c21
    Author: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Date:   Tue Nov 14 08:18:46 2017 +0100
    
    Since the problem is not s390x-specific, this patch makes it more
    generic, so the test handles both open() and openat() no matter
    which architecture it is running on.
    
    Signed-off-by: Michael Petlan <mpetlan@redhat.com>

diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
index 2a9ef08..33212da 100755
--- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
@@ -17,10 +17,8 @@ skip_if_no_perf_probe || exit 2
 file=$(mktemp /tmp/temporary_file.XXXXX)
 
 trace_open_vfs_getname() {
-	test "$(uname -m)" = s390x && { svc="openat"; txt="dfd: +CWD, +"; }
-
-	perf trace -e ${svc:-open} touch $file 2>&1 | \
-	egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ ${svc:-open}\(${txt}filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
+	perf trace -e 'open*' touch $file 2>&1 | \
+	egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
 }
 
 

[-- Attachment #3: Type: text/plain, Size: 691 bytes --]

diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
index 30a950c..3759582 100644
--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
@@ -13,7 +13,7 @@ add_probe_vfs_getname() {
 	local verbose=$1
 	if [ $had_vfs_getname -eq 1 ] ; then
 		line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
-		perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
+		perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string"
 	fi
 }
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-12-07  7:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 17:27 [PATCH] perf test shell: Fix check open filename arg using 'perf trace' Michael Petlan
2017-11-30 10:28 ` Thomas-Mich Richter
2017-11-30 15:56   ` Arnaldo de Melo
2017-11-30 15:59     ` Arnaldo de Melo
2017-12-05 15:39       ` Hendrik Brueckner
2017-12-06 16:34         ` Arnaldo Carvalho de Melo
2017-12-07  7:39           ` Hendrik Brueckner
2017-12-01  2:33     ` Namhyung Kim
2017-12-01 15:16       ` Arnaldo Carvalho de Melo
2017-12-02 23:21         ` Michael Petlan
2017-12-05 23:18         ` Michael Petlan
2017-12-06 14:28           ` Arnaldo de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.