On Fri, Mar 01, 2019 at 12:35:39PM +0530, Ravi Bangoria wrote:
> 
> On 2/28/19 9:52 PM, Jiri Olsa wrote:
> > 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.

Reported-by: Ravi Bangoria <ravi.bango...@linux.ibm.com>
Link: http://lkml.kernel.org/n/tip-dyq5jo6pn1j3yqavb5ukj...@git.kernel.org
Signed-off-by: Jiri Olsa <jo...@kernel.org>
---
 tools/perf/builtin-c2c.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 4272763a5e96..9e6cc868bdb4 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -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();
-- 
2.17.2

Reply via email to