mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Forrington <nick.forrington@arm.com>
To: Leo Yan <leo.yan@linaro.org>, Michael Petlan <mpetlan@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	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>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	vmolnaro@redhat.com
Subject: Re: [PATCH] perf test: Remove atomics from test_loop to avoid test failures
Date: Sat, 25 Nov 2023 19:10:25 +0000	[thread overview]
Message-ID: <f0ac7523-edce-4b0b-a142-14c03c912720@arm.com> (raw)
In-Reply-To: <20231125030529.GB178091@leoy-huanghe>


On 25/11/2023 03:05, Leo Yan wrote:
> Hi all,
>
> On Fri, Nov 24, 2023 at 08:57:52PM +0100, Michael Petlan wrote:
>> On Thu, 2 Nov 2023, Nick Forrington wrote:
>>> The current use of atomics can lead to test failures, as tests (such as
>>> tests/shell/record.sh) search for samples with "test_loop" as the
>>> top-most stack frame, but find frames related to the atomic operation
>>> (e.g. __aarch64_ldadd4_relax).
> I am confused by above description.  As I went through the script
> record.sh, which is the only test invoking the program 'test_loop',
> but I don't find any test is related with stack frame.
>
> Do I miss anything?  I went through record.sh but no clue why the
> failure is caused by stack frame.  All the testings use command:
>
>    if ! perf report -i "${perfdata}" -q | grep -q "${testsym}"
>      ...
>    fi
>
> @Nick, could you narrow down which specific test case causing the
> failure.
>
> [...]


All checks for ${testsym} in record.sh (including the example you 
provide) can fail, as the expected symbol (test_loop) is not the 
top-most function on the stack (and therefore not the symbol associated 
with the sample).


Example perf report output:

# Overhead  Command  Shared Object          Symbol
# ........  .......  ..................... .............................
#
     99.53%  perf     perf                   [.] __aarch64_ldadd4_relax

...


You can see the issue when recording/reporting with call stacks:

# Children      Self  Command  Shared Object          Symbol
# ........  ........  .......  ..................... 
..........................................................
#
     99.52%    99.52%  perf     perf                   [.] 
__aarch64_ldadd4_relax
             |
             |--49.77%--0xffffb905a5dc
             |          0xffffb8ff0aec
             |          thfunc
             |          test_loop
             |          __aarch64_ldadd4_relax

...

>
>> I believe that it was there to prevent the compiler to optimize the loop
>> out or some reason like that. Hopefully, it will work even without that
>> on all architectures with all compilers that are used for building perf...
> Agreed.
>
> As said above, I'd like to step back a bit for making clear what's the
> exactly failure caused by the program.


I don't think this loop could be sensibly optimised away, as it depends 
on "done", which is defined at file scope (and assigned by a signal 
handler).


Cheers,
Nick

>
> Thanks,
> Leo
>

  reply	other threads:[~2023-11-25 19:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 16:22 Nick Forrington
2023-11-03  9:14 ` James Clark
2023-11-21 17:04   ` Arnaldo Carvalho de Melo
2023-11-24 19:57 ` Michael Petlan
2023-11-25  3:05   ` Leo Yan
2023-11-25 19:10     ` Nick Forrington [this message]
2023-11-26  7:41       ` Leo Yan
2023-11-27 13:20         ` Arnaldo Carvalho de Melo
2023-11-27 13:29           ` Leo Yan
2023-11-27 10:45   ` James Clark

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=f0ac7523-edce-4b0b-a142-14c03c912720@arm.com \
    --to=nick.forrington@arm.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=vmolnaro@redhat.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

all inboxes | Powered by JetHome®