linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf c2c: Fix c2c report for empty numa node
@ 2019-02-28 15:37 Ravi Bangoria
  2019-02-28 16:12 ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Ravi Bangoria @ 2019-02-28 15:37 UTC (permalink / raw)
  To: acme
  Cc: alexander.shishkin, jolsa, namhyung, eranian, linux-kernel,
	tonyj, nasastry, 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 nodes

Fix this.

Reported-by: Nageswara R Sastry <nasastry@in.ibm.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 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;
 		cpus->map[0] = -1;
 		refcount_set(&cpus->refcnt, 1);
 	}
-- 
2.17.1


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

* Re: [PATCH] perf c2c: Fix c2c report for empty numa node
  2019-02-28 15:37 [PATCH] perf c2c: Fix c2c report for empty numa node Ravi Bangoria
@ 2019-02-28 16:12 ` Jiri Olsa
  2019-02-28 16:22   ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2019-02-28 16:12 UTC (permalink / raw)
  To: Ravi Bangoria
  Cc: acme, alexander.shishkin, namhyung, eranian, linux-kernel, tonyj,
	nasastry

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@in.ibm.com>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>  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
> 

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

* Re: [PATCH] perf c2c: Fix c2c report for empty numa node
  2019-02-28 16:12 ` Jiri Olsa
@ 2019-02-28 16:22   ` Jiri Olsa
  2019-03-01  7:05     ` Ravi Bangoria
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2019-02-28 16:22 UTC (permalink / raw)
  To: Ravi Bangoria
  Cc: acme, alexander.shishkin, namhyung, eranian, linux-kernel, tonyj,
	nasastry

On Thu, Feb 28, 2019 at 05:12:31PM +0100, Jiri Olsa wrote:
> 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@in.ibm.com>
> > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > ---
> >  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


how about attached change (untested)?

but I wonder there are some other hidden
bugs wrt empty node

jirka


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

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

* Re: [PATCH] perf c2c: Fix c2c report for empty numa node
  2019-02-28 16:22   ` Jiri Olsa
@ 2019-03-01  7:05     ` Ravi Bangoria
  2019-03-01 10:26       ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Ravi Bangoria @ 2019-03-01  7:05 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: acme, alexander.shishkin, namhyung, eranian, linux-kernel, tonyj,
	nasastry, Ravi Bangoria


On 2/28/19 9:52 PM, Jiri Olsa wrote:
> how about attached change (untested)?

LGTM. Would you mind sending a patch.

> 
> but I wonder there are some other hidden
> bugs wrt empty node
> 
> jirka
> 
> 
> ---
> 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();
> 


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

* Re: [PATCH] perf c2c: Fix c2c report for empty numa node
  2019-03-01  7:05     ` Ravi Bangoria
@ 2019-03-01 10:26       ` Jiri Olsa
  2019-03-02  3:07         ` Ravi Bangoria
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2019-03-01 10:26 UTC (permalink / raw)
  To: Ravi Bangoria
  Cc: acme, alexander.shishkin, namhyung, eranian, linux-kernel, tonyj,
	nasastry

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.bangoria@linux.ibm.com>
Link: http://lkml.kernel.org/n/tip-dyq5jo6pn1j3yqavb5ukjwwu@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@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


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

* Re: [PATCH] perf c2c: Fix c2c report for empty numa node
  2019-03-01 10:26       ` Jiri Olsa
@ 2019-03-02  3:07         ` Ravi Bangoria
  0 siblings, 0 replies; 6+ messages in thread
From: Ravi Bangoria @ 2019-03-02  3:07 UTC (permalink / raw)
  To: Jiri Olsa, acme
  Cc: alexander.shishkin, namhyung, eranian, linux-kernel, tonyj,
	nasastry, Ravi Bangoria


On 3/1/19 3:56 PM, Jiri Olsa wrote:
> 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.bangoria@linux.ibm.com>
> Link: http://lkml.kernel.org/n/tip-dyq5jo6pn1j3yqavb5ukjwwu@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

Reported-by: Nageswara R Sastry <nasastry@in.ibm.com>
Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>


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

end of thread, other threads:[~2019-03-02  3:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-28 15:37 [PATCH] perf c2c: Fix c2c report for empty numa node Ravi Bangoria
2019-02-28 16:12 ` Jiri Olsa
2019-02-28 16:22   ` Jiri Olsa
2019-03-01  7:05     ` Ravi Bangoria
2019-03-01 10:26       ` Jiri Olsa
2019-03-02  3:07         ` Ravi Bangoria

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