Commit fbdd17ec5ce2e5e4027356fcfde769b88d15702f

Authored by Ingo Molnar

Merge branch 'perf-core-for-mingo' into perf/urgent

Conflicts:
	tools/perf/bench/numa.c

Pull perf fixes from Jiri Olsa.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

Showing 8 changed files Side-by-side Diff

... ... @@ -6782,7 +6782,7 @@
6782 6782 M: Peter Zijlstra <a.p.zijlstra@chello.nl>
6783 6783 M: Paul Mackerras <paulus@samba.org>
6784 6784 M: Ingo Molnar <mingo@redhat.com>
6785   -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
  6785 +M: Arnaldo Carvalho de Melo <acme@kernel.org>
6786 6786 L: linux-kernel@vger.kernel.org
6787 6787 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
6788 6788 S: Supported
tools/lib/traceevent/event-parse.c
... ... @@ -50,6 +50,18 @@
50 50 warning(fmt, ##__VA_ARGS__); \
51 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 +
53 65 static void init_input_buf(const char *buf, unsigned long long size)
54 66 {
55 67 input_buf = buf;
... ... @@ -1355,7 +1367,7 @@
1355 1367 }
1356 1368  
1357 1369 if (!field->type) {
1358   - do_warning("%s: no type found", __func__);
  1370 + do_warning_event(event, "%s: no type found", __func__);
1359 1371 goto fail;
1360 1372 }
1361 1373 field->name = last_token;
... ... @@ -1402,7 +1414,7 @@
1402 1414 free_token(token);
1403 1415 type = read_token(&token);
1404 1416 if (type == EVENT_NONE) {
1405   - do_warning("failed to find token");
  1417 + do_warning_event(event, "failed to find token");
1406 1418 goto fail;
1407 1419 }
1408 1420 }
... ... @@ -1636,7 +1648,7 @@
1636 1648 right = alloc_arg();
1637 1649  
1638 1650 if (!arg || !left || !right) {
1639   - do_warning("%s: not enough memory!", __func__);
  1651 + do_warning_event(event, "%s: not enough memory!", __func__);
1640 1652 /* arg will be freed at out_free */
1641 1653 free_arg(left);
1642 1654 free_arg(right);
... ... @@ -1686,7 +1698,7 @@
1686 1698  
1687 1699 arg = alloc_arg();
1688 1700 if (!arg) {
1689   - do_warning("%s: not enough memory!", __func__);
  1701 + do_warning_event(event, "%s: not enough memory!", __func__);
1690 1702 /* '*tok' is set to top->op.op. No need to free. */
1691 1703 *tok = NULL;
1692 1704 return EVENT_ERROR;
... ... @@ -1792,7 +1804,7 @@
1792 1804 if (arg->type == PRINT_OP && !arg->op.left) {
1793 1805 /* handle single op */
1794 1806 if (token[1]) {
1795   - do_warning("bad op token %s", token);
  1807 + do_warning_event(event, "bad op token %s", token);
1796 1808 goto out_free;
1797 1809 }
1798 1810 switch (token[0]) {
... ... @@ -1802,7 +1814,7 @@
1802 1814 case '-':
1803 1815 break;
1804 1816 default:
1805   - do_warning("bad op token %s", token);
  1817 + do_warning_event(event, "bad op token %s", token);
1806 1818 goto out_free;
1807 1819  
1808 1820 }
... ... @@ -1888,7 +1900,7 @@
1888 1900 char *new_atom;
1889 1901  
1890 1902 if (left->type != PRINT_ATOM) {
1891   - do_warning("bad pointer type");
  1903 + do_warning_event(event, "bad pointer type");
1892 1904 goto out_free;
1893 1905 }
1894 1906 new_atom = realloc(left->atom.atom,
... ... @@ -1930,7 +1942,7 @@
1930 1942 type = process_array(event, arg, tok);
1931 1943  
1932 1944 } else {
1933   - do_warning("unknown op '%s'", token);
  1945 + do_warning_event(event, "unknown op '%s'", token);
1934 1946 event->flags |= EVENT_FL_FAILED;
1935 1947 /* the arg is now the left side */
1936 1948 goto out_free;
... ... @@ -1951,7 +1963,7 @@
1951 1963 return type;
1952 1964  
1953 1965 out_warn_free:
1954   - do_warning("%s: not enough memory!", __func__);
  1966 + do_warning_event(event, "%s: not enough memory!", __func__);
1955 1967 out_free:
1956 1968 free_token(token);
1957 1969 *tok = NULL;
... ... @@ -2385,7 +2397,7 @@
2385 2397  
2386 2398 field = alloc_arg();
2387 2399 if (!field) {
2388   - do_warning("%s: not enough memory!", __func__);
  2400 + do_warning_event(event, "%s: not enough memory!", __func__);
2389 2401 goto out_free;
2390 2402 }
2391 2403  
... ... @@ -2438,7 +2450,7 @@
2438 2450  
2439 2451 field = alloc_arg();
2440 2452 if (!field) {
2441   - do_warning("%s: not enough memory!", __func__);
  2453 + do_warning_event(event, "%s: not enough memory!", __func__);
2442 2454 goto out_free;
2443 2455 }
2444 2456  
... ... @@ -2477,7 +2489,7 @@
2477 2489  
2478 2490 field = alloc_arg();
2479 2491 if (!field) {
2480   - do_warning("%s: not enough memory!", __func__);
  2492 + do_warning_event(event, "%s: not enough memory!", __func__);
2481 2493 goto out_free;
2482 2494 }
2483 2495  
... ... @@ -2492,7 +2504,7 @@
2492 2504  
2493 2505 field = alloc_arg();
2494 2506 if (!field) {
2495   - do_warning("%s: not enough memory!", __func__);
  2507 + do_warning_event(event, "%s: not enough memory!", __func__);
2496 2508 *tok = NULL;
2497 2509 return EVENT_ERROR;
2498 2510 }
... ... @@ -2555,7 +2567,7 @@
2555 2567 free_token(token);
2556 2568 arg = alloc_arg();
2557 2569 if (!arg) {
2558   - do_warning("%s: not enough memory!", __func__);
  2570 + do_warning_event(event, "%s: not enough memory!", __func__);
2559 2571 *tok = NULL;
2560 2572 return EVENT_ERROR;
2561 2573 }
2562 2574  
... ... @@ -2614,13 +2626,14 @@
2614 2626  
2615 2627 /* prevous must be an atom */
2616 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 2630 goto out_free;
2619 2631 }
2620 2632  
2621 2633 item_arg = alloc_arg();
2622 2634 if (!item_arg) {
2623   - do_warning("%s: not enough memory!", __func__);
  2635 + do_warning_event(event, "%s: not enough memory!",
  2636 + __func__);
2624 2637 goto out_free;
2625 2638 }
2626 2639  
2627 2640  
2628 2641  
... ... @@ -2721,21 +2734,24 @@
2721 2734 for (i = 0; i < func->nr_args; i++) {
2722 2735 farg = alloc_arg();
2723 2736 if (!farg) {
2724   - do_warning("%s: not enough memory!", __func__);
  2737 + do_warning_event(event, "%s: not enough memory!",
  2738 + __func__);
2725 2739 return EVENT_ERROR;
2726 2740 }
2727 2741  
2728 2742 type = process_arg(event, farg, &token);
2729 2743 if (i < (func->nr_args - 1)) {
2730 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 2747 func->name, func->nr_args,
2733 2748 event->name, i + 1);
2734 2749 goto err;
2735 2750 }
2736 2751 } else {
2737 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 2755 func->name, func->nr_args, event->name);
2740 2756 goto err;
2741 2757 }
... ... @@ -2792,7 +2808,7 @@
2792 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 2812 free_token(token);
2797 2813 return EVENT_ERROR;
2798 2814 }
... ... @@ -2878,7 +2894,7 @@
2878 2894  
2879 2895 case EVENT_ERROR ... EVENT_NEWLINE:
2880 2896 default:
2881   - do_warning("unexpected type %d", type);
  2897 + do_warning_event(event, "unexpected type %d", type);
2882 2898 return EVENT_ERROR;
2883 2899 }
2884 2900 *tok = token;
... ... @@ -2901,7 +2917,8 @@
2901 2917  
2902 2918 arg = alloc_arg();
2903 2919 if (!arg) {
2904   - do_warning("%s: not enough memory!", __func__);
  2920 + do_warning_event(event, "%s: not enough memory!",
  2921 + __func__);
2905 2922 return -1;
2906 2923 }
2907 2924  
2908 2925  
... ... @@ -3481,11 +3498,12 @@
3481 3498 return val;
3482 3499  
3483 3500 out_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 3502 return 0;
3486 3503  
3487 3504 out_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 3507 return 0;
3490 3508 }
3491 3509  
... ... @@ -3591,7 +3609,8 @@
3591 3609 }
3592 3610 str = malloc(len + 1);
3593 3611 if (!str) {
3594   - do_warning("%s: not enough memory!", __func__);
  3612 + do_warning_event(event, "%s: not enough memory!",
  3613 + __func__);
3595 3614 return;
3596 3615 }
3597 3616 memcpy(str, data + field->offset, len);
... ... @@ -3697,7 +3716,8 @@
3697 3716 return;
3698 3717  
3699 3718 out_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  
3703 3723 static unsigned long long
3704 3724  
... ... @@ -3742,14 +3762,16 @@
3742 3762 trace_seq_terminate(&str);
3743 3763 string = malloc(sizeof(*string));
3744 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 3767 goto out_free;
3747 3768 }
3748 3769 string->next = strings;
3749 3770 string->str = strdup(str.buffer);
3750 3771 if (!string->str) {
3751 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 3775 goto out_free;
3754 3776 }
3755 3777 args[i] = (uintptr_t)string->str;
... ... @@ -3761,7 +3783,7 @@
3761 3783 * Something went totally wrong, this is not
3762 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 3787 goto out_free;
3766 3788 }
3767 3789 farg = farg->next;
3768 3790  
... ... @@ -3811,12 +3833,12 @@
3811 3833 if (!field) {
3812 3834 field = pevent_find_field(event, "buf");
3813 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 3837 return NULL;
3816 3838 }
3817 3839 ip_field = pevent_find_field(event, "ip");
3818 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 3842 return NULL;
3821 3843 }
3822 3844 pevent->bprint_buf_field = field;
... ... @@ -3830,7 +3852,8 @@
3830 3852 */
3831 3853 args = alloc_arg();
3832 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 3857 return NULL;
3835 3858 }
3836 3859 arg = args;
... ... @@ -3896,7 +3919,7 @@
3896 3919 bptr += vsize;
3897 3920 arg = alloc_arg();
3898 3921 if (!arg) {
3899   - do_warning("%s(%d): not enough memory!",
  3922 + do_warning_event(event, "%s(%d): not enough memory!",
3900 3923 __func__, __LINE__);
3901 3924 goto out_free;
3902 3925 }
... ... @@ -3919,7 +3942,7 @@
3919 3942 case 's':
3920 3943 arg = alloc_arg();
3921 3944 if (!arg) {
3922   - do_warning("%s(%d): not enough memory!",
  3945 + do_warning_event(event, "%s(%d): not enough memory!",
3923 3946 __func__, __LINE__);
3924 3947 goto out_free;
3925 3948 }
... ... @@ -3959,7 +3982,7 @@
3959 3982 if (!field) {
3960 3983 field = pevent_find_field(event, "fmt");
3961 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 3986 return NULL;
3964 3987 }
3965 3988 pevent->bprint_fmt_field = field;
... ... @@ -4003,8 +4026,8 @@
4003 4026 arg->field.field =
4004 4027 pevent_find_any_field(event, arg->field.name);
4005 4028 if (!arg->field.field) {
4006   - do_warning("%s: field %s not found",
4007   - __func__, arg->field.name);
  4029 + do_warning_event(event, "%s: field %s not found",
  4030 + __func__, arg->field.name);
4008 4031 return;
4009 4032 }
4010 4033 }
... ... @@ -4176,7 +4199,7 @@
4176 4199 case '*':
4177 4200 /* The argument is the length. */
4178 4201 if (!arg) {
4179   - do_warning("no argument match");
  4202 + do_warning_event(event, "no argument match");
4180 4203 event->flags |= EVENT_FL_FAILED;
4181 4204 goto out_failed;
4182 4205 }
... ... @@ -4213,7 +4236,7 @@
4213 4236 case 'X':
4214 4237 case 'u':
4215 4238 if (!arg) {
4216   - do_warning("no argument match");
  4239 + do_warning_event(event, "no argument match");
4217 4240 event->flags |= EVENT_FL_FAILED;
4218 4241 goto out_failed;
4219 4242 }
... ... @@ -4223,7 +4246,7 @@
4223 4246  
4224 4247 /* should never happen */
4225 4248 if (len > 31) {
4226   - do_warning("bad format!");
  4249 + do_warning_event(event, "bad format!");
4227 4250 event->flags |= EVENT_FL_FAILED;
4228 4251 len = 31;
4229 4252 }
4230 4253  
... ... @@ -4290,13 +4313,13 @@
4290 4313 trace_seq_printf(s, format, (long long)val);
4291 4314 break;
4292 4315 default:
4293   - do_warning("bad count (%d)", ls);
  4316 + do_warning_event(event, "bad count (%d)", ls);
4294 4317 event->flags |= EVENT_FL_FAILED;
4295 4318 }
4296 4319 break;
4297 4320 case 's':
4298 4321 if (!arg) {
4299   - do_warning("no matching argument");
  4322 + do_warning_event(event, "no matching argument");
4300 4323 event->flags |= EVENT_FL_FAILED;
4301 4324 goto out_failed;
4302 4325 }
... ... @@ -4306,7 +4329,7 @@
4306 4329  
4307 4330 /* should never happen */
4308 4331 if (len > 31) {
4309   - do_warning("bad format!");
  4332 + do_warning_event(event, "bad format!");
4310 4333 event->flags |= EVENT_FL_FAILED;
4311 4334 len = 31;
4312 4335 }
tools/perf/Documentation/perf-bench.txt
... ... @@ -48,6 +48,12 @@
48 48 'mem'::
49 49 Memory access performance.
50 50  
  51 +'numa'::
  52 + NUMA scheduling and MM benchmarks.
  53 +
  54 +'futex'::
  55 + Futex stressing benchmarks.
  56 +
51 57 'all'::
52 58 All benchmark subsystems.
53 59  
... ... @@ -186,6 +192,22 @@
186 192 -n::
187 193 --no-prefault::
188 194 Show only the result without page faults before memset.
  195 +
  196 +SUITES FOR 'numa'
  197 +~~~~~~~~~~~~~~~~~
  198 +*mem*::
  199 +Suite for evaluating NUMA workloads.
  200 +
  201 +SUITES FOR 'futex'
  202 +~~~~~~~~~~~~~~~~~~
  203 +*hash*::
  204 +Suite for evaluating hash tables.
  205 +
  206 +*wake*::
  207 +Suite for evaluating wake calls.
  208 +
  209 +*requeue*::
  210 +Suite for evaluating requeue calls.
189 211  
190 212 SEE ALSO
191 213 --------
tools/perf/Documentation/perf-top.txt
... ... @@ -87,7 +87,6 @@
87 87 --realtime=<priority>::
88 88 Collect data with this RT SCHED_FIFO priority.
89 89  
90   --s <symbol>::
91 90 --sym-annotate=<symbol>::
92 91 Annotate this symbol.
93 92  
tools/perf/bench/numa.c
... ... @@ -1593,6 +1593,10 @@
1593 1593 p->data_rand_walk = true;
1594 1594 p->nr_loops = -1;
1595 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 1600 p->run_all = argc == 1;
1597 1601 }
1598 1602  
tools/perf/builtin-stat.c
... ... @@ -174,13 +174,20 @@
174 174  
175 175 static 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  
180 184 static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
181 185 {
182 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  
186 193 static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
tools/perf/config/Makefile
... ... @@ -65,10 +65,9 @@
65 65 ifdef LIBDW_DIR
66 66 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
67 67 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 68 endif
  69 + FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
  70 + FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
72 71 endif
73 72  
74 73 # include ARCH specific config
... ... @@ -278,6 +277,8 @@
278 277 NO_LIBELF := 1
279 278 NO_DWARF := 1
280 279 NO_DEMANGLE := 1
  280 + NO_LIBUNWIND := 1
  281 + NO_LIBDW_DWARF_UNWIND := 1
281 282 else
282 283 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
283 284 endif
tools/perf/util/probe-finder.c
... ... @@ -985,7 +985,7 @@
985 985  
986 986 #if _ELFUTILS_PREREQ(0, 142)
987 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 989 #endif
990 990  
991 991 off = 0;
992 992  
... ... @@ -1441,13 +1441,15 @@
1441 1441 void *data)
1442 1442 {
1443 1443 struct line_finder *lf = data;
  1444 + int err;
1444 1445  
1445 1446 if ((strtailcmp(fname, lf->fname) != 0) ||
1446 1447 (lf->lno_s > lineno || lf->lno_e < lineno))
1447 1448 return 0;
1448 1449  
1449   - if (line_range_add_line(fname, lineno, lf->lr) < 0)
1450   - return -EINVAL;
  1450 + err = line_range_add_line(fname, lineno, lf->lr);
  1451 + if (err < 0 && err != -EEXIST)
  1452 + return err;
1451 1453  
1452 1454 return 0;
1453 1455 }
1454 1456  
1455 1457  
... ... @@ -1473,14 +1475,15 @@
1473 1475  
1474 1476 static 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 1481 * We have to check all instances of inlined function, because
1480 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 1489 /* Search function definition from function name */