[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aC_Vn95vYqcXul03@x1>
Date: Thu, 22 May 2025 22:55:43 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Leo Yan <leo.yan@....com>
Cc: Namhyung Kim <namhyung@...nel.org>, Ian Rogers <irogers@...gle.com>,
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 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:
root@...pberrypi:~# uname -a
Linux raspberrypi 6.12.25+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.25-1+rpt1 (2025-04-30) aarch64 GNU/Linux
root@...pberrypi:~# perf test -vvv "Track with sched_switch" |& tail -50
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
cycles event
sched_switch: cpu: 3 prev_tid 208750 next_tid 0
sched_switch: cpu: 2 prev_tid 0 next_tid 195941
sched_switch: cpu: 2 prev_tid 195941 next_tid 208748
sched_switch: cpu: 2 prev_tid 208748 next_tid 0
sched_switch: cpu: 3 prev_tid 0 next_tid 208750
sched_switch: cpu: 3 prev_tid 208750 next_tid 34
sched_switch: cpu: 3 prev_tid 34 next_tid 0
sched_switch: cpu: 0 prev_tid 0 next_tid 208750
sched_switch: cpu: 0 prev_tid 208750 next_tid 21
sched_switch: cpu: 0 prev_tid 21 next_tid 0
sched_switch: cpu: 1 prev_tid 0 next_tid 208750
sched_switch: cpu: 1 prev_tid 208750 next_tid 24
sched_switch: cpu: 1 prev_tid 24 next_tid 0
sched_switch: cpu: 2 prev_tid 0 next_tid 208750
sched_switch: cpu: 2 prev_tid 208750 next_tid 29
sched_switch: cpu: 3 prev_tid 0 next_tid 208750
sched_switch: cpu: 2 prev_tid 29 next_tid 0
sched_switch: cpu: 3 prev_tid 208750 next_tid 34
sched_switch: cpu: 3 prev_tid 34 next_tid 0
sched_switch: cpu: 0 prev_tid 0 next_tid 208750
sched_switch: cpu: 1 prev_tid 0 next_tid 208750
sched_switch: cpu: 2 prev_tid 0 next_tid 208750
sched_switch: cpu: 3 prev_tid 0 next_tid 208750
507 events recorded
---- end(0) ----
109: Track with sched_switch : Ok
root@...pberrypi:~#
Powered by blists - more mailing lists