linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:tracing/tasks] tracing: stop command line recording when tracing is disabled
       [not found]             ` <new-submission>
@ 2009-03-18  9:18               ` Thomas Gleixner
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: replace the crude (unsigned) -1 hackery Thomas Gleixner
                                 ` (706 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: Thomas Gleixner @ 2009-03-18  9:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, srostedt, tglx, mingo

Commit-ID:  18aecd362a1c991fbf5f7919ae051a77532ba2f8
Gitweb:     http://git.kernel.org/tip/18aecd362a1c991fbf5f7919ae051a77532ba2f8
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 18 Mar 2009 08:56:58 +0100
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 18 Mar 2009 10:10:16 +0100

tracing: stop command line recording when tracing is disabled

Impact: prevent overwrite of command line entries

When the tracer is stopped the command line recording continues to
record. The check for tracing_is_on() is not sufficient here as the
ringbuffer status is not affected by setting
debug/tracing/tracing_enabled to 0. On a non idle system this can
result in the loss of the command line information for the stopped
trace, which makes the trace harder to read and analyse.

Check tracer_enabled to allow further recording.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1ce6208..7b6043e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -797,7 +797,8 @@ void trace_find_cmdline(int pid, char comm[])
 
 void tracing_record_cmdline(struct task_struct *tsk)
 {
-	if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
+	if (atomic_read(&trace_record_cmdline_disabled) || !tracer_enabled ||
+	    !tracing_is_on())
 		return;
 
 	trace_save_cmdline(tsk);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:tracing/tasks] tracing: replace the crude (unsigned) -1 hackery
       [not found]             ` <new-submission>
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: stop command line recording when tracing is disabled Thomas Gleixner
@ 2009-03-18  9:18               ` Thomas Gleixner
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: fix trace_find_cmdline() Thomas Gleixner
                                 ` (705 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: Thomas Gleixner @ 2009-03-18  9:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, srostedt, tglx, mingo

Commit-ID:  2c7eea4c62ba090b7f4583c3d7337ea0019be900
Gitweb:     http://git.kernel.org/tip/2c7eea4c62ba090b7f4583c3d7337ea0019be900
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 18 Mar 2009 09:03:19 +0100
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 18 Mar 2009 10:10:17 +0100

tracing: replace the crude (unsigned) -1 hackery

Impact: cleanup

The command line recorder uses (unsigned) -1 to mark non mapped
entries in the pid to command line maps. The validity check is
completely unintuitive: idx >= SAVED_CMDLINES

There is no need for such casting games. Use a constant to mark
unmapped entries and check for that constant to make the code readable
and understandable.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7b6043e..ca673c4 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -633,6 +633,7 @@ void tracing_reset_online_cpus(struct trace_array *tr)
 }
 
 #define SAVED_CMDLINES 128
+#define NO_CMDLINE_MAP UINT_MAX
 static unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
 static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
 static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN];
@@ -644,8 +645,8 @@ static atomic_t trace_record_cmdline_disabled __read_mostly;
 
 static void trace_init_cmdlines(void)
 {
-	memset(&map_pid_to_cmdline, -1, sizeof(map_pid_to_cmdline));
-	memset(&map_cmdline_to_pid, -1, sizeof(map_cmdline_to_pid));
+	memset(&map_pid_to_cmdline, NO_CMDLINE_MAP, sizeof(map_pid_to_cmdline));
+	memset(&map_cmdline_to_pid, NO_CMDLINE_MAP, sizeof(map_cmdline_to_pid));
 	cmdline_idx = 0;
 }
 
@@ -753,12 +754,12 @@ static void trace_save_cmdline(struct task_struct *tsk)
 		return;
 
 	idx = map_pid_to_cmdline[tsk->pid];
-	if (idx >= SAVED_CMDLINES) {
+	if (idx == NO_CMDLINE_MAP) {
 		idx = (cmdline_idx + 1) % SAVED_CMDLINES;
 
 		map = map_cmdline_to_pid[idx];
-		if (map <= PID_MAX_DEFAULT)
-			map_pid_to_cmdline[map] = (unsigned)-1;
+		if (map != NO_CMDLINE_MAP)
+			map_pid_to_cmdline[map] = NO_CMDLINE_MAP;
 
 		map_pid_to_cmdline[tsk->pid] = idx;
 
@@ -786,7 +787,7 @@ void trace_find_cmdline(int pid, char comm[])
 
 	__raw_spin_lock(&trace_cmdline_lock);
 	map = map_pid_to_cmdline[pid];
-	if (map >= SAVED_CMDLINES)
+	if (map == NO_CMDLINE_MAP)
 		goto out;
 
 	strcpy(comm, saved_cmdlines[map]);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:tracing/tasks] tracing: fix trace_find_cmdline()
       [not found]             ` <new-submission>
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: stop command line recording when tracing is disabled Thomas Gleixner
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: replace the crude (unsigned) -1 hackery Thomas Gleixner
@ 2009-03-18  9:18               ` Thomas Gleixner
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: fix command line to pid reverse map Carsten Emde
                                 ` (704 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: Thomas Gleixner @ 2009-03-18  9:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, srostedt, tglx, mingo

Commit-ID:  50d88758a3f9787cbdbdbc030560b815721eab4b
Gitweb:     http://git.kernel.org/tip/50d88758a3f9787cbdbdbc030560b815721eab4b
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 18 Mar 2009 08:58:44 +0100
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 18 Mar 2009 10:10:17 +0100

tracing: fix trace_find_cmdline()

Impact: prevent stale command line output

In case there is no valid command line mapping for a pid
trace_find_cmdline() returns without updating the comm buffer. The
trace dump keeps the previous entry which results in confusing trace
output:

     <idle>-0     [000]   280.702056 ....
     <idle>-23456 [000]   280.702080 ....

Update the comm buffer with "<...>" when no mapping is found.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ca673c4..06c69a2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -787,12 +787,11 @@ void trace_find_cmdline(int pid, char comm[])
 
 	__raw_spin_lock(&trace_cmdline_lock);
 	map = map_pid_to_cmdline[pid];
-	if (map == NO_CMDLINE_MAP)
-		goto out;
-
-	strcpy(comm, saved_cmdlines[map]);
+	if (map != NO_CMDLINE_MAP)
+		strcpy(comm, saved_cmdlines[map]);
+	else
+		strcpy(comm, "<...>");
 
- out:
 	__raw_spin_unlock(&trace_cmdline_lock);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:tracing/tasks] tracing: fix command line to pid reverse map
       [not found]             ` <new-submission>
                                 ` (2 preceding siblings ...)
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: fix trace_find_cmdline() Thomas Gleixner
@ 2009-03-18  9:18               ` Carsten Emde
  2009-03-29 22:24               ` [tip:x86/mm] x86/mm: further cleanups of fault.c's include file section Ingo Molnar
                                 ` (703 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: Carsten Emde @ 2009-03-18  9:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, srostedt, Carsten.Emde, tglx,
	mingo

Commit-ID:  a635cf0497342978d417cae19d4a4823932977ff
Gitweb:     http://git.kernel.org/tip/a635cf0497342978d417cae19d4a4823932977ff
Author:     Carsten Emde <Carsten.Emde@osadl.org>
AuthorDate: Wed, 18 Mar 2009 09:00:41 +0100
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 18 Mar 2009 10:10:18 +0100

tracing: fix command line to pid reverse map

Impact: fix command line to pid mapping

map_cmdline_to_pid[] is checked in trace_save_cmdline(), but never
updated. This results in stale pid to command line mappings and the
tracer output will associate the wrong comm string.

Signed-off-by: Carsten Emde <Carsten.Emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 06c69a2..305c562 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -738,8 +738,7 @@ void trace_stop_cmdline_recording(void);
 
 static void trace_save_cmdline(struct task_struct *tsk)
 {
-	unsigned map;
-	unsigned idx;
+	unsigned pid, idx;
 
 	if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
 		return;
@@ -757,10 +756,17 @@ static void trace_save_cmdline(struct task_struct *tsk)
 	if (idx == NO_CMDLINE_MAP) {
 		idx = (cmdline_idx + 1) % SAVED_CMDLINES;
 
-		map = map_cmdline_to_pid[idx];
-		if (map != NO_CMDLINE_MAP)
-			map_pid_to_cmdline[map] = NO_CMDLINE_MAP;
+		/*
+		 * Check whether the cmdline buffer at idx has a pid
+		 * mapped. We are going to overwrite that entry so we
+		 * need to clear the map_pid_to_cmdline. Otherwise we
+		 * would read the new comm for the old pid.
+		 */
+		pid = map_cmdline_to_pid[idx];
+		if (pid != NO_CMDLINE_MAP)
+			map_pid_to_cmdline[pid] = NO_CMDLINE_MAP;
 
+		map_cmdline_to_pid[idx] = tsk->pid;
 		map_pid_to_cmdline[tsk->pid] = idx;
 
 		cmdline_idx = idx;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/mm] x86/mm: further cleanups of fault.c's include file section
       [not found]             ` <new-submission>
                                 ` (3 preceding siblings ...)
  2009-03-18  9:18               ` [tip:tracing/tasks] tracing: fix command line to pid reverse map Carsten Emde
@ 2009-03-29 22:24               ` Ingo Molnar
  2009-03-30 12:06                 ` Ingo Molnar
  2009-04-01 10:15               ` [tip:perfcounters/core] perf_counter tools: kerneltop: add real-time data acquisition thread Mike Galbraith
                                 ` (702 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-03-29 22:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torvalds, tglx, hpa, mingo

Commit-ID:  56aea8468746e673a4bf50b6a13d97b2d1cbe1e8
Gitweb:     http://git.kernel.org/tip/56aea8468746e673a4bf50b6a13d97b2d1cbe1e8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 29 Mar 2009 23:47:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 30 Mar 2009 00:10:22 +0200

x86/mm: further cleanups of fault.c's include file section

Impact: cleanup

Eliminate more than 20 unnecessary #include lines in fault.c

Also fix include file dependency bug in asm/traps.h. (this was
masked before, by implicit inclusion)

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <new-submission>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>


---
 arch/x86/include/asm/traps.h |    1 +
 arch/x86/mm/fault.c          |   41 ++++++++---------------------------------
 2 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 0d53425..37fb07a 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -2,6 +2,7 @@
 #define _ASM_X86_TRAPS_H
 
 #include <asm/debugreg.h>
+#include <asm/siginfo.h>			/* TRAP_TRACE, ... */
 
 #ifdef CONFIG_X86_32
 #define dotraplinkage
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index a03b727..f3c4d03 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -3,40 +3,15 @@
  *  Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs.
  *  Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar
  */
-#include <linux/interrupt.h>
-#include <linux/mmiotrace.h>
-#include <linux/bootmem.h>
-#include <linux/compiler.h>
-#include <linux/highmem.h>
-#include <linux/kprobes.h>
-#include <linux/uaccess.h>
-#include <linux/vmalloc.h>
-#include <linux/vt_kern.h>
-#include <linux/signal.h>
-#include <linux/kernel.h>
-#include <linux/ptrace.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/kdebug.h>
-#include <linux/errno.h>
-#include <linux/magic.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/mman.h>
-#include <linux/tty.h>
-#include <linux/smp.h>
-#include <linux/mm.h>
-
-#include <asm-generic/sections.h>
-
-#include <asm/tlbflush.h>
-#include <asm/pgalloc.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/proto.h>
-#include <asm/traps.h>
-#include <asm/desc.h>
+#include <linux/magic.h>		/* STACK_END_MAGIC		*/
+#include <linux/kdebug.h>		/* oops_begin/end, ...		*/
+#include <linux/module.h>		/* search_exception_table	*/
+#include <linux/bootmem.h>		/* max_low_pfn			*/
+#include <linux/kprobes.h>		/* __kprobes, ...		*/
+#include <linux/mmiotrace.h>		/* kmmio_handler, ...		*/
+
+#include <asm/traps.h>			/* dotraplinkage, ...		*/
+#include <asm/pgalloc.h>		/* pgd_*(), ...			*/
 
 /*
  * Page fault error code bits:

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/mm] x86/mm: further cleanups of fault.c's include file section
  2009-03-29 22:24               ` [tip:x86/mm] x86/mm: further cleanups of fault.c's include file section Ingo Molnar
@ 2009-03-30 12:06                 ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-03-30 12:06 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hpa, mingo

Commit-ID:  a2bcd4731f77cb77ae4b5e4a3d7f5471cf346c33
Gitweb:     http://git.kernel.org/tip/a2bcd4731f77cb77ae4b5e4a3d7f5471cf346c33
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 29 Mar 2009 23:47:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 30 Mar 2009 14:02:02 +0200

x86/mm: further cleanups of fault.c's include file section

Impact: cleanup

Eliminate more than 20 unnecessary #include lines in fault.c

Also fix include file dependency bug in asm/traps.h. (this was
masked before, by implicit inclusion)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <tip-56aea8468746e673a4bf50b6a13d97b2d1cbe1e8@git.kernel.org>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>


---
 arch/x86/include/asm/traps.h |    1 +
 arch/x86/mm/fault.c          |   42 +++++++++---------------------------------
 2 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 0d53425..37fb07a 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -2,6 +2,7 @@
 #define _ASM_X86_TRAPS_H
 
 #include <asm/debugreg.h>
+#include <asm/siginfo.h>			/* TRAP_TRACE, ... */
 
 #ifdef CONFIG_X86_32
 #define dotraplinkage
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index a03b727..24a36a6 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -3,40 +3,16 @@
  *  Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs.
  *  Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar
  */
-#include <linux/interrupt.h>
-#include <linux/mmiotrace.h>
-#include <linux/bootmem.h>
-#include <linux/compiler.h>
-#include <linux/highmem.h>
-#include <linux/kprobes.h>
-#include <linux/uaccess.h>
-#include <linux/vmalloc.h>
-#include <linux/vt_kern.h>
-#include <linux/signal.h>
-#include <linux/kernel.h>
-#include <linux/ptrace.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/kdebug.h>
-#include <linux/errno.h>
-#include <linux/magic.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/mman.h>
-#include <linux/tty.h>
-#include <linux/smp.h>
-#include <linux/mm.h>
-
-#include <asm-generic/sections.h>
-
-#include <asm/tlbflush.h>
-#include <asm/pgalloc.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/proto.h>
-#include <asm/traps.h>
-#include <asm/desc.h>
+#include <linux/magic.h>		/* STACK_END_MAGIC		*/
+#include <linux/sched.h>		/* test_thread_flag(), ...	*/
+#include <linux/kdebug.h>		/* oops_begin/end, ...		*/
+#include <linux/module.h>		/* search_exception_table	*/
+#include <linux/bootmem.h>		/* max_low_pfn			*/
+#include <linux/kprobes.h>		/* __kprobes, ...		*/
+#include <linux/mmiotrace.h>		/* kmmio_handler, ...		*/
+
+#include <asm/traps.h>			/* dotraplinkage, ...		*/
+#include <asm/pgalloc.h>		/* pgd_*(), ...			*/
 
 /*
  * Page fault error code bits:

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: kerneltop: add real-time data acquisition thread
       [not found]             ` <new-submission>
                                 ` (4 preceding siblings ...)
  2009-03-29 22:24               ` [tip:x86/mm] x86/mm: further cleanups of fault.c's include file section Ingo Molnar
@ 2009-04-01 10:15               ` Mike Galbraith
  2009-05-04 17:33               ` [tip:perfcounters/core] perf_counter: round-robin per-CPU counters too tip-bot for Ingo Molnar
                                 ` (701 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: Mike Galbraith @ 2009-04-01 10:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, efault, tglx,
	mingo

Commit-ID:  f0e36dc28173b65df2216dfae7109645d97a1bd9
Gitweb:     http://git.kernel.org/tip/f0e36dc28173b65df2216dfae7109645d97a1bd9
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 27 Mar 2009 12:13:43 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 1 Apr 2009 12:08:51 +0200

perf_counter tools: kerneltop: add real-time data acquisition thread

Decouple kerneltop display from event acquisition by introducing
a separate data acquisition thread. This fixes annnoying kerneltop
display refresh jitter and missed events.

Also add a -r <prio> option, to switch the data acquisition thread
to real-time priority.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/kerneltop.c |   57 ++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/Documentation/perf_counter/kerneltop.c b/Documentation/perf_counter/kerneltop.c
index 430810d..33b4fcf 100644
--- a/Documentation/perf_counter/kerneltop.c
+++ b/Documentation/perf_counter/kerneltop.c
@@ -77,6 +77,8 @@
 #include <errno.h>
 #include <ctype.h>
 #include <time.h>
+#include <sched.h>
+#include <pthread.h>
 
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
@@ -181,6 +183,7 @@ static int			tid				= -1;
 static int			profile_cpu			= -1;
 static int			nr_cpus				=  0;
 static int			nmi				=  1;
+static unsigned int		realtime_prio			=  0;
 static int			group				=  0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			=  16;
@@ -334,6 +337,7 @@ static void display_help(void)
 	" -l                           # show scale factor for RR events\n"
 	" -d delay  --delay=<seconds>  # sampling/display delay           [default:  2]\n"
 	" -f CNT    --filter=CNT       # min-event-count filter          [default: 100]\n\n"
+	" -r prio   --realtime=<prio>  # event acquisition runs with SCHED_FIFO policy\n"
 	" -s symbol --symbol=<symbol>  # function to be showed annotated one-shot\n"
 	" -x path   --vmlinux=<path>   # the vmlinux binary, required for -s use\n"
 	" -z        --zero             # zero counts after display\n"
@@ -620,7 +624,6 @@ static int compare(const void *__sym1, const void *__sym2)
 	return sym_weight(sym1) < sym_weight(sym2);
 }
 
-static time_t			last_refresh;
 static long			events;
 static long			userspace_events;
 static const char		CONSOLE_CLEAR[] = "^[[H^[[2J";
@@ -634,6 +637,7 @@ static void print_sym_table(void)
 	float events_per_sec = events/delay_secs;
 	float kevents_per_sec = (events-userspace_events)/delay_secs;
 
+	events = userspace_events = 0;
 	memcpy(tmp, sym_table, sizeof(sym_table[0])*sym_table_count);
 	qsort(tmp, sym_table_count, sizeof(tmp[0]), compare);
 
@@ -714,8 +718,6 @@ static void print_sym_table(void)
 	if (sym_filter_entry)
 		show_details(sym_filter_entry);
 
-	last_refresh = time(NULL);
-
 	{
 		struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
 
@@ -726,6 +728,16 @@ static void print_sym_table(void)
 	}
 }
 
+static void *display_thread(void *arg)
+{
+	printf("KernelTop refresh period: %d seconds\n", delay_secs);
+
+	while (!sleep(delay_secs))
+		print_sym_table();
+
+	return NULL;
+}
+
 static int read_symbol(FILE *in, struct sym_entry *s)
 {
 	static int filter_match = 0;
@@ -1081,19 +1093,20 @@ static void process_options(int argc, char *argv[])
 			{"filter",	required_argument,	NULL, 'f'},
 			{"group",	required_argument,	NULL, 'g'},
 			{"help",	no_argument,		NULL, 'h'},
-			{"scale",	no_argument,		NULL, 'l'},
 			{"nmi",		required_argument,	NULL, 'n'},
+			{"mmap_info",	no_argument,		NULL, 'M'},
+			{"mmap_pages",	required_argument,	NULL, 'm'},
+			{"munmap_info",	no_argument,		NULL, 'U'},
 			{"pid",		required_argument,	NULL, 'p'},
-			{"vmlinux",	required_argument,	NULL, 'x'},
+			{"realtime",	required_argument,	NULL, 'r'},
+			{"scale",	no_argument,		NULL, 'l'},
 			{"symbol",	required_argument,	NULL, 's'},
 			{"stat",	no_argument,		NULL, 'S'},
+			{"vmlinux",	required_argument,	NULL, 'x'},
 			{"zero",	no_argument,		NULL, 'z'},
-			{"mmap_pages",	required_argument,	NULL, 'm'},
-			{"mmap_info",	no_argument,		NULL, 'M'},
-			{"munmap_info",	no_argument,		NULL, 'U'},
 			{NULL,		0,			NULL,  0 }
 		};
-		int c = getopt_long(argc, argv, "+:ac:C:d:De:f:g:hln:m:p:s:Sx:zMU",
+		int c = getopt_long(argc, argv, "+:ac:C:d:De:f:g:hln:m:p:r:s:Sx:zMU",
 				    long_options, &option_index);
 		if (c == -1)
 			break;
@@ -1127,6 +1140,7 @@ static void process_options(int argc, char *argv[])
 				profile_cpu = -1;
 			}
 			tid				=   atoi(optarg); break;
+		case 'r': realtime_prio			=   atoi(optarg); break;
 		case 's': sym_filter			= strdup(optarg); break;
 		case 'S': run_perfstat			=	       1; break;
 		case 'x': vmlinux			= strdup(optarg); break;
@@ -1289,6 +1303,7 @@ int main(int argc, char *argv[])
 	struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
 	struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 	struct perf_counter_hw_event hw_event;
+	pthread_t thread;
 	int i, counter, group_fd, nr_poll = 0;
 	unsigned int cpu;
 	int ret;
@@ -1363,8 +1378,20 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	printf("KernelTop refresh period: %d seconds\n", delay_secs);
-	last_refresh = time(NULL);
+	if (pthread_create(&thread, NULL, display_thread, NULL)) {
+		printf("Could not create display thread.\n");
+		exit(-1);
+	}
+
+	if (realtime_prio) {
+		struct sched_param param;
+
+		param.sched_priority = realtime_prio;
+		if (sched_setscheduler(0, SCHED_FIFO, &param)) {
+			printf("Could not set realtime priority.\n");
+			exit(-1);
+		}
+	}
 
 	while (1) {
 		int hits = events;
@@ -1374,14 +1401,8 @@ int main(int argc, char *argv[])
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (time(NULL) >= last_refresh + delay_secs) {
-			print_sym_table();
-			events = userspace_events = 0;
-		}
-
 		if (hits == events)
-			ret = poll(event_array, nr_poll, 1000);
-		hits = events;
+			ret = poll(event_array, nr_poll, 100);
 	}
 
 	return 0;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: round-robin per-CPU counters too
       [not found]             ` <new-submission>
                                 ` (5 preceding siblings ...)
  2009-04-01 10:15               ` [tip:perfcounters/core] perf_counter tools: kerneltop: add real-time data acquisition thread Mike Galbraith
@ 2009-05-04 17:33               ` tip-bot for Ingo Molnar
  2009-05-04 17:33               ` [tip:perfcounters/core] perf_counter: initialize the per-cpu context earlier tip-bot for Ingo Molnar
                                 ` (700 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-04 17:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo

Commit-ID:  b82914ce33146186d554b0f5c41e4e13693614ce
Gitweb:     http://git.kernel.org/tip/b82914ce33146186d554b0f5c41e4e13693614ce
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 4 May 2009 18:54:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 4 May 2009 19:29:57 +0200

perf_counter: round-robin per-CPU counters too

This used to be unstable when we had the rq->lock dependencies,
but now that they are that of the past we can turn on percpu
counter RR too.

[ Impact: handle counter over-commit for per-CPU counters too ]

LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 8660ae5..b9679c3 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1069,18 +1069,14 @@ void perf_counter_task_tick(struct task_struct *curr, int cpu)
 {
 	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
 	struct perf_counter_context *ctx = &curr->perf_counter_ctx;
-	const int rotate_percpu = 0;
 
-	if (rotate_percpu)
-		perf_counter_cpu_sched_out(cpuctx);
+	perf_counter_cpu_sched_out(cpuctx);
 	perf_counter_task_sched_out(curr, cpu);
 
-	if (rotate_percpu)
-		rotate_ctx(&cpuctx->ctx);
+	rotate_ctx(&cpuctx->ctx);
 	rotate_ctx(ctx);
 
-	if (rotate_percpu)
-		perf_counter_cpu_sched_in(cpuctx, cpu);
+	perf_counter_cpu_sched_in(cpuctx, cpu);
 	perf_counter_task_sched_in(curr, cpu);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: initialize the per-cpu context earlier
       [not found]             ` <new-submission>
                                 ` (6 preceding siblings ...)
  2009-05-04 17:33               ` [tip:perfcounters/core] perf_counter: round-robin per-CPU counters too tip-bot for Ingo Molnar
@ 2009-05-04 17:33               ` tip-bot for Ingo Molnar
  2009-05-04 17:34               ` [tip:perfcounters/core] perf_counter: convert perf_resource_mutex to a spinlock tip-bot for Ingo Molnar
                                 ` (699 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-04 17:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo

Commit-ID:  0d905bca23aca5c86a10ee101bcd3b1abbd40b25
Gitweb:     http://git.kernel.org/tip/0d905bca23aca5c86a10ee101bcd3b1abbd40b25
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 4 May 2009 19:13:30 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 4 May 2009 19:30:32 +0200

perf_counter: initialize the per-cpu context earlier

percpu scheduling for perfcounters wants to take the context lock,
but that lock first needs to be initialized. Currently it is an
early_initcall() - but that is too late, the task tick runs much
sooner than that.

Call it explicitly from the scheduler init sequence instead.

[ Impact: fix access-before-init crash ]

LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    5 ++++-
 kernel/perf_counter.c        |    5 +----
 kernel/sched.c               |    5 ++++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index f776851..a356fa6 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -573,6 +573,8 @@ extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
 
 extern int sysctl_perf_counter_priv;
 
+extern void perf_counter_init(void);
+
 #else
 static inline void
 perf_counter_task_sched_in(struct task_struct *task, int cpu)		{ }
@@ -600,9 +602,10 @@ perf_counter_mmap(unsigned long addr, unsigned long len,
 
 static inline void
 perf_counter_munmap(unsigned long addr, unsigned long len,
-		    unsigned long pgoff, struct file *file) 		{ }
+		    unsigned long pgoff, struct file *file)		{ }
 
 static inline void perf_counter_comm(struct task_struct *tsk)		{ }
+static inline void perf_counter_init(void)				{ }
 #endif
 
 #endif /* __KERNEL__ */
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index b9679c3..fcdafa2 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3265,15 +3265,12 @@ static struct notifier_block __cpuinitdata perf_cpu_nb = {
 	.notifier_call		= perf_cpu_notify,
 };
 
-static int __init perf_counter_init(void)
+void __init perf_counter_init(void)
 {
 	perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE,
 			(void *)(long)smp_processor_id());
 	register_cpu_notifier(&perf_cpu_nb);
-
-	return 0;
 }
-early_initcall(perf_counter_init);
 
 static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf)
 {
diff --git a/kernel/sched.c b/kernel/sched.c
index 2f600e3..a728976 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -39,6 +39,7 @@
 #include <linux/completion.h>
 #include <linux/kernel_stat.h>
 #include <linux/debug_locks.h>
+#include <linux/perf_counter.h>
 #include <linux/security.h>
 #include <linux/notifier.h>
 #include <linux/profile.h>
@@ -8996,7 +8997,7 @@ void __init sched_init(void)
 		 * 1024) and two child groups A0 and A1 (of weight 1024 each),
 		 * then A0's share of the cpu resource is:
 		 *
-		 * 	A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
+		 *	A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
 		 *
 		 * We achieve this by letting init_task_group's tasks sit
 		 * directly in rq->cfs (i.e init_task_group->se[] = NULL).
@@ -9097,6 +9098,8 @@ void __init sched_init(void)
 	alloc_bootmem_cpumask_var(&cpu_isolated_map);
 #endif /* SMP */
 
+	perf_counter_init();
+
 	scheduler_running = 1;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: convert perf_resource_mutex to a spinlock
       [not found]             ` <new-submission>
                                 ` (7 preceding siblings ...)
  2009-05-04 17:33               ` [tip:perfcounters/core] perf_counter: initialize the per-cpu context earlier tip-bot for Ingo Molnar
@ 2009-05-04 17:34               ` tip-bot for Ingo Molnar
       [not found]               ` <tip-48dd0fed90e2b1f1ba87401439b85942181c6df3@git.kernel.org>
                                 ` (698 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-04 17:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo

Commit-ID:  1dce8d99b85aba6eddb8b8260baea944922e6fe7
Gitweb:     http://git.kernel.org/tip/1dce8d99b85aba6eddb8b8260baea944922e6fe7
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 4 May 2009 19:23:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 4 May 2009 19:30:42 +0200

perf_counter: convert perf_resource_mutex to a spinlock

Now percpu counters can be initialized very early. But the init
sequence uses mutex_lock(). Fortunately, perf_resource_mutex should
be a spinlock anyway, so convert it.

[ Impact: fix crash due to early init mutex use ]

LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index fcdafa2..5f86a11 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -46,9 +46,9 @@ static atomic_t nr_comm_tracking __read_mostly;
 int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */
 
 /*
- * Mutex for (sysadmin-configurable) counter reservations:
+ * Lock for (sysadmin-configurable) counter reservations:
  */
-static DEFINE_MUTEX(perf_resource_mutex);
+static DEFINE_SPINLOCK(perf_resource_lock);
 
 /*
  * Architecture provided APIs - weak aliases:
@@ -3207,9 +3207,9 @@ static void __cpuinit perf_counter_init_cpu(int cpu)
 	cpuctx = &per_cpu(perf_cpu_context, cpu);
 	__perf_counter_init_context(&cpuctx->ctx, NULL);
 
-	mutex_lock(&perf_resource_mutex);
+	spin_lock(&perf_resource_lock);
 	cpuctx->max_pertask = perf_max_counters - perf_reserved_percpu;
-	mutex_unlock(&perf_resource_mutex);
+	spin_unlock(&perf_resource_lock);
 
 	hw_perf_counter_setup(cpu);
 }
@@ -3292,7 +3292,7 @@ perf_set_reserve_percpu(struct sysdev_class *class,
 	if (val > perf_max_counters)
 		return -EINVAL;
 
-	mutex_lock(&perf_resource_mutex);
+	spin_lock(&perf_resource_lock);
 	perf_reserved_percpu = val;
 	for_each_online_cpu(cpu) {
 		cpuctx = &per_cpu(perf_cpu_context, cpu);
@@ -3302,7 +3302,7 @@ perf_set_reserve_percpu(struct sysdev_class *class,
 		cpuctx->max_pertask = mpt;
 		spin_unlock_irq(&cpuctx->ctx.lock);
 	}
-	mutex_unlock(&perf_resource_mutex);
+	spin_unlock(&perf_resource_lock);
 
 	return count;
 }
@@ -3324,9 +3324,9 @@ perf_set_overcommit(struct sysdev_class *class, const char *buf, size_t count)
 	if (val > 1)
 		return -EINVAL;
 
-	mutex_lock(&perf_resource_mutex);
+	spin_lock(&perf_resource_lock);
 	perf_overcommit = val;
-	mutex_unlock(&perf_resource_mutex);
+	spin_unlock(&perf_resource_lock);
 
 	return count;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:tracing/core] tracing: trace_output.c, fix false positive compiler warning
       [not found]               ` <tip-48dd0fed90e2b1f1ba87401439b85942181c6df3@git.kernel.org>
@ 2009-05-06 14:24                 ` Steven Rostedt
  2009-05-06 14:36                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Steven Rostedt @ 2009-05-06 14:24 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, jaswinder, jaswinderrajput, tglx, mingo
  Cc: linux-tip-commits


On Wed, 6 May 2009, tip-bot for Jaswinder Singh Rajput wrote:

> Commit-ID:  48dd0fed90e2b1f1ba87401439b85942181c6df3
> Gitweb:     http://git.kernel.org/tip/48dd0fed90e2b1f1ba87401439b85942181c6df3
> Author:     Jaswinder Singh Rajput <jaswinder@kernel.org>
> AuthorDate: Wed, 6 May 2009 15:45:45 +0530
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 6 May 2009 14:19:16 +0200
> 
> tracing: trace_output.c, fix false positive compiler warning
> 
> This compiler warning:
> 
>   CC      kernel/trace/trace_output.o
>  kernel/trace/trace_output.c: In function ?register_ftrace_event?:
>  kernel/trace/trace_output.c:544: warning: ?list? may be used uninitialized in this function
> 
> Is wrong as 'list' is always initialized - but GCC (4.3.2) does not
> recognize this relationship properly.
> 
> Work around the warning by initializing the variable to NULL.
> 
> [ Impact: fix false positive compiler warning ]
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> Acked-by: Steven Rostedt <rostedt@goodmis.org>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  kernel/trace/trace_output.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 5fc51f0..8bd9a2c 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -541,7 +541,7 @@ int register_ftrace_event(struct trace_event *event)
>  	INIT_LIST_HEAD(&event->list);
>  
>  	if (!event->type) {
> -		struct list_head *list;
> +		struct list_head *list = NULL;

Actually this is the wrong place to initialize. The correct place is in 
the function that is expected to.

>  
>  		if (next_event_type > FTRACE_MAX_EVENT) {
>  

Could you test this patch instead:

tracing: quiet gcc compile warning

Some versions of gcc can not catch the fact that the list variable in 
register_ftrace_event is initialized. There's one place in the logic that 
is a bit complex. The trace_search_list function that initializes the list 
will not initialize it on error. But that's OK, because the caller checks 
for error and will not use the list variable if there is one. Some 
versions of gcc miss this.

[ Impact: quiet gcc from complaining about an unused variable ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 5fc51f0..e949cf6 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -506,8 +506,10 @@ static int trace_search_list(struct list_head **list)
 	}
 
 	/* Did we used up all 65 thousand events??? */
-	if ((last + 1) > FTRACE_MAX_EVENT)
+	if ((last + 1) > FTRACE_MAX_EVENT) {
+		*list = NULL;
 		return 0;
+	}
 
 	*list = &e->list;
 	return last + 1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:tracing/core] tracing: trace_output.c, fix false positive compiler warning
  2009-05-06 14:24                 ` [tip:tracing/core] tracing: trace_output.c, fix false positive compiler warning Steven Rostedt
@ 2009-05-06 14:36                   ` Ingo Molnar
  2009-05-06 14:49                     ` Steven Rostedt
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-05-06 14:36 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, hpa, linux-kernel, jaswinder, jaswinderrajput, tglx,
	linux-tip-commits


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> On Wed, 6 May 2009, tip-bot for Jaswinder Singh Rajput wrote:
> 
> > Commit-ID:  48dd0fed90e2b1f1ba87401439b85942181c6df3
> > Gitweb:     http://git.kernel.org/tip/48dd0fed90e2b1f1ba87401439b85942181c6df3
> > Author:     Jaswinder Singh Rajput <jaswinder@kernel.org>
> > AuthorDate: Wed, 6 May 2009 15:45:45 +0530
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Wed, 6 May 2009 14:19:16 +0200
> > 
> > tracing: trace_output.c, fix false positive compiler warning
> > 
> > This compiler warning:
> > 
> >   CC      kernel/trace/trace_output.o
> >  kernel/trace/trace_output.c: In function ?register_ftrace_event?:
> >  kernel/trace/trace_output.c:544: warning: ?list? may be used uninitialized in this function
> > 
> > Is wrong as 'list' is always initialized - but GCC (4.3.2) does not
> > recognize this relationship properly.
> > 
> > Work around the warning by initializing the variable to NULL.
> > 
> > [ Impact: fix false positive compiler warning ]
> > 
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > Acked-by: Steven Rostedt <rostedt@goodmis.org>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  kernel/trace/trace_output.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > index 5fc51f0..8bd9a2c 100644
> > --- a/kernel/trace/trace_output.c
> > +++ b/kernel/trace/trace_output.c
> > @@ -541,7 +541,7 @@ int register_ftrace_event(struct trace_event *event)
> >  	INIT_LIST_HEAD(&event->list);
> >  
> >  	if (!event->type) {
> > -		struct list_head *list;
> > +		struct list_head *list = NULL;
> 
> Actually this is the wrong place to initialize. The correct place 
> is in the function that is expected to.

does it really matter? It's far more robust to initialize at the 
definition site, because there we can be sure there's no 
side-effects. This one:

>  	/* Did we used up all 65 thousand events??? */
> -	if ((last + 1) > FTRACE_MAX_EVENT)
> +	if ((last + 1) > FTRACE_MAX_EVENT) {
> +		*list = NULL;
>  		return 0;
> +	}

Is correct too but needs a semantic check (and ongoing maintenance, 
etc.).

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:tracing/core] tracing: trace_output.c, fix false positive compiler warning
  2009-05-06 14:36                   ` Ingo Molnar
@ 2009-05-06 14:49                     ` Steven Rostedt
  0 siblings, 0 replies; 1149+ messages in thread
From: Steven Rostedt @ 2009-05-06 14:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, jaswinder, jaswinderrajput, tglx,
	linux-tip-commits


On Wed, 6 May 2009, Ingo Molnar wrote:
> > > ---
> > >  kernel/trace/trace_output.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > > index 5fc51f0..8bd9a2c 100644
> > > --- a/kernel/trace/trace_output.c
> > > +++ b/kernel/trace/trace_output.c
> > > @@ -541,7 +541,7 @@ int register_ftrace_event(struct trace_event *event)
> > >  	INIT_LIST_HEAD(&event->list);
> > >  
> > >  	if (!event->type) {
> > > -		struct list_head *list;
> > > +		struct list_head *list = NULL;
> > 
> > Actually this is the wrong place to initialize. The correct place 
> > is in the function that is expected to.
> 
> does it really matter? It's far more robust to initialize at the 
> definition site, because there we can be sure there's no 
> side-effects. This one:
> 
> >  	/* Did we used up all 65 thousand events??? */
> > -	if ((last + 1) > FTRACE_MAX_EVENT)
> > +	if ((last + 1) > FTRACE_MAX_EVENT) {
> > +		*list = NULL;
> >  		return 0;
> > +	}
> 
> Is correct too but needs a semantic check (and ongoing maintenance, 
> etc.).

Actually, to answer this, we need to look at the entire code. Just looking 
at the changes of a patch does not include the big picture.

The original code is:

static int trace_search_list(struct list_head **list)
{
        struct trace_event *e;
        int last = __TRACE_LAST_TYPE;

        if (list_empty(&ftrace_event_list)) {
                *list = &ftrace_event_list;
                return last + 1;
        }

        /*
         * We used up all possible max events,
         * lets see if somebody freed one.
         */
        list_for_each_entry(e, &ftrace_event_list, list) {
                if (e->type != last + 1)
                        break;
                last++;
        }

        /* Did we used up all 65 thousand events??? */
        if ((last + 1) > FTRACE_MAX_EVENT)
                return 0;

        *list = &e->list;
        return last + 1;
}

[...]
                struct list_head *list;

                if (next_event_type > FTRACE_MAX_EVENT) {

                        event->type = trace_search_list(&list);
                        if (!event->type)
                                goto out;

                } else {

                        event->type = next_event_type++;
                        list = &ftrace_event_list;
                }

                if (WARN_ON(ftrace_find_event(event->type)))
                        goto out;

                list_add_tail(&event->list, list);



The caller is:

	struct list_head *list;

	if () {
		event->type = trace_seach_list(&list);
	} else {
		[...]
		list = &ftrace_event_list;
	}

This code shows that list is initialized by either trace_seach_list() or 
set manually.

Thus, my change makes trace_search_list always initialize the list 
variable. Thus if trace_search_list() is used someplace else, it will not 
cause us this error again.

If gcc can not figure out that trace_search_list initializes the code 
(from the original code), the

	struct list_head *list = NULL;

will always be performed, because gcc thinks that's the only way to 
guarantee that it will be initialized.

My solution, gcc can easily see that trace_search_list will always 
initialize list, and will not set it needlessly to NULL.

-- Steve


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:tracing/core] tracing: small trave_events sample Makefile cleanup
       [not found]             ` <new-submission>
                                 ` (9 preceding siblings ...)
       [not found]               ` <tip-48dd0fed90e2b1f1ba87401439b85942181c6df3@git.kernel.org>
@ 2009-05-06 14:51               ` tip-bot for Christoph Hellwig
  2009-05-07  9:19               ` [tip:x86/cleanups] x86: clean up arch/x86/kernel/tsc_sync.c a bit tip-bot for Ingo Molnar
                                 ` (696 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Christoph Hellwig @ 2009-05-06 14:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, hch, tglx, mingo

Commit-ID:  35cf723e99c0e26ddf51f037dffaa4ff2c2c9106
Gitweb:     http://git.kernel.org/tip/35cf723e99c0e26ddf51f037dffaa4ff2c2c9106
Author:     Christoph Hellwig <hch@lst.de>
AuthorDate: Wed, 6 May 2009 12:33:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 6 May 2009 16:48:56 +0200

tracing: small trave_events sample Makefile cleanup

Use -I$(src) to add the current directory the include path.

[ Impact: cleanup ]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 samples/trace_events/Makefile |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/samples/trace_events/Makefile b/samples/trace_events/Makefile
index 06c6dea..0d428dc 100644
--- a/samples/trace_events/Makefile
+++ b/samples/trace_events/Makefile
@@ -1,8 +1,6 @@
 # builds the trace events example kernel modules;
 # then to use one (as root):  insmod <module_name.ko>
 
-PWD := $(shell pwd)
-
-CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
+CFLAGS_trace-events-sample.o := -I$(src)
 
 obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace-events-sample.o

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/cleanups] x86: clean up arch/x86/kernel/tsc_sync.c a bit
       [not found]             ` <new-submission>
                                 ` (10 preceding siblings ...)
  2009-05-06 14:51               ` [tip:tracing/core] tracing: small trave_events sample Makefile cleanup tip-bot for Christoph Hellwig
@ 2009-05-07  9:19               ` tip-bot for Ingo Molnar
  2009-05-11  9:53               ` [tip:x86/apic] x86: apic: Check rev 3 fadt correctly for physical_apic bit tip-bot for Yinghai Lu
                                 ` (695 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-07  9:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo

Commit-ID:  643bec956544d376b7c2a80a3d5c3d0bf94da8d3
Gitweb:     http://git.kernel.org/tip/643bec956544d376b7c2a80a3d5c3d0bf94da8d3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 7 May 2009 09:12:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 7 May 2009 09:32:10 +0200

x86: clean up arch/x86/kernel/tsc_sync.c a bit

 - remove unused define
 - make the lock variable definition stand out some more
 - convert KERN_* to pr_info() / pr_warning()

[ Impact: cleanup ]

LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/tsc_sync.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index bf36328..027b5b4 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -34,6 +34,7 @@ static __cpuinitdata atomic_t stop_count;
  * of a critical section, to be able to prove TSC time-warps:
  */
 static __cpuinitdata raw_spinlock_t sync_lock = __RAW_SPIN_LOCK_UNLOCKED;
+
 static __cpuinitdata cycles_t last_tsc;
 static __cpuinitdata cycles_t max_warp;
 static __cpuinitdata int nr_warps;
@@ -113,13 +114,12 @@ void __cpuinit check_tsc_sync_source(int cpu)
 		return;
 
 	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) {
-		printk(KERN_INFO
-		       "Skipping synchronization checks as TSC is reliable.\n");
+		pr_info("Skipping synchronization checks as TSC is reliable.\n");
 		return;
 	}
 
-	printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:",
-			  smp_processor_id(), cpu);
+	pr_info("checking TSC synchronization [CPU#%d -> CPU#%d]:",
+		smp_processor_id(), cpu);
 
 	/*
 	 * Reset it - in case this is a second bootup:
@@ -143,8 +143,8 @@ void __cpuinit check_tsc_sync_source(int cpu)
 
 	if (nr_warps) {
 		printk("\n");
-		printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs,"
-				    " turning off TSC clock.\n", max_warp);
+		pr_warning("Measured %Ld cycles TSC warp between CPUs, "
+			   "turning off TSC clock.\n", max_warp);
 		mark_tsc_unstable("check_tsc_sync_source failed");
 	} else {
 		printk(" passed.\n");
@@ -195,5 +195,3 @@ void __cpuinit check_tsc_sync_target(void)
 	while (atomic_read(&stop_count) != cpus)
 		cpu_relax();
 }
-#undef NR_LOOPS
-

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/apic] x86: apic: Check rev 3 fadt correctly for physical_apic bit
       [not found]             ` <new-submission>
                                 ` (11 preceding siblings ...)
  2009-05-07  9:19               ` [tip:x86/cleanups] x86: clean up arch/x86/kernel/tsc_sync.c a bit tip-bot for Ingo Molnar
@ 2009-05-11  9:53               ` tip-bot for Yinghai Lu
  2009-05-11  9:53               ` [tip:x86/cpufeature] x86: clean up and fix setup_clear/force_cpu_cap handling tip-bot for Yinghai Lu
                                 ` (694 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Yinghai Lu @ 2009-05-11  9:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, tglx, mingo

Commit-ID:  61fe91e1319556f32bebfd7ed2c68ef02e2c17f7
Gitweb:     http://git.kernel.org/tip/61fe91e1319556f32bebfd7ed2c68ef02e2c17f7
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Sat, 9 May 2009 23:47:42 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 11 May 2009 10:52:40 +0200

x86: apic: Check rev 3 fadt correctly for physical_apic bit

Impact: fix fadt version checking

FADT2_REVISION_ID has value 3 aka rev 3 FADT. So need to use >= instead
of >, as other places in the code do.

[ Impact: extend scope of APIC boot quirk ]

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/apic/apic_flat_64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 306e5e8..744e6d8 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -235,7 +235,7 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 	 * regardless of how many processors are present (x86_64 ES7000
 	 * is an example).
 	 */
-	if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID &&
+	if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
 		(acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) {
 		printk(KERN_DEBUG "system APIC only can use physical flat");
 		return 1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/cpufeature] x86: clean up and fix setup_clear/force_cpu_cap handling
       [not found]             ` <new-submission>
                                 ` (12 preceding siblings ...)
  2009-05-11  9:53               ` [tip:x86/apic] x86: apic: Check rev 3 fadt correctly for physical_apic bit tip-bot for Yinghai Lu
@ 2009-05-11  9:53               ` tip-bot for Yinghai Lu
  2009-05-11 10:10               ` [tip:perfcounters/core] perf_counter, x86: clean up throttling printk tip-bot for Mike Galbraith
                                 ` (693 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Yinghai Lu @ 2009-05-11  9:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, rusty, jeremy.fitzhardinge,
	yinghai.lu, tglx, hpa, mingo

Commit-ID:  3e0c373749d7eb5b354ac0b043f2b2cdf84eefef
Gitweb:     http://git.kernel.org/tip/3e0c373749d7eb5b354ac0b043f2b2cdf84eefef
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Sat, 9 May 2009 23:47:42 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 11 May 2009 10:57:24 +0200

x86: clean up and fix setup_clear/force_cpu_cap handling

setup_force_cpu_cap() only have one user (Xen guest code),
but it should not reuse cleared_cpu_cpus, otherwise it
will have problems on SMP.

Need to have a separate cpu_cpus_set array too, for forced-on
flags, beyond the forced-off flags.

Also need to setup handling before all cpus caps are combined.

[ Impact: fix the forced-set CPU feature flag logic ]

Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/include/asm/cpufeature.h |    4 ++--
 arch/x86/include/asm/processor.h  |    3 ++-
 arch/x86/kernel/cpu/common.c      |   17 ++++++++++++-----
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index ccc1061..13cc6a5 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -192,11 +192,11 @@ extern const char * const x86_power_flags[32];
 #define clear_cpu_cap(c, bit)	clear_bit(bit, (unsigned long *)((c)->x86_capability))
 #define setup_clear_cpu_cap(bit) do { \
 	clear_cpu_cap(&boot_cpu_data, bit);	\
-	set_bit(bit, (unsigned long *)cleared_cpu_caps); \
+	set_bit(bit, (unsigned long *)cpu_caps_cleared); \
 } while (0)
 #define setup_force_cpu_cap(bit) do { \
 	set_cpu_cap(&boot_cpu_data, bit);	\
-	clear_bit(bit, (unsigned long *)cleared_cpu_caps);	\
+	set_bit(bit, (unsigned long *)cpu_caps_set);	\
 } while (0)
 
 #define cpu_has_fpu		boot_cpu_has(X86_FEATURE_FPU)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index c2cceae..fed93fe 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -135,7 +135,8 @@ extern struct cpuinfo_x86	boot_cpu_data;
 extern struct cpuinfo_x86	new_cpu_data;
 
 extern struct tss_struct	doublefault_tss;
-extern __u32			cleared_cpu_caps[NCAPINTS];
+extern __u32			cpu_caps_cleared[NCAPINTS];
+extern __u32			cpu_caps_set[NCAPINTS];
 
 #ifdef CONFIG_SMP
 DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c4f6678..e7fd5c4 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -292,7 +292,8 @@ static const char *__cpuinit table_lookup_model(struct cpuinfo_x86 *c)
 	return NULL;		/* Not found */
 }
 
-__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
+__u32 cpu_caps_cleared[NCAPINTS] __cpuinitdata;
+__u32 cpu_caps_set[NCAPINTS] __cpuinitdata;
 
 void load_percpu_segment(int cpu)
 {
@@ -806,6 +807,16 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 #endif
 
 	init_hypervisor(c);
+
+	/*
+	 * Clear/Set all flags overriden by options, need do it
+	 * before following smp all cpus cap AND.
+	 */
+	for (i = 0; i < NCAPINTS; i++) {
+		c->x86_capability[i] &= ~cpu_caps_cleared[i];
+		c->x86_capability[i] |= cpu_caps_set[i];
+	}
+
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
@@ -818,10 +829,6 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
 	}
 
-	/* Clear all flags overriden by options */
-	for (i = 0; i < NCAPINTS; i++)
-		c->x86_capability[i] &= ~cleared_cpu_caps[i];
-
 #ifdef CONFIG_X86_MCE
 	/* Init Machine Check Exception if available. */
 	mcheck_init(c);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: clean up throttling printk
       [not found]             ` <new-submission>
                                 ` (13 preceding siblings ...)
  2009-05-11  9:53               ` [tip:x86/cpufeature] x86: clean up and fix setup_clear/force_cpu_cap handling tip-bot for Yinghai Lu
@ 2009-05-11 10:10               ` tip-bot for Mike Galbraith
  2009-05-12 14:33               ` [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES tip-bot for Ingo Molnar
                                 ` (692 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-11 10:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, efault,
	robert.richter, tglx, mingo

Commit-ID:  8823392360dc4992f87bf4c623834d315f297493
Gitweb:     http://git.kernel.org/tip/8823392360dc4992f87bf4c623834d315f297493
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Sun, 10 May 2009 10:53:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 11 May 2009 12:04:30 +0200

perf_counter, x86: clean up throttling printk

s/PERFMON/perfcounters for perfcounter interrupt throttling warning.

'perfmon' is the CPU feature name that is Intel-only, while we do
throttling in a generic way.

[ Impact: cleanup ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index a6878b0..da27419 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -814,7 +814,7 @@ void perf_counter_unthrottle(void)
 	cpuc = &__get_cpu_var(cpu_hw_counters);
 	if (cpuc->interrupts >= PERFMON_MAX_INTERRUPTS) {
 		if (printk_ratelimit())
-			printk(KERN_WARNING "PERFMON: max interrupts exceeded!\n");
+			printk(KERN_WARNING "perfcounters: max interrupts exceeded!\n");
 		hw_perf_restore(cpuc->throttle_ctrl);
 	}
 	cpuc->interrupts = 0;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES
       [not found]             ` <new-submission>
                                 ` (14 preceding siblings ...)
  2009-05-11 10:10               ` [tip:perfcounters/core] perf_counter, x86: clean up throttling printk tip-bot for Mike Galbraith
@ 2009-05-12 14:33               ` tip-bot for Ingo Molnar
  2009-05-12 18:27               ` [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES and MAX_LOCKDEP_CHAINS tip-bot for Ingo Molnar
                                 ` (691 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-12 14:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  bbcc73ee0c8684b11cce247ad98d6929a0bdfcaf
Gitweb:     http://git.kernel.org/tip/bbcc73ee0c8684b11cce247ad98d6929a0bdfcaf
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 12 May 2009 16:29:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 12 May 2009 16:32:17 +0200

lockdep: increase MAX_LOCKDEP_ENTRIES

Now that lockdep coverage has increased it has become easier to
run out of entries:

[   21.401387] BUG: MAX_LOCKDEP_ENTRIES too low!
[   21.402007] turning off the locking correctness validator.
[   21.402007] Pid: 1555, comm: S99local Not tainted 2.6.30-rc5-tip #2
[   21.402007] Call Trace:
[   21.402007]  [<ffffffff81069789>] add_lock_to_list+0x53/0xba
[   21.402007]  [<ffffffff810eb615>] ? lookup_mnt+0x19/0x53
[   21.402007]  [<ffffffff8106be14>] check_prev_add+0x14b/0x1c7
[   21.402007]  [<ffffffff8106c304>] validate_chain+0x474/0x52a
[   21.402007]  [<ffffffff8106c6fc>] __lock_acquire+0x342/0x3c7
[   21.402007]  [<ffffffff8106c842>] lock_acquire+0xc1/0xe5
[   21.402007]  [<ffffffff810eb615>] ? lookup_mnt+0x19/0x53
[   21.402007]  [<ffffffff8153aedc>] _spin_lock+0x31/0x66

Double the size - as we've done in the past.

[ Impact: allow lockdep to cover more locks ]

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/lockdep_internals.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index a2cc7e9..ce523ac 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -54,7 +54,7 @@ enum {
  * table (if it's not there yet), and we check it for lock order
  * conflicts and deadlocks.
  */
-#define MAX_LOCKDEP_ENTRIES	8192UL
+#define MAX_LOCKDEP_ENTRIES	16384UL
 
 #define MAX_LOCKDEP_CHAINS_BITS	14
 #define MAX_LOCKDEP_CHAINS	(1UL << MAX_LOCKDEP_CHAINS_BITS)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES and MAX_LOCKDEP_CHAINS
       [not found]             ` <new-submission>
                                 ` (15 preceding siblings ...)
  2009-05-12 14:33               ` [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES tip-bot for Ingo Molnar
@ 2009-05-12 18:27               ` tip-bot for Ingo Molnar
  2009-05-13  6:21               ` [tip:perfcounters/core] perf_counter: fix print debug irq disable tip-bot for Peter Zijlstra
                                 ` (690 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-12 18:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  d80c19df5fcceb8c741e96f09f275c2da719efef
Gitweb:     http://git.kernel.org/tip/d80c19df5fcceb8c741e96f09f275c2da719efef
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 12 May 2009 16:29:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 12 May 2009 19:59:52 +0200

lockdep: increase MAX_LOCKDEP_ENTRIES and MAX_LOCKDEP_CHAINS

Now that lockdep coverage has increased it has become easier to
run out of entries:

[   21.401387] BUG: MAX_LOCKDEP_ENTRIES too low!
[   21.402007] turning off the locking correctness validator.
[   21.402007] Pid: 1555, comm: S99local Not tainted 2.6.30-rc5-tip #2
[   21.402007] Call Trace:
[   21.402007]  [<ffffffff81069789>] add_lock_to_list+0x53/0xba
[   21.402007]  [<ffffffff810eb615>] ? lookup_mnt+0x19/0x53
[   21.402007]  [<ffffffff8106be14>] check_prev_add+0x14b/0x1c7
[   21.402007]  [<ffffffff8106c304>] validate_chain+0x474/0x52a
[   21.402007]  [<ffffffff8106c6fc>] __lock_acquire+0x342/0x3c7
[   21.402007]  [<ffffffff8106c842>] lock_acquire+0xc1/0xe5
[   21.402007]  [<ffffffff810eb615>] ? lookup_mnt+0x19/0x53
[   21.402007]  [<ffffffff8153aedc>] _spin_lock+0x31/0x66

Double the size - as we've done in the past.

[ Impact: allow lockdep to cover more locks ]

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/lockdep_internals.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index a2cc7e9..699a2ac 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -54,9 +54,9 @@ enum {
  * table (if it's not there yet), and we check it for lock order
  * conflicts and deadlocks.
  */
-#define MAX_LOCKDEP_ENTRIES	8192UL
+#define MAX_LOCKDEP_ENTRIES	16384UL
 
-#define MAX_LOCKDEP_CHAINS_BITS	14
+#define MAX_LOCKDEP_CHAINS_BITS	15
 #define MAX_LOCKDEP_CHAINS	(1UL << MAX_LOCKDEP_CHAINS_BITS)
 
 #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: fix print debug irq disable
       [not found]             ` <new-submission>
                                 ` (16 preceding siblings ...)
  2009-05-12 18:27               ` [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES and MAX_LOCKDEP_CHAINS tip-bot for Ingo Molnar
@ 2009-05-13  6:21               ` tip-bot for Peter Zijlstra
  2009-05-13 13:52               ` [tip:x86/urgent] xen: use header for EXPORT_SYMBOL_GPL tip-bot for Randy Dunlap
                                 ` (689 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-13  6:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5bb9efe33ea4001a17ab98186a40a134a3061d67
Gitweb:     http://git.kernel.org/tip/5bb9efe33ea4001a17ab98186a40a134a3061d67
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 08:12:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 13 May 2009 08:17:37 +0200

perf_counter: fix print debug irq disable

inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
bash/15802 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (sysrq_key_table_lock){?.....},

Don't unconditionally enable interrupts in the perf_counter_print_debug()
path.

[ Impact: fix potential deadlock pointed out by lockdep ]

LKML-Reference: <new-submission>
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>


---
 arch/x86/kernel/cpu/perf_counter.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index da27419..f7772ff 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -621,12 +621,13 @@ void perf_counter_print_debug(void)
 {
 	u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
 	struct cpu_hw_counters *cpuc;
+	unsigned long flags;
 	int cpu, idx;
 
 	if (!x86_pmu.num_counters)
 		return;
 
-	local_irq_disable();
+	local_irq_save(flags);
 
 	cpu = smp_processor_id();
 	cpuc = &per_cpu(cpu_hw_counters, cpu);
@@ -664,7 +665,7 @@ void perf_counter_print_debug(void)
 		pr_info("CPU#%d: fixed-PMC%d count: %016llx\n",
 			cpu, idx, pmc_count);
 	}
-	local_irq_enable();
+	local_irq_restore(flags);
 }
 
 static void x86_pmu_disable(struct perf_counter *counter)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/urgent] xen: use header for EXPORT_SYMBOL_GPL
       [not found]             ` <new-submission>
                                 ` (17 preceding siblings ...)
  2009-05-13  6:21               ` [tip:perfcounters/core] perf_counter: fix print debug irq disable tip-bot for Peter Zijlstra
@ 2009-05-13 13:52               ` tip-bot for Randy Dunlap
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: More accurate counter update tip-bot for Peter Zijlstra
                                 ` (688 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Randy Dunlap @ 2009-05-13 13:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, randy.dunlap, jeremy.fitzhardinge, akpm,
	tglx, mingo

Commit-ID:  44408ad7368906c84000e87a99c14a16dbb867fd
Gitweb:     http://git.kernel.org/tip/44408ad7368906c84000e87a99c14a16dbb867fd
Author:     Randy Dunlap <randy.dunlap@oracle.com>
AuthorDate: Tue, 12 May 2009 13:31:40 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 13 May 2009 15:43:55 +0200

xen: use header for EXPORT_SYMBOL_GPL

mmu.c needs to #include module.h to prevent these warnings:

 arch/x86/xen/mmu.c:239: warning: data definition has no type or storage class
 arch/x86/xen/mmu.c:239: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
 arch/x86/xen/mmu.c:239: warning: parameter names (without types) in function declaration

[ Impact: cleanup ]

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/xen/mmu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e25a78e..fba55b1 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -42,6 +42,7 @@
 #include <linux/highmem.h>
 #include <linux/debugfs.h>
 #include <linux/bug.h>
+#include <linux/module.h>
 
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: More accurate counter update
       [not found]             ` <new-submission>
                                 ` (18 preceding siblings ...)
  2009-05-13 13:52               ` [tip:x86/urgent] xen: use header for EXPORT_SYMBOL_GPL tip-bot for Randy Dunlap
@ 2009-05-15  8:42               ` tip-bot for Peter Zijlstra
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: Fix throttling tip-bot for Ingo Molnar
                                 ` (687 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  ec3232bdf8518bea8410f0027f870b24d3aa8753
Gitweb:     http://git.kernel.org/tip/ec3232bdf8518bea8410f0027f870b24d3aa8753
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 09:45:19 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:46:54 +0200

perf_counter: x86: More accurate counter update

Take the counter width into account instead of assuming 32 bits.

In particular Nehalem has 44 bit wide counters, and all
arithmetics should happen on a 44-bit signed integer basis.

[ Impact: fix rare event imprecision, warning message on Nehalem ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index f7772ff..3a92a2b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -138,7 +138,9 @@ static u64
 x86_perf_counter_update(struct perf_counter *counter,
 			struct hw_perf_counter *hwc, int idx)
 {
-	u64 prev_raw_count, new_raw_count, delta;
+	int shift = 64 - x86_pmu.counter_bits;
+	u64 prev_raw_count, new_raw_count;
+	s64 delta;
 
 	/*
 	 * Careful: an NMI might modify the previous counter value.
@@ -161,9 +163,10 @@ again:
 	 * (counter-)time and add that to the generic counter.
 	 *
 	 * Careful, not all hw sign-extends above the physical width
-	 * of the count, so we do that by clipping the delta to 32 bits:
+	 * of the count.
 	 */
-	delta = (u64)(u32)((s32)new_raw_count - (s32)prev_raw_count);
+	delta = (new_raw_count << shift) - (prev_raw_count << shift);
+	delta >>= shift;
 
 	atomic64_add(delta, &counter->count);
 	atomic64_sub(delta, &hwc->period_left);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Fix throttling
       [not found]             ` <new-submission>
                                 ` (19 preceding siblings ...)
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: More accurate counter update tip-bot for Peter Zijlstra
@ 2009-05-15  8:42               ` tip-bot for Ingo Molnar
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: Allow unpriviliged use of NMIs tip-bot for Peter Zijlstra
                                 ` (686 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-15  8:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  f5a5a2f6e69e88647ae12da39f0ff3a510bcf0a6
Gitweb:     http://git.kernel.org/tip/f5a5a2f6e69e88647ae12da39f0ff3a510bcf0a6
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 13 May 2009 12:54:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:46:56 +0200

perf_counter: x86: Fix throttling

If counters are disabled globally when a perfcounter IRQ/NMI hits,
and if we throttle in that case, we'll promote the '0' value to
the next lapic IRQ and disable all perfcounters at that point,
permanently ...

Fix it.

[ Impact: fix hung perfcounters under load ]

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 3a92a2b..88ae8ce 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -765,8 +765,13 @@ out:
 	/*
 	 * Restore - do not reenable when global enable is off or throttled:
 	 */
-	if (++cpuc->interrupts < PERFMON_MAX_INTERRUPTS)
-		intel_pmu_restore_all(cpuc->throttle_ctrl);
+	if (cpuc->throttle_ctrl) {
+		if (++cpuc->interrupts < PERFMON_MAX_INTERRUPTS) {
+			intel_pmu_restore_all(cpuc->throttle_ctrl);
+		} else {
+			pr_info("CPU#%d: perfcounters: max interrupt rate exceeded! Throttle on.\n", smp_processor_id());
+		}
+	}
 
 	return ret;
 }
@@ -817,11 +822,16 @@ void perf_counter_unthrottle(void)
 
 	cpuc = &__get_cpu_var(cpu_hw_counters);
 	if (cpuc->interrupts >= PERFMON_MAX_INTERRUPTS) {
-		if (printk_ratelimit())
-			printk(KERN_WARNING "perfcounters: max interrupts exceeded!\n");
+		pr_info("CPU#%d: perfcounters: throttle off.\n", smp_processor_id());
+
+		/*
+		 * Clear them before re-enabling irqs/NMIs again:
+		 */
+		cpuc->interrupts = 0;
 		hw_perf_restore(cpuc->throttle_ctrl);
+	} else {
+		cpuc->interrupts = 0;
 	}
-	cpuc->interrupts = 0;
 }
 
 void smp_perf_counter_interrupt(struct pt_regs *regs)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Allow unpriviliged use of NMIs
       [not found]             ` <new-submission>
                                 ` (20 preceding siblings ...)
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: Fix throttling tip-bot for Ingo Molnar
@ 2009-05-15  8:42               ` tip-bot for Peter Zijlstra
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: Fix perf_output_copy() WARN to account for overflow tip-bot for Peter Zijlstra
                                 ` (685 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  a026dfecc035f213c1cfa0bf6407ce3155f6a9df
Gitweb:     http://git.kernel.org/tip/a026dfecc035f213c1cfa0bf6407ce3155f6a9df
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 10:02:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:46:57 +0200

perf_counter: x86: Allow unpriviliged use of NMIs

Apply sysctl_perf_counter_priv to NMIs. Also, fail the counter
creation instead of silently down-grading to regular interrupts.

[ Impact: allow wider perf-counter usage ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 88ae8ce..c19e927 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -280,8 +280,11 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	 * If privileged enough, allow NMI events:
 	 */
 	hwc->nmi = 0;
-	if (capable(CAP_SYS_ADMIN) && hw_event->nmi)
+	if (hw_event->nmi) {
+		if (sysctl_perf_counter_priv && !capable(CAP_SYS_ADMIN))
+			return -EACCES;
 		hwc->nmi = 1;
+	}
 
 	hwc->irq_period	= hw_event->irq_period;
 	if ((s64)hwc->irq_period <= 0 || hwc->irq_period > x86_pmu.max_period)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix perf_output_copy() WARN to account for overflow
       [not found]             ` <new-submission>
                                 ` (21 preceding siblings ...)
  2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: Allow unpriviliged use of NMIs tip-bot for Peter Zijlstra
@ 2009-05-15  8:43               ` tip-bot for Peter Zijlstra
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Fix up the amd NMI/INT throttle tip-bot for Peter Zijlstra
                                 ` (684 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  53020fe81eecd0b7be295868ce5850ef8f41074e
Gitweb:     http://git.kernel.org/tip/53020fe81eecd0b7be295868ce5850ef8f41074e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 21:26:19 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:46:59 +0200

perf_counter: Fix perf_output_copy() WARN to account for overflow

The simple reservation test in perf_output_copy() failed to take
unsigned int overflow into account, fix this.

[ Impact: fix false positive warning with more than 4GB of profiling data ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ff166c1..985be0b 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1927,7 +1927,11 @@ static void perf_output_copy(struct perf_output_handle *handle,
 
 	handle->offset = offset;
 
-	WARN_ON_ONCE(handle->offset > handle->head);
+	/*
+	 * Check we didn't copy past our reservation window, taking the
+	 * possible unsigned int wrap into account.
+	 */
+	WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
 }
 
 #define perf_output_put(handle, x) \

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Fix up the amd NMI/INT throttle
       [not found]             ` <new-submission>
                                 ` (22 preceding siblings ...)
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: Fix perf_output_copy() WARN to account for overflow tip-bot for Peter Zijlstra
@ 2009-05-15  8:43               ` tip-bot for Peter Zijlstra
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable tip-bot for Peter Zijlstra
                                 ` (683 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  962bf7a66edca4d36a730a38ff8410a67f560e40
Gitweb:     http://git.kernel.org/tip/962bf7a66edca4d36a730a38ff8410a67f560e40
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 13:21:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:01 +0200

perf_counter: x86: Fix up the amd NMI/INT throttle

perf_counter_unthrottle() restores throttle_ctrl, buts its never set.
Also, we fail to disable all counters when throttling.

[ Impact: fix rare stuck perf-counters when they are throttled ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   38 ++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index c19e927..7601c01 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -334,6 +334,8 @@ static u64 amd_pmu_save_disable_all(void)
 	 * right thing.
 	 */
 	barrier();
+	if (!enabled)
+		goto out;
 
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
 		u64 val;
@@ -347,6 +349,7 @@ static u64 amd_pmu_save_disable_all(void)
 		wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
 	}
 
+out:
 	return enabled;
 }
 
@@ -787,32 +790,43 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 	int handled = 0;
 	struct perf_counter *counter;
 	struct hw_perf_counter *hwc;
-	int idx;
+	int idx, throttle = 0;
+
+	cpuc->throttle_ctrl = cpuc->enabled;
+	cpuc->enabled = 0;
+	barrier();
+
+	if (cpuc->throttle_ctrl) {
+		if (++cpuc->interrupts >= PERFMON_MAX_INTERRUPTS)
+			throttle = 1;
+	}
 
-	++cpuc->interrupts;
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
+		int disable = 0;
+
 		if (!test_bit(idx, cpuc->active_mask))
 			continue;
+
 		counter = cpuc->counters[idx];
 		hwc = &counter->hw;
 		val = x86_perf_counter_update(counter, hwc, idx);
 		if (val & (1ULL << (x86_pmu.counter_bits - 1)))
-			continue;
+			goto next;
+
 		/* counter overflow */
 		x86_perf_counter_set_period(counter, hwc, idx);
 		handled = 1;
 		inc_irq_stat(apic_perf_irqs);
-		if (perf_counter_overflow(counter, nmi, regs, 0))
-			amd_pmu_disable_counter(hwc, idx);
-		else if (cpuc->interrupts >= PERFMON_MAX_INTERRUPTS)
-			/*
-			 * do not reenable when throttled, but reload
-			 * the register
-			 */
+		disable = perf_counter_overflow(counter, nmi, regs, 0);
+
+next:
+		if (disable || throttle)
 			amd_pmu_disable_counter(hwc, idx);
-		else if (counter->state == PERF_COUNTER_STATE_ACTIVE)
-			amd_pmu_enable_counter(hwc, idx);
 	}
+
+	if (cpuc->throttle_ctrl && !throttle)
+		cpuc->enabled = 1;
+
 	return handled;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable
       [not found]             ` <new-submission>
                                 ` (23 preceding siblings ...)
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Fix up the amd NMI/INT throttle tip-bot for Peter Zijlstra
@ 2009-05-15  8:43               ` tip-bot for Peter Zijlstra
  2009-05-15 11:05                 ` Paul Mackerras
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Robustify interrupt handling tip-bot for Peter Zijlstra
                                 ` (682 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  9e35ad388bea89f7d6f375af4c0ae98803688666
Gitweb:     http://git.kernel.org/tip/9e35ad388bea89f7d6f375af4c0ae98803688666
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 13 May 2009 16:21:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:02 +0200

perf_counter: Rework the perf counter disable/enable

The current disable/enable mechanism is:

	token = hw_perf_save_disable();
	...
	/* do bits */
	...
	hw_perf_restore(token);

This works well, provided that the use nests properly. Except we don't.

x86 NMI/INT throttling has non-nested use of this, breaking things. Therefore
provide a reference counter disable/enable interface, where the first disable
disables the hardware, and the last enable enables the hardware again.

[ Impact: refactor, simplify the PMU disable/enable logic ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/kernel/perf_counter.c |   24 ++++----
 arch/x86/kernel/cpu/perf_counter.c |  113 +++++++++++++----------------------
 drivers/acpi/processor_idle.c      |    6 +-
 include/linux/perf_counter.h       |   10 ++-
 kernel/perf_counter.c              |   76 +++++++++++++++---------
 5 files changed, 109 insertions(+), 120 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 15cdc8e..bb1b463 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -386,7 +386,7 @@ static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0)
  * Disable all counters to prevent PMU interrupts and to allow
  * counters to be added or removed.
  */
-u64 hw_perf_save_disable(void)
+void hw_perf_disable(void)
 {
 	struct cpu_hw_counters *cpuhw;
 	unsigned long ret;
@@ -428,7 +428,6 @@ u64 hw_perf_save_disable(void)
 		mb();
 	}
 	local_irq_restore(flags);
-	return ret;
 }
 
 /*
@@ -436,7 +435,7 @@ u64 hw_perf_save_disable(void)
  * If we were previously disabled and counters were added, then
  * put the new config on the PMU.
  */
-void hw_perf_restore(u64 disable)
+void hw_perf_enable(void)
 {
 	struct perf_counter *counter;
 	struct cpu_hw_counters *cpuhw;
@@ -448,9 +447,12 @@ void hw_perf_restore(u64 disable)
 	int n_lim;
 	int idx;
 
-	if (disable)
-		return;
 	local_irq_save(flags);
+	if (!cpuhw->disabled) {
+		local_irq_restore(flags);
+		return;
+	}
+
 	cpuhw = &__get_cpu_var(cpu_hw_counters);
 	cpuhw->disabled = 0;
 
@@ -649,19 +651,18 @@ int hw_perf_group_sched_in(struct perf_counter *group_leader,
 /*
  * Add a counter to the PMU.
  * If all counters are not already frozen, then we disable and
- * re-enable the PMU in order to get hw_perf_restore to do the
+ * re-enable the PMU in order to get hw_perf_enable to do the
  * actual work of reconfiguring the PMU.
  */
 static int power_pmu_enable(struct perf_counter *counter)
 {
 	struct cpu_hw_counters *cpuhw;
 	unsigned long flags;
-	u64 pmudis;
 	int n0;
 	int ret = -EAGAIN;
 
 	local_irq_save(flags);
-	pmudis = hw_perf_save_disable();
+	perf_disable();
 
 	/*
 	 * Add the counter to the list (if there is room)
@@ -685,7 +686,7 @@ static int power_pmu_enable(struct perf_counter *counter)
 
 	ret = 0;
  out:
-	hw_perf_restore(pmudis);
+	perf_enable();
 	local_irq_restore(flags);
 	return ret;
 }
@@ -697,11 +698,10 @@ static void power_pmu_disable(struct perf_counter *counter)
 {
 	struct cpu_hw_counters *cpuhw;
 	long i;
-	u64 pmudis;
 	unsigned long flags;
 
 	local_irq_save(flags);
-	pmudis = hw_perf_save_disable();
+	perf_disable();
 
 	power_pmu_read(counter);
 
@@ -735,7 +735,7 @@ static void power_pmu_disable(struct perf_counter *counter)
 		cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE);
 	}
 
-	hw_perf_restore(pmudis);
+	perf_enable();
 	local_irq_restore(flags);
 }
 
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 7601c01..313638c 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -31,7 +31,6 @@ struct cpu_hw_counters {
 	unsigned long		used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
 	unsigned long		active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
 	unsigned long		interrupts;
-	u64			throttle_ctrl;
 	int			enabled;
 };
 
@@ -42,8 +41,8 @@ struct x86_pmu {
 	const char	*name;
 	int		version;
 	int		(*handle_irq)(struct pt_regs *, int);
-	u64		(*save_disable_all)(void);
-	void		(*restore_all)(u64);
+	void		(*disable_all)(void);
+	void		(*enable_all)(void);
 	void		(*enable)(struct hw_perf_counter *, int);
 	void		(*disable)(struct hw_perf_counter *, int);
 	unsigned	eventsel;
@@ -56,6 +55,7 @@ struct x86_pmu {
 	int		counter_bits;
 	u64		counter_mask;
 	u64		max_period;
+	u64		intel_ctrl;
 };
 
 static struct x86_pmu x86_pmu __read_mostly;
@@ -311,22 +311,19 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	return 0;
 }
 
-static u64 intel_pmu_save_disable_all(void)
+static void intel_pmu_disable_all(void)
 {
-	u64 ctrl;
-
-	rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
 	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
-
-	return ctrl;
 }
 
-static u64 amd_pmu_save_disable_all(void)
+static void amd_pmu_disable_all(void)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
-	int enabled, idx;
+	int idx;
+
+	if (!cpuc->enabled)
+		return;
 
-	enabled = cpuc->enabled;
 	cpuc->enabled = 0;
 	/*
 	 * ensure we write the disable before we start disabling the
@@ -334,8 +331,6 @@ static u64 amd_pmu_save_disable_all(void)
 	 * right thing.
 	 */
 	barrier();
-	if (!enabled)
-		goto out;
 
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
 		u64 val;
@@ -348,37 +343,31 @@ static u64 amd_pmu_save_disable_all(void)
 		val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
 		wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
 	}
-
-out:
-	return enabled;
 }
 
-u64 hw_perf_save_disable(void)
+void hw_perf_disable(void)
 {
 	if (!x86_pmu_initialized())
-		return 0;
-	return x86_pmu.save_disable_all();
+		return;
+	return x86_pmu.disable_all();
 }
-/*
- * Exported because of ACPI idle
- */
-EXPORT_SYMBOL_GPL(hw_perf_save_disable);
 
-static void intel_pmu_restore_all(u64 ctrl)
+static void intel_pmu_enable_all(void)
 {
-	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
+	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
 }
 
-static void amd_pmu_restore_all(u64 ctrl)
+static void amd_pmu_enable_all(void)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
 	int idx;
 
-	cpuc->enabled = ctrl;
-	barrier();
-	if (!ctrl)
+	if (cpuc->enabled)
 		return;
 
+	cpuc->enabled = 1;
+	barrier();
+
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
 		u64 val;
 
@@ -392,16 +381,12 @@ static void amd_pmu_restore_all(u64 ctrl)
 	}
 }
 
-void hw_perf_restore(u64 ctrl)
+void hw_perf_enable(void)
 {
 	if (!x86_pmu_initialized())
 		return;
-	x86_pmu.restore_all(ctrl);
+	x86_pmu.enable_all();
 }
-/*
- * Exported because of ACPI idle
- */
-EXPORT_SYMBOL_GPL(hw_perf_restore);
 
 static inline u64 intel_pmu_get_status(void)
 {
@@ -735,15 +720,14 @@ static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
 	int bit, cpu = smp_processor_id();
 	u64 ack, status;
 	struct cpu_hw_counters *cpuc = &per_cpu(cpu_hw_counters, cpu);
-	int ret = 0;
-
-	cpuc->throttle_ctrl = intel_pmu_save_disable_all();
 
+	perf_disable();
 	status = intel_pmu_get_status();
-	if (!status)
-		goto out;
+	if (!status) {
+		perf_enable();
+		return 0;
+	}
 
-	ret = 1;
 again:
 	inc_irq_stat(apic_perf_irqs);
 	ack = status;
@@ -767,19 +751,11 @@ again:
 	status = intel_pmu_get_status();
 	if (status)
 		goto again;
-out:
-	/*
-	 * Restore - do not reenable when global enable is off or throttled:
-	 */
-	if (cpuc->throttle_ctrl) {
-		if (++cpuc->interrupts < PERFMON_MAX_INTERRUPTS) {
-			intel_pmu_restore_all(cpuc->throttle_ctrl);
-		} else {
-			pr_info("CPU#%d: perfcounters: max interrupt rate exceeded! Throttle on.\n", smp_processor_id());
-		}
-	}
 
-	return ret;
+	if (++cpuc->interrupts != PERFMON_MAX_INTERRUPTS)
+		perf_enable();
+
+	return 1;
 }
 
 static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
@@ -792,13 +768,11 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 	struct hw_perf_counter *hwc;
 	int idx, throttle = 0;
 
-	cpuc->throttle_ctrl = cpuc->enabled;
-	cpuc->enabled = 0;
-	barrier();
-
-	if (cpuc->throttle_ctrl) {
-		if (++cpuc->interrupts >= PERFMON_MAX_INTERRUPTS)
-			throttle = 1;
+	if (++cpuc->interrupts == PERFMON_MAX_INTERRUPTS) {
+		throttle = 1;
+		__perf_disable();
+		cpuc->enabled = 0;
+		barrier();
 	}
 
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
@@ -824,9 +798,6 @@ next:
 			amd_pmu_disable_counter(hwc, idx);
 	}
 
-	if (cpuc->throttle_ctrl && !throttle)
-		cpuc->enabled = 1;
-
 	return handled;
 }
 
@@ -839,13 +810,11 @@ void perf_counter_unthrottle(void)
 
 	cpuc = &__get_cpu_var(cpu_hw_counters);
 	if (cpuc->interrupts >= PERFMON_MAX_INTERRUPTS) {
-		pr_info("CPU#%d: perfcounters: throttle off.\n", smp_processor_id());
-
 		/*
 		 * Clear them before re-enabling irqs/NMIs again:
 		 */
 		cpuc->interrupts = 0;
-		hw_perf_restore(cpuc->throttle_ctrl);
+		perf_enable();
 	} else {
 		cpuc->interrupts = 0;
 	}
@@ -931,8 +900,8 @@ static __read_mostly struct notifier_block perf_counter_nmi_notifier = {
 static struct x86_pmu intel_pmu = {
 	.name			= "Intel",
 	.handle_irq		= intel_pmu_handle_irq,
-	.save_disable_all	= intel_pmu_save_disable_all,
-	.restore_all		= intel_pmu_restore_all,
+	.disable_all		= intel_pmu_disable_all,
+	.enable_all		= intel_pmu_enable_all,
 	.enable			= intel_pmu_enable_counter,
 	.disable		= intel_pmu_disable_counter,
 	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
@@ -951,8 +920,8 @@ static struct x86_pmu intel_pmu = {
 static struct x86_pmu amd_pmu = {
 	.name			= "AMD",
 	.handle_irq		= amd_pmu_handle_irq,
-	.save_disable_all	= amd_pmu_save_disable_all,
-	.restore_all		= amd_pmu_restore_all,
+	.disable_all		= amd_pmu_disable_all,
+	.enable_all		= amd_pmu_enable_all,
 	.enable			= amd_pmu_enable_counter,
 	.disable		= amd_pmu_disable_counter,
 	.eventsel		= MSR_K7_EVNTSEL0,
@@ -1003,6 +972,8 @@ static int intel_pmu_init(void)
 	x86_pmu.counter_bits = eax.split.bit_width;
 	x86_pmu.counter_mask = (1ULL << eax.split.bit_width) - 1;
 
+	rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
+
 	return 0;
 }
 
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index d2830f3..9645758 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -763,11 +763,9 @@ static int acpi_idle_bm_check(void)
  */
 static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 {
-	u64 perf_flags;
-
 	/* Don't trace irqs off for idle */
 	stop_critical_timings();
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 	if (cx->entry_method == ACPI_CSTATE_FFH) {
 		/* Call into architectural FFH based C-state */
 		acpi_processor_ffh_cstate_enter(cx);
@@ -782,7 +780,7 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 		   gets asserted in time to freeze execution properly. */
 		unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
 	}
-	hw_perf_restore(perf_flags);
+	perf_enable();
 	start_critical_timings();
 }
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 614f921..e543ecc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -544,8 +544,10 @@ extern void perf_counter_exit_task(struct task_struct *child);
 extern void perf_counter_do_pending(void);
 extern void perf_counter_print_debug(void);
 extern void perf_counter_unthrottle(void);
-extern u64 hw_perf_save_disable(void);
-extern void hw_perf_restore(u64 ctrl);
+extern void __perf_disable(void);
+extern bool __perf_enable(void);
+extern void perf_disable(void);
+extern void perf_enable(void);
 extern int perf_counter_task_disable(void);
 extern int perf_counter_task_enable(void);
 extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
@@ -600,8 +602,8 @@ static inline void perf_counter_exit_task(struct task_struct *child)	{ }
 static inline void perf_counter_do_pending(void)			{ }
 static inline void perf_counter_print_debug(void)			{ }
 static inline void perf_counter_unthrottle(void)			{ }
-static inline void hw_perf_restore(u64 ctrl)				{ }
-static inline u64 hw_perf_save_disable(void)		      { return 0; }
+static inline void perf_disable(void)					{ }
+static inline void perf_enable(void)					{ }
 static inline int perf_counter_task_disable(void)	{ return -EINVAL; }
 static inline int perf_counter_task_enable(void)	{ return -EINVAL; }
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 985be0b..e814ff0 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -60,8 +60,9 @@ extern __weak const struct pmu *hw_perf_counter_init(struct perf_counter *counte
 	return NULL;
 }
 
-u64 __weak hw_perf_save_disable(void)		{ return 0; }
-void __weak hw_perf_restore(u64 ctrl)		{ barrier(); }
+void __weak hw_perf_disable(void)		{ barrier(); }
+void __weak hw_perf_enable(void)		{ barrier(); }
+
 void __weak hw_perf_counter_setup(int cpu)	{ barrier(); }
 int __weak hw_perf_group_sched_in(struct perf_counter *group_leader,
 	       struct perf_cpu_context *cpuctx,
@@ -72,6 +73,32 @@ int __weak hw_perf_group_sched_in(struct perf_counter *group_leader,
 
 void __weak perf_counter_print_debug(void)	{ }
 
+static DEFINE_PER_CPU(int, disable_count);
+
+void __perf_disable(void)
+{
+	__get_cpu_var(disable_count)++;
+}
+
+bool __perf_enable(void)
+{
+	return !--__get_cpu_var(disable_count);
+}
+
+void perf_disable(void)
+{
+	__perf_disable();
+	hw_perf_disable();
+}
+EXPORT_SYMBOL_GPL(perf_disable); /* ACPI idle */
+
+void perf_enable(void)
+{
+	if (__perf_enable())
+		hw_perf_enable();
+}
+EXPORT_SYMBOL_GPL(perf_enable); /* ACPI idle */
+
 static void
 list_add_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 {
@@ -170,7 +197,6 @@ static void __perf_counter_remove_from_context(void *info)
 	struct perf_counter *counter = info;
 	struct perf_counter_context *ctx = counter->ctx;
 	unsigned long flags;
-	u64 perf_flags;
 
 	/*
 	 * If this is a task context, we need to check whether it is
@@ -191,9 +217,9 @@ static void __perf_counter_remove_from_context(void *info)
 	 * Protect the list operation against NMI by disabling the
 	 * counters on a global level. NOP for non NMI based counters.
 	 */
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 	list_del_counter(counter, ctx);
-	hw_perf_restore(perf_flags);
+	perf_enable();
 
 	if (!ctx->task) {
 		/*
@@ -538,7 +564,6 @@ static void __perf_install_in_context(void *info)
 	struct perf_counter *leader = counter->group_leader;
 	int cpu = smp_processor_id();
 	unsigned long flags;
-	u64 perf_flags;
 	int err;
 
 	/*
@@ -556,7 +581,7 @@ static void __perf_install_in_context(void *info)
 	 * Protect the list operation against NMI by disabling the
 	 * counters on a global level. NOP for non NMI based counters.
 	 */
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 
 	add_counter_to_ctx(counter, ctx);
 
@@ -596,7 +621,7 @@ static void __perf_install_in_context(void *info)
 		cpuctx->max_pertask--;
 
  unlock:
-	hw_perf_restore(perf_flags);
+	perf_enable();
 
 	spin_unlock_irqrestore(&ctx->lock, flags);
 }
@@ -663,7 +688,6 @@ static void __perf_counter_enable(void *info)
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_counter_context *ctx = counter->ctx;
 	struct perf_counter *leader = counter->group_leader;
-	unsigned long pmuflags;
 	unsigned long flags;
 	int err;
 
@@ -693,14 +717,14 @@ static void __perf_counter_enable(void *info)
 	if (!group_can_go_on(counter, cpuctx, 1)) {
 		err = -EEXIST;
 	} else {
-		pmuflags = hw_perf_save_disable();
+		perf_disable();
 		if (counter == leader)
 			err = group_sched_in(counter, cpuctx, ctx,
 					     smp_processor_id());
 		else
 			err = counter_sched_in(counter, cpuctx, ctx,
 					       smp_processor_id());
-		hw_perf_restore(pmuflags);
+		perf_enable();
 	}
 
 	if (err) {
@@ -795,7 +819,6 @@ void __perf_counter_sched_out(struct perf_counter_context *ctx,
 			      struct perf_cpu_context *cpuctx)
 {
 	struct perf_counter *counter;
-	u64 flags;
 
 	spin_lock(&ctx->lock);
 	ctx->is_active = 0;
@@ -803,12 +826,12 @@ void __perf_counter_sched_out(struct perf_counter_context *ctx,
 		goto out;
 	update_context_time(ctx);
 
-	flags = hw_perf_save_disable();
+	perf_disable();
 	if (ctx->nr_active) {
 		list_for_each_entry(counter, &ctx->counter_list, list_entry)
 			group_sched_out(counter, cpuctx, ctx);
 	}
-	hw_perf_restore(flags);
+	perf_enable();
  out:
 	spin_unlock(&ctx->lock);
 }
@@ -860,7 +883,6 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 			struct perf_cpu_context *cpuctx, int cpu)
 {
 	struct perf_counter *counter;
-	u64 flags;
 	int can_add_hw = 1;
 
 	spin_lock(&ctx->lock);
@@ -870,7 +892,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 
 	ctx->timestamp = perf_clock();
 
-	flags = hw_perf_save_disable();
+	perf_disable();
 
 	/*
 	 * First go through the list and put on any pinned groups
@@ -917,7 +939,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 				can_add_hw = 0;
 		}
 	}
-	hw_perf_restore(flags);
+	perf_enable();
  out:
 	spin_unlock(&ctx->lock);
 }
@@ -955,7 +977,6 @@ int perf_counter_task_disable(void)
 	struct perf_counter_context *ctx = &curr->perf_counter_ctx;
 	struct perf_counter *counter;
 	unsigned long flags;
-	u64 perf_flags;
 
 	if (likely(!ctx->nr_counters))
 		return 0;
@@ -969,7 +990,7 @@ int perf_counter_task_disable(void)
 	/*
 	 * Disable all the counters:
 	 */
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 
 	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
 		if (counter->state != PERF_COUNTER_STATE_ERROR) {
@@ -978,7 +999,7 @@ int perf_counter_task_disable(void)
 		}
 	}
 
-	hw_perf_restore(perf_flags);
+	perf_enable();
 
 	spin_unlock_irqrestore(&ctx->lock, flags);
 
@@ -991,7 +1012,6 @@ int perf_counter_task_enable(void)
 	struct perf_counter_context *ctx = &curr->perf_counter_ctx;
 	struct perf_counter *counter;
 	unsigned long flags;
-	u64 perf_flags;
 	int cpu;
 
 	if (likely(!ctx->nr_counters))
@@ -1007,7 +1027,7 @@ int perf_counter_task_enable(void)
 	/*
 	 * Disable all the counters:
 	 */
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 
 	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
 		if (counter->state > PERF_COUNTER_STATE_OFF)
@@ -1017,7 +1037,7 @@ int perf_counter_task_enable(void)
 			ctx->time - counter->total_time_enabled;
 		counter->hw_event.disabled = 0;
 	}
-	hw_perf_restore(perf_flags);
+	perf_enable();
 
 	spin_unlock(&ctx->lock);
 
@@ -1034,7 +1054,6 @@ int perf_counter_task_enable(void)
 static void rotate_ctx(struct perf_counter_context *ctx)
 {
 	struct perf_counter *counter;
-	u64 perf_flags;
 
 	if (!ctx->nr_counters)
 		return;
@@ -1043,12 +1062,12 @@ static void rotate_ctx(struct perf_counter_context *ctx)
 	/*
 	 * Rotate the first entry last (works just fine for group counters too):
 	 */
-	perf_flags = hw_perf_save_disable();
+	perf_disable();
 	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
 		list_move_tail(&counter->list_entry, &ctx->counter_list);
 		break;
 	}
-	hw_perf_restore(perf_flags);
+	perf_enable();
 
 	spin_unlock(&ctx->lock);
 }
@@ -3194,7 +3213,6 @@ __perf_counter_exit_task(struct task_struct *child,
 	} else {
 		struct perf_cpu_context *cpuctx;
 		unsigned long flags;
-		u64 perf_flags;
 
 		/*
 		 * Disable and unlink this counter.
@@ -3203,7 +3221,7 @@ __perf_counter_exit_task(struct task_struct *child,
 		 * could still be processing it:
 		 */
 		local_irq_save(flags);
-		perf_flags = hw_perf_save_disable();
+		perf_disable();
 
 		cpuctx = &__get_cpu_var(perf_cpu_context);
 
@@ -3214,7 +3232,7 @@ __perf_counter_exit_task(struct task_struct *child,
 
 		child_ctx->nr_counters--;
 
-		hw_perf_restore(perf_flags);
+		perf_enable();
 		local_irq_restore(flags);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Robustify interrupt handling
       [not found]             ` <new-submission>
                                 ` (24 preceding siblings ...)
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable tip-bot for Peter Zijlstra
@ 2009-05-15  8:43               ` tip-bot for Peter Zijlstra
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Disallow interval of 1 tip-bot for Ingo Molnar
                                 ` (681 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-15  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  a4016a79fcbd139e7378944c0d86a39fdbc70ecc
Gitweb:     http://git.kernel.org/tip/a4016a79fcbd139e7378944c0d86a39fdbc70ecc
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 14 May 2009 14:52:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:03 +0200

perf_counter: x86: Robustify interrupt handling

Two consecutive NMIs could daze and confuse the machine when the
first would handle the overflow of both counters.

[ Impact: fix false-positive syslog messages under multi-session profiling ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 313638c..1dcf670 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -783,6 +783,10 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 
 		counter = cpuc->counters[idx];
 		hwc = &counter->hw;
+
+		if (counter->hw_event.nmi != nmi)
+			goto next;
+
 		val = x86_perf_counter_update(counter, hwc, idx);
 		if (val & (1ULL << (x86_pmu.counter_bits - 1)))
 			goto next;
@@ -869,7 +873,6 @@ perf_counter_nmi_handler(struct notifier_block *self,
 {
 	struct die_args *args = __args;
 	struct pt_regs *regs;
-	int ret;
 
 	if (!atomic_read(&active_counters))
 		return NOTIFY_DONE;
@@ -886,9 +889,16 @@ perf_counter_nmi_handler(struct notifier_block *self,
 	regs = args->regs;
 
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
-	ret = x86_pmu.handle_irq(regs, 1);
+	/*
+	 * Can't rely on the handled return value to say it was our NMI, two
+	 * counters could trigger 'simultaneously' raising two back-to-back NMIs.
+	 *
+	 * If the first NMI handles both, the latter will be empty and daze
+	 * the CPU.
+	 */
+	x86_pmu.handle_irq(regs, 1);
 
-	return ret ? NOTIFY_STOP : NOTIFY_OK;
+	return NOTIFY_STOP;
 }
 
 static __read_mostly struct notifier_block perf_counter_nmi_notifier = {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Disallow interval of 1
       [not found]             ` <new-submission>
                                 ` (25 preceding siblings ...)
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Robustify interrupt handling tip-bot for Peter Zijlstra
@ 2009-05-15  8:43               ` tip-bot for Ingo Molnar
  2009-05-15  8:44               ` [tip:perfcounters/core] perf_counter: x86: Protect against infinite loops in intel_pmu_handle_irq() tip-bot for Ingo Molnar
                                 ` (680 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-15  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  1c80f4b598d9b075a2a0be694e28be93a6702bcc
Gitweb:     http://git.kernel.org/tip/1c80f4b598d9b075a2a0be694e28be93a6702bcc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 15 May 2009 08:25:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:05 +0200

perf_counter: x86: Disallow interval of 1

On certain CPUs i have observed a stuck PMU if interval was set to
1 and NMIs were used. The PMU had PMC0 set in MSR_CORE_PERF_GLOBAL_STATUS,
but it was not possible to ack it via MSR_CORE_PERF_GLOBAL_OVF_CTRL,
and the NMI loop got stuck infinitely.

[ Impact: fix rare hangs during high perfcounter load ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 1dcf670..46a82d1 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -473,6 +473,11 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 		left += period;
 		atomic64_set(&hwc->period_left, left);
 	}
+	/*
+	 * Quirk: certain CPUs dont like it if just 1 event is left:
+	 */
+	if (unlikely(left < 2))
+		left = 2;
 
 	per_cpu(prev_left[idx], smp_processor_id()) = left;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Protect against infinite loops in intel_pmu_handle_irq()
       [not found]             ` <new-submission>
                                 ` (26 preceding siblings ...)
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: x86: Disallow interval of 1 tip-bot for Ingo Molnar
@ 2009-05-15  8:44               ` tip-bot for Ingo Molnar
  2009-05-15  8:44               ` [tip:perfcounters/core] perf_counter: Remove ACPI quirk tip-bot for Ingo Molnar
                                 ` (679 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-15  8:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  9029a5e3801f1cc7cdaab80169d82427acf928d8
Gitweb:     http://git.kernel.org/tip/9029a5e3801f1cc7cdaab80169d82427acf928d8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 15 May 2009 08:26:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:06 +0200

perf_counter: x86: Protect against infinite loops in intel_pmu_handle_irq()

intel_pmu_handle_irq() can lock up in an infinite loop if the hardware
does not allow the acking of irqs. Alas, this happened in testing so
make this robust and emit a warning if it happens in the future.

Also, clean up the IRQ handlers a bit.

[ Impact: improve perfcounter irq/nmi handling robustness ]

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 46a82d1..5a7f718 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -722,9 +722,13 @@ static void intel_pmu_save_and_restart(struct perf_counter *counter)
  */
 static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
 {
-	int bit, cpu = smp_processor_id();
+	struct cpu_hw_counters *cpuc;
+	struct cpu_hw_counters;
+	int bit, cpu, loops;
 	u64 ack, status;
-	struct cpu_hw_counters *cpuc = &per_cpu(cpu_hw_counters, cpu);
+
+	cpu = smp_processor_id();
+	cpuc = &per_cpu(cpu_hw_counters, cpu);
 
 	perf_disable();
 	status = intel_pmu_get_status();
@@ -733,7 +737,13 @@ static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
 		return 0;
 	}
 
+	loops = 0;
 again:
+	if (++loops > 100) {
+		WARN_ONCE(1, "perfcounters: irq loop stuck!\n");
+		return 1;
+	}
+
 	inc_irq_stat(apic_perf_irqs);
 	ack = status;
 	for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
@@ -765,13 +775,14 @@ again:
 
 static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 {
-	int cpu = smp_processor_id();
-	struct cpu_hw_counters *cpuc = &per_cpu(cpu_hw_counters, cpu);
-	u64 val;
-	int handled = 0;
+	int cpu, idx, throttle = 0, handled = 0;
+	struct cpu_hw_counters *cpuc;
 	struct perf_counter *counter;
 	struct hw_perf_counter *hwc;
-	int idx, throttle = 0;
+	u64 val;
+
+	cpu = smp_processor_id();
+	cpuc = &per_cpu(cpu_hw_counters, cpu);
 
 	if (++cpuc->interrupts == PERFMON_MAX_INTERRUPTS) {
 		throttle = 1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Remove ACPI quirk
       [not found]             ` <new-submission>
                                 ` (27 preceding siblings ...)
  2009-05-15  8:44               ` [tip:perfcounters/core] perf_counter: x86: Protect against infinite loops in intel_pmu_handle_irq() tip-bot for Ingo Molnar
@ 2009-05-15  8:44               ` tip-bot for Ingo Molnar
  2009-05-15 10:12               ` [tip:perfcounters/core] perf stat: handle Ctrl-C tip-bot for Ingo Molnar
                                 ` (678 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-15  8:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, cjashfor,
	mingo

Commit-ID:  251e8e3c7235f5944805a64f24c79fc4696793f1
Gitweb:     http://git.kernel.org/tip/251e8e3c7235f5944805a64f24c79fc4696793f1
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 14 May 2009 05:16:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 09:47:07 +0200

perf_counter: Remove ACPI quirk

We had a disable/enable around acpi_idle_do_entry() due to an erratum
in an early prototype CPU i had access to. That erratum has been fixed
in the BIOS so remove the quirk.

The quirk also kept us from profiling interrupts that hit the ACPI idle
instruction - so this is an improvement as well, beyond a cleanup and
a micro-optimization.

[ Impact: improve profiling scope, cleanup, micro-optimization ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 drivers/acpi/processor_idle.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 9645758..f7ca8c5 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -765,7 +765,6 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 {
 	/* Don't trace irqs off for idle */
 	stop_critical_timings();
-	perf_disable();
 	if (cx->entry_method == ACPI_CSTATE_FFH) {
 		/* Call into architectural FFH based C-state */
 		acpi_processor_ffh_cstate_enter(cx);
@@ -780,7 +779,6 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 		   gets asserted in time to freeze execution properly. */
 		unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
 	}
-	perf_enable();
 	start_critical_timings();
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: handle Ctrl-C
       [not found]             ` <new-submission>
                                 ` (28 preceding siblings ...)
  2009-05-15  8:44               ` [tip:perfcounters/core] perf_counter: Remove ACPI quirk tip-bot for Ingo Molnar
@ 2009-05-15 10:12               ` tip-bot for Ingo Molnar
  2009-05-28 11:09                 ` Paul Mackerras
  2009-05-18  7:40               ` [tip:perfcounters/core] perf_counter, x86: speed up the scheduling fast-path tip-bot for Ingo Molnar
                                 ` (677 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-15 10:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, tglx,
	cjashfor, mingo

Commit-ID:  58d7e993b16b62d30f8ef27757614056fe4def11
Gitweb:     http://git.kernel.org/tip/58d7e993b16b62d30f8ef27757614056fe4def11
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 15 May 2009 11:03:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 15 May 2009 12:09:54 +0200

perf stat: handle Ctrl-C

Before this change, if a long-running perf stat workload was Ctrl-C-ed,
the utility exited without displaying statistics.

After the change, the Ctrl-C gets propagated into the workload (and
causes its early exit there), but perf stat itself will still continue
to run and will display counter results.

This is useful to run open-ended workloads, let them run for
a while, then Ctrl-C them to get the stats.

[ Impact: extend perf stat with new functionality ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index cf575c3..03518d7 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -538,8 +538,14 @@ static void process_options(int argc, char **argv)
 	}
 }
 
+static void skip_signal(int signo)
+{
+}
+
 int cmd_stat(int argc, char **argv, const char *prefix)
 {
+	sigset_t blocked;
+
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	process_options(argc, argv);
@@ -548,5 +554,15 @@ int cmd_stat(int argc, char **argv, const char *prefix)
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
+	/*
+	 * We dont want to block the signals - that would cause
+	 * child tasks to inherit that and Ctrl-C would not work.
+	 * What we want is for Ctrl-C to work in the exec()-ed
+	 * task, but being ignored by perf stat itself:
+	 */
+	signal(SIGINT,  skip_signal);
+	signal(SIGALRM, skip_signal);
+	signal(SIGABRT, skip_signal);
+
 	return do_perfstat(argc, argv);
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable
  2009-05-15  8:43               ` [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable tip-bot for Peter Zijlstra
@ 2009-05-15 11:05                 ` Paul Mackerras
  2009-05-15 11:23                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Paul Mackerras @ 2009-05-15 11:05 UTC (permalink / raw)
  To: mingo, a.p.zijlstra, linux-kernel, tglx, cjashfor

tip-bot for Peter Zijlstra writes:

> x86 NMI/INT throttling has non-nested use of this, breaking things. Therefore
> provide a reference counter disable/enable interface, where the first disable
> disables the hardware, and the last enable enables the hardware again.

It looks to me like what you've done for powerpc enables the hardware
again on the first enable, not the last one:

> @@ -436,7 +435,7 @@ u64 hw_perf_save_disable(void)
>   * If we were previously disabled and counters were added, then
>   * put the new config on the PMU.
>   */
> -void hw_perf_restore(u64 disable)
> +void hw_perf_enable(void)
>  {
>  	struct perf_counter *counter;
>  	struct cpu_hw_counters *cpuhw;
> @@ -448,9 +447,12 @@ void hw_perf_restore(u64 disable)
>  	int n_lim;
>  	int idx;
>  
> -	if (disable)
> -		return;
>  	local_irq_save(flags);
> +	if (!cpuhw->disabled) {
> +		local_irq_restore(flags);
> +		return;
> +	}
> +
>  	cpuhw = &__get_cpu_var(cpu_hw_counters);
>  	cpuhw->disabled = 0;

I do rely on nesting the disable/enable calls and only having the
hardware re-enabled on the last enable.  I can't see anything here
that detects the last enable.  Have I missed it somewhere?

Paul.

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Rework the perf counter disable/enable
  2009-05-15 11:05                 ` Paul Mackerras
@ 2009-05-15 11:23                   ` Peter Zijlstra
  0 siblings, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-05-15 11:23 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: mingo, linux-kernel, tglx, cjashfor

On Fri, 2009-05-15 at 21:05 +1000, Paul Mackerras wrote:
> tip-bot for Peter Zijlstra writes:
> 
> > x86 NMI/INT throttling has non-nested use of this, breaking things. Therefore
> > provide a reference counter disable/enable interface, where the first disable
> > disables the hardware, and the last enable enables the hardware again.
> 
> It looks to me like what you've done for powerpc enables the hardware
> again on the first enable, not the last one:
> 
> > @@ -436,7 +435,7 @@ u64 hw_perf_save_disable(void)
> >   * If we were previously disabled and counters were added, then
> >   * put the new config on the PMU.
> >   */
> > -void hw_perf_restore(u64 disable)
> > +void hw_perf_enable(void)
> >  {
> >  	struct perf_counter *counter;
> >  	struct cpu_hw_counters *cpuhw;
> > @@ -448,9 +447,12 @@ void hw_perf_restore(u64 disable)
> >  	int n_lim;
> >  	int idx;
> >  
> > -	if (disable)
> > -		return;
> >  	local_irq_save(flags);
> > +	if (!cpuhw->disabled) {
> > +		local_irq_restore(flags);
> > +		return;
> > +	}
> > +
> >  	cpuhw = &__get_cpu_var(cpu_hw_counters);
> >  	cpuhw->disabled = 0;
> 
> I do rely on nesting the disable/enable calls and only having the
> hardware re-enabled on the last enable.  I can't see anything here
> that detects the last enable.  Have I missed it somewhere?

+void perf_disable(void)
+{
+       __perf_disable();
+       hw_perf_disable();
+}

+void perf_enable(void)
+{
+       if (__perf_enable())
+               hw_perf_enable();
+}




^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: speed up the scheduling fast-path
       [not found]             ` <new-submission>
                                 ` (29 preceding siblings ...)
  2009-05-15 10:12               ` [tip:perfcounters/core] perf stat: handle Ctrl-C tip-bot for Ingo Molnar
@ 2009-05-18  7:40               ` tip-bot for Ingo Molnar
  2009-05-20 18:15               ` [tip:perfcounters/core] perf_counter: Fix context removal deadlock tip-bot for Ingo Molnar
                                 ` (676 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-18  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, mtosatti,
	vatsa, tglx, cjashfor, mingo

Commit-ID:  b68f1d2e7aa21029d73c7d453a8046e95d351740
Gitweb:     http://git.kernel.org/tip/b68f1d2e7aa21029d73c7d453a8046e95d351740
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 17 May 2009 19:37:25 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 18 May 2009 09:37:09 +0200

perf_counter, x86: speed up the scheduling fast-path

We have to set up the LVT entry only at counter init time, not at
every switch-in time.

There's friction between NMI and non-NMI use here - we'll probably
remove the per counter configurability of it - but until then, dont
slow down things ...

[ Impact: micro-optimization ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 5bfd30a..c109819 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -285,6 +285,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 			return -EACCES;
 		hwc->nmi = 1;
 	}
+	perf_counters_lapic_init(hwc->nmi);
 
 	if (!hwc->irq_period)
 		hwc->irq_period = x86_pmu.max_period;
@@ -603,8 +604,6 @@ try_generic:
 		hwc->counter_base = x86_pmu.perfctr;
 	}
 
-	perf_counters_lapic_init(hwc->nmi);
-
 	x86_pmu.disable(hwc, idx);
 
 	cpuc->counters[idx] = counter;
@@ -1054,7 +1053,7 @@ void __init init_hw_perf_counters(void)
 
 	pr_info("... counter mask:    %016Lx\n", perf_counter_mask);
 
-	perf_counters_lapic_init(0);
+	perf_counters_lapic_init(1);
 	register_die_notifier(&perf_counter_nmi_notifier);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix context removal deadlock
       [not found]             ` <new-submission>
                                 ` (30 preceding siblings ...)
  2009-05-18  7:40               ` [tip:perfcounters/core] perf_counter, x86: speed up the scheduling fast-path tip-bot for Ingo Molnar
@ 2009-05-20 18:15               ` tip-bot for Ingo Molnar
  2009-05-22 16:21               ` [tip:perfcounters/core] perf_counter tools: increase limits tip-bot for Ingo Molnar
                                 ` (675 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-20 18:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, mtosatti, tglx,
	cjashfor, mingo

Commit-ID:  34adc8062227f41b04ade0ff3fbd1dbe3002669e
Gitweb:     http://git.kernel.org/tip/34adc8062227f41b04ade0ff3fbd1dbe3002669e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 20 May 2009 20:13:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 20 May 2009 20:12:54 +0200

perf_counter: Fix context removal deadlock

Disable the PMU globally before removing a counter from a
context. This fixes the following lockup:

[22081.741922] ------------[ cut here ]------------
[22081.746668] WARNING: at arch/x86/kernel/cpu/perf_counter.c:803 intel_pmu_handle_irq+0x9b/0x24e()
[22081.755624] Hardware name: X8DTN
[22081.758903] perfcounters: irq loop stuck!
[22081.762985] Modules linked in:
[22081.766136] Pid: 11082, comm: perf Not tainted 2.6.30-rc6-tip #226
[22081.772432] Call Trace:
[22081.774940]  <NMI>  [<ffffffff81019aed>] ? intel_pmu_handle_irq+0x9b/0x24e
[22081.781993]  [<ffffffff81019aed>] ? intel_pmu_handle_irq+0x9b/0x24e
[22081.788368]  [<ffffffff8104505c>] ? warn_slowpath_common+0x77/0xa3
[22081.794649]  [<ffffffff810450d3>] ? warn_slowpath_fmt+0x40/0x45
[22081.800696]  [<ffffffff81019aed>] ? intel_pmu_handle_irq+0x9b/0x24e
[22081.807080]  [<ffffffff814d1a72>] ? perf_counter_nmi_handler+0x3f/0x4a
[22081.813751]  [<ffffffff814d2d09>] ? notifier_call_chain+0x58/0x86
[22081.819951]  [<ffffffff8105b250>] ? notify_die+0x2d/0x32
[22081.825392]  [<ffffffff814d1414>] ? do_nmi+0x8e/0x242
[22081.830538]  [<ffffffff814d0f0a>] ? nmi+0x1a/0x20
[22081.835342]  [<ffffffff8117e102>] ? selinux_file_free_security+0x0/0x1a
[22081.842105]  [<ffffffff81018793>] ? x86_pmu_disable_counter+0x15/0x41
[22081.848673]  <<EOE>>  [<ffffffff81018f3d>] ? x86_pmu_disable+0x86/0x103
[22081.855512]  [<ffffffff8108fedd>] ? __perf_counter_remove_from_context+0x0/0xfe
[22081.862926]  [<ffffffff8108fcbc>] ? counter_sched_out+0x30/0xce
[22081.868909]  [<ffffffff8108ff36>] ? __perf_counter_remove_from_context+0x59/0xfe
[22081.876382]  [<ffffffff8106808a>] ? smp_call_function_single+0x6c/0xe6
[22081.882955]  [<ffffffff81091b96>] ? perf_release+0x86/0x14c
[22081.888600]  [<ffffffff810c4c84>] ? __fput+0xe7/0x195
[22081.893718]  [<ffffffff810c213e>] ? filp_close+0x5b/0x62
[22081.899107]  [<ffffffff81046a70>] ? put_files_struct+0x64/0xc2
[22081.905031]  [<ffffffff8104841a>] ? do_exit+0x1e2/0x6ef
[22081.910360]  [<ffffffff814d0a60>] ? _spin_lock_irqsave+0x9/0xe
[22081.916292]  [<ffffffff8104898e>] ? do_group_exit+0x67/0x93
[22081.921953]  [<ffffffff810489cc>] ? sys_exit_group+0x12/0x16
[22081.927759]  [<ffffffff8100baab>] ? system_call_fastpath+0x16/0x1b
[22081.934076] ---[ end trace 3a3936ce3e1b4505 ]---

And could potentially also fix the lockup reported by Marcelo Tosatti.

Also, print more debug info in case of a detected lockup.

[ Impact: fix lockup ]

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    1 +
 kernel/perf_counter.c              |   12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index c109819..6cc1660 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -740,6 +740,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
 again:
 	if (++loops > 100) {
 		WARN_ONCE(1, "perfcounters: irq loop stuck!\n");
+		perf_counter_print_debug();
 		return 1;
 	}
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 69d4de8..08584c1 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -208,18 +208,17 @@ static void __perf_counter_remove_from_context(void *info)
 		return;
 
 	spin_lock_irqsave(&ctx->lock, flags);
+	/*
+	 * Protect the list operation against NMI by disabling the
+	 * counters on a global level.
+	 */
+	perf_disable();
 
 	counter_sched_out(counter, cpuctx, ctx);
 
 	counter->task = NULL;
 
-	/*
-	 * Protect the list operation against NMI by disabling the
-	 * counters on a global level. NOP for non NMI based counters.
-	 */
-	perf_disable();
 	list_del_counter(counter, ctx);
-	perf_enable();
 
 	if (!ctx->task) {
 		/*
@@ -231,6 +230,7 @@ static void __perf_counter_remove_from_context(void *info)
 			    perf_max_counters - perf_reserved_percpu);
 	}
 
+	perf_enable();
 	spin_unlock_irqrestore(&ctx->lock, flags);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: increase limits
       [not found]             ` <new-submission>
                                 ` (31 preceding siblings ...)
  2009-05-20 18:15               ` [tip:perfcounters/core] perf_counter: Fix context removal deadlock tip-bot for Ingo Molnar
@ 2009-05-22 16:21               ` tip-bot for Ingo Molnar
  2009-05-24  7:02               ` [tip:perfcounters/core] perf top: fix segfault tip-bot for Mike Galbraith
                                 ` (674 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-22 16:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  c6eb13847ba081552d2af644219bddeff7110caf
Gitweb:     http://git.kernel.org/tip/c6eb13847ba081552d2af644219bddeff7110caf
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 22 May 2009 18:18:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 22 May 2009 18:18:28 +0200

perf_counter tools: increase limits

I tried to run with 300 active counters and the tools bailed out
because our limit was at 64. So increase the counter limit to 1024
and the CPU limit to 4096.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/perf.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h
index 6fa3656..81a7374 100644
--- a/Documentation/perf_counter/perf.h
+++ b/Documentation/perf_counter/perf.h
@@ -54,8 +54,8 @@ sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr,
 		       group_fd, flags);
 }
 
-#define MAX_COUNTERS			64
-#define MAX_NR_CPUS			256
+#define MAX_COUNTERS			1024
+#define MAX_NR_CPUS			4096
 
 #define EID(type, id) (((__u64)(type) << PERF_COUNTER_TYPE_SHIFT) | (id))
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: fix segfault
       [not found]             ` <new-submission>
                                 ` (32 preceding siblings ...)
  2009-05-22 16:21               ` [tip:perfcounters/core] perf_counter tools: increase limits tip-bot for Ingo Molnar
@ 2009-05-24  7:02               ` tip-bot for Mike Galbraith
  2009-05-25  3:39               ` [tip:perfcounters/core] perf_counter: Increase mmap limit tip-bot for Ingo Molnar
                                 ` (673 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-24  7:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, tglx, cjashfor, mingo

Commit-ID:  c2990a2a582d73562d4dcf2502c39892a19a691d
Gitweb:     http://git.kernel.org/tip/c2990a2a582d73562d4dcf2502c39892a19a691d
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Sun, 24 May 2009 08:35:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 24 May 2009 08:57:08 +0200

perf top: fix segfault

c6eb13 increased stack usage such that perf-top now croaks on startup.

Take event_array and mmap_array off the stack to prevent segfault on boxen
with smallish ulimit -s setting.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index a3216a6..74021ac 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -1035,10 +1035,11 @@ static void mmap_read(struct mmap_data *md)
 	md->prev = old;
 }
 
+static struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
+static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
+
 int cmd_top(int argc, char **argv, const char *prefix)
 {
-	struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
-	struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 	struct perf_counter_hw_event hw_event;
 	pthread_t thread;
 	int i, counter, group_fd, nr_poll = 0;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Increase mmap limit
       [not found]             ` <new-submission>
                                 ` (33 preceding siblings ...)
  2009-05-24  7:02               ` [tip:perfcounters/core] perf top: fix segfault tip-bot for Mike Galbraith
@ 2009-05-25  3:39               ` tip-bot for Ingo Molnar
  2009-05-25  8:03               ` [tip:perfcounters/core] perf_counter tools: increase limits, fix tip-bot for Ingo Molnar
                                 ` (672 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-25  3:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, tglx, cjashfor, mingo

Commit-ID:  a3862d3f814ce7dfca9eed56ac23d29db3aee8d5
Gitweb:     http://git.kernel.org/tip/a3862d3f814ce7dfca9eed56ac23d29db3aee8d5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 24 May 2009 09:02:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 24 May 2009 09:02:37 +0200

perf_counter: Increase mmap limit

In a default 'perf top' run the tool will create a counter for
each online CPU. With enough CPUs this will eventually exhaust
the default limit.

So scale it up with the number of online CPUs.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index cb40625..6cdf824 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1704,6 +1704,12 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	user_extra = nr_pages + 1;
 	user_lock_limit = sysctl_perf_counter_mlock >> (PAGE_SHIFT - 10);
+
+	/*
+	 * Increase the limit linearly with more CPUs:
+	 */
+	user_lock_limit *= num_online_cpus();
+
 	user_locked = atomic_long_read(&user->locked_vm) + user_extra;
 
 	extra = 0;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: increase limits, fix
       [not found]             ` <new-submission>
                                 ` (34 preceding siblings ...)
  2009-05-25  3:39               ` [tip:perfcounters/core] perf_counter: Increase mmap limit tip-bot for Ingo Molnar
@ 2009-05-25  8:03               ` tip-bot for Ingo Molnar
  2009-05-25 11:03               ` [tip:perfcounters/core] perf top: Reduce display overhead tip-bot for Mike Galbraith
                                 ` (671 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-25  8:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, tglx, cjashfor, mingo

Commit-ID:  85a9f9200226ddffc2ea50dae6a8df04c033ecd4
Gitweb:     http://git.kernel.org/tip/85a9f9200226ddffc2ea50dae6a8df04c033ecd4
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 25 May 2009 09:59:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 25 May 2009 09:59:50 +0200

perf_counter tools: increase limits, fix

NR_CPUS and NR_COUNTERS goes up quadratic ... 1024x4096 was far
too ambitious upper limit - go for 256x256 which is still plenty.

[ Impact: reduce perf tool memory consumption ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/perf.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h
index a517683..5a2520b 100644
--- a/Documentation/perf_counter/perf.h
+++ b/Documentation/perf_counter/perf.h
@@ -61,8 +61,8 @@ sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr,
 		       group_fd, flags);
 }
 
-#define MAX_COUNTERS			1024
-#define MAX_NR_CPUS			4096
+#define MAX_COUNTERS			256
+#define MAX_NR_CPUS			256
 
 #define EID(type, id) (((__u64)(type) << PERF_COUNTER_TYPE_SHIFT) | (id))
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: Reduce display overhead
       [not found]             ` <new-submission>
                                 ` (35 preceding siblings ...)
  2009-05-25  8:03               ` [tip:perfcounters/core] perf_counter tools: increase limits, fix tip-bot for Ingo Molnar
@ 2009-05-25 11:03               ` tip-bot for Mike Galbraith
  2009-05-25 11:06               ` [tip:perfcounters/core] perf_counter: Move child perfcounter init to after scheduler init tip-bot for Ingo Molnar
                                 ` (670 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-25 11:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  d94b943054721c346b0881865d645f000cd19880
Gitweb:     http://git.kernel.org/tip/d94b943054721c346b0881865d645f000cd19880
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Mon, 25 May 2009 09:57:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 25 May 2009 13:01:17 +0200

perf top: Reduce display overhead

Iterate over the symbol table once per display interval, and
copy/sort/tally/decay only those symbols which are active.

Before:

 top - 10:14:53 up  4:08, 17 users,  load average: 1.17, 1.53, 1.49
 Tasks: 273 total,   5 running, 268 sleeping,   0 stopped,   0 zombie
 Cpu(s):  6.9%us, 38.2%sy,  0.0%ni, 19.9%id,  0.0%wa,  0.0%hi, 35.0%si,  0.0%st

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  P COMMAND
 28504 root      20   0  1044  260  164 S   58  0.0   0:04.19 2 netserver
 28499 root      20   0  1040  412  316 R   51  0.0   0:04.15 0 netperf
 28500 root      20   0  1040  408  316 R   50  0.0   0:04.14 1 netperf
 28503 root      20   0  1044  260  164 S   50  0.0   0:04.01 1 netserver
 28501 root      20   0  1044  260  164 S   49  0.0   0:03.99 0 netserver
 28502 root      20   0  1040  412  316 S   43  0.0   0:03.96 2 netperf
 28468 root      20   0 1892m 325m  972 S   16 10.8   0:10.50 3 perf
 28467 root      20   0 1892m 325m  972 R    2 10.8   0:00.72 3 perf

After:

 top - 10:16:30 up  4:10, 17 users,  load average: 2.27, 1.88, 1.62
 Tasks: 273 total,   6 running, 267 sleeping,   0 stopped,   0 zombie
 Cpu(s):  2.5%us, 39.7%sy,  0.0%ni, 24.6%id,  0.0%wa,  0.0%hi, 33.3%si,  0.0%st

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  P COMMAND
 28590 root      20   0  1040  412  316 S   54  0.0   0:07.85 2 netperf
 28589 root      20   0  1044  260  164 R   54  0.0   0:07.84 0 netserver
 28588 root      20   0  1040  412  316 R   50  0.0   0:07.89 1 netperf
 28591 root      20   0  1044  256  164 S   50  0.0   0:07.82 1 netserver
 28587 root      20   0  1040  408  316 R   47  0.0   0:07.61 0 netperf
 28592 root      20   0  1044  260  164 R   47  0.0   0:07.85 2 netserver
 28378 root      20   0  8732 1300  860 R    2  0.0   0:01.81 3 top
 28577 root      20   0 1892m 165m  972 R    2  5.5   0:00.48 3 perf
 28578 root      20   0 1892m 165m  972 S    2  5.5   0:00.04 3 perf

[ Impact: optimization ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |   56 +++++++++++++++--------------
 1 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 74021ac..4bed265 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -374,18 +374,26 @@ static struct sym_entry		tmp[MAX_SYMS];
 
 static void print_sym_table(void)
 {
-	int i, printed;
+	int i, j, active_count, printed;
 	int counter;
 	float events_per_sec = events/delay_secs;
 	float kevents_per_sec = (events-userspace_events)/delay_secs;
 	float sum_kevents = 0.0;
 
 	events = userspace_events = 0;
-	memcpy(tmp, sym_table, sizeof(sym_table[0])*sym_table_count);
-	qsort(tmp, sym_table_count, sizeof(tmp[0]), compare);
 
-	for (i = 0; i < sym_table_count && tmp[i].count[0]; i++)
-		sum_kevents += tmp[i].count[0];
+	/* Iterate over symbol table and copy/tally/decay active symbols. */
+	for (i = 0, active_count = 0; i < sym_table_count; i++) {
+		if (sym_table[i].count[0]) {
+			tmp[active_count++] = sym_table[i];
+			sum_kevents += sym_table[i].count[0];
+
+			for (j = 0; j < nr_counters; j++)
+				sym_table[i].count[j] = zero ? 0 : sym_table[i].count[j] * 7 / 8;
+		}
+	}
+
+	qsort(tmp, active_count + 1, sizeof(tmp[0]), compare);
 
 	write(1, CONSOLE_CLEAR, strlen(CONSOLE_CLEAR));
 
@@ -433,29 +441,23 @@ static void print_sym_table(void)
 	       	       "  ______     ______   _____   ________________   _______________\n\n"
 	);
 
-	for (i = 0, printed = 0; i < sym_table_count; i++) {
+	for (i = 0, printed = 0; i < active_count; i++) {
 		float pcnt;
-		int count;
 
-		if (printed <= 18 && tmp[i].count[0] >= count_filter) {
-			pcnt = 100.0 - (100.0*((sum_kevents-tmp[i].count[0])/sum_kevents));
-
-			if (nr_counters == 1)
-				printf("%19.2f - %4.1f%% - %016llx : %s\n",
-					sym_weight(tmp + i),
-					pcnt, tmp[i].addr, tmp[i].sym);
-			else
-				printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
-					sym_weight(tmp + i),
-					tmp[i].count[0],
-					pcnt, tmp[i].addr, tmp[i].sym);
-			printed++;
-		}
-		/*
-		 * Add decay to the counts:
-		 */
-		for (count = 0; count < nr_counters; count++)
-			sym_table[i].count[count] = zero ? 0 : sym_table[i].count[count] * 7 / 8;
+		if (++printed > 18 || tmp[i].count[0] < count_filter)
+			break;
+
+		pcnt = 100.0 - (100.0*((sum_kevents-tmp[i].count[0])/sum_kevents));
+
+		if (nr_counters == 1)
+			printf("%19.2f - %4.1f%% - %016llx : %s\n",
+				sym_weight(tmp + i),
+				pcnt, tmp[i].addr, tmp[i].sym);
+		else
+			printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
+				sym_weight(tmp + i),
+				tmp[i].count[0],
+				pcnt, tmp[i].addr, tmp[i].sym);
 	}
 
 	if (sym_filter_entry)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Move child perfcounter init to after scheduler init
       [not found]             ` <new-submission>
                                 ` (36 preceding siblings ...)
  2009-05-25 11:03               ` [tip:perfcounters/core] perf top: Reduce display overhead tip-bot for Mike Galbraith
@ 2009-05-25 11:06               ` tip-bot for Ingo Molnar
  2009-05-25 12:45               ` [tip:perfcounters/core] perf stat: flip around ':k' and ':u' flags tip-bot for Ingo Molnar
                                 ` (669 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-25 11:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, tglx, cjashfor, mingo

Commit-ID:  e4cbb4e3ac8b09fdb11e39e5a5611bfab0a7cd1a
Gitweb:     http://git.kernel.org/tip/e4cbb4e3ac8b09fdb11e39e5a5611bfab0a7cd1a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 19 May 2009 15:50:30 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 25 May 2009 13:05:06 +0200

perf_counter: Move child perfcounter init to after scheduler init

Initialize a task's perfcounters (inherit from parent, etc.) after
the child task's scheduler fields have been initialized already.

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/fork.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index e72a09f..675e01e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -984,7 +984,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 		goto fork_out;
 
 	rt_mutex_init_task(p);
-	perf_counter_init_task(p);
 
 #ifdef CONFIG_PROVE_LOCKING
 	DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
@@ -1096,6 +1095,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
 	/* Perform scheduler related setup. Assign this task to a CPU. */
 	sched_fork(p, clone_flags);
+	perf_counter_init_task(p);
 
 	if ((retval = audit_alloc(p)))
 		goto bad_fork_cleanup_policy;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: flip around ':k' and ':u' flags
       [not found]             ` <new-submission>
                                 ` (37 preceding siblings ...)
  2009-05-25 11:06               ` [tip:perfcounters/core] perf_counter: Move child perfcounter init to after scheduler init tip-bot for Ingo Molnar
@ 2009-05-25 12:45               ` tip-bot for Ingo Molnar
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter, x86: Fix APIC NMI programming tip-bot for Ingo Molnar
                                 ` (668 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-25 12:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, tglx, cjashfor, mingo

Commit-ID:  d3f4b3855ba87caff8f35e738c7e7e3bad0a6ab1
Gitweb:     http://git.kernel.org/tip/d3f4b3855ba87caff8f35e738c7e7e3bad0a6ab1
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 25 May 2009 14:40:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 25 May 2009 14:40:01 +0200

perf stat: flip around ':k' and ':u' flags

This output:

 $ perf stat -e 0:1:k -e 0:1:u ./hello
  Performance counter stats for './hello':
          140131  instructions         (events)
         1906968  instructions         (events)

Is quite confusing - as :k means "user instructions", :u means
"kernel instructions".

Flip them around - as the 'exclude' property is not intuitive in
the flag naming.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 8ae01d5..88c70be 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -266,9 +266,9 @@ static __u64 match_event_symbols(char *str)
 
 	switch (sscanf(str, "%d:%llu:%2s", &type, &id, mask_str)) {
 		case 3:
-			if (strchr(mask_str, 'u'))
-				event_mask[nr_counters] |= EVENT_MASK_USER;
 			if (strchr(mask_str, 'k'))
+				event_mask[nr_counters] |= EVENT_MASK_USER;
+			if (strchr(mask_str, 'u'))
 				event_mask[nr_counters] |= EVENT_MASK_KERNEL;
 		case 2:
 			return EID(type, id);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Fix APIC NMI programming
       [not found]             ` <new-submission>
                                 ` (38 preceding siblings ...)
  2009-05-25 12:45               ` [tip:perfcounters/core] perf stat: flip around ':k' and ':u' flags tip-bot for Ingo Molnar
@ 2009-05-26  7:57               ` tip-bot for Ingo Molnar
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter, x86: Make NMI lockups more robust tip-bot for Ingo Molnar
                                 ` (667 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26  7:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  79202ba9ff8cf570a75596f42e011167734d1c4b
Gitweb:     http://git.kernel.org/tip/79202ba9ff8cf570a75596f42e011167734d1c4b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 08:10:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 09:49:28 +0200

perf_counter, x86: Fix APIC NMI programming

My Nehalem box locks up in certain situations (with an
always-asserted NMI causing a lockup) if the PMU LVT
entry is programmed between NMI and IRQ mode with a
high frequency.

Standardize exlusively on NMIs instead.

[ Impact: fix lockup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 189bf9d..ece3813 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -285,14 +285,10 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 		hwc->config |= ARCH_PERFMON_EVENTSEL_OS;
 
 	/*
-	 * If privileged enough, allow NMI events:
+	 * Use NMI events all the time:
 	 */
-	hwc->nmi = 0;
-	if (hw_event->nmi) {
-		if (sysctl_perf_counter_priv && !capable(CAP_SYS_ADMIN))
-			return -EACCES;
-		hwc->nmi = 1;
-	}
+	hwc->nmi	= 1;
+	hw_event->nmi	= 1;
 
 	if (!hwc->irq_period)
 		hwc->irq_period = x86_pmu.max_period;
@@ -553,9 +549,6 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
 	if (!x86_pmu.num_counters_fixed)
 		return -1;
 
-	if (unlikely(hwc->nmi))
-		return -1;
-
 	event = hwc->config & ARCH_PERFMON_EVENT_MASK;
 
 	if (unlikely(event == x86_pmu.event_map(PERF_COUNT_INSTRUCTIONS)))
@@ -806,9 +799,6 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 		counter = cpuc->counters[idx];
 		hwc = &counter->hw;
 
-		if (counter->hw_event.nmi != nmi)
-			continue;
-
 		val = x86_perf_counter_update(counter, hwc, idx);
 		if (val & (1ULL << (x86_pmu.counter_bits - 1)))
 			continue;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Make NMI lockups more robust
       [not found]             ` <new-submission>
                                 ` (39 preceding siblings ...)
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter, x86: Fix APIC NMI programming tip-bot for Ingo Molnar
@ 2009-05-26  7:57               ` tip-bot for Ingo Molnar
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter: Initialize ->oncpu properly tip-bot for Ingo Molnar
                                 ` (666 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26  7:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  aaba98018b8295dfa2119345d17f833d74448cd0
Gitweb:     http://git.kernel.org/tip/aaba98018b8295dfa2119345d17f833d74448cd0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 08:10:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 09:52:03 +0200

perf_counter, x86: Make NMI lockups more robust

We have a debug check that detects stuck NMIs and returns with
the PMU disabled in the global ctrl MSR - but i managed to trigger
a situation where this was not enough to deassert the NMI.

So clear/reset the full PMU and keep the disable count balanced when
exiting from here. This way the box produces a debug warning but
stays up and is more debuggable.

[ Impact: in case of PMU related bugs, recover more gracefully ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index ece3813..2eeaa99 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -724,6 +724,30 @@ static void intel_pmu_save_and_restart(struct perf_counter *counter)
 		intel_pmu_enable_counter(hwc, idx);
 }
 
+static void intel_pmu_reset(void)
+{
+	unsigned long flags;
+	int idx;
+
+	if (!x86_pmu.num_counters)
+		return;
+
+	local_irq_save(flags);
+
+	printk("clearing PMU state on CPU#%d\n", smp_processor_id());
+
+	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
+		checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
+		checking_wrmsrl(x86_pmu.perfctr  + idx, 0ull);
+	}
+	for (idx = 0; idx < x86_pmu.num_counters_fixed; idx++) {
+		checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
+	}
+
+	local_irq_restore(flags);
+}
+
+
 /*
  * This handler is triggered by the local APIC, so the APIC IRQ handling
  * rules apply:
@@ -750,6 +774,8 @@ again:
 	if (++loops > 100) {
 		WARN_ONCE(1, "perfcounters: irq loop stuck!\n");
 		perf_counter_print_debug();
+		intel_pmu_reset();
+		perf_enable();
 		return 1;
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Initialize ->oncpu properly
       [not found]             ` <new-submission>
                                 ` (40 preceding siblings ...)
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter, x86: Make NMI lockups more robust tip-bot for Ingo Molnar
@ 2009-05-26  7:57               ` tip-bot for Ingo Molnar
  2009-05-26 10:33               ` [tip:perfcounters/core] perf record: Straighten out argv types tip-bot for Ingo Molnar
                                 ` (665 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26  7:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  329d876d6fd326109f191ae0fb2798b8834fb70b
Gitweb:     http://git.kernel.org/tip/329d876d6fd326109f191ae0fb2798b8834fb70b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 08:10:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 09:54:13 +0200

perf_counter: Initialize ->oncpu properly

This shouldnt matter normally (and i have not seen any
misbehavior), because active counters always have a
proper ->oncpu value - but nevertheless initialize the
field properly to -1.

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 070f92d..367299f 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3122,6 +3122,8 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,
 	counter->group_leader		= group_leader;
 	counter->pmu			= NULL;
 	counter->ctx			= ctx;
+	counter->oncpu			= -1;
+
 	get_ctx(ctx);
 
 	counter->state = PERF_COUNTER_STATE_INACTIVE;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Straighten out argv types
       [not found]             ` <new-submission>
                                 ` (41 preceding siblings ...)
  2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter: Initialize ->oncpu properly tip-bot for Ingo Molnar
@ 2009-05-26 10:33               ` tip-bot for Ingo Molnar
  2009-05-26 10:34               ` [tip:perfcounters/core] perf stat: Remove unused variable tip-bot for Ingo Molnar
                                 ` (664 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 10:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  69aa48ab82e17299efe2be6c21795945731a6c17
Gitweb:     http://git.kernel.org/tip/69aa48ab82e17299efe2be6c21795945731a6c17
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:02:27 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 10:05:56 +0200

perf record: Straighten out argv types

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 1b19f18..f225efa 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -191,7 +191,7 @@ static void display_help(void)
 	exit(0);
 }
 
-static void process_options(int argc, const char *argv[])
+static void process_options(int argc, char * const argv[])
 {
 	int error = 0, counter;
 
@@ -538,7 +538,7 @@ static void open_counters(int cpu, pid_t pid)
 	nr_cpu++;
 }
 
-int cmd_record(int argc, const char **argv)
+int cmd_record(int argc, char * const argv[])
 {
 	int i, counter;
 	pid_t pid;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Remove unused variable
       [not found]             ` <new-submission>
                                 ` (42 preceding siblings ...)
  2009-05-26 10:33               ` [tip:perfcounters/core] perf record: Straighten out argv types tip-bot for Ingo Molnar
@ 2009-05-26 10:34               ` tip-bot for Ingo Molnar
  2009-05-26 10:34               ` [tip:perfcounters/core] perf record: Convert to Git option parsing tip-bot for Ingo Molnar
                                 ` (663 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 10:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  4e97ddf09ee3ce715fc334399bae4cc0c0a13057
Gitweb:     http://git.kernel.org/tip/4e97ddf09ee3ce715fc334399bae4cc0c0a13057
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 10:07:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 10:08:19 +0200

perf stat: Remove unused variable

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 88c70be..c1053d8 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -541,8 +541,6 @@ static void skip_signal(int signo)
 
 int cmd_stat(int argc, char **argv, const char *prefix)
 {
-	sigset_t blocked;
-
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	process_options(argc, argv);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Convert to Git option parsing
       [not found]             ` <new-submission>
                                 ` (43 preceding siblings ...)
  2009-05-26 10:34               ` [tip:perfcounters/core] perf stat: Remove unused variable tip-bot for Ingo Molnar
@ 2009-05-26 10:34               ` tip-bot for Ingo Molnar
  2009-05-26 10:34               ` [tip:perfcounters/core] perf_counter tools: Librarize event string parsing tip-bot for Ingo Molnar
                                 ` (662 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 10:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  0e9b20b8a1cab6c6ab4f98f917a2d98783103969
Gitweb:     http://git.kernel.org/tip/0e9b20b8a1cab6c6ab4f98f917a2d98783103969
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:17:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 11:26:32 +0200

perf record: Convert to Git option parsing

Remove getopt usage and use Git's much more advanced and more compact
command option library.

Git's library (util/parse-options.[ch]) constructs help texts and
error messages automatically, and has a number of other convenience
features as well.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |  372 +++++++++++++--------------
 Documentation/perf_counter/builtin-top.c    |    3 +
 2 files changed, 177 insertions(+), 198 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index f225efa..f12a782 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -2,6 +2,8 @@
 
 #include "perf.h"
 #include "util/util.h"
+#include "util/parse-options.h"
+#include "util/exec_cmd.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -11,7 +13,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
-#include <getopt.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -33,8 +34,8 @@
 
 
 
-#define ALIGN(x,a)		__ALIGN_MASK(x,(typeof(x))(a)-1)
-#define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
+#define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a)-1)
+#define __ALIGN_MASK(x, mask)	(((x)+(mask))&~(mask))
 
 static int			nr_counters			=  0;
 static __u64			event_id[MAX_COUNTERS]		= { };
@@ -45,7 +46,7 @@ static int			nr_cpus				=  0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			= 16;
 static int			output;
-static char 			*output_name			= "output.perf";
+static const char		*output_name			= "output.perf";
 static int			group				= 0;
 static unsigned int		realtime_prio			= 0;
 static int			system_wide			= 0;
@@ -62,192 +63,6 @@ const unsigned int default_count[] = {
 	  10000,
 };
 
-struct event_symbol {
-	__u64 event;
-	char *symbol;
-};
-
-static struct event_symbol event_symbols[] = {
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
-
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
-};
-
-/*
- * Each event can have multiple symbolic names.
- * Symbolic names are (almost) exactly matched.
- */
-static __u64 match_event_symbols(char *str)
-{
-	__u64 config, id;
-	int type;
-	unsigned int i;
-
-	if (sscanf(str, "r%llx", &config) == 1)
-		return config | PERF_COUNTER_RAW_MASK;
-
-	if (sscanf(str, "%d:%llu", &type, &id) == 2)
-		return EID(type, id);
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		if (!strncmp(str, event_symbols[i].symbol,
-			     strlen(event_symbols[i].symbol)))
-			return event_symbols[i].event;
-	}
-
-	return ~0ULL;
-}
-
-static int parse_events(char *str)
-{
-	__u64 config;
-
-again:
-	if (nr_counters == MAX_COUNTERS)
-		return -1;
-
-	config = match_event_symbols(str);
-	if (config == ~0ULL)
-		return -1;
-
-	event_id[nr_counters] = config;
-	nr_counters++;
-
-	str = strstr(str, ",");
-	if (str) {
-		str++;
-		goto again;
-	}
-
-	return 0;
-}
-
-#define __PERF_COUNTER_FIELD(config, name) \
-	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
-#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
-#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
-#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
-
-static void display_events_help(void)
-{
-	unsigned int i;
-	__u64 e;
-
-	printf(
-	" -e EVENT     --event=EVENT   #  symbolic-name        abbreviations");
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		int type, id;
-
-		e = event_symbols[i].event;
-		type = PERF_COUNTER_TYPE(e);
-		id = PERF_COUNTER_ID(e);
-
-		printf("\n                             %d:%d: %-20s",
-				type, id, event_symbols[i].symbol);
-	}
-
-	printf("\n"
-	"                           rNNN: raw PMU events (eventsel+umask)\n\n");
-}
-
-static void display_help(void)
-{
-	printf(
-	"Usage: perf-record [<options>] <cmd>\n"
-	"perf-record Options (up to %d event types can be specified at once):\n\n",
-		 MAX_COUNTERS);
-
-	display_events_help();
-
-	printf(
-	" -c CNT    --count=CNT          # event period to sample\n"
-	" -m pages  --mmap_pages=<pages> # number of mmap data pages\n"
-	" -o file   --output=<file>      # output file\n"
-	" -p pid    --pid=<pid>		 # record events on existing pid\n"
-	" -r prio   --realtime=<prio>    # use RT prio\n"
-	" -s        --system             # system wide profiling\n"
-	);
-
-	exit(0);
-}
-
-static void process_options(int argc, char * const argv[])
-{
-	int error = 0, counter;
-
-	for (;;) {
-		int option_index = 0;
-		/** Options for getopt */
-		static struct option long_options[] = {
-			{"count",	required_argument,	NULL, 'c'},
-			{"event",	required_argument,	NULL, 'e'},
-			{"mmap_pages",	required_argument,	NULL, 'm'},
-			{"output",	required_argument,	NULL, 'o'},
-			{"pid",		required_argument,	NULL, 'p'},
-			{"realtime",	required_argument,	NULL, 'r'},
-			{"system",	no_argument,		NULL, 's'},
-			{"inherit",	no_argument,		NULL, 'i'},
-			{"nmi",		no_argument,		NULL, 'n'},
-			{NULL,		0,			NULL,  0 }
-		};
-		int c = getopt_long(argc, argv, "+:c:e:m:o:p:r:sin",
-				    long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'c': default_interval		=   atoi(optarg); break;
-		case 'e': error				= parse_events(optarg); break;
-		case 'm': mmap_pages			=   atoi(optarg); break;
-		case 'o': output_name			= strdup(optarg); break;
-		case 'p': target_pid			=   atoi(optarg); break;
-		case 'r': realtime_prio			=   atoi(optarg); break;
-		case 's': system_wide                   ^=             1; break;
-		case 'i': inherit			^=	       1; break;
-		case 'n': nmi				^=	       1; break;
-		default: error = 1; break;
-		}
-	}
-
-	if (argc - optind == 0 && target_pid == -1)
-		error = 1;
-
-	if (error)
-		display_help();
-
-	if (!nr_counters) {
-		nr_counters = 1;
-		event_id[0] = 0;
-	}
-
-	for (counter = 0; counter < nr_counters; counter++) {
-		if (event_count[counter])
-			continue;
-
-		event_count[counter] = default_interval;
-	}
-}
-
 struct mmap_data {
 	int counter;
 	void *base;
@@ -538,16 +353,13 @@ static void open_counters(int cpu, pid_t pid)
 	nr_cpu++;
 }
 
-int cmd_record(int argc, char * const argv[])
+static int __cmd_record(int argc, const char **argv)
 {
 	int i, counter;
 	pid_t pid;
 	int ret;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
-
-	process_options(argc, argv);
-
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
@@ -558,9 +370,6 @@ int cmd_record(int argc, char * const argv[])
 		exit(-1);
 	}
 
-	argc -= optind;
-	argv += optind;
-
 	if (!system_wide) {
 		open_counters(-1, target_pid != -1 ? target_pid : 0);
 	} else for (i = 0; i < nr_cpus; i++)
@@ -575,7 +384,7 @@ int cmd_record(int argc, char * const argv[])
 			perror("failed to fork");
 
 		if (!pid) {
-			if (execvp(argv[0], argv)) {
+			if (execvp(argv[0], (char **)argv)) {
 				perror(argv[0]);
 				exit(-1);
 			}
@@ -610,3 +419,170 @@ int cmd_record(int argc, char * const argv[])
 
 	return 0;
 }
+
+struct event_symbol {
+	__u64 event;
+	char *symbol;
+};
+
+static struct event_symbol event_symbols[] = {
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
+
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
+};
+
+/*
+ * Each event can have multiple symbolic names.
+ * Symbolic names are (almost) exactly matched.
+ */
+static __u64 match_event_symbols(const char *str)
+{
+	__u64 config, id;
+	int type;
+	unsigned int i;
+
+	if (sscanf(str, "r%llx", &config) == 1)
+		return config | PERF_COUNTER_RAW_MASK;
+
+	if (sscanf(str, "%d:%llu", &type, &id) == 2)
+		return EID(type, id);
+
+	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
+		if (!strncmp(str, event_symbols[i].symbol,
+			     strlen(event_symbols[i].symbol)))
+			return event_symbols[i].event;
+	}
+
+	return ~0ULL;
+}
+
+static int parse_events(const struct option *opt, const char *str, int unset)
+{
+	__u64 config;
+
+again:
+	if (nr_counters == MAX_COUNTERS)
+		return -1;
+
+	config = match_event_symbols(str);
+	if (config == ~0ULL)
+		return -1;
+
+	event_id[nr_counters] = config;
+	nr_counters++;
+
+	str = strstr(str, ",");
+	if (str) {
+		str++;
+		goto again;
+	}
+
+	return 0;
+}
+
+static char events_help[100000];
+
+#define __PERF_COUNTER_FIELD(config, name) \
+	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
+
+#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
+#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
+#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
+#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
+
+
+
+static void create_events_help(void)
+{
+	unsigned int i;
+	char *str;
+	__u64 e;
+
+	str = events_help;
+
+	str += sprintf(str,
+	"event name: [");
+
+	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
+		int type, id;
+
+		e = event_symbols[i].event;
+		type = PERF_COUNTER_TYPE(e);
+		id = PERF_COUNTER_ID(e);
+
+		if (i)
+			str += sprintf(str, "|");
+
+		str += sprintf(str, "%s",
+				event_symbols[i].symbol);
+	}
+
+	str += sprintf(str, "|rNNN]");
+}
+
+static const char * const record_usage[] = {
+	"perf record [<options>] <command>",
+	NULL
+};
+
+const struct option options[] = {
+	OPT_CALLBACK('e', "event", NULL, "event",
+		     events_help, parse_events),
+	OPT_INTEGER('c', "count", &default_interval,
+		    "event period to sample"),
+	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
+		    "number of mmap data pages"),
+	OPT_STRING('o', "output", &output_name, "file",
+		    "output file name"),
+	OPT_BOOLEAN('i', "inherit", &inherit,
+		    "child tasks inherit counters"),
+	OPT_INTEGER('p', "pid", &target_pid,
+		    "record events on existing pid"),
+	OPT_INTEGER('r', "realtime", &realtime_prio,
+		    "collect data with this RT SCHED_FIFO priority"),
+	OPT_BOOLEAN('a', "all-cpus", &system_wide,
+			    "system-wide collection from all CPUs"),
+	OPT_END()
+};
+
+int cmd_record(int argc, const char **argv, const char *prefix)
+{
+	int counter;
+
+	create_events_help();
+
+	argc = parse_options(argc, argv, options, record_usage, 0);
+	if (!argc)
+		usage_with_options(record_usage, options);
+
+	if (!nr_counters) {
+		nr_counters = 1;
+		event_id[0] = 0;
+	}
+
+	for (counter = 0; counter < nr_counters; counter++) {
+		if (event_count[counter])
+			continue;
+
+		event_count[counter] = default_interval;
+	}
+
+	return __cmd_record(argc, argv);
+}
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 4bed265..626b320 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -42,13 +42,16 @@
   * Released under the GPL v2. (and only v2, not any later version)
   */
 
+
 #include "perf.h"
 #include "util/util.h"
 
 #include <getopt.h>
 #include <assert.h>
 #include <fcntl.h>
+
 #include <stdio.h>
+
 #include <errno.h>
 #include <time.h>
 #include <sched.h>

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Librarize event string parsing
       [not found]             ` <new-submission>
                                 ` (44 preceding siblings ...)
  2009-05-26 10:34               ` [tip:perfcounters/core] perf record: Convert to Git option parsing tip-bot for Ingo Molnar
@ 2009-05-26 10:34               ` tip-bot for Ingo Molnar
  2009-05-26 11:03               ` [tip:perfcounters/core] perf stat: Convert to Git option parsing tip-bot for Ingo Molnar
                                 ` (661 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 10:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  8ad8db3788fd9a449941fb2392ca85af4ee1cde1
Gitweb:     http://git.kernel.org/tip/8ad8db3788fd9a449941fb2392ca85af4ee1cde1
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 11:10:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 11:26:34 +0200

perf_counter tools: Librarize event string parsing

Extract the event string parser from builtin-record.c, and
librarize it - to be reused in other commands.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile            |    2 +
 Documentation/perf_counter/builtin-record.c    |  154 +-----------------------
 Documentation/perf_counter/util/parse-events.c |  127 +++++++++++++++++++
 Documentation/perf_counter/util/parse-events.h |   10 ++
 4 files changed, 145 insertions(+), 148 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 481e4c2..45daa72 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -290,6 +290,7 @@ LIB_H += ../../include/linux/perf_counter.h
 LIB_H += perf.h
 LIB_H += util/levenshtein.h
 LIB_H += util/parse-options.h
+LIB_H += util/parse-events.h
 LIB_H += util/quote.h
 LIB_H += util/util.h
 LIB_H += util/help.h
@@ -304,6 +305,7 @@ LIB_OBJS += util/exec_cmd.o
 LIB_OBJS += util/help.o
 LIB_OBJS += util/levenshtein.o
 LIB_OBJS += util/parse-options.o
+LIB_OBJS += util/parse-events.o
 LIB_OBJS += util/path.o
 LIB_OBJS += util/run-command.o
 LIB_OBJS += util/quote.o
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index f12a782..6fa6ed6 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -3,44 +3,17 @@
 #include "perf.h"
 #include "util/util.h"
 #include "util/parse-options.h"
+#include "util/parse-events.h"
 #include "util/exec_cmd.h"
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
 #include <sched.h>
-#include <pthread.h>
-
-#include <sys/syscall.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include <sys/uio.h>
-#include <sys/mman.h>
-
-#include <linux/unistd.h>
-#include <linux/types.h>
-
-
 
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a)-1)
 #define __ALIGN_MASK(x, mask)	(((x)+(mask))&~(mask))
 
-static int			nr_counters			=  0;
-static __u64			event_id[MAX_COUNTERS]		= { };
 static int			default_interval = 100000;
 static int			event_count[MAX_COUNTERS];
+
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 static int			nr_cpus				=  0;
 static unsigned int		page_size;
@@ -420,131 +393,16 @@ static int __cmd_record(int argc, const char **argv)
 	return 0;
 }
 
-struct event_symbol {
-	__u64 event;
-	char *symbol;
-};
-
-static struct event_symbol event_symbols[] = {
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
-
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
-};
-
-/*
- * Each event can have multiple symbolic names.
- * Symbolic names are (almost) exactly matched.
- */
-static __u64 match_event_symbols(const char *str)
-{
-	__u64 config, id;
-	int type;
-	unsigned int i;
-
-	if (sscanf(str, "r%llx", &config) == 1)
-		return config | PERF_COUNTER_RAW_MASK;
-
-	if (sscanf(str, "%d:%llu", &type, &id) == 2)
-		return EID(type, id);
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		if (!strncmp(str, event_symbols[i].symbol,
-			     strlen(event_symbols[i].symbol)))
-			return event_symbols[i].event;
-	}
-
-	return ~0ULL;
-}
-
-static int parse_events(const struct option *opt, const char *str, int unset)
-{
-	__u64 config;
-
-again:
-	if (nr_counters == MAX_COUNTERS)
-		return -1;
-
-	config = match_event_symbols(str);
-	if (config == ~0ULL)
-		return -1;
-
-	event_id[nr_counters] = config;
-	nr_counters++;
-
-	str = strstr(str, ",");
-	if (str) {
-		str++;
-		goto again;
-	}
-
-	return 0;
-}
-
-static char events_help[100000];
-
-#define __PERF_COUNTER_FIELD(config, name) \
-	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
-#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
-#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
-#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
-
-
-
-static void create_events_help(void)
-{
-	unsigned int i;
-	char *str;
-	__u64 e;
-
-	str = events_help;
-
-	str += sprintf(str,
-	"event name: [");
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		int type, id;
-
-		e = event_symbols[i].event;
-		type = PERF_COUNTER_TYPE(e);
-		id = PERF_COUNTER_ID(e);
-
-		if (i)
-			str += sprintf(str, "|");
-
-		str += sprintf(str, "%s",
-				event_symbols[i].symbol);
-	}
-
-	str += sprintf(str, "|rNNN]");
-}
-
 static const char * const record_usage[] = {
 	"perf record [<options>] <command>",
 	NULL
 };
 
+static char events_help_msg[EVENTS_HELP_MAX];
+
 const struct option options[] = {
 	OPT_CALLBACK('e', "event", NULL, "event",
-		     events_help, parse_events),
+		     events_help_msg, parse_events),
 	OPT_INTEGER('c', "count", &default_interval,
 		    "event period to sample"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
@@ -566,7 +424,7 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 {
 	int counter;
 
-	create_events_help();
+	create_events_help(events_help_msg);
 
 	argc = parse_options(argc, argv, options, record_usage, 0);
 	if (!argc)
diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c
new file mode 100644
index 0000000..77d0917
--- /dev/null
+++ b/Documentation/perf_counter/util/parse-events.c
@@ -0,0 +1,127 @@
+
+#include "../perf.h"
+#include "util.h"
+#include "parse-options.h"
+#include "parse-events.h"
+#include "exec_cmd.h"
+
+int nr_counters;
+
+__u64			event_id[MAX_COUNTERS]		= { };
+
+struct event_symbol {
+	__u64 event;
+	char *symbol;
+};
+
+static struct event_symbol event_symbols[] = {
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
+	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
+
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
+	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
+};
+
+/*
+ * Each event can have multiple symbolic names.
+ * Symbolic names are (almost) exactly matched.
+ */
+static __u64 match_event_symbols(const char *str)
+{
+	__u64 config, id;
+	int type;
+	unsigned int i;
+
+	if (sscanf(str, "r%llx", &config) == 1)
+		return config | PERF_COUNTER_RAW_MASK;
+
+	if (sscanf(str, "%d:%llu", &type, &id) == 2)
+		return EID(type, id);
+
+	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
+		if (!strncmp(str, event_symbols[i].symbol,
+			     strlen(event_symbols[i].symbol)))
+			return event_symbols[i].event;
+	}
+
+	return ~0ULL;
+}
+
+int parse_events(const struct option *opt, const char *str, int unset)
+{
+	__u64 config;
+
+again:
+	if (nr_counters == MAX_COUNTERS)
+		return -1;
+
+	config = match_event_symbols(str);
+	if (config == ~0ULL)
+		return -1;
+
+	event_id[nr_counters] = config;
+	nr_counters++;
+
+	str = strstr(str, ",");
+	if (str) {
+		str++;
+		goto again;
+	}
+
+	return 0;
+}
+
+#define __PERF_COUNTER_FIELD(config, name) \
+	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
+
+#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
+#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
+#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
+#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
+
+/*
+ * Create the help text for the event symbols:
+ */
+void create_events_help(char *events_help_msg)
+{
+	unsigned int i;
+	char *str;
+	__u64 e;
+
+	str = events_help_msg;
+
+	str += sprintf(str,
+	"event name: [");
+
+	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
+		int type, id;
+
+		e = event_symbols[i].event;
+		type = PERF_COUNTER_TYPE(e);
+		id = PERF_COUNTER_ID(e);
+
+		if (i)
+			str += sprintf(str, "|");
+
+		str += sprintf(str, "%s",
+				event_symbols[i].symbol);
+	}
+
+	str += sprintf(str, "|rNNN]");
+}
+
diff --git a/Documentation/perf_counter/util/parse-events.h b/Documentation/perf_counter/util/parse-events.h
new file mode 100644
index 0000000..6e2ebe5
--- /dev/null
+++ b/Documentation/perf_counter/util/parse-events.h
@@ -0,0 +1,10 @@
+
+extern int nr_counters;
+extern __u64			event_id[MAX_COUNTERS];
+
+extern int parse_events(const struct option *opt, const char *str, int unset);
+
+#define EVENTS_HELP_MAX (128*1024)
+
+extern void create_events_help(char *help_msg);
+

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Convert to Git option parsing
       [not found]             ` <new-submission>
                                 ` (45 preceding siblings ...)
  2009-05-26 10:34               ` [tip:perfcounters/core] perf_counter tools: Librarize event string parsing tip-bot for Ingo Molnar
@ 2009-05-26 11:03               ` tip-bot for Ingo Molnar
  2009-05-26 11:36               ` [tip:perfcounters/core] perf top: " tip-bot for Ingo Molnar
                                 ` (660 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 11:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  5242519b0296d128425368fc6ab17f541d5fa775
Gitweb:     http://git.kernel.org/tip/5242519b0296d128425368fc6ab17f541d5fa775
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:17:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 11:59:34 +0200

perf stat: Convert to Git option parsing

Remove getopt usage and use Git's much more advanced and more compact
command option library.

Extend the event parser library with the extensions that were in
perf-stat before.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c    |    3 +-
 Documentation/perf_counter/builtin-stat.c      |  414 ++++--------------------
 Documentation/perf_counter/util/parse-events.c |   82 ++++-
 Documentation/perf_counter/util/parse-events.h |   10 +
 4 files changed, 145 insertions(+), 364 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 6fa6ed6..ec2b787 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -4,7 +4,6 @@
 #include "util/util.h"
 #include "util/parse-options.h"
 #include "util/parse-events.h"
-#include "util/exec_cmd.h"
 
 #include <sched.h>
 
@@ -400,7 +399,7 @@ static const char * const record_usage[] = {
 
 static char events_help_msg[EVENTS_HELP_MAX];
 
-const struct option options[] = {
+static const struct option options[] = {
 	OPT_CALLBACK('e', "event", NULL, "event",
 		     events_help_msg, parse_events),
 	OPT_INTEGER('c', "count", &default_interval,
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index c1053d8..e7cb941 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -1,35 +1,5 @@
 /*
- * kerneltop.c: show top kernel functions - performance counters showcase
-
-   Build with:
-
-     cc -O6 -Wall -c -o kerneltop.o kerneltop.c -lrt
-
-   Sample output:
-
-------------------------------------------------------------------------------
- KernelTop:    2669 irqs/sec  [NMI, cache-misses/cache-refs],  (all, cpu: 2)
-------------------------------------------------------------------------------
-
-             weight         RIP          kernel function
-             ______   ________________   _______________
-
-              35.20 - ffffffff804ce74b : skb_copy_and_csum_dev
-              33.00 - ffffffff804cb740 : sock_alloc_send_skb
-              31.26 - ffffffff804ce808 : skb_push
-              22.43 - ffffffff80510004 : tcp_established_options
-              19.00 - ffffffff8027d250 : find_get_page
-              15.76 - ffffffff804e4fc9 : eth_type_trans
-              15.20 - ffffffff804d8baa : dst_release
-              14.86 - ffffffff804cf5d8 : skb_release_head_state
-              14.00 - ffffffff802217d5 : read_hpet
-              12.00 - ffffffff804ffb7f : __ip_local_out
-              11.97 - ffffffff804fc0c8 : ip_local_deliver_finish
-               8.54 - ffffffff805001a3 : ip_queue_xmit
- */
-
-/*
- * perfstat:  /usr/bin/time -alike performance counter statistics utility
+ * perf stat:  /usr/bin/time -alike performance counter statistics utility
 
           It summarizes the counter events of all tasks (and child tasks),
           covering all CPUs that the command (or workload) executes on.
@@ -38,59 +8,38 @@
 
    Sample output:
 
-   $ ./perfstat -e 1 -e 3 -e 5 ls -lR /usr/include/ >/dev/null
+   $ perf stat -e 1 -e 3 -e 5 ls -lR /usr/include/ >/dev/null
 
    Performance counter stats for 'ls':
 
            163516953 instructions
                 2295 cache-misses
              2855182 branch-misses
+ *
+ * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
+ *
+ * Improvements and fixes by:
+ *
+ *   Arjan van de Ven <arjan@linux.intel.com>
+ *   Yanmin Zhang <yanmin.zhang@intel.com>
+ *   Wu Fengguang <fengguang.wu@intel.com>
+ *   Mike Galbraith <efault@gmx.de>
+ *   Paul Mackerras <paulus@samba.org>
+ *
+ * Released under the GPL v2. (and only v2, not any later version)
  */
 
- /*
-  * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
-  *
-  * Improvements and fixes by:
-  *
-  *   Arjan van de Ven <arjan@linux.intel.com>
-  *   Yanmin Zhang <yanmin.zhang@intel.com>
-  *   Wu Fengguang <fengguang.wu@intel.com>
-  *   Mike Galbraith <efault@gmx.de>
-  *   Paul Mackerras <paulus@samba.org>
-  *
-  * Released under the GPL v2. (and only v2, not any later version)
-  */
-
 #include "perf.h"
 #include "util/util.h"
+#include "util/parse-options.h"
+#include "util/parse-events.h"
 
-#include <getopt.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <sched.h>
-#include <pthread.h>
-
-#include <sys/syscall.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
 #include <sys/prctl.h>
-#include <sys/wait.h>
-#include <sys/uio.h>
-#include <sys/mman.h>
-
-#include <linux/unistd.h>
-#include <linux/types.h>
-
-#define EVENT_MASK_KERNEL		1
-#define EVENT_MASK_USER			2
 
 static int			system_wide			=  0;
+static int			inherit				=  1;
 
-static int			nr_counters			=  0;
-static __u64			event_id[MAX_COUNTERS]		= {
+static __u64			default_event_id[MAX_COUNTERS]	= {
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),
@@ -101,20 +50,15 @@ static __u64			event_id[MAX_COUNTERS]		= {
 	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),
 	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),
 };
+
 static int			default_interval = 100000;
 static int			event_count[MAX_COUNTERS];
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
-static int			event_mask[MAX_COUNTERS];
 
-static int			tid				= -1;
-static int			profile_cpu			= -1;
+static int			target_pid			= -1;
 static int			nr_cpus				=  0;
-static int			nmi				=  1;
-static int			group				=  0;
 static unsigned int		page_size;
 
-static int			zero;
-
 static int			scale				=  1;
 
 static const unsigned int default_count[] = {
@@ -126,197 +70,6 @@ static const unsigned int default_count[] = {
 	  10000,
 };
 
-static char *hw_event_names[] = {
-	"CPU cycles",
-	"instructions",
-	"cache references",
-	"cache misses",
-	"branches",
-	"branch misses",
-	"bus cycles",
-};
-
-static char *sw_event_names[] = {
-	"cpu clock ticks",
-	"task clock ticks",
-	"pagefaults",
-	"context switches",
-	"CPU migrations",
-	"minor faults",
-	"major faults",
-};
-
-struct event_symbol {
-	__u64 event;
-	char *symbol;
-};
-
-static struct event_symbol event_symbols[] = {
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
-
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
-};
-
-#define __PERF_COUNTER_FIELD(config, name) \
-	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
-#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
-#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
-#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
-
-static void display_events_help(void)
-{
-	unsigned int i;
-	__u64 e;
-
-	printf(
-	" -e EVENT     --event=EVENT   #  symbolic-name        abbreviations");
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		int type, id;
-
-		e = event_symbols[i].event;
-		type = PERF_COUNTER_TYPE(e);
-		id = PERF_COUNTER_ID(e);
-
-		printf("\n                             %d:%d: %-20s",
-				type, id, event_symbols[i].symbol);
-	}
-
-	printf("\n"
-	"                           rNNN: raw PMU events (eventsel+umask)\n\n");
-}
-
-static void display_help(void)
-{
-	printf(
-	"Usage: perfstat [<events...>] <cmd...>\n\n"
-	"PerfStat Options (up to %d event types can be specified):\n\n",
-		 MAX_COUNTERS);
-
-	display_events_help();
-
-	printf(
-	" -l                           # scale counter values\n"
-	" -a                           # system-wide collection\n");
-	exit(0);
-}
-
-static char *event_name(int ctr)
-{
-	__u64 config = event_id[ctr];
-	int type = PERF_COUNTER_TYPE(config);
-	int id = PERF_COUNTER_ID(config);
-	static char buf[32];
-
-	if (PERF_COUNTER_RAW(config)) {
-		sprintf(buf, "raw 0x%llx", PERF_COUNTER_CONFIG(config));
-		return buf;
-	}
-
-	switch (type) {
-	case PERF_TYPE_HARDWARE:
-		if (id < PERF_HW_EVENTS_MAX)
-			return hw_event_names[id];
-		return "unknown-hardware";
-
-	case PERF_TYPE_SOFTWARE:
-		if (id < PERF_SW_EVENTS_MAX)
-			return sw_event_names[id];
-		return "unknown-software";
-
-	default:
-		break;
-	}
-
-	return "unknown";
-}
-
-/*
- * Each event can have multiple symbolic names.
- * Symbolic names are (almost) exactly matched.
- */
-static __u64 match_event_symbols(char *str)
-{
-	__u64 config, id;
-	int type;
-	unsigned int i;
-	char mask_str[4];
-
-	if (sscanf(str, "r%llx", &config) == 1)
-		return config | PERF_COUNTER_RAW_MASK;
-
-	switch (sscanf(str, "%d:%llu:%2s", &type, &id, mask_str)) {
-		case 3:
-			if (strchr(mask_str, 'k'))
-				event_mask[nr_counters] |= EVENT_MASK_USER;
-			if (strchr(mask_str, 'u'))
-				event_mask[nr_counters] |= EVENT_MASK_KERNEL;
-		case 2:
-			return EID(type, id);
-
-		default:
-			break;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		if (!strncmp(str, event_symbols[i].symbol,
-			     strlen(event_symbols[i].symbol)))
-			return event_symbols[i].event;
-	}
-
-	return ~0ULL;
-}
-
-static int parse_events(char *str)
-{
-	__u64 config;
-
-again:
-	if (nr_counters == MAX_COUNTERS)
-		return -1;
-
-	config = match_event_symbols(str);
-	if (config == ~0ULL)
-		return -1;
-
-	event_id[nr_counters] = config;
-	nr_counters++;
-
-	str = strstr(str, ",");
-	if (str) {
-		str++;
-		goto again;
-	}
-
-	return 0;
-}
-
-
-/*
- * perfstat
- */
-
-char fault_here[1000000];
-
 static void create_perfstat_counter(int counter)
 {
 	struct perf_counter_hw_event hw_event;
@@ -324,7 +77,7 @@ static void create_perfstat_counter(int counter)
 	memset(&hw_event, 0, sizeof(hw_event));
 	hw_event.config		= event_id[counter];
 	hw_event.record_type	= 0;
-	hw_event.nmi		= 0;
+	hw_event.nmi		= 1;
 	hw_event.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
 	hw_event.exclude_user   = event_mask[counter] & EVENT_MASK_USER;
 
@@ -343,7 +96,7 @@ static void create_perfstat_counter(int counter)
 			}
 		}
 	} else {
-		hw_event.inherit	= 1;
+		hw_event.inherit	= inherit;
 		hw_event.disabled	= 1;
 
 		fd[0][counter] = sys_perf_counter_open(&hw_event, 0, -1, -1, 0);
@@ -355,7 +108,7 @@ static void create_perfstat_counter(int counter)
 	}
 }
 
-int do_perfstat(int argc, char *argv[])
+int do_perfstat(int argc, const char **argv)
 {
 	unsigned long long t0, t1;
 	int counter;
@@ -369,12 +122,6 @@ int do_perfstat(int argc, char *argv[])
 	for (counter = 0; counter < nr_counters; counter++)
 		create_perfstat_counter(counter);
 
-	argc -= optind;
-	argv += optind;
-
-	if (!argc)
-		display_help();
-
 	/*
 	 * Enable counters and exec the command:
 	 */
@@ -384,7 +131,7 @@ int do_perfstat(int argc, char *argv[])
 	if ((pid = fork()) < 0)
 		perror("failed to fork");
 	if (!pid) {
-		if (execvp(argv[0], argv)) {
+		if (execvp(argv[0], (char **)argv)) {
 			perror(argv[0]);
 			exit(-1);
 		}
@@ -458,70 +205,45 @@ int do_perfstat(int argc, char *argv[])
 	return 0;
 }
 
-static void process_options(int argc, char **argv)
+static void skip_signal(int signo)
 {
-	int error = 0, counter;
-
-	for (;;) {
-		int option_index = 0;
-		/** Options for getopt */
-		static struct option long_options[] = {
-			{"count",	required_argument,	NULL, 'c'},
-			{"cpu",		required_argument,	NULL, 'C'},
-			{"delay",	required_argument,	NULL, 'd'},
-			{"dump_symtab",	no_argument,		NULL, 'D'},
-			{"event",	required_argument,	NULL, 'e'},
-			{"filter",	required_argument,	NULL, 'f'},
-			{"group",	required_argument,	NULL, 'g'},
-			{"help",	no_argument,		NULL, 'h'},
-			{"nmi",		required_argument,	NULL, 'n'},
-			{"munmap_info",	no_argument,		NULL, 'U'},
-			{"pid",		required_argument,	NULL, 'p'},
-			{"realtime",	required_argument,	NULL, 'r'},
-			{"scale",	no_argument,		NULL, 'l'},
-			{"symbol",	required_argument,	NULL, 's'},
-			{"stat",	no_argument,		NULL, 'S'},
-			{"vmlinux",	required_argument,	NULL, 'x'},
-			{"zero",	no_argument,		NULL, 'z'},
-			{NULL,		0,			NULL,  0 }
-		};
-		int c = getopt_long(argc, argv, "+:ac:C:d:De:f:g:hln:m:p:r:s:Sx:zMU",
-				    long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'a': system_wide			=	       1; break;
-		case 'c': default_interval		=   atoi(optarg); break;
-		case 'C':
-			/* CPU and PID are mutually exclusive */
-			if (tid != -1) {
-				printf("WARNING: CPU switch overriding PID\n");
-				sleep(1);
-				tid = -1;
-			}
-			profile_cpu			=   atoi(optarg); break;
-
-		case 'e': error				= parse_events(optarg); break;
-
-		case 'g': group				=   atoi(optarg); break;
-		case 'h':      				  display_help(); break;
-		case 'l': scale				=	       1; break;
-		case 'n': nmi				=   atoi(optarg); break;
-		case 'p':
-			/* CPU and PID are mutually exclusive */
-			if (profile_cpu != -1) {
-				printf("WARNING: PID switch overriding CPU\n");
-				sleep(1);
-				profile_cpu = -1;
-			}
-			tid				=   atoi(optarg); break;
-		case 'z': zero				=              1; break;
-		default: error = 1; break;
-		}
-	}
-	if (error)
-		display_help();
+}
+
+static const char * const stat_usage[] = {
+	"perf stat [<options>] <command>",
+	NULL
+};
+
+static char events_help_msg[EVENTS_HELP_MAX];
+
+static const struct option options[] = {
+	OPT_CALLBACK('e', "event", NULL, "event",
+		     events_help_msg, parse_events),
+	OPT_INTEGER('c', "count", &default_interval,
+		    "event period to sample"),
+	OPT_BOOLEAN('i', "inherit", &inherit,
+		    "child tasks inherit counters"),
+	OPT_INTEGER('p', "pid", &target_pid,
+		    "stat events on existing pid"),
+	OPT_BOOLEAN('a', "all-cpus", &system_wide,
+			    "system-wide collection from all CPUs"),
+	OPT_BOOLEAN('l', "scale", &scale,
+			    "scale/normalize counters"),
+	OPT_END()
+};
+
+int cmd_stat(int argc, const char **argv, const char *prefix)
+{
+	int counter;
+
+	page_size = sysconf(_SC_PAGE_SIZE);
+
+	create_events_help(events_help_msg);
+	memcpy(event_id, default_event_id, sizeof(default_event_id));
+
+	argc = parse_options(argc, argv, options, stat_usage, 0);
+	if (!argc)
+		usage_with_options(stat_usage, options);
 
 	if (!nr_counters) {
 		nr_counters = 8;
@@ -533,18 +255,6 @@ static void process_options(int argc, char **argv)
 
 		event_count[counter] = default_interval;
 	}
-}
-
-static void skip_signal(int signo)
-{
-}
-
-int cmd_stat(int argc, char **argv, const char *prefix)
-{
-	page_size = sysconf(_SC_PAGE_SIZE);
-
-	process_options(argc, argv);
-
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c
index 77d0917..88c903e 100644
--- a/Documentation/perf_counter/util/parse-events.c
+++ b/Documentation/perf_counter/util/parse-events.c
@@ -8,6 +8,7 @@
 int nr_counters;
 
 __u64			event_id[MAX_COUNTERS]		= { };
+int			event_mask[MAX_COUNTERS];
 
 struct event_symbol {
 	__u64 event;
@@ -37,6 +38,64 @@ static struct event_symbol event_symbols[] = {
 	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
 };
 
+#define __PERF_COUNTER_FIELD(config, name) \
+	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
+
+#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
+#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
+#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
+#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
+
+static char *hw_event_names[] = {
+	"CPU cycles",
+	"instructions",
+	"cache references",
+	"cache misses",
+	"branches",
+	"branch misses",
+	"bus cycles",
+};
+
+static char *sw_event_names[] = {
+	"cpu clock ticks",
+	"task clock ticks",
+	"pagefaults",
+	"context switches",
+	"CPU migrations",
+	"minor faults",
+	"major faults",
+};
+
+char *event_name(int ctr)
+{
+	__u64 config = event_id[ctr];
+	int type = PERF_COUNTER_TYPE(config);
+	int id = PERF_COUNTER_ID(config);
+	static char buf[32];
+
+	if (PERF_COUNTER_RAW(config)) {
+		sprintf(buf, "raw 0x%llx", PERF_COUNTER_CONFIG(config));
+		return buf;
+	}
+
+	switch (type) {
+	case PERF_TYPE_HARDWARE:
+		if (id < PERF_HW_EVENTS_MAX)
+			return hw_event_names[id];
+		return "unknown-hardware";
+
+	case PERF_TYPE_SOFTWARE:
+		if (id < PERF_SW_EVENTS_MAX)
+			return sw_event_names[id];
+		return "unknown-software";
+
+	default:
+		break;
+	}
+
+	return "unknown";
+}
+
 /*
  * Each event can have multiple symbolic names.
  * Symbolic names are (almost) exactly matched.
@@ -46,12 +105,23 @@ static __u64 match_event_symbols(const char *str)
 	__u64 config, id;
 	int type;
 	unsigned int i;
+	char mask_str[4];
 
 	if (sscanf(str, "r%llx", &config) == 1)
 		return config | PERF_COUNTER_RAW_MASK;
 
-	if (sscanf(str, "%d:%llu", &type, &id) == 2)
-		return EID(type, id);
+	switch (sscanf(str, "%d:%llu:%2s", &type, &id, mask_str)) {
+		case 3:
+			if (strchr(mask_str, 'k'))
+				event_mask[nr_counters] |= EVENT_MASK_USER;
+			if (strchr(mask_str, 'u'))
+				event_mask[nr_counters] |= EVENT_MASK_KERNEL;
+		case 2:
+			return EID(type, id);
+
+		default:
+			break;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
 		if (!strncmp(str, event_symbols[i].symbol,
@@ -86,14 +156,6 @@ again:
 	return 0;
 }
 
-#define __PERF_COUNTER_FIELD(config, name) \
-	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
-#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
-#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
-#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
-
 /*
  * Create the help text for the event symbols:
  */
diff --git a/Documentation/perf_counter/util/parse-events.h b/Documentation/perf_counter/util/parse-events.h
index 6e2ebe5..0da306b 100644
--- a/Documentation/perf_counter/util/parse-events.h
+++ b/Documentation/perf_counter/util/parse-events.h
@@ -1,6 +1,16 @@
 
+/*
+ * Parse symbolic events/counts passed in as options:
+ */
+
 extern int nr_counters;
 extern __u64			event_id[MAX_COUNTERS];
+extern int			event_mask[MAX_COUNTERS];
+
+#define EVENT_MASK_KERNEL	1
+#define EVENT_MASK_USER		2
+
+extern char *event_name(int ctr);
 
 extern int parse_events(const struct option *opt, const char *str, int unset);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: Convert to Git option parsing
       [not found]             ` <new-submission>
                                 ` (46 preceding siblings ...)
  2009-05-26 11:03               ` [tip:perfcounters/core] perf stat: Convert to Git option parsing tip-bot for Ingo Molnar
@ 2009-05-26 11:36               ` tip-bot for Ingo Molnar
  2009-05-26 12:12               ` [tip:perfcounters/core] perf_counter: First part of 'perf report' conversion to C + elfutils tip-bot for Arnaldo Carvalho de Melo
                                 ` (659 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 11:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  b456bae0ff4f3cf91639dd32b2bfc49b1c30b4b0
Gitweb:     http://git.kernel.org/tip/b456bae0ff4f3cf91639dd32b2bfc49b1c30b4b0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:17:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 12:33:04 +0200

perf top: Convert to Git option parsing

Remove getopt usage and use Git's much more advanced and more compact
command option library.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |  559 ++++++------------------------
 1 files changed, 105 insertions(+), 454 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 626b320..87b925c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -45,8 +45,10 @@
 
 #include "perf.h"
 #include "util/util.h"
+#include "util/util.h"
+#include "util/parse-options.h"
+#include "util/parse-events.h"
 
-#include <getopt.h>
 #include <assert.h>
 #include <fcntl.h>
 
@@ -70,8 +72,7 @@
 
 static int			system_wide			=  0;
 
-static int			nr_counters			=  0;
-static __u64			event_id[MAX_COUNTERS]		= {
+static __u64			default_event_id[MAX_COUNTERS]		= {
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),
 	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),
@@ -88,7 +89,7 @@ static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static __u64			count_filter		       = 100;
 
-static int			tid				= -1;
+static int			target_pid				= -1;
 static int			profile_cpu			= -1;
 static int			nr_cpus				=  0;
 static int			nmi				=  1;
@@ -100,8 +101,6 @@ static int			use_mmap			= 0;
 static int			use_munmap			= 0;
 static int			freq				= 0;
 
-static char			*vmlinux;
-
 static char			*sym_filter;
 static unsigned long		filter_start;
 static unsigned long		filter_end;
@@ -110,18 +109,6 @@ static int			delay_secs			=  2;
 static int			zero;
 static int			dump_symtab;
 
-static int			scale;
-
-struct source_line {
-	uint64_t		EIP;
-	unsigned long		count;
-	char			*line;
-	struct source_line	*next;
-};
-
-static struct source_line	*lines;
-static struct source_line	**lines_tail;
-
 static const unsigned int default_count[] = {
 	1000000,
 	1000000,
@@ -131,194 +118,6 @@ static const unsigned int default_count[] = {
 	  10000,
 };
 
-static char *hw_event_names[] = {
-	"CPU cycles",
-	"instructions",
-	"cache references",
-	"cache misses",
-	"branches",
-	"branch misses",
-	"bus cycles",
-};
-
-static char *sw_event_names[] = {
-	"cpu clock ticks",
-	"task clock ticks",
-	"pagefaults",
-	"context switches",
-	"CPU migrations",
-	"minor faults",
-	"major faults",
-};
-
-struct event_symbol {
-	__u64 event;
-	char *symbol;
-};
-
-static struct event_symbol event_symbols[] = {
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
-
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
-};
-
-#define __PERF_COUNTER_FIELD(config, name) \
-	((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW(config)	__PERF_COUNTER_FIELD(config, RAW)
-#define PERF_COUNTER_CONFIG(config)	__PERF_COUNTER_FIELD(config, CONFIG)
-#define PERF_COUNTER_TYPE(config)	__PERF_COUNTER_FIELD(config, TYPE)
-#define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
-
-static void display_events_help(void)
-{
-	unsigned int i;
-	__u64 e;
-
-	printf(
-	" -e EVENT     --event=EVENT   #  symbolic-name        abbreviations");
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		int type, id;
-
-		e = event_symbols[i].event;
-		type = PERF_COUNTER_TYPE(e);
-		id = PERF_COUNTER_ID(e);
-
-		printf("\n                             %d:%d: %-20s",
-				type, id, event_symbols[i].symbol);
-	}
-
-	printf("\n"
-	"                           rNNN: raw PMU events (eventsel+umask)\n\n");
-}
-
-static void display_help(void)
-{
-	printf(
-	"Usage: kerneltop [<options>]\n"
-	"   Or: kerneltop -S [<options>] COMMAND [ARGS]\n\n"
-	"KernelTop Options (up to %d event types can be specified at once):\n\n",
-		 MAX_COUNTERS);
-
-	display_events_help();
-
-	printf(
-	" -c CNT    --count=CNT        # event period to sample\n\n"
-	" -C CPU    --cpu=CPU          # CPU (-1 for all)                 [default: -1]\n"
-	" -p PID    --pid=PID          # PID of sampled task (-1 for all) [default: -1]\n\n"
-	" -l                           # show scale factor for RR events\n"
-	" -d delay  --delay=<seconds>  # sampling/display delay           [default:  2]\n"
-	" -f CNT    --filter=CNT       # min-event-count filter          [default: 100]\n\n"
-	" -r prio   --realtime=<prio>  # event acquisition runs with SCHED_FIFO policy\n"
-	" -s symbol --symbol=<symbol>  # function to be showed annotated one-shot\n"
-	" -x path   --vmlinux=<path>   # the vmlinux binary, required for -s use\n"
-	" -z        --zero             # zero counts after display\n"
-	" -D        --dump_symtab      # dump symbol table to stderr on startup\n"
-	" -m pages  --mmap_pages=<pages> # number of mmap data pages\n"
-	" -M        --mmap_info        # print mmap info stream\n"
-	" -U        --munmap_info      # print munmap info stream\n"
-	);
-
-	exit(0);
-}
-
-static char *event_name(int ctr)
-{
-	__u64 config = event_id[ctr];
-	int type = PERF_COUNTER_TYPE(config);
-	int id = PERF_COUNTER_ID(config);
-	static char buf[32];
-
-	if (PERF_COUNTER_RAW(config)) {
-		sprintf(buf, "raw 0x%llx", PERF_COUNTER_CONFIG(config));
-		return buf;
-	}
-
-	switch (type) {
-	case PERF_TYPE_HARDWARE:
-		if (id < PERF_HW_EVENTS_MAX)
-			return hw_event_names[id];
-		return "unknown-hardware";
-
-	case PERF_TYPE_SOFTWARE:
-		if (id < PERF_SW_EVENTS_MAX)
-			return sw_event_names[id];
-		return "unknown-software";
-
-	default:
-		break;
-	}
-
-	return "unknown";
-}
-
-/*
- * Each event can have multiple symbolic names.
- * Symbolic names are (almost) exactly matched.
- */
-static __u64 match_event_symbols(char *str)
-{
-	__u64 config, id;
-	int type;
-	unsigned int i;
-
-	if (sscanf(str, "r%llx", &config) == 1)
-		return config | PERF_COUNTER_RAW_MASK;
-
-	if (sscanf(str, "%d:%llu", &type, &id) == 2)
-		return EID(type, id);
-
-	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
-		if (!strncmp(str, event_symbols[i].symbol,
-			     strlen(event_symbols[i].symbol)))
-			return event_symbols[i].event;
-	}
-
-	return ~0ULL;
-}
-
-static int parse_events(char *str)
-{
-	__u64 config;
-
-again:
-	if (nr_counters == MAX_COUNTERS)
-		return -1;
-
-	config = match_event_symbols(str);
-	if (config == ~0ULL)
-		return -1;
-
-	event_id[nr_counters] = config;
-	nr_counters++;
-
-	str = strstr(str, ",");
-	if (str) {
-		str++;
-		goto again;
-	}
-
-	return 0;
-}
-
 /*
  * Symbols
  */
@@ -331,7 +130,6 @@ struct sym_entry {
 	char			*sym;
 	unsigned long		count[MAX_COUNTERS];
 	int			skip;
-	struct source_line	*source;
 };
 
 #define MAX_SYMS		100000
@@ -342,8 +140,6 @@ struct sym_entry		*sym_filter_entry;
 
 static struct sym_entry		sym_table[MAX_SYMS];
 
-static void show_details(struct sym_entry *sym);
-
 /*
  * Ordering weight: count-1 * count-2 * ... / count-n
  */
@@ -419,15 +215,15 @@ static void print_sym_table(void)
 
 	printf( "], ");
 
-	if (tid != -1)
-		printf(" (tid: %d", tid);
+	if (target_pid != -1)
+		printf(" (target_pid: %d", target_pid);
 	else
 		printf(" (all");
 
 	if (profile_cpu != -1)
 		printf(", cpu: %d)\n", profile_cpu);
 	else {
-		if (tid != -1)
+		if (target_pid != -1)
 			printf(")\n");
 		else
 			printf(", %d CPUs)\n", nr_cpus);
@@ -463,9 +259,6 @@ static void print_sym_table(void)
 				pcnt, tmp[i].addr, tmp[i].sym);
 	}
 
-	if (sym_filter_entry)
-		show_details(sym_filter_entry);
-
 	{
 		struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
 
@@ -628,134 +421,8 @@ static void parse_symbols(void)
 	}
 }
 
-/*
- * Source lines
- */
-
-static void parse_vmlinux(char *filename)
-{
-	FILE *file;
-	char command[PATH_MAX*2];
-	if (!filename)
-		return;
-
-	sprintf(command, "objdump --start-address=0x%016lx --stop-address=0x%016lx -dS %s", filter_start, filter_end, filename);
-
-	file = popen(command, "r");
-	if (!file)
-		return;
-
-	lines_tail = &lines;
-	while (!feof(file)) {
-		struct source_line *src;
-		size_t dummy = 0;
-		char *c;
-
-		src = malloc(sizeof(struct source_line));
-		assert(src != NULL);
-		memset(src, 0, sizeof(struct source_line));
-
-		if (getline(&src->line, &dummy, file) < 0)
-			break;
-		if (!src->line)
-			break;
-
-		c = strchr(src->line, '\n');
-		if (c)
-			*c = 0;
-
-		src->next = NULL;
-		*lines_tail = src;
-		lines_tail = &src->next;
-
-		if (strlen(src->line)>8 && src->line[8] == ':')
-			src->EIP = strtoull(src->line, NULL, 16);
-		if (strlen(src->line)>8 && src->line[16] == ':')
-			src->EIP = strtoull(src->line, NULL, 16);
-	}
-	pclose(file);
-}
-
-static void record_precise_ip(uint64_t ip)
-{
-	struct source_line *line;
-
-	for (line = lines; line; line = line->next) {
-		if (line->EIP == ip)
-			line->count++;
-		if (line->EIP > ip)
-			break;
-	}
-}
-
-static void lookup_sym_in_vmlinux(struct sym_entry *sym)
-{
-	struct source_line *line;
-	char pattern[PATH_MAX];
-	sprintf(pattern, "<%s>:", sym->sym);
-
-	for (line = lines; line; line = line->next) {
-		if (strstr(line->line, pattern)) {
-			sym->source = line;
-			break;
-		}
-	}
-}
-
-static void show_lines(struct source_line *line_queue, int line_queue_count)
-{
-	int i;
-	struct source_line *line;
-
-	line = line_queue;
-	for (i = 0; i < line_queue_count; i++) {
-		printf("%8li\t%s\n", line->count, line->line);
-		line = line->next;
-	}
-}
-
 #define TRACE_COUNT     3
 
-static void show_details(struct sym_entry *sym)
-{
-	struct source_line *line;
-	struct source_line *line_queue = NULL;
-	int displayed = 0;
-	int line_queue_count = 0;
-
-	if (!sym->source)
-		lookup_sym_in_vmlinux(sym);
-	if (!sym->source)
-		return;
-
-	printf("Showing details for %s\n", sym->sym);
-
-	line = sym->source;
-	while (line) {
-		if (displayed && strstr(line->line, ">:"))
-			break;
-
-		if (!line_queue_count)
-			line_queue = line;
-		line_queue_count ++;
-
-		if (line->count >= count_filter) {
-			show_lines(line_queue, line_queue_count);
-			line_queue_count = 0;
-			line_queue = NULL;
-		} else if (line_queue_count > TRACE_COUNT) {
-			line_queue = line_queue->next;
-			line_queue_count --;
-		}
-
-		line->count = 0;
-		displayed++;
-		if (displayed > 300)
-			break;
-		line = line->next;
-	}
-}
-
 /*
  * Binary search in the histogram table and record the hit:
  */
@@ -764,8 +431,6 @@ static void record_ip(uint64_t ip, int counter)
 	int left_idx, middle_idx, right_idx, idx;
 	unsigned long left, middle, right;
 
-	record_precise_ip(ip);
-
 	left_idx = 0;
 	right_idx = sym_table_count-1;
 	assert(ip <= max_ip && ip >= min_ip);
@@ -822,97 +487,6 @@ static void process_event(uint64_t ip, int counter)
 	record_ip(ip, counter);
 }
 
-static void process_options(int argc, char **argv)
-{
-	int error = 0, counter;
-
-	for (;;) {
-		int option_index = 0;
-		/** Options for getopt */
-		static struct option long_options[] = {
-			{"count",	required_argument,	NULL, 'c'},
-			{"cpu",		required_argument,	NULL, 'C'},
-			{"delay",	required_argument,	NULL, 'd'},
-			{"dump_symtab",	no_argument,		NULL, 'D'},
-			{"event",	required_argument,	NULL, 'e'},
-			{"filter",	required_argument,	NULL, 'f'},
-			{"group",	required_argument,	NULL, 'g'},
-			{"help",	no_argument,		NULL, 'h'},
-			{"nmi",		required_argument,	NULL, 'n'},
-			{"mmap_info",	no_argument,		NULL, 'M'},
-			{"mmap_pages",	required_argument,	NULL, 'm'},
-			{"munmap_info",	no_argument,		NULL, 'U'},
-			{"pid",		required_argument,	NULL, 'p'},
-			{"realtime",	required_argument,	NULL, 'r'},
-			{"scale",	no_argument,		NULL, 'l'},
-			{"symbol",	required_argument,	NULL, 's'},
-			{"stat",	no_argument,		NULL, 'S'},
-			{"vmlinux",	required_argument,	NULL, 'x'},
-			{"zero",	no_argument,		NULL, 'z'},
-			{"freq",	required_argument,	NULL, 'F'},
-			{NULL,		0,			NULL,  0 }
-		};
-		int c = getopt_long(argc, argv, "+:ac:C:d:De:f:g:hln:m:p:r:s:Sx:zMUF:",
-				    long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'a': system_wide			=	       1; break;
-		case 'c': default_interval		=   atoi(optarg); break;
-		case 'C':
-			/* CPU and PID are mutually exclusive */
-			if (tid != -1) {
-				printf("WARNING: CPU switch overriding PID\n");
-				sleep(1);
-				tid = -1;
-			}
-			profile_cpu			=   atoi(optarg); break;
-		case 'd': delay_secs			=   atoi(optarg); break;
-		case 'D': dump_symtab			=              1; break;
-
-		case 'e': error				= parse_events(optarg); break;
-
-		case 'f': count_filter			=   atoi(optarg); break;
-		case 'g': group				=   atoi(optarg); break;
-		case 'h':      				  display_help(); break;
-		case 'l': scale				=	       1; break;
-		case 'n': nmi				=   atoi(optarg); break;
-		case 'p':
-			/* CPU and PID are mutually exclusive */
-			if (profile_cpu != -1) {
-				printf("WARNING: PID switch overriding CPU\n");
-				sleep(1);
-				profile_cpu = -1;
-			}
-			tid				=   atoi(optarg); break;
-		case 'r': realtime_prio			=   atoi(optarg); break;
-		case 's': sym_filter			= strdup(optarg); break;
-		case 'x': vmlinux			= strdup(optarg); break;
-		case 'z': zero				=              1; break;
-		case 'm': mmap_pages			=   atoi(optarg); break;
-		case 'M': use_mmap			=              1; break;
-		case 'U': use_munmap			=              1; break;
-		case 'F': freq = 1; default_interval	=   atoi(optarg); break;
-		default: error = 1; break;
-		}
-	}
-	if (error)
-		display_help();
-
-	if (!nr_counters) {
-		nr_counters = 1;
-		event_id[0] = 0;
-	}
-
-	for (counter = 0; counter < nr_counters; counter++) {
-		if (event_count[counter])
-			continue;
-
-		event_count[counter] = default_interval;
-	}
-}
-
 struct mmap_data {
 	int counter;
 	void *base;
@@ -973,11 +547,11 @@ static void mmap_read(struct mmap_data *md)
 		struct ip_event {
 			struct perf_event_header header;
 			__u64 ip;
-			__u32 pid, tid;
+			__u32 pid, target_pid;
 		};
 		struct mmap_event {
 			struct perf_event_header header;
-			__u32 pid, tid;
+			__u32 pid, target_pid;
 			__u64 start;
 			__u64 len;
 			__u64 pgoff;
@@ -1043,7 +617,7 @@ static void mmap_read(struct mmap_data *md)
 static struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
 static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 
-int cmd_top(int argc, char **argv, const char *prefix)
+static int __cmd_top(void)
 {
 	struct perf_counter_hw_event hw_event;
 	pthread_t thread;
@@ -1051,27 +625,12 @@ int cmd_top(int argc, char **argv, const char *prefix)
 	unsigned int cpu;
 	int ret;
 
-	page_size = sysconf(_SC_PAGE_SIZE);
-
-	process_options(argc, argv);
-
-	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	assert(nr_cpus <= MAX_NR_CPUS);
-	assert(nr_cpus >= 0);
-
-	if (tid != -1 || profile_cpu != -1)
-		nr_cpus = 1;
-
-	parse_symbols();
-	if (vmlinux && sym_filter_entry)
-		parse_vmlinux(vmlinux);
-
 	for (i = 0; i < nr_cpus; i++) {
 		group_fd = -1;
 		for (counter = 0; counter < nr_counters; counter++) {
 
 			cpu	= profile_cpu;
-			if (tid == -1 && profile_cpu == -1)
+			if (target_pid == -1 && profile_cpu == -1)
 				cpu = i;
 
 			memset(&hw_event, 0, sizeof(hw_event));
@@ -1083,7 +642,7 @@ int cmd_top(int argc, char **argv, const char *prefix)
 			hw_event.munmap		= use_munmap;
 			hw_event.freq		= freq;
 
-			fd[i][counter] = sys_perf_counter_open(&hw_event, tid, cpu, group_fd, 0);
+			fd[i][counter] = sys_perf_counter_open(&hw_event, target_pid, cpu, group_fd, 0);
 			if (fd[i][counter] < 0) {
 				int err = errno;
 				printf("kerneltop error: syscall returned with %d (%s)\n",
@@ -1147,3 +706,95 @@ int cmd_top(int argc, char **argv, const char *prefix)
 
 	return 0;
 }
+
+static const char * const top_usage[] = {
+	"perf top [<options>]",
+	NULL
+};
+
+static char events_help_msg[EVENTS_HELP_MAX];
+
+static const struct option options[] = {
+	OPT_CALLBACK('e', "event", NULL, "event",
+		     events_help_msg, parse_events),
+	OPT_INTEGER('c', "count", &default_interval,
+		    "event period to sample"),
+	OPT_INTEGER('p', "pid", &target_pid,
+		    "profile events on existing pid"),
+	OPT_BOOLEAN('a', "all-cpus", &system_wide,
+			    "system-wide collection from all CPUs"),
+	OPT_INTEGER('C', "CPU", &profile_cpu,
+		    "CPU to profile on"),
+	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
+		    "number of mmap data pages"),
+	OPT_INTEGER('r', "realtime", &realtime_prio,
+		    "collect data with this RT SCHED_FIFO priority"),
+	OPT_INTEGER('d', "delay", &realtime_prio,
+		    "number of seconds to delay between refreshes"),
+	OPT_BOOLEAN('D', "dump-symtab", &dump_symtab,
+			    "dump the symbol table used for profiling"),
+	OPT_INTEGER('f', "--count-filter", &count_filter,
+		    "only display functions with more events than this"),
+	OPT_BOOLEAN('g', "group", &group,
+			    "put the counters into a counter group"),
+	OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
+		    "only display symbols matchig this pattern"),
+	OPT_BOOLEAN('z', "zero", &group,
+		    "zero history across updates"),
+	OPT_BOOLEAN('M', "use-mmap", &use_mmap,
+		    "track mmap events"),
+	OPT_BOOLEAN('U', "use-munmap", &use_munmap,
+		    "track munmap events"),
+	OPT_INTEGER('F', "--freq", &freq,
+		    "profile at this frequency"),
+	OPT_END()
+};
+
+int cmd_top(int argc, const char **argv, const char *prefix)
+{
+	int counter;
+
+	page_size = sysconf(_SC_PAGE_SIZE);
+
+	create_events_help(events_help_msg);
+	memcpy(event_id, default_event_id, sizeof(default_event_id));
+
+	argc = parse_options(argc, argv, options, top_usage, 0);
+	if (argc)
+		usage_with_options(top_usage, options);
+
+	if (freq) {
+		default_interval = freq;
+		freq = 1;
+	}
+
+	/* CPU and PID are mutually exclusive */
+	if (target_pid != -1 && profile_cpu != -1) {
+		printf("WARNING: PID switch overriding CPU\n");
+		sleep(1);
+		profile_cpu = -1;
+	}
+
+	if (!nr_counters) {
+		nr_counters = 1;
+		event_id[0] = 0;
+	}
+
+	for (counter = 0; counter < nr_counters; counter++) {
+		if (event_count[counter])
+			continue;
+
+		event_count[counter] = default_interval;
+	}
+
+	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+	assert(nr_cpus <= MAX_NR_CPUS);
+	assert(nr_cpus >= 0);
+
+	if (target_pid != -1 || profile_cpu != -1)
+		nr_cpus = 1;
+
+	parse_symbols();
+
+	return __cmd_top();
+}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: First part of 'perf report' conversion to C + elfutils
       [not found]             ` <new-submission>
                                 ` (47 preceding siblings ...)
  2009-05-26 11:36               ` [tip:perfcounters/core] perf top: " tip-bot for Ingo Molnar
@ 2009-05-26 12:12               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 12:12               ` [tip:perfcounters/core] perf_counter tools: remove the standalone perf-report utility tip-bot for Ingo Molnar
                                 ` (658 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 12:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  8fa66bdcc81dd4fc2c91228074d0a4698120c5a2
Gitweb:     http://git.kernel.org/tip/8fa66bdcc81dd4fc2c91228074d0a4698120c5a2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 18 May 2009 12:45:42 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:53 +0200

perf_counter: First part of 'perf report' conversion to C + elfutils

Integrate perf-report into 'perf', as builtin-report.c.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile         |    6 +-
 Documentation/perf_counter/builtin-report.c |  751 +++++++++++++++++++++++++++
 Documentation/perf_counter/builtin.h        |    1 +
 Documentation/perf_counter/command-list.txt |    1 +
 Documentation/perf_counter/perf.c           |    1 +
 5 files changed, 755 insertions(+), 5 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 45daa72..49c601e 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -228,7 +228,6 @@ COMPAT_CFLAGS =
 COMPAT_OBJS =
 LIB_H =
 LIB_OBJS =
-PROGRAMS = perf-report
 SCRIPT_PERL =
 SCRIPT_SH =
 TEST_PROGRAMS =
@@ -315,6 +314,7 @@ LIB_OBJS += util/wrapper.o
 
 BUILTIN_OBJS += builtin-help.o
 BUILTIN_OBJS += builtin-record.o
+BUILTIN_OBJS += builtin-report.o
 BUILTIN_OBJS += builtin-stat.o
 BUILTIN_OBJS += builtin-top.o
 
@@ -811,10 +811,6 @@ clean:
 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
 	$(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS
 
-# temporary hack:
-perf-report: perf-report.cc ../../include/linux/perf_counter.h Makefile
-	g++ -g -O2 -Wall -lrt -o $@ $<
-
 .PHONY: all install clean strip
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
new file mode 100644
index 0000000..864f68f
--- /dev/null
+++ b/Documentation/perf_counter/builtin-report.c
@@ -0,0 +1,751 @@
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#include <time.h>
+#include <getopt.h>
+#include <assert.h>
+#include <search.h>
+
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
+#include <sys/wait.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/unistd.h>
+#include <linux/types.h>
+
+#include "../../include/linux/perf_counter.h"
+#include "list.h"
+
+#define SHOW_KERNEL	1
+#define SHOW_USER	2
+#define SHOW_HV		4
+
+static char 		const *input_name = "output.perf";
+static int		input;
+static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
+
+static unsigned long	page_size;
+static unsigned long	mmap_window = 32;
+
+static const char *perf_event_names[] = {
+	[PERF_EVENT_MMAP]   = " PERF_EVENT_MMAP",
+	[PERF_EVENT_MUNMAP] = " PERF_EVENT_MUNMAP",
+	[PERF_EVENT_COMM]   = " PERF_EVENT_COMM",
+};
+
+struct ip_event {
+	struct perf_event_header header;
+	__u64 ip;
+	__u32 pid, tid;
+};
+struct mmap_event {
+	struct perf_event_header header;
+	__u32 pid, tid;
+	__u64 start;
+	__u64 len;
+	__u64 pgoff;
+	char filename[PATH_MAX];
+};
+struct comm_event {
+	struct perf_event_header header;
+	__u32 pid,tid;
+	char comm[16];
+};
+
+typedef union event_union {
+	struct perf_event_header header;
+	struct ip_event ip;
+	struct mmap_event mmap;
+	struct comm_event comm;
+} event_t;
+
+struct section {
+	struct list_head node;
+	uint64_t	 start;
+	uint64_t	 end;
+	uint64_t	 offset;
+	char		 name[0];
+};
+
+static struct section *section__new(uint64_t start, uint64_t size,
+				    uint64_t offset, char *name)
+{
+	struct section *self = malloc(sizeof(*self) + strlen(name) + 1);
+
+	if (self != NULL) {
+		self->start  = start;
+		self->end    = start + size;
+		self->offset = offset;
+		strcpy(self->name, name);
+	}
+
+	return self;
+}
+
+static void section__delete(struct section *self)
+{
+	free(self);
+}
+
+struct symbol {
+	struct list_head node;
+	uint64_t	 start;
+	uint64_t	 end;
+	char		 name[0];
+};
+
+static struct symbol *symbol__new(uint64_t start, uint64_t len, const char *name)
+{
+	struct symbol *self = malloc(sizeof(*self) + strlen(name) + 1);
+
+	if (self != NULL) {
+		self->start = start;
+		self->end   = start + len;
+		strcpy(self->name, name);
+	}
+
+	return self;
+}
+
+static void symbol__delete(struct symbol *self)
+{
+	free(self);
+}
+
+static size_t symbol__fprintf(struct symbol *self, FILE *fp)
+{
+	return fprintf(fp, " %lx-%lx %s\n",
+		       self->start, self->end, self->name);
+}
+
+struct dso {
+	struct list_head node;
+	struct list_head sections;
+	struct list_head syms;
+	char		 name[0];
+};
+
+static struct dso *dso__new(const char *name)
+{
+	struct dso *self = malloc(sizeof(*self) + strlen(name) + 1);
+
+	if (self != NULL) {
+		strcpy(self->name, name);
+		INIT_LIST_HEAD(&self->sections);
+		INIT_LIST_HEAD(&self->syms);
+	}
+
+	return self;
+}
+
+static void dso__delete_sections(struct dso *self)
+{
+	struct section *pos, *n;
+
+	list_for_each_entry_safe(pos, n, &self->sections, node)
+		section__delete(pos);
+}
+
+static void dso__delete_symbols(struct dso *self)
+{
+	struct symbol *pos, *n;
+
+	list_for_each_entry_safe(pos, n, &self->syms, node)
+		symbol__delete(pos);
+}
+
+static void dso__delete(struct dso *self)
+{
+	dso__delete_sections(self);
+	dso__delete_symbols(self);
+	free(self);
+}
+
+static void dso__insert_symbol(struct dso *self, struct symbol *sym)
+{
+	list_add_tail(&sym->node, &self->syms);
+}
+
+static struct symbol *dso__find_symbol(struct dso *self, uint64_t ip)
+{
+	if (self == NULL)
+		return NULL;
+
+	struct symbol *pos;
+
+	list_for_each_entry(pos, &self->syms, node)
+		if (ip >= pos->start && ip <= pos->end)
+			return pos;
+
+	return NULL;
+}
+
+static int dso__load(struct dso *self)
+{
+	/* FIXME */
+	return 0;
+}
+
+static size_t dso__fprintf(struct dso *self, FILE *fp)
+{
+	struct symbol *pos;
+	size_t ret = fprintf(fp, "dso: %s\n", self->name);
+
+	list_for_each_entry(pos, &self->syms, node)
+		ret += symbol__fprintf(pos, fp);
+
+	return ret;
+}
+
+static LIST_HEAD(dsos);
+static struct dso *kernel_dso;
+
+static void dsos__add(struct dso *dso)
+{
+	list_add_tail(&dso->node, &dsos);
+}
+
+static struct dso *dsos__find(const char *name)
+{
+	struct dso *pos;
+
+	list_for_each_entry(pos, &dsos, node)
+		if (strcmp(pos->name, name) == 0)
+			return pos;
+	return NULL;
+}
+
+static struct dso *dsos__findnew(const char *name)
+{
+	struct dso *dso = dsos__find(name);
+
+	if (dso == NULL) {
+		dso = dso__new(name);
+		if (dso != NULL && dso__load(dso) < 0)
+			goto out_delete_dso;
+
+		dsos__add(dso);
+	}
+
+	return dso;
+
+out_delete_dso:
+	dso__delete(dso);
+	return NULL;
+}
+
+static void dsos__fprintf(FILE *fp)
+{
+	struct dso *pos;
+
+	list_for_each_entry(pos, &dsos, node)
+		dso__fprintf(pos, fp);
+}
+
+static int load_kallsyms(void)
+{
+	kernel_dso = dso__new("[kernel]");
+	if (kernel_dso == NULL)
+		return -1;
+
+	FILE *file = fopen("/proc/kallsyms", "r");
+
+	if (file == NULL)
+		goto out_delete_dso;
+
+	char *line = NULL;
+	size_t n;
+
+	while (!feof(file)) {
+		unsigned long long start;
+		char c, symbf[4096];
+
+		if (getline(&line, &n, file) < 0)
+			break;
+
+		if (!line)
+			goto out_delete_dso;
+
+		if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
+			struct symbol *sym = symbol__new(start, 0x1000000, symbf);
+
+			if (sym == NULL)
+				goto out_delete_dso;
+
+			dso__insert_symbol(kernel_dso, sym);
+		}
+	}
+
+	dsos__add(kernel_dso);
+	free(line);
+	fclose(file);
+	return 0;
+
+out_delete_dso:
+	dso__delete(kernel_dso);
+	return -1;
+}
+
+struct map {
+	struct list_head node;
+	uint64_t	 start;
+	uint64_t	 end;
+	uint64_t	 pgoff;
+	struct dso	 *dso;
+};
+
+static struct map *map__new(struct mmap_event *event)
+{
+	struct map *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		self->start = event->start;
+		self->end   = event->start + event->len;
+		self->pgoff = event->pgoff;
+
+		self->dso = dsos__findnew(event->filename);
+		if (self->dso == NULL)
+			goto out_delete;
+	}
+	return self;
+out_delete:
+	free(self);
+	return NULL;
+}
+
+static size_t map__fprintf(struct map *self, FILE *fp)
+{
+	return fprintf(fp, " %lx-%lx %lx %s\n",
+		       self->start, self->end, self->pgoff, self->dso->name);
+}
+
+struct symhist {
+	struct list_head node;
+	struct dso	 *dso;
+	struct symbol	 *sym;
+	uint32_t	 count;
+	char		 level;
+};
+
+static struct symhist *symhist__new(struct symbol *sym, struct dso *dso,
+				    char level)
+{
+	struct symhist *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		self->sym   = sym;
+		self->dso   = dso;
+		self->level = level;
+		self->count = 0;
+	}
+
+	return self;
+}
+
+static void symhist__delete(struct symhist *self)
+{
+	free(self);
+}
+
+static bool symhist__equal(struct symhist *self, struct symbol *sym,
+			   struct dso *dso, char level)
+{
+	return self->level == level && self->sym == sym && self->dso == dso;
+}
+
+static void symhist__inc(struct symhist *self)
+{
+	++self->count;
+}
+
+static size_t symhist__fprintf(struct symhist *self, FILE *fp)
+{
+	size_t ret = fprintf(fp, "[%c] ", self->level);
+
+	if (self->level != '.')
+		ret += fprintf(fp, "%s", self->sym->name);
+	else
+		ret += fprintf(fp, "%s: %s",
+			       self->dso ? self->dso->name : "<unknown",
+			       self->sym ? self->sym->name : "<unknown>");
+	return ret + fprintf(fp, ": %u\n", self->count);
+}
+
+struct thread {
+	struct list_head node;
+	struct list_head maps;
+	struct list_head symhists;
+	pid_t		 pid;
+	char		 *comm;
+};
+
+static struct thread *thread__new(pid_t pid)
+{
+	struct thread *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		self->pid = pid;
+		self->comm = NULL;
+		INIT_LIST_HEAD(&self->maps);
+		INIT_LIST_HEAD(&self->symhists);
+	}
+
+	return self;
+}
+
+static void thread__insert_symhist(struct thread *self,
+				   struct symhist *symhist)
+{
+	list_add_tail(&symhist->node, &self->symhists);
+}
+
+static struct symhist *thread__symhists_find(struct thread *self,
+					     struct symbol *sym,
+					     struct dso *dso, char level)
+{
+	struct symhist *pos;
+
+	list_for_each_entry(pos, &self->symhists, node)
+		if (symhist__equal(pos, sym, dso, level))
+			return pos;
+
+	return NULL;
+}
+
+static int thread__symbol_incnew(struct thread *self, struct symbol *sym,
+				 struct dso *dso, char level)
+{
+	struct symhist *symhist = thread__symhists_find(self, sym, dso, level);
+
+	if (symhist == NULL) {
+		symhist = symhist__new(sym, dso, level);
+		if (symhist == NULL)
+			goto out_error;
+		thread__insert_symhist(self, symhist);
+	}
+
+	symhist__inc(symhist);
+	return 0;
+out_error:
+	return -ENOMEM;
+}
+
+static int thread__set_comm(struct thread *self, const char *comm)
+{
+	self->comm = strdup(comm);
+	return self->comm ? 0 : -ENOMEM;
+}
+
+static size_t thread__maps_fprintf(struct thread *self, FILE *fp)
+{
+	struct map *pos;
+	size_t ret = 0;
+
+	list_for_each_entry(pos, &self->maps, node)
+		ret += map__fprintf(pos, fp);
+
+	return ret;
+}
+
+static size_t thread__fprintf(struct thread *self, FILE *fp)
+{
+	struct symhist *pos;
+	int ret = fprintf(fp, "thread: %d %s\n", self->pid, self->comm);
+
+	list_for_each_entry(pos, &self->symhists, node)
+		ret += symhist__fprintf(pos, fp);
+
+	return ret;
+}
+
+static LIST_HEAD(threads);
+
+static void threads__add(struct thread *thread)
+{
+	list_add_tail(&thread->node, &threads);
+}
+
+static struct thread *threads__find(pid_t pid)
+{
+	struct thread *pos;
+
+	list_for_each_entry(pos, &threads, node)
+		if (pos->pid == pid)
+			return pos;
+	return NULL;
+}
+
+static struct thread *threads__findnew(pid_t pid)
+{
+	struct thread *thread = threads__find(pid);
+
+	if (thread == NULL) {
+		thread = thread__new(pid);
+		if (thread != NULL)
+			threads__add(thread);
+	}
+
+	return thread;
+}
+
+static void thread__insert_map(struct thread *self, struct map *map)
+{
+	list_add_tail(&map->node, &self->maps);
+}
+
+static struct map *thread__find_map(struct thread *self, uint64_t ip)
+{
+	if (self == NULL)
+		return NULL;
+
+	struct map *pos;
+
+	list_for_each_entry(pos, &self->maps, node)
+		if (ip >= pos->start && ip <= pos->end)
+			return pos;
+
+	return NULL;
+}
+
+static void threads__fprintf(FILE *fp)
+{
+	struct thread *pos;
+
+	list_for_each_entry(pos, &threads, node)
+		thread__fprintf(pos, fp);
+}
+
+#if 0
+static std::string resolve_user_symbol(int pid, uint64_t ip)
+{
+	std::string sym = "<unknown>";
+
+	maps_t &m = maps[pid];
+	maps_t::const_iterator mi = m.upper_bound(map(ip));
+	if (mi == m.end())
+		return sym;
+
+	ip -= mi->start + mi->pgoff;
+
+	symbols_t &s = dsos[mi->dso].syms;
+	symbols_t::const_iterator si = s.upper_bound(symbol(ip));
+
+	sym = mi->dso + ": <unknown>";
+
+	if (si == s.begin())
+		return sym;
+	si--;
+
+	if (si->start <= ip && ip < si->end)
+		sym = mi->dso + ": " + si->name;
+#if 0
+	else if (si->start <= ip)
+		sym = mi->dso + ": ?" + si->name;
+#endif
+
+	return sym;
+}
+#endif
+
+static void display_help(void)
+{
+	printf(
+	"Usage: perf-report [<options>]\n"
+	" -i file   --input=<file>      # input file\n"
+	);
+
+	exit(0);
+}
+
+static void process_options(int argc, char *argv[])
+{
+	int error = 0;
+
+	for (;;) {
+		int option_index = 0;
+		/** Options for getopt */
+		static struct option long_options[] = {
+			{"input",	required_argument,	NULL, 'i'},
+			{"no-user",	no_argument,		NULL, 'u'},
+			{"no-kernel",	no_argument,		NULL, 'k'},
+			{"no-hv",	no_argument,		NULL, 'h'},
+			{NULL,		0,			NULL,  0 }
+		};
+		int c = getopt_long(argc, argv, "+:i:kuh",
+				    long_options, &option_index);
+		if (c == -1)
+			break;
+
+		switch (c) {
+		case 'i': input_name			= strdup(optarg); break;
+		case 'k': show_mask &= ~SHOW_KERNEL; break;
+		case 'u': show_mask &= ~SHOW_USER; break;
+		case 'h': show_mask &= ~SHOW_HV; break;
+		default: error = 1; break;
+		}
+	}
+
+	if (error)
+		display_help();
+}
+
+int cmd_report(int argc, char **argv)
+{
+	unsigned long offset = 0;
+	unsigned long head = 0;
+	struct stat stat;
+	char *buf;
+	event_t *event;
+	int ret, rc = EXIT_FAILURE;
+	unsigned long total = 0;
+
+	page_size = getpagesize();
+
+	process_options(argc, argv);
+
+	input = open(input_name, O_RDONLY);
+	if (input < 0) {
+		perror("failed to open file");
+		exit(-1);
+	}
+
+	ret = fstat(input, &stat);
+	if (ret < 0) {
+		perror("failed to stat file");
+		exit(-1);
+	}
+
+	if (!stat.st_size) {
+		fprintf(stderr, "zero-sized file, nothing to do!\n");
+		exit(0);
+	}
+
+	if (load_kallsyms() < 0) {
+		perror("failed to open kallsyms");
+		return EXIT_FAILURE;
+	}
+
+remap:
+	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
+			   MAP_SHARED, input, offset);
+	if (buf == MAP_FAILED) {
+		perror("failed to mmap file");
+		exit(-1);
+	}
+
+more:
+	event = (event_t *)(buf + head);
+
+	if (head + event->header.size >= page_size * mmap_window) {
+		unsigned long shift = page_size * (head / page_size);
+		int ret;
+
+		ret = munmap(buf, page_size * mmap_window);
+		assert(ret == 0);
+
+		offset += shift;
+		head -= shift;
+		goto remap;
+	}
+
+
+	if (!event->header.size) {
+		fprintf(stderr, "zero-sized event at file offset %ld\n", offset + head);
+		fprintf(stderr, "skipping %ld bytes of events.\n", stat.st_size - offset - head);
+		goto done;
+	}
+
+	head += event->header.size;
+
+	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
+		char level;
+		int show = 0;
+		struct dso *dso = NULL;
+		struct thread *thread = threads__findnew(event->ip.pid);
+
+		if (thread == NULL)
+			goto done;
+
+		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
+			show = SHOW_KERNEL;
+			level = 'k';
+			dso = kernel_dso;
+		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
+			show = SHOW_USER;
+			level = '.';
+			struct map *map = thread__find_map(thread, event->ip.ip);
+			if (map != NULL)
+				dso = map->dso;
+		} else {
+			show = SHOW_HV;
+			level = 'H';
+		}
+
+		if (show & show_mask) {
+			struct symbol *sym = dso__find_symbol(dso, event->ip.ip);
+
+			if (thread__symbol_incnew(thread, sym, dso, level))
+				goto done;
+		}
+		total++;
+	} else switch (event->header.type) {
+	case PERF_EVENT_MMAP: {
+		struct thread *thread = threads__findnew(event->mmap.pid);
+		struct map *map = map__new(&event->mmap);
+
+		if (thread == NULL || map == NULL )
+			goto done;
+		thread__insert_map(thread, map);
+		break;
+	}
+	case PERF_EVENT_COMM: {
+		struct thread *thread = threads__findnew(event->comm.pid);
+
+		if (thread == NULL ||
+		    thread__set_comm(thread, event->comm.comm))
+			goto done;
+		break;
+	}
+	}
+
+	if (offset + head < stat.st_size)
+		goto more;
+
+	rc = EXIT_SUCCESS;
+done:
+	close(input);
+	//dsos__fprintf(stdout);
+	threads__fprintf(stdout);
+#if 0
+	std::map<std::string, int>::iterator hi = hist.begin();
+
+	while (hi != hist.end()) {
+		rev_hist.insert(std::pair<int, std::string>(hi->second, hi->first));
+		hist.erase(hi++);
+	}
+
+	std::multimap<int, std::string>::const_iterator ri = rev_hist.begin();
+
+	while (ri != rev_hist.end()) {
+		printf(" %5.2f %s\n", (100.0 * ri->first)/total, ri->second.c_str());
+		ri++;
+	}
+#endif
+	return rc;
+}
+
diff --git a/Documentation/perf_counter/builtin.h b/Documentation/perf_counter/builtin.h
index d32318a..5bfea57 100644
--- a/Documentation/perf_counter/builtin.h
+++ b/Documentation/perf_counter/builtin.h
@@ -16,6 +16,7 @@ extern int check_pager_config(const char *cmd);
 
 extern int cmd_help(int argc, const char **argv, const char *prefix);
 extern int cmd_record(int argc, const char **argv, const char *prefix);
+extern int cmd_report(int argc, const char **argv, const char *prefix);
 extern int cmd_stat(int argc, const char **argv, const char *prefix);
 extern int cmd_top(int argc, const char **argv, const char *prefix);
 extern int cmd_version(int argc, const char **argv, const char *prefix);
diff --git a/Documentation/perf_counter/command-list.txt b/Documentation/perf_counter/command-list.txt
index d15210a..4390292 100644
--- a/Documentation/perf_counter/command-list.txt
+++ b/Documentation/perf_counter/command-list.txt
@@ -1,6 +1,7 @@
 # List of known perf commands.
 # command name				category [deprecated] [common]
 perf-record                             mainporcelain common
+perf-report                             mainporcelain common
 perf-stat                               mainporcelain common
 perf-top                                mainporcelain common
 
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c
index 1d6d7aa..e8a8584 100644
--- a/Documentation/perf_counter/perf.c
+++ b/Documentation/perf_counter/perf.c
@@ -250,6 +250,7 @@ static void handle_internal_command(int argc, const char **argv)
 	static struct cmd_struct commands[] = {
 		{ "help", cmd_help, 0 },
 		{ "record", cmd_record, 0 },
+		{ "report", cmd_report, 0 },
 		{ "stat", cmd_stat, 0 },
 		{ "top", cmd_top, 0 },
 		{ "version", cmd_version, 0 },

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: remove the standalone perf-report utility
       [not found]             ` <new-submission>
                                 ` (48 preceding siblings ...)
  2009-05-26 12:12               ` [tip:perfcounters/core] perf_counter: First part of 'perf report' conversion to C + elfutils tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 12:12               ` tip-bot for Ingo Molnar
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Implement dso__load using libelf tip-bot for Arnaldo Carvalho de Melo
                                 ` (657 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 12:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, mtosatti, tglx,
	cjashfor, mingo

Commit-ID:  fd4242bb35b70557eee8d0c79f82dacc3f3b89e0
Gitweb:     http://git.kernel.org/tip/fd4242bb35b70557eee8d0c79f82dacc3f3b89e0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 20 May 2009 12:45:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:53 +0200

perf_counter tools: remove the standalone perf-report utility

With a built-in 'perf report' command now available, remove the
standalone implementation for good.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/perf-report.cc |  515 -----------------------------
 1 files changed, 0 insertions(+), 515 deletions(-)

diff --git a/Documentation/perf_counter/perf-report.cc b/Documentation/perf_counter/perf-report.cc
deleted file mode 100644
index 8855107..0000000
--- a/Documentation/perf_counter/perf-report.cc
+++ /dev/null
@@ -1,515 +0,0 @@
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-#include <getopt.h>
-#include <assert.h>
-
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <linux/unistd.h>
-#include <linux/types.h>
-
-#include "../../include/linux/perf_counter.h"
-
-#include <set>
-#include <map>
-#include <string>
-
-
-#define SHOW_KERNEL	1
-#define SHOW_USER	2
-#define SHOW_HV		4
-
-static char 		const *input_name = "output.perf";
-static int		input;
-static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
-
-static unsigned long	page_size;
-static unsigned long	mmap_window = 32;
-
-struct ip_event {
-	struct perf_event_header header;
-	__u64 ip;
-	__u32 pid, tid;
-};
-struct mmap_event {
-	struct perf_event_header header;
-	__u32 pid, tid;
-	__u64 start;
-	__u64 len;
-	__u64 pgoff;
-	char filename[PATH_MAX];
-};
-struct comm_event {
-	struct perf_event_header header;
-	__u32 pid,tid;
-	char comm[16];
-};
-
-typedef union event_union {
-	struct perf_event_header header;
-	struct ip_event ip;
-	struct mmap_event mmap;
-	struct comm_event comm;
-} event_t;
-
-struct section {
-	uint64_t start;
-	uint64_t end;
-
-	uint64_t offset;
-
-	std::string name;
-
-	section() { };
-
-	section(uint64_t stab) : end(stab) { };
-
-	section(uint64_t start, uint64_t size, uint64_t offset, std::string name) :
-		start(start), end(start + size), offset(offset), name(name)
-	{ };
-
-	bool operator < (const struct section &s) const {
-		return end < s.end;
-	};
-};
-
-typedef std::set<struct section> sections_t;
-
-struct symbol {
-	uint64_t start;
-	uint64_t end;
-
-	std::string name;
-
-	symbol() { };
-
-	symbol(uint64_t ip) : start(ip) { }
-
-	symbol(uint64_t start, uint64_t len, std::string name) :
-		start(start), end(start + len), name(name)
-	{ };
-
-	bool operator < (const struct symbol &s) const {
-		return start < s.start;
-	};
-};
-
-typedef std::set<struct symbol> symbols_t;
-
-struct dso {
-	sections_t sections;
-	symbols_t syms;
-};
-
-static std::map<std::string, struct dso> dsos;
-
-static void load_dso_sections(std::string dso_name)
-{
-	struct dso &dso = dsos[dso_name];
-
-	std::string cmd = "readelf -DSW " + dso_name;
-
-	FILE *file = popen(cmd.c_str(), "r");
-	if (!file) {
-		perror("failed to open pipe");
-		exit(-1);
-	}
-
-	char *line = NULL;
-	size_t n = 0;
-
-	while (!feof(file)) {
-		uint64_t addr, off, size;
-		char name[32];
-
-		if (getline(&line, &n, file) < 0)
-			break;
-		if (!line)
-			break;
-
-		if (sscanf(line, "  [%*2d] %16s %*14s %Lx %Lx %Lx",
-					name, &addr, &off, &size) == 4) {
-
-			dso.sections.insert(section(addr, size, addr - off, name));
-		}
-#if 0
-		/*
-		 * for reading readelf symbols (-s), however these don't seem
-		 * to include nearly everything, so use nm for that.
-		 */
-		if (sscanf(line, " %*4d %*3d: %Lx %5Lu %*7s %*6s %*7s %3d %s",
-			   &start, &size, &section, sym) == 4) {
-
-			start -= dso.section_offsets[section];
-
-			dso.syms.insert(symbol(start, size, std::string(sym)));
-		}
-#endif
-	}
-	pclose(file);
-}
-
-static void load_dso_symbols(std::string dso_name, std::string args)
-{
-	struct dso &dso = dsos[dso_name];
-
-	std::string cmd = "nm -nSC " + args + " " + dso_name;
-
-	FILE *file = popen(cmd.c_str(), "r");
-	if (!file) {
-		perror("failed to open pipe");
-		exit(-1);
-	}
-
-	char *line = NULL;
-	size_t n = 0;
-
-	while (!feof(file)) {
-		uint64_t start, size;
-		char c;
-		char sym[1024];
-
-		if (getline(&line, &n, file) < 0)
-			break;
-		if (!line)
-			break;
-
-
-		if (sscanf(line, "%Lx %Lx %c %s", &start, &size, &c, sym) == 4) {
-			sections_t::const_iterator si =
-				dso.sections.upper_bound(section(start));
-			if (si == dso.sections.end()) {
-				printf("symbol in unknown section: %s\n", sym);
-				continue;
-			}
-
-			start -= si->offset;
-
-			dso.syms.insert(symbol(start, size, sym));
-		}
-	}
-	pclose(file);
-}
-
-static void load_dso(std::string dso_name)
-{
-	load_dso_sections(dso_name);
-	load_dso_symbols(dso_name, "-D"); /* dynamic symbols */
-	load_dso_symbols(dso_name, "");   /* regular ones */
-}
-
-void load_kallsyms(void)
-{
-	struct dso &dso = dsos["[kernel]"];
-
-	FILE *file = fopen("/proc/kallsyms", "r");
-	if (!file) {
-		perror("failed to open kallsyms");
-		exit(-1);
-	}
-
-	char *line;
-	size_t n;
-
-	while (!feof(file)) {
-		uint64_t start;
-		char c;
-		char sym[1024000];
-
-		if (getline(&line, &n, file) < 0)
-			break;
-		if (!line)
-			break;
-
-		if (sscanf(line, "%Lx %c %s", &start, &c, sym) == 3)
-			dso.syms.insert(symbol(start, 0x1000000, std::string(sym)));
-	}
-	fclose(file);
-}
-
-struct map {
-	uint64_t start;
-	uint64_t end;
-	uint64_t pgoff;
-
-	std::string dso;
-
-	map() { };
-
-	map(uint64_t ip) : end(ip) { }
-
-	map(mmap_event *mmap) {
-		start = mmap->start;
-		end = mmap->start + mmap->len;
-		pgoff = mmap->pgoff;
-
-		dso = std::string(mmap->filename);
-
-		if (dsos.find(dso) == dsos.end())
-			load_dso(dso);
-	};
-
-	bool operator < (const struct map &m) const {
-		return end < m.end;
-	};
-};
-
-typedef std::set<struct map> maps_t;
-
-static std::map<int, maps_t> maps;
-
-static std::map<int, std::string> comms;
-
-static std::map<std::string, int> hist;
-static std::multimap<int, std::string> rev_hist;
-
-static std::string resolve_comm(int pid)
-{
-	std::string comm;
-
-	std::map<int, std::string>::const_iterator ci = comms.find(pid);
-	if (ci != comms.end()) {
-		comm = ci->second;
-	} else {
-		char pid_str[30];
-
-		sprintf(pid_str, ":%d", pid);
-		comm = pid_str;
-	}
-
-	return comm;
-}
-
-static std::string resolve_user_symbol(int pid, uint64_t ip)
-{
-	std::string sym = "<unknown>";
-
-	maps_t &m = maps[pid];
-	maps_t::const_iterator mi = m.upper_bound(map(ip));
-	if (mi == m.end())
-		return sym;
-
-	ip -= mi->start + mi->pgoff;
-
-	symbols_t &s = dsos[mi->dso].syms;
-	symbols_t::const_iterator si = s.upper_bound(symbol(ip));
-
-	sym = mi->dso + ": <unknown>";
-
-	if (si == s.begin())
-		return sym;
-	si--;
-
-	if (si->start <= ip && ip < si->end)
-		sym = mi->dso + ": " + si->name;
-#if 0
-	else if (si->start <= ip)
-		sym = mi->dso + ": ?" + si->name;
-#endif
-
-	return sym;
-}
-
-static std::string resolve_kernel_symbol(uint64_t ip)
-{
-	std::string sym = "<unknown>";
-
-	symbols_t &s = dsos["[kernel]"].syms;
-	symbols_t::const_iterator si = s.upper_bound(symbol(ip));
-
-	if (si == s.begin())
-		return sym;
-	si--;
-
-	if (si->start <= ip && ip < si->end)
-		sym = si->name;
-
-	return sym;
-}
-
-static void display_help(void)
-{
-	printf(
-	"Usage: perf-report [<options>]\n"
-	" -i file   --input=<file>      # input file\n"
-	);
-
-	exit(0);
-}
-
-static void process_options(int argc, char *argv[])
-{
-	int error = 0;
-
-	for (;;) {
-		int option_index = 0;
-		/** Options for getopt */
-		static struct option long_options[] = {
-			{"input",	required_argument,	NULL, 'i'},
-			{"no-user",	no_argument,		NULL, 'u'},
-			{"no-kernel",	no_argument,		NULL, 'k'},
-			{"no-hv",	no_argument,		NULL, 'h'},
-			{NULL,		0,			NULL,  0 }
-		};
-		int c = getopt_long(argc, argv, "+:i:kuh",
-				    long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'i': input_name			= strdup(optarg); break;
-		case 'k': show_mask &= ~SHOW_KERNEL; break;
-		case 'u': show_mask &= ~SHOW_USER; break;
-		case 'h': show_mask &= ~SHOW_HV; break;
-		default: error = 1; break;
-		}
-	}
-
-	if (error)
-		display_help();
-}
-
-int main(int argc, char *argv[])
-{
-	unsigned long offset = 0;
-	unsigned long head = 0;
-	struct stat stat;
-	char *buf;
-	event_t *event;
-	int ret;
-	unsigned long total = 0;
-
-	page_size = getpagesize();
-
-	process_options(argc, argv);
-
-	input = open(input_name, O_RDONLY);
-	if (input < 0) {
-		perror("failed to open file");
-		exit(-1);
-	}
-
-	ret = fstat(input, &stat);
-	if (ret < 0) {
-		perror("failed to stat file");
-		exit(-1);
-	}
-
-	if (!stat.st_size) {
-		fprintf(stderr, "zero-sized file, nothing to do!\n");
-		exit(0);
-	}
-
-	load_kallsyms();
-
-remap:
-	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
-			   MAP_SHARED, input, offset);
-	if (buf == MAP_FAILED) {
-		perror("failed to mmap file");
-		exit(-1);
-	}
-
-more:
-	event = (event_t *)(buf + head);
-
-	if (head + event->header.size >= page_size * mmap_window) {
-		unsigned long shift = page_size * (head / page_size);
-		int ret;
-
-		ret = munmap(buf, page_size * mmap_window);
-		assert(ret == 0);
-
-		offset += shift;
-		head -= shift;
-		goto remap;
-	}
-
-
-	if (!event->header.size) {
-		fprintf(stderr, "zero-sized event at file offset %ld\n", offset + head);
-		fprintf(stderr, "skipping %ld bytes of events.\n", stat.st_size - offset - head);
-		goto done;
-	}
-
-	head += event->header.size;
-
-	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
-		std::string comm, sym, level;
-		int show = 0;
-		char output[1024];
-
-		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
-			show |= SHOW_KERNEL;
-			level = " [k] ";
-			sym = resolve_kernel_symbol(event->ip.ip);
-		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
-			show |= SHOW_USER;
-			level = " [.] ";
-			sym = resolve_user_symbol(event->ip.pid, event->ip.ip);
-		} else {
-			show |= SHOW_HV;
-			level = " [H] ";
-		}
-
-		if (show & show_mask) {
-			comm = resolve_comm(event->ip.pid);
-			snprintf(output, sizeof(output), "%16s %s %s",
-					comm.c_str(), level.c_str(), sym.c_str());
-			hist[output]++;
-		}
-
-		total++;
-
-	} else switch (event->header.type) {
-	case PERF_EVENT_MMAP:
-		maps[event->mmap.pid].insert(map(&event->mmap));
-		break;
-
-	case PERF_EVENT_COMM:
-		comms[event->comm.pid] = std::string(event->comm.comm);
-		break;
-	}
-
-	if (offset + head < stat.st_size)
-		goto more;
-
-done:
-
-	close(input);
-
-	std::map<std::string, int>::iterator hi = hist.begin();
-
-	while (hi != hist.end()) {
-		rev_hist.insert(std::pair<int, std::string>(hi->second, hi->first));
-		hist.erase(hi++);
-	}
-
-	std::multimap<int, std::string>::const_iterator ri = rev_hist.begin();
-
-	while (ri != rev_hist.end()) {
-		printf(" %5.2f %s\n", (100.0 * ri->first)/total, ri->second.c_str());
-		ri++;
-	}
-
-	return 0;
-}
-

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Implement dso__load using libelf
       [not found]             ` <new-submission>
                                 ` (49 preceding siblings ...)
  2009-05-26 12:12               ` [tip:perfcounters/core] perf_counter tools: remove the standalone perf-report utility tip-bot for Ingo Molnar
@ 2009-05-26 12:13               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Use rb_trees in perf report tip-bot for Arnaldo Carvalho de Melo
                                 ` (656 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 12:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  62eb93905b3b43cea407cfbc061cc7b40ae1c6e9
Gitweb:     http://git.kernel.org/tip/62eb93905b3b43cea407cfbc061cc7b40ae1c6e9
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 18 May 2009 14:28:47 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:53 +0200

perf_counter: Implement dso__load using libelf

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile         |    2 +-
 Documentation/perf_counter/builtin-report.c |  122 ++++++++++++++++++++++++++-
 2 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 49c601e..6bffa86 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -160,7 +160,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 CFLAGS = -g -O2 -Wall
-LDFLAGS = -lpthread -lrt
+LDFLAGS = -lpthread -lrt -lelf
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 864f68f..ad2f327 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -8,6 +8,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
+#include <gelf.h>
+#include <elf.h>
+#include <libelf.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
@@ -195,10 +198,123 @@ static struct symbol *dso__find_symbol(struct dso *self, uint64_t ip)
 	return NULL;
 }
 
+/**
+ * elf_symtab__for_each_symbol - iterate thru all the symbols
+ *
+ * @self: struct elf_symtab instance to iterate
+ * @index: uint32_t index
+ * @sym: GElf_Sym iterator
+ */
+#define elf_symtab__for_each_symbol(syms, nr_syms, index, sym) \
+	for (index = 0, gelf_getsym(syms, index, &sym);\
+	     index < nr_syms; \
+	     index++, gelf_getsym(syms, index, &sym))
+
+static inline uint8_t elf_sym__type(const GElf_Sym *sym)
+{
+	return GELF_ST_TYPE(sym->st_info);
+}
+
+static inline bool elf_sym__is_function(const GElf_Sym *sym)
+{
+	return elf_sym__type(sym) == STT_FUNC &&
+	       sym->st_name != 0 &&
+	       sym->st_shndx != SHN_UNDEF;
+}
+
+static inline const char *elf_sym__name(const GElf_Sym *sym,
+					const Elf_Data *symstrs)
+{
+	return symstrs->d_buf + sym->st_name;
+}
+
+static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
+				    GElf_Shdr *shp, const char *name,
+				    size_t *index)
+{
+	Elf_Scn *sec = NULL;
+	size_t cnt = 1;
+
+	while ((sec = elf_nextscn(elf, sec)) != NULL) {
+		char *str;
+
+		gelf_getshdr(sec, shp);
+		str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
+		if (!strcmp(name, str)) {
+			if (index)
+				*index = cnt;
+			break;
+		}
+		++cnt;
+	}
+
+	return sec;
+}
+
 static int dso__load(struct dso *self)
 {
-	/* FIXME */
-	return 0;
+	int fd = open(self->name, O_RDONLY), err = -1;
+
+	if (fd == -1)
+		return -1;
+
+	Elf *elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
+	if (elf == NULL) {
+		fprintf(stderr, "%s: cannot read %s ELF file.\n",
+			__func__, self->name);
+		goto out_close;
+	}
+
+	GElf_Ehdr ehdr;
+	if (gelf_getehdr(elf, &ehdr) == NULL) {
+		fprintf(stderr, "%s: cannot get elf header.\n", __func__);
+		goto out_elf_end;
+	}
+
+	GElf_Shdr shdr;
+	Elf_Scn *sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
+	if (sec == NULL)
+		sec = elf_section_by_name(elf, &ehdr, &shdr, ".dynsym", NULL);
+
+	if (sec == NULL)
+		goto out_elf_end;
+
+	if (gelf_getshdr(sec, &shdr) == NULL)
+		goto out_elf_end;
+
+	Elf_Data *syms = elf_getdata(sec, NULL);
+	if (syms == NULL)
+		goto out_elf_end;
+
+	sec = elf_getscn(elf, shdr.sh_link);
+	if (sec == NULL)
+		goto out_elf_end;
+
+	Elf_Data *symstrs = elf_getdata(sec, NULL);
+	if (symstrs == NULL)
+		goto out_elf_end;
+
+	const uint32_t nr_syms = shdr.sh_size / shdr.sh_entsize;
+
+	GElf_Sym sym;
+	uint32_t index;
+	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
+		if (!elf_sym__is_function(&sym))
+			continue;
+		struct symbol *f = symbol__new(sym.st_value, sym.st_size,
+					       elf_sym__name(&sym, symstrs));
+		if (f == NULL)
+			goto out_elf_end;
+
+		dso__insert_symbol(self, f);
+	}
+
+	err = 0;
+out_elf_end:
+	elf_end(elf);
+out_close:
+	close(fd);
+	return err;
 }
 
 static size_t dso__fprintf(struct dso *self, FILE *fp)
@@ -614,6 +730,8 @@ int cmd_report(int argc, char **argv)
 	int ret, rc = EXIT_FAILURE;
 	unsigned long total = 0;
 
+	elf_version(EV_CURRENT);
+
 	page_size = getpagesize();
 
 	process_options(argc, argv);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Use rb_trees in perf report
       [not found]             ` <new-submission>
                                 ` (50 preceding siblings ...)
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Implement dso__load using libelf tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 12:13               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Add our private copy of list.h tip-bot for Arnaldo Carvalho de Melo
                                 ` (655 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 12:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  35a50c8a20eea22c141e05c5667ac21c48b8b65d
Gitweb:     http://git.kernel.org/tip/35a50c8a20eea22c141e05c5667ac21c48b8b65d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 18 May 2009 16:24:49 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:55 +0200

perf_counter: Use rb_trees in perf report

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile         |    3 +
 Documentation/perf_counter/builtin-report.c |   60 +++--
 Documentation/perf_counter/util/rbtree.c    |  383 +++++++++++++++++++++++++++
 Documentation/perf_counter/util/rbtree.h    |  171 ++++++++++++
 4 files changed, 601 insertions(+), 16 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 6bffa86..412dea1 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -287,6 +287,8 @@ LIB_FILE=libperf.a
 
 LIB_H += ../../include/linux/perf_counter.h
 LIB_H += perf.h
+LIB_H += util/list.h
+LIB_H += util/rbtree.h
 LIB_H += util/levenshtein.h
 LIB_H += util/parse-options.h
 LIB_H += util/parse-events.h
@@ -306,6 +308,7 @@ LIB_OBJS += util/levenshtein.o
 LIB_OBJS += util/parse-options.o
 LIB_OBJS += util/parse-events.o
 LIB_OBJS += util/path.o
+LIB_OBJS += util/rbtree.o
 LIB_OBJS += util/run-command.o
 LIB_OBJS += util/quote.o
 LIB_OBJS += util/strbuf.o
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index ad2f327..f63057f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -32,7 +32,8 @@
 #include <linux/types.h>
 
 #include "../../include/linux/perf_counter.h"
-#include "list.h"
+#include "util/list.h"
+#include "util/rbtree.h"
 
 #define SHOW_KERNEL	1
 #define SHOW_USER	2
@@ -106,10 +107,10 @@ static void section__delete(struct section *self)
 }
 
 struct symbol {
-	struct list_head node;
-	uint64_t	 start;
-	uint64_t	 end;
-	char		 name[0];
+	struct rb_node rb_node;
+	uint64_t       start;
+	uint64_t       end;
+	char	       name[0];
 };
 
 static struct symbol *symbol__new(uint64_t start, uint64_t len, const char *name)
@@ -139,7 +140,7 @@ static size_t symbol__fprintf(struct symbol *self, FILE *fp)
 struct dso {
 	struct list_head node;
 	struct list_head sections;
-	struct list_head syms;
+	struct rb_root	 syms;
 	char		 name[0];
 };
 
@@ -150,7 +151,7 @@ static struct dso *dso__new(const char *name)
 	if (self != NULL) {
 		strcpy(self->name, name);
 		INIT_LIST_HEAD(&self->sections);
-		INIT_LIST_HEAD(&self->syms);
+		self->syms = RB_ROOT;
 	}
 
 	return self;
@@ -166,10 +167,14 @@ static void dso__delete_sections(struct dso *self)
 
 static void dso__delete_symbols(struct dso *self)
 {
-	struct symbol *pos, *n;
+	struct symbol *pos;
+	struct rb_node *next = rb_first(&self->syms);
 
-	list_for_each_entry_safe(pos, n, &self->syms, node)
+	while (next) {
+		pos = rb_entry(next, struct symbol, rb_node);
+		next = rb_next(&pos->rb_node);
 		symbol__delete(pos);
+	}
 }
 
 static void dso__delete(struct dso *self)
@@ -181,7 +186,21 @@ static void dso__delete(struct dso *self)
 
 static void dso__insert_symbol(struct dso *self, struct symbol *sym)
 {
-	list_add_tail(&sym->node, &self->syms);
+	struct rb_node **p = &self->syms.rb_node;
+	struct rb_node *parent = NULL;
+	const uint64_t ip = sym->start;
+	struct symbol *s;
+
+	while (*p != NULL) {
+		parent = *p;
+		s = rb_entry(parent, struct symbol, rb_node);
+		if (ip < s->start)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+	rb_link_node(&sym->rb_node, parent, p);
+	rb_insert_color(&sym->rb_node, &self->syms);
 }
 
 static struct symbol *dso__find_symbol(struct dso *self, uint64_t ip)
@@ -189,11 +208,18 @@ static struct symbol *dso__find_symbol(struct dso *self, uint64_t ip)
 	if (self == NULL)
 		return NULL;
 
-	struct symbol *pos;
+	struct rb_node *n = self->syms.rb_node;
 
-	list_for_each_entry(pos, &self->syms, node)
-		if (ip >= pos->start && ip <= pos->end)
-			return pos;
+	while (n) {
+		struct symbol *s = rb_entry(n, struct symbol, rb_node);
+
+		if (ip < s->start)
+			n = n->rb_left;
+		else if (ip > s->end)
+			n = n->rb_right;
+		else
+			return s;
+	}
 
 	return NULL;
 }
@@ -319,11 +345,13 @@ out_close:
 
 static size_t dso__fprintf(struct dso *self, FILE *fp)
 {
-	struct symbol *pos;
 	size_t ret = fprintf(fp, "dso: %s\n", self->name);
 
-	list_for_each_entry(pos, &self->syms, node)
+	struct rb_node *nd;
+	for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
+		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
 		ret += symbol__fprintf(pos, fp);
+	}
 
 	return ret;
 }
diff --git a/Documentation/perf_counter/util/rbtree.c b/Documentation/perf_counter/util/rbtree.c
new file mode 100644
index 0000000..b15ba9c
--- /dev/null
+++ b/Documentation/perf_counter/util/rbtree.c
@@ -0,0 +1,383 @@
+/*
+  Red Black Trees
+  (C) 1999  Andrea Arcangeli <andrea@suse.de>
+  (C) 2002  David Woodhouse <dwmw2@infradead.org>
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+  linux/lib/rbtree.c
+*/
+
+#include "rbtree.h"
+
+static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
+{
+	struct rb_node *right = node->rb_right;
+	struct rb_node *parent = rb_parent(node);
+
+	if ((node->rb_right = right->rb_left))
+		rb_set_parent(right->rb_left, node);
+	right->rb_left = node;
+
+	rb_set_parent(right, parent);
+
+	if (parent)
+	{
+		if (node == parent->rb_left)
+			parent->rb_left = right;
+		else
+			parent->rb_right = right;
+	}
+	else
+		root->rb_node = right;
+	rb_set_parent(node, right);
+}
+
+static void __rb_rotate_right(struct rb_node *node, struct rb_root *root)
+{
+	struct rb_node *left = node->rb_left;
+	struct rb_node *parent = rb_parent(node);
+
+	if ((node->rb_left = left->rb_right))
+		rb_set_parent(left->rb_right, node);
+	left->rb_right = node;
+
+	rb_set_parent(left, parent);
+
+	if (parent)
+	{
+		if (node == parent->rb_right)
+			parent->rb_right = left;
+		else
+			parent->rb_left = left;
+	}
+	else
+		root->rb_node = left;
+	rb_set_parent(node, left);
+}
+
+void rb_insert_color(struct rb_node *node, struct rb_root *root)
+{
+	struct rb_node *parent, *gparent;
+
+	while ((parent = rb_parent(node)) && rb_is_red(parent))
+	{
+		gparent = rb_parent(parent);
+
+		if (parent == gparent->rb_left)
+		{
+			{
+				register struct rb_node *uncle = gparent->rb_right;
+				if (uncle && rb_is_red(uncle))
+				{
+					rb_set_black(uncle);
+					rb_set_black(parent);
+					rb_set_red(gparent);
+					node = gparent;
+					continue;
+				}
+			}
+
+			if (parent->rb_right == node)
+			{
+				register struct rb_node *tmp;
+				__rb_rotate_left(parent, root);
+				tmp = parent;
+				parent = node;
+				node = tmp;
+			}
+
+			rb_set_black(parent);
+			rb_set_red(gparent);
+			__rb_rotate_right(gparent, root);
+		} else {
+			{
+				register struct rb_node *uncle = gparent->rb_left;
+				if (uncle && rb_is_red(uncle))
+				{
+					rb_set_black(uncle);
+					rb_set_black(parent);
+					rb_set_red(gparent);
+					node = gparent;
+					continue;
+				}
+			}
+
+			if (parent->rb_left == node)
+			{
+				register struct rb_node *tmp;
+				__rb_rotate_right(parent, root);
+				tmp = parent;
+				parent = node;
+				node = tmp;
+			}
+
+			rb_set_black(parent);
+			rb_set_red(gparent);
+			__rb_rotate_left(gparent, root);
+		}
+	}
+
+	rb_set_black(root->rb_node);
+}
+
+static void __rb_erase_color(struct rb_node *node, struct rb_node *parent,
+			     struct rb_root *root)
+{
+	struct rb_node *other;
+
+	while ((!node || rb_is_black(node)) && node != root->rb_node)
+	{
+		if (parent->rb_left == node)
+		{
+			other = parent->rb_right;
+			if (rb_is_red(other))
+			{
+				rb_set_black(other);
+				rb_set_red(parent);
+				__rb_rotate_left(parent, root);
+				other = parent->rb_right;
+			}
+			if ((!other->rb_left || rb_is_black(other->rb_left)) &&
+			    (!other->rb_right || rb_is_black(other->rb_right)))
+			{
+				rb_set_red(other);
+				node = parent;
+				parent = rb_parent(node);
+			}
+			else
+			{
+				if (!other->rb_right || rb_is_black(other->rb_right))
+				{
+					rb_set_black(other->rb_left);
+					rb_set_red(other);
+					__rb_rotate_right(other, root);
+					other = parent->rb_right;
+				}
+				rb_set_color(other, rb_color(parent));
+				rb_set_black(parent);
+				rb_set_black(other->rb_right);
+				__rb_rotate_left(parent, root);
+				node = root->rb_node;
+				break;
+			}
+		}
+		else
+		{
+			other = parent->rb_left;
+			if (rb_is_red(other))
+			{
+				rb_set_black(other);
+				rb_set_red(parent);
+				__rb_rotate_right(parent, root);
+				other = parent->rb_left;
+			}
+			if ((!other->rb_left || rb_is_black(other->rb_left)) &&
+			    (!other->rb_right || rb_is_black(other->rb_right)))
+			{
+				rb_set_red(other);
+				node = parent;
+				parent = rb_parent(node);
+			}
+			else
+			{
+				if (!other->rb_left || rb_is_black(other->rb_left))
+				{
+					rb_set_black(other->rb_right);
+					rb_set_red(other);
+					__rb_rotate_left(other, root);
+					other = parent->rb_left;
+				}
+				rb_set_color(other, rb_color(parent));
+				rb_set_black(parent);
+				rb_set_black(other->rb_left);
+				__rb_rotate_right(parent, root);
+				node = root->rb_node;
+				break;
+			}
+		}
+	}
+	if (node)
+		rb_set_black(node);
+}
+
+void rb_erase(struct rb_node *node, struct rb_root *root)
+{
+	struct rb_node *child, *parent;
+	int color;
+
+	if (!node->rb_left)
+		child = node->rb_right;
+	else if (!node->rb_right)
+		child = node->rb_left;
+	else
+	{
+		struct rb_node *old = node, *left;
+
+		node = node->rb_right;
+		while ((left = node->rb_left) != NULL)
+			node = left;
+		child = node->rb_right;
+		parent = rb_parent(node);
+		color = rb_color(node);
+
+		if (child)
+			rb_set_parent(child, parent);
+		if (parent == old) {
+			parent->rb_right = child;
+			parent = node;
+		} else
+			parent->rb_left = child;
+
+		node->rb_parent_color = old->rb_parent_color;
+		node->rb_right = old->rb_right;
+		node->rb_left = old->rb_left;
+
+		if (rb_parent(old))
+		{
+			if (rb_parent(old)->rb_left == old)
+				rb_parent(old)->rb_left = node;
+			else
+				rb_parent(old)->rb_right = node;
+		} else
+			root->rb_node = node;
+
+		rb_set_parent(old->rb_left, node);
+		if (old->rb_right)
+			rb_set_parent(old->rb_right, node);
+		goto color;
+	}
+
+	parent = rb_parent(node);
+	color = rb_color(node);
+
+	if (child)
+		rb_set_parent(child, parent);
+	if (parent)
+	{
+		if (parent->rb_left == node)
+			parent->rb_left = child;
+		else
+			parent->rb_right = child;
+	}
+	else
+		root->rb_node = child;
+
+ color:
+	if (color == RB_BLACK)
+		__rb_erase_color(child, parent, root);
+}
+
+/*
+ * This function returns the first node (in sort order) of the tree.
+ */
+struct rb_node *rb_first(const struct rb_root *root)
+{
+	struct rb_node	*n;
+
+	n = root->rb_node;
+	if (!n)
+		return NULL;
+	while (n->rb_left)
+		n = n->rb_left;
+	return n;
+}
+
+struct rb_node *rb_last(const struct rb_root *root)
+{
+	struct rb_node	*n;
+
+	n = root->rb_node;
+	if (!n)
+		return NULL;
+	while (n->rb_right)
+		n = n->rb_right;
+	return n;
+}
+
+struct rb_node *rb_next(const struct rb_node *node)
+{
+	struct rb_node *parent;
+
+	if (rb_parent(node) == node)
+		return NULL;
+
+	/* If we have a right-hand child, go down and then left as far
+	   as we can. */
+	if (node->rb_right) {
+		node = node->rb_right; 
+		while (node->rb_left)
+			node=node->rb_left;
+		return (struct rb_node *)node;
+	}
+
+	/* No right-hand children.  Everything down and left is
+	   smaller than us, so any 'next' node must be in the general
+	   direction of our parent. Go up the tree; any time the
+	   ancestor is a right-hand child of its parent, keep going
+	   up. First time it's a left-hand child of its parent, said
+	   parent is our 'next' node. */
+	while ((parent = rb_parent(node)) && node == parent->rb_right)
+		node = parent;
+
+	return parent;
+}
+
+struct rb_node *rb_prev(const struct rb_node *node)
+{
+	struct rb_node *parent;
+
+	if (rb_parent(node) == node)
+		return NULL;
+
+	/* If we have a left-hand child, go down and then right as far
+	   as we can. */
+	if (node->rb_left) {
+		node = node->rb_left; 
+		while (node->rb_right)
+			node=node->rb_right;
+		return (struct rb_node *)node;
+	}
+
+	/* No left-hand children. Go up till we find an ancestor which
+	   is a right-hand child of its parent */
+	while ((parent = rb_parent(node)) && node == parent->rb_left)
+		node = parent;
+
+	return parent;
+}
+
+void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+		     struct rb_root *root)
+{
+	struct rb_node *parent = rb_parent(victim);
+
+	/* Set the surrounding nodes to point to the replacement */
+	if (parent) {
+		if (victim == parent->rb_left)
+			parent->rb_left = new;
+		else
+			parent->rb_right = new;
+	} else {
+		root->rb_node = new;
+	}
+	if (victim->rb_left)
+		rb_set_parent(victim->rb_left, new);
+	if (victim->rb_right)
+		rb_set_parent(victim->rb_right, new);
+
+	/* Copy the pointers/colour from the victim to the replacement */
+	*new = *victim;
+}
diff --git a/Documentation/perf_counter/util/rbtree.h b/Documentation/perf_counter/util/rbtree.h
new file mode 100644
index 0000000..6bdc488
--- /dev/null
+++ b/Documentation/perf_counter/util/rbtree.h
@@ -0,0 +1,171 @@
+/*
+  Red Black Trees
+  (C) 1999  Andrea Arcangeli <andrea@suse.de>
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+  linux/include/linux/rbtree.h
+
+  To use rbtrees you'll have to implement your own insert and search cores.
+  This will avoid us to use callbacks and to drop drammatically performances.
+  I know it's not the cleaner way,  but in C (not in C++) to get
+  performances and genericity...
+
+  Some example of insert and search follows here. The search is a plain
+  normal search over an ordered tree. The insert instead must be implemented
+  int two steps: as first thing the code must insert the element in
+  order as a red leaf in the tree, then the support library function
+  rb_insert_color() must be called. Such function will do the
+  not trivial work to rebalance the rbtree if necessary.
+
+-----------------------------------------------------------------------
+static inline struct page * rb_search_page_cache(struct inode * inode,
+						 unsigned long offset)
+{
+	struct rb_node * n = inode->i_rb_page_cache.rb_node;
+	struct page * page;
+
+	while (n)
+	{
+		page = rb_entry(n, struct page, rb_page_cache);
+
+		if (offset < page->offset)
+			n = n->rb_left;
+		else if (offset > page->offset)
+			n = n->rb_right;
+		else
+			return page;
+	}
+	return NULL;
+}
+
+static inline struct page * __rb_insert_page_cache(struct inode * inode,
+						   unsigned long offset,
+						   struct rb_node * node)
+{
+	struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
+	struct rb_node * parent = NULL;
+	struct page * page;
+
+	while (*p)
+	{
+		parent = *p;
+		page = rb_entry(parent, struct page, rb_page_cache);
+
+		if (offset < page->offset)
+			p = &(*p)->rb_left;
+		else if (offset > page->offset)
+			p = &(*p)->rb_right;
+		else
+			return page;
+	}
+
+	rb_link_node(node, parent, p);
+
+	return NULL;
+}
+
+static inline struct page * rb_insert_page_cache(struct inode * inode,
+						 unsigned long offset,
+						 struct rb_node * node)
+{
+	struct page * ret;
+	if ((ret = __rb_insert_page_cache(inode, offset, node)))
+		goto out;
+	rb_insert_color(node, &inode->i_rb_page_cache);
+ out:
+	return ret;
+}
+-----------------------------------------------------------------------
+*/
+
+#ifndef	_LINUX_RBTREE_H
+#define	_LINUX_RBTREE_H
+
+#include <stddef.h>
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:	the pointer to the member.
+ * @type:	the type of the container struct this is embedded in.
+ * @member:	the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({			\
+	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
+	(type *)( (char *)__mptr - offsetof(type,member) );})
+
+struct rb_node
+{
+	unsigned long  rb_parent_color;
+#define	RB_RED		0
+#define	RB_BLACK	1
+	struct rb_node *rb_right;
+	struct rb_node *rb_left;
+} __attribute__((aligned(sizeof(long))));
+    /* The alignment might seem pointless, but allegedly CRIS needs it */
+
+struct rb_root
+{
+	struct rb_node *rb_node;
+};
+
+
+#define rb_parent(r)   ((struct rb_node *)((r)->rb_parent_color & ~3))
+#define rb_color(r)   ((r)->rb_parent_color & 1)
+#define rb_is_red(r)   (!rb_color(r))
+#define rb_is_black(r) rb_color(r)
+#define rb_set_red(r)  do { (r)->rb_parent_color &= ~1; } while (0)
+#define rb_set_black(r)  do { (r)->rb_parent_color |= 1; } while (0)
+
+static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
+{
+	rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
+}
+static inline void rb_set_color(struct rb_node *rb, int color)
+{
+	rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
+}
+
+#define RB_ROOT	(struct rb_root) { NULL, }
+#define	rb_entry(ptr, type, member) container_of(ptr, type, member)
+
+#define RB_EMPTY_ROOT(root)	((root)->rb_node == NULL)
+#define RB_EMPTY_NODE(node)	(rb_parent(node) == node)
+#define RB_CLEAR_NODE(node)	(rb_set_parent(node, node))
+
+extern void rb_insert_color(struct rb_node *, struct rb_root *);
+extern void rb_erase(struct rb_node *, struct rb_root *);
+
+/* Find logical next and previous nodes in a tree */
+extern struct rb_node *rb_next(const struct rb_node *);
+extern struct rb_node *rb_prev(const struct rb_node *);
+extern struct rb_node *rb_first(const struct rb_root *);
+extern struct rb_node *rb_last(const struct rb_root *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
+			    struct rb_root *root);
+
+static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
+				struct rb_node ** rb_link)
+{
+	node->rb_parent_color = (unsigned long )parent;
+	node->rb_left = node->rb_right = NULL;
+
+	*rb_link = node;
+}
+
+#endif	/* _LINUX_RBTREE_H */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add our private copy of list.h
       [not found]             ` <new-submission>
                                 ` (51 preceding siblings ...)
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Use rb_trees in perf report tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 12:13               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Use rb_tree for symhists and threads in report tip-bot for Arnaldo Carvalho de Melo
                                 ` (654 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 12:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  040e6034124c504d536736ce08e4643e640cd7c2
Gitweb:     http://git.kernel.org/tip/040e6034124c504d536736ce08e4643e640cd7c2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 18 May 2009 16:25:31 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:55 +0200

perf_counter: Add our private copy of list.h

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/util}/list.h                      |  238 ++++++--------------
 1 files changed, 73 insertions(+), 165 deletions(-)

diff --git a/include/linux/list.h b/Documentation/perf_counter/util/list.h
similarity index 74%
copy from include/linux/list.h
copy to Documentation/perf_counter/util/list.h
index 969f6e9..e2548e8 100644
--- a/include/linux/list.h
+++ b/Documentation/perf_counter/util/list.h
@@ -1,10 +1,33 @@
 #ifndef _LINUX_LIST_H
 #define _LINUX_LIST_H
+/*
+  Copyright (C) Cast of dozens, comes from the Linux kernel
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms of version 2 of the GNU General Public License as
+  published by the Free Software Foundation.
+*/
+
+#include <stddef.h>
+
+/*
+ * These are non-NULL pointers that will result in page faults
+ * under normal circumstances, used to verify that nobody uses
+ * non-initialized list entries.
+ */
+#define LIST_POISON1 ((void *)0x00100100)
+#define LIST_POISON2 ((void *)0x00200200)
 
-#include <linux/stddef.h>
-#include <linux/poison.h>
-#include <linux/prefetch.h>
-#include <asm/system.h>
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:	the pointer to the member.
+ * @type:	the type of the container struct this is embedded in.
+ * @member:	the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({			\
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
+        (type *)( (char *)__mptr - offsetof(type,member) );})
 
 /*
  * Simple doubly linked list implementation.
@@ -37,7 +60,6 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-#ifndef CONFIG_DEBUG_LIST
 static inline void __list_add(struct list_head *new,
 			      struct list_head *prev,
 			      struct list_head *next)
@@ -47,11 +69,6 @@ static inline void __list_add(struct list_head *new,
 	new->prev = prev;
 	prev->next = new;
 }
-#else
-extern void __list_add(struct list_head *new,
-			      struct list_head *prev,
-			      struct list_head *next);
-#endif
 
 /**
  * list_add - add a new entry
@@ -66,7 +83,6 @@ static inline void list_add(struct list_head *new, struct list_head *head)
 	__list_add(new, head, head->next);
 }
 
-
 /**
  * list_add_tail - add a new entry
  * @new: new entry to be added
@@ -96,26 +112,35 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
 /**
  * list_del - deletes entry from list.
  * @entry: the element to delete from the list.
- * Note: list_empty() on entry does not return true after this, the entry is
+ * Note: list_empty on entry does not return true after this, the entry is
  * in an undefined state.
  */
-#ifndef CONFIG_DEBUG_LIST
 static inline void list_del(struct list_head *entry)
 {
 	__list_del(entry->prev, entry->next);
 	entry->next = LIST_POISON1;
 	entry->prev = LIST_POISON2;
 }
-#else
-extern void list_del(struct list_head *entry);
-#endif
+
+/**
+ * list_del_range - deletes range of entries from list.
+ * @beging: first element in the range to delete from the list.
+ * @beging: first element in the range to delete from the list.
+ * Note: list_empty on the range of entries does not return true after this,
+ * the entries is in an undefined state.
+ */
+static inline void list_del_range(struct list_head *begin,
+				  struct list_head *end)
+{
+	begin->prev->next = end->next;
+	end->next->prev = begin->prev;
+}
 
 /**
  * list_replace - replace old entry by new one
  * @old : the element to be replaced
  * @new : the new element to insert
- *
- * If @old was empty, it will be overwritten.
+ * Note: if 'old' was empty, it will be overwritten.
  */
 static inline void list_replace(struct list_head *old,
 				struct list_head *new)
@@ -150,8 +175,8 @@ static inline void list_del_init(struct list_head *entry)
  */
 static inline void list_move(struct list_head *list, struct list_head *head)
 {
-	__list_del(list->prev, list->next);
-	list_add(list, head);
+        __list_del(list->prev, list->next);
+        list_add(list, head);
 }
 
 /**
@@ -162,8 +187,8 @@ static inline void list_move(struct list_head *list, struct list_head *head)
 static inline void list_move_tail(struct list_head *list,
 				  struct list_head *head)
 {
-	__list_del(list->prev, list->next);
-	list_add_tail(list, head);
+        __list_del(list->prev, list->next);
+        list_add_tail(list, head);
 }
 
 /**
@@ -205,91 +230,29 @@ static inline int list_empty_careful(const struct list_head *head)
 	return (next == head) && (next == head->prev);
 }
 
-/**
- * list_is_singular - tests whether a list has just one entry.
- * @head: the list to test.
- */
-static inline int list_is_singular(const struct list_head *head)
-{
-	return !list_empty(head) && (head->next == head->prev);
-}
-
-static inline void __list_cut_position(struct list_head *list,
-		struct list_head *head, struct list_head *entry)
-{
-	struct list_head *new_first = entry->next;
-	list->next = head->next;
-	list->next->prev = list;
-	list->prev = entry;
-	entry->next = list;
-	head->next = new_first;
-	new_first->prev = head;
-}
-
-/**
- * list_cut_position - cut a list into two
- * @list: a new list to add all removed entries
- * @head: a list with entries
- * @entry: an entry within head, could be the head itself
- *	and if so we won't cut the list
- *
- * This helper moves the initial part of @head, up to and
- * including @entry, from @head to @list. You should
- * pass on @entry an element you know is on @head. @list
- * should be an empty list or a list you do not care about
- * losing its data.
- *
- */
-static inline void list_cut_position(struct list_head *list,
-		struct list_head *head, struct list_head *entry)
-{
-	if (list_empty(head))
-		return;
-	if (list_is_singular(head) &&
-		(head->next != entry && head != entry))
-		return;
-	if (entry == head)
-		INIT_LIST_HEAD(list);
-	else
-		__list_cut_position(list, head, entry);
-}
-
-static inline void __list_splice(const struct list_head *list,
-				 struct list_head *prev,
-				 struct list_head *next)
+static inline void __list_splice(struct list_head *list,
+				 struct list_head *head)
 {
 	struct list_head *first = list->next;
 	struct list_head *last = list->prev;
+	struct list_head *at = head->next;
 
-	first->prev = prev;
-	prev->next = first;
-
-	last->next = next;
-	next->prev = last;
-}
+	first->prev = head;
+	head->next = first;
 
-/**
- * list_splice - join two lists, this is designed for stacks
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(const struct list_head *list,
-				struct list_head *head)
-{
-	if (!list_empty(list))
-		__list_splice(list, head, head->next);
+	last->next = at;
+	at->prev = last;
 }
 
 /**
- * list_splice_tail - join two lists, each list being a queue
+ * list_splice - join two lists
  * @list: the new list to add.
  * @head: the place to add it in the first list.
  */
-static inline void list_splice_tail(struct list_head *list,
-				struct list_head *head)
+static inline void list_splice(struct list_head *list, struct list_head *head)
 {
 	if (!list_empty(list))
-		__list_splice(list, head->prev, head);
+		__list_splice(list, head);
 }
 
 /**
@@ -303,24 +266,7 @@ static inline void list_splice_init(struct list_head *list,
 				    struct list_head *head)
 {
 	if (!list_empty(list)) {
-		__list_splice(list, head, head->next);
-		INIT_LIST_HEAD(list);
-	}
-}
-
-/**
- * list_splice_tail_init - join two lists and reinitialise the emptied list
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * Each of the lists is a queue.
- * The list at @list is reinitialised
- */
-static inline void list_splice_tail_init(struct list_head *list,
-					 struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head->prev, head);
+		__list_splice(list, head);
 		INIT_LIST_HEAD(list);
 	}
 }
@@ -336,9 +282,9 @@ static inline void list_splice_tail_init(struct list_head *list,
 
 /**
  * list_first_entry - get the first element from a list
- * @ptr:	the list head to take the element from.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
+ * @ptr:       the list head to take the element from.
+ * @type:      the type of the struct this is embedded in.
+ * @member:    the name of the list_struct within the struct.
  *
  * Note, that list is expected to be not empty.
  */
@@ -351,7 +297,7 @@ static inline void list_splice_tail_init(struct list_head *list,
  * @head:	the head for your list.
  */
 #define list_for_each(pos, head) \
-	for (pos = (head)->next; prefetch(pos->next), pos != (head); \
+	for (pos = (head)->next; pos != (head); \
         	pos = pos->next)
 
 /**
@@ -373,7 +319,7 @@ static inline void list_splice_tail_init(struct list_head *list,
  * @head:	the head for your list.
  */
 #define list_for_each_prev(pos, head) \
-	for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
+	for (pos = (head)->prev; pos != (head); \
         	pos = pos->prev)
 
 /**
@@ -387,17 +333,6 @@ static inline void list_splice_tail_init(struct list_head *list,
 		pos = n, n = pos->next)
 
 /**
- * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
- * @pos:	the &struct list_head to use as a loop cursor.
- * @n:		another &struct list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define list_for_each_prev_safe(pos, n, head) \
-	for (pos = (head)->prev, n = pos->prev; \
-	     prefetch(pos->prev), pos != (head); \
-	     pos = n, n = pos->prev)
-
-/**
  * list_for_each_entry	-	iterate over list of given type
  * @pos:	the type * to use as a loop cursor.
  * @head:	the head for your list.
@@ -405,7 +340,7 @@ static inline void list_splice_tail_init(struct list_head *list,
  */
 #define list_for_each_entry(pos, head, member)				\
 	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     prefetch(pos->member.next), &pos->member != (head); 	\
+	     &pos->member != (head); 	\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
 /**
@@ -416,16 +351,16 @@ static inline void list_splice_tail_init(struct list_head *list,
  */
 #define list_for_each_entry_reverse(pos, head, member)			\
 	for (pos = list_entry((head)->prev, typeof(*pos), member);	\
-	     prefetch(pos->member.prev), &pos->member != (head); 	\
+	     &pos->member != (head); 	\
 	     pos = list_entry(pos->member.prev, typeof(*pos), member))
 
 /**
- * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
+ * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue
  * @pos:	the type * to use as a start point
  * @head:	the head of the list
  * @member:	the name of the list_struct within the struct.
  *
- * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
+ * Prepares a pos entry for use as a start point in list_for_each_entry_continue.
  */
 #define list_prepare_entry(pos, head, member) \
 	((pos) ? : list_entry(head, typeof(*pos), member))
@@ -441,24 +376,10 @@ static inline void list_splice_tail_init(struct list_head *list,
  */
 #define list_for_each_entry_continue(pos, head, member) 		\
 	for (pos = list_entry(pos->member.next, typeof(*pos), member);	\
-	     prefetch(pos->member.next), &pos->member != (head);	\
+	     &pos->member != (head);	\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
 /**
- * list_for_each_entry_continue_reverse - iterate backwards from the given point
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Start to iterate over list of given type backwards, continuing after
- * the current position.
- */
-#define list_for_each_entry_continue_reverse(pos, head, member)		\
-	for (pos = list_entry(pos->member.prev, typeof(*pos), member);	\
-	     prefetch(pos->member.prev), &pos->member != (head);	\
-	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-
-/**
  * list_for_each_entry_from - iterate over list of given type from the current point
  * @pos:	the type * to use as a loop cursor.
  * @head:	the head for your list.
@@ -467,7 +388,7 @@ static inline void list_splice_tail_init(struct list_head *list,
  * Iterate over list of given type, continuing from current position.
  */
 #define list_for_each_entry_from(pos, head, member) 			\
-	for (; prefetch(pos->member.next), &pos->member != (head);	\
+	for (; &pos->member != (head);	\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
 /**
@@ -619,23 +540,10 @@ static inline void hlist_add_after(struct hlist_node *n,
 		next->next->pprev  = &next->next;
 }
 
-/*
- * Move a list from one list head to another. Fixup the pprev
- * reference of the first entry if it exists.
- */
-static inline void hlist_move_list(struct hlist_head *old,
-				   struct hlist_head *new)
-{
-	new->first = old->first;
-	if (new->first)
-		new->first->pprev = &new->first;
-	old->first = NULL;
-}
-
 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
 
 #define hlist_for_each(pos, head) \
-	for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
+	for (pos = (head)->first; pos; \
 	     pos = pos->next)
 
 #define hlist_for_each_safe(pos, n, head) \
@@ -651,7 +559,7 @@ static inline void hlist_move_list(struct hlist_head *old,
  */
 #define hlist_for_each_entry(tpos, pos, head, member)			 \
 	for (pos = (head)->first;					 \
-	     pos && ({ prefetch(pos->next); 1;}) &&			 \
+	     pos && 			 \
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next)
 
@@ -663,7 +571,7 @@ static inline void hlist_move_list(struct hlist_head *old,
  */
 #define hlist_for_each_entry_continue(tpos, pos, member)		 \
 	for (pos = (pos)->next;						 \
-	     pos && ({ prefetch(pos->next); 1;}) &&			 \
+	     pos && 			 \
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next)
 
@@ -674,7 +582,7 @@ static inline void hlist_move_list(struct hlist_head *old,
  * @member:	the name of the hlist_node within the struct.
  */
 #define hlist_for_each_entry_from(tpos, pos, member)			 \
-	for (; pos && ({ prefetch(pos->next); 1;}) &&			 \
+	for (; pos && 			 \
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next)
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Use rb_tree for symhists and threads in report
       [not found]             ` <new-submission>
                                 ` (52 preceding siblings ...)
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Add our private copy of list.h tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 12:13               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 12:14               ` [tip:perfcounters/core] perf record: Convert to Git option parsing tip-bot for Ingo Molnar
                                 ` (653 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 12:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, mtosatti,
	tglx, cjashfor, mingo

Commit-ID:  ce7e43653b08db094326f378958bc293a68e8e5b
Gitweb:     http://git.kernel.org/tip/ce7e43653b08db094326f378958bc293a68e8e5b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 19 May 2009 09:30:23 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:52:55 +0200

perf_counter: Use rb_tree for symhists and threads in report

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  178 +++++++++++---------------
 1 files changed, 75 insertions(+), 103 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index f63057f..e857201 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -479,23 +479,25 @@ static size_t map__fprintf(struct map *self, FILE *fp)
 }
 
 struct symhist {
-	struct list_head node;
+	struct rb_node	 rb_node;
 	struct dso	 *dso;
 	struct symbol	 *sym;
+	uint64_t	 ip;
 	uint32_t	 count;
 	char		 level;
 };
 
-static struct symhist *symhist__new(struct symbol *sym, struct dso *dso,
-				    char level)
+static struct symhist *symhist__new(struct symbol *sym, uint64_t ip,
+				    struct dso *dso, char level)
 {
 	struct symhist *self = malloc(sizeof(*self));
 
 	if (self != NULL) {
 		self->sym   = sym;
+		self->ip    = ip;
 		self->dso   = dso;
 		self->level = level;
-		self->count = 0;
+		self->count = 1;
 	}
 
 	return self;
@@ -506,12 +508,6 @@ static void symhist__delete(struct symhist *self)
 	free(self);
 }
 
-static bool symhist__equal(struct symhist *self, struct symbol *sym,
-			   struct dso *dso, char level)
-{
-	return self->level == level && self->sym == sym && self->dso == dso;
-}
-
 static void symhist__inc(struct symhist *self)
 {
 	++self->count;
@@ -519,7 +515,7 @@ static void symhist__inc(struct symhist *self)
 
 static size_t symhist__fprintf(struct symhist *self, FILE *fp)
 {
-	size_t ret = fprintf(fp, "[%c] ", self->level);
+	size_t ret = fprintf(fp, "%#llx [%c] ", (unsigned long long)self->ip, self->level);
 
 	if (self->level != '.')
 		ret += fprintf(fp, "%s", self->sym->name);
@@ -531,9 +527,9 @@ static size_t symhist__fprintf(struct symhist *self, FILE *fp)
 }
 
 struct thread {
-	struct list_head node;
+	struct rb_node	 rb_node;
 	struct list_head maps;
-	struct list_head symhists;
+	struct rb_root	 symhists;
 	pid_t		 pid;
 	char		 *comm;
 };
@@ -546,47 +542,43 @@ static struct thread *thread__new(pid_t pid)
 		self->pid = pid;
 		self->comm = NULL;
 		INIT_LIST_HEAD(&self->maps);
-		INIT_LIST_HEAD(&self->symhists);
+		self->symhists = RB_ROOT;
 	}
 
 	return self;
 }
 
-static void thread__insert_symhist(struct thread *self,
-				   struct symhist *symhist)
-{
-	list_add_tail(&symhist->node, &self->symhists);
-}
-
-static struct symhist *thread__symhists_find(struct thread *self,
-					     struct symbol *sym,
-					     struct dso *dso, char level)
+static int thread__symbol_incnew(struct thread *self, struct symbol *sym,
+				 uint64_t ip, struct dso *dso, char level)
 {
-	struct symhist *pos;
+	struct rb_node **p = &self->symhists.rb_node;
+	struct rb_node *parent = NULL;
+	struct symhist *sh;
 
-	list_for_each_entry(pos, &self->symhists, node)
-		if (symhist__equal(pos, sym, dso, level))
-			return pos;
+	while (*p != NULL) {
+		parent = *p;
+		sh = rb_entry(parent, struct symhist, rb_node);
 
-	return NULL;
-}
+		if (sh->sym == sym || ip == sh->ip) {
+			symhist__inc(sh);
+			return 0;
+		}
 
-static int thread__symbol_incnew(struct thread *self, struct symbol *sym,
-				 struct dso *dso, char level)
-{
-	struct symhist *symhist = thread__symhists_find(self, sym, dso, level);
+		/* Handle unresolved symbols too */
+		const uint64_t start = !sh->sym ? sh->ip : sh->sym->start;
 
-	if (symhist == NULL) {
-		symhist = symhist__new(sym, dso, level);
-		if (symhist == NULL)
-			goto out_error;
-		thread__insert_symhist(self, symhist);
+		if (ip < start)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
 	}
 
-	symhist__inc(symhist);
+	sh = symhist__new(sym, ip, dso, level);
+	if (sh == NULL)
+		return -ENOMEM;
+	rb_link_node(&sh->rb_node, parent, p);
+	rb_insert_color(&sh->rb_node, &self->symhists);
 	return 0;
-out_error:
-	return -ENOMEM;
 }
 
 static int thread__set_comm(struct thread *self, const char *comm)
@@ -608,43 +600,44 @@ static size_t thread__maps_fprintf(struct thread *self, FILE *fp)
 
 static size_t thread__fprintf(struct thread *self, FILE *fp)
 {
-	struct symhist *pos;
 	int ret = fprintf(fp, "thread: %d %s\n", self->pid, self->comm);
+	struct rb_node *nd;
 
-	list_for_each_entry(pos, &self->symhists, node)
+	for (nd = rb_first(&self->symhists); nd; nd = rb_next(nd)) {
+		struct symhist *pos = rb_entry(nd, struct symhist, rb_node);
 		ret += symhist__fprintf(pos, fp);
+	}
 
 	return ret;
 }
 
-static LIST_HEAD(threads);
+static struct rb_root threads = RB_ROOT;
 
-static void threads__add(struct thread *thread)
-{
-	list_add_tail(&thread->node, &threads);
-}
-
-static struct thread *threads__find(pid_t pid)
+static struct thread *threads__findnew(pid_t pid)
 {
-	struct thread *pos;
+	struct rb_node **p = &threads.rb_node;
+	struct rb_node *parent = NULL;
+	struct thread *th;
 
-	list_for_each_entry(pos, &threads, node)
-		if (pos->pid == pid)
-			return pos;
-	return NULL;
-}
+	while (*p != NULL) {
+		parent = *p;
+		th = rb_entry(parent, struct thread, rb_node);
 
-static struct thread *threads__findnew(pid_t pid)
-{
-	struct thread *thread = threads__find(pid);
+		if (th->pid == pid)
+			return th;
 
-	if (thread == NULL) {
-		thread = thread__new(pid);
-		if (thread != NULL)
-			threads__add(thread);
+		if (pid < th->pid)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
 	}
 
-	return thread;
+	th = thread__new(pid);
+	if (th != NULL) {
+		rb_link_node(&th->rb_node, parent, p);
+		rb_insert_color(&th->rb_node, &threads);
+	}
+	return th;
 }
 
 static void thread__insert_map(struct thread *self, struct map *map)
@@ -668,44 +661,13 @@ static struct map *thread__find_map(struct thread *self, uint64_t ip)
 
 static void threads__fprintf(FILE *fp)
 {
-	struct thread *pos;
-
-	list_for_each_entry(pos, &threads, node)
+	struct rb_node *nd;
+	for (nd = rb_first(&threads); nd; nd = rb_next(nd)) {
+		struct thread *pos = rb_entry(nd, struct thread, rb_node);
 		thread__fprintf(pos, fp);
+	}
 }
 
-#if 0
-static std::string resolve_user_symbol(int pid, uint64_t ip)
-{
-	std::string sym = "<unknown>";
-
-	maps_t &m = maps[pid];
-	maps_t::const_iterator mi = m.upper_bound(map(ip));
-	if (mi == m.end())
-		return sym;
-
-	ip -= mi->start + mi->pgoff;
-
-	symbols_t &s = dsos[mi->dso].syms;
-	symbols_t::const_iterator si = s.upper_bound(symbol(ip));
-
-	sym = mi->dso + ": <unknown>";
-
-	if (si == s.begin())
-		return sym;
-	si--;
-
-	if (si->start <= ip && ip < si->end)
-		sym = mi->dso + ": " + si->name;
-#if 0
-	else if (si->start <= ip)
-		sym = mi->dso + ": ?" + si->name;
-#endif
-
-	return sym;
-}
-#endif
-
 static void display_help(void)
 {
 	printf(
@@ -824,8 +786,11 @@ more:
 		struct dso *dso = NULL;
 		struct thread *thread = threads__findnew(event->ip.pid);
 
-		if (thread == NULL)
+		if (thread == NULL) {
+			fprintf(stderr, "problem processing %d event, bailing out\n",
+				event->header.type);
 			goto done;
+		}
 
 		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
 			show = SHOW_KERNEL;
@@ -845,8 +810,11 @@ more:
 		if (show & show_mask) {
 			struct symbol *sym = dso__find_symbol(dso, event->ip.ip);
 
-			if (thread__symbol_incnew(thread, sym, dso, level))
+			if (thread__symbol_incnew(thread, sym, event->ip.ip,
+						  dso, level)) {
+				fprintf(stderr, "problem incrementing symbol count, bailing out\n");
 				goto done;
+			}
 		}
 		total++;
 	} else switch (event->header.type) {
@@ -854,8 +822,10 @@ more:
 		struct thread *thread = threads__findnew(event->mmap.pid);
 		struct map *map = map__new(&event->mmap);
 
-		if (thread == NULL || map == NULL )
+		if (thread == NULL || map == NULL) {
+			fprintf(stderr, "problem processing PERF_EVENT_MMAP, bailing out\n");
 			goto done;
+		}
 		thread__insert_map(thread, map);
 		break;
 	}
@@ -863,8 +833,10 @@ more:
 		struct thread *thread = threads__findnew(event->comm.pid);
 
 		if (thread == NULL ||
-		    thread__set_comm(thread, event->comm.comm))
+		    thread__set_comm(thread, event->comm.comm)) {
+			fprintf(stderr, "problem processing PERF_EVENT_COMM, bailing out\n");
 			goto done;
+		}
 		break;
 	}
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Convert to Git option parsing
       [not found]             ` <new-submission>
                                 ` (53 preceding siblings ...)
  2009-05-26 12:13               ` [tip:perfcounters/core] perf_counter: Use rb_tree for symhists and threads in report tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 12:14               ` tip-bot for Ingo Molnar
  2009-05-26 12:15               ` [tip:perfcounters/core] perf report: Add help/manpage tip-bot for Ingo Molnar
                                 ` (652 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 12:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  53cb8bc2a3d976efd1a800c3de4640a7220afbb3
Gitweb:     http://git.kernel.org/tip/53cb8bc2a3d976efd1a800c3de4640a7220afbb3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:17:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:05:27 +0200

perf record: Convert to Git option parsing

Remove getopt usage and use Git's much more advanced and more compact
command option library.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  126 ++++++++-------------------
 1 files changed, 38 insertions(+), 88 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 21386a8..9e59d60 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -1,52 +1,29 @@
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
+#include "util/util.h"
+
+#include <libelf.h>
 #include <gelf.h>
 #include <elf.h>
-#include <libelf.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-#include <getopt.h>
-#include <assert.h>
-#include <search.h>
-
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <linux/unistd.h>
-#include <linux/types.h>
-
-#include "../../include/linux/perf_counter.h"
+
 #include "util/list.h"
 #include "util/rbtree.h"
 
+#include "perf.h"
+
+#include "util/parse-options.h"
+#include "util/parse-events.h"
+
 #define SHOW_KERNEL	1
 #define SHOW_USER	2
 #define SHOW_HV		4
 
-static char 		const *input_name = "output.perf";
+static char		const *input_name = "output.perf";
 static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
-static const char *perf_event_names[] = {
+const char *perf_event_names[] = {
 	[PERF_EVENT_MMAP]   = " PERF_EVENT_MMAP",
 	[PERF_EVENT_MUNMAP] = " PERF_EVENT_MUNMAP",
 	[PERF_EVENT_COMM]   = " PERF_EVENT_COMM",
@@ -86,7 +63,7 @@ struct section {
 	char		 name[0];
 };
 
-static struct section *section__new(uint64_t start, uint64_t size,
+struct section *section__new(uint64_t start, uint64_t size,
 				    uint64_t offset, char *name)
 {
 	struct section *self = malloc(sizeof(*self) + strlen(name) + 1);
@@ -241,7 +218,7 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
 	return GELF_ST_TYPE(sym->st_info);
 }
 
-static inline bool elf_sym__is_function(const GElf_Sym *sym)
+static inline int elf_sym__is_function(const GElf_Sym *sym)
 {
 	return elf_sym__type(sym) == STT_FUNC &&
 	       sym->st_name != 0 &&
@@ -393,7 +370,7 @@ out_delete_dso:
 	return NULL;
 }
 
-static void dsos__fprintf(FILE *fp)
+void dsos__fprintf(FILE *fp)
 {
 	struct dso *pos;
 
@@ -503,7 +480,7 @@ static struct symhist *symhist__new(struct symbol *sym, uint64_t ip,
 	return self;
 }
 
-static void symhist__delete(struct symhist *self)
+void symhist__delete(struct symhist *self)
 {
 	free(self);
 }
@@ -587,7 +564,7 @@ static int thread__set_comm(struct thread *self, const char *comm)
 	return self->comm ? 0 : -ENOMEM;
 }
 
-static size_t thread__maps_fprintf(struct thread *self, FILE *fp)
+size_t thread__maps_fprintf(struct thread *self, FILE *fp)
 {
 	struct map *pos;
 	size_t ret = 0;
@@ -668,49 +645,7 @@ static void threads__fprintf(FILE *fp)
 	}
 }
 
-static void display_help(void)
-{
-	printf(
-	"Usage: perf-report [<options>]\n"
-	" -i file   --input=<file>      # input file\n"
-	);
-
-	exit(0);
-}
-
-static void process_options(int argc, char *argv[])
-{
-	int error = 0;
-
-	for (;;) {
-		int option_index = 0;
-		/** Options for getopt */
-		static struct option long_options[] = {
-			{"input",	required_argument,	NULL, 'i'},
-			{"no-user",	no_argument,		NULL, 'u'},
-			{"no-kernel",	no_argument,		NULL, 'k'},
-			{"no-hv",	no_argument,		NULL, 'h'},
-			{NULL,		0,			NULL,  0 }
-		};
-		int c = getopt_long(argc, argv, "+:i:kuh",
-				    long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'i': input_name			= strdup(optarg); break;
-		case 'k': show_mask &= ~SHOW_KERNEL; break;
-		case 'u': show_mask &= ~SHOW_USER; break;
-		case 'h': show_mask &= ~SHOW_HV; break;
-		default: error = 1; break;
-		}
-	}
-
-	if (error)
-		display_help();
-}
-
-int cmd_report(int argc, char **argv)
+static int __cmd_report(void)
 {
 	unsigned long offset = 0;
 	unsigned long head = 0;
@@ -720,12 +655,6 @@ int cmd_report(int argc, char **argv)
 	int ret, rc = EXIT_FAILURE;
 	unsigned long total = 0;
 
-	elf_version(EV_CURRENT);
-
-	page_size = getpagesize();
-
-	process_options(argc, argv);
-
 	input = open(input_name, O_RDONLY);
 	if (input < 0) {
 		perror("failed to open file");
@@ -867,3 +796,24 @@ done:
 	return rc;
 }
 
+static const char * const report_usage[] = {
+	"perf report [<options>] <command>",
+	NULL
+};
+
+static const struct option options[] = {
+	OPT_STRING('i', "input", &input_name, "file",
+		    "input file name"),
+	OPT_END()
+};
+
+int cmd_report(int argc, const char **argv, const char *prefix)
+{
+	elf_version(EV_CURRENT);
+
+	page_size = getpagesize();
+
+	parse_options(argc, argv, options, report_usage, 0);
+
+	return __cmd_report();
+}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add help/manpage
       [not found]             ` <new-submission>
                                 ` (54 preceding siblings ...)
  2009-05-26 12:14               ` [tip:perfcounters/core] perf record: Convert to Git option parsing tip-bot for Ingo Molnar
@ 2009-05-26 12:15               ` tip-bot for Ingo Molnar
  2009-05-26 13:27               ` [tip:perfcounters/core] perf top: Remove leftover NMI/IRQ bits tip-bot for Mike Galbraith
                                 ` (651 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 12:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  0bec253c813fbb067db4dfd9f5b6cec1bd2ef026
Gitweb:     http://git.kernel.org/tip/0bec253c813fbb067db4dfd9f5b6cec1bd2ef026
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 09:17:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 13:11:57 +0200

perf report: Add help/manpage

Add a (minimal) manpage for perf report.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-report.txt     |   32 ++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-report.txt b/Documentation/perf_counter/Documentation/perf-report.txt
new file mode 100644
index 0000000..64696a2
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/perf-report.txt
@@ -0,0 +1,32 @@
+perf-report(1)
+==========
+
+NAME
+----
+perf-report - Read output.perf (created by perf record) and display the profile
+
+SYNOPSIS
+--------
+[verse]
+'perf report' [-i <file> | --input=file]
+
+DESCRIPTION
+-----------
+This command displays the performance counter profile information recorded
+via perf report.
+
+OPTIONS
+-------
+-i::
+--input=::
+        Input file name. (default: output.perf)
+
+Configuration
+-------------
+
+EXAMPLES
+--------
+
+SEE ALSO
+--------
+linkperf:perf-stat[1]

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: Remove leftover NMI/IRQ bits
       [not found]             ` <new-submission>
                                 ` (55 preceding siblings ...)
  2009-05-26 12:15               ` [tip:perfcounters/core] perf report: Add help/manpage tip-bot for Ingo Molnar
@ 2009-05-26 13:27               ` tip-bot for Mike Galbraith
  2009-05-26 13:27               ` [tip:perfcounters/core] perf top: fix typo in -d option tip-bot for Mike Galbraith
                                 ` (650 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-26 13:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  f91183fe3780d44849110a1653dfe8af7bc67aa4
Gitweb:     http://git.kernel.org/tip/f91183fe3780d44849110a1653dfe8af7bc67aa4
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 26 May 2009 15:25:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 15:25:34 +0200

perf top: Remove leftover NMI/IRQ bits

79202b removed IRQ/NMI mode selection, so remove it from
perf top as well.

[ Impact: cleanup ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 87b925c..cacaa3c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -8,7 +8,7 @@
    Sample output:
 
 ------------------------------------------------------------------------------
- KernelTop:    2669 irqs/sec  [NMI, cache-misses/cache-refs],  (all, cpu: 2)
+ KernelTop:    2669 irqs/sec  [cache-misses/cache-refs],  (all, cpu: 2)
 ------------------------------------------------------------------------------
 
              weight         RIP          kernel function
@@ -92,7 +92,6 @@ static __u64			count_filter		       = 100;
 static int			target_pid				= -1;
 static int			profile_cpu			= -1;
 static int			nr_cpus				=  0;
-static int			nmi				=  1;
 static unsigned int		realtime_prio			=  0;
 static int			group				=  0;
 static unsigned int		page_size;
@@ -198,10 +197,9 @@ static void print_sym_table(void)
 
 	printf(
 "------------------------------------------------------------------------------\n");
-	printf( " KernelTop:%8.0f irqs/sec  kernel:%4.1f%% [%s, ",
+	printf( " KernelTop:%8.0f irqs/sec  kernel:%4.1f%% [",
 		events_per_sec,
-		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)),
-		nmi ? "NMI" : "IRQ");
+		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
 
 	if (nr_counters == 1)
 		printf("%d ", event_count[0]);
@@ -637,7 +635,7 @@ static int __cmd_top(void)
 			hw_event.config		= event_id[counter];
 			hw_event.irq_period	= event_count[counter];
 			hw_event.record_type	= PERF_RECORD_IP | PERF_RECORD_TID;
-			hw_event.nmi		= nmi;
+			hw_event.nmi		= 1;
 			hw_event.mmap		= use_mmap;
 			hw_event.munmap		= use_munmap;
 			hw_event.freq		= freq;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: fix typo in -d option
       [not found]             ` <new-submission>
                                 ` (56 preceding siblings ...)
  2009-05-26 13:27               ` [tip:perfcounters/core] perf top: Remove leftover NMI/IRQ bits tip-bot for Mike Galbraith
@ 2009-05-26 13:27               ` tip-bot for Mike Galbraith
  2009-05-26 14:24               ` [tip:perfcounters/core] perf report: Fix ELF symbol parsing tip-bot for Peter Zijlstra
                                 ` (649 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-26 13:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  db20c0031288ff524d82b1f240f35f85d4a052eb
Gitweb:     http://git.kernel.org/tip/db20c0031288ff524d82b1f240f35f85d4a052eb
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 26 May 2009 15:25:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 15:25:34 +0200

perf top: fix typo in -d option

Clean up copy/paste options parsing conversion error.

[ Impact: reactivate -d option ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index cacaa3c..6b1c66f 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -727,7 +727,7 @@ static const struct option options[] = {
 		    "number of mmap data pages"),
 	OPT_INTEGER('r', "realtime", &realtime_prio,
 		    "collect data with this RT SCHED_FIFO priority"),
-	OPT_INTEGER('d', "delay", &realtime_prio,
+	OPT_INTEGER('d', "delay", &delay_secs,
 		    "number of seconds to delay between refreshes"),
 	OPT_BOOLEAN('D', "dump-symtab", &dump_symtab,
 			    "dump the symbol table used for profiling"),

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix ELF symbol parsing
       [not found]             ` <new-submission>
                                 ` (57 preceding siblings ...)
  2009-05-26 13:27               ` [tip:perfcounters/core] perf top: fix typo in -d option tip-bot for Mike Galbraith
@ 2009-05-26 14:24               ` tip-bot for Peter Zijlstra
  2009-05-26 14:24               ` [tip:perfcounters/core] perf report: Fix kernel symbol resolution tip-bot for Arnaldo Carvalho de Melo
                                 ` (648 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-26 14:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  f17e04afaff84b5cfd317da29ac4d764908ff833
Gitweb:     http://git.kernel.org/tip/f17e04afaff84b5cfd317da29ac4d764908ff833
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 26 May 2009 15:30:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 16:18:43 +0200

perf report: Fix ELF symbol parsing

[ Impact: fix DSO symbol output in perf report ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile         |    2 +-
 Documentation/perf_counter/builtin-report.c |   72 ++++++++-------------------
 2 files changed, 22 insertions(+), 52 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 412dea1..10c13a6 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -159,7 +159,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -ggdb3 -Wall
 LDFLAGS = -lpthread -lrt -lelf
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9e59d60..697f960 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -55,34 +55,6 @@ typedef union event_union {
 	struct comm_event comm;
 } event_t;
 
-struct section {
-	struct list_head node;
-	uint64_t	 start;
-	uint64_t	 end;
-	uint64_t	 offset;
-	char		 name[0];
-};
-
-struct section *section__new(uint64_t start, uint64_t size,
-				    uint64_t offset, char *name)
-{
-	struct section *self = malloc(sizeof(*self) + strlen(name) + 1);
-
-	if (self != NULL) {
-		self->start  = start;
-		self->end    = start + size;
-		self->offset = offset;
-		strcpy(self->name, name);
-	}
-
-	return self;
-}
-
-static void section__delete(struct section *self)
-{
-	free(self);
-}
-
 struct symbol {
 	struct rb_node rb_node;
 	uint64_t       start;
@@ -116,7 +88,6 @@ static size_t symbol__fprintf(struct symbol *self, FILE *fp)
 
 struct dso {
 	struct list_head node;
-	struct list_head sections;
 	struct rb_root	 syms;
 	char		 name[0];
 };
@@ -127,21 +98,12 @@ static struct dso *dso__new(const char *name)
 
 	if (self != NULL) {
 		strcpy(self->name, name);
-		INIT_LIST_HEAD(&self->sections);
 		self->syms = RB_ROOT;
 	}
 
 	return self;
 }
 
-static void dso__delete_sections(struct dso *self)
-{
-	struct section *pos, *n;
-
-	list_for_each_entry_safe(pos, n, &self->sections, node)
-		section__delete(pos);
-}
-
 static void dso__delete_symbols(struct dso *self)
 {
 	struct symbol *pos;
@@ -156,7 +118,6 @@ static void dso__delete_symbols(struct dso *self)
 
 static void dso__delete(struct dso *self)
 {
-	dso__delete_sections(self);
 	dso__delete_symbols(self);
 	free(self);
 }
@@ -282,9 +243,6 @@ static int dso__load(struct dso *self)
 	if (sec == NULL)
 		goto out_elf_end;
 
-	if (gelf_getshdr(sec, &shdr) == NULL)
-		goto out_elf_end;
-
 	Elf_Data *syms = elf_getdata(sec, NULL);
 	if (syms == NULL)
 		goto out_elf_end;
@@ -302,11 +260,21 @@ static int dso__load(struct dso *self)
 	GElf_Sym sym;
 	uint32_t index;
 	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
+		struct symbol *f;
+
 		if (!elf_sym__is_function(&sym))
 			continue;
-		struct symbol *f = symbol__new(sym.st_value, sym.st_size,
-					       elf_sym__name(&sym, symstrs));
-		if (f == NULL)
+
+		sec = elf_getscn(elf, sym.st_shndx);
+		if (!sec)
+			goto out_elf_end;
+
+		gelf_getshdr(sec, &shdr);
+		sym.st_value -= shdr.sh_addr - shdr.sh_offset;
+
+		f = symbol__new(sym.st_value, sym.st_size,
+				elf_sym__name(&sym, symstrs));
+		if (!f)
 			goto out_elf_end;
 
 		dso__insert_symbol(self, f);
@@ -498,7 +466,7 @@ static size_t symhist__fprintf(struct symhist *self, FILE *fp)
 		ret += fprintf(fp, "%s", self->sym ? self->sym->name: "<unknown>");
 	else
 		ret += fprintf(fp, "%s: %s",
-			       self->dso ? self->dso->name : "<unknown",
+			       self->dso ? self->dso->name : "<unknown>",
 			       self->sym ? self->sym->name : "<unknown>");
 	return ret + fprintf(fp, ": %u\n", self->count);
 }
@@ -714,6 +682,7 @@ more:
 		int show = 0;
 		struct dso *dso = NULL;
 		struct thread *thread = threads__findnew(event->ip.pid);
+		uint64_t ip = event->ip.ip;
 
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, bailing out\n",
@@ -728,19 +697,20 @@ more:
 		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
 			show = SHOW_USER;
 			level = '.';
-			struct map *map = thread__find_map(thread, event->ip.ip);
-			if (map != NULL)
+			struct map *map = thread__find_map(thread, ip);
+			if (map != NULL) {
 				dso = map->dso;
+				ip -= map->start + map->pgoff;
+			}
 		} else {
 			show = SHOW_HV;
 			level = 'H';
 		}
 
 		if (show & show_mask) {
-			struct symbol *sym = dso__find_symbol(dso, event->ip.ip);
+			struct symbol *sym = dso__find_symbol(dso, ip);
 
-			if (thread__symbol_incnew(thread, sym, event->ip.ip,
-						  dso, level)) {
+			if (thread__symbol_incnew(thread, sym, ip, dso, level)) {
 				fprintf(stderr, "problem incrementing symbol count, bailing out\n");
 				goto done;
 			}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix kernel symbol resolution
       [not found]             ` <new-submission>
                                 ` (58 preceding siblings ...)
  2009-05-26 14:24               ` [tip:perfcounters/core] perf report: Fix ELF symbol parsing tip-bot for Peter Zijlstra
@ 2009-05-26 14:24               ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 15:21                 ` [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered Arnaldo Carvalho de Melo
  2009-05-26 17:54               ` [tip:perfcounters/core] perf report: add --dump-raw-trace option tip-bot for Ingo Molnar
                                 ` (647 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 14:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  59d81029b6804c3d5895d07cad77d7dfddc6b5b2
Gitweb:     http://git.kernel.org/tip/59d81029b6804c3d5895d07cad77d7dfddc6b5b2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 26 May 2009 11:14:27 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 16:19:05 +0200

perf report: Fix kernel symbol resolution

kallsyms have just the symbol start, so we need to read two lines
to get the len.

[ Impact: fix incorrect kernel symbol display in perf report ]

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   30 ++++++++++++++++++++------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 697f960..b19b893 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -360,9 +360,17 @@ static int load_kallsyms(void)
 	char *line = NULL;
 	size_t n;
 
+	if (getline(&line, &n, file) < 0 || !line)
+		goto out_delete_dso;
+
+	unsigned long long previous_start;
+	char c, previous_symbf[4096];
+	if (sscanf(line, "%llx %c %s", &previous_start, &c, previous_symbf) != 3)
+		goto out_delete_line;
+
 	while (!feof(file)) {
 		unsigned long long start;
-		char c, symbf[4096];
+		char symbf[4096];
 
 		if (getline(&line, &n, file) < 0)
 			break;
@@ -371,12 +379,18 @@ static int load_kallsyms(void)
 			goto out_delete_dso;
 
 		if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
-			struct symbol *sym = symbol__new(start, 0x1000000, symbf);
+			if (start > previous_start) {
+				struct symbol *sym = symbol__new(previous_start,
+								 start - previous_start,
+								 previous_symbf);
 
-			if (sym == NULL)
-				goto out_delete_dso;
+				if (sym == NULL)
+					goto out_delete_dso;
 
-			dso__insert_symbol(kernel_dso, sym);
+				dso__insert_symbol(kernel_dso, sym);
+				previous_start = start;
+				strcpy(previous_symbf, symbf);
+			}
 		}
 	}
 
@@ -385,6 +399,8 @@ static int load_kallsyms(void)
 	fclose(file);
 	return 0;
 
+out_delete_line:
+	free(line);
 out_delete_dso:
 	dso__delete(kernel_dso);
 	return -1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered
  2009-05-26 14:24               ` [tip:perfcounters/core] perf report: Fix kernel symbol resolution tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 15:21                 ` Arnaldo Carvalho de Melo
  2009-05-26 15:39                   ` [tip:perfcounters/core] " tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 17:56                   ` [PATCH 1/1 tip] " Peter Zijlstra
  0 siblings, 2 replies; 1149+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-05-26 15:21 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: hpa, paulus, linux-kernel, jkacur, Peter Zijlstra, efault,
	mtosatti, Thomas Gleixner, cjashfor

Please fix the previous fix with this:

commit 64d254523be740b224533e0e4982cda7f25c0348
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Tue May 26 12:08:10 2009 -0300

    perf: Don't assume /proc/kallsyms is ordered
    
    Since we _are_ ordering it by the symbol start, just traverse the
    freshly built rbtree setting the prev->end members to curr->start - 1.
    
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index b19b893..5a385e8 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -360,17 +360,9 @@ static int load_kallsyms(void)
 	char *line = NULL;
 	size_t n;
 
-	if (getline(&line, &n, file) < 0 || !line)
-		goto out_delete_dso;
-
-	unsigned long long previous_start;
-	char c, previous_symbf[4096];
-	if (sscanf(line, "%llx %c %s", &previous_start, &c, previous_symbf) != 3)
-		goto out_delete_line;
-
 	while (!feof(file)) {
 		unsigned long long start;
-		char symbf[4096];
+		char c, symbf[4096];
 
 		if (getline(&line, &n, file) < 0)
 			break;
@@ -379,21 +371,35 @@ static int load_kallsyms(void)
 			goto out_delete_dso;
 
 		if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
-			if (start > previous_start) {
-				struct symbol *sym = symbol__new(previous_start,
-								 start - previous_start,
-								 previous_symbf);
+			/*
+			 * Well fix up the end later, when we have all sorted.
+			 */
+			struct symbol *sym = symbol__new(start, 0xdead, symbf);
 
-				if (sym == NULL)
-					goto out_delete_dso;
+			if (sym == NULL)
+				goto out_delete_dso;
 
-				dso__insert_symbol(kernel_dso, sym);
-				previous_start = start;
-				strcpy(previous_symbf, symbf);
-			}
+			dso__insert_symbol(kernel_dso, sym);
 		}
 	}
 
+	/*
+	 * Now that we have all sorted out, just set the ->end of all
+	 * symbols
+	 */
+	struct rb_node *nd, *prevnd = rb_first(&kernel_dso->syms);
+
+	if (prevnd == NULL)
+		goto out_delete_line;
+
+	for (nd = rb_next(prevnd); nd; nd = rb_next(nd)) {
+		struct symbol *prev = rb_entry(prevnd, struct symbol, rb_node),
+			      *curr = rb_entry(nd, struct symbol, rb_node);
+		
+		prev->end = curr->start - 1;
+		prevnd = nd;
+	}
+
 	dsos__add(kernel_dso);
 	free(line);
 	fclose(file);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf: Don't assume /proc/kallsyms is ordered
  2009-05-26 15:21                 ` [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered Arnaldo Carvalho de Melo
@ 2009-05-26 15:39                   ` tip-bot for Arnaldo Carvalho de Melo
  2009-05-26 17:56                   ` [PATCH 1/1 tip] " Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-05-26 15:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  abd54f68629fa73ed4fa040d433196211a9bbed2
Gitweb:     http://git.kernel.org/tip/abd54f68629fa73ed4fa040d433196211a9bbed2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 26 May 2009 12:21:34 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 17:36:13 +0200

perf: Don't assume /proc/kallsyms is ordered

perf: Don't assume /proc/kallsyms is ordered

Since we _are_ ordering it by the symbol start, just traverse the
freshly built rbtree setting the prev->end members to curr->start - 1.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <20090526152134.GF4424@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   48 +++++++++++++++------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index b19b893..e178190 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -360,17 +360,9 @@ static int load_kallsyms(void)
 	char *line = NULL;
 	size_t n;
 
-	if (getline(&line, &n, file) < 0 || !line)
-		goto out_delete_dso;
-
-	unsigned long long previous_start;
-	char c, previous_symbf[4096];
-	if (sscanf(line, "%llx %c %s", &previous_start, &c, previous_symbf) != 3)
-		goto out_delete_line;
-
 	while (!feof(file)) {
 		unsigned long long start;
-		char symbf[4096];
+		char c, symbf[4096];
 
 		if (getline(&line, &n, file) < 0)
 			break;
@@ -379,21 +371,35 @@ static int load_kallsyms(void)
 			goto out_delete_dso;
 
 		if (sscanf(line, "%llx %c %s", &start, &c, symbf) == 3) {
-			if (start > previous_start) {
-				struct symbol *sym = symbol__new(previous_start,
-								 start - previous_start,
-								 previous_symbf);
+			/*
+			 * Well fix up the end later, when we have all sorted.
+			 */
+			struct symbol *sym = symbol__new(start, 0xdead, symbf);
 
-				if (sym == NULL)
-					goto out_delete_dso;
+			if (sym == NULL)
+				goto out_delete_dso;
 
-				dso__insert_symbol(kernel_dso, sym);
-				previous_start = start;
-				strcpy(previous_symbf, symbf);
-			}
+			dso__insert_symbol(kernel_dso, sym);
 		}
 	}
 
+	/*
+	 * Now that we have all sorted out, just set the ->end of all
+	 * symbols
+	 */
+	struct rb_node *nd, *prevnd = rb_first(&kernel_dso->syms);
+
+	if (prevnd == NULL)
+		goto out_delete_line;
+
+	for (nd = rb_next(prevnd); nd; nd = rb_next(nd)) {
+		struct symbol *prev = rb_entry(prevnd, struct symbol, rb_node),
+			      *curr = rb_entry(nd, struct symbol, rb_node);
+
+		prev->end = curr->start - 1;
+		prevnd = nd;
+	}
+
 	dsos__add(kernel_dso);
 	free(line);
 	fclose(file);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: add --dump-raw-trace option
       [not found]             ` <new-submission>
                                 ` (59 preceding siblings ...)
  2009-05-26 14:24               ` [tip:perfcounters/core] perf report: Fix kernel symbol resolution tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 17:54               ` tip-bot for Ingo Molnar
  2009-05-26 18:09               ` [tip:perfcounters/core] perf report: add counter for unknown events tip-bot for Ingo Molnar
                                 ` (646 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 17:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  97b07b699b11d4bd1218a841e5dfed16bd53de06
Gitweb:     http://git.kernel.org/tip/97b07b699b11d4bd1218a841e5dfed16bd53de06
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 18:48:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 18:48:58 +0200

perf report: add --dump-raw-trace option

To help the inspection of various data files, implement an ASCII dump
method that just dumps the records as they are read in - then we exit.

[ Impact: new feature ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   39 ++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index e178190..8ea8aaa 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -20,6 +20,8 @@ static char		const *input_name = "output.perf";
 static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
+static int		dump_trace = 0;
+
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
@@ -643,7 +645,7 @@ static int __cmd_report(void)
 	char *buf;
 	event_t *event;
 	int ret, rc = EXIT_FAILURE;
-	unsigned long total = 0;
+	unsigned long total = 0, total_mmap = 0, total_comm = 0;
 
 	input = open(input_name, O_RDONLY);
 	if (input < 0) {
@@ -706,6 +708,13 @@ more:
 		struct thread *thread = threads__findnew(event->ip.pid);
 		uint64_t ip = event->ip.ip;
 
+		if (dump_trace) {
+			fprintf(stderr, "PERF_EVENT (IP, %d): %d: %p\n",
+				event->header.misc,
+				event->ip.pid,
+				(void *)event->ip.ip);
+		}
+
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, bailing out\n",
 				event->header.type);
@@ -743,23 +752,40 @@ more:
 		struct thread *thread = threads__findnew(event->mmap.pid);
 		struct map *map = map__new(&event->mmap);
 
+		if (dump_trace) {
+			fprintf(stderr, "PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+				(void *)event->mmap.start,
+				(void *)event->mmap.len,
+				(void *)event->mmap.pgoff,
+				event->mmap.filename);
+		}
 		if (thread == NULL || map == NULL) {
 			fprintf(stderr, "problem processing PERF_EVENT_MMAP, bailing out\n");
 			goto done;
 		}
 		thread__insert_map(thread, map);
+		total_mmap++;
 		break;
 	}
 	case PERF_EVENT_COMM: {
 		struct thread *thread = threads__findnew(event->comm.pid);
 
+		if (dump_trace) {
+			fprintf(stderr, "PERF_EVENT_COMM: %s:%d\n",
+				event->comm.comm, event->comm.pid);
+		}
 		if (thread == NULL ||
 		    thread__set_comm(thread, event->comm.comm)) {
 			fprintf(stderr, "problem processing PERF_EVENT_COMM, bailing out\n");
 			goto done;
 		}
+		total_comm++;
 		break;
 	}
+	default: {
+		fprintf(stderr, "skipping unknown header type: %d\n",
+			event->header.type);
+	}
 	}
 
 	if (offset + head < stat.st_size)
@@ -768,6 +794,15 @@ more:
 	rc = EXIT_SUCCESS;
 done:
 	close(input);
+
+	if (dump_trace) {
+		fprintf(stderr, "   IP events: %10ld\n", total);
+		fprintf(stderr, " mmap events: %10ld\n", total_mmap);
+		fprintf(stderr, " comm events: %10ld\n", total_comm);
+
+		return 0;
+	}
+
 	//dsos__fprintf(stdout);
 	threads__fprintf(stdout);
 #if 0
@@ -796,6 +831,8 @@ static const char * const report_usage[] = {
 static const struct option options[] = {
 	OPT_STRING('i', "input", &input_name, "file",
 		    "input file name"),
+	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
+		    "dump raw trace in ASCII"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered
  2009-05-26 15:21                 ` [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered Arnaldo Carvalho de Melo
  2009-05-26 15:39                   ` [tip:perfcounters/core] " tip-bot for Arnaldo Carvalho de Melo
@ 2009-05-26 17:56                   ` Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-05-26 17:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, hpa, paulus, linux-kernel, jkacur, efault, mtosatti,
	Thomas Gleixner, cjashfor

On Tue, 2009-05-26 at 12:21 -0300, Arnaldo Carvalho de Melo wrote:
> Please fix the previous fix with this:

You don't need a second walk through the RB-tree like that, simply
change the lookup function:

The below finds the first entry that has ->start > ip, we then walk
backwards until we find an entry that has start <= ip < end and end > ip
(should never be more than 1).

This way you can deal with holes (like userspace has), and deal with
entries without size (like kallsyms) by setting size to a random large
value.

---

Index: linux-2.6/Documentation/perf_counter/builtin-report.c
===================================================================
--- linux-2.6.orig/Documentation/perf_counter/builtin-report.c
+++ linux-2.6/Documentation/perf_counter/builtin-report.c
@@ -147,16 +147,25 @@ static struct symbol *dso__find_symbol(s
 		return NULL;
 
 	struct rb_node *n = self->syms.rb_node;
+	struct rb_node *last = NULL;
+	struct symbol *s;
 
 	while (n) {
-		struct symbol *s = rb_entry(n, struct symbol, rb_node);
+		last = n;
+		s = rb_entry(n, struct symbol, rb_node);
 
 		if (ip < s->start)
 			n = n->rb_left;
-		else if (ip > s->end)
-			n = n->rb_right;
 		else
+			n = n->rb_right;
+	}
+
+	while (last) {
+		s = rb_entry(last, struct symbol, rb_node);
+		if (s->start <= ip && ip < s->end)
 			return s;
+
+		last = rb_prev(last);
 	}
 
 	return NULL;


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: add counter for unknown events
       [not found]             ` <new-submission>
                                 ` (60 preceding siblings ...)
  2009-05-26 17:54               ` [tip:perfcounters/core] perf report: add --dump-raw-trace option tip-bot for Ingo Molnar
@ 2009-05-26 18:09               ` tip-bot for Ingo Molnar
  2009-05-26 18:09               ` [tip:perfcounters/core] perf report: add more debugging tip-bot for Ingo Molnar
                                 ` (645 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 18:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  3e70611460fe74ad32534fa9791774f6bbdd4159
Gitweb:     http://git.kernel.org/tip/3e70611460fe74ad32534fa9791774f6bbdd4159
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 18:53:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 18:53:17 +0200

perf report: add counter for unknown events

Add a counter for unknown event records.

[ Impact: improve debugging ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 8ea8aaa..4b5ccc5 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -645,7 +645,7 @@ static int __cmd_report(void)
 	char *buf;
 	event_t *event;
 	int ret, rc = EXIT_FAILURE;
-	unsigned long total = 0, total_mmap = 0, total_comm = 0;
+	unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown;
 
 	input = open(input_name, O_RDONLY);
 	if (input < 0) {
@@ -785,6 +785,7 @@ more:
 	default: {
 		fprintf(stderr, "skipping unknown header type: %d\n",
 			event->header.type);
+		total_unknown++;
 	}
 	}
 
@@ -796,9 +797,10 @@ done:
 	close(input);
 
 	if (dump_trace) {
-		fprintf(stderr, "   IP events: %10ld\n", total);
-		fprintf(stderr, " mmap events: %10ld\n", total_mmap);
-		fprintf(stderr, " comm events: %10ld\n", total_comm);
+		fprintf(stderr, "      IP events: %10ld\n", total);
+		fprintf(stderr, "    mmap events: %10ld\n", total_mmap);
+		fprintf(stderr, "    comm events: %10ld\n", total_comm);
+		fprintf(stderr, " unknown events: %10ld\n", total_unknown);
 
 		return 0;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: add more debugging
       [not found]             ` <new-submission>
                                 ` (61 preceding siblings ...)
  2009-05-26 18:09               ` [tip:perfcounters/core] perf report: add counter for unknown events tip-bot for Ingo Molnar
@ 2009-05-26 18:09               ` tip-bot for Ingo Molnar
  2009-05-26 18:21               ` tip-bot for Ingo Molnar
                                 ` (644 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 18:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  f95f33e6d0e6ee55f8ed62f70e4febe23e4830dc
Gitweb:     http://git.kernel.org/tip/f95f33e6d0e6ee55f8ed62f70e4febe23e4830dc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 19:03:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 19:03:36 +0200

perf report: add more debugging

Add the offset of the file we are analyzing.

In case of problems it's easier to see where the parser lost track.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 4b5ccc5..1b16f81 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -709,7 +709,8 @@ more:
 		uint64_t ip = event->ip.ip;
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT (IP, %d): %d: %p\n",
+			fprintf(stderr, "%p: PERF_EVENT (IP, %d): %d: %p\n",
+				(void *)(offset + head),
 				event->header.misc,
 				event->ip.pid,
 				(void *)event->ip.ip);
@@ -753,7 +754,8 @@ more:
 		struct map *map = map__new(&event->mmap);
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+			fprintf(stderr, "%p: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+				(void *)(offset + head),
 				(void *)event->mmap.start,
 				(void *)event->mmap.len,
 				(void *)event->mmap.pgoff,
@@ -771,7 +773,8 @@ more:
 		struct thread *thread = threads__findnew(event->comm.pid);
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT_COMM: %s:%d\n",
+			fprintf(stderr, "%p: PERF_EVENT_COMM: %s:%d\n",
+				(void *)(offset + head),
 				event->comm.comm, event->comm.pid);
 		}
 		if (thread == NULL ||
@@ -783,7 +786,8 @@ more:
 		break;
 	}
 	default: {
-		fprintf(stderr, "skipping unknown header type: %d\n",
+		fprintf(stderr, "%p: skipping unknown header type: %d\n",
+			(void *)(offset + head),
 			event->header.type);
 		total_unknown++;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: add more debugging
       [not found]             ` <new-submission>
                                 ` (62 preceding siblings ...)
  2009-05-26 18:09               ` [tip:perfcounters/core] perf report: add more debugging tip-bot for Ingo Molnar
@ 2009-05-26 18:21               ` tip-bot for Ingo Molnar
  2009-05-26 19:21               ` [tip:perfcounters/core] perf report: More robust error handling tip-bot for Peter Zijlstra
                                 ` (643 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-26 18:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  78bfcc8556838bad563b781c49e5f20ec5831611
Gitweb:     http://git.kernel.org/tip/78bfcc8556838bad563b781c49e5f20ec5831611
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 26 May 2009 19:03:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 19:15:59 +0200

perf report: add more debugging

Add the offset of the file we are analyzing, and the size of the record.

In case of problems it's easier to see where the parser lost track.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 4b5ccc5..1b16f81 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -709,7 +709,8 @@ more:
 		uint64_t ip = event->ip.ip;
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT (IP, %d): %d: %p\n",
+			fprintf(stderr, "%p: PERF_EVENT (IP, %d): %d: %p\n",
+				(void *)(offset + head),
 				event->header.misc,
 				event->ip.pid,
 				(void *)event->ip.ip);
@@ -753,7 +754,8 @@ more:
 		struct map *map = map__new(&event->mmap);
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+			fprintf(stderr, "%p: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+				(void *)(offset + head),
 				(void *)event->mmap.start,
 				(void *)event->mmap.len,
 				(void *)event->mmap.pgoff,
@@ -771,7 +773,8 @@ more:
 		struct thread *thread = threads__findnew(event->comm.pid);
 
 		if (dump_trace) {
-			fprintf(stderr, "PERF_EVENT_COMM: %s:%d\n",
+			fprintf(stderr, "%p: PERF_EVENT_COMM: %s:%d\n",
+				(void *)(offset + head),
 				event->comm.comm, event->comm.pid);
 		}
 		if (thread == NULL ||
@@ -783,7 +786,8 @@ more:
 		break;
 	}
 	default: {
-		fprintf(stderr, "skipping unknown header type: %d\n",
+		fprintf(stderr, "%p: skipping unknown header type: %d\n",
+			(void *)(offset + head),
 			event->header.type);
 		total_unknown++;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: More robust error handling
       [not found]             ` <new-submission>
                                 ` (63 preceding siblings ...)
  2009-05-26 18:21               ` tip-bot for Ingo Molnar
@ 2009-05-26 19:21               ` tip-bot for Peter Zijlstra
  2009-05-27  7:36               ` [tip:perfcounters/core] perf_counter tools: Rename output.perf to perf.data tip-bot for Ingo Molnar
                                 ` (642 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-26 19:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  6142f9ec108a4ddbf0d5904c3daa5fdcaa618792
Gitweb:     http://git.kernel.org/tip/6142f9ec108a4ddbf0d5904c3daa5fdcaa618792
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 26 May 2009 20:51:47 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 26 May 2009 20:17:46 +0200

perf report: More robust error handling

Don't let funny events confuse us, stick to what we know and
try to find sensible data again.

If we find an unknown event, check we're still u64 aligned, and
increment by one u64. This ensures we're bound to happen upon a
valid event soon.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 2d4e4cc..a58be7f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -645,6 +645,7 @@ static int __cmd_report(void)
 	char *buf;
 	event_t *event;
 	int ret, rc = EXIT_FAILURE;
+	uint32_t size;
 	unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
 
 	input = open(input_name, O_RDONLY);
@@ -680,6 +681,10 @@ remap:
 more:
 	event = (event_t *)(buf + head);
 
+	size = event->header.size;
+	if (!size)
+		size = 8;
+
 	if (head + event->header.size >= page_size * mmap_window) {
 		unsigned long shift = page_size * (head / page_size);
 		int ret;
@@ -692,12 +697,9 @@ more:
 		goto remap;
 	}
 
-
-	if (!event->header.size) {
-		fprintf(stderr, "zero-sized event at file offset %ld\n", offset + head);
-		fprintf(stderr, "skipping %ld bytes of events.\n", stat.st_size - offset - head);
-		goto done;
-	}
+	size = event->header.size;
+	if (!size)
+		goto broken_event;
 
 	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
 		char level;
@@ -787,15 +789,26 @@ more:
 		break;
 	}
 	default: {
+broken_event:
 		fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
 			(void *)(offset + head),
 			(void *)(long)(event->header.size),
 			event->header.type);
 		total_unknown++;
+
+		/*
+		 * assume we lost track of the stream, check alignment, and
+		 * increment a single u64 in the hope to catch on again 'soon'.
+		 */
+
+		if (unlikely(head & 7))
+			head &= ~7ULL;
+
+		size = 8;
 	}
 	}
 
-	head += event->header.size;
+	head += size;
 
 	if (offset + head < stat.st_size)
 		goto more;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Rename output.perf to perf.data
       [not found]             ` <new-submission>
                                 ` (64 preceding siblings ...)
  2009-05-26 19:21               ` [tip:perfcounters/core] perf report: More robust error handling tip-bot for Peter Zijlstra
@ 2009-05-27  7:36               ` tip-bot for Ingo Molnar
  2009-05-27  9:06               ` [tip:perfcounters/core] perf_counter tools: Add built-in pager support tip-bot for Ingo Molnar
                                 ` (641 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-27  7:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  23ac9cbed82b00ca3520bb81dbe9ea3b7a936a1b
Gitweb:     http://git.kernel.org/tip/23ac9cbed82b00ca3520bb81dbe9ea3b7a936a1b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 27 May 2009 09:33:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 09:33:18 +0200

perf_counter tools: Rename output.perf to perf.data

output.perf is only output to perf-record - it's input to
perf-report. So change it to a more direction-neutral name.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-record.txt     |    4 ++--
 .../perf_counter/Documentation/perf-report.txt     |    4 ++--
 Documentation/perf_counter/builtin-record.c        |    2 +-
 Documentation/perf_counter/builtin-report.c        |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/Documentation/perf_counter/Documentation/perf-record.txt
index d07700e..353db1b 100644
--- a/Documentation/perf_counter/Documentation/perf-record.txt
+++ b/Documentation/perf_counter/Documentation/perf-record.txt
@@ -3,7 +3,7 @@ perf-record(1)
 
 NAME
 ----
-perf-record - Run a command and record its profile into output.perf
+perf-record - Run a command and record its profile into perf.data
 
 SYNOPSIS
 --------
@@ -13,7 +13,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 This command runs a command and gathers a performance counter profile
-from it, into output.perf - without displaying anything.
+from it, into perf.data - without displaying anything.
 
 This file can then be inspected later on, using 'perf report'.
 
diff --git a/Documentation/perf_counter/Documentation/perf-report.txt b/Documentation/perf_counter/Documentation/perf-report.txt
index 64696a2..49efe16 100644
--- a/Documentation/perf_counter/Documentation/perf-report.txt
+++ b/Documentation/perf_counter/Documentation/perf-report.txt
@@ -3,7 +3,7 @@ perf-report(1)
 
 NAME
 ----
-perf-report - Read output.perf (created by perf record) and display the profile
+perf-report - Read perf.data (created by perf record) and display the profile
 
 SYNOPSIS
 --------
@@ -19,7 +19,7 @@ OPTIONS
 -------
 -i::
 --input=::
-        Input file name. (default: output.perf)
+        Input file name. (default: perf.data)
 
 Configuration
 -------------
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 68abfdf..431077a 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -19,7 +19,7 @@ static int			nr_cpus				=  0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			= 16;
 static int			output;
-static const char		*output_name			= "output.perf";
+static const char		*output_name			= "perf.data";
 static int			group				= 0;
 static unsigned int		realtime_prio			= 0;
 static int			system_wide			= 0;
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 7f1255d..e2712cd 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -18,7 +18,7 @@
 #define SHOW_USER	2
 #define SHOW_HV		4
 
-static char		const *input_name = "output.perf";
+static char		const *input_name = "perf.data";
 static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add built-in pager support
       [not found]             ` <new-submission>
                                 ` (65 preceding siblings ...)
  2009-05-27  7:36               ` [tip:perfcounters/core] perf_counter tools: Rename output.perf to perf.data tip-bot for Ingo Molnar
@ 2009-05-27  9:06               ` tip-bot for Ingo Molnar
  2009-05-27 10:33               ` [tip:perfcounters/core] perf record: Fix the profiling of existing pid or whole box tip-bot for Mike Galbraith
                                 ` (640 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-27  9:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  a930d2c0d0a685ab955472b08baad041cc5edb4a
Gitweb:     http://git.kernel.org/tip/a930d2c0d0a685ab955472b08baad041cc5edb4a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 27 May 2009 09:50:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 09:59:00 +0200

perf_counter tools: Add built-in pager support

Add Git's pager.c (and sigchain) code. A command only
has to call setup_pager() to get paged interactive
output.

Non-interactive (redirected, command-piped, etc.) uses
are not affected.

Update perf-report to make use of this.

[ Impact: new feature ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile           |    4 +
 Documentation/perf_counter/builtin-report.c   |    3 +
 Documentation/perf_counter/util/environment.c |    8 ++
 Documentation/perf_counter/util/pager.c       |   99 +++++++++++++++++++++++++
 Documentation/perf_counter/util/sigchain.c    |   52 +++++++++++++
 Documentation/perf_counter/util/sigchain.h    |   11 +++
 6 files changed, 177 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index efb0589..51b13f9 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -297,11 +297,13 @@ LIB_H += util/util.h
 LIB_H += util/help.h
 LIB_H += util/strbuf.h
 LIB_H += util/run-command.h
+LIB_H += util/sigchain.h
 
 LIB_OBJS += util/abspath.o
 LIB_OBJS += util/alias.o
 LIB_OBJS += util/config.o
 LIB_OBJS += util/ctype.o
+LIB_OBJS += util/environment.o
 LIB_OBJS += util/exec_cmd.o
 LIB_OBJS += util/help.o
 LIB_OBJS += util/levenshtein.o
@@ -314,6 +316,8 @@ LIB_OBJS += util/quote.o
 LIB_OBJS += util/strbuf.o
 LIB_OBJS += util/usage.o
 LIB_OBJS += util/wrapper.o
+LIB_OBJS += util/sigchain.o
+LIB_OBJS += util/pager.o
 
 BUILTIN_OBJS += builtin-help.o
 BUILTIN_OBJS += builtin-record.o
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index e2712cd..9aef7c5 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -7,6 +7,7 @@
 #include <ctype.h>
 
 #include "util/list.h"
+#include "util/cache.h"
 #include "util/rbtree.h"
 
 #include "perf.h"
@@ -992,5 +993,7 @@ int cmd_report(int argc, const char **argv, const char *prefix)
 
 	parse_options(argc, argv, options, report_usage, 0);
 
+	setup_pager();
+
 	return __cmd_report();
 }
diff --git a/Documentation/perf_counter/util/environment.c b/Documentation/perf_counter/util/environment.c
new file mode 100644
index 0000000..9b1c819
--- /dev/null
+++ b/Documentation/perf_counter/util/environment.c
@@ -0,0 +1,8 @@
+/*
+ * We put all the perf config variables in this same object
+ * file, so that programs can link against the config parser
+ * without having to link against all the rest of perf.
+ */
+#include "cache.h"
+
+const char *pager_program;
diff --git a/Documentation/perf_counter/util/pager.c b/Documentation/perf_counter/util/pager.c
new file mode 100644
index 0000000..a28bcca
--- /dev/null
+++ b/Documentation/perf_counter/util/pager.c
@@ -0,0 +1,99 @@
+#include "cache.h"
+#include "run-command.h"
+#include "sigchain.h"
+
+/*
+ * This is split up from the rest of git so that we can do
+ * something different on Windows.
+ */
+
+static int spawned_pager;
+
+#ifndef __MINGW32__
+static void pager_preexec(void)
+{
+	/*
+	 * Work around bug in "less" by not starting it until we
+	 * have real input
+	 */
+	fd_set in;
+
+	FD_ZERO(&in);
+	FD_SET(0, &in);
+	select(1, &in, NULL, &in, NULL);
+
+	setenv("LESS", "FRSX", 0);
+}
+#endif
+
+static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
+static struct child_process pager_process;
+
+static void wait_for_pager(void)
+{
+	fflush(stdout);
+	fflush(stderr);
+	/* signal EOF to pager */
+	close(1);
+	close(2);
+	finish_command(&pager_process);
+}
+
+static void wait_for_pager_signal(int signo)
+{
+	wait_for_pager();
+	sigchain_pop(signo);
+	raise(signo);
+}
+
+void setup_pager(void)
+{
+	const char *pager = getenv("PERF_PAGER");
+
+	if (!isatty(1))
+		return;
+	if (!pager) {
+		if (!pager_program)
+			perf_config(perf_default_config, NULL);
+		pager = pager_program;
+	}
+	if (!pager)
+		pager = getenv("PAGER");
+	if (!pager)
+		pager = "less";
+	else if (!*pager || !strcmp(pager, "cat"))
+		return;
+
+	spawned_pager = 1; /* means we are emitting to terminal */
+
+	/* spawn the pager */
+	pager_argv[2] = pager;
+	pager_process.argv = pager_argv;
+	pager_process.in = -1;
+#ifndef __MINGW32__
+	pager_process.preexec_cb = pager_preexec;
+#endif
+	if (start_command(&pager_process))
+		return;
+
+	/* original process continues, but writes to the pipe */
+	dup2(pager_process.in, 1);
+	if (isatty(2))
+		dup2(pager_process.in, 2);
+	close(pager_process.in);
+
+	/* this makes sure that the parent terminates after the pager */
+	sigchain_push_common(wait_for_pager_signal);
+	atexit(wait_for_pager);
+}
+
+int pager_in_use(void)
+{
+	const char *env;
+
+	if (spawned_pager)
+		return 1;
+
+	env = getenv("PERF_PAGER_IN_USE");
+	return env ? perf_config_bool("PERF_PAGER_IN_USE", env) : 0;
+}
diff --git a/Documentation/perf_counter/util/sigchain.c b/Documentation/perf_counter/util/sigchain.c
new file mode 100644
index 0000000..1118b99
--- /dev/null
+++ b/Documentation/perf_counter/util/sigchain.c
@@ -0,0 +1,52 @@
+#include "sigchain.h"
+#include "cache.h"
+
+#define SIGCHAIN_MAX_SIGNALS 32
+
+struct sigchain_signal {
+	sigchain_fun *old;
+	int n;
+	int alloc;
+};
+static struct sigchain_signal signals[SIGCHAIN_MAX_SIGNALS];
+
+static void check_signum(int sig)
+{
+	if (sig < 1 || sig >= SIGCHAIN_MAX_SIGNALS)
+		die("BUG: signal out of range: %d", sig);
+}
+
+int sigchain_push(int sig, sigchain_fun f)
+{
+	struct sigchain_signal *s = signals + sig;
+	check_signum(sig);
+
+	ALLOC_GROW(s->old, s->n + 1, s->alloc);
+	s->old[s->n] = signal(sig, f);
+	if (s->old[s->n] == SIG_ERR)
+		return -1;
+	s->n++;
+	return 0;
+}
+
+int sigchain_pop(int sig)
+{
+	struct sigchain_signal *s = signals + sig;
+	check_signum(sig);
+	if (s->n < 1)
+		return 0;
+
+	if (signal(sig, s->old[s->n - 1]) == SIG_ERR)
+		return -1;
+	s->n--;
+	return 0;
+}
+
+void sigchain_push_common(sigchain_fun f)
+{
+	sigchain_push(SIGINT, f);
+	sigchain_push(SIGHUP, f);
+	sigchain_push(SIGTERM, f);
+	sigchain_push(SIGQUIT, f);
+	sigchain_push(SIGPIPE, f);
+}
diff --git a/Documentation/perf_counter/util/sigchain.h b/Documentation/perf_counter/util/sigchain.h
new file mode 100644
index 0000000..618083b
--- /dev/null
+++ b/Documentation/perf_counter/util/sigchain.h
@@ -0,0 +1,11 @@
+#ifndef SIGCHAIN_H
+#define SIGCHAIN_H
+
+typedef void (*sigchain_fun)(int);
+
+int sigchain_push(int sig, sigchain_fun f);
+int sigchain_pop(int sig);
+
+void sigchain_push_common(sigchain_fun f);
+
+#endif /* SIGCHAIN_H */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Fix the profiling of existing pid or whole box
       [not found]             ` <new-submission>
                                 ` (66 preceding siblings ...)
  2009-05-27  9:06               ` [tip:perfcounters/core] perf_counter tools: Add built-in pager support tip-bot for Ingo Molnar
@ 2009-05-27 10:33               ` tip-bot for Mike Galbraith
  2009-05-27 11:24               ` [tip:perfcounters/core] perf report: Remove <ctype.h> include tip-bot for Ingo Molnar
                                 ` (639 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-27 10:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  ef65b2a0b3a2f82850144df6e6a7796f6d66da6b
Gitweb:     http://git.kernel.org/tip/ef65b2a0b3a2f82850144df6e6a7796f6d66da6b
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Wed, 27 May 2009 10:10:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 12:31:03 +0200

perf record: Fix the profiling of existing pid or whole box

Perf record bails if no command argument is provided, so you can't use
naked -a or -p to profile a running task or the whole box.

Allow foreground profiling of an existing pid or the entire system.

[ Impact: fix command option handling bug ]

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 431077a..4a06866 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -354,7 +354,7 @@ static int __cmd_record(int argc, const char **argv)
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
 
-	if (target_pid == -1) {
+	if (target_pid == -1 && argc) {
 		pid = fork();
 		if (pid < 0)
 			perror("failed to fork");
@@ -430,7 +430,7 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 	create_events_help(events_help_msg);
 
 	argc = parse_options(argc, argv, options, record_usage, 0);
-	if (!argc)
+	if (!argc && target_pid == -1 && !system_wide)
 		usage_with_options(record_usage, options);
 
 	if (!nr_counters) {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Remove <ctype.h> include
       [not found]             ` <new-submission>
                                 ` (67 preceding siblings ...)
  2009-05-27 10:33               ` [tip:perfcounters/core] perf record: Fix the profiling of existing pid or whole box tip-bot for Mike Galbraith
@ 2009-05-27 11:24               ` tip-bot for Ingo Molnar
  2009-05-27 13:03               ` [tip:perfcounters/core] perf_counter: tools: /usr/lib/debug%s.debug support tip-bot for Peter Zijlstra
                                 ` (638 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-27 11:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	penberg, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  d716fba49c7445ec87c3f045c59624fac03ee3f2
Gitweb:     http://git.kernel.org/tip/d716fba49c7445ec87c3f045c59624fac03ee3f2
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 27 May 2009 13:19:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 13:19:59 +0200

perf report: Remove <ctype.h> include

Pekka reported build failure in builtin-report.c:

    CC builtin-report.o
    In file included from builtin-report.c:7:
    /usr/include/ctype.h:102: error: expected expression before token

And observed:

| Removing #include <ctype.h> from builtin-report.c makes the problem
| go away. I am running Ubuntu 9.04 that has gcc 4.3.3 and libc 2.9.

Reported-by: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9aef7c5..6265bed 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -4,7 +4,6 @@
 #include <libelf.h>
 #include <gelf.h>
 #include <elf.h>
-#include <ctype.h>
 
 #include "util/list.h"
 #include "util/cache.h"

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: tools: /usr/lib/debug%s.debug support
       [not found]             ` <new-submission>
                                 ` (68 preceding siblings ...)
  2009-05-27 11:24               ` [tip:perfcounters/core] perf report: Remove <ctype.h> include tip-bot for Ingo Molnar
@ 2009-05-27 13:03               ` tip-bot for Peter Zijlstra
  2009-05-27 21:25               ` [tip:perfcounters/core] pref_counter: tools: report: Robustify in case of weird events tip-bot for Ingo Molnar
                                 ` (637 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-27 13:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  b7a16eac5e679fb5f531b9eeff7db7952303e77d
Gitweb:     http://git.kernel.org/tip/b7a16eac5e679fb5f531b9eeff7db7952303e77d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 27 May 2009 13:35:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 14:54:29 +0200

perf_counter: tools: /usr/lib/debug%s.debug support

Some distros seem to store debuginfo in weird places.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   94 +++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 18 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6265bed..a9ff49a 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -190,7 +190,8 @@ static inline int elf_sym__is_function(const GElf_Sym *sym)
 {
 	return elf_sym__type(sym) == STT_FUNC &&
 	       sym->st_name != 0 &&
-	       sym->st_shndx != SHN_UNDEF;
+	       sym->st_shndx != SHN_UNDEF &&
+	       sym->st_size != 0;
 }
 
 static inline const char *elf_sym__name(const GElf_Sym *sym,
@@ -222,11 +223,11 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 	return sec;
 }
 
-static int dso__load(struct dso *self)
+static int dso__load_sym(struct dso *self, int fd, char *name)
 {
 	Elf_Data *symstrs;
 	uint32_t nr_syms;
-	int fd, err = -1;
+	int err = -1;
 	uint32_t index;
 	GElf_Ehdr ehdr;
 	GElf_Shdr shdr;
@@ -234,16 +235,12 @@ static int dso__load(struct dso *self)
 	GElf_Sym sym;
 	Elf_Scn *sec;
 	Elf *elf;
-
-
-	fd = open(self->name, O_RDONLY);
-	if (fd == -1)
-		return -1;
+	int nr = 0;
 
 	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
 	if (elf == NULL) {
 		fprintf(stderr, "%s: cannot read %s ELF file.\n",
-			__func__, self->name);
+			__func__, name);
 		goto out_close;
 	}
 
@@ -292,16 +289,63 @@ static int dso__load(struct dso *self)
 			goto out_elf_end;
 
 		dso__insert_symbol(self, f);
+
+		nr++;
 	}
 
-	err = 0;
+	err = nr;
 out_elf_end:
 	elf_end(elf);
 out_close:
-	close(fd);
 	return err;
 }
 
+static int dso__load(struct dso *self)
+{
+	int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug");
+	char *name = malloc(size);
+	int variant = 0;
+	int ret = -1;
+	int fd;
+
+	if (!name)
+		return -1;
+
+more:
+	do {
+		switch (variant) {
+		case 0: /* Fedora */
+			snprintf(name, size, "/usr/lib/debug%s.debug", self->name);
+			break;
+		case 1: /* Ubuntu */
+			snprintf(name, size, "/usr/lib/debug%s", self->name);
+			break;
+		case 2: /* Sane people */
+			snprintf(name, size, "%s", self->name);
+			break;
+
+		default:
+			goto out;
+		}
+		variant++;
+
+		fd = open(name, O_RDONLY);
+	} while (fd < 0);
+
+	ret = dso__load_sym(self, fd, name);
+	close(fd);
+
+	/*
+	 * Some people seem to have debuginfo files _WITHOUT_ debug info!?!?
+	 */
+	if (!ret)
+		goto more;
+
+out:
+	free(name);
+	return ret;
+}
+
 static size_t dso__fprintf(struct dso *self, FILE *fp)
 {
 	size_t ret = fprintf(fp, "dso: %s\n", self->name);
@@ -336,11 +380,23 @@ static struct dso *dsos__find(const char *name)
 static struct dso *dsos__findnew(const char *name)
 {
 	struct dso *dso = dsos__find(name);
+	int nr;
 
 	if (dso == NULL) {
 		dso = dso__new(name);
-		if (dso != NULL && dso__load(dso) < 0)
+		if (!dso)
+			goto out_delete_dso;
+
+		nr = dso__load(dso);
+		if (nr < 0) {
+			fprintf(stderr, "Failed to open: %s\n", name);
 			goto out_delete_dso;
+		}
+		if (!nr) {
+			fprintf(stderr,
+		"Failed to find debug symbols for: %s, maybe install a debug package?\n",
+					name);
+		}
 
 		dsos__add(dso);
 	}
@@ -547,9 +603,9 @@ symhist__fprintf(struct symhist *self, uint64_t total_samples, FILE *fp)
 	size_t ret;
 
 	if (total_samples)
-		ret = fprintf(fp, "%5.2f", (self->count * 100.0) / total_samples);
+		ret = fprintf(fp, "%5.2f%% ", (self->count * 100.0) / total_samples);
 	else
-		ret = fprintf(fp, "%12d", self->count);
+		ret = fprintf(fp, "%12d ", self->count);
 
 	ret += fprintf(fp, "%14s [%c] ",
 		       thread__name(self->thread, bf, sizeof(bf)),
@@ -922,10 +978,12 @@ more:
 	}
 	default: {
 broken_event:
-		fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
-			(void *)(offset + head),
-			(void *)(long)(event->header.size),
-			event->header.type);
+		if (dump_trace)
+			fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
+					(void *)(offset + head),
+					(void *)(long)(event->header.size),
+					event->header.type);
+
 		total_unknown++;
 
 		/*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] pref_counter: tools: report: Robustify in case of weird events
       [not found]             ` <new-submission>
                                 ` (69 preceding siblings ...)
  2009-05-27 13:03               ` [tip:perfcounters/core] perf_counter: tools: /usr/lib/debug%s.debug support tip-bot for Peter Zijlstra
@ 2009-05-27 21:25               ` tip-bot for Ingo Molnar
  2009-05-28  9:46               ` [tip:perfcounters/core] perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS tip-bot for Ingo Molnar
                                 ` (636 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-27 21:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  55717314c4e3a5180a54228a2f97e50f3496de4c
Gitweb:     http://git.kernel.org/tip/55717314c4e3a5180a54228a2f97e50f3496de4c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 27 May 2009 22:13:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 May 2009 22:19:58 +0200

pref_counter: tools: report: Robustify in case of weird events

This error condition:

  aldebaran:~/linux/linux/Documentation/perf_counter> perf report
  dso__load_sym: cannot get elf header.
  failed to open: /etc/ld.so.cache
  problem processing PERF_EVENT_MMAP, bailing out

caused the profile to be very short - as the error was at the beginning
of the file and we bailed out completely.

Be more permissive and consider the event broken instead.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6df95c2..5993c12 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -1117,9 +1117,9 @@ more:
 		}
 
 		if (thread == NULL) {
-			fprintf(stderr, "problem processing %d event, bailing out\n",
+			fprintf(stderr, "problem processing %d event, skipping it.\n",
 				event->header.type);
-			goto done;
+			goto broken_event;
 		}
 
 		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
@@ -1149,8 +1149,8 @@ more:
 
 			if (hist_entry__add(thread, map, dso, sym, ip, level)) {
 				fprintf(stderr,
-		"problem incrementing symbol count, bailing out\n");
-				goto done;
+		"problem incrementing symbol count, skipping event\n");
+				goto broken_event;
 			}
 		}
 		total++;
@@ -1169,8 +1169,8 @@ more:
 				event->mmap.filename);
 		}
 		if (thread == NULL || map == NULL) {
-			fprintf(stderr, "problem processing PERF_EVENT_MMAP, bailing out\n");
-			goto done;
+			fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
+			goto broken_event;
 		}
 		thread__insert_map(thread, map);
 		total_mmap++;
@@ -1187,8 +1187,8 @@ more:
 		}
 		if (thread == NULL ||
 		    thread__set_comm(thread, event->comm.comm)) {
-			fprintf(stderr, "problem processing PERF_EVENT_COMM, bailing out\n");
-			goto done;
+			fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
+			goto broken_event;
 		}
 		total_comm++;
 		break;
@@ -1221,7 +1221,6 @@ broken_event:
 		goto more;
 
 	rc = EXIT_SUCCESS;
-done:
 	close(input);
 
 	if (dump_trace) {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS
       [not found]             ` <new-submission>
                                 ` (70 preceding siblings ...)
  2009-05-27 21:25               ` [tip:perfcounters/core] pref_counter: tools: report: Robustify in case of weird events tip-bot for Ingo Molnar
@ 2009-05-28  9:46               ` tip-bot for Ingo Molnar
  2009-05-28 10:00               ` [tip:perfcounters/core] perf_counter tools: report: Implement header output for --sort variants tip-bot for Peter Zijlstra
                                 ` (635 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-28  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  d3e78ee3d015dac1794433abb6403b6fc8e70e10
Gitweb:     http://git.kernel.org/tip/d3e78ee3d015dac1794433abb6403b6fc8e70e10
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 28 May 2009 11:41:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 28 May 2009 11:42:16 +0200

perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS

Pointed out by compiler warnings:

   tip/include/linux/perf_counter.h:644: warning: no return statement in function returning non-void

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 2b16ed3..a65ddc5 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -641,7 +641,7 @@ perf_counter_task_sched_out(struct task_struct *task,
 			    struct task_struct *next, int cpu)		{ }
 static inline void
 perf_counter_task_tick(struct task_struct *task, int cpu)		{ }
-static inline int perf_counter_init_task(struct task_struct *child)	{ }
+static inline int perf_counter_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_counter_exit_task(struct task_struct *child)	{ }
 static inline void perf_counter_do_pending(void)			{ }
 static inline void perf_counter_print_debug(void)			{ }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: report: Implement header output for --sort variants
       [not found]             ` <new-submission>
                                 ` (71 preceding siblings ...)
  2009-05-28  9:46               ` [tip:perfcounters/core] perf_counter: Fix perf_counter_init_task() on !CONFIG_PERF_COUNTERS tip-bot for Ingo Molnar
@ 2009-05-28 10:00               ` tip-bot for Peter Zijlstra
  2009-05-28 10:00               ` [tip:perfcounters/core] perf_counter tools: report: Add help text for --sort tip-bot for Ingo Molnar
                                 ` (634 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-28 10:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  ca8cdeef9ca2ff89ee8a21d6f6ff3dfb60286041
Gitweb:     http://git.kernel.org/tip/ca8cdeef9ca2ff89ee8a21d6f6ff3dfb60286041
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 28 May 2009 11:08:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 28 May 2009 11:47:02 +0200

perf_counter tools: report: Implement header output for --sort variants

Implement this style of header:

 #
 # Overhead          Command       File: Symbol
 # ........          .......       ............
 #

for the various --sort variants as well.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   70 +++++++++++----------------
 1 files changed, 28 insertions(+), 42 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 5993c12..506cde4 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -596,8 +596,6 @@ out_delete:
 
 struct thread;
 
-static const char *thread__name(struct thread *self, char *bf, size_t size);
-
 struct thread {
 	struct rb_node	 rb_node;
 	struct list_head maps;
@@ -605,15 +603,6 @@ struct thread {
 	char		 *comm;
 };
 
-static const char *thread__name(struct thread *self, char *bf, size_t size)
-{
-	if (self->comm)
-		return self->comm;
-
-	snprintf(bf, sizeof(bf), ":%u", self->pid);
-	return bf;
-}
-
 static struct thread *thread__new(pid_t pid)
 {
 	struct thread *self = malloc(sizeof(*self));
@@ -707,8 +696,9 @@ struct hist_entry {
 struct sort_entry {
 	struct list_head list;
 
+	char *header;
+
 	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
-	size_t (*print_header)(FILE *fp);
 	size_t	(*print)(FILE *fp, struct hist_entry *);
 };
 
@@ -721,13 +711,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__thread_print(FILE *fp, struct hist_entry *self)
 {
-	char bf[32];
-
-	return fprintf(fp, " %16s",
-			thread__name(self->thread, bf, sizeof(bf)));
+	return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
 }
 
 static struct sort_entry sort_thread = {
+	.header = "         Command: Pid ",
 	.cmp	= sort__thread_cmp,
 	.print	= sort__thread_print,
 };
@@ -757,6 +745,7 @@ sort__comm_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_comm = {
+	.header = "         Command",
 	.cmp	= sort__comm_cmp,
 	.print	= sort__comm_print,
 };
@@ -786,6 +775,7 @@ sort__dso_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_dso = {
+	.header = "                                                    Shared Object",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };
@@ -804,43 +794,25 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
 	return (int64_t)(ip_r - ip_l);
 }
 
-static size_t sort__sym_print_header(FILE *fp)
-{
-	size_t ret = 0;
-
-	ret += fprintf(fp, "#\n");
-	ret += fprintf(fp, "# Overhead          Command       File: Symbol\n");
-	ret += fprintf(fp, "# ........          .......       ............\n");
-	ret += fprintf(fp, "#\n");
-
-	return ret;
-}
-
 static size_t
 sort__sym_print(FILE *fp, struct hist_entry *self)
 {
 	size_t ret = 0;
 
-	ret += fprintf(fp, "  [%c] ", self->level);
-
 	if (verbose)
 		ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip);
 
-	if (self->level != '.')
-		ret += fprintf(fp, " kernel: %s",
-			       self->sym ? self->sym->name : "<unknown>");
-	else
-		ret += fprintf(fp, " %s: %s",
-			       self->dso ? self->dso->name : "<unknown>",
-			       self->sym ? self->sym->name : "<unknown>");
+	ret += fprintf(fp, " %s: %s",
+			self->dso ? self->dso->name : "<unknown>",
+			self->sym ? self->sym->name : "<unknown>");
 
 	return ret;
 }
 
 static struct sort_entry sort_sym = {
-	.cmp		= sort__sym_cmp,
-	.print_header	= sort__sym_print_header,
-	.print		= sort__sym_print,
+	.header = "Shared Object: Symbol",
+	.cmp	= sort__sym_cmp,
+	.print	= sort__sym_print,
 };
 
 struct sort_dimension {
@@ -1021,10 +993,24 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 	struct rb_node *nd;
 	size_t ret = 0;
 
+	fprintf(fp, "#\n");
+
+	fprintf(fp, "# Overhead");
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		fprintf(fp, " %s", se->header);
+	fprintf(fp, "\n");
+
+	fprintf(fp, "# ........");
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
-		if (se->print_header)
-			ret += se->print_header(fp);
+		int i;
+
+		fprintf(fp, " ");
+		for (i = 0; i < strlen(se->header); i++)
+			fprintf(fp, ".");
 	}
+	fprintf(fp, "\n");
+
+	fprintf(fp, "#\n");
 
 	for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
 		pos = rb_entry(nd, struct hist_entry, rb_node);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: report: Add help text for --sort
       [not found]             ` <new-submission>
                                 ` (72 preceding siblings ...)
  2009-05-28 10:00               ` [tip:perfcounters/core] perf_counter tools: report: Implement header output for --sort variants tip-bot for Peter Zijlstra
@ 2009-05-28 10:00               ` tip-bot for Ingo Molnar
  2009-05-28 22:03               ` [tip:perfcounters/core] perf_counter tools: Document '--' option parsing terminator tip-bot for Mike Galbraith
                                 ` (633 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-28 10:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  63299f057fbce47da895e8865cba7e9c3eb01a20
Gitweb:     http://git.kernel.org/tip/63299f057fbce47da895e8865cba7e9c3eb01a20
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 28 May 2009 10:52:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 28 May 2009 10:53:40 +0200

perf_counter tools: report: Add help text for --sort

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 506cde4..9fdf822 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -1240,7 +1240,8 @@ static const struct option options[] = {
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
-	OPT_STRING('s', "sort", &sort_order, "foo", "bar"),
+	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
+		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf stat: handle Ctrl-C
  2009-05-15 10:12               ` [tip:perfcounters/core] perf stat: handle Ctrl-C tip-bot for Ingo Molnar
@ 2009-05-28 11:09                 ` Paul Mackerras
  2009-05-28 12:19                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Paul Mackerras @ 2009-05-28 11:09 UTC (permalink / raw)
  To: mingo, hpa, acme, linux-kernel, a.p.zijlstra, tglx, cjashfor,
	mingo
  Cc: linux-tip-commits

tip-bot for Ingo Molnar writes:

> perf stat: handle Ctrl-C
> 
> Before this change, if a long-running perf stat workload was Ctrl-C-ed,
> the utility exited without displaying statistics.
> 
> After the change, the Ctrl-C gets propagated into the workload (and
> causes its early exit there), but perf stat itself will still continue
> to run and will display counter results.
> 
> This is useful to run open-ended workloads, let them run for
> a while, then Ctrl-C them to get the stats.

Unfortunately it means that if you do e.g.

$ while true; do perf stat something; done

it's impossible to kill the loop with ctrl-C.  To fix this we need to
make perf stat kill itself with the signal after printing the results,
so bash sees the died-due-to-signal exit status and stops the loop.

Paul.

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf stat: handle Ctrl-C
  2009-05-28 11:09                 ` Paul Mackerras
@ 2009-05-28 12:19                   ` Peter Zijlstra
  2009-05-29  9:06                     ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-05-28 12:19 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: mingo, hpa, acme, linux-kernel, tglx, cjashfor, mingo,
	linux-tip-commits

On Thu, 2009-05-28 at 21:09 +1000, Paul Mackerras wrote:
> tip-bot for Ingo Molnar writes:
> 
> > perf stat: handle Ctrl-C
> > 
> > Before this change, if a long-running perf stat workload was Ctrl-C-ed,
> > the utility exited without displaying statistics.
> > 
> > After the change, the Ctrl-C gets propagated into the workload (and
> > causes its early exit there), but perf stat itself will still continue
> > to run and will display counter results.
> > 
> > This is useful to run open-ended workloads, let them run for
> > a while, then Ctrl-C them to get the stats.
> 
> Unfortunately it means that if you do e.g.
> 
> $ while true; do perf stat something; done
> 
> it's impossible to kill the loop with ctrl-C.  To fix this we need to
> make perf stat kill itself with the signal after printing the results,
> so bash sees the died-due-to-signal exit status and stops the loop.

Yep, just ran into the same..

^Z kill $! worked though, but that's not ideal.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Document '--' option parsing terminator
       [not found]             ` <new-submission>
                                 ` (73 preceding siblings ...)
  2009-05-28 10:00               ` [tip:perfcounters/core] perf_counter tools: report: Add help text for --sort tip-bot for Ingo Molnar
@ 2009-05-28 22:03               ` tip-bot for Mike Galbraith
  2009-05-29  7:06               ` [tip:perfcounters/core] perf_counter tools: Fix top symbol table dump typo tip-bot for Mike Galbraith
                                 ` (632 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-28 22:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  9e09675366695405412b709e91709c1ce2925c90
Gitweb:     http://git.kernel.org/tip/9e09675366695405412b709e91709c1ce2925c90
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Thu, 28 May 2009 16:25:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 00:02:33 +0200

perf_counter tools: Document '--' option parsing terminator

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-record.txt     |    1 +
 .../perf_counter/Documentation/perf-stat.txt       |    1 +
 Documentation/perf_counter/builtin-record.c        |    3 ++-
 Documentation/perf_counter/builtin-stat.c          |    1 +
 4 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/Documentation/perf_counter/Documentation/perf-record.txt
index 353db1b..a93d2ec 100644
--- a/Documentation/perf_counter/Documentation/perf-record.txt
+++ b/Documentation/perf_counter/Documentation/perf-record.txt
@@ -9,6 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
+'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>]
 
 DESCRIPTION
 -----------
diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/Documentation/perf_counter/Documentation/perf-stat.txt
index 7fcab27..828c59f 100644
--- a/Documentation/perf_counter/Documentation/perf-stat.txt
+++ b/Documentation/perf_counter/Documentation/perf-stat.txt
@@ -9,6 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'perf stat' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
+'perf stat' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>]
 
 DESCRIPTION
 -----------
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 4a06866..23d1224 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -397,7 +397,8 @@ static int __cmd_record(int argc, const char **argv)
 }
 
 static const char * const record_usage[] = {
-	"perf record [<options>] <command>",
+	"perf record [<options>] [<command>]",
+	"perf record [<options>] -- <command> [<options>]",
 	NULL
 };
 
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index ce661e2..ac14086 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -212,6 +212,7 @@ static void skip_signal(int signo)
 
 static const char * const stat_usage[] = {
 	"perf stat [<options>] <command>",
+	"perf stat [<options>] -- <command> [<options>]",
 	NULL
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix top symbol table dump typo
       [not found]             ` <new-submission>
                                 ` (74 preceding siblings ...)
  2009-05-28 22:03               ` [tip:perfcounters/core] perf_counter tools: Document '--' option parsing terminator tip-bot for Mike Galbraith
@ 2009-05-29  7:06               ` tip-bot for Mike Galbraith
  2009-05-29  7:07               ` [tip:perfcounters/core] perf_counter tools: Fix top symbol table max_ip typo tip-bot for Mike Galbraith
                                 ` (631 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-29  7:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  a3ec8d70f1a55acccc4874fe9b4dadbbb9454a0f
Gitweb:     http://git.kernel.org/tip/a3ec8d70f1a55acccc4874fe9b4dadbbb9454a0f
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 29 May 2009 06:46:46 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 09:03:56 +0200

perf_counter tools: Fix top symbol table dump typo

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 52ba9f4..0d100f5 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -371,7 +371,7 @@ static int parse_symbols(void)
 	max_ip = sym->start;
 
 	if (dump_symtab)
-		dso__fprintf(kernel_dso, stdout);
+		dso__fprintf(kernel_dso, stderr);
 
 	return 0;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix top symbol table max_ip typo
       [not found]             ` <new-submission>
                                 ` (75 preceding siblings ...)
  2009-05-29  7:06               ` [tip:perfcounters/core] perf_counter tools: Fix top symbol table dump typo tip-bot for Mike Galbraith
@ 2009-05-29  7:07               ` tip-bot for Mike Galbraith
  2009-05-29  9:00               ` [tip:perfcounters/core] perf_counter tools: Clean up builtin-stat.c's do_perfstat() tip-bot for Ingo Molnar
                                 ` (630 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-05-29  7:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  da417a7537cbf4beb28a08a49adf915f2358040c
Gitweb:     http://git.kernel.org/tip/da417a7537cbf4beb28a08a49adf915f2358040c
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 29 May 2009 08:23:16 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 09:03:57 +0200

perf_counter tools: Fix top symbol table max_ip typo

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 0d100f5..ebe8bec 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -368,7 +368,7 @@ static int parse_symbols(void)
 
 	node = rb_last(&kernel_dso->syms);
 	sym = rb_entry(node, struct symbol, rb_node);
-	max_ip = sym->start;
+	max_ip = sym->end;
 
 	if (dump_symtab)
 		dso__fprintf(kernel_dso, stderr);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Clean up builtin-stat.c's do_perfstat()
       [not found]             ` <new-submission>
                                 ` (76 preceding siblings ...)
  2009-05-29  7:07               ` [tip:perfcounters/core] perf_counter tools: Fix top symbol table max_ip typo tip-bot for Mike Galbraith
@ 2009-05-29  9:00               ` tip-bot for Ingo Molnar
  2009-05-29  9:00               ` [tip:perfcounters/core] perf_counter tools: Split display into reading and printing tip-bot for Ingo Molnar
                                 ` (629 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-29  9:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  c04f5e5d7b523f90ee3cdd70a68c4002aaecd3fa
Gitweb:     http://git.kernel.org/tip/c04f5e5d7b523f90ee3cdd70a68c4002aaecd3fa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 09:10:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 09:11:49 +0200

perf_counter tools: Clean up builtin-stat.c's do_perfstat()

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |  116 +++++++++++++++++------------
 1 files changed, 67 insertions(+), 49 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index ac14086..6a29361 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -109,11 +109,75 @@ static void create_perfstat_counter(int counter)
 	}
 }
 
+/*
+ * Does the counter have nsecs as a unit?
+ */
+static inline int nsec_counter(int counter)
+{
+	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK))
+		return 1;
+	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK))
+		return 1;
+
+	return 0;
+}
+
+/*
+ * Print out the results of a single counter:
+ */
+static void print_counter(int counter)
+{
+	__u64 count[3], single_count[3];
+	ssize_t res;
+	int cpu, nv;
+	int scaled;
+
+	count[0] = count[1] = count[2] = 0;
+	nv = scale ? 3 : 1;
+	for (cpu = 0; cpu < nr_cpus; cpu ++) {
+		res = read(fd[cpu][counter], single_count, nv * sizeof(__u64));
+		assert(res == nv * sizeof(__u64));
+
+		count[0] += single_count[0];
+		if (scale) {
+			count[1] += single_count[1];
+			count[2] += single_count[2];
+		}
+	}
+
+	scaled = 0;
+	if (scale) {
+		if (count[2] == 0) {
+			fprintf(stderr, " %14s  %-20s\n",
+				"<not counted>", event_name(counter));
+			return;
+		}
+		if (count[2] < count[1]) {
+			scaled = 1;
+			count[0] = (unsigned long long)
+				((double)count[0] * count[1] / count[2] + 0.5);
+		}
+	}
+
+	if (nsec_counter(counter)) {
+		double msecs = (double)count[0] / 1000000;
+
+		fprintf(stderr, " %14.6f  %-20s (msecs)",
+			msecs, event_name(counter));
+	} else {
+		fprintf(stderr, " %14Ld  %-20s (events)",
+			count[0], event_name(counter));
+	}
+	if (scaled)
+		fprintf(stderr, "  (scaled from %.2f%%)",
+			(double) count[2] / count[1] * 100);
+	fprintf(stderr, "\n");
+}
+
 static int do_perfstat(int argc, const char **argv)
 {
 	unsigned long long t0, t1;
 	int counter;
-	ssize_t res;
 	int status;
 	int pid;
 
@@ -149,55 +213,10 @@ static int do_perfstat(int argc, const char **argv)
 		argv[0]);
 	fprintf(stderr, "\n");
 
-	for (counter = 0; counter < nr_counters; counter++) {
-		int cpu, nv;
-		__u64 count[3], single_count[3];
-		int scaled;
-
-		count[0] = count[1] = count[2] = 0;
-		nv = scale ? 3 : 1;
-		for (cpu = 0; cpu < nr_cpus; cpu ++) {
-			res = read(fd[cpu][counter],
-				   single_count, nv * sizeof(__u64));
-			assert(res == nv * sizeof(__u64));
-
-			count[0] += single_count[0];
-			if (scale) {
-				count[1] += single_count[1];
-				count[2] += single_count[2];
-			}
-		}
-
-		scaled = 0;
-		if (scale) {
-			if (count[2] == 0) {
-				fprintf(stderr, " %14s  %-20s\n",
-					"<not counted>", event_name(counter));
-				continue;
-			}
-			if (count[2] < count[1]) {
-				scaled = 1;
-				count[0] = (unsigned long long)
-					((double)count[0] * count[1] / count[2] + 0.5);
-			}
-		}
-
-		if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK) ||
-		    event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK)) {
+	for (counter = 0; counter < nr_counters; counter++)
+		print_counter(counter);
 
-			double msecs = (double)count[0] / 1000000;
 
-			fprintf(stderr, " %14.6f  %-20s (msecs)",
-				msecs, event_name(counter));
-		} else {
-			fprintf(stderr, " %14Ld  %-20s (events)",
-				count[0], event_name(counter));
-		}
-		if (scaled)
-			fprintf(stderr, "  (scaled from %.2f%%)",
-				(double) count[2] / count[1] * 100);
-		fprintf(stderr, "\n");
-	}
 	fprintf(stderr, "\n");
 	fprintf(stderr, " Wall-clock time elapsed: %12.6f msecs\n",
 			(double)(t1-t0)/1e6);
@@ -212,7 +231,6 @@ static void skip_signal(int signo)
 
 static const char * const stat_usage[] = {
 	"perf stat [<options>] <command>",
-	"perf stat [<options>] -- <command> [<options>]",
 	NULL
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Split display into reading and printing
       [not found]             ` <new-submission>
                                 ` (77 preceding siblings ...)
  2009-05-29  9:00               ` [tip:perfcounters/core] perf_counter tools: Clean up builtin-stat.c's do_perfstat() tip-bot for Ingo Molnar
@ 2009-05-29  9:00               ` tip-bot for Ingo Molnar
  2009-05-29  9:01               ` [tip:perfcounters/core] perf_counter tools: Also display time-normalized stat results tip-bot for Ingo Molnar
                                 ` (628 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-29  9:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  2996f5ddb7ba8889caeeac65edafe48845106eaa
Gitweb:     http://git.kernel.org/tip/2996f5ddb7ba8889caeeac65edafe48845106eaa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 09:10:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 09:21:49 +0200

perf_counter tools: Split display into reading and printing

We introduce the extra pass to allow the print-out to possibly
rely on already read counters.

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |   40 ++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 6a29361..0c92eb7 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -71,6 +71,9 @@ static const unsigned int default_count[] = {
 	  10000,
 };
 
+static __u64			event_res[MAX_COUNTERS][3];
+static __u64			event_scaled[MAX_COUNTERS];
+
 static void create_perfstat_counter(int counter)
 {
 	struct perf_counter_hw_event hw_event;
@@ -123,16 +126,19 @@ static inline int nsec_counter(int counter)
 }
 
 /*
- * Print out the results of a single counter:
+ * Read out the results of a single counter:
  */
-static void print_counter(int counter)
+static void read_counter(int counter)
 {
-	__u64 count[3], single_count[3];
+	__u64 *count, single_count[3];
 	ssize_t res;
 	int cpu, nv;
 	int scaled;
 
+	count = event_res[counter];
+
 	count[0] = count[1] = count[2] = 0;
+
 	nv = scale ? 3 : 1;
 	for (cpu = 0; cpu < nr_cpus; cpu ++) {
 		res = read(fd[cpu][counter], single_count, nv * sizeof(__u64));
@@ -148,16 +154,35 @@ static void print_counter(int counter)
 	scaled = 0;
 	if (scale) {
 		if (count[2] == 0) {
-			fprintf(stderr, " %14s  %-20s\n",
-				"<not counted>", event_name(counter));
+			event_scaled[counter] = -1;
+			count[0] = 0;
 			return;
 		}
+
 		if (count[2] < count[1]) {
-			scaled = 1;
+			event_scaled[counter] = 1;
 			count[0] = (unsigned long long)
 				((double)count[0] * count[1] / count[2] + 0.5);
 		}
 	}
+}
+
+/*
+ * Print out the results of a single counter:
+ */
+static void print_counter(int counter)
+{
+	__u64 *count;
+	int scaled;
+
+	count = event_res[counter];
+	scaled = event_scaled[counter];
+
+	if (scaled == -1) {
+		fprintf(stderr, " %14s  %-20s\n",
+			"<not counted>", event_name(counter));
+		return;
+	}
 
 	if (nsec_counter(counter)) {
 		double msecs = (double)count[0] / 1000000;
@@ -214,6 +239,9 @@ static int do_perfstat(int argc, const char **argv)
 	fprintf(stderr, "\n");
 
 	for (counter = 0; counter < nr_counters; counter++)
+		read_counter(counter);
+
+	for (counter = 0; counter < nr_counters; counter++)
 		print_counter(counter);
 
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Also display time-normalized stat results
       [not found]             ` <new-submission>
                                 ` (78 preceding siblings ...)
  2009-05-29  9:00               ` [tip:perfcounters/core] perf_counter tools: Split display into reading and printing tip-bot for Ingo Molnar
@ 2009-05-29  9:01               ` tip-bot for Ingo Molnar
  2009-05-29 12:27               ` [tip:perfcounters/core] perf_counter: Fix cpuctx->task_ctx races tip-bot for Ingo Molnar
                                 ` (627 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-29  9:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  be1ac0d81d0e3ab655f8c8ade31fb860ef6aa186
Gitweb:     http://git.kernel.org/tip/be1ac0d81d0e3ab655f8c8ade31fb860ef6aa186
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 09:10:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 09:46:45 +0200

perf_counter tools: Also display time-normalized stat results

Add new column that normalizes counter results by
'nanoseconds spent running' unit.

Before:

 Performance counter stats for '/home/mingo/hackbench':

   10469.403605  task clock ticks     (msecs)
          75502  context switches     (events)
           9501  CPU migrations       (events)
          36158  pagefaults           (events)
    31975676185  CPU cycles           (events)
    26257738659  instructions         (events)
      108740581  cache references     (events)
       54606088  cache misses         (events)

 Wall-clock time elapsed:   810.514504 msecs

After:

 Performance counter stats for '/home/mingo/hackbench':

   10469.403605  task clock ticks     (msecs)
          75502  context switches     #        0.007 M/sec
           9501  CPU migrations       #        0.001 M/sec
          36158  pagefaults           #        0.003 M/sec
    31975676185  CPU cycles           #     3054.202 M/sec
    26257738659  instructions         #     2508.045 M/sec
      108740581  cache references     #       10.387 M/sec
       54606088  cache misses         #        5.216 M/sec

 Wall-clock time elapsed:   810.514504 msecs

The advantage of that column is that it is characteristic of the
execution workflow, regardless of runtime. Hence 'hackbench 10'
will look similar to 'hackbench 15' - while the absolute counter
values are very different.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 0c92eb7..ef7e0e1 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -74,6 +74,8 @@ static const unsigned int default_count[] = {
 static __u64			event_res[MAX_COUNTERS][3];
 static __u64			event_scaled[MAX_COUNTERS];
 
+static __u64			runtime_nsecs;
+
 static void create_perfstat_counter(int counter)
 {
 	struct perf_counter_hw_event hw_event;
@@ -165,6 +167,11 @@ static void read_counter(int counter)
 				((double)count[0] * count[1] / count[2] + 0.5);
 		}
 	}
+	/*
+	 * Save the full runtime - to allow normalization during printout:
+	 */
+	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK))
+		runtime_nsecs = count[0];
 }
 
 /*
@@ -190,8 +197,11 @@ static void print_counter(int counter)
 		fprintf(stderr, " %14.6f  %-20s (msecs)",
 			msecs, event_name(counter));
 	} else {
-		fprintf(stderr, " %14Ld  %-20s (events)",
+		fprintf(stderr, " %14Ld  %-20s",
 			count[0], event_name(counter));
+		if (runtime_nsecs)
+			fprintf(stderr, " # %12.3f M/sec",
+				(double)count[0]/runtime_nsecs*1000.0);
 	}
 	if (scaled)
 		fprintf(stderr, "  (scaled from %.2f%%)",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf stat: handle Ctrl-C
  2009-05-28 12:19                   ` Peter Zijlstra
@ 2009-05-29  9:06                     ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-05-29  9:06 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Paul Mackerras, mingo, hpa, acme, linux-kernel, tglx, cjashfor,
	linux-tip-commits


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Thu, 2009-05-28 at 21:09 +1000, Paul Mackerras wrote:
> > tip-bot for Ingo Molnar writes:
> > 
> > > perf stat: handle Ctrl-C
> > > 
> > > Before this change, if a long-running perf stat workload was Ctrl-C-ed,
> > > the utility exited without displaying statistics.
> > > 
> > > After the change, the Ctrl-C gets propagated into the workload (and
> > > causes its early exit there), but perf stat itself will still continue
> > > to run and will display counter results.
> > > 
> > > This is useful to run open-ended workloads, let them run for
> > > a while, then Ctrl-C them to get the stats.
> > 
> > Unfortunately it means that if you do e.g.
> > 
> > $ while true; do perf stat something; done
> > 
> > it's impossible to kill the loop with ctrl-C.  To fix this we need to
> > make perf stat kill itself with the signal after printing the results,
> > so bash sees the died-due-to-signal exit status and stops the loop.
> 
> Yep, just ran into the same..
> 
> ^Z kill $! worked though, but that's not ideal.

would be nice to have a fix for this - i suspect people will run 
into this frequently.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix cpuctx->task_ctx races
       [not found]             ` <new-submission>
                                 ` (79 preceding siblings ...)
  2009-05-29  9:01               ` [tip:perfcounters/core] perf_counter tools: Also display time-normalized stat results tip-bot for Ingo Molnar
@ 2009-05-29 12:27               ` tip-bot for Ingo Molnar
  2009-05-29 12:27               ` [tip:perfcounters/core] perf_counter: Robustify counter-free logic tip-bot for Ingo Molnar
                                 ` (626 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-29 12:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  3f4dee227348daac32f36daad9a91059efd0723e
Gitweb:     http://git.kernel.org/tip/3f4dee227348daac32f36daad9a91059efd0723e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 11:25:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 14:28:36 +0200

perf_counter: Fix cpuctx->task_ctx races

Peter noticed that we are sometimes reading cpuctx->task_ctx with
interrupts enabled.

Noticed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index db843f8..eb34604 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -234,15 +234,18 @@ static void __perf_counter_remove_from_context(void *info)
 	struct perf_counter_context *ctx = counter->ctx;
 	unsigned long flags;
 
+	local_irq_save(flags);
 	/*
 	 * If this is a task context, we need to check whether it is
 	 * the current task context of this cpu. If not it has been
 	 * scheduled out before the smp call arrived.
 	 */
-	if (ctx->task && cpuctx->task_ctx != ctx)
+	if (ctx->task && cpuctx->task_ctx != ctx) {
+		local_irq_restore(flags);
 		return;
+	}
 
-	spin_lock_irqsave(&ctx->lock, flags);
+	spin_lock(&ctx->lock);
 	/*
 	 * Protect the list operation against NMI by disabling the
 	 * counters on a global level.
@@ -382,14 +385,17 @@ static void __perf_counter_disable(void *info)
 	struct perf_counter_context *ctx = counter->ctx;
 	unsigned long flags;
 
+	local_irq_save(flags);
 	/*
 	 * If this is a per-task counter, need to check whether this
 	 * counter's task is the current task on this cpu.
 	 */
-	if (ctx->task && cpuctx->task_ctx != ctx)
+	if (ctx->task && cpuctx->task_ctx != ctx) {
+		local_irq_restore(flags);
 		return;
+	}
 
-	spin_lock_irqsave(&ctx->lock, flags);
+	spin_lock(&ctx->lock);
 
 	/*
 	 * If the counter is on, turn it off.
@@ -615,6 +621,7 @@ static void __perf_install_in_context(void *info)
 	unsigned long flags;
 	int err;
 
+	local_irq_save(flags);
 	/*
 	 * If this is a task context, we need to check whether it is
 	 * the current task context of this cpu. If not it has been
@@ -623,12 +630,14 @@ static void __perf_install_in_context(void *info)
 	 * on this cpu because it had no counters.
 	 */
 	if (ctx->task && cpuctx->task_ctx != ctx) {
-		if (cpuctx->task_ctx || ctx->task != current)
+		if (cpuctx->task_ctx || ctx->task != current) {
+			local_irq_restore(flags);
 			return;
+		}
 		cpuctx->task_ctx = ctx;
 	}
 
-	spin_lock_irqsave(&ctx->lock, flags);
+	spin_lock(&ctx->lock);
 	ctx->is_active = 1;
 	update_context_time(ctx);
 
@@ -745,17 +754,20 @@ static void __perf_counter_enable(void *info)
 	unsigned long flags;
 	int err;
 
+	local_irq_save(flags);
 	/*
 	 * If this is a per-task counter, need to check whether this
 	 * counter's task is the current task on this cpu.
 	 */
 	if (ctx->task && cpuctx->task_ctx != ctx) {
-		if (cpuctx->task_ctx || ctx->task != current)
+		if (cpuctx->task_ctx || ctx->task != current) {
+			local_irq_restore(flags);
 			return;
+		}
 		cpuctx->task_ctx = ctx;
 	}
 
-	spin_lock_irqsave(&ctx->lock, flags);
+	spin_lock(&ctx->lock);
 	ctx->is_active = 1;
 	update_context_time(ctx);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Robustify counter-free logic
       [not found]             ` <new-submission>
                                 ` (80 preceding siblings ...)
  2009-05-29 12:27               ` [tip:perfcounters/core] perf_counter: Fix cpuctx->task_ctx races tip-bot for Ingo Molnar
@ 2009-05-29 12:27               ` tip-bot for Ingo Molnar
  2009-05-29 17:15               ` [tip:sched/core] ftrace: fix typo about map of kernel priority in ftrace.txt file tip-bot for GeunSik Lim
                                 ` (625 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-29 12:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  012b84dae17126d8b5d159173091eb3db5a2bc43
Gitweb:     http://git.kernel.org/tip/012b84dae17126d8b5d159173091eb3db5a2bc43
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 17 May 2009 11:08:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 14:28:37 +0200

perf_counter: Robustify counter-free logic

This fixes a nasty crash and highlights a bug that we were
freeing failed-fork() counters incorrectly.

(the fix for that will come separately)

[ Impact: fix crashes/lockups with inherited counters ]

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index eb34604..616c524 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1004,6 +1004,10 @@ static void __perf_counter_task_sched_out(struct perf_counter_context *ctx)
 
 	if (!cpuctx->task_ctx)
 		return;
+
+	if (WARN_ON_ONCE(ctx != cpuctx->task_ctx))
+		return;
+
 	__perf_counter_sched_out(ctx, cpuctx);
 	cpuctx->task_ctx = NULL;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:sched/core] ftrace: fix typo about map of kernel priority in ftrace.txt file.
       [not found]             ` <new-submission>
                                 ` (81 preceding siblings ...)
  2009-05-29 12:27               ` [tip:perfcounters/core] perf_counter: Robustify counter-free logic tip-bot for Ingo Molnar
@ 2009-05-29 17:15               ` tip-bot for GeunSik Lim
  2009-05-29 17:15               ` [tip:sched/core] sched: fix typo in sched-rt-group.txt file tip-bot for GeunSik Lim
                                 ` (624 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for GeunSik Lim @ 2009-05-29 17:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, geunsik.lim, leemgs1,
	rostedt, tglx, mingo

Commit-ID:  294ae4011530d008c59c4fb9847738e39228821e
Gitweb:     http://git.kernel.org/tip/294ae4011530d008c59c4fb9847738e39228821e
Author:     GeunSik Lim <leemgs1@gmail.com>
AuthorDate: Thu, 28 May 2009 10:36:11 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 16:21:08 +0200

ftrace: fix typo about map of kernel priority in ftrace.txt file.

Fix typo about chart to map the kernel priority to user land priorities.

   * About sched_setscheduler(2)
      Processes scheduled under SCHED_FIFO or SCHED_RR
      can have a (user-space) static priority in the range 1 to 99.
      (reference: http://www.kernel.org/doc/man-pages/online/pages/
                  man2/sched_setscheduler.2.html)

   * From: Steven Rostedt
      0 to 98 - maps to RT tasks 99 to 1 (SCHED_RR or SCHED_FIFO)

      99 - maps to internal kernel threads that want to be lower than RT tasks
      but higher than SCHED_OTHER tasks. Although I'm not sure if any
      kernel thread actually uses this. I'm not even sure how this can be
      set, because the internal sched_setscheduler function does not allow
      for it.

      100 to 139 - maps nice levels -20 to 19. These are not set via
      sched_setscheduler, but are set via the nice system call.

      140 - reserved for idle tasks.

Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/trace/ftrace.txt |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index fd9a3e6..e362f50 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -518,9 +518,18 @@ priority with zero (0) being the highest priority and the nice
 values starting at 100 (nice -20). Below is a quick chart to map
 the kernel priority to user land priorities.
 
-  Kernel priority: 0 to 99    ==> user RT priority 99 to 0
-  Kernel priority: 100 to 139 ==> user nice -20 to 19
-  Kernel priority: 140        ==> idle task priority
+   Kernel Space                     User Space
+ ===============================================================
+   0(high) to  98(low)     user RT priority 99(high) to 1(low)
+                           with SCHED_RR or SCHED_FIFO
+ ---------------------------------------------------------------
+  99                       sched_priority is not used in scheduling
+                           decisions(it must be specified as 0)
+ ---------------------------------------------------------------
+ 100(high) to 139(low)     user nice -20(high) to 19(low)
+ ---------------------------------------------------------------
+ 140                       idle task priority
+ ---------------------------------------------------------------
 
 The task states are:
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:sched/core] sched: fix typo in sched-rt-group.txt file
       [not found]             ` <new-submission>
                                 ` (82 preceding siblings ...)
  2009-05-29 17:15               ` [tip:sched/core] ftrace: fix typo about map of kernel priority in ftrace.txt file tip-bot for GeunSik Lim
@ 2009-05-29 17:15               ` tip-bot for GeunSik Lim
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters tip-bot for Peter Zijlstra
                                 ` (623 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for GeunSik Lim @ 2009-05-29 17:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, geunsik.lim, leemgs1,
	rostedt, tglx, mingo

Commit-ID:  f04d82b7e0c63d0251f9952a537a4bc4d73aa1a9
Gitweb:     http://git.kernel.org/tip/f04d82b7e0c63d0251f9952a537a4bc4d73aa1a9
Author:     GeunSik Lim <leemgs1@gmail.com>
AuthorDate: Thu, 28 May 2009 10:36:14 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 16:21:09 +0200

sched: fix typo in sched-rt-group.txt file

Fix typo about static priority's range.

    Kernel Space                     User Space
    ===============================================================
      0(high) to  98(low)     user RT priority 99(high) to 1(low)
                              with SCHED_RR or SCHED_FIFO
    ---------------------------------------------------------------
     99                       sched_priority is not used in scheduling
                              decisions(it must be specified as 0)
    ---------------------------------------------------------------
    100(high) to 139(low)     user nice -20(high) to 19(low)
    ---------------------------------------------------------------
    140                       idle task priority
    ---------------------------------------------------------------
    * ref) http://www.kernel.org/doc/man-pages/online/pages/man2/sched_setscheduler.2.html

Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com>
CC: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/scheduler/sched-rt-group.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/scheduler/sched-rt-group.txt b/Documentation/scheduler/sched-rt-group.txt
index eb74b01..1df7f9c 100644
--- a/Documentation/scheduler/sched-rt-group.txt
+++ b/Documentation/scheduler/sched-rt-group.txt
@@ -187,7 +187,7 @@ get their allocated time.
 
 Implementing SCHED_EDF might take a while to complete. Priority Inheritance is
 the biggest challenge as the current linux PI infrastructure is geared towards
-the limited static priority levels 0-139. With deadline scheduling you need to
+the limited static priority levels 0-99. With deadline scheduling you need to
 do deadline inheritance (since priority is inversely proportional to the
 deadline delta (deadline - now).
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters
       [not found]             ` <new-submission>
                                 ` (83 preceding siblings ...)
  2009-05-29 17:15               ` [tip:sched/core] sched: fix typo in sched-rt-group.txt file tip-bot for GeunSik Lim
@ 2009-05-29 17:16               ` tip-bot for Peter Zijlstra
  2009-05-30  0:15                 ` GeunSik Lim
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Clean up task_ctx vs interrupts tip-bot for Peter Zijlstra
                                 ` (622 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-29 17:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  efb3d17240d80e27508d238809168120fe4b93a4
Gitweb:     http://git.kernel.org/tip/efb3d17240d80e27508d238809168120fe4b93a4
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 29 May 2009 14:25:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 16:21:51 +0200

perf_counter: Fix COMM and MMAP events for cpu wide counters

Commit a63eaf34ae6 ("perf_counter: Dynamically allocate tasks'
perf_counter_context struct") broke COMM and MMAP notification for
cpu wide counters by dropping out early if there was no task context,
thereby also not iterating the cpu context.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 616c524..58d6d19 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2443,9 +2443,9 @@ static void perf_counter_comm_event(struct perf_comm_event *comm_event)
 
 	cpuctx = &get_cpu_var(perf_cpu_context);
 	perf_counter_comm_ctx(&cpuctx->ctx, comm_event);
+	if (cpuctx->task_ctx)
+		perf_counter_comm_ctx(cpuctx->task_ctx, comm_event);
 	put_cpu_var(perf_cpu_context);
-
-	perf_counter_comm_ctx(current->perf_counter_ctxp, comm_event);
 }
 
 void perf_counter_comm(struct task_struct *task)
@@ -2454,8 +2454,6 @@ void perf_counter_comm(struct task_struct *task)
 
 	if (!atomic_read(&nr_comm_tracking))
 		return;
-	if (!current->perf_counter_ctxp)
-		return;
 
 	comm_event = (struct perf_comm_event){
 		.task	= task,
@@ -2570,10 +2568,10 @@ got_name:
 
 	cpuctx = &get_cpu_var(perf_cpu_context);
 	perf_counter_mmap_ctx(&cpuctx->ctx, mmap_event);
+	if (cpuctx->task_ctx)
+		perf_counter_mmap_ctx(cpuctx->task_ctx, mmap_event);
 	put_cpu_var(perf_cpu_context);
 
-	perf_counter_mmap_ctx(current->perf_counter_ctxp, mmap_event);
-
 	kfree(buf);
 }
 
@@ -2584,8 +2582,6 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
 
 	if (!atomic_read(&nr_mmap_tracking))
 		return;
-	if (!current->perf_counter_ctxp)
-		return;
 
 	mmap_event = (struct perf_mmap_event){
 		.file   = file,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Clean up task_ctx vs interrupts
       [not found]             ` <new-submission>
                                 ` (84 preceding siblings ...)
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters tip-bot for Peter Zijlstra
@ 2009-05-29 17:16               ` tip-bot for Peter Zijlstra
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Ammend cleanup in fork() fail tip-bot for Peter Zijlstra
                                 ` (621 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-29 17:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  665c2142a94202881a3c11cbaee6506cb10ada2d
Gitweb:     http://git.kernel.org/tip/665c2142a94202881a3c11cbaee6506cb10ada2d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 29 May 2009 14:51:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 16:21:51 +0200

perf_counter: Clean up task_ctx vs interrupts

Remove the local_irq_save() etc.. in routines that are smp function
calls, or have IRQs disabled by other means.

Then change the COMM, MMAP, and swcounter context iteration to
current->perf_counter_ctxp and RCU, since it really doesn't matter
which context they iterate, they're all folded.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   82 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 50 insertions(+), 32 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 58d6d19..0c000d3 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -232,18 +232,14 @@ static void __perf_counter_remove_from_context(void *info)
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_counter *counter = info;
 	struct perf_counter_context *ctx = counter->ctx;
-	unsigned long flags;
 
-	local_irq_save(flags);
 	/*
 	 * If this is a task context, we need to check whether it is
 	 * the current task context of this cpu. If not it has been
 	 * scheduled out before the smp call arrived.
 	 */
-	if (ctx->task && cpuctx->task_ctx != ctx) {
-		local_irq_restore(flags);
+	if (ctx->task && cpuctx->task_ctx != ctx)
 		return;
-	}
 
 	spin_lock(&ctx->lock);
 	/*
@@ -267,7 +263,7 @@ static void __perf_counter_remove_from_context(void *info)
 	}
 
 	perf_enable();
-	spin_unlock_irqrestore(&ctx->lock, flags);
+	spin_unlock(&ctx->lock);
 }
 
 
@@ -383,17 +379,13 @@ static void __perf_counter_disable(void *info)
 	struct perf_counter *counter = info;
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_counter_context *ctx = counter->ctx;
-	unsigned long flags;
 
-	local_irq_save(flags);
 	/*
 	 * If this is a per-task counter, need to check whether this
 	 * counter's task is the current task on this cpu.
 	 */
-	if (ctx->task && cpuctx->task_ctx != ctx) {
-		local_irq_restore(flags);
+	if (ctx->task && cpuctx->task_ctx != ctx)
 		return;
-	}
 
 	spin_lock(&ctx->lock);
 
@@ -411,7 +403,7 @@ static void __perf_counter_disable(void *info)
 		counter->state = PERF_COUNTER_STATE_OFF;
 	}
 
-	spin_unlock_irqrestore(&ctx->lock, flags);
+	spin_unlock(&ctx->lock);
 }
 
 /*
@@ -618,10 +610,8 @@ static void __perf_install_in_context(void *info)
 	struct perf_counter_context *ctx = counter->ctx;
 	struct perf_counter *leader = counter->group_leader;
 	int cpu = smp_processor_id();
-	unsigned long flags;
 	int err;
 
-	local_irq_save(flags);
 	/*
 	 * If this is a task context, we need to check whether it is
 	 * the current task context of this cpu. If not it has been
@@ -630,10 +620,8 @@ static void __perf_install_in_context(void *info)
 	 * on this cpu because it had no counters.
 	 */
 	if (ctx->task && cpuctx->task_ctx != ctx) {
-		if (cpuctx->task_ctx || ctx->task != current) {
-			local_irq_restore(flags);
+		if (cpuctx->task_ctx || ctx->task != current)
 			return;
-		}
 		cpuctx->task_ctx = ctx;
 	}
 
@@ -687,7 +675,7 @@ static void __perf_install_in_context(void *info)
  unlock:
 	perf_enable();
 
-	spin_unlock_irqrestore(&ctx->lock, flags);
+	spin_unlock(&ctx->lock);
 }
 
 /*
@@ -751,19 +739,15 @@ static void __perf_counter_enable(void *info)
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_counter_context *ctx = counter->ctx;
 	struct perf_counter *leader = counter->group_leader;
-	unsigned long flags;
 	int err;
 
-	local_irq_save(flags);
 	/*
 	 * If this is a per-task counter, need to check whether this
 	 * counter's task is the current task on this cpu.
 	 */
 	if (ctx->task && cpuctx->task_ctx != ctx) {
-		if (cpuctx->task_ctx || ctx->task != current) {
-			local_irq_restore(flags);
+		if (cpuctx->task_ctx || ctx->task != current)
 			return;
-		}
 		cpuctx->task_ctx = ctx;
 	}
 
@@ -811,7 +795,7 @@ static void __perf_counter_enable(void *info)
 	}
 
  unlock:
-	spin_unlock_irqrestore(&ctx->lock, flags);
+	spin_unlock(&ctx->lock);
 }
 
 /*
@@ -981,6 +965,10 @@ void perf_counter_task_sched_out(struct task_struct *task,
 		spin_lock(&ctx->lock);
 		spin_lock_nested(&next_ctx->lock, SINGLE_DEPTH_NESTING);
 		if (context_equiv(ctx, next_ctx)) {
+			/*
+			 * XXX do we need a memory barrier of sorts
+			 * wrt to rcu_dereference() of perf_counter_ctxp
+			 */
 			task->perf_counter_ctxp = next_ctx;
 			next->perf_counter_ctxp = ctx;
 			ctx->task = next;
@@ -998,6 +986,9 @@ void perf_counter_task_sched_out(struct task_struct *task,
 	}
 }
 
+/*
+ * Called with IRQs disabled
+ */
 static void __perf_counter_task_sched_out(struct perf_counter_context *ctx)
 {
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
@@ -1012,6 +1003,9 @@ static void __perf_counter_task_sched_out(struct perf_counter_context *ctx)
 	cpuctx->task_ctx = NULL;
 }
 
+/*
+ * Called with IRQs disabled
+ */
 static void perf_counter_cpu_sched_out(struct perf_cpu_context *cpuctx)
 {
 	__perf_counter_sched_out(&cpuctx->ctx, cpuctx);
@@ -2431,6 +2425,7 @@ static void perf_counter_comm_ctx(struct perf_counter_context *ctx,
 static void perf_counter_comm_event(struct perf_comm_event *comm_event)
 {
 	struct perf_cpu_context *cpuctx;
+	struct perf_counter_context *ctx;
 	unsigned int size;
 	char *comm = comm_event->task->comm;
 
@@ -2443,9 +2438,17 @@ static void perf_counter_comm_event(struct perf_comm_event *comm_event)
 
 	cpuctx = &get_cpu_var(perf_cpu_context);
 	perf_counter_comm_ctx(&cpuctx->ctx, comm_event);
-	if (cpuctx->task_ctx)
-		perf_counter_comm_ctx(cpuctx->task_ctx, comm_event);
 	put_cpu_var(perf_cpu_context);
+
+	rcu_read_lock();
+	/*
+	 * doesn't really matter which of the child contexts the
+	 * events ends up in.
+	 */
+	ctx = rcu_dereference(current->perf_counter_ctxp);
+	if (ctx)
+		perf_counter_comm_ctx(ctx, comm_event);
+	rcu_read_unlock();
 }
 
 void perf_counter_comm(struct task_struct *task)
@@ -2536,6 +2539,7 @@ static void perf_counter_mmap_ctx(struct perf_counter_context *ctx,
 static void perf_counter_mmap_event(struct perf_mmap_event *mmap_event)
 {
 	struct perf_cpu_context *cpuctx;
+	struct perf_counter_context *ctx;
 	struct file *file = mmap_event->file;
 	unsigned int size;
 	char tmp[16];
@@ -2568,10 +2572,18 @@ got_name:
 
 	cpuctx = &get_cpu_var(perf_cpu_context);
 	perf_counter_mmap_ctx(&cpuctx->ctx, mmap_event);
-	if (cpuctx->task_ctx)
-		perf_counter_mmap_ctx(cpuctx->task_ctx, mmap_event);
 	put_cpu_var(perf_cpu_context);
 
+	rcu_read_lock();
+	/*
+	 * doesn't really matter which of the child contexts the
+	 * events ends up in.
+	 */
+	ctx = rcu_dereference(current->perf_counter_ctxp);
+	if (ctx)
+		perf_counter_mmap_ctx(ctx, mmap_event);
+	rcu_read_unlock();
+
 	kfree(buf);
 }
 
@@ -2882,6 +2894,7 @@ static void __perf_swcounter_event(enum perf_event_types type, u32 event,
 {
 	struct perf_cpu_context *cpuctx = &get_cpu_var(perf_cpu_context);
 	int *recursion = perf_swcounter_recursion_context(cpuctx);
+	struct perf_counter_context *ctx;
 
 	if (*recursion)
 		goto out;
@@ -2891,10 +2904,15 @@ static void __perf_swcounter_event(enum perf_event_types type, u32 event,
 
 	perf_swcounter_ctx_event(&cpuctx->ctx, type, event,
 				 nr, nmi, regs, addr);
-	if (cpuctx->task_ctx) {
-		perf_swcounter_ctx_event(cpuctx->task_ctx, type, event,
-					 nr, nmi, regs, addr);
-	}
+	rcu_read_lock();
+	/*
+	 * doesn't really matter which of the child contexts the
+	 * events ends up in.
+	 */
+	ctx = rcu_dereference(current->perf_counter_ctxp);
+	if (ctx)
+		perf_swcounter_ctx_event(ctx, type, event, nr, nmi, regs, addr);
+	rcu_read_unlock();
 
 	barrier();
 	(*recursion)--;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Ammend cleanup in fork() fail
       [not found]             ` <new-submission>
                                 ` (85 preceding siblings ...)
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Clean up task_ctx vs interrupts tip-bot for Peter Zijlstra
@ 2009-05-29 17:16               ` tip-bot for Peter Zijlstra
  2009-05-30 11:45               ` [tip:perfcounters/core] perf_counter tools: Print 'CPU utilization factor' in builtin-stat tip-bot for Ingo Molnar
                                 ` (620 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-05-29 17:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  bbbee90829304d156c12b171c0ac7e6e1aba8b90
Gitweb:     http://git.kernel.org/tip/bbbee90829304d156c12b171c0ac7e6e1aba8b90
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 29 May 2009 14:25:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 May 2009 16:21:52 +0200

perf_counter: Ammend cleanup in fork() fail

When fork() fails we cannot use perf_counter_exit_task() since that
assumes to operate on current. Write a new helper that cleans up
unused/clean contexts.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 +
 kernel/fork.c                |    2 +-
 kernel/perf_counter.c        |   43 +++++++++++++++++++++++++++++++++++++++--
 3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 717bf3b..519a41b 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -579,6 +579,7 @@ extern void perf_counter_task_sched_out(struct task_struct *task,
 extern void perf_counter_task_tick(struct task_struct *task, int cpu);
 extern int perf_counter_init_task(struct task_struct *child);
 extern void perf_counter_exit_task(struct task_struct *child);
+extern void perf_counter_free_task(struct task_struct *task);
 extern void perf_counter_do_pending(void);
 extern void perf_counter_print_debug(void);
 extern void __perf_disable(void);
@@ -644,6 +645,7 @@ static inline void
 perf_counter_task_tick(struct task_struct *task, int cpu)		{ }
 static inline int perf_counter_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_counter_exit_task(struct task_struct *child)	{ }
+static inline void perf_counter_free_task(struct task_struct *task)	{ }
 static inline void perf_counter_do_pending(void)			{ }
 static inline void perf_counter_print_debug(void)			{ }
 static inline void perf_disable(void)					{ }
diff --git a/kernel/fork.c b/kernel/fork.c
index c07c333..23bf757 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1298,7 +1298,7 @@ bad_fork_cleanup_semundo:
 bad_fork_cleanup_audit:
 	audit_free(p);
 bad_fork_cleanup_policy:
-	perf_counter_exit_task(p);
+	perf_counter_free_task(p);
 #ifdef CONFIG_NUMA
 	mpol_put(p->mempolicy);
 bad_fork_cleanup_cgroup:
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 0c000d3..79c3f26 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3538,8 +3538,7 @@ static void sync_child_counter(struct perf_counter *child_counter,
 }
 
 static void
-__perf_counter_exit_task(struct task_struct *child,
-			 struct perf_counter *child_counter,
+__perf_counter_exit_task(struct perf_counter *child_counter,
 			 struct perf_counter_context *child_ctx)
 {
 	struct perf_counter *parent_counter;
@@ -3605,7 +3604,7 @@ void perf_counter_exit_task(struct task_struct *child)
 again:
 	list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,
 				 list_entry)
-		__perf_counter_exit_task(child, child_counter, child_ctx);
+		__perf_counter_exit_task(child_counter, child_ctx);
 
 	/*
 	 * If the last counter was a group counter, it will have appended all
@@ -3621,6 +3620,44 @@ again:
 }
 
 /*
+ * free an unexposed, unused context as created by inheritance by
+ * init_task below, used by fork() in case of fail.
+ */
+void perf_counter_free_task(struct task_struct *task)
+{
+	struct perf_counter_context *ctx = task->perf_counter_ctxp;
+	struct perf_counter *counter, *tmp;
+
+	if (!ctx)
+		return;
+
+	mutex_lock(&ctx->mutex);
+again:
+	list_for_each_entry_safe(counter, tmp, &ctx->counter_list, list_entry) {
+		struct perf_counter *parent = counter->parent;
+
+		if (WARN_ON_ONCE(!parent))
+			continue;
+
+		mutex_lock(&parent->child_mutex);
+		list_del_init(&counter->child_list);
+		mutex_unlock(&parent->child_mutex);
+
+		fput(parent->filp);
+
+		list_del_counter(counter, ctx);
+		free_counter(counter);
+	}
+
+	if (!list_empty(&ctx->counter_list))
+		goto again;
+
+	mutex_unlock(&ctx->mutex);
+
+	put_ctx(ctx);
+}
+
+/*
  * Initialize the perf_counter context in task_struct
  */
 int perf_counter_init_task(struct task_struct *child)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events  for cpu wide counters
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters tip-bot for Peter Zijlstra
@ 2009-05-30  0:15                 ` GeunSik Lim
  2009-05-30  0:23                   ` Yinghai Lu
  0 siblings, 1 reply; 1149+ messages in thread
From: GeunSik Lim @ 2009-05-30  0:15 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo
  Cc: linux-tip-commits

> On Sat, May 30, 2009 at 2:16 AM, tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> Commit-ID:  efb3d17240d80e27508d238809168120fe4b93a4
> Gitweb:     http://git.kernel.org/tip/efb3d17240d80e27508d238809168120fe4b93a4

I have one question about "tip-bot" and "-tip" word.
"tip" word is abbreviation. Can anyone explain me meaning  of the "tip" word?
Sorry for trivial question.
But I always wondered about this abbreviation in private.


-- 
Regards,
GeunSik Lim ( SAMSUNG ELECTRONICS)
Blog : http://blog.naver.com/invain/
e-Mail: geunsik.lim@samsung.com
           leemgs@gmail.com , leemgs1@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters
  2009-05-30  0:15                 ` GeunSik Lim
@ 2009-05-30  0:23                   ` Yinghai Lu
  2009-05-30  9:40                     ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Yinghai Lu @ 2009-05-30  0:23 UTC (permalink / raw)
  To: GeunSik Lim
  Cc: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo, linux-tip-commits

GeunSik Lim wrote:
>> On Sat, May 30, 2009 at 2:16 AM, tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>> Commit-ID:  efb3d17240d80e27508d238809168120fe4b93a4
>> Gitweb:     http://git.kernel.org/tip/efb3d17240d80e27508d238809168120fe4b93a4
> 
> I have one question about "tip-bot" and "-tip" word.
> "tip" word is abbreviation. Can anyone explain me meaning  of the "tip" word?
> Sorry for trivial question.
> But I always wondered about this abbreviation in private.
> 
> 
T: Thomas
I: Ingo
P: hpa

YH

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events for cpu wide counters
  2009-05-30  0:23                   ` Yinghai Lu
@ 2009-05-30  9:40                     ` Ingo Molnar
  2009-05-30 11:27                       ` GeunSik Lim
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-05-30  9:40 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: GeunSik Lim, mingo, hpa, paulus, acme, linux-kernel, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, linux-tip-commits


* Yinghai Lu <yinghai@kernel.org> wrote:

> GeunSik Lim wrote:
> >> On Sat, May 30, 2009 at 2:16 AM, tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> >> Commit-ID:  efb3d17240d80e27508d238809168120fe4b93a4
> >> Gitweb:     http://git.kernel.org/tip/efb3d17240d80e27508d238809168120fe4b93a4
> > 
> > I have one question about "tip-bot" and "-tip" word.
> > "tip" word is abbreviation. Can anyone explain me meaning  of the "tip" word?
> > Sorry for trivial question.
> > But I always wondered about this abbreviation in private.

-tip is to signal the 'cutting edge/summit' of the trees we are 
maintaining and working on. "define:tip" on google gives:

tip:
  [...]
  peak: the top or extreme point of something (usually a mountain or 
  hill); "the view from the peak was magnificent"; "they clambered 
  to the tip of Monadnock"; "the region is a few molecules wide at 
  the summit"

> T: Thomas
> I: Ingo
> P: hpa

That secondary meaning is valid too ;-)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Fix COMM and MMAP events  for cpu wide counters
  2009-05-30  9:40                     ` Ingo Molnar
@ 2009-05-30 11:27                       ` GeunSik Lim
  0 siblings, 0 replies; 1149+ messages in thread
From: GeunSik Lim @ 2009-05-30 11:27 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Yinghai Lu, mingo, hpa, paulus, acme, linux-kernel, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, linux-tip-commits

On Sat, May 30, 2009 at 6:40 PM, Ingo Molnar <mingo@elte.hu> wrote:
> -tip is to signal the 'cutting edge/summit' of the trees we are
> maintaining and working on. "define:tip" on google gives:
>
> tip:
>  [...]
>  peak: the top or extreme point of something (usually a mountain or
>  hill); "the view from the peak was magnificent"; "they clambered
>  to the tip of Monadnock"; "the region is a few molecules wide at
>  the summit"
>
>> T: Thomas
>> I: Ingo
>> P: hpa
>
> That secondary meaning is valid too ;-)
>
>        Ingo
>
Thanks Yinghai and Ingo.
I'm so happy to hear about "-tip" meaning.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
--

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Print 'CPU utilization factor' in builtin-stat
       [not found]             ` <new-submission>
                                 ` (86 preceding siblings ...)
  2009-05-29 17:16               ` [tip:perfcounters/core] perf_counter: Ammend cleanup in fork() fail tip-bot for Peter Zijlstra
@ 2009-05-30 11:45               ` tip-bot for Ingo Molnar
  2009-05-30 11:51               ` [tip:perfcounters/core] perf_counter tools: Fix 'make install' tip-bot for Ingo Molnar
                                 ` (619 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-30 11:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  d7c29318c2daa96d64b7312afd8283488c1cb29f
Gitweb:     http://git.kernel.org/tip/d7c29318c2daa96d64b7312afd8283488c1cb29f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 30 May 2009 12:38:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 30 May 2009 12:41:12 +0200

perf_counter tools: Print 'CPU utilization factor' in builtin-stat

Before:

 Performance counter stats for '/home/mingo/hackbench':

    5728.862689  task clock ticks     (msecs)
          34426  context switches     #        0.006 M/sec
           3835  CPU migrations       #        0.001 M/sec
          18158  pagefaults           #        0.003 M/sec
    16218109156  CPU cycles           #     2830.947 M/sec
    13519616840  instructions         #     2359.913 M/sec
       55941661  cache references     #        9.765 M/sec
       23554938  cache misses         #        4.112 M/sec

 Wall-clock time elapsed:   528.886980 msecs

After:

 Performance counter stats for '/home/mingo/hackbench':

    5845.443541  task clock ticks     #      11.886 CPU utilization factor
          38289  context switches     #       0.007 M/sec
           4208  CPU migrations       #       0.001 M/sec
          17755  pagefaults           #       0.003 M/sec
    16664668576  CPU cycles           #    2850.882 M/sec
    13468113991  instructions         #    2304.036 M/sec
       57445468  cache references     #       9.827 M/sec
       26896502  cache misses         #       4.601 M/sec

 Wall-clock time elapsed:   491.802357 msecs

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index ef7e0e1..5886791 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -75,6 +75,7 @@ static __u64			event_res[MAX_COUNTERS][3];
 static __u64			event_scaled[MAX_COUNTERS];
 
 static __u64			runtime_nsecs;
+static __u64			walltime_nsecs;
 
 static void create_perfstat_counter(int counter)
 {
@@ -194,13 +195,19 @@ static void print_counter(int counter)
 	if (nsec_counter(counter)) {
 		double msecs = (double)count[0] / 1000000;
 
-		fprintf(stderr, " %14.6f  %-20s (msecs)",
+		fprintf(stderr, " %14.6f  %-20s",
 			msecs, event_name(counter));
+		if (event_id[counter] ==
+				EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK)) {
+
+			fprintf(stderr, " # %11.3f CPU utilization factor",
+				(double)count[0] / (double)walltime_nsecs);
+		}
 	} else {
 		fprintf(stderr, " %14Ld  %-20s",
 			count[0], event_name(counter));
 		if (runtime_nsecs)
-			fprintf(stderr, " # %12.3f M/sec",
+			fprintf(stderr, " # %11.3f M/sec",
 				(double)count[0]/runtime_nsecs*1000.0);
 	}
 	if (scaled)
@@ -241,6 +248,8 @@ static int do_perfstat(int argc, const char **argv)
 	prctl(PR_TASK_PERF_COUNTERS_DISABLE);
 	t1 = rdclock();
 
+	walltime_nsecs = t1 - t0;
+
 	fflush(stdout);
 
 	fprintf(stderr, "\n");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix 'make install'
       [not found]             ` <new-submission>
                                 ` (87 preceding siblings ...)
  2009-05-30 11:45               ` [tip:perfcounters/core] perf_counter tools: Print 'CPU utilization factor' in builtin-stat tip-bot for Ingo Molnar
@ 2009-05-30 11:51               ` tip-bot for Ingo Molnar
  2009-05-30 13:00               ` [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.) tip-bot for Ingo Molnar
                                 ` (618 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-30 11:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  7fbd55449aafb86d3237b5d1a26fb4dab2aa2c76
Gitweb:     http://git.kernel.org/tip/7fbd55449aafb86d3237b5d1a26fb4dab2aa2c76
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 30 May 2009 12:38:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 30 May 2009 12:45:29 +0200

perf_counter tools: Fix 'make install'

'make install' didnt install perf itself - which needs a special
rule to be copied to bindir.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index bd29a5c..8f72584 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -776,6 +776,7 @@ install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+	$(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)'
 ifneq (,$X)
 	$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';)
 endif

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
       [not found]             ` <new-submission>
                                 ` (88 preceding siblings ...)
  2009-05-30 11:51               ` [tip:perfcounters/core] perf_counter tools: Fix 'make install' tip-bot for Ingo Molnar
@ 2009-05-30 13:00               ` tip-bot for Ingo Molnar
  2009-05-30 13:46                 ` Sam Ravnborg
  2009-05-31 20:16               ` [tip:perfcounters/core] perf_counter tools: Fix unknown command help text tip-bot for Ingo Molnar
                                 ` (617 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-30 13:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  c1c2365acf8c044f749c0fe1ea236497e8d1718e
Gitweb:     http://git.kernel.org/tip/c1c2365acf8c044f749c0fe1ea236497e8d1718e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 30 May 2009 12:38:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 30 May 2009 13:52:44 +0200

perf_counter tools: Generate per command manpages (and pdf/html, etc.)

Import Git's nice .txt => {man/html/pdf} generation machinery.

Fix various errors in the Documentation/perf*.txt description as well.

Also fix a bug in builtin-help: we'd map 'perf help top' to 'perftop'
if only the 'perf' binary is in the default PATH - confusing the manpage
logic. I dont fully understand why Git did it this way - but i suppose
it's a migration artifact from their migration from standalone git-xyz
commands to 'git xyz' commands. The perf tools were always using the
modern form so it's not an issue there.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Documentation/Makefile  |  300 ++++++++++++++++++++
 .../perf_counter/Documentation/asciidoc.conf       |   91 ++++++
 .../perf_counter/Documentation/manpage-1.72.xsl    |   14 +
 .../perf_counter/Documentation/manpage-base.xsl    |   35 +++
 .../Documentation/manpage-bold-literal.xsl         |   17 ++
 .../perf_counter/Documentation/manpage-normal.xsl  |   13 +
 .../Documentation/manpage-suppress-sp.xsl          |   21 ++
 .../perf_counter/Documentation/perf-record.txt     |   10 +-
 .../perf_counter/Documentation/perf-report.txt     |    8 +-
 .../perf_counter/Documentation/perf-stat.txt       |    5 +-
 .../perf_counter/Documentation/perf-top.txt        |    8 +-
 Documentation/perf_counter/Documentation/perf.txt  |   23 ++
 Documentation/perf_counter/Makefile                |   61 ++++
 Documentation/perf_counter/builtin-help.c          |    2 +-
 14 files changed, 581 insertions(+), 27 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/Makefile b/Documentation/perf_counter/Documentation/Makefile
new file mode 100644
index 0000000..5457192
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/Makefile
@@ -0,0 +1,300 @@
+MAN1_TXT= \
+	$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
+		$(wildcard perf-*.txt)) \
+	perf.txt
+MAN5_TXT=
+MAN7_TXT=
+
+MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
+MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
+MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
+
+DOC_HTML=$(MAN_HTML)
+
+ARTICLES =
+# with their own formatting rules.
+SP_ARTICLES =
+API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
+SP_ARTICLES += $(API_DOCS)
+SP_ARTICLES += technical/api-index
+
+DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
+
+DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
+DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
+DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
+
+prefix?=$(HOME)
+bindir?=$(prefix)/bin
+htmldir?=$(prefix)/share/doc/perf-doc
+pdfdir?=$(prefix)/share/doc/perf-doc
+mandir?=$(prefix)/share/man
+man1dir=$(mandir)/man1
+man5dir=$(mandir)/man5
+man7dir=$(mandir)/man7
+# DESTDIR=
+
+ASCIIDOC=asciidoc
+ASCIIDOC_EXTRA =
+MANPAGE_XSL = manpage-normal.xsl
+XMLTO_EXTRA =
+INSTALL?=install
+RM ?= rm -f
+DOC_REF = origin/man
+HTML_REF = origin/html
+
+infodir?=$(prefix)/share/info
+MAKEINFO=makeinfo
+INSTALL_INFO=install-info
+DOCBOOK2X_TEXI=docbook2x-texi
+DBLATEX=dblatex
+ifndef PERL_PATH
+	PERL_PATH = /usr/bin/perl
+endif
+
+-include ../config.mak.autogen
+-include ../config.mak
+
+#
+# For asciidoc ...
+#	-7.1.2,	no extra settings are needed.
+#	8.0-,	set ASCIIDOC8.
+#
+
+#
+# For docbook-xsl ...
+#	-1.68.1,	set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
+#	1.69.0,		no extra settings are needed?
+#	1.69.1-1.71.0,	set DOCBOOK_SUPPRESS_SP?
+#	1.71.1,		no extra settings are needed?
+#	1.72.0,		set DOCBOOK_XSL_172.
+#	1.73.0-,	set ASCIIDOC_NO_ROFF
+#
+
+#
+# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
+# of 'the ".ft C" problem' in your generated manpages, and you
+# instead ended up with weird characters around callouts, try
+# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
+#
+
+ifdef ASCIIDOC8
+ASCIIDOC_EXTRA += -a asciidoc7compatible
+endif
+ifdef DOCBOOK_XSL_172
+ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
+MANPAGE_XSL = manpage-1.72.xsl
+else
+	ifdef ASCIIDOC_NO_ROFF
+	# docbook-xsl after 1.72 needs the regular XSL, but will not
+	# pass-thru raw roff codes from asciidoc.conf, so turn them off.
+	ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
+	endif
+endif
+ifdef MAN_BOLD_LITERAL
+XMLTO_EXTRA += -m manpage-bold-literal.xsl
+endif
+ifdef DOCBOOK_SUPPRESS_SP
+XMLTO_EXTRA += -m manpage-suppress-sp.xsl
+endif
+
+SHELL_PATH ?= $(SHELL)
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+#
+# Please note that there is a minor bug in asciidoc.
+# The version after 6.0.3 _will_ include the patch found here:
+#   http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2
+#
+# Until that version is released you may have to apply the patch
+# yourself - yes, all 6 characters of it!
+#
+
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_ASCIIDOC	= @echo '   ' ASCIIDOC $@;
+	QUIET_XMLTO	= @echo '   ' XMLTO $@;
+	QUIET_DB2TEXI	= @echo '   ' DB2TEXI $@;
+	QUIET_MAKEINFO	= @echo '   ' MAKEINFO $@;
+	QUIET_DBLATEX	= @echo '   ' DBLATEX $@;
+	QUIET_XSLTPROC	= @echo '   ' XSLTPROC $@;
+	QUIET_GEN	= @echo '   ' GEN $@;
+	QUIET_STDERR	= 2> /dev/null
+	QUIET_SUBDIR0	= +@subdir=
+	QUIET_SUBDIR1	= ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			  $(MAKE) $(PRINT_DIR) -C $$subdir
+	export V
+endif
+endif
+
+all: html man
+
+html: $(DOC_HTML)
+
+$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
+
+man: man1 man5 man7
+man1: $(DOC_MAN1)
+man5: $(DOC_MAN5)
+man7: $(DOC_MAN7)
+
+info: perf.info perfman.info
+
+pdf: user-manual.pdf
+
+install: install-man
+
+install-man: man
+	$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
+#	$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
+#	$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
+	$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
+#	$(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
+#	$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
+
+install-info: info
+	$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
+	$(INSTALL) -m 644 perf.info perfman.info $(DESTDIR)$(infodir)
+	if test -r $(DESTDIR)$(infodir)/dir; then \
+	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\
+	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\
+	else \
+	  echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
+	fi
+
+install-pdf: pdf
+	$(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
+	$(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
+
+install-html: html
+	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
+
+../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
+	$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE
+
+-include ../PERF-VERSION-FILE
+
+#
+# Determine "include::" file references in asciidoc files.
+#
+doc.dep : $(wildcard *.txt) build-docdep.perl
+	$(QUIET_GEN)$(RM) $@+ $@ && \
+	$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
+	mv $@+ $@
+
+-include doc.dep
+
+cmds_txt = cmds-ancillaryinterrogators.txt \
+	cmds-ancillarymanipulators.txt \
+	cmds-mainporcelain.txt \
+	cmds-plumbinginterrogators.txt \
+	cmds-plumbingmanipulators.txt \
+	cmds-synchingrepositories.txt \
+	cmds-synchelpers.txt \
+	cmds-purehelpers.txt \
+	cmds-foreignscminterface.txt
+
+$(cmds_txt): cmd-list.made
+
+cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
+	$(QUIET_GEN)$(RM) $@ && \
+	$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
+	date >$@
+
+clean:
+	$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
+	$(RM) *.texi *.texi+ *.texi++ perf.info perfman.info
+	$(RM) howto-index.txt howto/*.html doc.dep
+	$(RM) technical/api-*.html technical/api-index.txt
+	$(RM) $(cmds_txt) *.made
+
+$(MAN_HTML): %.html : %.txt
+	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+	$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
+		$(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
+	mv $@+ $@
+
+%.1 %.5 %.7 : %.xml
+	$(QUIET_XMLTO)$(RM) $@ && \
+	xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+
+%.xml : %.txt
+	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+	$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
+		$(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
+	mv $@+ $@
+
+XSLT = docbook.xsl
+XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
+
+user-manual.html: user-manual.xml
+	$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
+
+perf.info: user-manual.texi
+	$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
+
+user-manual.texi: user-manual.xml
+	$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
+	$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
+	$(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
+	rm $@++ && \
+	mv $@+ $@
+
+user-manual.pdf: user-manual.xml
+	$(QUIET_DBLATEX)$(RM) $@+ $@ && \
+	$(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
+	mv $@+ $@
+
+perfman.texi: $(MAN_XML) cat-texi.perl
+	$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
+	($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
+		--to-stdout $(xml) &&) true) > $@++ && \
+	$(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
+	rm $@++ && \
+	mv $@+ $@
+
+perfman.info: perfman.texi
+	$(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
+
+$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
+	$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
+	$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
+	mv $@+ $@
+
+howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
+	$(QUIET_GEN)$(RM) $@+ $@ && \
+	'$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
+	mv $@+ $@
+
+$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
+	$(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
+
+WEBDOC_DEST = /pub/software/tools/perf/docs
+
+$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
+	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+	sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
+	mv $@+ $@
+
+install-webdoc : html
+	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
+
+quick-install: quick-install-man
+
+quick-install-man:
+	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
+
+quick-install-html:
+	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
+
+.PHONY: .FORCE-PERF-VERSION-FILE
diff --git a/Documentation/perf_counter/Documentation/asciidoc.conf b/Documentation/perf_counter/Documentation/asciidoc.conf
new file mode 100644
index 0000000..356b23a
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/asciidoc.conf
@@ -0,0 +1,91 @@
+## linkperf: macro
+#
+# Usage: linkperf:command[manpage-section]
+#
+# Note, {0} is the manpage section, while {target} is the command.
+#
+# Show PERF link as: <command>(<section>); if section is defined, else just show
+# the command.
+
+[macros]
+(?su)[\\]?(?P<name>linkperf):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
+
+[attributes]
+asterisk=&#42;
+plus=&#43;
+caret=&#94;
+startsb=&#91;
+endsb=&#93;
+tilde=&#126;
+
+ifdef::backend-docbook[]
+[linkperf-inlinemacro]
+{0%{target}}
+{0#<citerefentry>}
+{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
+{0#</citerefentry>}
+endif::backend-docbook[]
+
+ifdef::backend-docbook[]
+ifndef::perf-asciidoc-no-roff[]
+# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this.
+# v1.72 breaks with this because it replaces dots not in roff requests.
+[listingblock]
+<example><title>{title}</title>
+<literallayout>
+ifdef::doctype-manpage[]
+&#10;.ft C&#10;
+endif::doctype-manpage[]
+|
+ifdef::doctype-manpage[]
+&#10;.ft&#10;
+endif::doctype-manpage[]
+</literallayout>
+{title#}</example>
+endif::perf-asciidoc-no-roff[]
+
+ifdef::perf-asciidoc-no-roff[]
+ifdef::doctype-manpage[]
+# The following two small workarounds insert a simple paragraph after screen
+[listingblock]
+<example><title>{title}</title>
+<literallayout>
+|
+</literallayout><simpara></simpara>
+{title#}</example>
+
+[verseblock]
+<formalpara{id? id="{id}"}><title>{title}</title><para>
+{title%}<literallayout{id? id="{id}"}>
+{title#}<literallayout>
+|
+</literallayout>
+{title#}</para></formalpara>
+{title%}<simpara></simpara>
+endif::doctype-manpage[]
+endif::perf-asciidoc-no-roff[]
+endif::backend-docbook[]
+
+ifdef::doctype-manpage[]
+ifdef::backend-docbook[]
+[header]
+template::[header-declarations]
+<refentry>
+<refmeta>
+<refentrytitle>{mantitle}</refentrytitle>
+<manvolnum>{manvolnum}</manvolnum>
+<refmiscinfo class="source">perf</refmiscinfo>
+<refmiscinfo class="version">{perf_version}</refmiscinfo>
+<refmiscinfo class="manual">perf Manual</refmiscinfo>
+</refmeta>
+<refnamediv>
+  <refname>{manname}</refname>
+  <refpurpose>{manpurpose}</refpurpose>
+</refnamediv>
+endif::backend-docbook[]
+endif::doctype-manpage[]
+
+ifdef::backend-xhtml11[]
+[linkperf-inlinemacro]
+<a href="{target}.html">{target}{0?({0})}</a>
+endif::backend-xhtml11[]
diff --git a/Documentation/perf_counter/Documentation/manpage-1.72.xsl b/Documentation/perf_counter/Documentation/manpage-1.72.xsl
new file mode 100644
index 0000000..b4d315c
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/manpage-1.72.xsl
@@ -0,0 +1,14 @@
+<!-- manpage-1.72.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles peculiarities in docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the special values for the roff control characters
+     needed for docbook-xsl 1.72.0 -->
+<xsl:param name="git.docbook.backslash">&#x2593;</xsl:param>
+<xsl:param name="git.docbook.dot"      >&#x2302;</xsl:param>
+
+</xsl:stylesheet>
diff --git a/Documentation/perf_counter/Documentation/manpage-base.xsl b/Documentation/perf_counter/Documentation/manpage-base.xsl
new file mode 100644
index 0000000..a264fa6
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/manpage-base.xsl
@@ -0,0 +1,35 @@
+<!-- manpage-base.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- these params silence some output from xmlto -->
+<xsl:param name="man.output.quietly" select="1"/>
+<xsl:param name="refentry.meta.get.quietly" select="1"/>
+
+<!-- convert asciidoc callouts to man page format;
+     git.docbook.backslash and git.docbook.dot params
+     must be supplied by another XSL file or other means -->
+<xsl:template match="co">
+	<xsl:value-of select="concat(
+			      $git.docbook.backslash,'fB(',
+			      substring-after(@id,'-'),')',
+			      $git.docbook.backslash,'fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+	<xsl:value-of select="$git.docbook.dot"/>
+	<xsl:text>sp&#10;</xsl:text>
+	<xsl:apply-templates/>
+	<xsl:text>&#10;</xsl:text>
+</xsl:template>
+<xsl:template match="callout">
+	<xsl:value-of select="concat(
+			      $git.docbook.backslash,'fB',
+			      substring-after(@arearefs,'-'),
+			      '. ',$git.docbook.backslash,'fR')"/>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$git.docbook.dot"/>
+	<xsl:text>br&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/Documentation/perf_counter/Documentation/manpage-bold-literal.xsl b/Documentation/perf_counter/Documentation/manpage-bold-literal.xsl
new file mode 100644
index 0000000..608eb5d
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/manpage-bold-literal.xsl
@@ -0,0 +1,17 @@
+<!-- manpage-bold-literal.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- render literal text as bold (instead of plain or monospace);
+     this makes literal text easier to distinguish in manpages
+     viewed on a tty -->
+<xsl:template match="literal">
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fB</xsl:text>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fR</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/Documentation/perf_counter/Documentation/manpage-normal.xsl b/Documentation/perf_counter/Documentation/manpage-normal.xsl
new file mode 100644
index 0000000..a48f5b1
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/manpage-normal.xsl
@@ -0,0 +1,13 @@
+<!-- manpage-normal.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles anything we want to keep away from docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the normal values for the roff control characters -->
+<xsl:param name="git.docbook.backslash">\</xsl:param>
+<xsl:param name="git.docbook.dot"	>.</xsl:param>
+
+</xsl:stylesheet>
diff --git a/Documentation/perf_counter/Documentation/manpage-suppress-sp.xsl b/Documentation/perf_counter/Documentation/manpage-suppress-sp.xsl
new file mode 100644
index 0000000..a63c763
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/manpage-suppress-sp.xsl
@@ -0,0 +1,21 @@
+<!-- manpage-suppress-sp.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles erroneous, inline .sp in manpage output of some
+     versions of docbook-xsl -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- attempt to work around spurious .sp at the tail of the line
+     that some versions of docbook stylesheets seem to add -->
+<xsl:template match="simpara">
+  <xsl:variable name="content">
+    <xsl:apply-templates/>
+  </xsl:variable>
+  <xsl:value-of select="normalize-space($content)"/>
+  <xsl:if test="not(ancestor::authorblurb) and
+                not(ancestor::personblurb)">
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/Documentation/perf_counter/Documentation/perf-record.txt
index a93d2ec..4d3416f 100644
--- a/Documentation/perf_counter/Documentation/perf-record.txt
+++ b/Documentation/perf_counter/Documentation/perf-record.txt
@@ -1,5 +1,5 @@
 perf-record(1)
-==========
+==============
 
 NAME
 ----
@@ -53,12 +53,6 @@ OPTIONS
 -l::
         scale counter values
 
-Configuration
--------------
-
-EXAMPLES
---------
-
 SEE ALSO
 --------
-linkperf:git-stat[1]
+linkperf:perf-stat[1]
diff --git a/Documentation/perf_counter/Documentation/perf-report.txt b/Documentation/perf_counter/Documentation/perf-report.txt
index 49efe16..52d3fc6 100644
--- a/Documentation/perf_counter/Documentation/perf-report.txt
+++ b/Documentation/perf_counter/Documentation/perf-report.txt
@@ -1,5 +1,5 @@
 perf-report(1)
-==========
+==============
 
 NAME
 ----
@@ -21,12 +21,6 @@ OPTIONS
 --input=::
         Input file name. (default: perf.data)
 
-Configuration
--------------
-
-EXAMPLES
---------
-
 SEE ALSO
 --------
 linkperf:perf-stat[1]
diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/Documentation/perf_counter/Documentation/perf-stat.txt
index 828c59f..a67d0e3 100644
--- a/Documentation/perf_counter/Documentation/perf-stat.txt
+++ b/Documentation/perf_counter/Documentation/perf-stat.txt
@@ -51,9 +51,6 @@ OPTIONS
 -l::
         scale counter values
 
-Configuration
--------------
-
 EXAMPLES
 --------
 
@@ -74,4 +71,4 @@ $ perf stat sleep 1
 
 SEE ALSO
 --------
-linkperf:git-tops[1]
+linkperf:perf-tops[1]
diff --git a/Documentation/perf_counter/Documentation/perf-top.txt b/Documentation/perf_counter/Documentation/perf-top.txt
index 057333b..15251e4 100644
--- a/Documentation/perf_counter/Documentation/perf-top.txt
+++ b/Documentation/perf_counter/Documentation/perf-top.txt
@@ -50,12 +50,6 @@ OPTIONS
 -l::
         scale counter values
 
-Configuration
--------------
-
-EXAMPLES
---------
-
 SEE ALSO
 --------
-linkperf:git-stat[1]
+linkperf:perf-stat[1]
diff --git a/Documentation/perf_counter/Documentation/perf.txt b/Documentation/perf_counter/Documentation/perf.txt
new file mode 100644
index 0000000..e3d8b38
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/perf.txt
@@ -0,0 +1,23 @@
+perf(1)
+=======
+
+NAME
+----
+perf - Performance analysis tools for Linux
+
+SYNOPSIS
+--------
+[verse]
+'perf' [--version] [--help] COMMAND [ARGS]
+
+DESCRIPTION
+-----------
+Performance counters for Linux are are a new kernel-based subsystem
+that provide a framework for all things performance analysis. It
+covers hardware level (CPU/PMU, Performance Monitoring Unit) features
+and software features (software counters, tracepoints) as well.
+
+SEE ALSO
+--------
+linkperf:perf-stat[1], linkperf:perf-top[1],
+linkperf:perf-record[1], linkperf:perf-report[1]
diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 8f72584..416ab11 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -693,6 +693,21 @@ builtin-revert.o wt-status.o: wt-status.h
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
 
+doc:
+	$(MAKE) -C Documentation all
+
+man:
+	$(MAKE) -C Documentation man
+
+html:
+	$(MAKE) -C Documentation html
+
+info:
+	$(MAKE) -C Documentation info
+
+pdf:
+	$(MAKE) -C Documentation pdf
+
 TAGS:
 	$(RM) TAGS
 	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
@@ -781,6 +796,31 @@ ifneq (,$X)
 	$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';)
 endif
 
+install-doc:
+	$(MAKE) -C Documentation install
+
+install-man:
+	$(MAKE) -C Documentation install-man
+
+install-html:
+	$(MAKE) -C Documentation install-html
+
+install-info:
+	$(MAKE) -C Documentation install-info
+
+install-pdf:
+	$(MAKE) -C Documentation install-pdf
+
+quick-install-doc:
+	$(MAKE) -C Documentation quick-install
+
+quick-install-man:
+	$(MAKE) -C Documentation quick-install-man
+
+quick-install-html:
+	$(MAKE) -C Documentation quick-install-html
+
+
 ### Maintainer's dist rules
 
 perf.spec: perf.spec.in
@@ -801,6 +841,26 @@ dist: perf.spec perf-archive$(X) configure
 	@$(RM) -r $(PERF_TARNAME)
 	gzip -f -9 $(PERF_TARNAME).tar
 
+htmldocs = perf-htmldocs-$(PERF_VERSION)
+manpages = perf-manpages-$(PERF_VERSION)
+dist-doc:
+	$(RM) -r .doc-tmp-dir
+	mkdir .doc-tmp-dir
+	$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
+	cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
+	gzip -n -9 -f $(htmldocs).tar
+	:
+	$(RM) -r .doc-tmp-dir
+	mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
+	$(MAKE) -C Documentation DESTDIR=./ \
+		man1dir=../.doc-tmp-dir/man1 \
+		man5dir=../.doc-tmp-dir/man5 \
+		man7dir=../.doc-tmp-dir/man7 \
+		install
+	cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
+	gzip -n -9 -f $(manpages).tar
+	$(RM) -r .doc-tmp-dir
+
 rpm: dist
 	$(RPMBUILD) -ta $(PERF_TARNAME).tar.gz
 
@@ -819,6 +879,7 @@ clean:
 	$(RM) -r $(PERF_TARNAME) .doc-tmp-dir
 	$(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz
 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
+	$(MAKE) -C Documentation/ clean
 	$(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS
 
 .PHONY: all install clean strip
diff --git a/Documentation/perf_counter/builtin-help.c b/Documentation/perf_counter/builtin-help.c
index d2bd317..a3894bf 100644
--- a/Documentation/perf_counter/builtin-help.c
+++ b/Documentation/perf_counter/builtin-help.c
@@ -317,7 +317,7 @@ static const char *cmd_to_page(const char *perf_cmd)
 	else if (is_perf_command(perf_cmd))
 		return prepend("perf-", perf_cmd);
 	else
-		return prepend("perf", perf_cmd);
+		return prepend("perf-", perf_cmd);
 }
 
 static void setup_man_path(void)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
  2009-05-30 13:00               ` [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.) tip-bot for Ingo Molnar
@ 2009-05-30 13:46                 ` Sam Ravnborg
  2009-05-30 14:47                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Sam Ravnborg @ 2009-05-30 13:46 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo
  Cc: linux-tip-commits

On Sat, May 30, 2009 at 01:00:33PM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  c1c2365acf8c044f749c0fe1ea236497e8d1718e
> Gitweb:     http://git.kernel.org/tip/c1c2365acf8c044f749c0fe1ea236497e8d1718e
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 30 May 2009 12:38:51 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 30 May 2009 13:52:44 +0200
> 
> perf_counter tools: Generate per command manpages (and pdf/html, etc.)
> 
> Import Git's nice .txt => {man/html/pdf} generation machinery.
> 
> Fix various errors in the Documentation/perf*.txt description as well.
> 
> Also fix a bug in builtin-help: we'd map 'perf help top' to 'perftop'
> if only the 'perf' binary is in the default PATH - confusing the manpage
> logic. I dont fully understand why Git did it this way - but i suppose
> it's a migration artifact from their migration from standalone git-xyz
> commands to 'git xyz' commands. The perf tools were always using the
> modern form so it's not an issue there.

Can we please have this patch split in at least a infrastructire and
a content part.
This makes it easier to review - and also makes it
much more clear what is needed to be added when adding new
documentation following this format.

I would also suggest to copy Randy Dunlap on patches
touching generic parts like this in Documentation.

I will try to review this when the splitup has heppend.

[I may have been copied on stuff earlier but I has been
and is almost off-line atm].

Thanks,
	Sam

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
  2009-05-30 13:46                 ` Sam Ravnborg
@ 2009-05-30 14:47                   ` Ingo Molnar
  2009-05-30 15:37                     ` Jaswinder Singh Rajput
  2009-05-30 16:38                     ` Sam Ravnborg
  0 siblings, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-05-30 14:47 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, linux-tip-commits


* Sam Ravnborg <sam@ravnborg.org> wrote:

> On Sat, May 30, 2009 at 01:00:33PM +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  c1c2365acf8c044f749c0fe1ea236497e8d1718e
> > Gitweb:     http://git.kernel.org/tip/c1c2365acf8c044f749c0fe1ea236497e8d1718e
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sat, 30 May 2009 12:38:51 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 30 May 2009 13:52:44 +0200
> > 
> > perf_counter tools: Generate per command manpages (and pdf/html, etc.)
> > 
> > Import Git's nice .txt => {man/html/pdf} generation machinery.
> > 
> > Fix various errors in the Documentation/perf*.txt description as well.
> > 
> > Also fix a bug in builtin-help: we'd map 'perf help top' to 'perftop'
> > if only the 'perf' binary is in the default PATH - confusing the manpage
> > logic. I dont fully understand why Git did it this way - but i suppose
> > it's a migration artifact from their migration from standalone git-xyz
> > commands to 'git xyz' commands. The perf tools were always using the
> > modern form so it's not an issue there.
> 
> Can we please have this patch split in at least a infrastructire 
> and a content part.

> This makes it easier to review - and also makes it much more clear 
> what is needed to be added when adding new documentation following 
> this format.

The .txt files were already present, so the patch is largely the 
infrastructure patch. The fixes to .txt files were minimal.

> I would also suggest to copy Randy Dunlap on patches touching 
> generic parts like this in Documentation.

Sure - if Randy shows interest in perfcounters bits i can Cc: him. 
Note, it isnt touching generic parts of Documentation/. It's 
touching the Documentation/perf_counter/ tools only.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
  2009-05-30 14:47                   ` Ingo Molnar
@ 2009-05-30 15:37                     ` Jaswinder Singh Rajput
  2009-05-30 16:38                     ` Sam Ravnborg
  1 sibling, 0 replies; 1149+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-30 15:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Sam Ravnborg, mingo, hpa, paulus, acme, linux-kernel, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, linux-tip-commits,
	Randy Dunlap

On Sat, 2009-05-30 at 16:47 +0200, Ingo Molnar wrote:
> * Sam Ravnborg <sam@ravnborg.org> wrote:
> 
> > On Sat, May 30, 2009 at 01:00:33PM +0000, tip-bot for Ingo Molnar wrote:
> > I would also suggest to copy Randy Dunlap on patches touching 
> > generic parts like this in Documentation.
> 
> Sure - if Randy shows interest in perfcounters bits i can Cc: him. 
> Note, it isnt touching generic parts of Documentation/. It's 
> touching the Documentation/perf_counter/ tools only.
> 

There is no question of interest. Sooner or later this will become part
of Documentation so CCing Randy is not a bad idea ;-)

Thanks,
--
JSR


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
  2009-05-30 14:47                   ` Ingo Molnar
  2009-05-30 15:37                     ` Jaswinder Singh Rajput
@ 2009-05-30 16:38                     ` Sam Ravnborg
  2009-05-30 17:23                       ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Sam Ravnborg @ 2009-05-30 16:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, linux-tip-commits

> > > 
> > > Import Git's nice .txt => {man/html/pdf} generation machinery.
> > > 
> 
> The .txt files were already present, so the patch is largely the 
> infrastructure patch. The fixes to .txt files were minimal.

We do not copy Git's .txt => {man/html/pdf} support only to
support perfcounters.
Either perfcounters use the infrastructure already present
or it establish a parallel infrastrucutre we can start
to migrate over to.

In an area where there is so little interest shown as in
documentation generation we do not want to have two different
ways to generate man pages, html etc.

IMO the ascii doc support from git is superior to what we have
today so I am all for replacing the current stuff.
But then we should do is properly and not as some perfconuter only stuff.

	Sam

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.)
  2009-05-30 16:38                     ` Sam Ravnborg
@ 2009-05-30 17:23                       ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-05-30 17:23 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: mingo, hpa, paulus, acme, linux-kernel, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, linux-tip-commits


* Sam Ravnborg <sam@ravnborg.org> wrote:

> > > > Import Git's nice .txt => {man/html/pdf} generation machinery.
> > 
> > The .txt files were already present, so the patch is largely the 
> > infrastructure patch. The fixes to .txt files were minimal.
> 
> We do not copy Git's .txt => {man/html/pdf} support only to 
> support perfcounters.
>
> Either perfcounters use the infrastructure already present or it 
> establish a parallel infrastrucutre we can start to migrate over 
> to.
> 
> In an area where there is so little interest shown as in 
> documentation generation we do not want to have two different ways 
> to generate man pages, html etc.
> 
> IMO the ascii doc support from git is superior to what we have 
> today so I am all for replacing the current stuff. But then we 
> should do is properly and not as some perfconuter only stuff.

I still think you are misunderstanding it. It is a user-space 
tool(-set) with its own needs to install manpages and other 
documentation. Look at the code.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix unknown command help text
       [not found]             ` <new-submission>
                                 ` (89 preceding siblings ...)
  2009-05-30 13:00               ` [tip:perfcounters/core] perf_counter tools: Generate per command manpages (and pdf/html, etc.) tip-bot for Ingo Molnar
@ 2009-05-31 20:16               ` tip-bot for Ingo Molnar
  2009-06-01  8:19               ` [tip:perfcounters/core] perf_counter: Tidy up style details tip-bot for Ingo Molnar
                                 ` (616 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-05-31 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	arjan, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  27b9613b7be39412775d0ab80f57229aa73bb07d
Gitweb:     http://git.kernel.org/tip/27b9613b7be39412775d0ab80f57229aa73bb07d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 31 May 2009 22:09:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 31 May 2009 22:09:49 +0200

perf_counter tools: Fix unknown command help text

Arjan reported this error when entering an unknown command to perf:

  $ perf start
  fatal: Uh oh. Your system reports no Git commands at all.

The Git code expects there to be perf-* commands - but since Perf
is a 'pure' utility with no dash commands anymore, this old assumption
of Git does not hold anymore. Remove that error check.

Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/help.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/Documentation/perf_counter/util/help.c b/Documentation/perf_counter/util/help.c
index edde541..397487f 100644
--- a/Documentation/perf_counter/util/help.c
+++ b/Documentation/perf_counter/util/help.c
@@ -323,9 +323,6 @@ const char *help_unknown_cmd(const char *cmd)
 	qsort(main_cmds.names, main_cmds.cnt,
 	      sizeof(*main_cmds.names), levenshtein_compare);
 
-	if (!main_cmds.cnt)
-		die ("Uh oh. Your system reports no Git commands at all.");
-
 	best_similarity = main_cmds.names[0]->len;
 	n = 1;
 	while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Tidy up style details
       [not found]             ` <new-submission>
                                 ` (90 preceding siblings ...)
  2009-05-31 20:16               ` [tip:perfcounters/core] perf_counter tools: Fix unknown command help text tip-bot for Ingo Molnar
@ 2009-06-01  8:19               ` tip-bot for Ingo Molnar
  2009-06-01 17:57               ` tip-bot for Ingo Molnar
                                 ` (615 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-01  8:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  fffd49c59754dc1fb3ec727b45f0f624d7595398
Gitweb:     http://git.kernel.org/tip/fffd49c59754dc1fb3ec727b45f0f624d7595398
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 1 Jun 2009 10:13:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 1 Jun 2009 10:14:57 +0200

perf_counter: Tidy up style details

 - whitespace fixlets
 - make local variable definitions more consistent

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 +-
 kernel/perf_counter.c        |   39 +++++++++++++++++++++------------------
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 82ab958..d970fbc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -561,7 +561,7 @@ struct perf_cpu_context {
 	 *
 	 * task, softirq, irq, nmi context
 	 */
-	int			recursion[4];
+	int				recursion[4];
 };
 
 #ifdef CONFIG_PERF_COUNTERS
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d6d2f9d..59866f7 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -16,8 +16,9 @@
 #include <linux/file.h>
 #include <linux/poll.h>
 #include <linux/sysfs.h>
-#include <linux/ptrace.h>
+#include <linux/dcache.h>
 #include <linux/percpu.h>
+#include <linux/ptrace.h>
 #include <linux/vmstat.h>
 #include <linux/hardirq.h>
 #include <linux/rculist.h>
@@ -26,7 +27,6 @@
 #include <linux/anon_inodes.h>
 #include <linux/kernel_stat.h>
 #include <linux/perf_counter.h>
-#include <linux/dcache.h>
 
 #include <asm/irq_regs.h>
 
@@ -65,7 +65,9 @@ void __weak hw_perf_disable(void)		{ barrier(); }
 void __weak hw_perf_enable(void)		{ barrier(); }
 
 void __weak hw_perf_counter_setup(int cpu)	{ barrier(); }
-int __weak hw_perf_group_sched_in(struct perf_counter *group_leader,
+
+int __weak
+hw_perf_group_sched_in(struct perf_counter *group_leader,
 	       struct perf_cpu_context *cpuctx,
 	       struct perf_counter_context *ctx, int cpu)
 {
@@ -127,8 +129,8 @@ static void put_ctx(struct perf_counter_context *ctx)
  * This has to cope with with the fact that until it is locked,
  * the context could get moved to another task.
  */
-static struct perf_counter_context *perf_lock_task_context(
-				struct task_struct *task, unsigned long *flags)
+static struct perf_counter_context *
+perf_lock_task_context(struct task_struct *task, unsigned long *flags)
 {
 	struct perf_counter_context *ctx;
 
@@ -1326,9 +1328,9 @@ __perf_counter_init_context(struct perf_counter_context *ctx,
 
 static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
 {
-	struct perf_cpu_context *cpuctx;
-	struct perf_counter_context *ctx;
 	struct perf_counter_context *parent_ctx;
+	struct perf_counter_context *ctx;
+	struct perf_cpu_context *cpuctx;
 	struct task_struct *task;
 	unsigned long flags;
 	int err;
@@ -1660,8 +1662,8 @@ int perf_counter_task_disable(void)
  */
 void perf_counter_update_userpage(struct perf_counter *counter)
 {
-	struct perf_mmap_data *data;
 	struct perf_counter_mmap_page *userpg;
+	struct perf_mmap_data *data;
 
 	rcu_read_lock();
 	data = rcu_dereference(counter->data);
@@ -1765,10 +1767,11 @@ fail:
 
 static void __perf_mmap_data_free(struct rcu_head *rcu_head)
 {
-	struct perf_mmap_data *data = container_of(rcu_head,
-			struct perf_mmap_data, rcu_head);
+	struct perf_mmap_data *data;
 	int i;
 
+	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
+
 	free_page((unsigned long)data->user_page);
 	for (i = 0; i < data->nr_pages; i++)
 		free_page((unsigned long)data->data_pages[i]);
@@ -1797,8 +1800,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 	struct perf_counter *counter = vma->vm_file->private_data;
 
 	WARN_ON_ONCE(counter->ctx->parent_ctx);
-	if (atomic_dec_and_mutex_lock(&counter->mmap_count,
-				      &counter->mmap_mutex)) {
+	if (atomic_dec_and_mutex_lock(&counter->mmap_count, &counter->mmap_mutex)) {
 		struct user_struct *user = current_user();
 
 		atomic_long_sub(counter->data->nr_pages + 1, &user->locked_vm);
@@ -1817,11 +1819,11 @@ static struct vm_operations_struct perf_mmap_vmops = {
 static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct perf_counter *counter = file->private_data;
+	unsigned long user_locked, user_lock_limit;
 	struct user_struct *user = current_user();
+	unsigned long locked, lock_limit;
 	unsigned long vma_size;
 	unsigned long nr_pages;
-	unsigned long user_locked, user_lock_limit;
-	unsigned long locked, lock_limit;
 	long user_extra, extra;
 	int ret = 0;
 
@@ -1896,8 +1898,8 @@ unlock:
 
 static int perf_fasync(int fd, struct file *filp, int on)
 {
-	struct perf_counter *counter = filp->private_data;
 	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct perf_counter *counter = filp->private_data;
 	int retval;
 
 	mutex_lock(&inode->i_mutex);
@@ -2408,8 +2410,8 @@ static void perf_counter_output(struct perf_counter *counter,
  */
 
 struct perf_comm_event {
-	struct task_struct 	*task;
-	char 			*comm;
+	struct task_struct	*task;
+	char			*comm;
 	int			comm_size;
 
 	struct {
@@ -2930,6 +2932,7 @@ static void perf_swcounter_add(struct perf_counter *counter, u64 nr,
 			       int nmi, struct pt_regs *regs, u64 addr)
 {
 	int neg = atomic64_add_negative(nr, &counter->hw.count);
+
 	if (counter->hw.irq_period && !neg && regs)
 		perf_swcounter_overflow(counter, nmi, regs, addr);
 }
@@ -3490,7 +3493,7 @@ inherit_counter(struct perf_counter *parent_counter,
 	/*
 	 * Make the child state follow the state of the parent counter,
 	 * not its hw_event.disabled bit.  We hold the parent's mutex,
-	 * so we won't race with perf_counter_{en,dis}able_family.
+	 * so we won't race with perf_counter_{en, dis}able_family.
 	 */
 	if (parent_counter->state >= PERF_COUNTER_STATE_INACTIVE)
 		child_counter->state = PERF_COUNTER_STATE_INACTIVE;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Tidy up style details
       [not found]             ` <new-submission>
                                 ` (91 preceding siblings ...)
  2009-06-01  8:19               ` [tip:perfcounters/core] perf_counter: Tidy up style details tip-bot for Ingo Molnar
@ 2009-06-01 17:57               ` tip-bot for Ingo Molnar
  2009-06-01 18:22                 ` Frans Pop
  2009-06-01 18:42               ` [tip:perfcounters/core] perf_counter tools: Guard against record damaging existing files tip-bot for Mike Galbraith
                                 ` (614 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-01 17:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  22a4f650d686eeaac3629dae1c4294381485efdf
Gitweb:     http://git.kernel.org/tip/22a4f650d686eeaac3629dae1c4294381485efdf
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 1 Jun 2009 10:13:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 1 Jun 2009 19:55:32 +0200

perf_counter: Tidy up style details

 - whitespace fixlets
 - make local variable definitions more consistent

[ Impact: cleanup ]

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 +-
 kernel/perf_counter.c        |   39 +++++++++++++++++++++------------------
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 81ec79c..0e57d8c 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -562,7 +562,7 @@ struct perf_cpu_context {
 	 *
 	 * task, softirq, irq, nmi context
 	 */
-	int			recursion[4];
+	int				recursion[4];
 };
 
 #ifdef CONFIG_PERF_COUNTERS
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ff8b463..df319c4 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -16,8 +16,9 @@
 #include <linux/file.h>
 #include <linux/poll.h>
 #include <linux/sysfs.h>
-#include <linux/ptrace.h>
+#include <linux/dcache.h>
 #include <linux/percpu.h>
+#include <linux/ptrace.h>
 #include <linux/vmstat.h>
 #include <linux/hardirq.h>
 #include <linux/rculist.h>
@@ -26,7 +27,6 @@
 #include <linux/anon_inodes.h>
 #include <linux/kernel_stat.h>
 #include <linux/perf_counter.h>
-#include <linux/dcache.h>
 
 #include <asm/irq_regs.h>
 
@@ -65,7 +65,9 @@ void __weak hw_perf_disable(void)		{ barrier(); }
 void __weak hw_perf_enable(void)		{ barrier(); }
 
 void __weak hw_perf_counter_setup(int cpu)	{ barrier(); }
-int __weak hw_perf_group_sched_in(struct perf_counter *group_leader,
+
+int __weak
+hw_perf_group_sched_in(struct perf_counter *group_leader,
 	       struct perf_cpu_context *cpuctx,
 	       struct perf_counter_context *ctx, int cpu)
 {
@@ -127,8 +129,8 @@ static void put_ctx(struct perf_counter_context *ctx)
  * This has to cope with with the fact that until it is locked,
  * the context could get moved to another task.
  */
-static struct perf_counter_context *perf_lock_task_context(
-				struct task_struct *task, unsigned long *flags)
+static struct perf_counter_context *
+perf_lock_task_context(struct task_struct *task, unsigned long *flags)
 {
 	struct perf_counter_context *ctx;
 
@@ -1330,9 +1332,9 @@ __perf_counter_init_context(struct perf_counter_context *ctx,
 
 static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
 {
-	struct perf_cpu_context *cpuctx;
-	struct perf_counter_context *ctx;
 	struct perf_counter_context *parent_ctx;
+	struct perf_counter_context *ctx;
+	struct perf_cpu_context *cpuctx;
 	struct task_struct *task;
 	unsigned long flags;
 	int err;
@@ -1664,8 +1666,8 @@ int perf_counter_task_disable(void)
  */
 void perf_counter_update_userpage(struct perf_counter *counter)
 {
-	struct perf_mmap_data *data;
 	struct perf_counter_mmap_page *userpg;
+	struct perf_mmap_data *data;
 
 	rcu_read_lock();
 	data = rcu_dereference(counter->data);
@@ -1769,10 +1771,11 @@ fail:
 
 static void __perf_mmap_data_free(struct rcu_head *rcu_head)
 {
-	struct perf_mmap_data *data = container_of(rcu_head,
-			struct perf_mmap_data, rcu_head);
+	struct perf_mmap_data *data;
 	int i;
 
+	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
+
 	free_page((unsigned long)data->user_page);
 	for (i = 0; i < data->nr_pages; i++)
 		free_page((unsigned long)data->data_pages[i]);
@@ -1801,8 +1804,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 	struct perf_counter *counter = vma->vm_file->private_data;
 
 	WARN_ON_ONCE(counter->ctx->parent_ctx);
-	if (atomic_dec_and_mutex_lock(&counter->mmap_count,
-				      &counter->mmap_mutex)) {
+	if (atomic_dec_and_mutex_lock(&counter->mmap_count, &counter->mmap_mutex)) {
 		struct user_struct *user = current_user();
 
 		atomic_long_sub(counter->data->nr_pages + 1, &user->locked_vm);
@@ -1821,11 +1823,11 @@ static struct vm_operations_struct perf_mmap_vmops = {
 static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct perf_counter *counter = file->private_data;
+	unsigned long user_locked, user_lock_limit;
 	struct user_struct *user = current_user();
+	unsigned long locked, lock_limit;
 	unsigned long vma_size;
 	unsigned long nr_pages;
-	unsigned long user_locked, user_lock_limit;
-	unsigned long locked, lock_limit;
 	long user_extra, extra;
 	int ret = 0;
 
@@ -1900,8 +1902,8 @@ unlock:
 
 static int perf_fasync(int fd, struct file *filp, int on)
 {
-	struct perf_counter *counter = filp->private_data;
 	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct perf_counter *counter = filp->private_data;
 	int retval;
 
 	mutex_lock(&inode->i_mutex);
@@ -2412,8 +2414,8 @@ static void perf_counter_output(struct perf_counter *counter,
  */
 
 struct perf_comm_event {
-	struct task_struct 	*task;
-	char 			*comm;
+	struct task_struct	*task;
+	char			*comm;
 	int			comm_size;
 
 	struct {
@@ -2932,6 +2934,7 @@ static void perf_swcounter_add(struct perf_counter *counter, u64 nr,
 			       int nmi, struct pt_regs *regs, u64 addr)
 {
 	int neg = atomic64_add_negative(nr, &counter->hw.count);
+
 	if (counter->hw.irq_period && !neg)
 		perf_swcounter_overflow(counter, nmi, regs, addr);
 }
@@ -3526,7 +3529,7 @@ inherit_counter(struct perf_counter *parent_counter,
 	/*
 	 * Make the child state follow the state of the parent counter,
 	 * not its hw_event.disabled bit.  We hold the parent's mutex,
-	 * so we won't race with perf_counter_{en,dis}able_family.
+	 * so we won't race with perf_counter_{en, dis}able_family.
 	 */
 	if (parent_counter->state >= PERF_COUNTER_STATE_INACTIVE)
 		child_counter->state = PERF_COUNTER_STATE_INACTIVE;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Tidy up style details
  2009-06-01 17:57               ` tip-bot for Ingo Molnar
@ 2009-06-01 18:22                 ` Frans Pop
  2009-06-01 18:43                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Frans Pop @ 2009-06-01 18:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: acme, paulus, hpa, mingo, jkacur, a.p.zijlstra, efault, mtosatti,
	tglx, cjashfor, mingo

tip-bot for Ingo Molnar wrote:
> @@ -3526,7 +3529,7 @@ inherit_counter(struct perf_counter *parent_counter,
>	/*
>	* Make the child state follow the state of the parent counter,
>	* not its hw_event.disabled bit.  We hold the parent's mutex,
> -	* so we won't race with perf_counter_{en,dis}able_family.
> +	* so we won't race with perf_counter_{en, dis}able_family.
> 	*/
> 	if (parent_counter->state >= PERF_COUNTER_STATE_INACTIVE)
> 	child_counter->state = PERF_COUNTER_STATE_INACTIVE;

I wouldn't call this an improvement TBH.

perf_counter_{en,dis}able_family expands to
   perf_counter_enable_family + perf_counter_disable_family

while perf_counter_{en, dis}able_family expands to
   perf_counter_enable_family + "perf_counter_ disable_family"

Cheers,
FJP

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Guard against record damaging existing files
       [not found]             ` <new-submission>
                                 ` (92 preceding siblings ...)
  2009-06-01 17:57               ` tip-bot for Ingo Molnar
@ 2009-06-01 18:42               ` tip-bot for Mike Galbraith
  2009-06-02  1:45               ` [tip:perfcounters/core] perf_counter tools: Add string.[ch] tip-bot for Arnaldo Carvalho de Melo
                                 ` (613 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-06-01 18:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  229c4eedcedcdadf70411120ba34bc37554a74bd
Gitweb:     http://git.kernel.org/tip/229c4eedcedcdadf70411120ba34bc37554a74bd
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Thu, 28 May 2009 16:28:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 1 Jun 2009 20:10:24 +0200

perf_counter tools: Guard against record damaging existing files

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 23d1224..96bfb7c 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -340,7 +340,7 @@ static int __cmd_record(int argc, const char **argv)
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
-	output = open(output_name, O_CREAT|O_RDWR, S_IRWXU);
+	output = open(output_name, O_CREAT|O_EXCL|O_RDWR, S_IRWXU);
 	if (output < 0) {
 		perror("failed to create output file");
 		exit(-1);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Tidy up style details
  2009-06-01 18:22                 ` Frans Pop
@ 2009-06-01 18:43                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-01 18:43 UTC (permalink / raw)
  To: Frans Pop
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor


* Frans Pop <elendil@planet.nl> wrote:

> tip-bot for Ingo Molnar wrote:
> > @@ -3526,7 +3529,7 @@ inherit_counter(struct perf_counter *parent_counter,
> >	/*
> >	* Make the child state follow the state of the parent counter,
> >	* not its hw_event.disabled bit.  We hold the parent's mutex,
> > -	* so we won't race with perf_counter_{en,dis}able_family.
> > +	* so we won't race with perf_counter_{en, dis}able_family.
> > 	*/
> > 	if (parent_counter->state >= PERF_COUNTER_STATE_INACTIVE)
> > 	child_counter->state = PERF_COUNTER_STATE_INACTIVE;
> 
> I wouldn't call this an improvement TBH.

yeah.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add string.[ch]
       [not found]             ` <new-submission>
                                 ` (93 preceding siblings ...)
  2009-06-01 18:42               ` [tip:perfcounters/core] perf_counter tools: Guard against record damaging existing files tip-bot for Mike Galbraith
@ 2009-06-02  1:45               ` tip-bot for Arnaldo Carvalho de Melo
  2009-06-02  8:25               ` [tip:perfcounters/core] perf_counter tools: Make .gitignore reflect perf_counter tools files tip-bot for Mike Galbraith
                                 ` (612 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-06-02  1:45 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx, mingo

Commit-ID:  ea5cc87c63b49c133d15ec2911bb2e49e8124516
Gitweb:     http://git.kernel.org/tip/ea5cc87c63b49c133d15ec2911bb2e49e8124516
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 1 Jun 2009 22:31:03 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 03:40:42 +0200

perf_counter tools: Add string.[ch]

Add hex conversion libraries. We are going to replace sscanf()
uses with them.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/string.c |   34 ++++++++++++++++++++++++++++++
 Documentation/perf_counter/util/string.h |    8 +++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/util/string.c b/Documentation/perf_counter/util/string.c
new file mode 100644
index 0000000..ec33c0c
--- /dev/null
+++ b/Documentation/perf_counter/util/string.c
@@ -0,0 +1,34 @@
+#include "string.h"
+
+static int hex(char ch)
+{
+	if ((ch >= '0') && (ch <= '9'))
+		return ch - '0';
+	if ((ch >= 'a') && (ch <= 'f'))
+		return ch - 'a' + 10;
+	if ((ch >= 'A') && (ch <= 'F'))
+		return ch - 'A' + 10;
+	return -1;
+}
+
+/*
+ * While we find nice hex chars, build a long_val.
+ * Return number of chars processed.
+ */
+int hex2u64(const char *ptr, __u64 *long_val)
+{
+	const char *p = ptr;
+	*long_val = 0;
+
+	while (*p) {
+		const int hex_val = hex(*p);
+
+		if (hex_val < 0)
+			break;
+
+		*long_val = (*long_val << 4) | hex_val;
+		p++;
+	}
+
+	return p - ptr;
+}
diff --git a/Documentation/perf_counter/util/string.h b/Documentation/perf_counter/util/string.h
new file mode 100644
index 0000000..72812c1
--- /dev/null
+++ b/Documentation/perf_counter/util/string.h
@@ -0,0 +1,8 @@
+#ifndef _PERF_STRING_H_
+#define _PERF_STRING_H_
+
+#include <linux/types.h>
+
+int hex2u64(const char *ptr, __u64 *val);
+
+#endif

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Make .gitignore reflect perf_counter tools files
       [not found]             ` <new-submission>
                                 ` (94 preceding siblings ...)
  2009-06-02  1:45               ` [tip:perfcounters/core] perf_counter tools: Add string.[ch] tip-bot for Arnaldo Carvalho de Melo
@ 2009-06-02  8:25               ` tip-bot for Mike Galbraith
  2009-06-02  9:03               ` [tip:perfcounters/core] perf_counter tools: Cleanup Makefile tip-bot for Mike Galbraith
                                 ` (611 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-06-02  8:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  c25486c5ea3ea5586f71285a3aa5cfafb1db59f9
Gitweb:     http://git.kernel.org/tip/c25486c5ea3ea5586f71285a3aa5cfafb1db59f9
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 2 Jun 2009 08:09:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 09:46:09 +0200

perf_counter tools: Make .gitignore reflect perf_counter tools files

Make .gitignore reflect perf_counter tools files so
git status doesn't gripe about untracked files.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/.gitignore |  187 ++------------------------------
 1 files changed, 12 insertions(+), 175 deletions(-)

diff --git a/Documentation/perf_counter/.gitignore b/Documentation/perf_counter/.gitignore
index 41c0b20..d69a759 100644
--- a/Documentation/perf_counter/.gitignore
+++ b/Documentation/perf_counter/.gitignore
@@ -1,179 +1,16 @@
-GIT-BUILD-OPTIONS
-GIT-CFLAGS
-GIT-GUI-VARS
-GIT-VERSION-FILE
-git
-git-add
-git-add--interactive
-git-am
-git-annotate
-git-apply
-git-archimport
-git-archive
-git-bisect
-git-bisect--helper
-git-blame
-git-branch
-git-bundle
-git-cat-file
-git-check-attr
-git-check-ref-format
-git-checkout
-git-checkout-index
-git-cherry
-git-cherry-pick
-git-clean
-git-clone
-git-commit
-git-commit-tree
-git-config
-git-count-objects
-git-cvsexportcommit
-git-cvsimport
-git-cvsserver
-git-daemon
-git-diff
-git-diff-files
-git-diff-index
-git-diff-tree
-git-difftool
-git-difftool--helper
-git-describe
-git-fast-export
-git-fast-import
-git-fetch
-git-fetch--tool
-git-fetch-pack
-git-filter-branch
-git-fmt-merge-msg
-git-for-each-ref
-git-format-patch
-git-fsck
-git-fsck-objects
-git-gc
-git-get-tar-commit-id
-git-grep
-git-hash-object
-git-help
-git-http-fetch
-git-http-push
-git-imap-send
-git-index-pack
-git-init
-git-init-db
-git-instaweb
-git-log
-git-lost-found
-git-ls-files
-git-ls-remote
-git-ls-tree
-git-mailinfo
-git-mailsplit
-git-merge
-git-merge-base
-git-merge-index
-git-merge-file
-git-merge-tree
-git-merge-octopus
-git-merge-one-file
-git-merge-ours
-git-merge-recursive
-git-merge-resolve
-git-merge-subtree
-git-mergetool
-git-mergetool--lib
-git-mktag
-git-mktree
-git-name-rev
-git-mv
-git-pack-redundant
-git-pack-objects
-git-pack-refs
-git-parse-remote
-git-patch-id
-git-peek-remote
-git-prune
-git-prune-packed
-git-pull
-git-push
-git-quiltimport
-git-read-tree
-git-rebase
-git-rebase--interactive
-git-receive-pack
-git-reflog
-git-relink
-git-remote
-git-repack
-git-repo-config
-git-request-pull
-git-rerere
-git-reset
-git-rev-list
-git-rev-parse
-git-revert
-git-rm
-git-send-email
-git-send-pack
-git-sh-setup
-git-shell
-git-shortlog
-git-show
-git-show-branch
-git-show-index
-git-show-ref
-git-stage
-git-stash
-git-status
-git-stripspace
-git-submodule
-git-svn
-git-symbolic-ref
-git-tag
-git-tar-tree
-git-unpack-file
-git-unpack-objects
-git-update-index
-git-update-ref
-git-update-server-info
-git-upload-archive
-git-upload-pack
-git-var
-git-verify-pack
-git-verify-tag
-git-web--browse
-git-whatchanged
-git-write-tree
-git-core-*/?*
-gitk-wish
-gitweb/gitweb.cgi
-test-chmtime
-test-ctype
-test-date
-test-delta
-test-dump-cache-tree
-test-genrandom
-test-match-trees
-test-parse-options
-test-path-utils
-test-sha1
-test-sigchain
+PERF-BUILD-OPTIONS
+PERF-CFLAGS
+PERF-GUI-VARS
+PERF-VERSION-FILE
+perf
+perf-help
+perf-record
+perf-report
+perf-stat
+perf-top
+perf*.1
+perf*.xml
 common-cmds.h
-*.tar.gz
-*.dsc
-*.deb
-git.spec
-*.exe
-*.[aos]
-*.py[co]
-config.mak
-autom4te.cache
-config.cache
-config.log
-config.status
-config.mak.autogen
-config.mak.append
-configure
 tags
 TAGS
 cscope*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Cleanup Makefile
       [not found]             ` <new-submission>
                                 ` (95 preceding siblings ...)
  2009-06-02  8:25               ` [tip:perfcounters/core] perf_counter tools: Make .gitignore reflect perf_counter tools files tip-bot for Mike Galbraith
@ 2009-06-02  9:03               ` tip-bot for Mike Galbraith
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: Use PID namespaces properly tip-bot for Peter Zijlstra
                                 ` (610 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-06-02  9:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  c1079abd1d5e66edabeb04d75e48e604cd8c167f
Gitweb:     http://git.kernel.org/tip/c1079abd1d5e66edabeb04d75e48e604cd8c167f
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 2 Jun 2009 10:17:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 11:01:43 +0200

perf_counter tools: Cleanup Makefile

We currently build perf-stat/record etc, only to do nothing
with them.  We also install the perf binary in two places,
$prefix/bin and $perfexec_instdir, which appears to be for
binaries which perf would exec were a command not linked in.
Correct this, and comment out broken/incomplete targets dist
and coverage.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile |  141 ++++++++++++++++++-----------------
 1 files changed, 73 insertions(+), 68 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 3b8275f..eae8856 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -260,8 +260,6 @@ PROGRAMS += perf
 
 # List built-in command $C whose implementation cmd_$C() is not in
 # builtin-$C.o but is linked in as part of some other command.
-BUILT_INS += $(patsubst builtin-%.o,perf-%$X,$(BUILTIN_OBJS))
-
 #
 # None right now:
 #
@@ -791,12 +789,14 @@ export perfexec_instdir
 
 install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
-	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
-	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(INSTALL) perf$X '$(DESTDIR_SQ)$(bindir_SQ)'
+ifdef BUILT_INS
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+	$(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 ifneq (,$X)
 	$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';)
 endif
+endif
 
 install-doc:
 	$(MAKE) -C Documentation install
@@ -824,52 +824,55 @@ quick-install-html:
 
 
 ### Maintainer's dist rules
-
-perf.spec: perf.spec.in
-	sed -e 's/@@VERSION@@/$(PERF_VERSION)/g' < $< > $@+
-	mv $@+ $@
-
-PERF_TARNAME=perf-$(PERF_VERSION)
-dist: perf.spec perf-archive$(X) configure
-	./perf-archive --format=tar \
-		--prefix=$(PERF_TARNAME)/ HEAD^{tree} > $(PERF_TARNAME).tar
-	@mkdir -p $(PERF_TARNAME)
-	@cp perf.spec configure $(PERF_TARNAME)
-	@echo $(PERF_VERSION) > $(PERF_TARNAME)/version
-	$(TAR) rf $(PERF_TARNAME).tar \
-		$(PERF_TARNAME)/perf.spec \
-		$(PERF_TARNAME)/configure \
-		$(PERF_TARNAME)/version
-	@$(RM) -r $(PERF_TARNAME)
-	gzip -f -9 $(PERF_TARNAME).tar
-
-htmldocs = perf-htmldocs-$(PERF_VERSION)
-manpages = perf-manpages-$(PERF_VERSION)
-dist-doc:
-	$(RM) -r .doc-tmp-dir
-	mkdir .doc-tmp-dir
-	$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
-	cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
-	gzip -n -9 -f $(htmldocs).tar
-	:
-	$(RM) -r .doc-tmp-dir
-	mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
-	$(MAKE) -C Documentation DESTDIR=./ \
-		man1dir=../.doc-tmp-dir/man1 \
-		man5dir=../.doc-tmp-dir/man5 \
-		man7dir=../.doc-tmp-dir/man7 \
-		install
-	cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
-	gzip -n -9 -f $(manpages).tar
-	$(RM) -r .doc-tmp-dir
-
-rpm: dist
-	$(RPMBUILD) -ta $(PERF_TARNAME).tar.gz
+#
+# None right now
+#
+#
+# perf.spec: perf.spec.in
+#	sed -e 's/@@VERSION@@/$(PERF_VERSION)/g' < $< > $@+
+#	mv $@+ $@
+#
+# PERF_TARNAME=perf-$(PERF_VERSION)
+# dist: perf.spec perf-archive$(X) configure
+#	./perf-archive --format=tar \
+#		--prefix=$(PERF_TARNAME)/ HEAD^{tree} > $(PERF_TARNAME).tar
+#	@mkdir -p $(PERF_TARNAME)
+#	@cp perf.spec configure $(PERF_TARNAME)
+#	@echo $(PERF_VERSION) > $(PERF_TARNAME)/version
+#	$(TAR) rf $(PERF_TARNAME).tar \
+#		$(PERF_TARNAME)/perf.spec \
+#		$(PERF_TARNAME)/configure \
+#		$(PERF_TARNAME)/version
+#	@$(RM) -r $(PERF_TARNAME)
+#	gzip -f -9 $(PERF_TARNAME).tar
+#
+# htmldocs = perf-htmldocs-$(PERF_VERSION)
+# manpages = perf-manpages-$(PERF_VERSION)
+# dist-doc:
+#	$(RM) -r .doc-tmp-dir
+#	mkdir .doc-tmp-dir
+#	$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
+#	cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
+#	gzip -n -9 -f $(htmldocs).tar
+#	:
+#	$(RM) -r .doc-tmp-dir
+#	mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
+#	$(MAKE) -C Documentation DESTDIR=./ \
+#		man1dir=../.doc-tmp-dir/man1 \
+#		man5dir=../.doc-tmp-dir/man5 \
+#		man7dir=../.doc-tmp-dir/man7 \
+#		install
+#	cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
+#	gzip -n -9 -f $(manpages).tar
+#	$(RM) -r .doc-tmp-dir
+#
+# rpm: dist
+#	$(RPMBUILD) -ta $(PERF_TARNAME).tar.gz
 
 ### Cleaning rules
 
 distclean: clean
-	$(RM) configure
+#	$(RM) configure
 
 clean:
 	$(RM) *.o */*.o $(LIB_FILE)
@@ -896,25 +899,27 @@ check-builtins::
 
 ### Test suite coverage testing
 #
-.PHONY: coverage coverage-clean coverage-build coverage-report
-
-coverage:
-	$(MAKE) coverage-build
-	$(MAKE) coverage-report
-
-coverage-clean:
-	rm -f *.gcda *.gcno
-
-COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
-COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
-
-coverage-build: coverage-clean
-	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
-	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-		-j1 test
-
-coverage-report:
-	gcov -b *.c */*.c
-	grep '^function.*called 0 ' *.c.gcov */*.c.gcov \
-		| sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
-		| tee coverage-untested-functions
+# None right now
+#
+# .PHONY: coverage coverage-clean coverage-build coverage-report
+#
+# coverage:
+#	$(MAKE) coverage-build
+#	$(MAKE) coverage-report
+#
+# coverage-clean:
+#	rm -f *.gcda *.gcno
+#
+# COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
+# COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
+#
+# coverage-build: coverage-clean
+#	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
+#	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
+#		-j1 test
+#
+# coverage-report:
+#	gcov -b *.c */*.c
+#	grep '^function.*called 0 ' *.c.gcov */*.c.gcov \
+#		| sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
+#		| tee coverage-untested-functions

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Use PID namespaces properly
       [not found]             ` <new-submission>
                                 ` (96 preceding siblings ...)
  2009-06-02  9:03               ` [tip:perfcounters/core] perf_counter tools: Cleanup Makefile tip-bot for Mike Galbraith
@ 2009-06-02 14:19               ` tip-bot for Peter Zijlstra
  2009-06-02 15:55                 ` Oleg Nesterov
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: tools: Expand the COMM,MMAP event synthesizer tip-bot for Peter Zijlstra
                                 ` (609 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 14:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, ebiederm, oleg, mtosatti, tglx, cjashfor, mingo

Commit-ID:  709e50cf870e61745b39552044aa6c7c38e4f9e0
Gitweb:     http://git.kernel.org/tip/709e50cf870e61745b39552044aa6c7c38e4f9e0
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 14:13:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 16:16:25 +0200

perf_counter: Use PID namespaces properly

Stop using task_struct::pid and start using PID namespaces.

PIDs will be reported in the PID namespace of the monitoring
task at the moment of counter creation.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    3 +++
 kernel/perf_counter.c        |   42 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index d970fbc..9ec20fc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -317,6 +317,7 @@ enum perf_event_type {
 #include <linux/spinlock.h>
 #include <linux/hrtimer.h>
 #include <linux/fs.h>
+#include <linux/pid_namespace.h>
 #include <asm/atomic.h>
 
 struct task_struct;
@@ -500,6 +501,8 @@ struct perf_counter {
 
 	void (*destroy)(struct perf_counter *);
 	struct rcu_head			rcu_head;
+
+	struct pid_namespace		*ns;
 #endif
 };
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index fbed4d2..caa012c 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1432,6 +1432,8 @@ static void free_counter_rcu(struct rcu_head *head)
 	struct perf_counter *counter;
 
 	counter = container_of(head, struct perf_counter, rcu_head);
+	if (counter->ns)
+		put_pid_ns(counter->ns);
 	kfree(counter);
 }
 
@@ -2267,6 +2269,28 @@ static void perf_output_end(struct perf_output_handle *handle)
 	rcu_read_unlock();
 }
 
+static u32 perf_counter_pid(struct perf_counter *counter, struct task_struct *p)
+{
+	/*
+	 * only top level counters have the pid namespace they were created in
+	 */
+	if (counter->parent)
+		counter = counter->parent;
+
+	return task_tgid_nr_ns(p, counter->ns);
+}
+
+static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p)
+{
+	/*
+	 * only top level counters have the pid namespace they were created in
+	 */
+	if (counter->parent)
+		counter = counter->parent;
+
+	return task_pid_nr_ns(p, counter->ns);
+}
+
 static void perf_counter_output(struct perf_counter *counter,
 				int nmi, struct pt_regs *regs, u64 addr)
 {
@@ -2303,8 +2327,8 @@ static void perf_counter_output(struct perf_counter *counter,
 
 	if (record_type & PERF_RECORD_TID) {
 		/* namespace issues */
-		tid_entry.pid = current->group_leader->pid;
-		tid_entry.tid = current->pid;
+		tid_entry.pid = perf_counter_pid(counter, current);
+		tid_entry.tid = perf_counter_tid(counter, current);
 
 		header.type |= PERF_RECORD_TID;
 		header.size += sizeof(tid_entry);
@@ -2432,6 +2456,9 @@ static void perf_counter_comm_output(struct perf_counter *counter,
 	if (ret)
 		return;
 
+	comm_event->event.pid = perf_counter_pid(counter, comm_event->task);
+	comm_event->event.tid = perf_counter_tid(counter, comm_event->task);
+
 	perf_output_put(&handle, comm_event->event);
 	perf_output_copy(&handle, comm_event->comm,
 				   comm_event->comm_size);
@@ -2504,8 +2531,6 @@ void perf_counter_comm(struct task_struct *task)
 		.task	= task,
 		.event  = {
 			.header = { .type = PERF_EVENT_COMM, },
-			.pid	= task->group_leader->pid,
-			.tid	= task->pid,
 		},
 	};
 
@@ -2542,6 +2567,9 @@ static void perf_counter_mmap_output(struct perf_counter *counter,
 	if (ret)
 		return;
 
+	mmap_event->event.pid = perf_counter_pid(counter, current);
+	mmap_event->event.tid = perf_counter_tid(counter, current);
+
 	perf_output_put(&handle, mmap_event->event);
 	perf_output_copy(&handle, mmap_event->file_name,
 				   mmap_event->file_size);
@@ -2641,8 +2669,6 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
 		.file   = file,
 		.event  = {
 			.header = { .type = PERF_EVENT_MMAP, },
-			.pid	= current->group_leader->pid,
-			.tid	= current->pid,
 			.start  = addr,
 			.len    = len,
 			.pgoff  = pgoff,
@@ -2664,8 +2690,6 @@ void perf_counter_munmap(unsigned long addr, unsigned long len,
 		.file   = file,
 		.event  = {
 			.header = { .type = PERF_EVENT_MUNMAP, },
-			.pid	= current->group_leader->pid,
-			.tid	= current->pid,
 			.start  = addr,
 			.len    = len,
 			.pgoff  = pgoff,
@@ -3445,6 +3469,8 @@ SYSCALL_DEFINE5(perf_counter_open,
 	list_add_tail(&counter->owner_entry, &current->perf_counter_list);
 	mutex_unlock(&current->perf_counter_mutex);
 
+	counter->ns = get_pid_ns(current->nsproxy->pid_ns);
+
 	fput_light(counter_file, fput_needed2);
 
 out_fput:

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: tools: Expand the COMM,MMAP event synthesizer
       [not found]             ` <new-submission>
                                 ` (97 preceding siblings ...)
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: Use PID namespaces properly tip-bot for Peter Zijlstra
@ 2009-06-02 14:19               ` tip-bot for Peter Zijlstra
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: tools: Better handle existing data files tip-bot for Peter Zijlstra
                                 ` (608 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 14:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  f70e87d7a6d9c5a23d5f43ed0a0c224c157ef597
Gitweb:     http://git.kernel.org/tip/f70e87d7a6d9c5a23d5f43ed0a0c224c157ef597
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 14:13:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 16:16:26 +0200

perf_counter: tools: Expand the COMM,MMAP event synthesizer

Include code to pre-construct mappings based on /proc,
on system wide recording.

Fix the existing code to properly fill out ->pid and ->tid.

The PID should be the Thread Group ID (PIDTYPE_PID of task->group_leader)
The TID should be the Thread ID (PIDTYPE_PID of task)

Furthermore, change the default sorting of report to comm,dso for a
better quick overview.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   84 ++++++++++++++++++++------
 Documentation/perf_counter/builtin-report.c |    2 +-
 2 files changed, 65 insertions(+), 21 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 9c151de..810fc27 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -162,7 +162,7 @@ struct comm_event {
 	char				comm[16];
 };
 
-static pid_t pid_synthesize_comm_event(pid_t pid)
+static void pid_synthesize_comm_event(pid_t pid, int full)
 {
 	struct comm_event comm_ev;
 	char filename[PATH_MAX];
@@ -170,6 +170,8 @@ static pid_t pid_synthesize_comm_event(pid_t pid)
 	int fd, ret;
 	size_t size;
 	char *field, *sep;
+	DIR *tasks;
+	struct dirent dirent, *next;
 
 	snprintf(filename, sizeof(filename), "/proc/%d/stat", pid);
 
@@ -194,29 +196,50 @@ static pid_t pid_synthesize_comm_event(pid_t pid)
 		goto out_failure;
 	size = sep - field;
 	memcpy(comm_ev.comm, field, size++);
-	field = strchr(sep + 4, ' ');
-	if (field == NULL)
-		goto out_failure;
-	comm_ev.pid = atoi(++field);
+
+	comm_ev.pid = pid;
 	comm_ev.header.type = PERF_EVENT_COMM;
-	comm_ev.tid = pid;
 	size = ALIGN(size, sizeof(uint64_t));
 	comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size);
 
-	ret = write(output, &comm_ev, comm_ev.header.size);
-	if (ret < 0) {
-		perror("failed to write");
-		exit(-1);
+	if (!full) {
+		comm_ev.tid = pid;
+
+		ret = write(output, &comm_ev, comm_ev.header.size);
+		if (ret < 0) {
+			perror("failed to write");
+			exit(-1);
+		}
+		return;
+	}
+
+	snprintf(filename, sizeof(filename), "/proc/%d/task", pid);
+
+	tasks = opendir(filename);
+	while (!readdir_r(tasks, &dirent, &next) && next) {
+		char *end;
+		pid = strtol(dirent.d_name, &end, 10);
+		if (*end)
+			continue;
+
+		comm_ev.tid = pid;
+
+		ret = write(output, &comm_ev, comm_ev.header.size);
+		if (ret < 0) {
+			perror("failed to write");
+			exit(-1);
+		}
 	}
-	return comm_ev.pid;
+	closedir(tasks);
+	return;
+
 out_failure:
 	fprintf(stderr, "couldn't get COMM and pgid, malformed %s\n",
 		filename);
 	exit(EXIT_FAILURE);
-	return -1;
 }
 
-static void pid_synthesize_mmap_events(pid_t pid, pid_t pgid)
+static void pid_synthesize_mmap_events(pid_t pid)
 {
 	char filename[PATH_MAX];
 	FILE *fp;
@@ -261,7 +284,7 @@ static void pid_synthesize_mmap_events(pid_t pid, pid_t pgid)
 			mmap_ev.len -= mmap_ev.start;
 			mmap_ev.header.size = (sizeof(mmap_ev) -
 					       (sizeof(mmap_ev.filename) - size));
-			mmap_ev.pid = pgid;
+			mmap_ev.pid = pid;
 			mmap_ev.tid = pid;
 
 			if (write(output, &mmap_ev, mmap_ev.header.size) < 0) {
@@ -274,6 +297,28 @@ static void pid_synthesize_mmap_events(pid_t pid, pid_t pgid)
 	fclose(fp);
 }
 
+static void synthesize_events(void)
+{
+	DIR *proc;
+	struct dirent dirent, *next;
+
+	proc = opendir("/proc");
+
+	while (!readdir_r(proc, &dirent, &next) && next) {
+		char *end;
+		pid_t pid;
+
+		pid = strtol(dirent.d_name, &end, 10);
+		if (*end) /* only interested in proper numerical dirents */
+			continue;
+
+		pid_synthesize_comm_event(pid, 1);
+		pid_synthesize_mmap_events(pid);
+	}
+
+	closedir(proc);
+}
+
 static void open_counters(int cpu, pid_t pid)
 {
 	struct perf_counter_hw_event hw_event;
@@ -281,8 +326,8 @@ static void open_counters(int cpu, pid_t pid)
 	int track = 1;
 
 	if (pid > 0) {
-		pid_t pgid = pid_synthesize_comm_event(pid);
-		pid_synthesize_mmap_events(pid, pgid);
+		pid_synthesize_comm_event(pid, 0);
+		pid_synthesize_mmap_events(pid);
 	}
 
 	group_fd = -1;
@@ -348,7 +393,7 @@ static int __cmd_record(int argc, const char **argv)
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
-	output = open(output_name, O_CREAT|O_EXCL|O_RDWR, S_IRWXU);
+	output = open(output_name, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, S_IRUSR|S_IWUSR);
 	if (output < 0) {
 		perror("failed to create output file");
 		exit(-1);
@@ -385,9 +430,8 @@ static int __cmd_record(int argc, const char **argv)
 		}
 	}
 
-	/*
-	 * TODO: store the current /proc/$/maps information somewhere
-	 */
+	if (system_wide)
+		synthesize_events();
 
 	while (!done) {
 		int hits = events;
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 20a4e51..0558c1e 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -18,7 +18,7 @@
 
 static char		const *input_name = "perf.data";
 static char		*vmlinux = NULL;
-static char		*sort_order = "pid,symbol";
+static char		*sort_order = "comm,dso";
 static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: tools: Better handle existing data files
       [not found]             ` <new-submission>
                                 ` (98 preceding siblings ...)
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: tools: Expand the COMM,MMAP event synthesizer tip-bot for Peter Zijlstra
@ 2009-06-02 14:19               ` tip-bot for Peter Zijlstra
  2009-06-02 14:42               ` [tip:perfcounters/core] perf report: Clean up the default output tip-bot for Ingo Molnar
                                 ` (607 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 14:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  97124d5e2df5b9eaa5bb684bb1e8ebc7e29d0f5d
Gitweb:     http://git.kernel.org/tip/97124d5e2df5b9eaa5bb684bb1e8ebc7e29d0f5d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 15:52:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 16:16:26 +0200

perf_counter: tools: Better handle existing data files

Provide an argument (-f) to overwrite existing data files.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 810fc27..bace7a8 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -7,6 +7,7 @@
 #include "util/parse-events.h"
 #include "util/string.h"
 
+#include <unistd.h>
 #include <sched.h>
 
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a)-1)
@@ -26,7 +27,7 @@ static unsigned int		realtime_prio			= 0;
 static int			system_wide			= 0;
 static pid_t			target_pid			= -1;
 static int			inherit				= 1;
-static int			nmi				= 1;
+static int			force				= 0;
 
 const unsigned int default_count[] = {
 	1000000,
@@ -337,7 +338,6 @@ static void open_counters(int cpu, pid_t pid)
 		hw_event.config		= event_id[counter];
 		hw_event.irq_period	= event_count[counter];
 		hw_event.record_type	= PERF_RECORD_IP | PERF_RECORD_TID;
-		hw_event.nmi		= nmi;
 		hw_event.mmap		= track;
 		hw_event.comm		= track;
 		hw_event.inherit	= (cpu < 0) && inherit;
@@ -387,13 +387,20 @@ static int __cmd_record(int argc, const char **argv)
 	int i, counter;
 	pid_t pid;
 	int ret;
+	struct stat st;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
-	output = open(output_name, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, S_IRUSR|S_IWUSR);
+	if (!stat(output_name, &st) && !force) {
+		fprintf(stderr, "Error, output file: %s exists, use -f to overwrite.\n",
+				output_name);
+		exit(-1);
+	}
+
+	output = open(output_name, O_CREAT|O_TRUNC|O_RDWR, S_IRUSR|S_IWUSR);
 	if (output < 0) {
 		perror("failed to create output file");
 		exit(-1);
@@ -473,6 +480,8 @@ static const struct option options[] = {
 		    "collect data with this RT SCHED_FIFO priority"),
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
 			    "system-wide collection from all CPUs"),
+	OPT_BOOLEAN('f', "force", &force,
+			"overwrite existing data file"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Clean up the default output
       [not found]             ` <new-submission>
                                 ` (99 preceding siblings ...)
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: tools: Better handle existing data files tip-bot for Peter Zijlstra
@ 2009-06-02 14:42               ` tip-bot for Ingo Molnar
  2009-06-02 20:15               ` [tip:perfcounters/core] perf_counter tools: Remove the last nmi bits tip-bot for Peter Zijlstra
                                 ` (606 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 14:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  4593bba8679b925a056f84edac061676e7eda71c
Gitweb:     http://git.kernel.org/tip/4593bba8679b925a056f84edac061676e7eda71c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 15:34:25 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 16:39:25 +0200

perf report: Clean up the default output

 - extra space between columns
 - left-aligned the symbol column
 - moved the no-symbols printout to -v

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   55 ++++++++++++++-------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 0558c1e..19c1e05 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -84,24 +84,25 @@ static struct dso *dsos__findnew(const char *name)
 	struct dso *dso = dsos__find(name);
 	int nr;
 
-	if (dso == NULL) {
-		dso = dso__new(name, 0);
-		if (!dso)
-			goto out_delete_dso;
-
-		nr = dso__load(dso, NULL);
-		if (nr < 0) {
-			fprintf(stderr, "Failed to open: %s\n", name);
-			goto out_delete_dso;
-		}
-		if (!nr) {
-			fprintf(stderr,
-		"Failed to find debug symbols for: %s, maybe install a debug package?\n",
-					name);
-		}
+	if (dso)
+		return dso;
+
+	dso = dso__new(name, 0);
+	if (!dso)
+		goto out_delete_dso;
 
-		dsos__add(dso);
+	nr = dso__load(dso, NULL);
+	if (nr < 0) {
+		fprintf(stderr, "Failed to open: %s\n", name);
+		goto out_delete_dso;
 	}
+	if (!nr && verbose) {
+		fprintf(stderr,
+		"No symbols found in: %s, maybe install a debug package?\n",
+				name);
+	}
+
+	dsos__add(dso);
 
 	return dso;
 
@@ -302,11 +303,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__thread_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
+	return fprintf(fp, "  %16s:%5d", self->thread->comm ?: "", self->thread->pid);
 }
 
 static struct sort_entry sort_thread = {
-	.header = "         Command: Pid ",
+	.header = "          Command: Pid ",
 	.cmp	= sort__thread_cmp,
 	.print	= sort__thread_print,
 };
@@ -332,11 +333,11 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__comm_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>");
+	return fprintf(fp, "  %16s", self->thread->comm ?: "<unknown>");
 }
 
 static struct sort_entry sort_comm = {
-	.header = "         Command",
+	.header = "          Command",
 	.cmp	= sort__comm_cmp,
 	.print	= sort__comm_print,
 };
@@ -362,11 +363,11 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__dso_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, " %64s", self->dso ? self->dso->name : "<unknown>");
+	return fprintf(fp, "  %s", self->dso ? self->dso->name : "<unknown>");
 }
 
 static struct sort_entry sort_dso = {
-	.header = "                                                    Shared Object",
+	.header = " Shared Object",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };
@@ -391,9 +392,9 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	size_t ret = 0;
 
 	if (verbose)
-		ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip);
+		ret += fprintf(fp, "  %#018llx", (unsigned long long)self->ip);
 
-	ret += fprintf(fp, " %s: %s",
+	ret += fprintf(fp, "  %s: %s",
 			self->dso ? self->dso->name : "<unknown>",
 			self->sym ? self->sym->name : "<unknown>");
 
@@ -401,7 +402,7 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_sym = {
-	.header = "Shared Object: Symbol",
+	.header = " Shared Object: Symbol",
 	.cmp	= sort__sym_cmp,
 	.print	= sort__sym_print,
 };
@@ -595,8 +596,8 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
 		int i;
 
-		fprintf(fp, " ");
-		for (i = 0; i < strlen(se->header); i++)
+		fprintf(fp, "  ");
+		for (i = 0; i < strlen(se->header)-1; i++)
 			fprintf(fp, ".");
 	}
 	fprintf(fp, "\n");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Use PID namespaces properly
  2009-06-02 14:19               ` [tip:perfcounters/core] perf_counter: Use PID namespaces properly tip-bot for Peter Zijlstra
@ 2009-06-02 15:55                 ` Oleg Nesterov
  2009-06-02 16:28                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Oleg Nesterov @ 2009-06-02 15:55 UTC (permalink / raw)
  To: tip-bot for Peter Zijlstra
  Cc: linux-tip-commits, linux-kernel, acme, paulus, hpa, mingo, jkacur,
	efault, ebiederm, mtosatti, tglx, cjashfor, mingo

On 06/02, tip-bot for Peter Zijlstra wrote:
>
> +static u32 perf_counter_pid(struct perf_counter *counter, struct task_struct *p)
> +{
> +	/*
> +	 * only top level counters have the pid namespace they were created in
> +	 */
> +	if (counter->parent)
> +		counter = counter->parent;
> +
> +	return task_tgid_nr_ns(p, counter->ns);
> +}
> +
> +static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p)
> +{
> +	/*
> +	 * only top level counters have the pid namespace they were created in
> +	 */
> +	if (counter->parent)
> +		counter = counter->parent;
> +
> +	return task_pid_nr_ns(p, counter->ns);

Perhaps this should be

	return task_pid_nr_ns(p->group_leader);

?

> +		tid_entry.pid = perf_counter_pid(counter, current);
> +		tid_entry.tid = perf_counter_tid(counter, current);


Otherwise we seem to always report .pid == .tid

Oleg.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Use PID namespaces properly
  2009-06-02 15:55                 ` Oleg Nesterov
@ 2009-06-02 16:28                   ` Peter Zijlstra
  2009-06-02 16:30                     ` Oleg Nesterov
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-02 16:28 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: linux-tip-commits, linux-kernel, acme, paulus, hpa, mingo, jkacur,
	efault, ebiederm, mtosatti, tglx, cjashfor, mingo

On Tue, 2009-06-02 at 17:55 +0200, Oleg Nesterov wrote:
> On 06/02, tip-bot for Peter Zijlstra wrote:
> >
> > +static u32 perf_counter_pid(struct perf_counter *counter, struct task_struct *p)
> > +{
> > +	/*
> > +	 * only top level counters have the pid namespace they were created in
> > +	 */
> > +	if (counter->parent)
> > +		counter = counter->parent;
> > +
> > +	return task_tgid_nr_ns(p, counter->ns);
> > +}
> > +
> > +static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p)
> > +{
> > +	/*
> > +	 * only top level counters have the pid namespace they were created in
> > +	 */
> > +	if (counter->parent)
> > +		counter = counter->parent;
> > +
> > +	return task_pid_nr_ns(p, counter->ns);
> 
> Perhaps this should be
> 
> 	return task_pid_nr_ns(p->group_leader);
> 
> ?

That seems to be exactly what task_tgid_nr_ns() does.

so  pid = task->group_leader->pids[PIDTYPE_PID].pid
and tid = task->pids[PIDTYPE_PID].pid

> > +		tid_entry.pid = perf_counter_pid(counter, current);
> > +		tid_entry.tid = perf_counter_tid(counter, current);
> 
> 
> Otherwise we seem to always report .pid == .tid

tgid vs pid, I don't think they end up being equal. Are they?


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Use PID namespaces properly
  2009-06-02 16:28                   ` Peter Zijlstra
@ 2009-06-02 16:30                     ` Oleg Nesterov
  0 siblings, 0 replies; 1149+ messages in thread
From: Oleg Nesterov @ 2009-06-02 16:30 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-tip-commits, linux-kernel, acme, paulus, hpa, mingo, jkacur,
	efault, ebiederm, mtosatti, tglx, cjashfor, mingo

On 06/02, Peter Zijlstra wrote:
>
> On Tue, 2009-06-02 at 17:55 +0200, Oleg Nesterov wrote:
> > On 06/02, tip-bot for Peter Zijlstra wrote:
> > >
> > > +static u32 perf_counter_pid(struct perf_counter *counter, struct task_struct *p)
> > > +{
> > > +	/*
> > > +	 * only top level counters have the pid namespace they were created in
> > > +	 */
> > > +	if (counter->parent)
> > > +		counter = counter->parent;
> > > +
> > > +	return task_tgid_nr_ns(p, counter->ns);
> > > +}
> > > +
> > > +static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p)
> > > +{
> > > +	/*
> > > +	 * only top level counters have the pid namespace they were created in
> > > +	 */
> > > +	if (counter->parent)
> > > +		counter = counter->parent;
> > > +
> > > +	return task_pid_nr_ns(p, counter->ns);
> > 
> > Perhaps this should be
> > 
> > 	return task_pid_nr_ns(p->group_leader);
> > 
> > ?
> 
> That seems to be exactly what task_tgid_nr_ns() does.

Ah, yes, I didn't notice _tgid_ above.

Oleg.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Remove the last nmi bits
       [not found]             ` <new-submission>
                                 ` (100 preceding siblings ...)
  2009-06-02 14:42               ` [tip:perfcounters/core] perf report: Clean up the default output tip-bot for Ingo Molnar
@ 2009-06-02 20:15               ` tip-bot for Peter Zijlstra
  2009-06-02 20:15               ` [tip:perfcounters/core] x86: Fix atomic_long_xchg() on 64bit tip-bot for Peter Zijlstra
                                 ` (605 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  29c2810276fbf8419c9b4d942b99c873e9b7640a
Gitweb:     http://git.kernel.org/tip/29c2810276fbf8419c9b4d942b99c873e9b7640a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 15:56:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:28 +0200

perf_counter tools: Remove the last nmi bits

Everything is nmi these days, remove the userspace bits so that
the kernel can drop the interface.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |    1 -
 Documentation/perf_counter/builtin-top.c  |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 5886791..644f850 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -84,7 +84,6 @@ static void create_perfstat_counter(int counter)
 	memset(&hw_event, 0, sizeof(hw_event));
 	hw_event.config		= event_id[counter];
 	hw_event.record_type	= 0;
-	hw_event.nmi		= 1;
 	hw_event.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
 	hw_event.exclude_user   = event_mask[counter] & EVENT_MASK_USER;
 
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 24a8879..a2cff7b 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -581,7 +581,6 @@ static int __cmd_top(void)
 			hw_event.config		= event_id[counter];
 			hw_event.irq_period	= event_count[counter];
 			hw_event.record_type	= PERF_RECORD_IP | PERF_RECORD_TID;
-			hw_event.nmi		= 1;
 			hw_event.mmap		= use_mmap;
 			hw_event.munmap		= use_munmap;
 			hw_event.freq		= freq;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] x86: Fix atomic_long_xchg() on 64bit
       [not found]             ` <new-submission>
                                 ` (101 preceding siblings ...)
  2009-06-02 20:15               ` [tip:perfcounters/core] perf_counter tools: Remove the last nmi bits tip-bot for Peter Zijlstra
@ 2009-06-02 20:15               ` tip-bot for Peter Zijlstra
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Add unique counter id tip-bot for Peter Zijlstra
                                 ` (604 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  53e111a730ea8b002d57dd226098c12789993329
Gitweb:     http://git.kernel.org/tip/53e111a730ea8b002d57dd226098c12789993329
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 17:01:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:29 +0200

x86: Fix atomic_long_xchg() on 64bit

Apparently I'm the first to use it :-)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/asm-generic/atomic.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 3673a13..81d3be4 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -134,7 +134,7 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
 #define atomic_long_cmpxchg(l, old, new) \
 	(atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
 #define atomic_long_xchg(v, new) \
-	(atomic64_xchg((atomic64_t *)(l), (new)))
+	(atomic64_xchg((atomic64_t *)(v), (new)))
 
 #else  /*  BITS_PER_LONG == 64  */
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add unique counter id
       [not found]             ` <new-submission>
                                 ` (102 preceding siblings ...)
  2009-06-02 20:15               ` [tip:perfcounters/core] x86: Fix atomic_long_xchg() on 64bit tip-bot for Peter Zijlstra
@ 2009-06-02 20:16               ` tip-bot for Peter Zijlstra
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Rename various fields tip-bot for Peter Zijlstra
                                 ` (603 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, eranian,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  8e5799b1ad2a0567fdfaaf0e91b40efee010f2c1
Gitweb:     http://git.kernel.org/tip/8e5799b1ad2a0567fdfaaf0e91b40efee010f2c1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 15:08:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:29 +0200

perf_counter: Add unique counter id

Stephan raised the issue that we currently cannot distinguish between
similar counters within a group (PERF_RECORD_GROUP uses the config
value as identifier).

Therefore, generate a new ID for each counter using a global u64
sequence counter.

Reported-by: Stephane Eranian <eranian@googlemail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    8 +++++---
 kernel/perf_counter.c        |    9 +++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 9ec20fc..4845a21 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -114,8 +114,9 @@ enum perf_counter_record_format {
  * in increasing order of bit value, after the counter value.
  */
 enum perf_counter_read_format {
-	PERF_FORMAT_TOTAL_TIME_ENABLED	=  1,
-	PERF_FORMAT_TOTAL_TIME_RUNNING	=  2,
+	PERF_FORMAT_TOTAL_TIME_ENABLED	=  1U << 0,
+	PERF_FORMAT_TOTAL_TIME_RUNNING	=  1U << 1,
+	PERF_FORMAT_ID			=  1U << 2,
 };
 
 /*
@@ -290,7 +291,7 @@ enum perf_event_type {
 	 *	{ u32			cpu, res; } && PERF_RECORD_CPU
 	 *
 	 *	{ u64			nr;
-	 *	  { u64 event, val; }	cnt[nr];  } && PERF_RECORD_GROUP
+	 *	  { u64 id, val; }	cnt[nr];  } && PERF_RECORD_GROUP
 	 *
 	 *	{ u16			nr,
 	 *				hv,
@@ -503,6 +504,7 @@ struct perf_counter {
 	struct rcu_head			rcu_head;
 
 	struct pid_namespace		*ns;
+	u64				id;
 #endif
 };
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index caa012c..978ecfc 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1510,6 +1510,8 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
 	if (counter->hw_event.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
 		values[n++] = counter->total_time_running +
 			atomic64_read(&counter->child_total_time_running);
+	if (counter->hw_event.read_format & PERF_FORMAT_ID)
+		values[n++] = counter->id;
 	mutex_unlock(&counter->child_mutex);
 
 	if (count < n * sizeof(u64))
@@ -2303,7 +2305,7 @@ static void perf_counter_output(struct perf_counter *counter,
 		u32 pid, tid;
 	} tid_entry;
 	struct {
-		u64 event;
+		u64 id;
 		u64 counter;
 	} group_entry;
 	struct perf_callchain_entry *callchain = NULL;
@@ -2416,7 +2418,7 @@ static void perf_counter_output(struct perf_counter *counter,
 			if (sub != counter)
 				sub->pmu->read(sub);
 
-			group_entry.event = sub->hw_event.config;
+			group_entry.id = sub->id;
 			group_entry.counter = atomic64_read(&sub->count);
 
 			perf_output_put(&handle, group_entry);
@@ -3375,6 +3377,8 @@ done:
 	return counter;
 }
 
+static atomic64_t perf_counter_id;
+
 /**
  * sys_perf_counter_open - open a performance counter, associate it to a task/cpu
  *
@@ -3470,6 +3474,7 @@ SYSCALL_DEFINE5(perf_counter_open,
 	mutex_unlock(&current->perf_counter_mutex);
 
 	counter->ns = get_pid_ns(current->nsproxy->pid_ns);
+	counter->id = atomic64_inc_return(&perf_counter_id);
 
 	fput_light(counter_file, fput_needed2);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Rename various fields
       [not found]             ` <new-submission>
                                 ` (103 preceding siblings ...)
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Add unique counter id tip-bot for Peter Zijlstra
@ 2009-06-02 20:16               ` tip-bot for Peter Zijlstra
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Remove the last nmi/irq bits tip-bot for Peter Zijlstra
                                 ` (602 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, eranian,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  b23f3325ed465f1bd914384884269af0d106778c
Gitweb:     http://git.kernel.org/tip/b23f3325ed465f1bd914384884269af0d106778c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 15:13:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:30 +0200

perf_counter: Rename various fields

A few renames:

  s/irq_period/sample_period/
  s/irq_freq/sample_freq/
  s/PERF_RECORD_/PERF_SAMPLE_/
  s/record_type/sample_type/

And change both the new sample_type and read_format to u64.

Reported-by: Stephane Eranian <eranian@googlemail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/kernel/perf_counter.c |   12 ++--
 arch/x86/kernel/cpu/perf_counter.c |    8 ++--
 include/linux/perf_counter.h       |   32 ++++++------
 kernel/perf_counter.c              |  104 ++++++++++++++++++------------------
 4 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index f96d55f..c963332 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -535,7 +535,7 @@ void hw_perf_enable(void)
 			continue;
 		}
 		val = 0;
-		if (counter->hw.irq_period) {
+		if (counter->hw.sample_period) {
 			left = atomic64_read(&counter->hw.period_left);
 			if (left < 0x80000000L)
 				val = 0x80000000L - left;
@@ -749,12 +749,12 @@ static void power_pmu_unthrottle(struct perf_counter *counter)
 	s64 val, left;
 	unsigned long flags;
 
-	if (!counter->hw.idx || !counter->hw.irq_period)
+	if (!counter->hw.idx || !counter->hw.sample_period)
 		return;
 	local_irq_save(flags);
 	perf_disable();
 	power_pmu_read(counter);
-	left = counter->hw.irq_period;
+	left = counter->hw.sample_period;
 	val = 0;
 	if (left < 0x80000000L)
 		val = 0x80000000L - left;
@@ -789,7 +789,7 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
 	if (counter->hw_event.exclude_user
 	    || counter->hw_event.exclude_kernel
 	    || counter->hw_event.exclude_hv
-	    || counter->hw_event.irq_period)
+	    || counter->hw_event.sample_period)
 		return 0;
 
 	if (ppmu->limited_pmc_event(ev))
@@ -925,7 +925,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 
 	counter->hw.config = events[n];
 	counter->hw.counter_base = cflags[n];
-	atomic64_set(&counter->hw.period_left, counter->hw.irq_period);
+	atomic64_set(&counter->hw.period_left, counter->hw.sample_period);
 
 	/*
 	 * See if we need to reserve the PMU.
@@ -958,7 +958,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 static void record_and_restart(struct perf_counter *counter, long val,
 			       struct pt_regs *regs, int nmi)
 {
-	u64 period = counter->hw.irq_period;
+	u64 period = counter->hw.sample_period;
 	s64 prev, delta, left;
 	int record = 0;
 	u64 addr, mmcra, sdsync;
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 316b0c9..ec06aa5 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -290,11 +290,11 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	hwc->nmi	= 1;
 	hw_event->nmi	= 1;
 
-	if (!hwc->irq_period)
-		hwc->irq_period = x86_pmu.max_period;
+	if (!hwc->sample_period)
+		hwc->sample_period = x86_pmu.max_period;
 
 	atomic64_set(&hwc->period_left,
-			min(x86_pmu.max_period, hwc->irq_period));
+			min(x86_pmu.max_period, hwc->sample_period));
 
 	/*
 	 * Raw event type provide the config in the event structure
@@ -462,7 +462,7 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 			     struct hw_perf_counter *hwc, int idx)
 {
 	s64 left = atomic64_read(&hwc->period_left);
-	s64 period = min(x86_pmu.max_period, hwc->irq_period);
+	s64 period = min(x86_pmu.max_period, hwc->sample_period);
 	int err;
 
 	/*
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 4845a21..1fcd3cc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -94,18 +94,18 @@ enum sw_event_ids {
 #define PERF_COUNTER_EVENT_MASK		__PERF_COUNTER_MASK(EVENT)
 
 /*
- * Bits that can be set in hw_event.record_type to request information
+ * Bits that can be set in hw_event.sample_type to request information
  * in the overflow packets.
  */
-enum perf_counter_record_format {
-	PERF_RECORD_IP			= 1U << 0,
-	PERF_RECORD_TID			= 1U << 1,
-	PERF_RECORD_TIME		= 1U << 2,
-	PERF_RECORD_ADDR		= 1U << 3,
-	PERF_RECORD_GROUP		= 1U << 4,
-	PERF_RECORD_CALLCHAIN		= 1U << 5,
-	PERF_RECORD_CONFIG		= 1U << 6,
-	PERF_RECORD_CPU			= 1U << 7,
+enum perf_counter_sample_format {
+	PERF_SAMPLE_IP			= 1U << 0,
+	PERF_SAMPLE_TID			= 1U << 1,
+	PERF_SAMPLE_TIME		= 1U << 2,
+	PERF_SAMPLE_ADDR		= 1U << 3,
+	PERF_SAMPLE_GROUP		= 1U << 4,
+	PERF_SAMPLE_CALLCHAIN		= 1U << 5,
+	PERF_SAMPLE_CONFIG		= 1U << 6,
+	PERF_SAMPLE_CPU			= 1U << 7,
 };
 
 /*
@@ -132,12 +132,12 @@ struct perf_counter_hw_event {
 	__u64			config;
 
 	union {
-		__u64		irq_period;
-		__u64		irq_freq;
+		__u64		sample_period;
+		__u64		sample_freq;
 	};
 
-	__u32			record_type;
-	__u32			read_format;
+	__u64			sample_type;
+	__u64			read_format;
 
 	__u64			disabled       :  1, /* off by default        */
 				nmi	       :  1, /* NMI sampling          */
@@ -262,7 +262,7 @@ enum perf_event_type {
 	 * struct {
 	 *	struct perf_event_header	header;
 	 *	u64				time;
-	 *	u64				irq_period;
+	 *	u64				sample_period;
 	 * };
 	 */
 	PERF_EVENT_PERIOD		= 4,
@@ -363,7 +363,7 @@ struct hw_perf_counter {
 		};
 	};
 	atomic64_t			prev_count;
-	u64				irq_period;
+	u64				sample_period;
 	atomic64_t			period_left;
 	u64				interrupts;
 #endif
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 978ecfc..5ecd998 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1186,7 +1186,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period);
 static void perf_adjust_freq(struct perf_counter_context *ctx)
 {
 	struct perf_counter *counter;
-	u64 interrupts, irq_period;
+	u64 interrupts, sample_period;
 	u64 events, period;
 	s64 delta;
 
@@ -1204,23 +1204,23 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 			interrupts = 2*sysctl_perf_counter_limit/HZ;
 		}
 
-		if (!counter->hw_event.freq || !counter->hw_event.irq_freq)
+		if (!counter->hw_event.freq || !counter->hw_event.sample_freq)
 			continue;
 
-		events = HZ * interrupts * counter->hw.irq_period;
-		period = div64_u64(events, counter->hw_event.irq_freq);
+		events = HZ * interrupts * counter->hw.sample_period;
+		period = div64_u64(events, counter->hw_event.sample_freq);
 
-		delta = (s64)(1 + period - counter->hw.irq_period);
+		delta = (s64)(1 + period - counter->hw.sample_period);
 		delta >>= 1;
 
-		irq_period = counter->hw.irq_period + delta;
+		sample_period = counter->hw.sample_period + delta;
 
-		if (!irq_period)
-			irq_period = 1;
+		if (!sample_period)
+			sample_period = 1;
 
-		perf_log_period(counter, irq_period);
+		perf_log_period(counter, sample_period);
 
-		counter->hw.irq_period = irq_period;
+		counter->hw.sample_period = sample_period;
 	}
 	spin_unlock(&ctx->lock);
 }
@@ -2297,7 +2297,7 @@ static void perf_counter_output(struct perf_counter *counter,
 				int nmi, struct pt_regs *regs, u64 addr)
 {
 	int ret;
-	u64 record_type = counter->hw_event.record_type;
+	u64 sample_type = counter->hw_event.sample_type;
 	struct perf_output_handle handle;
 	struct perf_event_header header;
 	u64 ip;
@@ -2321,61 +2321,61 @@ static void perf_counter_output(struct perf_counter *counter,
 	header.misc = PERF_EVENT_MISC_OVERFLOW;
 	header.misc |= perf_misc_flags(regs);
 
-	if (record_type & PERF_RECORD_IP) {
+	if (sample_type & PERF_SAMPLE_IP) {
 		ip = perf_instruction_pointer(regs);
-		header.type |= PERF_RECORD_IP;
+		header.type |= PERF_SAMPLE_IP;
 		header.size += sizeof(ip);
 	}
 
-	if (record_type & PERF_RECORD_TID) {
+	if (sample_type & PERF_SAMPLE_TID) {
 		/* namespace issues */
 		tid_entry.pid = perf_counter_pid(counter, current);
 		tid_entry.tid = perf_counter_tid(counter, current);
 
-		header.type |= PERF_RECORD_TID;
+		header.type |= PERF_SAMPLE_TID;
 		header.size += sizeof(tid_entry);
 	}
 
-	if (record_type & PERF_RECORD_TIME) {
+	if (sample_type & PERF_SAMPLE_TIME) {
 		/*
 		 * Maybe do better on x86 and provide cpu_clock_nmi()
 		 */
 		time = sched_clock();
 
-		header.type |= PERF_RECORD_TIME;
+		header.type |= PERF_SAMPLE_TIME;
 		header.size += sizeof(u64);
 	}
 
-	if (record_type & PERF_RECORD_ADDR) {
-		header.type |= PERF_RECORD_ADDR;
+	if (sample_type & PERF_SAMPLE_ADDR) {
+		header.type |= PERF_SAMPLE_ADDR;
 		header.size += sizeof(u64);
 	}
 
-	if (record_type & PERF_RECORD_CONFIG) {
-		header.type |= PERF_RECORD_CONFIG;
+	if (sample_type & PERF_SAMPLE_CONFIG) {
+		header.type |= PERF_SAMPLE_CONFIG;
 		header.size += sizeof(u64);
 	}
 
-	if (record_type & PERF_RECORD_CPU) {
-		header.type |= PERF_RECORD_CPU;
+	if (sample_type & PERF_SAMPLE_CPU) {
+		header.type |= PERF_SAMPLE_CPU;
 		header.size += sizeof(cpu_entry);
 
 		cpu_entry.cpu = raw_smp_processor_id();
 	}
 
-	if (record_type & PERF_RECORD_GROUP) {
-		header.type |= PERF_RECORD_GROUP;
+	if (sample_type & PERF_SAMPLE_GROUP) {
+		header.type |= PERF_SAMPLE_GROUP;
 		header.size += sizeof(u64) +
 			counter->nr_siblings * sizeof(group_entry);
 	}
 
-	if (record_type & PERF_RECORD_CALLCHAIN) {
+	if (sample_type & PERF_SAMPLE_CALLCHAIN) {
 		callchain = perf_callchain(regs);
 
 		if (callchain) {
 			callchain_size = (1 + callchain->nr) * sizeof(u64);
 
-			header.type |= PERF_RECORD_CALLCHAIN;
+			header.type |= PERF_SAMPLE_CALLCHAIN;
 			header.size += callchain_size;
 		}
 	}
@@ -2386,28 +2386,28 @@ static void perf_counter_output(struct perf_counter *counter,
 
 	perf_output_put(&handle, header);
 
-	if (record_type & PERF_RECORD_IP)
+	if (sample_type & PERF_SAMPLE_IP)
 		perf_output_put(&handle, ip);
 
-	if (record_type & PERF_RECORD_TID)
+	if (sample_type & PERF_SAMPLE_TID)
 		perf_output_put(&handle, tid_entry);
 
-	if (record_type & PERF_RECORD_TIME)
+	if (sample_type & PERF_SAMPLE_TIME)
 		perf_output_put(&handle, time);
 
-	if (record_type & PERF_RECORD_ADDR)
+	if (sample_type & PERF_SAMPLE_ADDR)
 		perf_output_put(&handle, addr);
 
-	if (record_type & PERF_RECORD_CONFIG)
+	if (sample_type & PERF_SAMPLE_CONFIG)
 		perf_output_put(&handle, counter->hw_event.config);
 
-	if (record_type & PERF_RECORD_CPU)
+	if (sample_type & PERF_SAMPLE_CPU)
 		perf_output_put(&handle, cpu_entry);
 
 	/*
-	 * XXX PERF_RECORD_GROUP vs inherited counters seems difficult.
+	 * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult.
 	 */
-	if (record_type & PERF_RECORD_GROUP) {
+	if (sample_type & PERF_SAMPLE_GROUP) {
 		struct perf_counter *leader, *sub;
 		u64 nr = counter->nr_siblings;
 
@@ -2702,7 +2702,7 @@ void perf_counter_munmap(unsigned long addr, unsigned long len,
 }
 
 /*
- * Log irq_period changes so that analyzing tools can re-normalize the
+ * Log sample_period changes so that analyzing tools can re-normalize the
  * event flow.
  */
 
@@ -2725,7 +2725,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period)
 		.period = period,
 	};
 
-	if (counter->hw.irq_period == period)
+	if (counter->hw.sample_period == period)
 		return;
 
 	ret = perf_output_begin(&handle, counter, sizeof(freq_event), 0, 0);
@@ -2834,7 +2834,7 @@ static void perf_swcounter_set_period(struct perf_counter *counter)
 {
 	struct hw_perf_counter *hwc = &counter->hw;
 	s64 left = atomic64_read(&hwc->period_left);
-	s64 period = hwc->irq_period;
+	s64 period = hwc->sample_period;
 
 	if (unlikely(left <= -period)) {
 		left = period;
@@ -2874,7 +2874,7 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 			ret = HRTIMER_NORESTART;
 	}
 
-	period = max_t(u64, 10000, counter->hw.irq_period);
+	period = max_t(u64, 10000, counter->hw.sample_period);
 	hrtimer_forward_now(hrtimer, ns_to_ktime(period));
 
 	return ret;
@@ -2959,7 +2959,7 @@ static void perf_swcounter_add(struct perf_counter *counter, u64 nr,
 {
 	int neg = atomic64_add_negative(nr, &counter->hw.count);
 
-	if (counter->hw.irq_period && !neg && regs)
+	if (counter->hw.sample_period && !neg && regs)
 		perf_swcounter_overflow(counter, nmi, regs, addr);
 }
 
@@ -3080,8 +3080,8 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter)
 	atomic64_set(&hwc->prev_count, cpu_clock(cpu));
 	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	hwc->hrtimer.function = perf_swcounter_hrtimer;
-	if (hwc->irq_period) {
-		u64 period = max_t(u64, 10000, hwc->irq_period);
+	if (hwc->sample_period) {
+		u64 period = max_t(u64, 10000, hwc->sample_period);
 		__hrtimer_start_range_ns(&hwc->hrtimer,
 				ns_to_ktime(period), 0,
 				HRTIMER_MODE_REL, 0);
@@ -3092,7 +3092,7 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter)
 
 static void cpu_clock_perf_counter_disable(struct perf_counter *counter)
 {
-	if (counter->hw.irq_period)
+	if (counter->hw.sample_period)
 		hrtimer_cancel(&counter->hw.hrtimer);
 	cpu_clock_perf_counter_update(counter);
 }
@@ -3132,8 +3132,8 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter)
 	atomic64_set(&hwc->prev_count, now);
 	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	hwc->hrtimer.function = perf_swcounter_hrtimer;
-	if (hwc->irq_period) {
-		u64 period = max_t(u64, 10000, hwc->irq_period);
+	if (hwc->sample_period) {
+		u64 period = max_t(u64, 10000, hwc->sample_period);
 		__hrtimer_start_range_ns(&hwc->hrtimer,
 				ns_to_ktime(period), 0,
 				HRTIMER_MODE_REL, 0);
@@ -3144,7 +3144,7 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter)
 
 static void task_clock_perf_counter_disable(struct perf_counter *counter)
 {
-	if (counter->hw.irq_period)
+	if (counter->hw.sample_period)
 		hrtimer_cancel(&counter->hw.hrtimer);
 	task_clock_perf_counter_update(counter, counter->ctx->time);
 
@@ -3223,7 +3223,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 		return NULL;
 
 	counter->destroy = tp_perf_counter_destroy;
-	counter->hw.irq_period = counter->hw_event.irq_period;
+	counter->hw.sample_period = counter->hw_event.sample_period;
 
 	return &perf_ops_generic;
 }
@@ -3323,15 +3323,15 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,
 	pmu = NULL;
 
 	hwc = &counter->hw;
-	if (hw_event->freq && hw_event->irq_freq)
-		hwc->irq_period = div64_u64(TICK_NSEC, hw_event->irq_freq);
+	if (hw_event->freq && hw_event->sample_freq)
+		hwc->sample_period = div64_u64(TICK_NSEC, hw_event->sample_freq);
 	else
-		hwc->irq_period = hw_event->irq_period;
+		hwc->sample_period = hw_event->sample_period;
 
 	/*
-	 * we currently do not support PERF_RECORD_GROUP on inherited counters
+	 * we currently do not support PERF_SAMPLE_GROUP on inherited counters
 	 */
-	if (hw_event->inherit && (hw_event->record_type & PERF_RECORD_GROUP))
+	if (hw_event->inherit && (hw_event->sample_type & PERF_SAMPLE_GROUP))
 		goto done;
 
 	if (perf_event_raw(hw_event)) {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Remove the last nmi/irq bits
       [not found]             ` <new-submission>
                                 ` (104 preceding siblings ...)
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Rename various fields tip-bot for Peter Zijlstra
@ 2009-06-02 20:16               ` tip-bot for Peter Zijlstra
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: x86: Emulate longer sample periods tip-bot for Peter Zijlstra
                                 ` (601 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  8a016db386195b193e2a8aeddff9fe937dcb7a40
Gitweb:     http://git.kernel.org/tip/8a016db386195b193e2a8aeddff9fe937dcb7a40
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 15:27:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:31 +0200

perf_counter: Remove the last nmi/irq bits

IRQ (non-NMI) sampling is not used anymore - remove the last few bits.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    6 ------
 include/linux/perf_counter.h       |    4 +---
 2 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index ec06aa5..9e144fb 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -284,12 +284,6 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	if (!hw_event->exclude_kernel)
 		hwc->config |= ARCH_PERFMON_EVENTSEL_OS;
 
-	/*
-	 * Use NMI events all the time:
-	 */
-	hwc->nmi	= 1;
-	hw_event->nmi	= 1;
-
 	if (!hwc->sample_period)
 		hwc->sample_period = x86_pmu.max_period;
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 1fcd3cc..cef9931 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -140,7 +140,6 @@ struct perf_counter_hw_event {
 	__u64			read_format;
 
 	__u64			disabled       :  1, /* off by default        */
-				nmi	       :  1, /* NMI sampling          */
 				inherit	       :  1, /* children inherit it   */
 				pinned	       :  1, /* must always be on PMU */
 				exclusive      :  1, /* only group on PMU     */
@@ -153,7 +152,7 @@ struct perf_counter_hw_event {
 				comm	       :  1, /* include comm data     */
 				freq           :  1, /* use freq, not period  */
 
-				__reserved_1   : 51;
+				__reserved_1   : 52;
 
 	__u32			wakeup_events;	/* wakeup every n events */
 	__u32			__reserved_2;
@@ -354,7 +353,6 @@ struct hw_perf_counter {
 			u64				config;
 			unsigned long			config_base;
 			unsigned long			counter_base;
-			int				nmi;
 			int				idx;
 		};
 		union { /* software */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Emulate longer sample periods
       [not found]             ` <new-submission>
                                 ` (105 preceding siblings ...)
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Remove the last nmi/irq bits tip-bot for Peter Zijlstra
@ 2009-06-02 20:16               ` tip-bot for Peter Zijlstra
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Change data head from u32 to u64 tip-bot for Peter Zijlstra
                                 ` (600 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, eranian,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  e4abb5d4f7ddabc1fc7c392cf0a10d8e5868c9ca
Gitweb:     http://git.kernel.org/tip/e4abb5d4f7ddabc1fc7c392cf0a10d8e5868c9ca
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 16:08:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:31 +0200

perf_counter: x86: Emulate longer sample periods

Do as Power already does, emulate sample periods up to 2^63-1 by
composing them of smaller values limited by hardware capabilities.
Only once we wrap the software period do we generate an overflow
event.

Just 10 lines of new code.

Reported-by: Stephane Eranian <eranian@googlemail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 9e144fb..904571b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -287,8 +287,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	if (!hwc->sample_period)
 		hwc->sample_period = x86_pmu.max_period;
 
-	atomic64_set(&hwc->period_left,
-			min(x86_pmu.max_period, hwc->sample_period));
+	atomic64_set(&hwc->period_left, hwc->sample_period);
 
 	/*
 	 * Raw event type provide the config in the event structure
@@ -451,13 +450,13 @@ static DEFINE_PER_CPU(u64, prev_left[X86_PMC_IDX_MAX]);
  * Set the next IRQ period, based on the hwc->period_left value.
  * To be called with the counter disabled in hw:
  */
-static void
+static int
 x86_perf_counter_set_period(struct perf_counter *counter,
 			     struct hw_perf_counter *hwc, int idx)
 {
 	s64 left = atomic64_read(&hwc->period_left);
-	s64 period = min(x86_pmu.max_period, hwc->sample_period);
-	int err;
+	s64 period = hwc->sample_period;
+	int err, ret = 0;
 
 	/*
 	 * If we are way outside a reasoable range then just skip forward:
@@ -465,11 +464,13 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 	if (unlikely(left <= -period)) {
 		left = period;
 		atomic64_set(&hwc->period_left, left);
+		ret = 1;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
 		atomic64_set(&hwc->period_left, left);
+		ret = 1;
 	}
 	/*
 	 * Quirk: certain CPUs dont like it if just 1 event is left:
@@ -477,6 +478,9 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 	if (unlikely(left < 2))
 		left = 2;
 
+	if (left > x86_pmu.max_period)
+		left = x86_pmu.max_period;
+
 	per_cpu(prev_left[idx], smp_processor_id()) = left;
 
 	/*
@@ -487,6 +491,8 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 
 	err = checking_wrmsrl(hwc->counter_base + idx,
 			     (u64)(-left) & x86_pmu.counter_mask);
+
+	return ret;
 }
 
 static inline void
@@ -706,16 +712,19 @@ static void x86_pmu_disable(struct perf_counter *counter)
  * Save and restart an expired counter. Called by NMI contexts,
  * so it has to be careful about preempting normal counter ops:
  */
-static void intel_pmu_save_and_restart(struct perf_counter *counter)
+static int intel_pmu_save_and_restart(struct perf_counter *counter)
 {
 	struct hw_perf_counter *hwc = &counter->hw;
 	int idx = hwc->idx;
+	int ret;
 
 	x86_perf_counter_update(counter, hwc, idx);
-	x86_perf_counter_set_period(counter, hwc, idx);
+	ret = x86_perf_counter_set_period(counter, hwc, idx);
 
 	if (counter->state == PERF_COUNTER_STATE_ACTIVE)
 		intel_pmu_enable_counter(hwc, idx);
+
+	return ret;
 }
 
 static void intel_pmu_reset(void)
@@ -782,7 +791,9 @@ again:
 		if (!test_bit(bit, cpuc->active_mask))
 			continue;
 
-		intel_pmu_save_and_restart(counter);
+		if (!intel_pmu_save_and_restart(counter))
+			continue;
+
 		if (perf_counter_overflow(counter, nmi, regs, 0))
 			intel_pmu_disable_counter(&counter->hw, bit);
 	}
@@ -824,9 +835,11 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
 			continue;
 
 		/* counter overflow */
-		x86_perf_counter_set_period(counter, hwc, idx);
 		handled = 1;
 		inc_irq_stat(apic_perf_irqs);
+		if (!x86_perf_counter_set_period(counter, hwc, idx))
+			continue;
+
 		if (perf_counter_overflow(counter, nmi, regs, 0))
 			amd_pmu_disable_counter(hwc, idx);
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Change data head from u32 to u64
       [not found]             ` <new-submission>
                                 ` (106 preceding siblings ...)
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: x86: Emulate longer sample periods tip-bot for Peter Zijlstra
@ 2009-06-02 20:16               ` tip-bot for Peter Zijlstra
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter: Add ioctl for changing the sample period/frequency tip-bot for Peter Zijlstra
                                 ` (599 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, eranian, a.p.zijlstra, tglx, mingo

Commit-ID:  8e3747c13c39246c7e46def7cf495d9d21d4c5f9
Gitweb:     http://git.kernel.org/tip/8e3747c13c39246c7e46def7cf495d9d21d4c5f9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 16:16:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:32 +0200

perf_counter: Change data head from u32 to u64

Since some people worried that 4G might not be a large enough
as an mmap data window, extend it to 64 bit for capable
platforms.

Reported-by: Stephane Eranian <eranian@googlemail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    7 ++++---
 kernel/perf_counter.c        |   15 ++++++++-------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index cef9931..c046f7d 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -212,7 +212,7 @@ struct perf_counter_mmap_page {
 	 * User-space reading this value should issue an rmb(), on SMP capable
 	 * platforms, after reading this value -- see perf_counter_wakeup().
 	 */
-	__u32   data_head;		/* head in the data section */
+	__u64   data_head;		/* head in the data section */
 };
 
 #define PERF_EVENT_MISC_CPUMODE_MASK	(3 << 0)
@@ -397,10 +397,11 @@ struct perf_mmap_data {
 	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
-	atomic_t			head;		/* write position    */
 	atomic_t			events;		/* event limit       */
 
-	atomic_t			done_head;	/* completed head    */
+	atomic_long_t			head;		/* write position    */
+	atomic_long_t			done_head;	/* completed head    */
+
 	atomic_t			lock;		/* concurrent writes */
 
 	atomic_t			wakeup;		/* needs a wakeup    */
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 5ecd998..3f11a2b 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2067,8 +2067,8 @@ __weak struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
 struct perf_output_handle {
 	struct perf_counter	*counter;
 	struct perf_mmap_data	*data;
-	unsigned int		offset;
-	unsigned int		head;
+	unsigned long		head;
+	unsigned long		offset;
 	int			nmi;
 	int			overflow;
 	int			locked;
@@ -2122,7 +2122,8 @@ static void perf_output_lock(struct perf_output_handle *handle)
 static void perf_output_unlock(struct perf_output_handle *handle)
 {
 	struct perf_mmap_data *data = handle->data;
-	int head, cpu;
+	unsigned long head;
+	int cpu;
 
 	data->done_head = data->head;
 
@@ -2135,7 +2136,7 @@ again:
 	 * before we publish the new head, matched by a rmb() in userspace when
 	 * reading this position.
 	 */
-	while ((head = atomic_xchg(&data->done_head, 0)))
+	while ((head = atomic_long_xchg(&data->done_head, 0)))
 		data->user_page->data_head = head;
 
 	/*
@@ -2148,7 +2149,7 @@ again:
 	/*
 	 * Therefore we have to validate we did not indeed do so.
 	 */
-	if (unlikely(atomic_read(&data->done_head))) {
+	if (unlikely(atomic_long_read(&data->done_head))) {
 		/*
 		 * Since we had it locked, we can lock it again.
 		 */
@@ -2195,7 +2196,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
 	do {
 		offset = head = atomic_read(&data->head);
 		head += size;
-	} while (atomic_cmpxchg(&data->head, offset, head) != offset);
+	} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
 
 	handle->offset	= offset;
 	handle->head	= head;
@@ -2246,7 +2247,7 @@ static void perf_output_copy(struct perf_output_handle *handle,
 	 * Check we didn't copy past our reservation window, taking the
 	 * possible unsigned int wrap into account.
 	 */
-	WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
+	WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0);
 }
 
 #define perf_output_put(handle, x) \

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add ioctl for changing the sample period/frequency
       [not found]             ` <new-submission>
                                 ` (107 preceding siblings ...)
  2009-06-02 20:16               ` [tip:perfcounters/core] perf_counter: Change data head from u32 to u64 tip-bot for Peter Zijlstra
@ 2009-06-02 20:17               ` tip-bot for Peter Zijlstra
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter: Rename perf_counter_hw_event => perf_counter_attr tip-bot for Peter Zijlstra
                                 ` (598 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, eranian,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  08247e31ca79b8f02cce47b7e8120797a8726606
Gitweb:     http://git.kernel.org/tip/08247e31ca79b8f02cce47b7e8120797a8726606
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 16:46:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:32 +0200

perf_counter: Add ioctl for changing the sample period/frequency

Reported-by: Stephane Eranian <eranian@googlemail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    9 +++++----
 kernel/perf_counter.c        |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index c046f7d..45bdd3b 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -164,10 +164,11 @@ struct perf_counter_hw_event {
 /*
  * Ioctls that can be done on a perf counter fd:
  */
-#define PERF_COUNTER_IOC_ENABLE		_IOW('$', 0, u32)
-#define PERF_COUNTER_IOC_DISABLE	_IOW('$', 1, u32)
-#define PERF_COUNTER_IOC_REFRESH	_IOW('$', 2, u32)
-#define PERF_COUNTER_IOC_RESET		_IOW('$', 3, u32)
+#define PERF_COUNTER_IOC_ENABLE		_IO ('$', 0)
+#define PERF_COUNTER_IOC_DISABLE	_IO ('$', 1)
+#define PERF_COUNTER_IOC_REFRESH	_IO ('$', 2)
+#define PERF_COUNTER_IOC_RESET		_IO ('$', 3)
+#define PERF_COUNTER_IOC_PERIOD		_IOW('$', 4, u64)
 
 enum perf_counter_ioc_flags {
 	PERF_IOC_FLAG_GROUP		= 1U << 0,
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 3f11a2b..abe2f3b 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1604,6 +1604,43 @@ static void perf_counter_for_each(struct perf_counter *counter,
 	mutex_unlock(&counter->child_mutex);
 }
 
+static int perf_counter_period(struct perf_counter *counter, u64 __user *arg)
+{
+	struct perf_counter_context *ctx = counter->ctx;
+	unsigned long size;
+	int ret = 0;
+	u64 value;
+
+	if (!counter->hw_event.sample_period)
+		return -EINVAL;
+
+	size = copy_from_user(&value, arg, sizeof(value));
+	if (size != sizeof(value))
+		return -EFAULT;
+
+	if (!value)
+		return -EINVAL;
+
+	spin_lock_irq(&ctx->lock);
+	if (counter->hw_event.freq) {
+		if (value > sysctl_perf_counter_limit) {
+			ret = -EINVAL;
+			goto unlock;
+		}
+
+		counter->hw_event.sample_freq = value;
+	} else {
+		counter->hw_event.sample_period = value;
+		counter->hw.sample_period = value;
+
+		perf_log_period(counter, value);
+	}
+unlock:
+	spin_unlock_irq(&ctx->lock);
+
+	return ret;
+}
+
 static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct perf_counter *counter = file->private_data;
@@ -1623,6 +1660,10 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	case PERF_COUNTER_IOC_REFRESH:
 		return perf_counter_refresh(counter, arg);
+
+	case PERF_COUNTER_IOC_PERIOD:
+		return perf_counter_period(counter, (u64 __user *)arg);
+
 	default:
 		return -ENOTTY;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Rename perf_counter_hw_event => perf_counter_attr
       [not found]             ` <new-submission>
                                 ` (108 preceding siblings ...)
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter: Add ioctl for changing the sample period/frequency tip-bot for Peter Zijlstra
@ 2009-06-02 20:17               ` tip-bot for Peter Zijlstra
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter tools: Fix up the ABI shakeup tip-bot for Peter Zijlstra
                                 ` (597 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, eranian, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  0d48696f87e3618b0d35bd3e4e9d7c188d51e7de
Gitweb:     http://git.kernel.org/tip/0d48696f87e3618b0d35bd3e4e9d7c188d51e7de
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 19:22:16 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:33 +0200

perf_counter: Rename perf_counter_hw_event => perf_counter_attr

The structure isn't hw only and when I read event, I think about those
things that fall out the other end. Rename the thing.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/kernel/perf_counter.c |   38 ++++++------
 arch/x86/kernel/cpu/perf_counter.c |   16 +++---
 include/linux/perf_counter.h       |   34 +++++-----
 include/linux/syscalls.h           |    4 +-
 kernel/perf_counter.c              |  116 ++++++++++++++++++------------------
 5 files changed, 104 insertions(+), 104 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index c963332..ea54686 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -262,13 +262,13 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[],
 		}
 		counter = ctrs[i];
 		if (first) {
-			eu = counter->hw_event.exclude_user;
-			ek = counter->hw_event.exclude_kernel;
-			eh = counter->hw_event.exclude_hv;
+			eu = counter->attr.exclude_user;
+			ek = counter->attr.exclude_kernel;
+			eh = counter->attr.exclude_hv;
 			first = 0;
-		} else if (counter->hw_event.exclude_user != eu ||
-			   counter->hw_event.exclude_kernel != ek ||
-			   counter->hw_event.exclude_hv != eh) {
+		} else if (counter->attr.exclude_user != eu ||
+			   counter->attr.exclude_kernel != ek ||
+			   counter->attr.exclude_hv != eh) {
 			return -EAGAIN;
 		}
 	}
@@ -483,16 +483,16 @@ void hw_perf_enable(void)
 
 	/*
 	 * Add in MMCR0 freeze bits corresponding to the
-	 * hw_event.exclude_* bits for the first counter.
+	 * attr.exclude_* bits for the first counter.
 	 * We have already checked that all counters have the
 	 * same values for these bits as the first counter.
 	 */
 	counter = cpuhw->counter[0];
-	if (counter->hw_event.exclude_user)
+	if (counter->attr.exclude_user)
 		cpuhw->mmcr[0] |= MMCR0_FCP;
-	if (counter->hw_event.exclude_kernel)
+	if (counter->attr.exclude_kernel)
 		cpuhw->mmcr[0] |= freeze_counters_kernel;
-	if (counter->hw_event.exclude_hv)
+	if (counter->attr.exclude_hv)
 		cpuhw->mmcr[0] |= MMCR0_FCHV;
 
 	/*
@@ -786,10 +786,10 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
 	int n;
 	u64 alt[MAX_EVENT_ALTERNATIVES];
 
-	if (counter->hw_event.exclude_user
-	    || counter->hw_event.exclude_kernel
-	    || counter->hw_event.exclude_hv
-	    || counter->hw_event.sample_period)
+	if (counter->attr.exclude_user
+	    || counter->attr.exclude_kernel
+	    || counter->attr.exclude_hv
+	    || counter->attr.sample_period)
 		return 0;
 
 	if (ppmu->limited_pmc_event(ev))
@@ -855,13 +855,13 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 
 	if (!ppmu)
 		return ERR_PTR(-ENXIO);
-	if (!perf_event_raw(&counter->hw_event)) {
-		ev = perf_event_id(&counter->hw_event);
+	if (!perf_event_raw(&counter->attr)) {
+		ev = perf_event_id(&counter->attr);
 		if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
 			return ERR_PTR(-EOPNOTSUPP);
 		ev = ppmu->generic_events[ev];
 	} else {
-		ev = perf_event_config(&counter->hw_event);
+		ev = perf_event_config(&counter->attr);
 	}
 	counter->hw.config_base = ev;
 	counter->hw.idx = 0;
@@ -872,7 +872,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 	 * the user set it to.
 	 */
 	if (!firmware_has_feature(FW_FEATURE_LPAR))
-		counter->hw_event.exclude_hv = 0;
+		counter->attr.exclude_hv = 0;
 
 	/*
 	 * If this is a per-task counter, then we can use
@@ -990,7 +990,7 @@ static void record_and_restart(struct perf_counter *counter, long val,
 	 */
 	if (record) {
 		addr = 0;
-		if (counter->hw_event.record_type & PERF_RECORD_ADDR) {
+		if (counter->attr.record_type & PERF_RECORD_ADDR) {
 			/*
 			 * The user wants a data address recorded.
 			 * If we're not doing instruction sampling,
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 904571b..e16e8c1 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -247,11 +247,11 @@ static inline int x86_pmu_initialized(void)
 }
 
 /*
- * Setup the hardware configuration for a given hw_event_type
+ * Setup the hardware configuration for a given attr_type
  */
 static int __hw_perf_counter_init(struct perf_counter *counter)
 {
-	struct perf_counter_hw_event *hw_event = &counter->hw_event;
+	struct perf_counter_attr *attr = &counter->attr;
 	struct hw_perf_counter *hwc = &counter->hw;
 	int err;
 
@@ -279,9 +279,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	/*
 	 * Count user and OS events unless requested not to.
 	 */
-	if (!hw_event->exclude_user)
+	if (!attr->exclude_user)
 		hwc->config |= ARCH_PERFMON_EVENTSEL_USR;
-	if (!hw_event->exclude_kernel)
+	if (!attr->exclude_kernel)
 		hwc->config |= ARCH_PERFMON_EVENTSEL_OS;
 
 	if (!hwc->sample_period)
@@ -292,15 +292,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	/*
 	 * Raw event type provide the config in the event structure
 	 */
-	if (perf_event_raw(hw_event)) {
-		hwc->config |= x86_pmu.raw_event(perf_event_config(hw_event));
+	if (perf_event_raw(attr)) {
+		hwc->config |= x86_pmu.raw_event(perf_event_config(attr));
 	} else {
-		if (perf_event_id(hw_event) >= x86_pmu.max_events)
+		if (perf_event_id(attr) >= x86_pmu.max_events)
 			return -EINVAL;
 		/*
 		 * The generic map:
 		 */
-		hwc->config |= x86_pmu.event_map(perf_event_id(hw_event));
+		hwc->config |= x86_pmu.event_map(perf_event_id(attr));
 	}
 
 	counter->destroy = hw_perf_counter_destroy;
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 45bdd3b..37d5541 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -22,7 +22,7 @@
  */
 
 /*
- * hw_event.type
+ * attr.type
  */
 enum perf_event_types {
 	PERF_TYPE_HARDWARE		= 0,
@@ -37,10 +37,10 @@ enum perf_event_types {
 };
 
 /*
- * Generalized performance counter event types, used by the hw_event.event_id
+ * Generalized performance counter event types, used by the attr.event_id
  * parameter of the sys_perf_counter_open() syscall:
  */
-enum hw_event_ids {
+enum attr_ids {
 	/*
 	 * Common hardware events, generalized by the kernel:
 	 */
@@ -94,7 +94,7 @@ enum sw_event_ids {
 #define PERF_COUNTER_EVENT_MASK		__PERF_COUNTER_MASK(EVENT)
 
 /*
- * Bits that can be set in hw_event.sample_type to request information
+ * Bits that can be set in attr.sample_type to request information
  * in the overflow packets.
  */
 enum perf_counter_sample_format {
@@ -109,7 +109,7 @@ enum perf_counter_sample_format {
 };
 
 /*
- * Bits that can be set in hw_event.read_format to request that
+ * Bits that can be set in attr.read_format to request that
  * reads on the counter should return the indicated quantities,
  * in increasing order of bit value, after the counter value.
  */
@@ -122,7 +122,7 @@ enum perf_counter_read_format {
 /*
  * Hardware event to monitor via a performance monitoring counter:
  */
-struct perf_counter_hw_event {
+struct perf_counter_attr {
 	/*
 	 * The MSB of the config word signifies if the rest contains cpu
 	 * specific (raw) counter configuration data, if unset, the next
@@ -323,25 +323,25 @@ enum perf_event_type {
 
 struct task_struct;
 
-static inline u64 perf_event_raw(struct perf_counter_hw_event *hw_event)
+static inline u64 perf_event_raw(struct perf_counter_attr *attr)
 {
-	return hw_event->config & PERF_COUNTER_RAW_MASK;
+	return attr->config & PERF_COUNTER_RAW_MASK;
 }
 
-static inline u64 perf_event_config(struct perf_counter_hw_event *hw_event)
+static inline u64 perf_event_config(struct perf_counter_attr *attr)
 {
-	return hw_event->config & PERF_COUNTER_CONFIG_MASK;
+	return attr->config & PERF_COUNTER_CONFIG_MASK;
 }
 
-static inline u64 perf_event_type(struct perf_counter_hw_event *hw_event)
+static inline u64 perf_event_type(struct perf_counter_attr *attr)
 {
-	return (hw_event->config & PERF_COUNTER_TYPE_MASK) >>
+	return (attr->config & PERF_COUNTER_TYPE_MASK) >>
 		PERF_COUNTER_TYPE_SHIFT;
 }
 
-static inline u64 perf_event_id(struct perf_counter_hw_event *hw_event)
+static inline u64 perf_event_id(struct perf_counter_attr *attr)
 {
-	return hw_event->config & PERF_COUNTER_EVENT_MASK;
+	return attr->config & PERF_COUNTER_EVENT_MASK;
 }
 
 /**
@@ -457,7 +457,7 @@ struct perf_counter {
 	u64				tstamp_running;
 	u64				tstamp_stopped;
 
-	struct perf_counter_hw_event	hw_event;
+	struct perf_counter_attr	attr;
 	struct hw_perf_counter		hw;
 
 	struct perf_counter_context	*ctx;
@@ -605,8 +605,8 @@ extern int perf_counter_overflow(struct perf_counter *counter,
  */
 static inline int is_software_counter(struct perf_counter *counter)
 {
-	return !perf_event_raw(&counter->hw_event) &&
-		perf_event_type(&counter->hw_event) != PERF_TYPE_HARDWARE;
+	return !perf_event_raw(&counter->attr) &&
+		perf_event_type(&counter->attr) != PERF_TYPE_HARDWARE;
 }
 
 extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 79faae9..c6c84ad 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -55,7 +55,7 @@ struct compat_timeval;
 struct robust_list_head;
 struct getcpu_cache;
 struct old_linux_dirent;
-struct perf_counter_hw_event;
+struct perf_counter_attr;
 
 #include <linux/types.h>
 #include <linux/aio_abi.h>
@@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
 
 
 asmlinkage long sys_perf_counter_open(
-		const struct perf_counter_hw_event __user *hw_event_uptr,
+		const struct perf_counter_attr __user *attr_uptr,
 		pid_t pid, int cpu, int group_fd, unsigned long flags);
 #endif
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index abe2f3b..317cef7 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -260,7 +260,7 @@ counter_sched_out(struct perf_counter *counter,
 	if (!is_software_counter(counter))
 		cpuctx->active_oncpu--;
 	ctx->nr_active--;
-	if (counter->hw_event.exclusive || !cpuctx->active_oncpu)
+	if (counter->attr.exclusive || !cpuctx->active_oncpu)
 		cpuctx->exclusive = 0;
 }
 
@@ -282,7 +282,7 @@ group_sched_out(struct perf_counter *group_counter,
 	list_for_each_entry(counter, &group_counter->sibling_list, list_entry)
 		counter_sched_out(counter, cpuctx, ctx);
 
-	if (group_counter->hw_event.exclusive)
+	if (group_counter->attr.exclusive)
 		cpuctx->exclusive = 0;
 }
 
@@ -550,7 +550,7 @@ counter_sched_in(struct perf_counter *counter,
 		cpuctx->active_oncpu++;
 	ctx->nr_active++;
 
-	if (counter->hw_event.exclusive)
+	if (counter->attr.exclusive)
 		cpuctx->exclusive = 1;
 
 	return 0;
@@ -642,7 +642,7 @@ static int group_can_go_on(struct perf_counter *counter,
 	 * If this group is exclusive and there are already
 	 * counters on the CPU, it can't go on.
 	 */
-	if (counter->hw_event.exclusive && cpuctx->active_oncpu)
+	if (counter->attr.exclusive && cpuctx->active_oncpu)
 		return 0;
 	/*
 	 * Otherwise, try to add it if all previous groups were able
@@ -725,7 +725,7 @@ static void __perf_install_in_context(void *info)
 		 */
 		if (leader != counter)
 			group_sched_out(leader, cpuctx, ctx);
-		if (leader->hw_event.pinned) {
+		if (leader->attr.pinned) {
 			update_group_times(leader);
 			leader->state = PERF_COUNTER_STATE_ERROR;
 		}
@@ -849,7 +849,7 @@ static void __perf_counter_enable(void *info)
 		 */
 		if (leader != counter)
 			group_sched_out(leader, cpuctx, ctx);
-		if (leader->hw_event.pinned) {
+		if (leader->attr.pinned) {
 			update_group_times(leader);
 			leader->state = PERF_COUNTER_STATE_ERROR;
 		}
@@ -927,7 +927,7 @@ static int perf_counter_refresh(struct perf_counter *counter, int refresh)
 	/*
 	 * not supported on inherited counters
 	 */
-	if (counter->hw_event.inherit)
+	if (counter->attr.inherit)
 		return -EINVAL;
 
 	atomic_add(refresh, &counter->event_limit);
@@ -1094,7 +1094,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 	 */
 	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
 		if (counter->state <= PERF_COUNTER_STATE_OFF ||
-		    !counter->hw_event.pinned)
+		    !counter->attr.pinned)
 			continue;
 		if (counter->cpu != -1 && counter->cpu != cpu)
 			continue;
@@ -1122,7 +1122,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 		 * ignore pinned counters since we did them already.
 		 */
 		if (counter->state <= PERF_COUNTER_STATE_OFF ||
-		    counter->hw_event.pinned)
+		    counter->attr.pinned)
 			continue;
 
 		/*
@@ -1204,11 +1204,11 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 			interrupts = 2*sysctl_perf_counter_limit/HZ;
 		}
 
-		if (!counter->hw_event.freq || !counter->hw_event.sample_freq)
+		if (!counter->attr.freq || !counter->attr.sample_freq)
 			continue;
 
 		events = HZ * interrupts * counter->hw.sample_period;
-		period = div64_u64(events, counter->hw_event.sample_freq);
+		period = div64_u64(events, counter->attr.sample_freq);
 
 		delta = (s64)(1 + period - counter->hw.sample_period);
 		delta >>= 1;
@@ -1444,11 +1444,11 @@ static void free_counter(struct perf_counter *counter)
 	perf_pending_sync(counter);
 
 	atomic_dec(&nr_counters);
-	if (counter->hw_event.mmap)
+	if (counter->attr.mmap)
 		atomic_dec(&nr_mmap_tracking);
-	if (counter->hw_event.munmap)
+	if (counter->attr.munmap)
 		atomic_dec(&nr_munmap_tracking);
-	if (counter->hw_event.comm)
+	if (counter->attr.comm)
 		atomic_dec(&nr_comm_tracking);
 
 	if (counter->destroy)
@@ -1504,13 +1504,13 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
 	mutex_lock(&counter->child_mutex);
 	values[0] = perf_counter_read(counter);
 	n = 1;
-	if (counter->hw_event.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
+	if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
 		values[n++] = counter->total_time_enabled +
 			atomic64_read(&counter->child_total_time_enabled);
-	if (counter->hw_event.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
+	if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
 		values[n++] = counter->total_time_running +
 			atomic64_read(&counter->child_total_time_running);
-	if (counter->hw_event.read_format & PERF_FORMAT_ID)
+	if (counter->attr.read_format & PERF_FORMAT_ID)
 		values[n++] = counter->id;
 	mutex_unlock(&counter->child_mutex);
 
@@ -1611,7 +1611,7 @@ static int perf_counter_period(struct perf_counter *counter, u64 __user *arg)
 	int ret = 0;
 	u64 value;
 
-	if (!counter->hw_event.sample_period)
+	if (!counter->attr.sample_period)
 		return -EINVAL;
 
 	size = copy_from_user(&value, arg, sizeof(value));
@@ -1622,15 +1622,15 @@ static int perf_counter_period(struct perf_counter *counter, u64 __user *arg)
 		return -EINVAL;
 
 	spin_lock_irq(&ctx->lock);
-	if (counter->hw_event.freq) {
+	if (counter->attr.freq) {
 		if (value > sysctl_perf_counter_limit) {
 			ret = -EINVAL;
 			goto unlock;
 		}
 
-		counter->hw_event.sample_freq = value;
+		counter->attr.sample_freq = value;
 	} else {
-		counter->hw_event.sample_period = value;
+		counter->attr.sample_period = value;
 		counter->hw.sample_period = value;
 
 		perf_log_period(counter, value);
@@ -2299,7 +2299,7 @@ static void perf_output_end(struct perf_output_handle *handle)
 	struct perf_counter *counter = handle->counter;
 	struct perf_mmap_data *data = handle->data;
 
-	int wakeup_events = counter->hw_event.wakeup_events;
+	int wakeup_events = counter->attr.wakeup_events;
 
 	if (handle->overflow && wakeup_events) {
 		int events = atomic_inc_return(&data->events);
@@ -2339,7 +2339,7 @@ static void perf_counter_output(struct perf_counter *counter,
 				int nmi, struct pt_regs *regs, u64 addr)
 {
 	int ret;
-	u64 sample_type = counter->hw_event.sample_type;
+	u64 sample_type = counter->attr.sample_type;
 	struct perf_output_handle handle;
 	struct perf_event_header header;
 	u64 ip;
@@ -2441,7 +2441,7 @@ static void perf_counter_output(struct perf_counter *counter,
 		perf_output_put(&handle, addr);
 
 	if (sample_type & PERF_SAMPLE_CONFIG)
-		perf_output_put(&handle, counter->hw_event.config);
+		perf_output_put(&handle, counter->attr.config);
 
 	if (sample_type & PERF_SAMPLE_CPU)
 		perf_output_put(&handle, cpu_entry);
@@ -2512,7 +2512,7 @@ static void perf_counter_comm_output(struct perf_counter *counter,
 static int perf_counter_comm_match(struct perf_counter *counter,
 				   struct perf_comm_event *comm_event)
 {
-	if (counter->hw_event.comm &&
+	if (counter->attr.comm &&
 	    comm_event->event.header.type == PERF_EVENT_COMM)
 		return 1;
 
@@ -2623,11 +2623,11 @@ static void perf_counter_mmap_output(struct perf_counter *counter,
 static int perf_counter_mmap_match(struct perf_counter *counter,
 				   struct perf_mmap_event *mmap_event)
 {
-	if (counter->hw_event.mmap &&
+	if (counter->attr.mmap &&
 	    mmap_event->event.header.type == PERF_EVENT_MMAP)
 		return 1;
 
-	if (counter->hw_event.munmap &&
+	if (counter->attr.munmap &&
 	    mmap_event->event.header.type == PERF_EVENT_MUNMAP)
 		return 1;
 
@@ -2907,8 +2907,8 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 	 * In case we exclude kernel IPs or are somehow not in interrupt
 	 * context, provide the next best thing, the user IP.
 	 */
-	if ((counter->hw_event.exclude_kernel || !regs) &&
-			!counter->hw_event.exclude_user)
+	if ((counter->attr.exclude_kernel || !regs) &&
+			!counter->attr.exclude_user)
 		regs = task_pt_regs(current);
 
 	if (regs) {
@@ -2982,14 +2982,14 @@ static int perf_swcounter_match(struct perf_counter *counter,
 	if (!perf_swcounter_is_counting(counter))
 		return 0;
 
-	if (counter->hw_event.config != event_config)
+	if (counter->attr.config != event_config)
 		return 0;
 
 	if (regs) {
-		if (counter->hw_event.exclude_user && user_mode(regs))
+		if (counter->attr.exclude_user && user_mode(regs))
 			return 0;
 
-		if (counter->hw_event.exclude_kernel && !user_mode(regs))
+		if (counter->attr.exclude_kernel && !user_mode(regs))
 			return 0;
 	}
 
@@ -3252,12 +3252,12 @@ extern void ftrace_profile_disable(int);
 
 static void tp_perf_counter_destroy(struct perf_counter *counter)
 {
-	ftrace_profile_disable(perf_event_id(&counter->hw_event));
+	ftrace_profile_disable(perf_event_id(&counter->attr));
 }
 
 static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 {
-	int event_id = perf_event_id(&counter->hw_event);
+	int event_id = perf_event_id(&counter->attr);
 	int ret;
 
 	ret = ftrace_profile_enable(event_id);
@@ -3265,7 +3265,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 		return NULL;
 
 	counter->destroy = tp_perf_counter_destroy;
-	counter->hw.sample_period = counter->hw_event.sample_period;
+	counter->hw.sample_period = counter->attr.sample_period;
 
 	return &perf_ops_generic;
 }
@@ -3287,7 +3287,7 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	 * to be kernel events, and page faults are never hypervisor
 	 * events.
 	 */
-	switch (perf_event_id(&counter->hw_event)) {
+	switch (perf_event_id(&counter->attr)) {
 	case PERF_COUNT_CPU_CLOCK:
 		pmu = &perf_ops_cpu_clock;
 
@@ -3319,7 +3319,7 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
  * Allocate and initialize a counter structure
  */
 static struct perf_counter *
-perf_counter_alloc(struct perf_counter_hw_event *hw_event,
+perf_counter_alloc(struct perf_counter_attr *attr,
 		   int cpu,
 		   struct perf_counter_context *ctx,
 		   struct perf_counter *group_leader,
@@ -3352,36 +3352,36 @@ perf_counter_alloc(struct perf_counter_hw_event *hw_event,
 	mutex_init(&counter->mmap_mutex);
 
 	counter->cpu			= cpu;
-	counter->hw_event		= *hw_event;
+	counter->attr		= *attr;
 	counter->group_leader		= group_leader;
 	counter->pmu			= NULL;
 	counter->ctx			= ctx;
 	counter->oncpu			= -1;
 
 	counter->state = PERF_COUNTER_STATE_INACTIVE;
-	if (hw_event->disabled)
+	if (attr->disabled)
 		counter->state = PERF_COUNTER_STATE_OFF;
 
 	pmu = NULL;
 
 	hwc = &counter->hw;
-	if (hw_event->freq && hw_event->sample_freq)
-		hwc->sample_period = div64_u64(TICK_NSEC, hw_event->sample_freq);
+	if (attr->freq && attr->sample_freq)
+		hwc->sample_period = div64_u64(TICK_NSEC, attr->sample_freq);
 	else
-		hwc->sample_period = hw_event->sample_period;
+		hwc->sample_period = attr->sample_period;
 
 	/*
 	 * we currently do not support PERF_SAMPLE_GROUP on inherited counters
 	 */
-	if (hw_event->inherit && (hw_event->sample_type & PERF_SAMPLE_GROUP))
+	if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP))
 		goto done;
 
-	if (perf_event_raw(hw_event)) {
+	if (perf_event_raw(attr)) {
 		pmu = hw_perf_counter_init(counter);
 		goto done;
 	}
 
-	switch (perf_event_type(hw_event)) {
+	switch (perf_event_type(attr)) {
 	case PERF_TYPE_HARDWARE:
 		pmu = hw_perf_counter_init(counter);
 		break;
@@ -3409,11 +3409,11 @@ done:
 	counter->pmu = pmu;
 
 	atomic_inc(&nr_counters);
-	if (counter->hw_event.mmap)
+	if (counter->attr.mmap)
 		atomic_inc(&nr_mmap_tracking);
-	if (counter->hw_event.munmap)
+	if (counter->attr.munmap)
 		atomic_inc(&nr_munmap_tracking);
-	if (counter->hw_event.comm)
+	if (counter->attr.comm)
 		atomic_inc(&nr_comm_tracking);
 
 	return counter;
@@ -3424,17 +3424,17 @@ static atomic64_t perf_counter_id;
 /**
  * sys_perf_counter_open - open a performance counter, associate it to a task/cpu
  *
- * @hw_event_uptr:	event type attributes for monitoring/sampling
+ * @attr_uptr:	event type attributes for monitoring/sampling
  * @pid:		target pid
  * @cpu:		target cpu
  * @group_fd:		group leader counter fd
  */
 SYSCALL_DEFINE5(perf_counter_open,
-		const struct perf_counter_hw_event __user *, hw_event_uptr,
+		const struct perf_counter_attr __user *, attr_uptr,
 		pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
 {
 	struct perf_counter *counter, *group_leader;
-	struct perf_counter_hw_event hw_event;
+	struct perf_counter_attr attr;
 	struct perf_counter_context *ctx;
 	struct file *counter_file = NULL;
 	struct file *group_file = NULL;
@@ -3446,7 +3446,7 @@ SYSCALL_DEFINE5(perf_counter_open,
 	if (flags)
 		return -EINVAL;
 
-	if (copy_from_user(&hw_event, hw_event_uptr, sizeof(hw_event)) != 0)
+	if (copy_from_user(&attr, attr_uptr, sizeof(attr)) != 0)
 		return -EFAULT;
 
 	/*
@@ -3484,11 +3484,11 @@ SYSCALL_DEFINE5(perf_counter_open,
 		/*
 		 * Only a group leader can be exclusive or pinned
 		 */
-		if (hw_event.exclusive || hw_event.pinned)
+		if (attr.exclusive || attr.pinned)
 			goto err_put_context;
 	}
 
-	counter = perf_counter_alloc(&hw_event, cpu, ctx, group_leader,
+	counter = perf_counter_alloc(&attr, cpu, ctx, group_leader,
 				     GFP_KERNEL);
 	ret = PTR_ERR(counter);
 	if (IS_ERR(counter))
@@ -3556,7 +3556,7 @@ inherit_counter(struct perf_counter *parent_counter,
 	if (parent_counter->parent)
 		parent_counter = parent_counter->parent;
 
-	child_counter = perf_counter_alloc(&parent_counter->hw_event,
+	child_counter = perf_counter_alloc(&parent_counter->attr,
 					   parent_counter->cpu, child_ctx,
 					   group_leader, GFP_KERNEL);
 	if (IS_ERR(child_counter))
@@ -3565,7 +3565,7 @@ inherit_counter(struct perf_counter *parent_counter,
 
 	/*
 	 * Make the child state follow the state of the parent counter,
-	 * not its hw_event.disabled bit.  We hold the parent's mutex,
+	 * not its attr.disabled bit.  We hold the parent's mutex,
 	 * so we won't race with perf_counter_{en, dis}able_family.
 	 */
 	if (parent_counter->state >= PERF_COUNTER_STATE_INACTIVE)
@@ -3582,7 +3582,7 @@ inherit_counter(struct perf_counter *parent_counter,
 	/*
 	 * inherit into child's child as well:
 	 */
-	child_counter->hw_event.inherit = 1;
+	child_counter->attr.inherit = 1;
 
 	/*
 	 * Get a reference to the parent filp - we will fput it
@@ -3838,7 +3838,7 @@ int perf_counter_init_task(struct task_struct *child)
 		if (counter != counter->group_leader)
 			continue;
 
-		if (!counter->hw_event.inherit) {
+		if (!counter->attr.inherit) {
 			inherited_all = 0;
 			continue;
 		}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix up the ABI shakeup
       [not found]             ` <new-submission>
                                 ` (109 preceding siblings ...)
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter: Rename perf_counter_hw_event => perf_counter_attr tip-bot for Peter Zijlstra
@ 2009-06-02 20:17               ` tip-bot for Peter Zijlstra
  2009-06-02 20:17               ` [tip:perfcounters/core] perf report: Separate out idle threads tip-bot for Peter Zijlstra
                                 ` (596 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, paulus, linux-kernel, hpa, mingo, eranian, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  c70975bc8d5bac487616785f5d5bc7b090dfa2d9
Gitweb:     http://git.kernel.org/tip/c70975bc8d5bac487616785f5d5bc7b090dfa2d9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 17:38:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:34 +0200

perf_counter tools: Fix up the ABI shakeup

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   18 +++++++++---------
 Documentation/perf_counter/builtin-stat.c   |   22 +++++++++++-----------
 Documentation/perf_counter/builtin-top.c    |   20 ++++++++++----------
 Documentation/perf_counter/perf.h           |    4 ++--
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index bace7a8..c2fd042 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -322,7 +322,7 @@ static void synthesize_events(void)
 
 static void open_counters(int cpu, pid_t pid)
 {
-	struct perf_counter_hw_event hw_event;
+	struct perf_counter_attr attr;
 	int counter, group_fd;
 	int track = 1;
 
@@ -334,18 +334,18 @@ static void open_counters(int cpu, pid_t pid)
 	group_fd = -1;
 	for (counter = 0; counter < nr_counters; counter++) {
 
-		memset(&hw_event, 0, sizeof(hw_event));
-		hw_event.config		= event_id[counter];
-		hw_event.irq_period	= event_count[counter];
-		hw_event.record_type	= PERF_RECORD_IP | PERF_RECORD_TID;
-		hw_event.mmap		= track;
-		hw_event.comm		= track;
-		hw_event.inherit	= (cpu < 0) && inherit;
+		memset(&attr, 0, sizeof(attr));
+		attr.config		= event_id[counter];
+		attr.sample_period	= event_count[counter];
+		attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+		attr.mmap		= track;
+		attr.comm		= track;
+		attr.inherit	= (cpu < 0) && inherit;
 
 		track = 0; // only the first counter needs these
 
 		fd[nr_cpu][counter] =
-			sys_perf_counter_open(&hw_event, pid, cpu, group_fd, 0);
+			sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
 
 		if (fd[nr_cpu][counter] < 0) {
 			int err = errno;
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 644f850..27abe6a 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -79,22 +79,22 @@ static __u64			walltime_nsecs;
 
 static void create_perfstat_counter(int counter)
 {
-	struct perf_counter_hw_event hw_event;
+	struct perf_counter_attr attr;
 
-	memset(&hw_event, 0, sizeof(hw_event));
-	hw_event.config		= event_id[counter];
-	hw_event.record_type	= 0;
-	hw_event.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
-	hw_event.exclude_user   = event_mask[counter] & EVENT_MASK_USER;
+	memset(&attr, 0, sizeof(attr));
+	attr.config		= event_id[counter];
+	attr.sample_type	= 0;
+	attr.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
+	attr.exclude_user   = event_mask[counter] & EVENT_MASK_USER;
 
 	if (scale)
-		hw_event.read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
+		attr.read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
 					  PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide) {
 		int cpu;
 		for (cpu = 0; cpu < nr_cpus; cpu ++) {
-			fd[cpu][counter] = sys_perf_counter_open(&hw_event, -1, cpu, -1, 0);
+			fd[cpu][counter] = sys_perf_counter_open(&attr, -1, cpu, -1, 0);
 			if (fd[cpu][counter] < 0) {
 				printf("perfstat error: syscall returned with %d (%s)\n",
 						fd[cpu][counter], strerror(errno));
@@ -102,10 +102,10 @@ static void create_perfstat_counter(int counter)
 			}
 		}
 	} else {
-		hw_event.inherit	= inherit;
-		hw_event.disabled	= 1;
+		attr.inherit	= inherit;
+		attr.disabled	= 1;
 
-		fd[0][counter] = sys_perf_counter_open(&hw_event, 0, -1, -1, 0);
+		fd[0][counter] = sys_perf_counter_open(&attr, 0, -1, -1, 0);
 		if (fd[0][counter] < 0) {
 			printf("perfstat error: syscall returned with %d (%s)\n",
 					fd[0][counter], strerror(errno));
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index a2cff7b..5029d8e 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -537,7 +537,7 @@ static void mmap_read(struct mmap_data *md)
 		old += size;
 
 		if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
-			if (event->header.type & PERF_RECORD_IP)
+			if (event->header.type & PERF_SAMPLE_IP)
 				process_event(event->ip.ip, md->counter);
 		} else {
 			switch (event->header.type) {
@@ -563,7 +563,7 @@ static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 
 static int __cmd_top(void)
 {
-	struct perf_counter_hw_event hw_event;
+	struct perf_counter_attr attr;
 	pthread_t thread;
 	int i, counter, group_fd, nr_poll = 0;
 	unsigned int cpu;
@@ -577,15 +577,15 @@ static int __cmd_top(void)
 			if (target_pid == -1 && profile_cpu == -1)
 				cpu = i;
 
-			memset(&hw_event, 0, sizeof(hw_event));
-			hw_event.config		= event_id[counter];
-			hw_event.irq_period	= event_count[counter];
-			hw_event.record_type	= PERF_RECORD_IP | PERF_RECORD_TID;
-			hw_event.mmap		= use_mmap;
-			hw_event.munmap		= use_munmap;
-			hw_event.freq		= freq;
+			memset(&attr, 0, sizeof(attr));
+			attr.config		= event_id[counter];
+			attr.sample_period	= event_count[counter];
+			attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+			attr.mmap		= use_mmap;
+			attr.munmap		= use_munmap;
+			attr.freq		= freq;
 
-			fd[i][counter] = sys_perf_counter_open(&hw_event, target_pid, cpu, group_fd, 0);
+			fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
 			if (fd[i][counter] < 0) {
 				int err = errno;
 				printf("kerneltop error: syscall returned with %d (%s)\n",
diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h
index 5a2520b..10622a4 100644
--- a/Documentation/perf_counter/perf.h
+++ b/Documentation/perf_counter/perf.h
@@ -53,11 +53,11 @@ static inline unsigned long long rdclock(void)
 	_min1 < _min2 ? _min1 : _min2; })
 
 static inline int
-sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr,
+sys_perf_counter_open(struct perf_counter_attr *attr_uptr,
 		      pid_t pid, int cpu, int group_fd,
 		      unsigned long flags)
 {
-	return syscall(__NR_perf_counter_open, hw_event_uptr, pid, cpu,
+	return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu,
 		       group_fd, flags);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Separate out idle threads
       [not found]             ` <new-submission>
                                 ` (110 preceding siblings ...)
  2009-06-02 20:17               ` [tip:perfcounters/core] perf_counter tools: Fix up the ABI shakeup tip-bot for Peter Zijlstra
@ 2009-06-02 20:17               ` tip-bot for Peter Zijlstra
  2009-06-02 20:17               ` [tip:perfcounters/core] perf report: Fix column width/alignment of dsos tip-bot for Ingo Molnar
                                 ` (595 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-02 20:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  436224a6d8bb3e29fe0cc18122f8d1f593da67b8
Gitweb:     http://git.kernel.org/tip/436224a6d8bb3e29fe0cc18122f8d1f593da67b8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Jun 2009 21:02:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 21:45:34 +0200

perf report: Separate out idle threads

Introduce the special comm name [idle] for idle theads.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 19c1e05..6d68f3a 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -612,6 +612,17 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 	return ret;
 }
 
+static void register_idle_thread(void)
+{
+	struct thread *thread = threads__findnew(0);
+
+	if (thread == NULL ||
+			thread__set_comm(thread, "[idle]")) {
+		fprintf(stderr, "problem inserting idle task.\n");
+		exit(-1);
+	}
+}
+
 
 static int __cmd_report(void)
 {
@@ -626,6 +637,8 @@ static int __cmd_report(void)
 	char cwd[PATH_MAX], *cwdp = cwd;
 	int cwdlen;
 
+	register_idle_thread();
+
 	input = open(input_name, O_RDONLY);
 	if (input < 0) {
 		perror("failed to open file");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix column width/alignment of dsos
       [not found]             ` <new-submission>
                                 ` (111 preceding siblings ...)
  2009-06-02 20:17               ` [tip:perfcounters/core] perf report: Separate out idle threads tip-bot for Peter Zijlstra
@ 2009-06-02 20:17               ` tip-bot for Ingo Molnar
  2009-06-02 22:07               ` [tip:perfcounters/core] perf record: Add --append option tip-bot for Ingo Molnar
                                 ` (594 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 20:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  cf25c63c609e99bfb9303b68a7a90a56a3a32cea
Gitweb:     http://git.kernel.org/tip/cf25c63c609e99bfb9303b68a7a90a56a3a32cea
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 22:12:14 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 22:12:14 +0200

perf report: Fix column width/alignment of dsos

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6d68f3a..b84aaf1 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -303,11 +303,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__thread_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %16s:%5d", self->thread->comm ?: "", self->thread->pid);
+	return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
 }
 
 static struct sort_entry sort_thread = {
-	.header = "          Command: Pid ",
+	.header = "         Command: Pid ",
 	.cmp	= sort__thread_cmp,
 	.print	= sort__thread_print,
 };
@@ -363,11 +363,11 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__dso_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %s", self->dso ? self->dso->name : "<unknown>");
+	return fprintf(fp, "  %-25s", self->dso ? self->dso->name : "<unknown>");
 }
 
 static struct sort_entry sort_dso = {
-	.header = " Shared Object",
+	.header = " Shared Object          ",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Add --append option
       [not found]             ` <new-submission>
                                 ` (112 preceding siblings ...)
  2009-06-02 20:17               ` [tip:perfcounters/core] perf report: Fix column width/alignment of dsos tip-bot for Ingo Molnar
@ 2009-06-02 22:07               ` tip-bot for Ingo Molnar
  2009-06-02 22:32               ` [tip:perfcounters/core] perf record: Increase mmap buffering default tip-bot for Ingo Molnar
                                 ` (593 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 22:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  abaff32a03e26e5d6674cb2a26ad882efe7493a3
Gitweb:     http://git.kernel.org/tip/abaff32a03e26e5d6674cb2a26ad882efe7493a3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 22:59:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 23:01:02 +0200

perf record: Add --append option

Allow incremental profiling via 'perf record -A' - this will append
to an existing perf.data.

Also reorder perf record options by utility / likelyhood of usage.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   40 +++++++++++++++++---------
 1 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index c2fd042..19cba6b 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -1,5 +1,7 @@
-
-
+/*
+ * perf record: Record the profile of a workload (or a CPU, or a PID) into
+ * the perf.data output file - for later analysis via perf report.
+ */
 #include "perf.h"
 #include "builtin.h"
 #include "util/util.h"
@@ -28,6 +30,7 @@ static int			system_wide			= 0;
 static pid_t			target_pid			= -1;
 static int			inherit				= 1;
 static int			force				= 0;
+static int			append_file			= 0;
 
 const unsigned int default_count[] = {
 	1000000,
@@ -385,22 +388,29 @@ static void open_counters(int cpu, pid_t pid)
 static int __cmd_record(int argc, const char **argv)
 {
 	int i, counter;
+	struct stat st;
 	pid_t pid;
+	int flags;
 	int ret;
-	struct stat st;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
-	if (!stat(output_name, &st) && !force) {
-		fprintf(stderr, "Error, output file: %s exists, use -f to overwrite.\n",
+	if (!stat(output_name, &st) && !force && !append_file) {
+		fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n",
 				output_name);
 		exit(-1);
 	}
 
-	output = open(output_name, O_CREAT|O_TRUNC|O_RDWR, S_IRUSR|S_IWUSR);
+	flags = O_CREAT|O_RDWR;
+	if (append_file)
+		flags |= O_APPEND;
+	else
+		flags |= O_TRUNC;
+
+	output = open(output_name, flags, S_IRUSR|S_IWUSR);
 	if (output < 0) {
 		perror("failed to create output file");
 		exit(-1);
@@ -466,22 +476,24 @@ static char events_help_msg[EVENTS_HELP_MAX];
 static const struct option options[] = {
 	OPT_CALLBACK('e', "event", NULL, "event",
 		     events_help_msg, parse_events),
-	OPT_INTEGER('c', "count", &default_interval,
-		    "event period to sample"),
-	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
-		    "number of mmap data pages"),
-	OPT_STRING('o', "output", &output_name, "file",
-		    "output file name"),
-	OPT_BOOLEAN('i', "inherit", &inherit,
-		    "child tasks inherit counters"),
 	OPT_INTEGER('p', "pid", &target_pid,
 		    "record events on existing pid"),
 	OPT_INTEGER('r', "realtime", &realtime_prio,
 		    "collect data with this RT SCHED_FIFO priority"),
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
 			    "system-wide collection from all CPUs"),
+	OPT_BOOLEAN('A', "append", &append_file,
+			    "append to the output file to do incremental profiling"),
 	OPT_BOOLEAN('f', "force", &force,
 			"overwrite existing data file"),
+	OPT_INTEGER('c', "count", &default_interval,
+		    "event period to sample"),
+	OPT_STRING('o', "output", &output_name, "file",
+		    "output file name"),
+	OPT_BOOLEAN('i', "inherit", &inherit,
+		    "child tasks inherit counters"),
+	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
+		    "number of mmap data pages"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Increase mmap buffering default
       [not found]             ` <new-submission>
                                 ` (113 preceding siblings ...)
  2009-06-02 22:07               ` [tip:perfcounters/core] perf record: Add --append option tip-bot for Ingo Molnar
@ 2009-06-02 22:32               ` tip-bot for Ingo Molnar
  2009-06-02 22:32               ` [tip:perfcounters/core] perf report: Print more info instead of <unknown> entries tip-bot for Ingo Molnar
                                 ` (592 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 22:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  3cf165fc2e7f221a7a95098b47eb990779e29f5f
Gitweb:     http://git.kernel.org/tip/3cf165fc2e7f221a7a95098b47eb990779e29f5f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 23:02:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 23:04:24 +0200

perf record: Increase mmap buffering default

I've run into mmap overruns with the current 16 pages default,
increase it to 128 pages.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 19cba6b..8feb119 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -19,9 +19,9 @@ static int			default_interval = 100000;
 static int			event_count[MAX_COUNTERS];
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
-static int			nr_cpus				=  0;
+static int			nr_cpus				= 0;
 static unsigned int		page_size;
-static unsigned int		mmap_pages			= 16;
+static unsigned int		mmap_pages			= 128;
 static int			output;
 static const char		*output_name			= "perf.data";
 static int			group				= 0;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print more info instead of <unknown> entries
       [not found]             ` <new-submission>
                                 ` (114 preceding siblings ...)
  2009-06-02 22:32               ` [tip:perfcounters/core] perf record: Increase mmap buffering default tip-bot for Ingo Molnar
@ 2009-06-02 22:32               ` tip-bot for Ingo Molnar
  2009-06-02 22:42               ` [tip:perfcounters/core] perf_counter tools: Make source code headers more coherent tip-bot for Ingo Molnar
                                 ` (591 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 22:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  0a520c63e1625b92ef775da40192e1542910e7f6
Gitweb:     http://git.kernel.org/tip/0a520c63e1625b92ef775da40192e1542910e7f6
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 23:24:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 23:24:45 +0200

perf report: Print more info instead of <unknown> entries

Sometimes we still fail to find a DSO or look up a symbol,
print out the raw information in this case (which an help
debug the problem), instead of a not very helpful <unknown>
string.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   28 +++++++++++++++++++-------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index b84aaf1..270e986 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -201,7 +201,9 @@ static struct thread *thread__new(pid_t pid)
 
 	if (self != NULL) {
 		self->pid = pid;
-		self->comm = NULL;
+		self->comm = malloc(30);
+		if (self->comm)
+			sprintf(self->comm, ":%d", pid);
 		INIT_LIST_HEAD(&self->maps);
 	}
 
@@ -333,7 +335,7 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__comm_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %16s", self->thread->comm ?: "<unknown>");
+	return fprintf(fp, "  %16s", self->thread->comm);
 }
 
 static struct sort_entry sort_comm = {
@@ -363,7 +365,10 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__dso_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %-25s", self->dso ? self->dso->name : "<unknown>");
+	if (self->dso)
+		return fprintf(fp, "  %-25s", self->dso->name);
+
+	return fprintf(fp, "  %016llx", (__u64)self->ip);
 }
 
 static struct sort_entry sort_dso = {
@@ -392,11 +397,17 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	size_t ret = 0;
 
 	if (verbose)
-		ret += fprintf(fp, "  %#018llx", (unsigned long long)self->ip);
+		ret += fprintf(fp, "  %#018llx", (__u64)self->ip);
+
+	if (self->dso)
+		ret += fprintf(fp, "  %s: ", self->dso->name);
+	else
+		ret += fprintf(fp, "  %#016llx: ", (__u64)self->ip);
 
-	ret += fprintf(fp, "  %s: %s",
-			self->dso ? self->dso->name : "<unknown>",
-			self->sym ? self->sym->name : "<unknown>");
+	if (self->sym)
+		ret += fprintf(fp, "%s", self->sym->name);
+	else
+		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
 
 	return ret;
 }
@@ -772,7 +783,8 @@ more:
 				event->mmap.filename);
 		}
 		if (thread == NULL || map == NULL) {
-			fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
+			if (verbose)
+				fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
 			goto broken_event;
 		}
 		thread__insert_map(thread, map);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Make source code headers more coherent
       [not found]             ` <new-submission>
                                 ` (115 preceding siblings ...)
  2009-06-02 22:32               ` [tip:perfcounters/core] perf report: Print more info instead of <unknown> entries tip-bot for Ingo Molnar
@ 2009-06-02 22:42               ` tip-bot for Ingo Molnar
  2009-06-02 22:49               ` [tip:perfcounters/core] perf record: Print out the number of events captured tip-bot for Ingo Molnar
                                 ` (590 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 22:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  bf9e187637ca3d85cee7407e3af93995868cc87c
Gitweb:     http://git.kernel.org/tip/bf9e187637ca3d85cee7407e3af93995868cc87c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 23:37:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 23:37:05 +0200

perf_counter tools: Make source code headers more coherent

The perf commands had different ways of describing themselves,
introduce a coherent command-file-header format taken from the
Git project.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   11 ++++-
 Documentation/perf_counter/builtin-report.c |   10 ++++-
 Documentation/perf_counter/builtin-stat.c   |   29 ++++++++-----
 Documentation/perf_counter/builtin-top.c    |   60 ++++++++-------------------
 Documentation/perf_counter/perf.c           |    9 ++++
 5 files changed, 62 insertions(+), 57 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 8feb119..2741b35 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -1,9 +1,14 @@
 /*
- * perf record: Record the profile of a workload (or a CPU, or a PID) into
- * the perf.data output file - for later analysis via perf report.
+ * builtin-record.c
+ *
+ * Builtin record command: Record the profile of a workload
+ * (or a CPU, or a PID) into the perf.data output file - for
+ * later analysis via perf report.
  */
-#include "perf.h"
 #include "builtin.h"
+
+#include "perf.h"
+
 #include "util/util.h"
 #include "util/parse-options.h"
 #include "util/parse-events.h"
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 270e986..9da990f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -1,6 +1,14 @@
-#include "util/util.h"
+/*
+ * builtin-report.c
+ *
+ * Builtin report command: Analyze the perf.data input file,
+ * look up and read DSOs and symbol information and display
+ * a histogram of results, along various sorting keys.
+ */
 #include "builtin.h"
 
+#include "util/util.h"
+
 #include "util/list.h"
 #include "util/cache.h"
 #include "util/rbtree.h"
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 27abe6a..2357a66 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -1,20 +1,27 @@
 /*
- * perf stat:  /usr/bin/time -alike performance counter statistics utility
+ * builtin-stat.c
+ *
+ * Builtin stat command: Give a precise performance counters summary
+ * overview about any workload, CPU or specific PID.
+ *
+ * Sample output:
 
-          It summarizes the counter events of all tasks (and child tasks),
-          covering all CPUs that the command (or workload) executes on.
-          It only counts the per-task events of the workload started,
-          independent of how many other tasks run on those CPUs.
+   $ perf stat ~/hackbench 10
+   Time: 0.104
 
-   Sample output:
+    Performance counter stats for '/home/mingo/hackbench':
 
-   $ perf stat -e 1 -e 3 -e 5 ls -lR /usr/include/ >/dev/null
+       1255.538611  task clock ticks     #      10.143 CPU utilization factor
+             54011  context switches     #       0.043 M/sec
+               385  CPU migrations       #       0.000 M/sec
+             17755  pagefaults           #       0.014 M/sec
+        3808323185  CPU cycles           #    3033.219 M/sec
+        1575111190  instructions         #    1254.530 M/sec
+          17367895  cache references     #      13.833 M/sec
+           7674421  cache misses         #       6.112 M/sec
 
-   Performance counter stats for 'ls':
+    Wall-clock time elapsed:   123.786620 msecs
 
-           163516953 instructions
-                2295 cache-misses
-             2855182 branch-misses
  *
  * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
  *
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 5029d8e..a639352 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -1,49 +1,25 @@
 /*
- * kerneltop.c: show top kernel functions - performance counters showcase
-
-   Build with:
-
-     make -C Documentation/perf_counter/
-
-   Sample output:
-
-------------------------------------------------------------------------------
- KernelTop:    2669 irqs/sec  [cache-misses/cache-refs],  (all, cpu: 2)
-------------------------------------------------------------------------------
-
-             weight         RIP          kernel function
-             ______   ________________   _______________
-
-              35.20 - ffffffff804ce74b : skb_copy_and_csum_dev
-              33.00 - ffffffff804cb740 : sock_alloc_send_skb
-              31.26 - ffffffff804ce808 : skb_push
-              22.43 - ffffffff80510004 : tcp_established_options
-              19.00 - ffffffff8027d250 : find_get_page
-              15.76 - ffffffff804e4fc9 : eth_type_trans
-              15.20 - ffffffff804d8baa : dst_release
-              14.86 - ffffffff804cf5d8 : skb_release_head_state
-              14.00 - ffffffff802217d5 : read_hpet
-              12.00 - ffffffff804ffb7f : __ip_local_out
-              11.97 - ffffffff804fc0c8 : ip_local_deliver_finish
-               8.54 - ffffffff805001a3 : ip_queue_xmit
+ * builtin-top.c
+ *
+ * Builtin top command: Display a continuously updated profile of
+ * any workload, CPU or specific PID.
+ *
+ * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
+ *
+ * Improvements and fixes by:
+ *
+ *   Arjan van de Ven <arjan@linux.intel.com>
+ *   Yanmin Zhang <yanmin.zhang@intel.com>
+ *   Wu Fengguang <fengguang.wu@intel.com>
+ *   Mike Galbraith <efault@gmx.de>
+ *   Paul Mackerras <paulus@samba.org>
+ *
+ * Released under the GPL v2. (and only v2, not any later version)
  */
-
- /*
-  * Copyright (C) 2008, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
-  *
-  * Improvements and fixes by:
-  *
-  *   Arjan van de Ven <arjan@linux.intel.com>
-  *   Yanmin Zhang <yanmin.zhang@intel.com>
-  *   Wu Fengguang <fengguang.wu@intel.com>
-  *   Mike Galbraith <efault@gmx.de>
-  *   Paul Mackerras <paulus@samba.org>
-  *
-  * Released under the GPL v2. (and only v2, not any later version)
-  */
+#include "builtin.h"
 
 #include "perf.h"
-#include "builtin.h"
+
 #include "util/symbol.h"
 #include "util/util.h"
 #include "util/rbtree.h"
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c
index e8a8584..ec7edb7 100644
--- a/Documentation/perf_counter/perf.c
+++ b/Documentation/perf_counter/perf.c
@@ -1,4 +1,13 @@
+/*
+ * perf.c
+ *
+ * Performance analysis utility.
+ *
+ * This is the main hub from which the sub-commands (perf stat,
+ * perf top, perf record, perf report, etc.) are started.
+ */
 #include "builtin.h"
+
 #include "util/exec_cmd.h"
 #include "util/cache.h"
 #include "util/quote.h"

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Print out the number of events captured
       [not found]             ` <new-submission>
                                 ` (116 preceding siblings ...)
  2009-06-02 22:42               ` [tip:perfcounters/core] perf_counter tools: Make source code headers more coherent tip-bot for Ingo Molnar
@ 2009-06-02 22:49               ` tip-bot for Ingo Molnar
  2009-06-03  8:46               ` [tip:perfcounters/core] perf_counter tools: Cover PLT symbols too tip-bot for Arnaldo Carvalho de Melo
                                 ` (589 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-02 22:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  addc2785ce92ff05da8edf18317b6b4719e10d9f
Gitweb:     http://git.kernel.org/tip/addc2785ce92ff05da8edf18317b6b4719e10d9f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 2 Jun 2009 23:43:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Jun 2009 23:43:11 +0200

perf record: Print out the number of events captured

It makes sense to inform the user about how many events
perf record has written - so that the sufficiency of
profiling coverage and intensity can be determined at
a glance.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 2741b35..ec3b73a 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -467,6 +467,9 @@ static int __cmd_record(int argc, const char **argv)
 			ret = poll(event_array, nr_poll, 100);
 	}
 
+
+	fprintf(stderr, "[ perf record: Captured and wrote %ld events. ]\n", events);
+
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Cover PLT symbols too
       [not found]             ` <new-submission>
                                 ` (117 preceding siblings ...)
  2009-06-02 22:49               ` [tip:perfcounters/core] perf record: Print out the number of events captured tip-bot for Ingo Molnar
@ 2009-06-03  8:46               ` tip-bot for Arnaldo Carvalho de Melo
  2009-06-03  8:46               ` [tip:perfcounters/core] perf report: Print -D to stdout tip-bot for Ingo Molnar
                                 ` (588 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-06-03  8:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, eranian, jkacur,
	a.p.zijlstra, efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  8ce998d6693bd02ab3b74ee1cc303ecb1fa9b514
Gitweb:     http://git.kernel.org/tip/8ce998d6693bd02ab3b74ee1cc303ecb1fa9b514
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 3 Jun 2009 00:54:33 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 09:58:52 +0200

perf_counter tools: Cover PLT symbols too

PLT, the Program Linking Table, is used with the dynamic linker to
allow PIC code in executables and shared objects to figure out
where functions are in other shared objects.

It is one of the sources of unknown/unresolved symbols - this patch
does what binutils figures out when you ask it to disassembly.
(objdump -S)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/symbol.c |  143 ++++++++++++++++++++++++++++-
 1 files changed, 138 insertions(+), 5 deletions(-)

diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index 039931f..d52a1ae 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -258,6 +258,117 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 	return sec;
 }
 
+#define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \
+	for (idx = 0, pos = gelf_getrel(reldata, 0, &pos_mem); \
+	     idx < nr_entries; \
+	     ++idx, pos = gelf_getrel(reldata, idx, &pos_mem))
+
+#define elf_section__for_each_rela(reldata, pos, pos_mem, idx, nr_entries) \
+	for (idx = 0, pos = gelf_getrela(reldata, 0, &pos_mem); \
+	     idx < nr_entries; \
+	     ++idx, pos = gelf_getrela(reldata, idx, &pos_mem))
+
+static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
+				       GElf_Ehdr *ehdr, Elf_Scn *scn_dynsym,
+				       GElf_Shdr *shdr_dynsym,
+				       size_t dynsym_idx)
+{
+	uint32_t nr_rel_entries, idx;
+	GElf_Sym sym;
+	__u64 plt_offset;
+	GElf_Shdr shdr_plt;
+	struct symbol *f;
+	GElf_Shdr shdr_rel_plt;
+	Elf_Data *reldata, *syms, *symstrs;
+	Elf_Scn *scn_plt_rel, *scn_symstrs;
+	char sympltname[1024];
+	int nr = 0, symidx;
+
+	scn_plt_rel = elf_section_by_name(elf, ehdr, &shdr_rel_plt,
+					  ".rela.plt", NULL);
+	if (scn_plt_rel == NULL) {
+		scn_plt_rel = elf_section_by_name(elf, ehdr, &shdr_rel_plt,
+						  ".rel.plt", NULL);
+		if (scn_plt_rel == NULL)
+			return 0;
+	}
+
+	if (shdr_rel_plt.sh_link != dynsym_idx)
+		return 0;
+
+	if (elf_section_by_name(elf, ehdr, &shdr_plt, ".plt", NULL) == NULL)
+		return 0;
+
+	/*
+	 * Fetch the relocation section to find the indexes to the GOT
+	 * and the symbols in the .dynsym they refer to.
+	 */
+	reldata = elf_getdata(scn_plt_rel, NULL);
+	if (reldata == NULL)
+		return -1;
+
+	syms = elf_getdata(scn_dynsym, NULL);
+	if (syms == NULL)
+		return -1;
+
+	scn_symstrs = elf_getscn(elf, shdr_dynsym->sh_link);
+	if (scn_symstrs == NULL)
+		return -1;
+
+	symstrs = elf_getdata(scn_symstrs, NULL);
+	if (symstrs == NULL)
+		return -1;
+
+	nr_rel_entries = shdr_rel_plt.sh_size / shdr_rel_plt.sh_entsize;
+	plt_offset = shdr_plt.sh_offset;
+
+	if (shdr_rel_plt.sh_type == SHT_RELA) {
+		GElf_Rela pos_mem, *pos;
+
+		elf_section__for_each_rela(reldata, pos, pos_mem, idx,
+					   nr_rel_entries) {
+			symidx = GELF_R_SYM(pos->r_info);
+			plt_offset += shdr_plt.sh_entsize;
+			gelf_getsym(syms, symidx, &sym);
+			snprintf(sympltname, sizeof(sympltname),
+				 "%s@plt", elf_sym__name(&sym, symstrs));
+
+			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
+					sympltname, self->sym_priv_size);
+			if (!f)
+				return -1;
+
+			dso__insert_symbol(self, f);
+			++nr;
+		}
+	} else if (shdr_rel_plt.sh_type == SHT_REL) {
+		GElf_Rel pos_mem, *pos;
+		elf_section__for_each_rel(reldata, pos, pos_mem, idx,
+					  nr_rel_entries) {
+			symidx = GELF_R_SYM(pos->r_info);
+			plt_offset += shdr_plt.sh_entsize;
+			gelf_getsym(syms, symidx, &sym);
+			snprintf(sympltname, sizeof(sympltname),
+				 "%s@plt", elf_sym__name(&sym, symstrs));
+
+			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
+					sympltname, self->sym_priv_size);
+			if (!f)
+				return -1;
+
+			dso__insert_symbol(self, f);
+			++nr;
+		}
+	} else {
+		/*
+		 * TODO: There are still one more shdr_rel_plt.sh_type
+		 * I have to investigate, but probably should be ignored.
+		 */
+	}
+
+	return nr;
+}
+
 static int dso__load_sym(struct dso *self, int fd, const char *name,
 			 symbol_filter_t filter)
 {
@@ -269,8 +380,9 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 	GElf_Shdr shdr;
 	Elf_Data *syms;
 	GElf_Sym sym;
-	Elf_Scn *sec;
+	Elf_Scn *sec, *sec_dynsym;
 	Elf *elf;
+	size_t dynsym_idx;
 	int nr = 0;
 
 	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
@@ -285,12 +397,33 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		goto out_elf_end;
 	}
 
+	/*
+	 * We need to check if we have a .dynsym, so that we can handle the
+	 * .plt, synthesizing its symbols, that aren't on the symtabs (be it
+	 * .dynsym or .symtab)
+	 */
+	sec_dynsym = elf_section_by_name(elf, &ehdr, &shdr,
+					 ".dynsym", &dynsym_idx);
+	if (sec_dynsym != NULL) {
+		nr = dso__synthesize_plt_symbols(self, elf, &ehdr,
+						 sec_dynsym, &shdr,
+						 dynsym_idx);
+		if (nr < 0)
+			goto out_elf_end;
+	}
+
+	/*
+	 * But if we have a full .symtab (that is a superset of .dynsym) we
+	 * should add the symbols not in the .dynsyn
+	 */
 	sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
-	if (sec == NULL)
-		sec = elf_section_by_name(elf, &ehdr, &shdr, ".dynsym", NULL);
+	if (sec == NULL) {
+		if (sec_dynsym == NULL)
+			goto out_elf_end;
 
-	if (sec == NULL)
-		goto out_elf_end;
+		sec = sec_dynsym;
+		gelf_getshdr(sec, &shdr);
+	}
 
 	syms = elf_getdata(sec, NULL);
 	if (syms == NULL)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print -D to stdout
       [not found]             ` <new-submission>
                                 ` (118 preceding siblings ...)
  2009-06-03  8:46               ` [tip:perfcounters/core] perf_counter tools: Cover PLT symbols too tip-bot for Arnaldo Carvalho de Melo
@ 2009-06-03  8:46               ` tip-bot for Ingo Molnar
  2009-06-03  9:48               ` tip-bot for Ingo Molnar
                                 ` (587 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03  8:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  97dd543cbd39f762357ba6cd5bfd94771851c96b
Gitweb:     http://git.kernel.org/tip/97dd543cbd39f762357ba6cd5bfd94771851c96b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 09:38:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 09:38:58 +0200

perf report: Print -D to stdout

-D prints to stderr - which is a bit confusing - print to stdout
instead.

Also clean up the if (dump_trace) patterns via a dprintf helper.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   65 ++++++++++++--------------
 1 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9da990f..2c8034f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -31,6 +31,8 @@ static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static int		dump_trace = 0;
+#define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
+
 static int		verbose;
 static int		full_paths;
 
@@ -729,14 +731,12 @@ more:
 		uint64_t ip = event->ip.ip;
 		struct map *map = NULL;
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				event->header.misc,
-				event->ip.pid,
-				(void *)(long)ip);
-		}
+		dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->header.misc,
+			event->ip.pid,
+			(void *)(long)ip);
 
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, skipping it.\n",
@@ -781,15 +781,14 @@ more:
 		struct thread *thread = threads__findnew(event->mmap.pid);
 		struct map *map = map__new(&event->mmap, cwdp, cwdlen);
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				(void *)(long)event->mmap.start,
-				(void *)(long)event->mmap.len,
-				(void *)(long)event->mmap.pgoff,
-				event->mmap.filename);
-		}
+		dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			(void *)(long)event->mmap.start,
+			(void *)(long)event->mmap.len,
+			(void *)(long)event->mmap.pgoff,
+			event->mmap.filename);
+
 		if (thread == NULL || map == NULL) {
 			if (verbose)
 				fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
@@ -802,12 +801,11 @@ more:
 	case PERF_EVENT_COMM: {
 		struct thread *thread = threads__findnew(event->comm.pid);
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				event->comm.comm, event->comm.pid);
-		}
+		dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->comm.comm, event->comm.pid);
+
 		if (thread == NULL ||
 		    thread__set_comm(thread, event->comm.comm)) {
 			fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
@@ -818,11 +816,10 @@ more:
 	}
 	default: {
 broken_event:
-		if (dump_trace)
-			fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
-					(void *)(offset + head),
-					(void *)(long)(event->header.size),
-					event->header.type);
+		dprintf("%p [%p]: skipping unknown header type: %d\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->header.type);
 
 		total_unknown++;
 
@@ -846,14 +843,12 @@ broken_event:
 	rc = EXIT_SUCCESS;
 	close(input);
 
-	if (dump_trace) {
-		fprintf(stderr, "      IP events: %10ld\n", total);
-		fprintf(stderr, "    mmap events: %10ld\n", total_mmap);
-		fprintf(stderr, "    comm events: %10ld\n", total_comm);
-		fprintf(stderr, " unknown events: %10ld\n", total_unknown);
+	dprintf("      IP events: %10ld\n", total);
+	dprintf("    mmap events: %10ld\n", total_mmap);
+	dprintf("    comm events: %10ld\n", total_comm);
+	dprintf(" unknown events: %10ld\n", total_unknown);
 
-		return 0;
-	}
+	return 0;
 
 	if (verbose >= 2)
 		dsos__fprintf(stdout);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print -D to stdout
       [not found]             ` <new-submission>
                                 ` (119 preceding siblings ...)
  2009-06-03  8:46               ` [tip:perfcounters/core] perf report: Print -D to stdout tip-bot for Ingo Molnar
@ 2009-06-03  9:48               ` tip-bot for Ingo Molnar
  2009-06-03  9:48               ` [tip:perfcounters/core] perf report: Improve sort key recognition tip-bot for Ingo Molnar
                                 ` (586 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03  9:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  3502973d005ed89cc2b3f39780813a341ddba97f
Gitweb:     http://git.kernel.org/tip/3502973d005ed89cc2b3f39780813a341ddba97f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 09:38:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 10:01:57 +0200

perf report: Print -D to stdout

-D prints to stderr - which is a bit confusing - print to stdout
instead.

Also clean up the if (dump_trace) patterns via a dprintf helper.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   64 ++++++++++++--------------
 1 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9da990f..6207a31 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -31,6 +31,8 @@ static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static int		dump_trace = 0;
+#define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
+
 static int		verbose;
 static int		full_paths;
 
@@ -729,14 +731,12 @@ more:
 		uint64_t ip = event->ip.ip;
 		struct map *map = NULL;
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				event->header.misc,
-				event->ip.pid,
-				(void *)(long)ip);
-		}
+		dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->header.misc,
+			event->ip.pid,
+			(void *)(long)ip);
 
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, skipping it.\n",
@@ -781,15 +781,14 @@ more:
 		struct thread *thread = threads__findnew(event->mmap.pid);
 		struct map *map = map__new(&event->mmap, cwdp, cwdlen);
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				(void *)(long)event->mmap.start,
-				(void *)(long)event->mmap.len,
-				(void *)(long)event->mmap.pgoff,
-				event->mmap.filename);
-		}
+		dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			(void *)(long)event->mmap.start,
+			(void *)(long)event->mmap.len,
+			(void *)(long)event->mmap.pgoff,
+			event->mmap.filename);
+
 		if (thread == NULL || map == NULL) {
 			if (verbose)
 				fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
@@ -802,12 +801,11 @@ more:
 	case PERF_EVENT_COMM: {
 		struct thread *thread = threads__findnew(event->comm.pid);
 
-		if (dump_trace) {
-			fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
-				(void *)(offset + head),
-				(void *)(long)(event->header.size),
-				event->comm.comm, event->comm.pid);
-		}
+		dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->comm.comm, event->comm.pid);
+
 		if (thread == NULL ||
 		    thread__set_comm(thread, event->comm.comm)) {
 			fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
@@ -818,11 +816,10 @@ more:
 	}
 	default: {
 broken_event:
-		if (dump_trace)
-			fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
-					(void *)(offset + head),
-					(void *)(long)(event->header.size),
-					event->header.type);
+		dprintf("%p [%p]: skipping unknown header type: %d\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->header.type);
 
 		total_unknown++;
 
@@ -846,14 +843,13 @@ broken_event:
 	rc = EXIT_SUCCESS;
 	close(input);
 
-	if (dump_trace) {
-		fprintf(stderr, "      IP events: %10ld\n", total);
-		fprintf(stderr, "    mmap events: %10ld\n", total_mmap);
-		fprintf(stderr, "    comm events: %10ld\n", total_comm);
-		fprintf(stderr, " unknown events: %10ld\n", total_unknown);
+	dprintf("      IP events: %10ld\n", total);
+	dprintf("    mmap events: %10ld\n", total_mmap);
+	dprintf("    comm events: %10ld\n", total_comm);
+	dprintf(" unknown events: %10ld\n", total_unknown);
 
+	if (dump_trace)
 		return 0;
-	}
 
 	if (verbose >= 2)
 		dsos__fprintf(stdout);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Improve sort key recognition
       [not found]             ` <new-submission>
                                 ` (120 preceding siblings ...)
  2009-06-03  9:48               ` tip-bot for Ingo Molnar
@ 2009-06-03  9:48               ` tip-bot for Ingo Molnar
  2009-06-03  9:48               ` [tip:perfcounters/core] perf report: Handle vDSO symbols properly tip-bot for Ingo Molnar
                                 ` (585 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03  9:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  5352f35d6ae7b8b981d77137fb268bc54d10624f
Gitweb:     http://git.kernel.org/tip/5352f35d6ae7b8b981d77137fb268bc54d10624f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 10:07:39 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 10:07:39 +0200

perf report: Improve sort key recognition

 - allow case-insensitive tokens - such as --sort Comm,Symbol
 - allow substring shortcuts: --sort sym
 - detect invalid tokens and bail out

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   29 +++++++++++++++-----------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6207a31..a8d3905 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -453,28 +453,18 @@ static int sort_dimension__add(char *tok)
 		if (sd->taken)
 			continue;
 
-		if (strcmp(tok, sd->name))
+		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
 		list_add_tail(&sd->entry->list, &hist_entry__sort_list);
 		sd->taken = 1;
+
 		return 0;
 	}
 
 	return -ESRCH;
 }
 
-static void setup_sorting(void)
-{
-	char *tmp, *tok, *str = strdup(sort_order);
-
-	for (tok = strtok_r(str, ", ", &tmp);
-			tok; tok = strtok_r(NULL, ", ", &tmp))
-		sort_dimension__add(tok);
-
-	free(str);
-}
-
 static int64_t
 hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
 {
@@ -880,6 +870,21 @@ static const struct option options[] = {
 	OPT_END()
 };
 
+static void setup_sorting(void)
+{
+	char *tmp, *tok, *str = strdup(sort_order);
+
+	for (tok = strtok_r(str, ", ", &tmp);
+			tok; tok = strtok_r(NULL, ", ", &tmp)) {
+		if (sort_dimension__add(tok) < 0) {
+			error("Unknown --sort key: `%s'", tok);
+			usage_with_options(report_usage, options);
+		}
+	}
+
+	free(str);
+}
+
 int cmd_report(int argc, const char **argv, const char *prefix)
 {
 	symbol__init();

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Handle vDSO symbols properly
       [not found]             ` <new-submission>
                                 ` (121 preceding siblings ...)
  2009-06-03  9:48               ` [tip:perfcounters/core] perf report: Improve sort key recognition tip-bot for Ingo Molnar
@ 2009-06-03  9:48               ` tip-bot for Ingo Molnar
  2009-06-03 13:06               ` [tip:perfcounters/core] perf_counter: Add a comm hook for pure fork()s tip-bot for Peter Zijlstra
                                 ` (584 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03  9:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  ed966aac335a63083d3125198479447248637d9e
Gitweb:     http://git.kernel.org/tip/ed966aac335a63083d3125198479447248637d9e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 10:39:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 10:39:26 +0200

perf report: Handle vDSO symbols properly

We were not looking up vDSO symbols properly, because they
are in the kallsyms but are user-mode entries.

Pass negative addresses to the kernel dso object, this
way we resolve them properly:

     0.05%  [kernel]: vread_tsc

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index a8d3905..0f88d9e 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -728,6 +728,8 @@ more:
 			event->ip.pid,
 			(void *)(long)ip);
 
+		dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, skipping it.\n",
 				event->header.type);
@@ -740,6 +742,8 @@ more:
 
 			dso = kernel_dso;
 
+			dprintf(" ...... dso: %s\n", dso->name);
+
 		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
 
 			show = SHOW_USER;
@@ -749,11 +753,22 @@ more:
 			if (map != NULL) {
 				dso = map->dso;
 				ip -= map->start + map->pgoff;
+			} else {
+				/*
+				 * If this is outside of all known maps,
+				 * and is a negative address, try to look it
+				 * up in the kernel dso, as it might be a
+				 * vsyscall (which executes in user-mode):
+				 */
+				if ((long long)ip < 0)
+					dso = kernel_dso;
 			}
+			dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
 
 		} else {
 			show = SHOW_HV;
 			level = 'H';
+			dprintf(" ...... dso: [hypervisor]\n");
 		}
 
 		if (show & show_mask) {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add a comm hook for pure fork()s
       [not found]             ` <new-submission>
                                 ` (122 preceding siblings ...)
  2009-06-03  9:48               ` [tip:perfcounters/core] perf report: Handle vDSO symbols properly tip-bot for Ingo Molnar
@ 2009-06-03 13:06               ` tip-bot for Peter Zijlstra
  2009-06-03 13:06               ` [tip:perfcounters/core] perf record: Use long arg for counter period tip-bot for Peter Zijlstra
                                 ` (583 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-03 13:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  226f62fdd53d5b2c74e242aa11f6ad43d0285d3f
Gitweb:     http://git.kernel.org/tip/226f62fdd53d5b2c74e242aa11f6ad43d0285d3f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 3 Jun 2009 11:23:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 14:14:30 +0200

perf_counter: Add a comm hook for pure fork()s

I noticed missing COMM events and found that we missed
reporting them for pure forks.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/fork.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 23bf757..b7d7a9f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1412,6 +1412,12 @@ long do_fork(unsigned long clone_flags,
 		if (clone_flags & CLONE_VFORK) {
 			p->vfork_done = &vfork;
 			init_completion(&vfork);
+		} else {
+			/*
+			 * vfork will do an exec which will call
+			 * set_task_comm()
+			 */
+			perf_counter_comm(p);
 		}
 
 		audit_finish_fork(p);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Use long arg for counter period
       [not found]             ` <new-submission>
                                 ` (123 preceding siblings ...)
  2009-06-03 13:06               ` [tip:perfcounters/core] perf_counter: Add a comm hook for pure fork()s tip-bot for Peter Zijlstra
@ 2009-06-03 13:06               ` tip-bot for Peter Zijlstra
  2009-06-03 13:06               ` [tip:perfcounters/core] perf report: Fix comm sorting tip-bot for Peter Zijlstra
                                 ` (582 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-03 13:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  e61078a0c88773d3465b0b9d665c5ed6b952b1cf
Gitweb:     http://git.kernel.org/tip/e61078a0c88773d3465b0b9d665c5ed6b952b1cf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 3 Jun 2009 11:24:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 14:14:31 +0200

perf record: Use long arg for counter period

I wrote this to test the extended period emulation, we might as
well merge it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c     |    6 +++---
 Documentation/perf_counter/util/parse-options.c |   16 ++++++++++++++++
 Documentation/perf_counter/util/parse-options.h |    2 ++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index ec3b73a..cea5b8d 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -20,8 +20,8 @@
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a)-1)
 #define __ALIGN_MASK(x, mask)	(((x)+(mask))&~(mask))
 
-static int			default_interval = 100000;
-static int			event_count[MAX_COUNTERS];
+static long			default_interval = 100000;
+static long			event_count[MAX_COUNTERS];
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 static int			nr_cpus				= 0;
@@ -494,7 +494,7 @@ static const struct option options[] = {
 			    "append to the output file to do incremental profiling"),
 	OPT_BOOLEAN('f', "force", &force,
 			"overwrite existing data file"),
-	OPT_INTEGER('c', "count", &default_interval,
+	OPT_LONG('c', "count", &default_interval,
 		    "event period to sample"),
 	OPT_STRING('o', "output", &output_name, "file",
 		    "output file name"),
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c
index 28b34c1..b80abd9 100644
--- a/Documentation/perf_counter/util/parse-options.c
+++ b/Documentation/perf_counter/util/parse-options.c
@@ -113,6 +113,22 @@ static int get_value(struct parse_opt_ctx_t *p,
 			return opterror(opt, "expects a numerical value", flags);
 		return 0;
 
+	case OPTION_LONG:
+		if (unset) {
+			*(long *)opt->value = 0;
+			return 0;
+		}
+		if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
+			*(long *)opt->value = opt->defval;
+			return 0;
+		}
+		if (get_arg(p, opt, flags, &arg))
+			return -1;
+		*(long *)opt->value = strtol(arg, (char **)&s, 10);
+		if (*s)
+			return opterror(opt, "expects a numerical value", flags);
+		return 0;
+
 	default:
 		die("should not happen, someone must be hit on the forehead");
 	}
diff --git a/Documentation/perf_counter/util/parse-options.h b/Documentation/perf_counter/util/parse-options.h
index a81c7fa..a1039a6 100644
--- a/Documentation/perf_counter/util/parse-options.h
+++ b/Documentation/perf_counter/util/parse-options.h
@@ -14,6 +14,7 @@ enum parse_opt_type {
 	/* options with arguments (usually) */
 	OPTION_STRING,
 	OPTION_INTEGER,
+	OPTION_LONG,
 	OPTION_CALLBACK,
 };
 
@@ -97,6 +98,7 @@ struct option {
 #define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
 #define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
 #define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
+#define OPT_LONG(s, l, v, h)        { OPTION_LONG, (s), (l), (v), NULL, (h) }
 #define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
 #define OPT_DATE(s, l, v, h) \
 	{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix comm sorting
       [not found]             ` <new-submission>
                                 ` (124 preceding siblings ...)
  2009-06-03 13:06               ` [tip:perfcounters/core] perf record: Use long arg for counter period tip-bot for Peter Zijlstra
@ 2009-06-03 13:06               ` tip-bot for Peter Zijlstra
  2009-06-03 13:07               ` [tip:perfcounters/core] perf_counter: Fix race in counter initialization tip-bot for Peter Zijlstra
                                 ` (581 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-03 13:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  8229289b607682f90b946ad2c319526303c17700
Gitweb:     http://git.kernel.org/tip/8229289b607682f90b946ad2c319526303c17700
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 3 Jun 2009 12:37:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 14:14:31 +0200

perf report: Fix comm sorting

Since we can (and do) change comm strings during the collection
phase, we cannot actually sort on them to build the histogram.
Therefore add an (optional) third sorting phase to collapse the
histrogram.

Comm sorting now builds the histrogram on threads and then in
the collapse phase collects all threads with the same comm.

This collapsed histogram is then reversed and sorted on events.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  118 +++++++++++++++++++++++++--
 1 files changed, 112 insertions(+), 6 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 0f88d9e..6d359c9 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -211,9 +211,9 @@ static struct thread *thread__new(pid_t pid)
 
 	if (self != NULL) {
 		self->pid = pid;
-		self->comm = malloc(30);
+		self->comm = malloc(32);
 		if (self->comm)
-			sprintf(self->comm, ":%d", pid);
+			snprintf(self->comm, 32, ":%d", self->pid);
 		INIT_LIST_HEAD(&self->maps);
 	}
 
@@ -222,6 +222,8 @@ static struct thread *thread__new(pid_t pid)
 
 static int thread__set_comm(struct thread *self, const char *comm)
 {
+	if (self->comm)
+		free(self->comm);
 	self->comm = strdup(comm);
 	return self->comm ? 0 : -ENOMEM;
 }
@@ -303,9 +305,12 @@ struct sort_entry {
 	char *header;
 
 	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
+	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
 	size_t	(*print)(FILE *fp, struct hist_entry *);
 };
 
+/* --sort pid */
+
 static int64_t
 sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 {
@@ -324,9 +329,17 @@ static struct sort_entry sort_thread = {
 	.print	= sort__thread_print,
 };
 
+/* --sort comm */
+
 static int64_t
 sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
 {
+	return right->thread->pid - left->thread->pid;
+}
+
+static int64_t
+sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
+{
 	char *comm_l = left->thread->comm;
 	char *comm_r = right->thread->comm;
 
@@ -349,11 +362,14 @@ sort__comm_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_comm = {
-	.header = "          Command",
-	.cmp	= sort__comm_cmp,
-	.print	= sort__comm_print,
+	.header 	= "          Command",
+	.cmp		= sort__comm_cmp,
+	.collapse	= sort__comm_collapse,
+	.print		= sort__comm_print,
 };
 
+/* --sort dso */
+
 static int64_t
 sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 {
@@ -387,6 +403,8 @@ static struct sort_entry sort_dso = {
 	.print	= sort__dso_print,
 };
 
+/* --sort symbol */
+
 static int64_t
 sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
 {
@@ -428,6 +446,8 @@ static struct sort_entry sort_sym = {
 	.print	= sort__sym_print,
 };
 
+static int sort__need_collapse = 0;
+
 struct sort_dimension {
 	char *name;
 	struct sort_entry *entry;
@@ -456,6 +476,9 @@ static int sort_dimension__add(char *tok)
 		if (strncasecmp(tok, sd->name, strlen(tok)))
 			continue;
 
+		if (sd->entry->collapse)
+			sort__need_collapse = 1;
+
 		list_add_tail(&sd->entry->list, &hist_entry__sort_list);
 		sd->taken = 1;
 
@@ -480,6 +503,25 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
 	return cmp;
 }
 
+static int64_t
+hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
+{
+	struct sort_entry *se;
+	int64_t cmp = 0;
+
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		int64_t (*f)(struct hist_entry *, struct hist_entry *);
+
+		f = se->collapse ?: se->cmp;
+
+		cmp = f(left, right);
+		if (cmp)
+			break;
+	}
+
+	return cmp;
+}
+
 static size_t
 hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 {
@@ -549,6 +591,64 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 	return 0;
 }
 
+static void hist_entry__free(struct hist_entry *he)
+{
+	free(he);
+}
+
+/*
+ * collapse the histogram
+ */
+
+static struct rb_root collapse_hists;
+
+static void collapse__insert_entry(struct hist_entry *he)
+{
+	struct rb_node **p = &collapse_hists.rb_node;
+	struct rb_node *parent = NULL;
+	struct hist_entry *iter;
+	int64_t cmp;
+
+	while (*p != NULL) {
+		parent = *p;
+		iter = rb_entry(parent, struct hist_entry, rb_node);
+
+		cmp = hist_entry__collapse(iter, he);
+
+		if (!cmp) {
+			iter->count += he->count;
+			hist_entry__free(he);
+			return;
+		}
+
+		if (cmp < 0)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	rb_link_node(&he->rb_node, parent, p);
+	rb_insert_color(&he->rb_node, &collapse_hists);
+}
+
+static void collapse__resort(void)
+{
+	struct rb_node *next;
+	struct hist_entry *n;
+
+	if (!sort__need_collapse)
+		return;
+
+	next = rb_first(&hist);
+	while (next) {
+		n = rb_entry(next, struct hist_entry, rb_node);
+		next = rb_next(&n->rb_node);
+
+		rb_erase(&n->rb_node, &hist);
+		collapse__insert_entry(n);
+	}
+}
+
 /*
  * reverse the map, sort on count.
  */
@@ -577,9 +677,14 @@ static void output__insert_entry(struct hist_entry *he)
 
 static void output__resort(void)
 {
-	struct rb_node *next = rb_first(&hist);
+	struct rb_node *next;
 	struct hist_entry *n;
 
+	if (sort__need_collapse)
+		next = rb_first(&collapse_hists);
+	else
+		next = rb_first(&hist);
+
 	while (next) {
 		n = rb_entry(next, struct hist_entry, rb_node);
 		next = rb_next(&n->rb_node);
@@ -859,6 +964,7 @@ broken_event:
 	if (verbose >= 2)
 		dsos__fprintf(stdout);
 
+	collapse__resort();
 	output__resort();
 	output__fprintf(stdout, total);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix race in counter initialization
       [not found]             ` <new-submission>
                                 ` (125 preceding siblings ...)
  2009-06-03 13:06               ` [tip:perfcounters/core] perf report: Fix comm sorting tip-bot for Peter Zijlstra
@ 2009-06-03 13:07               ` tip-bot for Peter Zijlstra
  2009-06-03 18:24               ` [tip:perfcounters/core] perf_counter tools: Clean up old kerneltop references tip-bot for Ingo Molnar
                                 ` (580 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-03 13:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, jkacur, a.p.zijlstra,
	efault, mtosatti, tglx, cjashfor, mingo

Commit-ID:  a96bbc16418bc691317f265d6bf98ba941ca9c1a
Gitweb:     http://git.kernel.org/tip/a96bbc16418bc691317f265d6bf98ba941ca9c1a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 3 Jun 2009 14:01:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 14:57:03 +0200

perf_counter: Fix race in counter initialization

We need the PID namespace and counter ID available when the
counter overflows and we need to generate a sample event.

[ Impact: fix kernel crash with high-frequency sampling ]

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
[ fixed a further crash and cleaned up the initialization a bit ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 317cef7..ab44554 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -48,6 +48,8 @@ int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */
 int sysctl_perf_counter_mlock __read_mostly = 512; /* 'free' kb per user */
 int sysctl_perf_counter_limit __read_mostly = 100000; /* max NMIs per second */
 
+static atomic64_t perf_counter_id;
+
 /*
  * Lock for (sysadmin-configurable) counter reservations:
  */
@@ -3351,14 +3353,18 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 
 	mutex_init(&counter->mmap_mutex);
 
-	counter->cpu			= cpu;
+	counter->cpu		= cpu;
 	counter->attr		= *attr;
-	counter->group_leader		= group_leader;
-	counter->pmu			= NULL;
-	counter->ctx			= ctx;
-	counter->oncpu			= -1;
+	counter->group_leader	= group_leader;
+	counter->pmu		= NULL;
+	counter->ctx		= ctx;
+	counter->oncpu		= -1;
+
+	counter->ns		= get_pid_ns(current->nsproxy->pid_ns);
+	counter->id		= atomic64_inc_return(&perf_counter_id);
+
+	counter->state		= PERF_COUNTER_STATE_INACTIVE;
 
-	counter->state = PERF_COUNTER_STATE_INACTIVE;
 	if (attr->disabled)
 		counter->state = PERF_COUNTER_STATE_OFF;
 
@@ -3402,6 +3408,8 @@ done:
 		err = PTR_ERR(pmu);
 
 	if (err) {
+		if (counter->ns)
+			put_pid_ns(counter->ns);
 		kfree(counter);
 		return ERR_PTR(err);
 	}
@@ -3419,8 +3427,6 @@ done:
 	return counter;
 }
 
-static atomic64_t perf_counter_id;
-
 /**
  * sys_perf_counter_open - open a performance counter, associate it to a task/cpu
  *
@@ -3515,9 +3521,6 @@ SYSCALL_DEFINE5(perf_counter_open,
 	list_add_tail(&counter->owner_entry, &current->perf_counter_list);
 	mutex_unlock(&current->perf_counter_mutex);
 
-	counter->ns = get_pid_ns(current->nsproxy->pid_ns);
-	counter->id = atomic64_inc_return(&perf_counter_id);
-
 	fput_light(counter_file, fput_needed2);
 
 out_fput:

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Clean up old kerneltop references
       [not found]             ` <new-submission>
                                 ` (126 preceding siblings ...)
  2009-06-03 13:07               ` [tip:perfcounters/core] perf_counter: Fix race in counter initialization tip-bot for Peter Zijlstra
@ 2009-06-03 18:24               ` tip-bot for Ingo Molnar
  2009-06-03 18:33               ` [tip:perfcounters/core] perf record: Refine capture printout tip-bot for Ingo Molnar
                                 ` (579 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 18:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  f2521b6e4c365bd0aac61b2c346e6e9f22607e31
Gitweb:     http://git.kernel.org/tip/f2521b6e4c365bd0aac61b2c346e6e9f22607e31
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 19:17:25 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 19:17:25 +0200

perf_counter tools: Clean up old kerneltop references

kerneltop has been replaced with perf top - so fix up a few
remaining references to it in display text and error messages.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    6 +++---
 Documentation/perf_counter/builtin-top.c    |   14 ++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index cea5b8d..fa62525 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -357,7 +357,8 @@ static void open_counters(int cpu, pid_t pid)
 
 		if (fd[nr_cpu][counter] < 0) {
 			int err = errno;
-			printf("kerneltop error: syscall returned with %d (%s)\n",
+
+			error("syscall returned with %d (%s)\n",
 					fd[nr_cpu][counter], strerror(err));
 			if (err == EPERM)
 				printf("Are you root?\n");
@@ -382,8 +383,7 @@ static void open_counters(int cpu, pid_t pid)
 		mmap_array[nr_cpu][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
 				PROT_READ, MAP_SHARED, fd[nr_cpu][counter], 0);
 		if (mmap_array[nr_cpu][counter].base == MAP_FAILED) {
-			printf("kerneltop error: failed to mmap with %d (%s)\n",
-					errno, strerror(errno));
+			error("failed to mmap with %d (%s)\n", errno, strerror(errno));
 			exit(-1);
 		}
 	}
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index a639352..16a6184 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -208,7 +208,7 @@ static void print_sym_table(void)
 
 	printf(
 "------------------------------------------------------------------------------\n");
-	printf( " KernelTop:%8.0f irqs/sec  kernel:%4.1f%% [",
+	printf( "   PerfTop:%8.0f irqs/sec  kernel:%4.1f%% [",
 		events_per_sec,
 		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
 
@@ -281,7 +281,7 @@ static void print_sym_table(void)
 
 static void *display_thread(void *arg)
 {
-	printf("KernelTop refresh period: %d seconds\n", delay_secs);
+	printf("PerfTop refresh period: %d seconds\n", delay_secs);
 
 	while (!sleep(delay_secs))
 		print_sym_table();
@@ -564,7 +564,8 @@ static int __cmd_top(void)
 			fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
 			if (fd[i][counter] < 0) {
 				int err = errno;
-				printf("kerneltop error: syscall returned with %d (%s)\n",
+
+				error("syscall returned with %d (%s)\n",
 					fd[i][counter], strerror(err));
 				if (err == EPERM)
 					printf("Are you root?\n");
@@ -588,11 +589,8 @@ static int __cmd_top(void)
 			mmap_array[i][counter].mask = mmap_pages*page_size - 1;
 			mmap_array[i][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
 					PROT_READ, MAP_SHARED, fd[i][counter], 0);
-			if (mmap_array[i][counter].base == MAP_FAILED) {
-				printf("kerneltop error: failed to mmap with %d (%s)\n",
-						errno, strerror(errno));
-				exit(-1);
-			}
+			if (mmap_array[i][counter].base == MAP_FAILED)
+				die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Refine capture printout
       [not found]             ` <new-submission>
                                 ` (127 preceding siblings ...)
  2009-06-03 18:24               ` [tip:perfcounters/core] perf_counter tools: Clean up old kerneltop references tip-bot for Ingo Molnar
@ 2009-06-03 18:33               ` tip-bot for Ingo Molnar
  2009-06-03 18:42               ` [tip:perfcounters/core] perf report: Display 100% correctly tip-bot for Ingo Molnar
                                 ` (578 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 18:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  021e9f476511ebe23d7f45854a52dfe74c09b6ee
Gitweb:     http://git.kernel.org/tip/021e9f476511ebe23d7f45854a52dfe74c09b6ee
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 19:27:19 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 19:27:19 +0200

perf record: Refine capture printout

Print out the number of bytes captured, and the (estimated) number of
events the output file contains.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   34 +++++++++++++++++++--------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index fa62525..efa2eb4 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -67,6 +67,8 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 static long events;
 static struct timeval last_read, this_read;
 
+static __u64 bytes_written;
+
 static void mmap_read(struct mmap_data *md)
 {
 	unsigned int head = mmap_read_head(md);
@@ -114,28 +116,34 @@ static void mmap_read(struct mmap_data *md)
 		buf = &data[old & md->mask];
 		size = md->mask + 1 - (old & md->mask);
 		old += size;
+
 		while (size) {
 			int ret = write(output, buf, size);
-			if (ret < 0) {
-				perror("failed to write");
-				exit(-1);
-			}
+
+			if (ret < 0)
+				die("failed to write");
+
 			size -= ret;
 			buf += ret;
+
+			bytes_written += ret;
 		}
 	}
 
 	buf = &data[old & md->mask];
 	size = head - old;
 	old += size;
+
 	while (size) {
 		int ret = write(output, buf, size);
-		if (ret < 0) {
-			perror("failed to write");
-			exit(-1);
-		}
+
+		if (ret < 0)
+			die("failed to write");
+
 		size -= ret;
 		buf += ret;
+
+		bytes_written += ret;
 	}
 
 	md->prev = old;
@@ -467,8 +475,14 @@ static int __cmd_record(int argc, const char **argv)
 			ret = poll(event_array, nr_poll, 100);
 	}
 
-
-	fprintf(stderr, "[ perf record: Captured and wrote %ld events. ]\n", events);
+	/*
+	 * Approximate RIP event size: 24 bytes.
+	 */
+	fprintf(stderr,
+		"[ perf record: Captured and wrote %.3f MB %s (~%lld events) ]\n",
+		(double)bytes_written / 1024.0 / 1024.0,
+		output_name,
+		bytes_written / 24);
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Display 100% correctly
       [not found]             ` <new-submission>
                                 ` (128 preceding siblings ...)
  2009-06-03 18:33               ` [tip:perfcounters/core] perf record: Refine capture printout tip-bot for Ingo Molnar
@ 2009-06-03 18:42               ` tip-bot for Ingo Molnar
  2009-06-03 18:42               ` [tip:perfcounters/core] perf stat: Print out all arguments tip-bot for Ingo Molnar
                                 ` (577 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 18:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  e98e96fe43ae92fad0930f05fb2b298e49b9f3b5
Gitweb:     http://git.kernel.org/tip/e98e96fe43ae92fad0930f05fb2b298e49b9f3b5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 19:30:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 19:30:38 +0200

perf report: Display 100% correctly

Needs to be 6.2 not 5.2, for 100.00% to be aligned properly.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6d359c9..e837bb9 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -529,7 +529,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 	size_t ret;
 
 	if (total_samples) {
-		ret = fprintf(fp, "    %5.2f%%",
+		ret = fprintf(fp, "   %6.2f%%",
 				(self->count * 100.0) / total_samples);
 	} else
 		ret = fprintf(fp, "%12d ", self->count);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Print out all arguments
       [not found]             ` <new-submission>
                                 ` (129 preceding siblings ...)
  2009-06-03 18:42               ` [tip:perfcounters/core] perf report: Display 100% correctly tip-bot for Ingo Molnar
@ 2009-06-03 18:42               ` tip-bot for Ingo Molnar
  2009-06-03 19:15               ` [tip:perfcounters/core] perf report: Add front-entry cache for lookups tip-bot for Ingo Molnar
                                 ` (576 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 18:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  44db76c8553c328f4ae02481d77bb3a88ca17645
Gitweb:     http://git.kernel.org/tip/44db76c8553c328f4ae02481d77bb3a88ca17645
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 19:36:07 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 19:36:07 +0200

perf stat: Print out all arguments

Before:

 Performance counter stats for '/home/mingo/hackbench':

After:

 Performance counter stats for '/home/mingo/hackbench 10':

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-stat.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 2357a66..4fc0d80 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -228,6 +228,7 @@ static int do_perfstat(int argc, const char **argv)
 	int counter;
 	int status;
 	int pid;
+	int i;
 
 	if (!system_wide)
 		nr_cpus = 1;
@@ -243,14 +244,17 @@ static int do_perfstat(int argc, const char **argv)
 
 	if ((pid = fork()) < 0)
 		perror("failed to fork");
+
 	if (!pid) {
 		if (execvp(argv[0], (char **)argv)) {
 			perror(argv[0]);
 			exit(-1);
 		}
 	}
+
 	while (wait(&status) >= 0)
 		;
+
 	prctl(PR_TASK_PERF_COUNTERS_DISABLE);
 	t1 = rdclock();
 
@@ -259,8 +263,12 @@ static int do_perfstat(int argc, const char **argv)
 	fflush(stdout);
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " Performance counter stats for \'%s\':\n",
-		argv[0]);
+	fprintf(stderr, " Performance counter stats for \'%s", argv[0]);
+
+	for (i = 1; i < argc; i++)
+		fprintf(stderr, " %s", argv[i]);
+
+	fprintf(stderr, "\':\n");
 	fprintf(stderr, "\n");
 
 	for (counter = 0; counter < nr_counters; counter++)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add front-entry cache for lookups
       [not found]             ` <new-submission>
                                 ` (130 preceding siblings ...)
  2009-06-03 18:42               ` [tip:perfcounters/core] perf stat: Print out all arguments tip-bot for Ingo Molnar
@ 2009-06-03 19:15               ` tip-bot for Ingo Molnar
  2009-06-03 19:15               ` [tip:perfcounters/core] perf help: Fix bug when there's no perf-* command around tip-bot for Ingo Molnar
                                 ` (575 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 19:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  eed4dcd443da7a46131ef37c7a389b444905960e
Gitweb:     http://git.kernel.org/tip/eed4dcd443da7a46131ef37c7a389b444905960e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 19:59:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 20:03:32 +0200

perf report: Add front-entry cache for lookups

Before:

 Performance counter stats for './perf report -i perf.data.big':

     12453988058  instructions

 Performance counter stats for './perf report -i perf.data.big':

     12379566017  instructions

0.60% reduction.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index e837bb9..33b3b15 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -229,6 +229,7 @@ static int thread__set_comm(struct thread *self, const char *comm)
 }
 
 static struct rb_root threads;
+static struct thread *last_match;
 
 static struct thread *threads__findnew(pid_t pid)
 {
@@ -236,12 +237,22 @@ static struct thread *threads__findnew(pid_t pid)
 	struct rb_node *parent = NULL;
 	struct thread *th;
 
+	/*
+	 * Font-end cache - PID lookups come in blocks,
+	 * so most of the time we dont have to look up
+	 * the full rbtree:
+	 */
+	if (last_match && last_match->pid == pid)
+		return last_match;
+
 	while (*p != NULL) {
 		parent = *p;
 		th = rb_entry(parent, struct thread, rb_node);
 
-		if (th->pid == pid)
+		if (th->pid == pid) {
+			last_match = th;
 			return th;
+		}
 
 		if (pid < th->pid)
 			p = &(*p)->rb_left;
@@ -253,7 +264,9 @@ static struct thread *threads__findnew(pid_t pid)
 	if (th != NULL) {
 		rb_link_node(&th->rb_node, parent, p);
 		rb_insert_color(&th->rb_node, &threads);
+		last_match = th;
 	}
+
 	return th;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf help: Fix bug when there's no perf-* command around
       [not found]             ` <new-submission>
                                 ` (131 preceding siblings ...)
  2009-06-03 19:15               ` [tip:perfcounters/core] perf report: Add front-entry cache for lookups tip-bot for Ingo Molnar
@ 2009-06-03 19:15               ` tip-bot for Ingo Molnar
  2009-06-03 19:21               ` [tip:perfcounters/core] perf_counter tools: Optimize harder tip-bot for Ingo Molnar
                                 ` (574 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 19:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	rostedt, mtosatti, tglx, cjashfor, mingo

Commit-ID:  051cdc3c2d0e24443ac03aff03ee89807ec8c589
Gitweb:     http://git.kernel.org/tip/051cdc3c2d0e24443ac03aff03ee89807ec8c589
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 20:09:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 20:09:11 +0200

perf help: Fix bug when there's no perf-* command around

main_cmds can be empty - fix util/help.c to handle this case
without segfaulting.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/help.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Documentation/perf_counter/util/help.c b/Documentation/perf_counter/util/help.c
index 397487f..6653f7d 100644
--- a/Documentation/perf_counter/util/help.c
+++ b/Documentation/perf_counter/util/help.c
@@ -298,7 +298,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
 
 const char *help_unknown_cmd(const char *cmd)
 {
-	int i, n, best_similarity = 0;
+	int i, n = 0, best_similarity = 0;
 	struct cmdnames main_cmds, other_cmds;
 
 	memset(&main_cmds, 0, sizeof(main_cmds));
@@ -315,20 +315,24 @@ const char *help_unknown_cmd(const char *cmd)
 	      sizeof(main_cmds.names), cmdname_compare);
 	uniq(&main_cmds);
 
-	/* This reuses cmdname->len for similarity index */
-	for (i = 0; i < main_cmds.cnt; ++i)
-		main_cmds.names[i]->len =
-			levenshtein(cmd, main_cmds.names[i]->name, 0, 2, 1, 4);
+	if (main_cmds.cnt) {
+		/* This reuses cmdname->len for similarity index */
+		for (i = 0; i < main_cmds.cnt; ++i)
+			main_cmds.names[i]->len =
+				levenshtein(cmd, main_cmds.names[i]->name, 0, 2, 1, 4);
 
-	qsort(main_cmds.names, main_cmds.cnt,
-	      sizeof(*main_cmds.names), levenshtein_compare);
+		qsort(main_cmds.names, main_cmds.cnt,
+		      sizeof(*main_cmds.names), levenshtein_compare);
+
+		best_similarity = main_cmds.names[0]->len;
+		n = 1;
+		while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)
+			++n;
+	}
 
-	best_similarity = main_cmds.names[0]->len;
-	n = 1;
-	while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)
-		++n;
 	if (autocorrect && n == 1) {
 		const char *assumed = main_cmds.names[0]->name;
+
 		main_cmds.names[0] = NULL;
 		clean_cmdnames(&main_cmds);
 		fprintf(stderr, "WARNING: You called a Git program named '%s', "
@@ -345,7 +349,7 @@ const char *help_unknown_cmd(const char *cmd)
 
 	fprintf(stderr, "perf: '%s' is not a perf-command. See 'perf --help'.\n", cmd);
 
-	if (best_similarity < 6) {
+	if (main_cmds.cnt && best_similarity < 6) {
 		fprintf(stderr, "\nDid you mean %s?\n",
 			n < 2 ? "this": "one of these");
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Optimize harder
       [not found]             ` <new-submission>
                                 ` (132 preceding siblings ...)
  2009-06-03 19:15               ` [tip:perfcounters/core] perf help: Fix bug when there's no perf-* command around tip-bot for Ingo Molnar
@ 2009-06-03 19:21               ` tip-bot for Ingo Molnar
  2009-06-03 21:42               ` [tip:perfcounters/core] perf_counter: Fix throttling lock-up tip-bot for Ingo Molnar
                                 ` (573 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 19:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  095b3a6a030f7d4f24825ae93fc384b3d4b4fafa
Gitweb:     http://git.kernel.org/tip/095b3a6a030f7d4f24825ae93fc384b3d4b4fafa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 20:13:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 20:15:15 +0200

perf_counter tools: Optimize harder

Use -O6 to build the tools.

Before:

    12387507370  instructions         #    3121.653 M/sec

After:

     6244894971  instructions         #    3458.437 M/sec

Almost twice as fast!

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index eae8856..005709b 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -159,7 +159,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement
+CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6
 LDFLAGS = -lpthread -lrt -lelf
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix throttling lock-up
       [not found]             ` <new-submission>
                                 ` (133 preceding siblings ...)
  2009-06-03 19:21               ` [tip:perfcounters/core] perf_counter tools: Optimize harder tip-bot for Ingo Molnar
@ 2009-06-03 21:42               ` tip-bot for Ingo Molnar
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Clean up event processing tip-bot for Ingo Molnar
                                 ` (572 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 21:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  128f048f0f0d2a477ad2555e7acd2ad15a1b6061
Gitweb:     http://git.kernel.org/tip/128f048f0f0d2a477ad2555e7acd2ad15a1b6061
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 22:19:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 23:39:51 +0200

perf_counter: Fix throttling lock-up

Throttling logic is broken and we can lock up with too small
hw sampling intervals.

Make the throttling code more robust: disable counters even
if we already disabled them.

( Also clean up whitespace damage i noticed while reading
  various pieces of code related to throttling. )

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    2 +-
 kernel/perf_counter.c              |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 12cc05e..8f53f3a 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -91,7 +91,7 @@ static u64 intel_pmu_raw_event(u64 event)
 #define CORE_EVNTSEL_INV_MASK		0x00800000ULL
 #define CORE_EVNTSEL_COUNTER_MASK	0xFF000000ULL
 
-#define CORE_EVNTSEL_MASK 		\
+#define CORE_EVNTSEL_MASK		\
 	(CORE_EVNTSEL_EVENT_MASK |	\
 	 CORE_EVNTSEL_UNIT_MASK  |	\
 	 CORE_EVNTSEL_EDGE_MASK  |	\
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ab44554..0bb03f1 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2822,11 +2822,20 @@ int perf_counter_overflow(struct perf_counter *counter,
 
 	if (!throttle) {
 		counter->hw.interrupts++;
-	} else if (counter->hw.interrupts != MAX_INTERRUPTS) {
-		counter->hw.interrupts++;
-		if (HZ*counter->hw.interrupts > (u64)sysctl_perf_counter_limit) {
-			counter->hw.interrupts = MAX_INTERRUPTS;
-			perf_log_throttle(counter, 0);
+	} else {
+		if (counter->hw.interrupts != MAX_INTERRUPTS) {
+			counter->hw.interrupts++;
+			if (HZ*counter->hw.interrupts > (u64)sysctl_perf_counter_limit) {
+				counter->hw.interrupts = MAX_INTERRUPTS;
+				perf_log_throttle(counter, 0);
+				ret = 1;
+			}
+		} else {
+			/*
+			 * Keep re-disabling counters even though on the previous
+			 * pass we disabled it - just in case we raced with a
+			 * sched-in and the counter got enabled again:
+			 */
 			ret = 1;
 		}
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Clean up event processing
       [not found]             ` <new-submission>
                                 ` (134 preceding siblings ...)
  2009-06-03 21:42               ` [tip:perfcounters/core] perf_counter: Fix throttling lock-up tip-bot for Ingo Molnar
@ 2009-06-03 22:35               ` tip-bot for Ingo Molnar
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Split out event processing helpers tip-bot for Ingo Molnar
                                 ` (571 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 22:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  d80d338d2fb611b65830db7ea56680624776030f
Gitweb:     http://git.kernel.org/tip/d80d338d2fb611b65830db7ea56680624776030f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 23:14:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 23:14:49 +0200

perf report: Clean up event processing

- Split out event processig into process_events() helper.

- Untangle the cwd parameters - it's constant so can be a static.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  186 ++++++++++++++-------------
 1 files changed, 98 insertions(+), 88 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 33b3b15..333d312 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -147,7 +147,11 @@ static int load_kernel(void)
 	return err;
 }
 
-static int strcommon(const char *pathname, const char *cwd, int cwdlen)
+static char __cwd[PATH_MAX];
+static char *cwd = __cwd;
+static int cwdlen;
+
+static int strcommon(const char *pathname)
 {
 	int n = 0;
 
@@ -165,7 +169,7 @@ struct map {
 	struct dso	 *dso;
 };
 
-static struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen)
+static struct map *map__new(struct mmap_event *event)
 {
 	struct map *self = malloc(sizeof(*self));
 
@@ -174,7 +178,8 @@ static struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen)
 		char newfilename[PATH_MAX];
 
 		if (cwd) {
-			int n = strcommon(filename, cwd, cwdlen);
+			int n = strcommon(filename);
+
 			if (n == cwdlen) {
 				snprintf(newfilename, sizeof(newfilename),
 					 ".%s", filename + n);
@@ -752,85 +757,11 @@ static void register_idle_thread(void)
 	}
 }
 
+static unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
 
-static int __cmd_report(void)
+static int
+process_event(event_t *event, unsigned long offset, unsigned long head)
 {
-	unsigned long offset = 0;
-	unsigned long head = 0;
-	struct stat stat;
-	char *buf;
-	event_t *event;
-	int ret, rc = EXIT_FAILURE;
-	uint32_t size;
-	unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
-	char cwd[PATH_MAX], *cwdp = cwd;
-	int cwdlen;
-
-	register_idle_thread();
-
-	input = open(input_name, O_RDONLY);
-	if (input < 0) {
-		perror("failed to open file");
-		exit(-1);
-	}
-
-	ret = fstat(input, &stat);
-	if (ret < 0) {
-		perror("failed to stat file");
-		exit(-1);
-	}
-
-	if (!stat.st_size) {
-		fprintf(stderr, "zero-sized file, nothing to do!\n");
-		exit(0);
-	}
-
-	if (load_kernel() < 0) {
-		perror("failed to load kernel symbols");
-		return EXIT_FAILURE;
-	}
-
-	if (!full_paths) {
-		if (getcwd(cwd, sizeof(cwd)) == NULL) {
-			perror("failed to get the current directory");
-			return EXIT_FAILURE;
-		}
-		cwdlen = strlen(cwd);
-	} else {
-		cwdp = NULL;
-		cwdlen = 0;
-	}
-remap:
-	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
-			   MAP_SHARED, input, offset);
-	if (buf == MAP_FAILED) {
-		perror("failed to mmap file");
-		exit(-1);
-	}
-
-more:
-	event = (event_t *)(buf + head);
-
-	size = event->header.size;
-	if (!size)
-		size = 8;
-
-	if (head + event->header.size >= page_size * mmap_window) {
-		unsigned long shift = page_size * (head / page_size);
-		int ret;
-
-		ret = munmap(buf, page_size * mmap_window);
-		assert(ret == 0);
-
-		offset += shift;
-		head -= shift;
-		goto remap;
-	}
-
-	size = event->header.size;
-	if (!size)
-		goto broken_event;
-
 	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
 		char level;
 		int show = 0;
@@ -851,7 +782,7 @@ more:
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, skipping it.\n",
 				event->header.type);
-			goto broken_event;
+			return -1;
 		}
 
 		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
@@ -895,14 +826,14 @@ more:
 			if (hist_entry__add(thread, map, dso, sym, ip, level)) {
 				fprintf(stderr,
 		"problem incrementing symbol count, skipping event\n");
-				goto broken_event;
+				return -1;
 			}
 		}
 		total++;
 	} else switch (event->header.type) {
 	case PERF_EVENT_MMAP: {
 		struct thread *thread = threads__findnew(event->mmap.pid);
-		struct map *map = map__new(&event->mmap, cwdp, cwdlen);
+		struct map *map = map__new(&event->mmap);
 
 		dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
 			(void *)(offset + head),
@@ -915,7 +846,7 @@ more:
 		if (thread == NULL || map == NULL) {
 			if (verbose)
 				fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
-			goto broken_event;
+			return -1;
 		}
 		thread__insert_map(thread, map);
 		total_mmap++;
@@ -932,13 +863,93 @@ more:
 		if (thread == NULL ||
 		    thread__set_comm(thread, event->comm.comm)) {
 			fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
-			goto broken_event;
+			return -1;
 		}
 		total_comm++;
 		break;
 	}
-	default: {
-broken_event:
+	default:
+		return -1;
+	}
+
+	return 0;
+}
+
+static int __cmd_report(void)
+{
+	unsigned long offset = 0;
+	unsigned long head = 0;
+	struct stat stat;
+	char *buf;
+	event_t *event;
+	int ret, rc = EXIT_FAILURE;
+	uint32_t size;
+
+	register_idle_thread();
+
+	input = open(input_name, O_RDONLY);
+	if (input < 0) {
+		perror("failed to open file");
+		exit(-1);
+	}
+
+	ret = fstat(input, &stat);
+	if (ret < 0) {
+		perror("failed to stat file");
+		exit(-1);
+	}
+
+	if (!stat.st_size) {
+		fprintf(stderr, "zero-sized file, nothing to do!\n");
+		exit(0);
+	}
+
+	if (load_kernel() < 0) {
+		perror("failed to load kernel symbols");
+		return EXIT_FAILURE;
+	}
+
+	if (!full_paths) {
+		if (getcwd(__cwd, sizeof(__cwd)) == NULL) {
+			perror("failed to get the current directory");
+			return EXIT_FAILURE;
+		}
+		cwdlen = strlen(cwd);
+	} else {
+		cwd = NULL;
+		cwdlen = 0;
+	}
+remap:
+	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
+			   MAP_SHARED, input, offset);
+	if (buf == MAP_FAILED) {
+		perror("failed to mmap file");
+		exit(-1);
+	}
+
+more:
+	event = (event_t *)(buf + head);
+
+	size = event->header.size;
+	if (!size)
+		size = 8;
+
+	if (head + event->header.size >= page_size * mmap_window) {
+		unsigned long shift = page_size * (head / page_size);
+		int ret;
+
+		ret = munmap(buf, page_size * mmap_window);
+		assert(ret == 0);
+
+		offset += shift;
+		head -= shift;
+		goto remap;
+	}
+
+	size = event->header.size;
+
+	if (!size || process_event(event, offset, head) < 0) {
+
 		dprintf("%p [%p]: skipping unknown header type: %d\n",
 			(void *)(offset + head),
 			(void *)(long)(event->header.size),
@@ -956,7 +967,6 @@ broken_event:
 
 		size = 8;
 	}
-	}
 
 	head += size;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Split out event processing helpers
       [not found]             ` <new-submission>
                                 ` (135 preceding siblings ...)
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Clean up event processing tip-bot for Ingo Molnar
@ 2009-06-03 22:35               ` tip-bot for Ingo Molnar
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Handle all known event types tip-bot for Ingo Molnar
                                 ` (570 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 22:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  75051724f78677532618dd164a515baf106990e5
Gitweb:     http://git.kernel.org/tip/75051724f78677532618dd164a515baf106990e5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 23:14:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 23:26:49 +0200

perf report: Split out event processing helpers

- Introduce per event helper functions

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  213 +++++++++++++++------------
 1 files changed, 119 insertions(+), 94 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 333d312..82b6252 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -50,6 +50,7 @@ struct ip_event {
 	__u64 ip;
 	__u32 pid, tid;
 };
+
 struct mmap_event {
 	struct perf_event_header header;
 	__u32 pid, tid;
@@ -58,9 +59,10 @@ struct mmap_event {
 	__u64 pgoff;
 	char filename[PATH_MAX];
 };
+
 struct comm_event {
 	struct perf_event_header header;
-	__u32 pid,tid;
+	__u32 pid, tid;
 	char comm[16];
 };
 
@@ -760,114 +762,137 @@ static void register_idle_thread(void)
 static unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
 
 static int
-process_event(event_t *event, unsigned long offset, unsigned long head)
+process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 {
-	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
-		char level;
-		int show = 0;
-		struct dso *dso = NULL;
-		struct thread *thread = threads__findnew(event->ip.pid);
-		uint64_t ip = event->ip.ip;
-		struct map *map = NULL;
-
-		dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
-			(void *)(offset + head),
-			(void *)(long)(event->header.size),
-			event->header.misc,
-			event->ip.pid,
-			(void *)(long)ip);
-
-		dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
-
-		if (thread == NULL) {
-			fprintf(stderr, "problem processing %d event, skipping it.\n",
-				event->header.type);
-			return -1;
-		}
-
-		if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
-			show = SHOW_KERNEL;
-			level = 'k';
+	char level;
+	int show = 0;
+	struct dso *dso = NULL;
+	struct thread *thread = threads__findnew(event->ip.pid);
+	uint64_t ip = event->ip.ip;
+	struct map *map = NULL;
+
+	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->header.misc,
+		event->ip.pid,
+		(void *)(long)ip);
+
+	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
+	if (thread == NULL) {
+		fprintf(stderr, "problem processing %d event, skipping it.\n",
+			event->header.type);
+		return -1;
+	}
 
-			dso = kernel_dso;
+	if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
+		show = SHOW_KERNEL;
+		level = 'k';
 
-			dprintf(" ...... dso: %s\n", dso->name);
+		dso = kernel_dso;
 
-		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
+		dprintf(" ...... dso: %s\n", dso->name);
 
-			show = SHOW_USER;
-			level = '.';
+	} else if (event->header.misc & PERF_EVENT_MISC_USER) {
 
-			map = thread__find_map(thread, ip);
-			if (map != NULL) {
-				dso = map->dso;
-				ip -= map->start + map->pgoff;
-			} else {
-				/*
-				 * If this is outside of all known maps,
-				 * and is a negative address, try to look it
-				 * up in the kernel dso, as it might be a
-				 * vsyscall (which executes in user-mode):
-				 */
-				if ((long long)ip < 0)
-					dso = kernel_dso;
-			}
-			dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
+		show = SHOW_USER;
+		level = '.';
 
+		map = thread__find_map(thread, ip);
+		if (map != NULL) {
+			dso = map->dso;
+			ip -= map->start + map->pgoff;
 		} else {
-			show = SHOW_HV;
-			level = 'H';
-			dprintf(" ...... dso: [hypervisor]\n");
+			/*
+			 * If this is outside of all known maps,
+			 * and is a negative address, try to look it
+			 * up in the kernel dso, as it might be a
+			 * vsyscall (which executes in user-mode):
+			 */
+			if ((long long)ip < 0)
+				dso = kernel_dso;
 		}
+		dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
 
-		if (show & show_mask) {
-			struct symbol *sym = dso__find_symbol(dso, ip);
+	} else {
+		show = SHOW_HV;
+		level = 'H';
+		dprintf(" ...... dso: [hypervisor]\n");
+	}
 
-			if (hist_entry__add(thread, map, dso, sym, ip, level)) {
-				fprintf(stderr,
-		"problem incrementing symbol count, skipping event\n");
-				return -1;
-			}
-		}
-		total++;
-	} else switch (event->header.type) {
-	case PERF_EVENT_MMAP: {
-		struct thread *thread = threads__findnew(event->mmap.pid);
-		struct map *map = map__new(&event->mmap);
+	if (show & show_mask) {
+		struct symbol *sym = dso__find_symbol(dso, ip);
 
-		dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
-			(void *)(offset + head),
-			(void *)(long)(event->header.size),
-			(void *)(long)event->mmap.start,
-			(void *)(long)event->mmap.len,
-			(void *)(long)event->mmap.pgoff,
-			event->mmap.filename);
-
-		if (thread == NULL || map == NULL) {
-			if (verbose)
-				fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
+		if (hist_entry__add(thread, map, dso, sym, ip, level)) {
+			fprintf(stderr,
+		"problem incrementing symbol count, skipping event\n");
 			return -1;
 		}
-		thread__insert_map(thread, map);
-		total_mmap++;
-		break;
 	}
-	case PERF_EVENT_COMM: {
-		struct thread *thread = threads__findnew(event->comm.pid);
+	total++;
 
-		dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
-			(void *)(offset + head),
-			(void *)(long)(event->header.size),
-			event->comm.comm, event->comm.pid);
+	return 0;
+}
 
-		if (thread == NULL ||
-		    thread__set_comm(thread, event->comm.comm)) {
-			fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
-			return -1;
-		}
-		total_comm++;
-		break;
+static int
+process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->mmap.pid);
+	struct map *map = map__new(&event->mmap);
+
+	dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		(void *)(long)event->mmap.start,
+		(void *)(long)event->mmap.len,
+		(void *)(long)event->mmap.pgoff,
+		event->mmap.filename);
+
+	if (thread == NULL || map == NULL) {
+		dprintf("problem processing PERF_EVENT_MMAP, skipping event.\n");
+		return -1;
+	}
+
+	thread__insert_map(thread, map);
+	total_mmap++;
+
+	return 0;
+}
+
+static int
+process_comm_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->comm.pid);
+
+	dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->comm.comm, event->comm.pid);
+
+	if (thread == NULL ||
+	    thread__set_comm(thread, event->comm.comm)) {
+		dprintf("problem processing PERF_EVENT_COMM, skipping event.\n");
+		return -1;
 	}
+	total_comm++;
+
+	return 0;
+}
+
+static int
+process_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
+		return process_overflow_event(event, offset, head);
+
+	switch (event->header.type) {
+	case PERF_EVENT_MMAP:
+		return process_mmap_event(event, offset, head);
+
+	case PERF_EVENT_COMM:
+		return process_comm_event(event, offset, head);
+
 	default:
 		return -1;
 	}
@@ -877,13 +902,13 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 
 static int __cmd_report(void)
 {
+	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
 	unsigned long head = 0;
 	struct stat stat;
-	char *buf;
 	event_t *event;
-	int ret, rc = EXIT_FAILURE;
 	uint32_t size;
+	char *buf;
 
 	register_idle_thread();
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Handle all known event types
       [not found]             ` <new-submission>
                                 ` (136 preceding siblings ...)
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Split out event processing helpers tip-bot for Ingo Molnar
@ 2009-06-03 22:35               ` tip-bot for Ingo Molnar
  2009-06-04  7:33               ` [tip:perfcounters/core] perf report: Fix rbtree bug tip-bot for Arnaldo Carvalho de Melo
                                 ` (569 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-03 22:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  d11444dfa78cdd887d8dfd2fab3883132aff2c2d
Gitweb:     http://git.kernel.org/tip/d11444dfa78cdd887d8dfd2fab3883132aff2c2d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 3 Jun 2009 23:29:14 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 3 Jun 2009 23:29:14 +0200

perf report: Handle all known event types

We have munmap, throttle/unthrottle and period events as well,
process them - otherwise they are considered broke events and
we mis-parse the next few events.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 82b6252..6003cc3 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -893,6 +893,15 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	case PERF_EVENT_COMM:
 		return process_comm_event(event, offset, head);
 
+	/*
+	 * We dont process them right now but they are fine:
+	 */
+	case PERF_EVENT_MUNMAP:
+	case PERF_EVENT_PERIOD:
+	case PERF_EVENT_THROTTLE:
+	case PERF_EVENT_UNTHROTTLE:
+		return 0;
+
 	default:
 		return -1;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix rbtree bug
       [not found]             ` <new-submission>
                                 ` (137 preceding siblings ...)
  2009-06-03 22:35               ` [tip:perfcounters/core] perf report: Handle all known event types tip-bot for Ingo Molnar
@ 2009-06-04  7:33               ` tip-bot for Arnaldo Carvalho de Melo
  2009-06-04  8:06               ` [tip:perfcounters/core] perf top: Reduce default filter threshold tip-bot for Ingo Molnar
                                 ` (568 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-06-04  7:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, eranian, efault, peterz,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  a4c43beaff0fe6c83aa2505dce8ffe65db8e0a33
Gitweb:     http://git.kernel.org/tip/a4c43beaff0fe6c83aa2505dce8ffe65db8e0a33
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 3 Jun 2009 23:02:33 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 09:27:21 +0200

perf report: Fix rbtree bug

Ingo Molnar reported:

> FYI, i just got this crash (segfault) in perf report after
> collecting a long profile from Xorg:
>
> Starting program: /home/mingo/tip/Documentation/perf_counter/perf report
> [Thread debugging using libthread_db enabled]
> Detaching after fork from child process 20008.
> [New Thread 0x7f92fd62a6f0 (LWP 20005)]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000041031a in __rb_erase_color (node=0x142c090, parent=0x0,
> root=0x881918)
>     at util/rbtree.c:143
> 143			if (parent->rb_left == node)

It was a problem introduced in this cset:

 perf report: Fix comm sorting - 8229289b607682f90b946ad2c319526303c17700

This patch should fix it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 6003cc3..86f23f0 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -699,17 +699,18 @@ static void output__resort(void)
 {
 	struct rb_node *next;
 	struct hist_entry *n;
+	struct rb_root *tree = &hist;
 
 	if (sort__need_collapse)
-		next = rb_first(&collapse_hists);
-	else
-		next = rb_first(&hist);
+		tree = &collapse_hists;
+
+	next = rb_first(tree);
 
 	while (next) {
 		n = rb_entry(next, struct hist_entry, rb_node);
 		next = rb_next(&n->rb_node);
 
-		rb_erase(&n->rb_node, &hist);
+		rb_erase(&n->rb_node, tree);
 		output__insert_entry(n);
 	}
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: Reduce default filter threshold
       [not found]             ` <new-submission>
                                 ` (138 preceding siblings ...)
  2009-06-04  7:33               ` [tip:perfcounters/core] perf report: Fix rbtree bug tip-bot for Arnaldo Carvalho de Melo
@ 2009-06-04  8:06               ` tip-bot for Ingo Molnar
  2009-06-04 12:48               ` [tip:perfcounters/core] perf record/report: Fix PID/COMM handling tip-bot for Ingo Molnar
                                 ` (567 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04  8:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	rostedt, mtosatti, tglx, cjashfor, mingo

Commit-ID:  6e53cdf11dfc8d302ebb67e7112d1baf8d7c66d4
Gitweb:     http://git.kernel.org/tip/6e53cdf11dfc8d302ebb67e7112d1baf8d7c66d4
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 08:53:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 09:02:12 +0200

perf top: Reduce default filter threshold

On idle systems 'perf top' comes up empty by default, because the event
count filter is set to 100.

Reduce it to 5 instead.

Also add an option to limit the number of functions displayed.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-top.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 7c907e2..3f7778b 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -64,9 +64,10 @@ static int			default_interval = 100000;
 static int			event_count[MAX_COUNTERS];
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static __u64			count_filter		       = 100;
+static __u64			count_filter			=  5;
+static int			print_entries			= 15;
 
-static int			target_pid				= -1;
+static int			target_pid			= -1;
 static int			profile_cpu			= -1;
 static int			nr_cpus				=  0;
 static unsigned int		realtime_prio			=  0;
@@ -254,7 +255,7 @@ static void print_sym_table(void)
 		struct symbol *sym = (struct symbol *)(syme + 1);
 		float pcnt;
 
-		if (++printed > 18 || syme->snap_count < count_filter)
+		if (++printed > print_entries || syme->snap_count < count_filter)
 			continue;
 
 		pcnt = 100.0 - (100.0 * ((sum_kevents - syme->snap_count) /
@@ -650,7 +651,7 @@ static const struct option options[] = {
 		    "number of seconds to delay between refreshes"),
 	OPT_BOOLEAN('D', "dump-symtab", &dump_symtab,
 			    "dump the symbol table used for profiling"),
-	OPT_INTEGER('f', "--count-filter", &count_filter,
+	OPT_INTEGER('f', "count-filter", &count_filter,
 		    "only display functions with more events than this"),
 	OPT_BOOLEAN('g', "group", &group,
 			    "put the counters into a counter group"),
@@ -662,8 +663,10 @@ static const struct option options[] = {
 		    "track mmap events"),
 	OPT_BOOLEAN('U', "use-munmap", &use_munmap,
 		    "track munmap events"),
-	OPT_INTEGER('F', "--freq", &freq,
+	OPT_INTEGER('F', "freq", &freq,
 		    "profile at this frequency"),
+	OPT_INTEGER('E', "entries", &print_entries,
+		    "display this many functions"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record/report: Fix PID/COMM handling
       [not found]             ` <new-submission>
                                 ` (139 preceding siblings ...)
  2009-06-04  8:06               ` [tip:perfcounters/core] perf top: Reduce default filter threshold tip-bot for Ingo Molnar
@ 2009-06-04 12:48               ` tip-bot for Ingo Molnar
  2009-06-04 13:09               ` [tip:perfcounters/core] perf_counter tools: Build with native optimization tip-bot for Ingo Molnar
                                 ` (566 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 12:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  df97992c6e25ffc66c549c8bc59262dc627c6d17
Gitweb:     http://git.kernel.org/tip/df97992c6e25ffc66c549c8bc59262dc627c6d17
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 13:41:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 13:41:37 +0200

perf record/report: Fix PID/COMM handling

Fix two bugs causing lost comm mappings:

 - initial PID is not 0 but getpid()

 - when we are unable to handle an mmap event, dont assume the event
   itself is broken - try to parse the stream. This way we wont lose
   comm events.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    2 +-
 Documentation/perf_counter/builtin-report.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index efa2eb4..bf59df5 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -430,7 +430,7 @@ static int __cmd_record(int argc, const char **argv)
 	}
 
 	if (!system_wide) {
-		open_counters(-1, target_pid != -1 ? target_pid : 0);
+		open_counters(-1, target_pid != -1 ? target_pid : getpid());
 	} else for (i = 0; i < nr_cpus; i++)
 		open_counters(i, target_pid);
 
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 86f23f0..ff6f657 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -852,7 +852,7 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
 
 	if (thread == NULL || map == NULL) {
 		dprintf("problem processing PERF_EVENT_MMAP, skipping event.\n");
-		return -1;
+		return 0;
 	}
 
 	thread__insert_map(thread, map);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Build with native optimization
       [not found]             ` <new-submission>
                                 ` (140 preceding siblings ...)
  2009-06-04 12:48               ` [tip:perfcounters/core] perf record/report: Fix PID/COMM handling tip-bot for Ingo Molnar
@ 2009-06-04 13:09               ` tip-bot for Ingo Molnar
  2009-06-05  1:03                 ` Paul Mackerras
  2009-06-04 13:09               ` [tip:perfcounters/core] perf report: Simplify symbol output tip-bot for Peter Zijlstra
                                 ` (565 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 13:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  af794b94ae8a16fb4a9da6ce640c122efb44e2a0
Gitweb:     http://git.kernel.org/tip/af794b94ae8a16fb4a9da6ce640c122efb44e2a0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 13:58:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 14:00:52 +0200

perf_counter tools: Build with native optimization

Build the tools with -march=native by default.

No measurable difference in speed though, compared to the
default, on a Nehalem testbox.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 005709b..414399c 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -159,7 +159,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6
+CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6 -march=native
 LDFLAGS = -lpthread -lrt -lelf
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Simplify symbol output
       [not found]             ` <new-submission>
                                 ` (141 preceding siblings ...)
  2009-06-04 13:09               ` [tip:perfcounters/core] perf_counter tools: Build with native optimization tip-bot for Ingo Molnar
@ 2009-06-04 13:09               ` tip-bot for Peter Zijlstra
  2009-06-04 13:21               ` [tip:perfcounters/core] perf_counter tools: Print out symbol parsing errors only if --verbose tip-bot for Ingo Molnar
                                 ` (564 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 13:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  95ed6fd06e52bf850cd17524f0b36ed14300c10d
Gitweb:     http://git.kernel.org/tip/95ed6fd06e52bf850cd17524f0b36ed14300c10d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 15:00:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 14:04:50 +0200

perf report: Simplify symbol output

The DSO can be printed already - no need to repeat it in the
symbol field.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index ff6f657..56c664d 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -382,7 +382,7 @@ sort__comm_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_comm = {
-	.header 	= "          Command",
+	.header		= "          Command",
 	.cmp		= sort__comm_cmp,
 	.collapse	= sort__comm_collapse,
 	.print		= sort__comm_print,
@@ -414,11 +414,11 @@ sort__dso_print(FILE *fp, struct hist_entry *self)
 	if (self->dso)
 		return fprintf(fp, "  %-25s", self->dso->name);
 
-	return fprintf(fp, "  %016llx", (__u64)self->ip);
+	return fprintf(fp, "  %016llx         ", (__u64)self->ip);
 }
 
 static struct sort_entry sort_dso = {
-	.header = " Shared Object          ",
+	.header = " Shared Object            ",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };
@@ -447,21 +447,16 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	if (verbose)
 		ret += fprintf(fp, "  %#018llx", (__u64)self->ip);
 
-	if (self->dso)
-		ret += fprintf(fp, "  %s: ", self->dso->name);
-	else
-		ret += fprintf(fp, "  %#016llx: ", (__u64)self->ip);
-
 	if (self->sym)
-		ret += fprintf(fp, "%s", self->sym->name);
+		ret += fprintf(fp, "  %s", self->sym->name);
 	else
-		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
+		ret += fprintf(fp, "  %#016llx", (__u64)self->ip);
 
 	return ret;
 }
 
 static struct sort_entry sort_sym = {
-	.header = " Shared Object: Symbol",
+	.header = " Symbol",
 	.cmp	= sort__sym_cmp,
 	.print	= sort__sym_print,
 };

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Print out symbol parsing errors only if --verbose
       [not found]             ` <new-submission>
                                 ` (142 preceding siblings ...)
  2009-06-04 13:09               ` [tip:perfcounters/core] perf report: Simplify symbol output tip-bot for Peter Zijlstra
@ 2009-06-04 13:21               ` tip-bot for Ingo Molnar
  2009-06-04 13:27               ` [tip:perfcounters/core] perf report: Print out the total number of events tip-bot for Ingo Molnar
                                 ` (563 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 13:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  bd74137ec9aaca3df3ff22b92455fddf7afaced1
Gitweb:     http://git.kernel.org/tip/bd74137ec9aaca3df3ff22b92455fddf7afaced1
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 14:13:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 14:16:38 +0200

perf_counter tools: Print out symbol parsing errors only if --verbose

Also, add a suggestion to 'perf report', if the default sort order is
used.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   18 ++++++++++++++----
 Documentation/perf_counter/builtin-top.c    |    2 +-
 Documentation/perf_counter/util/symbol.c    |   27 +++++++++++++++------------
 Documentation/perf_counter/util/symbol.h    |    4 ++--
 4 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 56c664d..15fe9da 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -26,7 +26,10 @@
 
 static char		const *input_name = "perf.data";
 static char		*vmlinux = NULL;
-static char		*sort_order = "comm,dso";
+
+static char		default_sort_order[] = "comm,dso";
+static char		*sort_order = default_sort_order;
+
 static int		input;
 static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
@@ -103,9 +106,10 @@ static struct dso *dsos__findnew(const char *name)
 	if (!dso)
 		goto out_delete_dso;
 
-	nr = dso__load(dso, NULL);
+	nr = dso__load(dso, NULL, verbose);
 	if (nr < 0) {
-		fprintf(stderr, "Failed to open: %s\n", name);
+		if (verbose)
+			fprintf(stderr, "Failed to open: %s\n", name);
 		goto out_delete_dso;
 	}
 	if (!nr && verbose) {
@@ -139,7 +143,7 @@ static int load_kernel(void)
 	if (!kernel_dso)
 		return -1;
 
-	err = dso__load_kernel(kernel_dso, vmlinux, NULL);
+	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
 	if (err) {
 		dso__delete(kernel_dso);
 		kernel_dso = NULL;
@@ -741,6 +745,12 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 		ret += hist_entry__fprintf(fp, pos, total_samples);
 	}
 
+	if (!strcmp(sort_order, default_sort_order)) {
+		fprintf(fp, "#\n");
+		fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n");
+		fprintf(fp, "#\n");
+	}
+
 	return ret;
 }
 
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 3f7778b..548a8da 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -349,7 +349,7 @@ static int parse_symbols(void)
 	if (kernel_dso == NULL)
 		return -1;
 
-	if (dso__load_kernel(kernel_dso, NULL, symbol_filter) != 0)
+	if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) != 0)
 		goto out_delete_dso;
 
 	node = rb_first(&kernel_dso->syms);
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index 35ee6de..15d5cf9 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -124,7 +124,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp)
 	return ret;
 }
 
-static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter)
+static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
 {
 	struct rb_node *nd, *prevnd;
 	char *line = NULL;
@@ -370,7 +370,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
 }
 
 static int dso__load_sym(struct dso *self, int fd, const char *name,
-			 symbol_filter_t filter)
+			 symbol_filter_t filter, int verbose)
 {
 	Elf_Data *symstrs;
 	uint32_t nr_syms;
@@ -387,13 +387,15 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 
 	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
 	if (elf == NULL) {
-		fprintf(stderr, "%s: cannot read %s ELF file.\n",
-			__func__, name);
+		if (verbose)
+			fprintf(stderr, "%s: cannot read %s ELF file.\n",
+				__func__, name);
 		goto out_close;
 	}
 
 	if (gelf_getehdr(elf, &ehdr) == NULL) {
-		fprintf(stderr, "%s: cannot get elf header.\n", __func__);
+		if (verbose)
+			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
 		goto out_elf_end;
 	}
 
@@ -473,7 +475,7 @@ out_close:
 	return err;
 }
 
-int dso__load(struct dso *self, symbol_filter_t filter)
+int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
 {
 	int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug");
 	char *name = malloc(size);
@@ -505,7 +507,7 @@ more:
 		fd = open(name, O_RDONLY);
 	} while (fd < 0);
 
-	ret = dso__load_sym(self, fd, name, filter);
+	ret = dso__load_sym(self, fd, name, filter, verbose);
 	close(fd);
 
 	/*
@@ -520,28 +522,29 @@ out:
 }
 
 static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
-			     symbol_filter_t filter)
+			     symbol_filter_t filter, int verbose)
 {
 	int err, fd = open(vmlinux, O_RDONLY);
 
 	if (fd < 0)
 		return -1;
 
-	err = dso__load_sym(self, fd, vmlinux, filter);
+	err = dso__load_sym(self, fd, vmlinux, filter, verbose);
 	close(fd);
 
 	return err;
 }
 
-int dso__load_kernel(struct dso *self, const char *vmlinux, symbol_filter_t filter)
+int dso__load_kernel(struct dso *self, const char *vmlinux,
+		     symbol_filter_t filter, int verbose)
 {
 	int err = -1;
 
 	if (vmlinux)
-		err = dso__load_vmlinux(self, vmlinux, filter);
+		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
 
 	if (err)
-		err = dso__load_kallsyms(self, filter);
+		err = dso__load_kallsyms(self, filter, verbose);
 
 	return err;
 }
diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h
index b0299bc..8dd8522 100644
--- a/Documentation/perf_counter/util/symbol.h
+++ b/Documentation/perf_counter/util/symbol.h
@@ -32,8 +32,8 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
 struct symbol *dso__find_symbol(struct dso *self, uint64_t ip);
 
 int dso__load_kernel(struct dso *self, const char *vmlinux,
-		     symbol_filter_t filter);
-int dso__load(struct dso *self, symbol_filter_t filter);
+		     symbol_filter_t filter, int verbose);
+int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
 
 size_t dso__fprintf(struct dso *self, FILE *fp);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print out the total number of events
       [not found]             ` <new-submission>
                                 ` (143 preceding siblings ...)
  2009-06-04 13:21               ` [tip:perfcounters/core] perf_counter tools: Print out symbol parsing errors only if --verbose tip-bot for Ingo Molnar
@ 2009-06-04 13:27               ` tip-bot for Ingo Molnar
  2009-06-04 13:30               ` [tip:perfcounters/core] perf report: Add consistent spacing rules tip-bot for Peter Zijlstra
                                 ` (562 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 13:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  05ca061eb9704ad9b0739f88046276792b75f2c1
Gitweb:     http://git.kernel.org/tip/05ca061eb9704ad9b0739f88046276792b75f2c1
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 14:21:16 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 14:21:16 +0200

perf report: Print out the total number of events

So that the statistical quality of the profile can be estimated at a glance.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 15fe9da..be392e0 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -722,6 +722,8 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 	size_t ret = 0;
 
 	fprintf(fp, "#\n");
+	fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples);
+	fprintf(fp, "#\n");
 
 	fprintf(fp, "# Overhead");
 	list_for_each_entry(se, &hist_entry__sort_list, list)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add consistent spacing rules
       [not found]             ` <new-submission>
                                 ` (144 preceding siblings ...)
  2009-06-04 13:27               ` [tip:perfcounters/core] perf report: Print out the total number of events tip-bot for Ingo Molnar
@ 2009-06-04 13:30               ` tip-bot for Peter Zijlstra
  2009-06-04 14:09               ` tip-bot for Peter Zijlstra
                                 ` (561 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 13:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  11fbe0555ffa7ad1e5359fc42cdf6e4019dd7879
Gitweb:     http://git.kernel.org/tip/11fbe0555ffa7ad1e5359fc42cdf6e4019dd7879
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 15:16:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 15:26:19 +0200

perf report: Add consistent spacing rules

Make the sort header and the print function have the same column width.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   30 ++++++++++++++------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index be392e0..132242d 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -344,11 +344,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__thread_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
+	return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid);
 }
 
 static struct sort_entry sort_thread = {
-	.header = "         Command: Pid ",
+	.header = "         Command:  Pid",
 	.cmp	= sort__thread_cmp,
 	.print	= sort__thread_print,
 };
@@ -382,11 +382,11 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__comm_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %16s", self->thread->comm);
+	return fprintf(fp, "%16s", self->thread->comm);
 }
 
 static struct sort_entry sort_comm = {
-	.header		= "          Command",
+	.header 	= "         Command",
 	.cmp		= sort__comm_cmp,
 	.collapse	= sort__comm_collapse,
 	.print		= sort__comm_print,
@@ -416,13 +416,13 @@ static size_t
 sort__dso_print(FILE *fp, struct hist_entry *self)
 {
 	if (self->dso)
-		return fprintf(fp, "  %-25s", self->dso->name);
+		return fprintf(fp, "%-25s", self->dso->name);
 
-	return fprintf(fp, "  %016llx         ", (__u64)self->ip);
+	return fprintf(fp, "%016llx         ", (__u64)self->ip);
 }
 
 static struct sort_entry sort_dso = {
-	.header = " Shared Object            ",
+	.header = "Shared Object            ",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };
@@ -449,18 +449,18 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	size_t ret = 0;
 
 	if (verbose)
-		ret += fprintf(fp, "  %#018llx", (__u64)self->ip);
+		ret += fprintf(fp, "%#018llx  ", (__u64)self->ip);
 
 	if (self->sym)
-		ret += fprintf(fp, "  %s", self->sym->name);
+		ret += fprintf(fp, "%s", self->sym->name);
 	else
-		ret += fprintf(fp, "  %#016llx", (__u64)self->ip);
+		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
 
 	return ret;
 }
 
 static struct sort_entry sort_sym = {
-	.header = " Symbol",
+	.header = "Symbol",
 	.cmp	= sort__sym_cmp,
 	.print	= sort__sym_print,
 };
@@ -553,8 +553,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 	} else
 		ret = fprintf(fp, "%12d ", self->count);
 
-	list_for_each_entry(se, &hist_entry__sort_list, list)
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		fprintf(fp, "  ");
 		ret += se->print(fp, self);
+	}
 
 	ret += fprintf(fp, "\n");
 
@@ -727,7 +729,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 
 	fprintf(fp, "# Overhead");
 	list_for_each_entry(se, &hist_entry__sort_list, list)
-		fprintf(fp, " %s", se->header);
+		fprintf(fp, "  %s", se->header);
 	fprintf(fp, "\n");
 
 	fprintf(fp, "# ........");
@@ -735,7 +737,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 		int i;
 
 		fprintf(fp, "  ");
-		for (i = 0; i < strlen(se->header)-1; i++)
+		for (i = 0; i < strlen(se->header); i++)
 			fprintf(fp, ".");
 	}
 	fprintf(fp, "\n");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add consistent spacing rules
       [not found]             ` <new-submission>
                                 ` (145 preceding siblings ...)
  2009-06-04 13:30               ` [tip:perfcounters/core] perf report: Add consistent spacing rules tip-bot for Peter Zijlstra
@ 2009-06-04 14:09               ` tip-bot for Peter Zijlstra
  2009-06-04 14:33               ` [tip:perfcounters/core] perf_counter tools: Add color terminal output support tip-bot for Ingo Molnar
                                 ` (560 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 14:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  71dd8945d8d827ab101cd287f9480ef22fc7c1b6
Gitweb:     http://git.kernel.org/tip/71dd8945d8d827ab101cd287f9480ef22fc7c1b6
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 15:16:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 15:04:41 +0200

perf report: Add consistent spacing rules

Make the sort header and the print function have the same column width.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   34 +++++++++++++++------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index be392e0..e930b4e 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -344,11 +344,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__thread_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
+	return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid);
 }
 
 static struct sort_entry sort_thread = {
-	.header = "         Command: Pid ",
+	.header = "         Command:  Pid",
 	.cmp	= sort__thread_cmp,
 	.print	= sort__thread_print,
 };
@@ -382,11 +382,11 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
 static size_t
 sort__comm_print(FILE *fp, struct hist_entry *self)
 {
-	return fprintf(fp, "  %16s", self->thread->comm);
+	return fprintf(fp, "%16s", self->thread->comm);
 }
 
 static struct sort_entry sort_comm = {
-	.header		= "          Command",
+	.header 	= "         Command",
 	.cmp		= sort__comm_cmp,
 	.collapse	= sort__comm_collapse,
 	.print		= sort__comm_print,
@@ -416,13 +416,13 @@ static size_t
 sort__dso_print(FILE *fp, struct hist_entry *self)
 {
 	if (self->dso)
-		return fprintf(fp, "  %-25s", self->dso->name);
+		return fprintf(fp, "%-25s", self->dso->name);
 
-	return fprintf(fp, "  %016llx         ", (__u64)self->ip);
+	return fprintf(fp, "%016llx         ", (__u64)self->ip);
 }
 
 static struct sort_entry sort_dso = {
-	.header = " Shared Object            ",
+	.header = "Shared Object            ",
 	.cmp	= sort__dso_cmp,
 	.print	= sort__dso_print,
 };
@@ -449,18 +449,18 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	size_t ret = 0;
 
 	if (verbose)
-		ret += fprintf(fp, "  %#018llx", (__u64)self->ip);
+		ret += fprintf(fp, "%#018llx  ", (__u64)self->ip);
 
 	if (self->sym)
-		ret += fprintf(fp, "  %s", self->sym->name);
+		ret += fprintf(fp, "%s", self->sym->name);
 	else
-		ret += fprintf(fp, "  %#016llx", (__u64)self->ip);
+		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
 
 	return ret;
 }
 
 static struct sort_entry sort_sym = {
-	.header = " Symbol",
+	.header = "Symbol",
 	.cmp	= sort__sym_cmp,
 	.print	= sort__sym_print,
 };
@@ -553,8 +553,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 	} else
 		ret = fprintf(fp, "%12d ", self->count);
 
-	list_for_each_entry(se, &hist_entry__sort_list, list)
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		fprintf(fp, "  ");
 		ret += se->print(fp, self);
+	}
 
 	ret += fprintf(fp, "\n");
 
@@ -721,13 +723,14 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 	struct rb_node *nd;
 	size_t ret = 0;
 
+	fprintf(fp, "\n");
 	fprintf(fp, "#\n");
 	fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples);
 	fprintf(fp, "#\n");
 
 	fprintf(fp, "# Overhead");
 	list_for_each_entry(se, &hist_entry__sort_list, list)
-		fprintf(fp, " %s", se->header);
+		fprintf(fp, "  %s", se->header);
 	fprintf(fp, "\n");
 
 	fprintf(fp, "# ........");
@@ -735,7 +738,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 		int i;
 
 		fprintf(fp, "  ");
-		for (i = 0; i < strlen(se->header)-1; i++)
+		for (i = 0; i < strlen(se->header); i++)
 			fprintf(fp, ".");
 	}
 	fprintf(fp, "\n");
@@ -749,9 +752,10 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 
 	if (!strcmp(sort_order, default_sort_order)) {
 		fprintf(fp, "#\n");
-		fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n");
+		fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
 		fprintf(fp, "#\n");
 	}
+	fprintf(fp, "\n");
 
 	return ret;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add color terminal output support
       [not found]             ` <new-submission>
                                 ` (146 preceding siblings ...)
  2009-06-04 14:09               ` tip-bot for Peter Zijlstra
@ 2009-06-04 14:33               ` tip-bot for Ingo Molnar
  2009-06-04 14:51               ` [tip:perfcounters/core] perf_counter tools: Dont output in color on !tty tip-bot for Ingo Molnar
                                 ` (559 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 14:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  8fc0321f1ad0ffef969056dda91b453bbd7a494d
Gitweb:     http://git.kernel.org/tip/8fc0321f1ad0ffef969056dda91b453bbd7a494d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 15:19:47 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 15:28:11 +0200

perf_counter tools: Add color terminal output support

Add Git's color printing library to util/color.[ch].

Add it to perf report, with a trivial example to print high-overhead
entries in red, low-overhead entries in green.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile           |    2 +
 Documentation/perf_counter/builtin-report.c   |   15 ++-
 Documentation/perf_counter/builtin-top.c      |   23 ++-
 Documentation/perf_counter/util/color.c       |  230 +++++++++++++++++++++++++
 Documentation/perf_counter/util/color.h       |   36 ++++
 Documentation/perf_counter/util/environment.c |    1 +
 6 files changed, 300 insertions(+), 7 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 414399c..c9ec458 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -298,6 +298,7 @@ LIB_H += util/string.h
 LIB_H += util/run-command.h
 LIB_H += util/sigchain.h
 LIB_H += util/symbol.h
+LIB_H += util/color.h
 
 LIB_OBJS += util/abspath.o
 LIB_OBJS += util/alias.o
@@ -319,6 +320,7 @@ LIB_OBJS += util/usage.o
 LIB_OBJS += util/wrapper.o
 LIB_OBJS += util/sigchain.o
 LIB_OBJS += util/symbol.o
+LIB_OBJS += util/color.o
 LIB_OBJS += util/pager.o
 
 BUILTIN_OBJS += builtin-help.o
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index e930b4e..7beedc6 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -9,6 +9,7 @@
 
 #include "util/util.h"
 
+#include "util/color.h"
 #include "util/list.h"
 #include "util/cache.h"
 #include "util/rbtree.h"
@@ -548,7 +549,19 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 	size_t ret;
 
 	if (total_samples) {
-		ret = fprintf(fp, "   %6.2f%%",
+		double percent = self->count * 100.0 / total_samples;
+		char *color = PERF_COLOR_NORMAL;
+
+		/*
+		 * We color high-overhead entries in red, low-overhead
+		 * entries in green - and keep the middle ground normal:
+		 */
+		if (percent >= 5.0)
+			color = PERF_COLOR_RED;
+		if (percent < 0.5)
+			color = PERF_COLOR_GREEN;
+
+		ret = color_fprintf(fp, color, "   %6.2f%%",
 				(self->count * 100.0) / total_samples);
 	} else
 		ret = fprintf(fp, "%12d ", self->count);
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 548a8da..20e5b12 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -21,6 +21,7 @@
 #include "perf.h"
 
 #include "util/symbol.h"
+#include "util/color.h"
 #include "util/util.h"
 #include "util/rbtree.h"
 #include "util/parse-options.h"
@@ -253,7 +254,8 @@ static void print_sym_table(void)
 	for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
 		struct sym_entry *syme = rb_entry(nd, struct sym_entry, rb_node);
 		struct symbol *sym = (struct symbol *)(syme + 1);
-		float pcnt;
+		char *color = PERF_COLOR_NORMAL;
+		double pcnt;
 
 		if (++printed > print_entries || syme->snap_count < count_filter)
 			continue;
@@ -261,13 +263,22 @@ static void print_sym_table(void)
 		pcnt = 100.0 - (100.0 * ((sum_kevents - syme->snap_count) /
 					 sum_kevents));
 
+		/*
+		 * We color high-overhead entries in red, low-overhead
+		 * entries in green - and keep the middle ground normal:
+		 */
+		if (pcnt >= 5.0)
+			color = PERF_COLOR_RED;
+		if (pcnt < 0.5)
+			color = PERF_COLOR_GREEN;
+
 		if (nr_counters == 1)
-			printf("%19.2f - %4.1f%% - %016llx : %s\n",
-				syme->weight, pcnt, sym->start, sym->name);
+			printf("%19.2f - ", syme->weight);
 		else
-			printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
-				syme->weight, syme->snap_count,
-				pcnt, sym->start, sym->name);
+			printf("%8.1f %10ld - ", syme->weight, syme->snap_count);
+
+		color_fprintf(stdout, color, "%4.1f%%", pcnt);
+		printf(" - %016llx : %s\n", sym->start, sym->name);
 	}
 
 	{
diff --git a/Documentation/perf_counter/util/color.c b/Documentation/perf_counter/util/color.c
new file mode 100644
index 0000000..a77975d
--- /dev/null
+++ b/Documentation/perf_counter/util/color.c
@@ -0,0 +1,230 @@
+#include "cache.h"
+#include "color.h"
+
+int perf_use_color_default = 0;
+
+static int parse_color(const char *name, int len)
+{
+	static const char * const color_names[] = {
+		"normal", "black", "red", "green", "yellow",
+		"blue", "magenta", "cyan", "white"
+	};
+	char *end;
+	int i;
+	for (i = 0; i < ARRAY_SIZE(color_names); i++) {
+		const char *str = color_names[i];
+		if (!strncasecmp(name, str, len) && !str[len])
+			return i - 1;
+	}
+	i = strtol(name, &end, 10);
+	if (end - name == len && i >= -1 && i <= 255)
+		return i;
+	return -2;
+}
+
+static int parse_attr(const char *name, int len)
+{
+	static const int attr_values[] = { 1, 2, 4, 5, 7 };
+	static const char * const attr_names[] = {
+		"bold", "dim", "ul", "blink", "reverse"
+	};
+	int i;
+	for (i = 0; i < ARRAY_SIZE(attr_names); i++) {
+		const char *str = attr_names[i];
+		if (!strncasecmp(name, str, len) && !str[len])
+			return attr_values[i];
+	}
+	return -1;
+}
+
+void color_parse(const char *value, const char *var, char *dst)
+{
+	color_parse_mem(value, strlen(value), var, dst);
+}
+
+void color_parse_mem(const char *value, int value_len, const char *var,
+		char *dst)
+{
+	const char *ptr = value;
+	int len = value_len;
+	int attr = -1;
+	int fg = -2;
+	int bg = -2;
+
+	if (!strncasecmp(value, "reset", len)) {
+		strcpy(dst, PERF_COLOR_RESET);
+		return;
+	}
+
+	/* [fg [bg]] [attr] */
+	while (len > 0) {
+		const char *word = ptr;
+		int val, wordlen = 0;
+
+		while (len > 0 && !isspace(word[wordlen])) {
+			wordlen++;
+			len--;
+		}
+
+		ptr = word + wordlen;
+		while (len > 0 && isspace(*ptr)) {
+			ptr++;
+			len--;
+		}
+
+		val = parse_color(word, wordlen);
+		if (val >= -1) {
+			if (fg == -2) {
+				fg = val;
+				continue;
+			}
+			if (bg == -2) {
+				bg = val;
+				continue;
+			}
+			goto bad;
+		}
+		val = parse_attr(word, wordlen);
+		if (val < 0 || attr != -1)
+			goto bad;
+		attr = val;
+	}
+
+	if (attr >= 0 || fg >= 0 || bg >= 0) {
+		int sep = 0;
+
+		*dst++ = '\033';
+		*dst++ = '[';
+		if (attr >= 0) {
+			*dst++ = '0' + attr;
+			sep++;
+		}
+		if (fg >= 0) {
+			if (sep++)
+				*dst++ = ';';
+			if (fg < 8) {
+				*dst++ = '3';
+				*dst++ = '0' + fg;
+			} else {
+				dst += sprintf(dst, "38;5;%d", fg);
+			}
+		}
+		if (bg >= 0) {
+			if (sep++)
+				*dst++ = ';';
+			if (bg < 8) {
+				*dst++ = '4';
+				*dst++ = '0' + bg;
+			} else {
+				dst += sprintf(dst, "48;5;%d", bg);
+			}
+		}
+		*dst++ = 'm';
+	}
+	*dst = 0;
+	return;
+bad:
+	die("bad color value '%.*s' for variable '%s'", value_len, value, var);
+}
+
+int perf_config_colorbool(const char *var, const char *value, int stdout_is_tty)
+{
+	if (value) {
+		if (!strcasecmp(value, "never"))
+			return 0;
+		if (!strcasecmp(value, "always"))
+			return 1;
+		if (!strcasecmp(value, "auto"))
+			goto auto_color;
+	}
+
+	/* Missing or explicit false to turn off colorization */
+	if (!perf_config_bool(var, value))
+		return 0;
+
+	/* any normal truth value defaults to 'auto' */
+ auto_color:
+	if (stdout_is_tty < 0)
+		stdout_is_tty = isatty(1);
+	if (stdout_is_tty || (pager_in_use() && pager_use_color)) {
+		char *term = getenv("TERM");
+		if (term && strcmp(term, "dumb"))
+			return 1;
+	}
+	return 0;
+}
+
+int perf_color_default_config(const char *var, const char *value, void *cb)
+{
+	if (!strcmp(var, "color.ui")) {
+		perf_use_color_default = perf_config_colorbool(var, value, -1);
+		return 0;
+	}
+
+	return perf_default_config(var, value, cb);
+}
+
+static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
+		va_list args, const char *trail)
+{
+	int r = 0;
+
+	if (*color)
+		r += fprintf(fp, "%s", color);
+	r += vfprintf(fp, fmt, args);
+	if (*color)
+		r += fprintf(fp, "%s", PERF_COLOR_RESET);
+	if (trail)
+		r += fprintf(fp, "%s", trail);
+	return r;
+}
+
+
+
+int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)
+{
+	va_list args;
+	int r;
+	va_start(args, fmt);
+	r = color_vfprintf(fp, color, fmt, args, NULL);
+	va_end(args);
+	return r;
+}
+
+int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...)
+{
+	va_list args;
+	int r;
+	va_start(args, fmt);
+	r = color_vfprintf(fp, color, fmt, args, "\n");
+	va_end(args);
+	return r;
+}
+
+/*
+ * This function splits the buffer by newlines and colors the lines individually.
+ *
+ * Returns 0 on success.
+ */
+int color_fwrite_lines(FILE *fp, const char *color,
+		size_t count, const char *buf)
+{
+	if (!*color)
+		return fwrite(buf, count, 1, fp) != 1;
+	while (count) {
+		char *p = memchr(buf, '\n', count);
+		if (p != buf && (fputs(color, fp) < 0 ||
+				fwrite(buf, p ? p - buf : count, 1, fp) != 1 ||
+				fputs(PERF_COLOR_RESET, fp) < 0))
+			return -1;
+		if (!p)
+			return 0;
+		if (fputc('\n', fp) < 0)
+			return -1;
+		count -= p + 1 - buf;
+		buf = p + 1;
+	}
+	return 0;
+}
+
+
diff --git a/Documentation/perf_counter/util/color.h b/Documentation/perf_counter/util/color.h
new file mode 100644
index 0000000..5abfd37
--- /dev/null
+++ b/Documentation/perf_counter/util/color.h
@@ -0,0 +1,36 @@
+#ifndef COLOR_H
+#define COLOR_H
+
+/* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
+#define COLOR_MAXLEN 24
+
+#define PERF_COLOR_NORMAL	""
+#define PERF_COLOR_RESET	"\033[m"
+#define PERF_COLOR_BOLD		"\033[1m"
+#define PERF_COLOR_RED		"\033[31m"
+#define PERF_COLOR_GREEN	"\033[32m"
+#define PERF_COLOR_YELLOW	"\033[33m"
+#define PERF_COLOR_BLUE		"\033[34m"
+#define PERF_COLOR_MAGENTA	"\033[35m"
+#define PERF_COLOR_CYAN		"\033[36m"
+#define PERF_COLOR_BG_RED	"\033[41m"
+
+/*
+ * This variable stores the value of color.ui
+ */
+extern int perf_use_color_default;
+
+
+/*
+ * Use this instead of perf_default_config if you need the value of color.ui.
+ */
+int perf_color_default_config(const char *var, const char *value, void *cb);
+
+int perf_config_colorbool(const char *var, const char *value, int stdout_is_tty);
+void color_parse(const char *value, const char *var, char *dst);
+void color_parse_mem(const char *value, int len, const char *var, char *dst);
+int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
+int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
+int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
+
+#endif /* COLOR_H */
diff --git a/Documentation/perf_counter/util/environment.c b/Documentation/perf_counter/util/environment.c
index 9b1c819..275b0ee 100644
--- a/Documentation/perf_counter/util/environment.c
+++ b/Documentation/perf_counter/util/environment.c
@@ -6,3 +6,4 @@
 #include "cache.h"
 
 const char *pager_program;
+int pager_use_color = 1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Dont output in color on !tty
       [not found]             ` <new-submission>
                                 ` (147 preceding siblings ...)
  2009-06-04 14:33               ` [tip:perfcounters/core] perf_counter tools: Add color terminal output support tip-bot for Ingo Molnar
@ 2009-06-04 14:51               ` tip-bot for Ingo Molnar
  2009-06-04 15:30               ` [tip:perfcounters/core] perf report: Bail out if there are unrecognized options/arguments tip-bot for Ingo Molnar
                                 ` (558 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 14:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  13d0ab5ec29852a6925f612830fa9e822669ece6
Gitweb:     http://git.kernel.org/tip/13d0ab5ec29852a6925f612830fa9e822669ece6
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 15:40:25 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 15:40:25 +0200

perf_counter tools: Dont output in color on !tty

Dont emit ASCII color characters if the terminal is not a tty,
such as when perf report gets redirected into a file.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/color.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/perf_counter/util/color.c b/Documentation/perf_counter/util/color.c
index a77975d..9a8c20c 100644
--- a/Documentation/perf_counter/util/color.c
+++ b/Documentation/perf_counter/util/color.c
@@ -1,7 +1,7 @@
 #include "cache.h"
 #include "color.h"
 
-int perf_use_color_default = 0;
+int perf_use_color_default = -1;
 
 static int parse_color(const char *name, int len)
 {
@@ -169,10 +169,20 @@ static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
 {
 	int r = 0;
 
-	if (*color)
+	/*
+	 * Auto-detect:
+	 */
+	if (perf_use_color_default < 0) {
+		if (isatty(1) || pager_in_use())
+			perf_use_color_default = 1;
+		else
+			perf_use_color_default = 0;
+	}
+
+	if (perf_use_color_default && *color)
 		r += fprintf(fp, "%s", color);
 	r += vfprintf(fp, fmt, args);
-	if (*color)
+	if (perf_use_color_default && *color)
 		r += fprintf(fp, "%s", PERF_COLOR_RESET);
 	if (trail)
 		r += fprintf(fp, "%s", trail);
@@ -185,6 +195,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)
 {
 	va_list args;
 	int r;
+
 	va_start(args, fmt);
 	r = color_vfprintf(fp, color, fmt, args, NULL);
 	va_end(args);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Bail out if there are unrecognized options/arguments
       [not found]             ` <new-submission>
                                 ` (148 preceding siblings ...)
  2009-06-04 14:51               ` [tip:perfcounters/core] perf_counter tools: Dont output in color on !tty tip-bot for Ingo Molnar
@ 2009-06-04 15:30               ` tip-bot for Ingo Molnar
  2009-06-04 15:39               ` [tip:perfcounters/core] perf stat: Update help text tip-bot for Ingo Molnar
                                 ` (557 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 15:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  edc52deac624e4641211a325c23da2a73b01a85d
Gitweb:     http://git.kernel.org/tip/edc52deac624e4641211a325c23da2a73b01a85d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 16:24:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 16:24:37 +0200

perf report: Bail out if there are unrecognized options/arguments

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 7beedc6..389ae25 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -1094,10 +1094,16 @@ int cmd_report(int argc, const char **argv, const char *prefix)
 
 	page_size = getpagesize();
 
-	parse_options(argc, argv, options, report_usage, 0);
+	argc = parse_options(argc, argv, options, report_usage, 0);
 
 	setup_sorting();
 
+	/*
+	 * Any (unrecognized) arguments left?
+	 */
+	if (argc)
+		usage_with_options(report_usage, options);
+
 	setup_pager();
 
 	return __cmd_report();

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Update help text
       [not found]             ` <new-submission>
                                 ` (149 preceding siblings ...)
  2009-06-04 15:30               ` [tip:perfcounters/core] perf report: Bail out if there are unrecognized options/arguments tip-bot for Ingo Molnar
@ 2009-06-04 15:39               ` tip-bot for Ingo Molnar
  2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Add fork event tip-bot for Peter Zijlstra
                                 ` (556 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-04 15:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  20c84e959ec11b1803d2b2832eef703d5fbe7f7b
Gitweb:     http://git.kernel.org/tip/20c84e959ec11b1803d2b2832eef703d5fbe7f7b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 4 Jun 2009 16:33:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 16:33:00 +0200

perf stat: Update help text

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-stat.txt       |   30 ++++++++++++-------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/Documentation/perf_counter/Documentation/perf-stat.txt
index a67d0e3..a340e7b 100644
--- a/Documentation/perf_counter/Documentation/perf-stat.txt
+++ b/Documentation/perf_counter/Documentation/perf-stat.txt
@@ -22,6 +22,7 @@ OPTIONS
 <command>...::
 	Any command you can specify in a shell.
 
+
 -e::
 --event=::
                              0:0: cpu-cycles          
@@ -45,6 +46,13 @@ OPTIONS
                              1:4: migrations          
                            rNNN: raw PMU events (eventsel+umask)
 
+-i::
+--inherit::
+        child tasks inherit counters
+-p::
+--pid=<pid>::
+        stat events on existing pid
+
 -a::
         system-wide collection
 
@@ -54,20 +62,20 @@ OPTIONS
 EXAMPLES
 --------
 
-$ perf stat sleep 1
+$ perf stat -- make -j
 
- Performance counter stats for 'sleep':
+ Performance counter stats for 'make -j':
 
-       0.678356  task clock ticks     (msecs)
-              7  context switches     (events)
-              4  CPU migrations       (events)
-            232  pagefaults           (events)
-        1810403  CPU cycles           (events)
-         946759  instructions         (events)
-          18952  cache references     (events)
-           4885  cache misses         (events)
+    8117.370256  task clock ticks     #      11.281 CPU utilization factor
+            678  context switches     #       0.000 M/sec
+            133  CPU migrations       #       0.000 M/sec
+         235724  pagefaults           #       0.029 M/sec
+    24821162526  CPU cycles           #    3057.784 M/sec
+    18687303457  instructions         #    2302.138 M/sec
+      172158895  cache references     #      21.209 M/sec
+       27075259  cache misses         #       3.335 M/sec
 
- Wall-clock time elapsed:  1001.252894 msecs
+ Wall-clock time elapsed:   719.554352 msecs
 
 SEE ALSO
 --------

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add fork event
       [not found]             ` <new-submission>
                                 ` (150 preceding siblings ...)
  2009-06-04 15:39               ` [tip:perfcounters/core] perf stat: Update help text tip-bot for Ingo Molnar
@ 2009-06-04 16:00               ` tip-bot for Peter Zijlstra
  2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Remove munmap stuff tip-bot for Peter Zijlstra
                                 ` (555 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 16:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  60313ebed739b331e8e61079da27a11ee3b73a30
Gitweb:     http://git.kernel.org/tip/60313ebed739b331e8e61079da27a11ee3b73a30
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 16:53:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 17:51:38 +0200

perf_counter: Add fork event

Create a fork event so that we can easily clone the comm and
dso maps without having to generate all those events.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   10 +++
 kernel/fork.c                |    4 +-
 kernel/perf_counter.c        |  131 ++++++++++++++++++++++++++++++++++++------
 3 files changed, 126 insertions(+), 19 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 37d5541..380247b 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -277,6 +277,14 @@ enum perf_event_type {
 	PERF_EVENT_UNTHROTTLE		= 6,
 
 	/*
+	 * struct {
+	 * 	struct perf_event_header	header;
+	 * 	u32				pid, ppid;
+	 * };
+	 */
+	PERF_EVENT_FORK			= 7,
+
+	/*
 	 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
 	 * will be PERF_RECORD_*
 	 *
@@ -618,6 +626,7 @@ extern void perf_counter_munmap(unsigned long addr, unsigned long len,
 				unsigned long pgoff, struct file *file);
 
 extern void perf_counter_comm(struct task_struct *tsk);
+extern void perf_counter_fork(struct task_struct *tsk);
 
 extern void perf_counter_task_migration(struct task_struct *task, int cpu);
 
@@ -673,6 +682,7 @@ perf_counter_munmap(unsigned long addr, unsigned long len,
 		    unsigned long pgoff, struct file *file)		{ }
 
 static inline void perf_counter_comm(struct task_struct *tsk)		{ }
+static inline void perf_counter_fork(struct task_struct *tsk)		{ }
 static inline void perf_counter_init(void)				{ }
 static inline void perf_counter_task_migration(struct task_struct *task,
 					       int cpu)			{ }
diff --git a/kernel/fork.c b/kernel/fork.c
index b7d7a9f..f4466ca 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1412,12 +1412,12 @@ long do_fork(unsigned long clone_flags,
 		if (clone_flags & CLONE_VFORK) {
 			p->vfork_done = &vfork;
 			init_completion(&vfork);
-		} else {
+		} else if (!(clone_flags & CLONE_VM)) {
 			/*
 			 * vfork will do an exec which will call
 			 * set_task_comm()
 			 */
-			perf_counter_comm(p);
+			perf_counter_fork(p);
 		}
 
 		audit_finish_fork(p);
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 0bb03f1..78c5862 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -40,9 +40,9 @@ static int perf_reserved_percpu __read_mostly;
 static int perf_overcommit __read_mostly = 1;
 
 static atomic_t nr_counters __read_mostly;
-static atomic_t nr_mmap_tracking __read_mostly;
-static atomic_t nr_munmap_tracking __read_mostly;
-static atomic_t nr_comm_tracking __read_mostly;
+static atomic_t nr_mmap_counters __read_mostly;
+static atomic_t nr_munmap_counters __read_mostly;
+static atomic_t nr_comm_counters __read_mostly;
 
 int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */
 int sysctl_perf_counter_mlock __read_mostly = 512; /* 'free' kb per user */
@@ -1447,11 +1447,11 @@ static void free_counter(struct perf_counter *counter)
 
 	atomic_dec(&nr_counters);
 	if (counter->attr.mmap)
-		atomic_dec(&nr_mmap_tracking);
+		atomic_dec(&nr_mmap_counters);
 	if (counter->attr.munmap)
-		atomic_dec(&nr_munmap_tracking);
+		atomic_dec(&nr_munmap_counters);
 	if (counter->attr.comm)
-		atomic_dec(&nr_comm_tracking);
+		atomic_dec(&nr_comm_counters);
 
 	if (counter->destroy)
 		counter->destroy(counter);
@@ -2476,6 +2476,105 @@ static void perf_counter_output(struct perf_counter *counter,
 }
 
 /*
+ * fork tracking
+ */
+
+struct perf_fork_event {
+	struct task_struct	*task;
+
+	struct {
+		struct perf_event_header	header;
+
+		u32				pid;
+		u32				ppid;
+	} event;
+};
+
+static void perf_counter_fork_output(struct perf_counter *counter,
+				     struct perf_fork_event *fork_event)
+{
+	struct perf_output_handle handle;
+	int size = fork_event->event.header.size;
+	struct task_struct *task = fork_event->task;
+	int ret = perf_output_begin(&handle, counter, size, 0, 0);
+
+	if (ret)
+		return;
+
+	fork_event->event.pid = perf_counter_pid(counter, task);
+	fork_event->event.ppid = perf_counter_pid(counter, task->real_parent);
+
+	perf_output_put(&handle, fork_event->event);
+	perf_output_end(&handle);
+}
+
+static int perf_counter_fork_match(struct perf_counter *counter)
+{
+	if (counter->attr.comm || counter->attr.mmap || counter->attr.munmap)
+		return 1;
+
+	return 0;
+}
+
+static void perf_counter_fork_ctx(struct perf_counter_context *ctx,
+				  struct perf_fork_event *fork_event)
+{
+	struct perf_counter *counter;
+
+	if (system_state != SYSTEM_RUNNING || list_empty(&ctx->event_list))
+		return;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(counter, &ctx->event_list, event_entry) {
+		if (perf_counter_fork_match(counter))
+			perf_counter_fork_output(counter, fork_event);
+	}
+	rcu_read_unlock();
+}
+
+static void perf_counter_fork_event(struct perf_fork_event *fork_event)
+{
+	struct perf_cpu_context *cpuctx;
+	struct perf_counter_context *ctx;
+
+	cpuctx = &get_cpu_var(perf_cpu_context);
+	perf_counter_fork_ctx(&cpuctx->ctx, fork_event);
+	put_cpu_var(perf_cpu_context);
+
+	rcu_read_lock();
+	/*
+	 * doesn't really matter which of the child contexts the
+	 * events ends up in.
+	 */
+	ctx = rcu_dereference(current->perf_counter_ctxp);
+	if (ctx)
+		perf_counter_fork_ctx(ctx, fork_event);
+	rcu_read_unlock();
+}
+
+void perf_counter_fork(struct task_struct *task)
+{
+	struct perf_fork_event fork_event;
+
+	if (!atomic_read(&nr_comm_counters) &&
+	    !atomic_read(&nr_mmap_counters) &&
+	    !atomic_read(&nr_munmap_counters))
+		return;
+
+	fork_event = (struct perf_fork_event){
+		.task	= task,
+		.event  = {
+			.header = {
+				.type = PERF_EVENT_FORK,
+				.size = sizeof(fork_event.event),
+			},
+		},
+	};
+
+	perf_counter_fork_event(&fork_event);
+}
+
+/*
  * comm tracking
  */
 
@@ -2511,11 +2610,9 @@ static void perf_counter_comm_output(struct perf_counter *counter,
 	perf_output_end(&handle);
 }
 
-static int perf_counter_comm_match(struct perf_counter *counter,
-				   struct perf_comm_event *comm_event)
+static int perf_counter_comm_match(struct perf_counter *counter)
 {
-	if (counter->attr.comm &&
-	    comm_event->event.header.type == PERF_EVENT_COMM)
+	if (counter->attr.comm)
 		return 1;
 
 	return 0;
@@ -2531,7 +2628,7 @@ static void perf_counter_comm_ctx(struct perf_counter_context *ctx,
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(counter, &ctx->event_list, event_entry) {
-		if (perf_counter_comm_match(counter, comm_event))
+		if (perf_counter_comm_match(counter))
 			perf_counter_comm_output(counter, comm_event);
 	}
 	rcu_read_unlock();
@@ -2570,7 +2667,7 @@ void perf_counter_comm(struct task_struct *task)
 {
 	struct perf_comm_event comm_event;
 
-	if (!atomic_read(&nr_comm_tracking))
+	if (!atomic_read(&nr_comm_counters))
 		return;
 
 	comm_event = (struct perf_comm_event){
@@ -2708,7 +2805,7 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
 {
 	struct perf_mmap_event mmap_event;
 
-	if (!atomic_read(&nr_mmap_tracking))
+	if (!atomic_read(&nr_mmap_counters))
 		return;
 
 	mmap_event = (struct perf_mmap_event){
@@ -2729,7 +2826,7 @@ void perf_counter_munmap(unsigned long addr, unsigned long len,
 {
 	struct perf_mmap_event mmap_event;
 
-	if (!atomic_read(&nr_munmap_tracking))
+	if (!atomic_read(&nr_munmap_counters))
 		return;
 
 	mmap_event = (struct perf_mmap_event){
@@ -3427,11 +3524,11 @@ done:
 
 	atomic_inc(&nr_counters);
 	if (counter->attr.mmap)
-		atomic_inc(&nr_mmap_tracking);
+		atomic_inc(&nr_mmap_counters);
 	if (counter->attr.munmap)
-		atomic_inc(&nr_munmap_tracking);
+		atomic_inc(&nr_munmap_counters);
 	if (counter->attr.comm)
-		atomic_inc(&nr_comm_tracking);
+		atomic_inc(&nr_comm_counters);
 
 	return counter;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Remove munmap stuff
       [not found]             ` <new-submission>
                                 ` (151 preceding siblings ...)
  2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Add fork event tip-bot for Peter Zijlstra
@ 2009-06-04 16:00               ` tip-bot for Peter Zijlstra
  2009-06-04 16:01               ` [tip:perfcounters/core] perf_counter tools: Use fork and remove munmap events tip-bot for Peter Zijlstra
                                 ` (554 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 16:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  d99e9446200c1ffab28cb0e39b76c34a2bfafd06
Gitweb:     http://git.kernel.org/tip/d99e9446200c1ffab28cb0e39b76c34a2bfafd06
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 17:08:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 17:51:38 +0200

perf_counter: Remove munmap stuff

In name of keeping it simple, only track mmap events. Userspace
will have to remove old overlapping maps when it encounters them.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   11 +----------
 kernel/perf_counter.c        |   38 +++-----------------------------------
 mm/mmap.c                    |    6 ------
 3 files changed, 4 insertions(+), 51 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 380247b..6ca403a 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -148,11 +148,10 @@ struct perf_counter_attr {
 				exclude_hv     :  1, /* ditto hypervisor      */
 				exclude_idle   :  1, /* don't count when idle */
 				mmap           :  1, /* include mmap data     */
-				munmap         :  1, /* include munmap data   */
 				comm	       :  1, /* include comm data     */
 				freq           :  1, /* use freq, not period  */
 
-				__reserved_1   : 52;
+				__reserved_1   : 53;
 
 	__u32			wakeup_events;	/* wakeup every n events */
 	__u32			__reserved_2;
@@ -246,7 +245,6 @@ enum perf_event_type {
 	 * };
 	 */
 	PERF_EVENT_MMAP			= 1,
-	PERF_EVENT_MUNMAP		= 2,
 
 	/*
 	 * struct {
@@ -622,9 +620,6 @@ extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
 extern void perf_counter_mmap(unsigned long addr, unsigned long len,
 			      unsigned long pgoff, struct file *file);
 
-extern void perf_counter_munmap(unsigned long addr, unsigned long len,
-				unsigned long pgoff, struct file *file);
-
 extern void perf_counter_comm(struct task_struct *tsk);
 extern void perf_counter_fork(struct task_struct *tsk);
 
@@ -677,10 +672,6 @@ static inline void
 perf_counter_mmap(unsigned long addr, unsigned long len,
 		  unsigned long pgoff, struct file *file)		{ }
 
-static inline void
-perf_counter_munmap(unsigned long addr, unsigned long len,
-		    unsigned long pgoff, struct file *file)		{ }
-
 static inline void perf_counter_comm(struct task_struct *tsk)		{ }
 static inline void perf_counter_fork(struct task_struct *tsk)		{ }
 static inline void perf_counter_init(void)				{ }
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 78c5862..195712e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -41,7 +41,6 @@ static int perf_overcommit __read_mostly = 1;
 
 static atomic_t nr_counters __read_mostly;
 static atomic_t nr_mmap_counters __read_mostly;
-static atomic_t nr_munmap_counters __read_mostly;
 static atomic_t nr_comm_counters __read_mostly;
 
 int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */
@@ -1448,8 +1447,6 @@ static void free_counter(struct perf_counter *counter)
 	atomic_dec(&nr_counters);
 	if (counter->attr.mmap)
 		atomic_dec(&nr_mmap_counters);
-	if (counter->attr.munmap)
-		atomic_dec(&nr_munmap_counters);
 	if (counter->attr.comm)
 		atomic_dec(&nr_comm_counters);
 
@@ -2510,7 +2507,7 @@ static void perf_counter_fork_output(struct perf_counter *counter,
 
 static int perf_counter_fork_match(struct perf_counter *counter)
 {
-	if (counter->attr.comm || counter->attr.mmap || counter->attr.munmap)
+	if (counter->attr.comm || counter->attr.mmap)
 		return 1;
 
 	return 0;
@@ -2557,8 +2554,7 @@ void perf_counter_fork(struct task_struct *task)
 	struct perf_fork_event fork_event;
 
 	if (!atomic_read(&nr_comm_counters) &&
-	    !atomic_read(&nr_mmap_counters) &&
-	    !atomic_read(&nr_munmap_counters))
+	    !atomic_read(&nr_mmap_counters))
 		return;
 
 	fork_event = (struct perf_fork_event){
@@ -2722,12 +2718,7 @@ static void perf_counter_mmap_output(struct perf_counter *counter,
 static int perf_counter_mmap_match(struct perf_counter *counter,
 				   struct perf_mmap_event *mmap_event)
 {
-	if (counter->attr.mmap &&
-	    mmap_event->event.header.type == PERF_EVENT_MMAP)
-		return 1;
-
-	if (counter->attr.munmap &&
-	    mmap_event->event.header.type == PERF_EVENT_MUNMAP)
+	if (counter->attr.mmap)
 		return 1;
 
 	return 0;
@@ -2821,27 +2812,6 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
 	perf_counter_mmap_event(&mmap_event);
 }
 
-void perf_counter_munmap(unsigned long addr, unsigned long len,
-			 unsigned long pgoff, struct file *file)
-{
-	struct perf_mmap_event mmap_event;
-
-	if (!atomic_read(&nr_munmap_counters))
-		return;
-
-	mmap_event = (struct perf_mmap_event){
-		.file   = file,
-		.event  = {
-			.header = { .type = PERF_EVENT_MUNMAP, },
-			.start  = addr,
-			.len    = len,
-			.pgoff  = pgoff,
-		},
-	};
-
-	perf_counter_mmap_event(&mmap_event);
-}
-
 /*
  * Log sample_period changes so that analyzing tools can re-normalize the
  * event flow.
@@ -3525,8 +3495,6 @@ done:
 	atomic_inc(&nr_counters);
 	if (counter->attr.mmap)
 		atomic_inc(&nr_mmap_counters);
-	if (counter->attr.munmap)
-		atomic_inc(&nr_munmap_counters);
 	if (counter->attr.comm)
 		atomic_inc(&nr_comm_counters);
 
diff --git a/mm/mmap.c b/mm/mmap.c
index 2c1c2cb..6451ce2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1756,12 +1756,6 @@ static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
 	do {
 		long nrpages = vma_pages(vma);
 
-		if (vma->vm_flags & VM_EXEC) {
-			perf_counter_munmap(vma->vm_start,
-					nrpages << PAGE_SHIFT,
-					vma->vm_pgoff, vma->vm_file);
-		}
-
 		mm->total_vm -= nrpages;
 		vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
 		vma = remove_vma(vma);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Use fork and remove munmap events
       [not found]             ` <new-submission>
                                 ` (152 preceding siblings ...)
  2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Remove munmap stuff tip-bot for Peter Zijlstra
@ 2009-06-04 16:01               ` tip-bot for Peter Zijlstra
  2009-06-05 12:45               ` [tip:perfcounters/core] perf record: Split out counter creation into a helper function tip-bot for Ingo Molnar
                                 ` (553 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-04 16:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  62fc44536c14b5787531bac7417580fca54c88b4
Gitweb:     http://git.kernel.org/tip/62fc44536c14b5787531bac7417580fca54c88b4
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 4 Jun 2009 16:53:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Jun 2009 17:51:39 +0200

perf_counter tools: Use fork and remove munmap events

Use fork events to clone comm and map data and remove everything
munmap related

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |  103 ++++++++++++++++++++++++---
 Documentation/perf_counter/builtin-top.c    |   21 ------
 2 files changed, 93 insertions(+), 31 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 389ae25..5d19121 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -43,12 +43,6 @@ static int		full_paths;
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
-const char *perf_event_names[] = {
-	[PERF_EVENT_MMAP]   = " PERF_EVENT_MMAP",
-	[PERF_EVENT_MUNMAP] = " PERF_EVENT_MUNMAP",
-	[PERF_EVENT_COMM]   = " PERF_EVENT_COMM",
-};
-
 struct ip_event {
 	struct perf_event_header header;
 	__u64 ip;
@@ -70,11 +64,17 @@ struct comm_event {
 	char comm[16];
 };
 
+struct fork_event {
+	struct perf_event_header header;
+	__u32 pid, ppid;
+};
+
 typedef union event_union {
 	struct perf_event_header header;
 	struct ip_event ip;
 	struct mmap_event mmap;
 	struct comm_event comm;
+	struct fork_event fork;
 } event_t;
 
 static LIST_HEAD(dsos);
@@ -208,7 +208,31 @@ out_delete:
 	return NULL;
 }
 
-struct thread;
+static struct map *map__clone(struct map *self)
+{
+	struct map *map = malloc(sizeof(*self));
+
+	if (!map)
+		return NULL;
+
+	memcpy(map, self, sizeof(*self));
+
+	return map;
+}
+
+static int map__overlap(struct map *l, struct map *r)
+{
+	if (l->start > r->start) {
+		struct map *t = l;
+		l = r;
+		r = t;
+	}
+
+	if (l->end > r->start)
+		return 1;
+
+	return 0;
+}
 
 struct thread {
 	struct rb_node	 rb_node;
@@ -284,9 +308,39 @@ static struct thread *threads__findnew(pid_t pid)
 
 static void thread__insert_map(struct thread *self, struct map *map)
 {
+	struct map *pos, *tmp;
+
+	list_for_each_entry_safe(pos, tmp, &self->maps, node) {
+		if (map__overlap(pos, map)) {
+			list_del_init(&pos->node);
+			/* XXX leaks dsos */
+			free(pos);
+		}
+	}
+
 	list_add_tail(&map->node, &self->maps);
 }
 
+static int thread__fork(struct thread *self, struct thread *parent)
+{
+	struct map *map;
+
+	if (self->comm)
+		free(self->comm);
+	self->comm = strdup(parent->comm);
+	if (!self->comm)
+		return -ENOMEM;
+
+	list_for_each_entry(map, &parent->maps, node) {
+		struct map *new = map__clone(map);
+		if (!new)
+			return -ENOMEM;
+		thread__insert_map(self, new);
+	}
+
+	return 0;
+}
+
 static struct map *thread__find_map(struct thread *self, uint64_t ip)
 {
 	struct map *pos;
@@ -784,7 +838,11 @@ static void register_idle_thread(void)
 	}
 }
 
-static unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
+static unsigned long total = 0,
+		     total_mmap = 0,
+		     total_comm = 0,
+		     total_fork = 0,
+		     total_unknown = 0;
 
 static int
 process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
@@ -866,9 +924,10 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
 	struct thread *thread = threads__findnew(event->mmap.pid);
 	struct map *map = map__new(&event->mmap);
 
-	dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+	dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n",
 		(void *)(offset + head),
 		(void *)(long)(event->header.size),
+		event->mmap.pid,
 		(void *)(long)event->mmap.start,
 		(void *)(long)event->mmap.len,
 		(void *)(long)event->mmap.pgoff,
@@ -906,6 +965,26 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 }
 
 static int
+process_fork_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->fork.pid);
+	struct thread *parent = threads__findnew(event->fork.ppid);
+
+	dprintf("%p [%p]: PERF_EVENT_FORK: %d:%d\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->fork.pid, event->fork.ppid);
+
+	if (!thread || !parent || thread__fork(thread, parent)) {
+		dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
+		return -1;
+	}
+	total_fork++;
+
+	return 0;
+}
+
+static int
 process_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
@@ -918,10 +997,13 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	case PERF_EVENT_COMM:
 		return process_comm_event(event, offset, head);
 
+	case PERF_EVENT_FORK:
+		return process_fork_event(event, offset, head);
+
 	/*
 	 * We dont process them right now but they are fine:
 	 */
-	case PERF_EVENT_MUNMAP:
+
 	case PERF_EVENT_PERIOD:
 	case PERF_EVENT_THROTTLE:
 	case PERF_EVENT_UNTHROTTLE:
@@ -1038,6 +1120,7 @@ more:
 	dprintf("      IP events: %10ld\n", total);
 	dprintf("    mmap events: %10ld\n", total_mmap);
 	dprintf("    comm events: %10ld\n", total_comm);
+	dprintf("    fork events: %10ld\n", total_fork);
 	dprintf(" unknown events: %10ld\n", total_unknown);
 
 	if (dump_trace)
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 20e5b12..31c00ba 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -75,8 +75,6 @@ static unsigned int		realtime_prio			=  0;
 static int			group				=  0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			=  16;
-static int			use_mmap			= 0;
-static int			use_munmap			= 0;
 static int			freq				= 0;
 
 static char			*sym_filter;
@@ -527,19 +525,6 @@ static void mmap_read(struct mmap_data *md)
 		if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
 			if (event->header.type & PERF_SAMPLE_IP)
 				process_event(event->ip.ip, md->counter);
-		} else {
-			switch (event->header.type) {
-				case PERF_EVENT_MMAP:
-				case PERF_EVENT_MUNMAP:
-					printf("%s: %Lu %Lu %Lu %s\n",
-							event->header.type == PERF_EVENT_MMAP
-							? "mmap" : "munmap",
-							event->mmap.start,
-							event->mmap.len,
-							event->mmap.pgoff,
-							event->mmap.filename);
-					break;
-			}
 		}
 	}
 
@@ -569,8 +554,6 @@ static int __cmd_top(void)
 			attr.config		= event_id[counter];
 			attr.sample_period	= event_count[counter];
 			attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
-			attr.mmap		= use_mmap;
-			attr.munmap		= use_munmap;
 			attr.freq		= freq;
 
 			fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
@@ -670,10 +653,6 @@ static const struct option options[] = {
 		    "only display symbols matchig this pattern"),
 	OPT_BOOLEAN('z', "zero", &group,
 		    "zero history across updates"),
-	OPT_BOOLEAN('M', "use-mmap", &use_mmap,
-		    "track mmap events"),
-	OPT_BOOLEAN('U', "use-munmap", &use_munmap,
-		    "track munmap events"),
 	OPT_INTEGER('F', "freq", &freq,
 		    "profile at this frequency"),
 	OPT_INTEGER('E', "entries", &print_entries,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Build with native optimization
  2009-06-04 13:09               ` [tip:perfcounters/core] perf_counter tools: Build with native optimization tip-bot for Ingo Molnar
@ 2009-06-05  1:03                 ` Paul Mackerras
  2009-06-05 18:42                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Paul Mackerras @ 2009-06-05  1:03 UTC (permalink / raw)
  To: mingo
  Cc: hpa, acme, linux-kernel, a.p.zijlstra, efault, mtosatti, tglx,
	cjashfor

tip-bot for Ingo Molnar writes:

> perf_counter tools: Build with native optimization
> 
> Build the tools with -march=native by default.

On powerpc (RHEL5.2 on POWER5+, gcc 4.1.2), I get:

    CC perf.o
cc1: error: unrecognized command line option "-march=native"
make: *** [perf.o] Error 1

Is there a way to make the default CFLAGS depend on the architecture?
We need -m64 on powerpc as well.

Paul.

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Split out counter creation into a helper function
       [not found]             ` <new-submission>
                                 ` (153 preceding siblings ...)
  2009-06-04 16:01               ` [tip:perfcounters/core] perf_counter tools: Use fork and remove munmap events tip-bot for Peter Zijlstra
@ 2009-06-05 12:45               ` tip-bot for Ingo Molnar
  2009-06-05 12:45               ` [tip:perfcounters/core] perf record, top: Implement --freq tip-bot for Ingo Molnar
                                 ` (552 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 12:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f250c030a87273f8838a2302bee7c2b4d03e9151
Gitweb:     http://git.kernel.org/tip/f250c030a87273f8838a2302bee7c2b4d03e9151
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 13:18:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 13:29:57 +0200

perf record: Split out counter creation into a helper function

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |  100 ++++++++++++++-------------
 1 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index bf59df5..7f2d7ce 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -336,65 +336,71 @@ static void synthesize_events(void)
 	closedir(proc);
 }
 
-static void open_counters(int cpu, pid_t pid)
+static int group_fd;
+
+static void create_counter(int counter, int cpu, pid_t pid)
 {
 	struct perf_counter_attr attr;
-	int counter, group_fd;
 	int track = 1;
 
-	if (pid > 0) {
-		pid_synthesize_comm_event(pid, 0);
-		pid_synthesize_mmap_events(pid);
-	}
+	memset(&attr, 0, sizeof(attr));
+	attr.config		= event_id[counter];
+	attr.sample_period	= event_count[counter];
+	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+	attr.mmap		= track;
+	attr.comm		= track;
+	attr.inherit	= (cpu < 0) && inherit;
 
-	group_fd = -1;
-	for (counter = 0; counter < nr_counters; counter++) {
+	track = 0; /* only the first counter needs these */
 
-		memset(&attr, 0, sizeof(attr));
-		attr.config		= event_id[counter];
-		attr.sample_period	= event_count[counter];
-		attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
-		attr.mmap		= track;
-		attr.comm		= track;
-		attr.inherit	= (cpu < 0) && inherit;
+	fd[nr_cpu][counter] = sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
 
-		track = 0; // only the first counter needs these
+	if (fd[nr_cpu][counter] < 0) {
+		int err = errno;
 
-		fd[nr_cpu][counter] =
-			sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
+		error("syscall returned with %d (%s)\n",
+				fd[nr_cpu][counter], strerror(err));
+		if (err == EPERM)
+			printf("Are you root?\n");
+		exit(-1);
+	}
+	assert(fd[nr_cpu][counter] >= 0);
+	fcntl(fd[nr_cpu][counter], F_SETFL, O_NONBLOCK);
 
-		if (fd[nr_cpu][counter] < 0) {
-			int err = errno;
+	/*
+	 * First counter acts as the group leader:
+	 */
+	if (group && group_fd == -1)
+		group_fd = fd[nr_cpu][counter];
+
+	event_array[nr_poll].fd = fd[nr_cpu][counter];
+	event_array[nr_poll].events = POLLIN;
+	nr_poll++;
+
+	mmap_array[nr_cpu][counter].counter = counter;
+	mmap_array[nr_cpu][counter].prev = 0;
+	mmap_array[nr_cpu][counter].mask = mmap_pages*page_size - 1;
+	mmap_array[nr_cpu][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
+			PROT_READ, MAP_SHARED, fd[nr_cpu][counter], 0);
+	if (mmap_array[nr_cpu][counter].base == MAP_FAILED) {
+		error("failed to mmap with %d (%s)\n", errno, strerror(errno));
+		exit(-1);
+	}
+}
 
-			error("syscall returned with %d (%s)\n",
-					fd[nr_cpu][counter], strerror(err));
-			if (err == EPERM)
-				printf("Are you root?\n");
-			exit(-1);
-		}
-		assert(fd[nr_cpu][counter] >= 0);
-		fcntl(fd[nr_cpu][counter], F_SETFL, O_NONBLOCK);
+static void open_counters(int cpu, pid_t pid)
+{
+	int counter;
 
-		/*
-		 * First counter acts as the group leader:
-		 */
-		if (group && group_fd == -1)
-			group_fd = fd[nr_cpu][counter];
-
-		event_array[nr_poll].fd = fd[nr_cpu][counter];
-		event_array[nr_poll].events = POLLIN;
-		nr_poll++;
-
-		mmap_array[nr_cpu][counter].counter = counter;
-		mmap_array[nr_cpu][counter].prev = 0;
-		mmap_array[nr_cpu][counter].mask = mmap_pages*page_size - 1;
-		mmap_array[nr_cpu][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ, MAP_SHARED, fd[nr_cpu][counter], 0);
-		if (mmap_array[nr_cpu][counter].base == MAP_FAILED) {
-			error("failed to mmap with %d (%s)\n", errno, strerror(errno));
-			exit(-1);
-		}
+	if (pid > 0) {
+		pid_synthesize_comm_event(pid, 0);
+		pid_synthesize_mmap_events(pid);
 	}
+
+	group_fd = -1;
+	for (counter = 0; counter < nr_counters; counter++)
+		create_counter(counter, cpu, pid);
+
 	nr_cpu++;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record, top: Implement --freq
       [not found]             ` <new-submission>
                                 ` (154 preceding siblings ...)
  2009-06-05 12:45               ` [tip:perfcounters/core] perf record: Split out counter creation into a helper function tip-bot for Ingo Molnar
@ 2009-06-05 12:45               ` tip-bot for Ingo Molnar
  2009-06-05 13:21               ` [tip:perfcounters/core] x86: Set context.vdso before installing the mapping tip-bot for Peter Zijlstra
                                 ` (551 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 12:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  cf1f45744c6fa3501e0a6f0ddc418f0ef27e725b
Gitweb:     http://git.kernel.org/tip/cf1f45744c6fa3501e0a6f0ddc418f0ef27e725b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 13:27:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 13:39:23 +0200

perf record, top: Implement --freq

Support frequency-based profiling and make it the default.

(Also add a Hz printout in perf top.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   10 +++++++++-
 Documentation/perf_counter/builtin-top.c    |   13 +++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 7f2d7ce..e2301f3 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -27,6 +27,7 @@ static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 static int			nr_cpus				= 0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			= 128;
+static int			freq				= 0;
 static int			output;
 static const char		*output_name			= "perf.data";
 static int			group				= 0;
@@ -347,9 +348,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	attr.config		= event_id[counter];
 	attr.sample_period	= event_count[counter];
 	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+	attr.freq		= freq;
 	attr.mmap		= track;
 	attr.comm		= track;
-	attr.inherit	= (cpu < 0) && inherit;
+	attr.inherit		= (cpu < 0) && inherit;
 
 	track = 0; /* only the first counter needs these */
 
@@ -520,6 +522,8 @@ static const struct option options[] = {
 		    "output file name"),
 	OPT_BOOLEAN('i', "inherit", &inherit,
 		    "child tasks inherit counters"),
+	OPT_INTEGER('F', "freq", &freq,
+		    "profile at this frequency"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
 		    "number of mmap data pages"),
 	OPT_END()
@@ -540,6 +544,10 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 		event_id[0] = 0;
 	}
 
+	if (freq) {
+		default_interval = freq;
+		freq = 1;
+	}
 	for (counter = 0; counter < nr_counters; counter++) {
 		if (event_count[counter])
 			continue;
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 28cbde4..2fee595 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -74,8 +74,8 @@ static int			nr_cpus				=  0;
 static unsigned int		realtime_prio			=  0;
 static int			group				=  0;
 static unsigned int		page_size;
-static unsigned int		mmap_pages			=  16;
-static int			freq				= 0;
+static unsigned int		mmap_pages			= 16;
+static int			freq				=  0;
 
 static char			*sym_filter;
 static unsigned long		filter_start;
@@ -212,8 +212,13 @@ static void print_sym_table(void)
 		events_per_sec,
 		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
 
-	if (nr_counters == 1)
-		printf("%d ", event_count[0]);
+	if (nr_counters == 1) {
+		printf("%d", event_count[0]);
+		if (freq)
+			printf("Hz ");
+		else
+			printf(" ");
+	}
 
 	for (counter = 0; counter < nr_counters; counter++) {
 		if (counter)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] x86: Set context.vdso before installing the mapping
       [not found]             ` <new-submission>
                                 ` (155 preceding siblings ...)
  2009-06-05 12:45               ` [tip:perfcounters/core] perf record, top: Implement --freq tip-bot for Ingo Molnar
@ 2009-06-05 13:21               ` tip-bot for Peter Zijlstra
  2009-06-05 13:21               ` [tip:perfcounters/core] perf_counter: Generate mmap events for install_special_mapping() tip-bot for Peter Zijlstra
                                 ` (550 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 13:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f7b6eb3fa07269da20dbbde8ba37a0273fdbd9c9
Gitweb:     http://git.kernel.org/tip/f7b6eb3fa07269da20dbbde8ba37a0273fdbd9c9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 14:04:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:46:40 +0200

x86: Set context.vdso before installing the mapping

In order to make arch_vma_name() work from inside
install_special_mapping() we need to set the context.vdso
before calling it.

( This is needed for performance counters to be able to track
  this special executable area. )

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/vdso/vdso32-setup.c |    6 +++++-
 arch/x86/vdso/vma.c          |    7 +++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 1241f11..58bc00f 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -338,6 +338,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		}
 	}
 
+	current->mm->context.vdso = (void *)addr;
+
 	if (compat_uses_vma || !compat) {
 		/*
 		 * MAYWRITE to allow gdb to COW and set breakpoints
@@ -358,11 +360,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 			goto up_fail;
 	}
 
-	current->mm->context.vdso = (void *)addr;
 	current_thread_info()->sysenter_return =
 		VDSO32_SYMBOL(addr, SYSENTER_RETURN);
 
   up_fail:
+	if (ret)
+		current->mm->context.vdso = NULL;
+
 	up_write(&mm->mmap_sem);
 
 	return ret;
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 7133cdf..93b7a29 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -115,15 +115,18 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		goto up_fail;
 	}
 
+	current->mm->context.vdso = (void *)addr;
+
 	ret = install_special_mapping(mm, addr, vdso_size,
 				      VM_READ|VM_EXEC|
 				      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
 				      VM_ALWAYSDUMP,
 				      vdso_pages);
-	if (ret)
+	if (ret) {
+		current->mm->context.vdso = NULL;
 		goto up_fail;
+	}
 
-	current->mm->context.vdso = (void *)addr;
 up_fail:
 	up_write(&mm->mmap_sem);
 	return ret;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Generate mmap events for install_special_mapping()
       [not found]             ` <new-submission>
                                 ` (156 preceding siblings ...)
  2009-06-05 13:21               ` [tip:perfcounters/core] x86: Set context.vdso before installing the mapping tip-bot for Peter Zijlstra
@ 2009-06-05 13:21               ` tip-bot for Peter Zijlstra
  2009-06-05 13:21               ` [tip:perfcounters/core] perf report: Deal with maps tip-bot for Peter Zijlstra
                                 ` (549 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 13:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  089dd79db9264dc0da602bad45d42f1b3e7d1e07
Gitweb:     http://git.kernel.org/tip/089dd79db9264dc0da602bad45d42f1b3e7d1e07
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 14:04:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:46:41 +0200

perf_counter: Generate mmap events for install_special_mapping()

In order to track the vdso also generate mmap events for
install_special_mapping().

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   14 ++++++++------
 kernel/perf_counter.c        |   34 ++++++++++++++++++++++------------
 mm/mmap.c                    |    5 +++--
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6ca403a..40dc0e2 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -617,8 +617,13 @@ static inline int is_software_counter(struct perf_counter *counter)
 
 extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
 
-extern void perf_counter_mmap(unsigned long addr, unsigned long len,
-			      unsigned long pgoff, struct file *file);
+extern void __perf_counter_mmap(struct vm_area_struct *vma);
+
+static inline void perf_counter_mmap(struct vm_area_struct *vma)
+{
+	if (vma->vm_flags & VM_EXEC)
+		__perf_counter_mmap(vma);
+}
 
 extern void perf_counter_comm(struct task_struct *tsk);
 extern void perf_counter_fork(struct task_struct *tsk);
@@ -668,10 +673,7 @@ static inline void
 perf_swcounter_event(u32 event, u64 nr, int nmi,
 		     struct pt_regs *regs, u64 addr)			{ }
 
-static inline void
-perf_counter_mmap(unsigned long addr, unsigned long len,
-		  unsigned long pgoff, struct file *file)		{ }
-
+static inline void perf_counter_mmap(struct vm_area_struct *vma)	{ }
 static inline void perf_counter_comm(struct task_struct *tsk)		{ }
 static inline void perf_counter_fork(struct task_struct *tsk)		{ }
 static inline void perf_counter_init(void)				{ }
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index a5d3e2a..37a5a24 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2255,7 +2255,7 @@ out:
 }
 
 static void perf_output_copy(struct perf_output_handle *handle,
-			     void *buf, unsigned int len)
+			     const void *buf, unsigned int len)
 {
 	unsigned int pages_mask;
 	unsigned int offset;
@@ -2681,9 +2681,10 @@ void perf_counter_comm(struct task_struct *task)
  */
 
 struct perf_mmap_event {
-	struct file	*file;
-	char		*file_name;
-	int		file_size;
+	struct vm_area_struct	*vma;
+
+	const char		*file_name;
+	int			file_size;
 
 	struct {
 		struct perf_event_header	header;
@@ -2744,11 +2745,12 @@ static void perf_counter_mmap_event(struct perf_mmap_event *mmap_event)
 {
 	struct perf_cpu_context *cpuctx;
 	struct perf_counter_context *ctx;
-	struct file *file = mmap_event->file;
+	struct vm_area_struct *vma = mmap_event->vma;
+	struct file *file = vma->vm_file;
 	unsigned int size;
 	char tmp[16];
 	char *buf = NULL;
-	char *name;
+	const char *name;
 
 	if (file) {
 		buf = kzalloc(PATH_MAX, GFP_KERNEL);
@@ -2762,6 +2764,15 @@ static void perf_counter_mmap_event(struct perf_mmap_event *mmap_event)
 			goto got_name;
 		}
 	} else {
+		name = arch_vma_name(mmap_event->vma);
+		if (name)
+			goto got_name;
+
+		if (!vma->vm_mm) {
+			name = strncpy(tmp, "[vdso]", sizeof(tmp));
+			goto got_name;
+		}
+
 		name = strncpy(tmp, "//anon", sizeof(tmp));
 		goto got_name;
 	}
@@ -2791,8 +2802,7 @@ got_name:
 	kfree(buf);
 }
 
-void perf_counter_mmap(unsigned long addr, unsigned long len,
-		       unsigned long pgoff, struct file *file)
+void __perf_counter_mmap(struct vm_area_struct *vma)
 {
 	struct perf_mmap_event mmap_event;
 
@@ -2800,12 +2810,12 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
 		return;
 
 	mmap_event = (struct perf_mmap_event){
-		.file   = file,
+		.vma	= vma,
 		.event  = {
 			.header = { .type = PERF_EVENT_MMAP, },
-			.start  = addr,
-			.len    = len,
-			.pgoff  = pgoff,
+			.start  = vma->vm_start,
+			.len    = vma->vm_end - vma->vm_start,
+			.pgoff  = vma->vm_pgoff,
 		},
 	};
 
diff --git a/mm/mmap.c b/mm/mmap.c
index 6451ce2..8101de4 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1220,8 +1220,7 @@ munmap_back:
 	if (correct_wcount)
 		atomic_inc(&inode->i_writecount);
 out:
-	if (vm_flags & VM_EXEC)
-		perf_counter_mmap(addr, len, pgoff, file);
+	perf_counter_mmap(vma);
 
 	mm->total_vm += len >> PAGE_SHIFT;
 	vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
@@ -2309,6 +2308,8 @@ int install_special_mapping(struct mm_struct *mm,
 
 	mm->total_vm += len >> PAGE_SHIFT;
 
+	perf_counter_mmap(vma);
+
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Deal with maps
       [not found]             ` <new-submission>
                                 ` (157 preceding siblings ...)
  2009-06-05 13:21               ` [tip:perfcounters/core] perf_counter: Generate mmap events for install_special_mapping() tip-bot for Peter Zijlstra
@ 2009-06-05 13:21               ` tip-bot for Peter Zijlstra
  2009-06-05 13:57                 ` Arnaldo Carvalho de Melo
  2009-06-05 13:22               ` [tip:perfcounters/core] perf report: Display user/kernel differentiator tip-bot for Ingo Molnar
                                 ` (548 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 13:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  fc54db5105d01ad691a7d747064c7890e17f936c
Gitweb:     http://git.kernel.org/tip/fc54db5105d01ad691a7d747064c7890e17f936c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 14:04:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:46:41 +0200

perf report: Deal with maps

In order to deal with [vdso] maps generalize the ip->symbol path
a bit and allow to override some bits with custom functions.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   37 +++++++++++++++++++++++++-
 Documentation/perf_counter/util/symbol.c    |    1 +
 Documentation/perf_counter/util/symbol.h    |    1 +
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index eb5424f..9783d1e 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -79,6 +79,7 @@ typedef union event_union {
 
 static LIST_HEAD(dsos);
 static struct dso *kernel_dso;
+static struct dso *vdso;
 
 static void dsos__add(struct dso *dso)
 {
@@ -136,6 +137,11 @@ static void dsos__fprintf(FILE *fp)
 		dso__fprintf(pos, fp);
 }
 
+static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
+{
+	return dso__find_symbol(kernel_dso, ip);
+}
+
 static int load_kernel(void)
 {
 	int err;
@@ -151,6 +157,14 @@ static int load_kernel(void)
 	} else
 		dsos__add(kernel_dso);
 
+	vdso = dso__new("[vdso]", 0);
+	if (!vdso)
+		return -1;
+
+	vdso->find_symbol = vdso__find_symbol;
+
+	dsos__add(vdso);
+
 	return err;
 }
 
@@ -173,9 +187,20 @@ struct map {
 	uint64_t	 start;
 	uint64_t	 end;
 	uint64_t	 pgoff;
+	uint64_t	 (*map_ip)(struct map *, uint64_t);
 	struct dso	 *dso;
 };
 
+static uint64_t map__map_ip(struct map *map, uint64_t ip)
+{
+	return ip - map->start + map->pgoff;
+}
+
+static uint64_t vdso__map_ip(struct map *map, uint64_t ip)
+{
+	return ip;
+}
+
 static struct map *map__new(struct mmap_event *event)
 {
 	struct map *self = malloc(sizeof(*self));
@@ -201,6 +226,11 @@ static struct map *map__new(struct mmap_event *event)
 		self->dso = dsos__findnew(filename);
 		if (self->dso == NULL)
 			goto out_delete;
+
+		if (self->dso == vdso)
+			self->map_ip = vdso__map_ip;
+		else
+			self->map_ip = map__map_ip;
 	}
 	return self;
 out_delete:
@@ -917,8 +947,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 
 		map = thread__find_map(thread, ip);
 		if (map != NULL) {
+			ip = map->map_ip(map, ip);
 			dso = map->dso;
-			ip -= map->start + map->pgoff;
 		} else {
 			/*
 			 * If this is outside of all known maps,
@@ -938,7 +968,10 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	}
 
 	if (show & show_mask) {
-		struct symbol *sym = dso__find_symbol(dso, ip);
+		struct symbol *sym = NULL;
+
+		if (dso)
+			sym = dso->find_symbol(dso, ip);
 
 		if (hist_entry__add(thread, map, dso, sym, ip, level)) {
 			fprintf(stderr,
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index 15d5cf9..a06bbfb 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -45,6 +45,7 @@ struct dso *dso__new(const char *name, unsigned int sym_priv_size)
 		strcpy(self->name, name);
 		self->syms = RB_ROOT;
 		self->sym_priv_size = sym_priv_size;
+		self->find_symbol = dso__find_symbol;
 	}
 
 	return self;
diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h
index 8dd8522..e23cc31 100644
--- a/Documentation/perf_counter/util/symbol.h
+++ b/Documentation/perf_counter/util/symbol.h
@@ -16,6 +16,7 @@ struct dso {
 	struct list_head node;
 	struct rb_root	 syms;
 	unsigned int	 sym_priv_size;
+	struct symbol    *(*find_symbol)(struct dso *, uint64_t ip);
 	char		 name[0];
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Display user/kernel differentiator
       [not found]             ` <new-submission>
                                 ` (158 preceding siblings ...)
  2009-06-05 13:21               ` [tip:perfcounters/core] perf report: Deal with maps tip-bot for Peter Zijlstra
@ 2009-06-05 13:22               ` tip-bot for Ingo Molnar
  2009-06-05 13:33               ` [tip:perfcounters/core] perf record/top: Clarify events/samples naming tip-bot for Ingo Molnar
                                 ` (547 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  8edd4286f99f78fe07fe9196e69d5643da86cada
Gitweb:     http://git.kernel.org/tip/8edd4286f99f78fe07fe9196e69d5643da86cada
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 14:13:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:13:18 +0200

perf report: Display user/kernel differentiator

Before:

    25.96%  copy_user_generic_string
    15.23%  two_op
    15.19%  one_op
     6.92%  enough_duration
     1.23%  alloc_pages_current
     1.14%  acpi_os_read_port
     1.08%  _spin_lock

After:

    25.96%  [k] copy_user_generic_string
    15.23%  [.] two_op
    15.19%  [.] one_op
     6.92%  [.] enough_duration
     1.23%  [k] alloc_pages_current
     1.14%  [k] acpi_os_read_port
     1.08%  [k] _spin_lock

The '[k]' differentiator is a quick clue that it's a kernel symbol,
without having to bring in the full dso column.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-report.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9783d1e..ca303fd 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -504,7 +504,7 @@ sort__comm_print(FILE *fp, struct hist_entry *self)
 }
 
 static struct sort_entry sort_comm = {
-	.header 	= "         Command",
+	.header		= "         Command",
 	.cmp		= sort__comm_cmp,
 	.collapse	= sort__comm_collapse,
 	.print		= sort__comm_print,
@@ -569,10 +569,12 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
 	if (verbose)
 		ret += fprintf(fp, "%#018llx  ", (__u64)self->ip);
 
-	if (self->sym)
-		ret += fprintf(fp, "%s", self->sym->name);
-	else
+	if (self->sym) {
+		ret += fprintf(fp, "[%c] %s",
+			self->dso == kernel_dso ? 'k' : '.', self->sym->name);
+	} else {
 		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
+	}
 
 	return ret;
 }
@@ -586,9 +588,9 @@ static struct sort_entry sort_sym = {
 static int sort__need_collapse = 0;
 
 struct sort_dimension {
-	char *name;
-	struct sort_entry *entry;
-	int taken;
+	char			*name;
+	struct sort_entry	*entry;
+	int			taken;
 };
 
 static struct sort_dimension sort_dimensions[] = {

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record/top: Clarify events/samples naming
       [not found]             ` <new-submission>
                                 ` (159 preceding siblings ...)
  2009-06-05 13:22               ` [tip:perfcounters/core] perf report: Display user/kernel differentiator tip-bot for Ingo Molnar
@ 2009-06-05 13:33               ` tip-bot for Ingo Molnar
  2009-06-05 13:42               ` [tip:perfcounters/core] perf_counter tools: " tip-bot for Ingo Molnar
                                 ` (546 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 13:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  6eb1642e07c0f84861971bcdd6f0e7236198b402
Gitweb:     http://git.kernel.org/tip/6eb1642e07c0f84861971bcdd6f0e7236198b402
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 14:29:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:29:10 +0200

perf record/top: Clarify events/samples naming

A number of places said 'events' while they should say 'samples'.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   22 ++++++------
 Documentation/perf_counter/builtin-top.c    |   46 +++++++++++++-------------
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index e2301f3..d4ad305 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -65,7 +65,7 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 	return head;
 }
 
-static long events;
+static long samples;
 static struct timeval last_read, this_read;
 
 static __u64 bytes_written;
@@ -83,7 +83,7 @@ static void mmap_read(struct mmap_data *md)
 
 	/*
 	 * If we're further behind than half the buffer, there's a chance
-	 * the writer will bite our tail and screw up the events under us.
+	 * the writer will bite our tail and mess up the samples under us.
 	 *
 	 * If we somehow ended up ahead of the head, we got messed up.
 	 *
@@ -109,7 +109,7 @@ static void mmap_read(struct mmap_data *md)
 	last_read = this_read;
 
 	if (old != head)
-		events++;
+		samples++;
 
 	size = head - old;
 
@@ -257,7 +257,7 @@ out_failure:
 	exit(EXIT_FAILURE);
 }
 
-static void pid_synthesize_mmap_events(pid_t pid)
+static void pid_synthesize_mmap_samples(pid_t pid)
 {
 	char filename[PATH_MAX];
 	FILE *fp;
@@ -315,7 +315,7 @@ static void pid_synthesize_mmap_events(pid_t pid)
 	fclose(fp);
 }
 
-static void synthesize_events(void)
+static void synthesize_samples(void)
 {
 	DIR *proc;
 	struct dirent dirent, *next;
@@ -331,7 +331,7 @@ static void synthesize_events(void)
 			continue;
 
 		pid_synthesize_comm_event(pid, 1);
-		pid_synthesize_mmap_events(pid);
+		pid_synthesize_mmap_samples(pid);
 	}
 
 	closedir(proc);
@@ -396,7 +396,7 @@ static void open_counters(int cpu, pid_t pid)
 
 	if (pid > 0) {
 		pid_synthesize_comm_event(pid, 0);
-		pid_synthesize_mmap_events(pid);
+		pid_synthesize_mmap_samples(pid);
 	}
 
 	group_fd = -1;
@@ -469,17 +469,17 @@ static int __cmd_record(int argc, const char **argv)
 	}
 
 	if (system_wide)
-		synthesize_events();
+		synthesize_samples();
 
 	while (!done) {
-		int hits = events;
+		int hits = samples;
 
 		for (i = 0; i < nr_cpu; i++) {
 			for (counter = 0; counter < nr_counters; counter++)
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (hits == events)
+		if (hits == samples)
 			ret = poll(event_array, nr_poll, 100);
 	}
 
@@ -487,7 +487,7 @@ static int __cmd_record(int argc, const char **argv)
 	 * Approximate RIP event size: 24 bytes.
 	 */
 	fprintf(stderr,
-		"[ perf record: Captured and wrote %.3f MB %s (~%lld events) ]\n",
+		"[ perf record: Captured and wrote %.3f MB %s (~%lld samples) ]\n",
 		(double)bytes_written / 1024.0 / 1024.0,
 		output_name,
 		bytes_written / 24);
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 2fee595..ff7e13c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -137,8 +137,8 @@ static double sym_weight(const struct sym_entry *sym)
 	return weight;
 }
 
-static long			events;
-static long			userspace_events;
+static long			samples;
+static long			userspace_samples;
 static const char		CONSOLE_CLEAR[] = "^[[H^[[2J";
 
 static void __list_insert_active_sym(struct sym_entry *syme)
@@ -177,14 +177,14 @@ static void print_sym_table(void)
 {
 	int printed = 0, j;
 	int counter;
-	float events_per_sec = events/delay_secs;
-	float kevents_per_sec = (events-userspace_events)/delay_secs;
-	float sum_kevents = 0.0;
+	float samples_per_sec = samples/delay_secs;
+	float ksamples_per_sec = (samples-userspace_samples)/delay_secs;
+	float sum_ksamples = 0.0;
 	struct sym_entry *syme, *n;
 	struct rb_root tmp = RB_ROOT;
 	struct rb_node *nd;
 
-	events = userspace_events = 0;
+	samples = userspace_samples = 0;
 
 	/* Sort the active symbols */
 	pthread_mutex_lock(&active_symbols_lock);
@@ -196,7 +196,7 @@ static void print_sym_table(void)
 		if (syme->snap_count != 0) {
 			syme->weight = sym_weight(syme);
 			rb_insert_active_sym(&tmp, syme);
-			sum_kevents += syme->snap_count;
+			sum_ksamples += syme->snap_count;
 
 			for (j = 0; j < nr_counters; j++)
 				syme->count[j] = zero ? 0 : syme->count[j] * 7 / 8;
@@ -209,8 +209,8 @@ static void print_sym_table(void)
 	printf(
 "------------------------------------------------------------------------------\n");
 	printf( "   PerfTop:%8.0f irqs/sec  kernel:%4.1f%% [",
-		events_per_sec,
-		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
+		samples_per_sec,
+		100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
 	if (nr_counters == 1) {
 		printf("%d", event_count[0]);
@@ -246,12 +246,12 @@ static void print_sym_table(void)
 	printf("------------------------------------------------------------------------------\n\n");
 
 	if (nr_counters == 1)
-		printf("             events    pcnt");
+		printf("             samples    pcnt");
 	else
-		printf("  weight     events    pcnt");
+		printf("  weight     samples    pcnt");
 
 	printf("         RIP          kernel function\n"
-	       	       "  ______     ______   _____   ________________   _______________\n\n"
+	       	       "  ______     _______   _____   ________________   _______________\n\n"
 	);
 
 	for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
@@ -263,8 +263,8 @@ static void print_sym_table(void)
 		if (++printed > print_entries || syme->snap_count < count_filter)
 			continue;
 
-		pcnt = 100.0 - (100.0 * ((sum_kevents - syme->snap_count) /
-					 sum_kevents));
+		pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
+					 sum_ksamples));
 
 		/*
 		 * We color high-overhead entries in red, low-overhead
@@ -276,9 +276,9 @@ static void print_sym_table(void)
 			color = PERF_COLOR_GREEN;
 
 		if (nr_counters == 1)
-			printf("%19.2f - ", syme->weight);
+			printf("%20.2f - ", syme->weight);
 		else
-			printf("%8.1f %10ld - ", syme->weight, syme->snap_count);
+			printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
 
 		color_fprintf(stdout, color, "%4.1f%%", pcnt);
 		printf(" - %016llx : %s\n", sym->start, sym->name);
@@ -318,7 +318,7 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
 		return 1;
 
 	syme = dso__sym_priv(self, sym);
-	/* Tag events to be skipped. */
+	/* Tag samples to be skipped. */
 	if (!strcmp("default_idle", name) ||
 	    !strcmp("cpu_idle", name) ||
 	    !strcmp("enter_idle", name) ||
@@ -405,15 +405,15 @@ static void record_ip(uint64_t ip, int counter)
 		}
 	}
 
-	events--;
+	samples--;
 }
 
 static void process_event(uint64_t ip, int counter)
 {
-	events++;
+	samples++;
 
 	if (ip < min_ip || ip > max_ip) {
-		userspace_events++;
+		userspace_samples++;
 		return;
 	}
 
@@ -451,7 +451,7 @@ static void mmap_read(struct mmap_data *md)
 
 	/*
 	 * If we're further behind than half the buffer, there's a chance
-	 * the writer will bite our tail and screw up the events under us.
+	 * the writer will bite our tail and mess up the samples under us.
 	 *
 	 * If we somehow ended up ahead of the head, we got messed up.
 	 *
@@ -608,14 +608,14 @@ static int __cmd_top(void)
 	}
 
 	while (1) {
-		int hits = events;
+		int hits = samples;
 
 		for (i = 0; i < nr_cpus; i++) {
 			for (counter = 0; counter < nr_counters; counter++)
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (hits == events)
+		if (hits == samples)
 			ret = poll(event_array, nr_poll, 100);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Clarify events/samples naming
       [not found]             ` <new-submission>
                                 ` (160 preceding siblings ...)
  2009-06-05 13:33               ` [tip:perfcounters/core] perf record/top: Clarify events/samples naming tip-bot for Ingo Molnar
@ 2009-06-05 13:42               ` tip-bot for Ingo Molnar
  2009-06-05 16:01               ` [tip:perfcounters/core] perf_counter tools: Remove -march=native tip-bot for Ingo Molnar
                                 ` (545 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 13:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  2debbc836696f2a815d02630230584a1754a5022
Gitweb:     http://git.kernel.org/tip/2debbc836696f2a815d02630230584a1754a5022
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 14:29:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 14:32:19 +0200

perf_counter tools: Clarify events/samples naming

A number of places said 'events' while they should say 'samples'.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |   22 ++++++------
 Documentation/perf_counter/builtin-report.c |    2 +-
 Documentation/perf_counter/builtin-top.c    |   46 +++++++++++++-------------
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index e2301f3..d4ad305 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -65,7 +65,7 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 	return head;
 }
 
-static long events;
+static long samples;
 static struct timeval last_read, this_read;
 
 static __u64 bytes_written;
@@ -83,7 +83,7 @@ static void mmap_read(struct mmap_data *md)
 
 	/*
 	 * If we're further behind than half the buffer, there's a chance
-	 * the writer will bite our tail and screw up the events under us.
+	 * the writer will bite our tail and mess up the samples under us.
 	 *
 	 * If we somehow ended up ahead of the head, we got messed up.
 	 *
@@ -109,7 +109,7 @@ static void mmap_read(struct mmap_data *md)
 	last_read = this_read;
 
 	if (old != head)
-		events++;
+		samples++;
 
 	size = head - old;
 
@@ -257,7 +257,7 @@ out_failure:
 	exit(EXIT_FAILURE);
 }
 
-static void pid_synthesize_mmap_events(pid_t pid)
+static void pid_synthesize_mmap_samples(pid_t pid)
 {
 	char filename[PATH_MAX];
 	FILE *fp;
@@ -315,7 +315,7 @@ static void pid_synthesize_mmap_events(pid_t pid)
 	fclose(fp);
 }
 
-static void synthesize_events(void)
+static void synthesize_samples(void)
 {
 	DIR *proc;
 	struct dirent dirent, *next;
@@ -331,7 +331,7 @@ static void synthesize_events(void)
 			continue;
 
 		pid_synthesize_comm_event(pid, 1);
-		pid_synthesize_mmap_events(pid);
+		pid_synthesize_mmap_samples(pid);
 	}
 
 	closedir(proc);
@@ -396,7 +396,7 @@ static void open_counters(int cpu, pid_t pid)
 
 	if (pid > 0) {
 		pid_synthesize_comm_event(pid, 0);
-		pid_synthesize_mmap_events(pid);
+		pid_synthesize_mmap_samples(pid);
 	}
 
 	group_fd = -1;
@@ -469,17 +469,17 @@ static int __cmd_record(int argc, const char **argv)
 	}
 
 	if (system_wide)
-		synthesize_events();
+		synthesize_samples();
 
 	while (!done) {
-		int hits = events;
+		int hits = samples;
 
 		for (i = 0; i < nr_cpu; i++) {
 			for (counter = 0; counter < nr_counters; counter++)
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (hits == events)
+		if (hits == samples)
 			ret = poll(event_array, nr_poll, 100);
 	}
 
@@ -487,7 +487,7 @@ static int __cmd_record(int argc, const char **argv)
 	 * Approximate RIP event size: 24 bytes.
 	 */
 	fprintf(stderr,
-		"[ perf record: Captured and wrote %.3f MB %s (~%lld events) ]\n",
+		"[ perf record: Captured and wrote %.3f MB %s (~%lld samples) ]\n",
 		(double)bytes_written / 1024.0 / 1024.0,
 		output_name,
 		bytes_written / 24);
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index ca303fd..5af105c 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -857,7 +857,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
 
 	fprintf(fp, "\n");
 	fprintf(fp, "#\n");
-	fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples);
+	fprintf(fp, "# (%Ld samples)\n", (__u64)total_samples);
 	fprintf(fp, "#\n");
 
 	fprintf(fp, "# Overhead");
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 2fee595..ff7e13c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -137,8 +137,8 @@ static double sym_weight(const struct sym_entry *sym)
 	return weight;
 }
 
-static long			events;
-static long			userspace_events;
+static long			samples;
+static long			userspace_samples;
 static const char		CONSOLE_CLEAR[] = "^[[H^[[2J";
 
 static void __list_insert_active_sym(struct sym_entry *syme)
@@ -177,14 +177,14 @@ static void print_sym_table(void)
 {
 	int printed = 0, j;
 	int counter;
-	float events_per_sec = events/delay_secs;
-	float kevents_per_sec = (events-userspace_events)/delay_secs;
-	float sum_kevents = 0.0;
+	float samples_per_sec = samples/delay_secs;
+	float ksamples_per_sec = (samples-userspace_samples)/delay_secs;
+	float sum_ksamples = 0.0;
 	struct sym_entry *syme, *n;
 	struct rb_root tmp = RB_ROOT;
 	struct rb_node *nd;
 
-	events = userspace_events = 0;
+	samples = userspace_samples = 0;
 
 	/* Sort the active symbols */
 	pthread_mutex_lock(&active_symbols_lock);
@@ -196,7 +196,7 @@ static void print_sym_table(void)
 		if (syme->snap_count != 0) {
 			syme->weight = sym_weight(syme);
 			rb_insert_active_sym(&tmp, syme);
-			sum_kevents += syme->snap_count;
+			sum_ksamples += syme->snap_count;
 
 			for (j = 0; j < nr_counters; j++)
 				syme->count[j] = zero ? 0 : syme->count[j] * 7 / 8;
@@ -209,8 +209,8 @@ static void print_sym_table(void)
 	printf(
 "------------------------------------------------------------------------------\n");
 	printf( "   PerfTop:%8.0f irqs/sec  kernel:%4.1f%% [",
-		events_per_sec,
-		100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
+		samples_per_sec,
+		100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
 	if (nr_counters == 1) {
 		printf("%d", event_count[0]);
@@ -246,12 +246,12 @@ static void print_sym_table(void)
 	printf("------------------------------------------------------------------------------\n\n");
 
 	if (nr_counters == 1)
-		printf("             events    pcnt");
+		printf("             samples    pcnt");
 	else
-		printf("  weight     events    pcnt");
+		printf("  weight     samples    pcnt");
 
 	printf("         RIP          kernel function\n"
-	       	       "  ______     ______   _____   ________________   _______________\n\n"
+	       	       "  ______     _______   _____   ________________   _______________\n\n"
 	);
 
 	for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
@@ -263,8 +263,8 @@ static void print_sym_table(void)
 		if (++printed > print_entries || syme->snap_count < count_filter)
 			continue;
 
-		pcnt = 100.0 - (100.0 * ((sum_kevents - syme->snap_count) /
-					 sum_kevents));
+		pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
+					 sum_ksamples));
 
 		/*
 		 * We color high-overhead entries in red, low-overhead
@@ -276,9 +276,9 @@ static void print_sym_table(void)
 			color = PERF_COLOR_GREEN;
 
 		if (nr_counters == 1)
-			printf("%19.2f - ", syme->weight);
+			printf("%20.2f - ", syme->weight);
 		else
-			printf("%8.1f %10ld - ", syme->weight, syme->snap_count);
+			printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
 
 		color_fprintf(stdout, color, "%4.1f%%", pcnt);
 		printf(" - %016llx : %s\n", sym->start, sym->name);
@@ -318,7 +318,7 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
 		return 1;
 
 	syme = dso__sym_priv(self, sym);
-	/* Tag events to be skipped. */
+	/* Tag samples to be skipped. */
 	if (!strcmp("default_idle", name) ||
 	    !strcmp("cpu_idle", name) ||
 	    !strcmp("enter_idle", name) ||
@@ -405,15 +405,15 @@ static void record_ip(uint64_t ip, int counter)
 		}
 	}
 
-	events--;
+	samples--;
 }
 
 static void process_event(uint64_t ip, int counter)
 {
-	events++;
+	samples++;
 
 	if (ip < min_ip || ip > max_ip) {
-		userspace_events++;
+		userspace_samples++;
 		return;
 	}
 
@@ -451,7 +451,7 @@ static void mmap_read(struct mmap_data *md)
 
 	/*
 	 * If we're further behind than half the buffer, there's a chance
-	 * the writer will bite our tail and screw up the events under us.
+	 * the writer will bite our tail and mess up the samples under us.
 	 *
 	 * If we somehow ended up ahead of the head, we got messed up.
 	 *
@@ -608,14 +608,14 @@ static int __cmd_top(void)
 	}
 
 	while (1) {
-		int hits = events;
+		int hits = samples;
 
 		for (i = 0; i < nr_cpus; i++) {
 			for (counter = 0; counter < nr_counters; counter++)
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (hits == events)
+		if (hits == samples)
 			ret = poll(event_array, nr_poll, 100);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf report: Deal with maps
  2009-06-05 13:21               ` [tip:perfcounters/core] perf report: Deal with maps tip-bot for Peter Zijlstra
@ 2009-06-05 13:57                 ` Arnaldo Carvalho de Melo
  2009-06-05 14:06                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-06-05 13:57 UTC (permalink / raw)
  To: mingo, hpa, paulus, linux-kernel, a.p.zijlstra, efault, tglx,
	mingo

Em Fri, Jun 05, 2009 at 01:21:54PM +0000, tip-bot for Peter Zijlstra escreveu:
> Commit-ID:  fc54db5105d01ad691a7d747064c7890e17f936c
> Gitweb:     http://git.kernel.org/tip/fc54db5105d01ad691a7d747064c7890e17f936c
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Fri, 5 Jun 2009 14:04:59 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 5 Jun 2009 14:46:41 +0200
> 
> perf report: Deal with maps
> 
> In order to deal with [vdso] maps generalize the ip->symbol path
> a bit and allow to override some bits with custom functions.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  Documentation/perf_counter/builtin-report.c |   37 +++++++++++++++++++++++++-
>  Documentation/perf_counter/util/symbol.c    |    1 +
>  Documentation/perf_counter/util/symbol.h    |    1 +
>  3 files changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
> index eb5424f..9783d1e 100644
> --- a/Documentation/perf_counter/builtin-report.c
> +++ b/Documentation/perf_counter/builtin-report.c
> @@ -79,6 +79,7 @@ typedef union event_union {
>  
>  static LIST_HEAD(dsos);
>  static struct dso *kernel_dso;
> +static struct dso *vdso;
>  
>  static void dsos__add(struct dso *dso)
>  {
> @@ -136,6 +137,11 @@ static void dsos__fprintf(FILE *fp)
>  		dso__fprintf(pos, fp);
>  }
>  
> +static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
> +{
> +	return dso__find_symbol(kernel_dso, ip);
> +}

Cut'n'paste error? s/kernel_dso/vdso/g

- Arnaldo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf report: Deal with maps
  2009-06-05 13:57                 ` Arnaldo Carvalho de Melo
@ 2009-06-05 14:06                   ` Peter Zijlstra
  2009-06-05 15:02                     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-05 14:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: mingo, hpa, paulus, linux-kernel, efault, tglx, mingo

On Fri, 2009-06-05 at 10:57 -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 05, 2009 at 01:21:54PM +0000, tip-bot for Peter Zijlstra escreveu:
> > Commit-ID:  fc54db5105d01ad691a7d747064c7890e17f936c
> > Gitweb:     http://git.kernel.org/tip/fc54db5105d01ad691a7d747064c7890e17f936c
> > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > AuthorDate: Fri, 5 Jun 2009 14:04:59 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Fri, 5 Jun 2009 14:46:41 +0200
> > 
> > perf report: Deal with maps
> > 
> > In order to deal with [vdso] maps generalize the ip->symbol path
> > a bit and allow to override some bits with custom functions.
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Mike Galbraith <efault@gmx.de>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  Documentation/perf_counter/builtin-report.c |   37 +++++++++++++++++++++++++-
> >  Documentation/perf_counter/util/symbol.c    |    1 +
> >  Documentation/perf_counter/util/symbol.h    |    1 +
> >  3 files changed, 37 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
> > index eb5424f..9783d1e 100644
> > --- a/Documentation/perf_counter/builtin-report.c
> > +++ b/Documentation/perf_counter/builtin-report.c
> > @@ -79,6 +79,7 @@ typedef union event_union {
> >  
> >  static LIST_HEAD(dsos);
> >  static struct dso *kernel_dso;
> > +static struct dso *vdso;
> >  
> >  static void dsos__add(struct dso *dso)
> >  {
> > @@ -136,6 +137,11 @@ static void dsos__fprintf(FILE *fp)
> >  		dso__fprintf(pos, fp);
> >  }
> >  
> > +static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
> > +{
> > +	return dso__find_symbol(kernel_dso, ip);
> > +}
> 
> Cut'n'paste error? s/kernel_dso/vdso/g

Ah, no, intentional cheating ;-)

the kernel dso includes the vdso symbols



^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf report: Deal with maps
  2009-06-05 14:06                   ` Peter Zijlstra
@ 2009-06-05 15:02                     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 1149+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-06-05 15:02 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, hpa, paulus, linux-kernel, efault, Thomas Gleixner

Em Fri, Jun 05, 2009 at 04:06:24PM +0200, Peter Zijlstra escreveu:
> On Fri, 2009-06-05 at 10:57 -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Jun 05, 2009 at 01:21:54PM +0000, tip-bot for Peter Zijlstra escreveu:
> > > Commit-ID:  fc54db5105d01ad691a7d747064c7890e17f936c
> > > Gitweb:     http://git.kernel.org/tip/fc54db5105d01ad691a7d747064c7890e17f936c
> > > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > AuthorDate: Fri, 5 Jun 2009 14:04:59 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Fri, 5 Jun 2009 14:46:41 +0200
> > > 
> > > perf report: Deal with maps
> > > 
> > > In order to deal with [vdso] maps generalize the ip->symbol path
> > > a bit and allow to override some bits with custom functions.
> > > 
> > > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > Cc: Mike Galbraith <efault@gmx.de>
> > > Cc: Paul Mackerras <paulus@samba.org>
> > > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > LKML-Reference: <new-submission>
> > > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > > 
> > > 
> > > ---
> > >  Documentation/perf_counter/builtin-report.c |   37 +++++++++++++++++++++++++-
> > >  Documentation/perf_counter/util/symbol.c    |    1 +
> > >  Documentation/perf_counter/util/symbol.h    |    1 +
> > >  3 files changed, 37 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
> > > index eb5424f..9783d1e 100644
> > > --- a/Documentation/perf_counter/builtin-report.c
> > > +++ b/Documentation/perf_counter/builtin-report.c
> > > @@ -79,6 +79,7 @@ typedef union event_union {
> > >  
> > >  static LIST_HEAD(dsos);
> > >  static struct dso *kernel_dso;
> > > +static struct dso *vdso;
> > >  
> > >  static void dsos__add(struct dso *dso)
> > >  {
> > > @@ -136,6 +137,11 @@ static void dsos__fprintf(FILE *fp)
> > >  		dso__fprintf(pos, fp);
> > >  }
> > >  
> > > +static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
> > > +{
> > > +	return dso__find_symbol(kernel_dso, ip);
> > > +}
> > 
> > Cut'n'paste error? s/kernel_dso/vdso/g
> 
> Ah, no, intentional cheating ;-)
> 
> the kernel dso includes the vdso symbols

OK, a comment would be nice then, will add it if you don't do it first :)

- Arnaldo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Remove -march=native
       [not found]             ` <new-submission>
                                 ` (161 preceding siblings ...)
  2009-06-05 13:42               ` [tip:perfcounters/core] perf_counter tools: " tip-bot for Ingo Molnar
@ 2009-06-05 16:01               ` tip-bot for Ingo Molnar
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Change PERF_SAMPLE_CONFIG into PERF_SAMPLE_ID tip-bot for Peter Zijlstra
                                 ` (544 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 16:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	rostedt, tglx, mingo

Commit-ID:  136107a76fe5f62906162f730834477b71cf131e
Gitweb:     http://git.kernel.org/tip/136107a76fe5f62906162f730834477b71cf131e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 17:56:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 17:56:21 +0200

perf_counter tools: Remove -march=native

Turns out that neither PowerPC nor older x86 compilers know this switch
..

and since it does not make a measurable difference, just omit it.

Reported-by: Paul Mackerras <paulus@samba.org>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index c9ec458..5b99f04 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -159,7 +159,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6 -march=native
+CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6
 LDFLAGS = -lpthread -lrt -lelf
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Change PERF_SAMPLE_CONFIG into PERF_SAMPLE_ID
       [not found]             ` <new-submission>
                                 ` (162 preceding siblings ...)
  2009-06-05 16:01               ` [tip:perfcounters/core] perf_counter tools: Remove -march=native tip-bot for Ingo Molnar
@ 2009-06-05 16:57               ` tip-bot for Peter Zijlstra
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Add PERF_SAMPLE_PERIOD tip-bot for Peter Zijlstra
                                 ` (543 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 16:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  ac4bcf889469ffbca88f234d3184452886a47905
Gitweb:     http://git.kernel.org/tip/ac4bcf889469ffbca88f234d3184452886a47905
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 14:44:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 18:07:47 +0200

perf_counter: Change PERF_SAMPLE_CONFIG into PERF_SAMPLE_ID

The purpose of PERF_SAMPLE_CONFIG was to identify the counters,
since then we've added counter ids, use those instead.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 +-
 kernel/perf_counter.c        |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 40dc0e2..9cea32a 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -104,7 +104,7 @@ enum perf_counter_sample_format {
 	PERF_SAMPLE_ADDR		= 1U << 3,
 	PERF_SAMPLE_GROUP		= 1U << 4,
 	PERF_SAMPLE_CALLCHAIN		= 1U << 5,
-	PERF_SAMPLE_CONFIG		= 1U << 6,
+	PERF_SAMPLE_ID			= 1U << 6,
 	PERF_SAMPLE_CPU			= 1U << 7,
 };
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 37a5a24..e75b91a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2392,8 +2392,8 @@ static void perf_counter_output(struct perf_counter *counter,
 		header.size += sizeof(u64);
 	}
 
-	if (sample_type & PERF_SAMPLE_CONFIG) {
-		header.type |= PERF_SAMPLE_CONFIG;
+	if (sample_type & PERF_SAMPLE_ID) {
+		header.type |= PERF_SAMPLE_ID;
 		header.size += sizeof(u64);
 	}
 
@@ -2439,8 +2439,8 @@ static void perf_counter_output(struct perf_counter *counter,
 	if (sample_type & PERF_SAMPLE_ADDR)
 		perf_output_put(&handle, addr);
 
-	if (sample_type & PERF_SAMPLE_CONFIG)
-		perf_output_put(&handle, counter->attr.config);
+	if (sample_type & PERF_SAMPLE_ID)
+		perf_output_put(&handle, counter->id);
 
 	if (sample_type & PERF_SAMPLE_CPU)
 		perf_output_put(&handle, cpu_entry);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add PERF_SAMPLE_PERIOD
       [not found]             ` <new-submission>
                                 ` (163 preceding siblings ...)
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Change PERF_SAMPLE_CONFIG into PERF_SAMPLE_ID tip-bot for Peter Zijlstra
@ 2009-06-05 16:57               ` tip-bot for Peter Zijlstra
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Fix frequency adjustment for < HZ tip-bot for Peter Zijlstra
                                 ` (542 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 16:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  689802b2d0536e72281dc959ab9cb34fb3c304cf
Gitweb:     http://git.kernel.org/tip/689802b2d0536e72281dc959ab9cb34fb3c304cf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 15:05:43 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 18:07:47 +0200

perf_counter: Add PERF_SAMPLE_PERIOD

In order to allow easy tracking of the period, also provide means of
adding it to the sample data.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    2 ++
 kernel/perf_counter.c        |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 9cea32a..6bc2500 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -106,6 +106,7 @@ enum perf_counter_sample_format {
 	PERF_SAMPLE_CALLCHAIN		= 1U << 5,
 	PERF_SAMPLE_ID			= 1U << 6,
 	PERF_SAMPLE_CPU			= 1U << 7,
+	PERF_SAMPLE_PERIOD		= 1U << 8,
 };
 
 /*
@@ -260,6 +261,7 @@ enum perf_event_type {
 	 * struct {
 	 *	struct perf_event_header	header;
 	 *	u64				time;
+	 *	u64				id;
 	 *	u64				sample_period;
 	 * };
 	 */
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index e75b91a..f839066 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2404,6 +2404,11 @@ static void perf_counter_output(struct perf_counter *counter,
 		cpu_entry.cpu = raw_smp_processor_id();
 	}
 
+	if (sample_type & PERF_SAMPLE_PERIOD) {
+		header.type |= PERF_SAMPLE_PERIOD;
+		header.size += sizeof(u64);
+	}
+
 	if (sample_type & PERF_SAMPLE_GROUP) {
 		header.type |= PERF_SAMPLE_GROUP;
 		header.size += sizeof(u64) +
@@ -2445,6 +2450,9 @@ static void perf_counter_output(struct perf_counter *counter,
 	if (sample_type & PERF_SAMPLE_CPU)
 		perf_output_put(&handle, cpu_entry);
 
+	if (sample_type & PERF_SAMPLE_PERIOD)
+		perf_output_put(&handle, counter->hw.sample_period);
+
 	/*
 	 * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult.
 	 */
@@ -2835,6 +2843,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period)
 	struct {
 		struct perf_event_header	header;
 		u64				time;
+		u64				id;
 		u64				period;
 	} freq_event = {
 		.header = {
@@ -2843,6 +2852,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period)
 			.size = sizeof(freq_event),
 		},
 		.time = sched_clock(),
+		.id = counter->id,
 		.period = period,
 	};
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix frequency adjustment for < HZ
       [not found]             ` <new-submission>
                                 ` (164 preceding siblings ...)
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Add PERF_SAMPLE_PERIOD tip-bot for Peter Zijlstra
@ 2009-06-05 16:57               ` tip-bot for Peter Zijlstra
  2009-06-05 17:12               ` [tip:perfcounters/core] perf_counter tools: Sample and display frequency adjustment changes tip-bot for Ingo Molnar
                                 ` (541 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-05 16:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  6a24ed6c6082ec65d19331a4bfa30c0512a1a822
Gitweb:     http://git.kernel.org/tip/6a24ed6c6082ec65d19331a4bfa30c0512a1a822
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 5 Jun 2009 18:01:29 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 18:07:48 +0200

perf_counter: Fix frequency adjustment for < HZ

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    3 +++
 kernel/perf_counter.c        |   32 +++++++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6bc2500..4f9d39e 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -373,6 +373,9 @@ struct hw_perf_counter {
 	u64				sample_period;
 	atomic64_t			period_left;
 	u64				interrupts;
+
+	u64				freq_count;
+	u64				freq_interrupts;
 #endif
 };
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index f839066..47c92fb 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1187,8 +1187,9 @@ static void perf_log_period(struct perf_counter *counter, u64 period);
 static void perf_adjust_freq(struct perf_counter_context *ctx)
 {
 	struct perf_counter *counter;
+	struct hw_perf_counter *hwc;
 	u64 interrupts, sample_period;
-	u64 events, period;
+	u64 events, period, freq;
 	s64 delta;
 
 	spin_lock(&ctx->lock);
@@ -1196,8 +1197,10 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 		if (counter->state != PERF_COUNTER_STATE_ACTIVE)
 			continue;
 
-		interrupts = counter->hw.interrupts;
-		counter->hw.interrupts = 0;
+		hwc = &counter->hw;
+
+		interrupts = hwc->interrupts;
+		hwc->interrupts = 0;
 
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(counter, 1);
@@ -1208,20 +1211,35 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 		if (!counter->attr.freq || !counter->attr.sample_freq)
 			continue;
 
-		events = HZ * interrupts * counter->hw.sample_period;
+		if (counter->attr.sample_freq < HZ) {
+			freq = counter->attr.sample_freq;
+
+			hwc->freq_count += freq;
+			hwc->freq_interrupts += interrupts;
+
+			if (hwc->freq_count < HZ)
+				continue;
+
+			interrupts = hwc->freq_interrupts;
+			hwc->freq_interrupts = 0;
+			hwc->freq_count -= HZ;
+		} else
+			freq = HZ;
+
+		events = freq * interrupts * hwc->sample_period;
 		period = div64_u64(events, counter->attr.sample_freq);
 
-		delta = (s64)(1 + period - counter->hw.sample_period);
+		delta = (s64)(1 + period - hwc->sample_period);
 		delta >>= 1;
 
-		sample_period = counter->hw.sample_period + delta;
+		sample_period = hwc->sample_period + delta;
 
 		if (!sample_period)
 			sample_period = 1;
 
 		perf_log_period(counter, sample_period);
 
-		counter->hw.sample_period = sample_period;
+		hwc->sample_period = sample_period;
 	}
 	spin_unlock(&ctx->lock);
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Sample and display frequency adjustment changes
       [not found]             ` <new-submission>
                                 ` (165 preceding siblings ...)
  2009-06-05 16:57               ` [tip:perfcounters/core] perf_counter: Fix frequency adjustment for < HZ tip-bot for Peter Zijlstra
@ 2009-06-05 17:12               ` tip-bot for Ingo Molnar
  2009-06-05 18:46               ` [tip:perfcounters/core] perf record: Set frequency correctly tip-bot for Ingo Molnar
                                 ` (540 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 17:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  b2fef0762fdb65cf8702eea93f4e58abeb0ecefc
Gitweb:     http://git.kernel.org/tip/b2fef0762fdb65cf8702eea93f4e58abeb0ecefc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 18:07:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 18:07:51 +0200

perf_counter tools: Sample and display frequency adjustment changes

To allow the debugging of frequency-adjusting counters, sample
those adjustments and display them in perf report -D.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    2 +-
 Documentation/perf_counter/builtin-report.c |   39 ++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index d4ad305..43ddab3 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -347,7 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	memset(&attr, 0, sizeof(attr));
 	attr.config		= event_id[counter];
 	attr.sample_period	= event_count[counter];
-	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
 	attr.freq		= freq;
 	attr.mmap		= track;
 	attr.comm		= track;
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 5af105c..242e09f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -69,12 +69,20 @@ struct fork_event {
 	__u32 pid, ppid;
 };
 
-typedef union event_union {
+struct period_event {
 	struct perf_event_header header;
-	struct ip_event ip;
-	struct mmap_event mmap;
-	struct comm_event comm;
-	struct fork_event fork;
+	__u64 time;
+	__u64 id;
+	__u64 sample_period;
+};
+
+typedef union event_union {
+	struct perf_event_header	header;
+	struct ip_event			ip;
+	struct mmap_event		mmap;
+	struct comm_event		comm;
+	struct fork_event		fork;
+	struct period_event		period;
 } event_t;
 
 static LIST_HEAD(dsos);
@@ -1053,6 +1061,19 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
 }
 
 static int
+process_period_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	dprintf("%p [%p]: PERF_EVENT_PERIOD: time:%Ld, id:%Ld: period:%Ld\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->period.time,
+		event->period.id,
+		event->period.sample_period);
+
+	return 0;
+}
+
+static int
 process_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
@@ -1068,11 +1089,12 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	case PERF_EVENT_FORK:
 		return process_fork_event(event, offset, head);
 
+	case PERF_EVENT_PERIOD:
+		return process_period_event(event, offset, head);
 	/*
 	 * We dont process them right now but they are fine:
 	 */
 
-	case PERF_EVENT_PERIOD:
 	case PERF_EVENT_THROTTLE:
 	case PERF_EVENT_UNTHROTTLE:
 		return 0;
@@ -1157,6 +1179,11 @@ more:
 
 	size = event->header.size;
 
+	dprintf("%p [%p]: event: %d\n",
+			(void *)(offset + head),
+			(void *)(long)event->header.size,
+			event->header.type);
+
 	if (!size || process_event(event, offset, head) < 0) {
 
 		dprintf("%p [%p]: skipping unknown header type: %d\n",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Build with native optimization
  2009-06-05  1:03                 ` Paul Mackerras
@ 2009-06-05 18:42                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-05 18:42 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: mingo, hpa, acme, linux-kernel, a.p.zijlstra, efault, mtosatti,
	tglx, cjashfor


* Paul Mackerras <paulus@samba.org> wrote:

> tip-bot for Ingo Molnar writes:
> 
> > perf_counter tools: Build with native optimization
> > 
> > Build the tools with -march=native by default.
> 
> On powerpc (RHEL5.2 on POWER5+, gcc 4.1.2), I get:
> 
>     CC perf.o
> cc1: error: unrecognized command line option "-march=native"
> make: *** [perf.o] Error 1

ok, i removed that.

> Is there a way to make the default CFLAGS depend on the architecture?
> We need -m64 on powerpc as well.

Would be nice to add a Makefile rule to add -m64 on all 64-bit 
architectures. That would avoid having to do PowerPC-specific magic.

(But, PowerPC-specific rules would be fine too, of course.)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Set frequency correctly
       [not found]             ` <new-submission>
                                 ` (166 preceding siblings ...)
  2009-06-05 17:12               ` [tip:perfcounters/core] perf_counter tools: Sample and display frequency adjustment changes tip-bot for Ingo Molnar
@ 2009-06-05 18:46               ` tip-bot for Ingo Molnar
  2009-06-06  9:46               ` [tip:perfcounters/core] perf_counter: Separate out attr->type from attr->config tip-bot for Ingo Molnar
                                 ` (539 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-05 18:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  1dba15e74aba5a90c1f2557f37e5d09f8a2df643
Gitweb:     http://git.kernel.org/tip/1dba15e74aba5a90c1f2557f37e5d09f8a2df643
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 18:37:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 18:37:22 +0200

perf record: Set frequency correctly

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index 43ddab3..c22ea0c 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -348,7 +348,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	attr.config		= event_id[counter];
 	attr.sample_period	= event_count[counter];
 	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
-	attr.freq		= freq;
+	if (freq) {
+		attr.freq		= 1;
+		attr.sample_freq	= freq;
+	}
 	attr.mmap		= track;
 	attr.comm		= track;
 	attr.inherit		= (cpu < 0) && inherit;
@@ -544,10 +547,6 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 		event_id[0] = 0;
 	}
 
-	if (freq) {
-		default_interval = freq;
-		freq = 1;
-	}
 	for (counter = 0; counter < nr_counters; counter++) {
 		if (event_count[counter])
 			continue;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Separate out attr->type from attr->config
       [not found]             ` <new-submission>
                                 ` (167 preceding siblings ...)
  2009-06-05 18:46               ` [tip:perfcounters/core] perf record: Set frequency correctly tip-bot for Ingo Molnar
@ 2009-06-06  9:46               ` tip-bot for Ingo Molnar
  2009-06-06 11:16               ` [tip:perfcounters/core] perf_counter: Implement generalized cache event types tip-bot for Ingo Molnar
                                 ` (538 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  a21ca2cac582886a3e95c8bb84ff7c52d4d15e54
Gitweb:     http://git.kernel.org/tip/a21ca2cac582886a3e95c8bb84ff7c52d4d15e54
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 09:58:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 11:37:22 +0200

perf_counter: Separate out attr->type from attr->config

Counter type is a frequently used value and we do a lot of
bit juggling by encoding and decoding it from attr->config.

Clean this up by creating a separate attr->type field.

Also clean up the various similarly complex user-space bits
all around counter attribute management.

The net improvement is significant, and it will be easier
to add a new major type (which is what triggered this cleanup).

(This changes the ABI, all tools are adapted.)
(PowerPC build-tested.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-record.c    |  105 +++++++++------------
 Documentation/perf_counter/builtin-stat.c      |   76 ++++++---------
 Documentation/perf_counter/builtin-top.c       |   67 +++++---------
 Documentation/perf_counter/perf.h              |    2 -
 Documentation/perf_counter/util/parse-events.c |  120 +++++++++++++-----------
 Documentation/perf_counter/util/parse-events.h |    7 +-
 arch/powerpc/kernel/perf_counter.c             |    6 +-
 arch/x86/kernel/cpu/perf_counter.c             |    8 +-
 include/linux/perf_counter.h                   |   65 +++----------
 kernel/perf_counter.c                          |   14 +--
 10 files changed, 196 insertions(+), 274 deletions(-)

diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index c22ea0c..130fd88 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -20,10 +20,10 @@
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a)-1)
 #define __ALIGN_MASK(x, mask)	(((x)+(mask))&~(mask))
 
-static long			default_interval = 100000;
-static long			event_count[MAX_COUNTERS];
-
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
+
+static long			default_interval		= 100000;
+
 static int			nr_cpus				= 0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			= 128;
@@ -38,22 +38,44 @@ static int			inherit				= 1;
 static int			force				= 0;
 static int			append_file			= 0;
 
-const unsigned int default_count[] = {
-	1000000,
-	1000000,
-	  10000,
-	  10000,
-	1000000,
-	  10000,
+static long			samples;
+static struct timeval		last_read;
+static struct timeval		this_read;
+
+static __u64			bytes_written;
+
+static struct pollfd		event_array[MAX_NR_CPUS * MAX_COUNTERS];
+
+static int			nr_poll;
+static int			nr_cpu;
+
+struct mmap_event {
+	struct perf_event_header	header;
+	__u32				pid;
+	__u32				tid;
+	__u64				start;
+	__u64				len;
+	__u64				pgoff;
+	char				filename[PATH_MAX];
+};
+
+struct comm_event {
+	struct perf_event_header	header;
+	__u32				pid;
+	__u32				tid;
+	char				comm[16];
 };
 
+
 struct mmap_data {
-	int counter;
-	void *base;
-	unsigned int mask;
-	unsigned int prev;
+	int			counter;
+	void			*base;
+	unsigned int		mask;
+	unsigned int		prev;
 };
 
+static struct mmap_data		mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
+
 static unsigned int mmap_read_head(struct mmap_data *md)
 {
 	struct perf_counter_mmap_page *pc = md->base;
@@ -65,11 +87,6 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 	return head;
 }
 
-static long samples;
-static struct timeval last_read, this_read;
-
-static __u64 bytes_written;
-
 static void mmap_read(struct mmap_data *md)
 {
 	unsigned int head = mmap_read_head(md);
@@ -157,29 +174,6 @@ static void sig_handler(int sig)
 	done = 1;
 }
 
-static struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
-static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
-
-static int nr_poll;
-static int nr_cpu;
-
-struct mmap_event {
-	struct perf_event_header	header;
-	__u32				pid;
-	__u32				tid;
-	__u64				start;
-	__u64				len;
-	__u64				pgoff;
-	char				filename[PATH_MAX];
-};
-
-struct comm_event {
-	struct perf_event_header	header;
-	__u32				pid;
-	__u32				tid;
-	char				comm[16];
-};
-
 static void pid_synthesize_comm_event(pid_t pid, int full)
 {
 	struct comm_event comm_ev;
@@ -341,24 +335,21 @@ static int group_fd;
 
 static void create_counter(int counter, int cpu, pid_t pid)
 {
-	struct perf_counter_attr attr;
+	struct perf_counter_attr *attr = attrs + counter;
 	int track = 1;
 
-	memset(&attr, 0, sizeof(attr));
-	attr.config		= event_id[counter];
-	attr.sample_period	= event_count[counter];
-	attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
+	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
 	if (freq) {
-		attr.freq		= 1;
-		attr.sample_freq	= freq;
+		attr->freq		= 1;
+		attr->sample_freq	= freq;
 	}
-	attr.mmap		= track;
-	attr.comm		= track;
-	attr.inherit		= (cpu < 0) && inherit;
+	attr->mmap		= track;
+	attr->comm		= track;
+	attr->inherit		= (cpu < 0) && inherit;
 
 	track = 0; /* only the first counter needs these */
 
-	fd[nr_cpu][counter] = sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
+	fd[nr_cpu][counter] = sys_perf_counter_open(attr, pid, cpu, group_fd, 0);
 
 	if (fd[nr_cpu][counter] < 0) {
 		int err = errno;
@@ -542,16 +533,14 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 	if (!argc && target_pid == -1 && !system_wide)
 		usage_with_options(record_usage, options);
 
-	if (!nr_counters) {
+	if (!nr_counters)
 		nr_counters = 1;
-		event_id[0] = 0;
-	}
 
 	for (counter = 0; counter < nr_counters; counter++) {
-		if (event_count[counter])
+		if (attrs[counter].sample_period)
 			continue;
 
-		event_count[counter] = default_interval;
+		attrs[counter].sample_period = default_interval;
 	}
 
 	return __cmd_record(argc, argv);
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 4fc0d80..9711e55 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -44,23 +44,22 @@
 
 #include <sys/prctl.h>
 
-static int			system_wide			=  0;
-static int			inherit				=  1;
+static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
 
-static __u64			default_event_id[MAX_COUNTERS]	= {
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),
+  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_TASK_CLOCK		},
+  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CONTEXT_SWITCHES	},
+  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CPU_MIGRATIONS	},
+  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_PAGE_FAULTS	},
 
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),
+  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CPU_CYCLES		},
+  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_INSTRUCTIONS	},
+  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_REFERENCES	},
+  { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_MISSES	},
 };
 
-static int			default_interval = 100000;
-static int			event_count[MAX_COUNTERS];
+static int			system_wide			=  0;
+static int			inherit				=  1;
+
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static int			target_pid			= -1;
@@ -86,22 +85,16 @@ static __u64			walltime_nsecs;
 
 static void create_perfstat_counter(int counter)
 {
-	struct perf_counter_attr attr;
-
-	memset(&attr, 0, sizeof(attr));
-	attr.config		= event_id[counter];
-	attr.sample_type	= 0;
-	attr.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
-	attr.exclude_user   = event_mask[counter] & EVENT_MASK_USER;
+	struct perf_counter_attr *attr = attrs + counter;
 
 	if (scale)
-		attr.read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
-					  PERF_FORMAT_TOTAL_TIME_RUNNING;
+		attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
+				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide) {
 		int cpu;
 		for (cpu = 0; cpu < nr_cpus; cpu ++) {
-			fd[cpu][counter] = sys_perf_counter_open(&attr, -1, cpu, -1, 0);
+			fd[cpu][counter] = sys_perf_counter_open(attr, -1, cpu, -1, 0);
 			if (fd[cpu][counter] < 0) {
 				printf("perfstat error: syscall returned with %d (%s)\n",
 						fd[cpu][counter], strerror(errno));
@@ -109,10 +102,10 @@ static void create_perfstat_counter(int counter)
 			}
 		}
 	} else {
-		attr.inherit	= inherit;
-		attr.disabled	= 1;
+		attr->inherit	= inherit;
+		attr->disabled	= 1;
 
-		fd[0][counter] = sys_perf_counter_open(&attr, 0, -1, -1, 0);
+		fd[0][counter] = sys_perf_counter_open(attr, 0, -1, -1, 0);
 		if (fd[0][counter] < 0) {
 			printf("perfstat error: syscall returned with %d (%s)\n",
 					fd[0][counter], strerror(errno));
@@ -126,9 +119,13 @@ static void create_perfstat_counter(int counter)
  */
 static inline int nsec_counter(int counter)
 {
-	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK))
+	if (attrs[counter].type != PERF_TYPE_SOFTWARE)
+		return 0;
+
+	if (attrs[counter].config == PERF_COUNT_CPU_CLOCK)
 		return 1;
-	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK))
+
+	if (attrs[counter].config == PERF_COUNT_TASK_CLOCK)
 		return 1;
 
 	return 0;
@@ -177,7 +174,8 @@ static void read_counter(int counter)
 	/*
 	 * Save the full runtime - to allow normalization during printout:
 	 */
-	if (event_id[counter] == EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK))
+	if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
+		attrs[counter].config == PERF_COUNT_TASK_CLOCK)
 		runtime_nsecs = count[0];
 }
 
@@ -203,8 +201,8 @@ static void print_counter(int counter)
 
 		fprintf(stderr, " %14.6f  %-20s",
 			msecs, event_name(counter));
-		if (event_id[counter] ==
-				EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK)) {
+		if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
+			attrs[counter].config == PERF_COUNT_TASK_CLOCK) {
 
 			fprintf(stderr, " # %11.3f CPU utilization factor",
 				(double)count[0] / (double)walltime_nsecs);
@@ -300,8 +298,6 @@ static char events_help_msg[EVENTS_HELP_MAX];
 static const struct option options[] = {
 	OPT_CALLBACK('e', "event", NULL, "event",
 		     events_help_msg, parse_events),
-	OPT_INTEGER('c', "count", &default_interval,
-		    "event period to sample"),
 	OPT_BOOLEAN('i', "inherit", &inherit,
 		    "child tasks inherit counters"),
 	OPT_INTEGER('p', "pid", &target_pid,
@@ -315,27 +311,19 @@ static const struct option options[] = {
 
 int cmd_stat(int argc, const char **argv, const char *prefix)
 {
-	int counter;
-
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	create_events_help(events_help_msg);
-	memcpy(event_id, default_event_id, sizeof(default_event_id));
+
+	memcpy(attrs, default_attrs, sizeof(attrs));
 
 	argc = parse_options(argc, argv, options, stat_usage, 0);
 	if (!argc)
 		usage_with_options(stat_usage, options);
 
-	if (!nr_counters) {
+	if (!nr_counters)
 		nr_counters = 8;
-	}
-
-	for (counter = 0; counter < nr_counters; counter++) {
-		if (event_count[counter])
-			continue;
 
-		event_count[counter] = default_interval;
-	}
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index b2f480b..98a6d53 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -48,22 +48,11 @@
 #include <linux/unistd.h>
 #include <linux/types.h>
 
-static int			system_wide			=  0;
+static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static __u64			default_event_id[MAX_COUNTERS]		= {
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),
-	EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),
+static int			system_wide			=  0;
 
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),
-	EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),
-};
-static int			default_interval = 100000;
-static int			event_count[MAX_COUNTERS];
-static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
+static int			default_interval		= 100000;
 
 static __u64			count_filter			=  5;
 static int			print_entries			= 15;
@@ -85,15 +74,6 @@ static int			delay_secs			=  2;
 static int			zero;
 static int			dump_symtab;
 
-static const unsigned int default_count[] = {
-	1000000,
-	1000000,
-	  10000,
-	  10000,
-	1000000,
-	  10000,
-};
-
 /*
  * Symbols
  */
@@ -112,7 +92,7 @@ struct sym_entry {
 
 struct sym_entry		*sym_filter_entry;
 
-struct dso *kernel_dso;
+struct dso			*kernel_dso;
 
 /*
  * Symbols will be added here in record_ip and will get out
@@ -213,7 +193,7 @@ static void print_sym_table(void)
 		100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
 	if (nr_counters == 1) {
-		printf("%d", event_count[0]);
+		printf("%Ld", attrs[0].sample_period);
 		if (freq)
 			printf("Hz ");
 		else
@@ -421,10 +401,10 @@ static void process_event(uint64_t ip, int counter)
 }
 
 struct mmap_data {
-	int counter;
-	void *base;
-	unsigned int mask;
-	unsigned int prev;
+	int			counter;
+	void			*base;
+	unsigned int		mask;
+	unsigned int		prev;
 };
 
 static unsigned int mmap_read_head(struct mmap_data *md)
@@ -539,7 +519,7 @@ static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 
 static int __cmd_top(void)
 {
-	struct perf_counter_attr attr;
+	struct perf_counter_attr *attr;
 	pthread_t thread;
 	int i, counter, group_fd, nr_poll = 0;
 	unsigned int cpu;
@@ -553,13 +533,12 @@ static int __cmd_top(void)
 			if (target_pid == -1 && profile_cpu == -1)
 				cpu = i;
 
-			memset(&attr, 0, sizeof(attr));
-			attr.config		= event_id[counter];
-			attr.sample_period	= event_count[counter];
-			attr.sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
-			attr.freq		= freq;
+			attr = attrs + counter;
 
-			fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
+			attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+			attr->freq		= freq;
+
+			fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
 			if (fd[i][counter] < 0) {
 				int err = errno;
 
@@ -670,7 +649,6 @@ int cmd_top(int argc, const char **argv, const char *prefix)
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	create_events_help(events_help_msg);
-	memcpy(event_id, default_event_id, sizeof(default_event_id));
 
 	argc = parse_options(argc, argv, options, top_usage, 0);
 	if (argc)
@@ -688,19 +666,22 @@ int cmd_top(int argc, const char **argv, const char *prefix)
 		profile_cpu = -1;
 	}
 
-	if (!nr_counters) {
+	if (!nr_counters)
 		nr_counters = 1;
-		event_id[0] = 0;
-	}
 
 	if (delay_secs < 1)
 		delay_secs = 1;
 
+	parse_symbols();
+
+	/*
+	 * Fill in the ones not specifically initialized via -c:
+	 */
 	for (counter = 0; counter < nr_counters; counter++) {
-		if (event_count[counter])
+		if (attrs[counter].sample_period)
 			continue;
 
-		event_count[counter] = default_interval;
+		attrs[counter].sample_period = default_interval;
 	}
 
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -710,7 +691,5 @@ int cmd_top(int argc, const char **argv, const char *prefix)
 	if (target_pid != -1 || profile_cpu != -1)
 		nr_cpus = 1;
 
-	parse_symbols();
-
 	return __cmd_top();
 }
diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h
index 10622a4..af0a504 100644
--- a/Documentation/perf_counter/perf.h
+++ b/Documentation/perf_counter/perf.h
@@ -64,6 +64,4 @@ sys_perf_counter_open(struct perf_counter_attr *attr_uptr,
 #define MAX_COUNTERS			256
 #define MAX_NR_CPUS			256
 
-#define EID(type, id) (((__u64)(type) << PERF_COUNTER_TYPE_SHIFT) | (id))
-
 #endif
diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c
index 2fdfd1d..eb56bd9 100644
--- a/Documentation/perf_counter/util/parse-events.c
+++ b/Documentation/perf_counter/util/parse-events.c
@@ -6,37 +6,39 @@
 #include "exec_cmd.h"
 #include "string.h"
 
-int nr_counters;
+int					nr_counters;
 
-__u64			event_id[MAX_COUNTERS]		= { };
-int			event_mask[MAX_COUNTERS];
+struct perf_counter_attr		attrs[MAX_COUNTERS];
 
 struct event_symbol {
-	__u64 event;
-	char *symbol;
+	__u8	type;
+	__u64	config;
+	char	*symbol;
 };
 
+#define C(x, y) .type = PERF_TYPE_##x, .config = PERF_COUNT_##y
+
 static struct event_symbol event_symbols[] = {
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cpu-cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CPU_CYCLES),		"cycles",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_INSTRUCTIONS),		"instructions",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_REFERENCES),		"cache-references",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_CACHE_MISSES),		"cache-misses",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branch-instructions",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_INSTRUCTIONS),	"branches",		},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BRANCH_MISSES),		"branch-misses",	},
-	{EID(PERF_TYPE_HARDWARE, PERF_COUNT_BUS_CYCLES),		"bus-cycles",		},
-
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_CLOCK),			"cpu-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK),		"task-clock",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"page-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS),		"faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MIN),		"minor-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_PAGE_FAULTS_MAJ),		"major-faults",		},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"context-switches",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CONTEXT_SWITCHES),		"cs",			},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"cpu-migrations",	},
-	{EID(PERF_TYPE_SOFTWARE, PERF_COUNT_CPU_MIGRATIONS),		"migrations",		},
+  { C(HARDWARE, CPU_CYCLES),		"cpu-cycles",		},
+  { C(HARDWARE, CPU_CYCLES),		"cycles",		},
+  { C(HARDWARE, INSTRUCTIONS),		"instructions",		},
+  { C(HARDWARE, CACHE_REFERENCES),	"cache-references",	},
+  { C(HARDWARE, CACHE_MISSES),		"cache-misses",		},
+  { C(HARDWARE, BRANCH_INSTRUCTIONS),	"branch-instructions",	},
+  { C(HARDWARE, BRANCH_INSTRUCTIONS),	"branches",		},
+  { C(HARDWARE, BRANCH_MISSES),		"branch-misses",	},
+  { C(HARDWARE, BUS_CYCLES),		"bus-cycles",		},
+
+  { C(SOFTWARE, CPU_CLOCK),		"cpu-clock",		},
+  { C(SOFTWARE, TASK_CLOCK),		"task-clock",		},
+  { C(SOFTWARE, PAGE_FAULTS),		"page-faults",		},
+  { C(SOFTWARE, PAGE_FAULTS),		"faults",		},
+  { C(SOFTWARE, PAGE_FAULTS_MIN),	"minor-faults",		},
+  { C(SOFTWARE, PAGE_FAULTS_MAJ),	"major-faults",		},
+  { C(SOFTWARE, CONTEXT_SWITCHES),	"context-switches",	},
+  { C(SOFTWARE, CONTEXT_SWITCHES),	"cs",			},
+  { C(SOFTWARE, CPU_MIGRATIONS),	"cpu-migrations",	},
+  { C(SOFTWARE, CPU_MIGRATIONS),	"migrations",		},
 };
 
 #define __PERF_COUNTER_FIELD(config, name) \
@@ -67,27 +69,26 @@ static char *sw_event_names[] = {
 	"major faults",
 };
 
-char *event_name(int ctr)
+char *event_name(int counter)
 {
-	__u64 config = event_id[ctr];
-	int type = PERF_COUNTER_TYPE(config);
-	int id = PERF_COUNTER_ID(config);
+	__u64 config = attrs[counter].config;
+	int type = attrs[counter].type;
 	static char buf[32];
 
-	if (PERF_COUNTER_RAW(config)) {
-		sprintf(buf, "raw 0x%llx", PERF_COUNTER_CONFIG(config));
+	if (attrs[counter].type == PERF_TYPE_RAW) {
+		sprintf(buf, "raw 0x%llx", config);
 		return buf;
 	}
 
 	switch (type) {
 	case PERF_TYPE_HARDWARE:
-		if (id < PERF_HW_EVENTS_MAX)
-			return hw_event_names[id];
+		if (config < PERF_HW_EVENTS_MAX)
+			return hw_event_names[config];
 		return "unknown-hardware";
 
 	case PERF_TYPE_SOFTWARE:
-		if (id < PERF_SW_EVENTS_MAX)
-			return sw_event_names[id];
+		if (config < PERF_SW_EVENTS_MAX)
+			return sw_event_names[config];
 		return "unknown-software";
 
 	default:
@@ -101,15 +102,19 @@ char *event_name(int ctr)
  * Each event can have multiple symbolic names.
  * Symbolic names are (almost) exactly matched.
  */
-static __u64 match_event_symbols(const char *str)
+static int match_event_symbols(const char *str, struct perf_counter_attr *attr)
 {
 	__u64 config, id;
 	int type;
 	unsigned int i;
 	const char *sep, *pstr;
 
-	if (str[0] == 'r' && hex2u64(str + 1, &config) > 0)
-		return config | PERF_COUNTER_RAW_MASK;
+	if (str[0] == 'r' && hex2u64(str + 1, &config) > 0) {
+		attr->type = PERF_TYPE_RAW;
+		attr->config = config;
+
+		return 0;
+	}
 
 	pstr = str;
 	sep = strchr(pstr, ':');
@@ -121,35 +126,45 @@ static __u64 match_event_symbols(const char *str)
 		if (sep) {
 			pstr = sep + 1;
 			if (strchr(pstr, 'k'))
-				event_mask[nr_counters] |= EVENT_MASK_USER;
+				attr->exclude_user = 1;
 			if (strchr(pstr, 'u'))
-				event_mask[nr_counters] |= EVENT_MASK_KERNEL;
+				attr->exclude_kernel = 1;
 		}
-		return EID(type, id);
+		attr->type = type;
+		attr->config = id;
+
+		return 0;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
 		if (!strncmp(str, event_symbols[i].symbol,
-			     strlen(event_symbols[i].symbol)))
-			return event_symbols[i].event;
+			     strlen(event_symbols[i].symbol))) {
+
+			attr->type = event_symbols[i].type;
+			attr->config = event_symbols[i].config;
+
+			return 0;
+		}
 	}
 
-	return ~0ULL;
+	return -EINVAL;
 }
 
 int parse_events(const struct option *opt, const char *str, int unset)
 {
-	__u64 config;
+	struct perf_counter_attr attr;
+	int ret;
 
+	memset(&attr, 0, sizeof(attr));
 again:
 	if (nr_counters == MAX_COUNTERS)
 		return -1;
 
-	config = match_event_symbols(str);
-	if (config == ~0ULL)
-		return -1;
+	ret = match_event_symbols(str, &attr);
+	if (ret < 0)
+		return ret;
 
-	event_id[nr_counters] = config;
+	attrs[nr_counters] = attr;
 	nr_counters++;
 
 	str = strstr(str, ",");
@@ -168,7 +183,6 @@ void create_events_help(char *events_help_msg)
 {
 	unsigned int i;
 	char *str;
-	__u64 e;
 
 	str = events_help_msg;
 
@@ -178,9 +192,8 @@ void create_events_help(char *events_help_msg)
 	for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
 		int type, id;
 
-		e = event_symbols[i].event;
-		type = PERF_COUNTER_TYPE(e);
-		id = PERF_COUNTER_ID(e);
+		type = event_symbols[i].type;
+		id = event_symbols[i].config;
 
 		if (i)
 			str += sprintf(str, "|");
@@ -191,4 +204,3 @@ void create_events_help(char *events_help_msg)
 
 	str += sprintf(str, "|rNNN]");
 }
-
diff --git a/Documentation/perf_counter/util/parse-events.h b/Documentation/perf_counter/util/parse-events.h
index 0da306b..542971c 100644
--- a/Documentation/perf_counter/util/parse-events.h
+++ b/Documentation/perf_counter/util/parse-events.h
@@ -3,12 +3,9 @@
  * Parse symbolic events/counts passed in as options:
  */
 
-extern int nr_counters;
-extern __u64			event_id[MAX_COUNTERS];
-extern int			event_mask[MAX_COUNTERS];
+extern int			nr_counters;
 
-#define EVENT_MASK_KERNEL	1
-#define EVENT_MASK_USER		2
+extern struct perf_counter_attr attrs[MAX_COUNTERS];
 
 extern char *event_name(int ctr);
 
diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 232b00a..4786ad9 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -867,13 +867,13 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 
 	if (!ppmu)
 		return ERR_PTR(-ENXIO);
-	if (!perf_event_raw(&counter->attr)) {
-		ev = perf_event_id(&counter->attr);
+	if (counter->attr.type != PERF_TYPE_RAW) {
+		ev = counter->attr.config;
 		if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
 			return ERR_PTR(-EOPNOTSUPP);
 		ev = ppmu->generic_events[ev];
 	} else {
-		ev = perf_event_config(&counter->attr);
+		ev = counter->attr.config;
 	}
 	counter->hw.config_base = ev;
 	counter->hw.idx = 0;
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 8f53f3a..430e048 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -292,15 +292,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	/*
 	 * Raw event type provide the config in the event structure
 	 */
-	if (perf_event_raw(attr)) {
-		hwc->config |= x86_pmu.raw_event(perf_event_config(attr));
+	if (attr->type == PERF_TYPE_RAW) {
+		hwc->config |= x86_pmu.raw_event(attr->config);
 	} else {
-		if (perf_event_id(attr) >= x86_pmu.max_events)
+		if (attr->config >= x86_pmu.max_events)
 			return -EINVAL;
 		/*
 		 * The generic map:
 		 */
-		hwc->config |= x86_pmu.event_map(perf_event_id(attr));
+		hwc->config |= x86_pmu.event_map(attr->config);
 	}
 
 	counter->destroy = hw_perf_counter_destroy;
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 4f9d39e..f794c69 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -73,26 +73,6 @@ enum sw_event_ids {
 	PERF_SW_EVENTS_MAX		= 7,
 };
 
-#define __PERF_COUNTER_MASK(name)			\
-	(((1ULL << PERF_COUNTER_##name##_BITS) - 1) <<	\
-	 PERF_COUNTER_##name##_SHIFT)
-
-#define PERF_COUNTER_RAW_BITS		1
-#define PERF_COUNTER_RAW_SHIFT		63
-#define PERF_COUNTER_RAW_MASK		__PERF_COUNTER_MASK(RAW)
-
-#define PERF_COUNTER_CONFIG_BITS	63
-#define PERF_COUNTER_CONFIG_SHIFT	0
-#define PERF_COUNTER_CONFIG_MASK	__PERF_COUNTER_MASK(CONFIG)
-
-#define PERF_COUNTER_TYPE_BITS		7
-#define PERF_COUNTER_TYPE_SHIFT		56
-#define PERF_COUNTER_TYPE_MASK		__PERF_COUNTER_MASK(TYPE)
-
-#define PERF_COUNTER_EVENT_BITS		56
-#define PERF_COUNTER_EVENT_SHIFT	0
-#define PERF_COUNTER_EVENT_MASK		__PERF_COUNTER_MASK(EVENT)
-
 /*
  * Bits that can be set in attr.sample_type to request information
  * in the overflow packets.
@@ -125,10 +105,13 @@ enum perf_counter_read_format {
  */
 struct perf_counter_attr {
 	/*
-	 * The MSB of the config word signifies if the rest contains cpu
-	 * specific (raw) counter configuration data, if unset, the next
-	 * 7 bits are an event type and the rest of the bits are the event
-	 * identifier.
+	 * Major type: hardware/software/tracepoint/etc.
+	 */
+	__u32			type;
+	__u32			__reserved_1;
+
+	/*
+	 * Type specific configuration information.
 	 */
 	__u64			config;
 
@@ -152,12 +135,11 @@ struct perf_counter_attr {
 				comm	       :  1, /* include comm data     */
 				freq           :  1, /* use freq, not period  */
 
-				__reserved_1   : 53;
+				__reserved_2   : 53;
 
 	__u32			wakeup_events;	/* wakeup every n events */
-	__u32			__reserved_2;
+	__u32			__reserved_3;
 
-	__u64			__reserved_3;
 	__u64			__reserved_4;
 };
 
@@ -278,8 +260,8 @@ enum perf_event_type {
 
 	/*
 	 * struct {
-	 * 	struct perf_event_header	header;
-	 * 	u32				pid, ppid;
+	 *	struct perf_event_header	header;
+	 *	u32				pid, ppid;
 	 * };
 	 */
 	PERF_EVENT_FORK			= 7,
@@ -331,27 +313,6 @@ enum perf_event_type {
 
 struct task_struct;
 
-static inline u64 perf_event_raw(struct perf_counter_attr *attr)
-{
-	return attr->config & PERF_COUNTER_RAW_MASK;
-}
-
-static inline u64 perf_event_config(struct perf_counter_attr *attr)
-{
-	return attr->config & PERF_COUNTER_CONFIG_MASK;
-}
-
-static inline u64 perf_event_type(struct perf_counter_attr *attr)
-{
-	return (attr->config & PERF_COUNTER_TYPE_MASK) >>
-		PERF_COUNTER_TYPE_SHIFT;
-}
-
-static inline u64 perf_event_id(struct perf_counter_attr *attr)
-{
-	return attr->config & PERF_COUNTER_EVENT_MASK;
-}
-
 /**
  * struct hw_perf_counter - performance counter hardware details:
  */
@@ -616,8 +577,8 @@ extern int perf_counter_overflow(struct perf_counter *counter,
  */
 static inline int is_software_counter(struct perf_counter *counter)
 {
-	return !perf_event_raw(&counter->attr) &&
-		perf_event_type(&counter->attr) != PERF_TYPE_HARDWARE;
+	return (counter->attr.type != PERF_TYPE_RAW) &&
+		(counter->attr.type != PERF_TYPE_HARDWARE);
 }
 
 extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 47c92fb..75ae767 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3091,14 +3091,12 @@ static int perf_swcounter_match(struct perf_counter *counter,
 				enum perf_event_types type,
 				u32 event, struct pt_regs *regs)
 {
-	u64 event_config;
-
-	event_config = ((u64) type << PERF_COUNTER_TYPE_SHIFT) | event;
-
 	if (!perf_swcounter_is_counting(counter))
 		return 0;
 
-	if (counter->attr.config != event_config)
+	if (counter->attr.type != type)
+		return 0;
+	if (counter->attr.config != event)
 		return 0;
 
 	if (regs) {
@@ -3403,7 +3401,7 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	 * to be kernel events, and page faults are never hypervisor
 	 * events.
 	 */
-	switch (perf_event_id(&counter->attr)) {
+	switch (counter->attr.config) {
 	case PERF_COUNT_CPU_CLOCK:
 		pmu = &perf_ops_cpu_clock;
 
@@ -3496,12 +3494,12 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP))
 		goto done;
 
-	if (perf_event_raw(attr)) {
+	if (attr->type == PERF_TYPE_RAW) {
 		pmu = hw_perf_counter_init(counter);
 		goto done;
 	}
 
-	switch (perf_event_type(attr)) {
+	switch (attr->type) {
 	case PERF_TYPE_HARDWARE:
 		pmu = hw_perf_counter_init(counter);
 		break;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Implement generalized cache event types
       [not found]             ` <new-submission>
                                 ` (168 preceding siblings ...)
  2009-06-06  9:46               ` [tip:perfcounters/core] perf_counter: Separate out attr->type from attr->config tip-bot for Ingo Molnar
@ 2009-06-06 11:16               ` tip-bot for Ingo Molnar
  2009-06-09  8:15                 ` Peter Zijlstra
  2009-06-06 13:22               ` [tip:perfcounters/core] perf_counter tools: Fix cache-event printout tip-bot for Ingo Molnar
                                 ` (537 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 11:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  8326f44da090d6d304d29b9fdc7fb3e20889e329
Gitweb:     http://git.kernel.org/tip/8326f44da090d6d304d29b9fdc7fb3e20889e329
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 5 Jun 2009 20:22:46 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 13:14:47 +0200

perf_counter: Implement generalized cache event types

Extend generic event enumeration with the PERF_TYPE_HW_CACHE
method.

This is a 3-dimensional space:

       { L1-D, L1-I, L2, ITLB, DTLB, BPU } x
       { load, store, prefetch } x
       { accesses, misses }

User-space passes in the 3 coordinates and the kernel provides
a counter. (if the hardware supports that type and if the
combination makes sense.)

Combinations that make no sense produce a -EINVAL.
Combinations that are not supported by the hardware produce -ENOTSUP.

Extend the tools to deal with this, and rewrite the event symbol
parsing code with various popular aliases for the units and
access methods above. So 'l1-cache-miss' and 'l1d-read-ops' are
both valid aliases.

( x86 is supported for now, with the Nehalem event table filled in,
  and with Core2 and Atom having placeholder tables. )

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/parse-events.c |  104 ++++++++++++-
 arch/x86/kernel/cpu/perf_counter.c             |  201 +++++++++++++++++++++++-
 include/linux/perf_counter.h                   |   34 ++++
 kernel/perf_counter.c                          |    1 +
 4 files changed, 329 insertions(+), 11 deletions(-)

diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c
index eb56bd9..de9a77c 100644
--- a/Documentation/perf_counter/util/parse-events.c
+++ b/Documentation/perf_counter/util/parse-events.c
@@ -6,6 +6,8 @@
 #include "exec_cmd.h"
 #include "string.h"
 
+extern char *strcasestr(const char *haystack, const char *needle);
+
 int					nr_counters;
 
 struct perf_counter_attr		attrs[MAX_COUNTERS];
@@ -17,6 +19,7 @@ struct event_symbol {
 };
 
 #define C(x, y) .type = PERF_TYPE_##x, .config = PERF_COUNT_##y
+#define CR(x, y) .type = PERF_TYPE_##x, .config = y
 
 static struct event_symbol event_symbols[] = {
   { C(HARDWARE, CPU_CYCLES),		"cpu-cycles",		},
@@ -69,6 +72,28 @@ static char *sw_event_names[] = {
 	"major faults",
 };
 
+#define MAX_ALIASES 8
+
+static char *hw_cache [][MAX_ALIASES] = {
+	{ "l1-d" ,	"l1d" ,	"l1", "l1-data-cache"			},
+	{ "l1-i" ,	"l1i" ,	"l1-instruction-cache"		},
+	{ "l2"  , },
+	{ "dtlb", },
+	{ "itlb", },
+	{ "bpu" , "btb", "branch-cache", NULL },
+};
+
+static char *hw_cache_op [][MAX_ALIASES] = {
+	{ "read"	, "load" },
+	{ "write"	, "store" },
+	{ "prefetch"	, "speculative-read", "speculative-load" },
+};
+
+static char *hw_cache_result [][MAX_ALIASES] = {
+	{ "access", "ops" },
+	{ "miss", },
+};
+
 char *event_name(int counter)
 {
 	__u64 config = attrs[counter].config;
@@ -86,6 +111,30 @@ char *event_name(int counter)
 			return hw_event_names[config];
 		return "unknown-hardware";
 
+	case PERF_TYPE_HW_CACHE: {
+		__u8 cache_type, cache_op, cache_result;
+		static char name[100];
+
+		cache_type   = (config >>  0) & 0xff;
+		if (cache_type > PERF_COUNT_HW_CACHE_MAX)
+			return "unknown-ext-hardware-cache-type";
+
+		cache_op     = (config >>  8) & 0xff;
+		if (cache_type > PERF_COUNT_HW_CACHE_OP_MAX)
+			return "unknown-ext-hardware-cache-op-type";
+
+		cache_result = (config >> 16) & 0xff;
+		if (cache_type > PERF_COUNT_HW_CACHE_RESULT_MAX)
+			return "unknown-ext-hardware-cache-result-type";
+
+		sprintf(name, "%s:%s:%s",
+			hw_cache[cache_type][0],
+			hw_cache_op[cache_op][0],
+			hw_cache_result[cache_result][0]);
+
+		return name;
+	}
+
 	case PERF_TYPE_SOFTWARE:
 		if (config < PERF_SW_EVENTS_MAX)
 			return sw_event_names[config];
@@ -98,11 +147,60 @@ char *event_name(int counter)
 	return "unknown";
 }
 
+static int parse_aliases(const char *str, char *names[][MAX_ALIASES], int size)
+{
+	int i, j;
+
+	for (i = 0; i < size; i++) {
+		for (j = 0; j < MAX_ALIASES; j++) {
+			if (!names[i][j])
+				break;
+			if (strcasestr(str, names[i][j]))
+				return i;
+		}
+	}
+
+	return 0;
+}
+
+static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *attr)
+{
+	__u8 cache_type = -1, cache_op = 0, cache_result = 0;
+
+	cache_type = parse_aliases(str, hw_cache, PERF_COUNT_HW_CACHE_MAX);
+	/*
+	 * No fallback - if we cannot get a clear cache type
+	 * then bail out:
+	 */
+	if (cache_type == -1)
+		return -EINVAL;
+
+	cache_op = parse_aliases(str, hw_cache_op, PERF_COUNT_HW_CACHE_OP_MAX);
+	/*
+	 * Fall back to reads:
+	 */
+	if (cache_type == -1)
+		cache_type = PERF_COUNT_HW_CACHE_OP_READ;
+
+	cache_result = parse_aliases(str, hw_cache_result,
+					PERF_COUNT_HW_CACHE_RESULT_MAX);
+	/*
+	 * Fall back to accesses:
+	 */
+	if (cache_result == -1)
+		cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS;
+
+	attr->config = cache_type | (cache_op << 8) | (cache_result << 16);
+	attr->type = PERF_TYPE_HW_CACHE;
+
+	return 0;
+}
+
 /*
  * Each event can have multiple symbolic names.
  * Symbolic names are (almost) exactly matched.
  */
-static int match_event_symbols(const char *str, struct perf_counter_attr *attr)
+static int parse_event_symbols(const char *str, struct perf_counter_attr *attr)
 {
 	__u64 config, id;
 	int type;
@@ -147,7 +245,7 @@ static int match_event_symbols(const char *str, struct perf_counter_attr *attr)
 		}
 	}
 
-	return -EINVAL;
+	return parse_generic_hw_symbols(str, attr);
 }
 
 int parse_events(const struct option *opt, const char *str, int unset)
@@ -160,7 +258,7 @@ again:
 	if (nr_counters == MAX_COUNTERS)
 		return -1;
 
-	ret = match_event_symbols(str, &attr);
+	ret = parse_event_symbols(str, &attr);
 	if (ret < 0)
 		return ret;
 
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 430e048..e86679f 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -83,6 +83,128 @@ static u64 intel_pmu_event_map(int event)
 	return intel_perfmon_event_map[event];
 }
 
+/*
+ * Generalized hw caching related event table, filled
+ * in on a per model basis. A value of 0 means
+ * 'not supported', -1 means 'event makes no sense on
+ * this CPU', any other value means the raw event
+ * ID.
+ */
+
+#define C(x) PERF_COUNT_HW_CACHE_##x
+
+static u64 __read_mostly hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX];
+
+static const u64 nehalem_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI            */
+		[ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE         */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI            */
+		[ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE         */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS        */
+		[ C(RESULT_MISS)   ] = 0x024e, /* L1D_PREFETCH.MISS            */
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0480, /* L1I.READS                    */
+		[ C(RESULT_MISS)   ] = 0x0280, /* L1I.MISSES                   */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(L2  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0324, /* L2_RQSTS.LOADS               */
+		[ C(RESULT_MISS)   ] = 0x0224, /* L2_RQSTS.LD_MISS             */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0c24, /* L2_RQSTS.RFOS                */
+		[ C(RESULT_MISS)   ] = 0x0824, /* L2_RQSTS.RFO_MISS            */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0xc024, /* L2_RQSTS.PREFETCHES          */
+		[ C(RESULT_MISS)   ] = 0x8024, /* L2_RQSTS.PREFETCH_MISS       */
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI   (alias)  */
+		[ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI   (alias)  */
+		[ C(RESULT_MISS)   ] = 0x010c, /* MEM_STORE_RETIRED.DTLB_MISS  */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0x0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x01c0, /* INST_RETIRED.ANY_P           */
+		[ C(RESULT_MISS)   ] = 0x0185, /* ITLB_MISS_RETIRED            */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
+		[ C(RESULT_MISS)   ] = 0x03e8, /* BPU_CLEARS.ANY               */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+};
+
+static const u64 core2_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+	/* To be filled in */
+};
+
+static const u64 atom_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+	/* To be filled in */
+};
+
 static u64 intel_pmu_raw_event(u64 event)
 {
 #define CORE_EVNTSEL_EVENT_MASK		0x000000FFULL
@@ -246,6 +368,39 @@ static inline int x86_pmu_initialized(void)
 	return x86_pmu.handle_irq != NULL;
 }
 
+static inline int
+set_ext_hw_attr(struct hw_perf_counter *hwc, struct perf_counter_attr *attr)
+{
+	unsigned int cache_type, cache_op, cache_result;
+	u64 config, val;
+
+	config = attr->config;
+
+	cache_type = (config >>  0) & 0xff;
+	if (cache_type >= PERF_COUNT_HW_CACHE_MAX)
+		return -EINVAL;
+
+	cache_op = (config >>  8) & 0xff;
+	if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX)
+		return -EINVAL;
+
+	cache_result = (config >> 16) & 0xff;
+	if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
+		return -EINVAL;
+
+	val = hw_cache_event_ids[cache_type][cache_op][cache_result];
+
+	if (val == 0)
+		return -ENOENT;
+
+	if (val == -1)
+		return -EINVAL;
+
+	hwc->config |= val;
+
+	return 0;
+}
+
 /*
  * Setup the hardware configuration for a given attr_type
  */
@@ -288,22 +443,25 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 		hwc->sample_period = x86_pmu.max_period;
 
 	atomic64_set(&hwc->period_left, hwc->sample_period);
+	counter->destroy = hw_perf_counter_destroy;
 
 	/*
 	 * Raw event type provide the config in the event structure
 	 */
 	if (attr->type == PERF_TYPE_RAW) {
 		hwc->config |= x86_pmu.raw_event(attr->config);
-	} else {
-		if (attr->config >= x86_pmu.max_events)
-			return -EINVAL;
-		/*
-		 * The generic map:
-		 */
-		hwc->config |= x86_pmu.event_map(attr->config);
+		return 0;
 	}
 
-	counter->destroy = hw_perf_counter_destroy;
+	if (attr->type == PERF_TYPE_HW_CACHE)
+		return set_ext_hw_attr(hwc, attr);
+
+	if (attr->config >= x86_pmu.max_events)
+		return -EINVAL;
+	/*
+	 * The generic map:
+	 */
+	hwc->config |= x86_pmu.event_map(attr->config);
 
 	return 0;
 }
@@ -989,6 +1147,33 @@ static int intel_pmu_init(void)
 
 	rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
 
+	/*
+	 * Nehalem:
+	 */
+	switch (boot_cpu_data.x86_model) {
+	case 17:
+		memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
+		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
+			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
+
+		pr_info("... installed Core2 event tables\n");
+		break;
+	default:
+	case 26:
+		memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
+		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
+			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
+
+		pr_info("... installed Nehalem/Corei7 event tables\n");
+		break;
+	case 28:
+		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
+		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
+			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
+
+		pr_info("... installed Atom event tables\n");
+		break;
+	}
 	return 0;
 }
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index f794c69..3586df8 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -28,6 +28,7 @@ enum perf_event_types {
 	PERF_TYPE_HARDWARE		= 0,
 	PERF_TYPE_SOFTWARE		= 1,
 	PERF_TYPE_TRACEPOINT		= 2,
+	PERF_TYPE_HW_CACHE		= 3,
 
 	/*
 	 * available TYPE space, raw is the max value.
@@ -56,6 +57,39 @@ enum attr_ids {
 };
 
 /*
+ * Generalized hardware cache counters:
+ *
+ *       { L1-D, L1-I, L2, LLC, ITLB, DTLB, BPU } x
+ *       { read, write, prefetch } x
+ *       { accesses, misses }
+ */
+enum hw_cache_id {
+	PERF_COUNT_HW_CACHE_L1D,
+	PERF_COUNT_HW_CACHE_L1I,
+	PERF_COUNT_HW_CACHE_L2,
+	PERF_COUNT_HW_CACHE_DTLB,
+	PERF_COUNT_HW_CACHE_ITLB,
+	PERF_COUNT_HW_CACHE_BPU,
+
+	PERF_COUNT_HW_CACHE_MAX,
+};
+
+enum hw_cache_op_id {
+	PERF_COUNT_HW_CACHE_OP_READ,
+	PERF_COUNT_HW_CACHE_OP_WRITE,
+	PERF_COUNT_HW_CACHE_OP_PREFETCH,
+
+	PERF_COUNT_HW_CACHE_OP_MAX,
+};
+
+enum hw_cache_op_result_id {
+	PERF_COUNT_HW_CACHE_RESULT_ACCESS,
+	PERF_COUNT_HW_CACHE_RESULT_MISS,
+
+	PERF_COUNT_HW_CACHE_RESULT_MAX,
+};
+
+/*
  * Special "software" counters provided by the kernel, even if the hardware
  * does not support performance counters. These counters measure various
  * physical and sw events of the kernel (and allow the profiling of them as
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 75ae767..5eacaaf 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3501,6 +3501,7 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 
 	switch (attr->type) {
 	case PERF_TYPE_HARDWARE:
+	case PERF_TYPE_HW_CACHE:
 		pmu = hw_perf_counter_init(counter);
 		break;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Fix cache-event printout
       [not found]             ` <new-submission>
                                 ` (169 preceding siblings ...)
  2009-06-06 11:16               ` [tip:perfcounters/core] perf_counter: Implement generalized cache event types tip-bot for Ingo Molnar
@ 2009-06-06 13:22               ` tip-bot for Ingo Molnar
  2009-06-06 13:27               ` [tip:perfcounters/core] perf_counter tools: Add help for perf list tip-bot for Thomas Gleixner
                                 ` (536 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  8faf3b547593bf6ea10df631e73204975273c4e0
Gitweb:     http://git.kernel.org/tip/8faf3b547593bf6ea10df631e73204975273c4e0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 13:58:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 14:16:50 +0200

perf_counter tools: Fix cache-event printout

Also standardize the cache printout (so that it can be pasted back
into the command) and sort out the aliases.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/util/parse-events.c |   56 ++++++++++++------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c
index 150fbd2..e0820b4 100644
--- a/Documentation/perf_counter/util/parse-events.c
+++ b/Documentation/perf_counter/util/parse-events.c
@@ -53,45 +53,45 @@ static struct event_symbol event_symbols[] = {
 #define PERF_COUNTER_ID(config)		__PERF_COUNTER_FIELD(config, EVENT)
 
 static char *hw_event_names[] = {
-	"CPU cycles",
+	"cycles",
 	"instructions",
-	"cache references",
-	"cache misses",
+	"cache-references",
+	"cache-misses",
 	"branches",
-	"branch misses",
-	"bus cycles",
+	"branch-misses",
+	"bus-cycles",
 };
 
 static char *sw_event_names[] = {
-	"cpu clock ticks",
-	"task clock ticks",
-	"pagefaults",
-	"context switches",
-	"CPU migrations",
-	"minor faults",
-	"major faults",
+	"cpu-clock-ticks",
+	"task-clock-ticks",
+	"page-faults",
+	"context-switches",
+	"CPU-migrations",
+	"minor-faults",
+	"major-faults",
 };
 
 #define MAX_ALIASES 8
 
 static char *hw_cache [][MAX_ALIASES] = {
-	{ "l1-d" ,	"l1d" ,	"l1", "l1-data-cache"			},
-	{ "l1-i" ,	"l1i" ,	"l1-instruction-cache"		},
-	{ "l2"  , },
-	{ "dtlb", },
-	{ "itlb", },
-	{ "bpu" , "btb", "branch-cache", NULL },
+	{ "L1-data"		, "l1-d", "l1d", "l1"				},
+	{ "L1-instruction"	, "l1-i", "l1i"					},
+	{ "L2"			, "l2"						},
+	{ "Data-TLB"		, "dtlb", "d-tlb"				},
+	{ "Instruction-TLB"	, "itlb", "i-tlb"				},
+	{ "Branch"		, "bpu" , "btb", "bpc"				},
 };
 
 static char *hw_cache_op [][MAX_ALIASES] = {
-	{ "read"	, "load" },
-	{ "write"	, "store" },
-	{ "prefetch"	, "speculative-read", "speculative-load" },
+	{ "Load"		, "read"					},
+	{ "Store"		, "write"					},
+	{ "Prefetch"		, "speculative-read", "speculative-load"	},
 };
 
 static char *hw_cache_result [][MAX_ALIASES] = {
-	{ "access", "ops" },
-	{ "miss", },
+	{ "Reference"		, "ops", "access"				},
+	{ "Miss"								},
 };
 
 char *event_name(int counter)
@@ -120,14 +120,14 @@ char *event_name(int counter)
 			return "unknown-ext-hardware-cache-type";
 
 		cache_op     = (config >>  8) & 0xff;
-		if (cache_type > PERF_COUNT_HW_CACHE_OP_MAX)
-			return "unknown-ext-hardware-cache-op-type";
+		if (cache_op > PERF_COUNT_HW_CACHE_OP_MAX)
+			return "unknown-ext-hardware-cache-op";
 
 		cache_result = (config >> 16) & 0xff;
-		if (cache_type > PERF_COUNT_HW_CACHE_RESULT_MAX)
-			return "unknown-ext-hardware-cache-result-type";
+		if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX)
+			return "unknown-ext-hardware-cache-result";
 
-		sprintf(name, "%s:%s:%s",
+		sprintf(name, "%s-Cache-%s-%ses",
 			hw_cache[cache_type][0],
 			hw_cache_op[cache_op][0],
 			hw_cache_result[cache_result][0]);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add help for perf list
       [not found]             ` <new-submission>
                                 ` (170 preceding siblings ...)
  2009-06-06 13:22               ` [tip:perfcounters/core] perf_counter tools: Fix cache-event printout tip-bot for Ingo Molnar
@ 2009-06-06 13:27               ` tip-bot for Thomas Gleixner
  2009-06-06 13:48               ` [tip:perfcounters/core] perf_counter tools: Uniform help printouts tip-bot for Ingo Molnar
                                 ` (535 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-06-06 13:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  386b05e3a2f3c5b0a9c5575060421cca0911648a
Gitweb:     http://git.kernel.org/tip/386b05e3a2f3c5b0a9c5575060421cca0911648a
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 6 Jun 2009 14:56:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 15:23:49 +0200

perf_counter tools: Add help for perf list

Also update other areas of the help texts.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-list.txt       |   25 +++++++++++++++++++
 .../perf_counter/Documentation/perf-record.txt     |   26 ++++----------------
 .../perf_counter/Documentation/perf-stat.txt       |   26 ++++----------------
 .../perf_counter/Documentation/perf-top.txt        |   26 ++++----------------
 Documentation/perf_counter/Documentation/perf.txt  |    3 +-
 5 files changed, 42 insertions(+), 64 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-list.txt b/Documentation/perf_counter/Documentation/perf-list.txt
new file mode 100644
index 0000000..aa55a71
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/perf-list.txt
@@ -0,0 +1,25 @@
+perf-list(1)
+==============
+
+NAME
+----
+perf-list - List all symbolic event types
+
+SYNOPSIS
+--------
+[verse]
+'perf list
+
+DESCRIPTION
+-----------
+This command displays the symbolic event types which can be selected in the
+various perf commands with the -e option.
+
+OPTIONS
+-------
+None
+
+SEE ALSO
+--------
+linkperf:perf-stat[1], linkperf:perf-top[1],
+linkperf:perf-record[1]
diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/Documentation/perf_counter/Documentation/perf-record.txt
index 4d3416f..1dbc1ee 100644
--- a/Documentation/perf_counter/Documentation/perf-record.txt
+++ b/Documentation/perf_counter/Documentation/perf-record.txt
@@ -26,26 +26,10 @@ OPTIONS
 
 -e::
 --event=::
-                             0:0: cpu-cycles          
-                             0:0: cycles              
-                             0:1: instructions        
-                             0:2: cache-references    
-                             0:3: cache-misses        
-                             0:4: branch-instructions 
-                             0:4: branches            
-                             0:5: branch-misses       
-                             0:6: bus-cycles          
-                             1:0: cpu-clock           
-                             1:1: task-clock          
-                             1:2: page-faults         
-                             1:2: faults              
-                             1:5: minor-faults        
-                             1:6: major-faults        
-                             1:3: context-switches    
-                             1:3: cs                  
-                             1:4: cpu-migrations      
-                             1:4: migrations          
-                           rNNN: raw PMU events (eventsel+umask)
+	Select the PMU event. Selection can be a symbolic event name
+	(use 'perf list' to list all events) or a raw PMU
+	event (eventsel+umask) in the form of rNNN where NNN is a
+	 hexadecimal event descriptor.
 
 -a::
         system-wide collection
@@ -55,4 +39,4 @@ OPTIONS
 
 SEE ALSO
 --------
-linkperf:perf-stat[1]
+linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/Documentation/perf_counter/Documentation/perf-stat.txt
index a340e7b..5d95784 100644
--- a/Documentation/perf_counter/Documentation/perf-stat.txt
+++ b/Documentation/perf_counter/Documentation/perf-stat.txt
@@ -25,26 +25,10 @@ OPTIONS
 
 -e::
 --event=::
-                             0:0: cpu-cycles          
-                             0:0: cycles              
-                             0:1: instructions        
-                             0:2: cache-references    
-                             0:3: cache-misses        
-                             0:4: branch-instructions 
-                             0:4: branches            
-                             0:5: branch-misses       
-                             0:6: bus-cycles          
-                             1:0: cpu-clock           
-                             1:1: task-clock          
-                             1:2: page-faults         
-                             1:2: faults              
-                             1:5: minor-faults        
-                             1:6: major-faults        
-                             1:3: context-switches    
-                             1:3: cs                  
-                             1:4: cpu-migrations      
-                             1:4: migrations          
-                           rNNN: raw PMU events (eventsel+umask)
+	Select the PMU event. Selection can be a symbolic event name
+	(use 'perf list' to list all events) or a raw PMU
+	event (eventsel+umask) in the form of rNNN where NNN is a
+	 hexadecimal event descriptor.
 
 -i::
 --inherit::
@@ -79,4 +63,4 @@ $ perf stat -- make -j
 
 SEE ALSO
 --------
-linkperf:perf-tops[1]
+linkperf:perf-top[1], linkperf:perf-list[1]
diff --git a/Documentation/perf_counter/Documentation/perf-top.txt b/Documentation/perf_counter/Documentation/perf-top.txt
index 15251e4..c8eb7cf 100644
--- a/Documentation/perf_counter/Documentation/perf-top.txt
+++ b/Documentation/perf_counter/Documentation/perf-top.txt
@@ -23,26 +23,10 @@ OPTIONS
 
 -e::
 --event=::
-                             0:0: cpu-cycles          
-                             0:0: cycles              
-                             0:1: instructions        
-                             0:2: cache-references    
-                             0:3: cache-misses        
-                             0:4: branch-instructions 
-                             0:4: branches            
-                             0:5: branch-misses       
-                             0:6: bus-cycles          
-                             1:0: cpu-clock           
-                             1:1: task-clock          
-                             1:2: page-faults         
-                             1:2: faults              
-                             1:5: minor-faults        
-                             1:6: major-faults        
-                             1:3: context-switches    
-                             1:3: cs                  
-                             1:4: cpu-migrations      
-                             1:4: migrations          
-                           rNNN: raw PMU events (eventsel+umask)
+	Select the PMU event. Selection can be a symbolic event name
+	(use 'perf list' to list all events) or a raw PMU
+	event (eventsel+umask) in the form of rNNN where NNN is a
+	 hexadecimal event descriptor.
 
 -a::
         system-wide collection
@@ -52,4 +36,4 @@ OPTIONS
 
 SEE ALSO
 --------
-linkperf:perf-stat[1]
+linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/Documentation/perf_counter/Documentation/perf.txt b/Documentation/perf_counter/Documentation/perf.txt
index e3d8b38..69c8325 100644
--- a/Documentation/perf_counter/Documentation/perf.txt
+++ b/Documentation/perf_counter/Documentation/perf.txt
@@ -20,4 +20,5 @@ and software features (software counters, tracepoints) as well.
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-top[1],
-linkperf:perf-record[1], linkperf:perf-report[1]
+linkperf:perf-record[1], linkperf:perf-report[1],
+linkperf:perf-list[1]

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Uniform help printouts
       [not found]             ` <new-submission>
                                 ` (171 preceding siblings ...)
  2009-06-06 13:27               ` [tip:perfcounters/core] perf_counter tools: Add help for perf list tip-bot for Thomas Gleixner
@ 2009-06-06 13:48               ` tip-bot for Ingo Molnar
  2009-06-06 14:21               ` [tip:perfcounters/core] perf_counter tools: Tidy up manpage details tip-bot for Ingo Molnar
                                 ` (534 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 13:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  502fc5c72a886ff9d4d7a596e65ecc4dd5e4d458
Gitweb:     http://git.kernel.org/tip/502fc5c72a886ff9d4d7a596e65ecc4dd5e4d458
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 13 Mar 2009 03:20:49 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 14:41:49 +0200

perf_counter tools: Uniform help printouts

Also add perf list to command-list.txt.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 Documentation/perf_counter/builtin-help.c       |   10 +++++-----
 Documentation/perf_counter/command-list.txt     |   14 ++++++++------
 Documentation/perf_counter/perf.c               |    4 ++--
 Documentation/perf_counter/util/parse-options.c |    2 +-
 Documentation/perf_counter/util/usage.c         |    2 +-
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/Documentation/perf_counter/builtin-help.c b/Documentation/perf_counter/builtin-help.c
index a3894bf..0f32dc3 100644
--- a/Documentation/perf_counter/builtin-help.c
+++ b/Documentation/perf_counter/builtin-help.c
@@ -284,7 +284,7 @@ void list_common_cmds_help(void)
 			longest = strlen(common_cmds[i].name);
 	}
 
-	puts("The most commonly used perf commands are:");
+	puts(" The most commonly used perf commands are:");
 	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
 		printf("   %s   ", common_cmds[i].name);
 		mput_char(' ', longest - strlen(common_cmds[i].name));
@@ -426,16 +426,16 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 			builtin_help_usage, 0);
 
 	if (show_all) {
-		printf("usage: %s\n\n", perf_usage_string);
+		printf("\n usage: %s\n\n", perf_usage_string);
 		list_commands("perf commands", &main_cmds, &other_cmds);
-		printf("%s\n", perf_more_info_string);
+		printf(" %s\n\n", perf_more_info_string);
 		return 0;
 	}
 
 	if (!argv[0]) {
-		printf("usage: %s\n\n", perf_usage_string);
+		printf("\n usage: %s\n\n", perf_usage_string);
 		list_common_cmds_help();
-		printf("\n%s\n", perf_more_info_string);
+		printf("\n %s\n\n", perf_more_info_string);
 		return 0;
 	}
 
diff --git a/Documentation/perf_counter/command-list.txt b/Documentation/perf_counter/command-list.txt
index 4390292..f0b922c 100644
--- a/Documentation/perf_counter/command-list.txt
+++ b/Documentation/perf_counter/command-list.txt
@@ -1,7 +1,9 @@
+#
 # List of known perf commands.
-# command name				category [deprecated] [common]
-perf-record                             mainporcelain common
-perf-report                             mainporcelain common
-perf-stat                               mainporcelain common
-perf-top                                mainporcelain common
-
+# command name			category [deprecated] [common]
+#
+perf-record			mainporcelain common
+perf-report			mainporcelain common
+perf-stat			mainporcelain common
+perf-top			mainporcelain common
+perf-list			mainporcelain common
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c
index 9ac7565..161824f 100644
--- a/Documentation/perf_counter/perf.c
+++ b/Documentation/perf_counter/perf.c
@@ -384,9 +384,9 @@ int main(int argc, const char **argv)
 			argv[0] += 2;
 	} else {
 		/* The user didn't specify a command; give them help */
-		printf("usage: %s\n\n", perf_usage_string);
+		printf("\n usage: %s\n\n", perf_usage_string);
 		list_common_cmds_help();
-		printf("\n%s\n", perf_more_info_string);
+		printf("\n %s\n\n", perf_more_info_string);
 		exit(1);
 	}
 	cmd = argv[0];
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c
index 551b6bc..e4d3533 100644
--- a/Documentation/perf_counter/util/parse-options.c
+++ b/Documentation/perf_counter/util/parse-options.c
@@ -385,7 +385,7 @@ int usage_with_options_internal(const char * const *usagestr,
 	if (!usagestr)
 		return PARSE_OPT_HELP;
 
-	fprintf(stderr, "usage: %s\n", *usagestr++);
+	fprintf(stderr, "\n usage: %s\n", *usagestr++);
 	while (*usagestr && **usagestr)
 		fprintf(stderr, "   or: %s\n", *usagestr++);
 	while (*usagestr) {
diff --git a/Documentation/perf_counter/util/usage.c b/Documentation/perf_counter/util/usage.c
index 7a10421..2cad286 100644
--- a/Documentation/perf_counter/util/usage.c
+++ b/Documentation/perf_counter/util/usage.c
@@ -14,7 +14,7 @@ static void report(const char *prefix, const char *err, va_list params)
 
 static NORETURN void usage_builtin(const char *err)
 {
-	fprintf(stderr, "usage: %s\n", err);
+	fprintf(stderr, "\n usage: %s\n", err);
 	exit(129);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Tidy up manpage details
       [not found]             ` <new-submission>
                                 ` (172 preceding siblings ...)
  2009-06-06 13:48               ` [tip:perfcounters/core] perf_counter tools: Uniform help printouts tip-bot for Ingo Molnar
@ 2009-06-06 14:21               ` tip-bot for Ingo Molnar
  2009-06-06 18:03               ` [tip:perfcounters/core] perf_counter tools: Prepare for 'perf annotate' tip-bot for Ingo Molnar
                                 ` (533 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 14:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  6e6b754ffdb6415723686c733f13275397e44422
Gitweb:     http://git.kernel.org/tip/6e6b754ffdb6415723686c733f13275397e44422
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 15 Apr 2008 22:39:31 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 15:15:48 +0200

perf_counter tools: Tidy up manpage details

Also fix a misalignment in usage string printing.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-help.txt       |    2 +-
 .../perf_counter/Documentation/perf-list.txt       |    4 ++--
 .../perf_counter/Documentation/perf-stat.txt       |    2 +-
 .../perf_counter/Documentation/perf-top.txt        |    2 +-
 Documentation/perf_counter/util/parse-options.c    |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-help.txt b/Documentation/perf_counter/Documentation/perf-help.txt
index f85fed5..5143918 100644
--- a/Documentation/perf_counter/Documentation/perf-help.txt
+++ b/Documentation/perf_counter/Documentation/perf-help.txt
@@ -1,5 +1,5 @@
 perf-help(1)
-===========
+============
 
 NAME
 ----
diff --git a/Documentation/perf_counter/Documentation/perf-list.txt b/Documentation/perf_counter/Documentation/perf-list.txt
index aa55a71..8290b94 100644
--- a/Documentation/perf_counter/Documentation/perf-list.txt
+++ b/Documentation/perf_counter/Documentation/perf-list.txt
@@ -1,5 +1,5 @@
 perf-list(1)
-==============
+============
 
 NAME
 ----
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
 SYNOPSIS
 --------
 [verse]
-'perf list
+'perf list'
 
 DESCRIPTION
 -----------
diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/Documentation/perf_counter/Documentation/perf-stat.txt
index 5d95784..c368a72 100644
--- a/Documentation/perf_counter/Documentation/perf-stat.txt
+++ b/Documentation/perf_counter/Documentation/perf-stat.txt
@@ -1,5 +1,5 @@
 perf-stat(1)
-==========
+============
 
 NAME
 ----
diff --git a/Documentation/perf_counter/Documentation/perf-top.txt b/Documentation/perf_counter/Documentation/perf-top.txt
index c8eb7cf..539d012 100644
--- a/Documentation/perf_counter/Documentation/perf-top.txt
+++ b/Documentation/perf_counter/Documentation/perf-top.txt
@@ -1,5 +1,5 @@
 perf-top(1)
-==========
+===========
 
 NAME
 ----
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c
index e4d3533..b3affb1 100644
--- a/Documentation/perf_counter/util/parse-options.c
+++ b/Documentation/perf_counter/util/parse-options.c
@@ -387,7 +387,7 @@ int usage_with_options_internal(const char * const *usagestr,
 
 	fprintf(stderr, "\n usage: %s\n", *usagestr++);
 	while (*usagestr && **usagestr)
-		fprintf(stderr, "   or: %s\n", *usagestr++);
+		fprintf(stderr, "    or: %s\n", *usagestr++);
 	while (*usagestr) {
 		fprintf(stderr, "%s%s\n",
 				**usagestr ? "    " : "",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Prepare for 'perf annotate'
       [not found]             ` <new-submission>
                                 ` (173 preceding siblings ...)
  2009-06-06 14:21               ` [tip:perfcounters/core] perf_counter tools: Tidy up manpage details tip-bot for Ingo Molnar
@ 2009-06-06 18:03               ` tip-bot for Ingo Molnar
  2009-06-06 18:03               ` [tip:perfcounters/core] perf_counter tools: Add 'perf annotate' feature tip-bot for Ingo Molnar
                                 ` (532 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 18:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  8035e4288078cb806e7dd6bafe4d3e54d44cab3f
Gitweb:     http://git.kernel.org/tip/8035e4288078cb806e7dd6bafe4d3e54d44cab3f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 15:19:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 18:58:30 +0200

perf_counter tools: Prepare for 'perf annotate'

Prepare for the 'perf annotate' implementation by splitting off
builtin-annotate.c from builtin-report.c.

( We keep this commit separate to ease the later librarization
  of the facilities that perf-report and perf-annotate shares. )

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-annotate.txt   |   26 +
 Documentation/perf_counter/Makefile                |    3 +-
 Documentation/perf_counter/builtin-annotate.c      | 1291 ++++++++++++++++++++
 Documentation/perf_counter/builtin.h               |    1 +
 Documentation/perf_counter/command-list.txt        |    3 +-
 Documentation/perf_counter/perf.c                  |    3 +
 6 files changed, 1325 insertions(+), 2 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-annotate.txt b/Documentation/perf_counter/Documentation/perf-annotate.txt
new file mode 100644
index 0000000..a9d6d5e
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/perf-annotate.txt
@@ -0,0 +1,26 @@
+perf-annotate(1)
+==============
+
+NAME
+----
+perf-annotate - Read perf.data (created by perf record) and annotate functions
+
+SYNOPSIS
+--------
+[verse]
+'perf annotate' [-i <file> | --input=file] symbol_name
+
+DESCRIPTION
+-----------
+This command displays the performance counter profile information recorded
+via perf record.
+
+OPTIONS
+-------
+-i::
+--input=::
+        Input file name. (default: perf.data)
+
+SEE ALSO
+--------
+linkperf:perf-record[1]
diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index 32c0bb2..0cbd5d6 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -323,12 +323,13 @@ LIB_OBJS += util/symbol.o
 LIB_OBJS += util/color.o
 LIB_OBJS += util/pager.o
 
+BUILTIN_OBJS += builtin-annotate.o
 BUILTIN_OBJS += builtin-help.o
+BUILTIN_OBJS += builtin-list.o
 BUILTIN_OBJS += builtin-record.o
 BUILTIN_OBJS += builtin-report.o
 BUILTIN_OBJS += builtin-stat.o
 BUILTIN_OBJS += builtin-top.o
-BUILTIN_OBJS += builtin-list.o
 
 PERFLIBS = $(LIB_FILE)
 EXTLIBS =
diff --git a/Documentation/perf_counter/builtin-annotate.c b/Documentation/perf_counter/builtin-annotate.c
new file mode 100644
index 0000000..d656484
--- /dev/null
+++ b/Documentation/perf_counter/builtin-annotate.c
@@ -0,0 +1,1291 @@
+/*
+ * builtin-annotate.c
+ *
+ * Builtin annotate command: Analyze the perf.data input file,
+ * look up and read DSOs and symbol information and display
+ * a histogram of results, along various sorting keys.
+ */
+#include "builtin.h"
+
+#include "util/util.h"
+
+#include "util/color.h"
+#include "util/list.h"
+#include "util/cache.h"
+#include "util/rbtree.h"
+#include "util/symbol.h"
+#include "util/string.h"
+
+#include "perf.h"
+
+#include "util/parse-options.h"
+#include "util/parse-events.h"
+
+#define SHOW_KERNEL	1
+#define SHOW_USER	2
+#define SHOW_HV		4
+
+static char		const *input_name = "perf.data";
+static char		*vmlinux = NULL;
+
+static char		default_sort_order[] = "comm,dso";
+static char		*sort_order = default_sort_order;
+
+static int		input;
+static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
+
+static int		dump_trace = 0;
+#define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
+
+static int		verbose;
+static int		full_paths;
+
+static unsigned long	page_size;
+static unsigned long	mmap_window = 32;
+
+struct ip_event {
+	struct perf_event_header header;
+	__u64 ip;
+	__u32 pid, tid;
+};
+
+struct mmap_event {
+	struct perf_event_header header;
+	__u32 pid, tid;
+	__u64 start;
+	__u64 len;
+	__u64 pgoff;
+	char filename[PATH_MAX];
+};
+
+struct comm_event {
+	struct perf_event_header header;
+	__u32 pid, tid;
+	char comm[16];
+};
+
+struct fork_event {
+	struct perf_event_header header;
+	__u32 pid, ppid;
+};
+
+struct period_event {
+	struct perf_event_header header;
+	__u64 time;
+	__u64 id;
+	__u64 sample_period;
+};
+
+typedef union event_union {
+	struct perf_event_header	header;
+	struct ip_event			ip;
+	struct mmap_event		mmap;
+	struct comm_event		comm;
+	struct fork_event		fork;
+	struct period_event		period;
+} event_t;
+
+static LIST_HEAD(dsos);
+static struct dso *kernel_dso;
+static struct dso *vdso;
+
+static void dsos__add(struct dso *dso)
+{
+	list_add_tail(&dso->node, &dsos);
+}
+
+static struct dso *dsos__find(const char *name)
+{
+	struct dso *pos;
+
+	list_for_each_entry(pos, &dsos, node)
+		if (strcmp(pos->name, name) == 0)
+			return pos;
+	return NULL;
+}
+
+static struct dso *dsos__findnew(const char *name)
+{
+	struct dso *dso = dsos__find(name);
+	int nr;
+
+	if (dso)
+		return dso;
+
+	dso = dso__new(name, 0);
+	if (!dso)
+		goto out_delete_dso;
+
+	nr = dso__load(dso, NULL, verbose);
+	if (nr < 0) {
+		if (verbose)
+			fprintf(stderr, "Failed to open: %s\n", name);
+		goto out_delete_dso;
+	}
+	if (!nr && verbose) {
+		fprintf(stderr,
+		"No symbols found in: %s, maybe install a debug package?\n",
+				name);
+	}
+
+	dsos__add(dso);
+
+	return dso;
+
+out_delete_dso:
+	dso__delete(dso);
+	return NULL;
+}
+
+static void dsos__fprintf(FILE *fp)
+{
+	struct dso *pos;
+
+	list_for_each_entry(pos, &dsos, node)
+		dso__fprintf(pos, fp);
+}
+
+static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
+{
+	return dso__find_symbol(kernel_dso, ip);
+}
+
+static int load_kernel(void)
+{
+	int err;
+
+	kernel_dso = dso__new("[kernel]", 0);
+	if (!kernel_dso)
+		return -1;
+
+	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
+	if (err) {
+		dso__delete(kernel_dso);
+		kernel_dso = NULL;
+	} else
+		dsos__add(kernel_dso);
+
+	vdso = dso__new("[vdso]", 0);
+	if (!vdso)
+		return -1;
+
+	vdso->find_symbol = vdso__find_symbol;
+
+	dsos__add(vdso);
+
+	return err;
+}
+
+static char __cwd[PATH_MAX];
+static char *cwd = __cwd;
+static int cwdlen;
+
+static int strcommon(const char *pathname)
+{
+	int n = 0;
+
+	while (pathname[n] == cwd[n] && n < cwdlen)
+		++n;
+
+	return n;
+}
+
+struct map {
+	struct list_head node;
+	uint64_t	 start;
+	uint64_t	 end;
+	uint64_t	 pgoff;
+	uint64_t	 (*map_ip)(struct map *, uint64_t);
+	struct dso	 *dso;
+};
+
+static uint64_t map__map_ip(struct map *map, uint64_t ip)
+{
+	return ip - map->start + map->pgoff;
+}
+
+static uint64_t vdso__map_ip(struct map *map, uint64_t ip)
+{
+	return ip;
+}
+
+static struct map *map__new(struct mmap_event *event)
+{
+	struct map *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		const char *filename = event->filename;
+		char newfilename[PATH_MAX];
+
+		if (cwd) {
+			int n = strcommon(filename);
+
+			if (n == cwdlen) {
+				snprintf(newfilename, sizeof(newfilename),
+					 ".%s", filename + n);
+				filename = newfilename;
+			}
+		}
+
+		self->start = event->start;
+		self->end   = event->start + event->len;
+		self->pgoff = event->pgoff;
+
+		self->dso = dsos__findnew(filename);
+		if (self->dso == NULL)
+			goto out_delete;
+
+		if (self->dso == vdso)
+			self->map_ip = vdso__map_ip;
+		else
+			self->map_ip = map__map_ip;
+	}
+	return self;
+out_delete:
+	free(self);
+	return NULL;
+}
+
+static struct map *map__clone(struct map *self)
+{
+	struct map *map = malloc(sizeof(*self));
+
+	if (!map)
+		return NULL;
+
+	memcpy(map, self, sizeof(*self));
+
+	return map;
+}
+
+static int map__overlap(struct map *l, struct map *r)
+{
+	if (l->start > r->start) {
+		struct map *t = l;
+		l = r;
+		r = t;
+	}
+
+	if (l->end > r->start)
+		return 1;
+
+	return 0;
+}
+
+static size_t map__fprintf(struct map *self, FILE *fp)
+{
+	return fprintf(fp, " %"PRIx64"-%"PRIx64" %"PRIx64" %s\n",
+		       self->start, self->end, self->pgoff, self->dso->name);
+}
+
+
+struct thread {
+	struct rb_node	 rb_node;
+	struct list_head maps;
+	pid_t		 pid;
+	char		 *comm;
+};
+
+static struct thread *thread__new(pid_t pid)
+{
+	struct thread *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		self->pid = pid;
+		self->comm = malloc(32);
+		if (self->comm)
+			snprintf(self->comm, 32, ":%d", self->pid);
+		INIT_LIST_HEAD(&self->maps);
+	}
+
+	return self;
+}
+
+static int thread__set_comm(struct thread *self, const char *comm)
+{
+	if (self->comm)
+		free(self->comm);
+	self->comm = strdup(comm);
+	return self->comm ? 0 : -ENOMEM;
+}
+
+static size_t thread__fprintf(struct thread *self, FILE *fp)
+{
+	struct map *pos;
+	size_t ret = fprintf(fp, "Thread %d %s\n", self->pid, self->comm);
+
+	list_for_each_entry(pos, &self->maps, node)
+		ret += map__fprintf(pos, fp);
+
+	return ret;
+}
+
+
+static struct rb_root threads;
+static struct thread *last_match;
+
+static struct thread *threads__findnew(pid_t pid)
+{
+	struct rb_node **p = &threads.rb_node;
+	struct rb_node *parent = NULL;
+	struct thread *th;
+
+	/*
+	 * Font-end cache - PID lookups come in blocks,
+	 * so most of the time we dont have to look up
+	 * the full rbtree:
+	 */
+	if (last_match && last_match->pid == pid)
+		return last_match;
+
+	while (*p != NULL) {
+		parent = *p;
+		th = rb_entry(parent, struct thread, rb_node);
+
+		if (th->pid == pid) {
+			last_match = th;
+			return th;
+		}
+
+		if (pid < th->pid)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	th = thread__new(pid);
+	if (th != NULL) {
+		rb_link_node(&th->rb_node, parent, p);
+		rb_insert_color(&th->rb_node, &threads);
+		last_match = th;
+	}
+
+	return th;
+}
+
+static void thread__insert_map(struct thread *self, struct map *map)
+{
+	struct map *pos, *tmp;
+
+	list_for_each_entry_safe(pos, tmp, &self->maps, node) {
+		if (map__overlap(pos, map)) {
+			list_del_init(&pos->node);
+			/* XXX leaks dsos */
+			free(pos);
+		}
+	}
+
+	list_add_tail(&map->node, &self->maps);
+}
+
+static int thread__fork(struct thread *self, struct thread *parent)
+{
+	struct map *map;
+
+	if (self->comm)
+		free(self->comm);
+	self->comm = strdup(parent->comm);
+	if (!self->comm)
+		return -ENOMEM;
+
+	list_for_each_entry(map, &parent->maps, node) {
+		struct map *new = map__clone(map);
+		if (!new)
+			return -ENOMEM;
+		thread__insert_map(self, new);
+	}
+
+	return 0;
+}
+
+static struct map *thread__find_map(struct thread *self, uint64_t ip)
+{
+	struct map *pos;
+
+	if (self == NULL)
+		return NULL;
+
+	list_for_each_entry(pos, &self->maps, node)
+		if (ip >= pos->start && ip <= pos->end)
+			return pos;
+
+	return NULL;
+}
+
+static size_t threads__fprintf(FILE *fp)
+{
+	size_t ret = 0;
+	struct rb_node *nd;
+
+	for (nd = rb_first(&threads); nd; nd = rb_next(nd)) {
+		struct thread *pos = rb_entry(nd, struct thread, rb_node);
+
+		ret += thread__fprintf(pos, fp);
+	}
+
+	return ret;
+}
+
+/*
+ * histogram, sorted on item, collects counts
+ */
+
+static struct rb_root hist;
+
+struct hist_entry {
+	struct rb_node	 rb_node;
+
+	struct thread	 *thread;
+	struct map	 *map;
+	struct dso	 *dso;
+	struct symbol	 *sym;
+	uint64_t	 ip;
+	char		 level;
+
+	uint32_t	 count;
+};
+
+/*
+ * configurable sorting bits
+ */
+
+struct sort_entry {
+	struct list_head list;
+
+	char *header;
+
+	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
+	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
+	size_t	(*print)(FILE *fp, struct hist_entry *);
+};
+
+/* --sort pid */
+
+static int64_t
+sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	return right->thread->pid - left->thread->pid;
+}
+
+static size_t
+sort__thread_print(FILE *fp, struct hist_entry *self)
+{
+	return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid);
+}
+
+static struct sort_entry sort_thread = {
+	.header = "         Command:  Pid",
+	.cmp	= sort__thread_cmp,
+	.print	= sort__thread_print,
+};
+
+/* --sort comm */
+
+static int64_t
+sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	return right->thread->pid - left->thread->pid;
+}
+
+static int64_t
+sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
+{
+	char *comm_l = left->thread->comm;
+	char *comm_r = right->thread->comm;
+
+	if (!comm_l || !comm_r) {
+		if (!comm_l && !comm_r)
+			return 0;
+		else if (!comm_l)
+			return -1;
+		else
+			return 1;
+	}
+
+	return strcmp(comm_l, comm_r);
+}
+
+static size_t
+sort__comm_print(FILE *fp, struct hist_entry *self)
+{
+	return fprintf(fp, "%16s", self->thread->comm);
+}
+
+static struct sort_entry sort_comm = {
+	.header		= "         Command",
+	.cmp		= sort__comm_cmp,
+	.collapse	= sort__comm_collapse,
+	.print		= sort__comm_print,
+};
+
+/* --sort dso */
+
+static int64_t
+sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	struct dso *dso_l = left->dso;
+	struct dso *dso_r = right->dso;
+
+	if (!dso_l || !dso_r) {
+		if (!dso_l && !dso_r)
+			return 0;
+		else if (!dso_l)
+			return -1;
+		else
+			return 1;
+	}
+
+	return strcmp(dso_l->name, dso_r->name);
+}
+
+static size_t
+sort__dso_print(FILE *fp, struct hist_entry *self)
+{
+	if (self->dso)
+		return fprintf(fp, "%-25s", self->dso->name);
+
+	return fprintf(fp, "%016llx         ", (__u64)self->ip);
+}
+
+static struct sort_entry sort_dso = {
+	.header = "Shared Object            ",
+	.cmp	= sort__dso_cmp,
+	.print	= sort__dso_print,
+};
+
+/* --sort symbol */
+
+static int64_t
+sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	uint64_t ip_l, ip_r;
+
+	if (left->sym == right->sym)
+		return 0;
+
+	ip_l = left->sym ? left->sym->start : left->ip;
+	ip_r = right->sym ? right->sym->start : right->ip;
+
+	return (int64_t)(ip_r - ip_l);
+}
+
+static size_t
+sort__sym_print(FILE *fp, struct hist_entry *self)
+{
+	size_t ret = 0;
+
+	if (verbose)
+		ret += fprintf(fp, "%#018llx  ", (__u64)self->ip);
+
+	if (self->sym) {
+		ret += fprintf(fp, "[%c] %s",
+			self->dso == kernel_dso ? 'k' : '.', self->sym->name);
+	} else {
+		ret += fprintf(fp, "%#016llx", (__u64)self->ip);
+	}
+
+	return ret;
+}
+
+static struct sort_entry sort_sym = {
+	.header = "Symbol",
+	.cmp	= sort__sym_cmp,
+	.print	= sort__sym_print,
+};
+
+static int sort__need_collapse = 0;
+
+struct sort_dimension {
+	char			*name;
+	struct sort_entry	*entry;
+	int			taken;
+};
+
+static struct sort_dimension sort_dimensions[] = {
+	{ .name = "pid",	.entry = &sort_thread,	},
+	{ .name = "comm",	.entry = &sort_comm,	},
+	{ .name = "dso",	.entry = &sort_dso,	},
+	{ .name = "symbol",	.entry = &sort_sym,	},
+};
+
+static LIST_HEAD(hist_entry__sort_list);
+
+static int sort_dimension__add(char *tok)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
+		struct sort_dimension *sd = &sort_dimensions[i];
+
+		if (sd->taken)
+			continue;
+
+		if (strncasecmp(tok, sd->name, strlen(tok)))
+			continue;
+
+		if (sd->entry->collapse)
+			sort__need_collapse = 1;
+
+		list_add_tail(&sd->entry->list, &hist_entry__sort_list);
+		sd->taken = 1;
+
+		return 0;
+	}
+
+	return -ESRCH;
+}
+
+static int64_t
+hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	struct sort_entry *se;
+	int64_t cmp = 0;
+
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		cmp = se->cmp(left, right);
+		if (cmp)
+			break;
+	}
+
+	return cmp;
+}
+
+static int64_t
+hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
+{
+	struct sort_entry *se;
+	int64_t cmp = 0;
+
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		int64_t (*f)(struct hist_entry *, struct hist_entry *);
+
+		f = se->collapse ?: se->cmp;
+
+		cmp = f(left, right);
+		if (cmp)
+			break;
+	}
+
+	return cmp;
+}
+
+static size_t
+hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
+{
+	struct sort_entry *se;
+	size_t ret;
+
+	if (total_samples) {
+		double percent = self->count * 100.0 / total_samples;
+		char *color = PERF_COLOR_NORMAL;
+
+		/*
+		 * We color high-overhead entries in red, low-overhead
+		 * entries in green - and keep the middle ground normal:
+		 */
+		if (percent >= 5.0)
+			color = PERF_COLOR_RED;
+		if (percent < 0.5)
+			color = PERF_COLOR_GREEN;
+
+		ret = color_fprintf(fp, color, "   %6.2f%%",
+				(self->count * 100.0) / total_samples);
+	} else
+		ret = fprintf(fp, "%12d ", self->count);
+
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		fprintf(fp, "  ");
+		ret += se->print(fp, self);
+	}
+
+	ret += fprintf(fp, "\n");
+
+	return ret;
+}
+
+/*
+ * collect histogram counts
+ */
+
+static int
+hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
+		struct symbol *sym, uint64_t ip, char level)
+{
+	struct rb_node **p = &hist.rb_node;
+	struct rb_node *parent = NULL;
+	struct hist_entry *he;
+	struct hist_entry entry = {
+		.thread	= thread,
+		.map	= map,
+		.dso	= dso,
+		.sym	= sym,
+		.ip	= ip,
+		.level	= level,
+		.count	= 1,
+	};
+	int cmp;
+
+	while (*p != NULL) {
+		parent = *p;
+		he = rb_entry(parent, struct hist_entry, rb_node);
+
+		cmp = hist_entry__cmp(&entry, he);
+
+		if (!cmp) {
+			he->count++;
+			return 0;
+		}
+
+		if (cmp < 0)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	he = malloc(sizeof(*he));
+	if (!he)
+		return -ENOMEM;
+	*he = entry;
+	rb_link_node(&he->rb_node, parent, p);
+	rb_insert_color(&he->rb_node, &hist);
+
+	return 0;
+}
+
+static void hist_entry__free(struct hist_entry *he)
+{
+	free(he);
+}
+
+/*
+ * collapse the histogram
+ */
+
+static struct rb_root collapse_hists;
+
+static void collapse__insert_entry(struct hist_entry *he)
+{
+	struct rb_node **p = &collapse_hists.rb_node;
+	struct rb_node *parent = NULL;
+	struct hist_entry *iter;
+	int64_t cmp;
+
+	while (*p != NULL) {
+		parent = *p;
+		iter = rb_entry(parent, struct hist_entry, rb_node);
+
+		cmp = hist_entry__collapse(iter, he);
+
+		if (!cmp) {
+			iter->count += he->count;
+			hist_entry__free(he);
+			return;
+		}
+
+		if (cmp < 0)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	rb_link_node(&he->rb_node, parent, p);
+	rb_insert_color(&he->rb_node, &collapse_hists);
+}
+
+static void collapse__resort(void)
+{
+	struct rb_node *next;
+	struct hist_entry *n;
+
+	if (!sort__need_collapse)
+		return;
+
+	next = rb_first(&hist);
+	while (next) {
+		n = rb_entry(next, struct hist_entry, rb_node);
+		next = rb_next(&n->rb_node);
+
+		rb_erase(&n->rb_node, &hist);
+		collapse__insert_entry(n);
+	}
+}
+
+/*
+ * reverse the map, sort on count.
+ */
+
+static struct rb_root output_hists;
+
+static void output__insert_entry(struct hist_entry *he)
+{
+	struct rb_node **p = &output_hists.rb_node;
+	struct rb_node *parent = NULL;
+	struct hist_entry *iter;
+
+	while (*p != NULL) {
+		parent = *p;
+		iter = rb_entry(parent, struct hist_entry, rb_node);
+
+		if (he->count > iter->count)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	rb_link_node(&he->rb_node, parent, p);
+	rb_insert_color(&he->rb_node, &output_hists);
+}
+
+static void output__resort(void)
+{
+	struct rb_node *next;
+	struct hist_entry *n;
+	struct rb_root *tree = &hist;
+
+	if (sort__need_collapse)
+		tree = &collapse_hists;
+
+	next = rb_first(tree);
+
+	while (next) {
+		n = rb_entry(next, struct hist_entry, rb_node);
+		next = rb_next(&n->rb_node);
+
+		rb_erase(&n->rb_node, tree);
+		output__insert_entry(n);
+	}
+}
+
+static size_t output__fprintf(FILE *fp, uint64_t total_samples)
+{
+	struct hist_entry *pos;
+	struct sort_entry *se;
+	struct rb_node *nd;
+	size_t ret = 0;
+
+	fprintf(fp, "\n");
+	fprintf(fp, "#\n");
+	fprintf(fp, "# (%Ld samples)\n", (__u64)total_samples);
+	fprintf(fp, "#\n");
+
+	fprintf(fp, "# Overhead");
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		fprintf(fp, "  %s", se->header);
+	fprintf(fp, "\n");
+
+	fprintf(fp, "# ........");
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		int i;
+
+		fprintf(fp, "  ");
+		for (i = 0; i < strlen(se->header); i++)
+			fprintf(fp, ".");
+	}
+	fprintf(fp, "\n");
+
+	fprintf(fp, "#\n");
+
+	for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
+		pos = rb_entry(nd, struct hist_entry, rb_node);
+		ret += hist_entry__fprintf(fp, pos, total_samples);
+	}
+
+	if (!strcmp(sort_order, default_sort_order)) {
+		fprintf(fp, "#\n");
+		fprintf(fp, "# (For more details, try: perf annotate --sort comm,dso,symbol)\n");
+		fprintf(fp, "#\n");
+	}
+	fprintf(fp, "\n");
+
+	return ret;
+}
+
+static void register_idle_thread(void)
+{
+	struct thread *thread = threads__findnew(0);
+
+	if (thread == NULL ||
+			thread__set_comm(thread, "[idle]")) {
+		fprintf(stderr, "problem inserting idle task.\n");
+		exit(-1);
+	}
+}
+
+static unsigned long total = 0,
+		     total_mmap = 0,
+		     total_comm = 0,
+		     total_fork = 0,
+		     total_unknown = 0;
+
+static int
+process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	char level;
+	int show = 0;
+	struct dso *dso = NULL;
+	struct thread *thread = threads__findnew(event->ip.pid);
+	uint64_t ip = event->ip.ip;
+	struct map *map = NULL;
+
+	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->header.misc,
+		event->ip.pid,
+		(void *)(long)ip);
+
+	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
+	if (thread == NULL) {
+		fprintf(stderr, "problem processing %d event, skipping it.\n",
+			event->header.type);
+		return -1;
+	}
+
+	if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
+		show = SHOW_KERNEL;
+		level = 'k';
+
+		dso = kernel_dso;
+
+		dprintf(" ...... dso: %s\n", dso->name);
+
+	} else if (event->header.misc & PERF_EVENT_MISC_USER) {
+
+		show = SHOW_USER;
+		level = '.';
+
+		map = thread__find_map(thread, ip);
+		if (map != NULL) {
+			ip = map->map_ip(map, ip);
+			dso = map->dso;
+		} else {
+			/*
+			 * If this is outside of all known maps,
+			 * and is a negative address, try to look it
+			 * up in the kernel dso, as it might be a
+			 * vsyscall (which executes in user-mode):
+			 */
+			if ((long long)ip < 0)
+				dso = kernel_dso;
+		}
+		dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
+
+	} else {
+		show = SHOW_HV;
+		level = 'H';
+		dprintf(" ...... dso: [hypervisor]\n");
+	}
+
+	if (show & show_mask) {
+		struct symbol *sym = NULL;
+
+		if (dso)
+			sym = dso->find_symbol(dso, ip);
+
+		if (hist_entry__add(thread, map, dso, sym, ip, level)) {
+			fprintf(stderr,
+		"problem incrementing symbol count, skipping event\n");
+			return -1;
+		}
+	}
+	total++;
+
+	return 0;
+}
+
+static int
+process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->mmap.pid);
+	struct map *map = map__new(&event->mmap);
+
+	dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->mmap.pid,
+		(void *)(long)event->mmap.start,
+		(void *)(long)event->mmap.len,
+		(void *)(long)event->mmap.pgoff,
+		event->mmap.filename);
+
+	if (thread == NULL || map == NULL) {
+		dprintf("problem processing PERF_EVENT_MMAP, skipping event.\n");
+		return 0;
+	}
+
+	thread__insert_map(thread, map);
+	total_mmap++;
+
+	return 0;
+}
+
+static int
+process_comm_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->comm.pid);
+
+	dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->comm.comm, event->comm.pid);
+
+	if (thread == NULL ||
+	    thread__set_comm(thread, event->comm.comm)) {
+		dprintf("problem processing PERF_EVENT_COMM, skipping event.\n");
+		return -1;
+	}
+	total_comm++;
+
+	return 0;
+}
+
+static int
+process_fork_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread = threads__findnew(event->fork.pid);
+	struct thread *parent = threads__findnew(event->fork.ppid);
+
+	dprintf("%p [%p]: PERF_EVENT_FORK: %d:%d\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->fork.pid, event->fork.ppid);
+
+	if (!thread || !parent || thread__fork(thread, parent)) {
+		dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
+		return -1;
+	}
+	total_fork++;
+
+	return 0;
+}
+
+static int
+process_period_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	dprintf("%p [%p]: PERF_EVENT_PERIOD: time:%Ld, id:%Ld: period:%Ld\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->period.time,
+		event->period.id,
+		event->period.sample_period);
+
+	return 0;
+}
+
+static int
+process_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
+		return process_overflow_event(event, offset, head);
+
+	switch (event->header.type) {
+	case PERF_EVENT_MMAP:
+		return process_mmap_event(event, offset, head);
+
+	case PERF_EVENT_COMM:
+		return process_comm_event(event, offset, head);
+
+	case PERF_EVENT_FORK:
+		return process_fork_event(event, offset, head);
+
+	case PERF_EVENT_PERIOD:
+		return process_period_event(event, offset, head);
+	/*
+	 * We dont process them right now but they are fine:
+	 */
+
+	case PERF_EVENT_THROTTLE:
+	case PERF_EVENT_UNTHROTTLE:
+		return 0;
+
+	default:
+		return -1;
+	}
+
+	return 0;
+}
+
+static int __cmd_annotate(void)
+{
+	int ret, rc = EXIT_FAILURE;
+	unsigned long offset = 0;
+	unsigned long head = 0;
+	struct stat stat;
+	event_t *event;
+	uint32_t size;
+	char *buf;
+
+	register_idle_thread();
+
+	input = open(input_name, O_RDONLY);
+	if (input < 0) {
+		perror("failed to open file");
+		exit(-1);
+	}
+
+	ret = fstat(input, &stat);
+	if (ret < 0) {
+		perror("failed to stat file");
+		exit(-1);
+	}
+
+	if (!stat.st_size) {
+		fprintf(stderr, "zero-sized file, nothing to do!\n");
+		exit(0);
+	}
+
+	if (load_kernel() < 0) {
+		perror("failed to load kernel symbols");
+		return EXIT_FAILURE;
+	}
+
+	if (!full_paths) {
+		if (getcwd(__cwd, sizeof(__cwd)) == NULL) {
+			perror("failed to get the current directory");
+			return EXIT_FAILURE;
+		}
+		cwdlen = strlen(cwd);
+	} else {
+		cwd = NULL;
+		cwdlen = 0;
+	}
+remap:
+	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
+			   MAP_SHARED, input, offset);
+	if (buf == MAP_FAILED) {
+		perror("failed to mmap file");
+		exit(-1);
+	}
+
+more:
+	event = (event_t *)(buf + head);
+
+	size = event->header.size;
+	if (!size)
+		size = 8;
+
+	if (head + event->header.size >= page_size * mmap_window) {
+		unsigned long shift = page_size * (head / page_size);
+		int ret;
+
+		ret = munmap(buf, page_size * mmap_window);
+		assert(ret == 0);
+
+		offset += shift;
+		head -= shift;
+		goto remap;
+	}
+
+	size = event->header.size;
+
+	dprintf("%p [%p]: event: %d\n",
+			(void *)(offset + head),
+			(void *)(long)event->header.size,
+			event->header.type);
+
+	if (!size || process_event(event, offset, head) < 0) {
+
+		dprintf("%p [%p]: skipping unknown header type: %d\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->header.type);
+
+		total_unknown++;
+
+		/*
+		 * assume we lost track of the stream, check alignment, and
+		 * increment a single u64 in the hope to catch on again 'soon'.
+		 */
+
+		if (unlikely(head & 7))
+			head &= ~7ULL;
+
+		size = 8;
+	}
+
+	head += size;
+
+	if (offset + head < stat.st_size)
+		goto more;
+
+	rc = EXIT_SUCCESS;
+	close(input);
+
+	dprintf("      IP events: %10ld\n", total);
+	dprintf("    mmap events: %10ld\n", total_mmap);
+	dprintf("    comm events: %10ld\n", total_comm);
+	dprintf("    fork events: %10ld\n", total_fork);
+	dprintf(" unknown events: %10ld\n", total_unknown);
+
+	if (dump_trace)
+		return 0;
+
+	if (verbose >= 3)
+		threads__fprintf(stdout);
+
+	if (verbose >= 2)
+		dsos__fprintf(stdout);
+
+	collapse__resort();
+	output__resort();
+	output__fprintf(stdout, total);
+
+	return rc;
+}
+
+static const char * const annotate_usage[] = {
+	"perf annotate [<options>] <command>",
+	NULL
+};
+
+static const struct option options[] = {
+	OPT_STRING('i', "input", &input_name, "file",
+		    "input file name"),
+	OPT_BOOLEAN('v', "verbose", &verbose,
+		    "be more verbose (show symbol address, etc)"),
+	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
+		    "dump raw trace in ASCII"),
+	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
+	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
+		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
+	OPT_BOOLEAN('P', "full-paths", &full_paths,
+		    "Don't shorten the pathnames taking into account the cwd"),
+	OPT_END()
+};
+
+static void setup_sorting(void)
+{
+	char *tmp, *tok, *str = strdup(sort_order);
+
+	for (tok = strtok_r(str, ", ", &tmp);
+			tok; tok = strtok_r(NULL, ", ", &tmp)) {
+		if (sort_dimension__add(tok) < 0) {
+			error("Unknown --sort key: `%s'", tok);
+			usage_with_options(annotate_usage, options);
+		}
+	}
+
+	free(str);
+}
+
+int cmd_annotate(int argc, const char **argv, const char *prefix)
+{
+	symbol__init();
+
+	page_size = getpagesize();
+
+	argc = parse_options(argc, argv, options, annotate_usage, 0);
+
+	setup_sorting();
+
+	/*
+	 * Any (unrecognized) arguments left?
+	 */
+	if (argc)
+		usage_with_options(annotate_usage, options);
+
+	setup_pager();
+
+	return __cmd_annotate();
+}
diff --git a/Documentation/perf_counter/builtin.h b/Documentation/perf_counter/builtin.h
index e7de47d..51d1682 100644
--- a/Documentation/perf_counter/builtin.h
+++ b/Documentation/perf_counter/builtin.h
@@ -14,6 +14,7 @@ extern void prune_packed_objects(int);
 extern int read_line_with_nul(char *buf, int size, FILE *file);
 extern int check_pager_config(const char *cmd);
 
+extern int cmd_annotate(int argc, const char **argv, const char *prefix);
 extern int cmd_help(int argc, const char **argv, const char *prefix);
 extern int cmd_record(int argc, const char **argv, const char *prefix);
 extern int cmd_report(int argc, const char **argv, const char *prefix);
diff --git a/Documentation/perf_counter/command-list.txt b/Documentation/perf_counter/command-list.txt
index f0b922c..eebce30 100644
--- a/Documentation/perf_counter/command-list.txt
+++ b/Documentation/perf_counter/command-list.txt
@@ -2,8 +2,9 @@
 # List of known perf commands.
 # command name			category [deprecated] [common]
 #
+perf-annotate			mainporcelain common
+perf-list			mainporcelain common
 perf-record			mainporcelain common
 perf-report			mainporcelain common
 perf-stat			mainporcelain common
 perf-top			mainporcelain common
-perf-list			mainporcelain common
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c
index 161824f..4eb7259 100644
--- a/Documentation/perf_counter/perf.c
+++ b/Documentation/perf_counter/perf.c
@@ -263,6 +263,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "report", cmd_report, 0 },
 		{ "stat", cmd_stat, 0 },
 		{ "top", cmd_top, 0 },
+		{ "annotate", cmd_annotate, 0 },
 		{ "version", cmd_version, 0 },
 	};
 	int i;
@@ -402,9 +403,11 @@ int main(int argc, const char **argv)
 	while (1) {
 		static int done_help = 0;
 		static int was_alias = 0;
+
 		was_alias = run_argv(&argc, &argv);
 		if (errno != ENOENT)
 			break;
+
 		if (was_alias) {
 			fprintf(stderr, "Expansion of alias '%s' failed; "
 				"'%s' is not a perf-command\n",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add 'perf annotate' feature
       [not found]             ` <new-submission>
                                 ` (174 preceding siblings ...)
  2009-06-06 18:03               ` [tip:perfcounters/core] perf_counter tools: Prepare for 'perf annotate' tip-bot for Ingo Molnar
@ 2009-06-06 18:03               ` tip-bot for Ingo Molnar
  2009-06-06 18:10                 ` Frederic Weisbecker
  2009-06-06 18:48               ` [tip:perfcounters/core] perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ tip-bot for Ingo Molnar
                                 ` (531 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 18:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  0b73da3f40128eab6ca2a07508f424029a1edaeb
Gitweb:     http://git.kernel.org/tip/0b73da3f40128eab6ca2a07508f424029a1edaeb
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 15:48:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 18:58:31 +0200

perf_counter tools: Add 'perf annotate' feature

Add new perf sub-command to display annotated source code:

 $ perf annotate decode_tree_entry

------------------------------------------------
 Percent |	Source code & Disassembly of /home/mingo/git/git
------------------------------------------------
         :
         :	/home/mingo/git/git:     file format elf64-x86-64
         :
         :
         :	Disassembly of section .text:
         :
         :	00000000004a0da0 <decode_tree_entry>:
         :		*modep = mode;
         :		return str;
         :	}
         :
         :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
         :	{
    3.82 :	  4a0da0:	41 54                	push   %r12
         :		const char *path;
         :		unsigned int mode, len;
         :
         :		if (size < 24 || buf[size - 21])
    0.17 :	  4a0da2:	48 83 fa 17          	cmp    $0x17,%rdx
         :		*modep = mode;
         :		return str;
         :	}
         :
         :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
         :	{
    0.00 :	  4a0da6:	49 89 fc             	mov    %rdi,%r12
    0.00 :	  4a0da9:	55                   	push   %rbp
    3.37 :	  4a0daa:	53                   	push   %rbx
         :		const char *path;
         :		unsigned int mode, len;
         :
         :		if (size < 24 || buf[size - 21])
    0.08 :	  4a0dab:	76 73                	jbe    4a0e20 <decode_tree_entry+0x80>
    0.00 :	  4a0dad:	80 7c 16 eb 00       	cmpb   $0x0,-0x15(%rsi,%rdx,1)
    3.48 :	  4a0db2:	75 6c                	jne    4a0e20 <decode_tree_entry+0x80>
         :	static const char *get_mode(const char *str, unsigned int *modep)
         :	{
         :		unsigned char c;
         :		unsigned int mode = 0;
         :
         :		if (*str == ' ')
    1.94 :	  4a0db4:	0f b6 06             	movzbl (%rsi),%eax
    0.39 :	  4a0db7:	3c 20                	cmp    $0x20,%al
    0.00 :	  4a0db9:	74 65                	je     4a0e20 <decode_tree_entry+0x80>
         :			return NULL;
         :
         :		while ((c = *str++) != ' ') {
    0.06 :	  4a0dbb:	89 c2                	mov    %eax,%edx
         :			if (c < '0' || c > '7')
    1.99 :	  4a0dbd:	31 ed                	xor    %ebp,%ebp
         :		unsigned int mode = 0;
         :
         :		if (*str == ' ')
         :			return NULL;
         :
         :		while ((c = *str++) != ' ') {
    1.74 :	  4a0dbf:	48 8d 5e 01          	lea    0x1(%rsi),%rbx
         :			if (c < '0' || c > '7')
    0.00 :	  4a0dc3:	8d 42 d0             	lea    -0x30(%rdx),%eax
    0.17 :	  4a0dc6:	3c 07                	cmp    $0x7,%al
    0.00 :	  4a0dc8:	76 0d                	jbe    4a0dd7 <decode_tree_entry+0x37>
    0.00 :	  4a0dca:	eb 54                	jmp    4a0e20 <decode_tree_entry+0x80>
    0.00 :	  4a0dcc:	0f 1f 40 00          	nopl   0x0(%rax)
   16.57 :	  4a0dd0:	8d 42 d0             	lea    -0x30(%rdx),%eax
    0.14 :	  4a0dd3:	3c 07                	cmp    $0x7,%al
    0.00 :	  4a0dd5:	77 49                	ja     4a0e20 <decode_tree_entry+0x80>
         :				return NULL;
         :			mode = (mode << 3) + (c - '0');
    3.12 :	  4a0dd7:	0f b6 c2             	movzbl %dl,%eax
         :		unsigned int mode = 0;
         :
         :		if (*str == ' ')
         :			return NULL;
         :
         :		while ((c = *str++) != ' ') {
    0.00 :	  4a0dda:	0f b6 13             	movzbl (%rbx),%edx
   16.74 :	  4a0ddd:	48 83 c3 01          	add    $0x1,%rbx
         :			if (c < '0' || c > '7')
         :				return NULL;
         :			mode = (mode << 3) + (c - '0');

The first column is the percentage of samples that arrived on that
particular line - relative to the total cost of the function.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter/Documentation/perf-annotate.txt   |    9 +-
 Documentation/perf_counter/builtin-annotate.c      |  304 ++++++++++++--------
 Documentation/perf_counter/util/symbol.c           |   50 +++-
 Documentation/perf_counter/util/symbol.h           |    5 +
 4 files changed, 229 insertions(+), 139 deletions(-)

diff --git a/Documentation/perf_counter/Documentation/perf-annotate.txt b/Documentation/perf_counter/Documentation/perf-annotate.txt
index a9d6d5e..c9dcade 100644
--- a/Documentation/perf_counter/Documentation/perf-annotate.txt
+++ b/Documentation/perf_counter/Documentation/perf-annotate.txt
@@ -3,7 +3,7 @@ perf-annotate(1)
 
 NAME
 ----
-perf-annotate - Read perf.data (created by perf record) and annotate functions
+perf-annotate - Read perf.data (created by perf record) and display annotated code
 
 SYNOPSIS
 --------
@@ -12,8 +12,11 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This command displays the performance counter profile information recorded
-via perf record.
+This command reads the input file and displays an annotated version of the
+code. If the object file has debug symbols then the source code will be
+displayed alongside assembly code.
+
+If there is no debug info in the object, then annotated assembly is displayed.
 
 OPTIONS
 -------
diff --git a/Documentation/perf_counter/builtin-annotate.c b/Documentation/perf_counter/builtin-annotate.c
index d656484..116a397 100644
--- a/Documentation/perf_counter/builtin-annotate.c
+++ b/Documentation/perf_counter/builtin-annotate.c
@@ -28,7 +28,7 @@
 static char		const *input_name = "perf.data";
 static char		*vmlinux = NULL;
 
-static char		default_sort_order[] = "comm,dso";
+static char		default_sort_order[] = "comm,symbol";
 static char		*sort_order = default_sort_order;
 
 static int		input;
@@ -38,7 +38,6 @@ static int		dump_trace = 0;
 #define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
 
 static int		verbose;
-static int		full_paths;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
@@ -89,6 +88,7 @@ static LIST_HEAD(dsos);
 static struct dso *kernel_dso;
 static struct dso *vdso;
 
+
 static void dsos__add(struct dso *dso)
 {
 	list_add_tail(&dso->node, &dsos);
@@ -176,20 +176,6 @@ static int load_kernel(void)
 	return err;
 }
 
-static char __cwd[PATH_MAX];
-static char *cwd = __cwd;
-static int cwdlen;
-
-static int strcommon(const char *pathname)
-{
-	int n = 0;
-
-	while (pathname[n] == cwd[n] && n < cwdlen)
-		++n;
-
-	return n;
-}
-
 struct map {
 	struct list_head node;
 	uint64_t	 start;
@@ -215,17 +201,6 @@ static struct map *map__new(struct mmap_event *event)
 
 	if (self != NULL) {
 		const char *filename = event->filename;
-		char newfilename[PATH_MAX];
-
-		if (cwd) {
-			int n = strcommon(filename);
-
-			if (n == cwdlen) {
-				snprintf(newfilename, sizeof(newfilename),
-					 ".%s", filename + n);
-				filename = newfilename;
-			}
-		}
 
 		self->start = event->start;
 		self->end   = event->start + event->len;
@@ -669,44 +644,36 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
 	return cmp;
 }
 
-static size_t
-hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
+/*
+ * collect histogram counts
+ */
+static void hist_hit(struct hist_entry *he, uint64_t ip)
 {
-	struct sort_entry *se;
-	size_t ret;
+	unsigned int sym_size, offset;
+	struct symbol *sym = he->sym;
 
-	if (total_samples) {
-		double percent = self->count * 100.0 / total_samples;
-		char *color = PERF_COLOR_NORMAL;
+	he->count++;
 
-		/*
-		 * We color high-overhead entries in red, low-overhead
-		 * entries in green - and keep the middle ground normal:
-		 */
-		if (percent >= 5.0)
-			color = PERF_COLOR_RED;
-		if (percent < 0.5)
-			color = PERF_COLOR_GREEN;
+	if (!sym || !sym->hist)
+		return;
 
-		ret = color_fprintf(fp, color, "   %6.2f%%",
-				(self->count * 100.0) / total_samples);
-	} else
-		ret = fprintf(fp, "%12d ", self->count);
+	sym_size = sym->end - sym->start;
+	offset = ip - sym->start;
 
-	list_for_each_entry(se, &hist_entry__sort_list, list) {
-		fprintf(fp, "  ");
-		ret += se->print(fp, self);
-	}
+	if (offset >= sym_size)
+		return;
 
-	ret += fprintf(fp, "\n");
+	sym->hist_sum++;
+	sym->hist[offset]++;
 
-	return ret;
+	if (verbose >= 3)
+		printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n",
+			(void *)he->sym->start,
+			he->sym->name,
+			(void *)ip, ip - he->sym->start,
+			sym->hist[offset]);
 }
 
-/*
- * collect histogram counts
- */
-
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		struct symbol *sym, uint64_t ip, char level)
@@ -732,7 +699,8 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		cmp = hist_entry__cmp(&entry, he);
 
 		if (!cmp) {
-			he->count++;
+			hist_hit(he, ip);
+
 			return 0;
 		}
 
@@ -856,50 +824,6 @@ static void output__resort(void)
 	}
 }
 
-static size_t output__fprintf(FILE *fp, uint64_t total_samples)
-{
-	struct hist_entry *pos;
-	struct sort_entry *se;
-	struct rb_node *nd;
-	size_t ret = 0;
-
-	fprintf(fp, "\n");
-	fprintf(fp, "#\n");
-	fprintf(fp, "# (%Ld samples)\n", (__u64)total_samples);
-	fprintf(fp, "#\n");
-
-	fprintf(fp, "# Overhead");
-	list_for_each_entry(se, &hist_entry__sort_list, list)
-		fprintf(fp, "  %s", se->header);
-	fprintf(fp, "\n");
-
-	fprintf(fp, "# ........");
-	list_for_each_entry(se, &hist_entry__sort_list, list) {
-		int i;
-
-		fprintf(fp, "  ");
-		for (i = 0; i < strlen(se->header); i++)
-			fprintf(fp, ".");
-	}
-	fprintf(fp, "\n");
-
-	fprintf(fp, "#\n");
-
-	for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
-		pos = rb_entry(nd, struct hist_entry, rb_node);
-		ret += hist_entry__fprintf(fp, pos, total_samples);
-	}
-
-	if (!strcmp(sort_order, default_sort_order)) {
-		fprintf(fp, "#\n");
-		fprintf(fp, "# (For more details, try: perf annotate --sort comm,dso,symbol)\n");
-		fprintf(fp, "#\n");
-	}
-	fprintf(fp, "\n");
-
-	return ret;
-}
-
 static void register_idle_thread(void)
 {
 	struct thread *thread = threads__findnew(0);
@@ -1106,6 +1030,149 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
+static int
+parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
+{
+	char *line = NULL, *tmp, *tmp2;
+	unsigned int offset;
+	size_t line_len;
+	__u64 line_ip;
+	int ret;
+	char *c;
+
+	if (getline(&line, &line_len, file) < 0)
+		return -1;
+	if (!line)
+		return -1;
+
+	c = strchr(line, '\n');
+	if (c)
+		*c = 0;
+
+	line_ip = -1;
+	offset = 0;
+	ret = -2;
+
+	/*
+	 * Strip leading spaces:
+	 */
+	tmp = line;
+	while (*tmp) {
+		if (*tmp != ' ')
+			break;
+		tmp++;
+	}
+
+	if (*tmp) {
+		/*
+		 * Parse hexa addresses followed by ':'
+		 */
+		line_ip = strtoull(tmp, &tmp2, 16);
+		if (*tmp2 != ':')
+			line_ip = -1;
+	}
+
+	if (line_ip != -1) {
+		unsigned int hits = 0;
+		double percent = 0.0;
+		char *color = PERF_COLOR_NORMAL;
+
+		offset = line_ip - start;
+		if (offset < len)
+			hits = sym->hist[offset];
+
+		if (sym->hist_sum)
+			percent = 100.0 * hits / sym->hist_sum;
+
+		/*
+		 * We color high-overhead entries in red, low-overhead
+		 * entries in green - and keep the middle ground normal:
+		 */
+		if (percent >= 5.0)
+			color = PERF_COLOR_RED;
+		else {
+			if (percent > 0.5)
+				color = PERF_COLOR_GREEN;
+		}
+
+		color_fprintf(stdout, color, " %7.2f", percent);
+		printf(" :	");
+		color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", line);
+	} else {
+		if (!*line)
+			printf("         :\n");
+		else
+			printf("         :	%s\n", line);
+	}
+
+	return 0;
+}
+
+static void annotate_sym(struct dso *dso, struct symbol *sym)
+{
+	char *filename = dso->name;
+	uint64_t start, end, len;
+	char command[PATH_MAX*2];
+	FILE *file;
+
+	if (!filename)
+		return;
+	if (dso == kernel_dso)
+		filename = vmlinux;
+
+	printf("\n------------------------------------------------\n");
+	printf(" Percent |	Source code & Disassembly of %s\n", filename);
+	printf("------------------------------------------------\n");
+
+	if (verbose >= 2)
+		printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name);
+
+	start = sym->obj_start;
+	if (!start)
+		start = sym->start;
+
+	end = start + sym->end - sym->start + 1;
+	len = sym->end - sym->start;
+
+	sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (__u64)start, (__u64)end, filename);
+
+	if (verbose >= 3)
+		printf("doing: %s\n", command);
+
+	file = popen(command, "r");
+	if (!file)
+		return;
+
+	while (!feof(file)) {
+		if (parse_line(file, sym, start, len) < 0)
+			break;
+	}
+
+	pclose(file);
+}
+
+static void find_annotations(void)
+{
+	struct rb_node *nd;
+	struct dso *dso;
+	int count = 0;
+
+	list_for_each_entry(dso, &dsos, node) {
+
+		for (nd = rb_first(&dso->syms); nd; nd = rb_next(nd)) {
+			struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
+
+			if (sym->hist) {
+				annotate_sym(dso, sym);
+				count++;
+			}
+		}
+	}
+
+	if (!count)
+		printf(" Error: symbol '%s' not present amongst the samples.\n", sym_hist_filter);
+}
+
 static int __cmd_annotate(void)
 {
 	int ret, rc = EXIT_FAILURE;
@@ -1140,16 +1207,6 @@ static int __cmd_annotate(void)
 		return EXIT_FAILURE;
 	}
 
-	if (!full_paths) {
-		if (getcwd(__cwd, sizeof(__cwd)) == NULL) {
-			perror("failed to get the current directory");
-			return EXIT_FAILURE;
-		}
-		cwdlen = strlen(cwd);
-	} else {
-		cwd = NULL;
-		cwdlen = 0;
-	}
 remap:
 	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
 			   MAP_SHARED, input, offset);
@@ -1229,7 +1286,8 @@ more:
 
 	collapse__resort();
 	output__resort();
-	output__fprintf(stdout, total);
+
+	find_annotations();
 
 	return rc;
 }
@@ -1242,15 +1300,13 @@ static const char * const annotate_usage[] = {
 static const struct option options[] = {
 	OPT_STRING('i', "input", &input_name, "file",
 		    "input file name"),
+	OPT_STRING('s', "symbol", &sym_hist_filter, "file",
+		    "symbol to annotate"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show symbol address, etc)"),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
-	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
-	OPT_BOOLEAN('P', "full-paths", &full_paths,
-		    "Don't shorten the pathnames taking into account the cwd"),
 	OPT_END()
 };
 
@@ -1279,10 +1335,18 @@ int cmd_annotate(int argc, const char **argv, const char *prefix)
 
 	setup_sorting();
 
-	/*
-	 * Any (unrecognized) arguments left?
-	 */
-	if (argc)
+	if (argc) {
+		/*
+		 * Special case: if there's an argument left then assume tha
+		 * it's a symbol filter:
+		 */
+		if (argc > 1)
+			usage_with_options(annotate_usage, options);
+
+		sym_hist_filter = argv[0];
+	}
+
+	if (!sym_hist_filter)
 		usage_with_options(annotate_usage, options);
 
 	setup_pager();
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index a06bbfb..23f4f7b 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -7,21 +7,36 @@
 #include <gelf.h>
 #include <elf.h>
 
+const char *sym_hist_filter;
+
 static struct symbol *symbol__new(uint64_t start, uint64_t len,
-				  const char *name, unsigned int priv_size)
+				  const char *name, unsigned int priv_size,
+				  uint64_t obj_start, int verbose)
 {
 	size_t namelen = strlen(name) + 1;
-	struct symbol *self = malloc(priv_size + sizeof(*self) + namelen);
+	struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
 
-	if (self != NULL) {
-		if (priv_size) {
-			memset(self, 0, priv_size);
-			self = ((void *)self) + priv_size;
-		}
-		self->start = start;
-		self->end   = start + len - 1;
-		memcpy(self->name, name, namelen);
+	if (!self)
+		return NULL;
+
+	if (verbose >= 2)
+		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
+			(__u64)start, len, name, self->hist, (void *)obj_start);
+
+	self->obj_start= obj_start;
+	self->hist = NULL;
+	self->hist_sum = 0;
+
+	if (sym_hist_filter && !strcmp(name, sym_hist_filter))
+		self->hist = calloc(sizeof(__u64), len);
+
+	if (priv_size) {
+		memset(self, 0, priv_size);
+		self = ((void *)self) + priv_size;
 	}
+	self->start = start;
+	self->end   = start + len - 1;
+	memcpy(self->name, name, namelen);
 
 	return self;
 }
@@ -166,7 +181,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
 		 * Well fix up the end later, when we have all sorted.
 		 */
 		sym = symbol__new(start, 0xdead, line + len + 2,
-				  self->sym_priv_size);
+				  self->sym_priv_size, 0, verbose);
 
 		if (sym == NULL)
 			goto out_delete_line;
@@ -272,7 +287,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
 				       GElf_Ehdr *ehdr, Elf_Scn *scn_dynsym,
 				       GElf_Shdr *shdr_dynsym,
-				       size_t dynsym_idx)
+				       size_t dynsym_idx, int verbose)
 {
 	uint32_t nr_rel_entries, idx;
 	GElf_Sym sym;
@@ -335,7 +350,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname, self->sym_priv_size);
+					sympltname, self->sym_priv_size, 0, verbose);
 			if (!f)
 				return -1;
 
@@ -353,7 +368,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname, self->sym_priv_size);
+					sympltname, self->sym_priv_size, 0, verbose);
 			if (!f)
 				return -1;
 
@@ -410,7 +425,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 	if (sec_dynsym != NULL) {
 		nr = dso__synthesize_plt_symbols(self, elf, &ehdr,
 						 sec_dynsym, &shdr,
-						 dynsym_idx);
+						 dynsym_idx, verbose);
 		if (nr < 0)
 			goto out_elf_end;
 	}
@@ -444,6 +459,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 
 	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
 		struct symbol *f;
+		uint64_t obj_start;
 
 		if (!elf_sym__is_function(&sym))
 			continue;
@@ -453,11 +469,13 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 			goto out_elf_end;
 
 		gelf_getshdr(sec, &shdr);
+		obj_start = sym.st_value;
+
 		sym.st_value -= shdr.sh_addr - shdr.sh_offset;
 
 		f = symbol__new(sym.st_value, sym.st_size,
 				elf_sym__name(&sym, symstrs),
-				self->sym_priv_size);
+				self->sym_priv_size, obj_start, verbose);
 		if (!f)
 			goto out_elf_end;
 
diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h
index e23cc31..4839d68 100644
--- a/Documentation/perf_counter/util/symbol.h
+++ b/Documentation/perf_counter/util/symbol.h
@@ -9,6 +9,9 @@ struct symbol {
 	struct rb_node	rb_node;
 	__u64		start;
 	__u64		end;
+	__u64		obj_start;
+	__u64		hist_sum;
+	__u64		*hist;
 	char		name[0];
 };
 
@@ -20,6 +23,8 @@ struct dso {
 	char		 name[0];
 };
 
+const char *sym_hist_filter;
+
 typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
 
 struct dso *dso__new(const char *name, unsigned int sym_priv_size);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Add 'perf annotate' feature
  2009-06-06 18:03               ` [tip:perfcounters/core] perf_counter tools: Add 'perf annotate' feature tip-bot for Ingo Molnar
@ 2009-06-06 18:10                 ` Frederic Weisbecker
  0 siblings, 0 replies; 1149+ messages in thread
From: Frederic Weisbecker @ 2009-06-06 18:10 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits

On Sat, Jun 06, 2009 at 06:03:55PM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  0b73da3f40128eab6ca2a07508f424029a1edaeb
> Gitweb:     http://git.kernel.org/tip/0b73da3f40128eab6ca2a07508f424029a1edaeb
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 6 Jun 2009 15:48:52 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 6 Jun 2009 18:58:31 +0200
> 
> perf_counter tools: Add 'perf annotate' feature
> 
> Add new perf sub-command to display annotated source code:
> 
>  $ perf annotate decode_tree_entry
> 
> ------------------------------------------------
>  Percent |	Source code & Disassembly of /home/mingo/git/git
> ------------------------------------------------
>          :
>          :	/home/mingo/git/git:     file format elf64-x86-64
>          :
>          :
>          :	Disassembly of section .text:
>          :
>          :	00000000004a0da0 <decode_tree_entry>:
>          :		*modep = mode;
>          :		return str;
>          :	}
>          :
>          :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
>          :	{
>     3.82 :	  4a0da0:	41 54                	push   %r12
>          :		const char *path;
>          :		unsigned int mode, len;
>          :
>          :		if (size < 24 || buf[size - 21])
>     0.17 :	  4a0da2:	48 83 fa 17          	cmp    $0x17,%rdx
>          :		*modep = mode;
>          :		return str;
>          :	}
>          :
>          :	static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size)
>          :	{
>     0.00 :	  4a0da6:	49 89 fc             	mov    %rdi,%r12
>     0.00 :	  4a0da9:	55                   	push   %rbp
>     3.37 :	  4a0daa:	53                   	push   %rbx
>          :		const char *path;
>          :		unsigned int mode, len;
>          :
>          :		if (size < 24 || buf[size - 21])
>     0.08 :	  4a0dab:	76 73                	jbe    4a0e20 <decode_tree_entry+0x80>
>     0.00 :	  4a0dad:	80 7c 16 eb 00       	cmpb   $0x0,-0x15(%rsi,%rdx,1)
>     3.48 :	  4a0db2:	75 6c                	jne    4a0e20 <decode_tree_entry+0x80>
>          :	static const char *get_mode(const char *str, unsigned int *modep)
>          :	{
>          :		unsigned char c;
>          :		unsigned int mode = 0;
>          :
>          :		if (*str == ' ')
>     1.94 :	  4a0db4:	0f b6 06             	movzbl (%rsi),%eax
>     0.39 :	  4a0db7:	3c 20                	cmp    $0x20,%al
>     0.00 :	  4a0db9:	74 65                	je     4a0e20 <decode_tree_entry+0x80>
>          :			return NULL;
>          :
>          :		while ((c = *str++) != ' ') {
>     0.06 :	  4a0dbb:	89 c2                	mov    %eax,%edx
>          :			if (c < '0' || c > '7')
>     1.99 :	  4a0dbd:	31 ed                	xor    %ebp,%ebp
>          :		unsigned int mode = 0;
>          :
>          :		if (*str == ' ')
>          :			return NULL;
>          :
>          :		while ((c = *str++) != ' ') {
>     1.74 :	  4a0dbf:	48 8d 5e 01          	lea    0x1(%rsi),%rbx
>          :			if (c < '0' || c > '7')
>     0.00 :	  4a0dc3:	8d 42 d0             	lea    -0x30(%rdx),%eax
>     0.17 :	  4a0dc6:	3c 07                	cmp    $0x7,%al
>     0.00 :	  4a0dc8:	76 0d                	jbe    4a0dd7 <decode_tree_entry+0x37>
>     0.00 :	  4a0dca:	eb 54                	jmp    4a0e20 <decode_tree_entry+0x80>
>     0.00 :	  4a0dcc:	0f 1f 40 00          	nopl   0x0(%rax)
>    16.57 :	  4a0dd0:	8d 42 d0             	lea    -0x30(%rdx),%eax
>     0.14 :	  4a0dd3:	3c 07                	cmp    $0x7,%al
>     0.00 :	  4a0dd5:	77 49                	ja     4a0e20 <decode_tree_entry+0x80>
>          :				return NULL;
>          :			mode = (mode << 3) + (c - '0');
>     3.12 :	  4a0dd7:	0f b6 c2             	movzbl %dl,%eax
>          :		unsigned int mode = 0;
>          :
>          :		if (*str == ' ')
>          :			return NULL;
>          :
>          :		while ((c = *str++) != ' ') {
>     0.00 :	  4a0dda:	0f b6 13             	movzbl (%rbx),%edx
>    16.74 :	  4a0ddd:	48 83 c3 01          	add    $0x1,%rbx
>          :			if (c < '0' || c > '7')
>          :				return NULL;
>          :			mode = (mode << 3) + (c - '0');
> 
> The first column is the percentage of samples that arrived on that
> particular line - relative to the total cost of the function.




Wow!! Very impressive tool!!

Frederic.



> 
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  .../perf_counter/Documentation/perf-annotate.txt   |    9 +-
>  Documentation/perf_counter/builtin-annotate.c      |  304 ++++++++++++--------
>  Documentation/perf_counter/util/symbol.c           |   50 +++-
>  Documentation/perf_counter/util/symbol.h           |    5 +
>  4 files changed, 229 insertions(+), 139 deletions(-)
> 
> diff --git a/Documentation/perf_counter/Documentation/perf-annotate.txt b/Documentation/perf_counter/Documentation/perf-annotate.txt
> index a9d6d5e..c9dcade 100644
> --- a/Documentation/perf_counter/Documentation/perf-annotate.txt
> +++ b/Documentation/perf_counter/Documentation/perf-annotate.txt
> @@ -3,7 +3,7 @@ perf-annotate(1)
>  
>  NAME
>  ----
> -perf-annotate - Read perf.data (created by perf record) and annotate functions
> +perf-annotate - Read perf.data (created by perf record) and display annotated code
>  
>  SYNOPSIS
>  --------
> @@ -12,8 +12,11 @@ SYNOPSIS
>  
>  DESCRIPTION
>  -----------
> -This command displays the performance counter profile information recorded
> -via perf record.
> +This command reads the input file and displays an annotated version of the
> +code. If the object file has debug symbols then the source code will be
> +displayed alongside assembly code.
> +
> +If there is no debug info in the object, then annotated assembly is displayed.
>  
>  OPTIONS
>  -------
> diff --git a/Documentation/perf_counter/builtin-annotate.c b/Documentation/perf_counter/builtin-annotate.c
> index d656484..116a397 100644
> --- a/Documentation/perf_counter/builtin-annotate.c
> +++ b/Documentation/perf_counter/builtin-annotate.c
> @@ -28,7 +28,7 @@
>  static char		const *input_name = "perf.data";
>  static char		*vmlinux = NULL;
>  
> -static char		default_sort_order[] = "comm,dso";
> +static char		default_sort_order[] = "comm,symbol";
>  static char		*sort_order = default_sort_order;
>  
>  static int		input;
> @@ -38,7 +38,6 @@ static int		dump_trace = 0;
>  #define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
>  
>  static int		verbose;
> -static int		full_paths;
>  
>  static unsigned long	page_size;
>  static unsigned long	mmap_window = 32;
> @@ -89,6 +88,7 @@ static LIST_HEAD(dsos);
>  static struct dso *kernel_dso;
>  static struct dso *vdso;
>  
> +
>  static void dsos__add(struct dso *dso)
>  {
>  	list_add_tail(&dso->node, &dsos);
> @@ -176,20 +176,6 @@ static int load_kernel(void)
>  	return err;
>  }
>  
> -static char __cwd[PATH_MAX];
> -static char *cwd = __cwd;
> -static int cwdlen;
> -
> -static int strcommon(const char *pathname)
> -{
> -	int n = 0;
> -
> -	while (pathname[n] == cwd[n] && n < cwdlen)
> -		++n;
> -
> -	return n;
> -}
> -
>  struct map {
>  	struct list_head node;
>  	uint64_t	 start;
> @@ -215,17 +201,6 @@ static struct map *map__new(struct mmap_event *event)
>  
>  	if (self != NULL) {
>  		const char *filename = event->filename;
> -		char newfilename[PATH_MAX];
> -
> -		if (cwd) {
> -			int n = strcommon(filename);
> -
> -			if (n == cwdlen) {
> -				snprintf(newfilename, sizeof(newfilename),
> -					 ".%s", filename + n);
> -				filename = newfilename;
> -			}
> -		}
>  
>  		self->start = event->start;
>  		self->end   = event->start + event->len;
> @@ -669,44 +644,36 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
>  	return cmp;
>  }
>  
> -static size_t
> -hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
> +/*
> + * collect histogram counts
> + */
> +static void hist_hit(struct hist_entry *he, uint64_t ip)
>  {
> -	struct sort_entry *se;
> -	size_t ret;
> +	unsigned int sym_size, offset;
> +	struct symbol *sym = he->sym;
>  
> -	if (total_samples) {
> -		double percent = self->count * 100.0 / total_samples;
> -		char *color = PERF_COLOR_NORMAL;
> +	he->count++;
>  
> -		/*
> -		 * We color high-overhead entries in red, low-overhead
> -		 * entries in green - and keep the middle ground normal:
> -		 */
> -		if (percent >= 5.0)
> -			color = PERF_COLOR_RED;
> -		if (percent < 0.5)
> -			color = PERF_COLOR_GREEN;
> +	if (!sym || !sym->hist)
> +		return;
>  
> -		ret = color_fprintf(fp, color, "   %6.2f%%",
> -				(self->count * 100.0) / total_samples);
> -	} else
> -		ret = fprintf(fp, "%12d ", self->count);
> +	sym_size = sym->end - sym->start;
> +	offset = ip - sym->start;
>  
> -	list_for_each_entry(se, &hist_entry__sort_list, list) {
> -		fprintf(fp, "  ");
> -		ret += se->print(fp, self);
> -	}
> +	if (offset >= sym_size)
> +		return;
>  
> -	ret += fprintf(fp, "\n");
> +	sym->hist_sum++;
> +	sym->hist[offset]++;
>  
> -	return ret;
> +	if (verbose >= 3)
> +		printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n",
> +			(void *)he->sym->start,
> +			he->sym->name,
> +			(void *)ip, ip - he->sym->start,
> +			sym->hist[offset]);
>  }
>  
> -/*
> - * collect histogram counts
> - */
> -
>  static int
>  hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
>  		struct symbol *sym, uint64_t ip, char level)
> @@ -732,7 +699,8 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
>  		cmp = hist_entry__cmp(&entry, he);
>  
>  		if (!cmp) {
> -			he->count++;
> +			hist_hit(he, ip);
> +
>  			return 0;
>  		}
>  
> @@ -856,50 +824,6 @@ static void output__resort(void)
>  	}
>  }
>  
> -static size_t output__fprintf(FILE *fp, uint64_t total_samples)
> -{
> -	struct hist_entry *pos;
> -	struct sort_entry *se;
> -	struct rb_node *nd;
> -	size_t ret = 0;
> -
> -	fprintf(fp, "\n");
> -	fprintf(fp, "#\n");
> -	fprintf(fp, "# (%Ld samples)\n", (__u64)total_samples);
> -	fprintf(fp, "#\n");
> -
> -	fprintf(fp, "# Overhead");
> -	list_for_each_entry(se, &hist_entry__sort_list, list)
> -		fprintf(fp, "  %s", se->header);
> -	fprintf(fp, "\n");
> -
> -	fprintf(fp, "# ........");
> -	list_for_each_entry(se, &hist_entry__sort_list, list) {
> -		int i;
> -
> -		fprintf(fp, "  ");
> -		for (i = 0; i < strlen(se->header); i++)
> -			fprintf(fp, ".");
> -	}
> -	fprintf(fp, "\n");
> -
> -	fprintf(fp, "#\n");
> -
> -	for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
> -		pos = rb_entry(nd, struct hist_entry, rb_node);
> -		ret += hist_entry__fprintf(fp, pos, total_samples);
> -	}
> -
> -	if (!strcmp(sort_order, default_sort_order)) {
> -		fprintf(fp, "#\n");
> -		fprintf(fp, "# (For more details, try: perf annotate --sort comm,dso,symbol)\n");
> -		fprintf(fp, "#\n");
> -	}
> -	fprintf(fp, "\n");
> -
> -	return ret;
> -}
> -
>  static void register_idle_thread(void)
>  {
>  	struct thread *thread = threads__findnew(0);
> @@ -1106,6 +1030,149 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
>  	return 0;
>  }
>  
> +static int
> +parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
> +{
> +	char *line = NULL, *tmp, *tmp2;
> +	unsigned int offset;
> +	size_t line_len;
> +	__u64 line_ip;
> +	int ret;
> +	char *c;
> +
> +	if (getline(&line, &line_len, file) < 0)
> +		return -1;
> +	if (!line)
> +		return -1;
> +
> +	c = strchr(line, '\n');
> +	if (c)
> +		*c = 0;
> +
> +	line_ip = -1;
> +	offset = 0;
> +	ret = -2;
> +
> +	/*
> +	 * Strip leading spaces:
> +	 */
> +	tmp = line;
> +	while (*tmp) {
> +		if (*tmp != ' ')
> +			break;
> +		tmp++;
> +	}
> +
> +	if (*tmp) {
> +		/*
> +		 * Parse hexa addresses followed by ':'
> +		 */
> +		line_ip = strtoull(tmp, &tmp2, 16);
> +		if (*tmp2 != ':')
> +			line_ip = -1;
> +	}
> +
> +	if (line_ip != -1) {
> +		unsigned int hits = 0;
> +		double percent = 0.0;
> +		char *color = PERF_COLOR_NORMAL;
> +
> +		offset = line_ip - start;
> +		if (offset < len)
> +			hits = sym->hist[offset];
> +
> +		if (sym->hist_sum)
> +			percent = 100.0 * hits / sym->hist_sum;
> +
> +		/*
> +		 * We color high-overhead entries in red, low-overhead
> +		 * entries in green - and keep the middle ground normal:
> +		 */
> +		if (percent >= 5.0)
> +			color = PERF_COLOR_RED;
> +		else {
> +			if (percent > 0.5)
> +				color = PERF_COLOR_GREEN;
> +		}
> +
> +		color_fprintf(stdout, color, " %7.2f", percent);
> +		printf(" :	");
> +		color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", line);
> +	} else {
> +		if (!*line)
> +			printf("         :\n");
> +		else
> +			printf("         :	%s\n", line);
> +	}
> +
> +	return 0;
> +}
> +
> +static void annotate_sym(struct dso *dso, struct symbol *sym)
> +{
> +	char *filename = dso->name;
> +	uint64_t start, end, len;
> +	char command[PATH_MAX*2];
> +	FILE *file;
> +
> +	if (!filename)
> +		return;
> +	if (dso == kernel_dso)
> +		filename = vmlinux;
> +
> +	printf("\n------------------------------------------------\n");
> +	printf(" Percent |	Source code & Disassembly of %s\n", filename);
> +	printf("------------------------------------------------\n");
> +
> +	if (verbose >= 2)
> +		printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name);
> +
> +	start = sym->obj_start;
> +	if (!start)
> +		start = sym->start;
> +
> +	end = start + sym->end - sym->start + 1;
> +	len = sym->end - sym->start;
> +
> +	sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (__u64)start, (__u64)end, filename);
> +
> +	if (verbose >= 3)
> +		printf("doing: %s\n", command);
> +
> +	file = popen(command, "r");
> +	if (!file)
> +		return;
> +
> +	while (!feof(file)) {
> +		if (parse_line(file, sym, start, len) < 0)
> +			break;
> +	}
> +
> +	pclose(file);
> +}
> +
> +static void find_annotations(void)
> +{
> +	struct rb_node *nd;
> +	struct dso *dso;
> +	int count = 0;
> +
> +	list_for_each_entry(dso, &dsos, node) {
> +
> +		for (nd = rb_first(&dso->syms); nd; nd = rb_next(nd)) {
> +			struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
> +
> +			if (sym->hist) {
> +				annotate_sym(dso, sym);
> +				count++;
> +			}
> +		}
> +	}
> +
> +	if (!count)
> +		printf(" Error: symbol '%s' not present amongst the samples.\n", sym_hist_filter);
> +}
> +
>  static int __cmd_annotate(void)
>  {
>  	int ret, rc = EXIT_FAILURE;
> @@ -1140,16 +1207,6 @@ static int __cmd_annotate(void)
>  		return EXIT_FAILURE;
>  	}
>  
> -	if (!full_paths) {
> -		if (getcwd(__cwd, sizeof(__cwd)) == NULL) {
> -			perror("failed to get the current directory");
> -			return EXIT_FAILURE;
> -		}
> -		cwdlen = strlen(cwd);
> -	} else {
> -		cwd = NULL;
> -		cwdlen = 0;
> -	}
>  remap:
>  	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
>  			   MAP_SHARED, input, offset);
> @@ -1229,7 +1286,8 @@ more:
>  
>  	collapse__resort();
>  	output__resort();
> -	output__fprintf(stdout, total);
> +
> +	find_annotations();
>  
>  	return rc;
>  }
> @@ -1242,15 +1300,13 @@ static const char * const annotate_usage[] = {
>  static const struct option options[] = {
>  	OPT_STRING('i', "input", &input_name, "file",
>  		    "input file name"),
> +	OPT_STRING('s', "symbol", &sym_hist_filter, "file",
> +		    "symbol to annotate"),
>  	OPT_BOOLEAN('v', "verbose", &verbose,
>  		    "be more verbose (show symbol address, etc)"),
>  	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
>  		    "dump raw trace in ASCII"),
>  	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
> -	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
> -		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
> -	OPT_BOOLEAN('P', "full-paths", &full_paths,
> -		    "Don't shorten the pathnames taking into account the cwd"),
>  	OPT_END()
>  };
>  
> @@ -1279,10 +1335,18 @@ int cmd_annotate(int argc, const char **argv, const char *prefix)
>  
>  	setup_sorting();
>  
> -	/*
> -	 * Any (unrecognized) arguments left?
> -	 */
> -	if (argc)
> +	if (argc) {
> +		/*
> +		 * Special case: if there's an argument left then assume tha
> +		 * it's a symbol filter:
> +		 */
> +		if (argc > 1)
> +			usage_with_options(annotate_usage, options);
> +
> +		sym_hist_filter = argv[0];
> +	}
> +
> +	if (!sym_hist_filter)
>  		usage_with_options(annotate_usage, options);
>  
>  	setup_pager();
> diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
> index a06bbfb..23f4f7b 100644
> --- a/Documentation/perf_counter/util/symbol.c
> +++ b/Documentation/perf_counter/util/symbol.c
> @@ -7,21 +7,36 @@
>  #include <gelf.h>
>  #include <elf.h>
>  
> +const char *sym_hist_filter;
> +
>  static struct symbol *symbol__new(uint64_t start, uint64_t len,
> -				  const char *name, unsigned int priv_size)
> +				  const char *name, unsigned int priv_size,
> +				  uint64_t obj_start, int verbose)
>  {
>  	size_t namelen = strlen(name) + 1;
> -	struct symbol *self = malloc(priv_size + sizeof(*self) + namelen);
> +	struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
>  
> -	if (self != NULL) {
> -		if (priv_size) {
> -			memset(self, 0, priv_size);
> -			self = ((void *)self) + priv_size;
> -		}
> -		self->start = start;
> -		self->end   = start + len - 1;
> -		memcpy(self->name, name, namelen);
> +	if (!self)
> +		return NULL;
> +
> +	if (verbose >= 2)
> +		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
> +			(__u64)start, len, name, self->hist, (void *)obj_start);
> +
> +	self->obj_start= obj_start;
> +	self->hist = NULL;
> +	self->hist_sum = 0;
> +
> +	if (sym_hist_filter && !strcmp(name, sym_hist_filter))
> +		self->hist = calloc(sizeof(__u64), len);
> +
> +	if (priv_size) {
> +		memset(self, 0, priv_size);
> +		self = ((void *)self) + priv_size;
>  	}
> +	self->start = start;
> +	self->end   = start + len - 1;
> +	memcpy(self->name, name, namelen);
>  
>  	return self;
>  }
> @@ -166,7 +181,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
>  		 * Well fix up the end later, when we have all sorted.
>  		 */
>  		sym = symbol__new(start, 0xdead, line + len + 2,
> -				  self->sym_priv_size);
> +				  self->sym_priv_size, 0, verbose);
>  
>  		if (sym == NULL)
>  			goto out_delete_line;
> @@ -272,7 +287,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>  static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
>  				       GElf_Ehdr *ehdr, Elf_Scn *scn_dynsym,
>  				       GElf_Shdr *shdr_dynsym,
> -				       size_t dynsym_idx)
> +				       size_t dynsym_idx, int verbose)
>  {
>  	uint32_t nr_rel_entries, idx;
>  	GElf_Sym sym;
> @@ -335,7 +350,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size);
> +					sympltname, self->sym_priv_size, 0, verbose);
>  			if (!f)
>  				return -1;
>  
> @@ -353,7 +368,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, Elf *elf,
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size);
> +					sympltname, self->sym_priv_size, 0, verbose);
>  			if (!f)
>  				return -1;
>  
> @@ -410,7 +425,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  	if (sec_dynsym != NULL) {
>  		nr = dso__synthesize_plt_symbols(self, elf, &ehdr,
>  						 sec_dynsym, &shdr,
> -						 dynsym_idx);
> +						 dynsym_idx, verbose);
>  		if (nr < 0)
>  			goto out_elf_end;
>  	}
> @@ -444,6 +459,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  
>  	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
>  		struct symbol *f;
> +		uint64_t obj_start;
>  
>  		if (!elf_sym__is_function(&sym))
>  			continue;
> @@ -453,11 +469,13 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  			goto out_elf_end;
>  
>  		gelf_getshdr(sec, &shdr);
> +		obj_start = sym.st_value;
> +
>  		sym.st_value -= shdr.sh_addr - shdr.sh_offset;
>  
>  		f = symbol__new(sym.st_value, sym.st_size,
>  				elf_sym__name(&sym, symstrs),
> -				self->sym_priv_size);
> +				self->sym_priv_size, obj_start, verbose);
>  		if (!f)
>  			goto out_elf_end;
>  
> diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h
> index e23cc31..4839d68 100644
> --- a/Documentation/perf_counter/util/symbol.h
> +++ b/Documentation/perf_counter/util/symbol.h
> @@ -9,6 +9,9 @@ struct symbol {
>  	struct rb_node	rb_node;
>  	__u64		start;
>  	__u64		end;
> +	__u64		obj_start;
> +	__u64		hist_sum;
> +	__u64		*hist;
>  	char		name[0];
>  };
>  
> @@ -20,6 +23,8 @@ struct dso {
>  	char		 name[0];
>  };
>  
> +const char *sym_hist_filter;
> +
>  typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
>  
>  struct dso *dso__new(const char *name, unsigned int sym_priv_size);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/
       [not found]             ` <new-submission>
                                 ` (175 preceding siblings ...)
  2009-06-06 18:03               ` [tip:perfcounters/core] perf_counter tools: Add 'perf annotate' feature tip-bot for Ingo Molnar
@ 2009-06-06 18:48               ` tip-bot for Ingo Molnar
  2009-06-06 18:48               ` [tip:perfcounters/core] perf_counter tools: Warning fixes on 32-bit tip-bot for Arjan van de Ven
                                 ` (530 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 18:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  864709302a80f26fa9da3be5b47304f0b8bae192
Gitweb:     http://git.kernel.org/tip/864709302a80f26fa9da3be5b47304f0b8bae192
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 20:33:43 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 20:33:43 +0200

perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/

Several people have suggested that 'perf' has become a full-fledged
tool that should be moved out of Documentation/. Move it to the
(new) tools/ directory.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 .../perf_counter => tools/perf}/.gitignore         |    0
 .../perf}/Documentation/Makefile                   |    0
 .../perf}/Documentation/asciidoc.conf              |    0
 .../perf}/Documentation/manpage-1.72.xsl           |    0
 .../perf}/Documentation/manpage-base.xsl           |    0
 .../perf}/Documentation/manpage-bold-literal.xsl   |    0
 .../perf}/Documentation/manpage-normal.xsl         |    0
 .../perf}/Documentation/manpage-suppress-sp.xsl    |    0
 .../perf}/Documentation/perf-annotate.txt          |    0
 .../perf}/Documentation/perf-help.txt              |    0
 .../perf}/Documentation/perf-list.txt              |    0
 .../perf}/Documentation/perf-record.txt            |    0
 .../perf}/Documentation/perf-report.txt            |    0
 .../perf}/Documentation/perf-stat.txt              |    0
 .../perf}/Documentation/perf-top.txt               |    0
 .../perf}/Documentation/perf.txt                   |    0
 .../perf_counter => tools/perf}/Makefile           |    0
 .../perf_counter => tools/perf}/builtin-annotate.c |    0
 .../perf_counter => tools/perf}/builtin-help.c     |    0
 .../perf_counter => tools/perf}/builtin-list.c     |    0
 .../perf_counter => tools/perf}/builtin-record.c   |    0
 .../perf_counter => tools/perf}/builtin-report.c   |    0
 .../perf_counter => tools/perf}/builtin-stat.c     |    0
 .../perf_counter => tools/perf}/builtin-top.c      |    0
 .../perf_counter => tools/perf}/builtin.h          |    0
 .../perf_counter => tools/perf}/command-list.txt   |    0
 .../perf_counter => tools/perf}/design.txt         |    0
 {Documentation/perf_counter => tools/perf}/perf.c  |    0
 {Documentation/perf_counter => tools/perf}/perf.h  |    0
 .../perf}/util/PERF-VERSION-GEN                    |    0
 .../perf_counter => tools/perf}/util/abspath.c     |    0
 .../perf_counter => tools/perf}/util/alias.c       |    0
 .../perf_counter => tools/perf}/util/cache.h       |    0
 .../perf_counter => tools/perf}/util/color.c       |    0
 .../perf_counter => tools/perf}/util/color.h       |    0
 .../perf_counter => tools/perf}/util/config.c      |    0
 .../perf_counter => tools/perf}/util/ctype.c       |    0
 .../perf_counter => tools/perf}/util/environment.c |    0
 .../perf_counter => tools/perf}/util/exec_cmd.c    |    0
 .../perf_counter => tools/perf}/util/exec_cmd.h    |    0
 .../perf}/util/generate-cmdlist.sh                 |    0
 .../perf_counter => tools/perf}/util/help.c        |    0
 .../perf_counter => tools/perf}/util/help.h        |    0
 .../perf_counter => tools/perf}/util/levenshtein.c |    0
 .../perf_counter => tools/perf}/util/levenshtein.h |    0
 .../perf_counter => tools/perf}/util/list.h        |    0
 .../perf_counter => tools/perf}/util/pager.c       |    0
 .../perf}/util/parse-events.c                      |    0
 .../perf}/util/parse-events.h                      |    0
 .../perf}/util/parse-options.c                     |    0
 .../perf}/util/parse-options.h                     |    0
 .../perf_counter => tools/perf}/util/path.c        |    0
 .../perf_counter => tools/perf}/util/quote.c       |    0
 .../perf_counter => tools/perf}/util/quote.h       |    0
 .../perf_counter => tools/perf}/util/rbtree.c      |    0
 .../perf_counter => tools/perf}/util/rbtree.h      |    0
 .../perf_counter => tools/perf}/util/run-command.c |    0
 .../perf_counter => tools/perf}/util/run-command.h |    0
 .../perf_counter => tools/perf}/util/sigchain.c    |    0
 .../perf_counter => tools/perf}/util/sigchain.h    |    0
 .../perf_counter => tools/perf}/util/strbuf.c      |    0
 .../perf_counter => tools/perf}/util/strbuf.h      |    0
 .../perf_counter => tools/perf}/util/string.c      |    0
 .../perf_counter => tools/perf}/util/string.h      |    0
 .../perf_counter => tools/perf}/util/symbol.c      |    0
 .../perf_counter => tools/perf}/util/symbol.h      |    0
 .../perf_counter => tools/perf}/util/usage.c       |    0
 .../perf_counter => tools/perf}/util/util.h        |    0
 .../perf_counter => tools/perf}/util/wrapper.c     |    0
 69 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/Documentation/perf_counter/.gitignore b/tools/perf/.gitignore
similarity index 100%
rename from Documentation/perf_counter/.gitignore
rename to tools/perf/.gitignore
diff --git a/Documentation/perf_counter/Documentation/Makefile b/tools/perf/Documentation/Makefile
similarity index 100%
rename from Documentation/perf_counter/Documentation/Makefile
rename to tools/perf/Documentation/Makefile
diff --git a/Documentation/perf_counter/Documentation/asciidoc.conf b/tools/perf/Documentation/asciidoc.conf
similarity index 100%
rename from Documentation/perf_counter/Documentation/asciidoc.conf
rename to tools/perf/Documentation/asciidoc.conf
diff --git a/Documentation/perf_counter/Documentation/manpage-1.72.xsl b/tools/perf/Documentation/manpage-1.72.xsl
similarity index 100%
rename from Documentation/perf_counter/Documentation/manpage-1.72.xsl
rename to tools/perf/Documentation/manpage-1.72.xsl
diff --git a/Documentation/perf_counter/Documentation/manpage-base.xsl b/tools/perf/Documentation/manpage-base.xsl
similarity index 100%
rename from Documentation/perf_counter/Documentation/manpage-base.xsl
rename to tools/perf/Documentation/manpage-base.xsl
diff --git a/Documentation/perf_counter/Documentation/manpage-bold-literal.xsl b/tools/perf/Documentation/manpage-bold-literal.xsl
similarity index 100%
rename from Documentation/perf_counter/Documentation/manpage-bold-literal.xsl
rename to tools/perf/Documentation/manpage-bold-literal.xsl
diff --git a/Documentation/perf_counter/Documentation/manpage-normal.xsl b/tools/perf/Documentation/manpage-normal.xsl
similarity index 100%
rename from Documentation/perf_counter/Documentation/manpage-normal.xsl
rename to tools/perf/Documentation/manpage-normal.xsl
diff --git a/Documentation/perf_counter/Documentation/manpage-suppress-sp.xsl b/tools/perf/Documentation/manpage-suppress-sp.xsl
similarity index 100%
rename from Documentation/perf_counter/Documentation/manpage-suppress-sp.xsl
rename to tools/perf/Documentation/manpage-suppress-sp.xsl
diff --git a/Documentation/perf_counter/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-annotate.txt
rename to tools/perf/Documentation/perf-annotate.txt
diff --git a/Documentation/perf_counter/Documentation/perf-help.txt b/tools/perf/Documentation/perf-help.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-help.txt
rename to tools/perf/Documentation/perf-help.txt
diff --git a/Documentation/perf_counter/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-list.txt
rename to tools/perf/Documentation/perf-list.txt
diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-record.txt
rename to tools/perf/Documentation/perf-record.txt
diff --git a/Documentation/perf_counter/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-report.txt
rename to tools/perf/Documentation/perf-report.txt
diff --git a/Documentation/perf_counter/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-stat.txt
rename to tools/perf/Documentation/perf-stat.txt
diff --git a/Documentation/perf_counter/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf-top.txt
rename to tools/perf/Documentation/perf-top.txt
diff --git a/Documentation/perf_counter/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
similarity index 100%
rename from Documentation/perf_counter/Documentation/perf.txt
rename to tools/perf/Documentation/perf.txt
diff --git a/Documentation/perf_counter/Makefile b/tools/perf/Makefile
similarity index 100%
rename from Documentation/perf_counter/Makefile
rename to tools/perf/Makefile
diff --git a/Documentation/perf_counter/builtin-annotate.c b/tools/perf/builtin-annotate.c
similarity index 100%
rename from Documentation/perf_counter/builtin-annotate.c
rename to tools/perf/builtin-annotate.c
diff --git a/Documentation/perf_counter/builtin-help.c b/tools/perf/builtin-help.c
similarity index 100%
rename from Documentation/perf_counter/builtin-help.c
rename to tools/perf/builtin-help.c
diff --git a/Documentation/perf_counter/builtin-list.c b/tools/perf/builtin-list.c
similarity index 100%
rename from Documentation/perf_counter/builtin-list.c
rename to tools/perf/builtin-list.c
diff --git a/Documentation/perf_counter/builtin-record.c b/tools/perf/builtin-record.c
similarity index 100%
rename from Documentation/perf_counter/builtin-record.c
rename to tools/perf/builtin-record.c
diff --git a/Documentation/perf_counter/builtin-report.c b/tools/perf/builtin-report.c
similarity index 100%
rename from Documentation/perf_counter/builtin-report.c
rename to tools/perf/builtin-report.c
diff --git a/Documentation/perf_counter/builtin-stat.c b/tools/perf/builtin-stat.c
similarity index 100%
rename from Documentation/perf_counter/builtin-stat.c
rename to tools/perf/builtin-stat.c
diff --git a/Documentation/perf_counter/builtin-top.c b/tools/perf/builtin-top.c
similarity index 100%
rename from Documentation/perf_counter/builtin-top.c
rename to tools/perf/builtin-top.c
diff --git a/Documentation/perf_counter/builtin.h b/tools/perf/builtin.h
similarity index 100%
rename from Documentation/perf_counter/builtin.h
rename to tools/perf/builtin.h
diff --git a/Documentation/perf_counter/command-list.txt b/tools/perf/command-list.txt
similarity index 100%
rename from Documentation/perf_counter/command-list.txt
rename to tools/perf/command-list.txt
diff --git a/Documentation/perf_counter/design.txt b/tools/perf/design.txt
similarity index 100%
rename from Documentation/perf_counter/design.txt
rename to tools/perf/design.txt
diff --git a/Documentation/perf_counter/perf.c b/tools/perf/perf.c
similarity index 100%
rename from Documentation/perf_counter/perf.c
rename to tools/perf/perf.c
diff --git a/Documentation/perf_counter/perf.h b/tools/perf/perf.h
similarity index 100%
rename from Documentation/perf_counter/perf.h
rename to tools/perf/perf.h
diff --git a/Documentation/perf_counter/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
similarity index 100%
rename from Documentation/perf_counter/util/PERF-VERSION-GEN
rename to tools/perf/util/PERF-VERSION-GEN
diff --git a/Documentation/perf_counter/util/abspath.c b/tools/perf/util/abspath.c
similarity index 100%
rename from Documentation/perf_counter/util/abspath.c
rename to tools/perf/util/abspath.c
diff --git a/Documentation/perf_counter/util/alias.c b/tools/perf/util/alias.c
similarity index 100%
rename from Documentation/perf_counter/util/alias.c
rename to tools/perf/util/alias.c
diff --git a/Documentation/perf_counter/util/cache.h b/tools/perf/util/cache.h
similarity index 100%
rename from Documentation/perf_counter/util/cache.h
rename to tools/perf/util/cache.h
diff --git a/Documentation/perf_counter/util/color.c b/tools/perf/util/color.c
similarity index 100%
rename from Documentation/perf_counter/util/color.c
rename to tools/perf/util/color.c
diff --git a/Documentation/perf_counter/util/color.h b/tools/perf/util/color.h
similarity index 100%
rename from Documentation/perf_counter/util/color.h
rename to tools/perf/util/color.h
diff --git a/Documentation/perf_counter/util/config.c b/tools/perf/util/config.c
similarity index 100%
rename from Documentation/perf_counter/util/config.c
rename to tools/perf/util/config.c
diff --git a/Documentation/perf_counter/util/ctype.c b/tools/perf/util/ctype.c
similarity index 100%
rename from Documentation/perf_counter/util/ctype.c
rename to tools/perf/util/ctype.c
diff --git a/Documentation/perf_counter/util/environment.c b/tools/perf/util/environment.c
similarity index 100%
rename from Documentation/perf_counter/util/environment.c
rename to tools/perf/util/environment.c
diff --git a/Documentation/perf_counter/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
similarity index 100%
rename from Documentation/perf_counter/util/exec_cmd.c
rename to tools/perf/util/exec_cmd.c
diff --git a/Documentation/perf_counter/util/exec_cmd.h b/tools/perf/util/exec_cmd.h
similarity index 100%
rename from Documentation/perf_counter/util/exec_cmd.h
rename to tools/perf/util/exec_cmd.h
diff --git a/Documentation/perf_counter/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
similarity index 100%
rename from Documentation/perf_counter/util/generate-cmdlist.sh
rename to tools/perf/util/generate-cmdlist.sh
diff --git a/Documentation/perf_counter/util/help.c b/tools/perf/util/help.c
similarity index 100%
rename from Documentation/perf_counter/util/help.c
rename to tools/perf/util/help.c
diff --git a/Documentation/perf_counter/util/help.h b/tools/perf/util/help.h
similarity index 100%
rename from Documentation/perf_counter/util/help.h
rename to tools/perf/util/help.h
diff --git a/Documentation/perf_counter/util/levenshtein.c b/tools/perf/util/levenshtein.c
similarity index 100%
rename from Documentation/perf_counter/util/levenshtein.c
rename to tools/perf/util/levenshtein.c
diff --git a/Documentation/perf_counter/util/levenshtein.h b/tools/perf/util/levenshtein.h
similarity index 100%
rename from Documentation/perf_counter/util/levenshtein.h
rename to tools/perf/util/levenshtein.h
diff --git a/Documentation/perf_counter/util/list.h b/tools/perf/util/list.h
similarity index 100%
rename from Documentation/perf_counter/util/list.h
rename to tools/perf/util/list.h
diff --git a/Documentation/perf_counter/util/pager.c b/tools/perf/util/pager.c
similarity index 100%
rename from Documentation/perf_counter/util/pager.c
rename to tools/perf/util/pager.c
diff --git a/Documentation/perf_counter/util/parse-events.c b/tools/perf/util/parse-events.c
similarity index 100%
rename from Documentation/perf_counter/util/parse-events.c
rename to tools/perf/util/parse-events.c
diff --git a/Documentation/perf_counter/util/parse-events.h b/tools/perf/util/parse-events.h
similarity index 100%
rename from Documentation/perf_counter/util/parse-events.h
rename to tools/perf/util/parse-events.h
diff --git a/Documentation/perf_counter/util/parse-options.c b/tools/perf/util/parse-options.c
similarity index 100%
rename from Documentation/perf_counter/util/parse-options.c
rename to tools/perf/util/parse-options.c
diff --git a/Documentation/perf_counter/util/parse-options.h b/tools/perf/util/parse-options.h
similarity index 100%
rename from Documentation/perf_counter/util/parse-options.h
rename to tools/perf/util/parse-options.h
diff --git a/Documentation/perf_counter/util/path.c b/tools/perf/util/path.c
similarity index 100%
rename from Documentation/perf_counter/util/path.c
rename to tools/perf/util/path.c
diff --git a/Documentation/perf_counter/util/quote.c b/tools/perf/util/quote.c
similarity index 100%
rename from Documentation/perf_counter/util/quote.c
rename to tools/perf/util/quote.c
diff --git a/Documentation/perf_counter/util/quote.h b/tools/perf/util/quote.h
similarity index 100%
rename from Documentation/perf_counter/util/quote.h
rename to tools/perf/util/quote.h
diff --git a/Documentation/perf_counter/util/rbtree.c b/tools/perf/util/rbtree.c
similarity index 100%
rename from Documentation/perf_counter/util/rbtree.c
rename to tools/perf/util/rbtree.c
diff --git a/Documentation/perf_counter/util/rbtree.h b/tools/perf/util/rbtree.h
similarity index 100%
rename from Documentation/perf_counter/util/rbtree.h
rename to tools/perf/util/rbtree.h
diff --git a/Documentation/perf_counter/util/run-command.c b/tools/perf/util/run-command.c
similarity index 100%
rename from Documentation/perf_counter/util/run-command.c
rename to tools/perf/util/run-command.c
diff --git a/Documentation/perf_counter/util/run-command.h b/tools/perf/util/run-command.h
similarity index 100%
rename from Documentation/perf_counter/util/run-command.h
rename to tools/perf/util/run-command.h
diff --git a/Documentation/perf_counter/util/sigchain.c b/tools/perf/util/sigchain.c
similarity index 100%
rename from Documentation/perf_counter/util/sigchain.c
rename to tools/perf/util/sigchain.c
diff --git a/Documentation/perf_counter/util/sigchain.h b/tools/perf/util/sigchain.h
similarity index 100%
rename from Documentation/perf_counter/util/sigchain.h
rename to tools/perf/util/sigchain.h
diff --git a/Documentation/perf_counter/util/strbuf.c b/tools/perf/util/strbuf.c
similarity index 100%
rename from Documentation/perf_counter/util/strbuf.c
rename to tools/perf/util/strbuf.c
diff --git a/Documentation/perf_counter/util/strbuf.h b/tools/perf/util/strbuf.h
similarity index 100%
rename from Documentation/perf_counter/util/strbuf.h
rename to tools/perf/util/strbuf.h
diff --git a/Documentation/perf_counter/util/string.c b/tools/perf/util/string.c
similarity index 100%
rename from Documentation/perf_counter/util/string.c
rename to tools/perf/util/string.c
diff --git a/Documentation/perf_counter/util/string.h b/tools/perf/util/string.h
similarity index 100%
rename from Documentation/perf_counter/util/string.h
rename to tools/perf/util/string.h
diff --git a/Documentation/perf_counter/util/symbol.c b/tools/perf/util/symbol.c
similarity index 100%
rename from Documentation/perf_counter/util/symbol.c
rename to tools/perf/util/symbol.c
diff --git a/Documentation/perf_counter/util/symbol.h b/tools/perf/util/symbol.h
similarity index 100%
rename from Documentation/perf_counter/util/symbol.h
rename to tools/perf/util/symbol.h
diff --git a/Documentation/perf_counter/util/usage.c b/tools/perf/util/usage.c
similarity index 100%
rename from Documentation/perf_counter/util/usage.c
rename to tools/perf/util/usage.c
diff --git a/Documentation/perf_counter/util/util.h b/tools/perf/util/util.h
similarity index 100%
rename from Documentation/perf_counter/util/util.h
rename to tools/perf/util/util.h
diff --git a/Documentation/perf_counter/util/wrapper.c b/tools/perf/util/wrapper.c
similarity index 100%
rename from Documentation/perf_counter/util/wrapper.c
rename to tools/perf/util/wrapper.c

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Warning fixes on 32-bit
       [not found]             ` <new-submission>
                                 ` (176 preceding siblings ...)
  2009-06-06 18:48               ` [tip:perfcounters/core] perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ tip-bot for Ingo Molnar
@ 2009-06-06 18:48               ` tip-bot for Arjan van de Ven
  2009-06-06 19:21               ` [tip:perfcounters/core] perf annotate: Automatically pick up vmlinux in the local directory tip-bot for Ingo Molnar
                                 ` (529 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arjan van de Ven @ 2009-06-06 18:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, arjan,
	efault, tglx, mingo

Commit-ID:  7d37a0cbd68c875fa984fa97bcf5c7f4b7950b6d
Gitweb:     http://git.kernel.org/tip/7d37a0cbd68c875fa984fa97bcf5c7f4b7950b6d
Author:     Arjan van de Ven <arjan@linux.intel.com>
AuthorDate: Sat, 6 Jun 2009 20:36:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 20:46:19 +0200

perf_counter tools: Warning fixes on 32-bit

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    4 ++--
 tools/perf/util/symbol.c      |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 116a397..4a3c279 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -668,9 +668,9 @@ static void hist_hit(struct hist_entry *he, uint64_t ip)
 
 	if (verbose >= 3)
 		printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n",
-			(void *)he->sym->start,
+			(void *)(unsigned long)he->sym->start,
 			he->sym->name,
-			(void *)ip, ip - he->sym->start,
+			(void *)(unsigned long)ip, ip - he->sym->start,
 			sym->hist[offset]);
 }
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 23f4f7b..253821d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -21,7 +21,7 @@ static struct symbol *symbol__new(uint64_t start, uint64_t len,
 
 	if (verbose >= 2)
 		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
-			(__u64)start, len, name, self->hist, (void *)obj_start);
+			(__u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
 
 	self->obj_start= obj_start;
 	self->hist = NULL;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf annotate: Automatically pick up vmlinux in the local directory
       [not found]             ` <new-submission>
                                 ` (177 preceding siblings ...)
  2009-06-06 18:48               ` [tip:perfcounters/core] perf_counter tools: Warning fixes on 32-bit tip-bot for Arjan van de Ven
@ 2009-06-06 19:21               ` tip-bot for Ingo Molnar
  2009-06-06 19:24               ` [tip:perfcounters/core] perf_counter tools: Initialize a stack variable before use tip-bot for Arjan van de Ven
                                 ` (528 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 19:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  39273ee9756917129de3190d469b0b120f87e763
Gitweb:     http://git.kernel.org/tip/39273ee9756917129de3190d469b0b120f87e763
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 21:17:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 21:17:03 +0200

perf annotate: Automatically pick up vmlinux in the local directory

Right now kernel debug info does not get resolved by default, because
we dont know where to look for the vmlinux.

The -k option can be used for that - but if no option is given, pick
up vmlinux files in the current directory - in case a kernel hacker
runs profiling from the source directory that the kernel was built in.

The real solution would be to embedd the location (and perhaps the
date/timestamp) of the vmlinux file in /proc/kallsyms, so that
tools can pick it up automatically.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 4a3c279..80c5aa0 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -26,7 +26,7 @@
 #define SHOW_HV		4
 
 static char		const *input_name = "perf.data";
-static char		*vmlinux = NULL;
+static char		*vmlinux = "vmlinux";
 
 static char		default_sort_order[] = "comm,symbol";
 static char		*sort_order = default_sort_order;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Initialize a stack variable before use
       [not found]             ` <new-submission>
                                 ` (178 preceding siblings ...)
  2009-06-06 19:21               ` [tip:perfcounters/core] perf annotate: Automatically pick up vmlinux in the local directory tip-bot for Ingo Molnar
@ 2009-06-06 19:24               ` tip-bot for Arjan van de Ven
  2009-06-06 19:27               ` [tip:perfcounters/core] perf annotate: Fix command line help text tip-bot for Ingo Molnar
                                 ` (527 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arjan van de Ven @ 2009-06-06 19:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, arjan,
	efault, tglx, mingo

Commit-ID:  e9fbc9dc9214d6a9de7d62627be5414804fd7b9f
Gitweb:     http://git.kernel.org/tip/e9fbc9dc9214d6a9de7d62627be5414804fd7b9f
Author:     Arjan van de Ven <arjan@linux.intel.com>
AuthorDate: Sat, 6 Jun 2009 21:22:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 21:22:33 +0200

perf_counter tools: Initialize a stack variable before use

the "perf report" utility crashed in some circumstances
because the "sym" stack variable was not initialized before used
(as also proven by valgrind).

With this fix both the crash goes away and valgrind no longer complains.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 253821d..158588c 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -457,6 +457,8 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 
 	nr_syms = shdr.sh_size / shdr.sh_entsize;
 
+	memset(&sym, 0, sizeof(sym));
+
 	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
 		struct symbol *f;
 		uint64_t obj_start;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf annotate: Fix command line help text
       [not found]             ` <new-submission>
                                 ` (179 preceding siblings ...)
  2009-06-06 19:24               ` [tip:perfcounters/core] perf_counter tools: Initialize a stack variable before use tip-bot for Arjan van de Ven
@ 2009-06-06 19:27               ` tip-bot for Ingo Molnar
  2009-06-07 15:12               ` [tip:perfcounters/core] perf stat: Continue even on counter creation error tip-bot for Ingo Molnar
                                 ` (526 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-06 19:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, arjan,
	efault, tglx, mingo

Commit-ID:  23b87116c7c4f73597965218b66041acbdb4e79f
Gitweb:     http://git.kernel.org/tip/23b87116c7c4f73597965218b66041acbdb4e79f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 21:25:29 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 6 Jun 2009 21:25:29 +0200

perf annotate: Fix command line help text

Arjan noticed this bug in the perf annotate help output:

    -s, --symbol <file>   symbol to annotate

that should be <symbol> instead.

Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 80c5aa0..0e23fe9 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -1300,7 +1300,7 @@ static const char * const annotate_usage[] = {
 static const struct option options[] = {
 	OPT_STRING('i', "input", &input_name, "file",
 		    "input file name"),
-	OPT_STRING('s', "symbol", &sym_hist_filter, "file",
+	OPT_STRING('s', "symbol", &sym_hist_filter, "symbol",
 		    "symbol to annotate"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show symbol address, etc)"),

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Continue even on counter creation error
       [not found]             ` <new-submission>
                                 ` (180 preceding siblings ...)
  2009-06-06 19:27               ` [tip:perfcounters/core] perf annotate: Fix command line help text tip-bot for Ingo Molnar
@ 2009-06-07 15:12               ` tip-bot for Ingo Molnar
  2009-06-07 15:36               ` [tip:perfcounters/core] perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available tip-bot for Ingo Molnar
                                 ` (525 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 15:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  743ee1f80434138495bbb95ffb897acf46b51d54
Gitweb:     http://git.kernel.org/tip/743ee1f80434138495bbb95ffb897acf46b51d54
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 17:06:46 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 17:08:59 +0200

perf stat: Continue even on counter creation error

Before:

 $ perf stat ~/hackbench 5

 error: syscall returned with -1 (No such device)

After:

 $ perf stat ~/hackbench 5
 Time: 1.640

 Performance counter stats for '/home/mingo/hackbench 5':

    6524.570382  task-clock-ticks     #       3.838 CPU utilization factor
          35704  context-switches     #       0.005 M/sec
            191  CPU-migrations       #       0.000 M/sec
           8958  page-faults          #       0.001 M/sec
  <not counted>  cycles
  <not counted>  instructions
  <not counted>  cache-references
  <not counted>  cache-misses

 Wall-clock time elapsed:  1699.999995 msecs

Also add -v (--verbose) option to allow the printing of failed
counter opens.

Plus dont print 'inf' if wall-time is zero (due to jiffies granularity),
instead skip the printing of the CPU utilization factor.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2cbf5a1..184ff95 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -59,6 +59,7 @@ static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
 
 static int			system_wide			=  0;
 static int			inherit				=  1;
+static int			verbose				=  0;
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
@@ -83,7 +84,7 @@ static __u64			event_scaled[MAX_COUNTERS];
 static __u64			runtime_nsecs;
 static __u64			walltime_nsecs;
 
-static void create_perfstat_counter(int counter)
+static void create_perf_stat_counter(int counter)
 {
 	struct perf_counter_attr *attr = attrs + counter;
 
@@ -95,10 +96,8 @@ static void create_perfstat_counter(int counter)
 		int cpu;
 		for (cpu = 0; cpu < nr_cpus; cpu ++) {
 			fd[cpu][counter] = sys_perf_counter_open(attr, -1, cpu, -1, 0);
-			if (fd[cpu][counter] < 0) {
-				printf("perfstat error: syscall returned with %d (%s)\n",
-						fd[cpu][counter], strerror(errno));
-				exit(-1);
+			if (fd[cpu][counter] < 0 && verbose) {
+				printf("Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n", counter, fd[cpu][counter], strerror(errno));
 			}
 		}
 	} else {
@@ -106,10 +105,8 @@ static void create_perfstat_counter(int counter)
 		attr->disabled	= 1;
 
 		fd[0][counter] = sys_perf_counter_open(attr, 0, -1, -1, 0);
-		if (fd[0][counter] < 0) {
-			printf("perfstat error: syscall returned with %d (%s)\n",
-					fd[0][counter], strerror(errno));
-			exit(-1);
+		if (fd[0][counter] < 0 && verbose) {
+			printf("Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n", counter, fd[0][counter], strerror(errno));
 		}
 	}
 }
@@ -147,6 +144,9 @@ static void read_counter(int counter)
 
 	nv = scale ? 3 : 1;
 	for (cpu = 0; cpu < nr_cpus; cpu ++) {
+		if (fd[cpu][counter] < 0)
+			continue;
+
 		res = read(fd[cpu][counter], single_count, nv * sizeof(__u64));
 		assert(res == nv * sizeof(__u64));
 
@@ -204,8 +204,9 @@ static void print_counter(int counter)
 		if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
 			attrs[counter].config == PERF_COUNT_TASK_CLOCK) {
 
-			fprintf(stderr, " # %11.3f CPU utilization factor",
-				(double)count[0] / (double)walltime_nsecs);
+			if (walltime_nsecs)
+				fprintf(stderr, " # %11.3f CPU utilization factor",
+					(double)count[0] / (double)walltime_nsecs);
 		}
 	} else {
 		fprintf(stderr, " %14Ld  %-20s",
@@ -220,7 +221,7 @@ static void print_counter(int counter)
 	fprintf(stderr, "\n");
 }
 
-static int do_perfstat(int argc, const char **argv)
+static int do_perf_stat(int argc, const char **argv)
 {
 	unsigned long long t0, t1;
 	int counter;
@@ -232,7 +233,7 @@ static int do_perfstat(int argc, const char **argv)
 		nr_cpus = 1;
 
 	for (counter = 0; counter < nr_counters; counter++)
-		create_perfstat_counter(counter);
+		create_perf_stat_counter(counter);
 
 	/*
 	 * Enable counters and exec the command:
@@ -305,6 +306,8 @@ static const struct option options[] = {
 			    "system-wide collection from all CPUs"),
 	OPT_BOOLEAN('S', "scale", &scale,
 			    "scale/normalize counters"),
+	OPT_BOOLEAN('v', "verbose", &verbose,
+		    "be more verbose (show counter open errors, etc)"),
 	OPT_END()
 };
 
@@ -335,5 +338,5 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 	signal(SIGALRM, skip_signal);
 	signal(SIGABRT, skip_signal);
 
-	return do_perfstat(argc, argv);
+	return do_perf_stat(argc, argv);
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available
       [not found]             ` <new-submission>
                                 ` (181 preceding siblings ...)
  2009-06-07 15:12               ` [tip:perfcounters/core] perf stat: Continue even on counter creation error tip-bot for Ingo Molnar
@ 2009-06-07 15:36               ` tip-bot for Ingo Molnar
  2009-06-07 15:42               ` [tip:perfcounters/core] perf record: Fall back to cpu-clock-ticks if no PMU tip-bot for Ingo Molnar
                                 ` (524 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 15:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  716c69fecacd42f2a304a97158e04af2786a3f65
Gitweb:     http://git.kernel.org/tip/716c69fecacd42f2a304a97158e04af2786a3f65
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 17:31:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 17:31:52 +0200

perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available

On architectures/CPUs without PMU support but with perfcounters
enabled 'perf top' currently fails because it cannot create a
cycle based hw-perfcounter.

Fall back to the cpu-clock-tick sw-perfcounter in this case, which
is hrtimer based and will always work (as long as perfcounters
is enabled).

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-top.c |  113 +++++++++++++++++++++++++++------------------
 tools/perf/util/usage.c  |   10 ++--
 2 files changed, 73 insertions(+), 50 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index fdc1d58..6da30a1 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -527,58 +527,81 @@ static void mmap_read(void)
 	}
 }
 
-static int __cmd_top(void)
+int nr_poll;
+int group_fd;
+
+static void start_counter(int i, int counter)
 {
 	struct perf_counter_attr *attr;
-	pthread_t thread;
-	int i, counter, group_fd, nr_poll = 0;
 	unsigned int cpu;
+
+	cpu = profile_cpu;
+	if (target_pid == -1 && profile_cpu == -1)
+		cpu = i;
+
+	attr = attrs + counter;
+
+	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+	attr->freq		= freq;
+
+try_again:
+	fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
+
+	if (fd[i][counter] < 0) {
+		int err = errno;
+
+		error("sys_perf_counter_open() syscall returned with %d (%s)\n",
+			fd[i][counter], strerror(err));
+
+		if (err == EPERM)
+			die(" No permission - are you root?\n");
+		/*
+		 * If it's cycles then fall back to hrtimer
+		 * based cpu-clock-tick sw counter, which
+		 * is always available even if no PMU support:
+		 */
+		if (attr->type == PERF_TYPE_HARDWARE
+			&& attr->config == PERF_COUNT_CPU_CYCLES) {
+
+			warning(" ... trying to fall back to cpu-clock-ticks\n");
+			attr->type = PERF_TYPE_SOFTWARE;
+			attr->config = PERF_COUNT_CPU_CLOCK;
+			goto try_again;
+		}
+		exit(-1);
+	}
+	assert(fd[i][counter] >= 0);
+	fcntl(fd[i][counter], F_SETFL, O_NONBLOCK);
+
+	/*
+	 * First counter acts as the group leader:
+	 */
+	if (group && group_fd == -1)
+		group_fd = fd[i][counter];
+
+	event_array[nr_poll].fd = fd[i][counter];
+	event_array[nr_poll].events = POLLIN;
+	nr_poll++;
+
+	mmap_array[i][counter].counter = counter;
+	mmap_array[i][counter].prev = 0;
+	mmap_array[i][counter].mask = mmap_pages*page_size - 1;
+	mmap_array[i][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
+			PROT_READ, MAP_SHARED, fd[i][counter], 0);
+	if (mmap_array[i][counter].base == MAP_FAILED)
+		die("failed to mmap with %d (%s)\n", errno, strerror(errno));
+}
+
+static int __cmd_top(void)
+{
+	pthread_t thread;
+	int i, counter;
 	int ret;
 
 	for (i = 0; i < nr_cpus; i++) {
 		group_fd = -1;
-		for (counter = 0; counter < nr_counters; counter++) {
-
-			cpu	= profile_cpu;
-			if (target_pid == -1 && profile_cpu == -1)
-				cpu = i;
-
-			attr = attrs + counter;
-
-			attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
-			attr->freq		= freq;
-
-			fd[i][counter] = sys_perf_counter_open(attr, target_pid, cpu, group_fd, 0);
-			if (fd[i][counter] < 0) {
-				int err = errno;
-
-				error("syscall returned with %d (%s)\n",
-					fd[i][counter], strerror(err));
-				if (err == EPERM)
-					printf("Are you root?\n");
-				exit(-1);
-			}
-			assert(fd[i][counter] >= 0);
-			fcntl(fd[i][counter], F_SETFL, O_NONBLOCK);
-
-			/*
-			 * First counter acts as the group leader:
-			 */
-			if (group && group_fd == -1)
-				group_fd = fd[i][counter];
-
-			event_array[nr_poll].fd = fd[i][counter];
-			event_array[nr_poll].events = POLLIN;
-			nr_poll++;
-
-			mmap_array[i][counter].counter = counter;
-			mmap_array[i][counter].prev = 0;
-			mmap_array[i][counter].mask = mmap_pages*page_size - 1;
-			mmap_array[i][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
-					PROT_READ, MAP_SHARED, fd[i][counter], 0);
-			if (mmap_array[i][counter].base == MAP_FAILED)
-				die("failed to mmap with %d (%s)\n", errno, strerror(errno));
-		}
+		for (counter = 0; counter < nr_counters; counter++)
+			start_counter(i, counter);
 	}
 
 	/* Wait for a minimal set of events before starting the snapshot */
diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c
index 2cad286..e16bf9a 100644
--- a/tools/perf/util/usage.c
+++ b/tools/perf/util/usage.c
@@ -9,29 +9,29 @@ static void report(const char *prefix, const char *err, va_list params)
 {
 	char msg[1024];
 	vsnprintf(msg, sizeof(msg), err, params);
-	fprintf(stderr, "%s%s\n", prefix, msg);
+	fprintf(stderr, " %s%s\n", prefix, msg);
 }
 
 static NORETURN void usage_builtin(const char *err)
 {
-	fprintf(stderr, "\n usage: %s\n", err);
+	fprintf(stderr, "\n Usage: %s\n", err);
 	exit(129);
 }
 
 static NORETURN void die_builtin(const char *err, va_list params)
 {
-	report("fatal: ", err, params);
+	report(" Fatal: ", err, params);
 	exit(128);
 }
 
 static void error_builtin(const char *err, va_list params)
 {
-	report("error: ", err, params);
+	report(" Error: ", err, params);
 }
 
 static void warn_builtin(const char *warn, va_list params)
 {
-	report("warning: ", warn, params);
+	report(" Warning: ", warn, params);
 }
 
 /* If we are in a dlopen()ed .so write to a global variable would segfault

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Fall back to cpu-clock-ticks if no PMU
       [not found]             ` <new-submission>
                                 ` (182 preceding siblings ...)
  2009-06-07 15:36               ` [tip:perfcounters/core] perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available tip-bot for Ingo Molnar
@ 2009-06-07 15:42               ` tip-bot for Ingo Molnar
  2009-06-07 15:51               ` [tip:perfcounters/core] perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER tip-bot for Ingo Molnar
                                 ` (523 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  3da297a60f7e8840f79f7d0b343af078890939ea
Gitweb:     http://git.kernel.org/tip/3da297a60f7e8840f79f7d0b343af078890939ea
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 17:39:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 17:39:02 +0200

perf record: Fall back to cpu-clock-ticks if no PMU

On architectures/CPUs without PMU support but with perfcounters
enabled 'perf record' currently fails because it cannot create a
cycle based hw-perfcounter.

Fall back to the cpu-clock-tick sw-perfcounter in this case, which
is hrtimer based and will always work (as long as perfcounters
are enabled).

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   25 +++++++++++++++++++++++--
 tools/perf/builtin-top.c    |   14 ++++++++++----
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index aeab9c4..8786629 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -37,6 +37,7 @@ static pid_t			target_pid			= -1;
 static int			inherit				= 1;
 static int			force				= 0;
 static int			append_file			= 0;
+static int			verbose				= 0;
 
 static long			samples;
 static struct timeval		last_read;
@@ -349,17 +350,35 @@ static void create_counter(int counter, int cpu, pid_t pid)
 
 	track = 0; /* only the first counter needs these */
 
+try_again:
 	fd[nr_cpu][counter] = sys_perf_counter_open(attr, pid, cpu, group_fd, 0);
 
 	if (fd[nr_cpu][counter] < 0) {
 		int err = errno;
 
-		error("syscall returned with %d (%s)\n",
+		if (verbose)
+			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
 				fd[nr_cpu][counter], strerror(err));
 		if (err == EPERM)
-			printf("Are you root?\n");
+			die("Permission error - are you root?\n");
+
+		/*
+		 * If it's cycles then fall back to hrtimer
+		 * based cpu-clock-tick sw counter, which
+		 * is always available even if no PMU support:
+		 */
+		if (attr->type == PERF_TYPE_HARDWARE
+			&& attr->config == PERF_COUNT_CPU_CYCLES) {
+
+			if (verbose)
+				warning(" ... trying to fall back to cpu-clock-ticks\n");
+			attr->type = PERF_TYPE_SOFTWARE;
+			attr->config = PERF_COUNT_CPU_CLOCK;
+			goto try_again;
+		}
 		exit(-1);
 	}
+
 	assert(fd[nr_cpu][counter] >= 0);
 	fcntl(fd[nr_cpu][counter], F_SETFL, O_NONBLOCK);
 
@@ -519,6 +538,8 @@ static const struct option options[] = {
 		    "profile at this frequency"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
 		    "number of mmap data pages"),
+	OPT_BOOLEAN('v', "verbose", &verbose,
+		    "be more verbose (show counter open errors, etc)"),
 	OPT_END()
 };
 
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6da30a1..1f8c97d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -65,6 +65,7 @@ static int			group				=  0;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			= 16;
 static int			freq				=  0;
+static int			verbose				=  0;
 
 static char			*sym_filter;
 static unsigned long		filter_start;
@@ -550,11 +551,12 @@ try_again:
 	if (fd[i][counter] < 0) {
 		int err = errno;
 
-		error("sys_perf_counter_open() syscall returned with %d (%s)\n",
-			fd[i][counter], strerror(err));
+		if (verbose)
+			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
+				fd[i][counter], strerror(err));
 
 		if (err == EPERM)
-			die(" No permission - are you root?\n");
+			die("No permission - are you root?\n");
 		/*
 		 * If it's cycles then fall back to hrtimer
 		 * based cpu-clock-tick sw counter, which
@@ -563,7 +565,9 @@ try_again:
 		if (attr->type == PERF_TYPE_HARDWARE
 			&& attr->config == PERF_COUNT_CPU_CYCLES) {
 
-			warning(" ... trying to fall back to cpu-clock-ticks\n");
+			if (verbose)
+				warning(" ... trying to fall back to cpu-clock-ticks\n");
+
 			attr->type = PERF_TYPE_SOFTWARE;
 			attr->config = PERF_COUNT_CPU_CLOCK;
 			goto try_again;
@@ -673,6 +677,8 @@ static const struct option options[] = {
 		    "profile at this frequency"),
 	OPT_INTEGER('E', "entries", &print_entries,
 		    "display this many functions"),
+	OPT_BOOLEAN('v', "verbose", &verbose,
+		    "be more verbose (show counter open errors, etc)"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER
       [not found]             ` <new-submission>
                                 ` (183 preceding siblings ...)
  2009-06-07 15:42               ` [tip:perfcounters/core] perf record: Fall back to cpu-clock-ticks if no PMU tip-bot for Ingo Molnar
@ 2009-06-07 15:51               ` tip-bot for Ingo Molnar
  2009-06-07 16:00               ` [tip:perfcounters/core] perf report: Print more expressive message in case of file open error tip-bot for Ingo Molnar
                                 ` (522 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 15:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  30c806a094493beb7691bc7957dfa02dee96230a
Gitweb:     http://git.kernel.org/tip/30c806a094493beb7691bc7957dfa02dee96230a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 17:46:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 17:46:24 +0200

perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER

If perf is run on a !CONFIG_PERF_COUNTER kernel right now it
bails out with no messages or with confusing messages.

Standardize this case some more and explain the situation.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |    7 ++++---
 tools/perf/builtin-top.c    |    8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 8786629..deaee42 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -356,9 +356,6 @@ try_again:
 	if (fd[nr_cpu][counter] < 0) {
 		int err = errno;
 
-		if (verbose)
-			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
-				fd[nr_cpu][counter], strerror(err));
 		if (err == EPERM)
 			die("Permission error - are you root?\n");
 
@@ -376,6 +373,10 @@ try_again:
 			attr->config = PERF_COUNT_CPU_CLOCK;
 			goto try_again;
 		}
+		printf("\n");
+		error("perfcounter syscall returned with %d (%s)\n",
+			fd[nr_cpu][counter], strerror(err));
+		die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n");
 		exit(-1);
 	}
 
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1f8c97d..be1698f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -551,10 +551,6 @@ try_again:
 	if (fd[i][counter] < 0) {
 		int err = errno;
 
-		if (verbose)
-			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
-				fd[i][counter], strerror(err));
-
 		if (err == EPERM)
 			die("No permission - are you root?\n");
 		/*
@@ -572,6 +568,10 @@ try_again:
 			attr->config = PERF_COUNT_CPU_CLOCK;
 			goto try_again;
 		}
+		printf("\n");
+		error("perfcounter syscall returned with %d (%s)\n",
+			fd[i][counter], strerror(err));
+		die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n");
 		exit(-1);
 	}
 	assert(fd[i][counter] >= 0);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print more expressive message in case of file open error
       [not found]             ` <new-submission>
                                 ` (184 preceding siblings ...)
  2009-06-07 15:51               ` [tip:perfcounters/core] perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER tip-bot for Ingo Molnar
@ 2009-06-07 16:00               ` tip-bot for Ingo Molnar
  2009-06-07 17:21               ` [tip:perfcounters/core] perf stat: Print out instructins/cycle metric tip-bot for Ingo Molnar
                                 ` (521 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 16:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  a14832ff977e78d1982cdf78cdabb1f2320d9ac8
Gitweb:     http://git.kernel.org/tip/a14832ff977e78d1982cdf78cdabb1f2320d9ac8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 17:58:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 17:58:23 +0200

perf report: Print more expressive message in case of file open error

Before:

 $ perf report
 failed to open file: No such file or directory

After:

 $ perf report
  failed to open file: perf.data  (try 'perf record' first)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 242e09f..f053a74 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1120,7 +1120,10 @@ static int __cmd_report(void)
 
 	input = open(input_name, O_RDONLY);
 	if (input < 0) {
-		perror("failed to open file");
+		fprintf(stderr, " failed to open file: %s", input_name);
+		if (!strcmp(input_name, "perf.data"))
+			fprintf(stderr, "  (try 'perf record' first)");
+		fprintf(stderr, "\n");
 		exit(-1);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Print out instructins/cycle metric
       [not found]             ` <new-submission>
                                 ` (185 preceding siblings ...)
  2009-06-07 16:00               ` [tip:perfcounters/core] perf report: Print more expressive message in case of file open error tip-bot for Ingo Molnar
@ 2009-06-07 17:21               ` tip-bot for Ingo Molnar
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Core2 support tip-bot for Thomas Gleixner
                                 ` (520 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-07 17:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  e779898aa74cd2e97216368b3f3689ceffe8aeed
Gitweb:     http://git.kernel.org/tip/e779898aa74cd2e97216368b3f3689ceffe8aeed
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 7 Jun 2009 18:14:46 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 18:14:46 +0200

perf stat: Print out instructins/cycle metric

Before:

     7549326754  cycles               #    3201.811 M/sec
    10007594937  instructions         #    4244.408 M/sec

After:

     7542051194  cycles               #    3201.996 M/sec
    10007743852  instructions         #    4248.811 M/sec # 1.327 per cycle

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 184ff95..8085509 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -83,6 +83,7 @@ static __u64			event_scaled[MAX_COUNTERS];
 
 static __u64			runtime_nsecs;
 static __u64			walltime_nsecs;
+static __u64			runtime_cycles;
 
 static void create_perf_stat_counter(int counter)
 {
@@ -177,6 +178,9 @@ static void read_counter(int counter)
 	if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
 		attrs[counter].config == PERF_COUNT_TASK_CLOCK)
 		runtime_nsecs = count[0];
+	if (attrs[counter].type == PERF_TYPE_HARDWARE &&
+		attrs[counter].config == PERF_COUNT_CPU_CYCLES)
+		runtime_cycles = count[0];
 }
 
 /*
@@ -214,6 +218,13 @@ static void print_counter(int counter)
 		if (runtime_nsecs)
 			fprintf(stderr, " # %11.3f M/sec",
 				(double)count[0]/runtime_nsecs*1000.0);
+		if (runtime_cycles &&
+			attrs[counter].type == PERF_TYPE_HARDWARE &&
+				attrs[counter].config == PERF_COUNT_INSTRUCTIONS) {
+
+			fprintf(stderr, " # %1.3f per cycle",
+				(double)count[0] / (double)runtime_cycles);
+		}
 	}
 	if (scaled)
 		fprintf(stderr, "  (scaled from %.2f%%)",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Core2 support
       [not found]             ` <new-submission>
                                 ` (186 preceding siblings ...)
  2009-06-07 17:21               ` [tip:perfcounters/core] perf stat: Print out instructins/cycle metric tip-bot for Ingo Molnar
@ 2009-06-08 10:31               ` tip-bot for Thomas Gleixner
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Atom support tip-bot for Thomas Gleixner
                                 ` (519 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-06-08 10:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  0312af84164215a452f2a94957ebd9bce86e0204
Gitweb:     http://git.kernel.org/tip/0312af84164215a452f2a94957ebd9bce86e0204
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 8 Jun 2009 07:42:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 11:18:26 +0200

perf_counter, x86: Implement generalized cache event types, add Core2 support

Fill in core2_hw_cache_event_id[] with the Core2 model specific events.

The events can be used in all the tools via the -e (--event) parameter,
for example "-e l1-misses" or -"-e l2-accesses" or "-e l2-write-misses".

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   85 +++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index e86679f..b1f71ff 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -194,7 +194,90 @@ static const u64 core2_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
 {
-	/* To be filled in */
+ [ C(L1D) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI          */
+		[ C(RESULT_MISS)   ] = 0x0140, /* L1D_CACHE_LD.I_STATE       */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI          */
+		[ C(RESULT_MISS)   ] = 0x0141, /* L1D_CACHE_ST.I_STATE       */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x104e, /* L1D_PREFETCH.REQUESTS      */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* L1I.READS                  */
+		[ C(RESULT_MISS)   ] = 0x0081, /* L1I.MISSES                 */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L2  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
+		[ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
+		[ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI  (alias) */
+		[ C(RESULT_MISS)   ] = 0x0208, /* DTLB_MISSES.MISS_LD        */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI  (alias) */
+		[ C(RESULT_MISS)   ] = 0x0808, /* DTLB_MISSES.MISS_ST        */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
+		[ C(RESULT_MISS)   ] = 0x1282, /* ITLBMISSES                 */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
+		[ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
 };
 
 static const u64 atom_hw_cache_event_ids

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Atom support
       [not found]             ` <new-submission>
                                 ` (187 preceding siblings ...)
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Core2 support tip-bot for Thomas Gleixner
@ 2009-06-08 10:31               ` tip-bot for Thomas Gleixner
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter: Clean up x86 boot messages tip-bot for Ingo Molnar
                                 ` (518 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-06-08 10:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  ad689220614b6c7c0b13b70d742f358e9310e71e
Gitweb:     http://git.kernel.org/tip/ad689220614b6c7c0b13b70d742f358e9310e71e
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 8 Jun 2009 09:30:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 11:18:27 +0200

perf_counter, x86: Implement generalized cache event types, add Atom support

Fill in core2_hw_cache_event_id[] with the Atom model specific events.

The events can be used in all the tools via the -e (--event) parameter,
for example "-e l1-misses" or -"-e l2-accesses" or "-e l2-write-misses".

( Note: these are straight from the Intel manuals - not tested yet.)

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   85 +++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index b1f71ff..71590e0 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -285,7 +285,90 @@ static const u64 atom_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
 {
-	/* To be filled in */
+ [ C(L1D) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x2140, /* L1D_CACHE.LD               */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x2241, /* L1D_CACHE.ST               */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* L1I.READS                  */
+		[ C(RESULT_MISS)   ] = 0x0081, /* L1I.MISSES                 */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L2  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x4f29, /* L2_LD.MESI                 */
+		[ C(RESULT_MISS)   ] = 0x4129, /* L2_LD.ISTATE               */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x4f2A, /* L2_ST.MESI                 */
+		[ C(RESULT_MISS)   ] = 0x412A, /* L2_ST.ISTATE               */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI  (alias) */
+		[ C(RESULT_MISS)   ] = 0x0508, /* DTLB_MISSES.MISS_LD        */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI  (alias) */
+		[ C(RESULT_MISS)   ] = 0x0608, /* DTLB_MISSES.MISS_ST        */
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P         */
+		[ C(RESULT_MISS)   ] = 0x0282, /* ITLB.MISSES                */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ANY        */
+		[ C(RESULT_MISS)   ] = 0x00c5, /* BP_INST_RETIRED.MISPRED    */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
 };
 
 static u64 intel_pmu_raw_event(u64 event)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Clean up x86 boot messages
       [not found]             ` <new-submission>
                                 ` (188 preceding siblings ...)
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add Atom support tip-bot for Thomas Gleixner
@ 2009-06-08 10:31               ` tip-bot for Ingo Molnar
  2009-06-08 20:36               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support tip-bot for Thomas Gleixner
                                 ` (517 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-08 10:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  1123e3ad73697d64ad99f0104bbe49f8b52d7d65
Gitweb:     http://git.kernel.org/tip/1123e3ad73697d64ad99f0104bbe49f8b52d7d65
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 11:25:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 12:29:30 +0200

perf_counter: Clean up x86 boot messages

Standardize and tidy up all the messages we print during
perfcounter initialization.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   46 ++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 71590e0..0339d19 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1298,23 +1298,22 @@ static int intel_pmu_init(void)
 	if (version < 2)
 		return -ENODEV;
 
-	x86_pmu = intel_pmu;
-	x86_pmu.version = version;
-	x86_pmu.num_counters = eax.split.num_counters;
+	x86_pmu				= intel_pmu;
+	x86_pmu.version			= version;
+	x86_pmu.num_counters		= eax.split.num_counters;
+	x86_pmu.counter_bits		= eax.split.bit_width;
+	x86_pmu.counter_mask		= (1ULL << eax.split.bit_width) - 1;
 
 	/*
 	 * Quirk: v2 perfmon does not report fixed-purpose counters, so
 	 * assume at least 3 counters:
 	 */
-	x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3);
-
-	x86_pmu.counter_bits = eax.split.bit_width;
-	x86_pmu.counter_mask = (1ULL << eax.split.bit_width) - 1;
+	x86_pmu.num_counters_fixed	= max((int)edx.split.num_counters_fixed, 3);
 
 	rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
 
 	/*
-	 * Nehalem:
+	 * Install the hw-cache-events table:
 	 */
 	switch (boot_cpu_data.x86_model) {
 	case 17:
@@ -1322,7 +1321,7 @@ static int intel_pmu_init(void)
 		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
 			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
 
-		pr_info("... installed Core2 event tables\n");
+		pr_cont("Core2 events, ");
 		break;
 	default:
 	case 26:
@@ -1330,14 +1329,14 @@ static int intel_pmu_init(void)
 		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
 			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
 
-		pr_info("... installed Nehalem/Corei7 event tables\n");
+		pr_cont("Nehalem/Corei7 events, ");
 		break;
 	case 28:
 		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
 		sizeof(u64)*PERF_COUNT_HW_CACHE_MAX*
 			PERF_COUNT_HW_CACHE_OP_MAX*PERF_COUNT_HW_CACHE_RESULT_MAX);
 
-		pr_info("... installed Atom event tables\n");
+		pr_cont("Atom events, ");
 		break;
 	}
 	return 0;
@@ -1353,6 +1352,8 @@ void __init init_hw_perf_counters(void)
 {
 	int err;
 
+	pr_info("Performance Counters: ");
+
 	switch (boot_cpu_data.x86_vendor) {
 	case X86_VENDOR_INTEL:
 		err = intel_pmu_init();
@@ -1363,14 +1364,13 @@ void __init init_hw_perf_counters(void)
 	default:
 		return;
 	}
-	if (err != 0)
+	if (err != 0) {
+		pr_cont("no PMU driver, software counters only.\n");
 		return;
+	}
 
-	pr_info("%s Performance Monitoring support detected.\n", x86_pmu.name);
-	pr_info("... version:         %d\n", x86_pmu.version);
-	pr_info("... bit width:       %d\n", x86_pmu.counter_bits);
+	pr_cont("%s PMU driver.\n", x86_pmu.name);
 
-	pr_info("... num counters:    %d\n", x86_pmu.num_counters);
 	if (x86_pmu.num_counters > X86_PMC_MAX_GENERIC) {
 		x86_pmu.num_counters = X86_PMC_MAX_GENERIC;
 		WARN(1, KERN_ERR "hw perf counters %d > max(%d), clipping!",
@@ -1379,23 +1379,25 @@ void __init init_hw_perf_counters(void)
 	perf_counter_mask = (1 << x86_pmu.num_counters) - 1;
 	perf_max_counters = x86_pmu.num_counters;
 
-	pr_info("... value mask:      %016Lx\n", x86_pmu.counter_mask);
-	pr_info("... max period:      %016Lx\n", x86_pmu.max_period);
-
 	if (x86_pmu.num_counters_fixed > X86_PMC_MAX_FIXED) {
 		x86_pmu.num_counters_fixed = X86_PMC_MAX_FIXED;
 		WARN(1, KERN_ERR "hw perf counters fixed %d > max(%d), clipping!",
 		     x86_pmu.num_counters_fixed, X86_PMC_MAX_FIXED);
 	}
-	pr_info("... fixed counters:  %d\n", x86_pmu.num_counters_fixed);
 
 	perf_counter_mask |=
 		((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED;
 
-	pr_info("... counter mask:    %016Lx\n", perf_counter_mask);
-
 	perf_counters_lapic_init();
 	register_die_notifier(&perf_counter_nmi_notifier);
+
+	pr_info("... version:                 %d\n",     x86_pmu.version);
+	pr_info("... bit width:               %d\n",     x86_pmu.counter_bits);
+	pr_info("... generic counters:        %d\n",     x86_pmu.num_counters);
+	pr_info("... value mask:              %016Lx\n", x86_pmu.counter_mask);
+	pr_info("... max period:              %016Lx\n", x86_pmu.max_period);
+	pr_info("... fixed-purpose counters:  %d\n",     x86_pmu.num_counters_fixed);
+	pr_info("... counter mask:            %016Lx\n", perf_counter_mask);
 }
 
 static inline void x86_pmu_read(struct perf_counter *counter)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support
       [not found]             ` <new-submission>
                                 ` (189 preceding siblings ...)
  2009-06-08 10:31               ` [tip:perfcounters/core] perf_counter: Clean up x86 boot messages tip-bot for Ingo Molnar
@ 2009-06-08 20:36               ` tip-bot for Thomas Gleixner
  2009-06-09  8:43                 ` Peter Zijlstra
  2009-06-08 21:33               ` tip-bot for Thomas Gleixner
                                 ` (516 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-06-08 20:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  d3ad70660a0bf6d1a3692093939d238fe8add498
Gitweb:     http://git.kernel.org/tip/d3ad70660a0bf6d1a3692093939d238fe8add498
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 8 Jun 2009 22:33:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 22:33:10 +0200

perf_counter, x86: Implement generalized cache event types, add AMD support

Fill in amd_hw_cache_event_id[] with the AMD CPU specific events,
for family 0x0f, 0x10 and 0x11.

There's apparently no distinction between load and store events, so
we only fill in the load events.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |  102 ++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 0339d19..0c2136b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -389,6 +389,97 @@ static u64 intel_pmu_raw_event(u64 event)
 	return event & CORE_EVNTSEL_MASK;
 }
 
+static const u64 amd_0f_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
+		[ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L2  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
+		[ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
+		[ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+};
+
 /*
  * AMD Performance Monitor K7 and later.
  */
@@ -1345,6 +1436,17 @@ static int intel_pmu_init(void)
 static int amd_pmu_init(void)
 {
 	x86_pmu = amd_pmu;
+
+	switch (boot_cpu_data.x86 >= 0x0f) {
+	case 0x0f:
+	case 0x10:
+	case 0x11:
+		memcpy(hw_cache_event_ids, amd_0f_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		pr_cont("AMD Family 0f/10/11 events, ");
+		break;
+	}
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support
       [not found]             ` <new-submission>
                                 ` (190 preceding siblings ...)
  2009-06-08 20:36               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support tip-bot for Thomas Gleixner
@ 2009-06-08 21:33               ` tip-bot for Thomas Gleixner
  2009-06-08 21:33               ` [tip:perfcounters/core] perf_counter tools: Standardize color printing tip-bot for Ingo Molnar
                                 ` (515 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-06-08 21:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f86748e91a14bd6cc49477560f33ed5d59896e89
Gitweb:     http://git.kernel.org/tip/f86748e91a14bd6cc49477560f33ed5d59896e89
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 8 Jun 2009 22:33:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 23:10:37 +0200

perf_counter, x86: Implement generalized cache event types, add AMD support

Fill in amd_hw_cache_event_id[] with the AMD CPU specific events,
for family 0x0f, 0x10 and 0x11.

There's apparently no distinction between load and store events, so
we only fill in the load events.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |  102 ++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 0339d19..93af821 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -389,6 +389,97 @@ static u64 intel_pmu_raw_event(u64 event)
 	return event & CORE_EVNTSEL_MASK;
 }
 
+static const u64 amd_0f_hw_cache_event_ids
+				[PERF_COUNT_HW_CACHE_MAX]
+				[PERF_COUNT_HW_CACHE_OP_MAX]
+				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
+{
+ [ C(L1D) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L1I ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
+		[ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(L2  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(ITLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
+		[ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+ [ C(BPU ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
+		[ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = -1,
+		[ C(RESULT_MISS)   ] = -1,
+	},
+ },
+};
+
 /*
  * AMD Performance Monitor K7 and later.
  */
@@ -1345,6 +1436,17 @@ static int intel_pmu_init(void)
 static int amd_pmu_init(void)
 {
 	x86_pmu = amd_pmu;
+
+	switch (boot_cpu_data.x86) {
+	case 0x0f:
+	case 0x10:
+	case 0x11:
+		memcpy(hw_cache_event_ids, amd_0f_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		pr_cont("AMD Family 0f/10/11 events, ");
+		break;
+	}
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Standardize color printing
       [not found]             ` <new-submission>
                                 ` (191 preceding siblings ...)
  2009-06-08 21:33               ` tip-bot for Thomas Gleixner
@ 2009-06-08 21:33               ` tip-bot for Ingo Molnar
  2009-06-10  9:51               ` [tip:core/locking] spinlock: Add missing __raw_spin_lock_flags() stub for UP tip-bot for Benjamin Herrenschmidt
                                 ` (514 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-08 21:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  aefcf37b82886260d8540c9fb815e613c8977e06
Gitweb:     http://git.kernel.org/tip/aefcf37b82886260d8540c9fb815e613c8977e06
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 8 Jun 2009 23:15:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 8 Jun 2009 23:15:28 +0200

perf_counter tools: Standardize color printing

The rule is:

 - high overhead: red
 -  mid overhead: green
 -  low overhead: normal (white/black)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    5 +++--
 tools/perf/builtin-report.c   |   13 ++++++++-----
 tools/perf/builtin-top.c      |   13 ++++++++-----
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 0e23fe9..3334a8b 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -1085,8 +1085,9 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
 			percent = 100.0 * hits / sym->hist_sum;
 
 		/*
-		 * We color high-overhead entries in red, low-overhead
-		 * entries in green - and keep the middle ground normal:
+		 * We color high-overhead entries in red, mid-overhead
+		 * entries in green - and keep the low overhead places
+		 * normal:
 		 */
 		if (percent >= 5.0)
 			color = PERF_COLOR_RED;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 61d8718..0b18cb9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -693,13 +693,16 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 		char *color = PERF_COLOR_NORMAL;
 
 		/*
-		 * We color high-overhead entries in red, low-overhead
-		 * entries in green - and keep the middle ground normal:
+		 * We color high-overhead entries in red, mid-overhead
+		 * entries in green - and keep the low overhead places
+		 * normal:
 		 */
-		if (percent >= 5.0)
+		if (percent >= 5.0) {
 			color = PERF_COLOR_RED;
-		if (percent < 0.5)
-			color = PERF_COLOR_GREEN;
+		} else {
+			if (percent >= 0.5)
+				color = PERF_COLOR_GREEN;
+		}
 
 		ret = color_fprintf(fp, color, "   %6.2f%%",
 				(self->count * 100.0) / total_samples);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index be1698f..8ba2480 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -248,13 +248,16 @@ static void print_sym_table(void)
 					 sum_ksamples));
 
 		/*
-		 * We color high-overhead entries in red, low-overhead
-		 * entries in green - and keep the middle ground normal:
+		 * We color high-overhead entries in red, mid-overhead
+		 * entries in green - and keep the low overhead places
+		 * normal:
 		 */
-		if (pcnt >= 5.0)
+		if (pcnt >= 5.0) {
 			color = PERF_COLOR_RED;
-		if (pcnt < 0.5)
-			color = PERF_COLOR_GREEN;
+		} else {
+			if (pcnt >= 0.5)
+				color = PERF_COLOR_GREEN;
+		}
 
 		if (nr_counters == 1)
 			printf("%20.2f - ", syme->weight);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Implement generalized cache event types
  2009-06-06 11:16               ` [tip:perfcounters/core] perf_counter: Implement generalized cache event types tip-bot for Ingo Molnar
@ 2009-06-09  8:15                 ` Peter Zijlstra
  2009-06-09 12:15                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-09  8:15 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, efault, mtosatti, tglx,
	cjashfor, mingo
  Cc: linux-tip-commits

On Sat, 2009-06-06 at 11:16 +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  8326f44da090d6d304d29b9fdc7fb3e20889e329
> Gitweb:     http://git.kernel.org/tip/8326f44da090d6d304d29b9fdc7fb3e20889e329
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Fri, 5 Jun 2009 20:22:46 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 6 Jun 2009 13:14:47 +0200
> 
> perf_counter: Implement generalized cache event types
> 
> Extend generic event enumeration with the PERF_TYPE_HW_CACHE
> method.
> 
> This is a 3-dimensional space:
> 
>        { L1-D, L1-I, L2, ITLB, DTLB, BPU } x
>        { load, store, prefetch } x
>        { accesses, misses }
> 
> User-space passes in the 3 coordinates and the kernel provides
> a counter. (if the hardware supports that type and if the
> combination makes sense.)
> 
> Combinations that make no sense produce a -EINVAL.
> Combinations that are not supported by the hardware produce -ENOTSUP.
> 
> Extend the tools to deal with this, and rewrite the event symbol
> parsing code with various popular aliases for the units and
> access methods above. So 'l1-cache-miss' and 'l1d-read-ops' are
> both valid aliases.
> 
> ( x86 is supported for now, with the Nehalem event table filled in,
>   and with Core2 and Atom having placeholder tables. )
> 

> +++ b/include/linux/perf_counter.h
> @@ -28,6 +28,7 @@ enum perf_event_types {
>  	PERF_TYPE_HARDWARE		= 0,
>  	PERF_TYPE_SOFTWARE		= 1,
>  	PERF_TYPE_TRACEPOINT		= 2,
> +	PERF_TYPE_HW_CACHE		= 3,
>  
>  	/*
>  	 * available TYPE space, raw is the max value.
> @@ -56,6 +57,39 @@ enum attr_ids {
>  };
>  
>  /*
> + * Generalized hardware cache counters:
> + *
> + *       { L1-D, L1-I, L2, LLC, ITLB, DTLB, BPU } x
> + *       { read, write, prefetch } x
> + *       { accesses, misses }
> + */
> +enum hw_cache_id {
> +	PERF_COUNT_HW_CACHE_L1D,
> +	PERF_COUNT_HW_CACHE_L1I,
> +	PERF_COUNT_HW_CACHE_L2,
> +	PERF_COUNT_HW_CACHE_DTLB,
> +	PERF_COUNT_HW_CACHE_ITLB,
> +	PERF_COUNT_HW_CACHE_BPU,
> +
> +	PERF_COUNT_HW_CACHE_MAX,
> +};
> +
> +enum hw_cache_op_id {
> +	PERF_COUNT_HW_CACHE_OP_READ,
> +	PERF_COUNT_HW_CACHE_OP_WRITE,
> +	PERF_COUNT_HW_CACHE_OP_PREFETCH,
> +
> +	PERF_COUNT_HW_CACHE_OP_MAX,
> +};
> +
> +enum hw_cache_op_result_id {
> +	PERF_COUNT_HW_CACHE_RESULT_ACCESS,
> +	PERF_COUNT_HW_CACHE_RESULT_MISS,
> +
> +	PERF_COUNT_HW_CACHE_RESULT_MAX,
> +};

May I suggest we do the below instead? Some hardware doesn't make the
read/write distinction and would therefore have an utterly empty table.

Furthermore, also splitting the hit/miss into a bitfield allows us to
have hit/miss and the combined value.

---
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 3586df8..1fb72fc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -64,29 +64,32 @@ enum attr_ids {
  *       { accesses, misses }
  */
 enum hw_cache_id {
-	PERF_COUNT_HW_CACHE_L1D,
-	PERF_COUNT_HW_CACHE_L1I,
-	PERF_COUNT_HW_CACHE_L2,
-	PERF_COUNT_HW_CACHE_DTLB,
-	PERF_COUNT_HW_CACHE_ITLB,
-	PERF_COUNT_HW_CACHE_BPU,
+	PERF_COUNT_HW_CACHE_L1D		= 0,
+	PERF_COUNT_HW_CACHE_L1I		= 1,
+	PERF_COUNT_HW_CACHE_L2		= 2,
+	PERF_COUNT_HW_CACHE_DTLB	= 3,
+	PERF_COUNT_HW_CACHE_ITLB	= 4,
+	PERF_COUNT_HW_CACHE_BPU		= 5,
 
 	PERF_COUNT_HW_CACHE_MAX,
 };
 
 enum hw_cache_op_id {
-	PERF_COUNT_HW_CACHE_OP_READ,
-	PERF_COUNT_HW_CACHE_OP_WRITE,
-	PERF_COUNT_HW_CACHE_OP_PREFETCH,
+	PERF_COUNT_HW_CACHE_OP_READ		= 0x1,
+	PERF_COUNT_HW_CACHE_OP_WRITE		= 0x2,
+	PERF_COUNT_HW_CACHE_OP_ACCESS		= 0x3, /* either READ or WRITE */
+	PERF_COUNT_HW_CACHE_OP_PREFETCH		= 0x4, /* XXX should we qualify this with either READ/WRITE? */
 
-	PERF_COUNT_HW_CACHE_OP_MAX,
+
+	PERF_COUNT_HW_CACHE_OP_MAX		= 0x8,
 };
 
 enum hw_cache_op_result_id {
-	PERF_COUNT_HW_CACHE_RESULT_ACCESS,
-	PERF_COUNT_HW_CACHE_RESULT_MISS,
+	PERF_COUNT_HW_CACHE_RESULT_HIT		= 0x1,
+	PERF_COUNT_HW_CACHE_RESULT_MISS		= 0x2,
+	PERF_COUNT_HW_CACHE_RESULT_SUM		= 0x3,
 
-	PERF_COUNT_HW_CACHE_RESULT_MAX,
+	PERF_COUNT_HW_CACHE_RESULT_MAX		= 0x4,
 };
 
 /*



^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support
  2009-06-08 20:36               ` [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support tip-bot for Thomas Gleixner
@ 2009-06-09  8:43                 ` Peter Zijlstra
  2009-06-09 12:01                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-09  8:43 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, efault, tglx, mingo
  Cc: linux-tip-commits

On Mon, 2009-06-08 at 20:36 +0000, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  d3ad70660a0bf6d1a3692093939d238fe8add498
> Gitweb:     http://git.kernel.org/tip/d3ad70660a0bf6d1a3692093939d238fe8add498
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Mon, 8 Jun 2009 22:33:10 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 8 Jun 2009 22:33:10 +0200
> 
> perf_counter, x86: Implement generalized cache event types, add AMD support
> 
> Fill in amd_hw_cache_event_id[] with the AMD CPU specific events,
> for family 0x0f, 0x10 and 0x11.
> 
> There's apparently no distinction between load and store events, so
> we only fill in the load events.

Ah, that's what you did.. :-)

> +static const u64 amd_0f_hw_cache_event_ids
> +				[PERF_COUNT_HW_CACHE_MAX]
> +				[PERF_COUNT_HW_CACHE_OP_MAX]
> +				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
> +{
> + [ C(L1D) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,

0x40 - Data Cache Access
0x41 - Data Cache Misses

> +	},
> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,

0x4B - unit 0x3 (load+store) Prefetch Dispatched

> +	},
> + },
> + [ C(L1I ) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
> +		[ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
> +	},
> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = -1,
> +		[ C(RESULT_MISS)   ] = -1,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},

0x81 L1I Miss
0x82 L1I Miss, L2 Hit
0x83 L1I Miss, L2 Miss

> + },
> + [ C(L2  ) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},
> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},

0x42 unit 0x1e (shared|exclusive|owned|mod) L1 Miss L2 Hit
0x43 unit 0x1e                              L2 Miss

0x7d unit 0x3 (IC|DC) L2 Hit
0x7e unit 0x3 (IC|DC) L2 Miss

> + },
> + [ C(DTLB) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},

0x4D - unit 0x1 4k DTLB L1 Hit
0x45 - unit 0x1 4k DTLB L1 Miss L2 Hit
0x46 - unit 0x1 4k DTLB L1 Miss L2 Miss

> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = 0,
> +		[ C(RESULT_MISS)   ] = 0,
> +	},
> + },
> + [ C(ITLB) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
> +		[ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
> +	},
> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = -1,
> +		[ C(RESULT_MISS)   ] = -1,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = -1,
> +		[ C(RESULT_MISS)   ] = -1,
> +	},

0x84               L1 ITLB Miss, L2 ITLB Hit
0x85 Unit 0x1 (4k) L1 ITLB Miss, L2 Miss

> + },
> + [ C(BPU ) ] = {
> +	[ C(OP_READ) ] = {
> +		[ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
> +		[ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */

There's also Retired Taken in C4 and C5

> +	},
> +	[ C(OP_WRITE) ] = {
> +		[ C(RESULT_ACCESS) ] = -1,
> +		[ C(RESULT_MISS)   ] = -1,
> +	},
> +	[ C(OP_PREFETCH) ] = {
> +		[ C(RESULT_ACCESS) ] = -1,
> +		[ C(RESULT_MISS)   ] = -1,
> +	},
> + },
> +};


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter, x86: Implement generalized cache event types, add AMD support
  2009-06-09  8:43                 ` Peter Zijlstra
@ 2009-06-09 12:01                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-09 12:01 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, tglx,
	linux-tip-commits


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Mon, 2009-06-08 at 20:36 +0000, tip-bot for Thomas Gleixner wrote:
> > Commit-ID:  d3ad70660a0bf6d1a3692093939d238fe8add498
> > Gitweb:     http://git.kernel.org/tip/d3ad70660a0bf6d1a3692093939d238fe8add498
> > Author:     Thomas Gleixner <tglx@linutronix.de>
> > AuthorDate: Mon, 8 Jun 2009 22:33:10 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Mon, 8 Jun 2009 22:33:10 +0200
> > 
> > perf_counter, x86: Implement generalized cache event types, add AMD support
> > 
> > Fill in amd_hw_cache_event_id[] with the AMD CPU specific events,
> > for family 0x0f, 0x10 and 0x11.
> > 
> > There's apparently no distinction between load and store events, so
> > we only fill in the load events.
> 
> Ah, that's what you did.. :-)
> 
> > +static const u64 amd_0f_hw_cache_event_ids
> > +				[PERF_COUNT_HW_CACHE_MAX]
> > +				[PERF_COUNT_HW_CACHE_OP_MAX]
> > +				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
> > +{
> > + [ C(L1D) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> 
> 0x40 - Data Cache Access
> 0x41 - Data Cache Misses
> 
> > +	},
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> 
> 0x4B - unit 0x3 (load+store) Prefetch Dispatched
> 
> > +	},
> > + },
> > + [ C(L1I ) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches  */
> > +		[ C(RESULT_MISS)   ] = 0x0081, /* Instruction cache misses   */
> > +	},
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = -1,
> > +		[ C(RESULT_MISS)   ] = -1,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> 
> 0x81 L1I Miss
> 0x82 L1I Miss, L2 Hit
> 0x83 L1I Miss, L2 Miss
> 
> > + },
> > + [ C(L2  ) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> 
> 0x42 unit 0x1e (shared|exclusive|owned|mod) L1 Miss L2 Hit
> 0x43 unit 0x1e                              L2 Miss
> 
> 0x7d unit 0x3 (IC|DC) L2 Hit
> 0x7e unit 0x3 (IC|DC) L2 Miss
> 
> > + },
> > + [ C(DTLB) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> 
> 0x4D - unit 0x1 4k DTLB L1 Hit
> 0x45 - unit 0x1 4k DTLB L1 Miss L2 Hit
> 0x46 - unit 0x1 4k DTLB L1 Miss L2 Miss
> 
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0,
> > +		[ C(RESULT_MISS)   ] = 0,
> > +	},
> > + },
> > + [ C(ITLB) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes        */
> > +		[ C(RESULT_MISS)   ] = 0x0085, /* Instr. fetch ITLB misses   */
> > +	},
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = -1,
> > +		[ C(RESULT_MISS)   ] = -1,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = -1,
> > +		[ C(RESULT_MISS)   ] = -1,
> > +	},
> 
> 0x84               L1 ITLB Miss, L2 ITLB Hit
> 0x85 Unit 0x1 (4k) L1 ITLB Miss, L2 Miss
> 
> > + },
> > + [ C(BPU ) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr.      */
> > +		[ C(RESULT_MISS)   ] = 0x00c3, /* Retired Mispredicted BI    */
> 
> There's also Retired Taken in C4 and C5

Mind turning this into a patch? You did the hard work already :-)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Implement generalized cache event types
  2009-06-09  8:15                 ` Peter Zijlstra
@ 2009-06-09 12:15                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-09 12:15 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, mtosatti, tglx,
	cjashfor, linux-tip-commits


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Sat, 2009-06-06 at 11:16 +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  8326f44da090d6d304d29b9fdc7fb3e20889e329
> > Gitweb:     http://git.kernel.org/tip/8326f44da090d6d304d29b9fdc7fb3e20889e329
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Fri, 5 Jun 2009 20:22:46 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 6 Jun 2009 13:14:47 +0200
> > 
> > perf_counter: Implement generalized cache event types
> > 
> > Extend generic event enumeration with the PERF_TYPE_HW_CACHE
> > method.
> > 
> > This is a 3-dimensional space:
> > 
> >        { L1-D, L1-I, L2, ITLB, DTLB, BPU } x
> >        { load, store, prefetch } x
> >        { accesses, misses }
> > 
> > User-space passes in the 3 coordinates and the kernel provides
> > a counter. (if the hardware supports that type and if the
> > combination makes sense.)
> > 
> > Combinations that make no sense produce a -EINVAL.
> > Combinations that are not supported by the hardware produce -ENOTSUP.
> > 
> > Extend the tools to deal with this, and rewrite the event symbol
> > parsing code with various popular aliases for the units and
> > access methods above. So 'l1-cache-miss' and 'l1d-read-ops' are
> > both valid aliases.
> > 
> > ( x86 is supported for now, with the Nehalem event table filled in,
> >   and with Core2 and Atom having placeholder tables. )
> > 
> 
> > +++ b/include/linux/perf_counter.h
> > @@ -28,6 +28,7 @@ enum perf_event_types {
> >  	PERF_TYPE_HARDWARE		= 0,
> >  	PERF_TYPE_SOFTWARE		= 1,
> >  	PERF_TYPE_TRACEPOINT		= 2,
> > +	PERF_TYPE_HW_CACHE		= 3,
> >  
> >  	/*
> >  	 * available TYPE space, raw is the max value.
> > @@ -56,6 +57,39 @@ enum attr_ids {
> >  };
> >  
> >  /*
> > + * Generalized hardware cache counters:
> > + *
> > + *       { L1-D, L1-I, L2, LLC, ITLB, DTLB, BPU } x
> > + *       { read, write, prefetch } x
> > + *       { accesses, misses }
> > + */
> > +enum hw_cache_id {
> > +	PERF_COUNT_HW_CACHE_L1D,
> > +	PERF_COUNT_HW_CACHE_L1I,
> > +	PERF_COUNT_HW_CACHE_L2,
> > +	PERF_COUNT_HW_CACHE_DTLB,
> > +	PERF_COUNT_HW_CACHE_ITLB,
> > +	PERF_COUNT_HW_CACHE_BPU,
> > +
> > +	PERF_COUNT_HW_CACHE_MAX,
> > +};
> > +
> > +enum hw_cache_op_id {
> > +	PERF_COUNT_HW_CACHE_OP_READ,
> > +	PERF_COUNT_HW_CACHE_OP_WRITE,
> > +	PERF_COUNT_HW_CACHE_OP_PREFETCH,
> > +
> > +	PERF_COUNT_HW_CACHE_OP_MAX,
> > +};
> > +
> > +enum hw_cache_op_result_id {
> > +	PERF_COUNT_HW_CACHE_RESULT_ACCESS,
> > +	PERF_COUNT_HW_CACHE_RESULT_MISS,
> > +
> > +	PERF_COUNT_HW_CACHE_RESULT_MAX,
> > +};
> 
> May I suggest we do the below instead? Some hardware doesn't make the
> read/write distinction and would therefore have an utterly empty table.
> 
> Furthermore, also splitting the hit/miss into a bitfield allows us to
> have hit/miss and the combined value.
> 
> ---
> diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
> index 3586df8..1fb72fc 100644
> --- a/include/linux/perf_counter.h
> +++ b/include/linux/perf_counter.h
> @@ -64,29 +64,32 @@ enum attr_ids {
>   *       { accesses, misses }
>   */
>  enum hw_cache_id {
> -	PERF_COUNT_HW_CACHE_L1D,
> -	PERF_COUNT_HW_CACHE_L1I,
> -	PERF_COUNT_HW_CACHE_L2,
> -	PERF_COUNT_HW_CACHE_DTLB,
> -	PERF_COUNT_HW_CACHE_ITLB,
> -	PERF_COUNT_HW_CACHE_BPU,
> +	PERF_COUNT_HW_CACHE_L1D		= 0,
> +	PERF_COUNT_HW_CACHE_L1I		= 1,
> +	PERF_COUNT_HW_CACHE_L2		= 2,
> +	PERF_COUNT_HW_CACHE_DTLB	= 3,
> +	PERF_COUNT_HW_CACHE_ITLB	= 4,
> +	PERF_COUNT_HW_CACHE_BPU		= 5,

Could you please also rename 'L2' to LLC (last level cache)?

We want to know about the fastest and the 'largest' caches. 
Intermediate caches are a lot less interesting in practice, and we 
dont really want to enumerate a variable number of cache levels.

>  	PERF_COUNT_HW_CACHE_MAX,
>  };
>  
>  enum hw_cache_op_id {
> -	PERF_COUNT_HW_CACHE_OP_READ,
> -	PERF_COUNT_HW_CACHE_OP_WRITE,
> -	PERF_COUNT_HW_CACHE_OP_PREFETCH,
> +	PERF_COUNT_HW_CACHE_OP_READ		= 0x1,
> +	PERF_COUNT_HW_CACHE_OP_WRITE		= 0x2,
> +	PERF_COUNT_HW_CACHE_OP_ACCESS		= 0x3, /* either READ or WRITE */
> +	PERF_COUNT_HW_CACHE_OP_PREFETCH		= 0x4, /* XXX should we qualify this with either READ/WRITE? */

Btw., could you please also rename the constants to LOAD/STORE? 
That's the proper PMU terminology.

Prefetches are basically almost always reads. That comes from the 
physical fact that they can be done speculatively without modifying 
memory state. A 'speculative write', while possible in theory, would 
have so many side effects, and would complicate the SMP caching 
algorithm and an in-order execution model enormously, so i doubt it 
will be done in any widespread way anytime soon.

Nevertheless, turning it into a bit does make sense, from an ABI 
cleanliness POV.

>  
> -	PERF_COUNT_HW_CACHE_OP_MAX,
> +
> +	PERF_COUNT_HW_CACHE_OP_MAX		= 0x8,
>  };
>  
>  enum hw_cache_op_result_id {
> -	PERF_COUNT_HW_CACHE_RESULT_ACCESS,
> -	PERF_COUNT_HW_CACHE_RESULT_MISS,
> +	PERF_COUNT_HW_CACHE_RESULT_HIT		= 0x1,
> +	PERF_COUNT_HW_CACHE_RESULT_MISS		= 0x2,
> +	PERF_COUNT_HW_CACHE_RESULT_SUM		= 0x3,

RESULT_SUM sounds a bit weird - perhaps RESULT_ANY or RESULT_ALL?

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:core/locking] spinlock: Add missing __raw_spin_lock_flags() stub for UP
       [not found]             ` <new-submission>
                                 ` (192 preceding siblings ...)
  2009-06-08 21:33               ` [tip:perfcounters/core] perf_counter tools: Standardize color printing tip-bot for Ingo Molnar
@ 2009-06-10  9:51               ` tip-bot for Benjamin Herrenschmidt
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter: More aggressive frequency adjustment tip-bot for Peter Zijlstra
                                 ` (513 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Benjamin Herrenschmidt @ 2009-06-10  9:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, benh, a.p.zijlstra, tglx, mingo

Commit-ID:  04dce7d9d429ea5ea04e9432d1726c930f4d67da
Gitweb:     http://git.kernel.org/tip/04dce7d9d429ea5ea04e9432d1726c930f4d67da
Author:     Benjamin Herrenschmidt <benh@kernel.crashing.org>
AuthorDate: Wed, 10 Jun 2009 16:59:46 +1000
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Jun 2009 11:48:14 +0200

spinlock: Add missing __raw_spin_lock_flags() stub for UP

This was only defined with CONFIG_DEBUG_SPINLOCK set, but some
obscure arch/powerpc code wants it always.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/spinlock_up.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 938234c..d4841ed 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -60,6 +60,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
 #define __raw_spin_is_locked(lock)	((void)(lock), 0)
 /* for sched.c and kernel_lock.c: */
 # define __raw_spin_lock(lock)		do { (void)(lock); } while (0)
+# define __raw_spin_lock_flags(lock, flags)	do { (void)(lock); } while (0)
 # define __raw_spin_unlock(lock)	do { (void)(lock); } while (0)
 # define __raw_spin_trylock(lock)	({ (void)(lock); 1; })
 #endif /* DEBUG_SPINLOCK */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: More aggressive frequency adjustment
       [not found]             ` <new-submission>
                                 ` (193 preceding siblings ...)
  2009-06-10  9:51               ` [tip:core/locking] spinlock: Add missing __raw_spin_lock_flags() stub for UP tip-bot for Benjamin Herrenschmidt
@ 2009-06-10 15:42               ` tip-bot for Peter Zijlstra
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter tools: Small frequency related fixes tip-bot for Peter Zijlstra
                                 ` (512 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-10 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  bd2b5b12849a3446abad0b25e920f86f5480b309
Gitweb:     http://git.kernel.org/tip/bd2b5b12849a3446abad0b25e920f86f5480b309
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 13:40:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Jun 2009 16:55:26 +0200

perf_counter: More aggressive frequency adjustment

Also employ the overflow handler to adjust the frequency, this results
in a stable frequency in about 40~50 samples, instead of that many ticks.

This also means we can start sampling at a sample period of 1 without
running head-first into the throttle.

It relies on sched_clock() to accurately measure the time difference
between the overflow NMIs.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    5 +-
 include/linux/perf_counter.h       |    1 +
 kernel/perf_counter.c              |  130 ++++++++++++++++++++++++------------
 3 files changed, 92 insertions(+), 44 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 49f2585..240ca56 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -696,10 +696,11 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	if (!attr->exclude_kernel)
 		hwc->config |= ARCH_PERFMON_EVENTSEL_OS;
 
-	if (!hwc->sample_period)
+	if (!hwc->sample_period) {
 		hwc->sample_period = x86_pmu.max_period;
+		atomic64_set(&hwc->period_left, hwc->sample_period);
+	}
 
-	atomic64_set(&hwc->period_left, hwc->sample_period);
 	counter->destroy = hw_perf_counter_destroy;
 
 	/*
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 3586df8..282d8cc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -371,6 +371,7 @@ struct hw_perf_counter {
 
 	u64				freq_count;
 	u64				freq_interrupts;
+	u64				freq_stamp;
 #endif
 };
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 5eacaaf..51c571e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1184,13 +1184,33 @@ static void perf_counter_cpu_sched_in(struct perf_cpu_context *cpuctx, int cpu)
 static void perf_log_throttle(struct perf_counter *counter, int enable);
 static void perf_log_period(struct perf_counter *counter, u64 period);
 
-static void perf_adjust_freq(struct perf_counter_context *ctx)
+static void perf_adjust_period(struct perf_counter *counter, u64 events)
+{
+	struct hw_perf_counter *hwc = &counter->hw;
+	u64 period, sample_period;
+	s64 delta;
+
+	events *= hwc->sample_period;
+	period = div64_u64(events, counter->attr.sample_freq);
+
+	delta = (s64)(period - hwc->sample_period);
+	delta = (delta + 7) / 8; /* low pass filter */
+
+	sample_period = hwc->sample_period + delta;
+
+	if (!sample_period)
+		sample_period = 1;
+
+	perf_log_period(counter, sample_period);
+
+	hwc->sample_period = sample_period;
+}
+
+static void perf_ctx_adjust_freq(struct perf_counter_context *ctx)
 {
 	struct perf_counter *counter;
 	struct hw_perf_counter *hwc;
-	u64 interrupts, sample_period;
-	u64 events, period, freq;
-	s64 delta;
+	u64 interrupts, freq;
 
 	spin_lock(&ctx->lock);
 	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
@@ -1202,6 +1222,9 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 		interrupts = hwc->interrupts;
 		hwc->interrupts = 0;
 
+		/*
+		 * unthrottle counters on the tick
+		 */
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(counter, 1);
 			counter->pmu->unthrottle(counter);
@@ -1211,6 +1234,9 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 		if (!counter->attr.freq || !counter->attr.sample_freq)
 			continue;
 
+		/*
+		 * if the specified freq < HZ then we need to skip ticks
+		 */
 		if (counter->attr.sample_freq < HZ) {
 			freq = counter->attr.sample_freq;
 
@@ -1226,20 +1252,20 @@ static void perf_adjust_freq(struct perf_counter_context *ctx)
 		} else
 			freq = HZ;
 
-		events = freq * interrupts * hwc->sample_period;
-		period = div64_u64(events, counter->attr.sample_freq);
-
-		delta = (s64)(1 + period - hwc->sample_period);
-		delta >>= 1;
-
-		sample_period = hwc->sample_period + delta;
-
-		if (!sample_period)
-			sample_period = 1;
+		perf_adjust_period(counter, freq * interrupts);
 
-		perf_log_period(counter, sample_period);
-
-		hwc->sample_period = sample_period;
+		/*
+		 * In order to avoid being stalled by an (accidental) huge
+		 * sample period, force reset the sample period if we didn't
+		 * get any events in this freq period.
+		 */
+		if (!interrupts) {
+			perf_disable();
+			counter->pmu->disable(counter);
+			atomic_set(&hwc->period_left, 0);
+			counter->pmu->enable(counter);
+			perf_enable();
+		}
 	}
 	spin_unlock(&ctx->lock);
 }
@@ -1279,9 +1305,9 @@ void perf_counter_task_tick(struct task_struct *curr, int cpu)
 	cpuctx = &per_cpu(perf_cpu_context, cpu);
 	ctx = curr->perf_counter_ctxp;
 
-	perf_adjust_freq(&cpuctx->ctx);
+	perf_ctx_adjust_freq(&cpuctx->ctx);
 	if (ctx)
-		perf_adjust_freq(ctx);
+		perf_ctx_adjust_freq(ctx);
 
 	perf_counter_cpu_sched_out(cpuctx);
 	if (ctx)
@@ -1647,10 +1673,10 @@ static int perf_counter_period(struct perf_counter *counter, u64 __user *arg)
 
 		counter->attr.sample_freq = value;
 	} else {
+		perf_log_period(counter, value);
+
 		counter->attr.sample_period = value;
 		counter->hw.sample_period = value;
-
-		perf_log_period(counter, value);
 	}
 unlock:
 	spin_unlock_irq(&ctx->lock);
@@ -2853,35 +2879,41 @@ void __perf_counter_mmap(struct vm_area_struct *vma)
  * event flow.
  */
 
+struct freq_event {
+	struct perf_event_header	header;
+	u64				time;
+	u64				id;
+	u64				period;
+};
+
 static void perf_log_period(struct perf_counter *counter, u64 period)
 {
 	struct perf_output_handle handle;
+	struct freq_event event;
 	int ret;
 
-	struct {
-		struct perf_event_header	header;
-		u64				time;
-		u64				id;
-		u64				period;
-	} freq_event = {
+	if (counter->hw.sample_period == period)
+		return;
+
+	if (counter->attr.sample_type & PERF_SAMPLE_PERIOD)
+		return;
+
+	event = (struct freq_event) {
 		.header = {
 			.type = PERF_EVENT_PERIOD,
 			.misc = 0,
-			.size = sizeof(freq_event),
+			.size = sizeof(event),
 		},
 		.time = sched_clock(),
 		.id = counter->id,
 		.period = period,
 	};
 
-	if (counter->hw.sample_period == period)
-		return;
-
-	ret = perf_output_begin(&handle, counter, sizeof(freq_event), 0, 0);
+	ret = perf_output_begin(&handle, counter, sizeof(event), 1, 0);
 	if (ret)
 		return;
 
-	perf_output_put(&handle, freq_event);
+	perf_output_put(&handle, event);
 	perf_output_end(&handle);
 }
 
@@ -2923,15 +2955,16 @@ int perf_counter_overflow(struct perf_counter *counter,
 {
 	int events = atomic_read(&counter->event_limit);
 	int throttle = counter->pmu->unthrottle != NULL;
+	struct hw_perf_counter *hwc = &counter->hw;
 	int ret = 0;
 
 	if (!throttle) {
-		counter->hw.interrupts++;
+		hwc->interrupts++;
 	} else {
-		if (counter->hw.interrupts != MAX_INTERRUPTS) {
-			counter->hw.interrupts++;
-			if (HZ*counter->hw.interrupts > (u64)sysctl_perf_counter_limit) {
-				counter->hw.interrupts = MAX_INTERRUPTS;
+		if (hwc->interrupts != MAX_INTERRUPTS) {
+			hwc->interrupts++;
+			if (HZ * hwc->interrupts > (u64)sysctl_perf_counter_limit) {
+				hwc->interrupts = MAX_INTERRUPTS;
 				perf_log_throttle(counter, 0);
 				ret = 1;
 			}
@@ -2945,6 +2978,16 @@ int perf_counter_overflow(struct perf_counter *counter,
 		}
 	}
 
+	if (counter->attr.freq) {
+		u64 now = sched_clock();
+		s64 delta = now - hwc->freq_stamp;
+
+		hwc->freq_stamp = now;
+
+		if (delta > 0 && delta < TICK_NSEC)
+			perf_adjust_period(counter, NSEC_PER_SEC / (int)delta);
+	}
+
 	/*
 	 * XXX event_limit might not quite work as expected on inherited
 	 * counters
@@ -3379,7 +3422,6 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 		return NULL;
 
 	counter->destroy = tp_perf_counter_destroy;
-	counter->hw.sample_period = counter->attr.sample_period;
 
 	return &perf_ops_generic;
 }
@@ -3483,10 +3525,11 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	pmu = NULL;
 
 	hwc = &counter->hw;
+	hwc->sample_period = attr->sample_period;
 	if (attr->freq && attr->sample_freq)
-		hwc->sample_period = div64_u64(TICK_NSEC, attr->sample_freq);
-	else
-		hwc->sample_period = attr->sample_period;
+		hwc->sample_period = 1;
+
+	atomic64_set(&hwc->period_left, hwc->sample_period);
 
 	/*
 	 * we currently do not support PERF_SAMPLE_GROUP on inherited counters
@@ -3687,6 +3730,9 @@ inherit_counter(struct perf_counter *parent_counter,
 	else
 		child_counter->state = PERF_COUNTER_STATE_OFF;
 
+	if (parent_counter->attr.freq)
+		child_counter->hw.sample_period = parent_counter->hw.sample_period;
+
 	/*
 	 * Link it up in the child's context:
 	 */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Small frequency related fixes
       [not found]             ` <new-submission>
                                 ` (194 preceding siblings ...)
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter: More aggressive frequency adjustment tip-bot for Peter Zijlstra
@ 2009-06-10 15:42               ` tip-bot for Peter Zijlstra
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter tools: Propagate signals properly tip-bot for Peter Zijlstra
                                 ` (511 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-10 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  4502d77c1d8f15f20c04b92cb96c12d4e465de29
Gitweb:     http://git.kernel.org/tip/4502d77c1d8f15f20c04b92cb96c12d4e465de29
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 15:03:06 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Jun 2009 16:55:26 +0200

perf_counter tools: Small frequency related fixes

Create the counter in a disabled state and only enable it after we
mmap() the buffer, this allows us to see the first few samples (and
observe the frequency ramp).

Furthermore, print the period in the verbose report.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |    3 +++
 tools/perf/builtin-report.c |    6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index deaee42..a5698ad 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -347,6 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= (cpu < 0) && inherit;
+	attr->disabled		= 1;
 
 	track = 0; /* only the first counter needs these */
 
@@ -402,6 +403,8 @@ try_again:
 		error("failed to mmap with %d (%s)\n", errno, strerror(errno));
 		exit(-1);
 	}
+
+	ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_ENABLE);
 }
 
 static void open_counters(int cpu, pid_t pid)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0b18cb9..9a0e31e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -47,6 +47,7 @@ struct ip_event {
 	struct perf_event_header header;
 	__u64 ip;
 	__u32 pid, tid;
+	__u64 period;
 };
 
 struct mmap_event {
@@ -943,12 +944,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	uint64_t ip = event->ip.ip;
 	struct map *map = NULL;
 
-	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
 		(void *)(offset + head),
 		(void *)(long)(event->header.size),
 		event->header.misc,
 		event->ip.pid,
-		(void *)(long)ip);
+		(void *)(long)ip,
+		(long long)event->ip.period);
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Propagate signals properly
       [not found]             ` <new-submission>
                                 ` (195 preceding siblings ...)
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter tools: Small frequency related fixes tip-bot for Peter Zijlstra
@ 2009-06-10 15:42               ` tip-bot for Peter Zijlstra
  2009-06-11  0:42               ` [tip:perfcounters/core] perf_counter: Annotate exit ctx recursion tip-bot for Peter Zijlstra
                                 ` (510 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-10 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f7b7c26e01e51fe46097e11f179dc71ce7950084
Gitweb:     http://git.kernel.org/tip/f7b7c26e01e51fe46097e11f179dc71ce7950084
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 15:55:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Jun 2009 16:55:27 +0200

perf_counter tools: Propagate signals properly

Currently report and stat catch SIGINT (and others) without altering
their exit state. This means that things like:

   while :; do perf stat ./foo ; done

Loops become hard-to-interrupt, because bash never sees perf terminate
due to interruption. Fix this.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   12 ++++++++++++
 tools/perf/builtin-stat.c   |   13 +++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a5698ad..c10553c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -169,10 +169,21 @@ static void mmap_read(struct mmap_data *md)
 }
 
 static volatile int done = 0;
+static volatile int signr = -1;
 
 static void sig_handler(int sig)
 {
 	done = 1;
+	signr = sig;
+}
+
+static void sig_atexit(void)
+{
+	if (signr == -1)
+		return;
+
+	signal(signr, SIG_DFL);
+	kill(getpid(), signr);
 }
 
 static void pid_synthesize_comm_event(pid_t pid, int full)
@@ -459,6 +470,7 @@ static int __cmd_record(int argc, const char **argv)
 	} else for (i = 0; i < nr_cpus; i++)
 		open_counters(i, target_pid);
 
+	atexit(sig_atexit);
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
 
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8085509..6404906 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -296,8 +296,20 @@ static int do_perf_stat(int argc, const char **argv)
 	return 0;
 }
 
+static volatile int signr = -1;
+
 static void skip_signal(int signo)
 {
+	signr = signo;
+}
+
+static void sig_atexit(void)
+{
+	if (signr == -1)
+		return;
+
+	signal(signr, SIG_DFL);
+	kill(getpid(), signr);
 }
 
 static const char * const stat_usage[] = {
@@ -345,6 +357,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 	 * What we want is for Ctrl-C to work in the exec()-ed
 	 * task, but being ignored by perf stat itself:
 	 */
+	atexit(sig_atexit);
 	signal(SIGINT,  skip_signal);
 	signal(SIGALRM, skip_signal);
 	signal(SIGABRT, skip_signal);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Annotate exit ctx recursion
       [not found]             ` <new-submission>
                                 ` (196 preceding siblings ...)
  2009-06-10 15:42               ` [tip:perfcounters/core] perf_counter tools: Propagate signals properly tip-bot for Peter Zijlstra
@ 2009-06-11  0:42               ` tip-bot for Peter Zijlstra
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter tools: Normalize data using per sample period data tip-bot for Peter Zijlstra
                                 ` (509 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-11  0:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  66fff22483d8542dfb4d61a28d21277bbde321e8
Gitweb:     http://git.kernel.org/tip/66fff22483d8542dfb4d61a28d21277bbde321e8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 22:53:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Jun 2009 02:39:01 +0200

perf_counter: Annotate exit ctx recursion

Ever since Paul fixed it to unclone the context before taking the
ctx->lock this became a false positive, annotate it away.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 51c571e..ae591a1 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3879,7 +3879,18 @@ void perf_counter_exit_task(struct task_struct *child)
 	spin_unlock(&child_ctx->lock);
 	local_irq_restore(flags);
 
-	mutex_lock(&child_ctx->mutex);
+	/*
+	 * We can recurse on the same lock type through:
+	 *
+	 *   __perf_counter_exit_task()
+	 *     sync_child_counter()
+	 *       fput(parent_counter->filp)
+	 *         perf_release()
+	 *           mutex_lock(&ctx->mutex)
+	 *
+	 * But since its the parent context it won't be the same instance.
+	 */
+	mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING);
 
 again:
 	list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Normalize data using per sample period data
       [not found]             ` <new-submission>
                                 ` (197 preceding siblings ...)
  2009-06-11  0:42               ` [tip:perfcounters/core] perf_counter: Annotate exit ctx recursion tip-bot for Peter Zijlstra
@ 2009-06-11  0:43               ` tip-bot for Peter Zijlstra
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter: Introduce struct for sample data tip-bot for Peter Zijlstra
                                 ` (508 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-11  0:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  ea1900e571d40a3ce60c835c2f21e1fd8c5cb663
Gitweb:     http://git.kernel.org/tip/ea1900e571d40a3ce60c835c2f21e1fd8c5cb663
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 21:45:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Jun 2009 02:39:01 +0200

perf_counter tools: Normalize data using per sample period data

When we use variable period sampling, add the period to the sample
data and use that to normalize the samples.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |    3 ++-
 tools/perf/builtin-report.c |   18 +++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index c10553c..919f23c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -350,8 +350,9 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	struct perf_counter_attr *attr = attrs + counter;
 	int track = 1;
 
-	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
+	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
 	if (freq) {
+		attr->sample_type	|= PERF_SAMPLE_PERIOD;
 		attr->freq		= 1;
 		attr->sample_freq	= freq;
 	}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 9a0e31e..f57fd5c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -456,7 +456,7 @@ struct hist_entry {
 	uint64_t	 ip;
 	char		 level;
 
-	uint32_t	 count;
+	uint64_t	 count;
 };
 
 /*
@@ -726,7 +726,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
 
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
-		struct symbol *sym, uint64_t ip, char level)
+		struct symbol *sym, uint64_t ip, char level, uint64_t count)
 {
 	struct rb_node **p = &hist.rb_node;
 	struct rb_node *parent = NULL;
@@ -738,7 +738,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		.sym	= sym,
 		.ip	= ip,
 		.level	= level,
-		.count	= 1,
+		.count	= count,
 	};
 	int cmp;
 
@@ -749,7 +749,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		cmp = hist_entry__cmp(&entry, he);
 
 		if (!cmp) {
-			he->count++;
+			he->count += count;
 			return 0;
 		}
 
@@ -942,15 +942,19 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	struct dso *dso = NULL;
 	struct thread *thread = threads__findnew(event->ip.pid);
 	uint64_t ip = event->ip.ip;
+	uint64_t period = 1;
 	struct map *map = NULL;
 
+	if (event->header.type & PERF_SAMPLE_PERIOD)
+		period = event->ip.period;
+
 	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
 		(void *)(offset + head),
 		(void *)(long)(event->header.size),
 		event->header.misc,
 		event->ip.pid,
 		(void *)(long)ip,
-		(long long)event->ip.period);
+		(long long)period);
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
 
@@ -1001,13 +1005,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 		if (dso)
 			sym = dso->find_symbol(dso, ip);
 
-		if (hist_entry__add(thread, map, dso, sym, ip, level)) {
+		if (hist_entry__add(thread, map, dso, sym, ip, level, period)) {
 			fprintf(stderr,
 		"problem incrementing symbol count, skipping event\n");
 			return -1;
 		}
 	}
-	total++;
+	total += period;
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Introduce struct for sample data
       [not found]             ` <new-submission>
                                 ` (198 preceding siblings ...)
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter tools: Normalize data using per sample period data tip-bot for Peter Zijlstra
@ 2009-06-11  0:43               ` tip-bot for Peter Zijlstra
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter: Accurate period data tip-bot for Peter Zijlstra
                                 ` (507 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-11  0:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  df1a132bf3d3508f863336c80a27806a2ac947e0
Gitweb:     http://git.kernel.org/tip/df1a132bf3d3508f863336c80a27806a2ac947e0
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 21:02:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Jun 2009 02:39:02 +0200

perf_counter: Introduce struct for sample data

For easy extension of the sample data, put it in a structure.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/kernel/perf_counter.c |   10 ++++++--
 arch/x86/kernel/cpu/perf_counter.c |   15 ++++++++++---
 include/linux/perf_counter.h       |   10 +++++++-
 kernel/perf_counter.c              |   38 ++++++++++++++++++++---------------
 4 files changed, 48 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 4786ad9..5e0bf39 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -1001,7 +1001,11 @@ static void record_and_restart(struct perf_counter *counter, long val,
 	 * Finally record data if requested.
 	 */
 	if (record) {
-		addr = 0;
+		struct perf_sample_data data = {
+			.regs = regs,
+			.addr = 0,
+		};
+
 		if (counter->attr.sample_type & PERF_SAMPLE_ADDR) {
 			/*
 			 * The user wants a data address recorded.
@@ -1016,9 +1020,9 @@ static void record_and_restart(struct perf_counter *counter, long val,
 			sdsync = (ppmu->flags & PPMU_ALT_SIPR) ?
 				POWER6_MMCRA_SDSYNC : MMCRA_SDSYNC;
 			if (!(mmcra & MMCRA_SAMPLE_ENABLE) || (mmcra & sdsync))
-				addr = mfspr(SPRN_SDAR);
+				data.addr = mfspr(SPRN_SDAR);
 		}
-		if (perf_counter_overflow(counter, nmi, regs, addr)) {
+		if (perf_counter_overflow(counter, nmi, &data)) {
 			/*
 			 * Interrupts are coming too fast - throttle them
 			 * by setting the counter to 0, so it will be
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 240ca56..82a23d4 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1173,11 +1173,14 @@ static void intel_pmu_reset(void)
  */
 static int intel_pmu_handle_irq(struct pt_regs *regs)
 {
+	struct perf_sample_data data;
 	struct cpu_hw_counters *cpuc;
-	struct cpu_hw_counters;
 	int bit, cpu, loops;
 	u64 ack, status;
 
+	data.regs = regs;
+	data.addr = 0;
+
 	cpu = smp_processor_id();
 	cpuc = &per_cpu(cpu_hw_counters, cpu);
 
@@ -1210,7 +1213,7 @@ again:
 		if (!intel_pmu_save_and_restart(counter))
 			continue;
 
-		if (perf_counter_overflow(counter, 1, regs, 0))
+		if (perf_counter_overflow(counter, 1, &data))
 			intel_pmu_disable_counter(&counter->hw, bit);
 	}
 
@@ -1230,12 +1233,16 @@ again:
 
 static int amd_pmu_handle_irq(struct pt_regs *regs)
 {
-	int cpu, idx, handled = 0;
+	struct perf_sample_data data;
 	struct cpu_hw_counters *cpuc;
 	struct perf_counter *counter;
 	struct hw_perf_counter *hwc;
+	int cpu, idx, handled = 0;
 	u64 val;
 
+	data.regs = regs;
+	data.addr = 0;
+
 	cpu = smp_processor_id();
 	cpuc = &per_cpu(cpu_hw_counters, cpu);
 
@@ -1256,7 +1263,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 		if (!x86_perf_counter_set_period(counter, hwc, idx))
 			continue;
 
-		if (perf_counter_overflow(counter, 1, regs, 0))
+		if (perf_counter_overflow(counter, 1, &data))
 			amd_pmu_disable_counter(hwc, idx);
 	}
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 282d8cc..d8c0eb4 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -605,8 +605,14 @@ extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
 	       struct perf_counter_context *ctx, int cpu);
 extern void perf_counter_update_userpage(struct perf_counter *counter);
 
-extern int perf_counter_overflow(struct perf_counter *counter,
-				 int nmi, struct pt_regs *regs, u64 addr);
+struct perf_sample_data {
+	struct pt_regs	*regs;
+	u64		addr;
+};
+
+extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
+				 struct perf_sample_data *data);
+
 /*
  * Return 1 for a software counter, 0 for a hardware counter
  */
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ae591a1..4fe85e8 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2378,8 +2378,8 @@ static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p)
 	return task_pid_nr_ns(p, counter->ns);
 }
 
-static void perf_counter_output(struct perf_counter *counter,
-				int nmi, struct pt_regs *regs, u64 addr)
+static void perf_counter_output(struct perf_counter *counter, int nmi,
+				struct perf_sample_data *data)
 {
 	int ret;
 	u64 sample_type = counter->attr.sample_type;
@@ -2404,10 +2404,10 @@ static void perf_counter_output(struct perf_counter *counter,
 	header.size = sizeof(header);
 
 	header.misc = PERF_EVENT_MISC_OVERFLOW;
-	header.misc |= perf_misc_flags(regs);
+	header.misc |= perf_misc_flags(data->regs);
 
 	if (sample_type & PERF_SAMPLE_IP) {
-		ip = perf_instruction_pointer(regs);
+		ip = perf_instruction_pointer(data->regs);
 		header.type |= PERF_SAMPLE_IP;
 		header.size += sizeof(ip);
 	}
@@ -2460,7 +2460,7 @@ static void perf_counter_output(struct perf_counter *counter,
 	}
 
 	if (sample_type & PERF_SAMPLE_CALLCHAIN) {
-		callchain = perf_callchain(regs);
+		callchain = perf_callchain(data->regs);
 
 		if (callchain) {
 			callchain_size = (1 + callchain->nr) * sizeof(u64);
@@ -2486,7 +2486,7 @@ static void perf_counter_output(struct perf_counter *counter,
 		perf_output_put(&handle, time);
 
 	if (sample_type & PERF_SAMPLE_ADDR)
-		perf_output_put(&handle, addr);
+		perf_output_put(&handle, data->addr);
 
 	if (sample_type & PERF_SAMPLE_ID)
 		perf_output_put(&handle, counter->id);
@@ -2950,8 +2950,8 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
  * Generic counter overflow handling.
  */
 
-int perf_counter_overflow(struct perf_counter *counter,
-			  int nmi, struct pt_regs *regs, u64 addr)
+int perf_counter_overflow(struct perf_counter *counter, int nmi,
+			  struct perf_sample_data *data)
 {
 	int events = atomic_read(&counter->event_limit);
 	int throttle = counter->pmu->unthrottle != NULL;
@@ -3005,7 +3005,7 @@ int perf_counter_overflow(struct perf_counter *counter,
 			perf_counter_disable(counter);
 	}
 
-	perf_counter_output(counter, nmi, regs, addr);
+	perf_counter_output(counter, nmi, data);
 	return ret;
 }
 
@@ -3054,24 +3054,25 @@ static void perf_swcounter_set_period(struct perf_counter *counter)
 static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 {
 	enum hrtimer_restart ret = HRTIMER_RESTART;
+	struct perf_sample_data data;
 	struct perf_counter *counter;
-	struct pt_regs *regs;
 	u64 period;
 
 	counter	= container_of(hrtimer, struct perf_counter, hw.hrtimer);
 	counter->pmu->read(counter);
 
-	regs = get_irq_regs();
+	data.addr = 0;
+	data.regs = get_irq_regs();
 	/*
 	 * In case we exclude kernel IPs or are somehow not in interrupt
 	 * context, provide the next best thing, the user IP.
 	 */
-	if ((counter->attr.exclude_kernel || !regs) &&
+	if ((counter->attr.exclude_kernel || !data.regs) &&
 			!counter->attr.exclude_user)
-		regs = task_pt_regs(current);
+		data.regs = task_pt_regs(current);
 
-	if (regs) {
-		if (perf_counter_overflow(counter, 0, regs, 0))
+	if (data.regs) {
+		if (perf_counter_overflow(counter, 0, &data))
 			ret = HRTIMER_NORESTART;
 	}
 
@@ -3084,9 +3085,14 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 static void perf_swcounter_overflow(struct perf_counter *counter,
 				    int nmi, struct pt_regs *regs, u64 addr)
 {
+	struct perf_sample_data data = {
+		.regs = regs,
+		.addr = addr,
+	};
+
 	perf_swcounter_update(counter);
 	perf_swcounter_set_period(counter);
-	if (perf_counter_overflow(counter, nmi, regs, addr))
+	if (perf_counter_overflow(counter, nmi, &data))
 		/* soft-disable the counter */
 		;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Accurate period data
       [not found]             ` <new-submission>
                                 ` (199 preceding siblings ...)
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter: Introduce struct for sample data tip-bot for Peter Zijlstra
@ 2009-06-11  0:43               ` tip-bot for Peter Zijlstra
  2009-06-12 12:42               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
                                 ` (506 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-11  0:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  9e350de37ac9607012fcf9c5314a28fbddf8f43c
Gitweb:     http://git.kernel.org/tip/9e350de37ac9607012fcf9c5314a28fbddf8f43c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Jun 2009 21:34:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Jun 2009 02:39:02 +0200

perf_counter: Accurate period data

We currently log hw.sample_period for PERF_SAMPLE_PERIOD, however this is
incorrect. When we adjust the period, it will only take effect the next
cycle but report it for the current cycle. So when we adjust the period
for every cycle, we're always wrong.

Solve this by keeping track of the last_period.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/kernel/perf_counter.c |    9 ++++++---
 arch/x86/kernel/cpu/perf_counter.c |   15 ++++++++++++---
 include/linux/perf_counter.h       |    6 ++++--
 kernel/perf_counter.c              |    9 ++++++---
 4 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 5e0bf39..4990ce2 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -767,6 +767,7 @@ static void power_pmu_unthrottle(struct perf_counter *counter)
 	perf_disable();
 	power_pmu_read(counter);
 	left = counter->hw.sample_period;
+	counter->hw.last_period = left;
 	val = 0;
 	if (left < 0x80000000L)
 		val = 0x80000000L - left;
@@ -937,7 +938,8 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
 
 	counter->hw.config = events[n];
 	counter->hw.counter_base = cflags[n];
-	atomic64_set(&counter->hw.period_left, counter->hw.sample_period);
+	counter->hw.last_period = counter->hw.sample_period;
+	atomic64_set(&counter->hw.period_left, counter->hw.last_period);
 
 	/*
 	 * See if we need to reserve the PMU.
@@ -1002,8 +1004,9 @@ static void record_and_restart(struct perf_counter *counter, long val,
 	 */
 	if (record) {
 		struct perf_sample_data data = {
-			.regs = regs,
-			.addr = 0,
+			.regs	= regs,
+			.addr	= 0,
+			.period	= counter->hw.last_period,
 		};
 
 		if (counter->attr.sample_type & PERF_SAMPLE_ADDR) {
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 82a23d4..57ae1be 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -698,6 +698,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 
 	if (!hwc->sample_period) {
 		hwc->sample_period = x86_pmu.max_period;
+		hwc->last_period = hwc->sample_period;
 		atomic64_set(&hwc->period_left, hwc->sample_period);
 	}
 
@@ -880,12 +881,14 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 	if (unlikely(left <= -period)) {
 		left = period;
 		atomic64_set(&hwc->period_left, left);
+		hwc->last_period = period;
 		ret = 1;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
 		atomic64_set(&hwc->period_left, left);
+		hwc->last_period = period;
 		ret = 1;
 	}
 	/*
@@ -1257,9 +1260,12 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 		if (val & (1ULL << (x86_pmu.counter_bits - 1)))
 			continue;
 
-		/* counter overflow */
-		handled = 1;
-		inc_irq_stat(apic_perf_irqs);
+		/*
+		 * counter overflow
+		 */
+		handled		= 1;
+		data.period	= counter->hw.last_period;
+
 		if (!x86_perf_counter_set_period(counter, hwc, idx))
 			continue;
 
@@ -1267,6 +1273,9 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 			amd_pmu_disable_counter(hwc, idx);
 	}
 
+	if (handled)
+		inc_irq_stat(apic_perf_irqs);
+
 	return handled;
 }
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index d8c0eb4..5b96647 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -366,6 +366,7 @@ struct hw_perf_counter {
 	};
 	atomic64_t			prev_count;
 	u64				sample_period;
+	u64				last_period;
 	atomic64_t			period_left;
 	u64				interrupts;
 
@@ -606,8 +607,9 @@ extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
 extern void perf_counter_update_userpage(struct perf_counter *counter);
 
 struct perf_sample_data {
-	struct pt_regs	*regs;
-	u64		addr;
+	struct pt_regs		*regs;
+	u64			addr;
+	u64			period;
 };
 
 extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 4fe85e8..8b89b40 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2495,7 +2495,7 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 		perf_output_put(&handle, cpu_entry);
 
 	if (sample_type & PERF_SAMPLE_PERIOD)
-		perf_output_put(&handle, counter->hw.sample_period);
+		perf_output_put(&handle, data->period);
 
 	/*
 	 * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult.
@@ -3040,11 +3040,13 @@ static void perf_swcounter_set_period(struct perf_counter *counter)
 	if (unlikely(left <= -period)) {
 		left = period;
 		atomic64_set(&hwc->period_left, left);
+		hwc->last_period = period;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
 		atomic64_add(period, &hwc->period_left);
+		hwc->last_period = period;
 	}
 
 	atomic64_set(&hwc->prev_count, -left);
@@ -3086,8 +3088,9 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 				    int nmi, struct pt_regs *regs, u64 addr)
 {
 	struct perf_sample_data data = {
-		.regs = regs,
-		.addr = addr,
+		.regs	= regs,
+		.addr	= addr,
+		.period	= counter->hw.last_period,
 	};
 
 	perf_swcounter_update(counter);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: Select frame pointers on x86
       [not found]             ` <new-submission>
                                 ` (200 preceding siblings ...)
  2009-06-11  0:43               ` [tip:perfcounters/core] perf_counter: Accurate period data tip-bot for Peter Zijlstra
@ 2009-06-12 12:42               ` tip-bot for Peter Zijlstra
  2009-06-12 12:42               ` [tip:perfcounters/core] perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too tip-bot for Peter Zijlstra
                                 ` (505 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-12 12:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, akpm, a.p.zijlstra, tglx, mingo

Commit-ID:  cac455509f22fede26b04889a8d2199af694a903
Gitweb:     http://git.kernel.org/tip/cac455509f22fede26b04889a8d2199af694a903
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 12 Jun 2009 10:04:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 12 Jun 2009 14:25:00 +0200

lockdep: Select frame pointers on x86

x86 stack traces are a piece of crap without frame pointers, and its not
like the 'performance gain' of not having stack pointers matters when you
selected lockdep.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/Kconfig.debug |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6cdcf38..3be4b7c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -440,7 +440,7 @@ config LOCKDEP
 	bool
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
 	select STACKTRACE
-	select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
+	select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
 	select KALLSYMS
 	select KALLSYMS_ALL
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too
       [not found]             ` <new-submission>
                                 ` (201 preceding siblings ...)
  2009-06-12 12:42               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
@ 2009-06-12 12:42               ` tip-bot for Peter Zijlstra
  2009-06-12 12:42               ` [tip:perfcounters/core] perf_counter: Remove PERF_TYPE_RAW special casing tip-bot for Peter Zijlstra
                                 ` (504 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-12 12:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f1a3c979059b2033d0b1cc4f9ee5c90bf92b5f94
Gitweb:     http://git.kernel.org/tip/f1a3c979059b2033d0b1cc4f9ee5c90bf92b5f94
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 11 Jun 2009 17:56:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 12 Jun 2009 14:28:51 +0200

perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too

is_software_counter() was missing the new HW_CACHE category.

( This could have caused some counter scheduling artifacts
  with mixed sw and hw counters and counter groups. )

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6e13395..7c4f32f 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -621,7 +621,8 @@ extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
 static inline int is_software_counter(struct perf_counter *counter)
 {
 	return (counter->attr.type != PERF_TYPE_RAW) &&
-		(counter->attr.type != PERF_TYPE_HARDWARE);
+		(counter->attr.type != PERF_TYPE_HARDWARE) &&
+		(counter->attr.type != PERF_TYPE_HW_CACHE);
 }
 
 extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Remove PERF_TYPE_RAW special casing
       [not found]             ` <new-submission>
                                 ` (202 preceding siblings ...)
  2009-06-12 12:42               ` [tip:perfcounters/core] perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too tip-bot for Peter Zijlstra
@ 2009-06-12 12:42               ` tip-bot for Peter Zijlstra
  2009-06-12 12:43               ` [tip:perfcounters/core] perf record: Explicity program a default counter tip-bot for Peter Zijlstra
                                 ` (503 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-12 12:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  081fad86178ec0f64f32f1bd04cf4aad22714fb9
Gitweb:     http://git.kernel.org/tip/081fad86178ec0f64f32f1bd04cf4aad22714fb9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 11 Jun 2009 17:57:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 12 Jun 2009 14:28:51 +0200

perf_counter: Remove PERF_TYPE_RAW special casing

The PERF_TYPE_RAW special case seems superfluous these days. Remove
it and add it to the switch() stmt like the others.

[ Impact: cleanup ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ef5d8a5..663bbe0 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3570,12 +3570,8 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP))
 		goto done;
 
-	if (attr->type == PERF_TYPE_RAW) {
-		pmu = hw_perf_counter_init(counter);
-		goto done;
-	}
-
 	switch (attr->type) {
+	case PERF_TYPE_RAW:
 	case PERF_TYPE_HARDWARE:
 	case PERF_TYPE_HW_CACHE:
 		pmu = hw_perf_counter_init(counter);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Explicity program a default counter
       [not found]             ` <new-submission>
                                 ` (203 preceding siblings ...)
  2009-06-12 12:42               ` [tip:perfcounters/core] perf_counter: Remove PERF_TYPE_RAW special casing tip-bot for Peter Zijlstra
@ 2009-06-12 12:43               ` tip-bot for Peter Zijlstra
  2009-06-12 12:43               ` [tip:perfcounters/core] perf_counter: Add forward/backward attribute ABI compatibility tip-bot for Peter Zijlstra
                                 ` (502 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-12 12:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  bbd36e5e6aa6f1757c84cdb406b6eb81686d14af
Gitweb:     http://git.kernel.org/tip/bbd36e5e6aa6f1757c84cdb406b6eb81686d14af
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 11 Jun 2009 23:11:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 12 Jun 2009 14:28:52 +0200

perf record: Explicity program a default counter

Up until now record has worked on the assumption that type=0, config=0
was a suitable configuration - which it is. Lets make this a little more
explicit and more readable via the use of proper symbols.

[ Impact: cleanup ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 29259e7..0f5771f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -568,8 +568,11 @@ int cmd_record(int argc, const char **argv, const char *prefix)
 	if (!argc && target_pid == -1 && !system_wide)
 		usage_with_options(record_usage, options);
 
-	if (!nr_counters)
-		nr_counters = 1;
+	if (!nr_counters) {
+		nr_counters	= 1;
+		attrs[0].type	= PERF_TYPE_HARDWARE;
+		attrs[0].config = PERF_COUNT_HW_CPU_CYCLES;
+	}
 
 	for (counter = 0; counter < nr_counters; counter++) {
 		if (attrs[counter].sample_period)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add forward/backward attribute ABI compatibility
       [not found]             ` <new-submission>
                                 ` (204 preceding siblings ...)
  2009-06-12 12:43               ` [tip:perfcounters/core] perf record: Explicity program a default counter tip-bot for Peter Zijlstra
@ 2009-06-12 12:43               ` tip-bot for Peter Zijlstra
  2009-06-13 14:49               ` [tip:perfcounters/core] perf_counter: Fix stack corruption in perf_read_hw tip-bot for Marti Raudsepp
                                 ` (501 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-12 12:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  974802eaa1afdc87e00821df7020a2b3c6fee623
Gitweb:     http://git.kernel.org/tip/974802eaa1afdc87e00821df7020a2b3c6fee623
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 12 Jun 2009 12:46:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 12 Jun 2009 14:28:52 +0200

perf_counter: Add forward/backward attribute ABI compatibility

Provide for means of extending the perf_counter_attr in a 'natural' way.

We allow growing the structure by appending fields at the end by specifying
the full structure size inside it.

When a new kernel sees a smaller (old) structure, it will 0 pad the tail.
When an old kernel sees a larger (new) structure, it will verify the tail
consists of 0s, otherwise fail.

If we fail due to a size-mismatch, we return -E2BIG and write the kernel's
native attribe size back into the provided structure.

Furthermore, add some attribute verification, so that we'll fail counter
creation when unknown bits are present (PERF_SAMPLE, PERF_FORMAT, or in
the __reserved fields).

(This ABI detail is introduced while keeping the existing syscall ABI.)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   19 +++++++--
 include/linux/syscalls.h     |    2 +-
 kernel/perf_counter.c        |   89 ++++++++++++++++++++++++++++++++++++++++-
 tools/perf/perf.h            |    5 +-
 4 files changed, 105 insertions(+), 10 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 7c4f32f..1b3118a 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -120,6 +120,8 @@ enum perf_counter_sample_format {
 	PERF_SAMPLE_ID				= 1U << 6,
 	PERF_SAMPLE_CPU				= 1U << 7,
 	PERF_SAMPLE_PERIOD			= 1U << 8,
+
+	PERF_SAMPLE_MAX = 1U << 9,		/* non-ABI */
 };
 
 /*
@@ -131,17 +133,26 @@ enum perf_counter_read_format {
 	PERF_FORMAT_TOTAL_TIME_ENABLED		= 1U << 0,
 	PERF_FORMAT_TOTAL_TIME_RUNNING		= 1U << 1,
 	PERF_FORMAT_ID				= 1U << 2,
+
+	PERF_FORMAT_MAX = 1U << 3, 		/* non-ABI */
 };
 
+#define PERF_ATTR_SIZE_VER0	64	/* sizeof first published struct */
+
 /*
  * Hardware event to monitor via a performance monitoring counter:
  */
 struct perf_counter_attr {
+
 	/*
 	 * Major type: hardware/software/tracepoint/etc.
 	 */
 	__u32			type;
-	__u32			__reserved_1;
+
+	/*
+	 * Size of the attr structure, for fwd/bwd compat.
+	 */
+	__u32			size;
 
 	/*
 	 * Type specific configuration information.
@@ -168,12 +179,12 @@ struct perf_counter_attr {
 				comm	       :  1, /* include comm data     */
 				freq           :  1, /* use freq, not period  */
 
-				__reserved_2   : 53;
+				__reserved_1   : 53;
 
 	__u32			wakeup_events;	/* wakeup every n events */
-	__u32			__reserved_3;
+	__u32			__reserved_2;
 
-	__u64			__reserved_4;
+	__u64			__reserved_3;
 };
 
 /*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c6c84ad..418d90f 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
 
 
 asmlinkage long sys_perf_counter_open(
-		const struct perf_counter_attr __user *attr_uptr,
+		struct perf_counter_attr __user *attr_uptr,
 		pid_t pid, int cpu, int group_fd, unsigned long flags);
 #endif
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 663bbe0..29b685f 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3584,6 +3584,9 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	case PERF_TYPE_TRACEPOINT:
 		pmu = tp_perf_counter_init(counter);
 		break;
+
+	default:
+		break;
 	}
 done:
 	err = 0;
@@ -3610,6 +3613,85 @@ done:
 	return counter;
 }
 
+static int perf_copy_attr(struct perf_counter_attr __user *uattr,
+			  struct perf_counter_attr *attr)
+{
+	int ret;
+	u32 size;
+
+	if (!access_ok(VERIFY_WRITE, uattr, PERF_ATTR_SIZE_VER0))
+		return -EFAULT;
+
+	/*
+	 * zero the full structure, so that a short copy will be nice.
+	 */
+	memset(attr, 0, sizeof(*attr));
+
+	ret = get_user(size, &uattr->size);
+	if (ret)
+		return ret;
+
+	if (size > PAGE_SIZE)	/* silly large */
+		goto err_size;
+
+	if (!size)		/* abi compat */
+		size = PERF_ATTR_SIZE_VER0;
+
+	if (size < PERF_ATTR_SIZE_VER0)
+		goto err_size;
+
+	/*
+	 * If we're handed a bigger struct than we know of,
+	 * ensure all the unknown bits are 0.
+	 */
+	if (size > sizeof(*attr)) {
+		unsigned long val;
+		unsigned long __user *addr;
+		unsigned long __user *end;
+
+		addr = PTR_ALIGN((void __user *)uattr + sizeof(*attr),
+				sizeof(unsigned long));
+		end  = PTR_ALIGN((void __user *)uattr + size,
+				sizeof(unsigned long));
+
+		for (; addr < end; addr += sizeof(unsigned long)) {
+			ret = get_user(val, addr);
+			if (ret)
+				return ret;
+			if (val)
+				goto err_size;
+		}
+	}
+
+	ret = copy_from_user(attr, uattr, size);
+	if (ret)
+		return -EFAULT;
+
+	/*
+	 * If the type exists, the corresponding creation will verify
+	 * the attr->config.
+	 */
+	if (attr->type >= PERF_TYPE_MAX)
+		return -EINVAL;
+
+	if (attr->__reserved_1 || attr->__reserved_2 || attr->__reserved_3)
+		return -EINVAL;
+
+	if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))
+		return -EINVAL;
+
+	if (attr->read_format & ~(PERF_FORMAT_MAX-1))
+		return -EINVAL;
+
+out:
+	return ret;
+
+err_size:
+	put_user(sizeof(*attr), &uattr->size);
+	ret = -E2BIG;
+	goto out;
+}
+
 /**
  * sys_perf_counter_open - open a performance counter, associate it to a task/cpu
  *
@@ -3619,7 +3701,7 @@ done:
  * @group_fd:		group leader counter fd
  */
 SYSCALL_DEFINE5(perf_counter_open,
-		const struct perf_counter_attr __user *, attr_uptr,
+		struct perf_counter_attr __user *, attr_uptr,
 		pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
 {
 	struct perf_counter *counter, *group_leader;
@@ -3635,8 +3717,9 @@ SYSCALL_DEFINE5(perf_counter_open,
 	if (flags)
 		return -EINVAL;
 
-	if (copy_from_user(&attr, attr_uptr, sizeof(attr)) != 0)
-		return -EFAULT;
+	ret = perf_copy_attr(attr_uptr, &attr);
+	if (ret)
+		return ret;
 
 	if (!attr.exclude_kernel) {
 		if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index af0a504..87a1aca 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -53,11 +53,12 @@ static inline unsigned long long rdclock(void)
 	_min1 < _min2 ? _min1 : _min2; })
 
 static inline int
-sys_perf_counter_open(struct perf_counter_attr *attr_uptr,
+sys_perf_counter_open(struct perf_counter_attr *attr,
 		      pid_t pid, int cpu, int group_fd,
 		      unsigned long flags)
 {
-	return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu,
+	attr->size = sizeof(*attr);
+	return syscall(__NR_perf_counter_open, attr, pid, cpu,
 		       group_fd, flags);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix stack corruption in perf_read_hw
       [not found]             ` <new-submission>
                                 ` (205 preceding siblings ...)
  2009-06-12 12:43               ` [tip:perfcounters/core] perf_counter: Add forward/backward attribute ABI compatibility tip-bot for Peter Zijlstra
@ 2009-06-13 14:49               ` tip-bot for Marti Raudsepp
  2009-06-13 14:49               ` [tip:perfcounters/core] perf stat: Reorganize output tip-bot for Ingo Molnar
                                 ` (500 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Marti Raudsepp @ 2009-06-13 14:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	marti, tglx, mingo

Commit-ID:  d5e8da6449d4ef4bac35ea9b9719a2cda02e7b39
Gitweb:     http://git.kernel.org/tip/d5e8da6449d4ef4bac35ea9b9719a2cda02e7b39
Author:     Marti Raudsepp <marti@juffo.org>
AuthorDate: Sat, 13 Jun 2009 02:35:01 +0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 13 Jun 2009 12:58:24 +0200

perf_counter: Fix stack corruption in perf_read_hw

With PERF_FORMAT_ID, perf_read_hw now needs space for up to 4 values.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 8d14a73..e914daf 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1553,7 +1553,7 @@ static int perf_release(struct inode *inode, struct file *file)
 static ssize_t
 perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
 {
-	u64 values[3];
+	u64 values[4];
 	int n;
 
 	/*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Reorganize output
       [not found]             ` <new-submission>
                                 ` (206 preceding siblings ...)
  2009-06-13 14:49               ` [tip:perfcounters/core] perf_counter: Fix stack corruption in perf_read_hw tip-bot for Marti Raudsepp
@ 2009-06-13 14:49               ` tip-bot for Ingo Molnar
  2009-06-13 14:49               ` [tip:perfcounters/core] perf stat: Add feature to run and measure a command multiple times tip-bot for Ingo Molnar
                                 ` (499 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-13 14:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  44175b6f397a6724121eeaf0f072e2c912a46614
Gitweb:     http://git.kernel.org/tip/44175b6f397a6724121eeaf0f072e2c912a46614
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 13 Jun 2009 13:35:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 13 Jun 2009 13:40:03 +0200

perf stat: Reorganize output

 - use IPC for the instruction normalization output
 - CPUs for the CPU utilization factor value.
 - print out time elapsed like the other rows
 - tidy up the task-clocks/cpu-clocks printout

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c      |   67 ++++++++++++++++++++++++----------------
 tools/perf/util/parse-events.c |    4 +-
 2 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c43e4a9..c128048 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -184,6 +184,40 @@ static void read_counter(int counter)
 		runtime_cycles = count[0];
 }
 
+static void nsec_printout(int counter, __u64 *count)
+{
+	double msecs = (double)count[0] / 1000000;
+
+	fprintf(stderr, " %14.6f  %-20s", msecs, event_name(counter));
+
+	if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
+		attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
+
+		if (walltime_nsecs)
+			fprintf(stderr, " # %10.3f CPUs",
+				(double)count[0] / (double)walltime_nsecs);
+	}
+}
+
+static void abs_printout(int counter, __u64 *count)
+{
+	fprintf(stderr, " %14Ld  %-20s", count[0], event_name(counter));
+
+	if (runtime_cycles &&
+		attrs[counter].type == PERF_TYPE_HARDWARE &&
+			attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
+
+		fprintf(stderr, " # %10.3f IPC",
+			(double)count[0] / (double)runtime_cycles);
+
+		return;
+	}
+
+	if (runtime_nsecs)
+		fprintf(stderr, " # %10.3f M/sec",
+			(double)count[0]/runtime_nsecs*1000.0);
+}
+
 /*
  * Print out the results of a single counter:
  */
@@ -201,35 +235,15 @@ static void print_counter(int counter)
 		return;
 	}
 
-	if (nsec_counter(counter)) {
-		double msecs = (double)count[0] / 1000000;
-
-		fprintf(stderr, " %14.6f  %-20s",
-			msecs, event_name(counter));
-		if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
-			attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
+	if (nsec_counter(counter))
+		nsec_printout(counter, count);
+	else
+		abs_printout(counter, count);
 
-			if (walltime_nsecs)
-				fprintf(stderr, " # %11.3f CPU utilization factor",
-					(double)count[0] / (double)walltime_nsecs);
-		}
-	} else {
-		fprintf(stderr, " %14Ld  %-20s",
-			count[0], event_name(counter));
-		if (runtime_nsecs)
-			fprintf(stderr, " # %11.3f M/sec",
-				(double)count[0]/runtime_nsecs*1000.0);
-		if (runtime_cycles &&
-			attrs[counter].type == PERF_TYPE_HARDWARE &&
-				attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
-
-			fprintf(stderr, " # %1.3f per cycle",
-				(double)count[0] / (double)runtime_cycles);
-		}
-	}
 	if (scaled)
 		fprintf(stderr, "  (scaled from %.2f%%)",
 			(double) count[2] / count[1] * 100);
+
 	fprintf(stderr, "\n");
 }
 
@@ -290,8 +304,7 @@ static int do_perf_stat(int argc, const char **argv)
 
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " Wall-clock time elapsed: %12.6f msecs\n",
-			(double)(t1-t0)/1e6);
+	fprintf(stderr, " %14.9f  seconds time elapsed.\n", (double)(t1-t0)/1e9);
 	fprintf(stderr, "\n");
 
 	return 0;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5a72586..f0c9f26 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -63,8 +63,8 @@ static char *hw_event_names[] = {
 };
 
 static char *sw_event_names[] = {
-	"cpu-clock-ticks",
-	"task-clock-ticks",
+	"cpu-clock-msecs",
+	"task-clock-msecs",
 	"page-faults",
 	"context-switches",
 	"CPU-migrations",

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Add feature to run and measure a command multiple times
       [not found]             ` <new-submission>
                                 ` (207 preceding siblings ...)
  2009-06-13 14:49               ` [tip:perfcounters/core] perf stat: Reorganize output tip-bot for Ingo Molnar
@ 2009-06-13 14:49               ` tip-bot for Ingo Molnar
  2009-06-13 14:50               ` [tip:perfcounters/core] perf stat: Enable raw data to be printed tip-bot for Ingo Molnar
                                 ` (498 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-13 14:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  42202dd56c717f173cd0bf2390249e1bf5cf210b
Gitweb:     http://git.kernel.org/tip/42202dd56c717f173cd0bf2390249e1bf5cf210b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 13 Jun 2009 14:57:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 13 Jun 2009 15:18:57 +0200

perf stat: Add feature to run and measure a command multiple times

Add the --repeat <n> feature to perf stat, which repeats a given
command up to a 100 times, collects the stats and calculates an
average and a stddev.

For example, the following oneliner 'perf stat' command runs hackbench
5 times and prints a tabulated result of all metrics, with averages
and noise levels (in percentage) printed:

 aldebaran:~/linux/linux/tools/perf> ./perf stat --repeat 5 ~/hackbench 10
 Time: 0.117
 Time: 0.108
 Time: 0.089
 Time: 0.088
 Time: 0.100

 Performance counter stats for '/home/mingo/hackbench 10' (5 runs):

    1243.989586  task-clock-msecs     #     10.460 CPUs    ( +-   4.720% )
          47706  context-switches     #      0.038 M/sec   ( +-  19.706% )
            387  CPU-migrations       #      0.000 M/sec   ( +-   3.608% )
          17793  page-faults          #      0.014 M/sec   ( +-   0.354% )
     3770941606  cycles               #   3031.329 M/sec   ( +-   4.621% )
     1566372416  instructions         #      0.415 IPC     ( +-   2.703% )
       16783421  cache-references     #     13.492 M/sec   ( +-   5.202% )
        7128590  cache-misses         #      5.730 M/sec   ( +-   7.420% )

    0.118924455  seconds time elapsed.

The goal of this feature is to allow the reliance on these accurate
statistics and to know how many times a command has to be repeated
for the noise to go down to an acceptable level.

(The -v option can be used to see a line printed out as each run progresses.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |  259 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 194 insertions(+), 65 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c128048..9eb42b1 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -43,6 +43,7 @@
 #include "util/parse-events.h"
 
 #include <sys/prctl.h>
+#include <math.h>
 
 static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
 
@@ -79,12 +80,34 @@ static const unsigned int default_count[] = {
 	  10000,
 };
 
-static __u64			event_res[MAX_COUNTERS][3];
-static __u64			event_scaled[MAX_COUNTERS];
+#define MAX_RUN 100
 
-static __u64			runtime_nsecs;
-static __u64			walltime_nsecs;
-static __u64			runtime_cycles;
+static int			run_count		=  1;
+static int			run_idx			=  0;
+
+static __u64			event_res[MAX_RUN][MAX_COUNTERS][3];
+static __u64			event_scaled[MAX_RUN][MAX_COUNTERS];
+
+//static __u64			event_hist[MAX_RUN][MAX_COUNTERS][3];
+
+
+static __u64			runtime_nsecs[MAX_RUN];
+static __u64			walltime_nsecs[MAX_RUN];
+static __u64			runtime_cycles[MAX_RUN];
+
+static __u64			event_res_avg[MAX_COUNTERS][3];
+static __u64			event_res_noise[MAX_COUNTERS][3];
+
+static __u64			event_scaled_avg[MAX_COUNTERS];
+
+static __u64			runtime_nsecs_avg;
+static __u64			runtime_nsecs_noise;
+
+static __u64			walltime_nsecs_avg;
+static __u64			walltime_nsecs_noise;
+
+static __u64			runtime_cycles_avg;
+static __u64			runtime_cycles_noise;
 
 static void create_perf_stat_counter(int counter)
 {
@@ -140,7 +163,7 @@ static void read_counter(int counter)
 	int cpu, nv;
 	int scaled;
 
-	count = event_res[counter];
+	count = event_res[run_idx][counter];
 
 	count[0] = count[1] = count[2] = 0;
 
@@ -151,6 +174,8 @@ static void read_counter(int counter)
 
 		res = read(fd[cpu][counter], single_count, nv * sizeof(__u64));
 		assert(res == nv * sizeof(__u64));
+		close(fd[cpu][counter]);
+		fd[cpu][counter] = -1;
 
 		count[0] += single_count[0];
 		if (scale) {
@@ -162,13 +187,13 @@ static void read_counter(int counter)
 	scaled = 0;
 	if (scale) {
 		if (count[2] == 0) {
-			event_scaled[counter] = -1;
+			event_scaled[run_idx][counter] = -1;
 			count[0] = 0;
 			return;
 		}
 
 		if (count[2] < count[1]) {
-			event_scaled[counter] = 1;
+			event_scaled[run_idx][counter] = 1;
 			count[0] = (unsigned long long)
 				((double)count[0] * count[1] / count[2] + 0.5);
 		}
@@ -178,13 +203,62 @@ static void read_counter(int counter)
 	 */
 	if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
 		attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
-		runtime_nsecs = count[0];
+		runtime_nsecs[run_idx] = count[0];
 	if (attrs[counter].type == PERF_TYPE_HARDWARE &&
 		attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES)
-		runtime_cycles = count[0];
+		runtime_cycles[run_idx] = count[0];
 }
 
-static void nsec_printout(int counter, __u64 *count)
+static int run_perf_stat(int argc, const char **argv)
+{
+	unsigned long long t0, t1;
+	int status = 0;
+	int counter;
+	int pid;
+
+	if (!system_wide)
+		nr_cpus = 1;
+
+	for (counter = 0; counter < nr_counters; counter++)
+		create_perf_stat_counter(counter);
+
+	/*
+	 * Enable counters and exec the command:
+	 */
+	t0 = rdclock();
+	prctl(PR_TASK_PERF_COUNTERS_ENABLE);
+
+	if ((pid = fork()) < 0)
+		perror("failed to fork");
+
+	if (!pid) {
+		if (execvp(argv[0], (char **)argv)) {
+			perror(argv[0]);
+			exit(-1);
+		}
+	}
+
+	wait(&status);
+
+	prctl(PR_TASK_PERF_COUNTERS_DISABLE);
+	t1 = rdclock();
+
+	walltime_nsecs[run_idx] = t1 - t0;
+
+	for (counter = 0; counter < nr_counters; counter++)
+		read_counter(counter);
+
+	return WEXITSTATUS(status);
+}
+
+static void print_noise(__u64 *count, __u64 *noise)
+{
+	if (run_count > 1)
+		fprintf(stderr, "   ( +- %7.3f%% )",
+			(double)noise[0]/(count[0]+1)*100.0);
+}
+
+static void nsec_printout(int counter, __u64 *count, __u64 *noise)
 {
 	double msecs = (double)count[0] / 1000000;
 
@@ -193,29 +267,30 @@ static void nsec_printout(int counter, __u64 *count)
 	if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
 		attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
 
-		if (walltime_nsecs)
-			fprintf(stderr, " # %10.3f CPUs",
-				(double)count[0] / (double)walltime_nsecs);
+		if (walltime_nsecs_avg)
+			fprintf(stderr, " # %10.3f CPUs ",
+				(double)count[0] / (double)walltime_nsecs_avg);
 	}
+	print_noise(count, noise);
 }
 
-static void abs_printout(int counter, __u64 *count)
+static void abs_printout(int counter, __u64 *count, __u64 *noise)
 {
 	fprintf(stderr, " %14Ld  %-20s", count[0], event_name(counter));
 
-	if (runtime_cycles &&
+	if (runtime_cycles_avg &&
 		attrs[counter].type == PERF_TYPE_HARDWARE &&
 			attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
 
-		fprintf(stderr, " # %10.3f IPC",
-			(double)count[0] / (double)runtime_cycles);
-
-		return;
+		fprintf(stderr, " # %10.3f IPC  ",
+			(double)count[0] / (double)runtime_cycles_avg);
+	} else {
+		if (runtime_nsecs_avg) {
+			fprintf(stderr, " # %10.3f M/sec",
+				(double)count[0]/runtime_nsecs_avg*1000.0);
+		}
 	}
-
-	if (runtime_nsecs)
-		fprintf(stderr, " # %10.3f M/sec",
-			(double)count[0]/runtime_nsecs*1000.0);
+	print_noise(count, noise);
 }
 
 /*
@@ -223,11 +298,12 @@ static void abs_printout(int counter, __u64 *count)
  */
 static void print_counter(int counter)
 {
-	__u64 *count;
+	__u64 *count, *noise;
 	int scaled;
 
-	count = event_res[counter];
-	scaled = event_scaled[counter];
+	count = event_res_avg[counter];
+	noise = event_res_noise[counter];
+	scaled = event_scaled_avg[counter];
 
 	if (scaled == -1) {
 		fprintf(stderr, " %14s  %-20s\n",
@@ -236,9 +312,9 @@ static void print_counter(int counter)
 	}
 
 	if (nsec_counter(counter))
-		nsec_printout(counter, count);
+		nsec_printout(counter, count, noise);
 	else
-		abs_printout(counter, count);
+		abs_printout(counter, count, noise);
 
 	if (scaled)
 		fprintf(stderr, "  (scaled from %.2f%%)",
@@ -247,43 +323,83 @@ static void print_counter(int counter)
 	fprintf(stderr, "\n");
 }
 
-static int do_perf_stat(int argc, const char **argv)
+/*
+ * Normalize noise values down to stddev:
+ */
+static void normalize(__u64 *val)
 {
-	unsigned long long t0, t1;
-	int counter;
-	int status;
-	int pid;
-	int i;
-
-	if (!system_wide)
-		nr_cpus = 1;
+	double res;
 
-	for (counter = 0; counter < nr_counters; counter++)
-		create_perf_stat_counter(counter);
+	res = (double)*val / (run_count * sqrt((double)run_count));
 
-	/*
-	 * Enable counters and exec the command:
-	 */
-	t0 = rdclock();
-	prctl(PR_TASK_PERF_COUNTERS_ENABLE);
+	*val = (__u64)res;
+}
 
-	if ((pid = fork()) < 0)
-		perror("failed to fork");
+/*
+ * Calculate the averages and noises:
+ */
+static void calc_avg(void)
+{
+	int i, j;
+
+	for (i = 0; i < run_count; i++) {
+		runtime_nsecs_avg += runtime_nsecs[i];
+		walltime_nsecs_avg += walltime_nsecs[i];
+		runtime_cycles_avg += runtime_cycles[i];
+
+		for (j = 0; j < nr_counters; j++) {
+			event_res_avg[j][0] += event_res[i][j][0];
+			event_res_avg[j][1] += event_res[i][j][1];
+			event_res_avg[j][2] += event_res[i][j][2];
+			event_scaled_avg[j] += event_scaled[i][j];
+		}
+	}
+	runtime_nsecs_avg /= run_count;
+	walltime_nsecs_avg /= run_count;
+	runtime_cycles_avg /= run_count;
+
+	for (j = 0; j < nr_counters; j++) {
+		event_res_avg[j][0] /= run_count;
+		event_res_avg[j][1] /= run_count;
+		event_res_avg[j][2] /= run_count;
+	}
 
-	if (!pid) {
-		if (execvp(argv[0], (char **)argv)) {
-			perror(argv[0]);
-			exit(-1);
+	for (i = 0; i < run_count; i++) {
+		runtime_nsecs_noise +=
+			abs((__s64)(runtime_nsecs[i] - runtime_nsecs_avg));
+		walltime_nsecs_noise +=
+			abs((__s64)(walltime_nsecs[i] - walltime_nsecs_avg));
+		runtime_cycles_noise +=
+			abs((__s64)(runtime_cycles[i] - runtime_cycles_avg));
+
+		for (j = 0; j < nr_counters; j++) {
+			event_res_noise[j][0] +=
+				abs((__s64)(event_res[i][j][0] - event_res_avg[j][0]));
+			event_res_noise[j][1] +=
+				abs((__s64)(event_res[i][j][1] - event_res_avg[j][1]));
+			event_res_noise[j][2] +=
+				abs((__s64)(event_res[i][j][2] - event_res_avg[j][2]));
 		}
 	}
 
-	while (wait(&status) >= 0)
-		;
+	normalize(&runtime_nsecs_noise);
+	normalize(&walltime_nsecs_noise);
+	normalize(&runtime_cycles_noise);
 
-	prctl(PR_TASK_PERF_COUNTERS_DISABLE);
-	t1 = rdclock();
+	for (j = 0; j < nr_counters; j++) {
+		normalize(&event_res_noise[j][0]);
+		normalize(&event_res_noise[j][1]);
+		normalize(&event_res_noise[j][2]);
+	}
+}
+
+static void print_stat(int argc, const char **argv)
+{
+	int i, counter;
+
+	calc_avg();
 
-	walltime_nsecs = t1 - t0;
+	run_idx = 0;
 
 	fflush(stdout);
 
@@ -293,21 +409,19 @@ static int do_perf_stat(int argc, const char **argv)
 	for (i = 1; i < argc; i++)
 		fprintf(stderr, " %s", argv[i]);
 
-	fprintf(stderr, "\':\n");
-	fprintf(stderr, "\n");
-
-	for (counter = 0; counter < nr_counters; counter++)
-		read_counter(counter);
+	fprintf(stderr, "\'");
+	if (run_count > 1)
+		fprintf(stderr, " (%d runs)", run_count);
+	fprintf(stderr, ":\n\n");
 
 	for (counter = 0; counter < nr_counters; counter++)
 		print_counter(counter);
 
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " %14.9f  seconds time elapsed.\n", (double)(t1-t0)/1e9);
+	fprintf(stderr, " %14.9f  seconds time elapsed.\n",
+			(double)walltime_nsecs_avg/1e9);
 	fprintf(stderr, "\n");
-
-	return 0;
 }
 
 static volatile int signr = -1;
@@ -345,11 +459,15 @@ static const struct option options[] = {
 			    "scale/normalize counters"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
+	OPT_INTEGER('r', "repeat", &run_count,
+		    "repeat command and print average + stddev (max: 100)"),
 	OPT_END()
 };
 
 int cmd_stat(int argc, const char **argv, const char *prefix)
 {
+	int status;
+
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	memcpy(attrs, default_attrs, sizeof(attrs));
@@ -357,6 +475,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, options, stat_usage, 0);
 	if (!argc)
 		usage_with_options(stat_usage, options);
+	if (run_count <= 0 || run_count > MAX_RUN)
+		usage_with_options(stat_usage, options);
 
 	if (!nr_counters)
 		nr_counters = 8;
@@ -376,5 +496,14 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 	signal(SIGALRM, skip_signal);
 	signal(SIGABRT, skip_signal);
 
-	return do_perf_stat(argc, argv);
+	status = 0;
+	for (run_idx = 0; run_idx < run_count; run_idx++) {
+		if (run_count != 1 && verbose)
+			fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx+1);
+		status = run_perf_stat(argc, argv);
+	}
+
+	print_stat(argc, argv);
+
+	return status;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf stat: Enable raw data to be printed
       [not found]             ` <new-submission>
                                 ` (208 preceding siblings ...)
  2009-06-13 14:49               ` [tip:perfcounters/core] perf stat: Add feature to run and measure a command multiple times tip-bot for Ingo Molnar
@ 2009-06-13 14:50               ` tip-bot for Ingo Molnar
  2009-06-13 18:36               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
                                 ` (497 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-13 14:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  ef281a196d66b8bc2d067a3704712e5b93691fbc
Gitweb:     http://git.kernel.org/tip/ef281a196d66b8bc2d067a3704712e5b93691fbc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 13 Jun 2009 15:40:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 13 Jun 2009 15:40:35 +0200

perf stat: Enable raw data to be printed

If -vv (very verbose) is specified, print out raw data
in the following format:

$ perf stat -vv -r 3 ./loop_1b_instructions

[ perf stat: executing run #1 ... ]
[ perf stat: executing run #2 ... ]
[ perf stat: executing run #3 ... ]

debug:              runtime[0]: 235871872
debug:             walltime[0]: 236646752
debug:       runtime_cycles[0]: 755150182
debug:            counter/0[0]: 235871872
debug:            counter/1[0]: 235871872
debug:            counter/2[0]: 235871872
debug:               scaled[0]: 0
debug:            counter/0[1]: 2
debug:            counter/1[1]: 235870662
debug:            counter/2[1]: 235870662
debug:               scaled[1]: 0
debug:            counter/0[2]: 1
debug:            counter/1[2]: 235870437
debug:            counter/2[2]: 235870437
debug:               scaled[2]: 0
debug:            counter/0[3]: 140
debug:            counter/1[3]: 235870298
debug:            counter/2[3]: 235870298
debug:               scaled[3]: 0
debug:            counter/0[4]: 755150182
debug:            counter/1[4]: 235870145
debug:            counter/2[4]: 235870145
debug:               scaled[4]: 0
debug:            counter/0[5]: 1001411258
debug:            counter/1[5]: 235868838
debug:            counter/2[5]: 235868838
debug:               scaled[5]: 0
debug:            counter/0[6]: 27897
debug:            counter/1[6]: 235868560
debug:            counter/2[6]: 235868560
debug:               scaled[6]: 0
debug:            counter/0[7]: 2910
debug:            counter/1[7]: 235868151
debug:            counter/2[7]: 235868151
debug:               scaled[7]: 0
debug:              runtime[0]: 235980257
debug:             walltime[0]: 236770942
debug:       runtime_cycles[0]: 755114546
debug:            counter/0[0]: 235980257
debug:            counter/1[0]: 235980257
debug:            counter/2[0]: 235980257
debug:               scaled[0]: 0
debug:            counter/0[1]: 3
debug:            counter/1[1]: 235980049
debug:            counter/2[1]: 235980049
debug:               scaled[1]: 0
debug:            counter/0[2]: 1
debug:            counter/1[2]: 235979907
debug:            counter/2[2]: 235979907
debug:               scaled[2]: 0
debug:            counter/0[3]: 135
debug:            counter/1[3]: 235979780
debug:            counter/2[3]: 235979780
debug:               scaled[3]: 0
debug:            counter/0[4]: 755114546
debug:            counter/1[4]: 235979652
debug:            counter/2[4]: 235979652
debug:               scaled[4]: 0
debug:            counter/0[5]: 1001439771
debug:            counter/1[5]: 235979304
debug:            counter/2[5]: 235979304
debug:               scaled[5]: 0
debug:            counter/0[6]: 23723
debug:            counter/1[6]: 235979050
debug:            counter/2[6]: 235979050
debug:               scaled[6]: 0
debug:            counter/0[7]: 2213
debug:            counter/1[7]: 235978820
debug:            counter/2[7]: 235978820
debug:               scaled[7]: 0
debug:              runtime[0]: 235888002
debug:             walltime[0]: 236700533
debug:       runtime_cycles[0]: 754881504
debug:            counter/0[0]: 235888002
debug:            counter/1[0]: 235888002
debug:            counter/2[0]: 235888002
debug:               scaled[0]: 0
debug:            counter/0[1]: 2
debug:            counter/1[1]: 235887793
debug:            counter/2[1]: 235887793
debug:               scaled[1]: 0
debug:            counter/0[2]: 1
debug:            counter/1[2]: 235887645
debug:            counter/2[2]: 235887645
debug:               scaled[2]: 0
debug:            counter/0[3]: 135
debug:            counter/1[3]: 235887499
debug:            counter/2[3]: 235887499
debug:               scaled[3]: 0
debug:            counter/0[4]: 754881504
debug:            counter/1[4]: 235887368
debug:            counter/2[4]: 235887368
debug:               scaled[4]: 0
debug:            counter/0[5]: 1001401731
debug:            counter/1[5]: 235887024
debug:            counter/2[5]: 235887024
debug:               scaled[5]: 0
debug:            counter/0[6]: 24212
debug:            counter/1[6]: 235886786
debug:            counter/2[6]: 235886786
debug:               scaled[6]: 0
debug:            counter/0[7]: 1824
debug:            counter/1[7]: 235886560
debug:            counter/2[7]: 235886560
debug:               scaled[7]: 0

 Performance counter stats for '/home/mingo/loop_1b_instructions' (3 runs):

     235.913377  task-clock-msecs     #      0.997 CPUs    ( +-   0.011% )
              2  context-switches     #      0.000 M/sec   ( +-   0.000% )
              1  CPU-migrations       #      0.000 M/sec   ( +-   0.000% )
            136  page-faults          #      0.001 M/sec   ( +-   0.730% )
      755048744  cycles               #   3200.534 M/sec   ( +-   0.009% )
     1001417586  instructions         #      1.326 IPC     ( +-   0.001% )
          25277  cache-references     #      0.107 M/sec   ( +-   3.988% )
           2315  cache-misses         #      0.010 M/sec   ( +-   9.845% )

    0.236706075  seconds time elapsed.

This allows the summary stats to be validated.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile       |    2 +-
 tools/perf/builtin-stat.c |   46 ++++++++++++++++++++++++++++----------------
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0cbd5d6..e8346f9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -160,7 +160,7 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 CFLAGS = -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6
-LDFLAGS = -lpthread -lrt -lelf
+LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9eb42b1..e5b3c0f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -324,9 +324,9 @@ static void print_counter(int counter)
 }
 
 /*
- * Normalize noise values down to stddev:
+ * normalize_noise noise values down to stddev:
  */
-static void normalize(__u64 *val)
+static void normalize_noise(__u64 *val)
 {
 	double res;
 
@@ -335,6 +335,13 @@ static void normalize(__u64 *val)
 	*val = (__u64)res;
 }
 
+static void update_avg(const char *name, int idx, __u64 *avg, __u64 *val)
+{
+	*avg += *val;
+
+	if (verbose > 1)
+		fprintf(stderr, "debug: %20s[%d]: %Ld\n", name, idx, *val);
+}
 /*
  * Calculate the averages and noises:
  */
@@ -342,16 +349,23 @@ static void calc_avg(void)
 {
 	int i, j;
 
+	if (verbose > 1)
+		fprintf(stderr, "\n");
+
 	for (i = 0; i < run_count; i++) {
-		runtime_nsecs_avg += runtime_nsecs[i];
-		walltime_nsecs_avg += walltime_nsecs[i];
-		runtime_cycles_avg += runtime_cycles[i];
+		update_avg("runtime", 0, &runtime_nsecs_avg, runtime_nsecs + i);
+		update_avg("walltime", 0, &walltime_nsecs_avg, walltime_nsecs + i);
+		update_avg("runtime_cycles", 0, &runtime_cycles_avg, runtime_cycles + i);
 
 		for (j = 0; j < nr_counters; j++) {
-			event_res_avg[j][0] += event_res[i][j][0];
-			event_res_avg[j][1] += event_res[i][j][1];
-			event_res_avg[j][2] += event_res[i][j][2];
-			event_scaled_avg[j] += event_scaled[i][j];
+			update_avg("counter/0", j,
+				event_res_avg[j]+0, event_res[i][j]+0);
+			update_avg("counter/1", j,
+				event_res_avg[j]+1, event_res[i][j]+1);
+			update_avg("counter/2", j,
+				event_res_avg[j]+2, event_res[i][j]+2);
+			update_avg("scaled", j,
+				event_scaled_avg + j, event_scaled[i]+j);
 		}
 	}
 	runtime_nsecs_avg /= run_count;
@@ -382,14 +396,14 @@ static void calc_avg(void)
 		}
 	}
 
-	normalize(&runtime_nsecs_noise);
-	normalize(&walltime_nsecs_noise);
-	normalize(&runtime_cycles_noise);
+	normalize_noise(&runtime_nsecs_noise);
+	normalize_noise(&walltime_nsecs_noise);
+	normalize_noise(&runtime_cycles_noise);
 
 	for (j = 0; j < nr_counters; j++) {
-		normalize(&event_res_noise[j][0]);
-		normalize(&event_res_noise[j][1]);
-		normalize(&event_res_noise[j][2]);
+		normalize_noise(&event_res_noise[j][0]);
+		normalize_noise(&event_res_noise[j][1]);
+		normalize_noise(&event_res_noise[j][2]);
 	}
 }
 
@@ -399,8 +413,6 @@ static void print_stat(int argc, const char **argv)
 
 	calc_avg();
 
-	run_idx = 0;
-
 	fflush(stdout);
 
 	fprintf(stderr, "\n");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: Select frame pointers on x86
       [not found]             ` <new-submission>
                                 ` (209 preceding siblings ...)
  2009-06-13 14:50               ` [tip:perfcounters/core] perf stat: Enable raw data to be printed tip-bot for Ingo Molnar
@ 2009-06-13 18:36               ` tip-bot for Peter Zijlstra
  2009-06-14 13:54               ` [tip:perfcounters/core] perf report: Print out raw events in hexa tip-bot for Ingo Molnar
                                 ` (496 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-13 18:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, akpm, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  c3c214ad629f5b34d753a74f01ea850a02974d34
Gitweb:     http://git.kernel.org/tip/c3c214ad629f5b34d753a74f01ea850a02974d34
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 12 Jun 2009 10:04:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 13 Jun 2009 20:32:57 +0200

lockdep: Select frame pointers on x86

x86 stack traces are a piece of crap without frame pointers, and its not
like the 'performance gain' of not having stack pointers matters when you
selected lockdep.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Cc: <stable@kernel.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/Kconfig.debug |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6cdcf38..3be4b7c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -440,7 +440,7 @@ config LOCKDEP
 	bool
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
 	select STACKTRACE
-	select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
+	select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
 	select KALLSYMS
 	select KALLSYMS_ALL
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Print out raw events in hexa
       [not found]             ` <new-submission>
                                 ` (210 preceding siblings ...)
  2009-06-13 18:36               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
@ 2009-06-14 13:54               ` tip-bot for Ingo Molnar
  2009-06-14 14:12               ` [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling tip-bot for Ingo Molnar
                                 ` (495 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-14 13:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  8465b05046652cfde3d47692cab2e8ba962f140f
Gitweb:     http://git.kernel.org/tip/8465b05046652cfde3d47692cab2e8ba962f140f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 14 Jun 2009 14:44:07 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 14 Jun 2009 14:45:12 +0200

perf report: Print out raw events in hexa

Print out events in hexa dump format, when -D is specified:

0x4868 [0x48]: event: 1

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
       [not found]             ` <new-submission>
                                 ` (211 preceding siblings ...)
  2009-06-14 13:54               ` [tip:perfcounters/core] perf report: Print out raw events in hexa tip-bot for Ingo Molnar
@ 2009-06-14 14:12               ` tip-bot for Ingo Molnar
  2009-06-14 18:36               ` tip-bot for Ingo Molnar
                                 ` (494 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-14 14:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, penberg,
	efault, arjan, fweisbec, tglx, mingo

Commit-ID:  ced7769616b40c7a0d597af775d4f123fb54dc95
Gitweb:     http://git.kernel.org/tip/ced7769616b40c7a0d597af775d4f123fb54dc95
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 14 Jun 2009 15:04:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 14 Jun 2009 15:04:15 +0200

perf record/report: Add call graph / call chain profiling

Add the first steps of call-graph profiling:

 - add the -c (--call-graph) option to perf record
 - parse the call-graph record and printout out under -D (--dump-trace)

The call-graph data is not put into the histogram yet, but it
can be seen that it's being processed correctly:

0x3ce0 [0x38]: event: 35

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
       [not found]             ` <new-submission>
                                 ` (212 preceding siblings ...)
  2009-06-14 14:12               ` [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling tip-bot for Ingo Molnar
@ 2009-06-14 18:36               ` tip-bot for Ingo Molnar
  2009-06-15  7:14                 ` Yong Wang
  2009-06-16  2:57                 ` Frederic Weisbecker
  2009-06-14 20:39               ` [tip:perfcounters/core] perf_counter, x86: Fix call-chain walking tip-bot for Ingo Molnar
                                 ` (493 subsequent siblings)
  707 siblings, 2 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-14 18:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, penberg,
	efault, arjan, fweisbec, tglx, mingo

Commit-ID:  3efa1cc99ec51bc7a7ae0011a16619fd20dbe6ea
Gitweb:     http://git.kernel.org/tip/3efa1cc99ec51bc7a7ae0011a16619fd20dbe6ea
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 14 Jun 2009 15:04:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 14 Jun 2009 20:34:06 +0200

perf record/report: Add call graph / call chain profiling

Add the first steps of call-graph profiling:

 - add the -c (--call-graph) option to perf record
 - parse the call-graph record and printout out under -D (--dump-trace)

The call-graph data is not put into the histogram yet, but it
can be seen that it's being processed correctly:

0x3ce0 [0x38]: event: 35
.
. ... raw event: size 56 bytes
.  0000:  23 00 00 00 05 00 38 00 d4 df 0e 81 ff ff ff ff  #.....8........
.  0010:  60 0b 00 00 60 0b 00 00 03 00 00 00 01 00 02 00  `...`..........
.  0020:  d4 df 0e 81 ff ff ff ff a0 61 ed 41 36 00 00 00  .........a.A6..
.  0030:  04 92 e6 41 36 00 00 00                          .a.A6..
.
0x3ce0 [0x38]: PERF_EVENT (IP, 5): 2912: 0xffffffff810edfd4 period: 1
... chain: u:2, k:1, nr:3
.....  0: 0xffffffff810edfd4
.....  1: 0x3641ed61a0
.....  2: 0x3641e69204
 ... thread: perf:2912
 ...... dso: [kernel]

This shows a 3-entry call-graph: with 1 kernel-space and two user-space
entries

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |    8 ++++++
 tools/perf/builtin-report.c |   57 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0f5771f..a177a59 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -37,6 +37,7 @@ static pid_t			target_pid			= -1;
 static int			inherit				= 1;
 static int			force				= 0;
 static int			append_file			= 0;
+static int			call_graph			= 0;
 static int			verbose				= 0;
 
 static long			samples;
@@ -351,11 +352,16 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	int track = 1;
 
 	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+
 	if (freq) {
 		attr->sample_type	|= PERF_SAMPLE_PERIOD;
 		attr->freq		= 1;
 		attr->sample_freq	= freq;
 	}
+
+	if (call_graph)
+		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
+
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= (cpu < 0) && inherit;
@@ -555,6 +561,8 @@ static const struct option options[] = {
 		    "profile at this frequency"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
 		    "number of mmap data pages"),
+	OPT_BOOLEAN('g', "call-graph", &call_graph,
+		    "do call-graph (stack chain/backtrace) recording"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
 	OPT_END()
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 37515da..aebba56 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -36,6 +36,7 @@ static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static int		dump_trace = 0;
 #define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
+#define cdprintf(x...)	do { if (dump_trace) color_fprintf(stdout, color, x); } while (0)
 
 static int		verbose;
 static int		full_paths;
@@ -43,11 +44,19 @@ static int		full_paths;
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
+struct ip_chain_event {
+	__u16 nr;
+	__u16 hv;
+	__u16 kernel;
+	__u16 user;
+	__u64 ips[];
+};
+
 struct ip_event {
 	struct perf_event_header header;
 	__u64 ip;
 	__u32 pid, tid;
-	__u64 period;
+	unsigned char __more_data[];
 };
 
 struct mmap_event {
@@ -944,9 +953,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	__u64 ip = event->ip.ip;
 	__u64 period = 1;
 	struct map *map = NULL;
+	void *more_data = event->ip.__more_data;
+	struct ip_chain_event *chain;
 
-	if (event->header.type & PERF_SAMPLE_PERIOD)
-		period = event->ip.period;
+	if (event->header.type & PERF_SAMPLE_PERIOD) {
+		period = *(__u64 *)more_data;
+		more_data += sizeof(__u64);
+	}
 
 	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
 		(void *)(offset + head),
@@ -956,6 +969,22 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 		(void *)(long)ip,
 		(long long)period);
 
+	if (event->header.type & PERF_SAMPLE_CALLCHAIN) {
+		int i;
+
+		chain = (void *)more_data;
+
+		if (dump_trace) {
+			dprintf("... chain: u:%d, k:%d, nr:%d\n",
+				chain->user,
+				chain->kernel,
+				chain->nr);
+
+			for (i = 0; i < chain->nr; i++)
+				dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
+		}
+	}
+
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
 
 	if (thread == NULL) {
@@ -1098,30 +1127,34 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head)
 static void trace_event(event_t *event)
 {
 	unsigned char *raw_event = (void *)event;
+	char *color = PERF_COLOR_BLUE;
 	int i, j;
 
 	if (!dump_trace)
 		return;
 
-	dprintf(".\n. ... raw event: size %d bytes\n", event->header.size);
+	dprintf(".");
+	cdprintf("\n. ... raw event: size %d bytes\n", event->header.size);
 
 	for (i = 0; i < event->header.size; i++) {
-		if ((i & 15) == 0)
-			dprintf(".  %04x: ", i);
+		if ((i & 15) == 0) {
+			dprintf(".");
+			cdprintf("  %04x: ", i);
+		}
 
-		dprintf(" %02x", raw_event[i]);
+		cdprintf(" %02x", raw_event[i]);
 
 		if (((i & 15) == 15) || i == event->header.size-1) {
-			dprintf("  ");
+			cdprintf("  ");
 			for (j = 0; j < 15-(i & 15); j++)
-				dprintf("   ");
+				cdprintf("   ");
 			for (j = 0; j < (i & 15); j++) {
 				if (isprint(raw_event[i-15+j]))
-					dprintf("%c", raw_event[i-15+j]);
+					cdprintf("%c", raw_event[i-15+j]);
 				else
-					dprintf(".");
+					cdprintf(".");
 			}
-			dprintf("\n");
+			cdprintf("\n");
 		}
 	}
 	dprintf(".\n");

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Fix call-chain walking
       [not found]             ` <new-submission>
                                 ` (213 preceding siblings ...)
  2009-06-14 18:36               ` tip-bot for Ingo Molnar
@ 2009-06-14 20:39               ` tip-bot for Ingo Molnar
  2009-06-15  7:24               ` [tip:perfcounters/core] perf record: Fix fast task-exit race tip-bot for Ingo Molnar
                                 ` (492 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-14 20:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, penberg,
	efault, arjan, fweisbec, tglx, mingo

Commit-ID:  5a6cec3abbdb74244caab68db100825a8c4ac02d
Gitweb:     http://git.kernel.org/tip/5a6cec3abbdb74244caab68db100825a8c4ac02d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 29 May 2009 11:25:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 14 Jun 2009 22:37:15 +0200

perf_counter, x86: Fix call-chain walking

Fix the ptregs variant when we hit user-mode tasks.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 77a59a5..09d8cb6 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1644,7 +1644,9 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	const void __user *fp;
 	int nr = entry->nr;
 
-	regs = (struct pt_regs *)current->thread.sp0 - 1;
+	if (!user_mode(regs))
+		regs = task_pt_regs(current);
+
 	fp   = (void __user *)regs->bp;
 
 	callchain_store(entry, regs->ip);
@@ -1656,7 +1658,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 		if (!copy_stack_frame(fp, &frame))
 			break;
 
-		if ((unsigned long)fp < user_stack_pointer(regs))
+		if ((unsigned long)fp < regs->sp)
 			break;
 
 		callchain_store(entry, frame.return_address);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-14 18:36               ` tip-bot for Ingo Molnar
@ 2009-06-15  7:14                 ` Yong Wang
  2009-06-16  2:57                 ` Frederic Weisbecker
  1 sibling, 0 replies; 1149+ messages in thread
From: Yong Wang @ 2009-06-15  7:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

On Sun, Jun 14, 2009 at 06:36:32PM +0000, tip-bot for Ingo Molnar wrote:
> +struct ip_chain_event {
> +	__u16 nr;
> +	__u16 hv;
> +	__u16 kernel;
> +	__u16 user;
> +	__u64 ips[];
> +};
> +

The following error on my 32bit box:

cc1: warnings being treated as errors
builtin-report.c: In function 'process_overflow_event':
builtin-report.c:984: error: cast to pointer from integer of different
size
make: *** [builtin-report.o] Error 1

unsigned long ips[] perhaps?

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Fix fast task-exit race
       [not found]             ` <new-submission>
                                 ` (214 preceding siblings ...)
  2009-06-14 20:39               ` [tip:perfcounters/core] perf_counter, x86: Fix call-chain walking tip-bot for Ingo Molnar
@ 2009-06-15  7:24               ` tip-bot for Ingo Molnar
  2009-06-15  8:03               ` [tip:perfcounters/core] perf_counter, x86: Fix kernel-space call-chains tip-bot for Ingo Molnar
                                 ` (491 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15  7:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  667d13da070a444aeb4ad4cf7b793c8c8f64dc5d
Gitweb:     http://git.kernel.org/tip/667d13da070a444aeb4ad4cf7b793c8c8f64dc5d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 08:17:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 08:17:12 +0200

perf record: Fix fast task-exit race

Recording with -a (or with -p) can race with tasks going away:

   couldn't open /proc/8440/maps

Causing an early exit() and no recording done.

Do not abort the recording session - instead just skip that task.

Also, only print the warnings under -v.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   16 ++++++++++++----
 tools/perf/builtin-report.c |    2 ++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a177a59..e1dfef2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -202,8 +202,12 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
 
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
-		fprintf(stderr, "couldn't open %s\n", filename);
-		exit(EXIT_FAILURE);
+		/*
+		 * We raced with a task exiting - just return:
+		 */
+		if (verbose)
+			fprintf(stderr, "couldn't open %s\n", filename);
+		return;
 	}
 	if (read(fd, bf, sizeof(bf)) < 0) {
 		fprintf(stderr, "couldn't read %s\n", filename);
@@ -273,8 +277,12 @@ static void pid_synthesize_mmap_samples(pid_t pid)
 
 	fp = fopen(filename, "r");
 	if (fp == NULL) {
-		fprintf(stderr, "couldn't open %s\n", filename);
-		exit(EXIT_FAILURE);
+		/*
+		 * We raced with a task exiting - just return:
+		 */
+		if (verbose)
+			fprintf(stderr, "couldn't open %s\n", filename);
+		return;
 	}
 	while (1) {
 		char bf[BUFSIZ], *pbf = bf;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index aebba56..51f38b2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -983,6 +983,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 			for (i = 0; i < chain->nr; i++)
 				dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
 		}
+		if (chain->kernel)
+			ip = chain->ips[chain->kernel-1];
 	}
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Fix kernel-space call-chains
       [not found]             ` <new-submission>
                                 ` (215 preceding siblings ...)
  2009-06-15  7:24               ` [tip:perfcounters/core] perf record: Fix fast task-exit race tip-bot for Ingo Molnar
@ 2009-06-15  8:03               ` tip-bot for Ingo Molnar
  2009-06-15  8:33               ` tip-bot for Ingo Molnar
                                 ` (490 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15  8:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  1f3d4ecee6fe08ca7ed1ef131a8a8903d613d730
Gitweb:     http://git.kernel.org/tip/1f3d4ecee6fe08ca7ed1ef131a8a8903d613d730
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 09:57:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 09:58:00 +0200

perf_counter, x86: Fix kernel-space call-chains

Kernel-space call-chains were trimmed at the first entry because
we never processed anything beyond the first stack context.

Allow the backtrace to jump from NMI to IRQ stack then to task stack
and finally user-space stack.

Also calculate the stack and bp variables correctly so that the
stack walker does not exit early.

We can get deep traces as a result, visible in perf report -D output:

0x32af0 [0xe0]: PERF_EVENT (IP, 5): 15134: 0xffffffff815225fd period: 1
... chain: u:2, k:22, nr:24
.....  0: 0xffffffff815225fd
.....  1: 0xffffffff810ac51c
.....  2: 0xffffffff81018e29
.....  3: 0xffffffff81523939
.....  4: 0xffffffff81524b8f
.....  5: 0xffffffff81524bd9
.....  6: 0xffffffff8105e498
.....  7: 0xffffffff8152315a
.....  8: 0xffffffff81522c3a
.....  9: 0xffffffff810d9b74
..... 10: 0xffffffff810dbeec
..... 11: 0xffffffff810dc3fb

This is a 22-entries kernel-space chain.

(We still only record reliable stack entries.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 09d8cb6..6d5e7cf 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1575,8 +1575,8 @@ static void backtrace_warning(void *data, char *msg)
 
 static int backtrace_stack(void *data, char *name)
 {
-	/* Don't bother with IRQ stacks for now */
-	return -1;
+	/* Process all stacks: */
+	return 0;
 }
 
 static void backtrace_address(void *data, unsigned long addr, int reliable)
@@ -1594,6 +1594,8 @@ static const struct stacktrace_ops backtrace_ops = {
 	.address		= backtrace_address,
 };
 
+#include "../dumpstack.h"
+
 static void
 perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 {
@@ -1601,26 +1603,20 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	char *stack;
 	int nr = entry->nr;
 
-	callchain_store(entry, instruction_pointer(regs));
+	callchain_store(entry, regs->ip);
 
 	stack = ((char *)regs + sizeof(struct pt_regs));
 #ifdef CONFIG_FRAME_POINTER
-	bp = frame_pointer(regs);
+	get_bp(bp);
 #else
 	bp = 0;
 #endif
 
-	dump_trace(NULL, regs, (void *)stack, bp, &backtrace_ops, entry);
+	dump_trace(NULL, regs, (void *)&stack, bp, &backtrace_ops, entry);
 
 	entry->kernel = entry->nr - nr;
 }
 
-
-struct stack_frame {
-	const void __user	*next_fp;
-	unsigned long		return_address;
-};
-
 static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
 {
 	int ret;
@@ -1652,7 +1648,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	callchain_store(entry, regs->ip);
 
 	while (entry->nr < MAX_STACK_DEPTH) {
-		frame.next_fp	     = NULL;
+		frame.next_frame	     = NULL;
 		frame.return_address = 0;
 
 		if (!copy_stack_frame(fp, &frame))
@@ -1662,7 +1658,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 			break;
 
 		callchain_store(entry, frame.return_address);
-		fp = frame.next_fp;
+		fp = frame.next_frame;
 	}
 
 	entry->user = entry->nr - nr;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Fix kernel-space call-chains
       [not found]             ` <new-submission>
                                 ` (216 preceding siblings ...)
  2009-06-15  8:03               ` [tip:perfcounters/core] perf_counter, x86: Fix kernel-space call-chains tip-bot for Ingo Molnar
@ 2009-06-15  8:33               ` tip-bot for Ingo Molnar
  2009-06-15  8:33               ` [tip:perfcounters/core] perf record: Fix fast task-exit race tip-bot for Ingo Molnar
                                 ` (489 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  038e836e97e70c4ad2b5058b07fc7207f50b59dd
Gitweb:     http://git.kernel.org/tip/038e836e97e70c4ad2b5058b07fc7207f50b59dd
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 09:57:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 09:08:08 +0200

perf_counter, x86: Fix kernel-space call-chains

Kernel-space call-chains were trimmed at the first entry because
we never processed anything beyond the first stack context.

Allow the backtrace to jump from NMI to IRQ stack then to task stack
and finally user-space stack.

Also calculate the stack and bp variables correctly so that the
stack walker does not exit early.

We can get deep traces as a result, visible in perf report -D output:

0x32af0 [0xe0]: PERF_EVENT (IP, 5): 15134: 0xffffffff815225fd period: 1
... chain: u:2, k:22, nr:24
.....  0: 0xffffffff815225fd
.....  1: 0xffffffff810ac51c
.....  2: 0xffffffff81018e29
.....  3: 0xffffffff81523939
.....  4: 0xffffffff81524b8f
.....  5: 0xffffffff81524bd9
.....  6: 0xffffffff8105e498
.....  7: 0xffffffff8152315a
.....  8: 0xffffffff81522c3a
.....  9: 0xffffffff810d9b74
..... 10: 0xffffffff810dbeec
..... 11: 0xffffffff810dc3fb

This is a 22-entries kernel-space chain.

(We still only record reliable stack entries.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 09d8cb6..6d5e7cf 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1575,8 +1575,8 @@ static void backtrace_warning(void *data, char *msg)
 
 static int backtrace_stack(void *data, char *name)
 {
-	/* Don't bother with IRQ stacks for now */
-	return -1;
+	/* Process all stacks: */
+	return 0;
 }
 
 static void backtrace_address(void *data, unsigned long addr, int reliable)
@@ -1594,6 +1594,8 @@ static const struct stacktrace_ops backtrace_ops = {
 	.address		= backtrace_address,
 };
 
+#include "../dumpstack.h"
+
 static void
 perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 {
@@ -1601,26 +1603,20 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	char *stack;
 	int nr = entry->nr;
 
-	callchain_store(entry, instruction_pointer(regs));
+	callchain_store(entry, regs->ip);
 
 	stack = ((char *)regs + sizeof(struct pt_regs));
 #ifdef CONFIG_FRAME_POINTER
-	bp = frame_pointer(regs);
+	get_bp(bp);
 #else
 	bp = 0;
 #endif
 
-	dump_trace(NULL, regs, (void *)stack, bp, &backtrace_ops, entry);
+	dump_trace(NULL, regs, (void *)&stack, bp, &backtrace_ops, entry);
 
 	entry->kernel = entry->nr - nr;
 }
 
-
-struct stack_frame {
-	const void __user	*next_fp;
-	unsigned long		return_address;
-};
-
 static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
 {
 	int ret;
@@ -1652,7 +1648,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	callchain_store(entry, regs->ip);
 
 	while (entry->nr < MAX_STACK_DEPTH) {
-		frame.next_fp	     = NULL;
+		frame.next_frame	     = NULL;
 		frame.return_address = 0;
 
 		if (!copy_stack_frame(fp, &frame))
@@ -1662,7 +1658,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 			break;
 
 		callchain_store(entry, frame.return_address);
-		fp = frame.next_fp;
+		fp = frame.next_frame;
 	}
 
 	entry->user = entry->nr - nr;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf record: Fix fast task-exit race
       [not found]             ` <new-submission>
                                 ` (217 preceding siblings ...)
  2009-06-15  8:33               ` tip-bot for Ingo Molnar
@ 2009-06-15  8:33               ` tip-bot for Ingo Molnar
  2009-06-15 14:07               ` [tip:perfcounters/core] x86, mm: Add __get_user_pages_fast() tip-bot for Peter Zijlstra
                                 ` (488 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  613d8602292165f86ba1969784fea01a06d55900
Gitweb:     http://git.kernel.org/tip/613d8602292165f86ba1969784fea01a06d55900
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 08:17:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 09:08:31 +0200

perf record: Fix fast task-exit race

Recording with -a (or with -p) can race with tasks going away:

   couldn't open /proc/8440/maps

Causing an early exit() and no recording done.

Do not abort the recording session - instead just skip that task.

Also, only print the warnings under -v.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a177a59..e1dfef2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -202,8 +202,12 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
 
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
-		fprintf(stderr, "couldn't open %s\n", filename);
-		exit(EXIT_FAILURE);
+		/*
+		 * We raced with a task exiting - just return:
+		 */
+		if (verbose)
+			fprintf(stderr, "couldn't open %s\n", filename);
+		return;
 	}
 	if (read(fd, bf, sizeof(bf)) < 0) {
 		fprintf(stderr, "couldn't read %s\n", filename);
@@ -273,8 +277,12 @@ static void pid_synthesize_mmap_samples(pid_t pid)
 
 	fp = fopen(filename, "r");
 	if (fp == NULL) {
-		fprintf(stderr, "couldn't open %s\n", filename);
-		exit(EXIT_FAILURE);
+		/*
+		 * We raced with a task exiting - just return:
+		 */
+		if (verbose)
+			fprintf(stderr, "couldn't open %s\n", filename);
+		return;
 	}
 	while (1) {
 		char bf[BUFSIZ], *pbf = bf;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] x86, mm: Add __get_user_pages_fast()
       [not found]             ` <new-submission>
                                 ` (218 preceding siblings ...)
  2009-06-15  8:33               ` [tip:perfcounters/core] perf record: Fix fast task-exit race tip-bot for Ingo Molnar
@ 2009-06-15 14:07               ` tip-bot for Peter Zijlstra
  2009-06-15 14:07               ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods tip-bot for Peter Zijlstra
                                 ` (487 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-15 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	npiggin, tglx, mingo

Commit-ID:  465a454f254ee2ff7acc4aececbe31f8af046bc0
Gitweb:     http://git.kernel.org/tip/465a454f254ee2ff7acc4aececbe31f8af046bc0
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 15 Jun 2009 12:31:37 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 15:57:51 +0200

x86, mm: Add __get_user_pages_fast()

Introduce a gup_fast() variant which is usable from IRQ/NMI context.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Nick Piggin <npiggin@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/mm/gup.c  |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mm.h |    6 +++++
 2 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 6340cef..697d572 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -219,6 +219,62 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
 	return 1;
 }
 
+/*
+ * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
+ * back to the regular GUP.
+ */
+int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
+			  struct page **pages)
+{
+	struct mm_struct *mm = current->mm;
+	unsigned long addr, len, end;
+	unsigned long next;
+	unsigned long flags;
+	pgd_t *pgdp;
+	int nr = 0;
+
+	start &= PAGE_MASK;
+	addr = start;
+	len = (unsigned long) nr_pages << PAGE_SHIFT;
+	end = start + len;
+	if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
+					(void __user *)start, len)))
+		return 0;
+
+	/*
+	 * XXX: batch / limit 'nr', to avoid large irq off latency
+	 * needs some instrumenting to determine the common sizes used by
+	 * important workloads (eg. DB2), and whether limiting the batch size
+	 * will decrease performance.
+	 *
+	 * It seems like we're in the clear for the moment. Direct-IO is
+	 * the main guy that batches up lots of get_user_pages, and even
+	 * they are limited to 64-at-a-time which is not so many.
+	 */
+	/*
+	 * This doesn't prevent pagetable teardown, but does prevent
+	 * the pagetables and pages from being freed on x86.
+	 *
+	 * So long as we atomically load page table pointers versus teardown
+	 * (which we do on x86, with the above PAE exception), we can follow the
+	 * address down to the the page and take a ref on it.
+	 */
+	local_irq_save(flags);
+	pgdp = pgd_offset(mm, addr);
+	do {
+		pgd_t pgd = *pgdp;
+
+		next = pgd_addr_end(addr, end);
+		if (pgd_none(pgd))
+			break;
+		if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
+			break;
+	} while (pgdp++, addr = next, addr != end);
+	local_irq_restore(flags);
+
+	return nr;
+}
+
 /**
  * get_user_pages_fast() - pin user pages in memory
  * @start:	starting user address
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ad613ed..b457bc0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -863,6 +863,12 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			struct page **pages);
 
 /*
+ * doesn't attempt to fault and will return short.
+ */
+int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
+			  struct page **pages);
+
+/*
  * A callback you can register to apply pressure to ageable caches.
  *
  * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'.  It should

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
       [not found]             ` <new-submission>
                                 ` (219 preceding siblings ...)
  2009-06-15 14:07               ` [tip:perfcounters/core] x86, mm: Add __get_user_pages_fast() tip-bot for Peter Zijlstra
@ 2009-06-15 14:07               ` tip-bot for Peter Zijlstra
  2009-06-15 16:14                 ` Mathieu Desnoyers
  2009-06-15 17:11                 ` Linus Torvalds
  2009-06-15 14:07               ` [tip:perfcounters/core] perf report: Add per system call overhead histogram tip-bot for Ingo Molnar
                                 ` (486 subsequent siblings)
  707 siblings, 2 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-15 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, mathieu.desnoyers, hpa, mingo,
	torvalds, penberg, a.p.zijlstra, efault, vegard.nossum, npiggin,
	jeremy, tglx, mingo

Commit-ID:  74193ef0ecab92535c8517f082f1f50504526c9b
Gitweb:     http://git.kernel.org/tip/74193ef0ecab92535c8517f082f1f50504526c9b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 15 Jun 2009 13:07:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 15:57:53 +0200

perf_counter: x86: Fix call-chain support to use NMI-safe methods

__copy_from_user_inatomic() isn't NMI safe in that it can trigger
the page fault handler which is another trap and its return path
invokes IRET which will also close the NMI context.

Therefore use a GUP based approach to copy the stack frames over.

We tried an alternative solution as well: we used a forward ported
version of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patch
that modifies the exception return path to use an open-coded IRET with
explicit stack unrolling and TF checking.

This didnt work as it interacted with faulting user-space instructions,
causing them not to restart properly, which corrupts user-space
registers.

Solving that would probably involve disassembling those instructions
and backtracing the RIP. But even without that, the code was deemed
rather complex to the already non-trivial x86 entry assembly code,
so instead we went for this GUP based method that does a
software-walk of the pagetables.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   49 ++++++++++++++++++++++++++++-------
 1 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 6d5e7cf..e8c68a5 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -19,6 +19,7 @@
 #include <linux/kdebug.h>
 #include <linux/sched.h>
 #include <linux/uaccess.h>
+#include <linux/highmem.h>
 
 #include <asm/apic.h>
 #include <asm/stacktrace.h>
@@ -1617,20 +1618,48 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	entry->kernel = entry->nr - nr;
 }
 
-static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
+/*
+ * best effort, GUP based copy_from_user() that assumes IRQ or NMI context
+ */
+static unsigned long
+copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
 {
+	unsigned long offset, addr = (unsigned long)from;
+	int type = in_nmi() ? KM_NMI : KM_IRQ0;
+	unsigned long size, len = 0;
+	struct page *page;
+	void *map;
 	int ret;
 
-	if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
-		return 0;
+	do {
+		ret = __get_user_pages_fast(addr, 1, 0, &page);
+		if (!ret)
+			break;
 
-	ret = 1;
-	pagefault_disable();
-	if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
-		ret = 0;
-	pagefault_enable();
+		offset = addr & (PAGE_SIZE - 1);
+		size = min(PAGE_SIZE - offset, n - len);
 
-	return ret;
+		map = kmap_atomic(page, type);
+		memcpy(to, map+offset, size);
+		kunmap_atomic(map, type);
+		put_page(page);
+
+		len  += size;
+		to   += size;
+		addr += size;
+
+	} while (len < n);
+
+	return len;
+}
+
+static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
+{
+	unsigned long bytes;
+
+	bytes = copy_from_user_nmi(frame, fp, sizeof(*frame));
+
+	return bytes == sizeof(*frame);
 }
 
 static void
@@ -1643,7 +1672,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 	if (!user_mode(regs))
 		regs = task_pt_regs(current);
 
-	fp   = (void __user *)regs->bp;
+	fp = (void __user *)regs->bp;
 
 	callchain_store(entry, regs->ip);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add per system call overhead histogram
       [not found]             ` <new-submission>
                                 ` (220 preceding siblings ...)
  2009-06-15 14:07               ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods tip-bot for Peter Zijlstra
@ 2009-06-15 14:07               ` tip-bot for Ingo Molnar
  2009-06-15 14:21               ` [tip:perfcounters/core] perf report: Fix 32-bit printf format tip-bot for Ingo Molnar
                                 ` (485 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, penberg, torvalds,
	a.p.zijlstra, efault, fweisbec, tglx, mingo

Commit-ID:  3dfabc74c65904c9e6cf952391312d16ea772ef5
Gitweb:     http://git.kernel.org/tip/3dfabc74c65904c9e6cf952391312d16ea772ef5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 11:24:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 15:58:03 +0200

perf report: Add per system call overhead histogram

Take advantage of call-graph percounter sampling/recording to
display a non-trivial histogram: the true, collapsed/summarized
cost measurement, on a per system call total overhead basis:

 aldebaran:~/linux/linux/tools/perf> ./perf record -g -a -f ~/hackbench 10
 aldebaran:~/linux/linux/tools/perf> ./perf report -s symbol --syscalls | head -10
 #
 # (3536 samples)
 #
 # Overhead  Symbol
 # ........  ......
 #
     40.75%  [k] sys_write
     40.21%  [k] sys_read
      4.44%  [k] do_nmi
 ...

This is done by accounting each (reliable) call-chain that chains back
to a given system call to that system call function.

[ So in the above example we can see that hackbench spends about 40% of
  its total time somewhere in sys_write() and 40% somewhere in
  sys_read(), the rest of the time is spent in user-space. The time
  is not spent in sys_write() _itself_ but in one of its many child
  functions. ]

Or, a recording of a (source files are already in the page-cache) kernel build:

 $ perf record -g -m 512 -f -- make -j32 kernel
 $ perf report -s s --syscalls | grep '\[k\]' | grep -v nmi

     4.14%  [k] do_page_fault
     1.20%  [k] sys_write
     1.10%  [k] sys_open
     0.63%  [k] sys_exit_group
     0.48%  [k] smp_apic_timer_interrupt
     0.37%  [k] sys_read
     0.37%  [k] sys_execve
     0.20%  [k] sys_mmap
     0.18%  [k] sys_close
     0.14%  [k] sys_munmap
     0.13%  [k] sys_poll
     0.09%  [k] sys_newstat
     0.07%  [k] sys_clone
     0.06%  [k] sys_newfstat
     0.05%  [k] sys_access
     0.05%  [k] schedule

Shows the true total cost of each syscall variant that gets used
during a kernel build. This profile reveals it that pagefaults are
the costliest, followed by read()/write().

An interesting detail: timer interrupts cost 0.5% - or 0.5 seconds
per 100 seconds of kernel build-time. (this was done with HZ=1000)

The summary is done in 'perf report', i.e. in the post-processing
stage - so once we have a good call-graph recording, this type of
non-trivial high-level analysis becomes possible.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index aebba56..1e2f5dd 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,6 +40,7 @@ static int		dump_trace = 0;
 
 static int		verbose;
 static int		full_paths;
+static int		collapse_syscalls;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
@@ -983,6 +984,15 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 			for (i = 0; i < chain->nr; i++)
 				dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
 		}
+		if (collapse_syscalls) {
+			/*
+			 * Find the all-but-last kernel entry
+			 * amongst the call-chains - to get
+			 * to the level of system calls:
+			 */
+			if (chain->kernel >= 2)
+				ip = chain->ips[chain->kernel-2];
+		}
 	}
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
@@ -1343,6 +1353,8 @@ static const struct option options[] = {
 		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
 		    "Don't shorten the pathnames taking into account the cwd"),
+	OPT_BOOLEAN('S', "syscalls", &collapse_syscalls,
+		    "show per syscall summary overhead, using call graph"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Fix 32-bit printf format
       [not found]             ` <new-submission>
                                 ` (221 preceding siblings ...)
  2009-06-15 14:07               ` [tip:perfcounters/core] perf report: Add per system call overhead histogram tip-bot for Ingo Molnar
@ 2009-06-15 14:21               ` tip-bot for Ingo Molnar
  2009-06-16 19:54               ` [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling tip-bot for Peter Zijlstra
                                 ` (484 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-15 14:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	yong.y.wang, tglx, mingo

Commit-ID:  e2eae0f5605b90a0838608043c21050b08b6dd95
Gitweb:     http://git.kernel.org/tip/e2eae0f5605b90a0838608043c21050b08b6dd95
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 15 Jun 2009 16:15:19 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Jun 2009 16:18:02 +0200

perf report: Fix 32-bit printf format

Yong Wang reported the following compiler warning:

 builtin-report.c: In function 'process_overflow_event':
 builtin-report.c:984: error: cast to pointer from integer of different size

Which happens because we try to print ->ips[] out with a limited
format, losing the high 32 bits. Print it out using %016Lx instead.

Reported-by: Yong Wang <yong.y.wang@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1e2f5dd..f86bb07 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -982,7 +982,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 				chain->nr);
 
 			for (i = 0; i < chain->nr; i++)
-				dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
+				dprintf("..... %2d: %016Lx\n", i, chain->ips[i]);
 		}
 		if (collapse_syscalls) {
 			/*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 14:07               ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods tip-bot for Peter Zijlstra
@ 2009-06-15 16:14                 ` Mathieu Desnoyers
  2009-06-15 17:05                   ` Ingo Molnar
  2009-06-15 17:11                 ` Linus Torvalds
  1 sibling, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 16:14 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, penberg,
	torvalds, vegard.nossum, efault, jeremy, npiggin, tglx, mingo
  Cc: linux-tip-commits

* tip-bot for Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> Commit-ID:  74193ef0ecab92535c8517f082f1f50504526c9b
> Gitweb:     http://git.kernel.org/tip/74193ef0ecab92535c8517f082f1f50504526c9b
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Mon, 15 Jun 2009 13:07:24 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 15 Jun 2009 15:57:53 +0200
> 
> perf_counter: x86: Fix call-chain support to use NMI-safe methods
> 
> __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> the page fault handler which is another trap and its return path
> invokes IRET which will also close the NMI context.
> 
> Therefore use a GUP based approach to copy the stack frames over.
> 
> We tried an alternative solution as well: we used a forward ported
> version of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patch
> that modifies the exception return path to use an open-coded IRET with
> explicit stack unrolling and TF checking.
> 
> This didnt work as it interacted with faulting user-space instructions,
> causing them not to restart properly, which corrupts user-space
> registers.
> 
> Solving that would probably involve disassembling those instructions
> and backtracing the RIP. But even without that, the code was deemed
> rather complex to the already non-trivial x86 entry assembly code,
> so instead we went for this GUP based method that does a
> software-walk of the pagetables.
> 

Hrm, I'm probably missing something. Normally, you should test for
"in_nmi()" upon return from exception, and only in these cases go for
the open-coded IRET with stack unrolling and ret. I really don't see how
you end up messing up the page fault return to userspace path, as it's
impossible to have in_nmi() set.

Mathieu

> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Nick Piggin <npiggin@suse.de>
> Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> Cc: Vegard Nossum <vegard.nossum@gmail.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  arch/x86/kernel/cpu/perf_counter.c |   49 ++++++++++++++++++++++++++++-------
>  1 files changed, 39 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
> index 6d5e7cf..e8c68a5 100644
> --- a/arch/x86/kernel/cpu/perf_counter.c
> +++ b/arch/x86/kernel/cpu/perf_counter.c
> @@ -19,6 +19,7 @@
>  #include <linux/kdebug.h>
>  #include <linux/sched.h>
>  #include <linux/uaccess.h>
> +#include <linux/highmem.h>
>  
>  #include <asm/apic.h>
>  #include <asm/stacktrace.h>
> @@ -1617,20 +1618,48 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
>  	entry->kernel = entry->nr - nr;
>  }
>  
> -static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
> +/*
> + * best effort, GUP based copy_from_user() that assumes IRQ or NMI context
> + */
> +static unsigned long
> +copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
>  {
> +	unsigned long offset, addr = (unsigned long)from;
> +	int type = in_nmi() ? KM_NMI : KM_IRQ0;
> +	unsigned long size, len = 0;
> +	struct page *page;
> +	void *map;
>  	int ret;
>  
> -	if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
> -		return 0;
> +	do {
> +		ret = __get_user_pages_fast(addr, 1, 0, &page);
> +		if (!ret)
> +			break;
>  
> -	ret = 1;
> -	pagefault_disable();
> -	if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
> -		ret = 0;
> -	pagefault_enable();
> +		offset = addr & (PAGE_SIZE - 1);
> +		size = min(PAGE_SIZE - offset, n - len);
>  
> -	return ret;
> +		map = kmap_atomic(page, type);
> +		memcpy(to, map+offset, size);
> +		kunmap_atomic(map, type);
> +		put_page(page);
> +
> +		len  += size;
> +		to   += size;
> +		addr += size;
> +
> +	} while (len < n);
> +
> +	return len;
> +}
> +
> +static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
> +{
> +	unsigned long bytes;
> +
> +	bytes = copy_from_user_nmi(frame, fp, sizeof(*frame));
> +
> +	return bytes == sizeof(*frame);
>  }
>  
>  static void
> @@ -1643,7 +1672,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
>  	if (!user_mode(regs))
>  		regs = task_pt_regs(current);
>  
> -	fp   = (void __user *)regs->bp;
> +	fp = (void __user *)regs->bp;
>  
>  	callchain_store(entry, regs->ip);
>  

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 16:14                 ` Mathieu Desnoyers
@ 2009-06-15 17:05                   ` Ingo Molnar
  2009-06-15 17:42                     ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 17:05 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, penberg,
	torvalds, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * tip-bot for Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> > Commit-ID:  74193ef0ecab92535c8517f082f1f50504526c9b
> > Gitweb:     http://git.kernel.org/tip/74193ef0ecab92535c8517f082f1f50504526c9b
> > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > AuthorDate: Mon, 15 Jun 2009 13:07:24 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Mon, 15 Jun 2009 15:57:53 +0200
> > 
> > perf_counter: x86: Fix call-chain support to use NMI-safe methods
> > 
> > __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> > the page fault handler which is another trap and its return path
> > invokes IRET which will also close the NMI context.
> > 
> > Therefore use a GUP based approach to copy the stack frames over.
> > 
> > We tried an alternative solution as well: we used a forward ported
> > version of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patch
> > that modifies the exception return path to use an open-coded IRET with
> > explicit stack unrolling and TF checking.
> > 
> > This didnt work as it interacted with faulting user-space instructions,
> > causing them not to restart properly, which corrupts user-space
> > registers.
> > 
> > Solving that would probably involve disassembling those instructions
> > and backtracing the RIP. But even without that, the code was deemed
> > rather complex to the already non-trivial x86 entry assembly code,
> > so instead we went for this GUP based method that does a
> > software-walk of the pagetables.
> > 
> 
> Hrm, I'm probably missing something. Normally, you should test for 
> "in_nmi()" upon return from exception, and only in these cases go 
> for the open-coded IRET with stack unrolling and ret. I really 
> don't see how you end up messing up the page fault return to 
> userspace path, as it's impossible to have in_nmi() set.

here's the (heavily modified) version of your patch that i used.

	Ingo

-------------------->
Subject: x86 NMI-safe INT3 and Page Fault
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Mon, 12 May 2008 21:21:07 +0200

Implements an alternative iret with popf and return so trap and exception
handlers can return to the NMI handler without issuing iret. iret would cause
NMIs to be reenabled prematurely. x86_32 uses popf and far return. x86_64 has to
copy the return instruction pointer to the top of the previous stack, issue a
popf, loads the previous esp and issue a near return (ret).

It allows placing immediate values (and therefore optimized trace_marks) in NMI
code since returning from a breakpoint would be valid. Accessing vmalloc'd
memory, which allows executing module code or accessing vmapped or vmalloc'd
areas from NMI context, would also be valid. This is very useful to tracers like
LTTng.

This patch makes all faults, traps and exception safe to be called from NMI
context *except* single-stepping, which requires iret to restore the TF (trap
flag) and jump to the return address in a single instruction. Sorry, no kprobes
support in NMI handlers because of this limitation.  We cannot single-step an
NMI handler, because iret must set the TF flag and return back to the
instruction to single-step in a single instruction. This cannot be emulated with
popf/lret, because lret would be single-stepped. It does not apply to immediate
values because they do not use single-stepping. This code detects if the TF
flag is set and uses the iret path for single-stepping, even if it reactivates
NMIs prematurely.

Test to detect if nested under a NMI handler is only done upon the return from
trap/exception to kernel, which is not frequent. Other return paths (return from
trap/exception to userspace, return from interrupt) keep the exact same behavior
(no slowdown).

Depends on :
change-alpha-active-count-bit.patch
change-avr32-active-count-bit.patch

TODO : test with lguest, xen, kvm.

** This patch depends on the "Stringify support commas" patchset **
** Also depends on fix-x86_64-page-fault-scheduler-race patch **

tested on x86_32 (tests implemented in a separate patch) :
- instrumented the return path to export the EIP, CS and EFLAGS values when
  taken so we know the return path code has been executed.
- trace_mark, using immediate values, with 10ms delay with the breakpoint
  activated. Runs well through the return path.
- tested vmalloc faults in NMI handler by placing a non-optimized marker in the
  NMI handler (so no breakpoint is executed) and connecting a probe which
  touches every pages of a 20MB vmalloc'd buffer. It executes trough the return
  path without problem.
- Tested with and without preemption

tested on x86_64
- instrumented the return path to export the EIP, CS and EFLAGS values when
  taken so we know the return path code has been executed.
- trace_mark, using immediate values, with 10ms delay with the breakpoint
  activated. Runs well through the return path.

To test on x86_64 :
- Test without preemption
- Test vmalloc faults
- Test on Intel 64 bits CPUs. (AMD64 was fine)

Changelog since v1 :
- x86_64 fixes.
Changelog since v2 :
- fix paravirt build
Changelog since v3 :
- Include modifications suggested by Jeremy
Changelog since v4 :
- including hardirq.h in entry_32/64.S is a bad idea (non ifndef'd C code),
  define HARDNMI_MASK in the .S files directly.
Changelog since v5 :
- Add HARDNMI_MASK to irq_count() and make die() more verbose for NMIs.
Changelog since v7 :
- Implement paravirtualized nmi_return.
Changelog since v8 :
- refreshed the patch for asm-offsets. Those were left out of v8.
- now depends on "Stringify support commas" patch.
Changelog since v9 :
- Only test the nmi nested preempt count flag upon return from exceptions, not
  on return from interrupts. Only the kernel return path has this test.
- Add Xen, VMI, lguest support. Use their iret pavavirt ops in lieu of
  nmi_return.

-- Ported to sched-devel.git

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: akpm@osdl.org
CC: mingo@elte.hu
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: "Frank Ch. Eigler" <fche@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/irqflags.h |   56 +++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/dumpstack.c     |    2 +
 arch/x86/kernel/entry_32.S      |   30 +++++++++++++++++++++
 arch/x86/kernel/entry_64.S      |   57 +++++++++++++++++++++++++++++++---------
 include/linux/hardirq.h         |   16 +++++++----
 5 files changed, 144 insertions(+), 17 deletions(-)

Index: linux/arch/x86/include/asm/irqflags.h
===================================================================
--- linux.orig/arch/x86/include/asm/irqflags.h
+++ linux/arch/x86/include/asm/irqflags.h
@@ -51,6 +51,61 @@ static inline void native_halt(void)
 
 #endif
 
+#ifdef CONFIG_X86_64
+/*
+ * Only returns from a trap or exception to a NMI context (intra-privilege
+ * level near return) to the same SS and CS segments. Should be used
+ * upon trap or exception return when nested over a NMI context so no iret is
+ * issued. It takes care of modifying the eflags, rsp and returning to the
+ * previous function.
+ *
+ * The stack, at that point, looks like :
+ *
+ * 0(rsp)  RIP
+ * 8(rsp)  CS
+ * 16(rsp) EFLAGS
+ * 24(rsp) RSP
+ * 32(rsp) SS
+ *
+ * Upon execution :
+ * Copy EIP to the top of the return stack
+ * Update top of return stack address
+ * Pop eflags into the eflags register
+ * Make the return stack current
+ * Near return (popping the return address from the return stack)
+ */
+#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
+						movq %rsp, %rax;	\
+						movq 24+8(%rax), %rsp;	\
+						pushq 0+8(%rax);	\
+						pushq 16+8(%rax);	\
+						movq (%rax), %rax;	\
+						popfq;			\
+						ret
+#else
+/*
+ * Protected mode only, no V8086. Implies that protected mode must
+ * be entered before NMIs or MCEs are enabled. Only returns from a trap or
+ * exception to a NMI context (intra-privilege level far return). Should be used
+ * upon trap or exception return when nested over a NMI context so no iret is
+ * issued.
+ *
+ * The stack, at that point, looks like :
+ *
+ * 0(esp) EIP
+ * 4(esp) CS
+ * 8(esp) EFLAGS
+ *
+ * Upon execution :
+ * Copy the stack eflags to top of stack
+ * Pop eflags into the eflags register
+ * Far return: pop EIP and CS into their register, and additionally pop EFLAGS.
+ */
+#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushl 8(%esp);	\
+						popfl;		\
+						lret $4
+#endif
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else
@@ -109,6 +164,7 @@ static inline unsigned long __raw_local_
 
 #define ENABLE_INTERRUPTS(x)	sti
 #define DISABLE_INTERRUPTS(x)	cli
+#define INTERRUPT_RETURN_NMI_SAFE	NATIVE_INTERRUPT_RETURN_NMI_SAFE
 
 #ifdef CONFIG_X86_64
 #define SWAPGS	swapgs
Index: linux/arch/x86/kernel/dumpstack.c
===================================================================
--- linux.orig/arch/x86/kernel/dumpstack.c
+++ linux/arch/x86/kernel/dumpstack.c
@@ -237,6 +237,8 @@ void __kprobes oops_end(unsigned long fl
 
 	if (!signr)
 		return;
+	if (in_nmi())
+		panic("Fatal exception in non-maskable interrupt");
 	if (in_interrupt())
 		panic("Fatal exception in interrupt");
 	if (panic_on_oops)
Index: linux/arch/x86/kernel/entry_32.S
===================================================================
--- linux.orig/arch/x86/kernel/entry_32.S
+++ linux/arch/x86/kernel/entry_32.S
@@ -80,6 +80,8 @@
 
 #define nr_syscalls ((syscall_table_size)/4)
 
+#define HARDNMI_MASK 0x40000000
+
 #ifdef CONFIG_PREEMPT
 #define preempt_stop(clobbers)	DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
 #else
@@ -344,8 +346,32 @@ END(ret_from_fork)
 	# userspace resumption stub bypassing syscall exit tracing
 	ALIGN
 	RING0_PTREGS_FRAME
+
 ret_from_exception:
 	preempt_stop(CLBR_ANY)
+	GET_THREAD_INFO(%ebp)
+	movl PT_EFLAGS(%esp), %eax	# mix EFLAGS and CS
+	movb PT_CS(%esp), %al
+	andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
+	cmpl $USER_RPL, %eax
+	jae resume_userspace	# returning to v8086 or userspace
+	testl $HARDNMI_MASK,TI_preempt_count(%ebp)
+	jz resume_kernel		/* Not nested over NMI ? */
+	testw $X86_EFLAGS_TF, PT_EFLAGS(%esp)
+	jnz resume_kernel		/*
+					 * If single-stepping an NMI handler,
+					 * use the normal iret path instead of
+					 * the popf/lret because lret would be
+					 * single-stepped. It should not
+					 * happen : it will reactivate NMIs
+					 * prematurely.
+					 */
+	TRACE_IRQS_IRET
+	RESTORE_REGS
+	addl $4, %esp			# skip orig_eax/error_code
+	CFI_ADJUST_CFA_OFFSET -4
+	INTERRUPT_RETURN_NMI_SAFE
+
 ret_from_intr:
 	GET_THREAD_INFO(%ebp)
 check_userspace:
@@ -851,6 +877,10 @@ ENTRY(native_iret)
 .previous
 END(native_iret)
 
+ENTRY(native_nmi_return)
+	NATIVE_INTERRUPT_RETURN_NMI_SAFE # Should we deal with popf exception ?
+END(native_nmi_return)
+
 ENTRY(native_irq_enable_sysexit)
 	sti
 	sysexit
Index: linux/arch/x86/kernel/entry_64.S
===================================================================
--- linux.orig/arch/x86/kernel/entry_64.S
+++ linux/arch/x86/kernel/entry_64.S
@@ -53,6 +53,7 @@
 #include <asm/paravirt.h>
 #include <asm/ftrace.h>
 #include <asm/percpu.h>
+#include <linux/hardirq.h>
 
 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
 #include <linux/elf-em.h>
@@ -875,6 +876,9 @@ ENTRY(native_iret)
 	.section __ex_table,"a"
 	.quad native_iret, bad_iret
 	.previous
+
+ENTRY(native_nmi_return)
+	NATIVE_INTERRUPT_RETURN_NMI_SAFE
 #endif
 
 	.section .fixup,"ax"
@@ -929,6 +933,23 @@ retint_signal:
 	GET_THREAD_INFO(%rcx)
 	jmp retint_with_reschedule
 
+	/* Returning to kernel space from exception. */
+	/* rcx:	 threadinfo. interrupts off. */
+ENTRY(retexc_kernel)
+	testl $NMI_MASK, TI_preempt_count(%rcx)
+	jz retint_kernel		/* Not nested over NMI ? */
+	testw $X86_EFLAGS_TF, EFLAGS-ARGOFFSET(%rsp)	/* trap flag? */
+	jnz retint_kernel		/*
+					 * If single-stepping an NMI handler,
+					 * use the normal iret path instead of
+					 * the popf/lret because lret would be
+					 * single-stepped. It should not
+					 * happen : it will reactivate NMIs
+					 * prematurely.
+					 */
+	RESTORE_ARGS 0, 8, 0
+	INTERRUPT_RETURN_NMI_SAFE
+
 #ifdef CONFIG_PREEMPT
 	/* Returning to kernel space. Check if we need preemption */
 	/* rcx:	 threadinfo. interrupts off. */
@@ -1407,34 +1428,46 @@ ENTRY(paranoid_exit)
 	INTR_FRAME
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
-	testl %ebx,%ebx				/* swapgs needed? */
+	testl %ebx, %ebx			/* swapgs needed? */
 	jnz paranoid_restore
-	testl $3,CS(%rsp)
+
+	testl $3, CS(%rsp)
 	jnz   paranoid_userspace
+
 paranoid_swapgs:
 	TRACE_IRQS_IRETQ 0
 	SWAPGS_UNSAFE_STACK
 	RESTORE_ALL 8
 	jmp irq_return
-paranoid_restore:
+paranoid_restore_no_nmi:
 	TRACE_IRQS_IRETQ 0
 	RESTORE_ALL 8
 	jmp irq_return
+paranoid_restore:
+	GET_THREAD_INFO(%rcx)
+	testl $NMI_MASK, TI_preempt_count(%rcx)
+	jz paranoid_restore_no_nmi		/* Nested over NMI ? */
+
+	testw $X86_EFLAGS_TF, EFLAGS-0(%rsp)	/* trap flag? */
+	jnz paranoid_restore_no_nmi
+	RESTORE_ALL 8
+	INTERRUPT_RETURN_NMI_SAFE
+
 paranoid_userspace:
 	GET_THREAD_INFO(%rcx)
-	movl TI_flags(%rcx),%ebx
-	andl $_TIF_WORK_MASK,%ebx
+	movl TI_flags(%rcx), %ebx
+	andl $_TIF_WORK_MASK, %ebx
 	jz paranoid_swapgs
-	movq %rsp,%rdi			/* &pt_regs */
+	movq %rsp, %rdi				/* &pt_regs */
 	call sync_regs
-	movq %rax,%rsp			/* switch stack for scheduling */
-	testl $_TIF_NEED_RESCHED,%ebx
+	movq %rax, %rsp				/* switch stack for scheduling */
+	testl $_TIF_NEED_RESCHED, %ebx
 	jnz paranoid_schedule
-	movl %ebx,%edx			/* arg3: thread flags */
+	movl %ebx, %edx				/* arg3: thread flags */
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_NONE)
-	xorl %esi,%esi 			/* arg2: oldset */
-	movq %rsp,%rdi 			/* arg1: &pt_regs */
+	xorl %esi, %esi				/* arg2: oldset */
+	movq %rsp, %rdi				/* arg1: &pt_regs */
 	call do_notify_resume
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
@@ -1513,7 +1546,7 @@ ENTRY(error_exit)
 	TRACE_IRQS_OFF
 	GET_THREAD_INFO(%rcx)
 	testl %eax,%eax
-	jne retint_kernel
+	jne  retexc_kernel
 	LOCKDEP_SYS_EXIT_IRQ
 	movl TI_flags(%rcx),%edx
 	movl $_TIF_WORK_MASK,%edi
Index: linux/include/linux/hardirq.h
===================================================================
--- linux.orig/include/linux/hardirq.h
+++ linux/include/linux/hardirq.h
@@ -1,12 +1,14 @@
 #ifndef LINUX_HARDIRQ_H
 #define LINUX_HARDIRQ_H
 
+#ifndef __ASSEMBLY__
 #include <linux/preempt.h>
 #include <linux/smp_lock.h>
 #include <linux/lockdep.h>
 #include <linux/ftrace_irq.h>
 #include <asm/hardirq.h>
 #include <asm/system.h>
+#endif
 
 /*
  * We put the hardirq and softirq counter into the preemption
@@ -50,17 +52,17 @@
 #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
 #define NMI_SHIFT	(HARDIRQ_SHIFT + HARDIRQ_BITS)
 
-#define __IRQ_MASK(x)	((1UL << (x))-1)
+#define __IRQ_MASK(x)	((1 << (x))-1)
 
 #define PREEMPT_MASK	(__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
 #define SOFTIRQ_MASK	(__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
 #define HARDIRQ_MASK	(__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
 #define NMI_MASK	(__IRQ_MASK(NMI_BITS)     << NMI_SHIFT)
 
-#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
-#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
-#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
-#define NMI_OFFSET	(1UL << NMI_SHIFT)
+#define PREEMPT_OFFSET	(1 << PREEMPT_SHIFT)
+#define SOFTIRQ_OFFSET	(1 << SOFTIRQ_SHIFT)
+#define HARDIRQ_OFFSET	(1 << HARDIRQ_SHIFT)
+#define NMI_OFFSET	(1 << NMI_SHIFT)
 
 #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
 #error PREEMPT_ACTIVE is too low!
@@ -116,6 +118,8 @@
 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
 #endif
 
+#ifndef __ASSEMBLY__
+
 #if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
 extern void synchronize_irq(unsigned int irq);
 #else
@@ -195,4 +199,6 @@ extern void irq_exit(void);
 		ftrace_nmi_exit();				\
 	} while (0)
 
+#endif /* !__ASSEMBLY__ */
+
 #endif /* LINUX_HARDIRQ_H */

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 14:07               ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods tip-bot for Peter Zijlstra
  2009-06-15 16:14                 ` Mathieu Desnoyers
@ 2009-06-15 17:11                 ` Linus Torvalds
  2009-06-15 17:18                   ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 17:11 UTC (permalink / raw)
  To: mingo, hpa, mathieu.desnoyers, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, mingo
  Cc: linux-tip-commits



On Mon, 15 Jun 2009, tip-bot for Peter Zijlstra wrote:
> 
> __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> the page fault handler which is another trap and its return path
> invokes IRET which will also close the NMI context.

That's not the only problem.

An even more fundamental problem is that the page fault handler is not 
re-entrant because of simple the value in %cr2. So regardless of any 
'iret' issues, you *CANNOT* take a page fault in an NMI, because the NMI 
might happen while we're in the critical region of having taken another 
page fault, but before we've saved off the value of %cr2 in that old page 
fault.

If the NMI handler causes a page fault, it will corrupt the %cr2 of the 
outer page fault. That's why the page fault is done with an interrupt 
gate, and why we have that conditional local_irq_enable() in it.

So page faults are fundamentally only safe wrt normal interrupts, not NMI.

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:11                 ` Linus Torvalds
@ 2009-06-15 17:18                   ` Ingo Molnar
  2009-06-15 17:37                     ` Linus Torvalds
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 17:18 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mingo, hpa, mathieu.desnoyers, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 15 Jun 2009, tip-bot for Peter Zijlstra wrote:
> > 
> > __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> > the page fault handler which is another trap and its return path
> > invokes IRET which will also close the NMI context.
> 
> That's not the only problem.
> 
> An even more fundamental problem is that the page fault handler is 
> not re-entrant because of simple the value in %cr2. So regardless 
> of any 'iret' issues, you *CANNOT* take a page fault in an NMI, 
> because the NMI might happen while we're in the critical region of 
> having taken another page fault, but before we've saved off the 
> value of %cr2 in that old page fault.
>
> If the NMI handler causes a page fault, it will corrupt the %cr2 
> of the outer page fault. That's why the page fault is done with an 
> interrupt gate, and why we have that conditional 
> local_irq_enable() in it.
> 
> So page faults are fundamentally only safe wrt normal interrupts, 
> not NMI.

ahhh ... a light goes up. Indeed.

I was suspecting something much more complex: like the CPU somehow 
having shadow state for attempted-fault which gets confused by 
NMI->fault.

A simple cr2 corruption would explain all those cc1 SIGSEGVs and 
other user-space crashes i saw, with sufficiently intense sampling - 
easily.

The thing is, that __copy_user_inatomic() has been in 
arch/x86/oprofile/backtrace.c for years, i didnt even suspect some 
simple, fundamental flaw like this. Apparently nobody uses it.

This is really good news in a sense: i really hate that additional 
entry*.S mucking in the exception path in the dont-IRET patch. We 
want less entry*.S magic, not more.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:18                   ` Ingo Molnar
@ 2009-06-15 17:37                     ` Linus Torvalds
  2009-06-15 18:05                       ` Mathieu Desnoyers
                                         ` (2 more replies)
  0 siblings, 3 replies; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 17:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, mathieu.desnoyers, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits



On Mon, 15 Jun 2009, Ingo Molnar wrote:
> 
> A simple cr2 corruption would explain all those cc1 SIGSEGVs and 
> other user-space crashes i saw, with sufficiently intense sampling - 
> easily.

Note that we could work around the %cr2 issue, since any corruption is 
always nicely "nested" (ie there are never any SMP issues with async 
writes to the register).

So what we _could_ do is to have a magic value for %cr2, along with a "NMI 
sequence count", and if we see that value, we just return (without doing 
anything) from the page fault handler.

Then, the NMI handler would be changed to always write that value to %cr2 
after it has done the operation that could fault, and do an atomic 
increment of the NMI sequence count. Then, we can do something like this 
in the page fault handler:

	if (cr2 == MAGIC_CR2) {
		static unsigned long my_seqno = -1;
		if (my_seqno != nmi_seqno) {
			my_seqno = nmi_seqno;
			return;
		}
	}

where the whole (and only) point of that "seqno" is to protect against 
user space doing something like

	int i = *(int *)MAGIC_CR2;

and causing infinite faults.

If a real NMI happens, then nmi_seqno will always be different, and we'll 
just retry the fault (the NMI handler would do something like

	write_cr2(MAGIC_CR2);
	atomic_inc(&nmi_seqno);

to set it all up).

Anyway, I do think that the _correct_ solution is to not do page faults 
from within NMI's, but the above is an outline of how we could _try_ to 
handle it if we really really wanted to. IOW, the fact that cr2 gets 
corrupted is not insurmountable, exactly because we _could_ always just 
retrigger the page fault, and thus "re-create' the corrupted %cr2 value.

Hacky, hacky. And I'm not sure how happy CPU's even are to have %cr2 
written to, so we could hit CPU issues.

			Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:05                   ` Ingo Molnar
@ 2009-06-15 17:42                     ` Mathieu Desnoyers
  2009-06-15 18:18                       ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 17:42 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, penberg,
	torvalds, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > * tip-bot for Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> > > Commit-ID:  74193ef0ecab92535c8517f082f1f50504526c9b
> > > Gitweb:     http://git.kernel.org/tip/74193ef0ecab92535c8517f082f1f50504526c9b
> > > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > AuthorDate: Mon, 15 Jun 2009 13:07:24 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Mon, 15 Jun 2009 15:57:53 +0200
> > > 
> > > perf_counter: x86: Fix call-chain support to use NMI-safe methods
> > > 
> > > __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> > > the page fault handler which is another trap and its return path
> > > invokes IRET which will also close the NMI context.
> > > 
> > > Therefore use a GUP based approach to copy the stack frames over.
> > > 
> > > We tried an alternative solution as well: we used a forward ported
> > > version of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patch
> > > that modifies the exception return path to use an open-coded IRET with
> > > explicit stack unrolling and TF checking.
> > > 
> > > This didnt work as it interacted with faulting user-space instructions,
> > > causing them not to restart properly, which corrupts user-space
> > > registers.
> > > 
> > > Solving that would probably involve disassembling those instructions
> > > and backtracing the RIP. But even without that, the code was deemed
> > > rather complex to the already non-trivial x86 entry assembly code,
> > > so instead we went for this GUP based method that does a
> > > software-walk of the pagetables.
> > > 
> > 
> > Hrm, I'm probably missing something. Normally, you should test for 
> > "in_nmi()" upon return from exception, and only in these cases go 
> > for the open-coded IRET with stack unrolling and ret. I really 
> > don't see how you end up messing up the page fault return to 
> > userspace path, as it's impossible to have in_nmi() set.
> 
> here's the (heavily modified) version of your patch that i used.
> 
> 	Ingo
> 
> -------------------->
> Subject: x86 NMI-safe INT3 and Page Fault
> From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Date: Mon, 12 May 2008 21:21:07 +0200
> 
> Implements an alternative iret with popf and return so trap and exception
> handlers can return to the NMI handler without issuing iret. iret would cause
> NMIs to be reenabled prematurely. x86_32 uses popf and far return. x86_64 has to
> copy the return instruction pointer to the top of the previous stack, issue a
> popf, loads the previous esp and issue a near return (ret).
> 
> It allows placing immediate values (and therefore optimized trace_marks) in NMI
> code since returning from a breakpoint would be valid. Accessing vmalloc'd
> memory, which allows executing module code or accessing vmapped or vmalloc'd
> areas from NMI context, would also be valid. This is very useful to tracers like
> LTTng.
> 
> This patch makes all faults, traps and exception safe to be called from NMI
> context *except* single-stepping, which requires iret to restore the TF (trap
> flag) and jump to the return address in a single instruction. Sorry, no kprobes
> support in NMI handlers because of this limitation.  We cannot single-step an
> NMI handler, because iret must set the TF flag and return back to the
> instruction to single-step in a single instruction. This cannot be emulated with
> popf/lret, because lret would be single-stepped. It does not apply to immediate
> values because they do not use single-stepping. This code detects if the TF
> flag is set and uses the iret path for single-stepping, even if it reactivates
> NMIs prematurely.
> 
> Test to detect if nested under a NMI handler is only done upon the return from
> trap/exception to kernel, which is not frequent. Other return paths (return from
> trap/exception to userspace, return from interrupt) keep the exact same behavior
> (no slowdown).
> 
> Depends on :
> change-alpha-active-count-bit.patch
> change-avr32-active-count-bit.patch
> 
> TODO : test with lguest, xen, kvm.
> 
> ** This patch depends on the "Stringify support commas" patchset **
> ** Also depends on fix-x86_64-page-fault-scheduler-race patch **
> 
> tested on x86_32 (tests implemented in a separate patch) :
> - instrumented the return path to export the EIP, CS and EFLAGS values when
>   taken so we know the return path code has been executed.
> - trace_mark, using immediate values, with 10ms delay with the breakpoint
>   activated. Runs well through the return path.
> - tested vmalloc faults in NMI handler by placing a non-optimized marker in the
>   NMI handler (so no breakpoint is executed) and connecting a probe which
>   touches every pages of a 20MB vmalloc'd buffer. It executes trough the return
>   path without problem.
> - Tested with and without preemption
> 
> tested on x86_64
> - instrumented the return path to export the EIP, CS and EFLAGS values when
>   taken so we know the return path code has been executed.
> - trace_mark, using immediate values, with 10ms delay with the breakpoint
>   activated. Runs well through the return path.
> 
> To test on x86_64 :
> - Test without preemption
> - Test vmalloc faults
> - Test on Intel 64 bits CPUs. (AMD64 was fine)
> 
> Changelog since v1 :
> - x86_64 fixes.
> Changelog since v2 :
> - fix paravirt build
> Changelog since v3 :
> - Include modifications suggested by Jeremy
> Changelog since v4 :
> - including hardirq.h in entry_32/64.S is a bad idea (non ifndef'd C code),
>   define HARDNMI_MASK in the .S files directly.
> Changelog since v5 :
> - Add HARDNMI_MASK to irq_count() and make die() more verbose for NMIs.
> Changelog since v7 :
> - Implement paravirtualized nmi_return.
> Changelog since v8 :
> - refreshed the patch for asm-offsets. Those were left out of v8.
> - now depends on "Stringify support commas" patch.
> Changelog since v9 :
> - Only test the nmi nested preempt count flag upon return from exceptions, not
>   on return from interrupts. Only the kernel return path has this test.
> - Add Xen, VMI, lguest support. Use their iret pavavirt ops in lieu of
>   nmi_return.
> 
> -- Ported to sched-devel.git
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> CC: akpm@osdl.org
> CC: mingo@elte.hu
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: Jeremy Fitzhardinge <jeremy@goop.org>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: "Frank Ch. Eigler" <fche@redhat.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/include/asm/irqflags.h |   56 +++++++++++++++++++++++++++++++++++++++
>  arch/x86/kernel/dumpstack.c     |    2 +
>  arch/x86/kernel/entry_32.S      |   30 +++++++++++++++++++++
>  arch/x86/kernel/entry_64.S      |   57 +++++++++++++++++++++++++++++++---------
>  include/linux/hardirq.h         |   16 +++++++----
>  5 files changed, 144 insertions(+), 17 deletions(-)
> 
> Index: linux/arch/x86/include/asm/irqflags.h
> ===================================================================
> --- linux.orig/arch/x86/include/asm/irqflags.h
> +++ linux/arch/x86/include/asm/irqflags.h
> @@ -51,6 +51,61 @@ static inline void native_halt(void)
>  
>  #endif
>  
> +#ifdef CONFIG_X86_64
> +/*
> + * Only returns from a trap or exception to a NMI context (intra-privilege
> + * level near return) to the same SS and CS segments. Should be used
> + * upon trap or exception return when nested over a NMI context so no iret is
> + * issued. It takes care of modifying the eflags, rsp and returning to the
> + * previous function.
> + *
> + * The stack, at that point, looks like :
> + *
> + * 0(rsp)  RIP
> + * 8(rsp)  CS
> + * 16(rsp) EFLAGS
> + * 24(rsp) RSP
> + * 32(rsp) SS
> + *
> + * Upon execution :
> + * Copy EIP to the top of the return stack
> + * Update top of return stack address
> + * Pop eflags into the eflags register
> + * Make the return stack current
> + * Near return (popping the return address from the return stack)
> + */
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> +						movq %rsp, %rax;	\
> +						movq 24+8(%rax), %rsp;	\
> +						pushq 0+8(%rax);	\
> +						pushq 16+8(%rax);	\
> +						movq (%rax), %rax;	\
> +						popfq;			\
> +						ret
> +#else
> +/*
> + * Protected mode only, no V8086. Implies that protected mode must
> + * be entered before NMIs or MCEs are enabled. Only returns from a trap or
> + * exception to a NMI context (intra-privilege level far return). Should be used
> + * upon trap or exception return when nested over a NMI context so no iret is
> + * issued.
> + *
> + * The stack, at that point, looks like :
> + *
> + * 0(esp) EIP
> + * 4(esp) CS
> + * 8(esp) EFLAGS
> + *
> + * Upon execution :
> + * Copy the stack eflags to top of stack
> + * Pop eflags into the eflags register
> + * Far return: pop EIP and CS into their register, and additionally pop EFLAGS.
> + */
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushl 8(%esp);	\
> +						popfl;		\
> +						lret $4
> +#endif
> +
>  #ifdef CONFIG_PARAVIRT
>  #include <asm/paravirt.h>
>  #else
> @@ -109,6 +164,7 @@ static inline unsigned long __raw_local_
>  
>  #define ENABLE_INTERRUPTS(x)	sti
>  #define DISABLE_INTERRUPTS(x)	cli
> +#define INTERRUPT_RETURN_NMI_SAFE	NATIVE_INTERRUPT_RETURN_NMI_SAFE
>  
>  #ifdef CONFIG_X86_64
>  #define SWAPGS	swapgs
> Index: linux/arch/x86/kernel/dumpstack.c
> ===================================================================
> --- linux.orig/arch/x86/kernel/dumpstack.c
> +++ linux/arch/x86/kernel/dumpstack.c
> @@ -237,6 +237,8 @@ void __kprobes oops_end(unsigned long fl
>  
>  	if (!signr)
>  		return;
> +	if (in_nmi())
> +		panic("Fatal exception in non-maskable interrupt");
>  	if (in_interrupt())
>  		panic("Fatal exception in interrupt");
>  	if (panic_on_oops)
> Index: linux/arch/x86/kernel/entry_32.S
> ===================================================================
> --- linux.orig/arch/x86/kernel/entry_32.S
> +++ linux/arch/x86/kernel/entry_32.S
> @@ -80,6 +80,8 @@
>  
>  #define nr_syscalls ((syscall_table_size)/4)
>  
> +#define HARDNMI_MASK 0x40000000
> +

This is called "NMI_MASK" in 2.6.30. Did you test the x86_64 or x86_32
portion of this patch ? 64-bits seems ok, but not 32.

>  #ifdef CONFIG_PREEMPT
>  #define preempt_stop(clobbers)	DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
>  #else
> @@ -344,8 +346,32 @@ END(ret_from_fork)
>  	# userspace resumption stub bypassing syscall exit tracing
>  	ALIGN
>  	RING0_PTREGS_FRAME
> +
>  ret_from_exception:
>  	preempt_stop(CLBR_ANY)
> +	GET_THREAD_INFO(%ebp)
> +	movl PT_EFLAGS(%esp), %eax	# mix EFLAGS and CS
> +	movb PT_CS(%esp), %al
> +	andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
> +	cmpl $USER_RPL, %eax
> +	jae resume_userspace	# returning to v8086 or userspace
> +	testl $HARDNMI_MASK,TI_preempt_count(%ebp)

"NMI_MASK"

> +	jz resume_kernel		/* Not nested over NMI ? */
> +	testw $X86_EFLAGS_TF, PT_EFLAGS(%esp)

Hrm, I'm wondering if this test is not problematic for page faults.
Basically, this test is there to deal with "single-stepping" in the nmi
handler (it would not be "safe", but at least would not hang the
system). So if page faults are raising the X86_EFLAGS_TF EFLAG, we
definitely want to change this code. I am not sure about that, but it
would be worth checking.

It's all I can spot for now, but if you have popf/ret firing to return
to userspace instructions, there is clearly something fishy there.

Mathieu

> +	jnz resume_kernel		/*
> +					 * If single-stepping an NMI handler,
> +					 * use the normal iret path instead of
> +					 * the popf/lret because lret would be
> +					 * single-stepped. It should not
> +					 * happen : it will reactivate NMIs
> +					 * prematurely.
> +					 */
> +	TRACE_IRQS_IRET
> +	RESTORE_REGS
> +	addl $4, %esp			# skip orig_eax/error_code
> +	CFI_ADJUST_CFA_OFFSET -4
> +	INTERRUPT_RETURN_NMI_SAFE
> +
>  ret_from_intr:
>  	GET_THREAD_INFO(%ebp)
>  check_userspace:
> @@ -851,6 +877,10 @@ ENTRY(native_iret)
>  .previous
>  END(native_iret)
>  
> +ENTRY(native_nmi_return)
> +	NATIVE_INTERRUPT_RETURN_NMI_SAFE # Should we deal with popf exception ?
> +END(native_nmi_return)
> +
>  ENTRY(native_irq_enable_sysexit)
>  	sti
>  	sysexit
> Index: linux/arch/x86/kernel/entry_64.S
> ===================================================================
> --- linux.orig/arch/x86/kernel/entry_64.S
> +++ linux/arch/x86/kernel/entry_64.S
> @@ -53,6 +53,7 @@
>  #include <asm/paravirt.h>
>  #include <asm/ftrace.h>
>  #include <asm/percpu.h>
> +#include <linux/hardirq.h>
>  
>  /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
>  #include <linux/elf-em.h>
> @@ -875,6 +876,9 @@ ENTRY(native_iret)
>  	.section __ex_table,"a"
>  	.quad native_iret, bad_iret
>  	.previous
> +
> +ENTRY(native_nmi_return)
> +	NATIVE_INTERRUPT_RETURN_NMI_SAFE
>  #endif
>  
>  	.section .fixup,"ax"
> @@ -929,6 +933,23 @@ retint_signal:
>  	GET_THREAD_INFO(%rcx)
>  	jmp retint_with_reschedule
>  
> +	/* Returning to kernel space from exception. */
> +	/* rcx:	 threadinfo. interrupts off. */
> +ENTRY(retexc_kernel)
> +	testl $NMI_MASK, TI_preempt_count(%rcx)
> +	jz retint_kernel		/* Not nested over NMI ? */
> +	testw $X86_EFLAGS_TF, EFLAGS-ARGOFFSET(%rsp)	/* trap flag? */
> +	jnz retint_kernel		/*
> +					 * If single-stepping an NMI handler,
> +					 * use the normal iret path instead of
> +					 * the popf/lret because lret would be
> +					 * single-stepped. It should not
> +					 * happen : it will reactivate NMIs
> +					 * prematurely.
> +					 */
> +	RESTORE_ARGS 0, 8, 0
> +	INTERRUPT_RETURN_NMI_SAFE
> +
>  #ifdef CONFIG_PREEMPT
>  	/* Returning to kernel space. Check if we need preemption */
>  	/* rcx:	 threadinfo. interrupts off. */
> @@ -1407,34 +1428,46 @@ ENTRY(paranoid_exit)
>  	INTR_FRAME
>  	DISABLE_INTERRUPTS(CLBR_NONE)
>  	TRACE_IRQS_OFF
> -	testl %ebx,%ebx				/* swapgs needed? */
> +	testl %ebx, %ebx			/* swapgs needed? */
>  	jnz paranoid_restore
> -	testl $3,CS(%rsp)
> +
> +	testl $3, CS(%rsp)
>  	jnz   paranoid_userspace
> +
>  paranoid_swapgs:
>  	TRACE_IRQS_IRETQ 0
>  	SWAPGS_UNSAFE_STACK
>  	RESTORE_ALL 8
>  	jmp irq_return
> -paranoid_restore:
> +paranoid_restore_no_nmi:
>  	TRACE_IRQS_IRETQ 0
>  	RESTORE_ALL 8
>  	jmp irq_return
> +paranoid_restore:
> +	GET_THREAD_INFO(%rcx)
> +	testl $NMI_MASK, TI_preempt_count(%rcx)
> +	jz paranoid_restore_no_nmi		/* Nested over NMI ? */
> +
> +	testw $X86_EFLAGS_TF, EFLAGS-0(%rsp)	/* trap flag? */
> +	jnz paranoid_restore_no_nmi
> +	RESTORE_ALL 8
> +	INTERRUPT_RETURN_NMI_SAFE
> +
>  paranoid_userspace:
>  	GET_THREAD_INFO(%rcx)
> -	movl TI_flags(%rcx),%ebx
> -	andl $_TIF_WORK_MASK,%ebx
> +	movl TI_flags(%rcx), %ebx
> +	andl $_TIF_WORK_MASK, %ebx
>  	jz paranoid_swapgs
> -	movq %rsp,%rdi			/* &pt_regs */
> +	movq %rsp, %rdi				/* &pt_regs */
>  	call sync_regs
> -	movq %rax,%rsp			/* switch stack for scheduling */
> -	testl $_TIF_NEED_RESCHED,%ebx
> +	movq %rax, %rsp				/* switch stack for scheduling */
> +	testl $_TIF_NEED_RESCHED, %ebx
>  	jnz paranoid_schedule
> -	movl %ebx,%edx			/* arg3: thread flags */
> +	movl %ebx, %edx				/* arg3: thread flags */
>  	TRACE_IRQS_ON
>  	ENABLE_INTERRUPTS(CLBR_NONE)
> -	xorl %esi,%esi 			/* arg2: oldset */
> -	movq %rsp,%rdi 			/* arg1: &pt_regs */
> +	xorl %esi, %esi				/* arg2: oldset */
> +	movq %rsp, %rdi				/* arg1: &pt_regs */
>  	call do_notify_resume
>  	DISABLE_INTERRUPTS(CLBR_NONE)
>  	TRACE_IRQS_OFF
> @@ -1513,7 +1546,7 @@ ENTRY(error_exit)
>  	TRACE_IRQS_OFF
>  	GET_THREAD_INFO(%rcx)
>  	testl %eax,%eax
> -	jne retint_kernel
> +	jne  retexc_kernel
>  	LOCKDEP_SYS_EXIT_IRQ
>  	movl TI_flags(%rcx),%edx
>  	movl $_TIF_WORK_MASK,%edi
> Index: linux/include/linux/hardirq.h
> ===================================================================
> --- linux.orig/include/linux/hardirq.h
> +++ linux/include/linux/hardirq.h
> @@ -1,12 +1,14 @@
>  #ifndef LINUX_HARDIRQ_H
>  #define LINUX_HARDIRQ_H
>  
> +#ifndef __ASSEMBLY__
>  #include <linux/preempt.h>
>  #include <linux/smp_lock.h>
>  #include <linux/lockdep.h>
>  #include <linux/ftrace_irq.h>
>  #include <asm/hardirq.h>
>  #include <asm/system.h>
> +#endif
>  
>  /*
>   * We put the hardirq and softirq counter into the preemption
> @@ -50,17 +52,17 @@
>  #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
>  #define NMI_SHIFT	(HARDIRQ_SHIFT + HARDIRQ_BITS)
>  
> -#define __IRQ_MASK(x)	((1UL << (x))-1)
> +#define __IRQ_MASK(x)	((1 << (x))-1)
>  
>  #define PREEMPT_MASK	(__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
>  #define SOFTIRQ_MASK	(__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
>  #define HARDIRQ_MASK	(__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
>  #define NMI_MASK	(__IRQ_MASK(NMI_BITS)     << NMI_SHIFT)
>  
> -#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
> -#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
> -#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
> -#define NMI_OFFSET	(1UL << NMI_SHIFT)
> +#define PREEMPT_OFFSET	(1 << PREEMPT_SHIFT)
> +#define SOFTIRQ_OFFSET	(1 << SOFTIRQ_SHIFT)
> +#define HARDIRQ_OFFSET	(1 << HARDIRQ_SHIFT)
> +#define NMI_OFFSET	(1 << NMI_SHIFT)
>  
>  #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
>  #error PREEMPT_ACTIVE is too low!
> @@ -116,6 +118,8 @@
>  # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
>  #endif
>  
> +#ifndef __ASSEMBLY__
> +
>  #if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
>  extern void synchronize_irq(unsigned int irq);
>  #else
> @@ -195,4 +199,6 @@ extern void irq_exit(void);
>  		ftrace_nmi_exit();				\
>  	} while (0)
>  
> +#endif /* !__ASSEMBLY__ */
> +
>  #endif /* LINUX_HARDIRQ_H */

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:37                     ` Linus Torvalds
@ 2009-06-15 18:05                       ` Mathieu Desnoyers
  2009-06-15 18:23                         ` Ingo Molnar
  2009-06-15 18:30                         ` Linus Torvalds
  2009-06-15 18:08                       ` Ingo Molnar
  2009-06-15 18:38                       ` H. Peter Anvin
  2 siblings, 2 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:05 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra,
	penberg, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits

* Linus Torvalds (torvalds@linux-foundation.org) wrote:
> 
> 
> On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > 
> > A simple cr2 corruption would explain all those cc1 SIGSEGVs and 
> > other user-space crashes i saw, with sufficiently intense sampling - 
> > easily.
> 
> Note that we could work around the %cr2 issue, since any corruption is 
> always nicely "nested" (ie there are never any SMP issues with async 
> writes to the register).
> 
> So what we _could_ do is to have a magic value for %cr2, along with a "NMI 
> sequence count", and if we see that value, we just return (without doing 
> anything) from the page fault handler.
> 
> Then, the NMI handler would be changed to always write that value to %cr2 
> after it has done the operation that could fault, and do an atomic 
> increment of the NMI sequence count. Then, we can do something like this 
> in the page fault handler:
> 
> 	if (cr2 == MAGIC_CR2) {
> 		static unsigned long my_seqno = -1;
> 		if (my_seqno != nmi_seqno) {
> 			my_seqno = nmi_seqno;
> 			return;
> 		}
> 	}
> 
> where the whole (and only) point of that "seqno" is to protect against 
> user space doing something like
> 
> 	int i = *(int *)MAGIC_CR2;
> 
> and causing infinite faults.
> 
> If a real NMI happens, then nmi_seqno will always be different, and we'll 
> just retry the fault (the NMI handler would do something like
> 
> 	write_cr2(MAGIC_CR2);
> 	atomic_inc(&nmi_seqno);
> 
> to set it all up).
> 
> Anyway, I do think that the _correct_ solution is to not do page faults 
> from within NMI's, but the above is an outline of how we could _try_ to 
> handle it if we really really wanted to. IOW, the fact that cr2 gets 
> corrupted is not insurmountable, exactly because we _could_ always just 
> retrigger the page fault, and thus "re-create' the corrupted %cr2 value.
> 
> Hacky, hacky. And I'm not sure how happy CPU's even are to have %cr2 
> written to, so we could hit CPU issues.
> 

Hrm, would it be possible to save the c2 register upon nmi handler entry
and restore it before iret instead ? This would ensure a
nmi-interrupted page fault handler would continue what it was doing with
a non-corrupted cr2 register after returning from nmi.

Plus, this involves no modification to the page fault handler fast path.

But I fear I might be missing something totally obvious.

Mathieu


> 			Linus

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:37                     ` Linus Torvalds
  2009-06-15 18:05                       ` Mathieu Desnoyers
@ 2009-06-15 18:08                       ` Ingo Molnar
  2009-06-15 18:38                       ` H. Peter Anvin
  2 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:08 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mingo, hpa, mathieu.desnoyers, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Then, the NMI handler would be changed to always write that value 
> to %cr2 after it has done the operation that could fault, and do 
> an atomic increment of the NMI sequence count. Then, we can do 
> something like this in the page fault handler:
> 
> 	if (cr2 == MAGIC_CR2) {
> 		static unsigned long my_seqno = -1;
> 		if (my_seqno != nmi_seqno) {
> 			my_seqno = nmi_seqno;
> 			return;
> 		}
> 	}
> 
> where the whole (and only) point of that "seqno" is to protect against 
> user space doing something like
> 
> 	int i = *(int *)MAGIC_CR2;
> 
> and causing infinite faults.

Heh - this is so tricky that it's disgusting! Lovely.

And, since this appears to be a competition of sick ideas, an even 
more disgusting hack might be to write to the IDT from the NMI 
handler, and install a NULL entry at #PF and rely on the double 
fault handler to detect faults - double faults dont clobber the cr2 
i think ...

( I think to protect the fragile and pure fabric of lkml against
  moral corruption, disgusting patches must remain unsent and
  disgusting ideas like this must absolutely stay unspoken. Hence
  i have removed lkml from the Cc:. [Oops i didnt ... too late, 
  and this mail has already been sent! :-/ ])

> If a real NMI happens, then nmi_seqno will always be different, 
> and we'll just retry the fault (the NMI handler would do something 
> like
> 
> 	write_cr2(MAGIC_CR2);
> 	atomic_inc(&nmi_seqno);
> 
> to set it all up).
> 
> Anyway, I do think that the _correct_ solution is to not do page 
> faults from within NMI's, but the above is an outline of how we 
> could _try_ to handle it if we really really wanted to. IOW, the 
> fact that cr2 gets corrupted is not insurmountable, exactly 
> because we _could_ always just retrigger the page fault, and thus 
> "re-create' the corrupted %cr2 value.
> 
> Hacky, hacky. And I'm not sure how happy CPU's even are to have 
> %cr2 written to, so we could hit CPU issues.

If cr2 cannot be safely written to on a CPU, that could be worked 
around by counting the number of NMIs via a 
percpu_add(this_nmi_count, 1) and retrying faults if any NMI 
happened between the previous fault and this fault.

This has the disadvantage of potentially doubling the number of 
pagefaults though. But it would certainly work as a tricky quirk to 
this quirk which is added to a rather quirky code-path to begin 
with.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:42                     ` Mathieu Desnoyers
@ 2009-06-15 18:18                       ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:18 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, penberg,
	torvalds, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * Ingo Molnar (mingo@elte.hu) wrote:
> > 
> > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> > 
> > > * tip-bot for Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> > > > Commit-ID:  74193ef0ecab92535c8517f082f1f50504526c9b
> > > > Gitweb:     http://git.kernel.org/tip/74193ef0ecab92535c8517f082f1f50504526c9b
> > > > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > > AuthorDate: Mon, 15 Jun 2009 13:07:24 +0200
> > > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > > CommitDate: Mon, 15 Jun 2009 15:57:53 +0200
> > > > 
> > > > perf_counter: x86: Fix call-chain support to use NMI-safe methods
> > > > 
> > > > __copy_from_user_inatomic() isn't NMI safe in that it can trigger
> > > > the page fault handler which is another trap and its return path
> > > > invokes IRET which will also close the NMI context.
> > > > 
> > > > Therefore use a GUP based approach to copy the stack frames over.
> > > > 
> > > > We tried an alternative solution as well: we used a forward ported
> > > > version of Mathieu Desnoyers's "NMI safe INT3 and Page Fault" patch
> > > > that modifies the exception return path to use an open-coded IRET with
> > > > explicit stack unrolling and TF checking.
> > > > 
> > > > This didnt work as it interacted with faulting user-space instructions,
> > > > causing them not to restart properly, which corrupts user-space
> > > > registers.
> > > > 
> > > > Solving that would probably involve disassembling those instructions
> > > > and backtracing the RIP. But even without that, the code was deemed
> > > > rather complex to the already non-trivial x86 entry assembly code,
> > > > so instead we went for this GUP based method that does a
> > > > software-walk of the pagetables.
> > > > 
> > > 
> > > Hrm, I'm probably missing something. Normally, you should test for 
> > > "in_nmi()" upon return from exception, and only in these cases go 
> > > for the open-coded IRET with stack unrolling and ret. I really 
> > > don't see how you end up messing up the page fault return to 
> > > userspace path, as it's impossible to have in_nmi() set.
> > 
> > here's the (heavily modified) version of your patch that i used.
> > 
> > 	Ingo
> > 
> > -------------------->
> > Subject: x86 NMI-safe INT3 and Page Fault
> > From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > Date: Mon, 12 May 2008 21:21:07 +0200
> > 
> > Implements an alternative iret with popf and return so trap and exception
> > handlers can return to the NMI handler without issuing iret. iret would cause
> > NMIs to be reenabled prematurely. x86_32 uses popf and far return. x86_64 has to
> > copy the return instruction pointer to the top of the previous stack, issue a
> > popf, loads the previous esp and issue a near return (ret).
> > 
> > It allows placing immediate values (and therefore optimized trace_marks) in NMI
> > code since returning from a breakpoint would be valid. Accessing vmalloc'd
> > memory, which allows executing module code or accessing vmapped or vmalloc'd
> > areas from NMI context, would also be valid. This is very useful to tracers like
> > LTTng.
> > 
> > This patch makes all faults, traps and exception safe to be called from NMI
> > context *except* single-stepping, which requires iret to restore the TF (trap
> > flag) and jump to the return address in a single instruction. Sorry, no kprobes
> > support in NMI handlers because of this limitation.  We cannot single-step an
> > NMI handler, because iret must set the TF flag and return back to the
> > instruction to single-step in a single instruction. This cannot be emulated with
> > popf/lret, because lret would be single-stepped. It does not apply to immediate
> > values because they do not use single-stepping. This code detects if the TF
> > flag is set and uses the iret path for single-stepping, even if it reactivates
> > NMIs prematurely.
> > 
> > Test to detect if nested under a NMI handler is only done upon the return from
> > trap/exception to kernel, which is not frequent. Other return paths (return from
> > trap/exception to userspace, return from interrupt) keep the exact same behavior
> > (no slowdown).
> > 
> > Depends on :
> > change-alpha-active-count-bit.patch
> > change-avr32-active-count-bit.patch
> > 
> > TODO : test with lguest, xen, kvm.
> > 
> > ** This patch depends on the "Stringify support commas" patchset **
> > ** Also depends on fix-x86_64-page-fault-scheduler-race patch **
> > 
> > tested on x86_32 (tests implemented in a separate patch) :
> > - instrumented the return path to export the EIP, CS and EFLAGS values when
> >   taken so we know the return path code has been executed.
> > - trace_mark, using immediate values, with 10ms delay with the breakpoint
> >   activated. Runs well through the return path.
> > - tested vmalloc faults in NMI handler by placing a non-optimized marker in the
> >   NMI handler (so no breakpoint is executed) and connecting a probe which
> >   touches every pages of a 20MB vmalloc'd buffer. It executes trough the return
> >   path without problem.
> > - Tested with and without preemption
> > 
> > tested on x86_64
> > - instrumented the return path to export the EIP, CS and EFLAGS values when
> >   taken so we know the return path code has been executed.
> > - trace_mark, using immediate values, with 10ms delay with the breakpoint
> >   activated. Runs well through the return path.
> > 
> > To test on x86_64 :
> > - Test without preemption
> > - Test vmalloc faults
> > - Test on Intel 64 bits CPUs. (AMD64 was fine)
> > 
> > Changelog since v1 :
> > - x86_64 fixes.
> > Changelog since v2 :
> > - fix paravirt build
> > Changelog since v3 :
> > - Include modifications suggested by Jeremy
> > Changelog since v4 :
> > - including hardirq.h in entry_32/64.S is a bad idea (non ifndef'd C code),
> >   define HARDNMI_MASK in the .S files directly.
> > Changelog since v5 :
> > - Add HARDNMI_MASK to irq_count() and make die() more verbose for NMIs.
> > Changelog since v7 :
> > - Implement paravirtualized nmi_return.
> > Changelog since v8 :
> > - refreshed the patch for asm-offsets. Those were left out of v8.
> > - now depends on "Stringify support commas" patch.
> > Changelog since v9 :
> > - Only test the nmi nested preempt count flag upon return from exceptions, not
> >   on return from interrupts. Only the kernel return path has this test.
> > - Add Xen, VMI, lguest support. Use their iret pavavirt ops in lieu of
> >   nmi_return.
> > 
> > -- Ported to sched-devel.git
> > 
> > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> > CC: akpm@osdl.org
> > CC: mingo@elte.hu
> > CC: "H. Peter Anvin" <hpa@zytor.com>
> > CC: Jeremy Fitzhardinge <jeremy@goop.org>
> > CC: Steven Rostedt <rostedt@goodmis.org>
> > CC: "Frank Ch. Eigler" <fche@redhat.com>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > ---
> >  arch/x86/include/asm/irqflags.h |   56 +++++++++++++++++++++++++++++++++++++++
> >  arch/x86/kernel/dumpstack.c     |    2 +
> >  arch/x86/kernel/entry_32.S      |   30 +++++++++++++++++++++
> >  arch/x86/kernel/entry_64.S      |   57 +++++++++++++++++++++++++++++++---------
> >  include/linux/hardirq.h         |   16 +++++++----
> >  5 files changed, 144 insertions(+), 17 deletions(-)
> > 
> > Index: linux/arch/x86/include/asm/irqflags.h
> > ===================================================================
> > --- linux.orig/arch/x86/include/asm/irqflags.h
> > +++ linux/arch/x86/include/asm/irqflags.h
> > @@ -51,6 +51,61 @@ static inline void native_halt(void)
> >  
> >  #endif
> >  
> > +#ifdef CONFIG_X86_64
> > +/*
> > + * Only returns from a trap or exception to a NMI context (intra-privilege
> > + * level near return) to the same SS and CS segments. Should be used
> > + * upon trap or exception return when nested over a NMI context so no iret is
> > + * issued. It takes care of modifying the eflags, rsp and returning to the
> > + * previous function.
> > + *
> > + * The stack, at that point, looks like :
> > + *
> > + * 0(rsp)  RIP
> > + * 8(rsp)  CS
> > + * 16(rsp) EFLAGS
> > + * 24(rsp) RSP
> > + * 32(rsp) SS
> > + *
> > + * Upon execution :
> > + * Copy EIP to the top of the return stack
> > + * Update top of return stack address
> > + * Pop eflags into the eflags register
> > + * Make the return stack current
> > + * Near return (popping the return address from the return stack)
> > + */
> > +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> > +						movq %rsp, %rax;	\
> > +						movq 24+8(%rax), %rsp;	\
> > +						pushq 0+8(%rax);	\
> > +						pushq 16+8(%rax);	\
> > +						movq (%rax), %rax;	\
> > +						popfq;			\
> > +						ret
> > +#else
> > +/*
> > + * Protected mode only, no V8086. Implies that protected mode must
> > + * be entered before NMIs or MCEs are enabled. Only returns from a trap or
> > + * exception to a NMI context (intra-privilege level far return). Should be used
> > + * upon trap or exception return when nested over a NMI context so no iret is
> > + * issued.
> > + *
> > + * The stack, at that point, looks like :
> > + *
> > + * 0(esp) EIP
> > + * 4(esp) CS
> > + * 8(esp) EFLAGS
> > + *
> > + * Upon execution :
> > + * Copy the stack eflags to top of stack
> > + * Pop eflags into the eflags register
> > + * Far return: pop EIP and CS into their register, and additionally pop EFLAGS.
> > + */
> > +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushl 8(%esp);	\
> > +						popfl;		\
> > +						lret $4
> > +#endif
> > +
> >  #ifdef CONFIG_PARAVIRT
> >  #include <asm/paravirt.h>
> >  #else
> > @@ -109,6 +164,7 @@ static inline unsigned long __raw_local_
> >  
> >  #define ENABLE_INTERRUPTS(x)	sti
> >  #define DISABLE_INTERRUPTS(x)	cli
> > +#define INTERRUPT_RETURN_NMI_SAFE	NATIVE_INTERRUPT_RETURN_NMI_SAFE
> >  
> >  #ifdef CONFIG_X86_64
> >  #define SWAPGS	swapgs
> > Index: linux/arch/x86/kernel/dumpstack.c
> > ===================================================================
> > --- linux.orig/arch/x86/kernel/dumpstack.c
> > +++ linux/arch/x86/kernel/dumpstack.c
> > @@ -237,6 +237,8 @@ void __kprobes oops_end(unsigned long fl
> >  
> >  	if (!signr)
> >  		return;
> > +	if (in_nmi())
> > +		panic("Fatal exception in non-maskable interrupt");
> >  	if (in_interrupt())
> >  		panic("Fatal exception in interrupt");
> >  	if (panic_on_oops)
> > Index: linux/arch/x86/kernel/entry_32.S
> > ===================================================================
> > --- linux.orig/arch/x86/kernel/entry_32.S
> > +++ linux/arch/x86/kernel/entry_32.S
> > @@ -80,6 +80,8 @@
> >  
> >  #define nr_syscalls ((syscall_table_size)/4)
> >  
> > +#define HARDNMI_MASK 0x40000000
> > +
> 
> This is called "NMI_MASK" in 2.6.30. Did you test the x86_64 or 
> x86_32 portion of this patch ? 64-bits seems ok, but not 32.

i only tested the 64-bit side, and fixed up NMI_MASK only on that 
side (as you can see it from the patch). This was a partial port of 
your patch.

> It's all I can spot for now, but if you have popf/ret firing to 
> return to userspace instructions, there is clearly something fishy 
> there.

I think Linus's observation about cr2 corruption explains all the 
symptoms i saw.

And it all stabilized and started behaving under load once we 
switched to Peter's fast-GUP based soft-pte-lookup method.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:05                       ` Mathieu Desnoyers
@ 2009-06-15 18:23                         ` Ingo Molnar
  2009-06-15 18:28                           ` Ingo Molnar
                                             ` (2 more replies)
  2009-06-15 18:30                         ` Linus Torvalds
  1 sibling, 3 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:23 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> Hrm, would it be possible to save the c2 register upon nmi handler 
> entry and restore it before iret instead ? This would ensure a 
> nmi-interrupted page fault handler would continue what it was 
> doing with a non-corrupted cr2 register after returning from nmi.
> 
> Plus, this involves no modification to the page fault handler fast 
> path.

I guess this kind of nesting would work too - assuming the cr2 can 
be written to robustly.

And i suspect CPU makers pull off a few tricks to stage the cr2 info 
away from the page fault entry execution asynchronously, so i'd not 
be surprised if writing to it uncovered unknown-so-far side-effects 
in CPU implementations.

If possible i wouldnt want to rely on such a narrowly possible hack 
really - any small change in CPU specs could cause problems years 
down the line.

The GUP based method is pretty generic though - and can be used on 
other architectures as well. It's not as fast as direct access 
though.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:23                         ` Ingo Molnar
@ 2009-06-15 18:28                           ` Ingo Molnar
  2009-06-15 18:42                             ` Mathieu Desnoyers
  2009-06-15 18:51                             ` Linus Torvalds
  2009-06-15 18:38                           ` Mathieu Desnoyers
  2009-06-15 18:39                           ` H. Peter Anvin
  2 siblings, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:28 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> The GUP based method is pretty generic though - and can be used on 
> other architectures as well. It's not as fast as direct access 
> though.

Another question is: your patch switches over all normal exceptions 
from IRET to hand-unroll+RET.

It would be really nice to benchmark it (via 'perf stat' for example 
;-) whether that's a slowdown or a speedup.

If it's a slowdown then the decision is easy: we dont want this, we 
want to push the overhead into the sampling code, away from common 
codepaths.

[ If on the other hand it's a speedup of a few cycles then we have 
  the problem of me suddenly liking this patch a whole lot more ;-) ]

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:05                       ` Mathieu Desnoyers
  2009-06-15 18:23                         ` Ingo Molnar
@ 2009-06-15 18:30                         ` Linus Torvalds
  2009-06-15 18:36                           ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 18:30 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra,
	penberg, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits



On Mon, 15 Jun 2009, Mathieu Desnoyers wrote:
> 
> Hrm, would it be possible to save the c2 register upon nmi handler entry
> and restore it before iret instead ?

Yes, that would work as well, and be less subtle.

It still does have the same worries about CPU's not being all that happy 
about writing to %cr2 (we do it when restoring CPU state at resume time, 
but nobody has ever _cared_ before, so I don't know if it matters).

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:30                         ` Linus Torvalds
@ 2009-06-15 18:36                           ` Ingo Molnar
  2009-06-15 18:46                             ` Mathieu Desnoyers
  2009-06-15 19:04                             ` Linus Torvalds
  0 siblings, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 15 Jun 2009, Mathieu Desnoyers wrote:
> > 
> > Hrm, would it be possible to save the c2 register upon nmi 
> > handler entry and restore it before iret instead ?
> 
> Yes, that would work as well, and be less subtle.
> 
> It still does have the same worries about CPU's not being all that 
> happy about writing to %cr2 (we do it when restoring CPU state at 
> resume time, but nobody has ever _cared_ before, so I don't know 
> if it matters).

I think we can dodge the whole issue by asking whether the old 
1-year-old patch from Mathieu (repeated below - partially ported and 
barely tested / not signed off) is an actual speedup in the normal 
exception codepaths.

The gist of it is the replacement of iret with this open-coded 
sequence:

+#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
+						movq %rsp, %rax;	\
+						movq 24+8(%rax), %rsp;	\
+						pushq 0+8(%rax);	\
+						pushq 16+8(%rax);	\
+						movq (%rax), %rax;	\
+						popfq;			\
+						ret

Whether popfq+ret is faster than iret is the question i think. 
(beyond the question of 'how about all the weird stack exceptions 
that are possible above')

If it's faster, this becomes a legit (albeit complex) 
micro-optimization in a _very_ hot codepath.

If it's slower then it's a non-starter and we do the GUP solution.

Lets hope it's slower ;-)

	Ingo

----------->
Subject: x86 NMI-safe INT3 and Page Fault
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Mon, 12 May 2008 21:21:07 +0200

Implements an alternative iret with popf and return so trap and exception
handlers can return to the NMI handler without issuing iret. iret would cause
NMIs to be reenabled prematurely. x86_32 uses popf and far return. x86_64 has to
copy the return instruction pointer to the top of the previous stack, issue a
popf, loads the previous esp and issue a near return (ret).

It allows placing immediate values (and therefore optimized trace_marks) in NMI
code since returning from a breakpoint would be valid. Accessing vmalloc'd
memory, which allows executing module code or accessing vmapped or vmalloc'd
areas from NMI context, would also be valid. This is very useful to tracers like
LTTng.

This patch makes all faults, traps and exception safe to be called from NMI
context *except* single-stepping, which requires iret to restore the TF (trap
flag) and jump to the return address in a single instruction. Sorry, no kprobes
support in NMI handlers because of this limitation.  We cannot single-step an
NMI handler, because iret must set the TF flag and return back to the
instruction to single-step in a single instruction. This cannot be emulated with
popf/lret, because lret would be single-stepped. It does not apply to immediate
values because they do not use single-stepping. This code detects if the TF
flag is set and uses the iret path for single-stepping, even if it reactivates
NMIs prematurely.

Test to detect if nested under a NMI handler is only done upon the return from
trap/exception to kernel, which is not frequent. Other return paths (return from
trap/exception to userspace, return from interrupt) keep the exact same behavior
(no slowdown).

Depends on :
change-alpha-active-count-bit.patch
change-avr32-active-count-bit.patch

TODO : test with lguest, xen, kvm.

** This patch depends on the "Stringify support commas" patchset **
** Also depends on fix-x86_64-page-fault-scheduler-race patch **

tested on x86_32 (tests implemented in a separate patch) :
- instrumented the return path to export the EIP, CS and EFLAGS values when
  taken so we know the return path code has been executed.
- trace_mark, using immediate values, with 10ms delay with the breakpoint
  activated. Runs well through the return path.
- tested vmalloc faults in NMI handler by placing a non-optimized marker in the
  NMI handler (so no breakpoint is executed) and connecting a probe which
  touches every pages of a 20MB vmalloc'd buffer. It executes trough the return
  path without problem.
- Tested with and without preemption

tested on x86_64
- instrumented the return path to export the EIP, CS and EFLAGS values when
  taken so we know the return path code has been executed.
- trace_mark, using immediate values, with 10ms delay with the breakpoint
  activated. Runs well through the return path.

To test on x86_64 :
- Test without preemption
- Test vmalloc faults
- Test on Intel 64 bits CPUs. (AMD64 was fine)

Changelog since v1 :
- x86_64 fixes.
Changelog since v2 :
- fix paravirt build
Changelog since v3 :
- Include modifications suggested by Jeremy
Changelog since v4 :
- including hardirq.h in entry_32/64.S is a bad idea (non ifndef'd C code),
  define HARDNMI_MASK in the .S files directly.
Changelog since v5 :
- Add HARDNMI_MASK to irq_count() and make die() more verbose for NMIs.
Changelog since v7 :
- Implement paravirtualized nmi_return.
Changelog since v8 :
- refreshed the patch for asm-offsets. Those were left out of v8.
- now depends on "Stringify support commas" patch.
Changelog since v9 :
- Only test the nmi nested preempt count flag upon return from exceptions, not
  on return from interrupts. Only the kernel return path has this test.
- Add Xen, VMI, lguest support. Use their iret pavavirt ops in lieu of
  nmi_return.

-- Ported to sched-devel.git

---
 arch/x86/include/asm/irqflags.h |   56 +++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/dumpstack.c     |    2 +
 arch/x86/kernel/entry_64.S      |   57 +++++++++++++++++++++++++++++++---------
 include/linux/hardirq.h         |   16 +++++++----

Index: linux/arch/x86/include/asm/irqflags.h
===================================================================
--- linux.orig/arch/x86/include/asm/irqflags.h
+++ linux/arch/x86/include/asm/irqflags.h
@@ -51,6 +51,61 @@ static inline void native_halt(void)
 
 #endif
 
+#ifdef CONFIG_X86_64
+/*
+ * Only returns from a trap or exception to a NMI context (intra-privilege
+ * level near return) to the same SS and CS segments. Should be used
+ * upon trap or exception return when nested over a NMI context so no iret is
+ * issued. It takes care of modifying the eflags, rsp and returning to the
+ * previous function.
+ *
+ * The stack, at that point, looks like :
+ *
+ * 0(rsp)  RIP
+ * 8(rsp)  CS
+ * 16(rsp) EFLAGS
+ * 24(rsp) RSP
+ * 32(rsp) SS
+ *
+ * Upon execution :
+ * Copy EIP to the top of the return stack
+ * Update top of return stack address
+ * Pop eflags into the eflags register
+ * Make the return stack current
+ * Near return (popping the return address from the return stack)
+ */
+#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
+						movq %rsp, %rax;	\
+						movq 24+8(%rax), %rsp;	\
+						pushq 0+8(%rax);	\
+						pushq 16+8(%rax);	\
+						movq (%rax), %rax;	\
+						popfq;			\
+						ret
+#else
+/*
+ * Protected mode only, no V8086. Implies that protected mode must
+ * be entered before NMIs or MCEs are enabled. Only returns from a trap or
+ * exception to a NMI context (intra-privilege level far return). Should be used
+ * upon trap or exception return when nested over a NMI context so no iret is
+ * issued.
+ *
+ * The stack, at that point, looks like :
+ *
+ * 0(esp) EIP
+ * 4(esp) CS
+ * 8(esp) EFLAGS
+ *
+ * Upon execution :
+ * Copy the stack eflags to top of stack
+ * Pop eflags into the eflags register
+ * Far return: pop EIP and CS into their register, and additionally pop EFLAGS.
+ */
+#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushl 8(%esp);	\
+						popfl;		\
+						lret $4
+#endif
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else
@@ -109,6 +164,7 @@ static inline unsigned long __raw_local_
 
 #define ENABLE_INTERRUPTS(x)	sti
 #define DISABLE_INTERRUPTS(x)	cli
+#define INTERRUPT_RETURN_NMI_SAFE	NATIVE_INTERRUPT_RETURN_NMI_SAFE
 
 #ifdef CONFIG_X86_64
 #define SWAPGS	swapgs
Index: linux/arch/x86/kernel/dumpstack.c
===================================================================
--- linux.orig/arch/x86/kernel/dumpstack.c
+++ linux/arch/x86/kernel/dumpstack.c
@@ -237,6 +237,8 @@ void __kprobes oops_end(unsigned long fl
 
 	if (!signr)
 		return;
+	if (in_nmi())
+		panic("Fatal exception in non-maskable interrupt");
 	if (in_interrupt())
 		panic("Fatal exception in interrupt");
 	if (panic_on_oops)
Index: linux/arch/x86/kernel/entry_64.S
===================================================================
--- linux.orig/arch/x86/kernel/entry_64.S
+++ linux/arch/x86/kernel/entry_64.S
@@ -53,6 +53,7 @@
 #include <asm/paravirt.h>
 #include <asm/ftrace.h>
 #include <asm/percpu.h>
+#include <linux/hardirq.h>
 
 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
 #include <linux/elf-em.h>
@@ -875,6 +876,9 @@ ENTRY(native_iret)
 	.section __ex_table,"a"
 	.quad native_iret, bad_iret
 	.previous
+
+ENTRY(native_nmi_return)
+	NATIVE_INTERRUPT_RETURN_NMI_SAFE
 #endif
 
 	.section .fixup,"ax"
@@ -929,6 +933,23 @@ retint_signal:
 	GET_THREAD_INFO(%rcx)
 	jmp retint_with_reschedule
 
+	/* Returning to kernel space from exception. */
+	/* rcx:	 threadinfo. interrupts off. */
+ENTRY(retexc_kernel)
+	testl $NMI_MASK, TI_preempt_count(%rcx)
+	jz retint_kernel		/* Not nested over NMI ? */
+	testw $X86_EFLAGS_TF, EFLAGS-ARGOFFSET(%rsp)	/* trap flag? */
+	jnz retint_kernel		/*
+					 * If single-stepping an NMI handler,
+					 * use the normal iret path instead of
+					 * the popf/lret because lret would be
+					 * single-stepped. It should not
+					 * happen : it will reactivate NMIs
+					 * prematurely.
+					 */
+	RESTORE_ARGS 0, 8, 0
+	INTERRUPT_RETURN_NMI_SAFE
+
 #ifdef CONFIG_PREEMPT
 	/* Returning to kernel space. Check if we need preemption */
 	/* rcx:	 threadinfo. interrupts off. */
@@ -1407,34 +1428,46 @@ ENTRY(paranoid_exit)
 	INTR_FRAME
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
-	testl %ebx,%ebx				/* swapgs needed? */
+	testl %ebx, %ebx			/* swapgs needed? */
 	jnz paranoid_restore
-	testl $3,CS(%rsp)
+
+	testl $3, CS(%rsp)
 	jnz   paranoid_userspace
+
 paranoid_swapgs:
 	TRACE_IRQS_IRETQ 0
 	SWAPGS_UNSAFE_STACK
 	RESTORE_ALL 8
 	jmp irq_return
-paranoid_restore:
+paranoid_restore_no_nmi:
 	TRACE_IRQS_IRETQ 0
 	RESTORE_ALL 8
 	jmp irq_return
+paranoid_restore:
+	GET_THREAD_INFO(%rcx)
+	testl $NMI_MASK, TI_preempt_count(%rcx)
+	jz paranoid_restore_no_nmi		/* Nested over NMI ? */
+
+	testw $X86_EFLAGS_TF, EFLAGS-0(%rsp)	/* trap flag? */
+	jnz paranoid_restore_no_nmi
+	RESTORE_ALL 8
+	INTERRUPT_RETURN_NMI_SAFE
+
 paranoid_userspace:
 	GET_THREAD_INFO(%rcx)
-	movl TI_flags(%rcx),%ebx
-	andl $_TIF_WORK_MASK,%ebx
+	movl TI_flags(%rcx), %ebx
+	andl $_TIF_WORK_MASK, %ebx
 	jz paranoid_swapgs
-	movq %rsp,%rdi			/* &pt_regs */
+	movq %rsp, %rdi				/* &pt_regs */
 	call sync_regs
-	movq %rax,%rsp			/* switch stack for scheduling */
-	testl $_TIF_NEED_RESCHED,%ebx
+	movq %rax, %rsp				/* switch stack for scheduling */
+	testl $_TIF_NEED_RESCHED, %ebx
 	jnz paranoid_schedule
-	movl %ebx,%edx			/* arg3: thread flags */
+	movl %ebx, %edx				/* arg3: thread flags */
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_NONE)
-	xorl %esi,%esi 			/* arg2: oldset */
-	movq %rsp,%rdi 			/* arg1: &pt_regs */
+	xorl %esi, %esi				/* arg2: oldset */
+	movq %rsp, %rdi				/* arg1: &pt_regs */
 	call do_notify_resume
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
@@ -1513,7 +1546,7 @@ ENTRY(error_exit)
 	TRACE_IRQS_OFF
 	GET_THREAD_INFO(%rcx)
 	testl %eax,%eax
-	jne retint_kernel
+	jne  retexc_kernel
 	LOCKDEP_SYS_EXIT_IRQ
 	movl TI_flags(%rcx),%edx
 	movl $_TIF_WORK_MASK,%edi
Index: linux/include/linux/hardirq.h
===================================================================
--- linux.orig/include/linux/hardirq.h
+++ linux/include/linux/hardirq.h
@@ -1,12 +1,14 @@
 #ifndef LINUX_HARDIRQ_H
 #define LINUX_HARDIRQ_H
 
+#ifndef __ASSEMBLY__
 #include <linux/preempt.h>
 #include <linux/smp_lock.h>
 #include <linux/lockdep.h>
 #include <linux/ftrace_irq.h>
 #include <asm/hardirq.h>
 #include <asm/system.h>
+#endif
 
 /*
  * We put the hardirq and softirq counter into the preemption
@@ -50,17 +52,17 @@
 #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
 #define NMI_SHIFT	(HARDIRQ_SHIFT + HARDIRQ_BITS)
 
-#define __IRQ_MASK(x)	((1UL << (x))-1)
+#define __IRQ_MASK(x)	((1 << (x))-1)
 
 #define PREEMPT_MASK	(__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
 #define SOFTIRQ_MASK	(__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
 #define HARDIRQ_MASK	(__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
 #define NMI_MASK	(__IRQ_MASK(NMI_BITS)     << NMI_SHIFT)
 
-#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
-#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
-#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
-#define NMI_OFFSET	(1UL << NMI_SHIFT)
+#define PREEMPT_OFFSET	(1 << PREEMPT_SHIFT)
+#define SOFTIRQ_OFFSET	(1 << SOFTIRQ_SHIFT)
+#define HARDIRQ_OFFSET	(1 << HARDIRQ_SHIFT)
+#define NMI_OFFSET	(1 << NMI_SHIFT)
 
 #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
 #error PREEMPT_ACTIVE is too low!
@@ -116,6 +118,8 @@
 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
 #endif
 
+#ifndef __ASSEMBLY__
+
 #if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
 extern void synchronize_irq(unsigned int irq);
 #else
@@ -195,4 +199,6 @@ extern void irq_exit(void);
 		ftrace_nmi_exit();				\
 	} while (0)
 
+#endif /* !__ASSEMBLY__ */
+
 #endif /* LINUX_HARDIRQ_H */


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 17:37                     ` Linus Torvalds
  2009-06-15 18:05                       ` Mathieu Desnoyers
  2009-06-15 18:08                       ` Ingo Molnar
@ 2009-06-15 18:38                       ` H. Peter Anvin
  2009-06-15 18:48                         ` Mathieu Desnoyers
  2 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 18:38 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, mingo, mathieu.desnoyers, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Linus Torvalds wrote:
> 
> On Mon, 15 Jun 2009, Ingo Molnar wrote:
>> A simple cr2 corruption would explain all those cc1 SIGSEGVs and 
>> other user-space crashes i saw, with sufficiently intense sampling - 
>> easily.
> 
> Note that we could work around the %cr2 issue, since any corruption is 
> always nicely "nested" (ie there are never any SMP issues with async 
> writes to the register).
> 
> So what we _could_ do is to have a magic value for %cr2, along with a "NMI 
> sequence count", and if we see that value, we just return (without doing 
> anything) from the page fault handler.
> 

Wouldn't it be simpler to just require the NMI handler to save and
restore %cr2 around any potentially faulting references?

	-hpa

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:23                         ` Ingo Molnar
  2009-06-15 18:28                           ` Ingo Molnar
@ 2009-06-15 18:38                           ` Mathieu Desnoyers
  2009-06-15 18:50                             ` Ingo Molnar
  2009-06-15 18:39                           ` H. Peter Anvin
  2 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Hrm, would it be possible to save the c2 register upon nmi handler 
> > entry and restore it before iret instead ? This would ensure a 
> > nmi-interrupted page fault handler would continue what it was 
> > doing with a non-corrupted cr2 register after returning from nmi.
> > 
> > Plus, this involves no modification to the page fault handler fast 
> > path.
> 
> I guess this kind of nesting would work too - assuming the cr2 can 
> be written to robustly.
> 
> And i suspect CPU makers pull off a few tricks to stage the cr2 info 
> away from the page fault entry execution asynchronously, so i'd not 
> be surprised if writing to it uncovered unknown-so-far side-effects 
> in CPU implementations.
> 
> If possible i wouldnt want to rely on such a narrowly possible hack 
> really - any small change in CPU specs could cause problems years 
> down the line.
> 
> The GUP based method is pretty generic though - and can be used on 
> other architectures as well. It's not as fast as direct access 
> though.
> 
> 	Ingo

I guess. However, having the ability to call module code in NMI handler
context without having to fear for page fault handler re-entrancy (on
x86 32) seems like an interesting overall simplification of nmi-handler
rules. It is currently far from trivial to write code aimed at NMI
handler context. I mean.. LTTng should not have to run
vmalloc_sync_all() after loading its modules as it currently does.

Maybe it would be worth trying the save/restore cr2 approach and test to
figure out how a large variety of machines react. The fact is that
hypervisor code already writes into the cr2 register :

kvm/vmx.c :
vmx_vcpu_run()
...
                "mov %%"R"ax, %%cr2 \n\t"

Mathieu



-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:23                         ` Ingo Molnar
  2009-06-15 18:28                           ` Ingo Molnar
  2009-06-15 18:38                           ` Mathieu Desnoyers
@ 2009-06-15 18:39                           ` H. Peter Anvin
  2009-06-15 18:45                             ` Ingo Molnar
  2 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 18:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

Ingo Molnar wrote:
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
>> Hrm, would it be possible to save the c2 register upon nmi handler 
>> entry and restore it before iret instead ? This would ensure a 
>> nmi-interrupted page fault handler would continue what it was 
>> doing with a non-corrupted cr2 register after returning from nmi.
>>
>> Plus, this involves no modification to the page fault handler fast 
>> path.
> 
> I guess this kind of nesting would work too - assuming the cr2 can 
> be written to robustly.
> 
> And i suspect CPU makers pull off a few tricks to stage the cr2 info 
> away from the page fault entry execution asynchronously, so i'd not 
> be surprised if writing to it uncovered unknown-so-far side-effects 
> in CPU implementations.
> 

I wouldn't actually expect that, *as long as* there is serialization
between the cr2 write and the cr2 read.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:28                           ` Ingo Molnar
@ 2009-06-15 18:42                             ` Mathieu Desnoyers
  2009-06-15 18:47                               ` Ingo Molnar
  2009-06-15 18:51                             ` Linus Torvalds
  1 sibling, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:42 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > The GUP based method is pretty generic though - and can be used on 
> > other architectures as well. It's not as fast as direct access 
> > though.
> 
> Another question is: your patch switches over all normal exceptions 
> from IRET to hand-unroll+RET.
> 

Nope, it actually only switches the exceptions returning from an
exception handler nested in NMI context to the hand-unroll+RET version.
Given such exception nesting is expected to be very rare, it should not
show any performance difference.

I also organised the code to make sure I did not add any test to the
fast paths in my original patch.

> It would be really nice to benchmark it (via 'perf stat' for example 
> ;-) whether that's a slowdown or a speedup.
> 
> If it's a slowdown then the decision is easy: we dont want this, we 
> want to push the overhead into the sampling code, away from common 
> codepaths.
> 

I did not try to make the "hand unroll + ret" the default. I therefore
don't know if it is faster or slower than iret. But I prefered to stay
on the safe side and only modify the exceptions nested within NMI
handlers.

Mathieu

> [ If on the other hand it's a speedup of a few cycles then we have 
>   the problem of me suddenly liking this patch a whole lot more ;-) ]
> 
> 	Ingo

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:39                           ` H. Peter Anvin
@ 2009-06-15 18:45                             ` Ingo Molnar
  2009-06-15 18:55                               ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:45 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Mathieu Desnoyers, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits


* H. Peter Anvin <hpa@zytor.com> wrote:

> Ingo Molnar wrote:
> > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> > 
> >> Hrm, would it be possible to save the c2 register upon nmi handler 
> >> entry and restore it before iret instead ? This would ensure a 
> >> nmi-interrupted page fault handler would continue what it was 
> >> doing with a non-corrupted cr2 register after returning from nmi.
> >>
> >> Plus, this involves no modification to the page fault handler fast 
> >> path.
> > 
> > I guess this kind of nesting would work too - assuming the cr2 can 
> > be written to robustly.
> > 
> > And i suspect CPU makers pull off a few tricks to stage the cr2 info 
> > away from the page fault entry execution asynchronously, so i'd not 
> > be surprised if writing to it uncovered unknown-so-far side-effects 
> > in CPU implementations.
> > 
> 
> I wouldn't actually expect that, *as long as* there is 
> serialization between the cr2 write and the cr2 read.

Well, is there any OS that heavily relies on cr2 writes and which 
uses them from NMI context, and which CPU makers care about? 
(Meaning: Windows, pretty much.)

If not then i agree that in theory it should work fine, but in 
practice we only know that we dont know the unknown risk here ;-)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:36                           ` Ingo Molnar
@ 2009-06-15 18:46                             ` Mathieu Desnoyers
  2009-06-15 19:04                             ` Linus Torvalds
  1 sibling, 0 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > On Mon, 15 Jun 2009, Mathieu Desnoyers wrote:
> > > 
> > > Hrm, would it be possible to save the c2 register upon nmi 
> > > handler entry and restore it before iret instead ?
> > 
> > Yes, that would work as well, and be less subtle.
> > 
> > It still does have the same worries about CPU's not being all that 
> > happy about writing to %cr2 (we do it when restoring CPU state at 
> > resume time, but nobody has ever _cared_ before, so I don't know 
> > if it matters).
> 
> I think we can dodge the whole issue by asking whether the old 
> 1-year-old patch from Mathieu (repeated below - partially ported and 
> barely tested / not signed off) is an actual speedup in the normal 
> exception codepaths.
> 
> The gist of it is the replacement of iret with this open-coded 
> sequence:
> 
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> +						movq %rsp, %rax;	\
> +						movq 24+8(%rax), %rsp;	\
> +						pushq 0+8(%rax);	\
> +						pushq 16+8(%rax);	\
> +						movq (%rax), %rax;	\
> +						popfq;			\
> +						ret
> 
> Whether popfq+ret is faster than iret is the question i think. 
> (beyond the question of 'how about all the weird stack exceptions 
> that are possible above')
> 
> If it's faster, this becomes a legit (albeit complex) 
> micro-optimization in a _very_ hot codepath.
> 
> If it's slower then it's a non-starter and we do the GUP solution.
> 
> Lets hope it's slower ;-)
> 

As I pointed out in my earlier email, and as I add :

- My patch only touched exceptions nested in NMI handlers
- You should not use the popf+ret to return to userspace. This could
  lead to interesting results like userspace running in ring 0. (read :
  bad things would happen).

So if you want to try making it the default to return from interrupts or
exceptions caught in kernel-mode, that might be interesting to see if it
speeds up the system compared to iret.

Mathieu

> 	Ingo
> 
> ----------->
> Subject: x86 NMI-safe INT3 and Page Fault
> From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> Date: Mon, 12 May 2008 21:21:07 +0200
> 
> Implements an alternative iret with popf and return so trap and exception
> handlers can return to the NMI handler without issuing iret. iret would cause
> NMIs to be reenabled prematurely. x86_32 uses popf and far return. x86_64 has to
> copy the return instruction pointer to the top of the previous stack, issue a
> popf, loads the previous esp and issue a near return (ret).
> 
> It allows placing immediate values (and therefore optimized trace_marks) in NMI
> code since returning from a breakpoint would be valid. Accessing vmalloc'd
> memory, which allows executing module code or accessing vmapped or vmalloc'd
> areas from NMI context, would also be valid. This is very useful to tracers like
> LTTng.
> 
> This patch makes all faults, traps and exception safe to be called from NMI
> context *except* single-stepping, which requires iret to restore the TF (trap
> flag) and jump to the return address in a single instruction. Sorry, no kprobes
> support in NMI handlers because of this limitation.  We cannot single-step an
> NMI handler, because iret must set the TF flag and return back to the
> instruction to single-step in a single instruction. This cannot be emulated with
> popf/lret, because lret would be single-stepped. It does not apply to immediate
> values because they do not use single-stepping. This code detects if the TF
> flag is set and uses the iret path for single-stepping, even if it reactivates
> NMIs prematurely.
> 
> Test to detect if nested under a NMI handler is only done upon the return from
> trap/exception to kernel, which is not frequent. Other return paths (return from
> trap/exception to userspace, return from interrupt) keep the exact same behavior
> (no slowdown).
> 
> Depends on :
> change-alpha-active-count-bit.patch
> change-avr32-active-count-bit.patch
> 
> TODO : test with lguest, xen, kvm.
> 
> ** This patch depends on the "Stringify support commas" patchset **
> ** Also depends on fix-x86_64-page-fault-scheduler-race patch **
> 
> tested on x86_32 (tests implemented in a separate patch) :
> - instrumented the return path to export the EIP, CS and EFLAGS values when
>   taken so we know the return path code has been executed.
> - trace_mark, using immediate values, with 10ms delay with the breakpoint
>   activated. Runs well through the return path.
> - tested vmalloc faults in NMI handler by placing a non-optimized marker in the
>   NMI handler (so no breakpoint is executed) and connecting a probe which
>   touches every pages of a 20MB vmalloc'd buffer. It executes trough the return
>   path without problem.
> - Tested with and without preemption
> 
> tested on x86_64
> - instrumented the return path to export the EIP, CS and EFLAGS values when
>   taken so we know the return path code has been executed.
> - trace_mark, using immediate values, with 10ms delay with the breakpoint
>   activated. Runs well through the return path.
> 
> To test on x86_64 :
> - Test without preemption
> - Test vmalloc faults
> - Test on Intel 64 bits CPUs. (AMD64 was fine)
> 
> Changelog since v1 :
> - x86_64 fixes.
> Changelog since v2 :
> - fix paravirt build
> Changelog since v3 :
> - Include modifications suggested by Jeremy
> Changelog since v4 :
> - including hardirq.h in entry_32/64.S is a bad idea (non ifndef'd C code),
>   define HARDNMI_MASK in the .S files directly.
> Changelog since v5 :
> - Add HARDNMI_MASK to irq_count() and make die() more verbose for NMIs.
> Changelog since v7 :
> - Implement paravirtualized nmi_return.
> Changelog since v8 :
> - refreshed the patch for asm-offsets. Those were left out of v8.
> - now depends on "Stringify support commas" patch.
> Changelog since v9 :
> - Only test the nmi nested preempt count flag upon return from exceptions, not
>   on return from interrupts. Only the kernel return path has this test.
> - Add Xen, VMI, lguest support. Use their iret pavavirt ops in lieu of
>   nmi_return.
> 
> -- Ported to sched-devel.git
> 
> ---
>  arch/x86/include/asm/irqflags.h |   56 +++++++++++++++++++++++++++++++++++++++
>  arch/x86/kernel/dumpstack.c     |    2 +
>  arch/x86/kernel/entry_64.S      |   57 +++++++++++++++++++++++++++++++---------
>  include/linux/hardirq.h         |   16 +++++++----
> 
> Index: linux/arch/x86/include/asm/irqflags.h
> ===================================================================
> --- linux.orig/arch/x86/include/asm/irqflags.h
> +++ linux/arch/x86/include/asm/irqflags.h
> @@ -51,6 +51,61 @@ static inline void native_halt(void)
>  
>  #endif
>  
> +#ifdef CONFIG_X86_64
> +/*
> + * Only returns from a trap or exception to a NMI context (intra-privilege
> + * level near return) to the same SS and CS segments. Should be used
> + * upon trap or exception return when nested over a NMI context so no iret is
> + * issued. It takes care of modifying the eflags, rsp and returning to the
> + * previous function.
> + *
> + * The stack, at that point, looks like :
> + *
> + * 0(rsp)  RIP
> + * 8(rsp)  CS
> + * 16(rsp) EFLAGS
> + * 24(rsp) RSP
> + * 32(rsp) SS
> + *
> + * Upon execution :
> + * Copy EIP to the top of the return stack
> + * Update top of return stack address
> + * Pop eflags into the eflags register
> + * Make the return stack current
> + * Near return (popping the return address from the return stack)
> + */
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> +						movq %rsp, %rax;	\
> +						movq 24+8(%rax), %rsp;	\
> +						pushq 0+8(%rax);	\
> +						pushq 16+8(%rax);	\
> +						movq (%rax), %rax;	\
> +						popfq;			\
> +						ret
> +#else
> +/*
> + * Protected mode only, no V8086. Implies that protected mode must
> + * be entered before NMIs or MCEs are enabled. Only returns from a trap or
> + * exception to a NMI context (intra-privilege level far return). Should be used
> + * upon trap or exception return when nested over a NMI context so no iret is
> + * issued.
> + *
> + * The stack, at that point, looks like :
> + *
> + * 0(esp) EIP
> + * 4(esp) CS
> + * 8(esp) EFLAGS
> + *
> + * Upon execution :
> + * Copy the stack eflags to top of stack
> + * Pop eflags into the eflags register
> + * Far return: pop EIP and CS into their register, and additionally pop EFLAGS.
> + */
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushl 8(%esp);	\
> +						popfl;		\
> +						lret $4
> +#endif
> +
>  #ifdef CONFIG_PARAVIRT
>  #include <asm/paravirt.h>
>  #else
> @@ -109,6 +164,7 @@ static inline unsigned long __raw_local_
>  
>  #define ENABLE_INTERRUPTS(x)	sti
>  #define DISABLE_INTERRUPTS(x)	cli
> +#define INTERRUPT_RETURN_NMI_SAFE	NATIVE_INTERRUPT_RETURN_NMI_SAFE
>  
>  #ifdef CONFIG_X86_64
>  #define SWAPGS	swapgs
> Index: linux/arch/x86/kernel/dumpstack.c
> ===================================================================
> --- linux.orig/arch/x86/kernel/dumpstack.c
> +++ linux/arch/x86/kernel/dumpstack.c
> @@ -237,6 +237,8 @@ void __kprobes oops_end(unsigned long fl
>  
>  	if (!signr)
>  		return;
> +	if (in_nmi())
> +		panic("Fatal exception in non-maskable interrupt");
>  	if (in_interrupt())
>  		panic("Fatal exception in interrupt");
>  	if (panic_on_oops)
> Index: linux/arch/x86/kernel/entry_64.S
> ===================================================================
> --- linux.orig/arch/x86/kernel/entry_64.S
> +++ linux/arch/x86/kernel/entry_64.S
> @@ -53,6 +53,7 @@
>  #include <asm/paravirt.h>
>  #include <asm/ftrace.h>
>  #include <asm/percpu.h>
> +#include <linux/hardirq.h>
>  
>  /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
>  #include <linux/elf-em.h>
> @@ -875,6 +876,9 @@ ENTRY(native_iret)
>  	.section __ex_table,"a"
>  	.quad native_iret, bad_iret
>  	.previous
> +
> +ENTRY(native_nmi_return)
> +	NATIVE_INTERRUPT_RETURN_NMI_SAFE
>  #endif
>  
>  	.section .fixup,"ax"
> @@ -929,6 +933,23 @@ retint_signal:
>  	GET_THREAD_INFO(%rcx)
>  	jmp retint_with_reschedule
>  
> +	/* Returning to kernel space from exception. */
> +	/* rcx:	 threadinfo. interrupts off. */
> +ENTRY(retexc_kernel)
> +	testl $NMI_MASK, TI_preempt_count(%rcx)
> +	jz retint_kernel		/* Not nested over NMI ? */
> +	testw $X86_EFLAGS_TF, EFLAGS-ARGOFFSET(%rsp)	/* trap flag? */
> +	jnz retint_kernel		/*
> +					 * If single-stepping an NMI handler,
> +					 * use the normal iret path instead of
> +					 * the popf/lret because lret would be
> +					 * single-stepped. It should not
> +					 * happen : it will reactivate NMIs
> +					 * prematurely.
> +					 */
> +	RESTORE_ARGS 0, 8, 0
> +	INTERRUPT_RETURN_NMI_SAFE
> +
>  #ifdef CONFIG_PREEMPT
>  	/* Returning to kernel space. Check if we need preemption */
>  	/* rcx:	 threadinfo. interrupts off. */
> @@ -1407,34 +1428,46 @@ ENTRY(paranoid_exit)
>  	INTR_FRAME
>  	DISABLE_INTERRUPTS(CLBR_NONE)
>  	TRACE_IRQS_OFF
> -	testl %ebx,%ebx				/* swapgs needed? */
> +	testl %ebx, %ebx			/* swapgs needed? */
>  	jnz paranoid_restore
> -	testl $3,CS(%rsp)
> +
> +	testl $3, CS(%rsp)
>  	jnz   paranoid_userspace
> +
>  paranoid_swapgs:
>  	TRACE_IRQS_IRETQ 0
>  	SWAPGS_UNSAFE_STACK
>  	RESTORE_ALL 8
>  	jmp irq_return
> -paranoid_restore:
> +paranoid_restore_no_nmi:
>  	TRACE_IRQS_IRETQ 0
>  	RESTORE_ALL 8
>  	jmp irq_return
> +paranoid_restore:
> +	GET_THREAD_INFO(%rcx)
> +	testl $NMI_MASK, TI_preempt_count(%rcx)
> +	jz paranoid_restore_no_nmi		/* Nested over NMI ? */
> +
> +	testw $X86_EFLAGS_TF, EFLAGS-0(%rsp)	/* trap flag? */
> +	jnz paranoid_restore_no_nmi
> +	RESTORE_ALL 8
> +	INTERRUPT_RETURN_NMI_SAFE
> +
>  paranoid_userspace:
>  	GET_THREAD_INFO(%rcx)
> -	movl TI_flags(%rcx),%ebx
> -	andl $_TIF_WORK_MASK,%ebx
> +	movl TI_flags(%rcx), %ebx
> +	andl $_TIF_WORK_MASK, %ebx
>  	jz paranoid_swapgs
> -	movq %rsp,%rdi			/* &pt_regs */
> +	movq %rsp, %rdi				/* &pt_regs */
>  	call sync_regs
> -	movq %rax,%rsp			/* switch stack for scheduling */
> -	testl $_TIF_NEED_RESCHED,%ebx
> +	movq %rax, %rsp				/* switch stack for scheduling */
> +	testl $_TIF_NEED_RESCHED, %ebx
>  	jnz paranoid_schedule
> -	movl %ebx,%edx			/* arg3: thread flags */
> +	movl %ebx, %edx				/* arg3: thread flags */
>  	TRACE_IRQS_ON
>  	ENABLE_INTERRUPTS(CLBR_NONE)
> -	xorl %esi,%esi 			/* arg2: oldset */
> -	movq %rsp,%rdi 			/* arg1: &pt_regs */
> +	xorl %esi, %esi				/* arg2: oldset */
> +	movq %rsp, %rdi				/* arg1: &pt_regs */
>  	call do_notify_resume
>  	DISABLE_INTERRUPTS(CLBR_NONE)
>  	TRACE_IRQS_OFF
> @@ -1513,7 +1546,7 @@ ENTRY(error_exit)
>  	TRACE_IRQS_OFF
>  	GET_THREAD_INFO(%rcx)
>  	testl %eax,%eax
> -	jne retint_kernel
> +	jne  retexc_kernel
>  	LOCKDEP_SYS_EXIT_IRQ
>  	movl TI_flags(%rcx),%edx
>  	movl $_TIF_WORK_MASK,%edi
> Index: linux/include/linux/hardirq.h
> ===================================================================
> --- linux.orig/include/linux/hardirq.h
> +++ linux/include/linux/hardirq.h
> @@ -1,12 +1,14 @@
>  #ifndef LINUX_HARDIRQ_H
>  #define LINUX_HARDIRQ_H
>  
> +#ifndef __ASSEMBLY__
>  #include <linux/preempt.h>
>  #include <linux/smp_lock.h>
>  #include <linux/lockdep.h>
>  #include <linux/ftrace_irq.h>
>  #include <asm/hardirq.h>
>  #include <asm/system.h>
> +#endif
>  
>  /*
>   * We put the hardirq and softirq counter into the preemption
> @@ -50,17 +52,17 @@
>  #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
>  #define NMI_SHIFT	(HARDIRQ_SHIFT + HARDIRQ_BITS)
>  
> -#define __IRQ_MASK(x)	((1UL << (x))-1)
> +#define __IRQ_MASK(x)	((1 << (x))-1)
>  
>  #define PREEMPT_MASK	(__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
>  #define SOFTIRQ_MASK	(__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
>  #define HARDIRQ_MASK	(__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
>  #define NMI_MASK	(__IRQ_MASK(NMI_BITS)     << NMI_SHIFT)
>  
> -#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
> -#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
> -#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
> -#define NMI_OFFSET	(1UL << NMI_SHIFT)
> +#define PREEMPT_OFFSET	(1 << PREEMPT_SHIFT)
> +#define SOFTIRQ_OFFSET	(1 << SOFTIRQ_SHIFT)
> +#define HARDIRQ_OFFSET	(1 << HARDIRQ_SHIFT)
> +#define NMI_OFFSET	(1 << NMI_SHIFT)
>  
>  #if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
>  #error PREEMPT_ACTIVE is too low!
> @@ -116,6 +118,8 @@
>  # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
>  #endif
>  
> +#ifndef __ASSEMBLY__
> +
>  #if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
>  extern void synchronize_irq(unsigned int irq);
>  #else
> @@ -195,4 +199,6 @@ extern void irq_exit(void);
>  		ftrace_nmi_exit();				\
>  	} while (0)
>  
> +#endif /* !__ASSEMBLY__ */
> +
>  #endif /* LINUX_HARDIRQ_H */
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:42                             ` Mathieu Desnoyers
@ 2009-06-15 18:47                               ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:47 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> > If it's a slowdown then the decision is easy: we dont want this, 
> > we want to push the overhead into the sampling code, away from 
> > common codepaths.
> 
> I did not try to make the "hand unroll + ret" the default. I 
> therefore don't know if it is faster or slower than iret. But I 
> prefered to stay on the safe side and only modify the exceptions 
> nested within NMI handlers.

hm, i misread that bit then. Too bad.

Btw., that speedup question is still valid. (Just not relevant here 
and now.)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:38                       ` H. Peter Anvin
@ 2009-06-15 18:48                         ` Mathieu Desnoyers
  2009-06-15 18:51                           ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:48 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Linus Torvalds, Ingo Molnar, mingo, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Linus Torvalds wrote:
> > 
> > On Mon, 15 Jun 2009, Ingo Molnar wrote:
> >> A simple cr2 corruption would explain all those cc1 SIGSEGVs and 
> >> other user-space crashes i saw, with sufficiently intense sampling - 
> >> easily.
> > 
> > Note that we could work around the %cr2 issue, since any corruption is 
> > always nicely "nested" (ie there are never any SMP issues with async 
> > writes to the register).
> > 
> > So what we _could_ do is to have a magic value for %cr2, along with a "NMI 
> > sequence count", and if we see that value, we just return (without doing 
> > anything) from the page fault handler.
> > 
> 
> Wouldn't it be simpler to just require the NMI handler to save and
> restore %cr2 around any potentially faulting references?
> 
> 	-hpa

If we require that around the whole NMI handler execution, then we get
all vmalloc + module text code references handled for free. This would
be a nice-to-have.a And given nmi-handler is not such a frequent code
path, we should not care that much about the performance hit of
saving/restoring the cr2 register at each nmi entry/exit.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:38                           ` Mathieu Desnoyers
@ 2009-06-15 18:50                             ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 18:50 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> I guess. However, having the ability to call module code in NMI 
> handler context [...]

I dont think we really want to execute module-provided code from NMI 
handlers. NMI context is pretty tricky to begin with. (Yes, i know 
it's possible via nmi notifiers or modular oprofile but it's a 
really bad practice IMHO.)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:28                           ` Ingo Molnar
  2009-06-15 18:42                             ` Mathieu Desnoyers
@ 2009-06-15 18:51                             ` Linus Torvalds
  2009-06-15 19:16                               ` Mathieu Desnoyers
  1 sibling, 1 reply; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 18:51 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits



On Mon, 15 Jun 2009, Ingo Molnar wrote:
> 
> [ If on the other hand it's a speedup of a few cycles then we have 
>   the problem of me suddenly liking this patch a whole lot more ;-) ]

I missed the patch.

It's quite possible that replacing "iret" with a regular "ret" (for the 
kernel->kernel transition) is a real speedup. That said, there's a few 
things to think about:

 - CPU return stack caches/predictors. I suspect that "iret" and 
   exceptions don't generally touch them (but who knows - maybe they do), 
   while a regular "ret" definitely does. I dunno about "retf".

   This can cause very subtle performance slowdowns, where the slowdown 
   happens somewhere else. And it could be _very_ uarch-dependent (ie only 
   happen on some architectures, while having no performance downside on 
   others)

 - kernel->kernel exceptions _should_ be rare, with the exception of 
   actual real external interrupts. So the path to optimize should always 
   be the user-space exception path. That one will need 'iret', but I'd 
   also not want to see more testing in that hot-path. I suspect we 
   already always test for user-mode anyway (due to signal handling etc 
   work), but if it adds new tests to that path, any kernel->kernel 
   speedup is likely totally pointless.

That said, it would be nice to avoid 'iret' if only because of its subtle 
interactions with the while NMI flag.

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:48                         ` Mathieu Desnoyers
@ 2009-06-15 18:51                           ` Peter Zijlstra
  2009-06-15 18:59                             ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-15 18:51 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: H. Peter Anvin, Linus Torvalds, Ingo Molnar, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
> we should not care that much about the performance hit of
> saving/restoring the cr2 register at each nmi entry/exit.

But we do, perf counters very much cares about nmi performance.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:45                             ` Ingo Molnar
@ 2009-06-15 18:55                               ` H. Peter Anvin
  2009-06-15 19:02                                 ` Avi Kivity
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 18:55 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

Ingo Molnar wrote:
>>>
>> I wouldn't actually expect that, *as long as* there is 
>> serialization between the cr2 write and the cr2 read.
> 
> Well, is there any OS that heavily relies on cr2 writes and which 
> uses them from NMI context, and which CPU makers care about? 
> (Meaning: Windows, pretty much.)
> 
> If not then i agree that in theory it should work fine, but in 
> practice we only know that we dont know the unknown risk here ;-)
> 

I think you can drop "uses them from NMI context" from that statement;
writing to %cr2 is independent of the context.

I can try to find out internally what Intel's position on writing %cr2
is, but it'll take a while; however, KVM should be able to tell you if
any random OS uses %cr2 writes (as should a static disassembly of their
kernel.)

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:51                           ` Peter Zijlstra
@ 2009-06-15 18:59                             ` Mathieu Desnoyers
  2009-06-15 19:02                               ` Peter Zijlstra
  2009-06-15 19:03                               ` Ingo Molnar
  0 siblings, 2 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 18:59 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: H. Peter Anvin, Linus Torvalds, Ingo Molnar, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
> > we should not care that much about the performance hit of
> > saving/restoring the cr2 register at each nmi entry/exit.
> 
> But we do, perf counters very much cares about nmi performance.
> 

To a point where it cannot afford a simple register save/restore ?

There is "caring" and "_caring_". I am tempted to ask what NMI handler
execution frequency you have in mind here to figure out if we are not
trying to optimize sub-nanoseconds per minutes. ;)

Mathieu


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:59                             ` Mathieu Desnoyers
@ 2009-06-15 19:02                               ` Peter Zijlstra
  2009-06-15 19:11                                 ` H. Peter Anvin
  2009-06-15 19:16                                 ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods Avi Kivity
  2009-06-15 19:03                               ` Ingo Molnar
  1 sibling, 2 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-15 19:02 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: H. Peter Anvin, Linus Torvalds, Ingo Molnar, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

On Mon, 2009-06-15 at 14:59 -0400, Mathieu Desnoyers wrote:
> * Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> > On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
> > > we should not care that much about the performance hit of
> > > saving/restoring the cr2 register at each nmi entry/exit.
> > 
> > But we do, perf counters very much cares about nmi performance.
> > 
> 
> To a point where it cannot afford a simple register save/restore ?
> 
> There is "caring" and "_caring_". I am tempted to ask what NMI handler
> execution frequency you have in mind here to figure out if we are not
> trying to optimize sub-nanoseconds per minutes. ;)

Ah, well, I have no idea who expensive cr2 is, if its like a regular
register then it should be fine. If however its tons more expensive then
we should really avoid it.

As to the freq, 100kHz would be nice ;-)


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:55                               ` H. Peter Anvin
@ 2009-06-15 19:02                                 ` Avi Kivity
  2009-06-16  8:36                                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Avi Kivity @ 2009-06-15 19:02 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Mathieu Desnoyers, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

On 06/15/2009 09:55 PM, H. Peter Anvin wrote:
> Ingo Molnar wrote:
>    
>>> I wouldn't actually expect that, *as long as* there is
>>> serialization between the cr2 write and the cr2 read.
>>>        
>> Well, is there any OS that heavily relies on cr2 writes and which
>> uses them from NMI context, and which CPU makers care about?
>> (Meaning: Windows, pretty much.)
>>
>> If not then i agree that in theory it should work fine, but in
>> practice we only know that we dont know the unknown risk here ;-)
>>
>>      
>
> I think you can drop "uses them from NMI context" from that statement;
> writing to %cr2 is independent of the context.
>
> I can try to find out internally what Intel's position on writing %cr2
> is, but it'll take a while; however, KVM should be able to tell you if
> any random OS uses %cr2 writes (as should a static disassembly of their
> kernel.)
>    

Linux is one such OS.  When acting as a hypervisor it writes cr2 to 
present its guests with their expected environment (any hypervisor that 
uses virtualization extensions will of course need to do this).


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:59                             ` Mathieu Desnoyers
  2009-06-15 19:02                               ` Peter Zijlstra
@ 2009-06-15 19:03                               ` Ingo Molnar
  2009-06-15 19:07                                 ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 19:03 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Peter Zijlstra, H. Peter Anvin, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> > On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
> > > we should not care that much about the performance hit of
> > > saving/restoring the cr2 register at each nmi entry/exit.
> > 
> > But we do, perf counters very much cares about nmi performance.
> > 
> 
> To a point where it cannot afford a simple register save/restore ?
> 
> There is "caring" and "_caring_". I am tempted to ask what NMI 
> handler execution frequency you have in mind here to figure out if 
> we are not trying to optimize sub-nanoseconds per minutes. ;)

I routinely run 'perf' with half a million NMIs per second or more. 
( Why wait 10 seconds for a profile you can get in 1 second? ;-)

Granted that is over multiple CPUs - but still performance does 
matter here too.

Reading cr2 is certainly fast. Writing it - dunno.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:36                           ` Ingo Molnar
  2009-06-15 18:46                             ` Mathieu Desnoyers
@ 2009-06-15 19:04                             ` Linus Torvalds
  2009-06-15 19:39                               ` Mathieu Desnoyers
                                                 ` (2 more replies)
  1 sibling, 3 replies; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 19:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits



On Mon, 15 Jun 2009, Ingo Molnar wrote:
> 
> The gist of it is the replacement of iret with this open-coded 
> sequence:
> 
> +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> +						movq %rsp, %rax;	\
> +						movq 24+8(%rax), %rsp;	\
> +						pushq 0+8(%rax);	\
> +						pushq 16+8(%rax);	\
> +						movq (%rax), %rax;	\
> +						popfq;			\
> +						ret

That's an odd way of writing it.

Don't we have a per-cpu segment here? I'd much rather just see it do 
something like this (_before_ restoring the regular registers)

	movq EIP(%esp),%rax
	movq ESP(%esp),%rdx
	movq %rax,gs:saved_esp
	movq %rdx,gs:saved_eip

	# restore regular regs
	RESTORE_ALL

	# skip eip/esp to get at eflags
	addl $16,%esp
	popfq

	# restore rsp/rip
	movq gs:saved_esp,%rsp
	jmpq *(gs:saved_eip)

but I haven't thought deeply about it. Maybe there's something wrong with 
the above.

> If it's faster, this becomes a legit (albeit complex) 
> micro-optimization in a _very_ hot codepath.

I don't think it's all that hot. It's not like it's the return to user 
mode.

			Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:03                               ` Ingo Molnar
@ 2009-06-15 19:07                                 ` Ingo Molnar
  2009-06-15 19:10                                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 19:07 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Peter Zijlstra, H. Peter Anvin, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> > To a point where it cannot afford a simple register save/restore 
> > ?
> > 
> > There is "caring" and "_caring_". I am tempted to ask what NMI 
> > handler execution frequency you have in mind here to figure out 
> > if we are not trying to optimize sub-nanoseconds per minutes. ;)
> 
> I routinely run 'perf' with half a million NMIs per second or 
> more. ( Why wait 10 seconds for a profile you can get in 1 second? 
> ;-)
> 
> Granted that is over multiple CPUs - but still performance does 
> matter here too.
> 
> Reading cr2 is certainly fast. Writing it - dunno.

But one thing is sure: it is certainly going to be faster than the 
INVLPG(s!) we have to do with the GUP solution.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:07                                 ` Ingo Molnar
@ 2009-06-15 19:10                                   ` Peter Zijlstra
  2009-06-15 19:21                                     ` Avi Kivity
  2009-06-15 19:59                                     ` Ingo Molnar
  0 siblings, 2 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-15 19:10 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, H. Peter Anvin, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits

On Mon, 2009-06-15 at 21:07 +0200, Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > > To a point where it cannot afford a simple register save/restore 
> > > ?
> > > 
> > > There is "caring" and "_caring_". I am tempted to ask what NMI 
> > > handler execution frequency you have in mind here to figure out 
> > > if we are not trying to optimize sub-nanoseconds per minutes. ;)
> > 
> > I routinely run 'perf' with half a million NMIs per second or 
> > more. ( Why wait 10 seconds for a profile you can get in 1 second? 
> > ;-)
> > 
> > Granted that is over multiple CPUs - but still performance does 
> > matter here too.
> > 
> > Reading cr2 is certainly fast. Writing it - dunno.
> 
> But one thing is sure: it is certainly going to be faster than the 
> INVLPG(s!) we have to do with the GUP solution.

Sure, but we only pay that price when we do the callchain bit, not on
every NMI.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:02                               ` Peter Zijlstra
@ 2009-06-15 19:11                                 ` H. Peter Anvin
  2009-06-15 19:27                                   ` Mathieu Desnoyers
  2009-06-15 19:16                                 ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods Avi Kivity
  1 sibling, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 19:11 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Mathieu Desnoyers, Linus Torvalds, Ingo Molnar, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits

Peter Zijlstra wrote:
> On Mon, 2009-06-15 at 14:59 -0400, Mathieu Desnoyers wrote:
>> * Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
>>> On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
>>>> we should not care that much about the performance hit of
>>>> saving/restoring the cr2 register at each nmi entry/exit.
>>> But we do, perf counters very much cares about nmi performance.
>>>
>> To a point where it cannot afford a simple register save/restore ?
>>
>> There is "caring" and "_caring_". I am tempted to ask what NMI handler
>> execution frequency you have in mind here to figure out if we are not
>> trying to optimize sub-nanoseconds per minutes. ;)
> 
> Ah, well, I have no idea who expensive cr2 is, if its like a regular
> register then it should be fine. If however its tons more expensive then
> we should really avoid it.
> 
> As to the freq, 100kHz would be nice ;-)
> 

Writing control registers is serializing, so it's a lot more expensive
than writing a normal register; my *guess* is that it will be on the
order of 100-200 cycles.

That is not based on any actual information.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:02                               ` Peter Zijlstra
  2009-06-15 19:11                                 ` H. Peter Anvin
@ 2009-06-15 19:16                                 ` Avi Kivity
  2009-06-15 19:18                                   ` H. Peter Anvin
  1 sibling, 1 reply; 1149+ messages in thread
From: Avi Kivity @ 2009-06-15 19:16 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Mathieu Desnoyers, H. Peter Anvin, Linus Torvalds, Ingo Molnar,
	mingo, paulus, acme, linux-kernel, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

On 06/15/2009 10:02 PM, Peter Zijlstra wrote:
> Ah, well, I have no idea who expensive cr2 is, if its like a regular
> register then it should be fine. If however its tons more expensive then
> we should really avoid it.
>
>    

IIRC it's pretty cheap, I measured it once when tuning the kvm context 
switch code.  I don't recall the exact numbers.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 18:51                             ` Linus Torvalds
@ 2009-06-15 19:16                               ` Mathieu Desnoyers
  0 siblings, 0 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 19:16 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra,
	penberg, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits

* Linus Torvalds (torvalds@linux-foundation.org) wrote:
> 
> 
> On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > 
> > [ If on the other hand it's a speedup of a few cycles then we have 
> >   the problem of me suddenly liking this patch a whole lot more ;-) ]
> 
> I missed the patch.
> 
> It's quite possible that replacing "iret" with a regular "ret" (for the 
> kernel->kernel transition) is a real speedup. That said, there's a few 
> things to think about:
> 
>  - CPU return stack caches/predictors. I suspect that "iret" and 
>    exceptions don't generally touch them (but who knows - maybe they do), 
>    while a regular "ret" definitely does. I dunno about "retf".
> 

Also, I don't think popf acts as a serializing instruction. (reading the
Intel Architecture Software Developer's Manual, vol 3 System programming
section 7.4 Serializing Instructions). And ret clearly doesn't.
Therefore I'd be worried of iret serialization assumptions which could
be done within the kernel code. Maybe it would be safer to add a cpuid
or mfence instruction in there to ensure correct core serialization.

This would turn the hand-made iret into a :

popf
mfence
ret

Or something like that.

Mathieu


>    This can cause very subtle performance slowdowns, where the slowdown 
>    happens somewhere else. And it could be _very_ uarch-dependent (ie only 
>    happen on some architectures, while having no performance downside on 
>    others)
> 
>  - kernel->kernel exceptions _should_ be rare, with the exception of 
>    actual real external interrupts. So the path to optimize should always 
>    be the user-space exception path. That one will need 'iret', but I'd 
>    also not want to see more testing in that hot-path. I suspect we 
>    already always test for user-mode anyway (due to signal handling etc 
>    work), but if it adds new tests to that path, any kernel->kernel 
>    speedup is likely totally pointless.
> 
> That said, it would be nice to avoid 'iret' if only because of its subtle 
> interactions with the while NMI flag.
> 
> 		Linus

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:16                                 ` [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods Avi Kivity
@ 2009-06-15 19:18                                   ` H. Peter Anvin
  0 siblings, 0 replies; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 19:18 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Peter Zijlstra, Mathieu Desnoyers, Linus Torvalds, Ingo Molnar,
	mingo, paulus, acme, linux-kernel, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

Avi Kivity wrote:
> On 06/15/2009 10:02 PM, Peter Zijlstra wrote:
>> Ah, well, I have no idea who expensive cr2 is, if its like a regular
>> register then it should be fine. If however its tons more expensive then
>> we should really avoid it.
> 
> IIRC it's pretty cheap, I measured it once when tuning the kvm context 
> switch code.  I don't recall the exact numbers.
> 

Sounds like a win to me.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:10                                   ` Peter Zijlstra
@ 2009-06-15 19:21                                     ` Avi Kivity
  2009-06-15 20:18                                       ` Jeremy Fitzhardinge
  2009-06-15 19:59                                     ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Avi Kivity @ 2009-06-15 19:21 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Mathieu Desnoyers, H. Peter Anvin, Linus Torvalds,
	mingo, paulus, acme, linux-kernel, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

On 06/15/2009 10:10 PM, Peter Zijlstra wrote:
>> But one thing is sure: it is certainly going to be faster than the
>> INVLPG(s!) we have to do with the GUP solution.
>>      
>
> Sure, but we only pay that price when we do the callchain bit, not on
> every NMI.
>    

You can read cr2 on nmi entry and nmi exit, and only write it if it has 
changed (if it turns out that writing cr2 is expensive; ISTR that it isn't).

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:11                                 ` H. Peter Anvin
@ 2009-06-15 19:27                                   ` Mathieu Desnoyers
  2009-06-15 19:32                                     ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 19:27 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Peter Zijlstra, Linus Torvalds, Ingo Molnar, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Peter Zijlstra wrote:
> > On Mon, 2009-06-15 at 14:59 -0400, Mathieu Desnoyers wrote:
> >> * Peter Zijlstra (a.p.zijlstra@chello.nl) wrote:
> >>> On Mon, 2009-06-15 at 14:48 -0400, Mathieu Desnoyers wrote:
> >>>> we should not care that much about the performance hit of
> >>>> saving/restoring the cr2 register at each nmi entry/exit.
> >>> But we do, perf counters very much cares about nmi performance.
> >>>
> >> To a point where it cannot afford a simple register save/restore ?
> >>
> >> There is "caring" and "_caring_". I am tempted to ask what NMI handler
> >> execution frequency you have in mind here to figure out if we are not
> >> trying to optimize sub-nanoseconds per minutes. ;)
> > 
> > Ah, well, I have no idea who expensive cr2 is, if its like a regular
> > register then it should be fine. If however its tons more expensive then
> > we should really avoid it.
> > 
> > As to the freq, 100kHz would be nice ;-)
> > 
> 
> Writing control registers is serializing, so it's a lot more expensive
> than writing a normal register; my *guess* is that it will be on the
> order of 100-200 cycles.
> 
> That is not based on any actual information.
> 

Then how about just writing to the cr2 register *if* it has changed
while the NMI handler was running ?

if (unlikely(read_cr2() != saved_cr2)))
	write_cr2(saved_cr2)

Mathieu

> 	-hpa
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:27                                   ` Mathieu Desnoyers
@ 2009-06-15 19:32                                     ` H. Peter Anvin
  2009-06-15 21:01                                       ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 19:32 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Peter Zijlstra, Linus Torvalds, Ingo Molnar, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
>>>
>> Writing control registers is serializing, so it's a lot more expensive
>> than writing a normal register; my *guess* is that it will be on the
>> order of 100-200 cycles.
>>
>> That is not based on any actual information.
>>
> 
> Then how about just writing to the cr2 register *if* it has changed
> while the NMI handler was running ?
> 
> if (unlikely(read_cr2() != saved_cr2)))
> 	write_cr2(saved_cr2)
> 
> Mathieu
> 

That works fine, obviously, and although it's probably overkill it's
also a trivially cheap optimization.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:04                             ` Linus Torvalds
@ 2009-06-15 19:39                               ` Mathieu Desnoyers
  2009-06-15 19:43                               ` Ingo Molnar
  2009-06-15 20:14                               ` Jeremy Fitzhardinge
  2 siblings, 0 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 19:39 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra,
	penberg, vegard.nossum, efault, jeremy, npiggin, tglx,
	linux-tip-commits

* Linus Torvalds (torvalds@linux-foundation.org) wrote:
> 
> 
> On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > 
> > The gist of it is the replacement of iret with this open-coded 
> > sequence:
> > 
> > +#define NATIVE_INTERRUPT_RETURN_NMI_SAFE	pushq %rax;		\
> > +						movq %rsp, %rax;	\
> > +						movq 24+8(%rax), %rsp;	\
> > +						pushq 0+8(%rax);	\
> > +						pushq 16+8(%rax);	\
> > +						movq (%rax), %rax;	\
> > +						popfq;			\
> > +						ret
> 
> That's an odd way of writing it.
> 

There were a few reasons (maybe not all good) for writing it like this :

- Saving I$ (as it is placed close to hot entry.S code paths)
- Staying localized with the top of stack, saving D$ accesses.

But maybe benchmarks will prove my approach overkill, dunno. Also we 
have to be aware that the CPU might behave more slowly in the presence
of unbalanced int/iret, call/ret. I think we should benchmark your 
approach to make sure jmp will not produce such slowdown. But it might
well be faster, and it's definitely clearer.

Thanks,

Mathieu


> Don't we have a per-cpu segment here? I'd much rather just see it do 
> something like this (_before_ restoring the regular registers)
> 
> 	movq EIP(%esp),%rax
> 	movq ESP(%esp),%rdx
> 	movq %rax,gs:saved_esp
> 	movq %rdx,gs:saved_eip
> 
> 	# restore regular regs
> 	RESTORE_ALL
> 
> 	# skip eip/esp to get at eflags
> 	addl $16,%esp
> 	popfq
> 
> 	# restore rsp/rip
> 	movq gs:saved_esp,%rsp
> 	jmpq *(gs:saved_eip)
> 
> but I haven't thought deeply about it. Maybe there's something wrong with 
> the above.
> 
> > If it's faster, this becomes a legit (albeit complex) 
> > micro-optimization in a _very_ hot codepath.
> 
> I don't think it's all that hot. It's not like it's the return to user 
> mode.
> 
> 			Linus

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:04                             ` Linus Torvalds
  2009-06-15 19:39                               ` Mathieu Desnoyers
@ 2009-06-15 19:43                               ` Ingo Molnar
  2009-06-15 19:51                                 ` Mathieu Desnoyers
                                                   ` (3 more replies)
  2009-06-15 20:14                               ` Jeremy Fitzhardinge
  2 siblings, 4 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 19:43 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> > If it's faster, this becomes a legit (albeit complex) 
> > micro-optimization in a _very_ hot codepath.
> 
> I don't think it's all that hot. It's not like it's the return to 
> user mode.

Well i guess it depends. For server apps it is true - syscalls are a 
lot more dominant, MMs are long-running so any startup cost gets 
amortized and pagefaults are avoided.

For something like a kernel build we have 7 times as many pagefaults 
as syscalls:

aldebaran:~/linux/linux> perf stat -- make -j32 >/dev/null
[...]
 Performance counter stats for 'make -j32':

 1444281.076741  task-clock-msecs     #     14.429 CPUs 
         219991  context-switches     #      0.000 M/sec
          18335  CPU-migrations       #      0.000 M/sec
       38465628  page-faults          #      0.027 M/sec
  4374762924204  cycles               #   3029.025 M/sec
  2645979309823  instructions         #      0.605 IPC  
    42398991227  cache-references     #     29.356 M/sec
     4371920878  cache-misses         #      3.027 M/sec

  100.097787566  seconds time elapsed.

So we have 38465628 page-faults, or one every 68788 instructions, 
one every 113731 cycles.

10 cycles saved in the page fault costs means 0.01% performance win 
- or about 10 milliseconds shaven off the kernel build time.
 
100 cycles saved (which is impossible really in the entry/exit path) 
would mean 0.1% win.

5653639 syscalls (according to strace -c) - which is a factor of 6.8 
lower. Same goes for shell scripts or most of the clicking we do on 
a GUI.

It's not a big factor for sure.

Btw., the biggest pagefault cost is in the fault handling itself 
(the page clearing):

      4.14%  [k] do_page_fault
      1.20%  [k] sys_write
      1.10%  [k] sys_open
      0.63%  [k] sys_exit_group
      0.48%  [k] smp_apic_timer_interrupt
      0.37%  [k] sys_read
      0.37%  [k] sys_execve
      0.20%  [k] sys_mmap
      0.18%  [k] sys_close
      0.14%  [k] sys_munmap
      0.13%  [k] sys_poll
      0.09%  [k] sys_newstat
      0.07%  [k] sys_clone
      0.06%  [k] sys_newfstat

it totals to 4.14% of the total cost (user-space cycles included) of 
a kernel build, on a Nehalem box.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:43                               ` Ingo Molnar
@ 2009-06-15 19:51                                 ` Mathieu Desnoyers
  2009-06-15 19:55                                 ` Ingo Molnar
                                                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 19:51 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > > If it's faster, this becomes a legit (albeit complex) 
> > > micro-optimization in a _very_ hot codepath.
> > 
> > I don't think it's all that hot. It's not like it's the return to 
> > user mode.
> 
> Well i guess it depends. For server apps it is true - syscalls are a 
> lot more dominant, MMs are long-running so any startup cost gets 
> amortized and pagefaults are avoided.
> 
> For something like a kernel build we have 7 times as many pagefaults 
> as syscalls:
> 
> aldebaran:~/linux/linux> perf stat -- make -j32 >/dev/null
> [...]
>  Performance counter stats for 'make -j32':
> 
>  1444281.076741  task-clock-msecs     #     14.429 CPUs 
>          219991  context-switches     #      0.000 M/sec
>           18335  CPU-migrations       #      0.000 M/sec
>        38465628  page-faults          #      0.027 M/sec
>   4374762924204  cycles               #   3029.025 M/sec
>   2645979309823  instructions         #      0.605 IPC  
>     42398991227  cache-references     #     29.356 M/sec
>      4371920878  cache-misses         #      3.027 M/sec
> 
>   100.097787566  seconds time elapsed.
> 
> So we have 38465628 page-faults, or one every 68788 instructions, 
> one every 113731 cycles.
> 
> 10 cycles saved in the page fault costs means 0.01% performance win 
> - or about 10 milliseconds shaven off the kernel build time.
>  
> 100 cycles saved (which is impossible really in the entry/exit path) 
> would mean 0.1% win.
> 
> 5653639 syscalls (according to strace -c) - which is a factor of 6.8 
> lower. Same goes for shell scripts or most of the clicking we do on 
> a GUI.
> 
> It's not a big factor for sure.
> 
> Btw., the biggest pagefault cost is in the fault handling itself 
> (the page clearing):
> 
>       4.14%  [k] do_page_fault
>       1.20%  [k] sys_write
>       1.10%  [k] sys_open
>       0.63%  [k] sys_exit_group
>       0.48%  [k] smp_apic_timer_interrupt
>       0.37%  [k] sys_read
>       0.37%  [k] sys_execve
>       0.20%  [k] sys_mmap
>       0.18%  [k] sys_close
>       0.14%  [k] sys_munmap
>       0.13%  [k] sys_poll
>       0.09%  [k] sys_newstat
>       0.07%  [k] sys_clone
>       0.06%  [k] sys_newfstat
> 
> it totals to 4.14% of the total cost (user-space cycles included) of 
> a kernel build, on a Nehalem box.
> 

Yes, page faults caused by COW of short-lived processes and faulting-in
execs and libraries account for an insane portion of the build time. :-/

Mathieu

> 	Ingo

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:43                               ` Ingo Molnar
  2009-06-15 19:51                                 ` Mathieu Desnoyers
@ 2009-06-15 19:55                                 ` Ingo Molnar
  2009-06-15 20:25                                   ` Ingo Molnar
  2009-06-15 20:04                                 ` Linus Torvalds
  2009-06-15 20:06                                 ` Mathieu Desnoyers
  3 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 19:55 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


btw., here's the cost analysis of cr2 reading and writing (in a 
tight loop). I've executed cr2 read+write instructions 1 billion 
times on a Nehalem box:

static long cr2_test(void)
{
	unsigned long tmp = 0;
	int i;

	for (i = 0; i < 1000000000; i++)
		asm("movq %0, %%cr2; movq %%cr2, %0" : : "r" (tmp));

	return 0;
}

Which gave these overall stats:

 Performance counter stats for './prctl 0 0':

   28414.696319  task-clock-msecs     #      0.997 CPUs 
              3  context-switches     #      0.000 M/sec
              1  CPU-migrations       #      0.000 M/sec
            149  page-faults          #      0.000 M/sec
    87254432334  cycles               #   3070.750 M/sec
     5078691161  instructions         #      0.058 IPC  
         304144  cache-references     #      0.011 M/sec
          28760  cache-misses         #      0.001 M/sec

   28.501962853  seconds time elapsed.

87254432334/1000000000 ~== 87, so we have 87 cycles cost per 
iteration.

The annotated output shows:

 aldebaran:~> perf annotate sys_prctl | grep -A 2 cr2

    0.42 :	ffffffff81053131:	0f 22 d1             	mov    %rcx,%cr2
   96.56 :	ffffffff81053134:	0f 20 d1             	mov    %cr2,%rcx
    3.02 :	ffffffff81053137:	ff c0                	inc    %eax
    0.00 :	ffffffff81053139:	39 d0                	cmp    %edx,%eax

the read/write cost ratio is 3%:96.5% (with skidding taken into 
account), that suggests that the reading cost of cr2 is about 2-3 
cycles, the writing cost is about 85 cycles.

Which makes sense - reading cr2 is in the pagefault critical path, 
so that's optimized. Writing it is allowed but not optimized at all. 
(especially in such a tight loop where it could easily have some 
back-to-back additional latency that would not be there in an NMI 
handler save/restore path which has other instructions inbetween.)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:10                                   ` Peter Zijlstra
  2009-06-15 19:21                                     ` Avi Kivity
@ 2009-06-15 19:59                                     ` Ingo Molnar
  1 sibling, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 19:59 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Mathieu Desnoyers, H. Peter Anvin, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Mon, 2009-06-15 at 21:07 +0200, Ingo Molnar wrote:
> > * Ingo Molnar <mingo@elte.hu> wrote:
> > 
> > > > To a point where it cannot afford a simple register save/restore 
> > > > ?
> > > > 
> > > > There is "caring" and "_caring_". I am tempted to ask what NMI 
> > > > handler execution frequency you have in mind here to figure out 
> > > > if we are not trying to optimize sub-nanoseconds per minutes. ;)
> > > 
> > > I routinely run 'perf' with half a million NMIs per second or 
> > > more. ( Why wait 10 seconds for a profile you can get in 1 second? 
> > > ;-)
> > > 
> > > Granted that is over multiple CPUs - but still performance does 
> > > matter here too.
> > > 
> > > Reading cr2 is certainly fast. Writing it - dunno.
> > 
> > But one thing is sure: it is certainly going to be faster than the 
> > INVLPG(s!) we have to do with the GUP solution.
> 
> Sure, but we only pay that price when we do the callchain bit, not 
> on every NMI.

same goes for the CR2 save/restore trick - it only has to be done 
around the code where we expect to generate a #PF. I.e. in the 
call-graph bits.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:43                               ` Ingo Molnar
  2009-06-15 19:51                                 ` Mathieu Desnoyers
  2009-06-15 19:55                                 ` Ingo Molnar
@ 2009-06-15 20:04                                 ` Linus Torvalds
  2009-06-15 20:30                                   ` Ingo Molnar
  2009-06-15 20:06                                 ` Mathieu Desnoyers
  3 siblings, 1 reply; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 20:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits



On Mon, 15 Jun 2009, Ingo Molnar wrote:
> 
> Well i guess it depends. For server apps it is true - syscalls are a 
> lot more dominant, MMs are long-running so any startup cost gets 
> amortized and pagefaults are avoided.
> 
> For something like a kernel build we have 7 times as many pagefaults 
> as syscalls:

Ingo - calm down.

This is not about page faults.

This is purely about taps FROM KERNEL SPACE.

Yes, for the kernel build we have 7 times as many page faults as system 
calls, BUT I BET 99.9% of them are from user mode!

The whole "open-code iret" only works for exceptions that happened in 
kernel mode. That's a _vanishingly_ small number (outside of device 
interrupts that happen during idle).

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:43                               ` Ingo Molnar
                                                   ` (2 preceding siblings ...)
  2009-06-15 20:04                                 ` Linus Torvalds
@ 2009-06-15 20:06                                 ` Mathieu Desnoyers
  2009-06-15 20:10                                   ` H. Peter Anvin
                                                     ` (2 more replies)
  3 siblings, 3 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 20:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > > If it's faster, this becomes a legit (albeit complex) 
> > > micro-optimization in a _very_ hot codepath.
> > 
> > I don't think it's all that hot. It's not like it's the return to 
> > user mode.
> 
> Well i guess it depends. For server apps it is true - syscalls are a 
> lot more dominant, MMs are long-running so any startup cost gets 
> amortized and pagefaults are avoided.
> 
> For something like a kernel build we have 7 times as many pagefaults 
> as syscalls:
> 
> aldebaran:~/linux/linux> perf stat -- make -j32 >/dev/null
> [...]
>  Performance counter stats for 'make -j32':
> 
>  1444281.076741  task-clock-msecs     #     14.429 CPUs 
>          219991  context-switches     #      0.000 M/sec
>           18335  CPU-migrations       #      0.000 M/sec
>        38465628  page-faults          #      0.027 M/sec
>   4374762924204  cycles               #   3029.025 M/sec
>   2645979309823  instructions         #      0.605 IPC  
>     42398991227  cache-references     #     29.356 M/sec
>      4371920878  cache-misses         #      3.027 M/sec
> 
>   100.097787566  seconds time elapsed.
> 
> So we have 38465628 page-faults, or one every 68788 instructions, 
> one every 113731 cycles.
> 
> 10 cycles saved in the page fault costs means 0.01% performance win 
> - or about 10 milliseconds shaven off the kernel build time.
>  
> 100 cycles saved (which is impossible really in the entry/exit path) 
> would mean 0.1% win.
> 
> 5653639 syscalls (according to strace -c) - which is a factor of 6.8 
> lower. Same goes for shell scripts or most of the clicking we do on 
> a GUI.
> 
> It's not a big factor for sure.
> 
> Btw., the biggest pagefault cost is in the fault handling itself 
> (the page clearing):
> 
>       4.14%  [k] do_page_fault
>       1.20%  [k] sys_write
>       1.10%  [k] sys_open
>       0.63%  [k] sys_exit_group
>       0.48%  [k] smp_apic_timer_interrupt
>       0.37%  [k] sys_read
>       0.37%  [k] sys_execve
>       0.20%  [k] sys_mmap
>       0.18%  [k] sys_close
>       0.14%  [k] sys_munmap
>       0.13%  [k] sys_poll
>       0.09%  [k] sys_newstat
>       0.07%  [k] sys_clone
>       0.06%  [k] sys_newfstat
> 
> it totals to 4.14% of the total cost (user-space cycles included) of 
> a kernel build, on a Nehalem box.
> 
> 	Ingo


In the category "crazy ideas one should never express out loud", I could add the
following. We could choose to save/restore the cr2 register on the local stack
at every interrupt entry/exit, and therefore allow the page fault handler to
execute with interrupts enabled.

I have not benchmarked the interrupt disabling overhead of the page fault
handler handled by starting an interrupt-gated handler rather than trap-gated 
handler, but cli/sti instructions are known to take quite a few cycles on some
architectures. e.g. 131 cycles for the pair on P4, 23 cycles on AMD Athlon X2
64, 43 cycles on Intel Core2.

I am tempted to think that taking, say, ~10 cycles on the interrupt path worths
it if we save a few tens of cycles on the page fault handler fast path.

But again, this calls for benchmarks.

Mathieu



-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:06                                 ` Mathieu Desnoyers
@ 2009-06-15 20:10                                   ` H. Peter Anvin
  2009-06-15 20:47                                   ` Ingo Molnar
  2009-06-16  8:42                                   ` Ingo Molnar
  2 siblings, 0 replies; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 20:10 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Linus Torvalds, mingo, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> In the category "crazy ideas one should never express out loud", I could add the
> following. We could choose to save/restore the cr2 register on the local stack
> at every interrupt entry/exit, and therefore allow the page fault handler to
> execute with interrupts enabled.
> 
> I have not benchmarked the interrupt disabling overhead of the page fault
> handler handled by starting an interrupt-gated handler rather than trap-gated 
> handler, but cli/sti instructions are known to take quite a few cycles on some
> architectures. e.g. 131 cycles for the pair on P4, 23 cycles on AMD Athlon X2
> 64, 43 cycles on Intel Core2.
> 
> I am tempted to think that taking, say, ~10 cycles on the interrupt path worths
> it if we save a few tens of cycles on the page fault handler fast path.
> 

Doesn't sound all that crazy, I suspect the underlying assumption that
interrupt gates are slower than trap gates is incorrect.  Disabling
interrupts itself isn't expensive, it's the synchronization requirements.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:04                             ` Linus Torvalds
  2009-06-15 19:39                               ` Mathieu Desnoyers
  2009-06-15 19:43                               ` Ingo Molnar
@ 2009-06-15 20:14                               ` Jeremy Fitzhardinge
  2009-06-15 20:27                                 ` Linus Torvalds
  2 siblings, 1 reply; 1149+ messages in thread
From: Jeremy Fitzhardinge @ 2009-06-15 20:14 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Mathieu Desnoyers, mingo, hpa, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	npiggin, tglx, linux-tip-commits

On 06/15/09 12:04, Linus Torvalds wrote:
> That's an odd way of writing it.
>
> Don't we have a per-cpu segment here? I'd much rather just see it do
> something like this (_before_ restoring the regular registers)
>
> 	movq EIP(%esp),%rax
> 	movq ESP(%esp),%rdx
> 	movq %rax,gs:saved_esp
> 	movq %rdx,gs:saved_eip
>
> 	# restore regular regs
> 	RESTORE_ALL
>
> 	# skip eip/esp to get at eflags
> 	addl $16,%esp
> 	popfq
>
> 	# restore rsp/rip
> 	movq gs:saved_esp,%rsp
> 	jmpq *(gs:saved_eip)
>
> but I haven't thought deeply about it. Maybe there's something wrong with
> the above.
>    

We have to restore the usermode %gs somewhere...

     J

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:21                                     ` Avi Kivity
@ 2009-06-15 20:18                                       ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 1149+ messages in thread
From: Jeremy Fitzhardinge @ 2009-06-15 20:18 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Peter Zijlstra, Ingo Molnar, Mathieu Desnoyers, H. Peter Anvin,
	Linus Torvalds, mingo, paulus, acme, linux-kernel, penberg,
	vegard.nossum, efault, npiggin, tglx, linux-tip-commits

On 06/15/09 12:21, Avi Kivity wrote:
> You can read cr2 on nmi entry and nmi exit, and only write it if it 
> has changed (if it turns out that writing cr2 is expensive; ISTR that 
> it isn't).
>

Writing the real cr2 is expensive, but it may be cheap to write the 
virtual cr2 in a vmx context.  Or something.

     J

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:55                                 ` Ingo Molnar
@ 2009-06-15 20:25                                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 20:25 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> Which gave these overall stats:
> 
>  Performance counter stats for './prctl 0 0':
> 
>    28414.696319  task-clock-msecs     #      0.997 CPUs 
>               3  context-switches     #      0.000 M/sec
>               1  CPU-migrations       #      0.000 M/sec
>             149  page-faults          #      0.000 M/sec
>     87254432334  cycles               #   3070.750 M/sec
>      5078691161  instructions         #      0.058 IPC  
>          304144  cache-references     #      0.011 M/sec
>           28760  cache-misses         #      0.001 M/sec
> 
>    28.501962853  seconds time elapsed.
> 
> 87254432334/1000000000 ~== 87, so we have 87 cycles cost per 
> iteration.

I also measured the GUP based copy_from_user_nmi(), on 64-bit (so 
there's not even any real atomic-kmap/invlpg overhead):

 Performance counter stats for './prctl 0 0':

   55580.513882  task-clock-msecs     #      0.997 CPUs 
              3  context-switches     #      0.000 M/sec
              1  CPU-migrations       #      0.000 M/sec
            149  page-faults          #      0.000 M/sec
   176375680192  cycles               #   3173.337 M/sec
   299353138289  instructions         #      1.697 IPC  
        3388060  cache-references     #      0.061 M/sec
        1318977  cache-misses         #      0.024 M/sec

   55.748468367  seconds time elapsed.

This shows the overhead of looking up pagetables - 176 cycles per 
iteration. A cr2 save/restore pair is twice as fast.

Here's the profile btw:

 aldebaran:~> perf report -s s

#
# (1813480 samples)
#
# Overhead  Symbol
# ........  ......
#
    23.99%  [k] __get_user_pages_fast
    19.89%  [k] gup_pte_range
    18.98%  [k] gup_pud_range
    16.95%  [k] copy_from_user_nmi
    16.04%  [k] put_page
     3.17%  [k] sys_prctl
     0.02%  [k] _spin_lock
     0.02%  [k] copy_user_generic_string
     0.02%  [k] get_page_from_freelist

taking a look at 'perf annotate __get_user_pages_fast' suggests 
these two hot-spots:

    0.04 :      ffffffff810310cc:       9c                      pushfq 
    9.24 :      ffffffff810310cd:       41 5d                   pop    %r13
    1.43 :      ffffffff810310cf:       fa                      cli    
    3.44 :      ffffffff810310d0:       48 89 fb                mov    %rdi,%rbx
    0.00 :      ffffffff810310d3:       4d 8d 7e ff             lea    -0x1(%r14),%r15
    0.00 :      ffffffff810310d7:       48 c1 eb 24             shr    $0x24,%rbx
    0.00 :      ffffffff810310db:       81 e3 f8 0f 00 00       and    $0xff8,%ebx

15% of its overhead is here, 50% is here:

    0.71 :      ffffffff81031141:       41 55                   push   %r13
    0.05 :      ffffffff81031143:       9d                      popfq  
   30.07 :      ffffffff81031144:       8b 55 d4                mov    -0x2c(%rbp),%edx
    2.78 :      ffffffff81031147:       48 83 c4 20             add    $0x20,%rsp
    0.00 :      ffffffff8103114b:       89 d0                   mov    %edx,%eax
   10.93 :      ffffffff8103114d:       5b                      pop    %rbx
    0.02 :      ffffffff8103114e:       41 5c                   pop    %r12
    1.28 :      ffffffff81031150:       41 5d                   pop    %r13
    0.51 :      ffffffff81031152:       41 5e                   pop    %r14

So either pushfq+cli...popfq sequences are a lot more expensive on 
Nehalem as i imagined, or instruction skidding is tricking us here.

gup_pte_range has a clear hotspot with a locked instruction:

    2.46 :      ffffffff81030d88:       48 8d 41 08             lea    0x8(%rcx),%rax
    0.00 :      ffffffff81030d8c:       f0 ff 41 08             lock incl 0x8(%rcx)
   53.52 :      ffffffff81030d90:       49 63 01                movslq (%r9),%rax
    0.00 :      ffffffff81030d93:       48 81 c6 00 10 00 00    add    $0x1000,%rsi

11% of the total overhead - or about 19 cycles.

So it seems cr2+direct-access is distinctly faster than fast-gup. 

And fast-gup overhead is _per frame entry_ - which makes 
cr2+direct-access (which is per NMI) _far_ more performant - a dozen 
or more call-chain entries are the norm.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:14                               ` Jeremy Fitzhardinge
@ 2009-06-15 20:27                                 ` Linus Torvalds
  2009-06-15 20:42                                   ` H. Peter Anvin
  2009-06-15 21:06                                   ` Jeremy Fitzhardinge
  0 siblings, 2 replies; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 20:27 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Ingo Molnar, Mathieu Desnoyers, mingo, hpa, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	npiggin, tglx, linux-tip-commits



On Mon, 15 Jun 2009, Jeremy Fitzhardinge wrote:
> 
> We have to restore the usermode %gs somewhere...

None of this is useful for user-mode return _anyway_, since you have to 
restore %cs/%ss too. At that point, you have to use iret.

			Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:04                                 ` Linus Torvalds
@ 2009-06-15 20:30                                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 20:30 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 
> 
> On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > 
> > Well i guess it depends. For server apps it is true - syscalls are a 
> > lot more dominant, MMs are long-running so any startup cost gets 
> > amortized and pagefaults are avoided.
> > 
> > For something like a kernel build we have 7 times as many pagefaults 
> > as syscalls:
> 
> Ingo - calm down.
> 
> This is not about page faults.
> 
> This is purely about taps FROM KERNEL SPACE.
> 
> Yes, for the kernel build we have 7 times as many page faults as 
> system calls, BUT I BET 99.9% of them are from user mode!
> 
> The whole "open-code iret" only works for exceptions that happened 
> in kernel mode. That's a _vanishingly_ small number (outside of 
> device interrupts that happen during idle).

Ah, i misunderstood you, sorry. Yes, you are right.

Btw., we can have a precise number - we can sample all pagefaults 
via a soft-counter:

$ perf record -e page-faults -c 1 -f -m 512 -- make -j32

 [ perf record: Captured and wrote 783.697 MB perf.data (~34240256 samples) ]

#
# (33858154 samples)
#
# Overhead  Symbol
# ........  ......
#
    41.62%  [.] memset
    18.21%  0x007fff07bff634
     5.85%  [.] __GI_memcpy
     5.35%  [.] parse_config_file
     4.34%  [.] _int_malloc
     1.24%  0x0000000000dc90
     1.14%  [k] file_read_actor
     1.10%  [.] _dl_addr
     0.64%  [.] __GI_strlen
     0.47%  [.] _dl_load_cache_lookup
     0.43%  [.] _dl_cache_libcmp

(i dont have debuginfo installed for that gcc build, hence that raw 
entry.)

Kernel triggered pagefaults:

 $ perf report -s s | grep '\[k\]'

     1.14%  [k] file_read_actor
     0.15%  [k] __clear_user
     0.12%  [k] strncpy_from_user
     0.12%  [k] copy_user_generic_string
     0.04%  [k] __put_user_4
     0.04%  [k] pipe_read
     0.02%  [k] load_elf_binary
     0.00%  [k] do_notify_resume
     0.00%  [k] iov_iter_fault_in_readable

so 1.7% of the pagefaults are kernel-initiated - 98.3% via 
user-space. Your 99.9% figure was within 1.6% of the real number :-)

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:27                                 ` Linus Torvalds
@ 2009-06-15 20:42                                   ` H. Peter Anvin
  2009-06-15 20:59                                     ` Ingo Molnar
  2009-06-15 22:39                                     ` Linus Torvalds
  2009-06-15 21:06                                   ` Jeremy Fitzhardinge
  1 sibling, 2 replies; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 20:42 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Jeremy Fitzhardinge, Ingo Molnar, Mathieu Desnoyers, mingo,
	paulus, acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum,
	efault, npiggin, tglx, linux-tip-commits

Linus Torvalds wrote:
> 
> On Mon, 15 Jun 2009, Jeremy Fitzhardinge wrote:
>> We have to restore the usermode %gs somewhere...
> 
> None of this is useful for user-mode return _anyway_, since you have to 
> restore %cs/%ss too. At that point, you have to use iret.
> 

cs/ss you could potentially restore with sysret/sysexit, at least for
the common case.  Of course, this means more cases...

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:06                                 ` Mathieu Desnoyers
  2009-06-15 20:10                                   ` H. Peter Anvin
@ 2009-06-15 20:47                                   ` Ingo Molnar
  2009-06-15 21:02                                     ` Mathieu Desnoyers
  2009-06-16  8:42                                   ` Ingo Molnar
  2 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 20:47 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> In the category "crazy ideas one should never express out loud", I 
> could add the following. We could choose to save/restore the cr2 
> register on the local stack at every interrupt entry/exit, and 
> therefore allow the page fault handler to execute with interrupts 
> enabled.
> 
> I have not benchmarked the interrupt disabling overhead of the 
> page fault handler handled by starting an interrupt-gated handler 
> rather than trap-gated handler, but cli/sti instructions are known 
> to take quite a few cycles on some architectures. e.g. 131 cycles 
> for the pair on P4, 23 cycles on AMD Athlon X2 64, 43 cycles on 
> Intel Core2.

The cost on Nehalem (1 billion local_irq_save()+restore() pairs):

 aldebaran:~> perf stat --repeat 5 ./prctl 0 0

 Performance counter stats for './prctl 0 0' (5 runs):

   10950.813461  task-clock-msecs     #      0.997 CPUs    ( +-   1.594% )
              3  context-switches     #      0.000 M/sec   ( +-   0.000% )
              1  CPU-migrations       #      0.000 M/sec   ( +-   0.000% )
            145  page-faults          #      0.000 M/sec   ( +-   0.000% )
    33946294720  cycles               #   3099.888 M/sec   ( +-   1.132% )
     8030365827  instructions         #      0.237 IPC     ( +-   0.006% )
         100933  cache-references     #      0.009 M/sec   ( +-  12.568% )
          27250  cache-misses         #      0.002 M/sec   ( +-   3.897% )

   10.985768499  seconds time elapsed.

That's 33.9 cycles per iteration, with a 1.1% confidence factor.

Annotation gives this result:

    2.24 :      ffffffff810535e5:       9c                      pushfq 
    8.58 :      ffffffff810535e6:       58                      pop    %rax
   10.99 :      ffffffff810535e7:       fa                      cli    
   20.38 :      ffffffff810535e8:       50                      push   %rax
    0.00 :      ffffffff810535e9:       9d                      popfq  
   46.71 :      ffffffff810535ea:       ff c6                   inc    %esi
    0.42 :      ffffffff810535ec:       3b 35 72 31 76 00       cmp    0x763172(%rip),%e
   10.69 :      ffffffff810535f2:       7c f1                   jl     ffffffff810535e5 
    0.00 :      ffffffff810535f4:       e9 7c 01 00 00          jmpq   ffffffff81053775 

i.e. pushfq+cli is roughly 42.19% or 14 cycles, the popfq is 46.71 
or 16 cycles. So the combo cost is 30 cycles, +- 1 cycle.

(Actual effective cost in a real critical section can be better than 
this, dependent on surrounding instructions.)

It got quite a bit faster than Core2 - but still not as fast as AMD.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:42                                   ` H. Peter Anvin
@ 2009-06-15 20:59                                     ` Ingo Molnar
  2009-06-15 21:04                                       ` H. Peter Anvin
  2009-06-15 22:39                                     ` Linus Torvalds
  1 sibling, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 20:59 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Linus Torvalds, Jeremy Fitzhardinge, Mathieu Desnoyers, mingo,
	paulus, acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum,
	efault, npiggin, tglx, linux-tip-commits


* H. Peter Anvin <hpa@zytor.com> wrote:

> Linus Torvalds wrote:
> > 
> > On Mon, 15 Jun 2009, Jeremy Fitzhardinge wrote:
> >> We have to restore the usermode %gs somewhere...
> > 
> > None of this is useful for user-mode return _anyway_, since you have to 
> > restore %cs/%ss too. At that point, you have to use iret.
> 
> cs/ss you could potentially restore with sysret/sysexit, at least 
> for the common case.  Of course, this means more cases...

hm, does this really work? Using sysret there would be quite 
tempting. Does anyone know the rough cycle count difference between 
IRET and SYSRET on contemporary hardware?

Also, is SYSRET NMI-invariant? If yes then this would be a quite 
clean all-around solution: on modern hw we'd standardize on doing 
SYSRET from pretty much all the contexts. We'd get a nice speedup 
and also the NMI nested pagefaults fix.

Oh, compat mode. Doesnt SYSRET on Intel CPUs have the problem of not 
being able to switch back to 32-bit user-space?

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:32                                     ` H. Peter Anvin
@ 2009-06-15 21:01                                       ` Ingo Molnar
  2009-06-15 21:12                                         ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 21:01 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Mathieu Desnoyers, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* H. Peter Anvin <hpa@zytor.com> wrote:

> Mathieu Desnoyers wrote:
> >>>
> >> Writing control registers is serializing, so it's a lot more expensive
> >> than writing a normal register; my *guess* is that it will be on the
> >> order of 100-200 cycles.
> >>
> >> That is not based on any actual information.
> >>
> > 
> > Then how about just writing to the cr2 register *if* it has changed
> > while the NMI handler was running ?
> > 
> > if (unlikely(read_cr2() != saved_cr2)))
> > 	write_cr2(saved_cr2)
> > 
> > Mathieu
> > 
> 
> That works fine, obviously, and although it's probably overkill 
> it's also a trivially cheap optimization.

Writing cr2 costs 84 cycles so it's not overkill at all - it's a 
nice optimization!

Btw., we dont have to re-read it - we actually _know_ when we got a 
fault (the fault handler gives us back an error code).

So we can do this common optimization and avoid the cr2 write 
usually. We only need the cr2 read.

Hm, tempting ...

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:47                                   ` Ingo Molnar
@ 2009-06-15 21:02                                     ` Mathieu Desnoyers
  2009-06-15 21:12                                       ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 21:02 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > In the category "crazy ideas one should never express out loud", I 
> > could add the following. We could choose to save/restore the cr2 
> > register on the local stack at every interrupt entry/exit, and 
> > therefore allow the page fault handler to execute with interrupts 
> > enabled.
> > 
> > I have not benchmarked the interrupt disabling overhead of the 
> > page fault handler handled by starting an interrupt-gated handler 
> > rather than trap-gated handler, but cli/sti instructions are known 
> > to take quite a few cycles on some architectures. e.g. 131 cycles 
> > for the pair on P4, 23 cycles on AMD Athlon X2 64, 43 cycles on 
> > Intel Core2.
> 
> The cost on Nehalem (1 billion local_irq_save()+restore() pairs):
> 
>  aldebaran:~> perf stat --repeat 5 ./prctl 0 0
> 
>  Performance counter stats for './prctl 0 0' (5 runs):
> 
>    10950.813461  task-clock-msecs     #      0.997 CPUs    ( +-   1.594% )
>               3  context-switches     #      0.000 M/sec   ( +-   0.000% )
>               1  CPU-migrations       #      0.000 M/sec   ( +-   0.000% )
>             145  page-faults          #      0.000 M/sec   ( +-   0.000% )
>     33946294720  cycles               #   3099.888 M/sec   ( +-   1.132% )
>      8030365827  instructions         #      0.237 IPC     ( +-   0.006% )
>          100933  cache-references     #      0.009 M/sec   ( +-  12.568% )
>           27250  cache-misses         #      0.002 M/sec   ( +-   3.897% )
> 
>    10.985768499  seconds time elapsed.
> 
> That's 33.9 cycles per iteration, with a 1.1% confidence factor.
> 
> Annotation gives this result:
> 
>     2.24 :      ffffffff810535e5:       9c                      pushfq 
>     8.58 :      ffffffff810535e6:       58                      pop    %rax
>    10.99 :      ffffffff810535e7:       fa                      cli    
>    20.38 :      ffffffff810535e8:       50                      push   %rax
>     0.00 :      ffffffff810535e9:       9d                      popfq  
>    46.71 :      ffffffff810535ea:       ff c6                   inc    %esi
>     0.42 :      ffffffff810535ec:       3b 35 72 31 76 00       cmp    0x763172(%rip),%e
>    10.69 :      ffffffff810535f2:       7c f1                   jl     ffffffff810535e5 
>     0.00 :      ffffffff810535f4:       e9 7c 01 00 00          jmpq   ffffffff81053775 
> 
> i.e. pushfq+cli is roughly 42.19% or 14 cycles, the popfq is 46.71 
> or 16 cycles. So the combo cost is 30 cycles, +- 1 cycle.
> 
> (Actual effective cost in a real critical section can be better than 
> this, dependent on surrounding instructions.)
> 
> It got quite a bit faster than Core2 - but still not as fast as AMD.
> 
> 	Ingo

Interesting, but in our specific case, what would be even more
interesting to know is how many trap gates/s vs interrupt gates/s can be
called. This would allow us to see if it's worth trying to make the page
fault handler interrupt-safe by mean of atomicity and context
save/restore by interrupt handlers (which would let us run the PF
handler with interrupts enabled).

Mathieu



-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:59                                     ` Ingo Molnar
@ 2009-06-15 21:04                                       ` H. Peter Anvin
  2009-06-15 21:13                                         ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 21:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, Jeremy Fitzhardinge, Mathieu Desnoyers, mingo,
	paulus, acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum,
	efault, npiggin, tglx, linux-tip-commits

Ingo Molnar wrote:
> 
> hm, does this really work? Using sysret there would be quite 
> tempting. Does anyone know the rough cycle count difference between 
> IRET and SYSRET on contemporary hardware?
> 
> Also, is SYSRET NMI-invariant? If yes then this would be a quite 
> clean all-around solution: on modern hw we'd standardize on doing 
> SYSRET from pretty much all the contexts. We'd get a nice speedup 
> and also the NMI nested pagefaults fix.
> 
> Oh, compat mode. Doesnt SYSRET on Intel CPUs have the problem of not 
> being able to switch back to 32-bit user-space?
> 

Not sure.  SYSRET/SYSEXIT are *not* general return to userspace
solutions in either case; any kind of complex modes and they can't.

And they are, of course, only applicable for returning to userspace.  As
such, I don't understand the "NMI invariant" comment.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:27                                 ` Linus Torvalds
  2009-06-15 20:42                                   ` H. Peter Anvin
@ 2009-06-15 21:06                                   ` Jeremy Fitzhardinge
  1 sibling, 0 replies; 1149+ messages in thread
From: Jeremy Fitzhardinge @ 2009-06-15 21:06 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Mathieu Desnoyers, mingo, hpa, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	npiggin, tglx, linux-tip-commits

On 06/15/09 13:27, Linus Torvalds wrote:
> On Mon, 15 Jun 2009, Jeremy Fitzhardinge wrote:
>    
>> We have to restore the usermode %gs somewhere...
>>      
>
> None of this is useful for user-mode return _anyway_, since you have to
> restore %cs/%ss too. At that point, you have to use iret.
>    

Ah, right.  I'd even looked at that at one point, when I was 
investigating optimising kernel->kernel exit paths (I'd decided it 
wasn't worth it for its own sake, since they simply don't happen that 
often).

     J

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:01                                       ` Ingo Molnar
@ 2009-06-15 21:12                                         ` Mathieu Desnoyers
  2009-06-15 21:16                                           ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 21:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * H. Peter Anvin <hpa@zytor.com> wrote:
> 
> > Mathieu Desnoyers wrote:
> > >>>
> > >> Writing control registers is serializing, so it's a lot more expensive
> > >> than writing a normal register; my *guess* is that it will be on the
> > >> order of 100-200 cycles.
> > >>
> > >> That is not based on any actual information.
> > >>
> > > 
> > > Then how about just writing to the cr2 register *if* it has changed
> > > while the NMI handler was running ?
> > > 
> > > if (unlikely(read_cr2() != saved_cr2)))
> > > 	write_cr2(saved_cr2)
> > > 
> > > Mathieu
> > > 
> > 
> > That works fine, obviously, and although it's probably overkill 
> > it's also a trivially cheap optimization.
> 
> Writing cr2 costs 84 cycles so it's not overkill at all - it's a 
> nice optimization!
> 
> Btw., we dont have to re-read it - we actually _know_ when we got a 
> fault (the fault handler gives us back an error code).
> 

Just for the sake of making NMI handlers less tricky, supporting page
faults caused by faulting kernel instructions (rather than only
supporting explicit faulting from get_user_pages_inatomic) would be
rather nice design-wise if it only costs 2-3 cycles.

And I would not want to touch the page fault handler itself to write the
saved cr2 value before the handler exits, because this would add a
branch on a very hot path.

Mathieu

> So we can do this common optimization and avoid the cr2 write 
> usually. We only need the cr2 read.
> 
> Hm, tempting ...
> 
> 	Ingo

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:02                                     ` Mathieu Desnoyers
@ 2009-06-15 21:12                                       ` Ingo Molnar
  2009-06-15 21:22                                         ` Mathieu Desnoyers
  2009-06-15 23:22                                         ` Linus Torvalds
  0 siblings, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 21:12 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * Ingo Molnar (mingo@elte.hu) wrote:
> > 
> > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> > 
> > > In the category "crazy ideas one should never express out loud", I 
> > > could add the following. We could choose to save/restore the cr2 
> > > register on the local stack at every interrupt entry/exit, and 
> > > therefore allow the page fault handler to execute with interrupts 
> > > enabled.
> > > 
> > > I have not benchmarked the interrupt disabling overhead of the 
> > > page fault handler handled by starting an interrupt-gated handler 
> > > rather than trap-gated handler, but cli/sti instructions are known 
> > > to take quite a few cycles on some architectures. e.g. 131 cycles 
> > > for the pair on P4, 23 cycles on AMD Athlon X2 64, 43 cycles on 
> > > Intel Core2.
> > 
> > The cost on Nehalem (1 billion local_irq_save()+restore() pairs):
> > 
> >  aldebaran:~> perf stat --repeat 5 ./prctl 0 0
> > 
> >  Performance counter stats for './prctl 0 0' (5 runs):
> > 
> >    10950.813461  task-clock-msecs     #      0.997 CPUs    ( +-   1.594% )
> >               3  context-switches     #      0.000 M/sec   ( +-   0.000% )
> >               1  CPU-migrations       #      0.000 M/sec   ( +-   0.000% )
> >             145  page-faults          #      0.000 M/sec   ( +-   0.000% )
> >     33946294720  cycles               #   3099.888 M/sec   ( +-   1.132% )
> >      8030365827  instructions         #      0.237 IPC     ( +-   0.006% )
> >          100933  cache-references     #      0.009 M/sec   ( +-  12.568% )
> >           27250  cache-misses         #      0.002 M/sec   ( +-   3.897% )
> > 
> >    10.985768499  seconds time elapsed.
> > 
> > That's 33.9 cycles per iteration, with a 1.1% confidence factor.
> > 
> > Annotation gives this result:
> > 
> >     2.24 :      ffffffff810535e5:       9c                      pushfq 
> >     8.58 :      ffffffff810535e6:       58                      pop    %rax
> >    10.99 :      ffffffff810535e7:       fa                      cli    
> >    20.38 :      ffffffff810535e8:       50                      push   %rax
> >     0.00 :      ffffffff810535e9:       9d                      popfq  
> >    46.71 :      ffffffff810535ea:       ff c6                   inc    %esi
> >     0.42 :      ffffffff810535ec:       3b 35 72 31 76 00       cmp    0x763172(%rip),%e
> >    10.69 :      ffffffff810535f2:       7c f1                   jl     ffffffff810535e5 
> >     0.00 :      ffffffff810535f4:       e9 7c 01 00 00          jmpq   ffffffff81053775 
> > 
> > i.e. pushfq+cli is roughly 42.19% or 14 cycles, the popfq is 46.71 
> > or 16 cycles. So the combo cost is 30 cycles, +- 1 cycle.
> > 
> > (Actual effective cost in a real critical section can be better than 
> > this, dependent on surrounding instructions.)
> > 
> > It got quite a bit faster than Core2 - but still not as fast as AMD.
> > 
> > 	Ingo
> 
> Interesting, but in our specific case, what would be even more 
> interesting to know is how many trap gates/s vs interrupt gates/s 
> can be called. This would allow us to see if it's worth trying to 
> make the page fault handler interrupt-safe by mean of atomicity 
> and context save/restore by interrupt handlers (which would let us 
> run the PF handler with interrupts enabled).

See the numbers in the other mail: about 33 million pagefaults 
happen in a typical kernel build - that's ~400K/sec - and that is 
not a particularly really pagefault-heavy workload.

OTOH, interrupt gates, if above 10K/second, do get noticed and get 
reduced. Above 100K/sec combined they are really painful. In 
practice, a combo limit of 10K is healthy.

So there's about an order of magnitude difference in the frequency 
of IRQs versus the frequency of pagefaults.

In the worst-case, we have 10K irqs/sec and almost zero pagefaults - 
every 10 cycles overhead in irq entry+exit cost causes a 0.003% 
total slowdown.

So i'd say that it's pretty safe to say that the shuffling of 
overhead from the pagefault path into the irq path, even if it's a 
zero-sum game as per cycles, is an overall win - or even in the 
worst-case, a negligible overhead.

Syscalls are even more critical: it's easy to have a 'good' workload 
with millions of syscalls per second - so getting even a single 
cycle off the syscall entry+exit path is worth the pain.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:04                                       ` H. Peter Anvin
@ 2009-06-15 21:13                                         ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 21:13 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Linus Torvalds, Jeremy Fitzhardinge, Mathieu Desnoyers, mingo,
	paulus, acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum,
	efault, npiggin, tglx, linux-tip-commits


* H. Peter Anvin <hpa@zytor.com> wrote:

> Ingo Molnar wrote:
> > 
> > hm, does this really work? Using sysret there would be quite 
> > tempting. Does anyone know the rough cycle count difference between 
> > IRET and SYSRET on contemporary hardware?
> > 
> > Also, is SYSRET NMI-invariant? If yes then this would be a quite 
> > clean all-around solution: on modern hw we'd standardize on doing 
> > SYSRET from pretty much all the contexts. We'd get a nice speedup 
> > and also the NMI nested pagefaults fix.
> > 
> > Oh, compat mode. Doesnt SYSRET on Intel CPUs have the problem of not 
> > being able to switch back to 32-bit user-space?
> > 
> 
> Not sure.  SYSRET/SYSEXIT are *not* general return to userspace 
> solutions in either case; any kind of complex modes and they 
> can't.
> 
> And they are, of course, only applicable for returning to 
> userspace.  As such, I don't understand the "NMI invariant" 
> comment.

Yeah - it makes no sense for the NMI return indeed, as the target 
CS/SS is hardcoded indeed.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:12                                         ` Mathieu Desnoyers
@ 2009-06-15 21:16                                           ` Ingo Molnar
  2009-06-15 21:34                                             ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-15 21:16 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: H. Peter Anvin, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> Just for the sake of making NMI handlers less tricky, supporting 
> page faults caused by faulting kernel instructions (rather than 
> only supporting explicit faulting from get_user_pages_inatomic) 
> would be rather nice design-wise if it only costs 2-3 cycles.
> 
> And I would not want to touch the page fault handler itself to 
> write the saved cr2 value before the handler exits, because this 
> would add a branch on a very hot path.

_That_ path is not hot at all - it's the 'we are in atomic section 
and faulted' rare path (laced with an exception table search - which 
is extremely slow compared to other bits of the pagefault path).

But ... it's not an issue: a check can be made in the NMI code too, 
as we always know about pagefaults there, by virtue of getting 
-EFAULT back from the attempted-user-copy.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:12                                       ` Ingo Molnar
@ 2009-06-15 21:22                                         ` Mathieu Desnoyers
  2009-06-15 23:22                                         ` Linus Torvalds
  1 sibling, 0 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 21:22 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > * Ingo Molnar (mingo@elte.hu) wrote:
> > > 
> > > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> > > 
> > > > In the category "crazy ideas one should never express out loud", I 
> > > > could add the following. We could choose to save/restore the cr2 
> > > > register on the local stack at every interrupt entry/exit, and 
> > > > therefore allow the page fault handler to execute with interrupts 
> > > > enabled.
> > > > 
> > > > I have not benchmarked the interrupt disabling overhead of the 
> > > > page fault handler handled by starting an interrupt-gated handler 
> > > > rather than trap-gated handler, but cli/sti instructions are known 
> > > > to take quite a few cycles on some architectures. e.g. 131 cycles 
> > > > for the pair on P4, 23 cycles on AMD Athlon X2 64, 43 cycles on 
> > > > Intel Core2.
> > > 
> > > The cost on Nehalem (1 billion local_irq_save()+restore() pairs):
> > > 
> > >  aldebaran:~> perf stat --repeat 5 ./prctl 0 0
> > > 
> > >  Performance counter stats for './prctl 0 0' (5 runs):
> > > 
> > >    10950.813461  task-clock-msecs     #      0.997 CPUs    ( +-   1.594% )
> > >               3  context-switches     #      0.000 M/sec   ( +-   0.000% )
> > >               1  CPU-migrations       #      0.000 M/sec   ( +-   0.000% )
> > >             145  page-faults          #      0.000 M/sec   ( +-   0.000% )
> > >     33946294720  cycles               #   3099.888 M/sec   ( +-   1.132% )
> > >      8030365827  instructions         #      0.237 IPC     ( +-   0.006% )
> > >          100933  cache-references     #      0.009 M/sec   ( +-  12.568% )
> > >           27250  cache-misses         #      0.002 M/sec   ( +-   3.897% )
> > > 
> > >    10.985768499  seconds time elapsed.
> > > 
> > > That's 33.9 cycles per iteration, with a 1.1% confidence factor.
> > > 
> > > Annotation gives this result:
> > > 
> > >     2.24 :      ffffffff810535e5:       9c                      pushfq 
> > >     8.58 :      ffffffff810535e6:       58                      pop    %rax
> > >    10.99 :      ffffffff810535e7:       fa                      cli    
> > >    20.38 :      ffffffff810535e8:       50                      push   %rax
> > >     0.00 :      ffffffff810535e9:       9d                      popfq  
> > >    46.71 :      ffffffff810535ea:       ff c6                   inc    %esi
> > >     0.42 :      ffffffff810535ec:       3b 35 72 31 76 00       cmp    0x763172(%rip),%e
> > >    10.69 :      ffffffff810535f2:       7c f1                   jl     ffffffff810535e5 
> > >     0.00 :      ffffffff810535f4:       e9 7c 01 00 00          jmpq   ffffffff81053775 
> > > 
> > > i.e. pushfq+cli is roughly 42.19% or 14 cycles, the popfq is 46.71 
> > > or 16 cycles. So the combo cost is 30 cycles, +- 1 cycle.
> > > 
> > > (Actual effective cost in a real critical section can be better than 
> > > this, dependent on surrounding instructions.)
> > > 
> > > It got quite a bit faster than Core2 - but still not as fast as AMD.
> > > 
> > > 	Ingo
> > 
> > Interesting, but in our specific case, what would be even more 
> > interesting to know is how many trap gates/s vs interrupt gates/s 
> > can be called. This would allow us to see if it's worth trying to 
> > make the page fault handler interrupt-safe by mean of atomicity 
> > and context save/restore by interrupt handlers (which would let us 
> > run the PF handler with interrupts enabled).
> 
> See the numbers in the other mail: about 33 million pagefaults 
> happen in a typical kernel build - that's ~400K/sec - and that is 
> not a particularly really pagefault-heavy workload.
> 
> OTOH, interrupt gates, if above 10K/second, do get noticed and get 
> reduced. Above 100K/sec combined they are really painful. In 
> practice, a combo limit of 10K is healthy.
> 
> So there's about an order of magnitude difference in the frequency 
> of IRQs versus the frequency of pagefaults.
> 
> In the worst-case, we have 10K irqs/sec and almost zero pagefaults - 
> every 10 cycles overhead in irq entry+exit cost causes a 0.003% 
> total slowdown.
> 
> So i'd say that it's pretty safe to say that the shuffling of 
> overhead from the pagefault path into the irq path, even if it's a 
> zero-sum game as per cycles, is an overall win - or even in the 
> worst-case, a negligible overhead.
> 
> Syscalls are even more critical: it's easy to have a 'good' workload 
> with millions of syscalls per second - so getting even a single 
> cycle off the syscall entry+exit path is worth the pain.
> 
> 	Ingo

I fully agree with what you say here Ingo, but then I think I must make
my main point a bit more clear :

Trap handlers are currently defined as "interrupt gates" rather than
trap gates, so interrupts are disabled starting from the moment the page
fault is generated. This is done, as Linus said, to protect the content
of the cr2 register from being messed up by interrupts. However, if we
choose to save the cr2 register around irq handler execution, we could
turn the page fault handler into a "real" trap gate (with interrupts
on).

Given I think, just like you, that we must save cycles on the PF handler
path, it would be interesting to see if there is a performance gain to
get by switching the pf handler from interrupt gate to trap gate.

So the test would be :

traps.c:	set_intr_gate(14, &page_fault);

changed for something like a set_trap_gate.

But we should make sure to save the cr2 register upon interrupt/NMI
entry and restore it upon int/NMI exit.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:16                                           ` Ingo Molnar
@ 2009-06-15 21:34                                             ` Mathieu Desnoyers
  2009-06-15 21:38                                               ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 21:34 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Just for the sake of making NMI handlers less tricky, supporting 
> > page faults caused by faulting kernel instructions (rather than 
> > only supporting explicit faulting from get_user_pages_inatomic) 
> > would be rather nice design-wise if it only costs 2-3 cycles.
> > 
> > And I would not want to touch the page fault handler itself to 
> > write the saved cr2 value before the handler exits, because this 
> > would add a branch on a very hot path.
> 
> _That_ path is not hot at all - it's the 'we are in atomic section 
> and faulted' rare path (laced with an exception table search - which 
> is extremely slow compared to other bits of the pagefault path).
> 
> But ... it's not an issue: a check can be made in the NMI code too, 
> as we always know about pagefaults there, by virtue of getting 
> -EFAULT back from the attempted-user-copy.

As the maintainer of the out-of-tree LTTng tracer, which hooks in the
page fault handler with tracepoints, and which can build almost entirely
as modules, I am very tempted to argue that having the nmi-code entirely
robust wrt in-kernel page faults would be a very-nice-to-have feature.

Requiring that code to be either built-in or to call vmalloc_sync_all()
after any vmalloc or after module load is just painful and error-prone.
Plus, tracing is a feature that some users will only use in specific
occasions. I don't see why it should be built-into the kernel at all.
That's just a waste of memory in many cases. (I am not talking about
users who want to do continuous system tracing here, which is a totally
different scenario).

Mathieu


> 
> 	Ingo

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:34                                             ` Mathieu Desnoyers
@ 2009-06-15 21:38                                               ` H. Peter Anvin
  2009-06-15 21:54                                                 ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 21:38 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> As the maintainer of the out-of-tree LTTng tracer, which hooks in the
> page fault handler with tracepoints, and which can build almost entirely
> as modules, I am very tempted to argue that having the nmi-code entirely
> robust wrt in-kernel page faults would be a very-nice-to-have feature.
> 

I doubt that is ever going to be reliable, due to reentrancy issues.

	-hpa

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:38                                               ` H. Peter Anvin
@ 2009-06-15 21:54                                                 ` Mathieu Desnoyers
  2009-06-15 22:21                                                   ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 21:54 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > 
> > As the maintainer of the out-of-tree LTTng tracer, which hooks in the
> > page fault handler with tracepoints, and which can build almost entirely
> > as modules, I am very tempted to argue that having the nmi-code entirely
> > robust wrt in-kernel page faults would be a very-nice-to-have feature.
> > 
> 
> I doubt that is ever going to be reliable, due to reentrancy issues.
> 
> 	-hpa

Do you mean the page fault handler code is no ever going to be reliable
or the tracer code ?

I spent a great deal of effort making LTTng lockless and reentrant wrt
NMIs. It would be great if the low-level kernel exception handlers would
do the same, therefore I would not have to isolate the tracer from the
kernel as I currently do. Well, I would still continue to isolate the
tracer from the kernel, but at least I would not have to spend as much
effort controlling what exceptions and faults paths the tracer is
executing.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:54                                                 ` Mathieu Desnoyers
@ 2009-06-15 22:21                                                   ` H. Peter Anvin
  2009-06-15 22:30                                                     ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 22:21 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> * H. Peter Anvin (hpa@zytor.com) wrote:
>> Mathieu Desnoyers wrote:
>>> As the maintainer of the out-of-tree LTTng tracer, which hooks in the
>>> page fault handler with tracepoints, and which can build almost entirely
>>> as modules, I am very tempted to argue that having the nmi-code entirely
>>> robust wrt in-kernel page faults would be a very-nice-to-have feature.
>>>
>> I doubt that is ever going to be reliable, due to reentrancy issues.
>>
>> 	-hpa
> 
> Do you mean the page fault handler code is no ever going to be reliable
> or the tracer code ?
> 
> I spent a great deal of effort making LTTng lockless and reentrant wrt
> NMIs. It would be great if the low-level kernel exception handlers would
> do the same, therefore I would not have to isolate the tracer from the
> kernel as I currently do. Well, I would still continue to isolate the
> tracer from the kernel, but at least I would not have to spend as much
> effort controlling what exceptions and faults paths the tracer is
> executing.
> 

So instead you want to core kernel to do your work for you?

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 22:21                                                   ` H. Peter Anvin
@ 2009-06-15 22:30                                                     ` Mathieu Desnoyers
  2009-06-15 22:36                                                       ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 22:30 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > * H. Peter Anvin (hpa@zytor.com) wrote:
> >> Mathieu Desnoyers wrote:
> >>> As the maintainer of the out-of-tree LTTng tracer, which hooks in the
> >>> page fault handler with tracepoints, and which can build almost entirely
> >>> as modules, I am very tempted to argue that having the nmi-code entirely
> >>> robust wrt in-kernel page faults would be a very-nice-to-have feature.
> >>>
> >> I doubt that is ever going to be reliable, due to reentrancy issues.
> >>
> >> 	-hpa
> > 
> > Do you mean the page fault handler code is no ever going to be reliable
> > or the tracer code ?
> > 
> > I spent a great deal of effort making LTTng lockless and reentrant wrt
> > NMIs. It would be great if the low-level kernel exception handlers would
> > do the same, therefore I would not have to isolate the tracer from the
> > kernel as I currently do. Well, I would still continue to isolate the
> > tracer from the kernel, but at least I would not have to spend as much
> > effort controlling what exceptions and faults paths the tracer is
> > executing.
> > 
> 
> So instead you want to core kernel to do your work for you?
> 

I'm just thinking that touching or not vmalloc'd areas should not be the
first thing that comes into the mind of someone willing to write a
nmi-hooking tracer or oprofile module.

As far as just me and LTTng are concerned, it's already dealt with. I'm
just saying that having to deal with that at the tracer or profiler
module level is ugly.

So basically, in order to let tracer/profiler modules be more solid,
yes, I think the core kernel should do that work if it does not involve
any significant performance degradation. Especially due to the
hard-to-reproduce and hard-to-debug nature of problems caused by such
races.

Mathieu


> 	-hpa
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 22:30                                                     ` Mathieu Desnoyers
@ 2009-06-15 22:36                                                       ` H. Peter Anvin
  2009-06-15 22:49                                                         ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-15 22:36 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> I'm just thinking that touching or not vmalloc'd areas should not be the
> first thing that comes into the mind of someone willing to write a
> nmi-hooking tracer or oprofile module.
> 

But is HAS to be.  Otherwise you're in deadlock city anyway.

	-hpa


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:42                                   ` H. Peter Anvin
  2009-06-15 20:59                                     ` Ingo Molnar
@ 2009-06-15 22:39                                     ` Linus Torvalds
  1 sibling, 0 replies; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 22:39 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Jeremy Fitzhardinge, Ingo Molnar, Mathieu Desnoyers, mingo,
	paulus, acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum,
	efault, npiggin, tglx, linux-tip-commits



On Mon, 15 Jun 2009, H. Peter Anvin wrote:
> 
> cs/ss you could potentially restore with sysret/sysexit, at least for
> the common case.  Of course, this means more cases...

Yes. But it gets pretty complicated. You now have to make user space 
restore some of the registers, so you end up having to write to the user 
space stack etc.

It might be worth it (iret really is very slow, _especially_ to user 
space, but it's definitely nontrivial.

			Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 22:36                                                       ` H. Peter Anvin
@ 2009-06-15 22:49                                                         ` Mathieu Desnoyers
  2009-06-16  1:28                                                           ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-15 22:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > 
> > I'm just thinking that touching or not vmalloc'd areas should not be the
> > first thing that comes into the mind of someone willing to write a
> > nmi-hooking tracer or oprofile module.
> > 
> 
> But is HAS to be.  Otherwise you're in deadlock city anyway.
> 

Where is the kernel page fault handler grabbing any lock to service
in-kernel page faults exactly ?

Those are usually considered as utterly simple page table fixups,
nothing more.

Mathieu

> 	-hpa
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 21:12                                       ` Ingo Molnar
  2009-06-15 21:22                                         ` Mathieu Desnoyers
@ 2009-06-15 23:22                                         ` Linus Torvalds
  2009-06-19 15:20                                           ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-15 23:22 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits



On Mon, 15 Jun 2009, Ingo Molnar wrote:
> 
> See the numbers in the other mail: about 33 million pagefaults 
> happen in a typical kernel build - that's ~400K/sec - and that is 
> not a particularly really pagefault-heavy workload.

Did you do any function-level profiles?

Last I looked at it, the real cost of page faults were all in the memory 
copies and page clearing, and while it would be nice to speed up the 
kernel entry and exit, the few tens of cycles we might be able to get from 
there really aren't all that important.

38 million page faults may sound like a lot, but put it in other terms: if 
we get rid of 20 cycles for each page fault, that's still not a lot of 
actual time. Lookie here at your own numbers:

       38465628  page-faults          #      0.027 M/sec
  4374762924204  cycles               #   3029.025 M/sec

Now, if we shave 20 cycles off each page fault, that is still just, what, 
0.018% or something? Not really that impressive in the end.

So I'm all for optimizing the kernel entry/exit paths, but ..

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 22:49                                                         ` Mathieu Desnoyers
@ 2009-06-16  1:28                                                           ` H. Peter Anvin
  2009-06-16  3:05                                                             ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-16  1:28 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> Where is the kernel page fault handler grabbing any lock to service
> in-kernel page faults exactly ?
> 
> Those are usually considered as utterly simple page table fixups,
> nothing more.
> 

It doesn't, *because it doesn't have to*.  Your proposal requires that
page faults can be handled inside the page fault handler, and that's a
pretty tall order.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-14 18:36               ` tip-bot for Ingo Molnar
  2009-06-15  7:14                 ` Yong Wang
@ 2009-06-16  2:57                 ` Frederic Weisbecker
  2009-06-16  8:09                   ` Ingo Molnar
  2009-06-17  7:29                   ` Peter Zijlstra
  1 sibling, 2 replies; 1149+ messages in thread
From: Frederic Weisbecker @ 2009-06-16  2:57 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, penberg, a.p.zijlstra,
	efault, arjan, tglx, mingo
  Cc: linux-tip-commits

On Sun, Jun 14, 2009 at 06:36:32PM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  3efa1cc99ec51bc7a7ae0011a16619fd20dbe6ea
> Gitweb:     http://git.kernel.org/tip/3efa1cc99ec51bc7a7ae0011a16619fd20dbe6ea
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sun, 14 Jun 2009 15:04:15 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 14 Jun 2009 20:34:06 +0200
> 
> perf record/report: Add call graph / call chain profiling
> 
> Add the first steps of call-graph profiling:
> 
>  - add the -c (--call-graph) option to perf record
>  - parse the call-graph record and printout out under -D (--dump-trace)
> 
> The call-graph data is not put into the histogram yet, but it
> can be seen that it's being processed correctly:
> 
> 0x3ce0 [0x38]: event: 35
> .
> . ... raw event: size 56 bytes
> .  0000:  23 00 00 00 05 00 38 00 d4 df 0e 81 ff ff ff ff  #.....8........
> .  0010:  60 0b 00 00 60 0b 00 00 03 00 00 00 01 00 02 00  `...`..........
> .  0020:  d4 df 0e 81 ff ff ff ff a0 61 ed 41 36 00 00 00  .........a.A6..
> .  0030:  04 92 e6 41 36 00 00 00                          .a.A6..
> .
> 0x3ce0 [0x38]: PERF_EVENT (IP, 5): 2912: 0xffffffff810edfd4 period: 1
> ... chain: u:2, k:1, nr:3
> .....  0: 0xffffffff810edfd4
> .....  1: 0x3641ed61a0
> .....  2: 0x3641e69204
>  ... thread: perf:2912
>  ...... dso: [kernel]
> 
> This shows a 3-entry call-graph: with 1 kernel-space and two user-space
> entries
> 
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> Cc: Arjan van de Ven <arjan@infradead.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  tools/perf/builtin-record.c |    8 ++++++
>  tools/perf/builtin-report.c |   57 ++++++++++++++++++++++++++++++++++---------
>  2 files changed, 53 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 0f5771f..a177a59 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -37,6 +37,7 @@ static pid_t			target_pid			= -1;
>  static int			inherit				= 1;
>  static int			force				= 0;
>  static int			append_file			= 0;
> +static int			call_graph			= 0;
>  static int			verbose				= 0;
>  
>  static long			samples;
> @@ -351,11 +352,16 @@ static void create_counter(int counter, int cpu, pid_t pid)
>  	int track = 1;
>  
>  	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
> +
>  	if (freq) {
>  		attr->sample_type	|= PERF_SAMPLE_PERIOD;
>  		attr->freq		= 1;
>  		attr->sample_freq	= freq;
>  	}
> +
> +	if (call_graph)
> +		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
> +
>  	attr->mmap		= track;
>  	attr->comm		= track;
>  	attr->inherit		= (cpu < 0) && inherit;
> @@ -555,6 +561,8 @@ static const struct option options[] = {
>  		    "profile at this frequency"),
>  	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
>  		    "number of mmap data pages"),
> +	OPT_BOOLEAN('g', "call-graph", &call_graph,
> +		    "do call-graph (stack chain/backtrace) recording"),
>  	OPT_BOOLEAN('v', "verbose", &verbose,
>  		    "be more verbose (show counter open errors, etc)"),
>  	OPT_END()
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 37515da..aebba56 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -36,6 +36,7 @@ static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
>  
>  static int		dump_trace = 0;
>  #define dprintf(x...)	do { if (dump_trace) printf(x); } while (0)
> +#define cdprintf(x...)	do { if (dump_trace) color_fprintf(stdout, color, x); } while (0)
>  
>  static int		verbose;
>  static int		full_paths;
> @@ -43,11 +44,19 @@ static int		full_paths;
>  static unsigned long	page_size;
>  static unsigned long	mmap_window = 32;
>  
> +struct ip_chain_event {
> +	__u16 nr;



Is it needed to have the nr encoded in the ip_chain?
We can already find it by doing kernel + user.

Thanks,
Frederic.



> +	__u16 hv;
> +	__u16 kernel;
> +	__u16 user;
> +	__u64 ips[];
> +};
> +
>  struct ip_event {
>  	struct perf_event_header header;
>  	__u64 ip;
>  	__u32 pid, tid;
> -	__u64 period;
> +	unsigned char __more_data[];
>  };
>  
>  struct mmap_event {
> @@ -944,9 +953,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
>  	__u64 ip = event->ip.ip;
>  	__u64 period = 1;
>  	struct map *map = NULL;
> +	void *more_data = event->ip.__more_data;
> +	struct ip_chain_event *chain;
>  
> -	if (event->header.type & PERF_SAMPLE_PERIOD)
> -		period = event->ip.period;
> +	if (event->header.type & PERF_SAMPLE_PERIOD) {
> +		period = *(__u64 *)more_data;
> +		more_data += sizeof(__u64);
> +	}
>  
>  	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
>  		(void *)(offset + head),
> @@ -956,6 +969,22 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
>  		(void *)(long)ip,
>  		(long long)period);
>  
> +	if (event->header.type & PERF_SAMPLE_CALLCHAIN) {
> +		int i;
> +
> +		chain = (void *)more_data;
> +
> +		if (dump_trace) {
> +			dprintf("... chain: u:%d, k:%d, nr:%d\n",
> +				chain->user,
> +				chain->kernel,
> +				chain->nr);
> +
> +			for (i = 0; i < chain->nr; i++)
> +				dprintf("..... %2d: %p\n", i, (void *)chain->ips[i]);
> +		}
> +	}
> +
>  	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
>  
>  	if (thread == NULL) {
> @@ -1098,30 +1127,34 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head)
>  static void trace_event(event_t *event)
>  {
>  	unsigned char *raw_event = (void *)event;
> +	char *color = PERF_COLOR_BLUE;
>  	int i, j;
>  
>  	if (!dump_trace)
>  		return;
>  
> -	dprintf(".\n. ... raw event: size %d bytes\n", event->header.size);
> +	dprintf(".");
> +	cdprintf("\n. ... raw event: size %d bytes\n", event->header.size);
>  
>  	for (i = 0; i < event->header.size; i++) {
> -		if ((i & 15) == 0)
> -			dprintf(".  %04x: ", i);
> +		if ((i & 15) == 0) {
> +			dprintf(".");
> +			cdprintf("  %04x: ", i);
> +		}
>  
> -		dprintf(" %02x", raw_event[i]);
> +		cdprintf(" %02x", raw_event[i]);
>  
>  		if (((i & 15) == 15) || i == event->header.size-1) {
> -			dprintf("  ");
> +			cdprintf("  ");
>  			for (j = 0; j < 15-(i & 15); j++)
> -				dprintf("   ");
> +				cdprintf("   ");
>  			for (j = 0; j < (i & 15); j++) {
>  				if (isprint(raw_event[i-15+j]))
> -					dprintf("%c", raw_event[i-15+j]);
> +					cdprintf("%c", raw_event[i-15+j]);
>  				else
> -					dprintf(".");
> +					cdprintf(".");
>  			}
> -			dprintf("\n");
> +			cdprintf("\n");
>  		}
>  	}
>  	dprintf(".\n");


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  1:28                                                           ` H. Peter Anvin
@ 2009-06-16  3:05                                                             ` Mathieu Desnoyers
  2009-06-16  8:33                                                               ` Ingo Molnar
  2009-06-16  8:36                                                               ` [tip:x86/urgent] x86: mm: Read cr2 before prefetching the mmap_lock tip-bot for Ingo Molnar
  0 siblings, 2 replies; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-16  3:05 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > 
> > Where is the kernel page fault handler grabbing any lock to service
> > in-kernel page faults exactly ?
> > 
> > Those are usually considered as utterly simple page table fixups,
> > nothing more.
> > 
> 
> It doesn't, *because it doesn't have to*.  Your proposal requires that
> page faults can be handled inside the page fault handler, and that's a
> pretty tall order.
> 
> 	-hpa
> 

I am not asking for the pf handler to handle every possible kind of
fault recursively. Just to keep the in-kernel page fault related code
for vmalloc (and possibly for prefetch ?) paths NMI-reentrant :

void do_page_fault(struct pt_regs *regs, unsigned long error_code)

  address = read_cr2();

  if (unlikely(kmmio_fault(regs, address)))
    return;

#ifdef CONFIG_X86_32
        if (unlikely(address >= TASK_SIZE)) {
#else
        if (unlikely(address >= TASK_SIZE64)) {
#endif
                if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
                    vmalloc_fault(address) >= 0)
                        return;

                /* Can handle a stale RO->RW TLB */
                if (spurious_fault(address, error_code))
                        return;

                /* kprobes don't want to hook the spurious faults. */
                if (notify_page_fault(regs))
                        return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
                 */
                goto bad_area_nosemaphore;
        }

This includes vmalloc_fault. Note that I already looked into
vmalloc_fault to ensure it could handle NMIs on x86_64 as well. See
commit bdd5ea31e79fed76eb57d0cd797355267f4f4a8c. It seems I missed the
cr2 register issue though. I assumed NMI handler to save it somehow,
which ends up not being the case.

Mathieu




-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-16  2:57                 ` Frederic Weisbecker
@ 2009-06-16  8:09                   ` Ingo Molnar
  2009-06-17  7:37                     ` Peter Zijlstra
  2009-06-17 11:41                     ` Frederic Weisbecker
  2009-06-17  7:29                   ` Peter Zijlstra
  1 sibling, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-16  8:09 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, penberg, a.p.zijlstra,
	efault, arjan, tglx, linux-tip-commits, Corey Ashford


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> > @@ -43,11 +44,19 @@ static int		full_paths;
> >  static unsigned long	page_size;
> >  static unsigned long	mmap_window = 32;
> >  
> > +struct ip_chain_event {
> > +	__u16 nr;
> 
> Is it needed to have the nr encoded in the ip_chain? We can 
> already find it by doing kernel + user.

That's a good observation. Since we havent exposed the call-chain 
bits in upstream version of the tools, we could still improve on 
this a little bit.

I think the best would be context separators which occupy a special 
address in some quiet corner of the 64-bit address space.

That way we'd have streams of u64 entries:

   ip-1
   ip-2
   CONTEXT_IRQ
   ip-3
   ip-4
   CONTEXT_SYSCALL
   ip-5
   ip-6

The following contexts IDs would be useful:

  CONTEXT_NMI
  CONTEXT_HARDIRQ
  CONTEXT_SOFTIRQ
  CONTEXT_KERNEL
  CONTEXT_USER
  CONTEXT_GUEST_NMI
  CONTEXT_GUEST_HARDIRQ
  CONTEXT_GUEST_SOFTIRQ
  CONTEXT_GUEST_KERNEL
  CONTEXT_GUEST_USER

The context IDs would occupy some rare and 
unlikely-to-be-allocated-soon corner of the address space - say 
startig at 0x8765432112345000. (and real RIPs would be filtered and 
nudged just outside that space of a handful IDs.)

The advantage would be that this is infinitely flexible and 
extensible - any level of nesting can be expressed without having 
separate fields for nr_hv_guest_irq, etc. It's also pretty fast to 
parse.

Hm?

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  3:05                                                             ` Mathieu Desnoyers
@ 2009-06-16  8:33                                                               ` Ingo Molnar
  2009-06-16 14:19                                                                 ` Mathieu Desnoyers
  2009-06-16  8:36                                                               ` [tip:x86/urgent] x86: mm: Read cr2 before prefetching the mmap_lock tip-bot for Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-16  8:33 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: H. Peter Anvin, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> I am not asking for the pf handler to handle every possible kind 
> of fault recursively. Just to keep the in-kernel page fault 
> related code for vmalloc (and possibly for prefetch ?) paths 
> NMI-reentrant :
> 
> void do_page_fault(struct pt_regs *regs, unsigned long error_code)
> 
>   address = read_cr2();

Why would this be needed? We read the cr2 as the first thing in 
do_page_fault(). It can be destroyed and re-faulted at will after 
that point, it wont matter a bit - we have already read it.

The only window to be careful about wrt. cr2 is the small window 
starting at <page_fault>, leading into <do_page_fault>:

ffffffff8154085f <do_page_fault>:
ffffffff8154085f:	55                   	push   %rbp
ffffffff81540860:	48 89 e5             	mov    %rsp,%rbp
ffffffff81540863:	41 57                	push   %r15
ffffffff81540865:	41 56                	push   %r14
ffffffff81540867:	49 89 f6             	mov    %rsi,%r14
ffffffff8154086a:	41 55                	push   %r13
ffffffff8154086c:	49 89 fd             	mov    %rdi,%r13
ffffffff8154086f:	41 54                	push   %r12
ffffffff81540871:	53                   	push   %rbx
ffffffff81540872:	48 83 ec 18          	sub    $0x18,%rsp
ffffffff81540876:	65 4c 8b 3c 25 00 b0 	mov    %gs:0xb000,%r15
ffffffff8154087d:	00 00 
ffffffff8154087f:	49 8b 87 48 02 00 00 	mov    0x248(%r15),%rax
ffffffff81540886:	48 89 45 d0          	mov    %rax,-0x30(%rbp)
ffffffff8154088a:	48 83 c0 60          	add    $0x60,%rax
ffffffff8154088e:	48 89 45 c8          	mov    %rax,-0x38(%rbp)
ffffffff81540892:	0f 18 08             	prefetcht0 (%rax)
ffffffff81540895:	41 0f 20 d4          	mov    %cr2,%r12

Look how early we read out cr2 - after trapping we read it after 
about 40 straight instructions, with no other function call 
inbetween. Only an NMI (or an MCE and similar deep-atomic contexts) 
can get in that window.

( Btw., a sidenote: the prefetcht0 right before the cr2 read is a 
  real bug. Prefetches can sometimes generate false faults and thus
  destroy the value cr2. I'll send a patch for that soon. )

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 19:02                                 ` Avi Kivity
@ 2009-06-16  8:36                                   ` Ingo Molnar
  2009-06-16  8:52                                     ` Avi Kivity
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-16  8:36 UTC (permalink / raw)
  To: Avi Kivity
  Cc: H. Peter Anvin, Mathieu Desnoyers, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits


* Avi Kivity <avi@redhat.com> wrote:

> On 06/15/2009 09:55 PM, H. Peter Anvin wrote:
>> Ingo Molnar wrote:
>>    
>>>> I wouldn't actually expect that, *as long as* there is
>>>> serialization between the cr2 write and the cr2 read.
>>>>        
>>> Well, is there any OS that heavily relies on cr2 writes and which
>>> uses them from NMI context, and which CPU makers care about?
>>> (Meaning: Windows, pretty much.)
>>>
>>> If not then i agree that in theory it should work fine, but in
>>> practice we only know that we dont know the unknown risk here ;-)
>>>
>>>      
>>
>> I think you can drop "uses them from NMI context" from that statement;
>> writing to %cr2 is independent of the context.
>>
>> I can try to find out internally what Intel's position on writing 
>> %cr2 is, but it'll take a while; however, KVM should be able to 
>> tell you if any random OS uses %cr2 writes (as should a static 
>> disassembly of their kernel.)
>
> Linux is one such OS.  When acting as a hypervisor it writes cr2 
> to present its guests with their expected environment (any 
> hypervisor that uses virtualization extensions will of course need 
> to do this).

Ah, it does save/restore it in svm_vcpu_run. VMX can do this via its 
context structure (without explicit CR manipulations in host space), 
right?

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:x86/urgent] x86: mm: Read cr2 before prefetching the mmap_lock
  2009-06-16  3:05                                                             ` Mathieu Desnoyers
  2009-06-16  8:33                                                               ` Ingo Molnar
@ 2009-06-16  8:36                                                               ` tip-bot for Ingo Molnar
  2009-06-16 17:54                                                                 ` Linus Torvalds
  1 sibling, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-16  8:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mathieu.desnoyers, hpa, mingo, penberg,
	a.p.zijlstra, torvalds, vegard.nossum, jeremy, npiggin,
	hugh.dickins, tglx, mingo

Commit-ID:  5dfaf90f8052327c92fbe3c470a2e6634be296c0
Gitweb:     http://git.kernel.org/tip/5dfaf90f8052327c92fbe3c470a2e6634be296c0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 16 Jun 2009 10:23:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 16 Jun 2009 10:23:32 +0200

x86: mm: Read cr2 before prefetching the mmap_lock

Prefetch instructions can generate spurious faults on certain
models of older CPUs. The faults themselves cannot be stopped
and they can occur pretty much anywhere - so the way we solve
them is that we detect certain patterns and ignore the fault.

There is one small path of code where we must not take faults
though: the #PF handler execution leading up to the reading
of the CR2 (the faulting address). If we take a fault there
then we destroy the CR2 value (with that of the prefetching
instruction's) and possibly mishandle user-space or
kernel-space pagefaults.

It turns out that in current upstream we do exactly that:

	prefetchw(&mm->mmap_sem);

	/* Get the faulting address: */
	address = read_cr2();

This is not good.

So turn around the order: first read the cr2 then prefetch
the lock address. Reading cr2 is plenty fast (2 cycles) so
delaying the prefetch by this amount shouldnt be a big issue
performance-wise.

[ And this might explain a mystery fault.c warning that sometimes
  occurs on one an old AMD/Semptron based test-system i have -
  which does have such prefetch problems. ]

Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
LKML-Reference: <20090616030522.GA22162@Krystal>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/mm/fault.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index c6acc63..0482fa6 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -951,11 +951,11 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
 	tsk = current;
 	mm = tsk->mm;
 
-	prefetchw(&mm->mmap_sem);
-
 	/* Get the faulting address: */
 	address = read_cr2();
 
+	prefetchw(&mm->mmap_sem);
+
 	if (unlikely(kmmio_fault(regs, address)))
 		return;
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 20:06                                 ` Mathieu Desnoyers
  2009-06-15 20:10                                   ` H. Peter Anvin
  2009-06-15 20:47                                   ` Ingo Molnar
@ 2009-06-16  8:42                                   ` Ingo Molnar
  2009-06-16 15:21                                     ` H. Peter Anvin
  2 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-16  8:42 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> In the category "crazy ideas one should never express out loud", I 
> could add the following. We could choose to save/restore the cr2 
> register on the local stack at every interrupt entry/exit, and 
> therefore allow the page fault handler to execute with interrupts 
> enabled.
> 
> I have not benchmarked the interrupt disabling overhead of the 
> page fault handler handled by starting an interrupt-gated handler 
> rather than trap-gated handler, but cli/sti instructions are known 
> to take quite a few cycles on some architectures. e.g. 131 cycles 
> for the pair on P4, 23 cycles on AMD Athlon X2 64, 43 cycles on 
> Intel Core2.
> 
> I am tempted to think that taking, say, ~10 cycles on the 
> interrupt path worths it if we save a few tens of cycles on the 
> page fault handler fast path.
> 
> But again, this calls for benchmarks.

One absolutely non-trivial complication with such a scheme would be 
preemptability: if we enter #PF with irqs enabled then it's 
immediately preemptible on CONFIG_PREEMPT=y. The scheduler would 
switch away to another context and the cr2 value is lost before it 
has been read out.

This means an additional collateral damage to context-switch cr2. 
(which might still be worth it given that context-switches are a 
less hot codepath than pagefaults - but an additional complicaton.)

The ideal solution would be for the CPU to atomically push the cr2 
value to the #PF hardware stack, alongside the error code it already 
pushes there.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  8:36                                   ` Ingo Molnar
@ 2009-06-16  8:52                                     ` Avi Kivity
  2009-06-16 10:50                                       ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Avi Kivity @ 2009-06-16  8:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Mathieu Desnoyers, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

On 06/16/2009 11:36 AM, Ingo Molnar wrote:
>
>>> I can try to find out internally what Intel's position on writing
>>> %cr2 is, but it'll take a while; however, KVM should be able to
>>> tell you if any random OS uses %cr2 writes (as should a static
>>> disassembly of their kernel.)
>>>        
>> Linux is one such OS.  When acting as a hypervisor it writes cr2
>> to present its guests with their expected environment (any
>> hypervisor that uses virtualization extensions will of course need
>> to do this).
>>      
>
> Ah, it does save/restore it in svm_vcpu_run. VMX can do this via its
> context structure (without explicit CR manipulations in host space),
> right?
>    

It's the other way around.  svm switches the guest cr2 in hardware 
(through svm->vmcb->save.cr2).  The code you're referring to saves and 
restores the host cr2, which is completely unnecessary.  I'm currently 
in the middle of dropping it :)

vmx has no hardware support for switching cr2, so vmx_vcpu_run() 
switches it using mov cr2.  Given that it's pretty expensive, I've 
switched it to write-if-changed, which dropped 70 cycles from the vmexit 
latency.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  8:52                                     ` Avi Kivity
@ 2009-06-16 10:50                                       ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-16 10:50 UTC (permalink / raw)
  To: Avi Kivity
  Cc: H. Peter Anvin, Mathieu Desnoyers, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits


* Avi Kivity <avi@redhat.com> wrote:

> On 06/16/2009 11:36 AM, Ingo Molnar wrote:
>>
>>>> I can try to find out internally what Intel's position on writing
>>>> %cr2 is, but it'll take a while; however, KVM should be able to
>>>> tell you if any random OS uses %cr2 writes (as should a static
>>>> disassembly of their kernel.)
>>>>        
>>> Linux is one such OS.  When acting as a hypervisor it writes cr2
>>> to present its guests with their expected environment (any
>>> hypervisor that uses virtualization extensions will of course need
>>> to do this).
>>>      
>>
>> Ah, it does save/restore it in svm_vcpu_run. VMX can do this via its
>> context structure (without explicit CR manipulations in host space),
>> right?
>>    
>
> It's the other way around.  svm switches the guest cr2 in hardware 
> (through svm->vmcb->save.cr2).  The code you're referring to saves 
> and restores the host cr2, which is completely unnecessary.  I'm 
> currently in the middle of dropping it :)

Heh :)

> vmx has no hardware support for switching cr2, so vmx_vcpu_run() 
> switches it using mov cr2.  Given that it's pretty expensive, I've 
> switched it to write-if-changed, which dropped 70 cycles from the 
> vmexit latency.

Yep, see my numbers elsewhere in this thread - the cost of a cr2 
write is ~84 cycles on Nehalem.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  8:33                                                               ` Ingo Molnar
@ 2009-06-16 14:19                                                                 ` Mathieu Desnoyers
  2009-06-16 15:22                                                                   ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-16 14:19 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Peter Zijlstra, Linus Torvalds, mingo, paulus,
	acme, linux-kernel, penberg, vegard.nossum, efault, jeremy,
	npiggin, tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > I am not asking for the pf handler to handle every possible kind 
> > of fault recursively. Just to keep the in-kernel page fault 
> > related code for vmalloc (and possibly for prefetch ?) paths 
> > NMI-reentrant :
> > 
> > void do_page_fault(struct pt_regs *regs, unsigned long error_code)
> > 
> >   address = read_cr2();
> 
> Why would this be needed? We read the cr2 as the first thing in 
> do_page_fault(). It can be destroyed and re-faulted at will after 
> that point, it wont matter a bit - we have already read it.
> 

With respect to cr2, yes, this is the only window we care about.
However, the rest of vmalloc_fault() must be audited for other non
nmi-suitable data structure use (e.g. "current"), which I did in the
past.

My intent was just to respond to Peter's concerns by showing that the
part of page fault handler which needs to be NMI-reentrant is really not
that big.

Mathieu

> The only window to be careful about wrt. cr2 is the small window 
> starting at <page_fault>, leading into <do_page_fault>:
> 
> ffffffff8154085f <do_page_fault>:
> ffffffff8154085f:	55                   	push   %rbp
> ffffffff81540860:	48 89 e5             	mov    %rsp,%rbp
> ffffffff81540863:	41 57                	push   %r15
> ffffffff81540865:	41 56                	push   %r14
> ffffffff81540867:	49 89 f6             	mov    %rsi,%r14
> ffffffff8154086a:	41 55                	push   %r13
> ffffffff8154086c:	49 89 fd             	mov    %rdi,%r13
> ffffffff8154086f:	41 54                	push   %r12
> ffffffff81540871:	53                   	push   %rbx
> ffffffff81540872:	48 83 ec 18          	sub    $0x18,%rsp
> ffffffff81540876:	65 4c 8b 3c 25 00 b0 	mov    %gs:0xb000,%r15
> ffffffff8154087d:	00 00 
> ffffffff8154087f:	49 8b 87 48 02 00 00 	mov    0x248(%r15),%rax
> ffffffff81540886:	48 89 45 d0          	mov    %rax,-0x30(%rbp)
> ffffffff8154088a:	48 83 c0 60          	add    $0x60,%rax
> ffffffff8154088e:	48 89 45 c8          	mov    %rax,-0x38(%rbp)
> ffffffff81540892:	0f 18 08             	prefetcht0 (%rax)
> ffffffff81540895:	41 0f 20 d4          	mov    %cr2,%r12
> 
> Look how early we read out cr2 - after trapping we read it after 
> about 40 straight instructions, with no other function call 
> inbetween. Only an NMI (or an MCE and similar deep-atomic contexts) 
> can get in that window.
> 
> ( Btw., a sidenote: the prefetcht0 right before the cr2 read is a 
>   real bug. Prefetches can sometimes generate false faults and thus
>   destroy the value cr2. I'll send a patch for that soon. )
> 
> 	Ingo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16  8:42                                   ` Ingo Molnar
@ 2009-06-16 15:21                                     ` H. Peter Anvin
  0 siblings, 0 replies; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-16 15:21 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, a.p.zijlstra, penberg, vegard.nossum, efault,
	jeremy, npiggin, tglx, linux-tip-commits

Ingo Molnar wrote:
> 
> The ideal solution would be for the CPU to atomically push the cr2 
> value to the #PF hardware stack, alongside the error code it already 
> pushes there.
> 

That's not going to happen any time soon, obviously.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16 14:19                                                                 ` Mathieu Desnoyers
@ 2009-06-16 15:22                                                                   ` H. Peter Anvin
  2009-06-16 19:06                                                                     ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-16 15:22 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> With respect to cr2, yes, this is the only window we care about.
> However, the rest of vmalloc_fault() must be audited for other non
> nmi-suitable data structure use (e.g. "current"), which I did in the
> past.
> 
> My intent was just to respond to Peter's concerns by showing that the
> part of page fault handler which needs to be NMI-reentrant is really not
> that big.
> 

Even if that is true now, you want it to be true for all future time,
and all to support an out-of-tree piece of code.  All of this is
virtually impossible to test for without said out-of-tree piece of code,
so I will object to it anyway.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:x86/urgent] x86: mm: Read cr2 before prefetching the mmap_lock
  2009-06-16  8:36                                                               ` [tip:x86/urgent] x86: mm: Read cr2 before prefetching the mmap_lock tip-bot for Ingo Molnar
@ 2009-06-16 17:54                                                                 ` Linus Torvalds
  0 siblings, 0 replies; 1149+ messages in thread
From: Linus Torvalds @ 2009-06-16 17:54 UTC (permalink / raw)
  To: mingo, hpa, mathieu.desnoyers, linux-kernel, a.p.zijlstra,
	penberg, vegard.nossum, npiggin, jeremy, tglx, hugh.dickins,
	mingo
  Cc: linux-tip-commits



On Tue, 16 Jun 2009, tip-bot for Ingo Molnar wrote:
> 
> It turns out that in current upstream we do exactly that:
> 
> 	prefetchw(&mm->mmap_sem);
> 
> 	/* Get the faulting address: */
> 	address = read_cr2();
> 
> This is not good.

Ack.

		Linus

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16 15:22                                                                   ` H. Peter Anvin
@ 2009-06-16 19:06                                                                     ` Mathieu Desnoyers
  2009-06-16 20:26                                                                       ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-16 19:06 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > 
> > With respect to cr2, yes, this is the only window we care about.
> > However, the rest of vmalloc_fault() must be audited for other non
> > nmi-suitable data structure use (e.g. "current"), which I did in the
> > past.
> > 
> > My intent was just to respond to Peter's concerns by showing that the
> > part of page fault handler which needs to be NMI-reentrant is really not
> > that big.
> > 
> 
> Even if that is true now, you want it to be true for all future time,
> and all to support an out-of-tree piece of code.  All of this is
> virtually impossible to test for without said out-of-tree piece of code,
> so I will object to it anyway.
> 

I think we are confusing two very distinct topics here :

LTTng is currently out-of-tree. Yes. It does not have to stay like this
in the future. Or it can be a different tracer, like ftrace for
instance.

LTTng can be built as modules. This is very likely to stay like this
even if LTTng (or parts of) are merged. Or as a different tracer is
merged. The reason why building a tracer as a module is convenient for
users has been expressed in a previous mail.

So now you argue that it should not be made easy to implement
tracers/profilers so they can be built as kernel modules because the
LTTng tracer is out-of-tree. I'm sorry, but I really don't follow your
line of reasoning.

So let's say we merge tracer or profiler code into the mainline kernel
and permit that code to be built as module, hence enable testing within
the mainline tree, would you be fine with this?

Mathieu


> 	-hpa
> 
> -- 
> H. Peter Anvin, Intel Open Source Technology Center
> I work for Intel.  I don't speak on their behalf.
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling
       [not found]             ` <new-submission>
                                 ` (222 preceding siblings ...)
  2009-06-15 14:21               ` [tip:perfcounters/core] perf report: Fix 32-bit printf format tip-bot for Ingo Molnar
@ 2009-06-16 19:54               ` tip-bot for Peter Zijlstra
  2009-06-17 11:51               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
                                 ` (483 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-16 19:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, akpm, tglx, mingo

Commit-ID:  702dd8c6624b353eb48dd20a0d36405cfe4f4f99
Gitweb:     http://git.kernel.org/tip/702dd8c6624b353eb48dd20a0d36405cfe4f4f99
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 16 Jun 2009 12:34:17 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 16 Jun 2009 21:48:01 +0200

sched, x86: Fix cpufreq + sched_clock() TSC scaling

For freqency dependent TSCs we only scale the cycles, we do not account
for the discrepancy in absolute value. Add a constant factor so that:

  c1 + f1*cyc == c2 + f2*cyc

[ Impact: fix/reduce sched_clock() jumps across frequency changing events ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Chucked-on-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


---
 arch/x86/include/asm/timer.h |    6 +++++-
 arch/x86/kernel/tsc.c        |    8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h
index bd37ed4..20ca9c4 100644
--- a/arch/x86/include/asm/timer.h
+++ b/arch/x86/include/asm/timer.h
@@ -45,12 +45,16 @@ extern int no_timer_check;
  */
 
 DECLARE_PER_CPU(unsigned long, cyc2ns);
+DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);
 
 #define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
 
 static inline unsigned long long __cycles_2_ns(unsigned long long cyc)
 {
-	return cyc * per_cpu(cyc2ns, smp_processor_id()) >> CYC2NS_SCALE_FACTOR;
+	int cpu = smp_processor_id();
+	unsigned long long ns = per_cpu(cyc2ns_offset, cpu);
+	ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR;
+	return ns;
 }
 
 static inline unsigned long long cycles_2_ns(unsigned long long cyc)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 3e1c057..ef4dac5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -589,22 +589,26 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
  */
 
 DEFINE_PER_CPU(unsigned long, cyc2ns);
+DEFINE_PER_CPU(unsigned long long, cyc2ns_offset);
 
 static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
 {
-	unsigned long long tsc_now, ns_now;
+	unsigned long long tsc_now, ns_now, *offset;
 	unsigned long flags, *scale;
 
 	local_irq_save(flags);
 	sched_clock_idle_sleep_event();
 
 	scale = &per_cpu(cyc2ns, cpu);
+	offset = &per_cpu(cyc2ns_offset, cpu);
 
 	rdtscll(tsc_now);
 	ns_now = __cycles_2_ns(tsc_now);
 
-	if (cpu_khz)
+	if (cpu_khz) {
 		*scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
+		*offset = ns_now - (tsc_now * *scale >> CYC2NS_SCALE_FACTOR);
+	}
 
 	sched_clock_idle_wakeup_event(0);
 	local_irq_restore(flags);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16 19:06                                                                     ` Mathieu Desnoyers
@ 2009-06-16 20:26                                                                       ` H. Peter Anvin
  2009-06-16 21:13                                                                         ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-16 20:26 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> * H. Peter Anvin (hpa@zytor.com) wrote:
>> Mathieu Desnoyers wrote:
>>> With respect to cr2, yes, this is the only window we care about.
>>> However, the rest of vmalloc_fault() must be audited for other non
>>> nmi-suitable data structure use (e.g. "current"), which I did in the
>>> past.
>>>
>>> My intent was just to respond to Peter's concerns by showing that the
>>> part of page fault handler which needs to be NMI-reentrant is really not
>>> that big.
>>>
>> Even if that is true now, you want it to be true for all future time,
>> and all to support an out-of-tree piece of code.  All of this is
>> virtually impossible to test for without said out-of-tree piece of code,
>> so I will object to it anyway.
>>
> 
> I think we are confusing two very distinct topics here :
> 
> LTTng is currently out-of-tree. Yes. It does not have to stay like this
> in the future. Or it can be a different tracer, like ftrace for
> instance.
> 
> LTTng can be built as modules. This is very likely to stay like this
> even if LTTng (or parts of) are merged. Or as a different tracer is
> merged. The reason why building a tracer as a module is convenient for
> users has been expressed in a previous mail.
> 
> So now you argue that it should not be made easy to implement
> tracers/profilers so they can be built as kernel modules because the
> LTTng tracer is out-of-tree. I'm sorry, but I really don't follow your
> line of reasoning.
> 
> So let's say we merge tracer or profiler code into the mainline kernel
> and permit that code to be built as module, hence enable testing within
> the mainline tree, would you be fine with this?
> 

I'm saying that imposing constraints on kernel code has cost.  The cost
may not be immediately evident, but it constraints the kernel
development going forward, potentially for all times.  It is
particularly obnoxious with out-of-tree users, because it is impossible
to fix up those users to deal with a new interface, or even know what
their constraints really are.

This is part of the fundamental problem that Xen causes, for example.

	-hpa

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16 20:26                                                                       ` H. Peter Anvin
@ 2009-06-16 21:13                                                                         ` Mathieu Desnoyers
  2009-06-16 22:37                                                                           ` H. Peter Anvin
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-16 21:13 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* H. Peter Anvin (hpa@zytor.com) wrote:
> Mathieu Desnoyers wrote:
> > * H. Peter Anvin (hpa@zytor.com) wrote:
> >> Mathieu Desnoyers wrote:
> >>> With respect to cr2, yes, this is the only window we care about.
> >>> However, the rest of vmalloc_fault() must be audited for other non
> >>> nmi-suitable data structure use (e.g. "current"), which I did in the
> >>> past.
> >>>
> >>> My intent was just to respond to Peter's concerns by showing that the
> >>> part of page fault handler which needs to be NMI-reentrant is really not
> >>> that big.
> >>>
> >> Even if that is true now, you want it to be true for all future time,
> >> and all to support an out-of-tree piece of code.  All of this is
> >> virtually impossible to test for without said out-of-tree piece of code,
> >> so I will object to it anyway.
> >>
> > 
> > I think we are confusing two very distinct topics here :
> > 
> > LTTng is currently out-of-tree. Yes. It does not have to stay like this
> > in the future. Or it can be a different tracer, like ftrace for
> > instance.
> > 
> > LTTng can be built as modules. This is very likely to stay like this
> > even if LTTng (or parts of) are merged. Or as a different tracer is
> > merged. The reason why building a tracer as a module is convenient for
> > users has been expressed in a previous mail.
> > 
> > So now you argue that it should not be made easy to implement
> > tracers/profilers so they can be built as kernel modules because the
> > LTTng tracer is out-of-tree. I'm sorry, but I really don't follow your
> > line of reasoning.
> > 
> > So let's say we merge tracer or profiler code into the mainline kernel
> > and permit that code to be built as module, hence enable testing within
> > the mainline tree, would you be fine with this?
> > 
> 
> I'm saying that imposing constraints on kernel code has cost.  The cost
> may not be immediately evident, but it constraints the kernel
> development going forward, potentially for all times.  It is
> particularly obnoxious with out-of-tree users, because it is impossible
> to fix up those users to deal with a new interface, or even know what
> their constraints really are.
> 
> This is part of the fundamental problem that Xen causes, for example.
> 

Agreed. And I agree that mainlining such users is a big part of the
answer, because then it makes the whole community aware of their
(ab)uses. However, wrt the specific case discussed here, I prefer by far
adding a reentrancy constraint on a very well defined path of the trap
handler if it permits to simplify a bunch of in-kernel users. This added
encapsulation of architecture corner-cases will eventually make overall
kernel development _simpler_, not harder.

Now if such encapsulation has an unbearable runtime cost, fine, we're
big boys and we can tweak the kernel code to deal on a case-by-case
basis with these corner-cases. However this kind of approach is usually
more error-prone.

So, in summary :

- near-zero measurable runtime cost.
- NMI-reentrancy constraint on a very small and well-defined trap
  handler code path.
- simplifies life of tracer and profilers. (meaning : makes a lot of
  _other_ kernel code much easier to write and understand)
- removes ad-hoc corner cases management from those users.
- provides early error detection because the nmi-reentrant code path is
  shared by all users.

So I'll use your own argument : making this trap handler code path
nmi-reentrant will simplify an already existing bunch of in-kernel users
(oprofile, perf counter tool, ftrace..). Moving the burden from
subsystems spread across the kernel tree to a single, well defined spot
looks like a constraint that will _diminish_ overall kernel development
cost.

Mathieu

> 	-hpa

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-16 21:13                                                                         ` Mathieu Desnoyers
@ 2009-06-16 22:37                                                                           ` H. Peter Anvin
  0 siblings, 0 replies; 1149+ messages in thread
From: H. Peter Anvin @ 2009-06-16 22:37 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Peter Zijlstra, Linus Torvalds, mingo, paulus, acme,
	linux-kernel, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

Mathieu Desnoyers wrote:
> 
> So, in summary :
> 
> - near-zero measurable runtime cost.
> - NMI-reentrancy constraint on a very small and well-defined trap
>   handler code path.
> - simplifies life of tracer and profilers. (meaning : makes a lot of
>   _other_ kernel code much easier to write and understand)
> - removes ad-hoc corner cases management from those users.
> - provides early error detection because the nmi-reentrant code path is
>   shared by all users.
> 
> So I'll use your own argument : making this trap handler code path
> nmi-reentrant will simplify an already existing bunch of in-kernel users
> (oprofile, perf counter tool, ftrace..). Moving the burden from
> subsystems spread across the kernel tree to a single, well defined spot
> looks like a constraint that will _diminish_ overall kernel development
> cost.
> 

No, this is utter bullshit.

YOU ARE ADDING A CONSTRAINT TO ONE OF THE HOTTEST PATHS IN THE KERNEL.

Constraining future optimizations.

To support tools.

That is what I'm objecting to.

	-hpa




^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-16  2:57                 ` Frederic Weisbecker
  2009-06-16  8:09                   ` Ingo Molnar
@ 2009-06-17  7:29                   ` Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-17  7:29 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, penberg, efault, arjan,
	tglx, mingo, linux-tip-commits

On Tue, 2009-06-16 at 04:57 +0200, Frederic Weisbecker wrote:
> > +struct ip_chain_event {
> > +     __u16 nr;
> 
> 
> 
> Is it needed to have the nr encoded in the ip_chain?
> We can already find it by doing kernel + user.

strictly speaking: hv+kernel+user
but yeah, we could possibly replace it with another context, guest
perhaps.

suggestions anyone?

> 
> > +     __u16 hv;
> > +     __u16 kernel;
> > +     __u16 user;
> > +     __u64 ips[];
> > +};


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-16  8:09                   ` Ingo Molnar
@ 2009-06-17  7:37                     ` Peter Zijlstra
  2009-06-17 12:24                       ` Ingo Molnar
  2009-06-17 11:41                     ` Frederic Weisbecker
  1 sibling, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-17  7:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Frederic Weisbecker, mingo, hpa, paulus, acme, linux-kernel,
	penberg, efault, arjan, tglx, linux-tip-commits, Corey Ashford

On Tue, 2009-06-16 at 10:09 +0200, Ingo Molnar wrote:
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > > @@ -43,11 +44,19 @@ static int		full_paths;
> > >  static unsigned long	page_size;
> > >  static unsigned long	mmap_window = 32;
> > >  
> > > +struct ip_chain_event {
> > > +	__u16 nr;
> > 
> > Is it needed to have the nr encoded in the ip_chain? We can 
> > already find it by doing kernel + user.
> 
> That's a good observation. Since we havent exposed the call-chain 
> bits in upstream version of the tools, we could still improve on 
> this a little bit.
> 
> I think the best would be context separators which occupy a special 
> address in some quiet corner of the 64-bit address space.
> 
> That way we'd have streams of u64 entries:
> 
>    ip-1
>    ip-2
>    CONTEXT_IRQ
>    ip-3
>    ip-4
>    CONTEXT_SYSCALL
>    ip-5
>    ip-6
> 
> The following contexts IDs would be useful:
> 
>   CONTEXT_NMI
>   CONTEXT_HARDIRQ
>   CONTEXT_SOFTIRQ
>   CONTEXT_KERNEL
>   CONTEXT_USER
>   CONTEXT_GUEST_NMI
>   CONTEXT_GUEST_HARDIRQ
>   CONTEXT_GUEST_SOFTIRQ
>   CONTEXT_GUEST_KERNEL
>   CONTEXT_GUEST_USER
> 
> The context IDs would occupy some rare and 
> unlikely-to-be-allocated-soon corner of the address space - say 
> startig at 0x8765432112345000. (and real RIPs would be filtered and 
> nudged just outside that space of a handful IDs.)

Right, that works too, but should we use (u64)-1..-4095 for that? We
already use that range for things like ERR_PTR() so its very unlikely we
have something sensible mapped there.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-16  8:09                   ` Ingo Molnar
  2009-06-17  7:37                     ` Peter Zijlstra
@ 2009-06-17 11:41                     ` Frederic Weisbecker
  1 sibling, 0 replies; 1149+ messages in thread
From: Frederic Weisbecker @ 2009-06-17 11:41 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, paulus, acme, linux-kernel, penberg, a.p.zijlstra,
	efault, arjan, tglx, linux-tip-commits, Corey Ashford

On Tue, Jun 16, 2009 at 10:09:24AM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > > @@ -43,11 +44,19 @@ static int		full_paths;
> > >  static unsigned long	page_size;
> > >  static unsigned long	mmap_window = 32;
> > >  
> > > +struct ip_chain_event {
> > > +	__u16 nr;
> > 
> > Is it needed to have the nr encoded in the ip_chain? We can 
> > already find it by doing kernel + user.
> 
> That's a good observation. Since we havent exposed the call-chain 
> bits in upstream version of the tools, we could still improve on 
> this a little bit.
> 
> I think the best would be context separators which occupy a special 
> address in some quiet corner of the 64-bit address space.
> 
> That way we'd have streams of u64 entries:
> 
>    ip-1
>    ip-2
>    CONTEXT_IRQ
>    ip-3
>    ip-4
>    CONTEXT_SYSCALL
>    ip-5
>    ip-6
> 
> The following contexts IDs would be useful:
> 
>   CONTEXT_NMI
>   CONTEXT_HARDIRQ
>   CONTEXT_SOFTIRQ
>   CONTEXT_KERNEL
>   CONTEXT_USER
>   CONTEXT_GUEST_NMI
>   CONTEXT_GUEST_HARDIRQ
>   CONTEXT_GUEST_SOFTIRQ
>   CONTEXT_GUEST_KERNEL
>   CONTEXT_GUEST_USER
> 
> The context IDs would occupy some rare and 
> unlikely-to-be-allocated-soon corner of the address space - say 
> startig at 0x8765432112345000. (and real RIPs would be filtered and 
> nudged just outside that space of a handful IDs.)
> 
> The advantage would be that this is infinitely flexible and 
> extensible - any level of nesting can be expressed without having 
> separate fields for nr_hv_guest_irq, etc. It's also pretty fast to 
> parse.



Indeed, nice idea!


 
> Hm?
> 
> 	Ingo


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: Select frame pointers on x86
       [not found]             ` <new-submission>
                                 ` (223 preceding siblings ...)
  2009-06-16 19:54               ` [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling tip-bot for Peter Zijlstra
@ 2009-06-17 11:51               ` tip-bot for Peter Zijlstra
  2009-06-17 14:06               ` [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling tip-bot for Peter Zijlstra
                                 ` (482 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-17 11:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, akpm, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  b54eff768d8b6d0b50d90b0a27eb2c3d20b9c91c
Gitweb:     http://git.kernel.org/tip/b54eff768d8b6d0b50d90b0a27eb2c3d20b9c91c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 12 Jun 2009 10:04:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 13:48:37 +0200

lockdep: Select frame pointers on x86

x86 stack traces are a piece of crap without frame pointers, and its not
like the 'performance gain' of not having stack pointers matters when you
selected lockdep.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Cc: <stable@kernel.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/Kconfig.debug |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6cdcf38..3be4b7c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -440,7 +440,7 @@ config LOCKDEP
 	bool
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
 	select STACKTRACE
-	select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
+	select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
 	select KALLSYMS
 	select KALLSYMS_ALL
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf record/report: Add call graph / call chain profiling
  2009-06-17  7:37                     ` Peter Zijlstra
@ 2009-06-17 12:24                       ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-17 12:24 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Frederic Weisbecker, mingo, hpa, paulus, acme, linux-kernel,
	penberg, efault, arjan, tglx, linux-tip-commits, Corey Ashford


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> > The context IDs would occupy some rare and 
> > unlikely-to-be-allocated-soon corner of the address space - say 
> > startig at 0x8765432112345000. (and real RIPs would be filtered 
> > and nudged just outside that space of a handful IDs.)
> 
> Right, that works too, but should we use (u64)-1..-4095 for that? 
> We already use that range for things like ERR_PTR() so its very 
> unlikely we have something sensible mapped there.

Makes sense. It's also an easier (and more natural) enumeration 
method.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling
       [not found]             ` <new-submission>
                                 ` (224 preceding siblings ...)
  2009-06-17 11:51               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
@ 2009-06-17 14:06               ` tip-bot for Peter Zijlstra
  2009-06-17 17:27               ` [tip:perfcounters/core] perf report: Add --sort <call> --call <$regex> tip-bot for Peter Zijlstra
                                 ` (481 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-17 14:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, akpm, tglx, mingo

Commit-ID:  84599f8a59e77699f18f06948cea171a349a3f0f
Gitweb:     http://git.kernel.org/tip/84599f8a59e77699f18f06948cea171a349a3f0f
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 16 Jun 2009 12:34:17 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 16:03:54 +0200

sched, x86: Fix cpufreq + sched_clock() TSC scaling

For freqency dependent TSCs we only scale the cycles, we do not account
for the discrepancy in absolute value.

Our current formula is: time = cycles * mult

(where mult is a function of the cpu-speed on variable tsc machines)

Suppose our current cycle count is 10, and we have a multiplier of 5,
then our time value would end up being 50.

Now cpufreq comes along and changes the multiplier to say 3 or 7,
which would result in our time being resp. 30 or 70.

That means that we can observe random jumps in the time value due to
frequency changes in both fwd and bwd direction.

So what this patch does is change the formula to:

  time = cycles * frequency + offset

And we calculate offset so that time_before == time_after, thereby
ridding us of these jumps in time.

[ Impact: fix/reduce sched_clock() jumps across frequency changing events ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Chucked-on-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


---
 arch/x86/include/asm/timer.h |    6 +++++-
 arch/x86/kernel/tsc.c        |    8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h
index bd37ed4..20ca9c4 100644
--- a/arch/x86/include/asm/timer.h
+++ b/arch/x86/include/asm/timer.h
@@ -45,12 +45,16 @@ extern int no_timer_check;
  */
 
 DECLARE_PER_CPU(unsigned long, cyc2ns);
+DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);
 
 #define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
 
 static inline unsigned long long __cycles_2_ns(unsigned long long cyc)
 {
-	return cyc * per_cpu(cyc2ns, smp_processor_id()) >> CYC2NS_SCALE_FACTOR;
+	int cpu = smp_processor_id();
+	unsigned long long ns = per_cpu(cyc2ns_offset, cpu);
+	ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR;
+	return ns;
 }
 
 static inline unsigned long long cycles_2_ns(unsigned long long cyc)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 3e1c057..ef4dac5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -589,22 +589,26 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
  */
 
 DEFINE_PER_CPU(unsigned long, cyc2ns);
+DEFINE_PER_CPU(unsigned long long, cyc2ns_offset);
 
 static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
 {
-	unsigned long long tsc_now, ns_now;
+	unsigned long long tsc_now, ns_now, *offset;
 	unsigned long flags, *scale;
 
 	local_irq_save(flags);
 	sched_clock_idle_sleep_event();
 
 	scale = &per_cpu(cyc2ns, cpu);
+	offset = &per_cpu(cyc2ns_offset, cpu);
 
 	rdtscll(tsc_now);
 	ns_now = __cycles_2_ns(tsc_now);
 
-	if (cpu_khz)
+	if (cpu_khz) {
 		*scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
+		*offset = ns_now - (tsc_now * *scale >> CYC2NS_SCALE_FACTOR);
+	}
 
 	sched_clock_idle_wakeup_event(0);
 	local_irq_restore(flags);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add --sort <call> --call <$regex>
       [not found]             ` <new-submission>
                                 ` (225 preceding siblings ...)
  2009-06-17 14:06               ` [tip:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling tip-bot for Peter Zijlstra
@ 2009-06-17 17:27               ` tip-bot for Peter Zijlstra
  2009-06-17 17:27               ` [tip:perfcounters/core] perf_counter: x86: Set the period in the intel overflow handler tip-bot for Peter Zijlstra
                                 ` (480 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-17 17:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  6e7d6fdcbeefa9434653b5e5da12909636ea1d52
Gitweb:     http://git.kernel.org/tip/6e7d6fdcbeefa9434653b5e5da12909636ea1d52
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 17 Jun 2009 15:51:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 19:23:52 +0200

perf report: Add --sort <call> --call <$regex>

Implement sorting by callchain symbols, --sort <call>.

It will create a new column which will show a match to
--call $regex or "[unmatched]".

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |  209 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 158 insertions(+), 51 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f86bb07..cd74b2e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,11 +40,13 @@ static int		dump_trace = 0;
 
 static int		verbose;
 static int		full_paths;
-static int		collapse_syscalls;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
+static char		*call = "^sys_";
+static regex_t		call_regex;
+
 struct ip_chain_event {
 	__u16 nr;
 	__u16 hv;
@@ -463,6 +465,7 @@ struct hist_entry {
 	struct map	 *map;
 	struct dso	 *dso;
 	struct symbol	 *sym;
+	struct symbol	 *call;
 	__u64		 ip;
 	char		 level;
 
@@ -483,6 +486,16 @@ struct sort_entry {
 	size_t	(*print)(FILE *fp, struct hist_entry *);
 };
 
+static int64_t cmp_null(void *l, void *r)
+{
+	if (!l && !r)
+		return 0;
+	else if (!l)
+		return -1;
+	else
+		return 1;
+}
+
 /* --sort pid */
 
 static int64_t
@@ -517,14 +530,8 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
 	char *comm_l = left->thread->comm;
 	char *comm_r = right->thread->comm;
 
-	if (!comm_l || !comm_r) {
-		if (!comm_l && !comm_r)
-			return 0;
-		else if (!comm_l)
-			return -1;
-		else
-			return 1;
-	}
+	if (!comm_l || !comm_r)
+		return cmp_null(comm_l, comm_r);
 
 	return strcmp(comm_l, comm_r);
 }
@@ -550,14 +557,8 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 	struct dso *dso_l = left->dso;
 	struct dso *dso_r = right->dso;
 
-	if (!dso_l || !dso_r) {
-		if (!dso_l && !dso_r)
-			return 0;
-		else if (!dso_l)
-			return -1;
-		else
-			return 1;
-	}
+	if (!dso_l || !dso_r)
+		return cmp_null(dso_l, dso_r);
 
 	return strcmp(dso_l->name, dso_r->name);
 }
@@ -617,7 +618,38 @@ static struct sort_entry sort_sym = {
 	.print	= sort__sym_print,
 };
 
+/* --sort call */
+
+static int64_t
+sort__call_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	struct symbol *sym_l = left->call;
+	struct symbol *sym_r = right->call;
+
+	if (!sym_l || !sym_r)
+		return cmp_null(sym_l, sym_r);
+
+	return strcmp(sym_l->name, sym_r->name);
+}
+
+static size_t
+sort__call_print(FILE *fp, struct hist_entry *self)
+{
+	size_t ret = 0;
+
+	ret += fprintf(fp, "%-20s", self->call ? self->call->name : "[unmatched]");
+
+	return ret;
+}
+
+static struct sort_entry sort_call = {
+	.header = "Callchain symbol    ",
+	.cmp	= sort__call_cmp,
+	.print	= sort__call_print,
+};
+
 static int sort__need_collapse = 0;
+static int sort__has_call = 0;
 
 struct sort_dimension {
 	char			*name;
@@ -630,6 +662,7 @@ static struct sort_dimension sort_dimensions[] = {
 	{ .name = "comm",	.entry = &sort_comm,	},
 	{ .name = "dso",	.entry = &sort_dso,	},
 	{ .name = "symbol",	.entry = &sort_sym,	},
+	{ .name = "call",	.entry = &sort_call,	},
 };
 
 static LIST_HEAD(hist_entry__sort_list);
@@ -650,6 +683,18 @@ static int sort_dimension__add(char *tok)
 		if (sd->entry->collapse)
 			sort__need_collapse = 1;
 
+		if (sd->entry == &sort_call) {
+			int ret = regcomp(&call_regex, call, REG_EXTENDED);
+			if (ret) {
+				char err[BUFSIZ];
+
+				regerror(ret, &call_regex, err, sizeof(err));
+				fprintf(stderr, "Invalid regex: %s\n%s", call, err);
+				exit(-1);
+			}
+			sort__has_call = 1;
+		}
+
 		list_add_tail(&sd->entry->list, &hist_entry__sort_list);
 		sd->taken = 1;
 
@@ -731,12 +776,75 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
 }
 
 /*
+ *
+ */
+
+static struct symbol *
+resolve_symbol(struct thread *thread, struct map **mapp,
+	       struct dso **dsop, __u64 *ipp)
+{
+	struct dso *dso = dsop ? *dsop : NULL;
+	struct map *map = mapp ? *mapp : NULL;
+	uint64_t ip = *ipp;
+
+	if (!thread)
+		return NULL;
+
+	if (dso)
+		goto got_dso;
+
+	if (map)
+		goto got_map;
+
+	map = thread__find_map(thread, ip);
+	if (map != NULL) {
+		if (mapp)
+			*mapp = map;
+got_map:
+		ip = map->map_ip(map, ip);
+		*ipp  = ip;
+
+		dso = map->dso;
+	} else {
+		/*
+		 * If this is outside of all known maps,
+		 * and is a negative address, try to look it
+		 * up in the kernel dso, as it might be a
+		 * vsyscall (which executes in user-mode):
+		 */
+		if ((long long)ip < 0)
+		dso = kernel_dso;
+	}
+	dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
+
+	if (dsop)
+		*dsop = dso;
+
+	if (!dso)
+		return NULL;
+got_dso:
+	return dso->find_symbol(dso, ip);
+}
+
+static struct symbol *call__match(struct symbol *sym)
+{
+	if (!sym)
+		return NULL;
+
+	if (sym->name && !regexec(&call_regex, sym->name, 0, NULL, 0))
+		return sym;
+
+	return NULL;
+}
+
+/*
  * collect histogram counts
  */
 
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
-		struct symbol *sym, __u64 ip, char level, __u64 count)
+		struct symbol *sym, __u64 ip, struct ip_chain_event *chain,
+	       	char level, __u64 count)
 {
 	struct rb_node **p = &hist.rb_node;
 	struct rb_node *parent = NULL;
@@ -752,6 +860,33 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 	};
 	int cmp;
 
+	if (sort__has_call && chain) {
+		int i, nr = chain->hv;
+		struct symbol *sym;
+		struct dso *dso;
+		__u64 ip;
+
+		for (i = 0; i < chain->kernel; i++) {
+			ip = chain->ips[nr + i];
+			dso = kernel_dso;
+			sym = resolve_symbol(thread, NULL, &dso, &ip);
+			entry.call = call__match(sym);
+			if (entry.call)
+				goto got_call;
+		}
+		nr += i;
+
+		for (i = 0; i < chain->user; i++) {
+			ip = chain->ips[nr + i];
+			sym = resolve_symbol(thread, NULL, NULL, &ip);
+			entry.call = call__match(sym);
+			if (entry.call)
+				goto got_call;
+		}
+		nr += i;
+	}
+got_call:
+
 	while (*p != NULL) {
 		parent = *p;
 		he = rb_entry(parent, struct hist_entry, rb_node);
@@ -955,7 +1090,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	__u64 period = 1;
 	struct map *map = NULL;
 	void *more_data = event->ip.__more_data;
-	struct ip_chain_event *chain;
+	struct ip_chain_event *chain = NULL;
 
 	if (event->header.type & PERF_SAMPLE_PERIOD) {
 		period = *(__u64 *)more_data;
@@ -984,15 +1119,6 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 			for (i = 0; i < chain->nr; i++)
 				dprintf("..... %2d: %016Lx\n", i, chain->ips[i]);
 		}
-		if (collapse_syscalls) {
-			/*
-			 * Find the all-but-last kernel entry
-			 * amongst the call-chains - to get
-			 * to the level of system calls:
-			 */
-			if (chain->kernel >= 2)
-				ip = chain->ips[chain->kernel-2];
-		}
 	}
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
@@ -1016,22 +1142,6 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 		show = SHOW_USER;
 		level = '.';
 
-		map = thread__find_map(thread, ip);
-		if (map != NULL) {
-			ip = map->map_ip(map, ip);
-			dso = map->dso;
-		} else {
-			/*
-			 * If this is outside of all known maps,
-			 * and is a negative address, try to look it
-			 * up in the kernel dso, as it might be a
-			 * vsyscall (which executes in user-mode):
-			 */
-			if ((long long)ip < 0)
-				dso = kernel_dso;
-		}
-		dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
-
 	} else {
 		show = SHOW_HV;
 		level = 'H';
@@ -1039,12 +1149,9 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	}
 
 	if (show & show_mask) {
-		struct symbol *sym = NULL;
-
-		if (dso)
-			sym = dso->find_symbol(dso, ip);
+		struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip);
 
-		if (hist_entry__add(thread, map, dso, sym, ip, level, period)) {
+		if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
 			fprintf(stderr,
 		"problem incrementing symbol count, skipping event\n");
 			return -1;
@@ -1353,8 +1460,8 @@ static const struct option options[] = {
 		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
 		    "Don't shorten the pathnames taking into account the cwd"),
-	OPT_BOOLEAN('S', "syscalls", &collapse_syscalls,
-		    "show per syscall summary overhead, using call graph"),
+	OPT_STRING('c', "call", &call, "regex",
+		   "regex to use for --sort call"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: x86: Set the period in the intel overflow handler
       [not found]             ` <new-submission>
                                 ` (226 preceding siblings ...)
  2009-06-17 17:27               ` [tip:perfcounters/core] perf report: Add --sort <call> --call <$regex> tip-bot for Peter Zijlstra
@ 2009-06-17 17:27               ` tip-bot for Peter Zijlstra
  2009-06-17 17:27               ` [tip:perfcounters/core] perf_counter tools: Replace isprint() with issane() tip-bot for Peter Zijlstra
                                 ` (479 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-17 17:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  60f916dee612130c9977a8edd4abee98334202ba
Gitweb:     http://git.kernel.org/tip/60f916dee612130c9977a8edd4abee98334202ba
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 15 Jun 2009 19:00:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 19:23:52 +0200

perf_counter: x86: Set the period in the intel overflow handler

Commit 9e350de37ac960 ("perf_counter: Accurate period data")
missed a spot, which caused all Intel-PMU samples to have a
period of 0.

This broke auto-freq sampling.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index e8c68a5..ce1ae3f 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1224,6 +1224,8 @@ again:
 		if (!intel_pmu_save_and_restart(counter))
 			continue;
 
+		data.period = counter->hw.last_period;
+
 		if (perf_counter_overflow(counter, 1, &data))
 			intel_pmu_disable_counter(&counter->hw, bit);
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Replace isprint() with issane()
       [not found]             ` <new-submission>
                                 ` (227 preceding siblings ...)
  2009-06-17 17:27               ` [tip:perfcounters/core] perf_counter: x86: Set the period in the intel overflow handler tip-bot for Peter Zijlstra
@ 2009-06-17 17:27               ` tip-bot for Peter Zijlstra
  2009-06-18  6:09               ` [tip:perfcounters/core] perf report: Tidy up the --collapse call-chain feature tip-bot for Ingo Molnar
                                 ` (478 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-17 17:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  5aa75a0fd4bc6402899e06fdb853cab024d65055
Gitweb:     http://git.kernel.org/tip/5aa75a0fd4bc6402899e06fdb853cab024d65055
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 15 Jun 2009 20:11:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Jun 2009 19:23:53 +0200

perf_counter tools: Replace isprint() with issane()

The Git utils came with a ctype replacement that doesn't provide
isprint(). Add a replacement.

Solves a build bug on certain distros.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    2 +-
 tools/perf/util/util.h      |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index cd74b2e..707f60c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1266,7 +1266,7 @@ static void trace_event(event_t *event)
 			for (j = 0; j < 15-(i & 15); j++)
 				cdprintf("   ");
 			for (j = 0; j < (i & 15); j++) {
-				if (isprint(raw_event[i-15+j]))
+				if (issane(raw_event[i-15+j]))
 					cdprintf("%c", raw_event[i-15+j]);
 				else
 					cdprintf(".");
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 76590a1..ce9b514 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -343,6 +343,7 @@ extern unsigned char sane_ctype[256];
 #define isdigit(x) sane_istest(x,GIT_DIGIT)
 #define isalpha(x) sane_istest(x,GIT_ALPHA)
 #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
+#define issane(x)  sane_istest(x,GIT_SPACE | GIT_DIGIT | GIT_ALPHA | GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
 #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
 #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
 #define tolower(x) sane_case((unsigned char)(x), 0x20)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Tidy up the --collapse call-chain feature
       [not found]             ` <new-submission>
                                 ` (228 preceding siblings ...)
  2009-06-17 17:27               ` [tip:perfcounters/core] perf_counter tools: Replace isprint() with issane() tip-bot for Peter Zijlstra
@ 2009-06-18  6:09               ` tip-bot for Ingo Molnar
  2009-06-18  6:27               ` [tip:perfcounters/core] perf report: Tidy up the "--parent <regex>" and "--sort parent" call-chain features tip-bot for Ingo Molnar
                                 ` (477 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-18  6:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  9e2e73305665c363fe173b2da53ae98dd6e7ae0d
Gitweb:     http://git.kernel.org/tip/9e2e73305665c363fe173b2da53ae98dd6e7ae0d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 18 Jun 2009 07:01:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 07:01:03 +0200

perf report: Tidy up the --collapse call-chain feature

 - rename --call <regex> to --collapse <regex>

 - add pagefaults to the default collapsing pattern too

 - rename [unmatched] to [other] - to signal that this is not
   an error but the inverse set

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 707f60c..57b6e2f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -44,7 +44,7 @@ static int		full_paths;
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
-static char		*call = "^sys_";
+static char		*call = "^sys_|^do_page_fault";
 static regex_t		call_regex;
 
 struct ip_chain_event {
@@ -637,7 +637,7 @@ sort__call_print(FILE *fp, struct hist_entry *self)
 {
 	size_t ret = 0;
 
-	ret += fprintf(fp, "%-20s", self->call ? self->call->name : "[unmatched]");
+	ret += fprintf(fp, "%-20s", self->call ? self->call->name : "[other]");
 
 	return ret;
 }
@@ -1457,11 +1457,11 @@ static const struct option options[] = {
 		    "dump raw trace in ASCII"),
 	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
+		   "sort by key(s): pid, comm, dso, symbol, call"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
 		    "Don't shorten the pathnames taking into account the cwd"),
-	OPT_STRING('c', "call", &call, "regex",
-		   "regex to use for --sort call"),
+	OPT_STRING('g', "grep", &call, "regex",
+		   "regex filter to use for '--sort call'"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Tidy up the "--parent <regex>" and "--sort parent" call-chain features
       [not found]             ` <new-submission>
                                 ` (229 preceding siblings ...)
  2009-06-18  6:09               ` [tip:perfcounters/core] perf report: Tidy up the --collapse call-chain feature tip-bot for Ingo Molnar
@ 2009-06-18  6:27               ` tip-bot for Ingo Molnar
  2009-06-18  7:21               ` [tip:perfcounters/core] perf report: Add validation of call-chain entries tip-bot for Ingo Molnar
                                 ` (476 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-18  6:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  b25bcf2f133b1e6216c3d40be394756107d3880f
Gitweb:     http://git.kernel.org/tip/b25bcf2f133b1e6216c3d40be394756107d3880f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 18 Jun 2009 07:01:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 07:21:54 +0200

perf report: Tidy up the "--parent <regex>" and "--sort parent" call-chain features

Instead of the ambigious 'call' naming use the much more
specific 'parent' naming:

 - rename --call <regex> to --parent <regex>

 - rename --sort call to --sort parent

 - rename [unmatched] to [other] - to signal that this is not
   an error but the inverse set

Also add pagefaults to the default parent-symbol pattern too,
as it's a 'syscall overhead category' in a sense.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   67 ++++++++++++++++++++++---------------------
 1 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 707f60c..9868346 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -44,8 +44,8 @@ static int		full_paths;
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
-static char		*call = "^sys_";
-static regex_t		call_regex;
+static char		*parent_pattern = "^sys_|^do_page_fault";
+static regex_t		parent_regex;
 
 struct ip_chain_event {
 	__u16 nr;
@@ -465,7 +465,7 @@ struct hist_entry {
 	struct map	 *map;
 	struct dso	 *dso;
 	struct symbol	 *sym;
-	struct symbol	 *call;
+	struct symbol	 *parent;
 	__u64		 ip;
 	char		 level;
 
@@ -618,13 +618,13 @@ static struct sort_entry sort_sym = {
 	.print	= sort__sym_print,
 };
 
-/* --sort call */
+/* --sort parent */
 
 static int64_t
-sort__call_cmp(struct hist_entry *left, struct hist_entry *right)
+sort__parent_cmp(struct hist_entry *left, struct hist_entry *right)
 {
-	struct symbol *sym_l = left->call;
-	struct symbol *sym_r = right->call;
+	struct symbol *sym_l = left->parent;
+	struct symbol *sym_r = right->parent;
 
 	if (!sym_l || !sym_r)
 		return cmp_null(sym_l, sym_r);
@@ -633,23 +633,23 @@ sort__call_cmp(struct hist_entry *left, struct hist_entry *right)
 }
 
 static size_t
-sort__call_print(FILE *fp, struct hist_entry *self)
+sort__parent_print(FILE *fp, struct hist_entry *self)
 {
 	size_t ret = 0;
 
-	ret += fprintf(fp, "%-20s", self->call ? self->call->name : "[unmatched]");
+	ret += fprintf(fp, "%-20s", self->parent ? self->parent->name : "[other]");
 
 	return ret;
 }
 
-static struct sort_entry sort_call = {
-	.header = "Callchain symbol    ",
-	.cmp	= sort__call_cmp,
-	.print	= sort__call_print,
+static struct sort_entry sort_parent = {
+	.header = "Parent symbol       ",
+	.cmp	= sort__parent_cmp,
+	.print	= sort__parent_print,
 };
 
 static int sort__need_collapse = 0;
-static int sort__has_call = 0;
+static int sort__has_parent = 0;
 
 struct sort_dimension {
 	char			*name;
@@ -662,7 +662,7 @@ static struct sort_dimension sort_dimensions[] = {
 	{ .name = "comm",	.entry = &sort_comm,	},
 	{ .name = "dso",	.entry = &sort_dso,	},
 	{ .name = "symbol",	.entry = &sort_sym,	},
-	{ .name = "call",	.entry = &sort_call,	},
+	{ .name = "parent",	.entry = &sort_parent,	},
 };
 
 static LIST_HEAD(hist_entry__sort_list);
@@ -683,16 +683,17 @@ static int sort_dimension__add(char *tok)
 		if (sd->entry->collapse)
 			sort__need_collapse = 1;
 
-		if (sd->entry == &sort_call) {
-			int ret = regcomp(&call_regex, call, REG_EXTENDED);
+		if (sd->entry == &sort_parent) {
+			int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED);
 			if (ret) {
 				char err[BUFSIZ];
 
-				regerror(ret, &call_regex, err, sizeof(err));
-				fprintf(stderr, "Invalid regex: %s\n%s", call, err);
+				regerror(ret, &parent_regex, err, sizeof(err));
+				fprintf(stderr, "Invalid regex: %s\n%s",
+					parent_pattern, err);
 				exit(-1);
 			}
-			sort__has_call = 1;
+			sort__has_parent = 1;
 		}
 
 		list_add_tail(&sd->entry->list, &hist_entry__sort_list);
@@ -831,7 +832,7 @@ static struct symbol *call__match(struct symbol *sym)
 	if (!sym)
 		return NULL;
 
-	if (sym->name && !regexec(&call_regex, sym->name, 0, NULL, 0))
+	if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
 		return sym;
 
 	return NULL;
@@ -844,7 +845,7 @@ static struct symbol *call__match(struct symbol *sym)
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		struct symbol *sym, __u64 ip, struct ip_chain_event *chain,
-	       	char level, __u64 count)
+		char level, __u64 count)
 {
 	struct rb_node **p = &hist.rb_node;
 	struct rb_node *parent = NULL;
@@ -860,7 +861,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 	};
 	int cmp;
 
-	if (sort__has_call && chain) {
+	if (sort__has_parent && chain) {
 		int i, nr = chain->hv;
 		struct symbol *sym;
 		struct dso *dso;
@@ -870,22 +871,22 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 			ip = chain->ips[nr + i];
 			dso = kernel_dso;
 			sym = resolve_symbol(thread, NULL, &dso, &ip);
-			entry.call = call__match(sym);
-			if (entry.call)
-				goto got_call;
+			entry.parent = call__match(sym);
+			if (entry.parent)
+				goto got_parent;
 		}
 		nr += i;
 
 		for (i = 0; i < chain->user; i++) {
 			ip = chain->ips[nr + i];
 			sym = resolve_symbol(thread, NULL, NULL, &ip);
-			entry.call = call__match(sym);
-			if (entry.call)
-				goto got_call;
+			entry.parent = call__match(sym);
+			if (entry.parent)
+				goto got_parent;
 		}
 		nr += i;
 	}
-got_call:
+got_parent:
 
 	while (*p != NULL) {
 		parent = *p;
@@ -1457,11 +1458,11 @@ static const struct option options[] = {
 		    "dump raw trace in ASCII"),
 	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-		   "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
+		   "sort by key(s): pid, comm, dso, symbol, parent"),
 	OPT_BOOLEAN('P', "full-paths", &full_paths,
 		    "Don't shorten the pathnames taking into account the cwd"),
-	OPT_STRING('c', "call", &call, "regex",
-		   "regex to use for --sort call"),
+	OPT_STRING('p', "parent", &parent_pattern, "regex",
+		   "regex filter to identify parent, see: '--sort parent'"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Add validation of call-chain entries
       [not found]             ` <new-submission>
                                 ` (230 preceding siblings ...)
  2009-06-18  6:27               ` [tip:perfcounters/core] perf report: Tidy up the "--parent <regex>" and "--sort parent" call-chain features tip-bot for Ingo Molnar
@ 2009-06-18  7:21               ` tip-bot for Ingo Molnar
  2009-06-18  7:45               ` [tip:perfcounters/core] perf_counter tools: Add and use isprint() tip-bot for Peter Zijlstra
                                 ` (475 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-18  7:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  7522060c95395f479ee4a6af3bbf9e097e92e48f
Gitweb:     http://git.kernel.org/tip/7522060c95395f479ee4a6af3bbf9e097e92e48f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 18 Jun 2009 08:00:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 08:15:47 +0200

perf report: Add validation of call-chain entries

Add boundary checks for call-chain events. In case of corrupted
entries we could crash otherwise.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   20 ++++++------
 tools/perf/builtin-report.c  |   74 ++++++++++++++++++++++++++----------------
 2 files changed, 56 insertions(+), 38 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index eccae43..a7d3a61 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -337,6 +337,16 @@ enum perf_event_type {
 	 */
 };
 
+#define MAX_STACK_DEPTH			255
+
+struct perf_callchain_entry {
+	__u16				nr;
+	__u16				hv;
+	__u16				kernel;
+	__u16				user;
+	__u64				ip[MAX_STACK_DEPTH];
+};
+
 #ifdef __KERNEL__
 /*
  * Kernel-internal data types and definitions:
@@ -652,16 +662,6 @@ extern void perf_counter_fork(struct task_struct *tsk);
 
 extern void perf_counter_task_migration(struct task_struct *task, int cpu);
 
-#define MAX_STACK_DEPTH			255
-
-struct perf_callchain_entry {
-	u16				nr;
-	u16				hv;
-	u16				kernel;
-	u16				user;
-	u64				ip[MAX_STACK_DEPTH];
-};
-
 extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
 
 extern int sysctl_perf_counter_paranoid;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 9868346..e14e986 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -39,6 +39,8 @@ static int		dump_trace = 0;
 #define cdprintf(x...)	do { if (dump_trace) color_fprintf(stdout, color, x); } while (0)
 
 static int		verbose;
+#define eprintf(x...)	do { if (verbose) fprintf(stderr, x); } while (0)
+
 static int		full_paths;
 
 static unsigned long	page_size;
@@ -47,14 +49,6 @@ static unsigned long	mmap_window = 32;
 static char		*parent_pattern = "^sys_|^do_page_fault";
 static regex_t		parent_regex;
 
-struct ip_chain_event {
-	__u16 nr;
-	__u16 hv;
-	__u16 kernel;
-	__u16 user;
-	__u64 ips[];
-};
-
 struct ip_event {
 	struct perf_event_header header;
 	__u64 ip;
@@ -131,15 +125,11 @@ static struct dso *dsos__findnew(const char *name)
 
 	nr = dso__load(dso, NULL, verbose);
 	if (nr < 0) {
-		if (verbose)
-			fprintf(stderr, "Failed to open: %s\n", name);
+		eprintf("Failed to open: %s\n", name);
 		goto out_delete_dso;
 	}
-	if (!nr && verbose) {
-		fprintf(stderr,
-		"No symbols found in: %s, maybe install a debug package?\n",
-				name);
-	}
+	if (!nr)
+		eprintf("No symbols found in: %s, maybe install a debug package?\n", name);
 
 	dsos__add(dso);
 
@@ -844,7 +834,7 @@ static struct symbol *call__match(struct symbol *sym)
 
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
-		struct symbol *sym, __u64 ip, struct ip_chain_event *chain,
+		struct symbol *sym, __u64 ip, struct perf_callchain_entry *chain,
 		char level, __u64 count)
 {
 	struct rb_node **p = &hist.rb_node;
@@ -868,7 +858,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		__u64 ip;
 
 		for (i = 0; i < chain->kernel; i++) {
-			ip = chain->ips[nr + i];
+			ip = chain->ip[nr + i];
 			dso = kernel_dso;
 			sym = resolve_symbol(thread, NULL, &dso, &ip);
 			entry.parent = call__match(sym);
@@ -878,7 +868,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		nr += i;
 
 		for (i = 0; i < chain->user; i++) {
-			ip = chain->ips[nr + i];
+			ip = chain->ip[nr + i];
 			sym = resolve_symbol(thread, NULL, NULL, &ip);
 			entry.parent = call__match(sym);
 			if (entry.parent)
@@ -1080,6 +1070,30 @@ static unsigned long total = 0,
 		     total_fork = 0,
 		     total_unknown = 0;
 
+static int validate_chain(struct perf_callchain_entry *chain, event_t *event)
+{
+	unsigned int chain_size;
+
+	if (chain->nr > MAX_STACK_DEPTH)
+		return -1;
+	if (chain->hv > MAX_STACK_DEPTH)
+		return -1;
+	if (chain->kernel > MAX_STACK_DEPTH)
+		return -1;
+	if (chain->user > MAX_STACK_DEPTH)
+		return -1;
+	if (chain->hv + chain->kernel + chain->user != chain->nr)
+		return -1;
+
+	chain_size = event->header.size;
+	chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event;
+
+	if (chain->nr*sizeof(__u64) > chain_size)
+		return -1;
+
+	return 0;
+}
+
 static int
 process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 {
@@ -1091,7 +1105,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	__u64 period = 1;
 	struct map *map = NULL;
 	void *more_data = event->ip.__more_data;
-	struct ip_chain_event *chain = NULL;
+	struct perf_callchain_entry *chain = NULL;
 
 	if (event->header.type & PERF_SAMPLE_PERIOD) {
 		period = *(__u64 *)more_data;
@@ -1111,21 +1125,26 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 
 		chain = (void *)more_data;
 
-		if (dump_trace) {
-			dprintf("... chain: u:%d, k:%d, nr:%d\n",
-				chain->user,
-				chain->kernel,
-				chain->nr);
+		dprintf("... chain: u:%d, k:%d, nr:%d\n",
+			chain->user,
+			chain->kernel,
+			chain->nr);
 
+		if (validate_chain(chain, event) < 0) {
+			eprintf("call-chain problem with event, skipping it.\n");
+			return 0;
+		}
+
+		if (dump_trace) {
 			for (i = 0; i < chain->nr; i++)
-				dprintf("..... %2d: %016Lx\n", i, chain->ips[i]);
+				dprintf("..... %2d: %016Lx\n", i, chain->ip[i]);
 		}
 	}
 
 	dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
 
 	if (thread == NULL) {
-		fprintf(stderr, "problem processing %d event, skipping it.\n",
+		eprintf("problem processing %d event, skipping it.\n",
 			event->header.type);
 		return -1;
 	}
@@ -1153,8 +1172,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 		struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip);
 
 		if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
-			fprintf(stderr,
-		"problem incrementing symbol count, skipping event\n");
+			eprintf("problem incrementing symbol count, skipping event\n");
 			return -1;
 		}
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add and use isprint()
       [not found]             ` <new-submission>
                                 ` (231 preceding siblings ...)
  2009-06-18  7:21               ` [tip:perfcounters/core] perf report: Add validation of call-chain entries tip-bot for Ingo Molnar
@ 2009-06-18  7:45               ` tip-bot for Peter Zijlstra
  2009-06-18  7:48               ` tip-bot for Peter Zijlstra
                                 ` (474 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-18  7:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  712d1cea920d7590ba9602f3dc27da4e9c612e12
Gitweb:     http://git.kernel.org/tip/712d1cea920d7590ba9602f3dc27da4e9c612e12
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 09:44:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 09:44:20 +0200

perf_counter tools: Add and use isprint()

Introduce isprint() to print out raw event dumps to ASCII, etc.

(This is an extension to upstream Git's ctype.c.)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    2 +-
 tools/perf/util/ctype.c     |   17 +++++++++++------
 tools/perf/util/util.h      |   14 ++++++++------
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index e14e986..9a3805f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1285,7 +1285,7 @@ static void trace_event(event_t *event)
 			for (j = 0; j < 15-(i & 15); j++)
 				cdprintf("   ");
 			for (j = 0; j < (i & 15); j++) {
-				if (issane(raw_event[i-15+j]))
+				if (isprint(raw_event[i-15+j]))
 					cdprintf("%c", raw_event[i-15+j]);
 				else
 					cdprintf(".");
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c
index b90ec00..0b791bd 100644
--- a/tools/perf/util/ctype.c
+++ b/tools/perf/util/ctype.c
@@ -11,16 +11,21 @@ enum {
 	D = GIT_DIGIT,
 	G = GIT_GLOB_SPECIAL,	/* *, ?, [, \\ */
 	R = GIT_REGEX_SPECIAL,	/* $, (, ), +, ., ^, {, | * */
+	P = GIT_PRINT_EXTRA,	/* printable - alpha - digit - glob - regex */
+
+	PS = GIT_SPACE | GIT_PRINT_EXTRA,
 };
 
 unsigned char sane_ctype[256] = {
+/*	0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F			    */
+
 	0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0,		/*   0.. 15 */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		/*  16.. 31 */
-	S, 0, 0, 0, R, 0, 0, 0, R, R, G, R, 0, 0, R, 0,		/*  32.. 47 */
-	D, D, D, D, D, D, D, D, D, D, 0, 0, 0, 0, 0, G,		/*  48.. 63 */
-	0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  64.. 79 */
-	A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, 0,		/*  80.. 95 */
-	0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  96..111 */
-	A, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0,		/* 112..127 */
+	PS,P, P, P, R, P, P, P, R, R, G, R, P, P, R, P,		/*  32.. 47 */
+	D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G,		/*  48.. 63 */
+	P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  64.. 79 */
+	A, A, A, A, A, A, A, A, A, A, A, G, G, P, R, P,		/*  80.. 95 */
+	P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  96..111 */
+	A, A, A, A, A, A, A, A, A, A, A, R, R, P, P, 0,		/* 112..127 */
 	/* Nothing in the 128.. range */
 };
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index ce9b514..e270258 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -332,18 +332,20 @@ static inline int has_extension(const char *filename, const char *ext)
 #undef tolower
 #undef toupper
 extern unsigned char sane_ctype[256];
-#define GIT_SPACE 0x01
-#define GIT_DIGIT 0x02
-#define GIT_ALPHA 0x04
-#define GIT_GLOB_SPECIAL 0x08
-#define GIT_REGEX_SPECIAL 0x10
+#define GIT_SPACE		0x01
+#define GIT_DIGIT		0x02
+#define GIT_ALPHA		0x04
+#define GIT_GLOB_SPECIAL	0x08
+#define GIT_REGEX_SPECIAL	0x10
+#define GIT_PRINT_EXTRA		0x20
+#define GIT_PRINT		0x3E
 #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
 #define isascii(x) (((x) & ~0x7f) == 0)
 #define isspace(x) sane_istest(x,GIT_SPACE)
 #define isdigit(x) sane_istest(x,GIT_DIGIT)
 #define isalpha(x) sane_istest(x,GIT_ALPHA)
 #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
-#define issane(x)  sane_istest(x,GIT_SPACE | GIT_DIGIT | GIT_ALPHA | GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
+#define isprint(x) sane_istest(x,GIT_PRINT)
 #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
 #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
 #define tolower(x) sane_case((unsigned char)(x), 0x20)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add and use isprint()
       [not found]             ` <new-submission>
                                 ` (232 preceding siblings ...)
  2009-06-18  7:45               ` [tip:perfcounters/core] perf_counter tools: Add and use isprint() tip-bot for Peter Zijlstra
@ 2009-06-18  7:48               ` tip-bot for Peter Zijlstra
  2009-06-18 12:50               ` [tip:perfcounters/core] fs: Provide empty .set_page_dirty() aop for anon inodes tip-bot for Peter Zijlstra
                                 ` (473 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-18  7:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  a73c7d84a1975b44c0ebd03c2dec288af1426349
Gitweb:     http://git.kernel.org/tip/a73c7d84a1975b44c0ebd03c2dec288af1426349
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 09:44:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 09:46:00 +0200

perf_counter tools: Add and use isprint()

Introduce isprint() to print out raw event dumps to ASCII, etc.

(This is an extension to upstream Git's ctype.c.)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
[ removed openssl.h inclusion from util.h - it leaked ctype.h ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    2 +-
 tools/perf/util/ctype.c     |   17 +++++++++++------
 tools/perf/util/util.h      |   19 ++++++++-----------
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index e14e986..9a3805f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1285,7 +1285,7 @@ static void trace_event(event_t *event)
 			for (j = 0; j < 15-(i & 15); j++)
 				cdprintf("   ");
 			for (j = 0; j < (i & 15); j++) {
-				if (issane(raw_event[i-15+j]))
+				if (isprint(raw_event[i-15+j]))
 					cdprintf("%c", raw_event[i-15+j]);
 				else
 					cdprintf(".");
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c
index b90ec00..0b791bd 100644
--- a/tools/perf/util/ctype.c
+++ b/tools/perf/util/ctype.c
@@ -11,16 +11,21 @@ enum {
 	D = GIT_DIGIT,
 	G = GIT_GLOB_SPECIAL,	/* *, ?, [, \\ */
 	R = GIT_REGEX_SPECIAL,	/* $, (, ), +, ., ^, {, | * */
+	P = GIT_PRINT_EXTRA,	/* printable - alpha - digit - glob - regex */
+
+	PS = GIT_SPACE | GIT_PRINT_EXTRA,
 };
 
 unsigned char sane_ctype[256] = {
+/*	0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F			    */
+
 	0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0,		/*   0.. 15 */
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		/*  16.. 31 */
-	S, 0, 0, 0, R, 0, 0, 0, R, R, G, R, 0, 0, R, 0,		/*  32.. 47 */
-	D, D, D, D, D, D, D, D, D, D, 0, 0, 0, 0, 0, G,		/*  48.. 63 */
-	0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  64.. 79 */
-	A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, 0,		/*  80.. 95 */
-	0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  96..111 */
-	A, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0,		/* 112..127 */
+	PS,P, P, P, R, P, P, P, R, R, G, R, P, P, R, P,		/*  32.. 47 */
+	D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G,		/*  48.. 63 */
+	P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  64.. 79 */
+	A, A, A, A, A, A, A, A, A, A, A, G, G, P, R, P,		/*  80.. 95 */
+	P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,		/*  96..111 */
+	A, A, A, A, A, A, A, A, A, A, A, R, R, P, P, 0,		/* 112..127 */
 	/* Nothing in the 128.. range */
 };
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index ce9b514..b8cfed7 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -100,11 +100,6 @@
 #include <iconv.h>
 #endif
 
-#ifndef NO_OPENSSL
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#endif
-
 /* On most systems <limits.h> would have given us this, but
  * not on some systems (e.g. GNU/Hurd).
  */
@@ -332,18 +327,20 @@ static inline int has_extension(const char *filename, const char *ext)
 #undef tolower
 #undef toupper
 extern unsigned char sane_ctype[256];
-#define GIT_SPACE 0x01
-#define GIT_DIGIT 0x02
-#define GIT_ALPHA 0x04
-#define GIT_GLOB_SPECIAL 0x08
-#define GIT_REGEX_SPECIAL 0x10
+#define GIT_SPACE		0x01
+#define GIT_DIGIT		0x02
+#define GIT_ALPHA		0x04
+#define GIT_GLOB_SPECIAL	0x08
+#define GIT_REGEX_SPECIAL	0x10
+#define GIT_PRINT_EXTRA		0x20
+#define GIT_PRINT		0x3E
 #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
 #define isascii(x) (((x) & ~0x7f) == 0)
 #define isspace(x) sane_istest(x,GIT_SPACE)
 #define isdigit(x) sane_istest(x,GIT_DIGIT)
 #define isalpha(x) sane_istest(x,GIT_ALPHA)
 #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
-#define issane(x)  sane_istest(x,GIT_SPACE | GIT_DIGIT | GIT_ALPHA | GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
+#define isprint(x) sane_istest(x,GIT_PRINT)
 #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
 #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
 #define tolower(x) sane_case((unsigned char)(x), 0x20)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] fs: Provide empty .set_page_dirty() aop for anon inodes
       [not found]             ` <new-submission>
                                 ` (233 preceding siblings ...)
  2009-06-18  7:48               ` tip-bot for Peter Zijlstra
@ 2009-06-18 12:50               ` tip-bot for Peter Zijlstra
  2009-06-18 12:50               ` [tip:perfcounters/core] perf_counter: Add event overlow handling tip-bot for Peter Zijlstra
                                 ` (472 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-18 12:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, davidel, a.p.zijlstra, tglx, viro,
	mingo

Commit-ID:  d3a9262e59f7fb83c6d44df3b2b1460ed57d3ea1
Gitweb:     http://git.kernel.org/tip/d3a9262e59f7fb83c6d44df3b2b1460ed57d3ea1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 12:54:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 14:46:10 +0200

fs: Provide empty .set_page_dirty() aop for anon inodes

.set_page_dirty() is one of those a_ops that defaults to the
buffer implementation when not set. Therefore provide a dummy
function to make it do nothing.

(Uncovered by perfcounters fd's which can now be writable-mmap-ed.)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Davide Libenzi <davidel@xmailserver.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 fs/anon_inodes.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 1dd96d4..47d4a01 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -52,6 +52,19 @@ static const struct dentry_operations anon_inodefs_dentry_operations = {
 	.d_delete	= anon_inodefs_delete_dentry,
 };
 
+/*
+ * nop .set_page_dirty method so that people can use .page_mkwrite on
+ * anon inodes.
+ */
+static int anon_set_page_dirty(struct page *page)
+{
+	return 0;
+};
+
+static const struct address_space_operations anon_aops = {
+	.set_page_dirty = anon_set_page_dirty,
+};
+
 /**
  * anon_inode_getfd - creates a new file instance by hooking it up to an
  *                    anonymous inode, and a dentry that describe the "class"
@@ -151,6 +164,8 @@ static struct inode *anon_inode_mkinode(void)
 
 	inode->i_fop = &anon_inode_fops;
 
+	inode->i_mapping->a_ops = &anon_aops;
+
 	/*
 	 * Mark the inode dirty from the very beginning,
 	 * that way it will never be moved to the dirty

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Add event overlow handling
       [not found]             ` <new-submission>
                                 ` (234 preceding siblings ...)
  2009-06-18 12:50               ` [tip:perfcounters/core] fs: Provide empty .set_page_dirty() aop for anon inodes tip-bot for Peter Zijlstra
@ 2009-06-18 12:50               ` tip-bot for Peter Zijlstra
  2009-06-18 12:50               ` [tip:perfcounters/core] perf_counter tools: Handle lost events tip-bot for Peter Zijlstra
                                 ` (471 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-18 12:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  43a21ea81a2400992561146327c4785ce7f7be38
Gitweb:     http://git.kernel.org/tip/43a21ea81a2400992561146327c4785ce7f7be38
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 25 Mar 2009 19:39:37 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 14:46:11 +0200

perf_counter: Add event overlow handling

Alternative method of mmap() data output handling that provides
better overflow management and a more reliable data stream.

Unlike the previous method, that didn't have any user->kernel
feedback and relied on userspace keeping up, this method relies on
userspace writing its last read position into the control page.

It will ensure new output doesn't overwrite not-yet read events,
new events for which there is no space left are lost and the
overflow counter is incremented, providing exact event loss
numbers.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   40 +++++++---
 kernel/perf_counter.c        |  185 +++++++++++++++++++++++++++++-------------
 2 files changed, 158 insertions(+), 67 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index a7d3a61..0765e8e 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -236,10 +236,16 @@ struct perf_counter_mmap_page {
 	/*
 	 * Control data for the mmap() data buffer.
 	 *
-	 * User-space reading this value should issue an rmb(), on SMP capable
-	 * platforms, after reading this value -- see perf_counter_wakeup().
+	 * User-space reading the @data_head value should issue an rmb(), on
+	 * SMP capable platforms, after reading this value -- see
+	 * perf_counter_wakeup().
+	 *
+	 * When the mapping is PROT_WRITE the @data_tail value should be
+	 * written by userspace to reflect the last read data. In this case
+	 * the kernel will not over-write unread data.
 	 */
 	__u64   data_head;		/* head in the data section */
+	__u64	data_tail;		/* user-space written tail */
 };
 
 #define PERF_EVENT_MISC_CPUMODE_MASK		(3 << 0)
@@ -275,6 +281,15 @@ enum perf_event_type {
 
 	/*
 	 * struct {
+	 * 	struct perf_event_header	header;
+	 * 	u64				id;
+	 * 	u64				lost;
+	 * };
+	 */
+	PERF_EVENT_LOST			= 2,
+
+	/*
+	 * struct {
 	 *	struct perf_event_header	header;
 	 *
 	 *	u32				pid, tid;
@@ -313,26 +328,26 @@ enum perf_event_type {
 
 	/*
 	 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
-	 * will be PERF_RECORD_*
+	 * will be PERF_SAMPLE_*
 	 *
 	 * struct {
 	 *	struct perf_event_header	header;
 	 *
-	 *	{ u64			ip;	  } && PERF_RECORD_IP
-	 *	{ u32			pid, tid; } && PERF_RECORD_TID
-	 *	{ u64			time;     } && PERF_RECORD_TIME
-	 *	{ u64			addr;     } && PERF_RECORD_ADDR
-	 *	{ u64			config;   } && PERF_RECORD_CONFIG
-	 *	{ u32			cpu, res; } && PERF_RECORD_CPU
+	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
+	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
+	 *	{ u64			time;     } && PERF_SAMPLE_TIME
+	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
+	 *	{ u64			config;   } && PERF_SAMPLE_CONFIG
+	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
 	 *
 	 *	{ u64			nr;
-	 *	  { u64 id, val; }	cnt[nr];  } && PERF_RECORD_GROUP
+	 *	  { u64 id, val; }	cnt[nr];  } && PERF_SAMPLE_GROUP
 	 *
 	 *	{ u16			nr,
 	 *				hv,
 	 *				kernel,
 	 *				user;
-	 *	  u64			ips[nr];  } && PERF_RECORD_CALLCHAIN
+	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
 	 * };
 	 */
 };
@@ -424,6 +439,7 @@ struct file;
 struct perf_mmap_data {
 	struct rcu_head			rcu_head;
 	int				nr_pages;	/* nr of data pages  */
+	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
@@ -433,8 +449,8 @@ struct perf_mmap_data {
 	atomic_long_t			done_head;	/* completed head    */
 
 	atomic_t			lock;		/* concurrent writes */
-
 	atomic_t			wakeup;		/* needs a wakeup    */
+	atomic_t			lost;		/* nr records lost   */
 
 	struct perf_counter_mmap_page   *user_page;
 	void				*data_pages[0];
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 109a957..7e9108e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1794,6 +1794,12 @@ static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	struct perf_mmap_data *data;
 	int ret = VM_FAULT_SIGBUS;
 
+	if (vmf->flags & FAULT_FLAG_MKWRITE) {
+		if (vmf->pgoff == 0)
+			ret = 0;
+		return ret;
+	}
+
 	rcu_read_lock();
 	data = rcu_dereference(counter->data);
 	if (!data)
@@ -1807,9 +1813,16 @@ static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 		if ((unsigned)nr > data->nr_pages)
 			goto unlock;
 
+		if (vmf->flags & FAULT_FLAG_WRITE)
+			goto unlock;
+
 		vmf->page = virt_to_page(data->data_pages[nr]);
 	}
+
 	get_page(vmf->page);
+	vmf->page->mapping = vma->vm_file->f_mapping;
+	vmf->page->index   = vmf->pgoff;
+
 	ret = 0;
 unlock:
 	rcu_read_unlock();
@@ -1862,6 +1875,14 @@ fail:
 	return -ENOMEM;
 }
 
+static void perf_mmap_free_page(unsigned long addr)
+{
+	struct page *page = virt_to_page(addr);
+
+	page->mapping = NULL;
+	__free_page(page);
+}
+
 static void __perf_mmap_data_free(struct rcu_head *rcu_head)
 {
 	struct perf_mmap_data *data;
@@ -1869,9 +1890,10 @@ static void __perf_mmap_data_free(struct rcu_head *rcu_head)
 
 	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
 
-	free_page((unsigned long)data->user_page);
+	perf_mmap_free_page((unsigned long)data->user_page);
 	for (i = 0; i < data->nr_pages; i++)
-		free_page((unsigned long)data->data_pages[i]);
+		perf_mmap_free_page((unsigned long)data->data_pages[i]);
+
 	kfree(data);
 }
 
@@ -1908,9 +1930,10 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 }
 
 static struct vm_operations_struct perf_mmap_vmops = {
-	.open  = perf_mmap_open,
-	.close = perf_mmap_close,
-	.fault = perf_mmap_fault,
+	.open		= perf_mmap_open,
+	.close		= perf_mmap_close,
+	.fault		= perf_mmap_fault,
+	.page_mkwrite	= perf_mmap_fault,
 };
 
 static int perf_mmap(struct file *file, struct vm_area_struct *vma)
@@ -1924,7 +1947,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	long user_extra, extra;
 	int ret = 0;
 
-	if (!(vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_WRITE))
+	if (!(vma->vm_flags & VM_SHARED))
 		return -EINVAL;
 
 	vma_size = vma->vm_end - vma->vm_start;
@@ -1983,10 +2006,12 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	atomic_long_add(user_extra, &user->locked_vm);
 	vma->vm_mm->locked_vm += extra;
 	counter->data->nr_locked = extra;
+	if (vma->vm_flags & VM_WRITE)
+		counter->data->writable = 1;
+
 unlock:
 	mutex_unlock(&counter->mmap_mutex);
 
-	vma->vm_flags &= ~VM_MAYWRITE;
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_ops = &perf_mmap_vmops;
 
@@ -2163,11 +2188,38 @@ struct perf_output_handle {
 	unsigned long		head;
 	unsigned long		offset;
 	int			nmi;
-	int			overflow;
+	int			sample;
 	int			locked;
 	unsigned long		flags;
 };
 
+static bool perf_output_space(struct perf_mmap_data *data,
+			      unsigned int offset, unsigned int head)
+{
+	unsigned long tail;
+	unsigned long mask;
+
+	if (!data->writable)
+		return true;
+
+	mask = (data->nr_pages << PAGE_SHIFT) - 1;
+	/*
+	 * Userspace could choose to issue a mb() before updating the tail
+	 * pointer. So that all reads will be completed before the write is
+	 * issued.
+	 */
+	tail = ACCESS_ONCE(data->user_page->data_tail);
+	smp_rmb();
+
+	offset = (offset - tail) & mask;
+	head   = (head   - tail) & mask;
+
+	if ((int)(head - offset) < 0)
+		return false;
+
+	return true;
+}
+
 static void perf_output_wakeup(struct perf_output_handle *handle)
 {
 	atomic_set(&handle->data->poll, POLL_IN);
@@ -2258,12 +2310,57 @@ out:
 	local_irq_restore(handle->flags);
 }
 
+static void perf_output_copy(struct perf_output_handle *handle,
+			     const void *buf, unsigned int len)
+{
+	unsigned int pages_mask;
+	unsigned int offset;
+	unsigned int size;
+	void **pages;
+
+	offset		= handle->offset;
+	pages_mask	= handle->data->nr_pages - 1;
+	pages		= handle->data->data_pages;
+
+	do {
+		unsigned int page_offset;
+		int nr;
+
+		nr	    = (offset >> PAGE_SHIFT) & pages_mask;
+		page_offset = offset & (PAGE_SIZE - 1);
+		size	    = min_t(unsigned int, PAGE_SIZE - page_offset, len);
+
+		memcpy(pages[nr] + page_offset, buf, size);
+
+		len	    -= size;
+		buf	    += size;
+		offset	    += size;
+	} while (len);
+
+	handle->offset = offset;
+
+	/*
+	 * Check we didn't copy past our reservation window, taking the
+	 * possible unsigned int wrap into account.
+	 */
+	WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0);
+}
+
+#define perf_output_put(handle, x) \
+	perf_output_copy((handle), &(x), sizeof(x))
+
 static int perf_output_begin(struct perf_output_handle *handle,
 			     struct perf_counter *counter, unsigned int size,
-			     int nmi, int overflow)
+			     int nmi, int sample)
 {
 	struct perf_mmap_data *data;
 	unsigned int offset, head;
+	int have_lost;
+	struct {
+		struct perf_event_header header;
+		u64			 id;
+		u64			 lost;
+	} lost_event;
 
 	/*
 	 * For inherited counters we send all the output towards the parent.
@@ -2276,19 +2373,25 @@ static int perf_output_begin(struct perf_output_handle *handle,
 	if (!data)
 		goto out;
 
-	handle->data	 = data;
-	handle->counter	 = counter;
-	handle->nmi	 = nmi;
-	handle->overflow = overflow;
+	handle->data	= data;
+	handle->counter	= counter;
+	handle->nmi	= nmi;
+	handle->sample	= sample;
 
 	if (!data->nr_pages)
 		goto fail;
 
+	have_lost = atomic_read(&data->lost);
+	if (have_lost)
+		size += sizeof(lost_event);
+
 	perf_output_lock(handle);
 
 	do {
 		offset = head = atomic_long_read(&data->head);
 		head += size;
+		if (unlikely(!perf_output_space(data, offset, head)))
+			goto fail;
 	} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
 
 	handle->offset	= offset;
@@ -2297,55 +2400,27 @@ static int perf_output_begin(struct perf_output_handle *handle,
 	if ((offset >> PAGE_SHIFT) != (head >> PAGE_SHIFT))
 		atomic_set(&data->wakeup, 1);
 
+	if (have_lost) {
+		lost_event.header.type = PERF_EVENT_LOST;
+		lost_event.header.misc = 0;
+		lost_event.header.size = sizeof(lost_event);
+		lost_event.id          = counter->id;
+		lost_event.lost        = atomic_xchg(&data->lost, 0);
+
+		perf_output_put(handle, lost_event);
+	}
+
 	return 0;
 
 fail:
-	perf_output_wakeup(handle);
+	atomic_inc(&data->lost);
+	perf_output_unlock(handle);
 out:
 	rcu_read_unlock();
 
 	return -ENOSPC;
 }
 
-static void perf_output_copy(struct perf_output_handle *handle,
-			     const void *buf, unsigned int len)
-{
-	unsigned int pages_mask;
-	unsigned int offset;
-	unsigned int size;
-	void **pages;
-
-	offset		= handle->offset;
-	pages_mask	= handle->data->nr_pages - 1;
-	pages		= handle->data->data_pages;
-
-	do {
-		unsigned int page_offset;
-		int nr;
-
-		nr	    = (offset >> PAGE_SHIFT) & pages_mask;
-		page_offset = offset & (PAGE_SIZE - 1);
-		size	    = min_t(unsigned int, PAGE_SIZE - page_offset, len);
-
-		memcpy(pages[nr] + page_offset, buf, size);
-
-		len	    -= size;
-		buf	    += size;
-		offset	    += size;
-	} while (len);
-
-	handle->offset = offset;
-
-	/*
-	 * Check we didn't copy past our reservation window, taking the
-	 * possible unsigned int wrap into account.
-	 */
-	WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0);
-}
-
-#define perf_output_put(handle, x) \
-	perf_output_copy((handle), &(x), sizeof(x))
-
 static void perf_output_end(struct perf_output_handle *handle)
 {
 	struct perf_counter *counter = handle->counter;
@@ -2353,7 +2428,7 @@ static void perf_output_end(struct perf_output_handle *handle)
 
 	int wakeup_events = counter->attr.wakeup_events;
 
-	if (handle->overflow && wakeup_events) {
+	if (handle->sample && wakeup_events) {
 		int events = atomic_inc_return(&data->events);
 		if (events >= wakeup_events) {
 			atomic_sub(wakeup_events, &data->events);
@@ -2958,7 +3033,7 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
 }
 
 /*
- * Generic counter overflow handling.
+ * Generic counter overflow handling, sampling.
  */
 
 int perf_counter_overflow(struct perf_counter *counter, int nmi,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Handle lost events
       [not found]             ` <new-submission>
                                 ` (235 preceding siblings ...)
  2009-06-18 12:50               ` [tip:perfcounters/core] perf_counter: Add event overlow handling tip-bot for Peter Zijlstra
@ 2009-06-18 12:50               ` tip-bot for Peter Zijlstra
  2009-06-18 21:17                 ` Corey Ashford
  2009-06-18 13:39               ` [tip:perfcounters/core] perf report: Filter to parent set by default tip-bot for Ingo Molnar
                                 ` (470 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-18 12:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  9d91a6f7a489eb914c16b82d927f9d81d629c259
Gitweb:     http://git.kernel.org/tip/9d91a6f7a489eb914c16b82d927f9d81d629c259
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 11:40:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 14:46:11 +0200

perf_counter tools: Handle lost events

Make use of the new ->data_tail mechanism to tell kernel-space
about user-space draining the data stream. Emit lost events
(and display them) if they happen.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   20 ++++++++++++++++----
 tools/perf/builtin-report.c |   29 ++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e1dfef2..06fdfb8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -78,10 +78,10 @@ struct mmap_data {
 
 static struct mmap_data		mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 
-static unsigned int mmap_read_head(struct mmap_data *md)
+static unsigned long mmap_read_head(struct mmap_data *md)
 {
 	struct perf_counter_mmap_page *pc = md->base;
-	int head;
+	long head;
 
 	head = pc->data_head;
 	rmb();
@@ -89,6 +89,17 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 	return head;
 }
 
+static void mmap_write_tail(struct mmap_data *md, unsigned long tail)
+{
+	struct perf_counter_mmap_page *pc = md->base;
+
+	/*
+	 * ensure all reads are done before we write the tail out.
+	 */
+	/* mb(); */
+	pc->data_tail = tail;
+}
+
 static void mmap_read(struct mmap_data *md)
 {
 	unsigned int head = mmap_read_head(md);
@@ -109,7 +120,7 @@ static void mmap_read(struct mmap_data *md)
 	 * In either case, truncate and restart at head.
 	 */
 	diff = head - old;
-	if (diff > md->mask / 2 || diff < 0) {
+	if (diff < 0) {
 		struct timeval iv;
 		unsigned long msecs;
 
@@ -167,6 +178,7 @@ static void mmap_read(struct mmap_data *md)
 	}
 
 	md->prev = old;
+	mmap_write_tail(md, old);
 }
 
 static volatile int done = 0;
@@ -424,7 +436,7 @@ try_again:
 	mmap_array[nr_cpu][counter].prev = 0;
 	mmap_array[nr_cpu][counter].mask = mmap_pages*page_size - 1;
 	mmap_array[nr_cpu][counter].base = mmap(NULL, (mmap_pages+1)*page_size,
-			PROT_READ, MAP_SHARED, fd[nr_cpu][counter], 0);
+			PROT_READ|PROT_WRITE, MAP_SHARED, fd[nr_cpu][counter], 0);
 	if (mmap_array[nr_cpu][counter].base == MAP_FAILED) {
 		error("failed to mmap with %d (%s)\n", errno, strerror(errno));
 		exit(-1);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 9a3805f..fe66895 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -83,6 +83,12 @@ struct period_event {
 	__u64 sample_period;
 };
 
+struct lost_event {
+	struct perf_event_header header;
+	__u64 id;
+	__u64 lost;
+};
+
 typedef union event_union {
 	struct perf_event_header	header;
 	struct ip_event			ip;
@@ -90,6 +96,7 @@ typedef union event_union {
 	struct comm_event		comm;
 	struct fork_event		fork;
 	struct period_event		period;
+	struct lost_event		lost;
 } event_t;
 
 static LIST_HEAD(dsos);
@@ -1068,7 +1075,8 @@ static unsigned long total = 0,
 		     total_mmap = 0,
 		     total_comm = 0,
 		     total_fork = 0,
-		     total_unknown = 0;
+		     total_unknown = 0,
+		     total_lost = 0;
 
 static int validate_chain(struct perf_callchain_entry *chain, event_t *event)
 {
@@ -1260,6 +1268,20 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
+static int
+process_lost_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->lost.id,
+		event->lost.lost);
+
+	total_lost += event->lost.lost;
+
+	return 0;
+}
+
 static void trace_event(event_t *event)
 {
 	unsigned char *raw_event = (void *)event;
@@ -1316,6 +1338,10 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 
 	case PERF_EVENT_PERIOD:
 		return process_period_event(event, offset, head);
+
+	case PERF_EVENT_LOST:
+		return process_lost_event(event, offset, head);
+
 	/*
 	 * We dont process them right now but they are fine:
 	 */
@@ -1444,6 +1470,7 @@ more:
 	dprintf("    mmap events: %10ld\n", total_mmap);
 	dprintf("    comm events: %10ld\n", total_comm);
 	dprintf("    fork events: %10ld\n", total_fork);
+	dprintf("    lost events: %10ld\n", total_lost);
 	dprintf(" unknown events: %10ld\n", total_unknown);
 
 	if (dump_trace)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf report: Filter to parent set by default
       [not found]             ` <new-submission>
                                 ` (236 preceding siblings ...)
  2009-06-18 12:50               ` [tip:perfcounters/core] perf_counter tools: Handle lost events tip-bot for Peter Zijlstra
@ 2009-06-18 13:39               ` tip-bot for Ingo Molnar
  2009-06-19 11:51               ` [tip:perfcounters/core] perf_counter: Make callchain samples extensible tip-bot for Peter Zijlstra
                                 ` (469 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-18 13:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  b8e6d829729d1a5991a9f628205b671cac2ec06f
Gitweb:     http://git.kernel.org/tip/b8e6d829729d1a5991a9f628205b671cac2ec06f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 18 Jun 2009 14:32:19 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 18 Jun 2009 14:32:19 +0200

perf report: Filter to parent set by default

Make it easier to use parent filtering - default to a filtered
output. Also add the parent column so that we get collapsing but
dont display it by default.

add --no-exclude-other to override this.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile         |    2 +-
 tools/perf/builtin-report.c |   30 +++++++++++++++++++++++++++---
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 714db73..672c5f0 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -164,7 +164,7 @@ endif
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6
+CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
 LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index fe66895..86981bd 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -46,9 +46,12 @@ static int		full_paths;
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
 
-static char		*parent_pattern = "^sys_|^do_page_fault";
+static char		default_parent_pattern[] = "^sys_|^do_page_fault";
+static char		*parent_pattern = default_parent_pattern;
 static regex_t		parent_regex;
 
+static int		exclude_other = 1;
+
 struct ip_event {
 	struct perf_event_header header;
 	__u64 ip;
@@ -742,6 +745,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
 	struct sort_entry *se;
 	size_t ret;
 
+	if (exclude_other && !self->parent)
+		return 0;
+
 	if (total_samples) {
 		double percent = self->count * 100.0 / total_samples;
 		char *color = PERF_COLOR_NORMAL;
@@ -764,6 +770,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
 		ret = fprintf(fp, "%12Ld ", self->count);
 
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		if (exclude_other && (se == &sort_parent))
+			continue;
+
 		fprintf(fp, "  ");
 		ret += se->print(fp, self);
 	}
@@ -855,6 +864,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 		.ip	= ip,
 		.level	= level,
 		.count	= count,
+		.parent = NULL,
 	};
 	int cmp;
 
@@ -1029,14 +1039,20 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
 	fprintf(fp, "#\n");
 
 	fprintf(fp, "# Overhead");
-	list_for_each_entry(se, &hist_entry__sort_list, list)
+	list_for_each_entry(se, &hist_entry__sort_list, list) {
+		if (exclude_other && (se == &sort_parent))
+			continue;
 		fprintf(fp, "  %s", se->header);
+	}
 	fprintf(fp, "\n");
 
 	fprintf(fp, "# ........");
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
 		int i;
 
+		if (exclude_other && (se == &sort_parent))
+			continue;
+
 		fprintf(fp, "  ");
 		for (i = 0; i < strlen(se->header); i++)
 			fprintf(fp, ".");
@@ -1050,7 +1066,8 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
 		ret += hist_entry__fprintf(fp, pos, total_samples);
 	}
 
-	if (!strcmp(sort_order, default_sort_order)) {
+	if (sort_order == default_sort_order &&
+			parent_pattern == default_parent_pattern) {
 		fprintf(fp, "#\n");
 		fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
 		fprintf(fp, "#\n");
@@ -1508,6 +1525,8 @@ static const struct option options[] = {
 		    "Don't shorten the pathnames taking into account the cwd"),
 	OPT_STRING('p', "parent", &parent_pattern, "regex",
 		   "regex filter to identify parent, see: '--sort parent'"),
+	OPT_BOOLEAN('x', "exclude-other", &exclude_other,
+		    "Only display entries with parent-match"),
 	OPT_END()
 };
 
@@ -1536,6 +1555,11 @@ int cmd_report(int argc, const char **argv, const char *prefix)
 
 	setup_sorting();
 
+	if (parent_pattern != default_parent_pattern)
+		sort_dimension__add("parent");
+	else
+		exclude_other = 0;
+
 	/*
 	 * Any (unrecognized) arguments left?
 	 */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter tools: Handle lost events
  2009-06-18 12:50               ` [tip:perfcounters/core] perf_counter tools: Handle lost events tip-bot for Peter Zijlstra
@ 2009-06-18 21:17                 ` Corey Ashford
  0 siblings, 0 replies; 1149+ messages in thread
From: Corey Ashford @ 2009-06-18 21:17 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits


tip-bot for Peter Zijlstra wrote:
> Commit-ID:  9d91a6f7a489eb914c16b82d927f9d81d629c259
> Gitweb:     http://git.kernel.org/tip/9d91a6f7a489eb914c16b82d927f9d81d629c259
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Thu, 18 Jun 2009 11:40:28 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Thu, 18 Jun 2009 14:46:11 +0200
> 
> perf_counter tools: Handle lost events
> 
> Make use of the new ->data_tail mechanism to tell kernel-space
> about user-space draining the data stream. Emit lost events
> (and display them) if they happen.
[snip]
> @@ -109,7 +120,7 @@ static void mmap_read(struct mmap_data *md)
>  	 * In either case, truncate and restart at head.
>  	 */
>  	diff = head - old;
> -	if (diff > md->mask / 2 || diff < 0) {
> +	if (diff < 0) {
>  		struct timeval iv;
>  		unsigned long msecs;
> 
[snip]

Hi Peter,

Very nice change.  One thing missing though on the above is an update to the 
comment which precedes snippet, which currently reads:

	/*
	 * If we're further behind than half the buffer, there's a chance
	 * the writer will bite our tail and mess up the samples under us.
	 *
	 * If we somehow ended up ahead of the head, we got messed up.
	 *
	 * In either case, truncate and restart at head.
	 */

The "further behind than half the buffer" no longer pertains.  Maybe:


	/*
	 * If we've gotten behind, truncate and restart at head.
	 */

Regards,

- Corey

Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
cjashfor@us.ibm.com


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Make callchain samples extensible
       [not found]             ` <new-submission>
                                 ` (237 preceding siblings ...)
  2009-06-18 13:39               ` [tip:perfcounters/core] perf report: Filter to parent set by default tip-bot for Ingo Molnar
@ 2009-06-19 11:51               ` tip-bot for Peter Zijlstra
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter: Update userspace callchain sampling uses tip-bot for Peter Zijlstra
                                 ` (468 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-19 11:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f9188e023c248d73f5b4a589b480e065c1864068
Gitweb:     http://git.kernel.org/tip/f9188e023c248d73f5b4a589b480e065c1864068
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 22:20:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 19 Jun 2009 13:42:34 +0200

perf_counter: Make callchain samples extensible

Before exposing upstream tools to a callchain-samples ABI, tidy it
up to make it more extensible in the future:

Use markers in the IP chain to denote context, use (u64)-1..-4095 range
for these context markers because we use them for ERR_PTR(), so these
addresses are unlikely to be mapped.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   29 ++++++-----------------------
 include/linux/perf_counter.h       |   28 +++++++++++++++++-----------
 2 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index ce1ae3f..76dfef2 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1555,9 +1555,9 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
  */
 
 static inline
-void callchain_store(struct perf_callchain_entry *entry, unsigned long ip)
+void callchain_store(struct perf_callchain_entry *entry, u64 ip)
 {
-	if (entry->nr < MAX_STACK_DEPTH)
+	if (entry->nr < PERF_MAX_STACK_DEPTH)
 		entry->ip[entry->nr++] = ip;
 }
 
@@ -1602,22 +1602,10 @@ static const struct stacktrace_ops backtrace_ops = {
 static void
 perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
 {
-	unsigned long bp;
-	char *stack;
-	int nr = entry->nr;
-
+	callchain_store(entry, PERF_CONTEXT_KERNEL);
 	callchain_store(entry, regs->ip);
 
-	stack = ((char *)regs + sizeof(struct pt_regs));
-#ifdef CONFIG_FRAME_POINTER
-	get_bp(bp);
-#else
-	bp = 0;
-#endif
-
-	dump_trace(NULL, regs, (void *)&stack, bp, &backtrace_ops, entry);
-
-	entry->kernel = entry->nr - nr;
+	dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry);
 }
 
 /*
@@ -1669,16 +1657,16 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 {
 	struct stack_frame frame;
 	const void __user *fp;
-	int nr = entry->nr;
 
 	if (!user_mode(regs))
 		regs = task_pt_regs(current);
 
 	fp = (void __user *)regs->bp;
 
+	callchain_store(entry, PERF_CONTEXT_USER);
 	callchain_store(entry, regs->ip);
 
-	while (entry->nr < MAX_STACK_DEPTH) {
+	while (entry->nr < PERF_MAX_STACK_DEPTH) {
 		frame.next_frame	     = NULL;
 		frame.return_address = 0;
 
@@ -1691,8 +1679,6 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
 		callchain_store(entry, frame.return_address);
 		fp = frame.next_frame;
 	}
-
-	entry->user = entry->nr - nr;
 }
 
 static void
@@ -1728,9 +1714,6 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
 		entry = &__get_cpu_var(irq_entry);
 
 	entry->nr = 0;
-	entry->hv = 0;
-	entry->kernel = 0;
-	entry->user = 0;
 
 	perf_do_callchain(regs, entry);
 
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 0765e8e..e7e7e02 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -343,23 +343,22 @@ enum perf_event_type {
 	 *	{ u64			nr;
 	 *	  { u64 id, val; }	cnt[nr];  } && PERF_SAMPLE_GROUP
 	 *
-	 *	{ u16			nr,
-	 *				hv,
-	 *				kernel,
-	 *				user;
+	 *	{ u64			nr,
 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
 	 * };
 	 */
 };
 
-#define MAX_STACK_DEPTH			255
+enum perf_callchain_context {
+	PERF_CONTEXT_HV			= (__u64)-32,
+	PERF_CONTEXT_KERNEL		= (__u64)-128,
+	PERF_CONTEXT_USER		= (__u64)-512,
 
-struct perf_callchain_entry {
-	__u16				nr;
-	__u16				hv;
-	__u16				kernel;
-	__u16				user;
-	__u64				ip[MAX_STACK_DEPTH];
+	PERF_CONTEXT_GUEST		= (__u64)-2048,
+	PERF_CONTEXT_GUEST_KERNEL	= (__u64)-2176,
+	PERF_CONTEXT_GUEST_USER		= (__u64)-2560,
+
+	PERF_CONTEXT_MAX		= (__u64)-4095,
 };
 
 #ifdef __KERNEL__
@@ -381,6 +380,13 @@ struct perf_callchain_entry {
 #include <linux/pid_namespace.h>
 #include <asm/atomic.h>
 
+#define PERF_MAX_STACK_DEPTH		255
+
+struct perf_callchain_entry {
+	__u64				nr;
+	__u64				ip[PERF_MAX_STACK_DEPTH];
+};
+
 struct task_struct;
 
 /**

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Update userspace callchain sampling uses
       [not found]             ` <new-submission>
                                 ` (238 preceding siblings ...)
  2009-06-19 11:51               ` [tip:perfcounters/core] perf_counter: Make callchain samples extensible tip-bot for Peter Zijlstra
@ 2009-06-19 11:52               ` tip-bot for Peter Zijlstra
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter tools: Add a data file header tip-bot for Peter Zijlstra
                                 ` (467 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-19 11:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  2a0a50fe9def21835d65035cc8109c0b6dd6099d
Gitweb:     http://git.kernel.org/tip/2a0a50fe9def21835d65035cc8109c0b6dd6099d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 22:20:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 19 Jun 2009 13:42:35 +0200

perf_counter: Update userspace callchain sampling uses

Update the tools to reflect the new callchain sampling format.

LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   86 +++++++++++++++++++-----------------------
 1 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 86981bd..7a6577b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -59,6 +59,11 @@ struct ip_event {
 	unsigned char __more_data[];
 };
 
+struct ip_callchain {
+	__u64 nr;
+	__u64 ips[0];
+};
+
 struct mmap_event {
 	struct perf_event_header header;
 	__u32 pid, tid;
@@ -833,15 +838,12 @@ got_dso:
 	return dso->find_symbol(dso, ip);
 }
 
-static struct symbol *call__match(struct symbol *sym)
+static int call__match(struct symbol *sym)
 {
-	if (!sym)
-		return NULL;
-
 	if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
-		return sym;
+		return 1;
 
-	return NULL;
+	return 0;
 }
 
 /*
@@ -850,7 +852,7 @@ static struct symbol *call__match(struct symbol *sym)
 
 static int
 hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
-		struct symbol *sym, __u64 ip, struct perf_callchain_entry *chain,
+		struct symbol *sym, __u64 ip, struct ip_callchain *chain,
 		char level, __u64 count)
 {
 	struct rb_node **p = &hist.rb_node;
@@ -869,31 +871,35 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
 	int cmp;
 
 	if (sort__has_parent && chain) {
-		int i, nr = chain->hv;
-		struct symbol *sym;
-		struct dso *dso;
-		__u64 ip;
-
-		for (i = 0; i < chain->kernel; i++) {
-			ip = chain->ip[nr + i];
-			dso = kernel_dso;
+		__u64 context = PERF_CONTEXT_MAX;
+		int i;
+
+		for (i = 0; i < chain->nr; i++) {
+			__u64 ip = chain->ips[i];
+			struct dso *dso = NULL;
+			struct symbol *sym;
+
+			if (ip >= PERF_CONTEXT_MAX) {
+				context = ip;
+				continue;
+			}
+
+			switch (context) {
+			case PERF_CONTEXT_KERNEL:
+				dso = kernel_dso;
+				break;
+			default:
+				break;
+			}
+
 			sym = resolve_symbol(thread, NULL, &dso, &ip);
-			entry.parent = call__match(sym);
-			if (entry.parent)
-				goto got_parent;
-		}
-		nr += i;
-
-		for (i = 0; i < chain->user; i++) {
-			ip = chain->ip[nr + i];
-			sym = resolve_symbol(thread, NULL, NULL, &ip);
-			entry.parent = call__match(sym);
-			if (entry.parent)
-				goto got_parent;
+
+			if (sym && call__match(sym)) {
+				entry.parent = sym;
+				break;
+			}
 		}
-		nr += i;
 	}
-got_parent:
 
 	while (*p != NULL) {
 		parent = *p;
@@ -1095,21 +1101,10 @@ static unsigned long total = 0,
 		     total_unknown = 0,
 		     total_lost = 0;
 
-static int validate_chain(struct perf_callchain_entry *chain, event_t *event)
+static int validate_chain(struct ip_callchain *chain, event_t *event)
 {
 	unsigned int chain_size;
 
-	if (chain->nr > MAX_STACK_DEPTH)
-		return -1;
-	if (chain->hv > MAX_STACK_DEPTH)
-		return -1;
-	if (chain->kernel > MAX_STACK_DEPTH)
-		return -1;
-	if (chain->user > MAX_STACK_DEPTH)
-		return -1;
-	if (chain->hv + chain->kernel + chain->user != chain->nr)
-		return -1;
-
 	chain_size = event->header.size;
 	chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event;
 
@@ -1130,7 +1125,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	__u64 period = 1;
 	struct map *map = NULL;
 	void *more_data = event->ip.__more_data;
-	struct perf_callchain_entry *chain = NULL;
+	struct ip_callchain *chain = NULL;
 
 	if (event->header.type & PERF_SAMPLE_PERIOD) {
 		period = *(__u64 *)more_data;
@@ -1150,10 +1145,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 
 		chain = (void *)more_data;
 
-		dprintf("... chain: u:%d, k:%d, nr:%d\n",
-			chain->user,
-			chain->kernel,
-			chain->nr);
+		dprintf("... chain: nr:%Lu\n", chain->nr);
 
 		if (validate_chain(chain, event) < 0) {
 			eprintf("call-chain problem with event, skipping it.\n");
@@ -1162,7 +1154,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 
 		if (dump_trace) {
 			for (i = 0; i < chain->nr; i++)
-				dprintf("..... %2d: %016Lx\n", i, chain->ip[i]);
+				dprintf("..... %2d: %016Lx\n", i, chain->ips[i]);
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Add a data file header
       [not found]             ` <new-submission>
                                 ` (239 preceding siblings ...)
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter: Update userspace callchain sampling uses tip-bot for Peter Zijlstra
@ 2009-06-19 11:52               ` tip-bot for Peter Zijlstra
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting tip-bot for Peter Zijlstra
                                 ` (466 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-19 11:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  f5970550d5ccf90453cbd7d260370ea99d1f6513
Gitweb:     http://git.kernel.org/tip/f5970550d5ccf90453cbd7d260370ea99d1f6513
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 18 Jun 2009 23:22:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 19 Jun 2009 13:42:36 +0200

perf_counter tools: Add a data file header

Add a data file header so we can transfer data between record and report.

LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   94 ++++++++++++++++++++++++-------------------
 tools/perf/builtin-report.c |   16 +++++++-
 tools/perf/perf.h           |    6 +++
 3 files changed, 73 insertions(+), 43 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 06fdfb8..2830467 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -51,6 +51,9 @@ static struct pollfd		event_array[MAX_NR_CPUS * MAX_COUNTERS];
 static int			nr_poll;
 static int			nr_cpu;
 
+static int			file_new = 1;
+static struct perf_file_header	file_header;
+
 struct mmap_event {
 	struct perf_event_header	header;
 	__u32				pid;
@@ -100,6 +103,21 @@ static void mmap_write_tail(struct mmap_data *md, unsigned long tail)
 	pc->data_tail = tail;
 }
 
+static void write_output(void *buf, size_t size)
+{
+	while (size) {
+		int ret = write(output, buf, size);
+
+		if (ret < 0)
+			die("failed to write");
+
+		size -= ret;
+		buf += ret;
+
+		bytes_written += ret;
+	}
+}
+
 static void mmap_read(struct mmap_data *md)
 {
 	unsigned int head = mmap_read_head(md);
@@ -148,34 +166,14 @@ static void mmap_read(struct mmap_data *md)
 		size = md->mask + 1 - (old & md->mask);
 		old += size;
 
-		while (size) {
-			int ret = write(output, buf, size);
-
-			if (ret < 0)
-				die("failed to write");
-
-			size -= ret;
-			buf += ret;
-
-			bytes_written += ret;
-		}
+		write_output(buf, size);
 	}
 
 	buf = &data[old & md->mask];
 	size = head - old;
 	old += size;
 
-	while (size) {
-		int ret = write(output, buf, size);
-
-		if (ret < 0)
-			die("failed to write");
-
-		size -= ret;
-		buf += ret;
-
-		bytes_written += ret;
-	}
+	write_output(buf, size);
 
 	md->prev = old;
 	mmap_write_tail(md, old);
@@ -204,7 +202,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
 	struct comm_event comm_ev;
 	char filename[PATH_MAX];
 	char bf[BUFSIZ];
-	int fd, ret;
+	int fd;
 	size_t size;
 	char *field, *sep;
 	DIR *tasks;
@@ -246,11 +244,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
 	if (!full) {
 		comm_ev.tid = pid;
 
-		ret = write(output, &comm_ev, comm_ev.header.size);
-		if (ret < 0) {
-			perror("failed to write");
-			exit(-1);
-		}
+		write_output(&comm_ev, comm_ev.header.size);
 		return;
 	}
 
@@ -265,11 +259,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
 
 		comm_ev.tid = pid;
 
-		ret = write(output, &comm_ev, comm_ev.header.size);
-		if (ret < 0) {
-			perror("failed to write");
-			exit(-1);
-		}
+		write_output(&comm_ev, comm_ev.header.size);
 	}
 	closedir(tasks);
 	return;
@@ -332,10 +322,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)
 			mmap_ev.pid = pid;
 			mmap_ev.tid = pid;
 
-			if (write(output, &mmap_ev, mmap_ev.header.size) < 0) {
-				perror("failed to write");
-				exit(-1);
-			}
+			write_output(&mmap_ev, mmap_ev.header.size);
 		}
 	}
 
@@ -382,6 +369,15 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	if (call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
+	if (file_new) {
+		file_header.sample_type = attr->sample_type;
+	} else {
+		if (file_header.sample_type != attr->sample_type) {
+			fprintf(stderr, "incompatible append\n");
+			exit(-1);
+		}
+	}
+
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= (cpu < 0) && inherit;
@@ -461,6 +457,13 @@ static void open_counters(int cpu, pid_t pid)
 	nr_cpu++;
 }
 
+static void atexit_header(void)
+{
+	file_header.data_size += bytes_written;
+
+	pwrite(output, &file_header, sizeof(file_header), 0);
+}
+
 static int __cmd_record(int argc, const char **argv)
 {
 	int i, counter;
@@ -474,6 +477,10 @@ static int __cmd_record(int argc, const char **argv)
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
+	atexit(sig_atexit);
+	signal(SIGCHLD, sig_handler);
+	signal(SIGINT, sig_handler);
+
 	if (!stat(output_name, &st) && !force && !append_file) {
 		fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n",
 				output_name);
@@ -482,7 +489,7 @@ static int __cmd_record(int argc, const char **argv)
 
 	flags = O_CREAT|O_RDWR;
 	if (append_file)
-		flags |= O_APPEND;
+		file_new = 0;
 	else
 		flags |= O_TRUNC;
 
@@ -492,15 +499,18 @@ static int __cmd_record(int argc, const char **argv)
 		exit(-1);
 	}
 
+	if (!file_new) {
+		read(output, &file_header, sizeof(file_header));
+		lseek(output, file_header.data_size, SEEK_CUR);
+	}
+
+	atexit(atexit_header);
+
 	if (!system_wide) {
 		open_counters(-1, target_pid != -1 ? target_pid : getpid());
 	} else for (i = 0; i < nr_cpus; i++)
 		open_counters(i, target_pid);
 
-	atexit(sig_atexit);
-	signal(SIGCHLD, sig_handler);
-	signal(SIGINT, sig_handler);
-
 	if (target_pid == -1 && argc) {
 		pid = fork();
 		if (pid < 0)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7a6577b..37b26ec 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1366,11 +1366,13 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
+static struct perf_file_header		file_header;
+
 static int __cmd_report(void)
 {
 	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
-	unsigned long head = 0;
+	unsigned long head = sizeof(file_header);
 	struct stat stat;
 	event_t *event;
 	uint32_t size;
@@ -1398,6 +1400,14 @@ static int __cmd_report(void)
 		exit(0);
 	}
 
+	read(input, &file_header, sizeof(file_header));
+
+	if (sort__has_parent &&
+	    !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) {
+		fprintf(stderr, "selected --sort parent, but no callchain data\n");
+		exit(-1);
+	}
+
 	if (load_kernel() < 0) {
 		perror("failed to load kernel symbols");
 		return EXIT_FAILURE;
@@ -1469,9 +1479,13 @@ more:
 
 	head += size;
 
+	if (offset + head >= sizeof(file_header) + file_header.data_size)
+		goto done;
+
 	if (offset + head < stat.st_size)
 		goto more;
 
+done:
 	rc = EXIT_SUCCESS;
 	close(input);
 
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 87a1aca..55c62f4 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -65,4 +65,10 @@ sys_perf_counter_open(struct perf_counter_attr *attr,
 #define MAX_COUNTERS			256
 #define MAX_NR_CPUS			256
 
+struct perf_file_header {
+	__u64	version;
+	__u64	sample_type;
+	__u64	data_size;
+};
+
 #endif

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting
       [not found]             ` <new-submission>
                                 ` (240 preceding siblings ...)
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter tools: Add a data file header tip-bot for Peter Zijlstra
@ 2009-06-19 11:52               ` tip-bot for Peter Zijlstra
  2009-06-19 11:59                 ` Peter Zijlstra
  2009-06-19 16:27               ` [tip:perfcounters/core] perf_counter: Close race in perf_lock_task_context() tip-bot for Peter Zijlstra
                                 ` (465 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-19 11:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mtosatti, tglx, cjashfor, mingo

Commit-ID:  e5289d4a181fb6c0b7a7607649af2ffdc491335c
Gitweb:     http://git.kernel.org/tip/e5289d4a181fb6c0b7a7607649af2ffdc491335c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Jun 2009 13:22:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 19 Jun 2009 13:43:12 +0200

perf_counter: Simplify and fix task migration counting

The task migrations counter was causing rare and hard to decypher
memory corruptions under load. After a day of debugging and bisection
we found that the problem was introduced with:

  3f731ca: perf_counter: Fix cpu migration counter

Turning them off fixes the crashes. Incidentally, the whole
perf_counter_task_migration() logic can be done simpler as well,
by injecting a proper sw-counter event.

This cleanup also fixed the crashes. The precise failure mode is
not completely clear yet, but we are clearly not unhappy about
having a fix ;-)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    4 ----
 kernel/perf_counter.c        |   23 +----------------------
 kernel/sched.c               |    3 ++-
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index e7e7e02..89698d8 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -682,8 +682,6 @@ static inline void perf_counter_mmap(struct vm_area_struct *vma)
 extern void perf_counter_comm(struct task_struct *tsk);
 extern void perf_counter_fork(struct task_struct *tsk);
 
-extern void perf_counter_task_migration(struct task_struct *task, int cpu);
-
 extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
 
 extern int sysctl_perf_counter_paranoid;
@@ -724,8 +722,6 @@ static inline void perf_counter_mmap(struct vm_area_struct *vma)	{ }
 static inline void perf_counter_comm(struct task_struct *tsk)		{ }
 static inline void perf_counter_fork(struct task_struct *tsk)		{ }
 static inline void perf_counter_init(void)				{ }
-static inline void perf_counter_task_migration(struct task_struct *task,
-					       int cpu)			{ }
 #endif
 
 #endif /* __KERNEL__ */
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 7e9108e..8d4f0dd 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -124,7 +124,7 @@ void perf_enable(void)
 
 static void get_ctx(struct perf_counter_context *ctx)
 {
-	atomic_inc(&ctx->refcount);
+	WARN_ON(!atomic_inc_not_zero(&ctx->refcount));
 }
 
 static void free_ctx(struct rcu_head *head)
@@ -3467,27 +3467,6 @@ static const struct pmu perf_ops_task_clock = {
 	.read		= task_clock_perf_counter_read,
 };
 
-/*
- * Software counter: cpu migrations
- */
-void perf_counter_task_migration(struct task_struct *task, int cpu)
-{
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
-	struct perf_counter_context *ctx;
-
-	perf_swcounter_ctx_event(&cpuctx->ctx, PERF_TYPE_SOFTWARE,
-				 PERF_COUNT_SW_CPU_MIGRATIONS,
-				 1, 1, NULL, 0);
-
-	ctx = perf_pin_task_context(task);
-	if (ctx) {
-		perf_swcounter_ctx_event(ctx, PERF_TYPE_SOFTWARE,
-					 PERF_COUNT_SW_CPU_MIGRATIONS,
-					 1, 1, NULL, 0);
-		perf_unpin_context(ctx);
-	}
-}
-
 #ifdef CONFIG_EVENT_PROFILE
 void perf_tpcounter_event(int event_id)
 {
diff --git a/kernel/sched.c b/kernel/sched.c
index 8fb88a9..f46540b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1978,7 +1978,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 		if (task_hot(p, old_rq->clock, NULL))
 			schedstat_inc(p, se.nr_forced2_migrations);
 #endif
-		perf_counter_task_migration(p, new_cpu);
+		perf_swcounter_event(PERF_COUNT_SW_CPU_MIGRATIONS,
+				     1, 1, NULL, 0);
 	}
 	p->se.vruntime -= old_cfsrq->min_vruntime -
 					 new_cfsrq->min_vruntime;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting tip-bot for Peter Zijlstra
@ 2009-06-19 11:59                 ` Peter Zijlstra
  2009-06-19 12:24                   ` Paul Mackerras
  2009-06-19 12:26                   ` Peter Zijlstra
  0 siblings, 2 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-19 11:59 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, efault, mtosatti, tglx,
	cjashfor, mingo
  Cc: linux-tip-commits

On Fri, 2009-06-19 at 11:52 +0000, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  e5289d4a181fb6c0b7a7607649af2ffdc491335c
> Gitweb:     http://git.kernel.org/tip/e5289d4a181fb6c0b7a7607649af2ffdc491335c
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Fri, 19 Jun 2009 13:22:51 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 19 Jun 2009 13:43:12 +0200
> 
> perf_counter: Simplify and fix task migration counting
> 
> The task migrations counter was causing rare and hard to decypher
> memory corruptions under load. After a day of debugging and bisection
> we found that the problem was introduced with:
> 
>   3f731ca: perf_counter: Fix cpu migration counter
> 
> Turning them off fixes the crashes. Incidentally, the whole
> perf_counter_task_migration() logic can be done simpler as well,
> by injecting a proper sw-counter event.
> 
> This cleanup also fixed the crashes. The precise failure mode is
> not completely clear yet, but we are clearly not unhappy about
> having a fix ;-)


I actually do know what happens:

static struct perf_counter_context *
perf_lock_task_context(struct task_struct *task, unsigned long *flags)
{
	struct perf_counter_context *ctx;

	rcu_read_lock();
 retry:
	ctx = rcu_dereference(task->perf_counter_ctxp);
	if (ctx) {

		spin_lock_irqsave(&ctx->lock, *flags);
		if (ctx != rcu_dereference(task->perf_counter_ctxp)) {
			spin_unlock_irqrestore(&ctx->lock, *flags);
			goto retry;
		}
	}
	rcu_read_unlock();
	return ctx;
}


static struct perf_counter_context *perf_pin_task_context(struct task_struct *task)
{
	struct perf_counter_context *ctx;
	unsigned long flags;

	ctx = perf_lock_task_context(task, &flags);
	if (ctx) {
		++ctx->pin_count;
		get_ctx(ctx);
		spin_unlock_irqrestore(&ctx->lock, flags);
	}
	return ctx;
}

Is buggy because perf_lock_task_context() can return a dead context.

the RCU read lock in perf_lock_task_context() only guarantees the memory
won't get freed, it doesn't guarantee the object is valid (in our case
refcount > 0).

Therefore we can return a locked object that can get freed the moment we
release the rcu read lock.

perf_pin_task_context() then increases the refcount and does an unlock
on freed memory.

That increased refcount will cause a double free, in case it started out
with 0.




^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting
  2009-06-19 11:59                 ` Peter Zijlstra
@ 2009-06-19 12:24                   ` Paul Mackerras
  2009-06-19 12:39                     ` Peter Zijlstra
  2009-06-19 12:26                   ` Peter Zijlstra
  1 sibling, 1 reply; 1149+ messages in thread
From: Paul Mackerras @ 2009-06-19 12:24 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, acme, linux-kernel, efault, mtosatti, tglx, cjashfor,
	mingo, linux-tip-commits

Peter Zijlstra writes:

> static struct perf_counter_context *perf_pin_task_context(struct task_struct *task)
> {
> 	struct perf_counter_context *ctx;
> 	unsigned long flags;
> 
> 	ctx = perf_lock_task_context(task, &flags);
> 	if (ctx) {
> 		++ctx->pin_count;
> 		get_ctx(ctx);
> 		spin_unlock_irqrestore(&ctx->lock, flags);
> 	}
> 	return ctx;
> }
> 
> Is buggy because perf_lock_task_context() can return a dead context.
> 
> the RCU read lock in perf_lock_task_context() only guarantees the memory
> won't get freed, it doesn't guarantee the object is valid (in our case
> refcount > 0).
> 
> Therefore we can return a locked object that can get freed the moment we
> release the rcu read lock.
> 
> perf_pin_task_context() then increases the refcount and does an unlock
> on freed memory.
> 
> That increased refcount will cause a double free, in case it started out
> with 0.

Wow, good catch!  Thanks for finding that.

Paul.

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting
  2009-06-19 11:59                 ` Peter Zijlstra
  2009-06-19 12:24                   ` Paul Mackerras
@ 2009-06-19 12:26                   ` Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-19 12:26 UTC (permalink / raw)
  To: mingo
  Cc: hpa, paulus, acme, linux-kernel, efault, mtosatti, tglx, cjashfor,
	mingo, linux-tip-commits

On Fri, 2009-06-19 at 13:59 +0200, Peter Zijlstra wrote:
> On Fri, 2009-06-19 at 11:52 +0000, tip-bot for Peter Zijlstra wrote:
> > Commit-ID:  e5289d4a181fb6c0b7a7607649af2ffdc491335c
> > Gitweb:     http://git.kernel.org/tip/e5289d4a181fb6c0b7a7607649af2ffdc491335c
> > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > AuthorDate: Fri, 19 Jun 2009 13:22:51 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Fri, 19 Jun 2009 13:43:12 +0200
> > 
> > perf_counter: Simplify and fix task migration counting
> > 
> > The task migrations counter was causing rare and hard to decypher
> > memory corruptions under load. After a day of debugging and bisection
> > we found that the problem was introduced with:
> > 
> >   3f731ca: perf_counter: Fix cpu migration counter
> > 
> > Turning them off fixes the crashes. Incidentally, the whole
> > perf_counter_task_migration() logic can be done simpler as well,
> > by injecting a proper sw-counter event.
> > 
> > This cleanup also fixed the crashes. The precise failure mode is
> > not completely clear yet, but we are clearly not unhappy about
> > having a fix ;-)
> 
> 
> I actually do know what happens:
> 
> static struct perf_counter_context *
> perf_lock_task_context(struct task_struct *task, unsigned long *flags)
> {
> 	struct perf_counter_context *ctx;
> 
> 	rcu_read_lock();
>  retry:
> 	ctx = rcu_dereference(task->perf_counter_ctxp);
> 	if (ctx) {
> 
> 		spin_lock_irqsave(&ctx->lock, *flags);
> 		if (ctx != rcu_dereference(task->perf_counter_ctxp)) {
> 			spin_unlock_irqrestore(&ctx->lock, *flags);
> 			goto retry;
> 		}
> 	}
> 	rcu_read_unlock();
> 	return ctx;
> }
> 
> 
> static struct perf_counter_context *perf_pin_task_context(struct task_struct *task)
> {
> 	struct perf_counter_context *ctx;
> 	unsigned long flags;
> 
> 	ctx = perf_lock_task_context(task, &flags);
> 	if (ctx) {
> 		++ctx->pin_count;
> 		get_ctx(ctx);
> 		spin_unlock_irqrestore(&ctx->lock, flags);
> 	}
> 	return ctx;
> }
> 
> Is buggy because perf_lock_task_context() can return a dead context.
> 
> the RCU read lock in perf_lock_task_context() only guarantees the memory
> won't get freed, it doesn't guarantee the object is valid (in our case
> refcount > 0).
> 
> Therefore we can return a locked object that can get freed the moment we
> release the rcu read lock.
> 
> perf_pin_task_context() then increases the refcount and does an unlock
> on freed memory.
> 
> That increased refcount will cause a double free, in case it started out
> with 0.
> 

Maybe something like so..

---
 kernel/perf_counter.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 7e9108e..923189e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -175,6 +175,11 @@ perf_lock_task_context(struct task_struct *task, unsigned long *flags)
 			spin_unlock_irqrestore(&ctx->lock, *flags);
 			goto retry;
 		}
+
+		if (!atomic_inc_not_zero(&ctx->refcount)) {
+			spin_unlock_irqrestore(&ctx->lock, *flags);
+			ctx = NULL;
+		}
 	}
 	rcu_read_unlock();
 	return ctx;
@@ -193,7 +198,6 @@ static struct perf_counter_context *perf_pin_task_context(struct task_struct *ta
 	ctx = perf_lock_task_context(task, &flags);
 	if (ctx) {
 		++ctx->pin_count;
-		get_ctx(ctx);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 	return ctx;
@@ -1459,11 +1463,6 @@ static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
 			put_ctx(parent_ctx);
 			ctx->parent_ctx = NULL;		/* no longer a clone */
 		}
-		/*
-		 * Get an extra reference before dropping the lock so that
-		 * this context won't get freed if the task exits.
-		 */
-		get_ctx(ctx);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting
  2009-06-19 12:24                   ` Paul Mackerras
@ 2009-06-19 12:39                     ` Peter Zijlstra
  0 siblings, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-19 12:39 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: mingo, hpa, acme, linux-kernel, efault, mtosatti, tglx, cjashfor,
	mingo, linux-tip-commits

On Fri, 2009-06-19 at 22:24 +1000, Paul Mackerras wrote:
> Peter Zijlstra writes:
> 
> > static struct perf_counter_context *perf_pin_task_context(struct task_struct *task)
> > {
> > 	struct perf_counter_context *ctx;
> > 	unsigned long flags;
> > 
> > 	ctx = perf_lock_task_context(task, &flags);
> > 	if (ctx) {
> > 		++ctx->pin_count;
> > 		get_ctx(ctx);
> > 		spin_unlock_irqrestore(&ctx->lock, flags);
> > 	}
> > 	return ctx;
> > }
> > 
> > Is buggy because perf_lock_task_context() can return a dead context.
> > 
> > the RCU read lock in perf_lock_task_context() only guarantees the memory
> > won't get freed, it doesn't guarantee the object is valid (in our case
> > refcount > 0).
> > 
> > Therefore we can return a locked object that can get freed the moment we
> > release the rcu read lock.
> > 
> > perf_pin_task_context() then increases the refcount and does an unlock
> > on freed memory.
> > 
> > That increased refcount will cause a double free, in case it started out
> > with 0.
> 
> Wow, good catch!  Thanks for finding that.

The clue that got me started was this scribble:

[  123.800172] =============================================================================
[  123.808725] BUG kmalloc-512: Poison overwritten
[  123.813422] -----------------------------------------------------------------------------
[  123.813424]
[  123.823390] INFO: 0xffff8801bd546480-0xffff8801bd546588. First byte 0x6c instead of 0x6b
[  123.831777] INFO: Allocated in perf_counter_init_task+0x8d/0x262 age=351 cpu=1 pid=12276
[  123.840047] INFO: Freed in free_ctx+0x10/0x12 age=256 cpu=1 pid=12669
[  123.846702] INFO: Slab 0xffffea0009914f60 objects=28 used=14 fp=0xffff8801bd546480 flags=0x2000000000040c3
[  123.856710] INFO: Object 0xffff8801bd546480 @offset=9344 fp=0xffff8801bd546fe8
[  123.856712]
[  123.865782] Bytes b4 0xffff8801bd546470:  31 3b fd ff 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a 1;<FD><FF>....ZZZZZZZZ
[  123.876163]   Object 0xffff8801bd546480:  6c 6c 6b 6b 6b 6b 6b 6b ff ff ff ff 6b 6b 6b 6b llkkkkkk<FF><FF><FF><FF>kkkk
[  123.886447]   Object 0xffff8801bd546490:  ff ff ff ff ff ff ff ff 6b 6b 6b 6b 6b 6b 6b 6b <FF><FF><FF><FF><FF><FF><FF><FF>kkkkkkkk
[  123.896810]   Object 0xffff8801bd5464a0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[  123.907162]   Object 0xffff8801bd5464b0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[  123.917421]   Object 0xffff8801bd5464c0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[  123.927837]   Object 0xffff8801bd5464d0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[  123.938147]   Object 0xffff8801bd5464e0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
[  123.948398]   Object 0xffff8801bd5464f0:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk

And from pahole (thanks acme!) we find that the only relevant perf
object in that bucket is:

struct perf_counter_context {
        spinlock_t                 lock;                 /*     0    64 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        struct mutex               mutex;                /*    64   152 */
        /* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */
        struct list_head           counter_list;         /*   216    16 */
        struct list_head           event_list;           /*   232    16 */
        int                        nr_counters;          /*   248     4 */
        int                        nr_active;            /*   252     4 */
        /* --- cacheline 4 boundary (256 bytes) --- */
        int                        is_active;            /*   256     4 */
        atomic_t                   refcount;             /*   260     4 */
        struct task_struct *       task;                 /*   264     8 */
        u64                        time;                 /*   272     8 */
        u64                        timestamp;            /*   280     8 */
        struct perf_counter_context * parent_ctx;        /*   288     8 */
        u64                        parent_gen;           /*   296     8 */
        u64                        generation;           /*   304     8 */
        int                        pin_count;            /*   312     4 */

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 5 boundary (320 bytes) --- */
        struct rcu_head            rcu_head;             /*   320    16 */

        /* size: 336, cachelines: 6 */
        /* sum members: 332, holes: 1, sum holes: 4 */
        /* last cacheline: 16 bytes */
}; 

typedef struct {
        raw_spinlock_t             raw_lock;             /*     0     4 */
        unsigned int               magic;                /*     4     4 */
        unsigned int               owner_cpu;            /*     8     4 */

        /* XXX 4 bytes hole, try to pack */

        void *                     owner;                /*    16     8 */
        struct lockdep_map         dep_map;              /*    24    40 */
        /* --- cacheline 1 boundary (64 bytes) --- */

        /* size: 64, cachelines: 1 */
        /* sum members: 60, holes: 1, sum holes: 4 */
} spinlock_t;   /* definitions: 1 */


Which learns us that we had lock/unlock (6b->6c) + owner and owner_cpu
scribble as through:

static inline void debug_spin_unlock(spinlock_t *lock)
{
	SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic");
	SPIN_BUG_ON(!spin_is_locked(lock), lock, "already unlocked");
	SPIN_BUG_ON(lock->owner != current, lock, "wrong owner");
	SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
							lock, "wrong CPU");
	lock->owner = SPINLOCK_OWNER_INIT;
	lock->owner_cpu = -1;
}

The SPIN_BUG_ON() failed to trigger in this particular case because
earlier corruption took out lockdep.




^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-15 23:22                                         ` Linus Torvalds
@ 2009-06-19 15:20                                           ` Ingo Molnar
  2009-06-19 15:51                                             ` Mathieu Desnoyers
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-19 15:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Mathieu Desnoyers, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > 
> > See the numbers in the other mail: about 33 million pagefaults 
> > happen in a typical kernel build - that's ~400K/sec - and that 
> > is not a particularly really pagefault-heavy workload.
> 
> Did you do any function-level profiles?
> 
> Last I looked at it, the real cost of page faults were all in the 
> memory copies and page clearing, and while it would be nice to 
> speed up the kernel entry and exit, the few tens of cycles we 
> might be able to get from there really aren't all that important.

Yeah.

Here's the function level profiles of a typical kernel build on a 
Nehalem box:

 $ perf report --sort symbol

 #
 # (14317328 samples)
 #
 # Overhead  Symbol
 # ........  ......
 #
    44.05%  0x000000001a0b80
     5.09%  0x0000000001d298
     3.56%  0x0000000005742c
     2.48%  0x0000000014026d
     2.31%  0x00000000007b1a
     2.06%  0x00000000115ac9
     1.83%  [.] _int_malloc
     1.71%  0x00000000064680
     1.50%  [.] memset
     1.37%  0x00000000125d88
     1.28%  0x000000000b7642
     1.17%  [k] clear_page_c
     0.87%  [k] page_fault
     0.78%  [.] is_defined_config
     0.71%  [.] _int_free
     0.68%  [.] __GI_strlen
     0.66%  0x000000000699e8
     0.54%  [.] __GI_memcpy

Most is dominated by user-space symbols. (no proper ELF+debuginfo on 
this box so they are unnamed.) It also sows that page clearing and 
pagefault handling dominates the kernel overhead - but is dwarved by 
other overhead. Any page-fault-entry costs are a drop in the bucket.

In fact with call-chain graphs we can get a precise picture, as we 
can do a non-linear 'slice' set operation over the samples and 
filter out the ones that have the 'page_fault' pattern in one of 
their parent functions:

 $ perf report --sort symbol --parent page_fault

 #
 # (14317328 samples)
 #
 # Overhead  Symbol
 # ........  ......
 #
     1.12%  [k] clear_page_c
     0.87%  [k] page_fault
     0.43%  [k] get_page_from_freelist
     0.25%  [k] _spin_lock
     0.24%  [k] do_page_fault
     0.23%  [k] perf_swcounter_ctx_event
     0.16%  [k] perf_swcounter_event
     0.15%  [k] handle_mm_fault
     0.15%  [k] __alloc_pages_nodemask
     0.14%  [k] __rmqueue
     0.12%  [k] find_get_page
     0.11%  [k] copy_page_c
     0.11%  [k] find_vma
     0.10%  [k] _spin_lock_irqsave
     0.10%  [k] __wake_up_bit
     0.09%  [k] _spin_unlock_irqrestore
     0.09%  [k] do_anonymous_page
     0.09%  [k] __inc_zone_state

This "sub-profile" shows the true summary overhead that 'page_fault' 
and all its child functions have. Note that for example clear_page_c 
decreased from 1.17% to 1.12%:

     1.12%  [k] clear_page_c
     1.17%  [k] clear_page_c

because there's 0.05% of other callers to clear_page_c() that do not 
involve page_fault. Those are filtered out via --parent 
filtering/matching.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-19 15:20                                           ` Ingo Molnar
@ 2009-06-19 15:51                                             ` Mathieu Desnoyers
  2009-06-19 16:16                                               ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mathieu Desnoyers @ 2009-06-19 15:51 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > > 
> > > See the numbers in the other mail: about 33 million pagefaults 
> > > happen in a typical kernel build - that's ~400K/sec - and that 
> > > is not a particularly really pagefault-heavy workload.
> > 
> > Did you do any function-level profiles?
> > 
> > Last I looked at it, the real cost of page faults were all in the 
> > memory copies and page clearing, and while it would be nice to 
> > speed up the kernel entry and exit, the few tens of cycles we 
> > might be able to get from there really aren't all that important.
> 
> Yeah.
> 
> Here's the function level profiles of a typical kernel build on a 
> Nehalem box:
> 
>  $ perf report --sort symbol
> 
>  #
>  # (14317328 samples)
>  #
>  # Overhead  Symbol
>  # ........  ......
>  #
>     44.05%  0x000000001a0b80

It makes me wonder how the following scenario is accounted :

- Execution of a newly forked/exec'd process instruction causes a fault.
  (traps, faults and interrupts can take roughly 2000 cycles to execute)
- PC sampling interrupt fires.

Will it account the execution time as part of user-space or
kernel-space execution ?

Depending on how the sampling mechanism finds out if it is running in
kernel mode or userspace mode, this might make the userspace PC appear
as currently running even though the current execution context is the
very beginning of the page fault handler (1st instruction servicing the
fault).

Mathieu

>      5.09%  0x0000000001d298
>      3.56%  0x0000000005742c
>      2.48%  0x0000000014026d
>      2.31%  0x00000000007b1a
>      2.06%  0x00000000115ac9
>      1.83%  [.] _int_malloc
>      1.71%  0x00000000064680
>      1.50%  [.] memset
>      1.37%  0x00000000125d88
>      1.28%  0x000000000b7642
>      1.17%  [k] clear_page_c
>      0.87%  [k] page_fault
>      0.78%  [.] is_defined_config
>      0.71%  [.] _int_free
>      0.68%  [.] __GI_strlen
>      0.66%  0x000000000699e8
>      0.54%  [.] __GI_memcpy
> 
> Most is dominated by user-space symbols. (no proper ELF+debuginfo on 
> this box so they are unnamed.) It also sows that page clearing and 
> pagefault handling dominates the kernel overhead - but is dwarved by 
> other overhead. Any page-fault-entry costs are a drop in the bucket.
> 
> In fact with call-chain graphs we can get a precise picture, as we 
> can do a non-linear 'slice' set operation over the samples and 
> filter out the ones that have the 'page_fault' pattern in one of 
> their parent functions:
> 
>  $ perf report --sort symbol --parent page_fault
> 
>  #
>  # (14317328 samples)
>  #
>  # Overhead  Symbol
>  # ........  ......
>  #
>      1.12%  [k] clear_page_c
>      0.87%  [k] page_fault
>      0.43%  [k] get_page_from_freelist
>      0.25%  [k] _spin_lock
>      0.24%  [k] do_page_fault
>      0.23%  [k] perf_swcounter_ctx_event
>      0.16%  [k] perf_swcounter_event
>      0.15%  [k] handle_mm_fault
>      0.15%  [k] __alloc_pages_nodemask
>      0.14%  [k] __rmqueue
>      0.12%  [k] find_get_page
>      0.11%  [k] copy_page_c
>      0.11%  [k] find_vma
>      0.10%  [k] _spin_lock_irqsave
>      0.10%  [k] __wake_up_bit
>      0.09%  [k] _spin_unlock_irqrestore
>      0.09%  [k] do_anonymous_page
>      0.09%  [k] __inc_zone_state
> 
> This "sub-profile" shows the true summary overhead that 'page_fault' 
> and all its child functions have. Note that for example clear_page_c 
> decreased from 1.17% to 1.12%:
> 
>      1.12%  [k] clear_page_c
>      1.17%  [k] clear_page_c
> 
> because there's 0.05% of other callers to clear_page_c() that do not 
> involve page_fault. Those are filtered out via --parent 
> filtering/matching.
> 
> 	Ingo

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/core] perf_counter: x86: Fix call-chain support to use NMI-safe methods
  2009-06-19 15:51                                             ` Mathieu Desnoyers
@ 2009-06-19 16:16                                               ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-19 16:16 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Linus Torvalds, mingo, hpa, paulus, acme, linux-kernel,
	a.p.zijlstra, penberg, vegard.nossum, efault, jeremy, npiggin,
	tglx, linux-tip-commits


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> * Ingo Molnar (mingo@elte.hu) wrote:
> > 
> > * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > 
> > > On Mon, 15 Jun 2009, Ingo Molnar wrote:
> > > > 
> > > > See the numbers in the other mail: about 33 million pagefaults 
> > > > happen in a typical kernel build - that's ~400K/sec - and that 
> > > > is not a particularly really pagefault-heavy workload.
> > > 
> > > Did you do any function-level profiles?
> > > 
> > > Last I looked at it, the real cost of page faults were all in the 
> > > memory copies and page clearing, and while it would be nice to 
> > > speed up the kernel entry and exit, the few tens of cycles we 
> > > might be able to get from there really aren't all that important.
> > 
> > Yeah.
> > 
> > Here's the function level profiles of a typical kernel build on a 
> > Nehalem box:
> > 
> >  $ perf report --sort symbol
> > 
> >  #
> >  # (14317328 samples)
> >  #
> >  # Overhead  Symbol
> >  # ........  ......
> >  #
> >     44.05%  0x000000001a0b80
> 
> It makes me wonder how the following scenario is accounted :
> 
> - Execution of a newly forked/exec'd process instruction causes a 
>   fault. (traps, faults and interrupts can take roughly 2000 
>   cycles to execute)
>
> - PC sampling interrupt fires.
> 
> Will it account the execution time as part of user-space or 
> kernel-space execution ?

"It depends".

With call-chain profiling ("perf record --call-graph" + "perf report 
--sort parent") this will show up as:

#
# (19525018 samples)
#
# Overhead  Parent symbol       
# ........  ....................
#
    88.60%  [other]             
     4.96%  do_page_fault       
     1.74%  sys_write           
     1.18%  sys_openat          
     0.75%  sys_exit_group      
     0.74%  sys_execve          
     0.43%  sys_read            
     0.28%  sys_mmap            
     0.23%  sys_clone           
     0.21%  sys_close           
     0.17%  sys_munmap          
     0.15%  sys_poll            
     0.13%  sys_lstat           
     0.09%  sys_faccessat       
     0.05%  sys_mprotect        

This line:

     4.96%  do_page_fault       

Is the summed up overhead of all things page faults.

If you sort by a specific user-space symbol, then _its_ own 
generated page-faults will be displayed.

Say, you profile 'git gc' done in Git's repo with 10 KHz:

  perf record -g -f -F 10000 -- ./git gc

Raw outline of overhead categories:

 $ perf report --sort parent

 #
 # Overhead  Parent symbol       
 # ........  ....................
 #
    96.97%  [other]             
     1.32%  do_page_fault       
     0.54%  sys_write           
     0.21%  sys_exit_group      
     0.15%  sys_open            
     0.14%  sys_execve          
     0.13%  sys_mmap            
     0.11%  sys_poll            
     0.10%  sys_clone           

Note that do_page_fault has 1.32% total overhead there. But if you 
only look at main's overhead:

#
# Overhead  Symbol
# ........  ......
#
    33.12%  [.] lookup_object
    11.17%  [.] __GI_strlen
     5.14%  [.] decode_tree_entry
     2.94%  [.] __GI_memcpy
     2.58%  [.] find_pack_entry_one
     2.30%  [.] lookup_blob
     1.61%  [.] tree_entry
     1.16%  [.] process_tree
     ....
     0.08%  [k] page_fault
     0.02%  [k] do_page_fault
     0.02%  [k] page_fault
     0.02%  [k] filemap_fault
     0.02%  [k] __do_fault
     0.01%  [k] handle_mm_fault

The page fault overhead is down the bottom. Why? Because most 
pagefaults are not raised by 'main', but by the dynamic loader which 
runs sooner than that.

> Depending on how the sampling mechanism finds out if it is running 
> in kernel mode or userspace mode, this might make the userspace PC 
> appear as currently running even though the current execution 
> context is the very beginning of the page fault handler (1st 
> instruction servicing the fault).

It's much more nuanced than a binary 'user-space' versus 
'kernel-space' decision.

A true 'raw' call-chain looks like this:

0x25b0 [0x108]: PERF_EVENT (IP, 5): 3455: 0xffffffff810b63ad period: 310083
... chain: nr:28
.....  0: ffffffffffffff80
.....  1: ffffffff810b63ad
.....  2: ffffffff81018258
.....  3: ffffffff810aeddb
.....  4: ffffffff810af14d
.....  5: ffffffff81019042
.....  6: ffffffff8153245e
.....  7: ffffffff81533783
.....  8: ffffffff815337cd
.....  9: ffffffff8105fc8c
..... 10: ffffffff81531c2a
..... 11: ffffffff81531e0e
..... 12: ffffffff8153174a
..... 13: ffffffff810b68aa
..... 14: ffffffff810daa24
..... 15: ffffffff810c558e
..... 16: ffffffff810c78e9
..... 17: ffffffff81533739
..... 18: ffffffff815314ff
..... 19: ffffffff810b1716
..... 20: ffffffff810b22a2
..... 21: ffffffff810e5586
..... 22: ffffffff810e6080
..... 23: ffffffff810e61a8
..... 24: ffffffff8100bd9b
..... 25: fffffffffffffe00
..... 26: 0000003641ed6590
..... 27: 0000003646e046b3
 ... thread: git:3455
 ...... dso: [kernel]

25 kernel-context RIPs followed by a context separator 
(fffffffffffffe00) followed by two user-space RIPs.

So whether this is kernel-space or user-space sample depends on the 
analysis stage - how you decide to look at it via perf report. If 
you only look at the top surface via 'perf report --sort symbol' 
it's a "kernel-space" sample. If you look deeper, it could be a 
user-space one too.

The full list of contexts is:

enum perf_callchain_context {
        PERF_CONTEXT_HV                 = (__u64)-32,
        PERF_CONTEXT_KERNEL             = (__u64)-128,
        PERF_CONTEXT_USER               = (__u64)-512,

        PERF_CONTEXT_GUEST              = (__u64)-2048,
        PERF_CONTEXT_GUEST_KERNEL       = (__u64)-2176,
        PERF_CONTEXT_GUEST_USER         = (__u64)-2560,

        PERF_CONTEXT_MAX                = (__u64)-4095,
};

and a call-chain can in theory include all of these, in a nice stack 
of call-chain entries.

( Btw., we are planning to adding context separators for IRQ and 
  softirq contexts as well - to be able to isolate hardirq and 
  softirq workloads (separated away from the mostly unrelated 
  syscall level and user-level execution overhead). )

Hope this answers your questions,

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Close race in perf_lock_task_context()
       [not found]             ` <new-submission>
                                 ` (241 preceding siblings ...)
  2009-06-19 11:52               ` [tip:perfcounters/core] perf_counter: Simplify and fix task migration counting tip-bot for Peter Zijlstra
@ 2009-06-19 16:27               ` tip-bot for Peter Zijlstra
  2009-06-20 11:27               ` [tip:perfcounters/core] perf_counter: Push perf_sample_data through the swcounter code tip-bot for Peter Zijlstra
                                 ` (464 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-19 16:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  b49a9e7e72103ea91946453c19703a4dfa1994fe
Gitweb:     http://git.kernel.org/tip/b49a9e7e72103ea91946453c19703a4dfa1994fe
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Jun 2009 17:39:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 19 Jun 2009 17:57:36 +0200

perf_counter: Close race in perf_lock_task_context()

perf_lock_task_context() is buggy because it can return a dead
context.

the RCU read lock in perf_lock_task_context() only guarantees
the memory won't get freed, it doesn't guarantee the object is
valid (in our case refcount > 0).

Therefore we can return a locked object that can get freed the
moment we release the rcu read lock.

perf_pin_task_context() then increases the refcount and does an
unlock on freed memory.

That increased refcount will cause a double free, in case it
started out with 0.

Ammend this by including the get_ctx() functionality in
perf_lock_task_context() (all users already did this later
anyway), and return a NULL context when the found one is
already dead.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 8d4f0dd..adb6ae5 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -175,6 +175,11 @@ perf_lock_task_context(struct task_struct *task, unsigned long *flags)
 			spin_unlock_irqrestore(&ctx->lock, *flags);
 			goto retry;
 		}
+
+		if (!atomic_inc_not_zero(&ctx->refcount)) {
+			spin_unlock_irqrestore(&ctx->lock, *flags);
+			ctx = NULL;
+		}
 	}
 	rcu_read_unlock();
 	return ctx;
@@ -193,7 +198,6 @@ static struct perf_counter_context *perf_pin_task_context(struct task_struct *ta
 	ctx = perf_lock_task_context(task, &flags);
 	if (ctx) {
 		++ctx->pin_count;
-		get_ctx(ctx);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 	return ctx;
@@ -1459,11 +1463,6 @@ static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
 			put_ctx(parent_ctx);
 			ctx->parent_ctx = NULL;		/* no longer a clone */
 		}
-		/*
-		 * Get an extra reference before dropping the lock so that
-		 * this context won't get freed if the task exits.
-		 */
-		get_ctx(ctx);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Push perf_sample_data through the swcounter code
       [not found]             ` <new-submission>
                                 ` (242 preceding siblings ...)
  2009-06-19 16:27               ` [tip:perfcounters/core] perf_counter: Close race in perf_lock_task_context() tip-bot for Peter Zijlstra
@ 2009-06-20 11:27               ` tip-bot for Peter Zijlstra
  2009-06-21  8:15               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
                                 ` (463 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-20 11:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  92bf309a9cd5fedd6c8eefbce0b9a95ada82d0a9
Gitweb:     http://git.kernel.org/tip/92bf309a9cd5fedd6c8eefbce0b9a95ada82d0a9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Jun 2009 18:11:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 20 Jun 2009 12:30:30 +0200

perf_counter: Push perf_sample_data through the swcounter code

Push the perf_sample_data further outwards to the swcounter interface,
to abstract it away some more.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   55 +++++++++++++++++++++++++-----------------------
 1 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index adb6ae5..1a933a2 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3171,20 +3171,15 @@ static enum hrtimer_restart perf_swcounter_hrtimer(struct hrtimer *hrtimer)
 }
 
 static void perf_swcounter_overflow(struct perf_counter *counter,
-				    int nmi, struct pt_regs *regs, u64 addr)
+				    int nmi, struct perf_sample_data *data)
 {
-	struct perf_sample_data data = {
-		.regs	= regs,
-		.addr	= addr,
-		.period	= counter->hw.last_period,
-	};
+	data->period = counter->hw.last_period;
 
 	perf_swcounter_update(counter);
 	perf_swcounter_set_period(counter);
-	if (perf_counter_overflow(counter, nmi, &data))
+	if (perf_counter_overflow(counter, nmi, data))
 		/* soft-disable the counter */
 		;
-
 }
 
 static int perf_swcounter_is_counting(struct perf_counter *counter)
@@ -3249,18 +3244,18 @@ static int perf_swcounter_match(struct perf_counter *counter,
 }
 
 static void perf_swcounter_add(struct perf_counter *counter, u64 nr,
-			       int nmi, struct pt_regs *regs, u64 addr)
+			       int nmi, struct perf_sample_data *data)
 {
 	int neg = atomic64_add_negative(nr, &counter->hw.count);
 
-	if (counter->hw.sample_period && !neg && regs)
-		perf_swcounter_overflow(counter, nmi, regs, addr);
+	if (counter->hw.sample_period && !neg && data->regs)
+		perf_swcounter_overflow(counter, nmi, data);
 }
 
 static void perf_swcounter_ctx_event(struct perf_counter_context *ctx,
-				     enum perf_type_id type, u32 event,
-				     u64 nr, int nmi, struct pt_regs *regs,
-				     u64 addr)
+				     enum perf_type_id type,
+				     u32 event, u64 nr, int nmi,
+				     struct perf_sample_data *data)
 {
 	struct perf_counter *counter;
 
@@ -3269,8 +3264,8 @@ static void perf_swcounter_ctx_event(struct perf_counter_context *ctx,
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(counter, &ctx->event_list, event_entry) {
-		if (perf_swcounter_match(counter, type, event, regs))
-			perf_swcounter_add(counter, nr, nmi, regs, addr);
+		if (perf_swcounter_match(counter, type, event, data->regs))
+			perf_swcounter_add(counter, nr, nmi, data);
 	}
 	rcu_read_unlock();
 }
@@ -3289,9 +3284,9 @@ static int *perf_swcounter_recursion_context(struct perf_cpu_context *cpuctx)
 	return &cpuctx->recursion[0];
 }
 
-static void __perf_swcounter_event(enum perf_type_id type, u32 event,
-				   u64 nr, int nmi, struct pt_regs *regs,
-				   u64 addr)
+static void do_perf_swcounter_event(enum perf_type_id type, u32 event,
+				    u64 nr, int nmi,
+				    struct perf_sample_data *data)
 {
 	struct perf_cpu_context *cpuctx = &get_cpu_var(perf_cpu_context);
 	int *recursion = perf_swcounter_recursion_context(cpuctx);
@@ -3304,7 +3299,7 @@ static void __perf_swcounter_event(enum perf_type_id type, u32 event,
 	barrier();
 
 	perf_swcounter_ctx_event(&cpuctx->ctx, type, event,
-				 nr, nmi, regs, addr);
+				 nr, nmi, data);
 	rcu_read_lock();
 	/*
 	 * doesn't really matter which of the child contexts the
@@ -3312,7 +3307,7 @@ static void __perf_swcounter_event(enum perf_type_id type, u32 event,
 	 */
 	ctx = rcu_dereference(current->perf_counter_ctxp);
 	if (ctx)
-		perf_swcounter_ctx_event(ctx, type, event, nr, nmi, regs, addr);
+		perf_swcounter_ctx_event(ctx, type, event, nr, nmi, data);
 	rcu_read_unlock();
 
 	barrier();
@@ -3325,7 +3320,12 @@ out:
 void
 perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
 {
-	__perf_swcounter_event(PERF_TYPE_SOFTWARE, event, nr, nmi, regs, addr);
+	struct perf_sample_data data = {
+		.regs = regs,
+		.addr = addr,
+	};
+
+	do_perf_swcounter_event(PERF_TYPE_SOFTWARE, event, nr, nmi, &data);
 }
 
 static void perf_swcounter_read(struct perf_counter *counter)
@@ -3469,12 +3469,15 @@ static const struct pmu perf_ops_task_clock = {
 #ifdef CONFIG_EVENT_PROFILE
 void perf_tpcounter_event(int event_id)
 {
-	struct pt_regs *regs = get_irq_regs();
+	struct perf_sample_data data = {
+		.regs = get_irq_regs();
+		.addr = 0,
+	};
 
-	if (!regs)
-		regs = task_pt_regs(current);
+	if (!data.regs)
+		data.regs = task_pt_regs(current);
 
-	__perf_swcounter_event(PERF_TYPE_TRACEPOINT, event_id, 1, 1, regs, 0);
+	do_perf_swcounter_event(PERF_TYPE_TRACEPOINT, event_id, 1, 1, &data);
 }
 EXPORT_SYMBOL_GPL(perf_tpcounter_event);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/urgent] lockdep: Select frame pointers on x86
       [not found]             ` <new-submission>
                                 ` (243 preceding siblings ...)
  2009-06-20 11:27               ` [tip:perfcounters/core] perf_counter: Push perf_sample_data through the swcounter code tip-bot for Peter Zijlstra
@ 2009-06-21  8:15               ` tip-bot for Peter Zijlstra
  2009-06-21 13:09               ` [tip:perfcounters/urgent] perf_counter tools: Fix vmlinux fallback when running on a different kernel tip-bot for Ingo Molnar
                                 ` (462 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-21  8:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, akpm, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  00540e5d54be972a94a3b2ce6da8621bebe731a2
Gitweb:     http://git.kernel.org/tip/00540e5d54be972a94a3b2ce6da8621bebe731a2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 12 Jun 2009 10:04:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 21 Jun 2009 10:14:33 +0200

lockdep: Select frame pointers on x86

x86 stack traces are a piece of crap without frame pointers, and its not
like the 'performance gain' of not having stack pointers matters when you
selected lockdep.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Cc: <stable@kernel.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/Kconfig.debug |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6cdcf38..3be4b7c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -440,7 +440,7 @@ config LOCKDEP
 	bool
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
 	select STACKTRACE
-	select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
+	select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
 	select KALLSYMS
 	select KALLSYMS_ALL
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Fix vmlinux fallback when running on a different kernel
       [not found]             ` <new-submission>
                                 ` (244 preceding siblings ...)
  2009-06-21  8:15               ` [tip:core/urgent] lockdep: Select frame pointers on x86 tip-bot for Peter Zijlstra
@ 2009-06-21 13:09               ` tip-bot for Ingo Molnar
  2009-06-22 15:00               ` [tip:perfcounters/urgent] perf report: Output more symbol related debug data tip-bot for Peter Zijlstra
                                 ` (461 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-21 13:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	lucas.de.marchi, tglx, mingo

Commit-ID:  c1f47b454ce759d7b13604137a233cad4617e1e8
Gitweb:     http://git.kernel.org/tip/c1f47b454ce759d7b13604137a233cad4617e1e8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 21 Jun 2009 13:58:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 21 Jun 2009 13:58:51 +0200

perf_counter tools: Fix vmlinux fallback when running on a different kernel

Lucas De Marchi reported that perf report and perf annotate
displays mismatching profile if a perf.data is analyzed on
an older kernel - even if the correct vmlinux is specified
via the -k option.

The reason is the fallback path in util/symbol.c:dso__load_kernel():

int dso__load_kernel(struct dso *self, const char *vmlinux,
                     symbol_filter_t filter, int verbose)
{
        int err = -1;

        if (vmlinux)
                err = dso__load_vmlinux(self, vmlinux, filter, verbose);

        if (err)
                err = dso__load_kallsyms(self, filter, verbose);

        return err;
}

dso__load_vmlinux() returns negative on error, but on success it
returns the number of symbols loaded - which confuses the function
to load the kallsyms.

This is normally harmless, as reporting is usually performed on the
same kernel that is analyzed - but if there's a mismatch then we
load the wrong kallsyms and create a non-sensical symbol tree.

The fix is to only fall back to kallsyms on errors.

Reported-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/symbol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 86e1437..01b62fa 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -629,7 +629,7 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
 	if (vmlinux)
 		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
 
-	if (err)
+	if (err < 0)
 		err = dso__load_kallsyms(self, filter, verbose);
 
 	return err;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf report: Output more symbol related debug data
       [not found]             ` <new-submission>
                                 ` (245 preceding siblings ...)
  2009-06-21 13:09               ` [tip:perfcounters/urgent] perf_counter tools: Fix vmlinux fallback when running on a different kernel tip-bot for Ingo Molnar
@ 2009-06-22 15:00               ` tip-bot for Peter Zijlstra
  2009-06-22 15:03               ` tip-bot for Peter Zijlstra
                                 ` (460 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-22 15:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, efault, peterz, tglx,
	mingo

Commit-ID:  d13c8eeb02770648dbd9097eb0ebeff70b2939be
Gitweb:     http://git.kernel.org/tip/d13c8eeb02770648dbd9097eb0ebeff70b2939be
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 22 Jun 2009 16:52:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 22 Jun 2009 16:59:32 +0200

perf report: Output more symbol related debug data

Print more symbol relocation related info under -vv.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    3 ++-
 tools/perf/util/symbol.c    |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 5eb5566..ae8fe37 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -814,7 +814,6 @@ resolve_symbol(struct thread *thread, struct map **mapp,
 			*mapp = map;
 got_map:
 		ip = map->map_ip(map, ip);
-		*ipp  = ip;
 
 		dso = map->dso;
 	} else {
@@ -828,6 +827,8 @@ got_map:
 		dso = kernel_dso;
 	}
 	dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
+	dprintf(" ...... map: %Lx -> %Lx\n", *ipp, ip);
+	*ipp  = ip;
 
 	if (dsop)
 		*dsop = dso;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 01b62fa..9c659ef 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -535,6 +535,10 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		gelf_getshdr(sec, &shdr);
 		obj_start = sym.st_value;
 
+		if (verbose >= 2)
+			printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n",
+				(u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset);
+
 		sym.st_value -= shdr.sh_addr - shdr.sh_offset;
 
 		f = symbol__new(sym.st_value, sym.st_size,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf report: Output more symbol related debug data
       [not found]             ` <new-submission>
                                 ` (246 preceding siblings ...)
  2009-06-22 15:00               ` [tip:perfcounters/urgent] perf report: Output more symbol related debug data tip-bot for Peter Zijlstra
@ 2009-06-22 15:03               ` tip-bot for Peter Zijlstra
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter tools: Handle overlapping MMAP events tip-bot for Peter Zijlstra
                                 ` (459 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-22 15:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, efault, peterz, tglx,
	mingo

Commit-ID:  520f2c346af463fa00924b236e092da482b344cc
Gitweb:     http://git.kernel.org/tip/520f2c346af463fa00924b236e092da482b344cc
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 22 Jun 2009 16:52:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 22 Jun 2009 17:02:07 +0200

perf report: Output more symbol related debug data

Print more symbol relocation related info under -vv.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |    5 +++--
 tools/perf/util/symbol.c    |    4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 5eb5566..ec230a0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -797,7 +797,7 @@ resolve_symbol(struct thread *thread, struct map **mapp,
 {
 	struct dso *dso = dsop ? *dsop : NULL;
 	struct map *map = mapp ? *mapp : NULL;
-	uint64_t ip = *ipp;
+	u64 ip = *ipp;
 
 	if (!thread)
 		return NULL;
@@ -814,7 +814,6 @@ resolve_symbol(struct thread *thread, struct map **mapp,
 			*mapp = map;
 got_map:
 		ip = map->map_ip(map, ip);
-		*ipp  = ip;
 
 		dso = map->dso;
 	} else {
@@ -828,6 +827,8 @@ got_map:
 		dso = kernel_dso;
 	}
 	dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
+	dprintf(" ...... map: %Lx -> %Lx\n", *ipp, ip);
+	*ipp  = ip;
 
 	if (dsop)
 		*dsop = dso;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 01b62fa..9c659ef 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -535,6 +535,10 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		gelf_getshdr(sec, &shdr);
 		obj_start = sym.st_value;
 
+		if (verbose >= 2)
+			printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n",
+				(u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset);
+
 		sym.st_value -= shdr.sh_addr - shdr.sh_offset;
 
 		f = symbol__new(sym.st_value, sym.st_size,

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Handle overlapping MMAP events
       [not found]             ` <new-submission>
                                 ` (247 preceding siblings ...)
  2009-06-22 15:03               ` tip-bot for Peter Zijlstra
@ 2009-06-23 10:03               ` tip-bot for Peter Zijlstra
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter: Optimize perf_swcounter_event() tip-bot for Peter Zijlstra
                                 ` (458 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-23 10:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	schwidefsky, tglx, mingo

Commit-ID:  3d906ef10a539ff336010afab8f6f9c4fe379695
Gitweb:     http://git.kernel.org/tip/3d906ef10a539ff336010afab8f6f9c4fe379695
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 23 Jun 2009 11:23:07 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Jun 2009 11:42:44 +0200

perf_counter tools: Handle overlapping MMAP events

Martin Schwidefsky reported "perf report" symbol resolution
problems on S390.

Since we only report MMAP, not MUNMAP, we have to deal with
overlapping maps.

We used to simply throw out the old map on the assumption whole
maps got unmapped. This obviously doesn't deal with partial
unmaps. However it appears some dynamic linkers do fancy
partial unmaps (s390), so do something more elaborate and
truncate the old maps, only removing them when they've been
fully covered.

This resolves (part of) the S390 symbol resolution problems.

Reported-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Tested-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ec230a0..b4e76f7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -400,9 +400,27 @@ static void thread__insert_map(struct thread *self, struct map *map)
 
 	list_for_each_entry_safe(pos, tmp, &self->maps, node) {
 		if (map__overlap(pos, map)) {
-			list_del_init(&pos->node);
-			/* XXX leaks dsos */
-			free(pos);
+			if (verbose >= 2) {
+				printf("overlapping maps:\n");
+				map__fprintf(map, stdout);
+				map__fprintf(pos, stdout);
+			}
+
+			if (map->start <= pos->start && map->end > pos->start)
+				pos->start = map->end;
+
+			if (map->end >= pos->end && map->start < pos->end)
+				pos->end = map->start;
+
+			if (verbose >= 2) {
+				printf("after collision:\n");
+				map__fprintf(pos, stdout);
+			}
+
+			if (pos->start >= pos->end) {
+				list_del_init(&pos->node);
+				free(pos);
+			}
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Optimize perf_swcounter_event()
       [not found]             ` <new-submission>
                                 ` (248 preceding siblings ...)
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter tools: Handle overlapping MMAP events tip-bot for Peter Zijlstra
@ 2009-06-23 10:03               ` tip-bot for Peter Zijlstra
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter: Push inherit into perf_counter_alloc() tip-bot for Peter Zijlstra
                                 ` (457 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-23 10:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, paulus, linux-kernel, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  f29ac756a40d0f1bb07d682ea521e7b666ff06d5
Gitweb:     http://git.kernel.org/tip/f29ac756a40d0f1bb07d682ea521e7b666ff06d5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Jun 2009 18:27:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Jun 2009 11:42:44 +0200

perf_counter: Optimize perf_swcounter_event()

Similar to tracepoints, use an enable variable to reduce
overhead when unused.

Only look for a counter of a particular event type when we know
there is at least one in the system.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   11 ++++++++++-
 kernel/perf_counter.c        |   18 +++++++++++++++---
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 89698d8..e7213e4 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -669,7 +669,16 @@ static inline int is_software_counter(struct perf_counter *counter)
 		(counter->attr.type != PERF_TYPE_HW_CACHE);
 }
 
-extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
+extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
+
+extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
+
+static inline void
+perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
+{
+	if (atomic_read(&perf_swcounter_enabled[event]))
+		__perf_swcounter_event(event, nr, nmi, regs, addr);
+}
 
 extern void __perf_counter_mmap(struct vm_area_struct *vma);
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 1a933a2..7515c76 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3317,8 +3317,8 @@ out:
 	put_cpu_var(perf_cpu_context);
 }
 
-void
-perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
+void __perf_swcounter_event(u32 event, u64 nr, int nmi,
+			    struct pt_regs *regs, u64 addr)
 {
 	struct perf_sample_data data = {
 		.regs = regs,
@@ -3509,9 +3509,19 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 }
 #endif
 
+atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
+
+static void sw_perf_counter_destroy(struct perf_counter *counter)
+{
+	u64 event = counter->attr.config;
+
+	atomic_dec(&perf_swcounter_enabled[event]);
+}
+
 static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 {
 	const struct pmu *pmu = NULL;
+	u64 event = counter->attr.config;
 
 	/*
 	 * Software counters (currently) can't in general distinguish
@@ -3520,7 +3530,7 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	 * to be kernel events, and page faults are never hypervisor
 	 * events.
 	 */
-	switch (counter->attr.config) {
+	switch (event) {
 	case PERF_COUNT_SW_CPU_CLOCK:
 		pmu = &perf_ops_cpu_clock;
 
@@ -3541,6 +3551,8 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
 	case PERF_COUNT_SW_CONTEXT_SWITCHES:
 	case PERF_COUNT_SW_CPU_MIGRATIONS:
+		atomic_inc(&perf_swcounter_enabled[event]);
+		counter->destroy = sw_perf_counter_destroy;
 		pmu = &perf_ops_generic;
 		break;
 	}

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Push inherit into perf_counter_alloc()
       [not found]             ` <new-submission>
                                 ` (249 preceding siblings ...)
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter: Optimize perf_swcounter_event() tip-bot for Peter Zijlstra
@ 2009-06-23 10:03               ` tip-bot for Peter Zijlstra
  2009-06-23 10:04               ` [tip:perfcounters/urgent] perf_counter: Optimize perf_counter_alloc()'s inherit case tip-bot for Peter Zijlstra
                                 ` (456 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-23 10:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  b84fbc9fb1d943e2c5f4efe52ed0e3c93a4bdb6a
Gitweb:     http://git.kernel.org/tip/b84fbc9fb1d943e2c5f4efe52ed0e3c93a4bdb6a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 22 Jun 2009 13:57:40 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Jun 2009 11:42:45 +0200

perf_counter: Push inherit into perf_counter_alloc()

Teach perf_counter_alloc() about inheritance so that we can
optimize the inherit path in the next patch.

Remove the child_counter->atrr.inherit = 1 line because the
only way to get there is if parent_counter->attr.inherit == 1
and we copy the attrs.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 7515c76..0a45490 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3568,6 +3568,7 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 		   int cpu,
 		   struct perf_counter_context *ctx,
 		   struct perf_counter *group_leader,
+		   struct perf_counter *parent_counter,
 		   gfp_t gfpflags)
 {
 	const struct pmu *pmu;
@@ -3603,6 +3604,8 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	counter->ctx		= ctx;
 	counter->oncpu		= -1;
 
+	counter->parent		= parent_counter;
+
 	counter->ns		= get_pid_ns(current->nsproxy->pid_ns);
 	counter->id		= atomic64_inc_return(&perf_counter_id);
 
@@ -3827,7 +3830,7 @@ SYSCALL_DEFINE5(perf_counter_open,
 	}
 
 	counter = perf_counter_alloc(&attr, cpu, ctx, group_leader,
-				     GFP_KERNEL);
+				     NULL, GFP_KERNEL);
 	ret = PTR_ERR(counter);
 	if (IS_ERR(counter))
 		goto err_put_context;
@@ -3893,7 +3896,8 @@ inherit_counter(struct perf_counter *parent_counter,
 
 	child_counter = perf_counter_alloc(&parent_counter->attr,
 					   parent_counter->cpu, child_ctx,
-					   group_leader, GFP_KERNEL);
+					   group_leader, parent_counter,
+					   GFP_KERNEL);
 	if (IS_ERR(child_counter))
 		return child_counter;
 	get_ctx(child_ctx);
@@ -3916,12 +3920,6 @@ inherit_counter(struct perf_counter *parent_counter,
 	 */
 	add_counter_to_ctx(child_counter, child_ctx);
 
-	child_counter->parent = parent_counter;
-	/*
-	 * inherit into child's child as well:
-	 */
-	child_counter->attr.inherit = 1;
-
 	/*
 	 * Get a reference to the parent filp - we will fput it
 	 * when the child counter exits. This is safe to do because

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Optimize perf_counter_alloc()'s inherit case
       [not found]             ` <new-submission>
                                 ` (250 preceding siblings ...)
  2009-06-23 10:03               ` [tip:perfcounters/urgent] perf_counter: Push inherit into perf_counter_alloc() tip-bot for Peter Zijlstra
@ 2009-06-23 10:04               ` tip-bot for Peter Zijlstra
  2009-06-23 14:42               ` [tip:perfcounters/urgent] perf report: Fix help text typo tip-bot for Ingo Molnar
                                 ` (455 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-23 10:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  f344011ccb85469445369153c3d27c4ee4bc2ac8
Gitweb:     http://git.kernel.org/tip/f344011ccb85469445369153c3d27c4ee4bc2ac8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 22 Jun 2009 13:58:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Jun 2009 11:42:46 +0200

perf_counter: Optimize perf_counter_alloc()'s inherit case

We don't need to add usage counts for swcounter and attr usage
models for inherited counters since the parent counter will
always have one, which suffices to generate the needed output.

This avoids up to 3 global atomic increments per inherited
counter.

LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 0a45490..c2b19c1 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1508,11 +1508,13 @@ static void free_counter(struct perf_counter *counter)
 {
 	perf_pending_sync(counter);
 
-	atomic_dec(&nr_counters);
-	if (counter->attr.mmap)
-		atomic_dec(&nr_mmap_counters);
-	if (counter->attr.comm)
-		atomic_dec(&nr_comm_counters);
+	if (!counter->parent) {
+		atomic_dec(&nr_counters);
+		if (counter->attr.mmap)
+			atomic_dec(&nr_mmap_counters);
+		if (counter->attr.comm)
+			atomic_dec(&nr_comm_counters);
+	}
 
 	if (counter->destroy)
 		counter->destroy(counter);
@@ -3515,6 +3517,8 @@ static void sw_perf_counter_destroy(struct perf_counter *counter)
 {
 	u64 event = counter->attr.config;
 
+	WARN_ON(counter->parent);
+
 	atomic_dec(&perf_swcounter_enabled[event]);
 }
 
@@ -3551,8 +3555,10 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
 	case PERF_COUNT_SW_CONTEXT_SWITCHES:
 	case PERF_COUNT_SW_CPU_MIGRATIONS:
-		atomic_inc(&perf_swcounter_enabled[event]);
-		counter->destroy = sw_perf_counter_destroy;
+		if (!counter->parent) {
+			atomic_inc(&perf_swcounter_enabled[event]);
+			counter->destroy = sw_perf_counter_destroy;
+		}
 		pmu = &perf_ops_generic;
 		break;
 	}
@@ -3663,11 +3669,13 @@ done:
 
 	counter->pmu = pmu;
 
-	atomic_inc(&nr_counters);
-	if (counter->attr.mmap)
-		atomic_inc(&nr_mmap_counters);
-	if (counter->attr.comm)
-		atomic_inc(&nr_comm_counters);
+	if (!counter->parent) {
+		atomic_inc(&nr_counters);
+		if (counter->attr.mmap)
+			atomic_inc(&nr_mmap_counters);
+		if (counter->attr.comm)
+			atomic_inc(&nr_comm_counters);
+	}
 
 	return counter;
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf report: Fix help text typo
       [not found]             ` <new-submission>
                                 ` (251 preceding siblings ...)
  2009-06-23 10:04               ` [tip:perfcounters/urgent] perf_counter: Optimize perf_counter_alloc()'s inherit case tip-bot for Peter Zijlstra
@ 2009-06-23 14:42               ` tip-bot for Ingo Molnar
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter tools: Rework the file format tip-bot for Peter Zijlstra
                                 ` (454 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-23 14:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, Brice.Goglin, hpa, mingo,
	a.p.zijlstra, efault, tglx, mingo

Commit-ID:  b0a28589b2fc9bee8ed83dee006a497d1ce93841
Gitweb:     http://git.kernel.org/tip/b0a28589b2fc9bee8ed83dee006a497d1ce93841
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 23 Jun 2009 16:39:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Jun 2009 16:39:53 +0200

perf report: Fix help text typo

Reported-by: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Documentation/perf-report.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 52d3fc6..40c1db8 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 This command displays the performance counter profile information recorded
-via perf report.
+via perf record.
 
 OPTIONS
 -------

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Rework the file format
       [not found]             ` <new-submission>
                                 ` (252 preceding siblings ...)
  2009-06-23 14:42               ` [tip:perfcounters/urgent] perf report: Fix help text typo tip-bot for Ingo Molnar
@ 2009-06-25 19:42               ` tip-bot for Peter Zijlstra
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter: Split the mmap control page in two parts tip-bot for Peter Zijlstra
                                 ` (453 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  7c6a1c65bbd3be688e581511f45818663efc1877
Gitweb:     http://git.kernel.org/tip/7c6a1c65bbd3be688e581511f45818663efc1877
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 25 Jun 2009 17:05:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:04 +0200

perf_counter tools: Rework the file format

Create a structured file format that includes the full
perf_counter_attr and all its relevant counter IDs so that
the reporting program has full information.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile           |    3 +-
 tools/perf/builtin-record.c   |  100 +++++++++++------
 tools/perf/builtin-report.c   |   37 +++++--
 tools/perf/perf.h             |    8 +-
 tools/perf/util/header.c      |  242 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/header.h      |   37 ++++++
 tools/perf/util/string.h      |    2 +-
 tools/perf/util/symbol.h      |    2 +-
 tools/perf/{ => util}/types.h |    0
 9 files changed, 377 insertions(+), 54 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 36d7eef..d3887ed 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -290,7 +290,7 @@ LIB_FILE=libperf.a
 
 LIB_H += ../../include/linux/perf_counter.h
 LIB_H += perf.h
-LIB_H += types.h
+LIB_H += util/types.h
 LIB_H += util/list.h
 LIB_H += util/rbtree.h
 LIB_H += util/levenshtein.h
@@ -328,6 +328,7 @@ LIB_OBJS += util/sigchain.o
 LIB_OBJS += util/symbol.o
 LIB_OBJS += util/color.o
 LIB_OBJS += util/pager.o
+LIB_OBJS += util/header.o
 
 BUILTIN_OBJS += builtin-annotate.o
 BUILTIN_OBJS += builtin-help.o
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 9b899ba..f4f0240 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -14,6 +14,8 @@
 #include "util/parse-events.h"
 #include "util/string.h"
 
+#include "util/header.h"
+
 #include <unistd.h>
 #include <sched.h>
 
@@ -52,7 +54,8 @@ static int			nr_poll;
 static int			nr_cpu;
 
 static int			file_new = 1;
-static struct perf_file_header	file_header;
+
+struct perf_header		*header;
 
 struct mmap_event {
 	struct perf_event_header	header;
@@ -328,7 +331,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)
 	fclose(fp);
 }
 
-static void synthesize_samples(void)
+static void synthesize_all(void)
 {
 	DIR *proc;
 	struct dirent dirent, *next;
@@ -352,10 +355,35 @@ static void synthesize_samples(void)
 
 static int group_fd;
 
+static struct perf_header_attr *get_header_attr(struct perf_counter_attr *a, int nr)
+{
+	struct perf_header_attr *h_attr;
+
+	if (nr < header->attrs) {
+		h_attr = header->attr[nr];
+	} else {
+		h_attr = perf_header_attr__new(a);
+		perf_header__add_attr(header, h_attr);
+	}
+
+	return h_attr;
+}
+
 static void create_counter(int counter, int cpu, pid_t pid)
 {
 	struct perf_counter_attr *attr = attrs + counter;
-	int track = 1;
+	struct perf_header_attr *h_attr;
+	int track = !counter; /* only the first counter needs these */
+	struct {
+		u64 count;
+		u64 time_enabled;
+		u64 time_running;
+		u64 id;
+	} read_data;
+
+	attr->read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
+				  PERF_FORMAT_TOTAL_TIME_RUNNING |
+				  PERF_FORMAT_ID;
 
 	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
 
@@ -368,22 +396,11 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	if (call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
-	if (file_new) {
-		file_header.sample_type = attr->sample_type;
-	} else {
-		if (file_header.sample_type != attr->sample_type) {
-			fprintf(stderr, "incompatible append\n");
-			exit(-1);
-		}
-	}
-
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= (cpu < 0) && inherit;
 	attr->disabled		= 1;
 
-	track = 0; /* only the first counter needs these */
-
 try_again:
 	fd[nr_cpu][counter] = sys_perf_counter_open(attr, pid, cpu, group_fd, 0);
 
@@ -414,6 +431,19 @@ try_again:
 		exit(-1);
 	}
 
+	h_attr = get_header_attr(attr, counter);
+
+	if (!file_new) {
+		if (memcmp(&h_attr->attr, attr, sizeof(*attr))) {
+			fprintf(stderr, "incompatible append\n");
+			exit(-1);
+		}
+	}
+
+	read(fd[nr_cpu][counter], &read_data, sizeof(read_data));
+
+	perf_header_attr__add_id(h_attr, read_data.id);
+
 	assert(fd[nr_cpu][counter] >= 0);
 	fcntl(fd[nr_cpu][counter], F_SETFL, O_NONBLOCK);
 
@@ -444,11 +474,6 @@ static void open_counters(int cpu, pid_t pid)
 {
 	int counter;
 
-	if (pid > 0) {
-		pid_synthesize_comm_event(pid, 0);
-		pid_synthesize_mmap_samples(pid);
-	}
-
 	group_fd = -1;
 	for (counter = 0; counter < nr_counters; counter++)
 		create_counter(counter, cpu, pid);
@@ -458,17 +483,16 @@ static void open_counters(int cpu, pid_t pid)
 
 static void atexit_header(void)
 {
-	file_header.data_size += bytes_written;
+	header->data_size += bytes_written;
 
-	if (pwrite(output, &file_header, sizeof(file_header), 0) == -1)
-		perror("failed to write on file headers");
+	perf_header__write(header, output);
 }
 
 static int __cmd_record(int argc, const char **argv)
 {
 	int i, counter;
 	struct stat st;
-	pid_t pid;
+	pid_t pid = 0;
 	int flags;
 	int ret;
 
@@ -499,22 +523,31 @@ static int __cmd_record(int argc, const char **argv)
 		exit(-1);
 	}
 
-	if (!file_new) {
-		if (read(output, &file_header, sizeof(file_header)) == -1) {
-			perror("failed to read file headers");
-			exit(-1);
-		}
-
-		lseek(output, file_header.data_size, SEEK_CUR);
-	}
+	if (!file_new)
+		header = perf_header__read(output);
+	else
+		header = perf_header__new();
 
 	atexit(atexit_header);
 
 	if (!system_wide) {
-		open_counters(-1, target_pid != -1 ? target_pid : getpid());
+		pid = target_pid;
+		if (pid == -1)
+			pid = getpid();
+
+		open_counters(-1, pid);
 	} else for (i = 0; i < nr_cpus; i++)
 		open_counters(i, target_pid);
 
+	if (file_new)
+		perf_header__write(header, output);
+
+	if (!system_wide) {
+		pid_synthesize_comm_event(pid, 0);
+		pid_synthesize_mmap_samples(pid);
+	} else
+		synthesize_all();
+
 	if (target_pid == -1 && argc) {
 		pid = fork();
 		if (pid < 0)
@@ -538,9 +571,6 @@ static int __cmd_record(int argc, const char **argv)
 		}
 	}
 
-	if (system_wide)
-		synthesize_samples();
-
 	while (!done) {
 		int hits = samples;
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b4e76f7..e575f30 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -17,6 +17,7 @@
 #include "util/string.h"
 
 #include "perf.h"
+#include "util/header.h"
 
 #include "util/parse-options.h"
 #include "util/parse-events.h"
@@ -1385,13 +1386,27 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
-static struct perf_file_header		file_header;
+static struct perf_header	*header;
+
+static int perf_header__has_sample(u64 sample_mask)
+{
+	int i;
+
+	for (i = 0; i < header->attrs; i++) {
+		struct perf_header_attr *attr = header->attr[i];
+
+		if (!(attr->attr.sample_type & sample_mask))
+			return 0;
+	}
+
+	return 1;
+}
 
 static int __cmd_report(void)
 {
 	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
-	unsigned long head = sizeof(file_header);
+	unsigned long head, shift;
 	struct stat stat;
 	event_t *event;
 	uint32_t size;
@@ -1419,13 +1434,11 @@ static int __cmd_report(void)
 		exit(0);
 	}
 
-	if (read(input, &file_header, sizeof(file_header)) == -1) {
-		perror("failed to read file headers");
-		exit(-1);
-	}
+	header = perf_header__read(input);
+	head = header->data_offset;
 
 	if (sort__has_parent &&
-	    !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) {
+	    !perf_header__has_sample(PERF_SAMPLE_CALLCHAIN)) {
 		fprintf(stderr, "selected --sort parent, but no callchain data\n");
 		exit(-1);
 	}
@@ -1445,6 +1458,11 @@ static int __cmd_report(void)
 		cwd = NULL;
 		cwdlen = 0;
 	}
+
+	shift = page_size * (head / page_size);
+	offset += shift;
+	head -= shift;
+
 remap:
 	buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
 			   MAP_SHARED, input, offset);
@@ -1461,9 +1479,10 @@ more:
 		size = 8;
 
 	if (head + event->header.size >= page_size * mmap_window) {
-		unsigned long shift = page_size * (head / page_size);
 		int ret;
 
+		shift = page_size * (head / page_size);
+
 		ret = munmap(buf, page_size * mmap_window);
 		assert(ret == 0);
 
@@ -1501,7 +1520,7 @@ more:
 
 	head += size;
 
-	if (offset + head >= sizeof(file_header) + file_header.data_size)
+	if (offset + head >= header->data_offset + header->data_size)
 		goto done;
 
 	if (offset + head < stat.st_size)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index bccb529..16c84fd 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -19,7 +19,7 @@
 #include <sys/syscall.h>
 
 #include "../../include/linux/perf_counter.h"
-#include "types.h"
+#include "util/types.h"
 
 /*
  * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all
@@ -66,10 +66,4 @@ sys_perf_counter_open(struct perf_counter_attr *attr,
 #define MAX_COUNTERS			256
 #define MAX_NR_CPUS			256
 
-struct perf_file_header {
-	u64	version;
-	u64	sample_type;
-	u64	data_size;
-};
-
 #endif
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
new file mode 100644
index 0000000..450384b
--- /dev/null
+++ b/tools/perf/util/header.c
@@ -0,0 +1,242 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "util.h"
+#include "header.h"
+
+/*
+ *
+ */
+
+struct perf_header_attr *perf_header_attr__new(struct perf_counter_attr *attr)
+{
+	struct perf_header_attr *self = malloc(sizeof(*self));
+
+	if (!self)
+		die("nomem");
+
+	self->attr = *attr;
+	self->ids = 0;
+	self->size = 1;
+	self->id = malloc(sizeof(u64));
+
+	if (!self->id)
+		die("nomem");
+
+	return self;
+}
+
+void perf_header_attr__add_id(struct perf_header_attr *self, u64 id)
+{
+	int pos = self->ids;
+
+	self->ids++;
+	if (self->ids > self->size) {
+		self->size *= 2;
+		self->id = realloc(self->id, self->size * sizeof(u64));
+		if (!self->id)
+			die("nomem");
+	}
+	self->id[pos] = id;
+}
+
+/*
+ *
+ */
+
+struct perf_header *perf_header__new(void)
+{
+	struct perf_header *self = malloc(sizeof(*self));
+
+	if (!self)
+		die("nomem");
+
+	self->frozen = 0;
+
+	self->attrs = 0;
+	self->size = 1;
+	self->attr = malloc(sizeof(void *));
+
+	if (!self->attr)
+		die("nomem");
+
+	self->data_offset = 0;
+	self->data_size = 0;
+
+	return self;
+}
+
+void perf_header__add_attr(struct perf_header *self,
+			   struct perf_header_attr *attr)
+{
+	int pos = self->attrs;
+
+	if (self->frozen)
+		die("frozen");
+
+	self->attrs++;
+	if (self->attrs > self->size) {
+		self->size *= 2;
+		self->attr = realloc(self->attr, self->size * sizeof(void *));
+		if (!self->attr)
+			die("nomem");
+	}
+	self->attr[pos] = attr;
+}
+
+static const char *__perf_magic = "PERFFILE";
+
+#define PERF_MAGIC	(*(u64 *)__perf_magic)
+
+struct perf_file_section {
+	u64 offset;
+	u64 size;
+};
+
+struct perf_file_attr {
+	struct perf_counter_attr	attr;
+	struct perf_file_section	ids;
+};
+
+struct perf_file_header {
+	u64				magic;
+	u64				size;
+	u64				attr_size;
+	struct perf_file_section	attrs;
+	struct perf_file_section	data;
+};
+
+static void do_write(int fd, void *buf, size_t size)
+{
+	while (size) {
+		int ret = write(fd, buf, size);
+
+		if (ret < 0)
+			die("failed to write");
+
+		size -= ret;
+		buf += ret;
+	}
+}
+
+void perf_header__write(struct perf_header *self, int fd)
+{
+	struct perf_file_header f_header;
+	struct perf_file_attr   f_attr;
+	struct perf_header_attr	*attr;
+	int i;
+
+	lseek(fd, sizeof(f_header), SEEK_SET);
+
+
+	for (i = 0; i < self->attrs; i++) {
+		attr = self->attr[i];
+
+		attr->id_offset = lseek(fd, 0, SEEK_CUR);
+		do_write(fd, attr->id, attr->ids * sizeof(u64));
+	}
+
+
+	self->attr_offset = lseek(fd, 0, SEEK_CUR);
+
+	for (i = 0; i < self->attrs; i++) {
+		attr = self->attr[i];
+
+		f_attr = (struct perf_file_attr){
+			.attr = attr->attr,
+			.ids  = {
+				.offset = attr->id_offset,
+				.size   = attr->ids * sizeof(u64),
+			}
+		};
+		do_write(fd, &f_attr, sizeof(f_attr));
+	}
+
+
+	self->data_offset = lseek(fd, 0, SEEK_CUR);
+
+	f_header = (struct perf_file_header){
+		.magic	   = PERF_MAGIC,
+		.size	   = sizeof(f_header),
+		.attr_size = sizeof(f_attr),
+		.attrs = {
+			.offset = self->attr_offset,
+			.size   = self->attrs * sizeof(f_attr),
+		},
+		.data = {
+			.offset = self->data_offset,
+			.size	= self->data_size,
+		},
+	};
+
+	lseek(fd, 0, SEEK_SET);
+	do_write(fd, &f_header, sizeof(f_header));
+	lseek(fd, self->data_offset + self->data_size, SEEK_SET);
+
+	self->frozen = 1;
+}
+
+static void do_read(int fd, void *buf, size_t size)
+{
+	while (size) {
+		int ret = read(fd, buf, size);
+
+		if (ret < 0)
+			die("failed to read");
+
+		size -= ret;
+		buf += ret;
+	}
+}
+
+struct perf_header *perf_header__read(int fd)
+{
+	struct perf_header	*self = perf_header__new();
+	struct perf_file_header f_header;
+	struct perf_file_attr	f_attr;
+	u64			f_id;
+
+	int nr_attrs, nr_ids, i, j;
+
+	lseek(fd, 0, SEEK_SET);
+	do_read(fd, &f_header, sizeof(f_header));
+
+	if (f_header.magic	!= PERF_MAGIC		||
+	    f_header.size	!= sizeof(f_header)	||
+	    f_header.attr_size	!= sizeof(f_attr))
+		die("incompatible file format");
+
+	nr_attrs = f_header.attrs.size / sizeof(f_attr);
+	lseek(fd, f_header.attrs.offset, SEEK_SET);
+
+	for (i = 0; i < nr_attrs; i++) {
+		struct perf_header_attr *attr;
+		off_t tmp = lseek(fd, 0, SEEK_CUR);
+
+		do_read(fd, &f_attr, sizeof(f_attr));
+
+		attr = perf_header_attr__new(&f_attr.attr);
+
+		nr_ids = f_attr.ids.size / sizeof(u64);
+		lseek(fd, f_attr.ids.offset, SEEK_SET);
+
+		for (j = 0; j < nr_ids; j++) {
+			do_read(fd, &f_id, sizeof(f_id));
+
+			perf_header_attr__add_id(attr, f_id);
+		}
+		perf_header__add_attr(self, attr);
+		lseek(fd, tmp, SEEK_SET);
+	}
+
+	self->data_offset = f_header.data.offset;
+	self->data_size   = f_header.data.size;
+
+	lseek(fd, self->data_offset + self->data_size, SEEK_SET);
+
+	self->frozen = 1;
+
+	return self;
+}
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
new file mode 100644
index 0000000..b5ef53a
--- /dev/null
+++ b/tools/perf/util/header.h
@@ -0,0 +1,37 @@
+#ifndef _PERF_HEADER_H
+#define _PERF_HEADER_H
+
+#include "../../../include/linux/perf_counter.h"
+#include <sys/types.h>
+#include "types.h"
+
+struct perf_header_attr {
+	struct perf_counter_attr attr;
+	int ids, size;
+	u64 *id;
+	off_t id_offset;
+};
+
+struct perf_header {
+	int frozen;
+	int attrs, size;
+	struct perf_header_attr **attr;
+	off_t attr_offset;
+	u64 data_offset;
+	u64 data_size;
+};
+
+struct perf_header *perf_header__read(int fd);
+void perf_header__write(struct perf_header *self, int fd);
+
+void perf_header__add_attr(struct perf_header *self,
+			   struct perf_header_attr *attr);
+
+struct perf_header_attr *
+perf_header_attr__new(struct perf_counter_attr *attr);
+void perf_header_attr__add_id(struct perf_header_attr *self, u64 id);
+
+
+struct perf_header *perf_header__new(void);
+
+#endif /* _PERF_HEADER_H */
diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h
index 37b0325..3dca2f6 100644
--- a/tools/perf/util/string.h
+++ b/tools/perf/util/string.h
@@ -1,7 +1,7 @@
 #ifndef _PERF_STRING_H_
 #define _PERF_STRING_H_
 
-#include "../types.h"
+#include "types.h"
 
 int hex2u64(const char *ptr, u64 *val);
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index ea332e5..940b432 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -2,7 +2,7 @@
 #define _PERF_SYMBOL_ 1
 
 #include <linux/types.h>
-#include "../types.h"
+#include "types.h"
 #include "list.h"
 #include "rbtree.h"
 
diff --git a/tools/perf/types.h b/tools/perf/util/types.h
similarity index 100%
rename from tools/perf/types.h
rename to tools/perf/util/types.h

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Split the mmap control page in two parts
       [not found]             ` <new-submission>
                                 ` (253 preceding siblings ...)
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter tools: Rework the file format tip-bot for Peter Zijlstra
@ 2009-06-25 19:42               ` tip-bot for Peter Zijlstra
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter: Add scale information to the mmap control page tip-bot for Peter Zijlstra
                                 ` (452 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  41f95331b972a039f519ae0c70f051b7121f7346
Gitweb:     http://git.kernel.org/tip/41f95331b972a039f519ae0c70f051b7121f7346
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 23 Jun 2009 17:55:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:05 +0200

perf_counter: Split the mmap control page in two parts

Since there are two distinct sections to the control page,
move them apart so that possible extentions don't overlap.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index e7213e4..489d5cb 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -233,6 +233,12 @@ struct perf_counter_mmap_page {
 	__u32	index;			/* hardware counter identifier */
 	__s64	offset;			/* add to hardware counter value */
 
+		/*
+		 * Hole for extension of the self monitor capabilities
+		 */
+
+	__u64	__reserved[125];	/* align to 1k */
+
 	/*
 	 * Control data for the mmap() data buffer.
 	 *

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Add scale information to the mmap control page
       [not found]             ` <new-submission>
                                 ` (254 preceding siblings ...)
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter: Split the mmap control page in two parts tip-bot for Peter Zijlstra
@ 2009-06-25 19:42               ` tip-bot for Peter Zijlstra
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter, x86: Add mmap counter read support tip-bot for Peter Zijlstra
                                 ` (451 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  7f8b4e4e0988dadfd22330fd147ad2453e19f510
Gitweb:     http://git.kernel.org/tip/7f8b4e4e0988dadfd22330fd147ad2453e19f510
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 22 Jun 2009 14:34:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:05 +0200

perf_counter: Add scale information to the mmap control page

Add the needed time scale to the self-profile mmap information.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    4 +++-
 kernel/perf_counter.c        |    6 ++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 489d5cb..bcbf1c4 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -232,12 +232,14 @@ struct perf_counter_mmap_page {
 	__u32	lock;			/* seqlock for synchronization */
 	__u32	index;			/* hardware counter identifier */
 	__s64	offset;			/* add to hardware counter value */
+	__u64	time_enabled;		/* time counter active */
+	__u64	time_running;		/* time counter on cpu */
 
 		/*
 		 * Hole for extension of the self monitor capabilities
 		 */
 
-	__u64	__reserved[125];	/* align to 1k */
+	__u64	__reserved[123];	/* align to 1k */
 
 	/*
 	 * Control data for the mmap() data buffer.
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index c2b19c1..23614ad 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1782,6 +1782,12 @@ void perf_counter_update_userpage(struct perf_counter *counter)
 	if (counter->state == PERF_COUNTER_STATE_ACTIVE)
 		userpg->offset -= atomic64_read(&counter->hw.prev_count);
 
+	userpg->time_enabled = counter->total_time_enabled +
+			atomic64_read(&counter->child_total_time_enabled);
+
+	userpg->time_running = counter->total_time_running +
+			atomic64_read(&counter->child_total_time_running);
+
 	barrier();
 	++userpg->lock;
 	preempt_enable();

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter, x86: Add mmap counter read support
       [not found]             ` <new-submission>
                                 ` (255 preceding siblings ...)
  2009-06-25 19:42               ` [tip:perfcounters/urgent] perf_counter: Add scale information to the mmap control page tip-bot for Peter Zijlstra
@ 2009-06-25 19:43               ` tip-bot for Peter Zijlstra
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Add PERF_EVENT_READ tip-bot for Peter Zijlstra
                                 ` (450 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  194002b274e9169a04beb1b23dcc132159bb566c
Gitweb:     http://git.kernel.org/tip/194002b274e9169a04beb1b23dcc132159bb566c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 22 Jun 2009 16:35:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:06 +0200

perf_counter, x86: Add mmap counter read support

Update the mmap control page with the needed information to
use the userspace RDPMC instruction for self monitoring.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/powerpc/include/asm/perf_counter.h |    2 ++
 arch/x86/include/asm/perf_counter.h     |    3 +++
 arch/x86/kernel/cpu/perf_counter.c      |    6 ++++++
 kernel/perf_counter.c                   |   10 +++++++++-
 4 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_counter.h b/arch/powerpc/include/asm/perf_counter.h
index 8ccd4e1..0ea0639 100644
--- a/arch/powerpc/include/asm/perf_counter.h
+++ b/arch/powerpc/include/asm/perf_counter.h
@@ -61,6 +61,8 @@ struct pt_regs;
 extern unsigned long perf_misc_flags(struct pt_regs *regs);
 extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
 
+#define PERF_COUNTER_INDEX_OFFSET	1
+
 /*
  * Only override the default definitions in include/linux/perf_counter.h
  * if we have hardware PMU support.
diff --git a/arch/x86/include/asm/perf_counter.h b/arch/x86/include/asm/perf_counter.h
index 5fb33e1..fa64e40 100644
--- a/arch/x86/include/asm/perf_counter.h
+++ b/arch/x86/include/asm/perf_counter.h
@@ -87,6 +87,9 @@ union cpuid10_edx {
 #ifdef CONFIG_PERF_COUNTERS
 extern void init_hw_perf_counters(void);
 extern void perf_counters_lapic_init(void);
+
+#define PERF_COUNTER_INDEX_OFFSET			0
+
 #else
 static inline void init_hw_perf_counters(void)		{ }
 static inline void perf_counters_lapic_init(void)	{ }
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index a310d19..b83474b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -912,6 +912,8 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 	err = checking_wrmsrl(hwc->counter_base + idx,
 			     (u64)(-left) & x86_pmu.counter_mask);
 
+	perf_counter_update_userpage(counter);
+
 	return ret;
 }
 
@@ -1034,6 +1036,8 @@ try_generic:
 	x86_perf_counter_set_period(counter, hwc, idx);
 	x86_pmu.enable(hwc, idx);
 
+	perf_counter_update_userpage(counter);
+
 	return 0;
 }
 
@@ -1126,6 +1130,8 @@ static void x86_pmu_disable(struct perf_counter *counter)
 	x86_perf_counter_update(counter, hwc, idx);
 	cpuc->counters[idx] = NULL;
 	clear_bit(idx, cpuc->used_mask);
+
+	perf_counter_update_userpage(counter);
 }
 
 /*
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 23614ad..02994a7 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1753,6 +1753,14 @@ int perf_counter_task_disable(void)
 	return 0;
 }
 
+static int perf_counter_index(struct perf_counter *counter)
+{
+	if (counter->state != PERF_COUNTER_STATE_ACTIVE)
+		return 0;
+
+	return counter->hw.idx + 1 - PERF_COUNTER_INDEX_OFFSET;
+}
+
 /*
  * Callers need to ensure there can be no nesting of this function, otherwise
  * the seqlock logic goes bad. We can not serialize this because the arch
@@ -1777,7 +1785,7 @@ void perf_counter_update_userpage(struct perf_counter *counter)
 	preempt_disable();
 	++userpg->lock;
 	barrier();
-	userpg->index = counter->hw.idx;
+	userpg->index = perf_counter_index(counter);
 	userpg->offset = atomic64_read(&counter->count);
 	if (counter->state == PERF_COUNTER_STATE_ACTIVE)
 		userpg->offset -= atomic64_read(&counter->hw.prev_count);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Add PERF_EVENT_READ
       [not found]             ` <new-submission>
                                 ` (256 preceding siblings ...)
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter, x86: Add mmap counter read support tip-bot for Peter Zijlstra
@ 2009-06-25 19:43               ` tip-bot for Peter Zijlstra
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Implement more accurate per task statistics tip-bot for Peter Zijlstra
                                 ` (449 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  38b200d67636a30cb8dc1508137908e7a649b5c9
Gitweb:     http://git.kernel.org/tip/38b200d67636a30cb8dc1508137908e7a649b5c9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 23 Jun 2009 20:13:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:07 +0200

perf_counter: Add PERF_EVENT_READ

Provide a read() like event which can be used to log the
counter value at specific sites such as child->parent
folding on exit.

In order to be useful, we log the counter parent ID, not the
actual counter ID, since userspace can only relate parent
IDs to perf_counter_attr constructs.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |   12 +++++++
 kernel/perf_counter.c        |   72 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index bcbf1c4..6a384f0 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -335,6 +335,18 @@ enum perf_event_type {
 	PERF_EVENT_FORK			= 7,
 
 	/*
+	 * struct {
+	 * 	struct perf_event_header	header;
+	 * 	u32				pid, tid;
+	 * 	u64				value;
+	 * 	{ u64		time_enabled; 	} && PERF_FORMAT_ENABLED
+	 * 	{ u64		time_running; 	} && PERF_FORMAT_RUNNING
+	 * 	{ u64		parent_id;	} && PERF_FORMAT_ID
+	 * };
+	 */
+	PERF_EVENT_READ			= 8,
+
+	/*
 	 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
 	 * will be PERF_SAMPLE_*
 	 *
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 02994a7..a72c20e 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2624,6 +2624,66 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 }
 
 /*
+ * read event
+ */
+
+struct perf_read_event {
+	struct perf_event_header	header;
+
+	u32				pid;
+	u32				tid;
+	u64				value;
+	u64				format[3];
+};
+
+static void
+perf_counter_read_event(struct perf_counter *counter,
+			struct task_struct *task)
+{
+	struct perf_output_handle handle;
+	struct perf_read_event event = {
+		.header = {
+			.type = PERF_EVENT_READ,
+			.misc = 0,
+			.size = sizeof(event) - sizeof(event.format),
+		},
+		.pid = perf_counter_pid(counter, task),
+		.tid = perf_counter_tid(counter, task),
+		.value = atomic64_read(&counter->count),
+	};
+	int ret, i = 0;
+
+	if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
+		event.header.size += sizeof(u64);
+		event.format[i++] = counter->total_time_enabled;
+	}
+
+	if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) {
+		event.header.size += sizeof(u64);
+		event.format[i++] = counter->total_time_running;
+	}
+
+	if (counter->attr.read_format & PERF_FORMAT_ID) {
+		u64 id;
+
+		event.header.size += sizeof(u64);
+		if (counter->parent)
+			id = counter->parent->id;
+		else
+			id = counter->id;
+
+		event.format[i++] = id;
+	}
+
+	ret = perf_output_begin(&handle, counter, event.header.size, 0, 0);
+	if (ret)
+		return;
+
+	perf_output_copy(&handle, &event, event.header.size);
+	perf_output_end(&handle);
+}
+
+/*
  * fork tracking
  */
 
@@ -3985,10 +4045,13 @@ static int inherit_group(struct perf_counter *parent_counter,
 }
 
 static void sync_child_counter(struct perf_counter *child_counter,
-			       struct perf_counter *parent_counter)
+			       struct task_struct *child)
 {
+	struct perf_counter *parent_counter = child_counter->parent;
 	u64 child_val;
 
+	perf_counter_read_event(child_counter, child);
+
 	child_val = atomic64_read(&child_counter->count);
 
 	/*
@@ -4017,7 +4080,8 @@ static void sync_child_counter(struct perf_counter *child_counter,
 
 static void
 __perf_counter_exit_task(struct perf_counter *child_counter,
-			 struct perf_counter_context *child_ctx)
+			 struct perf_counter_context *child_ctx,
+			 struct task_struct *child)
 {
 	struct perf_counter *parent_counter;
 
@@ -4031,7 +4095,7 @@ __perf_counter_exit_task(struct perf_counter *child_counter,
 	 * counters need to be zapped - but otherwise linger.
 	 */
 	if (parent_counter) {
-		sync_child_counter(child_counter, parent_counter);
+		sync_child_counter(child_counter, child);
 		free_counter(child_counter);
 	}
 }
@@ -4093,7 +4157,7 @@ void perf_counter_exit_task(struct task_struct *child)
 again:
 	list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,
 				 list_entry)
-		__perf_counter_exit_task(child_counter, child_ctx);
+		__perf_counter_exit_task(child_counter, child_ctx, child);
 
 	/*
 	 * If the last counter was a group counter, it will have appended all

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Implement more accurate per task statistics
       [not found]             ` <new-submission>
                                 ` (257 preceding siblings ...)
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Add PERF_EVENT_READ tip-bot for Peter Zijlstra
@ 2009-06-25 19:43               ` tip-bot for Peter Zijlstra
  2009-06-26 11:10                 ` [RFC][PATCH] perf_counter: Complete counter swap Peter Zijlstra
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Rework the sample ABI tip-bot for Peter Zijlstra
                                 ` (448 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  bfbd3381e63aa2a14c6706afb50ce4630aa0d9a2
Gitweb:     http://git.kernel.org/tip/bfbd3381e63aa2a14c6706afb50ce4630aa0d9a2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Jun 2009 21:11:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:07 +0200

perf_counter: Implement more accurate per task statistics

With the introduction of PERF_EVENT_READ we have the
possibility to provide accurate counter values for
individual tasks in a task hierarchy.

However, due to the lazy context switching used for similar
counter contexts our current per task counts are way off.

In order to maintain some of the lazy switch benefits we
don't disable it out-right, but simply iterate the active
counters and flip the values between the contexts.

This only reads the counters but does not need to reprogram
the full PMU.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    4 ++-
 kernel/perf_counter.c        |   83 ++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6a384f0..de70a10 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -178,8 +178,9 @@ struct perf_counter_attr {
 				mmap           :  1, /* include mmap data     */
 				comm	       :  1, /* include comm data     */
 				freq           :  1, /* use freq, not period  */
+				inherit_stat   :  1, /* per task counts       */
 
-				__reserved_1   : 53;
+				__reserved_1   : 52;
 
 	__u32			wakeup_events;	/* wakeup every n events */
 	__u32			__reserved_2;
@@ -602,6 +603,7 @@ struct perf_counter_context {
 	int				nr_counters;
 	int				nr_active;
 	int				is_active;
+	int				nr_stat;
 	atomic_t			refcount;
 	struct task_struct		*task;
 
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index a72c20e..385ca51 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -236,6 +236,8 @@ list_add_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 
 	list_add_rcu(&counter->event_entry, &ctx->event_list);
 	ctx->nr_counters++;
+	if (counter->attr.inherit_stat)
+		ctx->nr_stat++;
 }
 
 /*
@@ -250,6 +252,8 @@ list_del_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 	if (list_empty(&counter->list_entry))
 		return;
 	ctx->nr_counters--;
+	if (counter->attr.inherit_stat)
+		ctx->nr_stat--;
 
 	list_del_init(&counter->list_entry);
 	list_del_rcu(&counter->event_entry);
@@ -1006,6 +1010,76 @@ static int context_equiv(struct perf_counter_context *ctx1,
 		&& !ctx1->pin_count && !ctx2->pin_count;
 }
 
+static void __perf_counter_read(void *counter);
+
+static void __perf_counter_sync_stat(struct perf_counter *counter,
+				     struct perf_counter *next_counter)
+{
+	u64 value;
+
+	if (!counter->attr.inherit_stat)
+		return;
+
+	/*
+	 * Update the counter value, we cannot use perf_counter_read()
+	 * because we're in the middle of a context switch and have IRQs
+	 * disabled, which upsets smp_call_function_single(), however
+	 * we know the counter must be on the current CPU, therefore we
+	 * don't need to use it.
+	 */
+	switch (counter->state) {
+	case PERF_COUNTER_STATE_ACTIVE:
+		__perf_counter_read(counter);
+		break;
+
+	case PERF_COUNTER_STATE_INACTIVE:
+		update_counter_times(counter);
+		break;
+
+	default:
+		break;
+	}
+
+	/*
+	 * In order to keep per-task stats reliable we need to flip the counter
+	 * values when we flip the contexts.
+	 */
+	value = atomic64_read(&next_counter->count);
+	value = atomic64_xchg(&counter->count, value);
+	atomic64_set(&next_counter->count, value);
+
+	/*
+	 * XXX also sync time_enabled and time_running ?
+	 */
+}
+
+#define list_next_entry(pos, member) \
+	list_entry(pos->member.next, typeof(*pos), member)
+
+static void perf_counter_sync_stat(struct perf_counter_context *ctx,
+				   struct perf_counter_context *next_ctx)
+{
+	struct perf_counter *counter, *next_counter;
+
+	if (!ctx->nr_stat)
+		return;
+
+	counter = list_first_entry(&ctx->event_list,
+				   struct perf_counter, event_entry);
+
+	next_counter = list_first_entry(&next_ctx->event_list,
+					struct perf_counter, event_entry);
+
+	while (&counter->event_entry != &ctx->event_list &&
+	       &next_counter->event_entry != &next_ctx->event_list) {
+
+		__perf_counter_sync_stat(counter, next_counter);
+
+		counter = list_next_entry(counter, event_entry);
+		next_counter = list_next_entry(counter, event_entry);
+	}
+}
+
 /*
  * Called from scheduler to remove the counters of the current task,
  * with interrupts disabled.
@@ -1061,6 +1135,8 @@ void perf_counter_task_sched_out(struct task_struct *task,
 			ctx->task = next;
 			next_ctx->task = task;
 			do_switch = 0;
+
+			perf_counter_sync_stat(ctx, next_ctx);
 		}
 		spin_unlock(&next_ctx->lock);
 		spin_unlock(&ctx->lock);
@@ -1350,7 +1426,7 @@ void perf_counter_task_tick(struct task_struct *curr, int cpu)
 /*
  * Cross CPU call to read the hardware counter
  */
-static void __read(void *info)
+static void __perf_counter_read(void *info)
 {
 	struct perf_counter *counter = info;
 	struct perf_counter_context *ctx = counter->ctx;
@@ -1372,7 +1448,7 @@ static u64 perf_counter_read(struct perf_counter *counter)
 	 */
 	if (counter->state == PERF_COUNTER_STATE_ACTIVE) {
 		smp_call_function_single(counter->oncpu,
-					 __read, counter, 1);
+					 __perf_counter_read, counter, 1);
 	} else if (counter->state == PERF_COUNTER_STATE_INACTIVE) {
 		update_counter_times(counter);
 	}
@@ -4050,7 +4126,8 @@ static void sync_child_counter(struct perf_counter *child_counter,
 	struct perf_counter *parent_counter = child_counter->parent;
 	u64 child_val;
 
-	perf_counter_read_event(child_counter, child);
+	if (child_counter->attr.inherit_stat)
+		perf_counter_read_event(child_counter, child);
 
 	child_val = atomic64_read(&child_counter->count);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Rework the sample ABI
       [not found]             ` <new-submission>
                                 ` (258 preceding siblings ...)
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Implement more accurate per task statistics tip-bot for Peter Zijlstra
@ 2009-06-25 19:43               ` tip-bot for Peter Zijlstra
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf-report: Add modes for inherited stats and no-samples tip-bot for Peter Zijlstra
                                 ` (447 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e6e18ec79b023d5fe84226cef533cf0e3770ce93
Gitweb:     http://git.kernel.org/tip/e6e18ec79b023d5fe84226cef533cf0e3770ce93
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 25 Jun 2009 11:27:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:08 +0200

perf_counter: Rework the sample ABI

The PERF_EVENT_READ implementation made me realize we don't
actually need the sample_type int the output sample, since
we already have that in the perf_counter_attr information.

Therefore, remove the PERF_EVENT_MISC_OVERFLOW bit and the
event->type overloading, and imply put counter overflow
samples in a PERF_EVENT_SAMPLE type.

This also fixes the issue that event->type was only 32-bit
and sample_type had 64 usable bits.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h  |   10 +++++-----
 kernel/perf_counter.c         |   36 +++++++++++++++---------------------
 tools/perf/builtin-annotate.c |    8 ++++----
 tools/perf/builtin-report.c   |   32 +++++++++++++++++++-------------
 tools/perf/builtin-top.c      |   11 ++++++-----
 5 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index de70a10..3078e23 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -262,7 +262,6 @@ struct perf_counter_mmap_page {
 #define PERF_EVENT_MISC_KERNEL			(1 << 0)
 #define PERF_EVENT_MISC_USER			(2 << 0)
 #define PERF_EVENT_MISC_HYPERVISOR		(3 << 0)
-#define PERF_EVENT_MISC_OVERFLOW		(1 << 2)
 
 struct perf_event_header {
 	__u32	type;
@@ -348,9 +347,6 @@ enum perf_event_type {
 	PERF_EVENT_READ			= 8,
 
 	/*
-	 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
-	 * will be PERF_SAMPLE_*
-	 *
 	 * struct {
 	 *	struct perf_event_header	header;
 	 *
@@ -358,8 +354,9 @@ enum perf_event_type {
 	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
 	 *	{ u64			time;     } && PERF_SAMPLE_TIME
 	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
-	 *	{ u64			config;   } && PERF_SAMPLE_CONFIG
+	 *	{ u64			id;	  } && PERF_SAMPLE_ID
 	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
+	 * 	{ u64			period;   } && PERF_SAMPLE_PERIOD
 	 *
 	 *	{ u64			nr;
 	 *	  { u64 id, val; }	cnt[nr];  } && PERF_SAMPLE_GROUP
@@ -368,6 +365,9 @@ enum perf_event_type {
 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
 	 * };
 	 */
+	PERF_EVENT_SAMPLE		= 9,
+
+	PERF_EVENT_MAX,			/* non-ABI */
 };
 
 enum perf_callchain_context {
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 385ca51..f2f2326 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2575,15 +2575,14 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 		u32 cpu, reserved;
 	} cpu_entry;
 
-	header.type = 0;
+	header.type = PERF_EVENT_SAMPLE;
 	header.size = sizeof(header);
 
-	header.misc = PERF_EVENT_MISC_OVERFLOW;
+	header.misc = 0;
 	header.misc |= perf_misc_flags(data->regs);
 
 	if (sample_type & PERF_SAMPLE_IP) {
 		ip = perf_instruction_pointer(data->regs);
-		header.type |= PERF_SAMPLE_IP;
 		header.size += sizeof(ip);
 	}
 
@@ -2592,7 +2591,6 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 		tid_entry.pid = perf_counter_pid(counter, current);
 		tid_entry.tid = perf_counter_tid(counter, current);
 
-		header.type |= PERF_SAMPLE_TID;
 		header.size += sizeof(tid_entry);
 	}
 
@@ -2602,34 +2600,25 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 		 */
 		time = sched_clock();
 
-		header.type |= PERF_SAMPLE_TIME;
 		header.size += sizeof(u64);
 	}
 
-	if (sample_type & PERF_SAMPLE_ADDR) {
-		header.type |= PERF_SAMPLE_ADDR;
+	if (sample_type & PERF_SAMPLE_ADDR)
 		header.size += sizeof(u64);
-	}
 
-	if (sample_type & PERF_SAMPLE_ID) {
-		header.type |= PERF_SAMPLE_ID;
+	if (sample_type & PERF_SAMPLE_ID)
 		header.size += sizeof(u64);
-	}
 
 	if (sample_type & PERF_SAMPLE_CPU) {
-		header.type |= PERF_SAMPLE_CPU;
 		header.size += sizeof(cpu_entry);
 
 		cpu_entry.cpu = raw_smp_processor_id();
 	}
 
-	if (sample_type & PERF_SAMPLE_PERIOD) {
-		header.type |= PERF_SAMPLE_PERIOD;
+	if (sample_type & PERF_SAMPLE_PERIOD)
 		header.size += sizeof(u64);
-	}
 
 	if (sample_type & PERF_SAMPLE_GROUP) {
-		header.type |= PERF_SAMPLE_GROUP;
 		header.size += sizeof(u64) +
 			counter->nr_siblings * sizeof(group_entry);
 	}
@@ -2639,10 +2628,9 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 
 		if (callchain) {
 			callchain_size = (1 + callchain->nr) * sizeof(u64);
-
-			header.type |= PERF_SAMPLE_CALLCHAIN;
 			header.size += callchain_size;
-		}
+		} else
+			header.size += sizeof(u64);
 	}
 
 	ret = perf_output_begin(&handle, counter, header.size, nmi, 1);
@@ -2693,8 +2681,14 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
 		}
 	}
 
-	if (callchain)
-		perf_output_copy(&handle, callchain, callchain_size);
+	if (sample_type & PERF_SAMPLE_CALLCHAIN) {
+		if (callchain)
+			perf_output_copy(&handle, callchain, callchain_size);
+		else {
+			u64 nr = 0;
+			perf_output_put(&handle, nr);
+		}
+	}
 
 	perf_output_end(&handle);
 }
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 7e58e3a..722c0f5 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -855,7 +855,7 @@ static unsigned long total = 0,
 		     total_unknown = 0;
 
 static int
-process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
+process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	char level;
 	int show = 0;
@@ -1013,10 +1013,10 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head)
 static int
 process_event(event_t *event, unsigned long offset, unsigned long head)
 {
-	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
-		return process_overflow_event(event, offset, head);
-
 	switch (event->header.type) {
+	case PERF_EVENT_SAMPLE:
+		return process_sample_event(event, offset, head);
+
 	case PERF_EVENT_MMAP:
 		return process_mmap_event(event, offset, head);
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index e575f30..ec5361c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -53,6 +53,8 @@ static regex_t		parent_regex;
 
 static int		exclude_other = 1;
 
+static u64		sample_type;
+
 struct ip_event {
 	struct perf_event_header header;
 	u64 ip;
@@ -1135,7 +1137,7 @@ static int validate_chain(struct ip_callchain *chain, event_t *event)
 }
 
 static int
-process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
+process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	char level;
 	int show = 0;
@@ -1147,12 +1149,12 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 	void *more_data = event->ip.__more_data;
 	struct ip_callchain *chain = NULL;
 
-	if (event->header.type & PERF_SAMPLE_PERIOD) {
+	if (sample_type & PERF_SAMPLE_PERIOD) {
 		period = *(u64 *)more_data;
 		more_data += sizeof(u64);
 	}
 
-	dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
+	dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d: %p period: %Ld\n",
 		(void *)(offset + head),
 		(void *)(long)(event->header.size),
 		event->header.misc,
@@ -1160,7 +1162,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
 		(void *)(long)ip,
 		(long long)period);
 
-	if (event->header.type & PERF_SAMPLE_CALLCHAIN) {
+	if (sample_type & PERF_SAMPLE_CALLCHAIN) {
 		int i;
 
 		chain = (void *)more_data;
@@ -1352,10 +1354,10 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	trace_event(event);
 
-	if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
-		return process_overflow_event(event, offset, head);
-
 	switch (event->header.type) {
+	case PERF_EVENT_SAMPLE:
+		return process_sample_event(event, offset, head);
+
 	case PERF_EVENT_MMAP:
 		return process_mmap_event(event, offset, head);
 
@@ -1388,18 +1390,21 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 
 static struct perf_header	*header;
 
-static int perf_header__has_sample(u64 sample_mask)
+static u64 perf_header__sample_type(void)
 {
+	u64 sample_type = 0;
 	int i;
 
 	for (i = 0; i < header->attrs; i++) {
 		struct perf_header_attr *attr = header->attr[i];
 
-		if (!(attr->attr.sample_type & sample_mask))
-			return 0;
+		if (!sample_type)
+			sample_type = attr->attr.sample_type;
+		else if (sample_type != attr->attr.sample_type)
+			die("non matching sample_type");
 	}
 
-	return 1;
+	return sample_type;
 }
 
 static int __cmd_report(void)
@@ -1437,8 +1442,9 @@ static int __cmd_report(void)
 	header = perf_header__read(input);
 	head = header->data_offset;
 
-	if (sort__has_parent &&
-	    !perf_header__has_sample(PERF_SAMPLE_CALLCHAIN)) {
+	sample_type = perf_header__sample_type();
+
+	if (sort__has_parent && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
 		fprintf(stderr, "selected --sort parent, but no callchain data\n");
 		exit(-1);
 	}
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 5352b5e..cf0d21f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -392,11 +392,11 @@ static void record_ip(u64 ip, int counter)
 	samples--;
 }
 
-static void process_event(u64 ip, int counter)
+static void process_event(u64 ip, int counter, int user)
 {
 	samples++;
 
-	if (ip < min_ip || ip > max_ip) {
+	if (user) {
 		userspace_samples++;
 		return;
 	}
@@ -509,9 +509,10 @@ static void mmap_read_counter(struct mmap_data *md)
 
 		old += size;
 
-		if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
-			if (event->header.type & PERF_SAMPLE_IP)
-				process_event(event->ip.ip, md->counter);
+		if (event->header.type == PERF_EVENT_SAMPLE) {
+			int user =
+	(event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK) == PERF_EVENT_MISC_USER;
+			process_event(event->ip.ip, md->counter, user);
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf-report: Add modes for inherited stats and no-samples
       [not found]             ` <new-submission>
                                 ` (259 preceding siblings ...)
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Rework the sample ABI tip-bot for Peter Zijlstra
@ 2009-06-25 19:43               ` tip-bot for Peter Zijlstra
  2009-06-25 19:44               ` [tip:perfcounters/urgent] perf-report: Add bare minimum PERF_EVENT_READ parsing tip-bot for Peter Zijlstra
                                 ` (446 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  649c48a9e7fafcc72bfcc99471d9dea98d789d59
Gitweb:     http://git.kernel.org/tip/649c48a9e7fafcc72bfcc99471d9dea98d789d59
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Jun 2009 21:12:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:08 +0200

perf-report: Add modes for inherited stats and no-samples

Now that we can collect per task statistics, add modes that
make use of that facility.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-record.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f4f0240..798a56d 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -41,6 +41,8 @@ static int			force				= 0;
 static int			append_file			= 0;
 static int			call_graph			= 0;
 static int			verbose				= 0;
+static int			inherit_stat			= 0;
+static int			no_samples			= 0;
 
 static long			samples;
 static struct timeval		last_read;
@@ -393,6 +395,12 @@ static void create_counter(int counter, int cpu, pid_t pid)
 		attr->sample_freq	= freq;
 	}
 
+	if (no_samples)
+		attr->sample_freq = 0;
+
+	if (inherit_stat)
+		attr->inherit_stat = 1;
+
 	if (call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
@@ -571,7 +579,7 @@ static int __cmd_record(int argc, const char **argv)
 		}
 	}
 
-	while (!done) {
+	for (;;) {
 		int hits = samples;
 
 		for (i = 0; i < nr_cpu; i++) {
@@ -579,8 +587,11 @@ static int __cmd_record(int argc, const char **argv)
 				mmap_read(&mmap_array[i][counter]);
 		}
 
-		if (hits == samples)
+		if (hits == samples) {
+			if (done)
+				break;
 			ret = poll(event_array, nr_poll, 100);
+		}
 	}
 
 	/*
@@ -629,6 +640,10 @@ static const struct option options[] = {
 		    "do call-graph (stack chain/backtrace) recording"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
+	OPT_BOOLEAN('s', "stat", &inherit_stat,
+		    "per thread counts"),
+	OPT_BOOLEAN('n', "no-samples", &no_samples,
+		    "don't sample"),
 	OPT_END()
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf-report: Add bare minimum PERF_EVENT_READ parsing
       [not found]             ` <new-submission>
                                 ` (260 preceding siblings ...)
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf-report: Add modes for inherited stats and no-samples tip-bot for Peter Zijlstra
@ 2009-06-25 19:44               ` tip-bot for Peter Zijlstra
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf_counter tools: Remove dead code tip-bot for Ingo Molnar
                                 ` (445 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-25 19:44 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e9ea2fde7a07ae60a119171a2946ed2ae778271e
Gitweb:     http://git.kernel.org/tip/e9ea2fde7a07ae60a119171a2946ed2ae778271e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Jun 2009 22:46:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 25 Jun 2009 21:39:09 +0200

perf-report: Add bare minimum PERF_EVENT_READ parsing

Provide the basic infrastructure to provide per task stats.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-report.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ec5361c..681c223 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -100,6 +100,13 @@ struct lost_event {
 	u64 lost;
 };
 
+struct read_event {
+	struct perf_event_header header;
+	u32 pid,tid;
+	u64 value;
+	u64 format[3];
+};
+
 typedef union event_union {
 	struct perf_event_header	header;
 	struct ip_event			ip;
@@ -108,6 +115,7 @@ typedef union event_union {
 	struct fork_event		fork;
 	struct period_event		period;
 	struct lost_event		lost;
+	struct read_event		read;
 } event_t;
 
 static LIST_HEAD(dsos);
@@ -1350,6 +1358,19 @@ static void trace_event(event_t *event)
 }
 
 static int
+process_read_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	dprintf("%p [%p]: PERF_EVENT_READ: %d %d %Lu\n",
+			(void *)(offset + head),
+			(void *)(long)(event->header.size),
+			event->read.pid,
+			event->read.tid,
+			event->read.value);
+
+	return 0;
+}
+
+static int
 process_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	trace_event(event);
@@ -1373,6 +1394,9 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	case PERF_EVENT_LOST:
 		return process_lost_event(event, offset, head);
 
+	case PERF_EVENT_READ:
+		return process_read_event(event, offset, head);
+
 	/*
 	 * We dont process them right now but they are fine:
 	 */

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [RFC][PATCH] perf_counter: Complete counter swap.
  2009-06-25 19:43               ` [tip:perfcounters/urgent] perf_counter: Implement more accurate per task statistics tip-bot for Peter Zijlstra
@ 2009-06-26 11:10                 ` Peter Zijlstra
  2009-06-26 12:44                   ` Paul Mackerras
  2009-06-26 15:52                   ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
  0 siblings, 2 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-06-26 11:10 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, tglx, mingo; +Cc: linux-tip-commits, Paul Mackerras

On Thu, 2009-06-25 at 19:43 +0000, tip-bot for Peter Zijlstra wrote:

> +static void __perf_counter_sync_stat(struct perf_counter *counter,
> +				     struct perf_counter *next_counter)
> +{
> +	u64 value;
> +
> +	if (!counter->attr.inherit_stat)
> +		return;
> +
> +	/*
> +	 * Update the counter value, we cannot use perf_counter_read()
> +	 * because we're in the middle of a context switch and have IRQs
> +	 * disabled, which upsets smp_call_function_single(), however
> +	 * we know the counter must be on the current CPU, therefore we
> +	 * don't need to use it.
> +	 */
> +	switch (counter->state) {
> +	case PERF_COUNTER_STATE_ACTIVE:
> +		__perf_counter_read(counter);
> +		break;
> +
> +	case PERF_COUNTER_STATE_INACTIVE:
> +		update_counter_times(counter);
> +		break;
> +
> +	default:
> +		break;
> +	}
> +
> +	/*
> +	 * In order to keep per-task stats reliable we need to flip the counter
> +	 * values when we flip the contexts.
> +	 */
> +	value = atomic64_read(&next_counter->count);
> +	value = atomic64_xchg(&counter->count, value);
> +	atomic64_set(&next_counter->count, value);
> +
> +	/*
> +	 * XXX also sync time_enabled and time_running ?
> +	 */
> +}

Right, so I convinced myself we indeed want to swap the times as well,
and realized we need to update the userpage after modifying these
counters.

Then again, since inherited counters tend to wander around
self-monitoring mmap() + inherit is bound to be broken.. hmm?

Do we want to fix that or shall we simply say: don't do that then!

Paul?

---
Subject: perf_counter: Complete counter swap.

Complete the counter swap by indeed switching the times too and
updateing the userpage after modifying the counter values.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/perf_counter.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index f2f2326..66ab1e9 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1048,9 +1048,14 @@ static void __perf_counter_sync_stat(struct perf_counter *counter,
 	value = atomic64_xchg(&counter->count, value);
 	atomic64_set(&next_counter->count, value);
 
+	swap(counter->total_time_enabled, next_counter->total_time_enabled);
+	swap(counter->total_time_running, next_counter->total_time_running);
+
 	/*
-	 * XXX also sync time_enabled and time_running ?
+	 * Since we swizzled the values, update the user visible data too.
 	 */
+	perf_counter_update_userpage(counter);
+	perf_counter_update_userpage(next_counter);
 }
 
 #define list_next_entry(pos, member) \



^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [RFC][PATCH] perf_counter: Complete counter swap.
  2009-06-26 11:10                 ` [RFC][PATCH] perf_counter: Complete counter swap Peter Zijlstra
@ 2009-06-26 12:44                   ` Paul Mackerras
  2009-06-26 15:52                   ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: Paul Mackerras @ 2009-06-26 12:44 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, hpa, linux-kernel, tglx, mingo, linux-tip-commits

Peter Zijlstra writes:

> Right, so I convinced myself we indeed want to swap the times as well,
> and realized we need to update the userpage after modifying these
> counters.
> 
> Then again, since inherited counters tend to wander around
> self-monitoring mmap() + inherit is bound to be broken.. hmm?
> 
> Do we want to fix that or shall we simply say: don't do that then!

We only swap the contexts around if all the counters in both contexts
have been inherited, i.e. neither context is a top-level parent
context.  Now I had been going to say that a counter that had been
inherited couldn't be used for self-monitoring, and I think that is
actually true, but I guess the problem is that the child could have
inherited the fd and the mmap too, but the mmap will be on the parent
counter not the inherited child counter.  And there's no way for the
child (or anyone) to mmap the inherited counter since there's no fd
for it.

Currently we don't do anything to stop people trying to read the
counters directly when they're not self-monitoring - they just get
bogus data.  Maybe we should put the tid of the task the counter's on
into the first page of the mmap so that userspace can at least check
if it's the task being monitored.

Unless you can see some way to change the mmap on fork to point to the
child counter rather than the parent...  Which would possibly be a bit
nasty anyway since then the child's address space wouldn't be clone of
the parent's like you would expect after a fork.

Paul.

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter: Complete counter swap
  2009-06-26 11:10                 ` [RFC][PATCH] perf_counter: Complete counter swap Peter Zijlstra
  2009-06-26 12:44                   ` Paul Mackerras
@ 2009-06-26 15:52                   ` tip-bot for Peter Zijlstra
  1 sibling, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-06-26 15:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  19d2e755436054dfc2be640bffc32e427c37ac3d
Gitweb:     http://git.kernel.org/tip/19d2e755436054dfc2be640bffc32e427c37ac3d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 26 Jun 2009 13:10:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Jun 2009 17:48:54 +0200

perf_counter: Complete counter swap

Complete the counter swap by indeed switching the times too and
updating the userpage after modifying the counter values.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1246014623.31755.195.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index f2f2326..66ab1e9 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1048,9 +1048,14 @@ static void __perf_counter_sync_stat(struct perf_counter *counter,
 	value = atomic64_xchg(&counter->count, value);
 	atomic64_set(&next_counter->count, value);
 
+	swap(counter->total_time_enabled, next_counter->total_time_enabled);
+	swap(counter->total_time_running, next_counter->total_time_running);
+
 	/*
-	 * XXX also sync time_enabled and time_running ?
+	 * Since we swizzled the values, update the user visible data too.
 	 */
+	perf_counter_update_userpage(counter);
+	perf_counter_update_userpage(next_counter);
 }
 
 #define list_next_entry(pos, member) \

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Remove dead code
       [not found]             ` <new-submission>
                                 ` (261 preceding siblings ...)
  2009-06-25 19:44               ` [tip:perfcounters/urgent] perf-report: Add bare minimum PERF_EVENT_READ parsing tip-bot for Peter Zijlstra
@ 2009-06-27  4:31               ` tip-bot for Ingo Molnar
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters tip-bot for Ingo Molnar
                                 ` (444 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-27  4:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	vince, tglx, mingo

Commit-ID:  fde953c1c67986e1c381fa50d8207b1578b5cefa
Gitweb:     http://git.kernel.org/tip/fde953c1c67986e1c381fa50d8207b1578b5cefa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 27 Jun 2009 06:06:39 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 27 Jun 2009 06:06:39 +0200

perf_counter tools: Remove dead code

Vince Weaver reported that there's a handful of #ifdef __MINGW32__
sections in the code.

Remove them as they are in essence dead code - as unlike upstream
Git, the perf tool is unlikely to be ported to Windows.

Reported-by: Vince Weaver <vince@deater.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/help.c        |   15 ------
 tools/perf/util/pager.c       |    5 +--
 tools/perf/util/run-command.c |   95 +----------------------------------------
 tools/perf/util/run-command.h |    5 --
 tools/perf/util/util.h        |   15 ------
 5 files changed, 3 insertions(+), 132 deletions(-)

diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 6653f7d..17a00e0 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -126,21 +126,6 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
-	char buf[3] = { 0 };
-	int n;
-	int fd = open(name, O_RDONLY);
-	st.st_mode &= ~S_IXUSR;
-	if (fd >= 0) {
-		n = read(fd, buf, 2);
-		if (n == 2)
-			/* DOS executables start with "MZ" */
-			if (!strcmp(buf, "#!") || !strcmp(buf, "MZ"))
-				st.st_mode |= S_IXUSR;
-		close(fd);
-	}
-#endif
 	return st.st_mode & S_IXUSR;
 }
 
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index a28bcca..1915de2 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -9,7 +9,6 @@
 
 static int spawned_pager;
 
-#ifndef __MINGW32__
 static void pager_preexec(void)
 {
 	/*
@@ -24,7 +23,6 @@ static void pager_preexec(void)
 
 	setenv("LESS", "FRSX", 0);
 }
-#endif
 
 static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
 static struct child_process pager_process;
@@ -70,9 +68,8 @@ void setup_pager(void)
 	pager_argv[2] = pager;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-#ifndef __MINGW32__
 	pager_process.preexec_cb = pager_preexec;
-#endif
+
 	if (start_command(&pager_process))
 		return;
 
diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
index b2f5e85..a393534 100644
--- a/tools/perf/util/run-command.c
+++ b/tools/perf/util/run-command.c
@@ -65,7 +65,6 @@ int start_command(struct child_process *cmd)
 		cmd->err = fderr[0];
 	}
 
-#ifndef __MINGW32__
 	fflush(NULL);
 	cmd->pid = fork();
 	if (!cmd->pid) {
@@ -118,71 +117,6 @@ int start_command(struct child_process *cmd)
 		}
 		exit(127);
 	}
-#else
-	int s0 = -1, s1 = -1, s2 = -1;	/* backups of stdin, stdout, stderr */
-	const char **sargv = cmd->argv;
-	char **env = environ;
-
-	if (cmd->no_stdin) {
-		s0 = dup(0);
-		dup_devnull(0);
-	} else if (need_in) {
-		s0 = dup(0);
-		dup2(fdin[0], 0);
-	} else if (cmd->in) {
-		s0 = dup(0);
-		dup2(cmd->in, 0);
-	}
-
-	if (cmd->no_stderr) {
-		s2 = dup(2);
-		dup_devnull(2);
-	} else if (need_err) {
-		s2 = dup(2);
-		dup2(fderr[1], 2);
-	}
-
-	if (cmd->no_stdout) {
-		s1 = dup(1);
-		dup_devnull(1);
-	} else if (cmd->stdout_to_stderr) {
-		s1 = dup(1);
-		dup2(2, 1);
-	} else if (need_out) {
-		s1 = dup(1);
-		dup2(fdout[1], 1);
-	} else if (cmd->out > 1) {
-		s1 = dup(1);
-		dup2(cmd->out, 1);
-	}
-
-	if (cmd->dir)
-		die("chdir in start_command() not implemented");
-	if (cmd->env) {
-		env = copy_environ();
-		for (; *cmd->env; cmd->env++)
-			env = env_setenv(env, *cmd->env);
-	}
-
-	if (cmd->perf_cmd) {
-		cmd->argv = prepare_perf_cmd(cmd->argv);
-	}
-
-	cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env);
-
-	if (cmd->env)
-		free_environ(env);
-	if (cmd->perf_cmd)
-		free(cmd->argv);
-
-	cmd->argv = sargv;
-	if (s0 >= 0)
-		dup2(s0, 0), close(s0);
-	if (s1 >= 0)
-		dup2(s1, 1), close(s1);
-	if (s2 >= 0)
-		dup2(s2, 2), close(s2);
-#endif
 
 	if (cmd->pid < 0) {
 		int err = errno;
@@ -288,14 +222,6 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 	return run_command(&cmd);
 }
 
-#ifdef __MINGW32__
-static __stdcall unsigned run_thread(void *data)
-{
-	struct async *async = data;
-	return async->proc(async->fd_for_proc, async->data);
-}
-#endif
-
 int start_async(struct async *async)
 {
 	int pipe_out[2];
@@ -304,7 +230,6 @@ int start_async(struct async *async)
 		return error("cannot create pipe: %s", strerror(errno));
 	async->out = pipe_out[0];
 
-#ifndef __MINGW32__
 	/* Flush stdio before fork() to avoid cloning buffers */
 	fflush(NULL);
 
@@ -319,33 +244,17 @@ int start_async(struct async *async)
 		exit(!!async->proc(pipe_out[1], async->data));
 	}
 	close(pipe_out[1]);
-#else
-	async->fd_for_proc = pipe_out[1];
-	async->tid = (HANDLE) _beginthreadex(NULL, 0, run_thread, async, 0, NULL);
-	if (!async->tid) {
-		error("cannot create thread: %s", strerror(errno));
-		close_pair(pipe_out);
-		return -1;
-	}
-#endif
+
 	return 0;
 }
 
 int finish_async(struct async *async)
 {
-#ifndef __MINGW32__
 	int ret = 0;
 
 	if (wait_or_whine(async->pid))
 		ret = error("waitpid (async) failed");
-#else
-	DWORD ret = 0;
-	if (WaitForSingleObject(async->tid, INFINITE) != WAIT_OBJECT_0)
-		ret = error("waiting for thread failed: %lu", GetLastError());
-	else if (!GetExitCodeThread(async->tid, &ret))
-		ret = error("cannot get thread exit code: %lu", GetLastError());
-	CloseHandle(async->tid);
-#endif
+
 	return ret;
 }
 
diff --git a/tools/perf/util/run-command.h b/tools/perf/util/run-command.h
index 328289f..cc1837d 100644
--- a/tools/perf/util/run-command.h
+++ b/tools/perf/util/run-command.h
@@ -79,12 +79,7 @@ struct async {
 	int (*proc)(int fd, void *data);
 	void *data;
 	int out;	/* caller reads from here and closes it */
-#ifndef __MINGW32__
 	pid_t pid;
-#else
-	HANDLE tid;
-	int fd_for_proc;
-#endif
 };
 
 int start_async(struct async *async);
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index b8cfed7..b4be607 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -67,7 +67,6 @@
 #include <assert.h>
 #include <regex.h>
 #include <utime.h>
-#ifndef __MINGW32__
 #include <sys/wait.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
@@ -81,20 +80,6 @@
 #include <netdb.h>
 #include <pwd.h>
 #include <inttypes.h>
-#if defined(__CYGWIN__)
-#undef _XOPEN_SOURCE
-#include <grp.h>
-#define _XOPEN_SOURCE 600
-#include "compat/cygwin.h"
-#else
-#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
-#include <grp.h>
-#define _ALL_SOURCE 1
-#endif
-#else 	/* __MINGW32__ */
-/* pull in Windows compatibility stuff */
-#include "compat/mingw.h"
-#endif	/* __MINGW32__ */
 
 #ifndef NO_ICONV
 #include <iconv.h>

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters
       [not found]             ` <new-submission>
                                 ` (262 preceding siblings ...)
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf_counter tools: Remove dead code tip-bot for Ingo Molnar
@ 2009-06-27  4:31               ` tip-bot for Ingo Molnar
  2009-06-27  7:56                 ` Jaswinder Singh Rajput
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf stat: Fix multi-run stats tip-bot for Ingo Molnar
                                 ` (443 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-27  4:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  0cfb7a13b8e4e0afd4b856156ab16a182de7505b
Gitweb:     http://git.kernel.org/tip/0cfb7a13b8e4e0afd4b856156ab16a182de7505b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 27 Jun 2009 06:10:30 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 27 Jun 2009 06:11:24 +0200

perf stat: Add -n/--null option to run without counters

Allow a no-counters run. This can be useful to measure just
elapsed wall-clock time - or to assess the raw overhead of perf
stat itself, without running any counters.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8420ec5..cdcd058 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -70,6 +70,7 @@ static int			run_count			=  1;
 static int			inherit				=  1;
 static int			scale				=  1;
 static int			target_pid			= -1;
+static int			null_run			=  0;
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
@@ -461,6 +462,8 @@ static const struct option options[] = {
 		    "be more verbose (show counter open errors, etc)"),
 	OPT_INTEGER('r', "repeat", &run_count,
 		    "repeat command and print average + stddev (max: 100)"),
+	OPT_BOOLEAN('n', "null", &null_run,
+		    "null run - dont start any counters"),
 	OPT_END()
 };
 
@@ -476,7 +479,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 	if (run_count <= 0 || run_count > MAX_RUN)
 		usage_with_options(stat_usage, options);
 
-	if (!nr_counters)
+	if (!null_run && !nr_counters)
 		nr_counters = 8;
 
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf stat: Fix multi-run stats
       [not found]             ` <new-submission>
                                 ` (263 preceding siblings ...)
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters tip-bot for Ingo Molnar
@ 2009-06-27  4:31               ` tip-bot for Ingo Molnar
  2009-06-27  4:36               ` tip-bot for Ingo Molnar
                                 ` (442 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-27  4:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  9aae82a5d1a3a31a68e3b3eec4ac18e191930a11
Gitweb:     http://git.kernel.org/tip/9aae82a5d1a3a31a68e3b3eec4ac18e191930a11
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 27 Jun 2009 06:24:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 27 Jun 2009 06:24:32 +0200

perf stat: Fix multi-run stats

In multi-run (-r/--repeat) printouts, print out the noise of
the wall-clock average as well.

Also, fix a bug in printing out scaled counters: if it was not
scaled then we should not update the average with -1.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index cdcd058..e4bc4ed 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -353,8 +353,9 @@ static void calc_avg(void)
 				event_res_avg[j]+1, event_res[i][j]+1);
 			update_avg("counter/2", j,
 				event_res_avg[j]+2, event_res[i][j]+2);
-			update_avg("scaled", j,
-				event_scaled_avg + j, event_scaled[i]+j);
+			if (event_scaled[i][j] != -1)
+				update_avg("scaled", j,
+					event_scaled_avg + j, event_scaled[i]+j);
 		}
 	}
 	runtime_nsecs_avg /= run_count;
@@ -420,9 +421,13 @@ static void print_stat(int argc, const char **argv)
 
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " %14.9f  seconds time elapsed.\n",
+	fprintf(stderr, " %14.9f  seconds time elapsed",
 			(double)walltime_nsecs_avg/1e9);
-	fprintf(stderr, "\n");
+	if (run_count > 1) {
+		fprintf(stderr, "   ( +- %7.3f%% )",
+			100.0*(double)walltime_nsecs_noise/(double)walltime_nsecs_avg);
+	}
+	fprintf(stderr, "\n\n");
 }
 
 static volatile int signr = -1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf stat: Fix multi-run stats
       [not found]             ` <new-submission>
                                 ` (264 preceding siblings ...)
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf stat: Fix multi-run stats tip-bot for Ingo Molnar
@ 2009-06-27  4:36               ` tip-bot for Ingo Molnar
  2009-06-27  8:26                 ` Jaswinder Singh Rajput
  2009-06-29 19:54               ` [tip:perfcounters/urgent] perf stat: Use percentages for scaling output tip-bot for Ingo Molnar
                                 ` (441 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-27  4:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  566747e6298289c5cb02d4939cb3abf1c4fe7e5a
Gitweb:     http://git.kernel.org/tip/566747e6298289c5cb02d4939cb3abf1c4fe7e5a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 27 Jun 2009 06:24:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 27 Jun 2009 06:34:37 +0200

perf stat: Fix multi-run stats

In multi-run (-r/--repeat) printouts, print out the noise of
the wall-clock average as well.

Also, fix a bug in printing out scaled counters: if it was not
scaled then we should not update the average with -1.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index cdcd058..52c176c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -353,8 +353,11 @@ static void calc_avg(void)
 				event_res_avg[j]+1, event_res[i][j]+1);
 			update_avg("counter/2", j,
 				event_res_avg[j]+2, event_res[i][j]+2);
-			update_avg("scaled", j,
-				event_scaled_avg + j, event_scaled[i]+j);
+			if (event_scaled[i][j] != -1)
+				update_avg("scaled", j,
+					event_scaled_avg + j, event_scaled[i]+j);
+			else
+				event_scaled_avg[j] = -1;
 		}
 	}
 	runtime_nsecs_avg /= run_count;
@@ -420,9 +423,13 @@ static void print_stat(int argc, const char **argv)
 
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " %14.9f  seconds time elapsed.\n",
+	fprintf(stderr, " %14.9f  seconds time elapsed",
 			(double)walltime_nsecs_avg/1e9);
-	fprintf(stderr, "\n");
+	if (run_count > 1) {
+		fprintf(stderr, "   ( +- %7.3f%% )",
+			100.0*(double)walltime_nsecs_noise/(double)walltime_nsecs_avg);
+	}
+	fprintf(stderr, "\n\n");
 }
 
 static volatile int signr = -1;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters
  2009-06-27  4:31               ` [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters tip-bot for Ingo Molnar
@ 2009-06-27  7:56                 ` Jaswinder Singh Rajput
  2009-06-27 16:52                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Jaswinder Singh Rajput @ 2009-06-27  7:56 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits

On Sat, 2009-06-27 at 04:31 +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  0cfb7a13b8e4e0afd4b856156ab16a182de7505b
> Gitweb:     http://git.kernel.org/tip/0cfb7a13b8e4e0afd4b856156ab16a182de7505b
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 27 Jun 2009 06:10:30 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 27 Jun 2009 06:11:24 +0200
> 
> perf stat: Add -n/--null option to run without counters
> 
> Allow a no-counters run. This can be useful to measure just
> elapsed wall-clock time - or to assess the raw overhead of perf
> stat itself, without running any counters.
> 

Why it better then $ time <command>

Any way this patch is broken. 

Why you are allocating :
memcpy(attrs, default_attrs, sizeof(attrs)); when null_run is set.

To get better picture and solution, Please check [PATCH] perf stat: fix
default attrs and nr_counters

which I send in "Re: [PATCH -tip] perf_counter tools: add support to set
of multiple events in one short" send on Fri, 26 Jun 2009 18:08:40 +0530

Thanks,

--
JSR
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  tools/perf/builtin-stat.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 8420ec5..cdcd058 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -70,6 +70,7 @@ static int			run_count			=  1;
>  static int			inherit				=  1;
>  static int			scale				=  1;
>  static int			target_pid			= -1;
> +static int			null_run			=  0;
>  
>  static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
>  
> @@ -461,6 +462,8 @@ static const struct option options[] = {
>  		    "be more verbose (show counter open errors, etc)"),
>  	OPT_INTEGER('r', "repeat", &run_count,
>  		    "repeat command and print average + stddev (max: 100)"),
> +	OPT_BOOLEAN('n', "null", &null_run,
> +		    "null run - dont start any counters"),
>  	OPT_END()
>  };
>  
> @@ -476,7 +479,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
>  	if (run_count <= 0 || run_count > MAX_RUN)
>  		usage_with_options(stat_usage, options);
>  
> -	if (!nr_counters)
> +	if (!null_run && !nr_counters)
>  		nr_counters = 8;
>  
>  	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/urgent] perf stat: Fix multi-run stats
  2009-06-27  4:36               ` tip-bot for Ingo Molnar
@ 2009-06-27  8:26                 ` Jaswinder Singh Rajput
  2009-06-27 16:45                   ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Jaswinder Singh Rajput @ 2009-06-27  8:26 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits

On Sat, 2009-06-27 at 04:36 +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  566747e6298289c5cb02d4939cb3abf1c4fe7e5a
> Gitweb:     http://git.kernel.org/tip/566747e6298289c5cb02d4939cb3abf1c4fe7e5a
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 27 Jun 2009 06:24:32 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 27 Jun 2009 06:34:37 +0200
> 
> perf stat: Fix multi-run stats
> 
> In multi-run (-r/--repeat) printouts, print out the noise of
> the wall-clock average as well.
> 
> Also, fix a bug in printing out scaled counters: if it was not
> scaled then we should not update the average with -1.
> 
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  tools/perf/builtin-stat.c |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 


hmm, why you are keep on changing tools/perf/builtin-stat.c you know my
patches are in queue which I prepared on your request and send pull
request :

http://git.kernel.org/?p=linux/kernel/git/jaswinder/linux-2.6-tip.git;a=commitdiff;h=4e3340cd3087c4228350af04c2fc8f6502eb6ad6

In spite of adding the patches you keep on changing the original file ??

--
JSR


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/urgent] perf stat: Fix multi-run stats
  2009-06-27  8:26                 ` Jaswinder Singh Rajput
@ 2009-06-27 16:45                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-27 16:45 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> On Sat, 2009-06-27 at 04:36 +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  566747e6298289c5cb02d4939cb3abf1c4fe7e5a
> > Gitweb:     http://git.kernel.org/tip/566747e6298289c5cb02d4939cb3abf1c4fe7e5a
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sat, 27 Jun 2009 06:24:32 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 27 Jun 2009 06:34:37 +0200
> > 
> > perf stat: Fix multi-run stats
> > 
> > In multi-run (-r/--repeat) printouts, print out the noise of
> > the wall-clock average as well.
> > 
> > Also, fix a bug in printing out scaled counters: if it was not
> > scaled then we should not update the average with -1.
> > 
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Mike Galbraith <efault@gmx.de>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  tools/perf/builtin-stat.c |   15 +++++++++++----
> >  1 files changed, 11 insertions(+), 4 deletions(-)
> > 
> 
> 
> hmm, why you are keep on changing tools/perf/builtin-stat.c you 
> know my patches are in queue which I prepared on your request and 
> send pull request:
> 
> http://git.kernel.org/?p=linux/kernel/git/jaswinder/linux-2.6-tip.git;a=commitdiff;h=4e3340cd3087c4228350af04c2fc8f6502eb6ad6
> 
> In spite of adding the patches you keep on changing the original 
> file ??

Two things:

 - My changes and your changes do not conflict - i was able to
   apply your patches on top of my changes.

 - I could have applied all three patches of yours but i only
   applied the first one because the second and third did not
   implement the feature you are trying to add in an adequate
   way.

Also, i do not 'request' things from you, i am not your boss. I 
review patches and i reject patches i find inadequate. You are
free to submit new versions - or you are free to not do so. If
you submit new versions i will review them too and will merge
them or tell why i didnt merge them.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:perfcounters/urgent] perf stat: Add -n/--null option to run without counters
  2009-06-27  7:56                 ` Jaswinder Singh Rajput
@ 2009-06-27 16:52                   ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-06-27 16:52 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> On Sat, 2009-06-27 at 04:31 +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  0cfb7a13b8e4e0afd4b856156ab16a182de7505b
> > Gitweb:     http://git.kernel.org/tip/0cfb7a13b8e4e0afd4b856156ab16a182de7505b
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sat, 27 Jun 2009 06:10:30 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 27 Jun 2009 06:11:24 +0200
> > 
> > perf stat: Add -n/--null option to run without counters
> > 
> > Allow a no-counters run. This can be useful to measure just
> > elapsed wall-clock time - or to assess the raw overhead of perf
> > stat itself, without running any counters.
> > 
> 
> Why it better then $ time <command>

For example can 'time' do average and standard deviation 
measurements, like:

	perf stat --repeat 10 --null /bin/true

?

Also, --null can be used to validate 'perf stat'.

> Any way this patch is broken.
>
> Why you are allocating :
> memcpy(attrs, default_attrs, sizeof(attrs)); when null_run is set.

a memcpy is not 'allocating' anything. What do you mean?

The memcpy itself could be unnecessary. Is it a big problem?

What exactly is 'broken' about it? It's a straightforward feature.

> To get better picture and solution, Please check [PATCH] perf 
> stat: fix default attrs and nr_counters
> 
> which I send in "Re: [PATCH -tip] perf_counter tools: add support 
> to set of multiple events in one short" send on Fri, 26 Jun 2009 
> 18:08:40 +0530

When you send new patches you should change the subject line.

Also, that patch mixes in some other changes that look wrong. 
Anyway, please resubmit as standalone patch if you think that 
something is broken.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf stat: Use percentages for scaling output
       [not found]             ` <new-submission>
                                 ` (265 preceding siblings ...)
  2009-06-27  4:36               ` tip-bot for Ingo Molnar
@ 2009-06-29 19:54               ` tip-bot for Ingo Molnar
  2009-07-01 10:55               ` [tip:perfcounters/urgent] perf_counter tools: Add more warnings and fix/annotate them tip-bot for Ingo Molnar
                                 ` (440 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-06-29 19:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	jaswinder, tglx, mingo

Commit-ID:  210ad39fb7ef0bc0494483f517f42524f16bb2a7
Gitweb:     http://git.kernel.org/tip/210ad39fb7ef0bc0494483f517f42524f16bb2a7
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 29 Jun 2009 21:50:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 29 Jun 2009 21:50:54 +0200

perf stat: Use percentages for scaling output

Peter expressed a strong preference for percentage based
display of scaled values - so revert to that from the
recently introduced multiplication-factor unit.

Reported-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-stat.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3e5ea4e..c5a2907 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -307,7 +307,8 @@ static void print_counter(int counter)
 		abs_printout(counter, count, noise);
 
 	if (scaled)
-		fprintf(stderr, "  (%7.2fx scaled)", (double)count[1]/count[2]);
+		fprintf(stderr, "  (scaled from %.2f%%)",
+			(double) count[2] / count[1] * 100);
 
 	fprintf(stderr, "\n");
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Add more warnings and fix/annotate them
       [not found]             ` <new-submission>
                                 ` (266 preceding siblings ...)
  2009-06-29 19:54               ` [tip:perfcounters/urgent] perf stat: Use percentages for scaling output tip-bot for Ingo Molnar
@ 2009-07-01 10:55               ` tip-bot for Ingo Molnar
  2009-07-03  6:27               ` [tip:perfcounters/urgent] perf_counter tools: Adjust symbols in ET_EXEC files too tip-bot for Arnaldo Carvalho de Melo
                                 ` (439 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-07-01 10:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  f37a291c527c954df4da568de718ebb36b8261c0
Gitweb:     http://git.kernel.org/tip/f37a291c527c954df4da568de718ebb36b8261c0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 1 Jul 2009 12:37:06 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 1 Jul 2009 12:49:48 +0200

perf_counter tools: Add more warnings and fix/annotate them

Enable -Wextra. This found a few real bugs plus a number
of signed/unsigned type mismatches/uncleanlinesses. It
also required a few annotations

All things considered it was still worth it so lets try with
this enabled for now.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile             |    2 +-
 tools/perf/builtin-annotate.c   |   12 +++++-----
 tools/perf/builtin-help.c       |    6 +++-
 tools/perf/builtin-list.c       |    2 +-
 tools/perf/builtin-record.c     |    4 +-
 tools/perf/builtin-report.c     |   22 +++++++++---------
 tools/perf/builtin-stat.c       |   18 ++++++++------
 tools/perf/builtin-top.c        |    8 +++---
 tools/perf/perf.c               |    5 +---
 tools/perf/perf.h               |    2 +
 tools/perf/util/alias.c         |    2 +-
 tools/perf/util/cache.h         |    1 +
 tools/perf/util/callchain.c     |   15 ++++++------
 tools/perf/util/callchain.h     |   10 ++++----
 tools/perf/util/color.c         |   10 ++++++--
 tools/perf/util/config.c        |   18 ++++++++------
 tools/perf/util/exec_cmd.c      |    5 +++-
 tools/perf/util/help.c          |   26 ++++++++++++---------
 tools/perf/util/help.h          |    6 ++--
 tools/perf/util/parse-events.c  |    2 +-
 tools/perf/util/parse-options.c |    2 +-
 tools/perf/util/parse-options.h |   25 ++++++++++-----------
 tools/perf/util/quote.c         |   46 +++++++++++++++++++++-----------------
 tools/perf/util/quote.h         |    2 +-
 tools/perf/util/strbuf.c        |   13 ++++++-----
 tools/perf/util/strbuf.h        |   10 ++++----
 tools/perf/util/wrapper.c       |    5 ++-
 27 files changed, 151 insertions(+), 128 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f572c90..eddf076 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -164,7 +164,7 @@ endif
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
+CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
 LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 722c0f5..6cba70d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -160,7 +160,7 @@ static void dsos__fprintf(FILE *fp)
 
 static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip)
 {
-	return dso__find_symbol(kernel_dso, ip);
+	return dso__find_symbol(dso, ip);
 }
 
 static int load_kernel(void)
@@ -203,7 +203,7 @@ static u64 map__map_ip(struct map *map, u64 ip)
 	return ip - map->start + map->pgoff;
 }
 
-static u64 vdso__map_ip(struct map *map, u64 ip)
+static u64 vdso__map_ip(struct map *map __used, u64 ip)
 {
 	return ip;
 }
@@ -600,7 +600,7 @@ static LIST_HEAD(hist_entry__sort_list);
 
 static int sort_dimension__add(char *tok)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
 		struct sort_dimension *sd = &sort_dimensions[i];
@@ -1069,7 +1069,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len)
 	static const char *prev_color;
 	unsigned int offset;
 	size_t line_len;
-	u64 line_ip;
+	s64 line_ip;
 	int ret;
 	char *c;
 
@@ -1428,7 +1428,7 @@ more:
 
 	head += size;
 
-	if (offset + head < stat.st_size)
+	if (offset + head < (unsigned long)stat.st_size)
 		goto more;
 
 	rc = EXIT_SUCCESS;
@@ -1492,7 +1492,7 @@ static void setup_sorting(void)
 	free(str);
 }
 
-int cmd_annotate(int argc, const char **argv, const char *prefix)
+int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 {
 	symbol__init();
 
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 0f32dc3..2599d86 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -3,6 +3,7 @@
  *
  * Builtin help command
  */
+#include "perf.h"
 #include "util/cache.h"
 #include "builtin.h"
 #include "util/exec_cmd.h"
@@ -277,7 +278,7 @@ static struct cmdnames main_cmds, other_cmds;
 
 void list_common_cmds_help(void)
 {
-	int i, longest = 0;
+	unsigned int i, longest = 0;
 
 	for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
 		if (longest < strlen(common_cmds[i].name))
@@ -415,9 +416,10 @@ static void show_html_page(const char *perf_cmd)
 	open_html(page_path.buf);
 }
 
-int cmd_help(int argc, const char **argv, const char *prefix)
+int cmd_help(int argc, const char **argv, const char *prefix __used)
 {
 	const char *alias;
+
 	load_command_list("perf-", &main_cmds, &other_cmds);
 
 	perf_config(perf_help_config, NULL);
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index fe60e37..f990fa8 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -13,7 +13,7 @@
 #include "util/parse-options.h"
 #include "util/parse-events.h"
 
-int cmd_list(int argc, const char **argv, const char *prefix)
+int cmd_list(int argc __used, const char **argv __used, const char *prefix __used)
 {
 	print_events();
 	return 0;
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d18546f..4ef78a5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -294,7 +294,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)
 	while (1) {
 		char bf[BUFSIZ], *pbf = bf;
 		struct mmap_event mmap_ev = {
-			.header.type = PERF_EVENT_MMAP,
+			.header = { .type = PERF_EVENT_MMAP },
 		};
 		int n;
 		size_t size;
@@ -650,7 +650,7 @@ static const struct option options[] = {
 	OPT_END()
 };
 
-int cmd_record(int argc, const char **argv, const char *prefix)
+int cmd_record(int argc, const char **argv, const char *prefix __used)
 {
 	int counter;
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7d2b49a..007363d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -177,7 +177,7 @@ static void dsos__fprintf(FILE *fp)
 
 static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip)
 {
-	return dso__find_symbol(kernel_dso, ip);
+	return dso__find_symbol(dso, ip);
 }
 
 static int load_kernel(void)
@@ -239,7 +239,7 @@ static u64 map__map_ip(struct map *map, u64 ip)
 	return ip - map->start + map->pgoff;
 }
 
-static u64 vdso__map_ip(struct map *map, u64 ip)
+static u64 vdso__map_ip(struct map *map __used, u64 ip)
 {
 	return ip;
 }
@@ -712,7 +712,7 @@ static LIST_HEAD(hist_entry__sort_list);
 
 static int sort_dimension__add(char *tok)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
 		struct sort_dimension *sd = &sort_dimensions[i];
@@ -801,7 +801,7 @@ callchain__fprintf(FILE *fp, struct callchain_node *self, u64 total_samples)
 			ret += fprintf(fp, "                %s\n", chain->sym->name);
 		else
 			ret += fprintf(fp, "                %p\n",
-					(void *)chain->ip);
+					(void *)(long)chain->ip);
 	}
 
 	return ret;
@@ -938,12 +938,12 @@ static int call__match(struct symbol *sym)
 }
 
 static struct symbol **
-resolve_callchain(struct thread *thread, struct map *map,
+resolve_callchain(struct thread *thread, struct map *map __used,
 		    struct ip_callchain *chain, struct hist_entry *entry)
 {
-	int i;
-	struct symbol **syms;
 	u64 context = PERF_CONTEXT_MAX;
+	struct symbol **syms;
+	unsigned int i;
 
 	if (callchain) {
 		syms = calloc(chain->nr, sizeof(*syms));
@@ -1183,7 +1183,7 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
 
 	fprintf(fp, "# ........");
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
-		int i;
+		unsigned int i;
 
 		if (exclude_other && (se == &sort_parent))
 			continue;
@@ -1271,7 +1271,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		(long long)period);
 
 	if (sample_type & PERF_SAMPLE_CALLCHAIN) {
-		int i;
+		unsigned int i;
 
 		chain = (void *)more_data;
 
@@ -1667,7 +1667,7 @@ more:
 	if (offset + head >= header->data_offset + header->data_size)
 		goto done;
 
-	if (offset + head < stat.st_size)
+	if (offset + head < (unsigned long)stat.st_size)
 		goto more;
 
 done:
@@ -1756,7 +1756,7 @@ static void setup_list(struct strlist **list, const char *list_str,
 	}
 }
 
-int cmd_report(int argc, const char **argv, const char *prefix)
+int cmd_report(int argc, const char **argv, const char *prefix __used)
 {
 	symbol__init();
 
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2e03524..095a90e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -64,7 +64,7 @@ static struct perf_counter_attr default_attrs[] = {
 
 static int			system_wide			=  0;
 static int			verbose				=  0;
-static int			nr_cpus				=  0;
+static unsigned int		nr_cpus				=  0;
 static int			run_idx				=  0;
 
 static int			run_count			=  1;
@@ -108,7 +108,8 @@ static void create_perf_stat_counter(int counter, int pid)
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide) {
-		int cpu;
+		unsigned int cpu;
+
 		for (cpu = 0; cpu < nr_cpus; cpu++) {
 			fd[cpu][counter] = sys_perf_counter_open(attr, -1, cpu, -1, 0);
 			if (fd[cpu][counter] < 0 && verbose)
@@ -150,8 +151,8 @@ static inline int nsec_counter(int counter)
 static void read_counter(int counter)
 {
 	u64 *count, single_count[3];
-	ssize_t res;
-	int cpu, nv;
+	unsigned int cpu;
+	size_t res, nv;
 	int scaled;
 
 	count = event_res[run_idx][counter];
@@ -165,6 +166,7 @@ static void read_counter(int counter)
 
 		res = read(fd[cpu][counter], single_count, nv * sizeof(u64));
 		assert(res == nv * sizeof(u64));
+
 		close(fd[cpu][counter]);
 		fd[cpu][counter] = -1;
 
@@ -200,7 +202,7 @@ static void read_counter(int counter)
 		runtime_cycles[run_idx] = count[0];
 }
 
-static int run_perf_stat(int argc, const char **argv)
+static int run_perf_stat(int argc __used, const char **argv)
 {
 	unsigned long long t0, t1;
 	int status = 0;
@@ -390,7 +392,7 @@ static void calc_avg(void)
 				event_res_avg[j]+1, event_res[i][j]+1);
 			update_avg("counter/2", j,
 				event_res_avg[j]+2, event_res[i][j]+2);
-			if (event_scaled[i][j] != -1)
+			if (event_scaled[i][j] != (u64)-1)
 				update_avg("scaled", j,
 					event_scaled_avg + j, event_scaled[i]+j);
 			else
@@ -510,7 +512,7 @@ static const struct option options[] = {
 	OPT_END()
 };
 
-int cmd_stat(int argc, const char **argv, const char *prefix)
+int cmd_stat(int argc, const char **argv, const char *prefix __used)
 {
 	int status;
 
@@ -528,7 +530,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
 
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	assert(nr_cpus <= MAX_NR_CPUS);
-	assert(nr_cpus >= 0);
+	assert((int)nr_cpus >= 0);
 
 	/*
 	 * We dont want to block the signals - that would cause
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0506cd6..5f5e7df 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -269,7 +269,7 @@ static void print_sym_table(void)
 	}
 }
 
-static void *display_thread(void *arg)
+static void *display_thread(void *arg __used)
 {
 	struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
 	int delay_msecs = delay_secs * 1000;
@@ -287,7 +287,7 @@ static void *display_thread(void *arg)
 }
 
 /* Tag samples to be skipped. */
-char *skip_symbols[] = {
+static const char *skip_symbols[] = {
 	"default_idle",
 	"cpu_idle",
 	"enter_idle",
@@ -426,7 +426,7 @@ static void process_event(u64 ip, int counter, int user)
 struct mmap_data {
 	int			counter;
 	void			*base;
-	unsigned int		mask;
+	int			mask;
 	unsigned int		prev;
 };
 
@@ -705,7 +705,7 @@ static const struct option options[] = {
 	OPT_END()
 };
 
-int cmd_top(int argc, const char **argv, const char *prefix)
+int cmd_top(int argc, const char **argv, const char *prefix __used)
 {
 	int counter;
 
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 4eb7259..c565678 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -229,9 +229,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 		use_pager = 1;
 	commit_pager_choice();
 
-	if (p->option & NEED_WORK_TREE)
-		/* setup_work_tree() */;
-
 	status = p->fn(argc, argv, prefix);
 	if (status)
 		return status & 0xff;
@@ -266,7 +263,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "annotate", cmd_annotate, 0 },
 		{ "version", cmd_version, 0 },
 	};
-	int i;
+	unsigned int i;
 	static const char ext[] = STRIP_EXTENSION;
 
 	if (sizeof(ext) > 1) {
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index ce39419..27887c9 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -52,6 +52,8 @@ static inline unsigned long long rdclock(void)
 #define __user
 #define asmlinkage
 
+#define __used		__attribute__((__unused__))
+
 #define unlikely(x)	__builtin_expect(!!(x), 0)
 #define min(x, y) ({				\
 	typeof(x) _min1 = (x);			\
diff --git a/tools/perf/util/alias.c b/tools/perf/util/alias.c
index 9b3dd2b..b8144e8 100644
--- a/tools/perf/util/alias.c
+++ b/tools/perf/util/alias.c
@@ -3,7 +3,7 @@
 static const char *alias_key;
 static char *alias_val;
 
-static int alias_lookup_cb(const char *k, const char *v, void *cb)
+static int alias_lookup_cb(const char *k, const char *v, void *cb __used)
 {
 	if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
 		if (!v)
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 393d614..161d5f4 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -3,6 +3,7 @@
 
 #include "util.h"
 #include "strbuf.h"
+#include "../perf.h"
 
 #define PERF_DIR_ENVIRONMENT "PERF_DIR"
 #define PERF_WORK_TREE_ENVIRONMENT "PERF_WORK_TREE"
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 440db12..3dceabd 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -92,7 +92,7 @@ static void
 fill_node(struct callchain_node *node, struct ip_callchain *chain,
 	  int start, struct symbol **syms)
 {
-	int i;
+	unsigned int i;
 
 	for (i = start; i < chain->nr; i++) {
 		struct callchain_list *call;
@@ -135,7 +135,7 @@ split_add_child(struct callchain_node *parent, struct ip_callchain *chain,
 {
 	struct callchain_node *new;
 	struct list_head *old_tail;
-	int idx_total = idx_parents + idx_local;
+	unsigned int idx_total = idx_parents + idx_local;
 
 	/* split */
 	new = create_child(parent, true);
@@ -164,17 +164,18 @@ split_add_child(struct callchain_node *parent, struct ip_callchain *chain,
 
 static int
 __append_chain(struct callchain_node *root, struct ip_callchain *chain,
-	       int start, struct symbol **syms);
+	       unsigned int start, struct symbol **syms);
 
 static void
 __append_chain_children(struct callchain_node *root, struct ip_callchain *chain,
-			struct symbol **syms, int start)
+			struct symbol **syms, unsigned int start)
 {
 	struct callchain_node *rnode;
 
 	/* lookup in childrens */
 	list_for_each_entry(rnode, &root->children, brothers) {
-		int ret = __append_chain(rnode, chain, start, syms);
+		unsigned int ret = __append_chain(rnode, chain, start, syms);
+
 		if (!ret)
 			return;
 	}
@@ -184,10 +185,10 @@ __append_chain_children(struct callchain_node *root, struct ip_callchain *chain,
 
 static int
 __append_chain(struct callchain_node *root, struct ip_callchain *chain,
-	       int start, struct symbol **syms)
+	       unsigned int start, struct symbol **syms)
 {
 	struct callchain_list *cnode;
-	int i = start;
+	unsigned int i = start;
 	bool found = false;
 
 	/*
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index c942daa..251d99e 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -10,15 +10,15 @@
 struct callchain_node {
 	struct callchain_node	*parent;
 	struct list_head	brothers;
-	struct list_head 	children;
-	struct list_head 	val;
+	struct list_head	children;
+	struct list_head	val;
 	struct rb_node		rb_node;
-	int			val_nr;
-	int			hit;
+	unsigned int		val_nr;
+	u64			hit;
 };
 
 struct callchain_list {
-	unsigned long		ip;
+	u64			ip;
 	struct symbol		*sym;
 	struct list_head	list;
 };
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 9a8c20c..26f8231 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -11,7 +11,8 @@ static int parse_color(const char *name, int len)
 	};
 	char *end;
 	int i;
-	for (i = 0; i < ARRAY_SIZE(color_names); i++) {
+
+	for (i = 0; i < (int)ARRAY_SIZE(color_names); i++) {
 		const char *str = color_names[i];
 		if (!strncasecmp(name, str, len) && !str[len])
 			return i - 1;
@@ -28,7 +29,8 @@ static int parse_attr(const char *name, int len)
 	static const char * const attr_names[] = {
 		"bold", "dim", "ul", "blink", "reverse"
 	};
-	int i;
+	unsigned int i;
+
 	for (i = 0; i < ARRAY_SIZE(attr_names); i++) {
 		const char *str = attr_names[i];
 		if (!strncasecmp(name, str, len) && !str[len])
@@ -222,10 +224,12 @@ int color_fwrite_lines(FILE *fp, const char *color,
 {
 	if (!*color)
 		return fwrite(buf, count, 1, fp) != 1;
+
 	while (count) {
 		char *p = memchr(buf, '\n', count);
+
 		if (p != buf && (fputs(color, fp) < 0 ||
-				fwrite(buf, p ? p - buf : count, 1, fp) != 1 ||
+				fwrite(buf, p ? (size_t)(p - buf) : count, 1, fp) != 1 ||
 				fputs(PERF_COLOR_RESET, fp) < 0))
 			return -1;
 		if (!p)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3dd13fa..780df54 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -47,10 +47,12 @@ static int get_next_char(void)
 static char *parse_value(void)
 {
 	static char value[1024];
-	int quote = 0, comment = 0, len = 0, space = 0;
+	int quote = 0, comment = 0, space = 0;
+	size_t len = 0;
 
 	for (;;) {
 		int c = get_next_char();
+
 		if (len >= sizeof(value) - 1)
 			return NULL;
 		if (c == '\n') {
@@ -353,13 +355,13 @@ int perf_config_string(const char **dest, const char *var, const char *value)
 	return 0;
 }
 
-static int perf_default_core_config(const char *var, const char *value)
+static int perf_default_core_config(const char *var __used, const char *value __used)
 {
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
 }
 
-int perf_default_config(const char *var, const char *value, void *dummy)
+int perf_default_config(const char *var, const char *value, void *dummy __used)
 {
 	if (!prefixcmp(var, "core."))
 		return perf_default_core_config(var, value);
@@ -471,10 +473,10 @@ static int matches(const char* key, const char* value)
 		  !regexec(store.value_regex, value, 0, NULL, 0)));
 }
 
-static int store_aux(const char* key, const char* value, void *cb)
+static int store_aux(const char* key, const char* value, void *cb __used)
 {
+	int section_len;
 	const char *ep;
-	size_t section_len;
 
 	switch (store.state) {
 	case KEY_SEEN:
@@ -551,7 +553,7 @@ static int store_write_section(int fd, const char* key)
 		strbuf_addf(&sb, "[%.*s]\n", store.baselen, key);
 	}
 
-	success = write_in_full(fd, sb.buf, sb.len) == sb.len;
+	success = (write_in_full(fd, sb.buf, sb.len) == (ssize_t)sb.len);
 	strbuf_release(&sb);
 
 	return success;
@@ -599,7 +601,7 @@ static int store_write_pair(int fd, const char* key, const char* value)
 		}
 	strbuf_addf(&sb, "%s\n", quote);
 
-	success = write_in_full(fd, sb.buf, sb.len) == sb.len;
+	success = (write_in_full(fd, sb.buf, sb.len) == (ssize_t)sb.len);
 	strbuf_release(&sb);
 
 	return success;
@@ -741,7 +743,7 @@ int perf_config_set_multivar(const char* key, const char* value,
 	} else {
 		struct stat st;
 		char* contents;
-		size_t contents_sz, copy_begin, copy_end;
+		ssize_t contents_sz, copy_begin, copy_end;
 		int i, new_line = 0;
 
 		if (value_regex == NULL)
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
index d392922..34a3528 100644
--- a/tools/perf/util/exec_cmd.c
+++ b/tools/perf/util/exec_cmd.c
@@ -1,6 +1,9 @@
 #include "cache.h"
 #include "exec_cmd.h"
 #include "quote.h"
+
+#include <string.h>
+
 #define MAX_ARGS	32
 
 extern char **environ;
@@ -51,7 +54,7 @@ const char *perf_extract_argv0_path(const char *argv0)
 		slash--;
 
 	if (slash >= argv0) {
-		argv0_path = strndup(argv0, slash - argv0);
+		argv0_path = xstrndup(argv0, slash - argv0);
 		return slash + 1;
 	}
 
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 17a00e0..fbb0097 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -26,7 +26,7 @@ static int term_columns(void)
 	return 80;
 }
 
-void add_cmdname(struct cmdnames *cmds, const char *name, int len)
+void add_cmdname(struct cmdnames *cmds, const char *name, size_t len)
 {
 	struct cmdname *ent = malloc(sizeof(*ent) + len + 1);
 
@@ -40,7 +40,8 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 
 static void clean_cmdnames(struct cmdnames *cmds)
 {
-	int i;
+	unsigned int i;
+
 	for (i = 0; i < cmds->cnt; ++i)
 		free(cmds->names[i]);
 	free(cmds->names);
@@ -57,7 +58,7 @@ static int cmdname_compare(const void *a_, const void *b_)
 
 static void uniq(struct cmdnames *cmds)
 {
-	int i, j;
+	unsigned int i, j;
 
 	if (!cmds->cnt)
 		return;
@@ -71,7 +72,7 @@ static void uniq(struct cmdnames *cmds)
 
 void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
 {
-	int ci, cj, ei;
+	size_t ci, cj, ei;
 	int cmp;
 
 	ci = cj = ei = 0;
@@ -106,8 +107,9 @@ static void pretty_print_string_list(struct cmdnames *cmds, int longest)
 		printf("  ");
 
 		for (j = 0; j < cols; j++) {
-			int n = j * rows + i;
-			int size = space;
+			unsigned int n = j * rows + i;
+			unsigned int size = space;
+
 			if (n >= cmds->cnt)
 				break;
 			if (j == cols-1 || n + rows >= cmds->cnt)
@@ -208,7 +210,7 @@ void load_command_list(const char *prefix,
 void list_commands(const char *title, struct cmdnames *main_cmds,
 		   struct cmdnames *other_cmds)
 {
-	int i, longest = 0;
+	unsigned int i, longest = 0;
 
 	for (i = 0; i < main_cmds->cnt; i++)
 		if (longest < main_cmds->names[i]->len)
@@ -239,7 +241,8 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
 
 int is_in_cmdlist(struct cmdnames *c, const char *s)
 {
-	int i;
+	unsigned int i;
+
 	for (i = 0; i < c->cnt; i++)
 		if (!strcmp(s, c->names[i]->name))
 			return 1;
@@ -271,7 +274,8 @@ static int levenshtein_compare(const void *p1, const void *p2)
 
 static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
 {
-	int i;
+	unsigned int i;
+
 	ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc);
 
 	for (i = 0; i < old->cnt; i++)
@@ -283,7 +287,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
 
 const char *help_unknown_cmd(const char *cmd)
 {
-	int i, n = 0, best_similarity = 0;
+	unsigned int i, n = 0, best_similarity = 0;
 	struct cmdnames main_cmds, other_cmds;
 
 	memset(&main_cmds, 0, sizeof(main_cmds));
@@ -345,7 +349,7 @@ const char *help_unknown_cmd(const char *cmd)
 	exit(1);
 }
 
-int cmd_version(int argc, const char **argv, const char *prefix)
+int cmd_version(int argc __used, const char **argv __used, const char *prefix __used)
 {
 	printf("perf version %s\n", perf_version_string);
 	return 0;
diff --git a/tools/perf/util/help.h b/tools/perf/util/help.h
index 56bc154..7128783 100644
--- a/tools/perf/util/help.h
+++ b/tools/perf/util/help.h
@@ -2,8 +2,8 @@
 #define HELP_H
 
 struct cmdnames {
-	int alloc;
-	int cnt;
+	size_t alloc;
+	size_t cnt;
 	struct cmdname {
 		size_t len; /* also used for similarity index in help.c */
 		char name[FLEX_ARRAY];
@@ -19,7 +19,7 @@ static inline void mput_char(char c, unsigned int num)
 void load_command_list(const char *prefix,
 		struct cmdnames *main_cmds,
 		struct cmdnames *other_cmds);
-void add_cmdname(struct cmdnames *cmds, const char *name, int len);
+void add_cmdname(struct cmdnames *cmds, const char *name, size_t len);
 /* Here we require that excludes is a sorted list. */
 void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
 int is_in_cmdlist(struct cmdnames *c, const char *s);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e6b83a3..aed7090 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -385,7 +385,7 @@ static int parse_event_symbols(const char **str, struct perf_counter_attr *attr)
 	return 1;
 }
 
-int parse_events(const struct option *opt, const char *str, int unset)
+int parse_events(const struct option *opt __used, const char *str, int unset __used)
 {
 	struct perf_counter_attr attr;
 
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index b3affb1..9a897b7 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -485,7 +485,7 @@ int parse_options_usage(const char * const *usagestr,
 }
 
 
-int parse_opt_verbosity_cb(const struct option *opt, const char *arg,
+int parse_opt_verbosity_cb(const struct option *opt, const char *arg __used,
 			   int unset)
 {
 	int *target = opt->value;
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index a1039a6..15c8aba 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -90,21 +90,20 @@ struct option {
 	intptr_t defval;
 };
 
-#define OPT_END()                   { OPTION_END }
-#define OPT_ARGUMENT(l, h)          { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) }
-#define OPT_GROUP(h)                { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
-#define OPT_BIT(s, l, v, h, b)      { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
-#define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
-#define OPT_SET_INT(s, l, v, h, i)  { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
-#define OPT_SET_PTR(s, l, v, h, p)  { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
-#define OPT_INTEGER(s, l, v, h)     { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
-#define OPT_LONG(s, l, v, h)        { OPTION_LONG, (s), (l), (v), NULL, (h) }
-#define OPT_STRING(s, l, v, a, h)   { OPTION_STRING,  (s), (l), (v), (a), (h) }
+#define OPT_END()                   { .type = OPTION_END }
+#define OPT_ARGUMENT(l, h)          { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) }
+#define OPT_GROUP(h)                { .type = OPTION_GROUP, .help = (h) }
+#define OPT_BIT(s, l, v, h, b)      { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) }
+#define OPT_BOOLEAN(s, l, v, h)     { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
+#define OPT_SET_INT(s, l, v, h, i)  { .type = OPTION_SET_INT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (i) }
+#define OPT_SET_PTR(s, l, v, h, p)  { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) }
+#define OPT_INTEGER(s, l, v, h)     { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
+#define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
+#define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h) }
 #define OPT_DATE(s, l, v, h) \
-	{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
-	  parse_opt_approxidate_cb }
+	{ .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }
 #define OPT_CALLBACK(s, l, v, a, h, f) \
-	{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
+	{ .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f) }
 
 /* parse_options() will filter out the processed options and leave the
  * non-option argments in argv[].
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c
index f18c521..c6e5dc0 100644
--- a/tools/perf/util/quote.c
+++ b/tools/perf/util/quote.c
@@ -162,12 +162,16 @@ static inline int sq_must_quote(char c)
 	return sq_lookup[(unsigned char)c] + quote_path_fully > 0;
 }
 
-/* returns the longest prefix not needing a quote up to maxlen if positive.
-   This stops at the first \0 because it's marked as a character needing an
-   escape */
-static size_t next_quote_pos(const char *s, ssize_t maxlen)
+/*
+ * Returns the longest prefix not needing a quote up to maxlen if
+ * positive.
+ * This stops at the first \0 because it's marked as a character
+ * needing an escape.
+ */
+static ssize_t next_quote_pos(const char *s, ssize_t maxlen)
 {
-	size_t len;
+	ssize_t len;
+
 	if (maxlen < 0) {
 		for (len = 0; !sq_must_quote(s[len]); len++);
 	} else {
@@ -192,22 +196,22 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen)
 static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
                                     struct strbuf *sb, FILE *fp, int no_dq)
 {
-#undef EMIT
-#define EMIT(c)                                 \
-	do {                                        \
-		if (sb) strbuf_addch(sb, (c));          \
-		if (fp) fputc((c), fp);                 \
-		count++;                                \
+#define EMIT(c)							\
+	do {							\
+		if (sb) strbuf_addch(sb, (c));			\
+		if (fp) fputc((c), fp);				\
+		count++;					\
 	} while (0)
-#define EMITBUF(s, l)                           \
-	do {                                        \
-		int __ret;				\
-		if (sb) strbuf_add(sb, (s), (l));       \
-		if (fp) __ret = fwrite((s), (l), 1, fp);        \
-		count += (l);                           \
+
+#define EMITBUF(s, l)						\
+	do {							\
+		int __ret;					\
+		if (sb) strbuf_add(sb, (s), (l));		\
+		if (fp) __ret = fwrite((s), (l), 1, fp);	\
+		count += (l);					\
 	} while (0)
 
-	size_t len, count = 0;
+	ssize_t len, count = 0;
 	const char *p = name;
 
 	for (;;) {
@@ -273,8 +277,8 @@ void write_name_quoted(const char *name, FILE *fp, int terminator)
 	fputc(terminator, fp);
 }
 
-extern void write_name_quotedpfx(const char *pfx, size_t pfxlen,
-                                 const char *name, FILE *fp, int terminator)
+void write_name_quotedpfx(const char *pfx, ssize_t pfxlen,
+			  const char *name, FILE *fp, int terminator)
 {
 	int needquote = 0;
 
@@ -306,7 +310,7 @@ char *quote_path_relative(const char *in, int len,
 		len = strlen(in);
 
 	/* "../" prefix itself does not need quoting, but "in" might. */
-	needquote = next_quote_pos(in, len) < len;
+	needquote = (next_quote_pos(in, len) < len);
 	strbuf_setlen(out, 0);
 	strbuf_grow(out, len);
 
diff --git a/tools/perf/util/quote.h b/tools/perf/util/quote.h
index 5dfad89..a5454a1 100644
--- a/tools/perf/util/quote.h
+++ b/tools/perf/util/quote.h
@@ -53,7 +53,7 @@ extern size_t quote_c_style(const char *name, struct strbuf *, FILE *, int no_dq
 extern void quote_two_c_style(struct strbuf *, const char *, const char *, int);
 
 extern void write_name_quoted(const char *name, FILE *, int terminator);
-extern void write_name_quotedpfx(const char *pfx, size_t pfxlen,
+extern void write_name_quotedpfx(const char *pfx, ssize_t pfxlen,
                                  const char *name, FILE *, int terminator);
 
 /* quote path as relative to the given prefix */
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c
index 464e7ca..5249d5a 100644
--- a/tools/perf/util/strbuf.c
+++ b/tools/perf/util/strbuf.c
@@ -16,7 +16,7 @@ int prefixcmp(const char *str, const char *prefix)
  */
 char strbuf_slopbuf[1];
 
-void strbuf_init(struct strbuf *sb, size_t hint)
+void strbuf_init(struct strbuf *sb, ssize_t hint)
 {
 	sb->alloc = sb->len = 0;
 	sb->buf = strbuf_slopbuf;
@@ -92,7 +92,8 @@ void strbuf_ltrim(struct strbuf *sb)
 
 void strbuf_tolower(struct strbuf *sb)
 {
-	int i;
+	unsigned int i;
+
 	for (i = 0; i < sb->len; i++)
 		sb->buf[i] = tolower(sb->buf[i]);
 }
@@ -264,7 +265,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
 	return res;
 }
 
-ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint)
+ssize_t strbuf_read(struct strbuf *sb, int fd, ssize_t hint)
 {
 	size_t oldlen = sb->len;
 	size_t oldalloc = sb->alloc;
@@ -293,7 +294,7 @@ ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint)
 
 #define STRBUF_MAXLINK (2*PATH_MAX)
 
-int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
+int strbuf_readlink(struct strbuf *sb, const char *path, ssize_t hint)
 {
 	size_t oldalloc = sb->alloc;
 
@@ -301,7 +302,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)
 		hint = 32;
 
 	while (hint < STRBUF_MAXLINK) {
-		int len;
+		ssize_t len;
 
 		strbuf_grow(sb, hint);
 		len = readlink(path, sb->buf, hint);
@@ -343,7 +344,7 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term)
 	return 0;
 }
 
-int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
+int strbuf_read_file(struct strbuf *sb, const char *path, ssize_t hint)
 {
 	int fd, len;
 
diff --git a/tools/perf/util/strbuf.h b/tools/perf/util/strbuf.h
index 9ee908a..d2aa86c 100644
--- a/tools/perf/util/strbuf.h
+++ b/tools/perf/util/strbuf.h
@@ -50,7 +50,7 @@ struct strbuf {
 #define STRBUF_INIT  { 0, 0, strbuf_slopbuf }
 
 /*----- strbuf life cycle -----*/
-extern void strbuf_init(struct strbuf *, size_t);
+extern void strbuf_init(struct strbuf *buf, ssize_t hint);
 extern void strbuf_release(struct strbuf *);
 extern char *strbuf_detach(struct strbuf *, size_t *);
 extern void strbuf_attach(struct strbuf *, void *, size_t, size_t);
@@ -61,7 +61,7 @@ static inline void strbuf_swap(struct strbuf *a, struct strbuf *b) {
 }
 
 /*----- strbuf size related -----*/
-static inline size_t strbuf_avail(const struct strbuf *sb) {
+static inline ssize_t strbuf_avail(const struct strbuf *sb) {
 	return sb->alloc ? sb->alloc - sb->len - 1 : 0;
 }
 
@@ -122,9 +122,9 @@ extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
 
 extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
 /* XXX: if read fails, any partial read is undone */
-extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);
-extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);
-extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
+extern ssize_t strbuf_read(struct strbuf *, int fd, ssize_t hint);
+extern int strbuf_read_file(struct strbuf *sb, const char *path, ssize_t hint);
+extern int strbuf_readlink(struct strbuf *sb, const char *path, ssize_t hint);
 
 extern int strbuf_getline(struct strbuf *, FILE *, int);
 
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c
index 6350d65..4574ac2 100644
--- a/tools/perf/util/wrapper.c
+++ b/tools/perf/util/wrapper.c
@@ -7,7 +7,7 @@
  * There's no pack memory to release - but stay close to the Git
  * version so wrap this away:
  */
-static inline void release_pack_memory(size_t size, int flag)
+static inline void release_pack_memory(size_t size __used, int flag __used)
 {
 }
 
@@ -59,7 +59,8 @@ void *xmemdupz(const void *data, size_t len)
 char *xstrndup(const char *str, size_t len)
 {
 	char *p = memchr(str, '\0', len);
-	return xmemdupz(str, p ? p - str : len);
+
+	return xmemdupz(str, p ? (size_t)(p - str) : len);
 }
 
 void *xrealloc(void *ptr, size_t size)

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Adjust symbols in ET_EXEC files too
       [not found]             ` <new-submission>
                                 ` (267 preceding siblings ...)
  2009-07-01 10:55               ` [tip:perfcounters/urgent] perf_counter tools: Add more warnings and fix/annotate them tip-bot for Ingo Molnar
@ 2009-07-03  6:27               ` tip-bot for Arnaldo Carvalho de Melo
  2009-07-07 12:07               ` [tip:timers/core] timekeeping: Move ktime_get() functions to timekeeping.c tip-bot for Thomas Gleixner
                                 ` (438 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-07-03  6:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  30d7a77dd5a9720430af72f6f62f5156fe073e55
Gitweb:     http://git.kernel.org/tip/30d7a77dd5a9720430af72f6f62f5156fe073e55
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 2 Jul 2009 21:24:14 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 3 Jul 2009 08:24:13 +0200

perf_counter tools: Adjust symbols in ET_EXEC files too

Ingo Molnar wrote:

> i just bisected a 'perf report' bug that would cause us to not
> resolve all user-space symbols in a 'git gc' run to:
>
> f5812a7a336fb952d819e4427b9a2dce02368e82 is first bad commit
> commit f5812a7a336fb952d819e4427b9a2dce02368e82
> Author: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date:   Tue Jun 30 11:43:17 2009 -0300
>
>     perf_counter tools: Adjust only prelinked symbol's addresses

Rename ->prelinked to ->adjust_symbols and making what was done
only for prelinked libraries also to ET_EXEC binaries, such as
/usr/bin/git:

[acme@doppio pahole]$ readelf -h /usr/bin/git | grep Type
  Type:                              EXEC (Executable file)
[acme@doppio pahole]$

And after installing the 'git-debuginfo' package, I get correct results:

[acme@doppio linux-2.6-tip]$ perf report --sort comm,dso,symbol -d /usr/bin/git | head -20

 #
 # (1139614 samples)
 #
 # Overhead           Command  Shared Object              Symbol
 # ........  ................  .........................  ......
 #
    34.98%               git  /usr/bin/git               [.] send_sideband
    33.39%               git  /usr/bin/git               [.] enter_repo
     6.81%               git  /usr/bin/git               [.] diff_opt_parse
     4.95%               git  /usr/bin/git               [.] is_repository_shallow
     3.24%               git  /usr/bin/git               [.] odb_mkstemp
     1.39%               git  /usr/bin/git               [.] output
     1.34%               git  /usr/bin/git               [.] xmmap
     1.25%               git  /usr/bin/git               [.] receive_pack_config
     1.16%               git  /usr/bin/git               [.] git_pathdup
     0.90%               git  /usr/bin/git               [.] read_object_with_reference
     0.86%               git  /usr/bin/git               [.] show_patch_diff
     0.85%               git  /usr/bin/git               0x00000000095e2e
     0.69%               git  /usr/bin/git               [.] display
[acme@doppio linux-2.6-tip]$

I'll check what are the last cases where we can't resolve symbols, like
this 0x00000000095e2e later.

And I guess this will fix the problems Mike were seeing too:

 [acme@doppio linux-2.6-tip]$ readelf -h ../build/perf/vmlinux | grep Type
   Type:                              EXEC (Executable file)
 [acme@doppio linux-2.6-tip]$

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/symbol.c |   11 ++++++-----
 tools/perf/util/symbol.h |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 98a1311..4683b67 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -555,9 +555,10 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 	nr_syms = shdr.sh_size / shdr.sh_entsize;
 
 	memset(&sym, 0, sizeof(sym));
-	self->prelinked = elf_section_by_name(elf, &ehdr, &shdr,
-					      ".gnu.prelink_undo",
-					      NULL) != NULL;
+	self->adjust_symbols = (ehdr.e_type == ET_EXEC ||
+				elf_section_by_name(elf, &ehdr, &shdr,
+						     ".gnu.prelink_undo",
+						     NULL) != NULL);
 	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
 		struct symbol *f;
 		u64 obj_start;
@@ -580,7 +581,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		section_name = elf_sec__name(&shdr, secstrs);
 		obj_start = sym.st_value;
 
-		if (self->prelinked) {
+		if (self->adjust_symbols) {
 			if (verbose >= 2)
 				printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n",
 					(u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset);
@@ -632,7 +633,7 @@ int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
 	if (!name)
 		return -1;
 
-	self->prelinked = 0;
+	self->adjust_symbols = 0;
 
 	if (strncmp(self->name, "/tmp/perf-", 10) == 0)
 		return dso__load_perf_map(self, filter, verbose);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 4e141a3..7918cff 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -24,7 +24,7 @@ struct dso {
 	struct rb_root	 syms;
 	struct symbol    *(*find_symbol)(struct dso *, u64 ip);
 	unsigned int	 sym_priv_size;
-	unsigned char	 prelinked;
+	unsigned char	 adjust_symbols;
 	char		 name[0];
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:timers/core] timekeeping: Move ktime_get() functions to timekeeping.c
       [not found]             ` <new-submission>
                                 ` (268 preceding siblings ...)
  2009-07-03  6:27               ` [tip:perfcounters/urgent] perf_counter tools: Adjust symbols in ET_EXEC files too tip-bot for Arnaldo Carvalho de Melo
@ 2009-07-07 12:07               ` tip-bot for Thomas Gleixner
  2009-07-09 12:04               ` [tip:timers/urgent] hrtimer: migration: always subtract base->offset tip-bot for Thomas Gleixner
                                 ` (437 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-07-07 12:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  a40f262cc21fbfd781bbddcc40b16b83a75f5f34
Gitweb:     http://git.kernel.org/tip/a40f262cc21fbfd781bbddcc40b16b83a75f5f34
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Jul 2009 13:00:31 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 7 Jul 2009 13:00:31 +0200

timekeeping: Move ktime_get() functions to timekeeping.c

The ktime_get() functions for GENERIC_TIME=n are still located in
hrtimer.c. Move them to time/timekeeping.c where they belong.

LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 kernel/hrtimer.c          |   60 ---------------------------------------------
 kernel/time/timekeeping.c |   59 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 57 insertions(+), 62 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 829e066..43d151f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -48,39 +48,6 @@
 
 #include <asm/uaccess.h>
 
-#ifndef CONFIG_GENERIC_TIME
-/**
- * ktime_get - get the monotonic time in ktime_t format
- *
- * returns the time in ktime_t format
- */
-ktime_t ktime_get(void)
-{
-	struct timespec now;
-
-	ktime_get_ts(&now);
-
-	return timespec_to_ktime(now);
-}
-EXPORT_SYMBOL_GPL(ktime_get);
-#endif
-
-/**
- * ktime_get_real - get the real (wall-) time in ktime_t format
- *
- * returns the time in ktime_t format
- */
-ktime_t ktime_get_real(void)
-{
-	struct timespec now;
-
-	getnstimeofday(&now);
-
-	return timespec_to_ktime(now);
-}
-
-EXPORT_SYMBOL_GPL(ktime_get_real);
-
 /*
  * The timer bases:
  *
@@ -108,33 +75,6 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
 	}
 };
 
-#ifndef CONFIG_GENERIC_TIME
-/**
- * ktime_get_ts - get the monotonic clock in timespec format
- * @ts:		pointer to timespec variable
- *
- * The function calculates the monotonic clock from the realtime
- * clock and the wall_to_monotonic offset and stores the result
- * in normalized timespec format in the variable pointed to by @ts.
- */
-void ktime_get_ts(struct timespec *ts)
-{
-	struct timespec tomono;
-	unsigned long seq;
-
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		getnstimeofday(ts);
-		tomono = wall_to_monotonic;
-
-	} while (read_seqretry(&xtime_lock, seq));
-
-	set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
-				ts->tv_nsec + tomono.tv_nsec);
-}
-EXPORT_SYMBOL_GPL(ktime_get_ts);
-#endif
-
 /*
  * Get the coarse grained time at the softirq based on xtime and
  * wall_to_monotonic.
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 7a24813..02c0b2c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -290,10 +290,65 @@ static void change_clocksource(void)
 	       clock->name);
 	 */
 }
-#else
+#else /* GENERIC_TIME */
 static inline void clocksource_forward_now(void) { }
 static inline void change_clocksource(void) { }
-#endif
+
+/**
+ * ktime_get - get the monotonic time in ktime_t format
+ *
+ * returns the time in ktime_t format
+ */
+ktime_t ktime_get(void)
+{
+	struct timespec now;
+
+	ktime_get_ts(&now);
+
+	return timespec_to_ktime(now);
+}
+EXPORT_SYMBOL_GPL(ktime_get);
+
+/**
+ * ktime_get_ts - get the monotonic clock in timespec format
+ * @ts:		pointer to timespec variable
+ *
+ * The function calculates the monotonic clock from the realtime
+ * clock and the wall_to_monotonic offset and stores the result
+ * in normalized timespec format in the variable pointed to by @ts.
+ */
+void ktime_get_ts(struct timespec *ts)
+{
+	struct timespec tomono;
+	unsigned long seq;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		getnstimeofday(ts);
+		tomono = wall_to_monotonic;
+
+	} while (read_seqretry(&xtime_lock, seq));
+
+	set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
+				ts->tv_nsec + tomono.tv_nsec);
+}
+EXPORT_SYMBOL_GPL(ktime_get_ts);
+#endif /* !GENERIC_TIME */
+
+/**
+ * ktime_get_real - get the real (wall-) time in ktime_t format
+ *
+ * returns the time in ktime_t format
+ */
+ktime_t ktime_get_real(void)
+{
+	struct timespec now;
+
+	getnstimeofday(&now);
+
+	return timespec_to_ktime(now);
+}
+EXPORT_SYMBOL_GPL(ktime_get_real);
 
 /**
  * getrawmonotonic - Returns the raw monotonic time in a timespec

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:timers/urgent] hrtimer: migration: always subtract base->offset
       [not found]             ` <new-submission>
                                 ` (269 preceding siblings ...)
  2009-07-07 12:07               ` [tip:timers/core] timekeeping: Move ktime_get() functions to timekeeping.c tip-bot for Thomas Gleixner
@ 2009-07-09 12:04               ` tip-bot for Thomas Gleixner
  2009-07-09 12:04               ` [tip:timers/urgent] hrtimer: migration: do not check expiry time on current CPU tip-bot for Thomas Gleixner
                                 ` (436 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-07-09 12:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  94d25649812b7d7055c162c7d910e94d3d213d34
Gitweb:     http://git.kernel.org/tip/94d25649812b7d7055c162c7d910e94d3d213d34
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 9 Jul 2009 12:49:34 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 9 Jul 2009 13:58:06 +0200

hrtimer: migration: always subtract base->offset

The new timer migration code treats the !HIGHRES case special when
calculating the CLOCK_MONOTONIC based expiry time to validate whether
a timer should be enqueued on a different CPU or not.

This is wrong as a CLOCK_REALTIME based timer expiry value needs to be
converted to CLOCK_MONOTONIC in any case.

Cc: Arun Bharadwaj <arun@linux.vnet.ibm.com
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 kernel/hrtimer.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 9002958..0d43451 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -236,13 +236,8 @@ again:
 		/* Optimized away for NOHZ=n SMP=n */
 		if (cpu == preferred_cpu) {
 			/* Calculate clock monotonic expiry time */
-#ifdef CONFIG_HIGH_RES_TIMERS
 			ktime_t expires = ktime_sub(hrtimer_get_expires(timer),
-							new_base->offset);
-#else
-			ktime_t expires = hrtimer_get_expires(timer);
-#endif
-
+						    new_base->offset);
 			/*
 			 * Get the next event on target cpu from the
 			 * clock events layer.

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:timers/urgent] hrtimer: migration: do not check expiry time on current CPU
       [not found]             ` <new-submission>
                                 ` (270 preceding siblings ...)
  2009-07-09 12:04               ` [tip:timers/urgent] hrtimer: migration: always subtract base->offset tip-bot for Thomas Gleixner
@ 2009-07-09 12:04               ` tip-bot for Thomas Gleixner
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Fix up P6 PMU details tip-bot for Peter Zijlstra
                                 ` (435 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-07-09 12:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  de907e8432b08f2d5966c36e0747e97c0e596810
Gitweb:     http://git.kernel.org/tip/de907e8432b08f2d5966c36e0747e97c0e596810
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 9 Jul 2009 13:52:32 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 9 Jul 2009 13:59:11 +0200

hrtimer: migration: do not check expiry time on current CPU

The timer migration code needs to check whether the expiry time of the
timer is before the programmed clock event expiry time when the timer
is enqueued on another CPU because we can not reprogram the timer
device on the other CPU. The current logic checks the expiry time even
if we enqueue on the current CPU when nohz_get_load_balancer() returns
current CPU. This might lead to an endless loop in the expiry check
code when the expiry time of the timer is before the current
programmed next event.

Check whether nohz_get_load_balancer() returns current CPU and skip
the expiry check if this is the case.

Cc: Arun Bharadwaj <arun@linux.vnet.ibm.com
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 kernel/hrtimer.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 0d43451..d171ecf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -206,8 +206,19 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,
 #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
 	if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) {
 		preferred_cpu = get_nohz_load_balancer();
-		if (preferred_cpu >= 0)
-			cpu = preferred_cpu;
+		if (preferred_cpu >= 0) {
+			/*
+			 * We must not check the expiry value when
+			 * preferred_cpu is the current cpu. If base
+			 * != new_base we would loop forever when the
+			 * timer expires before the current programmed
+			 * next timer event.
+			 */
+			if (preferred_cpu != cpu)
+				cpu = preferred_cpu;
+			else
+				preferred_cpu = -1;
+		}
 	}
 #endif
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Fix up P6 PMU details
       [not found]             ` <new-submission>
                                 ` (271 preceding siblings ...)
  2009-07-09 12:04               ` [tip:timers/urgent] hrtimer: migration: do not check expiry time on current CPU tip-bot for Thomas Gleixner
@ 2009-07-10 10:40               ` tip-bot for Peter Zijlstra
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Clean up global vs counter enable tip-bot for Peter Zijlstra
                                 ` (434 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-07-10 10:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  9c74fb50867e8fb5f3be3be06716492c0f79309e
Gitweb:     http://git.kernel.org/tip/9c74fb50867e8fb5f3be3be06716492c0f79309e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 8 Jul 2009 10:21:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Jul 2009 10:28:27 +0200

perf_counter: Fix up P6 PMU details

The P6 doesn't seem to support cache ref/hit/miss counts, so
we extend the generic hardware event codes to have 0 and -1
mean the same thing as for the generic cache events.

Furthermore, it turns out the 0 event does not count
(that is, its reported that on PPro it actually does count
something), therefore use a event configuration that's
specified not to count to disable the counters.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 1910f39..c7cc6ea 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -84,6 +84,14 @@ static u64 p6_pmu_event_map(int event)
 	return p6_perfmon_event_map[event];
 }
 
+/*
+ * Counter setting that is specified not to count anything.
+ * We use this to effectively disable a counter.
+ *
+ * L2_RQSTS with 0 MESI unit mask.
+ */
+#define P6_NOP_COUNTER			0x0000002EULL
+
 static u64 p6_pmu_raw_event(u64 event)
 {
 #define P6_EVNTSEL_EVENT_MASK		0x000000FFULL
@@ -704,6 +712,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 {
 	struct perf_counter_attr *attr = &counter->attr;
 	struct hw_perf_counter *hwc = &counter->hw;
+	u64 config;
 	int err;
 
 	if (!x86_pmu_initialized())
@@ -756,10 +765,19 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 
 	if (attr->config >= x86_pmu.max_events)
 		return -EINVAL;
+
 	/*
 	 * The generic map:
 	 */
-	hwc->config |= x86_pmu.event_map(attr->config);
+	config = x86_pmu.event_map(attr->config);
+
+	if (config == 0)
+		return -ENOENT;
+
+	if (config == -1LL)
+		return -EINVAL;
+
+	hwc->config |= config;
 
 	return 0;
 }
@@ -767,7 +785,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 static void p6_pmu_disable_all(void)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
-	unsigned long val;
+	u64 val;
 
 	if (!cpuc->enabled)
 		return;
@@ -917,10 +935,10 @@ static inline void
 p6_pmu_disable_counter(struct hw_perf_counter *hwc, int idx)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
-	unsigned long val = ARCH_PERFMON_EVENTSEL0_ENABLE;
+	u64 val = P6_NOP_COUNTER;
 
-	if (!cpuc->enabled)
-		val = 0;
+	if (cpuc->enabled)
+		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
 
 	(void)checking_wrmsrl(hwc->config_base + idx, val);
 }

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Clean up global vs counter enable
       [not found]             ` <new-submission>
                                 ` (272 preceding siblings ...)
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Fix up P6 PMU details tip-bot for Peter Zijlstra
@ 2009-07-10 10:40               ` tip-bot for Peter Zijlstra
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Stop open coding unclone_ctx tip-bot for Peter Zijlstra
                                 ` (433 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-07-10 10:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  984b838ce69c063a91b87550598ab7f3439dd94a
Gitweb:     http://git.kernel.org/tip/984b838ce69c063a91b87550598ab7f3439dd94a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 10 Jul 2009 09:59:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Jul 2009 10:28:29 +0200

perf_counter: Clean up global vs counter enable

Ingo noticed that both AMD and P6 call
x86_pmu_disable_counter() on *_pmu_enable_counter(). This is
because we rely on the side effect of that call to program
the event config but not touch the EN bit.

We change that for AMD by having enable_all() simply write
the full config in, and for P6 by explicitly coding it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index c7cc6ea..bed1c4c 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -874,13 +874,13 @@ static void amd_pmu_enable_all(void)
 	barrier();
 
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
+		struct perf_counter *counter = cpuc->counters[idx];
 		u64 val;
 
 		if (!test_bit(idx, cpuc->active_mask))
 			continue;
-		rdmsrl(MSR_K7_EVNTSEL0 + idx, val);
-		if (val & ARCH_PERFMON_EVENTSEL0_ENABLE)
-			continue;
+
+		val = counter->hw.config;
 		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
 		wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
 	}
@@ -1044,11 +1044,13 @@ intel_pmu_enable_fixed(struct hw_perf_counter *hwc, int __idx)
 static void p6_pmu_enable_counter(struct hw_perf_counter *hwc, int idx)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
+	u64 val;
 
+	val = hwc->config;
 	if (cpuc->enabled)
-		x86_pmu_enable_counter(hwc, idx);
-	else
-		x86_pmu_disable_counter(hwc, idx);
+		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+
+	(void)checking_wrmsrl(hwc->config_base + idx, val);
 }
 
 
@@ -1068,8 +1070,6 @@ static void amd_pmu_enable_counter(struct hw_perf_counter *hwc, int idx)
 
 	if (cpuc->enabled)
 		x86_pmu_enable_counter(hwc, idx);
-	else
-		x86_pmu_disable_counter(hwc, idx);
 }
 
 static int

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Stop open coding unclone_ctx
       [not found]             ` <new-submission>
                                 ` (273 preceding siblings ...)
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Clean up global vs counter enable tip-bot for Peter Zijlstra
@ 2009-07-10 10:40               ` tip-bot for Peter Zijlstra
  2009-07-11  9:57               ` [tip:x86/cleanups] x86/cpu: Clean up various files a bit tip-bot for Alan Cox
                                 ` (432 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-07-10 10:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  71a851b4d2a815adcfac09c1adda7ef6811fde66
Gitweb:     http://git.kernel.org/tip/71a851b4d2a815adcfac09c1adda7ef6811fde66
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 10 Jul 2009 09:06:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Jul 2009 10:28:40 +0200

perf_counter: Stop open coding unclone_ctx

Instead of open coding the unclone context thingy, put it in
a common function.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d55a50d..8bf997d 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -146,6 +146,14 @@ static void put_ctx(struct perf_counter_context *ctx)
 	}
 }
 
+static void unclone_ctx(struct perf_counter_context *ctx)
+{
+	if (ctx->parent_ctx) {
+		put_ctx(ctx->parent_ctx);
+		ctx->parent_ctx = NULL;
+	}
+}
+
 /*
  * Get the perf_counter_context for a task and lock it.
  * This has to cope with with the fact that until it is locked,
@@ -1463,10 +1471,8 @@ static void perf_counter_enable_on_exec(struct task_struct *task)
 	/*
 	 * Unclone this context if we enabled any counter.
 	 */
-	if (enabled && ctx->parent_ctx) {
-		put_ctx(ctx->parent_ctx);
-		ctx->parent_ctx = NULL;
-	}
+	if (enabled)
+		unclone_ctx(ctx);
 
 	spin_unlock(&ctx->lock);
 
@@ -1526,7 +1532,6 @@ __perf_counter_init_context(struct perf_counter_context *ctx,
 
 static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
 {
-	struct perf_counter_context *parent_ctx;
 	struct perf_counter_context *ctx;
 	struct perf_cpu_context *cpuctx;
 	struct task_struct *task;
@@ -1586,11 +1591,7 @@ static struct perf_counter_context *find_get_context(pid_t pid, int cpu)
  retry:
 	ctx = perf_lock_task_context(task, &flags);
 	if (ctx) {
-		parent_ctx = ctx->parent_ctx;
-		if (parent_ctx) {
-			put_ctx(parent_ctx);
-			ctx->parent_ctx = NULL;		/* no longer a clone */
-		}
+		unclone_ctx(ctx);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 
@@ -4255,15 +4256,12 @@ void perf_counter_exit_task(struct task_struct *child)
 	 */
 	spin_lock(&child_ctx->lock);
 	child->perf_counter_ctxp = NULL;
-	if (child_ctx->parent_ctx) {
-		/*
-		 * This context is a clone; unclone it so it can't get
-		 * swapped to another process while we're removing all
-		 * the counters from it.
-		 */
-		put_ctx(child_ctx->parent_ctx);
-		child_ctx->parent_ctx = NULL;
-	}
+	/*
+	 * If this context is a clone; unclone it so it can't get
+	 * swapped to another process while we're removing all
+	 * the counters from it.
+	 */
+	unclone_ctx(child_ctx);
 	spin_unlock(&child_ctx->lock);
 	local_irq_restore(flags);
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/cleanups] x86/cpu: Clean up various files a bit
       [not found]             ` <new-submission>
                                 ` (274 preceding siblings ...)
  2009-07-10 10:40               ` [tip:perfcounters/core] perf_counter: Stop open coding unclone_ctx tip-bot for Peter Zijlstra
@ 2009-07-11  9:57               ` tip-bot for Alan Cox
  2009-07-11 11:00                 ` Jaswinder Singh Rajput
  2009-07-13  6:49               ` [tip:perfcounters/core] perf_counter, x86: Extend perf_counter Pentium M support tip-bot for Daniel Qarras
                                 ` (431 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Alan Cox @ 2009-07-11  9:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, alan, hpa, mingo, tglx, mingo

Commit-ID:  8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
Gitweb:     http://git.kernel.org/tip/8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
Author:     Alan Cox <alan@linux.intel.com>
AuthorDate: Sat, 4 Jul 2009 00:35:45 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 11 Jul 2009 11:24:09 +0200

x86/cpu: Clean up various files a bit

No code changes except printk levels (although some of the K6
mtrr code might be clearer if there were a few as would
splitting out some of the intel cache code).

Signed-off-by: Alan Cox <alan@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/amd.c              |   37 ++++++-----
 arch/x86/kernel/cpu/bugs.c             |   10 ++--
 arch/x86/kernel/cpu/bugs_64.c          |    2 +-
 arch/x86/kernel/cpu/common.c           |    8 +-
 arch/x86/kernel/cpu/cyrix.c            |   19 +++--
 arch/x86/kernel/cpu/hypervisor.c       |    5 +-
 arch/x86/kernel/cpu/intel.c            |   11 ++--
 arch/x86/kernel/cpu/intel_cacheinfo.c  |  116 ++++++++++++++++---------------
 arch/x86/kernel/cpu/perfctr-watchdog.c |   45 ++++++------
 arch/x86/kernel/cpu/proc.c             |    2 +-
 arch/x86/kernel/cpu/vmware.c           |   18 +++---
 11 files changed, 144 insertions(+), 129 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 28e5f59..c6eb02e 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -2,7 +2,7 @@
 #include <linux/bitops.h>
 #include <linux/mm.h>
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/processor.h>
 #include <asm/apic.h>
 #include <asm/cpu.h>
@@ -45,8 +45,8 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
 #define CBAR_ENB	(0x80000000)
 #define CBAR_KEY	(0X000000CB)
 	if (c->x86_model == 9 || c->x86_model == 10) {
-		if (inl (CBAR) & CBAR_ENB)
-			outl (0 | CBAR_KEY, CBAR);
+		if (inl(CBAR) & CBAR_ENB)
+			outl(0 | CBAR_KEY, CBAR);
 	}
 }
 
@@ -87,9 +87,10 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
 		d = d2-d;
 
 		if (d > 20*K6_BUG_LOOP)
-			printk("system stability may be impaired when more than 32 MB are used.\n");
+			printk(KERN_CONT
+				"system stability may be impaired when more than 32 MB are used.\n");
 		else
-			printk("probably OK (after B9730xxxx).\n");
+			printk(KERN_CONT "probably OK (after B9730xxxx).\n");
 		printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
 	}
 
@@ -219,8 +220,9 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
 	if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) {
 		rdmsr(MSR_K7_CLK_CTL, l, h);
 		if ((l & 0xfff00000) != 0x20000000) {
-			printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l,
-				((l & 0x000fffff)|0x20000000));
+			printk(KERN_INFO
+			    "CPU: CLK_CTL MSR was %x. Reprogramming to %x\n",
+					l, ((l & 0x000fffff)|0x20000000));
 			wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h);
 		}
 	}
@@ -398,7 +400,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		u32 level;
 
 		level = cpuid_eax(1);
-		if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
+		if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
 			set_cpu_cap(c, X86_FEATURE_REP_GOOD);
 	}
 	if (c->x86 == 0x10 || c->x86 == 0x11)
@@ -487,27 +489,30 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		 * benefit in doing so.
 		 */
 		if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) {
-		    printk(KERN_DEBUG "tseg: %010llx\n", tseg);
-		    if ((tseg>>PMD_SHIFT) <
+			printk(KERN_DEBUG "tseg: %010llx\n", tseg);
+			if ((tseg>>PMD_SHIFT) <
 				(max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) ||
-			((tseg>>PMD_SHIFT) <
+				((tseg>>PMD_SHIFT) <
 				(max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) &&
-			 (tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
-			set_memory_4k((unsigned long)__va(tseg), 1);
+				(tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
+				set_memory_4k((unsigned long)__va(tseg), 1);
 		}
 	}
 #endif
 }
 
 #ifdef CONFIG_X86_32
-static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
+static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
+							unsigned int size)
 {
 	/* AMD errata T13 (order #21922) */
 	if ((c->x86 == 6)) {
-		if (c->x86_model == 3 && c->x86_mask == 0)	/* Duron Rev A0 */
+		/* Duron Rev A0 */
+		if (c->x86_model == 3 && c->x86_mask == 0)
 			size = 64;
+		/* Tbird rev A1/A2 */
 		if (c->x86_model == 4 &&
-		    (c->x86_mask == 0 || c->x86_mask == 1))	/* Tbird rev A1/A2 */
+			(c->x86_mask == 0 || c->x86_mask == 1))
 			size = 256;
 	}
 	return size;
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index c8e315f..01a2652 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -81,7 +81,7 @@ static void __init check_fpu(void)
 
 	boot_cpu_data.fdiv_bug = fdiv_bug;
 	if (boot_cpu_data.fdiv_bug)
-		printk("Hmm, FPU with FDIV bug.\n");
+		printk(KERN_WARNING "Hmm, FPU with FDIV bug.\n");
 }
 
 static void __init check_hlt(void)
@@ -98,7 +98,7 @@ static void __init check_hlt(void)
 	halt();
 	halt();
 	halt();
-	printk("OK.\n");
+	printk(KERN_CONT "OK.\n");
 }
 
 /*
@@ -122,9 +122,9 @@ static void __init check_popad(void)
 	 * CPU hard. Too bad.
 	 */
 	if (res != 12345678)
-		printk("Buggy.\n");
+		printk(KERN_CONT "Buggy.\n");
 	else
-		printk("OK.\n");
+		printk(KERN_CONT "OK.\n");
 #endif
 }
 
@@ -156,7 +156,7 @@ void __init check_bugs(void)
 {
 	identify_boot_cpu();
 #ifndef CONFIG_SMP
-	printk("CPU: ");
+	printk(KERN_INFO "CPU: ");
 	print_cpu_info(&boot_cpu_data);
 #endif
 	check_config();
diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c
index 9a3ed06..04f0fe5 100644
--- a/arch/x86/kernel/cpu/bugs_64.c
+++ b/arch/x86/kernel/cpu/bugs_64.c
@@ -15,7 +15,7 @@ void __init check_bugs(void)
 {
 	identify_boot_cpu();
 #if !defined(CONFIG_SMP)
-	printk("CPU: ");
+	printk(KERN_INFO "CPU: ");
 	print_cpu_info(&boot_cpu_data);
 #endif
 	alternative_instructions();
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d6f27c9..c96ea44 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -18,8 +18,8 @@
 #include <asm/hypervisor.h>
 #include <asm/processor.h>
 #include <asm/sections.h>
-#include <asm/topology.h>
-#include <asm/cpumask.h>
+#include <linux/topology.h>
+#include <linux/cpumask.h>
 #include <asm/pgtable.h>
 #include <asm/atomic.h>
 #include <asm/proto.h>
@@ -28,13 +28,13 @@
 #include <asm/desc.h>
 #include <asm/i387.h>
 #include <asm/mtrr.h>
-#include <asm/numa.h>
+#include <linux/numa.h>
 #include <asm/asm.h>
 #include <asm/cpu.h>
 #include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/pat.h>
-#include <asm/smp.h>
+#include <linux/smp.h>
 
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/uv/uv.h>
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 593171e..19807b8 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -3,10 +3,10 @@
 #include <linux/delay.h>
 #include <linux/pci.h>
 #include <asm/dma.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/processor-cyrix.h>
 #include <asm/processor-flags.h>
-#include <asm/timer.h>
+#include <linux/timer.h>
 #include <asm/pci-direct.h>
 #include <asm/tsc.h>
 
@@ -282,7 +282,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
 		 *  The 5510/5520 companion chips have a funky PIT.
 		 */
 		if (vendor == PCI_VENDOR_ID_CYRIX &&
-	 (device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
+			(device == PCI_DEVICE_ID_CYRIX_5510 ||
+					device == PCI_DEVICE_ID_CYRIX_5520))
 			mark_tsc_unstable("cyrix 5510/5520 detected");
 	}
 #endif
@@ -299,7 +300,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
 			 *  ?  : 0x7x
 			 * GX1 : 0x8x          GX1  datasheet 56
 			 */
-			if ((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <= dir1 && dir1 <= 0x8f))
+			if ((0x30 <= dir1 && dir1 <= 0x6f) ||
+					(0x80 <= dir1 && dir1 <= 0x8f))
 				geode_configure();
 			return;
 		} else { /* MediaGX */
@@ -427,9 +429,12 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c)
 			printk(KERN_INFO "Enabling CPUID on Cyrix processor.\n");
 			local_irq_save(flags);
 			ccr3 = getCx86(CX86_CCR3);
-			setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);       /* enable MAPEN  */
-			setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);  /* enable cpuid  */
-			setCx86(CX86_CCR3, ccr3);                       /* disable MAPEN */
+			/* enable MAPEN  */
+			setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
+			/* enable cpuid  */
+			setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
+			/* disable MAPEN */
+			setCx86(CX86_CCR3, ccr3);
 			local_irq_restore(flags);
 		}
 	}
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index fb5b86a..93ba8ee 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -28,11 +28,10 @@
 static inline void __cpuinit
 detect_hypervisor_vendor(struct cpuinfo_x86 *c)
 {
-	if (vmware_platform()) {
+	if (vmware_platform())
 		c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
-	} else {
+	else
 		c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
-	}
 }
 
 unsigned long get_hypervisor_tsc_freq(void)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 3260ab0..80a722a 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -7,17 +7,17 @@
 #include <linux/sched.h>
 #include <linux/thread_info.h>
 #include <linux/module.h>
+#include <linux/uaccess.h>
 
 #include <asm/processor.h>
 #include <asm/pgtable.h>
 #include <asm/msr.h>
-#include <asm/uaccess.h>
 #include <asm/ds.h>
 #include <asm/bugs.h>
 #include <asm/cpu.h>
 
 #ifdef CONFIG_X86_64
-#include <asm/topology.h>
+#include <linux/topology.h>
 #include <asm/numa_64.h>
 #endif
 
@@ -174,7 +174,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
 #ifdef CONFIG_X86_F00F_BUG
 	/*
 	 * All current models of Pentium and Pentium with MMX technology CPUs
-	 * have the F0 0F bug, which lets nonprivileged users lock up the system.
+	 * have the F0 0F bug, which lets nonprivileged users lock up the
+	 * system.
 	 * Note that the workaround only should be initialized once...
 	 */
 	c->f00f_bug = 0;
@@ -207,7 +208,7 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
 			printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n");
 			printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
 			lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
-			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
+			wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
 		}
 	}
 
@@ -283,7 +284,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
 	/* Intel has a non-standard dependency on %ecx for this CPUID level. */
 	cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
 	if (eax & 0x1f)
-		return ((eax >> 26) + 1);
+		return (eax >> 26) + 1;
 	else
 		return 1;
 }
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 789efe2..306bf0d 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -3,7 +3,7 @@
  *
  *	Changes:
  *	Venkatesh Pallipadi	: Adding cache identification through cpuid(4)
- *		Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure.
+ *	Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure.
  *	Andi Kleen / Andreas Herrmann	: CPUID4 emulation on AMD.
  */
 
@@ -16,7 +16,7 @@
 #include <linux/pci.h>
 
 #include <asm/processor.h>
-#include <asm/smp.h>
+#include <linux/smp.h>
 #include <asm/k8.h>
 
 #define LVL_1_INST	1
@@ -25,14 +25,15 @@
 #define LVL_3		4
 #define LVL_TRACE	5
 
-struct _cache_table
-{
+struct _cache_table {
 	unsigned char descriptor;
 	char cache_type;
 	short size;
 };
 
-/* all the cache descriptor types we care about (no TLB or trace cache entries) */
+/* All the cache descriptor types we care about (no TLB or
+   trace cache entries) */
+
 static const struct _cache_table __cpuinitconst cache_table[] =
 {
 	{ 0x06, LVL_1_INST, 8 },	/* 4-way set assoc, 32 byte line size */
@@ -105,8 +106,7 @@ static const struct _cache_table __cpuinitconst cache_table[] =
 };
 
 
-enum _cache_type
-{
+enum _cache_type {
 	CACHE_TYPE_NULL	= 0,
 	CACHE_TYPE_DATA = 1,
 	CACHE_TYPE_INST = 2,
@@ -170,31 +170,31 @@ unsigned short			num_cache_leaves;
    Maybe later */
 union l1_cache {
 	struct {
-		unsigned line_size : 8;
-		unsigned lines_per_tag : 8;
-		unsigned assoc : 8;
-		unsigned size_in_kb : 8;
+		unsigned line_size:8;
+		unsigned lines_per_tag:8;
+		unsigned assoc:8;
+		unsigned size_in_kb:8;
 	};
 	unsigned val;
 };
 
 union l2_cache {
 	struct {
-		unsigned line_size : 8;
-		unsigned lines_per_tag : 4;
-		unsigned assoc : 4;
-		unsigned size_in_kb : 16;
+		unsigned line_size:8;
+		unsigned lines_per_tag:4;
+		unsigned assoc:4;
+		unsigned size_in_kb:16;
 	};
 	unsigned val;
 };
 
 union l3_cache {
 	struct {
-		unsigned line_size : 8;
-		unsigned lines_per_tag : 4;
-		unsigned assoc : 4;
-		unsigned res : 2;
-		unsigned size_encoded : 14;
+		unsigned line_size:8;
+		unsigned lines_per_tag:4;
+		unsigned assoc:4;
+		unsigned res:2;
+		unsigned size_encoded:14;
 	};
 	unsigned val;
 };
@@ -350,7 +350,8 @@ static int __cpuinit find_num_cache_leaves(void)
 
 unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
 {
-	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
+	/* Cache sizes */
+	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
 	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
 	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
 	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
@@ -377,8 +378,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
 
 			retval = cpuid4_cache_lookup_regs(i, &this_leaf);
 			if (retval >= 0) {
-				switch(this_leaf.eax.split.level) {
-				    case 1:
+				switch (this_leaf.eax.split.level) {
+				case 1:
 					if (this_leaf.eax.split.type ==
 							CACHE_TYPE_DATA)
 						new_l1d = this_leaf.size/1024;
@@ -386,19 +387,20 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
 							CACHE_TYPE_INST)
 						new_l1i = this_leaf.size/1024;
 					break;
-				    case 2:
+				case 2:
 					new_l2 = this_leaf.size/1024;
 					num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
 					index_msb = get_count_order(num_threads_sharing);
 					l2_id = c->apicid >> index_msb;
 					break;
-				    case 3:
+				case 3:
 					new_l3 = this_leaf.size/1024;
 					num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
-					index_msb = get_count_order(num_threads_sharing);
+					index_msb = get_count_order(
+							num_threads_sharing);
 					l3_id = c->apicid >> index_msb;
 					break;
-				    default:
+				default:
 					break;
 				}
 			}
@@ -421,22 +423,21 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
 		/* Number of times to iterate */
 		n = cpuid_eax(2) & 0xFF;
 
-		for ( i = 0 ; i < n ; i++ ) {
+		for (i = 0 ; i < n ; i++) {
 			cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
 
 			/* If bit 31 is set, this is an unknown format */
-			for ( j = 0 ; j < 3 ; j++ ) {
-				if (regs[j] & (1 << 31)) regs[j] = 0;
-			}
+			for (j = 0 ; j < 3 ; j++)
+				if (regs[j] & (1 << 31))
+					regs[j] = 0;
 
 			/* Byte 0 is level count, not a descriptor */
-			for ( j = 1 ; j < 16 ; j++ ) {
+			for (j = 1 ; j < 16 ; j++) {
 				unsigned char des = dp[j];
 				unsigned char k = 0;
 
 				/* look up this descriptor in the table */
-				while (cache_table[k].descriptor != 0)
-				{
+				while (cache_table[k].descriptor != 0) {
 					if (cache_table[k].descriptor == des) {
 						if (only_trace && cache_table[k].cache_type != LVL_TRACE)
 							break;
@@ -488,14 +489,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
 	}
 
 	if (trace)
-		printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
-	else if ( l1i )
-		printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);
+		printk(KERN_INFO "CPU: Trace cache: %dK uops", trace);
+	else if (l1i)
+		printk(KERN_INFO "CPU: L1 I cache: %dK", l1i);
 
 	if (l1d)
-		printk(", L1 D cache: %dK\n", l1d);
+		printk(KERN_CONT ", L1 D cache: %dK\n", l1d);
 	else
-		printk("\n");
+		printk(KERN_CONT "\n");
 
 	if (l2)
 		printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
@@ -558,8 +559,13 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
 	}
 }
 #else
-static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) {}
-static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) {}
+static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
+{
+}
+
+static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
+{
+}
 #endif
 
 static void __cpuinit free_cache_attributes(unsigned int cpu)
@@ -645,7 +651,7 @@ static DEFINE_PER_CPU(struct _index_kobject *, index_kobject);
 static ssize_t show_##file_name						\
 			(struct _cpuid4_info *this_leaf, char *buf)	\
 {									\
-	return sprintf (buf, "%lu\n", (unsigned long)this_leaf->object + val); \
+	return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \
 }
 
 show_one_plus(level, eax.split.level, 0);
@@ -656,7 +662,7 @@ show_one_plus(number_of_sets, ecx.split.number_of_sets, 1);
 
 static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf)
 {
-	return sprintf (buf, "%luK\n", this_leaf->size / 1024);
+	return sprintf(buf, "%luK\n", this_leaf->size / 1024);
 }
 
 static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
@@ -669,7 +675,7 @@ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
 		const struct cpumask *mask;
 
 		mask = to_cpumask(this_leaf->shared_cpu_map);
-		n = type?
+		n = type ?
 			cpulist_scnprintf(buf, len-2, mask) :
 			cpumask_scnprintf(buf, len-2, mask);
 		buf[n++] = '\n';
@@ -800,7 +806,7 @@ static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644,
 static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
 		show_cache_disable_1, store_cache_disable_1);
 
-static struct attribute * default_attrs[] = {
+static struct attribute *default_attrs[] = {
 	&type.attr,
 	&level.attr,
 	&coherency_line_size.attr,
@@ -815,7 +821,7 @@ static struct attribute * default_attrs[] = {
 	NULL
 };
 
-static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf)
+static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf)
 {
 	struct _cache_attr *fattr = to_attr(attr);
 	struct _index_kobject *this_leaf = to_object(kobj);
@@ -828,8 +834,8 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf)
 	return ret;
 }
 
-static ssize_t store(struct kobject * kobj, struct attribute * attr,
-		     const char * buf, size_t count)
+static ssize_t store(struct kobject *kobj, struct attribute *attr,
+		     const char *buf, size_t count)
 {
 	struct _cache_attr *fattr = to_attr(attr);
 	struct _index_kobject *this_leaf = to_object(kobj);
@@ -883,7 +889,7 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
 		goto err_out;
 
 	per_cpu(index_kobject, cpu) = kzalloc(
-	    sizeof(struct _index_kobject ) * num_cache_leaves, GFP_KERNEL);
+	    sizeof(struct _index_kobject) * num_cache_leaves, GFP_KERNEL);
 	if (unlikely(per_cpu(index_kobject, cpu) == NULL))
 		goto err_out;
 
@@ -917,7 +923,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
 	}
 
 	for (i = 0; i < num_cache_leaves; i++) {
-		this_object = INDEX_KOBJECT_PTR(cpu,i);
+		this_object = INDEX_KOBJECT_PTR(cpu, i);
 		this_object->cpu = cpu;
 		this_object->index = i;
 		retval = kobject_init_and_add(&(this_object->kobj),
@@ -925,9 +931,8 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
 					      per_cpu(cache_kobject, cpu),
 					      "index%1lu", i);
 		if (unlikely(retval)) {
-			for (j = 0; j < i; j++) {
-				kobject_put(&(INDEX_KOBJECT_PTR(cpu,j)->kobj));
-			}
+			for (j = 0; j < i; j++)
+				kobject_put(&(INDEX_KOBJECT_PTR(cpu, j)->kobj));
 			kobject_put(per_cpu(cache_kobject, cpu));
 			cpuid4_cache_sysfs_exit(cpu);
 			return retval;
@@ -952,7 +957,7 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
 	cpumask_clear_cpu(cpu, to_cpumask(cache_dev_map));
 
 	for (i = 0; i < num_cache_leaves; i++)
-		kobject_put(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));
+		kobject_put(&(INDEX_KOBJECT_PTR(cpu, i)->kobj));
 	kobject_put(per_cpu(cache_kobject, cpu));
 	cpuid4_cache_sysfs_exit(cpu);
 }
@@ -977,8 +982,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
 	return NOTIFY_OK;
 }
 
-static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier =
-{
+static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = {
 	.notifier_call = cacheinfo_cpu_callback,
 };
 
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 5c481f6..8100a29 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -68,16 +68,16 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
 	/* returns the bit offset of the performance counter register */
 	switch (boot_cpu_data.x86_vendor) {
 	case X86_VENDOR_AMD:
-		return (msr - MSR_K7_PERFCTR0);
+		return msr - MSR_K7_PERFCTR0;
 	case X86_VENDOR_INTEL:
 		if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
-			return (msr - MSR_ARCH_PERFMON_PERFCTR0);
+			return msr - MSR_ARCH_PERFMON_PERFCTR0;
 
 		switch (boot_cpu_data.x86) {
 		case 6:
-			return (msr - MSR_P6_PERFCTR0);
+			return msr - MSR_P6_PERFCTR0;
 		case 15:
-			return (msr - MSR_P4_BPU_PERFCTR0);
+			return msr - MSR_P4_BPU_PERFCTR0;
 		}
 	}
 	return 0;
@@ -92,16 +92,16 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
 	/* returns the bit offset of the event selection register */
 	switch (boot_cpu_data.x86_vendor) {
 	case X86_VENDOR_AMD:
-		return (msr - MSR_K7_EVNTSEL0);
+		return msr - MSR_K7_EVNTSEL0;
 	case X86_VENDOR_INTEL:
 		if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
-			return (msr - MSR_ARCH_PERFMON_EVENTSEL0);
+			return msr - MSR_ARCH_PERFMON_EVENTSEL0;
 
 		switch (boot_cpu_data.x86) {
 		case 6:
-			return (msr - MSR_P6_EVNTSEL0);
+			return msr - MSR_P6_EVNTSEL0;
 		case 15:
-			return (msr - MSR_P4_BSU_ESCR0);
+			return msr - MSR_P4_BSU_ESCR0;
 		}
 	}
 	return 0;
@@ -113,7 +113,7 @@ int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
 {
 	BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-	return (!test_bit(counter, perfctr_nmi_owner));
+	return !test_bit(counter, perfctr_nmi_owner);
 }
 
 /* checks the an msr for availability */
@@ -124,7 +124,7 @@ int avail_to_resrv_perfctr_nmi(unsigned int msr)
 	counter = nmi_perfctr_msr_to_bit(msr);
 	BUG_ON(counter > NMI_MAX_COUNTER_BITS);
 
-	return (!test_bit(counter, perfctr_nmi_owner));
+	return !test_bit(counter, perfctr_nmi_owner);
 }
 EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit);
 
@@ -237,7 +237,7 @@ static unsigned int adjust_for_32bit_ctr(unsigned int hz)
 	 */
 	counter_val = (u64)cpu_khz * 1000;
 	do_div(counter_val, retval);
- 	if (counter_val > 0x7fffffffULL) {
+	if (counter_val > 0x7fffffffULL) {
 		u64 count = (u64)cpu_khz * 1000;
 		do_div(count, 0x7fffffffUL);
 		retval = count + 1;
@@ -251,7 +251,7 @@ static void write_watchdog_counter(unsigned int perfctr_msr,
 	u64 count = (u64)cpu_khz * 1000;
 
 	do_div(count, nmi_hz);
-	if(descr)
+	if (descr)
 		pr_debug("setting %s to -0x%08Lx\n", descr, count);
 	wrmsrl(perfctr_msr, 0 - count);
 }
@@ -262,7 +262,7 @@ static void write_watchdog_counter32(unsigned int perfctr_msr,
 	u64 count = (u64)cpu_khz * 1000;
 
 	do_div(count, nmi_hz);
-	if(descr)
+	if (descr)
 		pr_debug("setting %s to -0x%08Lx\n", descr, count);
 	wrmsr(perfctr_msr, (u32)(-count), 0);
 }
@@ -296,7 +296,7 @@ static int setup_k7_watchdog(unsigned nmi_hz)
 
 	/* setup the timer */
 	wrmsr(evntsel_msr, evntsel, 0);
-	write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz);
+	write_watchdog_counter(perfctr_msr, "K7_PERFCTR0", nmi_hz);
 
 	/* initialize the wd struct before enabling */
 	wd->perfctr_msr = perfctr_msr;
@@ -387,7 +387,7 @@ static int setup_p6_watchdog(unsigned nmi_hz)
 	/* setup the timer */
 	wrmsr(evntsel_msr, evntsel, 0);
 	nmi_hz = adjust_for_32bit_ctr(nmi_hz);
-	write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz);
+	write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0", nmi_hz);
 
 	/* initialize the wd struct before enabling */
 	wd->perfctr_msr = perfctr_msr;
@@ -415,7 +415,7 @@ static void __kprobes p6_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
 
 	/* P6/ARCH_PERFMON has 32 bit counter write */
-	write_watchdog_counter32(wd->perfctr_msr, NULL,nmi_hz);
+	write_watchdog_counter32(wd->perfctr_msr, NULL, nmi_hz);
 }
 
 static const struct wd_ops p6_wd_ops = {
@@ -490,9 +490,9 @@ static int setup_p4_watchdog(unsigned nmi_hz)
 	if (smp_num_siblings == 2) {
 		unsigned int ebx, apicid;
 
-        	ebx = cpuid_ebx(1);
-	        apicid = (ebx >> 24) & 0xff;
-        	ht_num = apicid & 1;
+		ebx = cpuid_ebx(1);
+		apicid = (ebx >> 24) & 0xff;
+		ht_num = apicid & 1;
 	} else
 #endif
 		ht_num = 0;
@@ -544,7 +544,7 @@ static int setup_p4_watchdog(unsigned nmi_hz)
 	}
 
 	evntsel = P4_ESCR_EVENT_SELECT(0x3F)
-	 	| P4_ESCR_OS
+		| P4_ESCR_OS
 		| P4_ESCR_USR;
 
 	cccr_val |= P4_CCCR_THRESHOLD(15)
@@ -612,7 +612,7 @@ static void __kprobes p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
 {
 	unsigned dummy;
 	/*
- 	 * P4 quirks:
+	 * P4 quirks:
 	 * - An overflown perfctr will assert its interrupt
 	 *   until the OVF flag in its CCCR is cleared.
 	 * - LVTPC is masked on interrupt and must be
@@ -662,7 +662,8 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
 	 * NOTE: Corresponding bit = 0 in ebx indicates event present.
 	 */
 	cpuid(10, &(eax.full), &ebx, &unused, &unused);
-	if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) ||
+	if ((eax.split.mask_length <
+			(ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) ||
 	    (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT))
 		return 0;
 
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index d5e3039..1e90434 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -128,7 +128,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 			if (i < ARRAY_SIZE(x86_power_flags) &&
 			    x86_power_flags[i])
 				seq_printf(m, "%s%s",
-					   x86_power_flags[i][0]?" ":"",
+					   x86_power_flags[i][0] ? " " : "",
 					   x86_power_flags[i]);
 			else
 				seq_printf(m, " [%d]", i);
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 284c399..bc24f51 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -49,17 +49,17 @@ static inline int __vmware_platform(void)
 
 static unsigned long __vmware_get_tsc_khz(void)
 {
-        uint64_t tsc_hz;
-        uint32_t eax, ebx, ecx, edx;
+	uint64_t tsc_hz;
+	uint32_t eax, ebx, ecx, edx;
 
-        VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
+	VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
 
-        if (ebx == UINT_MAX)
-                return 0;
-        tsc_hz = eax | (((uint64_t)ebx) << 32);
-        do_div(tsc_hz, 1000);
-        BUG_ON(tsc_hz >> 32);
-        return tsc_hz;
+	if (ebx == UINT_MAX)
+		return 0;
+	tsc_hz = eax | (((uint64_t)ebx) << 32);
+	do_div(tsc_hz, 1000);
+	BUG_ON(tsc_hz >> 32);
+	return tsc_hz;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:x86/cleanups] x86/cpu: Clean up various files a bit
  2009-07-11  9:57               ` [tip:x86/cleanups] x86/cpu: Clean up various files a bit tip-bot for Alan Cox
@ 2009-07-11 11:00                 ` Jaswinder Singh Rajput
  2009-07-11 11:09                   ` Jaswinder Singh Rajput
  2009-07-11 14:10                   ` Alan Cox
  0 siblings, 2 replies; 1149+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 11:00 UTC (permalink / raw)
  To: mingo, hpa, alan, linux-kernel, tglx, mingo; +Cc: linux-tip-commits

On Sat, 2009-07-11 at 09:57 +0000, tip-bot for Alan Cox wrote:
> Commit-ID:  8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
> Gitweb:     http://git.kernel.org/tip/8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
> Author:     Alan Cox <alan@linux.intel.com>
> AuthorDate: Sat, 4 Jul 2009 00:35:45 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 11 Jul 2009 11:24:09 +0200
> 
> x86/cpu: Clean up various files a bit
> 
> No code changes except printk levels (although some of the K6
> mtrr code might be clearer if there were a few as would
> splitting out some of the intel cache code).
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  arch/x86/kernel/cpu/amd.c              |   37 ++++++-----
>  arch/x86/kernel/cpu/bugs.c             |   10 ++--
>  arch/x86/kernel/cpu/bugs_64.c          |    2 +-
>  arch/x86/kernel/cpu/common.c           |    8 +-
>  arch/x86/kernel/cpu/cyrix.c            |   19 +++--
>  arch/x86/kernel/cpu/hypervisor.c       |    5 +-
>  arch/x86/kernel/cpu/intel.c            |   11 ++--
>  arch/x86/kernel/cpu/intel_cacheinfo.c  |  116 ++++++++++++++++---------------
>  arch/x86/kernel/cpu/perfctr-watchdog.c |   45 ++++++------
>  arch/x86/kernel/cpu/proc.c             |    2 +-
>  arch/x86/kernel/cpu/vmware.c           |   18 +++---
>  11 files changed, 144 insertions(+), 129 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 28e5f59..c6eb02e 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -2,7 +2,7 @@
>  #include <linux/bitops.h>
>  #include <linux/mm.h>
>  
> -#include <asm/io.h>
> +#include <linux/io.h>

linux/io.h should move to linux/XXX.h block

>  
>  static void __init check_hlt(void)
> @@ -98,7 +98,7 @@ static void __init check_hlt(void)
>  	halt();
>  	halt();
>  	halt();
> -	printk("OK.\n");
> +	printk(KERN_CONT "OK.\n");
>  }
>  
>  /*
> @@ -122,9 +122,9 @@ static void __init check_popad(void)
>  	 * CPU hard. Too bad.
>  	 */
>  	if (res != 12345678)
> -		printk("Buggy.\n");
> +		printk(KERN_CONT "Buggy.\n");
>  	else
> -		printk("OK.\n");
> +		printk(KERN_CONT "OK.\n");
>  #endif
>  }
>  
> @@ -156,7 +156,7 @@ void __init check_bugs(void)
>  {
>  	identify_boot_cpu();
>  #ifndef CONFIG_SMP
> -	printk("CPU: ");
> +	printk(KERN_INFO "CPU: ");
>  	print_cpu_info(&boot_cpu_data);
>  #endif
>  	check_config();
> diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c
> index 9a3ed06..04f0fe5 100644
> --- a/arch/x86/kernel/cpu/bugs_64.c
> +++ b/arch/x86/kernel/cpu/bugs_64.c
> @@ -15,7 +15,7 @@ void __init check_bugs(void)
>  {
>  	identify_boot_cpu();
>  #if !defined(CONFIG_SMP)
> -	printk("CPU: ");
> +	printk(KERN_INFO "CPU: ");
>  	print_cpu_info(&boot_cpu_data);
>  #endif
>  	alternative_instructions();

I think, these was left intentionally otherwise dmesg output looks
weird.

> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index d6f27c9..c96ea44 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -18,8 +18,8 @@
>  #include <asm/hypervisor.h>
>  #include <asm/processor.h>
>  #include <asm/sections.h>
> -#include <asm/topology.h>
> -#include <asm/cpumask.h>
> +#include <linux/topology.h>
> +#include <linux/cpumask.h>

ditto

>  #include <asm/pgtable.h>
>  #include <asm/atomic.h>
>  #include <asm/proto.h>
> @@ -28,13 +28,13 @@
>  #include <asm/desc.h>
>  #include <asm/i387.h>
>  #include <asm/mtrr.h>
> -#include <asm/numa.h>
> +#include <linux/numa.h>

ditto.

>  #include <asm/asm.h>
>  #include <asm/cpu.h>
>  #include <asm/mce.h>
>  #include <asm/msr.h>
>  #include <asm/pat.h>
> -#include <asm/smp.h>
> +#include <linux/smp.h>

ditto + have you checking different config files, in some cases we get
error due to this.

>  
>  #ifdef CONFIG_X86_LOCAL_APIC
>  #include <asm/uv/uv.h>
> diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
> index 593171e..19807b8 100644
> --- a/arch/x86/kernel/cpu/cyrix.c
> +++ b/arch/x86/kernel/cpu/cyrix.c
> @@ -3,10 +3,10 @@
>  #include <linux/delay.h>
>  #include <linux/pci.h>
>  #include <asm/dma.h>
> -#include <asm/io.h>
> +#include <linux/io.h>
>  #include <asm/processor-cyrix.h>
>  #include <asm/processor-flags.h>
> -#include <asm/timer.h>
> +#include <linux/timer.h>
>  #include <asm/pci-direct.h>
>  #include <asm/tsc.h>
>  

ditto

> @@ -282,7 +282,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
>  		 *  The 5510/5520 companion chips have a funky PIT.
>  		 */
>  		if (vendor == PCI_VENDOR_ID_CYRIX &&
> -	 (device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
> +			(device == PCI_DEVICE_ID_CYRIX_5510 ||
> +					device == PCI_DEVICE_ID_CYRIX_5520))
>  			mark_tsc_unstable("cyrix 5510/5520 detected");

This even looks ugly.

>  	}
>  #endif
> @@ -299,7 +300,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
>  			 *  ?  : 0x7x
>  			 * GX1 : 0x8x          GX1  datasheet 56
>  			 */
> -			if ((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <= dir1 && dir1 <= 0x8f))
> +			if ((0x30 <= dir1 && dir1 <= 0x6f) ||
> +					(0x80 <= dir1 && dir1 <= 0x8f))
>  				geode_configure();

ditto

>  			return;
>  		} else { /* MediaGX */
> @@ -427,9 +429,12 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c)
>  			printk(KERN_INFO "Enabling CPUID on Cyrix processor.\n");
>  			local_irq_save(flags);
>  			ccr3 = getCx86(CX86_CCR3);
> -			setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);       /* enable MAPEN  */
> -			setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);  /* enable cpuid  */
> -			setCx86(CX86_CCR3, ccr3);                       /* disable MAPEN */
> +			/* enable MAPEN  */
> +			setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
> +			/* enable cpuid  */
> +			setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
> +			/* disable MAPEN */
> +			setCx86(CX86_CCR3, ccr3);
>  			local_irq_restore(flags);
>  		}
>  	}
>  
> @@ -174,7 +174,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
>  #ifdef CONFIG_X86_F00F_BUG
>  	/*
>  	 * All current models of Pentium and Pentium with MMX technology CPUs
> -	 * have the F0 0F bug, which lets nonprivileged users lock up the system.
> +	 * have the F0 0F bug, which lets nonprivileged users lock up the
> +	 * system.

It should be non-privileged


I think this is enough.

Even though I have send some of these fixes many times to you and you
keep on rejecting my patch by saying there are more clean-ups.

Do not you feel it this time.

Thanks,
--
JSR

>  	 * Note that the workaround only should be initialized once...
>  	 */
>  	c->f00f_bug = 0;
> @@ -207,7 +208,7 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
>  			printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n");
>  			printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
>  			lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
> -			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
> +			wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
>  		}
>  	}
>  
> @@ -283,7 +284,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
>  	/* Intel has a non-standard dependency on %ecx for this CPUID level. */
>  	cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
>  	if (eax & 0x1f)
> -		return ((eax >> 26) + 1);
> +		return (eax >> 26) + 1;
>  	else
>  		return 1;
>  }
> diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
> index 789efe2..306bf0d 100644
> --- a/arch/x86/kernel/cpu/intel_cacheinfo.c
> +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
> @@ -3,7 +3,7 @@
>   *
>   *	Changes:
>   *	Venkatesh Pallipadi	: Adding cache identification through cpuid(4)
> - *		Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure.
> + *	Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure.
>   *	Andi Kleen / Andreas Herrmann	: CPUID4 emulation on AMD.
>   */
>  
> @@ -16,7 +16,7 @@
>  #include <linux/pci.h>
>  
>  #include <asm/processor.h>
> -#include <asm/smp.h>
> +#include <linux/smp.h>
>  #include <asm/k8.h>
>  
>  #define LVL_1_INST	1
> @@ -25,14 +25,15 @@
>  #define LVL_3		4
>  #define LVL_TRACE	5
>  
> -struct _cache_table
> -{
> +struct _cache_table {
>  	unsigned char descriptor;
>  	char cache_type;
>  	short size;
>  };
>  
> -/* all the cache descriptor types we care about (no TLB or trace cache entries) */
> +/* All the cache descriptor types we care about (no TLB or
> +   trace cache entries) */
> +
>  static const struct _cache_table __cpuinitconst cache_table[] =
>  {
>  	{ 0x06, LVL_1_INST, 8 },	/* 4-way set assoc, 32 byte line size */
> @@ -105,8 +106,7 @@ static const struct _cache_table __cpuinitconst cache_table[] =
>  };
>  
> 
> -enum _cache_type
> -{
> +enum _cache_type {
>  	CACHE_TYPE_NULL	= 0,
>  	CACHE_TYPE_DATA = 1,
>  	CACHE_TYPE_INST = 2,
> @@ -170,31 +170,31 @@ unsigned short			num_cache_leaves;
>     Maybe later */
>  union l1_cache {
>  	struct {
> -		unsigned line_size : 8;
> -		unsigned lines_per_tag : 8;
> -		unsigned assoc : 8;
> -		unsigned size_in_kb : 8;
> +		unsigned line_size:8;
> +		unsigned lines_per_tag:8;
> +		unsigned assoc:8;
> +		unsigned size_in_kb:8;
>  	};
>  	unsigned val;
>  };
>  
>  union l2_cache {
>  	struct {
> -		unsigned line_size : 8;
> -		unsigned lines_per_tag : 4;
> -		unsigned assoc : 4;
> -		unsigned size_in_kb : 16;
> +		unsigned line_size:8;
> +		unsigned lines_per_tag:4;
> +		unsigned assoc:4;
> +		unsigned size_in_kb:16;
>  	};
>  	unsigned val;
>  };
>  
>  union l3_cache {
>  	struct {
> -		unsigned line_size : 8;
> -		unsigned lines_per_tag : 4;
> -		unsigned assoc : 4;
> -		unsigned res : 2;
> -		unsigned size_encoded : 14;
> +		unsigned line_size:8;
> +		unsigned lines_per_tag:4;
> +		unsigned assoc:4;
> +		unsigned res:2;
> +		unsigned size_encoded:14;
>  	};
>  	unsigned val;
>  };
> @@ -350,7 +350,8 @@ static int __cpuinit find_num_cache_leaves(void)
>  
>  unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  {
> -	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
> +	/* Cache sizes */
> +	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
>  	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
>  	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
>  	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
> @@ -377,8 +378,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  
>  			retval = cpuid4_cache_lookup_regs(i, &this_leaf);
>  			if (retval >= 0) {
> -				switch(this_leaf.eax.split.level) {
> -				    case 1:
> +				switch (this_leaf.eax.split.level) {
> +				case 1:
>  					if (this_leaf.eax.split.type ==
>  							CACHE_TYPE_DATA)
>  						new_l1d = this_leaf.size/1024;
> @@ -386,19 +387,20 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  							CACHE_TYPE_INST)
>  						new_l1i = this_leaf.size/1024;
>  					break;
> -				    case 2:
> +				case 2:
>  					new_l2 = this_leaf.size/1024;
>  					num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
>  					index_msb = get_count_order(num_threads_sharing);
>  					l2_id = c->apicid >> index_msb;
>  					break;
> -				    case 3:
> +				case 3:
>  					new_l3 = this_leaf.size/1024;
>  					num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
> -					index_msb = get_count_order(num_threads_sharing);
> +					index_msb = get_count_order(
> +							num_threads_sharing);
>  					l3_id = c->apicid >> index_msb;
>  					break;
> -				    default:
> +				default:
>  					break;
>  				}
>  			}
> @@ -421,22 +423,21 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  		/* Number of times to iterate */
>  		n = cpuid_eax(2) & 0xFF;
>  
> -		for ( i = 0 ; i < n ; i++ ) {
> +		for (i = 0 ; i < n ; i++) {
>  			cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
>  
>  			/* If bit 31 is set, this is an unknown format */
> -			for ( j = 0 ; j < 3 ; j++ ) {
> -				if (regs[j] & (1 << 31)) regs[j] = 0;
> -			}
> +			for (j = 0 ; j < 3 ; j++)
> +				if (regs[j] & (1 << 31))
> +					regs[j] = 0;
>  
>  			/* Byte 0 is level count, not a descriptor */
> -			for ( j = 1 ; j < 16 ; j++ ) {
> +			for (j = 1 ; j < 16 ; j++) {
>  				unsigned char des = dp[j];
>  				unsigned char k = 0;
>  
>  				/* look up this descriptor in the table */
> -				while (cache_table[k].descriptor != 0)
> -				{
> +				while (cache_table[k].descriptor != 0) {
>  					if (cache_table[k].descriptor == des) {
>  						if (only_trace && cache_table[k].cache_type != LVL_TRACE)
>  							break;
> @@ -488,14 +489,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  	}
>  
>  	if (trace)
> -		printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
> -	else if ( l1i )
> -		printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);
> +		printk(KERN_INFO "CPU: Trace cache: %dK uops", trace);
> +	else if (l1i)
> +		printk(KERN_INFO "CPU: L1 I cache: %dK", l1i);
>  
>  	if (l1d)
> -		printk(", L1 D cache: %dK\n", l1d);
> +		printk(KERN_CONT ", L1 D cache: %dK\n", l1d);
>  	else
> -		printk("\n");
> +		printk(KERN_CONT "\n");
>  
>  	if (l2)
>  		printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
> @@ -558,8 +559,13 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
>  	}
>  }
>  #else
> -static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) {}
> -static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) {}
> +static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
> +{
> +}
> +
> +static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
> +{
> +}
>  #endif
>  
>  static void __cpuinit free_cache_attributes(unsigned int cpu)
> @@ -645,7 +651,7 @@ static DEFINE_PER_CPU(struct _index_kobject *, index_kobject);
>  static ssize_t show_##file_name						\
>  			(struct _cpuid4_info *this_leaf, char *buf)	\
>  {									\
> -	return sprintf (buf, "%lu\n", (unsigned long)this_leaf->object + val); \
> +	return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \
>  }
>  
>  show_one_plus(level, eax.split.level, 0);
> @@ -656,7 +662,7 @@ show_one_plus(number_of_sets, ecx.split.number_of_sets, 1);
>  
>  static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf)
>  {
> -	return sprintf (buf, "%luK\n", this_leaf->size / 1024);
> +	return sprintf(buf, "%luK\n", this_leaf->size / 1024);
>  }
>  
>  static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
> @@ -669,7 +675,7 @@ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
>  		const struct cpumask *mask;
>  
>  		mask = to_cpumask(this_leaf->shared_cpu_map);
> -		n = type?
> +		n = type ?
>  			cpulist_scnprintf(buf, len-2, mask) :
>  			cpumask_scnprintf(buf, len-2, mask);
>  		buf[n++] = '\n';
> @@ -800,7 +806,7 @@ static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644,
>  static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
>  		show_cache_disable_1, store_cache_disable_1);
>  
> -static struct attribute * default_attrs[] = {
> +static struct attribute *default_attrs[] = {
>  	&type.attr,
>  	&level.attr,
>  	&coherency_line_size.attr,
> @@ -815,7 +821,7 @@ static struct attribute * default_attrs[] = {
>  	NULL
>  };
>  
> -static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf)
> +static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf)
>  {
>  	struct _cache_attr *fattr = to_attr(attr);
>  	struct _index_kobject *this_leaf = to_object(kobj);
> @@ -828,8 +834,8 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf)
>  	return ret;
>  }
>  
> -static ssize_t store(struct kobject * kobj, struct attribute * attr,
> -		     const char * buf, size_t count)
> +static ssize_t store(struct kobject *kobj, struct attribute *attr,
> +		     const char *buf, size_t count)
>  {
>  	struct _cache_attr *fattr = to_attr(attr);
>  	struct _index_kobject *this_leaf = to_object(kobj);
> @@ -883,7 +889,7 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
>  		goto err_out;
>  
>  	per_cpu(index_kobject, cpu) = kzalloc(
> -	    sizeof(struct _index_kobject ) * num_cache_leaves, GFP_KERNEL);
> +	    sizeof(struct _index_kobject) * num_cache_leaves, GFP_KERNEL);
>  	if (unlikely(per_cpu(index_kobject, cpu) == NULL))
>  		goto err_out;
>  
> @@ -917,7 +923,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
>  	}
>  
>  	for (i = 0; i < num_cache_leaves; i++) {
> -		this_object = INDEX_KOBJECT_PTR(cpu,i);
> +		this_object = INDEX_KOBJECT_PTR(cpu, i);
>  		this_object->cpu = cpu;
>  		this_object->index = i;
>  		retval = kobject_init_and_add(&(this_object->kobj),
> @@ -925,9 +931,8 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
>  					      per_cpu(cache_kobject, cpu),
>  					      "index%1lu", i);
>  		if (unlikely(retval)) {
> -			for (j = 0; j < i; j++) {
> -				kobject_put(&(INDEX_KOBJECT_PTR(cpu,j)->kobj));
> -			}
> +			for (j = 0; j < i; j++)
> +				kobject_put(&(INDEX_KOBJECT_PTR(cpu, j)->kobj));
>  			kobject_put(per_cpu(cache_kobject, cpu));
>  			cpuid4_cache_sysfs_exit(cpu);
>  			return retval;
> @@ -952,7 +957,7 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
>  	cpumask_clear_cpu(cpu, to_cpumask(cache_dev_map));
>  
>  	for (i = 0; i < num_cache_leaves; i++)
> -		kobject_put(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));
> +		kobject_put(&(INDEX_KOBJECT_PTR(cpu, i)->kobj));
>  	kobject_put(per_cpu(cache_kobject, cpu));
>  	cpuid4_cache_sysfs_exit(cpu);
>  }
> @@ -977,8 +982,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
>  	return NOTIFY_OK;
>  }
>  
> -static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier =
> -{
> +static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = {
>  	.notifier_call = cacheinfo_cpu_callback,
>  };
>  
> diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
> index 5c481f6..8100a29 100644
> --- a/arch/x86/kernel/cpu/perfctr-watchdog.c
> +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
> @@ -68,16 +68,16 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
>  	/* returns the bit offset of the performance counter register */
>  	switch (boot_cpu_data.x86_vendor) {
>  	case X86_VENDOR_AMD:
> -		return (msr - MSR_K7_PERFCTR0);
> +		return msr - MSR_K7_PERFCTR0;
>  	case X86_VENDOR_INTEL:
>  		if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
> -			return (msr - MSR_ARCH_PERFMON_PERFCTR0);
> +			return msr - MSR_ARCH_PERFMON_PERFCTR0;
>  
>  		switch (boot_cpu_data.x86) {
>  		case 6:
> -			return (msr - MSR_P6_PERFCTR0);
> +			return msr - MSR_P6_PERFCTR0;
>  		case 15:
> -			return (msr - MSR_P4_BPU_PERFCTR0);
> +			return msr - MSR_P4_BPU_PERFCTR0;
>  		}
>  	}
>  	return 0;
> @@ -92,16 +92,16 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
>  	/* returns the bit offset of the event selection register */
>  	switch (boot_cpu_data.x86_vendor) {
>  	case X86_VENDOR_AMD:
> -		return (msr - MSR_K7_EVNTSEL0);
> +		return msr - MSR_K7_EVNTSEL0;
>  	case X86_VENDOR_INTEL:
>  		if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
> -			return (msr - MSR_ARCH_PERFMON_EVENTSEL0);
> +			return msr - MSR_ARCH_PERFMON_EVENTSEL0;
>  
>  		switch (boot_cpu_data.x86) {
>  		case 6:
> -			return (msr - MSR_P6_EVNTSEL0);
> +			return msr - MSR_P6_EVNTSEL0;
>  		case 15:
> -			return (msr - MSR_P4_BSU_ESCR0);
> +			return msr - MSR_P4_BSU_ESCR0;
>  		}
>  	}
>  	return 0;
> @@ -113,7 +113,7 @@ int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
>  {
>  	BUG_ON(counter > NMI_MAX_COUNTER_BITS);
>  
> -	return (!test_bit(counter, perfctr_nmi_owner));
> +	return !test_bit(counter, perfctr_nmi_owner);
>  }
>  
>  /* checks the an msr for availability */
> @@ -124,7 +124,7 @@ int avail_to_resrv_perfctr_nmi(unsigned int msr)
>  	counter = nmi_perfctr_msr_to_bit(msr);
>  	BUG_ON(counter > NMI_MAX_COUNTER_BITS);
>  
> -	return (!test_bit(counter, perfctr_nmi_owner));
> +	return !test_bit(counter, perfctr_nmi_owner);
>  }
>  EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit);
>  
> @@ -237,7 +237,7 @@ static unsigned int adjust_for_32bit_ctr(unsigned int hz)
>  	 */
>  	counter_val = (u64)cpu_khz * 1000;
>  	do_div(counter_val, retval);
> - 	if (counter_val > 0x7fffffffULL) {
> +	if (counter_val > 0x7fffffffULL) {
>  		u64 count = (u64)cpu_khz * 1000;
>  		do_div(count, 0x7fffffffUL);
>  		retval = count + 1;
> @@ -251,7 +251,7 @@ static void write_watchdog_counter(unsigned int perfctr_msr,
>  	u64 count = (u64)cpu_khz * 1000;
>  
>  	do_div(count, nmi_hz);
> -	if(descr)
> +	if (descr)
>  		pr_debug("setting %s to -0x%08Lx\n", descr, count);
>  	wrmsrl(perfctr_msr, 0 - count);
>  }
> @@ -262,7 +262,7 @@ static void write_watchdog_counter32(unsigned int perfctr_msr,
>  	u64 count = (u64)cpu_khz * 1000;
>  
>  	do_div(count, nmi_hz);
> -	if(descr)
> +	if (descr)
>  		pr_debug("setting %s to -0x%08Lx\n", descr, count);
>  	wrmsr(perfctr_msr, (u32)(-count), 0);
>  }
> @@ -296,7 +296,7 @@ static int setup_k7_watchdog(unsigned nmi_hz)
>  
>  	/* setup the timer */
>  	wrmsr(evntsel_msr, evntsel, 0);
> -	write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz);
> +	write_watchdog_counter(perfctr_msr, "K7_PERFCTR0", nmi_hz);
>  
>  	/* initialize the wd struct before enabling */
>  	wd->perfctr_msr = perfctr_msr;
> @@ -387,7 +387,7 @@ static int setup_p6_watchdog(unsigned nmi_hz)
>  	/* setup the timer */
>  	wrmsr(evntsel_msr, evntsel, 0);
>  	nmi_hz = adjust_for_32bit_ctr(nmi_hz);
> -	write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz);
> +	write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0", nmi_hz);
>  
>  	/* initialize the wd struct before enabling */
>  	wd->perfctr_msr = perfctr_msr;
> @@ -415,7 +415,7 @@ static void __kprobes p6_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
>  	apic_write(APIC_LVTPC, APIC_DM_NMI);
>  
>  	/* P6/ARCH_PERFMON has 32 bit counter write */
> -	write_watchdog_counter32(wd->perfctr_msr, NULL,nmi_hz);
> +	write_watchdog_counter32(wd->perfctr_msr, NULL, nmi_hz);
>  }
>  
>  static const struct wd_ops p6_wd_ops = {
> @@ -490,9 +490,9 @@ static int setup_p4_watchdog(unsigned nmi_hz)
>  	if (smp_num_siblings == 2) {
>  		unsigned int ebx, apicid;
>  
> -        	ebx = cpuid_ebx(1);
> -	        apicid = (ebx >> 24) & 0xff;
> -        	ht_num = apicid & 1;
> +		ebx = cpuid_ebx(1);
> +		apicid = (ebx >> 24) & 0xff;
> +		ht_num = apicid & 1;
>  	} else
>  #endif
>  		ht_num = 0;
> @@ -544,7 +544,7 @@ static int setup_p4_watchdog(unsigned nmi_hz)
>  	}
>  
>  	evntsel = P4_ESCR_EVENT_SELECT(0x3F)
> -	 	| P4_ESCR_OS
> +		| P4_ESCR_OS
>  		| P4_ESCR_USR;
>  
>  	cccr_val |= P4_CCCR_THRESHOLD(15)
> @@ -612,7 +612,7 @@ static void __kprobes p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
>  {
>  	unsigned dummy;
>  	/*
> - 	 * P4 quirks:
> +	 * P4 quirks:
>  	 * - An overflown perfctr will assert its interrupt
>  	 *   until the OVF flag in its CCCR is cleared.
>  	 * - LVTPC is masked on interrupt and must be
> @@ -662,7 +662,8 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
>  	 * NOTE: Corresponding bit = 0 in ebx indicates event present.
>  	 */
>  	cpuid(10, &(eax.full), &ebx, &unused, &unused);
> -	if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) ||
> +	if ((eax.split.mask_length <
> +			(ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) ||
>  	    (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT))
>  		return 0;
>  
> diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
> index d5e3039..1e90434 100644
> --- a/arch/x86/kernel/cpu/proc.c
> +++ b/arch/x86/kernel/cpu/proc.c
> @@ -128,7 +128,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>  			if (i < ARRAY_SIZE(x86_power_flags) &&
>  			    x86_power_flags[i])
>  				seq_printf(m, "%s%s",
> -					   x86_power_flags[i][0]?" ":"",
> +					   x86_power_flags[i][0] ? " " : "",
>  					   x86_power_flags[i]);
>  			else
>  				seq_printf(m, " [%d]", i);
> diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
> index 284c399..bc24f51 100644
> --- a/arch/x86/kernel/cpu/vmware.c
> +++ b/arch/x86/kernel/cpu/vmware.c
> @@ -49,17 +49,17 @@ static inline int __vmware_platform(void)
>  
>  static unsigned long __vmware_get_tsc_khz(void)
>  {
> -        uint64_t tsc_hz;
> -        uint32_t eax, ebx, ecx, edx;
> +	uint64_t tsc_hz;
> +	uint32_t eax, ebx, ecx, edx;
>  
> -        VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
> +	VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
>  
> -        if (ebx == UINT_MAX)
> -                return 0;
> -        tsc_hz = eax | (((uint64_t)ebx) << 32);
> -        do_div(tsc_hz, 1000);
> -        BUG_ON(tsc_hz >> 32);
> -        return tsc_hz;
> +	if (ebx == UINT_MAX)
> +		return 0;
> +	tsc_hz = eax | (((uint64_t)ebx) << 32);
> +	do_div(tsc_hz, 1000);
> +	BUG_ON(tsc_hz >> 32);
> +	return tsc_hz;
>  }
>  
>  /*
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:x86/cleanups] x86/cpu: Clean up various files a bit
  2009-07-11 11:00                 ` Jaswinder Singh Rajput
@ 2009-07-11 11:09                   ` Jaswinder Singh Rajput
  2009-07-11 14:10                   ` Alan Cox
  1 sibling, 0 replies; 1149+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-11 11:09 UTC (permalink / raw)
  To: mingo; +Cc: hpa, alan, linux-kernel, tglx, mingo, linux-tip-commits

On Sat, 2009-07-11 at 16:30 +0530, Jaswinder Singh Rajput wrote:
> On Sat, 2009-07-11 at 09:57 +0000, tip-bot for Alan Cox wrote:
> > Commit-ID:  8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
> > Gitweb:     http://git.kernel.org/tip/8bdbd962ecfcbdd96f9dbb02d780b4553afd2543
> > Author:     Alan Cox <alan@linux.intel.com>
> > AuthorDate: Sat, 4 Jul 2009 00:35:45 +0100
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 11 Jul 2009 11:24:09 +0200
> > 
> > x86/cpu: Clean up various files a bit
> > 
> > No code changes except printk levels (although some of the K6
> > mtrr code might be clearer if there were a few as would
> > splitting out some of the intel cache code).
> > 
> > Signed-off-by: Alan Cox <alan@linux.intel.com>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > 
> > ---
> >  arch/x86/kernel/cpu/amd.c              |   37 ++++++-----
> >  arch/x86/kernel/cpu/bugs.c             |   10 ++--
> >  arch/x86/kernel/cpu/bugs_64.c          |    2 +-
> >  arch/x86/kernel/cpu/common.c           |    8 +-
> >  arch/x86/kernel/cpu/cyrix.c            |   19 +++--
> >  arch/x86/kernel/cpu/hypervisor.c       |    5 +-
> >  arch/x86/kernel/cpu/intel.c            |   11 ++--
> >  arch/x86/kernel/cpu/intel_cacheinfo.c  |  116 ++++++++++++++++---------------
> >  arch/x86/kernel/cpu/perfctr-watchdog.c |   45 ++++++------
> >  arch/x86/kernel/cpu/proc.c             |    2 +-
> >  arch/x86/kernel/cpu/vmware.c           |   18 +++---
> >  11 files changed, 144 insertions(+), 129 deletions(-)
> > 

> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > index d6f27c9..c96ea44 100644
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -18,8 +18,8 @@
> >  #include <asm/hypervisor.h>
> >  #include <asm/processor.h>
> >  #include <asm/sections.h>
> > -#include <asm/topology.h>
> > -#include <asm/cpumask.h>
> > +#include <linux/topology.h>
> > +#include <linux/cpumask.h>
> 
> ditto
> 

And <linux/cpumask.h> is not replacement of <asm/cpumask.h>

> >  #include <asm/pgtable.h>
> >  #include <asm/atomic.h>
> >  #include <asm/proto.h>
> > @@ -28,13 +28,13 @@
> >  #include <asm/desc.h>
> >  #include <asm/i387.h>
> >  #include <asm/mtrr.h>
> > -#include <asm/numa.h>
> > +#include <linux/numa.h>
> 
> ditto.
> 

And <linux/numa.h> is not replacement of <asm/numa.h>

> >  
> >  #ifdef CONFIG_X86_LOCAL_APIC
> >  #include <asm/uv/uv.h>
> > diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
> > index 593171e..19807b8 100644
> > --- a/arch/x86/kernel/cpu/cyrix.c
> > +++ b/arch/x86/kernel/cpu/cyrix.c
> > @@ -3,10 +3,10 @@
> >  #include <linux/delay.h>
> >  #include <linux/pci.h>
> >  #include <asm/dma.h>
> > -#include <asm/io.h>
> > +#include <linux/io.h>
> >  #include <asm/processor-cyrix.h>
> >  #include <asm/processor-flags.h>
> > -#include <asm/timer.h>
> > +#include <linux/timer.h>


And <linux/timer.h> is not replacement of <asm/timer.h>

Good work, Carry On.

--
JSR


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:x86/cleanups] x86/cpu: Clean up various files a bit
  2009-07-11 11:00                 ` Jaswinder Singh Rajput
  2009-07-11 11:09                   ` Jaswinder Singh Rajput
@ 2009-07-11 14:10                   ` Alan Cox
  1 sibling, 0 replies; 1149+ messages in thread
From: Alan Cox @ 2009-07-11 14:10 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: mingo, hpa, alan, linux-kernel, tglx, mingo, linux-tip-commits

> > No code changes except printk levels (although some of the K6
> > mtrr code might be clearer if there were a few as would
> > splitting out some of the intel cache code).
> > -#include <asm/io.h>
> > +#include <linux/io.h>
> 
> linux/io.h should move to linux/XXX.h block

That would be a code change and potentially a behaviour change - it
should be done but as a later patch. It doesn't help that checkpatch is
buggy here and thinks some stuff is the same which is not.


> >  #if !defined(CONFIG_SMP)
> > -	printk("CPU: ");
> > +	printk(KERN_INFO "CPU: ");
> >  	print_cpu_info(&boot_cpu_data);
> >  #endif
> >  	alternative_instructions();
> 
> I think, these was left intentionally otherwise dmesg output looks
> weird.

Curious. If it is meant to be a continuation it should be KERN_CONT but
that doesn't seem to be the case. No KERN_ is wrong, always.

> >  	 * All current models of Pentium and Pentium with MMX technology CPUs
> > -	 * have the F0 0F bug, which lets nonprivileged users lock up the system.
> > +	 * have the F0 0F bug, which lets nonprivileged users lock up the
> > +	 * system.
> 
> It should be non-privileged

Yes - I agree (or better yet unprivileged)


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter, x86: Extend perf_counter Pentium M support
       [not found]             ` <new-submission>
                                 ` (275 preceding siblings ...)
  2009-07-11  9:57               ` [tip:x86/cleanups] x86/cpu: Clean up various files a bit tip-bot for Alan Cox
@ 2009-07-13  6:49               ` tip-bot for Daniel Qarras
  2009-07-18  9:49               ` [tip:sched/urgent] sched: Account for vruntime wrapping tip-bot for Fabio Checconi
                                 ` (430 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Daniel Qarras @ 2009-07-13  6:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dqarras, hpa, mingo, eranian, a.p.zijlstra, vince,
	tglx, mingo

Commit-ID:  f1c6a58121f9846ac665b0fbd3cbab90ce8bcbac
Gitweb:     http://git.kernel.org/tip/f1c6a58121f9846ac665b0fbd3cbab90ce8bcbac
Author:     Daniel Qarras <dqarras@yahoo.com>
AuthorDate: Sun, 12 Jul 2009 04:32:40 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 13 Jul 2009 08:46:51 +0200

perf_counter, x86: Extend perf_counter Pentium M support

I've attached a patch to remove the Pentium M special casing of
EMON and as noticed at least with my Pentium M the hardware PMU
now works:

 Performance counter stats for '/bin/ls /var/tmp':

       1.809988  task-clock-msecs         #      0.125 CPUs
              1  context-switches         #      0.001 M/sec
              0  CPU-migrations           #	 0.000 M/sec
            224  page-faults              #	 0.124 M/sec
        1425648  cycles                   #    787.656 M/sec
         912755  instructions             #	 0.640 IPC

Vince suggested that this code was trying to address erratum
Y17 in Pentium-M's:

  http://download.intel.com/support/processors/mobile/pm/sb/25266532.pdf

But that erratum (related to IA32_MISC_ENABLES.7) does not
affect perfcounters as we dont use this toggle to disable RDPMC
and WRMSR/RDMSR access to performance counters. We keep cr4's
bit 8 (X86_CR4_PCE) clear so unprivileged RDPMC access is not
allowed anyway.

Cc: Vince Weaver <vince@deater.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index bed1c4c..7e346d4 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1583,10 +1583,8 @@ static int p6_pmu_init(void)
 		break;
 	case 9:
 	case 13:
-		/* for Pentium M, we need to check if PMU exist */
-		rdmsr(MSR_IA32_MISC_ENABLE, low, high);
-		if (low & MSR_IA32_MISC_ENABLE_EMON)
-			break;
+		/* Pentium M */
+		break;
 	default:
 		pr_cont("unsupported p6 CPU model %d ",
 			boot_cpu_data.x86_model);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:sched/urgent] sched: Account for vruntime wrapping
       [not found]             ` <new-submission>
                                 ` (276 preceding siblings ...)
  2009-07-13  6:49               ` [tip:perfcounters/core] perf_counter, x86: Extend perf_counter Pentium M support tip-bot for Daniel Qarras
@ 2009-07-18  9:49               ` tip-bot for Fabio Checconi
  2009-07-21 12:36               ` [tip:irq/urgent] genirq: Delegate irq affinity setting to the irq thread tip-bot for Thomas Gleixner
                                 ` (429 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Fabio Checconi @ 2009-07-18  9:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, fabio, tglx, mingo

Commit-ID:  54fdc5816631b43ba55fc3206d7add2d85850bc6
Gitweb:     http://git.kernel.org/tip/54fdc5816631b43ba55fc3206d7add2d85850bc6
Author:     Fabio Checconi <fabio@gandalf.sssup.it>
AuthorDate: Thu, 16 Jul 2009 12:32:27 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 18 Jul 2009 11:17:08 +0200

sched: Account for vruntime wrapping

I spotted two sites that didn't take vruntime wrap-around into
account. Fix these by creating a comparison helper that does do
so.

Signed-off-by: Fabio Checconi <fabio@gandalf.sssup.it>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched_fair.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 7c248dc..9ffb2b2 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -266,6 +266,12 @@ static inline u64 min_vruntime(u64 min_vruntime, u64 vruntime)
 	return min_vruntime;
 }
 
+static inline int entity_before(struct sched_entity *a,
+				struct sched_entity *b)
+{
+	return (s64)(a->vruntime - b->vruntime) < 0;
+}
+
 static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
 	return se->vruntime - cfs_rq->min_vruntime;
@@ -1017,7 +1023,7 @@ static void yield_task_fair(struct rq *rq)
 	/*
 	 * Already in the rightmost position?
 	 */
-	if (unlikely(!rightmost || rightmost->vruntime < se->vruntime))
+	if (unlikely(!rightmost || entity_before(rightmost, se)))
 		return;
 
 	/*
@@ -1713,7 +1719,7 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
 
 	/* 'curr' will be NULL if the child belongs to a different group */
 	if (sysctl_sched_child_runs_first && this_cpu == task_cpu(p) &&
-			curr && curr->vruntime < se->vruntime) {
+			curr && entity_before(curr, se)) {
 		/*
 		 * Upon rescheduling, sched_class::put_prev_task() will place
 		 * 'current' within the tree based on its new key value.

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:irq/urgent] genirq: Delegate irq affinity setting to the irq thread
       [not found]             ` <new-submission>
                                 ` (277 preceding siblings ...)
  2009-07-18  9:49               ` [tip:sched/urgent] sched: Account for vruntime wrapping tip-bot for Fabio Checconi
@ 2009-07-21 12:36               ` tip-bot for Thomas Gleixner
  2009-07-22 15:15               ` [tip:timers/core] hrtimer: Remove cb_entry from struct hrtimer tip-bot for Peter Zijlstra
                                 ` (428 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-07-21 12:36 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  591d2fb02ea80472d846c0b8507007806bdd69cc
Gitweb:     http://git.kernel.org/tip/591d2fb02ea80472d846c0b8507007806bdd69cc
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 21 Jul 2009 11:09:39 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 21 Jul 2009 14:35:07 +0200

genirq: Delegate irq affinity setting to the irq thread

irq_set_thread_affinity() calls set_cpus_allowed_ptr() which might
sleep, but irq_set_thread_affinity() is called with desc->lock held
and can be called from hard interrupt context as well. The code has
another bug as it does not hold a ref on the task struct as required
by set_cpus_allowed_ptr().

Just set the IRQTF_AFFINITY bit in action->thread_flags. The next time
the thread runs it migrates itself. Solves all of the above problems
nicely.

Add kerneldoc to irq_set_thread_affinity() while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>



---
 include/linux/interrupt.h |    2 +
 kernel/irq/internals.h    |    3 +-
 kernel/irq/manage.c       |   50 +++++++++++++++++++++++++++++++++++++++-----
 kernel/irq/migration.c    |    2 +-
 4 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2721f07..88b056a 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -64,11 +64,13 @@
  * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
  * IRQTF_DIED      - handler thread died
  * IRQTF_WARNED    - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
+ * IRQTF_AFFINITY  - irq thread is requested to adjust affinity
  */
 enum {
 	IRQTF_RUNTHREAD,
 	IRQTF_DIED,
 	IRQTF_WARNED,
+	IRQTF_AFFINITY,
 };
 
 typedef irqreturn_t (*irq_handler_t)(int, void *);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 7346825..e70ed55 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -42,8 +42,7 @@ static inline void unregister_handler_proc(unsigned int irq,
 
 extern int irq_select_affinity_usr(unsigned int irq);
 
-extern void
-irq_set_thread_affinity(struct irq_desc *desc, const struct cpumask *cpumask);
+extern void irq_set_thread_affinity(struct irq_desc *desc);
 
 /*
  * Debugging printout:
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 50da676..f0de36f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -80,14 +80,22 @@ int irq_can_set_affinity(unsigned int irq)
 	return 1;
 }
 
-void
-irq_set_thread_affinity(struct irq_desc *desc, const struct cpumask *cpumask)
+/**
+ *	irq_set_thread_affinity - Notify irq threads to adjust affinity
+ *	@desc:		irq descriptor which has affitnity changed
+ *
+ *	We just set IRQTF_AFFINITY and delegate the affinity setting
+ *	to the interrupt thread itself. We can not call
+ *	set_cpus_allowed_ptr() here as we hold desc->lock and this
+ *	code can be called from hard interrupt context.
+ */
+void irq_set_thread_affinity(struct irq_desc *desc)
 {
 	struct irqaction *action = desc->action;
 
 	while (action) {
 		if (action->thread)
-			set_cpus_allowed_ptr(action->thread, cpumask);
+			set_bit(IRQTF_AFFINITY, &action->thread_flags);
 		action = action->next;
 	}
 }
@@ -112,7 +120,7 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
 	if (desc->status & IRQ_MOVE_PCNTXT) {
 		if (!desc->chip->set_affinity(irq, cpumask)) {
 			cpumask_copy(desc->affinity, cpumask);
-			irq_set_thread_affinity(desc, cpumask);
+			irq_set_thread_affinity(desc);
 		}
 	}
 	else {
@@ -122,7 +130,7 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
 #else
 	if (!desc->chip->set_affinity(irq, cpumask)) {
 		cpumask_copy(desc->affinity, cpumask);
-		irq_set_thread_affinity(desc, cpumask);
+		irq_set_thread_affinity(desc);
 	}
 #endif
 	desc->status |= IRQ_AFFINITY_SET;
@@ -176,7 +184,7 @@ int irq_select_affinity_usr(unsigned int irq)
 	spin_lock_irqsave(&desc->lock, flags);
 	ret = setup_affinity(irq, desc);
 	if (!ret)
-		irq_set_thread_affinity(desc, desc->affinity);
+		irq_set_thread_affinity(desc);
 	spin_unlock_irqrestore(&desc->lock, flags);
 
 	return ret;
@@ -444,6 +452,34 @@ static int irq_wait_for_interrupt(struct irqaction *action)
 }
 
 /*
+ * Check whether we need to change the affinity of the interrupt thread.
+ */
+static void
+irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action)
+{
+	cpumask_var_t mask;
+
+	if (!test_and_clear_bit(IRQTF_AFFINITY, &action->thread_flags))
+		return;
+
+	/*
+	 * In case we are out of memory we set IRQTF_AFFINITY again and
+	 * try again next time
+	 */
+	if (!alloc_cpumask_var(&mask, GFP_KERNEL)) {
+		set_bit(IRQTF_AFFINITY, &action->thread_flags);
+		return;
+	}
+
+	spin_lock_irq(&desc->lock);
+	cpumask_copy(mask, desc->affinity);
+	spin_unlock_irq(&desc->lock);
+
+	set_cpus_allowed_ptr(current, mask);
+	free_cpumask_var(mask);
+}
+
+/*
  * Interrupt handler thread
  */
 static int irq_thread(void *data)
@@ -458,6 +494,8 @@ static int irq_thread(void *data)
 
 	while (!irq_wait_for_interrupt(action)) {
 
+		irq_thread_check_affinity(desc, action);
+
 		atomic_inc(&desc->threads_active);
 
 		spin_lock_irq(&desc->lock);
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index cfe767c..fcb6c96 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -45,7 +45,7 @@ void move_masked_irq(int irq)
 		   < nr_cpu_ids))
 		if (!desc->chip->set_affinity(irq, desc->pending_mask)) {
 			cpumask_copy(desc->affinity, desc->pending_mask);
-			irq_set_thread_affinity(desc, desc->pending_mask);
+			irq_set_thread_affinity(desc);
 		}
 
 	cpumask_clear(desc->pending_mask);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:timers/core] hrtimer: Remove cb_entry from struct hrtimer
       [not found]             ` <new-submission>
                                 ` (278 preceding siblings ...)
  2009-07-21 12:36               ` [tip:irq/urgent] genirq: Delegate irq affinity setting to the irq thread tip-bot for Thomas Gleixner
@ 2009-07-22 15:15               ` tip-bot for Peter Zijlstra
  2009-07-24  6:46               ` [tip:x86/urgent] x86: geode: Mark mfgpt irq IRQF_TIMER to prevent resume failure tip-bot for Thomas Gleixner
                                 ` (427 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-07-22 15:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx

Commit-ID:  fbd90375d7531927d312766b548376d909811b4d
Gitweb:     http://git.kernel.org/tip/fbd90375d7531927d312766b548376d909811b4d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 22 Jul 2009 13:40:14 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 22 Jul 2009 17:12:32 +0200

hrtimer: Remove cb_entry from struct hrtimer

It's unused, remove it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>


---
 include/linux/hrtimer.h |    2 --
 kernel/hrtimer.c        |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 54648e6..40e7d54 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -91,7 +91,6 @@ enum hrtimer_restart {
  * @function:	timer expiry callback function
  * @base:	pointer to the timer base (per cpu and per clock)
  * @state:	state information (See bit values above)
- * @cb_entry:	list head to enqueue an expired timer into the callback list
  * @start_site:	timer statistics field to store the site where the timer
  *		was started
  * @start_comm: timer statistics field to store the name of the process which
@@ -108,7 +107,6 @@ struct hrtimer {
 	enum hrtimer_restart		(*function)(struct hrtimer *);
 	struct hrtimer_clock_base	*base;
 	unsigned long			state;
-	struct list_head		cb_entry;
 #ifdef CONFIG_TIMER_STATS
 	int				start_pid;
 	void				*start_site;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 43d151f..052a0f5 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1092,7 +1092,6 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
 		clock_id = CLOCK_MONOTONIC;
 
 	timer->base = &cpu_base->clock_base[clock_id];
-	INIT_LIST_HEAD(&timer->cb_entry);
 	hrtimer_init_timer_hres(timer);
 
 #ifdef CONFIG_TIMER_STATS

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:x86/urgent] x86: geode: Mark mfgpt irq IRQF_TIMER to prevent resume failure
       [not found]             ` <new-submission>
                                 ` (279 preceding siblings ...)
  2009-07-22 15:15               ` [tip:timers/core] hrtimer: Remove cb_entry from struct hrtimer tip-bot for Peter Zijlstra
@ 2009-07-24  6:46               ` tip-bot for Thomas Gleixner
  2009-08-01 11:22               ` [tip:perfcounters/urgent] perf_counter tools: Fix link errors with older toolchains tip-bot for Ingo Molnar
                                 ` (426 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-07-24  6:46 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, dilinger

Commit-ID:  d6c585a4342a2ff627a29f9aea77c5ed4cd76023
Gitweb:     http://git.kernel.org/tip/d6c585a4342a2ff627a29f9aea77c5ed4cd76023
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 24 Jul 2009 08:34:59 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 24 Jul 2009 08:42:52 +0200

x86: geode: Mark mfgpt irq IRQF_TIMER to prevent resume failure

Timer interrupts are excluded from being disabled during suspend. The
clock events code manages the disabling of clock events on its own
because the timer interrupt needs to be functional before the resume
code reenables the device interrupts.

The mfgpt timer request its interrupt without setting the IRQF_TIMER
flag so suspend_device_irqs() disables it as well which results in a
fatal resume failure.

Adding IRQF_TIMER to the interupt flags when requesting the mrgpt
timer interrupt solves the problem.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Andres Salomon <dilinger@debian.org>
Cc: stable@kernel.org


---
 arch/x86/kernel/mfgpt_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 846510b..2a62d84 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -347,7 +347,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
 
 static struct irqaction mfgptirq  = {
 	.handler = mfgpt_tick,
-	.flags = IRQF_DISABLED | IRQF_NOBALANCING,
+	.flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
 	.name = "mfgpt-timer"
 };
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [patch] perf tools: allow top users to switch between weighted and individual counter display
@ 2009-07-24  8:09 Mike Galbraith
  2009-07-24  8:58 ` Peter Zijlstra
  2009-08-02 13:11 ` [tip:perfcounters/core] perf_counter tools: Allow top users to switch between weighted and individual counter display tip-bot for Mike Galbraith
  0 siblings, 2 replies; 1149+ messages in thread
From: Mike Galbraith @ 2009-07-24  8:09 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Peter Zijlstra

(depends on last resurrect annotation patch)

perf_counter tools: allow top users to switch between weighted and individual counter display.

Add [w]eighted hotkey.  Pressing [w] toggles between displaying weighted total of all counters,
and the counter selected via [E]vent select key.


------------------------------------------------------------------------------
   PerfTop:   90395 irqs/sec  kernel:16.1% [cache-misses/cache-references/instructions],  (all, 4 CPUs)
------------------------------------------------------------------------------

  weight     samples    pcnt         RIP          kernel function
  ______     _______   _____   ________________   _______________

1275408.6      10881 -  5.3% - ffffffff81146f70 : copy_page_c
 553683.4      43569 - 21.3% - ffffffff81146f20 : clear_page_c
  74075.0       6768 -  3.3% - ffffffff81147190 : copy_user_generic_string
  40602.9       7538 -  3.7% - ffffffff81284ba2 : _spin_lock
  26882.1        965 -  0.5% - ffffffff8109d280 : file_ra_state_init

[w]

------------------------------------------------------------------------------
   PerfTop:   91221 irqs/sec  kernel:14.5% [10000Hz cache-misses],  (all, 4 CPUs)
------------------------------------------------------------------------------

  weight     samples    pcnt         RIP          kernel function
  ______     _______   _____   ________________   _______________

            47320.00 - 22.3% - ffffffff81146f20 : clear_page_c
            14261.00 -  6.7% - ffffffff810992f5 : __rmqueue
            11046.00 -  5.2% - ffffffff81146f70 : copy_page_c
             7842.00 -  3.7% - ffffffff81284ba2 : _spin_lock
             7234.00 -  3.4% - ffffffff810aa1d6 : unmap_vmas


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

---
 tools/perf/builtin-top.c |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

Index: linux-2.6/tools/perf/builtin-top.c
===================================================================
--- linux-2.6.orig/tools/perf/builtin-top.c
+++ linux-2.6/tools/perf/builtin-top.c
@@ -90,6 +90,7 @@ static char			*sym_filter			=  NULL;
 struct sym_entry		*sym_filter_entry		=  NULL;
 static int			sym_pcnt_filter			=  5;
 static int			sym_counter			=  0;
+static int			display_weighted		= -1;
 
 /*
  * Symbols
@@ -354,6 +355,9 @@ static double sym_weight(const struct sy
 	double weight = sym->snap_count;
 	int counter;
 
+	if (!display_weighted)
+		return weight;
+
 	for (counter = 1; counter < nr_counters-1; counter++)
 		weight *= sym->count[counter];
 
@@ -401,7 +405,7 @@ static void rb_insert_active_sym(struct
 static void print_sym_table(void)
 {
 	int printed = 0, j;
-	int counter;
+	int counter, snap = !display_weighted ? sym_counter : 0;
 	float samples_per_sec = samples/delay_secs;
 	float ksamples_per_sec = (samples-userspace_samples)/delay_secs;
 	float sum_ksamples = 0.0;
@@ -417,7 +421,7 @@ static void print_sym_table(void)
 	pthread_mutex_unlock(&active_symbols_lock);
 
 	list_for_each_entry_safe_from(syme, n, &active_symbols, node) {
-		syme->snap_count = syme->count[0];
+		syme->snap_count = syme->count[snap];
 		if (syme->snap_count != 0) {
 			syme->weight = sym_weight(syme);
 			rb_insert_active_sym(&tmp, syme);
@@ -437,7 +441,7 @@ static void print_sym_table(void)
 		samples_per_sec,
 		100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
-	if (nr_counters == 1) {
+	if (nr_counters == 1 || !display_weighted) {
 		printf("%Ld", (u64)attrs[0].sample_period);
 		if (freq)
 			printf("Hz ");
@@ -445,7 +449,9 @@ static void print_sym_table(void)
 			printf(" ");
 	}
 
-	for (counter = 0; counter < nr_counters; counter++) {
+	if (!display_weighted)
+		printf("%s", event_name(sym_counter));
+	else for (counter = 0; counter < nr_counters; counter++) {
 		if (counter)
 			printf("/");
 
@@ -495,7 +501,7 @@ static void print_sym_table(void)
 		pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
 					 sum_ksamples));
 
-		if (nr_counters == 1)
+		if (nr_counters == 1 || !display_weighted)
 			printf("%20.2f - ", syme->weight);
 		else
 			printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
@@ -601,13 +607,14 @@ static void print_known_keys(void)
 	fprintf(stdout, "\nknown keys:\n");
 	fprintf(stdout, "\t[d]     display refresh delay.             \t(%d)\n", delay_secs);
 	fprintf(stdout, "\t[e]     display entries (lines).           \t(%d)\n", print_entries);
-	fprintf(stdout, "\t[E]     annotate event counter.            \t(%s)\n", event_name(sym_counter));
+	fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
 	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
 	fprintf(stdout, "\t[F]     annotate display filter (percent). \t(%d%%)\n", sym_pcnt_filter);
 	fprintf(stdout, "\t[qQ]    quit.\n");
 	fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
 	fprintf(stdout, "\t[S]     stop annotation.\n");
-	fprintf(stdout, "\t[z]     toggle count zeroing.              \t(%d)\n", zero ? 1 : 0);
+	fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+	fprintf(stdout, "\t[z]     toggle sample zeroing.             \t(%d)\n", zero ? 1 : 0);
 }
 
 static void handle_keypress(int c)
@@ -663,6 +670,9 @@ repeat:
 				pthread_mutex_unlock(&syme->source_lock);
 			}
 			break;
+		case 'w':
+			display_weighted = ~display_weighted;
+			break;
 		case 'z':
 			zero = ~zero;
 			break;



^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-07-24  8:09 [patch] perf tools: allow top users to switch between weighted and individual counter display Mike Galbraith
@ 2009-07-24  8:58 ` Peter Zijlstra
  2009-07-24 10:37   ` Mike Galbraith
  2009-08-02 13:11 ` [tip:perfcounters/core] perf_counter tools: Allow top users to switch between weighted and individual counter display tip-bot for Mike Galbraith
  1 sibling, 1 reply; 1149+ messages in thread
From: Peter Zijlstra @ 2009-07-24  8:58 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: LKML, Ingo Molnar

On Fri, 2009-07-24 at 10:09 +0200, Mike Galbraith wrote:
> (depends on last resurrect annotation patch)
> 
> perf_counter tools: allow top users to switch between weighted and individual counter display.
> 
> Add [w]eighted hotkey.  Pressing [w] toggles between displaying weighted total of all counters,
> and the counter selected via [E]vent select key.

/me stuck it next to that other one, let see what happens ;-)

Thanks Mike.


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-07-24  8:58 ` Peter Zijlstra
@ 2009-07-24 10:37   ` Mike Galbraith
  2009-08-02 20:00     ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mike Galbraith @ 2009-07-24 10:37 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML, Ingo Molnar

On Fri, 2009-07-24 at 10:58 +0200, Peter Zijlstra wrote:
> On Fri, 2009-07-24 at 10:09 +0200, Mike Galbraith wrote:
> > (depends on last resurrect annotation patch)
> > 
> > perf_counter tools: allow top users to switch between weighted and individual counter display.
> > 
> > Add [w]eighted hotkey.  Pressing [w] toggles between displaying weighted total of all counters,
> > and the counter selected via [E]vent select key.
> 
> /me stuck it next to that other one, let see what happens ;-)

(plugs in Bitwolf-9000 charger)


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Fix link errors with older toolchains
       [not found]             ` <new-submission>
                                 ` (280 preceding siblings ...)
  2009-07-24  6:46               ` [tip:x86/urgent] x86: geode: Mark mfgpt irq IRQF_TIMER to prevent resume failure tip-bot for Thomas Gleixner
@ 2009-08-01 11:22               ` tip-bot for Ingo Molnar
  2009-08-02 13:03               ` [tip:core/locking] lockdep: Fix BFS build tip-bot for Ingo Molnar
                                 ` (425 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-01 11:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  2d1b6949d2c855f195de0f5146625015ecca3944
Gitweb:     http://git.kernel.org/tip/2d1b6949d2c855f195de0f5146625015ecca3944
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 1 Aug 2009 13:15:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 1 Aug 2009 13:15:36 +0200

perf_counter tools: Fix link errors with older toolchains

On older distros (F8 for example) the perf build could fail
with such missing symbols:

    LINK perf
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/../../../../lib64/libbfd.a(bfd.o): In function `bfd_demangle':
(.text+0x2b3): undefined reference to `cplus_demangle'
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/../../../../lib64/libbfd.a(bfd.o): In function `bfd_demangle':

Link in -liberty too.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a5e9b87..4b20fa4 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -345,7 +345,7 @@ BUILTIN_OBJS += builtin-stat.o
 BUILTIN_OBJS += builtin-top.o
 
 PERFLIBS = $(LIB_FILE)
-EXTLIBS = -lbfd
+EXTLIBS = -lbfd -liberty
 
 #
 # Platform specific tweaks

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/locking] lockdep: Fix BFS build
       [not found]             ` <new-submission>
                                 ` (281 preceding siblings ...)
  2009-08-01 11:22               ` [tip:perfcounters/urgent] perf_counter tools: Fix link errors with older toolchains tip-bot for Ingo Molnar
@ 2009-08-02 13:03               ` tip-bot for Ingo Molnar
  2009-08-02 13:09               ` [tip:core/debug] debug lockups: Improve lockup detection tip-bot for Ingo Molnar
                                 ` (424 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-02 13:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, tom.leiming, mingo

Commit-ID:  bbfa26229a8143889e95e0df4a9d69067ee836cd
Gitweb:     http://git.kernel.org/tip/bbfa26229a8143889e95e0df4a9d69067ee836cd
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 2 Aug 2009 14:44:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 14:51:06 +0200

lockdep: Fix BFS build

Fix:

  kernel/built-in.o: In function `lockdep_stats_show':
  lockdep_proc.c:(.text+0x48202): undefined reference to `max_bfs_queue_depth'

As max_bfs_queue_depth is only available under
CONFIG_PROVE_LOCKING=y.

Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/lockdep_proc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index 9a1bf34..fba81f1 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -411,8 +411,10 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
 			max_lockdep_depth);
 	seq_printf(m, " max recursion depth:           %11u\n",
 			max_recursion_depth);
+#ifdef CONFIG_PROVE_LOCKING
 	seq_printf(m, " max bfs queue depth:           %11u\n",
 			max_bfs_queue_depth);
+#endif
 	lockdep_stats_debug_show(m);
 	seq_printf(m, " debug_locks:                   %11u\n",
 			debug_locks);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:core/debug] debug lockups: Improve lockup detection
       [not found]             ` <new-submission>
                                 ` (282 preceding siblings ...)
  2009-08-02 13:03               ` [tip:core/locking] lockdep: Fix BFS build tip-bot for Ingo Molnar
@ 2009-08-02 13:09               ` tip-bot for Ingo Molnar
  2009-08-02 17:18                 ` Paul E. McKenney
  2009-08-02 18:45                 ` Andrew Morton
  2009-08-02 13:10               ` [tip:perfcounters/core] perf_counter: Collapse inherit on read() tip-bot for Peter Zijlstra
                                 ` (423 subsequent siblings)
  707 siblings, 2 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-02 13:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, a.p.zijlstra, paulmck, akpm,
	tglx, mingo

Commit-ID:  c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
Gitweb:     http://git.kernel.org/tip/c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 2 Aug 2009 11:28:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 13:27:17 +0200

debug lockups: Improve lockup detection

When debugging a recent lockup bug i found various deficiencies
in how our current lockup detection helpers work:

 - SysRq-L is not very efficient as it uses a workqueue, hence
   it cannot punch through hard lockups and cannot see through
   most soft lockups either.

 - The SysRq-L code depends on the NMI watchdog - which is off
   by default.

 - We dont print backtraces from the RCU code's built-in
   'RCU state machine is stuck' debug code. This debug
   code tends to be one of the first (and only) mechanisms
   that show that a lockup has occured.

This patch changes the code so taht we:

 - Trigger the NMI backtrace code from SysRq-L instead of using
   a workqueue (which cannot punch through hard lockups)

 - Trigger print-all-CPU-backtraces from the RCU lockup detection
   code

Also decouple the backtrace printing code from the NMI watchdog:

 - Dont use variable size cpumasks (it might not be initialized
   and they are a bit more fragile anyway)

 - Trigger an NMI immediately via an IPI, instead of waiting
   for the NMI tick to occur. This is a lot faster and can
   produce more relevant backtraces. It will also work if the
   NMI watchdog is disabled.

 - Dont print the 'dazed and confused' message when we print
   a backtrace from the NMI

 - Do a show_regs() plus a dump_stack() to get maximum info
   out of the dump. Worst-case we get two stacktraces - which
   is not a big deal. Sometimes, if register content is
   corrupted, the precise stack walker in show_regs() wont
   give us a full backtrace - in this case dump_stack() will
   do it.

Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/apic/nmi.c |   18 ++++++++++++------
 drivers/char/sysrq.c       |    8 ++------
 kernel/rcutree.c           |    7 ++++++-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index b3025b4..1bb1ac2 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -39,7 +39,7 @@
 int unknown_nmi_panic;
 int nmi_watchdog_enabled;
 
-static cpumask_var_t backtrace_mask;
+static cpumask_t backtrace_mask __read_mostly;
 
 /* nmi_active:
  * >0: the lapic NMI watchdog is active, but can be disabled
@@ -138,7 +138,6 @@ int __init check_nmi_watchdog(void)
 	if (!prev_nmi_count)
 		goto error;
 
-	alloc_cpumask_var(&backtrace_mask, GFP_KERNEL|__GFP_ZERO);
 	printk(KERN_INFO "Testing NMI watchdog ... ");
 
 #ifdef CONFIG_SMP
@@ -415,14 +414,17 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
 	}
 
 	/* We can be called before check_nmi_watchdog, hence NULL check. */
-	if (backtrace_mask != NULL && cpumask_test_cpu(cpu, backtrace_mask)) {
+	if (cpumask_test_cpu(cpu, &backtrace_mask)) {
 		static DEFINE_SPINLOCK(lock);	/* Serialise the printks */
 
 		spin_lock(&lock);
 		printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
+		show_regs(regs);
 		dump_stack();
 		spin_unlock(&lock);
-		cpumask_clear_cpu(cpu, backtrace_mask);
+		cpumask_clear_cpu(cpu, &backtrace_mask);
+
+		rc = 1;
 	}
 
 	/* Could check oops_in_progress here too, but it's safer not to */
@@ -556,10 +558,14 @@ void __trigger_all_cpu_backtrace(void)
 {
 	int i;
 
-	cpumask_copy(backtrace_mask, cpu_online_mask);
+	cpumask_copy(&backtrace_mask, cpu_online_mask);
+
+	printk(KERN_INFO "sending NMI to all CPUs:\n");
+	apic->send_IPI_all(NMI_VECTOR);
+
 	/* Wait for up to 10 seconds for all CPUs to do the backtrace */
 	for (i = 0; i < 10 * 1000; i++) {
-		if (cpumask_empty(backtrace_mask))
+		if (cpumask_empty(&backtrace_mask))
 			break;
 		mdelay(1);
 	}
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 5d7a02f..165f307 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -24,6 +24,7 @@
 #include <linux/sysrq.h>
 #include <linux/kbd_kern.h>
 #include <linux/proc_fs.h>
+#include <linux/nmi.h>
 #include <linux/quotaops.h>
 #include <linux/perf_counter.h>
 #include <linux/kernel.h>
@@ -222,12 +223,7 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
 
 static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
 {
-	struct pt_regs *regs = get_irq_regs();
-	if (regs) {
-		printk(KERN_INFO "CPU%d:\n", smp_processor_id());
-		show_regs(regs);
-	}
-	schedule_work(&sysrq_showallcpus);
+	trigger_all_cpu_backtrace();
 }
 
 static struct sysrq_key_op sysrq_showallcpus_op = {
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 7717b95..9c5fa9f 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -35,6 +35,7 @@
 #include <linux/rcupdate.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
+#include <linux/nmi.h>
 #include <asm/atomic.h>
 #include <linux/bitops.h>
 #include <linux/module.h>
@@ -469,6 +470,8 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 	}
 	printk(" (detected by %d, t=%ld jiffies)\n",
 	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
+	trigger_all_cpu_backtrace();
+
 	force_quiescent_state(rsp, 0);  /* Kick them all. */
 }
 
@@ -479,12 +482,14 @@ static void print_cpu_stall(struct rcu_state *rsp)
 
 	printk(KERN_ERR "INFO: RCU detected CPU %d stall (t=%lu jiffies)\n",
 			smp_processor_id(), jiffies - rsp->gp_start);
-	dump_stack();
+	trigger_all_cpu_backtrace();
+
 	spin_lock_irqsave(&rnp->lock, flags);
 	if ((long)(jiffies - rsp->jiffies_stall) >= 0)
 		rsp->jiffies_stall =
 			jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
 	spin_unlock_irqrestore(&rnp->lock, flags);
+
 	set_need_resched();  /* kick ourselves to get things going. */
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter: Collapse inherit on read()
       [not found]             ` <new-submission>
                                 ` (283 preceding siblings ...)
  2009-08-02 13:09               ` [tip:core/debug] debug lockups: Improve lockup detection tip-bot for Ingo Molnar
@ 2009-08-02 13:10               ` tip-bot for Peter Zijlstra
  2009-08-02 13:13               ` [tip:sched/core] sched: Add debug check to task_of() tip-bot for Peter Zijlstra
                                 ` (422 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-02 13:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, cjashfor, mingo

Commit-ID:  e53c0994709166b111fbe9162d1a16ece7dfc45b
Gitweb:     http://git.kernel.org/tip/e53c0994709166b111fbe9162d1a16ece7dfc45b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 24 Jul 2009 14:42:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 13:47:54 +0200

perf_counter: Collapse inherit on read()

Currently the counter value returned by read() is the value of
the parent counter, to which child counters are only fed back
on child exit.

Thus read() can return rather erratic (and meaningless) numbers
depending on the state of the child processes.

Change this by always iterating the full child hierarchy on
read() and sum all counters.

Suggested-by: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/perf_counter.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 9509310..48471d7 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1688,6 +1688,18 @@ static int perf_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
+static u64 perf_counter_read_tree(struct perf_counter *counter)
+{
+	struct perf_counter *child;
+	u64 total = 0;
+
+	total += perf_counter_read(counter);
+	list_for_each_entry(child, &counter->child_list, child_list)
+		total += perf_counter_read(child);
+
+	return total;
+}
+
 /*
  * Read the performance counter - simple non blocking version for now
  */
@@ -1707,7 +1719,7 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
 
 	WARN_ON_ONCE(counter->ctx->parent_ctx);
 	mutex_lock(&counter->child_mutex);
-	values[0] = perf_counter_read(counter);
+	values[0] = perf_counter_read_tree(counter);
 	n = 1;
 	if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
 		values[n++] = counter->total_time_enabled +

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:perfcounters/core] perf_counter tools: Allow top users to switch between weighted and individual counter display
  2009-07-24  8:09 [patch] perf tools: allow top users to switch between weighted and individual counter display Mike Galbraith
  2009-07-24  8:58 ` Peter Zijlstra
@ 2009-08-02 13:11 ` tip-bot for Mike Galbraith
  1 sibling, 0 replies; 1149+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-08-02 13:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  5cb1a23a1019ce4a4b2596ba53ebb86536680d02
Gitweb:     http://git.kernel.org/tip/5cb1a23a1019ce4a4b2596ba53ebb86536680d02
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 24 Jul 2009 10:09:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 14:01:43 +0200

perf_counter tools: Allow top users to switch between weighted and individual counter display

Add [w]eighted hotkey.  Pressing [w] toggles between displaying
weighted total of all counters, and the counter selected via
[E]vent select key.

------------------------------------------------------------------------------
   PerfTop:   90395 irqs/sec  kernel:16.1% [cache-misses/cache-references/instructions],  (all, 4 CPUs)
------------------------------------------------------------------------------

  weight     samples    pcnt         RIP          kernel function
  ______     _______   _____   ________________   _______________

1275408.6      10881 -  5.3% - ffffffff81146f70 : copy_page_c
 553683.4      43569 - 21.3% - ffffffff81146f20 : clear_page_c
  74075.0       6768 -  3.3% - ffffffff81147190 : copy_user_generic_string
  40602.9       7538 -  3.7% - ffffffff81284ba2 : _spin_lock
  26882.1        965 -  0.5% - ffffffff8109d280 : file_ra_state_init

[w]

------------------------------------------------------------------------------
   PerfTop:   91221 irqs/sec  kernel:14.5% [10000Hz cache-misses],  (all, 4 CPUs)
------------------------------------------------------------------------------

  weight     samples    pcnt         RIP          kernel function
  ______     _______   _____   ________________   _______________

            47320.00 - 22.3% - ffffffff81146f20 : clear_page_c
            14261.00 -  6.7% - ffffffff810992f5 : __rmqueue
            11046.00 -  5.2% - ffffffff81146f70 : copy_page_c
             7842.00 -  3.7% - ffffffff81284ba2 : _spin_lock
             7234.00 -  3.4% - ffffffff810aa1d6 : unmap_vmas

Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1248422990.28486.3.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-top.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index d587013..4eef346 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -90,6 +90,7 @@ static char			*sym_filter			=  NULL;
 struct sym_entry		*sym_filter_entry		=  NULL;
 static int			sym_pcnt_filter			=  5;
 static int			sym_counter			=  0;
+static int			display_weighted		= -1;
 
 /*
  * Symbols
@@ -354,6 +355,9 @@ static double sym_weight(const struct sym_entry *sym)
 	double weight = sym->snap_count;
 	int counter;
 
+	if (!display_weighted)
+		return weight;
+
 	for (counter = 1; counter < nr_counters-1; counter++)
 		weight *= sym->count[counter];
 
@@ -401,7 +405,7 @@ static void rb_insert_active_sym(struct rb_root *tree, struct sym_entry *se)
 static void print_sym_table(void)
 {
 	int printed = 0, j;
-	int counter;
+	int counter, snap = !display_weighted ? sym_counter : 0;
 	float samples_per_sec = samples/delay_secs;
 	float ksamples_per_sec = (samples-userspace_samples)/delay_secs;
 	float sum_ksamples = 0.0;
@@ -417,7 +421,7 @@ static void print_sym_table(void)
 	pthread_mutex_unlock(&active_symbols_lock);
 
 	list_for_each_entry_safe_from(syme, n, &active_symbols, node) {
-		syme->snap_count = syme->count[0];
+		syme->snap_count = syme->count[snap];
 		if (syme->snap_count != 0) {
 			syme->weight = sym_weight(syme);
 			rb_insert_active_sym(&tmp, syme);
@@ -437,7 +441,7 @@ static void print_sym_table(void)
 		samples_per_sec,
 		100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));
 
-	if (nr_counters == 1) {
+	if (nr_counters == 1 || !display_weighted) {
 		printf("%Ld", (u64)attrs[0].sample_period);
 		if (freq)
 			printf("Hz ");
@@ -445,7 +449,9 @@ static void print_sym_table(void)
 			printf(" ");
 	}
 
-	for (counter = 0; counter < nr_counters; counter++) {
+	if (!display_weighted)
+		printf("%s", event_name(sym_counter));
+	else for (counter = 0; counter < nr_counters; counter++) {
 		if (counter)
 			printf("/");
 
@@ -495,7 +501,7 @@ static void print_sym_table(void)
 		pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
 					 sum_ksamples));
 
-		if (nr_counters == 1)
+		if (nr_counters == 1 || !display_weighted)
 			printf("%20.2f - ", syme->weight);
 		else
 			printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
@@ -594,13 +600,14 @@ static void print_known_keys(void)
 	fprintf(stdout, "\nknown keys:\n");
 	fprintf(stdout, "\t[d]     select display delay.\n");
 	fprintf(stdout, "\t[e]     select display entries (lines).\n");
-	fprintf(stdout, "\t[E]     select annotation event counter.\n");
+	fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
 	fprintf(stdout, "\t[f]     select normal display count filter.\n");
 	fprintf(stdout, "\t[F]     select annotation display count filter (percentage).\n");
 	fprintf(stdout, "\t[qQ]    quit.\n");
 	fprintf(stdout, "\t[s]     select annotation symbol and start annotation.\n");
 	fprintf(stdout, "\t[S]     stop annotation, revert to normal display.\n");
-	fprintf(stdout, "\t[z]     toggle event count zeroing.\n");
+	fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+	fprintf(stdout, "\t[z]     toggle sample zeroing.             \t(%d)\n", zero ? 1 : 0);
 }
 
 static void handle_keypress(int c)
@@ -656,6 +663,9 @@ repeat:
 				pthread_mutex_unlock(&syme->source_lock);
 			}
 			break;
+		case 'w':
+			display_weighted = ~display_weighted;
+			break;
 		case 'z':
 			zero = ~zero;
 			break;

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* [tip:sched/core] sched: Add debug check to task_of()
       [not found]             ` <new-submission>
                                 ` (284 preceding siblings ...)
  2009-08-02 13:10               ` [tip:perfcounters/core] perf_counter: Collapse inherit on read() tip-bot for Peter Zijlstra
@ 2009-08-02 13:13               ` tip-bot for Peter Zijlstra
  2009-08-02 18:36               ` [tip:core/rcu] rcu: Fix RCU & CPU hotplug hang tip-bot for Paul E. McKenney
                                 ` (421 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-02 13:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8f48894fcc89ddec62e1762f73a0825793e59e91
Gitweb:     http://git.kernel.org/tip/8f48894fcc89ddec62e1762f73a0825793e59e91
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 24 Jul 2009 12:25:30 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 14:26:14 +0200

sched: Add debug check to task_of()

A frequent mistake appears to be to call task_of() on a
scheduler entity that is not actually a task, which can result
in a wild pointer.

Add a check to catch these mistakes.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched_fair.c |   20 ++++++++++++++------
 kernel/sched_rt.c   |   16 ++++++++++++----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 4934729..342000b 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -79,11 +79,6 @@ static const struct sched_class fair_sched_class;
  * CFS operations on generic schedulable entities:
  */
 
-static inline struct task_struct *task_of(struct sched_entity *se)
-{
-	return container_of(se, struct task_struct, se);
-}
-
 #ifdef CONFIG_FAIR_GROUP_SCHED
 
 /* cpu runqueue to which this cfs_rq is attached */
@@ -95,6 +90,14 @@ static inline struct rq *rq_of(struct cfs_rq *cfs_rq)
 /* An entity is a task if it doesn't "own" a runqueue */
 #define entity_is_task(se)	(!se->my_q)
 
+static inline struct task_struct *task_of(struct sched_entity *se)
+{
+#ifdef CONFIG_SCHED_DEBUG
+	WARN_ON_ONCE(!entity_is_task(se));
+#endif
+	return container_of(se, struct task_struct, se);
+}
+
 /* Walk up scheduling entities hierarchy */
 #define for_each_sched_entity(se) \
 		for (; se; se = se->parent)
@@ -186,7 +189,12 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse)
 	}
 }
 
-#else	/* CONFIG_FAIR_GROUP_SCHED */
+#else	/* !CONFIG_FAIR_GROUP_SCHED */
+
+static inline struct task_struct *task_of(struct sched_entity *se)
+{
+	return container_of(se, struct task_struct, se);
+}
 
 static inline struct rq *rq_of(struct cfs_rq *cfs_rq)
 {
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 13f728e..f365e66 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -3,15 +3,18 @@
  * policies)
  */
 
+#ifdef CONFIG_RT_GROUP_SCHED
+
+#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
+
 static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
 {
+#ifdef CONFIG_SCHED_DEBUG
+	WARN_ON_ONCE(!rt_entity_is_task(rt_se));
+#endif
 	return container_of(rt_se, struct task_struct, rt);
 }
 
-#ifdef CONFIG_RT_GROUP_SCHED
-
-#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
-
 static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
 {
 	return rt_rq->rq;
@@ -26,6 +29,11 @@ static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
 
 #define rt_entity_is_task(rt_se) (1)
 
+static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
+{
+	return container_of(rt_se, struct task_struct, rt);
+}
+
 static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
 {
 	return container_of(rt_rq, struct rq, rt);

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 13:09               ` [tip:core/debug] debug lockups: Improve lockup detection tip-bot for Ingo Molnar
@ 2009-08-02 17:18                 ` Paul E. McKenney
  2009-08-02 18:45                 ` Andrew Morton
  1 sibling, 0 replies; 1149+ messages in thread
From: Paul E. McKenney @ 2009-08-02 17:18 UTC (permalink / raw)
  To: tip-bot for Ingo Molnar
  Cc: linux-tip-commits, linux-kernel, hpa, mingo, torvalds,
	a.p.zijlstra, akpm, tglx

On Sun, Aug 02, 2009 at 01:09:34PM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> Gitweb:     http://git.kernel.org/tip/c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sun, 2 Aug 2009 11:28:21 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 2 Aug 2009 13:27:17 +0200
> 
> debug lockups: Improve lockup detection
> 
> When debugging a recent lockup bug i found various deficiencies
> in how our current lockup detection helpers work:
> 
>  - SysRq-L is not very efficient as it uses a workqueue, hence
>    it cannot punch through hard lockups and cannot see through
>    most soft lockups either.
> 
>  - The SysRq-L code depends on the NMI watchdog - which is off
>    by default.
> 
>  - We dont print backtraces from the RCU code's built-in
>    'RCU state machine is stuck' debug code. This debug
>    code tends to be one of the first (and only) mechanisms
>    that show that a lockup has occured.
> 
> This patch changes the code so taht we:
> 
>  - Trigger the NMI backtrace code from SysRq-L instead of using
>    a workqueue (which cannot punch through hard lockups)
> 
>  - Trigger print-all-CPU-backtraces from the RCU lockup detection
>    code
> 
> Also decouple the backtrace printing code from the NMI watchdog:
> 
>  - Dont use variable size cpumasks (it might not be initialized
>    and they are a bit more fragile anyway)
> 
>  - Trigger an NMI immediately via an IPI, instead of waiting
>    for the NMI tick to occur. This is a lot faster and can
>    produce more relevant backtraces. It will also work if the
>    NMI watchdog is disabled.
> 
>  - Dont print the 'dazed and confused' message when we print
>    a backtrace from the NMI
> 
>  - Do a show_regs() plus a dump_stack() to get maximum info
>    out of the dump. Worst-case we get two stacktraces - which
>    is not a big deal. Sometimes, if register content is
>    corrupted, the precise stack walker in show_regs() wont
>    give us a full backtrace - in this case dump_stack() will
>    do it.

Looks good from an RCU perspective!  I will need to dump task stacks
in the new version.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  arch/x86/kernel/apic/nmi.c |   18 ++++++++++++------
>  drivers/char/sysrq.c       |    8 ++------
>  kernel/rcutree.c           |    7 ++++++-
>  3 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
> index b3025b4..1bb1ac2 100644
> --- a/arch/x86/kernel/apic/nmi.c
> +++ b/arch/x86/kernel/apic/nmi.c
> @@ -39,7 +39,7 @@
>  int unknown_nmi_panic;
>  int nmi_watchdog_enabled;
> 
> -static cpumask_var_t backtrace_mask;
> +static cpumask_t backtrace_mask __read_mostly;
> 
>  /* nmi_active:
>   * >0: the lapic NMI watchdog is active, but can be disabled
> @@ -138,7 +138,6 @@ int __init check_nmi_watchdog(void)
>  	if (!prev_nmi_count)
>  		goto error;
> 
> -	alloc_cpumask_var(&backtrace_mask, GFP_KERNEL|__GFP_ZERO);
>  	printk(KERN_INFO "Testing NMI watchdog ... ");
> 
>  #ifdef CONFIG_SMP
> @@ -415,14 +414,17 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
>  	}
> 
>  	/* We can be called before check_nmi_watchdog, hence NULL check. */
> -	if (backtrace_mask != NULL && cpumask_test_cpu(cpu, backtrace_mask)) {
> +	if (cpumask_test_cpu(cpu, &backtrace_mask)) {
>  		static DEFINE_SPINLOCK(lock);	/* Serialise the printks */
> 
>  		spin_lock(&lock);
>  		printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
> +		show_regs(regs);
>  		dump_stack();
>  		spin_unlock(&lock);
> -		cpumask_clear_cpu(cpu, backtrace_mask);
> +		cpumask_clear_cpu(cpu, &backtrace_mask);
> +
> +		rc = 1;
>  	}
> 
>  	/* Could check oops_in_progress here too, but it's safer not to */
> @@ -556,10 +558,14 @@ void __trigger_all_cpu_backtrace(void)
>  {
>  	int i;
> 
> -	cpumask_copy(backtrace_mask, cpu_online_mask);
> +	cpumask_copy(&backtrace_mask, cpu_online_mask);
> +
> +	printk(KERN_INFO "sending NMI to all CPUs:\n");
> +	apic->send_IPI_all(NMI_VECTOR);
> +
>  	/* Wait for up to 10 seconds for all CPUs to do the backtrace */
>  	for (i = 0; i < 10 * 1000; i++) {
> -		if (cpumask_empty(backtrace_mask))
> +		if (cpumask_empty(&backtrace_mask))
>  			break;
>  		mdelay(1);
>  	}
> diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
> index 5d7a02f..165f307 100644
> --- a/drivers/char/sysrq.c
> +++ b/drivers/char/sysrq.c
> @@ -24,6 +24,7 @@
>  #include <linux/sysrq.h>
>  #include <linux/kbd_kern.h>
>  #include <linux/proc_fs.h>
> +#include <linux/nmi.h>
>  #include <linux/quotaops.h>
>  #include <linux/perf_counter.h>
>  #include <linux/kernel.h>
> @@ -222,12 +223,7 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
> 
>  static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
>  {
> -	struct pt_regs *regs = get_irq_regs();
> -	if (regs) {
> -		printk(KERN_INFO "CPU%d:\n", smp_processor_id());
> -		show_regs(regs);
> -	}
> -	schedule_work(&sysrq_showallcpus);
> +	trigger_all_cpu_backtrace();
>  }
> 
>  static struct sysrq_key_op sysrq_showallcpus_op = {
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 7717b95..9c5fa9f 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -35,6 +35,7 @@
>  #include <linux/rcupdate.h>
>  #include <linux/interrupt.h>
>  #include <linux/sched.h>
> +#include <linux/nmi.h>
>  #include <asm/atomic.h>
>  #include <linux/bitops.h>
>  #include <linux/module.h>
> @@ -469,6 +470,8 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
>  	}
>  	printk(" (detected by %d, t=%ld jiffies)\n",
>  	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
> +	trigger_all_cpu_backtrace();
> +
>  	force_quiescent_state(rsp, 0);  /* Kick them all. */
>  }
> 
> @@ -479,12 +482,14 @@ static void print_cpu_stall(struct rcu_state *rsp)
> 
>  	printk(KERN_ERR "INFO: RCU detected CPU %d stall (t=%lu jiffies)\n",
>  			smp_processor_id(), jiffies - rsp->gp_start);
> -	dump_stack();
> +	trigger_all_cpu_backtrace();
> +
>  	spin_lock_irqsave(&rnp->lock, flags);
>  	if ((long)(jiffies - rsp->jiffies_stall) >= 0)
>  		rsp->jiffies_stall =
>  			jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
>  	spin_unlock_irqrestore(&rnp->lock, flags);
> +
>  	set_need_resched();  /* kick ourselves to get things going. */
>  }
> 

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:core/rcu] rcu: Fix RCU & CPU hotplug hang
       [not found]             ` <new-submission>
                                 ` (285 preceding siblings ...)
  2009-08-02 13:13               ` [tip:sched/core] sched: Add debug check to task_of() tip-bot for Peter Zijlstra
@ 2009-08-02 18:36               ` tip-bot for Paul E. McKenney
  2009-08-02 19:40               ` [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race tip-bot for Paul E. McKenney
                                 ` (420 subsequent siblings)
  707 siblings, 0 replies; 1149+ messages in thread
From: tip-bot for Paul E. McKenney @ 2009-08-02 18:36 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, paulmck, hpa, mingo, tglx, mingo

Commit-ID:  04b06256ccdd0af50ece04530f7dde0f81aa8f46
Gitweb:     http://git.kernel.org/tip/04b06256ccdd0af50ece04530f7dde0f81aa8f46
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Fri, 31 Jul 2009 23:25:50 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 16:08:47 +0200

rcu: Fix RCU & CPU hotplug hang

This patch divides the rcutree initialization into boot-time and
hotplug-time components, so that the tree data structures are guaranteed
to be fully linked at boot time regardless of what might happen in CPU
hotplug operations.

This should prevent the noted panic, but then again so should the
pre-patch setup...

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/rcupdate.c   |   12 +++++++++-
 kernel/rcupreempt.c |    9 -------
 kernel/rcutree.c    |   62 +++++++++++++++++++++++++++-----------------------
 3 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 3fea910..9f0584e 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -248,8 +248,18 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 
 void __init rcu_init(void)
 {
-	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+	int i;
+
 	__rcu_init();
+	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+
+	/*
+	 * We don't need protection against CPU-hotplug here because
+	 * this is called early in boot, before either interrupts
+	 * or the scheduler are operational.
+	 */
+	for_each_online_cpu(i)
+		rcu_barrier_cpu_hotplug(NULL, CPU_UP_PREPARE, (void *)(long)i);
 }
 
 void rcu_scheduler_starting(void)
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c
index 4300212..5948353 100644
--- a/kernel/rcupreempt.c
+++ b/kernel/rcupreempt.c
@@ -1467,15 +1467,6 @@ void __init __rcu_init(void)
 		rdp->waitschedtail = &rdp->waitschedlist;
 		rdp->rcu_sched_sleeping = 0;
 	}
-
-	/*
-	 * We don't need protection against CPU-hotplug here because
-	 * this is called early in boot, before either interrupts
-	 * or the scheduler are operational.
-	 */
-	for_each_online_cpu(cpu)
-		rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long) cpu);
-
 	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
 }
 
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index e8e9e93..3313244 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1325,22 +1325,40 @@ int rcu_needs_cpu(int cpu)
 }
 
 /*
- * Initialize a CPU's per-CPU RCU data.  We take this "scorched earth"
- * approach so that we don't have to worry about how long the CPU has
- * been gone, or whether it ever was online previously.  We do trust the
- * ->mynode field, as it is constant for a given struct rcu_data and
- * initialized during early boot.
- *
- * Note that only one online or offline event can be happening at a given
- * time.  Note also that we can accept some slop in the rsp->completed
- * access due to the fact that this CPU cannot possibly have any RCU
- * callbacks in flight yet.
+ * Do boot-time initialization of a CPU's per-CPU RCU data.
+ */
+static void __init
+rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp)
+{
+	unsigned long flags;
+	int i;
+	struct rcu_data *rdp = rsp->rda[cpu];
+	struct rcu_node *rnp = rcu_get_root(rsp);
+
+	/* Set up local state, ensuring consistent view of global state. */
+	spin_lock_irqsave(&rnp->lock, flags);
+	rdp->grpmask = 1UL << (cpu - rdp->mynode->grplo);
+	rdp->nxtlist = NULL;
+	for (i = 0; i < RCU_NEXT_SIZE; i++)
+		rdp->nxttail[i] = &rdp->nxtlist;
+	rdp->qlen = 0;
+#ifdef CONFIG_NO_HZ
+	rdp->dynticks = &per_cpu(rcu_dynticks, cpu);
+#endif /* #ifdef CONFIG_NO_HZ */
+	rdp->cpu = cpu;
+	spin_unlock_irqrestore(&rnp->lock, flags);
+}
+
+/*
+ * Initialize a CPU's per-CPU RCU data.  Note that only one online or
+ * offline event can be happening at a given time.  Note also that we
+ * can accept some slop in the rsp->completed access due to the fact
+ * that this CPU cannot possibly have any RCU callbacks in flight yet.
  */
 static void __cpuinit
 rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
 {
 	unsigned long flags;
-	int i;
 	long lastcomp;
 	unsigned long mask;
 	struct rcu_data *rdp = rsp->rda[cpu];
@@ -1355,16 +1373,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
 	rdp->qs_pending = 1;	 /*  so set up to respond to current GP. */
 	rdp->beenonline = 1;	 /* We have now been online. */
 	rdp->passed_quiesc_completed = lastcomp - 1;
-	rdp->grpmask = 1UL << (cpu - rdp->mynode->grplo);
-	rdp->nxtlist = NULL;
-	for (i = 0; i < RCU_NEXT_SIZE; i++)
-		rdp->nxttail[i] = &rdp->nxtlist;
-	rdp->qlen = 0;
 	rdp->blimit = blimit;
-#ifdef CONFIG_NO_HZ
-	rdp->dynticks = &per_cpu(rcu_dynticks, cpu);
-#endif /* #ifdef CONFIG_NO_HZ */
-	rdp->cpu = cpu;
 	spin_unlock(&rnp->lock);		/* irqs remain disabled. */
 
 	/*
@@ -1534,17 +1543,12 @@ void __init __rcu_init(void)
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 	rcu_init_one(&rcu_state);
 	RCU_DATA_PTR_INIT(&rcu_state, rcu_data);
+	for_each_possible_cpu(i)
+		rcu_boot_init_percpu_data(i, &rcu_state);
 	rcu_init_one(&rcu_bh_state);
 	RCU_DATA_PTR_INIT(&rcu_bh_state, rcu_bh_data);
-
-	/*
-	 * We don't need protection against CPU-hotplug here because
-	 * this is called early in boot, before either interrupts
-	 * or the scheduler are operational.
-	 */
-	for_each_online_cpu(i)
-		rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)i);
-
+	for_each_possible_cpu(i)
+		rcu_boot_init_percpu_data(i, &rcu_bh_state);
 	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 13:09               ` [tip:core/debug] debug lockups: Improve lockup detection tip-bot for Ingo Molnar
  2009-08-02 17:18                 ` Paul E. McKenney
@ 2009-08-02 18:45                 ` Andrew Morton
  2009-08-02 19:26                   ` Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Andrew Morton @ 2009-08-02 18:45 UTC (permalink / raw)
  To: paulmck, mingo, hpa, linux-kernel, akpm, a.p.zijlstra, torvalds,
	tglx, mingo
  Cc: tip-bot for Ingo Molnar, linux-tip-commits, linux-kernel, hpa,
	mingo, torvalds, a.p.zijlstra, paulmck, tglx

On Sun, 2 Aug 2009 13:09:34 GMT tip-bot for Ingo Molnar <mingo@elte.hu> wrote:

> Commit-ID:  c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> Gitweb:     http://git.kernel.org/tip/c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sun, 2 Aug 2009 11:28:21 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 2 Aug 2009 13:27:17 +0200
> 
> --- a/drivers/char/sysrq.c
> +++ b/drivers/char/sysrq.c
> @@ -24,6 +24,7 @@
>  #include <linux/sysrq.h>
>  #include <linux/kbd_kern.h>
>  #include <linux/proc_fs.h>
> +#include <linux/nmi.h>
>  #include <linux/quotaops.h>
>  #include <linux/perf_counter.h>
>  #include <linux/kernel.h>
> @@ -222,12 +223,7 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
>  
>  static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
>  {
> -	struct pt_regs *regs = get_irq_regs();
> -	if (regs) {
> -		printk(KERN_INFO "CPU%d:\n", smp_processor_id());
> -		show_regs(regs);
> -	}
> -	schedule_work(&sysrq_showallcpus);
> +	trigger_all_cpu_backtrace();
>  }

I think this just broke all non-x86 non-sparc SMP architectures.

>  static struct sysrq_key_op sysrq_showallcpus_op = {
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 7717b95..9c5fa9f 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -35,6 +35,7 @@
>  #include <linux/rcupdate.h>
>  #include <linux/interrupt.h>
>  #include <linux/sched.h>
> +#include <linux/nmi.h>
>  #include <asm/atomic.h>
>  #include <linux/bitops.h>
>  #include <linux/module.h>
> @@ -469,6 +470,8 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
>  	}
>  	printk(" (detected by %d, t=%ld jiffies)\n",
>  	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
> +	trigger_all_cpu_backtrace();

Be aware that trigger_all_cpu_backtrace() is a PITA when you have a lot
of CPUs.

If a callsite is careful to ensure that the most important information
is emitted last then that might improve things.

otoh, log buffer overflow will truncate, I think.  So that info needs
to be emitted first too ;)

It's a PITA.



^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 18:45                 ` Andrew Morton
@ 2009-08-02 19:26                   ` Ingo Molnar
  2009-08-02 19:39                     ` Andrew Morton
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-02 19:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Sun, 2 Aug 2009 13:09:34 GMT tip-bot for Ingo Molnar <mingo@elte.hu> wrote:
> 
> > Commit-ID:  c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> > Gitweb:     http://git.kernel.org/tip/c1dc0b9c0c8979ce4d411caadff5c0d79dee58bc
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sun, 2 Aug 2009 11:28:21 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sun, 2 Aug 2009 13:27:17 +0200
> > 
> > --- a/drivers/char/sysrq.c
> > +++ b/drivers/char/sysrq.c
> > @@ -24,6 +24,7 @@
> >  #include <linux/sysrq.h>
> >  #include <linux/kbd_kern.h>
> >  #include <linux/proc_fs.h>
> > +#include <linux/nmi.h>
> >  #include <linux/quotaops.h>
> >  #include <linux/perf_counter.h>
> >  #include <linux/kernel.h>
> > @@ -222,12 +223,7 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
> >  
> >  static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
> >  {
> > -	struct pt_regs *regs = get_irq_regs();
> > -	if (regs) {
> > -		printk(KERN_INFO "CPU%d:\n", smp_processor_id());
> > -		show_regs(regs);
> > -	}
> > -	schedule_work(&sysrq_showallcpus);
> > +	trigger_all_cpu_backtrace();
> >  }
> 
> I think this just broke all non-x86 non-sparc SMP architectures.

Yeah - it 'broke' them in the sense of them not having a working 
trigger_all_cpu_backtrace() implementation to begin with. (which 
breaks/degrades spinlock-debug to begin with so it's an existing 
problem)

One solution would be to do a generic trigger_all_cpu_backtrace() 
implementation that does the above schedule_work() approach.

I never understood why we proliferated all these different 
backtrace-triggering mechanisms instead of doing one good approach 
that everything uses.

> >  static struct sysrq_key_op sysrq_showallcpus_op = {
> > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > index 7717b95..9c5fa9f 100644
> > --- a/kernel/rcutree.c
> > +++ b/kernel/rcutree.c
> > @@ -35,6 +35,7 @@
> >  #include <linux/rcupdate.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/sched.h>
> > +#include <linux/nmi.h>
> >  #include <asm/atomic.h>
> >  #include <linux/bitops.h>
> >  #include <linux/module.h>
> > @@ -469,6 +470,8 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
> >  	}
> >  	printk(" (detected by %d, t=%ld jiffies)\n",
> >  	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
> > +	trigger_all_cpu_backtrace();
> 
> Be aware that trigger_all_cpu_backtrace() is a PITA when you have 
> a lot of CPUs.
> 
> If a callsite is careful to ensure that the most important 
> information is emitted last then that might improve things.
> 
> otoh, log buffer overflow will truncate, I think.  So that info 
> needs to be emitted first too ;)
> 
> It's a PITA.

Yeah, it is - i'd expect larger systems to have larger log buffers. 
Lack of info was obviously a showstopper with the highest priority.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 19:26                   ` Ingo Molnar
@ 2009-08-02 19:39                     ` Andrew Morton
  2009-08-02 20:41                       ` Ingo Molnar
  2009-08-02 20:46                       ` [tip:core/debug] debug lockups: Improve lockup detection Ingo Molnar
  0 siblings, 2 replies; 1149+ messages in thread
From: Andrew Morton @ 2009-08-02 19:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits

On Sun, 2 Aug 2009 21:26:57 +0200 Ingo Molnar <mingo@elte.hu> wrote:

> > I think this just broke all non-x86 non-sparc SMP architectures.
> 
> Yeah - it 'broke' them in the sense of them not having a working 
> trigger_all_cpu_backtrace() implementation to begin with.

c'mon.  It broke them in the sense that sysrq-l went from "works" to
"doesn't work".

It would take months for the relevant arch maintainers to even find out
about this, after which they're left with dud kernels out in the field.

It's better to break the build or to emit warnings than to silently and
secretly break their stuff.


--- a/include/linux/nmi.h~a
+++ a/include/linux/nmi.h
@@ -29,6 +29,9 @@ static inline void acpi_nmi_enable(void)
 #endif
 
 #ifndef trigger_all_cpu_backtrace
+#ifdef CONFIG_SMP
+#warning This architecture is missing a trigger_all_cpu_backtrace() implementation
+#endif
 #define trigger_all_cpu_backtrace() do { } while (0)
 #endif
 
_


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
       [not found]             ` <new-submission>
                                 ` (286 preceding siblings ...)
  2009-08-02 18:36               ` [tip:core/rcu] rcu: Fix RCU & CPU hotplug hang tip-bot for Paul E. McKenney
@ 2009-08-02 19:40               ` tip-bot for Paul E. McKenney
  2009-08-02 20:27                 ` Ingo Molnar
  2009-08-03 13:22               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
                                 ` (419 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Paul E. McKenney @ 2009-08-02 19:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, paulmck, hpa, mingo, tglx, mingo

Commit-ID:  7256cf0e83bf018be8a81806593aaef7f2437f0b
Gitweb:     http://git.kernel.org/tip/7256cf0e83bf018be8a81806593aaef7f2437f0b
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Sun, 2 Aug 2009 10:21:10 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 2 Aug 2009 21:31:28 +0200

rcu: Add diagnostic check for a possible CPU-hotplug race

Complain if the RCU softirq code ever runs on a CPU that has
not yet been announced to RCU as being online.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/rcutree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 3313244..b9b1928 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1132,6 +1132,8 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 {
 	unsigned long flags;
 
+	WARN_ON_ONCE(rdp->beenonline == 0);
+
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick
 	 * idle CPUs and, if needed, send resched IPIs.

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-07-24 10:37   ` Mike Galbraith
@ 2009-08-02 20:00     ` Ingo Molnar
  2009-08-03  5:09       ` Mike Galbraith
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-02 20:00 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Peter Zijlstra, LKML


* Mike Galbraith <efault@gmx.de> wrote:

> On Fri, 2009-07-24 at 10:58 +0200, Peter Zijlstra wrote:
> > On Fri, 2009-07-24 at 10:09 +0200, Mike Galbraith wrote:
> > > (depends on last resurrect annotation patch)
> > > 
> > > perf_counter tools: allow top users to switch between weighted and individual counter display.
> > > 
> > > Add [w]eighted hotkey.  Pressing [w] toggles between displaying weighted total of all counters,
> > > and the counter selected via [E]vent select key.
> > 
> > /me stuck it next to that other one, let see what happens ;-)
> 
> (plugs in Bitwolf-9000 charger)

seems to work well here.

A few minor comments:

 - I had to guess that '?' gets me a help screen. Might make sense 
   to display a line at the bottom (?) to give some hints.

 - Once i was on the help screen, i expected either <Enter> or '?' 
   to make it vanish. Only setting an option got rid of it - i 
   suspect this should be improved. (Also, a line in the help screen 
   that tells us how to go back without changing anything would be 
   helpful as well.)

 - I randomly tried the 's' option to do annotation. But it didnt do 
   anything. Probably because i didnt start perf top via --vmlinux, 
   right? This behavior is not intuitive in any case - it should 
   probably display an error message at minimum - but if possible it 
   should try to guess the position of the vmlinux file.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-02 19:40               ` [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race tip-bot for Paul E. McKenney
@ 2009-08-02 20:27                 ` Ingo Molnar
  2009-08-02 22:13                   ` Paul E. McKenney
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-02 20:27 UTC (permalink / raw)
  To: mingo, hpa, paulmck, linux-kernel, tglx; +Cc: linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 2860 bytes --]


* tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> Commit-ID:  7256cf0e83bf018be8a81806593aaef7f2437f0b
> Gitweb:     http://git.kernel.org/tip/7256cf0e83bf018be8a81806593aaef7f2437f0b
> Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> AuthorDate: Sun, 2 Aug 2009 10:21:10 -0700
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 2 Aug 2009 21:31:28 +0200
> 
> rcu: Add diagnostic check for a possible CPU-hotplug race
> 
> Complain if the RCU softirq code ever runs on a CPU that has
> not yet been announced to RCU as being online.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

FYI, the new warning triggered in -tip testing:

calling  tracer_alloc_buffers+0x0/0x296 @ 1
initcall tracer_alloc_buffers+0x0/0x296 returned 0 after 0 usecs
calling  init_trace_printk+0x0/0x7 @ 1
initcall init_trace_printk+0x0/0x7 returned 0 after 0 usecs
lockdep: fixing up alternatives.
Booting processor 1 APIC 0x1 ip 0x6000
Initializing CPU#1
masked ExtINT on CPU#1
Calibrating delay using timer specific routine.. 4021.85 BogoMIPS (lpj=6700572)
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 1
mce: CPU supports 5 MCE banks
CPU1: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
Brought up 2 CPUs
Total of 2 processors activated (8043.58 BogoMIPS).
------------[ cut here ]------------
WARNING: at kernel/rcutree.c:1140 __rcu_process_callbacks+0x2c/0xb9()
Hardware name: System Product Name
Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip #280
Call Trace:
 [<c105229d>] warn_slowpath_common+0x60/0x90
 [<c10522df>] warn_slowpath_null+0x12/0x15
 [<c1091f70>] __rcu_process_callbacks+0x2c/0xb9
 [<c1092021>] rcu_process_callbacks+0x24/0x42
 [<c105737c>] __do_softirq+0xbc/0x16f
 [<c105746a>] do_softirq+0x3b/0x5f
 [<c10575c2>] irq_exit+0x3a/0x6d
 [<c10318cb>] smp_apic_timer_interrupt+0x74/0x82
 [<c101f0af>] apic_timer_interrupt+0x2f/0x40
 [<c101d7c2>] ? cpu_idle+0x77/0x99
 [<c10370e0>] ? native_safe_halt+0xa/0xc
 [<c10248cf>] default_idle+0x80/0xd1
 [<c101d7c8>] cpu_idle+0x7d/0x99
 [<c1f806f1>] start_secondary+0xf7/0xf9
---[ end trace 4eaa2a86a8e2da22 ]---
CPU0 attaching sched-domain:
 domain 0: span 0-1 level MC
  groups: 0 1
CPU1 attaching sched-domain:
 domain 0: span 0-1 level MC
  groups: 1 0
device: 'platform': device_add
khelper used greatest stack depth: 6632 bytes left
bus: 'platform': registered
Registering sysdev class 'cpu'
calling  init_cpufreq_transition_notifier_list+0x0/0x18 @ 1
initcall init_cpufreq_transition_notifier_list+0x0/0x18 returned 0 after 0 usecs
calling  net_ns_init+0x0/0x120 @ 1
initcall net_ns_init+0x0/0x120 returned 0 after 0 usecs

with the attached config.

	Ingo

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 62461 bytes --]

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc5
# Sun Aug  2 22:16:02 2009
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
# CONFIG_X86_64 is not set
CONFIG_X86=y
CONFIG_OUTPUT_FORMAT="elf32-i386"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_FAST_CMPXCHG_LOCAL=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
# CONFIG_GENERIC_TIME_VSYSCALL is not set
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_DEFAULT_IDLE=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y
# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
# CONFIG_ZONE_DMA32 is not set
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
CONFIG_X86_32_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_TRAMPOLINE=y
CONFIG_X86_32_LAZY_GS=y
CONFIG_KTIME_SCALAR=y
# CONFIG_BOOTPARAM_SUPPORT_NOT_WANTED is not set
# CONFIG_BOOTPARAM_SUPPORT is not set
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_BOOT_ALLOWED4=y
# CONFIG_BROKEN_BOOT_ALLOWED3 is not set
CONFIG_BROKEN_BOOT_DISALLOWED=y
CONFIG_BROKEN_BOOT_EUROPE=y
CONFIG_BROKEN_BOOT_TITAN=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
# CONFIG_TASK_DELAY_ACCT is not set
CONFIG_TASK_XACCT=y
# CONFIG_TASK_IO_ACCOUNTING is not set
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_TREE=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_TRACE=y
CONFIG_RCU_FANOUT=32
CONFIG_RCU_FANOUT_EXACT=y
CONFIG_TREE_RCU_TRACE=y
# CONFIG_PREEMPT_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=20
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_GROUP_SCHED=y
# CONFIG_FAIR_GROUP_SCHED is not set
CONFIG_RT_GROUP_SCHED=y
# CONFIG_USER_SCHED is not set
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_CPUACCT is not set
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_CGROUP_MEM_RES_CTLR is not set
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_EMBEDDED=y
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
# CONFIG_EVENTFD is not set
# CONFIG_SHMEM is not set
# CONFIG_AIO is not set
CONFIG_HAVE_PERF_COUNTERS=y

#
# Performance Counters
#
# CONFIG_PERF_COUNTERS is not set
# CONFIG_VM_EVENT_COUNTERS is not set
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
CONFIG_STRIP_ASM_SYMS=y
# CONFIG_COMPAT_BRK is not set
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
CONFIG_PROFILING=y
CONFIG_TRACEPOINTS=y
CONFIG_MARKERS=y
CONFIG_OPROFILE=y
CONFIG_OPROFILE_IBS=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_HW_BREAKPOINT=y

#
# GCOV-based kernel profiling
#
CONFIG_SLOW_WORK=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
# CONFIG_MODULES is not set
CONFIG_BLOCK=y
# CONFIG_LBDAF is not set
CONFIG_BLK_DEV_BSG=y
# CONFIG_BLK_DEV_INTEGRITY is not set

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
# CONFIG_IOSCHED_AS is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
CONFIG_DEFAULT_NOOP=y
CONFIG_DEFAULT_IOSCHED="noop"
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_FREEZER=y

#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_SMP_SUPPORT=y
CONFIG_X86_MPPARSE=y
# CONFIG_X86_BIGSMP is not set
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_ELAN is not set
CONFIG_X86_RDC321X=y
# CONFIG_X86_32_NON_STANDARD is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_PARAVIRT_GUEST=y
CONFIG_VMI=y
CONFIG_KVM_CLOCK=y
# CONFIG_KVM_GUEST is not set
# CONFIG_LGUEST_GUEST is not set
CONFIG_PARAVIRT=y
# CONFIG_PARAVIRT_SPINLOCKS is not set
CONFIG_PARAVIRT_CLOCK=y
CONFIG_PARAVIRT_DEBUG=y
CONFIG_MEMTEST=y
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
CONFIG_M586MMX=y
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_MVIAC7 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_GENERIC_CPU is not set
CONFIG_X86_GENERIC=y
CONFIG_X86_CPU=y
CONFIG_X86_L1_CACHE_BYTES=64
CONFIG_X86_INTERNODE_CACHE_BYTES=64
CONFIG_X86_CMPXCHG=y
CONFIG_X86_L1_CACHE_SHIFT=5
CONFIG_X86_XADD=y
# CONFIG_X86_PPRO_FENCE is not set
CONFIG_X86_F00F_BUG=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_ALIGNMENT_16=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_TSC=y
CONFIG_X86_MINIMUM_CPU_FAMILY=4
CONFIG_PROCESSOR_SELECT=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_CYRIX_32=y
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_CENTAUR=y
# CONFIG_CPU_SUP_TRANSMETA_32 is not set
# CONFIG_CPU_SUP_UMC_32 is not set
# CONFIG_HPET_TIMER is not set
CONFIG_DMI=y
# CONFIG_IOMMU_HELPER is not set
# CONFIG_IOMMU_API is not set
CONFIG_NR_CPUS=8
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
CONFIG_X86_MCE=y
CONFIG_X86_MCE_INTEL=y
CONFIG_X86_MCE_AMD=y
# CONFIG_X86_ANCIENT_MCE is not set
CONFIG_X86_MCE_THRESHOLD=y
CONFIG_X86_MCE_INJECT=y
CONFIG_X86_THERMAL_VECTOR=y
CONFIG_VM86=y
CONFIG_I8K=y
CONFIG_X86_REBOOTFIXUPS=y
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
CONFIG_X86_CPUID=y
# CONFIG_X86_CPU_DEBUG is not set
CONFIG_UP_WANTED_1=y
# CONFIG_UP_WANTED_2 is not set
CONFIG_SMP=y
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_3G_OPT is not set
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_2G_OPT is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_HIGHMEM=y
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ILLEGAL_POINTER_VALUE=0
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_SPARSEMEM_STATIC=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_PHYS_ADDR_T_64BIT is not set
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_HAVE_MLOCK=y
CONFIG_HAVE_MLOCKED_PAGE_BIT=y
CONFIG_MMU_NOTIFIER=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
# CONFIG_HIGHPTE is not set
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
# CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
CONFIG_X86_RESERVE_LOW_64K=y
CONFIG_MATH_EMULATION=y
CONFIG_MTRR=y
CONFIG_MTRR_SANITIZER=y
CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
# CONFIG_X86_PAT is not set
CONFIG_SECCOMP=y
# CONFIG_CC_STACKPROTECTOR is not set
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
CONFIG_HZ_300=y
# CONFIG_HZ_1000 is not set
CONFIG_HZ=300
# CONFIG_SCHED_HRTICK is not set
# CONFIG_KEXEC is not set
# CONFIG_CRASH_DUMP is not set
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_X86_NEED_RELOCS=y
CONFIG_PHYSICAL_ALIGN=0x1000000
# CONFIG_HOTPLUG_CPU is not set
CONFIG_COMPAT_VDSO=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE=""
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y

#
# Power management and ACPI options
#
# CONFIG_PM is not set

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
# CONFIG_CPU_FREQ_STAT is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

#
# CPUFreq processor drivers
#
CONFIG_X86_POWERNOW_K6=y
# CONFIG_X86_POWERNOW_K7 is not set
# CONFIG_X86_GX_SUSPMOD is not set
CONFIG_X86_SPEEDSTEP_CENTRINO=y
CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
CONFIG_X86_SPEEDSTEP_ICH=y
CONFIG_X86_SPEEDSTEP_SMI=y
CONFIG_X86_P4_CLOCKMOD=y
# CONFIG_X86_CPUFREQ_NFORCE2 is not set
CONFIG_X86_LONGRUN=y
CONFIG_X86_E_POWERSAVER=y

#
# shared options
#
CONFIG_X86_SPEEDSTEP_LIB=y
CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_IDLE_GOV_MENU=y

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
CONFIG_PCI_GOBIOS=y
# CONFIG_PCI_GOMMCONFIG is not set
# CONFIG_PCI_GODIRECT is not set
# CONFIG_PCI_GOOLPC is not set
# CONFIG_PCI_GOANY is not set
CONFIG_PCI_BIOS=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=y
# CONFIG_HOTPLUG_PCI_PCIE is not set
CONFIG_PCIEAER=y
# CONFIG_PCIE_ECRC is not set
# CONFIG_PCIEAER_INJECT is not set
CONFIG_PCIEASPM=y
# CONFIG_PCIEASPM_DEBUG is not set
CONFIG_ARCH_SUPPORTS_MSI=y
# CONFIG_PCI_MSI is not set
CONFIG_PCI_LEGACY=y
CONFIG_PCI_DEBUG=y
# CONFIG_PCI_STUB is not set
# CONFIG_HT_IRQ is not set
# CONFIG_PCI_IOV is not set
CONFIG_ISA_DMA_API=y
CONFIG_ISA=y
CONFIG_EISA=y
CONFIG_EISA_VLB_PRIMING=y
CONFIG_EISA_PCI_EISA=y
# CONFIG_EISA_VIRTUAL_ROOT is not set
# CONFIG_EISA_NAMES is not set
CONFIG_MCA=y
CONFIG_MCA_LEGACY=y
# CONFIG_MCA_PROC_FS is not set
CONFIG_SCx200=y
CONFIG_SCx200HR_TIMER=y
# CONFIG_OLPC is not set
CONFIG_K8_NB=y
CONFIG_PCCARD=y
CONFIG_PCMCIA_DEBUG=y
# CONFIG_PCMCIA is not set
# CONFIG_CARDBUS is not set

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_TOSHIBA=y
CONFIG_PCMCIA_PROBE=y
CONFIG_PCCARD_NONSTATIC=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
CONFIG_HOTPLUG_PCI_COMPAQ=y
CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=y
# CONFIG_HOTPLUG_PCI_IBM is not set
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_CPCI_ZT5550=y
# CONFIG_HOTPLUG_PCI_CPCI_GENERIC is not set
CONFIG_HOTPLUG_PCI_SHPC=y

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_HAVE_AOUT=y
# CONFIG_BINFMT_AOUT is not set
# CONFIG_BINFMT_MISC is not set
CONFIG_HAVE_ATOMIC_IOMAP=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
CONFIG_XFRM=y
CONFIG_XFRM_USER=y
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_IPCOMP=y
# CONFIG_NET_KEY is not set
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_ASK_IP_FIB_HASH=y
# CONFIG_IP_FIB_TRIE is not set
CONFIG_IP_FIB_HASH=y
CONFIG_IP_MULTIPLE_TABLES=y
# CONFIG_IP_ROUTE_MULTIPATH is not set
# CONFIG_IP_ROUTE_VERBOSE is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
CONFIG_NET_IPGRE=y
CONFIG_ARPD=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
CONFIG_INET_IPCOMP=y
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
CONFIG_INET_LRO=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IPV6 is not set
# CONFIG_NETLABEL is not set
CONFIG_NETWORK_SECMARK=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_DEBUG=y
# CONFIG_NETFILTER_ADVANCED is not set

#
# Core Netfilter Configuration
#
# CONFIG_NETFILTER_NETLINK_LOG is not set
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_SECMARK=y
# CONFIG_NF_CONNTRACK_FTP is not set
CONFIG_NF_CONNTRACK_IRC=y
# CONFIG_NF_CONNTRACK_SIP is not set
# CONFIG_NF_CT_NETLINK is not set
CONFIG_NETFILTER_XTABLES=y
# CONFIG_NETFILTER_XT_TARGET_CONNSECMARK is not set
# CONFIG_NETFILTER_XT_TARGET_MARK is not set
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
# CONFIG_NETFILTER_XT_MATCH_STATE is not set
CONFIG_IP_VS=y
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12

#
# IPVS transport protocol load balancing support
#
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
# CONFIG_IP_VS_PROTO_ESP is not set
# CONFIG_IP_VS_PROTO_AH is not set

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
# CONFIG_IP_VS_DH is not set
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_SED=y
# CONFIG_IP_VS_NQ is not set

#
# IPVS application helper
#
CONFIG_IP_VS_FTP=y

#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP_NF_FILTER is not set
CONFIG_IP_NF_TARGET_LOG=y
# CONFIG_IP_NF_TARGET_ULOG is not set
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
# CONFIG_NF_NAT_FTP is not set
CONFIG_NF_NAT_IRC=y
# CONFIG_NF_NAT_TFTP is not set
# CONFIG_NF_NAT_AMANDA is not set
# CONFIG_NF_NAT_PPTP is not set
# CONFIG_NF_NAT_H323 is not set
# CONFIG_NF_NAT_SIP is not set
CONFIG_IP_NF_MANGLE=y
# CONFIG_IP_DCCP is not set
CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_MSG is not set
# CONFIG_SCTP_DBG_OBJCNT is not set
# CONFIG_SCTP_HMAC_NONE is not set
CONFIG_SCTP_HMAC_SHA1=y
# CONFIG_SCTP_HMAC_MD5 is not set
CONFIG_RDS=y
CONFIG_RDS_DEBUG=y
CONFIG_TIPC=y
# CONFIG_TIPC_ADVANCED is not set
CONFIG_TIPC_DEBUG=y
CONFIG_ATM=y
CONFIG_ATM_CLIP=y
CONFIG_ATM_CLIP_NO_ICMP=y
CONFIG_ATM_LANE=y
# CONFIG_ATM_MPOA is not set
CONFIG_ATM_BR2684=y
CONFIG_ATM_BR2684_IPFILTER=y
CONFIG_STP=y
CONFIG_GARP=y
CONFIG_BRIDGE=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_TAG_DSA=y
CONFIG_NET_DSA_TAG_EDSA=y
# CONFIG_NET_DSA_TAG_TRAILER is not set
CONFIG_NET_DSA_MV88E6XXX=y
# CONFIG_NET_DSA_MV88E6060 is not set
CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
CONFIG_NET_DSA_MV88E6131=y
CONFIG_NET_DSA_MV88E6123_61_65=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_DECNET=y
# CONFIG_DECNET_ROUTER is not set
CONFIG_LLC=y
CONFIG_LLC2=y
# CONFIG_IPX is not set
CONFIG_ATALK=y
# CONFIG_DEV_APPLETALK is not set
CONFIG_X25=y
CONFIG_LAPB=y
CONFIG_ECONET=y
# CONFIG_ECONET_AUNUDP is not set
# CONFIG_ECONET_NATIVE is not set
CONFIG_WAN_ROUTER=y
CONFIG_PHONET=y
CONFIG_IEEE802154=y
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set

#
# Network testing
#
CONFIG_NET_PKTGEN=y
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
# CONFIG_AX25 is not set
CONFIG_CAN=y
CONFIG_CAN_RAW=y
# CONFIG_CAN_BCM is not set

#
# CAN Device Drivers
#
CONFIG_CAN_VCAN=y
CONFIG_CAN_DEV=y
# CONFIG_CAN_CALC_BITTIMING is not set
# CONFIG_CAN_SJA1000 is not set
CONFIG_CAN_DEBUG_DEVICES=y
CONFIG_IRDA=y

#
# IrDA protocols
#
CONFIG_IRLAN=y
CONFIG_IRNET=y
# CONFIG_IRCOMM is not set
CONFIG_IRDA_ULTRA=y

#
# IrDA options
#
CONFIG_IRDA_CACHE_LAST_LSAP=y
CONFIG_IRDA_FAST_RR=y
CONFIG_IRDA_DEBUG=y

#
# Infrared-port device drivers
#

#
# SIR device drivers
#
CONFIG_IRTTY_SIR=y

#
# Dongle support
#
CONFIG_DONGLE=y
# CONFIG_ESI_DONGLE is not set
# CONFIG_ACTISYS_DONGLE is not set
CONFIG_TEKRAM_DONGLE=y
CONFIG_TOIM3232_DONGLE=y
CONFIG_LITELINK_DONGLE=y
CONFIG_MA600_DONGLE=y
CONFIG_GIRBIL_DONGLE=y
# CONFIG_MCP2120_DONGLE is not set
CONFIG_OLD_BELKIN_DONGLE=y
# CONFIG_ACT200L_DONGLE is not set
CONFIG_KINGSUN_DONGLE=y
CONFIG_KSDAZZLE_DONGLE=y
CONFIG_KS959_DONGLE=y

#
# FIR device drivers
#
CONFIG_USB_IRDA=y
# CONFIG_SIGMATEL_FIR is not set
CONFIG_NSC_FIR=y
CONFIG_WINBOND_FIR=y
CONFIG_TOSHIBA_FIR=y
# CONFIG_SMC_IRCC_FIR is not set
CONFIG_ALI_FIR=y
CONFIG_VLSI_FIR=y
CONFIG_VIA_FIR=y
CONFIG_MCS_FIR=y
# CONFIG_BT is not set
CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_DEBUG=y
CONFIG_RXKAD=y
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
# CONFIG_CFG80211 is not set
CONFIG_WIRELESS_OLD_REGULATORY=y
CONFIG_WIRELESS_EXT=y
CONFIG_WIRELESS_EXT_SYSFS=y
CONFIG_LIB80211=y
# CONFIG_LIB80211_DEBUG is not set

#
# CFG80211 needs to be enabled for MAC80211
#
CONFIG_MAC80211_DEFAULT_PS_VALUE=0
CONFIG_WIMAX=y
CONFIG_WIMAX_DEBUG_LEVEL=8
CONFIG_RFKILL=y
CONFIG_RFKILL_INPUT=y

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
# CONFIG_FIRMWARE_IN_KERNEL is not set
CONFIG_EXTRA_FIRMWARE=""
CONFIG_DEBUG_DRIVER=y
CONFIG_DEBUG_DEVRES=y
# CONFIG_SYS_HYPERVISOR is not set
CONFIG_CONNECTOR=y
# CONFIG_PROC_EVENTS is not set
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_PC_FIFO=y
CONFIG_PARPORT_PC_SUPERIO=y
# CONFIG_PARPORT_GSC is not set
# CONFIG_PARPORT_AX88796 is not set
CONFIG_PARPORT_1284=y
CONFIG_PARPORT_NOT_PC=y
# CONFIG_PNP is not set
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_XD=y
CONFIG_BLK_CPQ_DA=y
CONFIG_BLK_CPQ_CISS_DA=y
# CONFIG_CISS_SCSI_TAPE is not set
CONFIG_BLK_DEV_DAC960=y
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_SX8=y
CONFIG_BLK_DEV_UB=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_XIP=y
CONFIG_CDROM_PKTCDVD=y
CONFIG_CDROM_PKTCDVD_BUFFERS=8
# CONFIG_CDROM_PKTCDVD_WCACHE is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_VIRTIO_BLK is not set
CONFIG_BLK_DEV_HD=y
CONFIG_MISC_DEVICES=y
# CONFIG_IBM_ASM is not set
# CONFIG_PHANTOM is not set
# CONFIG_SGI_IOC4 is not set
CONFIG_TIFM_CORE=y
# CONFIG_TIFM_7XX1 is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
CONFIG_HP_ILO=y
CONFIG_ISL29003=y
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_LEGACY is not set
CONFIG_EEPROM_MAX6875=y
# CONFIG_EEPROM_93CX6 is not set
CONFIG_CB710_CORE=y
CONFIG_CB710_DEBUG=y
CONFIG_CB710_DEBUG_ASSUMPTIONS=y
CONFIG_HAVE_IDE=y

#
# SCSI device support
#
CONFIG_RAID_ATTRS=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_TGT=y
CONFIG_SCSI_NETLINK=y
# CONFIG_SCSI_PROC_FS is not set

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_CHR_DEV_OSST=y
CONFIG_BLK_DEV_SR=y
CONFIG_BLK_DEV_SR_VENDOR=y
CONFIG_CHR_DEV_SG=y
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
# CONFIG_SCSI_SCAN_ASYNC is not set

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
CONFIG_SCSI_FC_TGT_ATTRS=y
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
CONFIG_SCSI_SRP_ATTRS=y
CONFIG_SCSI_SRP_TGT_ATTRS=y
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=y
# CONFIG_SCSI_CXGB3_ISCSI is not set
CONFIG_BLK_DEV_3W_XXXX_RAID=y
CONFIG_SCSI_3W_9XXX=y
CONFIG_SCSI_7000FASST=y
CONFIG_SCSI_ACARD=y
# CONFIG_SCSI_AHA152X is not set
CONFIG_SCSI_AHA1740=y
CONFIG_SCSI_AACRAID=y
CONFIG_SCSI_AIC7XXX=y
CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
CONFIG_AIC7XXX_RESET_DELAY_MS=5000
# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
CONFIG_AIC7XXX_DEBUG_MASK=0
# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
CONFIG_SCSI_AIC7XXX_OLD=y
CONFIG_SCSI_AIC79XX=y
CONFIG_AIC79XX_CMDS_PER_DEVICE=32
CONFIG_AIC79XX_RESET_DELAY_MS=5000
# CONFIG_AIC79XX_DEBUG_ENABLE is not set
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC94XX is not set
CONFIG_SCSI_MVSAS=y
CONFIG_SCSI_MVSAS_DEBUG=y
# CONFIG_SCSI_DPT_I2O is not set
CONFIG_SCSI_ADVANSYS=y
CONFIG_SCSI_IN2000=y
CONFIG_SCSI_ARCMSR=y
CONFIG_SCSI_ARCMSR_AER=y
CONFIG_MEGARAID_NEWGEN=y
# CONFIG_MEGARAID_MM is not set
CONFIG_MEGARAID_LEGACY=y
# CONFIG_MEGARAID_SAS is not set
CONFIG_SCSI_MPT2SAS=y
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
# CONFIG_SCSI_MPT2SAS_LOGGING is not set
CONFIG_SCSI_HPTIOP=y
CONFIG_SCSI_BUSLOGIC=y
CONFIG_SCSI_FLASHPOINT=y
CONFIG_LIBFC=y
CONFIG_LIBFCOE=y
# CONFIG_FCOE is not set
# CONFIG_FCOE_FNIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_DTC3280 is not set
CONFIG_SCSI_EATA=y
# CONFIG_SCSI_EATA_TAGGED_QUEUE is not set
# CONFIG_SCSI_EATA_LINKED_COMMANDS is not set
CONFIG_SCSI_EATA_MAX_TAGS=16
CONFIG_SCSI_FUTURE_DOMAIN=y
# CONFIG_SCSI_FD_MCS is not set
CONFIG_SCSI_GDTH=y
CONFIG_SCSI_GENERIC_NCR5380=y
# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
CONFIG_SCSI_GENERIC_NCR53C400=y
CONFIG_SCSI_IBMMCA=y
# CONFIG_IBMMCA_SCSI_ORDER_STANDARD is not set
CONFIG_IBMMCA_SCSI_DEV_RESET=y
CONFIG_SCSI_IPS=y
CONFIG_SCSI_INITIO=y
# CONFIG_SCSI_INIA100 is not set
CONFIG_SCSI_PPA=y
CONFIG_SCSI_IMM=y
CONFIG_SCSI_IZIP_EPP16=y
# CONFIG_SCSI_IZIP_SLOW_CTR is not set
# CONFIG_SCSI_NCR53C406A is not set
CONFIG_SCSI_NCR_D700=y
CONFIG_SCSI_STEX=y
# CONFIG_SCSI_SYM53C8XX_2 is not set
CONFIG_SCSI_IPR=y
# CONFIG_SCSI_IPR_TRACE is not set
# CONFIG_SCSI_IPR_DUMP is not set
# CONFIG_SCSI_NCR_Q720 is not set
CONFIG_SCSI_PAS16=y
CONFIG_SCSI_QLOGIC_FAS=y
CONFIG_SCSI_QLOGIC_1280=y
CONFIG_SCSI_QLA_FC=y
# CONFIG_SCSI_QLA_ISCSI is not set
CONFIG_SCSI_LPFC=y
# CONFIG_SCSI_LPFC_DEBUG_FS is not set
# CONFIG_SCSI_SIM710 is not set
CONFIG_SCSI_SYM53C416=y
CONFIG_SCSI_DC395x=y
CONFIG_SCSI_DC390T=y
CONFIG_SCSI_T128=y
CONFIG_SCSI_U14_34F=y
CONFIG_SCSI_U14_34F_TAGGED_QUEUE=y
CONFIG_SCSI_U14_34F_LINKED_COMMANDS=y
CONFIG_SCSI_U14_34F_MAX_TAGS=8
CONFIG_SCSI_ULTRASTOR=y
CONFIG_SCSI_NSP32=y
CONFIG_SCSI_SRP=y
CONFIG_SCSI_DH=y
CONFIG_SCSI_DH_RDAC=y
CONFIG_SCSI_DH_HP_SW=y
# CONFIG_SCSI_DH_EMC is not set
# CONFIG_SCSI_DH_ALUA is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_SIL24=y
CONFIG_ATA_SFF=y
CONFIG_SATA_SVW=y
CONFIG_ATA_PIIX=y
# CONFIG_SATA_MV is not set
CONFIG_SATA_NV=y
# CONFIG_PDC_ADMA is not set
CONFIG_SATA_QSTOR=y
CONFIG_SATA_PROMISE=y
# CONFIG_SATA_SX4 is not set
CONFIG_SATA_SIL=y
CONFIG_SATA_SIS=y
CONFIG_SATA_ULI=y
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set
CONFIG_SATA_INIC162X=y
CONFIG_PATA_ALI=y
CONFIG_PATA_AMD=y
CONFIG_PATA_ARTOP=y
CONFIG_PATA_ATIIXP=y
# CONFIG_PATA_CMD640_PCI is not set
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
CONFIG_PATA_CS5530=y
CONFIG_PATA_CS5535=y
CONFIG_PATA_CS5536=y
CONFIG_PATA_CYPRESS=y
CONFIG_PATA_EFAR=y
CONFIG_ATA_GENERIC=y
CONFIG_PATA_HPT366=y
CONFIG_PATA_HPT37X=y
CONFIG_PATA_HPT3X2N=y
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT821X is not set
CONFIG_PATA_IT8213=y
CONFIG_PATA_JMICRON=y
CONFIG_PATA_LEGACY=y
CONFIG_PATA_TRIFLEX=y
# CONFIG_PATA_MARVELL is not set
CONFIG_PATA_MPIIX=y
CONFIG_PATA_OLDPIIX=y
# CONFIG_PATA_NETCELL is not set
CONFIG_PATA_NINJA32=y
CONFIG_PATA_NS87410=y
CONFIG_PATA_NS87415=y
CONFIG_PATA_OPTI=y
CONFIG_PATA_OPTIDMA=y
CONFIG_PATA_PDC_OLD=y
CONFIG_PATA_QDI=y
CONFIG_PATA_RADISYS=y
CONFIG_PATA_RZ1000=y
# CONFIG_PATA_SC1200 is not set
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_PDC2027X is not set
CONFIG_PATA_SIL680=y
CONFIG_PATA_SIS=y
CONFIG_PATA_VIA=y
CONFIG_PATA_WINBOND=y
CONFIG_PATA_WINBOND_VLB=y
CONFIG_PATA_PLATFORM=y
CONFIG_PATA_SCH=y
# CONFIG_MD is not set
# CONFIG_FUSION is not set

#
# IEEE 1394 (FireWire) support
#

#
# You can enable one or both FireWire driver stacks.
#

#
# See the help texts for more information.
#
CONFIG_FIREWIRE=y
CONFIG_FIREWIRE_OHCI=y
CONFIG_FIREWIRE_OHCI_DEBUG=y
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
CONFIG_IEEE1394=y
CONFIG_IEEE1394_OHCI1394=y
CONFIG_IEEE1394_PCILYNX=y
CONFIG_IEEE1394_SBP2=y
CONFIG_IEEE1394_SBP2_PHYS_DMA=y
CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y
CONFIG_IEEE1394_ETH1394=y
CONFIG_IEEE1394_RAWIO=y
# CONFIG_IEEE1394_VIDEO1394 is not set
# CONFIG_IEEE1394_DV1394 is not set
# CONFIG_IEEE1394_VERBOSEDEBUG is not set
# CONFIG_I2O is not set
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
CONFIG_BONDING=y
# CONFIG_MACVLAN is not set
CONFIG_EQUALIZER=y
CONFIG_TUN=y
CONFIG_VETH=y
# CONFIG_ARCNET is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
# CONFIG_MARVELL_PHY is not set
# CONFIG_DAVICOM_PHY is not set
CONFIG_QSEMI_PHY=y
CONFIG_LXT_PHY=y
CONFIG_CICADA_PHY=y
CONFIG_VITESSE_PHY=y
CONFIG_SMSC_PHY=y
# CONFIG_BROADCOM_PHY is not set
CONFIG_ICPLUS_PHY=y
CONFIG_REALTEK_PHY=y
# CONFIG_NATIONAL_PHY is not set
CONFIG_STE10XP=y
CONFIG_LSI_ET1011C_PHY=y
CONFIG_FIXED_PHY=y
# CONFIG_MDIO_BITBANG is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_HAPPYMEAL=y
CONFIG_SUNGEM=y
CONFIG_CASSINI=y
CONFIG_NET_VENDOR_3COM=y
CONFIG_EL1=y
# CONFIG_EL2 is not set
CONFIG_ELPLUS=y
CONFIG_EL16=y
CONFIG_EL3=y
# CONFIG_3C515 is not set
CONFIG_ELMC=y
CONFIG_ELMC_II=y
CONFIG_VORTEX=y
# CONFIG_TYPHOON is not set
# CONFIG_LANCE is not set
CONFIG_NET_VENDOR_SMC=y
CONFIG_ULTRAMCA=y
CONFIG_ULTRA=y
CONFIG_ULTRA32=y
CONFIG_SMC9194=y
CONFIG_ETHOC=y
CONFIG_NET_VENDOR_RACAL=y
# CONFIG_NI52 is not set
# CONFIG_NI65 is not set
# CONFIG_DNET is not set
# CONFIG_NET_TULIP is not set
CONFIG_AT1700=y
CONFIG_DEPCA=y
# CONFIG_HP100 is not set
CONFIG_NET_ISA=y
CONFIG_E2100=y
# CONFIG_EWRK3 is not set
CONFIG_EEXPRESS=y
CONFIG_EEXPRESS_PRO=y
# CONFIG_HPLAN is not set
# CONFIG_LP486E is not set
CONFIG_ETH16I=y
CONFIG_NE2000=y
CONFIG_ZNET=y
# CONFIG_SEEQ8005 is not set
CONFIG_NE2_MCA=y
CONFIG_IBMLANA=y
# CONFIG_IBM_NEW_EMAC_ZMII is not set
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
CONFIG_NET_PCI=y
CONFIG_PCNET32=y
# CONFIG_AMD8111_ETH is not set
CONFIG_ADAPTEC_STARFIRE=y
# CONFIG_AC3200 is not set
CONFIG_APRICOT=y
CONFIG_B44=y
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_FORCEDETH=y
# CONFIG_FORCEDETH_NAPI is not set
CONFIG_CS89x0=y
CONFIG_E100=y
CONFIG_LNE390=y
CONFIG_FEALNX=y
CONFIG_NATSEMI=y
# CONFIG_NE2K_PCI is not set
CONFIG_NE3210=y
CONFIG_ES3210=y
# CONFIG_8139CP is not set
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
# CONFIG_8139TOO_8129 is not set
CONFIG_8139_OLD_RX_RESET=y
CONFIG_R6040=y
CONFIG_SIS900=y
CONFIG_EPIC100=y
# CONFIG_SMSC9420 is not set
# CONFIG_SUNDANCE is not set
# CONFIG_TLAN is not set
CONFIG_KS8842=y
CONFIG_VIA_RHINE=y
CONFIG_VIA_RHINE_MMIO=y
CONFIG_SC92031=y
CONFIG_NET_POCKET=y
CONFIG_ATP=y
CONFIG_DE600=y
# CONFIG_DE620 is not set
CONFIG_ATL2=y
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
CONFIG_ACENIC_OMIT_TIGON_I=y
CONFIG_DL2K=y
CONFIG_E1000=y
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
CONFIG_IGB=y
CONFIG_IGB_DCA=y
CONFIG_IGBVF=y
CONFIG_NS83820=y
CONFIG_HAMACHI=y
CONFIG_YELLOWFIN=y
CONFIG_R8169=y
# CONFIG_R8169_VLAN is not set
CONFIG_SIS190=y
CONFIG_SKGE=y
CONFIG_SKGE_DEBUG=y
CONFIG_SKY2=y
CONFIG_SKY2_DEBUG=y
CONFIG_VIA_VELOCITY=y
CONFIG_TIGON3=y
CONFIG_BNX2=y
# CONFIG_QLA3XXX is not set
CONFIG_ATL1=y
CONFIG_ATL1E=y
CONFIG_ATL1C=y
CONFIG_JME=y
CONFIG_NETDEV_10000=y
CONFIG_MDIO=y
CONFIG_CHELSIO_T1=y
# CONFIG_CHELSIO_T1_1G is not set
CONFIG_CHELSIO_T3_DEPENDS=y
CONFIG_CHELSIO_T3=y
# CONFIG_ENIC is not set
# CONFIG_IXGBE is not set
# CONFIG_IXGB is not set
# CONFIG_S2IO is not set
CONFIG_MYRI10GE=y
CONFIG_MYRI10GE_DCA=y
CONFIG_NIU=y
CONFIG_MLX4_EN=y
CONFIG_MLX4_CORE=y
CONFIG_MLX4_DEBUG=y
# CONFIG_TEHUTI is not set
CONFIG_BNX2X=y
CONFIG_QLGE=y
CONFIG_SFC=y
CONFIG_BE2NET=y
# CONFIG_TR is not set

#
# Wireless LAN
#
CONFIG_WLAN_PRE80211=y
CONFIG_STRIP=y
# CONFIG_ARLAN is not set
CONFIG_WAVELAN=y
# CONFIG_WLAN_80211 is not set

#
# WiMAX Wireless Broadband devices
#

#
# Enable MMC support to see WiMAX SDIO drivers
#

#
# USB Network Adapters
#
CONFIG_USB_CATC=y
# CONFIG_USB_KAWETH is not set
CONFIG_USB_PEGASUS=y
# CONFIG_USB_RTL8150 is not set
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_SMSC95XX=y
# CONFIG_USB_NET_GL620A is not set
# CONFIG_USB_NET_NET1080 is not set
# CONFIG_USB_NET_PLUSB is not set
CONFIG_USB_NET_MCS7830=y
# CONFIG_USB_NET_RNDIS_HOST is not set
CONFIG_USB_NET_CDC_SUBSET=y
# CONFIG_USB_ALI_M5632 is not set
# CONFIG_USB_AN2720 is not set
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
# CONFIG_USB_EPSON2888 is not set
# CONFIG_USB_KC2190 is not set
CONFIG_USB_NET_ZAURUS=y
# CONFIG_USB_HSO is not set
CONFIG_USB_NET_INT51X1=y
# CONFIG_USB_CDC_PHONET is not set
# CONFIG_WAN is not set
CONFIG_ATM_DRIVERS=y
# CONFIG_ATM_DUMMY is not set
CONFIG_ATM_TCP=y
CONFIG_ATM_LANAI=y
CONFIG_ATM_ENI=y
CONFIG_ATM_ENI_DEBUG=y
# CONFIG_ATM_ENI_TUNE_BURST is not set
# CONFIG_ATM_FIRESTREAM is not set
# CONFIG_ATM_ZATM is not set
CONFIG_ATM_NICSTAR=y
# CONFIG_ATM_NICSTAR_USE_SUNI is not set
# CONFIG_ATM_NICSTAR_USE_IDT77105 is not set
CONFIG_ATM_IDT77252=y
# CONFIG_ATM_IDT77252_DEBUG is not set
# CONFIG_ATM_IDT77252_RCV_ALL is not set
CONFIG_ATM_IDT77252_USE_SUNI=y
CONFIG_ATM_AMBASSADOR=y
CONFIG_ATM_AMBASSADOR_DEBUG=y
CONFIG_ATM_HORIZON=y
CONFIG_ATM_HORIZON_DEBUG=y
# CONFIG_ATM_IA is not set
CONFIG_ATM_FORE200E=y
# CONFIG_ATM_FORE200E_USE_TASKLET is not set
CONFIG_ATM_FORE200E_TX_RETRY=16
CONFIG_ATM_FORE200E_DEBUG=0
# CONFIG_ATM_HE is not set
CONFIG_ATM_SOLOS=y
# CONFIG_IEEE802154_DRIVERS is not set
CONFIG_FDDI=y
CONFIG_DEFXX=y
CONFIG_DEFXX_MMIO=y
# CONFIG_SKFP is not set
# CONFIG_HIPPI is not set
# CONFIG_PLIP is not set
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
# CONFIG_PPP_MPPE is not set
CONFIG_PPPOE=y
# CONFIG_PPPOATM is not set
CONFIG_PPPOL2TP=y
# CONFIG_SLIP is not set
CONFIG_SLHC=y
CONFIG_NET_FC=y
CONFIG_NETCONSOLE=y
CONFIG_NETCONSOLE_DYNAMIC=y
CONFIG_NETPOLL=y
CONFIG_NETPOLL_TRAP=y
CONFIG_NET_POLL_CONTROLLER=y
# CONFIG_VIRTIO_NET is not set
CONFIG_ISDN=y
CONFIG_ISDN_I4L=y
# CONFIG_ISDN_PPP is not set
# CONFIG_ISDN_AUDIO is not set
CONFIG_ISDN_X25=y

#
# ISDN feature submodules
#
# CONFIG_ISDN_DIVERSION is not set

#
# ISDN4Linux hardware drivers
#

#
# Passive cards
#
CONFIG_ISDN_DRV_HISAX=y

#
# D-channel protocol features
#
CONFIG_HISAX_EURO=y
CONFIG_DE_AOC=y
# CONFIG_HISAX_NO_SENDCOMPLETE is not set
CONFIG_HISAX_NO_LLC=y
CONFIG_HISAX_NO_KEYPAD=y
# CONFIG_HISAX_1TR6 is not set
CONFIG_HISAX_NI1=y
CONFIG_HISAX_MAX_CARDS=8

#
# HiSax supported cards
#
# CONFIG_HISAX_16_0 is not set
# CONFIG_HISAX_16_3 is not set
CONFIG_HISAX_TELESPCI=y
# CONFIG_HISAX_S0BOX is not set
CONFIG_HISAX_AVM_A1=y
CONFIG_HISAX_FRITZPCI=y
CONFIG_HISAX_AVM_A1_PCMCIA=y
CONFIG_HISAX_ELSA=y
CONFIG_HISAX_IX1MICROR2=y
CONFIG_HISAX_DIEHLDIVA=y
CONFIG_HISAX_ASUSCOM=y
CONFIG_HISAX_TELEINT=y
CONFIG_HISAX_HFCS=y
# CONFIG_HISAX_SEDLBAUER is not set
# CONFIG_HISAX_SPORTSTER is not set
CONFIG_HISAX_MIC=y
CONFIG_HISAX_NETJET=y
# CONFIG_HISAX_NETJET_U is not set
CONFIG_HISAX_NICCY=y
CONFIG_HISAX_ISURF=y
# CONFIG_HISAX_HSTSAPHIR is not set
CONFIG_HISAX_BKM_A4T=y
CONFIG_HISAX_SCT_QUADRO=y
# CONFIG_HISAX_GAZEL is not set
CONFIG_HISAX_HFC_PCI=y
# CONFIG_HISAX_W6692 is not set
CONFIG_HISAX_HFC_SX=y
CONFIG_HISAX_ENTERNOW_PCI=y
# CONFIG_HISAX_DEBUG is not set

#
# HiSax PCMCIA card service modules
#

#
# HiSax sub driver modules
#
# CONFIG_HISAX_ST5481 is not set
CONFIG_HISAX_HFCUSB=y
CONFIG_HISAX_HFC4S8S=y
CONFIG_HISAX_FRITZ_PCIPNP=y

#
# Active cards
#
CONFIG_ISDN_DRV_PCBIT=y
CONFIG_ISDN_DRV_SC=y
# CONFIG_ISDN_DRV_ACT2000 is not set
# CONFIG_ISDN_CAPI is not set
CONFIG_ISDN_DRV_GIGASET=y
CONFIG_GIGASET_BASE=y
CONFIG_GIGASET_M105=y
CONFIG_GIGASET_M101=y
CONFIG_GIGASET_DEBUG=y
# CONFIG_PHONE is not set

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_POLLDEV=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
CONFIG_INPUT_EVBUG=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
CONFIG_KEYBOARD_LKKBD=y
CONFIG_KEYBOARD_LM8323=y
CONFIG_KEYBOARD_NEWTON=y
CONFIG_KEYBOARD_STOWAWAY=y
CONFIG_KEYBOARD_SUNKBD=y
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_ANALOG=y
# CONFIG_JOYSTICK_A3D is not set
CONFIG_JOYSTICK_ADI=y
CONFIG_JOYSTICK_COBRA=y
# CONFIG_JOYSTICK_GF2K is not set
CONFIG_JOYSTICK_GRIP=y
CONFIG_JOYSTICK_GRIP_MP=y
CONFIG_JOYSTICK_GUILLEMOT=y
CONFIG_JOYSTICK_INTERACT=y
CONFIG_JOYSTICK_SIDEWINDER=y
# CONFIG_JOYSTICK_TMDC is not set
CONFIG_JOYSTICK_IFORCE=y
# CONFIG_JOYSTICK_IFORCE_USB is not set
CONFIG_JOYSTICK_IFORCE_232=y
CONFIG_JOYSTICK_WARRIOR=y
CONFIG_JOYSTICK_MAGELLAN=y
CONFIG_JOYSTICK_SPACEORB=y
CONFIG_JOYSTICK_SPACEBALL=y
CONFIG_JOYSTICK_STINGER=y
CONFIG_JOYSTICK_TWIDJOY=y
CONFIG_JOYSTICK_ZHENHUA=y
CONFIG_JOYSTICK_DB9=y
# CONFIG_JOYSTICK_GAMECON is not set
# CONFIG_JOYSTICK_TURBOGRAFX is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
CONFIG_JOYSTICK_XPAD=y
# CONFIG_JOYSTICK_XPAD_FF is not set
CONFIG_JOYSTICK_XPAD_LEDS=y
CONFIG_INPUT_TABLET=y
# CONFIG_TABLET_USB_ACECAD is not set
CONFIG_TABLET_USB_AIPTEK=y
CONFIG_TABLET_USB_GTCO=y
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_WACOM=y
# CONFIG_INPUT_TOUCHSCREEN is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_PCSPKR is not set
# CONFIG_INPUT_APANEL is not set
CONFIG_INPUT_WISTRON_BTNS=y
CONFIG_INPUT_ATI_REMOTE=y
# CONFIG_INPUT_ATI_REMOTE2 is not set
CONFIG_INPUT_KEYSPAN_REMOTE=y
# CONFIG_INPUT_POWERMATE is not set
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
CONFIG_INPUT_UINPUT=y

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_CT82C710=y
CONFIG_SERIO_PARKBD=y
CONFIG_SERIO_PCIPS2=y
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
CONFIG_GAMEPORT=y
CONFIG_GAMEPORT_NS558=y
CONFIG_GAMEPORT_L4=y
CONFIG_GAMEPORT_EMU10K1=y
# CONFIG_GAMEPORT_FM801 is not set

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_COMPUTONE=y
# CONFIG_ROCKETPORT is not set
CONFIG_CYCLADES=y
CONFIG_CYZ_INTR=y
CONFIG_DIGIEPCA=y
CONFIG_MOXA_INTELLIO=y
CONFIG_MOXA_SMARTIO=y
CONFIG_ISI=y
CONFIG_SYNCLINK=y
CONFIG_SYNCLINKMP=y
# CONFIG_SYNCLINK_GT is not set
CONFIG_N_HDLC=y
CONFIG_RISCOM8=y
# CONFIG_SPECIALIX is not set
CONFIG_SX=y
# CONFIG_RIO is not set
CONFIG_STALDRV=y
CONFIG_STALLION=y
CONFIG_ISTALLION=y
CONFIG_NOZOMI=y

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
# CONFIG_SERIAL_8250_PCI is not set
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SERIAL_8250_MCA is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_SERIAL_JSM=y
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_PRINTER=y
# CONFIG_LP_CONSOLE is not set
CONFIG_PPDEV=y
# CONFIG_VIRTIO_CONSOLE is not set
CONFIG_IPMI_HANDLER=y
# CONFIG_IPMI_PANIC_EVENT is not set
# CONFIG_IPMI_DEVICE_INTERFACE is not set
CONFIG_IPMI_SI=y
CONFIG_IPMI_WATCHDOG=y
CONFIG_IPMI_POWEROFF=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_TIMERIOMEM=y
CONFIG_HW_RANDOM_INTEL=y
CONFIG_HW_RANDOM_AMD=y
CONFIG_HW_RANDOM_GEODE=y
# CONFIG_HW_RANDOM_VIA is not set
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_NVRAM=y
# CONFIG_RTC is not set
CONFIG_GEN_RTC=y
CONFIG_GEN_RTC_X=y
CONFIG_DTLK=y
CONFIG_R3964=y
CONFIG_APPLICOM=y
CONFIG_SONYPI=y
CONFIG_MWAVE=y
CONFIG_SCx200_GPIO=y
# CONFIG_PC8736x_GPIO is not set
CONFIG_NSC_GPIO=y
# CONFIG_CS5535_GPIO is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_HANGCHECK_TIMER is not set
# CONFIG_TCG_TPM is not set
CONFIG_TELCLOCK=y
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
# CONFIG_I2C_CHARDEV is not set
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCA=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
CONFIG_I2C_ALI1535=y
CONFIG_I2C_ALI1563=y
CONFIG_I2C_ALI15X3=y
CONFIG_I2C_AMD756=y
CONFIG_I2C_AMD8111=y
CONFIG_I2C_I801=y
CONFIG_I2C_ISCH=y
CONFIG_I2C_PIIX4=y
CONFIG_I2C_NFORCE2=y
CONFIG_I2C_SIS5595=y
CONFIG_I2C_SIS630=y
# CONFIG_I2C_SIS96X is not set
CONFIG_I2C_VIA=y
# CONFIG_I2C_VIAPRO is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
CONFIG_I2C_OCORES=y
CONFIG_I2C_SIMTEC=y

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT=y
CONFIG_I2C_PARPORT_LIGHT=y
CONFIG_I2C_TAOS_EVM=y
CONFIG_I2C_TINY_USB=y

#
# Graphics adapter I2C/DDC channel drivers
#
# CONFIG_I2C_VOODOO3 is not set

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_PCA_PLATFORM=y
# CONFIG_SCx200_I2C is not set
CONFIG_SCx200_ACB=y

#
# Miscellaneous I2C Chip support
#
CONFIG_DS1682=y
# CONFIG_SENSORS_PCF8574 is not set
CONFIG_PCF8575=y
CONFIG_SENSORS_PCA9539=y
CONFIG_SENSORS_TSL2550=y
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CHIP=y
# CONFIG_SPI is not set

#
# PPS support
#
# CONFIG_PPS is not set
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
CONFIG_W1=y
CONFIG_W1_CON=y

#
# 1-wire Bus Masters
#
CONFIG_W1_MASTER_MATROX=y
# CONFIG_W1_MASTER_DS2490 is not set
CONFIG_W1_MASTER_DS2482=y

#
# 1-wire Slaves
#
# CONFIG_W1_SLAVE_THERM is not set
CONFIG_W1_SLAVE_SMEM=y
CONFIG_W1_SLAVE_DS2431=y
CONFIG_W1_SLAVE_DS2433=y
# CONFIG_W1_SLAVE_DS2433_CRC is not set
CONFIG_W1_SLAVE_DS2760=y
# CONFIG_W1_SLAVE_BQ27000 is not set
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
CONFIG_PDA_POWER=y
CONFIG_BATTERY_DS2760=y
CONFIG_BATTERY_DS2782=y
# CONFIG_BATTERY_BQ27x00 is not set
CONFIG_BATTERY_DA9030=y
# CONFIG_BATTERY_MAX17040 is not set
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
# CONFIG_SENSORS_ABITUGURU is not set
CONFIG_SENSORS_ABITUGURU3=y
CONFIG_SENSORS_AD7414=y
CONFIG_SENSORS_AD7418=y
CONFIG_SENSORS_ADM1021=y
CONFIG_SENSORS_ADM1025=y
# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1029 is not set
CONFIG_SENSORS_ADM1031=y
# CONFIG_SENSORS_ADM9240 is not set
CONFIG_SENSORS_ADT7462=y
CONFIG_SENSORS_ADT7470=y
CONFIG_SENSORS_ADT7473=y
# CONFIG_SENSORS_ADT7475 is not set
# CONFIG_SENSORS_K8TEMP is not set
# CONFIG_SENSORS_ASB100 is not set
CONFIG_SENSORS_ATXP1=y
CONFIG_SENSORS_DS1621=y
CONFIG_SENSORS_I5K_AMB=y
CONFIG_SENSORS_F71805F=y
# CONFIG_SENSORS_F71882FG is not set
CONFIG_SENSORS_F75375S=y
# CONFIG_SENSORS_FSCHER is not set
CONFIG_SENSORS_FSCPOS=y
# CONFIG_SENSORS_FSCHMD is not set
# CONFIG_SENSORS_G760A is not set
# CONFIG_SENSORS_GL518SM is not set
CONFIG_SENSORS_GL520SM=y
CONFIG_SENSORS_CORETEMP=y
# CONFIG_SENSORS_IBMAEM is not set
CONFIG_SENSORS_IBMPEX=y
CONFIG_SENSORS_IT87=y
CONFIG_SENSORS_LM63=y
CONFIG_SENSORS_LM75=y
CONFIG_SENSORS_LM77=y
CONFIG_SENSORS_LM78=y
CONFIG_SENSORS_LM80=y
CONFIG_SENSORS_LM83=y
CONFIG_SENSORS_LM85=y
CONFIG_SENSORS_LM87=y
# CONFIG_SENSORS_LTC4215 is not set
CONFIG_SENSORS_LTC4245=y
CONFIG_SENSORS_LM95241=y
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX6650 is not set
CONFIG_SENSORS_PC87360=y
CONFIG_SENSORS_PC87427=y
CONFIG_SENSORS_PCF8591=y
CONFIG_SENSORS_SIS5595=y
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
CONFIG_SENSORS_SMSC47M192=y
CONFIG_SENSORS_SMSC47B397=y
CONFIG_SENSORS_ADS7828=y
CONFIG_SENSORS_THMC50=y
CONFIG_SENSORS_TMP401=y
CONFIG_SENSORS_VIA686A=y
CONFIG_SENSORS_VT1211=y
CONFIG_SENSORS_VT8231=y
# CONFIG_SENSORS_W83781D is not set
CONFIG_SENSORS_W83791D=y
CONFIG_SENSORS_W83792D=y
# CONFIG_SENSORS_W83793 is not set
CONFIG_SENSORS_W83L785TS=y
CONFIG_SENSORS_W83L786NG=y
CONFIG_SENSORS_W83627HF=y
CONFIG_SENSORS_W83627EHF=y
CONFIG_SENSORS_HDAPS=y
CONFIG_SENSORS_APPLESMC=y
# CONFIG_HWMON_DEBUG_CHIP is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_HWMON=y
# CONFIG_WATCHDOG is not set
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
CONFIG_SSB=y
CONFIG_SSB_SPROM=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
# CONFIG_SSB_B43_PCI_BRIDGE is not set
CONFIG_SSB_SILENT=y
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
CONFIG_MFD_SM501=y
# CONFIG_HTC_PASIC3 is not set
# CONFIG_TWL4030_CORE is not set
# CONFIG_MFD_TMIO is not set
CONFIG_PMIC_DA903X=y
CONFIG_MFD_WM8400=y
# CONFIG_MFD_PCF50633 is not set
CONFIG_AB3100_CORE=y
CONFIG_REGULATOR=y
# CONFIG_REGULATOR_DEBUG is not set
# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
CONFIG_REGULATOR_USERSPACE_CONSUMER=y
CONFIG_REGULATOR_BQ24022=y
# CONFIG_REGULATOR_MAX1586 is not set
CONFIG_REGULATOR_WM8400=y
CONFIG_REGULATOR_DA903X=y
CONFIG_REGULATOR_LP3971=y
CONFIG_MEDIA_SUPPORT=y

#
# Multimedia core support
#
# CONFIG_VIDEO_DEV is not set
# CONFIG_DVB_CORE is not set
# CONFIG_VIDEO_MEDIA is not set

#
# Multimedia drivers
#
# CONFIG_DAB is not set

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_ALI=y
CONFIG_AGP_ATI=y
# CONFIG_AGP_AMD is not set
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
# CONFIG_AGP_NVIDIA is not set
CONFIG_AGP_SIS=y
# CONFIG_AGP_SWORKS is not set
# CONFIG_AGP_VIA is not set
CONFIG_AGP_EFFICEON=y
CONFIG_DRM=y
CONFIG_DRM_TDFX=y
CONFIG_DRM_R128=y
# CONFIG_DRM_RADEON is not set
CONFIG_DRM_I810=y
# CONFIG_DRM_I830 is not set
# CONFIG_DRM_I915 is not set
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_SIS is not set
# CONFIG_DRM_VIA is not set
CONFIG_DRM_SAVAGE=y
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
# CONFIG_FB is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set

#
# Display device support
#
CONFIG_DISPLAY_SUPPORT=y

#
# Display hardware drivers
#

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_SOUND is not set
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
# CONFIG_HID_DEBUG is not set
# CONFIG_HIDRAW is not set

#
# USB Input Devices
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
CONFIG_USB_MOUSE=y

#
# Special HID drivers
#
CONFIG_HID_A4TECH=y
CONFIG_HID_APPLE=y
# CONFIG_HID_BELKIN is not set
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
# CONFIG_HID_CYPRESS is not set
# CONFIG_HID_DRAGONRISE is not set
CONFIG_HID_EZKEY=y
CONFIG_HID_KYE=y
# CONFIG_HID_GYRATION is not set
# CONFIG_HID_KENSINGTON is not set
CONFIG_HID_LOGITECH=y
CONFIG_LOGITECH_FF=y
# CONFIG_LOGIRUMBLEPAD2_FF is not set
# CONFIG_HID_MICROSOFT is not set
CONFIG_HID_MONTEREY=y
CONFIG_HID_NTRIG=y
CONFIG_HID_PANTHERLORD=y
CONFIG_PANTHERLORD_FF=y
# CONFIG_HID_PETALYNX is not set
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_GREENASIA=y
CONFIG_GREENASIA_FF=y
CONFIG_HID_SMARTJOYPLUS=y
CONFIG_SMARTJOYPLUS_FF=y
# CONFIG_HID_TOPSEED is not set
CONFIG_HID_THRUSTMASTER=y
# CONFIG_THRUSTMASTER_FF is not set
CONFIG_HID_ZEROPLUS=y
CONFIG_ZEROPLUS_FF=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

#
# Miscellaneous USB options
#
# CONFIG_USB_DEVICEFS is not set
CONFIG_USB_DEVICE_CLASS=y
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_OTG is not set
CONFIG_USB_OTG_WHITELIST=y
# CONFIG_USB_OTG_BLACKLIST_HUB is not set
CONFIG_USB_MON=y
# CONFIG_USB_WUSB is not set
# CONFIG_USB_WUSB_CBAF is not set

#
# USB Host Controller Drivers
#
CONFIG_USB_C67X00_HCD=y
# CONFIG_USB_XHCI_HCD is not set
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_OHCI_HCD=y
# CONFIG_USB_OHCI_HCD_SSB is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_UHCI_HCD=y
# CONFIG_USB_U132_HCD is not set
CONFIG_USB_SL811_HCD=y
CONFIG_USB_R8A66597_HCD=y
# CONFIG_USB_HWA_HCD is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=y
CONFIG_USB_WDM=y
CONFIG_USB_TMC=y

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=y
# CONFIG_USB_STORAGE_USBAT is not set
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
CONFIG_USB_STORAGE_ALAUDA=y
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
# CONFIG_USB_LIBUSUAL is not set

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y

#
# USB port drivers
#
CONFIG_USB_USS720=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_EZUSB=y
# CONFIG_USB_SERIAL_GENERIC is not set
# CONFIG_USB_SERIAL_AIRCABLE is not set
CONFIG_USB_SERIAL_ARK3116=y
CONFIG_USB_SERIAL_BELKIN=y
CONFIG_USB_SERIAL_CH341=y
CONFIG_USB_SERIAL_WHITEHEAT=y
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=y
# CONFIG_USB_SERIAL_CP210X is not set
CONFIG_USB_SERIAL_CYPRESS_M8=y
# CONFIG_USB_SERIAL_EMPEG is not set
CONFIG_USB_SERIAL_FTDI_SIO=y
# CONFIG_USB_SERIAL_FUNSOFT is not set
CONFIG_USB_SERIAL_VISOR=y
CONFIG_USB_SERIAL_IPAQ=y
CONFIG_USB_SERIAL_IR=y
CONFIG_USB_SERIAL_EDGEPORT=y
CONFIG_USB_SERIAL_EDGEPORT_TI=y
# CONFIG_USB_SERIAL_GARMIN is not set
CONFIG_USB_SERIAL_IPW=y
CONFIG_USB_SERIAL_IUU=y
CONFIG_USB_SERIAL_KEYSPAN_PDA=y
# CONFIG_USB_SERIAL_KEYSPAN is not set
# CONFIG_USB_SERIAL_KLSI is not set
# CONFIG_USB_SERIAL_KOBIL_SCT is not set
CONFIG_USB_SERIAL_MCT_U232=y
CONFIG_USB_SERIAL_MOS7720=y
CONFIG_USB_SERIAL_MOS7840=y
CONFIG_USB_SERIAL_MOTOROLA=y
# CONFIG_USB_SERIAL_NAVMAN is not set
# CONFIG_USB_SERIAL_PL2303 is not set
CONFIG_USB_SERIAL_OTI6858=y
# CONFIG_USB_SERIAL_QUALCOMM is not set
# CONFIG_USB_SERIAL_SPCP8X5 is not set
# CONFIG_USB_SERIAL_HP4X is not set
# CONFIG_USB_SERIAL_SAFE is not set
CONFIG_USB_SERIAL_SIEMENS_MPI=y
CONFIG_USB_SERIAL_SIERRAWIRELESS=y
# CONFIG_USB_SERIAL_SYMBOL is not set
# CONFIG_USB_SERIAL_TI is not set
# CONFIG_USB_SERIAL_CYBERJACK is not set
# CONFIG_USB_SERIAL_XIRCOM is not set
# CONFIG_USB_SERIAL_OPTION is not set
CONFIG_USB_SERIAL_OMNINET=y
CONFIG_USB_SERIAL_OPTICON=y
# CONFIG_USB_SERIAL_DEBUG is not set

#
# USB Miscellaneous drivers
#
CONFIG_USB_EMI62=y
CONFIG_USB_EMI26=y
CONFIG_USB_ADUTUX=y
# CONFIG_USB_SEVSEG is not set
CONFIG_USB_RIO500=y
CONFIG_USB_LEGOTOWER=y
# CONFIG_USB_LCD is not set
CONFIG_USB_BERRY_CHARGE=y
# CONFIG_USB_LED is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
CONFIG_USB_CYTHERM=y
# CONFIG_USB_IDMOUSE is not set
CONFIG_USB_FTDI_ELAN=y
# CONFIG_USB_APPLEDISPLAY is not set
CONFIG_USB_SISUSBVGA=y
# CONFIG_USB_SISUSBVGA_CON is not set
# CONFIG_USB_LD is not set
CONFIG_USB_TRANCEVIBRATOR=y
CONFIG_USB_IOWARRIOR=y
CONFIG_USB_TEST=y
CONFIG_USB_ISIGHTFW=y
# CONFIG_USB_VST is not set
# CONFIG_USB_ATM is not set

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=y
# CONFIG_UWB is not set
# CONFIG_MMC is not set
CONFIG_MEMSTICK=y
CONFIG_MEMSTICK_DEBUG=y

#
# MemoryStick drivers
#
CONFIG_MEMSTICK_UNSAFE_RESUME=y
CONFIG_MSPRO_BLOCK=y

#
# MemoryStick Host Controller Drivers
#
CONFIG_MEMSTICK_TIFM_MS=y
# CONFIG_MEMSTICK_JMICRON_38X is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
# CONFIG_LEDS_NET48XX is not set
CONFIG_LEDS_WRAP=y
CONFIG_LEDS_ALIX2=y
# CONFIG_LEDS_PCA9532 is not set
CONFIG_LEDS_LP3944=y
CONFIG_LEDS_CLEVO_MAIL=y
CONFIG_LEDS_PCA955X=y
# CONFIG_LEDS_DA903X is not set
CONFIG_LEDS_BD2802=y

#
# LED Triggers
#
# CONFIG_LEDS_TRIGGERS is not set
CONFIG_ACCESSIBILITY=y
CONFIG_A11Y_BRAILLE_CONSOLE=y
CONFIG_INFINIBAND=y
# CONFIG_INFINIBAND_USER_MAD is not set
# CONFIG_INFINIBAND_USER_ACCESS is not set
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_MTHCA=y
CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_AMSO1100=y
CONFIG_INFINIBAND_AMSO1100_DEBUG=y
CONFIG_INFINIBAND_CXGB3=y
# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
CONFIG_MLX4_INFINIBAND=y
CONFIG_INFINIBAND_NES=y
# CONFIG_INFINIBAND_NES_DEBUG is not set
CONFIG_INFINIBAND_IPOIB=y
CONFIG_INFINIBAND_IPOIB_CM=y
CONFIG_INFINIBAND_IPOIB_DEBUG=y
CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
CONFIG_INFINIBAND_SRP=y
CONFIG_INFINIBAND_ISER=y
CONFIG_EDAC=y

#
# Reporting subsystems
#
# CONFIG_EDAC_DEBUG is not set
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_AMD76X=y
# CONFIG_EDAC_E7XXX is not set
# CONFIG_EDAC_E752X is not set
# CONFIG_EDAC_I82875P is not set
CONFIG_EDAC_I82975X=y
CONFIG_EDAC_I3000=y
CONFIG_EDAC_X38=y
# CONFIG_EDAC_I5400 is not set
CONFIG_EDAC_I82860=y
CONFIG_EDAC_R82600=y
CONFIG_EDAC_I5000=y
CONFIG_EDAC_I5100=y
# CONFIG_RTC_CLASS is not set
CONFIG_DMADEVICES=y

#
# DMA Devices
#
CONFIG_INTEL_IOATDMA=y
CONFIG_DMA_ENGINE=y

#
# DMA Clients
#
# CONFIG_NET_DMA is not set
CONFIG_ASYNC_TX_DMA=y
CONFIG_DMATEST=y
CONFIG_DCA=y
CONFIG_AUXDISPLAY=y
CONFIG_KS0108=y
CONFIG_KS0108_PORT=0x378
CONFIG_KS0108_DELAY=2
CONFIG_UIO=y
CONFIG_UIO_CIF=y
# CONFIG_UIO_PDRV is not set
CONFIG_UIO_PDRV_GENIRQ=y
CONFIG_UIO_SMX=y
# CONFIG_UIO_AEC is not set
CONFIG_UIO_SERCOS3=y

#
# TI VLYNQ
#
# CONFIG_X86_PLATFORM_DEVICES is not set

#
# Firmware Drivers
#
# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_DELL_RBU=y
CONFIG_DCDBAS=y
CONFIG_DMIID=y
CONFIG_ISCSI_IBFT_FIND=y
# CONFIG_ISCSI_IBFT is not set

#
# File systems
#
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
CONFIG_EXT2_FS_XIP=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
# CONFIG_EXT4_FS is not set
CONFIG_FS_XIP=y
CONFIG_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
CONFIG_REISERFS_CHECK=y
CONFIG_REISERFS_PROC_INFO=y
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
# CONFIG_REISERFS_FS_SECURITY is not set
CONFIG_JFS_FS=y
CONFIG_JFS_POSIX_ACL=y
CONFIG_JFS_SECURITY=y
CONFIG_JFS_DEBUG=y
CONFIG_JFS_STATISTICS=y
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
# CONFIG_XFS_QUOTA is not set
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
CONFIG_XFS_DEBUG=y
# CONFIG_OCFS2_FS is not set
CONFIG_BTRFS_FS=y
# CONFIG_BTRFS_FS_POSIX_ACL is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
# CONFIG_DNOTIFY is not set
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_PRINT_QUOTA_WARNING is not set
CONFIG_QUOTA_TREE=y
# CONFIG_QFMT_V1 is not set
CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_CUSE=y
CONFIG_GENERIC_ACL=y

#
# Caches
#
CONFIG_FSCACHE=y
CONFIG_FSCACHE_STATS=y
CONFIG_FSCACHE_HISTOGRAM=y
CONFIG_FSCACHE_DEBUG=y
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set
CONFIG_CACHEFILES_HISTOGRAM=y

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
# CONFIG_UDF_FS is not set

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_NTFS_FS=y
CONFIG_NTFS_DEBUG=y
CONFIG_NTFS_RW=y

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not set
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_CONFIGFS_FS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_EXPORTFS=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
# CONFIG_ACORN_PARTITION_CUMANA is not set
CONFIG_ACORN_PARTITION_EESOX=y
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
# CONFIG_ACORN_PARTITION_POWERTEC is not set
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
CONFIG_ATARI_PARTITION=y
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
# CONFIG_LDM_PARTITION is not set
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
# CONFIG_SUN_PARTITION is not set
CONFIG_KARMA_PARTITION=y
# CONFIG_EFI_PARTITION is not set
CONFIG_SYSV68_PARTITION=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_737=y
CONFIG_NLS_CODEPAGE_775=y
CONFIG_NLS_CODEPAGE_850=y
CONFIG_NLS_CODEPAGE_852=y
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
CONFIG_NLS_CODEPAGE_860=y
CONFIG_NLS_CODEPAGE_861=y
# CONFIG_NLS_CODEPAGE_862 is not set
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
CONFIG_NLS_CODEPAGE_869=y
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
# CONFIG_NLS_CODEPAGE_932 is not set
CONFIG_NLS_CODEPAGE_949=y
# CONFIG_NLS_CODEPAGE_874 is not set
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
# CONFIG_NLS_CODEPAGE_1251 is not set
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_2=y
CONFIG_NLS_ISO8859_3=y
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
CONFIG_NLS_ISO8859_6=y
CONFIG_NLS_ISO8859_7=y
CONFIG_NLS_ISO8859_9=y
CONFIG_NLS_ISO8859_13=y
CONFIG_NLS_ISO8859_14=y
CONFIG_NLS_ISO8859_15=y
CONFIG_NLS_KOI8_R=y
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_UTF8=y
CONFIG_DLM=y
CONFIG_DLM_DEBUG=y

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
# CONFIG_PRINTK_TIME is not set
CONFIG_ALLOW_WARNINGS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
CONFIG_UNUSED_SYMBOLS=y
CONFIG_DEBUG_FS=y
CONFIG_HEADERS_CHECK=y
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_SHIRQ=y
CONFIG_DETECT_SOFTLOCKUP=y
# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
# CONFIG_DETECT_HUNG_TASK is not set
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
# CONFIG_TIMER_STATS is not set
CONFIG_DEBUG_OBJECTS=y
CONFIG_DEBUG_OBJECTS_SELFTEST=y
CONFIG_DEBUG_OBJECTS_FREE=y
CONFIG_DEBUG_OBJECTS_TIMERS=y
CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_SLUB_STATS is not set
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_PI_LIST=y
CONFIG_RT_MUTEX_TESTER=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_HIGHMEM is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VIRTUAL=y
CONFIG_DEBUG_WRITECOUNT=y
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_DEBUG_LIST is not set
CONFIG_DEBUG_SG=y
CONFIG_DEBUG_NOTIFIERS=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
CONFIG_BOOT_PRINTK_DELAY=y
CONFIG_RCU_TORTURE_TEST=y
CONFIG_RCU_TORTURE_TEST_RUNNABLE=y
CONFIG_RCU_CPU_STALL_DETECTOR=y
# CONFIG_BACKTRACE_SELF_TEST is not set
CONFIG_FAULT_INJECTION=y
# CONFIG_FAILSLAB is not set
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAIL_MAKE_REQUEST=y
# CONFIG_FAIL_IO_TIMEOUT is not set
CONFIG_FAULT_INJECTION_DEBUG_FS=y
CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
CONFIG_LATENCYTOP=y
# CONFIG_SYSCTL_SYSCALL_CHECK is not set
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=y
CONFIG_HAVE_FTRACE_NMI_ENTER=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_FTRACE_SYSCALLS=y
CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_FTRACE_NMI_ENTER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
CONFIG_FUNCTION_TRACER=y
# CONFIG_IRQSOFF_TRACER is not set
CONFIG_SYSPROF_TRACER=y
CONFIG_SCHED_TRACER=y
CONFIG_FTRACE_SYSCALLS=y
# CONFIG_BOOT_TRACER is not set
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
# CONFIG_POWER_TRACER is not set
# CONFIG_KSYM_TRACER is not set
CONFIG_STACK_TRACER=y
CONFIG_KMEMTRACE=y
# CONFIG_WORKQUEUE_TRACER is not set
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_DYNAMIC_FTRACE=y
# CONFIG_FUNCTION_PROFILER is not set
CONFIG_FTRACE_MCOUNT_RECORD=y
# CONFIG_FTRACE_STARTUP_TEST is not set
# CONFIG_MMIOTRACE is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
# CONFIG_FIREWIRE_OHCI_REMOTE_DMA is not set
CONFIG_BUILD_DOCSRC=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DMA_API_DEBUG=y
CONFIG_SAMPLES=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
# CONFIG_KGDB_SERIAL_CONSOLE is not set
CONFIG_KGDB_TESTS=y
CONFIG_HAVE_ARCH_KMEMCHECK=y
# CONFIG_STRICT_DEVMEM is not set
# CONFIG_X86_VERBOSE_BOOTUP is not set
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
# CONFIG_DEBUG_STACKOVERFLOW is not set
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_PER_CPU_MAPS=y
# CONFIG_X86_PTDUMP is not set
# CONFIG_DEBUG_RODATA is not set
# CONFIG_4KSTACKS is not set
CONFIG_DOUBLEFAULT=y
# CONFIG_IOMMU_STRESS is not set
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
CONFIG_IO_DELAY_TYPE_0X80=0
CONFIG_IO_DELAY_TYPE_0XED=1
CONFIG_IO_DELAY_TYPE_UDELAY=2
CONFIG_IO_DELAY_TYPE_NONE=3
CONFIG_IO_DELAY_0X80=y
# CONFIG_IO_DELAY_0XED is not set
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEFAULT_IO_DELAY_TYPE=0
CONFIG_DEBUG_BOOT_PARAMS=y
# CONFIG_CPA_DEBUG is not set
# CONFIG_OPTIMIZE_INLINING is not set

#
# Security options
#
CONFIG_KEYS=y
# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
# CONFIG_SECURITY_NETWORK is not set
CONFIG_SECURITY_PATH=y
CONFIG_SECURITY_FILE_CAPABILITIES=y
CONFIG_SECURITY_TOMOYO=y
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_FIPS=y
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_PCOMP=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_NULL=y
CONFIG_CRYPTO_WORKQUEUE=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y

#
# Authenticated Encryption with Associated Data
#
CONFIG_CRYPTO_CCM=y
# CONFIG_CRYPTO_GCM is not set
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
# CONFIG_CRYPTO_CBC is not set
CONFIG_CRYPTO_CTR=y
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=y

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_XCBC=y

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32C_INTEL=y
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
# CONFIG_CRYPTO_RMD128 is not set
CONFIG_CRYPTO_RMD160=y
CONFIG_CRYPTO_RMD256=y
CONFIG_CRYPTO_RMD320=y
CONFIG_CRYPTO_SHA1=y
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_TGR192 is not set
CONFIG_CRYPTO_WP512=y

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_586=y
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_BLOWFISH is not set
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_CAST5=y
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_FCRYPT=y
CONFIG_CRYPTO_KHAZAD=y
# CONFIG_CRYPTO_SALSA20 is not set
# CONFIG_CRYPTO_SALSA20_586 is not set
# CONFIG_CRYPTO_SEED is not set
CONFIG_CRYPTO_SERPENT=y
# CONFIG_CRYPTO_TEA is not set
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
CONFIG_CRYPTO_TWOFISH_586=y

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=y
# CONFIG_CRYPTO_LZO is not set

#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_HW=y
# CONFIG_CRYPTO_DEV_PADLOCK is not set
# CONFIG_CRYPTO_DEV_GEODE is not set
CONFIG_CRYPTO_DEV_HIFN_795X=y
CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_INTEL=y
# CONFIG_KVM_AMD is not set
# CONFIG_KVM_TRACE is not set
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
# CONFIG_VIRTIO_PCI is not set
CONFIG_VIRTIO_BALLOON=y
CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_BITREVERSE=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_FIND_LAST_BIT=y
CONFIG_CRC_CCITT=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
CONFIG_CRC7=y
CONFIG_LIBCRC32C=y
CONFIG_AUDIT_GENERIC=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=y
CONFIG_CPUMASK_OFFSTACK=y
CONFIG_NLATTR=y
CONFIG_FORCE_SUCCESSFUL_BUILD=y
CONFIG_FORCE_MINIMAL_CONFIG=y
CONFIG_FORCE_MINIMAL_CONFIG_PHYS=y
CONFIG_X86_32_ALWAYS_ON=y

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 19:39                     ` Andrew Morton
@ 2009-08-02 20:41                       ` Ingo Molnar
  2009-08-02 21:08                         ` Andrew Morton
  2009-08-02 20:46                       ` [tip:core/debug] debug lockups: Improve lockup detection Ingo Molnar
  1 sibling, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-02 20:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Sun, 2 Aug 2009 21:26:57 +0200 Ingo Molnar <mingo@elte.hu> wrote:
> 
> > > I think this just broke all non-x86 non-sparc SMP architectures.
> > 
> > Yeah - it 'broke' them in the sense of them not having a working 
> > trigger_all_cpu_backtrace() implementation to begin with.
> 
> c'mon.  It broke them in the sense that sysrq-l went from "works" 
> to "doesn't work".

You are right (i broke it with my patch) but the thing is, sysrq-l 
almost useless currently: it uses schedule_work() which assumes a 
mostly working system with full irqs and scheduling working fine. 
Now, i dont need sysrq-l on mostly working systems.

So the 'breakage' is of something that was largely useless: and now 
you put the onus of implementing it for _all_ architectures (which i 
dont use) on me?

If that's the requirement then i'll have to keep this as a local 
debug hack and not do an upstream solution - i dont have the 
resources to do it for all ~10 SMP architectures.

sysrq-l has been messed up really and now that messup limits the 
adoption of the much more useful solution? I didnt make this thing 
up, i tried to use it on a locked up system and wondered why it 
emits nothing and why it uses a separate facility instead of an 
existing trigger-backtraces facility (which the spinlock-debug code 
uses).

> It would take months for the relevant arch maintainers to even 
> find out about this, after which they're left with dud kernels out 
> in the field.
> 
> It's better to break the build or to emit warnings than to 
> silently and secretly break their stuff.

But that warning will bounce the ball back to me, wont it? My patch 
will be blamed for 'breaking' those architectures, right?

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 19:39                     ` Andrew Morton
  2009-08-02 20:41                       ` Ingo Molnar
@ 2009-08-02 20:46                       ` Ingo Molnar
  1 sibling, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-02 20:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits


* Andrew Morton <akpm@linux-foundation.org> wrote:

>  #ifndef trigger_all_cpu_backtrace
> +#ifdef CONFIG_SMP
> +#warning This architecture is missing a trigger_all_cpu_backtrace() implementation
> +#endif
>  #define trigger_all_cpu_backtrace() do { } while (0)
>  #endif

I think a better solution will be to make this function return 1 if 
it generated a backtrace.

That way we can fall back to the generic schedule_work based 
codepath.

Albeit the best and cleanest solution would be to implement a 
workqueue based trigger_all_cpu_backtrace() __weak variant and throw 
away the workqueue bits from sysrq.c.

	Ingo


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 20:41                       ` Ingo Molnar
@ 2009-08-02 21:08                         ` Andrew Morton
  2009-08-03  7:59                           ` Ingo Molnar
  2009-08-03  8:12                           ` [tip:core/debug] debug lockups: Improve lockup detection, fix generic arch fallback tip-bot for Ingo Molnar
  0 siblings, 2 replies; 1149+ messages in thread
From: Andrew Morton @ 2009-08-02 21:08 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits

On Sun, 2 Aug 2009 22:41:50 +0200 Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Sun, 2 Aug 2009 21:26:57 +0200 Ingo Molnar <mingo@elte.hu> wrote:
> > 
> > > > I think this just broke all non-x86 non-sparc SMP architectures.
> > > 
> > > Yeah - it 'broke' them in the sense of them not having a working 
> > > trigger_all_cpu_backtrace() implementation to begin with.
> > 
> > c'mon.  It broke them in the sense that sysrq-l went from "works" 
> > to "doesn't work".
> 
> You are right (i broke it with my patch) but the thing is, sysrq-l 
> almost useless currently: it uses schedule_work() which assumes a 
> mostly working system with full irqs and scheduling working fine. 
> Now, i dont need sysrq-l on mostly working systems.
> 
> So the 'breakage' is of something that was largely useless: and now 
> you put the onus of implementing it for _all_ architectures (which i 
> dont use) on me?

I never said that.

It's appropriate that those architectures be left with their existing
level of functionality/usefulness, as you're already discussing.

> > It's better to break the build or to emit warnings than to 
> > silently and secretly break their stuff.
> 
> But that warning will bounce the ball back to me, wont it? My patch 
> will be blamed for 'breaking' those architectures, right?

It's a very crude and somewhat rude way of communicating information to
other architecture maintainers.

A better way would be to send them an email explaining the problem and
outlining some solutions, no?

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-02 20:27                 ` Ingo Molnar
@ 2009-08-02 22:13                   ` Paul E. McKenney
  2009-08-03  5:15                     ` Paul E. McKenney
                                       ` (2 more replies)
  0 siblings, 3 replies; 1149+ messages in thread
From: Paul E. McKenney @ 2009-08-02 22:13 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits, ego

On Sun, Aug 02, 2009 at 10:27:20PM +0200, Ingo Molnar wrote:
> 
> * tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> 
> > Commit-ID:  7256cf0e83bf018be8a81806593aaef7f2437f0b
> > Gitweb:     http://git.kernel.org/tip/7256cf0e83bf018be8a81806593aaef7f2437f0b
> > Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > AuthorDate: Sun, 2 Aug 2009 10:21:10 -0700
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sun, 2 Aug 2009 21:31:28 +0200
> > 
> > rcu: Add diagnostic check for a possible CPU-hotplug race
> > 
> > Complain if the RCU softirq code ever runs on a CPU that has
> > not yet been announced to RCU as being online.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> FYI, the new warning triggered in -tip testing:

Yow!!!  I never was able to get this to trigger...  Of course, I never
was able to reproduce the original problem, either.

Just so you know, one of the reasons it took me so long to come up with
the fix is that this just isn't supposed to happen.  Where I grew up, CPUs
were supposed to come online -before- starting to handle softirqs.  ;-)

Here is my reasoning:

o	rcu_init(), which is invoked before a second CPU can possibly
	come online, calls hotplug_notifier(), which causes
	rcu_barrier_cpu_hotplug() to be invoked in response to any
	CPU-hotplug event.

o	We know rcu_init() really was called, because otherwise
	open_softirq(RCU_SOFTIRQ) never gets called, so the softirq would
	never have happened.  In addition, there should be a "Hierarchical
	RCU implementation" message in your bootlog.  (Is there?)

o	rcu_barrier_cpu_hotplug() unconditionally invokes
	rcu_cpu_notify() on every CPU-hotplug event.

o	rcu_cpu_notify() invokes rcu_online_cpu() in response to
	any CPU_UP_PREPARE or CPU_UP_PREPARE_FROZEN CPU-hotplug
	event.

o	The CPU_UP_PREPARE and CPU_UP_PREPARE_FROZEN CPU-hotplug events
	happen before the CPU in question is capable of running any code.

o	This looks to be the first onlining of this CPU during boot
	(right?).  So we cannot possibly have some strange situation
	where the end of the prior CPU-offline event overlaps with
	the current CPU-online event.  (Yes, this isn't supposed to
	happen courtesy of CPU-hotplug locking, but impossibility
	is clearly no reason to dismiss possible scenarios for -this-
	particular bug.)

o	Therefore the WARN_ON_ONCE() cannot possibly trigger.

This would be a convincing argument, aside from the fact that you
really did make it trigger.  So first, anything I am missing in
the above?  If not, could you please help me with the following,
at least if the answers are readily available?

o	Is rcu_init()'s "Hierarchical RCU implementation" log message
	in your bootlog?

o	Is _cpu_up() really being called, and, if so, is it really
	invoking __raw_notifier_call_chain() with CPU_UP_PREPARE?

o	Is this really during initial boot, or am I misreading your
	bootlog?  (The other reason I believe that this happened on
	the first CPU-online for this CPU is that ->beenonline, once
	set, is never cleared.)

Gautham, any thoughts on what might be happening here?

							Thanx, Paul

> calling  tracer_alloc_buffers+0x0/0x296 @ 1
> initcall tracer_alloc_buffers+0x0/0x296 returned 0 after 0 usecs
> calling  init_trace_printk+0x0/0x7 @ 1
> initcall init_trace_printk+0x0/0x7 returned 0 after 0 usecs
> lockdep: fixing up alternatives.
> Booting processor 1 APIC 0x1 ip 0x6000
> Initializing CPU#1
> masked ExtINT on CPU#1
> Calibrating delay using timer specific routine.. 4021.85 BogoMIPS (lpj=6700572)
> CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
> CPU: L2 Cache: 512K (64 bytes/line)
> CPU: Physical Processor ID: 0
> CPU: Processor Core ID: 1
> mce: CPU supports 5 MCE banks
> CPU1: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
> Brought up 2 CPUs
> Total of 2 processors activated (8043.58 BogoMIPS).
> ------------[ cut here ]------------
> WARNING: at kernel/rcutree.c:1140 __rcu_process_callbacks+0x2c/0xb9()
> Hardware name: System Product Name
> Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip #280
> Call Trace:
>  [<c105229d>] warn_slowpath_common+0x60/0x90
>  [<c10522df>] warn_slowpath_null+0x12/0x15
>  [<c1091f70>] __rcu_process_callbacks+0x2c/0xb9
>  [<c1092021>] rcu_process_callbacks+0x24/0x42
>  [<c105737c>] __do_softirq+0xbc/0x16f
>  [<c105746a>] do_softirq+0x3b/0x5f
>  [<c10575c2>] irq_exit+0x3a/0x6d
>  [<c10318cb>] smp_apic_timer_interrupt+0x74/0x82
>  [<c101f0af>] apic_timer_interrupt+0x2f/0x40
>  [<c101d7c2>] ? cpu_idle+0x77/0x99
>  [<c10370e0>] ? native_safe_halt+0xa/0xc
>  [<c10248cf>] default_idle+0x80/0xd1
>  [<c101d7c8>] cpu_idle+0x7d/0x99
>  [<c1f806f1>] start_secondary+0xf7/0xf9
> ---[ end trace 4eaa2a86a8e2da22 ]---
> CPU0 attaching sched-domain:
>  domain 0: span 0-1 level MC
>   groups: 0 1
> CPU1 attaching sched-domain:
>  domain 0: span 0-1 level MC
>   groups: 1 0
> device: 'platform': device_add
> khelper used greatest stack depth: 6632 bytes left
> bus: 'platform': registered
> Registering sysdev class 'cpu'
> calling  init_cpufreq_transition_notifier_list+0x0/0x18 @ 1
> initcall init_cpufreq_transition_notifier_list+0x0/0x18 returned 0 after 0 usecs
> calling  net_ns_init+0x0/0x120 @ 1
> initcall net_ns_init+0x0/0x120 returned 0 after 0 usecs
> 
> with the attached config.
> 
> 	Ingo

> #
> # Automatically generated make config: don't edit
> # Linux kernel version: 2.6.31-rc5
> # Sun Aug  2 22:16:02 2009
> #
> # CONFIG_64BIT is not set
> CONFIG_X86_32=y
> # CONFIG_X86_64 is not set
> CONFIG_X86=y
> CONFIG_OUTPUT_FORMAT="elf32-i386"
> CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
> CONFIG_GENERIC_TIME=y
> CONFIG_GENERIC_CMOS_UPDATE=y
> CONFIG_CLOCKSOURCE_WATCHDOG=y
> CONFIG_GENERIC_CLOCKEVENTS=y
> CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
> CONFIG_LOCKDEP_SUPPORT=y
> CONFIG_STACKTRACE_SUPPORT=y
> CONFIG_HAVE_LATENCYTOP_SUPPORT=y
> CONFIG_FAST_CMPXCHG_LOCAL=y
> CONFIG_MMU=y
> CONFIG_ZONE_DMA=y
> CONFIG_GENERIC_ISA_DMA=y
> CONFIG_GENERIC_IOMAP=y
> CONFIG_GENERIC_BUG=y
> CONFIG_GENERIC_HWEIGHT=y
> CONFIG_ARCH_MAY_HAVE_PC_FDC=y
> # CONFIG_RWSEM_GENERIC_SPINLOCK is not set
> CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> # CONFIG_GENERIC_TIME_VSYSCALL is not set
> CONFIG_ARCH_HAS_CPU_RELAX=y
> CONFIG_ARCH_HAS_DEFAULT_IDLE=y
> CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
> CONFIG_HAVE_SETUP_PER_CPU_AREA=y
> CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y
> # CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set
> CONFIG_ARCH_HIBERNATION_POSSIBLE=y
> CONFIG_ARCH_SUSPEND_POSSIBLE=y
> # CONFIG_ZONE_DMA32 is not set
> CONFIG_ARCH_POPULATES_NODE_MAP=y
> # CONFIG_AUDIT_ARCH is not set
> CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
> CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
> CONFIG_GENERIC_HARDIRQS=y
> CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
> CONFIG_GENERIC_IRQ_PROBE=y
> CONFIG_GENERIC_PENDING_IRQ=y
> CONFIG_USE_GENERIC_SMP_HELPERS=y
> CONFIG_X86_32_SMP=y
> CONFIG_X86_HT=y
> CONFIG_X86_TRAMPOLINE=y
> CONFIG_X86_32_LAZY_GS=y
> CONFIG_KTIME_SCALAR=y
> # CONFIG_BOOTPARAM_SUPPORT_NOT_WANTED is not set
> # CONFIG_BOOTPARAM_SUPPORT is not set
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> CONFIG_CONSTRUCTORS=y
> 
> #
> # General setup
> #
> CONFIG_EXPERIMENTAL=y
> CONFIG_BROKEN_BOOT_ALLOWED4=y
> # CONFIG_BROKEN_BOOT_ALLOWED3 is not set
> CONFIG_BROKEN_BOOT_DISALLOWED=y
> CONFIG_BROKEN_BOOT_EUROPE=y
> CONFIG_BROKEN_BOOT_TITAN=y
> CONFIG_LOCK_KERNEL=y
> CONFIG_INIT_ENV_ARG_LIMIT=32
> CONFIG_LOCALVERSION=""
> # CONFIG_LOCALVERSION_AUTO is not set
> CONFIG_HAVE_KERNEL_GZIP=y
> CONFIG_HAVE_KERNEL_BZIP2=y
> CONFIG_HAVE_KERNEL_LZMA=y
> CONFIG_KERNEL_GZIP=y
> # CONFIG_KERNEL_BZIP2 is not set
> # CONFIG_KERNEL_LZMA is not set
> # CONFIG_SWAP is not set
> CONFIG_SYSVIPC=y
> CONFIG_SYSVIPC_SYSCTL=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_POSIX_MQUEUE_SYSCTL=y
> CONFIG_BSD_PROCESS_ACCT=y
> CONFIG_BSD_PROCESS_ACCT_V3=y
> CONFIG_TASKSTATS=y
> # CONFIG_TASK_DELAY_ACCT is not set
> CONFIG_TASK_XACCT=y
> # CONFIG_TASK_IO_ACCOUNTING is not set
> CONFIG_AUDIT=y
> CONFIG_AUDITSYSCALL=y
> CONFIG_AUDIT_TREE=y
> 
> #
> # RCU Subsystem
> #
> CONFIG_TREE_RCU=y
> # CONFIG_PREEMPT_RCU is not set
> CONFIG_RCU_TRACE=y
> CONFIG_RCU_FANOUT=32
> CONFIG_RCU_FANOUT_EXACT=y
> CONFIG_TREE_RCU_TRACE=y
> # CONFIG_PREEMPT_RCU_TRACE is not set
> # CONFIG_IKCONFIG is not set
> CONFIG_LOG_BUF_SHIFT=20
> CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
> CONFIG_GROUP_SCHED=y
> # CONFIG_FAIR_GROUP_SCHED is not set
> CONFIG_RT_GROUP_SCHED=y
> # CONFIG_USER_SCHED is not set
> CONFIG_CGROUP_SCHED=y
> CONFIG_CGROUPS=y
> # CONFIG_CGROUP_DEBUG is not set
> CONFIG_CGROUP_NS=y
> CONFIG_CGROUP_FREEZER=y
> # CONFIG_CGROUP_DEVICE is not set
> # CONFIG_CPUSETS is not set
> # CONFIG_CGROUP_CPUACCT is not set
> CONFIG_RESOURCE_COUNTERS=y
> # CONFIG_CGROUP_MEM_RES_CTLR is not set
> CONFIG_SYSFS_DEPRECATED=y
> # CONFIG_SYSFS_DEPRECATED_V2 is not set
> CONFIG_RELAY=y
> CONFIG_NAMESPACES=y
> CONFIG_UTS_NS=y
> CONFIG_IPC_NS=y
> CONFIG_USER_NS=y
> # CONFIG_PID_NS is not set
> # CONFIG_NET_NS is not set
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_INITRAMFS_SOURCE=""
> CONFIG_RD_GZIP=y
> CONFIG_RD_BZIP2=y
> CONFIG_RD_LZMA=y
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> CONFIG_SYSCTL=y
> CONFIG_ANON_INODES=y
> CONFIG_EMBEDDED=y
> CONFIG_UID16=y
> CONFIG_SYSCTL_SYSCALL=y
> CONFIG_KALLSYMS=y
> CONFIG_KALLSYMS_ALL=y
> # CONFIG_KALLSYMS_EXTRA_PASS is not set
> CONFIG_HOTPLUG=y
> CONFIG_PRINTK=y
> CONFIG_BUG=y
> CONFIG_ELF_CORE=y
> CONFIG_PCSPKR_PLATFORM=y
> CONFIG_BASE_FULL=y
> CONFIG_FUTEX=y
> # CONFIG_EPOLL is not set
> CONFIG_SIGNALFD=y
> CONFIG_TIMERFD=y
> # CONFIG_EVENTFD is not set
> # CONFIG_SHMEM is not set
> # CONFIG_AIO is not set
> CONFIG_HAVE_PERF_COUNTERS=y
> 
> #
> # Performance Counters
> #
> # CONFIG_PERF_COUNTERS is not set
> # CONFIG_VM_EVENT_COUNTERS is not set
> CONFIG_PCI_QUIRKS=y
> CONFIG_SLUB_DEBUG=y
> CONFIG_STRIP_ASM_SYMS=y
> # CONFIG_COMPAT_BRK is not set
> # CONFIG_SLAB is not set
> CONFIG_SLUB=y
> # CONFIG_SLOB is not set
> CONFIG_PROFILING=y
> CONFIG_TRACEPOINTS=y
> CONFIG_MARKERS=y
> CONFIG_OPROFILE=y
> CONFIG_OPROFILE_IBS=y
> CONFIG_HAVE_OPROFILE=y
> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
> CONFIG_HAVE_IOREMAP_PROT=y
> CONFIG_HAVE_KPROBES=y
> CONFIG_HAVE_KRETPROBES=y
> CONFIG_HAVE_ARCH_TRACEHOOK=y
> CONFIG_HAVE_DMA_ATTRS=y
> CONFIG_HAVE_DMA_API_DEBUG=y
> CONFIG_HAVE_HW_BREAKPOINT=y
> 
> #
> # GCOV-based kernel profiling
> #
> CONFIG_SLOW_WORK=y
> CONFIG_HAVE_GENERIC_DMA_COHERENT=y
> CONFIG_SLABINFO=y
> CONFIG_RT_MUTEXES=y
> CONFIG_BASE_SMALL=0
> # CONFIG_MODULES is not set
> CONFIG_BLOCK=y
> # CONFIG_LBDAF is not set
> CONFIG_BLK_DEV_BSG=y
> # CONFIG_BLK_DEV_INTEGRITY is not set
> 
> #
> # IO Schedulers
> #
> CONFIG_IOSCHED_NOOP=y
> # CONFIG_IOSCHED_AS is not set
> # CONFIG_IOSCHED_DEADLINE is not set
> # CONFIG_IOSCHED_CFQ is not set
> # CONFIG_DEFAULT_AS is not set
> # CONFIG_DEFAULT_DEADLINE is not set
> # CONFIG_DEFAULT_CFQ is not set
> CONFIG_DEFAULT_NOOP=y
> CONFIG_DEFAULT_IOSCHED="noop"
> CONFIG_PREEMPT_NOTIFIERS=y
> CONFIG_FREEZER=y
> 
> #
> # Processor type and features
> #
> CONFIG_TICK_ONESHOT=y
> CONFIG_NO_HZ=y
> # CONFIG_HIGH_RES_TIMERS is not set
> CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
> CONFIG_SMP_SUPPORT=y
> CONFIG_X86_MPPARSE=y
> # CONFIG_X86_BIGSMP is not set
> CONFIG_X86_EXTENDED_PLATFORM=y
> # CONFIG_X86_ELAN is not set
> CONFIG_X86_RDC321X=y
> # CONFIG_X86_32_NON_STANDARD is not set
> CONFIG_SCHED_OMIT_FRAME_POINTER=y
> CONFIG_PARAVIRT_GUEST=y
> CONFIG_VMI=y
> CONFIG_KVM_CLOCK=y
> # CONFIG_KVM_GUEST is not set
> # CONFIG_LGUEST_GUEST is not set
> CONFIG_PARAVIRT=y
> # CONFIG_PARAVIRT_SPINLOCKS is not set
> CONFIG_PARAVIRT_CLOCK=y
> CONFIG_PARAVIRT_DEBUG=y
> CONFIG_MEMTEST=y
> # CONFIG_M386 is not set
> # CONFIG_M486 is not set
> # CONFIG_M586 is not set
> # CONFIG_M586TSC is not set
> CONFIG_M586MMX=y
> # CONFIG_M686 is not set
> # CONFIG_MPENTIUMII is not set
> # CONFIG_MPENTIUMIII is not set
> # CONFIG_MPENTIUMM is not set
> # CONFIG_MPENTIUM4 is not set
> # CONFIG_MK6 is not set
> # CONFIG_MK7 is not set
> # CONFIG_MK8 is not set
> # CONFIG_MCRUSOE is not set
> # CONFIG_MEFFICEON is not set
> # CONFIG_MWINCHIPC6 is not set
> # CONFIG_MWINCHIP3D is not set
> # CONFIG_MGEODEGX1 is not set
> # CONFIG_MGEODE_LX is not set
> # CONFIG_MCYRIXIII is not set
> # CONFIG_MVIAC3_2 is not set
> # CONFIG_MVIAC7 is not set
> # CONFIG_MPSC is not set
> # CONFIG_MCORE2 is not set
> # CONFIG_GENERIC_CPU is not set
> CONFIG_X86_GENERIC=y
> CONFIG_X86_CPU=y
> CONFIG_X86_L1_CACHE_BYTES=64
> CONFIG_X86_INTERNODE_CACHE_BYTES=64
> CONFIG_X86_CMPXCHG=y
> CONFIG_X86_L1_CACHE_SHIFT=5
> CONFIG_X86_XADD=y
> # CONFIG_X86_PPRO_FENCE is not set
> CONFIG_X86_F00F_BUG=y
> CONFIG_X86_WP_WORKS_OK=y
> CONFIG_X86_INVLPG=y
> CONFIG_X86_BSWAP=y
> CONFIG_X86_POPAD_OK=y
> CONFIG_X86_ALIGNMENT_16=y
> CONFIG_X86_INTEL_USERCOPY=y
> CONFIG_X86_TSC=y
> CONFIG_X86_MINIMUM_CPU_FAMILY=4
> CONFIG_PROCESSOR_SELECT=y
> CONFIG_CPU_SUP_INTEL=y
> CONFIG_CPU_SUP_CYRIX_32=y
> CONFIG_CPU_SUP_AMD=y
> CONFIG_CPU_SUP_CENTAUR=y
> # CONFIG_CPU_SUP_TRANSMETA_32 is not set
> # CONFIG_CPU_SUP_UMC_32 is not set
> # CONFIG_HPET_TIMER is not set
> CONFIG_DMI=y
> # CONFIG_IOMMU_HELPER is not set
> # CONFIG_IOMMU_API is not set
> CONFIG_NR_CPUS=8
> CONFIG_SCHED_SMT=y
> CONFIG_SCHED_MC=y
> # CONFIG_PREEMPT_NONE is not set
> CONFIG_PREEMPT_VOLUNTARY=y
> # CONFIG_PREEMPT is not set
> CONFIG_X86_LOCAL_APIC=y
> CONFIG_X86_IO_APIC=y
> CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
> CONFIG_X86_MCE=y
> CONFIG_X86_MCE_INTEL=y
> CONFIG_X86_MCE_AMD=y
> # CONFIG_X86_ANCIENT_MCE is not set
> CONFIG_X86_MCE_THRESHOLD=y
> CONFIG_X86_MCE_INJECT=y
> CONFIG_X86_THERMAL_VECTOR=y
> CONFIG_VM86=y
> CONFIG_I8K=y
> CONFIG_X86_REBOOTFIXUPS=y
> # CONFIG_MICROCODE is not set
> # CONFIG_X86_MSR is not set
> CONFIG_X86_CPUID=y
> # CONFIG_X86_CPU_DEBUG is not set
> CONFIG_UP_WANTED_1=y
> # CONFIG_UP_WANTED_2 is not set
> CONFIG_SMP=y
> # CONFIG_NOHIGHMEM is not set
> CONFIG_HIGHMEM4G=y
> # CONFIG_HIGHMEM64G is not set
> CONFIG_VMSPLIT_3G=y
> # CONFIG_VMSPLIT_3G_OPT is not set
> # CONFIG_VMSPLIT_2G is not set
> # CONFIG_VMSPLIT_2G_OPT is not set
> # CONFIG_VMSPLIT_1G is not set
> CONFIG_PAGE_OFFSET=0xC0000000
> CONFIG_HIGHMEM=y
> # CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
> CONFIG_ARCH_FLATMEM_ENABLE=y
> CONFIG_ARCH_SPARSEMEM_ENABLE=y
> CONFIG_ARCH_SELECT_MEMORY_MODEL=y
> CONFIG_ILLEGAL_POINTER_VALUE=0
> CONFIG_SELECT_MEMORY_MODEL=y
> CONFIG_FLATMEM_MANUAL=y
> # CONFIG_DISCONTIGMEM_MANUAL is not set
> # CONFIG_SPARSEMEM_MANUAL is not set
> CONFIG_FLATMEM=y
> CONFIG_FLAT_NODE_MEM_MAP=y
> CONFIG_SPARSEMEM_STATIC=y
> CONFIG_PAGEFLAGS_EXTENDED=y
> CONFIG_SPLIT_PTLOCK_CPUS=4
> # CONFIG_PHYS_ADDR_T_64BIT is not set
> CONFIG_ZONE_DMA_FLAG=1
> CONFIG_BOUNCE=y
> CONFIG_VIRT_TO_BUS=y
> CONFIG_HAVE_MLOCK=y
> CONFIG_HAVE_MLOCKED_PAGE_BIT=y
> CONFIG_MMU_NOTIFIER=y
> CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
> # CONFIG_HIGHPTE is not set
> CONFIG_X86_CHECK_BIOS_CORRUPTION=y
> # CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
> CONFIG_X86_RESERVE_LOW_64K=y
> CONFIG_MATH_EMULATION=y
> CONFIG_MTRR=y
> CONFIG_MTRR_SANITIZER=y
> CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
> CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
> # CONFIG_X86_PAT is not set
> CONFIG_SECCOMP=y
> # CONFIG_CC_STACKPROTECTOR is not set
> # CONFIG_HZ_100 is not set
> # CONFIG_HZ_250 is not set
> CONFIG_HZ_300=y
> # CONFIG_HZ_1000 is not set
> CONFIG_HZ=300
> # CONFIG_SCHED_HRTICK is not set
> # CONFIG_KEXEC is not set
> # CONFIG_CRASH_DUMP is not set
> CONFIG_PHYSICAL_START=0x1000000
> CONFIG_RELOCATABLE=y
> CONFIG_X86_NEED_RELOCS=y
> CONFIG_PHYSICAL_ALIGN=0x1000000
> # CONFIG_HOTPLUG_CPU is not set
> CONFIG_COMPAT_VDSO=y
> CONFIG_CMDLINE_BOOL=y
> CONFIG_CMDLINE=""
> CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
> 
> #
> # Power management and ACPI options
> #
> # CONFIG_PM is not set
> 
> #
> # CPU Frequency scaling
> #
> CONFIG_CPU_FREQ=y
> CONFIG_CPU_FREQ_TABLE=y
> # CONFIG_CPU_FREQ_DEBUG is not set
> # CONFIG_CPU_FREQ_STAT is not set
> CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
> # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
> # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
> # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
> # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
> CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
> CONFIG_CPU_FREQ_GOV_POWERSAVE=y
> CONFIG_CPU_FREQ_GOV_USERSPACE=y
> CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
> 
> #
> # CPUFreq processor drivers
> #
> CONFIG_X86_POWERNOW_K6=y
> # CONFIG_X86_POWERNOW_K7 is not set
> # CONFIG_X86_GX_SUSPMOD is not set
> CONFIG_X86_SPEEDSTEP_CENTRINO=y
> CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
> CONFIG_X86_SPEEDSTEP_ICH=y
> CONFIG_X86_SPEEDSTEP_SMI=y
> CONFIG_X86_P4_CLOCKMOD=y
> # CONFIG_X86_CPUFREQ_NFORCE2 is not set
> CONFIG_X86_LONGRUN=y
> CONFIG_X86_E_POWERSAVER=y
> 
> #
> # shared options
> #
> CONFIG_X86_SPEEDSTEP_LIB=y
> CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK=y
> CONFIG_CPU_IDLE=y
> CONFIG_CPU_IDLE_GOV_LADDER=y
> CONFIG_CPU_IDLE_GOV_MENU=y
> 
> #
> # Bus options (PCI etc.)
> #
> CONFIG_PCI=y
> CONFIG_PCI_GOBIOS=y
> # CONFIG_PCI_GOMMCONFIG is not set
> # CONFIG_PCI_GODIRECT is not set
> # CONFIG_PCI_GOOLPC is not set
> # CONFIG_PCI_GOANY is not set
> CONFIG_PCI_BIOS=y
> CONFIG_PCI_DOMAINS=y
> CONFIG_PCIEPORTBUS=y
> # CONFIG_HOTPLUG_PCI_PCIE is not set
> CONFIG_PCIEAER=y
> # CONFIG_PCIE_ECRC is not set
> # CONFIG_PCIEAER_INJECT is not set
> CONFIG_PCIEASPM=y
> # CONFIG_PCIEASPM_DEBUG is not set
> CONFIG_ARCH_SUPPORTS_MSI=y
> # CONFIG_PCI_MSI is not set
> CONFIG_PCI_LEGACY=y
> CONFIG_PCI_DEBUG=y
> # CONFIG_PCI_STUB is not set
> # CONFIG_HT_IRQ is not set
> # CONFIG_PCI_IOV is not set
> CONFIG_ISA_DMA_API=y
> CONFIG_ISA=y
> CONFIG_EISA=y
> CONFIG_EISA_VLB_PRIMING=y
> CONFIG_EISA_PCI_EISA=y
> # CONFIG_EISA_VIRTUAL_ROOT is not set
> # CONFIG_EISA_NAMES is not set
> CONFIG_MCA=y
> CONFIG_MCA_LEGACY=y
> # CONFIG_MCA_PROC_FS is not set
> CONFIG_SCx200=y
> CONFIG_SCx200HR_TIMER=y
> # CONFIG_OLPC is not set
> CONFIG_K8_NB=y
> CONFIG_PCCARD=y
> CONFIG_PCMCIA_DEBUG=y
> # CONFIG_PCMCIA is not set
> # CONFIG_CARDBUS is not set
> 
> #
> # PC-card bridges
> #
> CONFIG_YENTA=y
> CONFIG_YENTA_O2=y
> CONFIG_YENTA_RICOH=y
> CONFIG_YENTA_TI=y
> CONFIG_YENTA_TOSHIBA=y
> CONFIG_PCMCIA_PROBE=y
> CONFIG_PCCARD_NONSTATIC=y
> CONFIG_HOTPLUG_PCI=y
> CONFIG_HOTPLUG_PCI_FAKE=y
> CONFIG_HOTPLUG_PCI_COMPAQ=y
> CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=y
> # CONFIG_HOTPLUG_PCI_IBM is not set
> CONFIG_HOTPLUG_PCI_CPCI=y
> CONFIG_HOTPLUG_PCI_CPCI_ZT5550=y
> # CONFIG_HOTPLUG_PCI_CPCI_GENERIC is not set
> CONFIG_HOTPLUG_PCI_SHPC=y
> 
> #
> # Executable file formats / Emulations
> #
> CONFIG_BINFMT_ELF=y
> # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
> CONFIG_HAVE_AOUT=y
> # CONFIG_BINFMT_AOUT is not set
> # CONFIG_BINFMT_MISC is not set
> CONFIG_HAVE_ATOMIC_IOMAP=y
> CONFIG_NET=y
> 
> #
> # Networking options
> #
> CONFIG_PACKET=y
> # CONFIG_PACKET_MMAP is not set
> CONFIG_UNIX=y
> CONFIG_XFRM=y
> CONFIG_XFRM_USER=y
> CONFIG_XFRM_SUB_POLICY=y
> CONFIG_XFRM_MIGRATE=y
> CONFIG_XFRM_STATISTICS=y
> CONFIG_XFRM_IPCOMP=y
> # CONFIG_NET_KEY is not set
> CONFIG_INET=y
> # CONFIG_IP_MULTICAST is not set
> CONFIG_IP_ADVANCED_ROUTER=y
> CONFIG_ASK_IP_FIB_HASH=y
> # CONFIG_IP_FIB_TRIE is not set
> CONFIG_IP_FIB_HASH=y
> CONFIG_IP_MULTIPLE_TABLES=y
> # CONFIG_IP_ROUTE_MULTIPATH is not set
> # CONFIG_IP_ROUTE_VERBOSE is not set
> # CONFIG_IP_PNP is not set
> # CONFIG_NET_IPIP is not set
> CONFIG_NET_IPGRE=y
> CONFIG_ARPD=y
> CONFIG_SYN_COOKIES=y
> # CONFIG_INET_AH is not set
> # CONFIG_INET_ESP is not set
> CONFIG_INET_IPCOMP=y
> CONFIG_INET_XFRM_TUNNEL=y
> CONFIG_INET_TUNNEL=y
> CONFIG_INET_XFRM_MODE_TRANSPORT=y
> CONFIG_INET_XFRM_MODE_TUNNEL=y
> CONFIG_INET_XFRM_MODE_BEET=y
> CONFIG_INET_LRO=y
> CONFIG_INET_DIAG=y
> CONFIG_INET_TCP_DIAG=y
> # CONFIG_TCP_CONG_ADVANCED is not set
> CONFIG_TCP_CONG_CUBIC=y
> CONFIG_DEFAULT_TCP_CONG="cubic"
> # CONFIG_TCP_MD5SIG is not set
> # CONFIG_IPV6 is not set
> # CONFIG_NETLABEL is not set
> CONFIG_NETWORK_SECMARK=y
> CONFIG_NETFILTER=y
> CONFIG_NETFILTER_DEBUG=y
> # CONFIG_NETFILTER_ADVANCED is not set
> 
> #
> # Core Netfilter Configuration
> #
> # CONFIG_NETFILTER_NETLINK_LOG is not set
> CONFIG_NF_CONNTRACK=y
> CONFIG_NF_CONNTRACK_SECMARK=y
> # CONFIG_NF_CONNTRACK_FTP is not set
> CONFIG_NF_CONNTRACK_IRC=y
> # CONFIG_NF_CONNTRACK_SIP is not set
> # CONFIG_NF_CT_NETLINK is not set
> CONFIG_NETFILTER_XTABLES=y
> # CONFIG_NETFILTER_XT_TARGET_CONNSECMARK is not set
> # CONFIG_NETFILTER_XT_TARGET_MARK is not set
> # CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
> CONFIG_NETFILTER_XT_TARGET_SECMARK=y
> # CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
> CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> CONFIG_NETFILTER_XT_MATCH_MARK=y
> CONFIG_NETFILTER_XT_MATCH_POLICY=y
> # CONFIG_NETFILTER_XT_MATCH_STATE is not set
> CONFIG_IP_VS=y
> # CONFIG_IP_VS_DEBUG is not set
> CONFIG_IP_VS_TAB_BITS=12
> 
> #
> # IPVS transport protocol load balancing support
> #
> CONFIG_IP_VS_PROTO_TCP=y
> CONFIG_IP_VS_PROTO_UDP=y
> # CONFIG_IP_VS_PROTO_ESP is not set
> # CONFIG_IP_VS_PROTO_AH is not set
> 
> #
> # IPVS scheduler
> #
> CONFIG_IP_VS_RR=y
> CONFIG_IP_VS_WRR=y
> CONFIG_IP_VS_LC=y
> CONFIG_IP_VS_WLC=y
> CONFIG_IP_VS_LBLC=y
> CONFIG_IP_VS_LBLCR=y
> # CONFIG_IP_VS_DH is not set
> CONFIG_IP_VS_SH=y
> CONFIG_IP_VS_SED=y
> # CONFIG_IP_VS_NQ is not set
> 
> #
> # IPVS application helper
> #
> CONFIG_IP_VS_FTP=y
> 
> #
> # IP: Netfilter Configuration
> #
> CONFIG_NF_DEFRAG_IPV4=y
> CONFIG_NF_CONNTRACK_IPV4=y
> CONFIG_NF_CONNTRACK_PROC_COMPAT=y
> CONFIG_IP_NF_IPTABLES=y
> # CONFIG_IP_NF_FILTER is not set
> CONFIG_IP_NF_TARGET_LOG=y
> # CONFIG_IP_NF_TARGET_ULOG is not set
> CONFIG_NF_NAT=y
> CONFIG_NF_NAT_NEEDED=y
> CONFIG_IP_NF_TARGET_MASQUERADE=y
> # CONFIG_NF_NAT_FTP is not set
> CONFIG_NF_NAT_IRC=y
> # CONFIG_NF_NAT_TFTP is not set
> # CONFIG_NF_NAT_AMANDA is not set
> # CONFIG_NF_NAT_PPTP is not set
> # CONFIG_NF_NAT_H323 is not set
> # CONFIG_NF_NAT_SIP is not set
> CONFIG_IP_NF_MANGLE=y
> # CONFIG_IP_DCCP is not set
> CONFIG_IP_SCTP=y
> # CONFIG_SCTP_DBG_MSG is not set
> # CONFIG_SCTP_DBG_OBJCNT is not set
> # CONFIG_SCTP_HMAC_NONE is not set
> CONFIG_SCTP_HMAC_SHA1=y
> # CONFIG_SCTP_HMAC_MD5 is not set
> CONFIG_RDS=y
> CONFIG_RDS_DEBUG=y
> CONFIG_TIPC=y
> # CONFIG_TIPC_ADVANCED is not set
> CONFIG_TIPC_DEBUG=y
> CONFIG_ATM=y
> CONFIG_ATM_CLIP=y
> CONFIG_ATM_CLIP_NO_ICMP=y
> CONFIG_ATM_LANE=y
> # CONFIG_ATM_MPOA is not set
> CONFIG_ATM_BR2684=y
> CONFIG_ATM_BR2684_IPFILTER=y
> CONFIG_STP=y
> CONFIG_GARP=y
> CONFIG_BRIDGE=y
> CONFIG_NET_DSA=y
> CONFIG_NET_DSA_TAG_DSA=y
> CONFIG_NET_DSA_TAG_EDSA=y
> # CONFIG_NET_DSA_TAG_TRAILER is not set
> CONFIG_NET_DSA_MV88E6XXX=y
> # CONFIG_NET_DSA_MV88E6060 is not set
> CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
> CONFIG_NET_DSA_MV88E6131=y
> CONFIG_NET_DSA_MV88E6123_61_65=y
> CONFIG_VLAN_8021Q=y
> CONFIG_VLAN_8021Q_GVRP=y
> CONFIG_DECNET=y
> # CONFIG_DECNET_ROUTER is not set
> CONFIG_LLC=y
> CONFIG_LLC2=y
> # CONFIG_IPX is not set
> CONFIG_ATALK=y
> # CONFIG_DEV_APPLETALK is not set
> CONFIG_X25=y
> CONFIG_LAPB=y
> CONFIG_ECONET=y
> # CONFIG_ECONET_AUNUDP is not set
> # CONFIG_ECONET_NATIVE is not set
> CONFIG_WAN_ROUTER=y
> CONFIG_PHONET=y
> CONFIG_IEEE802154=y
> # CONFIG_NET_SCHED is not set
> # CONFIG_DCB is not set
> 
> #
> # Network testing
> #
> CONFIG_NET_PKTGEN=y
> # CONFIG_NET_DROP_MONITOR is not set
> CONFIG_HAMRADIO=y
> 
> #
> # Packet Radio protocols
> #
> # CONFIG_AX25 is not set
> CONFIG_CAN=y
> CONFIG_CAN_RAW=y
> # CONFIG_CAN_BCM is not set
> 
> #
> # CAN Device Drivers
> #
> CONFIG_CAN_VCAN=y
> CONFIG_CAN_DEV=y
> # CONFIG_CAN_CALC_BITTIMING is not set
> # CONFIG_CAN_SJA1000 is not set
> CONFIG_CAN_DEBUG_DEVICES=y
> CONFIG_IRDA=y
> 
> #
> # IrDA protocols
> #
> CONFIG_IRLAN=y
> CONFIG_IRNET=y
> # CONFIG_IRCOMM is not set
> CONFIG_IRDA_ULTRA=y
> 
> #
> # IrDA options
> #
> CONFIG_IRDA_CACHE_LAST_LSAP=y
> CONFIG_IRDA_FAST_RR=y
> CONFIG_IRDA_DEBUG=y
> 
> #
> # Infrared-port device drivers
> #
> 
> #
> # SIR device drivers
> #
> CONFIG_IRTTY_SIR=y
> 
> #
> # Dongle support
> #
> CONFIG_DONGLE=y
> # CONFIG_ESI_DONGLE is not set
> # CONFIG_ACTISYS_DONGLE is not set
> CONFIG_TEKRAM_DONGLE=y
> CONFIG_TOIM3232_DONGLE=y
> CONFIG_LITELINK_DONGLE=y
> CONFIG_MA600_DONGLE=y
> CONFIG_GIRBIL_DONGLE=y
> # CONFIG_MCP2120_DONGLE is not set
> CONFIG_OLD_BELKIN_DONGLE=y
> # CONFIG_ACT200L_DONGLE is not set
> CONFIG_KINGSUN_DONGLE=y
> CONFIG_KSDAZZLE_DONGLE=y
> CONFIG_KS959_DONGLE=y
> 
> #
> # FIR device drivers
> #
> CONFIG_USB_IRDA=y
> # CONFIG_SIGMATEL_FIR is not set
> CONFIG_NSC_FIR=y
> CONFIG_WINBOND_FIR=y
> CONFIG_TOSHIBA_FIR=y
> # CONFIG_SMC_IRCC_FIR is not set
> CONFIG_ALI_FIR=y
> CONFIG_VLSI_FIR=y
> CONFIG_VIA_FIR=y
> CONFIG_MCS_FIR=y
> # CONFIG_BT is not set
> CONFIG_AF_RXRPC=y
> CONFIG_AF_RXRPC_DEBUG=y
> CONFIG_RXKAD=y
> CONFIG_FIB_RULES=y
> CONFIG_WIRELESS=y
> # CONFIG_CFG80211 is not set
> CONFIG_WIRELESS_OLD_REGULATORY=y
> CONFIG_WIRELESS_EXT=y
> CONFIG_WIRELESS_EXT_SYSFS=y
> CONFIG_LIB80211=y
> # CONFIG_LIB80211_DEBUG is not set
> 
> #
> # CFG80211 needs to be enabled for MAC80211
> #
> CONFIG_MAC80211_DEFAULT_PS_VALUE=0
> CONFIG_WIMAX=y
> CONFIG_WIMAX_DEBUG_LEVEL=8
> CONFIG_RFKILL=y
> CONFIG_RFKILL_INPUT=y
> 
> #
> # Device Drivers
> #
> 
> #
> # Generic Driver Options
> #
> CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
> CONFIG_STANDALONE=y
> CONFIG_PREVENT_FIRMWARE_BUILD=y
> CONFIG_FW_LOADER=y
> # CONFIG_FIRMWARE_IN_KERNEL is not set
> CONFIG_EXTRA_FIRMWARE=""
> CONFIG_DEBUG_DRIVER=y
> CONFIG_DEBUG_DEVRES=y
> # CONFIG_SYS_HYPERVISOR is not set
> CONFIG_CONNECTOR=y
> # CONFIG_PROC_EVENTS is not set
> CONFIG_PARPORT=y
> CONFIG_PARPORT_PC=y
> CONFIG_PARPORT_PC_FIFO=y
> CONFIG_PARPORT_PC_SUPERIO=y
> # CONFIG_PARPORT_GSC is not set
> # CONFIG_PARPORT_AX88796 is not set
> CONFIG_PARPORT_1284=y
> CONFIG_PARPORT_NOT_PC=y
> # CONFIG_PNP is not set
> CONFIG_BLK_DEV=y
> CONFIG_BLK_DEV_FD=y
> CONFIG_BLK_DEV_XD=y
> CONFIG_BLK_CPQ_DA=y
> CONFIG_BLK_CPQ_CISS_DA=y
> # CONFIG_CISS_SCSI_TAPE is not set
> CONFIG_BLK_DEV_DAC960=y
> # CONFIG_BLK_DEV_UMEM is not set
> # CONFIG_BLK_DEV_COW_COMMON is not set
> CONFIG_BLK_DEV_LOOP=y
> # CONFIG_BLK_DEV_CRYPTOLOOP is not set
> CONFIG_BLK_DEV_NBD=y
> CONFIG_BLK_DEV_SX8=y
> CONFIG_BLK_DEV_UB=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_COUNT=16
> CONFIG_BLK_DEV_RAM_SIZE=4096
> CONFIG_BLK_DEV_XIP=y
> CONFIG_CDROM_PKTCDVD=y
> CONFIG_CDROM_PKTCDVD_BUFFERS=8
> # CONFIG_CDROM_PKTCDVD_WCACHE is not set
> # CONFIG_ATA_OVER_ETH is not set
> # CONFIG_VIRTIO_BLK is not set
> CONFIG_BLK_DEV_HD=y
> CONFIG_MISC_DEVICES=y
> # CONFIG_IBM_ASM is not set
> # CONFIG_PHANTOM is not set
> # CONFIG_SGI_IOC4 is not set
> CONFIG_TIFM_CORE=y
> # CONFIG_TIFM_7XX1 is not set
> # CONFIG_ICS932S401 is not set
> # CONFIG_ENCLOSURE_SERVICES is not set
> CONFIG_HP_ILO=y
> CONFIG_ISL29003=y
> # CONFIG_C2PORT is not set
> 
> #
> # EEPROM support
> #
> # CONFIG_EEPROM_AT24 is not set
> # CONFIG_EEPROM_LEGACY is not set
> CONFIG_EEPROM_MAX6875=y
> # CONFIG_EEPROM_93CX6 is not set
> CONFIG_CB710_CORE=y
> CONFIG_CB710_DEBUG=y
> CONFIG_CB710_DEBUG_ASSUMPTIONS=y
> CONFIG_HAVE_IDE=y
> 
> #
> # SCSI device support
> #
> CONFIG_RAID_ATTRS=y
> CONFIG_SCSI=y
> CONFIG_SCSI_DMA=y
> CONFIG_SCSI_TGT=y
> CONFIG_SCSI_NETLINK=y
> # CONFIG_SCSI_PROC_FS is not set
> 
> #
> # SCSI support type (disk, tape, CD-ROM)
> #
> CONFIG_BLK_DEV_SD=y
> CONFIG_CHR_DEV_ST=y
> CONFIG_CHR_DEV_OSST=y
> CONFIG_BLK_DEV_SR=y
> CONFIG_BLK_DEV_SR_VENDOR=y
> CONFIG_CHR_DEV_SG=y
> # CONFIG_CHR_DEV_SCH is not set
> CONFIG_SCSI_MULTI_LUN=y
> CONFIG_SCSI_CONSTANTS=y
> CONFIG_SCSI_LOGGING=y
> # CONFIG_SCSI_SCAN_ASYNC is not set
> 
> #
> # SCSI Transports
> #
> CONFIG_SCSI_SPI_ATTRS=y
> CONFIG_SCSI_FC_ATTRS=y
> CONFIG_SCSI_FC_TGT_ATTRS=y
> CONFIG_SCSI_ISCSI_ATTRS=y
> CONFIG_SCSI_SAS_ATTRS=y
> CONFIG_SCSI_SAS_LIBSAS=y
> CONFIG_SCSI_SAS_ATA=y
> CONFIG_SCSI_SAS_HOST_SMP=y
> # CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
> CONFIG_SCSI_SRP_ATTRS=y
> CONFIG_SCSI_SRP_TGT_ATTRS=y
> CONFIG_SCSI_LOWLEVEL=y
> CONFIG_ISCSI_TCP=y
> # CONFIG_SCSI_CXGB3_ISCSI is not set
> CONFIG_BLK_DEV_3W_XXXX_RAID=y
> CONFIG_SCSI_3W_9XXX=y
> CONFIG_SCSI_7000FASST=y
> CONFIG_SCSI_ACARD=y
> # CONFIG_SCSI_AHA152X is not set
> CONFIG_SCSI_AHA1740=y
> CONFIG_SCSI_AACRAID=y
> CONFIG_SCSI_AIC7XXX=y
> CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
> CONFIG_AIC7XXX_RESET_DELAY_MS=5000
> # CONFIG_AIC7XXX_DEBUG_ENABLE is not set
> CONFIG_AIC7XXX_DEBUG_MASK=0
> # CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
> CONFIG_SCSI_AIC7XXX_OLD=y
> CONFIG_SCSI_AIC79XX=y
> CONFIG_AIC79XX_CMDS_PER_DEVICE=32
> CONFIG_AIC79XX_RESET_DELAY_MS=5000
> # CONFIG_AIC79XX_DEBUG_ENABLE is not set
> CONFIG_AIC79XX_DEBUG_MASK=0
> CONFIG_AIC79XX_REG_PRETTY_PRINT=y
> # CONFIG_SCSI_AIC94XX is not set
> CONFIG_SCSI_MVSAS=y
> CONFIG_SCSI_MVSAS_DEBUG=y
> # CONFIG_SCSI_DPT_I2O is not set
> CONFIG_SCSI_ADVANSYS=y
> CONFIG_SCSI_IN2000=y
> CONFIG_SCSI_ARCMSR=y
> CONFIG_SCSI_ARCMSR_AER=y
> CONFIG_MEGARAID_NEWGEN=y
> # CONFIG_MEGARAID_MM is not set
> CONFIG_MEGARAID_LEGACY=y
> # CONFIG_MEGARAID_SAS is not set
> CONFIG_SCSI_MPT2SAS=y
> CONFIG_SCSI_MPT2SAS_MAX_SGE=128
> # CONFIG_SCSI_MPT2SAS_LOGGING is not set
> CONFIG_SCSI_HPTIOP=y
> CONFIG_SCSI_BUSLOGIC=y
> CONFIG_SCSI_FLASHPOINT=y
> CONFIG_LIBFC=y
> CONFIG_LIBFCOE=y
> # CONFIG_FCOE is not set
> # CONFIG_FCOE_FNIC is not set
> # CONFIG_SCSI_DMX3191D is not set
> # CONFIG_SCSI_DTC3280 is not set
> CONFIG_SCSI_EATA=y
> # CONFIG_SCSI_EATA_TAGGED_QUEUE is not set
> # CONFIG_SCSI_EATA_LINKED_COMMANDS is not set
> CONFIG_SCSI_EATA_MAX_TAGS=16
> CONFIG_SCSI_FUTURE_DOMAIN=y
> # CONFIG_SCSI_FD_MCS is not set
> CONFIG_SCSI_GDTH=y
> CONFIG_SCSI_GENERIC_NCR5380=y
> # CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
> CONFIG_SCSI_GENERIC_NCR53C400=y
> CONFIG_SCSI_IBMMCA=y
> # CONFIG_IBMMCA_SCSI_ORDER_STANDARD is not set
> CONFIG_IBMMCA_SCSI_DEV_RESET=y
> CONFIG_SCSI_IPS=y
> CONFIG_SCSI_INITIO=y
> # CONFIG_SCSI_INIA100 is not set
> CONFIG_SCSI_PPA=y
> CONFIG_SCSI_IMM=y
> CONFIG_SCSI_IZIP_EPP16=y
> # CONFIG_SCSI_IZIP_SLOW_CTR is not set
> # CONFIG_SCSI_NCR53C406A is not set
> CONFIG_SCSI_NCR_D700=y
> CONFIG_SCSI_STEX=y
> # CONFIG_SCSI_SYM53C8XX_2 is not set
> CONFIG_SCSI_IPR=y
> # CONFIG_SCSI_IPR_TRACE is not set
> # CONFIG_SCSI_IPR_DUMP is not set
> # CONFIG_SCSI_NCR_Q720 is not set
> CONFIG_SCSI_PAS16=y
> CONFIG_SCSI_QLOGIC_FAS=y
> CONFIG_SCSI_QLOGIC_1280=y
> CONFIG_SCSI_QLA_FC=y
> # CONFIG_SCSI_QLA_ISCSI is not set
> CONFIG_SCSI_LPFC=y
> # CONFIG_SCSI_LPFC_DEBUG_FS is not set
> # CONFIG_SCSI_SIM710 is not set
> CONFIG_SCSI_SYM53C416=y
> CONFIG_SCSI_DC395x=y
> CONFIG_SCSI_DC390T=y
> CONFIG_SCSI_T128=y
> CONFIG_SCSI_U14_34F=y
> CONFIG_SCSI_U14_34F_TAGGED_QUEUE=y
> CONFIG_SCSI_U14_34F_LINKED_COMMANDS=y
> CONFIG_SCSI_U14_34F_MAX_TAGS=8
> CONFIG_SCSI_ULTRASTOR=y
> CONFIG_SCSI_NSP32=y
> CONFIG_SCSI_SRP=y
> CONFIG_SCSI_DH=y
> CONFIG_SCSI_DH_RDAC=y
> CONFIG_SCSI_DH_HP_SW=y
> # CONFIG_SCSI_DH_EMC is not set
> # CONFIG_SCSI_DH_ALUA is not set
> # CONFIG_SCSI_OSD_INITIATOR is not set
> CONFIG_ATA=y
> # CONFIG_ATA_NONSTANDARD is not set
> CONFIG_SATA_PMP=y
> CONFIG_SATA_AHCI=y
> CONFIG_SATA_SIL24=y
> CONFIG_ATA_SFF=y
> CONFIG_SATA_SVW=y
> CONFIG_ATA_PIIX=y
> # CONFIG_SATA_MV is not set
> CONFIG_SATA_NV=y
> # CONFIG_PDC_ADMA is not set
> CONFIG_SATA_QSTOR=y
> CONFIG_SATA_PROMISE=y
> # CONFIG_SATA_SX4 is not set
> CONFIG_SATA_SIL=y
> CONFIG_SATA_SIS=y
> CONFIG_SATA_ULI=y
> # CONFIG_SATA_VIA is not set
> # CONFIG_SATA_VITESSE is not set
> CONFIG_SATA_INIC162X=y
> CONFIG_PATA_ALI=y
> CONFIG_PATA_AMD=y
> CONFIG_PATA_ARTOP=y
> CONFIG_PATA_ATIIXP=y
> # CONFIG_PATA_CMD640_PCI is not set
> CONFIG_PATA_CMD64X=y
> CONFIG_PATA_CS5520=y
> CONFIG_PATA_CS5530=y
> CONFIG_PATA_CS5535=y
> CONFIG_PATA_CS5536=y
> CONFIG_PATA_CYPRESS=y
> CONFIG_PATA_EFAR=y
> CONFIG_ATA_GENERIC=y
> CONFIG_PATA_HPT366=y
> CONFIG_PATA_HPT37X=y
> CONFIG_PATA_HPT3X2N=y
> # CONFIG_PATA_HPT3X3 is not set
> # CONFIG_PATA_IT821X is not set
> CONFIG_PATA_IT8213=y
> CONFIG_PATA_JMICRON=y
> CONFIG_PATA_LEGACY=y
> CONFIG_PATA_TRIFLEX=y
> # CONFIG_PATA_MARVELL is not set
> CONFIG_PATA_MPIIX=y
> CONFIG_PATA_OLDPIIX=y
> # CONFIG_PATA_NETCELL is not set
> CONFIG_PATA_NINJA32=y
> CONFIG_PATA_NS87410=y
> CONFIG_PATA_NS87415=y
> CONFIG_PATA_OPTI=y
> CONFIG_PATA_OPTIDMA=y
> CONFIG_PATA_PDC_OLD=y
> CONFIG_PATA_QDI=y
> CONFIG_PATA_RADISYS=y
> CONFIG_PATA_RZ1000=y
> # CONFIG_PATA_SC1200 is not set
> # CONFIG_PATA_SERVERWORKS is not set
> # CONFIG_PATA_PDC2027X is not set
> CONFIG_PATA_SIL680=y
> CONFIG_PATA_SIS=y
> CONFIG_PATA_VIA=y
> CONFIG_PATA_WINBOND=y
> CONFIG_PATA_WINBOND_VLB=y
> CONFIG_PATA_PLATFORM=y
> CONFIG_PATA_SCH=y
> # CONFIG_MD is not set
> # CONFIG_FUSION is not set
> 
> #
> # IEEE 1394 (FireWire) support
> #
> 
> #
> # You can enable one or both FireWire driver stacks.
> #
> 
> #
> # See the help texts for more information.
> #
> CONFIG_FIREWIRE=y
> CONFIG_FIREWIRE_OHCI=y
> CONFIG_FIREWIRE_OHCI_DEBUG=y
> CONFIG_FIREWIRE_SBP2=y
> CONFIG_FIREWIRE_NET=y
> CONFIG_IEEE1394=y
> CONFIG_IEEE1394_OHCI1394=y
> CONFIG_IEEE1394_PCILYNX=y
> CONFIG_IEEE1394_SBP2=y
> CONFIG_IEEE1394_SBP2_PHYS_DMA=y
> CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y
> CONFIG_IEEE1394_ETH1394=y
> CONFIG_IEEE1394_RAWIO=y
> # CONFIG_IEEE1394_VIDEO1394 is not set
> # CONFIG_IEEE1394_DV1394 is not set
> # CONFIG_IEEE1394_VERBOSEDEBUG is not set
> # CONFIG_I2O is not set
> CONFIG_MACINTOSH_DRIVERS=y
> CONFIG_MAC_EMUMOUSEBTN=y
> CONFIG_NETDEVICES=y
> CONFIG_DUMMY=y
> CONFIG_BONDING=y
> # CONFIG_MACVLAN is not set
> CONFIG_EQUALIZER=y
> CONFIG_TUN=y
> CONFIG_VETH=y
> # CONFIG_ARCNET is not set
> CONFIG_PHYLIB=y
> 
> #
> # MII PHY device drivers
> #
> # CONFIG_MARVELL_PHY is not set
> # CONFIG_DAVICOM_PHY is not set
> CONFIG_QSEMI_PHY=y
> CONFIG_LXT_PHY=y
> CONFIG_CICADA_PHY=y
> CONFIG_VITESSE_PHY=y
> CONFIG_SMSC_PHY=y
> # CONFIG_BROADCOM_PHY is not set
> CONFIG_ICPLUS_PHY=y
> CONFIG_REALTEK_PHY=y
> # CONFIG_NATIONAL_PHY is not set
> CONFIG_STE10XP=y
> CONFIG_LSI_ET1011C_PHY=y
> CONFIG_FIXED_PHY=y
> # CONFIG_MDIO_BITBANG is not set
> CONFIG_NET_ETHERNET=y
> CONFIG_MII=y
> CONFIG_HAPPYMEAL=y
> CONFIG_SUNGEM=y
> CONFIG_CASSINI=y
> CONFIG_NET_VENDOR_3COM=y
> CONFIG_EL1=y
> # CONFIG_EL2 is not set
> CONFIG_ELPLUS=y
> CONFIG_EL16=y
> CONFIG_EL3=y
> # CONFIG_3C515 is not set
> CONFIG_ELMC=y
> CONFIG_ELMC_II=y
> CONFIG_VORTEX=y
> # CONFIG_TYPHOON is not set
> # CONFIG_LANCE is not set
> CONFIG_NET_VENDOR_SMC=y
> CONFIG_ULTRAMCA=y
> CONFIG_ULTRA=y
> CONFIG_ULTRA32=y
> CONFIG_SMC9194=y
> CONFIG_ETHOC=y
> CONFIG_NET_VENDOR_RACAL=y
> # CONFIG_NI52 is not set
> # CONFIG_NI65 is not set
> # CONFIG_DNET is not set
> # CONFIG_NET_TULIP is not set
> CONFIG_AT1700=y
> CONFIG_DEPCA=y
> # CONFIG_HP100 is not set
> CONFIG_NET_ISA=y
> CONFIG_E2100=y
> # CONFIG_EWRK3 is not set
> CONFIG_EEXPRESS=y
> CONFIG_EEXPRESS_PRO=y
> # CONFIG_HPLAN is not set
> # CONFIG_LP486E is not set
> CONFIG_ETH16I=y
> CONFIG_NE2000=y
> CONFIG_ZNET=y
> # CONFIG_SEEQ8005 is not set
> CONFIG_NE2_MCA=y
> CONFIG_IBMLANA=y
> # CONFIG_IBM_NEW_EMAC_ZMII is not set
> # CONFIG_IBM_NEW_EMAC_RGMII is not set
> # CONFIG_IBM_NEW_EMAC_TAH is not set
> # CONFIG_IBM_NEW_EMAC_EMAC4 is not set
> # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
> # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
> # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
> CONFIG_NET_PCI=y
> CONFIG_PCNET32=y
> # CONFIG_AMD8111_ETH is not set
> CONFIG_ADAPTEC_STARFIRE=y
> # CONFIG_AC3200 is not set
> CONFIG_APRICOT=y
> CONFIG_B44=y
> CONFIG_B44_PCI_AUTOSELECT=y
> CONFIG_B44_PCICORE_AUTOSELECT=y
> CONFIG_B44_PCI=y
> CONFIG_FORCEDETH=y
> # CONFIG_FORCEDETH_NAPI is not set
> CONFIG_CS89x0=y
> CONFIG_E100=y
> CONFIG_LNE390=y
> CONFIG_FEALNX=y
> CONFIG_NATSEMI=y
> # CONFIG_NE2K_PCI is not set
> CONFIG_NE3210=y
> CONFIG_ES3210=y
> # CONFIG_8139CP is not set
> CONFIG_8139TOO=y
> CONFIG_8139TOO_PIO=y
> CONFIG_8139TOO_TUNE_TWISTER=y
> # CONFIG_8139TOO_8129 is not set
> CONFIG_8139_OLD_RX_RESET=y
> CONFIG_R6040=y
> CONFIG_SIS900=y
> CONFIG_EPIC100=y
> # CONFIG_SMSC9420 is not set
> # CONFIG_SUNDANCE is not set
> # CONFIG_TLAN is not set
> CONFIG_KS8842=y
> CONFIG_VIA_RHINE=y
> CONFIG_VIA_RHINE_MMIO=y
> CONFIG_SC92031=y
> CONFIG_NET_POCKET=y
> CONFIG_ATP=y
> CONFIG_DE600=y
> # CONFIG_DE620 is not set
> CONFIG_ATL2=y
> CONFIG_NETDEV_1000=y
> CONFIG_ACENIC=y
> CONFIG_ACENIC_OMIT_TIGON_I=y
> CONFIG_DL2K=y
> CONFIG_E1000=y
> CONFIG_E1000E=y
> # CONFIG_IP1000 is not set
> CONFIG_IGB=y
> CONFIG_IGB_DCA=y
> CONFIG_IGBVF=y
> CONFIG_NS83820=y
> CONFIG_HAMACHI=y
> CONFIG_YELLOWFIN=y
> CONFIG_R8169=y
> # CONFIG_R8169_VLAN is not set
> CONFIG_SIS190=y
> CONFIG_SKGE=y
> CONFIG_SKGE_DEBUG=y
> CONFIG_SKY2=y
> CONFIG_SKY2_DEBUG=y
> CONFIG_VIA_VELOCITY=y
> CONFIG_TIGON3=y
> CONFIG_BNX2=y
> # CONFIG_QLA3XXX is not set
> CONFIG_ATL1=y
> CONFIG_ATL1E=y
> CONFIG_ATL1C=y
> CONFIG_JME=y
> CONFIG_NETDEV_10000=y
> CONFIG_MDIO=y
> CONFIG_CHELSIO_T1=y
> # CONFIG_CHELSIO_T1_1G is not set
> CONFIG_CHELSIO_T3_DEPENDS=y
> CONFIG_CHELSIO_T3=y
> # CONFIG_ENIC is not set
> # CONFIG_IXGBE is not set
> # CONFIG_IXGB is not set
> # CONFIG_S2IO is not set
> CONFIG_MYRI10GE=y
> CONFIG_MYRI10GE_DCA=y
> CONFIG_NIU=y
> CONFIG_MLX4_EN=y
> CONFIG_MLX4_CORE=y
> CONFIG_MLX4_DEBUG=y
> # CONFIG_TEHUTI is not set
> CONFIG_BNX2X=y
> CONFIG_QLGE=y
> CONFIG_SFC=y
> CONFIG_BE2NET=y
> # CONFIG_TR is not set
> 
> #
> # Wireless LAN
> #
> CONFIG_WLAN_PRE80211=y
> CONFIG_STRIP=y
> # CONFIG_ARLAN is not set
> CONFIG_WAVELAN=y
> # CONFIG_WLAN_80211 is not set
> 
> #
> # WiMAX Wireless Broadband devices
> #
> 
> #
> # Enable MMC support to see WiMAX SDIO drivers
> #
> 
> #
> # USB Network Adapters
> #
> CONFIG_USB_CATC=y
> # CONFIG_USB_KAWETH is not set
> CONFIG_USB_PEGASUS=y
> # CONFIG_USB_RTL8150 is not set
> CONFIG_USB_USBNET=y
> CONFIG_USB_NET_AX8817X=y
> CONFIG_USB_NET_CDCETHER=y
> CONFIG_USB_NET_CDC_EEM=y
> CONFIG_USB_NET_DM9601=y
> CONFIG_USB_NET_SMSC95XX=y
> # CONFIG_USB_NET_GL620A is not set
> # CONFIG_USB_NET_NET1080 is not set
> # CONFIG_USB_NET_PLUSB is not set
> CONFIG_USB_NET_MCS7830=y
> # CONFIG_USB_NET_RNDIS_HOST is not set
> CONFIG_USB_NET_CDC_SUBSET=y
> # CONFIG_USB_ALI_M5632 is not set
> # CONFIG_USB_AN2720 is not set
> CONFIG_USB_BELKIN=y
> CONFIG_USB_ARMLINUX=y
> # CONFIG_USB_EPSON2888 is not set
> # CONFIG_USB_KC2190 is not set
> CONFIG_USB_NET_ZAURUS=y
> # CONFIG_USB_HSO is not set
> CONFIG_USB_NET_INT51X1=y
> # CONFIG_USB_CDC_PHONET is not set
> # CONFIG_WAN is not set
> CONFIG_ATM_DRIVERS=y
> # CONFIG_ATM_DUMMY is not set
> CONFIG_ATM_TCP=y
> CONFIG_ATM_LANAI=y
> CONFIG_ATM_ENI=y
> CONFIG_ATM_ENI_DEBUG=y
> # CONFIG_ATM_ENI_TUNE_BURST is not set
> # CONFIG_ATM_FIRESTREAM is not set
> # CONFIG_ATM_ZATM is not set
> CONFIG_ATM_NICSTAR=y
> # CONFIG_ATM_NICSTAR_USE_SUNI is not set
> # CONFIG_ATM_NICSTAR_USE_IDT77105 is not set
> CONFIG_ATM_IDT77252=y
> # CONFIG_ATM_IDT77252_DEBUG is not set
> # CONFIG_ATM_IDT77252_RCV_ALL is not set
> CONFIG_ATM_IDT77252_USE_SUNI=y
> CONFIG_ATM_AMBASSADOR=y
> CONFIG_ATM_AMBASSADOR_DEBUG=y
> CONFIG_ATM_HORIZON=y
> CONFIG_ATM_HORIZON_DEBUG=y
> # CONFIG_ATM_IA is not set
> CONFIG_ATM_FORE200E=y
> # CONFIG_ATM_FORE200E_USE_TASKLET is not set
> CONFIG_ATM_FORE200E_TX_RETRY=16
> CONFIG_ATM_FORE200E_DEBUG=0
> # CONFIG_ATM_HE is not set
> CONFIG_ATM_SOLOS=y
> # CONFIG_IEEE802154_DRIVERS is not set
> CONFIG_FDDI=y
> CONFIG_DEFXX=y
> CONFIG_DEFXX_MMIO=y
> # CONFIG_SKFP is not set
> # CONFIG_HIPPI is not set
> # CONFIG_PLIP is not set
> CONFIG_PPP=y
> CONFIG_PPP_MULTILINK=y
> CONFIG_PPP_FILTER=y
> CONFIG_PPP_ASYNC=y
> CONFIG_PPP_SYNC_TTY=y
> CONFIG_PPP_DEFLATE=y
> CONFIG_PPP_BSDCOMP=y
> # CONFIG_PPP_MPPE is not set
> CONFIG_PPPOE=y
> # CONFIG_PPPOATM is not set
> CONFIG_PPPOL2TP=y
> # CONFIG_SLIP is not set
> CONFIG_SLHC=y
> CONFIG_NET_FC=y
> CONFIG_NETCONSOLE=y
> CONFIG_NETCONSOLE_DYNAMIC=y
> CONFIG_NETPOLL=y
> CONFIG_NETPOLL_TRAP=y
> CONFIG_NET_POLL_CONTROLLER=y
> # CONFIG_VIRTIO_NET is not set
> CONFIG_ISDN=y
> CONFIG_ISDN_I4L=y
> # CONFIG_ISDN_PPP is not set
> # CONFIG_ISDN_AUDIO is not set
> CONFIG_ISDN_X25=y
> 
> #
> # ISDN feature submodules
> #
> # CONFIG_ISDN_DIVERSION is not set
> 
> #
> # ISDN4Linux hardware drivers
> #
> 
> #
> # Passive cards
> #
> CONFIG_ISDN_DRV_HISAX=y
> 
> #
> # D-channel protocol features
> #
> CONFIG_HISAX_EURO=y
> CONFIG_DE_AOC=y
> # CONFIG_HISAX_NO_SENDCOMPLETE is not set
> CONFIG_HISAX_NO_LLC=y
> CONFIG_HISAX_NO_KEYPAD=y
> # CONFIG_HISAX_1TR6 is not set
> CONFIG_HISAX_NI1=y
> CONFIG_HISAX_MAX_CARDS=8
> 
> #
> # HiSax supported cards
> #
> # CONFIG_HISAX_16_0 is not set
> # CONFIG_HISAX_16_3 is not set
> CONFIG_HISAX_TELESPCI=y
> # CONFIG_HISAX_S0BOX is not set
> CONFIG_HISAX_AVM_A1=y
> CONFIG_HISAX_FRITZPCI=y
> CONFIG_HISAX_AVM_A1_PCMCIA=y
> CONFIG_HISAX_ELSA=y
> CONFIG_HISAX_IX1MICROR2=y
> CONFIG_HISAX_DIEHLDIVA=y
> CONFIG_HISAX_ASUSCOM=y
> CONFIG_HISAX_TELEINT=y
> CONFIG_HISAX_HFCS=y
> # CONFIG_HISAX_SEDLBAUER is not set
> # CONFIG_HISAX_SPORTSTER is not set
> CONFIG_HISAX_MIC=y
> CONFIG_HISAX_NETJET=y
> # CONFIG_HISAX_NETJET_U is not set
> CONFIG_HISAX_NICCY=y
> CONFIG_HISAX_ISURF=y
> # CONFIG_HISAX_HSTSAPHIR is not set
> CONFIG_HISAX_BKM_A4T=y
> CONFIG_HISAX_SCT_QUADRO=y
> # CONFIG_HISAX_GAZEL is not set
> CONFIG_HISAX_HFC_PCI=y
> # CONFIG_HISAX_W6692 is not set
> CONFIG_HISAX_HFC_SX=y
> CONFIG_HISAX_ENTERNOW_PCI=y
> # CONFIG_HISAX_DEBUG is not set
> 
> #
> # HiSax PCMCIA card service modules
> #
> 
> #
> # HiSax sub driver modules
> #
> # CONFIG_HISAX_ST5481 is not set
> CONFIG_HISAX_HFCUSB=y
> CONFIG_HISAX_HFC4S8S=y
> CONFIG_HISAX_FRITZ_PCIPNP=y
> 
> #
> # Active cards
> #
> CONFIG_ISDN_DRV_PCBIT=y
> CONFIG_ISDN_DRV_SC=y
> # CONFIG_ISDN_DRV_ACT2000 is not set
> # CONFIG_ISDN_CAPI is not set
> CONFIG_ISDN_DRV_GIGASET=y
> CONFIG_GIGASET_BASE=y
> CONFIG_GIGASET_M105=y
> CONFIG_GIGASET_M101=y
> CONFIG_GIGASET_DEBUG=y
> # CONFIG_PHONE is not set
> 
> #
> # Input device support
> #
> CONFIG_INPUT=y
> CONFIG_INPUT_FF_MEMLESS=y
> CONFIG_INPUT_POLLDEV=y
> 
> #
> # Userland interfaces
> #
> CONFIG_INPUT_MOUSEDEV=y
> CONFIG_INPUT_MOUSEDEV_PSAUX=y
> CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
> CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
> # CONFIG_INPUT_JOYDEV is not set
> # CONFIG_INPUT_EVDEV is not set
> CONFIG_INPUT_EVBUG=y
> 
> #
> # Input Device Drivers
> #
> CONFIG_INPUT_KEYBOARD=y
> CONFIG_KEYBOARD_ATKBD=y
> CONFIG_KEYBOARD_LKKBD=y
> CONFIG_KEYBOARD_LM8323=y
> CONFIG_KEYBOARD_NEWTON=y
> CONFIG_KEYBOARD_STOWAWAY=y
> CONFIG_KEYBOARD_SUNKBD=y
> # CONFIG_KEYBOARD_XTKBD is not set
> # CONFIG_INPUT_MOUSE is not set
> CONFIG_INPUT_JOYSTICK=y
> CONFIG_JOYSTICK_ANALOG=y
> # CONFIG_JOYSTICK_A3D is not set
> CONFIG_JOYSTICK_ADI=y
> CONFIG_JOYSTICK_COBRA=y
> # CONFIG_JOYSTICK_GF2K is not set
> CONFIG_JOYSTICK_GRIP=y
> CONFIG_JOYSTICK_GRIP_MP=y
> CONFIG_JOYSTICK_GUILLEMOT=y
> CONFIG_JOYSTICK_INTERACT=y
> CONFIG_JOYSTICK_SIDEWINDER=y
> # CONFIG_JOYSTICK_TMDC is not set
> CONFIG_JOYSTICK_IFORCE=y
> # CONFIG_JOYSTICK_IFORCE_USB is not set
> CONFIG_JOYSTICK_IFORCE_232=y
> CONFIG_JOYSTICK_WARRIOR=y
> CONFIG_JOYSTICK_MAGELLAN=y
> CONFIG_JOYSTICK_SPACEORB=y
> CONFIG_JOYSTICK_SPACEBALL=y
> CONFIG_JOYSTICK_STINGER=y
> CONFIG_JOYSTICK_TWIDJOY=y
> CONFIG_JOYSTICK_ZHENHUA=y
> CONFIG_JOYSTICK_DB9=y
> # CONFIG_JOYSTICK_GAMECON is not set
> # CONFIG_JOYSTICK_TURBOGRAFX is not set
> # CONFIG_JOYSTICK_JOYDUMP is not set
> CONFIG_JOYSTICK_XPAD=y
> # CONFIG_JOYSTICK_XPAD_FF is not set
> CONFIG_JOYSTICK_XPAD_LEDS=y
> CONFIG_INPUT_TABLET=y
> # CONFIG_TABLET_USB_ACECAD is not set
> CONFIG_TABLET_USB_AIPTEK=y
> CONFIG_TABLET_USB_GTCO=y
> CONFIG_TABLET_USB_KBTAB=y
> CONFIG_TABLET_USB_WACOM=y
> # CONFIG_INPUT_TOUCHSCREEN is not set
> CONFIG_INPUT_MISC=y
> # CONFIG_INPUT_PCSPKR is not set
> # CONFIG_INPUT_APANEL is not set
> CONFIG_INPUT_WISTRON_BTNS=y
> CONFIG_INPUT_ATI_REMOTE=y
> # CONFIG_INPUT_ATI_REMOTE2 is not set
> CONFIG_INPUT_KEYSPAN_REMOTE=y
> # CONFIG_INPUT_POWERMATE is not set
> CONFIG_INPUT_YEALINK=y
> CONFIG_INPUT_CM109=y
> CONFIG_INPUT_UINPUT=y
> 
> #
> # Hardware I/O ports
> #
> CONFIG_SERIO=y
> CONFIG_SERIO_I8042=y
> CONFIG_SERIO_SERPORT=y
> CONFIG_SERIO_CT82C710=y
> CONFIG_SERIO_PARKBD=y
> CONFIG_SERIO_PCIPS2=y
> CONFIG_SERIO_LIBPS2=y
> # CONFIG_SERIO_RAW is not set
> CONFIG_GAMEPORT=y
> CONFIG_GAMEPORT_NS558=y
> CONFIG_GAMEPORT_L4=y
> CONFIG_GAMEPORT_EMU10K1=y
> # CONFIG_GAMEPORT_FM801 is not set
> 
> #
> # Character devices
> #
> CONFIG_VT=y
> CONFIG_CONSOLE_TRANSLATIONS=y
> CONFIG_VT_CONSOLE=y
> CONFIG_HW_CONSOLE=y
> CONFIG_VT_HW_CONSOLE_BINDING=y
> # CONFIG_DEVKMEM is not set
> CONFIG_SERIAL_NONSTANDARD=y
> CONFIG_COMPUTONE=y
> # CONFIG_ROCKETPORT is not set
> CONFIG_CYCLADES=y
> CONFIG_CYZ_INTR=y
> CONFIG_DIGIEPCA=y
> CONFIG_MOXA_INTELLIO=y
> CONFIG_MOXA_SMARTIO=y
> CONFIG_ISI=y
> CONFIG_SYNCLINK=y
> CONFIG_SYNCLINKMP=y
> # CONFIG_SYNCLINK_GT is not set
> CONFIG_N_HDLC=y
> CONFIG_RISCOM8=y
> # CONFIG_SPECIALIX is not set
> CONFIG_SX=y
> # CONFIG_RIO is not set
> CONFIG_STALDRV=y
> CONFIG_STALLION=y
> CONFIG_ISTALLION=y
> CONFIG_NOZOMI=y
> 
> #
> # Serial drivers
> #
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_FIX_EARLYCON_MEM=y
> # CONFIG_SERIAL_8250_PCI is not set
> CONFIG_SERIAL_8250_NR_UARTS=4
> CONFIG_SERIAL_8250_RUNTIME_UARTS=4
> # CONFIG_SERIAL_8250_EXTENDED is not set
> # CONFIG_SERIAL_8250_MCA is not set
> 
> #
> # Non-8250 serial port support
> #
> CONFIG_SERIAL_CORE=y
> CONFIG_SERIAL_CORE_CONSOLE=y
> CONFIG_SERIAL_JSM=y
> CONFIG_UNIX98_PTYS=y
> # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
> CONFIG_LEGACY_PTYS=y
> CONFIG_LEGACY_PTY_COUNT=256
> CONFIG_PRINTER=y
> # CONFIG_LP_CONSOLE is not set
> CONFIG_PPDEV=y
> # CONFIG_VIRTIO_CONSOLE is not set
> CONFIG_IPMI_HANDLER=y
> # CONFIG_IPMI_PANIC_EVENT is not set
> # CONFIG_IPMI_DEVICE_INTERFACE is not set
> CONFIG_IPMI_SI=y
> CONFIG_IPMI_WATCHDOG=y
> CONFIG_IPMI_POWEROFF=y
> CONFIG_HW_RANDOM=y
> CONFIG_HW_RANDOM_TIMERIOMEM=y
> CONFIG_HW_RANDOM_INTEL=y
> CONFIG_HW_RANDOM_AMD=y
> CONFIG_HW_RANDOM_GEODE=y
> # CONFIG_HW_RANDOM_VIA is not set
> CONFIG_HW_RANDOM_VIRTIO=y
> CONFIG_NVRAM=y
> # CONFIG_RTC is not set
> CONFIG_GEN_RTC=y
> CONFIG_GEN_RTC_X=y
> CONFIG_DTLK=y
> CONFIG_R3964=y
> CONFIG_APPLICOM=y
> CONFIG_SONYPI=y
> CONFIG_MWAVE=y
> CONFIG_SCx200_GPIO=y
> # CONFIG_PC8736x_GPIO is not set
> CONFIG_NSC_GPIO=y
> # CONFIG_CS5535_GPIO is not set
> # CONFIG_RAW_DRIVER is not set
> # CONFIG_HANGCHECK_TIMER is not set
> # CONFIG_TCG_TPM is not set
> CONFIG_TELCLOCK=y
> CONFIG_DEVPORT=y
> CONFIG_I2C=y
> CONFIG_I2C_BOARDINFO=y
> # CONFIG_I2C_CHARDEV is not set
> CONFIG_I2C_HELPER_AUTO=y
> CONFIG_I2C_ALGOBIT=y
> CONFIG_I2C_ALGOPCA=y
> 
> #
> # I2C Hardware Bus support
> #
> 
> #
> # PC SMBus host controller drivers
> #
> CONFIG_I2C_ALI1535=y
> CONFIG_I2C_ALI1563=y
> CONFIG_I2C_ALI15X3=y
> CONFIG_I2C_AMD756=y
> CONFIG_I2C_AMD8111=y
> CONFIG_I2C_I801=y
> CONFIG_I2C_ISCH=y
> CONFIG_I2C_PIIX4=y
> CONFIG_I2C_NFORCE2=y
> CONFIG_I2C_SIS5595=y
> CONFIG_I2C_SIS630=y
> # CONFIG_I2C_SIS96X is not set
> CONFIG_I2C_VIA=y
> # CONFIG_I2C_VIAPRO is not set
> 
> #
> # I2C system bus drivers (mostly embedded / system-on-chip)
> #
> CONFIG_I2C_OCORES=y
> CONFIG_I2C_SIMTEC=y
> 
> #
> # External I2C/SMBus adapter drivers
> #
> CONFIG_I2C_PARPORT=y
> CONFIG_I2C_PARPORT_LIGHT=y
> CONFIG_I2C_TAOS_EVM=y
> CONFIG_I2C_TINY_USB=y
> 
> #
> # Graphics adapter I2C/DDC channel drivers
> #
> # CONFIG_I2C_VOODOO3 is not set
> 
> #
> # Other I2C/SMBus bus drivers
> #
> CONFIG_I2C_PCA_PLATFORM=y
> # CONFIG_SCx200_I2C is not set
> CONFIG_SCx200_ACB=y
> 
> #
> # Miscellaneous I2C Chip support
> #
> CONFIG_DS1682=y
> # CONFIG_SENSORS_PCF8574 is not set
> CONFIG_PCF8575=y
> CONFIG_SENSORS_PCA9539=y
> CONFIG_SENSORS_TSL2550=y
> # CONFIG_I2C_DEBUG_CORE is not set
> # CONFIG_I2C_DEBUG_ALGO is not set
> CONFIG_I2C_DEBUG_BUS=y
> CONFIG_I2C_DEBUG_CHIP=y
> # CONFIG_SPI is not set
> 
> #
> # PPS support
> #
> # CONFIG_PPS is not set
> CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
> # CONFIG_GPIOLIB is not set
> CONFIG_W1=y
> CONFIG_W1_CON=y
> 
> #
> # 1-wire Bus Masters
> #
> CONFIG_W1_MASTER_MATROX=y
> # CONFIG_W1_MASTER_DS2490 is not set
> CONFIG_W1_MASTER_DS2482=y
> 
> #
> # 1-wire Slaves
> #
> # CONFIG_W1_SLAVE_THERM is not set
> CONFIG_W1_SLAVE_SMEM=y
> CONFIG_W1_SLAVE_DS2431=y
> CONFIG_W1_SLAVE_DS2433=y
> # CONFIG_W1_SLAVE_DS2433_CRC is not set
> CONFIG_W1_SLAVE_DS2760=y
> # CONFIG_W1_SLAVE_BQ27000 is not set
> CONFIG_POWER_SUPPLY=y
> CONFIG_POWER_SUPPLY_DEBUG=y
> CONFIG_PDA_POWER=y
> CONFIG_BATTERY_DS2760=y
> CONFIG_BATTERY_DS2782=y
> # CONFIG_BATTERY_BQ27x00 is not set
> CONFIG_BATTERY_DA9030=y
> # CONFIG_BATTERY_MAX17040 is not set
> CONFIG_HWMON=y
> CONFIG_HWMON_VID=y
> # CONFIG_SENSORS_ABITUGURU is not set
> CONFIG_SENSORS_ABITUGURU3=y
> CONFIG_SENSORS_AD7414=y
> CONFIG_SENSORS_AD7418=y
> CONFIG_SENSORS_ADM1021=y
> CONFIG_SENSORS_ADM1025=y
> # CONFIG_SENSORS_ADM1026 is not set
> # CONFIG_SENSORS_ADM1029 is not set
> CONFIG_SENSORS_ADM1031=y
> # CONFIG_SENSORS_ADM9240 is not set
> CONFIG_SENSORS_ADT7462=y
> CONFIG_SENSORS_ADT7470=y
> CONFIG_SENSORS_ADT7473=y
> # CONFIG_SENSORS_ADT7475 is not set
> # CONFIG_SENSORS_K8TEMP is not set
> # CONFIG_SENSORS_ASB100 is not set
> CONFIG_SENSORS_ATXP1=y
> CONFIG_SENSORS_DS1621=y
> CONFIG_SENSORS_I5K_AMB=y
> CONFIG_SENSORS_F71805F=y
> # CONFIG_SENSORS_F71882FG is not set
> CONFIG_SENSORS_F75375S=y
> # CONFIG_SENSORS_FSCHER is not set
> CONFIG_SENSORS_FSCPOS=y
> # CONFIG_SENSORS_FSCHMD is not set
> # CONFIG_SENSORS_G760A is not set
> # CONFIG_SENSORS_GL518SM is not set
> CONFIG_SENSORS_GL520SM=y
> CONFIG_SENSORS_CORETEMP=y
> # CONFIG_SENSORS_IBMAEM is not set
> CONFIG_SENSORS_IBMPEX=y
> CONFIG_SENSORS_IT87=y
> CONFIG_SENSORS_LM63=y
> CONFIG_SENSORS_LM75=y
> CONFIG_SENSORS_LM77=y
> CONFIG_SENSORS_LM78=y
> CONFIG_SENSORS_LM80=y
> CONFIG_SENSORS_LM83=y
> CONFIG_SENSORS_LM85=y
> CONFIG_SENSORS_LM87=y
> # CONFIG_SENSORS_LTC4215 is not set
> CONFIG_SENSORS_LTC4245=y
> CONFIG_SENSORS_LM95241=y
> # CONFIG_SENSORS_MAX1619 is not set
> # CONFIG_SENSORS_MAX6650 is not set
> CONFIG_SENSORS_PC87360=y
> CONFIG_SENSORS_PC87427=y
> CONFIG_SENSORS_PCF8591=y
> CONFIG_SENSORS_SIS5595=y
> # CONFIG_SENSORS_DME1737 is not set
> # CONFIG_SENSORS_SMSC47M1 is not set
> CONFIG_SENSORS_SMSC47M192=y
> CONFIG_SENSORS_SMSC47B397=y
> CONFIG_SENSORS_ADS7828=y
> CONFIG_SENSORS_THMC50=y
> CONFIG_SENSORS_TMP401=y
> CONFIG_SENSORS_VIA686A=y
> CONFIG_SENSORS_VT1211=y
> CONFIG_SENSORS_VT8231=y
> # CONFIG_SENSORS_W83781D is not set
> CONFIG_SENSORS_W83791D=y
> CONFIG_SENSORS_W83792D=y
> # CONFIG_SENSORS_W83793 is not set
> CONFIG_SENSORS_W83L785TS=y
> CONFIG_SENSORS_W83L786NG=y
> CONFIG_SENSORS_W83627HF=y
> CONFIG_SENSORS_W83627EHF=y
> CONFIG_SENSORS_HDAPS=y
> CONFIG_SENSORS_APPLESMC=y
> # CONFIG_HWMON_DEBUG_CHIP is not set
> CONFIG_THERMAL=y
> CONFIG_THERMAL_HWMON=y
> # CONFIG_WATCHDOG is not set
> CONFIG_SSB_POSSIBLE=y
> 
> #
> # Sonics Silicon Backplane
> #
> CONFIG_SSB=y
> CONFIG_SSB_SPROM=y
> CONFIG_SSB_PCIHOST_POSSIBLE=y
> CONFIG_SSB_PCIHOST=y
> # CONFIG_SSB_B43_PCI_BRIDGE is not set
> CONFIG_SSB_SILENT=y
> CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
> CONFIG_SSB_DRIVER_PCICORE=y
> 
> #
> # Multifunction device drivers
> #
> CONFIG_MFD_CORE=y
> CONFIG_MFD_SM501=y
> # CONFIG_HTC_PASIC3 is not set
> # CONFIG_TWL4030_CORE is not set
> # CONFIG_MFD_TMIO is not set
> CONFIG_PMIC_DA903X=y
> CONFIG_MFD_WM8400=y
> # CONFIG_MFD_PCF50633 is not set
> CONFIG_AB3100_CORE=y
> CONFIG_REGULATOR=y
> # CONFIG_REGULATOR_DEBUG is not set
> # CONFIG_REGULATOR_FIXED_VOLTAGE is not set
> CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
> CONFIG_REGULATOR_USERSPACE_CONSUMER=y
> CONFIG_REGULATOR_BQ24022=y
> # CONFIG_REGULATOR_MAX1586 is not set
> CONFIG_REGULATOR_WM8400=y
> CONFIG_REGULATOR_DA903X=y
> CONFIG_REGULATOR_LP3971=y
> CONFIG_MEDIA_SUPPORT=y
> 
> #
> # Multimedia core support
> #
> # CONFIG_VIDEO_DEV is not set
> # CONFIG_DVB_CORE is not set
> # CONFIG_VIDEO_MEDIA is not set
> 
> #
> # Multimedia drivers
> #
> # CONFIG_DAB is not set
> 
> #
> # Graphics support
> #
> CONFIG_AGP=y
> CONFIG_AGP_ALI=y
> CONFIG_AGP_ATI=y
> # CONFIG_AGP_AMD is not set
> CONFIG_AGP_AMD64=y
> CONFIG_AGP_INTEL=y
> # CONFIG_AGP_NVIDIA is not set
> CONFIG_AGP_SIS=y
> # CONFIG_AGP_SWORKS is not set
> # CONFIG_AGP_VIA is not set
> CONFIG_AGP_EFFICEON=y
> CONFIG_DRM=y
> CONFIG_DRM_TDFX=y
> CONFIG_DRM_R128=y
> # CONFIG_DRM_RADEON is not set
> CONFIG_DRM_I810=y
> # CONFIG_DRM_I830 is not set
> # CONFIG_DRM_I915 is not set
> # CONFIG_DRM_MGA is not set
> # CONFIG_DRM_SIS is not set
> # CONFIG_DRM_VIA is not set
> CONFIG_DRM_SAVAGE=y
> # CONFIG_VGASTATE is not set
> CONFIG_VIDEO_OUTPUT_CONTROL=y
> # CONFIG_FB is not set
> CONFIG_BACKLIGHT_LCD_SUPPORT=y
> # CONFIG_LCD_CLASS_DEVICE is not set
> # CONFIG_BACKLIGHT_CLASS_DEVICE is not set
> 
> #
> # Display device support
> #
> CONFIG_DISPLAY_SUPPORT=y
> 
> #
> # Display hardware drivers
> #
> 
> #
> # Console display driver support
> #
> CONFIG_VGA_CONSOLE=y
> # CONFIG_VGACON_SOFT_SCROLLBACK is not set
> CONFIG_DUMMY_CONSOLE=y
> # CONFIG_SOUND is not set
> CONFIG_HID_SUPPORT=y
> CONFIG_HID=y
> # CONFIG_HID_DEBUG is not set
> # CONFIG_HIDRAW is not set
> 
> #
> # USB Input Devices
> #
> CONFIG_USB_HID=y
> CONFIG_HID_PID=y
> CONFIG_USB_HIDDEV=y
> CONFIG_USB_MOUSE=y
> 
> #
> # Special HID drivers
> #
> CONFIG_HID_A4TECH=y
> CONFIG_HID_APPLE=y
> # CONFIG_HID_BELKIN is not set
> CONFIG_HID_CHERRY=y
> CONFIG_HID_CHICONY=y
> # CONFIG_HID_CYPRESS is not set
> # CONFIG_HID_DRAGONRISE is not set
> CONFIG_HID_EZKEY=y
> CONFIG_HID_KYE=y
> # CONFIG_HID_GYRATION is not set
> # CONFIG_HID_KENSINGTON is not set
> CONFIG_HID_LOGITECH=y
> CONFIG_LOGITECH_FF=y
> # CONFIG_LOGIRUMBLEPAD2_FF is not set
> # CONFIG_HID_MICROSOFT is not set
> CONFIG_HID_MONTEREY=y
> CONFIG_HID_NTRIG=y
> CONFIG_HID_PANTHERLORD=y
> CONFIG_PANTHERLORD_FF=y
> # CONFIG_HID_PETALYNX is not set
> # CONFIG_HID_SAMSUNG is not set
> CONFIG_HID_SONY=y
> CONFIG_HID_SUNPLUS=y
> CONFIG_HID_GREENASIA=y
> CONFIG_GREENASIA_FF=y
> CONFIG_HID_SMARTJOYPLUS=y
> CONFIG_SMARTJOYPLUS_FF=y
> # CONFIG_HID_TOPSEED is not set
> CONFIG_HID_THRUSTMASTER=y
> # CONFIG_THRUSTMASTER_FF is not set
> CONFIG_HID_ZEROPLUS=y
> CONFIG_ZEROPLUS_FF=y
> CONFIG_USB_SUPPORT=y
> CONFIG_USB_ARCH_HAS_HCD=y
> CONFIG_USB_ARCH_HAS_OHCI=y
> CONFIG_USB_ARCH_HAS_EHCI=y
> CONFIG_USB=y
> CONFIG_USB_DEBUG=y
> CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
> 
> #
> # Miscellaneous USB options
> #
> # CONFIG_USB_DEVICEFS is not set
> CONFIG_USB_DEVICE_CLASS=y
> # CONFIG_USB_DYNAMIC_MINORS is not set
> # CONFIG_USB_OTG is not set
> CONFIG_USB_OTG_WHITELIST=y
> # CONFIG_USB_OTG_BLACKLIST_HUB is not set
> CONFIG_USB_MON=y
> # CONFIG_USB_WUSB is not set
> # CONFIG_USB_WUSB_CBAF is not set
> 
> #
> # USB Host Controller Drivers
> #
> CONFIG_USB_C67X00_HCD=y
> # CONFIG_USB_XHCI_HCD is not set
> CONFIG_USB_EHCI_HCD=y
> CONFIG_USB_EHCI_ROOT_HUB_TT=y
> # CONFIG_USB_EHCI_TT_NEWSCHED is not set
> # CONFIG_USB_OXU210HP_HCD is not set
> # CONFIG_USB_ISP116X_HCD is not set
> CONFIG_USB_ISP1760_HCD=y
> CONFIG_USB_OHCI_HCD=y
> # CONFIG_USB_OHCI_HCD_SSB is not set
> # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
> # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
> CONFIG_USB_OHCI_LITTLE_ENDIAN=y
> CONFIG_USB_UHCI_HCD=y
> # CONFIG_USB_U132_HCD is not set
> CONFIG_USB_SL811_HCD=y
> CONFIG_USB_R8A66597_HCD=y
> # CONFIG_USB_HWA_HCD is not set
> 
> #
> # USB Device Class drivers
> #
> CONFIG_USB_ACM=y
> CONFIG_USB_PRINTER=y
> CONFIG_USB_WDM=y
> CONFIG_USB_TMC=y
> 
> #
> # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
> #
> 
> #
> # also be needed; see USB_STORAGE Help for more info
> #
> CONFIG_USB_STORAGE=y
> # CONFIG_USB_STORAGE_DEBUG is not set
> CONFIG_USB_STORAGE_DATAFAB=y
> CONFIG_USB_STORAGE_FREECOM=y
> CONFIG_USB_STORAGE_ISD200=y
> # CONFIG_USB_STORAGE_USBAT is not set
> CONFIG_USB_STORAGE_SDDR09=y
> CONFIG_USB_STORAGE_SDDR55=y
> CONFIG_USB_STORAGE_JUMPSHOT=y
> CONFIG_USB_STORAGE_ALAUDA=y
> # CONFIG_USB_STORAGE_ONETOUCH is not set
> # CONFIG_USB_STORAGE_KARMA is not set
> CONFIG_USB_STORAGE_CYPRESS_ATACB=y
> # CONFIG_USB_LIBUSUAL is not set
> 
> #
> # USB Imaging devices
> #
> CONFIG_USB_MDC800=y
> CONFIG_USB_MICROTEK=y
> 
> #
> # USB port drivers
> #
> CONFIG_USB_USS720=y
> CONFIG_USB_SERIAL=y
> CONFIG_USB_SERIAL_CONSOLE=y
> CONFIG_USB_EZUSB=y
> # CONFIG_USB_SERIAL_GENERIC is not set
> # CONFIG_USB_SERIAL_AIRCABLE is not set
> CONFIG_USB_SERIAL_ARK3116=y
> CONFIG_USB_SERIAL_BELKIN=y
> CONFIG_USB_SERIAL_CH341=y
> CONFIG_USB_SERIAL_WHITEHEAT=y
> CONFIG_USB_SERIAL_DIGI_ACCELEPORT=y
> # CONFIG_USB_SERIAL_CP210X is not set
> CONFIG_USB_SERIAL_CYPRESS_M8=y
> # CONFIG_USB_SERIAL_EMPEG is not set
> CONFIG_USB_SERIAL_FTDI_SIO=y
> # CONFIG_USB_SERIAL_FUNSOFT is not set
> CONFIG_USB_SERIAL_VISOR=y
> CONFIG_USB_SERIAL_IPAQ=y
> CONFIG_USB_SERIAL_IR=y
> CONFIG_USB_SERIAL_EDGEPORT=y
> CONFIG_USB_SERIAL_EDGEPORT_TI=y
> # CONFIG_USB_SERIAL_GARMIN is not set
> CONFIG_USB_SERIAL_IPW=y
> CONFIG_USB_SERIAL_IUU=y
> CONFIG_USB_SERIAL_KEYSPAN_PDA=y
> # CONFIG_USB_SERIAL_KEYSPAN is not set
> # CONFIG_USB_SERIAL_KLSI is not set
> # CONFIG_USB_SERIAL_KOBIL_SCT is not set
> CONFIG_USB_SERIAL_MCT_U232=y
> CONFIG_USB_SERIAL_MOS7720=y
> CONFIG_USB_SERIAL_MOS7840=y
> CONFIG_USB_SERIAL_MOTOROLA=y
> # CONFIG_USB_SERIAL_NAVMAN is not set
> # CONFIG_USB_SERIAL_PL2303 is not set
> CONFIG_USB_SERIAL_OTI6858=y
> # CONFIG_USB_SERIAL_QUALCOMM is not set
> # CONFIG_USB_SERIAL_SPCP8X5 is not set
> # CONFIG_USB_SERIAL_HP4X is not set
> # CONFIG_USB_SERIAL_SAFE is not set
> CONFIG_USB_SERIAL_SIEMENS_MPI=y
> CONFIG_USB_SERIAL_SIERRAWIRELESS=y
> # CONFIG_USB_SERIAL_SYMBOL is not set
> # CONFIG_USB_SERIAL_TI is not set
> # CONFIG_USB_SERIAL_CYBERJACK is not set
> # CONFIG_USB_SERIAL_XIRCOM is not set
> # CONFIG_USB_SERIAL_OPTION is not set
> CONFIG_USB_SERIAL_OMNINET=y
> CONFIG_USB_SERIAL_OPTICON=y
> # CONFIG_USB_SERIAL_DEBUG is not set
> 
> #
> # USB Miscellaneous drivers
> #
> CONFIG_USB_EMI62=y
> CONFIG_USB_EMI26=y
> CONFIG_USB_ADUTUX=y
> # CONFIG_USB_SEVSEG is not set
> CONFIG_USB_RIO500=y
> CONFIG_USB_LEGOTOWER=y
> # CONFIG_USB_LCD is not set
> CONFIG_USB_BERRY_CHARGE=y
> # CONFIG_USB_LED is not set
> # CONFIG_USB_CYPRESS_CY7C63 is not set
> CONFIG_USB_CYTHERM=y
> # CONFIG_USB_IDMOUSE is not set
> CONFIG_USB_FTDI_ELAN=y
> # CONFIG_USB_APPLEDISPLAY is not set
> CONFIG_USB_SISUSBVGA=y
> # CONFIG_USB_SISUSBVGA_CON is not set
> # CONFIG_USB_LD is not set
> CONFIG_USB_TRANCEVIBRATOR=y
> CONFIG_USB_IOWARRIOR=y
> CONFIG_USB_TEST=y
> CONFIG_USB_ISIGHTFW=y
> # CONFIG_USB_VST is not set
> # CONFIG_USB_ATM is not set
> 
> #
> # OTG and related infrastructure
> #
> CONFIG_USB_OTG_UTILS=y
> CONFIG_NOP_USB_XCEIV=y
> # CONFIG_UWB is not set
> # CONFIG_MMC is not set
> CONFIG_MEMSTICK=y
> CONFIG_MEMSTICK_DEBUG=y
> 
> #
> # MemoryStick drivers
> #
> CONFIG_MEMSTICK_UNSAFE_RESUME=y
> CONFIG_MSPRO_BLOCK=y
> 
> #
> # MemoryStick Host Controller Drivers
> #
> CONFIG_MEMSTICK_TIFM_MS=y
> # CONFIG_MEMSTICK_JMICRON_38X is not set
> CONFIG_NEW_LEDS=y
> CONFIG_LEDS_CLASS=y
> 
> #
> # LED drivers
> #
> # CONFIG_LEDS_NET48XX is not set
> CONFIG_LEDS_WRAP=y
> CONFIG_LEDS_ALIX2=y
> # CONFIG_LEDS_PCA9532 is not set
> CONFIG_LEDS_LP3944=y
> CONFIG_LEDS_CLEVO_MAIL=y
> CONFIG_LEDS_PCA955X=y
> # CONFIG_LEDS_DA903X is not set
> CONFIG_LEDS_BD2802=y
> 
> #
> # LED Triggers
> #
> # CONFIG_LEDS_TRIGGERS is not set
> CONFIG_ACCESSIBILITY=y
> CONFIG_A11Y_BRAILLE_CONSOLE=y
> CONFIG_INFINIBAND=y
> # CONFIG_INFINIBAND_USER_MAD is not set
> # CONFIG_INFINIBAND_USER_ACCESS is not set
> CONFIG_INFINIBAND_ADDR_TRANS=y
> CONFIG_INFINIBAND_MTHCA=y
> CONFIG_INFINIBAND_MTHCA_DEBUG=y
> CONFIG_INFINIBAND_AMSO1100=y
> CONFIG_INFINIBAND_AMSO1100_DEBUG=y
> CONFIG_INFINIBAND_CXGB3=y
> # CONFIG_INFINIBAND_CXGB3_DEBUG is not set
> CONFIG_MLX4_INFINIBAND=y
> CONFIG_INFINIBAND_NES=y
> # CONFIG_INFINIBAND_NES_DEBUG is not set
> CONFIG_INFINIBAND_IPOIB=y
> CONFIG_INFINIBAND_IPOIB_CM=y
> CONFIG_INFINIBAND_IPOIB_DEBUG=y
> CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
> CONFIG_INFINIBAND_SRP=y
> CONFIG_INFINIBAND_ISER=y
> CONFIG_EDAC=y
> 
> #
> # Reporting subsystems
> #
> # CONFIG_EDAC_DEBUG is not set
> CONFIG_EDAC_MM_EDAC=y
> CONFIG_EDAC_AMD76X=y
> # CONFIG_EDAC_E7XXX is not set
> # CONFIG_EDAC_E752X is not set
> # CONFIG_EDAC_I82875P is not set
> CONFIG_EDAC_I82975X=y
> CONFIG_EDAC_I3000=y
> CONFIG_EDAC_X38=y
> # CONFIG_EDAC_I5400 is not set
> CONFIG_EDAC_I82860=y
> CONFIG_EDAC_R82600=y
> CONFIG_EDAC_I5000=y
> CONFIG_EDAC_I5100=y
> # CONFIG_RTC_CLASS is not set
> CONFIG_DMADEVICES=y
> 
> #
> # DMA Devices
> #
> CONFIG_INTEL_IOATDMA=y
> CONFIG_DMA_ENGINE=y
> 
> #
> # DMA Clients
> #
> # CONFIG_NET_DMA is not set
> CONFIG_ASYNC_TX_DMA=y
> CONFIG_DMATEST=y
> CONFIG_DCA=y
> CONFIG_AUXDISPLAY=y
> CONFIG_KS0108=y
> CONFIG_KS0108_PORT=0x378
> CONFIG_KS0108_DELAY=2
> CONFIG_UIO=y
> CONFIG_UIO_CIF=y
> # CONFIG_UIO_PDRV is not set
> CONFIG_UIO_PDRV_GENIRQ=y
> CONFIG_UIO_SMX=y
> # CONFIG_UIO_AEC is not set
> CONFIG_UIO_SERCOS3=y
> 
> #
> # TI VLYNQ
> #
> # CONFIG_X86_PLATFORM_DEVICES is not set
> 
> #
> # Firmware Drivers
> #
> # CONFIG_EDD is not set
> CONFIG_FIRMWARE_MEMMAP=y
> CONFIG_DELL_RBU=y
> CONFIG_DCDBAS=y
> CONFIG_DMIID=y
> CONFIG_ISCSI_IBFT_FIND=y
> # CONFIG_ISCSI_IBFT is not set
> 
> #
> # File systems
> #
> CONFIG_EXT2_FS=y
> # CONFIG_EXT2_FS_XATTR is not set
> CONFIG_EXT2_FS_XIP=y
> CONFIG_EXT3_FS=y
> CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
> CONFIG_EXT3_FS_XATTR=y
> CONFIG_EXT3_FS_POSIX_ACL=y
> CONFIG_EXT3_FS_SECURITY=y
> # CONFIG_EXT4_FS is not set
> CONFIG_FS_XIP=y
> CONFIG_JBD=y
> CONFIG_JBD_DEBUG=y
> CONFIG_FS_MBCACHE=y
> CONFIG_REISERFS_FS=y
> CONFIG_REISERFS_CHECK=y
> CONFIG_REISERFS_PROC_INFO=y
> CONFIG_REISERFS_FS_XATTR=y
> CONFIG_REISERFS_FS_POSIX_ACL=y
> # CONFIG_REISERFS_FS_SECURITY is not set
> CONFIG_JFS_FS=y
> CONFIG_JFS_POSIX_ACL=y
> CONFIG_JFS_SECURITY=y
> CONFIG_JFS_DEBUG=y
> CONFIG_JFS_STATISTICS=y
> CONFIG_FS_POSIX_ACL=y
> CONFIG_XFS_FS=y
> # CONFIG_XFS_QUOTA is not set
> CONFIG_XFS_POSIX_ACL=y
> CONFIG_XFS_RT=y
> CONFIG_XFS_DEBUG=y
> # CONFIG_OCFS2_FS is not set
> CONFIG_BTRFS_FS=y
> # CONFIG_BTRFS_FS_POSIX_ACL is not set
> CONFIG_FILE_LOCKING=y
> CONFIG_FSNOTIFY=y
> # CONFIG_DNOTIFY is not set
> CONFIG_INOTIFY=y
> CONFIG_INOTIFY_USER=y
> CONFIG_QUOTA=y
> CONFIG_QUOTA_NETLINK_INTERFACE=y
> # CONFIG_PRINT_QUOTA_WARNING is not set
> CONFIG_QUOTA_TREE=y
> # CONFIG_QFMT_V1 is not set
> CONFIG_QFMT_V2=y
> CONFIG_QUOTACTL=y
> CONFIG_AUTOFS_FS=y
> CONFIG_AUTOFS4_FS=y
> CONFIG_FUSE_FS=y
> CONFIG_CUSE=y
> CONFIG_GENERIC_ACL=y
> 
> #
> # Caches
> #
> CONFIG_FSCACHE=y
> CONFIG_FSCACHE_STATS=y
> CONFIG_FSCACHE_HISTOGRAM=y
> CONFIG_FSCACHE_DEBUG=y
> CONFIG_CACHEFILES=y
> # CONFIG_CACHEFILES_DEBUG is not set
> CONFIG_CACHEFILES_HISTOGRAM=y
> 
> #
> # CD-ROM/DVD Filesystems
> #
> CONFIG_ISO9660_FS=y
> CONFIG_JOLIET=y
> CONFIG_ZISOFS=y
> # CONFIG_UDF_FS is not set
> 
> #
> # DOS/FAT/NT Filesystems
> #
> CONFIG_FAT_FS=y
> CONFIG_MSDOS_FS=y
> CONFIG_VFAT_FS=y
> CONFIG_FAT_DEFAULT_CODEPAGE=437
> CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
> CONFIG_NTFS_FS=y
> CONFIG_NTFS_DEBUG=y
> CONFIG_NTFS_RW=y
> 
> #
> # Pseudo filesystems
> #
> CONFIG_PROC_FS=y
> # CONFIG_PROC_KCORE is not set
> CONFIG_PROC_SYSCTL=y
> CONFIG_PROC_PAGE_MONITOR=y
> CONFIG_SYSFS=y
> CONFIG_TMPFS=y
> CONFIG_TMPFS_POSIX_ACL=y
> CONFIG_HUGETLBFS=y
> CONFIG_HUGETLB_PAGE=y
> CONFIG_CONFIGFS_FS=y
> # CONFIG_MISC_FILESYSTEMS is not set
> # CONFIG_NETWORK_FILESYSTEMS is not set
> CONFIG_EXPORTFS=y
> 
> #
> # Partition Types
> #
> CONFIG_PARTITION_ADVANCED=y
> CONFIG_ACORN_PARTITION=y
> # CONFIG_ACORN_PARTITION_CUMANA is not set
> CONFIG_ACORN_PARTITION_EESOX=y
> CONFIG_ACORN_PARTITION_ICS=y
> CONFIG_ACORN_PARTITION_ADFS=y
> # CONFIG_ACORN_PARTITION_POWERTEC is not set
> CONFIG_ACORN_PARTITION_RISCIX=y
> CONFIG_OSF_PARTITION=y
> CONFIG_AMIGA_PARTITION=y
> CONFIG_ATARI_PARTITION=y
> CONFIG_MAC_PARTITION=y
> CONFIG_MSDOS_PARTITION=y
> CONFIG_BSD_DISKLABEL=y
> CONFIG_MINIX_SUBPARTITION=y
> CONFIG_SOLARIS_X86_PARTITION=y
> CONFIG_UNIXWARE_DISKLABEL=y
> # CONFIG_LDM_PARTITION is not set
> CONFIG_SGI_PARTITION=y
> CONFIG_ULTRIX_PARTITION=y
> # CONFIG_SUN_PARTITION is not set
> CONFIG_KARMA_PARTITION=y
> # CONFIG_EFI_PARTITION is not set
> CONFIG_SYSV68_PARTITION=y
> CONFIG_NLS=y
> CONFIG_NLS_DEFAULT="iso8859-1"
> CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_CODEPAGE_737=y
> CONFIG_NLS_CODEPAGE_775=y
> CONFIG_NLS_CODEPAGE_850=y
> CONFIG_NLS_CODEPAGE_852=y
> # CONFIG_NLS_CODEPAGE_855 is not set
> # CONFIG_NLS_CODEPAGE_857 is not set
> CONFIG_NLS_CODEPAGE_860=y
> CONFIG_NLS_CODEPAGE_861=y
> # CONFIG_NLS_CODEPAGE_862 is not set
> CONFIG_NLS_CODEPAGE_863=y
> CONFIG_NLS_CODEPAGE_864=y
> # CONFIG_NLS_CODEPAGE_865 is not set
> # CONFIG_NLS_CODEPAGE_866 is not set
> CONFIG_NLS_CODEPAGE_869=y
> CONFIG_NLS_CODEPAGE_936=y
> CONFIG_NLS_CODEPAGE_950=y
> # CONFIG_NLS_CODEPAGE_932 is not set
> CONFIG_NLS_CODEPAGE_949=y
> # CONFIG_NLS_CODEPAGE_874 is not set
> CONFIG_NLS_ISO8859_8=y
> CONFIG_NLS_CODEPAGE_1250=y
> # CONFIG_NLS_CODEPAGE_1251 is not set
> CONFIG_NLS_ASCII=y
> CONFIG_NLS_ISO8859_1=y
> CONFIG_NLS_ISO8859_2=y
> CONFIG_NLS_ISO8859_3=y
> # CONFIG_NLS_ISO8859_4 is not set
> # CONFIG_NLS_ISO8859_5 is not set
> CONFIG_NLS_ISO8859_6=y
> CONFIG_NLS_ISO8859_7=y
> CONFIG_NLS_ISO8859_9=y
> CONFIG_NLS_ISO8859_13=y
> CONFIG_NLS_ISO8859_14=y
> CONFIG_NLS_ISO8859_15=y
> CONFIG_NLS_KOI8_R=y
> CONFIG_NLS_KOI8_U=y
> CONFIG_NLS_UTF8=y
> CONFIG_DLM=y
> CONFIG_DLM_DEBUG=y
> 
> #
> # Kernel hacking
> #
> CONFIG_TRACE_IRQFLAGS_SUPPORT=y
> # CONFIG_PRINTK_TIME is not set
> CONFIG_ALLOW_WARNINGS=y
> # CONFIG_ENABLE_WARN_DEPRECATED is not set
> CONFIG_ENABLE_MUST_CHECK=y
> CONFIG_FRAME_WARN=1024
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_UNUSED_SYMBOLS=y
> CONFIG_DEBUG_FS=y
> CONFIG_HEADERS_CHECK=y
> CONFIG_DEBUG_SECTION_MISMATCH=y
> CONFIG_DEBUG_KERNEL=y
> CONFIG_DEBUG_SHIRQ=y
> CONFIG_DETECT_SOFTLOCKUP=y
> # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
> CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
> # CONFIG_DETECT_HUNG_TASK is not set
> CONFIG_SCHED_DEBUG=y
> CONFIG_SCHEDSTATS=y
> # CONFIG_TIMER_STATS is not set
> CONFIG_DEBUG_OBJECTS=y
> CONFIG_DEBUG_OBJECTS_SELFTEST=y
> CONFIG_DEBUG_OBJECTS_FREE=y
> CONFIG_DEBUG_OBJECTS_TIMERS=y
> CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
> # CONFIG_SLUB_DEBUG_ON is not set
> # CONFIG_SLUB_STATS is not set
> CONFIG_DEBUG_RT_MUTEXES=y
> CONFIG_DEBUG_PI_LIST=y
> CONFIG_RT_MUTEX_TESTER=y
> CONFIG_DEBUG_SPINLOCK=y
> CONFIG_DEBUG_MUTEXES=y
> CONFIG_DEBUG_LOCK_ALLOC=y
> CONFIG_PROVE_LOCKING=y
> CONFIG_LOCKDEP=y
> CONFIG_LOCK_STAT=y
> CONFIG_DEBUG_LOCKDEP=y
> CONFIG_TRACE_IRQFLAGS=y
> CONFIG_DEBUG_SPINLOCK_SLEEP=y
> # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
> CONFIG_STACKTRACE=y
> # CONFIG_DEBUG_HIGHMEM is not set
> # CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_DEBUG_VM=y
> CONFIG_DEBUG_VIRTUAL=y
> CONFIG_DEBUG_WRITECOUNT=y
> CONFIG_DEBUG_MEMORY_INIT=y
> # CONFIG_DEBUG_LIST is not set
> CONFIG_DEBUG_SG=y
> CONFIG_DEBUG_NOTIFIERS=y
> CONFIG_ARCH_WANT_FRAME_POINTERS=y
> CONFIG_FRAME_POINTER=y
> CONFIG_BOOT_PRINTK_DELAY=y
> CONFIG_RCU_TORTURE_TEST=y
> CONFIG_RCU_TORTURE_TEST_RUNNABLE=y
> CONFIG_RCU_CPU_STALL_DETECTOR=y
> # CONFIG_BACKTRACE_SELF_TEST is not set
> CONFIG_FAULT_INJECTION=y
> # CONFIG_FAILSLAB is not set
> CONFIG_FAIL_PAGE_ALLOC=y
> CONFIG_FAIL_MAKE_REQUEST=y
> # CONFIG_FAIL_IO_TIMEOUT is not set
> CONFIG_FAULT_INJECTION_DEBUG_FS=y
> CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
> CONFIG_LATENCYTOP=y
> # CONFIG_SYSCTL_SYSCALL_CHECK is not set
> CONFIG_DEBUG_PAGEALLOC=y
> CONFIG_USER_STACKTRACE_SUPPORT=y
> CONFIG_NOP_TRACER=y
> CONFIG_HAVE_FTRACE_NMI_ENTER=y
> CONFIG_HAVE_FUNCTION_TRACER=y
> CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
> CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
> CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
> CONFIG_HAVE_DYNAMIC_FTRACE=y
> CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
> CONFIG_HAVE_FTRACE_SYSCALLS=y
> CONFIG_TRACER_MAX_TRACE=y
> CONFIG_RING_BUFFER=y
> CONFIG_FTRACE_NMI_ENTER=y
> CONFIG_EVENT_TRACING=y
> CONFIG_CONTEXT_SWITCH_TRACER=y
> CONFIG_TRACING=y
> CONFIG_GENERIC_TRACER=y
> CONFIG_TRACING_SUPPORT=y
> CONFIG_FTRACE=y
> CONFIG_FUNCTION_TRACER=y
> # CONFIG_IRQSOFF_TRACER is not set
> CONFIG_SYSPROF_TRACER=y
> CONFIG_SCHED_TRACER=y
> CONFIG_FTRACE_SYSCALLS=y
> # CONFIG_BOOT_TRACER is not set
> CONFIG_BRANCH_PROFILE_NONE=y
> # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
> # CONFIG_PROFILE_ALL_BRANCHES is not set
> # CONFIG_POWER_TRACER is not set
> # CONFIG_KSYM_TRACER is not set
> CONFIG_STACK_TRACER=y
> CONFIG_KMEMTRACE=y
> # CONFIG_WORKQUEUE_TRACER is not set
> CONFIG_BLK_DEV_IO_TRACE=y
> CONFIG_DYNAMIC_FTRACE=y
> # CONFIG_FUNCTION_PROFILER is not set
> CONFIG_FTRACE_MCOUNT_RECORD=y
> # CONFIG_FTRACE_STARTUP_TEST is not set
> # CONFIG_MMIOTRACE is not set
> CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
> # CONFIG_FIREWIRE_OHCI_REMOTE_DMA is not set
> CONFIG_BUILD_DOCSRC=y
> CONFIG_DYNAMIC_DEBUG=y
> CONFIG_DMA_API_DEBUG=y
> CONFIG_SAMPLES=y
> CONFIG_HAVE_ARCH_KGDB=y
> CONFIG_KGDB=y
> # CONFIG_KGDB_SERIAL_CONSOLE is not set
> CONFIG_KGDB_TESTS=y
> CONFIG_HAVE_ARCH_KMEMCHECK=y
> # CONFIG_STRICT_DEVMEM is not set
> # CONFIG_X86_VERBOSE_BOOTUP is not set
> CONFIG_EARLY_PRINTK=y
> CONFIG_EARLY_PRINTK_DBGP=y
> # CONFIG_DEBUG_STACKOVERFLOW is not set
> CONFIG_DEBUG_STACK_USAGE=y
> CONFIG_DEBUG_PER_CPU_MAPS=y
> # CONFIG_X86_PTDUMP is not set
> # CONFIG_DEBUG_RODATA is not set
> # CONFIG_4KSTACKS is not set
> CONFIG_DOUBLEFAULT=y
> # CONFIG_IOMMU_STRESS is not set
> CONFIG_HAVE_MMIOTRACE_SUPPORT=y
> CONFIG_IO_DELAY_TYPE_0X80=0
> CONFIG_IO_DELAY_TYPE_0XED=1
> CONFIG_IO_DELAY_TYPE_UDELAY=2
> CONFIG_IO_DELAY_TYPE_NONE=3
> CONFIG_IO_DELAY_0X80=y
> # CONFIG_IO_DELAY_0XED is not set
> # CONFIG_IO_DELAY_UDELAY is not set
> # CONFIG_IO_DELAY_NONE is not set
> CONFIG_DEFAULT_IO_DELAY_TYPE=0
> CONFIG_DEBUG_BOOT_PARAMS=y
> # CONFIG_CPA_DEBUG is not set
> # CONFIG_OPTIMIZE_INLINING is not set
> 
> #
> # Security options
> #
> CONFIG_KEYS=y
> # CONFIG_KEYS_DEBUG_PROC_KEYS is not set
> CONFIG_SECURITY=y
> CONFIG_SECURITYFS=y
> # CONFIG_SECURITY_NETWORK is not set
> CONFIG_SECURITY_PATH=y
> CONFIG_SECURITY_FILE_CAPABILITIES=y
> CONFIG_SECURITY_TOMOYO=y
> CONFIG_CRYPTO=y
> 
> #
> # Crypto core or helper
> #
> CONFIG_CRYPTO_FIPS=y
> CONFIG_CRYPTO_ALGAPI=y
> CONFIG_CRYPTO_ALGAPI2=y
> CONFIG_CRYPTO_AEAD=y
> CONFIG_CRYPTO_AEAD2=y
> CONFIG_CRYPTO_BLKCIPHER=y
> CONFIG_CRYPTO_BLKCIPHER2=y
> CONFIG_CRYPTO_HASH=y
> CONFIG_CRYPTO_HASH2=y
> CONFIG_CRYPTO_RNG=y
> CONFIG_CRYPTO_RNG2=y
> CONFIG_CRYPTO_PCOMP=y
> CONFIG_CRYPTO_MANAGER=y
> CONFIG_CRYPTO_MANAGER2=y
> CONFIG_CRYPTO_GF128MUL=y
> CONFIG_CRYPTO_NULL=y
> CONFIG_CRYPTO_WORKQUEUE=y
> # CONFIG_CRYPTO_CRYPTD is not set
> CONFIG_CRYPTO_AUTHENC=y
> 
> #
> # Authenticated Encryption with Associated Data
> #
> CONFIG_CRYPTO_CCM=y
> # CONFIG_CRYPTO_GCM is not set
> CONFIG_CRYPTO_SEQIV=y
> 
> #
> # Block modes
> #
> # CONFIG_CRYPTO_CBC is not set
> CONFIG_CRYPTO_CTR=y
> # CONFIG_CRYPTO_CTS is not set
> CONFIG_CRYPTO_ECB=y
> # CONFIG_CRYPTO_LRW is not set
> CONFIG_CRYPTO_PCBC=y
> CONFIG_CRYPTO_XTS=y
> 
> #
> # Hash modes
> #
> CONFIG_CRYPTO_HMAC=y
> CONFIG_CRYPTO_XCBC=y
> 
> #
> # Digest
> #
> CONFIG_CRYPTO_CRC32C=y
> CONFIG_CRYPTO_CRC32C_INTEL=y
> # CONFIG_CRYPTO_MD4 is not set
> CONFIG_CRYPTO_MD5=y
> CONFIG_CRYPTO_MICHAEL_MIC=y
> # CONFIG_CRYPTO_RMD128 is not set
> CONFIG_CRYPTO_RMD160=y
> CONFIG_CRYPTO_RMD256=y
> CONFIG_CRYPTO_RMD320=y
> CONFIG_CRYPTO_SHA1=y
> # CONFIG_CRYPTO_SHA256 is not set
> # CONFIG_CRYPTO_SHA512 is not set
> # CONFIG_CRYPTO_TGR192 is not set
> CONFIG_CRYPTO_WP512=y
> 
> #
> # Ciphers
> #
> CONFIG_CRYPTO_AES=y
> CONFIG_CRYPTO_AES_586=y
> CONFIG_CRYPTO_ANUBIS=y
> CONFIG_CRYPTO_ARC4=y
> # CONFIG_CRYPTO_BLOWFISH is not set
> CONFIG_CRYPTO_CAMELLIA=y
> CONFIG_CRYPTO_CAST5=y
> # CONFIG_CRYPTO_CAST6 is not set
> CONFIG_CRYPTO_DES=y
> CONFIG_CRYPTO_FCRYPT=y
> CONFIG_CRYPTO_KHAZAD=y
> # CONFIG_CRYPTO_SALSA20 is not set
> # CONFIG_CRYPTO_SALSA20_586 is not set
> # CONFIG_CRYPTO_SEED is not set
> CONFIG_CRYPTO_SERPENT=y
> # CONFIG_CRYPTO_TEA is not set
> CONFIG_CRYPTO_TWOFISH=y
> CONFIG_CRYPTO_TWOFISH_COMMON=y
> CONFIG_CRYPTO_TWOFISH_586=y
> 
> #
> # Compression
> #
> CONFIG_CRYPTO_DEFLATE=y
> CONFIG_CRYPTO_ZLIB=y
> # CONFIG_CRYPTO_LZO is not set
> 
> #
> # Random Number Generation
> #
> # CONFIG_CRYPTO_ANSI_CPRNG is not set
> CONFIG_CRYPTO_HW=y
> # CONFIG_CRYPTO_DEV_PADLOCK is not set
> # CONFIG_CRYPTO_DEV_GEODE is not set
> CONFIG_CRYPTO_DEV_HIFN_795X=y
> CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y
> CONFIG_HAVE_KVM=y
> CONFIG_HAVE_KVM_IRQCHIP=y
> CONFIG_VIRTUALIZATION=y
> CONFIG_KVM=y
> CONFIG_KVM_INTEL=y
> # CONFIG_KVM_AMD is not set
> # CONFIG_KVM_TRACE is not set
> CONFIG_VIRTIO=y
> CONFIG_VIRTIO_RING=y
> # CONFIG_VIRTIO_PCI is not set
> CONFIG_VIRTIO_BALLOON=y
> CONFIG_BINARY_PRINTF=y
> 
> #
> # Library routines
> #
> CONFIG_BITREVERSE=y
> CONFIG_GENERIC_FIND_FIRST_BIT=y
> CONFIG_GENERIC_FIND_NEXT_BIT=y
> CONFIG_GENERIC_FIND_LAST_BIT=y
> CONFIG_CRC_CCITT=y
> CONFIG_CRC16=y
> CONFIG_CRC_T10DIF=y
> CONFIG_CRC_ITU_T=y
> CONFIG_CRC32=y
> CONFIG_CRC7=y
> CONFIG_LIBCRC32C=y
> CONFIG_AUDIT_GENERIC=y
> CONFIG_ZLIB_INFLATE=y
> CONFIG_ZLIB_DEFLATE=y
> CONFIG_DECOMPRESS_GZIP=y
> CONFIG_DECOMPRESS_BZIP2=y
> CONFIG_DECOMPRESS_LZMA=y
> CONFIG_GENERIC_ALLOCATOR=y
> CONFIG_HAS_IOMEM=y
> CONFIG_HAS_IOPORT=y
> CONFIG_HAS_DMA=y
> CONFIG_CHECK_SIGNATURE=y
> CONFIG_CPUMASK_OFFSTACK=y
> CONFIG_NLATTR=y
> CONFIG_FORCE_SUCCESSFUL_BUILD=y
> CONFIG_FORCE_MINIMAL_CONFIG=y
> CONFIG_FORCE_MINIMAL_CONFIG_PHYS=y
> CONFIG_X86_32_ALWAYS_ON=y


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-08-02 20:00     ` Ingo Molnar
@ 2009-08-03  5:09       ` Mike Galbraith
  2009-08-04  8:21         ` Mike Galbraith
  0 siblings, 1 reply; 1149+ messages in thread
From: Mike Galbraith @ 2009-08-03  5:09 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML

On Sun, 2009-08-02 at 22:00 +0200, Ingo Molnar wrote:
> * Mike Galbraith <efault@gmx.de> wrote:
> 
> > On Fri, 2009-07-24 at 10:58 +0200, Peter Zijlstra wrote:
> > > On Fri, 2009-07-24 at 10:09 +0200, Mike Galbraith wrote:
> > > > (depends on last resurrect annotation patch)
> > > > 
> > > > perf_counter tools: allow top users to switch between weighted and individual counter display.
> > > > 
> > > > Add [w]eighted hotkey.  Pressing [w] toggles between displaying weighted total of all counters,
> > > > and the counter selected via [E]vent select key.
> > > 
> > > /me stuck it next to that other one, let see what happens ;-)
> > 
> > (plugs in Bitwolf-9000 charger)
> 
> seems to work well here.
> 
> A few minor comments:
> 
>  - I had to guess that '?' gets me a help screen. Might make sense 
>    to display a line at the bottom (?) to give some hints.
> 
>  - Once i was on the help screen, i expected either <Enter> or '?' 
>    to make it vanish. Only setting an option got rid of it - i 
>    suspect this should be improved. (Also, a line in the help screen 
>    that tells us how to go back without changing anything would be 
>    helpful as well.)

How about the below?

>  - I randomly tried the 's' option to do annotation. But it didnt do 
>    anything. Probably because i didnt start perf top via --vmlinux, 
>    right? This behavior is not intuitive in any case - it should 
>    probably display an error message at minimum - but if possible it 
>    should try to guess the position of the vmlinux file.

Guessing would require rebuilding symbols, and serialization for the
data acquisition thread, maybe something to do when/if top is made fully
interactive.  In the below, I just show what keys are available with the
provided command line options.

Not sure I like waiting for input at start though, maybe just display
and sleep a couple seconds would be friendlier.


perf_counter tools: improve perf top interactive key handling.

Display mapped keys and wait for input on startup to ensure that the user
knows which keys are available.  Change keypress handling such that current
vairable values are displayed, and pressing an unmapped key continues with
variables unchanged.


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

 tools/perf/builtin-top.c |  109 +++++++++++++++++++++++++++++++---------------
 1 files changed, 74 insertions(+), 35 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4eef346..f463dc9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -595,25 +595,84 @@ out_free:
 	free(buf);
 }
 
-static void print_known_keys(void)
+static void print_mapped_keys(void)
 {
-	fprintf(stdout, "\nknown keys:\n");
-	fprintf(stdout, "\t[d]     select display delay.\n");
-	fprintf(stdout, "\t[e]     select display entries (lines).\n");
-	fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
-	fprintf(stdout, "\t[f]     select normal display count filter.\n");
-	fprintf(stdout, "\t[F]     select annotation display count filter (percentage).\n");
-	fprintf(stdout, "\t[qQ]    quit.\n");
-	fprintf(stdout, "\t[s]     select annotation symbol and start annotation.\n");
-	fprintf(stdout, "\t[S]     stop annotation, revert to normal display.\n");
-	fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+	char *name = NULL;
+
+	if (sym_filter_entry) {
+		struct symbol *sym = (struct symbol *)(sym_filter_entry+1);
+		name = sym->name;
+	}
+
+	fprintf(stdout, "\nMapped keys:\n");
+	fprintf(stdout, "\t[d]     display refresh delay.             \t(%d)\n", delay_secs);
+	fprintf(stdout, "\t[e]     display entries (lines).           \t(%d)\n", print_entries);
+
+	if (nr_counters > 1)
+		fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
+
+	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
+
+	if (vmlinux) {
+		fprintf(stdout, "\t[F]     annotate display filter (percent). \t(%d%%)\n", sym_pcnt_filter);
+		fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
+		fprintf(stdout, "\t[S]     stop annotation.\n");
+	}
+
+	if (nr_counters > 1)
+		fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+
 	fprintf(stdout, "\t[z]     toggle sample zeroing.             \t(%d)\n", zero ? 1 : 0);
+	fprintf(stdout, "\t[qQ]    quit.\n");
+}
+
+static int key_mapped(int c)
+{
+	switch (c) {
+		case 'd':
+		case 'e':
+		case 'f':
+		case 'z':
+		case 'q':
+		case 'Q':
+			return 1;
+		case 'E':
+		case 'w':
+			return nr_counters > 1 ? 1 : 0;
+		case 'F':
+		case 's':
+		case 'S':
+			return vmlinux ? 1 : 0;
+	}
+
+	return 0;
 }
 
 static void handle_keypress(int c)
 {
-	int once = 0;
-repeat:
+	if (!key_mapped(c)) {
+		struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
+		struct termios tc, save;
+
+		print_mapped_keys();
+		fprintf(stdout, "\nEnter selection, or unmapped key to continue: ");
+		fflush(stdout);
+
+		tcgetattr(0, &save);
+		tc = save;
+		tc.c_lflag &= ~(ICANON | ECHO);
+		tc.c_cc[VMIN] = 0;
+		tc.c_cc[VTIME] = 0;
+		tcsetattr(0, TCSANOW, &tc);
+
+		poll(&stdin_poll, 1, -1);
+		c = getc(stdin);
+
+		tcsetattr(0, TCSAFLUSH, &save);
+		if (!key_mapped(c))
+			return;
+	}
+
 	switch (c) {
 		case 'd':
 			prompt_integer(&delay_secs, "Enter display delay");
@@ -669,28 +728,6 @@ repeat:
 		case 'z':
 			zero = ~zero;
 			break;
-		default: {
-			struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
-			struct termios tc, save;
-
-			if (!once) {
-				print_known_keys();
-				once++;
-			}
-
-			tcgetattr(0, &save);
-			tc = save;
-			tc.c_lflag &= ~(ICANON | ECHO);
-			tc.c_cc[VMIN] = 0;
-			tc.c_cc[VTIME] = 0;
-			tcsetattr(0, TCSANOW, &tc);
-
-			poll(&stdin_poll, 1, -1);
-			c = getc(stdin);
-
-			tcsetattr(0, TCSAFLUSH, &save);
-			goto repeat;
-		}
 	}
 }
 
@@ -705,6 +742,8 @@ static void *display_thread(void *arg __used)
 	tc.c_lflag &= ~(ICANON | ECHO);
 	tc.c_cc[VMIN] = 0;
 	tc.c_cc[VTIME] = 0;
+
+	handle_keypress(0);
 repeat:
 	delay_msecs = delay_secs * 1000;
 	tcsetattr(0, TCSANOW, &tc);



^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-02 22:13                   ` Paul E. McKenney
@ 2009-08-03  5:15                     ` Paul E. McKenney
  2009-08-03  7:04                     ` Ingo Molnar
  2009-08-04  5:47                     ` Gautham R Shenoy
  2 siblings, 0 replies; 1149+ messages in thread
From: Paul E. McKenney @ 2009-08-03  5:15 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits, ego

On Sun, Aug 02, 2009 at 03:13:24PM -0700, Paul E. McKenney wrote:
> On Sun, Aug 02, 2009 at 10:27:20PM +0200, Ingo Molnar wrote:
> > 
> > * tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> > 
> > > Commit-ID:  7256cf0e83bf018be8a81806593aaef7f2437f0b
> > > Gitweb:     http://git.kernel.org/tip/7256cf0e83bf018be8a81806593aaef7f2437f0b
> > > Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > AuthorDate: Sun, 2 Aug 2009 10:21:10 -0700
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Sun, 2 Aug 2009 21:31:28 +0200
> > > 
> > > rcu: Add diagnostic check for a possible CPU-hotplug race
> > > 
> > > Complain if the RCU softirq code ever runs on a CPU that has
> > > not yet been announced to RCU as being online.
> > > 
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > LKML-Reference: <new-submission>
> > > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > 
> > FYI, the new warning triggered in -tip testing:
> 
> Yow!!!  I never was able to get this to trigger...  Of course, I never
> was able to reproduce the original problem, either.
> 
> Just so you know, one of the reasons it took me so long to come up with
> the fix is that this just isn't supposed to happen.  Where I grew up, CPUs
> were supposed to come online -before- starting to handle softirqs.  ;-)
> 
> Here is my reasoning:
> 
> o	rcu_init(), which is invoked before a second CPU can possibly
> 	come online, calls hotplug_notifier(), which causes
> 	rcu_barrier_cpu_hotplug() to be invoked in response to any
> 	CPU-hotplug event.
> 
> o	We know rcu_init() really was called, because otherwise
> 	open_softirq(RCU_SOFTIRQ) never gets called, so the softirq would
> 	never have happened.  In addition, there should be a "Hierarchical
> 	RCU implementation" message in your bootlog.  (Is there?)
> 
> o	rcu_barrier_cpu_hotplug() unconditionally invokes
> 	rcu_cpu_notify() on every CPU-hotplug event.
> 
> o	rcu_cpu_notify() invokes rcu_online_cpu() in response to
> 	any CPU_UP_PREPARE or CPU_UP_PREPARE_FROZEN CPU-hotplug
> 	event.
> 
> o	The CPU_UP_PREPARE and CPU_UP_PREPARE_FROZEN CPU-hotplug events
> 	happen before the CPU in question is capable of running any code.
> 
> o	This looks to be the first onlining of this CPU during boot
> 	(right?).  So we cannot possibly have some strange situation
> 	where the end of the prior CPU-offline event overlaps with
> 	the current CPU-online event.  (Yes, this isn't supposed to
> 	happen courtesy of CPU-hotplug locking, but impossibility
> 	is clearly no reason to dismiss possible scenarios for -this-
> 	particular bug.)
> 
> o	Therefore the WARN_ON_ONCE() cannot possibly trigger.
> 
> This would be a convincing argument, aside from the fact that you
> really did make it trigger.  So first, anything I am missing in
> the above?  If not, could you please help me with the following,
> at least if the answers are readily available?
> 
> o	Is rcu_init()'s "Hierarchical RCU implementation" log message
> 	in your bootlog?
> 
> o	Is _cpu_up() really being called, and, if so, is it really
> 	invoking __raw_notifier_call_chain() with CPU_UP_PREPARE?
> 
> o	Is this really during initial boot, or am I misreading your
> 	bootlog?  (The other reason I believe that this happened on
> 	the first CPU-online for this CPU is that ->beenonline, once
> 	set, is never cleared.)
> 
> Gautham, any thoughts on what might be happening here?

And on the off-chance that someone is stomping on the notifier chain...
Untested, probably does not compile.  Diagnostic only, not for inclusion.
If this doesn't trigger the WARN_ON_ONCE() added to rcu_init(), the
idea would be to move the WARN_ON_ONCE() to rcu_process_callbacks().
If it does trigger there, then my guess would be that either someone is
unregistering the RCU CPU-hotplug notifier or directly corrupting the
notifier chain.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 include/linux/cpu.h |    3 +++
 kernel/cpu.c        |    5 +++++
 kernel/notifier.c   |   15 +++++++++++++++
 kernel/rcupdate.c   |    3 ++-
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e0..c8a8323 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -51,6 +51,9 @@ struct notifier_block;
 #ifdef CONFIG_HOTPLUG_CPU
 extern int register_cpu_notifier(struct notifier_block *nb);
 extern void unregister_cpu_notifier(struct notifier_block *nb);
+extern int cpu_notified(int (*fn)(struct notifier_block *, unsigned long, void *));
+extern int notifier_chain_is_registered(struct notifier_block *nl,
+		int (*fn)(struct notifier_block *, unsigned long, void *));
 #else
 
 #ifndef MODULE
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8ce1004..1b98862 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -133,6 +133,11 @@ int __ref register_cpu_notifier(struct notifier_block *nb)
 	return ret;
 }
 
+int cpu_notified(int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	return notifier_chain_is_registered(&cpu_chain, fn);
+}
+
 #ifdef CONFIG_HOTPLUG_CPU
 
 EXPORT_SYMBOL(register_cpu_notifier);
diff --git a/kernel/notifier.c b/kernel/notifier.c
index 61d5aa5..069e3d0 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -59,6 +59,21 @@ static int notifier_chain_unregister(struct notifier_block **nl,
 	return -ENOENT;
 }
 
+int notifier_chain_is_registered(struct notifier_block *nl,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	rcu_read_lock();
+	while (nl != NULL) {
+		if (rcu_dereference(nl)->notifier_call == fn) {
+			rcu_read_unlock();
+			return 0;
+		}
+		nl = &(rcu_dereference(nl)->next);
+	}
+	rcu_read_unlock();
+	return -ENOENT;
+}
+
 /**
  * notifier_call_chain - Informs the registered notifiers about an event.
  *	@nl:		Pointer to head of the blocking notifier chain
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 3fea910..30c3af7 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -220,7 +220,7 @@ static void rcu_migrate_callback(struct rcu_head *notused)
 extern int rcu_cpu_notify(struct notifier_block *self,
 			  unsigned long action, void *hcpu);
 
-static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
+int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 		unsigned long action, void *hcpu)
 {
 	rcu_cpu_notify(self, action, hcpu);
@@ -249,6 +249,7 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 void __init rcu_init(void)
 {
 	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+	WARN_ON_ONCE(!cpu_notified(rcu_barrier_cpu_hotplug));
 	__rcu_init();
 }
 

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-02 22:13                   ` Paul E. McKenney
  2009-08-03  5:15                     ` Paul E. McKenney
@ 2009-08-03  7:04                     ` Ingo Molnar
  2009-08-03 12:56                       ` Paul E. McKenney
  2009-08-04  8:18                       ` [tip:core/rcu] rcu: Add " Gautham R Shenoy
  2009-08-04  5:47                     ` Gautham R Shenoy
  2 siblings, 2 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-03  7:04 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits, ego


i've attached the full serial bootlog with the warning in it. This 
should address your question about what the order of initialization 
is, right?

Let me know if you still would like me to run your diagnostic patch 
too.

	Ingo

[    0.000000] Linux version 2.6.31-rc5-tip (mingo@sirius) (gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) ) #291 SMP PREEMPT Sun Aug 2 22:49:56 CEST 2009
[    0.000000] Command line: root=/dev/sda6 earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 debug initcall_debug apic=verbose sysrq_always_enabled ignore_loglevel selinux=0 nmi_watchdog=0 panic=1 3 nolapic_timer hpet=disable idle=poll highmem=512m nopat acpi=off pci=nomsi
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
[    0.000000]  BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000003fff0000 (usable)
[    0.000000]  BIOS-e820: 000000003fff0000 - 000000003fff3000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000003fff3000 - 0000000040000000 (ACPI data)
[    0.000000]  BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)
[    0.000000] bootconsole [earlyser0] enabled
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] using polling idle threads.
[    0.000000] last_pfn = 0x3fff0 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-C7FFF write-protect
[    0.000000]   C8000-FFFFF uncachable
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 0000000000 mask FFC0000000 write-back
[    0.000000]   1 disabled
[    0.000000]   2 disabled
[    0.000000]   3 disabled
[    0.000000]   4 disabled
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] e820 update range: 0000000000001000 - 0000000000006000 (usable) ==> (reserved)
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] modified physical RAM map:
[    0.000000]  modified: 0000000000000000 - 0000000000001000 (usable)
[    0.000000]  modified: 0000000000001000 - 0000000000006000 (reserved)
[    0.000000]  modified: 0000000000006000 - 000000000009f800 (usable)
[    0.000000]  modified: 000000000009f800 - 00000000000a0000 (reserved)
[    0.000000]  modified: 00000000000f0000 - 0000000000100000 (reserved)
[    0.000000]  modified: 0000000000100000 - 000000003fff0000 (usable)
[    0.000000]  modified: 000000003fff0000 - 000000003fff3000 (ACPI NVS)
[    0.000000]  modified: 000000003fff3000 - 0000000040000000 (ACPI data)
[    0.000000]  modified: 00000000e0000000 - 00000000f0000000 (reserved)
[    0.000000]  modified: 00000000fec00000 - 0000000100000000 (reserved)
[    0.000000] initial memory mapped : 0 - 20000000
[    0.000000] init_memory_mapping: 0000000000000000-000000003fff0000
[    0.000000]  0000000000 - 003fff0000 page 4k
[    0.000000] kernel direct mapping tables up to 3fff0000 @ 100000-302000
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at 0000000000000000-000000003fff0000
[    0.000000] Bootmem setup node 0 0000000000000000-000000003fff0000
[    0.000000]   NODE_DATA [0000000000008000 - 0000000000046fff]
[    0.000000]   bootmap [0000000000047000 -  000000000004efff] pages 8
[    0.000000] (5 early reservations) ==> bootmem [0000000000 - 003fff0000]
[    0.000000]   #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
[    0.000000]   #1 [0000006000 - 0000008000]       TRAMPOLINE ==> [0000006000 - 0000008000]
[    0.000000]   #2 [0001000000 - 00033f8d90]    TEXT DATA BSS ==> [0001000000 - 00033f8d90]
[    0.000000]   #3 [000009f800 - 0000100000]    BIOS reserved ==> [000009f800 - 0000100000]
[    0.000000]   #4 [0000100000 - 0000300000]          PGTABLE ==> [0000100000 - 0000300000]
[    0.000000] Scan SMP from ffff880000000000 for 1024 bytes.
[    0.000000] Scan SMP from ffff88000009fc00 for 1024 bytes.
[    0.000000] Scan SMP from ffff8800000f0000 for 65536 bytes.
[    0.000000] found SMP MP-table at [ffff8800000f5680] f5680
[    0.000000]   mpc: f1400-f152c
[    0.000000]  [ffffea0000000000-ffffea00015fffff] PMD -> [ffff880003800000-ffff880004dfffff] on node 0
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000000 -> 0x00001000
[    0.000000]   DMA32    0x00001000 -> 0x00100000
[    0.000000]   Normal   0x00100000 -> 0x00100000
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[3] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00000001
[    0.000000]     0: 0x00000006 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0003fff0
[    0.000000] On node 0 totalpages: 262026
[    0.000000]   DMA zone: 88 pages used for memmap
[    0.000000]   DMA zone: 611 pages reserved
[    0.000000]   DMA zone: 3295 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 5544 pages used for memmap
[    0.000000]   DMA32 zone: 252488 pages, LIFO batch:31
[    0.000000] Intel MultiProcessor Specification v1.4
[    0.000000]   mpc: f1400-f152c
[    0.000000] MPTABLE: OEM ID: OEM00000
[    0.000000] MPTABLE: Product ID: PROD00000000
[    0.000000] MPTABLE: APIC at: 0xFEE00000
[    0.000000] Processor #0 (Bootup-CPU)
[    0.000000] Processor #1
[    0.000000] Bus #0 is PCI   
[    0.000000] Bus #1 is PCI   
[    0.000000] Bus #2 is PCI   
[    0.000000] Bus #3 is PCI   
[    0.000000] Bus #4 is PCI   
[    0.000000] Bus #5 is PCI   
[    0.000000] Bus #6 is ISA   
[    0.000000] I/O APIC #2 Version 17 at 0xFEC00000.
[    0.000000] Int: type 0, pol 3, trig 3, bus 00, IRQ 28, APIC ID 2, APIC INT 0b
[    0.000000] Int: type 0, pol 3, trig 3, bus 00, IRQ 10, APIC ID 2, APIC INT 03
[    0.000000] Int: type 0, pol 3, trig 3, bus 01, IRQ 00, APIC ID 2, APIC INT 05
[    0.000000] Int: type 0, pol 3, trig 3, bus 05, IRQ 1c, APIC ID 2, APIC INT 0b
[    0.000000] Int: type 3, pol 0, trig 0, bus 06, IRQ 00, APIC ID 2, APIC INT 00
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 01, APIC ID 2, APIC INT 01
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 00, APIC ID 2, APIC INT 02
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 04, APIC ID 2, APIC INT 04
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 06, APIC ID 2, APIC INT 06
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 07, APIC ID 2, APIC INT 07
[    0.000000] Int: type 0, pol 1, trig 1, bus 06, IRQ 08, APIC ID 2, APIC INT 08
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 09, APIC ID 2, APIC INT 09
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 0a, APIC ID 2, APIC INT 0a
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 0c, APIC ID 2, APIC INT 0c
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 0d, APIC ID 2, APIC INT 0d
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 0e, APIC ID 2, APIC INT 0e
[    0.000000] Int: type 0, pol 0, trig 0, bus 06, IRQ 0f, APIC ID 2, APIC INT 0f
[    0.000000] Lint: type 3, pol 0, trig 0, bus 00, IRQ 00, APIC ID ff, APIC LINT 00
[    0.000000] Lint: type 1, pol 0, trig 0, bus 00, IRQ 00, APIC ID ff, APIC LINT 01
[    0.000000] Processors: 2
[    0.000000] SMP: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] mapped APIC to ffffffffff5fc000 (fee00000)
[    0.000000] mapped IOAPIC to ffffffffff5fb000 (fec00000)
[    0.000000] nr_irqs_gsi: 24
[    0.000000] Allocating PCI resources starting at 40000000 (gap: 40000000:a0000000)
[    0.000000] NR_CPUS:4096 nr_cpumask_bits:2 nr_cpu_ids:2 nr_node_ids:1
[    0.000000] PERCPU: Embedded 29 pages at ffff88000347c000, static data 95072 bytes
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 255783
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: root=/dev/sda6 earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 debug initcall_debug apic=verbose sysrq_always_enabled ignore_loglevel selinux=0 nmi_watchdog=0 panic=1 3 nolapic_timer hpet=disable idle=poll highmem=512m nopat acpi=off pci=nomsi
[    0.000000] debug: sysrq always enabled.
[    0.000000] PID hash table entries: 4096 (order: 12, 32768 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Memory: 985624k/1048512k available (15196k kernel code, 408k absent, 62480k reserved, 9977k data, 868k init)
[    0.000000] SLUB: Genslabs=14, HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] RCU-based detection of stalled CPUs is enabled.
[    0.000000] NR_IRQS:33024 nr_irqs:424
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 2010.639 MHz processor.
[    0.000015] spurious 8259A interrupt: IRQ7.
[    0.006744] Console: colour VGA+ 80x25
[    0.010000] console [ttyS0] enabled, bootconsole disabled
[    0.010000] console [ttyS0] enabled, bootconsole disabled
[    0.010000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.010000] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.010000] ... MAX_LOCK_DEPTH:          48
[    0.010000] ... MAX_LOCKDEP_KEYS:        8191
[    0.010000] ... CLASSHASH_SIZE:          4096
[    0.010000] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.010000] ... MAX_LOCKDEP_CHAINS:      32768
[    0.010000] ... CHAINHASH_SIZE:          16384
[    0.010000]  memory used by lock dependency info: 5823 kB
[    0.010000]  per task-struct memory footprint: 1920 bytes
[    0.010000] ------------------------
[    0.010000] | Locking API testsuite:
[    0.010000] ----------------------------------------------------------------------------
[    0.010000]                                  | spin |wlock |rlock |mutex | wsem | rsem |
[    0.010000]   --------------------------------------------------------------------------
[    0.010000]                      A-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]                  A-B-B-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]              A-B-B-C-C-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]              A-B-C-A-B-C deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]          A-B-B-C-C-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]          A-B-C-D-B-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]          A-B-C-D-B-C-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
[    0.010000]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.010000]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.010000]                  bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.010000]   --------------------------------------------------------------------------
[    0.010000]               recursive read-lock:             |  ok  |             |failed|
[    0.010000]            recursive read-lock #2:             |  ok  |             |failed|
[    0.010000]             mixed read-write-lock:             |failed|             |failed|
[    0.010000]             mixed write-read-lock:             |failed|             |failed|
[    0.010000]   --------------------------------------------------------------------------
[    0.010000]      hard-irqs-on + irq-safe-A/12:failed|failed|  ok  |
[    0.010000]      soft-irqs-on + irq-safe-A/12:failed|failed|  ok  |
[    0.010000]      hard-irqs-on + irq-safe-A/21:failed|failed|  ok  |
[    0.010000]      soft-irqs-on + irq-safe-A/21:failed|failed|  ok  |
[    0.010000]        sirq-safe-A => hirqs-on/12:failed|failed|  ok  |
[    0.010000]        sirq-safe-A => hirqs-on/21:failed|failed|  ok  |
[    0.010000]          hard-safe-A + irqs-on/12:failed|failed|  ok  |
[    0.010000]          soft-safe-A + irqs-on/12:failed|failed|  ok  |
[    0.010000]          hard-safe-A + irqs-on/21:failed|failed|  ok  |
[    0.010000]          soft-safe-A + irqs-on/21:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/123:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/123:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/132:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/132:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/213:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/213:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/231:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/231:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/312:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/312:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #1/321:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #1/321:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/123:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/123:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/132:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/132:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/213:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/213:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/231:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/231:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/312:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/312:failed|failed|  ok  |
[    0.010000]     hard-safe-A + unsafe-B #2/321:failed|failed|  ok  |
[    0.010000]     soft-safe-A + unsafe-B #2/321:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/123:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/123:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/132:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/132:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/213:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/213:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/231:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/231:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/312:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/312:failed|failed|  ok  |
[    0.010000]       hard-irq lock-inversion/321:failed|failed|  ok  |
[    0.010000]       soft-irq lock-inversion/321:failed|failed|  ok  |
[    0.010000]       hard-irq read-recursion/123:  ok  |
[    0.010000]       soft-irq read-recursion/123:  ok  |
[    0.010000]       hard-irq read-recursion/132:  ok  |
[    0.010000]       soft-irq read-recursion/132:  ok  |
[    0.010000]       hard-irq read-recursion/213:  ok  |
[    0.010000]       soft-irq read-recursion/213:  ok  |
[    0.010000]       hard-irq read-recursion/231:  ok  |
[    0.010000]       soft-irq read-recursion/231:  ok  |
[    0.010000]       hard-irq read-recursion/312:  ok  |
[    0.010000]       soft-irq read-recursion/312:  ok  |
[    0.010000]       hard-irq read-recursion/321:  ok  |
[    0.010000]       soft-irq read-recursion/321:  ok  |
[    0.010000] --------------------------------------------------------
[    0.010000] 133 out of 218 testcases failed, as expected. |
[    0.010000] ----------------------------------------------------
[    0.010000] ODEBUG: 11 of 11 active objects replaced
[    0.010000] ODEBUG: selftest passed
[    0.010013] Calibrating delay loop (skipped), value calculated using timer frequency.. 4021.27 BogoMIPS (lpj=20106390)
[    0.020634] Security Framework initialized
[    0.024730] TOMOYO Linux initialized
[    0.028979] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.030924] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.040482] Mount-cache hash table entries: 256
[    0.050722] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.057847] CPU: L2 Cache: 512K (64 bytes/line)
[    0.060006] CPU 0/0x0 -> Node 0
[    0.063146] tseg: 0000000000
[    0.066032] CPU: Physical Processor ID: 0
[    0.070003] CPU: Processor Core ID: 0
[    0.073660] mce: CPU supports 5 MCE banks
[    0.080899] debug: unmapping init memory ffffffff8289a000..ffffffff828ac000
[    0.088243] Setting APIC routing to flat
[    0.090012] enabled ExtINT on CPU#0
[    0.093548] ExtINT not setup in hardware but reported by MP table
[    0.100094] ENABLING IO-APIC IRQs
[    0.103408] init IO_APIC IRQs
[    0.106371]  2-0 (apicid-pin) not connected
[    0.110021] IOAPIC[0]: Set routing entry (2-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.117334] IOAPIC[0]: Set routing entry (2-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
[    0.120014] IOAPIC[0]: Set routing entry (2-3 -> 0x33 -> IRQ 3 Mode:1 Active:1)
[    0.127323] IOAPIC[0]: Set routing entry (2-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-5 -> 0x35 -> IRQ 5 Mode:1 Active:1)
[    0.130000] IOAPIC[0]: Set routing entry (2-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-9 -> 0x39 -> IRQ 9 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-11 -> 0x3b -> IRQ 11 Mode:1 Active:1)
[    0.130000] IOAPIC[0]: Set routing entry (2-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
[    0.130000] IOAPIC[0]: Set routing entry (2-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
[    0.130000]  2-16 2-17 2-18 2-19 2-20 2-21 2-22 2-23 (apicid-pin) not connected
[    0.130000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
[    0.130000] ..MP-BIOS bug: 8254 timer not connected to IO-APIC
[    0.130000] ...trying to set up timer (IRQ0) through the 8259A ...
[    0.130000] ..... (found apic 0 pin 0) ...
[    0.232854] ....... works.
[    0.235555] CPU0: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
[    0.241237] Disabling APIC timer
[    0.250011] calling  migration_init+0x0/0x7f @ 1
[    0.254802] initcall migration_init+0x0/0x7f returned 0 after 0 usecs
[    0.260006] calling  spawn_ksoftirqd+0x0/0x7f @ 1
[    0.264792] initcall spawn_ksoftirqd+0x0/0x7f returned 0 after 0 usecs
[    0.270006] calling  init_call_single_data+0x0/0xd5 @ 1
[    0.275234] initcall init_call_single_data+0x0/0xd5 returned 0 after 0 usecs
[    0.280005] calling  spawn_softlockup_task+0x0/0x9b @ 1
[    0.290126] initcall spawn_softlockup_task+0x0/0x9b returned 0 after 0 usecs
[    0.297160] calling  relay_init+0x0/0x2d @ 1
[    0.300005] initcall relay_init+0x0/0x2d returned 0 after 0 usecs
[    0.306096] calling  tracer_alloc_buffers+0x0/0x2b6 @ 1
[    0.310195] initcall tracer_alloc_buffers+0x0/0x2b6 returned 0 after 0 usecs
[    0.320005] calling  init_trace_printk+0x0/0x2d @ 1
[    0.324882] initcall init_trace_printk+0x0/0x2d returned 0 after 0 usecs
[    0.330004] calling  trace_workqueue_early_init+0x0/0x164 @ 1
[    0.335806] initcall trace_workqueue_early_init+0x0/0x164 returned 0 after 0 usecs
[    0.350022] lockdep: fixing up alternatives.
[    0.354423] Booting processor 1 APIC 0x1 ip 0x6000
[    0.010000] Initializing CPU#1
[    0.010000] masked ExtINT on CPU#1
[    0.010000] Calibrating delay using timer specific routine.. 4020.69 BogoMIPS (lpj=20103483)
[    0.010000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.010000] CPU: L2 Cache: 512K (64 bytes/line)
[    0.010000] CPU 1/0x1 -> Node 0
[    0.010000] CPU: Physical Processor ID: 0
[    0.010000] CPU: Processor Core ID: 1
[    0.010000] mce: CPU supports 5 MCE banks
[    0.520258] CPU1: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
[    0.530009] ------------[ cut here ]------------
[    0.530019] WARNING: at kernel/rcutree.c:1140 __rcu_process_callbacks+0x4b/0x294()
[    0.530024] Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip #291
[    0.530027] Call Trace:
[    0.530029]  <IRQ>  [<ffffffff810becbc>] ? __rcu_process_callbacks+0x4b/0x294
[    0.530037]  [<ffffffff8107c455>] warn_slowpath_common+0x68/0xab
[    0.530041]  [<ffffffff8107c4bf>] warn_slowpath_null+0x27/0x3d
[    0.530045]  [<ffffffff810becbc>] __rcu_process_callbacks+0x4b/0x294
[    0.530050]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    0.530055]  [<ffffffff810bef43>] rcu_process_callbacks+0x3e/0x76
[    0.530059]  [<ffffffff8108312a>] __do_softirq+0x12c/0x24b
[    0.530064]  [<ffffffff8102f44c>] call_softirq+0x1c/0x28
[    0.530068]  [<ffffffff8103177a>] do_softirq+0x56/0xb3
[    0.530073]  [<ffffffff810a5442>] ? tick_handle_periodic+0x35/0x9b
[    0.530077]  [<ffffffff8108274f>] irq_exit+0x57/0x7c
[    0.530083]  [<ffffffff81047643>] smp_apic_timer_interrupt+0xa0/0xc6
[    0.530088]  [<ffffffff8102ee33>] apic_timer_interrupt+0x13/0x20
[    0.530090]  <EOI>  [<ffffffff810374ca>] ? need_resched+0x53/0x54
[    0.530098]  [<ffffffff810375ac>] ? poll_idle+0x3c/0x5f
[    0.530102]  [<ffffffff8102d376>] ? enter_idle+0x38/0x4e
[    0.530106]  [<ffffffff8102d436>] ? cpu_idle+0xaa/0x110
[    0.530112]  [<ffffffff8290a187>] ? start_secondary+0x1c7/0x1e2
[    0.530119] ---[ end trace 93d72a36b9146f22 ]---
[    0.540003]  stepping 02
[    0.542554] Brought up 2 CPUs
[    0.550004] Total of 2 processors activated (8041.97 BogoMIPS).
[    0.556465] CPU0 attaching sched-domain:
[    0.560007]  domain 0: span 0-1 level CPU
[    0.564032]   groups: 0 1
[    0.570008] CPU1 attaching sched-domain:
[    0.573934]  domain 0: span 0-1 level CPU
[    0.577958]   groups: 1 0
[    0.581105] device: 'platform': device_add
[    0.585775] bus: 'platform': registered
[    0.589626] Registering sysdev class 'cpu'
[    0.590213] Registering sysdev class 'memory'
[    0.594788] Registering sys device of class 'memory'
[    0.600010] Registering sys device 'memory0'
[    0.604507] Registering sys device of class 'memory'
[    0.610008] Registering sys device 'memory1'
[    0.614511] Registering sys device of class 'memory'
[    0.620009] Registering sys device 'memory2'
[    0.624488] Registering sys device of class 'memory'
[    0.630008] Registering sys device 'memory3'
[    0.634469] Registering sys device of class 'memory'
[    0.640009] Registering sys device 'memory4'
[    0.644520] Registering sys device of class 'memory'
[    0.650008] Registering sys device 'memory5'
[    0.654481] Registering sys device of class 'memory'
[    0.660009] Registering sys device 'memory6'
[    0.664499] Registering sys device of class 'memory'
[    0.669460] Registering sys device 'memory7'
[    0.680699] calling  init_cpufreq_transition_notifier_list+0x0/0x42 @ 1
[    0.687308] initcall init_cpufreq_transition_notifier_list+0x0/0x42 returned 0 after 0 usecs
[    0.690006] calling  net_ns_init+0x0/0x11b @ 1
[    0.700016] initcall net_ns_init+0x0/0x11b returned 0 after 0 usecs
[    0.706277] calling  cpufreq_tsc+0x0/0x28 @ 1
[    0.710004] initcall cpufreq_tsc+0x0/0x28 returned 0 after 0 usecs
[    0.716175] calling  print_banner+0x0/0xe @ 1
[    0.720035] Booting paravirtualized kernel on bare hardware
[    0.725605] initcall print_banner+0x0/0xe returned 0 after 0 usecs
[    0.730004] calling  init_smp_flush+0x0/0x64 @ 1
[    0.734617] initcall init_smp_flush+0x0/0x64 returned 0 after 0 usecs
[    0.740004] calling  sysctl_init+0x0/0x59 @ 1
[    0.744570] initcall sysctl_init+0x0/0x59 returned 0 after 0 usecs
[    0.750003] calling  ksysfs_init+0x0/0xe4 @ 1
[    0.754637] initcall ksysfs_init+0x0/0xe4 returned 0 after 0 usecs
[    0.760020] calling  async_init+0x0/0x69 @ 1
[    0.770004] initcall async_init+0x0/0x69 returned 0 after 0 usecs
[    0.776088] calling  init_jiffies_clocksource+0x0/0x39 @ 1
[    0.780008] initcall init_jiffies_clocksource+0x0/0x39 returned 0 after 0 usecs
[    0.787309] calling  init_hw_breakpoint+0x0/0x39 @ 1
[    0.790006] initcall init_hw_breakpoint+0x0/0x39 returned 0 after 0 usecs
[    0.800027] calling  filelock_init+0x0/0x55 @ 1
[    0.804637] initcall filelock_init+0x0/0x55 returned 0 after 0 usecs
[    0.810004] calling  init_misc_binfmt+0x0/0x67 @ 1
[    0.814800] initcall init_misc_binfmt+0x0/0x67 returned 0 after 0 usecs
[    0.820004] calling  init_script_binfmt+0x0/0x3b @ 1
[    0.824963] initcall init_script_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.830004] calling  init_elf_binfmt+0x0/0x3b @ 1
[    0.834704] initcall init_elf_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.840019] calling  init_compat_elf_binfmt+0x0/0x3b @ 1
[    0.850004] initcall init_compat_elf_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.857128] calling  debugfs_init+0x0/0x80 @ 1
[    0.860011] initcall debugfs_init+0x0/0x80 returned 0 after 0 usecs
[    0.866269] calling  securityfs_init+0x0/0x77 @ 1
[    0.870011] initcall securityfs_init+0x0/0x77 returned 0 after 0 usecs
[    0.880019] calling  random32_init+0x0/0xff @ 1
[    0.884547] initcall random32_init+0x0/0xff returned 0 after 0 usecs
[    0.890003] calling  cpufreq_core_init+0x0/0xaa @ 1
[    0.894878] initcall cpufreq_core_init+0x0/0xaa returned 0 after 0 usecs
[    0.900005] calling  virtio_init+0x0/0x52 @ 1
[    0.904567] bus: 'virtio': registered
[    0.910005] initcall virtio_init+0x0/0x52 returned 0 after 9765 usecs
[    0.916434] calling  sock_init+0x0/0x80 @ 1
[    0.920220] initcall sock_init+0x0/0x80 returned 0 after 0 usecs
[    0.926216] calling  netpoll_init+0x0/0x69 @ 1
[    0.930004] initcall netpoll_init+0x0/0x69 returned 0 after 0 usecs
[    0.936268] calling  netlink_proto_init+0x0/0x169 @ 1
[    0.940054] NET: Registered protocol family 16
[    0.944557] initcall netlink_proto_init+0x0/0x169 returned 0 after 0 usecs
[    0.950027] calling  bdi_class_init+0x0/0x68 @ 1
[    0.954642] device class 'bdi': registering
[    0.960271] initcall bdi_class_init+0x0/0x68 returned 0 after 9765 usecs
[    0.970005] calling  kobject_uevent_init+0x0/0x7b @ 1
[    0.975070] initcall kobject_uevent_init+0x0/0x7b returned 0 after 0 usecs
[    0.980004] calling  gpiolib_sysfs_init+0x0/0xbc @ 1
[    0.984961] device class 'gpio': registering
[    0.990252] initcall gpiolib_sysfs_init+0x0/0xbc returned 0 after 9765 usecs
[    0.997293] calling  pcibus_class_init+0x0/0x40 @ 1
[    1.000004] device class 'pci_bus': registering
[    1.004788] initcall pcibus_class_init+0x0/0x40 returned 0 after 0 usecs
[    1.010004] calling  pci_driver_init+0x0/0x39 @ 1
[    1.020227] bus: 'pci': registered
[    1.023630] initcall pci_driver_init+0x0/0x39 returned 0 after 0 usecs
[    1.030005] calling  lcd_class_init+0x0/0x74 @ 1
[    1.034623] device class 'lcd': registering
[    1.039024] initcall lcd_class_init+0x0/0x74 returned 0 after 0 usecs
[    1.040004] calling  backlight_class_init+0x0/0x84 @ 1
[    1.050003] device class 'backlight': registering
[    1.054907] initcall backlight_class_init+0x0/0x84 returned 0 after 0 usecs
[    1.060005] calling  tty_class_init+0x0/0x58 @ 1
[    1.064617] device class 'tty': registering
[    1.070242] initcall tty_class_init+0x0/0x58 returned 0 after 9765 usecs
[    1.076936] calling  vtconsole_class_init+0x0/0xe8 @ 1
[    1.080005] device class 'vtconsole': registering
[    1.084930] device: 'vtcon0': device_add
[    1.090293] initcall vtconsole_class_init+0x0/0xe8 returned 0 after 9765 usecs
[    1.100005] calling  register_node_type+0x0/0xa4 @ 1
[    1.104960] Registering sysdev class 'node'
[    1.109376] initcall register_node_type+0x0/0xa4 returned 0 after 0 usecs
[    1.110005] calling  spi_init+0x0/0xd4 @ 1
[    1.120238] bus: 'spi': registered
[    1.123635] device class 'spi_master': registering
[    1.128652] initcall spi_init+0x0/0xd4 returned 0 after 0 usecs
[    1.130006] calling  i2c_init+0x0/0x8c @ 1
[    1.134334] bus: 'i2c': registered
[    1.140003] device class 'i2c-adapter': registering
[    1.145077] bus: 'i2c': add driver dummy
[    1.150253] initcall i2c_init+0x0/0x8c returned 0 after 19531 usecs
[    1.156512] calling  amd_postcore_init+0x0/0xa3 @ 1
[    1.160008] node 0 link 0: io port [1000, fffff]
[    1.164624] TOM: 0000000040000000 aka 1024M
[    1.170003] node 0 link 0: mmio [e0000000, efffffff]
[    1.174979] node 0 link 0: mmio [feb00000, fec0ffff]
[    1.180200] node 0 link 0: mmio [a0000, bffff]
[    1.184659] node 0 link 0: mmio [40000000, fed3ffff]
[    1.190215] bus: [00,ff] on node 0 link 0
[    1.194224] bus: 00 index 0 io port: [0, ffff]
[    1.200003] bus: 00 index 1 mmio: [40000000, fcffffffff]
[    1.205308] bus: 00 index 2 mmio: [feb00000, fec0ffff]
[    1.210003] bus: 00 index 3 mmio: [a0000, bffff]
[    1.214618] initcall amd_postcore_init+0x0/0xa3 returned 0 after 48828 usecs
[    1.220003] calling  arch_kdebugfs_init+0x0/0x2a7 @ 1
[    1.225086] initcall arch_kdebugfs_init+0x0/0x2a7 returned 0 after 0 usecs
[    1.230018] calling  mtrr_if_init+0x0/0x8a @ 1
[    1.234470] initcall mtrr_if_init+0x0/0x8a returned 0 after 0 usecs
[    1.240004] calling  dma_bus_init+0x0/0x66 @ 1
[    1.244442] device class 'dma': registering
[    1.250225] initcall dma_bus_init+0x0/0x66 returned 0 after 9765 usecs
[    1.260004] calling  dma_channel_table_init+0x0/0x137 @ 1
[    1.265409] initcall dma_channel_table_init+0x0/0x137 returned 0 after 0 usecs
[    1.270004] calling  dca_init+0x0/0x45 @ 1
[    1.274093] dca service started, version 1.8
[    1.280017] device class 'dca': registering
[    1.284444] initcall dca_init+0x0/0x45 returned 0 after 9765 usecs
[    1.290005] calling  pci_arch_init+0x0/0x67 @ 1
[    1.294841] PCI: Using configuration type 1 for base access
[    1.300005] initcall pci_arch_init+0x0/0x67 returned 0 after 9765 usecs
[    1.306609] calling  topology_init+0x0/0xe0 @ 1
[    1.310003] Registering sys device of class 'node'
[    1.314793] Registering sys device 'node0'
[    1.320256] Registering sys device of class 'cpu'
[    1.324956] Registering sys device 'cpu0'
[    1.330286] Registering sys device of class 'cpu'
[    1.334992] Registering sys device 'cpu1'
[    1.340225] initcall topology_init+0x0/0xe0 returned 0 after 29296 usecs
[    1.346919] calling  mtrr_init_finialize+0x0/0x64 @ 1
[    1.350006] initcall mtrr_init_finialize+0x0/0x64 returned 0 after 0 usecs
[    1.356874] calling  param_sysfs_init+0x0/0x37b @ 1
[    1.579904] initcall param_sysfs_init+0x0/0x37b returned 0 after 205078 usecs
[    1.581017] calling  init_slow_work+0x0/0x5f @ 1
[    1.590005] initcall init_slow_work+0x0/0x5f returned 0 after 0 usecs
[    1.596434] calling  default_bdi_init+0x0/0x5e @ 1
[    1.600020] device: 'default': device_add
[    1.604377] initcall default_bdi_init+0x0/0x5e returned 0 after 0 usecs
[    1.611124] calling  init_bio+0x0/0x100 @ 1
[    1.621337] bio: create slab <bio-0> at 0
[    1.625444] initcall init_bio+0x0/0x100 returned 0 after 0 usecs
[    1.630925] calling  fsnotify_init+0x0/0x39 @ 1
[    1.635459] initcall fsnotify_init+0x0/0x39 returned 0 after 0 usecs
[    1.640005] calling  fsnotify_notification_init+0x0/0x129 @ 1
[    1.645853] initcall fsnotify_notification_init+0x0/0x129 returned 0 after 0 usecs
[    1.650026] calling  cryptomgr_init+0x0/0x39 @ 1
[    1.660005] initcall cryptomgr_init+0x0/0x39 returned 0 after 0 usecs
[    1.666434] calling  blk_settings_init+0x0/0x51 @ 1
[    1.670004] initcall blk_settings_init+0x0/0x51 returned 0 after 0 usecs
[    1.676694] calling  blk_ioc_init+0x0/0x51 @ 1
[    1.680043] initcall blk_ioc_init+0x0/0x51 returned 0 after 0 usecs
[    1.690019] calling  blk_softirq_init+0x0/0x8f @ 1
[    1.694805] initcall blk_softirq_init+0x0/0x8f returned 0 after 0 usecs
[    1.700004] calling  genhd_device_init+0x0/0x8c @ 1
[    1.704875] device class 'block': registering
[    1.710394] initcall genhd_device_init+0x0/0x8c returned 0 after 9765 usecs
[    1.717344] calling  gpiolib_debugfs_init+0x0/0x4b @ 1
[    1.720122] initcall gpiolib_debugfs_init+0x0/0x4b returned 0 after 0 usecs
[    1.730004] calling  max7301_init+0x0/0x39 @ 1
[    1.734445] bus: 'spi': add driver max7301
[    1.738825] initcall max7301_init+0x0/0x39 returned 0 after 0 usecs
[    1.740261] calling  max732x_init+0x0/0x3b @ 1
[    1.750054] bus: 'i2c': add driver max732x
[    1.754367] initcall max732x_init+0x0/0x3b returned 0 after 0 usecs
[    1.760045] calling  mcp23s08_init+0x0/0x39 @ 1
[    1.764571] bus: 'spi': add driver mcp23s08
[    1.770071] initcall mcp23s08_init+0x0/0x39 returned 0 after 9765 usecs
[    1.776678] calling  pcf857x_init+0x0/0x3b @ 1
[    1.780003] bus: 'i2c': add driver pcf857x
[    1.784308] initcall pcf857x_init+0x0/0x3b returned 0 after 0 usecs
[    1.790005] calling  gpio_twl4030_init+0x0/0x39 @ 1
[    1.794874] bus: 'platform': add driver twl4030_gpio
[    1.800215] initcall gpio_twl4030_init+0x0/0x39 returned 0 after 9765 usecs
[    1.807173] calling  pci_slot_init+0x0/0x73 @ 1
[    1.810014] initcall pci_slot_init+0x0/0x73 returned 0 after 0 usecs
[    1.816364] calling  misc_init+0x0/0xd6 @ 1
[    1.820026] device class 'misc': registering
[    1.824517] initcall misc_init+0x0/0xd6 returned 0 after 0 usecs
[    1.830006] calling  cn_init+0x0/0x11a @ 1
[    1.834149] initcall cn_init+0x0/0x11a returned 0 after 0 usecs
[    1.840004] calling  tifm_init+0x0/0xab @ 1
[    1.844520] bus: 'tifm': registered
[    1.850003] device class 'tifm_adapter': registering
[    1.855186] initcall tifm_init+0x0/0xab returned 0 after 9765 usecs
[    1.860004] calling  tps_init+0x0/0xa4 @ 1
[    1.864094] tps65010: version 2 May 2005
[    1.870003] bus: 'i2c': add driver tps65010
[    1.874414] bus: 'i2c': remove driver tps65010
[    1.880261] driver: 'tps65010': driver_release
[    1.900010] bus: 'i2c': add driver tps65010
[    1.904449] bus: 'i2c': remove driver tps65010
[    1.909082] driver: 'tps65010': driver_release
[    1.930062] bus: 'i2c': add driver tps65010
[    1.934472] bus: 'i2c': remove driver tps65010
[    1.939102] driver: 'tps65010': driver_release
[    1.940034] tps65010: no chip?
[    1.943090] initcall tps_init+0x0/0xa4 returned -19 after 78125 usecs
[    1.950004] calling  twl4030_init+0x0/0x3b @ 1
[    1.954441] bus: 'i2c': add driver twl4030
[    1.960222] initcall twl4030_init+0x0/0x3b returned 0 after 9765 usecs
[    1.966739] calling  da903x_init+0x0/0x3b @ 1
[    1.970080] bus: 'i2c': add driver da903x
[    1.974311] initcall da903x_init+0x0/0x3b returned 0 after 0 usecs
[    1.980055] calling  pcf50633_init+0x0/0x3b @ 1
[    1.984579] bus: 'i2c': add driver pcf50633
[    1.990239] initcall pcf50633_init+0x0/0x3b returned 0 after 9765 usecs
[    1.996841] calling  init_scsi+0x0/0xb7 @ 1
[    2.000790] device class 'scsi_host': registering
[    2.005987] bus: 'scsi': registered
[    2.010026] device class 'scsi_device': registering
[    2.015146] SCSI subsystem initialized
[    2.020023] initcall init_scsi+0x0/0xb7 returned 0 after 19531 usecs
[    2.026366] calling  ata_init+0x0/0x3b3 @ 1
[    2.030339] libata version 3.00 loaded.
[    2.034175] initcall ata_init+0x0/0x3b3 returned 0 after 0 usecs
[    2.040007] calling  phy_init+0x0/0x57 @ 1
[    2.044096] device class 'mdio_bus': registering
[    2.050458] bus: 'mdio_bus': registered
[    2.054295] bus: 'mdio_bus': add driver Generic PHY
[    2.060234] initcall phy_init+0x0/0x57 returned 0 after 19531 usecs
[    2.066495] calling  usb_init+0x0/0x185 @ 1
[    2.070256] bus: 'usb': registered
[    2.073668] bus: 'usb': add driver usbfs
[    2.077830] usbcore: registered new interface driver usbfs
[    2.080012] bus: 'usb': add driver hub
[    2.083986] usbcore: registered new interface driver hub
[    2.090089] bus: 'usb': add driver usb
[    2.094047] usbcore: registered new device driver usb
[    2.100005] initcall usb_init+0x0/0x185 returned 0 after 29296 usecs
[    2.106355] calling  serio_init+0x0/0xb2 @ 1
[    2.110238] bus: 'serio': registered
[    2.113894] initcall serio_init+0x0/0xb2 returned 0 after 0 usecs
[    2.120005] calling  gameport_init+0x0/0xb2 @ 1
[    2.124806] bus: 'gameport': registered
[    2.130088] initcall gameport_init+0x0/0xb2 returned 0 after 9765 usecs
[    2.136693] calling  input_init+0x0/0x15d @ 1
[    2.140004] device class 'input': registering
[    2.144608] initcall input_init+0x0/0x15d returned 0 after 0 usecs
[    2.150005] calling  pps_init+0x0/0xd7 @ 1
[    2.154096] device class 'pps': registering
[    2.160205] LinuxPPS API ver. 1 registered
[    2.164295] Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.170006] initcall pps_init+0x0/0xd7 returned 0 after 19531 usecs
[    2.180003] calling  power_supply_class_init+0x0/0x5f @ 1
[    2.185396] device class 'power_supply': registering
[    2.190207] initcall power_supply_class_init+0x0/0x5f returned 0 after 9765 usecs
[    2.197681] calling  thermal_init+0x0/0x7e @ 1
[    2.200008] device class 'thermal': registering
[    2.204802] initcall thermal_init+0x0/0x7e returned 0 after 0 usecs
[    2.210004] calling  mmc_init+0x0/0x9c @ 1
[    2.214432] bus: 'mmc': registered
[    2.220004] device class 'mmc_host': registering
[    2.225103] bus: 'sdio': registered
[    2.230005] initcall mmc_init+0x0/0x9c returned 0 after 19531 usecs
[    2.236260] calling  leds_init+0x0/0x67 @ 1
[    2.240004] device class 'leds': registering
[    2.244485] initcall leds_init+0x0/0x67 returned 0 after 0 usecs
[    2.250006] calling  ac97_bus_init+0x0/0x39 @ 1
[    2.254789] bus: 'ac97': registered
[    2.258279] initcall ac97_bus_init+0x0/0x39 returned 0 after 0 usecs
[    2.260005] calling  pci_subsys_init+0x0/0x136 @ 1
[    2.270002] PCI: Probing PCI hardware
[    2.273683] PCI: Probing PCI hardware (bus 00)
[    2.278136] device: 'pci0000:00': device_add
[    2.280020] device: '0000:00': device_add
[    2.284259] PCI: Scanning bus 0000:00
[    2.290058] pci 0000:00:00.0: found [10de:005e] class 000580 header type 00
[    2.297060] pci 0000:00:00.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.300054] pci 0000:00:01.0: found [10de:0050] class 000601 header type 00
[    2.310030] pci 0000:00:01.0: calling nvidia_force_enable_hpet+0x0/0xec
[    2.316634] HPET not enabled in BIOS. You might try hpet=force boot option
[    2.320004] pci 0000:00:01.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.330045] pci 0000:00:01.1: found [10de:0052] class 000c05 header type 00
[    2.337007] pci 0000:00:01.1: reg 10 io port: [0xdc00-0xdc1f]
[    2.340015] pci 0000:00:01.1: reg 20 io port: [0x4c00-0x4c3f]
[    2.350006] pci 0000:00:01.1: reg 24 io port: [0x4c40-0x4c7f]
[    2.355749] pci 0000:00:01.1: calling quirk_resource_alignment+0x0/0x1dd
[    2.360013] pci 0000:00:01.1: PME# supported from D3hot D3cold
[    2.365837] pci 0000:00:01.1: PME# disabled
[    2.370048] pci 0000:00:02.0: found [10de:005a] class 000c03 header type 00
[    2.380014] pci 0000:00:02.0: reg 10 32bit mmio: [0xda102000-0xda102fff]
[    2.386731] pci 0000:00:02.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.390012] pci 0000:00:02.0: supports D1 D2
[    2.394276] pci 0000:00:02.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.400004] pci 0000:00:02.0: PME# disabled
[    2.404204] pci 0000:00:02.1: found [10de:005b] class 000c03 header type 00
[    2.410033] pci 0000:00:02.1: reg 10 32bit mmio: [0xfeb00000-0xfeb000ff]
[    2.420023] pci 0000:00:02.1: calling quirk_resource_alignment+0x0/0x1dd
[    2.426727] pci 0000:00:02.1: supports D1 D2
[    2.430003] pci 0000:00:02.1: PME# supported from D0 D1 D2 D3hot D3cold
[    2.440004] pci 0000:00:02.1: PME# disabled
[    2.444216] pci 0000:00:04.0: found [10de:0059] class 000401 header type 00
[    2.450029] pci 0000:00:04.0: reg 10 io port: [0xd400-0xd4ff]
[    2.455770] pci 0000:00:04.0: reg 14 io port: [0xd800-0xd8ff]
[    2.460009] pci 0000:00:04.0: reg 18 32bit mmio: [0xda101000-0xda101fff]
[    2.466719] pci 0000:00:04.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.470012] pci 0000:00:04.0: supports D1 D2
[    2.480025] pci 0000:00:06.0: found [10de:0053] class 000101 header type 00
[    2.487000] pci 0000:00:06.0: reg 20 io port: [0xf000-0xf00f]
[    2.490028] pci 0000:00:06.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.500033] pci 0000:00:09.0: found [10de:005c] class 000604 header type 01
[    2.507001] pci 0000:00:09.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.510023] pci 0000:00:0a.0: found [10de:0057] class 000680 header type 00
[    2.520014] pci 0000:00:0a.0: reg 10 32bit mmio: [0xda100000-0xda100fff]
[    2.526706] pci 0000:00:0a.0: reg 14 io port: [0xd000-0xd007]
[    2.530036] pci 0000:00:0a.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.536738] pci 0000:00:0a.0: supports D1 D2
[    2.540003] pci 0000:00:0a.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.550004] pci 0000:00:0a.0: PME# disabled
[    2.554250] pci 0000:00:0b.0: found [10de:005d] class 000604 header type 01
[    2.560021] pci 0000:00:0b.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.566728] pci 0000:00:0b.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.570019] pci 0000:00:0b.0: PME# disabled
[    2.574228] pci 0000:00:0c.0: found [10de:005d] class 000604 header type 01
[    2.580020] pci 0000:00:0c.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.590020] pci 0000:00:0c.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.596626] pci 0000:00:0c.0: PME# disabled
[    2.600030] pci 0000:00:0d.0: found [10de:005d] class 000604 header type 01
[    2.610035] pci 0000:00:0d.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.616744] pci 0000:00:0d.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.620004] pci 0000:00:0d.0: PME# disabled
[    2.624209] pci 0000:00:0e.0: found [10de:005d] class 000604 header type 01
[    2.630020] pci 0000:00:0e.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.640030] pci 0000:00:0e.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.646633] pci 0000:00:0e.0: PME# disabled
[    2.650056] pci 0000:00:18.0: found [1022:1100] class 000600 header type 00
[    2.660024] pci 0000:00:18.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.666744] pci 0000:00:18.1: found [1022:1101] class 000600 header type 00
[    2.670024] pci 0000:00:18.1: calling quirk_resource_alignment+0x0/0x1dd
[    2.680019] pci 0000:00:18.2: found [1022:1102] class 000600 header type 00
[    2.686991] pci 0000:00:18.2: calling quirk_resource_alignment+0x0/0x1dd
[    2.690034] pci 0000:00:18.3: found [1022:1103] class 000600 header type 00
[    2.700023] pci 0000:00:18.3: calling quirk_resource_alignment+0x0/0x1dd
[    2.706740] PCI: Fixups for bus 0000:00
[    2.710005] pci 0000:00:09.0: scanning behind bridge, config 050500, pass 0
[    2.716964] PCI: Scanning bus 0000:05
[    2.720035] pci 0000:05:07.0: found [10ec:8139] class 000200 header type 00
[    2.727005] pci 0000:05:07.0: reg 10 io port: [0xc000-0xc0ff]
[    2.730022] pci 0000:05:07.0: reg 14 32bit mmio: [0xda000000-0xda0000ff]
[    2.740027] pci 0000:05:07.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.746731] pci 0000:05:07.0: supports D1 D2
[    2.750003] pci 0000:05:07.0: PME# supported from D1 D2 D3hot
[    2.755743] pci 0000:05:07.0: PME# disabled
[    2.760047] PCI: Fixups for bus 0000:05
[    2.763880] pci 0000:00:09.0: transparent bridge
[    2.770019] pci 0000:00:09.0: bridge io port: [0xc000-0xcfff]
[    2.775759] pci 0000:00:09.0: bridge 32bit mmio: [0xda000000-0xda0fffff]
[    2.780004] PCI: Bus scan for 0000:05 returning with max=05
[    2.785571] pci 0000:00:0b.0: scanning behind bridge, config 040400, pass 0
[    2.790012] PCI: Scanning bus 0000:04
[    2.800056] PCI: Fixups for bus 0000:04
[    2.803895] PCI: Bus scan for 0000:04 returning with max=04
[    2.809468] pci 0000:00:0c.0: scanning behind bridge, config 030300, pass 0
[    2.810027] PCI: Scanning bus 0000:03
[    2.820056] PCI: Fixups for bus 0000:03
[    2.823893] PCI: Bus scan for 0000:03 returning with max=03
[    2.829457] pci 0000:00:0d.0: scanning behind bridge, config 020200, pass 0
[    2.830012] PCI: Scanning bus 0000:02
[    2.840056] PCI: Fixups for bus 0000:02
[    2.843896] PCI: Bus scan for 0000:02 returning with max=02
[    2.849468] pci 0000:00:0e.0: scanning behind bridge, config 010100, pass 0
[    2.850027] PCI: Scanning bus 0000:01
[    2.860022] pci 0000:01:00.0: found [1002:5b60] class 000300 header type 00
[    2.866977] pci 0000:01:00.0: calling quirk_no_ata_d3+0x0/0x47
[    2.870009] pci 0000:01:00.0: reg 10 32bit mmio: [0xd0000000-0xd7ffffff]
[    2.876705] pci 0000:01:00.0: reg 14 io port: [0xb000-0xb0ff]
[    2.880007] pci 0000:01:00.0: reg 18 32bit mmio: [0xd9000000-0xd900ffff]
[    2.890033] pci 0000:01:00.0: reg 30 32bit mmio: [0x000000-0x01ffff]
[    2.896387] pci 0000:01:00.0: calling quirk_resource_alignment+0x0/0x1dd
[    2.900021] pci 0000:01:00.0: supports D1 D2
[    2.904313] pci 0000:01:00.1: found [1002:5b70] class 000380 header type 00
[    2.910009] pci 0000:01:00.1: calling quirk_no_ata_d3+0x0/0x47
[    2.920008] pci 0000:01:00.1: reg 10 32bit mmio: [0xd9010000-0xd901ffff]
[    2.926729] pci 0000:01:00.1: calling quirk_resource_alignment+0x0/0x1dd
[    2.930034] pci 0000:01:00.1: supports D1 D2
[    2.940070] PCI: Fixups for bus 0000:01
[    2.943908] pci 0000:00:0e.0: bridge io port: [0xb000-0xbfff]
[    2.950004] pci 0000:00:0e.0: bridge 32bit mmio: [0xd8000000-0xd9ffffff]
[    2.956696] pci 0000:00:0e.0: bridge 64bit mmio pref: [0xd0000000-0xd7ffffff]
[    2.960003] PCI: Bus scan for 0000:01 returning with max=01
[    2.965569] pci 0000:00:09.0: scanning behind bridge, config 050500, pass 1
[    2.970021] pci 0000:00:0b.0: scanning behind bridge, config 040400, pass 1
[    2.980007] pci 0000:00:0c.0: scanning behind bridge, config 030300, pass 1
[    2.990005] pci 0000:00:0d.0: scanning behind bridge, config 020200, pass 1
[    2.996957] pci 0000:00:0e.0: scanning behind bridge, config 010100, pass 1
[    3.000005] PCI: Bus scan for 0000:00 returning with max=05
[    3.005568] device: '0000:00:00.0': device_add
[    3.010025] bus: 'pci': add device 0000:00:00.0
[    3.014867] device: '0000:00:01.0': device_add
[    3.020011] bus: 'pci': add device 0000:00:01.0
[    3.024813] device: '0000:00:01.1': device_add
[    3.030020] bus: 'pci': add device 0000:00:01.1
[    3.034810] device: '0000:00:02.0': device_add
[    3.040011] bus: 'pci': add device 0000:00:02.0
[    3.044828] device: '0000:00:02.1': device_add
[    3.050010] bus: 'pci': add device 0000:00:02.1
[    3.054798] device: '0000:00:04.0': device_add
[    3.060011] bus: 'pci': add device 0000:00:04.0
[    3.064853] device: '0000:00:06.0': device_add
[    3.069298] bus: 'pci': add device 0000:00:06.0
[    3.070257] device: '0000:00:09.0': device_add
[    3.074710] bus: 'pci': add device 0000:00:09.0
[    3.080277] device: '0000:00:0a.0': device_add
[    3.084723] bus: 'pci': add device 0000:00:0a.0
[    3.090266] device: '0000:00:0b.0': device_add
[    3.094716] bus: 'pci': add device 0000:00:0b.0
[    3.100286] device: '0000:00:0c.0': device_add
[    3.104736] bus: 'pci': add device 0000:00:0c.0
[    3.110279] device: '0000:00:0d.0': device_add
[    3.114725] bus: 'pci': add device 0000:00:0d.0
[    3.120326] device: '0000:00:0e.0': device_add
[    3.124770] bus: 'pci': add device 0000:00:0e.0
[    3.130269] device: '0000:00:18.0': device_add
[    3.134717] bus: 'pci': add device 0000:00:18.0
[    3.139532] device: '0000:00:18.1': device_add
[    3.140011] bus: 'pci': add device 0000:00:18.1
[    3.144818] device: '0000:00:18.2': device_add
[    3.150011] bus: 'pci': add device 0000:00:18.2
[    3.154801] device: '0000:00:18.3': device_add
[    3.160011] bus: 'pci': add device 0000:00:18.3
[    3.164820] device: '0000:05:07.0': device_add
[    3.170010] bus: 'pci': add device 0000:05:07.0
[    3.174803] device: '0000:05': device_add
[    3.180306] device: '0000:04': device_add
[    3.184542] device: '0000:03': device_add
[    3.188810] device: '0000:02': device_add
[    3.190235] device: '0000:01:00.0': device_add
[    3.194692] bus: 'pci': add device 0000:01:00.0
[    3.200279] device: '0000:01:00.1': device_add
[    3.204725] bus: 'pci': add device 0000:01:00.1
[    3.210268] device: '0000:01': device_add
[    3.214784] pci 0000:00:00.0: default IRQ router [10de:005e]
[    3.220374] initcall pci_subsys_init+0x0/0x136 returned 0 after 927734 usecs
[    3.227411] calling  proto_init+0x0/0x39 @ 1
[    3.230016] initcall proto_init+0x0/0x39 returned 0 after 0 usecs
[    3.240007] calling  net_dev_init+0x0/0x1c2 @ 1
[    3.244575] device class 'net': registering
[    3.249002] device: 'lo': device_add
[    3.250442] initcall net_dev_init+0x0/0x1c2 returned 0 after 9765 usecs
[    3.257049] calling  neigh_init+0x0/0x98 @ 1
[    3.260006] initcall neigh_init+0x0/0x98 returned 0 after 0 usecs
[    3.270003] calling  fib_rules_init+0x0/0xcc @ 1
[    3.274619] initcall fib_rules_init+0x0/0xcc returned 0 after 0 usecs
[    3.280007] calling  genl_init+0x0/0x100 @ 1
[    3.300047] initcall genl_init+0x0/0x100 returned 0 after 19531 usecs
[    3.306481] calling  cipso_v4_init+0x0/0xae @ 1
[    3.310024] initcall cipso_v4_init+0x0/0xae returned 0 after 0 usecs
[    3.316373] calling  wanrouter_init+0x0/0x79 @ 1
[    3.320003] Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.
[    3.327322] initcall wanrouter_init+0x0/0x79 returned 0 after 0 usecs
[    3.330004] calling  irda_init+0x0/0xcb @ 1
[    3.334180] irda_init()
[    3.340099] NET: Registered protocol family 23
[    3.344686] initcall irda_init+0x0/0xcb returned 0 after 9765 usecs
[    3.350004] calling  bt_init+0x0/0x81 @ 1
[    3.354007] Bluetooth: Core ver 2.15
[    3.360101] device class 'bluetooth': registering
[    3.365007] NET: Registered protocol family 31
[    3.370003] Bluetooth: HCI device and connection manager initialized
[    3.376364] Bluetooth: HCI socket layer initialized
[    3.380005] initcall bt_init+0x0/0x81 returned 0 after 29296 usecs
[    3.386173] calling  wireless_nlevent_init+0x0/0x69 @ 1
[    3.390004] initcall wireless_nlevent_init+0x0/0x69 returned 0 after 0 usecs
[    3.400005] calling  cfg80211_init+0x0/0x9f @ 1
[    3.404527] device class 'ieee80211': registering
[    3.460063] Registering platform device 'regulatory.0'. Parent at platform
[    3.466925] device: 'regulatory.0': device_add
[    3.470011] bus: 'platform': add device regulatory.0
[    3.475183] cfg80211: Using static regulatory domain info
[    3.480004] cfg80211: Regulatory domain: US
[    3.484181] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    3.490003] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[    3.500005] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    3.506781] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    3.510003] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    3.520025] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    3.526807] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[    3.530045] cfg80211: Calling CRDA for country: US
[    3.535050] initcall cfg80211_init+0x0/0x9f returned 0 after 126953 usecs
[    3.540005] calling  ieee80211_init+0x0/0x45 @ 1
[    3.550016] initcall ieee80211_init+0x0/0x45 returned 0 after 0 usecs
[    3.556453] calling  netlbl_init+0x0/0xa8 @ 1
[    3.560002] NetLabel: Initializing
[    3.563402] NetLabel:  domain hash size = 128
[    3.567759] NetLabel:  protocols = UNLABELED CIPSOv4
[    3.570201] NetLabel:  unlabeled traffic allowed by default
[    3.575768] initcall netlbl_init+0x0/0xa8 returned 0 after 9765 usecs
[    3.580027] calling  rfkill_init+0x0/0xb1 @ 1
[    3.590002] device class 'rfkill': registering
[    3.594660] device: 'rfkill': device_add
[    3.598834] initcall rfkill_init+0x0/0xb1 returned 0 after 0 usecs
[    3.600005] calling  sysctl_init+0x0/0x6f @ 1
[    3.610006] initcall sysctl_init+0x0/0x6f returned 0 after 0 usecs
[    3.616176] calling  pci_iommu_init+0x0/0x4a @ 1
[    3.679259] DMA-API: preallocated 32768 debug entries
[    3.680026] DMA-API: debugging enabled by kernel config
[    3.685252] initcall pci_iommu_init+0x0/0x4a returned 0 after 58593 usecs
[    3.690005] calling  print_all_ICs+0x0/0x5a1 @ 1
[    3.700002] 
[    3.700003] printing PIC contents
[    3.704807] ... PIC  IMR: fffa
[    3.707864] ... PIC  IRR: 0001
[    3.710002] ... PIC  ISR: 0001
[    3.713058] ... PIC ELCR: 0828
[    3.716116] printing local APIC contents on CPU#0/0:
[    3.720000] ... APIC ID:      00000000 (0)
[    3.720000] ... APIC VERSION: 00040010
[    3.720000] ... APIC TASKPRI: 00000000 (00)
[    3.720000] ... APIC ARBPRI: 000000e0 (e0)
[    3.720000] ... APIC PROCPRI: 00000000
[    3.720000] ... APIC LDR: 01000000
[    3.720000] ... APIC DFR: ffffffff
[    3.720000] ... APIC SPIV: 000001ff
[    3.720000] ... APIC ISR field:
[    3.720000] 0000000000000000000000000000000000000000000000000000000000000000
[    3.720000] ... APIC TMR field:
[    3.720000] 0000000000000000000000000000000000000000000000000000000000000000
[    3.720000] ... APIC IRR field:
[    3.720000] 0000000000000000000000000000000000000000000000000000000000008000
[    3.720000] ... APIC ESR: 00000000
[    3.720000] ... APIC ICR: 000008ef
[    3.720000] ... APIC ICR2: 02000000
[    3.720000] ... APIC LVTT: 00010000
[    3.720000] ... APIC LVTPC: 00010000
[    3.720000] ... APIC LVT0: 00010700
[    3.720000] ... APIC LVT1: 00000400
[    3.720000] ... APIC LVTERR: 000000fe
[    3.720000] ... APIC TMICT: 00000000
[    3.720000] ... APIC TMCCT: 00000000
[    3.720000] ... APIC TDCR: 00000000
[    3.720000] 
[    3.719992] printing local APIC contents on CPU#1/1:
[    3.719992] ... APIC ID:      01000000 (1)
[    3.720000] ... APIC VERSION: 00040010
[    3.720000] ... APIC TASKPRI: 00000000 (00)
[    3.720000] ... APIC ARBPRI: 00000030 (30)
[    3.720000] ... APIC PROCPRI: 00000000
[    3.720000] ... APIC LDR: 02000000
[    3.720000] ... APIC DFR: ffffffff
[    3.720000] ... APIC SPIV: 000001ff
[    3.720000] ... APIC ISR field:
[    3.720000] 0000000000000000000000000000000000000000000000000000000000000000
[    3.720000] ... APIC TMR field:
[    3.720000] 0000000000000000000000000000000000000000000000000000000000000000
[    3.720000] ... APIC IRR field:
[    3.720000] 0000000000010000000000000000000000000000000000000000000000000000
[    3.720000] ... APIC ESR: 00000000
[    3.720000] ... APIC ICR: 000008ef
[    3.720000] ... APIC ICR2: 01000000
[    3.720000] ... APIC LVTT: 00010000
[    3.720000] ... APIC LVTPC: 00010000
[    3.720000] ... APIC LVT0: 00010700
[    3.720000] ... APIC LVT1: 00010400
[    3.720000] ... APIC LVTERR: 000000fe
[    3.720000] ... APIC TMICT: 00000000
[    3.720000] ... APIC TMCCT: 00000000
[    3.720000] ... APIC TDCR: 00000000
[    3.720000] 
[    3.730000] number of MP IRQ sources: 17.
[    3.730003] number of IO-APIC #2 registers: 24.
[    3.734528] testing the IO APIC.......................
[    3.740005] 
[    3.741497] IO APIC #2......
[    3.744374] .... register #00: 00000000
[    3.750002] .......    : physical APIC id: 00
[    3.754355] .......    : Delivery Type: 0
[    3.760024] .......    : LTS          : 0
[    3.764026] .... register #01: 00170011
[    3.767854] .......     : max redirection entries: 0017
[    3.770002] .......     : PRQ implemented: 0
[    3.774268] .......     : IO APIC version: 0011
[    3.780002] .... register #02: 00000000
[    3.783836] .......     : arbitration: 00
[    3.780005] Clocksource tsc unstable (delta = 208562563 ns)
[    3.790002] .... IRQ redirection table:
[    3.793836]  NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:   
[    3.800019]  00 003 0    0    0   0   0    1    1    30
[    3.810004]  01 003 0    0    0   0   0    1    1    31
[    3.815239]  02 000 1    0    0   0   0    0    0    00
[    3.820004]  03 003 1    1    0   1   0    1    1    33
[    3.825250]  04 003 0    0    0   0   0    1    1    34
[    3.830004]  05 003 1    1    0   1   0    1    1    35
[    3.835239]  06 003 0    0    0   0   0    1    1    36
[    3.840019]  07 003 1    0    0   0   0    1    1    37
[    3.845265]  08 003 0    0    0   0   0    1    1    38
[    3.850004]  09 003 0    0    0   0   0    1    1    39
[    3.855250]  0a 003 0    0    0   0   0    1    1    3A
[    3.863230]  0b 003 1    1    0   1   0    1    1    3B
[    3.868470]  0c 003 0    0    0   0   0    1    1    3C
[    3.873232]  0d 003 0    0    0   0   0    1    1    3D
[    3.878469]  0e 003 0    0    0   0   0    1    1    3E
[    3.883249]  0f 003 0    0    0   0   0    1    1    3F
[    3.888498]  10 000 1    0    0   0   0    0    0    00
[    3.893230]  11 000 1    0    0   0   0    0    0    00
[    3.900004]  12 000 1    0    0   0   0    0    0    00
[    3.905250]  13 000 1    0    0   0   0    0    0    00
[    3.910004]  14 000 1    0    0   0   0    0    0    00
[    3.915239]  15 000 1    0    0   0   0    0    0    00
[    3.920019]  16 000 1    0    0   0   0    0    0    00
[    3.925267]  17 000 1    0    0   0   0    0    0    00
[    3.930002] IRQ to pin mappings:
[    3.933228] IRQ0 -> 0:0
[    3.935704] IRQ1 -> 0:1
[    3.938183] IRQ3 -> 0:3
[    3.940735] IRQ4 -> 0:4
[    3.943211] IRQ5 -> 0:5
[    3.945689] IRQ6 -> 0:6
[    3.948166] IRQ7 -> 0:7
[    3.950735] IRQ8 -> 0:8
[    3.953211] IRQ9 -> 0:9
[    3.955687] IRQ10 -> 0:10
[    3.958338] IRQ11 -> 0:11
[    3.960837] IRQ12 -> 0:12
[    3.963488] IRQ13 -> 0:13
[    3.966139] IRQ14 -> 0:14
[    3.970198] IRQ15 -> 0:15
[    3.972853] .................................... done.
[    3.977986] initcall print_all_ICs+0x0/0x5a1 returned 0 after 263671 usecs
[    3.980004] calling  hpet_late_init+0x0/0x91 @ 1
[    3.984619] initcall hpet_late_init+0x0/0x91 returned -19 after 0 usecs
[    3.990004] calling  clocksource_done_booting+0x0/0x37 @ 1
[    4.000019] initcall clocksource_done_booting+0x0/0x37 returned 0 after 0 usecs
[    4.007318] calling  ftrace_init_debugfs+0x0/0x1ad @ 1
[    4.010093] initcall ftrace_init_debugfs+0x0/0x1ad returned 0 after 0 usecs
[    4.020006] calling  rb_init_debugfs+0x0/0x56 @ 1
[    4.024709] initcall rb_init_debugfs+0x0/0x56 returned 0 after 0 usecs
[    4.030003] calling  tracer_init_debugfs+0x0/0x32e @ 1
[    4.035550] initcall tracer_init_debugfs+0x0/0x32e returned 0 after 0 usecs
[    4.040020] calling  init_trace_printk_function_export+0x0/0x56 @ 1
[    4.050011] initcall init_trace_printk_function_export+0x0/0x56 returned 0 after 0 usecs
[    4.058089] calling  stat_workqueue_init+0x0/0x54 @ 1
[    4.060013] initcall stat_workqueue_init+0x0/0x54 returned 0 after 0 usecs
[    4.070003] calling  event_trace_init+0x0/0x49c @ 1
[    4.089466] initcall event_trace_init+0x0/0x49c returned 0 after 9765 usecs
[    4.090012] calling  ksym_tracer_stat_init+0x0/0x54 @ 1
[    4.100016] initcall ksym_tracer_stat_init+0x0/0x54 returned 0 after 0 usecs
[    4.107057] calling  init_pipe_fs+0x0/0x72 @ 1
[    4.110092] initcall init_pipe_fs+0x0/0x72 returned 0 after 0 usecs
[    4.116348] calling  eventpoll_init+0x0/0x102 @ 1
[    4.120159] initcall eventpoll_init+0x0/0x102 returned 0 after 0 usecs
[    4.130004] calling  anon_inode_init+0x0/0x15c @ 1
[    4.134855] initcall anon_inode_init+0x0/0x15c returned 0 after 0 usecs
[    4.140005] calling  fscache_init+0x0/0xd1 @ 1
[    4.144450] Slow work thread pool: Starting up
[    4.150229] Slow work thread pool: Ready
[    4.154219] FS-Cache: Loaded
[    4.157102] initcall fscache_init+0x0/0xd1 returned 0 after 9765 usecs
[    4.160023] calling  tomoyo_initerface_init+0x0/0x181 @ 1
[    4.170131] initcall tomoyo_initerface_init+0x0/0x181 returned 0 after 0 usecs
[    4.177345] calling  blk_scsi_ioctl_init+0x0/0x2ad @ 1
[    4.180005] initcall blk_scsi_ioctl_init+0x0/0x2ad returned 0 after 0 usecs
[    4.186961] calling  chr_dev_init+0x0/0xca @ 1
[    4.190018] device class 'mem': registering
[    4.194441] device: 'mem': device_add
[    4.200283] device: 'kmem': device_add
[    4.204248] device: 'null': device_add
[    4.210252] device: 'port': device_add
[    4.214222] device: 'zero': device_add
[    4.218226] device: 'full': device_add
[    4.220239] device: 'random': device_add
[    4.224421] device: 'urandom': device_add
[    4.230221] device: 'kmsg': device_add
[    4.234229] initcall chr_dev_init+0x0/0xca returned 0 after 39062 usecs
[    4.240005] calling  firmware_class_init+0x0/0x9f @ 1
[    4.245048] device class 'firmware': registering
[    4.250216] initcall firmware_class_init+0x0/0x9f returned 0 after 9765 usecs
[    4.257345] calling  ieee1394_init+0x0/0x289 @ 1
[    4.260412] bus: 'ieee1394': registered
[    4.264248] device class 'ieee1394_host': registering
[    4.270211] device class 'ieee1394_protocol': registering
[    4.275845] device class 'ieee1394_node': registering
[    4.280263] device class 'ieee1394': registering
[    4.285076] bus: 'ieee1394': add driver nodemgr
[    4.290217] initcall ieee1394_init+0x0/0x289 returned 0 after 29296 usecs
[    4.300005] calling  cpufreq_gov_performance_init+0x0/0x39 @ 1
[    4.305838] initcall cpufreq_gov_performance_init+0x0/0x39 returned 0 after 0 usecs
[    4.310004] calling  cpufreq_gov_dbs_init+0x0/0x8e @ 1
[    4.315349] initcall cpufreq_gov_dbs_init+0x0/0x8e returned 0 after 0 usecs
[    4.320005] calling  ssb_modinit+0x0/0x9b @ 1
[    4.330253] bus: 'ssb': registered
[    4.333666] initcall ssb_modinit+0x0/0x9b returned 0 after 0 usecs
[    4.340006] calling  pcibios_assign_resources+0x0/0x9a @ 1
[    4.345624] pci 0000:00:09.0: PCI bridge, secondary bus 0000:05
[    4.350004] pci 0000:00:09.0:   IO window: 0xc000-0xcfff
[    4.355310] pci 0000:00:09.0:   MEM window: 0xda000000-0xda0fffff
[    4.360004] pci 0000:00:09.0:   PREFETCH window: disabled
[    4.365397] pci 0000:00:0b.0: PCI bridge, secondary bus 0000:04
[    4.370002] pci 0000:00:0b.0:   IO window: disabled
[    4.374876] pci 0000:00:0b.0:   MEM window: disabled
[    4.380026] pci 0000:00:0b.0:   PREFETCH window: disabled
[    4.385421] pci 0000:00:0c.0: PCI bridge, secondary bus 0000:03
[    4.390002] pci 0000:00:0c.0:   IO window: disabled
[    4.400004] pci 0000:00:0c.0:   MEM window: disabled
[    4.404961] pci 0000:00:0c.0:   PREFETCH window: disabled
[    4.410004] pci 0000:00:0d.0: PCI bridge, secondary bus 0000:02
[    4.415912] pci 0000:00:0d.0:   IO window: disabled
[    4.420019] pci 0000:00:0d.0:   MEM window: disabled
[    4.424979] pci 0000:00:0d.0:   PREFETCH window: disabled
[    4.430010] pci 0000:01:00.0: BAR 6: got res [0xd8000000-0xd801ffff] bus [0xd8000000-0xd801ffff] flags 0x27200
[    4.440006] pci 0000:00:0e.0: PCI bridge, secondary bus 0000:01
[    4.445922] pci 0000:00:0e.0:   IO window: 0xb000-0xbfff
[    4.450005] pci 0000:00:0e.0:   MEM window: 0xd8000000-0xd9ffffff
[    4.456088] pci 0000:00:0e.0:   PREFETCH window: 0x000000d0000000-0x000000d7ffffff
[    4.460027] pci 0000:00:09.0: setting latency timer to 64
[    4.470008] pci 0000:00:0b.0: setting latency timer to 64
[    4.475407] pci 0000:00:0c.0: setting latency timer to 64
[    4.480007] pci 0000:00:0d.0: setting latency timer to 64
[    4.485406] pci 0000:00:0e.0: setting latency timer to 64
[    4.490005] pci_bus 0000:00: resource 0 io:  [0x00-0xffff]
[    4.495482] pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffffffffffff]
[    4.500018] pci_bus 0000:05: resource 0 io:  [0xc000-0xcfff]
[    4.510003] pci_bus 0000:05: resource 1 mem: [0xda000000-0xda0fffff]
[    4.516348] pci_bus 0000:05: resource 3 io:  [0x00-0xffff]
[    4.520003] pci_bus 0000:05: resource 4 mem: [0x000000-0xffffffffffffffff]
[    4.530004] pci_bus 0000:01: resource 0 io:  [0xb000-0xbfff]
[    4.535653] pci_bus 0000:01: resource 1 mem: [0xd8000000-0xd9ffffff]
[    4.540021] pci_bus 0000:01: resource 2 pref mem [0xd0000000-0xd7ffffff]
[    4.546711] initcall pcibios_assign_resources+0x0/0x9a returned 0 after 195312 usecs
[    4.550004] calling  sysctl_core_init+0x0/0x5f @ 1
[    4.560056] initcall sysctl_core_init+0x0/0x5f returned 0 after 0 usecs
[    4.566659] calling  inet_init+0x0/0x231 @ 1
[    4.570263] NET: Registered protocol family 2
[    4.575033] IP route cache hash table entries: 32768 (order: 6, 262144 bytes)
[    4.582295] TCP established hash table entries: 131072 (order: 9, 2097152 bytes)
[    4.592850] TCP bind hash table entries: 65536 (order: 9, 3670016 bytes)
[    4.603425] TCP: Hash tables configured (established 131072 bind 65536)
[    4.610046] TCP reno registered
[    4.613592] initcall inet_init+0x0/0x231 returned 0 after 39062 usecs
[    4.620026] calling  af_unix_init+0x0/0x7b @ 1
[    4.624506] NET: Registered protocol family 1
[    4.630033] initcall af_unix_init+0x0/0x7b returned 0 after 9765 usecs
[    4.636550] calling  populate_rootfs+0x0/0x131 @ 1
[    4.640583] initcall populate_rootfs+0x0/0x131 returned 0 after 0 usecs
[    4.650005] calling  svm_init+0x0/0x40 @ 1
[    4.654363] has_svm: svm not available
[    4.658113] kvm: no hardware support
[    4.660022] initcall svm_init+0x0/0x40 returned -95 after 9765 usecs
[    4.666364] initcall svm_init+0x0/0x40 returned with error code -95 
[    4.670004] calling  i8259A_init_sysfs+0x0/0x49 @ 1
[    4.680003] Registering sysdev class 'i8259'
[    4.684550] Registering sys device of class 'i8259'
[    4.690025] Registering sys device 'i82590'
[    4.694441] initcall i8259A_init_sysfs+0x0/0x49 returned 0 after 9765 usecs
[    4.700010] calling  vsyscall_init+0x0/0x60 @ 1
[    4.704560] initcall vsyscall_init+0x0/0x60 returned 0 after 0 usecs
[    4.710004] calling  sbf_init+0x0/0x118 @ 1
[    4.714183] initcall sbf_init+0x0/0x118 returned 0 after 0 usecs
[    4.720004] calling  i8237A_init_sysfs+0x0/0x49 @ 1
[    4.724876] Registering sysdev class 'i8237'
[    4.730209] Registering sys device of class 'i8237'
[    4.735087] Registering sys device 'i82370'
[    4.740251] initcall i8237A_init_sysfs+0x0/0x49 returned 0 after 19531 usecs
[    4.747291] calling  add_rtc_cmos+0x0/0x68 @ 1
[    4.750008] Registering platform device 'rtc_cmos'. Parent at platform
[    4.756531] device: 'rtc_cmos': device_add
[    4.760023] bus: 'platform': add device rtc_cmos
[    4.764853] platform rtc_cmos: registered platform RTC device (no PNP device found)
[    4.770005] initcall add_rtc_cmos+0x0/0x68 returned 0 after 19531 usecs
[    4.780005] calling  cache_sysfs_init+0x0/0x323 @ 1
[    4.786815] initcall cache_sysfs_init+0x0/0x323 returned 0 after 0 usecs
[    4.790005] calling  cpu_debug_init+0x0/0x2de @ 1
[    4.802659] cpu0(2) debug files 137
[    4.810500] cpu1(2) debug files 137
[    4.813997] initcall cpu_debug_init+0x0/0x2de returned 0 after 9765 usecs
[    4.820004] calling  mce_init_device+0x0/0x2ed @ 1
[    4.824794] Registering sysdev class 'machinecheck'
[    4.830276] Registering sys device of class 'machinecheck'
[    4.835763] Registering sys device 'machinecheck0'
[    4.840257] Registering sys device of class 'machinecheck'
[    4.845736] Registering sys device 'machinecheck1'
[    4.850292] device: 'mcelog': device_add
[    4.854442] initcall mce_init_device+0x0/0x2ed returned 0 after 29296 usecs
[    4.860005] calling  threshold_init_device+0x0/0xc0 @ 1
[    4.865221] initcall threshold_init_device+0x0/0xc0 returned 0 after 0 usecs
[    4.870005] calling  inject_init+0x0/0x4b @ 1
[    4.874356] Machine check injector initialized
[    4.880004] initcall inject_init+0x0/0x4b returned 0 after 9765 usecs
[    4.890003] calling  msr_init+0x0/0x15c @ 1
[    4.894192] device class 'msr': registering
[    4.898590] device: 'msr0': device_add
[    4.900369] device: 'msr1': device_add
[    4.904340] initcall msr_init+0x0/0x15c returned 0 after 9765 usecs
[    4.910005] calling  ioapic_init_sysfs+0x0/0xd2 @ 1
[    4.914875] Registering sysdev class 'ioapic'
[    4.920224] Registering sys device of class 'ioapic'
[    4.925192] Registering sys device 'ioapic0'
[    4.930264] initcall ioapic_init_sysfs+0x0/0xd2 returned 0 after 19531 usecs
[    4.937300] calling  add_pcspkr+0x0/0x4f @ 1
[    4.940008] Registering platform device 'pcspkr'. Parent at platform
[    4.950004] device: 'pcspkr': device_add
[    4.953930] bus: 'platform': add device pcspkr
[    4.958586] initcall add_pcspkr+0x0/0x4f returned 0 after 9765 usecs
[    4.960006] calling  start_periodic_check_for_corruption+0x0/0x61 @ 1
[    4.970003] Scanning for low memory corruption every 60 seconds
[    4.975919] initcall start_periodic_check_for_corruption+0x0/0x61 returned 0 after 0 usecs
[    4.980005] calling  start_pageattr_test+0x0/0x6c @ 1
[    4.990099] initcall start_pageattr_test+0x0/0x6c returned 0 after 0 usecs
[    4.996963] calling  pt_dump_init+0x0/0x57 @ 1
[    5.000039] initcall pt_dump_init+0x0/0x57 returned 0 after 0 usecs
[    5.006296] calling  crypto_fpu_module_init+0x0/0x39 @ 1
[    5.010041] initcall crypto_fpu_module_init+0x0/0x39 returned 0 after 0 usecs
[    5.020004] calling  aes_init+0x0/0x39 @ 1
[    5.024340] initcall aes_init+0x0/0x39 returned 0 after 0 usecs
[    5.030005] calling  init+0x0/0x39 @ 1
[    5.034148] initcall init+0x0/0x39 returned 0 after 0 usecs
[    5.040004] calling  init+0x0/0x39 @ 1
[    5.043852] initcall init+0x0/0x39 returned 0 after 0 usecs
[    5.050029] calling  aesni_init+0x0/0x166 @ 1
[    5.054379] Intel AES-NI instructions are not detected.
[    5.059603] initcall aesni_init+0x0/0x166 returned -19 after 0 usecs
[    5.060008] calling  crc32c_intel_mod_init+0x0/0x47 @ 1
[    5.070004] initcall crc32c_intel_mod_init+0x0/0x47 returned -19 after 0 usecs
[    5.077214] calling  init_vdso_vars+0x0/0x245 @ 1
[    5.080025] initcall init_vdso_vars+0x0/0x245 returned 0 after 0 usecs
[    5.086546] calling  ia32_binfmt_init+0x0/0x3b @ 1
[    5.090049] initcall ia32_binfmt_init+0x0/0x3b returned 0 after 0 usecs
[    5.100004] calling  sysenter_setup+0x0/0x304 @ 1
[    5.104711] initcall sysenter_setup+0x0/0x304 returned 0 after 0 usecs
[    5.110004] calling  init_aout_binfmt+0x0/0x3b @ 1
[    5.114791] initcall init_aout_binfmt+0x0/0x3b returned 0 after 0 usecs
[    5.120004] calling  init_sched_debug_procfs+0x0/0x53 @ 1
[    5.125409] initcall init_sched_debug_procfs+0x0/0x53 returned 0 after 0 usecs
[    5.130019] calling  proc_schedstat_init+0x0/0x49 @ 1
[    5.140012] initcall proc_schedstat_init+0x0/0x49 returned 0 after 0 usecs
[    5.146877] calling  proc_execdomains_init+0x0/0x49 @ 1
[    5.150012] initcall proc_execdomains_init+0x0/0x49 returned 0 after 0 usecs
[    5.160004] calling  ioresources_init+0x0/0x63 @ 1
[    5.164804] initcall ioresources_init+0x0/0x63 returned 0 after 0 usecs
[    5.170019] calling  uid_cache_init+0x0/0xb4 @ 1
[    5.174691] initcall uid_cache_init+0x0/0xb4 returned 0 after 0 usecs
[    5.180004] calling  init_posix_timers+0x0/0x103 @ 1
[    5.185004] initcall init_posix_timers+0x0/0x103 returned 0 after 0 usecs
[    5.190003] calling  init_posix_cpu_timers+0x0/0xd6 @ 1
[    5.200004] initcall init_posix_cpu_timers+0x0/0xd6 returned 0 after 0 usecs
[    5.207040] calling  nsproxy_cache_init+0x0/0x54 @ 1
[    5.210059] initcall nsproxy_cache_init+0x0/0x54 returned 0 after 0 usecs
[    5.216842] calling  create_proc_profile+0x0/0x2a0 @ 1
[    5.220004] initcall create_proc_profile+0x0/0x2a0 returned 0 after 0 usecs
[    5.230003] calling  timekeeping_init_device+0x0/0x49 @ 1
[    5.235395] Registering sysdev class 'timekeeping'
[    5.240237] Registering sys device of class 'timekeeping'
[    5.245633] Registering sys device 'timekeeping0'
[    5.250281] initcall timekeeping_init_device+0x0/0x49 returned 0 after 19531 usecs
[    5.257836] calling  init_clocksource_sysfs+0x0/0x77 @ 1
[    5.260003] Registering sysdev class 'clocksource'
[    5.270153] Registering sys device of class 'clocksource'
[    5.275549] Registering sys device 'clocksource0'
[    5.280229] initcall init_clocksource_sysfs+0x0/0x77 returned 0 after 19531 usecs
[    5.287699] calling  init_timer_list_procfs+0x0/0x53 @ 1
[    5.290041] initcall init_timer_list_procfs+0x0/0x53 returned 0 after 0 usecs
[    5.300003] calling  lockdep_proc_init+0x0/0x69 @ 1
[    5.304900] initcall lockdep_proc_init+0x0/0x69 returned 0 after 0 usecs
[    5.310003] calling  futex_init+0x0/0xac @ 1
[    5.314289] initcall futex_init+0x0/0xac returned 0 after 0 usecs
[    5.320006] calling  proc_dma_init+0x0/0x49 @ 1
[    5.324545] initcall proc_dma_init+0x0/0x49 returned 0 after 0 usecs
[    5.330019] calling  kallsyms_init+0x0/0x4c @ 1
[    5.334554] initcall kallsyms_init+0x0/0x4c returned 0 after 0 usecs
[    5.340003] calling  crash_save_vmcoreinfo_init+0x0/0x492 @ 1
[    5.350032] initcall crash_save_vmcoreinfo_init+0x0/0x492 returned 0 after 0 usecs
[    5.357593] calling  crash_notes_memory_init+0x0/0x5f @ 1
[    5.360009] initcall crash_notes_memory_init+0x0/0x5f returned 0 after 0 usecs
[    5.370020] calling  backtrace_regression_test+0x0/0x11f @ 1
[    5.375671] ====[ backtrace testing ]===========
[    5.380002] Testing a backtrace from process context.
[    5.385046] The following trace is a kernel self test and not a bug!
[    5.390004] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    5.396866] Call Trace:
[    5.400006]  [<ffffffff810b3619>] ? backtrace_regression_test+0x0/0x11f
[    5.406608]  [<ffffffff810b3663>] backtrace_regression_test+0x4a/0x11f
[    5.410020]  [<ffffffff810a3721>] ? jiffies_read+0xd/0x3c
[    5.415414]  [<ffffffff810a1f2a>] ? ktime_get+0x77/0xea
[    5.420004]  [<ffffffff810b3619>] ? backtrace_regression_test+0x0/0x11f
[    5.430006]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    5.435658]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    5.440006]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    5.446091]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    5.450020]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.460004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.465742]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    5.470006]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    5.475484]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.480004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    5.485395]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    5.490019]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    5.500004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    5.505916]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    5.510005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    5.515397]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    5.520005]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    5.525395]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    5.530017] Testing a backtrace from irq context.
[    5.534717] The following trace is a kernel self test and not a bug!
[    5.540011] Pid: 4, comm: ksoftirqd/0 Tainted: G        W  2.6.31-rc5-tip #291
[    5.550001] Call Trace:
[    5.552449]  <IRQ>  [<ffffffff810b35f7>] backtrace_test_irq_callback+0x21/0x43
[    5.560004]  [<ffffffff810818dd>] tasklet_action+0x91/0xff
[    5.565484]  [<ffffffff8102f44c>] ? call_softirq+0x1c/0x28
[    5.570004]  [<ffffffff8108312a>] __do_softirq+0x12c/0x24b
[    5.575482]  [<ffffffff810827ac>] ? ksoftirqd+0x0/0x1c9
[    5.580003]  [<ffffffff8102f44c>] call_softirq+0x1c/0x28
[    5.585307]  <EOI>  [<ffffffff8103177a>] do_softirq+0x56/0xb3
[    5.590003]  [<ffffffff81082857>] ksoftirqd+0xab/0x1c9
[    5.595135]  [<ffffffff81096e4e>] kthread+0x9c/0xa4
[    5.600003]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    5.604962]  [<ffffffff81096db2>] ? kthread+0x0/0xa4
[    5.610003]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    5.615282] Testing a saved backtrace.
[    5.620019] The following trace is a kernel self test and not a bug!
[    5.626367]  [<ffffffff8103bcb7>] save_stack_trace+0x3e/0x73
[    5.634268]  [<ffffffff810b3701>] backtrace_regression_test+0xe8/0x11f
[    5.640002]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    5.645679]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    5.650002]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    5.654980]  [<ffffffffffffffff>] 0xffffffffffffffff
[    5.660017] ====[ end of backtrace testing ]====
[    5.664634] initcall backtrace_regression_test+0x0/0x11f returned 0 after 283203 usecs
[    5.670003] calling  hung_task_init+0x0/0x79 @ 1
[    5.674698] initcall hung_task_init+0x0/0x79 returned 0 after 0 usecs
[    5.680021] calling  rcu_torture_init+0x0/0x6ef @ 1
[    5.690024] rcu-torture:--- Start of test: nreaders=4 nfakewriters=4 stat_interval=0 verbose=0 test_no_idle_hz=0 shuffle_interval=3 stutter=5 irqreader=1
[    5.701021] initcall rcu_torture_init+0x0/0x6ef returned 0 after 9765 usecs
[    5.710007] calling  utsname_sysctl_init+0x0/0x3b @ 1
[    5.715072] sysctl table check failed: /kernel/ostype .1.1 No proc_handler
[    5.723317] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    5.730002] Call Trace:
[    5.732452]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    5.737416]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    5.740004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    5.750028]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    5.756547]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    5.760004]  [<ffffffff828c3330>] ? utsname_sysctl_init+0x0/0x3b
[    5.766002]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    5.770004]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    5.780004]  [<ffffffff828c3353>] utsname_sysctl_init+0x23/0x3b
[    5.785916]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    5.790020]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    5.795586]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    5.800005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    5.810004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.815742]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.820005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    5.826004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    5.830019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.835759]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    5.840004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    5.850004]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    5.855917]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    5.860005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    5.865311]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    5.870021]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    5.874981]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    5.880004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    5.885141] sysctl table check failed: /kernel/osrelease .1.2 No proc_handler
[    5.893577] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    5.900002] Call Trace:
[    5.902450]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    5.910019]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    5.916019]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    5.920005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    5.926522]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    5.930004]  [<ffffffff828c3330>] ? utsname_sysctl_init+0x0/0x3b
[    5.940005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    5.946089]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    5.950019]  [<ffffffff828c3353>] utsname_sysctl_init+0x23/0x3b
[    5.955933]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    5.960005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    5.970004]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    5.976089]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    5.980004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.985741]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    5.990019]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    6.000004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    6.005482]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.010004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    6.015395]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    6.020004]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    6.025916]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    6.030020]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    6.040005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    6.045395]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    6.050008]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    6.055405]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    6.060009] sysctl table check failed: /kernel/version .1.4 No proc_handler
[    6.067066] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    6.070017] Call Trace:
[    6.072469]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    6.080004]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    6.086002]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    6.090005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    6.100005]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    6.106434]  [<ffffffff828c3330>] ? utsname_sysctl_init+0x0/0x3b
[    6.110020]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    6.116107]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    6.120004]  [<ffffffff828c3353>] utsname_sysctl_init+0x23/0x3b
[    6.130006]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    6.135657]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    6.140005]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    6.146089]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    6.150019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.160004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.165743]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    6.170004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    6.175481]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.180004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    6.185396]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    6.190019]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    6.200004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    6.205916]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    6.210005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    6.215397]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    6.220005]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    6.225395]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    6.230024] sysctl table check failed: /kernel/hostname .1.7 No proc_handler
[    6.237169] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    6.240002] Call Trace:
[    6.242452]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    6.250004]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    6.260004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    6.266003]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    6.270019]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    6.276453]  [<ffffffff828c3330>] ? utsname_sysctl_init+0x0/0x3b
[    6.280005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    6.290005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    6.296089]  [<ffffffff828c3353>] utsname_sysctl_init+0x23/0x3b
[    6.300004]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    6.305656]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    6.310019]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    6.320005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    6.325830]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.330004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.335743]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    6.340004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    6.345481]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.350019]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    6.360004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    6.365740]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    6.370004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    6.375918]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    6.380005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    6.385396]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    6.390021]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    6.395412]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    6.400009] sysctl table check failed: /kernel/domainname .1.8 No proc_handler
[    6.410003] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    6.416865] Call Trace:
[    6.420004]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    6.424962]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    6.430019]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    6.436019]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    6.440005]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    6.450004]  [<ffffffff828c3330>] ? utsname_sysctl_init+0x0/0x3b
[    6.456002]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    6.460005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    6.466089]  [<ffffffff828c3353>] utsname_sysctl_init+0x23/0x3b
[    6.470019]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    6.480005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    6.485569]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    6.490005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    6.495830]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.500004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.505742]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    6.510019]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    6.520004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    6.525743]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    6.530004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    6.535742]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    6.540004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    6.545916]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    6.550020]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    6.560004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    6.564962]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    6.570004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    6.575138] initcall utsname_sysctl_init+0x0/0x3b returned 0 after 839843 usecs
[    6.580003] calling  init_lstats_procfs+0x0/0x4c @ 1
[    6.584973] initcall init_lstats_procfs+0x0/0x4c returned 0 after 0 usecs
[    6.590018] calling  ftrace_nodyn_init+0x0/0x37 @ 1
[    6.600004] initcall ftrace_nodyn_init+0x0/0x37 returned 0 after 0 usecs
[    6.606694] calling  init_events+0x0/0x8c @ 1
[    6.610010] initcall init_events+0x0/0x8c returned 0 after 0 usecs
[    6.616183] calling  init_sched_switch_trace+0x0/0x39 @ 1
[    6.620007] initcall init_sched_switch_trace+0x0/0x39 returned 0 after 0 usecs
[    6.627222] calling  init_stack_trace+0x0/0x39 @ 1
[    6.630021] initcall init_stack_trace+0x0/0x39 returned 0 after 0 usecs
[    6.640003] calling  init_function_trace+0x0/0x39 @ 1
[    6.645050] initcall init_function_trace+0x0/0x39 returned 0 after 0 usecs
[    6.650005] calling  init_wakeup_tracer+0x0/0x49 @ 1
[    6.654963] initcall init_wakeup_tracer+0x0/0x49 returned 0 after 0 usecs
[    6.660003] calling  stack_trace_init+0x0/0x91 @ 1
[    6.664810] initcall stack_trace_init+0x0/0x91 returned 0 after 0 usecs
[    6.670025] calling  init_mmio_trace+0x0/0x39 @ 1
[    6.680006] initcall init_mmio_trace+0x0/0x39 returned 0 after 0 usecs
[    6.686521] calling  init_power_trace+0x0/0x39 @ 1
[    6.690005] initcall init_power_trace+0x0/0x39 returned 0 after 0 usecs
[    6.696607] calling  init_kmem_tracer+0x0/0x7d @ 1
[    6.700004] Warning: could not register the kmem tracer
[    6.705222] initcall init_kmem_tracer+0x0/0x7d returned 1 after 0 usecs
[    6.710004] initcall init_kmem_tracer+0x0/0x7d returned with error code 1 
[    6.720004] calling  init_blk_tracer+0x0/0x7e @ 1
[    6.724702] initcall init_blk_tracer+0x0/0x7e returned 0 after 0 usecs
[    6.730025] calling  register_ftrace_syscalls+0x0/0xc5 @ 1
[    6.735512] initcall register_ftrace_syscalls+0x0/0xc5 returned 0 after 0 usecs
[    6.740004] calling  init_ksym_trace+0x0/0x76 @ 1
[    6.750012] initcall init_ksym_trace+0x0/0x76 returned 0 after 0 usecs
[    6.756532] calling  init_per_zone_wmark_min+0x0/0x8d @ 1
[    6.760070] initcall init_per_zone_wmark_min+0x0/0x8d returned 0 after 0 usecs
[    6.770003] calling  pdflush_init+0x0/0x43 @ 1
[    6.774705] initcall pdflush_init+0x0/0x43 returned 0 after 0 usecs
[    6.780026] calling  kswapd_init+0x0/0x97 @ 1
[    6.784508] initcall kswapd_init+0x0/0x97 returned 0 after 0 usecs
[    6.790004] calling  init_tmpfs+0x0/0x64 @ 1
[    6.794339] initcall init_tmpfs+0x0/0x64 returned 0 after 0 usecs
[    6.800005] calling  setup_vmstat+0x0/0xf0 @ 1
[    6.804482] initcall setup_vmstat+0x0/0xf0 returned 0 after 0 usecs
[    6.810004] calling  mm_sysfs_init+0x0/0x50 @ 1
[    6.814540] initcall mm_sysfs_init+0x0/0x50 returned 0 after 0 usecs
[    6.820027] calling  proc_vmalloc_init+0x0/0x4c @ 1
[    6.824909] initcall proc_vmalloc_init+0x0/0x4c returned 0 after 0 usecs
[    6.830004] calling  procswaps_init+0x0/0x49 @ 1
[    6.840012] initcall procswaps_init+0x0/0x49 returned 0 after 0 usecs
[    6.846443] calling  hugetlb_init+0x0/0x3cc @ 1
[    6.850008] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    6.856381] initcall hugetlb_init+0x0/0x3cc returned 0 after 0 usecs
[    6.860019] calling  slab_proc_init+0x0/0x4c @ 1
[    6.864643] initcall slab_proc_init+0x0/0x4c returned 0 after 0 usecs
[    6.870004] calling  slab_sysfs_init+0x0/0x119 @ 1
[    6.954616] initcall slab_sysfs_init+0x0/0x119 returned 0 after 68359 usecs
[    6.960110] calling  fasync_init+0x0/0x51 @ 1
[    6.975420] initcall fasync_init+0x0/0x51 returned 0 after 9765 usecs
[    6.980132] calling  proc_filesystems_init+0x0/0x49 @ 1
[    6.985369] initcall proc_filesystems_init+0x0/0x49 returned 0 after 0 usecs
[    6.990005] calling  dnotify_init+0x0/0xa7 @ 1
[    7.005625] initcall dnotify_init+0x0/0xa7 returned 0 after 9765 usecs
[    7.010026] calling  inotify_setup+0x0/0x37 @ 1
[    7.014554] initcall inotify_setup+0x0/0x37 returned 0 after 0 usecs
[    7.020004] calling  aio_setup+0x0/0x9c @ 1
[    7.050095] initcall aio_setup+0x0/0x9c returned 0 after 29296 usecs
[    7.056443] calling  proc_locks_init+0x0/0x49 @ 1
[    7.060037] initcall proc_locks_init+0x0/0x49 returned 0 after 0 usecs
[    7.066555] calling  init_sys32_ioctl+0x0/0xac @ 1
[    7.070019] initcall init_sys32_ioctl+0x0/0xac returned 0 after 0 usecs
[    7.076625] calling  init_mbcache+0x0/0x3b @ 1
[    7.080005] initcall init_mbcache+0x0/0x3b returned 0 after 0 usecs
[    7.086262] calling  dquot_init+0x0/0x12a @ 1
[    7.090002] VFS: Disk quotas dquot_6.5.2
[    7.104868] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    7.110065] initcall dquot_init+0x0/0x12a returned 0 after 19531 usecs
[    7.116581] calling  init_v1_quota_format+0x0/0x39 @ 1
[    7.120005] initcall init_v1_quota_format+0x0/0x39 returned 0 after 0 usecs
[    7.126954] calling  proc_cmdline_init+0x0/0x49 @ 1
[    7.130014] initcall proc_cmdline_init+0x0/0x49 returned 0 after 0 usecs
[    7.140004] calling  proc_cpuinfo_init+0x0/0x49 @ 1
[    7.144883] initcall proc_cpuinfo_init+0x0/0x49 returned 0 after 0 usecs
[    7.150019] calling  proc_devices_init+0x0/0x49 @ 1
[    7.154902] initcall proc_devices_init+0x0/0x49 returned 0 after 0 usecs
[    7.160004] calling  proc_interrupts_init+0x0/0x49 @ 1
[    7.165143] initcall proc_interrupts_init+0x0/0x49 returned 0 after 0 usecs
[    7.170009] calling  proc_loadavg_init+0x0/0x49 @ 1
[    7.180012] initcall proc_loadavg_init+0x0/0x49 returned 0 after 0 usecs
[    7.186702] calling  proc_meminfo_init+0x0/0x49 @ 1
[    7.190027] initcall proc_meminfo_init+0x0/0x49 returned 0 after 0 usecs
[    7.200004] calling  proc_stat_init+0x0/0x49 @ 1
[    7.204623] initcall proc_stat_init+0x0/0x49 returned 0 after 0 usecs
[    7.210004] calling  proc_uptime_init+0x0/0x49 @ 1
[    7.214798] initcall proc_uptime_init+0x0/0x49 returned 0 after 0 usecs
[    7.220004] calling  proc_version_init+0x0/0x49 @ 1
[    7.224884] initcall proc_version_init+0x0/0x49 returned 0 after 0 usecs
[    7.230019] calling  proc_softirqs_init+0x0/0x49 @ 1
[    7.234988] initcall proc_softirqs_init+0x0/0x49 returned 0 after 0 usecs
[    7.240004] calling  proc_kcore_init+0x0/0x70 @ 1
[    7.250021] initcall proc_kcore_init+0x0/0x70 returned 0 after 0 usecs
[    7.256537] calling  proc_kmsg_init+0x0/0x4c @ 1
[    7.260012] initcall proc_kmsg_init+0x0/0x4c returned 0 after 0 usecs
[    7.266443] calling  proc_page_init+0x0/0x69 @ 1
[    7.270034] initcall proc_page_init+0x0/0x69 returned 0 after 0 usecs
[    7.276470] calling  configfs_init+0x0/0xfb @ 1
[    7.291246] initcall configfs_init+0x0/0xfb returned 0 after 9765 usecs
[    7.297849] calling  init_devpts_fs+0x0/0x72 @ 1
[    7.300135] initcall init_devpts_fs+0x0/0x72 returned 0 after 0 usecs
[    7.306564] calling  init_dlm+0x0/0xae @ 1
[    7.321364] device: 'dlm-control': device_add
[    7.325982] device: 'dlm-monitor': device_add
[    7.342388] device: 'dlm_plock': device_add
[    7.346791] DLM (built Aug  2 2009 22:49:30) installed
[    7.350027] initcall init_dlm+0x0/0xae returned 0 after 39062 usecs
[    7.356286] calling  init_reiserfs_fs+0x0/0xb2 @ 1
[    7.371489] initcall init_reiserfs_fs+0x0/0xb2 returned 0 after 9765 usecs
[    7.378352] calling  init_ext3_fs+0x0/0x99 @ 1
[    7.391644] initcall init_ext3_fs+0x0/0x99 returned 0 after 9765 usecs
[    7.398165] calling  init_ext2_fs+0x0/0x99 @ 1
[    7.411883] initcall init_ext2_fs+0x0/0x99 returned 0 after 9765 usecs
[    7.418400] calling  init_ext4_fs+0x0/0x111 @ 1
[    7.433538] initcall init_ext4_fs+0x0/0x111 returned 0 after 9765 usecs
[    7.440031] calling  journal_init+0x0/0xf5 @ 1
[    7.456339] initcall journal_init+0x0/0xf5 returned 0 after 9765 usecs
[    7.460030] calling  journal_init+0x0/0xd6 @ 1
[    7.476480] initcall journal_init+0x0/0xd6 returned 0 after 9765 usecs
[    7.480028] calling  init_cramfs_fs+0x0/0x57 @ 1
[    7.484673] initcall init_cramfs_fs+0x0/0x57 returned 0 after 0 usecs
[    7.490005] calling  init_ramfs_fs+0x0/0x39 @ 1
[    7.494532] initcall init_ramfs_fs+0x0/0x39 returned 0 after 0 usecs
[    7.500004] calling  init_hugetlbfs_fs+0x0/0xbe @ 1
[    7.521169] initcall init_hugetlbfs_fs+0x0/0xbe returned 0 after 19531 usecs
[    7.528214] calling  init_fat_fs+0x0/0x75 @ 1
[    7.541176] initcall init_fat_fs+0x0/0x75 returned 0 after 9765 usecs
[    7.547609] calling  init_msdos_fs+0x0/0x39 @ 1
[    7.550029] initcall init_msdos_fs+0x0/0x39 returned 0 after 0 usecs
[    7.556372] calling  init_bfs_fs+0x0/0x89 @ 1
[    7.571734] initcall init_bfs_fs+0x0/0x89 returned 0 after 9765 usecs
[    7.578168] calling  init_iso9660_fs+0x0/0x89 @ 1
[    7.590952] initcall init_iso9660_fs+0x0/0x89 returned 0 after 9765 usecs
[    7.597727] calling  init_hfs_fs+0x0/0x83 @ 1
[    7.610719] initcall init_hfs_fs+0x0/0x83 returned 0 after 9765 usecs
[    7.617150] calling  ecryptfs_init+0x0/0x220 @ 1
[    7.636642] device: 'ecryptfs': device_add
[    7.640288] initcall ecryptfs_init+0x0/0x220 returned 0 after 19531 usecs
[    7.647067] calling  init_nls_cp437+0x0/0x39 @ 1
[    7.650838] initcall init_nls_cp437+0x0/0x39 returned 0 after 0 usecs
[    7.657273] calling  init_nls_cp737+0x0/0x39 @ 1
[    7.660005] initcall init_nls_cp737+0x0/0x39 returned 0 after 0 usecs
[    7.670003] calling  init_nls_cp775+0x0/0x39 @ 1
[    7.674616] initcall init_nls_cp775+0x0/0x39 returned 0 after 0 usecs
[    7.680003] calling  init_nls_cp850+0x0/0x39 @ 1
[    7.684615] initcall init_nls_cp850+0x0/0x39 returned 0 after 0 usecs
[    7.690028] calling  init_nls_cp852+0x0/0x39 @ 1
[    7.694643] initcall init_nls_cp852+0x0/0x39 returned 0 after 0 usecs
[    7.700003] calling  init_nls_cp857+0x0/0x39 @ 1
[    7.704616] initcall init_nls_cp857+0x0/0x39 returned 0 after 0 usecs
[    7.710003] calling  init_nls_cp861+0x0/0x39 @ 1
[    7.714616] initcall init_nls_cp861+0x0/0x39 returned 0 after 0 usecs
[    7.720003] calling  init_nls_cp862+0x0/0x39 @ 1
[    7.730019] initcall init_nls_cp862+0x0/0x39 returned 0 after 0 usecs
[    7.736451] calling  init_nls_cp863+0x0/0x39 @ 1
[    7.740004] initcall init_nls_cp863+0x0/0x39 returned 0 after 0 usecs
[    7.746432] calling  init_nls_cp874+0x0/0x39 @ 1
[    7.750004] initcall init_nls_cp874+0x0/0x39 returned 0 after 0 usecs
[    7.756435] calling  init_nls_cp932+0x0/0x39 @ 1
[    7.760004] initcall init_nls_cp932+0x0/0x39 returned 0 after 0 usecs
[    7.770018] calling  init_nls_euc_jp+0x0/0x6f @ 1
[    7.774721] initcall init_nls_euc_jp+0x0/0x6f returned 0 after 0 usecs
[    7.780003] calling  init_nls_cp936+0x0/0x39 @ 1
[    7.784616] initcall init_nls_cp936+0x0/0x39 returned 0 after 0 usecs
[    7.790003] calling  init_nls_cp949+0x0/0x39 @ 1
[    7.794616] initcall init_nls_cp949+0x0/0x39 returned 0 after 0 usecs
[    7.800003] calling  init_nls_cp950+0x0/0x39 @ 1
[    7.804616] initcall init_nls_cp950+0x0/0x39 returned 0 after 0 usecs
[    7.810018] calling  init_nls_cp1250+0x0/0x39 @ 1
[    7.814720] initcall init_nls_cp1250+0x0/0x39 returned 0 after 0 usecs
[    7.820003] calling  init_nls_cp1251+0x0/0x39 @ 1
[    7.830004] initcall init_nls_cp1251+0x0/0x39 returned 0 after 0 usecs
[    7.836519] calling  init_nls_ascii+0x0/0x39 @ 1
[    7.840004] initcall init_nls_ascii+0x0/0x39 returned 0 after 0 usecs
[    7.846435] calling  init_nls_iso8859_1+0x0/0x39 @ 1
[    7.850019] initcall init_nls_iso8859_1+0x0/0x39 returned 0 after 0 usecs
[    7.860003] calling  init_nls_iso8859_4+0x0/0x39 @ 1
[    7.864962] initcall init_nls_iso8859_4+0x0/0x39 returned 0 after 0 usecs
[    7.870003] calling  init_nls_iso8859_5+0x0/0x39 @ 1
[    7.874960] initcall init_nls_iso8859_5+0x0/0x39 returned 0 after 0 usecs
[    7.880003] calling  init_nls_iso8859_6+0x0/0x39 @ 1
[    7.884963] initcall init_nls_iso8859_6+0x0/0x39 returned 0 after 0 usecs
[    7.890018] calling  init_nls_iso8859_7+0x0/0x39 @ 1
[    7.900004] initcall init_nls_iso8859_7+0x0/0x39 returned 0 after 0 usecs
[    7.906781] calling  init_nls_cp1255+0x0/0x39 @ 1
[    7.910004] initcall init_nls_cp1255+0x0/0x39 returned 0 after 0 usecs
[    7.916522] calling  init_nls_iso8859_9+0x0/0x39 @ 1
[    7.920004] initcall init_nls_iso8859_9+0x0/0x39 returned 0 after 0 usecs
[    7.930018] calling  init_nls_iso8859_14+0x0/0x39 @ 1
[    7.935067] initcall init_nls_iso8859_14+0x0/0x39 returned 0 after 0 usecs
[    7.940003] calling  init_nls_koi8_r+0x0/0x39 @ 1
[    7.944703] initcall init_nls_koi8_r+0x0/0x39 returned 0 after 0 usecs
[    7.950005] calling  init_sysv_fs+0x0/0x75 @ 1
[    7.965022] initcall init_sysv_fs+0x0/0x75 returned 0 after 9765 usecs
[    7.970091] calling  init_ntfs_fs+0x0/0x253 @ 1
[    7.974615] NTFS driver 2.1.29 [Flags: R/W DEBUG].
[    7.992350] initcall init_ntfs_fs+0x0/0x253 returned 0 after 19531 usecs
[    7.999047] calling  init_ufs_fs+0x0/0x89 @ 1
[    8.011586] initcall init_ufs_fs+0x0/0x89 returned 0 after 9765 usecs
[    8.018020] calling  init_efs_fs+0x0/0x95 @ 1
[    8.020021] EFS: 1.0a - http://aeschi.ch.eu.org/efs/
[    8.035735] initcall init_efs_fs+0x0/0x95 returned 0 after 9765 usecs
[    8.040030] calling  init_romfs_fs+0x0/0xab @ 1
[    8.044555] ROMFS MTD (C) 2007 Red Hat, Inc.
[    8.061332] initcall init_romfs_fs+0x0/0xab returned 0 after 19531 usecs
[    8.068025] calling  init_qnx4_fs+0x0/0x99 @ 1
[    8.080617] QNX4 filesystem 0.2.3 registered.
[    8.084973] initcall init_qnx4_fs+0x0/0x99 returned 0 after 9765 usecs
[    8.090004] calling  init_autofs_fs+0x0/0x39 @ 1
[    8.094615] initcall init_autofs_fs+0x0/0x39 returned 0 after 0 usecs
[    8.100003] calling  init_autofs4_fs+0x0/0x4c @ 1
[    8.104702] initcall init_autofs4_fs+0x0/0x4c returned -16 after 0 usecs
[    8.110004] initcall init_autofs4_fs+0x0/0x4c returned with error code -16 
[    8.120025] calling  fuse_init+0x0/0x15c @ 1
[    8.124295] fuse init (API version 7.12)
[    8.139711] device: 'fuse': device_add
[    8.151362] initcall fuse_init+0x0/0x15c returned 0 after 29296 usecs
[    8.157795] calling  init_udf_fs+0x0/0x89 @ 1
[    8.171133] initcall init_udf_fs+0x0/0x89 returned 0 after 9765 usecs
[    8.177562] calling  init_omfs_fs+0x0/0x39 @ 1
[    8.180008] initcall init_omfs_fs+0x0/0x39 returned 0 after 0 usecs
[    8.186268] calling  init_jfs_fs+0x0/0x1f8 @ 1
[    8.202499] JFS: nTxBlock = 7700, nTxLock = 61601
[    8.214301] initcall init_jfs_fs+0x0/0x1f8 returned 0 after 19531 usecs
[    8.220098] calling  init_nilfs_fs+0x0/0xb9 @ 1
[    8.226415] initcall init_nilfs_fs+0x0/0xb9 returned 0 after 0 usecs
[    8.230029] calling  ocfs2_init+0x0/0x4c5 @ 1
[    8.234386] OCFS2 1.5.0
[    8.260226] initcall ocfs2_init+0x0/0x4c5 returned 0 after 29296 usecs
[    8.266748] calling  ocfs2_stack_glue_init+0x0/0xbb @ 1
[    8.270290] initcall ocfs2_stack_glue_init+0x0/0xbb returned 0 after 0 usecs
[    8.277325] calling  o2cb_stack_init+0x0/0x39 @ 1
[    8.280003] ocfs2: Registered cluster interface o2cb
[    8.284962] initcall o2cb_stack_init+0x0/0x39 returned 0 after 0 usecs
[    8.290003] calling  init_o2nm+0x0/0xcf @ 1
[    8.294182] OCFS2 Node Manager 1.5.0
[    8.312148] initcall init_o2nm+0x0/0xcf returned 0 after 19531 usecs
[    8.318494] calling  dlm_init+0x0/0x38a @ 1
[    8.320042] OCFS2 DLM 1.5.0
[    8.334832] initcall dlm_init+0x0/0x38a returned 0 after 9765 usecs
[    8.340030] calling  init_dlmfs_fs+0x0/0x106 @ 1
[    8.344646] OCFS2 DLMFS 1.5.0
[    8.358507] OCFS2 User DLM kernel interface loaded
[    8.360023] initcall init_dlmfs_fs+0x0/0x106 returned 0 after 19531 usecs
[    8.370004] calling  init_gfs2_fs+0x0/0x20d @ 1
[    8.382435] GFS2 (built Aug  2 2009 22:49:39) installed
[    8.387660] initcall init_gfs2_fs+0x0/0x20d returned 0 after 9765 usecs
[    8.390030] calling  ipc_init+0x0/0x56 @ 1
[    8.394148] msgmni has been set to 1925
[    8.400023] initcall ipc_init+0x0/0x56 returned 0 after 9765 usecs
[    8.406200] calling  ipc_sysctl_init+0x0/0x3b @ 1
[    8.410027] sysctl table check failed: /kernel/shmmax .1.34 No proc_handler
[    8.420005] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    8.426868] Call Trace:
[    8.429324]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    8.430021]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    8.440005]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    8.446005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    8.450005]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    8.456437]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    8.460005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    8.470025]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    8.476115]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    8.480006]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    8.485665]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    8.490007]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    8.500006]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    8.505830]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.510019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.515759]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    8.520006]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    8.525490]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.530004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    8.540004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    8.545742]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    8.550020]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    8.555934]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    8.560006]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    8.565404]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    8.570005]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    8.575394]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    8.580011] sysctl table check failed: /kernel/shmall .1.41 No proc_handler
[    8.590018] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    8.596883] Call Trace:
[    8.600005]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    8.604963]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    8.610004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    8.616001]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    8.620005]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    8.630020]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    8.635671]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    8.640005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    8.646088]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    8.650005]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    8.655655]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    8.660005]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    8.670020]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    8.675848]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.680004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.685743]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    8.690004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    8.700004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.705743]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    8.710019]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    8.715760]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    8.720005]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    8.725917]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    8.730007]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    8.735405]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    8.740005]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    8.745396]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    8.750026] sysctl table check failed: /kernel/shmmni .1.45 No proc_handler
[    8.762156] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    8.769021] Call Trace:
[    8.770004]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    8.774962]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    8.780004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    8.786004]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    8.790020]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    8.800004]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    8.805656]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    8.810005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    8.816088]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    8.820004]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    8.830020]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    8.835588]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    8.840005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    8.845829]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.850004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.855742]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    8.860004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    8.870019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    8.875758]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    8.880004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    8.885741]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    8.890004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    8.895916]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    8.900005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    8.910019]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    8.914982]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    8.920004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    8.925143] sysctl table check failed: /kernel/msgmax .1.35 No proc_handler
[    8.932778] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    8.939645] Call Trace:
[    8.940004]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    8.944963]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    8.950019]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    8.956020]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    8.960005]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    8.970004]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    8.975658]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    8.980005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    8.990022]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    8.995586]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.000005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.005569]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.010005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.015829]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.020004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.030019]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.036019]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.040011]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.045751]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.050005]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.055743]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.060004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.070020]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.075327]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.080004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.084965]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    9.090004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    9.095141] sysctl table check failed: /kernel/msgmni .1.42 No proc_handler
[    9.103402] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    9.110017] Call Trace:
[    9.112468]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    9.117432]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    9.120004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.130005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    9.136521]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    9.140004]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    9.145656]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    9.150020]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    9.160004]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    9.165569]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.170005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.175569]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.180005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.185831]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.190019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.200005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.206002]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.210004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.215743]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.220004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.225743]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.230019]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.240005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.245311]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.250006]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.254972]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    9.260004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    9.265142] sysctl table check failed: /kernel/msgmnb .1.36 No proc_handler
[    9.273419] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    9.280002] Call Trace:
[    9.282451]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    9.287413]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    9.290004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.300005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    9.306522]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    9.310019]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    9.315674]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    9.320005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    9.330004]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    9.335571]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.340005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.345570]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.350020]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.360004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.365743]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.370005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.376002]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.380004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.385743]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.390019]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.400004]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.405917]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.410005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.415308]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.420004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.424962]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    9.430019]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    9.435161] sysctl table check failed: /kernel/sem .1.43 No proc_handler
[    9.443144] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    9.450002] Call Trace:
[    9.452453]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    9.457413]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    9.460004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.470020]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    9.476539]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    9.480004]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    9.490005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    9.496090]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    9.500004]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    9.505569]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.510022]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.515587]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.520005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.530004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.535742]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.540005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.546002]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.550019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.560005]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.565394]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.570004]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.575915]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.580005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.585310]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.590019]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.594982]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    9.600004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    9.605142] sysctl table check failed: /kernel/auto_msgmni  No proc_handler
[    9.613367] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    9.620002] Call Trace:
[    9.622453]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    9.630019]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    9.636019]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.640005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    9.646521]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    9.650004]  [<ffffffff828ce5ad>] ? ipc_sysctl_init+0x0/0x3b
[    9.660005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    9.666090]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    9.670019]  [<ffffffff828ce5d0>] ipc_sysctl_init+0x23/0x3b
[    9.675587]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.680005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.690005]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.696090]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.700004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.705743]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.710019]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.716020]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.720004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.730004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.735396]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.740004]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.745915]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.750020]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.755327]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.760004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.764963]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[    9.770006]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[    9.780007] initcall ipc_sysctl_init+0x0/0x3b returned 0 after 1337890 usecs
[    9.787048] calling  init_mqueue_fs+0x0/0xee @ 1
[    9.800719] sysctl table check failed: /fs/mqueue/queues_max  No proc_handler
[    9.807935] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[    9.810025] Call Trace:
[    9.812478]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[    9.820005]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[    9.826002]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.830004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[    9.840005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[    9.846531]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[    9.850020]  [<ffffffff8145a27a>] ? kobject_uevent+0x1e/0x34
[    9.855673]  [<ffffffff81118ef5>] ? sysfs_slab_add+0x1a4/0x1e6
[    9.860005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[    9.870005]  [<ffffffff813ffe15>] ? init_once+0x0/0x3b
[    9.875135]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[    9.880004]  [<ffffffff814016c0>] mq_register_sysctl_table+0x28/0x40
[    9.886349]  [<ffffffff828ce639>] init_mqueue_fs+0x51/0xee
[    9.890019]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[    9.895586]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[    9.900005]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[    9.910005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[    9.915570]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[    9.920005]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[    9.925829]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.930019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.935760]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[    9.940005]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[    9.950004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[    9.955742]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[    9.960004]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[    9.965743]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[    9.970019]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[    9.980005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[    9.985319]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[    9.990004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[    9.994963]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[   10.000004]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[   10.005142] sysctl table check failed: /fs/mqueue/msg_max  No proc_handler
[   10.013031] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[   10.020002] Call Trace:
[   10.022451]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[   10.027412]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[   10.030007]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[   10.036010]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[   10.040005]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[   10.050020]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[   10.056451]  [<ffffffff8145a27a>] ? kobject_uevent+0x1e/0x34
[   10.060005]  [<ffffffff81118ef5>] ? sysfs_slab_add+0x1a4/0x1e6
[   10.070005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[   10.076089]  [<ffffffff813ffe15>] ? init_once+0x0/0x3b
[   10.080005]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[   10.086089]  [<ffffffff814016c0>] mq_register_sysctl_table+0x28/0x40
[   10.090019]  [<ffffffff828ce639>] init_mqueue_fs+0x51/0xee
[   10.095501]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[   10.100004]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[   10.110004]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[   10.115657]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[   10.120005]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[   10.126089]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[   10.130019]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.135758]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.140005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[   10.150004]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[   10.155484]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.160004]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[   10.165395]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[   10.170019]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[   10.175933]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[   10.180005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[   10.190005]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[   10.195396]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[   10.200005]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[   10.205404]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[   10.210024] sysctl table check failed: /fs/mqueue/msgsize_max  No proc_handler
[   10.217327] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip #291
[   10.220002] Call Trace:
[   10.222451]  [<ffffffff810a0b5c>] set_fail+0x5a/0x7c
[   10.230004]  [<ffffffff810a107c>] sysctl_check_table+0x4fe/0x5b7
[   10.236003]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[   10.240004]  [<ffffffff810a1095>] sysctl_check_table+0x517/0x5b7
[   10.250020]  [<ffffffff810857d4>] ? __register_sysctl_paths+0x69/0x2cd
[   10.256540]  [<ffffffff81085876>] __register_sysctl_paths+0x10b/0x2cd
[   10.260005]  [<ffffffff8145a27a>] ? kobject_uevent+0x1e/0x34
[   10.265657]  [<ffffffff81118ef5>] ? sysfs_slab_add+0x1a4/0x1e6
[   10.270005]  [<ffffffff81085a79>] register_sysctl_paths+0x41/0x57
[   10.280004]  [<ffffffff813ffe15>] ? init_once+0x0/0x3b
[   10.285137]  [<ffffffff81085aba>] register_sysctl_table+0x2b/0x41
[   10.290022]  [<ffffffff814016c0>] mq_register_sysctl_table+0x28/0x40
[   10.296367]  [<ffffffff828ce639>] init_mqueue_fs+0x51/0xee
[   10.300004]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[   10.310004]  [<ffffffff828ce5e8>] ? init_mqueue_fs+0x0/0xee
[   10.315571]  [<ffffffff810090b6>] do_one_initcall+0x84/0x1a8
[   10.320005]  [<ffffffff81117da5>] ? __slab_free+0x14a/0x36f
[   10.325570]  [<ffffffff814581d3>] ? ida_get_new_above+0x1b5/0x1ea
[   10.330020]  [<ffffffff810a88a4>] ? __lock_acquire+0x23a/0x472
[   10.335844]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.340004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.350005]  [<ffffffff810afd93>] ? test_ti_thread_flag+0xd/0x3a
[   10.356002]  [<ffffffff81ed39d9>] ? _spin_unlock+0x63/0x87
[   10.360004]  [<ffffffff8117aeb4>] ? proc_register+0x131/0x1bb
[   10.365742]  [<ffffffff81458229>] ? ida_get_new+0x21/0x37
[   10.370019]  [<ffffffff8117af16>] ? proc_register+0x193/0x1bb
[   10.375759]  [<ffffffff8117b0a4>] ? create_proc_entry+0x92/0xbe
[   10.380004]  [<ffffffff810bbce1>] ? register_irq_proc+0xc2/0xf2
[   10.390005]  [<ffffffff810b84dd>] ? irq_to_desc+0xd/0x50
[   10.395311]  [<ffffffff828ac8f9>] kernel_init+0x159/0x1c5
[   10.400004]  [<ffffffff8102f34a>] child_rip+0xa/0x20
[   10.404964]  [<ffffffff828ac7a0>] ? kernel_init+0x0/0x1c5
[   10.410019]  [<ffffffff8102f340>] ? child_rip+0x0/0x20
[   10.415290] initcall init_mqueue_fs+0x0/0xee returned 0 after 605468 usecs
[   10.420004] calling  key_proc_init+0x0/0x5a @ 1
[   10.424550] initcall key_proc_init+0x0/0x5a returned 0 after 0 usecs
[   10.430004] calling  crypto_wq_init+0x0/0x59 @ 1
[   10.434817] initcall crypto_wq_init+0x0/0x59 returned 0 after 0 usecs
[   10.440049] calling  crypto_algapi_init+0x0/0x34 @ 1
[   10.450014] initcall crypto_algapi_init+0x0/0x34 returned 0 after 0 usecs
[   10.456798] calling  chainiv_module_init+0x0/0x39 @ 1
[   10.460007] initcall chainiv_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.466875] calling  eseqiv_module_init+0x0/0x39 @ 1
[   10.470006] initcall eseqiv_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.480019] calling  seqiv_module_init+0x0/0x39 @ 1
[   10.484895] initcall seqiv_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.490003] calling  hmac_module_init+0x0/0x39 @ 1
[   10.494789] initcall hmac_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.500004] calling  crypto_xcbc_module_init+0x0/0x39 @ 1
[   10.510005] initcall crypto_xcbc_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.517221] calling  crypto_null_mod_init+0x0/0xa5 @ 1
[   10.520117] alg: No test for cipher_null (cipher_null-generic)
[   10.526097] alg: No test for ecb(cipher_null) (ecb-cipher_null)
[   10.530179] alg: No test for digest_null (digest_null-generic)
[   10.540174] alg: No test for compress_null (compress_null-generic)
[   10.546359] initcall crypto_null_mod_init+0x0/0xa5 returned 0 after 19531 usecs
[   10.550025] calling  md4_mod_init+0x0/0x39 @ 1
[   10.554659] initcall md4_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.560051] calling  md5_mod_init+0x0/0x39 @ 1
[   10.564663] initcall md5_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.570053] calling  rmd128_mod_init+0x0/0x39 @ 1
[   10.580162] initcall rmd128_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.586677] calling  rmd160_mod_init+0x0/0x39 @ 1
[   10.590216] initcall rmd160_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.596736] calling  rmd256_mod_init+0x0/0x39 @ 1
[   10.600185] initcall rmd256_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.610054] calling  sha1_generic_mod_init+0x0/0x39 @ 1
[   10.615423] initcall sha1_generic_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.620022] calling  sha256_generic_mod_init+0x0/0x65 @ 1
[   10.625722] initcall sha256_generic_mod_init+0x0/0x65 returned 0 after 0 usecs
[   10.630055] calling  wp512_mod_init+0x0/0x8a @ 1
[   10.640627] initcall wp512_mod_init+0x0/0x8a returned 0 after 0 usecs
[   10.647058] calling  tgr192_mod_init+0x0/0x8a @ 1
[   10.650553] initcall tgr192_mod_init+0x0/0x8a returned 0 after 0 usecs
[   10.657073] calling  crypto_ecb_module_init+0x0/0x39 @ 1
[   10.660173] initcall crypto_ecb_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.670004] calling  crypto_cbc_module_init+0x0/0x39 @ 1
[   10.675310] initcall crypto_cbc_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.680004] calling  crypto_module_init+0x0/0x39 @ 1
[   10.684963] initcall crypto_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.690003] calling  crypto_module_init+0x0/0x39 @ 1
[   10.700021] initcall crypto_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.706798] calling  crypto_ctr_module_init+0x0/0x69 @ 1
[   10.710006] initcall crypto_ctr_module_init+0x0/0x69 returned 0 after 0 usecs
[   10.720004] calling  cryptd_init+0x0/0x109 @ 1
[   10.724450] initcall cryptd_init+0x0/0x109 returned 0 after 0 usecs
[   10.730004] calling  des_generic_mod_init+0x0/0x65 @ 1
[   10.735530] initcall des_generic_mod_init+0x0/0x65 returned 0 after 0 usecs
[   10.740099] calling  fcrypt_mod_init+0x0/0x39 @ 1
[   10.744891] alg: No test for fcrypt (fcrypt-generic)
[   10.751125] initcall fcrypt_mod_init+0x0/0x39 returned 0 after 9765 usecs
[   10.760024] calling  blowfish_mod_init+0x0/0x39 @ 1
[   10.765837] initcall blowfish_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.770024] calling  twofish_mod_init+0x0/0x39 @ 1
[   10.775129] initcall twofish_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.780008] calling  aes_init+0x0/0x39 @ 1
[   10.784301] initcall aes_init+0x0/0x39 returned 0 after 0 usecs
[   10.790004] calling  cast5_mod_init+0x0/0x39 @ 1
[   10.800209] initcall cast5_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.806641] calling  cast6_mod_init+0x0/0x39 @ 1
[   10.810222] initcall cast6_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.816652] calling  arc4_init+0x0/0x39 @ 1
[   10.820198] initcall arc4_init+0x0/0x39 returned 0 after 0 usecs
[   10.826200] calling  tea_mod_init+0x0/0x8a @ 1
[   10.830601] initcall tea_mod_init+0x0/0x8a returned 0 after 0 usecs
[   10.840004] calling  khazad_mod_init+0x0/0x39 @ 1
[   10.844896] initcall khazad_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.850004] calling  anubis_mod_init+0x0/0x39 @ 1
[   10.854984] initcall anubis_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.860004] calling  seed_init+0x0/0x39 @ 1
[   10.864360] initcall seed_init+0x0/0x39 returned 0 after 0 usecs
[   10.870004] calling  deflate_mod_init+0x0/0x39 @ 1
[   10.875615] initcall deflate_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.880004] calling  zlib_mod_init+0x0/0x39 @ 1
[   10.891249] initcall zlib_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.897594] calling  michael_mic_init+0x0/0x39 @ 1
[   10.900195] initcall michael_mic_init+0x0/0x39 returned 0 after 0 usecs
[   10.906797] calling  crc32c_mod_init+0x0/0x39 @ 1
[   10.910215] initcall crc32c_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.920005] calling  crypto_authenc_module_init+0x0/0x39 @ 1
[   10.925655] initcall crypto_authenc_module_init+0x0/0x39 returned 0 after 0 usecs
[   10.930004] calling  lzo_mod_init+0x0/0x39 @ 1
[   10.934737] initcall lzo_mod_init+0x0/0x39 returned 0 after 0 usecs
[   10.940005] calling  krng_mod_init+0x0/0x39 @ 1
[   10.944614] alg: No test for stdrng (krng)
[   10.950132] initcall krng_mod_init+0x0/0x39 returned 0 after 9765 usecs
[   10.960004] calling  proc_genhd_init+0x0/0x63 @ 1
[   10.964723] initcall proc_genhd_init+0x0/0x63 returned 0 after 0 usecs
[   10.970004] calling  bsg_init+0x0/0x155 @ 1
[   10.974695] device class 'bsg': registering
[   10.980243] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[   10.987629] initcall bsg_init+0x0/0x155 returned 0 after 9765 usecs
[   10.990004] calling  noop_init+0x0/0x3b @ 1
[   10.994209] io scheduler noop registered (default)
[   11.000004] initcall noop_init+0x0/0x3b returned 0 after 9765 usecs
[   11.006260] calling  as_init+0x0/0x3b @ 1
[   11.010003] io scheduler anticipatory registered
[   11.014617] initcall as_init+0x0/0x3b returned 0 after 0 usecs
[   11.020025] calling  deadline_init+0x0/0x3b @ 1
[   11.024554] io scheduler deadline registered
[   11.030004] initcall deadline_init+0x0/0x3b returned 0 after 9765 usecs
[   11.036607] calling  debug_objects_init_debugfs+0x0/0x8a @ 1
[   11.040035] initcall debug_objects_init_debugfs+0x0/0x8a returned 0 after 0 usecs
[   11.050004] calling  libcrc32c_mod_init+0x0/0x53 @ 1
[   11.054967] initcall libcrc32c_mod_init+0x0/0x53 returned 0 after 0 usecs
[   11.060019] calling  percpu_counter_startup+0x0/0x54 @ 1
[   11.065326] initcall percpu_counter_startup+0x0/0x54 returned 0 after 0 usecs
[   11.070007] calling  pci_init+0x0/0x60 @ 1
[   11.080015] pci 0000:00:00.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.086272] pci 0000:00:00.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.090005] pci 0000:00:00.0: calling pci_fixup_video+0x0/0xe3
[   11.095834] pci 0000:00:01.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.100019] pci 0000:00:01.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.110003] pci 0000:00:01.0: calling pci_fixup_video+0x0/0xe3
[   11.115834] pci 0000:00:01.1: calling quirk_cardbus_legacy+0x0/0x4e
[   11.120004] pci 0000:00:01.1: calling quirk_usb_early_handoff+0x0/0x63e
[   11.130003] pci 0000:00:01.1: calling pci_fixup_video+0x0/0xe3
[   11.135834] pci 0000:00:02.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.140019] pci 0000:00:02.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.170025] pci 0000:00:02.0: calling pci_fixup_video+0x0/0xe3
[   11.175864] pci 0000:00:02.1: calling quirk_cardbus_legacy+0x0/0x4e
[   11.180005] pci 0000:00:02.1: calling quirk_usb_early_handoff+0x0/0x63e
[   11.186623] pci 0000:00:02.1: calling pci_fixup_video+0x0/0xe3
[   11.190010] pci 0000:00:04.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.200004] pci 0000:00:04.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.206609] pci 0000:00:04.0: calling pci_fixup_video+0x0/0xe3
[   11.210010] pci 0000:00:06.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.216270] pci 0000:00:06.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.220026] pci 0000:00:06.0: calling pci_fixup_video+0x0/0xe3
[   11.230010] pci 0000:00:09.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.236271] pci 0000:00:09.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.240004] pci 0000:00:09.0: calling pci_fixup_video+0x0/0xe3
[   11.250010] pci 0000:00:0a.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.256271] pci 0000:00:0a.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.260019] pci 0000:00:0a.0: calling pci_fixup_video+0x0/0xe3
[   11.265852] pci 0000:00:0b.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[   11.270005] pci 0000:00:0b.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.280004] pci 0000:00:0b.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.286607] pci 0000:00:0b.0: calling pci_fixup_video+0x0/0xe3
[   11.290010] pci 0000:00:0c.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[   11.300019] pci 0000:00:0c.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.306278] pci 0000:00:0c.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.310003] pci 0000:00:0c.0: calling pci_fixup_video+0x0/0xe3
[   11.320010] pci 0000:00:0d.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[   11.327568] pci 0000:00:0d.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.330006] pci 0000:00:0d.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.340018] pci 0000:00:0d.0: calling pci_fixup_video+0x0/0xe3
[   11.345853] pci 0000:00:0e.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[   11.350004] pci 0000:00:0e.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.360004] pci 0000:00:0e.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.366607] pci 0000:00:0e.0: calling pci_fixup_video+0x0/0xe3
[   11.370010] pci 0000:00:18.0: calling quirk_amd_nb_node+0x0/0x76
[   11.380022] pci 0000:00:18.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.386278] pci 0000:00:18.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.390003] pci 0000:00:18.0: calling pci_fixup_video+0x0/0xe3
[   11.395833] pci 0000:00:18.1: calling quirk_amd_nb_node+0x0/0x76
[   11.400006] pci 0000:00:18.1: calling quirk_cardbus_legacy+0x0/0x4e
[   11.410004] pci 0000:00:18.1: calling quirk_usb_early_handoff+0x0/0x63e
[   11.416609] pci 0000:00:18.1: calling pci_fixup_video+0x0/0xe3
[   11.420024] pci 0000:00:18.2: calling quirk_amd_nb_node+0x0/0x76
[   11.430006] pci 0000:00:18.2: calling quirk_cardbus_legacy+0x0/0x4e
[   11.436269] pci 0000:00:18.2: calling quirk_usb_early_handoff+0x0/0x63e
[   11.440003] pci 0000:00:18.2: calling pci_fixup_video+0x0/0xe3
[   11.445835] pci 0000:00:18.3: calling quirk_amd_nb_node+0x0/0x76
[   11.450006] pci 0000:00:18.3: calling quirk_cardbus_legacy+0x0/0x4e
[   11.460019] pci 0000:00:18.3: calling quirk_usb_early_handoff+0x0/0x63e
[   11.466624] pci 0000:00:18.3: calling pci_fixup_video+0x0/0xe3
[   11.470010] pci 0000:05:07.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.476270] pci 0000:05:07.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.480004] pci 0000:05:07.0: calling pci_fixup_video+0x0/0xe3
[   11.490010] pci 0000:01:00.0: calling quirk_cardbus_legacy+0x0/0x4e
[   11.496271] pci 0000:01:00.0: calling quirk_usb_early_handoff+0x0/0x63e
[   11.500018] pci 0000:01:00.0: calling pci_fixup_video+0x0/0xe3
[   11.510004] pci 0000:01:00.0: Boot video device
[   11.514536] pci 0000:01:00.1: calling quirk_cardbus_legacy+0x0/0x4e
[   11.520004] pci 0000:01:00.1: calling quirk_usb_early_handoff+0x0/0x63e
[   11.526609] pci 0000:01:00.1: calling pci_fixup_video+0x0/0xe3
[   11.530009] initcall pci_init+0x0/0x60 returned 0 after 439453 usecs
[   11.540019] calling  pci_proc_init+0x0/0x90 @ 1
[   11.544850] initcall pci_proc_init+0x0/0x90 returned 0 after 0 usecs
[   11.550004] calling  pci_hotplug_init+0x0/0x74 @ 1
[   11.554788] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[   11.560004] initcall pci_hotplug_init+0x0/0x74 returned 0 after 9765 usecs
[   11.566867] calling  zt5550_init+0x0/0xa3 @ 1
[   11.570002] cpcihp_zt5550: ZT5550 CompactPCI Hot Plug Driver version: 0.2
[   11.580021] bus: 'pci': add driver zt5550_hc
[   11.584558] initcall zt5550_init+0x0/0xa3 returned 0 after 9765 usecs
[   11.590008] calling  cpcihp_generic_init+0x0/0x443 @ 1
[   11.595142] cpcihp_generic: Generic port I/O CompactPCI Hot Plug Driver version: 0.1
[   11.600002] cpcihp_generic: not configured, disabling.
[   11.605136] initcall cpcihp_generic_init+0x0/0x443 returned -22 after 9765 usecs
[   11.610004] initcall cpcihp_generic_init+0x0/0x443 returned with error code -22 
[   11.620004] calling  shpcd_init+0x0/0x88 @ 1
[   11.624270] bus: 'pci': add driver shpchp
[   11.630040] bus: 'pci': driver_probe_device: matched device 0000:00:0b.0 with driver shpchp
[   11.640003] bus: 'pci': really_probe: probing driver shpchp with device 0000:00:0b.0
[   11.647918] bus: 'pci': driver_probe_device: matched device 0000:00:0c.0 with driver shpchp
[   11.650019] bus: 'pci': really_probe: probing driver shpchp with device 0000:00:0c.0
[   11.660147] bus: 'pci': driver_probe_device: matched device 0000:00:0d.0 with driver shpchp
[   11.670057] bus: 'pci': really_probe: probing driver shpchp with device 0000:00:0d.0
[   11.680157] bus: 'pci': driver_probe_device: matched device 0000:00:0e.0 with driver shpchp
[   11.688493] bus: 'pci': really_probe: probing driver shpchp with device 0000:00:0e.0
[   11.690459] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[   11.700058] initcall shpcd_init+0x0/0x88 returned 0 after 78125 usecs
[   11.710004] calling  init_legacy+0x0/0x69 @ 1
[   11.714648] initcall init_legacy+0x0/0x69 returned 0 after 0 usecs
[   11.720004] calling  tdo24m_init+0x0/0x39 @ 1
[   11.724357] bus: 'spi': add driver tdo24m
[   11.730232] initcall tdo24m_init+0x0/0x39 returned 0 after 9765 usecs
[   11.736669] calling  kb3886_init+0x0/0x32 @ 1
[   11.740071] initcall kb3886_init+0x0/0x32 returned -19 after 0 usecs
[   11.746415] calling  display_class_init+0x0/0xa5 @ 1
[   11.750004] device class 'display': registering
[   11.754753] initcall display_class_init+0x0/0xa5 returned 0 after 0 usecs
[   11.760026] calling  rand_initialize+0x0/0x58 @ 1
[   11.764761] initcall rand_initialize+0x0/0x58 returned 0 after 0 usecs
[   11.770004] calling  tty_init+0x0/0x11c @ 1
[   11.774192] device: 'tty': device_add
[   11.780256] device: 'console': device_add
[   11.784483] device: 'tty0': device_add
[   11.790282] device class 'vc': registering
[   11.794596] device: 'vcs': device_add
[   11.800199] device: 'vcsa': device_add
[   11.804190] device: 'vcs1': device_add
[   11.808152] device: 'vcsa1': device_add
[   11.810274] device: 'tty1': device_add
[   11.814291] device: 'tty2': device_add
[   11.820435] device: 'tty3': device_add
[   11.824414] device: 'tty4': device_add
[   11.828383] device: 'tty5': device_add
[   11.830409] device: 'tty6': device_add
[   11.834375] device: 'tty7': device_add
[   11.840251] device: 'tty8': device_add
[   11.844259] device: 'tty9': device_add
[   11.848241] device: 'tty10': device_add
[   11.850251] device: 'tty11': device_add
[   11.854305] device: 'tty12': device_add
[   11.860245] device: 'tty13': device_add
[   11.864310] device: 'tty14': device_add
[   11.868358] device: 'tty15': device_add
[   11.870285] device: 'tty16': device_add
[   11.874341] device: 'tty17': device_add
[   11.880229] device: 'tty18': device_add
[   11.884333] device: 'tty19': device_add
[   11.888387] device: 'tty20': device_add
[   11.890304] device: 'tty21': device_add
[   11.894358] device: 'tty22': device_add
[   11.900234] device: 'tty23': device_add
[   11.904304] device: 'tty24': device_add
[   11.908378] device: 'tty25': device_add
[   11.910285] device: 'tty26': device_add
[   11.914343] device: 'tty27': device_add
[   11.920232] device: 'tty28': device_add
[   11.924323] device: 'tty29': device_add
[   11.930583] device: 'tty30': device_add
[   11.934636] device: 'tty31': device_add
[   11.938689] device: 'tty32': device_add
[   11.940257] device: 'tty33': device_add
[   11.944339] device: 'tty34': device_add
[   11.950425] device: 'tty35': device_add
[   11.954498] device: 'tty36': device_add
[   11.958560] device: 'tty37': device_add
[   11.960312] device: 'tty38': device_add
[   11.964416] device: 'tty39': device_add
[   11.970271] device: 'tty40': device_add
[   11.974362] device: 'tty41': device_add
[   11.978412] device: 'tty42': device_add
[   11.980250] device: 'tty43': device_add
[   11.984308] device: 'tty44': device_add
[   11.990259] device: 'tty45': device_add
[   11.994316] device: 'tty46': device_add
[   12.000630] device: 'tty47': device_add
[   12.004691] device: 'tty48': device_add
[   12.008785] device: 'tty49': device_add
[   12.010226] device: 'tty50': device_add
[   12.014339] device: 'tty51': device_add
[   12.020266] device: 'tty52': device_add
[   12.024375] device: 'tty53': device_add
[   12.028433] device: 'tty54': device_add
[   12.030269] device: 'tty55': device_add
[   12.034336] device: 'tty56': device_add
[   12.040295] device: 'tty57': device_add
[   12.044354] device: 'tty58': device_add
[   12.048448] device: 'tty59': device_add
[   12.050240] device: 'tty60': device_add
[   12.054313] device: 'tty61': device_add
[   12.060252] device: 'tty62': device_add
[   12.064308] device: 'tty63': device_add
[   12.070630] initcall tty_init+0x0/0x11c returned 0 after 292968 usecs
[   12.077059] calling  pty_init+0x0/0x35d @ 1
[   12.080087] device: 'ptmx': device_add
[   12.084072] initcall pty_init+0x0/0x35d returned 0 after 0 usecs
[   12.090036] calling  sysrq_init+0x0/0x4c @ 1
[   12.094322] initcall sysrq_init+0x0/0x4c returned 0 after 0 usecs
[   12.100004] calling  nozomi_init+0x0/0x153 @ 1
[   12.104441] Initializing Nozomi driver 2.1d (build date: Aug  2 2009 22:49:23)
[   12.110030] bus: 'pci': add driver nozomi
[   12.114293] initcall nozomi_init+0x0/0x153 returned 0 after 9765 usecs
[   12.120059] calling  lp_init_module+0x0/0x259 @ 1
[   12.124771] device class 'printer': registering
[   12.130247] lp: driver loaded but no devices found
[   12.135032] initcall lp_init_module+0x0/0x259 returned 0 after 9765 usecs
[   12.140025] calling  rtc_init+0x0/0x12c @ 1
[   12.144228] device: 'rtc': device_add
[   12.150263] Real Time Clock Driver v1.12b
[   12.154270] initcall rtc_init+0x0/0x12c returned 0 after 9765 usecs
[   12.160024] calling  mod_init+0x0/0x73 @ 1
[   12.164121] initcall mod_init+0x0/0x73 returned -19 after 0 usecs
[   12.170004] calling  ppdev_init+0x0/0xe2 @ 1
[   12.174277] device class 'ppdev': registering
[   12.180212] ppdev: user-space parallel port driver
[   12.184999] initcall ppdev_init+0x0/0xe2 returned 0 after 9765 usecs
[   12.190007] calling  tlclk_init+0x0/0x274 @ 1
[   12.194382] telclk_interrup = 0xf non-mcpbl0010 hw.
[   12.200030] initcall tlclk_init+0x0/0x274 returned -6 after 9765 usecs
[   12.206547] initcall tlclk_init+0x0/0x274 returned with error code -6 
[   12.210004] calling  mwave_init+0x0/0x2ca @ 1
[   12.220008] smapi::smapi_init, ERROR invalid usSmapiID
[   12.225142] mwave: tp3780i::tp3780I_InitializeBoardData: Error: SMAPI is not available on this machine
[   12.230025] mwave: mwavedd::mwave_init: Error: Failed to initialize board data
[   12.240002] mwave: mwavedd::mwave_init: Error: Failed to initialize
[   12.246261] initcall mwave_init+0x0/0x2ca returned -5 after 19531 usecs
[   12.250004] initcall mwave_init+0x0/0x2ca returned with error code -5 
[   12.260004] calling  agp_init+0x0/0x4b @ 1
[   12.264094] Linux agpgart interface v0.103
[   12.270019] initcall agp_init+0x0/0x4b returned 0 after 9765 usecs
[   12.276192] calling  agp_amd64_init+0x0/0xe8 @ 1
[   12.280003] bus: 'pci': add driver agpgart-amd64
[   12.285079] initcall agp_amd64_init+0x0/0xe8 returned -19 after 0 usecs
[   12.290005] calling  agp_intel_init+0x0/0x50 @ 1
[   12.294615] bus: 'pci': add driver agpgart-intel
[   12.300241] initcall agp_intel_init+0x0/0x50 returned 0 after 9765 usecs
[   12.306936] calling  agp_sis_init+0x0/0x50 @ 1
[   12.310004] bus: 'pci': add driver agpgart-sis
[   12.314705] initcall agp_sis_init+0x0/0x50 returned 0 after 0 usecs
[   12.320005] calling  ipmi_init_msghandler_mod+0x0/0x34 @ 1
[   12.325482] bus: 'platform': add driver ipmi
[   12.330221] ipmi message handler version 39.2
[   12.334587] initcall ipmi_init_msghandler_mod+0x0/0x34 returned 0 after 9765 usecs
[   12.340005] calling  ipmi_wdog_init+0x0/0x153 @ 1
[   12.350025] IPMI Watchdog: driver initialized
[   12.354383] initcall ipmi_wdog_init+0x0/0x153 returned 0 after 0 usecs
[   12.360006] calling  ipmi_poweroff_init+0x0/0xb7 @ 1
[   12.364969] Copyright (C) 2004 MontaVista Software - IPMI Powerdown via sys_reboot.
[   12.370028] initcall ipmi_poweroff_init+0x0/0xb7 returned 0 after 9765 usecs
[   12.380026] calling  drm_core_init+0x0/0x145 @ 1
[   12.384647] device class 'drm': registering
[   12.390287] [drm] Initialized drm 1.1.0 20060810
[   12.394903] initcall drm_core_init+0x0/0x145 returned 0 after 9765 usecs
[   12.400005] calling  mga_init+0x0/0x45 @ 1
[   12.404137] initcall mga_init+0x0/0x45 returned 0 after 0 usecs
[   12.410004] calling  i810_init+0x0/0x45 @ 1
[   12.414224] initcall i810_init+0x0/0x45 returned 0 after 0 usecs
[   12.420004] calling  sis_init+0x0/0x45 @ 1
[   12.424179] initcall sis_init+0x0/0x45 returned 0 after 0 usecs
[   12.430021] calling  savage_init+0x0/0x45 @ 1
[   12.434606] initcall savage_init+0x0/0x45 returned 0 after 0 usecs
[   12.440026] calling  via_init+0x0/0x4a @ 1
[   12.444219] initcall via_init+0x0/0x4a returned 0 after 0 usecs
[   12.450004] calling  serial8250_init+0x0/0x16f @ 1
[   12.454786] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[   12.460051] Registering platform device 'serial8250'. Parent at platform
[   12.470005] device: 'serial8250': device_add
[   12.474276] bus: 'platform': add device serial8250
[   12.480304] async_waiting @ 1
[   12.483281] async_continuing @ 1 after 0 usec
[   12.620064] async_waiting @ 1
[   12.623031] async_continuing @ 1 after 0 usec
�[   12.760103] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[   12.766120] device: 'ttyS0': device_add
[   12.770255] device: 'ttyS1': device_add
[   12.774346] device: 'ttyS2': device_add
[   12.778434] device: 'ttyS3': device_add
[   12.780253] Platform driver 'serial8250' needs updating - please use dev_pm_ops
[   12.787549] bus: 'platform': add driver serial8250
[   12.790015] bus: 'platform': driver_probe_device: matched device serial8250 with driver serial8250
[   12.800003] bus: 'platform': really_probe: probing driver serial8250 with device serial8250
[   12.810011] driver: 'serial8250': driver_bound: bound to device 'serial8250'
[   12.817048] bus: 'platform': really_probe: bound device serial8250 to driver serial8250
[   12.820248] initcall serial8250_init+0x0/0x16f returned 0 after 361328 usecs
[   12.830029] calling  jsm_init_module+0x0/0x6e @ 1
[   12.834778] bus: 'pci': add driver jsm
[   12.840253] initcall jsm_init_module+0x0/0x6e returned 0 after 9765 usecs
[   12.847033] calling  init_kgdboc+0x0/0x3b @ 1
[   12.850006] initcall init_kgdboc+0x0/0x3b returned 0 after 0 usecs
[   12.860004] calling  parport_default_proc_register+0x0/0x42 @ 1
[   12.865956] initcall parport_default_proc_register+0x0/0x42 returned 0 after 0 usecs
[   12.870003] calling  parport_pc_init+0x0/0x355 @ 1
[   12.874789] bus: 'platform': add driver parport_pc
[   12.880233] IT8712 SuperIO detected.
[   12.884151] Registering platform device 'parport_pc.956'. Parent at platform
[   12.890027] device: 'parport_pc.956': device_add
[   12.894648] bus: 'platform': add device parport_pc.956
[   12.900217] bus: 'platform': driver_probe_device: matched device parport_pc.956 with driver parport_pc
[   12.910004] bus: 'platform': really_probe: probing driver parport_pc with device parport_pc.956
[   12.920011] driver: 'parport_pc.956': driver_bound: bound to device 'parport_pc'
[   12.930005] bus: 'platform': really_probe: bound device parport_pc.956 to driver parport_pc
[   12.938429] bus: 'platform': remove device parport_pc.956
[   12.940237] Registering platform device 'parport_pc.888'. Parent at platform
[   12.950027] device: 'parport_pc.888': device_add
[   12.954647] bus: 'platform': add device parport_pc.888
[   12.960217] bus: 'platform': driver_probe_device: matched device parport_pc.888 with driver parport_pc
[   12.970004] bus: 'platform': really_probe: probing driver parport_pc with device parport_pc.888
[   12.978693] driver: 'parport_pc.888': driver_bound: bound to device 'parport_pc'
[   12.980003] bus: 'platform': really_probe: bound device parport_pc.888 to driver parport_pc
[   12.990053] parport0: PC-style at 0x378 (0x778)async_waiting @ 1
[   13.000003] async_continuing @ 1 after 0 usec
[   13.141034]  [PCSPP,TRISTATE]
[   13.144052] parport0: irq 7 detected
[   13.220165] device: 'parport0': device_add
[   13.224600] device: 'lp0': device_add
[   13.228517] lp0: using parport0 (polling).
[   13.230028] lp0: console ready
[   13.233086] Registering platform device 'parport_pc.632'. Parent at platform
[   13.240005] device: 'parport_pc.632': device_add
[   13.244621] bus: 'platform': add device parport_pc.632
[   13.250227] bus: 'platform': driver_probe_device: matched device parport_pc.632 with driver parport_pc
[   13.260082] bus: 'platform': really_probe: probing driver parport_pc with device parport_pc.632
[   13.270011] driver: 'parport_pc.632': driver_bound: bound to device 'parport_pc'
[   13.277396] bus: 'platform': really_probe: bound device parport_pc.632 to driver parport_pc
[   13.280073] bus: 'platform': remove device parport_pc.632
[   13.290235] bus: 'pci': add driver parport_pc
[   13.294830] initcall parport_pc_init+0x0/0x355 returned 0 after 410156 usecs
[   13.300072] calling  topology_sysfs_init+0x0/0x82 @ 1
[   13.305154] initcall topology_sysfs_init+0x0/0x82 returned 0 after 0 usecs
[   13.310004] calling  floppy_init+0x0/0xe23 @ 1
[   13.320089] Platform driver 'floppy' needs updating - please use dev_pm_ops
[   13.327040] bus: 'platform': add driver floppy
[   13.330346] Floppy drive(s): fd0 is 1.44M
[   13.353888] FDC 0 is a post-1991 82077
[   13.358610] Registering platform device 'floppy.0'. Parent at platform
[   13.360022] device: 'floppy.0': device_add
[   13.364131] bus: 'platform': add device floppy.0
[   13.370229] bus: 'platform': driver_probe_device: matched device floppy.0 with driver floppy
[   13.380005] bus: 'platform': really_probe: probing driver floppy with device floppy.0
[   13.390011] driver: 'floppy.0': driver_bound: bound to device 'floppy'
[   13.396528] bus: 'platform': really_probe: bound device floppy.0 to driver floppy
[   13.400012] device: 'fd0': device_add
[   13.404023] device: '2:0': device_add
[   13.410281] initcall floppy_init+0x0/0xe23 returned 0 after 87890 usecs
[   13.416885] calling  loop_init+0x0/0x1bc @ 1
[   13.420291] device: 'loop0': device_add
[   13.424478] device: '7:0': device_add
[   13.430289] device: 'loop1': device_add
[   13.434513] device: '7:1': device_add
[   13.438420] device: 'loop2': device_add
[   13.440317] device: '7:2': device_add
[   13.444257] device: 'loop3': device_add
[   13.450344] device: '7:3': device_add
[   13.454278] device: 'loop4': device_add
[   13.460327] device: '7:4': device_add
[   13.464225] device: 'loop5': device_add
[   13.468373] device: '7:5': device_add
[   13.470313] device: 'loop6': device_add
[   13.474463] device: '7:6': device_add
[   13.480406] device: 'loop7': device_add
[   13.484580] device: '7:7': device_add
[   13.488499] loop: module loaded
[   13.490060] initcall loop_init+0x0/0x1bc returned 0 after 68359 usecs
[   13.496494] calling  cpqarray_init+0x0/0x2ba @ 1
[   13.500003] Compaq SMART2 Driver (v 2.6.0)
[   13.504097] bus: 'pci': add driver cpqarray
[   13.510267] bus: 'pci': remove driver cpqarray
[   13.514924] driver: 'cpqarray': driver_release
[   13.520039] initcall cpqarray_init+0x0/0x2ba returned -19 after 19531 usecs
[   13.526988] calling  cciss_init+0x0/0x7a @ 1
[   13.530006] HP CISS Driver (v 3.6.20)
[   13.533907] bus: 'cciss': registered
[   13.537481] bus: 'pci': add driver cciss
[   13.540286] initcall cciss_init+0x0/0x7a returned 0 after 9765 usecs
[   13.546635] calling  DAC960_init_module+0x0/0x78 @ 1
[   13.550022] bus: 'pci': add driver DAC960
[   13.554272] device: 'dac960_gam': device_add
[   13.560269] initcall DAC960_init_module+0x0/0x78 returned 0 after 9765 usecs
[   13.570004] calling  nbd_init+0x0/0x305 @ 1
[   13.574962] nbd: registered device at major 43
[   13.580017] device: 'nbd0': device_add
[   13.584088] device: '43:0': device_add
[   13.588076] device: 'nbd1': device_add
[   13.590350] device: '43:1': device_add
[   13.594362] device: 'nbd2': device_add
[   13.600360] device: '43:2': device_add
[   13.604370] device: 'nbd3': device_add
[   13.608423] device: '43:3': device_add
[   13.610309] device: 'nbd4': device_add
[   13.614390] device: '43:4': device_add
[   13.620243] device: 'nbd5': device_add
[   13.624356] device: '43:5': device_add
[   13.628339] device: 'nbd6': device_add
[   13.630400] device: '43:6': device_add
[   13.634399] device: 'nbd7': device_add
[   13.640345] device: '43:7': device_add
[   13.644381] device: 'nbd8': device_add
[   13.648451] device: '43:8': device_add
[   13.650295] device: 'nbd9': device_add
[   13.654368] device: '43:9': device_add
[   13.660259] device: 'nbd10': device_add
[   13.664438] device: '43:10': device_add
[   13.668513] device: 'nbd11': device_add
[   13.670381] device: '43:11': device_add
[   13.674452] device: 'nbd12': device_add
[   13.680325] device: '43:12': device_add
[   13.684445] device: 'nbd13': device_add
[   13.690703] device: '43:13': device_add
[   13.694776] device: 'nbd14': device_add
[   13.698967] device: '43:14': device_add
[   13.700273] device: 'nbd15': device_add
[   13.704518] device: '43:15': device_add
[   13.710264] initcall nbd_init+0x0/0x305 returned 0 after 136718 usecs
[   13.716692] calling  init_cryptoloop+0x0/0x55 @ 1
[   13.720005] initcall init_cryptoloop+0x0/0x55 returned 0 after 0 usecs
[   13.726519] calling  ibmasm_init+0x0/0x8a @ 1
[   13.730020] bus: 'pci': add driver ibmasm
[   13.734266] ibmasm: IBM ASM Service Processor Driver version 1.0 loaded
[   13.740010] initcall ibmasm_init+0x0/0x8a returned 0 after 9765 usecs
[   13.750003] calling  ics932s401_init+0x0/0x3b @ 1
[   13.754701] bus: 'i2c': add driver ics932s401
[   13.760342] initcall ics932s401_init+0x0/0x3b returned 0 after 9765 usecs
[   13.767121] calling  tifm_7xx1_init+0x0/0x42 @ 1
[   13.770003] bus: 'pci': add driver tifm_7xx1
[   13.774495] initcall tifm_7xx1_init+0x0/0x42 returned 0 after 0 usecs
[   13.780005] calling  phantom_init+0x0/0x12f @ 1
[   13.784527] device class 'phantom': registering
[   13.790251] bus: 'pci': add driver phantom
[   13.794592] Phantom Linux Driver, version n0.9.8, init OK
[   13.800005] initcall phantom_init+0x0/0x12f returned 0 after 19531 usecs
[   13.806703] calling  ioc4_init+0x0/0x47 @ 1
[   13.810004] bus: 'pci': add driver IOC4
[   13.814066] initcall ioc4_init+0x0/0x47 returned 0 after 0 usecs
[   13.820004] calling  ilo_init+0x0/0xb8 @ 1
[   13.824095] device class 'iLO': registering
[   13.830230] bus: 'pci': add driver hpilo
[   13.834403] initcall ilo_init+0x0/0xb8 returned 0 after 9765 usecs
[   13.840005] calling  c2port_init+0x0/0x77 @ 1
[   13.844353] Silicon Labs C2 port support v. 0.51.0 - (C) 2007 Rodolfo Giometti
[   13.850004] device class 'c2port': registering
[   13.854653] initcall c2port_init+0x0/0x77 returned 0 after 9765 usecs
[   13.860005] calling  duramar2150_c2port_init+0x0/0x97 @ 1
[   13.865489] device: 'c2port0': device_add
[   13.870286] c2port c2port0: C2 port uc added
[   13.874553] c2port c2port0: uc flash has 30 blocks x 512 bytes (15360 bytes total)
[   13.880006] initcall duramar2150_c2port_init+0x0/0x97 returned 0 after 19531 usecs
[   13.890004] calling  at24_init+0x0/0x5d @ 1
[   13.894183] bus: 'i2c': add driver at24
[   13.900218] initcall at24_init+0x0/0x5d returned 0 after 9765 usecs
[   13.906478] calling  at25_init+0x0/0x39 @ 1
[   13.910005] bus: 'spi': add driver at25
[   13.914068] initcall at25_init+0x0/0x39 returned 0 after 0 usecs
[   13.920004] calling  eeprom_init+0x0/0x3b @ 1
[   13.924355] bus: 'i2c': add driver eeprom
[   13.930221] initcall eeprom_init+0x0/0x3b returned 0 after 9765 usecs
[   13.936649] calling  max6875_init+0x0/0x3b @ 1
[   13.940004] bus: 'i2c': add driver max6875
[   13.944328] initcall max6875_init+0x0/0x3b returned 0 after 0 usecs
[   13.950004] calling  cb710_init_module+0x0/0x42 @ 1
[   13.954875] bus: 'pci': add driver cb710
[   13.960243] initcall cb710_init_module+0x0/0x42 returned 0 after 9765 usecs
[   13.967196] calling  pasic3_base_init+0x0/0x40 @ 1
[   13.970006] bus: 'platform': add driver pasic3
[   13.974735] bus: 'platform': remove driver pasic3
[   13.980211] driver: 'pasic3': driver_release
[   13.984481] initcall pasic3_base_init+0x0/0x40 returned -19 after 9765 usecs
[   13.990004] calling  ezx_pcap_init+0x0/0x39 @ 1
[   13.994529] bus: 'spi': add driver ezx-pcap
[   14.000221] initcall ezx_pcap_init+0x0/0x39 returned 0 after 9765 usecs
[   14.006825] calling  scsi_tgt_init+0x0/0xb1 @ 1
[   14.010805] device: 'tgt': device_add
[   14.014740] initcall scsi_tgt_init+0x0/0xb1 returned 0 after 0 usecs
[   14.020005] calling  raid_init+0x0/0x39 @ 1
[   14.024179] device class 'raid_devices': registering
[   14.030238] initcall raid_init+0x0/0x39 returned 0 after 9765 usecs
[   14.040012] calling  spi_transport_init+0x0/0x9f @ 1
[   14.044984] device class 'spi_transport': registering
[   14.050240] device class 'spi_host': registering
[   14.055093] initcall spi_transport_init+0x0/0x9f returned 0 after 9765 usecs
[   14.060005] calling  fc_transport_init+0x0/0x73 @ 1
[   14.064872] device class 'fc_host': registering
[   14.070212] device class 'fc_vports': registering
[   14.075112] device class 'fc_remote_ports': registering
[   14.080259] device class 'fc_transport': registering
[   14.085424] initcall fc_transport_init+0x0/0x73 returned 0 after 19531 usecs
[   14.090004] calling  iscsi_transport_init+0x0/0x173 @ 1
[   14.100002] Loading iSCSI transport class v2.0-870.
[   14.104874] device class 'iscsi_transport': registering
[   14.110211] device class 'iscsi_endpoint': registering
[   14.115545] device class 'iscsi_host': registering
[   14.120292] device class 'iscsi_connection': registering
[   14.125804] device class 'iscsi_session': registering
[   14.130326] initcall iscsi_transport_init+0x0/0x173 returned 0 after 29296 usecs
[   14.137714] calling  sas_transport_init+0x0/0xe1 @ 1
[   14.140004] device class 'sas_host': registering
[   14.144883] device class 'sas_phy': registering
[   14.150213] device class 'sas_port': registering
[   14.155050] device class 'sas_device': registering
[   14.160231] device class 'sas_end_device': registering
[   14.165601] device class 'sas_expander': registering
[   14.170215] initcall sas_transport_init+0x0/0xe1 returned 0 after 29296 usecs
[   14.180005] calling  sas_class_init+0x0/0x58 @ 1
[   14.185105] initcall sas_class_init+0x0/0x58 returned 0 after 0 usecs
[   14.190004] calling  srp_transport_init+0x0/0x65 @ 1
[   14.194959] device class 'srp_host': registering
[   14.200216] device class 'srp_remote_ports': registering
[   14.205760] initcall srp_transport_init+0x0/0x65 returned 0 after 9765 usecs
[   14.210005] calling  libfc_init+0x0/0x96 @ 1
[   14.220974] initcall libfc_init+0x0/0x96 returned 0 after 9765 usecs
[   14.227325] calling  fcoe_init+0x0/0x1ab @ 1
[   14.230260] initcall fcoe_init+0x0/0x1ab returned 0 after 0 usecs
[   14.236345] calling  fnic_init_module+0x0/0x20d @ 1
[   14.240004] fnic: Cisco FCoE HBA Driver, ver 1.0.0.1121
[   14.246678] bus: 'pci': add driver fnic
[   14.250264] initcall fnic_init_module+0x0/0x20d returned 0 after 9765 usecs
[   14.260010] calling  BusLogic_init+0x0/0x1830 @ 1
[   14.264807] initcall BusLogic_init+0x0/0x1830 returned 0 after 0 usecs
[   14.270004] calling  adpt_init+0x0/0xe95 @ 1
[   14.274267] Loading Adaptec I2O RAID: Version 2.4 Build 5go
[   14.280002] Detecting Adaptec I2O RAID controllers...
[   14.285060] initcall adpt_init+0x0/0xe95 returned -19 after 9765 usecs
[   14.290006] calling  arcmsr_module_init+0x0/0x47 @ 1
[   14.294962] bus: 'pci': add driver arcmsr
[   14.300267] initcall arcmsr_module_init+0x0/0x47 returned 0 after 9765 usecs
[   14.307310] calling  ahc_linux_init+0x0/0x8d @ 1
[   14.310009] bus: 'pci': add driver aic7xxx
[   14.314401] initcall ahc_linux_init+0x0/0x8d returned 0 after 0 usecs
[   14.320004] calling  ahd_linux_init+0x0/0xa7 @ 1
[   14.324617] bus: 'pci': add driver aic79xx
[   14.330254] initcall ahd_linux_init+0x0/0xa7 returned 0 after 9765 usecs
[   14.340005] calling  aac_init+0x0/0x95 @ 1
[   14.344096] Adaptec aacraid driver 1.1-5[2461]-ms
[   14.348800] bus: 'pci': add driver aacraid
[   14.350259] initcall aac_init+0x0/0x95 returned 0 after 9765 usecs
[   14.360005] calling  init_this_scsi_driver+0x0/0x10c @ 1
[   14.365676] initcall init_this_scsi_driver+0x0/0x10c returned -19 after 0 usecs
[   14.370004] calling  ips_module_init+0x0/0x3b7 @ 1
[   14.374790] bus: 'pci': add driver ips
[   14.380260] bus: 'pci': remove driver ips
[   14.384468] driver: 'ips': driver_release
[   14.390009] initcall ips_module_init+0x0/0x3b7 returned -19 after 19531 usecs
[   14.397135] calling  init_this_scsi_driver+0x0/0x10c @ 1
[   14.400058] scsi: <fdomain> Detection failed (no card)
[   14.405188] initcall init_this_scsi_driver+0x0/0x10c returned -19 after 0 usecs
[   14.410004] calling  qla1280_init+0x0/0x42 @ 1
[   14.414443] bus: 'pci': add driver qla1280
[   14.420234] initcall qla1280_init+0x0/0x42 returned 0 after 9765 usecs
[   14.430028] calling  qla2x00_module_init+0x0/0x152 @ 1
[   14.435704] QLogic Fibre Channel HBA Driver: 8.03.01-k4
[   14.440005] bus: 'pci': add driver qla2xxx
[   14.444372] initcall qla2x00_module_init+0x0/0x152 returned 0 after 9765 usecs
[   14.450005] calling  dc395x_module_init+0x0/0x42 @ 1
[   14.454970] bus: 'pci': add driver dc395x
[   14.460235] initcall dc395x_module_init+0x0/0x42 returned 0 after 9765 usecs
[   14.467275] calling  dc390_module_init+0x0/0xbf @ 1
[   14.470003] DC390: clustering now enabled by default. If you get problems load
[   14.480002]        with "disable_clustering=1" and report to maintainers
[   14.486694] bus: 'pci': add driver tmscsim
[   14.490236] initcall dc390_module_init+0x0/0xbf returned 0 after 19531 usecs
[   14.497275] calling  mraid_mm_init+0x0/0xa7 @ 1
[   14.500004] megaraid cmm: 2.20.2.7 (Release Date: Sun Jul 16 00:01:03 EST 2006)
[   14.510010] device: 'megadev0': device_add
[   14.514341] initcall mraid_mm_init+0x0/0xa7 returned 0 after 9765 usecs
[   14.520008] calling  megaraid_init+0x0/0xbc @ 1
[   14.524538] megaraid: 2.20.5.1 (Release Date: Thu Nov 16 15:32:35 EST 2006)
[   14.530006] bus: 'pci': add driver megaraid
[   14.534429] initcall megaraid_init+0x0/0xbc returned 0 after 9765 usecs
[   14.540005] calling  megasas_init+0x0/0x180 @ 1
[   14.544528] megasas: 00.00.04.01 Thu July 24 11:41:51 PST 2008
[   14.550014] bus: 'pci': add driver megaraid_sas
[   14.554778] initcall megasas_init+0x0/0x180 returned 0 after 9765 usecs
[   14.560005] calling  _scsih_init+0x0/0x117 @ 1
[   14.570003] mpt2sas version 01.100.03.00 loaded
[   14.574556] device: 'mpt2ctl': device_add
[   14.578801] bus: 'pci': add driver mpt2sas
[   14.580275] initcall _scsih_init+0x0/0x117 returned 0 after 9765 usecs
[   14.590004] calling  inia100_init+0x0/0x42 @ 1
[   14.594442] bus: 'pci': add driver inia100
[   14.598768] initcall inia100_init+0x0/0x42 returned 0 after 0 usecs
[   14.600005] calling  tw_init+0x0/0x55 @ 1
[   14.604007] 3ware Storage Controller device driver for Linux v1.26.02.002.
[   14.610003] bus: 'pci': add driver 3w-xxxx
[   14.620234] initcall tw_init+0x0/0x55 returned 0 after 19531 usecs
[   14.626409] calling  twa_init+0x0/0x55 @ 1
[   14.630006] 3ware 9000 Storage Controller device driver for Linux v2.26.02.012.
[   14.637308] bus: 'pci': add driver 3w-9xxx
[   14.640235] initcall twa_init+0x0/0x55 returned 0 after 9765 usecs
[   14.646408] calling  ppa_driver_init+0x0/0x4c @ 1
[   14.650004] ppa: Version 2.07 (for Linux 2.4.x)
[   14.660401] initcall ppa_driver_init+0x0/0x4c returned 0 after 9765 usecs
[   14.667177] calling  ipr_init+0x0/0x5c @ 1
[   14.670003] ipr: IBM Power RAID SCSI Device Driver version: 2.4.3 (June 10, 2009)
[   14.677472] bus: 'pci': add driver ipr
[   14.680237] initcall ipr_init+0x0/0x5c returned 0 after 9765 usecs
[   14.686410] calling  hptiop_module_init+0x0/0x5c @ 1
[   14.690004] RocketRAID 3xxx/4xxx Controller driver v1.3 (071203)
[   14.696000] bus: 'pci': add driver hptiop
[   14.700247] initcall hptiop_module_init+0x0/0x5c returned 0 after 9765 usecs
[   14.710005] calling  stex_init+0x0/0x55 @ 1
[   14.714179] stex: Promise SuperTrak EX Driver version: 4.6.0000.3
[   14.720004] bus: 'pci': add driver stex
[   14.724070] initcall stex_init+0x0/0x55 returned 0 after 9765 usecs
[   14.730007] calling  mvs_init+0x0/0x79 @ 1
[   14.734124] bus: 'pci': add driver mvsas
[   14.740230] initcall mvs_init+0x0/0x79 returned 0 after 9765 usecs
[   14.746406] calling  cxgb3i_init_module+0x0/0x5d @ 1
[   14.750004] cxgb3i: tag itt 0x1fff, 13 bits, age 0xf, 4 bits.
[   14.755763] device: 'cxgb3i': device_add
[   14.760229] iscsi: registered transport (cxgb3i)
[   14.764858] initcall cxgb3i_init_module+0x0/0x5d returned 0 after 9765 usecs
[   14.770005] calling  init_sd+0x0/0x106 @ 1
[   14.774124] device class 'scsi_disk': registering
[   14.780221] bus: 'scsi': add driver sd
[   14.784214] initcall init_sd+0x0/0x106 returned 0 after 9765 usecs
[   14.790005] calling  init_sr+0x0/0x6f @ 1
[   14.794009] bus: 'scsi': add driver sr
[   14.800331] initcall init_sr+0x0/0x6f returned 0 after 9765 usecs
[   14.806414] calling  init_sg+0x0/0x170 @ 1
[   14.810006] device class 'scsi_generic': registering
[   14.815284] initcall init_sg+0x0/0x170 returned 0 after 0 usecs
[   14.820005] calling  ahci_init+0x0/0x42 @ 1
[   14.824184] bus: 'pci': add driver ahci
[   14.830024] initcall ahci_init+0x0/0x42 returned 0 after 9765 usecs
[   14.836285] calling  k2_sata_init+0x0/0x42 @ 1
[   14.840004] bus: 'pci': add driver sata_svw
[   14.844415] initcall k2_sata_init+0x0/0x42 returned 0 after 0 usecs
[   14.850005] calling  piix_init+0x0/0x50 @ 1
[   14.854183] bus: 'pci': add driver ata_piix
[   14.860179] initcall piix_init+0x0/0x50 returned 0 after 9765 usecs
[   14.866440] calling  pdc_ata_init+0x0/0x42 @ 1
[   14.870005] bus: 'pci': add driver sata_promise
[   14.874793] initcall pdc_ata_init+0x0/0x42 returned 0 after 0 usecs
[   14.880004] calling  qs_ata_init+0x0/0x42 @ 1
[   14.884357] bus: 'pci': add driver sata_qstor
[   14.890250] initcall qs_ata_init+0x0/0x42 returned 0 after 9765 usecs
[   14.896685] calling  sil_init+0x0/0x42 @ 1
[   14.900005] bus: 'pci': add driver sata_sil
[   14.904436] initcall sil_init+0x0/0x42 returned 0 after 0 usecs
[   14.910004] calling  sil24_init+0x0/0x42 @ 1
[   14.914267] bus: 'pci': add driver sata_sil24
[   14.920239] initcall sil24_init+0x0/0x42 returned 0 after 9765 usecs
[   14.926582] calling  svia_init+0x0/0x42 @ 1
[   14.930007] bus: 'pci': add driver sata_via
[   14.934454] initcall svia_init+0x0/0x42 returned 0 after 0 usecs
[   14.940004] calling  sis_init+0x0/0x42 @ 1
[   14.944097] bus: 'pci': add driver sata_sis
[   14.950230] initcall sis_init+0x0/0x42 returned 0 after 9765 usecs
[   14.956407] calling  pdc_sata_init+0x0/0x42 @ 1
[   14.960005] bus: 'pci': add driver sata_sx4
[   14.964447] initcall pdc_sata_init+0x0/0x42 returned 0 after 0 usecs
[   14.970004] calling  nv_init+0x0/0x42 @ 1
[   14.974010] bus: 'pci': add driver sata_nv
[   14.980309] initcall nv_init+0x0/0x42 returned 0 after 9765 usecs
[   14.986399] calling  uli_init+0x0/0x42 @ 1
[   14.990005] bus: 'pci': add driver sata_uli
[   14.994411] initcall uli_init+0x0/0x42 returned 0 after 0 usecs
[   15.000005] calling  mv_init+0x0/0x6e @ 1
[   15.004009] bus: 'pci': add driver sata_mv
[   15.008395] bus: 'platform': add driver sata_mv
[   15.010225] initcall mv_init+0x0/0x6e returned 0 after 9765 usecs
[   15.020005] calling  amd_init+0x0/0x42 @ 1
[   15.024096] bus: 'pci': add driver pata_amd
[   15.028292] bus: 'pci': driver_probe_device: matched device 0000:00:06.0 with driver pata_amd
[   15.030005] bus: 'pci': really_probe: probing driver pata_amd with device 0000:00:06.0
[   15.040115] pata_amd 0000:00:06.0: version 0.4.1
[   15.044825] pata_amd 0000:00:06.0: setting latency timer to 64
[   15.050275] scsi0 : pata_amd
[   15.054088] device: 'host0': device_add
[   15.060017] device: 'host0': device_add
[   15.064261] scsi1 : pata_amd
[   15.070009] device: 'host1': device_add
[   15.073859] device: 'host1': device_add
[   15.077990] ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xf000 irq 14
[   15.080004] ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xf008 irq 15
[   15.280546] ata1.00: ATA-6: HDS722525VLAT80, V36OA60A, max UDMA/100
[   15.286804] ata1.00: 488397168 sectors, multi 1: LBA48 
[   15.290044] ata1: nv_mode_filter: 0x3f39f&0x3f07f->0x3f01f, BIOS=0x3f000 (0xc60000c0) ACPI=0x0
[   15.370475] ata1.00: configured for UDMA/100
[   15.384754] async_waiting @ 1360
[   15.387981] async_continuing @ 1360 after 0 usec
[   15.390285] scsi 0:0:0:0: Direct-Access     ATA      HDS722525VLAT80  V36O PQ: 0 ANSI: 5
[   15.400009] device: 'target0:0:0': device_add
[   15.404376] device: '0:0:0:0': device_add
[   15.408436] bus: 'scsi': add device 0:0:0:0
[   15.410267] bus: 'scsi': driver_probe_device: matched device 0:0:0:0 with driver sd
[   15.420019] bus: 'scsi': really_probe: probing driver sd with device 0:0:0:0
[   15.427161] device: '0:0:0:0': device_add
[   15.430402] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[   15.440228] sd 0:0:0:0: [sda] Write Protect is off
[   15.445012] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   15.450106] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   15.459143] device: 'sda': device_add
[   15.460589]  sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 >
[   15.545548] device: 'sda1': device_add
[   15.549369] device: 'sda2': device_add
[   15.550125] device: 'sda3': device_add
[   15.553952] device: 'sda5': device_add
[   15.560067] device: 'sda6': device_add
[   15.563871] device: 'sda7': device_add
[   15.567682] device: 'sda8': device_add
[   15.570083] device: 'sda9': device_add
[   15.573891] device: 'sda10': device_add
[   15.582455] device: '8:0': device_add
[   15.586805] sd 0:0:0:0: [sda] Attached SCSI disk
[   15.590029] driver: '0:0:0:0': driver_bound: bound to device 'sd'
[   15.596113] bus: 'scsi': really_probe: bound device 0:0:0:0 to driver sd
[   15.600009] device: '0:0:0:0': device_add
[   15.604334] device: 'sg0': device_add
[   15.610381] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   15.615766] device: '0:0:0:0': device_add
[   15.620310] async_waiting @ 1360
[   15.623540] async_continuing @ 1360 after 0 usec
[   15.800299] ata2.01: ATAPI: DVDRW IDE 16X, VER A079, max UDMA/66
[   15.806323] ata2: nv_mode_filter: 0x1f39f&0x707f->0x701f, BIOS=0x7000 (0xc60000c0) ACPI=0x0
[   15.860251] ata2.01: configured for UDMA/33
[   15.875113] async_waiting @ 1360
[   15.878342] async_continuing @ 1360 after 0 usec
[   15.880431] scsi 1:0:1:0: CD-ROM            DVDRW    IDE 16X          A079 PQ: 0 ANSI: 5
[   15.890018] device: 'target1:0:1': device_add
[   15.894387] device: '1:0:1:0': device_add
[   15.898442] bus: 'scsi': add device 1:0:1:0
[   15.911921] bus: 'scsi': driver_probe_device: matched device 1:0:1:0 with driver sd
[   15.919566] bus: 'scsi': really_probe: probing driver sd with device 1:0:1:0
[   15.920033] bus: 'scsi': driver_probe_device: matched device 1:0:1:0 with driver sr
[   15.930005] bus: 'scsi': really_probe: probing driver sr with device 1:0:1:0
[   15.944171] sr0: scsi3-mmc drive: 1x/48x writer cd/rw xa/form2 cdda tray
[   15.950089] Uniform CD-ROM driver Revision: 3.20
[   15.954799] device: 'sr0': device_add
[   15.970664] device: '11:0': device_add
[   15.974976] sr 1:0:1:0: Attached scsi CD-ROM sr0
[   15.979590] driver: '1:0:1:0': driver_bound: bound to device 'sr'
[   15.980030] bus: 'scsi': really_probe: bound device 1:0:1:0 to driver sr
[   15.990008] device: '1:0:1:0': device_add
[   15.994476] device: 'sg1': device_add
[   16.011019] sr 1:0:1:0: Attached scsi generic sg1 type 5
[   16.016337] device: '1:0:1:0': device_add
[   16.032231] driver: '0000:00:06.0': driver_bound: bound to device 'pata_amd'
[   16.039304] bus: 'pci': really_probe: bound device 0000:00:06.0 to driver pata_amd
[   16.051101] initcall amd_init+0x0/0x42 returned 0 after 1005859 usecs
[   16.057540] calling  artop_init+0x0/0x42 @ 1
[   16.060030] bus: 'pci': add driver pata_artop
[   16.074802] initcall artop_init+0x0/0x42 returned 0 after 9765 usecs
[   16.080011] calling  cmd640_init+0x0/0x42 @ 1
[   16.084365] bus: 'pci': add driver pata_cmd640
[   16.092518] initcall cmd640_init+0x0/0x42 returned 0 after 9765 usecs
[   16.098955] calling  cmd64x_init+0x0/0x42 @ 1
[   16.100009] bus: 'pci': add driver pata_cmd64x
[   16.114910] initcall cmd64x_init+0x0/0x42 returned 0 after 9765 usecs
[   16.120008] calling  cs5520_init+0x0/0x42 @ 1
[   16.124366] bus: 'pci': add driver pata_cs5520
[   16.141108] initcall cs5520_init+0x0/0x42 returned 0 after 19531 usecs
[   16.147629] calling  cy82c693_init+0x0/0x42 @ 1
[   16.150030] bus: 'pci': add driver pata_cypress
[   16.165147] initcall cy82c693_init+0x0/0x42 returned 0 after 9765 usecs
[   16.170007] calling  hpt36x_init+0x0/0x42 @ 1
[   16.174365] bus: 'pci': add driver pata_hpt366
[   16.190432] initcall hpt36x_init+0x0/0x42 returned 0 after 19531 usecs
[   16.196952] calling  hpt37x_init+0x0/0x42 @ 1
[   16.200007] bus: 'pci': add driver pata_hpt37x
[   16.215004] initcall hpt37x_init+0x0/0x42 returned 0 after 9765 usecs
[   16.220007] calling  hpt3x3_init+0x0/0x42 @ 1
[   16.224365] bus: 'pci': add driver pata_hpt3x3
[   16.242184] initcall hpt3x3_init+0x0/0x42 returned 0 after 19531 usecs
[   16.248706] calling  it8213_init+0x0/0x42 @ 1
[   16.250013] bus: 'pci': add driver pata_it8213
[   16.264853] initcall it8213_init+0x0/0x42 returned 0 after 9765 usecs
[   16.270010] calling  jmicron_init+0x0/0x42 @ 1
[   16.274453] bus: 'pci': add driver pata_jmicron
[   16.291973] initcall jmicron_init+0x0/0x42 returned 0 after 19531 usecs
[   16.298583] calling  ninja32_init+0x0/0x42 @ 1
[   16.300008] bus: 'pci': add driver pata_ninja32
[   16.314946] initcall ninja32_init+0x0/0x42 returned 0 after 9765 usecs
[   16.320012] calling  ns87410_init+0x0/0x42 @ 1
[   16.324451] bus: 'pci': add driver pata_ns87410
[   16.340961] initcall ns87410_init+0x0/0x42 returned 0 after 19531 usecs
[   16.347564] calling  ns87415_init+0x0/0x42 @ 1
[   16.350013] bus: 'pci': add driver pata_ns87415
[   16.364940] initcall ns87415_init+0x0/0x42 returned 0 after 9765 usecs
[   16.370008] calling  opti_init+0x0/0x42 @ 1
[   16.374194] bus: 'pci': add driver pata_opti
[   16.390368] initcall opti_init+0x0/0x42 returned 0 after 19531 usecs
[   16.396714] calling  optidma_init+0x0/0x42 @ 1
[   16.400009] bus: 'pci': add driver pata_optidma
[   16.415069] initcall optidma_init+0x0/0x42 returned 0 after 9765 usecs
[   16.420029] calling  marvell_init+0x0/0x42 @ 1
[   16.424471] bus: 'pci': add driver pata_marvell
[   16.441598] initcall marvell_init+0x0/0x42 returned 0 after 19531 usecs
[   16.448200] calling  mpiix_init+0x0/0x42 @ 1
[   16.450008] bus: 'pci': add driver pata_mpiix
[   16.464783] initcall mpiix_init+0x0/0x42 returned 0 after 9765 usecs
[   16.470007] calling  oldpiix_init+0x0/0x42 @ 1
[   16.474451] bus: 'pci': add driver pata_oldpiix
[   16.490954] initcall oldpiix_init+0x0/0x42 returned 0 after 19531 usecs
[   16.497558] calling  pdc2027x_init+0x0/0x42 @ 1
[   16.500008] bus: 'pci': add driver pata_pdc2027x
[   16.515026] initcall pdc2027x_init+0x0/0x42 returned 0 after 9765 usecs
[   16.520029] calling  pdc202xx_init+0x0/0x42 @ 1
[   16.524558] bus: 'pci': add driver pata_pdc202xx_old
[   16.540625] initcall pdc202xx_init+0x0/0x42 returned 0 after 19531 usecs
[   16.547322] calling  sc1200_init+0x0/0x42 @ 1
[   16.550012] bus: 'pci': add driver sc1200
[   16.564438] initcall sc1200_init+0x0/0x42 returned 0 after 9765 usecs
[   16.570013] calling  serverworks_init+0x0/0x42 @ 1
[   16.574799] bus: 'pci': add driver pata_serverworks
[   16.590974] initcall serverworks_init+0x0/0x42 returned 0 after 19531 usecs
[   16.597924] calling  via_init+0x0/0x42 @ 1
[   16.600009] bus: 'pci': add driver pata_via
[   16.614600] initcall via_init+0x0/0x42 returned 0 after 9765 usecs
[   16.620029] calling  sl82c105_init+0x0/0x42 @ 1
[   16.624556] bus: 'pci': add driver pata_sl82c105
[   16.641839] initcall sl82c105_init+0x0/0x42 returned 0 after 19531 usecs
[   16.648529] calling  sis_init+0x0/0x42 @ 1
[   16.650009] bus: 'pci': add driver pata_sis
[   16.664603] initcall sis_init+0x0/0x42 returned 0 after 9765 usecs
[   16.670008] calling  triflex_init+0x0/0x42 @ 1
[   16.674452] bus: 'pci': add driver pata_triflex
[   16.689405] initcall triflex_init+0x0/0x42 returned 0 after 9765 usecs
[   16.690012] calling  sch_init+0x0/0x42 @ 1
[   16.700005] bus: 'pci': add driver pata_sch
[   16.714591] initcall sch_init+0x0/0x42 returned 0 after 9765 usecs
[   16.720012] calling  pata_platform_init+0x0/0x39 @ 1
[   16.724971] bus: 'platform': add driver pata_platform
[   16.741084] initcall pata_platform_init+0x0/0x39 returned 0 after 19531 usecs
[   16.748211] calling  e1000_init_module+0x0/0xab @ 1
[   16.750006] Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
[   16.756442] Copyright (c) 1999-2006 Intel Corporation.
[   16.760005] bus: 'pci': add driver e1000
[   16.774336] initcall e1000_init_module+0x0/0xab returned 0 after 19531 usecs
[   16.780008] calling  e1000_init_module+0x0/0x8f @ 1
[   16.784883] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
[   16.790003] e1000e: Copyright (c) 1999-2008 Intel Corporation.
[   16.795831] bus: 'pci': add driver e1000e
[   16.810833] initcall e1000_init_module+0x0/0x8f returned 0 after 29296 usecs
[   16.817873] calling  igb_init_module+0x0/0x7b @ 1
[   16.820009] Intel(R) Gigabit Ethernet Network Driver - version 1.3.16-k2
[   16.826701] Copyright (c) 2007-2009 Intel Corporation.
[   16.830009] bus: 'pci': add driver igb
[   16.844353] initcall igb_init_module+0x0/0x7b returned 0 after 19531 usecs
[   16.850006] calling  ixgbe_init_module+0x0/0x7f @ 1
[   16.854881] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 2.0.34-k2
[   16.860003] ixgbe: Copyright (c) 1999-2009 Intel Corporation.
[   16.865743] bus: 'pci': add driver ixgbe
[   16.883031] initcall ixgbe_init_module+0x0/0x7f returned 0 after 29296 usecs
[   16.890011] calling  ixgb_init_module+0x0/0x71 @ 1
[   16.894796] Intel(R) PRO/10GbE Network Driver - version 1.0.135-k2-NAPI
[   16.900002] Copyright (c) 1999-2008 Intel Corporation.
[   16.905138] bus: 'pci': add driver ixgb
[   16.921260] initcall ixgb_init_module+0x0/0x71 returned 0 after 29296 usecs
[   16.928214] calling  t1_init_module+0x0/0x42 @ 1
[   16.930009] bus: 'pci': add driver cxgb
[   16.944492] initcall t1_init_module+0x0/0x42 returned 0 after 9765 usecs
[   16.950006] calling  cxgb3_init_module+0x0/0x47 @ 1
[   16.954886] bus: 'pci': add driver cxgb3
[   16.970473] initcall cxgb3_init_module+0x0/0x47 returned 0 after 19531 usecs
[   16.977510] calling  vcan_init_module+0x0/0x5c @ 1
[   16.980008] vcan: Virtual CAN interface driver
[   16.984454] initcall vcan_init_module+0x0/0x5c returned 0 after 0 usecs
[   16.990004] calling  can_dev_init+0x0/0x55 @ 1
[   16.994443] CAN device driver interface
[   17.000004] initcall can_dev_init+0x0/0x55 returned 0 after 9765 usecs
[   17.006522] calling  atl1_init_module+0x0/0x42 @ 1
[   17.010027] bus: 'pci': add driver atl1
[   17.024333] initcall atl1_init_module+0x0/0x42 returned 0 after 9765 usecs
[   17.030013] calling  atl2_init_module+0x0/0x71 @ 1
[   17.034798] Atheros(R) L2 Ethernet Driver - version 2.2.3
[   17.040009] Copyright (c) 2007 Atheros Corporation.
[   17.044884] bus: 'pci': add driver atl2
[   17.061098] initcall atl2_init_module+0x0/0x71 returned 0 after 29296 usecs
[   17.068049] calling  atl1e_init_module+0x0/0x42 @ 1
[   17.070005] bus: 'pci': add driver ATL1E
[   17.084518] initcall atl1e_init_module+0x0/0x42 returned 0 after 9765 usecs
[   17.090008] calling  bdx_module_init+0x0/0xb0 @ 1
[   17.094709] tehuti: Tehuti Networks(R) Network Driver, 7.29.3
[   17.100002] tehuti: Options: hw_csum 
[   17.103663] bus: 'pci': add driver tehuti
[   17.118811] initcall bdx_module_init+0x0/0xb0 returned 0 after 19531 usecs
[   17.120004] calling  enic_init_module+0x0/0x5c @ 1
[   17.130005] enic: Cisco 10G Ethernet Driver, ver 1.0.0.933
[   17.135484] bus: 'pci': add driver enic
[   17.149900] initcall enic_init_module+0x0/0x5c returned 0 after 9765 usecs
[   17.150027] calling  plip_init+0x0/0x84 @ 1
[   17.160024] plip: parport0 has no IRQ. Using IRQ-less mode,which is fairly inefficient!
[   17.168031] device: 'plip0': device_add
[   17.182739] NET3 PLIP version 2.4-parport gniibe@mri.co.jp
[   17.188218] plip0: Parallel port at 0x378, not using IRQ.
[   17.190006] initcall plip_init+0x0/0x84 returned 0 after 29296 usecs
[   17.196348] calling  happy_meal_probe+0x0/0x42 @ 1
[   17.200006] bus: 'pci': add driver hme
[   17.214277] initcall happy_meal_probe+0x0/0x42 returned 0 after 9765 usecs
[   17.220008] calling  gem_init+0x0/0x42 @ 1
[   17.224104] bus: 'pci': add driver gem
[   17.238427] initcall gem_init+0x0/0x42 returned 0 after 9765 usecs
[   17.240009] calling  cas_init+0x0/0x61 @ 1
[   17.244106] bus: 'pci': add driver cassini
[   17.261348] initcall cas_init+0x0/0x61 returned 0 after 19531 usecs
[   17.267604] calling  vortex_init+0x0/0xd8 @ 1
[   17.270010] bus: 'pci': add driver 3c59x
[   17.284526] initcall vortex_init+0x0/0xd8 returned 0 after 9765 usecs
[   17.290026] calling  typhoon_init+0x0/0x42 @ 1
[   17.294470] bus: 'pci': add driver typhoon
[   17.309213] initcall typhoon_init+0x0/0x42 returned 0 after 9765 usecs
[   17.310004] calling  ne2k_pci_init+0x0/0x42 @ 1
[   17.320005] bus: 'pci': add driver ne2k-pci
[   17.334753] initcall ne2k_pci_init+0x0/0x42 returned 0 after 9765 usecs
[   17.340004] calling  pcnet32_init_module+0x0/0x154 @ 1
[   17.345135] pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de
[   17.350008] bus: 'pci': add driver pcnet32
[   17.364651] initcall pcnet32_init_module+0x0/0x154 returned 0 after 19531 usecs
[   17.370004] calling  e100_init_module+0x0/0x81 @ 1
[   17.374787] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[   17.380006] e100: Copyright(c) 1999-2006 Intel Corporation
[   17.385485] bus: 'pci': add driver e100
[   17.401336] initcall e100_init_module+0x0/0x81 returned 0 after 29296 usecs
[   17.408290] calling  tlan_probe+0x0/0x108 @ 1
[   17.410006] ThunderLAN driver v1.15a
[   17.413577] bus: 'pci': add driver tlan
[   17.430938] TLAN: 0 devices installed, PCI: 0  EISA: 0
[   17.436101] bus: 'pci': remove driver tlan
[   17.451223] driver: 'tlan': driver_release
[   17.455321] initcall tlan_probe+0x0/0x108 returned -19 after 39062 usecs
[   17.460004] calling  smsc9420_init_module+0x0/0x64 @ 1
[   17.465137] bus: 'pci': add driver smsc9420
[   17.481487] initcall smsc9420_init_module+0x0/0x64 returned 0 after 19531 usecs
[   17.488791] calling  sis190_init_module+0x0/0x42 @ 1
[   17.490011] bus: 'pci': add driver sis190
[   17.504715] initcall sis190_init_module+0x0/0x42 returned 0 after 9765 usecs
[   17.510008] calling  r6040_init+0x0/0x42 @ 1
[   17.514278] bus: 'pci': add driver r6040
[   17.530686] initcall r6040_init+0x0/0x42 returned 0 after 19531 usecs
[   17.537117] calling  yellowfin_init+0x0/0x42 @ 1
[   17.540006] bus: 'pci': add driver yellowfin
[   17.555044] initcall yellowfin_init+0x0/0x42 returned 0 after 9765 usecs
[   17.560026] calling  acenic_init+0x0/0x42 @ 1
[   17.564384] bus: 'pci': add driver acenic
[   17.581320] initcall acenic_init+0x0/0x42 returned 0 after 19531 usecs
[   17.587843] calling  ns83820_init+0x0/0x4e @ 1
[   17.590003] ns83820.c: National Semiconductor DP83820 10/100/1000 driver.
[   17.596782] bus: 'pci': add driver ns83820
[   17.612402] initcall ns83820_init+0x0/0x4e returned 0 after 19531 usecs
[   17.619007] calling  fealnx_init+0x0/0x42 @ 1
[   17.620010] bus: 'pci': add driver fealnx
[   17.634614] initcall fealnx_init+0x0/0x42 returned 0 after 9765 usecs
[   17.640009] calling  tg3_init+0x0/0x42 @ 1
[   17.644106] bus: 'pci': add driver tg3
[   17.658455] initcall tg3_init+0x0/0x42 returned 0 after 9765 usecs
[   17.660005] calling  bnx2x_init+0x0/0xa8 @ 1
[   17.664387] bus: 'pci': add driver bnx2x
[   17.670272] initcall bnx2x_init+0x0/0xa8 returned 0 after 9765 usecs
[   17.676616] calling  skge_init_module+0x0/0x42 @ 1
[   17.680029] bus: 'pci': add driver skge
[   17.694662] initcall skge_init_module+0x0/0x42 returned 0 after 9765 usecs
[   17.700022] calling  sky2_init_module+0x0/0x4e @ 1
[   17.704805] sky2 driver version 1.23
[   17.708383] bus: 'pci': add driver sky2
[   17.720697] initcall sky2_init_module+0x0/0x4e returned 0 after 19531 usecs
[   17.727652] calling  ks8851_init+0x0/0x39 @ 1
[   17.730010] bus: 'spi': add driver ks8851
[   17.744456] initcall ks8851_init+0x0/0x39 returned 0 after 9765 usecs
[   17.750026] calling  rhine_init+0x0/0x5e @ 1
[   17.754296] bus: 'pci': add driver via-rhine
[   17.769167] initcall rhine_init+0x0/0x5e returned 0 after 9765 usecs
[   17.770005] calling  velocity_init_module+0x0/0x42 @ 1
[   17.780005] bus: 'pci': add driver via-velocity
[   17.795092] initcall velocity_init_module+0x0/0x42 returned 0 after 9765 usecs
[   17.800004] calling  starfire_init+0x0/0x42 @ 1
[   17.804531] bus: 'pci': add driver starfire
[   17.820968] initcall starfire_init+0x0/0x42 returned 0 after 19531 usecs
[   17.827663] calling  marvell_init+0x0/0x84 @ 1
[   17.830029] bus: 'mdio_bus': add driver Marvell 88E1101
[   17.845786] bus: 'mdio_bus': add driver Marvell 88E1112
[   17.861869] bus: 'mdio_bus': add driver Marvell 88E1111
[   17.867310] bus: 'mdio_bus': add driver Marvell 88E1118
[   17.881776] bus: 'mdio_bus': add driver Marvell 88E1121R
[   17.887311] bus: 'mdio_bus': add driver Marvell 88E1145
[   17.900786] bus: 'mdio_bus': add driver Marvell 88E1240
[   17.906235] initcall marvell_init+0x0/0x84 returned 0 after 68359 usecs
[   17.910024] calling  davicom_init+0x0/0x83 @ 1
[   17.914466] bus: 'mdio_bus': add driver Davicom DM9161E
[   17.930745] bus: 'mdio_bus': add driver Davicom DM9161A
[   17.936187] bus: 'mdio_bus': add driver Davicom DM9131
[   17.951200] initcall davicom_init+0x0/0x83 returned 0 after 39062 usecs
[   17.957808] calling  cicada_init+0x0/0x65 @ 1
[   17.960025] bus: 'mdio_bus': add driver Cicada Cis8204
[   17.975550] bus: 'mdio_bus': add driver Cicada Cis8201
[   17.990396] initcall cicada_init+0x0/0x65 returned 0 after 29296 usecs
[   17.996914] calling  qs6612_init+0x0/0x39 @ 1
[   18.000004] bus: 'mdio_bus': add driver QS6612
[   18.014841] initcall qs6612_init+0x0/0x39 returned 0 after 9765 usecs
[   18.020005] calling  smsc_init+0x0/0xbf @ 1
[   18.024183] bus: 'mdio_bus': add driver SMSC LAN83C185
[   18.041405] bus: 'mdio_bus': add driver SMSC LAN8187
[   18.046626] bus: 'mdio_bus': add driver SMSC LAN8700
[   18.060595] bus: 'mdio_bus': add driver SMSC LAN911x Internal PHY
[   18.066896] bus: 'mdio_bus': add driver SMSC LAN8710/LAN8720
[   18.081363] initcall smsc_init+0x0/0xbf returned 0 after 58593 usecs
[   18.087711] calling  vsc82xx_init+0x0/0x65 @ 1
[   18.090021] bus: 'mdio_bus': add driver Vitesse VSC8244
[   18.105657] bus: 'mdio_bus': add driver Vitesse VSC8221
[   18.120475] initcall vsc82xx_init+0x0/0x65 returned 0 after 29296 usecs
[   18.127085] calling  broadcom_init+0x0/0x125 @ 1
[   18.130010] bus: 'mdio_bus': add driver Broadcom BCM5411
[   18.145697] bus: 'mdio_bus': add driver Broadcom BCM5421
[   18.160543] bus: 'mdio_bus': add driver Broadcom BCM5461
[   18.166075] bus: 'mdio_bus': add driver Broadcom BCM5464
[   18.181715] bus: 'mdio_bus': add driver Broadcom BCM5481
[   18.187258] bus: 'mdio_bus': add driver Broadcom BCM5482
[   18.201082] bus: 'mdio_bus': add driver Broadcom BCM50610
[   18.206698] bus: 'mdio_bus': add driver Broadcom BCM57780
[   18.221151] initcall broadcom_init+0x0/0x125 returned 0 after 87890 usecs
[   18.227927] calling  ip175c_init+0x0/0x39 @ 1
[   18.230023] bus: 'mdio_bus': add driver ICPlus IP175C
[   18.245650] initcall ip175c_init+0x0/0x39 returned 0 after 9765 usecs
[   18.250026] calling  et1011c_init+0x0/0x39 @ 1
[   18.254468] bus: 'mdio_bus': add driver ET1011C
[   18.271408] initcall et1011c_init+0x0/0x39 returned 0 after 19531 usecs
[   18.278019] calling  fixed_mdio_bus_init+0x0/0xf6 @ 1
[   18.280009] Registering platform device 'Fixed MDIO bus.0'. Parent at platform
[   18.290005] device: 'Fixed MDIO bus.0': device_add
[   18.294798] bus: 'platform': add device Fixed MDIO bus.0
[   18.311411] device: '0': device_add
[   18.315178] Fixed MDIO Bus: probed
[   18.318580] initcall fixed_mdio_bus_init+0x0/0xf6 returned 0 after 29296 usecs
[   18.320032] calling  ns_init+0x0/0x39 @ 1
[   18.324043] bus: 'mdio_bus': add driver NatSemi DP83865
[   18.341561] initcall ns_init+0x0/0x39 returned 0 after 19531 usecs
[   18.347733] calling  ste10Xp_init+0x0/0x49 @ 1
[   18.350023] bus: 'mdio_bus': add driver STe100p
[   18.364935] bus: 'mdio_bus': add driver STe101p
[   18.369677] initcall ste10Xp_init+0x0/0x49 returned 0 after 9765 usecs
[   18.370027] calling  sundance_init+0x0/0x42 @ 1
[   18.380011] bus: 'pci': add driver sundance
[   18.394811] initcall sundance_init+0x0/0x42 returned 0 after 9765 usecs
[   18.400022] calling  hamachi_init+0x0/0x42 @ 1
[   18.404462] bus: 'pci': add driver hamachi
[   18.410236] initcall hamachi_init+0x0/0x42 returned 0 after 9765 usecs
[   18.416754] calling  net_olddevs_init+0x0/0xc7 @ 1
[   18.420040] D-Link DE-620 pocket adapter io 0x378, which is busy.
[   18.426159] initcall net_olddevs_init+0x0/0xc7 returned 0 after 0 usecs
[   18.430011] calling  hp100_module_init+0x0/0x42 @ 1
[   18.434888] bus: 'pci': add driver hp100
[   18.450854] initcall hp100_module_init+0x0/0x42 returned 0 after 19531 usecs
[   18.457894] calling  b44_init+0x0/0x89 @ 1
[   18.460030] bus: 'pci': add driver b44
[   18.474362] bus: 'ssb': add driver b44
[   18.478337] initcall b44_init+0x0/0x89 returned 0 after 9765 usecs
[   18.480027] calling  init_nic+0x0/0x42 @ 1
[   18.484123] bus: 'pci': add driver forcedeth
[   18.490024] bus: 'pci': driver_probe_device: matched device 0000:00:0a.0 with driver forcedeth
[   18.500003] bus: 'pci': really_probe: probing driver forcedeth with device 0000:00:0a.0
[   18.508124] forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
[   18.510134] IOAPIC[0]: Set routing entry (2-11 -> 0x3b -> IRQ 11 Mode:1 Active:1)
[   18.520009] forcedeth 0000:00:0a.0: PCI->APIC IRQ transform: INT A -> IRQ 11
[   18.530008] forcedeth 0000:00:0a.0: setting latency timer to 64
[   18.535986] nv_probe: set workaround bit for reversed mac addr
[   19.070247] device: 'eth0': device_add
[   19.075056] forcedeth 0000:00:0a.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 00:13:d4:dc:41:12
[   19.080031] forcedeth 0000:00:0a.0: highdma csum gbit lnktim desc-v3
[   19.086409] driver: '0000:00:0a.0': driver_bound: bound to device 'forcedeth'
[   19.090071] bus: 'pci': really_probe: bound device 0000:00:0a.0 to driver forcedeth
[   19.110984] initcall init_nic+0x0/0x42 returned 0 after 615234 usecs
[   19.117330] calling  ql3xxx_init_module+0x0/0x42 @ 1
[   19.120037] bus: 'pci': add driver qla3xxx
[   19.134597] initcall ql3xxx_init_module+0x0/0x42 returned 0 after 9765 usecs
[   19.140022] calling  qlge_init_module+0x0/0x42 @ 1
[   19.144809] bus: 'pci': add driver qlge
[   19.162653] initcall qlge_init_module+0x0/0x42 returned 0 after 19531 usecs
[   19.169606] calling  ppp_init+0x0/0x104 @ 1
[   19.170002] PPP generic driver version 2.4.2
[   19.174346] device class 'ppp': registering
[   19.190604] device: 'ppp': device_add
[   19.194545] initcall ppp_init+0x0/0x104 returned 0 after 19531 usecs
[   19.200028] calling  ppp_sync_init+0x0/0x5c @ 1
[   19.204555] initcall ppp_sync_init+0x0/0x5c returned 0 after 0 usecs
[   19.210008] calling  deflate_init+0x0/0x61 @ 1
[   19.214463] PPP Deflate Compression module registered
[   19.220006] initcall deflate_init+0x0/0x61 returned 0 after 9765 usecs
[   19.226521] calling  bsdcomp_init+0x0/0x55 @ 1
[   19.230006] PPP BSD Compression module registered
[   19.234704] initcall bsdcomp_init+0x0/0x55 returned 0 after 0 usecs
[   19.240020] calling  ppp_mppe_init+0x0/0x10d @ 1
[   19.255352] PPP MPPE Compression module registered
[   19.260025] initcall ppp_mppe_init+0x0/0x10d returned 0 after 19531 usecs
[   19.266808] calling  pppox_init+0x0/0x39 @ 1
[   19.270003] NET: Registered protocol family 24
[   19.274443] initcall pppox_init+0x0/0x39 returned 0 after 0 usecs
[   19.280004] calling  pppoe_init+0x0/0xaf @ 1
[   19.284295] initcall pppoe_init+0x0/0xaf returned 0 after 0 usecs
[   19.290004] calling  pppol2tp_init+0x0/0xa8 @ 1
[   19.294540] PPPoL2TP kernel driver, V1.0
[   19.300020] initcall pppol2tp_init+0x0/0xa8 returned 0 after 9765 usecs
[   19.306624] calling  slip_init+0x0/0xe6 @ 1
[   19.310003] SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256) (6 bit encapsulation enabled).
[   19.320002] CSLIP: code copyright 1989 Regents of the University of California.
[   19.327299] SLIP linefill/keepalive option.
[   19.330057] initcall slip_init+0x0/0xe6 returned 0 after 19531 usecs
[   19.336401] calling  macvlan_init_module+0x0/0x79 @ 1
[   19.340022] initcall macvlan_init_module+0x0/0x79 returned 0 after 0 usecs
[   19.350004] calling  de600_init+0x0/0x2f2 @ 1
[   19.354370] DE600: port 0x378 busy
[   19.357776] initcall de600_init+0x0/0x2f2 returned -16 after 0 usecs
[   19.360004] initcall de600_init+0x0/0x2f2 returned with error code -16 
[   19.370008] calling  cp_init+0x0/0x42 @ 1
[   19.374025] bus: 'pci': add driver 8139cp
[   19.378069] bus: 'pci': driver_probe_device: matched device 0000:05:07.0 with driver 8139cp
[   19.380018] bus: 'pci': really_probe: probing driver 8139cp with device 0000:05:07.0
[   19.390120] <6>8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
[   19.400026] 8139cp 0000:05:07.0: This (id 10ec:8139 rev 10) is not an 8139C+ compatible chip, use 8139too
[   19.410302] initcall cp_init+0x0/0x42 returned 0 after 39062 usecs
[   19.416479] calling  rtl8139_init_module+0x0/0x42 @ 1
[   19.420028] bus: 'pci': add driver 8139too
[   19.424147] bus: 'pci': driver_probe_device: matched device 0000:05:07.0 with driver 8139too
[   19.430006] bus: 'pci': really_probe: probing driver 8139too with device 0000:05:07.0
[   19.440102] 8139too Fast Ethernet driver 0.9.28
[   19.444662] 8139too 0000:05:07.0: PCI->APIC IRQ transform: INT A -> IRQ 11
[   19.450412] device: 'eth1': device_add
[   19.460574] eth1: RealTek RTL8139 at 0xc000, 00:c0:df:03:68:5d, IRQ 11
[   19.467124] driver: '0000:05:07.0': driver_bound: bound to device '8139too'
[   19.470071] bus: 'pci': really_probe: bound device 0000:05:07.0 to driver 8139too
[   19.491790] initcall rtl8139_init_module+0x0/0x42 returned 0 after 68359 usecs
[   19.499002] calling  atp_init_module+0x0/0xbf @ 1
[   19.500030] atp.c:v1.09=ac 2002/10/01 Donald Becker <becker@scyld.com>
[   19.510035] initcall atp_init_module+0x0/0xbf returned -19 after 9765 usecs
[   19.516988] calling  sc92031_init+0x0/0x42 @ 1
[   19.520009] bus: 'pci': add driver sc92031
[   19.534723] initcall sc92031_init+0x0/0x42 returned 0 after 9765 usecs
[   19.540022] calling  eql_init_module+0x0/0x89 @ 1
[   19.544718] Equalizer2002: Simon Janes (simon@ncm.com) and David S. Miller (davem@redhat.com)
[   19.550021] device: 'eql': device_add
[   19.564971] initcall eql_init_module+0x0/0x89 returned 0 after 19531 usecs
[   19.570004] calling  tun_init+0x0/0xb7 @ 1
[   19.574094] tun: Universal TUN/TAP device driver, 1.6
[   19.580003] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[   19.586182] device: 'tun': device_add
[   19.601596] initcall tun_init+0x0/0xb7 returned 0 after 29296 usecs
[   19.607855] calling  veth_init+0x0/0x39 @ 1
[   19.610008] initcall veth_init+0x0/0x39 returned 0 after 0 usecs
[   19.616011] calling  rio_init+0x0/0x42 @ 1
[   19.620007] bus: 'pci': add driver dl2k
[   19.634361] initcall rio_init+0x0/0x42 returned 0 after 9765 usecs
[   19.640005] calling  rtl8169_init_module+0x0/0x42 @ 1
[   19.645051] bus: 'pci': add driver r8169
[   19.659473] initcall rtl8169_init_module+0x0/0x42 returned 0 after 9765 usecs
[   19.660004] calling  amd8111e_init+0x0/0x42 @ 1
[   19.670006] bus: 'pci': add driver amd8111e
[   19.684813] initcall amd8111e_init+0x0/0x42 returned 0 after 9765 usecs
[   19.690004] calling  myri10ge_init_module+0x0/0x99 @ 1
[   19.695135] myri10ge: Version 1.5.0-1.418
[   19.700006] bus: 'pci': add driver myri10ge
[   19.714774] initcall myri10ge_init_module+0x0/0x99 returned 0 after 19531 usecs
[   19.720010] calling  mlx4_init+0x0/0xcb @ 1
[   19.725249] bus: 'pci': add driver mlx4_core
[   19.742084] initcall mlx4_init+0x0/0xcb returned 0 after 19531 usecs
[   19.748434] calling  mlx4_en_init+0x0/0x39 @ 1
[   19.750045] initcall mlx4_en_init+0x0/0x39 returned 0 after 0 usecs
[   19.756304] calling  enc28j60_init+0x0/0x4a @ 1
[   19.760005] bus: 'spi': add driver enc28j60
[   19.774953] initcall enc28j60_init+0x0/0x4a returned 0 after 9765 usecs
[   19.780004] calling  ethoc_init+0x0/0x39 @ 1
[   19.784270] bus: 'platform': add driver ethoc
[   19.800902] initcall ethoc_init+0x0/0x39 returned 0 after 19531 usecs
[   19.807333] calling  dnet_init+0x0/0x39 @ 1
[   19.810004] bus: 'platform': add driver dnet
[   19.824913] initcall dnet_init+0x0/0x39 returned 0 after 9765 usecs
[   19.830010] calling  hdlc_module_init+0x0/0x66 @ 1
[   19.834795] HDLC support module revision 1.22
[   19.840009] initcall hdlc_module_init+0x0/0x66 returned 0 after 9765 usecs
[   19.846874] calling  mod_init+0x0/0x3b @ 1
[   19.850005] initcall mod_init+0x0/0x3b returned 0 after 0 usecs
[   19.855916] calling  mod_init+0x0/0x3b @ 1
[   19.860005] initcall mod_init+0x0/0x3b returned 0 after 0 usecs
[   19.865914] calling  mod_init+0x0/0x3b @ 1
[   19.870027] initcall mod_init+0x0/0x3b returned 0 after 0 usecs
[   19.875941] calling  fst_init+0x0/0x76 @ 1
[   19.880008] bus: 'pci': add driver fst
[   19.894429] initcall fst_init+0x0/0x76 returned 0 after 9765 usecs
[   19.900005] calling  pci200_init_module+0x0/0x69 @ 1
[   19.904970] bus: 'pci': add driver PCI200SYN
[   19.921761] initcall pci200_init_module+0x0/0x69 returned 0 after 19531 usecs
[   19.928890] calling  pc300_init_module+0x0/0x8c @ 1
[   19.930014] bus: 'pci': add driver PC300
[   19.944445] initcall pc300_init_module+0x0/0x8c returned 0 after 9765 usecs
[   19.950008] calling  arcnet_init+0x0/0x84 @ 1
[   19.954364] arcnet loaded.
[   19.957074] initcall arcnet_init+0x0/0x84 returned 0 after 0 usecs
[   19.960003] calling  arcnet_rfc1201_init+0x0/0x98 @ 1
[   19.965047] arcnet: RFC1201 "standard" (`a') encapsulation support loaded.
[   19.970003] initcall arcnet_rfc1201_init+0x0/0x98 returned 0 after 9765 usecs
[   19.980003] calling  arcnet_raw_init+0x0/0x80 @ 1
[   19.984700] arcnet: raw mode (`r') encapsulation support loaded.
[   19.990026] initcall arcnet_raw_init+0x0/0x80 returned 0 after 9765 usecs
[   20.000003] calling  com90io_init+0x0/0x4d4 @ 1
[   20.004567] arcnet: COM90xx IO-mapped mode support (by David Woodhouse et el.)
[   20.010002] E-mail me if you actually test this driver, please!
[   20.015913]  arc%d: No autoprobe for IO mapped cards; you must specify the base address!
[   20.020023] initcall com90io_init+0x0/0x4d4 returned -19 after 19531 usecs
[   20.030021] calling  arc_rimi_init+0x0/0x4f2 @ 1
[   20.034666] arcnet: RIM I (entirely mem-mapped) support
[   20.040011] E-mail me if you actually test the RIM I driver, please!
[   20.050003]  arc%d: Given: node 00h, shmem 0h, irq 0
[   20.054962]  arc%d: No autoprobe for RIM I; you must specify the shmem and irq!
[   20.060022] initcall arc_rimi_init+0x0/0x4f2 returned -5 after 29296 usecs
[   20.066885] initcall arc_rimi_init+0x0/0x4f2 returned with error code -5 
[   20.070019] calling  com20020pci_init+0x0/0x57 @ 1
[   20.080002] arcnet: COM20020 PCI support
[   20.083925] bus: 'pci': add driver com20020
[   20.098694] initcall com20020pci_init+0x0/0x57 returned 0 after 9765 usecs
[   20.100009] calling  catc_init+0x0/0x5e @ 1
[   20.104192] bus: 'usb': add driver catc
[   20.121196] usbcore: registered new interface driver catc
[   20.126594] catc: v2.8:CATC EL1210A NetMate USB Ethernet driver
[   20.130006] initcall catc_init+0x0/0x5e returned 0 after 29296 usecs
[   20.136356] calling  kaweth_init+0x0/0x42 @ 1
[   20.140003] bus: 'usb': add driver kaweth
[   20.154771] usbcore: registered new interface driver kaweth
[   20.160008] initcall kaweth_init+0x0/0x42 returned 0 after 19531 usecs
[   20.166530] calling  pegasus_init+0x0/0x18d @ 1
[   20.170003] pegasus: v0.6.14 (2006/09/27), Pegasus/Pegasus II USB Ethernet driver
[   20.177474] bus: 'usb': add driver pegasus
[   20.191608] usbcore: registered new interface driver pegasus
[   20.197272] initcall pegasus_init+0x0/0x18d returned 0 after 19531 usecs
[   20.200004] calling  usb_rtl8150_init+0x0/0x4e @ 1
[   20.204787] rtl8150: v0.6.2 (2004/08/27):rtl8150 based usb-ethernet driver
[   20.210003] bus: 'usb': add driver rtl8150
[   20.224668] usbcore: registered new interface driver rtl8150
[   20.230010] initcall usb_rtl8150_init+0x0/0x4e returned 0 after 29296 usecs
[   20.236961] calling  hso_init+0x0/0x1ce @ 1
[   20.240003] hso: drivers/net/usb/hso.c: 1.2 Option Wireless
[   20.245595] bus: 'usb': add driver hso
[   20.261984] usbcore: registered new interface driver hso
[   20.267296] initcall hso_init+0x0/0x1ce returned 0 after 19531 usecs
[   20.270004] calling  asix_init+0x0/0x42 @ 1
[   20.274182] bus: 'usb': add driver asix
[   20.290989] usbcore: registered new interface driver asix
[   20.296391] initcall asix_init+0x0/0x42 returned 0 after 19531 usecs
[   20.300003] calling  cdc_init+0x0/0x42 @ 1
[   20.304097] bus: 'usb': add driver cdc_ether
[   20.322061] usbcore: registered new interface driver cdc_ether
[   20.327893] initcall cdc_init+0x0/0x42 returned 0 after 19531 usecs
[   20.330006] calling  eem_init+0x0/0x42 @ 1
[   20.334097] bus: 'usb': add driver cdc_eem
[   20.352334] usbcore: registered new interface driver cdc_eem
[   20.357999] initcall eem_init+0x0/0x42 returned 0 after 19531 usecs
[   20.360004] calling  dm9601_init+0x0/0x42 @ 1
[   20.364354] bus: 'usb': add driver dm9601
[   20.381143] usbcore: registered new interface driver dm9601
[   20.386713] initcall dm9601_init+0x0/0x42 returned 0 after 19531 usecs
[   20.390004] calling  smsc95xx_init+0x0/0x42 @ 1
[   20.394529] bus: 'usb': add driver smsc95xx
[   20.410891] usbcore: registered new interface driver smsc95xx
[   20.416637] initcall smsc95xx_init+0x0/0x42 returned 0 after 19531 usecs
[   20.420004] calling  usbnet_init+0x0/0x42 @ 1
[   20.424354] bus: 'usb': add driver gl620a
[   20.441793] usbcore: registered new interface driver gl620a
[   20.447361] initcall usbnet_init+0x0/0x42 returned 0 after 19531 usecs
[   20.450004] calling  net1080_init+0x0/0x42 @ 1
[   20.454441] bus: 'usb': add driver net1080
[   20.471106] usbcore: registered new interface driver net1080
[   20.476767] initcall net1080_init+0x0/0x42 returned 0 after 19531 usecs
[   20.480004] calling  plusb_init+0x0/0x42 @ 1
[   20.484268] bus: 'usb': add driver plusb
[   20.501569] usbcore: registered new interface driver plusb
[   20.507056] initcall plusb_init+0x0/0x42 returned 0 after 19531 usecs
[   20.510004] calling  rndis_init+0x0/0x42 @ 1
[   20.514269] bus: 'usb': add driver rndis_host
[   20.530631] usbcore: registered new interface driver rndis_host
[   20.536549] initcall rndis_init+0x0/0x42 returned 0 after 19531 usecs
[   20.540004] calling  cdc_subset_init+0x0/0x42 @ 1
[   20.544701] bus: 'usb': add driver cdc_subset
[   20.560807] usbcore: registered new interface driver cdc_subset
[   20.566726] initcall cdc_subset_init+0x0/0x42 returned 0 after 19531 usecs
[   20.570004] calling  zaurus_init+0x0/0x42 @ 1
[   20.574354] bus: 'usb': add driver zaurus
[   20.591559] usbcore: registered new interface driver zaurus
[   20.597128] initcall zaurus_init+0x0/0x42 returned 0 after 19531 usecs
[   20.600004] calling  mcs7830_init+0x0/0x42 @ 1
[   20.604443] bus: 'usb': add driver MOSCHIP usb-ethernet driver
[   20.622315] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[   20.629704] initcall mcs7830_init+0x0/0x42 returned 0 after 19531 usecs
[   20.630006] calling  usbnet_init+0x0/0x52 @ 1
[   20.640009] initcall usbnet_init+0x0/0x52 returned 0 after 0 usecs
[   20.646182] calling  int51x1_init+0x0/0x42 @ 1
[   20.650003] bus: 'usb': add driver int51x1
[   20.664849] usbcore: registered new interface driver int51x1
[   20.670011] initcall int51x1_init+0x0/0x42 returned 0 after 19531 usecs
[   20.676616] calling  usbpn_init+0x0/0x42 @ 1
[   20.680004] bus: 'usb': add driver cdc_phonet
[   20.695108] usbcore: registered new interface driver cdc_phonet
[   20.700008] initcall usbpn_init+0x0/0x42 returned 0 after 19531 usecs
[   20.706443] calling  ipw2100_init+0x0/0x93 @ 1
[   20.710003] ipw2100: Intel(R) PRO/Wireless 2100 Network Driver, git-1.2.2
[   20.716778] ipw2100: Copyright(c) 2003-2006 Intel Corporation
[   20.720009] bus: 'pci': add driver ipw2100
[   20.724349] initcall ipw2100_init+0x0/0x93 returned 0 after 9765 usecs
[   20.730028] calling  ipw_init+0x0/0xad @ 1
[   20.734120] ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.2.2kdq
[   20.740002] ipw2200: Copyright(c) 2003-2006 Intel Corporation
[   20.750006] bus: 'pci': add driver ipw2200
[   20.754387] initcall ipw_init+0x0/0xad returned 0 after 19531 usecs
[   20.760005] calling  ieee80211_init+0x0/0x49 @ 1
[   20.764615] ieee80211: 802.11 data/management/control stack, git-1.1.13
[   20.770002] ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>
[   20.780004] initcall ieee80211_init+0x0/0x49 returned 0 after 19531 usecs
[   20.786782] calling  strip_init_driver+0x0/0x8e @ 1
[   20.790002] STRIP: Version 1.3A-STUART.CHESHIRE (unlimited channels)
[   20.800042] initcall strip_init_driver+0x0/0x8e returned 0 after 9765 usecs
[   20.806996] calling  init_orinoco+0x0/0x42 @ 1
[   20.810003] orinoco 0.15 (David Gibson <hermes@gibson.dropbear.id.au>, Pavel Roskin <proski@gnu.org>, et al)
[   20.820003] initcall init_orinoco+0x0/0x42 returned 0 after 9765 usecs
[   20.826521] calling  orinoco_pci_init+0x0/0x55 @ 1
[   20.830005] orinoco_pci 0.15 (Pavel Roskin <proski@gnu.org>, David Gibson <hermes@gibson.dropbear.id.au> & Jean Tourrilhes <jt@hpl.hp.com>)
[   20.840021] bus: 'pci': add driver orinoco_pci
[   20.850237] initcall orinoco_pci_init+0x0/0x55 returned 0 after 19531 usecs
[   20.857188] calling  airo_init_module+0x0/0x110 @ 1
[   20.860018] airo(): Probing for PCI adapters
[   20.864288] bus: 'pci': add driver airo
[   20.870251] airo(): Finished probing for PCI adapters
[   20.875301] initcall airo_init_module+0x0/0x110 returned 0 after 9765 usecs
[   20.880005] calling  prism54_module_init+0x0/0x5c @ 1
[   20.885047] Loaded prism54 driver, version 1.2
[   20.890006] bus: 'pci': add driver prism54
[   20.894333] initcall prism54_module_init+0x0/0x5c returned 0 after 9765 usecs
[   20.900005] calling  rtl8180_init+0x0/0x42 @ 1
[   20.904442] bus: 'pci': add driver rtl8180
[   20.910238] initcall rtl8180_init+0x0/0x42 returned 0 after 9765 usecs
[   20.916755] calling  rtl8187_init+0x0/0x42 @ 1
[   20.920006] bus: 'usb': add driver rtl8187
[   20.924321] usbcore: registered new interface driver rtl8187
[   20.930014] initcall rtl8187_init+0x0/0x42 returned 0 after 9765 usecs
[   20.936537] calling  rndis_wlan_init+0x0/0x42 @ 1
[   20.940004] bus: 'usb': add driver rndis_wlan
[   20.944565] usbcore: registered new interface driver rndis_wlan
[   20.950009] initcall rndis_wlan_init+0x0/0x42 returned 0 after 9765 usecs
[   20.960004] calling  zd1201_init+0x0/0x42 @ 1
[   20.964354] bus: 'usb': add driver zd1201
[   20.970265] usbcore: registered new interface driver zd1201
[   20.975832] initcall zd1201_init+0x0/0x42 returned 0 after 9765 usecs
[   20.980005] calling  lbs_init_module+0x0/0x5d @ 1
[   20.984728] initcall lbs_init_module+0x0/0x5d returned 0 after 0 usecs
[   20.990004] calling  if_spi_init_module+0x0/0x45 @ 1
[   20.994960] libertas_spi: Libertas SPI driver
[   21.000004] bus: 'spi': add driver libertas_spi
[   21.004735] initcall if_spi_init_module+0x0/0x45 returned 0 after 9765 usecs
[   21.010005] calling  lbtf_init_module+0x0/0x6c @ 1
[   21.014985] initcall lbtf_init_module+0x0/0x6c returned 0 after 0 usecs
[   21.020004] calling  if_usb_init_module+0x0/0x42 @ 1
[   21.030006] bus: 'usb': add driver lbtf_usb
[   21.034401] usbcore: registered new interface driver lbtf_usb
[   21.040015] initcall if_usb_init_module+0x0/0x42 returned 0 after 9765 usecs
[   21.047056] calling  adm8211_init+0x0/0x42 @ 1
[   21.050008] bus: 'pci': add driver adm8211
[   21.054346] initcall adm8211_init+0x0/0x42 returned 0 after 0 usecs
[   21.060005] calling  iwl3945_init+0x0/0x9a @ 1
[   21.064441] iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.2.26kd
[   21.070002] iwl3945: Copyright(c) 2003-2009 Intel Corporation
[   21.080008] bus: 'pci': add driver iwl3945
[   21.084341] initcall iwl3945_init+0x0/0x9a returned 0 after 19531 usecs
[   21.090005] calling  p54p_init+0x0/0x42 @ 1
[   21.094185] bus: 'pci': add driver p54pci
[   21.100251] initcall p54p_init+0x0/0x42 returned 0 after 9765 usecs
[   21.106511] calling  p54spi_init+0x0/0x57 @ 1
[   21.110005] bus: 'spi': add driver cx3110x
[   21.114324] initcall p54spi_init+0x0/0x57 returned 0 after 0 usecs
[   21.120004] calling  ar9170_init+0x0/0x42 @ 1
[   21.124356] bus: 'usb': add driver ar9170usb
[   21.130218] usbcore: registered new interface driver ar9170usb
[   21.136047] initcall ar9170_init+0x0/0x42 returned 0 after 9765 usecs
[   21.140005] calling  init_mac80211_hwsim+0x0/0x535 @ 1
[   21.145134] device class 'mac80211_hwsim': registering
[   21.150219] mac80211_hwsim: Initializing radio 0
[   21.154897] device: 'hwsim0': device_add
[   21.160325] device: 'phy0': device_add
[   21.164316] device: 'rfkill0': device_add
[   21.170892] device: 'wmaster0': device_add
[   21.176092] phy0: Selected rate control algorithm 'pid'
[   21.180181] device: 'wlan0': device_add
[   21.185107] phy0: hwaddr 02:00:00:00:00:00 registered
[   21.190034] mac80211_hwsim: Initializing radio 1
[   21.194744] device: 'hwsim1': device_add
[   21.200224] device: 'phy1': device_add
[   21.204227] device: 'rfkill1': device_add
[   21.210790] device: 'wmaster1': device_add
[   21.216080] phy1: Selected rate control algorithm 'pid'
[   21.220183] device: 'wlan1': device_add
[   21.225221] phy1: hwaddr 02:00:00:00:01:00 registered
[   21.230063] device: 'hwsim0': device_add
[   21.235088] initcall init_mac80211_hwsim+0x0/0x535 returned 0 after 87890 usecs
[   21.240005] calling  wl12xx_init+0x0/0x57 @ 1
[   21.244364] bus: 'spi': add driver wl12xx
[   21.250221] initcall wl12xx_init+0x0/0x57 returned 0 after 9765 usecs
[   21.256651] calling  iwm_sdio_init_module+0x0/0x39 @ 1
[   21.260005] bus: 'sdio': add driver iwm_sdio
[   21.264505] initcall iwm_sdio_init_module+0x0/0x39 returned 0 after 0 usecs
[   21.270004] calling  dmfe_init_module+0x0/0x10f @ 1
[   21.280002] dmfe: Davicom DM9xxx net driver, version 1.36.4 (2002-01-17)
[   21.286707] bus: 'pci': add driver dmfe
[   21.290272] initcall dmfe_init_module+0x0/0x10f returned 0 after 9765 usecs
[   21.297223] calling  de_init+0x0/0x42 @ 1
[   21.300029] bus: 'pci': add driver de2104x
[   21.304382] initcall de_init+0x0/0x42 returned 0 after 0 usecs
[   21.310004] calling  tulip_init+0x0/0x5a @ 1
[   21.314269] bus: 'pci': add driver tulip
[   21.320282] initcall tulip_init+0x0/0x5a returned 0 after 9765 usecs
[   21.326625] calling  de4x5_module_init+0x0/0x42 @ 1
[   21.330010] bus: 'pci': add driver de4x5
[   21.334176] initcall de4x5_module_init+0x0/0x42 returned 0 after 0 usecs
[   21.340004] calling  uli526x_init_module+0x0/0xc3 @ 1
[   21.345046] uli526x: ULi M5261/M5263 net driver, version 0.9.3 (2005-7-29)
[   21.350006] bus: 'pci': add driver uli526x
[   21.354383] initcall uli526x_init_module+0x0/0xc3 returned 0 after 9765 usecs
[   21.360005] calling  mkiss_init_driver+0x0/0x68 @ 1
[   21.370002] mkiss: AX.25 Multikiss, Hans Albas PE1AYX
[   21.375049] initcall mkiss_init_driver+0x0/0x68 returned 0 after 0 usecs
[   21.380003] calling  sixpack_init_driver+0x0/0x68 @ 1
[   21.385047] AX.25: 6pack driver, Revision: 0.3.0
[   21.390004] initcall sixpack_init_driver+0x0/0x68 returned 0 after 9765 usecs
[   21.400025] calling  bpq_init_driver+0x0/0x8c @ 1
[   21.404750] AX.25: bpqether driver version 004
[   21.409188] initcall bpq_init_driver+0x0/0x8c returned 0 after 0 usecs
[   21.410004] calling  init_baycomserfdx+0x0/0x120 @ 1
[   21.420002] baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA
[   21.420005] baycom_ser_fdx: version 0.10 compiled 22:49:37 Aug  2 2009
[   21.430031] device: 'bcsf0': device_add
[   21.434998] device: 'bcsf1': device_add
[   21.441145] device: 'bcsf2': device_add
[   21.446202] device: 'bcsf3': device_add
[   21.451234] initcall init_baycomserfdx+0x0/0x120 returned 0 after 29296 usecs
[   21.460006] calling  hdlcdrv_init_driver+0x0/0x49 @ 1
[   21.465054] hdlcdrv: (C) 1996-2000 Thomas Sailer HB9JNX/AE4WA
[   21.470002] hdlcdrv: version 0.8 compiled 22:49:38 Aug  2 2009
[   21.475830] initcall hdlcdrv_init_driver+0x0/0x49 returned 0 after 9765 usecs
[   21.480003] calling  usb_irda_init+0x0/0x65 @ 1
[   21.484532] bus: 'usb': add driver irda-usb
[   21.490264] usbcore: registered new interface driver irda-usb
[   21.496055] USB IrDA support registered
[   21.500028] initcall usb_irda_init+0x0/0x65 returned 0 after 19531 usecs
[   21.510004] calling  nsc_ircc_init+0x0/0x2a8 @ 1
[   21.514615] Platform driver 'nsc-ircc' needs updating - please use dev_pm_ops
[   21.520004] bus: 'platform': add driver nsc-ircc
[   21.524878] bus: 'platform': remove driver nsc-ircc
[   21.530235] driver: 'nsc-ircc': driver_release
[   21.534681] initcall nsc_ircc_init+0x0/0x2a8 returned -19 after 19531 usecs
[   21.540004] calling  smsc_ircc_init+0x0/0x4f9 @ 1
[   21.544702] Platform driver 'smsc-ircc2' needs updating - please use dev_pm_ops
[   21.550003] bus: 'platform': add driver smsc-ircc2
[   21.560427] bus: 'platform': remove driver smsc-ircc2
[   21.565713] driver: 'smsc-ircc2': driver_release
[   21.570032] initcall smsc_ircc_init+0x0/0x4f9 returned -19 after 29296 usecs
[   21.577076] calling  ali_ircc_init+0x0/0x812 @ 1
[   21.580003] Platform driver 'ali-ircc' needs updating - please use dev_pm_ops
[   21.587126] bus: 'platform': add driver ali-ircc
[   21.590265] bus: 'platform': remove driver ali-ircc
[   21.595340] driver: 'ali-ircc': driver_release
[   21.600010] initcall ali_ircc_init+0x0/0x812 returned -19 after 19531 usecs
[   21.610004] calling  via_ircc_init+0x0/0x82 @ 1
[   21.614541] bus: 'pci': add driver via-ircc
[   21.618972] initcall via_ircc_init+0x0/0x82 returned 0 after 0 usecs
[   21.620005] calling  kingsun_init+0x0/0x42 @ 1
[   21.630007] bus: 'usb': add driver kingsun-sir
[   21.634666] usbcore: registered new interface driver kingsun-sir
[   21.640009] initcall kingsun_init+0x0/0x42 returned 0 after 9765 usecs
[   21.646528] calling  ksdazzle_init+0x0/0x42 @ 1
[   21.650004] bus: 'usb': add driver ksdazzle-sir
[   21.654740] usbcore: registered new interface driver ksdazzle-sir
[   21.660009] initcall ksdazzle_init+0x0/0x42 returned 0 after 9765 usecs
[   21.666616] calling  ks959_init+0x0/0x42 @ 1
[   21.670004] bus: 'usb': add driver ks959-sir
[   21.674483] usbcore: registered new interface driver ks959-sir
[   21.680009] initcall ks959_init+0x0/0x42 returned 0 after 9765 usecs
[   21.690004] calling  init_netconsole+0x0/0x260 @ 1
[   21.694793] console [netcon0] enabled
[   21.698450] netconsole: network logging started
[   21.700004] initcall init_netconsole+0x0/0x260 returned 0 after 9765 usecs
[   21.710006] calling  niu_init+0x0/0x64 @ 1
[   21.714106] bus: 'pci': add driver niu
[   21.718092] initcall niu_init+0x0/0x64 returned 0 after 0 usecs
[   21.720027] calling  init+0x0/0x39 @ 1
[   21.723774] bus: 'virtio': add driver virtio_net
[   21.730233] initcall init+0x0/0x39 returned 0 after 9765 usecs
[   21.736062] calling  efx_init_module+0x0/0xfd @ 1
[   21.740003] Solarflare NET driver v2.3
[   21.744083] bus: 'pci': add driver sfc
[   21.750249] initcall efx_init_module+0x0/0xfd returned 0 after 9765 usecs
[   21.757032] calling  i2400m_driver_init+0x0/0x2d @ 1
[   21.760005] initcall i2400m_driver_init+0x0/0x2d returned 0 after 0 usecs
[   21.770004] calling  i2400ms_driver_init+0x0/0x39 @ 1
[   21.775049] bus: 'sdio': add driver i2400m_sdio
[   21.780219] initcall i2400ms_driver_init+0x0/0x39 returned 0 after 9765 usecs
[   21.787344] calling  i2o_iop_init+0x0/0x6c @ 1
[   21.790003] I2O subsystem v1.325
[   21.793227] i2o: max drivers = 8
[   21.796733] bus: 'i2o': registered
[   21.800255] bus: 'i2o': add driver exec-osm
[   21.804653] bus: 'pci': add driver PCI_I2O
[   21.810304] initcall i2o_iop_init+0x0/0x6c returned 0 after 19531 usecs
[   21.816908] calling  i2o_bus_init+0x0/0x68 @ 1
[   21.820003] I2O Bus Adapter OSM v1.317
[   21.823749] bus: 'i2o': add driver bus-osm
[   21.830169] initcall i2o_bus_init+0x0/0x68 returned 0 after 9765 usecs
[   21.836688] calling  i2o_scsi_init+0x0/0x68 @ 1
[   21.840003] I2O SCSI Peripheral OSM v1.316
[   21.844095] bus: 'i2o': add driver scsi-osm
[   21.848521] initcall i2o_scsi_init+0x0/0x68 returned 0 after 0 usecs
[   21.850004] calling  fusion_init+0x0/0x164 @ 1
[   21.860003] Fusion MPT base driver 3.04.10
[   21.864096] Copyright (c) 1999-2008 LSI Corporation
[   21.869005] initcall fusion_init+0x0/0x164 returned 0 after 0 usecs
[   21.870004] calling  mptfc_init+0x0/0x115 @ 1
[   21.880024] Fusion MPT FC Host driver 3.04.10
[   21.884408] bus: 'pci': add driver mptfc
[   21.888612] initcall mptfc_init+0x0/0x115 returned 0 after 0 usecs
[   21.890005] calling  mptctl_init+0x0/0x141 @ 1
[   21.894448] Fusion MPT misc device (ioctl) driver 3.04.10
[   21.900011] device: 'mptctl': device_add
[   21.904214] mptctl: Registered with Fusion MPT base driver
[   21.910004] mptctl: /dev/mptctl @ (major,minor=10,220)
[   21.915135] initcall mptctl_init+0x0/0x141 returned 0 after 19531 usecs
[   21.920004] calling  mpt_lan_init+0x0/0xa4 @ 1
[   21.930005] Fusion MPT LAN driver 3.04.10
[   21.934011] initcall mpt_lan_init+0x0/0xa4 returned 0 after 0 usecs
[   21.940004] calling  fw_core_init+0x0/0xb0 @ 1
[   21.944692] bus: 'firewire': registered
[   21.948570] initcall fw_core_init+0x0/0xb0 returned 0 after 0 usecs
[   21.950028] calling  fw_ohci_init+0x0/0x42 @ 1
[   21.960009] bus: 'pci': add driver firewire_ohci
[   21.964878] initcall fw_ohci_init+0x0/0x42 returned 0 after 0 usecs
[   21.970009] calling  sbp2_init+0x0/0x6d @ 1
[   21.974287] bus: 'firewire': add driver sbp2
[   21.980261] initcall sbp2_init+0x0/0x6d returned 0 after 9765 usecs
[   21.986519] calling  ohci1394_init+0x0/0x42 @ 1
[   21.990032] bus: 'pci': add driver ohci1394
[   21.994449] initcall ohci1394_init+0x0/0x42 returned 0 after 0 usecs
[   22.000074] calling  video1394_init_module+0x0/0xfc @ 1
[   22.005296] bus: 'ieee1394': add driver video1394
[   22.010222] video1394: Installed video1394 module
[   22.014920] initcall video1394_init_module+0x0/0xfc returned 0 after 9765 usecs
[   22.020022] calling  init_raw1394+0x0/0x11a @ 1
[   22.024560] device: 'raw1394': device_add
[   22.030267] ieee1394: raw1394: /dev/raw1394 device initialized
[   22.036095] bus: 'ieee1394': add driver raw1394
[   22.040280] initcall init_raw1394+0x0/0x11a returned 0 after 19531 usecs
[   22.050014] calling  dv1394_init_module+0x0/0xc5 @ 1
[   22.054974] bus: 'ieee1394': add driver dv1394
[   22.059649] initcall dv1394_init_module+0x0/0xc5 returned 0 after 0 usecs
[   22.060004] calling  ether1394_init_module+0x0/0x96 @ 1
[   22.070487] bus: 'ieee1394': add driver eth1394
[   22.075223] initcall ether1394_init_module+0x0/0x96 returned 0 after 0 usecs
[   22.080005] calling  cdrom_init+0x0/0x91 @ 1
[   22.084268] initcall cdrom_init+0x0/0x91 returned 0 after 0 usecs
[   22.090004] calling  ks0108_init+0x0/0xe0 @ 1
[   22.094359] parport0: cannot grant exclusive access for device ks0108
[   22.100008] ks0108: ERROR: parport didn't register new device
[   22.110004] initcall ks0108_init+0x0/0xe0 returned -22 after 19531 usecs
[   22.116696] initcall ks0108_init+0x0/0xe0 returned with error code -22 
[   22.120026] calling  spi_gpio_init+0x0/0x40 @ 1
[   22.124557] bus: 'platform': add driver spi_gpio
[   22.130240] bus: 'platform': remove driver spi_gpio
[   22.135310] driver: 'spi_gpio': driver_release
[   22.140011] initcall spi_gpio_init+0x0/0x40 returned -19 after 19531 usecs
[   22.150004] calling  init_spi_lm70llp+0x0/0x39 @ 1
[   22.154796] parport0: cannot grant exclusive access for device spi-lm70llp
[   22.160008] spi-lm70llp: spi_lm70llp probe fail, status -12
[   22.165578] initcall init_spi_lm70llp+0x0/0x39 returned 0 after 9765 usecs
[   22.170003] calling  spidev_init+0x0/0xbf @ 1
[   22.174363] device class 'spidev': registering
[   22.180245] bus: 'spi': add driver spidev
[   22.184505] initcall spidev_init+0x0/0xbf returned 0 after 9765 usecs
[   22.190005] calling  tle62x0_init+0x0/0x39 @ 1
[   22.194442] bus: 'spi': add driver tle62x0
[   22.200209] initcall tle62x0_init+0x0/0x39 returned 0 after 9765 usecs
[   22.206729] calling  aoe_init+0x0/0xd5 @ 1
[   22.210011] device class 'aoe': registering
[   22.214438] device: 'err': device_add
[   22.220271] device: 'discover': device_add
[   22.224630] device: 'interfaces': device_add
[   22.230263] device: 'revalidate': device_add
[   22.234776] device: 'flush': device_add
[   22.239272] aoe: AoE v47 initialised.
[   22.240246] initcall aoe_init+0x0/0xd5 returned 0 after 29296 usecs
[   22.250005] calling  uwb_subsys_init+0x0/0x77 @ 1
[   22.254723] device class 'uwb_rc': registering
[   22.259401] initcall uwb_subsys_init+0x0/0x77 returned 0 after 0 usecs
[   22.260006] calling  wlp_subsys_init+0x0/0x2d @ 1
[   22.270004] initcall wlp_subsys_init+0x0/0x2d returned 0 after 0 usecs
[   22.276521] calling  umc_bus_init+0x0/0x39 @ 1
[   22.280259] bus: 'umc': registered
[   22.283663] initcall umc_bus_init+0x0/0x39 returned 0 after 0 usecs
[   22.290005] calling  whci_init+0x0/0x42 @ 1
[   22.294196] bus: 'pci': add driver whci
[   22.298302] initcall whci_init+0x0/0x42 returned 0 after 0 usecs
[   22.300004] calling  whcrc_driver_init+0x0/0x42 @ 1
[   22.310003] bus: 'umc': add driver whc-rc
[   22.314226] initcall whcrc_driver_init+0x0/0x42 returned 0 after 0 usecs
[   22.320005] calling  hwarc_driver_init+0x0/0x42 @ 1
[   22.324879] bus: 'usb': add driver hwa-rc
[   22.330224] usbcore: registered new interface driver hwa-rc
[   22.335799] initcall hwarc_driver_init+0x0/0x42 returned 0 after 9765 usecs
[   22.340005] calling  gpio_vbus_init+0x0/0x40 @ 1
[   22.344616] bus: 'platform': add driver gpio-vbus
[   22.350262] bus: 'platform': remove driver gpio-vbus
[   22.355418] driver: 'gpio-vbus': driver_release
[   22.360011] initcall gpio_vbus_init+0x0/0x40 returned -19 after 19531 usecs
[   22.366962] calling  mon_init+0x0/0x141 @ 1
[   22.370015] device class 'usbmon': registering
[   22.374689] device: 'usbmon0': device_add
[   22.380339] initcall mon_init+0x0/0x141 returned 0 after 9765 usecs
[   22.386599] calling  ehci_hcd_init+0x0/0x10e @ 1
[   22.390004] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   22.400003] ehci_hcd: block sizes: qh 192 qtd 96 itd 192 sitd 96
[   22.406028] bus: 'pci': add driver ehci_hcd
[   22.410027] bus: 'pci': driver_probe_device: matched device 0000:00:02.1 with driver ehci_hcd
[   22.418537] bus: 'pci': really_probe: probing driver ehci_hcd with device 0000:00:02.1
[   22.420204] ehci_hcd 0000:00:02.1: can't find IRQ for PCI INT B; probably buggy MP table
[   22.430007] ehci_hcd 0000:00:02.1: Found HC with no IRQ.  Check BIOS/PCI 0000:00:02.1 setup!
[   22.440005] ehci_hcd 0000:00:02.1: init 0000:00:02.1 fail, -19
[   22.446113] initcall ehci_hcd_init+0x0/0x10e returned 0 after 48828 usecs
[   22.450027] calling  oxu_module_init+0x0/0x39 @ 1
[   22.460004] bus: 'platform': add driver oxu210hp-hcd
[   22.465183] initcall oxu_module_init+0x0/0x39 returned 0 after 0 usecs
[   22.470057] calling  ohci_hcd_mod_init+0x0/0x101 @ 1
[   22.475012] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   22.480003] ohci_hcd: block sizes: ed 80 td 96
[   22.484478] bus: 'pci': add driver ohci_hcd
[   22.490026] bus: 'pci': driver_probe_device: matched device 0000:00:02.0 with driver ohci_hcd
[   22.500003] bus: 'pci': really_probe: probing driver ohci_hcd with device 0000:00:02.0
[   22.508021] ohci_hcd 0000:00:02.0: can't find IRQ for PCI INT A; probably buggy MP table
[   22.510042] ohci_hcd 0000:00:02.0: Found HC with no IRQ.  Check BIOS/PCI 0000:00:02.0 setup!
[   22.520008] ohci_hcd 0000:00:02.0: init 0000:00:02.0 fail, -19
[   22.530272] bus: 'ssb': add driver ohci_hcd
[   22.534661] initcall ohci_hcd_mod_init+0x0/0x101 returned 0 after 58593 usecs
[   22.540027] calling  uhci_hcd_init+0x0/0x159 @ 1
[   22.544640] uhci_hcd: USB Universal Host Controller Interface driver
[   22.550486] bus: 'pci': add driver uhci_hcd
[   22.554946] initcall uhci_hcd_init+0x0/0x159 returned 0 after 9765 usecs
[   22.560058] calling  sl811h_init+0x0/0x67 @ 1
[   22.570003] sl811: driver sl811-hcd, 19 May 2005
[   22.574615] bus: 'platform': add driver sl811-hcd
[   22.580206] initcall sl811h_init+0x0/0x67 returned 0 after 9765 usecs
[   22.586641] calling  u132_hcd_init+0x0/0xd8 @ 1
[   22.590023] driver u132_hcd built at 22:49:46 on Aug  2 2009
[   22.595786] bus: 'platform': add driver u132_hcd
[   22.600300] initcall u132_hcd_init+0x0/0xd8 returned 0 after 9765 usecs
[   22.606910] calling  isp1760_init+0x0/0x76 @ 1
[   22.610798] bus: 'platform': add driver isp1760
[   22.615539] bus: 'pci': add driver isp1760
[   22.620298] initcall isp1760_init+0x0/0x76 returned 0 after 9765 usecs
[   22.626814] calling  hwahc_driver_init+0x0/0x42 @ 1
[   22.630011] bus: 'usb': add driver hwa-hc
[   22.634226] usbcore: registered new interface driver hwa-hc
[   22.640009] initcall hwahc_driver_init+0x0/0x42 returned 0 after 9765 usecs
[   22.650004] calling  c67x00_init+0x0/0x39 @ 1
[   22.654356] bus: 'platform': add driver c67x00
[   22.660321] initcall c67x00_init+0x0/0x39 returned 0 after 9765 usecs
[   22.666752] calling  wusbcore_init+0x0/0x9a @ 1
[   22.670127] initcall wusbcore_init+0x0/0x9a returned 0 after 0 usecs
[   22.676477] calling  cbaf_driver_init+0x0/0x42 @ 1
[   22.680005] bus: 'usb': add driver wusb-cbaf
[   22.684544] usbcore: registered new interface driver wusb-cbaf
[   22.690009] initcall cbaf_driver_init+0x0/0x42 returned 0 after 9765 usecs
[   22.696875] calling  acm_init+0x0/0x128 @ 1
[   22.700016] bus: 'usb': add driver cdc_acm
[   22.704317] usbcore: registered new interface driver cdc_acm
[   22.710007] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
[   22.720005] initcall acm_init+0x0/0x128 returned 0 after 19531 usecs
[   22.726348] calling  usb_stor_init+0x0/0x6a @ 1
[   22.730004] Initializing USB Mass Storage driver...
[   22.734878] bus: 'usb': add driver usb-storage
[   22.740216] usbcore: registered new interface driver usb-storage
[   22.746220] USB Mass Storage support registered.
[   22.750033] initcall usb_stor_init+0x0/0x6a returned 0 after 19531 usecs
[   22.760004] calling  alauda_init+0x0/0x42 @ 1
[   22.764355] bus: 'usb': add driver ums-alauda
[   22.768974] usbcore: registered new interface driver ums-alauda
[   22.770009] initcall alauda_init+0x0/0x42 returned 0 after 9765 usecs
[   22.780004] calling  cypress_init+0x0/0x42 @ 1
[   22.784444] bus: 'usb': add driver ums-cypress
[   22.790207] usbcore: registered new interface driver ums-cypress
[   22.796213] initcall cypress_init+0x0/0x42 returned 0 after 9765 usecs
[   22.800005] calling  datafab_init+0x0/0x42 @ 1
[   22.804443] bus: 'usb': add driver ums-datafab
[   22.810214] usbcore: registered new interface driver ums-datafab
[   22.816223] initcall datafab_init+0x0/0x42 returned 0 after 9765 usecs
[   22.820005] calling  freecom_init+0x0/0x42 @ 1
[   22.824442] bus: 'usb': add driver ums-freecom
[   22.830229] usbcore: registered new interface driver ums-freecom
[   22.840009] initcall freecom_init+0x0/0x42 returned 0 after 19531 usecs
[   22.846616] calling  isd200_init+0x0/0x42 @ 1
[   22.850004] bus: 'usb': add driver ums-isd200
[   22.854567] usbcore: registered new interface driver ums-isd200
[   22.860009] initcall isd200_init+0x0/0x42 returned 0 after 9765 usecs
[   22.866442] calling  jumpshot_init+0x0/0x42 @ 1
[   22.870004] bus: 'usb': add driver ums-jumpshot
[   22.874768] usbcore: registered new interface driver ums-jumpshot
[   22.880009] initcall jumpshot_init+0x0/0x42 returned 0 after 9765 usecs
[   22.886614] calling  sddr09_init+0x0/0x42 @ 1
[   22.890004] bus: 'usb': add driver ums-sddr09
[   22.894568] usbcore: registered new interface driver ums-sddr09
[   22.900009] initcall sddr09_init+0x0/0x42 returned 0 after 9765 usecs
[   22.910004] calling  usbat_init+0x0/0x42 @ 1
[   22.914270] bus: 'usb': add driver ums-usbat
[   22.920120] usbcore: registered new interface driver ums-usbat
[   22.925954] initcall usbat_init+0x0/0x42 returned 0 after 9765 usecs
[   22.930006] calling  usb_mdc800_init+0x0/0x325 @ 1
[   22.934801] bus: 'usb': add driver mdc800
[   22.940213] usbcore: registered new interface driver mdc800
[   22.945778] mdc800: v0.7.5 (30/10/2000):USB Driver for Mustek MDC800 Digital Camera
[   22.950006] initcall usb_mdc800_init+0x0/0x325 returned 0 after 19531 usecs
[   22.960004] calling  microtek_drv_init+0x0/0x42 @ 1
[   22.964876] bus: 'usb': add driver microtekX6
[   22.970212] usbcore: registered new interface driver microtekX6
[   22.976127] initcall microtek_drv_init+0x0/0x42 returned 0 after 9765 usecs
[   22.980005] calling  adu_init+0x0/0xba @ 1
[   22.984094] drivers/usb/misc/adutux.c :  adu_init : enter 
[   22.990004] bus: 'usb': add driver adutux
[   22.994269] usbcore: registered new interface driver adutux
[   23.000007] adutux adutux (see www.ontrak.net) v0.0.13
[   23.005142] adutux is an experimental driver. Use at your own risk
[   23.010005] drivers/usb/misc/adutux.c :  adu_init : leave, return value 0 
[   23.020004] initcall adu_init+0x0/0xba returned 0 after 39062 usecs
[   23.026260] calling  appledisplay_init+0x0/0x80 @ 1
[   23.030099] bus: 'usb': add driver appledisplay
[   23.034833] usbcore: registered new interface driver appledisplay
[   23.040037] initcall appledisplay_init+0x0/0x80 returned 0 after 9765 usecs
[   23.050004] calling  berry_init+0x0/0x42 @ 1
[   23.054270] bus: 'usb': add driver berry_charge
[   23.059010] usbcore: registered new interface driver berry_charge
[   23.060009] initcall berry_init+0x0/0x42 returned 0 after 9765 usecs
[   23.070004] calling  usb_cytherm_init+0x0/0x70 @ 1
[   23.074789] bus: 'usb': add driver cytherm
[   23.080214] usbcore: registered new interface driver cytherm
[   23.085871] cytherm: v1.0:Cypress USB Thermometer driver
[   23.090006] initcall usb_cytherm_init+0x0/0x70 returned 0 after 19531 usecs
[   23.096955] calling  emi26_init+0x0/0x42 @ 1
[   23.100004] bus: 'usb': add driver emi26 - firmware loader
[   23.105693] usbcore: registered new interface driver emi26 - firmware loader
[   23.110009] initcall emi26_init+0x0/0x42 returned 0 after 9765 usecs
[   23.120004] calling  ftdi_elan_init+0x0/0x192 @ 1
[   23.124700] driver ftdi-elan built at 22:49:45 on Aug  2 2009
[   23.130336] bus: 'usb': add driver ftdi-elan
[   23.134824] usbcore: registered new interface driver ftdi-elan
[   23.140019] initcall ftdi_elan_init+0x0/0x192 returned 0 after 19531 usecs
[   23.150004] calling  iowarrior_init+0x0/0x42 @ 1
[   23.154617] bus: 'usb': add driver iowarrior
[   23.159099] usbcore: registered new interface driver iowarrior
[   23.160009] initcall iowarrior_init+0x0/0x42 returned 0 after 9765 usecs
[   23.170004] calling  isight_firmware_init+0x0/0x42 @ 1
[   23.175138] bus: 'usb': add driver isight_firmware
[   23.180225] usbcore: registered new interface driver isight_firmware
[   23.186576] initcall isight_firmware_init+0x0/0x42 returned 0 after 9765 usecs
[   23.190005] calling  usb_lcd_init+0x0/0x60 @ 1
[   23.200004] bus: 'usb': add driver usblcd
[   23.204221] usbcore: registered new interface driver usblcd
[   23.210009] initcall usb_lcd_init+0x0/0x60 returned 0 after 9765 usecs
[   23.216530] calling  ld_usb_init+0x0/0x60 @ 1
[   23.220004] bus: 'usb': add driver ldusb
[   23.224135] usbcore: registered new interface driver ldusb
[   23.230011] initcall ld_usb_init+0x0/0x60 returned 0 after 9765 usecs
[   23.236444] calling  usb_led_init+0x0/0x60 @ 1
[   23.240005] bus: 'usb': add driver usbled
[   23.244221] usbcore: registered new interface driver usbled
[   23.250009] initcall usb_led_init+0x0/0x60 returned 0 after 9765 usecs
[   23.256529] calling  usb_rio_init+0x0/0x5e @ 1
[   23.260005] bus: 'usb': add driver rio500
[   23.264231] usbcore: registered new interface driver rio500
[   23.270010] rio500: v1.1:USB Rio 500 driver
[   23.274191] initcall usb_rio_init+0x0/0x5e returned 0 after 9765 usecs
[   23.280004] calling  tv_init+0x0/0x70 @ 1
[   23.284008] bus: 'usb': add driver trancevibrator
[   23.290215] usbcore: registered new interface driver trancevibrator
[   23.296480] trancevibrator: v1.1:PlayStation 2 Trance Vibrator driver
[   23.300006] initcall tv_init+0x0/0x70 returned 0 after 19531 usecs
[   23.310004] calling  usb_sevseg_init+0x0/0x60 @ 1
[   23.314704] bus: 'usb': add driver usbsevseg
[   23.319184] usbcore: registered new interface driver usbsevseg
[   23.320009] initcall usb_sevseg_init+0x0/0x60 returned 0 after 9765 usecs
[   23.330006] calling  vstusb_init+0x0/0x67 @ 1
[   23.334357] bus: 'usb': add driver vstusb
[   23.340228] usbcore: registered new interface driver vstusb
[   23.345796] initcall vstusb_init+0x0/0x67 returned 0 after 9765 usecs
[   23.350005] calling  i8042_init+0x0/0xdb @ 1
[   23.354318] bus: 'platform': add driver i8042
[   23.360227] Registering platform device 'i8042'. Parent at platform
[   23.366489] device: 'i8042': device_add
[   23.370013] bus: 'platform': add device i8042
[   23.374641] bus: 'platform': driver_probe_device: matched device i8042 with driver i8042
[   23.380003] bus: 'platform': really_probe: probing driver i8042 with device i8042
[   23.391444] serio: i8042 KBD port at 0x60,0x64 irq 1
[   23.391444] serio: i8042 AUX port at 0x60,0x64 irq 12
[   23.391444] driver: 'i8042': driver_bound: bound to device 'i8042'
[   23.400096] bus: 'platform': really_probe: bound device i8042 to driver i8042
[   23.407233] initcall i8042_init+0x0/0xdb returned 0 after 58593 usecs
[   23.410006] calling  parkbd_init+0x0/0x230 @ 1
[   23.414447] parport0: cannot grant exclusive access for device parkbd
[   23.420081] initcall parkbd_init+0x0/0x230 returned -19 after 9765 usecs
[   23.430005] calling  serport_init+0x0/0x5a @ 1
[   23.434443] initcall serport_init+0x0/0x5a returned 0 after 0 usecs
[   23.440031] calling  pcips2_init+0x0/0x42 @ 1
[   23.444400] bus: 'pci': add driver pcips2
[   23.460000] device: 'serio0': device_add
[   23.460388] initcall pcips2_init+0x0/0x42 returned 0 after 9765 usecs
[   23.460393] calling  serio_raw_init+0x0/0x42 @ 1
[   23.460397] bus: 'serio': add driver serio_raw
[   23.460620] initcall serio_raw_init+0x0/0x42 returned 0 after 0 usecs
[   23.460624] calling  emu_init+0x0/0x42 @ 1
[   23.460641] bus: 'pci': add driver Emu10k1_gameport
[   23.460942] initcall emu_init+0x0/0x42 returned 0 after 0 usecs
[   23.460947] calling  fm801_gp_init+0x0/0x42 @ 1
[   23.460953] bus: 'pci': add driver FM801_gameport
[   23.461189] initcall fm801_gp_init+0x0/0x42 returned 0 after 0 usecs
[   23.461193] calling  l4_init+0x0/0x37f @ 1
[   23.461215] initcall l4_init+0x0/0x37f returned -19 after 0 usecs
[   23.461219] calling  ns558_init+0x0/0x311 @ 1
[   23.470000] initcall ns558_init+0x0/0x311 returned -19 after 0 usecs
[   23.470000] calling  mousedev_init+0x0/0x87 @ 1
[   23.470000] device: 'mice': device_add
[   23.470000] mice: PS/2 mouse device common for all mice
[   23.470000] initcall mousedev_init+0x0/0x87 returned 0 after 0 usecs
[   23.470000] calling  joydev_init+0x0/0x39 @ 1
[   23.470000] initcall joydev_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  evdev_init+0x0/0x39 @ 1
[   23.470000] initcall evdev_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  evbug_init+0x0/0x39 @ 1
[   23.470000] initcall evbug_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  atkbd_init+0x0/0x42 @ 1
[   23.470000] bus: 'serio': add driver atkbd
[   23.470000] initcall atkbd_init+0x0/0x42 returned 0 after 0 usecs
[   23.470000] calling  gpio_keys_init+0x0/0x39 @ 1
[   23.470000] bus: 'platform': add driver gpio-keys
[   23.470000] initcall gpio_keys_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  lkkbd_init+0x0/0x42 @ 1
[   23.470000] bus: 'serio': add driver lkkbd
[   23.470000] initcall lkkbd_init+0x0/0x42 returned 0 after 0 usecs
[   23.470000] calling  lm8323_init+0x0/0x3b @ 1
[   23.470000] bus: 'i2c': add driver lm8323
[   23.470000] initcall lm8323_init+0x0/0x3b returned 0 after 0 usecs
[   23.470000] calling  matrix_keypad_init+0x0/0x39 @ 1
[   23.470000] bus: 'platform': add driver matrix-keypad
[   23.470000] initcall matrix_keypad_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  sunkbd_init+0x0/0x42 @ 1
[   23.470000] bus: 'serio': add driver sunkbd
[   23.470000] initcall sunkbd_init+0x0/0x42 returned 0 after 0 usecs
[   23.470000] calling  xtkbd_init+0x0/0x42 @ 1
[   23.470000] bus: 'serio': add driver xtkbd
[   23.470000] initcall xtkbd_init+0x0/0x42 returned 0 after 0 usecs
[   23.470000] calling  atp_init+0x0/0x42 @ 1
[   23.470000] bus: 'usb': add driver appletouch
[   23.470000] usbcore: registered new interface driver appletouch
[   23.470000] initcall atp_init+0x0/0x42 returned 0 after 0 usecs
[   23.470000] calling  gpio_mouse_init+0x0/0x39 @ 1
[   23.470000] bus: 'platform': add driver gpio_mouse
[   23.470000] initcall gpio_mouse_init+0x0/0x39 returned 0 after 0 usecs
[   23.470000] calling  psmouse_init+0x0/0x9a @ 1
[   23.470000] bus: 'serio': add device serio0
[   23.480948] bus: 'serio': add driver psmouse
[   23.485465] bus: 'serio': driver_probe_device: matched device serio0 with driver atkbd
[   23.485622] initcall psmouse_init+0x0/0x9a returned 0 after 19531 usecs
[   23.485627] calling  sermouse_init+0x0/0x42 @ 1
[   23.485630] bus: 'serio': add driver sermouse
[   23.485878] initcall sermouse_init+0x0/0x42 returned 0 after 0 usecs
[   23.485882] calling  synaptics_i2c_init+0x0/0x3b @ 1
[   23.485887] bus: 'i2c': add driver synaptics_i2c
[   23.486098] initcall synaptics_i2c_init+0x0/0x3b returned 0 after 0 usecs
[   23.486103] calling  vsxxxaa_init+0x0/0x42 @ 1
[   23.486106] bus: 'serio': add driver vsxxxaa
[   23.486356] initcall vsxxxaa_init+0x0/0x42 returned 0 after 0 usecs
[   23.486360] calling  a3d_init+0x0/0x42 @ 1
[   23.486363] bus: 'gameport': add driver adc
[   23.486581] initcall a3d_init+0x0/0x42 returned 0 after 0 usecs
[   23.486585] calling  analog_init+0x0/0x118 @ 1
[   23.486588] bus: 'gameport': add driver analog
[   23.486841] initcall analog_init+0x0/0x118 returned 0 after 0 usecs
[   23.486845] calling  gc_init+0x0/0x62b @ 1
[   23.486850] initcall gc_init+0x0/0x62b returned -19 after 0 usecs
[   23.486853] calling  gf2k_init+0x0/0x42 @ 1
[   23.486856] bus: 'gameport': add driver gf2k
[   23.487069] initcall gf2k_init+0x0/0x42 returned 0 after 0 usecs
[   23.487073] calling  grip_init+0x0/0x42 @ 1
[   23.487076] bus: 'gameport': add driver grip_mp
[   23.487326] initcall grip_init+0x0/0x42 returned 0 after 0 usecs
[   23.487330] calling  iforce_init+0x0/0x42 @ 1
[   23.487333] bus: 'serio': add driver iforce
[   23.487558] initcall iforce_init+0x0/0x42 returned 0 after 0 usecs
[   23.487563] calling  interact_init+0x0/0x42 @ 1
[   23.487566] bus: 'gameport': add driver interact
[   23.487813] initcall interact_init+0x0/0x42 returned 0 after 0 usecs
[   23.487818] calling  magellan_init+0x0/0x42 @ 1
[   23.487821] bus: 'serio': add driver magellan
[   23.488056] initcall magellan_init+0x0/0x42 returned 0 after 0 usecs
[   23.488060] calling  sw_init+0x0/0x42 @ 1
[   23.488063] bus: 'gameport': add driver sidewinder
[   23.488307] initcall sw_init+0x0/0x42 returned 0 after 0 usecs
[   23.488311] calling  spaceball_init+0x0/0x42 @ 1
[   23.488315] bus: 'serio': add driver spaceball
[   23.488531] initcall spaceball_init+0x0/0x42 returned 0 after 0 usecs
[   23.488535] calling  spaceorb_init+0x0/0x42 @ 1
[   23.488538] bus: 'serio': add driver spaceorb
[   23.488796] initcall spaceorb_init+0x0/0x42 returned 0 after 0 usecs
[   23.488800] calling  stinger_init+0x0/0x42 @ 1
[   23.488803] bus: 'serio': add driver stinger
[   23.489038] initcall stinger_init+0x0/0x42 returned 0 after 0 usecs
[   23.489042] calling  tmdc_init+0x0/0x42 @ 1
[   23.489045] bus: 'gameport': add driver tmdc
[   23.489289] initcall tmdc_init+0x0/0x42 returned 0 after 0 usecs
[   23.489293] calling  tgfx_init+0x0/0x4a2 @ 1
[   23.489298] initcall tgfx_init+0x0/0x4a2 returned -19 after 0 usecs
[   23.489302] calling  walkera0701_init+0x0/0x2c8 @ 1
[   23.489305] walkera0701: parport without interrupt
[   23.489310] initcall walkera0701_init+0x0/0x2c8 returned -19 after 0 usecs
[   23.489314] calling  ad7877_init+0x0/0x39 @ 1
[   23.489319] bus: 'spi': add driver ad7877
[   23.489530] initcall ad7877_init+0x0/0x39 returned 0 after 0 usecs
[   23.489535] calling  ad7879_init+0x0/0x39 @ 1
[   23.489539] bus: 'spi': add driver ad7879
[   23.489782] initcall ad7879_init+0x0/0x39 returned 0 after 0 usecs
[   23.489787] calling  elo_init+0x0/0x42 @ 1
[   23.489791] bus: 'serio': add driver elo
[   23.490056] initcall elo_init+0x0/0x42 returned 0 after 9765 usecs
[   23.490060] calling  fujitsu_init+0x0/0x42 @ 1
[   23.490063] bus: 'serio': add driver fujitsu_ts
[   23.490326] initcall fujitsu_init+0x0/0x42 returned 0 after 0 usecs
[   23.490331] calling  usbtouch_init+0x0/0x42 @ 1
[   23.490342] bus: 'usb': add driver usbtouchscreen
[   23.490574] usbcore: registered new interface driver usbtouchscreen
[   23.490584] initcall usbtouch_init+0x0/0x42 returned 0 after 0 usecs
[   23.490588] calling  touchit213_init+0x0/0x42 @ 1
[   23.490592] bus: 'serio': add driver touchit213
[   23.490840] initcall touchit213_init+0x0/0x42 returned 0 after 0 usecs
[   23.490844] calling  tr_init+0x0/0x42 @ 1
[   23.490847] bus: 'serio': add driver touchright
[   23.491083] initcall tr_init+0x0/0x42 returned 0 after 0 usecs
[   23.491087] calling  tw_init+0x0/0x42 @ 1
[   23.491090] bus: 'serio': add driver touchwin
[   23.491350] initcall tw_init+0x0/0x42 returned 0 after 0 usecs
[   23.491354] calling  tsc2007_init+0x0/0x3b @ 1
[   23.491359] bus: 'i2c': add driver tsc2007
[   23.491582] initcall tsc2007_init+0x0/0x3b returned 0 after 0 usecs
[   23.491586] calling  da9034_touch_init+0x0/0x39 @ 1
[   23.491593] bus: 'platform': add driver da9034-touch
[   23.491847] initcall da9034_touch_init+0x0/0x39 returned 0 after 0 usecs
[   23.491852] calling  w90x900ts_init+0x0/0x39 @ 1
[   23.491856] bus: 'platform': add driver w90x900-ts
[   23.492067] initcall w90x900ts_init+0x0/0x39 returned 0 after 0 usecs
[   23.492072] calling  i2c_dev_init+0x0/0xcb @ 1
[   23.492074] i2c /dev entries driver
[   23.492096] device class 'i2c-dev': registering
[   23.492345] bus: 'i2c': add driver dev_driver
[   23.492554] initcall i2c_dev_init+0x0/0xcb returned 0 after 0 usecs
[   23.492559] calling  i2c_ali1535_init+0x0/0x42 @ 1
[   23.492580] bus: 'pci': add driver ali1535_smbus
[   23.492884] initcall i2c_ali1535_init+0x0/0x42 returned 0 after 0 usecs
[   23.492889] calling  ali1563_init+0x0/0x42 @ 1
[   23.492896] bus: 'pci': add driver ali1563_smbus
[   23.493123] initcall ali1563_init+0x0/0x42 returned 0 after 0 usecs
[   23.493128] calling  i2c_amd8111_init+0x0/0x42 @ 1
[   23.493135] bus: 'pci': add driver amd8111_smbus2
[   23.493409] initcall i2c_amd8111_init+0x0/0x42 returned 0 after 0 usecs
[   23.493414] calling  i2c_i801_init+0x0/0x42 @ 1
[   23.493421] bus: 'pci': add driver i801_smbus
[   23.493655] initcall i2c_i801_init+0x0/0x42 returned 0 after 0 usecs
[   23.493660] calling  i2c_sch_init+0x0/0x42 @ 1
[   23.493667] bus: 'pci': add driver isch_smbus
[   23.493961] initcall i2c_sch_init+0x0/0x42 returned 0 after 0 usecs
[   23.493966] calling  nforce2_init+0x0/0x42 @ 1
[   23.493972] bus: 'pci': add driver nForce2_smbus
[   23.493992] bus: 'pci': driver_probe_device: matched device 0000:00:01.1 with driver nForce2_smbus
[   23.493996] bus: 'pci': really_probe: probing driver nForce2_smbus with device 0000:00:01.1
[   23.502943] device: 'i2c-0': device_add
[   23.520109] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.560018] device: '0-0050': device_add
[   23.560030] bus: 'i2c': add device 0-0050
[   23.560275] bus: 'i2c': driver_probe_device: matched device 0-0050 with driver eeprom
[   23.560279] bus: 'i2c': really_probe: probing driver eeprom with device 0-0050
[   23.560297] driver: '0-0050': driver_bound: bound to device 'eeprom'
[   23.560301] bus: 'i2c': really_probe: bound device 0-0050 to driver eeprom
[   23.600037] device: '0-0051': device_add
[   23.600047] bus: 'i2c': add device 0-0051
[   23.600260] bus: 'i2c': driver_probe_device: matched device 0-0051 with driver eeprom
[   23.600264] bus: 'i2c': really_probe: probing driver eeprom with device 0-0051
[   23.600281] driver: '0-0051': driver_bound: bound to device 'eeprom'
[   23.600284] bus: 'i2c': really_probe: bound device 0-0051 to driver eeprom
[   23.620068] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.640030] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.660010] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.680010] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.700009] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.720010] i2c-adapter i2c-0: Transaction failed (0x10)!
[   23.720057] device: 'i2c-0': device_add
[   23.720362] i2c-adapter i2c-0: nForce2 SMBus adapter at 0x4c00
[   23.720377] device: 'i2c-1': device_add
[   23.740111] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.760034] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.780012] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.800010] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.820010] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.840009] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.860009] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.880009] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.900010] i2c-adapter i2c-1: Transaction failed (0x10)!
[   23.900027] device: 'i2c-1': device_add
[   23.900284] i2c-adapter i2c-1: nForce2 SMBus adapter at 0x4c40
[   23.900309] driver: '0000:00:01.1': driver_bound: bound to device 'nForce2_smbus'
[   23.900316] bus: 'pci': really_probe: bound device 0000:00:01.1 to driver nForce2_smbus
[   23.900560] initcall nforce2_init+0x0/0x42 returned 0 after 400390 usecs
[   23.900566] calling  i2c_piix4_init+0x0/0x42 @ 1
[   23.900585] bus: 'pci': add driver piix4_smbus
[   23.900849] initcall i2c_piix4_init+0x0/0x42 returned 0 after 0 usecs
[   23.900854] calling  i2c_sis5595_init+0x0/0x42 @ 1
[   23.900861] bus: 'pci': add driver sis5595_smbus
[   23.901126] initcall i2c_sis5595_init+0x0/0x42 returned 0 after 0 usecs
[   23.901131] calling  i2c_sis630_init+0x0/0x42 @ 1
[   23.901138] bus: 'pci': add driver sis630_smbus
[   23.901370] initcall i2c_sis630_init+0x0/0x42 returned 0 after 0 usecs
[   23.901375] calling  i2c_sis96x_init+0x0/0x42 @ 1
[   23.901382] bus: 'pci': add driver sis96x_smbus
[   23.901649] initcall i2c_sis96x_init+0x0/0x42 returned 0 after 0 usecs
[   23.901653] calling  ocores_i2c_init+0x0/0x39 @ 1
[   23.901660] bus: 'platform': add driver ocores-i2c
[   23.901889] initcall ocores_i2c_init+0x0/0x39 returned 0 after 0 usecs
[   23.901894] calling  i2c_adap_simtec_init+0x0/0x39 @ 1
[   23.901898] bus: 'platform': add driver simtec-i2c
[   23.902143] initcall i2c_adap_simtec_init+0x0/0x39 returned 0 after 0 usecs
[   23.902148] calling  i2c_parport_init+0x0/0x171 @ 1
[   23.902151] i2c-parport-light: adapter type unspecified
[   23.902156] initcall i2c_parport_init+0x0/0x171 returned -19 after 0 usecs
[   23.902160] calling  taos_init+0x0/0x42 @ 1
[   23.902166] bus: 'serio': add driver taos-evm
[   23.902387] initcall taos_init+0x0/0x42 returned 0 after 0 usecs
[   23.902391] calling  tsl2550_init+0x0/0x3b @ 1
[   23.902395] bus: 'i2c': add driver tsl2550
[   23.902643] initcall tsl2550_init+0x0/0x3b returned 0 after 0 usecs
[   23.902648] calling  videodev_init+0x0/0xad @ 1
[   23.902651] Linux video capture interface: v2.00
[   23.902657] device class 'video4linux': registering
[   23.902872] initcall videodev_init+0x0/0xad returned 0 after 0 usecs
[   23.902877] calling  dabusb_init+0x0/0x11b @ 1
[   23.902993] bus: 'usb': add driver dabusb
[   23.903247] usbcore: registered new interface driver dabusb
[   23.903253] dabusb: v1.54:DAB-USB Interface Driver for Linux (c)1999
[   23.903259] initcall dabusb_init+0x0/0x11b returned 0 after 0 usecs
[   23.903264] calling  gemtek_pci_init+0x0/0x42 @ 1
[   23.903281] bus: 'pci': add driver gemtek_pci
[   23.903564] initcall gemtek_pci_init+0x0/0x42 returned 0 after 0 usecs
[   23.903569] calling  maestro_radio_init+0x0/0x5e @ 1
[   23.903576] bus: 'pci': add driver maestro_radio
[   23.903842] initcall maestro_radio_init+0x0/0x5e returned 0 after 0 usecs
[   23.903847] calling  dsbr100_init+0x0/0x5a @ 1
[   23.903854] bus: 'usb': add driver dsbr100
[   23.904063] usbcore: registered new interface driver dsbr100
[   23.904070] dsbr100: v0.46:D-Link DSB-R100 USB FM radio driver
[   23.904075] initcall dsbr100_init+0x0/0x5a returned 0 after 0 usecs
[   23.904080] calling  tea5764_init+0x0/0x53 @ 1
[   23.904085] bus: 'i2c': add driver radio-tea5764
[   23.904343] radio_tea5764: v0.01: A driver for the TEA5764 radio chip for EZX Phones.
[   23.904349] initcall tea5764_init+0x0/0x53 returned 0 after 0 usecs
[   23.904355] calling  w1_init+0x0/0xcd @ 1
[   23.904357] Driver for 1-wire Dallas network protocol.
[   23.904602] bus: 'w1': registered
[   23.904606] bus: 'w1': add driver w1_master_driver
[   23.904867] bus: 'w1': add driver w1_slave_driver
[   23.905126] initcall w1_init+0x0/0xcd returned 0 after 0 usecs
[   23.905131] calling  matrox_w1_init+0x0/0x42 @ 1
[   23.905144] bus: 'pci': add driver matrox_w1
[   23.905432] initcall matrox_w1_init+0x0/0x42 returned 0 after 0 usecs
[   23.905437] calling  ds_init+0x0/0x65 @ 1
[   23.905445] bus: 'usb': add driver DS9490R
[   23.905664] usbcore: registered new interface driver DS9490R
[   23.905675] initcall ds_init+0x0/0x65 returned 0 after 0 usecs
[   23.905679] calling  sensors_ds2482_init+0x0/0x3b @ 1
[   23.905684] bus: 'i2c': add driver ds2482
[   23.905953] initcall sensors_ds2482_init+0x0/0x3b returned 0 after 0 usecs
[   23.905957] calling  w1_therm_init+0x0/0x5b @ 1
[   23.906032] initcall w1_therm_init+0x0/0x5b returned 0 after 0 usecs
[   23.906036] calling  w1_smem_init+0x0/0x65 @ 1
[   23.906041] initcall w1_smem_init+0x0/0x65 returned 0 after 0 usecs
[   23.906045] calling  w1_f2d_init+0x0/0x39 @ 1
[   23.906049] initcall w1_f2d_init+0x0/0x39 returned 0 after 0 usecs
[   23.906053] calling  w1_ds2760_init+0x0/0x51 @ 1
[   23.906055] 1-Wire driver for the DS2760 battery monitor  chip  - (c) 2004-2005, Szabolcs Gyurko
[   23.906061] initcall w1_ds2760_init+0x0/0x51 returned 0 after 0 usecs
[   23.906065] calling  w1_bq27000_init+0x0/0x49 @ 1
[   23.906069] initcall w1_bq27000_init+0x0/0x49 returned -17 after 0 usecs
[   23.906074] initcall w1_bq27000_init+0x0/0x49 returned with error code -17 
[   23.906078] calling  pda_power_init+0x0/0x39 @ 1
[   23.906084] bus: 'platform': add driver pda-power
[   23.906308] initcall pda_power_init+0x0/0x39 returned 0 after 0 usecs
[   23.906312] calling  ds2760_battery_init+0x0/0x39 @ 1
[   23.906316] bus: 'platform': add driver ds2760-battery
[   23.906595] initcall ds2760_battery_init+0x0/0x39 returned 0 after 0 usecs
[   23.906600] calling  bq27x00_battery_init+0x0/0x57 @ 1
[   23.906605] bus: 'i2c': add driver bq27200-battery
[   23.906817] initcall bq27x00_battery_init+0x0/0x57 returned 0 after 0 usecs
[   23.906822] calling  da903x_battery_init+0x0/0x3e @ 1
[   23.906827] bus: 'platform': add driver da903x-battery
[   23.907070] initcall da903x_battery_init+0x0/0x3e returned 0 after 0 usecs
[   23.907075] calling  max17040_init+0x0/0x3b @ 1
[   23.907078] bus: 'i2c': add driver max17040
[   23.907291] initcall max17040_init+0x0/0x3b returned 0 after 0 usecs
[   23.907295] calling  pcipcwd_init_module+0x0/0x5c @ 1
[   23.907313] bus: 'pci': add driver pcwd_pci
[   23.907592] initcall pcipcwd_init_module+0x0/0x5c returned 0 after 0 usecs
[   23.907596] calling  wdtpci_init+0x0/0x42 @ 1
[   23.907603] bus: 'pci': add driver wdt_pci
[   23.907864] initcall wdtpci_init+0x0/0x42 returned 0 after 0 usecs
[   23.907868] calling  usb_pcwd_init+0x0/0x70 @ 1
[   23.907879] bus: 'usb': add driver pcwd_usb
[   23.908125] usbcore: registered new interface driver pcwd_usb
[   23.908131] pcwd_usb: Berkshire USB-PC Watchdog driver v1.02
[   23.908136] initcall usb_pcwd_init+0x0/0x70 returned 0 after 0 usecs
[   23.908142] calling  twl4030_wdt_init+0x0/0x3e @ 1
[   23.908147] bus: 'platform': add driver twl4030_wdt
[   23.908361] initcall twl4030_wdt_init+0x0/0x3e returned 0 after 0 usecs
[   23.908365] calling  advwdt_init+0x0/0x83 @ 1
[   23.908368] WDT driver for Advantech single board computer initialising.
[   23.908372] bus: 'platform': add driver advantechwdt
[   23.908622] Registering platform device 'advantechwdt'. Parent at platform
[   23.908628] device: 'advantechwdt': device_add
[   23.908641] bus: 'platform': add device advantechwdt
[   23.908881] bus: 'platform': driver_probe_device: matched device advantechwdt with driver advantechwdt
[   23.908886] bus: 'platform': really_probe: probing driver advantechwdt with device advantechwdt
[   23.908908] device: 'watchdog': device_add
[   23.909178] advantechwdt: initialized. timeout=60 sec (nowayout=1)
[   23.909182] driver: 'advantechwdt': driver_bound: bound to device 'advantechwdt'
[   23.909186] bus: 'platform': really_probe: bound device advantechwdt to driver advantechwdt
[   23.909195] initcall advwdt_init+0x0/0x83 returned 0 after 0 usecs
[   23.909199] calling  watchdog_init+0x0/0x18d @ 1
[   23.909223] initcall watchdog_init+0x0/0x18d returned -19 after 0 usecs
[   23.909227] calling  alim7101_wdt_init+0x0/0x1b7 @ 1
[   23.909229] alim7101_wdt: Steve Hill <steve@navaho.co.uk>.
[   23.909239] alim7101_wdt: ALi M7101 PMU not present - WDT not set
[   23.909243] initcall alim7101_wdt_init+0x0/0x1b7 returned -16 after 0 usecs
[   23.909246] initcall alim7101_wdt_init+0x0/0x1b7 returned with error code -16 
[   23.909250] calling  wafwdt_init+0x0/0x18e @ 1
[   23.909252] WDT driver for Wafer 5823 single board computer initialising.
[   23.909259] Wafer 5823 WDT: I/O address 0x0443 already in use
[   23.909265] initcall wafwdt_init+0x0/0x18e returned -5 after 0 usecs
[   23.909268] initcall wafwdt_init+0x0/0x18e returned with error code -5 
[   23.909272] calling  watchdog_init+0x0/0x8a @ 1
[   23.909274] i6300ESB timer: Intel 6300ESB WatchDog Timer Driver v0.04
[   23.909278] bus: 'platform': add driver i6300ESB timer
[   23.909525] Registering platform device 'i6300ESB timer'. Parent at platform
[   23.909530] device: 'i6300ESB timer': device_add
[   23.909541] bus: 'platform': add device i6300ESB timer
[   23.909803] bus: 'platform': driver_probe_device: matched device i6300ESB timer with driver i6300ESB timer
[   23.909808] bus: 'platform': really_probe: probing driver i6300ESB timer with device i6300ESB timer
[   23.909849] initcall watchdog_init+0x0/0x8a returned 0 after 0 usecs
[   23.909853] calling  iTCO_wdt_init_module+0x0/0x8a @ 1
[   23.909855] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.05
[   23.909859] bus: 'platform': add driver iTCO_wdt
[   23.910131] Registering platform device 'iTCO_wdt'. Parent at platform
[   23.910137] device: 'iTCO_wdt': device_add
[   23.910148] bus: 'platform': add device iTCO_wdt
[   23.910399] bus: 'platform': driver_probe_device: matched device iTCO_wdt with driver iTCO_wdt
[   23.910403] bus: 'platform': really_probe: probing driver iTCO_wdt with device iTCO_wdt
[   23.910497] iTCO_wdt: No card detected
[   23.910514] initcall iTCO_wdt_init_module+0x0/0x8a returned 0 after 9765 usecs
[   23.910518] calling  it87_wdt_init+0x0/0x4ee @ 1
[   23.910597] IT87 WDT: Unsupported Chip found, Chip 8712 Revision 07
[   23.910601] initcall it87_wdt_init+0x0/0x4ee returned -19 after 0 usecs
[   23.910605] calling  hpwdt_init+0x0/0x42 @ 1
[   23.910626] bus: 'pci': add driver hpwdt
[   23.910923] initcall hpwdt_init+0x0/0x42 returned 0 after 0 usecs
[   23.910927] calling  pc87413_init+0x0/0xb5 @ 1
[   23.910930] pc87413 WDT: Version 1.1 at io 0x2E
[   23.910934] pc87413 WDT: cannot register miscdev on minor=130 (err=-16)
[   23.910939] initcall pc87413_init+0x0/0xb5 returned -16 after 0 usecs
[   23.910943] initcall pc87413_init+0x0/0xb5 returned with error code -16 
[   23.910947] calling  sbc60xxwdt_init+0x0/0x1ab @ 1
[   23.910955] sbc60xxwdt: I/O address 0x0443 already in use
[   23.910959] initcall sbc60xxwdt_init+0x0/0x1ab returned -5 after 0 usecs
[   23.910964] initcall sbc60xxwdt_init+0x0/0x1ab returned with error code -5 
[   23.910968] calling  sbc8360_init+0x0/0x1ca @ 1
[   23.910973] sbc8360: failed to register misc device
[   23.910981] initcall sbc8360_init+0x0/0x1ca returned -16 after 0 usecs
[   23.910985] initcall sbc8360_init+0x0/0x1ca returned with error code -16 
[   23.910989] calling  sch311x_wdt_init+0x0/0x176 @ 1
[   23.911017] initcall sch311x_wdt_init+0x0/0x176 returned -19 after 0 usecs
[   23.911022] calling  wb_smsc_wdt_init+0x0/0x1de @ 1
[   23.911024] SMsC 37B787 watchdog component driver 1.1 initialising...
[   23.912089] smsc37b787_wdt: Unable to register miscdev on minor 130
[   23.912096] initcall wb_smsc_wdt_init+0x0/0x1de returned -16 after 0 usecs
[   23.912100] initcall wb_smsc_wdt_init+0x0/0x1de returned with error code -16 
[   23.912105] calling  w83877f_wdt_init+0x0/0x183 @ 1
[   23.912111] w83877f_wdt: I/O address 0x0443 already in use
[   23.912118] initcall w83877f_wdt_init+0x0/0x183 returned -5 after 0 usecs
[   23.912122] initcall w83877f_wdt_init+0x0/0x183 returned with error code -5 
[   23.912126] calling  watchdog_init+0x0/0xde @ 1
[   23.912131] epx_c3: cannot register miscdev on minor=130 (err=-16)
[   23.912137] initcall watchdog_init+0x0/0xde returned -16 after 0 usecs
[   23.912141] initcall watchdog_init+0x0/0xde returned with error code -16 
[   23.912145] calling  watchdog_init+0x0/0xdb @ 1
[   23.912148] SoftDog: cannot register miscdev on minor=130 (err=-16)
[   23.912153] initcall watchdog_init+0x0/0xdb returned -16 after 0 usecs
[   23.912157] initcall watchdog_init+0x0/0xdb returned with error code -16 
[   23.912161] calling  telephony_init+0x0/0x71 @ 1
[   23.912163] Linux telephony interface: v1.00
[   23.912175] initcall telephony_init+0x0/0x71 returned 0 after 0 usecs
[   23.912178] calling  vhci_init+0x0/0x73 @ 1
[   23.912181] Bluetooth: Virtual HCI driver ver 1.3
[   23.912191] device: 'vhci': device_add
[   23.912476] initcall vhci_init+0x0/0x73 returned 0 after 0 usecs
[   23.912480] calling  hci_uart_init+0x0/0x109 @ 1
[   23.912483] Bluetooth: HCI UART driver ver 2.2
[   23.912486] Bluetooth: HCI H4 protocol initialized
[   23.912489] Bluetooth: HCILL protocol initialized
[   23.912493] initcall hci_uart_init+0x0/0x109 returned 0 after 0 usecs
[   23.912497] calling  bpa10x_init+0x0/0x55 @ 1
[   23.912499] Bluetooth: Digianswer Bluetooth USB driver ver 0.10
[   23.912510] bus: 'usb': add driver bpa10x
[   23.912728] usbcore: registered new interface driver bpa10x
[   23.912737] initcall bpa10x_init+0x0/0x55 returned 0 after 0 usecs
[   23.912741] calling  bfusb_init+0x0/0x78 @ 1
[   23.912743] Bluetooth: BlueFRITZ! USB driver ver 1.2
[   23.912748] bus: 'usb': add driver bfusb
[   23.912992] usbcore: registered new interface driver bfusb
[   23.913000] initcall bfusb_init+0x0/0x78 returned 0 after 0 usecs
[   23.913004] calling  btusb_init+0x0/0x55 @ 1
[   23.913007] Bluetooth: Generic Bluetooth USB driver ver 0.5
[   23.913012] bus: 'usb': add driver btusb
[   23.913235] usbcore: registered new interface driver btusb
[   23.913244] initcall btusb_init+0x0/0x55 returned 0 after 0 usecs
[   23.913248] calling  btsdio_init+0x0/0x4c @ 1
[   23.913250] Bluetooth: Generic Bluetooth SDIO driver ver 0.1
[   23.913255] bus: 'sdio': add driver btsdio
[   23.913508] initcall btsdio_init+0x0/0x4c returned 0 after 0 usecs
[   23.913513] calling  isdn_init+0x0/0x35c @ 1
[   23.916520] ISDN subsystem Rev: 1.1.2.3/1.1.2.3/1.1.2.2/1.1.2.3/none/1.1.2.2
[   23.916536] initcall isdn_init+0x0/0x35c returned 0 after 0 usecs
[   23.916540] calling  isdn_bsdcomp_init+0x0/0x55 @ 1
[   23.916542] PPP BSD Compression module registered
[   23.916546] initcall isdn_bsdcomp_init+0x0/0x55 returned 0 after 0 usecs
[   23.916549] calling  divert_init+0x0/0x8a @ 1
[   23.916583] dss1_divert module successfully installed
[   23.916587] initcall divert_init+0x0/0x8a returned 0 after 0 usecs
[   23.916590] calling  cpufreq_stats_init+0x0/0xca @ 1
[   23.916669] initcall cpufreq_stats_init+0x0/0xca returned 0 after 0 usecs
[   23.916673] calling  cpufreq_gov_userspace_init+0x0/0x39 @ 1
[   23.916678] initcall cpufreq_gov_userspace_init+0x0/0x39 returned 0 after 0 usecs
[   23.916682] calling  cpufreq_gov_dbs_init+0x0/0xd5 @ 1
[   23.921086] initcall cpufreq_gov_dbs_init+0x0/0xd5 returned 0 after 9765 usecs
[   23.921091] calling  i7300_idle_init+0x0/0x649 @ 1
[   23.921183] initcall i7300_idle_init+0x0/0x649 returned -19 after 0 usecs
[   23.921187] calling  mmc_test_init+0x0/0x39 @ 1
[   23.921192] bus: 'mmc': add driver mmc_test
[   23.923942] initcall mmc_test_init+0x0/0x39 returned 0 after 0 usecs
[   23.923947] calling  sdio_uart_init+0x0/0x11a @ 1
[   23.923979] bus: 'sdio': add driver sdio_uart
[   23.924202] initcall sdio_uart_init+0x0/0x11a returned 0 after 0 usecs
[   23.924207] calling  wbsd_drv_init+0x0/0xb5 @ 1
[   23.924209] wbsd: Winbond W83L51xD SD/MMC card interface driver
[   23.924212] wbsd: Copyright(c) Pierre Ossman
[   23.924220] bus: 'platform': add driver wbsd
[   23.924478] Registering platform device 'wbsd'. Parent at platform
[   23.924484] device: 'wbsd': device_add
[   23.924498] bus: 'platform': add device wbsd
[   23.924725] bus: 'platform': driver_probe_device: matched device wbsd with driver wbsd
[   23.924729] bus: 'platform': really_probe: probing driver wbsd with device wbsd
[   23.924965] initcall wbsd_drv_init+0x0/0xb5 returned 0 after 0 usecs
[   23.924969] calling  memstick_init+0x0/0xab @ 1
[   23.925344] bus: 'memstick': registered
[   23.925347] device class 'memstick_host': registering
[   23.925592] initcall memstick_init+0x0/0xab returned 0 after 0 usecs
[   23.925597] calling  tifm_ms_init+0x0/0x39 @ 1
[   23.925601] bus: 'tifm': add driver tifm_ms
[   23.925821] initcall tifm_ms_init+0x0/0x39 returned 0 after 0 usecs
[   23.925825] calling  bd2802_init+0x0/0x3b @ 1
[   23.925831] bus: 'i2c': add driver BD2802
[   23.926080] initcall bd2802_init+0x0/0x3b returned 0 after 0 usecs
[   23.926085] calling  alix_led_init+0x0/0x132 @ 1
[   23.931221] initcall alix_led_init+0x0/0x132 returned -19 after 9765 usecs
[   23.931225] calling  pca9532_init+0x0/0x3b @ 1
[   23.931229] bus: 'i2c': add driver pca9532
[   23.931449] initcall pca9532_init+0x0/0x3b returned 0 after 0 usecs
[   23.931453] calling  gpio_led_init+0x0/0x2d @ 1
[   23.931457] initcall gpio_led_init+0x0/0x2d returned 0 after 0 usecs
[   23.931461] calling  dac124s085_leds_init+0x0/0x39 @ 1
[   23.931467] bus: 'spi': add driver dac124s085
[   23.931710] initcall dac124s085_leds_init+0x0/0x39 returned 0 after 0 usecs
[   23.931715] calling  timer_trig_init+0x0/0x39 @ 1
[   23.931723] initcall timer_trig_init+0x0/0x39 returned 0 after 0 usecs
[   23.931727] calling  heartbeat_trig_init+0x0/0x39 @ 1
[   23.931733] initcall heartbeat_trig_init+0x0/0x39 returned 0 after 0 usecs
[   23.931737] calling  gpio_trig_init+0x0/0x39 @ 1
[   23.931742] initcall gpio_trig_init+0x0/0x39 returned 0 after 0 usecs
[   23.931746] calling  ib_core_init+0x0/0x6a @ 1
[   23.931748] device class 'infiniband': registering
[   23.931998] initcall ib_core_init+0x0/0x6a returned 0 after 0 usecs
[   23.932002] calling  ib_mad_init_module+0x0/0xca @ 1
[   23.932521] initcall ib_mad_init_module+0x0/0xca returned 0 after 0 usecs
[   23.932525] calling  ib_sa_init+0x0/0xc1 @ 1
[   23.932625] initcall ib_sa_init+0x0/0xc1 returned 0 after 0 usecs
[   23.932629] calling  ib_cm_init+0x0/0x180 @ 1
[   23.932703] device class 'infiniband_cm': registering
[   23.950396] initcall ib_cm_init+0x0/0x180 returned 0 after 19531 usecs
[   23.950402] calling  iw_cm_init+0x0/0x5c @ 1
[   23.950487] initcall iw_cm_init+0x0/0x5c returned 0 after 0 usecs
[   23.950492] calling  addr_init+0x0/0x6d @ 1
[   23.950628] initcall addr_init+0x0/0x6d returned 0 after 0 usecs
[   23.950632] calling  cma_init+0x0/0x108 @ 1
[   23.950731] initcall cma_init+0x0/0x108 returned 0 after 0 usecs
[   23.950735] calling  mthca_init+0x0/0x1a7 @ 1
[   23.950837] bus: 'pci': add driver ib_mthca
[   23.951197] initcall mthca_init+0x0/0x1a7 returned 0 after 0 usecs
[   23.951201] calling  infinipath_init+0x0/0xe9 @ 1
[   23.951255] bus: 'pci': add driver ib_ipath
[   23.951511] initcall infinipath_init+0x0/0xe9 returned 0 after 0 usecs
[   23.951515] calling  c2_init_module+0x0/0x42 @ 1
[   23.951522] bus: 'pci': add driver c2
[   23.951801] initcall c2_init_module+0x0/0x42 returned 0 after 0 usecs
[   23.951805] calling  nes_init_module+0x0/0x17f @ 1
[   23.952051] bus: 'pci': add driver iw_nes
[   23.952328] initcall nes_init_module+0x0/0x17f returned 0 after 0 usecs
[   23.952333] calling  ipoib_init_module+0x0/0x12d @ 1
[   23.952464] initcall ipoib_init_module+0x0/0x12d returned 0 after 0 usecs
[   23.952469] calling  srp_init_module+0x0/0x116 @ 1
[   23.952479] device class 'infiniband_srp': registering
[   23.952705] initcall srp_init_module+0x0/0x116 returned 0 after 0 usecs
[   23.952710] calling  dcdrbu_init+0x0/0x169 @ 1
[   23.952733] Registering platform device 'dell_rbu'. Parent at platform
[   23.952747] device: 'dell_rbu': device_add
[   23.952762] bus: 'platform': add device dell_rbu
[   23.953051] initcall dcdrbu_init+0x0/0x169 returned 0 after 0 usecs
[   23.953056] calling  dcdbas_init+0x0/0x8d @ 1
[   23.953063] bus: 'platform': add driver dcdbas
[   23.953284] Registering platform device 'dcdbas'. Parent at platform
[   23.953289] device: 'dcdbas': device_add
[   23.953300] bus: 'platform': add device dcdbas
[   23.953552] bus: 'platform': driver_probe_device: matched device dcdbas with driver dcdbas
[   23.953556] bus: 'platform': really_probe: probing driver dcdbas with device dcdbas
[   23.953586] dcdbas dcdbas: Dell Systems Management Base Driver (version 5.6.0-3.2)
[   23.953590] driver: 'dcdbas': driver_bound: bound to device 'dcdbas'
[   23.953594] bus: 'platform': really_probe: bound device dcdbas to driver dcdbas
[   23.953602] initcall dcdbas_init+0x0/0x8d returned 0 after 0 usecs
[   23.953605] calling  hifn_init+0x0/0x3e @ 1
[   23.953607] HIFN supports only 32-bit addresses.
[   23.953611] initcall hifn_init+0x0/0x3e returned -22 after 0 usecs
[   23.953614] initcall hifn_init+0x0/0x3e returned with error code -22 
[   23.953618] calling  ioat_init_module+0x0/0x42 @ 1
[   23.953633] bus: 'pci': add driver ioatdma
[   23.953892] initcall ioat_init_module+0x0/0x42 returned 0 after 0 usecs
[   23.953897] calling  hid_init+0x0/0x55 @ 1
[   23.954173] bus: 'hid': registered
[   23.954177] initcall hid_init+0x0/0x55 returned 0 after 0 usecs
[   23.954183] calling  apple_init+0x0/0x63 @ 1
[   23.954187] bus: 'hid': add driver apple
[   23.954396] initcall apple_init+0x0/0x63 returned 0 after 0 usecs
[   23.954401] calling  belkin_init+0x0/0x47 @ 1
[   23.954404] bus: 'hid': add driver belkin
[   23.954648] initcall belkin_init+0x0/0x47 returned 0 after 0 usecs
[   23.954652] calling  ch_init+0x0/0x47 @ 1
[   23.954656] bus: 'hid': add driver cherry
[   23.954864] initcall ch_init+0x0/0x47 returned 0 after 0 usecs
[   23.954869] calling  dr_init+0x0/0x42 @ 1
[   23.954872] bus: 'hid': add driver dragonrise
[   23.955141] initcall dr_init+0x0/0x42 returned 0 after 0 usecs
[   23.955145] calling  ez_init+0x0/0x47 @ 1
[   23.955149] bus: 'hid': add driver ezkey
[   23.955368] initcall ez_init+0x0/0x47 returned 0 after 0 usecs
[   23.955372] calling  gyration_init+0x0/0x47 @ 1
[   23.955376] bus: 'hid': add driver gyration
[   23.955619] initcall gyration_init+0x0/0x47 returned 0 after 0 usecs
[   23.955623] calling  ks_init+0x0/0x47 @ 1
[   23.955627] bus: 'hid': add driver kensington
[   23.955837] initcall ks_init+0x0/0x47 returned 0 after 0 usecs
[   23.955841] calling  lg_init+0x0/0x47 @ 1
[   23.955845] bus: 'hid': add driver logitech
[   23.956087] initcall lg_init+0x0/0x47 returned 0 after 0 usecs
[   23.956092] calling  ms_init+0x0/0x47 @ 1
[   23.956096] bus: 'hid': add driver microsoft
[   23.956318] initcall ms_init+0x0/0x47 returned 0 after 0 usecs
[   23.956322] calling  mr_init+0x0/0x47 @ 1
[   23.956326] bus: 'hid': add driver monterey
[   23.956578] initcall mr_init+0x0/0x47 returned 0 after 0 usecs
[   23.956583] calling  ntrig_init+0x0/0x47 @ 1
[   23.956587] bus: 'hid': add driver ntrig
[   23.956808] initcall ntrig_init+0x0/0x47 returned 0 after 0 usecs
[   23.956812] calling  sony_init+0x0/0x47 @ 1
[   23.956816] bus: 'hid': add driver sony
[   23.957073] initcall sony_init+0x0/0x47 returned 0 after 0 usecs
[   23.957078] calling  sp_init+0x0/0x47 @ 1
[   23.957082] bus: 'hid': add driver sunplus
[   23.957292] initcall sp_init+0x0/0x47 returned 0 after 0 usecs
[   23.957296] calling  tm_init+0x0/0x47 @ 1
[   23.957300] bus: 'hid': add driver thrustmaster
[   23.957577] initcall tm_init+0x0/0x47 returned 0 after 0 usecs
[   23.957581] calling  ts_init+0x0/0x47 @ 1
[   23.957585] bus: 'hid': add driver topseed
[   23.957793] initcall ts_init+0x0/0x47 returned 0 after 0 usecs
[   23.957798] calling  zp_init+0x0/0x47 @ 1
[   23.957801] bus: 'hid': add driver zeroplus
[   23.958064] initcall zp_init+0x0/0x47 returned 0 after 0 usecs
[   23.958068] calling  wacom_init+0x0/0x71 @ 1
[   23.958072] bus: 'hid': add driver wacom
[   23.958278] wacom driver registered
[   23.958283] initcall wacom_init+0x0/0x71 returned 0 after 0 usecs
[   23.958288] calling  hid_init+0x0/0xf1 @ 1
[   23.958419] bus: 'hid': add driver generic-usb
[   23.958688] bus: 'usb': add driver hiddev
[   23.958943] usbcore: registered new interface driver hiddev
[   23.958963] bus: 'usb': add driver usbhid
[   23.959171] usbcore: registered new interface driver usbhid
[   23.959177] usbhid: v2.6:USB HID core driver
[   23.959183] initcall hid_init+0x0/0xf1 returned 0 after 0 usecs
[   23.959187] calling  usb_mouse_init+0x0/0x5e @ 1
[   23.959192] bus: 'usb': add driver usbmouse
[   23.959444] usbcore: registered new interface driver usbmouse
[   23.959451] usbmouse: v1.6:USB HID Boot Protocol mouse driver
[   23.959456] initcall usb_mouse_init+0x0/0x5e returned 0 after 0 usecs
[   23.959460] calling  virtio_pci_init+0x0/0x7b @ 1
[   23.959471] device: 'virtio-pci': device_add
[   23.959505] bus: 'pci': add driver virtio-pci
[   23.959766] initcall virtio_pci_init+0x0/0x7b returned 0 after 0 usecs
[   23.959770] calling  dell_init+0x0/0x32 @ 1
[   23.959774] initcall dell_init+0x0/0x32 returned -19 after 0 usecs
[   23.959778] calling  init_soundcore+0x0/0xa5 @ 1
[   23.959791] device class 'sound': registering
[   23.960111] initcall init_soundcore+0x0/0xa5 returned 0 after 9765 usecs
[   23.960116] calling  alsa_sound_init+0x0/0xba @ 1
[   23.960281] Advanced Linux Sound Architecture Driver Version 1.0.20.
[   23.960287] initcall alsa_sound_init+0x0/0xba returned 0 after 0 usecs
[   23.960291] calling  alsa_hwdep_init+0x0/0x8a @ 1
[   23.960343] initcall alsa_hwdep_init+0x0/0x8a returned 0 after 0 usecs
[   23.960348] calling  alsa_timer_init+0x0/0x1a6 @ 1
[   23.960405] device: 'timer': device_add
[   23.960715] initcall alsa_timer_init+0x0/0x1a6 returned 0 after 0 usecs
[   23.960720] calling  rtctimer_init+0x0/0x148 @ 1
[   23.960728] initcall rtctimer_init+0x0/0x148 returned 0 after 0 usecs
[   23.960732] calling  alsa_pcm_init+0x0/0x92 @ 1
[   23.960749] initcall alsa_pcm_init+0x0/0x92 returned 0 after 0 usecs
[   23.960753] calling  snd_mem_init+0x0/0x53 @ 1
[   23.960767] initcall snd_mem_init+0x0/0x53 returned 0 after 0 usecs
[   23.960771] calling  alsa_rawmidi_init+0x0/0xcb @ 1
[   23.960778] initcall alsa_rawmidi_init+0x0/0xcb returned 0 after 0 usecs
[   23.960782] calling  alsa_mixer_oss_init+0x0/0x63 @ 1
[   23.960787] initcall alsa_mixer_oss_init+0x0/0x63 returned 0 after 0 usecs
[   23.960791] calling  alsa_pcm_oss_init+0x0/0xc8 @ 1
[   23.960809] initcall alsa_pcm_oss_init+0x0/0xc8 returned 0 after 0 usecs
[   23.960813] calling  alsa_akm4xxx_module_init+0x0/0x2d @ 1
[   23.960818] initcall alsa_akm4xxx_module_init+0x0/0x2d returned 0 after 0 usecs
[   23.960822] calling  alsa_tea575x_module_init+0x0/0x2d @ 1
[   23.960827] initcall alsa_tea575x_module_init+0x0/0x2d returned 0 after 0 usecs
[   23.960831] calling  alsa_i2c_init+0x0/0x2d @ 1
[   23.960835] initcall alsa_i2c_init+0x0/0x2d returned 0 after 0 usecs
[   23.960839] calling  alsa_opl3_init+0x0/0x2d @ 1
[   23.960843] initcall alsa_opl3_init+0x0/0x2d returned 0 after 0 usecs
[   23.960848] calling  alsa_mpu401_uart_init+0x0/0x2d @ 1
[   23.960852] initcall alsa_mpu401_uart_init+0x0/0x2d returned 0 after 0 usecs
[   23.960856] calling  alsa_sb_common_init+0x0/0x2d @ 1
[   23.960860] initcall alsa_sb_common_init+0x0/0x2d returned 0 after 0 usecs
[   23.960865] calling  alsa_sb16_init+0x0/0x2d @ 1
[   23.960869] initcall alsa_sb16_init+0x0/0x2d returned 0 after 0 usecs
[   23.960873] calling  alsa_ad1889_init+0x0/0x42 @ 1
[   23.960890] bus: 'pci': add driver AD1889 Audio
[   23.961234] initcall alsa_ad1889_init+0x0/0x42 returned 0 after 0 usecs
[   23.961238] calling  alsa_card_als4000_init+0x0/0x42 @ 1
[   23.961247] bus: 'pci': add driver ALS4000
[   23.961481] initcall alsa_card_als4000_init+0x0/0x42 returned 0 after 0 usecs
[   23.961486] calling  alsa_card_atiixp_init+0x0/0x42 @ 1
[   23.961493] bus: 'pci': add driver ATI IXP MC97 controller
[   23.961757] initcall alsa_card_atiixp_init+0x0/0x42 returned 0 after 0 usecs
[   23.961762] calling  alsa_card_bt87x_init+0x0/0x56 @ 1
[   23.961770] bus: 'pci': add driver Bt87x
[   23.962006] initcall alsa_card_bt87x_init+0x0/0x56 returned 0 after 0 usecs
[   23.962011] calling  alsa_card_cmipci_init+0x0/0x42 @ 1
[   23.962019] bus: 'pci': add driver C-Media PCI
[   23.962307] initcall alsa_card_cmipci_init+0x0/0x42 returned 0 after 0 usecs
[   23.962312] calling  alsa_card_cs5530_init+0x0/0x42 @ 1
[   23.962319] bus: 'pci': add driver CS5530_Audio
[   23.962555] initcall alsa_card_cs5530_init+0x0/0x42 returned 0 after 0 usecs
[   23.962560] calling  alsa_card_es1968_init+0x0/0x42 @ 1
[   23.962568] bus: 'pci': add driver ES1968 (ESS Maestro)
[   23.962857] initcall alsa_card_es1968_init+0x0/0x42 returned 0 after 0 usecs
[   23.962862] calling  alsa_card_fm801_init+0x0/0x42 @ 1
[   23.962870] bus: 'pci': add driver FM801
[   23.963108] initcall alsa_card_fm801_init+0x0/0x42 returned 0 after 0 usecs
[   23.963113] calling  alsa_card_intel8x0_init+0x0/0x42 @ 1
[   23.963121] bus: 'pci': add driver Intel ICH
[   23.963143] bus: 'pci': driver_probe_device: matched device 0000:00:04.0 with driver Intel ICH
[   23.963147] bus: 'pci': really_probe: probing driver Intel ICH with device 0000:00:04.0
[   23.963382] IOAPIC[0]: Set routing entry (2-3 -> 0x33 -> IRQ 3 Mode:1 Active:1)
[   23.963392] Intel ICH 0000:00:04.0: PCI->APIC IRQ transform: INT A -> IRQ 3
[   23.963441] Intel ICH 0000:00:04.0: setting latency timer to 64
[   24.300018] intel8x0_measure_ac97_clock: measured 60000 usecs (2936 samples)
[   24.300021] intel8x0: clocking to 47084
[   24.300053] device: 'pcmC0D2p': device_add
[   24.300473] device: 'pcmC0D1c': device_add
[   24.300774] device: 'adsp': device_add
[   24.301033] device: 'pcmC0D0p': device_add
[   24.301292] device: 'pcmC0D0c': device_add
[   24.301538] device: 'dsp': device_add
[   24.301809] device: 'audio': device_add
[   24.302081] device: '0-0:ALC850': device_add
[   24.302101] bus: 'ac97': add device 0-0:ALC850
[   24.302361] device: 'controlC0': device_add
[   24.302664] device: 'mixer': device_add
[   24.303581] driver: '0000:00:04.0': driver_bound: bound to device 'Intel ICH'
[   24.303588] bus: 'pci': really_probe: bound device 0000:00:04.0 to driver Intel ICH
[   24.303833] initcall alsa_card_intel8x0_init+0x0/0x42 returned 0 after 332031 usecs
[   24.303839] calling  alsa_card_m3_init+0x0/0x42 @ 1
[   24.303862] bus: 'pci': add driver Maestro3
[   24.304185] initcall alsa_card_m3_init+0x0/0x42 returned 0 after 0 usecs
[   24.304190] calling  alsa_card_rme96_init+0x0/0x42 @ 1
[   24.304198] bus: 'pci': add driver RME Digi96
[   24.304433] initcall alsa_card_rme96_init+0x0/0x42 returned 0 after 0 usecs
[   24.304438] calling  alsa_card_via82xx_init+0x0/0x42 @ 1
[   24.304445] bus: 'pci': add driver VIA 82xx Audio
[   24.304713] initcall alsa_card_via82xx_init+0x0/0x42 returned 0 after 0 usecs
[   24.304718] calling  alsa_card_via82xx_init+0x0/0x42 @ 1
[   24.304726] bus: 'pci': add driver VIA 82xx Modem
[   24.304961] initcall alsa_card_via82xx_init+0x0/0x42 returned 0 after 0 usecs
[   24.304966] calling  alsa_ac97_init+0x0/0x2d @ 1
[   24.304970] initcall alsa_ac97_init+0x0/0x2d returned 0 after 0 usecs
[   24.304974] calling  alsa_card_ali_init+0x0/0x42 @ 1
[   24.304982] bus: 'pci': add driver ALI 5451
[   24.305259] initcall alsa_card_ali_init+0x0/0x42 returned 0 after 0 usecs
[   24.305264] calling  alsa_card_vortex_init+0x0/0x42 @ 1
[   24.305272] bus: 'pci': add driver au8810
[   24.305507] initcall alsa_card_vortex_init+0x0/0x42 returned 0 after 0 usecs
[   24.305512] calling  alsa_card_vortex_init+0x0/0x42 @ 1
[   24.305520] bus: 'pci': add driver au8830
[   24.305803] initcall alsa_card_vortex_init+0x0/0x42 returned 0 after 0 usecs
[   24.305808] calling  ct_card_init+0x0/0x42 @ 1
[   24.305815] bus: 'pci': add driver SB-XFi
[   24.306052] initcall ct_card_init+0x0/0x42 returned 0 after 0 usecs
[   24.306057] calling  alsa_card_ca0106_init+0x0/0x42 @ 1
[   24.306065] bus: 'pci': add driver CA0106
[   24.306334] initcall alsa_card_ca0106_init+0x0/0x42 returned 0 after 0 usecs
[   24.306339] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.306347] bus: 'pci': add driver Echoaudio Darla20
[   24.306604] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.306609] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.306617] bus: 'pci': add driver Echoaudio Gina20
[   24.306902] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.306906] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.306915] bus: 'pci': add driver Echoaudio Darla24
[   24.307150] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.307155] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.307163] bus: 'pci': add driver Echoaudio Layla24
[   24.307453] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.307458] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.307466] bus: 'pci': add driver Echoaudio Mia
[   24.307724] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.307729] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.307738] bus: 'pci': add driver Echoaudio Echo3G
[   24.308010] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.308015] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.308023] bus: 'pci': add driver Echoaudio Indigo DJ
[   24.308256] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.308261] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.308269] bus: 'pci': add driver Echoaudio Indigo IOx
[   24.308524] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.308529] calling  alsa_card_echo_init+0x0/0x42 @ 1
[   24.308537] bus: 'pci': add driver Echoaudio Indigo DJx
[   24.308787] initcall alsa_card_echo_init+0x0/0x42 returned 0 after 0 usecs
[   24.308792] calling  alsa_card_emu10k1_init+0x0/0x42 @ 1
[   24.308801] bus: 'pci': add driver EMU10K1_Audigy
[   24.309089] initcall alsa_card_emu10k1_init+0x0/0x42 returned 0 after 0 usecs
[   24.309094] calling  alsa_card_emu10k1x_init+0x0/0x42 @ 1
[   24.309103] bus: 'pci': add driver EMU10K1X
[   24.309341] initcall alsa_card_emu10k1x_init+0x0/0x42 returned 0 after 0 usecs
[   24.309346] calling  patch_cmedia_init+0x0/0x39 @ 1
[   24.309418] initcall patch_cmedia_init+0x0/0x39 returned 0 after 0 usecs
[   24.309423] calling  patch_sigmatel_init+0x0/0x39 @ 1
[   24.309428] initcall patch_sigmatel_init+0x0/0x39 returned 0 after 0 usecs
[   24.309432] calling  patch_ca0110_init+0x0/0x39 @ 1
[   24.309437] initcall patch_ca0110_init+0x0/0x39 returned 0 after 0 usecs
[   24.309441] calling  patch_nvhdmi_init+0x0/0x39 @ 1
[   24.309446] initcall patch_nvhdmi_init+0x0/0x39 returned 0 after 0 usecs
[   24.309450] calling  patch_intelhdmi_init+0x0/0x39 @ 1
[   24.309455] initcall patch_intelhdmi_init+0x0/0x39 returned 0 after 0 usecs
[   24.309460] calling  alsa_card_azx_init+0x0/0x42 @ 1
[   24.309471] bus: 'pci': add driver HDA Intel
[   24.309769] initcall alsa_card_azx_init+0x0/0x42 returned 0 after 0 usecs
[   24.309774] calling  alsa_card_ice1724_init+0x0/0x42 @ 1
[   24.309782] bus: 'pci': add driver ICE1724
[   24.310063] initcall alsa_card_ice1724_init+0x0/0x42 returned 0 after 9765 usecs
[   24.310069] calling  alsa_ice1712_akm4xxx_module_init+0x0/0x2d @ 1
[   24.310073] initcall alsa_ice1712_akm4xxx_module_init+0x0/0x2d returned 0 after 0 usecs
[   24.310078] calling  alsa_card_mixart_init+0x0/0x42 @ 1
[   24.310088] bus: 'pci': add driver Digigram miXart
[   24.310380] initcall alsa_card_mixart_init+0x0/0x42 returned 0 after 0 usecs
[   24.310385] calling  alsa_card_nm256_init+0x0/0x42 @ 1
[   24.310394] bus: 'pci': add driver NeoMagic 256
[   24.310670] initcall alsa_card_nm256_init+0x0/0x42 returned 0 after 0 usecs
[   24.310675] calling  alsa_card_hifier_init+0x0/0x42 @ 1
[   24.310683] bus: 'pci': add driver CMI8787HiFier
[   24.310957] initcall alsa_card_hifier_init+0x0/0x42 returned 0 after 0 usecs
[   24.310962] calling  alsa_card_oxygen_init+0x0/0x42 @ 1
[   24.310971] bus: 'pci': add driver CMI8788
[   24.311221] initcall alsa_card_oxygen_init+0x0/0x42 returned 0 after 0 usecs
[   24.311226] calling  alsa_card_xonar_init+0x0/0x42 @ 1
[   24.311235] bus: 'pci': add driver AV200
[   24.311518] initcall alsa_card_xonar_init+0x0/0x42 returned 0 after 0 usecs
[   24.311523] calling  pcxhr_module_init+0x0/0x42 @ 1
[   24.311532] bus: 'pci': add driver Digigram pcxhr
[   24.311772] initcall pcxhr_module_init+0x0/0x42 returned 0 after 0 usecs
[   24.311777] calling  alsa_card_riptide_init+0x0/0x77 @ 1
[   24.311785] bus: 'pci': add driver RIPTIDE
[   24.312071] bus: 'pci': add driver Riptide Joystick
[   24.312319] initcall alsa_card_riptide_init+0x0/0x77 returned 0 after 0 usecs
[   24.312325] calling  alsa_card_hammerfall_init+0x0/0x42 @ 1
[   24.312334] bus: 'pci': add driver RME Digi9652 (Hammerfall)
[   24.312618] initcall alsa_card_hammerfall_init+0x0/0x42 returned 0 after 0 usecs
[   24.312623] calling  alsa_card_hdsp_init+0x0/0x42 @ 1
[   24.312632] bus: 'pci': add driver RME Hammerfall DSP
[   24.312897] initcall alsa_card_hdsp_init+0x0/0x42 returned 0 after 0 usecs
[   24.312902] calling  alsa_card_hdspm_init+0x0/0x42 @ 1
[   24.312911] bus: 'pci': add driver RME Hammerfall DSP MADI
[   24.313186] initcall alsa_card_hdspm_init+0x0/0x42 returned 0 after 0 usecs
[   24.313191] calling  alsa_card_trident_init+0x0/0x42 @ 1
[   24.313200] bus: 'pci': add driver Trident4DWaveAudio
[   24.313440] initcall alsa_card_trident_init+0x0/0x42 returned 0 after 0 usecs
[   24.313445] calling  alsa_card_ymfpci_init+0x0/0x42 @ 1
[   24.313453] bus: 'pci': add driver Yamaha DS-1 PCI
[   24.313736] initcall alsa_card_ymfpci_init+0x0/0x42 returned 0 after 0 usecs
[   24.313741] calling  alsa_util_mem_init+0x0/0x2d @ 1
[   24.313746] initcall alsa_util_mem_init+0x0/0x2d returned 0 after 0 usecs
[   24.313750] calling  snd_usX2Y_module_init+0x0/0x42 @ 1
[   24.313763] bus: 'usb': add driver snd-usb-usx2y
[   24.313995] usbcore: registered new interface driver snd-usb-usx2y
[   24.314005] initcall snd_usX2Y_module_init+0x0/0x42 returned 0 after 0 usecs
[   24.314009] calling  snd_module_init+0x0/0x42 @ 1
[   24.314015] bus: 'usb': add driver snd-usb-caiaq
[   24.314261] usbcore: registered new interface driver snd-usb-caiaq
[   24.314270] initcall snd_module_init+0x0/0x42 returned 0 after 0 usecs
[   24.314274] calling  snd_soc_init+0x0/0x74 @ 1
[   24.314297] bus: 'platform': add driver soc-audio
[   24.314533] initcall snd_soc_init+0x0/0x74 returned 0 after 0 usecs
[   24.314538] calling  ad73311_init+0x0/0x39 @ 1
[   24.314541] No device for DAI AD73311
[   24.314608] initcall ad73311_init+0x0/0x39 returned 0 after 0 usecs
[   24.314613] calling  ak4104_init+0x0/0x45 @ 1
[   24.314615] Asahi Kasei AK4104 ALSA SoC Codec Driver
[   24.314621] bus: 'spi': add driver ak4104
[   24.314881] initcall ak4104_init+0x0/0x45 returned 0 after 0 usecs
[   24.314886] calling  ak4535_modinit+0x0/0x39 @ 1
[   24.314889] No device for DAI AK4535
[   24.314893] initcall ak4535_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.314898] calling  cs4270_init+0x0/0x47 @ 1
[   24.314900] Cirrus Logic CS4270 ALSA SoC Codec Driver
[   24.314906] bus: 'i2c': add driver cs4270
[   24.315144] initcall cs4270_init+0x0/0x47 returned 0 after 0 usecs
[   24.315149] calling  pcm3008_init+0x0/0x39 @ 1
[   24.315151] No device for DAI PCM3008 HiFi
[   24.315156] initcall pcm3008_init+0x0/0x39 returned 0 after 0 usecs
[   24.315161] calling  dit_modinit+0x0/0x39 @ 1
[   24.315166] bus: 'platform': add driver spdif-dit
[   24.315416] initcall dit_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.315421] calling  ssm2602_modinit+0x0/0x39 @ 1
[   24.315424] No device for DAI SSM2602
[   24.315428] initcall ssm2602_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.315433] calling  tlv320aic23_modinit+0x0/0x39 @ 1
[   24.315436] No device for DAI tlv320aic23
[   24.315440] initcall tlv320aic23_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.315445] calling  aic26_init+0x0/0x39 @ 1
[   24.315449] bus: 'spi': add driver tlv320aic26
[   24.315695] initcall aic26_init+0x0/0x39 returned 0 after 0 usecs
[   24.315699] calling  aic3x_modinit+0x0/0x39 @ 1
[   24.315702] No device for DAI tlv320aic3x
[   24.315707] initcall aic3x_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.315711] calling  twl4030_modinit+0x0/0x3e @ 1
[   24.315714] No device for DAI twl4030
[   24.315717] No device for DAI twl4030 Voice
[   24.315721] initcall twl4030_modinit+0x0/0x3e returned 0 after 0 usecs
[   24.315726] calling  uda134x_init+0x0/0x39 @ 1
[   24.315728] No device for DAI UDA134X
[   24.315733] initcall uda134x_init+0x0/0x39 returned 0 after 0 usecs
[   24.315737] calling  uda1380_modinit+0x0/0x3e @ 1
[   24.315740] No device for DAI UDA1380
[   24.315743] No device for DAI UDA1380
[   24.315745] No device for DAI UDA1380
[   24.315750] initcall uda1380_modinit+0x0/0x3e returned 0 after 0 usecs
[   24.315754] calling  wm8510_modinit+0x0/0x39 @ 1
[   24.315757] No device for DAI WM8510 HiFi
[   24.315761] initcall wm8510_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.315766] calling  wm8580_modinit+0x0/0x51 @ 1
[   24.315770] bus: 'i2c': add driver wm8580
[   24.316018] initcall wm8580_modinit+0x0/0x51 returned 0 after 0 usecs
[   24.316023] calling  wm8728_modinit+0x0/0x39 @ 1
[   24.316026] No device for DAI WM8728
[   24.316030] initcall wm8728_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.316035] calling  wm8731_modinit+0x0/0x71 @ 1
[   24.316039] bus: 'i2c': add driver WM8731 I2C Codec
[   24.316263] bus: 'spi': add driver wm8731
[   24.316507] initcall wm8731_modinit+0x0/0x71 returned 0 after 0 usecs
[   24.316513] calling  wm8750_modinit+0x0/0x39 @ 1
[   24.316515] No device for DAI WM8750
[   24.316520] initcall wm8750_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.316524] calling  wm8753_modinit+0x0/0x71 @ 1
[   24.316529] bus: 'i2c': add driver wm8753
[   24.316750] bus: 'spi': add driver wm8753
[   24.316995] initcall wm8753_modinit+0x0/0x71 returned 0 after 0 usecs
[   24.317001] calling  wm8900_modinit+0x0/0x3b @ 1
[   24.317005] bus: 'i2c': add driver WM8900
[   24.317240] initcall wm8900_modinit+0x0/0x3b returned 0 after 0 usecs
[   24.317245] calling  wm8903_modinit+0x0/0x3b @ 1
[   24.317249] bus: 'i2c': add driver WM8903
[   24.317495] initcall wm8903_modinit+0x0/0x3b returned 0 after 0 usecs
[   24.317500] calling  wm8971_modinit+0x0/0x39 @ 1
[   24.317503] No device for DAI WM8971
[   24.317508] initcall wm8971_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.317512] calling  wm8940_modinit+0x0/0x59 @ 1
[   24.317517] bus: 'i2c': add driver WM8940 I2C Codec
[   24.317733] initcall wm8940_modinit+0x0/0x59 returned 0 after 0 usecs
[   24.317738] calling  wm8960_modinit+0x0/0x59 @ 1
[   24.317742] bus: 'i2c': add driver WM8960 I2C Codec
[   24.318009] initcall wm8960_modinit+0x0/0x59 returned 0 after 0 usecs
[   24.318013] calling  wm8988_modinit+0x0/0x79 @ 1
[   24.318018] bus: 'i2c': add driver WM8988
[   24.318231] bus: 'spi': add driver wm8988
[   24.318499] initcall wm8988_modinit+0x0/0x79 returned 0 after 0 usecs
[   24.318504] calling  wm8990_modinit+0x0/0x39 @ 1
[   24.318506] No device for DAI WM8990 ADC/DAC Primary
[   24.318512] initcall wm8990_modinit+0x0/0x39 returned 0 after 0 usecs
[   24.318516] calling  wm9081_modinit+0x0/0x59 @ 1
[   24.318520] bus: 'i2c': add driver wm9081
[   24.318734] initcall wm9081_modinit+0x0/0x59 returned 0 after 0 usecs
[   24.318739] calling  alsa_sound_last_init+0x0/0x93 @ 1
[   24.318742] ALSA device list:
[   24.318744]   #0: NVidia CK804 with ALC850 at irq 3
[   24.318749] initcall alsa_sound_last_init+0x0/0x93 returned 0 after 0 usecs
[   24.318754] calling  flow_cache_init+0x0/0x1c9 @ 1
[   24.319248] initcall flow_cache_init+0x0/0x1c9 returned 0 after 0 usecs
[   24.319252] calling  llc_init+0x0/0x47 @ 1
[   24.319258] initcall llc_init+0x0/0x47 returned 0 after 0 usecs
[   24.319262] calling  snap_init+0x0/0x61 @ 1
[   24.319332] initcall snap_init+0x0/0x61 returned 0 after 0 usecs
[   24.319336] calling  sysctl_ipv4_init+0x0/0x74 @ 1
[   24.321697] initcall sysctl_ipv4_init+0x0/0x74 returned 0 after 9765 usecs
[   24.321702] calling  ipip_init+0x0/0x95 @ 1
[   24.321704] IPv4 over IPv4 tunneling driver
[   24.321802] device: 'tunl0': device_add
[   24.327530] initcall ipip_init+0x0/0x95 returned 0 after 0 usecs
[   24.327535] calling  ipgre_init+0x0/0xd7 @ 1
[   24.327537] GRE over IPv4 tunneling driver
[   24.327572] device: 'gre0': device_add
[   24.328830] initcall ipgre_init+0x0/0xd7 returned 0 after 0 usecs
[   24.328834] calling  ah4_init+0x0/0x8f @ 1
[   24.328839] initcall ah4_init+0x0/0x8f returned 0 after 0 usecs
[   24.328842] calling  ipcomp4_init+0x0/0x8f @ 1
[   24.328846] initcall ipcomp4_init+0x0/0x8f returned 0 after 0 usecs
[   24.328850] calling  ipip_init+0x0/0xc5 @ 1
[   24.328855] initcall ipip_init+0x0/0xc5 returned 0 after 0 usecs
[   24.328859] calling  tunnel4_init+0x0/0x8f @ 1
[   24.328863] initcall tunnel4_init+0x0/0x8f returned 0 after 0 usecs
[   24.328866] calling  xfrm4_mode_tunnel_init+0x0/0x3e @ 1
[   24.328870] initcall xfrm4_mode_tunnel_init+0x0/0x3e returned 0 after 0 usecs
[   24.328874] calling  tcp_westwood_register+0x0/0x39 @ 1
[   24.328878] TCP westwood registered
[   24.328881] initcall tcp_westwood_register+0x0/0x39 returned 0 after 0 usecs
[   24.328884] calling  hstcp_register+0x0/0x39 @ 1
[   24.328887] TCP highspeed registered
[   24.328890] initcall hstcp_register+0x0/0x39 returned 0 after 0 usecs
[   24.328894] calling  hybla_register+0x0/0x39 @ 1
[   24.328896] TCP hybla registered
[   24.328899] initcall hybla_register+0x0/0x39 returned 0 after 0 usecs
[   24.328902] calling  htcp_register+0x0/0x39 @ 1
[   24.328905] TCP htcp registered
[   24.328908] initcall htcp_register+0x0/0x39 returned 0 after 0 usecs
[   24.328911] calling  tcp_vegas_register+0x0/0x3b @ 1
[   24.328914] TCP vegas registered
[   24.328917] initcall tcp_vegas_register+0x0/0x3b returned 0 after 0 usecs
[   24.328921] calling  tcp_veno_register+0x0/0x3b @ 1
[   24.328923] TCP veno registered
[   24.328926] initcall tcp_veno_register+0x0/0x3b returned 0 after 0 usecs
[   24.328930] calling  tcp_scalable_register+0x0/0x39 @ 1
[   24.328932] TCP scalable registered
[   24.328936] initcall tcp_scalable_register+0x0/0x39 returned 0 after 0 usecs
[   24.328939] calling  tcp_yeah_register+0x0/0x3b @ 1
[   24.328942] TCP yeah registered
[   24.328945] initcall tcp_yeah_register+0x0/0x3b returned 0 after 0 usecs
[   24.328948] calling  inet6_init+0x0/0x2ec @ 1
[   24.331725] NET: Registered protocol family 10
[   24.335890] lo: Disabled Privacy Extensions
[   24.344751] tunl0: Disabled Privacy Extensions
[   24.348036] initcall inet6_init+0x0/0x2ec returned 0 after 19531 usecs
[   24.348041] calling  ah6_init+0x0/0x8f @ 1
[   24.348047] initcall ah6_init+0x0/0x8f returned 0 after 0 usecs
[   24.348051] calling  xfrm6_mode_tunnel_init+0x0/0x3e @ 1
[   24.348056] initcall xfrm6_mode_tunnel_init+0x0/0x3e returned 0 after 0 usecs
[   24.348059] calling  xfrm6_ro_init+0x0/0x3e @ 1
[   24.348063] initcall xfrm6_ro_init+0x0/0x3e returned 0 after 0 usecs
[   24.348067] calling  xfrm6_beet_init+0x0/0x3e @ 1
[   24.348071] initcall xfrm6_beet_init+0x0/0x3e returned 0 after 0 usecs
[   24.348075] calling  mip6_init+0x0/0xe1 @ 1
[   24.348077] Mobile IPv6
[   24.348081] initcall mip6_init+0x0/0xe1 returned 0 after 0 usecs
[   24.348085] calling  sit_init+0x0/0x95 @ 1
[   24.348087] IPv6 over IPv4 tunneling driver
[   24.348136] device: 'sit0': device_add
[   24.350627] sit0: Disabled Privacy Extensions
[   24.352082] initcall sit_init+0x0/0x95 returned 0 after 9765 usecs
[   24.352087] calling  packet_init+0x0/0x6d @ 1
[   24.352092] NET: Registered protocol family 17
[   24.352176] initcall packet_init+0x0/0x6d returned 0 after 0 usecs
[   24.352180] calling  ipsec_pfkey_init+0x0/0xac @ 1
[   24.352184] NET: Registered protocol family 15
[   24.352215] initcall ipsec_pfkey_init+0x0/0xac returned 0 after 0 usecs
[   24.352219] calling  br_init+0x0/0xd3 @ 1
[   24.352818] initcall br_init+0x0/0xd3 returned 0 after 0 usecs
[   24.352822] calling  dsa_init_module+0x0/0x3b @ 1
[   24.352827] initcall dsa_init_module+0x0/0x3b returned 0 after 0 usecs
[   24.352831] calling  edsa_init_module+0x0/0x3b @ 1
[   24.352835] initcall edsa_init_module+0x0/0x3b returned 0 after 0 usecs
[   24.352839] calling  mv88e6123_61_65_init+0x0/0x3b @ 1
[   24.352855] initcall mv88e6123_61_65_init+0x0/0x3b returned 0 after 0 usecs
[   24.352859] calling  mv88e6131_init+0x0/0x3b @ 1
[   24.352863] initcall mv88e6131_init+0x0/0x3b returned 0 after 0 usecs
[   24.352867] calling  dsa_init_module+0x0/0x39 @ 1
[   24.352876] bus: 'platform': add driver dsa
[   24.353117] initcall dsa_init_module+0x0/0x39 returned 0 after 0 usecs
[   24.353122] calling  atalk_init+0x0/0xb3 @ 1
[   24.353126] NET: Registered protocol family 5
[   24.390282] initcall atalk_init+0x0/0xb3 returned 0 after 39062 usecs
[   24.390287] calling  x25_init+0x0/0x85 @ 1
[   24.390291] NET: Registered protocol family 9
[   24.390295] X.25 for Linux Version 0.2
[   24.390526] initcall x25_init+0x0/0x85 returned 0 after 0 usecs
[   24.390531] calling  nr_proto_init+0x0/0x273 @ 1
[   24.390555] device: 'nr0': device_add
[   24.392441] device: 'nr1': device_add
[   24.394139] device: 'nr2': device_add
[   24.395896] device: 'nr3': device_add
[   24.397650] NET: Registered protocol family 6
[   24.398156] initcall nr_proto_init+0x0/0x273 returned 0 after 0 usecs
[   24.398160] calling  ax25_init+0x0/0xd3 @ 1
[   24.398164] NET: Registered protocol family 3
[   24.398243] initcall ax25_init+0x0/0xd3 returned 0 after 0 usecs
[   24.398247] calling  can_init+0x0/0x141 @ 1
[   24.398249] can: controller area network core (rev 20090105 abi 8)
[   24.398897] NET: Registered protocol family 29
[   24.398908] initcall can_init+0x0/0x141 returned 0 after 0 usecs
[   24.398913] calling  irnet_init+0x0/0x42 @ 1
[   24.398977] device: 'irnet': device_add
[   24.399238] initcall irnet_init+0x0/0x42 returned 0 after 0 usecs
[   24.399242] calling  l2cap_init+0x0/0x10a @ 1
[   24.399271] Bluetooth: L2CAP ver 2.13
[   24.399273] Bluetooth: L2CAP socket layer initialized
[   24.399277] initcall l2cap_init+0x0/0x10a returned 0 after 0 usecs
[   24.399282] calling  hidp_init+0x0/0x81 @ 1
[   24.399285] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   24.399291] bus: 'hid': add driver generic-bluetooth
[   24.399550] initcall hidp_init+0x0/0x81 returned 0 after 0 usecs
[   24.399554] calling  decnet_init+0x0/0xaf @ 1
[   24.399557] NET4: DECnet for Linux: V.2.5.68s (C) 1995-2003 Linux DECnet Project Team
[   24.401727] DECnet: Routing cache hash table of 1024 buckets, 56Kbytes
[   24.401798] NET: Registered protocol family 12
[   24.402221] initcall decnet_init+0x0/0xaf returned 0 after 9765 usecs
[   24.402226] calling  econet_proto_init+0x0/0x1fb @ 1
[   24.402230] NET: Registered protocol family 19
[   24.402371] initcall econet_proto_init+0x0/0x1fb returned 0 after 0 usecs
[   24.402376] calling  phonet_init+0x0/0x9e @ 1
[   24.402393] NET: Registered protocol family 35
[   24.403082] initcall phonet_init+0x0/0x9e returned 0 after 0 usecs
[   24.403087] calling  pep_register+0x0/0x3e @ 1
[   24.403519] initcall pep_register+0x0/0x3e returned 0 after 0 usecs
[   24.403523] calling  vlan_proto_init+0x0/0xeb @ 1
[   24.403527] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
[   24.403530] All bugs added by David S. Miller <davem@redhat.com>
[   24.403596] initcall vlan_proto_init+0x0/0xeb returned 0 after 0 usecs
[   24.403601] calling  sctp_init+0x0/0x82d @ 1
[   24.406583] SCTP: Hash tables configured (established 18724 bind 18724)
[   24.408512] sctp_init_sock(sk: ffff88003cb08000)
[   24.408611] initcall sctp_init+0x0/0x82d returned 0 after 0 usecs
[   24.408616] calling  lib80211_init+0x0/0x45 @ 1
[   24.408618] lib80211: common routines for IEEE802.11 drivers
[   24.408634] lib80211_crypt: registered algorithm 'NULL'
[   24.408638] initcall lib80211_init+0x0/0x45 returned 0 after 0 usecs
[   24.408642] calling  lib80211_crypto_wep_init+0x0/0x39 @ 1
[   24.408646] lib80211_crypt: registered algorithm 'WEP'
[   24.408650] initcall lib80211_crypto_wep_init+0x0/0x39 returned 0 after 0 usecs
[   24.408654] calling  lib80211_crypto_ccmp_init+0x0/0x39 @ 1
[   24.408657] lib80211_crypt: registered algorithm 'CCMP'
[   24.408661] initcall lib80211_crypto_ccmp_init+0x0/0x39 returned 0 after 0 usecs
[   24.408665] calling  lib80211_crypto_tkip_init+0x0/0x39 @ 1
[   24.408668] lib80211_crypt: registered algorithm 'TKIP'
[   24.408672] initcall lib80211_crypto_tkip_init+0x0/0x39 returned 0 after 0 usecs
[   24.408676] calling  tipc_init+0x0/0xdf @ 1
[   24.408692] TIPC: Activated (version 1.6.4 compiled Aug  2 2009 22:49:36)
[   24.411036] NET: Registered protocol family 30
[   24.411040] TIPC: Started in single node mode
[   24.411049] initcall tipc_init+0x0/0xdf returned 0 after 9765 usecs
[   24.411054] calling  dcbnl_init+0x0/0x59 @ 1
[   24.411059] initcall dcbnl_init+0x0/0x59 returned 0 after 0 usecs
[   24.411063] calling  wimax_subsys_init+0x0/0x25a @ 1
[   24.430153] initcall wimax_subsys_init+0x0/0x25a returned 0 after 19531 usecs
[   24.430158] calling  severities_debugfs_init+0x0/0x83 @ 1
[   24.430184] initcall severities_debugfs_init+0x0/0x83 returned 0 after 0 usecs
[   24.430188] calling  cpufreq_p4_init+0x0/0x82 @ 1
[   24.430192] initcall cpufreq_p4_init+0x0/0x82 returned -19 after 0 usecs
[   24.430196] calling  update_mp_table+0x0/0x689 @ 1
[   24.430200] initcall update_mp_table+0x0/0x689 returned 0 after 0 usecs
[   24.430204] calling  lapic_insert_resource+0x0/0x67 @ 1
[   24.430211] initcall lapic_insert_resource+0x0/0x67 returned 0 after 0 usecs
[   24.430215] calling  io_apic_bug_finalize+0x0/0x42 @ 1
[   24.430219] initcall io_apic_bug_finalize+0x0/0x42 returned 0 after 0 usecs
[   24.430223] calling  check_early_ioremap_leak+0x0/0x8e @ 1
[   24.430228] initcall check_early_ioremap_leak+0x0/0x8e returned 0 after 0 usecs
[   24.430232] calling  sched_init_debug+0x0/0x4b @ 1
[   24.430243] initcall sched_init_debug+0x0/0x4b returned 0 after 0 usecs
[   24.430247] calling  init_oops_id+0x0/0x5d @ 1
[   24.430251] initcall init_oops_id+0x0/0x5d returned 0 after 0 usecs
[   24.430255] calling  disable_boot_consoles+0x0/0xf3 @ 1
[   24.430259] initcall disable_boot_consoles+0x0/0xf3 returned 0 after 0 usecs
[   24.430263] calling  pm_qos_power_init+0x0/0xf0 @ 1
[   24.430277] device: 'cpu_dma_latency': device_add
[   24.430572] device: 'network_latency': device_add
[   24.430796] device: 'network_throughput': device_add
[   24.431028] initcall pm_qos_power_init+0x0/0xf0 returned 0 after 0 usecs
[   24.431033] calling  clear_boot_tracer+0x0/0x52 @ 1
[   24.431037] initcall clear_boot_tracer+0x0/0x52 returned 0 after 0 usecs
[   24.431042] calling  max_swapfiles_check+0x0/0x2d @ 1
[   24.431047] initcall max_swapfiles_check+0x0/0x2d returned 0 after 0 usecs
[   24.431052] calling  random32_reseed+0x0/0xce @ 1
[   24.431070] initcall random32_reseed+0x0/0xce returned 0 after 0 usecs
[   24.431075] calling  pci_resource_alignment_sysfs_init+0x0/0x40 @ 1
[   24.431085] initcall pci_resource_alignment_sysfs_init+0x0/0x40 returned 0 after 0 usecs
[   24.431089] calling  pci_sysfs_init+0x0/0x77 @ 1
[   24.431401] initcall pci_sysfs_init+0x0/0x77 returned 0 after 0 usecs
[   24.431405] calling  seqgen_init+0x0/0x36 @ 1
[   24.431425] initcall seqgen_init+0x0/0x36 returned 0 after 0 usecs
[   24.431429] calling  hd_init+0x0/0x321 @ 1
[   24.431478] hd: no drives specified - use hd=cyl,head,sectors on kernel command line
[   24.431629] initcall hd_init+0x0/0x321 returned -1 after 0 usecs
[   24.431633] initcall hd_init+0x0/0x321 returned with error code -1 
[   24.431639] calling  scsi_complete_async_scans+0x0/0x13b @ 1
[   24.431643] initcall scsi_complete_async_scans+0x0/0x13b returned 0 after 0 usecs
[   24.431647] calling  edd_init+0x0/0x386 @ 1
[   24.431650] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[   24.431652] EDD information not available.
[   24.431656] initcall edd_init+0x0/0x386 returned -19 after 0 usecs
[   24.431659] calling  memmap_init+0x0/0xce @ 1
[   24.431778] initcall memmap_init+0x0/0xce returned 0 after 0 usecs
[   24.431781] calling  dmatest_init+0x0/0x16c @ 1
[   24.431802] initcall dmatest_init+0x0/0x16c returned 0 after 0 usecs
[   24.431806] calling  tcp_congestion_default+0x0/0x39 @ 1
[   24.431811] initcall tcp_congestion_default+0x0/0x39 returned 0 after 0 usecs
[   24.431815] calling  ip_auto_config+0x0/0xf1d @ 1
[   24.431842] initcall ip_auto_config+0x0/0xf1d returned 0 after 0 usecs
[   24.431846] calling  initialize_hashrnd+0x0/0x40 @ 1
[   24.431854] initcall initialize_hashrnd+0x0/0x40 returned 0 after 0 usecs
[   24.431894] async_waiting @ 1
[   24.431897] async_continuing @ 1 after 0 usec
[   29.297460] EXT3-fs: INFO: recovery required on readonly filesystem.
[   29.300255] EXT3-fs: write access will be enabled during recovery.
[   29.345899] kjournald starting.  Commit interval 5 seconds
[   29.350055] EXT3-fs: recovery complete.
[   29.354793] EXT3-fs: mounted filesystem with writeback data mode.
[   29.360101] VFS: Mounted root (ext3 filesystem) readonly on device 8:6.
[   29.366790] async_waiting @ 1
[   29.370004] async_continuing @ 1 after 0 usec
[   29.374355] debug: unmapping init memory ffffffff828ac000..ffffffff82985000
[   29.380094] Write protecting the kernel read-only data: 22020k
[   29.390362] Testing CPA: undo ffffffff81009000-ffffffff8258a000
[   29.397211] Testing CPA: again
[   29.397780] bus: 'serio': really_probe: probing driver atkbd with device serio0
[   29.432248] device: 'input0': device_add
[   29.447136] Not activating Mandatory Access Control now since /sbin/tomoyo-init doesn't exist.
[   29.464851] input: AT Translated Set 2 keyboard as /class/input/input0
[   29.464851] device: 'event0': device_add
[   29.474693] evbug.c: Connected device: input0 (AT Translated Set 2 keyboard at isa0060/serio0/input0)
[   29.480032] driver: 'serio0': driver_bound: bound to device 'atkbd'
[   29.486339] bus: 'serio': really_probe: bound device serio0 to driver atkbd
[   29.487052] device: 'serio1': device_add
[   29.490012] bus: 'serio': add device serio1
[   29.504888] bus: 'serio': driver_probe_device: matched device serio1 with driver atkbd
[   29.504888] bus: 'serio': really_probe: probing driver atkbd with device serio1
[   29.525961] bus: 'serio': driver_probe_device: matched device serio1 with driver psmouse
[   29.530000] bus: 'serio': really_probe: probing driver psmouse with device serio1
Mount failed for selinuxfs on /selinux:  No such device
INIT: version 2.86 booting
		Welcome to Fedora 
		Press 'I' to enter interactive startup.
[   30.915335] device: 'input1': device_add
[   30.930122] input: ImPS/2 Generic Wheel Mouse as /class/input/input1
[   30.930122] device: 'mouse0': device_add
[   30.940546] device: 'event1': device_add
[   30.945070] evbug.c: Connected device: input1 (ImPS/2 Generic Wheel Mouse at isa0060/serio1/input0)
[   30.945070] driver: 'serio1': driver_bound: bound to device 'psmouse'
[   30.950012] bus: 'serio': really_probe: bound device serio1 to driver psmouse
Setting clock  (localtime): Mon Aug  3 02:49:22 CEST 2009 [  OK  ]
Starting udev: /sbin/start_udev: line 85: cannot redirect standard input from /dev/null: No such file or directory
/sbin/start_udev: line 85: cannot redirect standard input from /dev/null: No such file or directory
/sbin/start_udev: line 187: /proc/sys/kernel/hotplug: No such file or directory
[   34.989808] CPA self-test:
[   35.002100]  4k 262128 large 0 gb 0 x 262128[ffff880000000000-ffff88003ffef000] miss 0
[   35.028029]  4k 262128 large 0 gb 0 x 262128[ffff880000000000-ffff88003ffef000] miss 0
[   35.055923]  4k 262128 large 0 gb 0 x 262128[ffff880000000000-ffff88003ffef000] miss 0
[   35.059899] ok.
[   36.010887] eth1: link down
[   36.010887] device: 'bpq0': device_add
[   36.021765] ADDRCONF(NETDEV_UP): eth1: link is not ready
[   36.075293] device: 'bpq1': device_add
[   37.270073] IPv4 FIB: Using LC-trie version 0.408
[  OK  ]
Loading default keymap (us): [  OK  ]
Setting hostname mercury:  [  OK  ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/sda6 
/1: Superblock last mount time is in the future.  FIXED.
/1: Superblock last write time is in the future.  FIXED.
/1: clean, 375369/7325696 files, 3524827/7325632 blocks
[/sbin/fsck.ext3 (1) -- /home] fsck.ext3 -a /dev/sda5 
/home: recovering journal
/home: Superblock last mount time is in the future.  FIXED.
/home: clean, 134936/6111232 files, 2541855/12209392 blocks
[  OK  ]
Remounting root filesystem in read-write mode:  [   43.092507] EXT3 FS on sda6, internal journal
[  OK  ]
Mounting local filesystems:  [   43.208424] kjournald starting.  Commit interval 5 seconds
[   43.211002] EXT3 FS on sda5, internal journal
[   43.211002] EXT3-fs: mounted filesystem with writeback data mode.
[  OK  ]
Enabling local filesystem quotas:  [  OK  ]
Enabling /etc/fstab swaps:  [   44.106716] Adding 3911816k swap on /dev/sda2.  Priority:-1 extents:1 across:3911816k 
[  OK  ]
INIT: Entering runlevel: 3
Entering non-interactive startup
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]
Starting system message bus: [   45.537838] warning: `dbus-daemon' uses 32-bit capabilities (legacy support in use)

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/debug] debug lockups: Improve lockup detection
  2009-08-02 21:08                         ` Andrew Morton
@ 2009-08-03  7:59                           ` Ingo Molnar
  2009-08-03  8:12                           ` [tip:core/debug] debug lockups: Improve lockup detection, fix generic arch fallback tip-bot for Ingo Molnar
  1 sibling, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-03  7:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: paulmck, mingo, hpa, linux-kernel, a.p.zijlstra, torvalds, tglx,
	linux-tip-commits


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Sun, 2 Aug 2009 22:41:50 +0200 Ingo Molnar <mingo@elte.hu> wrote:
> 
> > 
> > * Andrew Morton <akpm@linux-foundation.org> wrote:
> > 
> > > On Sun, 2 Aug 2009 21:26:57 +0200 Ingo Molnar <mingo@elte.hu> wrote:
> > > 
> > > > > I think this just broke all non-x86 non-sparc SMP architectures.
> > > > 
> > > > Yeah - it 'broke' them in the sense of them not having a working 
> > > > trigger_all_cpu_backtrace() implementation to begin with.
> > > 
> > > c'mon.  It broke them in the sense that sysrq-l went from "works" 
> > > to "doesn't work".
> > 
> > You are right (i broke it with my patch) but the thing is, 
> > sysrq-l almost useless currently: it uses schedule_work() which 
> > assumes a mostly working system with full irqs and scheduling 
> > working fine. Now, i dont need sysrq-l on mostly working 
> > systems.
> > 
> > So the 'breakage' is of something that was largely useless: and 
> > now you put the onus of implementing it for _all_ architectures 
> > (which i dont use) on me?
> 
> I never said that.
>
> It's appropriate that those architectures be left with their 
> existing level of functionality/usefulness, as you're already 
> discussing.

Ok, agreed.

> > > It's better to break the build or to emit warnings than to 
> > > silently and secretly break their stuff.
> > 
> > But that warning will bounce the ball back to me, wont it? My 
> > patch will be blamed for 'breaking' those architectures, right?
> 
> It's a very crude and somewhat rude way of communicating 
> information to other architecture maintainers.
>
> A better way would be to send them an email explaining the problem 
> and outlining some solutions, no?

I've restored the generic fallback code so there should be no change 
in functionality. I'll test it and push it out - you can check that 
patch via the commit notification email.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:core/debug] debug lockups: Improve lockup detection, fix generic arch fallback
  2009-08-02 21:08                         ` Andrew Morton
  2009-08-03  7:59                           ` Ingo Molnar
@ 2009-08-03  8:12                           ` tip-bot for Ingo Molnar
  1 sibling, 0 replies; 1149+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-03  8:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, a.p.zijlstra, davem, paulmck,
	akpm, tglx, mingo

Commit-ID:  47cab6a722d44c71c4f8224017ef548522243cf4
Gitweb:     http://git.kernel.org/tip/47cab6a722d44c71c4f8224017ef548522243cf4
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 3 Aug 2009 09:31:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 3 Aug 2009 09:56:52 +0200

debug lockups: Improve lockup detection, fix generic arch fallback

As Andrew noted, my previous patch ("debug lockups: Improve lockup
detection") broke/removed SysRq-L support from architecture that do
not provide a __trigger_all_cpu_backtrace implementation.

Restore a fallback path and clean up the SysRq-L machinery a bit:

 - Rename the arch method to arch_trigger_all_cpu_backtrace()

 - Simplify the define

 - Document the method a bit - in the hope of more architectures
   adding support for it.

[ The patch touches Sparc code for the rename. ]

Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
LKML-Reference: <20090802140809.7ec4bb6b.akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/sparc/include/asm/irq_64.h |    4 ++--
 arch/sparc/kernel/process_64.c  |    4 ++--
 arch/x86/include/asm/nmi.h      |    4 ++--
 arch/x86/kernel/apic/nmi.c      |    2 +-
 drivers/char/sysrq.c            |   15 ++++++++++++++-
 include/linux/nmi.h             |   19 +++++++++++++++++--
 6 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 1934f2c..a0b443c 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -89,8 +89,8 @@ static inline unsigned long get_softint(void)
 	return retval;
 }
 
-void __trigger_all_cpu_backtrace(void);
-#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
+void arch_trigger_all_cpu_backtrace(void);
+#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
 
 extern void *hardirq_stack[NR_CPUS];
 extern void *softirq_stack[NR_CPUS];
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 4041f94..18d6785 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -251,7 +251,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp)
 	}
 }
 
-void __trigger_all_cpu_backtrace(void)
+void arch_trigger_all_cpu_backtrace(void)
 {
 	struct thread_info *tp = current_thread_info();
 	struct pt_regs *regs = get_irq_regs();
@@ -304,7 +304,7 @@ void __trigger_all_cpu_backtrace(void)
 
 static void sysrq_handle_globreg(int key, struct tty_struct *tty)
 {
-	__trigger_all_cpu_backtrace();
+	arch_trigger_all_cpu_backtrace();
 }
 
 static struct sysrq_key_op sparc_globalreg_op = {
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index c86e5ed..e63cf7d 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -45,8 +45,8 @@ extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
 			void __user *, size_t *, loff_t *);
 extern int unknown_nmi_panic;
 
-void __trigger_all_cpu_backtrace(void);
-#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
+void arch_trigger_all_cpu_backtrace(void);
+#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
 
 static inline void localise_nmi_watchdog(void)
 {
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index 1bb1ac2..db72202 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -554,7 +554,7 @@ int do_nmi_callback(struct pt_regs *regs, int cpu)
 	return 0;
 }
 
-void __trigger_all_cpu_backtrace(void)
+void arch_trigger_all_cpu_backtrace(void)
 {
 	int i;
 
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 165f307..50eecfe 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -223,7 +223,20 @@ static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
 
 static void sysrq_handle_showallcpus(int key, struct tty_struct *tty)
 {
-	trigger_all_cpu_backtrace();
+	/*
+	 * Fall back to the workqueue based printing if the
+	 * backtrace printing did not succeed or the
+	 * architecture has no support for it:
+	 */
+	if (!trigger_all_cpu_backtrace()) {
+		struct pt_regs *regs = get_irq_regs();
+
+		if (regs) {
+			printk(KERN_INFO "CPU%d:\n", smp_processor_id());
+			show_regs(regs);
+		}
+		schedule_work(&sysrq_showallcpus);
+	}
 }
 
 static struct sysrq_key_op sysrq_showallcpus_op = {
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 29af2d5..b752e80 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -28,8 +28,23 @@ static inline void acpi_nmi_disable(void) { }
 static inline void acpi_nmi_enable(void) { }
 #endif
 
-#ifndef trigger_all_cpu_backtrace
-#define trigger_all_cpu_backtrace() do { } while (0)
+/*
+ * Create trigger_all_cpu_backtrace() out of the arch-provided
+ * base function. Return whether such support was available,
+ * to allow calling code to fall back to some other mechanism:
+ */
+#ifdef arch_trigger_all_cpu_backtrace
+static inline bool trigger_all_cpu_backtrace(void)
+{
+	arch_trigger_all_cpu_backtrace();
+
+	return true;
+}
+#else
+static inline bool trigger_all_cpu_backtrace(void)
+{
+	return false;
+}
 #endif
 
 #endif

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-03  7:04                     ` Ingo Molnar
@ 2009-08-03 12:56                       ` Paul E. McKenney
  2009-08-06  1:26                         ` Paul E. McKenney
  2009-08-04  8:18                       ` [tip:core/rcu] rcu: Add " Gautham R Shenoy
  1 sibling, 1 reply; 1149+ messages in thread
From: Paul E. McKenney @ 2009-08-03 12:56 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits, ego

On Mon, Aug 03, 2009 at 09:04:58AM +0200, Ingo Molnar wrote:
> 
> i've attached the full serial bootlog with the warning in it. This 
> should address your question about what the order of initialization 
> is, right?

It does, thank you!  This problem really is happening during boot.

> Let me know if you still would like me to run your diagnostic patch 
> too.

Now that you mention it, you should probably let me test it a bit first.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
       [not found]             ` <new-submission>
                                 ` (287 preceding siblings ...)
  2009-08-02 19:40               ` [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race tip-bot for Paul E. McKenney
@ 2009-08-03 13:22               ` tip-bot for Peter Zijlstra
  2009-08-03 13:24                 ` Ingo Molnar
  2009-08-04 11:37               ` [tip:perfcounters/core] perf top: Update man page tip-bot for Mike Galbraith
                                 ` (418 subsequent siblings)
  707 siblings, 1 reply; 1149+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-08-03 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, a.p.zijlstra, fweisbec, rostedt,
	tglx, mingo

Commit-ID:  5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
Gitweb:     http://git.kernel.org/tip/5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 3 Aug 2009 14:35:37 +0200

sched: Add wait, sleep and iowait accounting tracepoints

Add 3 schedstat tracepoints to help account for wait-time,
sleep-time and iowait-time.

They can also be used as a perf-counter source to profile tasks
on these clocks.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/trace/events/sched.h |   95 ++++++++++++++++++++++++++++++++++++++++++
 kernel/sched_fair.c          |   10 ++++-
 2 files changed, 104 insertions(+), 1 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 8949bb7..a4c369e 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -340,6 +340,101 @@ TRACE_EVENT(sched_signal_send,
 		  __entry->sig, __entry->comm, __entry->pid)
 );
 
+/*
+ * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
+ *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
+ */
+
+/*
+ * Tracepoint for accounting wait time (time the task is runnable
+ * but not actually running due to scheduler contention).
+ */
+TRACE_EVENT(sched_stat_wait,
+
+	TP_PROTO(struct task_struct *tsk, u64 delay),
+
+	TP_ARGS(tsk, delay),
+
+	TP_STRUCT__entry(
+		__array( char,	comm,	TASK_COMM_LEN	)
+		__field( pid_t,	pid			)
+		__field( u64,	delay			)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid	= tsk->pid;
+		__entry->delay	= delay;
+	)
+	TP_perf_assign(
+		__perf_count(delay);
+	),
+
+	TP_printk("task: %s:%d wait: %Lu [ns]",
+			__entry->comm, __entry->pid,
+			(unsigned long long)__entry->delay)
+);
+
+/*
+ * Tracepoint for accounting sleep time (time the task is not runnable,
+ * including iowait, see below).
+ */
+TRACE_EVENT(sched_stat_sleep,
+
+	TP_PROTO(struct task_struct *tsk, u64 delay),
+
+	TP_ARGS(tsk, delay),
+
+	TP_STRUCT__entry(
+		__array( char,	comm,	TASK_COMM_LEN	)
+		__field( pid_t,	pid			)
+		__field( u64,	delay			)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid	= tsk->pid;
+		__entry->delay	= delay;
+	)
+	TP_perf_assign(
+		__perf_count(delay);
+	),
+
+	TP_printk("task: %s:%d sleep: %Lu [ns]",
+			__entry->comm, __entry->pid,
+			(unsigned long long)__entry->delay)
+);
+
+/*
+ * Tracepoint for accounting iowait time (time the task is not runnable
+ * due to waiting on IO to complete).
+ */
+TRACE_EVENT(sched_stat_iowait,
+
+	TP_PROTO(struct task_struct *tsk, u64 delay),
+
+	TP_ARGS(tsk, delay),
+
+	TP_STRUCT__entry(
+		__array( char,	comm,	TASK_COMM_LEN	)
+		__field( pid_t,	pid			)
+		__field( u64,	delay			)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid	= tsk->pid;
+		__entry->delay	= delay;
+	)
+	TP_perf_assign(
+		__perf_count(delay);
+	),
+
+	TP_printk("task: %s:%d iowait: %Lu [ns]",
+			__entry->comm, __entry->pid,
+			(unsigned long long)__entry->delay)
+);
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 471fa28..0e4d6c5 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -546,6 +546,11 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 	schedstat_set(se->wait_sum, se->wait_sum +
 			rq_of(cfs_rq)->clock - se->wait_start);
 	schedstat_set(se->wait_start, 0);
+
+	if (entity_is_task(se)) {
+		trace_sched_stat_wait(task_of(se),
+			rq_of(cfs_rq)->clock - se->wait_start);
+	}
 }
 
 static inline void
@@ -636,8 +641,10 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
 		se->sleep_start = 0;
 		se->sum_sleep_runtime += delta;
 
-		if (tsk)
+		if (tsk) {
 			account_scheduler_latency(tsk, delta >> 10, 1);
+			trace_sched_stat_sleep(tsk, delta);
+		}
 	}
 	if (se->block_start) {
 		u64 delta = rq_of(cfs_rq)->clock - se->block_start;
@@ -655,6 +662,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
 			if (tsk->in_iowait) {
 				se->iowait_sum += delta;
 				se->iowait_count++;
+				trace_sched_stat_iowait(tsk, delta);
 			}
 
 			/*

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
  2009-08-03 13:22               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
@ 2009-08-03 13:24                 ` Ingo Molnar
  2009-08-03 14:24                   ` Peter Zijlstra
  0 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-03 13:24 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, fweisbec, rostedt, a.p.zijlstra, arjan,
	tglx
  Cc: linux-tip-commits


* tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> Commit-ID:  5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
> Gitweb:     http://git.kernel.org/tip/5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 3 Aug 2009 14:35:37 +0200

> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -546,6 +546,11 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
>  	schedstat_set(se->wait_sum, se->wait_sum +
>  			rq_of(cfs_rq)->clock - se->wait_start);
>  	schedstat_set(se->wait_start, 0);
> +
> +	if (entity_is_task(se)) {
> +		trace_sched_stat_wait(task_of(se),
> +			rq_of(cfs_rq)->clock - se->wait_start);
> +	}

FYI, this doesnt build with !SCHEDSTATS. I suspect we shold maintain 
se->wait_start unconditionally.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
  2009-08-03 13:24                 ` Ingo Molnar
@ 2009-08-03 14:24                   ` Peter Zijlstra
  0 siblings, 0 replies; 1149+ messages in thread
From: Peter Zijlstra @ 2009-08-03 14:24 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, fweisbec, rostedt, arjan, tglx,
	linux-tip-commits

On Mon, 2009-08-03 at 15:24 +0200, Ingo Molnar wrote:
> * tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> 
> > Commit-ID:  5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
> > Gitweb:     http://git.kernel.org/tip/5f3e60fb2a0e05cdaf9b59acb0bb249bb1e96362
> > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Mon, 3 Aug 2009 14:35:37 +0200
> 
> > --- a/kernel/sched_fair.c
> > +++ b/kernel/sched_fair.c
> > @@ -546,6 +546,11 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
> >  	schedstat_set(se->wait_sum, se->wait_sum +
> >  			rq_of(cfs_rq)->clock - se->wait_start);
> >  	schedstat_set(se->wait_start, 0);
> > +
> > +	if (entity_is_task(se)) {
> > +		trace_sched_stat_wait(task_of(se),
> > +			rq_of(cfs_rq)->clock - se->wait_start);
> > +	}
> 
> FYI, this doesnt build with !SCHEDSTATS. I suspect we shold maintain 
> se->wait_start unconditionally.

Also noticed that we have this TASK_INTERRUPTIBLE vs
TASK_UNINTERRUPTIBLE split in sleep vs block which I overlooked the
other day.

Since all the other trace_sched_stat tracepoints are under
CONFIG_SCHEDSTAT I fixed the above error by adding ifdefs.

This probably wants folding back into the original patch.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 include/trace/events/sched.h |   36 ++++++++++++++++++++++++++++++++----
 kernel/sched_fair.c          |    3 +++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index a4c369e..c201b51 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -376,8 +376,7 @@ TRACE_EVENT(sched_stat_wait,
 );
 
 /*
- * Tracepoint for accounting sleep time (time the task is not runnable,
- * including iowait, see below).
+ * Tracepoint for accounting sleep time, TASK_INTERRUPTIBLE
  */
 TRACE_EVENT(sched_stat_sleep,
 
@@ -406,8 +405,37 @@ TRACE_EVENT(sched_stat_sleep,
 );
 
 /*
- * Tracepoint for accounting iowait time (time the task is not runnable
- * due to waiting on IO to complete).
+ * Tracepoint for accounting block time, TASK_UNINTERRUPTIBLE
+ * (including iowait).
+ */
+TRACE_EVENT(sched_stat_block,
+
+	TP_PROTO(struct task_struct *tsk, u64 delay),
+
+	TP_ARGS(tsk, delay),
+
+	TP_STRUCT__entry(
+		__array( char,	comm,	TASK_COMM_LEN	)
+		__field( pid_t,	pid			)
+		__field( u64,	delay			)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid	= tsk->pid;
+		__entry->delay	= delay;
+	)
+	TP_perf_assign(
+		__perf_count(delay);
+	),
+
+	TP_printk("task: %s:%d block: %Lu [ns]",
+			__entry->comm, __entry->pid,
+			(unsigned long long)__entry->delay)
+);
+
+/*
+ * Tracepoint for accounting iowait time, TASK_UNINTERRUPTIBLE
  */
 TRACE_EVENT(sched_stat_iowait,
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 0e4d6c5..abc8e6c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -540,6 +540,7 @@ static void update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
 static void
 update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
+#ifdef CONFIG_SCHEDSTATS
 	schedstat_set(se->wait_max, max(se->wait_max,
 			rq_of(cfs_rq)->clock - se->wait_start));
 	schedstat_set(se->wait_count, se->wait_count + 1);
@@ -551,6 +552,7 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 		trace_sched_stat_wait(task_of(se),
 			rq_of(cfs_rq)->clock - se->wait_start);
 	}
+#endif
 }
 
 static inline void
@@ -664,6 +666,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
 				se->iowait_count++;
 				trace_sched_stat_iowait(tsk, delta);
 			}
+			trace_sched_stat_block(tsk, delta);
 
 			/*
 			 * Blocking time is in units of nanosecs, so shift by



^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-02 22:13                   ` Paul E. McKenney
  2009-08-03  5:15                     ` Paul E. McKenney
  2009-08-03  7:04                     ` Ingo Molnar
@ 2009-08-04  5:47                     ` Gautham R Shenoy
  2 siblings, 0 replies; 1149+ messages in thread
From: Gautham R Shenoy @ 2009-08-04  5:47 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Ingo Molnar, mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Sun, Aug 02, 2009 at 03:13:25PM -0700, Paul E. McKenney wrote:
> > FYI, the new warning triggered in -tip testing:
> 
> Yow!!!  I never was able to get this to trigger...  Of course, I never
> was able to reproduce the original problem, either.
> 
> Just so you know, one of the reasons it took me so long to come up with
> the fix is that this just isn't supposed to happen.  Where I grew up, CPUs
> were supposed to come online -before- starting to handle softirqs.  ;-)
> 
> Here is my reasoning:
> 
> o	rcu_init(), which is invoked before a second CPU can possibly
> 	come online, calls hotplug_notifier(), which causes
> 	rcu_barrier_cpu_hotplug() to be invoked in response to any
> 	CPU-hotplug event.
> 
> o	We know rcu_init() really was called, because otherwise
> 	open_softirq(RCU_SOFTIRQ) never gets called, so the softirq would
> 	never have happened.  In addition, there should be a "Hierarchical
> 	RCU implementation" message in your bootlog.  (Is there?)
> 
> o	rcu_barrier_cpu_hotplug() unconditionally invokes
> 	rcu_cpu_notify() on every CPU-hotplug event.
> 
> o	rcu_cpu_notify() invokes rcu_online_cpu() in response to
> 	any CPU_UP_PREPARE or CPU_UP_PREPARE_FROZEN CPU-hotplug
> 	event.
> 
> o	The CPU_UP_PREPARE and CPU_UP_PREPARE_FROZEN CPU-hotplug events
> 	happen before the CPU in question is capable of running any code.
> 
> o	This looks to be the first onlining of this CPU during boot
> 	(right?).  So we cannot possibly have some strange situation
> 	where the end of the prior CPU-offline event overlaps with
> 	the current CPU-online event.  (Yes, this isn't supposed to
> 	happen courtesy of CPU-hotplug locking, but impossibility
> 	is clearly no reason to dismiss possible scenarios for -this-
> 	particular bug.)
> 
> o	Therefore the WARN_ON_ONCE() cannot possibly trigger.
> 
> This would be a convincing argument, aside from the fact that you
> really did make it trigger.  So first, anything I am missing in
> the above?  If not, could you please help me with the following,
> at least if the answers are readily available?
> 
> o	Is rcu_init()'s "Hierarchical RCU implementation" log message
> 	in your bootlog?
> 
> o	Is _cpu_up() really being called, and, if so, is it really
> 	invoking __raw_notifier_call_chain() with CPU_UP_PREPARE?
> 
> o	Is this really during initial boot, or am I misreading your
> 	bootlog?  (The other reason I believe that this happened on
> 	the first CPU-online for this CPU is that ->beenonline, once
> 	set, is never cleared.)
> 
> Gautham, any thoughts on what might be happening here?

Beats me. You're reasoning seems quite iron-clad, there's nothing that's
obviously missing at least from the CPU-Hotplug point of view.

I am trying to reproduce this on 2.6.31-rc5 tip-master + your patch with
an added printk.
Let me see if I can catch it.


-->
rcu: Check if the cpu has been initialized before handling callbacks

From: Gautham R Shenoy <ego@in.ibm.com>

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Paul E.Mckenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 0e40e61..1809cc8 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1137,6 +1137,8 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 {
 	unsigned long flags;
 
+	WARN_ON_ONCE(rdp->beenonline == 0);
+
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick
 	 * idle CPUs and, if needed, send resched IPIs.
@@ -1351,6 +1353,8 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
 	struct rcu_data *rdp = rsp->rda[cpu];
 	struct rcu_node *rnp = rcu_get_root(rsp);
 
+	printk(KERN_INFO "Initializing RCU for cpu %d\n", cpu);
+
 	/* Set up local state, ensuring consistent view of global state. */
 	spin_lock_irqsave(&rnp->lock, flags);
 	lastcomp = rsp->completed;



-- 
Thanks and Regards
gautham

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-03  7:04                     ` Ingo Molnar
  2009-08-03 12:56                       ` Paul E. McKenney
@ 2009-08-04  8:18                       ` Gautham R Shenoy
  2009-08-04  8:20                         ` Ingo Molnar
  2009-08-04 15:37                         ` Paul E. McKenney
  1 sibling, 2 replies; 1149+ messages in thread
From: Gautham R Shenoy @ 2009-08-04  8:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Paul E. McKenney, mingo, hpa, linux-kernel, tglx,
	linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 32343 bytes --]

On Mon, Aug 03, 2009 at 09:04:58AM +0200, Ingo Molnar wrote:
> [    0.010000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> [    0.010000] ... MAX_LOCKDEP_SUBCLASSES:  8
> [    0.010000] ... MAX_LOCK_DEPTH:          48
> [    0.010000] ... MAX_LOCKDEP_KEYS:        8191
> [    0.010000] ... CLASSHASH_SIZE:          4096
> [    0.010000] ... MAX_LOCKDEP_ENTRIES:     16384
> [    0.010000] ... MAX_LOCKDEP_CHAINS:      32768
> [    0.010000] ... CHAINHASH_SIZE:          16384
> [    0.010000]  memory used by lock dependency info: 5823 kB
> [    0.010000]  per task-struct memory footprint: 1920 bytes
> [    0.010000] ------------------------
> [    0.010000] | Locking API testsuite:
> [    0.010000] ----------------------------------------------------------------------------
> [    0.010000]                                  | spin |wlock |rlock |mutex | wsem | rsem |
> [    0.010000]   --------------------------------------------------------------------------
> [    0.010000]                      A-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]                  A-B-B-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]              A-B-B-C-C-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]              A-B-C-A-B-C deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]          A-B-B-C-C-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]          A-B-C-D-B-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]          A-B-C-D-B-C-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> [    0.010000]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> [    0.010000]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> [    0.010000]                  bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> [    0.010000]   --------------------------------------------------------------------------
> [    0.010000]               recursive read-lock:             |  ok  |             |failed|
> [    0.010000]            recursive read-lock #2:             |  ok  |             |failed|
> [    0.010000]             mixed read-write-lock:             |failed|             |failed|
> [    0.010000]             mixed write-read-lock:             |failed|             |failed|
> [    0.010000]   --------------------------------------------------------------------------
> [    0.010000]      hard-irqs-on + irq-safe-A/12:failed|failed|  ok  |
> [    0.010000]      soft-irqs-on + irq-safe-A/12:failed|failed|  ok  |
> [    0.010000]      hard-irqs-on + irq-safe-A/21:failed|failed|  ok  |
> [    0.010000]      soft-irqs-on + irq-safe-A/21:failed|failed|  ok  |
> [    0.010000]        sirq-safe-A => hirqs-on/12:failed|failed|  ok  |
> [    0.010000]        sirq-safe-A => hirqs-on/21:failed|failed|  ok  |
> [    0.010000]          hard-safe-A + irqs-on/12:failed|failed|  ok  |
> [    0.010000]          soft-safe-A + irqs-on/12:failed|failed|  ok  |
> [    0.010000]          hard-safe-A + irqs-on/21:failed|failed|  ok  |
> [    0.010000]          soft-safe-A + irqs-on/21:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/123:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/123:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/132:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/132:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/213:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/213:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/231:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/231:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/312:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/312:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #1/321:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #1/321:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/123:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/123:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/132:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/132:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/213:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/213:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/231:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/231:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/312:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/312:failed|failed|  ok  |
> [    0.010000]     hard-safe-A + unsafe-B #2/321:failed|failed|  ok  |
> [    0.010000]     soft-safe-A + unsafe-B #2/321:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/123:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/123:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/132:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/132:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/213:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/213:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/231:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/231:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/312:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/312:failed|failed|  ok  |
> [    0.010000]       hard-irq lock-inversion/321:failed|failed|  ok  |
> [    0.010000]       soft-irq lock-inversion/321:failed|failed|  ok  |
> [    0.010000]       hard-irq read-recursion/123:  ok  |
> [    0.010000]       soft-irq read-recursion/123:  ok  |
> [    0.010000]       hard-irq read-recursion/132:  ok  |
> [    0.010000]       soft-irq read-recursion/132:  ok  |
> [    0.010000]       hard-irq read-recursion/213:  ok  |
> [    0.010000]       soft-irq read-recursion/213:  ok  |
> [    0.010000]       hard-irq read-recursion/231:  ok  |
> [    0.010000]       soft-irq read-recursion/231:  ok  |
> [    0.010000]       hard-irq read-recursion/312:  ok  |
> [    0.010000]       soft-irq read-recursion/312:  ok  |
> [    0.010000]       hard-irq read-recursion/321:  ok  |
> [    0.010000]       soft-irq read-recursion/321:  ok  |
> [    0.010000] --------------------------------------------------------
> [    0.010000] 133 out of 218 testcases failed, as expected. |
> [    0.010000] ----------------------------------------------------

Hmm.. I tried to reproduce this on a similar 2 CPU machine running
linux-2.6.31-rc5-tip. However, I couldn't reproduce this WARN_ON.

That aside, in my case, all the 218 lockdep test cases passed,
while this bootlog shows quite a few failures.
So, wondering if I am testing the right kernel version.

Appending the patch, bootup log and the config.

/*************** Patch ******************************/

rcu: Check if the cpu has been initialized before handling callbacks

From: Gautham R Shenoy <ego@in.ibm.com>

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
---
 kernel/rcutree.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 0e40e61..1809cc8 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1137,6 +1137,8 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 {
 	unsigned long flags;
 
+	WARN_ON_ONCE(rdp->beenonline == 0);
+
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick
 	 * idle CPUs and, if needed, send resched IPIs.
@@ -1351,6 +1353,8 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
 	struct rcu_data *rdp = rsp->rda[cpu];
 	struct rcu_node *rnp = rcu_get_root(rsp);
 
+	printk(KERN_INFO "Initializing RCU for cpu %d\n", cpu);
+
 	/* Set up local state, ensuring consistent view of global state. */
 	spin_lock_irqsave(&rnp->lock, flags);
 	lastcomp = rsp->completed;


/*************** Boot Log ******************************/
root  (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
kernel  /boot/vmlinuz-autobench console=tty0 console=ttyS0,9600 autobench_args:
 root=/dev/sda2 ABAT:1249362544
   [Linux-bzImage, setup=0x3000, size=0x334830]
initrd /boot/initrd-autobench.img
   [Linux-initrd @ 0x37de8000, 0x2077cb bytes]
boot
Linux version 2.6.31-rc5-autokern1-tip (root@elm3b165) (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) #1 SMP Tue Aug 4 05:08:45 UTC 2009
Command line: console=tty0 console=ttyS0,9600 autobench_args: root=/dev/sda2 ABAT:1249362544
KERNEL supported cpus:
  Intel GenuineIntel
  AMD AuthenticAMD
  Centaur CentaurHauls
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009ac00 (usable)
 BIOS-e820: 000000000009ac00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000d4000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 00000000dff70000 (usable)
 BIOS-e820: 00000000dff70000 - 00000000dff7b000 (ACPI data)
 BIOS-e820: 00000000dff7b000 - 00000000dff80000 (ACPI NVS)
 BIOS-e820: 00000000dff80000 - 00000000e0000000 (reserved)
 BIOS-e820: 00000000fec00000 - 00000000fec00400 (reserved)
 BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
 BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
 BIOS-e820: 0000000100000000 - 0000000400000000 (usable)
DMI 2.3 present.
last_pfn = 0x400000 max_arch_pfn = 0x400000000
last_pfn = 0xdff70 max_arch_pfn = 0x400000000
init_memory_mapping: 0000000000000000-00000000dff70000
init_memory_mapping: 0000000100000000-0000000400000000
RAMDISK: 37de8000 - 37fef7cb
ACPI: RSDP 00000000000f7560 00024 (v02 PTLTD )
ACPI: XSDT 00000000dff78a5b 0004C (v01 PTLTD     XSDT   06040000  LTP 00000000)
ACPI: FACP 00000000dff7ac02 000F4 (v03 AMD    HAMMER   06040000 PTEC 000F4240)
ACPI: DSDT 00000000dff78aa7 020E7 (v01 AMD-K8  AMDACPI 06040000 MSFT 0100000E)
ACPI: FACS 00000000dff7bfc0 00040
ACPI: SSDT 00000000dff7acf6 0020C (v01 PTLTD  POWERNOW 06040000  LTP 00000001)
ACPI: HPET 00000000dff7af02 00038 (v01 AMD    HAMMER   06040000 PTEC 00000000)
ACPI: APIC 00000000dff7af3a 00076 (v01 PTLTD     APIC   06040000  LTP 00000000)
ACPI: SPCR 00000000dff7afb0 00050 (v01 PTLTD  $UCRTBL$ 06040000 PTL  00000001)
Scanning NUMA topology in Northbridge 24
Number of nodes 2
Node 0 MemBase 0000000000000000 Limit 0000000200000000
Node 1 MemBase 0000000200000000 Limit 0000000400000000
Using node hash shift of 33
found SMP MP-table at [ffff8800000f75e0] f75e0
Bootmem setup node 0 0000000000000000-0000000200000000
  NODE_DATA [0000000000001000 - 0000000000005fff]
  bootmap [0000000000018000 -  0000000000057fff] pages 40
(8 early reservations) ==> bootmem [0000000000 - 0200000000]
  #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
  #1 [0000006000 - 0000008000]       TRAMPOLINE ==> [0000006000 - 0000008000]
  #2 [0001000000 - 00022fbea8]    TEXT DATA BSS ==> [0001000000 - 00022fbea8]
  #3 [0037de8000 - 0037fef7cb]          RAMDISK ==> [0037de8000 - 0037fef7cb]
  #4 [000009ac00 - 0000100000]    BIOS reserved ==> [000009ac00 - 0000100000]
  #5 [00022fc000 - 00022fc108]              BRK ==> [00022fc000 - 00022fc108]
  #6 [0000008000 - 000000c000]          PGTABLE ==> [0000008000 - 000000c000]
  #7 [000000c000 - 0000018000]          PGTABLE ==> [000000c000 - 0000018000]
Bootmem setup node 1 0000000200000000-0000000400000000
  NODE_DATA [0000000200000000 - 0000000200004fff]
  bootmap [0000000200005000 -  0000000200044fff] pages 40
(8 early reservations) ==> bootmem [0200000000 - 0400000000]
  #0 [0000000000 - 0000001000]   BIOS data page
  #1 [0000006000 - 0000008000]       TRAMPOLINE
  #2 [0001000000 - 00022fbea8]    TEXT DATA BSS
  #3 [0037de8000 - 0037fef7cb]          RAMDISK
  #4 [000009ac00 - 0000100000]    BIOS reserved
  #5 [00022fc000 - 00022fc108]              BRK
  #6 [0000008000 - 000000c000]          PGTABLE
  #7 [000000c000 - 0000018000]          PGTABLE
found SMP MP-table at [ffff8800000f75e0] f75e0
Zone PFN ranges:
  DMA      0x00000000 -> 0x00001000
  DMA32    0x00001000 -> 0x00100000
  Normal   0x00100000 -> 0x00400000
Movable zone start PFN for each node
early_node_map[4] active PFN ranges
    0: 0x00000000 -> 0x0000009a
    0: 0x00000100 -> 0x000dff70
    0: 0x00100000 -> 0x00200000
    1: 0x00200000 -> 0x00400000
Detected use of extended apic ids on hypertransport bus
Detected use of extended apic ids on hypertransport bus
ACPI: PM-Timer IO Port: 0x8008
ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23
ACPI: IOAPIC (id[0x03] address[0xe8000000] gsi_base[24])
IOAPIC[1]: apic_id 3, version 17, address 0xe8000000, GSI 24-27
ACPI: IOAPIC (id[0x04] address[0xe8001000] gsi_base[28])
IOAPIC[2]: apic_id 4, version 17, address 0xe8001000, GSI 28-31
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 high edge)
Using ACPI (MADT) for SMP configuration information
ACPI: HPET id: 0x102282a0 base: 0xfed00000
SMP: Allowing 2 CPUs, 0 hotplug CPUs
Allocating PCI resources starting at e0000000 (gap: e0000000:1ec00000)
NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:2 nr_node_ids:2
PERCPU: Remapped at ffffc90000000000 with large pages, static data 1914656 bytes
Built 2 zonelists in Zone order, mobility grouping on.  Total pages: 3956370
Policy zone: Normal
Kernel command line: console=tty0 console=ttyS0,9600 autobench_args: root=/dev/sda2 ABAT:1249362544
PID hash table entries: 4096 (order: 12, 32768 bytes)
Initializing CPU#0
Checking aperture...
No AGP bridge found
Node 0: aperture @ 0 size 32 MB
Your BIOS doesn't leave a aperture memory hole
Please enable the IOMMU option in the BIOS setup
This costs you 64 MB of RAM
Mapping aperture over 65536 KB of RAM @ 20000000
Memory: 15746208k/16777216k available (4270k kernel code, 525272k absent, 505736k reserved, 3005k data, 2396k init)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is enabled.
Initializing RCU for cpu 0
Initializing RCU for cpu 0
NR_IRQS:1280
Extended CMOS year: 2000
Fast TSC calibration using PIT
Detected 2392.251 MHz processor.
Console: colour VGA+ 80x25
console [tty0] enabled
console [ttyS0] enabled
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES:  8
... MAX_LOCK_DEPTH:          48
... MAX_LOCKDEP_KEYS:        8191
... CLASSHASH_SIZE:          4096
... MAX_LOCKDEP_ENTRIES:     16384
... MAX_LOCKDEP_CHAINS:      32768
... CHAINHASH_SIZE:          16384
 memory used by lock dependency info: 6367 kB
 per task-struct memory footprint: 2688 bytes
------------------------
| Locking API testsuite:
----------------------------------------------------------------------------
                                 | spin |wlock |rlock |mutex | wsem | rsem |
  --------------------------------------------------------------------------
                     A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                 A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
             A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
             A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                    double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                  initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                 bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
  --------------------------------------------------------------------------
              recursive read-lock:             |  ok  |             |  ok  |
           recursive read-lock #2:             |  ok  |             |  ok  |
            mixed read-write-lock:             |  ok  |             |  ok  |
            mixed write-read-lock:             |  ok  |             |  ok  |
  --------------------------------------------------------------------------
     hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
     soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
     hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
     soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
       sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
       sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
         hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
         soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
         hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
         soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
      hard-irq read-recursion/123:  ok  |
      soft-irq read-recursion/123:  ok  |
      hard-irq read-recursion/132:  ok  |
      soft-irq read-recursion/132:  ok  |
      hard-irq read-recursion/213:  ok  |
      soft-irq read-recursion/213:  ok  |
      hard-irq read-recursion/231:  ok  |
      soft-irq read-recursion/231:  ok  |
      hard-irq read-recursion/312:  ok  |
      soft-irq read-recursion/312:  ok  |
      hard-irq read-recursion/321:  ok  |
      soft-irq read-recursion/321:  ok  |
-------------------------------------------------------
Good, all 218 testcases passed! |
---------------------------------
HPET: 3 timers in total, 0 timers will be used for per-cpu timer
Calibrating delay loop (skipped), value calculated using timer frequency.. 4784.50 BogoMIPS (lpj=9569004)
Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes)
Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Mount-cache hash table entries: 256
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU 0/0x0 -> Node 0
mce: CPU supports 5 MCE banks
Performance Counters: AMD PMU driver.
... version:                 0
... bit width:               48
... generic counters:        4
... value mask:              0000ffffffffffff
... max period:              00007fffffffffff
... fixed-purpose counters:  0
... counter mask:            000000000000000f
ACPI: Core revision 20090521
Setting APIC routing to flat
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
CPU0: AMD Opteron(tm) Processor 250 stepping 0a
Initializing RCU for cpu 1
Initializing RCU for cpu 1
lockdep: fixing up alternatives.
Booting processor 1 APIC 0x1 ip 0x6000
Initializing CPU#1
Calibrating delay using timer specific routine.. 4785.02 BogoMIPS (lpj=9570044)
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU 1/0x1 -> Node 1
mce: CPU supports 5 MCE banks
CPU1: AMD Opteron(tm) Processor 250 stepping 0a
Brought up 2 CPUs
Total of 2 processors activated (9569.52 BogoMIPS).
NET: Registered protocol family 16
TOM: 00000000e0000000 aka 3584M
TOM2: 0000000400000000 aka 16384M
ACPI: bus type pci registered
PCI: Using configuration type 1 for base access
bio: create slab <bio-0> at 0
ACPI: Interpreter enabled
ACPI: (supports S0 S1 S5)
ACPI: Using IOAPIC for interrupt routing
ACPI: No dock devices found.
ACPI: PCI Root Bridge [PCI0] (0000:00)
pci 0000:02:01.0: PME# supported from D3hot D3cold
pci 0000:02:01.0: PME# disabled
pci 0000:02:01.1: PME# supported from D3hot D3cold
pci 0000:02:01.1: PME# disabled
pci 0000:03:03.0: PME# supported from D0 D3hot D3cold
pci 0000:03:03.0: PME# disabled
ACPI: PCI Interrupt Link [LNKA] (IRQs 3 5 10 11) *7
ACPI: PCI Interrupt Link [LNKB] (IRQs 3 5 *10 11)
ACPI: PCI Interrupt Link [LNKC] (IRQs *3 5 10 11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 3 5 10 *11)
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
PCI: Using ACPI for IRQ routing
PCI-DMA: Disabling AGP.
PCI-DMA: aperture base @ 20000000 size 65536 KB
PCI-DMA: using GART IOMMU.
PCI-DMA: Reserving 64MB of IOMMU area in the AGP aperture
hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
hpet0: 3 comparators, 32-bit 14.318180 MHz counter
pnp: PnP ACPI init
ACPI: bus type pnp registered
pnp 00:00: mem resource (0x0-0x9ffff) overlaps 0000:02:02.0 BAR 6 (0x0-0xfffff), disabling
pnp 00:00: mem resource (0xe0000-0xfffff) overlaps 0000:02:02.0 BAR 6 (0x0-0xfffff), disabling
pnp 00:06: mem resource (0xc0000-0xc7fff) overlaps 0000:02:02.0 BAR 6 (0x0-0xfffff), disabling
pnp: PnP ACPI: found 8 devices
ACPI: ACPI bus type pnp unregistered
system 00:00: iomem range 0x100000-0xdfffffff could not be reserved
system 00:00: iomem range 0xfec00000-0xfec00fff could not be reserved
system 00:00: iomem range 0xffc00000-0xfff7ffff has been reserved
system 00:00: iomem range 0xfee00000-0xfee00fff has been reserved
system 00:00: iomem range 0xfff80000-0xffffffff has been reserved
system 00:06: ioport range 0x4d0-0x4d1 has been reserved
system 00:06: ioport range 0x1100-0x117f has been reserved
system 00:06: ioport range 0x1180-0x11ff has been reserved
system 00:06: ioport range 0x300-0x307 has been reserved
system 00:06: ioport range 0x421-0x42f has been reserved
system 00:06: ioport range 0xca2-0xca3 has been reserved
pci 0000:00:06.0: PCI bridge, secondary bus 0000:01
pci 0000:00:06.0:   IO window: 0x2000-0x2fff
pci 0000:00:06.0:   MEM window: 0xe8100000-0xe81fffff
pci 0000:00:06.0:   PREFETCH window: 0xe0000000-0xe00fffff
pci 0000:00:0a.0: PCI bridge, secondary bus 0000:02
pci 0000:00:0a.0:   IO window: 0x3000-0x3fff
pci 0000:00:0a.0:   MEM window: 0xe8200000-0xe82fffff
pci 0000:00:0a.0:   PREFETCH window: 0xe0100000-0xe01fffff
pci 0000:00:0b.0: PCI bridge, secondary bus 0000:03
pci 0000:00:0b.0:   IO window: 0x4000-0x4fff
pci 0000:00:0b.0:   MEM window: 0xe8300000-0xe83fffff
pci 0000:00:0b.0:   PREFETCH window: 0x000000f0000000-0x000000f7ffffff
NET: Registered protocol family 2
IP route cache hash table entries: 524288 (order: 10, 4194304 bytes)
TCP established hash table entries: 524288 (order: 11, 8388608 bytes)
TCP bind hash table entries: 65536 (order: 10, 4718592 bytes)
TCP: Hash tables configured (established 524288 bind 65536)
TCP reno registered
NET: Registered protocol family 1
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 2077k freed
HugeTLB registered 2 MB page size, pre-allocated 0 pages
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
msgmni has been set to 30758
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
boot interrupts on PCI device 0x1022:0x746b already disabled
pci 0000:00:0a.0: MSI quirk detected; subordinate MSI disabled
disabled boot interrupts on PCI device 0x1022:0x7450
pci 0000:00:0a.0: AMD8131 rev 12 detected; disabling PCI-X MMRBC
pci 0000:00:0b.0: MSI quirk detected; subordinate MSI disabled
disabled boot interrupts on PCI device 0x1022:0x7450
pci 0000:00:0b.0: AMD8131 rev 12 detected; disabling PCI-X MMRBC
input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
ACPI: Power Button [PWRF]
input: Power Button as /devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input1
ACPI: Power Button [PWRB]
processor LNXCPU:00: registered as cooling_device0
processor LNXCPU:01: registered as cooling_device1
Real Time Clock Driver v1.12b
AMD768 RNG detected
Linux agpgart interface v0.103
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Platform driver 'serial8250' needs updating - please use dev_pm_ops
00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Platform driver 'floppy' needs updating - please use dev_pm_ops
floppy0: no floppy controllers found
brd: module loaded
loop: module loaded
Uniform Multi-Platform E-IDE driver
amd74xx 0000:00:07.1: UDMA133 controller
amd74xx 0000:00:07.1: IDE controller (0x1022:0x7469 rev 0x03)
amd74xx 0000:00:07.1: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0x1020-0x1027
    ide1: BM-DMA at 0x1028-0x102f
hdc: LG CD-ROM CRN-8245B, ATAPI CD/DVD-ROM drive
hdc: UDMA/33 mode selected
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
ide_generic: please use "probe_mask=0x3f" module parameter for probing all legacy ISA IDE ports
ide-gd driver 1.18
ide-cd driver 5.00
ide-cd: hdc: ATAPI 24X CD-ROM drive, 128kB Cache
Uniform CD-ROM driver Revision: 3.20
sata_sil 0000:01:06.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
scsi0 : sata_sil
scsi1 : sata_sil
ata1: SATA max UDMA/100 mmio m512@0xe8102000 tf 0xe8102080 irq 17
ata2: SATA max UDMA/100 mmio m512@0xe8102000 tf 0xe81020c0 irq 17
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
ata1.00: ATA-6: ST380013AS, 3.25, max UDMA/133
ata1.00: 156312576 sectors, multi 16: LBA48 
ata1.00: configured for UDMA/100
scsi 0:0:0:0: Direct-Access     ATA      ST380013AS       3.25 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 156312576 512-byte logical blocks: (80.0 GB/74.5 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 >
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
ata2: SATA link down (SStatus 0 SControl 310)
Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
Copyright (c) 1999-2006 Intel Corporation.
e1000 0000:03:03.0: PCI INT A -> GSI 28 (level, low) -> IRQ 28
e1000: 0000:03:03.0: e1000_probe: (PCI:66MHz:64-bit) 00:02:b3:9b:20:ef
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
tg3.c:v3.99 (April 20, 2009)
tg3 0000:02:01.0: PCI INT A -> GSI 24 (level, low) -> IRQ 24
tg3 0000:02:01.0: PME# disabled
eth1: Tigon3 [partno(BCM95704A6) rev 2003] (PCIX:100MHz:64-bit) MAC address 00:0d:60:14:bf:64
eth1: attached PHY is 5704 (10/100/1000Base-T Ethernet) (WireSpeed[1])
eth1: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[1] TSOcap[0]
eth1: dma_rwctrl[769f4000] dma_mask[64-bit]
tg3 0000:02:01.1: PCI INT B -> GSI 25 (level, low) -> IRQ 25
tg3 0000:02:01.1: PME# disabled
eth2: Tigon3 [partno(BCM95704A6) rev 2003] (PCIX:100MHz:64-bit) MAC address 00:0d:60:14:bf:65
eth2: attached PHY is 5704 (10/100/1000Base-T Ethernet) (WireSpeed[1])
eth2: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] TSOcap[1]
eth2: dma_rwctrl[769f4000] dma_mask[64-bit]
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
console [netcon0] enabled
netconsole: network logging started
Fusion MPT base driver 3.04.10
Copyright (c) 1999-2008 LSI Corporation
Fusion MPT SPI Host driver 3.04.10
mptspi 0000:02:02.0: PCI INT A -> GSI 26 (level, low) -> IRQ 26
mptbase: ioc0: Initiating bringup
ioc0: LSI53C1030 B2: Capabilities={Initiator}
scsi2 : ioc0: LSI53C1030 B2, FwRev=01032316h, Ports=1, MaxQ=222, IRQ=26
Fusion MPT SAS Host driver 3.04.10
ieee1394: raw1394: /dev/raw1394 device initialized
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci_hcd 0000:01:00.0: PCI INT D -> GSI 19 (level, low) -> IRQ 19
ohci_hcd 0000:01:00.0: OHCI Host Controller
ohci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1
ohci_hcd 0000:01:00.0: irq 19, io mem 0xe8100000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd 0000:01:00.1: PCI INT D -> GSI 19 (level, low) -> IRQ 19
ohci_hcd 0000:01:00.1: OHCI Host Controller
ohci_hcd 0000:01:00.1: new USB bus registered, assigned bus number 2
ohci_hcd 0000:01:00.1: irq 19, io mem 0xe8101000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
uhci_hcd: USB Universal Host Controller Interface driver
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
PNP: No PS/2 controller found. Probing ports directly.
Platform driver 'i8042' needs updating - please use dev_pm_ops
usb 1-1: new full speed USB device using ohci_hcd and address 2
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
cpuidle: using governor ladder
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
oprofile: using NMI interrupt.
TCP cubic registered
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
powernow-k8: Found 2 AMD Opteron(tm) Processor 250 processors (2 cpu cores) (version 2.20.00)
powernow-k8:    0 : fid 0x10 (2400 MHz), vid 0x2
powernow-k8:    1 : fid 0xe (2200 MHz), vid 0x6
powernow-k8:    2 : fid 0xc (2000 MHz), vid 0xa
powernow-k8:    3 : fid 0xa (1800 MHz), vid 0xc
usb 1-1: configuration #1 chosen from 1 choice
input: IBM PPC I/F as /devices/pci0000:00/0000:00:06.0/0000:01:00.0/usb1/1-1/1-1:1.0/input/input2
generic-usb 0003:04B3:4001.0001: input: USB HID v1.10 Keyboard [IBM PPC I/F] on usb-0000:01:00.0-1/input0
input: IBM PPC I/F as /devices/pci0000:00/0000:00:06.0/0000:01:00.0/usb1/1-1/1-1:1.1/input/input3
generic-usb 0003:04B3:4001.0002: input: USB HID v1.10 Mouse [IBM PPC I/F] on usb-0000:01:00.0-1/input1
powernow-k8:    4 : fid 0x2 (1000 MHz), vid 0xe
powernow-k8:    0 : fid 0x10 (2400 MHz), vid 0x2
powernow-k8:    1 : fid 0xe (2200 MHz), vid 0x6
powernow-k8:    2 : fid 0xc (2000 MHz), vid 0xa
powernow-k8:    3 : fid 0xa (1800 MHz), vid 0xc
powernow-k8:    4 : fid 0x2 (1000 MHz), vid 0xe
Freeing unused kernel memory: 2396k freed
Begin: Loading essential drivers... ...
Done.
Begin: Running /scripts/init-premount ...
ata_id[1419]: main: unable to open '/dev/.tmp-0-0'
ata_id[1461]: main: unable to open '/dev/.tmp-0-0'
Done.
Begin: Mounting root file system... ...
Begin: Running /scripts/local-top ...
Done.
Begin: Waiting for root file system... ...


-- 
Thanks and Regards
gautham

[-- Attachment #2: config-autobench-2.6.31-rc5-autokern1-tip.bz2 --]
[-- Type: application/octet-stream, Size: 10542 bytes --]

^ permalink raw reply related	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-04  8:18                       ` [tip:core/rcu] rcu: Add " Gautham R Shenoy
@ 2009-08-04  8:20                         ` Ingo Molnar
  2009-08-04 11:01                           ` Ingo Molnar
  2009-08-04 15:37                         ` Paul E. McKenney
  1 sibling, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-04  8:20 UTC (permalink / raw)
  To: Gautham R Shenoy
  Cc: Paul E. McKenney, mingo, hpa, linux-kernel, tglx,
	linux-tip-commits


* Gautham R Shenoy <ego@in.ibm.com> wrote:

> On Mon, Aug 03, 2009 at 09:04:58AM +0200, Ingo Molnar wrote:
> > [    0.010000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> > [    0.010000] ... MAX_LOCKDEP_SUBCLASSES:  8
> > [    0.010000] ... MAX_LOCK_DEPTH:          48
> > [    0.010000] ... MAX_LOCKDEP_KEYS:        8191
> > [    0.010000] ... CLASSHASH_SIZE:          4096
> > [    0.010000] ... MAX_LOCKDEP_ENTRIES:     16384
> > [    0.010000] ... MAX_LOCKDEP_CHAINS:      32768
> > [    0.010000] ... CHAINHASH_SIZE:          16384
> > [    0.010000]  memory used by lock dependency info: 5823 kB
> > [    0.010000]  per task-struct memory footprint: 1920 bytes
> > [    0.010000] ------------------------
> > [    0.010000] | Locking API testsuite:
> > [    0.010000] ----------------------------------------------------------------------------
> > [    0.010000]                                  | spin |wlock |rlock |mutex | wsem | rsem |
> > [    0.010000]   --------------------------------------------------------------------------
> > [    0.010000]                      A-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]                  A-B-B-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]              A-B-B-C-C-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]              A-B-C-A-B-C deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]          A-B-B-C-C-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]          A-B-C-D-B-D-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]          A-B-C-D-B-C-D-A deadlock:failed|failed|  ok  |failed|failed|failed|
> > [    0.010000]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> > [    0.010000]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> > [    0.010000]                  bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
> > [    0.010000]   --------------------------------------------------------------------------
> > [    0.010000]               recursive read-lock:             |  ok  |             |failed|
> > [    0.010000]            recursive read-lock #2:             |  ok  |             |failed|
> > [    0.010000]             mixed read-write-lock:             |failed|             |failed|
> > [    0.010000]             mixed write-read-lock:             |failed|             |failed|
> > [    0.010000]   --------------------------------------------------------------------------
> > [    0.010000]      hard-irqs-on + irq-safe-A/12:failed|failed|  ok  |
> > [    0.010000]      soft-irqs-on + irq-safe-A/12:failed|failed|  ok  |
> > [    0.010000]      hard-irqs-on + irq-safe-A/21:failed|failed|  ok  |
> > [    0.010000]      soft-irqs-on + irq-safe-A/21:failed|failed|  ok  |
> > [    0.010000]        sirq-safe-A => hirqs-on/12:failed|failed|  ok  |
> > [    0.010000]        sirq-safe-A => hirqs-on/21:failed|failed|  ok  |
> > [    0.010000]          hard-safe-A + irqs-on/12:failed|failed|  ok  |
> > [    0.010000]          soft-safe-A + irqs-on/12:failed|failed|  ok  |
> > [    0.010000]          hard-safe-A + irqs-on/21:failed|failed|  ok  |
> > [    0.010000]          soft-safe-A + irqs-on/21:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/123:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/123:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/132:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/132:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/213:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/213:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/231:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/231:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/312:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/312:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #1/321:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #1/321:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/123:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/123:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/132:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/132:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/213:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/213:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/231:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/231:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/312:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/312:failed|failed|  ok  |
> > [    0.010000]     hard-safe-A + unsafe-B #2/321:failed|failed|  ok  |
> > [    0.010000]     soft-safe-A + unsafe-B #2/321:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/123:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/123:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/132:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/132:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/213:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/213:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/231:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/231:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/312:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/312:failed|failed|  ok  |
> > [    0.010000]       hard-irq lock-inversion/321:failed|failed|  ok  |
> > [    0.010000]       soft-irq lock-inversion/321:failed|failed|  ok  |
> > [    0.010000]       hard-irq read-recursion/123:  ok  |
> > [    0.010000]       soft-irq read-recursion/123:  ok  |
> > [    0.010000]       hard-irq read-recursion/132:  ok  |
> > [    0.010000]       soft-irq read-recursion/132:  ok  |
> > [    0.010000]       hard-irq read-recursion/213:  ok  |
> > [    0.010000]       soft-irq read-recursion/213:  ok  |
> > [    0.010000]       hard-irq read-recursion/231:  ok  |
> > [    0.010000]       soft-irq read-recursion/231:  ok  |
> > [    0.010000]       hard-irq read-recursion/312:  ok  |
> > [    0.010000]       soft-irq read-recursion/312:  ok  |
> > [    0.010000]       hard-irq read-recursion/321:  ok  |
> > [    0.010000]       soft-irq read-recursion/321:  ok  |
> > [    0.010000] --------------------------------------------------------
> > [    0.010000] 133 out of 218 testcases failed, as expected. |
> > [    0.010000] ----------------------------------------------------
> 
> Hmm.. I tried to reproduce this on a similar 2 CPU machine running
> linux-2.6.31-rc5-tip. However, I couldn't reproduce this WARN_ON.
> 
> That aside, in my case, all the 218 lockdep test cases passed,
> while this bootlog shows quite a few failures.
> So, wondering if I am testing the right kernel version.

hm, maybe i sent the wrong config.

I'll try to reproduce it once more and will double check.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-08-03  5:09       ` Mike Galbraith
@ 2009-08-04  8:21         ` Mike Galbraith
  2009-08-04  8:24           ` [patch] perf tools: update perf top man page Mike Galbraith
                             ` (2 more replies)
  0 siblings, 3 replies; 1149+ messages in thread
From: Mike Galbraith @ 2009-08-04  8:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML

On Mon, 2009-08-03 at 07:09 +0200, Mike Galbraith wrote:

> Not sure I like waiting for input at start though, maybe just display
> and sleep a couple seconds would be friendlier.

I find both really annoying, so just go straight into displaying.  That
kind of usage information belongs in the man page.  I've updated same to
reflect the current implementation, and will submit separately.

perf_counter tools:  improve perf top interactive key handling.

Pressing any key which is not currently mapped to functionality, based on
startup command line options, displays currently mapped keys, and prompts
for input.  Pressing any unmapped key at the prompt returns the user to
display mode with variables unchanged.  eg, pressing ? <SPACE> <ESC> etc
displays currently available keys, the value of the variable associated
with that key, and prompts.  Pressing same again aborts input.


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

---
 tools/perf/builtin-top.c |  108 +++++++++++++++++++++++++++++++----------------
 1 file changed, 73 insertions(+), 35 deletions(-)

Index: linux-2.6/tools/perf/builtin-top.c
===================================================================
--- linux-2.6.orig/tools/perf/builtin-top.c
+++ linux-2.6/tools/perf/builtin-top.c
@@ -595,25 +595,84 @@ out_free:
 	free(buf);
 }
 
-static void print_known_keys(void)
+static void print_mapped_keys(void)
 {
-	fprintf(stdout, "\nknown keys:\n");
-	fprintf(stdout, "\t[d]     select display delay.\n");
-	fprintf(stdout, "\t[e]     select display entries (lines).\n");
-	fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
-	fprintf(stdout, "\t[f]     select normal display count filter.\n");
-	fprintf(stdout, "\t[F]     select annotation display count filter (percentage).\n");
-	fprintf(stdout, "\t[qQ]    quit.\n");
-	fprintf(stdout, "\t[s]     select annotation symbol and start annotation.\n");
-	fprintf(stdout, "\t[S]     stop annotation, revert to normal display.\n");
-	fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+	char *name = NULL;
+
+	if (sym_filter_entry) {
+		struct symbol *sym = (struct symbol *)(sym_filter_entry+1);
+		name = sym->name;
+	}
+
+	fprintf(stdout, "\nMapped keys:\n");
+	fprintf(stdout, "\t[d]     display refresh delay.             \t(%d)\n", delay_secs);
+	fprintf(stdout, "\t[e]     display entries (lines).           \t(%d)\n", print_entries);
+
+	if (nr_counters > 1)
+		fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_counter));
+
+	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
+
+	if (vmlinux) {
+		fprintf(stdout, "\t[F]     annotate display filter (percent). \t(%d%%)\n", sym_pcnt_filter);
+		fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
+		fprintf(stdout, "\t[S]     stop annotation.\n");
+	}
+
+	if (nr_counters > 1)
+		fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
+
 	fprintf(stdout, "\t[z]     toggle sample zeroing.             \t(%d)\n", zero ? 1 : 0);
+	fprintf(stdout, "\t[qQ]    quit.\n");
+}
+
+static int key_mapped(int c)
+{
+	switch (c) {
+		case 'd':
+		case 'e':
+		case 'f':
+		case 'z':
+		case 'q':
+		case 'Q':
+			return 1;
+		case 'E':
+		case 'w':
+			return nr_counters > 1 ? 1 : 0;
+		case 'F':
+		case 's':
+		case 'S':
+			return vmlinux ? 1 : 0;
+	}
+
+	return 0;
 }
 
 static void handle_keypress(int c)
 {
-	int once = 0;
-repeat:
+	if (!key_mapped(c)) {
+		struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
+		struct termios tc, save;
+
+		print_mapped_keys();
+		fprintf(stdout, "\nEnter selection, or unmapped key to continue: ");
+		fflush(stdout);
+
+		tcgetattr(0, &save);
+		tc = save;
+		tc.c_lflag &= ~(ICANON | ECHO);
+		tc.c_cc[VMIN] = 0;
+		tc.c_cc[VTIME] = 0;
+		tcsetattr(0, TCSANOW, &tc);
+
+		poll(&stdin_poll, 1, -1);
+		c = getc(stdin);
+
+		tcsetattr(0, TCSAFLUSH, &save);
+		if (!key_mapped(c))
+			return;
+	}
+
 	switch (c) {
 		case 'd':
 			prompt_integer(&delay_secs, "Enter display delay");
@@ -669,28 +728,6 @@ repeat:
 		case 'z':
 			zero = ~zero;
 			break;
-		default: {
-			struct pollfd stdin_poll = { .fd = 0, .events = POLLIN };
-			struct termios tc, save;
-
-			if (!once) {
-				print_known_keys();
-				once++;
-			}
-
-			tcgetattr(0, &save);
-			tc = save;
-			tc.c_lflag &= ~(ICANON | ECHO);
-			tc.c_cc[VMIN] = 0;
-			tc.c_cc[VTIME] = 0;
-			tcsetattr(0, TCSANOW, &tc);
-
-			poll(&stdin_poll, 1, -1);
-			c = getc(stdin);
-
-			tcsetattr(0, TCSAFLUSH, &save);
-			goto repeat;
-		}
 	}
 }
 
@@ -705,6 +742,7 @@ static void *display_thread(void *arg __
 	tc.c_lflag &= ~(ICANON | ECHO);
 	tc.c_cc[VMIN] = 0;
 	tc.c_cc[VTIME] = 0;
+
 repeat:
 	delay_msecs = delay_secs * 1000;
 	tcsetattr(0, TCSANOW, &tc);



^ permalink raw reply	[flat|nested] 1149+ messages in thread

* [patch] perf tools: update perf top man page
  2009-08-04  8:21         ` Mike Galbraith
@ 2009-08-04  8:24           ` Mike Galbraith
       [not found]             ` <new-submission>
  2009-08-04  8:32           ` [patch] perf tools: allow top users to switch between weighted and individual counter display Ingo Molnar
  2009-08-04 11:36           ` [tip:perfcounters/core] perf top: Improve interactive key handling tip-bot for Mike Galbraith
  2 siblings, 1 reply; 1149+ messages in thread
From: Mike Galbraith @ 2009-08-04  8:24 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML


perf_counter tools: update perf top manual page to reflect current implementation.


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

---
 tools/perf/Documentation/perf-top.txt |  112 ++++++++++++++++++++++++++++++----
 1 file changed, 99 insertions(+), 13 deletions(-)

Index: linux-2.6/tools/perf/Documentation/perf-top.txt
===================================================================
--- linux-2.6.orig/tools/perf/Documentation/perf-top.txt
+++ linux-2.6/tools/perf/Documentation/perf-top.txt
@@ -3,36 +3,122 @@ perf-top(1)
 
 NAME
 ----
-perf-top - Run a command and profile it
+perf-top - System profiling tool.
 
 SYNOPSIS
 --------
 [verse]
-'perf top' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
+'perf top' [-e <EVENT> | --event=EVENT] [<options>]
 
 DESCRIPTION
 -----------
-This command runs a command and gathers a performance counter profile
-from it.
+This command generates and displays a performance counter profile in realtime.
 
 
 OPTIONS
 -------
-<command>...::
-	Any command you can specify in a shell.
+-a::
+--all-cpus::
+        System-wide collection.  (default)
+
+-c <count>::
+--count=<count>::
+	Event period to sample.
+
+-C <cpu>::
+--CPU=<cpu>::
+	CPU to profile.
+
+-d <seconds>::
+--delay=<seconds>::
+	Number of seconds to delay between refreshes.
 
--e::
---event=::
+-e <event>::
+--event=<event>::
 	Select the PMU event. Selection can be a symbolic event name
 	(use 'perf list' to list all events) or a raw PMU
 	event (eventsel+umask) in the form of rNNN where NNN is a
-	 hexadecimal event descriptor.
+	hexadecimal event descriptor.
 
--a::
-        system-wide collection
+-E <entries>::
+--entries=<entries>::
+	Display this many functions.
+
+-f <count>::
+--count-filter=<count>::
+	Only display functions with more events than this.
+
+-F <freq>::
+--freq=<freq>::
+	Profile at this frequency.
+
+-i::
+--inherit::
+	Child tasks inherit counters, only makes sens with -p option.
+
+-k <path>::
+--vmlinux=<path>::
+	Path to vmlinux.  Required for annotation functionality.
+
+-m <pages>::
+--mmap-pages=<pages>::
+	Number of mmapped data pages.
+
+-p <pid>::
+--pid=<pid>::
+	Profile events on existing pid.
+
+-r <priority>::
+--realtime=<priority>::
+	Collect data with this RT SCHED_FIFO priority.
+
+-s <symbol>::
+--sym-annotate=<symbol>::
+        Annotate this symbol.  Requires -k option.
+
+-v::
+--verbose::
+	Be more verbose (show counter open errors, etc).
+
+-z::
+--zero::
+	Zero history across display updates.
+
+INTERACTIVE PROMPTING KEYS
+--------------------------
+
+[d]::
+	Display refresh delay.
+
+[e]::
+	Number of entries to display.
+
+[E]::
+	Event to display when multiple counters are active.
+
+[f]::
+	Profile display filter (>= hit count).
+
+[F]::
+	Annotation display filter (>= % of total).
+
+[s]::
+	Annotate symbol.
+
+[S]::
+	Stop annotation, return to full profile display.
+
+[w]::
+	Toggle between weighted sum and individual count[E]r profile.
+
+[z]::
+	Toggle event count zeroing across display updates.
+
+[qQ]::
+	Quit.
+
+Pressing any unmapped key displays a menu, and prompts for input.
 
--l::
-        scale counter values
 
 SEE ALSO
 --------



^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-08-04  8:21         ` Mike Galbraith
  2009-08-04  8:24           ` [patch] perf tools: update perf top man page Mike Galbraith
@ 2009-08-04  8:32           ` Ingo Molnar
  2009-08-04  8:46             ` Mike Galbraith
  2009-08-04 11:36           ` [tip:perfcounters/core] perf top: Improve interactive key handling tip-bot for Mike Galbraith
  2 siblings, 1 reply; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-04  8:32 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Peter Zijlstra, LKML


* Mike Galbraith <efault@gmx.de> wrote:

> On Mon, 2009-08-03 at 07:09 +0200, Mike Galbraith wrote:
> 
> > Not sure I like waiting for input at start though, maybe just 
> > display and sleep a couple seconds would be friendlier.
> 
> I find both really annoying, so just go straight into displaying.  
> That kind of usage information belongs in the man page.  I've 
> updated same to reflect the current implementation, and will 
> submit separately.

yeah - will apply both patches, thanks Mike.

I'm wondering, have you seen the 'tig' tool before? It puts the 
console into raw mode too and has a rather pleasant text interface. 
Since it's a relatively young project it might have a compact code 
base that could be imported (assuming the license is compatible and 
assuming what i say is true - have not checked yet).

	Ingo


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-08-04  8:32           ` [patch] perf tools: allow top users to switch between weighted and individual counter display Ingo Molnar
@ 2009-08-04  8:46             ` Mike Galbraith
  2009-08-04  8:56               ` Ingo Molnar
  0 siblings, 1 reply; 1149+ messages in thread
From: Mike Galbraith @ 2009-08-04  8:46 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML

On Tue, 2009-08-04 at 10:32 +0200, Ingo Molnar wrote:
> * Mike Galbraith <efault@gmx.de> wrote:
> 
> > On Mon, 2009-08-03 at 07:09 +0200, Mike Galbraith wrote:
> > 
> > > Not sure I like waiting for input at start though, maybe just 
> > > display and sleep a couple seconds would be friendlier.
> > 
> > I find both really annoying, so just go straight into displaying.  
> > That kind of usage information belongs in the man page.  I've 
> > updated same to reflect the current implementation, and will 
> > submit separately.
> 
> yeah - will apply both patches, thanks Mike.

Thanks.

> I'm wondering, have you seen the 'tig' tool before? It puts the 
> console into raw mode too and has a rather pleasant text interface. 
> Since it's a relatively young project it might have a compact code 
> base that could be imported (assuming the license is compatible and 
> assuming what i say is true - have not checked yet).

No, I haven't.  I'll take a look (time time time) though, because I'd
like to make top fully interactive, and my code is... um er, somewhat
crude :)

	-Mike


^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [patch] perf tools: allow top users to switch between weighted and individual counter display
  2009-08-04  8:46             ` Mike Galbraith
@ 2009-08-04  8:56               ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-04  8:56 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Peter Zijlstra, LKML


* Mike Galbraith <efault@gmx.de> wrote:

> On Tue, 2009-08-04 at 10:32 +0200, Ingo Molnar wrote:
> > * Mike Galbraith <efault@gmx.de> wrote:
> > 
> > > On Mon, 2009-08-03 at 07:09 +0200, Mike Galbraith wrote:
> > > 
> > > > Not sure I like waiting for input at start though, maybe just 
> > > > display and sleep a couple seconds would be friendlier.
> > > 
> > > I find both really annoying, so just go straight into displaying.  
> > > That kind of usage information belongs in the man page.  I've 
> > > updated same to reflect the current implementation, and will 
> > > submit separately.
> > 
> > yeah - will apply both patches, thanks Mike.
> 
> Thanks.
> 
> > I'm wondering, have you seen the 'tig' tool before? It puts the 
> > console into raw mode too and has a rather pleasant text interface. 
> > Since it's a relatively young project it might have a compact code 
> > base that could be imported (assuming the license is compatible and 
> > assuming what i say is true - have not checked yet).
> 
> No, I haven't.  I'll take a look (time time time) though, because 
> I'd like to make top fully interactive, and my code is... um er, 
> somewhat crude :)

it's at:

  git clone http://jonas.nitro.dk/tig/tig.git

7 KLOC and clean looking. Code seems quite readable and in standard 
Git style - i.e. kernel and tools/perf/ compatible. License is GPLv2 
or later - i.e. that too is kernel compatible.

The tig.c is a bit large at 7000+ lines, but it looks easily split. 
It uses libcurses for console handling.

Looks like a pretty good starting point IMO.

	Ingo

^ permalink raw reply	[flat|nested] 1149+ messages in thread

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-04  8:20                         ` Ingo Molnar
@ 2009-08-04 11:01                           ` Ingo Molnar
  0 siblings, 0 replies; 1149+ messages in thread
From: Ingo Molnar @ 2009-08-04 11:01 UTC (permalink / raw)
  To: Gautham R Shenoy
  Cc: Paul E. McKenney, mingo, hpa, linux-kernel, tglx,
	linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]


* Ingo Molnar <mingo@elte.hu> wrote:

> > Hmm.. I tried to reproduce this on a similar 2 CPU machine 
> > running linux-2.6.31-rc5-tip. However, I couldn't reproduce this 
> > WARN_ON.
> > 
> > That aside, in my case, all the 218 lockdep test cases passed, 
> > while this bootlog shows quite a few failures. So, wondering if 
> > I am testing the right kernel version.
> 
> hm, maybe i sent the wrong config.
> 
> I'll try to reproduce it once more and will double check.

Another config attached which triggers this, plus the bootlog. I've 
rebooted the same kernel once more and the warning triggered for a 
second time as well.

	Ingo

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 64476 bytes --]

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc5
# Tue Aug  4 11:29:31 2009
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_FAST_CMPXCHG_LOCAL=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_DEFAULT_IDLE=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y
CONFIG_HAVE_CPUMASK_OF_CPU_MAP=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ZONE_DMA32=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
CONFIG_X86_64_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_TRAMPOLINE=y
# CONFIG_KTIME_SCALAR is not set
CONFIG_BOOTPARAM_SUPPORT_NOT_WANTED=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_BOOT_ALLOWED4=y
# CONFIG_BROKEN_BOOT_ALLOWED3 is not set
# CONFIG_BROKEN_BOOT_DISALLOWED is not set
CONFIG_BROKEN_BOOT_EUROPE=y
CONFIG_BROKEN_BOOT_TITAN=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
# CONFIG_TASK_DELAY_ACCT is not set
# CONFIG_TASK_XACCT is not set
CONFIG_AUDIT=y
# CONFIG_AUDITSYSCALL is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_TRACE=y
CONFIG_RCU_FANOUT=64
# CONFIG_RCU_FANOUT_EXACT is not set
CONFIG_TREE_RCU_TRACE=y
# CONFIG_PREEMPT_RCU_TRACE is not set
CONFIG_IKCONFIG=y
# CONFIG_IKCONFIG_PROC is not set
CONFIG_LOG_BUF_SHIFT=20
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_GROUP_SCHED=y
# CONFIG_FAIR_GROUP_SCHED is not set
CONFIG_RT_GROUP_SCHED=y
CONFIG_USER_SCHED=y
# CONFIG_CGROUP_SCHED is not set
# CONFIG_CGROUPS is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_RELAY=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
# CONFIG_NET_NS is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_EMBEDDED=y
# CONFIG_UID16 is not set
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
# CONFIG_SIGNALFD is not set
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
# CONFIG_SHMEM is not set
CONFIG_AIO=y
CONFIG_HAVE_PERF_COUNTERS=y

#
# Performance Counters
#
CONFIG_PERF_COUNTERS=y
CONFIG_EVENT_PROFILE=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_COMPAT_BRK=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
CONFIG_PROFILING=y
CONFIG_TRACEPOINTS=y
CONFIG_MARKERS=y
CONFIG_OPROFILE=y
# CONFIG_OPROFILE_IBS is not set
# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_HW_BREAKPOINT=y

#
# GCOV-based kernel profiling
#
CONFIG_SLOW_WORK=y
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
# CONFIG_MODULES is not set
CONFIG_BLOCK=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_BLK_DEV_INTEGRITY is not set
CONFIG_BLOCK_COMPAT=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"
CONFIG_PREEMPT_NOTIFIERS=y
# CONFIG_FREEZER is not set

#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_SMP_SUPPORT=y
# CONFIG_SPARSE_IRQ is not set
CONFIG_X86_MPPARSE=y
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_VSMP is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
CONFIG_PARAVIRT_GUEST=y
CONFIG_XEN=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=32
# CONFIG_XEN_DEBUG_FS is not set
CONFIG_KVM_CLOCK=y
CONFIG_KVM_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_PARAVIRT_DEBUG is not set
# CONFIG_MEMTEST is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_MVIAC7 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
CONFIG_GENERIC_CPU=y
CONFIG_X86_CPU=y
CONFIG_X86_L1_CACHE_BYTES=64
CONFIG_X86_INTERNODE_CACHE_BYTES=64
CONFIG_X86_CMPXCHG=y
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_TSC=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_X86_DEBUGCTLMSR=y
# CONFIG_PROCESSOR_SELECT is not set
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_CENTAUR=y
# CONFIG_X86_DS is not set
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
CONFIG_DMI=y
# CONFIG_GART_IOMMU is not set
CONFIG_CALGARY_IOMMU=y
CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
CONFIG_SWIOTLB=y
CONFIG_IOMMU_HELPER=y
# CONFIG_IOMMU_API is not set
CONFIG_MAXSMP=y
CONFIG_NR_CPUS=4096
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set
CONFIG_X86_MCE=y
# CONFIG_X86_MCE_INTEL is not set
CONFIG_X86_MCE_AMD=y
CONFIG_X86_MCE_THRESHOLD=y
CONFIG_X86_MCE_INJECT=y
CONFIG_I8K=y
# CONFIG_MICROCODE is not set
CONFIG_X86_MSR=y
# CONFIG_X86_CPUID is not set
# CONFIG_X86_CPU_DEBUG is not set
CONFIG_UP_WANTED_1=y
# CONFIG_UP_WANTED_2 is not set
CONFIG_SMP=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_DIRECT_GBPAGES=y
CONFIG_NUMA=y
CONFIG_K8_NUMA=y
# CONFIG_NUMA_EMU is not set
CONFIG_NODES_SHIFT=9
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
CONFIG_SELECT_MEMORY_MODEL=y
# CONFIG_FLATMEM_MANUAL is not set
# CONFIG_DISCONTIGMEM_MANUAL is not set
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_NEED_MULTIPLE_NODES=y
CONFIG_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not set
# CONFIG_MEMORY_HOTPLUG is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MIGRATION=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_HAVE_MLOCK=y
CONFIG_HAVE_MLOCKED_PAGE_BIT=y
CONFIG_MMU_NOTIFIER=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
# CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
CONFIG_X86_RESERVE_LOW_64K=y
# CONFIG_MTRR is not set
CONFIG_SECCOMP=y
CONFIG_CC_STACKPROTECTOR_ALL=y
CONFIG_CC_STACKPROTECTOR=y
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
CONFIG_HZ_1000=y
CONFIG_HZ=1000
CONFIG_SCHED_HRTICK=y
CONFIG_KEXEC=y
# CONFIG_CRASH_DUMP is not set
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_PHYSICAL_ALIGN=0x1000000
# CONFIG_HOTPLUG_CPU is not set
CONFIG_COMPAT_VDSO=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE=""
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y

#
# Power management and ACPI options
#
# CONFIG_PM is not set

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

#
# CPUFreq processor drivers
#
# CONFIG_X86_P4_CLOCKMOD is not set

#
# shared options
#
# CONFIG_X86_SPEEDSTEP_LIB is not set
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_IDLE_GOV_MENU=y

#
# Memory power savings
#
CONFIG_I7300_IDLE_IOAT_CHANNEL=y
CONFIG_I7300_IDLE=y

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_PCIEAER=y
CONFIG_PCIE_ECRC=y
CONFIG_PCIEAER_INJECT=y
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEBUG=y
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
# CONFIG_PCI_LEGACY is not set
CONFIG_PCI_DEBUG=y
# CONFIG_PCI_STUB is not set
CONFIG_HT_IRQ=y
# CONFIG_PCI_IOV is not set
CONFIG_ISA_DMA_API=y
CONFIG_K8_NB=y
CONFIG_PCCARD=y
CONFIG_PCMCIA_DEBUG=y
# CONFIG_PCMCIA is not set
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
# CONFIG_YENTA_TI is not set
# CONFIG_YENTA_TOSHIBA is not set
CONFIG_PCCARD_NONSTATIC=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_CPCI_ZT5550=y
CONFIG_HOTPLUG_PCI_CPCI_GENERIC=y
# CONFIG_HOTPLUG_PCI_SHPC is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
# CONFIG_HAVE_AOUT is not set
# CONFIG_BINFMT_MISC is not set
CONFIG_IA32_EMULATION=y
CONFIG_IA32_AOUT=y
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
CONFIG_UNIX=y
CONFIG_XFRM=y
CONFIG_XFRM_USER=y
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
CONFIG_NET_IPGRE=y
# CONFIG_NET_IPGRE_BROADCAST is not set
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_ARPD=y
CONFIG_SYN_COOKIES=y
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
CONFIG_INET_LRO=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_TCP_MD5SIG=y
CONFIG_IPV6=y
# CONFIG_IPV6_PRIVACY is not set
# CONFIG_IPV6_ROUTER_PREF is not set
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=y
# CONFIG_INET6_ESP is not set
CONFIG_INET6_IPCOMP=y
CONFIG_IPV6_MIP6=y
CONFIG_INET6_XFRM_TUNNEL=y
CONFIG_INET6_TUNNEL=y
# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
CONFIG_INET6_XFRM_MODE_TUNNEL=y
# CONFIG_INET6_XFRM_MODE_BEET is not set
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y
# CONFIG_IPV6_SIT is not set
CONFIG_IPV6_TUNNEL=y
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_NETLABEL=y
CONFIG_NETWORK_SECMARK=y
# CONFIG_NETFILTER is not set
CONFIG_IP_DCCP=y
CONFIG_INET_DCCP_DIAG=y

#
# DCCP CCIDs Configuration (EXPERIMENTAL)
#
CONFIG_IP_DCCP_CCID2_DEBUG=y
# CONFIG_IP_DCCP_CCID3 is not set

#
# DCCP Kernel Hacking
#
# CONFIG_IP_DCCP_DEBUG is not set
CONFIG_IP_SCTP=y
CONFIG_SCTP_DBG_MSG=y
# CONFIG_SCTP_DBG_OBJCNT is not set
# CONFIG_SCTP_HMAC_NONE is not set
CONFIG_SCTP_HMAC_SHA1=y
# CONFIG_SCTP_HMAC_MD5 is not set
CONFIG_RDS=y
CONFIG_RDS_DEBUG=y
CONFIG_TIPC=y
# CONFIG_TIPC_ADVANCED is not set
CONFIG_TIPC_DEBUG=y
# CONFIG_ATM is not set
CONFIG_STP=y
CONFIG_GARP=y
CONFIG_BRIDGE=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_TAG_DSA=y
CONFIG_NET_DSA_TAG_EDSA=y
CONFIG_NET_DSA_TAG_TRAILER=y
CONFIG_NET_DSA_MV88E6XXX=y
CONFIG_NET_DSA_MV88E6060=y
CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
CONFIG_NET_DSA_MV88E6131=y
CONFIG_NET_DSA_MV88E6123_61_65=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_DECNET=y
CONFIG_DECNET_ROUTER=y
CONFIG_LLC=y
CONFIG_LLC2=y
CONFIG_IPX=y
CONFIG_IPX_INTERN=y
CONFIG_ATALK=y
CONFIG_DEV_APPLETALK=y
CONFIG_IPDDP=y
CONFIG_IPDDP_ENCAP=y
CONFIG_IPDDP_DECAP=y
CONFIG_X25=y
# CONFIG_LAPB is not set
CONFIG_ECONET=y
CONFIG_ECONET_AUNUDP=y
# CONFIG_ECONET_NATIVE is not set
# CONFIG_WAN_ROUTER is not set
CONFIG_PHONET=y
CONFIG_IEEE802154=y
# CONFIG_NET_SCHED is not set
CONFIG_DCB=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
CONFIG_NET_DROP_MONITOR=y
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
# CONFIG_AX25 is not set
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y

#
# CAN Device Drivers
#
# CONFIG_CAN_VCAN is not set
# CONFIG_CAN_DEV is not set
CONFIG_CAN_DEBUG_DEVICES=y
CONFIG_IRDA=y

#
# IrDA protocols
#
CONFIG_IRLAN=y
# CONFIG_IRNET is not set
# CONFIG_IRCOMM is not set
CONFIG_IRDA_ULTRA=y

#
# IrDA options
#
CONFIG_IRDA_CACHE_LAST_LSAP=y
# CONFIG_IRDA_FAST_RR is not set
# CONFIG_IRDA_DEBUG is not set

#
# Infrared-port device drivers
#

#
# SIR device drivers
#
CONFIG_IRTTY_SIR=y

#
# Dongle support
#
CONFIG_DONGLE=y
# CONFIG_ESI_DONGLE is not set
CONFIG_ACTISYS_DONGLE=y
CONFIG_TEKRAM_DONGLE=y
CONFIG_TOIM3232_DONGLE=y
CONFIG_LITELINK_DONGLE=y
CONFIG_MA600_DONGLE=y
# CONFIG_GIRBIL_DONGLE is not set
CONFIG_MCP2120_DONGLE=y
# CONFIG_OLD_BELKIN_DONGLE is not set
# CONFIG_ACT200L_DONGLE is not set
# CONFIG_KINGSUN_DONGLE is not set
CONFIG_KSDAZZLE_DONGLE=y
# CONFIG_KS959_DONGLE is not set

#
# FIR device drivers
#
CONFIG_USB_IRDA=y
CONFIG_SIGMATEL_FIR=y
CONFIG_NSC_FIR=y
CONFIG_WINBOND_FIR=y
CONFIG_SMC_IRCC_FIR=y
CONFIG_ALI_FIR=y
CONFIG_VLSI_FIR=y
# CONFIG_VIA_FIR is not set
# CONFIG_MCS_FIR is not set
CONFIG_BT=y
CONFIG_BT_L2CAP=y
# CONFIG_BT_SCO is not set
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
# CONFIG_BT_BNEP is not set
CONFIG_BT_HIDP=y

#
# Bluetooth device drivers
#
CONFIG_BT_HCIBTUSB=y
# CONFIG_BT_HCIUART is not set
CONFIG_BT_HCIBCM203X=y
CONFIG_BT_HCIBPA10X=y
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
CONFIG_AF_RXRPC=y
# CONFIG_AF_RXRPC_DEBUG is not set
CONFIG_RXKAD=y
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
# CONFIG_CFG80211_REG_DEBUG is not set
CONFIG_CFG80211_DEBUGFS=y
CONFIG_WIRELESS_OLD_REGULATORY=y
CONFIG_WIRELESS_EXT=y
# CONFIG_WIRELESS_EXT_SYSFS is not set
CONFIG_LIB80211=y
CONFIG_LIB80211_CRYPT_WEP=y
CONFIG_LIB80211_CRYPT_CCMP=y
CONFIG_LIB80211_CRYPT_TKIP=y
# CONFIG_LIB80211_DEBUG is not set
CONFIG_MAC80211=y
# CONFIG_MAC80211_DEFAULT_PS is not set
CONFIG_MAC80211_DEFAULT_PS_VALUE=0

#
# Rate control algorithm selection
#
CONFIG_MAC80211_RC_PID=y
CONFIG_MAC80211_RC_MINSTREL=y
# CONFIG_MAC80211_RC_DEFAULT_PID is not set
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel"
CONFIG_MAC80211_LEDS=y
# CONFIG_MAC80211_DEBUGFS is not set
CONFIG_MAC80211_DEBUG_MENU=y
CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT=y
CONFIG_MAC80211_NOINLINE=y
CONFIG_MAC80211_VERBOSE_DEBUG=y
CONFIG_MAC80211_HT_DEBUG=y
CONFIG_MAC80211_TKIP_DEBUG=y
CONFIG_MAC80211_IBSS_DEBUG=y
CONFIG_MAC80211_VERBOSE_PS_DEBUG=y
CONFIG_WIMAX=y
CONFIG_WIMAX_DEBUG_LEVEL=8
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_RFKILL_INPUT=y

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_DEBUG_DRIVER is not set
CONFIG_DEBUG_DEVRES=y
# CONFIG_SYS_HYPERVISOR is not set
CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_SERIAL=y
CONFIG_PARPORT_PC_FIFO=y
# CONFIG_PARPORT_PC_SUPERIO is not set
# CONFIG_PARPORT_GSC is not set
CONFIG_PARPORT_AX88796=y
# CONFIG_PARPORT_1284 is not set
CONFIG_PARPORT_NOT_PC=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_CPQ_DA=y
# CONFIG_BLK_CPQ_CISS_DA is not set
CONFIG_BLK_DEV_DAC960=y
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_CRYPTOLOOP=y
# CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_OSD is not set
CONFIG_BLK_DEV_SX8=y
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_XIP=y
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_XEN_BLKDEV_FRONTEND is not set
CONFIG_BLK_DEV_HD=y
CONFIG_MISC_DEVICES=y
CONFIG_IBM_ASM=y
CONFIG_PHANTOM=y
CONFIG_SGI_IOC4=y
CONFIG_TIFM_CORE=y
CONFIG_TIFM_7XX1=y
CONFIG_ICS932S401=y
# CONFIG_ENCLOSURE_SERVICES is not set
CONFIG_HP_ILO=y
CONFIG_ISL29003=y
CONFIG_C2PORT=y
CONFIG_C2PORT_DURAMAR_2150=y

#
# EEPROM support
#
CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_AT25=y
CONFIG_EEPROM_LEGACY=y
CONFIG_EEPROM_MAX6875=y
CONFIG_EEPROM_93CX6=y
CONFIG_CB710_CORE=y
# CONFIG_CB710_DEBUG is not set
CONFIG_CB710_DEBUG_ASSUMPTIONS=y
CONFIG_HAVE_IDE=y

#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_TGT=y
CONFIG_SCSI_NETLINK=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_CHR_DEV_OSST=y
# CONFIG_BLK_DEV_SR is not set
# CONFIG_CHR_DEV_SG is not set
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
# CONFIG_SCSI_SCAN_ASYNC is not set

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
# CONFIG_SCSI_FC_TGT_ATTRS is not set
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
CONFIG_SCSI_SRP_ATTRS=y
CONFIG_SCSI_SRP_TGT_ATTRS=y
CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
CONFIG_SCSI_CXGB3_ISCSI=y
CONFIG_BLK_DEV_3W_XXXX_RAID=y
CONFIG_SCSI_3W_9XXX=y
# CONFIG_SCSI_ACARD is not set
CONFIG_SCSI_AACRAID=y
CONFIG_SCSI_AIC7XXX=y
CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
CONFIG_AIC7XXX_RESET_DELAY_MS=5000
# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
CONFIG_AIC7XXX_DEBUG_MASK=0
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
# CONFIG_SCSI_AIC7XXX_OLD is not set
CONFIG_SCSI_AIC79XX=y
CONFIG_AIC79XX_CMDS_PER_DEVICE=32
CONFIG_AIC79XX_RESET_DELAY_MS=5000
# CONFIG_AIC79XX_DEBUG_ENABLE is not set
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
CONFIG_SCSI_AIC94XX=y
CONFIG_AIC94XX_DEBUG=y
CONFIG_SCSI_MVSAS=y
# CONFIG_SCSI_MVSAS_DEBUG is not set
CONFIG_SCSI_DPT_I2O=y
CONFIG_SCSI_ADVANSYS=y
CONFIG_SCSI_ARCMSR=y
CONFIG_SCSI_ARCMSR_AER=y
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_MPT2SAS=y
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
# CONFIG_SCSI_MPT2SAS_LOGGING is not set
# CONFIG_SCSI_HPTIOP is not set
CONFIG_SCSI_BUSLOGIC=y
CONFIG_LIBFC=y
CONFIG_LIBFCOE=y
CONFIG_FCOE=y
# CONFIG_FCOE_FNIC is not set
# CONFIG_SCSI_DMX3191D is not set
CONFIG_SCSI_EATA=y
# CONFIG_SCSI_EATA_TAGGED_QUEUE is not set
CONFIG_SCSI_EATA_LINKED_COMMANDS=y
CONFIG_SCSI_EATA_MAX_TAGS=16
CONFIG_SCSI_FUTURE_DOMAIN=y
# CONFIG_SCSI_GDTH is not set
CONFIG_SCSI_IPS=y
CONFIG_SCSI_INITIO=y
# CONFIG_SCSI_INIA100 is not set
CONFIG_SCSI_PPA=y
CONFIG_SCSI_IMM=y
# CONFIG_SCSI_IZIP_EPP16 is not set
CONFIG_SCSI_IZIP_SLOW_CTR=y
# CONFIG_SCSI_STEX is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
CONFIG_SCSI_IPR=y
CONFIG_SCSI_IPR_TRACE=y
CONFIG_SCSI_IPR_DUMP=y
CONFIG_SCSI_QLOGIC_1280=y
CONFIG_SCSI_QLA_FC=y
CONFIG_SCSI_QLA_ISCSI=y
CONFIG_SCSI_LPFC=y
# CONFIG_SCSI_LPFC_DEBUG_FS is not set
CONFIG_SCSI_DC395x=y
CONFIG_SCSI_DC390T=y
CONFIG_SCSI_SRP=y
CONFIG_SCSI_DH=y
CONFIG_SCSI_DH_RDAC=y
# CONFIG_SCSI_DH_HP_SW is not set
# CONFIG_SCSI_DH_EMC is not set
# CONFIG_SCSI_DH_ALUA is not set
CONFIG_SCSI_OSD_INITIATOR=y
CONFIG_SCSI_OSD_ULD=y
CONFIG_SCSI_OSD_DPRINT_SENSE=1
# CONFIG_SCSI_OSD_DEBUG is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
# CONFIG_SATA_SIL24 is not set
CONFIG_ATA_SFF=y
# CONFIG_SATA_SVW is not set
CONFIG_ATA_PIIX=y
CONFIG_SATA_MV=y
CONFIG_SATA_NV=y
CONFIG_PDC_ADMA=y
# CONFIG_SATA_QSTOR is not set
CONFIG_SATA_PROMISE=y
CONFIG_SATA_SX4=y
CONFIG_SATA_SIL=y
CONFIG_SATA_SIS=y
CONFIG_SATA_ULI=y
# CONFIG_SATA_VIA is not set
CONFIG_SATA_VITESSE=y
# CONFIG_SATA_INIC162X is not set
# CONFIG_PATA_ALI is not set
CONFIG_PATA_AMD=y
CONFIG_PATA_ARTOP=y
CONFIG_PATA_ATIIXP=y
CONFIG_PATA_CMD640_PCI=y
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
# CONFIG_PATA_CS5530 is not set
CONFIG_PATA_CYPRESS=y
CONFIG_PATA_EFAR=y
CONFIG_ATA_GENERIC=y
CONFIG_PATA_HPT366=y
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
CONFIG_PATA_IT821X=y
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_JMICRON is not set
CONFIG_PATA_TRIFLEX=y
CONFIG_PATA_MARVELL=y
CONFIG_PATA_MPIIX=y
CONFIG_PATA_OLDPIIX=y
CONFIG_PATA_NETCELL=y
CONFIG_PATA_NINJA32=y
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_NS87415 is not set
CONFIG_PATA_OPTI=y
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC_OLD is not set
CONFIG_PATA_RADISYS=y
CONFIG_PATA_RZ1000=y
# CONFIG_PATA_SC1200 is not set
CONFIG_PATA_SERVERWORKS=y
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_SIL680 is not set
CONFIG_PATA_SIS=y
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set
# CONFIG_PATA_PLATFORM is not set
# CONFIG_PATA_SCH is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
# CONFIG_MD_AUTODETECT is not set
CONFIG_MD_LINEAR=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
# CONFIG_MD_RAID456 is not set
# CONFIG_MD_MULTIPATH is not set
CONFIG_MD_FAULTY=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_MIRROR=y
CONFIG_DM_LOG_USERSPACE=y
CONFIG_DM_ZERO=y
# CONFIG_DM_MULTIPATH is not set
CONFIG_DM_DELAY=y
# CONFIG_DM_UEVENT is not set
CONFIG_FUSION=y
# CONFIG_FUSION_SPI is not set
# CONFIG_FUSION_FC is not set
CONFIG_FUSION_SAS=y
CONFIG_FUSION_MAX_SGE=128
CONFIG_FUSION_CTL=y
# CONFIG_FUSION_LOGGING is not set

#
# IEEE 1394 (FireWire) support
#

#
# You can enable one or both FireWire driver stacks.
#

#
# See the help texts for more information.
#
# CONFIG_FIREWIRE is not set
CONFIG_IEEE1394=y
CONFIG_IEEE1394_OHCI1394=y
CONFIG_IEEE1394_PCILYNX=y
# CONFIG_IEEE1394_SBP2 is not set
CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y
CONFIG_IEEE1394_ETH1394=y
CONFIG_IEEE1394_RAWIO=y
CONFIG_IEEE1394_VIDEO1394=y
CONFIG_IEEE1394_DV1394=y
# CONFIG_IEEE1394_VERBOSEDEBUG is not set
# CONFIG_I2O is not set
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
CONFIG_MACVLAN=y
CONFIG_EQUALIZER=y
CONFIG_TUN=y
CONFIG_VETH=y
CONFIG_ARCNET=y
CONFIG_ARCNET_1201=y
CONFIG_ARCNET_1051=y
CONFIG_ARCNET_RAW=y
CONFIG_ARCNET_CAP=y
# CONFIG_ARCNET_COM90xx is not set
CONFIG_ARCNET_COM90xxIO=y
# CONFIG_ARCNET_RIM_I is not set
CONFIG_ARCNET_COM20020=y
CONFIG_ARCNET_COM20020_PCI=y
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
# CONFIG_MARVELL_PHY is not set
CONFIG_DAVICOM_PHY=y
# CONFIG_QSEMI_PHY is not set
# CONFIG_LXT_PHY is not set
CONFIG_CICADA_PHY=y
CONFIG_VITESSE_PHY=y
# CONFIG_SMSC_PHY is not set
CONFIG_BROADCOM_PHY=y
CONFIG_ICPLUS_PHY=y
CONFIG_REALTEK_PHY=y
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
CONFIG_LSI_ET1011C_PHY=y
CONFIG_FIXED_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_HAPPYMEAL=y
CONFIG_SUNGEM=y
CONFIG_CASSINI=y
CONFIG_NET_VENDOR_3COM=y
CONFIG_VORTEX=y
# CONFIG_TYPHOON is not set
CONFIG_ENC28J60=y
# CONFIG_ENC28J60_WRITEVERIFY is not set
CONFIG_ETHOC=y
CONFIG_DNET=y
# CONFIG_NET_TULIP is not set
CONFIG_HP100=y
# CONFIG_IBM_NEW_EMAC_ZMII is not set
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
CONFIG_NET_PCI=y
CONFIG_PCNET32=y
CONFIG_AMD8111_ETH=y
CONFIG_ADAPTEC_STARFIRE=y
CONFIG_B44=y
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_FORCEDETH=y
CONFIG_FORCEDETH_NAPI=y
CONFIG_E100=y
CONFIG_FEALNX=y
CONFIG_NATSEMI=y
CONFIG_NE2K_PCI=y
CONFIG_8139CP=y
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
CONFIG_8139TOO_8129=y
# CONFIG_8139_OLD_RX_RESET is not set
CONFIG_R6040=y
# CONFIG_SIS900 is not set
# CONFIG_EPIC100 is not set
# CONFIG_SMSC9420 is not set
# CONFIG_SUNDANCE is not set
CONFIG_TLAN=y
CONFIG_KS8842=y
CONFIG_KS8851=y
# CONFIG_VIA_RHINE is not set
CONFIG_SC92031=y
CONFIG_NET_POCKET=y
CONFIG_ATP=y
CONFIG_DE600=y
CONFIG_DE620=y
CONFIG_ATL2=y
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
CONFIG_ACENIC_OMIT_TIGON_I=y
CONFIG_DL2K=y
CONFIG_E1000=y
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
CONFIG_IGB=y
# CONFIG_IGBVF is not set
# CONFIG_NS83820 is not set
CONFIG_HAMACHI=y
# CONFIG_YELLOWFIN is not set
CONFIG_R8169=y
CONFIG_R8169_VLAN=y
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
CONFIG_VIA_VELOCITY=y
CONFIG_TIGON3=y
# CONFIG_BNX2 is not set
CONFIG_QLA3XXX=y
CONFIG_ATL1=y
CONFIG_ATL1E=y
CONFIG_ATL1C=y
CONFIG_JME=y
CONFIG_NETDEV_10000=y
CONFIG_MDIO=y
# CONFIG_CHELSIO_T1 is not set
CONFIG_CHELSIO_T3_DEPENDS=y
CONFIG_CHELSIO_T3=y
CONFIG_ENIC=y
CONFIG_IXGBE=y
CONFIG_IXGBE_DCB=y
CONFIG_IXGB=y
# CONFIG_S2IO is not set
CONFIG_MYRI10GE=y
CONFIG_NIU=y
CONFIG_MLX4_EN=y
CONFIG_MLX4_CORE=y
CONFIG_MLX4_DEBUG=y
CONFIG_TEHUTI=y
# CONFIG_BNX2X is not set
# CONFIG_QLGE is not set
CONFIG_SFC=y
CONFIG_BE2NET=y
CONFIG_TR=y
CONFIG_IBMOL=y
CONFIG_3C359=y
# CONFIG_TMS380TR is not set

#
# Wireless LAN
#
CONFIG_WLAN_PRE80211=y
CONFIG_STRIP=y
CONFIG_WLAN_80211=y
CONFIG_LIBERTAS=y
CONFIG_LIBERTAS_USB=y
CONFIG_LIBERTAS_SPI=y
# CONFIG_LIBERTAS_DEBUG is not set
CONFIG_LIBERTAS_THINFIRM=y
CONFIG_LIBERTAS_THINFIRM_USB=y
CONFIG_AIRO=y
CONFIG_ATMEL=y
CONFIG_PCI_ATMEL=y
CONFIG_AT76C50X_USB=y
CONFIG_PRISM54=y
CONFIG_USB_ZD1201=y
CONFIG_USB_NET_RNDIS_WLAN=y
CONFIG_RTL8180=y
CONFIG_RTL8187=y
CONFIG_RTL8187_LEDS=y
# CONFIG_ADM8211 is not set
CONFIG_MAC80211_HWSIM=y
CONFIG_MWL8K=y
# CONFIG_P54_COMMON is not set
CONFIG_ATH_COMMON=y
CONFIG_ATH5K=y
# CONFIG_ATH5K_DEBUG is not set
CONFIG_ATH9K=y
CONFIG_ATH9K_DEBUG=y
CONFIG_AR9170_USB=y
CONFIG_AR9170_LEDS=y
# CONFIG_IPW2100 is not set
CONFIG_IPW2200=y
# CONFIG_IPW2200_MONITOR is not set
CONFIG_IPW2200_QOS=y
CONFIG_IPW2200_DEBUG=y
CONFIG_LIBIPW=y
CONFIG_LIBIPW_DEBUG=y
# CONFIG_IWLWIFI is not set
CONFIG_HOSTAP=y
CONFIG_HOSTAP_FIRMWARE=y
CONFIG_HOSTAP_FIRMWARE_NVRAM=y
# CONFIG_HOSTAP_PLX is not set
# CONFIG_HOSTAP_PCI is not set
CONFIG_B43=y
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
CONFIG_B43_LEDS=y
CONFIG_B43_HWRNG=y
CONFIG_B43_DEBUG=y
# CONFIG_B43_FORCE_PIO is not set
CONFIG_B43LEGACY=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
CONFIG_B43LEGACY_LEDS=y
CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
# CONFIG_B43LEGACY_DMA_AND_PIO_MODE is not set
CONFIG_B43LEGACY_DMA_MODE=y
# CONFIG_B43LEGACY_PIO_MODE is not set
# CONFIG_ZD1211RW is not set
CONFIG_HERMES=y
CONFIG_HERMES_CACHE_FW_ON_INIT=y
CONFIG_PLX_HERMES=y
CONFIG_TMD_HERMES=y
# CONFIG_NORTEL_HERMES is not set
CONFIG_PCI_HERMES=y
CONFIG_WL12XX=y

#
# WiMAX Wireless Broadband devices
#

#
# Enable MMC support to see WiMAX SDIO drivers
#

#
# USB Network Adapters
#
CONFIG_USB_CATC=y
CONFIG_USB_KAWETH=y
# CONFIG_USB_PEGASUS is not set
CONFIG_USB_RTL8150=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_GL620A=y
# CONFIG_USB_NET_NET1080 is not set
CONFIG_USB_NET_PLUSB=y
# CONFIG_USB_NET_MCS7830 is not set
CONFIG_USB_NET_RNDIS_HOST=y
# CONFIG_USB_NET_CDC_SUBSET is not set
CONFIG_USB_NET_ZAURUS=y
# CONFIG_USB_HSO is not set
# CONFIG_USB_NET_INT51X1 is not set
CONFIG_USB_CDC_PHONET=y
# CONFIG_WAN is not set
CONFIG_IEEE802154_DRIVERS=y
CONFIG_IEEE802154_FAKEHARD=y
# CONFIG_XEN_NETDEV_FRONTEND is not set
CONFIG_FDDI=y
CONFIG_DEFXX=y
# CONFIG_DEFXX_MMIO is not set
# CONFIG_SKFP is not set
CONFIG_HIPPI=y
CONFIG_ROADRUNNER=y
CONFIG_ROADRUNNER_LARGE_RINGS=y
CONFIG_PLIP=y
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
# CONFIG_PPP_FILTER is not set
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
# CONFIG_PPP_DEFLATE is not set
# CONFIG_PPP_BSDCOMP is not set
# CONFIG_PPP_MPPE is not set
CONFIG_PPPOE=y
CONFIG_PPPOL2TP=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=y
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_NET_FC=y
CONFIG_NETCONSOLE=y
CONFIG_NETCONSOLE_DYNAMIC=y
CONFIG_NETPOLL=y
# CONFIG_NETPOLL_TRAP is not set
CONFIG_NET_POLL_CONTROLLER=y
# CONFIG_ISDN is not set
CONFIG_PHONE=y

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_POLLDEV=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=y
CONFIG_XEN_KBDDEV_FRONTEND=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_LKKBD is not set
CONFIG_KEYBOARD_LM8323=y
CONFIG_KEYBOARD_NEWTON=y
CONFIG_KEYBOARD_STOWAWAY=y
# CONFIG_KEYBOARD_SUNKBD is not set
CONFIG_KEYBOARD_XTKBD=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
CONFIG_JOYSTICK_A3D=y
# CONFIG_JOYSTICK_ADI is not set
CONFIG_JOYSTICK_COBRA=y
CONFIG_JOYSTICK_GF2K=y
CONFIG_JOYSTICK_GRIP=y
CONFIG_JOYSTICK_GRIP_MP=y
# CONFIG_JOYSTICK_GUILLEMOT is not set
CONFIG_JOYSTICK_INTERACT=y
CONFIG_JOYSTICK_SIDEWINDER=y
CONFIG_JOYSTICK_TMDC=y
CONFIG_JOYSTICK_IFORCE=y
CONFIG_JOYSTICK_IFORCE_USB=y
# CONFIG_JOYSTICK_IFORCE_232 is not set
# CONFIG_JOYSTICK_WARRIOR is not set
# CONFIG_JOYSTICK_MAGELLAN is not set
# CONFIG_JOYSTICK_SPACEORB is not set
CONFIG_JOYSTICK_SPACEBALL=y
CONFIG_JOYSTICK_STINGER=y
CONFIG_JOYSTICK_TWIDJOY=y
# CONFIG_JOYSTICK_ZHENHUA is not set
# CONFIG_JOYSTICK_DB9 is not set
CONFIG_JOYSTICK_GAMECON=y
CONFIG_JOYSTICK_TURBOGRAFX=y
CONFIG_JOYSTICK_JOYDUMP=y
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
# CONFIG_JOYSTICK_XPAD_LEDS is not set
# CONFIG_JOYSTICK_WALKERA0701 is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=y
# CONFIG_TABLET_USB_GTCO is not set
# CONFIG_TABLET_USB_KBTAB is not set
CONFIG_TABLET_USB_WACOM=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ADS7846=y
CONFIG_TOUCHSCREEN_AD7877=y
CONFIG_TOUCHSCREEN_AD7879_I2C=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_EETI=y
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
CONFIG_TOUCHSCREEN_MTOUCH=y
CONFIG_TOUCHSCREEN_INEXIO=y
# CONFIG_TOUCHSCREEN_MK712 is not set
CONFIG_TOUCHSCREEN_PENMOUNT=y
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
CONFIG_TOUCHSCREEN_USB_EGALAX=y
# CONFIG_TOUCHSCREEN_USB_PANJIT is not set
CONFIG_TOUCHSCREEN_USB_3M=y
CONFIG_TOUCHSCREEN_USB_ITM=y
CONFIG_TOUCHSCREEN_USB_ETURBO=y
CONFIG_TOUCHSCREEN_USB_GUNZE=y
# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set
# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_W90X900 is not set
CONFIG_INPUT_MISC=y
CONFIG_INPUT_PCSPKR=y
# CONFIG_INPUT_APANEL is not set
CONFIG_INPUT_ATI_REMOTE=y
CONFIG_INPUT_ATI_REMOTE2=y
CONFIG_INPUT_KEYSPAN_REMOTE=y
# CONFIG_INPUT_POWERMATE is not set
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
CONFIG_INPUT_TWL4030_PWRBUTTON=y
CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_PCF50633_PMU=y

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PARKBD is not set
CONFIG_SERIO_PCIPS2=y
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
CONFIG_GAMEPORT=y
CONFIG_GAMEPORT_NS558=y
# CONFIG_GAMEPORT_L4 is not set
CONFIG_GAMEPORT_EMU10K1=y
# CONFIG_GAMEPORT_FM801 is not set

#
# Character devices
#
CONFIG_VT=y
# CONFIG_CONSOLE_TRANSLATIONS is not set
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_DEVKMEM=y
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_COMPUTONE=y
CONFIG_ROCKETPORT=y
CONFIG_CYCLADES=y
# CONFIG_CYZ_INTR is not set
# CONFIG_DIGIEPCA is not set
CONFIG_MOXA_INTELLIO=y
CONFIG_MOXA_SMARTIO=y
# CONFIG_ISI is not set
# CONFIG_SYNCLINK is not set
CONFIG_SYNCLINKMP=y
CONFIG_SYNCLINK_GT=y
# CONFIG_N_HDLC is not set
CONFIG_RISCOM8=y
CONFIG_SPECIALIX=y
CONFIG_SX=y
# CONFIG_RIO is not set
CONFIG_STALDRV=y
CONFIG_STALLION=y
# CONFIG_ISTALLION is not set
CONFIG_NOZOMI=y

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_MAX3100=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_CONSOLE_POLL=y
# CONFIG_SERIAL_JSM is not set
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
# CONFIG_PRINTER is not set
# CONFIG_PPDEV is not set
CONFIG_HVC_DRIVER=y
CONFIG_HVC_IRQ=y
CONFIG_HVC_XEN=y
CONFIG_IPMI_HANDLER=y
# CONFIG_IPMI_PANIC_EVENT is not set
# CONFIG_IPMI_DEVICE_INTERFACE is not set
CONFIG_IPMI_SI=y
CONFIG_IPMI_WATCHDOG=y
CONFIG_IPMI_POWEROFF=y
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_INTEL=y
# CONFIG_HW_RANDOM_AMD is not set
CONFIG_HW_RANDOM_VIA=y
CONFIG_NVRAM=y
CONFIG_R3964=y
# CONFIG_APPLICOM is not set
CONFIG_MWAVE=y
# CONFIG_PC8736x_GPIO is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_TCG_TPM=y
# CONFIG_TCG_NSC is not set
CONFIG_TCG_ATMEL=y
# CONFIG_TELCLOCK is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCA=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
CONFIG_I2C_ALI1535=y
CONFIG_I2C_ALI1563=y
# CONFIG_I2C_ALI15X3 is not set
CONFIG_I2C_AMD756=y
# CONFIG_I2C_AMD8111 is not set
CONFIG_I2C_I801=y
CONFIG_I2C_ISCH=y
CONFIG_I2C_PIIX4=y
CONFIG_I2C_NFORCE2=y
# CONFIG_I2C_SIS5595 is not set
CONFIG_I2C_SIS630=y
CONFIG_I2C_SIS96X=y
CONFIG_I2C_VIA=y
# CONFIG_I2C_VIAPRO is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
CONFIG_I2C_OCORES=y
# CONFIG_I2C_SIMTEC is not set

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT=y
# CONFIG_I2C_PARPORT_LIGHT is not set
CONFIG_I2C_TAOS_EVM=y
CONFIG_I2C_TINY_USB=y

#
# Graphics adapter I2C/DDC channel drivers
#
CONFIG_I2C_VOODOO3=y

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_PCA_PLATFORM=y

#
# Miscellaneous I2C Chip support
#
# CONFIG_DS1682 is not set
CONFIG_SENSORS_PCF8574=y
# CONFIG_PCF8575 is not set
CONFIG_SENSORS_PCA9539=y
CONFIG_SENSORS_TSL2550=y
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CHIP=y
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y

#
# SPI Master Controller Drivers
#
CONFIG_SPI_BITBANG=y
CONFIG_SPI_BUTTERFLY=y
CONFIG_SPI_LM70_LLP=y

#
# SPI Protocol Masters
#
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_TLE62X0=y

#
# PPS support
#
CONFIG_PPS=y
CONFIG_PPS_DEBUG=y
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
CONFIG_W1=y
# CONFIG_W1_CON is not set

#
# 1-wire Bus Masters
#
CONFIG_W1_MASTER_MATROX=y
# CONFIG_W1_MASTER_DS2490 is not set
CONFIG_W1_MASTER_DS2482=y

#
# 1-wire Slaves
#
# CONFIG_W1_SLAVE_THERM is not set
# CONFIG_W1_SLAVE_SMEM is not set
CONFIG_W1_SLAVE_DS2431=y
# CONFIG_W1_SLAVE_DS2433 is not set
CONFIG_W1_SLAVE_DS2760=y
CONFIG_W1_SLAVE_BQ27000=y
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
# CONFIG_PDA_POWER is not set
CONFIG_BATTERY_DS2760=y
CONFIG_BATTERY_DS2782=y
CONFIG_BATTERY_BQ27x00=y
CONFIG_BATTERY_MAX17040=y
CONFIG_CHARGER_PCF50633=y
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
# CONFIG_SENSORS_ABITUGURU is not set
CONFIG_SENSORS_ABITUGURU3=y
CONFIG_SENSORS_AD7414=y
# CONFIG_SENSORS_AD7418 is not set
CONFIG_SENSORS_ADCXX=y
CONFIG_SENSORS_ADM1021=y
# CONFIG_SENSORS_ADM1025 is not set
CONFIG_SENSORS_ADM1026=y
CONFIG_SENSORS_ADM1029=y
# CONFIG_SENSORS_ADM1031 is not set
CONFIG_SENSORS_ADM9240=y
# CONFIG_SENSORS_ADT7462 is not set
CONFIG_SENSORS_ADT7470=y
# CONFIG_SENSORS_ADT7473 is not set
# CONFIG_SENSORS_ADT7475 is not set
CONFIG_SENSORS_K8TEMP=y
CONFIG_SENSORS_ASB100=y
CONFIG_SENSORS_ATXP1=y
CONFIG_SENSORS_DS1621=y
CONFIG_SENSORS_I5K_AMB=y
# CONFIG_SENSORS_F71805F is not set
# CONFIG_SENSORS_F71882FG is not set
CONFIG_SENSORS_F75375S=y
CONFIG_SENSORS_FSCHER=y
CONFIG_SENSORS_FSCPOS=y
# CONFIG_SENSORS_FSCHMD is not set
CONFIG_SENSORS_G760A=y
# CONFIG_SENSORS_GL518SM is not set
CONFIG_SENSORS_GL520SM=y
CONFIG_SENSORS_CORETEMP=y
CONFIG_SENSORS_IBMAEM=y
CONFIG_SENSORS_IBMPEX=y
CONFIG_SENSORS_IT87=y
# CONFIG_SENSORS_LM63 is not set
CONFIG_SENSORS_LM70=y
CONFIG_SENSORS_LM75=y
CONFIG_SENSORS_LM77=y
CONFIG_SENSORS_LM78=y
CONFIG_SENSORS_LM80=y
# CONFIG_SENSORS_LM83 is not set
CONFIG_SENSORS_LM85=y
# CONFIG_SENSORS_LM87 is not set
CONFIG_SENSORS_LTC4215=y
# CONFIG_SENSORS_LTC4245 is not set
# CONFIG_SENSORS_LM95241 is not set
CONFIG_SENSORS_MAX1111=y
# CONFIG_SENSORS_MAX1619 is not set
CONFIG_SENSORS_MAX6650=y
# CONFIG_SENSORS_PC87360 is not set
CONFIG_SENSORS_PC87427=y
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_SENSORS_SIS5595 is not set
CONFIG_SENSORS_DME1737=y
CONFIG_SENSORS_SMSC47M1=y
CONFIG_SENSORS_SMSC47M192=y
CONFIG_SENSORS_SMSC47B397=y
CONFIG_SENSORS_ADS7828=y
CONFIG_SENSORS_THMC50=y
CONFIG_SENSORS_TMP401=y
CONFIG_SENSORS_VIA686A=y
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
CONFIG_SENSORS_W83781D=y
CONFIG_SENSORS_W83791D=y
CONFIG_SENSORS_W83792D=y
CONFIG_SENSORS_W83793=y
# CONFIG_SENSORS_W83L785TS is not set
CONFIG_SENSORS_W83L786NG=y
CONFIG_SENSORS_W83627HF=y
# CONFIG_SENSORS_W83627EHF is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_SENSORS_LIS3_SPI is not set
# CONFIG_SENSORS_APPLESMC is not set
CONFIG_HWMON_DEBUG_CHIP=y
# CONFIG_THERMAL is not set
# CONFIG_THERMAL_HWMON is not set
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_NOWAYOUT is not set

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=y
# CONFIG_TWL4030_WATCHDOG is not set
# CONFIG_ACQUIRE_WDT is not set
CONFIG_ADVANTECH_WDT=y
CONFIG_ALIM1535_WDT=y
# CONFIG_ALIM7101_WDT is not set
# CONFIG_SC520_WDT is not set
CONFIG_IB700_WDT=y
CONFIG_IBMASR=y
# CONFIG_WAFER_WDT is not set
CONFIG_I6300ESB_WDT=y
CONFIG_ITCO_WDT=y
# CONFIG_ITCO_VENDOR_SUPPORT is not set
CONFIG_IT8712F_WDT=y
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
CONFIG_SC1200_WDT=y
CONFIG_PC87413_WDT=y
# CONFIG_60XX_WDT is not set
CONFIG_SBC8360_WDT=y
CONFIG_CPU5_WDT=y
CONFIG_SMSC_SCH311X_WDT=y
# CONFIG_SMSC37B787_WDT is not set
CONFIG_W83627HF_WDT=y
CONFIG_W83877F_WDT=y
CONFIG_W83977F_WDT=y
# CONFIG_MACHZ_WDT is not set
CONFIG_SBC_EPX_C3_WATCHDOG=y

#
# PCI-based Watchdog Cards
#
CONFIG_PCIPCWATCHDOG=y
CONFIG_WDTPCI=y

#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=y
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
CONFIG_SSB=y
CONFIG_SSB_SPROM=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
CONFIG_SSB_B43_PCI_BRIDGE=y
CONFIG_SSB_SILENT=y
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
# CONFIG_MFD_SM501 is not set
CONFIG_HTC_PASIC3=y
CONFIG_TWL4030_CORE=y
# CONFIG_MFD_TMIO is not set
# CONFIG_PMIC_DA903X is not set
CONFIG_MFD_WM8400=y
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=y
# CONFIG_PCF50633_GPIO is not set
CONFIG_AB3100_CORE=y
CONFIG_EZX_PCAP=y
# CONFIG_REGULATOR is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
CONFIG_AGP_SIS=y
# CONFIG_AGP_VIA is not set
CONFIG_DRM=y
CONFIG_DRM_TDFX=y
# CONFIG_DRM_R128 is not set
CONFIG_DRM_RADEON=y
CONFIG_DRM_I810=y
# CONFIG_DRM_I830 is not set
# CONFIG_DRM_I915 is not set
CONFIG_DRM_MGA=y
# CONFIG_DRM_SIS is not set
CONFIG_DRM_VIA=y
CONFIG_DRM_SAVAGE=y
CONFIG_VGASTATE=y
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
CONFIG_FIRMWARE_EDID=y
CONFIG_FB_DDC=y
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB_FOREIGN_ENDIAN=y
# CONFIG_FB_BOTH_ENDIAN is not set
# CONFIG_FB_BIG_ENDIAN is not set
CONFIG_FB_LITTLE_ENDIAN=y
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_SVGALIB=y
# CONFIG_FB_MACMODES is not set
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y

#
# Frame buffer hardware drivers
#
# CONFIG_FB_PM2 is not set
CONFIG_FB_CYBER2000=y
CONFIG_FB_ARC=y
# CONFIG_FB_IMSTT is not set
CONFIG_FB_UVESA=y
# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
CONFIG_FB_S1D13XXX=y
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
CONFIG_FB_LE80578=y
CONFIG_FB_CARILLO_RANCH=y
CONFIG_FB_INTEL=y
CONFIG_FB_INTEL_DEBUG=y
CONFIG_FB_INTEL_I2C=y
CONFIG_FB_MATROX=y
# CONFIG_FB_MATROX_MILLENIUM is not set
CONFIG_FB_MATROX_MYSTIQUE=y
CONFIG_FB_MATROX_G=y
# CONFIG_FB_MATROX_I2C is not set
CONFIG_FB_MATROX_MULTIHEAD=y
CONFIG_FB_ATY128=y
CONFIG_FB_ATY128_BACKLIGHT=y
CONFIG_FB_ATY=y
CONFIG_FB_ATY_CT=y
CONFIG_FB_ATY_GENERIC_LCD=y
# CONFIG_FB_ATY_GX is not set
# CONFIG_FB_ATY_BACKLIGHT is not set
CONFIG_FB_S3=y
CONFIG_FB_SAVAGE=y
# CONFIG_FB_SAVAGE_I2C is not set
CONFIG_FB_SAVAGE_ACCEL=y
CONFIG_FB_SIS=y
# CONFIG_FB_SIS_300 is not set
CONFIG_FB_SIS_315=y
CONFIG_FB_VIA=y
CONFIG_FB_NEOMAGIC=y
CONFIG_FB_KYRO=y
CONFIG_FB_3DFX=y
CONFIG_FB_3DFX_ACCEL=y
CONFIG_FB_3DFX_I2C=y
# CONFIG_FB_VOODOO1 is not set
CONFIG_FB_VT8623=y
CONFIG_FB_TRIDENT=y
# CONFIG_FB_ARK is not set
CONFIG_FB_PM3=y
# CONFIG_FB_CARMINE is not set
CONFIG_FB_GEODE=y
# CONFIG_FB_GEODE_LX is not set
CONFIG_FB_GEODE_GX=y
CONFIG_FB_GEODE_GX1=y
# CONFIG_FB_TMIO is not set
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_FB_METRONOME=y
# CONFIG_FB_MB862XX is not set
CONFIG_FB_BROADSHEET=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=y
# CONFIG_LCD_LTV350QV is not set
# CONFIG_LCD_ILI9320 is not set
CONFIG_LCD_TDO24M=y
# CONFIG_LCD_VGG2432A4 is not set
CONFIG_LCD_PLATFORM=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_GENERIC is not set
CONFIG_BACKLIGHT_PROGEAR=y
CONFIG_BACKLIGHT_CARILLO_RANCH=y
# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
CONFIG_BACKLIGHT_SAHARA=y

#
# Display device support
#
# CONFIG_DISPLAY_SUPPORT is not set

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
CONFIG_VGACON_SOFT_SCROLLBACK=y
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
CONFIG_DUMMY_CONSOLE=y
CONFIG_FONT_8x16=y
# CONFIG_LOGO is not set
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_RAWMIDI=y
CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_OSSEMUL=y
# CONFIG_SND_MIXER_OSS is not set
CONFIG_SND_PCM_OSS=y
# CONFIG_SND_PCM_OSS_PLUGINS is not set
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=y
# CONFIG_SND_SEQ_HRTIMER_DEFAULT is not set
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VERBOSE_PRINTK=y
CONFIG_SND_DEBUG=y
# CONFIG_SND_DEBUG_VERBOSE is not set
CONFIG_SND_PCM_XRUN_DEBUG=y
CONFIG_SND_RAWMIDI_SEQ=y
# CONFIG_SND_OPL3_LIB_SEQ is not set
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
# CONFIG_SND_EMU10K1_SEQ is not set
CONFIG_SND_MPU401_UART=y
CONFIG_SND_DRIVERS=y
CONFIG_SND_PCSP=y
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_VIRMIDI is not set
CONFIG_SND_MTS64=y
CONFIG_SND_SERIAL_U16550=y
CONFIG_SND_MPU401=y
CONFIG_SND_PORTMAN2X4=y
# CONFIG_SND_PCI is not set
CONFIG_SND_SPI=y
# CONFIG_SND_USB is not set
CONFIG_SND_SOC=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# CONFIG_SND_SOC_ALL_CODECS is not set
CONFIG_SOUND_PRIME=y
# CONFIG_SOUND_OSS is not set
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
CONFIG_HID_DEBUG=y
CONFIG_HIDRAW=y

#
# USB Input Devices
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
CONFIG_USB_MOUSE=y

#
# Special HID drivers
#
# CONFIG_HID_A4TECH is not set
CONFIG_HID_APPLE=y
# CONFIG_HID_BELKIN is not set
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CYPRESS=y
# CONFIG_HID_DRAGONRISE is not set
# CONFIG_HID_EZKEY is not set
CONFIG_HID_KYE=y
CONFIG_HID_GYRATION=y
# CONFIG_HID_KENSINGTON is not set
CONFIG_HID_LOGITECH=y
CONFIG_LOGITECH_FF=y
# CONFIG_LOGIRUMBLEPAD2_FF is not set
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
CONFIG_HID_NTRIG=y
CONFIG_HID_PANTHERLORD=y
CONFIG_PANTHERLORD_FF=y
CONFIG_HID_PETALYNX=y
CONFIG_HID_SAMSUNG=y
CONFIG_HID_SONY=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_GREENASIA=y
# CONFIG_GREENASIA_FF is not set
# CONFIG_HID_SMARTJOYPLUS is not set
CONFIG_HID_TOPSEED=y
# CONFIG_HID_THRUSTMASTER is not set
CONFIG_HID_WACOM=y
# CONFIG_HID_ZEROPLUS is not set
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
CONFIG_USB_DYNAMIC_MINORS=y
# CONFIG_USB_OTG is not set
# CONFIG_USB_OTG_WHITELIST is not set
CONFIG_USB_OTG_BLACKLIST_HUB=y
CONFIG_USB_MON=y
CONFIG_USB_WUSB=y
CONFIG_USB_WUSB_CBAF=y
CONFIG_USB_WUSB_CBAF_DEBUG=y

#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
CONFIG_USB_XHCI_HCD=y
# CONFIG_USB_XHCI_HCD_DEBUGGING is not set
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_SSB=y
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_SL811_HCD=y
CONFIG_USB_R8A66597_HCD=y
# CONFIG_USB_HWA_HCD is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=y
CONFIG_USB_WDM=y
# CONFIG_USB_TMC is not set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
# CONFIG_USB_STORAGE is not set
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y

#
# USB port drivers
#
CONFIG_USB_USS720=y
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
CONFIG_USB_EMI26=y
CONFIG_USB_ADUTUX=y
# CONFIG_USB_SEVSEG is not set
CONFIG_USB_RIO500=y
CONFIG_USB_LEGOTOWER=y
# CONFIG_USB_LCD is not set
CONFIG_USB_BERRY_CHARGE=y
# CONFIG_USB_LED is not set
CONFIG_USB_CYPRESS_CY7C63=y
# CONFIG_USB_CYTHERM is not set
CONFIG_USB_IDMOUSE=y
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_SISUSBVGA_CON=y
CONFIG_USB_LD=y
# CONFIG_USB_TRANCEVIBRATOR is not set
CONFIG_USB_IOWARRIOR=y
CONFIG_USB_TEST=y
# CONFIG_USB_ISIGHTFW is not set
# CONFIG_USB_VST is not set

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_UWB=y
CONFIG_UWB_HWA=y
# CONFIG_UWB_WHCI is not set
# CONFIG_UWB_WLP is not set
# CONFIG_UWB_I1480U is not set
# CONFIG_MMC is not set
CONFIG_MEMSTICK=y
CONFIG_MEMSTICK_DEBUG=y

#
# MemoryStick drivers
#
CONFIG_MEMSTICK_UNSAFE_RESUME=y
CONFIG_MSPRO_BLOCK=y

#
# MemoryStick Host Controller Drivers
#
CONFIG_MEMSTICK_TIFM_MS=y
CONFIG_MEMSTICK_JMICRON_38X=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
# CONFIG_LEDS_ALIX2 is not set
CONFIG_LEDS_PCA9532=y
# CONFIG_LEDS_LP3944 is not set
CONFIG_LEDS_CLEVO_MAIL=y
CONFIG_LEDS_PCA955X=y
CONFIG_LEDS_DAC124S085=y
# CONFIG_LEDS_BD2802 is not set

#
# LED Trigg