Skip to contentSkip to conversation

Minor fixes around perf bench

PATCH In review Ramkumar Ramachandra 4 participants 12 messages Mar 27, 2014 – Apr 14, 2014 perf events

lore
Share & tools
lore
#0 lore raw

cover Minor fixes around perf bench

Hi,

I just started looking at 'perf bench' this afternoon. Here are some simple patches fixing the minor issues I had while starting out.

Thanks.

Ram

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

Ramkumar Ramachandra (3):
perf bench: Set more defaults in the 'numa' suite perf bench: Update manpage to mention numa and futex perf bench: Fix segfault at the end of an 'all' execution

 tools/perf/Documentation/perf-bench.txt | 22 ++++++++++++++++++++++
 tools/perf/bench/numa.c                 |  4 ++++
 tools/perf/builtin-bench.c              |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.0.431.g014438b
#1 lore raw

PATCH 1/3 perf bench: Set more defaults in the 'numa' suite

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let us provide a minimum set of default values required for a test run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/bench/numa.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/bench/numa.c +4 -0
index d4c83c6..20697fb 100644
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
 	p->data_rand_walk		= true;
 	p->nr_loops			= -1;
 	p->init_random			= true;
+	p->mb_global_str		= "1";
+	p->nr_proc			= 1;
+	p->nr_threads			= 1;
+	p->nr_secs			= 5;
 }
 
 static int run_bench_numa(const char *name, const char **argv)
Signature · 1 line
1.9.0.431.g014438b
#2 lore raw

Re: [PATCH 1/3] perf bench: Set more defaults in the 'numa' suite

Quoted 26 lines · Ramkumar Ramachandra

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let us provide a minimum set of default values required for a test run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/bench/numa.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/bench/numa.c +0 -0
index d4c83c6..20697fb 100644

tools/perf/bench/numa.c static void init_params(struct params *p, const char *name, int argc, const char · line 1599

Quoted 7 lines
tools/perf/bench/numa.c +4 -0
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
 	p->data_rand_walk		= true;
 	p->nr_loops			= -1;
 	p->init_random			= true;
+	p->mb_global_str		= "1";
+	p->nr_proc			= 1;
+	p->nr_threads			= 1;
+	p->nr_secs			= 5;

hi,
I dont claim to understand this benchmark, but I'm now getting this:

$ ./perf bench numa all
# Running numa/mem benchmark...

SNIP

###
# 1 task will execute (on 1 nodes, 4 CPUs):

 #         -1x     1MB global  shared mem operations
 #         -1x     0MB process shared mem operations
 #         -1x     0MB thread  local  mem operations

###
...

'-1x' does not seem right/intentional for default case

thanks,
jirka

#3 lore raw

Re: [PATCH 1/3] perf bench: Set more defaults in the 'numa' suite

Quoted 10 lines · Jiri Olsa

###
# 1 task will execute (on 1 nodes, 4 CPUs):

 #         -1x     1MB global  shared mem operations
 #         -1x     0MB process shared mem operations
 #         -1x     0MB thread  local  mem operations

###
...

'-1x' does not seem right/intentional for default case

As you can see from print_summary(), -1 is the value of nr_loops. In init_params(), Ingo set nr_loops is set to -1 in his original patch -- I haven't touched that. So, unless I'm missing something, it's quite an apt default case.

Ram

#4 lore raw

Re: [PATCH 1/3] perf bench: Set more defaults in the 'numa' suite

Quoted 10 lines · Ramkumar Ramachandra
Quoted 9 lines · Jiri Olsa

###
# 1 task will execute (on 1 nodes, 4 CPUs):

 #         -1x     1MB global  shared mem operations
 #         -1x     0MB process shared mem operations
 #         -1x     0MB thread  local  mem operations

###
...

Quoted 6 lines
Quoted 1 line

'-1x' does not seem right/intentional for default case

As you can see from print_summary(), -1 is the value of nr_loops. In init_params(), Ingo set nr_loops is set to -1 in his original patch -- I haven't touched that. So, unless I'm missing something, it's quite an apt default case.

fair enough ;-) ok

thanks,
jirka

#5 lore raw

[tip:perf/urgent] perf bench: Set more defaults in the 'numa' suite

In reply to Ramkumar Ramachandra
perf bench: Set more defaults in the 'numa' suite
Commit-ID:  40ba93e3aa001246110320edbe8cf2eb488c1fe7
Gitweb:     http://git.kernel.org/tip/40ba93e3aa001246110320edbe8cf2eb488c1fe7
Author:     Ramkumar Ramachandra <[email protected]>
AuthorDate: Thu, 27 Mar 2014 19:50:17 -0400
Committer:  Jiri Olsa <[email protected]>
CommitDate: Mon, 14 Apr 2014 12:55:58 +0200

perf bench: Set more defaults in the 'numa' suite

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let us provide a minimum set of default values required for a test run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

---
 tools/perf/bench/numa.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/bench/numa.c +4 -0
index d4c83c6..20697fb 100644
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
 	p->data_rand_walk		= true;
 	p->nr_loops			= -1;
 	p->init_random			= true;
+	p->mb_global_str		= "1";
+	p->nr_proc			= 1;
+	p->nr_threads			= 1;
+	p->nr_secs			= 5;
 }
 
 static int run_bench_numa(const char *name, const char **argv)
#6 lore raw

PATCH 2/3 perf bench: Update manpage to mention numa and futex

In reply to Ramkumar Ramachandra
Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Documentation/perf-bench.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
tools/perf/Documentation/perf-bench.txt +22 -0
index 7065cd6..4464ad7 100644
@@ -48,6 +48,12 @@ SUBSYSTEM
 'mem'::
 	Memory access performance.
 
+'numa'::
+	NUMA scheduling and MM benchmarks.
+
+'futex'::
+	Futex stressing benchmarks.
+
 'all'::
 	All benchmark subsystems.
 
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
 --no-prefault::
 Show only the result without page faults before memset.
 
+SUITES FOR 'numa'
+~~~~~~~~~~~~~~~~~
+*mem*::
+Suite for evaluating NUMA workloads.
+
+SUITES FOR 'futex'
+~~~~~~~~~~~~~~~~~~
+*hash*::
+Suite for evaluating hash tables.
+
+*wake*::
+Suite for evaluating wake calls.
+
+*requeue*::
+Suite for evaluating requeue calls.
+
 SEE ALSO
 --------
 linkperf:perf[1]
Signature · 1 line
1.9.0.431.g014438b
#7 lore raw

[tip:perf/urgent] perf bench: Update manpage to mention numa and futex

perf bench: Update manpage to mention numa and futex
Commit-ID:  95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Gitweb:     http://git.kernel.org/tip/95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Author:     Ramkumar Ramachandra <[email protected]>
AuthorDate: Thu, 27 Mar 2014 19:50:18 -0400
Committer:  Jiri Olsa <[email protected]>
CommitDate: Mon, 14 Apr 2014 12:55:41 +0200

perf bench: Update manpage to mention numa and futex

---
 tools/perf/Documentation/perf-bench.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
tools/perf/Documentation/perf-bench.txt +22 -0
index 7065cd6..4464ad7 100644
@@ -48,6 +48,12 @@ SUBSYSTEM
 'mem'::
 	Memory access performance.
 
+'numa'::
+	NUMA scheduling and MM benchmarks.
+
+'futex'::
+	Futex stressing benchmarks.
+
 'all'::
 	All benchmark subsystems.
 
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
 --no-prefault::
 Show only the result without page faults before memset.
 
+SUITES FOR 'numa'
+~~~~~~~~~~~~~~~~~
+*mem*::
+Suite for evaluating NUMA workloads.
+
+SUITES FOR 'futex'
+~~~~~~~~~~~~~~~~~~
+*hash*::
+Suite for evaluating hash tables.
+
+*wake*::
+Suite for evaluating wake calls.
+
+*requeue*::
+Suite for evaluating requeue calls.
+
 SEE ALSO
 --------
 linkperf:perf[1]
#8 lore raw

PATCH 3/3 perf bench: Fix segfault at the end of an 'all' execution

In reply to Ramkumar Ramachandra

At the end of

  $ perf bench all

the program segfaults because it attempts to dereference a NULL pointer. Fix this fault.

Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-bench.c +1 -1
index f600b74..1e6e777 100644
@@ -86,7 +86,7 @@ static struct collection collections[] = {
 
 /* Iterate over all benchmarks within a collection: */
 #define for_each_bench(coll, bench) \
-	for (bench = coll->benchmarks; bench->name; bench++)
+	for (bench = coll->benchmarks; bench && bench->name; bench++)
 
 static void dump_benchmarks(struct collection *coll)
 {
Signature · 1 line
1.9.0.431.g014438b
#9 lore raw

[tip:perf/urgent] perf bench: Fix segfault at the end of an 'all' execution

perf bench: Fix segfault at the end of an 'all' execution
Commit-ID:  5673872d4afd2584e075cf2b1adb2cccec46a0f3
Gitweb:     http://git.kernel.org/tip/5673872d4afd2584e075cf2b1adb2cccec46a0f3
Author:     Ramkumar Ramachandra <[email protected]>
AuthorDate: Thu, 27 Mar 2014 19:50:19 -0400
Committer:  Jiri Olsa <[email protected]>
CommitDate: Mon, 14 Apr 2014 12:55:53 +0200

perf bench: Fix segfault at the end of an 'all' execution

At the end of

  $ perf bench all

the program segfaults because it attempts to dereference a NULL pointer. Fix this fault.

---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-bench.c +1 -1
index f600b74..1e6e777 100644
@@ -86,7 +86,7 @@ static struct collection collections[] = {
 
 /* Iterate over all benchmarks within a collection: */
 #define for_each_bench(coll, bench) \
-	for (bench = coll->benchmarks; bench->name; bench++)
+	for (bench = coll->benchmarks; bench && bench->name; bench++)
 
 static void dump_benchmarks(struct collection *coll)
 {
Acked-by on the v1 series
#10 lore raw
In reply to Ramkumar Ramachandra
Quoted 14 lines · Ramkumar Ramachandra

Hi,

I just started looking at 'perf bench' this afternoon. Here are some simple patches fixing the minor issues I had while starting out.

Thanks.

Ram

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc David Ahern <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Quoted 4 lines

Ramkumar Ramachandra (3):
perf bench: Set more defaults in the 'numa' suite perf bench: Update manpage to mention numa and futex perf bench: Fix segfault at the end of an 'all' execution

#11 lore raw
In reply to Ramkumar Ramachandra
Quoted 4 lines · Ramkumar Ramachandra

Hi,

I just started looking at 'perf bench' this afternoon. Here are some simple patches fixing the minor issues I had while starting out.

look good to me, will merge them

thanks,
jirka