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=1796402816; b=eUU67G81bWLzTH7lJV2MUs+VklwM+4ztXj5HzUyHEpHRDgpFhbeW6j4Y3MbhPsE5PTne vabXHN7VnqZOmb5b3PCmU7soc+k2wb1Atq/F9Nq/f/GPP3zA73TwLCS/x0Y0x7OfevyXp +C07sqvkWbMHk/1e+GoFtSL7GiYhLwWkBxozrvL72YEK1/sZFsIq6lOIMDs5K8cOK271p nzK+cLW8g3x0MrTrFZaZADJqBw4/O1OAt2hNjexYoo2pn8evDBfKaqSAb4l1nforf7KnK IjCqDRhfG0yLsjSHl15OJgc8OZHmg6Tz+Ce11XLvO6BwqlIzPxZ/+pB155vIiCOXWOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796402816; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=3nLmFghBtzFddLuDL3hr7awaUiWlvg35oSyT9jQvkes=; b=1yQV7hoeiDhlxfEPyjmGMIFImrCCzYXGZYZruS9mTiRKnJe2IC+s+7STT6nUm3oWPBNh fc3NYRFHo9gGJQPIx2glg5YPgo6ir+PEo3reQGd1KvhyuzjcTzL1Nq5MaxVbKfuShAQps L/0rrKR+bQAVZuIa9U3tge1AF1CINGzbUDjIovnRajpYplXxsE3hxneX2OraE5WY9OHh3 ALWPXjDS+yjqTGM8Tyefz5ejT6zXXA70SDcZBqSKU475EVAXPXkpRSxESUTBAN+MxbgHX 0a7iKCvPMD8QP23JnQtE57tYcpnb9NPtai8x/loTtd2/rIsK+ZFiECxI0nI03l4/YDQ== 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=I1TRGwki; 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 22647606A322 for ; Fri, 4 Dec 2026 16:46:56 +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=I1TRGwki Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1D091F000C2; Fri, 4 Dec 2026 16:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796402816; bh=3nLmFghBtzFddLuDL3hr7awaUiWlvg35oSyT9jQvkes=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=I1TRGwkiG3rm/a4k1c4pRa/k1E1Vb6r8WEnvWLT/CDhuRZUkD0rUCuyUfrIlDvhjU ThnMDm2Eg7b+kVgOm5GBm/6lIbw4kHmeIHDblyB2qWeIeiuJ7FV1W1qxtcCiLX0u9b eRIvg0kL/ZuOGZqefa9ie74KuhDcf/NeytE3fhXq86/ZvEh3Mv3+mTfPR+HU7BnFV1 PFROzb+yrRbHzd/rTj2t0DaYNA+foLUJIrxYru7jvSzObayaqqhoPVRghArS5XHwMM Jyr2fFaa7cB8Lae40aBVZ/ZBtzJM1wiU6dmNwI+R9bW6fkwLkAMkqy0otIbrQ9KVfF da3AoNEcg/B6A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/5] perf python: Support inlined frames in callchains Reply-To: sashiko-reviews@lists.linux.dev To: "Jens Remus" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261204162426.4171717-8-jremus@linux.ibm.com> References: <20261204162426.4171717-7-jremus@linux.ibm.com> <20261204162426.4171717-8-jremus@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 16:46:52 +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 3 potential issues to consider: - [Medium] perf python: net_dropmonitor.py pairs inlined frame with enclosing offset - [Low] perf doc: perf-script-python.txt omits inlined callchain node attribute - [Low] perf python: pyrf_getenv_bool() checks only "0" instead of perf_config_bool() -- commit b323825e4c680032e02984aa9e4613ee4ca3e78e Author: Jens Remus perf python: Support inlined frames in callchains This commit adds an inline keyword argument to perf.session (defaulting to the PERF_SYMBOL_INLINE environment variable set by perf script) and exposes an inlined attribute on perf.callchain_node. > diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf= /Documentation/perf-script-python.txt > index cbf50b3e5f062..10b124267f89a 100644 > --- a/tools/perf/Documentation/perf-script-python.txt > +++ b/tools/perf/Documentation/perf-script-python.txt [ ... ] > @@ -118,7 +119,7 @@ perf.session > =20 > Manages a trace session. > =20 > -- `__init__(data, sample=3DNone, stat=3DNone, context_switch=3DNone, cal= l_return=3DNone, itrace=3DNone, vmlinux=3DNone, kallsyms=3DNone, symfs=3DNo= ne)`: Creates a new session. `data` is a `perf.data` object. `sample` is a = callback function called for each sample event. `vmlinux`, `kallsyms`, and = `symfs` configure symbol resolution paths. > +- `__init__(data, sample=3DNone, stat=3DNone, context_switch=3DNone, cal= l_return=3DNone, itrace=3DNone, vmlinux=3DNone, kallsyms=3DNone, symfs=3DNo= ne, inline=3DFalse)`: Creates a new session. `data` is a `perf.data` object= . `sample` is a callback function called for each sample event. `vmlinux`, = `kallsyms`, and `symfs` configure symbol resolution paths. `inline` resolve= s inlined functions in callchains, which are then flagged by `callchain_nod= e.inlined`. When run by `perf script`, the default of `inline` is the value= of `--inline`/`--no-inline`. [Severity: Low] The Sample Object section later in this file still documents callchain as a sequence of callchain nodes with only ip, symbol, and dso, omitting the newly added inlined attribute (and the pre-existing sym_offset attribute). Should that section be updated as well? > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c > index b6691ebb1b4ef..2ab6b17f638e0 100644 > --- a/tools/perf/builtin-script.c > +++ b/tools/perf/builtin-script.c > @@ -4537,6 +4537,7 @@ int cmd_script(int argc, const char **argv) > setenv("PERF_SYMBOL_SYMFS", symbol_conf.symfs, 1); > if (script_itrace_opts) > setenv("PERF_ITRACE", script_itrace_opts, 1); > + setenv("PERF_SYMBOL_INLINE", symbol_conf.inline_name ? "1" : "0", 1); [Severity: Medium] Can exporting PERF_SYMBOL_INLINE=3D1 by default cause tools/perf/python/net_dropmonitor.py to report an inlined function name paired with the enclosing function's offset? Because symbol_conf.inline_name defaults to true and callchains default to callee order, sample.callchain now yields the innermost inlined frame before the enclosing frame with the same ip. new_inline_sym() copies base_sym->start, so sym_offset is still relative to the enclosing function. tools/perf/python/net_dropmonitor.py:DropMonitor.process_event() { ... if entry_ip =3D=3D location and sym_name and sym_na= me !=3D "[unknown]": if sym_off is not None: self.resolved_syms[location] =3D (sym_name,= sym_off) self.callchain_syms.pop(location, None) else: self.callchain_syms[location] =3D sym_name break ... } DropMonitor.process_event() breaks on the first matching entry_ip without checking entry.inlined, so an inlined frame at a drop location prints a mismatched (inlined_name, enclosing_offset) pair. Skipping frames where entry.inlined is true would preserve the enclosing symbol and offset. [ ... ] > diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c > index 60dbe2dad5eb8..b5426dfaee01f 100644 > --- a/tools/perf/util/python.c > +++ b/tools/perf/util/python.c [ ... ] > @@ -4958,6 +4966,16 @@ static PyObject *pyrf_session__find_thread(struct = pyrf_session *psession, PyObje > return result; > } > =20 > +/* Return @def when the environment variable is unset or empty. */ > +static bool pyrf_getenv_bool(const char *name, bool def) > +{ > + const char *str =3D getenv(name); > + > + if (!str || !str[0]) > + return def; > + return strcmp(str, "0") !=3D 0; > +} [Severity: Low] Should pyrf_getenv_bool() use perf_config_bool() instead of only checking for "0"? With strcmp(str, "0") !=3D 0, a user running a standalone script with PERF_SYMBOL_INLINE=3Dfalse (or "no"/"off") silently gets true, since the documentation does not restrict the variable to 0/1. python.c already includes config.h, so calling perf_config_bool(name, str) after the empty-string check (matching perf_env_bool() in util/config.c) would handle standard boolean values consistently. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204162426.4171= 717-7-jremus@linux.ibm.com?part=3D1