diff options
author | Ingo Molnar <mingo@kernel.org> | 2021-03-29 15:56:48 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-03-29 15:56:48 +0200 |
commit | feecb81732d8f271440d907beb082425e109f877 (patch) | |
tree | af55ca33d43cf3b3c2b82e9860df7d01be061a0f /tools/perf/util/pmu.c | |
parent | MAINTAINERS: Add myself as futex reviewer (diff) | |
parent | Linux 5.12-rc5 (diff) | |
download | wireguard-linux-feecb81732d8f271440d907beb082425e109f877.tar.xz wireguard-linux-feecb81732d8f271440d907beb082425e109f877.zip |
Merge tag 'v5.12-rc5' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/pmu.c')
-rw-r--r-- | tools/perf/util/pmu.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 44ef28302fc7..46fd0f998484 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1812,3 +1812,36 @@ int perf_pmu__caps_parse(struct perf_pmu *pmu) return nr_caps; } + +void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, + char *name) +{ + struct perf_pmu_format *format; + __u64 masks = 0, bits; + char buf[100]; + unsigned int i; + + list_for_each_entry(format, &pmu->format, list) { + if (format->value != PERF_PMU_FORMAT_VALUE_CONFIG) + continue; + + for_each_set_bit(i, format->bits, PERF_PMU_FORMAT_BITS) + masks |= 1ULL << i; + } + + /* + * Kernel doesn't export any valid format bits. + */ + if (masks == 0) + return; + + bits = config & ~masks; + if (bits == 0) + return; + + bitmap_scnprintf((unsigned long *)&bits, sizeof(bits) * 8, buf, sizeof(buf)); + + pr_warning("WARNING: event '%s' not valid (bits %s of config " + "'%llx' not supported by kernel)!\n", + name ?: "N/A", buf, config); +} |