From: Namhyung Kim <namhyung@kernel.org>
To: Jiebin Sun <jiebin.sun@intel.com>
Cc: acme@kernel.org, mingo@redhat.com, peterz@infradead.org,
adrian.hunter@intel.com, alexander.shishkin@linux.intel.com,
irogers@google.com, james.clark@linaro.org, jolsa@kernel.org,
mark.rutland@arm.com, dapeng1.mi@linux.intel.com,
thomas.falcon@intel.com, tianyou.li@intel.com,
wangyang.guo@intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 0/9] perf c2c: add a function view
Date: Tue, 4 Aug 2026 10:15:59 -0700 [thread overview]
Message-ID: <anIeT4yBy6WX2ky5@google.com> (raw)
In-Reply-To: <20260803035220.172022-1-jiebin.sun@intel.com>
Hello,
On Mon, Aug 03, 2026 at 11:52:11AM +0800, Jiebin Sun wrote:
> This series adds a new "function view" to perf c2c report, on top of the
> existing cacheline view. Existing cacheline-view data and operations remain
> unchanged; TAB adds access to a complementary way to inspect the same
> cache-to-cache (C2C) data.
>
> v1: https://lore.kernel.org/linux-perf-users/20260626070355.1556721-1-jiebin.sun@intel.com/
> v2: https://lore.kernel.org/linux-perf-users/20260710084247.3576706-1-jiebin.sun@intel.com/
> v3: https://lore.kernel.org/linux-perf-users/20260717020530.1645123-1-jiebin.sun@intel.com/
> v4: https://lore.kernel.org/linux-perf-users/20260724095842.995920-1-jiebin.sun@intel.com/
> v5: https://lore.kernel.org/linux-perf-users/20260730090521.2206375-1-jiebin.sun@intel.com/
>
> Changes since v5
> ================
>
> - Give the function-view children their own references instead of
> borrowing them, as suggested by Namhyung. They set ops and take refs
> via map_symbol__copy() and thread__get(), so hist_entry__delete()
> frees them; the custom child destructor and the
> WARN_ON_ONCE(report_hierarchy) guard are gone.
>
> - Add NO_SLANG stubs for the two TUI entry points declared in c2c.h,
> matching how util/hist.h declares its own.
>
> - Spell out in the symbol renderer why the length returned by
> se_snprintf() cannot exceed the cell.
>
> - Rebase onto perf-tools-next at d04ef71492fa.
>
> No intended change to the rendered output, cacheline-view data, existing
> cacheline operations, or --stdio output.
I'm about to merge the series. But please consider a follow-up work to
add support for --stdio and add a test case.
Thanks,
Namhyung
>
> Changes since v4
> ================
>
> - Rebase onto perf-tools-next at 0d40fedcd1b9.
>
> - Require `iaddr` in --coalesce before entering the function view;
> without it, coalesced samples cannot be reliably attributed.
>
> - Reuse each source cacheline's existing index as the level-3 identity,
> so same-address sources no longer merge and 'd' finds the original
> entry, without adding fields to the shared C2C structures.
>
> - Keep same-function reader/writer pairs, which the coalesced view cannot
> reliably tell apart from cross-thread contention.
>
> - Robustness and cleanup: build the hierarchy only from filtered
> cachelines with a lightweight entry allocator; explicit
> mem_info__new() handling; a local bound in the symbol renderer; a
> NULL-map guard; deterministic tie-breaks; function-view-local row
> recounting; Ctrl-C as an exit key; and expanded man-page docs.
>
> Changes since v3
> ================
>
> Reworked the function view into a true function-centric hierarchy, as
> discussed with Namhyung:
>
> - Level 1 is the read-side function itself, aggregating all of its code
> addresses into one entry and sorting by Cycles %.
>
> - Level 2 is the contending function that writes the shared lines,
> aggregated across cachelines and sorted by store count. Level 3 is the
> specific cachelines.
>
> - Dedicated code-address and offset columns were removed from the main
> view. Verbose function formatting can still include a representative
> code address, and full code-address information remains available in
> the per-cacheline detail view ('d').
>
> - Lower-level entries are indented like the normal perf report hierarchy
> view, and entries with no contending writer are pruned.
>
> - Reorganized the series from 14 mechanical patches into 9 logically
> self-contained patches.
>
> Changes since v2
> ================
>
> - Prefix helpers exported from builtin-c2c.c with c2c_, as suggested by
> Namhyung.
>
> Changes since v1
> ================
>
> - Add a worked man-page example, as suggested by Namhyung.
>
> In the perf c2c TUI, press TAB in the cacheline view to switch to the
> function view. It presents a three-level hierarchy:
>
> Level 1: read-side function, sorted by Cycles %
> Level 2: functions writing the shared lines, sorted by store count
> Level 3: cachelines where the two functions contend
>
> For example, with dequeue_pushable_task expanded to its level-2 writers and
> two of those writers expanded to their level-3 cachelines:
>
> Shared Data Functions Table (19 entries, sorted on Cycles %)
> Cycles Store
> % count Function / Contending function / Cacheline
> ----------------------------------------------------------------------
> + 35.67% 876 + [k] cpupri_set
> + 24.31% 424 + [k] pull_rt_task
> - 16.53% 555 - [k] dequeue_pushable_task
> 145 - [k] pull_rt_task
> 145 0xff2d0082809da080
> 139 - [k] enqueue_pushable_task
> 70 0xff2d00a2071f9640
> 69 0xff2d0082809da000
>
> A level-1 store count decomposes into its level-2 writers, and each writer's
> count decomposes into its level-3 cachelines (here 145 = 145, 139 = 70 + 69).
>
> Keys in the function view:
>
> TAB/ESC/q/Ctrl-C return to the cacheline view
> d show details for the selected level-3 cacheline
> e / + expand / collapse the selected entry
> ? help
>
> The function view is a separate hist_browser in
> tools/perf/ui/browsers/c2c-function.c. Shared types and helpers used by
> both views are factored out of builtin-c2c.c into c2c.h. The hierarchy is
> constructed from the existing cacheline histograms into dedicated hists
> and rendered with custom column formatters.
>
> Testing: each commit builds individually; the full series builds with and
> without SLANG support; perf test c2c passes (one permission-related skip);
> cacheline --stdio output is byte-identical to the base commit; and the
> perf-c2c man page builds.
>
> Jiebin Sun (9):
> perf c2c: extract shared data structures into c2c.h
> perf c2c: add function view browser skeleton
> perf c2c: add column rendering for function view
> perf c2c: add HPP list parsing for function view columns
> perf c2c: add function view stats merge and memory management
> perf c2c: add function view hierarchy entry creation
> perf c2c: build and finalize the function view hierarchy
> perf c2c: add function view browser UI and cacheline detail
> perf c2c: document function view in perf-c2c man page
>
> tools/perf/Documentation/perf-c2c.txt | 71 +
> tools/perf/builtin-c2c.c | 130 +-
> tools/perf/c2c.h | 155 +++
> tools/perf/ui/browsers/Build | 1 +
> tools/perf/ui/browsers/c2c-function.c | 1783 +++++++++++++++++++++++++
> 5 files changed, 2021 insertions(+), 119 deletions(-)
> create mode 100644 tools/perf/c2c.h
> create mode 100644 tools/perf/ui/browsers/c2c-function.c
>
>
> base-commit: d04ef71492fad7230d474efe33d05f4c0563d409
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-08-04 17:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 3:52 [PATCH v6 0/9] perf c2c: add a function view Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 1/9] perf c2c: extract shared data structures into c2c.h Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 2/9] perf c2c: add function view browser skeleton Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 3/9] perf c2c: add column rendering for function view Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 4/9] perf c2c: add HPP list parsing for function view columns Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 5/9] perf c2c: add function view stats merge and memory management Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 6/9] perf c2c: add function view hierarchy entry creation Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 7/9] perf c2c: build and finalize the function view hierarchy Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 8/9] perf c2c: add function view browser UI and cacheline detail Jiebin Sun
2026-08-03 3:52 ` [PATCH v6 9/9] perf c2c: document function view in perf-c2c man page Jiebin Sun
2026-08-04 17:15 ` Namhyung Kim [this message]
2026-08-05 6:12 ` [PATCH v6 0/9] perf c2c: add a function view Jiebin Sun
2026-08-05 18:19 ` Namhyung Kim
2026-08-06 7:47 ` Jiebin Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anIeT4yBy6WX2ky5@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jiebin.sun@intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=thomas.falcon@intel.com \
--cc=tianyou.li@intel.com \
--cc=wangyang.guo@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox