From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796348160; b=kgACKn3yXcRZXyrP7pt/r/G+wrkIMXKBgFbbvoalIbmPcr6N/rV+eMOEwU90jL1mQJvT bZZUaTjo82G9K6l/DEjio8/V6KuHgvlLulTxss/w/Z88R4CDsUs7zNXYNZE21/V2+9XWn /t/2nX2tt7yUgsmABZKt7NQXWPBaR6lB/kNeLdNnssEyphGkffjGMukZFMQ2RtalbItii wwqdE9HFoKWWcTeLONStPejgfU2JpVQlb1yFgA585RBmfr3o8Jnpvxcyxm1I7oJNFNGpo QzOhbSSk3y6idH1bTdsaLYcmkx+wt8aTk5gQFpBDROGZsauaSxnE3Cvjbgu309PGuJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796348160; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=fjb8wjlMPh9appBfVRqvwiqscBbKdopUUt7b/JWS+vo=; b=UGU6ZCfsg973UvCpHxPXVr8HZvQZBk1b/o9w3m/7ypon1fhD9Bt9aMXWneqDRBPee84r noxrCSyXafosp3L3V0CPByMkHsC1svAbmkCinwaFxraOWAc7ZV/BHmqkKAMtDB1mWBBU3 UTRDNX/3kZqoi/MS4YhvY2Pjj5IkrdelnX9qjXz3Drg4x6yNNk/VOiULGabz4RlnFOD8q RKqb2ZmVY3fEm9vxJYqFgQOMagyusBjsY8MGRVjebJP08ILpo1YJaYKrPdq9+6KxfvqQ5 vt5c7KtwQVai5p9Nzo02I+tQTVZZh+Pzu2I3D0q/WxW/EIOQ7/me+jE1B95yDnALuWg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cP0jgYLu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2CF9606A322 for ; Fri, 4 Dec 2026 01:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cP0jgYLu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EFE01F000CE; Fri, 4 Dec 2026 01:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796348160; bh=fjb8wjlMPh9appBfVRqvwiqscBbKdopUUt7b/JWS+vo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cP0jgYLuc2Z62nENf65ovN9nZX5dT6sbqXTIaM9NGtGhN9d/cBFUXBMCLBuG5mRpT KWnYt71rEMbs0q+kZqyPjCbco7xyg1mTTMW5sJvydGhqUQfHXkwQ4vbunULl4UW8Jk tGa+n8FjFx3ya325yYsRs9jC8Fgdg12bwTYmDlXbhpqb0T10XKiT5EU+5tj9s2g2JZ mWPojLiPNnQNJkiSVTDbYqvPAa2kpkRyDYounge8moPxOFMseAVfRHxBZ5TE4eLIYj o7TpbyYxG0+SiELUcRO2CIS+0t9KrObrnwSHctnl2msrWvJVfAw6qmyrvtYggSmLuK 781rLQrroib2A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] perf evlist: Reparent first_wildcard_match when evsels are removed Reply-To: sashiko-reviews@lists.linux.dev To: "Ian Rogers" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261204011846.1959123-1-irogers@google.com> References: <20261204011846.1959123-1-irogers@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 01:36:00 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] perf: evlist__add() map propagation omits wildcard reparenting -- commit 21a926f2d87a03affcb864c9eb166a663484742d Author: Ian Rogers perf evlist: Reparent first_wildcard_match when evsels are removed This patch adds helpers to reparent first_wildcard_match when an evsel is removed from an evlist, calling them from evlist__remove(), evlist__create_maps(), and evlist__create_syswide_maps(), along with unit tests in tools/perf/tests/hybrid-merge.c. > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c > index c2402e4791b64..4b8cba6410c45 100644 > --- a/tools/perf/util/evlist.c > +++ b/tools/perf/util/evlist.c [ ... ] > @@ -1383,6 +1421,7 @@ int evlist__create_maps(struct evlist *evlist, stru= ct target *target) > evlist__core(evlist)->has_user_cpus =3D !!target->cpu_list; > =20 > perf_evlist__set_maps(evlist__core(evlist), cpus, threads); > + evlist__fix_removed_wildcard_matches(evlist); > =20 > /* as evlist now has references, put count here */ > perf_cpu_map__put(cpus); [Severity: Medium] Can evlist__add() still leave stale first_wildcard_match pointers before evlist__create_maps() runs, or when it is never called? evlist__new() calls perf_evlist__set_maps() with NULL maps, which sets needs_map_propagation on every new evlist. During __parse_events() -> evlist__splice_list_tail(), evlist__add() runs __perf_evlist__propagate_maps() and removes an empty-CPU primary evsel. For an event with a per-event cpu=3D term (such as cycles/cpu=3D0/ when cpu= _atom does not cover CPU 0), the later evsels are added with first_wildcard_match still pointing to the removed evsel. In perf stat --for-each-cgroup, evlist__expand_cgroup() runs before evlist__create_maps() and copies pos->first_wildcard_match->priv. Since the removed evsel was never in the list, priv is NULL, permanently breaking wildcard merging among the surviving PMUs. Callers such as pyrf__parse_events() set maps before parse_events() and nev= er call evlist__create_maps(), leaving dangling first_wildcard_match pointers. Would calling evlist__fix_removed_wildcard_matches() in evlist__splice_list_tail() (or reparenting on removal in evlist__add()) cov= er these paths? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204011846.1959= 123-1-irogers@google.com?part=3D1