linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Disha Goel <disgoel@linux.vnet.ibm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH] perf test: Fix dwarf unwind test
Date: Wed, 25 Jan 2023 10:44:00 -0300	[thread overview]
Message-ID: <Y9EyICeJCx+8CscR@kernel.org> (raw)
In-Reply-To: <20230125123442.107156-1-naveen.n.rao@linux.vnet.ibm.com>

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

      reply	other threads:[~2023-01-25 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=Y9EyICeJCx+8CscR@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=disgoel@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    /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).