linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Thomas Richter <tmricht@linux.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 01/19] perf record: Support s390 random socket_id assignment
Date: Mon, 25 Jun 2018 14:40:27 -0300	[thread overview]
Message-ID: <20180625174045.25765-2-acme@kernel.org> (raw)
In-Reply-To: <20180625174045.25765-1-acme@kernel.org>

From: Thomas Richter <tmricht@linux.ibm.com>

On s390 the socket identifier assigned to a CPU identifier is random and
(depending on the configuration of the LPAR) may be higher than the CPU
identifier. This is currently not supported.

Fix this by allowing arbitrary socket identifiers being assigned to
CPU id.

Output before:

  [root@p23lp27 perf]# ./perf report --header -I -v
  ...
  socket_id number is too big.You may need to upgrade the perf tool.
  Error:
  The perf.data file has no samples!
  # ========
  # captured on    : Tue May 29 09:29:57 2018
  # header version : 1
  ...
  # Core ID and Socket ID information is not available
  ...
  [root@p23lp27 perf]#

Output after:

  [root@p23lp27 perf]# ./perf report --header -I -v
  ...
  Error:
  The perf.data file has no samples!
  # ========
  # captured on    : Tue May 29 09:29:57 2018
  # header version : 1
  ...
  # CPU 0: Core ID 0, Socket ID 6
  # CPU 1: Core ID 1, Socket ID 3
  # CPU 2: Core ID -1, Socket ID -1
  ...
  [root@p23lp27 perf]#

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180611073153.15592-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 540cd2dcd3e7..59fcc790c865 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2129,6 +2129,7 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
 	int cpu_nr = ff->ph->env.nr_cpus_avail;
 	u64 size = 0;
 	struct perf_header *ph = ff->ph;
+	bool do_core_id_test = true;
 
 	ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu));
 	if (!ph->env.cpu)
@@ -2183,6 +2184,13 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
 		return 0;
 	}
 
+	/* On s390 the socket_id number is not related to the numbers of cpus.
+	 * The socket_id number might be higher than the numbers of cpus.
+	 * This depends on the configuration.
+	 */
+	if (ph->env.arch && !strncmp(ph->env.arch, "s390", 4))
+		do_core_id_test = false;
+
 	for (i = 0; i < (u32)cpu_nr; i++) {
 		if (do_read_u32(ff, &nr))
 			goto free_cpu;
@@ -2192,7 +2200,7 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
 		if (do_read_u32(ff, &nr))
 			goto free_cpu;
 
-		if (nr != (u32)-1 && nr > (u32)cpu_nr) {
+		if (do_core_id_test && nr != (u32)-1 && nr > (u32)cpu_nr) {
 			pr_debug("socket_id number is too big."
 				 "You may need to upgrade the perf tool.\n");
 			goto free_cpu;
-- 
2.14.3

  reply	other threads:[~2018-06-25 17:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 17:40 [GIT PULL 00/19] perf/urgent fixes for 4.18 Arnaldo Carvalho de Melo
2018-06-25 17:40 ` Arnaldo Carvalho de Melo [this message]
2018-06-25 17:40 ` [PATCH 02/19] perf test session topology: Fix test on s390 Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 03/19] perf report powerpc: Fix crash if callchain is empty Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 04/19] perf tests: Add event parsing error handling to parse events test Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 05/19] perf tests: Add valid callback for parse-events test Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 06/19] perf intel-pt: Fix packet decoding of CYC packets Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 07/19] tools headers uapi: Synchronize drm/drm.h Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 08/19] perf tools: Update x86's syscall_64.tbl, adding 'io_pgetevents' and 'rseq' Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 09/19] tools include powerpc: Update arch/powerpc/include/uapi/asm/unistd.h copy to get 'rseq' syscall Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 10/19] tools include uapi: Update if_link.h to pick IFLA_{BRPORT_ISOLATED,VXLAN_TTL_INHERIT} Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 11/19] tools include uapi: Synchronize bpf.h with the kernel Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 12/19] perf tools: Fix a clang 7.0 compilation error Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 13/19] perf alias: Remove trailing newline when reading sysfs files Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 14/19] perf alias: Rebuild alias expression string to make it comparable Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 15/19] perf stat: Remove duplicate event counting Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 16/19] perf bench: Fix numa report output code Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 17/19] perf script: Add missing output fields in a hint Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 18/19] perf script: Fix crash because of missing evsel->priv Arnaldo Carvalho de Melo
2018-06-25 17:40 ` [PATCH 19/19] perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE] Arnaldo Carvalho de Melo
2018-06-25 20:26 ` [GIT PULL 00/19] perf/urgent fixes for 4.18 Arnaldo Carvalho de Melo
2018-06-26  6:46 ` Ingo Molnar

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=20180625174045.25765-2-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tmricht@linux.ibm.com \
    --cc=williams@redhat.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).