Commit ee33a0ef authored by Athira Rajeev's avatar Athira Rajeev Committed by Namhyung Kim

perf test: Fix parse-events tests to skip parametrized events

Testcase "Parsing of all PMU events from sysfs" parse events for
all PMUs, and not just cpu. In case of powerpc, the PowerVM
environment supports events from hv_24x7 and hv_gpci PMU which
is of example format like below:

- hv_24x7/CPM_ADJUNCT_INST,domain=?,core=?/
- hv_gpci/event,partition_id=?/

The value for "?" needs to be filled in depending on system
configuration. It is better to skip these parametrized events
in this test as it is done in:
'commit b50d691e ("perf test: Fix "all PMU test" to skip
parametrized events")' which handled a simialr instance with
"all PMU test".

Fix parse-events test to skip parametrized events since
it needs proper setup of the parameters.
Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: default avatarIan Rogers <irogers@google.com>
Tested-by: default avatarSachin Sant <sachinp@linux.ibm.com>
Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230927181703.80936-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 4f3ee7d1
...@@ -2514,9 +2514,14 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest ...@@ -2514,9 +2514,14 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest
while ((pmu = perf_pmus__scan(pmu)) != NULL) { while ((pmu = perf_pmus__scan(pmu)) != NULL) {
struct stat st; struct stat st;
char path[PATH_MAX]; char path[PATH_MAX];
char pmu_event[PATH_MAX];
char *buf = NULL;
FILE *file;
struct dirent *ent; struct dirent *ent;
size_t len = 0;
DIR *dir; DIR *dir;
int err; int err;
int n;
snprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/events/", snprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/events/",
sysfs__mountpoint(), pmu->name); sysfs__mountpoint(), pmu->name);
...@@ -2538,11 +2543,45 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest ...@@ -2538,11 +2543,45 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest
struct evlist_test e = { .name = NULL, }; struct evlist_test e = { .name = NULL, };
char name[2 * NAME_MAX + 1 + 12 + 3]; char name[2 * NAME_MAX + 1 + 12 + 3];
int test_ret; int test_ret;
bool is_event_parameterized = 0;
/* Names containing . are special and cannot be used directly */ /* Names containing . are special and cannot be used directly */
if (strchr(ent->d_name, '.')) if (strchr(ent->d_name, '.'))
continue; continue;
/* exclude parametrized ones (name contains '?') */
n = snprintf(pmu_event, sizeof(pmu_event), "%s%s", path, ent->d_name);
if (n >= PATH_MAX) {
pr_err("pmu event name crossed PATH_MAX(%d) size\n", PATH_MAX);
continue;
}
file = fopen(pmu_event, "r");
if (!file) {
pr_debug("can't open pmu event file for '%s'\n", ent->d_name);
ret = combine_test_results(ret, TEST_FAIL);
continue;
}
if (getline(&buf, &len, file) < 0) {
pr_debug(" pmu event: %s is a null event\n", ent->d_name);
ret = combine_test_results(ret, TEST_FAIL);
fclose(file);
continue;
}
if (strchr(buf, '?'))
is_event_parameterized = 1;
free(buf);
buf = NULL;
fclose(file);
if (is_event_parameterized == 1) {
pr_debug("skipping parametrized PMU event: %s which contains ?\n", pmu_event);
continue;
}
snprintf(name, sizeof(name), "%s/event=%s/u", pmu->name, ent->d_name); snprintf(name, sizeof(name), "%s/event=%s/u", pmu->name, ent->d_name);
e.name = name; e.name = name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment