mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
synced 2025-09-13 15:43:39 +10:00
The PMU name could be NULL in the case of the fake_pmu. Initialize the name for the fake_pmu to "fake" so that all other logic can assume it is initialized. Add a const to the type of name so that a literal can be used to avoid additional initialization code. Propagate the cost through related routines and remove now unnecessary "(char *)" casts. Doing this located a bug in builtin-list for the pmu_glob that was missing a strdup. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20230825024002.801955-3-irogers@google.com Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: James Clark <james.clark@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Wei Li <liwei391@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: Ming Wang <wangming01@loongson.cn> Cc: John Garry <john.g.garry@oracle.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include "map_symbol.h"
|
|
#include "mem-events.h"
|
|
|
|
#define E(t, n, s) { .tag = t, .name = n, .sysfs_name = s }
|
|
|
|
static struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
|
|
E("spe-load", "arm_spe_0/ts_enable=1,pa_enable=1,load_filter=1,store_filter=0,min_latency=%u/", "arm_spe_0"),
|
|
E("spe-store", "arm_spe_0/ts_enable=1,pa_enable=1,load_filter=0,store_filter=1/", "arm_spe_0"),
|
|
E("spe-ldst", "arm_spe_0/ts_enable=1,pa_enable=1,load_filter=1,store_filter=1,min_latency=%u/", "arm_spe_0"),
|
|
};
|
|
|
|
static char mem_ev_name[100];
|
|
|
|
struct perf_mem_event *perf_mem_events__ptr(int i)
|
|
{
|
|
if (i >= PERF_MEM_EVENTS__MAX)
|
|
return NULL;
|
|
|
|
return &perf_mem_events[i];
|
|
}
|
|
|
|
const char *perf_mem_events__name(int i, const char *pmu_name __maybe_unused)
|
|
{
|
|
struct perf_mem_event *e = perf_mem_events__ptr(i);
|
|
|
|
if (i >= PERF_MEM_EVENTS__MAX)
|
|
return NULL;
|
|
|
|
if (i == PERF_MEM_EVENTS__LOAD || i == PERF_MEM_EVENTS__LOAD_STORE)
|
|
scnprintf(mem_ev_name, sizeof(mem_ev_name),
|
|
e->name, perf_mem_events__loads_ldlat);
|
|
else /* PERF_MEM_EVENTS__STORE */
|
|
scnprintf(mem_ev_name, sizeof(mem_ev_name), e->name);
|
|
|
|
return mem_ev_name;
|
|
}
|