mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
perf env: Remove global perf_env
The global perf_env was used for the host, but if a perf_env wasn't easy to come by it was used in a lot of places where potentially recorded and host data could be confused. Remove the global variable as now the majority of accesses retrieve the perf_env for the host from the session. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250724163302.596743-20-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
003a86bce0
commit
525a599bad
|
|
@ -346,12 +346,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
|
||||||
use_pager = 1;
|
use_pager = 1;
|
||||||
commit_pager_choice();
|
commit_pager_choice();
|
||||||
|
|
||||||
perf_env__init(&perf_env);
|
|
||||||
perf_env__set_cmdline(&perf_env, argc, argv);
|
|
||||||
status = p->fn(argc, argv);
|
status = p->fn(argc, argv);
|
||||||
perf_config__exit();
|
perf_config__exit();
|
||||||
exit_browser(status);
|
exit_browser(status);
|
||||||
perf_env__exit(&perf_env);
|
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
return status & 0xff;
|
return status & 0xff;
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
|
||||||
* for perf-record and perf-report use header.env;
|
* for perf-record and perf-report use header.env;
|
||||||
* otherwise, use global perf_env.
|
* otherwise, use global perf_env.
|
||||||
*/
|
*/
|
||||||
env = session->data ? perf_session__env(session) : &perf_env;
|
env = perf_session__env(session);
|
||||||
|
|
||||||
arrays = 1UL << PERF_BPIL_JITED_KSYMS;
|
arrays = 1UL << PERF_BPIL_JITED_KSYMS;
|
||||||
arrays |= 1UL << PERF_BPIL_JITED_FUNC_LENS;
|
arrays |= 1UL << PERF_BPIL_JITED_FUNC_LENS;
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "trace/beauty/beauty.h"
|
#include "trace/beauty/beauty.h"
|
||||||
|
|
||||||
struct perf_env perf_env;
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBBPF_SUPPORT
|
#ifdef HAVE_LIBBPF_SUPPORT
|
||||||
#include "bpf-event.h"
|
#include "bpf-event.h"
|
||||||
#include "bpf-utils.h"
|
#include "bpf-utils.h"
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,6 @@ enum perf_compress_type {
|
||||||
struct bpf_prog_info_node;
|
struct bpf_prog_info_node;
|
||||||
struct btf_node;
|
struct btf_node;
|
||||||
|
|
||||||
extern struct perf_env perf_env;
|
|
||||||
|
|
||||||
int perf_env__read_core_pmu_caps(struct perf_env *env);
|
int perf_env__read_core_pmu_caps(struct perf_env *env);
|
||||||
void perf_env__exit(struct perf_env *env);
|
void perf_env__exit(struct perf_env *env);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3882,7 +3882,7 @@ struct perf_env *evsel__env(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
struct perf_session *session = evsel__session(evsel);
|
struct perf_session *session = evsel__session(evsel);
|
||||||
|
|
||||||
return session ? perf_session__env(session) : &perf_env;
|
return session ? perf_session__env(session) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
|
static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,8 @@ struct perf_session *__perf_session__new(struct perf_data *data,
|
||||||
symbol_conf.kallsyms_name = perf_data__kallsyms_name(data);
|
symbol_conf.kallsyms_name = perf_data__kallsyms_name(data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
session->machines.host.env = host_env ?: &perf_env;
|
assert(host_env != NULL);
|
||||||
|
session->machines.host.env = host_env;
|
||||||
}
|
}
|
||||||
if (session->evlist)
|
if (session->evlist)
|
||||||
session->evlist->session = session;
|
session->evlist->session = session;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user