* [PATCH 1/5] perf test: "probe libc's inet_pton" fails on s390 due to missing inline
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2018-05-14 12:23 ` Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 2/5] perf annotate: Display all available events on --stdio Arnaldo Carvalho de Melo
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-14 12:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Thomas Richter,
Heiko Carstens, Hendrik Brueckner, Martin Schwidefsky,
Arnaldo Carvalho de Melo
From: Thomas Richter <tmricht@linux.ibm.com>
perf test "probe libc's inet_pton & backtrace it with ping" fails on
4.17.0rc3 on s/390. It turned out that function __inet_pton is reported
as inline:
[root@s8360047 perf]# ./perf script -i /tmp/perf.data.111
ping 12457 [000] 1584.478959: probe_libc:inet_pton: (3ffb5a347e8)
1347e8 __inet_pton (inlined)
f19d7 gaih_inet.constprop.5 (/usr/lib64/libc-2.24.so)
f4c3f __GI_getaddrinfo (inlined)
410b main (/usr/bin/ping)
Allow __inet_pton listed as inline.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180503065837.71043-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 016882dbbc16..ee86473643be 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -16,7 +16,7 @@ nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
trace_libc_inet_pton_backtrace() {
idx=0
expected[0]="ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)"
- expected[1]=".*inet_pton[[:space:]]\($libc\)$"
+ expected[1]=".*inet_pton[[:space:]]\($libc|inlined\)$"
case "$(uname -m)" in
s390x)
eventattr='call-graph=dwarf,max-stack=4'
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] perf annotate: Display all available events on --stdio
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 1/5] perf test: "probe libc's inet_pton" fails on s390 due to missing inline Arnaldo Carvalho de Melo
@ 2018-05-14 12:23 ` Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 3/5] perf cs-etm: Support unknown_thread in cs_etm_auxtrace Arnaldo Carvalho de Melo
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-14 12:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Jin Yao,
Alexander Shishkin, Andi Kleen, Jiri Olsa, Kan Liang,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Jin Yao <yao.jin@linux.intel.com>
When we perform the following command lines:
$ perf record -e "{cycles,branches}" ./div
$ perf annotate main --stdio
The output shows only the first event, "cycles" and the displaying
format is not correct.
Percent | Source code & Disassembly of div for cycles (44550 samples)
-----------------------------------------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 00000000004004b0 <main>:
: main():
:
: return i;
: }
:
: int main(void)
: {
0.00 : 4004b0: push %rbx
: int i;
: int flag;
: volatile double x = 1212121212, y = 121212;
:
: s_randseed = time(0);
0.00 : 4004b1: xor %edi,%edi
: srand(s_randseed);
0.00 : 4004b3: mov $0x77359400,%ebx
:
: return i;
: }
The issue is that the value of the 'nr_percent' variable is hardcoded to
1. This patch fixes it.
With this patch, the output is:
Percent | Source code & Disassembly of div for cycles (44550 samples)
-----------------------------------------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 00000000004004b0 <main>:
: main():
:
: return i;
: }
:
: int main(void)
: {
0.00 0.00 : 4004b0: push %rbx
: int i;
: int flag;
: volatile double x = 1212121212, y = 121212;
:
: s_randseed = time(0);
0.00 0.00 : 4004b1: xor %edi,%edi
: srand(s_randseed);
0.00 0.00 : 4004b3: mov $0x77359400,%ebx
:
: return i;
: }
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: f681d593d1ce ("perf annotate: Remove disasm__calc_percent() from disasm_line__print()")
Link: http://lkml.kernel.org/r/1525881435-4092-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 536ee148bff8..5d74a30fe00f 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1263,6 +1263,9 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
max_percent = sample->percent;
}
+ if (al->samples_nr > nr_percent)
+ nr_percent = al->samples_nr;
+
if (max_percent < min_pcnt)
return -1;
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] perf cs-etm: Support unknown_thread in cs_etm_auxtrace
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 1/5] perf test: "probe libc's inet_pton" fails on s390 due to missing inline Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 2/5] perf annotate: Display all available events on --stdio Arnaldo Carvalho de Melo
@ 2018-05-14 12:23 ` Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 4/5] perf cs-etm: Remove redundant space Arnaldo Carvalho de Melo
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-14 12:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Leo Yan,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
linux-arm-kernel, Arnaldo Carvalho de Melo
From: Leo Yan <leo.yan@linaro.org>
CoreSight doesn't allocate thread structure for unknown_thread in ETM
auxtrace, so unknown_thread is NULL pointer. If the perf data doesn't
contain valid tid and then cs_etm__mem_access() uses unknown_thread
instead as thread handler, this results in a segmentation fault when
thread__find_addr_map() accesses the thread handler.
This commit creates a new thread data which is used by unknown_thread, so
CoreSight tracing can roll back to use unknown_thread if perf data
doesn't include valid thread info. This commit also releases thread
data for initialization failure case and for normal auxtrace free flow.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1525924920-4381-1-git-send-email-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/cs-etm.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 40020b1ca54f..2bf28b5acc08 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -239,6 +239,7 @@ static void cs_etm__free(struct perf_session *session)
for (i = 0; i < aux->num_cpu; i++)
zfree(&aux->metadata[i]);
+ thread__zput(aux->unknown_thread);
zfree(&aux->metadata);
zfree(&aux);
}
@@ -1357,6 +1358,23 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
etm->auxtrace.free = cs_etm__free;
session->auxtrace = &etm->auxtrace;
+ etm->unknown_thread = thread__new(999999999, 999999999);
+ if (!etm->unknown_thread)
+ goto err_free_queues;
+
+ /*
+ * Initialize list node so that at thread__zput() we can avoid
+ * segmentation fault at list_del_init().
+ */
+ INIT_LIST_HEAD(&etm->unknown_thread->node);
+
+ err = thread__set_comm(etm->unknown_thread, "unknown", 0);
+ if (err)
+ goto err_delete_thread;
+
+ if (thread__init_map_groups(etm->unknown_thread, etm->machine))
+ goto err_delete_thread;
+
if (dump_trace) {
cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
return 0;
@@ -1371,16 +1389,18 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
err = cs_etm__synth_events(etm, session);
if (err)
- goto err_free_queues;
+ goto err_delete_thread;
err = auxtrace_queues__process_index(&etm->queues, session);
if (err)
- goto err_free_queues;
+ goto err_delete_thread;
etm->data_queued = etm->queues.populated;
return 0;
+err_delete_thread:
+ thread__zput(etm->unknown_thread);
err_free_queues:
auxtrace_queues__free(&etm->queues);
session->auxtrace = NULL;
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] perf cs-etm: Remove redundant space
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2018-05-14 12:23 ` [PATCH 3/5] perf cs-etm: Support unknown_thread in cs_etm_auxtrace Arnaldo Carvalho de Melo
@ 2018-05-14 12:23 ` Arnaldo Carvalho de Melo
2018-05-14 12:23 ` [PATCH 5/5] perf tools: Add missing newline when parsing empty BPF proggie Arnaldo Carvalho de Melo
2018-05-15 6:21 ` [GIT PULL 0/5] perf/urgent fixes Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-14 12:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Leo Yan,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
linux-arm-kernel, Arnaldo Carvalho de Melo
From: Leo Yan <leo.yan@linaro.org>
There have two spaces ahead function name cs_etm__set_pid_tid_cpu(), so
remove one space and correct indentation.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1525924920-4381-2-git-send-email-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/cs-etm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 2bf28b5acc08..bf16dc9ee507 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -613,8 +613,8 @@ cs_etm__get_trace(struct cs_etm_buffer *buff, struct cs_etm_queue *etmq)
return buff->len;
}
-static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm,
- struct auxtrace_queue *queue)
+static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm,
+ struct auxtrace_queue *queue)
{
struct cs_etm_queue *etmq = queue->priv;
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] perf tools: Add missing newline when parsing empty BPF proggie
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2018-05-14 12:23 ` [PATCH 4/5] perf cs-etm: Remove redundant space Arnaldo Carvalho de Melo
@ 2018-05-14 12:23 ` Arnaldo Carvalho de Melo
2018-05-15 6:21 ` [GIT PULL 0/5] perf/urgent fixes Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-14 12:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern, Jiri Olsa,
Namhyung Kim, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
This is not specific to BPF but was found when parsing a .c BPF proggie
that while valid, had no events attached to tracepoints, kprobes, etc:
Very minimal file that perf's BPF code can compile:
# cat empty.c
char _license[] __attribute__((section("license"), used)) = "GPL";
int _version __attribute__((section("version"), used)) = LINUX_VERSION_CODE;
#
Before this patch:
# perf trace -e empty.c
WARNING: event parser found nothinginvalid or unsupported event: 'empty.c'
Run 'perf list' for a list of valid events
Usage: perf trace [<options>] [<command>]
or: perf trace [<options>] -- <command> [<options>]
or: perf trace record [<options>] [<command>]
or: perf trace record [<options>] -- <command> [<options>]
-e, --event <event> event/syscall selector. use 'perf list' to list available events
#
After:
# perf trace -e empty.c
WARNING: event parser found nothing
invalid or unsupported event: 'empty.c'
Run 'perf list' for a list of valid events
Usage: perf trace [<options>] [<command>]
or: perf trace [<options>] -- <command> [<options>]
or: perf trace record [<options>] [<command>]
or: perf trace record [<options>] -- <command> [<options>]
-e, --event <event> event/syscall selector. use 'perf list' to list available events
#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-8ysughiz00h6mjpcot04qyjj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/parse-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 2fb0272146d8..b8b8a9558d32 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1715,7 +1715,7 @@ int parse_events(struct perf_evlist *evlist, const char *str,
struct perf_evsel *last;
if (list_empty(&parse_state.list)) {
- WARN_ONCE(true, "WARNING: event parser found nothing");
+ WARN_ONCE(true, "WARNING: event parser found nothing\n");
return -1;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [GIT PULL 0/5] perf/urgent fixes
2018-05-14 12:23 [GIT PULL 0/5] perf/urgent fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2018-05-14 12:23 ` [PATCH 5/5] perf tools: Add missing newline when parsing empty BPF proggie Arnaldo Carvalho de Melo
@ 2018-05-15 6:21 ` Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2018-05-15 6:21 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Clark Williams, linux-kernel, linux-perf-users, Adrian Hunter,
Alexander Shishkin, Andi Kleen, David Ahern, Heiko Carstens,
Hendrik Brueckner, Jin Yao, Jiri Olsa, Kan Liang, Leo Yan,
linux-arm-kernel, Martin Schwidefsky, Mathieu Poirier,
Namhyung Kim, Peter Zijlstra, Thomas Richter, Wang Nan,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> Test results at the end of this message, as usual.
>
> The following changes since commit 49cf4a4b3f5a8b02556dd4f45c5cee598d4fc799:
>
> Merge tag 'perf-urgent-for-mingo-4.17-20180507' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2018-05-10 20:09:00 +0200)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo-4.17-20180514
>
> for you to fetch changes up to c23080a6e4e853cff2834436e3cf33eae7723900:
>
> perf tools: Add missing newline when parsing empty BPF proggie (2018-05-11 12:10:02 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> - Fix segfault when processing unknown threads in cs-etm (Leo Yan)
>
> - Fix "perf test inet_pton" on s390 failing due to missing inline (Thomas Richter)
>
> - Display all available events on 'perf annotate --stdio' (Jin Yao)
>
> - Add missing newline when parsing empty BPF proggie (Arnaldo Carvalho de Melo)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
> perf tools: Add missing newline when parsing empty BPF proggie
>
> Jin Yao (1):
> perf annotate: Display all available events on --stdio
>
> Leo Yan (2):
> perf cs-etm: Support unknown_thread in cs_etm_auxtrace
> perf cs-etm: Remove redundant space
>
> Thomas Richter (1):
> perf test: "probe libc's inet_pton" fails on s390 due to missing inline
>
> .../tests/shell/record+probe_libc_inet_pton.sh | 2 +-
> tools/perf/util/annotate.c | 3 +++
> tools/perf/util/cs-etm.c | 28 ++++++++++++++++++----
> tools/perf/util/parse-events.c | 2 +-
> 4 files changed, 29 insertions(+), 6 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread