Skip to content

Commit

Permalink
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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()
  • Loading branch information
torvalds committed Oct 22, 2017
2 parents 4f184d7 + 275d34b commit 085cf9b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 10 deletions.
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/Documentation/perf-record.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------
Expand Down
9 changes: 6 additions & 3 deletions tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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}
Expand Down
9 changes: 8 additions & 1 deletion tools/perf/ui/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
17 changes: 15 additions & 2 deletions tools/perf/util/parse-events.l
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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:
*
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/util/xyarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */

0 comments on commit 085cf9b

Please sign in to comment.