summaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorThomas Richter <tmricht@linux.ibm.com>2018-06-11 03:31:52 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-06-25 10:59:35 -0400
commit01766229533f9bdb1144a41b4345c8c7286da7b4 (patch)
treedc42cbcb8816aeeacf1a8ef96bd902638a59c3c5 /tools/perf
parent57d6a7938a8fc6cee8420b40ca244220b41721f5 (diff)
perf record: Support s390 random socket_id assignment
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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/header.c10
1 files changed, 9 insertions, 1 deletions
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)
2129 int cpu_nr = ff->ph->env.nr_cpus_avail; 2129 int cpu_nr = ff->ph->env.nr_cpus_avail;
2130 u64 size = 0; 2130 u64 size = 0;
2131 struct perf_header *ph = ff->ph; 2131 struct perf_header *ph = ff->ph;
2132 bool do_core_id_test = true;
2132 2133
2133 ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); 2134 ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu));
2134 if (!ph->env.cpu) 2135 if (!ph->env.cpu)
@@ -2183,6 +2184,13 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
2183 return 0; 2184 return 0;
2184 } 2185 }
2185 2186
2187 /* On s390 the socket_id number is not related to the numbers of cpus.
2188 * The socket_id number might be higher than the numbers of cpus.
2189 * This depends on the configuration.
2190 */
2191 if (ph->env.arch && !strncmp(ph->env.arch, "s390", 4))
2192 do_core_id_test = false;
2193
2186 for (i = 0; i < (u32)cpu_nr; i++) { 2194 for (i = 0; i < (u32)cpu_nr; i++) {
2187 if (do_read_u32(ff, &nr)) 2195 if (do_read_u32(ff, &nr))
2188 goto free_cpu; 2196 goto free_cpu;
@@ -2192,7 +2200,7 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
2192 if (do_read_u32(ff, &nr)) 2200 if (do_read_u32(ff, &nr))
2193 goto free_cpu; 2201 goto free_cpu;
2194 2202
2195 if (nr != (u32)-1 && nr > (u32)cpu_nr) { 2203 if (do_core_id_test && nr != (u32)-1 && nr > (u32)cpu_nr) {
2196 pr_debug("socket_id number is too big." 2204 pr_debug("socket_id number is too big."
2197 "You may need to upgrade the perf tool.\n"); 2205 "You may need to upgrade the perf tool.\n");
2198 goto free_cpu; 2206 goto free_cpu;