[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fX9pLRig7qJ+6Wk1g9ysDUDDKXMbo4s1GYvz28iAPs1iA@mail.gmail.com>
Date: Tue, 13 Aug 2024 10:48:21 -0700
From: Ian Rogers <irogers@...gle.com>
To: "Wang, Weilin" <weilin.wang@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
"Hunter, Adrian" <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Taylor, Perry" <perry.taylor@...el.com>,
"Alt, Samantha" <samantha.alt@...el.com>, "Biggers, Caleb" <caleb.biggers@...el.com>
Subject: Re: [RFC PATCH v18 8/8] perf test: Add test for Intel TPEBS counting mode
On Tue, Aug 13, 2024 at 10:18 AM Wang, Weilin <weilin.wang@...el.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Arnaldo Carvalho de Melo <acme@...nel.org>
> > Sent: Monday, August 12, 2024 6:26 PM
> > To: Wang, Weilin <weilin.wang@...el.com>
> > Cc: Namhyung Kim <namhyung@...nel.org>; Ian Rogers
> > <irogers@...gle.com>; Peter Zijlstra <peterz@...radead.org>; Ingo Molnar
> > <mingo@...hat.com>; Alexander Shishkin
> > <alexander.shishkin@...ux.intel.com>; Jiri Olsa <jolsa@...nel.org>; Hunter,
> > Adrian <adrian.hunter@...el.com>; Kan Liang <kan.liang@...ux.intel.com>;
> > linux-perf-users@...r.kernel.org; linux-kernel@...r.kernel.org; Taylor, Perry
> > <perry.taylor@...el.com>; Alt, Samantha <samantha.alt@...el.com>; Biggers,
> > Caleb <caleb.biggers@...el.com>
> > Subject: Re: [RFC PATCH v18 8/8] perf test: Add test for Intel TPEBS counting
> > mode
> >
> > On Mon, Aug 12, 2024 at 10:24:40PM -0300, Arnaldo Carvalho de Melo
> > wrote:
> > > On Sat, Jul 20, 2024 at 02:21:01AM -0400, weilin.wang@...el.com wrote:
> > > > From: Weilin Wang <weilin.wang@...el.com>
> > > >
> > > > Intel TPEBS sampling mode is supported through perf record. The counting
> > mode
> > > > code uses perf record to capture retire_latency value and use it in metric
> > > > calculation. This test checks the counting mode code on Intel platforms.
> > >
> > > root@x1:~# perf test -vvvvv 123
> > > 123: test Intel TPEBS counting mode:
> > > --- start ---
> > > test child forked, pid 2600160
> > > Testing without --record-tpebs
> > > Testing with --record-tpebs
> > > ---- end(-1) ----
> > > 123: test Intel TPEBS counting mode : FAILED!
> > > root@x1:~# grep -m1 "model name" /proc/cpuinfo
> > > model name : 13th Gen Intel(R) Core(TM) i7-1365U
> > > root@x1:~#
> > >
> > > What am I missing?
> > >
> > > The current codebase is in tmp.perf-tools-next
> >
> > acme@x1:~/git/perf-tools-next$ uname -a
> > Linux x1 6.8.11-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Sun May 26
> > 20:05:41 UTC 2024 x86_64 GNU/Linux
> >
>
> Hi Arnaldo,
> I just checkout the code and tested it. The failure is caused by a seg fault on a
> perf_tool struct that is not initialized correctly. I think this is related to the patches
> on struct perf_tool in this branch that applied right before the tpebs patches.
>
> I was able to fix the seg fault by adding the perf_tool__fill_defaults() back. Since
> Ian updated the code to replace this function, I think I need some advice on how
> to use the new code to initialize perf_tool correctly here. Should I call the
> perf_tool__init()?
Yep. If you've added or refactored a tool struct the intent now is
that you call perf_tool__init then override the functions you want to
override. I don't mind to rebase those changes over your changes,
Arnaldo if you want to drop those changes.
Thanks,
Ian
>
>
> Thanks,
> Weilin
>
>
> > > - Arnaldo
> > >
> > > > Signed-off-by: Weilin Wang <weilin.wang@...el.com>
> > > > ---
> > > > .../perf/tests/shell/test_stat_intel_tpebs.sh | 19 +++++++++++++++++++
> > > > 1 file changed, 19 insertions(+)
> > > > create mode 100755 tools/perf/tests/shell/test_stat_intel_tpebs.sh
> > > >
> > > > diff --git a/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> > b/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> > > > new file mode 100755
> > > > index 000000000000..c60b29add980
> > > > --- /dev/null
> > > > +++ b/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> > > > @@ -0,0 +1,19 @@
> > > > +#!/bin/bash
> > > > +# test Intel TPEBS counting mode
> > > > +# SPDX-License-Identifier: GPL-2.0
> > > > +
> > > > +set -e
> > > > +grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
> > > > +
> > > > +# Use this event for testing because it should exist in all platforms
> > > > +event=cache-misses:R
> > > > +
> > > > +# Without this cmd option, default value or zero is returned
> > > > +echo "Testing without --record-tpebs"
> > > > +result=$(perf stat -e "$event" true 2>&1)
> > > > +[[ "$result" =~ $event ]] || exit 1
> > > > +
> > > > +# In platforms that do not support TPEBS, it should execute without error.
> > > > +echo "Testing with --record-tpebs"
> > > > +result=$(perf stat -e "$event" --record-tpebs -a sleep 0.01 2>&1)
> > > > +[[ "$result" =~ "perf record" && "$result" =~ $event ]] || exit 1
> > > > --
> > > > 2.43.0
> > > >
Powered by blists - more mailing lists