perf trace: Fix exclusion of not available syscall names from selector list

We were just skipping the syscalls not available in a particular
architecture without reflecting this in the number of entries in the
ev_qualifier_ids.nr variable, fix it.

This was done with the most minimalistic way, reusing the index variable
'i', a followup patch will further clean this by making 'i' renamed to
'nr_used' and using 'nr_allocated' in a few more places.
Reported-by: default avatarLeo Yan <leo.yan@linaro.org>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Fixes: 04c41bcb ("perf trace: Skip unknown syscalls when expanding strace like syscall groups")
Link: https://lkml.kernel.org/r/20190613181514.GC1402@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4541a8bb
...@@ -1527,9 +1527,9 @@ static int trace__read_syscall_info(struct trace *trace, int id) ...@@ -1527,9 +1527,9 @@ static int trace__read_syscall_info(struct trace *trace, int id)
static int trace__validate_ev_qualifier(struct trace *trace) static int trace__validate_ev_qualifier(struct trace *trace)
{ {
int err = 0, i; int err = 0;
bool printed_invalid_prefix = false; bool printed_invalid_prefix = false;
size_t nr_allocated; size_t nr_allocated, i;
struct str_node *pos; struct str_node *pos;
trace->ev_qualifier_ids.nr = strlist__nr_entries(trace->ev_qualifier); trace->ev_qualifier_ids.nr = strlist__nr_entries(trace->ev_qualifier);
...@@ -1574,7 +1574,7 @@ static int trace__validate_ev_qualifier(struct trace *trace) ...@@ -1574,7 +1574,7 @@ static int trace__validate_ev_qualifier(struct trace *trace)
id = syscalltbl__strglobmatch_next(trace->sctbl, sc, &match_next); id = syscalltbl__strglobmatch_next(trace->sctbl, sc, &match_next);
if (id < 0) if (id < 0)
break; break;
if (nr_allocated == trace->ev_qualifier_ids.nr) { if (nr_allocated == i) {
void *entries; void *entries;
nr_allocated += 8; nr_allocated += 8;
...@@ -1587,11 +1587,11 @@ static int trace__validate_ev_qualifier(struct trace *trace) ...@@ -1587,11 +1587,11 @@ static int trace__validate_ev_qualifier(struct trace *trace)
} }
trace->ev_qualifier_ids.entries = entries; trace->ev_qualifier_ids.entries = entries;
} }
trace->ev_qualifier_ids.nr++;
trace->ev_qualifier_ids.entries[i++] = id; trace->ev_qualifier_ids.entries[i++] = id;
} }
} }
trace->ev_qualifier_ids.nr = i;
out: out:
if (printed_invalid_prefix) if (printed_invalid_prefix)
pr_debug("\n"); pr_debug("\n");
......
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