From: K Prateek Nayak <kprateek.nayak@amd.com>
To: <linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <acme@kernel.org>,
<peterz@infradead.org>, <mingo@redhat.com>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@kernel.org>, <namhyung@kernel.org>
Cc: <ravi.bangoria@amd.com>, <sandipan.das@amd.com>,
<ananth.narayan@amd.com>, <gautham.shenoy@amd.com>,
<eranian@google.com>
Subject: [RFC PATCH 1/4] perf: Read cache instance ID when building cache topology
Date: Fri, 31 Mar 2023 10:21:14 +0530 [thread overview]
Message-ID: <20230331045117.1266-2-kprateek.nayak@amd.com> (raw)
In-Reply-To: <20230331045117.1266-1-kprateek.nayak@amd.com>
CPU cache level data currently stores cache level, type, line size,
associativity, sets, total cache size, and the CPUs sharing the cache.
Also read and store the cache instance ID from
"/sys/devices/system/cpu/cpuX/cache/indexY/id" in the cache level data.
Use instance ID as well when comparing cache levels.
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
tools/perf/util/env.h | 1 +
| 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h
index 4566c51f2fd9..d761bfae76af 100644
--- a/tools/perf/util/env.h
+++ b/tools/perf/util/env.h
@@ -17,6 +17,7 @@ struct cpu_topology_map {
struct cpu_cache_level {
u32 level;
+ u32 id;
u32 line_size;
u32 sets;
u32 ways;
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 404d816ca124..5c3f5d260612 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1131,6 +1131,9 @@ static bool cpu_cache_level__cmp(struct cpu_cache_level *a, struct cpu_cache_lev
if (a->level != b->level)
return false;
+ if (a->id != b->id)
+ return false;
+
if (a->line_size != b->line_size)
return false;
@@ -1168,6 +1171,10 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
if (sysfs__read_int(file, (int *) &cache->level))
return -1;
+ scnprintf(file, PATH_MAX, "%s/id", path);
+ if (sysfs__read_int(file, (int *) &cache->id))
+ return -1;
+
scnprintf(file, PATH_MAX, "%s/coherency_line_size", path);
if (sysfs__read_int(file, (int *) &cache->line_size))
return -1;
--
2.34.1
next prev parent reply other threads:[~2023-03-31 4:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 4:51 [RFC PATCH 0/4] perf stat: Add option to aggregate data based on the cache topology K Prateek Nayak
2023-03-31 4:51 ` K Prateek Nayak [this message]
2023-03-31 11:54 ` [RFC PATCH 1/4] perf: Read cache instance ID when building " Arnaldo Carvalho de Melo
2023-04-03 2:43 ` K Prateek Nayak
2023-03-31 4:51 ` [RFC PATCH 2/4] perf: Save cache instance ID when saving cache topology data K Prateek Nayak
2023-03-31 4:51 ` [RFC PATCH 3/4] perf: Extract building cache level for a CPU into separate function K Prateek Nayak
2023-03-31 4:51 ` [RFC PATCH 4/4] perf: Add option for --per-cache aggregation K Prateek Nayak
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=20230331045117.1266-2-kprateek.nayak@amd.com \
--to=kprateek.nayak@amd.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=eranian@google.com \
--cc=gautham.shenoy@amd.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=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=sandipan.das@amd.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;
as well as URLs for NNTP newsgroup(s).