Re: [PATCH] perf c2c: Fix c2c report for empty numa node

From: Jiri Olsa
Date: Thu Feb 28 2019 - 11:12:35 EST


On Thu, Feb 28, 2019 at 09:07:19PM +0530, Ravi Bangoria wrote:
> 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.
>
> Reported-by: Nageswara R Sastry <nasastry@xxxxxxxxxx>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx>
> ---
> tools/perf/util/cpumap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index 383674f448fc..517c3f37c613 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -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

> cpus->map[0] = -1;
> refcount_set(&cpus->refcnt, 1);
> }
> --
> 2.17.1
>