lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241015145416.583690-1-james.clark@linaro.org>
Date: Tue, 15 Oct 2024 15:54:14 +0100
From: James Clark <james.clark@...aro.org>
To: linux-perf-users@...r.kernel.org,
	acme@...nel.org,
	namhyung@...nel.org,
	irogers@...gle.com
Cc: James Clark <james.clark@...aro.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>,
	linux-kernel@...r.kernel.org
Subject: [RFC PATCH 0/1] libperf: evlist: Fix --cpu argument on hybrid platform

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ