The mrvl_ddr_pmu is uncore and has a hexadecimal address suffix while the previous PMU sorting/merging code assumes uncore PMU names start with uncore_ and have a decimal suffix. Because of the previous assumption it isn't possible to wildcard the mrvl_ddr_pmu. Modify pmu_name_len_no_suffix but also remove the suffix number out argument, this is because we don't know if a suffix number of say 100 is in hexadecimal or decimal. As the only use of the suffix number is in comparisons, it is safe there to compare the values as hexadecimal. Modify perf_pmu__match_ignoring_suffix so that hexadecimal suffixes are ignored. Only allow hexadecimal suffixes to be greater than length 2 (ie 3 or more) so that S390's cpum_cf PMU doesn't lose its suffix. Change the return type of pmu_name_len_no_suffix to size_t to workaround GCC incorrectly determining the result could be negative. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: James Clark <james.clark@arm.com> Cc: Robin Murphy <robin.murphy@arm.com> Cc: Stephane Eranian <eranian@google.com> Cc: Will Deacon <will@kernel.org> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Bharat Bhushan <bbhushan2@marvell.com> Cc: Bhaskara Budiredla <bbudiredla@marvell.com> Cc: Tuan Phan <tuanphan@os.amperecomputing.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240515060114.3268149-2-irogers@google.com
34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PMUS_H
|
|
#define __PMUS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
struct perf_pmu;
|
|
struct print_callbacks;
|
|
|
|
size_t pmu_name_len_no_suffix(const char *str);
|
|
/* Exposed for testing only. */
|
|
int pmu_name_cmp(const char *lhs_pmu_name, const char *rhs_pmu_name);
|
|
|
|
void perf_pmus__destroy(void);
|
|
|
|
struct perf_pmu *perf_pmus__find(const char *name);
|
|
struct perf_pmu *perf_pmus__find_by_type(unsigned int type);
|
|
|
|
struct perf_pmu *perf_pmus__scan(struct perf_pmu *pmu);
|
|
struct perf_pmu *perf_pmus__scan_core(struct perf_pmu *pmu);
|
|
|
|
const struct perf_pmu *perf_pmus__pmu_for_pmu_filter(const char *str);
|
|
|
|
void perf_pmus__print_pmu_events(const struct print_callbacks *print_cb, void *print_state);
|
|
void perf_pmus__print_raw_pmu_events(const struct print_callbacks *print_cb, void *print_state);
|
|
bool perf_pmus__have_event(const char *pname, const char *name);
|
|
int perf_pmus__num_core_pmus(void);
|
|
bool perf_pmus__supports_extended_type(void);
|
|
char *perf_pmus__default_pmu_name(void);
|
|
|
|
struct perf_pmu *perf_pmus__add_test_pmu(int test_sysfs_dirfd, const char *name);
|
|
|
|
#endif /* __PMUS_H */
|