Skip to contentSkip to conversation

perf test 29 crashing

BUG Jiri Olsa 4 participants 9 messages Jun 28, 2016 – Jul 1, 2016 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

hi,
I'm having test 29 crashing on latest Arnaldo's perf/core:

[jolsa@krava perf]$ ./perf test hist

15: Test matching and linking multiple hists                 : Ok
25: Test filtering hist entries                              : Ok
28: Test output sorting of hist entries                      : Ok
29: Test cumulation of child hist entries                    : FAILED!

I was hunting this, because I though it was caused by one of my local changes, but then realized it's public bug ;-)

but can't find the reason so far..

thanks,
jirka

#1 lore raw

Em Tue, Jun 28, 2016 at 02:34:10PM +0200, Jiri Olsa escreveu:

Quoted 9 lines

hi,
I'm having test 29 crashing on latest Arnaldo's perf/core:

[jolsa@krava perf]$ ./perf test hist

15: Test matching and linking multiple hists                 : Ok
25: Test filtering hist entries                              : Ok
28: Test output sorting of hist entries                      : Ok
29: Test cumulation of child hist entries                    : FAILED!
Quoted 4 lines

I was hunting this, because I though it was caused by one of my local changes, but then realized it's public bug ;-)

but can't find the reason so far..

Huh?

[acme@jouet linux]$ perf test 29
29: Test cumulation of child hist entries : Ok
[acme@jouet linux]$ perf --version
perf version 4.7.rc5.g1c1e35c
[acme@jouet linux]$

#2 lore raw
Quoted 15 lines · Arnaldo Carvalho de Melo

Em Tue, Jun 28, 2016 at 02:34:10PM +0200, Jiri Olsa escreveu:

Quoted 9 lines

hi,
I'm having test 29 crashing on latest Arnaldo's perf/core:

[jolsa@krava perf]$ ./perf test hist

15: Test matching and linking multiple hists                 : Ok
25: Test filtering hist entries                              : Ok
28: Test output sorting of hist entries                      : Ok
29: Test cumulation of child hist entries                    : FAILED!
Quoted 4 lines

I was hunting this, because I though it was caused by one of my local changes, but then realized it's public bug ;-)

but can't find the reason so far..

Quoted 8 lines

Huh?

[acme@jouet linux]$ perf test 29
29: Test cumulation of child hist entries : Ok
[acme@jouet linux]$ perf --version
perf version 4.7.rc5.g1c1e35c
[acme@jouet linux]$

If this helps break the tie:

dsa@kenny:~/kernel.git$ /tmp/perf/perf test 29
29: Test cumulation of child hist entries                    : Ok
dsa@kenny:~/kernel.git$ /tmp/perf/perf --version
perf version 4.7.rc5.g02184c

But running on net-next kernel from a few days ago + 1 local patch:

dsa@kenny:~/kernel.git$ uname -r
4.7.0-rc2-00862-g23854048c919

(I do get a few other failures)

maintainer
#3 lore raw

Hi,

Quoted 30 lines · David Ahern
Quoted 15 lines · Arnaldo Carvalho de Melo

Em Tue, Jun 28, 2016 at 02:34:10PM +0200, Jiri Olsa escreveu:

Quoted 9 lines

hi,
I'm having test 29 crashing on latest Arnaldo's perf/core:

[jolsa@krava perf]$ ./perf test hist

15: Test matching and linking multiple hists                 : Ok
25: Test filtering hist entries                              : Ok
28: Test output sorting of hist entries                      : Ok
29: Test cumulation of child hist entries                    : FAILED!
Quoted 4 lines

I was hunting this, because I though it was caused by one of my local changes, but then realized it's public bug ;-)

but can't find the reason so far..

Quoted 8 lines

Huh?

[acme@jouet linux]$ perf test 29
29: Test cumulation of child hist entries : Ok
[acme@jouet linux]$ perf --version
perf version 4.7.rc5.g1c1e35c
[acme@jouet linux]$

If this helps break the tie:

dsa@kenny:~/kernel.git$ /tmp/perf/perf test 29
29: Test cumulation of child hist entries                    : Ok
Quoted 8 lines
dsa@kenny:~/kernel.git$ /tmp/perf/perf --version
perf version 4.7.rc5.g02184c

But running on net-next kernel from a few days ago + 1 local patch:

dsa@kenny:~/kernel.git$ uname -r
4.7.0-rc2-00862-g23854048c919

(I do get a few other failures)

Running latest acme/perf/core:

  $ perf test hist
  15: Test matching and linking multiple hists                 : Ok
  25: Test filtering hist entries                              : Ok
  28: Test output sorting of hist entries                      : Ok
  29: Test cumulation of child hist entries                    : Ok
  $ perf --version
  perf version 4.6.g6d9c67

But I saw a build failure which was fixed by below patch:

Quoted 1 line

From 0b011dbf5ba60f78dd3198dc3f72005334507eb4 Mon Sep 17 00:00:00 2001

From: Namhyung Kim <[email protected]>
Date: Wed, 29 Jun 2016 11:10:22 +0900
Subject: [PATCH] perf tools: Fix build failture on perl script context
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

CC scripts/perl/Perf-Trace-Util/Context.o
In file included from /usr/lib/perl5/core_perl/CORE/perl.h:3905:0,

                   from Context.xs:23:
  /usr/lib/perl5/core_perl/CORE/inline.h: In function ‘S_cx_popsub_args’:
  /usr/lib/perl5/core_perl/CORE/cop.h:612:13: warning: declaration of ‘av'
                                  shadows a previous local [-Werror=shadow]
             AV *av = GvAV(PL_defgv);
                 ^
  /usr/lib/perl5/core_perl/CORE/inline.h:526:5: note: in expansion of
                                  macro ‘CX_POP_SAVEARRAY’
         CX_POP_SAVEARRAY(cx);
         ^~~~~~~~~~~~~~~~
  In file included from /usr/lib/perl5/core_perl/CORE/perl.h:5853:0,
                   from Context.xs:23:
  /usr/lib/perl5/core_perl/CORE/inline.h:518:9: note:
                                  shadowed declaration is here
         AV *av;
             ^~
---
 tools/perf/scripts/perl/Perf-Trace-Util/Build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/scripts/perl/Perf-Trace-Util/Build +3 -1
index 928e110179cb..34faecf774ae 100644
@@ -1,3 +1,5 @@
 libperf-y += Context.o
 
-CFLAGS_Context.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default
+CFLAGS_Context.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs -Wno-undef
+CFLAGS_Context.o += -Wno-switch-default -Wno-shadow
Signature · 1 line
2.9.0
author
#4 lore raw

On Wed, Jun 29, 2016 at 11:20:06AM +0900, Namhyung Kim wrote:

SNIP

Quoted 17 lines
Quoted 6 lines

If this helps break the tie:

dsa@kenny:~/kernel.git$ /tmp/perf/perf test 29
29: Test cumulation of child hist entries                    : Ok
Quoted 8 lines
dsa@kenny:~/kernel.git$ /tmp/perf/perf --version
perf version 4.7.rc5.g02184c

But running on net-next kernel from a few days ago + 1 local patch:

dsa@kenny:~/kernel.git$ uname -r
4.7.0-rc2-00862-g23854048c919

(I do get a few other failures)

Running latest acme/perf/core:

Quoted 8 lines
  $ perf test hist
  15: Test matching and linking multiple hists                 : Ok
  25: Test filtering hist entries                              : Ok
  28: Test output sorting of hist entries                      : Ok
  29: Test cumulation of child hist entries                    : Ok
  $ perf --version
  perf version 4.6.g6d9c67

hum.. I still see it:
(latest acme's perf/core)

[jolsa@krava perf]$ ./perf --version
perf version 4.7.rc5.ga059d59
[jolsa@krava perf]$ ./perf test hist

15: Test matching and linking multiple hists                 : Ok
25: Test filtering hist entries                              : Ok
28: Test output sorting of hist entries                      : Ok
29: Test cumulation of child hist entries                    : FAILED!

[jolsa@krava perf]$ ./perf test 29 -v
29: Test cumulation of child hist entries :
--- start ---
test child forked, pid 11925
perf: Segmentation fault
Obtained 11 stack frames. ./perf(sighandler_dump_stack+0x41) [0x4f57f1] /lib64/libc.so.6(+0x34a50) [0x7f5e22695a50] ./perf() [0x47b2cc] ./perf(test__hists_cumulate+0x10c) [0x47c79c] ./perf() [0x4698b6]
./perf(cmd_test+0x5be) [0x469eae]
./perf() [0x487561]
./perf(main+0x6f6) [0x424cb6] /lib64/libc.so.6(__libc_start_main+0xf0) [0x7f5e22681700] ./perf(_start+0x29) [0x424da9]
[(nil)]
test child interrupted
---- end ----
Test cumulation of child hist entries: FAILED!

hate to be the only one with this.. now I need to dive in ;-)

jirka

author
#5 lore raw

On Thu, Jun 30, 2016 at 05:10:16PM +0200, Jiri Olsa wrote:

SNIP

Quoted 2 lines

hate to be the only one with this.. now I need to dive in ;-)

it was the setup in my .perfconfig:

[call-graph]
threshold=10

caused some of the callchains to disappear and screw the test, I think we should make that test using default values, like in attached patch

however maybe we should think about disabling ~/.perfconfig overload for perf test at all

I'll post patch below with my other stuff if there are no objection or another solution

thanks,
jirka

---

tools/perf/tests/hists_cumulate.c +2 -0
index a9e3db3afac4..1208284a7338 100644
@@ -666,6 +666,8 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
 	perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
 	setup_sorting(NULL);
+
+	callchain_param = callchain_param_default;
 	callchain_register_param(&callchain_param);
 
 	err = add_hist_entries(hists, machine);
tools/perf/util/callchain.h +1 -0
index a70f6b54eb92..13e75549c440 100644
@@ -106,6 +106,7 @@ struct callchain_param {
 };
 
 extern struct callchain_param callchain_param;
+extern struct callchain_param callchain_param_default;
 
 struct callchain_list {
 	u64			ip;
tools/perf/util/util.c +13 -6
index e08b9a092a23..5f44a21955cd 100644
@@ -19,12 +19,19 @@
 #include "callchain.h"
 #include "strlist.h"
 
-struct callchain_param	callchain_param = {
-	.mode	= CHAIN_GRAPH_ABS,
-	.min_percent = 0.5,
-	.order  = ORDER_CALLEE,
-	.key	= CCKEY_FUNCTION,
-	.value	= CCVAL_PERCENT,
+#define CALLCHAIN_PARAM_DEFAULT			\
+	.mode		= CHAIN_GRAPH_ABS,	\
+	.min_percent	= 0.5,			\
+	.order		= ORDER_CALLEE,		\
+	.key		= CCKEY_FUNCTION,	\
+	.value		= CCVAL_PERCENT,	\
+
+struct callchain_param callchain_param = {
+	CALLCHAIN_PARAM_DEFAULT
+};
+
+struct callchain_param callchain_param_default = {
+	CALLCHAIN_PARAM_DEFAULT
 };
 
 /*
#6 lore raw
Quoted 6 lines · Jiri Olsa

it was the setup in my .perfconfig:

[call-graph]
threshold=10

caused some of the callchains to disappear and screw the test,

Did you find out why it caused a segfault?

Quoted 5 lines

I think we should make that test using default values, like in attached patch

however maybe we should think about disabling ~/.perfconfig overload for perf test at all

Agree. The tests need a known config.

author
#7 lore raw
Quoted 9 lines · David Ahern
Quoted 6 lines · Jiri Olsa

it was the setup in my .perfconfig:

[call-graph]
threshold=10

caused some of the callchains to disappear and screw the test,

Did you find out why it caused a segfault?

yep, the code of tests/hists_cumulate.c::do_test
expects each hist_entry to carry callchain,
and the option above cause only some of the
had it:

  do_test
  {
       root = &he->callchain->node.rb_root;
       cnode = rb_entry(rb_first(root), struct callchain_node, rb_node);

       c = 0;
       list_for_each_entry(clist, &cnode->val, list) {
       ^
       - root is empty, cnode is trash and this itaration segfaults

maybe we could also add check below

jirka

---

tools/perf/tests/hists_cumulate.c +2 -0
index 1208284a7338..9fd54b79a788 100644
@@ -216,6 +216,8 @@ static int do_test(struct hists *hists, struct result *expected, size_t nr_expec
 
 		/* check callchain entries */
 		root = &he->callchain->node.rb_root;
+
+		TEST_ASSERT_VAL("callchains expected", !RB_EMPTY_ROOT(root));
 		cnode = rb_entry(rb_first(root), struct callchain_node, rb_node);
 
 		c = 0;
#8 lore raw
In reply to Jiri Olsa

Em Thu, Jun 30, 2016 at 06:18:16PM +0200, Jiri Olsa escreveu:

Quoted 16 lines · Jiri Olsa

SNIP

Quoted 2 lines

hate to be the only one with this.. now I need to dive in ;-)

it was the setup in my .perfconfig:

[call-graph]
threshold=10

caused some of the callchains to disappear and screw the test, I think we should make that test using default values, like in attached patch

Quoted 5 lines

however maybe we should think about disabling ~/.perfconfig overload for perf test at all

I'll post patch below with my other stuff if there are no objection or another solution

Yeah, tests expect things in a certain way, so shouldn't be affect by local .perfconfig stuff, ignoring it in tests is the way to go.

But probably we should instead check if the subcommand is 'test' when calling into perf_config(), no? I.e. Other tests may suffer from this issue.

- Arnaldo

Quoted 59 lines

thanks,
jirka

---

tools/perf/tests/hists_cumulate.c +2 -0
index a9e3db3afac4..1208284a7338 100644
@@ -666,6 +666,8 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
 	perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
 	setup_sorting(NULL);
+
+	callchain_param = callchain_param_default;
 	callchain_register_param(&callchain_param);
 
 	err = add_hist_entries(hists, machine);
tools/perf/util/callchain.h +1 -0
index a70f6b54eb92..13e75549c440 100644
@@ -106,6 +106,7 @@ struct callchain_param {
 };
 
 extern struct callchain_param callchain_param;
+extern struct callchain_param callchain_param_default;
 
 struct callchain_list {
 	u64			ip;
tools/perf/util/util.c +13 -6
index e08b9a092a23..5f44a21955cd 100644
@@ -19,12 +19,19 @@
 #include "callchain.h"
 #include "strlist.h"
 
-struct callchain_param	callchain_param = {
-	.mode	= CHAIN_GRAPH_ABS,
-	.min_percent = 0.5,
-	.order  = ORDER_CALLEE,
-	.key	= CCKEY_FUNCTION,
-	.value	= CCVAL_PERCENT,
+#define CALLCHAIN_PARAM_DEFAULT			\
+	.mode		= CHAIN_GRAPH_ABS,	\
+	.min_percent	= 0.5,			\
+	.order		= ORDER_CALLEE,		\
+	.key		= CCKEY_FUNCTION,	\
+	.value		= CCVAL_PERCENT,	\
+
+struct callchain_param callchain_param = {
+	CALLCHAIN_PARAM_DEFAULT
+};
+
+struct callchain_param callchain_param_default = {
+	CALLCHAIN_PARAM_DEFAULT
 };
 
 /*