diff options
author | Ian Rogers <irogers@google.com> | 2024-11-20 16:09:55 -0800 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-11-22 13:38:39 -0800 |
commit | 6d78089da9805787a72e52604ad4b2ed7380be3f (patch) | |
tree | 97d7b72b1ed5d07380b4e008535a647b3e54df41 /tools/perf/util | |
parent | 62878b400f5b02416368eda361277c045c675466 (diff) | |
download | linux-stable-6d78089da9805787a72e52604ad4b2ed7380be3f.tar.gz linux-stable-6d78089da9805787a72e52604ad4b2ed7380be3f.tar.bz2 linux-stable-6d78089da9805787a72e52604ad4b2ed7380be3f.zip |
perf tests: Fix hwmon parsing with PMU name test
Incorrectly the hwmon with PMU name test didn't pass "true". Fix and
address issue with hwmon_pmu__config_terms needing to load events - a
load bearing assert fired. Also fix missing list deletion when putting
the hwmon test PMU and lower some debug warnings to make the hwmon PMU
less spammy in verbose mode.
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20241121000955.536930-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/hwmon_pmu.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c index 4d9d6f405434..e61429b38ba7 100644 --- a/tools/perf/util/hwmon_pmu.c +++ b/tools/perf/util/hwmon_pmu.c @@ -197,13 +197,13 @@ bool parse_hwmon_filename(const char *filename, } } if (fn_item == NULL || fn_type[0] == '\0' || (item != NULL && fn_item[0] == '\0')) { - pr_debug("hwmon_pmu: not a hwmon file '%s'\n", filename); + pr_debug3("hwmon_pmu: not a hwmon file '%s'\n", filename); return false; } elem = bsearch(&fn_type, hwmon_type_strs + 1, ARRAY_SIZE(hwmon_type_strs) - 1, sizeof(hwmon_type_strs[0]), hwmon_strcmp); if (!elem) { - pr_debug("hwmon_pmu: not a hwmon type '%s' in file name '%s'\n", + pr_debug3("hwmon_pmu: not a hwmon type '%s' in file name '%s'\n", fn_type, filename); return false; } @@ -223,7 +223,7 @@ bool parse_hwmon_filename(const char *filename, elem = bsearch(fn_item, hwmon_item_strs + 1, ARRAY_SIZE(hwmon_item_strs) - 1, sizeof(hwmon_item_strs[0]), hwmon_strcmp); if (!elem) { - pr_debug("hwmon_pmu: not a hwmon item '%s' in file name '%s'\n", + pr_debug3("hwmon_pmu: not a hwmon item '%s' in file name '%s'\n", fn_item, filename); return false; } @@ -281,7 +281,7 @@ static int hwmon_pmu__read_events(struct hwmon_pmu *pmu) continue; if (!parse_hwmon_filename(ent->d_name, &type, &number, &item, &alarm)) { - pr_debug("Not a hwmon file '%s'\n", ent->d_name); + pr_debug3("Not a hwmon file '%s'\n", ent->d_name); continue; } key.num = number; @@ -653,10 +653,14 @@ int hwmon_pmu__config_terms(const struct perf_pmu *pmu, struct parse_events_terms *terms, struct parse_events_error *err) { - const struct hwmon_pmu *hwm = container_of(pmu, struct hwmon_pmu, pmu); + struct hwmon_pmu *hwm = container_of(pmu, struct hwmon_pmu, pmu); struct parse_events_term *term; + int ret; + + ret = hwmon_pmu__read_events(hwm); + if (ret) + return ret; - assert(pmu->sysfs_aliases_loaded); list_for_each_entry(term, &terms->terms, list) { if (hwmon_pmu__config_term(hwm, attr, term, err)) return -EINVAL; |