mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
perf evsel: apply evsel__set_config_if_unset() to all config fields
Misleadingly, evsel__set_config_if_unset() only works with the config field and not config1, config2, etc. This is fine at the moment because all users of it happen to operate on bits that are in that config field. Fix it before there are any new users of the function which operate on bits in different config fields. In theory it's also possible for a driver to move an existing bit to another config field and this fixes that scenario too, although this hasn't happened yet either. Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: James Clark <james.clark@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a2441cf3a5
commit
87775abac8
|
|
@ -1336,6 +1336,36 @@ void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
|
|||
struct perf_pmu_format *format = pmu_find_format(&evsel->pmu->format,
|
||||
config_name);
|
||||
int fbit;
|
||||
__u64 *vp;
|
||||
|
||||
if (!format)
|
||||
return;
|
||||
|
||||
switch (format->value) {
|
||||
case PERF_PMU_FORMAT_VALUE_CONFIG:
|
||||
term = evsel__get_config_term(evsel, USR_CHG_CONFIG);
|
||||
vp = &evsel->core.attr.config;
|
||||
break;
|
||||
case PERF_PMU_FORMAT_VALUE_CONFIG1:
|
||||
term = evsel__get_config_term(evsel, USR_CHG_CONFIG1);
|
||||
vp = &evsel->core.attr.config1;
|
||||
break;
|
||||
case PERF_PMU_FORMAT_VALUE_CONFIG2:
|
||||
term = evsel__get_config_term(evsel, USR_CHG_CONFIG2);
|
||||
vp = &evsel->core.attr.config2;
|
||||
break;
|
||||
case PERF_PMU_FORMAT_VALUE_CONFIG3:
|
||||
term = evsel__get_config_term(evsel, USR_CHG_CONFIG3);
|
||||
vp = &evsel->core.attr.config3;
|
||||
break;
|
||||
case PERF_PMU_FORMAT_VALUE_CONFIG4:
|
||||
term = evsel__get_config_term(evsel, USR_CHG_CONFIG4);
|
||||
vp = &evsel->core.attr.config4;
|
||||
break;
|
||||
default:
|
||||
pr_err("Unknown format value: %d\n", format->value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!format)
|
||||
return;
|
||||
|
|
@ -1349,7 +1379,7 @@ void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
|
|||
return;
|
||||
|
||||
/* Otherwise replace it */
|
||||
pmu_format_value(format->bits, val, &evsel->core.attr.config, /*zero=*/true);
|
||||
pmu_format_value(format->bits, val, vp, /*zero=*/true);
|
||||
}
|
||||
|
||||
void __weak arch_evsel__set_sample_weight(struct evsel *evsel)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user