linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf record: Support s390 random socket_id assignment
@ 2018-06-11  7:31 Thomas Richter
  2018-06-11  7:31 ` [PATCH 2/2] perf test: Fix test 39 Session topology for s390 Thomas Richter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Richter @ 2018-06-11  7:31 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

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>
---
 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 a8bff2178fbc..34e9d6b9d945 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2113,6 +2113,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)
@@ -2167,6 +2168,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;
@@ -2176,7 +2184,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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] perf test: Fix test 39 Session topology for s390
  2018-06-11  7:31 [PATCH 1/2] perf record: Support s390 random socket_id assignment Thomas Richter
@ 2018-06-11  7:31 ` Thomas Richter
  2018-06-26  6:52   ` [tip:perf/urgent] perf test session topology: Fix test on s390 tip-bot for Thomas Richter
  2018-06-13 19:55 ` [PATCH 1/2] perf record: Support s390 random socket_id assignment Arnaldo Carvalho de Melo
  2018-06-26  6:51 ` [tip:perf/urgent] " tip-bot for Thomas Richter
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Richter @ 2018-06-11  7:31 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

On s390 this test case fails because the socket identifiction numbers
assigned to the CPU are higher than the CPU identification numbers.

Fix this by adding the platform architecture into the perf data header
flag information. This helps identifiing the test platform and handles
s390 specifics in process_cpu_topology().

Output before:
[root@p23lp27 perf]# ./perf test -vvvvv -F 39
39: Session topology                                      :
--- start ---
templ file: /tmp/perf-test-iUv755
socket_id number is too big.You may need to upgrade the perf tool.
---- end ----
Session topology: Skip
[root@p23lp27 perf]#

Output after:
[root@p23lp27 perf]# ./perf test -vvvvv -F 39
39: Session topology                                      :
--- start ---
templ file: /tmp/perf-test-8X8VTs
CPU 0, core 0, socket 6
CPU 1, core 1, socket 3
---- end ----
Session topology: Ok
[root@p23lp27 perf]#

Fixes: c84974ed9fb6 ("perf test: Add entry to test cpu topology")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
---
 tools/perf/tests/topology.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index 40e30a26b23c..9497d02f69e6 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -45,6 +45,7 @@ static int session_write_header(char *path)
 
 	perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
 	perf_header__set_feat(&session->header, HEADER_NRCPUS);
+	perf_header__set_feat(&session->header, HEADER_ARCH);
 
 	session->header.data_size += DATA_SIZE;
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf record: Support s390 random socket_id assignment
  2018-06-11  7:31 [PATCH 1/2] perf record: Support s390 random socket_id assignment Thomas Richter
  2018-06-11  7:31 ` [PATCH 2/2] perf test: Fix test 39 Session topology for s390 Thomas Richter
@ 2018-06-13 19:55 ` Arnaldo Carvalho de Melo
  2018-06-26  6:51 ` [tip:perf/urgent] " tip-bot for Thomas Richter
  2 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-06-13 19:55 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, brueckner, schwidefsky, heiko.carstens

Em Mon, Jun 11, 2018 at 09:31:52AM +0200, Thomas Richter escreveu:
> 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:

Thanks, applied both patches in this series,

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/urgent] perf record: Support s390 random socket_id assignment
  2018-06-11  7:31 [PATCH 1/2] perf record: Support s390 random socket_id assignment Thomas Richter
  2018-06-11  7:31 ` [PATCH 2/2] perf test: Fix test 39 Session topology for s390 Thomas Richter
  2018-06-13 19:55 ` [PATCH 1/2] perf record: Support s390 random socket_id assignment Arnaldo Carvalho de Melo
@ 2018-06-26  6:51 ` tip-bot for Thomas Richter
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Thomas Richter @ 2018-06-26  6:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: heiko.carstens, brueckner, mingo, linux-kernel, tmricht, acme,
	schwidefsky, tglx, hpa

Commit-ID:  01766229533f9bdb1144a41b4345c8c7286da7b4
Gitweb:     https://git.kernel.org/tip/01766229533f9bdb1144a41b4345c8c7286da7b4
Author:     Thomas Richter <tmricht@linux.ibm.com>
AuthorDate: Mon, 11 Jun 2018 09:31:52 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Jun 2018 11:59:35 -0300

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>
---
 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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip:perf/urgent] perf test session topology: Fix test on s390
  2018-06-11  7:31 ` [PATCH 2/2] perf test: Fix test 39 Session topology for s390 Thomas Richter
@ 2018-06-26  6:52   ` tip-bot for Thomas Richter
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Thomas Richter @ 2018-06-26  6:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, schwidefsky, acme, mingo, linux-kernel, tmricht, brueckner,
	tglx, heiko.carstens

Commit-ID:  b930e62ecd362843002bdf84c2940439822af321
Gitweb:     https://git.kernel.org/tip/b930e62ecd362843002bdf84c2940439822af321
Author:     Thomas Richter <tmricht@linux.ibm.com>
AuthorDate: Mon, 11 Jun 2018 09:31:53 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Jun 2018 11:59:35 -0300

perf test session topology: Fix test on s390

On s390 this test case fails because the socket identifiction numbers
assigned to the CPU are higher than the CPU identification numbers.

F/ix this by adding the platform architecture into the perf data header
flag information. This helps identifiing the test platform and handles
s390 specifics in process_cpu_topology().

Before:

  [root@p23lp27 perf]# perf test -vvvvv -F 39
  39: Session topology                                      :
  --- start ---
  templ file: /tmp/perf-test-iUv755
  socket_id number is too big.You may need to upgrade the perf tool.
  ---- end ----
  Session topology: Skip
  [root@p23lp27 perf]#

After:

  [root@p23lp27 perf]# perf test -vvvvv -F 39
  39: Session topology                                      :
  --- start ---
  templ file: /tmp/perf-test-8X8VTs
  CPU 0, core 0, socket 6
  CPU 1, core 1, socket 3
  ---- end ----
  Session topology: Ok
  [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>
Fixes: c84974ed9fb6 ("perf test: Add entry to test cpu topology")
Link: http://lkml.kernel.org/r/20180611073153.15592-2-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/topology.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index 40e30a26b23c..9497d02f69e6 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -45,6 +45,7 @@ static int session_write_header(char *path)
 
 	perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
 	perf_header__set_feat(&session->header, HEADER_NRCPUS);
+	perf_header__set_feat(&session->header, HEADER_ARCH);
 
 	session->header.data_size += DATA_SIZE;
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-26  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11  7:31 [PATCH 1/2] perf record: Support s390 random socket_id assignment Thomas Richter
2018-06-11  7:31 ` [PATCH 2/2] perf test: Fix test 39 Session topology for s390 Thomas Richter
2018-06-26  6:52   ` [tip:perf/urgent] perf test session topology: Fix test on s390 tip-bot for Thomas Richter
2018-06-13 19:55 ` [PATCH 1/2] perf record: Support s390 random socket_id assignment Arnaldo Carvalho de Melo
2018-06-26  6:51 ` [tip:perf/urgent] " tip-bot for Thomas Richter

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).