Skip to content

Commit 67d6129

Browse files
author
Ingo Molnar
committed
Merge tag 'perf-core-for-mingo-20160419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: Build fixes: - Fix 'perf trace' build when DWARF unwind isn't available (Arnaldo Carvalho de Melo) - Remove x86 references from arch-neutral Build, fixing it in !x86 arches, reported as breaking the build for powerpc64le in linux-next (Arnaldo Carvalho de Melo) Infrastructure changes: - Do memset() variable 'st' using the correct size in the jit code (Colin Ian King) - Fix postgresql ubuntu 'perf script' install instructions (Chris Phlipot) - Use callchain_param more thoroughly when checking how callchains were configured, eventually will be the only way to look for callchain parameters (Arnaldo Carvalho de Melo) - Fix some issues in the 'perf test kallsyms' entry (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2 parents 31b8431 + 6566fea commit 67d6129

18 files changed

+74
-56
lines changed

tools/perf/builtin-record.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,6 @@ int record_opts__parse_callchain(struct record_opts *record,
946946
const char *arg, bool unset)
947947
{
948948
int ret;
949-
record->callgraph_set = true;
950949
callchain->enabled = !unset;
951950

952951
/* --no-call-graph */
@@ -978,15 +977,14 @@ int record_callchain_opt(const struct option *opt,
978977
const char *arg __maybe_unused,
979978
int unset __maybe_unused)
980979
{
981-
struct record_opts *record = (struct record_opts *)opt->value;
980+
struct callchain_param *callchain = opt->value;
982981

983-
record->callgraph_set = true;
984-
callchain_param.enabled = true;
982+
callchain->enabled = true;
985983

986-
if (callchain_param.record_mode == CALLCHAIN_NONE)
987-
callchain_param.record_mode = CALLCHAIN_FP;
984+
if (callchain->record_mode == CALLCHAIN_NONE)
985+
callchain->record_mode = CALLCHAIN_FP;
988986

989-
callchain_debug(&callchain_param);
987+
callchain_debug(callchain);
990988
return 0;
991989
}
992990

@@ -1224,7 +1222,7 @@ struct option __record_options[] = {
12241222
record__parse_mmap_pages),
12251223
OPT_BOOLEAN(0, "group", &record.opts.group,
12261224
"put the counters into a counter group"),
1227-
OPT_CALLBACK_NOOPT('g', NULL, &record.opts,
1225+
OPT_CALLBACK_NOOPT('g', NULL, &callchain_param,
12281226
NULL, "enables call-graph recording" ,
12291227
&record_callchain_opt),
12301228
OPT_CALLBACK(0, "call-graph", &record.opts,

tools/perf/builtin-report.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct report {
4747
struct perf_tool tool;
4848
struct perf_session *session;
4949
bool use_tui, use_gtk, use_stdio;
50-
bool dont_use_callchains;
5150
bool show_full_info;
5251
bool show_threads;
5352
bool inverted_callchain;
@@ -247,7 +246,7 @@ static int report__setup_sample_type(struct report *rep)
247246
"you call 'perf record' without -g?\n");
248247
return -1;
249248
}
250-
} else if (!rep->dont_use_callchains &&
249+
} else if (!callchain_param.enabled &&
251250
callchain_param.mode != CHAIN_NONE &&
252251
!symbol_conf.use_callchain) {
253252
symbol_conf.use_callchain = true;
@@ -599,13 +598,15 @@ static int __cmd_report(struct report *rep)
599598
static int
600599
report_parse_callchain_opt(const struct option *opt, const char *arg, int unset)
601600
{
602-
struct report *rep = (struct report *)opt->value;
601+
struct callchain_param *callchain = opt->value;
603602

603+
callchain->enabled = !unset;
604604
/*
605605
* --no-call-graph
606606
*/
607607
if (unset) {
608-
rep->dont_use_callchains = true;
608+
symbol_conf.use_callchain = false;
609+
callchain->mode = CHAIN_NONE;
609610
return 0;
610611
}
611612

@@ -734,7 +735,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
734735
"regex filter to identify parent, see: '--sort parent'"),
735736
OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
736737
"Only display entries with parent-match"),
737-
OPT_CALLBACK_DEFAULT('g', "call-graph", &report,
738+
OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param,
738739
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
739740
report_callchain_help, &report_parse_callchain_opt,
740741
callchain_default_opt),

tools/perf/builtin-script.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ static void process_event(struct perf_script *script,
791791
if (PRINT_FIELD(IP)) {
792792
struct callchain_cursor *cursor = NULL, cursor_callchain;
793793

794-
if (symbol_conf.use_callchain &&
794+
if (symbol_conf.use_callchain && sample->callchain &&
795795
thread__resolve_callchain(al->thread, &cursor_callchain, evsel,
796796
sample, NULL, NULL, scripting_max_stack) == 0)
797797
cursor = &cursor_callchain;

tools/perf/builtin-top.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,15 @@ static int perf_top__start_counters(struct perf_top *top)
917917
return -1;
918918
}
919919

920-
static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
920+
static int callchain_param__setup_sample_type(struct callchain_param *callchain)
921921
{
922922
if (!sort__has_sym) {
923-
if (symbol_conf.use_callchain) {
923+
if (callchain->enabled) {
924924
ui__error("Selected -g but \"sym\" not present in --sort/-s.");
925925
return -EINVAL;
926926
}
927-
} else if (callchain_param.mode != CHAIN_NONE) {
928-
if (callchain_register_param(&callchain_param) < 0) {
927+
} else if (callchain->mode != CHAIN_NONE) {
928+
if (callchain_register_param(callchain) < 0) {
929929
ui__error("Can't register callchain params.\n");
930930
return -EINVAL;
931931
}
@@ -952,7 +952,7 @@ static int __cmd_top(struct perf_top *top)
952952
goto out_delete;
953953
}
954954

955-
ret = perf_top__setup_sample_type(top);
955+
ret = callchain_param__setup_sample_type(&callchain_param);
956956
if (ret)
957957
goto out_delete;
958958

@@ -1045,18 +1045,17 @@ callchain_opt(const struct option *opt, const char *arg, int unset)
10451045
static int
10461046
parse_callchain_opt(const struct option *opt, const char *arg, int unset)
10471047
{
1048-
struct record_opts *record = (struct record_opts *)opt->value;
1048+
struct callchain_param *callchain = opt->value;
10491049

1050-
record->callgraph_set = true;
1051-
callchain_param.enabled = !unset;
1052-
callchain_param.record_mode = CALLCHAIN_FP;
1050+
callchain->enabled = !unset;
1051+
callchain->record_mode = CALLCHAIN_FP;
10531052

10541053
/*
10551054
* --no-call-graph
10561055
*/
10571056
if (unset) {
10581057
symbol_conf.use_callchain = false;
1059-
callchain_param.record_mode = CALLCHAIN_NONE;
1058+
callchain->record_mode = CALLCHAIN_NONE;
10601059
return 0;
10611060
}
10621061

@@ -1162,10 +1161,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
11621161
"output field(s): overhead, period, sample plus all of sort keys"),
11631162
OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
11641163
"Show a column with the number of samples"),
1165-
OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts,
1164+
OPT_CALLBACK_NOOPT('g', NULL, &callchain_param,
11661165
NULL, "enables call-graph recording and display",
11671166
&callchain_opt),
1168-
OPT_CALLBACK(0, "call-graph", &top.record_opts,
1167+
OPT_CALLBACK(0, "call-graph", &callchain_param,
11691168
"record_mode[,record_size],print_type,threshold[,print_limit],order,sort_key[,branch]",
11701169
top_callchain_help, &parse_callchain_opt),
11711170
OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
@@ -1312,7 +1311,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
13121311

13131312
top.sym_evsel = perf_evlist__first(top.evlist);
13141313

1315-
if (!symbol_conf.use_callchain) {
1314+
if (!callchain_param.enabled) {
13161315
symbol_conf.cumulate_callchain = false;
13171316
perf_hpp__cancel_cumulate();
13181317
}

tools/perf/builtin-trace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ static int trace__add_syscall_newtp(struct trace *trace)
24572457
perf_evlist__add(evlist, sys_enter);
24582458
perf_evlist__add(evlist, sys_exit);
24592459

2460-
if (trace->opts.callgraph_set && !trace->kernel_syscallchains) {
2460+
if (callchain_param.enabled && !trace->kernel_syscallchains) {
24612461
/*
24622462
* We're interested only in the user space callchain
24632463
* leading to the syscall, allow overriding that for
@@ -2546,7 +2546,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
25462546

25472547
perf_evlist__config(evlist, &trace->opts, NULL);
25482548

2549-
if (trace->opts.callgraph_set && trace->syscalls.events.sys_exit) {
2549+
if (callchain_param.enabled && trace->syscalls.events.sys_exit) {
25502550
perf_evsel__config_callchain(trace->syscalls.events.sys_exit,
25512551
&trace->opts, &callchain_param);
25522552
/*
@@ -3109,7 +3109,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
31093109
"per thread proc mmap processing timeout in ms"),
31103110
OPT_END()
31113111
};
3112-
bool max_stack_user_set = true;
3112+
bool __maybe_unused max_stack_user_set = true;
31133113
bool mmap_pages_user_set = true;
31143114
const char * const trace_subcommands[] = { "record", NULL };
31153115
int err;
@@ -3153,11 +3153,11 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
31533153
}
31543154

31553155
#ifdef HAVE_DWARF_UNWIND_SUPPORT
3156-
if ((trace.min_stack || max_stack_user_set) && !trace.opts.callgraph_set)
3156+
if ((trace.min_stack || max_stack_user_set) && !callchain_param.enabled)
31573157
record_opts__parse_callchain(&trace.opts, &callchain_param, "dwarf", false);
31583158
#endif
31593159

3160-
if (trace.opts.callgraph_set) {
3160+
if (callchain_param.enabled) {
31613161
if (!mmap_pages_user_set && geteuid() == 0)
31623162
trace.opts.mmap_pages = perf_event_mlock_kb_in_pages() * 4;
31633163

tools/perf/perf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ struct record_opts {
5252
bool sample_weight;
5353
bool sample_time;
5454
bool sample_time_set;
55-
bool callgraph_set;
5655
bool period;
5756
bool running_time;
5857
bool full_auxtrace;

tools/perf/scripts/python/export-to-postgresql.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@
3434
#
3535
# ubuntu:
3636
#
37-
# $ sudo apt-get install postgresql
37+
# $ sudo apt-get install postgresql python-pyside.qtsql libqt4-sql-psql
3838
# $ sudo su - postgres
39-
# $ createuser <your user id here>
40-
# Shall the new role be a superuser? (y/n) y
39+
# $ createuser -s <your user id here>
4140
#
4241
# An example of using this script with Intel PT:
4342
#

tools/perf/tests/vmlinux-kallsyms.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused)
5454
* Step 3:
5555
*
5656
* Load and split /proc/kallsyms into multiple maps, one per module.
57+
* Do not use kcore, as this test was designed before kcore support
58+
* and has parts that only make sense if using the non-kcore code.
59+
* XXX: extend it to stress the kcorre code as well, hint: the list
60+
* of modules extracted from /proc/kcore, in its current form, can't
61+
* be compacted against the list of modules found in the "vmlinux"
62+
* code and with the one got from /proc/modules from the "kallsyms" code.
5763
*/
58-
if (machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, NULL) <= 0) {
64+
if (__machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, true, NULL) <= 0) {
5965
pr_debug("dso__load_kallsyms ");
6066
goto out;
6167
}
@@ -157,6 +163,9 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused)
157163

158164
pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n",
159165
mem_start, sym->name, pair->name);
166+
} else {
167+
pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n",
168+
mem_start, sym->name, first_pair->name);
160169
}
161170
}
162171
} else

tools/perf/ui/browsers/hists.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,11 +1896,10 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
18961896
bool first = true;
18971897
int ret;
18981898

1899-
if (symbol_conf.use_callchain)
1899+
if (symbol_conf.use_callchain) {
19001900
folded_sign = hist_entry__folded(he);
1901-
1902-
if (symbol_conf.use_callchain)
19031901
printed += fprintf(fp, "%c ", folded_sign);
1902+
}
19041903

19051904
hists__for_each_format(browser->hists, fmt) {
19061905
if (perf_hpp__should_skip(fmt, he->hists))

tools/perf/util/Build

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
150150
CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
151151
CFLAGS_parse-events.o += -Wno-redundant-decls
152152

153-
$(OUTPUT)util/syscalltbl.o: util/syscalltbl.c arch/x86/entry/syscalls/syscall_64.tbl $(OUTPUT)arch/x86/include/generated/asm/syscalls_64.c FORCE
154-
$(call rule_mkdir)
155-
$(call if_changed_dep,cc_o_c)
156-
157153
$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
158154
$(call rule_mkdir)
159155
$(call if_changed_dep,cc_o_c)

0 commit comments

Comments
 (0)