Commit 97e9c8eb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'perf-tools-fixes-for-v5.17-2022-03-19' of...

Merge tag 'perf-tools-fixes-for-v5.17-2022-03-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Avoid iterating empty evlist, fixing a segfault with 'perf stat --null'

 - Ignore case in topdown.slots check, fixing issue with Intel Icelake
   JSON metrics.

 - Fix symbol size calculation condition for fixing up corner case
   symbol end address obtained from Kallsyms.

* tag 'perf-tools-fixes-for-v5.17-2022-03-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf parse-events: Ignore case in topdown.slots check
  perf evlist: Avoid iteration for empty evlist.
  perf symbols: Fix symbol size calculation condition
parents ba6354f6 7bd1da15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct evsel *arch_evlist__leader(struct list_head *list)

	__evlist__for_each_entry(list, evsel) {
		if (evsel->pmu_name && !strcmp(evsel->pmu_name, "cpu") &&
			evsel->name && strstr(evsel->name, "slots"))
			evsel->name && strcasestr(evsel->name, "slots"))
			return evsel;
	}
	return first;
+17 −11
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ struct evlist_cpu_iterator evlist__cpu_begin(struct evlist *evlist, struct affin
{
	struct evlist_cpu_iterator itr = {
		.container = evlist,
		.evsel = evlist__first(evlist),
		.evsel = NULL,
		.cpu_map_idx = 0,
		.evlist_cpu_map_idx = 0,
		.evlist_cpu_map_nr = perf_cpu_map__nr(evlist->core.all_cpus),
@@ -354,17 +354,23 @@ struct evlist_cpu_iterator evlist__cpu_begin(struct evlist *evlist, struct affin
		.affinity = affinity,
	};

	if (evlist__empty(evlist)) {
		/* Ensure the empty list doesn't iterate. */
		itr.evlist_cpu_map_idx = itr.evlist_cpu_map_nr;
	} else {
		itr.evsel = evlist__first(evlist);
		if (itr.affinity) {
			itr.cpu = perf_cpu_map__cpu(evlist->core.all_cpus, 0);
			affinity__set(itr.affinity, itr.cpu.cpu);
			itr.cpu_map_idx = perf_cpu_map__idx(itr.evsel->core.cpus, itr.cpu);
			/*
		 * If this CPU isn't in the evsel's cpu map then advance through
		 * the list.
			 * If this CPU isn't in the evsel's cpu map then advance
			 * through the list.
			 */
			if (itr.cpu_map_idx == -1)
				evlist_cpu_iterator__next(&itr);
		}
	}
	return itr;
}

+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ void symbols__fixup_end(struct rb_root_cached *symbols)
		prev = curr;
		curr = rb_entry(nd, struct symbol, rb_node);

		if (prev->end == prev->start && prev->end != curr->start)
		if (prev->end == prev->start || prev->end != curr->start)
			arch__symbols__fixup_end(prev, curr);
	}