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=1796476717; b=h1sRBRv8YIHzgrkqu9Lp2p0bSp3//BrxiwUboKq3WYnH57JDnkFSv8NqpBv1YmZjZudP 2wPz4sNlMXDaotVNIWxiQ4Nr1X8/PbSzrK9Bzrpf0smEQFIQ+VZ58NTUKbXq3EixfmG9T 6gmwi80vPl3H86MhMd2utSrBOqyV+yk0C6MEkjIG+smfm9WUXjE24gOmd4PdX5UnESX6+ qBoJeITwLEOSObqy9DXjXWcgNbdP1uHeEA49N/JMSvjcVeKDnP8MjhrXJdA3IskfdLq2Y LGDFnyxEsiNzwOAdUF9omS3PQR8F8RiCnSH21HPzb8Ehh7YmfN9PCGHNvqczyxzI/2Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796476717; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=LNuMpfZ7KkD/40CgCggqmUWeFe1yQYnZtkhfkBvNTjU=; b=Hi8vWQJqulH/mn0nob8gJqEFhTxzTT7r1kqD0MNcOjdM8XclANSGId7PNLRz8iCrlfJ+ 2al5oUBXCUZPpCFiiMIJp2bwCw1SmAkNZL/JCwptWfzCoMWL6lcYAU0GlITGn/kvr8P6R aVcuqzSnbPT6aBqiRbz4V7z7g+En1YOO6IbXhsuygosh8gFR5MjWrbgpqU2D9Bh5nL0RI eLRxD0YktT23URuGncb+LDka4hUiN7LFpQrr1HHLBFMh12s09Npg4K70XCReSpKSOugBH q6lBHgN6LUY47DYgU7xtQSEbLa+sZS23LJJsIWW21WJMFqN5dr8rV/A+PMQpHUSM2aA== 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=IxhvOl34; 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 69601606A322 for ; Sat, 5 Dec 2026 13:18:37 +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=IxhvOl34 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E492E1F0092B; Sat, 5 Dec 2026 13:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796476717; bh=LNuMpfZ7KkD/40CgCggqmUWeFe1yQYnZtkhfkBvNTjU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=IxhvOl34GaCerGIGAdFgjWNnNjLZpMd/x8HbwZuuGnW68rDcYF5tZ9M0Mm0k9mn1s aHKqQY5lfAyz7QRB9fy2xoai3cXeGIDppzTmdJaNZUWkn/h3NYCMyIfqWKN4DhbC+S OZcdGys1/ucMHYobn2JAlhByM5L7dcYYWhwCXa8ijRujULCfKCpxIPlpFvqpBuQPPD 3LpYTQ+q8W4+d3BSXkXdd3ZeLLeJLubM0algCzO8KxR1839G+GDIo2rF35UXlNI+RR T8ViS62jmWD/N9HE2c6baRZLkWXhZgMHfRxdH4riRJm1kQ2P45Q4c8jx+9bq6B7JDh 0aakqzRdhcFqg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v1 1/1] perf annotate-data: Cache the per-instruction data type resolution Reply-To: sashiko-reviews@lists.linux.dev To: "Arnaldo Carvalho de Melo" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261205130136.5962-1-acme@kernel.org> References: <20261205130136.5962-1-acme@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 13:18:36 +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 annotate-data: wrong ms key in __hist_entry__get_data_type() -- commit 91c505c1c8646d1d466660ac433e03bbaba797f2 Author: Arnaldo Carvalho de Melo perf annotate-data: Cache the per-instruction data type resolution This commit adds a session-global hashmap (dtype_cache) keyed on (dso, ip) to memoize per-instruction data type resolution and replay its statistics in __hist_entry__get_data_type(). > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 86a4beec6528e..321c0af4265c3 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c [ ... ] > @@ -2847,32 +3052,48 @@ __hist_entry__get_data_type(struct hist_entry *he= , const struct arch *arch, > struct map_symbol *ms =3D &he->ms; > struct annotated_insn_loc loc; > struct annotated_op_loc *op_loc; > - struct annotated_data_type *mem_type; > + struct annotated_data_type *mem_type =3D NULL, *ret; > struct annotated_item_stat *istat; > + struct dtype_cache fill =3D { .replay =3D DTYPE_REPLAY_NONE }; > + struct dtype_cache *dc; > + struct annotated_data_stat before; > int i; > =20 > + dc =3D dtype_cache__find(map__dso(ms->map), ms->sym->start + dl->al.off= set); > + if (dc) > + return dtype_cache__replay(dc, he, type_offset); [ ... ] > +out_add: > + annotated_data_stat__delta(&fill.stat_delta, &before); > + dtype_cache__add(map__dso(ms->map), ms->sym->start + dl->al.offset, &fi= ll); > + return ret; > } [Severity: Medium] Can he->ms differ from the symbol that owns dl, or have a NULL sym or map, when __hist_entry__get_data_type() keys dtype_cache on it? In __hist_entry__tui_annotate(), browser.he->ms is only updated from ms when hbt !=3D NULL && he !=3D &annotate_he. When hbt is NULL (in perf report, p= erf annotate, or perf c2c) or on nested calls in perf top, browser.he->ms stays on the caller or root entry while dl comes from ms. With code-with-type enabled, annotate_browser__callq() passes the callee's target_ms with the caller's browser->he. disasm_line__snprint_type_info() then looks up and inserts under the caller's (dso, sym->start + offset), replaying the caller's verdicts onto the callee and poisoning dtype_cache. If he->ms.sym is NULL, such as when do_annotate() annotates a synthetic symbol from symbol__new_unresolved() in perf_evsel__hists_browse(), ms->sym->start also causes a NULL pointer dereference on entry before any early returns. Passing the annotated map_symbol to __hist_entry__get_data_type() (and checking ms->map and ms->sym) would ensure the cache key matches dl. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205130136.5962= -1-acme@kernel.org?part=3D1