perf fixes for 4.14
Linus,
please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
A series of fixes for perf tooling:
- Make xyarray return the X/Y size correctly which fixes a crash in the exit code.
- Fix the libc path in test so it works not only on Debian/Ubuntu correctly
- Check for eBPF file existance and output a useful error message instead of failing to compile a non existant file
- Make sure perf_hpp_fmt is not longer references before freeing it
- Use list_del_init() in the histogram code to prevent a crash when the already deleted element is deleted again
- Remove the leftovers of the removed '-l' option
- Add reviewer entries to the MAINTAINERS file
Thanks,
tglx
------------------>
Arnaldo Carvalho de Melo (1):
perf tools: Add long time reviewers to MAINTAINERS
Jin Yao (1):
perf xyarray: Fix wrong processing when closing evsel fd
Jiri Olsa (3):
perf hists: Fix crash in perf_hpp__reset_output_field() perf hists: Add extra integrity checks to fmt_free() perf tools: Check wether the eBPF file exists in event parsing
Li Zhijian (1):
perf test shell trace+probe_libc_inet_pton.sh: Be compatible with Debian/Ubuntu
Namhyung Kim (1):
perf buildid-list: Fix crash when processing PERF_RECORD_NAMESPACE
Taeung Song (1):
perf record: Fix documentation for a inexistent option '-l'
MAINTAINERS | 2 ++ tools/perf/Documentation/perf-record.txt | 4 ++-- tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 9 ++++++--- tools/perf/ui/hist.c | 9 ++++++++- tools/perf/util/parse-events.l | 17 +++++++++++++++-- tools/perf/util/session.c | 2 ++ tools/perf/util/xyarray.h | 4 ++-- 7 files changed, 37 insertions(+), 10 deletions(-)
MAINTAINERS +2 -0
@@ -10560,6 +10560,8 @@ M: Peter Zijlstra <[email protected]> M: Ingo Molnar <[email protected]> M: Arnaldo Carvalho de Melo <[email protected]> R: Alexander Shishkin <[email protected]> +R: Jiri Olsa <[email protected]> +R: Namhyung Kim <[email protected]> L: [email protected] T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core S: Supported
tools/perf/Documentation/perf-record.txt +2 -2
@@ -8,8 +8,8 @@ perf-record - Run a command and record its profile into perf.data SYNOPSIS -------- [verse] -'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command> -'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>] +'perf record' [-e <EVENT> | --event=EVENT] [-a] <command> +'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>] DESCRIPTION -----------
tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +6 -3
@@ -10,6 +10,9 @@ . $(dirname $0)/lib/probe.sh +ld=$(realpath /lib64/ld*.so.* | uniq) +libc=$(echo $ld | sed 's/ld/libc/g') + trace_libc_inet_pton_backtrace() { idx=0 expected[0]="PING.*bytes"
@@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() { expected[3]=".*packets transmitted.*" expected[4]="rtt min.*" expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" - expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" - expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" + expected[6]=".*inet_pton[[:space:]]\($libc\)$" + expected[7]="getaddrinfo[[:space:]]\($libc\)$" expected[8]=".*\(.*/bin/ping.*\)$" perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do
@@ -35,7 +38,7 @@ trace_libc_inet_pton_backtrace() { } skip_if_no_perf_probe && \ -perf probe -q /lib64/libc-*.so inet_pton && \ +perf probe -q $libc inet_pton && \ trace_libc_inet_pton_backtrace err=$? rm -f ${file}
tools/perf/ui/hist.c +8 -1
@@ -532,7 +532,7 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list,void perf_hpp__column_unregister (struct perf_hpp_fmt *format) { -list_del (&format->list); +list_del_init (&format->list); }void perf_hpp__cancel_cumulate (void )
@@ -606,6 +606,13 @@ void perf_hpp__append_sort_keys(struct perf_hpp_list *list)static void fmt_free (struct perf_hpp_fmt *fmt) { +/* +* At this point fmt should be completely +* unhooked, if not it's a bug. +*/ +BUG_ON (!list_empty (&fmt->list)); +BUG_ON (!list_empty (&fmt->sort_list)); +if (fmt->free) fmt->free (fmt); }
tools/perf/util/parse-events.l +15 -2
@@ -8,6 +8,9 @@ %{ #include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "../perf.h" #include "parse-events.h" #include "parse-events-bison.h"
@@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token) return token; } -static bool isbpf(yyscan_t scanner) +static bool isbpf_suffix(char *text) { - char *text = parse_events_get_text(scanner); int len = strlen(text); if (len < 2)
@@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner) return false; } +static bool isbpf(yyscan_t scanner) +{ + char *text = parse_events_get_text(scanner); + struct stat st; + + if (!isbpf_suffix(text)) + return false; + + return stat(text, &st) == 0; +} + /* * This function is called when the parser gets two kind of input: *
tools/perf/util/session.c +2 -0
@@ -374,6 +374,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) tool->mmap2 = process_event_stub;if (tool->comm ==NULL ) tool->comm = process_event_stub; +if (tool->namespaces ==NULL ) + tool->namespaces = process_event_stub;if (tool->fork ==NULL ) tool->fork = process_event_stub;if (tool->exit ==NULL )
tools/perf/util/xyarray.h +2 -2
@@ -23,12 +23,12 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y)static inline int xyarray__max_y (struct xyarray *xy) { -return xy->max_x; +return xy->max_y; }static inline int xyarray__max_x (struct xyarray *xy) { -return xy->max_y; +return xy->max_x; }#endif /* _PERF_XYARRAY_H_ */