perf mem: Clean up perf_mem_events__ptr()
authorKan Liang <kan.liang@linux.intel.com>
Tue, 23 Jan 2024 18:50:31 +0000 (10:50 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 24 Jan 2024 22:04:02 +0000 (14:04 -0800)
commita30450e6a43b7f4b4df9bb3eb7dfaebd96f09682
tree3517e374d10d606334bb816f3eeb0c92d2e559af
parentbb65acdc832ec84fa42d752c50247e968381d057
perf mem: Clean up perf_mem_events__ptr()

The mem_events can be retrieved from the struct perf_pmu now. An ARCH
specific perf_mem_events__ptr() is not required anymore. Remove all of
them.

The Intel hybrid has multiple mem-events-supported PMUs. But they share
the same mem_events. Other ARCHs only support one mem-events-supported
PMU. In the configuration, it's good enough to only configure the
mem_events for one PMU. Add perf_mem_events_find_pmu() which returns the
first mem-events-supported PMU.

In the perf_mem_events__init(), the perf_pmus__scan() is not required
anymore. It avoids checking the sysfs for every PMU on the system.

Make the perf_mem_events__record_args() more generic. Remove the
perf_mem_events__print_unsupport_hybrid().

Since pmu is added as a new parameter, rename perf_mem_events__ptr() to
perf_pmu__mem_events_ptr(). Several other functions also do a similar
rename.

Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Tested-by: Ravi Bangoria <ravi.bangoria@amd.com>
Tested-by: Kajol jain <kjain@linux.ibm.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Cc: james.clark@arm.com
Cc: will@kernel.org
Cc: leo.yan@linaro.org
Cc: mike.leach@linaro.org
Cc: renyu.zj@linux.alibaba.com
Cc: yuhaixin.yhx@linux.alibaba.com
Cc: tmricht@linux.ibm.com
Cc: atrajeev@linux.vnet.ibm.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: john.g.garry@oracle.com
Link: https://lore.kernel.org/r/20240123185036.3461837-3-kan.liang@linux.intel.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/arch/arm64/util/mem-events.c
tools/perf/arch/x86/util/mem-events.c
tools/perf/builtin-c2c.c
tools/perf/builtin-mem.c
tools/perf/util/mem-events.c
tools/perf/util/mem-events.h