[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zrulm_giiqaFP1li@x1>
Date: Tue, 13 Aug 2024 15:27:39 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: "Wang, Weilin" <weilin.wang@...el.com>,
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:48:21AM -0700, Ian Rogers wrote:
> On Tue, Aug 13, 2024 at 10:18 AM Wang, Weilin <weilin.wang@...el.com> wrote:
> > 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.
So I'm adding the patch below, which should be enough, right?
Now:
root@x1:~# perf test tpebs
123: test Intel TPEBS counting mode : Ok
root@x1:~# set -o vi
root@x1:~# perf test tpebs
123: test Intel TPEBS counting mode : Ok
root@x1:~# perf test -v tpebs
123: test Intel TPEBS counting mode : Ok
root@x1:~# perf test -vvv tpebs
123: test Intel TPEBS counting mode:
--- start ---
test child forked, pid 16603
Testing without --record-tpebs
Testing with --record-tpebs
---- end(0) ----
123: test Intel TPEBS counting mode : Ok
root@x1:~#
diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c
index 3729caeba645a3e8..50a3c3e0716065f8 100644
--- a/tools/perf/util/intel-tpebs.c
+++ b/tools/perf/util/intel-tpebs.c
@@ -164,11 +164,12 @@ static void *__sample_reader(void *arg)
.path = PERF_DATA,
.file.fd = child->out,
};
- struct perf_tool tool = {
- .sample = process_sample_event,
- .feature = process_feature_event,
- .attr = perf_event__process_attr,
- };
+ struct perf_tool tool;
+
+ perf_tool__init(&tool, /*ordered_events=*/false);
+ tool.sample = process_sample_event;
+ tool.feature = process_feature_event;
+ tool.attr = perf_event__process_attr;
session = perf_session__new(&data, &tool);
if (IS_ERR(session))
Thanks for root causing, my mistake,
- Arnaldo
Powered by blists - more mailing lists