mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
perf/urgent fixes:
. The python binding needs to link with libtraceevent and to initialize the 'page_size' variable so that mmaping works again. . The callchain folding character that appears on the TUI just before the overhead had disappeared due to recent changes, add it back. . Intel PEBS in VT-x context uses the DS address as a guest linear address, even though its programmed by the host as a host linear address. This either results in guest memory corruption and or the hardware faulting and 'crashing' the virtual machine. Therefore we have to disable PEBS on VT-x enter and re-enable on VT-x exit, enforcing a strict exclude_guest. Kernel side enforcement fix by Peter Zijlstra, tooling side fix by David Ahern. . Fix build on sparc due to UAPI, fix from David Miller. . Fixes for the srclike sort key for unresolved symbols and when processing samples in JITted code, where we don't have an ELF file, just an special symbol table, fixes from Namhyung Kim. . Fix some leaks in libtraceevent, from Steven Rostedt. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJQfuZQAAoJENZQFvNTUqpAqCAQALDAEmfIfj3MHjlYuf4eO54J sxlyv1U1l0oi6IXE2nqEUJCmh0qtpUT386WkVynqLd4EzklQ2/RP7y1tezqDTx0b o7qoT1CjB064x2TrHqqDbS96kYOyjLoZaIyfNPqSHUQlyq1jeA6gDzmTNqrE6ckO vqW7RbwFoXRHH8YTBfalxY0KQdJd/bBvLS6tKBssiROw2wZ4B3OWRbwqPEPLgu7B 8OrX+cm02/LYvAP63VmlDlAEyIwYSN3KQUG+fAAtjNg2spMYV7ntHHH1GOvzuO5D wEmsY7KrMcWUW/qxhYow0ka1cSTK8QckiS6usDBocAVioPBl2YhnFqPgSzPzqF2M 1iqfdsGwhytLZqrVzD+9MfoHVZaBVPvwtI/iCgdPFIK2RuiBJW36SECeu5jMKynV Teq65Nhkr9A58+5L88pz+Ws89x/TQVINYxWGLeVsN7IVEmg+o90SK6U64+EXRUZ1 hNZ1/4BPw5i/KBDT8jX3qDZradZfA/hZiCyYAfPCk/4AUfak69wRmMDmOcQEo7JP m0mSi850s//ofygf+6Bu1R/usXpJEG9LFuFsIplp+rzHuM2qeHP0ch01Mj/weHjp 7zD1xVpuRxu35o3q+9k9YKp37G+zsyiPmL4zrk0mgmYydempHY1Z6G6ZsboQYCmF oN0iMavg0klkd0gjEXGH =DTM3 -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: * The python binding needs to link with libtraceevent and to initialize the 'page_size' variable so that mmaping works again. * The callchain folding character that appears on the TUI just before the overhead had disappeared due to recent changes, add it back. * Intel PEBS in VT-x context uses the DS address as a guest linear address, even though its programmed by the host as a host linear address. This either results in guest memory corruption and or the hardware faulting and 'crashing' the virtual machine. Therefore we have to disable PEBS on VT-x enter and re-enable on VT-x exit, enforcing a strict exclude_guest. Kernel side enforcement fix by Peter Zijlstra, tooling side fix by David Ahern. * Fix build on sparc due to UAPI, fix from David Miller. * Fixes for the srclike sort key for unresolved symbols and when processing samples in JITted code, where we don't have an ELF file, just an special symbol table, fixes from Namhyung Kim. * Fix some leaks in libtraceevent, from Steven Rostedt. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
a448a0318a
9 changed files with 44 additions and 6 deletions
|
@ -338,6 +338,9 @@ int x86_setup_perfctr(struct perf_event *event)
|
||||||
/* BTS is currently only allowed for user-mode. */
|
/* BTS is currently only allowed for user-mode. */
|
||||||
if (!attr->exclude_kernel)
|
if (!attr->exclude_kernel)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
if (!attr->exclude_guest)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwc->config |= config;
|
hwc->config |= config;
|
||||||
|
@ -380,6 +383,9 @@ int x86_pmu_hw_config(struct perf_event *event)
|
||||||
if (event->attr.precise_ip) {
|
if (event->attr.precise_ip) {
|
||||||
int precise = 0;
|
int precise = 0;
|
||||||
|
|
||||||
|
if (!event->attr.exclude_guest)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
/* Support for constant skid */
|
/* Support for constant skid */
|
||||||
if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
|
if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
|
||||||
precise++;
|
precise++;
|
||||||
|
|
|
@ -2602,6 +2602,9 @@ find_func_handler(struct pevent *pevent, char *func_name)
|
||||||
{
|
{
|
||||||
struct pevent_function_handler *func;
|
struct pevent_function_handler *func;
|
||||||
|
|
||||||
|
if (!pevent)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (func = pevent->func_handlers; func; func = func->next) {
|
for (func = pevent->func_handlers; func; func = func->next) {
|
||||||
if (strcmp(func->name, func_name) == 0)
|
if (strcmp(func->name, func_name) == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -4938,6 +4941,9 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
|
||||||
goto event_alloc_failed;
|
goto event_alloc_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add pevent to event so that it can be referenced */
|
||||||
|
event->pevent = pevent;
|
||||||
|
|
||||||
ret = event_read_format(event);
|
ret = event_read_format(event);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
|
ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
|
||||||
|
@ -5041,9 +5047,6 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf,
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Add pevent to event so that it can be referenced */
|
|
||||||
event->pevent = pevent;
|
|
||||||
|
|
||||||
if (add_event(pevent, event)) {
|
if (add_event(pevent, event)) {
|
||||||
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
|
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
|
||||||
goto event_add_failed;
|
goto event_add_failed;
|
||||||
|
|
|
@ -209,7 +209,16 @@ static void free_arg(struct filter_arg *arg)
|
||||||
switch (arg->type) {
|
switch (arg->type) {
|
||||||
case FILTER_ARG_NONE:
|
case FILTER_ARG_NONE:
|
||||||
case FILTER_ARG_BOOLEAN:
|
case FILTER_ARG_BOOLEAN:
|
||||||
|
break;
|
||||||
|
|
||||||
case FILTER_ARG_NUM:
|
case FILTER_ARG_NUM:
|
||||||
|
free_arg(arg->num.left);
|
||||||
|
free_arg(arg->num.right);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FILTER_ARG_EXP:
|
||||||
|
free_arg(arg->exp.left);
|
||||||
|
free_arg(arg->exp.right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILTER_ARG_STR:
|
case FILTER_ARG_STR:
|
||||||
|
@ -218,6 +227,12 @@ static void free_arg(struct filter_arg *arg)
|
||||||
free(arg->str.buffer);
|
free(arg->str.buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FILTER_ARG_VALUE:
|
||||||
|
if (arg->value.type == FILTER_STRING ||
|
||||||
|
arg->value.type == FILTER_CHAR)
|
||||||
|
free(arg->value.str);
|
||||||
|
break;
|
||||||
|
|
||||||
case FILTER_ARG_OP:
|
case FILTER_ARG_OP:
|
||||||
free_arg(arg->op.left);
|
free_arg(arg->op.left);
|
||||||
free_arg(arg->op.right);
|
free_arg(arg->op.right);
|
||||||
|
|
|
@ -57,7 +57,7 @@ void get_term_dimensions(struct winsize *ws);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __sparc__
|
#ifdef __sparc__
|
||||||
#include "../../arch/sparc/include/asm/unistd.h"
|
#include "../../arch/sparc/include/uapi/asm/unistd.h"
|
||||||
#define rmb() asm volatile("":::"memory")
|
#define rmb() asm volatile("":::"memory")
|
||||||
#define cpu_relax() asm volatile("":::"memory")
|
#define cpu_relax() asm volatile("":::"memory")
|
||||||
#define CPUINFO_PROC "cpu"
|
#define CPUINFO_PROC "cpu"
|
||||||
|
|
|
@ -610,6 +610,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
|
||||||
char folded_sign = ' ';
|
char folded_sign = ' ';
|
||||||
bool current_entry = ui_browser__is_current_entry(&browser->b, row);
|
bool current_entry = ui_browser__is_current_entry(&browser->b, row);
|
||||||
off_t row_offset = entry->row_offset;
|
off_t row_offset = entry->row_offset;
|
||||||
|
bool first = true;
|
||||||
|
|
||||||
if (current_entry) {
|
if (current_entry) {
|
||||||
browser->he_selection = entry;
|
browser->he_selection = entry;
|
||||||
|
@ -633,10 +634,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
|
||||||
if (!perf_hpp__format[i].cond)
|
if (!perf_hpp__format[i].cond)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i) {
|
if (!first) {
|
||||||
slsmg_printf(" ");
|
slsmg_printf(" ");
|
||||||
width -= 2;
|
width -= 2;
|
||||||
}
|
}
|
||||||
|
first = false;
|
||||||
|
|
||||||
if (perf_hpp__format[i].color) {
|
if (perf_hpp__format[i].color) {
|
||||||
hpp.ptr = &percent;
|
hpp.ptr = &percent;
|
||||||
|
@ -645,7 +647,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
|
||||||
|
|
||||||
ui_browser__set_percent_color(&browser->b, percent, current_entry);
|
ui_browser__set_percent_color(&browser->b, percent, current_entry);
|
||||||
|
|
||||||
if (i == 0 && symbol_conf.use_callchain) {
|
if (i == PERF_HPP__OVERHEAD && symbol_conf.use_callchain) {
|
||||||
slsmg_printf("%c ", folded_sign);
|
slsmg_printf("%c ", folded_sign);
|
||||||
width -= 2;
|
width -= 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -690,6 +690,9 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
|
||||||
eH = 0;
|
eH = 0;
|
||||||
} else if (*str == 'p') {
|
} else if (*str == 'p') {
|
||||||
precise++;
|
precise++;
|
||||||
|
/* use of precise requires exclude_guest */
|
||||||
|
if (!exclude_GH)
|
||||||
|
eG = 1;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1015,6 +1015,8 @@ PyMODINIT_FUNC initperf(void)
|
||||||
pyrf_cpu_map__setup_types() < 0)
|
pyrf_cpu_map__setup_types() < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
|
||||||
Py_INCREF(&pyrf_evlist__type);
|
Py_INCREF(&pyrf_evlist__type);
|
||||||
PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type);
|
PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ perf = Extension('perf',
|
||||||
sources = ext_sources,
|
sources = ext_sources,
|
||||||
include_dirs = ['util/include'],
|
include_dirs = ['util/include'],
|
||||||
extra_compile_args = cflags,
|
extra_compile_args = cflags,
|
||||||
|
extra_objects = [build_tmp + '/../../libtraceevent.a'],
|
||||||
)
|
)
|
||||||
|
|
||||||
setup(name='perf',
|
setup(name='perf',
|
||||||
|
|
|
@ -260,6 +260,12 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
goto out_path;
|
goto out_path;
|
||||||
|
|
||||||
|
if (!self->ms.map)
|
||||||
|
goto out_ip;
|
||||||
|
|
||||||
|
if (!strncmp(self->ms.map->dso->long_name, "/tmp/perf-", 10))
|
||||||
|
goto out_ip;
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
|
snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
|
||||||
self->ms.map->dso->long_name, self->ip);
|
self->ms.map->dso->long_name, self->ip);
|
||||||
fp = popen(cmd, "r");
|
fp = popen(cmd, "r");
|
||||||
|
|
Loading…
Reference in a new issue