perf c2c: Fix c2c report for empty numa node
PATCH 1/1 perf c2c: Fix c2c report for empty numa node
perf c2c report fails if system has empty numa node(0 cpus):
$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4
$ sudo ./perf c2c report node/cpu topology bugFailed setup nodes
Fix this.
--- tools/perf/util/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/cpumap.c +1 -1
@@ -261,7 +261,7 @@ struct cpu_map *cpu_map__dummy_new(void)struct cpu_map *cpus =malloc (sizeof (*cpus) +sizeof (int ));if (cpus !=NULL ) { - cpus->nr =1 ; + cpus->nr =0 ; cpus->map[0 ] =-1 ;refcount_set (&cpus->refcnt,1 ); }
Signature · 1 line
2.17.1
Quoted 22 lines · Ravi Bangoria
perf c2c report fails if system has empty numa node(0 cpus):
$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4$ sudo ./perf c2c report node/cpu topology bugFailed setup nodesFix this.
Reported-by Nageswara R Sastry <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/cpumap.c +0
-0
tools/perf/util/cpumap.c struct cpu_map *cpu_map__dummy_new(void) · line 264
Quoted 5 lines
tools/perf/util/cpumap.c +1
-1@@ -261,7 +261,7 @@ struct cpu_map *cpu_map__dummy_new(void)struct cpu_map *cpus =malloc (sizeof (*cpus) +sizeof (int ));if (cpus !=NULL ) { - cpus->nr =1 ; + cpus->nr =0 ;
you can't do this, there's one item in the map, nr needs to reflect that.. it breaks 'perf test' badly
so the node is empty.. we need to teach c2c to work with that I'll check
jirka
Quoted 6 lines
tools/perf/util/cpumap.c +0
-0cpus->map[0 ] =-1 ;refcount_set (&cpus->refcnt,1 ); }Signature · 1 line
2.17.1
Quoted 32 lines · Jiri Olsa
Quoted 22 lines · Ravi Bangoria
perf c2c report fails if system has empty numa node(0 cpus):
$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4$ sudo ./perf c2c report node/cpu topology bugFailed setup nodesFix this.
Reported-by Nageswara R Sastry <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/cpumap.c +0
-0tools/perf/util/cpumap.c struct cpu_map *cpu_map__dummy_new(void) · line 264
Quoted 5 lines
tools/perf/util/cpumap.c +1
-1@@ -261,7 +261,7 @@ struct cpu_map *cpu_map__dummy_new(void)struct cpu_map *cpus =malloc (sizeof (*cpus) +sizeof (int ));if (cpus !=NULL ) { - cpus->nr =1 ; + cpus->nr =0 ;you can't do this, there's one item in the map, nr needs to reflect that.. it breaks 'perf test' badly
Quoted 2 lines
so the node is empty.. we need to teach c2c to work with that I'll check
how about attached change (untested)?
but I wonder there are some other hidden
bugs wrt empty node
jirka
---
tools/perf/builtin-c2c.c +6 -2
@@ -2056,6 +2056,12 @@ static int setup_nodes(struct perf_session *session)if (!set)return -ENOMEM ; + nodes[node] = set; + +/* empty node, skip */ +if (cpu_map__empty (map)) +continue ; +for (cpu =0 ; cpu < map->nr; cpu++) {set_bit (map->map[cpu], set);
@@ -2064,8 +2070,6 @@ static int setup_nodes(struct perf_session *session) cpu2node[map->map[cpu]] = node; } - - nodes[node] = set; }setup_nodes_header ();
Quoted 1 line · Jiri Olsa
how about attached change (untested)?
LGTM. Would you mind sending a patch.
Quoted 35 lines
but I wonder there are some other hidden
bugs wrt empty nodejirka
---
tools/perf/builtin-c2c.c +6
-2@@ -2056,6 +2056,12 @@ static int setup_nodes(struct perf_session *session)if (!set)return -ENOMEM ; + nodes[node] = set; + +/* empty node, skip */ +if (cpu_map__empty (map)) +continue ; +for (cpu =0 ; cpu < map->nr; cpu++) {set_bit (map->map[cpu], set);@@ -2064,8 +2070,6 @@ static int setup_nodes(struct perf_session *session) cpu2node[map->map[cpu]] = node; } - - nodes[node] = set; }setup_nodes_header ();
Quoted 5 lines · Ravi Bangoria
Quoted 1 line · Jiri Olsa
how about attached change (untested)?
LGTM. Would you mind sending a patch.
attached, please test on your system
thanks,
jirka
---
Ravi Bangoria reported that we fail with empty
numa node with following message:
$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4
$ sudo ./perf c2c report node/cpu topology bugFailed setup nodes
Fixing this by detecting empty node and keeping
its cpu set empty.
--- tools/perf/builtin-c2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-c2c.c +6 -2
@@ -2056,6 +2056,12 @@ static int setup_nodes(struct perf_session *session)if (!set)return -ENOMEM ; + nodes[node] = set; + +/* empty node, skip */ +if (cpu_map__empty (map)) +continue ; +for (cpu =0 ; cpu < map->nr; cpu++) {set_bit (map->map[cpu], set);
@@ -2064,8 +2070,6 @@ static int setup_nodes(struct perf_session *session) cpu2node[map->map[cpu]] = node; } - - nodes[node] = set; }setup_nodes_header ();
Signature · 1 line
2.17.2
Ravi Bangoria
Tested-byQuoted 10 lines · Jiri Olsa
Ravi Bangoria reported that we fail with empty
numa node with following message:$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4$ sudo ./perf c2c report node/cpu topology bugFailed setup nodes
Quoted 6 lines
Fixing this by detecting empty node and keeping
its cpu set empty.Reported-by Ravi Bangoria <[email protected]>Signed-off-by Jiri Olsa <[email protected]>