[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXexLBnq1pkHPR5uXR-bL3CFTzEWkFnxHVs-71+S0yZSg@mail.gmail.com>
Date: Thu, 24 Aug 2023 21:51:22 -0700
From: Ian Rogers <irogers@...gle.com>
To: Yang Jihong <yangjihong1@...wei.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, namhyung@...nel.org, adrian.hunter@...el.com,
kan.liang@...ux.intel.com, james.clark@....com,
tmricht@...ux.ibm.com, ak@...ux.intel.com,
anshuman.khandual@....com, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v6 1/7] perf evlist: Add perf_evlist__go_system_wide() helper
On Sun, Aug 20, 2023 at 6:30 PM Yang Jihong <yangjihong1@...wei.com> wrote:
>
> For dummy events that keep tracking, we may need to modify its cpu_maps.
> For example, change the cpu_maps to record sideband events for all CPUS.
> Add perf_evlist__go_system_wide() helper to support this scenario.
>
> Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
> Acked-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> tools/lib/perf/evlist.c | 9 +++++++++
> tools/lib/perf/include/internal/evlist.h | 2 ++
> 2 files changed, 11 insertions(+)
>
> diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
> index b8b066d0dc5e..3acbbccc1901 100644
> --- a/tools/lib/perf/evlist.c
> +++ b/tools/lib/perf/evlist.c
> @@ -738,3 +738,12 @@ int perf_evlist__nr_groups(struct perf_evlist *evlist)
> }
> return nr_groups;
> }
> +
> +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel)
> +{
> + if (!evsel->system_wide) {
> + evsel->system_wide = true;
> + if (evlist->needs_map_propagation)
> + __perf_evlist__propagate_maps(evlist, evsel);
> + }
> +}
I think this should be:
void evsel__set_system_wide(struct evsel *evsel)
{
if (evsel->system_wide)
return;
evsel->system_wide = true;
if (evsel->evlist->core.needs_map_propagation)
...
The API being on evlist makes it look like all evsels are affected.
Thanks,
Ian
> diff --git a/tools/lib/perf/include/internal/evlist.h b/tools/lib/perf/include/internal/evlist.h
> index 3339bc2f1765..d86ffe8ed483 100644
> --- a/tools/lib/perf/include/internal/evlist.h
> +++ b/tools/lib/perf/include/internal/evlist.h
> @@ -135,4 +135,6 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist,
> void perf_evlist__reset_id_hash(struct perf_evlist *evlist);
>
> void __perf_evlist__set_leader(struct list_head *list, struct perf_evsel *leader);
> +
> +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel);
> #endif /* __LIBPERF_INTERNAL_EVLIST_H */
> --
> 2.30.GIT
>
Powered by blists - more mailing lists