[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230405170906.2510-3-kprateek.nayak@amd.com>
Date: Wed, 5 Apr 2023 22:39:04 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: <linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<acme@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...nel.org>, <namhyung@...nel.org>
CC: <ravi.bangoria@....com>, <sandipan.das@....com>,
<ananth.narayan@....com>, <gautham.shenoy@....com>,
<eranian@...gle.com>, <puwen@...on.cn>
Subject: [RFC PATCH v2 2/4] perf: Save cache instance ID when saving cache topology data
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@....com>
---
tools/perf/util/header.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --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
Powered by blists - more mailing lists