Commit 2a83dc7e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Tooling fixes, plus a simple hardware-enablement patch for the Intel
  RAPL PMU (energy use measurement) on Haswell CPUs, which I hope is
  still fine at this stage"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Instead of redirecting flex output, use -o
  perf tools: Fix double free in perf test 21 (code-reading.c)
  perf stat: Initialize statistics correctly
  perf bench: Set more defaults in the 'numa' suite
  perf bench: Fix segfault at the end of an 'all' execution
  perf bench: Update manpage to mention numa and futex
  perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()
  perf probe: Fix to handle errors in line_range searching
  perf probe: Fix --line option behavior
  perf tools: Pick up libdw without explicit LIBDW_DIR
  MAINTAINERS: Change e-mail to kernel.org one
  perf callchains: Disable unwind libraries when libelf isn't found
  tools lib traceevent: Do not call warning() directly
  tools lib traceevent: Print event name when show warning if possible
  perf top: Fix documentation of invalid -s option
  perf/x86: Enable DRAM RAPL support on Intel Haswell
parents 17cf7db2 ad466db5
...@@ -6782,7 +6782,7 @@ PERFORMANCE EVENTS SUBSYSTEM ...@@ -6782,7 +6782,7 @@ PERFORMANCE EVENTS SUBSYSTEM
M: Peter Zijlstra <a.p.zijlstra@chello.nl> M: Peter Zijlstra <a.p.zijlstra@chello.nl>
M: Paul Mackerras <paulus@samba.org> M: Paul Mackerras <paulus@samba.org>
M: Ingo Molnar <mingo@redhat.com> M: Ingo Molnar <mingo@redhat.com>
M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> M: Arnaldo Carvalho de Melo <acme@kernel.org>
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
S: Supported S: Supported
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#define INTEL_RAPL_PKG 0x2 /* pseudo-encoding */ #define INTEL_RAPL_PKG 0x2 /* pseudo-encoding */
#define RAPL_IDX_RAM_NRG_STAT 2 /* DRAM */ #define RAPL_IDX_RAM_NRG_STAT 2 /* DRAM */
#define INTEL_RAPL_RAM 0x3 /* pseudo-encoding */ #define INTEL_RAPL_RAM 0x3 /* pseudo-encoding */
#define RAPL_IDX_PP1_NRG_STAT 3 /* DRAM */ #define RAPL_IDX_PP1_NRG_STAT 3 /* gpu */
#define INTEL_RAPL_PP1 0x4 /* pseudo-encoding */ #define INTEL_RAPL_PP1 0x4 /* pseudo-encoding */
/* Clients have PP0, PKG */ /* Clients have PP0, PKG */
...@@ -72,6 +72,12 @@ ...@@ -72,6 +72,12 @@
1<<RAPL_IDX_PKG_NRG_STAT|\ 1<<RAPL_IDX_PKG_NRG_STAT|\
1<<RAPL_IDX_RAM_NRG_STAT) 1<<RAPL_IDX_RAM_NRG_STAT)
/* Servers have PP0, PKG, RAM, PP1 */
#define RAPL_IDX_HSW (1<<RAPL_IDX_PP0_NRG_STAT|\
1<<RAPL_IDX_PKG_NRG_STAT|\
1<<RAPL_IDX_RAM_NRG_STAT|\
1<<RAPL_IDX_PP1_NRG_STAT)
/* /*
* event code: LSB 8 bits, passed in attr->config * event code: LSB 8 bits, passed in attr->config
* any other bit is reserved * any other bit is reserved
...@@ -425,6 +431,24 @@ static struct attribute *rapl_events_cln_attr[] = { ...@@ -425,6 +431,24 @@ static struct attribute *rapl_events_cln_attr[] = {
NULL, NULL,
}; };
static struct attribute *rapl_events_hsw_attr[] = {
EVENT_PTR(rapl_cores),
EVENT_PTR(rapl_pkg),
EVENT_PTR(rapl_gpu),
EVENT_PTR(rapl_ram),
EVENT_PTR(rapl_cores_unit),
EVENT_PTR(rapl_pkg_unit),
EVENT_PTR(rapl_gpu_unit),
EVENT_PTR(rapl_ram_unit),
EVENT_PTR(rapl_cores_scale),
EVENT_PTR(rapl_pkg_scale),
EVENT_PTR(rapl_gpu_scale),
EVENT_PTR(rapl_ram_scale),
NULL,
};
static struct attribute_group rapl_pmu_events_group = { static struct attribute_group rapl_pmu_events_group = {
.name = "events", .name = "events",
.attrs = NULL, /* patched at runtime */ .attrs = NULL, /* patched at runtime */
...@@ -631,11 +655,14 @@ static int __init rapl_pmu_init(void) ...@@ -631,11 +655,14 @@ static int __init rapl_pmu_init(void)
switch (boot_cpu_data.x86_model) { switch (boot_cpu_data.x86_model) {
case 42: /* Sandy Bridge */ case 42: /* Sandy Bridge */
case 58: /* Ivy Bridge */ case 58: /* Ivy Bridge */
case 60: /* Haswell */
case 69: /* Haswell-Celeron */
rapl_cntr_mask = RAPL_IDX_CLN; rapl_cntr_mask = RAPL_IDX_CLN;
rapl_pmu_events_group.attrs = rapl_events_cln_attr; rapl_pmu_events_group.attrs = rapl_events_cln_attr;
break; break;
case 60: /* Haswell */
case 69: /* Haswell-Celeron */
rapl_cntr_mask = RAPL_IDX_HSW;
rapl_pmu_events_group.attrs = rapl_events_hsw_attr;
break;
case 45: /* Sandy Bridge-EP */ case 45: /* Sandy Bridge-EP */
case 62: /* IvyTown */ case 62: /* IvyTown */
rapl_cntr_mask = RAPL_IDX_SRV; rapl_cntr_mask = RAPL_IDX_SRV;
......
...@@ -50,6 +50,18 @@ static int show_warning = 1; ...@@ -50,6 +50,18 @@ static int show_warning = 1;
warning(fmt, ##__VA_ARGS__); \ warning(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#define do_warning_event(event, fmt, ...) \
do { \
if (!show_warning) \
continue; \
\
if (event) \
warning("[%s:%s] " fmt, event->system, \
event->name, ##__VA_ARGS__); \
else \
warning(fmt, ##__VA_ARGS__); \
} while (0)
static void init_input_buf(const char *buf, unsigned long long size) static void init_input_buf(const char *buf, unsigned long long size)
{ {
input_buf = buf; input_buf = buf;
...@@ -1355,7 +1367,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f ...@@ -1355,7 +1367,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
} }
if (!field->type) { if (!field->type) {
do_warning("%s: no type found", __func__); do_warning_event(event, "%s: no type found", __func__);
goto fail; goto fail;
} }
field->name = last_token; field->name = last_token;
...@@ -1402,7 +1414,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f ...@@ -1402,7 +1414,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
free_token(token); free_token(token);
type = read_token(&token); type = read_token(&token);
if (type == EVENT_NONE) { if (type == EVENT_NONE) {
do_warning("failed to find token"); do_warning_event(event, "failed to find token");
goto fail; goto fail;
} }
} }
...@@ -1636,7 +1648,7 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok) ...@@ -1636,7 +1648,7 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok)
right = alloc_arg(); right = alloc_arg();
if (!arg || !left || !right) { if (!arg || !left || !right) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
/* arg will be freed at out_free */ /* arg will be freed at out_free */
free_arg(left); free_arg(left);
free_arg(right); free_arg(right);
...@@ -1686,7 +1698,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok) ...@@ -1686,7 +1698,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok)
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
/* '*tok' is set to top->op.op. No need to free. */ /* '*tok' is set to top->op.op. No need to free. */
*tok = NULL; *tok = NULL;
return EVENT_ERROR; return EVENT_ERROR;
...@@ -1792,7 +1804,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -1792,7 +1804,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
if (arg->type == PRINT_OP && !arg->op.left) { if (arg->type == PRINT_OP && !arg->op.left) {
/* handle single op */ /* handle single op */
if (token[1]) { if (token[1]) {
do_warning("bad op token %s", token); do_warning_event(event, "bad op token %s", token);
goto out_free; goto out_free;
} }
switch (token[0]) { switch (token[0]) {
...@@ -1802,7 +1814,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -1802,7 +1814,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
case '-': case '-':
break; break;
default: default:
do_warning("bad op token %s", token); do_warning_event(event, "bad op token %s", token);
goto out_free; goto out_free;
} }
...@@ -1888,7 +1900,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -1888,7 +1900,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
char *new_atom; char *new_atom;
if (left->type != PRINT_ATOM) { if (left->type != PRINT_ATOM) {
do_warning("bad pointer type"); do_warning_event(event, "bad pointer type");
goto out_free; goto out_free;
} }
new_atom = realloc(left->atom.atom, new_atom = realloc(left->atom.atom,
...@@ -1930,7 +1942,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -1930,7 +1942,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
type = process_array(event, arg, tok); type = process_array(event, arg, tok);
} else { } else {
do_warning("unknown op '%s'", token); do_warning_event(event, "unknown op '%s'", token);
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
/* the arg is now the left side */ /* the arg is now the left side */
goto out_free; goto out_free;
...@@ -1951,7 +1963,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -1951,7 +1963,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
return type; return type;
out_warn_free: out_warn_free:
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
out_free: out_free:
free_token(token); free_token(token);
*tok = NULL; *tok = NULL;
...@@ -2385,7 +2397,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2385,7 +2397,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
field = alloc_arg(); field = alloc_arg();
if (!field) { if (!field) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
goto out_free; goto out_free;
} }
...@@ -2438,7 +2450,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2438,7 +2450,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
field = alloc_arg(); field = alloc_arg();
if (!field) { if (!field) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
goto out_free; goto out_free;
} }
...@@ -2477,7 +2489,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2477,7 +2489,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
field = alloc_arg(); field = alloc_arg();
if (!field) { if (!field) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
goto out_free; goto out_free;
} }
...@@ -2492,7 +2504,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2492,7 +2504,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
field = alloc_arg(); field = alloc_arg();
if (!field) { if (!field) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
*tok = NULL; *tok = NULL;
return EVENT_ERROR; return EVENT_ERROR;
} }
...@@ -2555,7 +2567,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char ** ...@@ -2555,7 +2567,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
free_token(token); free_token(token);
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!", __func__);
*tok = NULL; *tok = NULL;
return EVENT_ERROR; return EVENT_ERROR;
} }
...@@ -2614,13 +2626,14 @@ process_paren(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2614,13 +2626,14 @@ process_paren(struct event_format *event, struct print_arg *arg, char **tok)
/* prevous must be an atom */ /* prevous must be an atom */
if (arg->type != PRINT_ATOM) { if (arg->type != PRINT_ATOM) {
do_warning("previous needed to be PRINT_ATOM"); do_warning_event(event, "previous needed to be PRINT_ATOM");
goto out_free; goto out_free;
} }
item_arg = alloc_arg(); item_arg = alloc_arg();
if (!item_arg) { if (!item_arg) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!",
__func__);
goto out_free; goto out_free;
} }
...@@ -2721,21 +2734,24 @@ process_func_handler(struct event_format *event, struct pevent_function_handler ...@@ -2721,21 +2734,24 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
for (i = 0; i < func->nr_args; i++) { for (i = 0; i < func->nr_args; i++) {
farg = alloc_arg(); farg = alloc_arg();
if (!farg) { if (!farg) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!",
__func__);
return EVENT_ERROR; return EVENT_ERROR;
} }
type = process_arg(event, farg, &token); type = process_arg(event, farg, &token);
if (i < (func->nr_args - 1)) { if (i < (func->nr_args - 1)) {
if (type != EVENT_DELIM || strcmp(token, ",") != 0) { if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
warning("Error: function '%s()' expects %d arguments but event %s only uses %d", do_warning_event(event,
"Error: function '%s()' expects %d arguments but event %s only uses %d",
func->name, func->nr_args, func->name, func->nr_args,
event->name, i + 1); event->name, i + 1);
goto err; goto err;
} }
} else { } else {
if (type != EVENT_DELIM || strcmp(token, ")") != 0) { if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
warning("Error: function '%s()' only expects %d arguments but event %s has more", do_warning_event(event,
"Error: function '%s()' only expects %d arguments but event %s has more",
func->name, func->nr_args, event->name); func->name, func->nr_args, event->name);
goto err; goto err;
} }
...@@ -2792,7 +2808,7 @@ process_function(struct event_format *event, struct print_arg *arg, ...@@ -2792,7 +2808,7 @@ process_function(struct event_format *event, struct print_arg *arg,
return process_func_handler(event, func, arg, tok); return process_func_handler(event, func, arg, tok);
} }
do_warning("function %s not defined", token); do_warning_event(event, "function %s not defined", token);
free_token(token); free_token(token);
return EVENT_ERROR; return EVENT_ERROR;
} }
...@@ -2878,7 +2894,7 @@ process_arg_token(struct event_format *event, struct print_arg *arg, ...@@ -2878,7 +2894,7 @@ process_arg_token(struct event_format *event, struct print_arg *arg,
case EVENT_ERROR ... EVENT_NEWLINE: case EVENT_ERROR ... EVENT_NEWLINE:
default: default:
do_warning("unexpected type %d", type); do_warning_event(event, "unexpected type %d", type);
return EVENT_ERROR; return EVENT_ERROR;
} }
*tok = token; *tok = token;
...@@ -2901,7 +2917,8 @@ static int event_read_print_args(struct event_format *event, struct print_arg ** ...@@ -2901,7 +2917,8 @@ static int event_read_print_args(struct event_format *event, struct print_arg **
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!",
__func__);
return -1; return -1;
} }
...@@ -3481,11 +3498,12 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg ...@@ -3481,11 +3498,12 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
return val; return val;
out_warning_op: out_warning_op:
do_warning("%s: unknown op '%s'", __func__, arg->op.op); do_warning_event(event, "%s: unknown op '%s'", __func__, arg->op.op);
return 0; return 0;
out_warning_field: out_warning_field:
do_warning("%s: field %s not found", __func__, arg->field.name); do_warning_event(event, "%s: field %s not found",
__func__, arg->field.name);
return 0; return 0;
} }
...@@ -3591,7 +3609,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, ...@@ -3591,7 +3609,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
} }
str = malloc(len + 1); str = malloc(len + 1);
if (!str) { if (!str) {
do_warning("%s: not enough memory!", __func__); do_warning_event(event, "%s: not enough memory!",
__func__);
return; return;
} }
memcpy(str, data + field->offset, len); memcpy(str, data + field->offset, len);
...@@ -3697,7 +3716,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, ...@@ -3697,7 +3716,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
return; return;
out_warning_field: out_warning_field:
do_warning("%s: field %s not found", __func__, arg->field.name); do_warning_event(event, "%s: field %s not found",
__func__, arg->field.name);
} }
static unsigned long long static unsigned long long
...@@ -3742,14 +3762,16 @@ process_defined_func(struct trace_seq *s, void *data, int size, ...@@ -3742,14 +3762,16 @@ process_defined_func(struct trace_seq *s, void *data, int size,
trace_seq_terminate(&str); trace_seq_terminate(&str);
string = malloc(sizeof(*string)); string = malloc(sizeof(*string));
if (!string) { if (!string) {
do_warning("%s(%d): malloc str", __func__, __LINE__); do_warning_event(event, "%s(%d): malloc str",
__func__, __LINE__);
goto out_free; goto out_free;
} }
string->next = strings; string->next = strings;
string->str = strdup(str.buffer); string->str = strdup(str.buffer);
if (!string->str) { if (!string->str) {
free(string); free(string);
do_warning("%s(%d): malloc str", __func__, __LINE__); do_warning_event(event, "%s(%d): malloc str",
__func__, __LINE__);
goto out_free; goto out_free;
} }
args[i] = (uintptr_t)string->str; args[i] = (uintptr_t)string->str;
...@@ -3761,7 +3783,7 @@ process_defined_func(struct trace_seq *s, void *data, int size, ...@@ -3761,7 +3783,7 @@ process_defined_func(struct trace_seq *s, void *data, int size,
* Something went totally wrong, this is not * Something went totally wrong, this is not
* an input error, something in this code broke. * an input error, something in this code broke.
*/ */
do_warning("Unexpected end of arguments\n"); do_warning_event(event, "Unexpected end of arguments\n");
goto out_free; goto out_free;
} }
farg = farg->next; farg = farg->next;
...@@ -3811,12 +3833,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc ...@@ -3811,12 +3833,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
if (!field) { if (!field) {
field = pevent_find_field(event, "buf"); field = pevent_find_field(event, "buf");
if (!field) { if (!field) {
do_warning("can't find buffer field for binary printk"); do_warning_event(event, "can't find buffer field for binary printk");
return NULL; return NULL;
} }
ip_field = pevent_find_field(event, "ip"); ip_field = pevent_find_field(event, "ip");
if (!ip_field) { if (!ip_field) {
do_warning("can't find ip field for binary printk"); do_warning_event(event, "can't find ip field for binary printk");
return NULL; return NULL;
} }
pevent->bprint_buf_field = field; pevent->bprint_buf_field = field;
...@@ -3830,7 +3852,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc ...@@ -3830,7 +3852,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
*/ */
args = alloc_arg(); args = alloc_arg();
if (!args) { if (!args) {
do_warning("%s(%d): not enough memory!", __func__, __LINE__); do_warning_event(event, "%s(%d): not enough memory!",
__func__, __LINE__);
return NULL; return NULL;
} }
arg = args; arg = args;
...@@ -3896,7 +3919,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc ...@@ -3896,7 +3919,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
bptr += vsize; bptr += vsize;
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
do_warning("%s(%d): not enough memory!", do_warning_event(event, "%s(%d): not enough memory!",
__func__, __LINE__); __func__, __LINE__);
goto out_free; goto out_free;
} }
...@@ -3919,7 +3942,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc ...@@ -3919,7 +3942,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
case 's': case 's':
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
do_warning("%s(%d): not enough memory!", do_warning_event(event, "%s(%d): not enough memory!",
__func__, __LINE__); __func__, __LINE__);
goto out_free; goto out_free;
} }
...@@ -3959,7 +3982,7 @@ get_bprint_format(void *data, int size __maybe_unused, ...@@ -3959,7 +3982,7 @@ get_bprint_format(void *data, int size __maybe_unused,
if (!field) { if (!field) {
field = pevent_find_field(event, "fmt"); field = pevent_find_field(event, "fmt");
if (!field) { if (!field) {
do_warning("can't find format field for binary printk"); do_warning_event(event, "can't find format field for binary printk");
return NULL; return NULL;
} }
pevent->bprint_fmt_field = field; 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,8 +4026,8 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size,
arg->field.field = arg->field.field =
pevent_find_any_field(event, arg->field.name); pevent_find_any_field(event, arg->field.name);
if (!arg->field.field) { if (!arg->field.field) {
do_warning("%s: field %s not found", do_warning_event(event, "%s: field %s not found",
__func__, arg->field.name); __func__, arg->field.name);
return; return;
} }
} }
...@@ -4176,7 +4199,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event ...@@ -4176,7 +4199,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
case '*': case '*':
/* The argument is the length. */ /* The argument is the length. */
if (!arg) { if (!arg) {
do_warning("no argument match"); do_warning_event(event, "no argument match");
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
goto out_failed; goto out_failed;
} }
...@@ -4213,7 +4236,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event ...@@ -4213,7 +4236,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
case 'X': case 'X':
case 'u': case 'u':
if (!arg) { if (!arg) {
do_warning("no argument match"); do_warning_event(event, "no argument match");
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
goto out_failed; goto out_failed;
} }
...@@ -4223,7 +4246,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event ...@@ -4223,7 +4246,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
/* should never happen */ /* should never happen */
if (len > 31) { if (len > 31) {
do_warning("bad format!"); do_warning_event(event, "bad format!");
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
len = 31; len = 31;
} }
...@@ -4290,13 +4313,13 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event ...@@ -4290,13 +4313,13 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
trace_seq_printf(s, format, (long long)val); trace_seq_printf(s, format, (long long)val);
break; break;
default: default:
do_warning("bad count (%d)", ls); do_warning_event(event, "bad count (%d)", ls);
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
} }
break; break;
case 's': case 's':
if (!arg) { if (!arg) {
do_warning("no matching argument"); do_warning_event(event, "no matching argument");
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
goto out_failed; goto out_failed;
} }
...@@ -4306,7 +4329,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event ...@@ -4306,7 +4329,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
/* should never happen */ /* should never happen */
if (len > 31) { if (len > 31) {
do_warning("bad format!"); do_warning_event(event, "bad format!");
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
len = 31; len = 31;
} }
......
...@@ -48,6 +48,12 @@ SUBSYSTEM ...@@ -48,6 +48,12 @@ SUBSYSTEM
'mem':: 'mem'::
Memory access performance. Memory access performance.
'numa'::
NUMA scheduling and MM benchmarks.
'futex'::
Futex stressing benchmarks.
'all':: 'all'::
All benchmark subsystems. All benchmark subsystems.
...@@ -187,6 +193,22 @@ Show only the result with page faults before memset. ...@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
--no-prefault:: --no-prefault::
Show only the result without page faults before memset. Show only the result without page faults before memset.
SUITES FOR 'numa'
~~~~~~~~~~~~~~~~~
*mem*::
Suite for evaluating NUMA workloads.
SUITES FOR 'futex'
~~~~~~~~~~~~~~~~~~
*hash*::
Suite for evaluating hash tables.
*wake*::
Suite for evaluating wake calls.
*requeue*::
Suite for evaluating requeue calls.
SEE ALSO SEE ALSO
-------- --------
linkperf:perf[1] linkperf:perf[1]
...@@ -87,7 +87,6 @@ Default is to monitor all CPUS. ...@@ -87,7 +87,6 @@ Default is to monitor all CPUS.
--realtime=<priority>:: --realtime=<priority>::
Collect data with this RT SCHED_FIFO priority. Collect data with this RT SCHED_FIFO priority.
-s <symbol>::
--sym-annotate=<symbol>:: --sym-annotate=<symbol>::
Annotate this symbol. Annotate this symbol.
......
...@@ -192,13 +192,13 @@ endif ...@@ -192,13 +192,13 @@ endif
export PERL_PATH export PERL_PATH
$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
$(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 $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
$(OUTPUT)util/parse-events-bison.c: util/parse-events.y $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
$(OUTPUT)util/pmu-bison.c: util/pmu.y $(OUTPUT)util/pmu-bison.c: util/pmu.y
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
......
...@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char ...@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
p->data_rand_walk = true; p->data_rand_walk = true;
p->nr_loops = -1; p->nr_loops = -1;
p->init_random = true; p->init_random = true;
p->mb_global_str = "1";
p->nr_proc = 1;
p->nr_threads = 1;
p->nr_secs = 5;
p->run_all = argc == 1; p->run_all = argc == 1;
} }
......
...@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel) ...@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
{ {
memset(evsel->priv, 0, sizeof(struct perf_stat)); int i;
struct perf_stat *ps = evsel->priv;
for (i = 0; i < 3; i++)
init_stats(&ps->res_stats[i]);
} }
static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
{ {
evsel->priv = zalloc(sizeof(struct perf_stat)); evsel->priv = zalloc(sizeof(struct perf_stat));
return evsel->priv == NULL ? -ENOMEM : 0; if (evsel == NULL)
return -ENOMEM;
perf_evsel__reset_stat_priv(evsel);
return 0;
} }
static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
......
...@@ -65,10 +65,9 @@ ifndef NO_LIBELF ...@@ -65,10 +65,9 @@ ifndef NO_LIBELF
ifdef LIBDW_DIR ifdef LIBDW_DIR
LIBDW_CFLAGS := -I$(LIBDW_DIR)/include LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif endif
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif endif
# include ARCH specific config # include ARCH specific config
...@@ -278,6 +277,8 @@ else ...@@ -278,6 +277,8 @@ else
NO_LIBELF := 1 NO_LIBELF := 1
NO_DWARF := 1 NO_DWARF := 1
NO_DEMANGLE := 1 NO_DEMANGLE := 1
NO_LIBUNWIND := 1
NO_LIBDW_DWARF_UNWIND := 1
else else
msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
endif endif
......
...@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore) ...@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore)
if (ret < 0) { if (ret < 0) {
if (!excl_kernel) { if (!excl_kernel) {
excl_kernel = true; excl_kernel = true;
perf_evlist__set_maps(evlist, NULL, NULL);
perf_evlist__delete(evlist); perf_evlist__delete(evlist);
evlist = NULL; evlist = NULL;
continue; continue;
......
...@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg, ...@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
#if _ELFUTILS_PREREQ(0, 142) #if _ELFUTILS_PREREQ(0, 142)
/* Get the call frame information from this dwarf */ /* Get the call frame information from this dwarf */
pf->cfi = dwarf_getcfi(dbg->dbg); pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
#endif #endif
off = 0; off = 0;
...@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno, ...@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno,
void *data) void *data)
{ {
struct line_finder *lf = data; struct line_finder *lf = data;
int err;
if ((strtailcmp(fname, lf->fname) != 0) || if ((strtailcmp(fname, lf->fname) != 0) ||
(lf->lno_s > lineno || lf->lno_e < lineno)) (lf->lno_s > lineno || lf->lno_e < lineno))
return 0; return 0;
if (line_range_add_line(fname, lineno, lf->lr) < 0) err = line_range_add_line(fname, lineno, lf->lr);
return -EINVAL; if (err < 0 && err != -EEXIST)
return err;
return 0; return 0;
} }
...@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) ...@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf)
static int line_range_inline_cb(Dwarf_Die *in_die, void *data) static int line_range_inline_cb(Dwarf_Die *in_die, void *data)
{ {
find_line_range_by_line(in_die, data); int ret = find_line_range_by_line(in_die, data);
/* /*
* We have to check all instances of inlined function, because * We have to check all instances of inlined function, because
* some execution paths can be optimized out depends on the * some execution paths can be optimized out depends on the
* function argument of instances * function argument of instances. However, if an error occurs,
* it should be handled by the caller.
*/ */
return 0; return ret < 0 ? ret : 0;
} }
/* Search function definition from function name */ /* Search function definition from function name */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment