From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762970AbZLPTTy (ORCPT ); Wed, 16 Dec 2009 14:19:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S935273AbZLPTTx (ORCPT ); Wed, 16 Dec 2009 14:19:53 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:36978 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760928AbZLPTTt (ORCPT ); Wed, 16 Dec 2009 14:19:49 -0500 Date: Wed, 16 Dec 2009 20:18:58 +0100 From: Ingo Molnar To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Paul Mackerras , Andrew Morton , Thomas Gleixner Subject: [RFC GIT PULL] perf updates/fixes Message-ID: <20091216191858.GA8554@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: 0.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=0.0 required=5.9 tests=none autolearn=no SpamAssassin version=3.2.5 _SUMMARY_ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 64a53f7..5fcbf7d 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -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; }; /* diff --git a/kernel/perf_event.c b/kernel/perf_event.c index d891ec4..2e0aaa3 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -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)) diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt new file mode 100644 index 0000000..8974e20 --- /dev/null +++ b/tools/perf/Documentation/perf-diff.txt @@ -0,0 +1,55 @@ +perf-diff(1) +============== + +NAME +---- +perf-diff - Read two perf.data files and display the differential profile + +SYNOPSIS +-------- +[verse] +'perf diff' [oldfile] [newfile] + +DESCRIPTION +----------- +This command displays the performance difference amongst two perf.data files +captured via perf record. + +If no parameters are passed it will assume perf.data.old and perf.data. + +OPTIONS +------- +-d:: +--dsos=:: + Only consider symbols in these dsos. CSV that understands + file://filename entries. + +-C:: +--comms=:: + Only consider symbols in these comms. CSV that understands + file://filename entries. + +-S:: +--symbols=:: + Only consider these symbols. CSV that understands + file://filename entries. + +-s:: +--sort=:: + Sort by key(s): pid, comm, dso, symbol. + +-t:: +--field-separator=:: + + Use a special separator character and don't pad with spaces, replacing + all occurances of this separator in symbol names (and other output) + with a '.' character, that thus it's the only non valid separator. + +-v:: +--verbose:: + Be verbose, for instance, show the raw counts in addition to the + diff. + +SEE ALSO +-------- +linkperf:perf-record[1] diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index 8fa6bf9..250e391 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt @@ -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). diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 9dccb18..abfabe9 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt @@ -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 diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt index 07065ef..60e5900 100644 --- a/tools/perf/Documentation/perf-trace.txt +++ b/tools/perf/Documentation/perf-trace.txt @@ -8,18 +8,43 @@ perf-trace - Read perf.data (created by perf record) and display trace output SYNOPSIS -------- [verse] -'perf trace' [-i | --input=file] symbol_name +'perf trace' {record