Commit d4affd6b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'perf-tools-fixes-for-v5.14-2021-08-01' of...

Merge tag 'perf-tools-fixes-for-v5.14-2021-08-01' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Revert "perf map: Fix dso->nsinfo refcounting", this makes 'perf top'
   abort, uncovering a design flaw on how namespace information is kept.
   The fix for that is more than we can do right now, leave it for the
   next merge window.

 - Split --dump-raw-trace by AUX records for ARM's CoreSight, fixing up
   the decoding of some records.

 - Fix PMU alias matching.

Thanks to James Clark and John Garry for these fixes.

* tag 'perf-tools-fixes-for-v5.14-2021-08-01' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  Revert "perf map: Fix dso->nsinfo refcounting"
  perf pmu: Fix alias matching
  perf cs-etm: Split --dump-raw-trace by AUX records
parents c82357a7 9bac1bd6
......@@ -2434,6 +2434,22 @@ static int cs_etm__process_event(struct perf_session *session,
return 0;
}
static void dump_queued_data(struct cs_etm_auxtrace *etm,
struct perf_record_auxtrace *event)
{
struct auxtrace_buffer *buf;
unsigned int i;
/*
* Find all buffers with same reference in the queues and dump them.
* This is because the queues can contain multiple entries of the same
* buffer that were split on aux records.
*/
for (i = 0; i < etm->queues.nr_queues; ++i)
list_for_each_entry(buf, &etm->queues.queue_array[i].head, list)
if (buf->reference == event->reference)
cs_etm__dump_event(etm, buf);
}
static int cs_etm__process_auxtrace_event(struct perf_session *session,
union perf_event *event,
struct perf_tool *tool __maybe_unused)
......@@ -2466,7 +2482,8 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session,
cs_etm__dump_event(etm, buffer);
auxtrace_buffer__put_data(buffer);
}
}
} else if (dump_trace)
dump_queued_data(etm, &event->auxtrace);
return 0;
}
......@@ -3042,7 +3059,6 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
if (dump_trace) {
cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
return 0;
}
err = cs_etm__synth_events(etm, session);
......
......@@ -192,8 +192,6 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
if (!(prot & PROT_EXEC))
dso__set_loaded(dso);
}
nsinfo__put(dso->nsinfo);
dso->nsinfo = nsi;
if (build_id__is_defined(bid))
......
......@@ -742,9 +742,13 @@ struct pmu_events_map *__weak pmu_events_map__find(void)
return perf_pmu__find_map(NULL);
}
static bool perf_pmu__valid_suffix(char *pmu_name, char *tok)
/*
* Suffix must be in form tok_{digits}, or tok{digits}, or same as pmu_name
* to be valid.
*/
static bool perf_pmu__valid_suffix(const char *pmu_name, char *tok)
{
char *p;
const char *p;
if (strncmp(pmu_name, tok, strlen(tok)))
return false;
......@@ -753,12 +757,16 @@ static bool perf_pmu__valid_suffix(char *pmu_name, char *tok)
if (*p == 0)
return true;
if (*p != '_')
return false;
if (*p == '_')
++p;
++p;
if (*p == 0 || !isdigit(*p))
return false;
/* Ensure we end in a number */
while (1) {
if (!isdigit(*p))
return false;
if (*(++p) == 0)
break;
}
return true;
}
......@@ -789,12 +797,19 @@ bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
* match "socket" in "socketX_pmunameY" and then "pmuname" in
* "pmunameY".
*/
for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
while (1) {
char *next_tok = strtok_r(NULL, ",", &tmp);
name = strstr(name, tok);
if (!name || !perf_pmu__valid_suffix((char *)name, tok)) {
if (!name ||
(!next_tok && !perf_pmu__valid_suffix(name, tok))) {
res = false;
goto out;
}
if (!next_tok)
break;
tok = next_tok;
name += strlen(tok);
}
res = true;
......
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