[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fU52ZcPUM1QMgAQ59GOouCCJyUZOQs2H7Gt8zB32+0C1Q@mail.gmail.com>
Date: Mon, 19 Aug 2024 08:20:26 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Kan Liang <kan.liang@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 1/2] perf record: Fix sample cgroup & namespace tracking
On Sun, Aug 18, 2024 at 2:29 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> The recent change in perf_tool constification broke the cgroup and/or
> namespace tracking by resetting tool fields. It should set the values
> after perf_tool__init().
>
> Fixes: cecb1cf154b30 ("perf record: Use perf_tool__init()")
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/builtin-record.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 39367709fd99..adbaf80b398c 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -2374,13 +2374,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
> signal(SIGTERM, sig_handler);
> signal(SIGSEGV, sigsegv_handler);
>
> - if (rec->opts.record_namespaces)
> - tool->namespace_events = true;
> -
> if (rec->opts.record_cgroup) {
> -#ifdef HAVE_FILE_HANDLE
> - tool->cgroup_events = true;
> -#else
> +#ifndef HAVE_FILE_HANDLE
> pr_err("cgroup tracking is not supported\n");
> return -1;
> #endif
> @@ -2406,6 +2401,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
> tool->mmap2 = build_id__process_mmap2;
> tool->itrace_start = process_timestamp_boundary;
> tool->aux = process_timestamp_boundary;
> + tool->namespace_events = rec->opts.record_namespaces;
> + tool->cgroup_events = rec->opts.record_cgroup;
> session = perf_session__new(data, tool);
> if (IS_ERR(session)) {
> pr_err("Perf session creation failed.\n");
> --
> 2.46.0.184.g6999bdac58-goog
>
Powered by blists - more mailing lists