From: Yinghai Lu <yinghai@kernel.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH] perf: fix core dump for "perf bench all"
Date: Thu, 12 Sep 2013 22:37:47 -0700 [thread overview]
Message-ID: <1379050667-4357-1-git-send-email-yinghai@kernel.org> (raw)
When numa for perf bench is compiled will have core dump.
| #./perf bench numa all
| # Running numa/mem benchmark...
|
| Segmentation fault (core dumped)
| # ./perf bench all
| # Running numa/mem benchmark...
|
| Segmentation fault (core dumped)
Fix it by adding own handler for numa bench. all_suite()
will search and find handler call it first, if can not
find it, will fallback the old way.
Also fix argv setting in that function, we should use [0]
as argc is 1.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
tools/perf/bench/bench.h | 1 +
tools/perf/bench/numa.c | 5 +++--
tools/perf/builtin-bench.c | 19 +++++++++++++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
Index: linux-2.6/tools/perf/bench/bench.h
===================================================================
--- linux-2.6.orig/tools/perf/bench/bench.h
+++ linux-2.6/tools/perf/bench/bench.h
@@ -26,6 +26,7 @@
#endif
extern int bench_numa(int argc, const char **argv, const char *prefix);
+int bench_numa_all(int argc, const char **argv, const char *prefix);
extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
extern int bench_mem_memcpy(int argc, const char **argv,
Index: linux-2.6/tools/perf/bench/numa.c
===================================================================
--- linux-2.6.orig/tools/perf/bench/numa.c
+++ linux-2.6/tools/perf/bench/numa.c
@@ -1691,7 +1691,8 @@ static const char *tests[][MAX_ARGS] = {
"mem", "-p", "2", "-t", "16", "-T", "192", OPT_BW_NOTHP },
};
-static int bench_all(void)
+int bench_numa_all(int argc __maybe_unused, const char **argv __maybe_unused,
+ const char *prefix __maybe_unused)
{
int nr = ARRAY_SIZE(tests);
int ret;
@@ -1718,7 +1719,7 @@ int bench_numa(int argc, const char **ar
goto err;
if (p0.run_all)
- return bench_all();
+ return bench_numa_all(argc, argv, prefix);
if (__bench_numa(NULL))
goto err;
Index: linux-2.6/tools/perf/builtin-bench.c
===================================================================
--- linux-2.6.orig/tools/perf/builtin-bench.c
+++ linux-2.6/tools/perf/builtin-bench.c
@@ -40,7 +40,7 @@ static struct bench_suite numa_suites[]
{ "mem",
"Benchmark for NUMA workloads",
bench_numa },
- suite_all,
+ { "all", "Test all benchmark suites", bench_numa_all },
{ NULL,
NULL,
NULL }
@@ -166,6 +166,21 @@ static void all_suite(struct bench_subsy
struct bench_suite *suites = subsys->suites;
argv[1] = NULL;
+
+ /* own all handling ? */
+ for (i = 0; suites[i].fn; i++) {
+ if (!strcmp("all", suites[i].name)) {
+ printf("# Running %s/%s benchmark...\n",
+ subsys->name,
+ suites[i].name);
+ fflush(stdout);
+
+ argv[0] = suites[i].name;
+ suites[i].fn(1, argv, NULL);
+ return;
+ }
+ }
+
/*
* TODO:
* preparing preset parameters for
@@ -178,7 +193,7 @@ static void all_suite(struct bench_subsy
suites[i].name);
fflush(stdout);
- argv[1] = suites[i].name;
+ argv[0] = suites[i].name;
suites[i].fn(1, argv, NULL);
printf("\n");
}
reply other threads:[~2013-09-13 5:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379050667-4357-1-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).