Skip to contentSkip to conversation

perf changes

GIT PULL Ingo Molnar 6 participants 8 messages May 24, 2010 – May 28, 2010

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest perf-core-for-linus git tree from:

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

Most of these changes are fixes and dead code removal, but also a set of optimizations and a series of tracing size-optimization bits that we kept pending because they conflicted with the previous push - and some TUI enhancements.

Thanks,

Ingo

------------------>
Akinobu Mita (1):
x86/mmiotrace: Remove redundant instruction prefix checks

Arnaldo Carvalho de Melo (15):
perf tui: Fix build problem with slang <= 2.0.6
perf tools: Remove some unused functions
perf probe: Fix some error exit paths
perf probe: Don't call die()
perf tools: remove xstrndup, xmalloc, xzalloc
perf symbols: Don't try to read the build-id twice
perf session: Make read_build_id routines look at the host_machine too perf TUI: Make 'space' be an alias to 'PgDn'
perf annotate: Use build-ids to find the right DSO
perf tui: Allow disabling the TUI on a per command basis in ~/.perfconfig perf report: Don't start the TUI if -D is used
perf tui: Remove annotate from popup menu after failure
perf annotate: Add TUI interface
perf annotate: Fix up usage of the build id cache
perf report: Support multiple events on the TUI

Cyrill Gorcunov (5):
perf, x86: P4 PMU -- handle unflagged events
perf, x86: P4 PMU -- fix typo in unflagged NMI handling perf, x86: P4 PMU -- do a real check for ESCR address being in hash perf, x86: P4_pmu_schedule_events -- use smp_processor_id instead of raw_ perf, x86: P4 PMU -- add missing bit in CCCR mask

Frederic Weisbecker (4):
perf: Comply with new rcu checks API
perf: Fix unaligned accesses while fetching trace values
perf: Fix forgotten preempt_enable by nested writers
perf: Fix getline undeclared

Li Zefan (1):
tracing: Fix function declarations if !CONFIG_STACKTRACE

Lin Ming (1):
perf, sparc: Implement group scheduling transactional APIs

Masami Hiramatsu (1):
perf probe: Don't compile CFI related code if elfutils is old

Mathieu Desnoyers (1):
tracepoints: Add check trace callback type

Peter Zijlstra (16):
perf/ftrace: Optimize perf/tracepoint interaction for single events
perf: Optimize buffer placement by allocating buffers NUMA aware
perf: Disallow mmap() on per-task inherited events
perf: Optimize the perf_output() path by removing IRQ-disables
perf: Optimize the hotpath by converting the perf output buffer to local_t
perf: Optimize perf_output_*() by avoiding local_xchg()
perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction perf, trace: Optimize tracepoints by using per-tracepoint-per-cpu hlist to track events
perf: Ensure that IOC_OUTPUT isn't used to create multi-writer buffers
perf-record: Remove -M
perf-record: Share per-cpu buffers
perf: Fix wakeup storm for RO mmap()s
perf: Optimize perf_output_copy()
perf: Optimize the !vmalloc backed buffer
perf: Remove more code from the fastpath
perf: Optimize perf_tp_event_match()

Russ Anderson (1):
perf record: remove unneeded gettimeofday() call

Stephane Eranian (2):
perf: Fix errors path in perf_output_begin() perf stat: add perf stat -B to pretty print large numbers

Steven Rostedt (10):
tracing: Create class struct for events
tracing: Let tracepoints have data passed to tracepoint callbacks
tracing: Remove per event trace registering
tracing: Move fields from event to class structure
tracing: Move raw_init from events to class
tracing: Allow events to share their print functions
tracing: Move print functions into event class
tracing: Remove duplicate id information in event structure
tracing: Combine event filter_active and enable into single flags field
tracing: Comment the use of event_mutex with trace event flags

Tom Zanussi (1):
perf: Use read() instead of lseek() in trace_event_read.c:skip()

 arch/sparc/kernel/perf_event.c                 |  108 ++++---
 arch/x86/include/asm/perf_event_p4.h           |    3 +-
 arch/x86/kernel/cpu/perf_event_p4.c            |   41 ++-
 arch/x86/mm/pf_in.c                            |    2 +-
 include/linux/ftrace_event.h                   |  103 ++++--
 include/linux/perf_event.h                     |   28 +-
 include/linux/syscalls.h                       |   57 +--
 include/linux/tracepoint.h                     |   98 ++++--
 include/trace/ftrace.h                         |  247 +++++--------
 include/trace/syscall.h                        |   10 +-
 kernel/perf_event.c                            |  389 +++++++++++---------
 kernel/trace/blktrace.c                        |  138 ++++---
 kernel/trace/ftrace.c                          |    7 +-
 kernel/trace/kmemtrace.c                       |   70 +++--
 kernel/trace/trace.c                           |    9 +-
 kernel/trace/trace.h                           |    9 +-
 kernel/trace/trace_branch.c                    |    8 +-
 kernel/trace/trace_event_perf.c                |  183 +++++-----
 kernel/trace/trace_events.c                    |  139 +++++---
 kernel/trace/trace_events_filter.c             |   28 +-
 kernel/trace/trace_export.c                    |   16 +-
 kernel/trace/trace_functions_graph.c           |   13 +-
 kernel/trace/trace_kprobe.c                    |  113 ++++---
 kernel/trace/trace_output.c                    |  137 +++++---
 kernel/trace/trace_output.h                    |    2 +-
 kernel/trace/trace_sched_switch.c              |   20 +-
 kernel/trace/trace_sched_wakeup.c              |   28 +-
 kernel/trace/trace_syscalls.c                  |  146 ++++++--
 kernel/trace/trace_workqueue.c                 |   26 +-
 kernel/tracepoint.c                            |   91 +++--
 net/core/drop_monitor.c                        |   12 +-
 samples/tracepoints/tp-samples-trace.h         |    4 +-
 samples/tracepoints/tracepoint-probe-sample.c  |   13 +-
 samples/tracepoints/tracepoint-probe-sample2.c |    7 +-
 tools/perf/Documentation/perf-stat.txt         |    3 +
 tools/perf/builtin-annotate.c                  |   61 +++-
 tools/perf/builtin-probe.c                     |   10 +-
 tools/perf/builtin-record.c                    |   72 ++---
 tools/perf/builtin-report.c                    |   64 ++--
 tools/perf/builtin-stat.c                      |   18 +-
 tools/perf/perf.c                              |   25 ++-
 tools/perf/util/abspath.c                      |   81 -----
 tools/perf/util/build-id.c                     |   22 ++
 tools/perf/util/build-id.h                     |    2 +
 tools/perf/util/cache.h                        |   57 +---
 tools/perf/util/callchain.c                    |    1 +
 tools/perf/util/callchain.h                    |    1 -
 tools/perf/util/config.c                       |  461 +-----------------------
 tools/perf/util/exec_cmd.c                     |    6 +-
 tools/perf/util/exec_cmd.h                     |    1 -
 tools/perf/util/header.c                       |   84 +++--
 tools/perf/util/help.c                         |   30 +--
 tools/perf/util/hist.c                         |   42 ++-
 tools/perf/util/hist.h                         |   24 ++-
 tools/perf/util/newt.c                         |  150 ++++++--
 tools/perf/util/path.c                         |  204 +-----------
 tools/perf/util/probe-finder.c                 |   33 ++-
 tools/perf/util/probe-finder.h                 |    3 +
 tools/perf/util/quote.c                        |  433 +----------------------
 tools/perf/util/quote.h                        |   39 --
 tools/perf/util/run-command.c                  |   90 -----
 tools/perf/util/run-command.h                  |   30 --
 tools/perf/util/session.c                      |    8 +
 tools/perf/util/session.h                      |    8 +-
 tools/perf/util/sigchain.c                     |    2 +-
 tools/perf/util/sigchain.h                     |    1 -
 tools/perf/util/strbuf.c                       |  229 +------------
 tools/perf/util/strbuf.h                       |   45 ---
 tools/perf/util/symbol.c                       |   25 +-
 tools/perf/util/symbol.h                       |    1 +
 tools/perf/util/trace-event-read.c             |   19 +-
 tools/perf/util/trace-event.h                  |    7 +-
 tools/perf/util/util.h                         |  177 +---------
 tools/perf/util/wrapper.c                      |  110 ------
 74 files changed, 1839 insertions(+), 3145 deletions(-)
arch/sparc/kernel/perf_event.c +61 -47
index e277193..cf4ce26 100644
@@ -91,6 +91,8 @@ struct cpu_hw_events {
 
 	/* Enabled/disable state.  */
 	int			enabled;
+
+	unsigned int		group_flag;
 };
 DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
 
@@ -980,53 +982,6 @@ static int collect_events(struct perf_event *group, int max_count,
 	return n;
 }
 
-static void event_sched_in(struct perf_event *event)
-{
-	event->state = PERF_EVENT_STATE_ACTIVE;
-	event->oncpu = smp_processor_id();
-	event->tstamp_running += event->ctx->time - event->tstamp_stopped;
-	if (is_software_event(event))
-		event->pmu->enable(event);
-}
-
-int hw_perf_group_sched_in(struct perf_event *group_leader,
-			   struct perf_cpu_context *cpuctx,
-			   struct perf_event_context *ctx)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	struct perf_event *sub;
-	int n0, n;
-
-	if (!sparc_pmu)
-		return 0;
-
-	n0 = cpuc->n_events;
-	n = collect_events(group_leader, perf_max_events - n0,
-			   &cpuc->event[n0], &cpuc->events[n0],
-			   &cpuc->current_idx[n0]);
-	if (n < 0)
-		return -EAGAIN;
-	if (check_excludes(cpuc->event, n0, n))
-		return -EINVAL;
-	if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0))
-		return -EAGAIN;
-	cpuc->n_events = n0 + n;
-	cpuc->n_added += n;
-
-	cpuctx->active_oncpu += n;
-	n = 1;
-	event_sched_in(group_leader);
-	list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
-		if (sub->state != PERF_EVENT_STATE_OFF) {
-			event_sched_in(sub);
-			n++;
-		}
-	}
-	ctx->nr_active += n;
-
-	return 1;
-}
-
 static int sparc_pmu_enable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1044,11 +999,20 @@ static int sparc_pmu_enable(struct perf_event *event)
 	cpuc->events[n0] = event->hw.event_base;
 	cpuc->current_idx[n0] = PIC_NO_INDEX;
 
+	/*
+	 * If group events scheduling transaction was started,
+	 * skip the schedulability test here, it will be peformed
+	 * at commit time(->commit_txn) as a whole
+	 */
+	if (cpuc->group_flag & PERF_EVENT_TXN_STARTED)
+		goto nocheck;
+
 	if (check_excludes(cpuc->event, n0, 1))
 		goto out;
 	if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1))
 		goto out;
 
+nocheck:
 	cpuc->n_events++;
 	cpuc->n_added++;
 
@@ -1128,11 +1092,61 @@ static int __hw_perf_event_init(struct perf_event *event)
 	return 0;
 }
 
+/*
+ * Start group events scheduling transaction
+ * Set the flag to make pmu::enable() not perform the
+ * schedulability test, it will be performed at commit time
+ */
+static void sparc_pmu_start_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
+
+	cpuhw->group_flag |= PERF_EVENT_TXN_STARTED;
+}
+
+/*
+ * Stop group events scheduling transaction
+ * Clear the flag and pmu::enable() will perform the
+ * schedulability test.
+ */
+static void sparc_pmu_cancel_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
+
+	cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED;
+}
+
+/*
+ * Commit group events scheduling transaction
+ * Perform the group schedulability test as a whole
+ * Return 0 if success
+ */
+static int sparc_pmu_commit_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int n;
+
+	if (!sparc_pmu)
+		return -EINVAL;
+
+	cpuc = &__get_cpu_var(cpu_hw_events);
+	n = cpuc->n_events;
+	if (check_excludes(cpuc->event, 0, n))
+		return -EINVAL;
+	if (sparc_check_constraints(cpuc->event, cpuc->events, n))
+		return -EAGAIN;
+
+	return 0;
+}
+
 static const struct pmu pmu = {
 	.enable		= sparc_pmu_enable,
 	.disable	= sparc_pmu_disable,
 	.read		= sparc_pmu_read,
 	.unthrottle	= sparc_pmu_unthrottle,
+	.start_txn	= sparc_pmu_start_txn,
+	.cancel_txn	= sparc_pmu_cancel_txn,
+	.commit_txn	= sparc_pmu_commit_txn,
 };
 
 const struct pmu *hw_perf_event_init(struct perf_event *event)
arch/x86/include/asm/perf_event_p4.h +2 -1
index b05400a..64a8ebf 100644
@@ -89,7 +89,8 @@
 	P4_CCCR_ENABLE)
 
 /* HT mask */
-#define P4_CCCR_MASK_HT	(P4_CCCR_MASK | P4_CCCR_THREAD_ANY)
+#define P4_CCCR_MASK_HT				\
+	(P4_CCCR_MASK | P4_CCCR_OVF_PMI_T1 | P4_CCCR_THREAD_ANY)
 
 #define P4_GEN_ESCR_EMASK(class, name, bit)	\
 	class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT)
arch/x86/kernel/cpu/perf_event_p4.c +21 -20

79 lines not on this page · raw message

arch/x86/mm/pf_in.c +1 -1
index df3d5c8..308e325 100644
@@ -34,7 +34,7 @@
 /* IA32 Manual 3, 2-1 */
 static unsigned char prefix_codes[] = {
 	0xF0, 0xF2, 0xF3, 0x2E, 0x36, 0x3E, 0x26, 0x64,
-	0x65, 0x2E, 0x3E, 0x66, 0x67
+	0x65, 0x66, 0x67
 };
 /* IA32 Manual 3, 3-432*/
 static unsigned int reg_rop[] = {
include/linux/ftrace_event.h +75 -28

145 lines not on this page · raw message

include/linux/perf_event.h +15 -13
index 3fd5c82..fb6c91e 100644
@@ -485,6 +485,7 @@ struct perf_guest_info_callbacks {
 #include <linux/ftrace.h>
 #include <linux/cpu.h>
 #include <asm/atomic.h>
+#include <asm/local.h>
 
 #define PERF_MAX_STACK_DEPTH		255
 
@@ -587,21 +588,19 @@ struct perf_mmap_data {
 	struct rcu_head			rcu_head;
 #ifdef CONFIG_PERF_USE_VMALLOC
 	struct work_struct		work;
+	int				page_order;	/* allocation order  */
 #endif
-	int				data_order;
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
-	atomic_t			events;		/* event_id limit       */
 
-	atomic_long_t			head;		/* write position    */
-	atomic_long_t			done_head;	/* completed head    */
-
-	atomic_t			lock;		/* concurrent writes */
-	atomic_t			wakeup;		/* needs a wakeup    */
-	atomic_t			lost;		/* nr records lost   */
+	local_t				head;		/* write position    */
+	local_t				nest;		/* nested writers    */
+	local_t				events;		/* event limit       */
+	local_t				wakeup;		/* wakeup stamp      */
+	local_t				lost;		/* nr records lost   */
 
 	long				watermark;	/* wakeup watermark  */
 
@@ -728,6 +727,7 @@ struct perf_event {
 	perf_overflow_handler_t		overflow_handler;
 
 #ifdef CONFIG_EVENT_TRACING
+	struct ftrace_event_call	*tp_event;
 	struct event_filter		*filter;
 #endif
 
@@ -803,11 +803,12 @@ struct perf_cpu_context {
 struct perf_output_handle {
 	struct perf_event		*event;
 	struct perf_mmap_data		*data;
-	unsigned long			head;
-	unsigned long			offset;
+	unsigned long			wakeup;
+	unsigned long			size;
+	void				*addr;
+	int				page;
 	int				nmi;
 	int				sample;
-	int				locked;
 };
 
 #ifdef CONFIG_PERF_EVENTS
@@ -993,8 +994,9 @@ static inline bool perf_paranoid_kernel(void)
 }
 
 extern void perf_event_init(void);
-extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
-			  int entry_size, struct pt_regs *regs);
+extern void perf_tp_event(u64 addr, u64 count, void *record,
+			  int entry_size, struct pt_regs *regs,
+			  struct hlist_head *head);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
include/linux/syscalls.h +17 -40

111 lines not on this page · raw message

include/linux/tracepoint.h +76 -22

169 lines not on this page · raw message

include/trace/ftrace.h +90 -157

429 lines not on this page · raw message

include/trace/syscall.h +6 -4
index e5e5f48..257e089 100644
@@ -25,6 +25,8 @@ struct syscall_metadata {
 	int		nb_args;
 	const char	**types;
 	const char	**args;
+	struct list_head enter_fields;
+	struct list_head exit_fields;
 
 	struct ftrace_event_call *enter_event;
 	struct ftrace_event_call *exit_event;
@@ -34,16 +36,16 @@ struct syscall_metadata {
 extern unsigned long arch_syscall_addr(int nr);
 extern int init_syscall_trace(struct ftrace_event_call *call);
 
-extern int syscall_enter_define_fields(struct ftrace_event_call *call);
-extern int syscall_exit_define_fields(struct ftrace_event_call *call);
 extern int reg_event_syscall_enter(struct ftrace_event_call *call);
 extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
 extern int reg_event_syscall_exit(struct ftrace_event_call *call);
 extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
 extern int
 ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
-enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
-enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
+enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags,
+				      struct trace_event *event);
+enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags,
+				     struct trace_event *event);
 #endif
 
 #ifdef CONFIG_PERF_EVENTS
kernel/perf_event.c +217 -172

699 lines not on this page · raw message

kernel/trace/blktrace.c +79 -59

281 lines not on this page · raw message

kernel/trace/ftrace.c +4 -3
index 32837e1..6d2cb14 100644
@@ -3234,7 +3234,8 @@ free:
 }
 
 static void
-ftrace_graph_probe_sched_switch(struct task_struct *prev, struct task_struct *next)
+ftrace_graph_probe_sched_switch(void *ignore,
+			struct task_struct *prev, struct task_struct *next)
 {
 	unsigned long long timestamp;
 	int index;
@@ -3288,7 +3289,7 @@ static int start_graph_tracing(void)
 	} while (ret == -EAGAIN);
 
 	if (!ret) {
-		ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch);
+		ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
 		if (ret)
 			pr_info("ftrace_graph: Couldn't activate tracepoint"
 				" probe to kernel_sched_switch\n");
@@ -3364,7 +3365,7 @@ void unregister_ftrace_graph(void)
 	ftrace_graph_entry = ftrace_graph_entry_stub;
 	ftrace_shutdown(FTRACE_STOP_FUNC_RET);
 	unregister_pm_notifier(&ftrace_suspend_notifier);
-	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
+	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
 
  out:
 	mutex_unlock(&ftrace_lock);
kernel/trace/kmemtrace.c +44 -26

164 lines not on this page · raw message

kernel/trace/trace.c +5 -4
index 756d728..ba0ec81 100644
@@ -1936,7 +1936,7 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
 	}
 
 	if (event)
-		return event->trace(iter, sym_flags);
+		return event->funcs->trace(iter, sym_flags, event);
 
 	if (!trace_seq_printf(s, "Unknown type %d\n", entry->type))
 		goto partial;
@@ -1962,7 +1962,7 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
 
 	event = ftrace_find_event(entry->type);
 	if (event)
-		return event->raw(iter, 0);
+		return event->funcs->raw(iter, 0, event);
 
 	if (!trace_seq_printf(s, "%d ?\n", entry->type))
 		goto partial;
@@ -1989,7 +1989,7 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)
 
 	event = ftrace_find_event(entry->type);
 	if (event) {
-		enum print_line_t ret = event->hex(iter, 0);
+		enum print_line_t ret = event->funcs->hex(iter, 0, event);
 		if (ret != TRACE_TYPE_HANDLED)
 			return ret;
 	}
@@ -2014,7 +2014,8 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
 	}
 
 	event = ftrace_find_event(entry->type);
-	return event ? event->binary(iter, 0) : TRACE_TYPE_HANDLED;
+	return event ? event->funcs->binary(iter, 0, event) :
+		TRACE_TYPE_HANDLED;
 }
 
 int trace_empty(struct trace_iterator *iter)
kernel/trace/trace.h +6 -3
index d1ce0be..2cd9639 100644
@@ -405,12 +405,12 @@ void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags,
 void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
 		   int pc);
 #else
-static inline void ftrace_trace_stack(struct trace_array *tr,
+static inline void ftrace_trace_stack(struct ring_buffer *buffer,
 				      unsigned long flags, int skip, int pc)
 {
 }
 
-static inline void ftrace_trace_userstack(struct trace_array *tr,
+static inline void ftrace_trace_userstack(struct ring_buffer *buffer,
 					  unsigned long flags, int pc)
 {
 }
@@ -778,12 +778,15 @@ extern void print_subsystem_event_filter(struct event_subsystem *system,
 					 struct trace_seq *s);
 extern int filter_assign_type(const char *type);
 
+struct list_head *
+trace_get_fields(struct ftrace_event_call *event_call);
+
 static inline int
 filter_check_discard(struct ftrace_event_call *call, void *rec,
 		     struct ring_buffer *buffer,
 		     struct ring_buffer_event *event)
 {
-	if (unlikely(call->filter_active) &&
+	if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&
 	    !filter_match_preds(call->filter, rec)) {
 		ring_buffer_discard_commit(buffer, event);
 		return 1;
kernel/trace/trace_branch.c +6 -2
index b9bc4d4..8d3538b 100644
@@ -143,7 +143,7 @@ static void branch_trace_reset(struct trace_array *tr)
 }
 
 static enum print_line_t trace_branch_print(struct trace_iterator *iter,
-					    int flags)
+					    int flags, struct trace_event *event)
 {
 	struct trace_branch *field;
 
@@ -167,9 +167,13 @@ static void branch_print_header(struct seq_file *s)
 		"    |\n");
 }
 
+static struct trace_event_functions trace_branch_funcs = {
+	.trace		= trace_branch_print,
+};
+
 static struct trace_event trace_branch_event = {
 	.type		= TRACE_BRANCH,
-	.trace		= trace_branch_print,
+	.funcs		= &trace_branch_funcs,
 };
 
 static struct tracer branch_trace __read_mostly =
kernel/trace/trace_event_perf.c +95 -88

255 lines not on this page · raw message

kernel/trace/trace_events.c +88 -51

304 lines not on this page · raw message

kernel/trace/trace_events_filter.c +15 -13
index 58092d8..57bb1bb 100644

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

kernel/trace/trace_export.c +10 -6
index e091f64..8536e2a 100644

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

kernel/trace/trace_functions_graph.c +9 -4
index dd11c83..79f4bac 100644

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

kernel/trace/trace_kprobe.c +67 -46

113 lines not on this page · raw message

kernel/trace/trace_output.c +92 -45

137 lines not on this page · raw message

kernel/trace/trace_output.h +1 -1
index 9d91c72..c038eba 100644

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

kernel/trace/trace_sched_switch.c +10 -10
index a55fccf..8f758d0 100644

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

kernel/trace/trace_sched_wakeup.c +15 -13
index 8052446..0e73bc2 100644

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

kernel/trace/trace_syscalls.c +120 -26

146 lines not on this page · raw message

kernel/trace/trace_workqueue.c +15 -11
index cc2d2fa..a7cc379 100644

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

kernel/tracepoint.c +51 -40

91 lines not on this page · raw message

net/core/drop_monitor.c +6 -6
index cf208d8..ad41529 100644

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

samples/tracepoints/tp-samples-trace.h +1 -3
index dffdc49..4d46be9 100644

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

samples/tracepoints/tracepoint-probe-sample.c +7 -6
index 9e60eb6..744c0b9 100644

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

samples/tracepoints/tracepoint-probe-sample2.c +4 -3
index be2a960..9fcf990 100644

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

tools/perf/Documentation/perf-stat.txt +3 -0
index 2cab8e8..909fa76 100644

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

tools/perf/builtin-annotate.c +45 -16

61 lines not on this page · raw message

tools/perf/builtin-probe.c +7 -3
index 61c6d70..e4a4da3 100644

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

tools/perf/builtin-record.c +25 -47

72 lines not on this page · raw message

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

64 lines not on this page · raw message

tools/perf/builtin-stat.c +14 -4
index ff8c413..9a39ca3 100644

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

tools/perf/perf.c +23 -2
index 08e0e5d..6e48711 100644

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

tools/perf/util/abspath.c +0 -81

81 lines not on this page · raw message

tools/perf/util/build-id.c +22 -0
index 0f60a39..70c5cf8 100644

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

tools/perf/util/build-id.h +2 -0
index 1d981d6..5dafb00 100644

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

tools/perf/util/cache.h +2 -55

57 lines not on this page · raw message

tools/perf/util/callchain.c +1 -0
index 21a52e0..62b69ad 100644

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

tools/perf/util/callchain.h +0 -1
index 1cba1f5..1ca73e4 100644

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

tools/perf/util/config.c +6 -455

461 lines not on this page · raw message

tools/perf/util/exec_cmd.c +3 -3
index 2745605..67eeff5 100644

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

tools/perf/util/exec_cmd.h +0 -1
index 31647ac..bc4b915 100644

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

tools/perf/util/header.c +52 -32

84 lines not on this page · raw message

tools/perf/util/help.c +6 -24
index fbb0097..6f2975a 100644

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

tools/perf/util/hist.c +33 -9

42 lines not on this page · raw message

tools/perf/util/hist.h +22 -2
index 6f17dcd..83fa33a 100644

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

tools/perf/util/newt.c +116 -34

150 lines not on this page · raw message

tools/perf/util/path.c +1 -203

204 lines not on this page · raw message

tools/perf/util/probe-finder.c +23 -10
index 562b144..d964cb1 100644

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

tools/perf/util/probe-finder.h +3 -0
index 66f1980..e1f61dc 100644

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

tools/perf/util/quote.c +1 -432

433 lines not on this page · raw message

tools/perf/util/quote.h +0 -39
index b6a0197..172889e 100644

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

tools/perf/util/run-command.c +0 -90

90 lines not on this page · raw message

tools/perf/util/run-command.h +0 -30
index d790287..1ef264d 100644

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

tools/perf/util/session.c +8 -0
index 25bfca4..8f83a18 100644

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

tools/perf/util/session.h +2 -6
index e7fce48..55c6881 100644

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

tools/perf/util/sigchain.c +1 -1
index 1118b99..ba785e9 100644

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

tools/perf/util/sigchain.h +0 -1
index 1a53c11..959d64e 100644

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

tools/perf/util/strbuf.c +1 -228

229 lines not on this page · raw message

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

45 lines not on this page · raw message

tools/perf/util/symbol.c +14 -11
index a06131f..aaa51ba 100644

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

tools/perf/util/symbol.h +1 -0
index 032469e..5d25b5e 100644

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

tools/perf/util/trace-event-read.c +13 -6
index cb54cd0..f55cc3a 100644

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

tools/perf/util/trace-event.h +6 -1
index 406d452..b3e86b1 100644

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

tools/perf/util/util.h +14 -163

177 lines not on this page · raw message

tools/perf/util/wrapper.c +0 -110

110 lines not on this page · 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.

#1 lore raw
Quoted 9 lines · Ingo Molnar

Please pull the latest perf-core-for-linus git tree from:

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

Most of these changes are fixes and dead code removal, but also a set of optimizations and a series of tracing size-optimization bits that we kept pending because they conflicted with the previous push - and some TUI enhancements.

...

Quoted 8 lines

Peter Zijlstra (16):
perf/ftrace: Optimize perf/tracepoint interaction for single events
perf: Optimize buffer placement by allocating buffers NUMA aware
perf: Disallow mmap() on per-task inherited events
perf: Optimize the perf_output() path by removing IRQ-disables
perf: Optimize the hotpath by converting the perf output buffer to local_t
perf: Optimize perf_output_*() by avoiding local_xchg()
perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction

This commit breaks all non-x86 architectures by adding a reference to regs->flags in generic code. I mentioned this on lkml (with cc to Ingo and Peter), and Peter has a further patch that fixes the problem, which isn't in this pull.

So Linus, please don't do this pull just yet, until we get this extra patch merged.

Paul.

#2 lore raw
Quoted 10 lines · Paul Mackerras
Quoted 8 lines

Peter Zijlstra (16):
perf/ftrace: Optimize perf/tracepoint interaction for single events
perf: Optimize buffer placement by allocating buffers NUMA aware
perf: Disallow mmap() on per-task inherited events
perf: Optimize the perf_output() path by removing IRQ-disables
perf: Optimize the hotpath by converting the perf output buffer to local_t
perf: Optimize perf_output_*() by avoiding local_xchg()
perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction

This commit breaks all non-x86 architectures [...]

Indeed. I have merged and tested the fix, Linus, please pull the updated perf-core-for-linus git tree from:

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

Thanks,

Ingo

------------------>
Akinobu Mita (1):
x86/mmiotrace: Remove redundant instruction prefix checks

Arnaldo Carvalho de Melo (15):
perf tui: Fix build problem with slang <= 2.0.6
perf tools: Remove some unused functions
perf probe: Fix some error exit paths
perf probe: Don't call die()
perf tools: remove xstrndup, xmalloc, xzalloc
perf symbols: Don't try to read the build-id twice
perf session: Make read_build_id routines look at the host_machine too perf TUI: Make 'space' be an alias to 'PgDn'
perf annotate: Use build-ids to find the right DSO
perf tui: Allow disabling the TUI on a per command basis in ~/.perfconfig perf report: Don't start the TUI if -D is used
perf tui: Remove annotate from popup menu after failure
perf annotate: Add TUI interface
perf annotate: Fix up usage of the build id cache
perf report: Support multiple events on the TUI

Cyrill Gorcunov (5):
perf, x86: P4 PMU -- handle unflagged events
perf, x86: P4 PMU -- fix typo in unflagged NMI handling perf, x86: P4 PMU -- do a real check for ESCR address being in hash perf, x86: P4_pmu_schedule_events -- use smp_processor_id instead of raw_ perf, x86: P4 PMU -- add missing bit in CCCR mask

Frederic Weisbecker (4):
perf: Comply with new rcu checks API
perf: Fix unaligned accesses while fetching trace values
perf: Fix forgotten preempt_enable by nested writers
perf: Fix getline undeclared

Li Zefan (1):
tracing: Fix function declarations if !CONFIG_STACKTRACE

Lin Ming (1):
perf, sparc: Implement group scheduling transactional APIs

Masami Hiramatsu (1):
perf probe: Don't compile CFI related code if elfutils is old

Mathieu Desnoyers (1):
tracepoints: Add check trace callback type

Peter Zijlstra (17):
perf/ftrace: Optimize perf/tracepoint interaction for single events
perf: Optimize buffer placement by allocating buffers NUMA aware
perf: Disallow mmap() on per-task inherited events
perf: Optimize the perf_output() path by removing IRQ-disables
perf: Optimize the hotpath by converting the perf output buffer to local_t
perf: Optimize perf_output_*() by avoiding local_xchg()
perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction perf, trace: Optimize tracepoints by using per-tracepoint-per-cpu hlist to track events
perf: Ensure that IOC_OUTPUT isn't used to create multi-writer buffers
perf-record: Remove -M
perf-record: Share per-cpu buffers
perf: Fix wakeup storm for RO mmap()s
perf: Optimize perf_output_copy()
perf: Optimize the !vmalloc backed buffer
perf: Remove more code from the fastpath
perf: Optimize perf_tp_event_match()
perf, trace: Fix !x86 build bug

Russ Anderson (1):
perf record: remove unneeded gettimeofday() call

Stephane Eranian (2):
perf: Fix errors path in perf_output_begin() perf stat: add perf stat -B to pretty print large numbers

Steven Rostedt (11):
tracing: Create class struct for events
tracing: Let tracepoints have data passed to tracepoint callbacks
tracing: Remove per event trace registering
tracing: Move fields from event to class structure
tracing: Move raw_init from events to class
tracing: Allow events to share their print functions
tracing: Move print functions into event class
tracing: Remove duplicate id information in event structure
tracing: Combine event filter_active and enable into single flags field
tracing: Comment the use of event_mutex with trace event flags
tracing: Add __used annotation to event variable

Tom Zanussi (1):
perf: Use read() instead of lseek() in trace_event_read.c:skip()

 arch/sparc/kernel/perf_event.c                 |  108 ++++---
 arch/x86/include/asm/perf_event_p4.h           |    3 +-
 arch/x86/kernel/cpu/perf_event.c               |    6 +-
 arch/x86/kernel/cpu/perf_event_p4.c            |   41 ++-
 arch/x86/mm/pf_in.c                            |    2 +-
 include/linux/ftrace_event.h                   |  103 ++++--
 include/linux/perf_event.h                     |   28 +-
 include/linux/syscalls.h                       |   57 +--
 include/linux/tracepoint.h                     |   98 ++++--
 include/trace/ftrace.h                         |  249 +++++--------
 include/trace/syscall.h                        |   10 +-
 kernel/perf_event.c                            |  389 +++++++++++---------
 kernel/trace/blktrace.c                        |  138 ++++---
 kernel/trace/ftrace.c                          |    7 +-
 kernel/trace/kmemtrace.c                       |   70 +++--
 kernel/trace/trace.c                           |    9 +-
 kernel/trace/trace.h                           |    9 +-
 kernel/trace/trace_branch.c                    |    8 +-
 kernel/trace/trace_event_perf.c                |  185 +++++-----
 kernel/trace/trace_events.c                    |  139 +++++---
 kernel/trace/trace_events_filter.c             |   28 +-
 kernel/trace/trace_export.c                    |   16 +-
 kernel/trace/trace_functions_graph.c           |   13 +-
 kernel/trace/trace_kprobe.c                    |  113 ++++---
 kernel/trace/trace_output.c                    |  137 +++++---
 kernel/trace/trace_output.h                    |    2 +-
 kernel/trace/trace_sched_switch.c              |   20 +-
 kernel/trace/trace_sched_wakeup.c              |   28 +-
 kernel/trace/trace_syscalls.c                  |  146 ++++++--
 kernel/trace/trace_workqueue.c                 |   26 +-
 kernel/tracepoint.c                            |   91 +++--
 net/core/drop_monitor.c                        |   12 +-
 samples/tracepoints/tp-samples-trace.h         |    4 +-
 samples/tracepoints/tracepoint-probe-sample.c  |   13 +-
 samples/tracepoints/tracepoint-probe-sample2.c |    7 +-
 tools/perf/Documentation/perf-stat.txt         |    3 +
 tools/perf/builtin-annotate.c                  |   61 +++-
 tools/perf/builtin-probe.c                     |   10 +-
 tools/perf/builtin-record.c                    |   72 ++---
 tools/perf/builtin-report.c                    |   64 ++--
 tools/perf/builtin-stat.c                      |   18 +-
 tools/perf/perf.c                              |   25 ++-
 tools/perf/util/abspath.c                      |   81 -----
 tools/perf/util/build-id.c                     |   22 ++
 tools/perf/util/build-id.h                     |    2 +
 tools/perf/util/cache.h                        |   57 +---
 tools/perf/util/callchain.c                    |    1 +
 tools/perf/util/callchain.h                    |    1 -
 tools/perf/util/config.c                       |  461 +-----------------------
 tools/perf/util/exec_cmd.c                     |    6 +-
 tools/perf/util/exec_cmd.h                     |    1 -
 tools/perf/util/header.c                       |   84 +++--
 tools/perf/util/help.c                         |   30 +--
 tools/perf/util/hist.c                         |   42 ++-
 tools/perf/util/hist.h                         |   24 ++-
 tools/perf/util/newt.c                         |  150 ++++++--
 tools/perf/util/path.c                         |  204 +-----------
 tools/perf/util/probe-finder.c                 |   33 ++-
 tools/perf/util/probe-finder.h                 |    3 +
 tools/perf/util/quote.c                        |  433 +----------------------
 tools/perf/util/quote.h                        |   39 --
 tools/perf/util/run-command.c                  |   90 -----
 tools/perf/util/run-command.h                  |   30 --
 tools/perf/util/session.c                      |    8 +
 tools/perf/util/session.h                      |    8 +-
 tools/perf/util/sigchain.c                     |    2 +-
 tools/perf/util/sigchain.h                     |    1 -
 tools/perf/util/strbuf.c                       |  229 +------------
 tools/perf/util/strbuf.h                       |   45 ---
 tools/perf/util/symbol.c                       |   25 +-
 tools/perf/util/symbol.h                       |    1 +
 tools/perf/util/trace-event-read.c             |   19 +-
 tools/perf/util/trace-event.h                  |    7 +-
 tools/perf/util/util.h                         |  177 +---------
 tools/perf/util/wrapper.c                      |  110 ------
 75 files changed, 1847 insertions(+), 3147 deletions(-)
arch/sparc/kernel/perf_event.c +61 -47
index e277193..cf4ce26 100644
@@ -91,6 +91,8 @@ struct cpu_hw_events {
 
 	/* Enabled/disable state.  */
 	int			enabled;
+
+	unsigned int		group_flag;
 };
 DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
 
@@ -980,53 +982,6 @@ static int collect_events(struct perf_event *group, int max_count,
 	return n;
 }
 
-static void event_sched_in(struct perf_event *event)
-{
-	event->state = PERF_EVENT_STATE_ACTIVE;
-	event->oncpu = smp_processor_id();
-	event->tstamp_running += event->ctx->time - event->tstamp_stopped;
-	if (is_software_event(event))
-		event->pmu->enable(event);
-}
-
-int hw_perf_group_sched_in(struct perf_event *group_leader,
-			   struct perf_cpu_context *cpuctx,
-			   struct perf_event_context *ctx)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	struct perf_event *sub;
-	int n0, n;
-
-	if (!sparc_pmu)
-		return 0;
-
-	n0 = cpuc->n_events;
-	n = collect_events(group_leader, perf_max_events - n0,
-			   &cpuc->event[n0], &cpuc->events[n0],
-			   &cpuc->current_idx[n0]);
-	if (n < 0)
-		return -EAGAIN;
-	if (check_excludes(cpuc->event, n0, n))
-		return -EINVAL;
-	if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0))
-		return -EAGAIN;
-	cpuc->n_events = n0 + n;
-	cpuc->n_added += n;
-
-	cpuctx->active_oncpu += n;
-	n = 1;
-	event_sched_in(group_leader);
-	list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
-		if (sub->state != PERF_EVENT_STATE_OFF) {
-			event_sched_in(sub);
-			n++;
-		}
-	}
-	ctx->nr_active += n;
-
-	return 1;
-}
-
 static int sparc_pmu_enable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1044,11 +999,20 @@ static int sparc_pmu_enable(struct perf_event *event)
 	cpuc->events[n0] = event->hw.event_base;
 	cpuc->current_idx[n0] = PIC_NO_INDEX;
 
+	/*
+	 * If group events scheduling transaction was started,
+	 * skip the schedulability test here, it will be peformed
+	 * at commit time(->commit_txn) as a whole
+	 */
+	if (cpuc->group_flag & PERF_EVENT_TXN_STARTED)
+		goto nocheck;
+
 	if (check_excludes(cpuc->event, n0, 1))
 		goto out;
 	if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1))
 		goto out;
 
+nocheck:
 	cpuc->n_events++;
 	cpuc->n_added++;
 
@@ -1128,11 +1092,61 @@ static int __hw_perf_event_init(struct perf_event *event)
 	return 0;
 }
 
+/*
+ * Start group events scheduling transaction
+ * Set the flag to make pmu::enable() not perform the
+ * schedulability test, it will be performed at commit time
+ */
+static void sparc_pmu_start_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
+
+	cpuhw->group_flag |= PERF_EVENT_TXN_STARTED;
+}
+
+/*
+ * Stop group events scheduling transaction
+ * Clear the flag and pmu::enable() will perform the
+ * schedulability test.
+ */
+static void sparc_pmu_cancel_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
+
+	cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED;
+}
+
+/*
+ * Commit group events scheduling transaction
+ * Perform the group schedulability test as a whole
+ * Return 0 if success
+ */
+static int sparc_pmu_commit_txn(const struct pmu *pmu)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int n;
+
+	if (!sparc_pmu)
+		return -EINVAL;
+
+	cpuc = &__get_cpu_var(cpu_hw_events);
+	n = cpuc->n_events;
+	if (check_excludes(cpuc->event, 0, n))
+		return -EINVAL;
+	if (sparc_check_constraints(cpuc->event, cpuc->events, n))
+		return -EAGAIN;
+
+	return 0;
+}
+
 static const struct pmu pmu = {
 	.enable		= sparc_pmu_enable,
 	.disable	= sparc_pmu_disable,
 	.read		= sparc_pmu_read,
 	.unthrottle	= sparc_pmu_unthrottle,
+	.start_txn	= sparc_pmu_start_txn,
+	.cancel_txn	= sparc_pmu_cancel_txn,
+	.commit_txn	= sparc_pmu_commit_txn,
 };
 
 const struct pmu *hw_perf_event_init(struct perf_event *event)
arch/x86/include/asm/perf_event_p4.h +2 -1
index b05400a..64a8ebf 100644
@@ -89,7 +89,8 @@
 	P4_CCCR_ENABLE)
 
 /* HT mask */
-#define P4_CCCR_MASK_HT	(P4_CCCR_MASK | P4_CCCR_THREAD_ANY)
+#define P4_CCCR_MASK_HT				\
+	(P4_CCCR_MASK | P4_CCCR_OVF_PMI_T1 | P4_CCCR_THREAD_ANY)
 
 #define P4_GEN_ESCR_EMASK(class, name, bit)	\
 	class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT)
arch/x86/kernel/cpu/perf_event.c +5 -1
index fd4db0d..c775860 100644
@@ -1717,7 +1717,11 @@ void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int ski
 	 */
 	regs->bp = rewind_frame_pointer(skip + 1);
 	regs->cs = __KERNEL_CS;
-	local_save_flags(regs->flags);
+	/*
+	 * We abuse bit 3 to pass exact information, see perf_misc_flags
+	 * and the comment with PERF_EFLAGS_EXACT.
+	 */
+	regs->flags = 0;
 }
 
 unsigned long perf_instruction_pointer(struct pt_regs *regs)
arch/x86/kernel/cpu/perf_event_p4.c +21 -20

79 lines not on this page · raw message

arch/x86/mm/pf_in.c +1 -1
index df3d5c8..308e325 100644
@@ -34,7 +34,7 @@
 /* IA32 Manual 3, 2-1 */
 static unsigned char prefix_codes[] = {
 	0xF0, 0xF2, 0xF3, 0x2E, 0x36, 0x3E, 0x26, 0x64,
-	0x65, 0x2E, 0x3E, 0x66, 0x67
+	0x65, 0x66, 0x67
 };
 /* IA32 Manual 3, 3-432*/
 static unsigned int reg_rop[] = {
include/linux/ftrace_event.h +75 -28

145 lines not on this page · raw message

include/linux/perf_event.h +15 -13
index 3fd5c82..fb6c91e 100644
@@ -485,6 +485,7 @@ struct perf_guest_info_callbacks {
 #include <linux/ftrace.h>
 #include <linux/cpu.h>
 #include <asm/atomic.h>
+#include <asm/local.h>
 
 #define PERF_MAX_STACK_DEPTH		255
 
@@ -587,21 +588,19 @@ struct perf_mmap_data {
 	struct rcu_head			rcu_head;
 #ifdef CONFIG_PERF_USE_VMALLOC
 	struct work_struct		work;
+	int				page_order;	/* allocation order  */
 #endif
-	int				data_order;
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
-	atomic_t			events;		/* event_id limit       */
 
-	atomic_long_t			head;		/* write position    */
-	atomic_long_t			done_head;	/* completed head    */
-
-	atomic_t			lock;		/* concurrent writes */
-	atomic_t			wakeup;		/* needs a wakeup    */
-	atomic_t			lost;		/* nr records lost   */
+	local_t				head;		/* write position    */
+	local_t				nest;		/* nested writers    */
+	local_t				events;		/* event limit       */
+	local_t				wakeup;		/* wakeup stamp      */
+	local_t				lost;		/* nr records lost   */
 
 	long				watermark;	/* wakeup watermark  */
 
@@ -728,6 +727,7 @@ struct perf_event {
 	perf_overflow_handler_t		overflow_handler;
 
 #ifdef CONFIG_EVENT_TRACING
+	struct ftrace_event_call	*tp_event;
 	struct event_filter		*filter;
 #endif
 
@@ -803,11 +803,12 @@ struct perf_cpu_context {
 struct perf_output_handle {
 	struct perf_event		*event;
 	struct perf_mmap_data		*data;
-	unsigned long			head;
-	unsigned long			offset;
+	unsigned long			wakeup;
+	unsigned long			size;
+	void				*addr;
+	int				page;
 	int				nmi;
 	int				sample;
-	int				locked;
 };
 
 #ifdef CONFIG_PERF_EVENTS
@@ -993,8 +994,9 @@ static inline bool perf_paranoid_kernel(void)
 }
 
 extern void perf_event_init(void);
-extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
-			  int entry_size, struct pt_regs *regs);
+extern void perf_tp_event(u64 addr, u64 count, void *record,
+			  int entry_size, struct pt_regs *regs,
+			  struct hlist_head *head);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
include/linux/syscalls.h +17 -40

111 lines not on this page · raw message

include/linux/tracepoint.h +76 -22

169 lines not on this page · raw message

include/trace/ftrace.h +91 -158

433 lines not on this page · raw message

include/trace/syscall.h +6 -4
index e5e5f48..257e089 100644
@@ -25,6 +25,8 @@ struct syscall_metadata {
 	int		nb_args;
 	const char	**types;
 	const char	**args;
+	struct list_head enter_fields;
+	struct list_head exit_fields;
 
 	struct ftrace_event_call *enter_event;
 	struct ftrace_event_call *exit_event;
@@ -34,16 +36,16 @@ struct syscall_metadata {
 extern unsigned long arch_syscall_addr(int nr);
 extern int init_syscall_trace(struct ftrace_event_call *call);
 
-extern int syscall_enter_define_fields(struct ftrace_event_call *call);
-extern int syscall_exit_define_fields(struct ftrace_event_call *call);
 extern int reg_event_syscall_enter(struct ftrace_event_call *call);
 extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
 extern int reg_event_syscall_exit(struct ftrace_event_call *call);
 extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
 extern int
 ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
-enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
-enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
+enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags,
+				      struct trace_event *event);
+enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags,
+				     struct trace_event *event);
 #endif
 
 #ifdef CONFIG_PERF_EVENTS
kernel/perf_event.c +217 -172

699 lines not on this page · raw message

kernel/trace/blktrace.c +79 -59

281 lines not on this page · raw message

kernel/trace/ftrace.c +4 -3
index 32837e1..6d2cb14 100644
@@ -3234,7 +3234,8 @@ free:
 }
 
 static void
-ftrace_graph_probe_sched_switch(struct task_struct *prev, struct task_struct *next)
+ftrace_graph_probe_sched_switch(void *ignore,
+			struct task_struct *prev, struct task_struct *next)
 {
 	unsigned long long timestamp;
 	int index;
@@ -3288,7 +3289,7 @@ static int start_graph_tracing(void)
 	} while (ret == -EAGAIN);
 
 	if (!ret) {
-		ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch);
+		ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
 		if (ret)
 			pr_info("ftrace_graph: Couldn't activate tracepoint"
 				" probe to kernel_sched_switch\n");
@@ -3364,7 +3365,7 @@ void unregister_ftrace_graph(void)
 	ftrace_graph_entry = ftrace_graph_entry_stub;
 	ftrace_shutdown(FTRACE_STOP_FUNC_RET);
 	unregister_pm_notifier(&ftrace_suspend_notifier);
-	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
+	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
 
  out:
 	mutex_unlock(&ftrace_lock);
kernel/trace/kmemtrace.c +44 -26

164 lines not on this page · raw message

kernel/trace/trace.c +5 -4
index 756d728..ba0ec81 100644
@@ -1936,7 +1936,7 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
 	}
 
 	if (event)
-		return event->trace(iter, sym_flags);
+		return event->funcs->trace(iter, sym_flags, event);
 
 	if (!trace_seq_printf(s, "Unknown type %d\n", entry->type))
 		goto partial;
@@ -1962,7 +1962,7 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
 
 	event = ftrace_find_event(entry->type);
 	if (event)
-		return event->raw(iter, 0);
+		return event->funcs->raw(iter, 0, event);
 
 	if (!trace_seq_printf(s, "%d ?\n", entry->type))
 		goto partial;
@@ -1989,7 +1989,7 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)
 
 	event = ftrace_find_event(entry->type);
 	if (event) {
-		enum print_line_t ret = event->hex(iter, 0);
+		enum print_line_t ret = event->funcs->hex(iter, 0, event);
 		if (ret != TRACE_TYPE_HANDLED)
 			return ret;
 	}
@@ -2014,7 +2014,8 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
 	}
 
 	event = ftrace_find_event(entry->type);
-	return event ? event->binary(iter, 0) : TRACE_TYPE_HANDLED;
+	return event ? event->funcs->binary(iter, 0, event) :
+		TRACE_TYPE_HANDLED;
 }
 
 int trace_empty(struct trace_iterator *iter)
kernel/trace/trace.h +6 -3
index d1ce0be..2cd9639 100644
@@ -405,12 +405,12 @@ void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags,
 void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
 		   int pc);
 #else
-static inline void ftrace_trace_stack(struct trace_array *tr,
+static inline void ftrace_trace_stack(struct ring_buffer *buffer,
 				      unsigned long flags, int skip, int pc)
 {
 }
 
-static inline void ftrace_trace_userstack(struct trace_array *tr,
+static inline void ftrace_trace_userstack(struct ring_buffer *buffer,
 					  unsigned long flags, int pc)
 {
 }
@@ -778,12 +778,15 @@ extern void print_subsystem_event_filter(struct event_subsystem *system,
 					 struct trace_seq *s);
 extern int filter_assign_type(const char *type);
 
+struct list_head *
+trace_get_fields(struct ftrace_event_call *event_call);
+
 static inline int
 filter_check_discard(struct ftrace_event_call *call, void *rec,
 		     struct ring_buffer *buffer,
 		     struct ring_buffer_event *event)
 {
-	if (unlikely(call->filter_active) &&
+	if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&
 	    !filter_match_preds(call->filter, rec)) {
 		ring_buffer_discard_commit(buffer, event);
 		return 1;
kernel/trace/trace_branch.c +6 -2
index b9bc4d4..8d3538b 100644
@@ -143,7 +143,7 @@ static void branch_trace_reset(struct trace_array *tr)
 }
 
 static enum print_line_t trace_branch_print(struct trace_iterator *iter,
-					    int flags)
+					    int flags, struct trace_event *event)
 {
 	struct trace_branch *field;
 
@@ -167,9 +167,13 @@ static void branch_print_header(struct seq_file *s)
 		"    |\n");
 }
 
+static struct trace_event_functions trace_branch_funcs = {
+	.trace		= trace_branch_print,
+};
+
 static struct trace_event trace_branch_event = {
 	.type		= TRACE_BRANCH,
-	.trace		= trace_branch_print,
+	.funcs		= &trace_branch_funcs,
 };
 
 static struct tracer branch_trace __read_mostly =
kernel/trace/trace_event_perf.c +97 -88

257 lines not on this page · raw message

kernel/trace/trace_events.c +88 -51

286 lines not on this page · raw message

kernel/trace/trace_events_filter.c +15 -13
index 58092d8..57bb1bb 100644

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

kernel/trace/trace_export.c +10 -6
index e091f64..8536e2a 100644

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

kernel/trace/trace_functions_graph.c +9 -4
index dd11c83..79f4bac 100644

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

kernel/trace/trace_kprobe.c +67 -46

113 lines not on this page · raw message

kernel/trace/trace_output.c +92 -45

137 lines not on this page · raw message

kernel/trace/trace_output.h +1 -1
index 9d91c72..c038eba 100644

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

kernel/trace/trace_sched_switch.c +10 -10
index a55fccf..8f758d0 100644

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

kernel/trace/trace_sched_wakeup.c +15 -13
index 8052446..0e73bc2 100644

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

kernel/trace/trace_syscalls.c +120 -26

146 lines not on this page · raw message

kernel/trace/trace_workqueue.c +15 -11
index cc2d2fa..a7cc379 100644

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

kernel/tracepoint.c +51 -40

91 lines not on this page · raw message

net/core/drop_monitor.c +6 -6
index cf208d8..ad41529 100644

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

samples/tracepoints/tp-samples-trace.h +1 -3
index dffdc49..4d46be9 100644

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

samples/tracepoints/tracepoint-probe-sample.c +7 -6
index 9e60eb6..744c0b9 100644

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

samples/tracepoints/tracepoint-probe-sample2.c +4 -3
index be2a960..9fcf990 100644

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

tools/perf/Documentation/perf-stat.txt +3 -0
index 2cab8e8..909fa76 100644

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

tools/perf/builtin-annotate.c +45 -16

61 lines not on this page · raw message

tools/perf/builtin-probe.c +7 -3
index 61c6d70..e4a4da3 100644

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

tools/perf/builtin-record.c +25 -47

72 lines not on this page · raw message

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

64 lines not on this page · raw message

tools/perf/builtin-stat.c +14 -4
index ff8c413..9a39ca3 100644

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

tools/perf/perf.c +23 -2
index 08e0e5d..6e48711 100644

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

tools/perf/util/abspath.c +0 -81

81 lines not on this page · raw message

tools/perf/util/build-id.c +22 -0
index 0f60a39..70c5cf8 100644

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

tools/perf/util/build-id.h +2 -0
index 1d981d6..5dafb00 100644

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

tools/perf/util/cache.h +2 -55

57 lines not on this page · raw message

tools/perf/util/callchain.c +1 -0
index 21a52e0..62b69ad 100644

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

tools/perf/util/callchain.h +0 -1
index 1cba1f5..1ca73e4 100644

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

tools/perf/util/config.c +6 -455

461 lines not on this page · raw message

tools/perf/util/exec_cmd.c +3 -3
index 2745605..67eeff5 100644

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

tools/perf/util/exec_cmd.h +0 -1
index 31647ac..bc4b915 100644

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

tools/perf/util/header.c +52 -32

84 lines not on this page · raw message

tools/perf/util/help.c +6 -24
index fbb0097..6f2975a 100644

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

tools/perf/util/hist.c +33 -9

42 lines not on this page · raw message

tools/perf/util/hist.h +22 -2
index 6f17dcd..83fa33a 100644

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

tools/perf/util/newt.c +116 -34

150 lines not on this page · raw message

tools/perf/util/path.c +1 -203

204 lines not on this page · raw message

tools/perf/util/probe-finder.c +23 -10
index 562b144..d964cb1 100644

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

tools/perf/util/probe-finder.h +3 -0
index 66f1980..e1f61dc 100644

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

tools/perf/util/quote.c +1 -432

433 lines not on this page · raw message

tools/perf/util/quote.h +0 -39
index b6a0197..172889e 100644

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

tools/perf/util/run-command.c +0 -90

90 lines not on this page · raw message

tools/perf/util/run-command.h +0 -30
index d790287..1ef264d 100644

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

tools/perf/util/session.c +8 -0
index 25bfca4..8f83a18 100644

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

tools/perf/util/session.h +2 -6
index e7fce48..55c6881 100644

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

tools/perf/util/sigchain.c +1 -1
index 1118b99..ba785e9 100644

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

tools/perf/util/sigchain.h +0 -1
index 1a53c11..959d64e 100644

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

tools/perf/util/strbuf.c +1 -228

229 lines not on this page · raw message

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

45 lines not on this page · raw message

tools/perf/util/symbol.c +14 -11
index a06131f..aaa51ba 100644

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

tools/perf/util/symbol.h +1 -0
index 032469e..5d25b5e 100644

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

tools/perf/util/trace-event-read.c +13 -6
index cb54cd0..f55cc3a 100644

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

tools/perf/util/trace-event.h +6 -1
index 406d452..b3e86b1 100644

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

tools/perf/util/util.h +14 -163

177 lines not on this page · raw message

tools/perf/util/wrapper.c +0 -110

110 lines not on this page · 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.

#3 lore raw
Quoted 2 lines · Ingo Molnar
 75 files changed, 1847 insertions(+), 3147 deletions(-)

I was excited by this ("A code _reduction_! Will wonders never cease?"), but it turns out that all of the reduction was due to removing some unused utility functions from the user-level tools.

The actual kernel still grew:

 32 files changed, 1327 insertions(+), 964 deletions(-)

oh well. Merged anyway.

Linus

#4 lore raw

Em Thu, May 27, 2010 at 03:34:51PM -0700, Linus Torvalds escreveu:

Quoted 9 lines · Ingo Molnar
Quoted 2 lines
 75 files changed, 1847 insertions(+), 3147 deletions(-)

I was excited by this ("A code _reduction_! Will wonders never cease?"), but it turns out that all of the reduction was due to removing some unused utility functions from the user-level tools.

That was Ingo's forward looking investments, which I decided to take off the balance sheet not to get the IMF on our backs, glad you noticed the trick, never the less, it was at least a step on the right direction, I guess.

Quoted 5 lines

The actual kernel still grew:

 32 files changed, 1327 insertions(+), 964 deletions(-)

oh well. Merged anyway.

Thanks!

Quoted 1 line

Linus

- Arnaldo

maintainer
#5 lore raw
In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

The actual kernel still grew:

 32 files changed, 1327 insertions(+), 964 deletions(-)

Well, if it's any consolation, that patch pull did include my 100K reduction in trace events.

-- Steve

#6 lore raw

Em Thu, May 27, 2010 at 08:32:37PM -0400, Steven Rostedt escreveu:

Quoted 8 lines · Linus Torvalds
Quoted 4 lines

The actual kernel still grew:

 32 files changed, 1327 insertions(+), 964 deletions(-)

Well, if it's any consolation, that patch pull did include my 100K reduction in trace events.

Bah, these investors, who would believe in them? :-P

- Arnaldo

#7 lore raw
In reply to Linus Torvalds
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Ingo Molnar
 75 files changed, 1847 insertions(+), 3147 deletions(-)

I was excited by this ("A code _reduction_! Will wonders never cease?"), but it turns out that all of the reduction was due to removing some unused utility functions from the user-level tools.

Simple things first and maybe it turns into a habit!

Quoted 5 lines

The actual kernel still grew:

 32 files changed, 1327 insertions(+), 964 deletions(-)

oh well. Merged anyway.

Hey, while i have to admit to being a member of the infinitely large group of kernel developers working hard to ensure that the kernel's size follows Moore's Law - this time i beg to differ, as we _did_ manage to shrink the kernel! ;-)

Here's the before/after vmlinux comparison:

(x86 defconfig, 64-bit): vmlinux:

text data bss dec hex filename
.......................................................

 cad719d (before):  8441843   1281100   983876  10706819   a35f83   vmlinux
 c5617b2 ( after):  8417488   1277724   983876  10679088   a2f330   vmlinux
                    .......................................................
                    -24.35K    -3.37K
                     -0.28%    -0.26%

Ob'Suggestion: we could help debloating efforts by officially declaring to take provably-debloating patches up to -rc4? (with a vmlinux comparison mandated in the changelog or such)

Debloating patches tend to reduce complexity, and hence are more regression-resistent. (They are also rare, so it's not like we would be risking a flood of patches.)

That would be a clever way to redirect the creative energies of kernel developers who are otherwise bored by -rc1's legendary stability and always try to sneak further features upstream post -rc1.

Such a policy would mean that while the merge window for bloating patches is a strict ~1.5 weeks, the merge window for debloating patches would be a generous ~1.5 months.

Maybe such a mild hint would help propagate the idea some more.

Dunno - just an idea,

Ingo