* [PATCH] perf test: Fix dwarf unwind test
@ 2023-01-25 12:34 Naveen N. Rao
2023-01-25 13:44 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Naveen N. Rao @ 2023-01-25 12:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, linux-perf-users, Disha Goel
Dwarf unwind perf test can sometimes fail:
$ perf test -v 74
Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
74: Test dwarf unwind :
--- start ---
test child forked, pid 3785254
Problems creating module maps, continuing anyway...
Problems creating module maps, continuing anyway...
unwind: test__arch_unwind_sample:ip = 0x102d0ad4c (0x36ad4c)
unwind: access_mem addr 0x7fffc33128c8, val 1031c3228, offset 120
unwind: access_mem addr 0x7fffc33128d0, val 12427cc70, offset 128
<snip>
unwind: test_dwarf_unwind__krava_3:ip = 0x102b8768b (0x1e768b)
unwind: access_mem addr 0x7fffc3313048, val 7fffc3313050, offset 2040
unwind: access_mem addr 0x7fffc3313060, val 102b8777c, offset 2064
unwind: test_dwarf_unwind__krava_2:ip = 0x102b8770b (0x1e770b)
unwind: access_mem addr 0x7fffc3313088, val 7fffc3313090, offset 2104
unwind: access_mem addr 0x7fffc33130a0, val 102b87890, offset 2128
unwind: test_dwarf_unwind__krava_1:ip = 0x102b8777b (0x1e777b)
unwind: access_mem addr 0x7fffc3313108, val 10323a274, offset 2232
unwind: access_mem addr 0x7fffc3313110, val ffffffffffffffff, offset 2240
unwind: access_mem addr 0x7fffc3313118, val 102c08ed0, offset 2248
unwind: access_mem addr 0x7fffc3313120, val 1031db000, offset 2256
unwind: access_mem addr 0x7fffc3313128, val 7fffc3313130, offset 2264
unwind: access_mem addr 0x7fffc3313140, val 102b45ee8, offset 2288
unwind: '':ip = 0x102b8788f (0x1e788f)
failed: got unresolved address 0x102b8788f
unwind: failed with 'no error'
got wrong number of stack entries 0 != 8
test child finished with -1
---- end ----
Test dwarf unwind: FAILED!
We expect to resolve test__dwarf_unwind as the last symbol, but that
function can be optimized away:
$ objdump -tT /usr/bin/perf | grep dwarf_unwind
000000000083b018 g DO .data 0000000000000040 Base tests__dwarf_unwind
00000000001e7750 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_1
00000000001e76e0 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_2
00000000001e7620 g DF .text 00000000000000b4 Base 0x60 test_dwarf_unwind__krava_3
00000000001e74f0 g DF .text 0000000000000128 Base 0x60 test_dwarf_unwind__compare
00000000001e7350 g DF .text 000000000000019c Base 0x60 test_dwarf_unwind__thread
000000000083b000 g DO .data 0000000000000018 Base suite__dwarf_unwind
Fix this similar to commit fdf7c49c200d1b ("perf tests: Fix dwarf unwind
for stripped binaries") by marking the function as a global and adding
the 'noinline' attribute to it.
With this patch:
$ objdump -tT perf | grep dwarf_unwind
000000000083b018 g DO .data 0000000000000040 Base tests__dwarf_unwind
00000000001e80f0 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_1
00000000001e8080 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_2
00000000001e7fc0 g DF .text 00000000000000b4 Base 0x60 test_dwarf_unwind__krava_3
00000000001e7e90 g DF .text 0000000000000128 Base 0x60 test_dwarf_unwind__compare
00000000001e7cf0 g DF .text 000000000000019c Base 0x60 test_dwarf_unwind__thread
00000000001e8160 g DF .text 0000000000000248 Base 0x60 test__dwarf_unwind
000000000083b000 g DO .data 0000000000000018 Base suite__dwarf_unwind
$ ./perf test 74
74: Test dwarf unwind : Ok
Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
tools/perf/tests/dwarf-unwind.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index afdca7f2959f07..ee983b677a6ae0 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -67,6 +67,7 @@ int test_dwarf_unwind__compare(void *p1, void *p2);
int test_dwarf_unwind__krava_3(struct thread *thread);
int test_dwarf_unwind__krava_2(struct thread *thread);
int test_dwarf_unwind__krava_1(struct thread *thread);
+int test__dwarf_unwind(struct test_suite *test, int subtest);
#define MAX_STACK 8
@@ -195,8 +196,8 @@ NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__krava_1(struct thread *th
return ret;
}
-static int test__dwarf_unwind(struct test_suite *test __maybe_unused,
- int subtest __maybe_unused)
+noinline int test__dwarf_unwind(struct test_suite *test __maybe_unused,
+ int subtest __maybe_unused)
{
struct machine *machine;
struct thread *thread;
base-commit: 5670ebf54bd26482f57a094c53bdc562c106e0a9
--
2.39.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] perf test: Fix dwarf unwind test
2023-01-25 12:34 [PATCH] perf test: Fix dwarf unwind test Naveen N. Rao
@ 2023-01-25 13:44 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-01-25 13:44 UTC (permalink / raw)
To: Naveen N. Rao
Cc: linux-kernel, linux-perf-users, Disha Goel, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers
Em Wed, Jan 25, 2023 at 06:04:42PM +0530, Naveen N. Rao escreveu:
> Dwarf unwind perf test can sometimes fail:
Thanks, applied, next time please CC the perf tools reviewers,
[acme@quaco perf]$ ./scripts/get_maintainer.pl tools/perf/tests/dwarf-unwind.c | grep reviewer | grep PERF
Mark Rutland <mark.rutland@arm.com> (reviewer:PERFORMANCE EVENTS SUBSYSTEM)
Alexander Shishkin <alexander.shishkin@linux.intel.com> (reviewer:PERFORMANCE EVENTS SUBSYSTEM)
Jiri Olsa <jolsa@kernel.org> (reviewer:PERFORMANCE EVENTS SUBSYSTEM)
Namhyung Kim <namhyung@kernel.org> (reviewer:PERFORMANCE EVENTS SUBSYSTEM)
Ian Rogers <irogers@google.com> (reviewer:PERFORMANCE EVENTS SUBSYSTEM)
[acme@quaco perf]$
- Arnaldo
> $ perf test -v 74
> Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
> 74: Test dwarf unwind :
> --- start ---
> test child forked, pid 3785254
> Problems creating module maps, continuing anyway...
> Problems creating module maps, continuing anyway...
> unwind: test__arch_unwind_sample:ip = 0x102d0ad4c (0x36ad4c)
> unwind: access_mem addr 0x7fffc33128c8, val 1031c3228, offset 120
> unwind: access_mem addr 0x7fffc33128d0, val 12427cc70, offset 128
> <snip>
> unwind: test_dwarf_unwind__krava_3:ip = 0x102b8768b (0x1e768b)
> unwind: access_mem addr 0x7fffc3313048, val 7fffc3313050, offset 2040
> unwind: access_mem addr 0x7fffc3313060, val 102b8777c, offset 2064
> unwind: test_dwarf_unwind__krava_2:ip = 0x102b8770b (0x1e770b)
> unwind: access_mem addr 0x7fffc3313088, val 7fffc3313090, offset 2104
> unwind: access_mem addr 0x7fffc33130a0, val 102b87890, offset 2128
> unwind: test_dwarf_unwind__krava_1:ip = 0x102b8777b (0x1e777b)
> unwind: access_mem addr 0x7fffc3313108, val 10323a274, offset 2232
> unwind: access_mem addr 0x7fffc3313110, val ffffffffffffffff, offset 2240
> unwind: access_mem addr 0x7fffc3313118, val 102c08ed0, offset 2248
> unwind: access_mem addr 0x7fffc3313120, val 1031db000, offset 2256
> unwind: access_mem addr 0x7fffc3313128, val 7fffc3313130, offset 2264
> unwind: access_mem addr 0x7fffc3313140, val 102b45ee8, offset 2288
> unwind: '':ip = 0x102b8788f (0x1e788f)
> failed: got unresolved address 0x102b8788f
> unwind: failed with 'no error'
> got wrong number of stack entries 0 != 8
> test child finished with -1
> ---- end ----
> Test dwarf unwind: FAILED!
>
> We expect to resolve test__dwarf_unwind as the last symbol, but that
> function can be optimized away:
> $ objdump -tT /usr/bin/perf | grep dwarf_unwind
> 000000000083b018 g DO .data 0000000000000040 Base tests__dwarf_unwind
> 00000000001e7750 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_1
> 00000000001e76e0 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_2
> 00000000001e7620 g DF .text 00000000000000b4 Base 0x60 test_dwarf_unwind__krava_3
> 00000000001e74f0 g DF .text 0000000000000128 Base 0x60 test_dwarf_unwind__compare
> 00000000001e7350 g DF .text 000000000000019c Base 0x60 test_dwarf_unwind__thread
> 000000000083b000 g DO .data 0000000000000018 Base suite__dwarf_unwind
>
> Fix this similar to commit fdf7c49c200d1b ("perf tests: Fix dwarf unwind
> for stripped binaries") by marking the function as a global and adding
> the 'noinline' attribute to it.
>
> With this patch:
> $ objdump -tT perf | grep dwarf_unwind
> 000000000083b018 g DO .data 0000000000000040 Base tests__dwarf_unwind
> 00000000001e80f0 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_1
> 00000000001e8080 g DF .text 0000000000000068 Base 0x60 test_dwarf_unwind__krava_2
> 00000000001e7fc0 g DF .text 00000000000000b4 Base 0x60 test_dwarf_unwind__krava_3
> 00000000001e7e90 g DF .text 0000000000000128 Base 0x60 test_dwarf_unwind__compare
> 00000000001e7cf0 g DF .text 000000000000019c Base 0x60 test_dwarf_unwind__thread
> 00000000001e8160 g DF .text 0000000000000248 Base 0x60 test__dwarf_unwind
> 000000000083b000 g DO .data 0000000000000018 Base suite__dwarf_unwind
> $ ./perf test 74
> 74: Test dwarf unwind : Ok
>
> Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> tools/perf/tests/dwarf-unwind.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
> index afdca7f2959f07..ee983b677a6ae0 100644
> --- a/tools/perf/tests/dwarf-unwind.c
> +++ b/tools/perf/tests/dwarf-unwind.c
> @@ -67,6 +67,7 @@ int test_dwarf_unwind__compare(void *p1, void *p2);
> int test_dwarf_unwind__krava_3(struct thread *thread);
> int test_dwarf_unwind__krava_2(struct thread *thread);
> int test_dwarf_unwind__krava_1(struct thread *thread);
> +int test__dwarf_unwind(struct test_suite *test, int subtest);
>
> #define MAX_STACK 8
>
> @@ -195,8 +196,8 @@ NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__krava_1(struct thread *th
> return ret;
> }
>
> -static int test__dwarf_unwind(struct test_suite *test __maybe_unused,
> - int subtest __maybe_unused)
> +noinline int test__dwarf_unwind(struct test_suite *test __maybe_unused,
> + int subtest __maybe_unused)
> {
> struct machine *machine;
> struct thread *thread;
>
> base-commit: 5670ebf54bd26482f57a094c53bdc562c106e0a9
> --
> 2.39.1
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-25 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-25 12:34 [PATCH] perf test: Fix dwarf unwind test Naveen N. Rao
2023-01-25 13:44 ` 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.