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

Pull perf fixes from Thomas Gleixner:
 "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"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf test shell trace+probe_libc_inet_pton.sh: Be compatible with Debian/Ubuntu
  perf xyarray: Fix wrong processing when closing evsel fd
  perf buildid-list: Fix crash when processing PERF_RECORD_NAMESPACE
  perf record: Fix documentation for a inexistent option '-l'
  perf tools: Add long time reviewers to MAINTAINERS
  perf tools: Check wether the eBPF file exists in event parsing
  perf hists: Add extra integrity checks to fmt_free()
  perf hists: Fix crash in perf_hpp__reset_output_field()
This commit is contained in:
Linus Torvalds 2017-10-22 06:52:53 -04:00
commit 085cf9bfc9
7 changed files with 37 additions and 10 deletions

View File

@ -10560,6 +10560,8 @@ M: Peter Zijlstra <peterz@infradead.org>
M: Ingo Molnar <mingo@redhat.com> M: Ingo Molnar <mingo@redhat.com>
M: Arnaldo Carvalho de Melo <acme@kernel.org> M: Arnaldo Carvalho de Melo <acme@kernel.org>
R: Alexander Shishkin <alexander.shishkin@linux.intel.com> R: Alexander Shishkin <alexander.shishkin@linux.intel.com>
R: Jiri Olsa <jolsa@redhat.com>
R: Namhyung Kim <namhyung@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

View File

@ -8,8 +8,8 @@ perf-record - Run a command and record its profile into perf.data
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command> 'perf record' [-e <EVENT> | --event=EVENT] [-a] <command>
'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>] 'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -10,6 +10,9 @@
. $(dirname $0)/lib/probe.sh . $(dirname $0)/lib/probe.sh
ld=$(realpath /lib64/ld*.so.* | uniq)
libc=$(echo $ld | sed 's/ld/libc/g')
trace_libc_inet_pton_backtrace() { trace_libc_inet_pton_backtrace() {
idx=0 idx=0
expected[0]="PING.*bytes" expected[0]="PING.*bytes"
@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() {
expected[3]=".*packets transmitted.*" expected[3]=".*packets transmitted.*"
expected[4]="rtt min.*" expected[4]="rtt min.*"
expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" 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[6]=".*inet_pton[[:space:]]\($libc\)$"
expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" expected[7]="getaddrinfo[[:space:]]\($libc\)$"
expected[8]=".*\(.*/bin/ping.*\)$" 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 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 && \ skip_if_no_perf_probe && \
perf probe -q /lib64/libc-*.so inet_pton && \ perf probe -q $libc inet_pton && \
trace_libc_inet_pton_backtrace trace_libc_inet_pton_backtrace
err=$? err=$?
rm -f ${file} rm -f ${file}

View File

@ -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) 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) 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) 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) if (fmt->free)
fmt->free(fmt); fmt->free(fmt);
} }

View File

@ -8,6 +8,9 @@
%{ %{
#include <errno.h> #include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../perf.h" #include "../perf.h"
#include "parse-events.h" #include "parse-events.h"
#include "parse-events-bison.h" #include "parse-events-bison.h"
@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token)
return 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); int len = strlen(text);
if (len < 2) if (len < 2)
@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner)
return false; 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: * This function is called when the parser gets two kind of input:
* *

View File

@ -374,6 +374,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
tool->mmap2 = process_event_stub; tool->mmap2 = process_event_stub;
if (tool->comm == NULL) if (tool->comm == NULL)
tool->comm = process_event_stub; tool->comm = process_event_stub;
if (tool->namespaces == NULL)
tool->namespaces = process_event_stub;
if (tool->fork == NULL) if (tool->fork == NULL)
tool->fork = process_event_stub; tool->fork = process_event_stub;
if (tool->exit == NULL) if (tool->exit == NULL)

View File

@ -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) 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) static inline int xyarray__max_x(struct xyarray *xy)
{ {
return xy->max_y; return xy->max_x;
} }
#endif /* _PERF_XYARRAY_H_ */ #endif /* _PERF_XYARRAY_H_ */