All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test fix check open filename arg using perf trace on s390x
@ 2017-11-14  7:18 Thomas Richter
  2017-11-14  7:18 ` [PATCH] perf test: fix test case probe libc's inet_pton " Thomas Richter
  2017-11-14 13:13 ` [PATCH] perf test fix check open filename arg using perf trace " Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Richter @ 2017-11-14  7:18 UTC (permalink / raw)
  To: acme, linux-perf-users; +Cc: brueckner, Thomas Richter

This perf test case fails on s390x. The touch command on s390x uses
the openat system call to open the file named on the command line:

[root@s35lp76 perf]# ./perf probe -l
  probe:vfs_getname    (on getname_flags:72@fs/namei.c with pathname)
[root@s35lp76 perf]# ./perf trace -e open touch /tmp/abc
     0.400 ( 0.015 ms): touch/27542 open(filename:
		/usr/lib/locale/locale-archive, flags: CLOEXEC         ) = 3
[root@s35lp76 perf]#

There is no open system call for file /tmp/abc. Instead openat
system call is used:

[root@s35lp76 perf]# strace touch /tmp/abc
    execve("/usr/bin/touch", ["touch", "/tmp/abc"], 0x3ffd547ec98
			/* 30 vars */) = 0
    [...]
    openat(AT_FDCWD, "/tmp/abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
    [...]

On s390x the egrep command does not find a matching pattern and returns
an error.

Fix this for the s390x platform and create a platform dependend command
line to enable the perf probe to listen to openat system call on s390x
and get the correct perf trace output.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
---
 tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
index 2e68c5f120da..2a9ef080efd0 100755
--- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
@@ -17,8 +17,10 @@ skip_if_no_perf_probe || exit 2
 file=$(mktemp /tmp/temporary_file.XXXXX)
 
 trace_open_vfs_getname() {
-	perf trace -e open touch $file 2>&1 | \
-	egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open\(filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
+	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]+$"
 }
 
 
-- 
2.13.4

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

* [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14  7:18 [PATCH] perf test fix check open filename arg using perf trace on s390x Thomas Richter
@ 2017-11-14  7:18 ` Thomas Richter
  2017-11-14 13:26   ` Arnaldo Carvalho de Melo
  2017-11-14 13:13 ` [PATCH] perf test fix check open filename arg using perf trace " Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Richter @ 2017-11-14  7:18 UTC (permalink / raw)
  To: acme, linux-perf-users; +Cc: brueckner, Thomas Richter

Perf test case probe libc's inet_pton & backtrace it with ping
fails on s390x. The reason is the 'realpath /lib64/ld*.so.* | uniq'
line which returns 2 libraries:

        root@s35lp76 shell]# realpath /lib64/ld*.so.* | uniq
        /usr/lib64/ld-2.26.so
        /usr/lib64/ld_pre_smc.so.1.0.1
        [root@s35lp76 shell]

This output makes the perf probe command lines invalid.

Use tool ldd to find out the libraries required by the bash and
check if symbol inet_pton is part of the libc library.
Some distros do not have a /lib64 directory.

I have also added a check for the existence of an IPv6
network interface before it is being used.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Suggested-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
---
 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
index 7a84d73324e3..b9c913f1a360 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -10,8 +10,8 @@
 
 . $(dirname $0)/lib/probe.sh
 
-ld=$(realpath /lib64/ld*.so.* | uniq)
-libc=$(echo $ld | sed 's/ld/libc/g')
+libc=$(ldd $(which bash) 2>/dev/null | fgrep libc | awk '{ print $3 }')
+nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
 
 trace_libc_inet_pton_backtrace() {
 	idx=0
@@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
 	done
 }
 
+# Check for IPv6 interface existence
+ip a sh lo | fgrep -q inet6 || exit 2
+
 skip_if_no_perf_probe && \
 perf probe -q $libc inet_pton && \
 trace_libc_inet_pton_backtrace
-- 
2.13.4

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

* Re: [PATCH] perf test fix check open filename arg using perf trace on s390x
  2017-11-14  7:18 [PATCH] perf test fix check open filename arg using perf trace on s390x Thomas Richter
  2017-11-14  7:18 ` [PATCH] perf test: fix test case probe libc's inet_pton " Thomas Richter
@ 2017-11-14 13:13 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-14 13:13 UTC (permalink / raw)
  To: Thomas Richter; +Cc: linux-perf-users, brueckner

Em Tue, Nov 14, 2017 at 08:18:46AM +0100, Thomas Richter escreveu:
> This perf test case fails on s390x. The touch command on s390x uses
> the openat system call to open the file named on the command line:

Thanks, tested on x86_64 and applied!

- Arnaldo
 
> [root@s35lp76 perf]# ./perf probe -l
>   probe:vfs_getname    (on getname_flags:72@fs/namei.c with pathname)
> [root@s35lp76 perf]# ./perf trace -e open touch /tmp/abc
>      0.400 ( 0.015 ms): touch/27542 open(filename:
> 		/usr/lib/locale/locale-archive, flags: CLOEXEC         ) = 3
> [root@s35lp76 perf]#
> 
> There is no open system call for file /tmp/abc. Instead openat
> system call is used:
> 
> [root@s35lp76 perf]# strace touch /tmp/abc
>     execve("/usr/bin/touch", ["touch", "/tmp/abc"], 0x3ffd547ec98
> 			/* 30 vars */) = 0
>     [...]
>     openat(AT_FDCWD, "/tmp/abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
>     [...]
> 
> On s390x the egrep command does not find a matching pattern and returns
> an error.
> 
> Fix this for the s390x platform and create a platform dependend command
> line to enable the perf probe to listen to openat system call on s390x
> and get the correct perf trace output.
> 
> Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/shell/trace+probe_vfs_getname.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> index 2e68c5f120da..2a9ef080efd0 100755
> --- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> +++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
> @@ -17,8 +17,10 @@ skip_if_no_perf_probe || exit 2
>  file=$(mktemp /tmp/temporary_file.XXXXX)
>  
>  trace_open_vfs_getname() {
> -	perf trace -e open touch $file 2>&1 | \
> -	egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open\(filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
> +	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]+$"
>  }
>  
>  
> -- 
> 2.13.4

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

* Re: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14  7:18 ` [PATCH] perf test: fix test case probe libc's inet_pton " Thomas Richter
@ 2017-11-14 13:26   ` Arnaldo Carvalho de Melo
  2017-11-14 13:34     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-14 13:26 UTC (permalink / raw)
  To: Thomas Richter; +Cc: linux-perf-users, brueckner

Em Tue, Nov 14, 2017 at 08:18:47AM +0100, Thomas Richter escreveu:
> Perf test case probe libc's inet_pton & backtrace it with ping
> fails on s390x. The reason is the 'realpath /lib64/ld*.so.* | uniq'
> line which returns 2 libraries:
> 
>         root@s35lp76 shell]# realpath /lib64/ld*.so.* | uniq
>         /usr/lib64/ld-2.26.so
>         /usr/lib64/ld_pre_smc.so.1.0.1
>         [root@s35lp76 shell]
> 
> This output makes the perf probe command lines invalid.
> 
> Use tool ldd to find out the libraries required by the bash and
> check if symbol inet_pton is part of the libc library.
> Some distros do not have a /lib64 directory.
> 
> I have also added a check for the existence of an IPv6
> network interface before it is being used.
> 
> Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> Suggested-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
> Reviewed-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> index 7a84d73324e3..b9c913f1a360 100755
> --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> @@ -10,8 +10,8 @@
>  
>  . $(dirname $0)/lib/probe.sh
>  
> -ld=$(realpath /lib64/ld*.so.* | uniq)
> -libc=$(echo $ld | sed 's/ld/libc/g')
> +libc=$(ldd $(which bash) 2>/dev/null | fgrep libc | awk '{ print $3 }')
> +nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
>  
>  trace_libc_inet_pton_backtrace() {
>  	idx=0
> @@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
>  	done
>  }
>  
> +# Check for IPv6 interface existence
> +ip a sh lo | fgrep -q inet6 || exit 2
> +
>  skip_if_no_perf_probe && \
>  perf probe -q $libc inet_pton && \
>  trace_libc_inet_pton_backtrace

Humm, this one is failing:

[root@jouet linux]# ls -ila /usr/lib64/libc-2.25.so 
3151772 -rwxr-xr-x. 2 root root 2163016 Aug 28 11:48 /usr/lib64/libc-2.25.so
[root@jouet linux]# ls -ila /lib64/libc-2.25.so 
3151772 -rwxr-xr-x. 2 root root 2163016 Aug 28 11:48 /lib64/libc-2.25.so
[root@jouet linux]#

[root@jouet linux]# tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.068 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.068/0.068/0.068/0.000 ms
0.000 probe_libc:inet_pton:(7fa97fac3d80))
__GI___inet_pton (/usr/lib64/libc-2.25.so)
FAIL: expected backtrace entry 6 ".*inet_pton[[:space:]]\(/lib64/libc.so.6\)$" got "__GI___inet_pton (/usr/lib64/libc-2.25.so)"
[root@jouet linux]#

[root@jouet linux]# ldd `which ping6` | grep 'libc\>'
	libc.so.6 => /lib64/libc.so.6 (0x00007f883df4f000)
[root@jouet linux]#

[root@jouet linux]# ps | grep bash
 3112 pts/3    00:00:00 bash
[root@jouet linux]# ldd `which bash` | grep 'libc\>'
	libc.so.6 => /lib64/libc.so.6 (0x00007fdd0a17f000)
[root@jouet linux]# grep -w libc /proc/3112/maps 
7f0d017ee000-7f0d019b5000 r-xp 00000000 fd:00 3151772  /usr/lib64/libc-2.25.so
7f0d019b5000-7f0d01bb5000 ---p 001c7000 fd:00 3151772  /usr/lib64/libc-2.25.so
7f0d01bb5000-7f0d01bb9000 r--p 001c7000 fd:00 3151772  /usr/lib64/libc-2.25.so
7f0d01bb9000-7f0d01bbb000 rw-p 001cb000 fd:00 3151772  /usr/lib64/libc-2.25.so
[root@jouet linux]#

/me scratches head

Different name, same contents, need to look at the inode... ;-\

- Arnaldo

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

* Re: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14 13:26   ` Arnaldo Carvalho de Melo
@ 2017-11-14 13:34     ` Arnaldo Carvalho de Melo
  2017-11-14 13:47       ` Arnaldo Carvalho de Melo
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-14 13:34 UTC (permalink / raw)
  To: Thomas Richter; +Cc: linux-perf-users, brueckner, Linux Kernel Mailing List

Em Tue, Nov 14, 2017 at 10:26:25AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Nov 14, 2017 at 08:18:47AM +0100, Thomas Richter escreveu:
> > -ld=$(realpath /lib64/ld*.so.* | uniq)
> > -libc=$(echo $ld | sed 's/ld/libc/g')
> > +libc=$(ldd $(which bash) 2>/dev/null | fgrep libc | awk '{ print $3 }')
> 
> Humm, this one is failing:
> 
> [root@jouet linux]# ls -ila /usr/lib64/libc-2.25.so 
> 3151772 -rwxr-xr-x. 2 root root 2163016 Aug 28 11:48 /usr/lib64/libc-2.25.so
> [root@jouet linux]# ls -ila /lib64/libc-2.25.so 
> 3151772 -rwxr-xr-x. 2 root root 2163016 Aug 28 11:48 /lib64/libc-2.25.so
> [root@jouet linux]#
> 
> [root@jouet linux]# tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> PING ::1(::1) 56 data bytes
> 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.068 ms
> --- ::1 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 0.068/0.068/0.068/0.000 ms
> 0.000 probe_libc:inet_pton:(7fa97fac3d80))
> __GI___inet_pton (/usr/lib64/libc-2.25.so)
> FAIL: expected backtrace entry 6 ".*inet_pton[[:space:]]\(/lib64/libc.so.6\)$" got "__GI___inet_pton (/usr/lib64/libc-2.25.so)"
> [root@jouet linux]#
> 
> [root@jouet linux]# ldd `which ping6` | grep 'libc\>'
> 	libc.so.6 => /lib64/libc.so.6 (0x00007f883df4f000)
> [root@jouet linux]#
> 
> [root@jouet linux]# ps | grep bash
>  3112 pts/3    00:00:00 bash
> [root@jouet linux]# ldd `which bash` | grep 'libc\>'
> 	libc.so.6 => /lib64/libc.so.6 (0x00007fdd0a17f000)
> [root@jouet linux]# grep -w libc /proc/3112/maps 
> 7f0d017ee000-7f0d019b5000 r-xp 00000000 fd:00 3151772  /usr/lib64/libc-2.25.so
> 7f0d019b5000-7f0d01bb5000 ---p 001c7000 fd:00 3151772  /usr/lib64/libc-2.25.so
> 7f0d01bb5000-7f0d01bb9000 r--p 001c7000 fd:00 3151772  /usr/lib64/libc-2.25.so
> 7f0d01bb9000-7f0d01bbb000 rw-p 001cb000 fd:00 3151772  /usr/lib64/libc-2.25.so
> [root@jouet linux]#
> 
> /me scratches head
> 
> Different name, same contents, need to look at the inode... ;-\

Nah, lets ask the kernel how is it that it sees libc, please test the
following, works for me:

diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
index 7a84d73324e3..8b3da21a08f1 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -10,8 +10,8 @@
 
 . $(dirname $0)/lib/probe.sh
 
-ld=$(realpath /lib64/ld*.so.* | uniq)
-libc=$(echo $ld | sed 's/ld/libc/g')
+libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
+nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
 
 trace_libc_inet_pton_backtrace() {
 	idx=0
@@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
 	done
 }
 
+# Check for IPv6 interface existence
+ip a sh lo | fgrep -q inet6 || exit 2
+
 skip_if_no_perf_probe && \
 perf probe -q $libc inet_pton && \
 trace_libc_inet_pton_backtrace

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

* Re: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14 13:34     ` Arnaldo Carvalho de Melo
@ 2017-11-14 13:47       ` Arnaldo Carvalho de Melo
  2017-11-14 13:55         ` Thomas-Mich Richter
  2017-11-18  8:33       ` [tip:perf/core] perf test shell: Fix " tip-bot for Thomas Richter
  2017-11-29  6:31       ` tip-bot for Thomas Richter
  2 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-14 13:47 UTC (permalink / raw)
  To: Thomas Richter; +Cc: linux-perf-users, brueckner, Linux Kernel Mailing List

Em Tue, Nov 14, 2017 at 10:34:09AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Different name, same contents, need to look at the inode... ;-\
> 
> Nah, lets ask the kernel how is it that it sees libc, please test the
> following, works for me:

BTW, this is what I sticked on that cset:

    Committer changes:
    
    We can't really use ldd for libc, as in some systems, such as x86_64, it
    has hardlinks and then ldd sees one and the kernel the other, so grep
    for libc in /proc/self/maps to get the one we'll receive from
    PERF_RECORD_MMAP.

- Arnaldo
 
> diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> index 7a84d73324e3..8b3da21a08f1 100755
> --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
> @@ -10,8 +10,8 @@
>  
>  . $(dirname $0)/lib/probe.sh
>  
> -ld=$(realpath /lib64/ld*.so.* | uniq)
> -libc=$(echo $ld | sed 's/ld/libc/g')
> +libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
> +nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
>  
>  trace_libc_inet_pton_backtrace() {
>  	idx=0
> @@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
>  	done
>  }
>  
> +# Check for IPv6 interface existence
> +ip a sh lo | fgrep -q inet6 || exit 2
> +
>  skip_if_no_perf_probe && \
>  perf probe -q $libc inet_pton && \
>  trace_libc_inet_pton_backtrace

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

* Re: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14 13:47       ` Arnaldo Carvalho de Melo
@ 2017-11-14 13:55         ` Thomas-Mich Richter
  2017-11-14 14:58           ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas-Mich Richter @ 2017-11-14 13:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-perf-users, brueckner, Linux Kernel Mailing List

On 11/14/2017 02:47 PM, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 14, 2017 at 10:34:09AM -0300, Arnaldo Carvalho de Melo escreveu:
>>> Different name, same contents, need to look at the inode... ;-\
>>
>> Nah, lets ask the kernel how is it that it sees libc, please test the
>> following, works for me:

works for me too.

> 
> BTW, this is what I sticked on that cset:
> 
>     Committer changes:
>     
>     We can't really use ldd for libc, as in some systems, such as x86_64, it
>     has hardlinks and then ldd sees one and the kernel the other, so grep
>     for libc in /proc/self/maps to get the one we'll receive from
>     PERF_RECORD_MMAP.
> 
> - Arnaldo
> 

Yes I am fine with this changes.
Go ahead.

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
  2017-11-14 13:55         ` Thomas-Mich Richter
@ 2017-11-14 14:58           ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-11-14 14:58 UTC (permalink / raw)
  To: Thomas-Mich Richter
  Cc: linux-perf-users, brueckner, Linux Kernel Mailing List

Em Tue, Nov 14, 2017 at 02:55:48PM +0100, Thomas-Mich Richter escreveu:
> On 11/14/2017 02:47 PM, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Nov 14, 2017 at 10:34:09AM -0300, Arnaldo Carvalho de Melo escreveu:
> >>> Different name, same contents, need to look at the inode... ;-\
> >>
> >> Nah, lets ask the kernel how is it that it sees libc, please test the
> >> following, works for me:
> 
> works for me too.
> 
> > 
> > BTW, this is what I sticked on that cset:
> > 
> >     Committer changes:
> >     
> >     We can't really use ldd for libc, as in some systems, such as x86_64, it
> >     has hardlinks and then ldd sees one and the kernel the other, so grep
> >     for libc in /proc/self/maps to get the one we'll receive from
> >     PERF_RECORD_MMAP.
> > 
> > - Arnaldo
> > 
> 
> Yes I am fine with this changes.
> Go ahead.

Thanks for checking, committed.

- Arnaldo

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

* [tip:perf/core] perf test shell: Fix test case probe libc's inet_pton on s390x
  2017-11-14 13:34     ` Arnaldo Carvalho de Melo
  2017-11-14 13:47       ` Arnaldo Carvalho de Melo
@ 2017-11-18  8:33       ` tip-bot for Thomas Richter
  2017-11-29  6:31       ` tip-bot for Thomas Richter
  2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Thomas Richter @ 2017-11-18  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, brueckner, mingo, tmricht, linux-kernel, acme, hpa

Commit-ID:  0879e5e5f33c8a1eb01281ad920173664e68b266
Gitweb:     https://git.kernel.org/tip/0879e5e5f33c8a1eb01281ad920173664e68b266
Author:     Thomas Richter <tmricht@linux.vnet.ibm.com>
AuthorDate: Tue, 14 Nov 2017 08:18:47 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Nov 2017 14:50:00 -0300

perf test shell: Fix test case probe libc's inet_pton on s390x

The 'perf test' case "probe libc's inet_pton & backtrace it with ping"
fails on s390x. The reason is the 'realpath /lib64/ld*.so.* | uniq' line
which returns 2 libraries:

        root@s35lp76 shell]# realpath /lib64/ld*.so.* | uniq
        /usr/lib64/ld-2.26.so
        /usr/lib64/ld_pre_smc.so.1.0.1
        [root@s35lp76 shell]

This output makes the "perf probe" command lines invalid.

Use ldd tool to find out the libraries required by "bash" and check if
symbol "inet_pton" is part of the "libc" library.  Some distros do not
have a /lib64 directory.

I have also added a check for the existence of an IPv6 network interface
before it is being used.

Committer changes:

We can't really use ldd for libc, as in some systems, such as x86_64, it
has hardlinks and then ldd sees one and the kernel the other, so grep
for libc in /proc/self/maps to get the one we'll receive from
PERF_RECORD_MMAP.

Thomas checked this change and acked it.

Signed-off-by: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Suggested-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20171114133409.GN8836@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
index 7a84d73..8b3da21 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -10,8 +10,8 @@
 
 . $(dirname $0)/lib/probe.sh
 
-ld=$(realpath /lib64/ld*.so.* | uniq)
-libc=$(echo $ld | sed 's/ld/libc/g')
+libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
+nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
 
 trace_libc_inet_pton_backtrace() {
 	idx=0
@@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
 	done
 }
 
+# Check for IPv6 interface existence
+ip a sh lo | fgrep -q inet6 || exit 2
+
 skip_if_no_perf_probe && \
 perf probe -q $libc inet_pton && \
 trace_libc_inet_pton_backtrace

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

* [tip:perf/core] perf test shell: Fix test case probe libc's inet_pton on s390x
  2017-11-14 13:34     ` Arnaldo Carvalho de Melo
  2017-11-14 13:47       ` Arnaldo Carvalho de Melo
  2017-11-18  8:33       ` [tip:perf/core] perf test shell: Fix " tip-bot for Thomas Richter
@ 2017-11-29  6:31       ` tip-bot for Thomas Richter
  2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Thomas Richter @ 2017-11-29  6:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, tmricht, linux-kernel, hpa, mingo, brueckner, tglx

Commit-ID:  d5c5e46aa7a2b256a526f9ce832ffbf622c3c19a
Gitweb:     https://git.kernel.org/tip/d5c5e46aa7a2b256a526f9ce832ffbf622c3c19a
Author:     Thomas Richter <tmricht@linux.vnet.ibm.com>
AuthorDate: Tue, 14 Nov 2017 08:18:47 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 Nov 2017 14:23:16 -0300

perf test shell: Fix test case probe libc's inet_pton on s390x

The 'perf test' case "probe libc's inet_pton & backtrace it with ping"
fails on s390x. The reason is the 'realpath /lib64/ld*.so.* | uniq' line
which returns 2 libraries:

        root@s35lp76 shell]# realpath /lib64/ld*.so.* | uniq
        /usr/lib64/ld-2.26.so
        /usr/lib64/ld_pre_smc.so.1.0.1
        [root@s35lp76 shell]

This output makes the "perf probe" command lines invalid.

Use ldd tool to find out the libraries required by "bash" and check if
symbol "inet_pton" is part of the "libc" library.  Some distros do not
have a /lib64 directory.

I have also added a check for the existence of an IPv6 network interface
before it is being used.

Committer changes:

We can't really use ldd for libc, as in some systems, such as x86_64, it
has hardlinks and then ldd sees one and the kernel the other, so grep
for libc in /proc/self/maps to get the one we'll receive from
PERF_RECORD_MMAP.

Thomas checked this change and acked it.

Signed-off-by: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Suggested-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20171114133409.GN8836@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
index 7a84d73..8b3da21 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -10,8 +10,8 @@
 
 . $(dirname $0)/lib/probe.sh
 
-ld=$(realpath /lib64/ld*.so.* | uniq)
-libc=$(echo $ld | sed 's/ld/libc/g')
+libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
+nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
 
 trace_libc_inet_pton_backtrace() {
 	idx=0
@@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
 	done
 }
 
+# Check for IPv6 interface existence
+ip a sh lo | fgrep -q inet6 || exit 2
+
 skip_if_no_perf_probe && \
 perf probe -q $libc inet_pton && \
 trace_libc_inet_pton_backtrace

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

end of thread, other threads:[~2017-11-29  6:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14  7:18 [PATCH] perf test fix check open filename arg using perf trace on s390x Thomas Richter
2017-11-14  7:18 ` [PATCH] perf test: fix test case probe libc's inet_pton " Thomas Richter
2017-11-14 13:26   ` Arnaldo Carvalho de Melo
2017-11-14 13:34     ` Arnaldo Carvalho de Melo
2017-11-14 13:47       ` Arnaldo Carvalho de Melo
2017-11-14 13:55         ` Thomas-Mich Richter
2017-11-14 14:58           ` Arnaldo Carvalho de Melo
2017-11-18  8:33       ` [tip:perf/core] perf test shell: Fix " tip-bot for Thomas Richter
2017-11-29  6:31       ` tip-bot for Thomas Richter
2017-11-14 13:13 ` [PATCH] perf test fix check open filename arg using perf trace " Arnaldo Carvalho 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.