All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>, Arnaldo de Melo <acme@redhat.com>
Subject: [PATCH] perf test shell: Fix check open filename arg using 'perf trace'
Date: Wed, 29 Nov 2017 18:27:47 +0100 (CET)	[thread overview]
Message-ID: <alpine.LRH.2.20.1711291656270.9416@Diego> (raw)

[-- 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
 }
 

             reply	other threads:[~2017-11-29 17:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 17:27 Michael Petlan [this message]
2017-11-30 10:28 ` [PATCH] perf test shell: Fix check open filename arg using 'perf trace' 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.20.1711291656270.9416@Diego \
    --to=mpetlan@redhat.com \
    --cc=acme@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-perf-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.