Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Falcon" <thomas.falcon@intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v11 2/6] perf mem: Add support for printing PERF_MEM_LVLNUM_L0
Date: Wed, 23 Sep 2026 16:13:29 +0000	[thread overview]
Message-ID: <20260923161330.21FFF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923155703.34814-3-thomas.falcon@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf: L0 cache hits are silently dropped in perf c2c statistics
--

commit f3eb05aaf438922225a25a217c33e99b8e7d269e
Author: Dapeng Mi <dapeng1.mi@linux.intel.com>

    perf mem: Add support for printing PERF_MEM_LVLNUM_L0
    
    Add support for printing PERF_MEM_LVLNUM_L0 in perf mem report.
    
    The L0 cache is newly added a small piece of cache which is
    the closest, lowest-latency memory cache tied directly to the
    execution pipeline.
    
    The table "Table 9-4. Data Source Field Encodings for Panther
    Cove and Coyote Cove Microarchitectures" in the ISE doc chapter
    "9.2.1 Panther Cove and Coyote Cove Microarchitectures Memory
    Auxiliary Field Layout"[1] indicates the code "01H" means the
    "L0 Hit - Minimal latency core cache hit. This request was
    satisfied by the L0 data cache."

> diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
> index 4e490f9cd3488..4fd48fd200552 100644
> --- a/tools/perf/util/mem-events.c
> +++ b/tools/perf/util/mem-events.c
> @@ -391,6 +391,7 @@ static const char * const mem_lvlnum[] = {
>  	[PERF_MEM_LVLNUM_L4] = "L4",
>  	[PERF_MEM_LVLNUM_L2_MHB] = "L2 MHB",
>  	[PERF_MEM_LVLNUM_MSC] = "Memory-side Cache",
> +	[PERF_MEM_LVLNUM_L0] = "L0",

[Severity: Medium]
This is a pre-existing issue, but does sort__lvl_cmp() in tools/perf/util/sort.c
incorrectly merge histogram entries for L0 cache hits with other unmatched cache
hierarchies?

Because sort__lvl_cmp() exclusively compares the deprecated mem_lvl bitmask
when determining the sort order:

	return (int64_t)(data_src_r.mem_lvl - data_src_l.mem_lvl);

Since PERF_MEM_LVLNUM_L0 and other new levels are only defined in mem_lvl_num,
their mem_lvl evaluates to 0. This causes them to be incorrectly grouped
together with other unrecognized hierarchies like CXL or PMEM in perf report.

[Severity: Medium]
Will L0 cache hits be silently dropped in perf c2c statistics since they are
not accounted for in c2c_decode_stats() in tools/perf/util/mem-events.c?

c2c_decode_stats() populates c2c_stats by checking the deprecated mem_lvl
bitmask:

			if (lvl & P(LVL, L1 )) stats->ld_l1hit++;
			if (lvl & P(LVL, L2)) {

Since PERF_MEM_LVLNUM_L0 is encoded in the new mem_lvl_num field, L0 cache
hits will bypass these cache depth checks entirely. In addition, the c2c_stats
structure lacks an ld_l0hit counter to track them.

>  	[PERF_MEM_LVLNUM_UNC] = "Uncached",
>  	[PERF_MEM_LVLNUM_CXL] = "CXL",
>  	[PERF_MEM_LVLNUM_IO] = "I/O",

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923155703.34814-1-thomas.falcon@intel.com?part=2

  reply	other threads:[~2026-09-23 16:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 15:56 [PATCH v11 0/6] perf: Add support for memory region/range reporting Thomas Falcon
2026-09-23 15:56 ` [PATCH v11 1/6] perf mem: Fix size tracking for mem_lvl's in perf_script__meminfo_scnprintf() Thomas Falcon
2026-09-23 16:05   ` sashiko-bot
2026-09-23 15:56 ` [PATCH v11 2/6] perf mem: Add support for printing PERF_MEM_LVLNUM_L0 Thomas Falcon
2026-09-23 16:13   ` sashiko-bot [this message]
2026-09-23 15:57 ` [PATCH v11 3/6] perf header: Support memory ranges Thomas Falcon
2026-09-23 16:10   ` sashiko-bot
2026-09-23 17:08     ` [PATCH v12 0/6] perf: Add support for memory region/range reporting Thomas Falcon
2026-09-23 17:08       ` [PATCH v12 1/6] perf mem: Fix size tracking for mem_lvl's in perf_script__meminfo_scnprintf() Thomas Falcon
2026-09-23 17:17         ` sashiko-bot
2026-09-23 17:08       ` [PATCH v12 2/6] perf mem: Add support for printing PERF_MEM_LVLNUM_L0 Thomas Falcon
2026-09-23 17:16         ` sashiko-bot
2026-09-23 17:09       ` [PATCH v12 3/6] perf header: Support memory ranges Thomas Falcon
2026-09-23 17:18         ` sashiko-bot
2026-09-23 17:09       ` [PATCH v12 4/6] perf tools: Show memory region in perf-c2c subcommand Thomas Falcon
2026-09-23 17:17         ` sashiko-bot
2026-09-24  0:23         ` Mi, Dapeng
2026-09-24 17:28           ` Arnaldo Carvalho de Melo
2026-09-24 17:29             ` Arnaldo Carvalho de Melo
2026-09-23 17:09       ` [PATCH v12 5/6] perf tools: Show memory region in perf-script subcommand Thomas Falcon
2026-09-23 17:22         ` sashiko-bot
2026-09-23 17:09       ` [PATCH v12 6/6] perf c2c: print memory region data with stdio output Thomas Falcon
2026-09-23 17:18         ` sashiko-bot
2026-09-24 17:35       ` [PATCH v12 0/6] perf: Add support for memory region/range reporting Arnaldo Carvalho de Melo
2026-09-23 15:57 ` [PATCH v11 4/6] perf tools: Show memory region in perf-c2c subcommand Thomas Falcon
2026-09-23 16:04   ` sashiko-bot
2026-09-23 15:57 ` [PATCH v11 5/6] perf tools: Show memory region in perf-script subcommand Thomas Falcon
2026-09-23 16:07   ` sashiko-bot
2026-09-23 15:57 ` [PATCH v11 6/6] perf c2c: print memory region data with stdio output Thomas Falcon
2026-09-23 16:05   ` sashiko-bot

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=20260923161330.21FFF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.falcon@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