linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] libperf: evlist: Fix --cpu argument on hybrid platform
@ 2024-10-15 14:54 James Clark
  2024-10-15 14:54 ` [RFC PATCH 1/1] " James Clark
  0 siblings, 1 reply; 10+ messages in thread
From: James Clark @ 2024-10-15 14:54 UTC (permalink / raw)
  To: linux-perf-users, acme, namhyung, irogers
  Cc: James Clark, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Liang, Kan,
	linux-kernel

I noticed that this isn't working on Arm or Intel, and I've attached a
hack that I don't really think is the right fix but it does work. It's
not strictly a regression from the linked fixes: commit, as before that
events wouldn't be opened on multiple PMUs properly. But after it the
error becomes more fatal.

Posting the RFC because whatever the fix should be isn't straightforward
and probably needs discussion. I think similar things have been
discussed before about the empty cpumap issue, but not related to the
--cpu option.

I thought of a few possible fixes:

 * Don't open "empty" CPU maps in Perf. This would make Perf and libperf
   diverge. Also not sure if libperf is supposed to be backwards
   compatible? But this would be a breaking change because someone might
   be using empty == all deliberately.

 * Prune the evlist for empty CPU maps in every tool in Perf. This isn't
   great because users of libperf also have to do this and is a lot of
   duplication in Perf.

 * Use cpumap->nr == 0 for empty instead of cpumap == NULL

One issue with the attached fix is that you can only delete the core
evsel from within libperf and not Perf's part of it. Also maybe it's a
bit weird for the propagate function to start deleting things.

For reference the empty to any code is here:

static int __evsel__prepare_open(...)
	if (cpus == NULL) {
		if (empty_cpu_map == NULL) {
			empty_cpu_map = perf_cpu_map__new_any_cpu();
			if (empty_cpu_map == NULL)
				return -ENOMEM;
		}

		cpus = empty_cpu_map;
	}
 
James Clark (1):
  libperf: evlist: Fix --cpu argument on hybrid platform

 tools/lib/perf/evlist.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-18 10:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 14:54 [RFC PATCH 0/1] libperf: evlist: Fix --cpu argument on hybrid platform James Clark
2024-10-15 14:54 ` [RFC PATCH 1/1] " James Clark
2024-10-15 15:14   ` Ian Rogers
2024-10-16  8:29     ` James Clark
2024-10-16 15:01       ` Ian Rogers
2024-10-17 23:10         ` Namhyung Kim
2024-10-18 10:19           ` James Clark
2024-10-15 16:53   ` Falcon, Thomas
2024-10-17 23:02   ` Namhyung Kim
2024-10-18 10:18     ` James Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).