* [PATCH v1] perf lock: Provide a host_env for session new
@ 2025-09-13 0:01 Ian Rogers
2025-09-13 0:48 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2025-09-13 0:01 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
linux-kernel
When "perf lock con" is run in a live mode, with no data file, a host
environment must be provided. Testing missed this as a failing assert
was creating the 1 line of expected stderr output.
Signed-off-by: Ian Rogers <irogers@google.com>
---
Please consider this patch for v6.17 fixes.
---
tools/perf/builtin-lock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index fd49703021fd..078634461df2 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -2009,6 +2009,7 @@ static int __cmd_contention(int argc, const char **argv)
.owner = show_lock_owner,
.cgroups = RB_ROOT,
};
+ struct perf_env host_env;
lockhash_table = calloc(LOCKHASH_SIZE, sizeof(*lockhash_table));
if (!lockhash_table)
@@ -2024,7 +2025,10 @@ static int __cmd_contention(int argc, const char **argv)
eops.mmap = perf_event__process_mmap;
eops.tracing_data = perf_event__process_tracing_data;
- session = perf_session__new(use_bpf ? NULL : &data, &eops);
+ perf_env__init(&host_env);
+ session = __perf_session__new(use_bpf ? NULL : &data, &eops,
+ /*trace_event_repipe=*/false, &host_env);
+
if (IS_ERR(session)) {
pr_err("Initializing perf session failed\n");
err = PTR_ERR(session);
@@ -2142,6 +2146,7 @@ static int __cmd_contention(int argc, const char **argv)
evlist__delete(con.evlist);
lock_contention_finish(&con);
perf_session__delete(session);
+ perf_env__exit(&host_env);
zfree(&lockhash_table);
return err;
}
--
2.51.0.384.g4c02a37b29-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v1] perf lock: Provide a host_env for session new
2025-09-13 0:01 [PATCH v1] perf lock: Provide a host_env for session new Ian Rogers
@ 2025-09-13 0:48 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2025-09-13 0:48 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, linux-perf-users, linux-kernel
On Fri, Sep 12, 2025 at 05:01:29PM -0700, Ian Rogers wrote:
> When "perf lock con" is run in a live mode, with no data file, a host
> environment must be provided. Testing missed this as a failing assert
> was creating the 1 line of expected stderr output.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> Please consider this patch for v6.17 fixes.
Yep, I'll queue it to perf-tools tree.
Thanks,
Namhyung
> ---
> tools/perf/builtin-lock.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index fd49703021fd..078634461df2 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -2009,6 +2009,7 @@ static int __cmd_contention(int argc, const char **argv)
> .owner = show_lock_owner,
> .cgroups = RB_ROOT,
> };
> + struct perf_env host_env;
>
> lockhash_table = calloc(LOCKHASH_SIZE, sizeof(*lockhash_table));
> if (!lockhash_table)
> @@ -2024,7 +2025,10 @@ static int __cmd_contention(int argc, const char **argv)
> eops.mmap = perf_event__process_mmap;
> eops.tracing_data = perf_event__process_tracing_data;
>
> - session = perf_session__new(use_bpf ? NULL : &data, &eops);
> + perf_env__init(&host_env);
> + session = __perf_session__new(use_bpf ? NULL : &data, &eops,
> + /*trace_event_repipe=*/false, &host_env);
> +
> if (IS_ERR(session)) {
> pr_err("Initializing perf session failed\n");
> err = PTR_ERR(session);
> @@ -2142,6 +2146,7 @@ static int __cmd_contention(int argc, const char **argv)
> evlist__delete(con.evlist);
> lock_contention_finish(&con);
> perf_session__delete(session);
> + perf_env__exit(&host_env);
> zfree(&lockhash_table);
> return err;
> }
> --
> 2.51.0.384.g4c02a37b29-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-13 0:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 0:01 [PATCH v1] perf lock: Provide a host_env for session new Ian Rogers
2025-09-13 0:48 ` Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.