From: Thomas Falcon <thomas.falcon@intel.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Dapeng Mi <dapeng1.mi@linux.intel.com>
Subject: [PATCH v3 2/6] perf mem: Add support for printing PERF_MEM_LVLNUM_L0
Date: Mon, 3 Aug 2026 15:45:36 -0500 [thread overview]
Message-ID: <20260803204540.100348-3-thomas.falcon@intel.com> (raw)
In-Reply-To: <20260803204540.100348-1-thomas.falcon@intel.com>
From: Dapeng Mi <dapeng1.mi@linux.intel.com>
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."
[1]: https://www.intel.com/content/www/us/en/content-details/922690/intel-architecture-instruction-set-extensions-programming-reference.html
Assisted-by: Sashiko:gemini-3.1-pro-preview
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Thomas Falcon <thomas.falcon@intel.com>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
v3: Included more information about the L0 cache in the commit message.
---
tools/perf/Documentation/perf-record.txt | 2 +-
tools/perf/util/bpf-filter.l | 1 +
tools/perf/util/mem-events.c | 5 +++++
tools/perf/util/mem-events.h | 1 +
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 178f483140ed..b54032efe41c 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -212,7 +212,7 @@ OPTIONS
The <value> can be one of:
<number> (for any term)
na, load, store, pfetch, exec (for mem_op)
- l1, l2, l3, l4, cxl, io, any_cache, lfb, ram, pmem (for mem_lvl)
+ l0, l1, l2, l3, l4, cxl, io, any_cache, lfb, ram, pmem (for mem_lvl)
na, none, hit, miss, hitm, fwd, peer (for mem_snoop)
remote (for mem_remote)
na, locked (for mem_locked)
diff --git a/tools/perf/util/bpf-filter.l b/tools/perf/util/bpf-filter.l
index 6aa65ade3385..1be9df6550fc 100644
--- a/tools/perf/util/bpf-filter.l
+++ b/tools/perf/util/bpf-filter.l
@@ -131,6 +131,7 @@ store { return constant(PERF_MEM_OP_STORE); }
pfetch { return constant(PERF_MEM_OP_PFETCH); }
exec { return constant(PERF_MEM_OP_EXEC); }
+l0 { return constant(PERF_MEM_LVLNUM_L0); }
l1 { return constant(PERF_MEM_LVLNUM_L1); }
l2 { return constant(PERF_MEM_LVLNUM_L2); }
l3 { return constant(PERF_MEM_LVLNUM_L3); }
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 4e490f9cd348..4fd48fd20055 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",
[PERF_MEM_LVLNUM_UNC] = "Uncached",
[PERF_MEM_LVLNUM_CXL] = "CXL",
[PERF_MEM_LVLNUM_IO] = "I/O",
@@ -831,6 +832,8 @@ int mem_stat_index(const enum mem_stat_type mst, const u64 val)
}
case PERF_MEM_STAT_CACHE:
switch (src.mem_lvl_num) {
+ case PERF_MEM_LVLNUM_L0:
+ return MEM_STAT_CACHE_L0;
case PERF_MEM_LVLNUM_L1:
return MEM_STAT_CACHE_L1;
case PERF_MEM_LVLNUM_L2:
@@ -915,6 +918,8 @@ const char *mem_stat_name(const enum mem_stat_type mst, const int idx)
}
case PERF_MEM_STAT_CACHE:
switch (idx) {
+ case MEM_STAT_CACHE_L0:
+ return "L0";
case MEM_STAT_CACHE_L1:
return "L1";
case MEM_STAT_CACHE_L2:
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index 5b98076904b0..daa22748f9fe 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -109,6 +109,7 @@ enum mem_stat_op {
};
enum mem_stat_cache {
+ MEM_STAT_CACHE_L0,
MEM_STAT_CACHE_L1,
MEM_STAT_CACHE_L2,
MEM_STAT_CACHE_L3,
--
2.55.0
next prev parent reply other threads:[~2026-08-03 20:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 20:45 [PATCH v3 0/6] perf: Add support for memory region/range reporting Thomas Falcon
2026-08-03 20:45 ` [PATCH v3 1/6] perf mem: Fix size tracking for mem_lvl's in perf_script__meminfo_scnprintf() Thomas Falcon
2026-08-03 20:54 ` sashiko-bot
2026-08-03 20:45 ` Thomas Falcon [this message]
2026-08-03 20:45 ` [PATCH v3 3/6] perf header: Support memory ranges Thomas Falcon
2026-08-03 21:00 ` sashiko-bot
2026-08-03 20:45 ` [PATCH v3 4/6] perf tools: Show memory region in perf-c2c subcommand Thomas Falcon
2026-08-03 20:57 ` sashiko-bot
2026-08-03 20:45 ` [PATCH v3 5/6] perf tools: Show memory region in perf-script subcommand Thomas Falcon
2026-08-03 21:01 ` sashiko-bot
2026-08-03 20:45 ` [PATCH v3 6/6] perf c2c: print memory region data with stdio output Thomas Falcon
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=20260803204540.100348-3-thomas.falcon@intel.com \
--to=thomas.falcon@intel.com \
--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=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=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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