All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	mhiramat@kernel.org, jstancek@redhat.com
Subject: [PATCH v4 0/3] perf: topology on systems with offline/absent CPUs
Date: Mon, 20 Feb 2017 10:33:17 +0100	[thread overview]
Message-ID: <cover.1487579859.git.jstancek@redhat.com> (raw)

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

             reply	other threads:[~2017-02-20  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20  9:33 Jan Stancek [this message]
2017-02-20  9:33 ` [PATCH v4 1/3] perf cpu_map: Add cpu__max_present_cpu() Jan Stancek
2017-02-20  9:33 ` [PATCH v4 2/3] perf header: Make build_cpu_topology skip offline/absent CPUs Jan Stancek
2017-02-20  9:33 ` [PATCH v4 3/3] perf: Replace _SC_NPROCESSORS_CONF with max_present_cpu in cpu_topology_map Jan Stancek

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=cover.1487579859.git.jstancek@redhat.com \
    --to=jstancek@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.