* [PATCH 1/2] perf bench numa: Make no args mean 'run all tests'
2014-03-14 17:23 [GIT PULL 0/2] perf/urgent 'perf bench' fixes Arnaldo Carvalho de Melo
@ 2014-03-14 17:23 ` Arnaldo Carvalho de Melo
2014-03-14 17:23 ` [PATCH 2/2] perf bench: Fix NULL pointer dereference in "perf bench all" Arnaldo Carvalho de Melo
2014-03-18 8:22 ` [GIT PULL 0/2] perf/urgent 'perf bench' fixes Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-03-14 17:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Patrick Palka, Paul Mackerras, Peter Zijlstra,
Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
If we call just:
perf bench numa mem
it will present the same output as:
perf bench numa mem -h
i.e. ask for instructions about what to run.
While that is kinda ok, using 'run all tests' as the default, i.e.
making 'no parms' be equivalent to:
perf bench numa mem -a
Will allow:
perf bench numa all
to actually do what is asked: i.e. run all the 'bench' tests, instead of
responding to that by asking what to do.
That, in turn, allows:
perf bench all
to actually complete, for the same reasons.
And after that, the tests that come after that, and that at some point
hit a NULL deref, will run, allowing me to reproduce a recently reported
problem.
That when you have the needed numa libraries, which wasn't the case for
the reporter, making me a bit confused after trying to reproduce his
report.
So make no parms mean -a.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Patrick Palka <patrick@parcs.ath.cx>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x7h0ghx4pef4n0brywg21krk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/numa.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index d4c83c60b9b2..97d86d828190 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1593,6 +1593,7 @@ 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->run_all = argc == 1;
}
static int run_bench_numa(const char *name, const char **argv)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] perf bench: Fix NULL pointer dereference in "perf bench all"
2014-03-14 17:23 [GIT PULL 0/2] perf/urgent 'perf bench' fixes Arnaldo Carvalho de Melo
2014-03-14 17:23 ` [PATCH 1/2] perf bench numa: Make no args mean 'run all tests' Arnaldo Carvalho de Melo
@ 2014-03-14 17:23 ` Arnaldo Carvalho de Melo
2014-03-18 8:22 ` [GIT PULL 0/2] perf/urgent 'perf bench' fixes Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-03-14 17:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Patrick Palka, Ingo Molnar, Paul Mackerras,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Patrick Palka <patrick@parcs.ath.cx>
The for_each_bench() macro must check that the "benchmarks" field of a
collection is not NULL before dereferencing it because the "all"
collection in particular has a NULL "benchmarks" field (signifying that
it has no benchmarks to iterate over).
This fixes this NULL pointer dereference when running "perf bench all":
[root@ssdandy ~]# perf bench all
<SNIP>
# Running mem/memset benchmark...
# Copying 1MB Bytes ...
2.453675 GB/Sec
12.056327 GB/Sec (with prefault)
Segmentation fault (core dumped)
[root@ssdandy ~]#
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1394664051-6037-1-git-send-email-patrick@parcs.ath.cx
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-bench.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index e47f90cc7b98..8a987d252780 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -76,7 +76,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)
{
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [GIT PULL 0/2] perf/urgent 'perf bench' fixes
2014-03-14 17:23 [GIT PULL 0/2] perf/urgent 'perf bench' fixes Arnaldo Carvalho de Melo
2014-03-14 17:23 ` [PATCH 1/2] perf bench numa: Make no args mean 'run all tests' Arnaldo Carvalho de Melo
2014-03-14 17:23 ` [PATCH 2/2] perf bench: Fix NULL pointer dereference in "perf bench all" Arnaldo Carvalho de Melo
@ 2014-03-18 8:22 ` Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2014-03-18 8:22 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Patrick Palka, Paul Mackerras, Peter Zijlstra,
Stephane Eranian
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit b7b4839d93e50adccef29eccb694807cdcb8bee3:
>
> perf/x86: Fix leak in uncore_type_init failure paths (2014-03-11 11:59:34 +0100)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
>
> for you to fetch changes up to 6eeefccdcfc2cc9697562e740bfe6c35fddd4e1c:
>
> perf bench: Fix NULL pointer dereference in "perf bench all" (2014-03-14 13:45:54 -0300)
>
> ----------------------------------------------------------------
> perf/urgent 'bench' fixes:
>
> . Make 'perf bench mem' (i.e. no args) mean 'run all tests' so that we can run
> all tests, not stopping at the numa ones. (Arnaldo Carvalho de Melo)
>
> . Fix NULL pointer dereference after last test in in "perf bench all" (Patrick Palka)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
> perf bench numa: Make no args mean 'run all tests'
>
> Patrick Palka (1):
> perf bench: Fix NULL pointer dereference in "perf bench all"
>
> tools/perf/bench/numa.c | 1 +
> tools/perf/builtin-bench.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread