From: tip-bot for Kan Liang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: ak@linux.intel.com, mingo@kernel.org, jolsa@kernel.org,
tglx@linutronix.de, kan.liang@linux.intel.com,
linux-kernel@vger.kernel.org, acme@redhat.com,
peterz@infradead.org, hpa@zytor.com
Subject: [tip:perf/core] perf tools: Apply new CPU topology sysfs attributes
Date: Mon, 17 Jun 2019 12:34:47 -0700 [thread overview]
Message-ID: <tip-0ccdb8407a4660f6dbc5977bc060917d2c3e7986@git.kernel.org> (raw)
In-Reply-To: <1559688644-106558-5-git-send-email-kan.liang@linux.intel.com>
Commit-ID: 0ccdb8407a4660f6dbc5977bc060917d2c3e7986
Gitweb: https://git.kernel.org/tip/0ccdb8407a4660f6dbc5977bc060917d2c3e7986
Author: Kan Liang <kan.liang@linux.intel.com>
AuthorDate: Tue, 4 Jun 2019 15:50:44 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jun 2019 16:20:11 -0300
perf tools: Apply new CPU topology sysfs attributes
The existing "thread_siblings" and "thread_siblings_list" attribute will
be deprecated.
Use the new CPU topology sysfs attributes, "core_cpus" and
"core_cpus_list", which are synonymous with the deprecated attributes.
Check the new name first. If not available, use the deprecated name to
be compatible with old kernel.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1559688644-106558-5-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/cputopo.c | 8 +++++++-
tools/perf/util/smt.c | 8 ++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c
index 85fa87fc30cf..26e73a4bd4fe 100644
--- a/tools/perf/util/cputopo.c
+++ b/tools/perf/util/cputopo.c
@@ -15,6 +15,8 @@
"%s/devices/system/cpu/cpu%d/topology/die_cpus_list"
#define THRD_SIB_FMT \
"%s/devices/system/cpu/cpu%d/topology/thread_siblings_list"
+#define THRD_SIB_FMT_NEW \
+ "%s/devices/system/cpu/cpu%d/topology/core_cpus_list"
#define NODE_ONLINE_FMT \
"%s/devices/system/node/online"
#define NODE_MEMINFO_FMT \
@@ -91,8 +93,12 @@ try_dies:
ret = 0;
try_threads:
- scnprintf(filename, MAXPATHLEN, THRD_SIB_FMT,
+ scnprintf(filename, MAXPATHLEN, THRD_SIB_FMT_NEW,
sysfs__mountpoint(), cpu);
+ if (access(filename, F_OK) == -1) {
+ scnprintf(filename, MAXPATHLEN, THRD_SIB_FMT,
+ sysfs__mountpoint(), cpu);
+ }
fp = fopen(filename, "r");
if (!fp)
goto done;
diff --git a/tools/perf/util/smt.c b/tools/perf/util/smt.c
index 453f6f6f29f3..3b791ef2cd50 100644
--- a/tools/perf/util/smt.c
+++ b/tools/perf/util/smt.c
@@ -23,8 +23,12 @@ int smt_on(void)
char fn[256];
snprintf(fn, sizeof fn,
- "devices/system/cpu/cpu%d/topology/thread_siblings",
- cpu);
+ "devices/system/cpu/cpu%d/topology/core_cpus", cpu);
+ if (access(fn, F_OK) == -1) {
+ snprintf(fn, sizeof fn,
+ "devices/system/cpu/cpu%d/topology/thread_siblings",
+ cpu);
+ }
if (sysfs__read_str(fn, &str, &strlen) < 0)
continue;
/* Entry is hex, but does not have 0x, so need custom parser */
next prev parent reply other threads:[~2019-06-17 19:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 22:50 [PATCH V3 1/5] perf cpumap: Retrieve die id information kan.liang
2019-06-04 22:50 ` [PATCH V3 2/5] perf header: Add die information in CPU topology kan.liang
2019-06-06 19:12 ` Arnaldo Carvalho de Melo
2019-06-06 20:08 ` Arnaldo Carvalho de Melo
2019-06-06 20:56 ` Liang, Kan
2019-06-17 19:32 ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-04 22:50 ` [PATCH V3 3/5] perf stat: Support per-die aggregation kan.liang
2019-06-04 22:50 ` [PATCH V3 4/5] perf header: Rename "sibling cores" to "sibling sockets" kan.liang
2019-06-17 19:34 ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-04 22:50 ` [PATCH V3 5/5] perf tools: Apply new CPU topology sysfs attributes kan.liang
2019-06-17 19:34 ` tip-bot for Kan Liang [this message]
2019-06-05 9:09 ` [PATCH V3 1/5] perf cpumap: Retrieve die id information Jiri Olsa
2019-06-06 19:19 ` Arnaldo Carvalho de Melo
2019-06-17 19:32 ` [tip:perf/core] " tip-bot for Kan Liang
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=tip-0ccdb8407a4660f6dbc5977bc060917d2c3e7986@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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