aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile6
-rw-r--r--tools/hv/hv_fcopy_daemon.c4
-rw-r--r--tools/lib/api/fs/debugfs.c4
-rw-r--r--tools/lib/lockdep/Makefile18
-rw-r--r--tools/lib/lockdep/uinclude/linux/lockdep.h3
-rw-r--r--tools/lib/traceevent/event-parse.c110
-rw-r--r--tools/lib/traceevent/event-parse.h4
-rw-r--r--tools/net/bpf_dbg.c2
-rw-r--r--tools/perf/Documentation/perf-bench.txt22
-rw-r--r--tools/perf/Documentation/perf-top.txt1
-rw-r--r--tools/perf/Makefile.perf6
-rw-r--r--tools/perf/arch/x86/tests/dwarf-unwind.c3
-rw-r--r--tools/perf/arch/x86/tests/regs_load.S8
-rw-r--r--tools/perf/bench/numa.c4
-rw-r--r--tools/perf/builtin-kvm.c1
-rw-r--r--tools/perf/builtin-record.c2
-rw-r--r--tools/perf/builtin-stat.c11
-rw-r--r--tools/perf/config/Makefile53
-rw-r--r--tools/perf/tests/code-reading.c1
-rw-r--r--tools/perf/tests/make2
-rw-r--r--tools/perf/util/data.c9
-rw-r--r--tools/perf/util/machine.c16
-rw-r--r--tools/perf/util/probe-finder.c15
-rw-r--r--tools/perf/util/symbol-elf.c2
-rw-r--r--tools/power/acpi/Makefile11
25 files changed, 212 insertions, 106 deletions
diff --git a/tools/Makefile b/tools/Makefile
index bcae806b0c39..9a617adc6675 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -44,6 +44,9 @@ cpupower: FORCE
44cgroup firewire hv guest usb virtio vm net: FORCE 44cgroup firewire hv guest usb virtio vm net: FORCE
45 $(call descend,$@) 45 $(call descend,$@)
46 46
47liblockdep: FORCE
48 $(call descend,lib/lockdep)
49
47libapikfs: FORCE 50libapikfs: FORCE
48 $(call descend,lib/api) 51 $(call descend,lib/api)
49 52
@@ -91,6 +94,9 @@ cpupower_clean:
91cgroup_clean hv_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean: 94cgroup_clean hv_clean firewire_clean lguest_clean usb_clean virtio_clean vm_clean net_clean:
92 $(call descend,$(@:_clean=),clean) 95 $(call descend,$(@:_clean=),clean)
93 96
97liblockdep_clean:
98 $(call descend,lib/lockdep,clean)
99
94libapikfs_clean: 100libapikfs_clean:
95 $(call descend,lib/api,clean) 101 $(call descend,lib/api,clean)
96 102
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index 4ecc4fd0bc1b..fba1c75aa484 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -82,8 +82,10 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
82 82
83 if (!access(target_fname, F_OK)) { 83 if (!access(target_fname, F_OK)) {
84 syslog(LOG_INFO, "File: %s exists", target_fname); 84 syslog(LOG_INFO, "File: %s exists", target_fname);
85 if (!smsg->copy_flags & OVER_WRITE) 85 if (!(smsg->copy_flags & OVER_WRITE)) {
86 error = HV_ERROR_ALREADY_EXISTS;
86 goto done; 87 goto done;
88 }
87 } 89 }
88 90
89 target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744); 91 target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744);
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
index 7c4347962353..a74fba6d7743 100644
--- a/tools/lib/api/fs/debugfs.c
+++ b/tools/lib/api/fs/debugfs.c
@@ -12,8 +12,8 @@
12char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; 12char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
13 13
14static const char * const debugfs_known_mountpoints[] = { 14static const char * const debugfs_known_mountpoints[] = {
15 "/sys/kernel/debug/", 15 "/sys/kernel/debug",
16 "/debug/", 16 "/debug",
17 0, 17 0,
18}; 18};
19 19
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile
index 07b0b7542511..bba2f5253b6e 100644
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -1,13 +1,7 @@
1# liblockdep version
2LL_VERSION = 0
3LL_PATCHLEVEL = 0
4LL_EXTRAVERSION = 1
5
6# file format version 1# file format version
7FILE_VERSION = 1 2FILE_VERSION = 1
8 3
9MAKEFLAGS += --no-print-directory 4LIBLOCKDEP_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion)
10
11 5
12# Makefiles suck: This macro sets a default value of $(2) for the 6# Makefiles suck: This macro sets a default value of $(2) for the
13# variable named by $(1), unless the variable has been set by 7# variable named by $(1), unless the variable has been set by
@@ -98,7 +92,7 @@ export prefix libdir bindir src obj
98libdir_SQ = $(subst ','\'',$(libdir)) 92libdir_SQ = $(subst ','\'',$(libdir))
99bindir_SQ = $(subst ','\'',$(bindir)) 93bindir_SQ = $(subst ','\'',$(bindir))
100 94
101LIB_FILE = liblockdep.a liblockdep.so 95LIB_FILE = liblockdep.a liblockdep.so.$(LIBLOCKDEP_VERSION)
102BIN_FILE = lockdep 96BIN_FILE = lockdep
103 97
104CONFIG_INCLUDES = 98CONFIG_INCLUDES =
@@ -110,8 +104,6 @@ N =
110 104
111export Q VERBOSE 105export Q VERBOSE
112 106
113LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION)
114
115INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) 107INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES)
116 108
117# Set compile option CFLAGS if not set elsewhere 109# Set compile option CFLAGS if not set elsewhere
@@ -146,7 +138,7 @@ do_app_build = \
146 138
147do_compile_shared_library = \ 139do_compile_shared_library = \
148 ($(print_shared_lib_compile) \ 140 ($(print_shared_lib_compile) \
149 $(CC) --shared $^ -o $@ -lpthread -ldl) 141 $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so))
150 142
151do_build_static_lib = \ 143do_build_static_lib = \
152 ($(print_static_lib_build) \ 144 ($(print_static_lib_build) \
@@ -177,7 +169,7 @@ all: all_cmd
177 169
178all_cmd: $(CMD_TARGETS) 170all_cmd: $(CMD_TARGETS)
179 171
180liblockdep.so: $(PEVENT_LIB_OBJS) 172liblockdep.so.$(LIBLOCKDEP_VERSION): $(PEVENT_LIB_OBJS)
181 $(Q)$(do_compile_shared_library) 173 $(Q)$(do_compile_shared_library)
182 174
183liblockdep.a: $(PEVENT_LIB_OBJS) 175liblockdep.a: $(PEVENT_LIB_OBJS)
@@ -238,7 +230,7 @@ install_lib: all_cmd
238install: install_lib 230install: install_lib
239 231
240clean: 232clean:
241 $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d 233 $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
242 $(RM) tags TAGS 234 $(RM) tags TAGS
243 235
244endif # skip-makefile 236endif # skip-makefile
diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h
index d0f5d6e50214..c1552c28507e 100644
--- a/tools/lib/lockdep/uinclude/linux/lockdep.h
+++ b/tools/lib/lockdep/uinclude/linux/lockdep.h
@@ -10,6 +10,9 @@
10 10
11#define MAX_LOCK_DEPTH 2000UL 11#define MAX_LOCK_DEPTH 2000UL
12 12
13#define asmlinkage
14#define __visible
15
13#include "../../../include/linux/lockdep.h" 16#include "../../../include/linux/lockdep.h"
14 17
15struct task_struct { 18struct task_struct {
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 1587ea392ad6..b83184f2d484 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -50,6 +50,18 @@ static int show_warning = 1;
50 warning(fmt, ##__VA_ARGS__); \ 50 warning(fmt, ##__VA_ARGS__); \
51 } while (0) 51 } while (0)
52 52
53#define do_warning_event(event, fmt, ...) \
54 do { \
55 if (!show_warning) \
56 continue; \
57 \
58 if (event) \
59 warning("[%s:%s] " fmt, event->system, \
60 event->name, ##__VA_ARGS__); \
61 else \
62 warning(fmt, ##__VA_ARGS__); \
63 } while (0)
64
53static void init_input_buf(const char *buf, unsigned long long size) 65static void init_input_buf(const char *buf, unsigned long long size)
54{ 66{
55 input_buf = buf; 67 input_buf = buf;
@@ -1355,7 +1367,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
1355 } 1367 }
1356 1368
1357 if (!field->type) { 1369 if (!field->type) {
1358 do_warning("%s: no type found", __func__); 1370 do_warning_event(event, "%s: no type found", __func__);
1359 goto fail; 1371 goto fail;
1360 } 1372 }
1361 field->name = last_token; 1373 field->name = last_token;
@@ -1402,7 +1414,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
1402 free_token(token); 1414 free_token(token);
1403 type = read_token(&token); 1415 type = read_token(&token);
1404 if (type == EVENT_NONE) { 1416 if (type == EVENT_NONE) {
1405 do_warning("failed to find token"); 1417 do_warning_event(event, "failed to find token");
1406 goto fail; 1418 goto fail;
1407 } 1419 }
1408 } 1420 }
@@ -1636,7 +1648,7 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok)
1636 right = alloc_arg(); 1648 right = alloc_arg();
1637 1649
1638 if (!arg || !left || !right) { 1650 if (!arg || !left || !right) {
1639 do_warning("%s: not enough memory!", __func__); 1651 do_warning_event(event, "%s: not enough memory!", __func__);
1640 /* arg will be freed at out_free */ 1652 /* arg will be freed at out_free */
1641 free_arg(left); 1653 free_arg(left);
1642 free_arg(right); 1654 free_arg(right);
@@ -1686,7 +1698,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok)
1686 1698
1687 arg = alloc_arg(); 1699 arg = alloc_arg();
1688 if (!arg) { 1700 if (!arg) {
1689 do_warning("%s: not enough memory!", __func__); 1701 do_warning_event(event, "%s: not enough memory!", __func__);
1690 /* '*tok' is set to top->op.op. No need to free. */ 1702 /* '*tok' is set to top->op.op. No need to free. */
1691 *tok = NULL; 1703 *tok = NULL;
1692 return EVENT_ERROR; 1704 return EVENT_ERROR;
@@ -1792,7 +1804,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1792 if (arg->type == PRINT_OP && !arg->op.left) { 1804 if (arg->type == PRINT_OP && !arg->op.left) {
1793 /* handle single op */ 1805 /* handle single op */
1794 if (token[1]) { 1806 if (token[1]) {
1795 do_warning("bad op token %s", token); 1807 do_warning_event(event, "bad op token %s", token);
1796 goto out_free; 1808 goto out_free;
1797 } 1809 }
1798 switch (token[0]) { 1810 switch (token[0]) {
@@ -1802,7 +1814,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1802 case '-': 1814 case '-':
1803 break; 1815 break;
1804 default: 1816 default:
1805 do_warning("bad op token %s", token); 1817 do_warning_event(event, "bad op token %s", token);
1806 goto out_free; 1818 goto out_free;
1807 1819
1808 } 1820 }
@@ -1888,7 +1900,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1888 char *new_atom; 1900 char *new_atom;
1889 1901
1890 if (left->type != PRINT_ATOM) { 1902 if (left->type != PRINT_ATOM) {
1891 do_warning("bad pointer type"); 1903 do_warning_event(event, "bad pointer type");
1892 goto out_free; 1904 goto out_free;
1893 } 1905 }
1894 new_atom = realloc(left->atom.atom, 1906 new_atom = realloc(left->atom.atom,
@@ -1930,7 +1942,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1930 type = process_array(event, arg, tok); 1942 type = process_array(event, arg, tok);
1931 1943
1932 } else { 1944 } else {
1933 do_warning("unknown op '%s'", token); 1945 do_warning_event(event, "unknown op '%s'", token);
1934 event->flags |= EVENT_FL_FAILED; 1946 event->flags |= EVENT_FL_FAILED;
1935 /* the arg is now the left side */ 1947 /* the arg is now the left side */
1936 goto out_free; 1948 goto out_free;
@@ -1951,7 +1963,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1951 return type; 1963 return type;
1952 1964
1953out_warn_free: 1965out_warn_free:
1954 do_warning("%s: not enough memory!", __func__); 1966 do_warning_event(event, "%s: not enough memory!", __func__);
1955out_free: 1967out_free:
1956 free_token(token); 1968 free_token(token);
1957 *tok = NULL; 1969 *tok = NULL;
@@ -2385,7 +2397,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
2385 2397
2386 field = alloc_arg(); 2398 field = alloc_arg();
2387 if (!field) { 2399 if (!field) {
2388 do_warning("%s: not enough memory!", __func__); 2400 do_warning_event(event, "%s: not enough memory!", __func__);
2389 goto out_free; 2401 goto out_free;
2390 } 2402 }
2391 2403
@@ -2438,7 +2450,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
2438 2450
2439 field = alloc_arg(); 2451 field = alloc_arg();
2440 if (!field) { 2452 if (!field) {
2441 do_warning("%s: not enough memory!", __func__); 2453 do_warning_event(event, "%s: not enough memory!", __func__);
2442 goto out_free; 2454 goto out_free;
2443 } 2455 }
2444 2456
@@ -2477,7 +2489,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
2477 2489
2478 field = alloc_arg(); 2490 field = alloc_arg();
2479 if (!field) { 2491 if (!field) {
2480 do_warning("%s: not enough memory!", __func__); 2492 do_warning_event(event, "%s: not enough memory!", __func__);
2481 goto out_free; 2493 goto out_free;
2482 } 2494 }
2483 2495
@@ -2492,7 +2504,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
2492 2504
2493 field = alloc_arg(); 2505 field = alloc_arg();
2494 if (!field) { 2506 if (!field) {
2495 do_warning("%s: not enough memory!", __func__); 2507 do_warning_event(event, "%s: not enough memory!", __func__);
2496 *tok = NULL; 2508 *tok = NULL;
2497 return EVENT_ERROR; 2509 return EVENT_ERROR;
2498 } 2510 }
@@ -2555,7 +2567,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
2555 free_token(token); 2567 free_token(token);
2556 arg = alloc_arg(); 2568 arg = alloc_arg();
2557 if (!arg) { 2569 if (!arg) {
2558 do_warning("%s: not enough memory!", __func__); 2570 do_warning_event(event, "%s: not enough memory!", __func__);
2559 *tok = NULL; 2571 *tok = NULL;
2560 return EVENT_ERROR; 2572 return EVENT_ERROR;
2561 } 2573 }
@@ -2614,13 +2626,14 @@ process_paren(struct event_format *event, struct print_arg *arg, char **tok)
2614 2626
2615 /* prevous must be an atom */ 2627 /* prevous must be an atom */
2616 if (arg->type != PRINT_ATOM) { 2628 if (arg->type != PRINT_ATOM) {
2617 do_warning("previous needed to be PRINT_ATOM"); 2629 do_warning_event(event, "previous needed to be PRINT_ATOM");
2618 goto out_free; 2630 goto out_free;
2619 } 2631 }
2620 2632
2621 item_arg = alloc_arg(); 2633 item_arg = alloc_arg();
2622 if (!item_arg) { 2634 if (!item_arg) {
2623 do_warning("%s: not enough memory!", __func__); 2635 do_warning_event(event, "%s: not enough memory!",
2636 __func__);
2624 goto out_free; 2637 goto out_free;
2625 } 2638 }
2626 2639
@@ -2721,21 +2734,24 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
2721 for (i = 0; i < func->nr_args; i++) { 2734 for (i = 0; i < func->nr_args; i++) {
2722 farg = alloc_arg(); 2735 farg = alloc_arg();
2723 if (!farg) { 2736 if (!farg) {
2724 do_warning("%s: not enough memory!", __func__); 2737 do_warning_event(event, "%s: not enough memory!",
2738 __func__);
2725 return EVENT_ERROR; 2739 return EVENT_ERROR;
2726 } 2740 }
2727 2741
2728 type = process_arg(event, farg, &token); 2742 type = process_arg(event, farg, &token);
2729 if (i < (func->nr_args - 1)) { 2743 if (i < (func->nr_args - 1)) {
2730 if (type != EVENT_DELIM || strcmp(token, ",") != 0) { 2744 if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
2731 warning("Error: function '%s()' expects %d arguments but event %s only uses %d", 2745 do_warning_event(event,
2746 "Error: function '%s()' expects %d arguments but event %s only uses %d",
2732 func->name, func->nr_args, 2747 func->name, func->nr_args,
2733 event->name, i + 1); 2748 event->name, i + 1);
2734 goto err; 2749 goto err;
2735 } 2750 }
2736 } else { 2751 } else {
2737 if (type != EVENT_DELIM || strcmp(token, ")") != 0) { 2752 if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
2738 warning("Error: function '%s()' only expects %d arguments but event %s has more", 2753 do_warning_event(event,
2754 "Error: function '%s()' only expects %d arguments but event %s has more",
2739 func->name, func->nr_args, event->name); 2755 func->name, func->nr_args, event->name);
2740 goto err; 2756 goto err;
2741 } 2757 }
@@ -2792,7 +2808,7 @@ process_function(struct event_format *event, struct print_arg *arg,
2792 return process_func_handler(event, func, arg, tok); 2808 return process_func_handler(event, func, arg, tok);
2793 } 2809 }
2794 2810
2795 do_warning("function %s not defined", token); 2811 do_warning_event(event, "function %s not defined", token);
2796 free_token(token); 2812 free_token(token);
2797 return EVENT_ERROR; 2813 return EVENT_ERROR;
2798} 2814}
@@ -2878,7 +2894,7 @@ process_arg_token(struct event_format *event, struct print_arg *arg,
2878 2894
2879 case EVENT_ERROR ... EVENT_NEWLINE: 2895 case EVENT_ERROR ... EVENT_NEWLINE:
2880 default: 2896 default:
2881 do_warning("unexpected type %d", type); 2897 do_warning_event(event, "unexpected type %d", type);
2882 return EVENT_ERROR; 2898 return EVENT_ERROR;
2883 } 2899 }
2884 *tok = token; 2900 *tok = token;
@@ -2901,7 +2917,8 @@ static int event_read_print_args(struct event_format *event, struct print_arg **
2901 2917
2902 arg = alloc_arg(); 2918 arg = alloc_arg();
2903 if (!arg) { 2919 if (!arg) {
2904 do_warning("%s: not enough memory!", __func__); 2920 do_warning_event(event, "%s: not enough memory!",
2921 __func__);
2905 return -1; 2922 return -1;
2906 } 2923 }
2907 2924
@@ -3481,11 +3498,12 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
3481 return val; 3498 return val;
3482 3499
3483out_warning_op: 3500out_warning_op:
3484 do_warning("%s: unknown op '%s'", __func__, arg->op.op); 3501 do_warning_event(event, "%s: unknown op '%s'", __func__, arg->op.op);
3485 return 0; 3502 return 0;
3486 3503
3487out_warning_field: 3504out_warning_field:
3488 do_warning("%s: field %s not found", __func__, arg->field.name); 3505 do_warning_event(event, "%s: field %s not found",
3506 __func__, arg->field.name);
3489 return 0; 3507 return 0;
3490} 3508}
3491 3509
@@ -3591,7 +3609,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3591 } 3609 }
3592 str = malloc(len + 1); 3610 str = malloc(len + 1);
3593 if (!str) { 3611 if (!str) {
3594 do_warning("%s: not enough memory!", __func__); 3612 do_warning_event(event, "%s: not enough memory!",
3613 __func__);
3595 return; 3614 return;
3596 } 3615 }
3597 memcpy(str, data + field->offset, len); 3616 memcpy(str, data + field->offset, len);
@@ -3697,7 +3716,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3697 return; 3716 return;
3698 3717
3699out_warning_field: 3718out_warning_field:
3700 do_warning("%s: field %s not found", __func__, arg->field.name); 3719 do_warning_event(event, "%s: field %s not found",
3720 __func__, arg->field.name);
3701} 3721}
3702 3722
3703static unsigned long long 3723static unsigned long long
@@ -3742,14 +3762,16 @@ process_defined_func(struct trace_seq *s, void *data, int size,
3742 trace_seq_terminate(&str); 3762 trace_seq_terminate(&str);
3743 string = malloc(sizeof(*string)); 3763 string = malloc(sizeof(*string));
3744 if (!string) { 3764 if (!string) {
3745 do_warning("%s(%d): malloc str", __func__, __LINE__); 3765 do_warning_event(event, "%s(%d): malloc str",
3766 __func__, __LINE__);
3746 goto out_free; 3767 goto out_free;
3747 } 3768 }
3748 string->next = strings; 3769 string->next = strings;
3749 string->str = strdup(str.buffer); 3770 string->str = strdup(str.buffer);
3750 if (!string->str) { 3771 if (!string->str) {
3751 free(string); 3772 free(string);
3752 do_warning("%s(%d): malloc str", __func__, __LINE__); 3773 do_warning_event(event, "%s(%d): malloc str",
3774 __func__, __LINE__);
3753 goto out_free; 3775 goto out_free;
3754 } 3776 }
3755 args[i] = (uintptr_t)string->str; 3777 args[i] = (uintptr_t)string->str;
@@ -3761,7 +3783,7 @@ process_defined_func(struct trace_seq *s, void *data, int size,
3761 * Something went totally wrong, this is not 3783 * Something went totally wrong, this is not
3762 * an input error, something in this code broke. 3784 * an input error, something in this code broke.
3763 */ 3785 */
3764 do_warning("Unexpected end of arguments\n"); 3786 do_warning_event(event, "Unexpected end of arguments\n");
3765 goto out_free; 3787 goto out_free;
3766 } 3788 }
3767 farg = farg->next; 3789 farg = farg->next;
@@ -3811,12 +3833,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
3811 if (!field) { 3833 if (!field) {
3812 field = pevent_find_field(event, "buf"); 3834 field = pevent_find_field(event, "buf");
3813 if (!field) { 3835 if (!field) {
3814 do_warning("can't find buffer field for binary printk"); 3836 do_warning_event(event, "can't find buffer field for binary printk");
3815 return NULL; 3837 return NULL;
3816 } 3838 }
3817 ip_field = pevent_find_field(event, "ip"); 3839 ip_field = pevent_find_field(event, "ip");
3818 if (!ip_field) { 3840 if (!ip_field) {
3819 do_warning("can't find ip field for binary printk"); 3841 do_warning_event(event, "can't find ip field for binary printk");
3820 return NULL; 3842 return NULL;
3821 } 3843 }
3822 pevent->bprint_buf_field = field; 3844 pevent->bprint_buf_field = field;
@@ -3830,7 +3852,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
3830 */ 3852 */
3831 args = alloc_arg(); 3853 args = alloc_arg();
3832 if (!args) { 3854 if (!args) {
3833 do_warning("%s(%d): not enough memory!", __func__, __LINE__); 3855 do_warning_event(event, "%s(%d): not enough memory!",
3856 __func__, __LINE__);
3834 return NULL; 3857 return NULL;
3835 } 3858 }
3836 arg = args; 3859 arg = args;
@@ -3896,7 +3919,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
3896 bptr += vsize; 3919 bptr += vsize;
3897 arg = alloc_arg(); 3920 arg = alloc_arg();
3898 if (!arg) { 3921 if (!arg) {
3899 do_warning("%s(%d): not enough memory!", 3922 do_warning_event(event, "%s(%d): not enough memory!",
3900 __func__, __LINE__); 3923 __func__, __LINE__);
3901 goto out_free; 3924 goto out_free;
3902 } 3925 }
@@ -3919,7 +3942,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
3919 case 's': 3942 case 's':
3920 arg = alloc_arg(); 3943 arg = alloc_arg();
3921 if (!arg) { 3944 if (!arg) {
3922 do_warning("%s(%d): not enough memory!", 3945 do_warning_event(event, "%s(%d): not enough memory!",
3923 __func__, __LINE__); 3946 __func__, __LINE__);
3924 goto out_free; 3947 goto out_free;
3925 } 3948 }
@@ -3959,7 +3982,7 @@ get_bprint_format(void *data, int size __maybe_unused,
3959 if (!field) { 3982 if (!field) {
3960 field = pevent_find_field(event, "fmt"); 3983 field = pevent_find_field(event, "fmt");
3961 if (!field) { 3984 if (!field) {
3962 do_warning("can't find format field for binary printk"); 3985 do_warning_event(event, "can't find format field for binary printk");
3963 return NULL; 3986 return NULL;
3964 } 3987 }
3965 pevent->bprint_fmt_field = field; 3988 pevent->bprint_fmt_field = field;
@@ -4003,8 +4026,8 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size,
4003 arg->field.field = 4026 arg->field.field =
4004 pevent_find_any_field(event, arg->field.name); 4027 pevent_find_any_field(event, arg->field.name);
4005 if (!arg->field.field) { 4028 if (!arg->field.field) {
4006 do_warning("%s: field %s not found", 4029 do_warning_event(event, "%s: field %s not found",
4007 __func__, arg->field.name); 4030 __func__, arg->field.name);
4008 return; 4031 return;
4009 } 4032 }
4010 } 4033 }
@@ -4176,7 +4199,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4176 case '*': 4199 case '*':
4177 /* The argument is the length. */ 4200 /* The argument is the length. */
4178 if (!arg) { 4201 if (!arg) {
4179 do_warning("no argument match"); 4202 do_warning_event(event, "no argument match");
4180 event->flags |= EVENT_FL_FAILED; 4203 event->flags |= EVENT_FL_FAILED;
4181 goto out_failed; 4204 goto out_failed;
4182 } 4205 }
@@ -4213,7 +4236,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4213 case 'X': 4236 case 'X':
4214 case 'u': 4237 case 'u':
4215 if (!arg) { 4238 if (!arg) {
4216 do_warning("no argument match"); 4239 do_warning_event(event, "no argument match");
4217 event->flags |= EVENT_FL_FAILED; 4240 event->flags |= EVENT_FL_FAILED;
4218 goto out_failed; 4241 goto out_failed;
4219 } 4242 }
@@ -4223,7 +4246,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4223 4246
4224 /* should never happen */ 4247 /* should never happen */
4225 if (len > 31) { 4248 if (len > 31) {
4226 do_warning("bad format!"); 4249 do_warning_event(event, "bad format!");
4227 event->flags |= EVENT_FL_FAILED; 4250 event->flags |= EVENT_FL_FAILED;
4228 len = 31; 4251 len = 31;
4229 } 4252 }
@@ -4290,13 +4313,13 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4290 trace_seq_printf(s, format, (long long)val); 4313 trace_seq_printf(s, format, (long long)val);
4291 break; 4314 break;
4292 default: 4315 default:
4293 do_warning("bad count (%d)", ls); 4316 do_warning_event(event, "bad count (%d)", ls);
4294 event->flags |= EVENT_FL_FAILED; 4317 event->flags |= EVENT_FL_FAILED;
4295 } 4318 }
4296 break; 4319 break;
4297 case 's': 4320 case 's':
4298 if (!arg) { 4321 if (!arg) {
4299 do_warning("no matching argument"); 4322 do_warning_event(event, "no matching argument");
4300 event->flags |= EVENT_FL_FAILED; 4323 event->flags |= EVENT_FL_FAILED;
4301 goto out_failed; 4324 goto out_failed;
4302 } 4325 }
@@ -4306,7 +4329,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4306 4329
4307 /* should never happen */ 4330 /* should never happen */
4308 if (len > 31) { 4331 if (len > 31) {
4309 do_warning("bad format!"); 4332 do_warning_event(event, "bad format!");
4310 event->flags |= EVENT_FL_FAILED; 4333 event->flags |= EVENT_FL_FAILED;
4311 len = 31; 4334 len = 31;
4312 } 4335 }
@@ -4321,6 +4344,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4321 format, len_arg, arg); 4344 format, len_arg, arg);
4322 trace_seq_terminate(&p); 4345 trace_seq_terminate(&p);
4323 trace_seq_puts(s, p.buffer); 4346 trace_seq_puts(s, p.buffer);
4347 trace_seq_destroy(&p);
4324 arg = arg->next; 4348 arg = arg->next;
4325 break; 4349 break;
4326 default: 4350 default:
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 791c539374c7..feab94281634 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -876,8 +876,8 @@ struct event_filter {
876struct event_filter *pevent_filter_alloc(struct pevent *pevent); 876struct event_filter *pevent_filter_alloc(struct pevent *pevent);
877 877
878/* for backward compatibility */ 878/* for backward compatibility */
879#define FILTER_NONE PEVENT_ERRNO__FILTER_NOT_FOUND 879#define FILTER_NONE PEVENT_ERRNO__NO_FILTER
880#define FILTER_NOEXIST PEVENT_ERRNO__NO_FILTER 880#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND
881#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS 881#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS
882#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH 882#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH
883 883
diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
index bb31813e43dd..9a287bec695a 100644
--- a/tools/net/bpf_dbg.c
+++ b/tools/net/bpf_dbg.c
@@ -820,7 +820,7 @@ do_div:
820 r->A &= r->X; 820 r->A &= r->X;
821 break; 821 break;
822 case BPF_ALU_AND | BPF_K: 822 case BPF_ALU_AND | BPF_K:
823 r->A &= r->X; 823 r->A &= K;
824 break; 824 break;
825 case BPF_ALU_OR | BPF_X: 825 case BPF_ALU_OR | BPF_X:
826 r->A |= r->X; 826 r->A |= r->X;
diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index 7065cd6fbdfc..4464ad770d51 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -48,6 +48,12 @@ SUBSYSTEM
48'mem':: 48'mem'::
49 Memory access performance. 49 Memory access performance.
50 50
51'numa'::
52 NUMA scheduling and MM benchmarks.
53
54'futex'::
55 Futex stressing benchmarks.
56
51'all':: 57'all'::
52 All benchmark subsystems. 58 All benchmark subsystems.
53 59
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
187--no-prefault:: 193--no-prefault::
188Show only the result without page faults before memset. 194Show only the result without page faults before memset.
189 195
196SUITES FOR 'numa'
197~~~~~~~~~~~~~~~~~
198*mem*::
199Suite for evaluating NUMA workloads.
200
201SUITES FOR 'futex'
202~~~~~~~~~~~~~~~~~~
203*hash*::
204Suite for evaluating hash tables.
205
206*wake*::
207Suite for evaluating wake calls.
208
209*requeue*::
210Suite for evaluating requeue calls.
211
190SEE ALSO 212SEE ALSO
191-------- 213--------
192linkperf:perf[1] 214linkperf:perf[1]
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index cdd8d4946dba..976b00c6cdb1 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -87,7 +87,6 @@ Default is to monitor all CPUS.
87--realtime=<priority>:: 87--realtime=<priority>::
88 Collect data with this RT SCHED_FIFO priority. 88 Collect data with this RT SCHED_FIFO priority.
89 89
90-s <symbol>::
91--sym-annotate=<symbol>:: 90--sym-annotate=<symbol>::
92 Annotate this symbol. 91 Annotate this symbol.
93 92
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 50d875d970c4..895edd32930c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -192,13 +192,13 @@ endif
192export PERL_PATH 192export PERL_PATH
193 193
194$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c 194$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
195 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c 195 $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
196 196
197$(OUTPUT)util/parse-events-bison.c: util/parse-events.y 197$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
198 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ 198 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
199 199
200$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c 200$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
201 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c 201 $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
202 202
203$(OUTPUT)util/pmu-bison.c: util/pmu.y 203$(OUTPUT)util/pmu-bison.c: util/pmu.y
204 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ 204 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
@@ -589,7 +589,7 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
589 $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< 589 $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
590 590
591$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) 591$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
592 $(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) 592 $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
593 593
594$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS 594$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
595 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ 595 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c
index b602ad93ce63..83bc2385e6d3 100644
--- a/tools/perf/arch/x86/tests/dwarf-unwind.c
+++ b/tools/perf/arch/x86/tests/dwarf-unwind.c
@@ -23,9 +23,10 @@ static int sample_ustack(struct perf_sample *sample,
23 23
24 sp = (unsigned long) regs[PERF_REG_X86_SP]; 24 sp = (unsigned long) regs[PERF_REG_X86_SP];
25 25
26 map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); 26 map = map_groups__find(&thread->mg, MAP__VARIABLE, (u64) sp);
27 if (!map) { 27 if (!map) {
28 pr_debug("failed to get stack map\n"); 28 pr_debug("failed to get stack map\n");
29 free(buf);
29 return -1; 30 return -1;
30 } 31 }
31 32
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 99167bf644ea..60875d5c556c 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -1,4 +1,3 @@
1
2#include <linux/linkage.h> 1#include <linux/linkage.h>
3 2
4#define AX 0 3#define AX 0
@@ -90,3 +89,10 @@ ENTRY(perf_regs_load)
90 ret 89 ret
91ENDPROC(perf_regs_load) 90ENDPROC(perf_regs_load)
92#endif 91#endif
92
93/*
94 * We need to provide note.GNU-stack section, saying that we want
95 * NOT executable stack. Otherwise the final linking will assume that
96 * the ELF stack should not be restricted at all and set it RWX.
97 */
98.section .note.GNU-stack,"",@progbits
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 97d86d828190..ebfa163b80b5 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
1593 p->data_rand_walk = true; 1593 p->data_rand_walk = true;
1594 p->nr_loops = -1; 1594 p->nr_loops = -1;
1595 p->init_random = true; 1595 p->init_random = true;
1596 p->mb_global_str = "1";
1597 p->nr_proc = 1;
1598 p->nr_threads = 1;
1599 p->nr_secs = 5;
1596 p->run_all = argc == 1; 1600 p->run_all = argc == 1;
1597} 1601}
1598 1602
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 21c164b8f9db..0f1e5a2f6ad7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -404,6 +404,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key)
404 } 404 }
405 405
406 event->key = *key; 406 event->key = *key;
407 init_stats(&event->total.stats);
407 return event; 408 return event;
408} 409}
409 410
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index eb524f91bffe..8ce62ef7f6c3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
374 374
375 session = perf_session__new(file, false, NULL); 375 session = perf_session__new(file, false, NULL);
376 if (session == NULL) { 376 if (session == NULL) {
377 pr_err("Not enough memory for reading perf file header\n"); 377 pr_err("Perf session creation failed.\n");
378 return -1; 378 return -1;
379 } 379 }
380 380
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8b0e1c9234d9..65a151e36067 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
174 174
175static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) 175static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
176{ 176{
177 memset(evsel->priv, 0, sizeof(struct perf_stat)); 177 int i;
178 struct perf_stat *ps = evsel->priv;
179
180 for (i = 0; i < 3; i++)
181 init_stats(&ps->res_stats[i]);
178} 182}
179 183
180static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) 184static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
181{ 185{
182 evsel->priv = zalloc(sizeof(struct perf_stat)); 186 evsel->priv = zalloc(sizeof(struct perf_stat));
183 return evsel->priv == NULL ? -ENOMEM : 0; 187 if (evsel == NULL)
188 return -ENOMEM;
189 perf_evsel__reset_stat_priv(evsel);
190 return 0;
184} 191}
185 192
186static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) 193static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c23418225c2c..802cf544202b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,6 +34,14 @@ ifeq ($(ARCH),arm)
34 LIBUNWIND_LIBS = -lunwind -lunwind-arm 34 LIBUNWIND_LIBS = -lunwind -lunwind-arm
35endif 35endif
36 36
37# So far there's only x86 libdw unwind support merged in perf.
38# Disable it on all other architectures in case libdw unwind
39# support is detected in system. Add supported architectures
40# to the check.
41ifneq ($(ARCH),x86)
42 NO_LIBDW_DWARF_UNWIND := 1
43endif
44
37ifeq ($(LIBUNWIND_LIBS),) 45ifeq ($(LIBUNWIND_LIBS),)
38 NO_LIBUNWIND := 1 46 NO_LIBUNWIND := 1
39else 47else
@@ -65,10 +73,9 @@ ifndef NO_LIBELF
65 ifdef LIBDW_DIR 73 ifdef LIBDW_DIR
66 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include 74 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
67 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib 75 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
68
69 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
70 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
71 endif 76 endif
77 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
78 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
72endif 79endif
73 80
74# include ARCH specific config 81# include ARCH specific config
@@ -110,6 +117,10 @@ CFLAGS += -Wall
110CFLAGS += -Wextra 117CFLAGS += -Wextra
111CFLAGS += -std=gnu99 118CFLAGS += -std=gnu99
112 119
120# Enforce a non-executable stack, as we may regress (again) in the future by
121# adding assembler files missing the .GNU-stack linker note.
122LDFLAGS += -Wl,-z,noexecstack
123
113EXTLIBS = -lelf -lpthread -lrt -lm -ldl 124EXTLIBS = -lelf -lpthread -lrt -lm -ldl
114 125
115ifneq ($(OUTPUT),) 126ifneq ($(OUTPUT),)
@@ -187,7 +198,10 @@ VF_FEATURE_TESTS = \
187 stackprotector-all \ 198 stackprotector-all \
188 timerfd \ 199 timerfd \
189 libunwind-debug-frame \ 200 libunwind-debug-frame \
190 bionic 201 bionic \
202 liberty \
203 liberty-z \
204 cplus-demangle
191 205
192# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. 206# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
193# If in the future we need per-feature checks/flags for features not 207# If in the future we need per-feature checks/flags for features not
@@ -278,6 +292,8 @@ else
278 NO_LIBELF := 1 292 NO_LIBELF := 1
279 NO_DWARF := 1 293 NO_DWARF := 1
280 NO_DEMANGLE := 1 294 NO_DEMANGLE := 1
295 NO_LIBUNWIND := 1
296 NO_LIBDW_DWARF_UNWIND := 1
281 else 297 else
282 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 298 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
283 endif 299 endif
@@ -503,7 +519,21 @@ else
503endif 519endif
504 520
505ifeq ($(feature-libbfd), 1) 521ifeq ($(feature-libbfd), 1)
506 EXTLIBS += -lbfd -lz -liberty 522 EXTLIBS += -lbfd
523
524 # call all detections now so we get correct
525 # status in VF output
526 $(call feature_check,liberty)
527 $(call feature_check,liberty-z)
528 $(call feature_check,cplus-demangle)
529
530 ifeq ($(feature-liberty), 1)
531 EXTLIBS += -liberty
532 else
533 ifeq ($(feature-liberty-z), 1)
534 EXTLIBS += -liberty -lz
535 endif
536 endif
507endif 537endif
508 538
509ifdef NO_DEMANGLE 539ifdef NO_DEMANGLE
@@ -514,15 +544,10 @@ else
514 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT 544 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
515 else 545 else
516 ifneq ($(feature-libbfd), 1) 546 ifneq ($(feature-libbfd), 1)
517 $(call feature_check,liberty) 547 ifneq ($(feature-liberty), 1)
518 ifeq ($(feature-liberty), 1) 548 ifneq ($(feature-liberty-z), 1)
519 EXTLIBS += -lbfd -liberty 549 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
520 else 550 # or any of 'bfd iberty z' trinity
521 $(call feature_check,liberty-z)
522 ifeq ($(feature-liberty-z), 1)
523 EXTLIBS += -lbfd -liberty -lz
524 else
525 $(call feature_check,cplus-demangle)
526 ifeq ($(feature-cplus-demangle), 1) 551 ifeq ($(feature-cplus-demangle), 1)
527 EXTLIBS += -liberty 552 EXTLIBS += -liberty
528 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT 553 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 653a8fe2db95..bfb186900ac0 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore)
504 if (ret < 0) { 504 if (ret < 0) {
505 if (!excl_kernel) { 505 if (!excl_kernel) {
506 excl_kernel = true; 506 excl_kernel = true;
507 perf_evlist__set_maps(evlist, NULL, NULL);
507 perf_evlist__delete(evlist); 508 perf_evlist__delete(evlist);
508 evlist = NULL; 509 evlist = NULL;
509 continue; 510 continue;
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 5daeae1cb4c0..2f92d6e7ee00 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -46,6 +46,7 @@ make_install_man := install-man
46make_install_html := install-html 46make_install_html := install-html
47make_install_info := install-info 47make_install_info := install-info
48make_install_pdf := install-pdf 48make_install_pdf := install-pdf
49make_static := LDFLAGS=-static
49 50
50# all the NO_* variable combined 51# all the NO_* variable combined
51make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 52make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
@@ -87,6 +88,7 @@ run += make_install_bin
87# run += make_install_info 88# run += make_install_info
88# run += make_install_pdf 89# run += make_install_pdf
89run += make_minimal 90run += make_minimal
91run += make_static
90 92
91ifneq ($(call has,ctags),) 93ifneq ($(call has,ctags),)
92run += make_tags 94run += make_tags
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 1fbcd8bdc11b..55de44ecebef 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file)
86 86
87static int open_file_write(struct perf_data_file *file) 87static int open_file_write(struct perf_data_file *file)
88{ 88{
89 int fd;
90
89 if (check_backup(file)) 91 if (check_backup(file))
90 return -1; 92 return -1;
91 93
92 return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); 94 fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
95
96 if (fd < 0)
97 pr_err("failed to open %s : %s\n", file->path, strerror(errno));
98
99 return fd;
93} 100}
94 101
95static int open_file(struct perf_data_file *file) 102static int open_file(struct perf_data_file *file)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b8c151..27c2a5efe450 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
717} 717}
718 718
719static int map_groups__set_modules_path_dir(struct map_groups *mg, 719static int map_groups__set_modules_path_dir(struct map_groups *mg,
720 const char *dir_name) 720 const char *dir_name, int depth)
721{ 721{
722 struct dirent *dent; 722 struct dirent *dent;
723 DIR *dir = opendir(dir_name); 723 DIR *dir = opendir(dir_name);
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
742 !strcmp(dent->d_name, "..")) 742 !strcmp(dent->d_name, ".."))
743 continue; 743 continue;
744 744
745 ret = map_groups__set_modules_path_dir(mg, path); 745 /* Do not follow top-level source and build symlinks */
746 if (depth == 0) {
747 if (!strcmp(dent->d_name, "source") ||
748 !strcmp(dent->d_name, "build"))
749 continue;
750 }
751
752 ret = map_groups__set_modules_path_dir(mg, path,
753 depth + 1);
746 if (ret < 0) 754 if (ret < 0)
747 goto out; 755 goto out;
748 } else { 756 } else {
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
786 if (!version) 794 if (!version)
787 return -1; 795 return -1;
788 796
789 snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", 797 snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
790 machine->root_dir, version); 798 machine->root_dir, version);
791 free(version); 799 free(version);
792 800
793 return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); 801 return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
794} 802}
795 803
796static int machine__create_module(void *arg, const char *name, u64 start) 804static int machine__create_module(void *arg, const char *name, u64 start)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index df0238654698..562762117639 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
985 985
986#if _ELFUTILS_PREREQ(0, 142) 986#if _ELFUTILS_PREREQ(0, 142)
987 /* Get the call frame information from this dwarf */ 987 /* Get the call frame information from this dwarf */
988 pf->cfi = dwarf_getcfi(dbg->dbg); 988 pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
989#endif 989#endif
990 990
991 off = 0; 991 off = 0;
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno,
1441 void *data) 1441 void *data)
1442{ 1442{
1443 struct line_finder *lf = data; 1443 struct line_finder *lf = data;
1444 int err;
1444 1445
1445 if ((strtailcmp(fname, lf->fname) != 0) || 1446 if ((strtailcmp(fname, lf->fname) != 0) ||
1446 (lf->lno_s > lineno || lf->lno_e < lineno)) 1447 (lf->lno_s > lineno || lf->lno_e < lineno))
1447 return 0; 1448 return 0;
1448 1449
1449 if (line_range_add_line(fname, lineno, lf->lr) < 0) 1450 err = line_range_add_line(fname, lineno, lf->lr);
1450 return -EINVAL; 1451 if (err < 0 && err != -EEXIST)
1452 return err;
1451 1453
1452 return 0; 1454 return 0;
1453} 1455}
@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf)
1473 1475
1474static int line_range_inline_cb(Dwarf_Die *in_die, void *data) 1476static int line_range_inline_cb(Dwarf_Die *in_die, void *data)
1475{ 1477{
1476 find_line_range_by_line(in_die, data); 1478 int ret = find_line_range_by_line(in_die, data);
1477 1479
1478 /* 1480 /*
1479 * We have to check all instances of inlined function, because 1481 * We have to check all instances of inlined function, because
1480 * some execution paths can be optimized out depends on the 1482 * some execution paths can be optimized out depends on the
1481 * function argument of instances 1483 * function argument of instances. However, if an error occurs,
1484 * it should be handled by the caller.
1482 */ 1485 */
1483 return 0; 1486 return ret < 0 ? ret : 0;
1484} 1487}
1485 1488
1486/* Search function definition from function name */ 1489/* Search function definition from function name */
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 3b7dbf51d4a9..6864661a79dd 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -6,6 +6,7 @@
6#include <inttypes.h> 6#include <inttypes.h>
7 7
8#include "symbol.h" 8#include "symbol.h"
9#include "vdso.h"
9#include <symbol/kallsyms.h> 10#include <symbol/kallsyms.h>
10#include "debug.h" 11#include "debug.h"
11 12
@@ -618,6 +619,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
618 GElf_Shdr shdr; 619 GElf_Shdr shdr;
619 ss->adjust_symbols = (ehdr.e_type == ET_EXEC || 620 ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
620 ehdr.e_type == ET_REL || 621 ehdr.e_type == ET_REL ||
622 is_vdso_map(dso->short_name) ||
621 elf_section_by_name(elf, &ehdr, &shdr, 623 elf_section_by_name(elf, &ehdr, &shdr,
622 ".gnu.prelink_undo", 624 ".gnu.prelink_undo",
623 NULL) != NULL); 625 NULL) != NULL);
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile
index d9186a2fdf06..c2c0f20067a5 100644
--- a/tools/power/acpi/Makefile
+++ b/tools/power/acpi/Makefile
@@ -89,15 +89,6 @@ else
89 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment 89 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
90endif 90endif
91 91
92# if DEBUG is enabled, then we do not strip or optimize
93ifeq ($(strip $(DEBUG)),true)
94 CFLAGS += -O1 -g -DDEBUG
95 STRIPCMD = /bin/true -Since_we_are_debugging
96else
97 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
98 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
99endif
100
101# --- ACPIDUMP BEGIN --- 92# --- ACPIDUMP BEGIN ---
102 93
103vpath %.c \ 94vpath %.c \
@@ -128,7 +119,7 @@ clean:
128 -rm -f $(OUTPUT)acpidump 119 -rm -f $(OUTPUT)acpidump
129 120
130install-tools: 121install-tools:
131 $(INSTALL) -d $(DESTDIR)${bindir} 122 $(INSTALL) -d $(DESTDIR)${sbindir}
132 $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir} 123 $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
133 124
134install-man: 125install-man: