Skip to contentSkip to conversation

perf updates/fixes

GIT PULL Ingo Molnar 1 participant 1 message Dec 16, 2009 perf events

lore
Share & tools
lore
#0 lore raw

Linus,

Please consider pulling the latest perf-fixes-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus

I marked it RFC because it includes a fair amount of last-minute activity:

- performance fixes for inherited recording on lots of CPUs

- usability fixes and enhancements to perf probe

- fixes to the perf trace scripting engine

- new 'perf diff' tool - compares the profiles of the last two "perf record -f" sessions

95% of the changes are to tools/perf/, not to the kernel itself.

The reason we'd like this to happen still in this cycle is that 'perf diff' is both tempting from a feature POV and wide from a patch surface POV. (ok, i'll admit the former reason weighs more heavily for me :-/ )

It has passed the regular cross-build and x86 runtime tests we do.

Thanks,

Ingo

------------------>
Arnaldo Carvalho de Melo (25):
perf session: Pass the perf_session to the event handling operations perf session: Ditch register_perf_file_handler
perf session: Register the idle thread in perf_session__process_events perf session: Reduce the number of parms to perf_session__process_events perf session: Move the global threads list to perf_session
perf session: Move kmaps to perf_session
perf tools: No need for three rb_trees for sorting hist entries perf session: Move the hist_entries rb tree to perf_session
perf session: Adopt resolve_callchain
perf session: Adopt the sample_type variable
perf session: Event statistics also are per session
perf util: Remove setup_sorting dups
perf record: Rename perf.data to perf.data.old if --force/-f is used perf diff: Introduce tool to show performance difference
perf diff: Fix documentation
perf symbols: Make symbol_conf global
perf symbols: Adopt the strlists for dso, comm
perf symbols: Move symbol filtering to event__preprocess_sample() perf report: Generalize perf_session__fprintf_hists()
perf tools: Move hist entries printing routines from perf report perf session: Move perf report specific hits out of perf_session__fprintf_hists perf report: Fix cut'n'paste error recently introduced
perf diff: Use perf_session__fprintf_hists just like 'perf record' perf diff: Change the default sort order to "dso,symbol"
perf diff: Percent calcs should use double values

Frederic Weisbecker (1):
perf tools: Make symbol_conf static

Ingo Molnar (1):
perf diff: Improve the help text

Masami Hiramatsu (14):
perf probe: Cleanup struct session in builtin-probe.c perf probe: Check the result of e_snprintf()
perf probe: Check hyphen only argument
perf probe: Show need-dwarf message only if it is really needed perf probe: Fix --del to show info instead of warning perf probe: Fix --del to update current event list perf tools: Add for_each macros for strlist
perf probe: Use strlist__for_each macros in probe-event.c perf probe: Add glob matching support on --del
perf probe: Support event name for --add option
perf probe: Reject second attempt of adding same-name event perf probe: Check build-id of vmlinux
perf probe: Check symbols in symtab/kallsyms
perf probe: Fix to show which probe point is not found

Paul Mackerras (1):
perf_event: Fix incorrect range check on cpu number

Peter Zijlstra (4):
perf_events: Fix perf_event_attr layout
perf events: Allow per-task-per-cpu counters
perf record: Properly synchronize child creation perf record: Use per-task-per-cpu events for inherited events

Tom Zanussi (6):
perf trace/scripting: Add support for script args perf trace/scripting: Don't install unneeded files perf trace/scripting: Check return val of perl_run() perf trace/scripting: List available scripts perf trace/scripting: Add 'record' and 'report' options perf trace/scripting: Update Documentation

 include/linux/perf_event.h                         |   12 +-
 kernel/perf_event.c                                |   15 +-
 tools/perf/Documentation/perf-diff.txt             |   55 ++
 tools/perf/Documentation/perf-probe.txt            |    3 +-
 tools/perf/Documentation/perf-report.txt           |    4 +
 tools/perf/Documentation/perf-trace.txt            |   27 +-
 tools/perf/Makefile                                |    4 +-
 tools/perf/builtin-annotate.c                      |   66 +--
 tools/perf/builtin-buildid-list.c                  |    4 +-
 tools/perf/builtin-diff.c                          |  248 +++++++
 tools/perf/builtin-kmem.c                          |   64 +-
 tools/perf/builtin-probe.c                         |  141 +++--
 tools/perf/builtin-record.c                        |  141 +++--
 tools/perf/builtin-report.c                        |  723 ++------------------
 tools/perf/builtin-sched.c                         |   93 ++--
 tools/perf/builtin-timechart.c                     |   59 +-
 tools/perf/builtin-top.c                           |   45 +-
 tools/perf/builtin-trace.c                         |  349 +++++++++--
 tools/perf/builtin.h                               |    1 +
 tools/perf/command-list.txt                        |    1 +
 tools/perf/perf.c                                  |    1 +
 .../perf/scripts/perl/bin/check-perf-trace-report  |    1 +
 tools/perf/scripts/perl/bin/rw-by-file-report      |    4 +-
 tools/perf/scripts/perl/bin/rw-by-pid-report       |    1 +
 tools/perf/scripts/perl/bin/wakeup-latency-report  |    1 +
 tools/perf/scripts/perl/bin/workqueue-stats-report |    1 +
 tools/perf/scripts/perl/rw-by-file.pl              |    5 +-
 tools/perf/util/data_map.c                         |   96 ++--
 tools/perf/util/data_map.h                         |   29 -
 tools/perf/util/event.c                            |  142 +++-
 tools/perf/util/event.h                            |   36 +-
 tools/perf/util/header.c                           |    2 +-
 tools/perf/util/hist.c                             |  518 +++++++++++++-
 tools/perf/util/hist.h                             |   55 +--
 tools/perf/util/map.c                              |   18 +-
 tools/perf/util/probe-event.c                      |  207 ++++--
 tools/perf/util/probe-event.h                      |   11 +-
 tools/perf/util/probe-finder.c                     |    4 +-
 tools/perf/util/probe-finder.h                     |    3 +
 tools/perf/util/session.c                          |   84 +++-
 tools/perf/util/session.h                          |   45 ++
 tools/perf/util/sort.c                             |   26 +
 tools/perf/util/sort.h                             |   12 +-
 tools/perf/util/string.c                           |   25 +
 tools/perf/util/string.h                           |    2 +
 tools/perf/util/strlist.c                          |    6 +-
 tools/perf/util/strlist.h                          |   41 ++-
 tools/perf/util/symbol.c                           |  144 +++--
 tools/perf/util/symbol.h                           |   34 +-
 tools/perf/util/thread.c                           |   37 +-
 tools/perf/util/thread.h                           |   16 +-
 tools/perf/util/trace-event-perl.c                 |   42 +-
 tools/perf/util/trace-event.h                      |    2 +-
 53 files changed, 2293 insertions(+), 1413 deletions(-)
 create mode 100644 tools/perf/Documentation/perf-diff.txt
 create mode 100644 tools/perf/builtin-diff.c
 delete mode 100644 tools/perf/util/data_map.h
include/linux/perf_event.h +3 -9
index 64a53f7..5fcbf7d 100644
@@ -211,17 +211,11 @@ struct perf_event_attr {
 		__u32		wakeup_watermark; /* bytes before wakeup   */
 	};
 
-	struct { /* Hardware breakpoint info */
-		__u64		bp_addr;
-		__u32		bp_type;
-		__u32		bp_len;
-		__u64		__bp_reserved_1;
-		__u64		__bp_reserved_2;
-	};
-
 	__u32			__reserved_2;
 
-	__u64			__reserved_3;
+	__u64			bp_addr;
+	__u32			bp_type;
+	__u32			bp_len;
 };
 
 /*
kernel/perf_event.c +9 -6
index d891ec4..2e0aaa3 100644
@@ -782,6 +782,9 @@ static void __perf_install_in_context(void *info)
 
 	add_event_to_ctx(event, ctx);
 
+	if (event->cpu != -1 && event->cpu != smp_processor_id())
+		goto unlock;
+
 	/*
 	 * Don't put the event on if it is disabled or if
 	 * it is in a group and the group isn't on.
@@ -925,6 +928,9 @@ static void __perf_event_enable(void *info)
 		goto unlock;
 	__perf_event_mark_enabled(event, ctx);
 
+	if (event->cpu != -1 && event->cpu != smp_processor_id())
+		goto unlock;
+
 	/*
 	 * If the event is in a group and isn't the group leader,
 	 * then don't put it on unless the group is on.
@@ -1595,15 +1601,12 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
 	unsigned long flags;
 	int err;
 
-	/*
-	 * If cpu is not a wildcard then this is a percpu event:
-	 */
-	if (cpu != -1) {
+	if (pid == -1 && cpu != -1) {
 		/* Must be root to operate on a CPU event: */
 		if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
 			return ERR_PTR(-EACCES);
 
-		if (cpu < 0 || cpu > num_possible_cpus())
+		if (cpu < 0 || cpu >= nr_cpumask_bits)
 			return ERR_PTR(-EINVAL);
 
 		/*
@@ -4564,7 +4567,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
 	if (attr->type >= PERF_TYPE_MAX)
 		return -EINVAL;
 
-	if (attr->__reserved_1 || attr->__reserved_2 || attr->__reserved_3)
+	if (attr->__reserved_1 || attr->__reserved_2)
 		return -EINVAL;
 
 	if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))
tools/perf/Documentation/perf-diff.txt new file +55 -0

55 lines not on this page · raw message

tools/perf/Documentation/perf-probe.txt +2 -1
index 8fa6bf9..250e391 100644
@@ -49,8 +49,9 @@ PROBE SYNTAX
 ------------
 Probe points are defined by following syntax.
 
- "FUNC[+OFFS|:RLN|%return][@SRC]|SRC:ALN [ARG ...]"
+ "[EVENT=]FUNC[+OFFS|:RLN|%return][@SRC]|SRC:ALN [ARG ...]"
 
+'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. Currently, event group name is set as 'probe'.
 'FUNC' specifies a probed function name, and it may have one of the following options; '+OFFS' is the offset from function entry address in bytes, 'RLN' is the relative-line number from function entry line, and '%return' means that it probes function return. In addition, 'SRC' specifies a source file which has that function.
 It is also possible to specify a probe point by the source line number by using 'SRC:ALN' syntax, where 'SRC' is the source file path and 'ALN' is the line number.
 'ARG' specifies the arguments of this probe point. You can use the name of local variable, or kprobe-tracer argument format (e.g. $retval, %ax, etc).
tools/perf/Documentation/perf-report.txt +4 -0
index 9dccb18..abfabe9 100644
@@ -39,6 +39,10 @@ OPTIONS
 	Only consider these symbols. CSV that understands
 	file://filename entries.
 
+-s::
+--sort=::
+	Sort by key(s): pid, comm, dso, symbol, parent.
+
 -w::
 --field-width=::
 	Force each column width to the provided list, for large terminal
tools/perf/Documentation/perf-trace.txt +26 -1
index 07065ef..60e5900 100644
@@ -8,18 +8,43 @@ perf-trace - Read perf.data (created by perf record) and display trace output
 SYNOPSIS
 --------
 [verse]
-'perf trace' [-i <file> | --input=file] symbol_name
+'perf trace' {record <script> | report <script> [args] }
 
 DESCRIPTION
 -----------
 This command reads the input file and displays the trace recorded.
 
+There are several variants of perf trace:
+
+  'perf trace' to see a detailed trace of the workload that was
+  recorded.
+
+  'perf trace record <script>' to record the events required for 'perf
+  trace report'.  <script> is the name displayed in the output of
+  'perf trace --list' i.e. the actual script name minus any language
+  extension.
+
+  'perf trace report <script>' to run and display the results of
+  <script>.  <script> is the name displayed in the output of 'perf
+  trace --list' i.e. the actual script name minus any language
+  extension.  The perf.data output from a previous run of 'perf trace
+  record <script>' is used and should be present for this command to
+  succeed.
+
 OPTIONS
 -------
 -D::
 --dump-raw-trace=::
         Display verbose dump of the trace data.
 
+-L::
+--Latency=::
+        Show latency attributes (irqs/preemption disabled, etc).
+
+-l::
+--list=::
+        Display a list of available trace scripts.
+
 -s::
 --script=::
         Process trace data with the given script ([lang]:script[.ext]).
tools/perf/Makefile +1 -3
index 4069996..7814dbb 100644
@@ -370,7 +370,6 @@ LIB_H += util/values.h
 LIB_H += util/sort.h
 LIB_H += util/hist.h
 LIB_H += util/thread.h
-LIB_H += util/data_map.h
 LIB_H += util/probe-finder.h
 LIB_H += util/probe-event.h
 
@@ -428,6 +427,7 @@ BUILTIN_OBJS += bench/sched-messaging.o
 BUILTIN_OBJS += bench/sched-pipe.o
 BUILTIN_OBJS += bench/mem-memcpy.o
 
+BUILTIN_OBJS += builtin-diff.o
 BUILTIN_OBJS += builtin-help.o
 BUILTIN_OBJS += builtin-sched.o
 BUILTIN_OBJS += builtin-buildid-list.o
@@ -996,8 +996,6 @@ install: all
 	$(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
 	$(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
 	$(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
-	$(INSTALL) scripts/perl/Perf-Trace-Util/Makefile.PL -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util'
-	$(INSTALL) scripts/perl/Perf-Trace-Util/README -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util'
 ifdef BUILT_INS
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
tools/perf/builtin-annotate.c +23 -43

150 lines not on this page · raw message

tools/perf/builtin-buildid-list.c +2 -2
index bfd16a1..e693e67 100644
@@ -9,7 +9,6 @@
 #include "builtin.h"
 #include "perf.h"
 #include "util/cache.h"
-#include "util/data_map.h"
 #include "util/debug.h"
 #include "util/parse-options.h"
 #include "util/session.h"
@@ -55,8 +54,9 @@ static int perf_file_section__process_buildids(struct perf_file_section *self,
 static int __cmd_buildid_list(void)
 {
 	int err = -1;
-	struct perf_session *session = perf_session__new(input_name, O_RDONLY, force);
+	struct perf_session *session;
 
+	session = perf_session__new(input_name, O_RDONLY, force);
 	if (session == NULL)
 		return -1;
 
tools/perf/builtin-diff.c new file +248 -0

248 lines not on this page · raw message

tools/perf/builtin-kmem.c +26 -38

152 lines not on this page · raw message

tools/perf/builtin-probe.c +78 -63

238 lines not on this page · raw message

tools/perf/builtin-record.c +93 -48

202 lines not on this page · raw message

tools/perf/builtin-report.c +59 -664

906 lines not on this page · raw message

tools/perf/builtin-sched.c +50 -43

326 lines not on this page · raw message

tools/perf/builtin-timechart.c +24 -35

168 lines not on this page · raw message

tools/perf/builtin-top.c +27 -18

132 lines not on this page · raw message

tools/perf/builtin-trace.c +306 -43

257 lines not on this page · raw message

tools/perf/builtin.h +1 -0
index a3d8bf6..18035b1 100644

Lines of this file are not shown. View the raw message.

tools/perf/command-list.txt +1 -0
index 02b09ea..71dc7c3 100644

Lines of this file are not shown. View the raw message.

tools/perf/perf.c +1 -0
index cf64049..873e55f 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/bin/check-perf-trace-report +1 -0
index 89948b0..7fc4a03 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/bin/rw-by-file-report +3 -1
index f5dcf9c..eddb9cc 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/bin/rw-by-pid-report +1 -0
index cea16f7..7f44c25 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/bin/wakeup-latency-report +1 -0
index 85769dc..fce3adc 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/bin/workqueue-stats-report +1 -0
index aa68435..71cfbd1 100644

Lines of this file are not shown. View the raw message.

tools/perf/scripts/perl/rw-by-file.pl +3 -2
index 61f9156..2a39097 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/data_map.c +53 -43

96 lines not on this page · raw message

tools/perf/util/data_map.h deleted +0 -29
deleted file mode 100644
index 98c5b82..0000000

Lines of this file are not shown. View the raw message.

tools/perf/util/event.c +109 -33

142 lines not on this page · raw message

tools/perf/util/event.h +21 -15
index 51a96c2..8027309 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/header.c +1 -1
index f2e8d87..8a0bca5 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/hist.c +489 -29

518 lines not on this page · raw message

tools/perf/util/hist.h +16 -39

55 lines not on this page · raw message

tools/perf/util/map.c +12 -6
index 76bdca6..c4d55a0 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/probe-event.c +141 -66

207 lines not on this page · raw message

tools/perf/util/probe-event.h +7 -4
index f752159..7f1d499 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/probe-finder.c +1 -3
index 4585f1d..4b852c0 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/probe-finder.h +3 -0
index bdebca6..5e4050c 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/session.c +77 -7

84 lines not on this page · raw message

tools/perf/util/session.h +45 -0

45 lines not on this page · raw message

tools/perf/util/sort.c +26 -0
index b490354..cb0f327 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/sort.h +10 -2
index 333e664..753f9ea 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/string.c +25 -0
index f24a8cc..5352d7d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/string.h +2 -0
index bfecec2..02ede58 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/strlist.c +3 -3
index 7ad3817..6783a20 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/strlist.h +40 -1

41 lines not on this page · raw message

tools/perf/util/symbol.c +87 -57

144 lines not on this page · raw message

tools/perf/util/symbol.h +24 -10
index cf99f88..8aded23 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/thread.c +12 -25
index b68a00e..4a08dcf 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/thread.h +8 -8
index 1751802..c206f72 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/trace-event-perl.c +31 -11

42 lines not on this page · raw message

tools/perf/util/trace-event.h +1 -1
index 81698d5..6ad4056 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.