mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
perf arm-spe: Don't warn about the discard bit if it doesn't exist
Opening an SPE event shows a warning that doesn't concern the user: $ perf record -e arm_spe Unknown/empty format name: discard Perf only wants to know if the discard bit is set for configuring the event, not in response to anything the user has done. Fix it by adding another helper that returns if a config bit exists without warning. We should probably keep the warning in evsel__get_config_val() to avoid having every caller having to do it, and most format bits should never be missing. Add a test for the new helper. Rename the parent test function to be more generic rather than adding a new one as it requires a lot of boilerplate. Reviewed-by: Ian Rogers <irogers@google.com> Reviewed-by: Leo Yan <leo.yan@arm.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: Will Deacon <will@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
167bef4df6
commit
83eff458a6
@@ -428,7 +428,8 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
|
||||
evlist__for_each_entry_safe(evlist, tmp, evsel) {
|
||||
if (evsel__is_aux_event(evsel)) {
|
||||
arm_spe_setup_evsel(evsel, cpus);
|
||||
if (!evsel__get_config_val(evsel, "discard", &discard_bit))
|
||||
if (evsel__config_exists(evsel, "discard") &&
|
||||
!evsel__get_config_val(evsel, "discard", &discard_bit))
|
||||
discard = !!discard_bit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,8 @@ static int test__pmu_format(struct test_suite *test __maybe_unused, int subtest
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test__pmu_usr_chgs(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
|
||||
static int test__pmu_config_helpers(struct test_suite *test __maybe_unused,
|
||||
int subtest __maybe_unused)
|
||||
{
|
||||
const char *event = "perf-pmu-test/config=15,config1=4,krava02=170,"
|
||||
"krava03=1,krava11=27,krava12=1/";
|
||||
@@ -236,6 +237,12 @@ static int test__pmu_usr_chgs(struct test_suite *test __maybe_unused, int subtes
|
||||
}
|
||||
evsel = evlist__first(evlist);
|
||||
|
||||
/* Test evsel__config_exists() */
|
||||
TEST_ASSERT_EQUAL("krava01 should exist",
|
||||
evsel__config_exists(evsel, "krava01"), true);
|
||||
TEST_ASSERT_EQUAL("krava99 should not exist",
|
||||
evsel__config_exists(evsel, "krava99"), false);
|
||||
|
||||
/*
|
||||
* Set via config=15, krava01 bits 0-1
|
||||
* Set via config1=4, krava11 bit 1
|
||||
@@ -629,7 +636,7 @@ static struct test_case tests__pmu[] = {
|
||||
TEST_CASE("PMU name combining", name_len),
|
||||
TEST_CASE("PMU name comparison", name_cmp),
|
||||
TEST_CASE("PMU cmdline match", pmu_match),
|
||||
TEST_CASE("PMU user config changes", pmu_usr_chgs),
|
||||
TEST_CASE("PMU config helpers", pmu_config_helpers),
|
||||
{ .name = NULL, }
|
||||
};
|
||||
|
||||
|
||||
@@ -1399,6 +1399,12 @@ void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
|
||||
perf_pmu__format_pack(format->bits, val, vp, /*zero=*/true);
|
||||
}
|
||||
|
||||
bool evsel__config_exists(const struct evsel *evsel, const char *config_name)
|
||||
{
|
||||
struct perf_pmu_format *format = pmu_find_format(&evsel->pmu->format, config_name);
|
||||
|
||||
return format && !bitmap_empty(format->bits, PERF_PMU_FORMAT_BITS);
|
||||
}
|
||||
|
||||
int evsel__get_config_val(const struct evsel *evsel, const char *config_name,
|
||||
u64 *val)
|
||||
|
||||
@@ -589,6 +589,7 @@ void evsel__uniquify_counter(struct evsel *counter);
|
||||
((((src) >> (pos)) & ((1ull << (size)) - 1)) << (63 - ((pos) + (size) - 1)))
|
||||
|
||||
u64 evsel__bitfield_swap_branch_flags(u64 value);
|
||||
bool evsel__config_exists(const struct evsel *evsel, const char *config_name);
|
||||
int evsel__get_config_val(const struct evsel *evsel, const char *config_name,
|
||||
u64 *val);
|
||||
void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
|
||||
|
||||
Reference in New Issue
Block a user