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>, <puwen@hygon.cn>
Subject: [RFC PATCH v2 2/4] perf: Save cache instance ID when saving cache topology data
Date: Wed, 5 Apr 2023 22:39:04 +0530 [thread overview]
Message-ID: <20230405170906.2510-3-kprateek.nayak@amd.com> (raw)
In-Reply-To: <20230405170906.2510-1-kprateek.nayak@amd.com>
Bump up the version and save the cache instance ID when saving cache
topology information. When reading the topology information,
conditionally parse the instance ID for newer versions only.
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
| 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a938738f8775..2daaee5065ef 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1269,7 +1269,7 @@ static int write_cache(struct feat_fd *ff,
{
u32 max_caches = cpu__max_cpu().cpu * MAX_CACHE_LVL;
struct cpu_cache_level caches[max_caches];
- u32 cnt = 0, i, version = 1;
+ u32 cnt = 0, i, version = 2;
int ret;
ret = build_caches(caches, &cnt);
@@ -1295,6 +1295,7 @@ static int write_cache(struct feat_fd *ff,
goto out;
_W(level)
+ _W(id)
_W(line_size)
_W(sets)
_W(ways)
@@ -2886,7 +2887,7 @@ static int process_cache(struct feat_fd *ff, void *data __maybe_unused)
if (do_read_u32(ff, &version))
return -1;
- if (version != 1)
+ if (version != 1 && version != 2)
return -1;
if (do_read_u32(ff, &cnt))
@@ -2904,6 +2905,8 @@ static int process_cache(struct feat_fd *ff, void *data __maybe_unused)
goto out_free_caches; \
_R(level)
+ if (version >= 2)
+ _R(id)
_R(line_size)
_R(sets)
_R(ways)
--
2.34.1
next prev parent reply other threads:[~2023-04-05 17:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 17:09 [RFC PATCH v2 0/4] perf stat: Add option to aggregate data based on the cache topology K Prateek Nayak
2023-04-05 17:09 ` [RFC PATCH v2 1/4] perf: Read cache instance ID when building " K Prateek Nayak
2023-04-05 17:09 ` K Prateek Nayak [this message]
2023-04-05 17:09 ` [RFC PATCH v2 3/4] perf: Extract building cache level for a CPU into separate function K Prateek Nayak
2023-04-05 17:09 ` [RFC PATCH v2 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=20230405170906.2510-3-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=puwen@hygon.cn \
--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).