Skip to contentSkip to conversation

perf bench numa: Fix cpu0 binding

PATCH Applied Jiri Olsa 3 participants 3 messages Aug 1, 2019 – Aug 8, 2019 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf bench numa: Fix cpu0 binding

Michael reported an issue with perf bench numa failing with binding to cpu0 with '-0' option.

  # perf bench numa mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd
  # Running 'numa/mem' benchmark:

# Running main, "perf bench numa numa-mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd"
binding to node 0, mask: 0000000000000001 => -1
perf: bench/numa.c:356: bind_to_memnode: Assertion `!(ret)' failed.
Aborted (core dumped)

This happens when the cpu0 is not part of node0, which is the benchmark assumption and we can see that's not the case for some powerpc servers.

Using correct node for cpu0 binding.

---
 tools/perf/bench/numa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +4 -2
index a640ca7aaada..513cb2f2fa32 100644
@@ -379,8 +379,10 @@ static u8 *alloc_data(ssize_t bytes0, int map_flags,
 
 	/* Allocate and initialize all memory on CPU#0: */
 	if (init_cpu0) {
-		orig_mask = bind_to_node(0);
-		bind_to_memnode(0);
+		int node = numa_node_of_cpu(0);
+
+		orig_mask = bind_to_node(node);
+		bind_to_memnode(node);
 	}
 
 	bytes = bytes0 + HPSIZE;
Signature · 1 line
2.21.0
#1 lore raw

Em Thu, Aug 01, 2019 at 04:26:42PM +0200, Jiri Olsa escreveu:

Quoted 11 lines

Michael reported an issue with perf bench numa failing with binding to cpu0 with '-0' option.

  # perf bench numa mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd
  # Running 'numa/mem' benchmark:
   # Running main, "perf bench numa numa-mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd"

binding to node 0, mask: 0000000000000001 => -1
perf: bench/numa.c:356: bind_to_memnode: Assertion `!(ret)' failed. Aborted (core dumped)

Quoted 5 lines

This happens when the cpu0 is not part of node0, which is the benchmark assumption and we can see that's not the case for some powerpc servers.

Using correct node for cpu0 binding.

Thanks, applied to perf/urgent.

- Arnaldo

Quoted 27 lines
---
 tools/perf/bench/numa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +4 -2
index a640ca7aaada..513cb2f2fa32 100644
@@ -379,8 +379,10 @@ static u8 *alloc_data(ssize_t bytes0, int map_flags,
 
 	/* Allocate and initialize all memory on CPU#0: */
 	if (init_cpu0) {
-		orig_mask = bind_to_node(0);
-		bind_to_memnode(0);
+		int node = numa_node_of_cpu(0);
+
+		orig_mask = bind_to_node(node);
+		bind_to_memnode(node);
 	}
 
 	bytes = bytes0 + HPSIZE;
Signature · 1 line
2.21.0
Signature · 1 line
- Arnaldo
#2 lore raw
In reply to Jiri Olsa
perf bench numa: Fix cpu0 binding
Commit-ID:  6bbfe4e602691b90ac866712bd4c43c51e546a60
Gitweb:     https://git.kernel.org/tip/6bbfe4e602691b90ac866712bd4c43c51e546a60
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 1 Aug 2019 16:26:42 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 1 Aug 2019 11:34:13 -0300

perf bench numa: Fix cpu0 binding

Michael reported an issue with perf bench numa failing with binding to cpu0 with '-0' option.

  # perf bench numa mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd
  # Running 'numa/mem' benchmark:

# Running main, "perf bench numa numa-mem -p 3 -t 1 -P 512 -s 100 -zZcm0 --thp 1 -M 1 -ddd"
binding to node 0, mask: 0000000000000001 => -1
perf: bench/numa.c:356: bind_to_memnode: Assertion `!(ret)' failed.
Aborted (core dumped)

This happens when the cpu0 is not part of node0, which is the benchmark assumption and we can see that's not the case for some powerpc servers.

Using correct node for cpu0 binding.

---
 tools/perf/bench/numa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +4 -2
index a640ca7aaada..513cb2f2fa32 100644
@@ -379,8 +379,10 @@ static u8 *alloc_data(ssize_t bytes0, int map_flags,
 
 	/* Allocate and initialize all memory on CPU#0: */
 	if (init_cpu0) {
-		orig_mask = bind_to_node(0);
-		bind_to_memnode(0);
+		int node = numa_node_of_cpu(0);
+
+		orig_mask = bind_to_node(node);
+		bind_to_memnode(node);
 	}
 
 	bytes = bytes0 + HPSIZE;