[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXSaYcYp4YVvD8aRXNDuCN5f1QM6KkbNF4Sr+paTFkevQ@mail.gmail.com>
Date: Fri, 23 May 2025 09:52:44 -0700
From: Ian Rogers <irogers@...gle.com>
To: Leo Yan <leo.yan@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, "Liang, Kan" <kan.liang@...ux.intel.com>,
James Clark <james.clark@...aro.org>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf tests switch-tracking: Fix timestamp comparison
On Fri, May 23, 2025 at 1:10 AM Leo Yan <leo.yan@....com> wrote:
>
> On Thu, May 22, 2025 at 10:57:41PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Thu, May 22, 2025 at 10:55:46PM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Mon, Mar 31, 2025 at 06:27:59PM +0100, Leo Yan wrote:
> > > > The test might fail on the Arm64 platform with the error:
> > > >
> > > > perf test -vvv "Track with sched_switch"
> > > > Missing sched_switch events
> > > >
> > > > The issue is caused by incorrect handling of timestamp comparisons. The
> > > > comparison result, a signed 64-bit value, was being directly cast to an
> > > > int, leading to incorrect sorting for sched events.
> > > >
> > > > Fix this by explicitly returning 0, 1, or -1 based on whether the result
> > > > is zero, positive, or negative.
> > > >
> > > > Fixes: d44bc5582972 ("perf tests: Add a test for tracking with sched_switch")
> > > > Signed-off-by: Leo Yan <leo.yan@....com>
> > >
> > > How can I reproduce this?
> > >
> > > Testing on a rpi5, 64-bit debian, this test passes:
>
> Sorry that I did not give precise info for reproducing the failure.
> The case does not fail everytime, usually I can trigger the failure
> after run 20 ~ 30 times:
>
> # while true; do perf test "Track with sched_switch"; done
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : FAILED!
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : FAILED!
> 106: Track with sched_switch : Ok
> 106: Track with sched_switch : Ok
Just to advertise the "-r" or "--runs-per-test" option:
```
$ perf test -v -r 100 "Track with sched_switch"
```
The test is exclusive so you won't get any parallelism from this, but
you could in other cases.
Thanks,
Ian
> I used cross compiler to build Perf tool on my host machine and tested on
> Debian / Juno board. Generally, I think this issue is not very specific
> to GCC versions. As both internal CI and my local env can reproduce the
> issue.
>
> Please let me know if need any more info. Thanks!
>
>
> ---8<---
>
> My Host Build compiler:
>
> # aarch64-linux-gnu-gcc --version
> aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
>
> Juno Board:
>
> # lsb_release -a
> No LSB modules are available.
> Distributor ID: Debian
> Description: Debian GNU/Linux 12 (bookworm)
> Release: 12
> Codename: bookworm
Powered by blists - more mailing lists