From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Jiri Olsa <jolsa@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 07/28] perf tests: Switch trace+probe_libc_inet_pton to use record
Date: Mon, 5 Mar 2018 11:29:11 -0300 [thread overview]
Message-ID: <20180305142932.16921-8-acme@kernel.org> (raw)
In-Reply-To: <20180305142932.16921-1-acme@kernel.org>
From: Jiri Olsa <jolsa@kernel.org>
There's a problem with relying on backtrace data from 'perf trace' the
way the trace+probe_libc_inet_pton does. This test inserts uprobe within
ping binary and checks that it gets its sample using 'perf trace'.
It also checks it gets proper backtrace from sample and that's where the
issue is.
The 'perf trace' does not sort events (by definition) so it can happen
that it processes the event sample before the ping binary memory map
event. This can (very rarely) happen as proved by this events dump
output (from custom added debug output):
...
7680/7680: [0x7f4e29718000(0x204000) @ 0 fd:00 33611321 4230892504]: r-xp /usr/lib64/libdl-2.17.so
7680/7680: [0x7f4e29502000(0x216000) @ 0 fd:00 33617257 2606846872]: r-xp /usr/lib64/libz.so.1.2.7
(IP, 0x2): 7680/7680: 0x7f4e29c2ed60 period: 1 addr: 0
7680/7680: [0x564842ef0000(0x233000) @ 0 fd:00 83 1989280200]: r-xp /usr/bin/ping
7680/7680: [0x7f4e2aca2000(0x224000) @ 0 fd:00 33611308 1219144940]: r-xp /usr/lib64/ld-2.17.so
...
In this case 'perf trace' fails to resolve the last callchain IP (within
the ping binary) because it does not know about the ping binary memory
map yet and the test fails like this:
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.037 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.037/0.037/0.037/0.000 ms
0.000 probe_libc:inet_pton:(7f4e29c2ed60))
__GI___inet_pton (/usr/lib64/libc-2.17.so)
getaddrinfo (/usr/lib64/libc-2.17.so)
[0] ([unknown])
FAIL: expected backtrace entry 8 ".*\(.*/bin/ping.*\)$" got "[0] ([unknown])"
Switching the test to use 'perf record' and 'perf script' instead of
'perf trace'.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180301165215.6780-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../perf/tests/shell/trace+probe_libc_inet_pton.sh | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 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 8c4ab0b390c0..52c3ee701a89 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -15,30 +15,28 @@ nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
trace_libc_inet_pton_backtrace() {
idx=0
- expected[0]="PING.*bytes"
- expected[1]="64 bytes from ::1.*"
- expected[2]=".*ping statistics.*"
- expected[3]=".*packets transmitted.*"
- expected[4]="rtt min.*"
- expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)"
- expected[6]=".*inet_pton[[:space:]]\($libc|inlined\)$"
+ expected[0]="ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)"
+ expected[1]=".*inet_pton[[:space:]]\($libc\)$"
case "$(uname -m)" in
s390x)
eventattr='call-graph=dwarf'
- expected[7]="gaih_inet.*[[:space:]]\($libc|inlined\)$"
- expected[8]="__GI_getaddrinfo[[:space:]]\($libc|inlined\)$"
- expected[9]="main[[:space:]]\(.*/bin/ping.*\)$"
- expected[10]="__libc_start_main[[:space:]]\($libc\)$"
- expected[11]="_start[[:space:]]\(.*/bin/ping.*\)$"
+ expected[2]="gaih_inet.*[[:space:]]\($libc|inlined\)$"
+ expected[3]="__GI_getaddrinfo[[:space:]]\($libc|inlined\)$"
+ expected[4]="main[[:space:]]\(.*/bin/ping.*\)$"
+ expected[5]="__libc_start_main[[:space:]]\($libc\)$"
+ expected[6]="_start[[:space:]]\(.*/bin/ping.*\)$"
;;
*)
eventattr='max-stack=3'
- expected[7]="getaddrinfo[[:space:]]\($libc\)$"
- expected[8]=".*\(.*/bin/ping.*\)$"
+ expected[2]="getaddrinfo[[:space:]]\($libc\)$"
+ expected[3]=".*\(.*/bin/ping.*\)$"
;;
esac
- perf trace --no-syscalls -e probe_libc:inet_pton/$eventattr/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do
+ file=`mktemp -u /tmp/perf.data.XXX`
+
+ perf record -e probe_libc:inet_pton/$eventattr/ -o $file ping -6 -c 1 ::1 > /dev/null 2>&1
+ perf script -i $file | while read line ; do
echo $line
echo "$line" | egrep -q "${expected[$idx]}"
if [ $? -ne 0 ] ; then
@@ -48,6 +46,8 @@ trace_libc_inet_pton_backtrace() {
let idx+=1
[ -z "${expected[$idx]}" ] && break
done
+
+ rm -f $file
}
# Check for IPv6 interface existence
--
2.14.3
next prev parent reply other threads:[~2018-03-05 14:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 14:29 [GIT PULL 00/28] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 01/28] perf kallsyms: Fix the usage on the man page Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 02/28] perf stat: Use xyarray dimensions to iterate fds Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 03/28] perf cgroup: Simplify arguments when tracking multiple events Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 04/28] perf top: Fix annoying fallback message on older kernels Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 05/28] perf stat: Ignore error thread when enabling system-wide --per-thread Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 06/28] perf annotate browser: Be more robust when drawing jump arrows Arnaldo Carvalho de Melo
2018-03-05 14:29 ` Arnaldo Carvalho de Melo [this message]
2018-03-05 14:29 ` [PATCH 08/28] perf tests: Rename trace+probe_libc_inet_pton to record+probe_libc_inet_pton Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 09/28] perf record: Allow asking for the maximum allowed sample rate Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 10/28] perf top browser: Show sample_freq in browser title line Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 11/28] perf top: Allow asking for the maximum allowed sample rate Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 12/28] perf record: Throttle user defined frequencies to the maximum allowed Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 13/28] perf annotate: Find 'call' instruction target symbol at parsing time Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 14/28] perf record: Fix crash in pipe mode Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 15/28] perf kvm: Switch to new perf_mmap__read_event() interface Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 16/28] perf trace: " Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 17/28] perf python: " Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 18/28] perf test: Switch to new perf_mmap__read_event() interface for bpf Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 19/28] perf test: Switch to new perf_mmap__read_event() interface for 'code reading' test Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 20/28] perf test: Switch to new perf_mmap__read_event() interface for "keep tracking" test Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 21/28] perf test: Switch to new perf_mmap__read_event() interface for mmap-basic Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 22/28] perf test: Switch to new perf_mmap__read_event() interface for tp fields Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 23/28] perf test: Switch to new perf_mmap__read_event() interface for perf-record Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 24/28] perf test: Switch to new perf_mmap__read_event() interface for time-to-tsc Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 25/28] perf test: Switch to new perf_mmap__read_event() interface for sw-clock Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 26/28] perf test: Switch to new perf_mmap__read_event() interface for switch-tracking Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 27/28] perf test: Switch to new perf_mmap__read_event() interface for task-exit Arnaldo Carvalho de Melo
2018-03-05 14:29 ` [PATCH 28/28] perf mmap: Discard legacy interfaces for mmap read forward Arnaldo Carvalho de Melo
2018-03-06 6:35 ` [GIT PULL 00/28] perf/core improvements and fixes Ingo Molnar
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=20180305142932.16921-8-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).