[PATCH v4 0/3] perf: topology on systems with offline/absent CPUs
From: Jan Stancek
Date: Mon Feb 20 2017 - 04:34:41 EST
Changes in v4:
- rebase on top of 4.10
- fix style of commit logs
- add comment to process_cpu_topology()
This series aims to address issues on systems with offline/absent CPUs:
1. cpu_topology_map size
Allocation based on _SC_NPROCESSORS_CONF is too small,
there can be CPU IDs that are higher, which causes invalid reads.
2. build_cpu_topology fails for offline/absent CPUs
It is trying to parse sysfs entries, that do not exist.
3. perf topology test fails
Changes affect HEADER_NRCPUS and HEADER_CPU_TOPOLOGY:
For example on a system like this:
_SC_NPROCESSORS_CONF == 16
available: 2 nodes (0-1)
node 0 cpus: 0 6 8 10 16 22 24 26
node 0 size: 12004 MB
node 0 free: 9470 MB
node 1 cpus: 1 7 9 11 23 25 27
node 1 size: 12093 MB
node 1 free: 9406 MB
node distances:
node 0 1
0: 10 20
1: 20 10
HEADER_NRCPUS before this series:
nr_cpus_online = 15
nr_cpus_available = 16
HEADER_CPU_TOPOLOGY before this series:
core_sib_nr: 2
core_siblings: 0,6,8,10,16,22,24,26
core_siblings: 1,7,9,11,23,25,27
thread_sib_nr: 8
thread_siblings: 0,16
thread_siblings: 1
thread_siblings: 6,22
thread_siblings: 7,23
thread_siblings: 8,24
thread_siblings: 9,25
thread_siblings: 10,26
thread_siblings: 11,27
core_id: 0, socket_id: 0
core_id: 0, socket_id: 1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: 10, socket_id: 0
core_id: 10, socket_id: 1
core_id: 1, socket_id: 0
core_id: 1, socket_id: 1
core_id: 9, socket_id: 0
core_id: 9, socket_id: 1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
HEADER_NRCPUS with this series applied:
nr_cpus_online = 15
nr_cpus_available = 28
HEADER_CPU_TOPOLOGY with this series applied:
core_sib_nr: 2
core_siblings: 0,6,8,10,16,22,24,26
core_siblings: 1,7,9,11,23,25,27
thread_sib_nr: 8
thread_siblings: 0,16
thread_siblings: 1
thread_siblings: 6,22
thread_siblings: 7,23
thread_siblings: 8,24
thread_siblings: 9,25
thread_siblings: 10,26
thread_siblings: 11,27
core_id: 0, socket_id: 0
core_id: 0, socket_id: 1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: 10, socket_id: 0
core_id: 10, socket_id: 1
core_id: 1, socket_id: 0
core_id: 1, socket_id: 1
core_id: 9, socket_id: 0
core_id: 9, socket_id: 1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: 0, socket_id: 0
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: -1, socket_id: -1
core_id: 10, socket_id: 0
core_id: 10, socket_id: 1
core_id: 1, socket_id: 0
core_id: 1, socket_id: 1
core_id: 9, socket_id: 0
core_id: 9, socket_id: 1
Jan Stancek (3):
perf cpu_map: Add cpu__max_present_cpu()
perf header: Make build_cpu_topology skip offline/absent CPUs
perf: Replace _SC_NPROCESSORS_CONF with max_present_cpu in
cpu_topology_map
tools/perf/builtin-stat.c | 2 +-
tools/perf/tests/topology.c | 4 +++-
tools/perf/util/cpumap.c | 22 ++++++++++++++++++++++
tools/perf/util/cpumap.h | 1 +
tools/perf/util/env.c | 2 +-
tools/perf/util/header.c | 37 ++++++++++++++++++++++++-------------
6 files changed, 52 insertions(+), 16 deletions(-)
--
1.8.3.1