public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* perf test unwind failing
@ 2015-11-26 20:45 Arnaldo Carvalho de Melo
  2015-11-27  8:21 ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-26 20:45 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Namhyung Kim, Linux Kernel Mailing List

Jiri,

	Can you take a look at 'perf test unwind'? It is failing in my
perf/core branch, no time to bisect that now.

[root@zoo ~]# perf test unwind
40: Test dwarf unwind                                        : FAILED!

- Arnaldo

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

* Re: perf test unwind failing
  2015-11-26 20:45 perf test unwind failing Arnaldo Carvalho de Melo
@ 2015-11-27  8:21 ` Jiri Olsa
  2015-11-27 16:03   ` Arnaldo Carvalho de Melo
  2015-11-29  7:55   ` [tip:perf/core] perf test: 'unwind' test should create kernel maps tip-bot for Jiri Olsa
  0 siblings, 2 replies; 6+ messages in thread
From: Jiri Olsa @ 2015-11-27  8:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Linux Kernel Mailing List,
	masami.hiramatsu.pt, David Ahern

On Thu, Nov 26, 2015 at 05:45:59PM -0300, Arnaldo Carvalho de Melo wrote:
> Jiri,
> 
> 	Can you take a look at 'perf test unwind'? It is failing in my
> perf/core branch, no time to bisect that now.
> 
> [root@zoo ~]# perf test unwind
> 40: Test dwarf unwind                                        : FAILED!

(gdb) set follow-fork-mode child
(gdb) r test dwarf
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fd2780 (LWP 29735)]
0x00000000004ac953 in map__kmap (map=map@entry=0x7ffff7ffe4a0) at util/map.c:839
839             if (!map->dso || !map->dso->kernel) {
(gdb) bt
#0  0x00000000004ac953 in map__kmap (map=map@entry=0x7ffff7ffe4a0) at util/map.c:839
#1  0x00000000004a97a2 in machine__destroy_kernel_maps (machine=machine@entry=0x7fffffffdb80) at util/machine.c:807
#2  0x00000000004a9861 in machine__exit (machine=machine@entry=0x7fffffffdb80) at util/machine.c:125
#3  0x0000000000477669 in test__dwarf_unwind (subtest=<optimized out>) at tests/dwarf-unwind.c:197
#4  0x000000000045a128 in run_test (test=test@entry=0x888470 <arch_tests+80>, subtest=subtest@entry=-1) at tests/builtin-test.c:241
#5  0x000000000045a201 in test_and_print (t=t@entry=0x888470 <arch_tests+80>, force_skip=force_skip@entry=false, subtest=subtest@entry=-1)
    at tests/builtin-test.c:268
#6  0x000000000045a42b in __cmd_test (argc=argc@entry=1, argv=argv@entry=0x7fffffffe3d0, skiplist=0x0) at tests/builtin-test.c:324
#7  0x000000000045a707 in cmd_test (argc=1, argv=0x7fffffffe3d0, prefix=<optimized out>) at tests/builtin-test.c:416
#8  0x00000000004782b0 in run_builtin (p=p@entry=0x885d98 <commands+504>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe3d0) at perf.c:387
#9  0x00000000004784ad in handle_internal_command (argc=2, argv=0x7fffffffe3d0) at perf.c:448
#10 0x0000000000478518 in run_argv (argcp=argcp@entry=0x7fffffffe23c, argv=argv@entry=0x7fffffffe230) at perf.c:492
#11 0x0000000000478789 in main (argc=2, argv=0x7fffffffe3d0) at perf.c:609
(gdb) q


it's caused by following commit:
  commit ebe9729c8c3171aa46ad5d7af40acdc29806689d
  Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
  Date:   Wed Nov 18 15:40:24 2015 +0900

it kind of assumes that __machine__create_kernel_maps is called on
machine, but we don't do that in the tests/dwarf-unwind.c,
only following initialization:

        machines__init(&machines);

        machine = machines__find(&machines, HOST_KERNEL_ID);
        if (!machine) {
                pr_err("Could not get machine\n");
                return -1;
        }


we could call machine__create_kernel_maps right here to fix the issue,
(please check attached patch), but I wonder what's the proper interface
we want to have for creating machine..

thanks,
jirka


---
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index b2357e8115a2..3cce13b19cbb 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -173,6 +173,11 @@ int test__dwarf_unwind(int subtest __maybe_unused)
 		return -1;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_err("Failed to create kernel maps\n");
+		return -1;
+	}
+
 	callchain_param.record_mode = CALLCHAIN_DWARF;
 
 	if (init_live_machine(machine)) {

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

* Re: perf test unwind failing
  2015-11-27  8:21 ` Jiri Olsa
@ 2015-11-27 16:03   ` Arnaldo Carvalho de Melo
  2015-11-27 16:17     ` Arnaldo Carvalho de Melo
  2015-11-29  7:55   ` [tip:perf/core] perf test: 'unwind' test should create kernel maps tip-bot for Jiri Olsa
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-27 16:03 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Namhyung Kim, Linux Kernel Mailing List,
	masami.hiramatsu.pt, David Ahern

Em Fri, Nov 27, 2015 at 09:21:21AM +0100, Jiri Olsa escreveu:
> On Thu, Nov 26, 2015 at 05:45:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > 	Can you take a look at 'perf test unwind'? It is failing in my
> > perf/core branch, no time to bisect that now.
> > 
> > [root@zoo ~]# perf test unwind
> > 40: Test dwarf unwind                                        : FAILED!
> 
> (gdb) set follow-fork-mode child
> (gdb) r test dwarf
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffff7fd2780 (LWP 29735)]
> 0x00000000004ac953 in map__kmap (map=map@entry=0x7ffff7ffe4a0) at util/map.c:839
> 839             if (!map->dso || !map->dso->kernel) {
> (gdb) bt
> #0  0x00000000004ac953 in map__kmap (map=map@entry=0x7ffff7ffe4a0) at util/map.c:839
> #1  0x00000000004a97a2 in machine__destroy_kernel_maps (machine=machine@entry=0x7fffffffdb80) at util/machine.c:807
> #2  0x00000000004a9861 in machine__exit (machine=machine@entry=0x7fffffffdb80) at util/machine.c:125
> #3  0x0000000000477669 in test__dwarf_unwind (subtest=<optimized out>) at tests/dwarf-unwind.c:197
> #4  0x000000000045a128 in run_test (test=test@entry=0x888470 <arch_tests+80>, subtest=subtest@entry=-1) at tests/builtin-test.c:241
> #5  0x000000000045a201 in test_and_print (t=t@entry=0x888470 <arch_tests+80>, force_skip=force_skip@entry=false, subtest=subtest@entry=-1)
>     at tests/builtin-test.c:268
> #6  0x000000000045a42b in __cmd_test (argc=argc@entry=1, argv=argv@entry=0x7fffffffe3d0, skiplist=0x0) at tests/builtin-test.c:324
> #7  0x000000000045a707 in cmd_test (argc=1, argv=0x7fffffffe3d0, prefix=<optimized out>) at tests/builtin-test.c:416
> #8  0x00000000004782b0 in run_builtin (p=p@entry=0x885d98 <commands+504>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe3d0) at perf.c:387
> #9  0x00000000004784ad in handle_internal_command (argc=2, argv=0x7fffffffe3d0) at perf.c:448
> #10 0x0000000000478518 in run_argv (argcp=argcp@entry=0x7fffffffe23c, argv=argv@entry=0x7fffffffe230) at perf.c:492
> #11 0x0000000000478789 in main (argc=2, argv=0x7fffffffe3d0) at perf.c:609
> (gdb) q
> 
> 
> it's caused by following commit:
>   commit ebe9729c8c3171aa46ad5d7af40acdc29806689d
>   Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>   Date:   Wed Nov 18 15:40:24 2015 +0900

Humm, affects just machine__exit(), how could it cause problems here?
 
> it kind of assumes that __machine__create_kernel_maps is called ono
> machine, but we don't do that in the tests/dwarf-unwind.c,

Must be some other patch (see below).

> only following initialization:
> 
>         machines__init(&machines);

Well, if you want to deal with a machine that supports a kernel, then
you need to create the kernel maps, if all you want to do is to deal
with userspace samples, why would you spend time on that?
 
>         machine = machines__find(&machines, HOST_KERNEL_ID);
>         if (!machine) {
>                 pr_err("Could not get machine\n");
>                 return -1;
>         }
> 
> 
> we could call machine__create_kernel_maps right here to fix the issue,
> (please check attached patch), but I wonder what's the proper interface
> we want to have for creating machine..

See above.

After reading the patch I see why you refer to that patch, it is just
that at machine__exit() one should free the kernel maps if they were
created, so it calls machine__destroy_kernel_maps(), and that will check
if the maps were allocated, if not, nothing will be done.

Anyway, I applied your patch, it fixes the problem, thanks!

- Arnaldo

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

* Re: perf test unwind failing
  2015-11-27 16:03   ` Arnaldo Carvalho de Melo
@ 2015-11-27 16:17     ` Arnaldo Carvalho de Melo
  2015-11-29 20:13       ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-27 16:17 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Namhyung Kim, Linux Kernel Mailing List,
	masami.hiramatsu.pt, David Ahern

Em Fri, Nov 27, 2015 at 01:03:11PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Nov 27, 2015 at 09:21:21AM +0100, Jiri Olsa escreveu:
> > On Thu, Nov 26, 2015 at 05:45:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > > 	Can you take a look at 'perf test unwind'? It is failing in my
> > > perf/core branch, no time to bisect that now.
> See above.
> 
> After reading the patch I see why you refer to that patch, it is just
> that at machine__exit() one should free the kernel maps if they were
> created, so it calls machine__destroy_kernel_maps(), and that will check
> if the maps were allocated, if not, nothing will be done.
> 
> Anyway, I applied your patch, it fixes the problem, thanks!

Applied this one to my local tree:

>From 9bdcede563a831f139b5fc872f028ef844a7462e Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa@redhat.com>
Date: Fri, 27 Nov 2015 09:21:21 +0100
Subject: [PATCH 1/1] perf test: 'unwind' test should create kernel maps

The 'perf test unwind' is failing because it forgot to create the kernel
maps, fix it.

After the patch:

  # perf test unwind
  40: Test dwarf unwind         : Ok

Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20151127082121.GA24503@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/dwarf-unwind.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index b2357e8115a2..3cce13b19cbb 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -173,6 +173,11 @@ int test__dwarf_unwind(int subtest __maybe_unused)
 		return -1;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_err("Failed to create kernel maps\n");
+		return -1;
+	}
+
 	callchain_param.record_mode = CALLCHAIN_DWARF;
 
 	if (init_live_machine(machine)) {
-- 
2.1.0


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

* [tip:perf/core] perf test: 'unwind' test should create kernel maps
  2015-11-27  8:21 ` Jiri Olsa
  2015-11-27 16:03   ` Arnaldo Carvalho de Melo
@ 2015-11-29  7:55   ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-11-29  7:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, acme, mingo, tglx, masami.hiramatsu.pt, dsahern,
	linux-kernel, hpa, namhyung

Commit-ID:  9bdcede563a831f139b5fc872f028ef844a7462e
Gitweb:     http://git.kernel.org/tip/9bdcede563a831f139b5fc872f028ef844a7462e
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Fri, 27 Nov 2015 09:21:21 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 27 Nov 2015 13:14:26 -0300

perf test: 'unwind' test should create kernel maps

The 'perf test unwind' is failing because it forgot to create the kernel
maps, fix it.

After the patch:

  # perf test unwind
  40: Test dwarf unwind         : Ok

Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20151127082121.GA24503@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/dwarf-unwind.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index b2357e8..3cce13b1 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -173,6 +173,11 @@ int test__dwarf_unwind(int subtest __maybe_unused)
 		return -1;
 	}
 
+	if (machine__create_kernel_maps(machine)) {
+		pr_err("Failed to create kernel maps\n");
+		return -1;
+	}
+
 	callchain_param.record_mode = CALLCHAIN_DWARF;
 
 	if (init_live_machine(machine)) {

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

* Re: perf test unwind failing
  2015-11-27 16:17     ` Arnaldo Carvalho de Melo
@ 2015-11-29 20:13       ` Jiri Olsa
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Olsa @ 2015-11-29 20:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Linux Kernel Mailing List,
	masami.hiramatsu.pt, David Ahern

On Fri, Nov 27, 2015 at 01:17:40PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Nov 27, 2015 at 01:03:11PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Nov 27, 2015 at 09:21:21AM +0100, Jiri Olsa escreveu:
> > > On Thu, Nov 26, 2015 at 05:45:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > 	Can you take a look at 'perf test unwind'? It is failing in my
> > > > perf/core branch, no time to bisect that now.
> > See above.
> > 
> > After reading the patch I see why you refer to that patch, it is just
> > that at machine__exit() one should free the kernel maps if they were
> > created, so it calls machine__destroy_kernel_maps(), and that will check
> > if the maps were allocated, if not, nothing will be done.
> > 
> > Anyway, I applied your patch, it fixes the problem, thanks!
> 
> Applied this one to my local tree:

cool, thanks

jirka

> 
> From 9bdcede563a831f139b5fc872f028ef844a7462e Mon Sep 17 00:00:00 2001
> From: Jiri Olsa <jolsa@redhat.com>
> Date: Fri, 27 Nov 2015 09:21:21 +0100
> Subject: [PATCH 1/1] perf test: 'unwind' test should create kernel maps
> 
> The 'perf test unwind' is failing because it forgot to create the kernel
> maps, fix it.
> 
> After the patch:
> 
>   # perf test unwind
>   40: Test dwarf unwind         : Ok
> 
> Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: http://lkml.kernel.org/r/20151127082121.GA24503@krava.brq.redhat.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/tests/dwarf-unwind.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
> index b2357e8115a2..3cce13b19cbb 100644
> --- a/tools/perf/tests/dwarf-unwind.c
> +++ b/tools/perf/tests/dwarf-unwind.c
> @@ -173,6 +173,11 @@ int test__dwarf_unwind(int subtest __maybe_unused)
>  		return -1;
>  	}
>  
> +	if (machine__create_kernel_maps(machine)) {
> +		pr_err("Failed to create kernel maps\n");
> +		return -1;
> +	}
> +
>  	callchain_param.record_mode = CALLCHAIN_DWARF;
>  
>  	if (init_live_machine(machine)) {
> -- 
> 2.1.0
> 

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

end of thread, other threads:[~2015-11-29 20:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26 20:45 perf test unwind failing Arnaldo Carvalho de Melo
2015-11-27  8:21 ` Jiri Olsa
2015-11-27 16:03   ` Arnaldo Carvalho de Melo
2015-11-27 16:17     ` Arnaldo Carvalho de Melo
2015-11-29 20:13       ` Jiri Olsa
2015-11-29  7:55   ` [tip:perf/core] perf test: 'unwind' test should create kernel maps tip-bot for Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox