diff options
author | David S. Miller <davem@davemloft.net> | 2014-07-16 17:09:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-16 17:09:34 -0400 |
commit | 1a98c69af1ecd97bfd1f4e4539924a9192434e36 (patch) | |
tree | a243defcf921ea174f8e43fce11d06830a6a9c36 /tools | |
parent | 7a575f6b907ea5d207d2b5010293c189616eae34 (diff) | |
parent | b6603fe574af289dbe9eb9fb4c540bca04f5a053 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 21 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 54 | ||||
-rw-r--r-- | tools/testing/selftests/cpu-hotplug/Makefile | 2 | ||||
-rw-r--r-- | tools/testing/selftests/ipc/msgque.c | 5 | ||||
-rw-r--r-- | tools/testing/selftests/memory-hotplug/Makefile | 2 | ||||
-rw-r--r-- | tools/thermal/tmon/Makefile | 2 | ||||
-rw-r--r-- | tools/thermal/tmon/tmon.c | 26 | ||||
-rw-r--r-- | tools/usb/ffs-test.c | 4 |
8 files changed, 73 insertions, 43 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 52c03fbbba17..04a229aa5c0f 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "../util.h" | 17 | #include "../util.h" |
18 | #include "../ui.h" | 18 | #include "../ui.h" |
19 | #include "map.h" | 19 | #include "map.h" |
20 | #include "annotate.h" | ||
20 | 21 | ||
21 | struct hist_browser { | 22 | struct hist_browser { |
22 | struct ui_browser b; | 23 | struct ui_browser b; |
@@ -1593,13 +1594,18 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1593 | bi->to.sym->name) > 0) | 1594 | bi->to.sym->name) > 0) |
1594 | annotate_t = nr_options++; | 1595 | annotate_t = nr_options++; |
1595 | } else { | 1596 | } else { |
1596 | |||
1597 | if (browser->selection != NULL && | 1597 | if (browser->selection != NULL && |
1598 | browser->selection->sym != NULL && | 1598 | browser->selection->sym != NULL && |
1599 | !browser->selection->map->dso->annotate_warned && | 1599 | !browser->selection->map->dso->annotate_warned) { |
1600 | asprintf(&options[nr_options], "Annotate %s", | 1600 | struct annotation *notes; |
1601 | browser->selection->sym->name) > 0) | 1601 | |
1602 | annotate = nr_options++; | 1602 | notes = symbol__annotation(browser->selection->sym); |
1603 | |||
1604 | if (notes->src && | ||
1605 | asprintf(&options[nr_options], "Annotate %s", | ||
1606 | browser->selection->sym->name) > 0) | ||
1607 | annotate = nr_options++; | ||
1608 | } | ||
1603 | } | 1609 | } |
1604 | 1610 | ||
1605 | if (thread != NULL && | 1611 | if (thread != NULL && |
@@ -1656,6 +1662,7 @@ retry_popup_menu: | |||
1656 | 1662 | ||
1657 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { | 1663 | if (choice == annotate || choice == annotate_t || choice == annotate_f) { |
1658 | struct hist_entry *he; | 1664 | struct hist_entry *he; |
1665 | struct annotation *notes; | ||
1659 | int err; | 1666 | int err; |
1660 | do_annotate: | 1667 | do_annotate: |
1661 | if (!objdump_path && perf_session_env__lookup_objdump(env)) | 1668 | if (!objdump_path && perf_session_env__lookup_objdump(env)) |
@@ -1679,6 +1686,10 @@ do_annotate: | |||
1679 | he->ms.map = he->branch_info->to.map; | 1686 | he->ms.map = he->branch_info->to.map; |
1680 | } | 1687 | } |
1681 | 1688 | ||
1689 | notes = symbol__annotation(he->ms.sym); | ||
1690 | if (!notes->src) | ||
1691 | continue; | ||
1692 | |||
1682 | /* | 1693 | /* |
1683 | * Don't let this be freed, say, by hists__decay_entry. | 1694 | * Don't let this be freed, say, by hists__decay_entry. |
1684 | */ | 1695 | */ |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 0e5fea95d596..c73e1fc12e53 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -496,18 +496,6 @@ struct process_args { | |||
496 | u64 start; | 496 | u64 start; |
497 | }; | 497 | }; |
498 | 498 | ||
499 | static int symbol__in_kernel(void *arg, const char *name, | ||
500 | char type __maybe_unused, u64 start) | ||
501 | { | ||
502 | struct process_args *args = arg; | ||
503 | |||
504 | if (strchr(name, '[')) | ||
505 | return 0; | ||
506 | |||
507 | args->start = start; | ||
508 | return 1; | ||
509 | } | ||
510 | |||
511 | static void machine__get_kallsyms_filename(struct machine *machine, char *buf, | 499 | static void machine__get_kallsyms_filename(struct machine *machine, char *buf, |
512 | size_t bufsz) | 500 | size_t bufsz) |
513 | { | 501 | { |
@@ -517,27 +505,41 @@ static void machine__get_kallsyms_filename(struct machine *machine, char *buf, | |||
517 | scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); | 505 | scnprintf(buf, bufsz, "%s/proc/kallsyms", machine->root_dir); |
518 | } | 506 | } |
519 | 507 | ||
520 | /* Figure out the start address of kernel map from /proc/kallsyms */ | 508 | const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL}; |
521 | static u64 machine__get_kernel_start_addr(struct machine *machine) | 509 | |
510 | /* Figure out the start address of kernel map from /proc/kallsyms. | ||
511 | * Returns the name of the start symbol in *symbol_name. Pass in NULL as | ||
512 | * symbol_name if it's not that important. | ||
513 | */ | ||
514 | static u64 machine__get_kernel_start_addr(struct machine *machine, | ||
515 | const char **symbol_name) | ||
522 | { | 516 | { |
523 | char filename[PATH_MAX]; | 517 | char filename[PATH_MAX]; |
524 | struct process_args args; | 518 | int i; |
519 | const char *name; | ||
520 | u64 addr = 0; | ||
525 | 521 | ||
526 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); | 522 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); |
527 | 523 | ||
528 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) | 524 | if (symbol__restricted_filename(filename, "/proc/kallsyms")) |
529 | return 0; | 525 | return 0; |
530 | 526 | ||
531 | if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0) | 527 | for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) { |
532 | return 0; | 528 | addr = kallsyms__get_function_start(filename, name); |
529 | if (addr) | ||
530 | break; | ||
531 | } | ||
532 | |||
533 | if (symbol_name) | ||
534 | *symbol_name = name; | ||
533 | 535 | ||
534 | return args.start; | 536 | return addr; |
535 | } | 537 | } |
536 | 538 | ||
537 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) | 539 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) |
538 | { | 540 | { |
539 | enum map_type type; | 541 | enum map_type type; |
540 | u64 start = machine__get_kernel_start_addr(machine); | 542 | u64 start = machine__get_kernel_start_addr(machine, NULL); |
541 | 543 | ||
542 | for (type = 0; type < MAP__NR_TYPES; ++type) { | 544 | for (type = 0; type < MAP__NR_TYPES; ++type) { |
543 | struct kmap *kmap; | 545 | struct kmap *kmap; |
@@ -852,23 +854,11 @@ static int machine__create_modules(struct machine *machine) | |||
852 | return 0; | 854 | return 0; |
853 | } | 855 | } |
854 | 856 | ||
855 | const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL}; | ||
856 | |||
857 | int machine__create_kernel_maps(struct machine *machine) | 857 | int machine__create_kernel_maps(struct machine *machine) |
858 | { | 858 | { |
859 | struct dso *kernel = machine__get_kernel(machine); | 859 | struct dso *kernel = machine__get_kernel(machine); |
860 | char filename[PATH_MAX]; | ||
861 | const char *name; | 860 | const char *name; |
862 | u64 addr = 0; | 861 | u64 addr = machine__get_kernel_start_addr(machine, &name); |
863 | int i; | ||
864 | |||
865 | machine__get_kallsyms_filename(machine, filename, PATH_MAX); | ||
866 | |||
867 | for (i = 0; (name = ref_reloc_sym_names[i]) != NULL; i++) { | ||
868 | addr = kallsyms__get_function_start(filename, name); | ||
869 | if (addr) | ||
870 | break; | ||
871 | } | ||
872 | if (!addr) | 862 | if (!addr) |
873 | return -1; | 863 | return -1; |
874 | 864 | ||
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | all: | 1 | all: |
2 | 2 | ||
3 | run_tests: | 3 | run_tests: |
4 | @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
5 | 5 | ||
6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index aa290c0de6f5..552f0810bffb 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
@@ -193,6 +193,11 @@ int main(int argc, char **argv) | |||
193 | int msg, pid, err; | 193 | int msg, pid, err; |
194 | struct msgque_data msgque; | 194 | struct msgque_data msgque; |
195 | 195 | ||
196 | if (getuid() != 0) { | ||
197 | printf("Please run the test as root - Exiting.\n"); | ||
198 | exit(1); | ||
199 | } | ||
200 | |||
196 | msgque.key = ftok(argv[0], 822155650); | 201 | msgque.key = ftok(argv[0], 822155650); |
197 | if (msgque.key == -1) { | 202 | if (msgque.key == -1) { |
198 | printf("Can't make key\n"); | 203 | printf("Can't make key\n"); |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | all: | 1 | all: |
2 | 2 | ||
3 | run_tests: | 3 | run_tests: |
4 | @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
5 | 5 | ||
6 | clean: | 6 | clean: |
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 447321104ec0..e775adcbd29f 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
@@ -21,7 +21,7 @@ OBJS = tmon.o tui.o sysfs.o pid.o | |||
21 | OBJS += | 21 | OBJS += |
22 | 22 | ||
23 | tmon: $(OBJS) Makefile tmon.h | 23 | tmon: $(OBJS) Makefile tmon.h |
24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -lpthread | 24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread |
25 | 25 | ||
26 | valgrind: tmon | 26 | valgrind: tmon |
27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null | 27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null |
diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index b30f531173e4..09b7c3218334 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c | |||
@@ -142,6 +142,7 @@ static void start_syslog(void) | |||
142 | static void prepare_logging(void) | 142 | static void prepare_logging(void) |
143 | { | 143 | { |
144 | int i; | 144 | int i; |
145 | struct stat logstat; | ||
145 | 146 | ||
146 | if (!logging) | 147 | if (!logging) |
147 | return; | 148 | return; |
@@ -152,6 +153,29 @@ static void prepare_logging(void) | |||
152 | return; | 153 | return; |
153 | } | 154 | } |
154 | 155 | ||
156 | if (lstat(TMON_LOG_FILE, &logstat) < 0) { | ||
157 | syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE); | ||
158 | fclose(tmon_log); | ||
159 | tmon_log = NULL; | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | /* The log file must be a regular file owned by us */ | ||
164 | if (S_ISLNK(logstat.st_mode)) { | ||
165 | syslog(LOG_ERR, "Log file is a symlink. Will not log\n"); | ||
166 | fclose(tmon_log); | ||
167 | tmon_log = NULL; | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | if (logstat.st_uid != getuid()) { | ||
172 | syslog(LOG_ERR, "We don't own the log file. Not logging\n"); | ||
173 | fclose(tmon_log); | ||
174 | tmon_log = NULL; | ||
175 | return; | ||
176 | } | ||
177 | |||
178 | |||
155 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); | 179 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); |
156 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { | 180 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { |
157 | char binding_str[33]; /* size of long + 1 */ | 181 | char binding_str[33]; /* size of long + 1 */ |
@@ -331,7 +355,7 @@ static void start_daemon_mode() | |||
331 | disable_tui(); | 355 | disable_tui(); |
332 | 356 | ||
333 | /* change the file mode mask */ | 357 | /* change the file mode mask */ |
334 | umask(0); | 358 | umask(S_IWGRP | S_IWOTH); |
335 | 359 | ||
336 | /* new SID for the daemon process */ | 360 | /* new SID for the daemon process */ |
337 | sid = setsid(); | 361 | sid = setsid(); |
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index fe1e66b6ef40..a87e99f37c52 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
@@ -116,8 +116,8 @@ static const struct { | |||
116 | .header = { | 116 | .header = { |
117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), | 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), |
118 | .length = cpu_to_le32(sizeof descriptors), | 118 | .length = cpu_to_le32(sizeof descriptors), |
119 | .fs_count = 3, | 119 | .fs_count = cpu_to_le32(3), |
120 | .hs_count = 3, | 120 | .hs_count = cpu_to_le32(3), |
121 | }, | 121 | }, |
122 | .fs_descs = { | 122 | .fs_descs = { |
123 | .intf = { | 123 | .intf = { |