All of lore.kernel.org
 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
                                 ` (705 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (704 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (703 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (702 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (701 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (700 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (699 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (698 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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>
                                 ` (697 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (695 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (694 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (693 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (692 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (691 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (690 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (689 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (688 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (687 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (686 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (685 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (684 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (683 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (682 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (681 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (680 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (679 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (678 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (677 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (676 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (675 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (674 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (673 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (672 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (671 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (670 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (669 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (668 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (667 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (666 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (665 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (664 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (663 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (662 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (661 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (660 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (659 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (658 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (657 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (656 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (655 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (654 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (653 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (652 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (651 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (650 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (649 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (648 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (647 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (646 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (645 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (644 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (643 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (642 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (641 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (640 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (639 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (638 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (637 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (636 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (635 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (634 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (633 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (632 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (631 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (630 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (629 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (628 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (627 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (626 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (625 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (624 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (623 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (622 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (621 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (620 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (619 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (618 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (617 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (616 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (615 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (614 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (613 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (612 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (611 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (610 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (609 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (608 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (607 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (606 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (605 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (604 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (603 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (602 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (601 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (600 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (599 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (598 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (597 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (596 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (595 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (594 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (593 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (592 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (591 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (590 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (589 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (588 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (587 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (586 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (585 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (584 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (583 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (582 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (581 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (580 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (579 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (578 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (577 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (576 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (575 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (574 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (573 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (572 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (571 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (570 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (569 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (568 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (567 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (566 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (565 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (564 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (563 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (562 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (561 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (560 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (559 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (558 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (557 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (556 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (555 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (554 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (553 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (552 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (551 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (550 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (549 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (548 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (547 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (546 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (545 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (544 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (543 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (542 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (541 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (540 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (539 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (538 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (537 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (536 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (535 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (534 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (533 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (532 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (531 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (530 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (529 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (528 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (527 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (526 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (525 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (524 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (523 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (522 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (521 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (520 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (519 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (518 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (517 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (516 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (515 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (514 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (513 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (512 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (511 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (510 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (509 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (508 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (507 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (506 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (505 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (504 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (503 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (502 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (501 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (500 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (499 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (498 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (497 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (496 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (495 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (494 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (493 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (492 subsequent siblings)
  706 siblings, 2 replies; 1150+ 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] 1150+ 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
                                 ` (491 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (490 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (489 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (488 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (487 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (486 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (485 subsequent siblings)
  706 siblings, 2 replies; 1150+ 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] 1150+ 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
                                 ` (484 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (483 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (482 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (481 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (480 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (479 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (478 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (477 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (476 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (475 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (474 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (473 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (472 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (471 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (470 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (469 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (468 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (467 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (466 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (465 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (464 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (463 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (462 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (461 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (460 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (459 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (458 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (457 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (456 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (455 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (454 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (453 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (452 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (451 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (450 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (449 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (448 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (447 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (446 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (445 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (444 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (443 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (442 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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
                                 ` (441 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (440 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (439 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (438 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (437 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (436 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (435 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (434 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (433 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (432 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (431 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (430 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (429 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (428 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (427 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (426 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (425 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (424 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (423 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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
                                 ` (422 subsequent siblings)
  706 siblings, 2 replies; 1150+ 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] 1150+ 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
                                 ` (421 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (420 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (419 subsequent siblings)
  706 siblings, 0 replies; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (418 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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
                                 ` (417 subsequent siblings)
  706 siblings, 1 reply; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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] 1150+ 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; 1150+ 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 Triggers
#
CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_TIMER is not set
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
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 is not set
CONFIG_INFINIBAND_IPATH=y
CONFIG_INFINIBAND_AMSO1100=y
# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set
# CONFIG_INFINIBAND_CXGB3 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 is not set
CONFIG_INFINIBAND_SRP=y
# CONFIG_INFINIBAND_ISER is not set
CONFIG_EDAC=y

#
# Reporting subsystems
#
CONFIG_EDAC_DEBUG=y
CONFIG_EDAC_DEBUG_VERBOSE=y
# CONFIG_EDAC_MM_EDAC is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_DEBUG=y

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
CONFIG_RTC_DRV_DS1307=y
# CONFIG_RTC_DRV_DS1374 is not set
CONFIG_RTC_DRV_DS1672=y
CONFIG_RTC_DRV_MAX6900=y
CONFIG_RTC_DRV_RS5C372=y
CONFIG_RTC_DRV_ISL1208=y
CONFIG_RTC_DRV_X1205=y
CONFIG_RTC_DRV_PCF8563=y
CONFIG_RTC_DRV_PCF8583=y
CONFIG_RTC_DRV_M41T80=y
CONFIG_RTC_DRV_M41T80_WDT=y
# CONFIG_RTC_DRV_TWL4030 is not set
CONFIG_RTC_DRV_S35390A=y
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set

#
# SPI RTC drivers
#
CONFIG_RTC_DRV_M41T94=y
CONFIG_RTC_DRV_DS1305=y
CONFIG_RTC_DRV_DS1390=y
CONFIG_RTC_DRV_MAX6902=y
# CONFIG_RTC_DRV_R9701 is not set
CONFIG_RTC_DRV_RS5C348=y
CONFIG_RTC_DRV_DS3234=y

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
CONFIG_RTC_DRV_DS1286=y
CONFIG_RTC_DRV_DS1511=y
CONFIG_RTC_DRV_DS1553=y
CONFIG_RTC_DRV_DS1742=y
CONFIG_RTC_DRV_STK17TA8=y
# CONFIG_RTC_DRV_M48T86 is not set
CONFIG_RTC_DRV_M48T35=y
CONFIG_RTC_DRV_M48T59=y
# CONFIG_RTC_DRV_BQ4802 is not set
CONFIG_RTC_DRV_V3020=y
CONFIG_RTC_DRV_PCF50633=y

#
# on-CPU RTC drivers
#
# CONFIG_DMADEVICES is not set
# CONFIG_AUXDISPLAY is not set
CONFIG_UIO=y
CONFIG_UIO_CIF=y
CONFIG_UIO_PDRV=y
CONFIG_UIO_PDRV_GENIRQ=y
CONFIG_UIO_SMX=y
CONFIG_UIO_AEC=y
# CONFIG_UIO_SERCOS3 is not set

#
# TI VLYNQ
#
# CONFIG_XEN_BALLOON is not set
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XENFS=y
# CONFIG_XEN_COMPAT_XENFS is not set
# CONFIG_XEN_SYS_HYPERVISOR is not set
CONFIG_X86_PLATFORM_DEVICES=y

#
# Firmware Drivers
#
CONFIG_EDD=y
# CONFIG_EDD_OFF is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_DELL_RBU=y
# CONFIG_DCDBAS is not set
CONFIG_DMIID=y
CONFIG_ISCSI_IBFT_FIND=y
CONFIG_ISCSI_IBFT=y

#
# File systems
#
# CONFIG_EXT2_FS is not set
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_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS 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 is not set
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=y
CONFIG_OCFS2_FS=y
CONFIG_OCFS2_FS_O2CB=y
CONFIG_OCFS2_FS_USERSPACE_CLUSTER=y
CONFIG_OCFS2_FS_STATS=y
CONFIG_OCFS2_DEBUG_MASKLOG=y
# CONFIG_OCFS2_DEBUG_FS is not set
CONFIG_OCFS2_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
# CONFIG_INOTIFY is not set
# CONFIG_INOTIFY_USER is not set
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_PRINT_QUOTA_WARNING is not set
CONFIG_QUOTA_TREE=y
CONFIG_QFMT_V1=y
CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
# CONFIG_AUTOFS_FS is not set
CONFIG_AUTOFS4_FS=y
# CONFIG_FUSE_FS is not set
CONFIG_GENERIC_ACL=y

#
# Caches
#
# CONFIG_FSCACHE is not set

#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
# 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 is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not set
# CONFIG_PROC_SYSCTL is not set
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=y
CONFIG_ADFS_FS=y
CONFIG_ADFS_FS_RW=y
# CONFIG_AFFS_FS is not set
CONFIG_ECRYPT_FS=y
# CONFIG_HFS_FS is not set
CONFIG_HFSPLUS_FS=y
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
CONFIG_EFS_FS=y
CONFIG_CRAMFS=y
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
CONFIG_VXFS_FS=y
# CONFIG_MINIX_FS is not set
CONFIG_OMFS_FS=y
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_ROMFS_FS is not set
CONFIG_SYSV_FS=y
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y
CONFIG_UFS_DEBUG=y
CONFIG_EXOFS_FS=y
# CONFIG_EXOFS_DEBUG is not set
CONFIG_NILFS2_FS=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFSD=y
# CONFIG_NFSD_V3 is not set
# CONFIG_NFSD_V4 is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_SUNRPC_XPRT_RDMA=y
CONFIG_RPCSEC_GSS_KRB5=y
CONFIG_RPCSEC_GSS_SPKM3=y
# CONFIG_SMB_FS is not set
CONFIG_CIFS=y
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
# CONFIG_CIFS_WEAK_PW_HASH is not set
CONFIG_CIFS_UPCALL=y
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
# CONFIG_CIFS_DEBUG2 is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_EXPERIMENTAL=y
# CONFIG_NCP_FS is not set
CONFIG_CODA_FS=y
CONFIG_AFS_FS=y
CONFIG_AFS_DEBUG=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
# CONFIG_ACORN_PARTITION_CUMANA is not set
# CONFIG_ACORN_PARTITION_EESOX is not set
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_OSF_PARTITION=y
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
# CONFIG_MAC_PARTITION is not set
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_LDM_PARTITION=y
CONFIG_LDM_DEBUG=y
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
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 is not set
CONFIG_NLS_CODEPAGE_737=y
CONFIG_NLS_CODEPAGE_775=y
# CONFIG_NLS_CODEPAGE_850 is not set
CONFIG_NLS_CODEPAGE_852=y
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
# CONFIG_NLS_CODEPAGE_860 is not set
CONFIG_NLS_CODEPAGE_861=y
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
CONFIG_NLS_CODEPAGE_865=y
CONFIG_NLS_CODEPAGE_866=y
CONFIG_NLS_CODEPAGE_869=y
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=y
# CONFIG_NLS_CODEPAGE_949 is not set
CONFIG_NLS_CODEPAGE_874=y
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
CONFIG_NLS_CODEPAGE_1251=y
# CONFIG_NLS_ASCII is not set
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_2=y
# CONFIG_NLS_ISO8859_3 is not set
CONFIG_NLS_ISO8859_4=y
CONFIG_NLS_ISO8859_5=y
CONFIG_NLS_ISO8859_6=y
# CONFIG_NLS_ISO8859_7 is not set
CONFIG_NLS_ISO8859_9=y
CONFIG_NLS_ISO8859_13=y
CONFIG_NLS_ISO8859_14=y
CONFIG_NLS_ISO8859_15=y
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y
CONFIG_DLM=y
CONFIG_DLM_DEBUG=y

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
CONFIG_ALLOW_WARNINGS=y
CONFIG_ENABLE_WARN_DEPRECATED=y
# CONFIG_ENABLE_MUST_CHECK is not set
CONFIG_FRAME_WARN=2048
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 is not set
CONFIG_DETECT_SOFTLOCKUP=y
# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
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=y
CONFIG_SLUB_STATS=y
CONFIG_DEBUG_PREEMPT=y
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
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 is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
# CONFIG_DEBUG_MEMORY_INIT is not set
CONFIG_DEBUG_LIST=y
CONFIG_DEBUG_SG=y
# CONFIG_DEBUG_NOTIFIERS is not set
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
CONFIG_BOOT_PRINTK_DELAY=y
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_RCU_CPU_STALL_DETECTOR=y
CONFIG_BACKTRACE_SELF_TEST=y
CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAULT_INJECTION_DEBUG_FS=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_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_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_FUNCTION_GRAPH_TRACER=y
CONFIG_IRQSOFF_TRACER=y
CONFIG_PREEMPT_TRACER=y
CONFIG_SYSPROF_TRACER=y
# CONFIG_SCHED_TRACER is not set
CONFIG_FTRACE_SYSCALLS=y
CONFIG_BOOT_TRACER=y
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
CONFIG_POWER_TRACER=y
CONFIG_KSYM_TRACER=y
CONFIG_PROFILE_KSYM_TRACER=y
# CONFIG_STACK_TRACER is not set
CONFIG_KMEMTRACE=y
CONFIG_WORKQUEUE_TRACER=y
CONFIG_BLK_DEV_IO_TRACE=y
# CONFIG_DYNAMIC_FTRACE is not set
# CONFIG_FUNCTION_PROFILER is not set
CONFIG_FTRACE_SELFTEST=y
CONFIG_FTRACE_STARTUP_TEST=y
# CONFIG_MMIOTRACE is not set
# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
CONFIG_BUILD_DOCSRC=y
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_DMA_API_DEBUG is not set
CONFIG_SAMPLES=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
# CONFIG_KGDB_TESTS is not set
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 is not set
# CONFIG_DEBUG_STACKOVERFLOW is not set
CONFIG_DEBUG_STACK_USAGE=y
# CONFIG_DEBUG_PER_CPU_MAPS is not set
CONFIG_X86_PTDUMP=y
CONFIG_DEBUG_RODATA=y
CONFIG_DEBUG_RODATA_TEST=y
CONFIG_IOMMU_STRESS=y
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 is not set
CONFIG_IO_DELAY_0XED=y
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEFAULT_IO_DELAY_TYPE=1
CONFIG_DEBUG_BOOT_PARAMS=y
# CONFIG_CPA_DEBUG is not set
CONFIG_OPTIMIZE_INLINING=y

#
# Security options
#
CONFIG_KEYS=y
# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_NETWORK_XFRM=y
CONFIG_SECURITY_PATH=y
# CONFIG_SECURITY_FILE_CAPABILITIES is not set
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
# CONFIG_SECURITY_SELINUX_DISABLE is not set
CONFIG_SECURITY_SELINUX_DEVELOP=y
# CONFIG_SECURITY_SELINUX_AVC_STATS is not set
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
# CONFIG_SECURITY_TOMOYO is not set
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=y
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=y
CONFIG_CRYPTO_CTR=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_FPU=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 is not set
CONFIG_CRYPTO_RMD320=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_SHA512=y
# CONFIG_CRYPTO_TGR192 is not set
# CONFIG_CRYPTO_WP512 is not set

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_X86_64=y
CONFIG_CRYPTO_AES_NI_INTEL=y
# CONFIG_CRYPTO_ANUBIS is not set
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_BLOWFISH=y
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_X86_64=y
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
CONFIG_CRYPTO_TEA=y
# CONFIG_CRYPTO_TWOFISH is not set
CONFIG_CRYPTO_TWOFISH_COMMON=y
CONFIG_CRYPTO_TWOFISH_X86_64=y

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
# CONFIG_CRYPTO_ZLIB is not set
# CONFIG_CRYPTO_LZO is not set

#
# Random Number Generation
#
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_HW=y
CONFIG_CRYPTO_DEV_PADLOCK=y
CONFIG_CRYPTO_DEV_PADLOCK_AES=y
# CONFIG_CRYPTO_DEV_PADLOCK_SHA 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=y
CONFIG_KVM_TRACE=y
# CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_BALLOON is not set
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_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=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_64=y
CONFIG_FORCE_MINIMAL_CONFIG_PHYS=y

[-- Attachment #3: boot.log --]
[-- Type: text/plain, Size: 276477 bytes --]

[    0.000000] Linux version 2.6.31-rc5-tip-00896-g6efa9e9-dirty (mingo@sirius) (gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) ) #718 SMP PREEMPT Tue Aug 4 11:30:30 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
[    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] DMI 2.3 present.
[    0.000000] Phoenix BIOS detected: BIOS may corrupt low RAM, working around it.
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
[    0.000000] last_pfn = 0x3fff0 max_arch_pfn = 0x400000000
[    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] Scanning NUMA topology in Northbridge 24
[    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 [0000000000010000 - 0000000000043fff]
[    0.000000]   bootmap [0000000000044000 -  000000000004bfff] pages 8
[    0.000000] (6 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 - 0007cd4058]    TEXT DATA BSS ==> [0001000000 - 0007cd4058]
[    0.000000]   #3 [000009f800 - 0000100000]    BIOS reserved ==> [000009f800 - 0000100000]
[    0.000000]   #4 [0007cd5000 - 0007cd5149]              BRK ==> [0007cd5000 - 0007cd5149]
[    0.000000]   #5 [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] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 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[2] active PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0003fff0
[    0.000000] On node 0 totalpages: 262015
[    0.000000]   DMA zone: 104 pages used for memmap
[    0.000000]   DMA zone: 611 pages reserved
[    0.000000]   DMA zone: 3268 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 6552 pages used for memmap
[    0.000000]   DMA32 zone: 251480 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 480 pages at ffff880007cee000, static data 1942408 bytes
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 254748
[    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
[    0.000000] debug: sysrq always enabled.
[    0.000000] PID hash table entries: 4096 (order: 12, 32768 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Calgary: detecting Calgary via BIOS EBDA area
[    0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
[    0.000000] Memory: 903748k/1048512k available (15689k kernel code, 452k absent, 144312k reserved, 9369k data, 3384k 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:4352
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 2010.391 MHz processor.
[    0.000035] spurious 8259A interrupt: IRQ7.
[    0.000999] Console: colour VGA+ 80x25
[    0.000999] console [ttyS0] enabled, bootconsole disabled
[    0.000999] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.000999] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.000999] ... MAX_LOCK_DEPTH:          48
[    0.000999] ... MAX_LOCKDEP_KEYS:        8191
[    0.000999] ... CLASSHASH_SIZE:          4096
[    0.000999] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.000999] ... MAX_LOCKDEP_CHAINS:      32768
[    0.000999] ... CHAINHASH_SIZE:          16384
[    0.000999]  memory used by lock dependency info: 6367 kB
[    0.000999]  per task-struct memory footprint: 2688 bytes
[    0.000999] ODEBUG: 11 of 11 active objects replaced
[    0.000999] ODEBUG: selftest passed
[    0.001040] Calibrating delay loop (skipped), value calculated using timer frequency.. 4020.78 BogoMIPS (lpj=2010391)
[    0.004503] Security Framework initialized
[    0.005013] SELinux:  Disabled at boot.
[    0.007294] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.009469] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.010487] Mount-cache hash table entries: 256
[    0.013668] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.014008] CPU: L2 Cache: 512K (64 bytes/line)
[    0.015009] CPU 0/0x0 -> Node 0
[    0.016006] tseg: 0000000000
[    0.017030] CPU: Physical Processor ID: 0
[    0.018005] CPU: Processor Core ID: 0
[    0.019007] mce: CPU supports 5 MCE banks
[    0.020024] Performance Counters: AMD PMU driver.
[    0.022015] ... version:                 0
[    0.023005] ... bit width:               48
[    0.024004] ... generic counters:        4
[    0.025004] ... value mask:              0000ffffffffffff
[    0.026004] ... max period:              00007fffffffffff
[    0.027004] ... fixed-purpose counters:  0
[    0.028003] ... counter mask:            000000000000000f
[    0.031192] debug: unmapping init memory ffffffff8287c000..ffffffff8288f000
[    0.032473] Setting APIC routing to flat
[    0.033008] enabled ExtINT on CPU#0
[    0.034067] ExtINT not setup in hardware but reported by MP table
[    0.035116] ENABLING IO-APIC IRQs
[    0.036003] init IO_APIC IRQs
[    0.037002]  2-0 (apicid-pin) not connected
[    0.039051] IOAPIC[0]: Set routing entry (2-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.040022] IOAPIC[0]: Set routing entry (2-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
[    0.041018] IOAPIC[0]: Set routing entry (2-3 -> 0x33 -> IRQ 3 Mode:1 Active:1)
[    0.041993] IOAPIC[0]: Set routing entry (2-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-5 -> 0x35 -> IRQ 5 Mode:1 Active:1)
[    0.041993] IOAPIC[0]: Set routing entry (2-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-9 -> 0x39 -> IRQ 9 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-11 -> 0x3b -> IRQ 11 Mode:1 Active:1)
[    0.041993] IOAPIC[0]: Set routing entry (2-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
[    0.041993] IOAPIC[0]: Set routing entry (2-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
[    0.041993]  2-16 2-17 2-18 2-19 2-20 2-21 2-22 2-23 (apicid-pin) not connected
[    0.041993] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
[    0.041993] ..MP-BIOS bug: 8254 timer not connected to IO-APIC
[    0.041993] ...trying to set up timer (IRQ0) through the 8259A ...
[    0.041993] ..... (found apic 0 pin 0) ...
[    0.052859] ....... works.
[    0.052998] CPU0: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
[    0.055998] Using local APIC timer interrupts.
[    0.056000] calibrating APIC timer ...
[    0.057991] ... lapic delta = 1256253
[    0.057991] ..... delta 1256253
[    0.057991] ..... mult: 53963858
[    0.057991] ..... calibration result: 201000
[    0.057991] ..... CPU clock speed is 2010.0004 MHz.
[    0.057991] ..... host bus clock speed is 201.0000 MHz.
[    0.057991] ... verify APIC timer
[    0.160718] ... jiffies delta = 100
[    0.160981] ... jiffies result ok
[    0.162008] calling  migration_init+0x0/0x7b @ 1
[    0.163326] initcall migration_init+0x0/0x7b returned 0 after 0 usecs
[    0.163983] calling  spawn_ksoftirqd+0x0/0x7b @ 1
[    0.165143] initcall spawn_ksoftirqd+0x0/0x7b returned 0 after 0 usecs
[    0.165983] calling  init_call_single_data+0x0/0xd4 @ 1
[    0.166989] initcall init_call_single_data+0x0/0xd4 returned 0 after 0 usecs
[    0.167982] calling  spawn_softlockup_task+0x0/0x97 @ 1
[    0.169086] initcall spawn_softlockup_task+0x0/0x97 returned 0 after 0 usecs
[    0.169982] calling  relay_init+0x0/0x2d @ 1
[    0.170981] initcall relay_init+0x0/0x2d returned 0 after 0 usecs
[    0.171993] calling  tracer_alloc_buffers+0x0/0x2b5 @ 1
[    0.173252] Testing tracer nop: PASSED
[    0.174989] initcall tracer_alloc_buffers+0x0/0x2b5 returned 0 after 1952 usecs
[    0.175981] calling  init_trace_printk+0x0/0x2d @ 1
[    0.176980] initcall init_trace_printk+0x0/0x2d returned 0 after 0 usecs
[    0.177980] calling  trace_workqueue_early_init+0x0/0x164 @ 1
[    0.180002] initcall trace_workqueue_early_init+0x0/0x164 returned 0 after 976 usecs
[    0.183070] lockdep: fixing up alternatives.
[    0.184170] Booting processor 1 APIC 0x1 ip 0x6000
[    0.000999] Initializing CPU#1
[    0.000999] masked ExtINT on CPU#1
[    0.000999] Calibrating delay using timer specific routine.. 4019.90 BogoMIPS (lpj=2009954)
[    0.000999] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.000999] CPU: L2 Cache: 512K (64 bytes/line)
[    0.000999] CPU 1/0x1 -> Node 0
[    0.000999] CPU: Physical Processor ID: 0
[    0.000999] CPU: Processor Core ID: 1
[    0.000999] mce: CPU supports 5 MCE banks
[    0.256043] CPU1: 
[    0.255973] ------------[ cut here ]------------
[    0.255982] WARNING: at kernel/rcutree.c:1140 __rcu_process_callbacks+0x45/0x100()
[    0.255986] Hardware name: System Product Name
[    0.255990] Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip-00896-g6efa9e9-dirty #718
[    0.255994] Call Trace:
[    0.255996]  <IRQ>  [<ffffffff810d6b91>] ? __rcu_process_callbacks+0x45/0x100
[    0.256007]  [<ffffffff810889ae>] warn_slowpath_common+0x88/0xcb
[    0.256014]  [<ffffffff81083cad>] ? scheduler_tick+0x123/0x26c
[    0.256019]  [<ffffffff81088a18>] warn_slowpath_null+0x27/0x3d
[    0.256024]  [<ffffffff810d6b91>] __rcu_process_callbacks+0x45/0x100
[    0.256029]  [<ffffffff810d6c98>] rcu_process_callbacks+0x4c/0x88
[    0.256036]  [<ffffffff81090501>] __do_softirq+0x14d/0x25b
[    0.256042]  [<ffffffff8103d55c>] call_softirq+0x1c/0x30
[    0.256048]  [<ffffffff8103f8ca>] do_softirq+0x5e/0xcf
[    0.256053]  [<ffffffff8108fcdd>] irq_exit+0x5d/0xc5
[    0.256059]  [<ffffffff81f4f731>] smp_apic_timer_interrupt+0x9e/0xc2
[    0.256064]  [<ffffffff8103cf23>] apic_timer_interrupt+0x13/0x20
[    0.256067]  <EOI>  [<ffffffff8105bff1>] ? native_safe_halt+0xb/0xd
[    0.256077]  [<ffffffff8105bfef>] ? native_safe_halt+0x9/0xd
[    0.256082]  [<ffffffff810458d5>] ? default_idle+0x55/0x94
[    0.256087]  [<ffffffff8103b24b>] ? enter_idle+0x38/0x4e
[    0.256092]  [<ffffffff8103b324>] ? cpu_idle+0xc3/0x11f
[    0.256098]  [<ffffffff828f82db>] ? start_secondary+0xcb/0xe6
[    0.256129] ---[ end trace 93d72a36b9146f22 ]---
[    0.256968] AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
[    0.259001] Brought up 2 CPUs
[    0.259968] Total of 2 processors activated (8040.69 BogoMIPS).
[    0.262319] CPU0 attaching sched-domain:
[    0.262972]  domain 0: span 0-1 level MC
[    0.264966]   groups: 0 1
[    0.266967] CPU1 attaching sched-domain:
[    0.267970]  domain 0: span 0-1 level MC
[    0.269965]   groups: 1 0
[    0.272857] khelper used greatest stack depth: 4720 bytes left
[    0.280843] calling  init_cpufreq_transition_notifier_list+0x0/0x42 @ 1
[    0.280973] initcall init_cpufreq_transition_notifier_list+0x0/0x42 returned 0 after 0 usecs
[    0.281965] calling  net_ns_init+0x0/0x11b @ 1
[    0.283015] initcall net_ns_init+0x0/0x11b returned 0 after 0 usecs
[    0.284041] calling  cpufreq_tsc+0x0/0x28 @ 1
[    0.284964] initcall cpufreq_tsc+0x0/0x28 returned 0 after 0 usecs
[    0.285963] calling  pci_reboot_init+0x0/0x3b @ 1
[    0.286964] initcall pci_reboot_init+0x0/0x3b returned 0 after 0 usecs
[    0.288012] calling  print_banner+0x0/0xe @ 1
[    0.288962] Booting paravirtualized kernel on bare hardware
[    0.289963] initcall print_banner+0x0/0xe returned 0 after 976 usecs
[    0.290963] calling  init_smp_flush+0x0/0x68 @ 1
[    0.292012] initcall init_smp_flush+0x0/0x68 returned 0 after 0 usecs
[    0.292962] calling  sysctl_init+0x0/0x3d @ 1
[    0.293969] initcall sysctl_init+0x0/0x3d returned 0 after 0 usecs
[    0.294962] calling  ksysfs_init+0x0/0xe4 @ 1
[    0.296198] initcall ksysfs_init+0x0/0xe4 returned 0 after 0 usecs
[    0.297032] calling  async_init+0x0/0x69 @ 1
[    0.297961] initcall async_init+0x0/0x69 returned 0 after 0 usecs
[    0.298961] calling  init_jiffies_clocksource+0x0/0x39 @ 1
[    0.300013] initcall init_jiffies_clocksource+0x0/0x39 returned 0 after 0 usecs
[    0.301963] calling  init_hw_breakpoint+0x0/0x39 @ 1
[    0.302964] initcall init_hw_breakpoint+0x0/0x39 returned 0 after 0 usecs
[    0.303960] calling  filelock_init+0x0/0x55 @ 1
[    0.305054] initcall filelock_init+0x0/0x55 returned 0 after 0 usecs
[    0.305960] calling  init_script_binfmt+0x0/0x3b @ 1
[    0.306981] initcall init_script_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.307959] calling  init_elf_binfmt+0x0/0x3b @ 1
[    0.309009] initcall init_elf_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.309959] calling  init_compat_elf_binfmt+0x0/0x3b @ 1
[    0.310960] initcall init_compat_elf_binfmt+0x0/0x3b returned 0 after 0 usecs
[    0.311960] calling  debugfs_init+0x0/0x80 @ 1
[    0.313020] initcall debugfs_init+0x0/0x80 returned 0 after 0 usecs
[    0.313959] calling  securityfs_init+0x0/0x77 @ 1
[    0.314970] initcall securityfs_init+0x0/0x77 returned 0 after 0 usecs
[    0.315959] calling  random32_init+0x0/0xff @ 1
[    0.317027] initcall random32_init+0x0/0xff returned 0 after 0 usecs
[    0.318000] calling  gnttab_init+0x0/0x1a8 @ 1
[    0.319004] initcall gnttab_init+0x0/0x1a8 returned -19 after 0 usecs
[    0.320006] calling  cpufreq_core_init+0x0/0xaa @ 1
[    0.321056] initcall cpufreq_core_init+0x0/0xaa returned 0 after 0 usecs
[    0.322006] calling  cpuidle_init+0x0/0x66 @ 1
[    0.323024] initcall cpuidle_init+0x0/0x66 returned 0 after 0 usecs
[    0.324007] calling  sock_init+0x0/0x80 @ 1
[    0.326336] initcall sock_init+0x0/0x80 returned 0 after 976 usecs
[    0.327008] calling  netpoll_init+0x0/0x69 @ 1
[    0.328008] initcall netpoll_init+0x0/0x69 returned 0 after 0 usecs
[    0.329056] calling  netlink_proto_init+0x0/0x169 @ 1
[    0.330110] NET: Registered protocol family 16
[    0.332072] initcall netlink_proto_init+0x0/0x169 returned 0 after 1953 usecs
[    0.333056] calling  bdi_class_init+0x0/0x68 @ 1
[    0.335579] initcall bdi_class_init+0x0/0x68 returned 0 after 976 usecs
[    0.336063] calling  kobject_uevent_init+0x0/0x7b @ 1
[    0.337032] initcall kobject_uevent_init+0x0/0x7b returned 0 after 0 usecs
[    0.338007] calling  pcibus_class_init+0x0/0x40 @ 1
[    0.339149] initcall pcibus_class_init+0x0/0x40 returned 0 after 0 usecs
[    0.340124] calling  pci_driver_init+0x0/0x39 @ 1
[    0.342079] initcall pci_driver_init+0x0/0x39 returned 0 after 0 usecs
[    0.343083] calling  lcd_class_init+0x0/0x74 @ 1
[    0.344080] initcall lcd_class_init+0x0/0x74 returned 0 after 0 usecs
[    0.345061] calling  backlight_class_init+0x0/0x84 @ 1
[    0.346248] initcall backlight_class_init+0x0/0x84 returned 0 after 0 usecs
[    0.347057] calling  video_output_class_init+0x0/0x40 @ 1
[    0.348078] initcall video_output_class_init+0x0/0x40 returned 0 after 0 usecs
[    0.349012] calling  xenbus_probe_init+0x0/0xe4 @ 1
[    0.350007] initcall xenbus_probe_init+0x0/0xe4 returned -19 after 0 usecs
[    0.351007] calling  tty_class_init+0x0/0x58 @ 1
[    0.352092] initcall tty_class_init+0x0/0x58 returned 0 after 0 usecs
[    0.353063] calling  vtconsole_class_init+0x0/0xe8 @ 1
[    0.354193] initcall vtconsole_class_init+0x0/0xe8 returned 0 after 0 usecs
[    0.355063] calling  register_node_type+0x0/0xa4 @ 1
[    0.357121] initcall register_node_type+0x0/0xa4 returned 0 after 976 usecs
[    0.358084] calling  spi_init+0x0/0xd4 @ 1
[    0.359125] initcall spi_init+0x0/0xd4 returned 0 after 0 usecs
[    0.360060] calling  i2c_init+0x0/0x8c @ 1
[    0.362140] i2c-core: driver [dummy] registered
[    0.363119] initcall i2c_init+0x0/0x8c returned 0 after 1953 usecs
[    0.364008] calling  amd_postcore_init+0x0/0xa3 @ 1
[    0.365010] node 0 link 0: io port [1000, fffff]
[    0.366007] TOM: 0000000040000000 aka 1024M
[    0.367007] node 0 link 0: mmio [e0000000, efffffff]
[    0.368197] node 0 link 0: mmio [feb00000, fec0ffff]
[    0.369197] node 0 link 0: mmio [a0000, bffff]
[    0.371060] node 0 link 0: mmio [40000000, fed3ffff]
[    0.373006] bus: [00,ff] on node 0 link 0
[    0.374006] bus: 00 index 0 io port: [0, ffff]
[    0.375054] bus: 00 index 1 mmio: [40000000, fcffffffff]
[    0.376006] bus: 00 index 2 mmio: [feb00000, fec0ffff]
[    0.377006] bus: 00 index 3 mmio: [a0000, bffff]
[    0.378007] initcall amd_postcore_init+0x0/0xa3 returned 0 after 12695 usecs
[    0.379056] calling  arch_kdebugfs_init+0x0/0x55 @ 1
[    0.380111] initcall arch_kdebugfs_init+0x0/0x55 returned 0 after 0 usecs
[    0.381007] calling  dmi_id_init+0x0/0xf7 @ 1
[    0.382297] initcall dmi_id_init+0x0/0xf7 returned 0 after 0 usecs
[    0.383157] calling  pci_arch_init+0x0/0x67 @ 1
[    0.384012] PCI: Using configuration type 1 for base access
[    0.385014] initcall pci_arch_init+0x0/0x67 returned 0 after 976 usecs
[    0.386007] calling  topology_init+0x0/0xe0 @ 1
[    0.388208] initcall topology_init+0x0/0xe0 returned 0 after 976 usecs
[    0.390019] calling  param_sysfs_init+0x0/0xf6 @ 1
[    0.599249] initcall param_sysfs_init+0x0/0xf6 returned 0 after 203125 usecs
[    0.600150] calling  audit_watch_init+0x0/0x46 @ 1
[    0.601031] audit: cannot initialize inotify handle
[    0.602007] initcall audit_watch_init+0x0/0x46 returned 0 after 976 usecs
[    0.603007] calling  init_slow_work+0x0/0x5f @ 1
[    0.604056] initcall init_slow_work+0x0/0x5f returned 0 after 0 usecs
[    0.605007] calling  default_bdi_init+0x0/0x5e @ 1
[    0.606197] initcall default_bdi_init+0x0/0x5e returned 0 after 0 usecs
[    0.607173] calling  init_bio+0x0/0x100 @ 1
[    0.609193] bio: create slab <bio-0> at 0
[    0.610106] initcall init_bio+0x0/0x100 returned 0 after 1953 usecs
[    0.611057] calling  fsnotify_init+0x0/0x39 @ 1
[    0.612011] initcall fsnotify_init+0x0/0x39 returned 0 after 0 usecs
[    0.613007] calling  fsnotify_notification_init+0x0/0x129 @ 1
[    0.614087] initcall fsnotify_notification_init+0x0/0x129 returned 0 after 0 usecs
[    0.616010] calling  cryptomgr_init+0x0/0x39 @ 1
[    0.617008] initcall cryptomgr_init+0x0/0x39 returned 0 after 0 usecs
[    0.618008] calling  blk_settings_init+0x0/0x51 @ 1
[    0.619056] initcall blk_settings_init+0x0/0x51 returned 0 after 0 usecs
[    0.620007] calling  blk_ioc_init+0x0/0x51 @ 1
[    0.621091] initcall blk_ioc_init+0x0/0x51 returned 0 after 0 usecs
[    0.622008] calling  blk_softirq_init+0x0/0x8f @ 1
[    0.623056] initcall blk_softirq_init+0x0/0x8f returned 0 after 0 usecs
[    0.624007] calling  genhd_device_init+0x0/0x8c @ 1
[    0.626382] initcall genhd_device_init+0x0/0x8c returned 0 after 976 usecs
[    0.627178] calling  pci_slot_init+0x0/0x73 @ 1
[    0.629023] initcall pci_slot_init+0x0/0x73 returned 0 after 0 usecs
[    0.630008] calling  fbmem_init+0x0/0xb8 @ 1
[    0.632106] initcall fbmem_init+0x0/0xb8 returned 0 after 976 usecs
[    0.633094] calling  setup_shutdown_event+0x0/0x3b @ 1
[    0.634008] initcall setup_shutdown_event+0x0/0x3b returned 0 after 0 usecs
[    0.635007] calling  misc_init+0x0/0xd6 @ 1
[    0.637145] initcall misc_init+0x0/0xd6 returned 0 after 976 usecs
[    0.638060] calling  cn_init+0x0/0x11a @ 1
[    0.639097] initcall cn_init+0x0/0x11a returned 0 after 0 usecs
[    0.640008] calling  tifm_init+0x0/0xab @ 1
[    0.642345] initcall tifm_init+0x0/0xab returned 0 after 976 usecs
[    0.643065] calling  wm8400_module_init+0x0/0x59 @ 1
[    0.645160] i2c-core: driver [WM8400] registered
[    0.646085] initcall wm8400_module_init+0x0/0x59 returned 0 after 1953 usecs
[    0.647007] calling  twl4030_init+0x0/0x3b @ 1
[    0.648139] i2c-core: driver [twl4030] registered
[    0.649062] initcall twl4030_init+0x0/0x3b returned 0 after 976 usecs
[    0.650007] calling  pcf50633_init+0x0/0x3b @ 1
[    0.651208] i2c-core: driver [pcf50633] registered
[    0.652060] initcall pcf50633_init+0x0/0x3b returned 0 after 976 usecs
[    0.653007] calling  ab3100_i2c_init+0x0/0x3b @ 1
[    0.655219] i2c-core: driver [ab3100] registered
[    0.656010] initcall ab3100_i2c_init+0x0/0x3b returned 0 after 1953 usecs
[    0.657007] calling  init_scsi+0x0/0xb7 @ 1
[    0.660290] SCSI subsystem initialized
[    0.661068] initcall init_scsi+0x0/0xb7 returned 0 after 2929 usecs
[    0.663009] calling  ata_init+0x0/0xb4 @ 1
[    0.664492] libata version 3.00 loaded.
[    0.665181] initcall ata_init+0x0/0xb4 returned 0 after 976 usecs
[    0.666007] calling  phy_init+0x0/0x57 @ 1
[    0.668298] initcall phy_init+0x0/0x57 returned 0 after 976 usecs
[    0.669069] calling  init_pcmcia_cs+0x0/0x56 @ 1
[    0.670112] initcall init_pcmcia_cs+0x0/0x56 returned 0 after 0 usecs
[    0.671124] calling  nop_usb_xceiv_init+0x0/0x39 @ 1
[    0.672121] initcall nop_usb_xceiv_init+0x0/0x39 returned 0 after 0 usecs
[    0.673085] calling  usb_init+0x0/0x199 @ 1
[    0.675302] usbcore: registered new interface driver usbfs
[    0.677247] usbcore: registered new interface driver hub
[    0.679198] usbcore: registered new device driver usb
[    0.680061] initcall usb_init+0x0/0x199 returned 0 after 5859 usecs
[    0.681007] calling  serio_init+0x0/0xb2 @ 1
[    0.682138] initcall serio_init+0x0/0xb2 returned 0 after 0 usecs
[    0.683060] calling  gameport_init+0x0/0xb2 @ 1
[    0.684148] initcall gameport_init+0x0/0xb2 returned 0 after 0 usecs
[    0.685013] calling  input_init+0x0/0x15d @ 1
[    0.686084] initcall input_init+0x0/0x15d returned 0 after 0 usecs
[    0.687010] calling  rtc_init+0x0/0x98 @ 1
[    0.689068] initcall rtc_init+0x0/0x98 returned 0 after 976 usecs
[    0.690010] calling  pps_init+0x0/0xd7 @ 1
[    0.691226] LinuxPPS API ver. 1 registered
[    0.692008] Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.693008] initcall pps_init+0x0/0xd7 returned 0 after 1953 usecs
[    0.694007] calling  power_supply_class_init+0x0/0x5f @ 1
[    0.696094] initcall power_supply_class_init+0x0/0x5f returned 0 after 976 usecs
[    0.697007] calling  hwmon_init+0x0/0x6e @ 1
[    0.699113] initcall hwmon_init+0x0/0x6e returned 0 after 976 usecs
[    0.700007] calling  md_init+0x0/0xf7 @ 1
[    0.701037] initcall md_init+0x0/0xf7 returned 0 after 0 usecs
[    0.702007] calling  leds_init+0x0/0x67 @ 1
[    0.703264] initcall leds_init+0x0/0x67 returned 0 after 0 usecs
[    0.704010] calling  pci_subsys_init+0x0/0x136 @ 1
[    0.705005] PCI: Probing PCI hardware
[    0.706069] PCI: Probing PCI hardware (bus 00)
[    0.708297] PCI: Scanning bus 0000:00
[    0.710085] pci 0000:00:00.0: found [10de:005e] class 000580 header type 00
[    0.711096] pci 0000:00:00.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.712106] pci 0000:00:01.0: found [10de:0050] class 000601 header type 00
[    0.714052] pci 0000:00:01.0: calling nvidia_force_enable_hpet+0x0/0xec
[    0.715006] HPET not enabled in BIOS. You might try hpet=force boot option
[    0.716007] pci 0000:00:01.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.717093] pci 0000:00:01.1: found [10de:0052] class 000c05 header type 00
[    0.718032] pci 0000:00:01.1: reg 10 io port: [0xdc00-0xdc1f]
[    0.719035] pci 0000:00:01.1: reg 20 io port: [0x4c00-0x4c3f]
[    0.720014] pci 0000:00:01.1: reg 24 io port: [0x4c40-0x4c7f]
[    0.721067] pci 0000:00:01.1: calling quirk_resource_alignment+0x0/0x1dd
[    0.722029] pci 0000:00:01.1: PME# supported from D3hot D3cold
[    0.723010] pci 0000:00:01.1: PME# disabled
[    0.724069] pci 0000:00:02.0: found [10de:005a] class 000c03 header type 00
[    0.725082] pci 0000:00:02.0: reg 10 32bit mmio: [0xda102000-0xda102fff]
[    0.726053] pci 0000:00:02.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.727029] pci 0000:00:02.0: supports D1 D2
[    0.728006] pci 0000:00:02.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.730011] pci 0000:00:02.0: PME# disabled
[    0.731047] pci 0000:00:02.1: found [10de:005b] class 000c03 header type 00
[    0.732040] pci 0000:00:02.1: reg 10 32bit mmio: [0xfeb00000-0xfeb000ff]
[    0.734055] pci 0000:00:02.1: calling quirk_resource_alignment+0x0/0x1dd
[    0.735040] pci 0000:00:02.1: supports D1 D2
[    0.736007] pci 0000:00:02.1: PME# supported from D0 D1 D2 D3hot D3cold
[    0.737058] pci 0000:00:02.1: PME# disabled
[    0.739054] pci 0000:00:04.0: found [10de:0059] class 000401 header type 00
[    0.740032] pci 0000:00:04.0: reg 10 io port: [0xd400-0xd4ff]
[    0.741062] pci 0000:00:04.0: reg 14 io port: [0xd800-0xd8ff]
[    0.742014] pci 0000:00:04.0: reg 18 32bit mmio: [0xda101000-0xda101fff]
[    0.743040] pci 0000:00:04.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.744029] pci 0000:00:04.0: supports D1 D2
[    0.745095] pci 0000:00:06.0: found [10de:0053] class 000101 header type 00
[    0.746058] pci 0000:00:06.0: reg 20 io port: [0xf000-0xf00f]
[    0.747028] pci 0000:00:06.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.749086] pci 0000:00:09.0: found [10de:005c] class 000604 header type 01
[    0.750034] pci 0000:00:09.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.751044] pci 0000:00:0a.0: found [10de:0057] class 000680 header type 00
[    0.752032] pci 0000:00:0a.0: reg 10 32bit mmio: [0xda100000-0xda100fff]
[    0.753064] pci 0000:00:0a.0: reg 14 io port: [0xd000-0xd007]
[    0.754046] pci 0000:00:0a.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.755029] pci 0000:00:0a.0: supports D1 D2
[    0.756006] pci 0000:00:0a.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.757058] pci 0000:00:0a.0: PME# disabled
[    0.758098] pci 0000:00:0b.0: found [10de:005d] class 000604 header type 01
[    0.759048] pci 0000:00:0b.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.760049] pci 0000:00:0b.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.761058] pci 0000:00:0b.0: PME# disabled
[    0.763056] pci 0000:00:0c.0: found [10de:005d] class 000604 header type 01
[    0.764047] pci 0000:00:0c.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.765097] pci 0000:00:0c.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.766010] pci 0000:00:0c.0: PME# disabled
[    0.767062] pci 0000:00:0d.0: found [10de:005d] class 000604 header type 01
[    0.768047] pci 0000:00:0d.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.769098] pci 0000:00:0d.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.770010] pci 0000:00:0d.0: PME# disabled
[    0.771062] pci 0000:00:0e.0: found [10de:005d] class 000604 header type 01
[    0.772047] pci 0000:00:0e.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.773096] pci 0000:00:0e.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.774010] pci 0000:00:0e.0: PME# disabled
[    0.775090] pci 0000:00:18.0: found [1022:1100] class 000600 header type 00
[    0.776059] pci 0000:00:18.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.777104] pci 0000:00:18.1: found [1022:1101] class 000600 header type 00
[    0.778059] pci 0000:00:18.1: calling quirk_resource_alignment+0x0/0x1dd
[    0.779037] pci 0000:00:18.2: found [1022:1102] class 000600 header type 00
[    0.780059] pci 0000:00:18.2: calling quirk_resource_alignment+0x0/0x1dd
[    0.781085] pci 0000:00:18.3: found [1022:1103] class 000600 header type 00
[    0.782061] pci 0000:00:18.3: calling quirk_resource_alignment+0x0/0x1dd
[    0.783062] PCI: Fixups for bus 0000:00
[    0.784009] pci 0000:00:09.0: scanning behind bridge, config 050500, pass 0
[    0.785073] PCI: Scanning bus 0000:05
[    0.786065] pci 0000:05:07.0: found [10ec:8139] class 000200 header type 00
[    0.787036] pci 0000:05:07.0: reg 10 io port: [0xc000-0xc0ff]
[    0.788015] pci 0000:05:07.0: reg 14 32bit mmio: [0xda000000-0xda0000ff]
[    0.789102] pci 0000:05:07.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.790032] pci 0000:05:07.0: supports D1 D2
[    0.791006] pci 0000:05:07.0: PME# supported from D1 D2 D3hot
[    0.792010] pci 0000:05:07.0: PME# disabled
[    0.793169] PCI: Fixups for bus 0000:05
[    0.794006] pci 0000:00:09.0: transparent bridge
[    0.795010] pci 0000:00:09.0: bridge io port: [0xc000-0xcfff]
[    0.796010] pci 0000:00:09.0: bridge 32bit mmio: [0xda000000-0xda0fffff]
[    0.797058] PCI: Bus scan for 0000:05 returning with max=05
[    0.798011] pci 0000:00:0b.0: scanning behind bridge, config 040400, pass 0
[    0.799024] PCI: Scanning bus 0000:04
[    0.801152] PCI: Fixups for bus 0000:04
[    0.803025] PCI: Bus scan for 0000:04 returning with max=04
[    0.804011] pci 0000:00:0c.0: scanning behind bridge, config 030300, pass 0
[    0.805072] PCI: Scanning bus 0000:03
[    0.806143] PCI: Fixups for bus 0000:03
[    0.807024] PCI: Bus scan for 0000:03 returning with max=03
[    0.808011] pci 0000:00:0d.0: scanning behind bridge, config 020200, pass 0
[    0.809072] PCI: Scanning bus 0000:02
[    0.810142] PCI: Fixups for bus 0000:02
[    0.811023] PCI: Bus scan for 0000:02 returning with max=02
[    0.812011] pci 0000:00:0e.0: scanning behind bridge, config 010100, pass 0
[    0.813072] PCI: Scanning bus 0000:01
[    0.814038] pci 0000:01:00.0: found [1002:5b60] class 000300 header type 00
[    0.815019] pci 0000:01:00.0: calling quirk_no_ata_d3+0x0/0x47
[    0.816019] pci 0000:01:00.0: reg 10 32bit mmio: [0xd0000000-0xd7ffffff]
[    0.817063] pci 0000:01:00.0: reg 14 io port: [0xb000-0xb0ff]
[    0.818015] pci 0000:01:00.0: reg 18 32bit mmio: [0xd9000000-0xd900ffff]
[    0.820020] pci 0000:01:00.0: reg 30 32bit mmio: [0x000000-0x01ffff]
[    0.821060] pci 0000:01:00.0: calling quirk_resource_alignment+0x0/0x1dd
[    0.822043] pci 0000:01:00.0: supports D1 D2
[    0.823057] pci 0000:01:00.1: found [1002:5b70] class 000380 header type 00
[    0.824019] pci 0000:01:00.1: calling quirk_no_ata_d3+0x0/0x47
[    0.825065] pci 0000:01:00.1: reg 10 32bit mmio: [0xd9010000-0xd901ffff]
[    0.826060] pci 0000:01:00.1: calling quirk_resource_alignment+0x0/0x1dd
[    0.827039] pci 0000:01:00.1: supports D1 D2
[    0.828119] pci 0000:01:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
[    0.829272] PCI: Fixups for bus 0000:01
[    0.830014] pci 0000:00:0e.0: bridge io port: [0xb000-0xbfff]
[    0.831010] pci 0000:00:0e.0: bridge 32bit mmio: [0xd8000000-0xd9ffffff]
[    0.832014] pci 0000:00:0e.0: bridge 64bit mmio pref: [0xd0000000-0xd7ffffff]
[    0.833054] PCI: Bus scan for 0000:01 returning with max=01
[    0.834011] pci 0000:00:09.0: scanning behind bridge, config 050500, pass 1
[    0.835013] pci 0000:00:0b.0: scanning behind bridge, config 040400, pass 1
[    0.836013] pci 0000:00:0c.0: scanning behind bridge, config 030300, pass 1
[    0.837061] pci 0000:00:0d.0: scanning behind bridge, config 020200, pass 1
[    0.838013] pci 0000:00:0e.0: scanning behind bridge, config 010100, pass 1
[    0.839011] PCI: Bus scan for 0000:00 returning with max=05
[    0.852354] pci 0000:00:00.0: default IRQ router [10de:005e]
[    0.853584] initcall pci_subsys_init+0x0/0x136 returned 0 after 144531 usecs
[    0.854008] calling  proto_init+0x0/0x39 @ 1
[    0.855027] initcall proto_init+0x0/0x39 returned 0 after 0 usecs
[    0.856056] calling  net_dev_init+0x0/0x1c2 @ 1
[    0.859245] initcall net_dev_init+0x0/0x1c2 returned 0 after 1953 usecs
[    0.860008] calling  neigh_init+0x0/0x98 @ 1
[    0.861009] initcall neigh_init+0x0/0x98 returned 0 after 0 usecs
[    0.862008] calling  fib_rules_init+0x0/0xcc @ 1
[    0.863061] initcall fib_rules_init+0x0/0xcc returned 0 after 0 usecs
[    0.864007] calling  genl_init+0x0/0x100 @ 1
[    0.867139] initcall genl_init+0x0/0x100 returned 0 after 1953 usecs
[    0.868015] calling  cipso_v4_init+0x0/0xae @ 1
[    0.869032] initcall cipso_v4_init+0x0/0xae returned 0 after 0 usecs
[    0.870008] calling  irda_init+0x0/0xb8 @ 1
[    0.871104] NET: Registered protocol family 23
[    0.872204] initcall irda_init+0x0/0xb8 returned 0 after 976 usecs
[    0.873008] calling  bt_init+0x0/0x81 @ 1
[    0.874006] Bluetooth: Core ver 2.15
[    0.875163] NET: Registered protocol family 31
[    0.876057] Bluetooth: HCI device and connection manager initialized
[    0.877040] Bluetooth: HCI socket layer initialized
[    0.878008] initcall bt_init+0x0/0x81 returned 0 after 3906 usecs
[    0.879008] calling  wireless_nlevent_init+0x0/0x69 @ 1
[    0.880064] initcall wireless_nlevent_init+0x0/0x69 returned 0 after 0 usecs
[    0.881008] calling  cfg80211_init+0x0/0x9f @ 1
[    0.887211] cfg80211: Using static regulatory domain info
[    0.888057] cfg80211: Regulatory domain: US
[    0.889006] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    0.890007] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[    0.891006] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.893008] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.894007] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.895006] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.896055] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[    0.897137] cfg80211: Calling CRDA for country: US
[    0.898290] initcall cfg80211_init+0x0/0x9f returned 0 after 15625 usecs
[    0.899058] calling  ieee80211_init+0x0/0x3b @ 1
[    0.900042] initcall ieee80211_init+0x0/0x3b returned 0 after 0 usecs
[    0.901007] calling  netlbl_init+0x0/0xa8 @ 1
[    0.902006] NetLabel: Initializing
[    0.903053] NetLabel:  domain hash size = 128
[    0.904005] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.906030] NetLabel:  unlabeled traffic allowed by default
[    0.907057] initcall netlbl_init+0x0/0xa8 returned 0 after 4882 usecs
[    0.908008] calling  rfkill_init+0x0/0xb1 @ 1
[    0.910202] initcall rfkill_init+0x0/0xb1 returned 0 after 976 usecs
[    0.911058] calling  sysctl_init+0x0/0x6f @ 1
[    0.912012] initcall sysctl_init+0x0/0x6f returned 0 after 0 usecs
[    0.913008] calling  pci_iommu_init+0x0/0x39 @ 1
[    0.914008] initcall pci_iommu_init+0x0/0x39 returned 0 after 0 usecs
[    0.915056] calling  print_all_ICs+0x0/0xbf @ 1
[    0.916006] 
[    0.916007] printing PIC contents
[    0.917008] ... PIC  IMR: fffa
[    0.918000] ... PIC  IRR: 0001
[    0.918005] ... PIC  ISR: 0001
[    0.919055] ... PIC ELCR: 0828
[    0.920007] printing local APIC contents on CPU#0/0:
[    0.921000] ... APIC ID:      00000000 (0)
[    0.921000] ... APIC VERSION: 00040010
[    0.921000] ... APIC TASKPRI: 00000000 (00)
[    0.921000] ... APIC ARBPRI: 000000e0 (e0)
[    0.921000] ... APIC PROCPRI: 00000000
[    0.921000] ... APIC LDR: 01000000
[    0.921000] ... APIC DFR: ffffffff
[    0.921000] ... APIC SPIV: 000001ff
[    0.921000] ... APIC ISR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000000000
[    0.921000] ... APIC TMR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000000000
[    0.921000] ... APIC IRR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000008000
[    0.921000] ... APIC ESR: 00000000
[    0.921000] ... APIC ICR: 000008fd
[    0.921000] ... APIC ICR2: 02000000
[    0.921000] ... APIC LVTT: 000200ef
[    0.921000] ... APIC LVTPC: 00000400
[    0.921000] ... APIC LVT0: 00010700
[    0.921000] ... APIC LVT1: 00000400
[    0.921000] ... APIC LVTERR: 000000fe
[    0.921000] ... APIC TMICT: 00003112
[    0.921000] ... APIC TMCCT: 000030e3
[    0.921000] ... APIC TDCR: 00000003
[    0.921000] 
[    0.920999] printing local APIC contents on CPU#1/1:
[    0.921000] ... APIC ID:      01000000 (1)
[    0.921000] ... APIC VERSION: 00040010
[    0.921000] ... APIC TASKPRI: 00000000 (00)
[    0.921000] ... APIC ARBPRI: 000000e0 (e0)
[    0.921000] ... APIC PROCPRI: 00000000
[    0.921000] ... APIC LDR: 02000000
[    0.921000] ... APIC DFR: ffffffff
[    0.921000] ... APIC SPIV: 000001ff
[    0.921000] ... APIC ISR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000000000
[    0.921000] ... APIC TMR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000000000
[    0.921000] ... APIC IRR field:
[    0.921000] 0000000000000000000000000000000000000000000000000000000000008000
[    0.921000] ... APIC ESR: 00000000
[    0.921000] ... APIC ICR: 000008fd
[    0.921000] ... APIC ICR2: 01000000
[    0.921000] ... APIC LVTT: 000200ef
[    0.921000] ... APIC LVTPC: 00010400
[    0.921000] ... APIC LVT0: 00010700
[    0.921000] ... APIC LVT1: 00010400
[    0.921000] ... APIC LVTERR: 000000fe
[    0.921000] ... APIC TMICT: 00003112
[    0.921000] ... APIC TMCCT: 0000098d
[    0.921000] ... APIC TDCR: 00000003
[    0.921000] 
[    1.027898] number of MP IRQ sources: 17.
[    1.028006] number of IO-APIC #2 registers: 24.
[    1.029006] testing the IO APIC.......................
[    1.030009] 
[    1.031054] IO APIC #2......
[    1.032006] .... register #00: 00000000
[    1.033006] .......    : physical APIC id: 00
[    1.034006] .......    : Delivery Type: 0
[    1.035054] .......    : LTS          : 0
[    1.036006] .... register #01: 00170011
[    1.037006] .......     : max redirection entries: 0017
[    1.038006] .......     : PRQ implemented: 0
[    1.039054] .......     : IO APIC version: 0011
[    1.040006] .... register #02: 00000000
[    1.041006] .......     : arbitration: 00
[    1.042006] .... IRQ redirection table:
[    1.043053]  NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:   
[    1.044009]  00 003 0    0    0   0   0    1    1    30
[    1.046008]  01 003 0    0    0   0   0    1    1    31
[    1.048008]  02 000 1    0    0   0   0    0    0    00
[    1.050008]  03 003 1    1    0   1   0    1    1    33
[    1.052008]  04 003 0    0    0   0   0    1    1    34
[    1.054008]  05 003 1    1    0   1   0    1    1    35
[    1.056008]  06 003 0    0    0   0   0    1    1    36
[    1.058008]  07 003 1    0    0   0   0    1    1    37
[    1.060008]  08 003 0    0    0   0   0    1    1    38
[    1.062008]  09 003 0    0    0   0   0    1    1    39
[    1.064009]  0a 003 0    0    0   0   0    1    1    3A
[    1.066008]  0b 003 1    1    0   1   0    1    1    3B
[    1.068009]  0c 003 0    0    0   0   0    1    1    3C
[    1.070008]  0d 003 0    0    0   0   0    1    1    3D
[    1.072008]  0e 003 0    0    0   0   0    1    1    3E
[    1.074008]  0f 003 0    0    0   0   0    1    1    3F
[    1.076008]  10 000 1    0    0   0   0    0    0    00
[    1.078008]  11 000 1    0    0   0   0    0    0    00
[    1.080008]  12 000 1    0    0   0   0    0    0    00
[    1.082008]  13 000 1    0    0   0   0    0    0    00
[    1.084008]  14 000 1    0    0   0   0    0    0    00
[    1.086008]  15 000 1    0    0   0   0    0    0    00
[    1.089008]  16 000 1    0    0   0   0    0    0    00
[    1.091058]  17 000 1    0    0   0   0    0    0    00
[    1.093006] IRQ to pin mappings:
[    1.094006] IRQ0 -> 0:0
[    1.096197] IRQ1 -> 0:1
[    1.098006] IRQ3 -> 0:3
[    1.100197] IRQ4 -> 0:4
[    1.102195] IRQ5 -> 0:5
[    1.104741] IRQ6 -> 0:6
[    1.106195] IRQ7 -> 0:7
[    1.108791] IRQ8 -> 0:8
[    1.110197] IRQ9 -> 0:9
[    1.111732] IRQ10 -> 0:10
[    1.113197] IRQ11 -> 0:11
[    1.115006] IRQ12 -> 0:12
[    1.116873] IRQ13 -> 0:13
[    1.118197] IRQ14 -> 0:14
[    1.120247] IRQ15 -> 0:15
[    1.122356] .................................... done.
[    1.123010] initcall print_all_ICs+0x0/0xbf returned 0 after 202148 usecs
[    1.124057] calling  hpet_late_init+0x0/0xa6 @ 1
[    1.125009] initcall hpet_late_init+0x0/0xa6 returned -19 after 0 usecs
[    1.126008] calling  clocksource_done_booting+0x0/0x37 @ 1
[    1.127008] initcall clocksource_done_booting+0x0/0x37 returned 0 after 0 usecs
[    1.128056] calling  ftrace_init_debugfs+0x0/0x56 @ 1
[    1.129115] initcall ftrace_init_debugfs+0x0/0x56 returned 0 after 0 usecs
[    1.130008] calling  rb_init_debugfs+0x0/0x56 @ 1
[    1.131023] initcall rb_init_debugfs+0x0/0x56 returned 0 after 0 usecs
[    1.132056] calling  tracer_init_debugfs+0x0/0x254 @ 1
[    1.134729] initcall tracer_init_debugfs+0x0/0x254 returned 0 after 976 usecs
[    1.135008] calling  init_trace_printk_function_export+0x0/0x56 @ 1
[    1.136072] initcall init_trace_printk_function_export+0x0/0x56 returned 0 after 0 usecs
[    1.137008] calling  stat_workqueue_init+0x0/0x54 @ 1
[    1.138077] initcall stat_workqueue_init+0x0/0x54 returned 0 after 0 usecs
[    1.139008] calling  event_trace_init+0x0/0x212 @ 1
[    1.156079] initcall event_trace_init+0x0/0x212 returned 0 after 15625 usecs
[    1.157009] calling  ksym_tracer_stat_init+0x0/0x54 @ 1
[    1.158029] initcall ksym_tracer_stat_init+0x0/0x54 returned 0 after 0 usecs
[    1.159008] calling  init_pipe_fs+0x0/0x72 @ 1
[    1.161143] initcall init_pipe_fs+0x0/0x72 returned 0 after 976 usecs
[    1.162008] calling  eventpoll_init+0x0/0x102 @ 1
[    1.163171] initcall eventpoll_init+0x0/0x102 returned 0 after 0 usecs
[    1.164057] calling  anon_inode_init+0x0/0x150 @ 1
[    1.166065] initcall anon_inode_init+0x0/0x150 returned 0 after 976 usecs
[    1.167010] calling  blk_scsi_ioctl_init+0x0/0x2ad @ 1
[    1.168057] initcall blk_scsi_ioctl_init+0x0/0x2ad returned 0 after 0 usecs
[    1.169008] calling  chr_dev_init+0x0/0xca @ 1
[    1.174288] initcall chr_dev_init+0x0/0xca returned 0 after 3906 usecs
[    1.176040] calling  firmware_class_init+0x0/0x9f @ 1
[    1.177116] initcall firmware_class_init+0x0/0x9f returned 0 after 0 usecs
[    1.178080] calling  ieee1394_init+0x0/0x289 @ 1
[    1.182193] initcall ieee1394_init+0x0/0x289 returned 0 after 2929 usecs
[    1.184056] calling  cpufreq_gov_performance_init+0x0/0x39 @ 1
[    1.185035] initcall cpufreq_gov_performance_init+0x0/0x39 returned 0 after 0 usecs
[    1.186007] calling  cpufreq_gov_userspace_init+0x0/0x39 @ 1
[    1.187058] initcall cpufreq_gov_userspace_init+0x0/0x39 returned 0 after 0 usecs
[    1.188008] calling  ssb_modinit+0x0/0x9a @ 1
[    1.189356] initcall ssb_modinit+0x0/0x9a returned 0 after 0 usecs
[    1.190074] calling  pcibios_assign_resources+0x0/0x9a @ 1
[    1.191240] pci 0000:00:09.0: PCI bridge, secondary bus 0000:05
[    1.192009] pci 0000:00:09.0:   IO window: 0xc000-0xcfff
[    1.193012] pci 0000:00:09.0:   MEM window: 0xda000000-0xda0fffff
[    1.194057] pci 0000:00:09.0:   PREFETCH window: disabled
[    1.195010] pci 0000:00:0b.0: PCI bridge, secondary bus 0000:04
[    1.196006] pci 0000:00:0b.0:   IO window: disabled
[    1.197011] pci 0000:00:0b.0:   MEM window: disabled
[    1.198060] pci 0000:00:0b.0:   PREFETCH window: disabled
[    1.199010] pci 0000:00:0c.0: PCI bridge, secondary bus 0000:03
[    1.200006] pci 0000:00:0c.0:   IO window: disabled
[    1.201011] pci 0000:00:0c.0:   MEM window: disabled
[    1.202057] pci 0000:00:0c.0:   PREFETCH window: disabled
[    1.203010] pci 0000:00:0d.0: PCI bridge, secondary bus 0000:02
[    1.204006] pci 0000:00:0d.0:   IO window: disabled
[    1.205011] pci 0000:00:0d.0:   MEM window: disabled
[    1.206057] pci 0000:00:0d.0:   PREFETCH window: disabled
[    1.207018] pci 0000:01:00.0: BAR 6: got res [0xd8000000-0xd801ffff] bus [0xd8000000-0xd801ffff] flags 0x27200
[    1.208011] pci 0000:00:0e.0: PCI bridge, secondary bus 0000:01
[    1.209008] pci 0000:00:0e.0:   IO window: 0xb000-0xbfff
[    1.210060] pci 0000:00:0e.0:   MEM window: 0xd8000000-0xd9ffffff
[    1.211011] pci 0000:00:0e.0:   PREFETCH window: 0x000000d0000000-0x000000d7ffffff
[    1.212024] pci 0000:00:09.0: setting latency timer to 64
[    1.213019] pci 0000:00:0b.0: setting latency timer to 64
[    1.214067] pci 0000:00:0c.0: setting latency timer to 64
[    1.215019] pci 0000:00:0d.0: setting latency timer to 64
[    1.216019] pci 0000:00:0e.0: setting latency timer to 64
[    1.217010] pci_bus 0000:00: resource 0 io:  [0x00-0xffff]
[    1.218055] pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffffffffffff]
[    1.219007] pci_bus 0000:05: resource 0 io:  [0xc000-0xcfff]
[    1.220007] pci_bus 0000:05: resource 1 mem: [0xda000000-0xda0fffff]
[    1.221007] pci_bus 0000:05: resource 3 io:  [0x00-0xffff]
[    1.222055] pci_bus 0000:05: resource 4 mem: [0x000000-0xffffffffffffffff]
[    1.223008] pci_bus 0000:01: resource 0 io:  [0xb000-0xbfff]
[    1.224007] pci_bus 0000:01: resource 1 mem: [0xd8000000-0xd9ffffff]
[    1.225007] pci_bus 0000:01: resource 2 pref mem [0xd0000000-0xd7ffffff]
[    1.226056] initcall pcibios_assign_resources+0x0/0x9a returned 0 after 34179 usecs
[    1.227008] calling  sysctl_core_init+0x0/0x5f @ 1
[    1.228061] initcall sysctl_core_init+0x0/0x5f returned 0 after 0 usecs
[    1.229008] calling  inet_init+0x0/0x1ff @ 1
[    1.231082] NET: Registered protocol family 2
[    1.232405] IP route cache hash table entries: 32768 (order: 6, 262144 bytes)
[    1.236560] TCP established hash table entries: 131072 (order: 9, 2097152 bytes)
[    1.241858] TCP bind hash table entries: 65536 (order: 10, 4718592 bytes)
[    1.252684] TCP: Hash tables configured (established 131072 bind 65536)
[    1.253058] TCP reno registered
[    1.255065] initcall inet_init+0x0/0x1ff returned 0 after 24414 usecs
[    1.256009] calling  af_unix_init+0x0/0x7b @ 1
[    1.258063] NET: Registered protocol family 1
[    1.259032] initcall af_unix_init+0x0/0x7b returned 0 after 1953 usecs
[    1.260011] calling  populate_rootfs+0x0/0x100 @ 1
[    1.262658] initcall populate_rootfs+0x0/0x100 returned 0 after 976 usecs
[    1.263010] calling  calgary_fixup_tce_spaces+0x0/0x121 @ 1
[    1.264009] initcall calgary_fixup_tce_spaces+0x0/0x121 returned -19 after 0 usecs
[    1.265008] calling  vmx_init+0x0/0x233 @ 1
[    1.267457] kvm: no hardware support
[    1.268022] initcall vmx_init+0x0/0x233 returned -95 after 1953 usecs
[    1.269008] initcall vmx_init+0x0/0x233 returned with error code -95 
[    1.271009] calling  svm_init+0x0/0x40 @ 1
[    1.272527] has_svm: svm not available
[    1.273006] kvm: no hardware support
[    1.275010] initcall svm_init+0x0/0x40 returned -95 after 2929 usecs
[    1.276008] initcall svm_init+0x0/0x40 returned with error code -95 
[    1.277007] calling  i8259A_init_sysfs+0x0/0x49 @ 1
[    1.279215] initcall i8259A_init_sysfs+0x0/0x49 returned 0 after 976 usecs
[    1.280069] calling  vsyscall_init+0x0/0x60 @ 1
[    1.281021] initcall vsyscall_init+0x0/0x60 returned 0 after 0 usecs
[    1.282007] calling  sbf_init+0x0/0x118 @ 1
[    1.283008] initcall sbf_init+0x0/0x118 returned 0 after 0 usecs
[    1.284059] calling  i8237A_init_sysfs+0x0/0x49 @ 1
[    1.286111] initcall i8237A_init_sysfs+0x0/0x49 returned 0 after 976 usecs
[    1.288125] calling  add_rtc_cmos+0x0/0x68 @ 1
[    1.289166] platform rtc_cmos: registered platform RTC device (no PNP device found)
[    1.290063] initcall add_rtc_cmos+0x0/0x68 returned 0 after 976 usecs
[    1.291009] calling  cache_sysfs_init+0x0/0x85 @ 1
[    1.295284] initcall cache_sysfs_init+0x0/0x85 returned 0 after 2929 usecs
[    1.296141] calling  mce_init_device+0x0/0x124 @ 1
[    1.299144] initcall mce_init_device+0x0/0x124 returned 0 after 1953 usecs
[    1.300087] calling  threshold_init_device+0x0/0xc0 @ 1
[    1.300011] Clocksource tsc unstable (delta = 1237999586 ns)
[    1.301008] initcall threshold_init_device+0x0/0xc0 returned 0 after 0 usecs
[    1.302009] calling  inject_init+0x0/0x4b @ 1
[    1.303006] Machine check injector initialized
[    1.304055] initcall inject_init+0x0/0x4b returned 0 after 976 usecs
[    1.305007] calling  msr_init+0x0/0x15c @ 1
[    1.307390] initcall msr_init+0x0/0x15c returned 0 after 976 usecs
[    1.308095] calling  ioapic_init_sysfs+0x0/0xd0 @ 1
[    1.309144] initcall ioapic_init_sysfs+0x0/0xd0 returned 0 after 0 usecs
[    1.310070] calling  add_pcspkr+0x0/0x4f @ 1
[    1.312103] initcall add_pcspkr+0x0/0x4f returned 0 after 976 usecs
[    1.313055] calling  start_periodic_check_for_corruption+0x0/0x61 @ 1
[    1.314008] initcall start_periodic_check_for_corruption+0x0/0x61 returned 0 after 0 usecs
[    1.315008] calling  audit_classes_init+0x0/0xd6 @ 1
[    1.316039] initcall audit_classes_init+0x0/0xd6 returned 0 after 0 usecs
[    1.317056] calling  pt_dump_init+0x0/0x57 @ 1
[    1.318030] initcall pt_dump_init+0x0/0x57 returned 0 after 0 usecs
[    1.319008] calling  crypto_fpu_module_init+0x0/0x39 @ 1
[    1.320129] initcall crypto_fpu_module_init+0x0/0x39 returned 0 after 0 usecs
[    1.321056] calling  aes_init+0x0/0x39 @ 1
[    1.322207] initcall aes_init+0x0/0x39 returned 0 after 0 usecs
[    1.323012] calling  init+0x0/0x39 @ 1
[    1.325111] initcall init+0x0/0x39 returned 0 after 976 usecs
[    1.326007] calling  init+0x0/0x39 @ 1
[    1.327099] initcall init+0x0/0x39 returned 0 after 0 usecs
[    1.328010] calling  aesni_init+0x0/0x188 @ 1
[    1.329006] Intel AES-NI instructions are not detected.
[    1.330008] initcall aesni_init+0x0/0x188 returned -19 after 976 usecs
[    1.331007] calling  crc32c_intel_mod_init+0x0/0x47 @ 1
[    1.332062] initcall crc32c_intel_mod_init+0x0/0x47 returned -19 after 0 usecs
[    1.334008] calling  init_vdso_vars+0x0/0x272 @ 1
[    1.335027] initcall init_vdso_vars+0x0/0x272 returned 0 after 0 usecs
[    1.336056] calling  ia32_binfmt_init+0x0/0x3b @ 1
[    1.337014] initcall ia32_binfmt_init+0x0/0x3b returned 0 after 0 usecs
[    1.338007] calling  sysenter_setup+0x0/0xfb @ 1
[    1.339015] initcall sysenter_setup+0x0/0xfb returned 0 after 0 usecs
[    1.340056] calling  init_aout_binfmt+0x0/0x3b @ 1
[    1.341009] initcall init_aout_binfmt+0x0/0x3b returned 0 after 0 usecs
[    1.342007] calling  init_sched_debug_procfs+0x0/0x53 @ 1
[    1.343027] initcall init_sched_debug_procfs+0x0/0x53 returned 0 after 0 usecs
[    1.345009] calling  proc_schedstat_init+0x0/0x49 @ 1
[    1.346020] initcall proc_schedstat_init+0x0/0x49 returned 0 after 0 usecs
[    1.347008] calling  proc_execdomains_init+0x0/0x49 @ 1
[    1.348068] initcall proc_execdomains_init+0x0/0x49 returned 0 after 0 usecs
[    1.349008] calling  ioresources_init+0x0/0x63 @ 1
[    1.350031] initcall ioresources_init+0x0/0x63 returned 0 after 0 usecs
[    1.351008] calling  uid_cache_init+0x0/0xb4 @ 1
[    1.352126] initcall uid_cache_init+0x0/0xb4 returned 0 after 0 usecs
[    1.353008] calling  init_posix_timers+0x0/0x10e @ 1
[    1.354055] initcall init_posix_timers+0x0/0x10e returned 0 after 0 usecs
[    1.355008] calling  init_posix_cpu_timers+0x0/0x109 @ 1
[    1.356057] initcall init_posix_cpu_timers+0x0/0x109 returned 0 after 0 usecs
[    1.357007] calling  nsproxy_cache_init+0x0/0x54 @ 1
[    1.358054] initcall nsproxy_cache_init+0x0/0x54 returned 0 after 0 usecs
[    1.359010] calling  create_proc_profile+0x0/0x85 @ 1
[    1.360057] initcall create_proc_profile+0x0/0x85 returned 0 after 0 usecs
[    1.361008] calling  timekeeping_init_device+0x0/0x49 @ 1
[    1.363208] initcall timekeeping_init_device+0x0/0x49 returned 0 after 976 usecs
[    1.364008] calling  init_clocksource_sysfs+0x0/0x77 @ 1
[    1.366195] initcall init_clocksource_sysfs+0x0/0x77 returned 0 after 976 usecs
[    1.367064] calling  init_timer_list_procfs+0x0/0x53 @ 1
[    1.368021] initcall init_timer_list_procfs+0x0/0x53 returned 0 after 0 usecs
[    1.369008] calling  init_tstats_procfs+0x0/0x53 @ 1
[    1.370020] initcall init_tstats_procfs+0x0/0x53 returned 0 after 0 usecs
[    1.371062] calling  lockdep_proc_init+0x0/0xa3 @ 1
[    1.372063] initcall lockdep_proc_init+0x0/0xa3 returned 0 after 0 usecs
[    1.373008] calling  futex_init+0x0/0xa9 @ 1
[    1.374057] initcall futex_init+0x0/0xa9 returned 0 after 0 usecs
[    1.375056] calling  proc_dma_init+0x0/0x49 @ 1
[    1.376020] initcall proc_dma_init+0x0/0x49 returned 0 after 0 usecs
[    1.377008] calling  kallsyms_init+0x0/0x4c @ 1
[    1.378020] initcall kallsyms_init+0x0/0x4c returned 0 after 0 usecs
[    1.379056] calling  crash_save_vmcoreinfo_init+0x0/0x492 @ 1
[    1.380036] initcall crash_save_vmcoreinfo_init+0x0/0x492 returned 0 after 0 usecs
[    1.381008] calling  crash_notes_memory_init+0x0/0x5f @ 1
[    1.382015] initcall crash_notes_memory_init+0x0/0x5f returned 0 after 0 usecs
[    1.383057] calling  backtrace_regression_test+0x0/0x11f @ 1
[    1.384006] ====[ backtrace testing ]===========
[    1.385006] Testing a backtrace from process context.
[    1.386006] The following trace is a kernel self test and not a bug!
[    1.388010] Pid: 1, comm: swapper Tainted: G        W  2.6.31-rc5-tip-00896-g6efa9e9-dirty #718
[    1.389006] Call Trace:
[    1.390011]  [<ffffffff810c7731>] ? backtrace_regression_test+0x0/0x11f
[    1.391058]  [<ffffffff810c777b>] backtrace_regression_test+0x4a/0x11f
[    1.392009]  [<ffffffff810c7731>] ? backtrace_regression_test+0x0/0x11f
[    1.393010]  [<ffffffff810b1515>] ? jiffies_read+0xd/0x3c
[    1.394009]  [<ffffffff810afcc9>] ? ktime_get+0x77/0xea
[    1.395057]  [<ffffffff828a7a49>] ? kallsyms_init+0x0/0x4c
[    1.396009]  [<ffffffff810c7731>] ? backtrace_regression_test+0x0/0x11f
[    1.397011]  [<ffffffff8100a10b>] do_one_initcall+0x85/0x1a5
[    1.398011]  [<ffffffff810bc0da>] ? __lock_acquire+0x3e6/0x463
[    1.399058]  [<ffffffff8119e679>] ? proc_register+0x114/0x138
[    1.400010]  [<ffffffff810b840f>] ? put_lock_stats+0x3b/0x5a
[    1.401009]  [<ffffffff810b84f3>] ? lock_release_holdtime+0xc5/0xe1
[    1.402009]  [<ffffffff8119e679>] ? proc_register+0x114/0x138
[    1.403057]  [<ffffffff810bceaf>] ? __lock_release+0x17f/0x19f
[    1.404011]  [<ffffffff8148e1ca>] ? _raw_spin_unlock+0x9e/0xbb
[    1.405009]  [<ffffffff810c4297>] ? test_ti_thread_flag+0xd/0x3a
[    1.406011]  [<ffffffff81f4e250>] ? _spin_unlock+0x5e/0x82
[    1.407057]  [<ffffffff8119e679>] ? proc_register+0x114/0x138
[    1.408009]  [<ffffffff8119e803>] ? create_proc_entry+0x92/0xbe
[    1.409011]  [<ffffffff810d56f5>] ? register_irq_proc+0x12/0xf2
[    1.410009]  [<ffffffff810d2161>] ? irq_to_desc+0xd/0x49
[    1.411059]  [<ffffffff8288f140>] ? early_idt_handler+0x0/0x71
[    1.412009]  [<ffffffff8288f140>] ? early_idt_handler+0x0/0x71
[    1.413009]  [<ffffffff8288f95c>] do_basic_setup+0x59/0x82
[    1.414009]  [<ffffffff8288f140>] ? early_idt_handler+0x0/0x71
[    1.415057]  [<ffffffff8288fa0d>] kernel_init+0x88/0xe2
[    1.416009]  [<ffffffff8288f140>] ? early_idt_handler+0x0/0x71
[    1.417011]  [<ffffffff8103d45a>] child_rip+0xa/0x20
[    1.418010]  [<ffffffff8103cd94>] ? restore_args+0x0/0x30
[    1.419057]  [<ffffffff8288f985>] ? kernel_init+0x0/0xe2
[    1.420009]  [<ffffffff8103d450>] ? child_rip+0x0/0x20
[    1.421006] Testing a backtrace from irq context.
[    1.422006] The following trace is a kernel self test and not a bug!
[    1.423065] Pid: 4, comm: ksoftirqd/0 Tainted: G        W  2.6.31-rc5-tip-00896-g6efa9e9-dirty #718
[    1.424003] Call Trace:
[    1.425003]  <IRQ>  [<ffffffff810c770f>] backtrace_test_irq_callback+0x21/0x43
[    1.427008]  [<ffffffff8108f5ee>] tasklet_action+0xd1/0x160
[    1.428006]  [<ffffffff81090501>] __do_softirq+0x14d/0x25b
[    1.429006]  [<ffffffff8103d55c>] call_softirq+0x1c/0x30
[    1.430003]  <EOI>  [<ffffffff8103f8ca>] do_softirq+0x5e/0xcf
[    1.432006]  [<ffffffff8108f21c>] ksoftirqd+0xa8/0x19d
[    1.433006]  [<ffffffff810740e5>] ? complete+0x57/0x76
[    1.434006]  [<ffffffff8108f174>] ? ksoftirqd+0x0/0x19d
[    1.435007]  [<ffffffff810a4b28>] kthread+0x96/0x9e
[    1.436006]  [<ffffffff8103d45a>] child_rip+0xa/0x20
[    1.437006]  [<ffffffff8103cd94>] ? restore_args+0x0/0x30
[    1.438006]  [<ffffffff810a4a92>] ? kthread+0x0/0x9e
[    1.439006]  [<ffffffff8103d450>] ? child_rip+0x0/0x20
[    1.440016] Testing a saved backtrace.
[    1.441006] The following trace is a kernel self test and not a bug!
[    1.442010]  [<ffffffff81049fbb>] save_stack_trace+0x3e/0x73
[    1.444060]  [<ffffffff810c7819>] backtrace_regression_test+0xe8/0x11f
[    1.446006]  [<ffffffff8100a10b>] do_one_initcall+0x85/0x1a5
[    1.448054]  [<ffffffff8288f95c>] do_basic_setup+0x59/0x82
[    1.450006]  [<ffffffff8288fa0d>] kernel_init+0x88/0xe2
[    1.452054]  [<ffffffff8103d45a>] child_rip+0xa/0x20
[    1.454006]  [<ffffffffffffffff>] 0xffffffffffffffff
[    1.456054] ====[ end of backtrace testing ]====
[    1.457009] initcall backtrace_regression_test+0x0/0x11f returned 0 after 71289 usecs
[    1.458008] calling  pid_namespaces_init+0x0/0x54 @ 1
[    1.459102] initcall pid_namespaces_init+0x0/0x54 returned 0 after 0 usecs
[    1.460057] calling  audit_init+0x0/0x17a @ 1
[    1.461007] audit: initializing netlink socket (disabled)
[    1.462129] type=2000 audit(1249399790.462:1): initialized
[    1.463021] initcall audit_init+0x0/0x17a returned 0 after 1953 usecs
[    1.464056] calling  hung_task_init+0x0/0x79 @ 1
[    1.465116] initcall hung_task_init+0x0/0x79 returned 0 after 0 usecs
[    1.466010] calling  rcuclassic_trace_init+0x0/0x17d @ 1
[    1.467099] initcall rcuclassic_trace_init+0x0/0x17d returned 0 after 0 usecs
[    1.468008] calling  utsname_sysctl_init+0x0/0x3b @ 1
[    1.469014] initcall utsname_sysctl_init+0x0/0x3b returned 0 after 0 usecs
[    1.470064] calling  init_lstats_procfs+0x0/0x4c @ 1
[    1.471024] initcall init_lstats_procfs+0x0/0x4c returned 0 after 0 usecs
[    1.472008] calling  ftrace_nodyn_init+0x0/0x37 @ 1
[    1.473008] initcall ftrace_nodyn_init+0x0/0x37 returned 0 after 0 usecs
[    1.474056] calling  init_events+0x0/0x8c @ 1
[    1.475029] initcall init_events+0x0/0x8c returned 0 after 0 usecs
[    1.476008] calling  init_sched_switch_trace+0x0/0x39 @ 1
[    1.477016] Testing tracer sched_switch: PASSED
[    1.580957] initcall init_sched_switch_trace+0x0/0x39 returned 0 after 100586 usecs
[    1.581009] calling  init_stack_trace+0x0/0x39 @ 1
[    1.582010] Testing tracer sysprof: .. no entries found ..FAILED!
[    1.686807] initcall init_stack_trace+0x0/0x39 returned -1 after 101562 usecs
[    1.688010] initcall init_stack_trace+0x0/0x39 returned with error code -1 
[    1.690009] calling  init_function_trace+0x0/0x39 @ 1
[    1.691010] Testing tracer function: PASSED
[    1.796011] initcall init_function_trace+0x0/0x39 returned 0 after 102539 usecs
[    1.797008] calling  init_irqsoff_tracer+0x0/0x53 @ 1
[    1.798010] Testing tracer irqsoff: PASSED
[    1.801011] Testing tracer preemptoff: PASSED
[    1.803063] Testing tracer preemptirqsoff: PASSED
[    1.805010] initcall init_irqsoff_tracer+0x0/0x53 returned 0 after 6835 usecs
[    1.806008] calling  init_graph_trace+0x0/0x39 @ 1
[    1.807010] Testing tracer function_graph: PASSED
[    1.911012] initcall init_graph_trace+0x0/0x39 returned 0 after 101562 usecs
[    1.912010] calling  init_power_trace+0x0/0x39 @ 1
[    1.913011] initcall init_power_trace+0x0/0x39 returned 0 after 0 usecs
[    1.914056] calling  init_kmem_tracer+0x0/0x7d @ 1
[    1.915014] Warning: could not register the kmem tracer
[    1.916008] initcall init_kmem_tracer+0x0/0x7d returned 1 after 976 usecs
[    1.917008] initcall init_kmem_tracer+0x0/0x7d returned with error code 1 
[    1.918056] calling  init_blk_tracer+0x0/0x7e @ 1
[    1.919016] initcall init_blk_tracer+0x0/0x7e returned 0 after 0 usecs
[    1.920056] calling  register_ftrace_syscalls+0x0/0xc5 @ 1
[    1.921016] initcall register_ftrace_syscalls+0x0/0xc5 returned 0 after 0 usecs
[    1.922008] calling  init_ksym_trace+0x0/0x76 @ 1
[    1.923031] Testing tracer ksym_tracer: PASSED
[    1.939777] initcall init_ksym_trace+0x0/0x76 returned 0 after 15625 usecs
[    1.940009] calling  perf_counter_sysfs_init+0x0/0x40 @ 1
[    1.941036] initcall perf_counter_sysfs_init+0x0/0x40 returned 0 after 0 usecs
[    1.942009] calling  init_per_zone_wmark_min+0x0/0x8d @ 1
[    1.943138] initcall init_per_zone_wmark_min+0x0/0x8d returned 0 after 0 usecs
[    1.944008] calling  pdflush_init+0x0/0x43 @ 1
[    1.945129] initcall pdflush_init+0x0/0x43 returned 0 after 0 usecs
[    1.946010] calling  kswapd_init+0x0/0x97 @ 1
[    1.947170] initcall kswapd_init+0x0/0x97 returned 0 after 0 usecs
[    1.948009] calling  init_tmpfs+0x0/0x64 @ 1
[    1.949196] initcall init_tmpfs+0x0/0x64 returned 0 after 0 usecs
[    1.950009] calling  setup_vmstat+0x0/0xef @ 1
[    1.951077] initcall setup_vmstat+0x0/0xef returned 0 after 0 usecs
[    1.952009] calling  mm_sysfs_init+0x0/0x50 @ 1
[    1.953023] initcall mm_sysfs_init+0x0/0x50 returned 0 after 0 usecs
[    1.954008] calling  proc_vmalloc_init+0x0/0x4c @ 1
[    1.956023] initcall proc_vmalloc_init+0x0/0x4c returned 0 after 0 usecs
[    1.957009] calling  procswaps_init+0x0/0x49 @ 1
[    1.958021] initcall procswaps_init+0x0/0x49 returned 0 after 0 usecs
[    1.959009] calling  hugetlb_init+0x0/0x230 @ 1
[    1.960012] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    1.961051] initcall hugetlb_init+0x0/0x230 returned 0 after 976 usecs
[    1.962008] calling  slab_proc_init+0x0/0x4c @ 1
[    1.963022] initcall slab_proc_init+0x0/0x4c returned 0 after 0 usecs
[    1.964008] calling  slab_sysfs_init+0x0/0x11b @ 1
[    2.017158] initcall slab_sysfs_init+0x0/0x11b returned 0 after 50781 usecs
[    2.018144] calling  fasync_init+0x0/0x51 @ 1
[    2.020050] initcall fasync_init+0x0/0x51 returned 0 after 976 usecs
[    2.021071] calling  proc_filesystems_init+0x0/0x49 @ 1
[    2.022029] initcall proc_filesystems_init+0x0/0x49 returned 0 after 0 usecs
[    2.023008] calling  dnotify_init+0x0/0xa7 @ 1
[    2.025493] initcall dnotify_init+0x0/0xa7 returned 0 after 976 usecs
[    2.026058] calling  aio_setup+0x0/0x9c @ 1
[    2.030168] initcall aio_setup+0x0/0x9c returned 0 after 2929 usecs
[    2.031058] calling  proc_locks_init+0x0/0x49 @ 1
[    2.032027] initcall proc_locks_init+0x0/0x49 returned 0 after 0 usecs
[    2.033008] calling  init_sys32_ioctl+0x0/0xac @ 1
[    2.034024] initcall init_sys32_ioctl+0x0/0xac returned 0 after 0 usecs
[    2.035056] calling  init_mbcache+0x0/0x3b @ 1
[    2.036012] initcall init_mbcache+0x0/0x3b returned 0 after 0 usecs
[    2.037008] calling  dquot_init+0x0/0x12a @ 1
[    2.038007] VFS: Disk quotas dquot_6.5.2
[    2.040068] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    2.041067] initcall dquot_init+0x0/0x12a returned 0 after 2929 usecs
[    2.042008] calling  init_v1_quota_format+0x0/0x39 @ 1
[    2.043010] initcall init_v1_quota_format+0x0/0x39 returned 0 after 0 usecs
[    2.044056] calling  init_v2_quota_format+0x0/0x39 @ 1
[    2.045009] initcall init_v2_quota_format+0x0/0x39 returned 0 after 0 usecs
[    2.046008] calling  proc_cmdline_init+0x0/0x49 @ 1
[    2.047023] initcall proc_cmdline_init+0x0/0x49 returned 0 after 0 usecs
[    2.048057] calling  proc_cpuinfo_init+0x0/0x49 @ 1
[    2.049021] initcall proc_cpuinfo_init+0x0/0x49 returned 0 after 0 usecs
[    2.050008] calling  proc_devices_init+0x0/0x49 @ 1
[    2.051021] initcall proc_devices_init+0x0/0x49 returned 0 after 0 usecs
[    2.052057] calling  proc_interrupts_init+0x0/0x49 @ 1
[    2.053021] initcall proc_interrupts_init+0x0/0x49 returned 0 after 0 usecs
[    2.054008] calling  proc_loadavg_init+0x0/0x49 @ 1
[    2.055021] initcall proc_loadavg_init+0x0/0x49 returned 0 after 0 usecs
[    2.057009] calling  proc_meminfo_init+0x0/0x49 @ 1
[    2.058021] initcall proc_meminfo_init+0x0/0x49 returned 0 after 0 usecs
[    2.059009] calling  proc_stat_init+0x0/0x49 @ 1
[    2.060069] initcall proc_stat_init+0x0/0x49 returned 0 after 0 usecs
[    2.061008] calling  proc_uptime_init+0x0/0x49 @ 1
[    2.062021] initcall proc_uptime_init+0x0/0x49 returned 0 after 0 usecs
[    2.063009] calling  proc_version_init+0x0/0x49 @ 1
[    2.064069] initcall proc_version_init+0x0/0x49 returned 0 after 0 usecs
[    2.065008] calling  proc_softirqs_init+0x0/0x49 @ 1
[    2.066021] initcall proc_softirqs_init+0x0/0x49 returned 0 after 0 usecs
[    2.067009] calling  proc_kmsg_init+0x0/0x4c @ 1
[    2.068081] initcall proc_kmsg_init+0x0/0x4c returned 0 after 0 usecs
[    2.069008] calling  proc_page_init+0x0/0x69 @ 1
[    2.070033] initcall proc_page_init+0x0/0x69 returned 0 after 0 usecs
[    2.071008] calling  configfs_init+0x0/0xfb @ 1
[    2.073125] initcall configfs_init+0x0/0xfb returned 0 after 976 usecs
[    2.074014] calling  init_devpts_fs+0x0/0x72 @ 1
[    2.075355] initcall init_devpts_fs+0x0/0x72 returned 0 after 0 usecs
[    2.076008] calling  init_dlm+0x0/0xbe @ 1
[    2.079348] DLM (built Aug  4 2009 11:29:49) installed
[    2.080063] initcall init_dlm+0x0/0xbe returned 0 after 2929 usecs
[    2.081009] calling  init_ext3_fs+0x0/0x99 @ 1
[    2.083533] initcall init_ext3_fs+0x0/0x99 returned 0 after 976 usecs
[    2.084093] calling  journal_init+0x0/0xf5 @ 1
[    2.088278] initcall journal_init+0x0/0xf5 returned 0 after 2929 usecs
[    2.089086] calling  journal_init+0x0/0xd6 @ 1
[    2.093170] initcall journal_init+0x0/0xd6 returned 0 after 2929 usecs
[    2.094059] calling  init_cramfs_fs+0x0/0x57 @ 1
[    2.095048] initcall init_cramfs_fs+0x0/0x57 returned 0 after 0 usecs
[    2.096009] calling  init_squashfs_fs+0x0/0x93 @ 1
[    2.098087] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.099058] initcall init_squashfs_fs+0x0/0x93 returned 0 after 1953 usecs
[    2.100008] calling  init_ramfs_fs+0x0/0x39 @ 1
[    2.101010] initcall init_ramfs_fs+0x0/0x39 returned 0 after 0 usecs
[    2.102008] calling  init_hugetlbfs_fs+0x0/0xbe @ 1
[    2.104309] initcall init_hugetlbfs_fs+0x0/0xbe returned 0 after 976 usecs
[    2.105015] calling  init_coda+0x0/0x16a @ 1
[    2.110167] initcall init_coda+0x0/0x16a returned 0 after 3906 usecs
[    2.111009] calling  init_fat_fs+0x0/0x75 @ 1
[    2.114157] initcall init_fat_fs+0x0/0x75 returned 0 after 1953 usecs
[    2.115098] calling  init_vfat_fs+0x0/0x39 @ 1
[    2.116011] initcall init_vfat_fs+0x0/0x39 returned 0 after 0 usecs
[    2.117008] calling  init_msdos_fs+0x0/0x39 @ 1
[    2.118010] initcall init_msdos_fs+0x0/0x39 returned 0 after 0 usecs
[    2.119056] calling  init_hfsplus_fs+0x0/0x83 @ 1
[    2.120417] initcall init_hfsplus_fs+0x0/0x83 returned 0 after 0 usecs
[    2.121060] calling  ecryptfs_init+0x0/0x220 @ 1
[    2.132370] initcall ecryptfs_init+0x0/0x220 returned 0 after 9765 usecs
[    2.133154] calling  vxfs_init+0x0/0x7f @ 1
[    2.135175] initcall vxfs_init+0x0/0x7f returned 0 after 976 usecs
[    2.136061] calling  init_nfs_fs+0x0/0x15e @ 1
[    2.141081] initcall init_nfs_fs+0x0/0x15e returned 0 after 3906 usecs
[    2.142009] calling  init_nfsd+0x0/0xe1 @ 1
[    2.143007] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    2.145978] initcall init_nfsd+0x0/0xe1 returned 0 after 1953 usecs
[    2.146009] calling  init_nlm+0x0/0x49 @ 1
[    2.147013] initcall init_nlm+0x0/0x49 returned 0 after 0 usecs
[    2.148009] calling  init_nls_cp737+0x0/0x39 @ 1
[    2.149082] initcall init_nls_cp737+0x0/0x39 returned 0 after 0 usecs
[    2.150008] calling  init_nls_cp775+0x0/0x39 @ 1
[    2.151010] initcall init_nls_cp775+0x0/0x39 returned 0 after 0 usecs
[    2.152009] calling  init_nls_cp852+0x0/0x39 @ 1
[    2.153058] initcall init_nls_cp852+0x0/0x39 returned 0 after 0 usecs
[    2.154008] calling  init_nls_cp855+0x0/0x39 @ 1
[    2.155010] initcall init_nls_cp855+0x0/0x39 returned 0 after 0 usecs
[    2.156008] calling  init_nls_cp857+0x0/0x39 @ 1
[    2.157058] initcall init_nls_cp857+0x0/0x39 returned 0 after 0 usecs
[    2.158008] calling  init_nls_cp861+0x0/0x39 @ 1
[    2.159010] initcall init_nls_cp861+0x0/0x39 returned 0 after 0 usecs
[    2.160008] calling  init_nls_cp865+0x0/0x39 @ 1
[    2.161058] initcall init_nls_cp865+0x0/0x39 returned 0 after 0 usecs
[    2.162008] calling  init_nls_cp866+0x0/0x39 @ 1
[    2.163010] initcall init_nls_cp866+0x0/0x39 returned 0 after 0 usecs
[    2.164008] calling  init_nls_cp869+0x0/0x39 @ 1
[    2.165058] initcall init_nls_cp869+0x0/0x39 returned 0 after 0 usecs
[    2.166013] calling  init_nls_cp874+0x0/0x39 @ 1
[    2.167010] initcall init_nls_cp874+0x0/0x39 returned 0 after 0 usecs
[    2.168008] calling  init_nls_cp932+0x0/0x39 @ 1
[    2.170011] initcall init_nls_cp932+0x0/0x39 returned 0 after 0 usecs
[    2.171008] calling  init_nls_euc_jp+0x0/0x6f @ 1
[    2.172011] initcall init_nls_euc_jp+0x0/0x6f returned 0 after 0 usecs
[    2.173057] calling  init_nls_cp936+0x0/0x39 @ 1
[    2.174010] initcall init_nls_cp936+0x0/0x39 returned 0 after 0 usecs
[    2.175008] calling  init_nls_cp950+0x0/0x39 @ 1
[    2.176010] initcall init_nls_cp950+0x0/0x39 returned 0 after 0 usecs
[    2.177057] calling  init_nls_cp1250+0x0/0x39 @ 1
[    2.178010] initcall init_nls_cp1250+0x0/0x39 returned 0 after 0 usecs
[    2.179009] calling  init_nls_cp1251+0x0/0x39 @ 1
[    2.180010] initcall init_nls_cp1251+0x0/0x39 returned 0 after 0 usecs
[    2.181058] calling  init_nls_iso8859_1+0x0/0x39 @ 1
[    2.182010] initcall init_nls_iso8859_1+0x0/0x39 returned 0 after 0 usecs
[    2.183009] calling  init_nls_iso8859_2+0x0/0x39 @ 1
[    2.184010] initcall init_nls_iso8859_2+0x0/0x39 returned 0 after 0 usecs
[    2.185057] calling  init_nls_iso8859_4+0x0/0x39 @ 1
[    2.186010] initcall init_nls_iso8859_4+0x0/0x39 returned 0 after 0 usecs
[    2.187009] calling  init_nls_iso8859_5+0x0/0x39 @ 1
[    2.188010] initcall init_nls_iso8859_5+0x0/0x39 returned 0 after 0 usecs
[    2.189057] calling  init_nls_iso8859_6+0x0/0x39 @ 1
[    2.190010] initcall init_nls_iso8859_6+0x0/0x39 returned 0 after 0 usecs
[    2.191009] calling  init_nls_cp1255+0x0/0x39 @ 1
[    2.192010] initcall init_nls_cp1255+0x0/0x39 returned 0 after 0 usecs
[    2.193057] calling  init_nls_iso8859_9+0x0/0x39 @ 1
[    2.194010] initcall init_nls_iso8859_9+0x0/0x39 returned 0 after 0 usecs
[    2.195009] calling  init_nls_iso8859_13+0x0/0x39 @ 1
[    2.196010] initcall init_nls_iso8859_13+0x0/0x39 returned 0 after 0 usecs
[    2.197059] calling  init_nls_iso8859_14+0x0/0x39 @ 1
[    2.198010] initcall init_nls_iso8859_14+0x0/0x39 returned 0 after 0 usecs
[    2.199009] calling  init_nls_iso8859_15+0x0/0x39 @ 1
[    2.200010] initcall init_nls_iso8859_15+0x0/0x39 returned 0 after 0 usecs
[    2.201057] calling  init_nls_utf8+0x0/0x4a @ 1
[    2.202010] initcall init_nls_utf8+0x0/0x4a returned 0 after 0 usecs
[    2.203009] calling  init_sysv_fs+0x0/0x75 @ 1
[    2.205513] initcall init_sysv_fs+0x0/0x75 returned 0 after 976 usecs
[    2.206082] calling  init_cifs+0x0/0x37a @ 1
[    2.211310] initcall init_cifs+0x0/0x37a returned 0 after 3906 usecs
[    2.212066] calling  init_ufs_fs+0x0/0x89 @ 1
[    2.214163] initcall init_ufs_fs+0x0/0x89 returned 0 after 976 usecs
[    2.215075] calling  init_efs_fs+0x0/0x95 @ 1
[    2.216007] EFS: 1.0a - http://aeschi.ch.eu.org/efs/
[    2.218328] initcall init_efs_fs+0x0/0x95 returned 0 after 1953 usecs
[    2.220015] calling  init_autofs4_fs+0x0/0x4c @ 1
[    2.222152] initcall init_autofs4_fs+0x0/0x4c returned 0 after 976 usecs
[    2.223009] calling  init_adfs_fs+0x0/0x89 @ 1
[    2.224365] initcall init_adfs_fs+0x0/0x89 returned 0 after 0 usecs
[    2.225011] calling  init_omfs_fs+0x0/0x39 @ 1
[    2.226010] initcall init_omfs_fs+0x0/0x39 returned 0 after 0 usecs
[    2.227008] calling  init_jfs_fs+0x0/0x28a @ 1
[    2.229381] JFS: nTxBlock = 7060, nTxLock = 56484
[    2.239148] initcall init_jfs_fs+0x0/0x28a returned 0 after 10742 usecs
[    2.240010] calling  init_nilfs_fs+0x0/0xb9 @ 1
[    2.244156] initcall init_nilfs_fs+0x0/0xb9 returned 0 after 2929 usecs
[    2.245065] calling  ocfs2_init+0x0/0x484 @ 1
[    2.246007] OCFS2 1.5.0
[    2.252157] initcall ocfs2_init+0x0/0x484 returned 0 after 5859 usecs
[    2.253065] calling  ocfs2_stack_glue_init+0x0/0xbb @ 1
[    2.255053] initcall ocfs2_stack_glue_init+0x0/0xbb returned 0 after 0 usecs
[    2.256009] calling  o2cb_stack_init+0x0/0x39 @ 1
[    2.257056] ocfs2: Registered cluster interface o2cb
[    2.258009] initcall o2cb_stack_init+0x0/0x39 returned 0 after 976 usecs
[    2.259008] calling  ocfs2_user_plugin_init+0x0/0x7c @ 1
[    2.261065] ocfs2: Registered cluster interface user
[    2.262058] initcall ocfs2_user_plugin_init+0x0/0x7c returned 0 after 1953 usecs
[    2.263008] calling  init_o2nm+0x0/0xcf @ 1
[    2.264007] OCFS2 Node Manager 1.5.0
[    2.268595] initcall init_o2nm+0x0/0xcf returned 0 after 3906 usecs
[    2.269016] calling  dlm_init+0x0/0x356 @ 1
[    2.270007] OCFS2 DLM 1.5.0
[    2.273449] initcall dlm_init+0x0/0x356 returned 0 after 2929 usecs
[    2.274066] calling  init_dlmfs_fs+0x0/0x106 @ 1
[    2.275007] OCFS2 DLMFS 1.5.0
[    2.277149] OCFS2 User DLM kernel interface loaded
[    2.278127] initcall init_dlmfs_fs+0x0/0x106 returned 0 after 2929 usecs
[    2.279009] calling  init_gfs2_fs+0x0/0x20d @ 1
[    2.285163] Slow work thread pool: Starting up
[    2.286157] Slow work thread pool: Ready
[    2.288035] GFS2 (built Aug  4 2009 11:30:00) installed
[    2.289014] initcall init_gfs2_fs+0x0/0x20d returned 0 after 8789 usecs
[    2.290009] calling  init_exofs+0x0/0x89 @ 1
[    2.291444] initcall init_exofs+0x0/0x89 returned 0 after 0 usecs
[    2.293017] calling  init_mqueue_fs+0x0/0xee @ 1
[    2.295326] initcall init_mqueue_fs+0x0/0xee returned 0 after 976 usecs
[    2.296116] calling  key_proc_init+0x0/0x5a @ 1
[    2.297033] initcall key_proc_init+0x0/0x5a returned 0 after 0 usecs
[    2.298009] calling  init_sel_fs+0x0/0x8e @ 1
[    2.299009] initcall init_sel_fs+0x0/0x8e returned 0 after 0 usecs
[    2.300056] calling  selnl_init+0x0/0x74 @ 1
[    2.301038] initcall selnl_init+0x0/0x74 returned 0 after 0 usecs
[    2.302009] calling  sel_netif_init+0x0/0x8d @ 1
[    2.303009] initcall sel_netif_init+0x0/0x8d returned 0 after 0 usecs
[    2.304057] calling  sel_netnode_init+0x0/0x9a @ 1
[    2.305009] initcall sel_netnode_init+0x0/0x9a returned 0 after 0 usecs
[    2.306009] calling  sel_netport_init+0x0/0x9a @ 1
[    2.307009] initcall sel_netport_init+0x0/0x9a returned 0 after 0 usecs
[    2.308057] calling  aurule_init+0x0/0x5e @ 1
[    2.309011] initcall aurule_init+0x0/0x5e returned 0 after 0 usecs
[    2.310009] calling  crypto_wq_init+0x0/0x59 @ 1
[    2.311165] initcall crypto_wq_init+0x0/0x59 returned 0 after 0 usecs
[    2.312106] calling  crypto_algapi_init+0x0/0x34 @ 1
[    2.313028] initcall crypto_algapi_init+0x0/0x34 returned 0 after 0 usecs
[    2.314009] calling  chainiv_module_init+0x0/0x39 @ 1
[    2.315017] initcall chainiv_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.316058] calling  eseqiv_module_init+0x0/0x39 @ 1
[    2.317014] initcall eseqiv_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.318009] calling  seqiv_module_init+0x0/0x39 @ 1
[    2.319014] initcall seqiv_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.320059] calling  hmac_module_init+0x0/0x39 @ 1
[    2.321014] initcall hmac_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.322009] calling  crypto_xcbc_module_init+0x0/0x39 @ 1
[    2.323014] initcall crypto_xcbc_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.324057] calling  crypto_null_mod_init+0x0/0xa5 @ 1
[    2.325102] alg: No test for cipher_null (cipher_null-generic)
[    2.332072] alg: No test for ecb(cipher_null) (ecb-cipher_null)
[    2.333262] alg: No test for digest_null (digest_null-generic)
[    2.339348] alg: No test for compress_null (compress_null-generic)
[    2.340064] initcall crypto_null_mod_init+0x0/0xa5 returned 0 after 14648 usecs
[    2.341064] calling  md5_mod_init+0x0/0x39 @ 1
[    2.342105] initcall md5_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.344011] calling  rmd160_mod_init+0x0/0x39 @ 1
[    2.345096] initcall rmd160_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.346059] calling  rmd320_mod_init+0x0/0x39 @ 1
[    2.347110] initcall rmd320_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.348014] calling  sha1_generic_mod_init+0x0/0x39 @ 1
[    2.349108] initcall sha1_generic_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.350011] calling  sha256_generic_mod_init+0x0/0x65 @ 1
[    2.352264] initcall sha256_generic_mod_init+0x0/0x65 returned 0 after 976 usecs
[    2.353064] calling  sha512_generic_mod_init+0x0/0x65 @ 1
[    2.354247] initcall sha512_generic_mod_init+0x0/0x65 returned 0 after 0 usecs
[    2.356040] calling  crypto_ecb_module_init+0x0/0x39 @ 1
[    2.357014] initcall crypto_ecb_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.358009] calling  crypto_cbc_module_init+0x0/0x39 @ 1
[    2.359061] initcall crypto_cbc_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.360009] calling  crypto_pcbc_module_init+0x0/0x39 @ 1
[    2.361014] initcall crypto_pcbc_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.362009] calling  crypto_cts_module_init+0x0/0x39 @ 1
[    2.364016] initcall crypto_cts_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.365009] calling  crypto_module_init+0x0/0x39 @ 1
[    2.366014] initcall crypto_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.368010] calling  crypto_module_init+0x0/0x39 @ 1
[    2.370016] initcall crypto_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.371057] calling  crypto_ctr_module_init+0x0/0x69 @ 1
[    2.372019] initcall crypto_ctr_module_init+0x0/0x69 returned 0 after 0 usecs
[    2.373009] calling  crypto_ccm_module_init+0x0/0x87 @ 1
[    2.374024] initcall crypto_ccm_module_init+0x0/0x87 returned 0 after 0 usecs
[    2.375057] calling  cryptd_init+0x0/0x109 @ 1
[    2.376020] initcall cryptd_init+0x0/0x109 returned 0 after 0 usecs
[    2.377009] calling  des_generic_mod_init+0x0/0x65 @ 1
[    2.379246] initcall des_generic_mod_init+0x0/0x65 returned 0 after 976 usecs
[    2.380059] calling  fcrypt_mod_init+0x0/0x39 @ 1
[    2.381111] alg: No test for fcrypt (fcrypt-generic)
[    2.386510] initcall fcrypt_mod_init+0x0/0x39 returned 0 after 4882 usecs
[    2.387009] calling  blowfish_mod_init+0x0/0x39 @ 1
[    2.389276] initcall blowfish_mod_init+0x0/0x39 returned 0 after 976 usecs
[    2.390009] calling  aes_init+0x0/0x39 @ 1
[    2.391143] initcall aes_init+0x0/0x39 returned 0 after 0 usecs
[    2.392011] calling  camellia_init+0x0/0x39 @ 1
[    2.393147] initcall camellia_init+0x0/0x39 returned 0 after 0 usecs
[    2.394011] calling  cast5_mod_init+0x0/0x39 @ 1
[    2.395111] initcall cast5_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.396011] calling  arc4_init+0x0/0x39 @ 1
[    2.397132] initcall arc4_init+0x0/0x39 returned 0 after 0 usecs
[    2.398011] calling  tea_mod_init+0x0/0x8a @ 1
[    2.400387] initcall tea_mod_init+0x0/0x8a returned 0 after 976 usecs
[    2.401064] calling  khazad_mod_init+0x0/0x39 @ 1
[    2.402157] initcall khazad_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.403084] calling  deflate_mod_init+0x0/0x39 @ 1
[    2.405812] initcall deflate_mod_init+0x0/0x39 returned 0 after 976 usecs
[    2.406014] calling  michael_mic_init+0x0/0x39 @ 1
[    2.407135] initcall michael_mic_init+0x0/0x39 returned 0 after 0 usecs
[    2.408011] calling  crc32c_mod_init+0x0/0x39 @ 1
[    2.409163] initcall crc32c_mod_init+0x0/0x39 returned 0 after 0 usecs
[    2.410011] calling  crypto_authenc_module_init+0x0/0x39 @ 1
[    2.411015] initcall crypto_authenc_module_init+0x0/0x39 returned 0 after 0 usecs
[    2.412009] calling  krng_mod_init+0x0/0x39 @ 1
[    2.413109] alg: No test for stdrng (krng)
[    2.417929] initcall krng_mod_init+0x0/0x39 returned 0 after 3906 usecs
[    2.418009] calling  prng_mod_init+0x0/0x4e @ 1
[    2.419109] alg: No test for stdrng (ansi_cprng)
[    2.423925] initcall prng_mod_init+0x0/0x4e returned 0 after 3906 usecs
[    2.424009] calling  proc_genhd_init+0x0/0x63 @ 1
[    2.425037] initcall proc_genhd_init+0x0/0x63 returned 0 after 0 usecs
[    2.426009] calling  bsg_init+0x0/0x155 @ 1
[    2.428112] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    2.429128] initcall bsg_init+0x0/0x155 returned 0 after 1953 usecs
[    2.430009] calling  noop_init+0x0/0x3b @ 1
[    2.431056] io scheduler noop registered
[    2.432009] initcall noop_init+0x0/0x3b returned 0 after 976 usecs
[    2.433056] calling  as_init+0x0/0x3b @ 1
[    2.434008] io scheduler anticipatory registered (default)
[    2.435009] initcall as_init+0x0/0x3b returned 0 after 976 usecs
[    2.436009] calling  deadline_init+0x0/0x3b @ 1
[    2.437057] io scheduler deadline registered
[    2.438009] initcall deadline_init+0x0/0x3b returned 0 after 976 usecs
[    2.439009] calling  cfq_init+0x0/0xbb @ 1
[    2.441523] io scheduler cfq registered
[    2.442105] initcall cfq_init+0x0/0xbb returned 0 after 1953 usecs
[    2.443009] calling  debug_objects_init_debugfs+0x0/0x8a @ 1
[    2.444073] initcall debug_objects_init_debugfs+0x0/0x8a returned 0 after 0 usecs
[    2.445008] calling  libcrc32c_mod_init+0x0/0x53 @ 1
[    2.446066] initcall libcrc32c_mod_init+0x0/0x53 returned 0 after 0 usecs
[    2.447008] calling  percpu_counter_startup+0x0/0x54 @ 1
[    2.448008] initcall percpu_counter_startup+0x0/0x54 returned 0 after 0 usecs
[    2.449009] calling  pci_init+0x0/0x60 @ 1
[    2.450072] pci 0000:00:00.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.451050] pci 0000:00:00.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.452011] pci 0000:00:00.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.453009] pci 0000:00:00.0: calling pci_fixup_video+0x0/0xe3
[    2.454068] pci 0000:00:01.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.455012] pci 0000:00:01.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.456009] pci 0000:00:01.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.457009] pci 0000:00:01.0: calling pci_fixup_video+0x0/0xe3
[    2.458068] pci 0000:00:01.1: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.459017] pci 0000:00:01.1: calling quirk_cardbus_legacy+0x0/0x4e
[    2.460009] pci 0000:00:01.1: calling quirk_usb_early_handoff+0x0/0xc4
[    2.461009] pci 0000:00:01.1: calling pci_fixup_video+0x0/0xe3
[    2.462068] pci 0000:00:02.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.463017] pci 0000:00:02.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.464009] pci 0000:00:02.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.476052] pci 0000:00:02.0: calling pci_fixup_video+0x0/0xe3
[    2.477020] pci 0000:00:02.1: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.478022] pci 0000:00:02.1: calling quirk_cardbus_legacy+0x0/0x4e
[    2.479009] pci 0000:00:02.1: calling quirk_usb_early_handoff+0x0/0xc4
[    2.480037] pci 0000:00:02.1: calling pci_fixup_video+0x0/0xe3
[    2.481019] pci 0000:00:04.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.482017] pci 0000:00:04.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.483009] pci 0000:00:04.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.484009] pci 0000:00:04.0: calling pci_fixup_video+0x0/0xe3
[    2.485019] pci 0000:00:06.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.486017] pci 0000:00:06.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.487009] pci 0000:00:06.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.488008] pci 0000:00:06.0: calling pci_fixup_video+0x0/0xe3
[    2.489019] pci 0000:00:09.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.490011] pci 0000:00:09.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.491009] pci 0000:00:09.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.492008] pci 0000:00:09.0: calling pci_fixup_video+0x0/0xe3
[    2.493019] pci 0000:00:0a.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.494017] pci 0000:00:0a.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.495009] pci 0000:00:0a.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.496009] pci 0000:00:0a.0: calling pci_fixup_video+0x0/0xe3
[    2.497019] pci 0000:00:0b.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.499151] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.500009] pci 0000:00:0b.0: calling quirk_nvidia_ck804_msi_ht_cap+0x0/0xb3
[    2.501025] pci 0000:00:0b.0: Found disabled HT MSI Mapping
[    2.502023] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.503009] pci 0000:00:0b.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[    2.504010] pci 0000:00:0b.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.505009] pci 0000:00:0b.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.506008] pci 0000:00:0b.0: calling pci_fixup_video+0x0/0xe3
[    2.507019] pci 0000:00:0c.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.508167] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.509009] pci 0000:00:0c.0: calling quirk_nvidia_ck804_msi_ht_cap+0x0/0xb3
[    2.510025] pci 0000:00:0c.0: Found disabled HT MSI Mapping
[    2.511024] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.512009] pci 0000:00:0c.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[    2.513010] pci 0000:00:0c.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.514009] pci 0000:00:0c.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.515008] pci 0000:00:0c.0: calling pci_fixup_video+0x0/0xe3
[    2.516019] pci 0000:00:0d.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.517187] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.518009] pci 0000:00:0d.0: calling quirk_nvidia_ck804_msi_ht_cap+0x0/0xb3
[    2.519025] pci 0000:00:0d.0: Found disabled HT MSI Mapping
[    2.520024] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.521009] pci 0000:00:0d.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[    2.522010] pci 0000:00:0d.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.523009] pci 0000:00:0d.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.524008] pci 0000:00:0d.0: calling pci_fixup_video+0x0/0xe3
[    2.525019] pci 0000:00:0e.0: calling nv_msi_ht_cap_quirk_leaf+0x0/0x39
[    2.526208] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.527009] pci 0000:00:0e.0: calling quirk_nvidia_ck804_msi_ht_cap+0x0/0xb3
[    2.528025] pci 0000:00:0e.0: Found disabled HT MSI Mapping
[    2.529024] pci 0000:00:00.0: Found enabled HT MSI Mapping
[    2.530009] pci 0000:00:0e.0: calling quirk_nvidia_ck804_pcie_aer_ext_cap+0x0/0xa1
[    2.531010] pci 0000:00:0e.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.532009] pci 0000:00:0e.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.533008] pci 0000:00:0e.0: calling pci_fixup_video+0x0/0xe3
[    2.534019] pci 0000:00:18.0: calling quirk_amd_nb_node+0x0/0x76
[    2.535014] pci 0000:00:18.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.536009] pci 0000:00:18.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.537008] pci 0000:00:18.0: calling pci_fixup_video+0x0/0xe3
[    2.538018] pci 0000:00:18.1: calling quirk_amd_nb_node+0x0/0x76
[    2.539014] pci 0000:00:18.1: calling quirk_cardbus_legacy+0x0/0x4e
[    2.540009] pci 0000:00:18.1: calling quirk_usb_early_handoff+0x0/0xc4
[    2.541008] pci 0000:00:18.1: calling pci_fixup_video+0x0/0xe3
[    2.542019] pci 0000:00:18.2: calling quirk_amd_nb_node+0x0/0x76
[    2.543014] pci 0000:00:18.2: calling quirk_cardbus_legacy+0x0/0x4e
[    2.544009] pci 0000:00:18.2: calling quirk_usb_early_handoff+0x0/0xc4
[    2.545008] pci 0000:00:18.2: calling pci_fixup_video+0x0/0xe3
[    2.546018] pci 0000:00:18.3: calling quirk_amd_nb_node+0x0/0x76
[    2.547014] pci 0000:00:18.3: calling quirk_cardbus_legacy+0x0/0x4e
[    2.548009] pci 0000:00:18.3: calling quirk_usb_early_handoff+0x0/0xc4
[    2.549008] pci 0000:00:18.3: calling pci_fixup_video+0x0/0xe3
[    2.550019] pci 0000:05:07.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.551009] pci 0000:05:07.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.552008] pci 0000:05:07.0: calling pci_fixup_video+0x0/0xe3
[    2.553019] pci 0000:01:00.0: calling quirk_cardbus_legacy+0x0/0x4e
[    2.554009] pci 0000:01:00.0: calling quirk_usb_early_handoff+0x0/0xc4
[    2.555008] pci 0000:01:00.0: calling pci_fixup_video+0x0/0xe3
[    2.556011] pci 0000:01:00.0: Boot video device
[    2.557019] pci 0000:01:00.1: calling quirk_cardbus_legacy+0x0/0x4e
[    2.558009] pci 0000:01:00.1: calling quirk_usb_early_handoff+0x0/0xc4
[    2.559008] pci 0000:01:00.1: calling pci_fixup_video+0x0/0xe3
[    2.560018] initcall pci_init+0x0/0x60 returned 0 after 107421 usecs
[    2.561008] calling  pci_proc_init+0x0/0x90 @ 1
[    2.562507] initcall pci_proc_init+0x0/0x90 returned 0 after 0 usecs
[    2.563009] calling  pcie_portdrv_init+0x0/0x72 @ 1
[    2.564236] pcieport-driver 0000:00:0b.0: irq 24 for MSI/MSI-X
[    2.565021] pcieport-driver 0000:00:0b.0: setting latency timer to 64
[    2.566299] pcieport-driver 0000:00:0c.0: irq 25 for MSI/MSI-X
[    2.567075] pcieport-driver 0000:00:0c.0: setting latency timer to 64
[    2.569094] pcieport-driver 0000:00:0d.0: irq 26 for MSI/MSI-X
[    2.570019] pcieport-driver 0000:00:0d.0: setting latency timer to 64
[    2.572233] pcieport-driver 0000:00:0e.0: irq 27 for MSI/MSI-X
[    2.573096] pcieport-driver 0000:00:0e.0: setting latency timer to 64
[    2.575235] initcall pcie_portdrv_init+0x0/0x72 returned 0 after 10742 usecs
[    2.576066] calling  aer_service_init+0x0/0x47 @ 1
[    2.577150] initcall aer_service_init+0x0/0x47 returned 0 after 0 usecs
[    2.578084] calling  aer_inject_init+0x0/0x39 @ 1
[    2.579119] initcall aer_inject_init+0x0/0x39 returned 0 after 0 usecs
[    2.581012] calling  pci_hotplug_init+0x0/0x74 @ 1
[    2.582007] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    2.583008] initcall pci_hotplug_init+0x0/0x74 returned 0 after 976 usecs
[    2.584056] calling  pcied_init+0x0/0x9a @ 1
[    2.585097] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    2.586059] initcall pcied_init+0x0/0x9a returned 0 after 976 usecs
[    2.587009] calling  zt5550_init+0x0/0xa3 @ 1
[    2.588007] cpcihp_zt5550: ZT5550 CompactPCI Hot Plug Driver version: 0.2
[    2.590149] initcall zt5550_init+0x0/0xa3 returned 0 after 1953 usecs
[    2.591014] calling  cpcihp_generic_init+0x0/0x254 @ 1
[    2.592007] cpcihp_generic: Generic port I/O CompactPCI Hot Plug Driver version: 0.1
[    2.593007] cpcihp_generic: not configured, disabling.
[    2.594009] initcall cpcihp_generic_init+0x0/0x254 returned -22 after 1953 usecs
[    2.595063] initcall cpcihp_generic_init+0x0/0x254 returned with error code -22 
[    2.596008] calling  init_legacy+0x0/0x69 @ 1
[    2.597491] initcall init_legacy+0x0/0x69 returned 0 after 0 usecs
[    2.598009] calling  platform_lcd_init+0x0/0x39 @ 1
[    2.600037] initcall platform_lcd_init+0x0/0x39 returned 0 after 976 usecs
[    2.601009] calling  tdo24m_init+0x0/0x39 @ 1
[    2.602095] initcall tdo24m_init+0x0/0x39 returned 0 after 0 usecs
[    2.603011] calling  progearbl_init+0x0/0x7b @ 1
[    2.605216] ALI M7101 PMU not found.
[    2.606178] initcall progearbl_init+0x0/0x7b returned 0 after 1953 usecs
[    2.607009] calling  cr_backlight_init+0x0/0x8b @ 1
[    2.609196] INTEL CARILLO RANCH LPC not found.
[    2.610124] Carillo Ranch Backlight Driver Initialized.
[    2.611010] initcall cr_backlight_init+0x0/0x8b returned 0 after 2929 usecs
[    2.612008] calling  kb3886_init+0x0/0x63 @ 1
[    2.613010] initcall kb3886_init+0x0/0x63 returned -19 after 0 usecs
[    2.614056] calling  arcfb_init+0x0/0x9a @ 1
[    2.615009] initcall arcfb_init+0x0/0x9a returned -6 after 0 usecs
[    2.616009] initcall arcfb_init+0x0/0x9a returned with error code -6 
[    2.617008] calling  cyber2000fb_init+0x0/0xf6 @ 1
[    2.619096] initcall cyber2000fb_init+0x0/0xf6 returned 0 after 976 usecs
[    2.620060] calling  pm3fb_init+0x0/0x107 @ 1
[    2.621123] initcall pm3fb_init+0x0/0x107 returned 0 after 0 usecs
[    2.622015] calling  matroxfb_init+0x0/0x8d @ 1
[    2.623134] initcall matroxfb_init+0x0/0x8d returned 0 after 0 usecs
[    2.624066] calling  matroxfb_crtc2_init+0x0/0x59 @ 1
[    2.625010] initcall matroxfb_crtc2_init+0x0/0x59 returned 0 after 0 usecs
[    2.626008] calling  atyfb_init+0x0/0x94 @ 1
[    2.627157] initcall atyfb_init+0x0/0x94 returned 0 after 0 usecs
[    2.628121] calling  aty128fb_init+0x0/0x75 @ 1
[    2.629282] initcall aty128fb_init+0x0/0x75 returned 0 after 0 usecs
[    2.630104] calling  sisfb_init+0x0/0x70 @ 1
[    2.631126] initcall sisfb_init+0x0/0x70 returned 0 after 0 usecs
[    2.632091] calling  viafb_init+0x0/0x78 @ 1
[    2.633008] VIA Graphics Intergration Chipset framebuffer 2.4 initializing
[    2.634254] i2c-adapter i2c-0: adapter [via_i2c] registered
[    2.635315] i2c-adapter i2c-0: master_xfer[0] W, addr=0x08, len=1
[    2.636009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x08, len=1
[    2.659009] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.702009] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.745008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.788008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.789009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x08: failed, timeout?
[    2.790008] i2c-adapter i2c-0: NAK from device addr 0x08 msg #0
[    2.812053] i2c-adapter i2c-0: master_xfer[0] W, addr=0x08, len=1
[    2.813008] i2c-adapter i2c-0: master_xfer[1] R, addr=0x08, len=1
[    2.835008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.878009] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.921008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.964008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    2.965009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x08: failed, timeout?
[    2.966008] i2c-adapter i2c-0: NAK from device addr 0x08 msg #0
[    2.988063] i2c-adapter i2c-0: master_xfer[0] W, addr=0x08, len=1
[    2.989008] i2c-adapter i2c-0: master_xfer[1] R, addr=0x08, len=1
[    3.011008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    3.054009] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    3.097008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    3.140008] i2c-adapter i2c-0: i2c_outb: 0x10, timeout at bit #7
[    3.141009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x08: failed, timeout?
[    3.142008] i2c-adapter i2c-0: NAK from device addr 0x08 msg #0
[    3.164052] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    3.165009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    3.187009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.230009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.273008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.316009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.317009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    3.318008] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    3.340052] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    3.341009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    3.363008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.406008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.449009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.492008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.493009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    3.494009] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    3.516052] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    3.517009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    3.539009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.582008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.625009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.668008] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.669009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    3.670009] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    3.692056] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    3.693009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    3.715009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.758009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.801009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.844009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.845009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    3.846009] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    3.868052] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    3.869009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    3.891009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.934009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    3.977010] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.020009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.021009] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    4.022009] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    4.044053] i2c-adapter i2c-0: master_xfer[0] W, addr=0x50, len=1
[    4.045009] i2c-adapter i2c-0: master_xfer[1] R, addr=0x50, len=1
[    4.067009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.110009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.153009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.196009] i2c-adapter i2c-0: i2c_outb: 0xa0, timeout at bit #7
[    4.197010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x50: failed, timeout?
[    4.198009] i2c-adapter i2c-0: NAK from device addr 0x50 msg #0
[    4.220054] i2c-adapter i2c-0: master_xfer[0] W, addr=0x40, len=1
[    4.221010] i2c-adapter i2c-0: master_xfer[1] R, addr=0x40, len=1
[    4.243009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.286010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.329010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.372010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.373010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x40: failed, timeout?
[    4.374009] i2c-adapter i2c-0: NAK from device addr 0x40 msg #0
[    4.396053] i2c-adapter i2c-0: master_xfer[0] W, addr=0x40, len=1
[    4.397010] i2c-adapter i2c-0: master_xfer[1] R, addr=0x40, len=1
[    4.419010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.462009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.505009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.548010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.549010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x40: failed, timeout?
[    4.550009] i2c-adapter i2c-0: NAK from device addr 0x40 msg #0
[    4.572054] i2c-adapter i2c-0: master_xfer[0] W, addr=0x40, len=1
[    4.573010] i2c-adapter i2c-0: master_xfer[1] R, addr=0x40, len=1
[    4.595009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.638009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.681010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.724011] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.725010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x40: failed, timeout?
[    4.726010] i2c-adapter i2c-0: NAK from device addr 0x40 msg #0
[    4.748053] i2c-adapter i2c-0: master_xfer[0] W, addr=0x40, len=1
[    4.749010] i2c-adapter i2c-0: master_xfer[1] R, addr=0x40, len=1
[    4.771010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.814009] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.857010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.900010] i2c-adapter i2c-0: i2c_outb: 0x80, timeout at bit #7
[    4.901010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x40: failed, timeout?
[    4.902010] i2c-adapter i2c-0: NAK from device addr 0x40 msg #0
[    4.924054] i2c-adapter i2c-0: master_xfer[0] W, addr=0x38, len=1
[    4.925010] i2c-adapter i2c-0: master_xfer[1] R, addr=0x38, len=1
[    4.947010] i2c-adapter i2c-0: i2c_outb: 0x70, timeout at bit #7
[    4.990010] i2c-adapter i2c-0: i2c_outb: 0x70, timeout at bit #7
[    5.033010] i2c-adapter i2c-0: i2c_outb: 0x70, timeout at bit #7
[    5.076010] i2c-adapter i2c-0: i2c_outb: 0x70, timeout at bit #7
[    5.077010] i2c-adapter i2c-0: Used 4 tries to write to client at 0x38: failed, timeout?
[    5.078010] i2c-adapter i2c-0: NAK from device addr 0x38 msg #0
[    5.100057] ioremap failed
[    5.101012] initcall viafb_init+0x0/0x78 returned -1 after 2410158 usecs
[    5.102011] initcall viafb_init+0x0/0x78 returned with error code -1 
[    5.103010] calling  kyrofb_init+0x0/0xf0 @ 1
[    5.104138] initcall kyrofb_init+0x0/0xf0 returned 0 after 0 usecs
[    5.105011] calling  savagefb_init+0x0/0x9a @ 1
[    5.106256] initcall savagefb_init+0x0/0x9a returned 0 after 0 usecs
[    5.107013] calling  gx1fb_init+0x0/0x70 @ 1
[    5.108243] initcall gx1fb_init+0x0/0x70 returned 0 after 0 usecs
[    5.109013] calling  gxfb_init+0x0/0xa7 @ 1
[    5.110137] initcall gxfb_init+0x0/0xa7 returned 0 after 0 usecs
[    5.111013] calling  neofb_init+0x0/0x70 @ 1
[    5.113164] initcall neofb_init+0x0/0x70 returned 0 after 976 usecs
[    5.114011] calling  tdfxfb_init+0x0/0x129 @ 1
[    5.116038] initcall tdfxfb_init+0x0/0x129 returned 0 after 976 usecs
[    5.117067] calling  vt8623fb_init+0x0/0x7c @ 1
[    5.118124] initcall vt8623fb_init+0x0/0x7c returned 0 after 0 usecs
[    5.119013] calling  tridentfb_init+0x0/0x70 @ 1
[    5.120126] initcall tridentfb_init+0x0/0x70 returned 0 after 0 usecs
[    5.121013] calling  vmlfb_init+0x0/0xbb @ 1
[    5.122009] vmlfb: initializing
[    5.124237] initcall vmlfb_init+0x0/0xbb returned 0 after 1953 usecs
[    5.125061] calling  cr_pll_init+0x0/0x10a @ 1
[    5.126033] Could not find Carillo Ranch MCH device.
[    5.127011] initcall cr_pll_init+0x0/0x10a returned -19 after 976 usecs
[    5.128010] calling  s3fb_init+0x0/0xdf @ 1
[    5.130123] initcall s3fb_init+0x0/0xdf returned 0 after 976 usecs
[    5.131076] calling  metronomefb_init+0x0/0x39 @ 1
[    5.132147] initcall metronomefb_init+0x0/0x39 returned 0 after 0 usecs
[    5.133091] calling  broadsheetfb_init+0x0/0x39 @ 1
[    5.134115] initcall broadsheetfb_init+0x0/0x39 returned 0 after 0 usecs
[    5.135059] calling  s1d13xxxfb_init+0x0/0x54 @ 1
[    5.136099] initcall s1d13xxxfb_init+0x0/0x54 returned 0 after 0 usecs
[    5.137060] calling  xenfb_init+0x0/0x6b @ 1
[    5.138011] initcall xenfb_init+0x0/0x6b returned -19 after 0 usecs
[    5.139012] calling  uvesafb_init+0x0/0x116 @ 1
[    5.141327] uvesafb: failed to execute /sbin/v86d
[    5.142108] uvesafb: make sure that the v86d helper is installed and executable
[    5.143018] uvesafb: Getting VBE info block failed (eax=0x4f00, err=-2)
[    5.144016] uvesafb: vbe_init() failed with -22
[    5.145050] uvesafb: probe of uvesafb.0 failed with error -22
[    5.146074] initcall uvesafb_init+0x0/0x116 returned 0 after 5859 usecs
[    5.147011] calling  evtchn_init+0x0/0x94 @ 1
[    5.148011] initcall evtchn_init+0x0/0x94 returned -19 after 0 usecs
[    5.149010] calling  xenfs_init+0x0/0x54 @ 1
[    5.150058] XENFS: not registering filesystem on non-xen platform
[    5.151011] initcall xenfs_init+0x0/0x54 returned 0 after 976 usecs
[    5.152012] calling  rand_initialize+0x0/0x58 @ 1
[    5.153053] initcall rand_initialize+0x0/0x58 returned 0 after 0 usecs
[    5.154059] calling  tty_init+0x0/0x11c @ 1
[    5.182346] initcall tty_init+0x0/0x11c returned 0 after 26367 usecs
[    5.183113] calling  pty_init+0x0/0x39 @ 1
[    5.405330] initcall pty_init+0x0/0x39 returned 0 after 215820 usecs
[    5.406190] calling  sysrq_init+0x0/0x4c @ 1
[    5.407038] initcall sysrq_init+0x0/0x4c returned 0 after 0 usecs
[    5.408011] calling  rp_init+0x0/0x34f @ 1
[    5.409010] RocketPort device driver module, version 2.09, 12-June-2003
[    5.410137] No rocketport ports found; unloading driver
[    5.411093] initcall rp_init+0x0/0x34f returned -6 after 1953 usecs
[    5.412011] initcall rp_init+0x0/0x34f returned with error code -6 
[    5.413010] calling  cy_init+0x0/0x148 @ 1
[    5.414061] Cyclades driver 2.5 (built Aug  4 2009 11:29:45)
[    5.415345] initcall cy_init+0x0/0x148 returned 0 after 976 usecs
[    5.416096] calling  stallion_module_init+0x0/0x33d @ 1
[    5.417010] Stallion Multiport Serial Driver: version 5.6.0
[    5.421216] initcall stallion_module_init+0x0/0x33d returned 0 after 3906 usecs
[    5.422160] calling  nozomi_init+0x0/0x153 @ 1
[    5.423010] Initializing Nozomi driver 2.1d (build date: Aug  4 2009 11:29:47)
[    5.425098] initcall nozomi_init+0x0/0x153 returned 0 after 1953 usecs
[    5.426011] calling  specialix_init_module+0x0/0xc4 @ 1
[    5.427010] sx: Specialix IO8+ driver v1.11, (c) R.E.Wolff 1997/1998.
[    5.428009] sx: derived from work (c) D.Gorodchanin 1994-1996.
[    5.429057] sx: DTR/RTS pin is always RTS.
[    5.461314] sx0: specialix IO8+ Board at 0x100 not found.
[    5.462088] sx1: specialix IO8+ Board at 0x180 not found.
[    5.463021] sx2: specialix IO8+ Board at 0x250 not found.
[    5.464021] sx3: specialix IO8+ Board at 0x260 not found.
[    5.530119] sx: No specialix IO8+ boards detected.
[    5.531016] initcall specialix_init_module+0x0/0xc4 returned -5 after 101562 usecs
[    5.532011] initcall specialix_init_module+0x0/0xc4 returned with error code -5 
[    5.533011] calling  moxa_init+0x0/0x14c @ 1
[    5.534058] MOXA Intellio family driver version 6.0k
[    5.601360] initcall moxa_init+0x0/0x14c returned 0 after 65429 usecs
[    5.602018] calling  mxser_module_init+0x0/0x230 @ 1
[    5.603013] MOXA Smartio/Industio family driver version 2.0.4
[    5.604143] initcall mxser_module_init+0x0/0x230 returned 0 after 976 usecs
[    5.605014] calling  ip2_loadmain+0x0/0xa04 @ 1
[    5.607012] Computone IntelliPort Plus multiport driver version 1.2.14
[    5.608158] initcall ip2_loadmain+0x0/0xa04 returned 0 after 976 usecs
[    5.609070] calling  riscom8_init_module+0x0/0xb0 @ 1
[    5.610009] rc: SDL RISCom/8 card driver v1.1, (c) D.Gorodchanin 1994-1996.
[    5.628222] rc0: RISCom/8 Board at 0x220 not found.
[    5.629231] rc1: RISCom/8 Board at 0x240 not found.
[    5.630075] rc2: RISCom/8 Board at 0x250 not found.
[    5.631075] rc3: RISCom/8 Board at 0x260 not found.
[    5.666224] rc: No RISCom/8 boards detected.
[    5.667079] initcall riscom8_init_module+0x0/0xb0 returned -5 after 55664 usecs
[    5.668011] initcall riscom8_init_module+0x0/0xb0 returned with error code -5 
[    5.669012] calling  synclinkmp_init+0x0/0x1b7 @ 1
[    5.670010] SyncLink MultiPort driver $Revision: 4.38 $
[    5.742188] SyncLink MultiPort driver $Revision: 4.38 $, tty major#250
[    5.744035] initcall synclinkmp_init+0x0/0x1b7 returned 0 after 72265 usecs
[    5.745012] calling  slgt_init+0x0/0x1e6 @ 1
[    5.746010] SyncLink GT
[    5.747088] SyncLink GT, tty major#249
[    5.748175] SyncLink GT no devices found
[    5.750035] initcall slgt_init+0x0/0x1e6 returned 0 after 3906 usecs
[    5.751011] calling  sx_init+0x0/0x10e @ 1
[    5.753216] initcall sx_init+0x0/0x10e returned 0 after 976 usecs
[    5.754068] calling  xen_init+0x0/0xbb @ 1
[    5.755011] initcall xen_init+0x0/0xbb returned -19 after 0 usecs
[    5.756011] calling  r3964_init+0x0/0x68 @ 1
[    5.757010] r3964: Philips r3964 Driver $Revision: 1.10 $
[    5.758062] initcall r3964_init+0x0/0x68 returned 0 after 976 usecs
[    5.759012] calling  nvram_init+0x0/0xaa @ 1
[    5.760173] Non-volatile memory driver v1.3
[    5.761067] initcall nvram_init+0x0/0xaa returned 0 after 976 usecs
[    5.762011] calling  i8k_init+0x0/0x78 @ 1
[    5.763015] initcall i8k_init+0x0/0x78 returned -19 after 0 usecs
[    5.764011] calling  mod_init+0x0/0x231 @ 1
[    5.766208] initcall mod_init+0x0/0x231 returned -19 after 976 usecs
[    5.767011] calling  mod_init+0x0/0x73 @ 1
[    5.768011] initcall mod_init+0x0/0x73 returned -19 after 0 usecs
[    5.769060] calling  mwave_init+0x0/0x2ca @ 1
[    5.770019] smapi::smapi_init, ERROR invalid usSmapiID
[    5.771010] mwave: tp3780i::tp3780I_InitializeBoardData: Error: SMAPI is not available on this machine
[    5.772010] mwave: mwavedd::mwave_init: Error: Failed to initialize board data
[    5.773058] mwave: mwavedd::mwave_init: Error: Failed to initialize
[    5.774012] initcall mwave_init+0x0/0x2ca returned -5 after 3906 usecs
[    5.775012] initcall mwave_init+0x0/0x2ca returned with error code -5 
[    5.776012] calling  agp_init+0x0/0x4b @ 1
[    5.777058] Linux agpgart interface v0.103
[    5.778012] initcall agp_init+0x0/0x4b returned 0 after 976 usecs
[    5.779011] calling  agp_amd64_init+0x0/0xe8 @ 1
[    5.780401] initcall agp_amd64_init+0x0/0xe8 returned -19 after 0 usecs
[    5.781110] calling  agp_intel_init+0x0/0x50 @ 1
[    5.782144] initcall agp_intel_init+0x0/0x50 returned 0 after 0 usecs
[    5.783018] calling  agp_sis_init+0x0/0x50 @ 1
[    5.784127] initcall agp_sis_init+0x0/0x50 returned 0 after 0 usecs
[    5.785014] calling  ipmi_init_msghandler_mod+0x0/0x34 @ 1
[    5.787120] ipmi message handler version 39.2
[    5.788036] initcall ipmi_init_msghandler_mod+0x0/0x34 returned 0 after 1953 usecs
[    5.789013] calling  init_ipmi_si+0x0/0x286 @ 1
[    5.790113] IPMI System Interface driver.
[    5.796337] ipmi_si: Unable to find any System Interface(s)
[    5.797064] initcall init_ipmi_si+0x0/0x286 returned -19 after 6835 usecs
[    5.798012] calling  ipmi_wdog_init+0x0/0x153 @ 1
[    5.800012] IPMI Watchdog: driver initialized
[    5.801059] initcall ipmi_wdog_init+0x0/0x153 returned 0 after 1953 usecs
[    5.802012] calling  ipmi_poweroff_init+0x0/0xb7 @ 1
[    5.803010] Copyright (C) 2004 MontaVista Software - IPMI Powerdown via sys_reboot.
[    5.804024] initcall ipmi_poweroff_init+0x0/0xb7 returned 0 after 976 usecs
[    5.805060] calling  init_atmel+0x0/0x1af @ 1
[    5.806010] Platform driver 'tpm_atmel' needs updating - please use dev_pm_ops
[    5.808210] initcall init_atmel+0x0/0x1af returned -19 after 1953 usecs
[    5.809092] calling  drm_core_init+0x0/0x145 @ 1
[    5.810302] [drm] Initialized drm 1.1.0 20060810
[    5.811077] initcall drm_core_init+0x0/0x145 returned 0 after 976 usecs
[    5.812011] calling  tdfx_init+0x0/0x39 @ 1
[    5.813142] initcall tdfx_init+0x0/0x39 returned 0 after 0 usecs
[    5.814011] calling  radeon_init+0x0/0x50 @ 1
[    5.818478] IOAPIC[0]: Set routing entry (2-5 -> 0x35 -> IRQ 5 Mode:1 Active:1)
[    5.819068] pci 0000:01:00.0: PCI->APIC IRQ transform: INT A -> IRQ 5
[    5.820016] pci 0000:01:00.0: setting latency timer to 64
[    5.822404] [drm] Initialized radeon 1.30.0 20080528 for 0000:01:00.0 on minor 0
[    5.828678] initcall radeon_init+0x0/0x50 returned 0 after 12695 usecs
[    5.829012] calling  mga_init+0x0/0x45 @ 1
[    5.830099] initcall mga_init+0x0/0x45 returned 0 after 0 usecs
[    5.831060] calling  i810_init+0x0/0x45 @ 1
[    5.832098] initcall i810_init+0x0/0x45 returned 0 after 0 usecs
[    5.833012] calling  savage_init+0x0/0x45 @ 1
[    5.834504] initcall savage_init+0x0/0x45 returned 0 after 0 usecs
[    5.835060] calling  via_init+0x0/0x4a @ 1
[    5.837093] initcall via_init+0x0/0x4a returned 0 after 976 usecs
[    5.838012] calling  cn_proc_init+0x0/0x63 @ 1
[    5.839068] initcall cn_proc_init+0x0/0x63 returned 0 after 0 usecs
[    5.840012] calling  intelfb_init+0x0/0x9f @ 1
[    5.841010] intelfb: intelfb_init
[    5.842010] intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/945GME/965G/965GM chipsets
[    5.843058] intelfb: Version 0.9.6
[    5.844010] intelfb: intelfb_setup
[    5.845009] intelfb: no options
[    5.846173] initcall intelfb_init+0x0/0x9f returned 0 after 4882 usecs
[    5.847111] calling  serial8250_init+0x0/0x16f @ 1
[    5.848011] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    5.850196] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    5.854100] Platform driver 'serial8250' needs updating - please use dev_pm_ops
[    5.855230] initcall serial8250_init+0x0/0x16f returned 0 after 6835 usecs
[    5.856206] calling  serial8250_pci_init+0x0/0x42 @ 1
[    5.858094] initcall serial8250_pci_init+0x0/0x42 returned 0 after 976 usecs
[    5.859068] calling  max3100_init+0x0/0x39 @ 1
[    5.861211] initcall max3100_init+0x0/0x39 returned 0 after 976 usecs
[    5.862060] calling  init_kgdboc+0x0/0x3b @ 1
[    5.863012] initcall init_kgdboc+0x0/0x3b returned 0 after 0 usecs
[    5.864012] calling  parport_default_proc_register+0x0/0x42 @ 1
[    5.865021] initcall parport_default_proc_register+0x0/0x42 returned 0 after 0 usecs
[    5.867013] calling  parport_pc_init+0x0/0xd2 @ 1
[    5.870368] parport0: PC-style at 0x378 (0x778)async_waiting @ 1
[    5.873028] async_continuing @ 1 after 0 usec
[    6.012150]  [PCSPP(,...)]
[    6.014823] parport0: irq 7 detected
[    6.016380] initcall parport_pc_init+0x0/0xd2 returned 0 after 144531 usecs
[    6.018014] calling  parport_serial_init+0x0/0x42 @ 1
[    6.019159] initcall parport_serial_init+0x0/0x42 returned 0 after 0 usecs
[    6.020137] calling  parport_ax88796_init+0x0/0x39 @ 1
[    6.021109] initcall parport_ax88796_init+0x0/0x39 returned 0 after 0 usecs
[    6.022088] calling  topology_sysfs_init+0x0/0x82 @ 1
[    6.023095] initcall topology_sysfs_init+0x0/0x82 returned 0 after 0 usecs
[    6.024012] calling  floppy_init+0x0/0x5bf @ 1
[    6.025162] Platform driver 'floppy' needs updating - please use dev_pm_ops
[    6.027316] Floppy drive(s): fd0 is 1.44M
[    6.043015] FDC 0 is a post-1991 82077
[    6.047235] initcall floppy_init+0x0/0x5bf returned 0 after 21484 usecs
[    6.049014] calling  brd_init+0x0/0x193 @ 1
[    6.067335] brd: module loaded
[    6.068135] initcall brd_init+0x0/0x193 returned 0 after 17578 usecs
[    6.069012] calling  loop_init+0x0/0x1bc @ 1
[    6.079203] loop: module loaded
[    6.080169] initcall loop_init+0x0/0x1bc returned 0 after 9765 usecs
[    6.081012] calling  cpqarray_init+0x0/0x92 @ 1
[    6.082010] Compaq SMART2 Driver (v 2.6.0)
[    6.084205] initcall cpqarray_init+0x0/0x92 returned -19 after 1953 usecs
[    6.085110] calling  DAC960_init_module+0x0/0x78 @ 1
[    6.087163] initcall DAC960_init_module+0x0/0x78 returned 0 after 976 usecs
[    6.088075] calling  init_cryptoloop+0x0/0x55 @ 1
[    6.089013] initcall init_cryptoloop+0x0/0x55 returned 0 after 0 usecs
[    6.090012] calling  carm_init+0x0/0x42 @ 1
[    6.091131] initcall carm_init+0x0/0x42 returned 0 after 0 usecs
[    6.092065] calling  ibmasm_init+0x0/0x8a @ 1
[    6.093230] ibmasm: IBM ASM Service Processor Driver version 1.0 loaded
[    6.094015] initcall ibmasm_init+0x0/0x8a returned 0 after 976 usecs
[    6.095012] calling  ics932s401_init+0x0/0x3b @ 1
[    6.096275] i2c-core: driver [ics932s401] registered
[    6.097054] initcall ics932s401_init+0x0/0x3b returned 0 after 976 usecs
[    6.098012] calling  tifm_7xx1_init+0x0/0x42 @ 1
[    6.099129] initcall tifm_7xx1_init+0x0/0x42 returned 0 after 0 usecs
[    6.100015] calling  phantom_init+0x0/0x12f @ 1
[    6.102236] Phantom Linux Driver, version n0.9.8, init OK
[    6.103064] initcall phantom_init+0x0/0x12f returned 0 after 1953 usecs
[    6.104013] calling  ioc4_init+0x0/0x47 @ 1
[    6.105309] initcall ioc4_init+0x0/0x47 returned 0 after 0 usecs
[    6.106074] calling  ilo_init+0x0/0xb8 @ 1
[    6.107161] initcall ilo_init+0x0/0xb8 returned 0 after 0 usecs
[    6.108099] calling  isl29003_init+0x0/0x3b @ 1
[    6.109134] i2c-core: driver [isl29003] registered
[    6.110083] initcall isl29003_init+0x0/0x3b returned 0 after 976 usecs
[    6.111012] calling  c2port_init+0x0/0x77 @ 1
[    6.112010] Silicon Labs C2 port support v. 0.51.0 - (C) 2007 Rodolfo Giometti
[    6.113087] initcall c2port_init+0x0/0x77 returned 0 after 976 usecs
[    6.114142] calling  duramar2150_c2port_init+0x0/0x97 @ 1
[    6.116174] c2port c2port0: C2 port uc added
[    6.117065] c2port c2port0: uc flash has 30 blocks x 512 bytes (15360 bytes total)
[    6.118013] initcall duramar2150_c2port_init+0x0/0x97 returned 0 after 2929 usecs
[    6.119012] calling  at24_init+0x0/0x5d @ 1
[    6.120126] i2c-core: driver [at24] registered
[    6.121116] initcall at24_init+0x0/0x5d returned 0 after 976 usecs
[    6.122012] calling  at25_init+0x0/0x39 @ 1
[    6.123140] initcall at25_init+0x0/0x39 returned 0 after 0 usecs
[    6.124018] calling  eeprom_init+0x0/0x3b @ 1
[    6.125095] i2c-core: driver [eeprom] registered
[    6.126025] initcall eeprom_init+0x0/0x3b returned 0 after 976 usecs
[    6.127012] calling  max6875_init+0x0/0x3b @ 1
[    6.129198] i2c-core: driver [max6875] registered
[    6.130021] initcall max6875_init+0x0/0x3b returned 0 after 1953 usecs
[    6.131012] calling  cb710_init_module+0x0/0x42 @ 1
[    6.132151] initcall cb710_init_module+0x0/0x42 returned 0 after 0 usecs
[    6.133069] calling  pasic3_base_init+0x0/0x40 @ 1
[    6.134256] initcall pasic3_base_init+0x0/0x40 returned -19 after 0 usecs
[    6.135015] calling  ezx_pcap_init+0x0/0x39 @ 1
[    6.136096] initcall ezx_pcap_init+0x0/0x39 returned 0 after 0 usecs
[    6.137015] calling  pcf50633_adc_init+0x0/0x39 @ 1
[    6.139031] initcall pcf50633_adc_init+0x0/0x39 returned 0 after 976 usecs
[    6.140014] calling  mac_hid_init+0x0/0xfd @ 1
[    6.142074] input: Macintosh mouse button emulation as /class/input/input0
[    6.143032] initcall mac_hid_init+0x0/0xfd returned 0 after 1953 usecs
[    6.144011] calling  scsi_tgt_init+0x0/0xb1 @ 1
[    6.146464] initcall scsi_tgt_init+0x0/0xb1 returned 0 after 976 usecs
[    6.147071] calling  spi_transport_init+0x0/0x9f @ 1
[    6.149169] initcall spi_transport_init+0x0/0x9f returned 0 after 976 usecs
[    6.150143] calling  fc_transport_init+0x0/0x73 @ 1
[    6.152183] initcall fc_transport_init+0x0/0x73 returned 0 after 976 usecs
[    6.153104] calling  iscsi_transport_init+0x0/0x173 @ 1
[    6.154010] Loading iSCSI transport class v2.0-870.
[    6.157378] initcall iscsi_transport_init+0x0/0x173 returned 0 after 2929 usecs
[    6.158161] calling  sas_transport_init+0x0/0xe1 @ 1
[    6.161320] initcall sas_transport_init+0x0/0xe1 returned 0 after 1953 usecs
[    6.163017] calling  sas_class_init+0x0/0x58 @ 1
[    6.165074] initcall sas_class_init+0x0/0x58 returned 0 after 976 usecs
[    6.167174] calling  srp_transport_init+0x0/0x65 @ 1
[    6.168165] initcall srp_transport_init+0x0/0x65 returned 0 after 0 usecs
[    6.169078] calling  scsi_dh_init+0x0/0x65 @ 1
[    6.170014] initcall scsi_dh_init+0x0/0x65 returned 0 after 0 usecs
[    6.171011] calling  rdac_init+0x0/0x55 @ 1
[    6.172060] rdac: device handler registered
[    6.173060] initcall rdac_init+0x0/0x55 returned 0 after 976 usecs
[    6.174011] calling  libfc_init+0x0/0x96 @ 1
[    6.176492] initcall libfc_init+0x0/0x96 returned 0 after 976 usecs
[    6.177097] calling  fcoe_init+0x0/0x1ab @ 1
[    6.179229] initcall fcoe_init+0x0/0x1ab returned 0 after 976 usecs
[    6.186083] calling  advansys_init+0x0/0x42 @ 1
[    6.191095] initcall advansys_init+0x0/0x42 returned 0 after 976 usecs
[    6.197071] calling  BusLogic_init+0x0/0x5b2 @ 1
[    6.202179] initcall BusLogic_init+0x0/0x5b2 returned 0 after 0 usecs
[    6.208011] calling  adpt_init+0x0/0xb1 @ 1
[    6.213010] Loading Adaptec I2O RAID: Version 2.4 Build 5go
[    6.218010] Detecting Adaptec I2O RAID controllers...
[    6.223035] initcall adpt_init+0x0/0xb1 returned -19 after 9765 usecs
[    6.230014] calling  arcmsr_module_init+0x0/0x47 @ 1
[    6.235592] initcall arcmsr_module_init+0x0/0x47 returned 0 after 0 usecs
[    6.242012] calling  ahc_linux_init+0x0/0x8d @ 1
[    6.247414] initcall ahc_linux_init+0x0/0x8d returned 0 after 0 usecs
[    6.253012] calling  ahd_linux_init+0x0/0xa7 @ 1
[    6.258894] initcall ahd_linux_init+0x0/0xa7 returned 0 after 0 usecs
[    6.265012] calling  aac_init+0x0/0x95 @ 1
[    6.269011] Adaptec aacraid driver 1.1-5[2461]-ms
[    6.274556] initcall aac_init+0x0/0x95 returned 0 after 4882 usecs
[    6.280012] calling  aic94xx_init+0x0/0x160 @ 1
[    6.285011] aic94xx: Adaptec aic94xx SAS/SATA driver version 1.0.3 loaded
[    6.293394] initcall aic94xx_init+0x0/0x160 returned 0 after 7812 usecs
[    6.300016] calling  ips_module_init+0x0/0x8e @ 1
[    6.305495] initcall ips_module_init+0x0/0x8e returned -19 after 0 usecs
[    6.312013] calling  init_this_scsi_driver+0x0/0x10c @ 1
[    6.317095] scsi: <fdomain> Detection failed (no card)
[    6.323013] initcall init_this_scsi_driver+0x0/0x10c returned -19 after 5859 usecs
[    6.330012] calling  qla1280_init+0x0/0x42 @ 1
[    6.335468] initcall qla1280_init+0x0/0x42 returned 0 after 0 usecs
[    6.341013] calling  qla2x00_module_init+0x0/0x152 @ 1
[    6.347537] QLogic Fibre Channel HBA Driver: 8.03.01-k4
[    6.353200] initcall qla2x00_module_init+0x0/0x152 returned 0 after 6835 usecs
[    6.360013] calling  qla4xxx_module_init+0x0/0x108 @ 1
[    6.366306] iscsi: registered transport (qla4xxx)
[    6.371738] QLogic iSCSI HBA Driver
[    6.375014] initcall qla4xxx_module_init+0x0/0x108 returned 0 after 9765 usecs
[    6.382012] calling  lpfc_init+0x0/0xfb @ 1
[    6.386010] Emulex LightPulse Fibre Channel SCSI driver 8.3.3
[    6.392010] Copyright(c) 2004-2009 Emulex.  All rights reserved.
[    6.398828] initcall lpfc_init+0x0/0xfb returned 0 after 11718 usecs
[    6.405013] calling  init_this_scsi_driver+0x0/0x10c @ 1
[    6.410038] initcall init_this_scsi_driver+0x0/0x10c returned -19 after 0 usecs
[    6.417012] calling  dc395x_module_init+0x0/0x42 @ 1
[    6.423208] initcall dc395x_module_init+0x0/0x42 returned 0 after 976 usecs
[    6.430013] calling  dc390_module_init+0x0/0xbf @ 1
[    6.435011] DC390: clustering now enabled by default. If you get problems load
[    6.442010]        with "disable_clustering=1" and report to maintainers
[    6.449390] initcall dc390_module_init+0x0/0xbf returned 0 after 13671 usecs
[    6.456013] calling  megasas_init+0x0/0x180 @ 1
[    6.461011] megasas: 00.00.04.01 Thu July 24 11:41:51 PST 2008
[    6.467216] initcall megasas_init+0x0/0x180 returned 0 after 5859 usecs
[    6.473013] calling  _scsih_init+0x0/0x117 @ 1
[    6.478011] mpt2sas version 01.100.03.00 loaded
[    6.483435] initcall _scsih_init+0x0/0x117 returned 0 after 4882 usecs
[    6.490013] calling  initio_init_driver+0x0/0x42 @ 1
[    6.495652] initcall initio_init_driver+0x0/0x42 returned 0 after 0 usecs
[    6.502012] calling  tw_init+0x0/0x55 @ 1
[    6.506011] 3ware Storage Controller device driver for Linux v1.26.02.002.
[    6.513740] initcall tw_init+0x0/0x55 returned 0 after 6835 usecs
[    6.519013] calling  twa_init+0x0/0x55 @ 1
[    6.523011] 3ware 9000 Storage Controller device driver for Linux v2.26.02.012.
[    6.531639] initcall twa_init+0x0/0x55 returned 0 after 7812 usecs
[    6.537013] calling  ppa_driver_init+0x0/0x4c @ 1
[    6.542011] ppa: Version 2.07 (for Linux 2.4.x)
[    6.549093] initcall ppa_driver_init+0x0/0x4c returned 0 after 6835 usecs
[    6.556015] calling  imm_driver_init+0x0/0x4c @ 1
[    6.561011] imm: Version 2.05 (for Linux 2.4.0)
[    6.565486] initcall imm_driver_init+0x0/0x4c returned 0 after 4882 usecs
[    6.572012] calling  ipr_init+0x0/0x5c @ 1
[    6.577011] ipr: IBM Power RAID SCSI Device Driver version: 2.4.3 (June 10, 2009)
[    6.584872] initcall ipr_init+0x0/0x5c returned 0 after 6835 usecs
[    6.591013] calling  mvs_init+0x0/0x79 @ 1
[    6.595636] initcall mvs_init+0x0/0x79 returned 0 after 0 usecs
[    6.601013] calling  cxgb3i_init_module+0x0/0x5d @ 1
[    6.606012] cxgb3i: tag itt 0x1fff, 13 bits, age 0xf, 4 bits.
[    6.612665] iscsi: registered transport (cxgb3i)
[    6.617054] initcall cxgb3i_init_module+0x0/0x5d returned 0 after 10742 usecs
[    6.624013] calling  init_st+0x0/0x129 @ 1
[    6.628012] st: Version 20081215, fixed bufsize 32768, s/g segs 256
[    6.635271] initcall init_st+0x0/0x129 returned 0 after 6835 usecs
[    6.641013] calling  init_osst+0x0/0x160 @ 1
[    6.646011] osst :I: Tape driver with OnStream support version 0.99.4
[    6.646014] osst :I: $Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $
[    6.659544] initcall init_osst+0x0/0x160 returned 0 after 12695 usecs
[    6.666013] calling  init_sd+0x0/0x125 @ 1
[    6.671104] initcall init_sd+0x0/0x125 returned 0 after 976 usecs
[    6.677013] calling  osd_uld_init+0x0/0xfe @ 1
[    6.682387] osd: LOADED open-osd 0.1.0
[    6.686014] initcall osd_uld_init+0x0/0xfe returned 0 after 4882 usecs
[    6.692066] calling  ahci_init+0x0/0x42 @ 1
[    6.697411] initcall ahci_init+0x0/0x42 returned 0 after 0 usecs
[    6.703076] calling  piix_init+0x0/0x50 @ 1
[    6.708112] initcall piix_init+0x0/0x50 returned 0 after 976 usecs
[    6.714017] calling  pdc_ata_init+0x0/0x42 @ 1
[    6.719137] initcall pdc_ata_init+0x0/0x42 returned 0 after 976 usecs
[    6.725013] calling  sil_init+0x0/0x42 @ 1
[    6.730077] initcall sil_init+0x0/0x42 returned 0 after 976 usecs
[    6.736013] calling  vsc_sata_init+0x0/0x42 @ 1
[    6.741126] initcall vsc_sata_init+0x0/0x42 returned 0 after 976 usecs
[    6.747013] calling  sis_init+0x0/0x42 @ 1
[    6.752154] initcall sis_init+0x0/0x42 returned 0 after 976 usecs
[    6.758013] calling  pdc_sata_init+0x0/0x42 @ 1
[    6.763181] initcall pdc_sata_init+0x0/0x42 returned 0 after 976 usecs
[    6.769013] calling  nv_init+0x0/0x42 @ 1
[    6.774132] initcall nv_init+0x0/0x42 returned 0 after 976 usecs
[    6.780013] calling  uli_init+0x0/0x42 @ 1
[    6.784636] initcall uli_init+0x0/0x42 returned 0 after 0 usecs
[    6.790013] calling  mv_init+0x0/0x6e @ 1
[    6.794969] initcall mv_init+0x0/0x6e returned 0 after 976 usecs
[    6.801067] calling  adma_ata_init+0x0/0x42 @ 1
[    6.806356] initcall adma_ata_init+0x0/0x42 returned 0 after 0 usecs
[    6.812073] calling  amd_init+0x0/0x42 @ 1
[    6.817185] pata_amd 0000:00:06.0: version 0.4.1
[    6.819026] pata_amd 0000:00:06.0: setting latency timer to 64
[    6.821171] scsi0 : pata_amd
[    6.824443] scsi1 : pata_amd
[    6.825335] ata1: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xf000 irq 14
[    6.826077] ata2: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xf008 irq 15
[    6.987045] ata1.00: ATA-6: HDS722525VLAT80, V36OA60A, max UDMA/100
[    6.993014] ata1.00: 488397168 sectors, multi 1: LBA48 
[    6.998036] ata1: nv_mode_filter: 0x3f39f&0x3f07f->0x3f01f, BIOS=0x3f000 (0xc60000c0) ACPI=0x0
[    7.017255] ata1.00: configured for UDMA/100
[    7.022321] async_waiting @ 2169
[    7.023013] async_continuing @ 2169 after 0 usec
[    7.025018] scsi 0:0:0:0: Direct-Access     ATA      HDS722525VLAT80  V36O PQ: 0 ANSI: 5
[    7.028045] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[    7.029355] sd 0:0:0:0: [sda] Write Protect is off
[    7.030015] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    7.031182] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.034265]  sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 >
[    7.138539] sd 0:0:0:0: [sda] Attached SCSI disk
[    7.140606] async_waiting @ 2169
[    7.141070] async_continuing @ 2169 after 0 usec
[    7.295315] ata2.01: ATAPI: DVDRW IDE 16X, VER A079, max UDMA/66
[    7.296035] ata2: nv_mode_filter: 0x1f39f&0x707f->0x701f, BIOS=0x7000 (0xc60000c0) ACPI=0x0
[    7.303226] ata2.01: configured for UDMA/33
[    7.305193] async_waiting @ 2169
[    7.306013] async_continuing @ 2169 after 0 usec
[    7.307255] scsi 1:0:1:0: CD-ROM            DVDRW    IDE 16X          A079 PQ: 0 ANSI: 5
[    7.310217] work_for_cpu used greatest stack depth: 2448 bytes left
[    7.310296] initcall amd_init+0x0/0x42 returned 0 after 482422 usecs
[    7.310302] calling  artop_init+0x0/0x42 @ 1
[    7.310660] initcall artop_init+0x0/0x42 returned 0 after 0 usecs
[    7.310664] calling  atiixp_init+0x0/0x42 @ 1
[    7.311001] initcall atiixp_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  cmd640_init+0x0/0x42 @ 1
[    7.311005] initcall cmd640_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  cmd64x_init+0x0/0x42 @ 1
[    7.311005] initcall cmd64x_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  cs5520_init+0x0/0x42 @ 1
[    7.311005] initcall cs5520_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  cy82c693_init+0x0/0x42 @ 1
[    7.311005] initcall cy82c693_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  efar_init+0x0/0x42 @ 1
[    7.311005] initcall efar_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  hpt36x_init+0x0/0x42 @ 1
[    7.311005] initcall hpt36x_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  it821x_init+0x0/0x42 @ 1
[    7.311005] initcall it821x_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  netcell_init+0x0/0x42 @ 1
[    7.311005] initcall netcell_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  ninja32_init+0x0/0x42 @ 1
[    7.311005] initcall ninja32_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  opti_init+0x0/0x42 @ 1
[    7.311005] initcall opti_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  marvell_init+0x0/0x42 @ 1
[    7.311005] initcall marvell_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  mpiix_init+0x0/0x42 @ 1
[    7.311005] initcall mpiix_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  oldpiix_init+0x0/0x42 @ 1
[    7.311005] initcall oldpiix_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  radisys_init+0x0/0x42 @ 1
[    7.311005] initcall radisys_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  rz1000_init+0x0/0x42 @ 1
[    7.311005] initcall rz1000_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  serverworks_init+0x0/0x42 @ 1
[    7.311005] initcall serverworks_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  sis_init+0x0/0x42 @ 1
[    7.311005] initcall sis_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  triflex_init+0x0/0x42 @ 1
[    7.311005] initcall triflex_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  ata_generic_init+0x0/0x42 @ 1
[    7.311005] initcall ata_generic_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  e1000_init_module+0x0/0xab @ 1
[    7.311005] Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
[    7.311005] Copyright (c) 1999-2006 Intel Corporation.
[    7.311005] initcall e1000_init_module+0x0/0xab returned 0 after 0 usecs
[    7.311005] calling  e1000_init_module+0x0/0x8f @ 1
[    7.311005] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
[    7.311005] e1000e: Copyright (c) 1999-2008 Intel Corporation.
[    7.311005] initcall e1000_init_module+0x0/0x8f returned 0 after 0 usecs
[    7.311005] calling  igb_init_module+0x0/0x7b @ 1
[    7.311005] Intel(R) Gigabit Ethernet Network Driver - version 1.3.16-k2
[    7.311005] Copyright (c) 2007-2009 Intel Corporation.
[    7.311005] initcall igb_init_module+0x0/0x7b returned 0 after 0 usecs
[    7.311005] calling  ixgbe_init_module+0x0/0x7f @ 1
[    7.311005] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 2.0.34-k2
[    7.311005] ixgbe: Copyright (c) 1999-2009 Intel Corporation.
[    7.311005] initcall ixgbe_init_module+0x0/0x7f returned 0 after 0 usecs
[    7.311005] calling  ixgb_init_module+0x0/0x71 @ 1
[    7.311005] Intel(R) PRO/10GbE Network Driver - version 1.0.135-k2-NAPI
[    7.311005] Copyright (c) 1999-2008 Intel Corporation.
[    7.311005] initcall ixgb_init_module+0x0/0x71 returned 0 after 0 usecs
[    7.311005] calling  cxgb3_init_module+0x0/0x47 @ 1
[    7.311005] initcall cxgb3_init_module+0x0/0x47 returned 0 after 0 usecs
[    7.311005] calling  atl1_init_module+0x0/0x42 @ 1
[    7.311005] initcall atl1_init_module+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  atl2_init_module+0x0/0x71 @ 1
[    7.311005] Atheros(R) L2 Ethernet Driver - version 2.2.3
[    7.311005] Copyright (c) 2007 Atheros Corporation.
[    7.311005] initcall atl2_init_module+0x0/0x71 returned 0 after 0 usecs
[    7.311005] calling  atl1e_init_module+0x0/0x42 @ 1
[    7.311005] initcall atl1e_init_module+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  atl1c_init_module+0x0/0x42 @ 1
[    7.311005] initcall atl1c_init_module+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  bdx_module_init+0x0/0xb0 @ 1
[    7.311005] tehuti: Tehuti Networks(R) Network Driver, 7.29.3
[    7.311005] tehuti: Options: hw_csum 
[    7.311005] initcall bdx_module_init+0x0/0xb0 returned 0 after 0 usecs
[    7.311005] calling  enic_init_module+0x0/0x5c @ 1
[    7.311005] enic: Cisco 10G Ethernet Driver, ver 1.0.0.933
[    7.311005] initcall enic_init_module+0x0/0x5c returned 0 after 0 usecs
[    7.311005] calling  jme_init_module+0x0/0x55 @ 1
[    7.311005] jme: JMicron JMC2XX ethernet driver version 1.0.4
[    7.311005] initcall jme_init_module+0x0/0x55 returned 0 after 0 usecs
[    7.311005] calling  be_init_module+0x0/0x9d @ 1
[    7.311005] initcall be_init_module+0x0/0x9d returned 0 after 0 usecs
[    7.311005] calling  plip_init+0x0/0x84 @ 1
[    7.311005] plip: parport0 has no IRQ. Using IRQ-less mode,which is fairly inefficient!
[    7.311005] NET3 PLIP version 2.4-parport gniibe@mri.co.jp
[    7.311005] plip0: Parallel port at 0x378, not using IRQ.
[    7.311005] initcall plip_init+0x0/0x84 returned 0 after 0 usecs
[    7.311005] calling  rr_init_module+0x0/0x42 @ 1
[    7.311005] initcall rr_init_module+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  happy_meal_probe+0x0/0x42 @ 1
[    7.311005] initcall happy_meal_probe+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  gem_init+0x0/0x42 @ 1
[    7.311005] initcall gem_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  cas_init+0x0/0x64 @ 1
[    7.311005] initcall cas_init+0x0/0x64 returned 0 after 0 usecs
[    7.311005] calling  vortex_init+0x0/0xd8 @ 1
[    7.311005] initcall vortex_init+0x0/0xd8 returned 0 after 0 usecs
[    7.311005] calling  ne2k_pci_init+0x0/0x42 @ 1
[    7.311005] initcall ne2k_pci_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  pcnet32_init_module+0x0/0x154 @ 1
[    7.311005] pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de
[    7.311005] initcall pcnet32_init_module+0x0/0x154 returned 0 after 0 usecs
[    7.311005] calling  e100_init_module+0x0/0x81 @ 1
[    7.311005] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    7.311005] e100: Copyright(c) 1999-2006 Intel Corporation
[    7.311005] initcall e100_init_module+0x0/0x81 returned 0 after 0 usecs
[    7.311005] calling  tlan_probe+0x0/0x108 @ 1
[    7.311005] ThunderLAN driver v1.15a
[    7.311005] TLAN: 0 devices installed, PCI: 0  EISA: 0
[    7.311005] initcall tlan_probe+0x0/0x108 returned -19 after 0 usecs
[    7.311005] calling  r6040_init+0x0/0x42 @ 1
[    7.311005] initcall r6040_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  acenic_init+0x0/0x42 @ 1
[    7.311005] initcall acenic_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  natsemi_init_mod+0x0/0x42 @ 1
[    7.311005] initcall natsemi_init_mod+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  fealnx_init+0x0/0x42 @ 1
[    7.311005] initcall fealnx_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  tg3_init+0x0/0x42 @ 1
[    7.311005] initcall tg3_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  ks8842_init+0x0/0x39 @ 1
[    7.311005] initcall ks8842_init+0x0/0x39 returned 0 after 0 usecs
[    7.311005] calling  ks8851_init+0x0/0x39 @ 1
[    7.311005] initcall ks8851_init+0x0/0x39 returned 0 after 0 usecs
[    7.311005] calling  velocity_init_module+0x0/0x42 @ 1
[    7.311005] initcall velocity_init_module+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  starfire_init+0x0/0x42 @ 1
[    7.311005] initcall starfire_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  davicom_init+0x0/0x83 @ 1
[    7.311005] initcall davicom_init+0x0/0x83 returned 0 after 0 usecs
[    7.311005] calling  cicada_init+0x0/0x65 @ 1
[    7.311005] initcall cicada_init+0x0/0x65 returned 0 after 0 usecs
[    7.311005] calling  vsc82xx_init+0x0/0x65 @ 1
[    7.311005] initcall vsc82xx_init+0x0/0x65 returned 0 after 0 usecs
[    7.311005] calling  broadcom_init+0x0/0x125 @ 1
[    7.311005] initcall broadcom_init+0x0/0x125 returned 0 after 0 usecs
[    7.311005] calling  ip175c_init+0x0/0x39 @ 1
[    7.311005] initcall ip175c_init+0x0/0x39 returned 0 after 0 usecs
[    7.311005] calling  realtek_init+0x0/0x39 @ 1
[    7.311005] initcall realtek_init+0x0/0x39 returned 0 after 0 usecs
[    7.311005] calling  et1011c_init+0x0/0x39 @ 1
[    7.311005] initcall et1011c_init+0x0/0x39 returned 0 after 0 usecs
[    7.311005] calling  fixed_mdio_bus_init+0x0/0xf6 @ 1
[    7.311005] Fixed MDIO Bus: probed
[    7.311005] initcall fixed_mdio_bus_init+0x0/0xf6 returned 0 after 0 usecs
[    7.311005] calling  hamachi_init+0x0/0x42 @ 1
[    7.311005] initcall hamachi_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  net_olddevs_init+0x0/0x45 @ 1
[    7.311005] D-Link DE-620 pocket adapter io 0x378, which is busy.
[    7.311005] initcall net_olddevs_init+0x0/0x45 returned 0 after 0 usecs
[    7.311005] calling  hp100_module_init+0x0/0x42 @ 1
[    7.311005] initcall hp100_module_init+0x0/0x42 returned 0 after 0 usecs
[    7.311005] calling  b44_init+0x0/0x89 @ 1
[    7.311005] initcall b44_init+0x0/0x89 returned 0 after 0 usecs
[    7.311005] calling  init_nic+0x0/0x42 @ 1
[    7.312567] forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
[    7.314071] IOAPIC[0]: Set routing entry (2-11 -> 0x3b -> IRQ 11 Mode:1 Active:1)
[    7.315021] forcedeth 0000:00:0a.0: PCI->APIC IRQ transform: INT A -> IRQ 11
[    7.316017] forcedeth 0000:00:0a.0: setting latency timer to 64
[    7.317128] nv_probe: set workaround bit for reversed mac addr
[    7.831213] forcedeth 0000:00:0a.0: ifname eth0, PHY OUI 0x5043 @ 1, addr 00:13:d4:dc:41:12
[    7.832015] forcedeth 0000:00:0a.0: highdma csum gbit lnktim desc-v3
[    7.833014] initcall init_nic+0x0/0x42 returned 0 after 511719 usecs
[    7.840071] calling  ql3xxx_init_module+0x0/0x42 @ 1
[    7.846199] initcall ql3xxx_init_module+0x0/0x42 returned 0 after 976 usecs
[    7.853073] calling  ppp_init+0x0/0x104 @ 1
[    7.857067] PPP generic driver version 2.4.2
[    7.862343] initcall ppp_init+0x0/0x104 returned 0 after 4882 usecs
[    7.869016] calling  ppp_async_init+0x0/0x5c @ 1
[    7.873016] initcall ppp_async_init+0x0/0x5c returned 0 after 0 usecs
[    7.880014] calling  ppp_sync_init+0x0/0x5c @ 1
[    7.884015] initcall ppp_sync_init+0x0/0x5c returned 0 after 0 usecs
[    7.891014] calling  pppox_init+0x0/0x39 @ 1
[    7.895014] NET: Registered protocol family 24
[    7.899017] initcall pppox_init+0x0/0x39 returned 0 after 3906 usecs
[    7.906014] calling  pppoe_init+0x0/0xaf @ 1
[    7.910051] initcall pppoe_init+0x0/0xaf returned 0 after 0 usecs
[    7.916014] calling  pppol2tp_init+0x0/0xa8 @ 1
[    7.921047] PPPoL2TP kernel driver, V1.0
[    7.925015] initcall pppol2tp_init+0x0/0xa8 returned 0 after 3906 usecs
[    7.931014] calling  slip_init+0x0/0xe6 @ 1
[    7.935013] SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256) (6 bit encapsulation enabled).
[    7.945012] CSLIP: code copyright 1989 Regents of the University of California.
[    7.952012] SLIP linefill/keepalive option.
[    7.957024] initcall slip_init+0x0/0xe6 returned 0 after 21484 usecs
[    7.963014] calling  dummy_init_module+0x0/0xd8 @ 1
[    7.969159] initcall dummy_init_module+0x0/0xd8 returned 0 after 976 usecs
[    7.976015] calling  macvlan_init_module+0x0/0x79 @ 1
[    7.981017] initcall macvlan_init_module+0x0/0x79 returned 0 after 0 usecs
[    7.988013] calling  de600_init+0x0/0x48 @ 1
[    7.992034] DE600: port 0x378 busy
[    7.995078] initcall de600_init+0x0/0x48 returned -16 after 2929 usecs
[    8.002019] initcall de600_init+0x0/0x48 returned with error code -16 
[    8.008014] calling  dfx_init+0x0/0x47 @ 1
[    8.013399] initcall dfx_init+0x0/0x47 returned 0 after 0 usecs
[    8.019015] calling  cp_init+0x0/0x42 @ 1
[    8.023572] <6>8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
[    8.024014] 8139cp 0000:05:07.0: This (id 10ec:8139 rev 10) is not an 8139C+ compatible chip, use 8139too
[    8.025013] initcall cp_init+0x0/0x42 returned 0 after 1953 usecs
[    8.032072] calling  rtl8139_init_module+0x0/0x42 @ 1
[    8.037502] 8139too Fast Ethernet driver 0.9.28
[    8.038056] 8139too 0000:05:07.0: PCI->APIC IRQ transform: INT A -> IRQ 11
[    8.040671] eth1: RealTek RTL8139 at 0xc000, 00:c0:df:03:68:5d, IRQ 11
[    8.041427] initcall rtl8139_init_module+0x0/0x42 returned 0 after 3906 usecs
[    8.049073] calling  atp_init_module+0x0/0xbf @ 1
[    8.053134] atp.c:v1.09=ac 2002/10/01 Donald Becker <becker@scyld.com>
[    8.060101] initcall atp_init_module+0x0/0xbf returned -19 after 6835 usecs
[    8.067079] calling  sc92031_init+0x0/0x42 @ 1
[    8.072497] initcall sc92031_init+0x0/0x42 returned 0 after 0 usecs
[    8.078073] calling  eql_init_module+0x0/0x89 @ 1
[    8.083016] Equalizer2002: Simon Janes (simon@ncm.com) and David S. Miller (davem@redhat.com)
[    8.092665] initcall eql_init_module+0x0/0x89 returned 0 after 8789 usecs
[    8.099015] calling  tun_init+0x0/0xb7 @ 1
[    8.103013] tun: Universal TUN/TAP device driver, 1.6
[    8.108012] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    8.115429] initcall tun_init+0x0/0xb7 returned 0 after 11718 usecs
[    8.121016] calling  veth_init+0x0/0x39 @ 1
[    8.125016] initcall veth_init+0x0/0x39 returned 0 after 0 usecs
[    8.131014] calling  rio_init+0x0/0x42 @ 1
[    8.136422] initcall rio_init+0x0/0x42 returned 0 after 0 usecs
[    8.142015] calling  rtl8169_init_module+0x0/0x42 @ 1
[    8.147805] initcall rtl8169_init_module+0x0/0x42 returned 0 after 0 usecs
[    8.154015] calling  amd8111e_init+0x0/0x42 @ 1
[    8.159616] initcall amd8111e_init+0x0/0x42 returned 0 after 0 usecs
[    8.166015] calling  myri10ge_init_module+0x0/0x99 @ 1
[    8.171013] myri10ge: Version 1.5.0-1.418
[    8.175540] initcall myri10ge_init_module+0x0/0x99 returned 0 after 3906 usecs
[    8.182014] calling  mlx4_init+0x0/0xcb @ 1
[    8.187263] initcall mlx4_init+0x0/0xcb returned 0 after 0 usecs
[    8.193015] calling  mlx4_en_init+0x0/0x39 @ 1
[    8.198071] initcall mlx4_en_init+0x0/0x39 returned 0 after 0 usecs
[    8.204014] calling  enc28j60_init+0x0/0x4a @ 1
[    8.209200] initcall enc28j60_init+0x0/0x4a returned 0 after 976 usecs
[    8.215015] calling  ethoc_init+0x0/0x39 @ 1
[    8.220377] initcall ethoc_init+0x0/0x39 returned 0 after 0 usecs
[    8.226015] calling  dnet_init+0x0/0x39 @ 1
[    8.231079] initcall dnet_init+0x0/0x39 returned 0 after 976 usecs
[    8.237015] calling  ipddp_init_module+0x0/0x48 @ 1
[    8.242027] ipddp.c:v0.01 8/28/97 Bradford W. Johnson <johns393@maroon.tc.umn.edu>
[    8.250318] ipddp0: Appletalk-IP Encap. mode by Bradford W. Johnson <johns393@maroon.tc.umn.edu>
[    8.259016] initcall ipddp_init_module+0x0/0x48 returned 0 after 16601 usecs
[    8.266014] calling  olympic_pci_init+0x0/0x42 @ 1
[    8.271460] initcall olympic_pci_init+0x0/0x42 returned 0 after 0 usecs
[    8.278015] calling  xl_pci_init+0x0/0x42 @ 1
[    8.282840] initcall xl_pci_init+0x0/0x42 returned 0 after 0 usecs
[    8.289017] calling  arcnet_init+0x0/0x84 @ 1
[    8.293012] arcnet loaded.
[    8.296015] initcall arcnet_init+0x0/0x84 returned 0 after 2929 usecs
[    8.302014] calling  arcnet_rfc1201_init+0x0/0x98 @ 1
[    8.307012] arcnet: RFC1201 "standard" (`a') encapsulation support loaded.
[    8.314014] initcall arcnet_rfc1201_init+0x0/0x98 returned 0 after 6835 usecs
[    8.321014] calling  arcnet_rfc1051_init+0x0/0x6c @ 1
[    8.326012] arcnet: RFC1051 "simple standard" (`s') encapsulation support loaded.
[    8.334014] initcall arcnet_rfc1051_init+0x0/0x6c returned 0 after 7812 usecs
[    8.341014] calling  arcnet_raw_init+0x0/0x80 @ 1
[    8.346012] arcnet: raw mode (`r') encapsulation support loaded.
[    8.352015] initcall arcnet_raw_init+0x0/0x80 returned 0 after 5859 usecs
[    8.358014] calling  com90io_init+0x0/0x91 @ 1
[    8.363057] arcnet: COM90xx IO-mapped mode support (by David Woodhouse et el.)
[    8.370012] E-mail me if you actually test this driver, please!
[    8.376014]  arc%d: No autoprobe for IO mapped cards; you must specify the base address!
[    8.384097] initcall com90io_init+0x0/0x91 returned -19 after 20507 usecs
[    8.391019] calling  com20020pci_init+0x0/0x57 @ 1
[    8.396012] arcnet: COM20020 PCI support
[    8.400605] initcall com20020pci_init+0x0/0x57 returned 0 after 3906 usecs
[    8.407015] calling  catc_init+0x0/0x5e @ 1
[    8.412124] usbcore: registered new interface driver catc
[    8.417024] catc: v2.8:CATC EL1210A NetMate USB Ethernet driver
[    8.423015] initcall catc_init+0x0/0x5e returned 0 after 11718 usecs
[    8.429014] calling  kaweth_init+0x0/0x42 @ 1
[    8.434550] usbcore: registered new interface driver kaweth
[    8.440026] initcall kaweth_init+0x0/0x42 returned 0 after 5859 usecs
[    8.446014] calling  usb_rtl8150_init+0x0/0x4e @ 1
[    8.451012] rtl8150: v0.6.2 (2004/08/27):rtl8150 based usb-ethernet driver
[    8.458595] usbcore: registered new interface driver rtl8150
[    8.464021] initcall usb_rtl8150_init+0x0/0x4e returned 0 after 12695 usecs
[    8.471014] calling  asix_init+0x0/0x42 @ 1
[    8.475757] usbcore: registered new interface driver asix
[    8.481022] initcall asix_init+0x0/0x42 returned 0 after 5859 usecs
[    8.487014] calling  cdc_init+0x0/0x42 @ 1
[    8.491903] usbcore: registered new interface driver cdc_ether
[    8.497022] initcall cdc_init+0x0/0x42 returned 0 after 5859 usecs
[    8.503014] calling  eem_init+0x0/0x42 @ 1
[    8.508387] usbcore: registered new interface driver cdc_eem
[    8.514021] initcall eem_init+0x0/0x42 returned 0 after 5859 usecs
[    8.520014] calling  dm9601_init+0x0/0x42 @ 1
[    8.524950] usbcore: registered new interface driver dm9601
[    8.530022] initcall dm9601_init+0x0/0x42 returned 0 after 5859 usecs
[    8.537014] calling  smsc95xx_init+0x0/0x42 @ 1
[    8.541863] usbcore: registered new interface driver smsc95xx
[    8.547023] initcall smsc95xx_init+0x0/0x42 returned 0 after 5859 usecs
[    8.554014] calling  usbnet_init+0x0/0x42 @ 1
[    8.558948] usbcore: registered new interface driver gl620a
[    8.564022] initcall usbnet_init+0x0/0x42 returned 0 after 5859 usecs
[    8.571014] calling  plusb_init+0x0/0x42 @ 1
[    8.575602] usbcore: registered new interface driver plusb
[    8.581033] initcall plusb_init+0x0/0x42 returned 0 after 5859 usecs
[    8.587014] calling  rndis_init+0x0/0x42 @ 1
[    8.592080] usbcore: registered new interface driver rndis_host
[    8.598022] initcall rndis_init+0x0/0x42 returned 0 after 6835 usecs
[    8.604014] calling  zaurus_init+0x0/0x42 @ 1
[    8.609080] usbcore: registered new interface driver zaurus
[    8.614022] initcall zaurus_init+0x0/0x42 returned 0 after 5859 usecs
[    8.621014] calling  usbnet_init+0x0/0x52 @ 1
[    8.625024] initcall usbnet_init+0x0/0x52 returned 0 after 0 usecs
[    8.631014] calling  usbpn_init+0x0/0x42 @ 1
[    8.636331] usbcore: registered new interface driver cdc_phonet
[    8.642022] initcall usbpn_init+0x0/0x42 returned 0 after 5859 usecs
[    8.648014] calling  ipw_init+0x0/0xad @ 1
[    8.652012] ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.2.2kdq
[    8.659012] ipw2200: Copyright(c) 2003-2006 Intel Corporation
[    8.666001] initcall ipw_init+0x0/0xad returned 0 after 13671 usecs
[    8.672016] calling  ieee80211_init+0x0/0xda @ 1
[    8.676044] ieee80211: 802.11 data/management/control stack, git-1.1.13
[    8.683013] ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>
[    8.691014] initcall ieee80211_init+0x0/0xda returned 0 after 14648 usecs
[    8.698014] calling  strip_init_driver+0x0/0x8e @ 1
[    8.703024] STRIP: Version 1.3A-STUART.CHESHIRE (unlimited channels)
[    8.710041] initcall strip_init_driver+0x0/0x8e returned 0 after 6835 usecs
[    8.717015] calling  init_orinoco+0x0/0x42 @ 1
[    8.721013] orinoco 0.15 (David Gibson <hermes@gibson.dropbear.id.au>, Pavel Roskin <proski@gnu.org>, et al)
[    8.731015] initcall init_orinoco+0x0/0x42 returned 0 after 9765 usecs
[    8.737014] calling  orinoco_plx_init+0x0/0x55 @ 1
[    8.742013] orinoco_plx 0.15 (Pavel Roskin <proski@gnu.org>, David Gibson <hermes@gibson.dropbear.id.au>, Daniel Barlow <dan@telent.net>)
[    8.755327] initcall orinoco_plx_init+0x0/0x55 returned 0 after 12695 usecs
[    8.762016] calling  orinoco_pci_init+0x0/0x55 @ 1
[    8.767013] orinoco_pci 0.15 (Pavel Roskin <proski@gnu.org>, David Gibson <hermes@gibson.dropbear.id.au> & Jean Tourrilhes <jt@hpl.hp.com>)
[    8.780062] initcall orinoco_pci_init+0x0/0x55 returned 0 after 12695 usecs
[    8.787015] calling  orinoco_tmd_init+0x0/0x55 @ 1
[    8.791013] orinoco_tmd 0.15 (Joerg Dorchain <joerg@dorchain.net>)
[    8.798396] initcall orinoco_tmd_init+0x0/0x55 returned 0 after 6835 usecs
[    8.805017] calling  airo_init_module+0x0/0x110 @ 1
[    8.810034] airo(): Probing for PCI adapters
[    8.814854] airo(): Finished probing for PCI adapters
[    8.819016] initcall airo_init_module+0x0/0x110 returned 0 after 8789 usecs
[    8.826015] calling  atmel_init_module+0x0/0x42 @ 1
[    8.832150] initcall atmel_init_module+0x0/0x42 returned 0 after 976 usecs
[    8.839016] calling  at76_mod_init+0x0/0x99 @ 1
[    8.843013] Atmel at76x USB Wireless LAN Driver 0.17 loading
[    8.849590] usbcore: registered new interface driver at76c50x-usb
[    8.855163] initcall at76_mod_init+0x0/0x99 returned 0 after 11718 usecs
[    8.862015] calling  prism54_module_init+0x0/0x5c @ 1
[    8.867013] Loaded prism54 driver, version 1.2
[    8.872456] initcall prism54_module_init+0x0/0x5c returned 0 after 4882 usecs
[    8.879015] calling  hostap_init+0x0/0x6c @ 1
[    8.884032] initcall hostap_init+0x0/0x6c returned 0 after 0 usecs
[    8.890015] calling  b43_init+0x0/0x7b @ 1
[    8.894685] Broadcom 43xx driver loaded [ Features: PL, Firmware-ID: FW13 ]
[    8.901016] initcall b43_init+0x0/0x7b returned 0 after 6835 usecs
[    8.907014] calling  b43legacy_init+0x0/0x82 @ 1
[    8.912829] Broadcom 43xx-legacy driver loaded [ Features: PLD, Firmware-ID: FW10 ]
[    8.920016] initcall b43legacy_init+0x0/0x82 returned 0 after 7812 usecs
[    8.927015] calling  rtl8180_init+0x0/0x42 @ 1
[    8.932104] initcall rtl8180_init+0x0/0x42 returned 0 after 976 usecs
[    8.938016] calling  rtl8187_init+0x0/0x42 @ 1
[    8.943368] usbcore: registered new interface driver rtl8187
[    8.949022] initcall rtl8187_init+0x0/0x42 returned 0 after 5859 usecs
[    8.955015] calling  rndis_wlan_init+0x0/0x42 @ 1
[    8.960632] usbcore: registered new interface driver rndis_wlan
[    8.966022] initcall rndis_wlan_init+0x0/0x42 returned 0 after 5859 usecs
[    8.973015] calling  zd1201_init+0x0/0x42 @ 1
[    8.978078] usbcore: registered new interface driver zd1201
[    8.983022] initcall zd1201_init+0x0/0x42 returned 0 after 5859 usecs
[    8.990015] calling  lbs_init_module+0x0/0x5d @ 1
[    8.994032] initcall lbs_init_module+0x0/0x5d returned 0 after 0 usecs
[    9.001015] calling  if_usb_init_module+0x0/0x42 @ 1
[    9.006709] usbcore: registered new interface driver usb8xxx
[    9.012022] initcall if_usb_init_module+0x0/0x42 returned 0 after 5859 usecs
[    9.019015] calling  if_spi_init_module+0x0/0x45 @ 1
[    9.024013] libertas_spi: Libertas SPI driver
[    9.029127] initcall if_spi_init_module+0x0/0x45 returned 0 after 4882 usecs
[    9.036016] calling  lbtf_init_module+0x0/0x6c @ 1
[    9.041166] initcall lbtf_init_module+0x0/0x6c returned 0 after 0 usecs
[    9.047017] calling  if_usb_init_module+0x0/0x42 @ 1
[    9.053212] usbcore: registered new interface driver lbtf_usb
[    9.058023] initcall if_usb_init_module+0x0/0x42 returned 0 after 6835 usecs
[    9.066017] calling  mwl8k_init+0x0/0x42 @ 1
[    9.070697] initcall mwl8k_init+0x0/0x42 returned 0 after 0 usecs
[    9.076015] calling  init_ath5k_pci+0x0/0x5e @ 1
[    9.081821] initcall init_ath5k_pci+0x0/0x5e returned 0 after 0 usecs
[    9.088016] calling  ath9k_init+0x0/0x95 @ 1
[    9.092953] initcall ath9k_init+0x0/0x95 returned 0 after 0 usecs
[    9.099015] calling  ar9170_init+0x0/0x42 @ 1
[    9.103773] usbcore: registered new interface driver ar9170usb
[    9.109022] initcall ar9170_init+0x0/0x42 returned 0 after 5859 usecs
[    9.116015] calling  init_mac80211_hwsim+0x0/0x535 @ 1
[    9.121570] mac80211_hwsim: Initializing radio 0
[    9.129267] phy0: Selected rate control algorithm 'minstrel'
[    9.136405] phy0: hwaddr 02:00:00:00:00:00 registered
[    9.141127] mac80211_hwsim: Initializing radio 1
[    9.148297] phy1: Selected rate control algorithm 'minstrel'
[    9.155186] phy1: hwaddr 02:00:00:00:01:00 registered
[    9.160936] initcall init_mac80211_hwsim+0x0/0x535 returned 0 after 39062 usecs
[    9.168017] calling  wl12xx_init+0x0/0x57 @ 1
[    9.173080] initcall wl12xx_init+0x0/0x57 returned 0 after 976 usecs
[    9.179016] calling  usb_irda_init+0x0/0x65 @ 1
[    9.184348] usbcore: registered new interface driver irda-usb
[    9.190022] USB IrDA support registered
[    9.193016] initcall usb_irda_init+0x0/0x65 returned 0 after 8789 usecs
[    9.200015] calling  stir_init+0x0/0x42 @ 1
[    9.205122] usbcore: registered new interface driver stir4200
[    9.210022] initcall stir_init+0x0/0x42 returned 0 after 5859 usecs
[    9.217015] calling  nsc_ircc_init+0x0/0x1fd @ 1
[    9.221014] Platform driver 'nsc-ircc' needs updating - please use dev_pm_ops
[    9.229322] initcall nsc_ircc_init+0x0/0x1fd returned -19 after 7812 usecs
[    9.236017] calling  w83977af_init+0x0/0x74 @ 1
[    9.241072] initcall w83977af_init+0x0/0x74 returned -19 after 0 usecs
[    9.247015] calling  smsc_ircc_init+0x0/0x87 @ 1
[    9.252013] Platform driver 'smsc-ircc2' needs updating - please use dev_pm_ops
[    9.260484] initcall smsc_ircc_init+0x0/0x87 returned -19 after 7812 usecs
[    9.267015] calling  ali_ircc_init+0x0/0x196 @ 1
[    9.272013] Platform driver 'ali-ircc' needs updating - please use dev_pm_ops
[    9.279555] initcall ali_ircc_init+0x0/0x196 returned -19 after 6835 usecs
[    9.286015] calling  vlsi_mod_init+0x0/0x151 @ 1
[    9.291809] initcall vlsi_mod_init+0x0/0x151 returned 0 after 0 usecs
[    9.298015] calling  irtty_sir_init+0x0/0x65 @ 1
[    9.302016] initcall irtty_sir_init+0x0/0x65 returned 0 after 0 usecs
[    9.309014] calling  sir_wq_init+0x0/0x5c @ 1
[    9.313865] initcall sir_wq_init+0x0/0x5c returned 0 after 0 usecs
[    9.320016] calling  tekram_sir_init+0x0/0x52 @ 1
[    9.324082] initcall tekram_sir_init+0x0/0x52 returned 0 after 0 usecs
[    9.331015] calling  actisys_sir_init+0x0/0x69 @ 1
[    9.336018] initcall actisys_sir_init+0x0/0x69 returned 0 after 0 usecs
[    9.342015] calling  litelink_sir_init+0x0/0x39 @ 1
[    9.347017] initcall litelink_sir_init+0x0/0x39 returned 0 after 0 usecs
[    9.354015] calling  mcp2120_sir_init+0x0/0x39 @ 1
[    9.359017] initcall mcp2120_sir_init+0x0/0x39 returned 0 after 0 usecs
[    9.365015] calling  ma600_sir_init+0x0/0x39 @ 1
[    9.370017] initcall ma600_sir_init+0x0/0x39 returned 0 after 0 usecs
[    9.376015] calling  toim3232_sir_init+0x0/0x52 @ 1
[    9.381017] initcall toim3232_sir_init+0x0/0x52 returned 0 after 0 usecs
[    9.388015] calling  ksdazzle_init+0x0/0x42 @ 1
[    9.393357] usbcore: registered new interface driver ksdazzle-sir
[    9.399022] initcall ksdazzle_init+0x0/0x42 returned 0 after 5859 usecs
[    9.406015] calling  init_netconsole+0x0/0x184 @ 1
[    9.410065] console [netcon0] enabled
[    9.414014] netconsole: network logging started
[    9.419015] initcall init_netconsole+0x0/0x184 returned 0 after 8789 usecs
[    9.426014] calling  niu_init+0x0/0x64 @ 1
[    9.430518] initcall niu_init+0x0/0x64 returned 0 after 0 usecs
[    9.436015] calling  efx_init_module+0x0/0xfd @ 1
[    9.441014] Solarflare NET driver v2.3
[    9.448066] initcall efx_init_module+0x0/0xfd returned 0 after 6835 usecs
[    9.454016] calling  fusion_init+0x0/0x164 @ 1
[    9.459014] Fusion MPT base driver 3.04.10
[    9.463013] Copyright (c) 1999-2008 LSI Corporation
[    9.468060] initcall fusion_init+0x0/0x164 returned 0 after 8789 usecs
[    9.474015] calling  mptsas_init+0x0/0x130 @ 1
[    9.479014] Fusion MPT SAS Host driver 3.04.10
[    9.484203] initcall mptsas_init+0x0/0x130 returned 0 after 4882 usecs
[    9.490015] calling  mptctl_init+0x0/0x141 @ 1
[    9.495014] Fusion MPT misc device (ioctl) driver 3.04.10
[    9.501081] mptctl: Registered with Fusion MPT base driver
[    9.506016] mptctl: /dev/mptctl @ (major,minor=10,220)
[    9.511016] initcall mptctl_init+0x0/0x141 returned 0 after 15625 usecs
[    9.518015] calling  pcilynx_init+0x0/0x62 @ 1
[    9.523234] initcall pcilynx_init+0x0/0x62 returned 0 after 976 usecs
[    9.529015] calling  ohci1394_init+0x0/0x42 @ 1
[    9.534628] initcall ohci1394_init+0x0/0x42 returned 0 after 0 usecs
[    9.541016] calling  video1394_init_module+0x0/0xfc @ 1
[    9.546586] video1394: Installed video1394 module
[    9.551016] initcall video1394_init_module+0x0/0xfc returned 0 after 4882 usecs
[    9.558015] calling  init_raw1394+0x0/0x11a @ 1
[    9.563619] ieee1394: raw1394: /dev/raw1394 device initialized
[    9.569896] initcall init_raw1394+0x0/0x11a returned 0 after 5859 usecs
[    9.576016] calling  dv1394_init_module+0x0/0xc5 @ 1
[    9.581851] initcall dv1394_init_module+0x0/0xc5 returned 0 after 0 usecs
[    9.588015] calling  ether1394_init_module+0x0/0x96 @ 1
[    9.594640] initcall ether1394_init_module+0x0/0x96 returned 0 after 976 usecs
[    9.602016] calling  uio_init+0x0/0x2d @ 1
[    9.606015] initcall uio_init+0x0/0x2d returned 0 after 0 usecs
[    9.612015] calling  hilscher_init_module+0x0/0x42 @ 1
[    9.617722] initcall hilscher_init_module+0x0/0x42 returned 0 after 0 usecs
[    9.624016] calling  uio_pdrv_init+0x0/0x39 @ 1
[    9.629594] initcall uio_pdrv_init+0x0/0x39 returned 0 after 0 usecs
[    9.635016] calling  uio_pdrv_genirq_init+0x0/0x39 @ 1
[    9.641467] initcall uio_pdrv_genirq_init+0x0/0x39 returned 0 after 0 usecs
[    9.648016] calling  smx_ce_init_module+0x0/0x39 @ 1
[    9.653761] initcall smx_ce_init_module+0x0/0x39 returned 0 after 0 usecs
[    9.660015] calling  aectc_init+0x0/0x42 @ 1
[    9.665218] initcall aectc_init+0x0/0x42 returned 0 after 976 usecs
[    9.671017] calling  butterfly_init+0x0/0x39 @ 1
[    9.785078] parport0: AVR Butterfly
[    9.788019] initcall butterfly_init+0x0/0x39 returned 0 after 109375 usecs
[    9.795016] calling  init_spi_lm70llp+0x0/0x39 @ 1
[    9.800026] parport0: cannot grant exclusive access for device spi-lm70llp
[    9.807022] spi-lm70llp: spi_lm70llp probe fail, status -12
[    9.812016] initcall init_spi_lm70llp+0x0/0x39 returned 0 after 11718 usecs
[    9.819015] calling  spidev_init+0x0/0xbf @ 1
[    9.824508] initcall spidev_init+0x0/0xbf returned 0 after 0 usecs
[    9.830017] calling  tle62x0_init+0x0/0x39 @ 1
[    9.835769] initcall tle62x0_init+0x0/0x39 returned 0 after 0 usecs
[    9.842019] calling  nonstatic_sysfs_init+0x0/0x39 @ 1
[    9.847068] initcall nonstatic_sysfs_init+0x0/0x39 returned 0 after 0 usecs
[    9.854015] calling  yenta_socket_init+0x0/0x42 @ 1
[    9.859506] initcall yenta_socket_init+0x0/0x42 returned 0 after 0 usecs
[    9.866015] calling  uwb_subsys_init+0x0/0x77 @ 1
[    9.871298] initcall uwb_subsys_init+0x0/0x77 returned 0 after 976 usecs
[    9.878016] calling  hwarc_driver_init+0x0/0x42 @ 1
[    9.883271] usbcore: registered new interface driver hwa-rc
[    9.888023] initcall hwarc_driver_init+0x0/0x42 returned 0 after 5859 usecs
[    9.895015] calling  mon_init+0x0/0x141 @ 1
[    9.900403] initcall mon_init+0x0/0x141 returned 0 after 0 usecs
[    9.907019] calling  ehci_hcd_init+0x0/0x10e @ 1
[    9.911014] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    9.918015] ehci_hcd: block sizes: qh 192 qtd 96 itd 192 sitd 96
[    9.924432] ehci_hcd 0000:00:02.1: can't find IRQ for PCI INT B; probably buggy MP table
[    9.925016] ehci_hcd 0000:00:02.1: Found HC with no IRQ.  Check BIOS/PCI 0000:00:02.1 setup!
[    9.927021] ehci_hcd 0000:00:02.1: init 0000:00:02.1 fail, -19
[    9.929187] initcall ehci_hcd_init+0x0/0x10e returned 0 after 17578 usecs
[    9.936016] calling  oxu_module_init+0x0/0x39 @ 1
[    9.941078] initcall oxu_module_init+0x0/0x39 returned 0 after 976 usecs
[    9.947016] calling  isp116x_init+0x0/0x67 @ 1
[    9.952014] 116x: driver isp116x-hcd, 03 Nov 2005
[    9.957307] initcall isp116x_init+0x0/0x67 returned 0 after 4882 usecs
[    9.963016] calling  ohci_hcd_mod_init+0x0/0x101 @ 1
[    9.968014] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    9.975014] ohci_hcd: block sizes: ed 80 td 96
[    9.979643] ohci_hcd 0000:00:02.0: can't find IRQ for PCI INT A; probably buggy MP table
[    9.980015] ohci_hcd 0000:00:02.0: Found HC with no IRQ.  Check BIOS/PCI 0000:00:02.0 setup!
[    9.981018] ohci_hcd 0000:00:02.0: init 0000:00:02.0 fail, -19
[    9.982261] initcall ohci_hcd_mod_init+0x0/0x101 returned 0 after 13671 usecs
[    9.989071] calling  uhci_hcd_init+0x0/0x15a @ 1
[    9.994144] uhci_hcd: USB Universal Host Controller Interface driver
[   10.002157] initcall uhci_hcd_init+0x0/0x15a returned 0 after 7812 usecs
[   10.008086] calling  xhci_hcd_init+0x0/0x52 @ 1
[   10.013889] initcall xhci_hcd_init+0x0/0x52 returned 0 after 0 usecs
[   10.020074] calling  sl811h_init+0x0/0x67 @ 1
[   10.024018] sl811: driver sl811-hcd, 19 May 2005
[   10.029688] initcall sl811h_init+0x0/0x67 returned 0 after 4882 usecs
[   10.036016] calling  r8a66597_init+0x0/0x67 @ 1
[   10.040014] r8a66597_hcd: driver r8a66597_hcd, 2009-05-26
[   10.046431] initcall r8a66597_init+0x0/0x67 returned 0 after 5859 usecs
[   10.053016] calling  isp1760_init+0x0/0x76 @ 1
[   10.059304] initcall isp1760_init+0x0/0x76 returned 0 after 1953 usecs
[   10.066016] calling  wusbcore_init+0x0/0x9a @ 1
[   10.070766] initcall wusbcore_init+0x0/0x9a returned 0 after 0 usecs
[   10.077017] calling  cbaf_driver_init+0x0/0x42 @ 1
[   10.082252] usbcore: registered new interface driver wusb-cbaf
[   10.088023] initcall cbaf_driver_init+0x0/0x42 returned 0 after 6835 usecs
[   10.095015] calling  acm_init+0x0/0x128 @ 1
[   10.099534] usbcore: registered new interface driver cdc_acm
[   10.105020] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
[   10.113016] initcall acm_init+0x0/0x128 returned 0 after 13671 usecs
[   10.120015] calling  usblp_init+0x0/0x42 @ 1
[   10.124728] usbcore: registered new interface driver usblp
[   10.130034] initcall usblp_init+0x0/0x42 returned 0 after 5859 usecs
[   10.136015] calling  wdm_init+0x0/0x42 @ 1
[   10.141104] usbcore: registered new interface driver cdc_wdm
[   10.146022] initcall wdm_init+0x0/0x42 returned 0 after 5859 usecs
[   10.152016] calling  usb_usual_init+0x0/0x66 @ 1
[   10.158215] usbcore: registered new interface driver libusual
[   10.163026] initcall usb_usual_init+0x0/0x66 returned 0 after 6835 usecs
[   10.170016] calling  usb_mdc800_init+0x0/0x32e @ 1
[   10.175851] usbcore: registered new interface driver mdc800
[   10.181021] mdc800: v0.7.5 (30/10/2000):USB Driver for Mustek MDC800 Digital Camera
[   10.189016] initcall usb_mdc800_init+0x0/0x32e returned 0 after 13671 usecs
[   10.196015] calling  microtek_drv_init+0x0/0x42 @ 1
[   10.201292] usbcore: registered new interface driver microtekX6
[   10.207023] initcall microtek_drv_init+0x0/0x42 returned 0 after 6835 usecs
[   10.214016] calling  adu_init+0x0/0xba @ 1
[   10.218014] drivers/usb/misc/adutux.c :  adu_init : enter 
[   10.224136] usbcore: registered new interface driver adutux
[   10.229021] adutux adutux (see www.ontrak.net) v0.0.13
[   10.234014] adutux is an experimental driver. Use at your own risk
[   10.241014] drivers/usb/misc/adutux.c :  adu_init : leave, return value 0 
[   10.247016] initcall adu_init+0x0/0xba returned 0 after 28320 usecs
[   10.254015] calling  berry_init+0x0/0x42 @ 1
[   10.258839] usbcore: registered new interface driver berry_charge
[   10.264023] initcall berry_init+0x0/0x42 returned 0 after 5859 usecs
[   10.271016] calling  cypress_init+0x0/0x60 @ 1
[   10.276081] usbcore: registered new interface driver cypress_cy7c63
[   10.282023] initcall cypress_init+0x0/0x60 returned 0 after 6835 usecs
[   10.288015] calling  emi26_init+0x0/0x42 @ 1
[   10.293555] usbcore: registered new interface driver emi26 - firmware loader
[   10.300022] initcall emi26_init+0x0/0x42 returned 0 after 6835 usecs
[   10.307018] calling  usb_idmouse_init+0x0/0x6c @ 1
[   10.311014] idmouse: 0.6:Siemens ID Mouse FingerTIP Sensor Driver
[   10.318206] usbcore: registered new interface driver idmouse
[   10.323023] initcall usb_idmouse_init+0x0/0x6c returned 0 after 11718 usecs
[   10.330016] calling  iowarrior_init+0x0/0x42 @ 1
[   10.335826] usbcore: registered new interface driver iowarrior
[   10.341023] initcall iowarrior_init+0x0/0x42 returned 0 after 5859 usecs
[   10.348016] calling  ld_usb_init+0x0/0x60 @ 1
[   10.353081] usbcore: registered new interface driver ldusb
[   10.358025] initcall ld_usb_init+0x0/0x60 returned 0 after 5859 usecs
[   10.365016] calling  lego_usb_tower_init+0x0/0xaf @ 1
[   10.370014] drivers/usb/misc/legousbtower.c: lego_usb_tower_init: enter
[   10.377081] usbcore: registered new interface driver legousbtower
[   10.383021] legousbtower: v0.96:LEGO USB Tower Driver
[   10.388015] drivers/usb/misc/legousbtower.c: lego_usb_tower_init: leave, return value 0
[   10.396016] initcall lego_usb_tower_init+0x0/0xaf returned 0 after 25390 usecs
[   10.403015] calling  usb_rio_init+0x0/0x5e @ 1
[   10.408269] usbcore: registered new interface driver rio500
[   10.413021] rio500: v1.1:USB Rio 500 driver
[   10.418016] initcall usb_rio_init+0x0/0x5e returned 0 after 10742 usecs
[   10.424015] calling  usbtest_init+0x0/0x66 @ 1
[   10.429455] usbcore: registered new interface driver usbtest
[   10.435023] initcall usbtest_init+0x0/0x66 returned 0 after 5859 usecs
[   10.441016] calling  uss720_init+0x0/0x88 @ 1
[   10.446368] usbcore: registered new interface driver uss720
[   10.451021] uss720: v0.6:USB Parport Cable driver for Cables using the Lucent Technologies USS720 Chip
[   10.461014] uss720: NOTE: this is a special purpose driver to allow nonstandard
[   10.468014] uss720: protocols (eg. bitbang) over USS720 usb to parallel cables
[   10.475014] uss720: If you just want to connect to a printer, use usblp instead
[   10.483016] initcall uss720_init+0x0/0x88 returned 0 after 36132 usecs
[   10.489015] calling  usb_sisusb_init+0x0/0x47 @ 1
[   10.494727] usbcore: registered new interface driver sisusb
[   10.500023] initcall usb_sisusb_init+0x0/0x47 returned 0 after 5859 usecs
[   10.507016] calling  i8042_init+0x0/0x143 @ 1
[   10.514615] serio: i8042 KBD port at 0x60,0x64 irq 1
[   10.520062] serio: i8042 AUX port at 0x60,0x64 irq 12
[   10.525032] initcall i8042_init+0x0/0x143 returned 0 after 13671 usecs
[   10.531017] calling  serport_init+0x0/0x5a @ 1
[   10.536017] initcall serport_init+0x0/0x5a returned 0 after 0 usecs
[   10.542016] calling  pcips2_init+0x0/0x42 @ 1
[   10.547291] initcall pcips2_init+0x0/0x42 returned 0 after 976 usecs
[   10.553017] calling  serio_raw_init+0x0/0x42 @ 1
[   10.558671] initcall serio_raw_init+0x0/0x42 returned 0 after 0 usecs
[   10.565016] calling  emu_init+0x0/0x42 @ 1
[   10.569612] initcall emu_init+0x0/0x42 returned 0 after 0 usecs
[   10.575016] calling  ns558_init+0x0/0x60 @ 1
[   10.588423] initcall ns558_init+0x0/0x60 returned -19 after 8789 usecs
[   10.595016] calling  mousedev_init+0x0/0x87 @ 1
[   10.601211] mice: PS/2 mouse device common for all mice
[   10.606020] initcall mousedev_init+0x0/0x87 returned 0 after 5859 usecs
[   10.613016] calling  evdev_init+0x0/0x39 @ 1
[   10.617925] initcall evdev_init+0x0/0x39 returned 0 after 0 usecs
[   10.624017] calling  evbug_init+0x0/0x39 @ 1
[   10.628022] evbug.c: Connected device: input0 (Macintosh mouse button emulation at unknown)
[   10.636018] initcall evbug_init+0x0/0x39 returned 0 after 7812 usecs
[   10.643016] calling  atkbd_init+0x0/0x4e @ 1
[   10.647689] initcall atkbd_init+0x0/0x4e returned 0 after 0 usecs
[   10.653016] calling  lm8323_init+0x0/0x3b @ 1
[   10.658545] i2c-core: driver [lm8323] registered
[   10.663022] initcall lm8323_init+0x0/0x3b returned 0 after 4882 usecs
[   10.669016] calling  nkbd_init+0x0/0x42 @ 1
[   10.674174] input: AT Translated Set 2 keyboard as /class/input/input1
[   10.676296] initcall nkbd_init+0x0/0x42 returned 0 after 2929 usecs
[   10.682138] calling  skbd_init+0x0/0x42 @ 1
[   10.687419] evbug.c: Connected device: input1 (AT Translated Set 2 keyboard at isa0060/serio0/input0)
[   10.688277] initcall skbd_init+0x0/0x42 returned 0 after 1953 usecs
[   10.695081] calling  xtkbd_init+0x0/0x42 @ 1
[   10.700155] initcall xtkbd_init+0x0/0x42 returned 0 after 976 usecs
[   10.706088] calling  a3d_init+0x0/0x42 @ 1
[   10.711105] initcall a3d_init+0x0/0x42 returned 0 after 976 usecs
[   10.717076] calling  cobra_init+0x0/0x42 @ 1
[   10.721950] initcall cobra_init+0x0/0x42 returned 0 after 0 usecs
[   10.728021] calling  gc_init+0x0/0xe8 @ 1
[   10.732017] initcall gc_init+0x0/0xe8 returned -19 after 0 usecs
[   10.738016] calling  gf2k_init+0x0/0x42 @ 1
[   10.742638] initcall gf2k_init+0x0/0x42 returned 0 after 0 usecs
[   10.748017] calling  grip_init+0x0/0x42 @ 1
[   10.753212] initcall grip_init+0x0/0x42 returned 0 after 976 usecs
[   10.759017] calling  grip_init+0x0/0x42 @ 1
[   10.763964] initcall grip_init+0x0/0x42 returned 0 after 0 usecs
[   10.770018] calling  iforce_init+0x0/0x42 @ 1
[   10.774707] usbcore: registered new interface driver iforce
[   10.780023] initcall iforce_init+0x0/0x42 returned 0 after 5859 usecs
[   10.786016] calling  interact_init+0x0/0x42 @ 1
[   10.791638] initcall interact_init+0x0/0x42 returned 0 after 0 usecs
[   10.798017] calling  joydump_init+0x0/0x42 @ 1
[   10.802817] initcall joydump_init+0x0/0x42 returned 0 after 0 usecs
[   10.809017] calling  sw_init+0x0/0x42 @ 1
[   10.813478] initcall sw_init+0x0/0x42 returned 0 after 0 usecs
[   10.819017] calling  spaceball_init+0x0/0x42 @ 1
[   10.824329] initcall spaceball_init+0x0/0x42 returned 0 after 976 usecs
[   10.830017] calling  stinger_init+0x0/0x42 @ 1
[   10.835610] initcall stinger_init+0x0/0x42 returned 0 after 0 usecs
[   10.842066] calling  tmdc_init+0x0/0x42 @ 1
[   10.846661] initcall tmdc_init+0x0/0x42 returned 0 after 0 usecs
[   10.852077] calling  tgfx_init+0x0/0xe7 @ 1
[   10.857013] initcall tgfx_init+0x0/0xe7 returned -19 after 0 usecs
[   10.863066] calling  twidjoy_init+0x0/0x42 @ 1
[   10.868168] initcall twidjoy_init+0x0/0x42 returned 0 after 976 usecs
[   10.874019] calling  usb_xpad_init+0x0/0x5e @ 1
[   10.879507] usbcore: registered new interface driver xpad
[   10.884021] xpad: X-Box pad driver
[   10.888017] initcall usb_xpad_init+0x0/0x5e returned 0 after 8789 usecs
[   10.894016] calling  usb_acecad_init+0x0/0x5e @ 1
[   10.900068] usbcore: registered new interface driver usb_acecad
[   10.906021] acecad: v3.2:USB Acecad Flair tablet driver
[   10.911017] initcall usb_acecad_init+0x0/0x5e returned 0 after 11718 usecs
[   10.918016] calling  aiptek_init+0x0/0x6c @ 1
[   10.922833] usbcore: registered new interface driver aiptek
[   10.928021] aiptek: v2.3 (May 2, 2007):Aiptek HyperPen USB Tablet Driver (Linux 2.6.x)
[   10.936015] aiptek: Bryan W. Headley/Chris Atenasio/Cedric Brun/Rene van Paassen
[   10.943017] initcall aiptek_init+0x0/0x6c returned 0 after 20507 usecs
[   10.950016] calling  wacom_init+0x0/0x6a @ 1
[   10.954891] usbcore: registered new interface driver wacom
[   10.960021] wacom: v1.51:USB Wacom Graphire and Wacom Intuos tablet driver
[   10.967017] initcall wacom_init+0x0/0x6a returned 0 after 12695 usecs
[   10.973016] calling  ad7877_init+0x0/0x39 @ 1
[   10.978432] initcall ad7877_init+0x0/0x39 returned 0 after 0 usecs
[   10.984017] calling  ad7879_init+0x0/0x3b @ 1
[   10.989333] i2c-core: driver [ad7879] registered
[   10.993021] initcall ad7879_init+0x0/0x3b returned 0 after 3906 usecs
[   11.000016] calling  ads7846_init+0x0/0x39 @ 1
[   11.005197] initcall ads7846_init+0x0/0x39 returned 0 after 976 usecs
[   11.011066] calling  eeti_ts_init+0x0/0x3b @ 1
[   11.016548] i2c-core: driver [eeti_ts] registered
[   11.021079] initcall eeti_ts_init+0x0/0x3b returned 0 after 4882 usecs
[   11.027098] calling  inexio_init+0x0/0x42 @ 1
[   11.032684] initcall inexio_init+0x0/0x42 returned 0 after 0 usecs
[   11.038021] calling  mtouch_init+0x0/0x42 @ 1
[   11.043595] initcall mtouch_init+0x0/0x42 returned 0 after 0 usecs
[   11.049017] calling  usbtouch_init+0x0/0x42 @ 1
[   11.054683] usbcore: registered new interface driver usbtouchscreen
[   11.060023] initcall usbtouch_init+0x0/0x42 returned 0 after 5859 usecs
[   11.067016] calling  pm_init+0x0/0x42 @ 1
[   11.071971] initcall pm_init+0x0/0x42 returned 0 after 0 usecs
[   11.077017] calling  ati_remote_init+0x0/0x70 @ 1
[   11.082871] usbcore: registered new interface driver ati_remote
[   11.088021] ati_remote: 2.2.1:ATI/X10 RF USB Remote Control
[   11.094017] initcall ati_remote_init+0x0/0x70 returned 0 after 11718 usecs
[   11.101016] calling  ati_remote2_init+0x0/0x70 @ 1
[   11.106406] usbcore: registered new interface driver ati_remote2
[   11.112021] ati_remote2: ATI/Philips USB RF remote driver 0.3
[   11.118017] initcall ati_remote2_init+0x0/0x70 returned 0 after 11718 usecs
[   11.125016] calling  cm109_init+0x0/0x69 @ 1
[   11.129015] cm109: Keymap for Komunikate KIP1000 phone loaded
[   11.135514] usbcore: registered new interface driver cm109
[   11.141021] cm109: CM109 phone driver: 20080805 (C) Alfred E. Heggestad
[   11.147017] initcall cm109_init+0x0/0x69 returned 0 after 17578 usecs
[   11.154017] calling  usb_keyspan_init+0x0/0x60 @ 1
[   11.159184] usbcore: registered new interface driver keyspan_remote
[   11.165071] initcall usb_keyspan_init+0x0/0x60 returned 0 after 6835 usecs
[   11.172071] calling  pcf50633_input_init+0x0/0x39 @ 1
[   11.177954] initcall pcf50633_input_init+0x0/0x39 returned 0 after 0 usecs
[   11.184075] calling  pcspkr_init+0x0/0x39 @ 1
[   11.189872] input: PC Speaker as /class/input/input2
[   11.195427] evbug.c: Connected device: input2 (PC Speaker at isa0061/input0)
[   11.202856] initcall pcspkr_init+0x0/0x39 returned 0 after 12695 usecs
[   11.209018] calling  twl4030_pwrbutton_init+0x0/0x39 @ 1
[   11.215130] initcall twl4030_pwrbutton_init+0x0/0x39 returned 0 after 976 usecs
[   11.222018] calling  uinput_init+0x0/0x39 @ 1
[   11.227205] initcall uinput_init+0x0/0x39 returned 0 after 976 usecs
[   11.233067] calling  yealink_dev_init+0x0/0x5e @ 1
[   11.238853] usbcore: registered new interface driver yealink
[   11.244081] yealink: yld-20051230:Yealink phone driver
[   11.249105] initcall yealink_dev_init+0x0/0x5e returned 0 after 10742 usecs
[   11.256066] calling  xenkbd_init+0x0/0x6b @ 1
[   11.261020] initcall xenkbd_init+0x0/0x6b returned -19 after 0 usecs
[   11.267016] calling  cmos_init+0x0/0x55 @ 1
[   11.272477] rtc_cmos: dev (254:0)
[   11.275037] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[   11.282081] rtc0: alarms up to one day, 114 bytes nvram
[   11.287918] initcall cmos_init+0x0/0x55 returned 0 after 15625 usecs
[   11.294018] calling  ds1286_init+0x0/0x39 @ 1
[   11.299067] initcall ds1286_init+0x0/0x39 returned 0 after 976 usecs
[   11.305017] calling  ds1305_init+0x0/0x39 @ 1
[   11.310120] initcall ds1305_init+0x0/0x39 returned 0 after 976 usecs
[   11.316017] calling  ds1307_init+0x0/0x3b @ 1
[   11.321250] i2c-core: driver [rtc-ds1307] registered
[   11.326023] initcall ds1307_init+0x0/0x3b returned 0 after 5859 usecs
[   11.332017] calling  ds1390_init+0x0/0x39 @ 1
[   11.337379] initcall ds1390_init+0x0/0x39 returned 0 after 0 usecs
[   11.343018] calling  ds1511_rtc_init+0x0/0x39 @ 1
[   11.348645] initcall ds1511_rtc_init+0x0/0x39 returned 0 after 0 usecs
[   11.355017] calling  ds1553_init+0x0/0x39 @ 1
[   11.359901] initcall ds1553_init+0x0/0x39 returned 0 after 0 usecs
[   11.366017] calling  ds1672_init+0x0/0x3b @ 1
[   11.370801] i2c-core: driver [rtc-ds1672] registered
[   11.375021] initcall ds1672_init+0x0/0x3b returned 0 after 4882 usecs
[   11.382017] calling  ds1742_init+0x0/0x39 @ 1
[   11.386945] initcall ds1742_init+0x0/0x39 returned 0 after 0 usecs
[   11.393021] calling  ds3234_init+0x0/0x39 @ 1
[   11.397859] initcall ds3234_init+0x0/0x39 returned 0 after 0 usecs
[   11.404017] calling  isl1208_init+0x0/0x3b @ 1
[   11.408845] i2c-core: driver [rtc-isl1208] registered
[   11.413021] initcall isl1208_init+0x0/0x3b returned 0 after 4882 usecs
[   11.420017] calling  m41t80_rtc_init+0x0/0x3b @ 1
[   11.425492] i2c-core: driver [rtc-m41t80] registered
[   11.430021] initcall m41t80_rtc_init+0x0/0x3b returned 0 after 4882 usecs
[   11.437017] calling  m41t94_init+0x0/0x39 @ 1
[   11.441971] initcall m41t94_init+0x0/0x39 returned 0 after 0 usecs
[   11.448017] calling  m48t35_init+0x0/0x39 @ 1
[   11.452876] initcall m48t35_init+0x0/0x39 returned 0 after 0 usecs
[   11.459017] calling  m48t59_rtc_init+0x0/0x39 @ 1
[   11.464119] initcall m48t59_rtc_init+0x0/0x39 returned 0 after 976 usecs
[   11.470018] calling  max6900_init+0x0/0x3b @ 1
[   11.475658] i2c-core: driver [rtc-max6900] registered
[   11.480021] initcall max6900_init+0x0/0x3b returned 0 after 4882 usecs
[   11.487017] calling  max6902_init+0x0/0x39 @ 1
[   11.492122] initcall max6902_init+0x0/0x39 returned 0 after 976 usecs
[   11.498018] calling  pcf8563_init+0x0/0x3b @ 1
[   11.503380] i2c-core: driver [rtc-pcf8563] registered
[   11.508021] initcall pcf8563_init+0x0/0x3b returned 0 after 4882 usecs
[   11.514017] calling  pcf8583_init+0x0/0x3b @ 1
[   11.519619] i2c-core: driver [pcf8583] registered
[   11.524058] initcall pcf8583_init+0x0/0x3b returned 0 after 4882 usecs
[   11.531095] calling  rs5c348_init+0x0/0x39 @ 1
[   11.535973] initcall rs5c348_init+0x0/0x39 returned 0 after 0 usecs
[   11.542081] calling  rs5c372_init+0x0/0x3b @ 1
[   11.547119] i2c-core: driver [rtc-rs5c372] registered
[   11.552021] initcall rs5c372_init+0x0/0x3b returned 0 after 5859 usecs
[   11.558017] calling  s35390a_rtc_init+0x0/0x3b @ 1
[   11.563862] i2c-core: driver [rtc-s35390a] registered
[   11.568021] initcall s35390a_rtc_init+0x0/0x3b returned 0 after 4882 usecs
[   11.575017] calling  stk17ta8_init+0x0/0x39 @ 1
[   11.580704] initcall stk17ta8_init+0x0/0x39 returned 0 after 0 usecs
[   11.587017] calling  v3020_init+0x0/0x39 @ 1
[   11.591700] initcall v3020_init+0x0/0x39 returned 0 after 0 usecs
[   11.597017] calling  x1205_init+0x0/0x3b @ 1
[   11.602430] i2c-core: driver [rtc-x1205] registered
[   11.607022] initcall x1205_init+0x0/0x3b returned 0 after 4882 usecs
[   11.613017] calling  pcf50633_rtc_init+0x0/0x39 @ 1
[   11.618917] initcall pcf50633_rtc_init+0x0/0x39 returned 0 after 0 usecs
[   11.625018] calling  i2c_dev_init+0x0/0xcb @ 1
[   11.630015] i2c /dev entries driver
[   11.634273] i2c-core: driver [dev_driver] registered
[   11.639933] i2c-dev: adapter [via_i2c] registered as minor 0
[   11.645024] initcall i2c_dev_init+0x0/0xcb returned 0 after 14648 usecs
[   11.652021] calling  i2c_ali1535_init+0x0/0x42 @ 1
[   11.657573] initcall i2c_ali1535_init+0x0/0x42 returned 0 after 0 usecs
[   11.664018] calling  ali1563_init+0x0/0x42 @ 1
[   11.669103] initcall ali1563_init+0x0/0x42 returned 0 after 976 usecs
[   11.675018] calling  amd756_init+0x0/0x42 @ 1
[   11.680317] initcall amd756_init+0x0/0x42 returned 0 after 976 usecs
[   11.686018] calling  i2c_i801_init+0x0/0x42 @ 1
[   11.691615] initcall i2c_i801_init+0x0/0x42 returned 0 after 0 usecs
[   11.698018] calling  i2c_sch_init+0x0/0x42 @ 1
[   11.702851] initcall i2c_sch_init+0x0/0x42 returned 0 after 0 usecs
[   11.709018] calling  nforce2_init+0x0/0x42 @ 1
[   11.714214] i2c-adapter i2c-1: adapter [SMBus nForce2 adapter at 4c00] registered
[   11.715078] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x69
[   11.718112] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.719082] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x50
[   11.724030] i2c-adapter i2c-1: Creating eeprom at 0x50
[   11.725098] i2c 1-0050: uevent
[   11.726142] eeprom 1-0050: probe
[   11.727051] i2c-adapter i2c-1: client [eeprom] registered with bus id 1-0050
[   11.728017] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x51
[   11.733029] i2c-adapter i2c-1: Creating eeprom at 0x51
[   11.734110] i2c 1-0051: uevent
[   11.735153] eeprom 1-0051: probe
[   11.736035] i2c-adapter i2c-1: client [eeprom] registered with bus id 1-0051
[   11.737016] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x52
[   11.740029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.741020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x53
[   11.744028] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.745020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x54
[   11.748028] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.749017] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x55
[   11.752028] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.753017] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x56
[   11.756028] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.757017] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x57
[   11.760028] i2c-adapter i2c-1: Transaction failed (0x10)!
[   11.761411] i2c-dev: adapter [SMBus nForce2 adapter at 4c00] registered as minor 1
[   11.762020] i2c-adapter i2c-1: nForce2 SMBus adapter at 0x4c00
[   11.763250] i2c-adapter i2c-2: adapter [SMBus nForce2 adapter at 4c40] registered
[   11.764064] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x69
[   11.767029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.768030] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x50
[   11.771028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.772020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x51
[   11.775028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.776017] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x52
[   11.779028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.780017] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x53
[   11.783028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.784017] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x54
[   11.787028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.788025] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x55
[   11.791028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.792017] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x56
[   11.795028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.796017] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x57
[   11.799028] i2c-adapter i2c-2: Transaction failed (0x10)!
[   11.800357] i2c-dev: adapter [SMBus nForce2 adapter at 4c40] registered as minor 2
[   11.801020] i2c-adapter i2c-2: nForce2 SMBus adapter at 0x4c40
[   11.802194] initcall nforce2_init+0x0/0x42 returned 0 after 86914 usecs
[   11.809076] calling  i2c_piix4_init+0x0/0x42 @ 1
[   11.814513] initcall i2c_piix4_init+0x0/0x42 returned 0 after 0 usecs
[   11.820077] calling  i2c_sis630_init+0x0/0x42 @ 1
[   11.826142] initcall i2c_sis630_init+0x0/0x42 returned 0 after 976 usecs
[   11.832068] calling  i2c_sis96x_init+0x0/0x42 @ 1
[   11.838123] initcall i2c_sis96x_init+0x0/0x42 returned 0 after 976 usecs
[   11.844075] calling  i2c_vt586b_init+0x0/0x42 @ 1
[   11.850111] initcall i2c_vt586b_init+0x0/0x42 returned 0 after 976 usecs
[   11.856077] calling  ocores_i2c_init+0x0/0x39 @ 1
[   11.861982] initcall ocores_i2c_init+0x0/0x39 returned 0 after 976 usecs
[   11.868018] calling  i2c_parport_init+0x0/0x6b @ 1
[   11.873015] i2c-parport: adapter type unspecified
[   11.878017] initcall i2c_parport_init+0x0/0x6b returned -19 after 4882 usecs
[   11.885017] calling  taos_init+0x0/0x42 @ 1
[   11.889836] initcall taos_init+0x0/0x42 returned 0 after 0 usecs
[   11.895018] calling  usb_i2c_tiny_usb_init+0x0/0x42 @ 1
[   11.901447] usbcore: registered new interface driver i2c-tiny-usb
[   11.907025] initcall usb_i2c_tiny_usb_init+0x0/0x42 returned 0 after 5859 usecs
[   11.914019] calling  i2c_voodoo3_init+0x0/0x42 @ 1
[   11.920140] initcall i2c_voodoo3_init+0x0/0x42 returned 0 after 976 usecs
[   11.926018] calling  i2c_pca_pf_init+0x0/0x39 @ 1
[   11.932069] initcall i2c_pca_pf_init+0x0/0x39 returned 0 after 976 usecs
[   11.938018] calling  pca9539_init+0x0/0x3b @ 1
[   11.943588] i2c-core: driver [pca9539] registered
[   11.948043] initcall pca9539_init+0x0/0x3b returned 0 after 4882 usecs
[   11.954017] calling  pcf8574_init+0x0/0x3b @ 1
[   11.959661] i2c-core: driver [pcf8574] registered
[   11.964038] initcall pcf8574_init+0x0/0x3b returned 0 after 4882 usecs
[   11.970017] calling  tsl2550_init+0x0/0x3b @ 1
[   11.975721] i2c-core: driver [tsl2550] registered
[   11.980023] initcall tsl2550_init+0x0/0x3b returned 0 after 4882 usecs
[   11.986018] calling  w1_init+0x0/0xcd @ 1
[   11.991016] Driver for 1-wire Dallas network protocol.
[   11.997183] initcall w1_init+0x0/0xcd returned 0 after 5859 usecs
[   12.003018] calling  matrox_w1_init+0x0/0x42 @ 1
[   12.008306] initcall matrox_w1_init+0x0/0x42 returned 0 after 976 usecs
[   12.014018] calling  sensors_ds2482_init+0x0/0x3b @ 1
[   12.020346] i2c-core: driver [ds2482] registered
[   12.024040] initcall sensors_ds2482_init+0x0/0x3b returned 0 after 4882 usecs
[   12.032017] calling  w1_f2d_init+0x0/0x39 @ 1
[   12.036069] initcall w1_f2d_init+0x0/0x39 returned 0 after 0 usecs
[   12.042018] calling  w1_ds2760_init+0x0/0x51 @ 1
[   12.047016] 1-Wire driver for the DS2760 battery monitor  chip  - (c) 2004-2005, Szabolcs Gyurko
[   12.056020] initcall w1_ds2760_init+0x0/0x51 returned 0 after 8789 usecs
[   12.062017] calling  w1_bq27000_init+0x0/0x49 @ 1
[   12.067020] initcall w1_bq27000_init+0x0/0x49 returned 0 after 0 usecs
[   12.074017] calling  ds2760_battery_init+0x0/0x39 @ 1
[   12.079568] initcall ds2760_battery_init+0x0/0x39 returned 0 after 0 usecs
[   12.086018] calling  ds2782_init+0x0/0x3b @ 1
[   12.091183] i2c-core: driver [ds2782-battery] registered
[   12.096024] initcall ds2782_init+0x0/0x3b returned 0 after 5859 usecs
[   12.102018] calling  bq27x00_battery_init+0x0/0x57 @ 1
[   12.108443] i2c-core: driver [bq27200-battery] registered
[   12.113024] initcall bq27x00_battery_init+0x0/0x57 returned 0 after 4882 usecs
[   12.121017] calling  max17040_init+0x0/0x3b @ 1
[   12.125972] i2c-core: driver [max17040] registered
[   12.130024] initcall max17040_init+0x0/0x3b returned 0 after 4882 usecs
[   12.137017] calling  pcf50633_mbc_init+0x0/0x39 @ 1
[   12.142649] initcall pcf50633_mbc_init+0x0/0x39 returned 0 after 0 usecs
[   12.149018] calling  asb100_init+0x0/0x3b @ 1
[   12.154132] i2c-core: driver [asb100] registered
[   12.158029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   12.167031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.172028] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   12.181029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.186025] initcall asb100_init+0x0/0x3b returned 0 after 32226 usecs
[   12.193019] calling  sensors_w83627hf_init+0x0/0x9e @ 1
[   12.198035] initcall sensors_w83627hf_init+0x0/0x9e returned -19 after 0 usecs
[   12.205018] calling  sensors_w83792d_init+0x0/0x3b @ 1
[   12.211475] i2c-core: driver [w83792d] registered
[   12.216028] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   12.225029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.230018] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   12.239029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.244018] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   12.253029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.258019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   12.267029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.272025] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   12.281029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.286018] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   12.295029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.300019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   12.309029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.314019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   12.323029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.328025] initcall sensors_w83792d_init+0x0/0x3b returned 0 after 114257 usecs
[   12.336019] calling  sensors_w83793_init+0x0/0x3b @ 1
[   12.341604] i2c-core: driver [w83793] registered
[   12.346078] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   12.355079] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.361075] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   12.369029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.374019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   12.383029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.388019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   12.397029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.402025] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   12.411029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.416019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   12.425029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.430020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   12.439029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.444019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   12.453029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.458025] initcall sensors_w83793_init+0x0/0x3b returned 0 after 114257 usecs
[   12.466019] calling  sensors_w83781d_init+0x0/0x3b @ 1
[   12.471790] i2c-core: driver [w83781d] registered
[   12.476028] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x28
[   12.485030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.490019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x29
[   12.499029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.504019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2a
[   12.513029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.518019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2b
[   12.527029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.532019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   12.541029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.546019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   12.555029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.560019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   12.569029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.574019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   12.583029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.588025] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x28
[   12.597029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.602019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x29
[   12.611029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.616019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2a
[   12.625029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.630019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2b
[   12.639029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.644019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   12.653029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.658019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   12.667029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.672019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   12.681029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.686020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   12.695029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.700025] initcall sensors_w83781d_init+0x0/0x3b returned 0 after 223632 usecs
[   12.708030] calling  sensors_w83791d_init+0x0/0x3b @ 1
[   12.713866] i2c-core: driver [w83791d] registered
[   12.718029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   12.727030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.732019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   12.741029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.746019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   12.755029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.760019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   12.769029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.774025] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   12.783029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.788019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   12.797029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.802019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   12.811029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.816019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   12.825029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   12.830026] initcall sensors_w83791d_init+0x0/0x3b returned 0 after 114257 usecs
[   12.838019] calling  abituguru3_init+0x0/0x185 @ 1
[   12.843020] initcall abituguru3_init+0x0/0x185 returned -19 after 0 usecs
[   12.849019] calling  ad7414_init+0x0/0x3b @ 1
[   12.854665] i2c-core: driver [ad7414] registered
[   12.859024] initcall ad7414_init+0x0/0x3b returned 0 after 4882 usecs
[   12.865018] calling  init_adcxx+0x0/0xa1 @ 1
[   12.871169] initcall init_adcxx+0x0/0xa1 returned 0 after 976 usecs
[   12.877019] calling  sensors_adm1021_init+0x0/0x3b @ 1
[   12.883153] i2c-core: driver [adm1021] registered
[   12.887217] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x18
[   12.897030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.902023] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x19
[   12.911030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.916019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x1a
[   12.925029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.930019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x29
[   12.939029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.944021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2a
[   12.953029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.958019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2b
[   12.967029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.972019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4c
[   12.981029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   12.986019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4d
[   12.995029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.000019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4e
[   13.009030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.014026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x18
[   13.023029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.028019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x19
[   13.037029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.042019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x1a
[   13.051029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.056019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x29
[   13.065029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.070019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2a
[   13.079029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.084019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2b
[   13.093029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.098019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4c
[   13.107029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.112019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4d
[   13.121029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.126019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4e
[   13.135029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.140026] initcall sensors_adm1021_init+0x0/0x3b returned 0 after 251953 usecs
[   13.148019] calling  sm_adm1026_init+0x0/0x3b @ 1
[   13.153425] i2c-core: driver [adm1026] registered
[   13.158029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   13.167030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.172019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   13.181030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.186019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   13.195029] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.200027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   13.209030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.214019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   13.223029] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.228019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   13.237030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.242026] initcall sm_adm1026_init+0x0/0x3b returned 0 after 86914 usecs
[   13.249019] calling  sensors_adm1029_init+0x0/0x3b @ 1
[   13.255319] i2c-core: driver [adm1029] registered
[   13.260029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x28
[   13.268030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.273019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x29
[   13.282030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.287019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2a
[   13.296030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.301019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2b
[   13.310030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.315019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   13.324030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.329019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   13.338030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.343019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   13.352030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.357019] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   13.366030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.371026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x28
[   13.380030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.385019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x29
[   13.394030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.399019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2a
[   13.408030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.413019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2b
[   13.422030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.427019] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   13.436030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.441020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   13.450030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.455020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   13.464030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.469020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   13.478030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.483026] initcall sensors_adm1029_init+0x0/0x3b returned 0 after 223632 usecs
[   13.491020] calling  sensors_adm9240_init+0x0/0x3b @ 1
[   13.496853] i2c-core: driver [adm9240] registered
[   13.501029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   13.510030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.515020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   13.524030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.529020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   13.538030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.543020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   13.552030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.557026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   13.566030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.571020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   13.580030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.585020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   13.594030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.599020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   13.608030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.613026] initcall sensors_adm9240_init+0x0/0x3b returned 0 after 114257 usecs
[   13.621020] calling  sensors_ads7828_init+0x0/0x78 @ 1
[   13.626851] i2c-core: driver [ads7828] registered
[   13.631029] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x48
[   13.640030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.645020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x49
[   13.654030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.659020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4a
[   13.668030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.673020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4b
[   13.682030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.687026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x48
[   13.696030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.701029] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x49
[   13.710030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.715020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4a
[   13.724030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.729020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4b
[   13.738030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.743026] initcall sensors_ads7828_init+0x0/0x78 returned 0 after 114257 usecs
[   13.751020] calling  adt7470_init+0x0/0x3b @ 1
[   13.756166] i2c-core: driver [adt7470] registered
[   13.760030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   13.769030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.774020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   13.783030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.788020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   13.797030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.802026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   13.811031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.816020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   13.825030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.830020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   13.839030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.844026] initcall adt7470_init+0x0/0x3b returned 0 after 86914 usecs
[   13.851020] calling  atxp1_init+0x0/0x3b @ 1
[   13.856185] i2c-core: driver [atxp1] registered
[   13.860078] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x37
[   13.869080] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.875076] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4e
[   13.883030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.888026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x37
[   13.897030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.902020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4e
[   13.911030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   13.916026] initcall atxp1_init+0x0/0x3b returned 0 after 59570 usecs
[   13.923020] calling  coretemp_init+0x0/0x182 @ 1
[   13.928020] initcall coretemp_init+0x0/0x182 returned -19 after 0 usecs
[   13.934020] calling  dme1737_init+0x0/0xdb @ 1
[   13.939463] i2c-core: driver [dme1737] registered
[   13.944030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   13.953031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.958020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   13.967030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.972020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   13.981030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   13.986026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   13.995030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.000020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   14.009030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.014020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   14.023030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.028040] initcall dme1737_init+0x0/0xdb returned 0 after 86914 usecs
[   14.035020] calling  ds1621_init+0x0/0x3b @ 1
[   14.040293] i2c-core: driver [ds1621] registered
[   14.044030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x48
[   14.053031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.058020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x49
[   14.067030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.072020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4a
[   14.081030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.086020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4b
[   14.095030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.100020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4c
[   14.109030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.114020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4d
[   14.123030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.128020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4e
[   14.137030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.142020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4f
[   14.151030] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.156026] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x48
[   14.165030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.170020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x49
[   14.179030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.184020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4a
[   14.193031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.198020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4b
[   14.207030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.212020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4c
[   14.221030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.226020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4d
[   14.235032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.240020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4e
[   14.249030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.254020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4f
[   14.263030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.268026] initcall ds1621_init+0x0/0x3b returned 0 after 223632 usecs
[   14.275020] calling  sensors_f75375_init+0x0/0x3b @ 1
[   14.280979] i2c-core: driver [f75375] registered
[   14.285030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   14.294031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.299020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   14.308031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.313027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   14.322030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.327020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   14.336030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.341026] initcall sensors_f75375_init+0x0/0x3b returned 0 after 59570 usecs
[   14.349020] calling  sensors_fscher_init+0x0/0x3b @ 1
[   14.354591] i2c-core: driver [fscher] registered
[   14.359030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x73
[   14.368031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.373027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x73
[   14.382030] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.387027] initcall sensors_fscher_init+0x0/0x3b returned 0 after 32226 usecs
[   14.395020] calling  sm_fscpos_init+0x0/0x3b @ 1
[   14.400122] i2c-core: driver [fscpos] registered
[   14.404030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x73
[   14.413031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.418027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x73
[   14.427031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.432027] initcall sm_fscpos_init+0x0/0x3b returned 0 after 32226 usecs
[   14.439020] calling  g760a_init+0x0/0x3b @ 1
[   14.444388] i2c-core: driver [g760a] registered
[   14.448027] initcall g760a_init+0x0/0x3b returned 0 after 3906 usecs
[   14.455020] calling  sensors_gl520sm_init+0x0/0x3b @ 1
[   14.460794] i2c-core: driver [gl520sm] registered
[   14.465026] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   14.474031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.479020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   14.488031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.493028] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   14.502031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.507020] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   14.516031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.521027] initcall sensors_gl520sm_init+0x0/0x3b returned 0 after 59570 usecs
[   14.529020] calling  i5k_amb_init+0x0/0x8c @ 1
[   14.534203] initcall i5k_amb_init+0x0/0x8c returned 0 after 976 usecs
[   14.541020] calling  aem_init+0x0/0x75 @ 1
[   14.545529] initcall aem_init+0x0/0x75 returned 0 after 0 usecs
[   14.551020] calling  ibmpex_init+0x0/0x39 @ 1
[   14.555022] initcall ibmpex_init+0x0/0x39 returned 0 after 0 usecs
[   14.562020] calling  sm_it87_init+0x0/0x8d @ 1
[   14.566047] it87: Found IT8712F chip at 0x290, revision 7
[   14.571023] it87: in3 is VCC (+5V)
[   14.575017] it87: in7 is VCCH (+5V Stand-By)
[   14.580317] it87 it87.656: Detected broken BIOS defaults, disabling PWM interface
[   14.588808] initcall sm_it87_init+0x0/0x8d returned 0 after 21484 usecs
[   14.595021] calling  k8temp_init+0x0/0x42 @ 1
[   14.602163] initcall k8temp_init+0x0/0x42 returned 0 after 2929 usecs
[   14.608026] calling  init_lm70+0x0/0x65 @ 1
[   14.613420] initcall init_lm70+0x0/0x65 returned 0 after 0 usecs
[   14.619161] calling  sensors_lm75_init+0x0/0x3b @ 1
[   14.625166] i2c-core: driver [lm75] registered
[   14.629057] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x48
[   14.638100] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.644025] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x49
[   14.652031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.657020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4a
[   14.666031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.671020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4b
[   14.680031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.685020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4c
[   14.694031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.699020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4d
[   14.708031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.713020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4e
[   14.722031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.727020] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4f
[   14.736031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.741027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x48
[   14.750031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.755021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x49
[   14.764031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.769021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4a
[   14.778031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.783021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4b
[   14.792031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.797021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4c
[   14.806031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.811021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4d
[   14.820031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.825021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4e
[   14.834031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.839021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4f
[   14.848031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.853027] initcall sensors_lm75_init+0x0/0x3b returned 0 after 223632 usecs
[   14.861021] calling  sensors_lm77_init+0x0/0x3b @ 1
[   14.866355] i2c-core: driver [lm77] registered
[   14.870030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x48
[   14.879031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.884021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x49
[   14.893031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.898021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4a
[   14.907031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.912021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4b
[   14.921031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   14.926027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x48
[   14.935031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.940021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x49
[   14.949031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.954021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4a
[   14.963031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.968021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4b
[   14.977031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   14.982027] initcall sensors_lm77_init+0x0/0x3b returned 0 after 114257 usecs
[   14.990021] calling  sm_lm78_init+0x0/0x91 @ 1
[   14.994041] lm78: Failed to request high part of region
[   15.000124] i2c-core: driver [lm78] registered
[   15.004030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x28
[   15.013032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.018021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x29
[   15.027031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.032021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2a
[   15.041031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.046021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2b
[   15.055031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.060021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   15.069031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.074021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   15.083031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.088021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   15.097031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.102021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   15.111031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.116027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x28
[   15.125031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.130021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x29
[   15.139031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.144021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2a
[   15.153031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.158021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2b
[   15.167031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.172021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   15.181031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.186021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   15.195031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.200021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   15.209031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.214021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   15.223031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.228027] initcall sm_lm78_init+0x0/0x91 returned 0 after 228515 usecs
[   15.235021] calling  sensors_lm80_init+0x0/0x3b @ 1
[   15.240901] i2c-core: driver [lm80] registered
[   15.245030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x28
[   15.254032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.259021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x29
[   15.268031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.273021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2a
[   15.282031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.287021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2b
[   15.296031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.301021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   15.310031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.315021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   15.324031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.329021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   15.338031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.343021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   15.352031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.357027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x28
[   15.366031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.371021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x29
[   15.380031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.385021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2a
[   15.394031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.399021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2b
[   15.408031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.413021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   15.422031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.427021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   15.436031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.441021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   15.450031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.455021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   15.464031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.469027] initcall sensors_lm80_init+0x0/0x3b returned 0 after 223632 usecs
[   15.477021] calling  sm_lm85_init+0x0/0x3b @ 1
[   15.481892] i2c-core: driver [lm85] registered
[   15.486030] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   15.495032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.500021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   15.509032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.514021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   15.523033] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.528028] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   15.537031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.542021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   15.551031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.556021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   15.565031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.570027] initcall sm_lm85_init+0x0/0x3b returned 0 after 86914 usecs
[   15.577021] calling  ltc4215_init+0x0/0x3b @ 1
[   15.582362] i2c-core: driver [ltc4215] registered
[   15.587041] initcall ltc4215_init+0x0/0x3b returned 0 after 4882 usecs
[   15.593021] calling  max1111_init+0x0/0x39 @ 1
[   15.598433] initcall max1111_init+0x0/0x39 returned 0 after 0 usecs
[   15.604021] calling  sensors_max6650_init+0x0/0x3b @ 1
[   15.610188] i2c-core: driver [max6650] registered
[   15.614079] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x1b
[   15.623082] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.628078] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x1f
[   15.637032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.642021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x48
[   15.651031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.656021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4b
[   15.665031] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.670027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x1b
[   15.679031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.684021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x1f
[   15.693032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.698021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x48
[   15.707031] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.712021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4b
[   15.721032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.726028] initcall sensors_max6650_init+0x0/0x3b returned 0 after 114257 usecs
[   15.734021] calling  pc87427_init+0x0/0x96 @ 1
[   15.738034] initcall pc87427_init+0x0/0x96 returned -19 after 0 usecs
[   15.745020] calling  smsc47b397_init+0x0/0xfd @ 1
[   15.749027] initcall smsc47b397_init+0x0/0xfd returned -19 after 976 usecs
[   15.756021] calling  sm_smsc47m1_init+0x0/0x80 @ 1
[   15.761027] initcall sm_smsc47m1_init+0x0/0x80 returned -19 after 0 usecs
[   15.768020] calling  smsc47m192_init+0x0/0x3b @ 1
[   15.773542] i2c-core: driver [smsc47m192] registered
[   15.778031] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   15.787032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.792021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   15.801032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.806027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   15.815032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.820021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   15.829032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.834027] initcall smsc47m192_init+0x0/0x3b returned 0 after 59570 usecs
[   15.841021] calling  sm_thmc50_init+0x0/0x3b @ 1
[   15.846819] i2c-core: driver [thmc50] registered
[   15.851031] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2c
[   15.860032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.865021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2d
[   15.874032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.879021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   15.888032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.893027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2c
[   15.902032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.907021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2d
[   15.916032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.921021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   15.930032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.935027] initcall sm_thmc50_init+0x0/0x3b returned 0 after 86914 usecs
[   15.942021] calling  tmp401_init+0x0/0x3b @ 1
[   15.947453] i2c-core: driver [tmp401] registered
[   15.952031] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x4c
[   15.960032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   15.965028] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x4c
[   15.974032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   15.979027] initcall tmp401_init+0x0/0x3b returned 0 after 31250 usecs
[   15.986021] calling  sm_via686a_init+0x0/0x42 @ 1
[   15.991604] initcall sm_via686a_init+0x0/0x42 returned 0 after 0 usecs
[   15.998020] calling  sensors_w83l786ng_init+0x0/0x3b @ 1
[   16.003826] i2c-core: driver [w83l786ng] registered
[   16.008031] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2e
[   16.017032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   16.022021] i2c-adapter i2c-1: found normal entry for adapter 1, addr 0x2f
[   16.031032] i2c-adapter i2c-1: Transaction failed (0x10)!
[   16.036027] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2e
[   16.045032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   16.050021] i2c-adapter i2c-2: found normal entry for adapter 2, addr 0x2f
[   16.059032] i2c-adapter i2c-2: Transaction failed (0x10)!
[   16.064027] initcall sensors_w83l786ng_init+0x0/0x3b returned 0 after 59570 usecs
[   16.072021] calling  pcipcwd_init_module+0x0/0x5c @ 1
[   16.077897] initcall pcipcwd_init_module+0x0/0x5c returned 0 after 0 usecs
[   16.084021] calling  wdtpci_init+0x0/0x42 @ 1
[   16.089540] initcall wdtpci_init+0x0/0x42 returned 0 after 0 usecs
[   16.095021] calling  usb_pcwd_init+0x0/0x70 @ 1
[   16.100653] usbcore: registered new interface driver pcwd_usb
[   16.106025] pcwd_usb: Berkshire USB-PC Watchdog driver v1.02
[   16.112021] initcall usb_pcwd_init+0x0/0x70 returned 0 after 11718 usecs
[   16.118020] calling  advwdt_init+0x0/0x83 @ 1
[   16.123019] WDT driver for Advantech single board computer initialising.
[   16.131081] advantechwdt: initialized. timeout=60 sec (nowayout=0)
[   16.137040] initcall advwdt_init+0x0/0x83 returned 0 after 13671 usecs
[   16.143075] calling  watchdog_init+0x0/0xf1 @ 1
[   16.148122] initcall watchdog_init+0x0/0xf1 returned -19 after 0 usecs
[   16.155143] calling  ibwdt_init+0x0/0x83 @ 1
[   16.159078] ib700wdt: WDT driver for IB700 single board computer initialising.
[   16.167335] ib700wdt: START method I/O 443 is not available.
[   16.173099] ib700wdt: probe of ib700wdt failed with error -5
[   16.179034] initcall ibwdt_init+0x0/0x83 returned 0 after 19531 usecs
[   16.185020] calling  ibmasr_init+0x0/0xdb @ 1
[   16.190021] initcall ibmasr_init+0x0/0xdb returned -19 after 0 usecs
[   16.196020] calling  watchdog_init+0x0/0x8a @ 1
[   16.200019] i6300ESB timer: Intel 6300ESB WatchDog Timer Driver v0.04
[   16.207579] initcall watchdog_init+0x0/0x8a returned 0 after 7812 usecs
[   16.214071] calling  iTCO_wdt_init_module+0x0/0x8a @ 1
[   16.219156] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.05
[   16.226206] iTCO_wdt: No card detected
[   16.230050] initcall iTCO_wdt_init_module+0x0/0x8a returned 0 after 9765 usecs
[   16.237074] calling  it8712f_wdt_init+0x0/0x114 @ 1
[   16.242121] it8712f_wdt: Found IT8712F chip revision 7 - using DogFood address 0x201
[   16.250025] it8712f_wdt: disabling watchdog timer
[   16.255044] it8712f_wdt: cannot register miscdev on minor=130 (err=-16)
[   16.261026] initcall it8712f_wdt_init+0x0/0x114 returned -16 after 18554 usecs
[   16.269021] initcall it8712f_wdt_init+0x0/0x114 returned with error code -16 
[   16.276020] calling  sc1200wdt_init+0x0/0x13a @ 1
[   16.280019] sc1200wdt: build 20020303
[   16.284019] sc1200wdt: io parameter must be specified
[   16.289020] initcall sc1200wdt_init+0x0/0x13a returned -22 after 8789 usecs
[   16.296020] initcall sc1200wdt_init+0x0/0x13a returned with error code -22 
[   16.303023] calling  pc87413_init+0x0/0xb5 @ 1
[   16.308019] pc87413 WDT: Version 1.1 at io 0x2E
[   16.312020] pc87413 WDT: cannot register miscdev on minor=130 (err=-16)
[   16.319020] initcall pc87413_init+0x0/0xb5 returned -16 after 10742 usecs
[   16.326020] initcall pc87413_init+0x0/0xb5 returned with error code -16 
[   16.332020] calling  sbc8360_init+0x0/0x1ca @ 1
[   16.337024] sbc8360: failed to register misc device
[   16.342030] initcall sbc8360_init+0x0/0x1ca returned -16 after 4882 usecs
[   16.348021] initcall sbc8360_init+0x0/0x1ca returned with error code -16 
[   16.355021] calling  cpu5wdt_init_module+0x0/0x37 @ 1
[   16.360026] cpu5wdt: sorry, was my fault
[   16.364020] cpu5wdt: misc_register failed
[   16.368025] initcall cpu5wdt_init_module+0x0/0x37 returned -16 after 7812 usecs
[   16.376020] initcall cpu5wdt_init_module+0x0/0x37 returned with error code -16 
[   16.383020] calling  sch311x_wdt_init+0x0/0x176 @ 1
[   16.388038] initcall sch311x_wdt_init+0x0/0x176 returned -19 after 0 usecs
[   16.395020] calling  wdt_init+0x0/0x142 @ 1
[   16.399019] WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.
[   16.407052] w83627hf/thf/hg WDT: Watchdog already running. Resetting timeout to 60 sec
[   16.415049] w83627hf/thf/hg WDT: cannot register miscdev on minor=130 (err=-16)
[   16.422025] initcall wdt_init+0x0/0x142 returned -16 after 22460 usecs
[   16.429020] initcall wdt_init+0x0/0x142 returned with error code -16 
[   16.435020] calling  w83877f_wdt_init+0x0/0x183 @ 1
[   16.440028] w83877f_wdt: I/O address 0x0443 already in use
[   16.446025] initcall w83877f_wdt_init+0x0/0x183 returned -5 after 5859 usecs
[   16.453021] initcall w83877f_wdt_init+0x0/0x183 returned with error code -5 
[   16.460020] calling  w83977f_wdt_init+0x0/0x16d @ 1
[   16.465019] W83977F WDT: W83977F WDT driver, v1.00
[   16.469023] W83977F WDT: cannot register miscdev on minor=130 (err=-16)
[   16.476026] initcall w83977f_wdt_init+0x0/0x16d returned -16 after 10742 usecs
[   16.483021] initcall w83977f_wdt_init+0x0/0x16d returned with error code -16 
[   16.490020] calling  watchdog_init+0x0/0xde @ 1
[   16.495024] epx_c3: cannot register miscdev on minor=130 (err=-16)
[   16.501026] initcall watchdog_init+0x0/0xde returned -16 after 5859 usecs
[   16.508020] initcall watchdog_init+0x0/0xde returned with error code -16 
[   16.515020] calling  watchdog_init+0x0/0xdb @ 1
[   16.519021] SoftDog: cannot register miscdev on minor=130 (err=-16)
[   16.525020] initcall watchdog_init+0x0/0xdb returned -16 after 5859 usecs
[   16.532020] initcall watchdog_init+0x0/0xdb returned with error code -16 
[   16.539020] calling  telephony_init+0x0/0x71 @ 1
[   16.544019] Linux telephony interface: v1.00
[   16.548032] initcall telephony_init+0x0/0x71 returned 0 after 3906 usecs
[   16.555020] calling  linear_init+0x0/0x39 @ 1
[   16.559049] md: linear personality registered for level -1
[   16.565022] initcall linear_init+0x0/0x39 returned 0 after 5859 usecs
[   16.571020] calling  raid0_init+0x0/0x39 @ 1
[   16.575020] md: raid0 personality registered for level 0
[   16.581021] initcall raid0_init+0x0/0x39 returned 0 after 5859 usecs
[   16.587020] calling  raid_init+0x0/0x39 @ 1
[   16.591020] md: raid1 personality registered for level 1
[   16.596021] initcall raid_init+0x0/0x39 returned 0 after 4882 usecs
[   16.603020] calling  raid_init+0x0/0x39 @ 1
[   16.607020] md: raid10 personality registered for level 10
[   16.612021] initcall raid_init+0x0/0x39 returned 0 after 4882 usecs
[   16.619020] calling  raid_init+0x0/0x39 @ 1
[   16.623020] md: faulty personality registered for level -5
[   16.628021] initcall raid_init+0x0/0x39 returned 0 after 4882 usecs
[   16.635020] calling  dm_init+0x0/0x6f @ 1
[   16.643171] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
[   16.651081] initcall dm_init+0x0/0x6f returned 0 after 11718 usecs
[   16.657138] calling  dm_crypt_init+0x0/0x8f @ 1
[   16.663267] initcall dm_crypt_init+0x0/0x8f returned 0 after 976 usecs
[   16.669085] calling  dm_delay_init+0x0/0xe8 @ 1
[   16.675284] initcall dm_delay_init+0x0/0xe8 returned 0 after 976 usecs
[   16.681022] calling  dm_snapshot_init+0x0/0x267 @ 1
[   16.688392] initcall dm_snapshot_init+0x0/0x267 returned 0 after 1953 usecs
[   16.695021] calling  dm_mirror_init+0x0/0x9f @ 1
[   16.701205] initcall dm_mirror_init+0x0/0x9f returned 0 after 976 usecs
[   16.707032] calling  dm_dirty_log_init+0x0/0x7f @ 1
[   16.712056] initcall dm_dirty_log_init+0x0/0x7f returned 0 after 0 usecs
[   16.719021] calling  userspace_dirty_log_init+0x0/0xca @ 1
[   16.724169] device-mapper: dm-log-userspace: version 1.0.0 loaded
[   16.731022] initcall userspace_dirty_log_init+0x0/0xca returned 0 after 6835 usecs
[   16.738021] calling  dm_zero_init+0x0/0x57 @ 1
[   16.743024] initcall dm_zero_init+0x0/0x57 returned 0 after 0 usecs
[   16.749021] calling  bcm203x_init+0x0/0x78 @ 1
[   16.753020] Bluetooth: Broadcom Blutonium firmware driver ver 1.2
[   16.760459] usbcore: registered new interface driver bcm203x
[   16.766029] initcall bcm203x_init+0x0/0x78 returned 0 after 12695 usecs
[   16.772021] calling  bpa10x_init+0x0/0x55 @ 1
[   16.777019] Bluetooth: Digianswer Bluetooth USB driver ver 0.10
[   16.783391] usbcore: registered new interface driver bpa10x
[   16.788027] initcall bpa10x_init+0x0/0x55 returned 0 after 10742 usecs
[   16.795021] calling  btusb_init+0x0/0x55 @ 1
[   16.799019] Bluetooth: Generic Bluetooth USB driver ver 0.5
[   16.805724] usbcore: registered new interface driver btusb
[   16.811027] initcall btusb_init+0x0/0x55 returned 0 after 11718 usecs
[   16.817024] calling  cpufreq_stats_init+0x0/0xca @ 1
[   16.822044] initcall cpufreq_stats_init+0x0/0xca returned 0 after 0 usecs
[   16.829021] calling  cpufreq_gov_powersave_init+0x0/0x39 @ 1
[   16.835023] initcall cpufreq_gov_powersave_init+0x0/0x39 returned 0 after 0 usecs
[   16.842021] calling  cpufreq_gov_dbs_init+0x0/0x103 @ 1
[   16.849040] initcall cpufreq_gov_dbs_init+0x0/0x103 returned 0 after 1953 usecs
[   16.856022] calling  cpufreq_gov_dbs_init+0x0/0x8e @ 1
[   16.862133] initcall cpufreq_gov_dbs_init+0x0/0x8e returned 0 after 0 usecs
[   16.869023] calling  init_ladder+0x0/0x39 @ 1
[   16.873051] cpuidle: using governor ladder
[   16.877023] initcall init_ladder+0x0/0x39 returned 0 after 3906 usecs
[   16.884022] calling  init_menu+0x0/0x39 @ 1
[   16.888021] cpuidle: using governor menu
[   16.892023] initcall init_menu+0x0/0x39 returned 0 after 3906 usecs
[   16.898022] calling  i7300_idle_init+0x0/0x1b1 @ 1
[   16.903179] initcall i7300_idle_init+0x0/0x1b1 returned -19 after 0 usecs
[   16.910022] calling  memstick_init+0x0/0xab @ 1
[   16.915273] initcall memstick_init+0x0/0xab returned 0 after 976 usecs
[   16.922076] calling  mspro_block_init+0x0/0x98 @ 1
[   16.927556] initcall mspro_block_init+0x0/0x98 returned 0 after 0 usecs
[   16.934079] calling  tifm_ms_init+0x0/0x39 @ 1
[   16.939155] initcall tifm_ms_init+0x0/0x39 returned 0 after 976 usecs
[   16.945080] calling  jmb38x_ms_init+0x0/0x42 @ 1
[   16.950715] initcall jmb38x_ms_init+0x0/0x42 returned 0 after 0 usecs
[   16.957021] calling  pca9532_init+0x0/0x3b @ 1
[   16.961991] i2c-core: driver [pca9532] registered
[   16.966029] initcall pca9532_init+0x0/0x3b returned 0 after 4882 usecs
[   16.973021] calling  clevo_mail_led_init+0x0/0xba @ 1
[   16.978024] initcall clevo_mail_led_init+0x0/0xba returned -19 after 0 usecs
[   16.985021] calling  pca955x_leds_init+0x0/0x3b @ 1
[   16.990587] i2c-core: driver [leds-pca955x] registered
[   16.995027] initcall pca955x_leds_init+0x0/0x3b returned 0 after 4882 usecs
[   17.002021] calling  dac124s085_leds_init+0x0/0x39 @ 1
[   17.008193] initcall dac124s085_leds_init+0x0/0x39 returned 0 after 976 usecs
[   17.015070] calling  heartbeat_trig_init+0x0/0x39 @ 1
[   17.020072] initcall heartbeat_trig_init+0x0/0x39 returned 0 after 0 usecs
[   17.027068] calling  bl_trig_init+0x0/0x39 @ 1
[   17.031031] initcall bl_trig_init+0x0/0x39 returned 0 after 0 usecs
[   17.038021] calling  ib_core_init+0x0/0x6a @ 1
[   17.042967] initcall ib_core_init+0x0/0x6a returned 0 after 976 usecs
[   17.049072] calling  ib_mad_init_module+0x0/0xca @ 1
[   17.055277] initcall ib_mad_init_module+0x0/0xca returned 0 after 976 usecs
[   17.062080] calling  ib_sa_init+0x0/0xc1 @ 1
[   17.066719] initcall ib_sa_init+0x0/0xc1 returned 0 after 0 usecs
[   17.072022] calling  ib_cm_init+0x0/0x180 @ 1
[   17.079039] initcall ib_cm_init+0x0/0x180 returned 0 after 1953 usecs
[   17.085022] calling  iw_cm_init+0x0/0x5c @ 1
[   17.090391] initcall iw_cm_init+0x0/0x5c returned 0 after 0 usecs
[   17.096022] calling  addr_init+0x0/0x6d @ 1
[   17.100809] initcall addr_init+0x0/0x6d returned 0 after 0 usecs
[   17.106022] calling  cma_init+0x0/0x108 @ 1
[   17.111220] initcall cma_init+0x0/0x108 returned 0 after 0 usecs
[   17.117022] calling  infinipath_init+0x0/0xe9 @ 1
[   17.122440] initcall infinipath_init+0x0/0xe9 returned 0 after 976 usecs
[   17.129022] calling  c2_init_module+0x0/0x42 @ 1
[   17.134226] initcall c2_init_module+0x0/0x42 returned 0 after 976 usecs
[   17.140074] calling  mlx4_ib_init+0x0/0x39 @ 1
[   17.145090] initcall mlx4_ib_init+0x0/0x39 returned 0 after 0 usecs
[   17.151069] calling  nes_init_module+0x0/0x80 @ 1
[   17.157166] initcall nes_init_module+0x0/0x80 returned 0 after 976 usecs
[   17.163084] calling  ipoib_init_module+0x0/0x12d @ 1
[   17.169315] initcall ipoib_init_module+0x0/0x12d returned 0 after 0 usecs
[   17.176071] calling  srp_init_module+0x0/0x116 @ 1
[   17.181372] initcall srp_init_module+0x0/0x116 returned 0 after 976 usecs
[   17.188022] calling  dcdrbu_init+0x0/0x169 @ 1
[   17.192997] initcall dcdrbu_init+0x0/0x169 returned 0 after 976 usecs
[   17.199022] calling  ibft_init+0x0/0x1e6 @ 1
[   17.203030] No iBFT detected.
[   17.206022] initcall ibft_init+0x0/0x1e6 returned 0 after 2929 usecs
[   17.213021] calling  padlock_init+0x0/0x11d @ 1
[   17.217019] padlock: VIA PadLock not detected.
[   17.222021] initcall padlock_init+0x0/0x11d returned -19 after 4882 usecs
[   17.228021] calling  hifn_init+0x0/0x3e @ 1
[   17.233019] HIFN supports only 32-bit addresses.
[   17.237021] initcall hifn_init+0x0/0x3e returned -22 after 3906 usecs
[   17.244021] initcall hifn_init+0x0/0x3e returned with error code -22 
[   17.250021] calling  hid_init+0x0/0x6e @ 1
[   17.255220] initcall hid_init+0x0/0x6e returned 0 after 976 usecs
[   17.261023] calling  apple_init+0x0/0x63 @ 1
[   17.266202] initcall apple_init+0x0/0x63 returned 0 after 976 usecs
[   17.272064] calling  ch_init+0x0/0x47 @ 1
[   17.276983] initcall ch_init+0x0/0x47 returned 0 after 976 usecs
[   17.283081] calling  ch_init+0x0/0x47 @ 1
[   17.287443] initcall ch_init+0x0/0x47 returned 0 after 0 usecs
[   17.293026] calling  cp_init+0x0/0x47 @ 1
[   17.297654] initcall cp_init+0x0/0x47 returned 0 after 0 usecs
[   17.303022] calling  gyration_init+0x0/0x47 @ 1
[   17.308386] initcall gyration_init+0x0/0x47 returned 0 after 0 usecs
[   17.314022] calling  kye_init+0x0/0x47 @ 1
[   17.319194] initcall kye_init+0x0/0x47 returned 0 after 976 usecs
[   17.325027] calling  lg_init+0x0/0x47 @ 1
[   17.329583] initcall lg_init+0x0/0x47 returned 0 after 0 usecs
[   17.335099] calling  ms_init+0x0/0x47 @ 1
[   17.340081] initcall ms_init+0x0/0x47 returned 0 after 976 usecs
[   17.346086] calling  mr_init+0x0/0x47 @ 1
[   17.350542] initcall mr_init+0x0/0x47 returned 0 after 0 usecs
[   17.356079] calling  ntrig_init+0x0/0x47 @ 1
[   17.361143] initcall ntrig_init+0x0/0x47 returned 0 after 976 usecs
[   17.367022] calling  pl_init+0x0/0x47 @ 1
[   17.371811] initcall pl_init+0x0/0x47 returned 0 after 0 usecs
[   17.377022] calling  pl_init+0x0/0x47 @ 1
[   17.382075] initcall pl_init+0x0/0x47 returned 0 after 976 usecs
[   17.388022] calling  samsung_init+0x0/0x47 @ 1
[   17.392914] initcall samsung_init+0x0/0x47 returned 0 after 0 usecs
[   17.399022] calling  sony_init+0x0/0x47 @ 1
[   17.403586] initcall sony_init+0x0/0x47 returned 0 after 0 usecs
[   17.409071] calling  sp_init+0x0/0x47 @ 1
[   17.414138] initcall sp_init+0x0/0x47 returned 0 after 976 usecs
[   17.420072] calling  ga_init+0x0/0x42 @ 1
[   17.424585] initcall ga_init+0x0/0x42 returned 0 after 0 usecs
[   17.430071] calling  ts_init+0x0/0x47 @ 1
[   17.435097] initcall ts_init+0x0/0x47 returned 0 after 976 usecs
[   17.441080] calling  wacom_init+0x0/0x71 @ 1
[   17.445871] wacom driver registered
[   17.449027] initcall wacom_init+0x0/0x71 returned 0 after 3906 usecs
[   17.455075] calling  hid_init+0x0/0xf1 @ 1
[   17.460285] usbcore: registered new interface driver hiddev
[   17.466690] usbcore: registered new interface driver usbhid
[   17.472161] usbhid: v2.6:USB HID core driver
[   17.476112] initcall hid_init+0x0/0xf1 returned 0 after 16601 usecs
[   17.483087] calling  usb_mouse_init+0x0/0x5e @ 1
[   17.488145] usbcore: registered new interface driver usbmouse
[   17.493083] usbmouse: v1.6:USB HID Boot Protocol mouse driver
[   17.499025] initcall usb_mouse_init+0x0/0x5e returned 0 after 11718 usecs
[   17.506021] calling  fake_init+0x0/0x53 @ 1
[   17.511383] ieee802154hardmac ieee802154hardmac: Added ieee802154 HardMAC hardware
[   17.519914] initcall fake_init+0x0/0x53 returned 0 after 8789 usecs
[   17.526022] calling  init_soundcore+0x0/0xa5 @ 1
[   17.531181] initcall init_soundcore+0x0/0xa5 returned 0 after 976 usecs
[   17.537022] calling  alsa_sound_init+0x0/0xba @ 1
[   17.542305] Advanced Linux Sound Architecture Driver Version 1.0.20.
[   17.549023] initcall alsa_sound_init+0x0/0xba returned 0 after 6835 usecs
[   17.555021] calling  alsa_timer_init+0x0/0xf4 @ 1
[   17.561462] initcall alsa_timer_init+0x0/0xf4 returned 0 after 976 usecs
[   17.568023] calling  snd_hrtimer_init+0x0/0x129 @ 1
[   17.573028] initcall snd_hrtimer_init+0x0/0x129 returned 0 after 0 usecs
[   17.579022] calling  alsa_pcm_init+0x0/0x92 @ 1
[   17.584080] initcall alsa_pcm_init+0x0/0x92 returned 0 after 0 usecs
[   17.590022] calling  snd_mem_init+0x0/0x53 @ 1
[   17.595044] initcall snd_mem_init+0x0/0x53 returned 0 after 0 usecs
[   17.601022] calling  alsa_rawmidi_init+0x0/0xcb @ 1
[   17.606029] initcall alsa_rawmidi_init+0x0/0xcb returned 0 after 0 usecs
[   17.613022] calling  alsa_pcm_oss_init+0x0/0xcc @ 1
[   17.618052] initcall alsa_pcm_oss_init+0x0/0xcc returned 0 after 0 usecs
[   17.624022] calling  alsa_seq_init+0x0/0x5f @ 1
[   17.629990] initcall alsa_seq_init+0x0/0x5f returned 0 after 976 usecs
[   17.636025] calling  alsa_seq_device_init+0x0/0x82 @ 1
[   17.641040] initcall alsa_seq_device_init+0x0/0x82 returned 0 after 0 usecs
[   17.648022] calling  alsa_seq_midi_event_init+0x0/0x2d @ 1
[   17.654022] initcall alsa_seq_midi_event_init+0x0/0x2d returned 0 after 0 usecs
[   17.661021] calling  alsa_seq_oss_init+0x0/0xf3 @ 1
[   17.667569] initcall alsa_seq_oss_init+0x0/0xf3 returned 0 after 1953 usecs
[   17.675024] calling  alsa_seq_dummy_init+0x0/0x32 @ 1
[   17.680110] initcall alsa_seq_dummy_init+0x0/0x32 returned 0 after 0 usecs
[   17.687022] calling  alsa_seq_midi_init+0x0/0x52 @ 1
[   17.692058] initcall alsa_seq_midi_init+0x0/0x52 returned 0 after 0 usecs
[   17.699022] calling  alsa_card_serial_init+0x0/0xb4 @ 1
[   17.705228] no UART detected at 0x1
[   17.709466] initcall alsa_card_serial_init+0x0/0xb4 returned -19 after 4882 usecs
[   17.717023] calling  snd_mts64_module_init+0x0/0x75 @ 1
[   17.723265] snd_mts64: probe of snd_mts64.0 failed with error -5
[   17.730188] initcall snd_mts64_module_init+0x0/0x75 returned -19 after 7812 usecs
[   17.737077] calling  snd_portman_module_init+0x0/0x75 @ 1
[   17.743658] snd_portman2x4: probe of snd_portman2x4.0 failed with error -5
[   17.751364] initcall snd_portman_module_init+0x0/0x75 returned -19 after 7812 usecs
[   17.759149] calling  alsa_mpu401_uart_init+0x0/0x2d @ 1
[   17.764188] initcall alsa_mpu401_uart_init+0x0/0x2d returned 0 after 0 usecs
[   17.771081] calling  alsa_card_mpu401_init+0x0/0xb2 @ 1
[   17.777587] ALSA sound/drivers/mpu401/mpu401.c:111: specify port
[   17.784192] snd_mpu401: probe of snd_mpu401.0 failed with error -22
[   17.791212] initcall alsa_card_mpu401_init+0x0/0xb2 returned -19 after 13671 usecs
[   17.799093] calling  pcsp_init+0x0/0x47 @ 1
[   17.803114] Error: Driver 'pcspkr' is already registered, aborting...
[   17.809069] initcall pcsp_init+0x0/0x47 returned -17 after 5859 usecs
[   17.816068] initcall pcsp_init+0x0/0x47 returned with error code -17 
[   17.822026] calling  snd_soc_init+0x0/0x74 @ 1
[   17.827720] initcall snd_soc_init+0x0/0x74 returned 0 after 0 usecs
[   17.834022] calling  alsa_sound_last_init+0x0/0x93 @ 1
[   17.839020] ALSA device list:
[   17.842020]   No soundcards found.
[   17.845022] initcall alsa_sound_last_init+0x0/0x93 returned 0 after 5859 usecs
[   17.852025] calling  oprofile_init+0x0/0x78 @ 1
[   17.857023] oprofile: using NMI interrupt.
[   17.861032] initcall oprofile_init+0x0/0x78 returned 0 after 3906 usecs
[   17.868022] calling  flow_cache_init+0x0/0x1c9 @ 1
[   17.873507] initcall flow_cache_init+0x0/0x1c9 returned 0 after 976 usecs
[   17.880022] calling  llc_init+0x0/0x47 @ 1
[   17.884025] initcall llc_init+0x0/0x47 returned 0 after 0 usecs
[   17.890022] calling  llc2_init+0x0/0xf4 @ 1
[   17.894093] NET: Registered protocol family 26
[   17.899023] initcall llc2_init+0x0/0xf4 returned 0 after 4882 usecs
[   17.905022] calling  snap_init+0x0/0x61 @ 1
[   17.909084] initcall snap_init+0x0/0x61 returned 0 after 0 usecs
[   17.915022] calling  rif_init+0x0/0xb5 @ 1
[   17.919046] initcall rif_init+0x0/0xb5 returned 0 after 0 usecs
[   17.925022] calling  sysctl_ipv4_init+0x0/0x74 @ 1
[   17.930043] initcall sysctl_ipv4_init+0x0/0x74 returned 0 after 0 usecs
[   17.937021] calling  ipgre_init+0x0/0xd7 @ 1
[   17.941020] GRE over IPv4 tunneling driver
[   17.946317] initcall ipgre_init+0x0/0xd7 returned 0 after 4882 usecs
[   17.952023] calling  init_syncookies+0x0/0x40 @ 1
[   17.957066] initcall init_syncookies+0x0/0x40 returned 0 after 0 usecs
[   17.964021] calling  ah4_init+0x0/0x8f @ 1
[   17.968025] initcall ah4_init+0x0/0x8f returned 0 after 0 usecs
[   17.974021] calling  esp4_init+0x0/0x8f @ 1
[   17.978023] initcall esp4_init+0x0/0x8f returned 0 after 0 usecs
[   17.984021] calling  xfrm4_beet_init+0x0/0x3e @ 1
[   17.989023] initcall xfrm4_beet_init+0x0/0x3e returned 0 after 0 usecs
[   17.995021] calling  xfrm4_transport_init+0x0/0x3e @ 1
[   18.000022] initcall xfrm4_transport_init+0x0/0x3e returned 0 after 0 usecs
[   18.007021] calling  xfrm4_mode_tunnel_init+0x0/0x3e @ 1
[   18.013022] initcall xfrm4_mode_tunnel_init+0x0/0x3e returned 0 after 0 usecs
[   18.020021] calling  inet_diag_init+0x0/0xbc @ 1
[   18.024079] initcall inet_diag_init+0x0/0xbc returned 0 after 0 usecs
[   18.031022] calling  tcp_diag_init+0x0/0x39 @ 1
[   18.035065] initcall tcp_diag_init+0x0/0x39 returned 0 after 0 usecs
[   18.042022] calling  cubictcp_register+0x0/0x88 @ 1
[   18.047022] TCP cubic registered
[   18.050022] initcall cubictcp_register+0x0/0x88 returned 0 after 2929 usecs
[   18.057021] calling  xfrm_user_init+0x0/0x71 @ 1
[   18.061021] Initializing XFRM netlink socket
[   18.066131] initcall xfrm_user_init+0x0/0x71 returned 0 after 3906 usecs
[   18.073022] calling  inet6_init+0x0/0x2ec @ 1
[   18.081279] NET: Registered protocol family 10
[   18.091367] initcall inet6_init+0x0/0x2ec returned 0 after 13671 usecs
[   18.098115] calling  ah6_init+0x0/0x8f @ 1
[   18.102078] initcall ah6_init+0x0/0x8f returned 0 after 0 usecs
[   18.108088] calling  ipcomp6_init+0x0/0x8f @ 1
[   18.113028] initcall ipcomp6_init+0x0/0x8f returned 0 after 0 usecs
[   18.119022] calling  xfrm6_tunnel_init+0x0/0x11c @ 1
[   18.125160] initcall xfrm6_tunnel_init+0x0/0x11c returned 0 after 976 usecs
[   18.132072] calling  tunnel6_init+0x0/0x8f @ 1
[   18.136126] initcall tunnel6_init+0x0/0x8f returned 0 after 0 usecs
[   18.143069] calling  xfrm6_mode_tunnel_init+0x0/0x3e @ 1
[   18.148077] initcall xfrm6_mode_tunnel_init+0x0/0x3e returned 0 after 0 usecs
[   18.155025] calling  xfrm6_ro_init+0x0/0x3e @ 1
[   18.160023] initcall xfrm6_ro_init+0x0/0x3e returned 0 after 0 usecs
[   18.166021] calling  mip6_init+0x0/0xe1 @ 1
[   18.170020] Mobile IPv6
[   18.173024] initcall mip6_init+0x0/0xe1 returned 0 after 2929 usecs
[   18.179022] calling  ip6_tunnel_init+0x0/0xc8 @ 1
[   18.184749] initcall ip6_tunnel_init+0x0/0xc8 returned 0 after 976 usecs
[   18.191085] calling  packet_init+0x0/0x6d @ 1
[   18.196096] NET: Registered protocol family 17
[   18.200177] initcall packet_init+0x0/0x6d returned 0 after 4882 usecs
[   18.207026] calling  ipsec_pfkey_init+0x0/0xac @ 1
[   18.212022] NET: Registered protocol family 15
[   18.216048] initcall ipsec_pfkey_init+0x0/0xac returned 0 after 3906 usecs
[   18.223022] calling  br_init+0x0/0xd3 @ 1
[   18.228429] initcall br_init+0x0/0xd3 returned 0 after 976 usecs
[   18.234023] calling  dsa_init_module+0x0/0x3b @ 1
[   18.239024] initcall dsa_init_module+0x0/0x3b returned 0 after 0 usecs
[   18.245021] calling  edsa_init_module+0x0/0x3b @ 1
[   18.250023] initcall edsa_init_module+0x0/0x3b returned 0 after 0 usecs
[   18.257022] calling  trailer_init_module+0x0/0x3b @ 1
[   18.262023] initcall trailer_init_module+0x0/0x3b returned 0 after 0 usecs
[   18.269022] calling  mv88e6060_init+0x0/0x3b @ 1
[   18.273051] initcall mv88e6060_init+0x0/0x3b returned 0 after 0 usecs
[   18.280022] calling  mv88e6123_61_65_init+0x0/0x3b @ 1
[   18.285023] initcall mv88e6123_61_65_init+0x0/0x3b returned 0 after 0 usecs
[   18.292021] calling  mv88e6131_init+0x0/0x3b @ 1
[   18.296023] initcall mv88e6131_init+0x0/0x3b returned 0 after 0 usecs
[   18.303022] calling  dsa_init_module+0x0/0x39 @ 1
[   18.308564] initcall dsa_init_module+0x0/0x39 returned 0 after 0 usecs
[   18.315022] calling  ipx_init+0x0/0x120 @ 1
[   18.319977] NET: Registered protocol family 4
[   18.326102] initcall ipx_init+0x0/0x120 returned 0 after 6835 usecs
[   18.332023] calling  atalk_init+0x0/0xb3 @ 1
[   18.337023] NET: Registered protocol family 5
[   18.345117] initcall atalk_init+0x0/0xb3 returned 0 after 7812 usecs
[   18.351023] calling  x25_init+0x0/0x85 @ 1
[   18.356023] NET: Registered protocol family 9
[   18.360025] X.25 for Linux Version 0.2
[   18.364079] initcall x25_init+0x0/0x85 returned 0 after 7812 usecs
[   18.370023] calling  can_init+0x0/0x144 @ 1
[   18.374021] can: controller area network core (rev 20090105 abi 8)
[   18.381519] NET: Registered protocol family 29
[   18.386028] initcall can_init+0x0/0x144 returned 0 after 11718 usecs
[   18.392022] calling  raw_module_init+0x0/0x61 @ 1
[   18.397020] can: raw protocol (rev 20090105)
[   18.401050] initcall raw_module_init+0x0/0x61 returned 0 after 3906 usecs
[   18.408022] calling  bcm_module_init+0x0/0x7f @ 1
[   18.413020] can: broadcast manager protocol (rev 20090105 t)
[   18.418038] initcall bcm_module_init+0x0/0x7f returned 0 after 4882 usecs
[   18.425023] calling  irlan_init+0x0/0xfd @ 1
[   18.430455] initcall irlan_init+0x0/0xfd returned 0 after 976 usecs
[   18.437023] calling  l2cap_init+0x0/0x10a @ 1
[   18.441073] Bluetooth: L2CAP ver 2.13
[   18.445021] Bluetooth: L2CAP socket layer initialized
[   18.450022] initcall l2cap_init+0x0/0x10a returned 0 after 8789 usecs
[   18.456022] calling  rfcomm_init+0x0/0xdf @ 1
[   18.461257] Bluetooth: RFCOMM socket layer initialized
[   18.466054] Bluetooth: RFCOMM TTY layer initialized
[   18.471021] Bluetooth: RFCOMM ver 1.11
[   18.475023] initcall rfcomm_init+0x0/0xdf returned 0 after 13671 usecs
[   18.481022] calling  hidp_init+0x0/0x81 @ 1
[   18.485021] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   18.492140] initcall hidp_init+0x0/0x81 returned 0 after 6835 usecs
[   18.498023] calling  init_sunrpc+0x0/0x83 @ 1
[   18.505364] RPC: Registered udp transport module.
[   18.510023] RPC: Registered tcp transport module.
[   18.514029] initcall init_sunrpc+0x0/0x83 returned 0 after 11718 usecs
[   18.521022] calling  init_rpcsec_gss+0x0/0x73 @ 1
[   18.526154] initcall init_rpcsec_gss+0x0/0x73 returned 0 after 0 usecs
[   18.532022] calling  init_kerberos_module+0x0/0x55 @ 1
[   18.537095] initcall init_kerberos_module+0x0/0x55 returned 0 after 976 usecs
[   18.545023] calling  init_spkm3_module+0x0/0x55 @ 1
[   18.550044] initcall init_spkm3_module+0x0/0x55 returned 0 after 0 usecs
[   18.556022] calling  xprt_rdma_init+0x0/0xe2 @ 1
[   18.561021] RPC: Registered rdma transport module.
[   18.566027] initcall xprt_rdma_init+0x0/0xe2 returned 0 after 4882 usecs
[   18.572024] calling  svc_rdma_init+0x0/0x172 @ 1
[   18.578286] initcall svc_rdma_init+0x0/0x172 returned 0 after 976 usecs
[   18.585023] calling  af_rxrpc_init+0x0/0x1c6 @ 1
[   18.593186] NET: Registered protocol family 33
[   18.597123] initcall af_rxrpc_init+0x0/0x1c6 returned 0 after 6835 usecs
[   18.604063] calling  rxkad_init+0x0/0x64 @ 1
[   18.609197] RxRPC: Registered security type 2 'rxkad'
[   18.614076] initcall rxkad_init+0x0/0x64 returned 0 after 5859 usecs
[   18.620114] calling  decnet_init+0x0/0xb4 @ 1
[   18.625071] NET4: DECnet for Linux: V.2.5.68s (C) 1995-2003 Linux DECnet Project Team
[   18.635205] DECnet: Routing cache hash table of 512 buckets, 36Kbytes
[   18.642654] NET: Registered protocol family 12
[   18.647147] initcall decnet_init+0x0/0xb4 returned 0 after 21484 usecs
[   18.653111] calling  econet_proto_init+0x0/0x80 @ 1
[   18.658077] NET: Registered protocol family 19
[   18.663304] initcall econet_proto_init+0x0/0x80 returned 0 after 4882 usecs
[   18.670028] calling  phonet_init+0x0/0x9e @ 1
[   18.674043] NET: Registered protocol family 35
[   18.680147] initcall phonet_init+0x0/0x9e returned 0 after 5859 usecs
[   18.686023] calling  pep_register+0x0/0x3e @ 1
[   18.691589] initcall pep_register+0x0/0x3e returned 0 after 0 usecs
[   18.698073] calling  vlan_proto_init+0x0/0xeb @ 1
[   18.702101] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
[   18.709070] All bugs added by David S. Miller <davem@redhat.com>
[   18.715128] initcall vlan_proto_init+0x0/0xeb returned 0 after 12695 usecs
[   18.722023] calling  dccp_init+0x0/0x36f @ 1
[   18.736534] CCID: Activated CCID 2 (TCP-like)
[   18.740032] initcall dccp_init+0x0/0x36f returned 0 after 12695 usecs
[   18.747111] calling  dccp_v4_init+0x0/0xae @ 1
[   18.753392] initcall dccp_v4_init+0x0/0xae returned 0 after 1953 usecs
[   18.760078] calling  dccp_v6_init+0x0/0xae @ 1
[   18.767132] initcall dccp_v6_init+0x0/0xae returned 0 after 1953 usecs
[   18.773077] calling  dccp_diag_init+0x0/0x39 @ 1
[   18.778084] initcall dccp_diag_init+0x0/0x39 returned 0 after 0 usecs
[   18.784025] calling  sctp_init+0x0/0x775 @ 1
[   18.795287] SCTP: Hash tables configured (established 14563 bind 14563)
[   18.803443] sctp_init_sock(sk: ffff88003cf68000)
[   18.808190] initcall sctp_init+0x0/0x775 returned 0 after 18554 usecs
[   18.815169] calling  rds_init+0x0/0xf8 @ 1
[   18.821083] NET: Registered protocol family 21
[   18.825213] rds_rdma_listen_init(): cm ffff88003ce2bbf0 listening on port 18634
[   18.834401] Registered RDS/iwarp transport
[   18.839400] Registered RDS/infiniband transport
[   18.844076] initcall rds_init+0x0/0xf8 returned 0 after 24414 usecs
[   18.850154] calling  lib80211_init+0x0/0x45 @ 1
[   18.855064] lib80211: common routines for IEEE802.11 drivers
[   18.861126] lib80211_crypt: registered algorithm 'NULL'
[   18.866073] initcall lib80211_init+0x0/0x45 returned 0 after 10742 usecs
[   18.873026] calling  lib80211_crypto_wep_init+0x0/0x39 @ 1
[   18.878027] lib80211_crypt: registered algorithm 'WEP'
[   18.883024] initcall lib80211_crypto_wep_init+0x0/0x39 returned 0 after 4882 usecs
[   18.891023] calling  lib80211_crypto_ccmp_init+0x0/0x39 @ 1
[   18.897023] lib80211_crypt: registered algorithm 'CCMP'
[   18.902023] initcall lib80211_crypto_ccmp_init+0x0/0x39 returned 0 after 4882 usecs
[   18.910023] calling  lib80211_crypto_tkip_init+0x0/0x39 @ 1
[   18.915024] lib80211_crypt: registered algorithm 'TKIP'
[   18.920024] initcall lib80211_crypto_tkip_init+0x0/0x39 returned 0 after 4882 usecs
[   18.928023] calling  tipc_init+0x0/0xdf @ 1
[   18.932048] TIPC: Activated (version 1.6.4 compiled Aug  4 2009 11:29:57)
[   18.942663] NET: Registered protocol family 30
[   18.947023] TIPC: Started in single node mode
[   18.951028] initcall tipc_init+0x0/0xdf returned 0 after 18554 usecs
[   18.957023] calling  dcbnl_init+0x0/0x59 @ 1
[   18.962023] initcall dcbnl_init+0x0/0x59 returned 0 after 0 usecs
[   18.968023] calling  ieee802154_nl_init+0x0/0xb4 @ 1
[   18.977082] initcall ieee802154_nl_init+0x0/0xb4 returned 0 after 3906 usecs
[   18.984024] calling  af_ieee802154_init+0x0/0x9b @ 1
[   18.990449] NET: Registered protocol family 36
[   18.995079] initcall af_ieee802154_init+0x0/0x9b returned 0 after 5859 usecs
[   19.002098] calling  wimax_subsys_init+0x0/0x25a @ 1
[   19.011121] initcall wimax_subsys_init+0x0/0x25a returned 0 after 3906 usecs
[   19.018028] calling  severities_debugfs_init+0x0/0x83 @ 1
[   19.024061] initcall severities_debugfs_init+0x0/0x83 returned 0 after 0 usecs
[   19.031023] calling  update_mp_table+0x0/0x245 @ 1
[   19.036023] initcall update_mp_table+0x0/0x245 returned 0 after 0 usecs
[   19.042023] calling  lapic_insert_resource+0x0/0x67 @ 1
[   19.048026] initcall lapic_insert_resource+0x0/0x67 returned 0 after 0 usecs
[   19.055023] calling  io_apic_bug_finalize+0x0/0x42 @ 1
[   19.060023] initcall io_apic_bug_finalize+0x0/0x42 returned 0 after 0 usecs
[   19.067023] calling  check_early_ioremap_leak+0x0/0x8e @ 1
[   19.072023] initcall check_early_ioremap_leak+0x0/0x8e returned 0 after 0 usecs
[   19.080023] calling  sched_init_debug+0x0/0x4b @ 1
[   19.084038] initcall sched_init_debug+0x0/0x4b returned 0 after 0 usecs
[   19.091023] calling  init_oops_id+0x0/0x5d @ 1
[   19.095022] initcall init_oops_id+0x0/0x5d returned 0 after 0 usecs
[   19.102022] calling  disable_boot_consoles+0x0/0x99 @ 1
[   19.107023] initcall disable_boot_consoles+0x0/0x99 returned 0 after 0 usecs
[   19.114022] calling  pm_qos_power_init+0x0/0xf0 @ 1
[   19.120287] initcall pm_qos_power_init+0x0/0xf0 returned 0 after 976 usecs
[   19.127023] calling  taskstats_init+0x0/0xbe @ 1
[   19.132074] registered taskstats version 1
[   19.136027] initcall taskstats_init+0x0/0xbe returned 0 after 3906 usecs
[   19.143022] calling  clear_boot_tracer+0x0/0x52 @ 1
[   19.147023] initcall clear_boot_tracer+0x0/0x52 returned 0 after 0 usecs
[   19.154023] calling  event_trace_self_tests_init+0x0/0x68 @ 1
[   19.160021] Running tests on trace events:
[   19.164021] Testing event kfree_skb: OK
[   19.172064] Testing event block_rq_abort: OK
[   19.180590] Testing event block_rq_insert: OK
[   19.189589] Testing event block_rq_issue: OK
[   19.198589] Testing event block_rq_requeue: OK
[   19.207589] Testing event block_rq_complete: OK
[   19.216589] Testing event block_bio_bounce: OK
[   19.225589] Testing event block_bio_complete: OK
[   19.234589] Testing event block_bio_backmerge: OK
[   19.243557] Testing event block_bio_frontmerge: OK
[   19.252677] Testing event block_bio_queue: OK
[   19.261593] Testing event block_getrq: OK
[   19.269588] Testing event block_sleeprq: OK
[   19.279019] Testing event block_plug: OK
[   19.286669] Testing event block_unplug_timer: OK
[   19.295541] Testing event block_unplug_io: OK
[   19.304667] Testing event block_split: OK
[   19.313589] Testing event block_remap: OK
[   19.321589] Testing event gfs2_glock_state_change: OK
[   19.330589] Testing event gfs2_glock_put: OK
[   19.339589] Testing event gfs2_demote_rq: OK
[   19.348589] Testing event gfs2_promote: OK
[   19.357589] Testing event gfs2_glock_queue: OK
[   19.366589] Testing event gfs2_pin: OK
[   19.374589] Testing event gfs2_log_flush: OK
[   19.383589] Testing event gfs2_log_blocks: OK
[   19.392591] Testing event gfs2_bmap: OK
[   19.400589] Testing event gfs2_block_alloc: OK
[   19.409589] Testing event jbd2_checkpoint: OK
[   19.418589] Testing event jbd2_start_commit: OK
[   19.427589] Testing event jbd2_commit_locking: OK
[   19.436539] Testing event jbd2_commit_flushing: OK
[   19.445667] Testing event jbd2_commit_logging: OK
[   19.454593] Testing event jbd2_end_commit: OK
[   19.463589] Testing event jbd2_submit_inode_data: OK
[   19.472589] Testing event kmalloc: OK
[   19.480589] Testing event kmem_cache_alloc: OK
[   19.489589] Testing event kmalloc_node: OK
[   19.498589] Testing event kmem_cache_alloc_node: OK
[   19.507589] Testing event kfree: OK
[   19.515590] Testing event kmem_cache_free: OK
[   19.524589] Testing event lock_acquire: OK
[   19.533633] Testing event lock_release: OK
[   19.542601] Testing event lock_contended: OK
[   19.551589] Testing event lock_acquired: OK
[   19.560591] Testing event workqueue_insertion: OK
[   19.569673] Testing event workqueue_execution: OK
[   19.578598] Testing event workqueue_creation: OK
[   19.587592] Testing event workqueue_destruction: OK
[   19.596592] Testing event irq_handler_entry: OK
[   19.605589] Testing event irq_handler_exit: OK
[   19.614589] Testing event softirq_entry: OK
[   19.623539] Testing event softirq_exit: OK
[   19.632591] Testing event sched_kthread_stop: OK
[   19.641593] Testing event sched_kthread_stop_ret: OK
[   19.650589] Testing event sched_wait_task: OK
[   19.659589] Testing event sched_wakeup: OK
[   19.668591] Testing event sched_wakeup_new: OK
[   19.677594] Testing event sched_switch: OK
[   19.686591] Testing event sched_migrate_task: OK
[   19.695589] Testing event sched_process_free: OK
[   19.704458] Testing event sched_process_exit: OK
[   19.713589] Testing event sched_process_wait: OK
[   19.722589] Testing event sched_process_fork: OK
[   19.731589] Testing event sched_signal_send: OK
[   19.740589] Running tests on trace event systems:
[   19.745076] Testing event system skb: OK
[   19.753589] Testing event system block: OK
[   19.762753] Testing event system gfs2: OK
[   19.771630] Testing event system jbd2: OK
[   19.780590] Testing event system kmem: OK
[   19.789590] Testing event system lockdep: OK
[   19.798619] Testing event system workqueue: OK
[   19.807612] Testing event system irq: OK
[   19.815591] Testing event system sched: OK
[   19.824650] Running tests on all trace events:
[   19.829075] Testing all events: OK
[   19.840028] Running tests again, along with the function tracer
[   19.846315] Running tests on trace events:
[   19.851255] Testing event kfree_skb: OK
[   19.860681] Testing event block_rq_abort: OK
[   19.869687] Testing event block_rq_insert: OK
[   19.879681] Testing event block_rq_issue: OK
[   19.888687] Testing event block_rq_requeue: OK
[   19.898681] Testing event block_rq_complete: OK
[   19.908897] Testing event block_bio_bounce: OK
[   19.918680] Testing event block_bio_complete: OK
[   19.928685] Testing event block_bio_backmerge: OK
[   19.938687] Testing event block_bio_frontmerge: OK
[   19.948682] Testing event block_bio_queue: OK
[   19.958684] Testing event block_getrq: OK
[   19.967681] Testing event block_sleeprq: OK
[   19.976680] Testing event block_plug: OK
[   19.985687] Testing event block_unplug_timer: OK
[   19.995890] Testing event block_unplug_io: OK
[   20.005683] Testing event block_split: OK
[   20.014684] Testing event block_remap: OK
[   20.023688] Testing event gfs2_glock_state_change: OK
[   20.033682] Testing event gfs2_glock_put: OK
[   20.042681] Testing event gfs2_demote_rq: OK
[   20.051687] Testing event gfs2_promote: OK
[   20.060895] Testing event gfs2_glock_queue: OK
[   20.070685] Testing event gfs2_pin: OK
[   20.079684] Testing event gfs2_log_flush: OK
[   20.088681] Testing event gfs2_log_blocks: OK
[   20.098684] Testing event gfs2_bmap: OK
[   20.107684] Testing event gfs2_block_alloc: OK
[   20.117687] Testing event jbd2_checkpoint: OK
[   20.127681] Testing event jbd2_start_commit: OK
[   20.137895] Testing event jbd2_commit_locking: OK
[   20.147683] Testing event jbd2_commit_flushing: OK
[   20.157681] Testing event jbd2_commit_logging: OK
[   20.167684] Testing event jbd2_end_commit: OK
[   20.177681] Testing event jbd2_submit_inode_data: OK
[   20.187682] Testing event kmalloc: OK
[   20.196682] Testing event kmem_cache_alloc: OK
[   20.206685] Testing event kmalloc_node: OK
[   20.215892] Testing event kmem_cache_alloc_node: OK
[   20.225683] Testing event kfree: OK
[   20.234894] Testing event kmem_cache_free: OK
[   20.244684] Testing event lock_acquire: OK
[   20.253955] Testing event lock_release: OK
[   20.263687] Testing event lock_contended: OK
[   20.273681] Testing event lock_acquired: OK
[   20.282691] Testing event workqueue_insertion: OK
[   20.292674] Testing event workqueue_execution: OK
[   20.302677] Testing event workqueue_creation: OK
[   20.312882] Testing event workqueue_destruction: OK
[   20.322670] Testing event irq_handler_entry: OK
[   20.332897] Testing event irq_handler_exit: OK
[   20.342678] Testing event softirq_entry: OK
[   20.351681] Testing event softirq_exit: OK
[   20.360897] Testing event sched_kthread_stop: OK
[   20.370685] Testing event sched_kthread_stop_ret: OK
[   20.380682] Testing event sched_wait_task: OK
[   20.390684] Testing event sched_wakeup: OK
[   20.399904] Testing event sched_wakeup_new: OK
[   20.409675] Testing event sched_switch: OK
[   20.418921] Testing event sched_migrate_task: OK
[   20.428686] Testing event sched_process_free: OK
[   20.438681] Testing event sched_process_exit: OK
[   20.448896] Testing event sched_process_wait: OK
[   20.458685] Testing event sched_process_fork: OK
[   20.468682] Testing event sched_signal_send: OK
[   20.478895] Running tests on trace event systems:
[   20.484145] Testing event system skb: OK
[   20.492692] Testing event system block: OK
[   20.503948] Testing event system gfs2: OK
[   20.514466] Testing event system jbd2: OK
[   20.524035] Testing event system kmem: OK
[   20.534034] Testing event system lockdep: OK
[   20.544034] Testing event system workqueue: OK
[   20.553866] Testing event system irq: OK
[   20.564034] Testing event system sched: OK
[   20.574657] Running tests on all trace events:
[   20.579141] Testing all events: OK
[   20.599271] initcall event_trace_self_tests_init+0x0/0x68 returned 0 after 1406250 usecs
[   20.608137] calling  fail_page_alloc_debugfs+0x0/0x10e @ 1
[   20.614021] initcall fail_page_alloc_debugfs+0x0/0x10e returned 0 after 976 usecs
[   20.621052] calling  max_swapfiles_check+0x0/0x2d @ 1
[   20.626075] initcall max_swapfiles_check+0x0/0x2d returned 0 after 0 usecs
[   20.633034] calling  failslab_debugfs_init+0x0/0x91 @ 1
[   20.639020] initcall failslab_debugfs_init+0x0/0x91 returned 0 after 0 usecs
[   20.646025] calling  afs_init+0x0/0x1d0 @ 1
[   20.650023] kAFS: Red Hat AFS client v0.1 registering.
[   20.657227] initcall afs_init+0x0/0x1d0 returned 0 after 6835 usecs
[   20.663214] calling  fail_make_request_debugfs+0x0/0x40 @ 1
[   20.669195] initcall fail_make_request_debugfs+0x0/0x40 returned 0 after 0 usecs
[   20.676071] calling  fail_io_timeout_debugfs+0x0/0x40 @ 1
[   20.682166] initcall fail_io_timeout_debugfs+0x0/0x40 returned 0 after 0 usecs
[   20.689024] calling  random32_reseed+0x0/0xce @ 1
[   20.694045] initcall random32_reseed+0x0/0xce returned 0 after 0 usecs
[   20.700024] calling  pci_resource_alignment_sysfs_init+0x0/0x40 @ 1
[   20.707052] initcall pci_resource_alignment_sysfs_init+0x0/0x40 returned 0 after 0 usecs
[   20.715024] calling  pci_sysfs_init+0x0/0x77 @ 1
[   20.720520] initcall pci_sysfs_init+0x0/0x77 returned 0 after 0 usecs
[   20.726025] calling  boot_wait_for_devices+0x0/0x40 @ 1
[   20.732024] initcall boot_wait_for_devices+0x0/0x40 returned 0 after 0 usecs
[   20.739023] calling  seqgen_init+0x0/0x36 @ 1
[   20.743063] initcall seqgen_init+0x0/0x36 returned 0 after 0 usecs
[   20.749024] calling  hd_init+0x0/0x321 @ 1
[   20.753158] hd: no drives specified - use hd=cyl,head,sectors on kernel command line
[   20.761352] initcall hd_init+0x0/0x321 returned -1 after 8789 usecs
[   20.768025] initcall hd_init+0x0/0x321 returned with error code -1 
[   20.774026] calling  scsi_complete_async_scans+0x0/0x13b @ 1
[   20.780024] initcall scsi_complete_async_scans+0x0/0x13b returned 0 after 0 usecs
[   20.787025] calling  rtc_hctosys+0x0/0x193 @ 1
[   20.792109] rtc_cmos rtc_cmos: setting system clock to 2009-08-04 15:30:19 UTC (1249399819)
[   20.800025] initcall rtc_hctosys+0x0/0x193 returned 0 after 7812 usecs
[   20.807025] calling  edd_init+0x0/0x248 @ 1
[   20.811023] BIOS EDD facility v0.16 2004-Jun-25, 1 devices found
[   20.817943] initcall edd_init+0x0/0x248 returned 0 after 5859 usecs
[   20.824025] calling  memmap_init+0x0/0xce @ 1
[   20.828230] initcall memmap_init+0x0/0xce returned 0 after 0 usecs
[   20.834025] calling  init_net_drop_monitor+0x0/0x1a4 @ 1
[   20.840022] Initalizing network drop monitor service
[   20.845194] initcall init_net_drop_monitor+0x0/0x1a4 returned 0 after 4882 usecs
[   20.852025] calling  tcp_congestion_default+0x0/0x39 @ 1
[   20.858026] initcall tcp_congestion_default+0x0/0x39 returned 0 after 0 usecs
[   20.865024] calling  initialize_hashrnd+0x0/0x40 @ 1
[   20.870031] initcall initialize_hashrnd+0x0/0x40 returned 0 after 0 usecs
[   20.877135] async_waiting @ 1
[   20.880070] async_continuing @ 1 after 0 usec
[   20.884195] md: Skipping autodetection of RAID arrays. (raid=autodetect will force)
[   20.894261] EXT3-fs: INFO: recovery required on readonly filesystem.
[   20.901055] EXT3-fs: write access will be enabled during recovery.
[   20.942174] EXT3-fs: recovery complete.
[   20.946344] kjournald starting.  Commit interval 5 seconds
[   20.947076] EXT3-fs: mounted filesystem with ordered data mode.
[   20.947240] VFS: Mounted root (ext3 filesystem) readonly on device 8:6.
[   20.947341] async_waiting @ 1
[   20.947345] async_continuing @ 1 after 0 usec
[   20.947349] debug: unmapping init memory ffffffff8288f000..ffffffff82bdd000
[   20.979189] Write protecting the kernel read-only data: 21532k
[   27.160060] eeprom 1-0050: uevent
[   27.163506] eeprom 1-0051: uevent
[   29.979141] eth1: link down
[   29.983051] ADDRCONF(NETDEV_UP): eth1: link is not ready
[   38.425105] EXT3 FS on sda6, internal journal
[   38.563428] kjournald starting.  Commit interval 5 seconds
[   38.569077] EXT3 FS on sda5, internal journal
[   38.573045] EXT3-fs: mounted filesystem with ordered data mode.
[   39.653549] Adding 3911816k swap on /dev/sda2.  Priority:-1 extents:1 across:3911816k 
[   40.876035] eth0: no IPv6 routers present
[   41.433214] warning: `dbus-daemon' uses 32-bit capabilities (legacy support in use)

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

* [tip:perfcounters/core] perf top: Improve interactive key handling
  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           ` [patch] perf tools: allow top users to switch between weighted and individual counter display Ingo Molnar
@ 2009-08-04 11:36           ` tip-bot for Mike Galbraith
  2 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-08-04 11:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  0aafe6d2af76ea03501683d7d972edd0018878be
Gitweb:     http://git.kernel.org/tip/0aafe6d2af76ea03501683d7d972edd0018878be
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 4 Aug 2009 10:21:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 10:35:18 +0200

perf top: Improve 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: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1249374083.10069.18.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-top.c |  108 +++++++++++++++++++++++++++++++---------------
 1 files changed, 73 insertions(+), 35 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4eef346..7de28ce 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,7 @@ static void *display_thread(void *arg __used)
 	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 related	[flat|nested] 1150+ messages in thread

* [tip:perfcounters/core] perf top: Update man page
       [not found]             ` <new-submission>
                                 ` (288 preceding siblings ...)
  2009-08-03 13:22               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
@ 2009-08-04 11:37               ` tip-bot for Mike Galbraith
  2009-08-04 11:37               ` [tip:perfcounters/urgent] perf_counter tools: Provide default bfd_demangle() function in case it's not around tip-bot for Ingo Molnar
                                 ` (416 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-08-04 11:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  2a7c07f3ba0bb1234ef787134c81a9a4a2319aa9
Gitweb:     http://git.kernel.org/tip/2a7c07f3ba0bb1234ef787134c81a9a4a2319aa9
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 4 Aug 2009 10:24:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 10:35:19 +0200

perf top: Update man page

perf_counter tools: update perf top manual page to reflect
current implementation.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1249374281.10069.22.camel@marge.simson.net>
Signed-off-by: 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 files changed, 99 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 539d012..4a7d558 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/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 related	[flat|nested] 1150+ messages in thread

* [tip:perfcounters/urgent] perf_counter tools: Provide default bfd_demangle() function in case it's not around
       [not found]             ` <new-submission>
                                 ` (289 preceding siblings ...)
  2009-08-04 11:37               ` [tip:perfcounters/core] perf top: Update man page tip-bot for Mike Galbraith
@ 2009-08-04 11:37               ` tip-bot for Ingo Molnar
  2009-08-04 16:21               ` tip-bot for Ingo Molnar
                                 ` (415 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-04 11:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  238762507bb41689df191160ada1986b012b57df
Gitweb:     http://git.kernel.org/tip/238762507bb41689df191160ada1986b012b57df
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 4 Aug 2009 13:27:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 13:27:43 +0200

perf_counter tools: Provide default bfd_demangle() function in case it's not around

Provide weak alias (which does nothing) in case the system does not
offer one.

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 |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b4fe057..7bd5128 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -8,6 +8,17 @@
 #include <elf.h>
 #include <bfd.h>
 
+/*
+ * Weak wrapper in case a library version is not available:
+ */
+extern char * __attribute__((weak)) bfd_demangle (bfd *, const char *, int);
+
+char * __attribute__((weak))
+ bfd_demangle (bfd *bfd __used, const char *name __used, int flags __used)
+{
+	return NULL;
+}
+
 const char *sym_hist_filter;
 
 #ifndef DMGL_PARAMS

^ permalink raw reply related	[flat|nested] 1150+ 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 15:37                         ` Paul E. McKenney
  1 sibling, 0 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-04 15:37 UTC (permalink / raw)
  To: Gautham R Shenoy
  Cc: Ingo Molnar, mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Tue, Aug 04, 2009 at 01:48:50PM +0530, Gautham R Shenoy 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.
> 
> Appending the patch, bootup log and the config.

I like this patch, one small comment below.

							Thanx, Paul

> /*************** 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);

Suggest:

	printk(KERN_INFO "Initializing RCU for cpu %d, structure %p\n",
	       cpu, rsp);

Just to avoid people being confused by RCU initializing twice per CPU.
Or three times with the new preemptable RCU.  ;-)

> +
>  	/* 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



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

* [tip:perfcounters/urgent] perf_counter tools: Provide default bfd_demangle() function in case it's not around
       [not found]             ` <new-submission>
                                 ` (290 preceding siblings ...)
  2009-08-04 11:37               ` [tip:perfcounters/urgent] perf_counter tools: Provide default bfd_demangle() function in case it's not around tip-bot for Ingo Molnar
@ 2009-08-04 16:21               ` tip-bot for Ingo Molnar
  2009-08-06 12:57               ` [tip:perfcounters/urgent] perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink tip-bot for Arnaldo Carvalho de Melo
                                 ` (414 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-04 16:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	tglx, mingo

Commit-ID:  08b6cb88eeb51fe267cb3847ba663a9558fe73cd
Gitweb:     http://git.kernel.org/tip/08b6cb88eeb51fe267cb3847ba663a9558fe73cd
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 4 Aug 2009 13:27:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 18:19:33 +0200

perf_counter tools: Provide default bfd_demangle() function in case it's not around

Provide weak alias (which does nothing) in case the system does not
offer one.

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 |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b4fe057..7bd5128 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -8,6 +8,17 @@
 #include <elf.h>
 #include <bfd.h>
 
+/*
+ * Weak wrapper in case a library version is not available:
+ */
+extern char * __attribute__((weak)) bfd_demangle (bfd *, const char *, int);
+
+char * __attribute__((weak))
+ bfd_demangle (bfd *bfd __used, const char *name __used, int flags __used)
+{
+	return NULL;
+}
+
 const char *sym_hist_filter;
 
 #ifndef DMGL_PARAMS

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

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-03 12:56                       ` Paul E. McKenney
@ 2009-08-06  1:26                         ` Paul E. McKenney
  2009-08-06  2:51                           ` Gautham R Shenoy
                                             ` (2 more replies)
  0 siblings, 3 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-06  1:26 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits, ego

On Mon, Aug 03, 2009 at 05:56:18AM -0700, Paul E. McKenney wrote:
> 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.

And here is a tested and debugged version.  Diagnostic only, not for
inclusion, based on tip/core/rcu as of today (August 5th).

Gautham, have you been able to reproduce on your machines?  Still cannot
here.

							Thanx, Paul

------------------------------------------------------------------------

Create an rcu_cpu_notified() API that checks to see whether RCU's
CPU-hotplug notifier is registered.  This is used in three WARN_ON_ONCE()
calls, the first of which should trigger, and the second two of
which should not -- but I suspect that the WARN_ON_ONCE() located in
__rcu_process_callbacks() will in fact trigger on the machine suffering
from this bug.  ;-)

Any code path that executes after rcu_init() should have RCU CPU-hotplug
notifiers registered, so any triggering of the following WARN_ON_ONCE()
after rcu_init() is a bug:

	WARN_ON_ONCE(!rcu_cpu_notified());

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 include/linux/cpu.h      |    3 +++
 include/linux/rcupdate.h |    1 +
 kernel/cpu.c             |    5 +++++
 kernel/notifier.c        |   23 +++++++++++++++++++++++
 kernel/rcupdate.c        |    9 ++++++++-
 kernel/rcutree.c         |    1 +
 6 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e0..d9b3c18 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 raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *));
 #else
 
 #ifndef MODULE
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 3c89d6a..f790f3c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,6 +65,7 @@ extern void rcu_init(void);
 extern void rcu_scheduler_starting(void);
 extern int rcu_needs_cpu(int cpu);
 extern int rcu_scheduler_active;
+extern int rcu_cpu_notified(void);
 
 #if defined(CONFIG_TREE_RCU)
 #include <linux/rcutree.h>
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8ce1004..5aa736a 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 raw_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..d72c0b8 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -59,6 +59,29 @@ static int notifier_chain_unregister(struct notifier_block **nl,
 	return -ENOENT;
 }
 
+static int notifier_chain_is_registered(struct notifier_block *nl,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	rcu_read_lock();
+	/* printk(KERN_ALERT "notifier_chain_is_registered looking for: %pS\n", fn); */
+	while (nl != NULL) {
+		/* printk(KERN_ALERT "notifier_chain_is_registered: %pS\n", rcu_dereference(nl)->notifier_call); */
+		if (rcu_dereference(nl)->notifier_call == fn) {
+			rcu_read_unlock();
+			return 1;
+		}
+		nl = (rcu_dereference(nl)->next);
+	}
+	rcu_read_unlock();
+	return 0;
+}
+
+int raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	return notifier_chain_is_registered(nh->head, fn);
+}
+
 /**
  * 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 9f0584e..57a4626 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);
@@ -246,12 +246,19 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 	return NOTIFY_OK;
 }
 
+int rcu_cpu_notified(void)
+{
+	return cpu_notified(rcu_barrier_cpu_hotplug);
+}
+
 void __init rcu_init(void)
 {
 	int i;
 
 	__rcu_init();
+	WARN_ON_ONCE(!rcu_cpu_notified()); /* this one expected to trigger. */
 	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * We don't need protection against CPU-hotplug here because
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index b9b1928..a0bfc93 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1133,6 +1133,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 	unsigned long flags;
 
 	WARN_ON_ONCE(rdp->beenonline == 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick

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

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-06  1:26                         ` Paul E. McKenney
@ 2009-08-06  2:51                           ` Gautham R Shenoy
  2009-08-06 12:29                             ` Ingo Molnar
  2009-08-08 14:57                           ` [tip:core/rcu] rcu: Add second " tip-bot for Paul E. McKenney
  2009-08-09 10:54                           ` tip-bot for Paul E. McKenney
  2 siblings, 1 reply; 1150+ messages in thread
From: Gautham R Shenoy @ 2009-08-06  2:51 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Ingo Molnar, mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Wed, Aug 05, 2009 at 06:26:45PM -0700, Paul E. McKenney wrote:
> On Mon, Aug 03, 2009 at 05:56:18AM -0700, Paul E. McKenney wrote:
> > 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.
> 
> And here is a tested and debugged version.  Diagnostic only, not for
> inclusion, based on tip/core/rcu as of today (August 5th).
> 
> Gautham, have you been able to reproduce on your machines?  Still cannot
> here.

I tried on a couple of machines yesterday, but I still couldn't
reproduce it with Ingo's config.

> 
> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> Create an rcu_cpu_notified() API that checks to see whether RCU's
> CPU-hotplug notifier is registered.  This is used in three WARN_ON_ONCE()
> calls, the first of which should trigger, and the second two of
> which should not -- but I suspect that the WARN_ON_ONCE() located in
> __rcu_process_callbacks() will in fact trigger on the machine suffering
> from this bug.  ;-)
> 
> Any code path that executes after rcu_init() should have RCU CPU-hotplug
> notifiers registered, so any triggering of the following WARN_ON_ONCE()
> after rcu_init() is a bug:
> 
> 	WARN_ON_ONCE(!rcu_cpu_notified());
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> 
>  include/linux/cpu.h      |    3 +++
>  include/linux/rcupdate.h |    1 +
>  kernel/cpu.c             |    5 +++++
>  kernel/notifier.c        |   23 +++++++++++++++++++++++
>  kernel/rcupdate.c        |    9 ++++++++-
>  kernel/rcutree.c         |    1 +
>  6 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 4d668e0..d9b3c18 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 raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
> +		int (*fn)(struct notifier_block *, unsigned long, void *));
>  #else
> 
>  #ifndef MODULE
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 3c89d6a..f790f3c 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -65,6 +65,7 @@ extern void rcu_init(void);
>  extern void rcu_scheduler_starting(void);
>  extern int rcu_needs_cpu(int cpu);
>  extern int rcu_scheduler_active;
> +extern int rcu_cpu_notified(void);
> 
>  #if defined(CONFIG_TREE_RCU)
>  #include <linux/rcutree.h>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 8ce1004..5aa736a 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 raw_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..d72c0b8 100644
> --- a/kernel/notifier.c
> +++ b/kernel/notifier.c
> @@ -59,6 +59,29 @@ static int notifier_chain_unregister(struct notifier_block **nl,
>  	return -ENOENT;
>  }
> 
> +static int notifier_chain_is_registered(struct notifier_block *nl,
> +		int (*fn)(struct notifier_block *, unsigned long, void *))
> +{
> +	rcu_read_lock();
> +	/* printk(KERN_ALERT "notifier_chain_is_registered looking for: %pS\n", fn); */
> +	while (nl != NULL) {
> +		/* printk(KERN_ALERT "notifier_chain_is_registered: %pS\n", rcu_dereference(nl)->notifier_call); */
> +		if (rcu_dereference(nl)->notifier_call == fn) {
> +			rcu_read_unlock();
> +			return 1;
> +		}
> +		nl = (rcu_dereference(nl)->next);
> +	}
> +	rcu_read_unlock();
> +	return 0;
> +}
> +
> +int raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
> +		int (*fn)(struct notifier_block *, unsigned long, void *))
> +{
> +	return notifier_chain_is_registered(nh->head, fn);
> +}
> +
>  /**
>   * 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 9f0584e..57a4626 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);
> @@ -246,12 +246,19 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
>  	return NOTIFY_OK;
>  }
> 
> +int rcu_cpu_notified(void)
> +{
> +	return cpu_notified(rcu_barrier_cpu_hotplug);
> +}
> +
>  void __init rcu_init(void)
>  {
>  	int i;
> 
>  	__rcu_init();
> +	WARN_ON_ONCE(!rcu_cpu_notified()); /* this one expected to trigger. */
>  	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
> +	WARN_ON_ONCE(!rcu_cpu_notified());
> 
>  	/*
>  	 * We don't need protection against CPU-hotplug here because
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index b9b1928..a0bfc93 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -1133,6 +1133,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
>  	unsigned long flags;
> 
>  	WARN_ON_ONCE(rdp->beenonline == 0);
> +	WARN_ON_ONCE(!rcu_cpu_notified());
> 
>  	/*
>  	 * If an RCU GP has gone long enough, go check for dyntick

-- 
Thanks and Regards
gautham

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

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-06  2:51                           ` Gautham R Shenoy
@ 2009-08-06 12:29                             ` Ingo Molnar
  2009-08-06 13:59                               ` Paul E. McKenney
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-06 12:29 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 Wed, Aug 05, 2009 at 06:26:45PM -0700, Paul E. McKenney wrote:
> > On Mon, Aug 03, 2009 at 05:56:18AM -0700, Paul E. McKenney wrote:
> > > 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.
> > 
> > And here is a tested and debugged version.  Diagnostic only, not for
> > inclusion, based on tip/core/rcu as of today (August 5th).
> > 
> > Gautham, have you been able to reproduce on your machines?  
> > Still cannot here.
> 
> I tried on a couple of machines yesterday, but I still couldn't 
> reproduce it with Ingo's config.

Paul, should i try your latest diagnostic patch in -tip testing, to 
see whether it triggers any new warning?

	Ingo

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

* [tip:perfcounters/urgent] perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink
       [not found]             ` <new-submission>
                                 ` (291 preceding siblings ...)
  2009-08-04 16:21               ` tip-bot for Ingo Molnar
@ 2009-08-06 12:57               ` tip-bot for Arnaldo Carvalho de Melo
  2009-08-06 18:27               ` tip-bot for Arnaldo Carvalho de Melo
                                 ` (413 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-08-06 12:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, peterz, tglx, mingo

Commit-ID:  98b31af14e0a42030563e3f360fe5a214d589131
Gitweb:     http://git.kernel.org/tip/98b31af14e0a42030563e3f360fe5a214d589131
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 5 Aug 2009 19:02:49 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 6 Aug 2009 14:52:10 +0200

perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink

In some cases...

[root@doppio tuna]# ls -la /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
-rwxr-xr-x 1 root root 90024 2009-08-03 19:45 /usr/lib64/firefox-3.5.2/firefox
-rwxr-xr-x 1 root root 90024 2009-08-03 18:23 /usr/lib64/xulrunner-1.9.1/xulrunner-stub
[root@doppio tuna]# sha1sum /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/xulrunner-1.9.1/xulrunner-stub
19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/firefox-3.5.2/firefox
[root@doppio tuna]# rpm -qf /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
xulrunner-1.9.1.2-1.fc11.x86_64
firefox-3.5.2-2.fc11.x86_64
[root@doppio tuna]# ls -la /usr/lib/debug/{usr/lib64/xulrunner-1.9.1/xulrunner-stub,usr/lib64/firefox-3.5.2/firefox}.debug
ls: cannot access /usr/lib/debug/usr/lib64/firefox-3.5.2/firefox.debug: No such file or directory
-rwxr-xr-x 1 root root 403608 2009-08-03 18:22 /usr/lib/debug/usr/lib64/xulrunner-1.9.1/xulrunner-stub.debug

Seemingly we don't have a .symtab when we actually can find it
if we use the .note.gnu.build-id ELF section put in place by
some distros. Use it and find the symbols we need.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/symbol.c |   74 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0580b94..80fa3e4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -661,10 +661,67 @@ out_close:
 	return err;
 }
 
+static char *dso__read_build_id(struct dso *self, int verbose)
+{
+	int i;
+	GElf_Ehdr ehdr;
+	GElf_Shdr shdr;
+	Elf_Data *build_id_data;
+	Elf_Scn *sec;
+	char *build_id = NULL, *bid;
+	unsigned char *raw;
+	Elf *elf;
+	int fd = open(self->name, O_RDONLY);
+
+	if (fd < 0)
+		goto out;
+
+	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
+	if (elf == NULL) {
+		if (verbose)
+			fprintf(stderr, "%s: cannot read %s ELF file.\n",
+				__func__, self->name);
+		goto out_close;
+	}
+
+	if (gelf_getehdr(elf, &ehdr) == NULL) {
+		if (verbose)
+			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
+		goto out_elf_end;
+	}
+
+	sec = elf_section_by_name(elf, &ehdr, &shdr, ".note.gnu.build-id", NULL);
+	if (sec == NULL)
+		goto out_elf_end;
+
+	build_id_data = elf_getdata(sec, NULL);
+	if (build_id_data == NULL)
+		goto out_elf_end;
+	build_id = malloc(128);
+	if (build_id == NULL)
+		goto out_elf_end;
+	raw = build_id_data->d_buf + 16;
+	bid = build_id;
+
+	for (i = 0; i < 20; ++i) {
+		sprintf(bid, "%02x", *raw);
+		++raw;
+		bid += 2;
+	}
+	if (verbose)
+		printf("%s(%s): %s\n", __func__, self->name, build_id);
+out_elf_end:
+	elf_end(elf);
+out_close:
+	close(fd);
+out:
+	return build_id;
+}
+
 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);
+	int size = PATH_MAX;
+	char *name = malloc(size), *build_id = NULL;
 	int variant = 0;
 	int ret = -1;
 	int fd;
@@ -686,7 +743,18 @@ more:
 		case 1: /* Ubuntu */
 			snprintf(name, size, "/usr/lib/debug%s", self->name);
 			break;
-		case 2: /* Sane people */
+		case 2:
+			build_id = dso__read_build_id(self, verbose);
+			if (build_id != NULL) {
+				snprintf(name, size,
+					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
+					build_id, build_id + 2);
+				free(build_id);
+				break;
+			}
+			variant++;
+			/* Fall thru */
+		case 3: /* Sane people */
 			snprintf(name, size, "%s", self->name);
 			break;
 

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

* Re: [tip:core/rcu] rcu: Add diagnostic check for a possible CPU-hotplug race
  2009-08-06 12:29                             ` Ingo Molnar
@ 2009-08-06 13:59                               ` Paul E. McKenney
  0 siblings, 0 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-06 13:59 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Gautham R Shenoy, mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Thu, Aug 06, 2009 at 02:29:35PM +0200, Ingo Molnar wrote:
> 
> * Gautham R Shenoy <ego@in.ibm.com> wrote:
> 
> > On Wed, Aug 05, 2009 at 06:26:45PM -0700, Paul E. McKenney wrote:
> > > On Mon, Aug 03, 2009 at 05:56:18AM -0700, Paul E. McKenney wrote:
> > > > 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.
> > > 
> > > And here is a tested and debugged version.  Diagnostic only, not for
> > > inclusion, based on tip/core/rcu as of today (August 5th).
> > > 
> > > Gautham, have you been able to reproduce on your machines?  
> > > Still cannot here.
> > 
> > I tried on a couple of machines yesterday, but I still couldn't 
> > reproduce it with Ingo's config.
> 
> Paul, should i try your latest diagnostic patch in -tip testing, to 
> see whether it triggers any new warning?

Could you please?

							Thanx, Paul

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

* [tip:perfcounters/urgent] perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink
       [not found]             ` <new-submission>
                                 ` (292 preceding siblings ...)
  2009-08-06 12:57               ` [tip:perfcounters/urgent] perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink tip-bot for Arnaldo Carvalho de Melo
@ 2009-08-06 18:27               ` tip-bot for Arnaldo Carvalho de Melo
  2009-08-11 11:33               ` [tip:perfcounters/urgent] perf_counter, x86: Fix lapic printk message tip-bot for Ingo Molnar
                                 ` (412 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-08-06 18:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, peterz, tglx, mingo

Commit-ID:  4d1e00a8af426500edfb8643fa6c375b89f1f804
Gitweb:     http://git.kernel.org/tip/4d1e00a8af426500edfb8643fa6c375b89f1f804
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 5 Aug 2009 19:02:49 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 6 Aug 2009 20:24:37 +0200

perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink

In some cases distros have binaries and debuginfo in weird places:

[root@doppio tuna]# ls -la /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
-rwxr-xr-x 1 root root 90024 2009-08-03 19:45 /usr/lib64/firefox-3.5.2/firefox
-rwxr-xr-x 1 root root 90024 2009-08-03 18:23 /usr/lib64/xulrunner-1.9.1/xulrunner-stub
[root@doppio tuna]# sha1sum /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/xulrunner-1.9.1/xulrunner-stub
19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/firefox-3.5.2/firefox
[root@doppio tuna]# rpm -qf /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
xulrunner-1.9.1.2-1.fc11.x86_64
firefox-3.5.2-2.fc11.x86_64
[root@doppio tuna]# ls -la /usr/lib/debug/{usr/lib64/xulrunner-1.9.1/xulrunner-stub,usr/lib64/firefox-3.5.2/firefox}.debug
ls: cannot access /usr/lib/debug/usr/lib64/firefox-3.5.2/firefox.debug: No such file or directory
-rwxr-xr-x 1 root root 403608 2009-08-03 18:22 /usr/lib/debug/usr/lib64/xulrunner-1.9.1/xulrunner-stub.debug

Seemingly we don't have a .symtab when we actually can find it
if we use the .note.gnu.build-id ELF section put in place by
some distros. Use it and find the symbols we need.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/symbol.c |   76 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0580b94..16ddca2 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -661,10 +661,69 @@ out_close:
 	return err;
 }
 
+#define BUILD_ID_SIZE 128
+
+static char *dso__read_build_id(struct dso *self, int verbose)
+{
+	int i;
+	GElf_Ehdr ehdr;
+	GElf_Shdr shdr;
+	Elf_Data *build_id_data;
+	Elf_Scn *sec;
+	char *build_id = NULL, *bid;
+	unsigned char *raw;
+	Elf *elf;
+	int fd = open(self->name, O_RDONLY);
+
+	if (fd < 0)
+		goto out;
+
+	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
+	if (elf == NULL) {
+		if (verbose)
+			fprintf(stderr, "%s: cannot read %s ELF file.\n",
+				__func__, self->name);
+		goto out_close;
+	}
+
+	if (gelf_getehdr(elf, &ehdr) == NULL) {
+		if (verbose)
+			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
+		goto out_elf_end;
+	}
+
+	sec = elf_section_by_name(elf, &ehdr, &shdr, ".note.gnu.build-id", NULL);
+	if (sec == NULL)
+		goto out_elf_end;
+
+	build_id_data = elf_getdata(sec, NULL);
+	if (build_id_data == NULL)
+		goto out_elf_end;
+	build_id = malloc(BUILD_ID_SIZE);
+	if (build_id == NULL)
+		goto out_elf_end;
+	raw = build_id_data->d_buf + 16;
+	bid = build_id;
+
+	for (i = 0; i < 20; ++i) {
+		sprintf(bid, "%02x", *raw);
+		++raw;
+		bid += 2;
+	}
+	if (verbose)
+		printf("%s(%s): %s\n", __func__, self->name, build_id);
+out_elf_end:
+	elf_end(elf);
+out_close:
+	close(fd);
+out:
+	return build_id;
+}
+
 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);
+	int size = PATH_MAX;
+	char *name = malloc(size), *build_id = NULL;
 	int variant = 0;
 	int ret = -1;
 	int fd;
@@ -686,7 +745,18 @@ more:
 		case 1: /* Ubuntu */
 			snprintf(name, size, "/usr/lib/debug%s", self->name);
 			break;
-		case 2: /* Sane people */
+		case 2:
+			build_id = dso__read_build_id(self, verbose);
+			if (build_id != NULL) {
+				snprintf(name, size,
+					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
+					build_id, build_id + 2);
+				free(build_id);
+				break;
+			}
+			variant++;
+			/* Fall thru */
+		case 3: /* Sane people */
 			snprintf(name, size, "%s", self->name);
 			break;
 

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

* [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-06  1:26                         ` Paul E. McKenney
  2009-08-06  2:51                           ` Gautham R Shenoy
@ 2009-08-08 14:57                           ` tip-bot for Paul E. McKenney
  2009-08-08 15:01                             ` Ingo Molnar
  2009-08-09 10:54                           ` tip-bot for Paul E. McKenney
  2 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Paul E. McKenney @ 2009-08-08 14:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, paulmck, hpa, mingo, tglx, mingo

Commit-ID:  0d84abdae6740ee5290a7a523ee35916f65e16ec
Gitweb:     http://git.kernel.org/tip/0d84abdae6740ee5290a7a523ee35916f65e16ec
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Wed, 5 Aug 2009 18:26:45 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 8 Aug 2009 16:51:08 +0200

rcu: Add second diagnostic check for a possible CPU-hotplug race

Create an rcu_cpu_notified() API that checks to see whether RCU's
CPU-hotplug notifier is registered.  This is used in three WARN_ON_ONCE()
calls, the first of which should trigger, and the second two of
which should not -- but I suspect that the WARN_ON_ONCE() located in
__rcu_process_callbacks() will in fact trigger on the machine suffering
from this bug.  ;-)

Any code path that executes after rcu_init() should have RCU CPU-hotplug
notifiers registered, so any triggering of the following WARN_ON_ONCE()
after rcu_init() is a bug:

	WARN_ON_ONCE(!rcu_cpu_notified());

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: ego@in.ibm.com
LKML-Reference: <20090806012645.GA24800@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/cpu.h      |    3 +++
 include/linux/rcupdate.h |    1 +
 kernel/cpu.c             |    5 +++++
 kernel/notifier.c        |   23 +++++++++++++++++++++++
 kernel/rcupdate.c        |    9 ++++++++-
 kernel/rcutree.c         |    1 +
 6 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e0..d9b3c18 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 raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *));
 #else
 
 #ifndef MODULE
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 3c89d6a..f790f3c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,6 +65,7 @@ extern void rcu_init(void);
 extern void rcu_scheduler_starting(void);
 extern int rcu_needs_cpu(int cpu);
 extern int rcu_scheduler_active;
+extern int rcu_cpu_notified(void);
 
 #if defined(CONFIG_TREE_RCU)
 #include <linux/rcutree.h>
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8ce1004..5aa736a 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 raw_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..d72c0b8 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -59,6 +59,29 @@ static int notifier_chain_unregister(struct notifier_block **nl,
 	return -ENOENT;
 }
 
+static int notifier_chain_is_registered(struct notifier_block *nl,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	rcu_read_lock();
+	/* printk(KERN_ALERT "notifier_chain_is_registered looking for: %pS\n", fn); */
+	while (nl != NULL) {
+		/* printk(KERN_ALERT "notifier_chain_is_registered: %pS\n", rcu_dereference(nl)->notifier_call); */
+		if (rcu_dereference(nl)->notifier_call == fn) {
+			rcu_read_unlock();
+			return 1;
+		}
+		nl = (rcu_dereference(nl)->next);
+	}
+	rcu_read_unlock();
+	return 0;
+}
+
+int raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	return notifier_chain_is_registered(nh->head, fn);
+}
+
 /**
  * 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 9f0584e..57a4626 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);
@@ -246,12 +246,19 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 	return NOTIFY_OK;
 }
 
+int rcu_cpu_notified(void)
+{
+	return cpu_notified(rcu_barrier_cpu_hotplug);
+}
+
 void __init rcu_init(void)
 {
 	int i;
 
 	__rcu_init();
+	WARN_ON_ONCE(!rcu_cpu_notified()); /* this one expected to trigger. */
 	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * We don't need protection against CPU-hotplug here because
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index b9b1928..a0bfc93 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1133,6 +1133,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 	unsigned long flags;
 
 	WARN_ON_ONCE(rdp->beenonline == 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick

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

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-08 14:57                           ` [tip:core/rcu] rcu: Add second " tip-bot for Paul E. McKenney
@ 2009-08-08 15:01                             ` Ingo Molnar
  2009-08-08 23:21                               ` Paul E. McKenney
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-08 15:01 UTC (permalink / raw)
  To: tip-bot for Paul E. McKenney
  Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx


* tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> Commit-ID:  0d84abdae6740ee5290a7a523ee35916f65e16ec
> Gitweb:     http://git.kernel.org/tip/0d84abdae6740ee5290a7a523ee35916f65e16ec
> Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> AuthorDate: Wed, 5 Aug 2009 18:26:45 -0700
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sat, 8 Aug 2009 16:51:08 +0200
> 
> rcu: Add second diagnostic check for a possible CPU-hotplug race

hm, got this build failure in -tip testing:

kernel/rcupdate.c: In function ‘rcu_cpu_notified’:
kernel/rcupdate.c:251: error: implicit declaration of function ‘cpu_notified’

with the config below.

	Ingo
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc5
# Sat Aug  8 16:54:05 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_HWEIGHT=y
CONFIG_GENERIC_GPIO=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_KTIME_SCALAR=y
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_BROKEN_ON_SMP=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 is not set
CONFIG_KERNEL_BZIP2=y
# CONFIG_KERNEL_LZMA is not set
CONFIG_SWAP=y
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=y
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=y
CONFIG_RT_GROUP_SCHED=y
# CONFIG_USER_SCHED is not set
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
# CONFIG_CGROUP_NS is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
CONFIG_CGROUP_CPUACCT=y
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_CGROUP_MEM_RES_CTLR is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_RELAY=y
# CONFIG_NAMESPACES is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
# CONFIG_RD_LZMA is not set
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=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
# CONFIG_BUG is not set
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
# CONFIG_BASE_FULL is not set
CONFIG_FUTEX=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
# CONFIG_TIMERFD is not set
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_HAVE_PERF_COUNTERS=y

#
# Performance Counters
#
# CONFIG_PERF_COUNTERS is not set
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
# CONFIG_STRIP_ASM_SYMS is not set
CONFIG_COMPAT_BRK=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
# CONFIG_PROFILING is not set
CONFIG_TRACEPOINTS=y
CONFIG_MARKERS=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=1
# CONFIG_MODULES is not set
CONFIG_BLOCK=y
# CONFIG_LBDAF is not set
# CONFIG_BLK_DEV_BSG is not set
CONFIG_BLK_DEV_INTEGRITY=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"
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 is not set
CONFIG_SPARSE_IRQ=y
CONFIG_X86_MPPARSE=y
CONFIG_X86_EXTENDED_PLATFORM=y
CONFIG_X86_ELAN=y
CONFIG_X86_RDC321X=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_PARAVIRT_GUEST=y
# CONFIG_VMI is not set
CONFIG_KVM_CLOCK=y
CONFIG_KVM_GUEST=y
# CONFIG_LGUEST_GUEST is not set
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_CLOCK=y
CONFIG_PARAVIRT_DEBUG=y
CONFIG_MEMTEST=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=4
CONFIG_X86_XADD=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_MINIMUM_CPU_FAMILY=4
CONFIG_X86_DEBUGCTLMSR=y
CONFIG_PROCESSOR_SELECT=y
CONFIG_CPU_SUP_INTEL=y
# CONFIG_CPU_SUP_CYRIX_32 is not set
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_CENTAUR=y
# CONFIG_CPU_SUP_TRANSMETA_32 is not set
CONFIG_CPU_SUP_UMC_32=y
# CONFIG_X86_DS is not set
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
# CONFIG_DMI is not set
# CONFIG_IOMMU_HELPER is not set
# CONFIG_IOMMU_API is not set
CONFIG_NR_CPUS=1
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_X86_UP_APIC=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
# CONFIG_X86_MCE is not set
CONFIG_VM86=y
CONFIG_I8K=y
CONFIG_X86_REBOOTFIXUPS=y
# CONFIG_MICROCODE is not set
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_X86_CPU_DEBUG=y
CONFIG_UP_WANTED_1=y
CONFIG_UP_WANTED_2=y
CONFIG_UP_WANTED=y
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
# CONFIG_VMSPLIT_3G is not set
# CONFIG_VMSPLIT_3G_OPT is not set
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_2G_OPT is not set
CONFIG_VMSPLIT_1G=y
CONFIG_PAGE_OFFSET=0x40000000
CONFIG_HIGHMEM=y
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
CONFIG_NEED_NODE_MEMMAP_SIZE=y
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
# CONFIG_ARCH_MEMORY_PROBE is not set
CONFIG_ILLEGAL_POINTER_VALUE=0
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_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_STATIC=y
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_SPARSE=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MIGRATION=y
# 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_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_HIGHPTE=y
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y
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=y
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=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 is not set
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_COMPAT_VDSO=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE=""
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y

#
# Power management and ACPI options
#
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_VERBOSE is not set
CONFIG_CAN_PM_TRACE=y
# CONFIG_PM_TRACE_RTC is not set
CONFIG_PM_SLEEP=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
# CONFIG_ACPI is not set
CONFIG_X86_APM_BOOT=y
CONFIG_APM=y
CONFIG_APM_IGNORE_USER_SUSPEND=y
# CONFIG_APM_DO_ENABLE is not set
# CONFIG_APM_CPU_IDLE is not set
CONFIG_APM_DISPLAY_BLANK=y
CONFIG_APM_ALLOW_INTS=y

#
# CPU Frequency scaling
#
# CONFIG_CPU_FREQ is not set
# CONFIG_CPU_IDLE is not set

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GOMMCONFIG is not set
# CONFIG_PCI_GODIRECT is not set
# CONFIG_PCI_GOOLPC is not set
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=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=y
CONFIG_PCI_DEBUG=y
CONFIG_PCI_STUB=y
CONFIG_HT_IRQ=y
CONFIG_PCI_IOV=y
CONFIG_ISA_DMA_API=y
CONFIG_ISA=y
CONFIG_EISA=y
# CONFIG_EISA_VLB_PRIMING is not set
CONFIG_EISA_PCI_EISA=y
CONFIG_EISA_VIRTUAL_ROOT=y
CONFIG_EISA_NAMES=y
CONFIG_MCA=y
CONFIG_MCA_LEGACY=y
CONFIG_MCA_PROC_FS=y
# CONFIG_SCx200 is not set
# CONFIG_OLPC is not set
CONFIG_PCCARD=y
CONFIG_PCMCIA_DEBUG=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_PCMCIA_IOCTL=y
# CONFIG_CARDBUS is not set

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
# CONFIG_YENTA_TI is not set
CONFIG_YENTA_TOSHIBA=y
CONFIG_PD6729=y
CONFIG_I82092=y
# CONFIG_I82365 is not set
CONFIG_TCIC=y
CONFIG_PCMCIA_PROBE=y
CONFIG_PCCARD_NONSTATIC=y
# CONFIG_HOTPLUG_PCI is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
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=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_NET_KEY=y
# CONFIG_NET_KEY_MIGRATE is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
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 is not set
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
# CONFIG_IP_PNP is not set
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE=y
# CONFIG_NET_IPGRE_BROADCAST is not set
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
# CONFIG_IP_PIMSM_V2 is not set
# CONFIG_ARPD is not set
# CONFIG_SYN_COOKIES is not set
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
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=y
CONFIG_IPV6=y
# CONFIG_IPV6_PRIVACY is not set
CONFIG_IPV6_ROUTER_PREF=y
CONFIG_IPV6_ROUTE_INFO=y
# CONFIG_IPV6_OPTIMISTIC_DAD is not set
# CONFIG_INET6_AH is not set
CONFIG_INET6_ESP=y
# CONFIG_INET6_IPCOMP is not set
CONFIG_IPV6_MIP6=y
# CONFIG_INET6_XFRM_TUNNEL is not set
CONFIG_INET6_TUNNEL=y
CONFIG_INET6_XFRM_MODE_TRANSPORT=y
CONFIG_INET6_XFRM_MODE_TUNNEL=y
CONFIG_INET6_XFRM_MODE_BEET=y
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y
# CONFIG_IPV6_SIT is not set
CONFIG_IPV6_TUNNEL=y
# CONFIG_IPV6_MULTIPLE_TABLES is not set
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_PIMSM_V2=y
# 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=y
CONFIG_NETFILTER_NETLINK_LOG=y
# CONFIG_NF_CONNTRACK is not set
CONFIG_NETFILTER_XTABLES=y
# CONFIG_NETFILTER_XT_TARGET_MARK is not set
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
# CONFIG_IP_VS is not set

#
# IP: Netfilter Configuration
#
# CONFIG_NF_DEFRAG_IPV4 is not set
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
# CONFIG_IP_NF_TARGET_ULOG is not set
# CONFIG_IP_NF_MANGLE is not set

#
# IPv6: Netfilter Configuration
#
CONFIG_IP6_NF_IPTABLES=y
# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
CONFIG_IP6_NF_TARGET_LOG=y
CONFIG_IP6_NF_FILTER=y
# CONFIG_IP6_NF_TARGET_REJECT is not set
CONFIG_IP6_NF_MANGLE=y
# CONFIG_IP_DCCP 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 is not set
CONFIG_SCTP_HMAC_MD5=y
# CONFIG_TIPC is not set
CONFIG_ATM=y
CONFIG_ATM_CLIP=y
# CONFIG_ATM_CLIP_NO_ICMP is not set
CONFIG_ATM_LANE=y
# CONFIG_ATM_MPOA is not set
CONFIG_ATM_BR2684=y
CONFIG_ATM_BR2684_IPFILTER=y
# CONFIG_BRIDGE is not set
CONFIG_NET_DSA=y
# CONFIG_NET_DSA_TAG_DSA is not set
# CONFIG_NET_DSA_TAG_EDSA is not set
# CONFIG_NET_DSA_TAG_TRAILER is not set
# CONFIG_NET_DSA_MV88E6XXX is not set
# CONFIG_NET_DSA_MV88E6060 is not set
# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set
# CONFIG_NET_DSA_MV88E6131 is not set
# CONFIG_NET_DSA_MV88E6123_61_65 is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
CONFIG_LLC=y
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
CONFIG_X25=y
# CONFIG_LAPB is not set
CONFIG_ECONET=y
CONFIG_ECONET_AUNUDP=y
CONFIG_ECONET_NATIVE=y
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=y
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
CONFIG_AX25=y
# CONFIG_AX25_DAMA_SLAVE is not set
# CONFIG_NETROM is not set
# CONFIG_ROSE is not set

#
# AX.25 network device drivers
#
CONFIG_MKISS=y
# CONFIG_6PACK is not set
CONFIG_BPQETHER=y
CONFIG_DMASCC=y
CONFIG_SCC=y
# CONFIG_SCC_DELAY is not set
CONFIG_SCC_TRXECHO=y
CONFIG_BAYCOM_SER_FDX=y
CONFIG_BAYCOM_SER_HDX=y
CONFIG_YAM=y
CONFIG_CAN=y
# CONFIG_CAN_RAW is not set
CONFIG_CAN_BCM=y

#
# CAN Device Drivers
#
# CONFIG_CAN_VCAN is not set
# CONFIG_CAN_DEV is not set
# CONFIG_CAN_DEBUG_DEVICES is not set
# CONFIG_IRDA 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=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
# CONFIG_BT_HIDP is not set

#
# Bluetooth device drivers
#
CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_LL=y
# CONFIG_BT_HCIBCM203X is not set
CONFIG_BT_HCIBPA10X=y
CONFIG_BT_HCIBFUSB=y
# CONFIG_BT_HCIDTL1 is not set
CONFIG_BT_HCIBT3C=y
# CONFIG_BT_HCIBLUECARD is not set
CONFIG_BT_HCIBTUART=y
# CONFIG_BT_HCIVHCI is not set
# CONFIG_AF_RXRPC is not set
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
CONFIG_CFG80211_REG_DEBUG=y
CONFIG_CFG80211_DEBUGFS=y
# CONFIG_WIRELESS_OLD_REGULATORY is not set
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=y
# CONFIG_MAC80211 is not set
CONFIG_MAC80211_DEFAULT_PS_VALUE=0
# CONFIG_WIMAX is not set
CONFIG_RFKILL=y
# CONFIG_RFKILL_INPUT is not set

#
# 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 is not set
# CONFIG_SYS_HYPERVISOR is not set
CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y
# CONFIG_PARPORT is not set
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_ISAPNP=y
CONFIG_PNPBIOS=y
# CONFIG_PNPBIOS_PROC_FS is not set
# CONFIG_PNPACPI 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 is not set
CONFIG_BLK_DEV_UMEM=y
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
# CONFIG_BLK_DEV_NBD 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=y
CONFIG_VIRTIO_BLK=y
# CONFIG_BLK_DEV_HD is not set
# CONFIG_MISC_DEVICES is not set
# CONFIG_DELL_LAPTOP is not set
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=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
# CONFIG_CHR_DEV_SG is not set
CONFIG_CHR_DEV_SCH=y
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_LOGGING is not set
CONFIG_SCSI_SCAN_ASYNC=y

#
# 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_BLK_DEV_3W_XXXX_RAID=y
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_7000FASST is not set
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=y
CONFIG_AIC7XXX_DEBUG_MASK=0
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
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=y
CONFIG_AIC79XX_DEBUG_MASK=0
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
CONFIG_SCSI_AIC94XX=y
# CONFIG_AIC94XX_DEBUG is not set
CONFIG_SCSI_MVSAS=y
CONFIG_SCSI_MVSAS_DEBUG=y
CONFIG_SCSI_DPT_I2O=y
CONFIG_SCSI_ADVANSYS=y
CONFIG_SCSI_IN2000=y
CONFIG_SCSI_ARCMSR=y
CONFIG_SCSI_ARCMSR_AER=y
CONFIG_MEGARAID_NEWGEN=y
CONFIG_MEGARAID_MM=y
CONFIG_MEGARAID_MAILBOX=y
CONFIG_MEGARAID_LEGACY=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_MPT2SAS=y
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
CONFIG_SCSI_MPT2SAS_LOGGING=y
CONFIG_SCSI_HPTIOP=y
CONFIG_SCSI_BUSLOGIC=y
# CONFIG_SCSI_FLASHPOINT is not set
CONFIG_LIBFC=y
CONFIG_LIBFCOE=y
CONFIG_FCOE=y
CONFIG_FCOE_FNIC=y
# CONFIG_SCSI_DMX3191D is not set
CONFIG_SCSI_DTC3280=y
# CONFIG_SCSI_EATA is not set
CONFIG_SCSI_FUTURE_DOMAIN=y
# CONFIG_SCSI_FD_MCS is not set
# CONFIG_SCSI_GDTH is not set
CONFIG_SCSI_GENERIC_NCR5380=y
CONFIG_SCSI_GENERIC_NCR5380_MMIO=y
# CONFIG_SCSI_GENERIC_NCR53C400 is not set
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=y
# CONFIG_SCSI_NCR53C406A is not set
# CONFIG_SCSI_NCR_D700 is not set
CONFIG_SCSI_STEX=y
CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_SCSI_SYM53C8XX_MMIO=y
CONFIG_SCSI_IPR=y
CONFIG_SCSI_IPR_TRACE=y
CONFIG_SCSI_IPR_DUMP=y
CONFIG_SCSI_NCR_Q720=y
CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
CONFIG_SCSI_NCR53C8XX_SYNC=20
CONFIG_SCSI_PAS16=y
CONFIG_SCSI_QLOGIC_FAS=y
CONFIG_SCSI_QLOGIC_1280=y
# CONFIG_SCSI_QLA_FC is not set
CONFIG_SCSI_QLA_ISCSI=y
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_SIM710 is not set
CONFIG_SCSI_SYM53C416=y
# CONFIG_SCSI_DC395x is not set
CONFIG_SCSI_DC390T=y
CONFIG_SCSI_T128=y
# CONFIG_SCSI_U14_34F is not set
CONFIG_SCSI_ULTRASTOR=y
CONFIG_SCSI_NSP32=y
# CONFIG_SCSI_SRP is not set
# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
# CONFIG_SCSI_DH is not set
CONFIG_SCSI_OSD_INITIATOR=y
# CONFIG_SCSI_OSD_ULD is not set
CONFIG_SCSI_OSD_DPRINT_SENSE=1
CONFIG_SCSI_OSD_DEBUG=y
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 is not set
CONFIG_ATA_PIIX=y
CONFIG_SATA_MV=y
CONFIG_SATA_NV=y
CONFIG_PDC_ADMA=y
CONFIG_SATA_QSTOR=y
CONFIG_SATA_PROMISE=y
# CONFIG_SATA_SX4 is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
CONFIG_SATA_ULI=y
# CONFIG_SATA_VIA is not set
CONFIG_SATA_VITESSE=y
# CONFIG_SATA_INIC162X is not set
CONFIG_PATA_ALI=y
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
CONFIG_PATA_ATIIXP=y
CONFIG_PATA_CMD640_PCI=y
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
CONFIG_PATA_CS5530=y
# CONFIG_PATA_CS5535 is not set
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 is not set
# CONFIG_PATA_HPT3X3 is not set
CONFIG_PATA_ISAPNP=y
CONFIG_PATA_IT821X=y
CONFIG_PATA_IT8213=y
CONFIG_PATA_JMICRON=y
CONFIG_PATA_LEGACY=y
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_MARVELL is not set
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=y
# CONFIG_PATA_OPTI is not set
CONFIG_PATA_OPTIDMA=y
CONFIG_PATA_PCMCIA=y
CONFIG_PATA_PDC_OLD=y
# CONFIG_PATA_QDI is not set
CONFIG_PATA_RADISYS=y
# CONFIG_PATA_RZ1000 is not set
CONFIG_PATA_SC1200=y
CONFIG_PATA_SERVERWORKS=y
CONFIG_PATA_PDC2027X=y
# CONFIG_PATA_SIL680 is not set
CONFIG_PATA_SIS=y
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set
CONFIG_PATA_WINBOND_VLB=y
CONFIG_PATA_PLATFORM=y
# CONFIG_PATA_SCH is not set
CONFIG_MD=y
# CONFIG_BLK_DEV_MD is not set
CONFIG_BLK_DEV_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DM_CRYPT=y
# CONFIG_DM_SNAPSHOT is not set
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=y
# 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=y
# CONFIG_FIREWIRE_OHCI is not set
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
# CONFIG_IEEE1394 is not set
CONFIG_I2O=y
# CONFIG_I2O_LCT_NOTIFY_ON_CHANGES is not set
CONFIG_I2O_EXT_ADAPTEC=y
# CONFIG_I2O_CONFIG is not set
CONFIG_I2O_BUS=y
# CONFIG_I2O_BLOCK is not set
CONFIG_I2O_SCSI=y
CONFIG_I2O_PROC=y
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
CONFIG_TUN=y
CONFIG_VETH=y
CONFIG_NET_SB1000=y
CONFIG_ARCNET=y
# CONFIG_ARCNET_1201 is not set
CONFIG_ARCNET_1051=y
# CONFIG_ARCNET_RAW is not set
CONFIG_ARCNET_CAP=y
CONFIG_ARCNET_COM90xx=y
# CONFIG_ARCNET_COM90xxIO is not set
# CONFIG_ARCNET_RIM_I is not set
# CONFIG_ARCNET_COM20020 is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
CONFIG_MARVELL_PHY=y
# 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=y
# CONFIG_ICPLUS_PHY is not set
CONFIG_REALTEK_PHY=y
CONFIG_NATIONAL_PHY=y
CONFIG_STE10XP=y
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_FIXED_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_GPIO=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
CONFIG_CASSINI=y
CONFIG_NET_VENDOR_3COM=y
# CONFIG_EL1 is not set
CONFIG_EL2=y
CONFIG_ELPLUS=y
CONFIG_EL16=y
CONFIG_EL3=y
CONFIG_3C515=y
CONFIG_ELMC=y
# CONFIG_ELMC_II is not set
CONFIG_VORTEX=y
# CONFIG_TYPHOON is not set
CONFIG_LANCE=y
CONFIG_NET_VENDOR_SMC=y
# CONFIG_ULTRAMCA is not set
CONFIG_ULTRA=y
# CONFIG_ULTRA32 is not set
CONFIG_SMC9194=y
CONFIG_ETHOC=y
CONFIG_NET_VENDOR_RACAL=y
CONFIG_NI5010=y
# CONFIG_NI52 is not set
# CONFIG_NI65 is not set
# CONFIG_DNET is not set
CONFIG_NET_TULIP=y
CONFIG_DE2104X=y
CONFIG_DE2104X_DSL=0
# CONFIG_TULIP is not set
# CONFIG_DE4X5 is not set
CONFIG_WINBOND_840=y
# CONFIG_DM9102 is not set
CONFIG_ULI526X=y
CONFIG_AT1700=y
# CONFIG_DEPCA is not set
CONFIG_HP100=y
CONFIG_NET_ISA=y
# CONFIG_E2100 is not set
# CONFIG_EWRK3 is not set
CONFIG_EEXPRESS=y
CONFIG_EEXPRESS_PRO=y
CONFIG_HPLAN=y
# CONFIG_LP486E is not set
CONFIG_ETH16I=y
# CONFIG_NE2000 is not set
CONFIG_ZNET=y
CONFIG_SEEQ8005=y
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=y
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=y
# CONFIG_CS89x0 is not set
CONFIG_E100=y
# CONFIG_LNE390 is not set
# CONFIG_FEALNX is not set
# CONFIG_NATSEMI is not set
# CONFIG_NE2K_PCI is not set
# CONFIG_NE3210 is not set
CONFIG_ES3210=y
CONFIG_8139CP=y
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
# CONFIG_8139TOO_TUNE_TWISTER is not set
# CONFIG_8139TOO_8129 is not set
CONFIG_8139_OLD_RX_RESET=y
CONFIG_R6040=y
CONFIG_SIS900=y
CONFIG_EPIC100=y
CONFIG_SMSC9420=y
# CONFIG_SUNDANCE is not set
CONFIG_TLAN=y
CONFIG_KS8842=y
CONFIG_VIA_RHINE=y
# CONFIG_VIA_RHINE_MMIO is not set
CONFIG_SC92031=y
CONFIG_ATL2=y
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
# CONFIG_ACENIC_OMIT_TIGON_I is not set
CONFIG_DL2K=y
CONFIG_E1000=y
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
# CONFIG_IGB is not set
CONFIG_IGBVF=y
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
CONFIG_YELLOWFIN=y
# CONFIG_R8169 is not set
# CONFIG_SIS190 is not set
CONFIG_SKGE=y
CONFIG_SKGE_DEBUG=y
CONFIG_SKY2=y
# CONFIG_SKY2_DEBUG is not set
CONFIG_VIA_VELOCITY=y
CONFIG_TIGON3=y
CONFIG_BNX2=y
CONFIG_QLA3XXX=y
# CONFIG_ATL1 is not set
# CONFIG_ATL1E is not set
# CONFIG_ATL1C is not set
CONFIG_JME=y
# CONFIG_NETDEV_10000 is not set
CONFIG_MLX4_CORE=y
CONFIG_TR=y
# CONFIG_IBMTR is not set
# CONFIG_IBMOL is not set
CONFIG_IBMLS=y
CONFIG_3C359=y
CONFIG_TMS380TR=y
CONFIG_TMSPCI=y
CONFIG_SKISA=y
CONFIG_PROTEON=y
CONFIG_ABYSS=y
CONFIG_MADGEMC=y
# CONFIG_SMCTR is not set

#
# Wireless LAN
#
CONFIG_WLAN_PRE80211=y
CONFIG_STRIP=y
CONFIG_ARLAN=y
CONFIG_WAVELAN=y
CONFIG_PCMCIA_WAVELAN=y
CONFIG_PCMCIA_NETWAVE=y
CONFIG_WLAN_80211=y
CONFIG_PCMCIA_RAYCS=y
CONFIG_LIBERTAS=y
# CONFIG_LIBERTAS_USB is not set
CONFIG_LIBERTAS_CS=y
# CONFIG_LIBERTAS_DEBUG is not set
CONFIG_AIRO=y
# CONFIG_ATMEL is not set
CONFIG_AIRO_CS=y
CONFIG_PCMCIA_WL3501=y
CONFIG_PRISM54=y
CONFIG_USB_ZD1201=y
CONFIG_USB_NET_RNDIS_WLAN=y
# CONFIG_IPW2100 is not set
CONFIG_IPW2200=y
CONFIG_IPW2200_MONITOR=y
CONFIG_IPW2200_RADIOTAP=y
# CONFIG_IPW2200_PROMISCUOUS is not set
CONFIG_IPW2200_QOS=y
CONFIG_IPW2200_DEBUG=y
CONFIG_LIBIPW=y
CONFIG_LIBIPW_DEBUG=y
# CONFIG_HOSTAP is not set
CONFIG_HERMES=y
# CONFIG_HERMES_CACHE_FW_ON_INIT is not set
CONFIG_PLX_HERMES=y
CONFIG_TMD_HERMES=y
CONFIG_NORTEL_HERMES=y
# CONFIG_PCI_HERMES is not set
# CONFIG_PCMCIA_HERMES is not set
CONFIG_PCMCIA_SPECTRUM=y

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
CONFIG_USB_KAWETH=y
CONFIG_USB_PEGASUS=y
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 is not set
CONFIG_USB_NET_GL620A=y
# CONFIG_USB_NET_NET1080 is not set
CONFIG_USB_NET_PLUSB=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
# CONFIG_USB_NET_CDC_SUBSET is not set
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_HSO=y
CONFIG_USB_NET_INT51X1=y
# CONFIG_USB_CDC_PHONET is not set
# CONFIG_NET_PCMCIA is not set
CONFIG_WAN=y
# CONFIG_LANMEDIA is not set
CONFIG_HDLC=y
CONFIG_HDLC_RAW=y
# CONFIG_HDLC_RAW_ETH is not set
# CONFIG_HDLC_CISCO is not set
# CONFIG_HDLC_FR is not set
# CONFIG_HDLC_PPP is not set

#
# X.25/LAPB support is disabled
#
CONFIG_PCI200SYN=y
CONFIG_WANXL=y
CONFIG_PC300TOO=y
CONFIG_N2=y
# CONFIG_C101 is not set
CONFIG_FARSYNC=y
CONFIG_DLCI=y
CONFIG_DLCI_MAX=8
# CONFIG_SDLA is not set
# CONFIG_WAN_ROUTER_DRIVERS is not set
# CONFIG_SBNI is not set
# CONFIG_ATM_DRIVERS is not set
# CONFIG_IEEE802154_DRIVERS is not set
CONFIG_FDDI=y
CONFIG_DEFXX=y
CONFIG_DEFXX_MMIO=y
CONFIG_SKFP=y
# CONFIG_HIPPI 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=y
CONFIG_PPPOE=y
CONFIG_PPPOATM=y
CONFIG_PPPOL2TP=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=y
CONFIG_SLIP_SMART=y
# CONFIG_SLIP_MODE_SLIP6 is not set
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=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=y
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

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYBOARD_MATRIX is not set
CONFIG_KEYBOARD_NEWTON=y
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
CONFIG_INPUT_MOUSE=y
# CONFIG_MOUSE_PS2 is not set
# CONFIG_MOUSE_SERIAL is not set
CONFIG_MOUSE_APPLETOUCH=y
CONFIG_MOUSE_BCM5974=y
# CONFIG_MOUSE_INPORT is not set
CONFIG_MOUSE_LOGIBM=y
CONFIG_MOUSE_PC110PAD=y
CONFIG_MOUSE_VSXXXAA=y
# CONFIG_MOUSE_GPIO is not set
CONFIG_MOUSE_SYNAPTICS_I2C=y
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
# CONFIG_JOYSTICK_A3D is not set
CONFIG_JOYSTICK_ADI=y
# CONFIG_JOYSTICK_COBRA is not set
CONFIG_JOYSTICK_GF2K=y
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=y
CONFIG_JOYSTICK_IFORCE_232=y
CONFIG_JOYSTICK_WARRIOR=y
CONFIG_JOYSTICK_MAGELLAN=y
CONFIG_JOYSTICK_SPACEORB=y
# CONFIG_JOYSTICK_SPACEBALL is not set
CONFIG_JOYSTICK_STINGER=y
CONFIG_JOYSTICK_TWIDJOY=y
CONFIG_JOYSTICK_ZHENHUA=y
CONFIG_JOYSTICK_JOYDUMP=y
CONFIG_JOYSTICK_XPAD=y
# CONFIG_JOYSTICK_XPAD_FF is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=y
CONFIG_TABLET_USB_GTCO=y
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_WACOM=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_AD7879_I2C=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_DA9034=y
CONFIG_TOUCHSCREEN_EETI=y
CONFIG_TOUCHSCREEN_FUJITSU=y
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_ELO is not set
CONFIG_TOUCHSCREEN_WACOM_W8001=y
CONFIG_TOUCHSCREEN_MTOUCH=y
CONFIG_TOUCHSCREEN_INEXIO=y
# CONFIG_TOUCHSCREEN_MK712 is not set
CONFIG_TOUCHSCREEN_HTCPEN=y
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
CONFIG_TOUCHSCREEN_TOUCHRIGHT=y
CONFIG_TOUCHSCREEN_TOUCHWIN=y
CONFIG_TOUCHSCREEN_WM97XX=y
CONFIG_TOUCHSCREEN_WM9705=y
# CONFIG_TOUCHSCREEN_WM9712 is not set
CONFIG_TOUCHSCREEN_WM9713=y
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 is not set
CONFIG_TOUCHSCREEN_USB_ETURBO=y
# CONFIG_TOUCHSCREEN_USB_GUNZE is not set
# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set
CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
CONFIG_TOUCHSCREEN_TOUCHIT213=y
CONFIG_TOUCHSCREEN_TSC2007=y
# CONFIG_TOUCHSCREEN_W90X900 is not set
# CONFIG_INPUT_MISC is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_CT82C710 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=y
CONFIG_GAMEPORT_EMU10K1=y
CONFIG_GAMEPORT_FM801=y

#
# 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=y
# CONFIG_SERIAL_NONSTANDARD 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_PNP is not set
# CONFIG_SERIAL_8250_CS 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=y

#
# 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=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_HVC_DRIVER=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_IPMI_HANDLER=y
CONFIG_IPMI_PANIC_EVENT=y
# CONFIG_IPMI_PANIC_STRING is not set
CONFIG_IPMI_DEVICE_INTERFACE=y
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 is not set
CONFIG_HW_RANDOM_GEODE=y
# CONFIG_HW_RANDOM_VIA is not set
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_NVRAM is not set
# CONFIG_DTLK is not set
CONFIG_R3964=y
CONFIG_APPLICOM=y
CONFIG_SONYPI=y

#
# PCMCIA character devices
#
CONFIG_SYNCLINK_CS=y
CONFIG_CARDMAN_4000=y
# CONFIG_CARDMAN_4040 is not set
CONFIG_IPWIRELESS=y
# CONFIG_MWAVE is not set
CONFIG_PC8736x_GPIO=y
CONFIG_NSC_GPIO=y
# CONFIG_CS5535_GPIO is not set
# CONFIG_RAW_DRIVER is not set
CONFIG_HANGCHECK_TIMER=y
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set
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_ALGOPCF=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
CONFIG_I2C_ALI1563=y
CONFIG_I2C_ALI15X3=y
CONFIG_I2C_AMD756=y
CONFIG_I2C_AMD8111=y
CONFIG_I2C_I801=y
# CONFIG_I2C_ISCH is not set
CONFIG_I2C_PIIX4=y
# CONFIG_I2C_NFORCE2 is not set
CONFIG_I2C_SIS5595=y
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_GPIO=y
# CONFIG_I2C_OCORES is not set
CONFIG_I2C_SIMTEC=y

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT_LIGHT=y
# CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB=y

#
# Graphics adapter I2C/DDC channel drivers
#
CONFIG_I2C_VOODOO3=y

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_ELEKTOR=y
# CONFIG_I2C_PCA_PLATFORM is not set
CONFIG_SCx200_ACB=y

#
# Miscellaneous I2C Chip support
#
CONFIG_DS1682=y
CONFIG_SENSORS_PCF8574=y
CONFIG_PCF8575=y
# CONFIG_SENSORS_TSL2550 is not set
CONFIG_I2C_DEBUG_CORE=y
# 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=y
# CONFIG_DEBUG_GPIO is not set
# CONFIG_GPIO_SYSFS is not set

#
# Memory mapped GPIO expanders:
#

#
# I2C GPIO expanders:
#
# CONFIG_GPIO_MAX732X is not set
CONFIG_GPIO_PCA953X=y
# CONFIG_GPIO_PCF857X is not set
CONFIG_GPIO_TWL4030=y

#
# PCI GPIO expanders:
#
# CONFIG_GPIO_BT8XX is not set

#
# SPI GPIO expanders:
#
CONFIG_W1=y
CONFIG_W1_CON=y

#
# 1-wire Bus Masters
#
CONFIG_W1_MASTER_MATROX=y
CONFIG_W1_MASTER_DS2490=y
CONFIG_W1_MASTER_DS2482=y
CONFIG_W1_MASTER_GPIO=y

#
# 1-wire Slaves
#
CONFIG_W1_SLAVE_THERM=y
# CONFIG_W1_SLAVE_SMEM is not set
# CONFIG_W1_SLAVE_DS2431 is not set
CONFIG_W1_SLAVE_DS2433=y
CONFIG_W1_SLAVE_DS2433_CRC=y
CONFIG_W1_SLAVE_DS2760=y
CONFIG_W1_SLAVE_BQ27000=y
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
CONFIG_PDA_POWER=y
CONFIG_BATTERY_DS2760=y
CONFIG_BATTERY_DS2782=y
CONFIG_BATTERY_WM97XX=y
# CONFIG_BATTERY_BQ27x00 is not set
CONFIG_BATTERY_DA9030=y
CONFIG_BATTERY_MAX17040=y
CONFIG_CHARGER_PCF50633=y
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_NOWAYOUT=y

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
CONFIG_TWL4030_WATCHDOG=y
CONFIG_ACQUIRE_WDT=y
CONFIG_ADVANTECH_WDT=y
CONFIG_ALIM1535_WDT=y
CONFIG_ALIM7101_WDT=y
CONFIG_SC520_WDT=y
CONFIG_IB700_WDT=y
CONFIG_IBMASR=y
CONFIG_WAFER_WDT=y
CONFIG_I6300ESB_WDT=y
CONFIG_ITCO_WDT=y
CONFIG_ITCO_VENDOR_SUPPORT=y
# CONFIG_IT8712F_WDT is not set
CONFIG_IT87_WDT=y
# CONFIG_HP_WATCHDOG is not set
CONFIG_SC1200_WDT=y
CONFIG_PC87413_WDT=y
CONFIG_RDC321X_WDT=y
# CONFIG_60XX_WDT is not set
CONFIG_SBC8360_WDT=y
# CONFIG_SBC7240_WDT is not set
# CONFIG_CPU5_WDT is not set
CONFIG_SMSC_SCH311X_WDT=y
CONFIG_SMSC37B787_WDT=y
CONFIG_W83627HF_WDT=y
# CONFIG_W83877F_WDT is not set
CONFIG_W83977F_WDT=y
CONFIG_MACHZ_WDT=y
CONFIG_SBC_EPX_C3_WATCHDOG=y

#
# ISA-based Watchdog Cards
#
# CONFIG_PCWATCHDOG is not set
CONFIG_MIXCOMWD=y

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set

#
# 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 is not set
CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
CONFIG_SSB_PCMCIAHOST=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=y
CONFIG_MFD_SM501_GPIO=y
# CONFIG_HTC_PASIC3 is not set
# CONFIG_UCB1400_CORE is not set
# CONFIG_TPS65010 is not set
CONFIG_TWL4030_CORE=y
# CONFIG_MFD_TMIO is not set
CONFIG_PMIC_DA903X=y
CONFIG_MFD_WM8400=y
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=y
CONFIG_PCF50633_GPIO=y
CONFIG_AB3100_CORE=y
# CONFIG_REGULATOR is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_ALI=y
# CONFIG_AGP_ATI is not set
CONFIG_AGP_AMD=y
# CONFIG_AGP_AMD64 is not set
# CONFIG_AGP_INTEL is not set
CONFIG_AGP_NVIDIA=y
# CONFIG_AGP_SIS is not set
# CONFIG_AGP_SWORKS is not set
CONFIG_AGP_VIA=y
CONFIG_AGP_EFFICEON=y
CONFIG_DRM=y
CONFIG_DRM_TDFX=y
# CONFIG_DRM_R128 is not set
# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_MGA is not set
CONFIG_DRM_SIS=y
# CONFIG_DRM_VIA is not set
CONFIG_DRM_SAVAGE=y
CONFIG_VGASTATE=y
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
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_HECUBA=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=y
CONFIG_FB_PM2_FIFO_DISCONNECT=y
CONFIG_FB_CYBER2000=y
CONFIG_FB_ARC=y
CONFIG_FB_IMSTT=y
# CONFIG_FB_UVESA is not set
CONFIG_FB_N411=y
# CONFIG_FB_HGA is not set
CONFIG_FB_S1D13XXX=y
CONFIG_FB_NVIDIA=y
CONFIG_FB_NVIDIA_I2C=y
# CONFIG_FB_NVIDIA_DEBUG is not set
# CONFIG_FB_NVIDIA_BACKLIGHT is not set
CONFIG_FB_RIVA=y
CONFIG_FB_RIVA_I2C=y
CONFIG_FB_RIVA_DEBUG=y
CONFIG_FB_RIVA_BACKLIGHT=y
CONFIG_FB_LE80578=y
CONFIG_FB_CARILLO_RANCH=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=y
CONFIG_FB_MATROX_MAVEN=y
# CONFIG_FB_MATROX_MULTIHEAD is not set
CONFIG_FB_ATY128=y
CONFIG_FB_ATY128_BACKLIGHT=y
CONFIG_FB_ATY=y
# CONFIG_FB_ATY_CT is not set
CONFIG_FB_ATY_GX=y
CONFIG_FB_ATY_BACKLIGHT=y
# CONFIG_FB_S3 is not set
CONFIG_FB_SAVAGE=y
CONFIG_FB_SAVAGE_I2C=y
# CONFIG_FB_SAVAGE_ACCEL is not set
CONFIG_FB_SIS=y
CONFIG_FB_SIS_300=y
CONFIG_FB_SIS_315=y
CONFIG_FB_VIA=y
CONFIG_FB_NEOMAGIC=y
# CONFIG_FB_KYRO is not set
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=y
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
CONFIG_FB_GEODE=y
CONFIG_FB_GEODE_LX=y
CONFIG_FB_GEODE_GX=y
CONFIG_FB_GEODE_GX1=y
CONFIG_FB_TMIO=y
CONFIG_FB_TMIO_ACCELL=y
CONFIG_FB_SM501=y
# CONFIG_FB_METRONOME is not set
CONFIG_FB_MB862XX=y
# CONFIG_FB_MB862XX_PCI_GDC is not set
CONFIG_FB_BROADSHEET=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=y
# CONFIG_BACKLIGHT_PROGEAR is not set
CONFIG_BACKLIGHT_DA903X=y
CONFIG_BACKLIGHT_MBP_NVIDIA=y
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 is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
# CONFIG_LOGO_LINUX_VGA16 is not set
CONFIG_LOGO_LINUX_CLUT224=y
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=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=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
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=y
CONFIG_SND_PCM_XRUN_DEBUG=y
CONFIG_SND_VMASTER=y
CONFIG_SND_RAWMIDI_SEQ=y
CONFIG_SND_OPL3_LIB_SEQ=y
CONFIG_SND_OPL4_LIB_SEQ=y
CONFIG_SND_SBAWE_SEQ=y
# CONFIG_SND_EMU10K1_SEQ is not set
CONFIG_SND_MPU401_UART=y
CONFIG_SND_OPL3_LIB=y
CONFIG_SND_OPL4_LIB=y
CONFIG_SND_VX_LIB=y
CONFIG_SND_AC97_CODEC=y
CONFIG_SND_DRIVERS=y
# CONFIG_SND_DUMMY is not set
CONFIG_SND_VIRMIDI=y
CONFIG_SND_SERIAL_U16550=y
CONFIG_SND_MPU401=y
CONFIG_SND_AC97_POWER_SAVE=y
CONFIG_SND_AC97_POWER_SAVE_DEFAULT=0
CONFIG_SND_WSS_LIB=y
CONFIG_SND_SB_COMMON=y
CONFIG_SND_SB8_DSP=y
CONFIG_SND_SB16_DSP=y
CONFIG_SND_ISA=y
CONFIG_SND_ADLIB=y
# CONFIG_SND_AD1816A is not set
# CONFIG_SND_AD1848 is not set
# CONFIG_SND_ALS100 is not set
CONFIG_SND_AZT2320=y
CONFIG_SND_CMI8330=y
CONFIG_SND_CS4231=y
CONFIG_SND_CS4236=y
CONFIG_SND_DT019X=y
CONFIG_SND_ES968=y
CONFIG_SND_ES1688=y
# CONFIG_SND_ES18XX is not set
# CONFIG_SND_SC6000 is not set
CONFIG_SND_GUSCLASSIC=y
# CONFIG_SND_GUSEXTREME is not set
CONFIG_SND_GUSMAX=y
CONFIG_SND_INTERWAVE=y
CONFIG_SND_INTERWAVE_STB=y
CONFIG_SND_OPL3SA2=y
CONFIG_SND_OPTI92X_AD1848=y
CONFIG_SND_OPTI92X_CS4231=y
CONFIG_SND_OPTI93X=y
CONFIG_SND_MIRO=y
CONFIG_SND_SB8=y
# CONFIG_SND_SB16 is not set
CONFIG_SND_SBAWE=y
CONFIG_SND_SB16_CSP=y
CONFIG_SND_SGALAXY=y
CONFIG_SND_SSCAPE=y
CONFIG_SND_WAVEFRONT=y
CONFIG_SND_MSND_PINNACLE=y
CONFIG_SND_MSND_CLASSIC=y
CONFIG_SND_PCI=y
CONFIG_SND_AD1889=y
CONFIG_SND_ALS300=y
CONFIG_SND_ALS4000=y
CONFIG_SND_ALI5451=y
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
CONFIG_SND_AU8820=y
CONFIG_SND_AU8830=y
CONFIG_SND_AW2=y
CONFIG_SND_AZT3328=y
CONFIG_SND_BT87X=y
CONFIG_SND_BT87X_OVERCLOCK=y
CONFIG_SND_CA0106=y
CONFIG_SND_CMIPCI=y
CONFIG_SND_OXYGEN_LIB=y
# CONFIG_SND_OXYGEN is not set
CONFIG_SND_CS4281=y
CONFIG_SND_CS46XX=y
CONFIG_SND_CS46XX_NEW_DSP=y
# CONFIG_SND_CS5530 is not set
# CONFIG_SND_CS5535AUDIO is not set
CONFIG_SND_CTXFI=y
# CONFIG_SND_DARLA20 is not set
CONFIG_SND_GINA20=y
CONFIG_SND_LAYLA20=y
CONFIG_SND_DARLA24=y
CONFIG_SND_GINA24=y
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
CONFIG_SND_ECHO3G=y
# CONFIG_SND_INDIGO is not set
CONFIG_SND_INDIGOIO=y
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
CONFIG_SND_INDIGODJX=y
# CONFIG_SND_EMU10K1 is not set
CONFIG_SND_EMU10K1X=y
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
CONFIG_SND_ES1938=y
CONFIG_SND_ES1968=y
CONFIG_SND_FM801=y
# CONFIG_SND_HDA_INTEL is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
CONFIG_SND_HIFIER=y
CONFIG_SND_ICE1712=y
CONFIG_SND_ICE1724=y
# CONFIG_SND_INTEL8X0 is not set
CONFIG_SND_INTEL8X0M=y
CONFIG_SND_KORG1212=y
CONFIG_SND_LX6464ES=y
CONFIG_SND_MAESTRO3=y
CONFIG_SND_MIXART=y
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
CONFIG_SND_RME32=y
CONFIG_SND_RME96=y
CONFIG_SND_RME9652=y
# CONFIG_SND_SIS7019 is not set
CONFIG_SND_SONICVIBES=y
CONFIG_SND_TRIDENT=y
CONFIG_SND_VIA82XX=y
CONFIG_SND_VIA82XX_MODEM=y
# CONFIG_SND_VIRTUOSO is not set
CONFIG_SND_VX222=y
# CONFIG_SND_YMFPCI is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
# CONFIG_SND_USB_USX2Y is not set
CONFIG_SND_USB_CAIAQ=y
CONFIG_SND_USB_CAIAQ_INPUT=y
CONFIG_SND_USB_US122L=y
CONFIG_SND_PCMCIA=y
# CONFIG_SND_VXPOCKET is not set
CONFIG_SND_PDAUDIOCF=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_I2C_AND_SPI=y
CONFIG_SND_SOC_ALL_CODECS=y
CONFIG_SND_SOC_AD73311=y
CONFIG_SND_SOC_AK4535=y
CONFIG_SND_SOC_CS4270=y
CONFIG_SND_SOC_L3=y
CONFIG_SND_SOC_PCM3008=y
CONFIG_SND_SOC_SPDIF=y
CONFIG_SND_SOC_SSM2602=y
CONFIG_SND_SOC_TLV320AIC23=y
CONFIG_SND_SOC_TLV320AIC3X=y
CONFIG_SND_SOC_TWL4030=y
CONFIG_SND_SOC_UDA134X=y
CONFIG_SND_SOC_UDA1380=y
CONFIG_SND_SOC_WM8400=y
CONFIG_SND_SOC_WM8510=y
CONFIG_SND_SOC_WM8580=y
CONFIG_SND_SOC_WM8728=y
CONFIG_SND_SOC_WM8731=y
CONFIG_SND_SOC_WM8750=y
CONFIG_SND_SOC_WM8753=y
CONFIG_SND_SOC_WM8900=y
CONFIG_SND_SOC_WM8903=y
CONFIG_SND_SOC_WM8940=y
CONFIG_SND_SOC_WM8960=y
CONFIG_SND_SOC_WM8971=y
CONFIG_SND_SOC_WM8988=y
CONFIG_SND_SOC_WM8990=y
CONFIG_SND_SOC_WM9081=y
CONFIG_SOUND_PRIME=y
# CONFIG_SOUND_OSS is not set
CONFIG_AC97_BUS=y
# CONFIG_HID_SUPPORT is not set
CONFIG_USB_MOUSE=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 is not set
# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
CONFIG_USB_DYNAMIC_MINORS=y
# CONFIG_USB_SUSPEND is not set
# CONFIG_USB_OTG is not set
# CONFIG_USB_OTG_WHITELIST is not set
CONFIG_USB_OTG_BLACKLIST_HUB=y
# CONFIG_USB_MON is not set
CONFIG_USB_WUSB=y
CONFIG_USB_WUSB_CBAF=y
CONFIG_USB_WUSB_CBAF_DEBUG=y

#
# 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=y
# 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=y
# CONFIG_USB_SL811_HCD is not set
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_HWA_HCD=y

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=y
# CONFIG_USB_WDM is not set
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 is not set
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y

#
# USB port drivers
#
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_EZUSB=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_AIRCABLE=y
# CONFIG_USB_SERIAL_ARK3116 is not set
CONFIG_USB_SERIAL_BELKIN=y
CONFIG_USB_SERIAL_CH341=y
# CONFIG_USB_SERIAL_WHITEHEAT is not set
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=y
CONFIG_USB_SERIAL_CP210X=y
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 is not set
# CONFIG_USB_SERIAL_EDGEPORT is not set
CONFIG_USB_SERIAL_EDGEPORT_TI=y
CONFIG_USB_SERIAL_GARMIN=y
CONFIG_USB_SERIAL_IPW=y
# CONFIG_USB_SERIAL_IUU is not set
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=y
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=y
CONFIG_USB_SERIAL_PL2303=y
CONFIG_USB_SERIAL_OTI6858=y
CONFIG_USB_SERIAL_QUALCOMM=y
# CONFIG_USB_SERIAL_SPCP8X5 is not set
CONFIG_USB_SERIAL_HP4X=y
# CONFIG_USB_SERIAL_SAFE is not set
CONFIG_USB_SERIAL_SIEMENS_MPI=y
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
# CONFIG_USB_SERIAL_SYMBOL is not set
CONFIG_USB_SERIAL_TI=y
CONFIG_USB_SERIAL_CYBERJACK=y
# CONFIG_USB_SERIAL_XIRCOM is not set
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_SERIAL_OMNINET=y
# CONFIG_USB_SERIAL_OPTICON is not set
CONFIG_USB_SERIAL_DEBUG=y

#
# 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 is not set
CONFIG_USB_LCD=y
CONFIG_USB_BERRY_CHARGE=y
CONFIG_USB_LED=y
# CONFIG_USB_CYPRESS_CY7C63 is not set
# CONFIG_USB_CYTHERM is not set
# CONFIG_USB_IDMOUSE is not set
CONFIG_USB_FTDI_ELAN=y
CONFIG_USB_APPLEDISPLAY=y
CONFIG_USB_SISUSBVGA=y
# CONFIG_USB_SISUSBVGA_CON is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
CONFIG_USB_IOWARRIOR=y
# CONFIG_USB_TEST is not set
CONFIG_USB_ISIGHTFW=y
CONFIG_USB_VST=y
CONFIG_USB_ATM=y
CONFIG_USB_SPEEDTOUCH=y
CONFIG_USB_CXACRU=y
# CONFIG_USB_UEAGLEATM is not set
# CONFIG_USB_XUSBATM is not set

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
# CONFIG_USB_GPIO_VBUS is not set
CONFIG_NOP_USB_XCEIV=y
CONFIG_UWB=y
CONFIG_UWB_HWA=y
# CONFIG_UWB_WHCI is not set
CONFIG_UWB_WLP=y
CONFIG_UWB_I1480U=y
CONFIG_UWB_I1480U_WLP=y
# CONFIG_MMC is not set
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
CONFIG_ACCESSIBILITY=y
CONFIG_A11Y_BRAILLE_CONSOLE=y
CONFIG_INFINIBAND=y
CONFIG_INFINIBAND_USER_MAD=y
CONFIG_INFINIBAND_USER_ACCESS=y
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_MTHCA=y
CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_AMSO1100=y
# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set
CONFIG_MLX4_INFINIBAND=y
CONFIG_INFINIBAND_NES=y
CONFIG_INFINIBAND_NES_DEBUG=y
# CONFIG_INFINIBAND_IPOIB is not set
CONFIG_INFINIBAND_SRP=y
CONFIG_INFINIBAND_ISER=y
# CONFIG_EDAC is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_DEBUG=y

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
# CONFIG_RTC_INTF_DEV is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_DS1374=y
CONFIG_RTC_DRV_DS1672=y
CONFIG_RTC_DRV_MAX6900=y
CONFIG_RTC_DRV_RS5C372=y
CONFIG_RTC_DRV_ISL1208=y
CONFIG_RTC_DRV_X1205=y
# CONFIG_RTC_DRV_PCF8563 is not set
CONFIG_RTC_DRV_PCF8583=y
CONFIG_RTC_DRV_M41T80=y
# CONFIG_RTC_DRV_M41T80_WDT is not set
# CONFIG_RTC_DRV_TWL4030 is not set
CONFIG_RTC_DRV_S35390A=y
CONFIG_RTC_DRV_FM3130=y
CONFIG_RTC_DRV_RX8581=y
CONFIG_RTC_DRV_RX8025=y

#
# SPI RTC drivers
#

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
CONFIG_RTC_DRV_DS1286=y
CONFIG_RTC_DRV_DS1511=y
CONFIG_RTC_DRV_DS1553=y
CONFIG_RTC_DRV_DS1742=y
# CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86=y
# CONFIG_RTC_DRV_M48T35 is not set
CONFIG_RTC_DRV_M48T59=y
# CONFIG_RTC_DRV_BQ4802 is not set
CONFIG_RTC_DRV_V3020=y
CONFIG_RTC_DRV_PCF50633=y

#
# on-CPU RTC drivers
#
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_UIO is not set

#
# TI VLYNQ
#
CONFIG_X86_PLATFORM_DEVICES=y

#
# Firmware Drivers
#
CONFIG_EDD=y
CONFIG_EDD_OFF=y
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_DELL_RBU is not set
CONFIG_DCDBAS=y
CONFIG_ISCSI_IBFT_FIND=y
CONFIG_ISCSI_IBFT=y

#
# File systems
#
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
# CONFIG_EXT2_FS_XIP is not set
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=y
# CONFIG_EXT4DEV_COMPAT is not set
# CONFIG_EXT4_FS_XATTR is not set
CONFIG_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_JBD2=y
CONFIG_JBD2_DEBUG=y
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
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=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
CONFIG_XFS_DEBUG=y
# CONFIG_OCFS2_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
# CONFIG_INOTIFY_USER is not set
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
CONFIG_PRINT_QUOTA_WARNING=y
CONFIG_QUOTA_TREE=y
CONFIG_QFMT_V1=y
CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
# CONFIG_AUTOFS_FS is not set
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_CUSE=y

#
# Caches
#
CONFIG_FSCACHE=y
CONFIG_FSCACHE_STATS=y
# CONFIG_FSCACHE_HISTOGRAM is not set
# CONFIG_FSCACHE_DEBUG is not set
# CONFIG_CACHEFILES is not set

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
# CONFIG_MSDOS_FS is not set
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 is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
# CONFIG_TMPFS is not set
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=y
CONFIG_ACORN_PARTITION_EESOX=y
# CONFIG_ACORN_PARTITION_ICS is not set
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
# CONFIG_ATARI_PARTITION is not set
# CONFIG_MAC_PARTITION is not set
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_LDM_PARTITION=y
CONFIG_LDM_DEBUG=y
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
# CONFIG_SUN_PARTITION is not set
# CONFIG_KARMA_PARTITION is not set
CONFIG_EFI_PARTITION=y
CONFIG_SYSV68_PARTITION=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
CONFIG_NLS_CODEPAGE_737=y
CONFIG_NLS_CODEPAGE_775=y
CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_852 is not set
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
CONFIG_NLS_CODEPAGE_860=y
CONFIG_NLS_CODEPAGE_861=y
CONFIG_NLS_CODEPAGE_862=y
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
CONFIG_NLS_CODEPAGE_865=y
CONFIG_NLS_CODEPAGE_866=y
CONFIG_NLS_CODEPAGE_869=y
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=y
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
CONFIG_NLS_CODEPAGE_1251=y
# CONFIG_NLS_ASCII is not set
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=y
CONFIG_NLS_ISO8859_5=y
CONFIG_NLS_ISO8859_6=y
CONFIG_NLS_ISO8859_7=y
# CONFIG_NLS_ISO8859_9 is not set
CONFIG_NLS_ISO8859_13=y
# CONFIG_NLS_ISO8859_14 is not set
CONFIG_NLS_ISO8859_15=y
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y
# CONFIG_DLM is not set

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
# CONFIG_ALLOW_WARNINGS is not set
CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
# CONFIG_UNUSED_SYMBOLS is not set
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=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1
# CONFIG_DETECT_HUNG_TASK is not set
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
# CONFIG_TIMER_STATS is not set
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SLUB_DEBUG_ON is not set
CONFIG_SLUB_STATS=y
# CONFIG_DEBUG_RT_MUTEXES is not set
CONFIG_RT_MUTEX_TESTER=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
# CONFIG_PROVE_LOCKING is not set
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
# CONFIG_DEBUG_LOCKDEP is not set
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
CONFIG_DEBUG_HIGHMEM=y
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 is not set
CONFIG_RCU_TORTURE_TEST=y
CONFIG_RCU_TORTURE_TEST_RUNNABLE=y
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
CONFIG_BACKTRACE_SELF_TEST=y
CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAULT_INJECTION_DEBUG_FS=y
# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set
CONFIG_LATENCYTOP=y
CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=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_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=y
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
CONFIG_POWER_TRACER=y
CONFIG_KSYM_TRACER=y
CONFIG_PROFILE_KSYM_TRACER=y
CONFIG_STACK_TRACER=y
CONFIG_KMEMTRACE=y
# CONFIG_WORKQUEUE_TRACER is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_DYNAMIC_FTRACE is not set
CONFIG_FUNCTION_PROFILER=y
# CONFIG_FTRACE_STARTUP_TEST is not set
CONFIG_MMIOTRACE=y
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
CONFIG_BUILD_DOCSRC=y
CONFIG_DYNAMIC_DEBUG=y
# CONFIG_DMA_API_DEBUG is not set
CONFIG_SAMPLES=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
# CONFIG_KGDB_SERIAL_CONSOLE is not set
# CONFIG_KGDB_TESTS is not set
CONFIG_HAVE_ARCH_KMEMCHECK=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_STACKOVERFLOW=y
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_X86_PTDUMP is not set
# CONFIG_DEBUG_RODATA is not set
# CONFIG_4KSTACKS is not set
CONFIG_DOUBLEFAULT=y
CONFIG_IOMMU_STRESS=y
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 is not set
CONFIG_CPA_DEBUG=y
# CONFIG_OPTIMIZE_INLINING is not set

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
# CONFIG_SECURITY_NETWORK_XFRM is not set
CONFIG_SECURITY_PATH=y
CONFIG_SECURITY_FILE_CAPABILITIES=y
# CONFIG_SECURITY_SELINUX is not set
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=y
CONFIG_CRYPTO_AUTHENC=y

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
# CONFIG_CRYPTO_PCBC is not set
CONFIG_CRYPTO_XTS=y

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_XCBC=y

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32C_INTEL is not set
CONFIG_CRYPTO_MD4=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
CONFIG_CRYPTO_RMD128=y
# CONFIG_CRYPTO_RMD160 is not set
CONFIG_CRYPTO_RMD256=y
# CONFIG_CRYPTO_RMD320 is not set
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_TGR192 is not set
# CONFIG_CRYPTO_WP512 is not set

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_586=y
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_CAST5=y
CONFIG_CRYPTO_CAST6=y
CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_KHAZAD is not set
CONFIG_CRYPTO_SALSA20=y
CONFIG_CRYPTO_SALSA20_586=y
CONFIG_CRYPTO_SEED=y
CONFIG_CRYPTO_SERPENT=y
# CONFIG_CRYPTO_TEA is not set
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
# CONFIG_CRYPTO_TWOFISH_586 is not set

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
# CONFIG_CRYPTO_ZLIB is not set
# CONFIG_CRYPTO_LZO is not set

#
# Random Number Generation
#
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_HW=y
CONFIG_CRYPTO_DEV_PADLOCK=y
CONFIG_CRYPTO_DEV_PADLOCK_AES=y
CONFIG_CRYPTO_DEV_PADLOCK_SHA=y
CONFIG_CRYPTO_DEV_GEODE=y
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 is not set
CONFIG_LGUEST=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_PCI=y
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 is not set
CONFIG_LIBCRC32C=y
CONFIG_AUDIT_GENERIC=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=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] 1150+ messages in thread

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-08 15:01                             ` Ingo Molnar
@ 2009-08-08 23:21                               ` Paul E. McKenney
  0 siblings, 0 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-08 23:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx

On Sat, Aug 08, 2009 at 05:01:03PM +0200, Ingo Molnar wrote:
> 
> * tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> 
> > Commit-ID:  0d84abdae6740ee5290a7a523ee35916f65e16ec
> > Gitweb:     http://git.kernel.org/tip/0d84abdae6740ee5290a7a523ee35916f65e16ec
> > Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > AuthorDate: Wed, 5 Aug 2009 18:26:45 -0700
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sat, 8 Aug 2009 16:51:08 +0200
> > 
> > rcu: Add second diagnostic check for a possible CPU-hotplug race
> 
> hm, got this build failure in -tip testing:
> 
> kernel/rcupdate.c: In function ‘rcu_cpu_notified’:
> kernel/rcupdate.c:251: error: implicit declaration of function ‘cpu_notified’
> 
> with the config below.

Gah...  I didn't take !CONFIG_HOTPLUG_CPU into account.  Fix below.

							Thanx, Paul

------------------------------------------------------------------------

Fix build breakage in diagnostic patch.

Move cpu_notified() declaration out from under #ifdef.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 cpu.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index d9b3c18..1b1c30c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -45,13 +45,13 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
 extern void unregister_cpu(struct cpu *cpu);
 #endif
 struct notifier_block;
+extern int cpu_notified(int (*fn)(struct notifier_block *, unsigned long, void *));
 
 #ifdef CONFIG_SMP
 /* Need to know about CPUs going up/down? */
 #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 raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
 		int (*fn)(struct notifier_block *, unsigned long, void *));
 #else

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

* [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-06  1:26                         ` Paul E. McKenney
  2009-08-06  2:51                           ` Gautham R Shenoy
  2009-08-08 14:57                           ` [tip:core/rcu] rcu: Add second " tip-bot for Paul E. McKenney
@ 2009-08-09 10:54                           ` tip-bot for Paul E. McKenney
  2009-08-09 11:00                             ` Ingo Molnar
  2 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Paul E. McKenney @ 2009-08-09 10:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, paulmck, hpa, mingo, tglx, mingo

Commit-ID:  86f044729ee3e4d8885c17371ce5a76f6f321dc7
Gitweb:     http://git.kernel.org/tip/86f044729ee3e4d8885c17371ce5a76f6f321dc7
Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Wed, 5 Aug 2009 18:26:45 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 9 Aug 2009 12:42:48 +0200

rcu: Add second diagnostic check for a possible CPU-hotplug race

Create an rcu_cpu_notified() API that checks to see whether RCU's
CPU-hotplug notifier is registered.  This is used in three WARN_ON_ONCE()
calls, the first of which should trigger, and the second two of
which should not -- but I suspect that the WARN_ON_ONCE() located in
__rcu_process_callbacks() will in fact trigger on the machine suffering
from this bug.  ;-)

Any code path that executes after rcu_init() should have RCU CPU-hotplug
notifiers registered, so any triggering of the following WARN_ON_ONCE()
after rcu_init() is a bug:

	WARN_ON_ONCE(!rcu_cpu_notified());

-v2: fix build error

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: ego@in.ibm.com
LKML-Reference: <20090806012645.GA24800@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/cpu.h      |    3 +++
 include/linux/rcupdate.h |    1 +
 kernel/cpu.c             |    5 +++++
 kernel/notifier.c        |   23 +++++++++++++++++++++++
 kernel/rcupdate.c        |    9 ++++++++-
 kernel/rcutree.c         |    1 +
 6 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e0..1b1c30c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -45,12 +45,15 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
 extern void unregister_cpu(struct cpu *cpu);
 #endif
 struct notifier_block;
+extern int cpu_notified(int (*fn)(struct notifier_block *, unsigned long, void *));
 
 #ifdef CONFIG_SMP
 /* Need to know about CPUs going up/down? */
 #ifdef CONFIG_HOTPLUG_CPU
 extern int register_cpu_notifier(struct notifier_block *nb);
 extern void unregister_cpu_notifier(struct notifier_block *nb);
+extern int raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *));
 #else
 
 #ifndef MODULE
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 3c89d6a..f790f3c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,6 +65,7 @@ extern void rcu_init(void);
 extern void rcu_scheduler_starting(void);
 extern int rcu_needs_cpu(int cpu);
 extern int rcu_scheduler_active;
+extern int rcu_cpu_notified(void);
 
 #if defined(CONFIG_TREE_RCU)
 #include <linux/rcutree.h>
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 8ce1004..5aa736a 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 raw_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..d72c0b8 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -59,6 +59,29 @@ static int notifier_chain_unregister(struct notifier_block **nl,
 	return -ENOENT;
 }
 
+static int notifier_chain_is_registered(struct notifier_block *nl,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	rcu_read_lock();
+	/* printk(KERN_ALERT "notifier_chain_is_registered looking for: %pS\n", fn); */
+	while (nl != NULL) {
+		/* printk(KERN_ALERT "notifier_chain_is_registered: %pS\n", rcu_dereference(nl)->notifier_call); */
+		if (rcu_dereference(nl)->notifier_call == fn) {
+			rcu_read_unlock();
+			return 1;
+		}
+		nl = (rcu_dereference(nl)->next);
+	}
+	rcu_read_unlock();
+	return 0;
+}
+
+int raw_notifier_chain_is_registered(struct raw_notifier_head *nh,
+		int (*fn)(struct notifier_block *, unsigned long, void *))
+{
+	return notifier_chain_is_registered(nh->head, fn);
+}
+
 /**
  * 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 9f0584e..57a4626 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);
@@ -246,12 +246,19 @@ static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
 	return NOTIFY_OK;
 }
 
+int rcu_cpu_notified(void)
+{
+	return cpu_notified(rcu_barrier_cpu_hotplug);
+}
+
 void __init rcu_init(void)
 {
 	int i;
 
 	__rcu_init();
+	WARN_ON_ONCE(!rcu_cpu_notified()); /* this one expected to trigger. */
 	hotcpu_notifier(rcu_barrier_cpu_hotplug, 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * We don't need protection against CPU-hotplug here because
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index b9b1928..a0bfc93 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1133,6 +1133,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
 	unsigned long flags;
 
 	WARN_ON_ONCE(rdp->beenonline == 0);
+	WARN_ON_ONCE(!rcu_cpu_notified());
 
 	/*
 	 * If an RCU GP has gone long enough, go check for dyntick

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

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-09 10:54                           ` tip-bot for Paul E. McKenney
@ 2009-08-09 11:00                             ` Ingo Molnar
  2009-08-09 11:10                               ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-09 11:00 UTC (permalink / raw)
  To: mingo, hpa, paulmck, linux-kernel, tglx; +Cc: linux-tip-commits


* tip-bot for Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> Commit-ID:  86f044729ee3e4d8885c17371ce5a76f6f321dc7
> Gitweb:     http://git.kernel.org/tip/86f044729ee3e4d8885c17371ce5a76f6f321dc7
> Author:     Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> AuthorDate: Wed, 5 Aug 2009 18:26:45 -0700
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 9 Aug 2009 12:42:48 +0200
> 
> rcu: Add second diagnostic check for a possible CPU-hotplug race

has a build problem too:

 kernel/built-in.o: In function `rcu_cpu_notified':
 (.text+0x1d787): undefined reference to `cpu_notified'
 kernel/built-in.o: In function `rcu_init':
 (.init.text+0x1174): undefined reference to `cpu_notified'
 kernel/built-in.o: In function `rcu_init':
 (.init.text+0x11a8): undefined reference to `cpu_notified'

Maybe we should simplify all those Kconfig rules? It's a maze.

	Ingo

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

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-09 11:00                             ` Ingo Molnar
@ 2009-08-09 11:10                               ` Ingo Molnar
  2009-08-09 18:30                                 ` Paul E. McKenney
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-09 11:10 UTC (permalink / raw)
  To: mingo, hpa, paulmck, linux-kernel, tglx; +Cc: linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 133214 bytes --]


* Ingo Molnar <mingo@elte.hu> wrote:

> > rcu: Add second diagnostic check for a possible CPU-hotplug race
> 
> has a build problem too:
> 
>  kernel/built-in.o: In function `rcu_cpu_notified':
>  (.text+0x1d787): undefined reference to `cpu_notified'
>  kernel/built-in.o: In function `rcu_init':
>  (.init.text+0x1174): undefined reference to `cpu_notified'
>  kernel/built-in.o: In function `rcu_init':
>  (.init.text+0x11a8): undefined reference to `cpu_notified'
> 
> Maybe we should simplify all those Kconfig rules? It's a maze.

a testbox still managed to sneak in, build another config, boot it 
and trigger the warning below - is this what you were after? Bootlog 
below, config attached.

	Ingo

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.31-rc5-tip (mingo@europe) (gcc version 4.2.2) #7134 SMP Sun Aug 9 13:04:19 CEST 2009
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   NSC Geode by NSC
[    0.000000]   Cyrix CyrixInstead
[    0.000000]   Centaur CentaurHauls
[    0.000000]   Transmeta GenuineTMx86
[    0.000000]   Transmeta TransmetaCPU
[    0.000000]   UMC UMC UMC UMC
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
[    0.000000]  BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000d2000 - 00000000000d4000 (reserved)
[    0.000000]  BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000007f6e0000 (usable)
[    0.000000]  BIOS-e820: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
[    0.000000]  BIOS-e820: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000007f700000 - 0000000080000000 (reserved)
[    0.000000]  BIOS-e820: 00000000f0000000 - 00000000f4000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  BIOS-e820: 00000000fed14000 - 00000000fed1a000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed90000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000ff800000 - 0000000100000000 (reserved)
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] DMI present.
[    0.000000] last_pfn = 0x7f6e0 max_arch_pfn = 0x100000
[    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-CFFFF write-protect
[    0.000000]   D0000-DBFFF uncachable
[    0.000000]   DC000-DFFFF write-back
[    0.000000]   E0000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000 mask F80000000 write-back
[    0.000000]   1 base 07F700000 mask FFFF00000 uncachable
[    0.000000]   2 base 07F800000 mask FFF800000 uncachable
[    0.000000]   3 disabled
[    0.000000]   4 disabled
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] PAT not supported by CPU.
[    0.000000] e820 update range: 0000000000002000 - 0000000000006000 (usable) ==> (reserved)
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] modified physical RAM map:
[    0.000000]  modified: 0000000000000000 - 0000000000002000 (usable)
[    0.000000]  modified: 0000000000002000 - 0000000000006000 (reserved)
[    0.000000]  modified: 0000000000006000 - 000000000009f000 (usable)
[    0.000000]  modified: 000000000009f000 - 00000000000a0000 (reserved)
[    0.000000]  modified: 00000000000d2000 - 00000000000d4000 (reserved)
[    0.000000]  modified: 00000000000dc000 - 0000000000100000 (reserved)
[    0.000000]  modified: 0000000000100000 - 000000007f6e0000 (usable)
[    0.000000]  modified: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
[    0.000000]  modified: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
[    0.000000]  modified: 000000007f700000 - 0000000080000000 (reserved)
[    0.000000]  modified: 00000000f0000000 - 00000000f4000000 (reserved)
[    0.000000]  modified: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  modified: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  modified: 00000000fed14000 - 00000000fed1a000 (reserved)
[    0.000000]  modified: 00000000fed1c000 - 00000000fed90000 (reserved)
[    0.000000]  modified: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  modified: 00000000ff800000 - 0000000100000000 (reserved)
[    0.000000] initial memory mapped : 0 - 01c00000
[    0.000000] init_memory_mapping: 0000000000000000-00000000377fe000
[    0.000000]  0000000000 - 0000400000 page 4k
[    0.000000]  0000400000 - 0037400000 page 2M
[    0.000000]  0037400000 - 00377fe000 page 4k
[    0.000000] kernel direct mapping tables up to 377fe000 @ 7000-c000
[    0.000000] ACPI: RSDP 000f68a0 00024 (v02 LENOVO)
[    0.000000] ACPI: XSDT 7f6e631f 00074 (v01 LENOVO TP-79    00001020  LTP 00000000)
[    0.000000] ACPI: FACP 7f6e6400 000F4 (v03 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI Warning: 32/64X length mismatch in Gpe1Block: 0/32 20090521 tbfadt-527
[    0.000000] ACPI Warning: Optional field Gpe1Block has zero address or length: 000000000000102C/0 20090521 tbfadt-558
[    0.000000] ACPI: DSDT 7f6e65e7 0C765 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
[    0.000000] ACPI: FACS 7f6f4000 00040
[    0.000000] ACPI: SSDT 7f6e65b4 00033 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
[    0.000000] ACPI: ECDT 7f6f2d4c 00052 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: TCPA 7f6f2d9e 00032 (v02 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: APIC 7f6f2dd0 00068 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: MCFG 7f6f2e38 0003E (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: HPET 7f6f2e76 00038 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: BOOT 7f6f2fd8 00028 (v01 LENOVO TP-79    00001020  LTP 00000001)
[    0.000000] ACPI: SSDT 7f6e58da 00507 (v01 LENOVO TP-79    00001020 INTL 20050513)
[    0.000000] ACPI: SSDT 7f6e5702 001D8 (v01 LENOVO TP-79    00001020 INTL 20050513)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] 1150MB HIGHMEM available.
[    0.000000] 887MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 377fe000
[    0.000000]   low ram: 0 - 377fe000
[    0.000000]   node 0 low ram: 00000000 - 377fe000
[    0.000000]   node 0 bootmap 00008000 - 0000ef00
[    0.000000] (8 early reservations) ==> bootmem [0000000000 - 00377fe000]
[    0.000000]   #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
[    0.000000]   #1 [0000001000 - 0000002000]    EX TRAMPOLINE ==> [0000001000 - 0000002000]
[    0.000000]   #2 [0000006000 - 0000007000]       TRAMPOLINE ==> [0000006000 - 0000007000]
[    0.000000]   #3 [0001000000 - 00018150c8]    TEXT DATA BSS ==> [0001000000 - 00018150c8]
[    0.000000]   #4 [000009f000 - 0000100000]    BIOS reserved ==> [000009f000 - 0000100000]
[    0.000000]   #5 [0001816000 - 000181d138]              BRK ==> [0001816000 - 000181d138]
[    0.000000]   #6 [0000007000 - 0000008000]          PGTABLE ==> [0000007000 - 0000008000]
[    0.000000]   #7 [0000008000 - 000000f000]          BOOTMAP ==> [0000008000 - 000000f000]
[    0.000000] Scan SMP from c0000000 for 1024 bytes.
[    0.000000] Scan SMP from c009fc00 for 1024 bytes.
[    0.000000] Scan SMP from c00f0000 for 65536 bytes.
[    0.000000] found SMP MP-table at [c00f68e0] f68e0
[    0.000000]   mpc: 9f5a1-9f6b5
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000000 -> 0x00001000
[    0.000000]   Normal   0x00001000 -> 0x000377fe
[    0.000000]   HighMem  0x000377fe -> 0x0007f6e0
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[3] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00000002
[    0.000000]     0: 0x00000006 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0007f6e0
[    0.000000] On node 0 totalpages: 521851
[    0.000000] free_area_init_node: node 0, pgdat c16f3c20, node_mem_map c181e000
[    0.000000]   DMA zone: 32 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 3963 pages, LIFO batch:0
[    0.000000]   Normal zone: 1744 pages used for memmap
[    0.000000]   Normal zone: 221486 pages, LIFO batch:31
[    0.000000]   HighMem zone: 2302 pages used for memmap
[    0.000000]   HighMem zone: 292324 pages, LIFO batch:31
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0x1008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] SMP: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] mapped APIC to ffffb000 (fee00000)
[    0.000000] mapped IOAPIC to ffffa000 (fec00000)
[    0.000000] nr_irqs_gsi: 24
[    0.000000] PM: Registered nosave memory: 0000000000002000 - 0000000000006000
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000d2000
[    0.000000] PM: Registered nosave memory: 00000000000d2000 - 00000000000d4000
[    0.000000] PM: Registered nosave memory: 00000000000d4000 - 00000000000dc000
[    0.000000] PM: Registered nosave memory: 00000000000dc000 - 0000000000100000
[    0.000000] Allocating PCI resources starting at 80000000 (gap: 80000000:70000000)
[    0.000000] NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
[    0.000000] PERCPU: Embedded 14 pages at c2818000, static data 33436 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 517773
[    0.000000] Kernel command line: root=/dev/sda1 console=tty profile=0 debug initcall_debug enforcing=0 apic=verbose sysrq_always_enabled ignore_loglevel selinux=1 relaxed_check=1 3 netconsole=4444@10.0.1.15/eth0,4444@10.0.1.21/00:30:48:c6:86:26
[    0.000000] kernel profiling enabled (shift: 0)
[    0.000000] debug: sysrq always enabled.
[    0.000000] PID hash table entries: 4096 (order: 12, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Enabling fast FPU save and restore... done.
[    0.000000] Enabling unmasked SIMD FPU exception support... done.
[    0.000000] Initializing CPU#0
[    0.000000] Initializing HighMem for node 0 (000377fe:0007f6e0)
[    0.000000] Memory: 2061020k/2087808k available (4496k kernel code, 25604k reserved, 2686k data, 376k init, 1178504k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff1f000 - 0xfffff000   ( 896 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
[    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
[    0.000000]       .init : 0xc170b000 - 0xc1769000   ( 376 kB)
[    0.000000]       .data : 0xc14643fd - 0xc1703f68   (2686 kB)
[    0.000000]       .text : 0xc1000000 - 0xc14643fd   (4496 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.000000] SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: at kernel/rcupdate.c:259 rcu_init+0x2b/0xa0()
[    0.000000] Hardware name: 1951A26
[    0.000000] Modules linked in:
[    0.000000] Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip #7134
[    0.000000] Call Trace:
[    0.000000]  [<c102ec3b>] warn_slowpath_common+0x60/0x77
[    0.000000]  [<c102ec5f>] warn_slowpath_null+0xd/0x10
[    0.000000]  [<c171c929>] rcu_init+0x2b/0xa0
[    0.000000]  [<c170b6f3>] start_kernel+0x184/0x2ca
[    0.000000]  [<c170b06a>] __init_begin+0x6a/0x6f
[    0.000000] ---[ end trace 4eaa2a86a8e2da22 ]---
[    0.000000] NR_IRQS:2304 nr_irqs:424
[    0.000000] Extended CMOS year: 2000
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 1828.477 MHz processor.
[    0.000999] Console: colour VGA+ 80x25
[    0.000999] console [tty0] enabled
[    0.000999] hpet clockevent registered
[    0.000999] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.000999] Calibrating delay loop (skipped), value calculated using timer frequency.. 3656.95 BogoMIPS (lpj=1828477)
[    0.000999] Security Framework initialized
[    0.000999] SELinux:  Initializing.
[    0.000999] SELinux:  Starting in permissive mode
[    0.000999] Mount-cache hash table entries: 512
[    0.000999] Initializing cgroup subsys ns
[    0.000999] Initializing cgroup subsys cpuacct
[    0.001013] Initializing cgroup subsys freezer
[    0.001119] CPU: L1 I cache: 32K, L1 D cache: 32K
[    0.001249] CPU: L2 cache: 2048K
[    0.001336] CPU: Physical Processor ID: 0
[    0.001422] CPU: Processor Core ID: 0
[    0.001510] mce: CPU supports 6 MCE banks
[    0.001605] CPU0: Thermal monitoring enabled (TM2)
[    0.001694] using mwait in idle threads.
[    0.001786] Performance Counters: no PMU driver, software counters only.
[    0.002005] Checking 'hlt' instruction... OK.
[    0.006584] ACPI: Core revision 20090521
[    0.027076] enabled ExtINT on CPU#0
[    0.028075] ENABLING IO-APIC IRQs
[    0.028161] init IO_APIC IRQs
[    0.028246]  1-0 (apicid-pin) not connected
[    0.028377] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.028508] IOAPIC[0]: Set routing entry (1-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
[    0.028640] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
[    0.028772] IOAPIC[0]: Set routing entry (1-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
[    0.028904] IOAPIC[0]: Set routing entry (1-5 -> 0x35 -> IRQ 5 Mode:0 Active:0)
[    0.029001] IOAPIC[0]: Set routing entry (1-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
[    0.029132] IOAPIC[0]: Set routing entry (1-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
[    0.029264] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.029397] IOAPIC[0]: Set routing entry (1-9 -> 0x39 -> IRQ 9 Mode:1 Active:0)
[    0.029528] IOAPIC[0]: Set routing entry (1-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
[    0.029659] IOAPIC[0]: Set routing entry (1-11 -> 0x3b -> IRQ 11 Mode:0 Active:0)
[    0.029791] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.029923] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.030000] IOAPIC[0]: Set routing entry (1-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
[    0.030131] IOAPIC[0]: Set routing entry (1-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
[    0.030261]  1-16 1-17 1-18 1-19 1-20 1-21 1-22 1-23 (apicid-pin) not connected
[    0.030875] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.041069] CPU0: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
[    0.041248] Using local APIC timer interrupts.
[    0.041250] calibrating APIC timer ...
[    0.041993] ... lapic delta = 1039050
[    0.041993] ... PM-Timer delta = 357950
[    0.041993] ... PM-Timer result ok
[    0.041993] ..... delta 1039050
[    0.041993] ..... mult: 44633642
[    0.041993] ..... calibration result: 166248
[    0.041993] ..... CPU clock speed is 1828.0727 MHz.
[    0.041993] ..... host bus clock speed is 166.0248 MHz.
[    0.041993] calling  migration_init+0x0/0x47 @ 1
[    0.041993] initcall migration_init+0x0/0x47 returned 0 after 0 usecs
[    0.041993] calling  spawn_ksoftirqd+0x0/0x47 @ 1
[    0.041993] initcall spawn_ksoftirqd+0x0/0x47 returned 0 after 0 usecs
[    0.041993] calling  init_call_single_data+0x0/0x6d @ 1
[    0.041993] initcall init_call_single_data+0x0/0x6d returned 0 after 0 usecs
[    0.041993] calling  relay_init+0x0/0x11 @ 1
[    0.041993] initcall relay_init+0x0/0x11 returned 0 after 0 usecs
[    0.041993] calling  tracer_alloc_buffers+0x0/0x12d @ 1
[    0.041993] initcall tracer_alloc_buffers+0x0/0x12d returned 0 after 0 usecs
[    0.041998] calling  init_trace_printk+0x0/0xf @ 1
[    0.042087] initcall init_trace_printk+0x0/0xf returned 0 after 0 usecs
[    0.042253] Booting processor 1 APIC 0x1 ip 0x6000
[    0.000999] Initializing CPU#1
[    0.000999] masked ExtINT on CPU#1
[    0.000999] Calibrating delay using timer specific routine.. 3657.34 BogoMIPS (lpj=1828674)
[    0.000999] CPU: L1 I cache: 32K, L1 D cache: 32K
[    0.000999] CPU: L2 cache: 2048K
[    0.000999] CPU: Physical Processor ID: 0
[    0.000999] CPU: Processor Core ID: 1
[    0.000999] mce: CPU supports 6 MCE banks
[    0.000999] CPU1: Thermal monitoring enabled (TM2)
[    0.113434] CPU1: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
[    0.114126] checking TSC synchronization [CPU#0 -> CPU#1]:
[    0.114982] Measured 579865 cycles TSC warp between CPUs, turning off TSC clock.
[    0.114982] Marking TSC unstable due to check_tsc_sync_source failed
[    0.115008] Brought up 2 CPUs
[    0.115095] Total of 2 processors activated (7314.30 BogoMIPS).
[    0.116092] khelper used greatest stack depth: 6944 bytes left
[    0.116167] calling  init_cpufreq_transition_notifier_list+0x0/0x18 @ 1
[    0.116167] initcall init_cpufreq_transition_notifier_list+0x0/0x18 returned 0 after 0 usecs
[    0.116275] calling  net_ns_init+0x0/0xc0 @ 1
[    0.116384] initcall net_ns_init+0x0/0xc0 returned 0 after 0 usecs
[    0.116384] calling  e820_mark_nvs_memory+0x0/0x37 @ 1
[    0.116989] initcall e820_mark_nvs_memory+0x0/0x37 returned 0 after 0 usecs
[    0.117084] calling  cpufreq_tsc+0x0/0x25 @ 1
[    0.117172] initcall cpufreq_tsc+0x0/0x25 returned 0 after 0 usecs
[    0.117265] calling  pci_reboot_init+0x0/0x11 @ 1
[    0.117355] initcall pci_reboot_init+0x0/0x11 returned 0 after 0 usecs
[    0.117447] calling  reboot_init+0x0/0x11 @ 1
[    0.117540] initcall reboot_init+0x0/0x11 returned 0 after 0 usecs
[    0.117633] calling  init_lapic_sysfs+0x0/0x28 @ 1
[    0.117730] initcall init_lapic_sysfs+0x0/0x28 returned 0 after 0 usecs
[    0.117989] calling  init_smp_flush+0x0/0x20 @ 1
[    0.118078] initcall init_smp_flush+0x0/0x20 returned 0 after 0 usecs
[    0.118172] calling  alloc_frozen_cpus+0x0/0x9 @ 1
[    0.118262] initcall alloc_frozen_cpus+0x0/0x9 returned 0 after 0 usecs
[    0.118355] calling  sysctl_init+0x0/0x29 @ 1
[    0.118584] initcall sysctl_init+0x0/0x29 returned 0 after 0 usecs
[    0.118676] calling  ksysfs_init+0x0/0x96 @ 1
[    0.118773] initcall ksysfs_init+0x0/0x96 returned 0 after 0 usecs
[    0.118865] calling  async_init+0x0/0x3c @ 1
[    0.118954] initcall async_init+0x0/0x3c returned 0 after 0 usecs
[    0.118986] calling  init_jiffies_clocksource+0x0/0xf @ 1
[    0.119078] initcall init_jiffies_clocksource+0x0/0xf returned 0 after 0 usecs
[    0.119206] calling  pm_init+0x0/0x2d @ 1
[    0.119299] initcall pm_init+0x0/0x2d returned 0 after 0 usecs
[    0.119389] calling  pm_disk_init+0x0/0x14 @ 1
[    0.119480] initcall pm_disk_init+0x0/0x14 returned 0 after 0 usecs
[    0.119573] calling  swsusp_header_init+0x0/0x26 @ 1
[    0.119663] initcall swsusp_header_init+0x0/0x26 returned 0 after 0 usecs
[    0.119756] calling  init_hw_breakpoint+0x0/0xf @ 1
[    0.119848] initcall init_hw_breakpoint+0x0/0xf returned 0 after 0 usecs
[    0.119986] calling  filelock_init+0x0/0x27 @ 1
[    0.120075] initcall filelock_init+0x0/0x27 returned 0 after 0 usecs
[    0.120167] calling  init_misc_binfmt+0x0/0x35 @ 1
[    0.120259] initcall init_misc_binfmt+0x0/0x35 returned 0 after 0 usecs
[    0.120351] calling  init_script_binfmt+0x0/0x11 @ 1
[    0.120442] initcall init_script_binfmt+0x0/0x11 returned 0 after 0 usecs
[    0.120534] calling  init_elf_binfmt+0x0/0x11 @ 1
[    0.120623] initcall init_elf_binfmt+0x0/0x11 returned 0 after 0 usecs
[    0.120716] calling  debugfs_init+0x0/0x4a @ 1
[    0.120808] initcall debugfs_init+0x0/0x4a returned 0 after 0 usecs
[    0.120901] calling  random32_init+0x0/0xa4 @ 1
[    0.120985] initcall random32_init+0x0/0xa4 returned 0 after 0 usecs
[    0.121079] calling  early_resume_init+0x0/0x183 @ 1
[    0.121985] Time: 11:05:10  Date: 08/09/09
[    0.122072] initcall early_resume_init+0x0/0x183 returned 0 after 976 usecs
[    0.122164] calling  cpufreq_core_init+0x0/0x59 @ 1
[    0.122253] initcall cpufreq_core_init+0x0/0x59 returned 0 after 0 usecs
[    0.122345] calling  cpuidle_init+0x0/0x32 @ 1
[    0.122437] initcall cpuidle_init+0x0/0x32 returned 0 after 0 usecs
[    0.122529] calling  sock_init+0x0/0x51 @ 1
[    0.122662] initcall sock_init+0x0/0x51 returned 0 after 0 usecs
[    0.122754] calling  net_inuse_init+0x0/0x1f @ 1
[    0.122845] initcall net_inuse_init+0x0/0x1f returned 0 after 0 usecs
[    0.122937] calling  netpoll_init+0x0/0x11 @ 1
[    0.122985] initcall netpoll_init+0x0/0x11 returned 0 after 0 usecs
[    0.123077] calling  netlink_proto_init+0x0/0x102 @ 1
[    0.123170] NET: Registered protocol family 16
[    0.123269] initcall netlink_proto_init+0x0/0x102 returned 0 after 0 usecs
[    0.123362] calling  bdi_class_init+0x0/0x35 @ 1
[    0.123464] initcall bdi_class_init+0x0/0x35 returned 0 after 0 usecs
[    0.123464] calling  kobject_uevent_init+0x0/0x4e @ 1
[    0.123464] initcall kobject_uevent_init+0x0/0x4e returned 0 after 0 usecs
[    0.123464] calling  pcibus_class_init+0x0/0x14 @ 1
[    0.123464] initcall pcibus_class_init+0x0/0x14 returned 0 after 0 usecs
[    0.123992] calling  pci_driver_init+0x0/0xf @ 1
[    0.124091] initcall pci_driver_init+0x0/0xf returned 0 after 0 usecs
[    0.124091] calling  backlight_class_init+0x0/0x4d @ 1
[    0.124182] initcall backlight_class_init+0x0/0x4d returned 0 after 0 usecs
[    0.124182] calling  video_output_class_init+0x0/0x14 @ 1
[    0.124182] initcall video_output_class_init+0x0/0x14 returned 0 after 0 usecs
[    0.124182] calling  tty_class_init+0x0/0x28 @ 1
[    0.124212] initcall tty_class_init+0x0/0x28 returned 0 after 0 usecs
[    0.124987] calling  vtconsole_class_init+0x0/0xa1 @ 1
[    0.125087] initcall vtconsole_class_init+0x0/0xa1 returned 0 after 0 usecs
[    0.125087] calling  i2c_init+0x0/0x54 @ 1
[    0.125177] initcall i2c_init+0x0/0x54 returned 0 after 0 usecs
[    0.125177] calling  amd_postcore_init+0x0/0x66 @ 1
[    0.125177] initcall amd_postcore_init+0x0/0x66 returned 0 after 0 usecs
[    0.125260] calling  arch_kdebugfs_init+0x0/0x261 @ 1
[    0.125361] initcall arch_kdebugfs_init+0x0/0x261 returned 0 after 0 usecs
[    0.125986] calling  init_pit_clocksource+0x0/0x94 @ 1
[    0.126077] initcall init_pit_clocksource+0x0/0x94 returned 0 after 0 usecs
[    0.126170] calling  mtrr_if_init+0x0/0x44 @ 1
[    0.126261] initcall mtrr_if_init+0x0/0x44 returned 0 after 0 usecs
[    0.126353] calling  ffh_cstate_init+0x0/0x27 @ 1
[    0.126442] initcall ffh_cstate_init+0x0/0x27 returned 0 after 0 usecs
[    0.126535] calling  kdump_buf_page_init+0x0/0x54 @ 1
[    0.126626] initcall kdump_buf_page_init+0x0/0x54 returned 0 after 0 usecs
[    0.126719] calling  acpi_pci_init+0x0/0x4c @ 1
[    0.126807] ACPI: bus type pci registered
[    0.126895] initcall acpi_pci_init+0x0/0x4c returned 0 after 0 usecs
[    0.126983] calling  dmi_id_init+0x0/0x28f @ 1
[    0.127083] initcall dmi_id_init+0x0/0x28f returned 0 after 0 usecs
[    0.127083] calling  pci_arch_init+0x0/0x53 @ 1
[    0.127190] PCI: MCFG configuration 0: base f0000000 segment 0 buses 0 - 63
[    0.127283] PCI: MCFG area at f0000000 reserved in E820
[    0.127372] PCI: Using MMCONFIG for extended config space
[    0.127461] PCI: Using configuration type 1 for base access
[    0.127560] initcall pci_arch_init+0x0/0x53 returned 0 after 0 usecs
[    0.127653] calling  topology_init+0x0/0x36 @ 1
[    0.128010] initcall topology_init+0x0/0x36 returned 0 after 976 usecs
[    0.128103] calling  mtrr_init_finialize+0x0/0x35 @ 1
[    0.128193] initcall mtrr_init_finialize+0x0/0x35 returned 0 after 0 usecs
[    0.128287] calling  param_sysfs_init+0x0/0x1a6 @ 1
[    0.138109] initcall param_sysfs_init+0x0/0x1a6 returned 0 after 9764 usecs
[    0.138109] calling  pm_sysrq_init+0x0/0x16 @ 1
[    0.138195] initcall pm_sysrq_init+0x0/0x16 returned 0 after 0 usecs
[    0.138287] calling  audit_watch_init+0x0/0x27 @ 1
[    0.138376] initcall audit_watch_init+0x0/0x27 returned 0 after 0 usecs
[    0.138469] calling  default_bdi_init+0x0/0x2f @ 1
[    0.138584] initcall default_bdi_init+0x0/0x2f returned 0 after 0 usecs
[    0.138584] calling  init_bio+0x0/0xc0 @ 1
[    0.139024] bio: create slab <bio-0> at 0
[    0.139118] initcall init_bio+0x0/0xc0 returned 0 after 0 usecs
[    0.139210] calling  fsnotify_init+0x0/0xf @ 1
[    0.139300] initcall fsnotify_init+0x0/0xf returned 0 after 0 usecs
[    0.139392] calling  fsnotify_notification_init+0x0/0x5b @ 1
[    0.139485] initcall fsnotify_notification_init+0x0/0x5b returned 0 after 0 usecs
[    0.139615] calling  cryptomgr_init+0x0/0xf @ 1
[    0.139704] initcall cryptomgr_init+0x0/0xf returned 0 after 0 usecs
[    0.139795] calling  blk_settings_init+0x0/0x1d @ 1
[    0.139885] initcall blk_settings_init+0x0/0x1d returned 0 after 0 usecs
[    0.140016] calling  blk_ioc_init+0x0/0x24 @ 1
[    0.140106] initcall blk_ioc_init+0x0/0x24 returned 0 after 0 usecs
[    0.140198] calling  blk_softirq_init+0x0/0x5b @ 1
[    0.140288] initcall blk_softirq_init+0x0/0x5b returned 0 after 0 usecs
[    0.140379] calling  genhd_device_init+0x0/0x50 @ 1
[    0.140516] initcall genhd_device_init+0x0/0x50 returned 0 after 0 usecs
[    0.140516] calling  pci_slot_init+0x0/0x3b @ 1
[    0.140516] initcall pci_slot_init+0x0/0x3b returned 0 after 0 usecs
[    0.140516] calling  fbmem_init+0x0/0x78 @ 1
[    0.140516] initcall fbmem_init+0x0/0x78 returned 0 after 0 usecs
[    0.141018] calling  acpi_init+0x0/0x25e @ 1
[    0.142435] ACPI: EC: EC description table is found, configuring boot EC
[    0.150150] ACPI: EC: non-query interrupt received, switching to interrupt mode
[    0.156229] ACPI: Interpreter enabled
[    0.156318] ACPI: (supports S0 S3 S4 S5)
[    0.156596] ACPI: Using IOAPIC for interrupt routing
[    0.173122] ACPI: EC: GPE = 0x1c, I/O: command/status = 0x66, data = 0x62
[    0.173215] ACPI: EC: driver started in interrupt mode
[    0.173323] ACPI: Power Resource [PUBS] (on)
[    0.174221] initcall acpi_init+0x0/0x25e returned 0 after 32221 usecs
[    0.174314] calling  dock_init+0x0/0x7d @ 1
[    0.177366] ACPI: ACPI Dock Station Driver: 3 docks/bays found
[    0.177460] initcall dock_init+0x0/0x7d returned 0 after 2929 usecs
[    0.177553] calling  acpi_pci_root_init+0x0/0x25 @ 1
[    0.177668] ACPI: PCI Root Bridge [PCI0] (0000:00)
[    0.177785] pci 0000:00:02.0: reg 10 32bit mmio: [0xee100000-0xee17ffff]
[    0.177979] pci 0000:00:02.0: reg 14 io port: [0x1800-0x1807]
[    0.178072] pci 0000:00:02.0: reg 18 32bit mmio: [0xd0000000-0xdfffffff]
[    0.178166] pci 0000:00:02.0: reg 1c 32bit mmio: [0xee200000-0xee23ffff]
[    0.178296] pci 0000:00:02.1: reg 10 32bit mmio: [0xee180000-0xee1fffff]
[    0.178500] pci 0000:00:1b.0: reg 10 64bit mmio: [0xee240000-0xee243fff]
[    0.178650] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    0.178743] pci 0000:00:1b.0: PME# disabled
[    0.178913] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.178978] pci 0000:00:1c.0: PME# disabled
[    0.179149] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold
[    0.179243] pci 0000:00:1c.1: PME# disabled
[    0.179414] pci 0000:00:1c.2: PME# supported from D0 D3hot D3cold
[    0.179508] pci 0000:00:1c.2: PME# disabled
[    0.179678] pci 0000:00:1c.3: PME# supported from D0 D3hot D3cold
[    0.179771] pci 0000:00:1c.3: PME# disabled
[    0.179919] pci 0000:00:1d.0: reg 20 io port: [0x1820-0x183f]
[    0.180039] pci 0000:00:1d.1: reg 20 io port: [0x1840-0x185f]
[    0.180191] pci 0000:00:1d.2: reg 20 io port: [0x1860-0x187f]
[    0.180342] pci 0000:00:1d.3: reg 20 io port: [0x1880-0x189f]
[    0.180498] pci 0000:00:1d.7: reg 10 32bit mmio: [0xee444000-0xee4443ff]
[    0.180649] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
[    0.180744] pci 0000:00:1d.7: PME# disabled
[    0.181077] pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
[    0.181209] pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH6 GPIO
[    0.181303] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 1600 (mask 007f)
[    0.181435] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 2 PIO at 15e0 (mask 000f)
[    0.181567] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 3 PIO at 1680 (mask 001f)
[    0.181748] pci 0000:00:1f.1: reg 10 io port: [0x00-0x07]
[    0.181843] pci 0000:00:1f.1: reg 14 io port: [0x00-0x03]
[    0.181939] pci 0000:00:1f.1: reg 18 io port: [0x00-0x07]
[    0.181980] pci 0000:00:1f.1: reg 1c io port: [0x00-0x03]
[    0.182075] pci 0000:00:1f.1: reg 20 io port: [0x1810-0x181f]
[    0.182227] pci 0000:00:1f.2: reg 10 io port: [0x18d0-0x18d7]
[    0.182323] pci 0000:00:1f.2: reg 14 io port: [0x18c4-0x18c7]
[    0.182419] pci 0000:00:1f.2: reg 18 io port: [0x18c8-0x18cf]
[    0.182514] pci 0000:00:1f.2: reg 1c io port: [0x18c0-0x18c3]
[    0.182610] pci 0000:00:1f.2: reg 20 io port: [0x18b0-0x18bf]
[    0.182705] pci 0000:00:1f.2: reg 24 32bit mmio: [0xee444400-0xee4447ff]
[    0.182833] pci 0000:00:1f.2: PME# supported from D3hot
[    0.182977] pci 0000:00:1f.2: PME# disabled
[    0.183126] pci 0000:00:1f.3: reg 20 io port: [0x18e0-0x18ff]
[    0.183388] pci 0000:02:00.0: reg 10 32bit mmio: [0xee000000-0xee01ffff]
[    0.183563] pci 0000:02:00.0: reg 18 io port: [0x2000-0x201f]
[    0.183819] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
[    0.183977] pci 0000:02:00.0: PME# disabled
[    0.184201] pci 0000:00:1c.0: bridge io port: [0x2000-0x2fff]
[    0.184295] pci 0000:00:1c.0: bridge 32bit mmio: [0xee000000-0xee0fffff]
[    0.184575] pci 0000:03:00.0: reg 10 32bit mmio: [0xedf00000-0xedf00fff]
[    0.184946] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
[    0.185025] pci 0000:03:00.0: PME# disabled
[    0.185254] pci 0000:00:1c.1: bridge io port: [0x3000-0x4fff]
[    0.185348] pci 0000:00:1c.1: bridge 32bit mmio: [0xec000000-0xedffffff]
[    0.185446] pci 0000:00:1c.1: bridge 64bit mmio pref: [0xe4000000-0xe40fffff]
[    0.185596] pci 0000:00:1c.2: bridge io port: [0x5000-0x6fff]
[    0.185690] pci 0000:00:1c.2: bridge 32bit mmio: [0xe8000000-0xe9ffffff]
[    0.185789] pci 0000:00:1c.2: bridge 64bit mmio pref: [0xe4100000-0xe41fffff]
[    0.186016] pci 0000:00:1c.3: bridge io port: [0x7000-0x8fff]
[    0.186109] pci 0000:00:1c.3: bridge 32bit mmio: [0xea000000-0xebffffff]
[    0.186206] pci 0000:00:1c.3: bridge 64bit mmio pref: [0xe4200000-0xe42fffff]
[    0.186352] pci 0000:15:00.0: reg 10 32bit mmio: [0xe4300000-0xe4300fff]
[    0.186471] pci 0000:15:00.0: supports D1 D2
[    0.186558] pci 0000:15:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.186653] pci 0000:15:00.0: PME# disabled
[    0.186808] pci 0000:00:1e.0: transparent bridge
[    0.186898] pci 0000:00:1e.0: bridge io port: [0x9000-0xcfff]
[    0.186980] pci 0000:00:1e.0: bridge 32bit mmio: [0xe4300000-0xe7ffffff]
[    0.187845] pci 0000:00:1e.0: bridge 64bit mmio pref: [0xe0000000-0xe3ffffff]
[    0.188012] pci_bus 0000:00: on NUMA node 0
[    0.188103] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[    0.188345] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP0._PRT]
[    0.188515] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP1._PRT]
[    0.188683] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP2._PRT]
[    0.188857] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP3._PRT]
[    0.189037] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
[    0.194071] initcall acpi_pci_root_init+0x0/0x25 returned 0 after 16599 usecs
[    0.194071] calling  acpi_pci_link_init+0x0/0x3f @ 1
[    0.194320] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11)
[    0.195402] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11)
[    0.196167] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 9 10 *11)
[    0.196895] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11)
[    0.197608] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11)
[    0.198349] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 *11)
[    0.199103] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 *11)
[    0.199834] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 10 *11)
[    0.200436] initcall acpi_pci_link_init+0x0/0x3f returned 0 after 5858 usecs
[    0.200436] calling  pnp_init+0x0/0xf @ 1
[    0.200436] initcall pnp_init+0x0/0xf returned 0 after 0 usecs
[    0.200436] calling  misc_init+0x0/0x92 @ 1
[    0.200436] initcall misc_init+0x0/0x92 returned 0 after 0 usecs
[    0.200979] calling  cn_init+0x0/0xcb @ 1
[    0.201078] initcall cn_init+0x0/0xcb returned 0 after 0 usecs
[    0.201170] calling  init_scsi+0x0/0x84 @ 1
[    0.201338] SCSI subsystem initialized
[    0.201338] initcall init_scsi+0x0/0x84 returned 0 after 0 usecs
[    0.201338] calling  ata_init+0x0/0x29d @ 1
[    0.201338] libata version 3.00 loaded.
[    0.201338] initcall ata_init+0x0/0x29d returned 0 after 0 usecs
[    0.201975] calling  phy_init+0x0/0x29 @ 1
[    0.202074] initcall phy_init+0x0/0x29 returned 0 after 0 usecs
[    0.202074] calling  init_pcmcia_cs+0x0/0x1e @ 1
[    0.202163] initcall init_pcmcia_cs+0x0/0x1e returned 0 after 0 usecs
[    0.202163] calling  usb_init+0x0/0x177 @ 1
[    0.202177] usbcore: registered new interface driver usbfs
[    0.202177] usbcore: registered new interface driver hub
[    0.203006] usbcore: registered new device driver usb
[    0.203063] initcall usb_init+0x0/0x177 returned 0 after 976 usecs
[    0.203155] calling  serio_init+0x0/0x82 @ 1
[    0.203252] initcall serio_init+0x0/0x82 returned 0 after 0 usecs
[    0.203252] calling  input_init+0x0/0xfb @ 1
[    0.203252] initcall input_init+0x0/0xfb returned 0 after 0 usecs
[    0.203252] calling  rtc_init+0x0/0x5e @ 1
[    0.203252] initcall rtc_init+0x0/0x5e returned 0 after 0 usecs
[    0.203973] calling  power_supply_class_init+0x0/0x2b @ 1
[    0.204074] initcall power_supply_class_init+0x0/0x2b returned 0 after 0 usecs
[    0.204101] calling  hwmon_init+0x0/0xe9 @ 1
[    0.204202] initcall hwmon_init+0x0/0xe9 returned 0 after 0 usecs
[    0.204202] calling  thermal_init+0x0/0x32 @ 1
[    0.204202] initcall thermal_init+0x0/0x32 returned 0 after 0 usecs
[    0.204202] calling  md_init+0x0/0xb5 @ 1
[    0.204202] initcall md_init+0x0/0xb5 returned 0 after 0 usecs
[    0.204252] calling  leds_init+0x0/0x32 @ 1
[    0.204983] initcall leds_init+0x0/0x32 returned 0 after 0 usecs
[    0.205065] calling  pci_subsys_init+0x0/0xdf @ 1
[    0.205153] PCI: Using ACPI for IRQ routing
[    0.205553] initcall pci_subsys_init+0x0/0xdf returned 0 after 0 usecs
[    0.205646] calling  proto_init+0x0/0xf @ 1
[    0.205736] initcall proto_init+0x0/0xf returned 0 after 0 usecs
[    0.205827] calling  net_dev_init+0x0/0x142 @ 1
[    0.206028] initcall net_dev_init+0x0/0x142 returned 0 after 0 usecs
[    0.206075] calling  neigh_init+0x0/0x66 @ 1
[    0.206164] initcall neigh_init+0x0/0x66 returned 0 after 0 usecs
[    0.206256] calling  fib_rules_init+0x0/0x99 @ 1
[    0.206346] initcall fib_rules_init+0x0/0x99 returned 0 after 0 usecs
[    0.206439] calling  pktsched_init+0x0/0xa9 @ 1
[    0.206530] initcall pktsched_init+0x0/0xa9 returned 0 after 0 usecs
[    0.206622] calling  tc_filter_init+0x0/0x43 @ 1
[    0.206712] initcall tc_filter_init+0x0/0x43 returned 0 after 0 usecs
[    0.206804] calling  tc_action_init+0x0/0x43 @ 1
[    0.206972] initcall tc_action_init+0x0/0x43 returned 0 after 0 usecs
[    0.207065] calling  genl_init+0x0/0xb0 @ 1
[    0.208976] initcall genl_init+0x0/0xb0 returned 0 after 1952 usecs
[    0.209068] calling  cipso_v4_init+0x0/0x52 @ 1
[    0.209159] initcall cipso_v4_init+0x0/0x52 returned 0 after 0 usecs
[    0.209250] calling  wireless_nlevent_init+0x0/0x2f @ 1
[    0.209341] initcall wireless_nlevent_init+0x0/0x2f returned 0 after 0 usecs
[    0.209436] calling  cfg80211_init+0x0/0x64 @ 1
[    0.219994] cfg80211: Using static regulatory domain info
[    0.220082] cfg80211: Regulatory domain: US
[    0.220169] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    0.220298] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[    0.220391] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.220485] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.220577] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.220669] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.220762] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[    0.220858] cfg80211: Calling CRDA for country: US
[    0.220985] initcall cfg80211_init+0x0/0x64 returned 0 after 11716 usecs
[    0.221068] calling  ieee80211_init+0x0/0xa @ 1
[    0.221158] initcall ieee80211_init+0x0/0xa returned 0 after 0 usecs
[    0.221250] calling  netlbl_init+0x0/0x6d @ 1
[    0.221336] NetLabel: Initializing
[    0.221421] NetLabel:  domain hash size = 128
[    0.221508] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.221610] NetLabel:  unlabeled traffic allowed by default
[    0.221702] initcall netlbl_init+0x0/0x6d returned 0 after 0 usecs
[    0.221793] calling  rfkill_init+0x0/0x75 @ 1
[    0.222006] initcall rfkill_init+0x0/0x75 returned 0 after 976 usecs
[    0.222087] calling  sysctl_init+0x0/0x3b @ 1
[    0.222175] initcall sysctl_init+0x0/0x3b returned 0 after 0 usecs
[    0.222267] calling  pci_iommu_init+0x0/0xc @ 1
[    0.222356] initcall pci_iommu_init+0x0/0xc returned 0 after 0 usecs
[    0.222449] calling  print_all_ICs+0x0/0x441 @ 1
[    0.222538] 
[    0.222539] printing PIC contents
[    0.222707] ... PIC  IMR: ffff
[    0.222795] ... PIC  IRR: 0800
[    0.222888] ... PIC  ISR: 0000
[    0.222972] ... PIC ELCR: 0800
[    0.223058] printing local APIC contents on CPU#0/0:
[    0.223146] ... APIC ID:      00000000 (0)
[    0.223233] ... APIC VERSION: 00050014
[    0.223318] ... APIC TASKPRI: 00000000 (00)
[    0.223406] ... APIC PROCPRI: 00000000
[    0.223491] ... APIC LDR: 01000000
[    0.223576] ... APIC DFR: ffffffff
[    0.223661] ... APIC SPIV: 000001ff
[    0.223747] ... APIC ISR field:
[    0.223832] 0000000000000000000000000000000000000000000000000000000000000000
[    0.223965] ... APIC TMR field:
[    0.223965] 0000000002000000000000000000000000000000000000000000000000000000
[    0.223965] ... APIC IRR field:
[    0.223965] 0000000000000000000000000000000000000000000000000000000000008000
[    0.223965] ... APIC ESR: 00000000
[    0.223965] ... APIC ICR: 000008fb
[    0.223965] ... APIC ICR2: 02000000
[    0.223965] ... APIC LVTT: 000200ef
[    0.223965] ... APIC LVTPC: 00010000
[    0.223965] ... APIC LVT0: 00010700
[    0.223965] ... APIC LVT1: 00000400
[    0.223965] ... APIC LVTERR: 000000fe
[    0.223965] ... APIC TMICT: 00002896
[    0.223965] ... APIC TMCCT: 000021a7
[    0.223965] ... APIC TDCR: 00000003
[    0.223965] 
[    0.223577] printing local APIC contents on CPU#1/1:
[    0.223668] ... APIC ID:      01000000 (1)
[    0.223754] ... APIC VERSION: 00050014
[    0.223840] ... APIC TASKPRI: 00000000 (00)
[    0.223928] ... APIC PROCPRI: 00000000
[    0.223965] ... APIC LDR: 02000000
[    0.223965] ... APIC DFR: ffffffff
[    0.223965] ... APIC SPIV: 000001ff
[    0.223965] ... APIC ISR field:
[    0.223965] 0000000000000000000000000000000000000000000000000000000000000000
[    0.223965] ... APIC TMR field:
[    0.223965] 0000000000000000000000000000000000000000000000000000000000000000
[    0.223965] ... APIC IRR field:
[    0.223965] 0000000000000000000000000000000000000000000000000000000000008000
[    0.223965] ... APIC ESR: 00000000
[    0.223965] ... APIC ICR: 000008fd
[    0.223965] ... APIC ICR2: 01000000
[    0.223965] ... APIC LVTT: 000200ef
[    0.223965] ... APIC LVTPC: 00010000
[    0.223965] ... APIC LVT0: 00010700
[    0.223965] ... APIC LVT1: 00010400
[    0.223965] ... APIC LVTERR: 000000fe
[    0.223965] ... APIC TMICT: 00002896
[    0.223965] ... APIC TMCCT: 00000f04
[    0.223965] ... APIC TDCR: 00000003
[    0.223965] 
[    0.227664] number of MP IRQ sources: 15.
[    0.227752] number of IO-APIC #1 registers: 24.
[    0.227839] testing the IO APIC.......................
[    0.227933] 
[    0.227967] IO APIC #1......
[    0.228050] .... register #00: 02000000
[    0.228136] .......    : physical APIC id: 02
[    0.228223] .......    : Delivery Type: 0
[    0.228309] .......    : LTS          : 0
[    0.228396] .... register #01: 00170020
[    0.228482] .......     : max redirection entries: 0017
[    0.228570] .......     : PRQ implemented: 0
[    0.228656] .......     : IO APIC version: 0020
[    0.228743] .... IRQ redirection table:
[    0.228966]  NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:   
[    0.229059]  00 000 1    0    0   0   0    0    0    00
[    0.229195]  01 003 0    0    0   0   0    1    1    31
[    0.229970]  02 003 0    0    0   0   0    1    1    30
[    0.230105]  03 003 0    0    0   0   0    1    1    33
[    0.230241]  04 003 0    0    0   0   0    1    1    34
[    0.230377]  05 003 0    0    0   0   0    1    1    35
[    0.230514]  06 003 0    0    0   0   0    1    1    36
[    0.230650]  07 003 0    0    0   0   0    1    1    37
[    0.230787]  08 003 0    0    0   0   0    1    1    38
[    0.230967]  09 003 0    1    0   0   0    1    1    39
[    0.231103]  0a 003 0    0    0   0   0    1    1    3A
[    0.231239]  0b 003 0    0    0   0   0    1    1    3B
[    0.231375]  0c 003 0    0    0   0   0    1    1    3C
[    0.231511]  0d 003 0    0    0   0   0    1    1    3D
[    0.231646]  0e 003 0    0    0   0   0    1    1    3E
[    0.231782]  0f 003 0    0    0   0   0    1    1    3F
[    0.231918]  10 000 1    0    0   0   0    0    0    00
[    0.232055]  11 000 1    0    0   0   0    0    0    00
[    0.232192]  12 000 1    0    0   0   0    0    0    00
[    0.232329]  13 000 1    0    0   0   0    0    0    00
[    0.232465]  14 000 1    0    0   0   0    0    0    00
[    0.232602]  15 000 1    0    0   0   0    0    0    00
[    0.232737]  16 000 1    0    0   0   0    0    0    00
[    0.232873]  17 000 1    0    0   0   0    0    0    00
[    0.232966] IRQ to pin mappings:
[    0.233051] IRQ0 -> 0:2
[    0.233219] IRQ1 -> 0:1
[    0.233389] IRQ3 -> 0:3
[    0.233559] IRQ4 -> 0:4
[    0.233729] IRQ5 -> 0:5
[    0.233897] IRQ6 -> 0:6
[    0.234088] IRQ7 -> 0:7
[    0.234258] IRQ8 -> 0:8
[    0.234426] IRQ9 -> 0:9
[    0.234596] IRQ10 -> 0:10
[    0.234765] IRQ11 -> 0:11
[    0.234933] IRQ12 -> 0:12
[    0.235087] IRQ13 -> 0:13
[    0.235256] IRQ14 -> 0:14
[    0.235426] IRQ15 -> 0:15
[    0.235599] .................................... done.
[    0.235690] initcall print_all_ICs+0x0/0x441 returned 0 after 12693 usecs
[    0.235783] calling  hpet_late_init+0x0/0x183 @ 1
[    0.235877] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.236179] hpet0: 3 comparators, 64-bit 14.318180 MHz counter
[    0.238971] initcall hpet_late_init+0x0/0x183 returned 0 after 3905 usecs
[    0.239062] calling  clocksource_done_booting+0x0/0x11 @ 1
[    0.239968] initcall clocksource_done_booting+0x0/0x11 returned 0 after 0 usecs
[    0.240097] calling  rb_init_debugfs+0x0/0x27 @ 1
[    0.240191] initcall rb_init_debugfs+0x0/0x27 returned 0 after 0 usecs
[    0.240283] calling  tracer_init_debugfs+0x0/0x26b @ 1
[    0.240459] initcall tracer_init_debugfs+0x0/0x26b returned 0 after 0 usecs
[    0.240553] calling  init_trace_printk_function_export+0x0/0x2a @ 1
[    0.240647] initcall init_trace_printk_function_export+0x0/0x2a returned 0 after 0 usecs
[    0.240776] calling  event_trace_init+0x0/0x17e @ 1
[    0.240979] Switched to high resolution mode on CPU 0
[    0.241783] Switched to high resolution mode on CPU 1
[    0.242167] initcall event_trace_init+0x0/0x17e returned 0 after 2148 usecs
[    0.242265] calling  init_pipe_fs+0x0/0x41 @ 1
[    0.242366] initcall init_pipe_fs+0x0/0x41 returned 0 after 11 usecs
[    0.242459] calling  eventpoll_init+0x0/0xac @ 1
[    0.242554] initcall eventpoll_init+0x0/0xac returned 0 after 5 usecs
[    0.242647] calling  anon_inode_init+0x0/0xed @ 1
[    0.242744] initcall anon_inode_init+0x0/0xed returned 0 after 6 usecs
[    0.242836] calling  blk_scsi_ioctl_init+0x0/0x288 @ 1
[    0.242929] initcall blk_scsi_ioctl_init+0x0/0x288 returned 0 after 1 usecs
[    0.243031] calling  acpi_event_init+0x0/0x6f @ 1
[    0.246021] initcall acpi_event_init+0x0/0x6f returned 0 after 2830 usecs
[    0.246114] calling  pnpacpi_init+0x0/0x7b @ 1
[    0.246202] pnp: PnP ACPI init
[    0.246298] ACPI: bus type pnp registered
[    0.248505] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.248733] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.248956] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.249185] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.250518] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
[    0.253081] pnp: PnP ACPI: found 11 devices
[    0.253168] ACPI: ACPI bus type pnp unregistered
[    0.253266] initcall pnpacpi_init+0x0/0x7b returned 0 after 6895 usecs
[    0.253359] calling  pnp_system_init+0x0/0xf @ 1
[    0.253456] system 00:00: iomem range 0x0-0x9ffff could not be reserved
[    0.253548] system 00:00: iomem range 0xc0000-0xc3fff could not be reserved
[    0.253641] system 00:00: iomem range 0xc4000-0xc7fff could not be reserved
[    0.253735] system 00:00: iomem range 0xc8000-0xcbfff has been reserved
[    0.253828] system 00:00: iomem range 0xcc000-0xcffff could not be reserved
[    0.253921] system 00:00: iomem range 0xd0000-0xd3fff could not be reserved
[    0.254025] system 00:00: iomem range 0xdc000-0xdffff could not be reserved
[    0.254118] system 00:00: iomem range 0xe0000-0xe3fff could not be reserved
[    0.254211] system 00:00: iomem range 0xe4000-0xe7fff could not be reserved
[    0.254313] system 00:00: iomem range 0xe8000-0xebfff could not be reserved
[    0.254406] system 00:00: iomem range 0xec000-0xeffff could not be reserved
[    0.254499] system 00:00: iomem range 0xf0000-0xfffff could not be reserved
[    0.254592] system 00:00: iomem range 0x100000-0x7fffffff could not be reserved
[    0.254723] system 00:00: iomem range 0xfec00000-0xffffffff could not be reserved
[    0.254859] system 00:02: ioport range 0x164e-0x164f has been reserved
[    0.254952] system 00:02: ioport range 0x1000-0x107f has been reserved
[    0.255050] system 00:02: ioport range 0x1180-0x11bf has been reserved
[    0.255143] system 00:02: ioport range 0x800-0x80f has been reserved
[    0.255235] system 00:02: ioport range 0x15e0-0x15ef has been reserved
[    0.255334] system 00:02: ioport range 0x1600-0x165f could not be reserved
[    0.255428] system 00:02: iomem range 0xf0000000-0xf3ffffff has been reserved
[    0.255522] system 00:02: iomem range 0xfed1c000-0xfed1ffff has been reserved
[    0.255616] system 00:02: iomem range 0xfed14000-0xfed17fff has been reserved
[    0.255710] system 00:02: iomem range 0xfed18000-0xfed18fff has been reserved
[    0.255804] system 00:02: iomem range 0xfed19000-0xfed19fff has been reserved
[    0.255954] initcall pnp_system_init+0x0/0xf returned 0 after 2446 usecs
[    0.256056] calling  chr_dev_init+0x0/0x8d @ 1
[    0.256797] initcall chr_dev_init+0x0/0x8d returned 0 after 636 usecs
[    0.256891] calling  firmware_class_init+0x0/0x61 @ 1
[    0.257046] initcall firmware_class_init+0x0/0x61 returned 0 after 62 usecs
[    0.257140] calling  init_pcmcia_bus+0x0/0x62 @ 1
[    0.257308] initcall init_pcmcia_bus+0x0/0x62 returned 0 after 75 usecs
[    0.257402] calling  cpufreq_gov_performance_init+0x0/0xf @ 1
[    0.257497] initcall cpufreq_gov_performance_init+0x0/0xf returned 0 after 1 usecs
[    0.257625] calling  cpufreq_gov_userspace_init+0x0/0xf @ 1
[    0.257719] initcall cpufreq_gov_userspace_init+0x0/0xf returned 0 after 1 usecs
[    0.257849] calling  init_acpi_pm_clocksource+0x0/0x1b5 @ 1
[    0.292492] initcall init_acpi_pm_clocksource+0x0/0x1b5 returned 0 after 33741 usecs
[    0.292622] calling  pcibios_assign_resources+0x0/0x66 @ 1
[    0.292785] pci 0000:00:1c.0: PCI bridge, secondary bus 0000:02
[    0.292876] pci 0000:00:1c.0:   IO window: 0x2000-0x2fff
[    0.292970] pci 0000:00:1c.0:   MEM window: 0xee000000-0xee0fffff
[    0.293076] pci 0000:00:1c.0:   PREFETCH window: disabled
[    0.293169] pci 0000:00:1c.1: PCI bridge, secondary bus 0000:03
[    0.293267] pci 0000:00:1c.1:   IO window: 0x3000-0x4fff
[    0.293360] pci 0000:00:1c.1:   MEM window: 0xec000000-0xedffffff
[    0.293453] pci 0000:00:1c.1:   PREFETCH window: 0x000000e4000000-0x000000e40fffff
[    0.293588] pci 0000:00:1c.2: PCI bridge, secondary bus 0000:04
[    0.293679] pci 0000:00:1c.2:   IO window: 0x5000-0x6fff
[    0.293773] pci 0000:00:1c.2:   MEM window: 0xe8000000-0xe9ffffff
[    0.293866] pci 0000:00:1c.2:   PREFETCH window: 0x000000e4100000-0x000000e41fffff
[    0.294009] pci 0000:00:1c.3: PCI bridge, secondary bus 0000:0c
[    0.294100] pci 0000:00:1c.3:   IO window: 0x7000-0x8fff
[    0.294194] pci 0000:00:1c.3:   MEM window: 0xea000000-0xebffffff
[    0.294293] pci 0000:00:1c.3:   PREFETCH window: 0x000000e4200000-0x000000e42fffff
[    0.294431] pci 0000:15:00.0: CardBus bridge, secondary bus 0000:16
[    0.294524] pci 0000:15:00.0:   IO window: 0x009000-0x0090ff
[    0.294618] pci 0000:15:00.0:   IO window: 0x009400-0x0094ff
[    0.294712] pci 0000:15:00.0:   PREFETCH window: 0xe0000000-0xe3ffffff
[    0.294807] pci 0000:15:00.0:   MEM window: 0x80000000-0x83ffffff
[    0.294902] pci 0000:00:1e.0: PCI bridge, secondary bus 0000:15
[    0.294994] pci 0000:00:1e.0:   IO window: 0x9000-0xcfff
[    0.295094] pci 0000:00:1e.0:   MEM window: 0xe4300000-0xe7ffffff
[    0.295188] pci 0000:00:1e.0:   PREFETCH window: 0x000000e0000000-0x000000e3ffffff
[    0.295338]   alloc irq_desc for 20 on node -1
[    0.295425]   alloc kstat_irqs on node -1
[    0.295514] IOAPIC[0]: Set routing entry (1-20 -> 0x49 -> IRQ 20 Mode:1 Active:1)
[    0.295645] pci 0000:00:1c.0: PCI INT A -> GSI 20 (level, low) -> IRQ 20
[    0.295741] pci 0000:00:1c.0: setting latency timer to 64
[    0.295836]   alloc irq_desc for 21 on node -1
[    0.295923]   alloc kstat_irqs on node -1
[    0.296019] IOAPIC[0]: Set routing entry (1-21 -> 0x51 -> IRQ 21 Mode:1 Active:1)
[    0.296149] pci 0000:00:1c.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21
[    0.296243] pci 0000:00:1c.1: setting latency timer to 64
[    0.296347]   alloc irq_desc for 22 on node -1
[    0.296435]   alloc kstat_irqs on node -1
[    0.296522] IOAPIC[0]: Set routing entry (1-22 -> 0x59 -> IRQ 22 Mode:1 Active:1)
[    0.296651] pci 0000:00:1c.2: PCI INT C -> GSI 22 (level, low) -> IRQ 22
[    0.296747] pci 0000:00:1c.2: setting latency timer to 64
[    0.296843]   alloc irq_desc for 23 on node -1
[    0.297013]   alloc kstat_irqs on node -1
[    0.297803] IOAPIC[0]: Set routing entry (1-23 -> 0x61 -> IRQ 23 Mode:1 Active:1)
[    0.297933] pci 0000:00:1c.3: PCI INT D -> GSI 23 (level, low) -> IRQ 23
[    0.298033] pci 0000:00:1c.3: setting latency timer to 64
[    0.298126] pci 0000:00:1e.0: enabling device (0005 -> 0007)
[    0.298219] pci 0000:00:1e.0: setting latency timer to 64
[    0.298326]   alloc irq_desc for 16 on node -1
[    0.298413]   alloc kstat_irqs on node -1
[    0.298501] IOAPIC[0]: Set routing entry (1-16 -> 0x69 -> IRQ 16 Mode:1 Active:1)
[    0.298631] pci 0000:15:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    0.298729] pci_bus 0000:00: resource 0 io:  [0x00-0xffff]
[    0.298819] pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffff]
[    0.298910] pci_bus 0000:02: resource 0 io:  [0x2000-0x2fff]
[    0.299000] pci_bus 0000:02: resource 1 mem: [0xee000000-0xee0fffff]
[    0.299099] pci_bus 0000:03: resource 0 io:  [0x3000-0x4fff]
[    0.299189] pci_bus 0000:03: resource 1 mem: [0xec000000-0xedffffff]
[    0.299287] pci_bus 0000:03: resource 2 pref mem [0xe4000000-0xe40fffff]
[    0.299380] pci_bus 0000:04: resource 0 io:  [0x5000-0x6fff]
[    0.299471] pci_bus 0000:04: resource 1 mem: [0xe8000000-0xe9ffffff]
[    0.299563] pci_bus 0000:04: resource 2 pref mem [0xe4100000-0xe41fffff]
[    0.299655] pci_bus 0000:0c: resource 0 io:  [0x7000-0x8fff]
[    0.299745] pci_bus 0000:0c: resource 1 mem: [0xea000000-0xebffffff]
[    0.299837] pci_bus 0000:0c: resource 2 pref mem [0xe4200000-0xe42fffff]
[    0.299929] pci_bus 0000:15: resource 0 io:  [0x9000-0xcfff]
[    0.300026] pci_bus 0000:15: resource 1 mem: [0xe4300000-0xe7ffffff]
[    0.300117] pci_bus 0000:15: resource 2 pref mem [0xe0000000-0xe3ffffff]
[    0.300210] pci_bus 0000:15: resource 3 io:  [0x00-0xffff]
[    0.300309] pci_bus 0000:15: resource 4 mem: [0x000000-0xffffffff]
[    0.300400] pci_bus 0000:16: resource 0 io:  [0x9000-0x90ff]
[    0.300491] pci_bus 0000:16: resource 1 io:  [0x9400-0x94ff]
[    0.300581] pci_bus 0000:16: resource 2 pref mem [0xe0000000-0xe3ffffff]
[    0.300673] pci_bus 0000:16: resource 3 mem: [0x80000000-0x83ffffff]
[    0.300767] initcall pcibios_assign_resources+0x0/0x66 returned 0 after 7864 usecs
[    0.300897] calling  sysctl_core_init+0x0/0x2d @ 1
[    0.301023] initcall sysctl_core_init+0x0/0x2d returned 0 after 33 usecs
[    0.301115] calling  inet_init+0x0/0x1c3 @ 1
[    0.301213] NET: Registered protocol family 2
[    0.301404] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.301831] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.302659] TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
[    0.303110] TCP: Hash tables configured (established 131072 bind 65536)
[    0.303202] TCP reno registered
[    0.303404] initcall inet_init+0x0/0x1c3 returned 0 after 2142 usecs
[    0.303499] calling  af_unix_init+0x0/0x47 @ 1
[    0.303589] NET: Registered protocol family 1
[    0.303688] initcall af_unix_init+0x0/0x47 returned 0 after 97 usecs
[    0.303781] calling  populate_rootfs+0x0/0x1ea @ 1
[    0.303938] initcall populate_rootfs+0x0/0x1ea returned 0 after 63 usecs
[    0.304045] calling  i8259A_init_sysfs+0x0/0x1d @ 1
[    0.304311] initcall i8259A_init_sysfs+0x0/0x1d returned 0 after 169 usecs
[    0.304404] calling  sbf_init+0x0/0xc0 @ 1
[    0.304495] Simple Boot Flag at 0x35 set to 0x1
[    0.304589] initcall sbf_init+0x0/0xc0 returned 0 after 93 usecs
[    0.304681] calling  i8237A_init_sysfs+0x0/0x1d @ 1
[    0.304886] initcall i8237A_init_sysfs+0x0/0x1d returned 0 after 111 usecs
[    0.304980] calling  add_rtc_cmos+0x0/0x7e @ 1
[    0.305095] initcall add_rtc_cmos+0x0/0x7e returned 0 after 5 usecs
[    0.305188] calling  cache_sysfs_init+0x0/0x4b @ 1
[    0.305753] initcall cache_sysfs_init+0x0/0x4b returned 0 after 457 usecs
[    0.305847] calling  mce_init_device+0x0/0xc1 @ 1
[    0.306201] initcall mce_init_device+0x0/0xc1 returned 0 after 257 usecs
[    0.306305] calling  threshold_init_device+0x0/0x3a @ 1
[    0.306398] initcall threshold_init_device+0x0/0x3a returned 0 after 1 usecs
[    0.306492] calling  thermal_throttle_init_device+0x0/0x77 @ 1
[    0.306590] initcall thermal_throttle_init_device+0x0/0x77 returned 0 after 5 usecs
[    0.306720] calling  msr_init+0x0/0xda @ 1
[    0.307020] initcall msr_init+0x0/0xda returned 0 after 189 usecs
[    0.307111] calling  cpuid_init+0x0/0xda @ 1
[    0.307389] initcall cpuid_init+0x0/0xda returned 0 after 181 usecs
[    0.307482] calling  ioapic_init_sysfs+0x0/0x84 @ 1
[    0.307679] initcall ioapic_init_sysfs+0x0/0x84 returned 0 after 104 usecs
[    0.307772] calling  add_pcspkr+0x0/0x24 @ 1
[    0.307929] initcall add_pcspkr+0x0/0x24 returned 0 after 65 usecs
[    0.308034] calling  microcode_init+0x0/0xf2 @ 1
[    0.308192] microcode: CPU0 sig=0x6e8, pf=0x20, revision=0x39
[    0.308297] microcode: CPU1 sig=0x6e8, pf=0x20, revision=0x39
[    0.308450] Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[    0.308583] initcall microcode_init+0x0/0xf2 returned 0 after 447 usecs
[    0.308678] calling  start_periodic_check_for_corruption+0x0/0x32 @ 1
[    0.308770] Scanning for low memory corruption every 60 seconds
[    0.308864] initcall start_periodic_check_for_corruption+0x0/0x32 returned 0 after 91 usecs
[    0.308996] calling  aes_init+0x0/0xf @ 1
[    0.309202] initcall aes_init+0x0/0xf returned 0 after 90 usecs
[    0.309304] calling  proc_schedstat_init+0x0/0x1c @ 1
[    0.309401] initcall proc_schedstat_init+0x0/0x1c returned 0 after 6 usecs
[    0.309495] calling  proc_execdomains_init+0x0/0x1c @ 1
[    0.309588] initcall proc_execdomains_init+0x0/0x1c returned 0 after 2 usecs
[    0.309681] calling  ioresources_init+0x0/0x2d @ 1
[    0.309775] initcall ioresources_init+0x0/0x2d returned 0 after 3 usecs
[    0.309867] calling  uid_cache_init+0x0/0x5b @ 1
[    0.309963] initcall uid_cache_init+0x0/0x5b returned 0 after 5 usecs
[    0.310078] calling  init_posix_timers+0x0/0xb3 @ 1
[    0.310174] initcall init_posix_timers+0x0/0xb3 returned 0 after 5 usecs
[    0.310274] calling  init_posix_cpu_timers+0x0/0xba @ 1
[    0.310367] initcall init_posix_cpu_timers+0x0/0xba returned 0 after 1 usecs
[    0.310460] calling  nsproxy_cache_init+0x0/0x27 @ 1
[    0.310553] initcall nsproxy_cache_init+0x0/0x27 returned 0 after 1 usecs
[    0.310647] calling  create_proc_profile+0x0/0x16f @ 1
[    0.310749] initcall create_proc_profile+0x0/0x16f returned 0 after 9 usecs
[    0.310843] calling  timekeeping_init_device+0x0/0x1d @ 1
[    0.311038] initcall timekeeping_init_device+0x0/0x1d returned 0 after 100 usecs
[    0.311170] calling  init_clocksource_sysfs+0x0/0x43 @ 1
[    0.311377] initcall init_clocksource_sysfs+0x0/0x43 returned 0 after 106 usecs
[    0.311508] calling  init_timer_list_procfs+0x0/0x27 @ 1
[    0.311602] initcall init_timer_list_procfs+0x0/0x27 returned 0 after 2 usecs
[    0.311695] calling  init_tstats_procfs+0x0/0x27 @ 1
[    0.311789] initcall init_tstats_procfs+0x0/0x27 returned 0 after 2 usecs
[    0.311881] calling  futex_init+0x0/0x65 @ 1
[    0.311979] initcall futex_init+0x0/0x65 returned 0 after 8 usecs
[    0.312086] calling  proc_dma_init+0x0/0x1c @ 1
[    0.312179] initcall proc_dma_init+0x0/0x1c returned 0 after 2 usecs
[    0.312277] calling  proc_modules_init+0x0/0x1c @ 1
[    0.312370] initcall proc_modules_init+0x0/0x1c returned 0 after 2 usecs
[    0.312462] calling  kallsyms_init+0x0/0x1f @ 1
[    0.312553] initcall kallsyms_init+0x0/0x1f returned 0 after 2 usecs
[    0.312646] calling  snapshot_device_init+0x0/0xf @ 1
[    0.312801] initcall snapshot_device_init+0x0/0xf returned 0 after 61 usecs
[    0.312895] calling  crash_save_vmcoreinfo_init+0x0/0x348 @ 1
[    0.313023] initcall crash_save_vmcoreinfo_init+0x0/0x348 returned 0 after 34 usecs
[    0.313153] calling  crash_notes_memory_init+0x0/0x31 @ 1
[    0.313247] initcall crash_notes_memory_init+0x0/0x31 returned 0 after 3 usecs
[    0.313384] calling  pid_namespaces_init+0x0/0x27 @ 1
[    0.313477] initcall pid_namespaces_init+0x0/0x27 returned 0 after 2 usecs
[    0.313570] calling  audit_init+0x0/0xd2 @ 1
[    0.313657] audit: initializing netlink socket (disabled)
[    0.313756] type=2000 audit(1249815910.313:1): initialized
[    0.313848] initcall audit_init+0x0/0xd2 returned 0 after 186 usecs
[    0.313941] calling  audit_tree_init+0x0/0x3b @ 1
[    0.314048] initcall audit_tree_init+0x0/0x3b returned 0 after 3 usecs
[    0.314140] calling  init_kprobes+0x0/0x11c @ 1
[    0.324102] initcall init_kprobes+0x0/0x11c returned 0 after 9640 usecs
[    0.324195] calling  utsname_sysctl_init+0x0/0x11 @ 1
[    0.324314] initcall utsname_sysctl_init+0x0/0x11 returned 0 after 22 usecs
[    0.324409] calling  init_markers+0x0/0xf @ 1
[    0.324499] initcall init_markers+0x0/0xf returned 0 after 1 usecs
[    0.324591] calling  init_tracepoints+0x0/0xf @ 1
[    0.324683] initcall init_tracepoints+0x0/0xf returned 0 after 1 usecs
[    0.324774] calling  init_events+0x0/0x5a @ 1
[    0.324867] initcall init_events+0x0/0x5a returned 0 after 2 usecs
[    0.324958] calling  init_sched_switch_trace+0x0/0xf @ 1
[    0.325059] initcall init_sched_switch_trace+0x0/0xf returned 0 after 2 usecs
[    0.325152] calling  init_blk_tracer+0x0/0x4b @ 1
[    0.325243] initcall init_blk_tracer+0x0/0x4b returned 0 after 1 usecs
[    0.325343] calling  perf_counter_sysfs_init+0x0/0x14 @ 1
[    0.325439] initcall perf_counter_sysfs_init+0x0/0x14 returned 0 after 4 usecs
[    0.325569] calling  init_per_zone_wmark_min+0x0/0x59 @ 1
[    0.325746] initcall init_per_zone_wmark_min+0x0/0x59 returned 0 after 83 usecs
[    0.325877] calling  pdflush_init+0x0/0x20 @ 1
[    0.326037] initcall pdflush_init+0x0/0x20 returned 0 after 68 usecs
[    0.326131] calling  kswapd_init+0x0/0x1d @ 1
[    0.326255] initcall kswapd_init+0x0/0x1d returned 0 after 33 usecs
[    0.326350] calling  init_tmpfs+0x0/0xb9 @ 1
[    0.326466] initcall init_tmpfs+0x0/0xb9 returned 0 after 26 usecs
[    0.326558] calling  setup_vmstat+0x0/0x9a @ 1
[    0.326658] initcall setup_vmstat+0x0/0x9a returned 0 after 9 usecs
[    0.326751] calling  mm_sysfs_init+0x0/0x22 @ 1
[    0.326844] initcall mm_sysfs_init+0x0/0x22 returned 0 after 4 usecs
[    0.326936] calling  proc_vmalloc_init+0x0/0x1f @ 1
[    0.327037] initcall proc_vmalloc_init+0x0/0x1f returned 0 after 2 usecs
[    0.327131] calling  init_emergency_pool+0x0/0x57 @ 1
[    0.327243] highmem bounce pool size: 64 pages
[    0.327340] initcall init_emergency_pool+0x0/0x57 returned 0 after 115 usecs
[    0.327433] calling  procswaps_init+0x0/0x1c @ 1
[    0.327527] initcall procswaps_init+0x0/0x1c returned 0 after 2 usecs
[    0.327619] calling  hugetlb_init+0x0/0x230 @ 1
[    0.327709] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[    0.327811] initcall hugetlb_init+0x0/0x230 returned 0 after 99 usecs
[    0.328692] calling  slab_proc_init+0x0/0x1f @ 1
[    0.328784] initcall slab_proc_init+0x0/0x1f returned 0 after 2 usecs
[    0.328876] calling  slab_sysfs_init+0x0/0xb7 @ 1
[    0.333074] initcall slab_sysfs_init+0x0/0xb7 returned 0 after 4008 usecs
[    0.333169] calling  fasync_init+0x0/0x24 @ 1
[    0.333268] initcall fasync_init+0x0/0x24 returned 0 after 6 usecs
[    0.333360] calling  proc_filesystems_init+0x0/0x1c @ 1
[    0.333455] initcall proc_filesystems_init+0x0/0x1c returned 0 after 3 usecs
[    0.333548] calling  dnotify_init+0x0/0x6f @ 1
[    0.333649] initcall dnotify_init+0x0/0x6f returned 0 after 10 usecs
[    0.333741] calling  inotify_setup+0x0/0x11 @ 1
[    0.333833] initcall inotify_setup+0x0/0x11 returned 0 after 1 usecs
[    0.333925] calling  inotify_user_setup+0x0/0x9e @ 1
[    0.334044] initcall inotify_user_setup+0x0/0x9e returned 0 after 20 usecs
[    0.334138] calling  aio_setup+0x0/0x60 @ 1
[    0.334295] initcall aio_setup+0x0/0x60 returned 0 after 65 usecs
[    0.334389] calling  proc_locks_init+0x0/0x1c @ 1
[    0.334483] initcall proc_locks_init+0x0/0x1c returned 0 after 2 usecs
[    0.334575] calling  init_mbcache+0x0/0x11 @ 1
[    0.334665] initcall init_mbcache+0x0/0x11 returned 0 after 1 usecs
[    0.334757] calling  dquot_init+0x0/0xdd @ 1
[    0.334845] VFS: Disk quotas dquot_6.5.2
[    0.335056] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.335156] initcall dquot_init+0x0/0xdd returned 0 after 301 usecs
[    0.335249] calling  init_v2_quota_format+0x0/0xf @ 1
[    0.335349] initcall init_v2_quota_format+0x0/0xf returned 0 after 1 usecs
[    0.335442] calling  proc_cmdline_init+0x0/0x1c @ 1
[    0.335535] initcall proc_cmdline_init+0x0/0x1c returned 0 after 2 usecs
[    0.335629] calling  proc_cpuinfo_init+0x0/0x1c @ 1
[    0.335723] initcall proc_cpuinfo_init+0x0/0x1c returned 0 after 2 usecs
[    0.335815] calling  proc_devices_init+0x0/0x1c @ 1
[    0.335909] initcall proc_devices_init+0x0/0x1c returned 0 after 2 usecs
[    0.336010] calling  proc_interrupts_init+0x0/0x1c @ 1
[    0.336103] initcall proc_interrupts_init+0x0/0x1c returned 0 after 2 usecs
[    0.336197] calling  proc_loadavg_init+0x0/0x1c @ 1
[    0.336297] initcall proc_loadavg_init+0x0/0x1c returned 0 after 2 usecs
[    0.336390] calling  proc_meminfo_init+0x0/0x1c @ 1
[    0.336483] initcall proc_meminfo_init+0x0/0x1c returned 0 after 2 usecs
[    0.336576] calling  proc_stat_init+0x0/0x1c @ 1
[    0.336668] initcall proc_stat_init+0x0/0x1c returned 0 after 2 usecs
[    0.336759] calling  proc_uptime_init+0x0/0x1c @ 1
[    0.336851] initcall proc_uptime_init+0x0/0x1c returned 0 after 2 usecs
[    0.336943] calling  proc_version_init+0x0/0x1c @ 1
[    0.337060] initcall proc_version_init+0x0/0x1c returned 0 after 2 usecs
[    0.337152] calling  proc_softirqs_init+0x0/0x1c @ 1
[    0.337245] initcall proc_softirqs_init+0x0/0x1c returned 0 after 2 usecs
[    0.337347] calling  proc_kcore_init+0x0/0x40 @ 1
[    0.337439] initcall proc_kcore_init+0x0/0x40 returned 0 after 2 usecs
[    0.337532] calling  vmcore_init+0x0/0xa0b @ 1
[    0.337624] initcall vmcore_init+0x0/0xa0b returned 0 after 2 usecs
[    0.337716] calling  proc_kmsg_init+0x0/0x1f @ 1
[    0.337808] initcall proc_kmsg_init+0x0/0x1f returned 0 after 2 usecs
[    0.337901] calling  proc_page_init+0x0/0x33 @ 1
[    0.337995] initcall proc_page_init+0x0/0x33 returned 0 after 3 usecs
[    0.338093] calling  init_devpts_fs+0x0/0x41 @ 1
[    0.338196] initcall init_devpts_fs+0x0/0x41 returned 0 after 12 usecs
[    0.338296] calling  init_ext3_fs+0x0/0x5f @ 1
[    0.338545] initcall init_ext3_fs+0x0/0x5f returned 0 after 154 usecs
[    0.338636] calling  journal_init+0x0/0x85 @ 1
[    0.338965] initcall journal_init+0x0/0x85 returned 0 after 232 usecs
[    0.339070] calling  init_ramfs_fs+0x0/0xf @ 1
[    0.339161] initcall init_ramfs_fs+0x0/0xf returned 0 after 2 usecs
[    0.339254] calling  init_hugetlbfs_fs+0x0/0x84 @ 1
[    0.339441] initcall init_hugetlbfs_fs+0x0/0x84 returned 0 after 88 usecs
[    0.339535] calling  init_fat_fs+0x0/0x46 @ 1
[    0.339774] initcall init_fat_fs+0x0/0x46 returned 0 after 145 usecs
[    0.339866] calling  init_vfat_fs+0x0/0xf @ 1
[    0.339957] initcall init_vfat_fs+0x0/0xf returned 0 after 2 usecs
[    0.340057] calling  init_msdos_fs+0x0/0xf @ 1
[    0.340148] initcall init_msdos_fs+0x0/0xf returned 0 after 2 usecs
[    0.340240] calling  init_iso9660_fs+0x0/0x61 @ 1
[    0.340422] initcall init_iso9660_fs+0x0/0x61 returned 0 after 81 usecs
[    0.340515] calling  init_nfs_fs+0x0/0xf9 @ 1
[    0.340839] initcall init_nfs_fs+0x0/0xf9 returned 0 after 228 usecs
[    0.340931] calling  init_nlm+0x0/0x1c @ 1
[    0.341054] initcall init_nlm+0x0/0x1c returned 0 after 20 usecs
[    0.341146] calling  init_nls_cp437+0x0/0xf @ 1
[    0.341238] initcall init_nls_cp437+0x0/0xf returned 0 after 2 usecs
[    0.341339] calling  init_nls_ascii+0x0/0xf @ 1
[    0.341430] initcall init_nls_ascii+0x0/0xf returned 0 after 1 usecs
[    0.341523] calling  init_nls_iso8859_1+0x0/0xf @ 1
[    0.341615] initcall init_nls_iso8859_1+0x0/0xf returned 0 after 1 usecs
[    0.341707] calling  init_nls_utf8+0x0/0x1f @ 1
[    0.341798] initcall init_nls_utf8+0x0/0x1f returned 0 after 1 usecs
[    0.341891] calling  init_autofs4_fs+0x0/0x1e @ 1
[    0.342055] initcall init_autofs4_fs+0x0/0x1e returned 0 after 71 usecs
[    0.342148] calling  ipc_init+0x0/0x20 @ 1
[    0.342239] msgmni has been set to 1725
[    0.342337] initcall ipc_init+0x0/0x20 returned 0 after 98 usecs
[    0.342430] calling  ipc_sysctl_init+0x0/0x11 @ 1
[    0.342553] initcall ipc_sysctl_init+0x0/0x11 returned 0 after 32 usecs
[    0.342647] calling  init_mqueue_fs+0x0/0x9e @ 1
[    0.342845] initcall init_mqueue_fs+0x0/0x9e returned 0 after 104 usecs
[    0.342938] calling  key_proc_init+0x0/0x48 @ 1
[    0.343041] initcall key_proc_init+0x0/0x48 returned 0 after 4 usecs
[    0.343134] calling  selinux_nf_ip_init+0x0/0x54 @ 1
[    0.343222] SELinux:  Registering netfilter hooks
[    0.343321] initcall selinux_nf_ip_init+0x0/0x54 returned 0 after 94 usecs
[    0.343414] calling  init_sel_fs+0x0/0x5a @ 1
[    0.343585] initcall init_sel_fs+0x0/0x5a returned 0 after 76 usecs
[    0.343677] calling  selnl_init+0x0/0x46 @ 1
[    0.343773] initcall selnl_init+0x0/0x46 returned 0 after 6 usecs
[    0.343864] calling  sel_netif_init+0x0/0x57 @ 1
[    0.343957] initcall sel_netif_init+0x0/0x57 returned 0 after 3 usecs
[    0.344056] calling  sel_netnode_init+0x0/0x68 @ 1
[    0.344149] initcall sel_netnode_init+0x0/0x68 returned 0 after 2 usecs
[    0.344241] calling  sel_netport_init+0x0/0x68 @ 1
[    0.344340] initcall sel_netport_init+0x0/0x68 returned 0 after 2 usecs
[    0.344433] calling  aurule_init+0x0/0x30 @ 1
[    0.344523] initcall aurule_init+0x0/0x30 returned 0 after 1 usecs
[    0.344615] calling  crypto_wq_init+0x0/0x29 @ 1
[    0.344761] initcall crypto_wq_init+0x0/0x29 returned 0 after 54 usecs
[    0.344854] calling  crypto_algapi_init+0x0/0xc @ 1
[    0.344947] initcall crypto_algapi_init+0x0/0xc returned 0 after 3 usecs
[    0.345048] calling  chainiv_module_init+0x0/0xf @ 1
[    0.345141] initcall chainiv_module_init+0x0/0xf returned 0 after 1 usecs
[    0.345234] calling  eseqiv_module_init+0x0/0xf @ 1
[    0.345333] initcall eseqiv_module_init+0x0/0xf returned 0 after 1 usecs
[    0.345425] calling  hmac_module_init+0x0/0xf @ 1
[    0.345517] initcall hmac_module_init+0x0/0xf returned 0 after 1 usecs
[    0.345609] calling  md5_mod_init+0x0/0xf @ 1
[    0.345762] initcall md5_mod_init+0x0/0xf returned 0 after 62 usecs
[    0.345855] calling  sha1_generic_mod_init+0x0/0xf @ 1
[    0.345998] initcall sha1_generic_mod_init+0x0/0xf returned 0 after 50 usecs
[    0.346100] calling  crypto_ecb_module_init+0x0/0xf @ 1
[    0.346193] initcall crypto_ecb_module_init+0x0/0xf returned 0 after 1 usecs
[    0.346291] calling  crypto_cbc_module_init+0x0/0xf @ 1
[    0.346384] initcall crypto_cbc_module_init+0x0/0xf returned 0 after 1 usecs
[    0.346477] calling  des_generic_mod_init+0x0/0x33 @ 1
[    0.346690] initcall des_generic_mod_init+0x0/0x33 returned 0 after 119 usecs
[    0.346785] calling  aes_init+0x0/0xf @ 1
[    0.346945] initcall aes_init+0x0/0xf returned 0 after 69 usecs
[    0.347046] calling  arc4_init+0x0/0xf @ 1
[    0.347226] initcall arc4_init+0x0/0xf returned 0 after 88 usecs
[    0.347324] calling  crypto_authenc_module_init+0x0/0xf @ 1
[    0.347417] initcall crypto_authenc_module_init+0x0/0xf returned 0 after 1 usecs
[    0.347547] calling  krng_mod_init+0x0/0xf @ 1
[    0.347669] alg: No test for stdrng (krng)
[    0.347767] initcall krng_mod_init+0x0/0xf returned 0 after 126 usecs
[    0.347861] calling  proc_genhd_init+0x0/0x2d @ 1
[    0.347956] initcall proc_genhd_init+0x0/0x2d returned 0 after 4 usecs
[    0.348056] calling  bsg_init+0x0/0x10d @ 1
[    0.348296] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.348427] initcall bsg_init+0x0/0x10d returned 0 after 275 usecs
[    0.348519] calling  noop_init+0x0/0x11 @ 1
[    0.348608] io scheduler noop registered
[    0.348696] initcall noop_init+0x0/0x11 returned 0 after 85 usecs
[    0.348786] calling  as_init+0x0/0x11 @ 1
[    0.348874] io scheduler anticipatory registered
[    0.348964] initcall as_init+0x0/0x11 returned 0 after 86 usecs
[    0.349062] calling  deadline_init+0x0/0x11 @ 1
[    0.349150] io scheduler deadline registered
[    0.349239] initcall deadline_init+0x0/0x11 returned 0 after 85 usecs
[    0.349338] calling  cfq_init+0x0/0x91 @ 1
[    0.349515] io scheduler cfq registered (default)
[    0.349605] initcall cfq_init+0x0/0x91 returned 0 after 173 usecs
[    0.349696] calling  percpu_counter_startup+0x0/0x16 @ 1
[    0.349789] initcall percpu_counter_startup+0x0/0x16 returned 0 after 1 usecs
[    0.349882] calling  audit_classes_init+0x0/0x4f @ 1
[    0.349978] initcall audit_classes_init+0x0/0x4f returned 0 after 4 usecs
[    0.350079] calling  pci_init+0x0/0x2c @ 1
[    0.350177] pci 0000:00:02.0: Boot video device
[    0.350285] pci 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x2000
[    0.350377] pci 0000:00:1d.0: Performing full reset
[    0.350482] pci 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x2000
[    0.350573] pci 0000:00:1d.1: Performing full reset
[    0.350677] pci 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x2000
[    0.350769] pci 0000:00:1d.2: Performing full reset
[    0.350873] pci 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x2000
[    0.350964] pci 0000:00:1d.3: Performing full reset
[    0.351107] initcall pci_init+0x0/0x2c returned 0 after 917 usecs
[    0.351199] calling  pci_proc_init+0x0/0x5b @ 1
[    0.351347] initcall pci_proc_init+0x0/0x5b returned 0 after 49 usecs
[    0.351440] calling  pcie_portdrv_init+0x0/0x41 @ 1
[    0.351664]   alloc irq_desc for 24 on node -1
[    0.351752]   alloc kstat_irqs on node -1
[    0.351850] pcieport-driver 0000:00:1c.0: irq 24 for MSI/MSI-X
[    0.351950] pcieport-driver 0000:00:1c.0: setting latency timer to 64
[    0.353132]   alloc irq_desc for 25 on node -1
[    0.353220]   alloc kstat_irqs on node -1
[    0.353324] pcieport-driver 0000:00:1c.1: irq 25 for MSI/MSI-X
[    0.353421] pcieport-driver 0000:00:1c.1: setting latency timer to 64
[    0.353816]   alloc irq_desc for 26 on node -1
[    0.353904]   alloc kstat_irqs on node -1
[    0.353998] pcieport-driver 0000:00:1c.2: irq 26 for MSI/MSI-X
[    0.354105] pcieport-driver 0000:00:1c.2: setting latency timer to 64
[    0.354480]   alloc irq_desc for 27 on node -1
[    0.354567]   alloc kstat_irqs on node -1
[    0.354660] pcieport-driver 0000:00:1c.3: irq 27 for MSI/MSI-X
[    0.354759] pcieport-driver 0000:00:1c.3: setting latency timer to 64
[    0.355139] initcall pcie_portdrv_init+0x0/0x41 returned 0 after 3523 usecs
[    0.355233] calling  aer_service_init+0x0/0x1d @ 1
[    0.355390] initcall aer_service_init+0x0/0x1d returned 0 after 57 usecs
[    0.355483] calling  pci_hotplug_init+0x0/0x18 @ 1
[    0.355573] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.355665] initcall pci_hotplug_init+0x0/0x18 returned 0 after 88 usecs
[    0.355757] calling  fb_console_init+0x0/0xf5 @ 1
[    0.355912] initcall fb_console_init+0x0/0xf5 returned 0 after 63 usecs
[    0.356014] calling  genericbl_init+0x0/0xf @ 1
[    0.356161] initcall genericbl_init+0x0/0xf returned 0 after 55 usecs
[    0.356253] calling  efifb_init+0x0/0x1b8 @ 1
[    0.356357] initcall efifb_init+0x0/0x1b8 returned -19 after 9 usecs
[    0.356450] calling  acpi_reserve_resources+0x0/0xc8 @ 1
[    0.356544] initcall acpi_reserve_resources+0x0/0xc8 returned 0 after 3 usecs
[    0.356638] calling  irqrouter_init_sysfs+0x0/0x33 @ 1
[    0.356829] initcall irqrouter_init_sysfs+0x0/0x33 returned 0 after 97 usecs
[    0.356923] calling  acpi_ac_init+0x0/0x3d @ 1
[    0.357536] ACPI: AC Adapter [AC] (on-line)
[    0.357690] initcall acpi_ac_init+0x0/0x3d returned 0 after 643 usecs
[    0.357785] calling  acpi_button_init+0x0/0x4a @ 1
[    0.357978] input: Power Button as /class/input/input0
[    0.358075] ACPI: Power Button [PWRF]
[    0.358286] input: Lid Switch as /class/input/input1
[    0.358958] ACPI: Lid Switch [LID]
[    0.359153] input: Sleep Button as /class/input/input2
[    0.359245] ACPI: Sleep Button [SLPB]
[    0.359403] initcall acpi_button_init+0x0/0x4a returned 0 after 1490 usecs
[    0.359496] calling  acpi_fan_init+0x0/0x4a @ 1
[    0.359649] initcall acpi_fan_init+0x0/0x4a returned 0 after 61 usecs
[    0.359741] calling  acpi_video_init+0x0/0x6b @ 1
[    0.360402] input: Video Bus as /class/input/input3
[    0.360492] ACPI: Video Device [VID] (multi-head: yes  rom: no  post: no)
[    0.360659] initcall acpi_video_init+0x0/0x6b returned 0 after 807 usecs
[    0.360753] calling  acpi_processor_init+0x0/0xe9 @ 1
[    0.361333] ACPI: SSDT 7f6e609e 001ED (v01  PmRef  Cpu0Ist 00000100 INTL 20050513)
[    0.362054] ACPI: SSDT 7f6e5de1 00238 (v01  PmRef  Cpu0Cst 00000100 INTL 20050513)
[    0.363535] ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])
[    0.363866] processor LNXCPU:00: registered as cooling_device0
[    0.363960] ACPI: Processor [CPU0] (supports 8 throttling states)
[    0.364541] ACPI: SSDT 7f6e628b 00094 (v01  PmRef  Cpu1Ist 00000100 INTL 20050513)
[    0.365193] ACPI: SSDT 7f6e6019 00085 (v01  PmRef  Cpu1Cst 00000100 INTL 20050513)
[    0.366681] ACPI: CPU1 (power states: C1[C1] C2[C2] C3[C3])
[    0.367015] processor LNXCPU:01: registered as cooling_device1
[    0.367108] ACPI: Processor [CPU1] (supports 8 throttling states)
[    0.367390] initcall acpi_processor_init+0x0/0xe9 returned 0 after 6391 usecs
[    0.367484] calling  acpi_container_init+0x0/0x3d @ 1
[    0.372921] initcall acpi_container_init+0x0/0x3d returned 0 after 5219 usecs
[    0.373026] calling  acpi_thermal_init+0x0/0x6f @ 1
[    0.376397] thermal LNXTHERM:01: registered as thermal_zone0
[    0.376493] ACPI: Thermal Zone [THM0] (55 C)
[    0.378159] thermal LNXTHERM:02: registered as thermal_zone1
[    0.378256] ACPI: Thermal Zone [THM1] (56 C)
[    0.378400] initcall acpi_thermal_init+0x0/0x6f returned 0 after 5157 usecs
[    0.378494] calling  acpi_battery_init+0x0/0x13 @ 1
[    0.420206] ACPI: Battery Slot [BAT0] (battery present)
[    0.420371] initcall acpi_battery_init+0x0/0x13 returned 0 after 40805 usecs
[    0.420467] calling  rand_initialize+0x0/0x25 @ 1
[    0.420582] initcall rand_initialize+0x0/0x25 returned 0 after 23 usecs
[    0.420675] calling  tty_init+0x0/0xd5 @ 1
[    0.425266] initcall tty_init+0x0/0xd5 returned 0 after 4393 usecs
[    0.425361] calling  pty_init+0x0/0x20d @ 1
[    0.425540] initcall pty_init+0x0/0x20d returned 0 after 86 usecs
[    0.425633] calling  sysrq_init+0x0/0x1f @ 1
[    0.425726] initcall sysrq_init+0x0/0x1f returned 0 after 4 usecs
[    0.425818] calling  hpet_init+0x0/0x57 @ 1
[    0.426111] initcall hpet_init+0x0/0x57 returned 0 after 197 usecs
[    0.426202] calling  nvram_init+0x0/0x70 @ 1
[    0.426358] Non-volatile memory driver v1.3
[    0.426448] initcall nvram_init+0x0/0x70 returned 0 after 144 usecs
[    0.426540] calling  mod_init+0x0/0x1ba @ 1
[    0.426734] intel_rng: FWH not detected
[    0.426854] initcall mod_init+0x0/0x1ba returned -19 after 219 usecs
[    0.426948] calling  mod_init+0x0/0x9f @ 1
[    0.427073] initcall mod_init+0x0/0x9f returned -19 after 16 usecs
[    0.427165] calling  mod_init+0x0/0x91 @ 1
[    0.427270] initcall mod_init+0x0/0x91 returned -19 after 15 usecs
[    0.427362] calling  mod_init+0x0/0x41 @ 1
[    0.427451] initcall mod_init+0x0/0x41 returned -19 after 0 usecs
[    0.427543] calling  agp_init+0x0/0x21 @ 1
[    0.427631] Linux agpgart interface v0.103
[    0.427720] initcall agp_init+0x0/0x21 returned 0 after 85 usecs
[    0.427811] calling  agp_amd64_init+0x0/0xc0 @ 1
[    0.427970] initcall agp_amd64_init+0x0/0xc0 returned -19 after 65 usecs
[    0.428083] calling  agp_intel_init+0x0/0x24 @ 1
[    0.428184] agpgart-intel 0000:00:00.0: Intel 945GM Chipset
[    0.428933] agpgart-intel 0000:00:00.0: detected 7932K stolen memory
[    0.432042] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000
[    0.432221] initcall agp_intel_init+0x0/0x24 returned 0 after 3948 usecs
[    0.432324] calling  drm_core_init+0x0/0xea @ 1
[    0.432486] [drm] Initialized drm 1.1.0 20060810
[    0.432577] initcall drm_core_init+0x0/0xea returned 0 after 159 usecs
[    0.432669] calling  i915_init+0x0/0x58 @ 1
[    0.432856] pci 0000:00:02.0: power state changed by ACPI to D0
[    0.432952] pci 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    0.433066] pci 0000:00:02.0: setting latency timer to 64
[    0.435959] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
[    0.436130] initcall i915_init+0x0/0x58 returned 0 after 3288 usecs
[    0.436223] calling  cn_proc_init+0x0/0x30 @ 1
[    0.436325] initcall cn_proc_init+0x0/0x30 returned 0 after 3 usecs
[    0.436416] calling  serial8250_init+0x0/0x113 @ 1
[    0.436506] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.436900] async_waiting @ 1
[    0.436986] async_continuing @ 1 after 1 usec
[    0.558108] async_waiting @ 1
[    0.558195] async_continuing @ 1 after 1 usec
[    0.680159] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
[    0.680516] Platform driver 'serial8250' needs updating - please use dev_pm_ops
[    0.680720] initcall serial8250_init+0x0/0x113 returned 0 after 238488 usecs
[    0.680814] calling  serial8250_pnp_init+0x0/0xf @ 1
[    0.681118] initcall serial8250_pnp_init+0x0/0xf returned 0 after 208 usecs
[    0.681212] calling  serial8250_pci_init+0x0/0x16 @ 1
[    0.681414] initcall serial8250_pci_init+0x0/0x16 returned 0 after 99 usecs
[    0.681510] calling  topology_sysfs_init+0x0/0x3f @ 1
[    0.681615] initcall topology_sysfs_init+0x0/0x3f returned 0 after 14 usecs
[    0.681709] calling  brd_init+0x0/0x14e @ 1
[    0.684430] brd: module loaded
[    0.684519] initcall brd_init+0x0/0x14e returned 0 after 2657 usecs
[    0.684612] calling  loop_init+0x0/0x166 @ 1
[    0.685961] loop: module loaded
[    0.686059] initcall loop_init+0x0/0x166 returned 0 after 1325 usecs
[    0.686152] calling  cpqarray_init+0x0/0x22b @ 1
[    0.686240] Compaq SMART2 Driver (v 2.6.0)
[    0.686452] initcall cpqarray_init+0x0/0x22b returned -19 after 204 usecs
[    0.686546] calling  mac_hid_init+0x0/0x75 @ 1
[    0.686729] input: Macintosh mouse button emulation as /class/input/input4
[    0.686851] initcall mac_hid_init+0x0/0x75 returned 0 after 209 usecs
[    0.686943] calling  spi_transport_init+0x0/0x6c @ 1
[    0.687171] initcall spi_transport_init+0x0/0x6c returned 0 after 101 usecs
[    0.687272] calling  ahc_linux_init+0x0/0x5c @ 1
[    0.687446] initcall ahc_linux_init+0x0/0x5c returned 0 after 81 usecs
[    0.687538] calling  init_sd+0x0/0xb6 @ 1
[    0.687733] initcall init_sd+0x0/0xb6 returned 0 after 103 usecs
[    0.687825] calling  init_sr+0x0/0x3d @ 1
[    0.687968] initcall init_sr+0x0/0x3d returned 0 after 52 usecs
[    0.688080] calling  init_sg+0x0/0x133 @ 1
[    0.688234] initcall init_sg+0x0/0x133 returned 0 after 62 usecs
[    0.688333] calling  ahci_init+0x0/0x16 @ 1
[    0.688446] ahci 0000:00:1f.2: version 3.0
[    0.688549] ahci 0000:00:1f.2: PCI INT B -> GSI 16 (level, low) -> IRQ 16
[    0.688679]   alloc irq_desc for 28 on node -1
[    0.688767]   alloc kstat_irqs on node -1
[    0.688863] ahci 0000:00:1f.2: irq 28 for MSI/MSI-X
[    0.689024] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 4 ports 1.5 Gbps 0x1 impl SATA mode
[    0.689157] ahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part 
[    0.689255] ahci 0000:00:1f.2: setting latency timer to 64
[    0.689459] scsi0 : ahci
[    0.689686] scsi1 : ahci
[    0.689879] scsi2 : ahci
[    0.690070] scsi3 : ahci
[    0.690291] ata1: SATA max UDMA/133 abar m1024@0xee444400 port 0xee444500 irq 28
[    0.690419] ata2: DUMMY
[    0.690502] ata3: DUMMY
[    0.690585] ata4: DUMMY
[    1.250038] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    1.251600] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 succeeded
[    1.251693] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 filtered out
[    1.251785] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 filtered out
[    1.253078] ata1.00: ATA-7: HTS541080G9SA00, MB4IC60H, max UDMA/100
[    1.253170] ata1.00: 156301488 sectors, multi 16: LBA48 
[    1.254937] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 succeeded
[    1.255050] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 filtered out
[    1.255932] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 filtered out
[    1.257229] ata1.00: configured for UDMA/100
[    1.270677] ata1.00: configured for UDMA/100
[    1.270768] ata1: EH complete
[    1.270855] async_waiting @ 1
[    1.270941] async_continuing @ 1 after 1 usec
[    1.271148] scsi 0:0:0:0: Direct-Access     ATA      HTS541080G9SA00  MB4I PQ: 0 ANSI: 5
[    1.271477] sd 0:0:0:0: [sda] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
[    1.271659] sd 0:0:0:0: [sda] Write Protect is off
[    1.271748] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.271864] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.272142]  sda: sda1 sda2
[    1.659535] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.659772] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    1.659958] async_waiting @ 1
[    1.660055] async_continuing @ 1 after 1 usec
[    1.660159] async_waiting @ 1
[    1.660245] async_continuing @ 1 after 1 usec
[    1.660355] async_waiting @ 1
[    1.660442] async_continuing @ 1 after 1 usec
[    1.660601] initcall ahci_init+0x0/0x16 returned 0 after 949390 usecs
[    1.660693] calling  piix_init+0x0/0x27 @ 1
[    1.660798] ata_piix 0000:00:1f.1: version 2.13
[    1.660893] ata_piix 0000:00:1f.1: PCI INT C -> GSI 16 (level, low) -> IRQ 16
[    1.661028] ata_piix 0000:00:1f.1: setting latency timer to 64
[    1.661196] scsi4 : ata_piix
[    1.661393] scsi5 : ata_piix
[    1.662298] ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x1810 irq 14
[    1.662391] ata6: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x1818 irq 15
[    1.816409] ata5.00: ATAPI: HL-DT-STCD-RW/DVD DRIVE GCC-4246N, 0X05, max UDMA/33
[    1.822317] ata5.00: configured for UDMA/33
[    1.823055] async_waiting @ 1
[    1.823142] async_continuing @ 1 after 1 usec
[    1.827280] scsi 4:0:0:0: CD-ROM            HL-DT-ST RW/DVD GCC-4246N 0X05 PQ: 0 ANSI: 5
[    1.838286] sr0: scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
[    1.838379] Uniform CD-ROM driver Revision: 3.20
[    1.838690] sr 4:0:0:0: Attached scsi CD-ROM sr0
[    1.838933] sr 4:0:0:0: Attached scsi generic sg1 type 5
[    1.839145] ata6: port disabled. ignoring.
[    1.839241] async_waiting @ 1
[    1.839335] async_continuing @ 1 after 1 usec
[    1.839489] initcall piix_init+0x0/0x27 returned 0 after 174516 usecs
[    1.839582] calling  nv_init+0x0/0x16 @ 1
[    1.839737] initcall nv_init+0x0/0x16 returned 0 after 64 usecs
[    1.839829] calling  amd_init+0x0/0x16 @ 1
[    1.839979] initcall amd_init+0x0/0x16 returned 0 after 59 usecs
[    1.840080] calling  mpiix_init+0x0/0x16 @ 1
[    1.840230] initcall mpiix_init+0x0/0x16 returned 0 after 58 usecs
[    1.840327] calling  oldpiix_init+0x0/0x16 @ 1
[    1.840478] initcall oldpiix_init+0x0/0x16 returned 0 after 59 usecs
[    1.840570] calling  sch_init+0x0/0x16 @ 1
[    1.840719] initcall sch_init+0x0/0x16 returned 0 after 57 usecs
[    1.840810] calling  ata_generic_init+0x0/0x16 @ 1
[    1.840963] initcall ata_generic_init+0x0/0x16 returned 0 after 60 usecs
[    1.841065] calling  e1000_init_module+0x0/0x6e @ 1
[    1.841154] Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
[    1.841246] Copyright (c) 1999-2006 Intel Corporation.
[    1.841412] initcall e1000_init_module+0x0/0x6e returned 0 after 251 usecs
[    1.841505] calling  e1000_init_module+0x0/0x53 @ 1
[    1.841594] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
[    1.841683] e1000e: Copyright (c) 1999-2008 Intel Corporation.
[    1.841874] e1000e 0000:02:00.0: Disabling L1 ASPM
[    1.842048] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    1.842149] e1000e 0000:02:00.0: setting latency timer to 64
[    1.842419]   alloc irq_desc for 29 on node -1
[    1.842507]   alloc kstat_irqs on node -1
[    1.842609] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    1.883473] e1000e 0000:02:00.0: Warning: detected ASPM enabled in EEPROM
[    1.925641] 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:16:41:17:49:d2
[    1.925771] 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
[    1.925937] 0000:02:00.0: eth0: MAC: 2, PHY: 2, PBA No: 005301-003
[    1.926107] initcall e1000_init_module+0x0/0x53 returned 0 after 82530 usecs
[    1.926200] calling  vortex_init+0x0/0x9b @ 1
[    1.926364] initcall vortex_init+0x0/0x9b returned 0 after 66 usecs
[    1.926457] calling  ne2k_pci_init+0x0/0x16 @ 1
[    1.926608] initcall ne2k_pci_init+0x0/0x16 returned 0 after 60 usecs
[    1.926701] calling  e100_init_module+0x0/0x4d @ 1
[    1.926790] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    1.926880] e100: Copyright(c) 1999-2006 Intel Corporation
[    1.927046] initcall e100_init_module+0x0/0x4d returned 0 after 248 usecs
[    1.927138] calling  tg3_init+0x0/0x16 @ 1
[    1.927304] initcall tg3_init+0x0/0x16 returned 0 after 74 usecs
[    1.927396] calling  bnx2_init+0x0/0x16 @ 1
[    1.927547] initcall bnx2_init+0x0/0x16 returned 0 after 59 usecs
[    1.927639] calling  sky2_init_module+0x0/0x20 @ 1
[    1.927727] sky2 driver version 1.23
[    1.927880] initcall sky2_init_module+0x0/0x20 returned 0 after 147 usecs
[    1.927973] calling  net_olddevs_init+0x0/0x81 @ 1
[    1.928076] initcall net_olddevs_init+0x0/0x81 returned 0 after 5 usecs
[    1.928169] calling  init_nic+0x0/0x16 @ 1
[    1.928328] initcall init_nic+0x0/0x16 returned 0 after 66 usecs
[    1.928420] calling  rtl8139_init_module+0x0/0x16 @ 1
[    1.928576] initcall rtl8139_init_module+0x0/0x16 returned 0 after 64 usecs
[    1.928670] calling  rtl8169_init_module+0x0/0x16 @ 1
[    1.928823] initcall rtl8169_init_module+0x0/0x16 returned 0 after 60 usecs
[    1.928917] calling  init_ath5k_pci+0x0/0x2d @ 1
[    1.929084] initcall init_ath5k_pci+0x0/0x2d returned 0 after 68 usecs
[    1.929176] calling  init_netconsole+0x0/0x1a2 @ 1
[    1.929275] netconsole: local port 4444
[    1.929361] netconsole: local IP 10.0.1.15
[    1.929448] netconsole: interface eth0
[    1.929535] netconsole: remote port 4444
[    1.929621] netconsole: remote IP 10.0.1.21
[    1.929709] netconsole: remote ethernet address 00:30:48:c6:86:26
[    1.929801] netconsole: device eth0 not up yet, forcing it
[    1.943283] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    1.994113] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    4.659020] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
[    4.817190] console [netcon0] enabled
[    4.817294] netconsole: network logging started
[    4.817394] initcall init_netconsole+0x0/0x1a2 returned 0 after 2820429 usecs
[    4.817497] calling  cdrom_init+0x0/0xc @ 1
[    4.817596] initcall cdrom_init+0x0/0xc returned 0 after 1 usecs
[    4.817697] calling  nonstatic_sysfs_init+0x0/0xf @ 1
[    4.817803] initcall nonstatic_sysfs_init+0x0/0xf returned 0 after 5 usecs
[    4.817906] calling  yenta_socket_init+0x0/0x16 @ 1
[    4.818039] yenta_cardbus 0000:15:00.0: CardBus bridge found [17aa:2012]
[    4.818164] yenta_cardbus 0000:15:00.0: Using INTVAL to route CSC interrupts to PCI
[    4.818312] yenta_cardbus 0000:15:00.0: Routing CardBus interrupts to PCI
[    4.818417] yenta_cardbus 0000:15:00.0: TI: mfunc 0x01d01002, devctl 0x64
[    4.919062] async_waiting @ 1
[    4.919152] async_continuing @ 1 after 1 usec
[    5.041827] yenta_cardbus 0000:15:00.0: ISA IRQ mask 0x0cf8, PCI irq 16
[    5.041922] yenta_cardbus 0000:15:00.0: Socket status: 30000007
[    5.042032] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge I/O window: 0x9000 - 0xcfff
[    5.042173] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge Memory window: 0xe4300000 - 0xe7ffffff
[    5.042326] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge Memory window: 0xe0000000 - 0xe3ffffff
[    5.293140] initcall yenta_socket_init+0x0/0x16 returned 0 after 463995 usecs
[    5.293235] calling  mon_init+0x0/0xe2 @ 1
[    5.293480] initcall mon_init+0x0/0xe2 returned 0 after 131 usecs
[    5.293574] calling  ehci_hcd_init+0x0/0xbf @ 1
[    5.293672] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.293774] ehci_hcd: block sizes: qh 128 qtd 96 itd 160 sitd 96
[    5.294375] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[    5.294474]   alloc irq_desc for 19 on node -1
[    5.294564]   alloc kstat_irqs on node -1
[    5.294664] IOAPIC[0]: Set routing entry (1-19 -> 0xb1 -> IRQ 19 Mode:1 Active:1)
[    5.294802] ehci_hcd 0000:00:1d.7: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[    5.294912] ehci_hcd 0000:00:1d.7: setting latency timer to 64
[    5.295024] ehci_hcd 0000:00:1d.7: EHCI Host Controller
[    5.295145] drivers/usb/core/inode.c: creating file 'devices'
[    5.295247] drivers/usb/core/inode.c: creating file '001'
[    5.295428] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1
[    5.295566] ehci_hcd 0000:00:1d.7: reset hcs_params 0x104208 dbg=1 cc=4 pcc=2 ordered !ppc ports=8
[    5.295707] ehci_hcd 0000:00:1d.7: reset hcc_params 6871 thresh 7 uframes 1024 64 bit addr
[    5.295867] ehci_hcd 0000:00:1d.7: reset command 080022 (park)=0 ithresh=8 Async period=1024 Reset HALT
[    5.299905] ehci_hcd 0000:00:1d.7: debug port 1
[    5.300000] ehci_hcd 0000:00:1d.7: cache line size of 32 is not supported
[    5.300108] ehci_hcd 0000:00:1d.7: supports USB remote wakeup
[    5.300219] ehci_hcd 0000:00:1d.7: irq 19, io mem 0xee444000
[    5.300328] ehci_hcd 0000:00:1d.7: reset command 080002 (park)=0 ithresh=8 period=1024 Reset HALT
[    5.304353] ehci_hcd 0000:00:1d.7: init command 010001 (park)=0 ithresh=1 period=1024 RUN
[    5.310015] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[    5.310158] usb usb1: default language 0x0409
[    5.310254] usb usb1: udev 1, busnum 1, minor = 0
[    5.310353] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    5.310454] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.310591] usb usb1: Product: EHCI Host Controller
[    5.310687] usb usb1: Manufacturer: Linux 2.6.31-rc5-tip ehci_hcd
[    5.310786] usb usb1: SerialNumber: 0000:00:1d.7
[    5.310930] usb usb1: uevent
[    5.311098] usb usb1: usb_probe_device
[    5.311187] usb usb1: configuration #1 chosen from 1 choice
[    5.311297] usb usb1: adding 1-0:1.0 (config #1, interface 0)
[    5.311412] usb 1-0:1.0: uevent
[    5.311563] hub 1-0:1.0: usb_probe_interface
[    5.311653] hub 1-0:1.0: usb_probe_interface - got id
[    5.311751] hub 1-0:1.0: USB hub found
[    5.311851] hub 1-0:1.0: 8 ports detected
[    5.311946] hub 1-0:1.0: standalone hub
[    5.312049] hub 1-0:1.0: no power switching (usb 1.0)
[    5.312145] hub 1-0:1.0: individual port over-current protection
[    5.312245] hub 1-0:1.0: power on to power good time: 20ms
[    5.312352] hub 1-0:1.0: local power source is good
[    5.312450] hub 1-0:1.0: trying to enable port power on non-switchable hub
[    5.312599] drivers/usb/core/inode.c: creating file '001'
[    5.312771] initcall ehci_hcd_init+0x0/0xbf returned 0 after 18649 usecs
[    5.312865] calling  ohci_hcd_mod_init+0x0/0x94 @ 1
[    5.312963] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.313070] ohci_hcd: block sizes: ed 64 td 64
[    5.313243] initcall ohci_hcd_mod_init+0x0/0x94 returned 0 after 271 usecs
[    5.313344] calling  uhci_hcd_init+0x0/0x10a @ 1
[    5.313441] uhci_hcd: USB Universal Host Controller Interface driver
[    5.314123] uhci_hcd 0000:00:1d.0: power state changed by ACPI to D0
[    5.314220] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    5.314334] uhci_hcd 0000:00:1d.0: setting latency timer to 64
[    5.314433] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[    5.314535] drivers/usb/core/inode.c: creating file '002'
[    5.314718] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2
[    5.314853] uhci_hcd 0000:00:1d.0: detected 2 ports
[    5.314954] uhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: cmd = 0x0000
[    5.315062] uhci_hcd 0000:00:1d.0: Performing full reset
[    5.315182] uhci_hcd 0000:00:1d.0: supports USB remote wakeup
[    5.315284] uhci_hcd 0000:00:1d.0: irq 16, io base 0x00001820
[    5.315433] usb usb2: default language 0x0409
[    5.315529] usb usb2: udev 1, busnum 2, minor = 128
[    5.315627] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    5.315728] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.315865] usb usb2: Product: UHCI Host Controller
[    5.315961] usb usb2: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
[    5.316068] usb usb2: SerialNumber: 0000:00:1d.0
[    5.316207] usb usb2: uevent
[    5.316373] usb usb2: usb_probe_device
[    5.317244] usb usb2: configuration #1 chosen from 1 choice
[    5.317354] usb usb2: adding 2-0:1.0 (config #1, interface 0)
[    5.317470] usb 2-0:1.0: uevent
[    5.317619] hub 2-0:1.0: usb_probe_interface
[    5.317717] hub 2-0:1.0: usb_probe_interface - got id
[    5.317813] hub 2-0:1.0: USB hub found
[    5.317913] hub 2-0:1.0: 2 ports detected
[    5.318015] hub 2-0:1.0: standalone hub
[    5.318111] hub 2-0:1.0: no power switching (usb 1.0)
[    5.318208] hub 2-0:1.0: individual port over-current protection
[    5.318315] hub 2-0:1.0: power on to power good time: 2ms
[    5.318416] hub 2-0:1.0: local power source is good
[    5.318513] hub 2-0:1.0: trying to enable port power on non-switchable hub
[    5.318631] drivers/usb/core/inode.c: creating file '001'
[    5.318767]   alloc irq_desc for 17 on node -1
[    5.318857]   alloc kstat_irqs on node -1
[    5.318956] IOAPIC[0]: Set routing entry (1-17 -> 0xb9 -> IRQ 17 Mode:1 Active:1)
[    5.319103] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[    5.319208] uhci_hcd 0000:00:1d.1: setting latency timer to 64
[    5.319316] uhci_hcd 0000:00:1d.1: UHCI Host Controller
[    5.319417] drivers/usb/core/inode.c: creating file '003'
[    5.319593] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3
[    5.319729] uhci_hcd 0000:00:1d.1: detected 2 ports
[    5.319830] uhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: cmd = 0x0000
[    5.319930] uhci_hcd 0000:00:1d.1: Performing full reset
[    5.320048] uhci_hcd 0000:00:1d.1: supports USB remote wakeup
[    5.320159] uhci_hcd 0000:00:1d.1: irq 17, io base 0x00001840
[    5.320293] usb usb3: default language 0x0409
[    5.320397] usb usb3: udev 1, busnum 3, minor = 256
[    5.320494] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
[    5.320595] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.320731] usb usb3: Product: UHCI Host Controller
[    5.320828] usb usb3: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
[    5.320927] usb usb3: SerialNumber: 0000:00:1d.1
[    5.321082] usb usb3: uevent
[    5.321232] usb usb3: usb_probe_device
[    5.321327] usb usb3: configuration #1 chosen from 1 choice
[    5.321430] usb usb3: adding 3-0:1.0 (config #1, interface 0)
[    5.321545] usb 3-0:1.0: uevent
[    5.321699] hub 3-0:1.0: usb_probe_interface
[    5.321787] hub 3-0:1.0: usb_probe_interface - got id
[    5.321883] hub 3-0:1.0: USB hub found
[    5.321985] hub 3-0:1.0: 2 ports detected
[    5.322087] hub 3-0:1.0: standalone hub
[    5.322182] hub 3-0:1.0: no power switching (usb 1.0)
[    5.322285] hub 3-0:1.0: individual port over-current protection
[    5.322385] hub 3-0:1.0: power on to power good time: 2ms
[    5.322485] hub 3-0:1.0: local power source is good
[    5.322582] hub 3-0:1.0: trying to enable port power on non-switchable hub
[    5.322702] drivers/usb/core/inode.c: creating file '001'
[    5.323510] uhci_hcd 0000:00:1d.2: power state changed by ACPI to D0
[    5.323605]   alloc irq_desc for 18 on node -1
[    5.323693]   alloc kstat_irqs on node -1
[    5.323791] IOAPIC[0]: Set routing entry (1-18 -> 0xc1 -> IRQ 18 Mode:1 Active:1)
[    5.323929] uhci_hcd 0000:00:1d.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[    5.324043] uhci_hcd 0000:00:1d.2: setting latency timer to 64
[    5.324143] uhci_hcd 0000:00:1d.2: UHCI Host Controller
[    5.324244] drivers/usb/core/inode.c: creating file '004'
[    5.324427] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4
[    5.324563] uhci_hcd 0000:00:1d.2: detected 2 ports
[    5.324663] uhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: cmd = 0x0000
[    5.324763] uhci_hcd 0000:00:1d.2: Performing full reset
[    5.324875] uhci_hcd 0000:00:1d.2: supports USB remote wakeup
[    5.324985] uhci_hcd 0000:00:1d.2: irq 18, io base 0x00001860
[    5.325132] usb usb4: default language 0x0409
[    5.325227] usb usb4: udev 1, busnum 4, minor = 384
[    5.325331] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
[    5.325432] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.325568] usb usb4: Product: UHCI Host Controller
[    5.325665] usb usb4: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
[    5.325765] usb usb4: SerialNumber: 0000:00:1d.2
[    5.325905] usb usb4: uevent
[    5.326071] usb usb4: usb_probe_device
[    5.326160] usb usb4: configuration #1 chosen from 1 choice
[    5.326264] usb usb4: adding 4-0:1.0 (config #1, interface 0)
[    5.326382] usb 4-0:1.0: uevent
[    5.326533] hub 4-0:1.0: usb_probe_interface
[    5.326622] hub 4-0:1.0: usb_probe_interface - got id
[    5.326719] hub 4-0:1.0: USB hub found
[    5.326820] hub 4-0:1.0: 2 ports detected
[    5.326915] hub 4-0:1.0: standalone hub
[    5.327017] hub 4-0:1.0: no power switching (usb 1.0)
[    5.327114] hub 4-0:1.0: individual port over-current protection
[    5.327213] hub 4-0:1.0: power on to power good time: 2ms
[    5.327322] hub 4-0:1.0: local power source is good
[    5.327418] hub 4-0:1.0: trying to enable port power on non-switchable hub
[    5.327536] drivers/usb/core/inode.c: creating file '001'
[    5.327677] uhci_hcd 0000:00:1d.3: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[    5.327774] uhci_hcd 0000:00:1d.3: setting latency timer to 64
[    5.327876] uhci_hcd 0000:00:1d.3: UHCI Host Controller
[    5.327977] drivers/usb/core/inode.c: creating file '005'
[    5.328167] uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 5
[    5.328311] uhci_hcd 0000:00:1d.3: detected 2 ports
[    5.328411] uhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: cmd = 0x0000
[    5.328512] uhci_hcd 0000:00:1d.3: Performing full reset
[    5.328627] uhci_hcd 0000:00:1d.3: irq 19, io base 0x00001880
[    5.328768] usb usb5: default language 0x0409
[    5.328863] usb usb5: udev 1, busnum 5, minor = 512
[    5.328961] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001
[    5.329070] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.329208] usb usb5: Product: UHCI Host Controller
[    5.329313] usb usb5: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
[    5.329413] usb usb5: SerialNumber: 0000:00:1d.3
[    5.329563] usb usb5: uevent
[    5.329713] usb usb5: usb_probe_device
[    5.329801] usb usb5: configuration #1 chosen from 1 choice
[    5.329906] usb usb5: adding 5-0:1.0 (config #1, interface 0)
[    5.330029] usb 5-0:1.0: uevent
[    5.330179] hub 5-0:1.0: usb_probe_interface
[    5.330275] hub 5-0:1.0: usb_probe_interface - got id
[    5.330372] hub 5-0:1.0: USB hub found
[    5.330472] hub 5-0:1.0: 2 ports detected
[    5.330568] hub 5-0:1.0: standalone hub
[    5.330663] hub 5-0:1.0: no power switching (usb 1.0)
[    5.330761] hub 5-0:1.0: individual port over-current protection
[    5.330861] hub 5-0:1.0: power on to power good time: 2ms
[    5.330961] hub 5-0:1.0: local power source is good
[    5.331067] hub 5-0:1.0: trying to enable port power on non-switchable hub
[    5.331184] drivers/usb/core/inode.c: creating file '001'
[    5.331381] initcall uhci_hcd_init+0x0/0x10a returned 0 after 17516 usecs
[    5.331476] calling  usblp_init+0x0/0x16 @ 1
[    5.331635] usbcore: registered new interface driver usblp
[    5.331730] initcall usblp_init+0x0/0x16 returned 0 after 152 usecs
[    5.331830] calling  usb_stor_init+0x0/0x42 @ 1
[    5.331927] Initializing USB Mass Storage driver...
[    5.332119] usbcore: registered new interface driver usb-storage
[    5.332211] USB Mass Storage support registered.
[    5.332319] initcall usb_stor_init+0x0/0x42 returned 0 after 381 usecs
[    5.332420] calling  usb_usual_init+0x0/0x30 @ 1
[    5.332603] usbcore: registered new interface driver libusual
[    5.332699] initcall usb_usual_init+0x0/0x30 returned 0 after 176 usecs
[    5.332801] calling  i8042_init+0x0/0x35f @ 1
[    5.333051] PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    5.333202] Platform driver 'i8042' needs updating - please use dev_pm_ops
[    5.341619] serio: i8042 KBD port at 0x60,0x64 irq 1
[    5.341716] serio: i8042 AUX port at 0x60,0x64 irq 12
[    5.341854] initcall i8042_init+0x0/0x35f returned 0 after 8744 usecs
[    5.341949] calling  serport_init+0x0/0x2b @ 1
[    5.342057] initcall serport_init+0x0/0x2b returned 0 after 1 usecs
[    5.342157] calling  mousedev_init+0x0/0x51 @ 1
[    5.342433] mice: PS/2 mouse device common for all mice
[    5.342526] initcall mousedev_init+0x0/0x51 returned 0 after 263 usecs
[    5.342627] calling  evdev_init+0x0/0xf @ 1
[    5.343079] initcall evdev_init+0x0/0xf returned 0 after 345 usecs
[    5.343173] calling  atkbd_init+0x0/0x20 @ 1
[    5.343350] initcall atkbd_init+0x0/0x20 returned 0 after 72 usecs
[    5.343444] calling  psmouse_init+0x0/0x61 @ 1
[    5.343667] initcall psmouse_init+0x0/0x61 returned 0 after 121 usecs
[    5.343761] calling  cmos_init+0x0/0x65 @ 1
[    5.343890] rtc_cmos 00:07: RTC can wake from S4
[    5.344078] rtc_cmos 00:07: rtc core: registered rtc_cmos as rtc0
[    5.344201] rtc0: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[    5.344386] initcall cmos_init+0x0/0x65 returned 0 after 513 usecs
[    5.344480] calling  i2c_i801_init+0x0/0x16 @ 1
[    5.344596] i801_smbus 0000:00:1f.3: PCI INT A -> GSI 23 (level, low) -> IRQ 23
[    5.344903] initcall i2c_i801_init+0x0/0x16 returned 0 after 316 usecs
[    5.344997] calling  dm_init+0x0/0x39 @ 1
[    5.345454] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
[    5.345590] initcall dm_init+0x0/0x39 returned 0 after 474 usecs
[    5.345690] calling  dm_mirror_init+0x0/0x69 @ 1
[    5.345811] initcall dm_mirror_init+0x0/0x69 returned 0 after 16 usecs
[    5.345912] calling  dm_dirty_log_init+0x0/0x49 @ 1
[    5.346021] initcall dm_dirty_log_init+0x0/0x49 returned 0 after 1 usecs
[    5.346122] calling  dm_zero_init+0x0/0x28 @ 1
[    5.346221] initcall dm_zero_init+0x0/0x28 returned 0 after 1 usecs
[    5.346330] calling  cpufreq_gov_dbs_init+0x0/0x9f @ 1
[    5.346526] initcall cpufreq_gov_dbs_init+0x0/0x9f returned 0 after 88 usecs
[    5.346621] calling  init_ladder+0x0/0xf @ 1
[    5.347188] cpuidle: using governor ladder
[    5.348068] initcall init_ladder+0x0/0xf returned 0 after 1315 usecs
[    5.348169] calling  init_menu+0x0/0xf @ 1
[    5.349088] input: AT Translated Set 2 keyboard as /class/input/input5
[    5.349518] cpuidle: using governor menu
[    5.349610] initcall init_menu+0x0/0xf returned 0 after 1308 usecs
[    5.349711] calling  efivars_init+0x0/0x187 @ 1
[    5.349810] initcall efivars_init+0x0/0x187 returned -19 after 1 usecs
[    5.349912] calling  hid_init+0x0/0x3d @ 1
[    5.350186] initcall hid_init+0x0/0x3d returned 0 after 165 usecs
[    5.350284] calling  a4_init+0x0/0x16 @ 1
[    5.350470] initcall a4_init+0x0/0x16 returned 0 after 71 usecs
[    5.350563] calling  apple_init+0x0/0x2d @ 1
[    5.350740] initcall apple_init+0x0/0x2d returned 0 after 76 usecs
[    5.350833] calling  belkin_init+0x0/0x16 @ 1
[    5.350989] initcall belkin_init+0x0/0x16 returned 0 after 56 usecs
[    5.351097] calling  ch_init+0x0/0x16 @ 1
[    5.351275] initcall ch_init+0x0/0x16 returned 0 after 77 usecs
[    5.351369] calling  ch_init+0x0/0x16 @ 1
[    5.351539] initcall ch_init+0x0/0x16 returned 0 after 70 usecs
[    5.351632] calling  cp_init+0x0/0x16 @ 1
[    5.351791] initcall cp_init+0x0/0x16 returned 0 after 60 usecs
[    5.351885] calling  dr_init+0x0/0x16 @ 1
[    5.352056] initcall dr_init+0x0/0x16 returned 0 after 71 usecs
[    5.352149] calling  ez_init+0x0/0x16 @ 1
[    5.352342] initcall ez_init+0x0/0x16 returned 0 after 93 usecs
[    5.352435] calling  gyration_init+0x0/0x16 @ 1
[    5.352620] initcall gyration_init+0x0/0x16 returned 0 after 83 usecs
[    5.352715] calling  ks_init+0x0/0x16 @ 1
[    5.352904] initcall ks_init+0x0/0x16 returned 0 after 89 usecs
[    5.352998] calling  kye_init+0x0/0x16 @ 1
[    5.353189] initcall kye_init+0x0/0x16 returned 0 after 73 usecs
[    5.353285] calling  lg_init+0x0/0x16 @ 1
[    5.353468] initcall lg_init+0x0/0x16 returned 0 after 71 usecs
[    5.353562] calling  ms_init+0x0/0x16 @ 1
[    5.353974] initcall ms_init+0x0/0x16 returned 0 after 300 usecs
[    5.354089] calling  mr_init+0x0/0x16 @ 1
[    5.354263] initcall mr_init+0x0/0x16 returned 0 after 72 usecs
[    5.354364] calling  ntrig_init+0x0/0x16 @ 1
[    5.354534] initcall ntrig_init+0x0/0x16 returned 0 after 69 usecs
[    5.354628] calling  pl_init+0x0/0x16 @ 1
[    5.354794] initcall pl_init+0x0/0x16 returned 0 after 66 usecs
[    5.354887] calling  pl_init+0x0/0x16 @ 1
[    5.355059] initcall pl_init+0x0/0x16 returned 0 after 72 usecs
[    5.355151] calling  samsung_init+0x0/0x16 @ 1
[    5.355343] initcall samsung_init+0x0/0x16 returned 0 after 90 usecs
[    5.355436] calling  sjoy_init+0x0/0x16 @ 1
[    5.355616] initcall sjoy_init+0x0/0x16 returned 0 after 79 usecs
[    5.355710] calling  sony_init+0x0/0x16 @ 1
[    5.355898] initcall sony_init+0x0/0x16 returned 0 after 87 usecs
[    5.355992] calling  sp_init+0x0/0x16 @ 1
[    5.356194] initcall sp_init+0x0/0x16 returned 0 after 85 usecs
[    5.356290] calling  ga_init+0x0/0x16 @ 1
[    5.356481] initcall ga_init+0x0/0x16 returned 0 after 75 usecs
[    5.356574] calling  tm_init+0x0/0x16 @ 1
[    5.356733] initcall tm_init+0x0/0x16 returned 0 after 59 usecs
[    5.356826] calling  ts_init+0x0/0x16 @ 1
[    5.357000] initcall ts_init+0x0/0x16 returned 0 after 67 usecs
[    5.357106] calling  zp_init+0x0/0x16 @ 1
[    5.357289] initcall zp_init+0x0/0x16 returned 0 after 82 usecs
[    5.357382] calling  hid_init+0x0/0xaa @ 1
[    5.357681] usbcore: registered new interface driver hiddev
[    5.357859] usbcore: registered new interface driver usbhid
[    5.357951] usbhid: v2.6:USB HID core driver
[    5.358071] initcall hid_init+0x0/0xaa returned 0 after 576 usecs
[    5.358171] calling  usb_mouse_init+0x0/0x2d @ 1
[    5.358602] usbcore: registered new interface driver usbmouse
[    5.358695] usbmouse: v1.6:USB HID Boot Protocol mouse driver
[    5.358797] initcall usb_mouse_init+0x0/0x2d returned 0 after 511 usecs
[    5.358899] calling  eeepc_laptop_init+0x0/0x3e1 @ 1
[    5.359180] initcall eeepc_laptop_init+0x0/0x3e1 returned -19 after 176 usecs
[    5.359277] calling  init_soundcore+0x0/0x64 @ 1
[    5.359459] initcall init_soundcore+0x0/0x64 returned 0 after 66 usecs
[    5.359553] calling  alsa_sound_init+0x0/0x77 @ 1
[    5.359667] Advanced Linux Sound Architecture Driver Version 1.0.20.
[    5.359770] initcall alsa_sound_init+0x0/0x77 returned 0 after 113 usecs
[    5.359872] calling  alsa_hwdep_init+0x0/0x46 @ 1
[    5.359974] initcall alsa_hwdep_init+0x0/0x46 returned 0 after 3 usecs
[    5.360098] calling  alsa_timer_init+0x0/0x12c @ 1
[    5.360287] initcall alsa_timer_init+0x0/0x12c returned 0 after 88 usecs
[    5.360382] calling  snd_hrtimer_init+0x0/0xd4 @ 1
[    5.360482] initcall snd_hrtimer_init+0x0/0xd4 returned 0 after 1 usecs
[    5.360584] calling  alsa_pcm_init+0x0/0x4d @ 1
[    5.360684] initcall alsa_pcm_init+0x0/0x4d returned 0 after 2 usecs
[    5.360785] calling  snd_mem_init+0x0/0x24 @ 1
[    5.360887] initcall snd_mem_init+0x0/0x24 returned 0 after 3 usecs
[    5.360987] calling  alsa_mixer_oss_init+0x0/0x2d @ 1
[    5.361111] initcall alsa_mixer_oss_init+0x0/0x2d returned 0 after 8 usecs
[    5.361206] calling  alsa_pcm_oss_init+0x0/0x76 @ 1
[    5.361322] initcall alsa_pcm_oss_init+0x0/0x76 returned 0 after 1 usecs
[    5.361431] calling  alsa_seq_init+0x0/0x51 @ 1
[    5.361905] initcall alsa_seq_init+0x0/0x51 returned 0 after 366 usecs
[    5.362000] calling  alsa_seq_device_init+0x0/0x4e @ 1
[    5.362110] initcall alsa_seq_device_init+0x0/0x4e returned 0 after 2 usecs
[    5.362212] calling  alsa_seq_midi_event_init+0x0/0x7 @ 1
[    5.362317] initcall alsa_seq_midi_event_init+0x0/0x7 returned 0 after 1 usecs
[    5.362466] calling  alsa_seq_oss_init+0x0/0x130 @ 1
[    5.362833] initcall alsa_seq_oss_init+0x0/0x130 returned 0 after 260 usecs
[    5.362929] calling  alsa_seq_dummy_init+0x0/0xa7 @ 1
[    5.363059] initcall alsa_seq_dummy_init+0x0/0xa7 returned 0 after 14 usecs
[    5.363153] calling  patch_realtek_init+0x0/0xf @ 1
[    5.363258] initcall patch_realtek_init+0x0/0xf returned 0 after 4 usecs
[    5.363371] calling  patch_cmedia_init+0x0/0xf @ 1
[    5.363472] initcall patch_cmedia_init+0x0/0xf returned 0 after 1 usecs
[    5.363572] calling  patch_analog_init+0x0/0xf @ 1
[    5.363673] initcall patch_analog_init+0x0/0xf returned 0 after 1 usecs
[    5.363773] calling  patch_sigmatel_init+0x0/0xf @ 1
[    5.363874] initcall patch_sigmatel_init+0x0/0xf returned 0 after 1 usecs
[    5.363975] calling  patch_si3054_init+0x0/0xf @ 1
[    5.364082] initcall patch_si3054_init+0x0/0xf returned 0 after 1 usecs
[    5.364183] calling  patch_atihdmi_init+0x0/0xf @ 1
[    5.364286] initcall patch_atihdmi_init+0x0/0xf returned 0 after 1 usecs
[    5.364397] calling  patch_ca0110_init+0x0/0xf @ 1
[    5.364497] initcall patch_ca0110_init+0x0/0xf returned 0 after 1 usecs
[    5.364597] calling  patch_conexant_init+0x0/0xf @ 1
[    5.364697] initcall patch_conexant_init+0x0/0xf returned 0 after 1 usecs
[    5.364798] calling  patch_via_init+0x0/0xf @ 1
[    5.364898] initcall patch_via_init+0x0/0xf returned 0 after 1 usecs
[    5.364998] calling  patch_nvhdmi_init+0x0/0xf @ 1
[    5.365106] initcall patch_nvhdmi_init+0x0/0xf returned 0 after 1 usecs
[    5.365208] calling  patch_intelhdmi_init+0x0/0xf @ 1
[    5.365312] initcall patch_intelhdmi_init+0x0/0xf returned 0 after 1 usecs
[    5.365425] calling  alsa_card_azx_init+0x0/0x16 @ 1
[    5.365557] HDA Intel 0000:00:1b.0: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[    5.365689] hda_intel: probe_mask set to 0x1 for device 17aa:2010
[    5.365808] HDA Intel 0000:00:1b.0: setting latency timer to 64
[    5.399675] initcall alsa_card_azx_init+0x0/0x16 returned 0 after 33348 usecs
[    5.399772] calling  alsa_sound_last_init+0x0/0x50 @ 1
[    5.399872] ALSA device list:
[    5.399965]   #0: HDA Intel at 0xee240000 irq 17
[    5.400078] initcall alsa_sound_last_init+0x0/0x50 returned 0 after 199 usecs
[    5.400181] calling  flow_cache_init+0x0/0x141 @ 1
[    5.400318] initcall flow_cache_init+0x0/0x141 returned 0 after 33 usecs
[    5.400412] calling  llc_init+0x0/0x1b @ 1
[    5.400512] initcall llc_init+0x0/0x1b returned 0 after 1 usecs
[    5.400612] calling  snap_init+0x0/0x31 @ 1
[    5.400710] initcall snap_init+0x0/0x31 returned 0 after 1 usecs
[    5.400811] calling  rif_init+0x0/0x6b @ 1
[    5.400934] initcall rif_init+0x0/0x6b returned 0 after 24 usecs
[    5.401056] calling  blackhole_module_init+0x0/0xf @ 1
[    5.401158] initcall blackhole_module_init+0x0/0xf returned 0 after 1 usecs
[    5.401263] calling  nfnetlink_init+0x0/0x51 @ 1
[    5.401372] Netfilter messages via NETLINK v0.30.
[    5.401479] initcall nfnetlink_init+0x0/0x51 returned 0 after 102 usecs
[    5.401581] calling  nfnetlink_log_init+0x0/0xb3 @ 1
[    5.401699] initcall nfnetlink_log_init+0x0/0xb3 returned 0 after 10 usecs
[    5.401802] calling  nf_conntrack_standalone_init+0x0/0xf @ 1
[    5.401903] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[    5.402740] initcall nf_conntrack_standalone_init+0x0/0xf returned 0 after 816 usecs
[    5.402874] calling  ctnetlink_init+0x0/0x62 @ 1
[    5.402971] ctnetlink v0.93: registering with nfnetlink.
[    5.403091] initcall ctnetlink_init+0x0/0x62 returned 0 after 115 usecs
[    5.403194] calling  nf_conntrack_ftp_init+0x0/0x189 @ 1
[    5.403300] initcall nf_conntrack_ftp_init+0x0/0x189 returned 0 after 3 usecs
[    5.403412] calling  nf_conntrack_irc_init+0x0/0x17e @ 1
[    5.403517] initcall nf_conntrack_irc_init+0x0/0x17e returned 0 after 2 usecs
[    5.403619] calling  nf_conntrack_sip_init+0x0/0x159 @ 1
[    5.403721] initcall nf_conntrack_sip_init+0x0/0x159 returned 0 after 1 usecs
[    5.403823] calling  xt_init+0x0/0xda @ 1
[    5.403922] initcall xt_init+0x0/0xda returned 0 after 1 usecs
[    5.404029] calling  tcpudp_mt_init+0x0/0x14 @ 1
[    5.404130] initcall tcpudp_mt_init+0x0/0x14 returned 0 after 2 usecs
[    5.404231] calling  connsecmark_tg_init+0x0/0xf @ 1
[    5.404345] initcall connsecmark_tg_init+0x0/0xf returned 0 after 10 usecs
[    5.404447] calling  mark_tg_init+0x0/0x14 @ 1
[    5.404547] initcall mark_tg_init+0x0/0x14 returned 0 after 1 usecs
[    5.404648] calling  nflog_tg_init+0x0/0xf @ 1
[    5.404747] initcall nflog_tg_init+0x0/0xf returned 0 after 1 usecs
[    5.404848] calling  secmark_tg_init+0x0/0xf @ 1
[    5.404948] initcall secmark_tg_init+0x0/0xf returned 0 after 1 usecs
[    5.405057] calling  tcpmss_tg_init+0x0/0x14 @ 1
[    5.405156] initcall tcpmss_tg_init+0x0/0x14 returned 0 after 1 usecs
[    5.405259] calling  conntrack_mt_init+0x0/0x14 @ 1
[    5.405374] initcall conntrack_mt_init+0x0/0x14 returned 0 after 1 usecs
[    5.405475] calling  mark_mt_init+0x0/0x14 @ 1
[    5.405757] initcall mark_mt_init+0x0/0x14 returned 0 after 172 usecs
[    5.405851] calling  policy_mt_init+0x0/0x14 @ 1
[    5.405952] initcall policy_mt_init+0x0/0x14 returned 0 after 1 usecs
[    5.406838] calling  state_mt_init+0x0/0x14 @ 1
[    5.406946] initcall state_mt_init+0x0/0x14 returned 0 after 1 usecs
[    5.407052] calling  sysctl_ipv4_init+0x0/0x3f @ 1
[    5.407600] initcall sysctl_ipv4_init+0x0/0x3f returned 0 after 438 usecs
[    5.407694] calling  init_syncookies+0x0/0x16 @ 1
[    5.407844] initcall init_syncookies+0x0/0x16 returned 0 after 48 usecs
[    5.407938] calling  tunnel4_init+0x0/0x5a @ 1
[    5.408045] initcall tunnel4_init+0x0/0x5a returned 0 after 1 usecs
[    5.408147] calling  ipv4_netfilter_init+0x0/0xf @ 1
[    5.408248] initcall ipv4_netfilter_init+0x0/0xf returned 0 after 1 usecs
[    5.408352] calling  nf_conntrack_l3proto_ipv4_init+0x0/0x11d @ 1
[    5.409022] initcall nf_conntrack_l3proto_ipv4_init+0x0/0x11d returned 0 after 535 usecs
[    5.409154] calling  nf_nat_init+0x0/0xea @ 1
[    5.409290] initcall nf_nat_init+0x0/0xea returned 0 after 36 usecs
[    5.409383] calling  nf_defrag_init+0x0/0x14 @ 1
[    5.409483] initcall nf_defrag_init+0x0/0x14 returned 0 after 1 usecs
[    5.409584] calling  nf_nat_ftp_init+0x0/0x1e @ 1
[    5.409684] initcall nf_nat_ftp_init+0x0/0x1e returned 0 after 1 usecs
[    5.409784] calling  nf_nat_irc_init+0x0/0x1e @ 1
[    5.409884] initcall nf_nat_irc_init+0x0/0x1e returned 0 after 1 usecs
[    5.409983] calling  nf_nat_sip_init+0x0/0x91 @ 1
[    5.410091] initcall nf_nat_sip_init+0x0/0x91 returned 0 after 1 usecs
[    5.410191] calling  ip_tables_init+0x0/0x92 @ 1
[    5.410298] ip_tables: (C) 2000-2006 Netfilter Core Team
[    5.410407] initcall ip_tables_init+0x0/0x92 returned 0 after 112 usecs
[    5.410507] calling  iptable_filter_init+0x0/0x5d @ 1
[    5.410615] initcall iptable_filter_init+0x0/0x5d returned 0 after 8 usecs
[    5.410716] calling  iptable_mangle_init+0x0/0x38 @ 1
[    5.410822] initcall iptable_mangle_init+0x0/0x38 returned 0 after 5 usecs
[    5.410924] calling  nf_nat_standalone_init+0x0/0x73 @ 1
[    5.411036] initcall nf_nat_standalone_init+0x0/0x73 returned 0 after 5 usecs
[    5.411139] calling  log_tg_init+0x0/0x24 @ 1
[    5.411239] initcall log_tg_init+0x0/0x24 returned 0 after 1 usecs
[    5.411342] calling  masquerade_tg_init+0x0/0x2d @ 1
[    5.411693] initcall masquerade_tg_init+0x0/0x2d returned 0 after 225 usecs
[    5.411788] calling  reject_tg_init+0x0/0xf @ 1
[    5.411888] initcall reject_tg_init+0x0/0xf returned 0 after 1 usecs
[    5.411989] calling  ulog_tg_init+0x0/0xbe @ 1
[    5.412099] initcall ulog_tg_init+0x0/0xbe returned 0 after 4 usecs
[    5.412199] calling  cubictcp_register+0x0/0x93 @ 1
[    5.412301] TCP cubic registered
[    5.412410] initcall cubictcp_register+0x0/0x93 returned 0 after 105 usecs
[    5.412512] calling  xfrm_user_init+0x0/0x40 @ 1
[    5.412608] Initializing XFRM netlink socket
[    5.412709] initcall xfrm_user_init+0x0/0x40 returned 0 after 97 usecs
[    5.412810] calling  inet6_init+0x0/0x277 @ 1
[    5.413051] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 001803 POWER sig=j CSC CONNECT
[    5.413184] hub 1-0:1.0: port 8: status 0501 change 0001
[    5.413671] NET: Registered protocol family 10
[    5.415678] initcall inet6_init+0x0/0x277 returned 0 after 2703 usecs
[    5.415774] calling  ah6_init+0x0/0x5a @ 1
[    5.415875] initcall ah6_init+0x0/0x5a returned 0 after 1 usecs
[    5.415974] calling  esp6_init+0x0/0x5a @ 1
[    5.416081] initcall esp6_init+0x0/0x5a returned 0 after 1 usecs
[    5.416181] calling  xfrm6_transport_init+0x0/0x14 @ 1
[    5.416285] initcall xfrm6_transport_init+0x0/0x14 returned 0 after 1 usecs
[    5.416396] calling  xfrm6_mode_tunnel_init+0x0/0x14 @ 1
[    5.416497] initcall xfrm6_mode_tunnel_init+0x0/0x14 returned 0 after 1 usecs
[    5.416598] calling  xfrm6_beet_init+0x0/0x14 @ 1
[    5.416698] initcall xfrm6_beet_init+0x0/0x14 returned 0 after 1 usecs
[    5.416799] calling  ip6_tables_init+0x0/0x92 @ 1
[    5.416904] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    5.417011] initcall ip6_tables_init+0x0/0x92 returned 0 after 110 usecs
[    5.417113] calling  ip6table_filter_init+0x0/0x5d @ 1
[    5.417459] initcall ip6table_filter_init+0x0/0x5d returned 0 after 233 usecs
[    5.417560] calling  ip6table_mangle_init+0x0/0x38 @ 1
[    5.417668] initcall ip6table_mangle_init+0x0/0x38 returned 0 after 6 usecs
[    5.417769] calling  nf_conntrack_l3proto_ipv6_init+0x0/0xef @ 1
[    5.417937] initcall nf_conntrack_l3proto_ipv6_init+0x0/0xef returned 0 after 64 usecs
[    5.418102] calling  ipv6header_mt6_init+0x0/0xf @ 1
[    5.418205] initcall ipv6header_mt6_init+0x0/0xf returned 0 after 1 usecs
[    5.418309] calling  log_tg6_init+0x0/0x24 @ 1
[    5.418419] initcall log_tg6_init+0x0/0x24 returned 0 after 1 usecs
[    5.418520] calling  reject_tg6_init+0x0/0xf @ 1
[    5.418619] initcall reject_tg6_init+0x0/0xf returned 0 after 1 usecs
[    5.418719] calling  sit_init+0x0/0x5f @ 1
[    5.418815] IPv6 over IPv4 tunneling driver
[    5.419018] hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    5.419887] initcall sit_init+0x0/0x5f returned 0 after 1044 usecs
[    5.419980] calling  packet_init+0x0/0x39 @ 1
[    5.420086] NET: Registered protocol family 17
[    5.420426] initcall packet_init+0x0/0x39 returned 0 after 329 usecs
[    5.420528] calling  init_sunrpc+0x0/0x53 @ 1
[    5.420932] RPC: Registered udp transport module.
[    5.421031] RPC: Registered tcp transport module.
[    5.421131] initcall init_sunrpc+0x0/0x53 returned 0 after 492 usecs
[    5.421232] calling  init_rpcsec_gss+0x0/0x3f @ 1
[    5.421344] initcall init_rpcsec_gss+0x0/0x3f returned 0 after 8 usecs
[    5.421453] calling  init_kerberos_module+0x0/0x26 @ 1
[    5.421556] initcall init_kerberos_module+0x0/0x26 returned 0 after 4 usecs
[    5.421661] calling  severities_debugfs_init+0x0/0x4e @ 1
[    5.421770] initcall severities_debugfs_init+0x0/0x4e returned 0 after 9 usecs
[    5.421910] calling  acpi_cpufreq_init+0x0/0xbf @ 1
[    5.422347] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    5.426065] initcall acpi_cpufreq_init+0x0/0xbf returned 0 after 3951 usecs
[    5.426162] calling  hpet_insert_resource+0x0/0x1e @ 1
[    5.426271] initcall hpet_insert_resource+0x0/0x1e returned 0 after 4 usecs
[    5.426381] calling  update_mp_table+0x0/0x3ad @ 1
[    5.426482] initcall update_mp_table+0x0/0x3ad returned 0 after 1 usecs
[    5.426590] calling  lapic_insert_resource+0x0/0x33 @ 1
[    5.426691] initcall lapic_insert_resource+0x0/0x33 returned 0 after 1 usecs
[    5.426793] calling  print_ipi_mode+0x0/0x26 @ 1
[    5.426890] Using IPI No-Shortcut mode
[    5.426986] initcall print_ipi_mode+0x0/0x26 returned 0 after 92 usecs
[    5.427096] calling  init_lapic_nmi_sysfs+0x0/0x33 @ 1
[    5.427196] initcall init_lapic_nmi_sysfs+0x0/0x33 returned 0 after 1 usecs
[    5.427301] calling  io_apic_bug_finalize+0x0/0x1c @ 1
[    5.427415] initcall io_apic_bug_finalize+0x0/0x1c returned 0 after 2 usecs
[    5.427517] calling  check_early_ioremap_leak+0x0/0x5e @ 1
[    5.427619] initcall check_early_ioremap_leak+0x0/0x5e returned 0 after 1 usecs
[    5.427758] calling  pat_memtype_list_init+0x0/0x23 @ 1
[    5.428110] hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    5.428218] initcall pat_memtype_list_init+0x0/0x23 returned 0 after 351 usecs
[    5.428361] calling  init_oops_id+0x0/0x3a @ 1
[    5.428473] initcall init_oops_id+0x0/0x3a returned 0 after 1 usecs
[    5.428574] calling  disable_boot_consoles+0x0/0x3a @ 1
[    5.428675] initcall disable_boot_consoles+0x0/0x3a returned 0 after 1 usecs
[    5.428777] calling  pm_qos_power_init+0x0/0x54 @ 1
[    5.429120] initcall pm_qos_power_init+0x0/0x54 returned 0 after 237 usecs
[    5.429216] calling  software_resume+0x0/0x19d @ 1
[    5.429319] PM: Resume from disk failed.
[    5.429429] initcall software_resume+0x0/0x19d returned -2 after 105 usecs
[    5.429531] initcall software_resume+0x0/0x19d returned with error code -2 
[    5.429635] calling  debugfs_kprobe_init+0x0/0x78 @ 1
[    5.429742] initcall debugfs_kprobe_init+0x0/0x78 returned 0 after 7 usecs
[    5.429844] calling  taskstats_init+0x0/0x7d @ 1
[    5.429945] registered taskstats version 1
[    5.430051] initcall taskstats_init+0x0/0x7d returned 0 after 107 usecs
[    5.430153] calling  clear_boot_tracer+0x0/0x27 @ 1
[    5.430253] initcall clear_boot_tracer+0x0/0x27 returned 0 after 1 usecs
[    5.430358] calling  max_swapfiles_check+0x0/0x7 @ 1
[    5.430470] initcall max_swapfiles_check+0x0/0x7 returned 0 after 1 usecs
[    5.430571] calling  random32_reseed+0x0/0x7e @ 1
[    5.430684] initcall random32_reseed+0x0/0x7e returned 0 after 14 usecs
[    5.430786] calling  pci_resource_alignment_sysfs_init+0x0/0x14 @ 1
[    5.430892] initcall pci_resource_alignment_sysfs_init+0x0/0x14 returned 0 after 3 usecs
[    5.431048] calling  pci_sysfs_init+0x0/0x44 @ 1
[    5.431161] uhci_hcd 0000:00:1d.3: port 2 portsc 008a,00
[    5.431714] initcall pci_sysfs_init+0x0/0x44 returned 0 after 554 usecs
[    5.431811] calling  seqgen_init+0x0/0xe @ 1
[    5.431927] initcall seqgen_init+0x0/0xe returned 0 after 16 usecs
[    5.432038] calling  late_resume_init+0x0/0xc2 @ 1
[    5.432136]   Magic number: 5:366:74
[    5.432316] initcall late_resume_init+0x0/0xc2 returned 0 after 174 usecs
[    5.432410] calling  scsi_complete_async_scans+0x0/0xf4 @ 1
[    5.432511] initcall scsi_complete_async_scans+0x0/0xf4 returned 0 after 1 usecs
[    5.432649] calling  memmap_init+0x0/0x8a @ 1
[    5.432807] initcall memmap_init+0x0/0x8a returned 0 after 59 usecs
[    5.432901] calling  pci_mmcfg_late_insert_resources+0x0/0x12e @ 1
[    5.433013] initcall pci_mmcfg_late_insert_resources+0x0/0x12e returned 0 after 10 usecs
[    5.433153] calling  tcp_congestion_default+0x0/0xf @ 1
[    5.433257] initcall tcp_congestion_default+0x0/0xf returned 0 after 1 usecs
[    5.433372] calling  ip_auto_config+0x0/0xd22 @ 1
[    5.433475] initcall ip_auto_config+0x0/0xd22 returned 0 after 4 usecs
[    5.433576] calling  initialize_hashrnd+0x0/0x16 @ 1
[    5.433680] initcall initialize_hashrnd+0x0/0x16 returned 0 after 4 usecs
[    5.512059] hub 1-0:1.0: state 7 ports 8 chg 0100 evt 0000
[    5.512156] hub 1-0:1.0: port 8, status 0501, change 0000, 480 Mb/s
[    5.563254] ehci_hcd 0000:00:1d.7: port 8 full speed --> companion
[    5.563350] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003801 POWER OWNER sig=j CONNECT
[    5.563490] hub 1-0:1.0: port 8 not reset yet, waiting 50ms
[    5.614058] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003002 POWER OWNER sig=se0 CSC
[    5.614211] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    5.614311] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100
[    5.704097] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
[    5.704195] uhci_hcd 0000:00:1d.3: port 2 portsc 0093,00
[    5.704315] hub 5-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
[    5.808059] hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
[    5.910056] usb 5-2: new full speed USB device using uhci_hcd and address 2
[    6.000070] Clocksource tsc unstable (delta = -270104002 ns)
[    6.011844] Synaptics Touchpad, model: 1, fw: 6.2, id: 0x81a0b1, caps: 0xa04793/0x300000
[    6.011976] serio: Synaptics pass-through port at isa0060/serio1/input0
[    6.030026] usb 5-2: ep0 maxpacket = 8
[    6.053781] usb 5-2: default language 0x0409
[    6.054626] input: SynPS/2 Synaptics TouchPad as /class/input/input6
[    6.058807] async_waiting @ 1
[    6.058903] async_continuing @ 1 after 1 usec
[    6.059373] md: Waiting for all devices to be available before autodetect
[    6.059470] md: If you don't use raid, use raid=noautodetect
[    6.072781] usb 5-2: udev 2, busnum 5, minor = 513
[    6.072872] usb 5-2: New USB device found, idVendor=0483, idProduct=2016
[    6.072973] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    6.073094] usb 5-2: Product: Biometric Coprocessor
[    6.073190] usb 5-2: Manufacturer: STMicroelectronics
[    6.073349] usb 5-2: uevent
[    6.073630] usb 5-2: usb_probe_device
[    6.073719] usb 5-2: configuration #1 chosen from 1 choice
[    6.075783] usb 5-2: adding 5-2:1.0 (config #1, interface 0)
[    6.075892] usb 5-2:1.0: uevent
[    6.076112] drivers/usb/core/inode.c: creating file '002'
[    6.076222] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
[    6.454033] usb usb2: suspend_rh (auto-stop)
[    6.454146] usb usb3: suspend_rh (auto-stop)
[    6.454261] usb usb4: suspend_rh (auto-stop)
[    7.704063] hub 2-0:1.0: hub_suspend
[    7.704155] usb usb2: bus auto-suspend
[    7.704249] usb usb2: suspend_rh
[    7.704367] hub 3-0:1.0: hub_suspend
[    7.704456] usb usb3: bus auto-suspend
[    7.704551] usb usb3: suspend_rh
[    7.704660] hub 4-0:1.0: hub_suspend
[    7.704748] usb usb4: bus auto-suspend
[    7.704843] usb usb4: suspend_rh
[    7.704952] hub 1-0:1.0: hub_suspend
[    7.705050] usb usb1: bus auto-suspend
[    7.705154] ehci_hcd 0000:00:1d.7: suspend root hub
[   11.497204] IBM TrackPoint firmware: 0x0e, buttons: 3/3
[   11.725545] input: TPPS/2 IBM TrackPoint as /class/input/input7
[   11.807485] async_waiting @ 1
[   11.807575] async_continuing @ 1 after 1 usec
[   11.807943] md: Autodetecting RAID arrays.
[   11.808049] md: Scanned 0 and added 0 devices.
[   11.808146] md: autorun ...
[   11.808240] md: ... autorun DONE.
[   12.181957] kjournald starting.  Commit interval 5 seconds
[   12.181982] EXT3-fs: mounted filesystem with writeback data mode.
[   12.181993] VFS: Mounted root (ext3 filesystem) readonly on device 8:1.
[   12.182046] async_waiting @ 1
[   12.182050] async_continuing @ 1 after 1 usec
[   12.182062] Freeing unused kernel memory: 376k freed
[   12.182560] Write protecting the kernel text: 4500k
[   12.182721] Write protecting the kernel read-only data: 2196k
[   13.464436] sh used greatest stack depth: 6284 bytes left
[   14.209169] mount used greatest stack depth: 6256 bytes left
[   15.252079] awk used greatest stack depth: 5956 bytes left
[   16.155028] eth0: no IPv6 routers present
[   16.398723] readahead[895]: segfault at 0 ip 00c693b3 sp bfdbd30c error 4 in libc-2.9.so[bf2000+16e000]
[   16.929854] usb usb2: uevent
[   16.929976] usb 2-0:1.0: uevent
[   16.930154] usb usb3: uevent
[   16.930269] usb 3-0:1.0: uevent
[   16.930424] usb usb4: uevent
[   16.930547] usb 4-0:1.0: uevent
[   16.930696] usb usb5: uevent
[   16.930809] usb 5-0:1.0: uevent
[   16.930935] usb 5-2: uevent
[   16.931069] usb 5-2:1.0: uevent
[   16.931226] usb usb1: uevent
[   16.931350] usb 1-0:1.0: uevent
[   25.714165] EXT3 FS on sda1, internal journal
[   27.705850] Adding 4096564k swap on /dev/sda2.  Priority:-1 extents:1 across:4096564k 
[   29.035661] ip used greatest stack depth: 5752 bytes left
[   45.490796] CPUFREQ: ondemand sampling_rate_max sysfs file is deprecated - used by: cat
[  102.555904] ssh used greatest stack depth: 5312 bytes left

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 67163 bytes --]

# head: baace7ea
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc5
# Sun Aug  9 12:56:59 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 is not set
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
# CONFIG_BROKEN_BOOT_ALLOWED4 is not set
# CONFIG_BROKEN_BOOT_EUROPE is not set
# CONFIG_BROKEN_BOOT_TITAN is not set
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=y
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 is not set
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
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 is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_PREEMPT_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=18
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_GROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_RT_GROUP_SCHED is not set
# 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=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_CPUACCT=y
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=y
CONFIG_NET_NS=y
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 is not set
CONFIG_UID16=y
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=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
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 is not set
# 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 is not set
CONFIG_HAVE_OPROFILE=y
CONFIG_KPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_KRETPROBES=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 is not set
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_BLK_DEV_INTEGRITY is not set

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"
CONFIG_FREEZER=y

#
# 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 is not set
CONFIG_SPARSE_IRQ=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 is not set
# CONFIG_X86_32_NON_STANDARD is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_PARAVIRT_GUEST 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=y
# 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_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=4
CONFIG_X86_DEBUGCTLMSR=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=y
CONFIG_CPU_SUP_UMC_32=y
# CONFIG_X86_DS is not set
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
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 is not set
CONFIG_X86_THERMAL_VECTOR=y
CONFIG_VM86=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
CONFIG_X86_REBOOTFIXUPS=y
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
CONFIG_MICROCODE_AMD=y
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
# CONFIG_X86_CPU_DEBUG is not set
# CONFIG_UP_WANTED_1 is not set
CONFIG_SMP=y
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G 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_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_HIGHPTE=y
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y
CONFIG_X86_RESERVE_LOW_64K=y
# CONFIG_MATH_EMULATION is not set
CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set
CONFIG_X86_PAT=y
CONFIG_EFI=y
CONFIG_SECCOMP=y
# CONFIG_CC_STACKPROTECTOR is not set
# 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=y
# CONFIG_KEXEC_JUMP is not set
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_X86_NEED_RELOCS=y
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_HOTPLUG_CPU=y
# CONFIG_COMPAT_VDSO is not set
# CONFIG_CMDLINE_BOOL is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y

#
# Power management and ACPI options
#
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_VERBOSE is not set
CONFIG_CAN_PM_TRACE=y
CONFIG_PM_TRACE=y
CONFIG_PM_TRACE_RTC=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_SLEEP=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
CONFIG_HIBERNATION_NVS=y
CONFIG_HIBERNATION=y
CONFIG_PM_STD_PARTITION=""
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_PROCFS=y
CONFIG_ACPI_PROCFS_POWER=y
CONFIG_ACPI_SYSFS_POWER=y
CONFIG_ACPI_PROC_EVENT=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_THERMAL=y
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_X86_PM_TIMER=y
CONFIG_ACPI_CONTAINER=y
# CONFIG_ACPI_SBS is not set
# CONFIG_APM is not set

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_DEBUG=y
# CONFIG_CPU_FREQ_STAT is not set
# 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 is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set

#
# CPUFreq processor drivers
#
CONFIG_X86_ACPI_CPUFREQ=y
# CONFIG_X86_POWERNOW_K6 is not set
# CONFIG_X86_POWERNOW_K7 is not set
# CONFIG_X86_POWERNOW_K8 is not set
# CONFIG_X86_GX_SUSPMOD is not set
# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
# CONFIG_X86_SPEEDSTEP_ICH is not set
# CONFIG_X86_SPEEDSTEP_SMI is not set
# CONFIG_X86_P4_CLOCKMOD is not set
# CONFIG_X86_CPUFREQ_NFORCE2 is not set
# CONFIG_X86_LONGRUN is not set
# CONFIG_X86_LONGHAUL is not set
# CONFIG_X86_E_POWERSAVER 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

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GOMMCONFIG is not set
# CONFIG_PCI_GODIRECT is not set
# CONFIG_PCI_GOOLPC is not set
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_DOMAINS=y
# CONFIG_DMAR is not set
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 is not set
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
# CONFIG_PCI_LEGACY is not set
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_STUB is not set
CONFIG_HT_IRQ=y
# CONFIG_PCI_IOV is not set
CONFIG_ISA_DMA_API=y
# CONFIG_ISA is not set
# CONFIG_MCA is not set
# CONFIG_SCx200 is not set
# CONFIG_OLPC is not set
CONFIG_K8_NB=y
CONFIG_PCCARD=y
# CONFIG_PCMCIA_DEBUG is not set
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_PCMCIA_IOCTL=y
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
# CONFIG_PD6729 is not set
# CONFIG_I82092 is not set
CONFIG_PCCARD_NONSTATIC=y
CONFIG_HOTPLUG_PCI=y
# CONFIG_HOTPLUG_PCI_FAKE is not set
# CONFIG_HOTPLUG_PCI_COMPAQ is not set
# CONFIG_HOTPLUG_PCI_IBM is not set
# CONFIG_HOTPLUG_PCI_ACPI is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_HAVE_AOUT=y
# CONFIG_BINFMT_AOUT is not set
CONFIG_BINFMT_MISC=y
CONFIG_HAVE_ATOMIC_IOMAP=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 is not set
# CONFIG_XFRM_MIGRATE is not set
# CONFIG_XFRM_STATISTICS is not set
# CONFIG_NET_KEY is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
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=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
# CONFIG_ARPD is not set
CONFIG_SYN_COOKIES=y
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
CONFIG_INET_TUNNEL=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
CONFIG_INET_LRO=y
# CONFIG_INET_DIAG is not set
CONFIG_TCP_CONG_ADVANCED=y
# CONFIG_TCP_CONG_BIC is not set
CONFIG_TCP_CONG_CUBIC=y
# CONFIG_TCP_CONG_WESTWOOD is not set
# CONFIG_TCP_CONG_HTCP is not set
# CONFIG_TCP_CONG_HSTCP is not set
# CONFIG_TCP_CONG_HYBLA is not set
# CONFIG_TCP_CONG_VEGAS is not set
# CONFIG_TCP_CONG_SCALABLE is not set
# CONFIG_TCP_CONG_LP is not set
# CONFIG_TCP_CONG_VENO is not set
# CONFIG_TCP_CONG_YEAH is not set
# CONFIG_TCP_CONG_ILLINOIS is not set
# CONFIG_DEFAULT_BIC is not set
CONFIG_DEFAULT_CUBIC=y
# CONFIG_DEFAULT_HTCP is not set
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_RENO is not set
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 is not set
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
# CONFIG_INET6_IPCOMP is not set
# CONFIG_IPV6_MIP6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
CONFIG_INET6_XFRM_MODE_TRANSPORT=y
CONFIG_INET6_XFRM_MODE_TUNNEL=y
CONFIG_INET6_XFRM_MODE_BEET=y
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_IPV6_SIT=y
CONFIG_IPV6_NDISC_NODETYPE=y
# CONFIG_IPV6_TUNNEL is not set
# CONFIG_IPV6_MULTIPLE_TABLES is not set
# CONFIG_IPV6_MROUTE is not set
CONFIG_NETLABEL=y
CONFIG_NETWORK_SECMARK=y
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
# CONFIG_NETFILTER_ADVANCED is not set

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
# CONFIG_IP_VS is not set

#
# 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=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
CONFIG_IP_NF_TARGET_ULOG=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_NF_NAT_FTP=y
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=y
CONFIG_IP_NF_MANGLE=y

#
# IPv6: Netfilter Configuration
#
CONFIG_NF_CONNTRACK_IPV6=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_MATCH_IPV6HEADER=y
CONFIG_IP6_NF_TARGET_LOG=y
CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_MANGLE=y
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
CONFIG_LLC=y
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_PHONET is not set
# CONFIG_IEEE802154 is not set
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
# CONFIG_NET_SCH_CBQ is not set
# CONFIG_NET_SCH_HTB is not set
# CONFIG_NET_SCH_HFSC is not set
# CONFIG_NET_SCH_PRIO is not set
# CONFIG_NET_SCH_MULTIQ is not set
# CONFIG_NET_SCH_RED is not set
# CONFIG_NET_SCH_SFQ is not set
# CONFIG_NET_SCH_TEQL is not set
# CONFIG_NET_SCH_TBF is not set
# CONFIG_NET_SCH_GRED is not set
# CONFIG_NET_SCH_DSMARK is not set
# CONFIG_NET_SCH_NETEM is not set
# CONFIG_NET_SCH_DRR is not set
# CONFIG_NET_SCH_INGRESS is not set

#
# Classification
#
CONFIG_NET_CLS=y
# CONFIG_NET_CLS_BASIC is not set
# CONFIG_NET_CLS_TCINDEX is not set
# CONFIG_NET_CLS_ROUTE4 is not set
# CONFIG_NET_CLS_FW is not set
# CONFIG_NET_CLS_U32 is not set
# CONFIG_NET_CLS_RSVP is not set
# CONFIG_NET_CLS_RSVP6 is not set
# CONFIG_NET_CLS_FLOW is not set
# CONFIG_NET_CLS_CGROUP is not set
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
# CONFIG_NET_EMATCH_CMP is not set
# CONFIG_NET_EMATCH_NBYTE is not set
# CONFIG_NET_EMATCH_U32 is not set
# CONFIG_NET_EMATCH_META is not set
# CONFIG_NET_EMATCH_TEXT is not set
CONFIG_NET_CLS_ACT=y
# CONFIG_NET_ACT_POLICE is not set
# CONFIG_NET_ACT_GACT is not set
# CONFIG_NET_ACT_MIRRED is not set
# CONFIG_NET_ACT_IPT is not set
# CONFIG_NET_ACT_NAT is not set
# CONFIG_NET_ACT_PEDIT is not set
# CONFIG_NET_ACT_SIMP is not set
# CONFIG_NET_ACT_SKBEDIT is not set
CONFIG_NET_SCH_FIFO=y
# CONFIG_DCB is not set

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_NET_TCPPROBE is not set
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
# CONFIG_AX25 is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
# CONFIG_CFG80211_REG_DEBUG is not set
# CONFIG_CFG80211_DEBUGFS is not set
CONFIG_WIRELESS_OLD_REGULATORY=y
CONFIG_WIRELESS_EXT=y
CONFIG_WIRELESS_EXT_SYSFS=y
# CONFIG_LIB80211 is not set
CONFIG_MAC80211=y
CONFIG_MAC80211_DEFAULT_PS=y
CONFIG_MAC80211_DEFAULT_PS_VALUE=1

#
# Rate control algorithm selection
#
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 is not set
# CONFIG_WIMAX is not set
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 is not set
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_FD is not set
CONFIG_BLK_CPQ_DA=y
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
# 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 is not set
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=16384
# CONFIG_BLK_DEV_XIP is not set
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_BLK_DEV_HD is not set
CONFIG_MISC_DEVICES=y
# CONFIG_IBM_ASM is not set
# CONFIG_PHANTOM is not set
# CONFIG_SGI_IOC4 is not set
# CONFIG_TIFM_CORE is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_HP_ILO is not set
# CONFIG_ISL29003 is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
# CONFIG_EEPROM_93CX6 is not set
# CONFIG_CB710_CORE is not set
CONFIG_HAVE_IDE=y

#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
# CONFIG_SCSI_TGT is not set
# CONFIG_SCSI_NETLINK is not set
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
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 is not set
CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_LOGGING is not set
# CONFIG_SCSI_SCAN_ASYNC is not set
CONFIG_SCSI_WAIT_SCAN=m

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_ATTRS is not set
# CONFIG_SCSI_SAS_LIBSAS is not set
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_SCSI_AIC7XXX=y
# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
# CONFIG_SCSI_DH is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_ACPI=y
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 is not set
CONFIG_SATA_NV=y
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SX4 is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_ULI is not set
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set
# CONFIG_SATA_INIC162X is not set
# CONFIG_PATA_ACPI is not set
# CONFIG_PATA_ALI is not set
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_CMD64X is not set
# CONFIG_PATA_CS5520 is not set
# CONFIG_PATA_CS5530 is not set
# CONFIG_PATA_CS5535 is not set
# CONFIG_PATA_CS5536 is not set
# CONFIG_PATA_CYPRESS is not set
# CONFIG_PATA_EFAR is not set
CONFIG_ATA_GENERIC=y
# CONFIG_PATA_HPT366 is not set
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT821X is not set
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_MARVELL is not set
CONFIG_PATA_MPIIX=y
CONFIG_PATA_OLDPIIX=y
# CONFIG_PATA_NETCELL is not set
# CONFIG_PATA_NINJA32 is not set
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_NS87415 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PCMCIA is not set
# CONFIG_PATA_PDC_OLD is not set
# CONFIG_PATA_RADISYS is not set
# CONFIG_PATA_RZ1000 is not set
# CONFIG_PATA_SC1200 is not set
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set
CONFIG_PATA_SCH=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
# CONFIG_MD_RAID1 is not set
# CONFIG_MD_RAID10 is not set
# CONFIG_MD_RAID456 is not set
# CONFIG_MD_MULTIPATH is not set
# CONFIG_MD_FAULTY is not set
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
# CONFIG_DM_CRYPT is not set
# CONFIG_DM_SNAPSHOT is not set
CONFIG_DM_MIRROR=y
# CONFIG_DM_LOG_USERSPACE is not set
CONFIG_DM_ZERO=y
# CONFIG_DM_MULTIPATH is not set
# CONFIG_DM_DELAY is not set
# CONFIG_DM_UEVENT 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 is not set
# CONFIG_IEEE1394 is not set
# CONFIG_I2O is not set
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
# CONFIG_IFB is not set
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
# CONFIG_NET_SB1000 is not set
# 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 is not set
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
# CONFIG_FIXED_PHY is not set
# CONFIG_MDIO_BITBANG is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set
CONFIG_NET_VENDOR_3COM=y
CONFIG_VORTEX=y
# CONFIG_TYPHOON is not set
# CONFIG_ETHOC is not set
# CONFIG_DNET is not set
CONFIG_NET_TULIP=y
# CONFIG_DE2104X is not set
# CONFIG_TULIP is not set
# CONFIG_DE4X5 is not set
# CONFIG_WINBOND_840 is not set
# CONFIG_DM9102 is not set
# CONFIG_ULI526X is not set
# CONFIG_PCMCIA_XIRCOM is not set
# CONFIG_HP100 is not set
# 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 is not set
# CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_B44 is not set
CONFIG_FORCEDETH=y
# CONFIG_FORCEDETH_NAPI is not set
CONFIG_E100=y
# CONFIG_FEALNX is not set
# CONFIG_NATSEMI is not set
CONFIG_NE2K_PCI=y
# CONFIG_8139CP is not set
CONFIG_8139TOO=y
# CONFIG_8139TOO_PIO is not set
# CONFIG_8139TOO_TUNE_TWISTER is not set
# CONFIG_8139TOO_8129 is not set
# CONFIG_8139_OLD_RX_RESET is not set
# CONFIG_R6040 is not set
# CONFIG_SIS900 is not set
# CONFIG_EPIC100 is not set
# CONFIG_SMSC9420 is not set
# CONFIG_SUNDANCE is not set
# CONFIG_TLAN is not set
# CONFIG_KS8842 is not set
# CONFIG_VIA_RHINE is not set
# CONFIG_SC92031 is not set
# CONFIG_ATL2 is not set
CONFIG_NETDEV_1000=y
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
CONFIG_E1000=y
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
# CONFIG_IGB is not set
# CONFIG_IGBVF is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
CONFIG_R8169=y
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
CONFIG_SKY2=y
# CONFIG_SKY2_DEBUG is not set
# CONFIG_VIA_VELOCITY is not set
CONFIG_TIGON3=y
CONFIG_BNX2=y
# CONFIG_QLA3XXX is not set
# CONFIG_ATL1 is not set
# CONFIG_ATL1E is not set
# CONFIG_ATL1C is not set
# CONFIG_JME is not set
CONFIG_NETDEV_10000=y
# CONFIG_CHELSIO_T1 is not set
CONFIG_CHELSIO_T3_DEPENDS=y
# CONFIG_CHELSIO_T3 is not set
# CONFIG_ENIC is not set
# CONFIG_IXGBE is not set
# CONFIG_IXGB is not set
# CONFIG_S2IO is not set
# CONFIG_MYRI10GE is not set
# CONFIG_NIU is not set
# CONFIG_MLX4_EN is not set
# CONFIG_MLX4_CORE is not set
# CONFIG_TEHUTI is not set
# CONFIG_BNX2X is not set
# CONFIG_QLGE is not set
# CONFIG_SFC is not set
# CONFIG_BE2NET is not set
CONFIG_TR=y
# CONFIG_IBMOL is not set
# CONFIG_IBMLS is not set
# CONFIG_3C359 is not set
# CONFIG_TMS380TR is not set

#
# Wireless LAN
#
# CONFIG_WLAN_PRE80211 is not set
CONFIG_WLAN_80211=y
# CONFIG_PCMCIA_RAYCS is not set
# CONFIG_LIBERTAS is not set
# CONFIG_LIBERTAS_THINFIRM is not set
# CONFIG_AIRO is not set
# CONFIG_ATMEL is not set
# CONFIG_AT76C50X_USB is not set
# CONFIG_AIRO_CS is not set
# CONFIG_PCMCIA_WL3501 is not set
# CONFIG_PRISM54 is not set
# CONFIG_USB_ZD1201 is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
# CONFIG_RTL8180 is not set
# CONFIG_RTL8187 is not set
# CONFIG_ADM8211 is not set
# CONFIG_MAC80211_HWSIM is not set
# CONFIG_MWL8K is not set
# CONFIG_P54_COMMON is not set
CONFIG_ATH_COMMON=y
CONFIG_ATH5K=y
# CONFIG_ATH5K_DEBUG is not set
# CONFIG_ATH9K is not set
# CONFIG_AR9170_USB is not set
# CONFIG_IPW2100 is not set
# CONFIG_IPW2200 is not set
# CONFIG_IWLWIFI is not set
# CONFIG_HOSTAP is not set
# CONFIG_B43 is not set
# CONFIG_B43LEGACY is not set
# CONFIG_ZD1211RW is not set
# CONFIG_HERMES is not set

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_USBNET is not set
# CONFIG_USB_HSO is not set
CONFIG_NET_PCMCIA=y
# CONFIG_PCMCIA_3C589 is not set
# CONFIG_PCMCIA_3C574 is not set
# CONFIG_PCMCIA_FMVJ18X is not set
# CONFIG_PCMCIA_PCNET is not set
# CONFIG_PCMCIA_NMCLAN is not set
# CONFIG_PCMCIA_SMC91C92 is not set
# CONFIG_PCMCIA_XIRC2PS is not set
# CONFIG_PCMCIA_AXNET is not set
# CONFIG_PCMCIA_IBMTR is not set
# CONFIG_WAN is not set
CONFIG_FDDI=y
# CONFIG_DEFXX is not set
# CONFIG_SKFP is not set
# CONFIG_HIPPI is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NET_FC is not set
CONFIG_NETCONSOLE=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_NETPOLL=y
# CONFIG_NETPOLL_TRAP is not set
CONFIG_NET_POLL_CONTROLLER=y
# CONFIG_ISDN is not set
# 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 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 is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_LIFEBOOK=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
# CONFIG_MOUSE_PS2_ELANTECH is not set
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
# CONFIG_MOUSE_SERIAL is not set
# CONFIG_MOUSE_APPLETOUCH is not set
# CONFIG_MOUSE_BCM5974 is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
# CONFIG_JOYSTICK_A3D is not set
# CONFIG_JOYSTICK_ADI is not set
# CONFIG_JOYSTICK_COBRA is not set
# CONFIG_JOYSTICK_GF2K is not set
# CONFIG_JOYSTICK_GRIP is not set
# CONFIG_JOYSTICK_GRIP_MP is not set
# CONFIG_JOYSTICK_GUILLEMOT is not set
# CONFIG_JOYSTICK_INTERACT is not set
# CONFIG_JOYSTICK_SIDEWINDER is not set
# CONFIG_JOYSTICK_TMDC is not set
# CONFIG_JOYSTICK_IFORCE is not set
# CONFIG_JOYSTICK_WARRIOR is not set
# CONFIG_JOYSTICK_MAGELLAN is not set
# CONFIG_JOYSTICK_SPACEORB is not set
# CONFIG_JOYSTICK_SPACEBALL is not set
# CONFIG_JOYSTICK_STINGER is not set
# CONFIG_JOYSTICK_TWIDJOY is not set
# CONFIG_JOYSTICK_ZHENHUA is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
# CONFIG_JOYSTICK_XPAD is not set
CONFIG_INPUT_TABLET=y
# CONFIG_TABLET_USB_ACECAD is not set
# CONFIG_TABLET_USB_AIPTEK is not set
# CONFIG_TABLET_USB_GTCO is not set
# CONFIG_TABLET_USB_KBTAB is not set
# CONFIG_TABLET_USB_WACOM is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
# CONFIG_TOUCHSCREEN_EETI is not set
# 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 is not set
# CONFIG_TOUCHSCREEN_INEXIO is not set
# CONFIG_TOUCHSCREEN_MK712 is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
# 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 is not set
# CONFIG_INPUT_APANEL is not set
# CONFIG_INPUT_WISTRON_BTNS is not set
# CONFIG_INPUT_ATLAS_BTNS is not set
# CONFIG_INPUT_ATI_REMOTE is not set
# CONFIG_INPUT_ATI_REMOTE2 is not set
# CONFIG_INPUT_KEYSPAN_REMOTE is not set
# CONFIG_INPUT_POWERMATE is not set
# CONFIG_INPUT_YEALINK is not set
# CONFIG_INPUT_CM109 is not set
# CONFIG_INPUT_UINPUT is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_GAMEPORT 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=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_COMPUTONE is not set
# CONFIG_ROCKETPORT is not set
# CONFIG_CYCLADES is not set
# CONFIG_DIGIEPCA is not set
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
# CONFIG_ISI is not set
# CONFIG_SYNCLINK is not set
# CONFIG_SYNCLINKMP is not set
# CONFIG_SYNCLINK_GT is not set
# CONFIG_N_HDLC is not set
# CONFIG_RISCOM8 is not set
# CONFIG_SPECIALIX is not set
# CONFIG_SX is not set
# CONFIG_RIO is not set
# CONFIG_STALDRV is not set
# CONFIG_NOZOMI is not set

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_PNP=y
# CONFIG_SERIAL_8250_CS is not set
CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y

#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
# CONFIG_LEGACY_PTYS is not set
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_INTEL=y
CONFIG_HW_RANDOM_AMD=y
CONFIG_HW_RANDOM_GEODE=y
CONFIG_HW_RANDOM_VIA=y
CONFIG_NVRAM=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_SONYPI is not set

#
# PCMCIA character devices
#
# CONFIG_SYNCLINK_CS is not set
# CONFIG_CARDMAN_4000 is not set
# CONFIG_CARDMAN_4040 is not set
# CONFIG_IPWIRELESS is not set
# CONFIG_MWAVE is not set
# CONFIG_PC8736x_GPIO is not set
# CONFIG_NSC_GPIO is not set
# CONFIG_CS5535_GPIO is not set
# CONFIG_RAW_DRIVER is not set
CONFIG_HPET=y
# CONFIG_HPET_MMAP is not set
# CONFIG_HANGCHECK_TIMER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set
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

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
# CONFIG_I2C_ALI1563 is not set
# CONFIG_I2C_ALI15X3 is not set
# CONFIG_I2C_AMD756 is not set
# CONFIG_I2C_AMD8111 is not set
CONFIG_I2C_I801=y
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_PIIX4 is not set
# CONFIG_I2C_NFORCE2 is not set
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
# CONFIG_I2C_SIS96X is not set
# CONFIG_I2C_VIA is not set
# CONFIG_I2C_VIAPRO is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_SIMTEC is not set

#
# External I2C/SMBus adapter drivers
#
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_TINY_USB is not set

#
# Graphics adapter I2C/DDC channel drivers
#
# CONFIG_I2C_VOODOO3 is not set

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_STUB is not set
# CONFIG_SCx200_ACB is not set

#
# Miscellaneous I2C Chip support
#
# CONFIG_DS1682 is not set
# CONFIG_SENSORS_PCF8574 is not set
# CONFIG_PCF8575 is not set
# CONFIG_SENSORS_PCA9539 is not set
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# CONFIG_I2C_DEBUG_CHIP is not set
# 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 is not set
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
# CONFIG_PDA_POWER is not set
# CONFIG_BATTERY_DS2760 is not set
# CONFIG_BATTERY_DS2782 is not set
# CONFIG_BATTERY_BQ27x00 is not set
# CONFIG_BATTERY_MAX17040 is not set
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_SENSORS_ABITUGURU is not set
# CONFIG_SENSORS_ABITUGURU3 is not set
# CONFIG_SENSORS_AD7414 is not set
# CONFIG_SENSORS_AD7418 is not set
# CONFIG_SENSORS_ADM1021 is not set
# CONFIG_SENSORS_ADM1025 is not set
# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1029 is not set
# CONFIG_SENSORS_ADM1031 is not set
# CONFIG_SENSORS_ADM9240 is not set
# CONFIG_SENSORS_ADT7462 is not set
# CONFIG_SENSORS_ADT7470 is not set
# CONFIG_SENSORS_ADT7473 is not set
# CONFIG_SENSORS_ADT7475 is not set
# CONFIG_SENSORS_K8TEMP is not set
# CONFIG_SENSORS_ASB100 is not set
# CONFIG_SENSORS_ATK0110 is not set
# CONFIG_SENSORS_ATXP1 is not set
# CONFIG_SENSORS_DS1621 is not set
# CONFIG_SENSORS_I5K_AMB is not set
# CONFIG_SENSORS_F71805F is not set
# CONFIG_SENSORS_F71882FG is not set
# CONFIG_SENSORS_F75375S is not set
# CONFIG_SENSORS_FSCHER is not set
# CONFIG_SENSORS_FSCPOS is not set
# CONFIG_SENSORS_FSCHMD is not set
# CONFIG_SENSORS_G760A is not set
# CONFIG_SENSORS_GL518SM is not set
# CONFIG_SENSORS_GL520SM is not set
# CONFIG_SENSORS_CORETEMP is not set
# CONFIG_SENSORS_IT87 is not set
# CONFIG_SENSORS_LM63 is not set
# CONFIG_SENSORS_LM75 is not set
# CONFIG_SENSORS_LM77 is not set
# CONFIG_SENSORS_LM78 is not set
# CONFIG_SENSORS_LM80 is not set
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_LTC4215 is not set
# CONFIG_SENSORS_LTC4245 is not set
# CONFIG_SENSORS_LM95241 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47M192 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
# CONFIG_SENSORS_ADS7828 is not set
# CONFIG_SENSORS_THMC50 is not set
# CONFIG_SENSORS_TMP401 is not set
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
# CONFIG_SENSORS_W83781D is not set
# CONFIG_SENSORS_W83791D is not set
# CONFIG_SENSORS_W83792D is not set
# CONFIG_SENSORS_W83793 is not set
# CONFIG_SENSORS_W83L785TS is not set
# CONFIG_SENSORS_W83L786NG is not set
# CONFIG_SENSORS_W83627HF is not set
# CONFIG_SENSORS_W83627EHF is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_SENSORS_LIS3LV02D is not set
# CONFIG_SENSORS_APPLESMC is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
CONFIG_THERMAL=y
# CONFIG_THERMAL_HWMON is not set
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_NOWAYOUT is not set

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_ACQUIRE_WDT is not set
# CONFIG_ADVANTECH_WDT is not set
# CONFIG_ALIM1535_WDT is not set
# CONFIG_ALIM7101_WDT is not set
# CONFIG_SC520_WDT is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
# CONFIG_WAFER_WDT is not set
# CONFIG_I6300ESB_WDT is not set
# CONFIG_ITCO_WDT is not set
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
# CONFIG_PC87413_WDT is not set
# CONFIG_60XX_WDT is not set
# CONFIG_SBC8360_WDT is not set
# CONFIG_SBC7240_WDT is not set
# CONFIG_CPU5_WDT is not set
# CONFIG_SMSC_SCH311X_WDT is not set
# CONFIG_SMSC37B787_WDT is not set
# CONFIG_W83627HF_WDT is not set
# CONFIG_W83697HF_WDT is not set
# CONFIG_W83697UG_WDT is not set
# CONFIG_W83877F_WDT is not set
# CONFIG_W83977F_WDT is not set
# CONFIG_MACHZ_WDT is not set
# CONFIG_SBC_EPX_C3_WATCHDOG is not set

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set

#
# USB-based Watchdog Cards
#
# CONFIG_USBPCWATCHDOG is not set
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
# CONFIG_SSB is not set

#
# Multifunction device drivers
#
# CONFIG_MFD_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_TWL4030_CORE is not set
# CONFIG_MFD_TMIO is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_PCF50633 is not set
# CONFIG_AB3100_CORE is not set
# CONFIG_REGULATOR is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
CONFIG_AGP=y
# CONFIG_AGP_ALI is not set
# CONFIG_AGP_ATI is not set
# CONFIG_AGP_AMD is not set
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
# CONFIG_AGP_NVIDIA is not set
# CONFIG_AGP_SIS is not set
# CONFIG_AGP_SWORKS is not set
# CONFIG_AGP_VIA is not set
# CONFIG_AGP_EFFICEON is not set
CONFIG_DRM=y
# CONFIG_DRM_TDFX is not set
# CONFIG_DRM_R128 is not set
# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_I810 is not set
# CONFIG_DRM_I830 is not set
CONFIG_DRM_I915=y
# CONFIG_DRM_I915_KMS is not set
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_SIS is not set
# CONFIG_DRM_VIA is not set
# CONFIG_DRM_SAVAGE is not set
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
# CONFIG_FB_DDC is not set
# CONFIG_FB_BOOT_VESA_SUPPORT is not set
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 is not set
# CONFIG_FB_SYS_COPYAREA is not set
# CONFIG_FB_SYS_IMAGEBLIT is not set
# CONFIG_FB_FOREIGN_ENDIAN is not set
# CONFIG_FB_SYS_FOPS is not set
# CONFIG_FB_SVGALIB is not set
# CONFIG_FB_MACMODES is not set
# CONFIG_FB_BACKLIGHT is not set
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y

#
# Frame buffer hardware drivers
#
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_UVESA is not set
CONFIG_FB_EFI=y
# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I810 is not set
# CONFIG_FB_LE80578 is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_VIA is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_GEODE is not set
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
# CONFIG_FB_BROADSHEET is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=y
# CONFIG_BACKLIGHT_PROGEAR is not set
# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
# CONFIG_BACKLIGHT_SAHARA is not set

#
# 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_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
# CONFIG_LOGO_LINUX_VGA16 is not set
CONFIG_LOGO_LINUX_CLUT224=y
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=y
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
CONFIG_SND_VMASTER=y
# CONFIG_SND_RAWMIDI_SEQ is not set
# 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_DRIVERS=y
# CONFIG_SND_PCSP is not set
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_VIRMIDI is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALS4000 is not set
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
# CONFIG_SND_OXYGEN is not set
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CS5530 is not set
# CONFIG_SND_CS5535AUDIO is not set
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
# CONFIG_SND_LAYLA20 is not set
# CONFIG_SND_DARLA24 is not set
# CONFIG_SND_GINA24 is not set
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
# CONFIG_SND_ECHO3G is not set
# CONFIG_SND_INDIGO is not set
# CONFIG_SND_INDIGOIO is not set
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
# CONFIG_SND_EMU10K1X is not set
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
# CONFIG_SND_FM801 is not set
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_HWDEP=y
# CONFIG_SND_HDA_RECONFIG is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
# CONFIG_SND_HDA_INPUT_JACK is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_ATIHDMI=y
CONFIG_SND_HDA_CODEC_NVHDMI=y
CONFIG_SND_HDA_CODEC_INTELHDMI=y
CONFIG_SND_HDA_ELD=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
# CONFIG_SND_HDA_POWER_SAVE is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_HIFIER is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
# CONFIG_SND_INTEL8X0M is not set
# CONFIG_SND_KORG1212 is not set
# CONFIG_SND_LX6464ES is not set
# CONFIG_SND_MAESTRO3 is not set
# CONFIG_SND_MIXART is not set
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SIS7019 is not set
# CONFIG_SND_SONICVIBES is not set
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set
CONFIG_SND_USB=y
# CONFIG_SND_USB_AUDIO is not set
# CONFIG_SND_USB_USX2Y is not set
# CONFIG_SND_USB_CAIAQ is not set
# CONFIG_SND_USB_US122L is not set
CONFIG_SND_PCMCIA=y
# CONFIG_SND_VXPOCKET is not set
# CONFIG_SND_PDAUDIOCF is not set
# CONFIG_SND_SOC is not set
# CONFIG_SOUND_PRIME 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=y
CONFIG_HID_APPLE=y
CONFIG_HID_BELKIN=y
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CYPRESS=y
CONFIG_HID_DRAGONRISE=y
# CONFIG_DRAGONRISE_FF is not set
CONFIG_HID_EZKEY=y
CONFIG_HID_KYE=y
CONFIG_HID_GYRATION=y
CONFIG_HID_KENSINGTON=y
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=y
# CONFIG_SMARTJOYPLUS_FF is not set
CONFIG_HID_TOPSEED=y
CONFIG_HID_THRUSTMASTER=y
CONFIG_THRUSTMASTER_FF=y
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=y
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_USB_SUSPEND=y
# CONFIG_USB_OTG 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 is not set
# CONFIG_USB_XHCI_HCD is not set
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
# 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 is not set
CONFIG_USB_OHCI_HCD=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 is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_HWA_HCD is not set

#
# USB Device Class drivers
#
# CONFIG_USB_ACM is not set
CONFIG_USB_PRINTER=y
# CONFIG_USB_WDM is not set
# 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=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set

#
# USB port drivers
#
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_ADUTUX is not set
# CONFIG_USB_SEVSEG is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_LEGOTOWER is not set
# CONFIG_USB_LCD is not set
# CONFIG_USB_BERRY_CHARGE is not set
# CONFIG_USB_LED is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
# CONFIG_USB_CYTHERM is not set
# CONFIG_USB_IDMOUSE is not set
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
# CONFIG_USB_SISUSBVGA is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
# CONFIG_USB_IOWARRIOR is not set
# CONFIG_USB_TEST is not set
# CONFIG_USB_ISIGHTFW is not set
# CONFIG_USB_VST is not set

#
# OTG and related infrastructure
#
# CONFIG_NOP_USB_XCEIV is not set
# CONFIG_UWB is not set
# CONFIG_MMC is not set
# CONFIG_MEMSTICK is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
# CONFIG_LEDS_ALIX2 is not set
# CONFIG_LEDS_PCA9532 is not set
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_CLEVO_MAIL is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_BD2802 is not set

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_TIMER is not set
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set
CONFIG_EDAC=y

#
# Reporting subsystems
#
# CONFIG_EDAC_DEBUG is not set
# CONFIG_EDAC_MM_EDAC is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
# CONFIG_RTC_DEBUG is not set

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set

#
# SPI RTC drivers
#

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
# CONFIG_RTC_DRV_V3020 is not set

#
# on-CPU RTC drivers
#
CONFIG_DMADEVICES=y

#
# DMA Devices
#
# CONFIG_INTEL_IOATDMA is not set
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set

#
# TI VLYNQ
#
CONFIG_X86_PLATFORM_DEVICES=y
# CONFIG_ACER_WMI is not set
# CONFIG_ASUS_LAPTOP is not set
# CONFIG_FUJITSU_LAPTOP is not set
# CONFIG_TC1100_WMI is not set
# CONFIG_MSI_LAPTOP is not set
# CONFIG_PANASONIC_LAPTOP is not set
# CONFIG_COMPAL_LAPTOP is not set
# CONFIG_SONY_LAPTOP is not set
# CONFIG_THINKPAD_ACPI is not set
# CONFIG_INTEL_MENLOW is not set
CONFIG_EEEPC_LAPTOP=y
# CONFIG_ACPI_WMI is not set
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_TOSHIBA is not set

#
# Firmware Drivers
#
# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_EFI_VARS=y
# CONFIG_DELL_RBU is not set
# CONFIG_DCDBAS is not set
CONFIG_DMIID=y
# CONFIG_ISCSI_IBFT_FIND is not set

#
# File systems
#
# CONFIG_EXT2_FS is not set
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
# CONFIG_EXT4_FS is not set
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
CONFIG_FS_POSIX_ACL=y
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
# CONFIG_BTRFS_FS is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
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 is not set
CONFIG_AUTOFS4_FS=y
# CONFIG_FUSE_FS is not set
CONFIG_GENERIC_ACL=y

#
# Caches
#
# CONFIG_FSCACHE is not set

#
# 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 is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_VMCORE=y
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 is not set
CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_ECRYPT_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
# CONFIG_VXFS_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
# CONFIG_NILFS2_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_V4_1 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_RPCSEC_GSS_SPKM3 is not set
# CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
# CONFIG_ATARI_PARTITION is not set
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 is not set
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="utf8"
CONFIG_NLS_CODEPAGE_437=y
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y
# CONFIG_DLM is not set

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
CONFIG_ALLOW_WARNINGS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
# CONFIG_UNUSED_SYMBOLS is not set
CONFIG_DEBUG_FS=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_SHIRQ is not set
# CONFIG_DETECT_SOFTLOCKUP is not set
# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_SLUB_STATS is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set
# CONFIG_PROVE_LOCKING is not set
# CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_HIGHMEM is not set
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_DEBUG_LIST is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_DEBUG_NOTIFIERS is not set
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
# CONFIG_KPROBES_SANITY_TEST is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_LKDTM is not set
# CONFIG_FAULT_INJECTION is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=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_RING_BUFFER=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 is not set
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_SYSPROF_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_FTRACE_SYSCALLS is not set
# 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 is not set
# CONFIG_KMEMTRACE is not set
# CONFIG_WORKQUEUE_TRACER is not set
CONFIG_BLK_DEV_IO_TRACE=y
# CONFIG_FTRACE_STARTUP_TEST is not set
# CONFIG_MMIOTRACE is not set
# CONFIG_RING_BUFFER_BENCHMARK is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_HAVE_ARCH_KMEMCHECK=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_STACK_USAGE=y
# CONFIG_DEBUG_PER_CPU_MAPS is not set
# CONFIG_X86_PTDUMP is not set
CONFIG_DEBUG_RODATA=y
# CONFIG_DEBUG_RODATA_TEST is not set
CONFIG_DEBUG_NX_TEST=m
# 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=y

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
CONFIG_SECURITY=y
# CONFIG_SECURITYFS is not set
CONFIG_SECURITY_NETWORK=y
# CONFIG_SECURITY_NETWORK_XFRM is not set
# CONFIG_SECURITY_PATH is not set
CONFIG_SECURITY_FILE_CAPABILITIES=y
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
CONFIG_SECURITY_SELINUX_DISABLE=y
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
# CONFIG_SECURITY_TOMOYO is not set
# CONFIG_IMA is not set
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
# CONFIG_CRYPTO_FIPS is not set
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_RNG2=y
CONFIG_CRYPTO_PCOMP=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
CONFIG_CRYPTO_WORKQUEUE=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y
# CONFIG_CRYPTO_TEST is not set

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
# CONFIG_CRYPTO_GCM is not set
# CONFIG_CRYPTO_SEQIV is not set

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set

#
# Digest
#
# CONFIG_CRYPTO_CRC32C is not set
# CONFIG_CRYPTO_CRC32C_INTEL is not set
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
# CONFIG_CRYPTO_MICHAEL_MIC is not set
# CONFIG_CRYPTO_RMD128 is not set
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
# CONFIG_CRYPTO_RMD320 is not set
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 is not set

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_586=y
# CONFIG_CRYPTO_ANUBIS is not set
CONFIG_CRYPTO_ARC4=y
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_KHAZAD is not set
# CONFIG_CRYPTO_SALSA20 is not set
# CONFIG_CRYPTO_SALSA20_586 is not set
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
# CONFIG_CRYPTO_TWOFISH_586 is not set

#
# Compression
#
# CONFIG_CRYPTO_DEFLATE is not set
# CONFIG_CRYPTO_ZLIB is not set
# 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 is not set
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_VIRTUALIZATION=y
# CONFIG_KVM is not set
# CONFIG_LGUEST is not set
# CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_BALLOON is not set
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 is not set
# CONFIG_CRC16 is not set
CONFIG_CRC_T10DIF=y
# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
CONFIG_AUDIT_GENERIC=y
CONFIG_ZLIB_INFLATE=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=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] 1150+ messages in thread

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-09 11:10                               ` Ingo Molnar
@ 2009-08-09 18:30                                 ` Paul E. McKenney
  2009-08-09 19:23                                   ` Paul E. McKenney
  0 siblings, 1 reply; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-09 18:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Sun, Aug 09, 2009 at 01:10:08PM +0200, Ingo Molnar wrote:
> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > > rcu: Add second diagnostic check for a possible CPU-hotplug race
> > 
> > has a build problem too:
> > 
> >  kernel/built-in.o: In function `rcu_cpu_notified':
> >  (.text+0x1d787): undefined reference to `cpu_notified'
> >  kernel/built-in.o: In function `rcu_init':
> >  (.init.text+0x1174): undefined reference to `cpu_notified'
> >  kernel/built-in.o: In function `rcu_init':
> >  (.init.text+0x11a8): undefined reference to `cpu_notified'
> > 
> > Maybe we should simplify all those Kconfig rules? It's a maze.

Or I could fix up my scripts so that I once again test the relevant
combinations -before- I submit the patch.  :-/

> a testbox still managed to sneak in, build another config, boot it 
> and trigger the warning below - is this what you were after? Bootlog 
> below, config attached.

Sigh!  I have once again managed to disable testing of !CPU_HOTPLUG.  :-(

Patch under way...

							Thanx, Paul

> 	Ingo
> 
> [    0.000000] Initializing cgroup subsys cpuset
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 2.6.31-rc5-tip (mingo@europe) (gcc version 4.2.2) #7134 SMP Sun Aug 9 13:04:19 CEST 2009
> [    0.000000] KERNEL supported cpus:
> [    0.000000]   Intel GenuineIntel
> [    0.000000]   AMD AuthenticAMD
> [    0.000000]   NSC Geode by NSC
> [    0.000000]   Cyrix CyrixInstead
> [    0.000000]   Centaur CentaurHauls
> [    0.000000]   Transmeta GenuineTMx86
> [    0.000000]   Transmeta TransmetaCPU
> [    0.000000]   UMC UMC UMC UMC
> [    0.000000] BIOS-provided physical RAM map:
> [    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
> [    0.000000]  BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
> [    0.000000]  BIOS-e820: 00000000000d2000 - 00000000000d4000 (reserved)
> [    0.000000]  BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
> [    0.000000]  BIOS-e820: 0000000000100000 - 000000007f6e0000 (usable)
> [    0.000000]  BIOS-e820: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
> [    0.000000]  BIOS-e820: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
> [    0.000000]  BIOS-e820: 000000007f700000 - 0000000080000000 (reserved)
> [    0.000000]  BIOS-e820: 00000000f0000000 - 00000000f4000000 (reserved)
> [    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
> [    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
> [    0.000000]  BIOS-e820: 00000000fed14000 - 00000000fed1a000 (reserved)
> [    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed90000 (reserved)
> [    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
> [    0.000000]  BIOS-e820: 00000000ff800000 - 0000000100000000 (reserved)
> [    0.000000] debug: ignoring loglevel setting.
> [    0.000000] DMI present.
> [    0.000000] last_pfn = 0x7f6e0 max_arch_pfn = 0x100000
> [    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-CFFFF write-protect
> [    0.000000]   D0000-DBFFF uncachable
> [    0.000000]   DC000-DFFFF write-back
> [    0.000000]   E0000-FFFFF write-protect
> [    0.000000] MTRR variable ranges enabled:
> [    0.000000]   0 base 000000000 mask F80000000 write-back
> [    0.000000]   1 base 07F700000 mask FFFF00000 uncachable
> [    0.000000]   2 base 07F800000 mask FFF800000 uncachable
> [    0.000000]   3 disabled
> [    0.000000]   4 disabled
> [    0.000000]   5 disabled
> [    0.000000]   6 disabled
> [    0.000000]   7 disabled
> [    0.000000] PAT not supported by CPU.
> [    0.000000] e820 update range: 0000000000002000 - 0000000000006000 (usable) ==> (reserved)
> [    0.000000] Scanning 1 areas for low memory corruption
> [    0.000000] modified physical RAM map:
> [    0.000000]  modified: 0000000000000000 - 0000000000002000 (usable)
> [    0.000000]  modified: 0000000000002000 - 0000000000006000 (reserved)
> [    0.000000]  modified: 0000000000006000 - 000000000009f000 (usable)
> [    0.000000]  modified: 000000000009f000 - 00000000000a0000 (reserved)
> [    0.000000]  modified: 00000000000d2000 - 00000000000d4000 (reserved)
> [    0.000000]  modified: 00000000000dc000 - 0000000000100000 (reserved)
> [    0.000000]  modified: 0000000000100000 - 000000007f6e0000 (usable)
> [    0.000000]  modified: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
> [    0.000000]  modified: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
> [    0.000000]  modified: 000000007f700000 - 0000000080000000 (reserved)
> [    0.000000]  modified: 00000000f0000000 - 00000000f4000000 (reserved)
> [    0.000000]  modified: 00000000fec00000 - 00000000fec10000 (reserved)
> [    0.000000]  modified: 00000000fed00000 - 00000000fed00400 (reserved)
> [    0.000000]  modified: 00000000fed14000 - 00000000fed1a000 (reserved)
> [    0.000000]  modified: 00000000fed1c000 - 00000000fed90000 (reserved)
> [    0.000000]  modified: 00000000fee00000 - 00000000fee01000 (reserved)
> [    0.000000]  modified: 00000000ff800000 - 0000000100000000 (reserved)
> [    0.000000] initial memory mapped : 0 - 01c00000
> [    0.000000] init_memory_mapping: 0000000000000000-00000000377fe000
> [    0.000000]  0000000000 - 0000400000 page 4k
> [    0.000000]  0000400000 - 0037400000 page 2M
> [    0.000000]  0037400000 - 00377fe000 page 4k
> [    0.000000] kernel direct mapping tables up to 377fe000 @ 7000-c000
> [    0.000000] ACPI: RSDP 000f68a0 00024 (v02 LENOVO)
> [    0.000000] ACPI: XSDT 7f6e631f 00074 (v01 LENOVO TP-79    00001020  LTP 00000000)
> [    0.000000] ACPI: FACP 7f6e6400 000F4 (v03 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI Warning: 32/64X length mismatch in Gpe1Block: 0/32 20090521 tbfadt-527
> [    0.000000] ACPI Warning: Optional field Gpe1Block has zero address or length: 000000000000102C/0 20090521 tbfadt-558
> [    0.000000] ACPI: DSDT 7f6e65e7 0C765 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
> [    0.000000] ACPI: FACS 7f6f4000 00040
> [    0.000000] ACPI: SSDT 7f6e65b4 00033 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
> [    0.000000] ACPI: ECDT 7f6f2d4c 00052 (v01 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI: TCPA 7f6f2d9e 00032 (v02 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI: APIC 7f6f2dd0 00068 (v01 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI: MCFG 7f6f2e38 0003E (v01 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI: HPET 7f6f2e76 00038 (v01 LENOVO TP-79    00001020 LNVO 00000001)
> [    0.000000] ACPI: BOOT 7f6f2fd8 00028 (v01 LENOVO TP-79    00001020  LTP 00000001)
> [    0.000000] ACPI: SSDT 7f6e58da 00507 (v01 LENOVO TP-79    00001020 INTL 20050513)
> [    0.000000] ACPI: SSDT 7f6e5702 001D8 (v01 LENOVO TP-79    00001020 INTL 20050513)
> [    0.000000] ACPI: Local APIC address 0xfee00000
> [    0.000000] 1150MB HIGHMEM available.
> [    0.000000] 887MB LOWMEM available.
> [    0.000000]   mapped low ram: 0 - 377fe000
> [    0.000000]   low ram: 0 - 377fe000
> [    0.000000]   node 0 low ram: 00000000 - 377fe000
> [    0.000000]   node 0 bootmap 00008000 - 0000ef00
> [    0.000000] (8 early reservations) ==> bootmem [0000000000 - 00377fe000]
> [    0.000000]   #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
> [    0.000000]   #1 [0000001000 - 0000002000]    EX TRAMPOLINE ==> [0000001000 - 0000002000]
> [    0.000000]   #2 [0000006000 - 0000007000]       TRAMPOLINE ==> [0000006000 - 0000007000]
> [    0.000000]   #3 [0001000000 - 00018150c8]    TEXT DATA BSS ==> [0001000000 - 00018150c8]
> [    0.000000]   #4 [000009f000 - 0000100000]    BIOS reserved ==> [000009f000 - 0000100000]
> [    0.000000]   #5 [0001816000 - 000181d138]              BRK ==> [0001816000 - 000181d138]
> [    0.000000]   #6 [0000007000 - 0000008000]          PGTABLE ==> [0000007000 - 0000008000]
> [    0.000000]   #7 [0000008000 - 000000f000]          BOOTMAP ==> [0000008000 - 000000f000]
> [    0.000000] Scan SMP from c0000000 for 1024 bytes.
> [    0.000000] Scan SMP from c009fc00 for 1024 bytes.
> [    0.000000] Scan SMP from c00f0000 for 65536 bytes.
> [    0.000000] found SMP MP-table at [c00f68e0] f68e0
> [    0.000000]   mpc: 9f5a1-9f6b5
> [    0.000000] Zone PFN ranges:
> [    0.000000]   DMA      0x00000000 -> 0x00001000
> [    0.000000]   Normal   0x00001000 -> 0x000377fe
> [    0.000000]   HighMem  0x000377fe -> 0x0007f6e0
> [    0.000000] Movable zone start PFN for each node
> [    0.000000] early_node_map[3] active PFN ranges
> [    0.000000]     0: 0x00000000 -> 0x00000002
> [    0.000000]     0: 0x00000006 -> 0x0000009f
> [    0.000000]     0: 0x00000100 -> 0x0007f6e0
> [    0.000000] On node 0 totalpages: 521851
> [    0.000000] free_area_init_node: node 0, pgdat c16f3c20, node_mem_map c181e000
> [    0.000000]   DMA zone: 32 pages used for memmap
> [    0.000000]   DMA zone: 0 pages reserved
> [    0.000000]   DMA zone: 3963 pages, LIFO batch:0
> [    0.000000]   Normal zone: 1744 pages used for memmap
> [    0.000000]   Normal zone: 221486 pages, LIFO batch:31
> [    0.000000]   HighMem zone: 2302 pages used for memmap
> [    0.000000]   HighMem zone: 292324 pages, LIFO batch:31
> [    0.000000] Using APIC driver default
> [    0.000000] ACPI: PM-Timer IO Port: 0x1008
> [    0.000000] ACPI: Local APIC address 0xfee00000
> [    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
> [    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
> [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
> [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
> [    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
> [    0.000000] IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
> [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
> [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
> [    0.000000] ACPI: IRQ0 used by override.
> [    0.000000] ACPI: IRQ2 used by override.
> [    0.000000] ACPI: IRQ9 used by override.
> [    0.000000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
> [    0.000000] Using ACPI (MADT) for SMP configuration information
> [    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
> [    0.000000] SMP: Allowing 2 CPUs, 0 hotplug CPUs
> [    0.000000] mapped APIC to ffffb000 (fee00000)
> [    0.000000] mapped IOAPIC to ffffa000 (fec00000)
> [    0.000000] nr_irqs_gsi: 24
> [    0.000000] PM: Registered nosave memory: 0000000000002000 - 0000000000006000
> [    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
> [    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000d2000
> [    0.000000] PM: Registered nosave memory: 00000000000d2000 - 00000000000d4000
> [    0.000000] PM: Registered nosave memory: 00000000000d4000 - 00000000000dc000
> [    0.000000] PM: Registered nosave memory: 00000000000dc000 - 0000000000100000
> [    0.000000] Allocating PCI resources starting at 80000000 (gap: 80000000:70000000)
> [    0.000000] NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
> [    0.000000] PERCPU: Embedded 14 pages at c2818000, static data 33436 bytes
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 517773
> [    0.000000] Kernel command line: root=/dev/sda1 console=tty profile=0 debug initcall_debug enforcing=0 apic=verbose sysrq_always_enabled ignore_loglevel selinux=1 relaxed_check=1 3 netconsole=4444@10.0.1.15/eth0,4444@10.0.1.21/00:30:48:c6:86:26
> [    0.000000] kernel profiling enabled (shift: 0)
> [    0.000000] debug: sysrq always enabled.
> [    0.000000] PID hash table entries: 4096 (order: 12, 16384 bytes)
> [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
> [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
> [    0.000000] Enabling fast FPU save and restore... done.
> [    0.000000] Enabling unmasked SIMD FPU exception support... done.
> [    0.000000] Initializing CPU#0
> [    0.000000] Initializing HighMem for node 0 (000377fe:0007f6e0)
> [    0.000000] Memory: 2061020k/2087808k available (4496k kernel code, 25604k reserved, 2686k data, 376k init, 1178504k highmem)
> [    0.000000] virtual kernel memory layout:
> [    0.000000]     fixmap  : 0xfff1f000 - 0xfffff000   ( 896 kB)
> [    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
> [    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
> [    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
> [    0.000000]       .init : 0xc170b000 - 0xc1769000   ( 376 kB)
> [    0.000000]       .data : 0xc14643fd - 0xc1703f68   (2686 kB)
> [    0.000000]       .text : 0xc1000000 - 0xc14643fd   (4496 kB)
> [    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
> [    0.000000] SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
> [    0.000000] Hierarchical RCU implementation.
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: at kernel/rcupdate.c:259 rcu_init+0x2b/0xa0()
> [    0.000000] Hardware name: 1951A26
> [    0.000000] Modules linked in:
> [    0.000000] Pid: 0, comm: swapper Not tainted 2.6.31-rc5-tip #7134
> [    0.000000] Call Trace:
> [    0.000000]  [<c102ec3b>] warn_slowpath_common+0x60/0x77
> [    0.000000]  [<c102ec5f>] warn_slowpath_null+0xd/0x10
> [    0.000000]  [<c171c929>] rcu_init+0x2b/0xa0
> [    0.000000]  [<c170b6f3>] start_kernel+0x184/0x2ca
> [    0.000000]  [<c170b06a>] __init_begin+0x6a/0x6f
> [    0.000000] ---[ end trace 4eaa2a86a8e2da22 ]---
> [    0.000000] NR_IRQS:2304 nr_irqs:424
> [    0.000000] Extended CMOS year: 2000
> [    0.000000] Fast TSC calibration using PIT
> [    0.000000] Detected 1828.477 MHz processor.
> [    0.000999] Console: colour VGA+ 80x25
> [    0.000999] console [tty0] enabled
> [    0.000999] hpet clockevent registered
> [    0.000999] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
> [    0.000999] Calibrating delay loop (skipped), value calculated using timer frequency.. 3656.95 BogoMIPS (lpj=1828477)
> [    0.000999] Security Framework initialized
> [    0.000999] SELinux:  Initializing.
> [    0.000999] SELinux:  Starting in permissive mode
> [    0.000999] Mount-cache hash table entries: 512
> [    0.000999] Initializing cgroup subsys ns
> [    0.000999] Initializing cgroup subsys cpuacct
> [    0.001013] Initializing cgroup subsys freezer
> [    0.001119] CPU: L1 I cache: 32K, L1 D cache: 32K
> [    0.001249] CPU: L2 cache: 2048K
> [    0.001336] CPU: Physical Processor ID: 0
> [    0.001422] CPU: Processor Core ID: 0
> [    0.001510] mce: CPU supports 6 MCE banks
> [    0.001605] CPU0: Thermal monitoring enabled (TM2)
> [    0.001694] using mwait in idle threads.
> [    0.001786] Performance Counters: no PMU driver, software counters only.
> [    0.002005] Checking 'hlt' instruction... OK.
> [    0.006584] ACPI: Core revision 20090521
> [    0.027076] enabled ExtINT on CPU#0
> [    0.028075] ENABLING IO-APIC IRQs
> [    0.028161] init IO_APIC IRQs
> [    0.028246]  1-0 (apicid-pin) not connected
> [    0.028377] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
> [    0.028508] IOAPIC[0]: Set routing entry (1-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
> [    0.028640] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
> [    0.028772] IOAPIC[0]: Set routing entry (1-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
> [    0.028904] IOAPIC[0]: Set routing entry (1-5 -> 0x35 -> IRQ 5 Mode:0 Active:0)
> [    0.029001] IOAPIC[0]: Set routing entry (1-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
> [    0.029132] IOAPIC[0]: Set routing entry (1-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
> [    0.029264] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
> [    0.029397] IOAPIC[0]: Set routing entry (1-9 -> 0x39 -> IRQ 9 Mode:1 Active:0)
> [    0.029528] IOAPIC[0]: Set routing entry (1-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
> [    0.029659] IOAPIC[0]: Set routing entry (1-11 -> 0x3b -> IRQ 11 Mode:0 Active:0)
> [    0.029791] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
> [    0.029923] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
> [    0.030000] IOAPIC[0]: Set routing entry (1-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
> [    0.030131] IOAPIC[0]: Set routing entry (1-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
> [    0.030261]  1-16 1-17 1-18 1-19 1-20 1-21 1-22 1-23 (apicid-pin) not connected
> [    0.030875] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
> [    0.041069] CPU0: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
> [    0.041248] Using local APIC timer interrupts.
> [    0.041250] calibrating APIC timer ...
> [    0.041993] ... lapic delta = 1039050
> [    0.041993] ... PM-Timer delta = 357950
> [    0.041993] ... PM-Timer result ok
> [    0.041993] ..... delta 1039050
> [    0.041993] ..... mult: 44633642
> [    0.041993] ..... calibration result: 166248
> [    0.041993] ..... CPU clock speed is 1828.0727 MHz.
> [    0.041993] ..... host bus clock speed is 166.0248 MHz.
> [    0.041993] calling  migration_init+0x0/0x47 @ 1
> [    0.041993] initcall migration_init+0x0/0x47 returned 0 after 0 usecs
> [    0.041993] calling  spawn_ksoftirqd+0x0/0x47 @ 1
> [    0.041993] initcall spawn_ksoftirqd+0x0/0x47 returned 0 after 0 usecs
> [    0.041993] calling  init_call_single_data+0x0/0x6d @ 1
> [    0.041993] initcall init_call_single_data+0x0/0x6d returned 0 after 0 usecs
> [    0.041993] calling  relay_init+0x0/0x11 @ 1
> [    0.041993] initcall relay_init+0x0/0x11 returned 0 after 0 usecs
> [    0.041993] calling  tracer_alloc_buffers+0x0/0x12d @ 1
> [    0.041993] initcall tracer_alloc_buffers+0x0/0x12d returned 0 after 0 usecs
> [    0.041998] calling  init_trace_printk+0x0/0xf @ 1
> [    0.042087] initcall init_trace_printk+0x0/0xf returned 0 after 0 usecs
> [    0.042253] Booting processor 1 APIC 0x1 ip 0x6000
> [    0.000999] Initializing CPU#1
> [    0.000999] masked ExtINT on CPU#1
> [    0.000999] Calibrating delay using timer specific routine.. 3657.34 BogoMIPS (lpj=1828674)
> [    0.000999] CPU: L1 I cache: 32K, L1 D cache: 32K
> [    0.000999] CPU: L2 cache: 2048K
> [    0.000999] CPU: Physical Processor ID: 0
> [    0.000999] CPU: Processor Core ID: 1
> [    0.000999] mce: CPU supports 6 MCE banks
> [    0.000999] CPU1: Thermal monitoring enabled (TM2)
> [    0.113434] CPU1: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
> [    0.114126] checking TSC synchronization [CPU#0 -> CPU#1]:
> [    0.114982] Measured 579865 cycles TSC warp between CPUs, turning off TSC clock.
> [    0.114982] Marking TSC unstable due to check_tsc_sync_source failed
> [    0.115008] Brought up 2 CPUs
> [    0.115095] Total of 2 processors activated (7314.30 BogoMIPS).
> [    0.116092] khelper used greatest stack depth: 6944 bytes left
> [    0.116167] calling  init_cpufreq_transition_notifier_list+0x0/0x18 @ 1
> [    0.116167] initcall init_cpufreq_transition_notifier_list+0x0/0x18 returned 0 after 0 usecs
> [    0.116275] calling  net_ns_init+0x0/0xc0 @ 1
> [    0.116384] initcall net_ns_init+0x0/0xc0 returned 0 after 0 usecs
> [    0.116384] calling  e820_mark_nvs_memory+0x0/0x37 @ 1
> [    0.116989] initcall e820_mark_nvs_memory+0x0/0x37 returned 0 after 0 usecs
> [    0.117084] calling  cpufreq_tsc+0x0/0x25 @ 1
> [    0.117172] initcall cpufreq_tsc+0x0/0x25 returned 0 after 0 usecs
> [    0.117265] calling  pci_reboot_init+0x0/0x11 @ 1
> [    0.117355] initcall pci_reboot_init+0x0/0x11 returned 0 after 0 usecs
> [    0.117447] calling  reboot_init+0x0/0x11 @ 1
> [    0.117540] initcall reboot_init+0x0/0x11 returned 0 after 0 usecs
> [    0.117633] calling  init_lapic_sysfs+0x0/0x28 @ 1
> [    0.117730] initcall init_lapic_sysfs+0x0/0x28 returned 0 after 0 usecs
> [    0.117989] calling  init_smp_flush+0x0/0x20 @ 1
> [    0.118078] initcall init_smp_flush+0x0/0x20 returned 0 after 0 usecs
> [    0.118172] calling  alloc_frozen_cpus+0x0/0x9 @ 1
> [    0.118262] initcall alloc_frozen_cpus+0x0/0x9 returned 0 after 0 usecs
> [    0.118355] calling  sysctl_init+0x0/0x29 @ 1
> [    0.118584] initcall sysctl_init+0x0/0x29 returned 0 after 0 usecs
> [    0.118676] calling  ksysfs_init+0x0/0x96 @ 1
> [    0.118773] initcall ksysfs_init+0x0/0x96 returned 0 after 0 usecs
> [    0.118865] calling  async_init+0x0/0x3c @ 1
> [    0.118954] initcall async_init+0x0/0x3c returned 0 after 0 usecs
> [    0.118986] calling  init_jiffies_clocksource+0x0/0xf @ 1
> [    0.119078] initcall init_jiffies_clocksource+0x0/0xf returned 0 after 0 usecs
> [    0.119206] calling  pm_init+0x0/0x2d @ 1
> [    0.119299] initcall pm_init+0x0/0x2d returned 0 after 0 usecs
> [    0.119389] calling  pm_disk_init+0x0/0x14 @ 1
> [    0.119480] initcall pm_disk_init+0x0/0x14 returned 0 after 0 usecs
> [    0.119573] calling  swsusp_header_init+0x0/0x26 @ 1
> [    0.119663] initcall swsusp_header_init+0x0/0x26 returned 0 after 0 usecs
> [    0.119756] calling  init_hw_breakpoint+0x0/0xf @ 1
> [    0.119848] initcall init_hw_breakpoint+0x0/0xf returned 0 after 0 usecs
> [    0.119986] calling  filelock_init+0x0/0x27 @ 1
> [    0.120075] initcall filelock_init+0x0/0x27 returned 0 after 0 usecs
> [    0.120167] calling  init_misc_binfmt+0x0/0x35 @ 1
> [    0.120259] initcall init_misc_binfmt+0x0/0x35 returned 0 after 0 usecs
> [    0.120351] calling  init_script_binfmt+0x0/0x11 @ 1
> [    0.120442] initcall init_script_binfmt+0x0/0x11 returned 0 after 0 usecs
> [    0.120534] calling  init_elf_binfmt+0x0/0x11 @ 1
> [    0.120623] initcall init_elf_binfmt+0x0/0x11 returned 0 after 0 usecs
> [    0.120716] calling  debugfs_init+0x0/0x4a @ 1
> [    0.120808] initcall debugfs_init+0x0/0x4a returned 0 after 0 usecs
> [    0.120901] calling  random32_init+0x0/0xa4 @ 1
> [    0.120985] initcall random32_init+0x0/0xa4 returned 0 after 0 usecs
> [    0.121079] calling  early_resume_init+0x0/0x183 @ 1
> [    0.121985] Time: 11:05:10  Date: 08/09/09
> [    0.122072] initcall early_resume_init+0x0/0x183 returned 0 after 976 usecs
> [    0.122164] calling  cpufreq_core_init+0x0/0x59 @ 1
> [    0.122253] initcall cpufreq_core_init+0x0/0x59 returned 0 after 0 usecs
> [    0.122345] calling  cpuidle_init+0x0/0x32 @ 1
> [    0.122437] initcall cpuidle_init+0x0/0x32 returned 0 after 0 usecs
> [    0.122529] calling  sock_init+0x0/0x51 @ 1
> [    0.122662] initcall sock_init+0x0/0x51 returned 0 after 0 usecs
> [    0.122754] calling  net_inuse_init+0x0/0x1f @ 1
> [    0.122845] initcall net_inuse_init+0x0/0x1f returned 0 after 0 usecs
> [    0.122937] calling  netpoll_init+0x0/0x11 @ 1
> [    0.122985] initcall netpoll_init+0x0/0x11 returned 0 after 0 usecs
> [    0.123077] calling  netlink_proto_init+0x0/0x102 @ 1
> [    0.123170] NET: Registered protocol family 16
> [    0.123269] initcall netlink_proto_init+0x0/0x102 returned 0 after 0 usecs
> [    0.123362] calling  bdi_class_init+0x0/0x35 @ 1
> [    0.123464] initcall bdi_class_init+0x0/0x35 returned 0 after 0 usecs
> [    0.123464] calling  kobject_uevent_init+0x0/0x4e @ 1
> [    0.123464] initcall kobject_uevent_init+0x0/0x4e returned 0 after 0 usecs
> [    0.123464] calling  pcibus_class_init+0x0/0x14 @ 1
> [    0.123464] initcall pcibus_class_init+0x0/0x14 returned 0 after 0 usecs
> [    0.123992] calling  pci_driver_init+0x0/0xf @ 1
> [    0.124091] initcall pci_driver_init+0x0/0xf returned 0 after 0 usecs
> [    0.124091] calling  backlight_class_init+0x0/0x4d @ 1
> [    0.124182] initcall backlight_class_init+0x0/0x4d returned 0 after 0 usecs
> [    0.124182] calling  video_output_class_init+0x0/0x14 @ 1
> [    0.124182] initcall video_output_class_init+0x0/0x14 returned 0 after 0 usecs
> [    0.124182] calling  tty_class_init+0x0/0x28 @ 1
> [    0.124212] initcall tty_class_init+0x0/0x28 returned 0 after 0 usecs
> [    0.124987] calling  vtconsole_class_init+0x0/0xa1 @ 1
> [    0.125087] initcall vtconsole_class_init+0x0/0xa1 returned 0 after 0 usecs
> [    0.125087] calling  i2c_init+0x0/0x54 @ 1
> [    0.125177] initcall i2c_init+0x0/0x54 returned 0 after 0 usecs
> [    0.125177] calling  amd_postcore_init+0x0/0x66 @ 1
> [    0.125177] initcall amd_postcore_init+0x0/0x66 returned 0 after 0 usecs
> [    0.125260] calling  arch_kdebugfs_init+0x0/0x261 @ 1
> [    0.125361] initcall arch_kdebugfs_init+0x0/0x261 returned 0 after 0 usecs
> [    0.125986] calling  init_pit_clocksource+0x0/0x94 @ 1
> [    0.126077] initcall init_pit_clocksource+0x0/0x94 returned 0 after 0 usecs
> [    0.126170] calling  mtrr_if_init+0x0/0x44 @ 1
> [    0.126261] initcall mtrr_if_init+0x0/0x44 returned 0 after 0 usecs
> [    0.126353] calling  ffh_cstate_init+0x0/0x27 @ 1
> [    0.126442] initcall ffh_cstate_init+0x0/0x27 returned 0 after 0 usecs
> [    0.126535] calling  kdump_buf_page_init+0x0/0x54 @ 1
> [    0.126626] initcall kdump_buf_page_init+0x0/0x54 returned 0 after 0 usecs
> [    0.126719] calling  acpi_pci_init+0x0/0x4c @ 1
> [    0.126807] ACPI: bus type pci registered
> [    0.126895] initcall acpi_pci_init+0x0/0x4c returned 0 after 0 usecs
> [    0.126983] calling  dmi_id_init+0x0/0x28f @ 1
> [    0.127083] initcall dmi_id_init+0x0/0x28f returned 0 after 0 usecs
> [    0.127083] calling  pci_arch_init+0x0/0x53 @ 1
> [    0.127190] PCI: MCFG configuration 0: base f0000000 segment 0 buses 0 - 63
> [    0.127283] PCI: MCFG area at f0000000 reserved in E820
> [    0.127372] PCI: Using MMCONFIG for extended config space
> [    0.127461] PCI: Using configuration type 1 for base access
> [    0.127560] initcall pci_arch_init+0x0/0x53 returned 0 after 0 usecs
> [    0.127653] calling  topology_init+0x0/0x36 @ 1
> [    0.128010] initcall topology_init+0x0/0x36 returned 0 after 976 usecs
> [    0.128103] calling  mtrr_init_finialize+0x0/0x35 @ 1
> [    0.128193] initcall mtrr_init_finialize+0x0/0x35 returned 0 after 0 usecs
> [    0.128287] calling  param_sysfs_init+0x0/0x1a6 @ 1
> [    0.138109] initcall param_sysfs_init+0x0/0x1a6 returned 0 after 9764 usecs
> [    0.138109] calling  pm_sysrq_init+0x0/0x16 @ 1
> [    0.138195] initcall pm_sysrq_init+0x0/0x16 returned 0 after 0 usecs
> [    0.138287] calling  audit_watch_init+0x0/0x27 @ 1
> [    0.138376] initcall audit_watch_init+0x0/0x27 returned 0 after 0 usecs
> [    0.138469] calling  default_bdi_init+0x0/0x2f @ 1
> [    0.138584] initcall default_bdi_init+0x0/0x2f returned 0 after 0 usecs
> [    0.138584] calling  init_bio+0x0/0xc0 @ 1
> [    0.139024] bio: create slab <bio-0> at 0
> [    0.139118] initcall init_bio+0x0/0xc0 returned 0 after 0 usecs
> [    0.139210] calling  fsnotify_init+0x0/0xf @ 1
> [    0.139300] initcall fsnotify_init+0x0/0xf returned 0 after 0 usecs
> [    0.139392] calling  fsnotify_notification_init+0x0/0x5b @ 1
> [    0.139485] initcall fsnotify_notification_init+0x0/0x5b returned 0 after 0 usecs
> [    0.139615] calling  cryptomgr_init+0x0/0xf @ 1
> [    0.139704] initcall cryptomgr_init+0x0/0xf returned 0 after 0 usecs
> [    0.139795] calling  blk_settings_init+0x0/0x1d @ 1
> [    0.139885] initcall blk_settings_init+0x0/0x1d returned 0 after 0 usecs
> [    0.140016] calling  blk_ioc_init+0x0/0x24 @ 1
> [    0.140106] initcall blk_ioc_init+0x0/0x24 returned 0 after 0 usecs
> [    0.140198] calling  blk_softirq_init+0x0/0x5b @ 1
> [    0.140288] initcall blk_softirq_init+0x0/0x5b returned 0 after 0 usecs
> [    0.140379] calling  genhd_device_init+0x0/0x50 @ 1
> [    0.140516] initcall genhd_device_init+0x0/0x50 returned 0 after 0 usecs
> [    0.140516] calling  pci_slot_init+0x0/0x3b @ 1
> [    0.140516] initcall pci_slot_init+0x0/0x3b returned 0 after 0 usecs
> [    0.140516] calling  fbmem_init+0x0/0x78 @ 1
> [    0.140516] initcall fbmem_init+0x0/0x78 returned 0 after 0 usecs
> [    0.141018] calling  acpi_init+0x0/0x25e @ 1
> [    0.142435] ACPI: EC: EC description table is found, configuring boot EC
> [    0.150150] ACPI: EC: non-query interrupt received, switching to interrupt mode
> [    0.156229] ACPI: Interpreter enabled
> [    0.156318] ACPI: (supports S0 S3 S4 S5)
> [    0.156596] ACPI: Using IOAPIC for interrupt routing
> [    0.173122] ACPI: EC: GPE = 0x1c, I/O: command/status = 0x66, data = 0x62
> [    0.173215] ACPI: EC: driver started in interrupt mode
> [    0.173323] ACPI: Power Resource [PUBS] (on)
> [    0.174221] initcall acpi_init+0x0/0x25e returned 0 after 32221 usecs
> [    0.174314] calling  dock_init+0x0/0x7d @ 1
> [    0.177366] ACPI: ACPI Dock Station Driver: 3 docks/bays found
> [    0.177460] initcall dock_init+0x0/0x7d returned 0 after 2929 usecs
> [    0.177553] calling  acpi_pci_root_init+0x0/0x25 @ 1
> [    0.177668] ACPI: PCI Root Bridge [PCI0] (0000:00)
> [    0.177785] pci 0000:00:02.0: reg 10 32bit mmio: [0xee100000-0xee17ffff]
> [    0.177979] pci 0000:00:02.0: reg 14 io port: [0x1800-0x1807]
> [    0.178072] pci 0000:00:02.0: reg 18 32bit mmio: [0xd0000000-0xdfffffff]
> [    0.178166] pci 0000:00:02.0: reg 1c 32bit mmio: [0xee200000-0xee23ffff]
> [    0.178296] pci 0000:00:02.1: reg 10 32bit mmio: [0xee180000-0xee1fffff]
> [    0.178500] pci 0000:00:1b.0: reg 10 64bit mmio: [0xee240000-0xee243fff]
> [    0.178650] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
> [    0.178743] pci 0000:00:1b.0: PME# disabled
> [    0.178913] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
> [    0.178978] pci 0000:00:1c.0: PME# disabled
> [    0.179149] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold
> [    0.179243] pci 0000:00:1c.1: PME# disabled
> [    0.179414] pci 0000:00:1c.2: PME# supported from D0 D3hot D3cold
> [    0.179508] pci 0000:00:1c.2: PME# disabled
> [    0.179678] pci 0000:00:1c.3: PME# supported from D0 D3hot D3cold
> [    0.179771] pci 0000:00:1c.3: PME# disabled
> [    0.179919] pci 0000:00:1d.0: reg 20 io port: [0x1820-0x183f]
> [    0.180039] pci 0000:00:1d.1: reg 20 io port: [0x1840-0x185f]
> [    0.180191] pci 0000:00:1d.2: reg 20 io port: [0x1860-0x187f]
> [    0.180342] pci 0000:00:1d.3: reg 20 io port: [0x1880-0x189f]
> [    0.180498] pci 0000:00:1d.7: reg 10 32bit mmio: [0xee444000-0xee4443ff]
> [    0.180649] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
> [    0.180744] pci 0000:00:1d.7: PME# disabled
> [    0.181077] pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
> [    0.181209] pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH6 GPIO
> [    0.181303] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 1600 (mask 007f)
> [    0.181435] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 2 PIO at 15e0 (mask 000f)
> [    0.181567] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 3 PIO at 1680 (mask 001f)
> [    0.181748] pci 0000:00:1f.1: reg 10 io port: [0x00-0x07]
> [    0.181843] pci 0000:00:1f.1: reg 14 io port: [0x00-0x03]
> [    0.181939] pci 0000:00:1f.1: reg 18 io port: [0x00-0x07]
> [    0.181980] pci 0000:00:1f.1: reg 1c io port: [0x00-0x03]
> [    0.182075] pci 0000:00:1f.1: reg 20 io port: [0x1810-0x181f]
> [    0.182227] pci 0000:00:1f.2: reg 10 io port: [0x18d0-0x18d7]
> [    0.182323] pci 0000:00:1f.2: reg 14 io port: [0x18c4-0x18c7]
> [    0.182419] pci 0000:00:1f.2: reg 18 io port: [0x18c8-0x18cf]
> [    0.182514] pci 0000:00:1f.2: reg 1c io port: [0x18c0-0x18c3]
> [    0.182610] pci 0000:00:1f.2: reg 20 io port: [0x18b0-0x18bf]
> [    0.182705] pci 0000:00:1f.2: reg 24 32bit mmio: [0xee444400-0xee4447ff]
> [    0.182833] pci 0000:00:1f.2: PME# supported from D3hot
> [    0.182977] pci 0000:00:1f.2: PME# disabled
> [    0.183126] pci 0000:00:1f.3: reg 20 io port: [0x18e0-0x18ff]
> [    0.183388] pci 0000:02:00.0: reg 10 32bit mmio: [0xee000000-0xee01ffff]
> [    0.183563] pci 0000:02:00.0: reg 18 io port: [0x2000-0x201f]
> [    0.183819] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
> [    0.183977] pci 0000:02:00.0: PME# disabled
> [    0.184201] pci 0000:00:1c.0: bridge io port: [0x2000-0x2fff]
> [    0.184295] pci 0000:00:1c.0: bridge 32bit mmio: [0xee000000-0xee0fffff]
> [    0.184575] pci 0000:03:00.0: reg 10 32bit mmio: [0xedf00000-0xedf00fff]
> [    0.184946] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
> [    0.185025] pci 0000:03:00.0: PME# disabled
> [    0.185254] pci 0000:00:1c.1: bridge io port: [0x3000-0x4fff]
> [    0.185348] pci 0000:00:1c.1: bridge 32bit mmio: [0xec000000-0xedffffff]
> [    0.185446] pci 0000:00:1c.1: bridge 64bit mmio pref: [0xe4000000-0xe40fffff]
> [    0.185596] pci 0000:00:1c.2: bridge io port: [0x5000-0x6fff]
> [    0.185690] pci 0000:00:1c.2: bridge 32bit mmio: [0xe8000000-0xe9ffffff]
> [    0.185789] pci 0000:00:1c.2: bridge 64bit mmio pref: [0xe4100000-0xe41fffff]
> [    0.186016] pci 0000:00:1c.3: bridge io port: [0x7000-0x8fff]
> [    0.186109] pci 0000:00:1c.3: bridge 32bit mmio: [0xea000000-0xebffffff]
> [    0.186206] pci 0000:00:1c.3: bridge 64bit mmio pref: [0xe4200000-0xe42fffff]
> [    0.186352] pci 0000:15:00.0: reg 10 32bit mmio: [0xe4300000-0xe4300fff]
> [    0.186471] pci 0000:15:00.0: supports D1 D2
> [    0.186558] pci 0000:15:00.0: PME# supported from D0 D1 D2 D3hot D3cold
> [    0.186653] pci 0000:15:00.0: PME# disabled
> [    0.186808] pci 0000:00:1e.0: transparent bridge
> [    0.186898] pci 0000:00:1e.0: bridge io port: [0x9000-0xcfff]
> [    0.186980] pci 0000:00:1e.0: bridge 32bit mmio: [0xe4300000-0xe7ffffff]
> [    0.187845] pci 0000:00:1e.0: bridge 64bit mmio pref: [0xe0000000-0xe3ffffff]
> [    0.188012] pci_bus 0000:00: on NUMA node 0
> [    0.188103] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
> [    0.188345] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP0._PRT]
> [    0.188515] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP1._PRT]
> [    0.188683] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP2._PRT]
> [    0.188857] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP3._PRT]
> [    0.189037] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
> [    0.194071] initcall acpi_pci_root_init+0x0/0x25 returned 0 after 16599 usecs
> [    0.194071] calling  acpi_pci_link_init+0x0/0x3f @ 1
> [    0.194320] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.195402] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.196167] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.196895] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.197608] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.198349] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.199103] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.199834] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 10 *11)
> [    0.200436] initcall acpi_pci_link_init+0x0/0x3f returned 0 after 5858 usecs
> [    0.200436] calling  pnp_init+0x0/0xf @ 1
> [    0.200436] initcall pnp_init+0x0/0xf returned 0 after 0 usecs
> [    0.200436] calling  misc_init+0x0/0x92 @ 1
> [    0.200436] initcall misc_init+0x0/0x92 returned 0 after 0 usecs
> [    0.200979] calling  cn_init+0x0/0xcb @ 1
> [    0.201078] initcall cn_init+0x0/0xcb returned 0 after 0 usecs
> [    0.201170] calling  init_scsi+0x0/0x84 @ 1
> [    0.201338] SCSI subsystem initialized
> [    0.201338] initcall init_scsi+0x0/0x84 returned 0 after 0 usecs
> [    0.201338] calling  ata_init+0x0/0x29d @ 1
> [    0.201338] libata version 3.00 loaded.
> [    0.201338] initcall ata_init+0x0/0x29d returned 0 after 0 usecs
> [    0.201975] calling  phy_init+0x0/0x29 @ 1
> [    0.202074] initcall phy_init+0x0/0x29 returned 0 after 0 usecs
> [    0.202074] calling  init_pcmcia_cs+0x0/0x1e @ 1
> [    0.202163] initcall init_pcmcia_cs+0x0/0x1e returned 0 after 0 usecs
> [    0.202163] calling  usb_init+0x0/0x177 @ 1
> [    0.202177] usbcore: registered new interface driver usbfs
> [    0.202177] usbcore: registered new interface driver hub
> [    0.203006] usbcore: registered new device driver usb
> [    0.203063] initcall usb_init+0x0/0x177 returned 0 after 976 usecs
> [    0.203155] calling  serio_init+0x0/0x82 @ 1
> [    0.203252] initcall serio_init+0x0/0x82 returned 0 after 0 usecs
> [    0.203252] calling  input_init+0x0/0xfb @ 1
> [    0.203252] initcall input_init+0x0/0xfb returned 0 after 0 usecs
> [    0.203252] calling  rtc_init+0x0/0x5e @ 1
> [    0.203252] initcall rtc_init+0x0/0x5e returned 0 after 0 usecs
> [    0.203973] calling  power_supply_class_init+0x0/0x2b @ 1
> [    0.204074] initcall power_supply_class_init+0x0/0x2b returned 0 after 0 usecs
> [    0.204101] calling  hwmon_init+0x0/0xe9 @ 1
> [    0.204202] initcall hwmon_init+0x0/0xe9 returned 0 after 0 usecs
> [    0.204202] calling  thermal_init+0x0/0x32 @ 1
> [    0.204202] initcall thermal_init+0x0/0x32 returned 0 after 0 usecs
> [    0.204202] calling  md_init+0x0/0xb5 @ 1
> [    0.204202] initcall md_init+0x0/0xb5 returned 0 after 0 usecs
> [    0.204252] calling  leds_init+0x0/0x32 @ 1
> [    0.204983] initcall leds_init+0x0/0x32 returned 0 after 0 usecs
> [    0.205065] calling  pci_subsys_init+0x0/0xdf @ 1
> [    0.205153] PCI: Using ACPI for IRQ routing
> [    0.205553] initcall pci_subsys_init+0x0/0xdf returned 0 after 0 usecs
> [    0.205646] calling  proto_init+0x0/0xf @ 1
> [    0.205736] initcall proto_init+0x0/0xf returned 0 after 0 usecs
> [    0.205827] calling  net_dev_init+0x0/0x142 @ 1
> [    0.206028] initcall net_dev_init+0x0/0x142 returned 0 after 0 usecs
> [    0.206075] calling  neigh_init+0x0/0x66 @ 1
> [    0.206164] initcall neigh_init+0x0/0x66 returned 0 after 0 usecs
> [    0.206256] calling  fib_rules_init+0x0/0x99 @ 1
> [    0.206346] initcall fib_rules_init+0x0/0x99 returned 0 after 0 usecs
> [    0.206439] calling  pktsched_init+0x0/0xa9 @ 1
> [    0.206530] initcall pktsched_init+0x0/0xa9 returned 0 after 0 usecs
> [    0.206622] calling  tc_filter_init+0x0/0x43 @ 1
> [    0.206712] initcall tc_filter_init+0x0/0x43 returned 0 after 0 usecs
> [    0.206804] calling  tc_action_init+0x0/0x43 @ 1
> [    0.206972] initcall tc_action_init+0x0/0x43 returned 0 after 0 usecs
> [    0.207065] calling  genl_init+0x0/0xb0 @ 1
> [    0.208976] initcall genl_init+0x0/0xb0 returned 0 after 1952 usecs
> [    0.209068] calling  cipso_v4_init+0x0/0x52 @ 1
> [    0.209159] initcall cipso_v4_init+0x0/0x52 returned 0 after 0 usecs
> [    0.209250] calling  wireless_nlevent_init+0x0/0x2f @ 1
> [    0.209341] initcall wireless_nlevent_init+0x0/0x2f returned 0 after 0 usecs
> [    0.209436] calling  cfg80211_init+0x0/0x64 @ 1
> [    0.219994] cfg80211: Using static regulatory domain info
> [    0.220082] cfg80211: Regulatory domain: US
> [    0.220169] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
> [    0.220298] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
> [    0.220391] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
> [    0.220485] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
> [    0.220577] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
> [    0.220669] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
> [    0.220762] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
> [    0.220858] cfg80211: Calling CRDA for country: US
> [    0.220985] initcall cfg80211_init+0x0/0x64 returned 0 after 11716 usecs
> [    0.221068] calling  ieee80211_init+0x0/0xa @ 1
> [    0.221158] initcall ieee80211_init+0x0/0xa returned 0 after 0 usecs
> [    0.221250] calling  netlbl_init+0x0/0x6d @ 1
> [    0.221336] NetLabel: Initializing
> [    0.221421] NetLabel:  domain hash size = 128
> [    0.221508] NetLabel:  protocols = UNLABELED CIPSOv4
> [    0.221610] NetLabel:  unlabeled traffic allowed by default
> [    0.221702] initcall netlbl_init+0x0/0x6d returned 0 after 0 usecs
> [    0.221793] calling  rfkill_init+0x0/0x75 @ 1
> [    0.222006] initcall rfkill_init+0x0/0x75 returned 0 after 976 usecs
> [    0.222087] calling  sysctl_init+0x0/0x3b @ 1
> [    0.222175] initcall sysctl_init+0x0/0x3b returned 0 after 0 usecs
> [    0.222267] calling  pci_iommu_init+0x0/0xc @ 1
> [    0.222356] initcall pci_iommu_init+0x0/0xc returned 0 after 0 usecs
> [    0.222449] calling  print_all_ICs+0x0/0x441 @ 1
> [    0.222538] 
> [    0.222539] printing PIC contents
> [    0.222707] ... PIC  IMR: ffff
> [    0.222795] ... PIC  IRR: 0800
> [    0.222888] ... PIC  ISR: 0000
> [    0.222972] ... PIC ELCR: 0800
> [    0.223058] printing local APIC contents on CPU#0/0:
> [    0.223146] ... APIC ID:      00000000 (0)
> [    0.223233] ... APIC VERSION: 00050014
> [    0.223318] ... APIC TASKPRI: 00000000 (00)
> [    0.223406] ... APIC PROCPRI: 00000000
> [    0.223491] ... APIC LDR: 01000000
> [    0.223576] ... APIC DFR: ffffffff
> [    0.223661] ... APIC SPIV: 000001ff
> [    0.223747] ... APIC ISR field:
> [    0.223832] 0000000000000000000000000000000000000000000000000000000000000000
> [    0.223965] ... APIC TMR field:
> [    0.223965] 0000000002000000000000000000000000000000000000000000000000000000
> [    0.223965] ... APIC IRR field:
> [    0.223965] 0000000000000000000000000000000000000000000000000000000000008000
> [    0.223965] ... APIC ESR: 00000000
> [    0.223965] ... APIC ICR: 000008fb
> [    0.223965] ... APIC ICR2: 02000000
> [    0.223965] ... APIC LVTT: 000200ef
> [    0.223965] ... APIC LVTPC: 00010000
> [    0.223965] ... APIC LVT0: 00010700
> [    0.223965] ... APIC LVT1: 00000400
> [    0.223965] ... APIC LVTERR: 000000fe
> [    0.223965] ... APIC TMICT: 00002896
> [    0.223965] ... APIC TMCCT: 000021a7
> [    0.223965] ... APIC TDCR: 00000003
> [    0.223965] 
> [    0.223577] printing local APIC contents on CPU#1/1:
> [    0.223668] ... APIC ID:      01000000 (1)
> [    0.223754] ... APIC VERSION: 00050014
> [    0.223840] ... APIC TASKPRI: 00000000 (00)
> [    0.223928] ... APIC PROCPRI: 00000000
> [    0.223965] ... APIC LDR: 02000000
> [    0.223965] ... APIC DFR: ffffffff
> [    0.223965] ... APIC SPIV: 000001ff
> [    0.223965] ... APIC ISR field:
> [    0.223965] 0000000000000000000000000000000000000000000000000000000000000000
> [    0.223965] ... APIC TMR field:
> [    0.223965] 0000000000000000000000000000000000000000000000000000000000000000
> [    0.223965] ... APIC IRR field:
> [    0.223965] 0000000000000000000000000000000000000000000000000000000000008000
> [    0.223965] ... APIC ESR: 00000000
> [    0.223965] ... APIC ICR: 000008fd
> [    0.223965] ... APIC ICR2: 01000000
> [    0.223965] ... APIC LVTT: 000200ef
> [    0.223965] ... APIC LVTPC: 00010000
> [    0.223965] ... APIC LVT0: 00010700
> [    0.223965] ... APIC LVT1: 00010400
> [    0.223965] ... APIC LVTERR: 000000fe
> [    0.223965] ... APIC TMICT: 00002896
> [    0.223965] ... APIC TMCCT: 00000f04
> [    0.223965] ... APIC TDCR: 00000003
> [    0.223965] 
> [    0.227664] number of MP IRQ sources: 15.
> [    0.227752] number of IO-APIC #1 registers: 24.
> [    0.227839] testing the IO APIC.......................
> [    0.227933] 
> [    0.227967] IO APIC #1......
> [    0.228050] .... register #00: 02000000
> [    0.228136] .......    : physical APIC id: 02
> [    0.228223] .......    : Delivery Type: 0
> [    0.228309] .......    : LTS          : 0
> [    0.228396] .... register #01: 00170020
> [    0.228482] .......     : max redirection entries: 0017
> [    0.228570] .......     : PRQ implemented: 0
> [    0.228656] .......     : IO APIC version: 0020
> [    0.228743] .... IRQ redirection table:
> [    0.228966]  NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:   
> [    0.229059]  00 000 1    0    0   0   0    0    0    00
> [    0.229195]  01 003 0    0    0   0   0    1    1    31
> [    0.229970]  02 003 0    0    0   0   0    1    1    30
> [    0.230105]  03 003 0    0    0   0   0    1    1    33
> [    0.230241]  04 003 0    0    0   0   0    1    1    34
> [    0.230377]  05 003 0    0    0   0   0    1    1    35
> [    0.230514]  06 003 0    0    0   0   0    1    1    36
> [    0.230650]  07 003 0    0    0   0   0    1    1    37
> [    0.230787]  08 003 0    0    0   0   0    1    1    38
> [    0.230967]  09 003 0    1    0   0   0    1    1    39
> [    0.231103]  0a 003 0    0    0   0   0    1    1    3A
> [    0.231239]  0b 003 0    0    0   0   0    1    1    3B
> [    0.231375]  0c 003 0    0    0   0   0    1    1    3C
> [    0.231511]  0d 003 0    0    0   0   0    1    1    3D
> [    0.231646]  0e 003 0    0    0   0   0    1    1    3E
> [    0.231782]  0f 003 0    0    0   0   0    1    1    3F
> [    0.231918]  10 000 1    0    0   0   0    0    0    00
> [    0.232055]  11 000 1    0    0   0   0    0    0    00
> [    0.232192]  12 000 1    0    0   0   0    0    0    00
> [    0.232329]  13 000 1    0    0   0   0    0    0    00
> [    0.232465]  14 000 1    0    0   0   0    0    0    00
> [    0.232602]  15 000 1    0    0   0   0    0    0    00
> [    0.232737]  16 000 1    0    0   0   0    0    0    00
> [    0.232873]  17 000 1    0    0   0   0    0    0    00
> [    0.232966] IRQ to pin mappings:
> [    0.233051] IRQ0 -> 0:2
> [    0.233219] IRQ1 -> 0:1
> [    0.233389] IRQ3 -> 0:3
> [    0.233559] IRQ4 -> 0:4
> [    0.233729] IRQ5 -> 0:5
> [    0.233897] IRQ6 -> 0:6
> [    0.234088] IRQ7 -> 0:7
> [    0.234258] IRQ8 -> 0:8
> [    0.234426] IRQ9 -> 0:9
> [    0.234596] IRQ10 -> 0:10
> [    0.234765] IRQ11 -> 0:11
> [    0.234933] IRQ12 -> 0:12
> [    0.235087] IRQ13 -> 0:13
> [    0.235256] IRQ14 -> 0:14
> [    0.235426] IRQ15 -> 0:15
> [    0.235599] .................................... done.
> [    0.235690] initcall print_all_ICs+0x0/0x441 returned 0 after 12693 usecs
> [    0.235783] calling  hpet_late_init+0x0/0x183 @ 1
> [    0.235877] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
> [    0.236179] hpet0: 3 comparators, 64-bit 14.318180 MHz counter
> [    0.238971] initcall hpet_late_init+0x0/0x183 returned 0 after 3905 usecs
> [    0.239062] calling  clocksource_done_booting+0x0/0x11 @ 1
> [    0.239968] initcall clocksource_done_booting+0x0/0x11 returned 0 after 0 usecs
> [    0.240097] calling  rb_init_debugfs+0x0/0x27 @ 1
> [    0.240191] initcall rb_init_debugfs+0x0/0x27 returned 0 after 0 usecs
> [    0.240283] calling  tracer_init_debugfs+0x0/0x26b @ 1
> [    0.240459] initcall tracer_init_debugfs+0x0/0x26b returned 0 after 0 usecs
> [    0.240553] calling  init_trace_printk_function_export+0x0/0x2a @ 1
> [    0.240647] initcall init_trace_printk_function_export+0x0/0x2a returned 0 after 0 usecs
> [    0.240776] calling  event_trace_init+0x0/0x17e @ 1
> [    0.240979] Switched to high resolution mode on CPU 0
> [    0.241783] Switched to high resolution mode on CPU 1
> [    0.242167] initcall event_trace_init+0x0/0x17e returned 0 after 2148 usecs
> [    0.242265] calling  init_pipe_fs+0x0/0x41 @ 1
> [    0.242366] initcall init_pipe_fs+0x0/0x41 returned 0 after 11 usecs
> [    0.242459] calling  eventpoll_init+0x0/0xac @ 1
> [    0.242554] initcall eventpoll_init+0x0/0xac returned 0 after 5 usecs
> [    0.242647] calling  anon_inode_init+0x0/0xed @ 1
> [    0.242744] initcall anon_inode_init+0x0/0xed returned 0 after 6 usecs
> [    0.242836] calling  blk_scsi_ioctl_init+0x0/0x288 @ 1
> [    0.242929] initcall blk_scsi_ioctl_init+0x0/0x288 returned 0 after 1 usecs
> [    0.243031] calling  acpi_event_init+0x0/0x6f @ 1
> [    0.246021] initcall acpi_event_init+0x0/0x6f returned 0 after 2830 usecs
> [    0.246114] calling  pnpacpi_init+0x0/0x7b @ 1
> [    0.246202] pnp: PnP ACPI init
> [    0.246298] ACPI: bus type pnp registered
> [    0.248505] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
> [    0.248733] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
> [    0.248956] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
> [    0.249185] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
> [    0.250518] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
> [    0.253081] pnp: PnP ACPI: found 11 devices
> [    0.253168] ACPI: ACPI bus type pnp unregistered
> [    0.253266] initcall pnpacpi_init+0x0/0x7b returned 0 after 6895 usecs
> [    0.253359] calling  pnp_system_init+0x0/0xf @ 1
> [    0.253456] system 00:00: iomem range 0x0-0x9ffff could not be reserved
> [    0.253548] system 00:00: iomem range 0xc0000-0xc3fff could not be reserved
> [    0.253641] system 00:00: iomem range 0xc4000-0xc7fff could not be reserved
> [    0.253735] system 00:00: iomem range 0xc8000-0xcbfff has been reserved
> [    0.253828] system 00:00: iomem range 0xcc000-0xcffff could not be reserved
> [    0.253921] system 00:00: iomem range 0xd0000-0xd3fff could not be reserved
> [    0.254025] system 00:00: iomem range 0xdc000-0xdffff could not be reserved
> [    0.254118] system 00:00: iomem range 0xe0000-0xe3fff could not be reserved
> [    0.254211] system 00:00: iomem range 0xe4000-0xe7fff could not be reserved
> [    0.254313] system 00:00: iomem range 0xe8000-0xebfff could not be reserved
> [    0.254406] system 00:00: iomem range 0xec000-0xeffff could not be reserved
> [    0.254499] system 00:00: iomem range 0xf0000-0xfffff could not be reserved
> [    0.254592] system 00:00: iomem range 0x100000-0x7fffffff could not be reserved
> [    0.254723] system 00:00: iomem range 0xfec00000-0xffffffff could not be reserved
> [    0.254859] system 00:02: ioport range 0x164e-0x164f has been reserved
> [    0.254952] system 00:02: ioport range 0x1000-0x107f has been reserved
> [    0.255050] system 00:02: ioport range 0x1180-0x11bf has been reserved
> [    0.255143] system 00:02: ioport range 0x800-0x80f has been reserved
> [    0.255235] system 00:02: ioport range 0x15e0-0x15ef has been reserved
> [    0.255334] system 00:02: ioport range 0x1600-0x165f could not be reserved
> [    0.255428] system 00:02: iomem range 0xf0000000-0xf3ffffff has been reserved
> [    0.255522] system 00:02: iomem range 0xfed1c000-0xfed1ffff has been reserved
> [    0.255616] system 00:02: iomem range 0xfed14000-0xfed17fff has been reserved
> [    0.255710] system 00:02: iomem range 0xfed18000-0xfed18fff has been reserved
> [    0.255804] system 00:02: iomem range 0xfed19000-0xfed19fff has been reserved
> [    0.255954] initcall pnp_system_init+0x0/0xf returned 0 after 2446 usecs
> [    0.256056] calling  chr_dev_init+0x0/0x8d @ 1
> [    0.256797] initcall chr_dev_init+0x0/0x8d returned 0 after 636 usecs
> [    0.256891] calling  firmware_class_init+0x0/0x61 @ 1
> [    0.257046] initcall firmware_class_init+0x0/0x61 returned 0 after 62 usecs
> [    0.257140] calling  init_pcmcia_bus+0x0/0x62 @ 1
> [    0.257308] initcall init_pcmcia_bus+0x0/0x62 returned 0 after 75 usecs
> [    0.257402] calling  cpufreq_gov_performance_init+0x0/0xf @ 1
> [    0.257497] initcall cpufreq_gov_performance_init+0x0/0xf returned 0 after 1 usecs
> [    0.257625] calling  cpufreq_gov_userspace_init+0x0/0xf @ 1
> [    0.257719] initcall cpufreq_gov_userspace_init+0x0/0xf returned 0 after 1 usecs
> [    0.257849] calling  init_acpi_pm_clocksource+0x0/0x1b5 @ 1
> [    0.292492] initcall init_acpi_pm_clocksource+0x0/0x1b5 returned 0 after 33741 usecs
> [    0.292622] calling  pcibios_assign_resources+0x0/0x66 @ 1
> [    0.292785] pci 0000:00:1c.0: PCI bridge, secondary bus 0000:02
> [    0.292876] pci 0000:00:1c.0:   IO window: 0x2000-0x2fff
> [    0.292970] pci 0000:00:1c.0:   MEM window: 0xee000000-0xee0fffff
> [    0.293076] pci 0000:00:1c.0:   PREFETCH window: disabled
> [    0.293169] pci 0000:00:1c.1: PCI bridge, secondary bus 0000:03
> [    0.293267] pci 0000:00:1c.1:   IO window: 0x3000-0x4fff
> [    0.293360] pci 0000:00:1c.1:   MEM window: 0xec000000-0xedffffff
> [    0.293453] pci 0000:00:1c.1:   PREFETCH window: 0x000000e4000000-0x000000e40fffff
> [    0.293588] pci 0000:00:1c.2: PCI bridge, secondary bus 0000:04
> [    0.293679] pci 0000:00:1c.2:   IO window: 0x5000-0x6fff
> [    0.293773] pci 0000:00:1c.2:   MEM window: 0xe8000000-0xe9ffffff
> [    0.293866] pci 0000:00:1c.2:   PREFETCH window: 0x000000e4100000-0x000000e41fffff
> [    0.294009] pci 0000:00:1c.3: PCI bridge, secondary bus 0000:0c
> [    0.294100] pci 0000:00:1c.3:   IO window: 0x7000-0x8fff
> [    0.294194] pci 0000:00:1c.3:   MEM window: 0xea000000-0xebffffff
> [    0.294293] pci 0000:00:1c.3:   PREFETCH window: 0x000000e4200000-0x000000e42fffff
> [    0.294431] pci 0000:15:00.0: CardBus bridge, secondary bus 0000:16
> [    0.294524] pci 0000:15:00.0:   IO window: 0x009000-0x0090ff
> [    0.294618] pci 0000:15:00.0:   IO window: 0x009400-0x0094ff
> [    0.294712] pci 0000:15:00.0:   PREFETCH window: 0xe0000000-0xe3ffffff
> [    0.294807] pci 0000:15:00.0:   MEM window: 0x80000000-0x83ffffff
> [    0.294902] pci 0000:00:1e.0: PCI bridge, secondary bus 0000:15
> [    0.294994] pci 0000:00:1e.0:   IO window: 0x9000-0xcfff
> [    0.295094] pci 0000:00:1e.0:   MEM window: 0xe4300000-0xe7ffffff
> [    0.295188] pci 0000:00:1e.0:   PREFETCH window: 0x000000e0000000-0x000000e3ffffff
> [    0.295338]   alloc irq_desc for 20 on node -1
> [    0.295425]   alloc kstat_irqs on node -1
> [    0.295514] IOAPIC[0]: Set routing entry (1-20 -> 0x49 -> IRQ 20 Mode:1 Active:1)
> [    0.295645] pci 0000:00:1c.0: PCI INT A -> GSI 20 (level, low) -> IRQ 20
> [    0.295741] pci 0000:00:1c.0: setting latency timer to 64
> [    0.295836]   alloc irq_desc for 21 on node -1
> [    0.295923]   alloc kstat_irqs on node -1
> [    0.296019] IOAPIC[0]: Set routing entry (1-21 -> 0x51 -> IRQ 21 Mode:1 Active:1)
> [    0.296149] pci 0000:00:1c.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21
> [    0.296243] pci 0000:00:1c.1: setting latency timer to 64
> [    0.296347]   alloc irq_desc for 22 on node -1
> [    0.296435]   alloc kstat_irqs on node -1
> [    0.296522] IOAPIC[0]: Set routing entry (1-22 -> 0x59 -> IRQ 22 Mode:1 Active:1)
> [    0.296651] pci 0000:00:1c.2: PCI INT C -> GSI 22 (level, low) -> IRQ 22
> [    0.296747] pci 0000:00:1c.2: setting latency timer to 64
> [    0.296843]   alloc irq_desc for 23 on node -1
> [    0.297013]   alloc kstat_irqs on node -1
> [    0.297803] IOAPIC[0]: Set routing entry (1-23 -> 0x61 -> IRQ 23 Mode:1 Active:1)
> [    0.297933] pci 0000:00:1c.3: PCI INT D -> GSI 23 (level, low) -> IRQ 23
> [    0.298033] pci 0000:00:1c.3: setting latency timer to 64
> [    0.298126] pci 0000:00:1e.0: enabling device (0005 -> 0007)
> [    0.298219] pci 0000:00:1e.0: setting latency timer to 64
> [    0.298326]   alloc irq_desc for 16 on node -1
> [    0.298413]   alloc kstat_irqs on node -1
> [    0.298501] IOAPIC[0]: Set routing entry (1-16 -> 0x69 -> IRQ 16 Mode:1 Active:1)
> [    0.298631] pci 0000:15:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [    0.298729] pci_bus 0000:00: resource 0 io:  [0x00-0xffff]
> [    0.298819] pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffff]
> [    0.298910] pci_bus 0000:02: resource 0 io:  [0x2000-0x2fff]
> [    0.299000] pci_bus 0000:02: resource 1 mem: [0xee000000-0xee0fffff]
> [    0.299099] pci_bus 0000:03: resource 0 io:  [0x3000-0x4fff]
> [    0.299189] pci_bus 0000:03: resource 1 mem: [0xec000000-0xedffffff]
> [    0.299287] pci_bus 0000:03: resource 2 pref mem [0xe4000000-0xe40fffff]
> [    0.299380] pci_bus 0000:04: resource 0 io:  [0x5000-0x6fff]
> [    0.299471] pci_bus 0000:04: resource 1 mem: [0xe8000000-0xe9ffffff]
> [    0.299563] pci_bus 0000:04: resource 2 pref mem [0xe4100000-0xe41fffff]
> [    0.299655] pci_bus 0000:0c: resource 0 io:  [0x7000-0x8fff]
> [    0.299745] pci_bus 0000:0c: resource 1 mem: [0xea000000-0xebffffff]
> [    0.299837] pci_bus 0000:0c: resource 2 pref mem [0xe4200000-0xe42fffff]
> [    0.299929] pci_bus 0000:15: resource 0 io:  [0x9000-0xcfff]
> [    0.300026] pci_bus 0000:15: resource 1 mem: [0xe4300000-0xe7ffffff]
> [    0.300117] pci_bus 0000:15: resource 2 pref mem [0xe0000000-0xe3ffffff]
> [    0.300210] pci_bus 0000:15: resource 3 io:  [0x00-0xffff]
> [    0.300309] pci_bus 0000:15: resource 4 mem: [0x000000-0xffffffff]
> [    0.300400] pci_bus 0000:16: resource 0 io:  [0x9000-0x90ff]
> [    0.300491] pci_bus 0000:16: resource 1 io:  [0x9400-0x94ff]
> [    0.300581] pci_bus 0000:16: resource 2 pref mem [0xe0000000-0xe3ffffff]
> [    0.300673] pci_bus 0000:16: resource 3 mem: [0x80000000-0x83ffffff]
> [    0.300767] initcall pcibios_assign_resources+0x0/0x66 returned 0 after 7864 usecs
> [    0.300897] calling  sysctl_core_init+0x0/0x2d @ 1
> [    0.301023] initcall sysctl_core_init+0x0/0x2d returned 0 after 33 usecs
> [    0.301115] calling  inet_init+0x0/0x1c3 @ 1
> [    0.301213] NET: Registered protocol family 2
> [    0.301404] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
> [    0.301831] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
> [    0.302659] TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
> [    0.303110] TCP: Hash tables configured (established 131072 bind 65536)
> [    0.303202] TCP reno registered
> [    0.303404] initcall inet_init+0x0/0x1c3 returned 0 after 2142 usecs
> [    0.303499] calling  af_unix_init+0x0/0x47 @ 1
> [    0.303589] NET: Registered protocol family 1
> [    0.303688] initcall af_unix_init+0x0/0x47 returned 0 after 97 usecs
> [    0.303781] calling  populate_rootfs+0x0/0x1ea @ 1
> [    0.303938] initcall populate_rootfs+0x0/0x1ea returned 0 after 63 usecs
> [    0.304045] calling  i8259A_init_sysfs+0x0/0x1d @ 1
> [    0.304311] initcall i8259A_init_sysfs+0x0/0x1d returned 0 after 169 usecs
> [    0.304404] calling  sbf_init+0x0/0xc0 @ 1
> [    0.304495] Simple Boot Flag at 0x35 set to 0x1
> [    0.304589] initcall sbf_init+0x0/0xc0 returned 0 after 93 usecs
> [    0.304681] calling  i8237A_init_sysfs+0x0/0x1d @ 1
> [    0.304886] initcall i8237A_init_sysfs+0x0/0x1d returned 0 after 111 usecs
> [    0.304980] calling  add_rtc_cmos+0x0/0x7e @ 1
> [    0.305095] initcall add_rtc_cmos+0x0/0x7e returned 0 after 5 usecs
> [    0.305188] calling  cache_sysfs_init+0x0/0x4b @ 1
> [    0.305753] initcall cache_sysfs_init+0x0/0x4b returned 0 after 457 usecs
> [    0.305847] calling  mce_init_device+0x0/0xc1 @ 1
> [    0.306201] initcall mce_init_device+0x0/0xc1 returned 0 after 257 usecs
> [    0.306305] calling  threshold_init_device+0x0/0x3a @ 1
> [    0.306398] initcall threshold_init_device+0x0/0x3a returned 0 after 1 usecs
> [    0.306492] calling  thermal_throttle_init_device+0x0/0x77 @ 1
> [    0.306590] initcall thermal_throttle_init_device+0x0/0x77 returned 0 after 5 usecs
> [    0.306720] calling  msr_init+0x0/0xda @ 1
> [    0.307020] initcall msr_init+0x0/0xda returned 0 after 189 usecs
> [    0.307111] calling  cpuid_init+0x0/0xda @ 1
> [    0.307389] initcall cpuid_init+0x0/0xda returned 0 after 181 usecs
> [    0.307482] calling  ioapic_init_sysfs+0x0/0x84 @ 1
> [    0.307679] initcall ioapic_init_sysfs+0x0/0x84 returned 0 after 104 usecs
> [    0.307772] calling  add_pcspkr+0x0/0x24 @ 1
> [    0.307929] initcall add_pcspkr+0x0/0x24 returned 0 after 65 usecs
> [    0.308034] calling  microcode_init+0x0/0xf2 @ 1
> [    0.308192] microcode: CPU0 sig=0x6e8, pf=0x20, revision=0x39
> [    0.308297] microcode: CPU1 sig=0x6e8, pf=0x20, revision=0x39
> [    0.308450] Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
> [    0.308583] initcall microcode_init+0x0/0xf2 returned 0 after 447 usecs
> [    0.308678] calling  start_periodic_check_for_corruption+0x0/0x32 @ 1
> [    0.308770] Scanning for low memory corruption every 60 seconds
> [    0.308864] initcall start_periodic_check_for_corruption+0x0/0x32 returned 0 after 91 usecs
> [    0.308996] calling  aes_init+0x0/0xf @ 1
> [    0.309202] initcall aes_init+0x0/0xf returned 0 after 90 usecs
> [    0.309304] calling  proc_schedstat_init+0x0/0x1c @ 1
> [    0.309401] initcall proc_schedstat_init+0x0/0x1c returned 0 after 6 usecs
> [    0.309495] calling  proc_execdomains_init+0x0/0x1c @ 1
> [    0.309588] initcall proc_execdomains_init+0x0/0x1c returned 0 after 2 usecs
> [    0.309681] calling  ioresources_init+0x0/0x2d @ 1
> [    0.309775] initcall ioresources_init+0x0/0x2d returned 0 after 3 usecs
> [    0.309867] calling  uid_cache_init+0x0/0x5b @ 1
> [    0.309963] initcall uid_cache_init+0x0/0x5b returned 0 after 5 usecs
> [    0.310078] calling  init_posix_timers+0x0/0xb3 @ 1
> [    0.310174] initcall init_posix_timers+0x0/0xb3 returned 0 after 5 usecs
> [    0.310274] calling  init_posix_cpu_timers+0x0/0xba @ 1
> [    0.310367] initcall init_posix_cpu_timers+0x0/0xba returned 0 after 1 usecs
> [    0.310460] calling  nsproxy_cache_init+0x0/0x27 @ 1
> [    0.310553] initcall nsproxy_cache_init+0x0/0x27 returned 0 after 1 usecs
> [    0.310647] calling  create_proc_profile+0x0/0x16f @ 1
> [    0.310749] initcall create_proc_profile+0x0/0x16f returned 0 after 9 usecs
> [    0.310843] calling  timekeeping_init_device+0x0/0x1d @ 1
> [    0.311038] initcall timekeeping_init_device+0x0/0x1d returned 0 after 100 usecs
> [    0.311170] calling  init_clocksource_sysfs+0x0/0x43 @ 1
> [    0.311377] initcall init_clocksource_sysfs+0x0/0x43 returned 0 after 106 usecs
> [    0.311508] calling  init_timer_list_procfs+0x0/0x27 @ 1
> [    0.311602] initcall init_timer_list_procfs+0x0/0x27 returned 0 after 2 usecs
> [    0.311695] calling  init_tstats_procfs+0x0/0x27 @ 1
> [    0.311789] initcall init_tstats_procfs+0x0/0x27 returned 0 after 2 usecs
> [    0.311881] calling  futex_init+0x0/0x65 @ 1
> [    0.311979] initcall futex_init+0x0/0x65 returned 0 after 8 usecs
> [    0.312086] calling  proc_dma_init+0x0/0x1c @ 1
> [    0.312179] initcall proc_dma_init+0x0/0x1c returned 0 after 2 usecs
> [    0.312277] calling  proc_modules_init+0x0/0x1c @ 1
> [    0.312370] initcall proc_modules_init+0x0/0x1c returned 0 after 2 usecs
> [    0.312462] calling  kallsyms_init+0x0/0x1f @ 1
> [    0.312553] initcall kallsyms_init+0x0/0x1f returned 0 after 2 usecs
> [    0.312646] calling  snapshot_device_init+0x0/0xf @ 1
> [    0.312801] initcall snapshot_device_init+0x0/0xf returned 0 after 61 usecs
> [    0.312895] calling  crash_save_vmcoreinfo_init+0x0/0x348 @ 1
> [    0.313023] initcall crash_save_vmcoreinfo_init+0x0/0x348 returned 0 after 34 usecs
> [    0.313153] calling  crash_notes_memory_init+0x0/0x31 @ 1
> [    0.313247] initcall crash_notes_memory_init+0x0/0x31 returned 0 after 3 usecs
> [    0.313384] calling  pid_namespaces_init+0x0/0x27 @ 1
> [    0.313477] initcall pid_namespaces_init+0x0/0x27 returned 0 after 2 usecs
> [    0.313570] calling  audit_init+0x0/0xd2 @ 1
> [    0.313657] audit: initializing netlink socket (disabled)
> [    0.313756] type=2000 audit(1249815910.313:1): initialized
> [    0.313848] initcall audit_init+0x0/0xd2 returned 0 after 186 usecs
> [    0.313941] calling  audit_tree_init+0x0/0x3b @ 1
> [    0.314048] initcall audit_tree_init+0x0/0x3b returned 0 after 3 usecs
> [    0.314140] calling  init_kprobes+0x0/0x11c @ 1
> [    0.324102] initcall init_kprobes+0x0/0x11c returned 0 after 9640 usecs
> [    0.324195] calling  utsname_sysctl_init+0x0/0x11 @ 1
> [    0.324314] initcall utsname_sysctl_init+0x0/0x11 returned 0 after 22 usecs
> [    0.324409] calling  init_markers+0x0/0xf @ 1
> [    0.324499] initcall init_markers+0x0/0xf returned 0 after 1 usecs
> [    0.324591] calling  init_tracepoints+0x0/0xf @ 1
> [    0.324683] initcall init_tracepoints+0x0/0xf returned 0 after 1 usecs
> [    0.324774] calling  init_events+0x0/0x5a @ 1
> [    0.324867] initcall init_events+0x0/0x5a returned 0 after 2 usecs
> [    0.324958] calling  init_sched_switch_trace+0x0/0xf @ 1
> [    0.325059] initcall init_sched_switch_trace+0x0/0xf returned 0 after 2 usecs
> [    0.325152] calling  init_blk_tracer+0x0/0x4b @ 1
> [    0.325243] initcall init_blk_tracer+0x0/0x4b returned 0 after 1 usecs
> [    0.325343] calling  perf_counter_sysfs_init+0x0/0x14 @ 1
> [    0.325439] initcall perf_counter_sysfs_init+0x0/0x14 returned 0 after 4 usecs
> [    0.325569] calling  init_per_zone_wmark_min+0x0/0x59 @ 1
> [    0.325746] initcall init_per_zone_wmark_min+0x0/0x59 returned 0 after 83 usecs
> [    0.325877] calling  pdflush_init+0x0/0x20 @ 1
> [    0.326037] initcall pdflush_init+0x0/0x20 returned 0 after 68 usecs
> [    0.326131] calling  kswapd_init+0x0/0x1d @ 1
> [    0.326255] initcall kswapd_init+0x0/0x1d returned 0 after 33 usecs
> [    0.326350] calling  init_tmpfs+0x0/0xb9 @ 1
> [    0.326466] initcall init_tmpfs+0x0/0xb9 returned 0 after 26 usecs
> [    0.326558] calling  setup_vmstat+0x0/0x9a @ 1
> [    0.326658] initcall setup_vmstat+0x0/0x9a returned 0 after 9 usecs
> [    0.326751] calling  mm_sysfs_init+0x0/0x22 @ 1
> [    0.326844] initcall mm_sysfs_init+0x0/0x22 returned 0 after 4 usecs
> [    0.326936] calling  proc_vmalloc_init+0x0/0x1f @ 1
> [    0.327037] initcall proc_vmalloc_init+0x0/0x1f returned 0 after 2 usecs
> [    0.327131] calling  init_emergency_pool+0x0/0x57 @ 1
> [    0.327243] highmem bounce pool size: 64 pages
> [    0.327340] initcall init_emergency_pool+0x0/0x57 returned 0 after 115 usecs
> [    0.327433] calling  procswaps_init+0x0/0x1c @ 1
> [    0.327527] initcall procswaps_init+0x0/0x1c returned 0 after 2 usecs
> [    0.327619] calling  hugetlb_init+0x0/0x230 @ 1
> [    0.327709] HugeTLB registered 4 MB page size, pre-allocated 0 pages
> [    0.327811] initcall hugetlb_init+0x0/0x230 returned 0 after 99 usecs
> [    0.328692] calling  slab_proc_init+0x0/0x1f @ 1
> [    0.328784] initcall slab_proc_init+0x0/0x1f returned 0 after 2 usecs
> [    0.328876] calling  slab_sysfs_init+0x0/0xb7 @ 1
> [    0.333074] initcall slab_sysfs_init+0x0/0xb7 returned 0 after 4008 usecs
> [    0.333169] calling  fasync_init+0x0/0x24 @ 1
> [    0.333268] initcall fasync_init+0x0/0x24 returned 0 after 6 usecs
> [    0.333360] calling  proc_filesystems_init+0x0/0x1c @ 1
> [    0.333455] initcall proc_filesystems_init+0x0/0x1c returned 0 after 3 usecs
> [    0.333548] calling  dnotify_init+0x0/0x6f @ 1
> [    0.333649] initcall dnotify_init+0x0/0x6f returned 0 after 10 usecs
> [    0.333741] calling  inotify_setup+0x0/0x11 @ 1
> [    0.333833] initcall inotify_setup+0x0/0x11 returned 0 after 1 usecs
> [    0.333925] calling  inotify_user_setup+0x0/0x9e @ 1
> [    0.334044] initcall inotify_user_setup+0x0/0x9e returned 0 after 20 usecs
> [    0.334138] calling  aio_setup+0x0/0x60 @ 1
> [    0.334295] initcall aio_setup+0x0/0x60 returned 0 after 65 usecs
> [    0.334389] calling  proc_locks_init+0x0/0x1c @ 1
> [    0.334483] initcall proc_locks_init+0x0/0x1c returned 0 after 2 usecs
> [    0.334575] calling  init_mbcache+0x0/0x11 @ 1
> [    0.334665] initcall init_mbcache+0x0/0x11 returned 0 after 1 usecs
> [    0.334757] calling  dquot_init+0x0/0xdd @ 1
> [    0.334845] VFS: Disk quotas dquot_6.5.2
> [    0.335056] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
> [    0.335156] initcall dquot_init+0x0/0xdd returned 0 after 301 usecs
> [    0.335249] calling  init_v2_quota_format+0x0/0xf @ 1
> [    0.335349] initcall init_v2_quota_format+0x0/0xf returned 0 after 1 usecs
> [    0.335442] calling  proc_cmdline_init+0x0/0x1c @ 1
> [    0.335535] initcall proc_cmdline_init+0x0/0x1c returned 0 after 2 usecs
> [    0.335629] calling  proc_cpuinfo_init+0x0/0x1c @ 1
> [    0.335723] initcall proc_cpuinfo_init+0x0/0x1c returned 0 after 2 usecs
> [    0.335815] calling  proc_devices_init+0x0/0x1c @ 1
> [    0.335909] initcall proc_devices_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336010] calling  proc_interrupts_init+0x0/0x1c @ 1
> [    0.336103] initcall proc_interrupts_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336197] calling  proc_loadavg_init+0x0/0x1c @ 1
> [    0.336297] initcall proc_loadavg_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336390] calling  proc_meminfo_init+0x0/0x1c @ 1
> [    0.336483] initcall proc_meminfo_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336576] calling  proc_stat_init+0x0/0x1c @ 1
> [    0.336668] initcall proc_stat_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336759] calling  proc_uptime_init+0x0/0x1c @ 1
> [    0.336851] initcall proc_uptime_init+0x0/0x1c returned 0 after 2 usecs
> [    0.336943] calling  proc_version_init+0x0/0x1c @ 1
> [    0.337060] initcall proc_version_init+0x0/0x1c returned 0 after 2 usecs
> [    0.337152] calling  proc_softirqs_init+0x0/0x1c @ 1
> [    0.337245] initcall proc_softirqs_init+0x0/0x1c returned 0 after 2 usecs
> [    0.337347] calling  proc_kcore_init+0x0/0x40 @ 1
> [    0.337439] initcall proc_kcore_init+0x0/0x40 returned 0 after 2 usecs
> [    0.337532] calling  vmcore_init+0x0/0xa0b @ 1
> [    0.337624] initcall vmcore_init+0x0/0xa0b returned 0 after 2 usecs
> [    0.337716] calling  proc_kmsg_init+0x0/0x1f @ 1
> [    0.337808] initcall proc_kmsg_init+0x0/0x1f returned 0 after 2 usecs
> [    0.337901] calling  proc_page_init+0x0/0x33 @ 1
> [    0.337995] initcall proc_page_init+0x0/0x33 returned 0 after 3 usecs
> [    0.338093] calling  init_devpts_fs+0x0/0x41 @ 1
> [    0.338196] initcall init_devpts_fs+0x0/0x41 returned 0 after 12 usecs
> [    0.338296] calling  init_ext3_fs+0x0/0x5f @ 1
> [    0.338545] initcall init_ext3_fs+0x0/0x5f returned 0 after 154 usecs
> [    0.338636] calling  journal_init+0x0/0x85 @ 1
> [    0.338965] initcall journal_init+0x0/0x85 returned 0 after 232 usecs
> [    0.339070] calling  init_ramfs_fs+0x0/0xf @ 1
> [    0.339161] initcall init_ramfs_fs+0x0/0xf returned 0 after 2 usecs
> [    0.339254] calling  init_hugetlbfs_fs+0x0/0x84 @ 1
> [    0.339441] initcall init_hugetlbfs_fs+0x0/0x84 returned 0 after 88 usecs
> [    0.339535] calling  init_fat_fs+0x0/0x46 @ 1
> [    0.339774] initcall init_fat_fs+0x0/0x46 returned 0 after 145 usecs
> [    0.339866] calling  init_vfat_fs+0x0/0xf @ 1
> [    0.339957] initcall init_vfat_fs+0x0/0xf returned 0 after 2 usecs
> [    0.340057] calling  init_msdos_fs+0x0/0xf @ 1
> [    0.340148] initcall init_msdos_fs+0x0/0xf returned 0 after 2 usecs
> [    0.340240] calling  init_iso9660_fs+0x0/0x61 @ 1
> [    0.340422] initcall init_iso9660_fs+0x0/0x61 returned 0 after 81 usecs
> [    0.340515] calling  init_nfs_fs+0x0/0xf9 @ 1
> [    0.340839] initcall init_nfs_fs+0x0/0xf9 returned 0 after 228 usecs
> [    0.340931] calling  init_nlm+0x0/0x1c @ 1
> [    0.341054] initcall init_nlm+0x0/0x1c returned 0 after 20 usecs
> [    0.341146] calling  init_nls_cp437+0x0/0xf @ 1
> [    0.341238] initcall init_nls_cp437+0x0/0xf returned 0 after 2 usecs
> [    0.341339] calling  init_nls_ascii+0x0/0xf @ 1
> [    0.341430] initcall init_nls_ascii+0x0/0xf returned 0 after 1 usecs
> [    0.341523] calling  init_nls_iso8859_1+0x0/0xf @ 1
> [    0.341615] initcall init_nls_iso8859_1+0x0/0xf returned 0 after 1 usecs
> [    0.341707] calling  init_nls_utf8+0x0/0x1f @ 1
> [    0.341798] initcall init_nls_utf8+0x0/0x1f returned 0 after 1 usecs
> [    0.341891] calling  init_autofs4_fs+0x0/0x1e @ 1
> [    0.342055] initcall init_autofs4_fs+0x0/0x1e returned 0 after 71 usecs
> [    0.342148] calling  ipc_init+0x0/0x20 @ 1
> [    0.342239] msgmni has been set to 1725
> [    0.342337] initcall ipc_init+0x0/0x20 returned 0 after 98 usecs
> [    0.342430] calling  ipc_sysctl_init+0x0/0x11 @ 1
> [    0.342553] initcall ipc_sysctl_init+0x0/0x11 returned 0 after 32 usecs
> [    0.342647] calling  init_mqueue_fs+0x0/0x9e @ 1
> [    0.342845] initcall init_mqueue_fs+0x0/0x9e returned 0 after 104 usecs
> [    0.342938] calling  key_proc_init+0x0/0x48 @ 1
> [    0.343041] initcall key_proc_init+0x0/0x48 returned 0 after 4 usecs
> [    0.343134] calling  selinux_nf_ip_init+0x0/0x54 @ 1
> [    0.343222] SELinux:  Registering netfilter hooks
> [    0.343321] initcall selinux_nf_ip_init+0x0/0x54 returned 0 after 94 usecs
> [    0.343414] calling  init_sel_fs+0x0/0x5a @ 1
> [    0.343585] initcall init_sel_fs+0x0/0x5a returned 0 after 76 usecs
> [    0.343677] calling  selnl_init+0x0/0x46 @ 1
> [    0.343773] initcall selnl_init+0x0/0x46 returned 0 after 6 usecs
> [    0.343864] calling  sel_netif_init+0x0/0x57 @ 1
> [    0.343957] initcall sel_netif_init+0x0/0x57 returned 0 after 3 usecs
> [    0.344056] calling  sel_netnode_init+0x0/0x68 @ 1
> [    0.344149] initcall sel_netnode_init+0x0/0x68 returned 0 after 2 usecs
> [    0.344241] calling  sel_netport_init+0x0/0x68 @ 1
> [    0.344340] initcall sel_netport_init+0x0/0x68 returned 0 after 2 usecs
> [    0.344433] calling  aurule_init+0x0/0x30 @ 1
> [    0.344523] initcall aurule_init+0x0/0x30 returned 0 after 1 usecs
> [    0.344615] calling  crypto_wq_init+0x0/0x29 @ 1
> [    0.344761] initcall crypto_wq_init+0x0/0x29 returned 0 after 54 usecs
> [    0.344854] calling  crypto_algapi_init+0x0/0xc @ 1
> [    0.344947] initcall crypto_algapi_init+0x0/0xc returned 0 after 3 usecs
> [    0.345048] calling  chainiv_module_init+0x0/0xf @ 1
> [    0.345141] initcall chainiv_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.345234] calling  eseqiv_module_init+0x0/0xf @ 1
> [    0.345333] initcall eseqiv_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.345425] calling  hmac_module_init+0x0/0xf @ 1
> [    0.345517] initcall hmac_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.345609] calling  md5_mod_init+0x0/0xf @ 1
> [    0.345762] initcall md5_mod_init+0x0/0xf returned 0 after 62 usecs
> [    0.345855] calling  sha1_generic_mod_init+0x0/0xf @ 1
> [    0.345998] initcall sha1_generic_mod_init+0x0/0xf returned 0 after 50 usecs
> [    0.346100] calling  crypto_ecb_module_init+0x0/0xf @ 1
> [    0.346193] initcall crypto_ecb_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.346291] calling  crypto_cbc_module_init+0x0/0xf @ 1
> [    0.346384] initcall crypto_cbc_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.346477] calling  des_generic_mod_init+0x0/0x33 @ 1
> [    0.346690] initcall des_generic_mod_init+0x0/0x33 returned 0 after 119 usecs
> [    0.346785] calling  aes_init+0x0/0xf @ 1
> [    0.346945] initcall aes_init+0x0/0xf returned 0 after 69 usecs
> [    0.347046] calling  arc4_init+0x0/0xf @ 1
> [    0.347226] initcall arc4_init+0x0/0xf returned 0 after 88 usecs
> [    0.347324] calling  crypto_authenc_module_init+0x0/0xf @ 1
> [    0.347417] initcall crypto_authenc_module_init+0x0/0xf returned 0 after 1 usecs
> [    0.347547] calling  krng_mod_init+0x0/0xf @ 1
> [    0.347669] alg: No test for stdrng (krng)
> [    0.347767] initcall krng_mod_init+0x0/0xf returned 0 after 126 usecs
> [    0.347861] calling  proc_genhd_init+0x0/0x2d @ 1
> [    0.347956] initcall proc_genhd_init+0x0/0x2d returned 0 after 4 usecs
> [    0.348056] calling  bsg_init+0x0/0x10d @ 1
> [    0.348296] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> [    0.348427] initcall bsg_init+0x0/0x10d returned 0 after 275 usecs
> [    0.348519] calling  noop_init+0x0/0x11 @ 1
> [    0.348608] io scheduler noop registered
> [    0.348696] initcall noop_init+0x0/0x11 returned 0 after 85 usecs
> [    0.348786] calling  as_init+0x0/0x11 @ 1
> [    0.348874] io scheduler anticipatory registered
> [    0.348964] initcall as_init+0x0/0x11 returned 0 after 86 usecs
> [    0.349062] calling  deadline_init+0x0/0x11 @ 1
> [    0.349150] io scheduler deadline registered
> [    0.349239] initcall deadline_init+0x0/0x11 returned 0 after 85 usecs
> [    0.349338] calling  cfq_init+0x0/0x91 @ 1
> [    0.349515] io scheduler cfq registered (default)
> [    0.349605] initcall cfq_init+0x0/0x91 returned 0 after 173 usecs
> [    0.349696] calling  percpu_counter_startup+0x0/0x16 @ 1
> [    0.349789] initcall percpu_counter_startup+0x0/0x16 returned 0 after 1 usecs
> [    0.349882] calling  audit_classes_init+0x0/0x4f @ 1
> [    0.349978] initcall audit_classes_init+0x0/0x4f returned 0 after 4 usecs
> [    0.350079] calling  pci_init+0x0/0x2c @ 1
> [    0.350177] pci 0000:00:02.0: Boot video device
> [    0.350285] pci 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x2000
> [    0.350377] pci 0000:00:1d.0: Performing full reset
> [    0.350482] pci 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x2000
> [    0.350573] pci 0000:00:1d.1: Performing full reset
> [    0.350677] pci 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x2000
> [    0.350769] pci 0000:00:1d.2: Performing full reset
> [    0.350873] pci 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x2000
> [    0.350964] pci 0000:00:1d.3: Performing full reset
> [    0.351107] initcall pci_init+0x0/0x2c returned 0 after 917 usecs
> [    0.351199] calling  pci_proc_init+0x0/0x5b @ 1
> [    0.351347] initcall pci_proc_init+0x0/0x5b returned 0 after 49 usecs
> [    0.351440] calling  pcie_portdrv_init+0x0/0x41 @ 1
> [    0.351664]   alloc irq_desc for 24 on node -1
> [    0.351752]   alloc kstat_irqs on node -1
> [    0.351850] pcieport-driver 0000:00:1c.0: irq 24 for MSI/MSI-X
> [    0.351950] pcieport-driver 0000:00:1c.0: setting latency timer to 64
> [    0.353132]   alloc irq_desc for 25 on node -1
> [    0.353220]   alloc kstat_irqs on node -1
> [    0.353324] pcieport-driver 0000:00:1c.1: irq 25 for MSI/MSI-X
> [    0.353421] pcieport-driver 0000:00:1c.1: setting latency timer to 64
> [    0.353816]   alloc irq_desc for 26 on node -1
> [    0.353904]   alloc kstat_irqs on node -1
> [    0.353998] pcieport-driver 0000:00:1c.2: irq 26 for MSI/MSI-X
> [    0.354105] pcieport-driver 0000:00:1c.2: setting latency timer to 64
> [    0.354480]   alloc irq_desc for 27 on node -1
> [    0.354567]   alloc kstat_irqs on node -1
> [    0.354660] pcieport-driver 0000:00:1c.3: irq 27 for MSI/MSI-X
> [    0.354759] pcieport-driver 0000:00:1c.3: setting latency timer to 64
> [    0.355139] initcall pcie_portdrv_init+0x0/0x41 returned 0 after 3523 usecs
> [    0.355233] calling  aer_service_init+0x0/0x1d @ 1
> [    0.355390] initcall aer_service_init+0x0/0x1d returned 0 after 57 usecs
> [    0.355483] calling  pci_hotplug_init+0x0/0x18 @ 1
> [    0.355573] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
> [    0.355665] initcall pci_hotplug_init+0x0/0x18 returned 0 after 88 usecs
> [    0.355757] calling  fb_console_init+0x0/0xf5 @ 1
> [    0.355912] initcall fb_console_init+0x0/0xf5 returned 0 after 63 usecs
> [    0.356014] calling  genericbl_init+0x0/0xf @ 1
> [    0.356161] initcall genericbl_init+0x0/0xf returned 0 after 55 usecs
> [    0.356253] calling  efifb_init+0x0/0x1b8 @ 1
> [    0.356357] initcall efifb_init+0x0/0x1b8 returned -19 after 9 usecs
> [    0.356450] calling  acpi_reserve_resources+0x0/0xc8 @ 1
> [    0.356544] initcall acpi_reserve_resources+0x0/0xc8 returned 0 after 3 usecs
> [    0.356638] calling  irqrouter_init_sysfs+0x0/0x33 @ 1
> [    0.356829] initcall irqrouter_init_sysfs+0x0/0x33 returned 0 after 97 usecs
> [    0.356923] calling  acpi_ac_init+0x0/0x3d @ 1
> [    0.357536] ACPI: AC Adapter [AC] (on-line)
> [    0.357690] initcall acpi_ac_init+0x0/0x3d returned 0 after 643 usecs
> [    0.357785] calling  acpi_button_init+0x0/0x4a @ 1
> [    0.357978] input: Power Button as /class/input/input0
> [    0.358075] ACPI: Power Button [PWRF]
> [    0.358286] input: Lid Switch as /class/input/input1
> [    0.358958] ACPI: Lid Switch [LID]
> [    0.359153] input: Sleep Button as /class/input/input2
> [    0.359245] ACPI: Sleep Button [SLPB]
> [    0.359403] initcall acpi_button_init+0x0/0x4a returned 0 after 1490 usecs
> [    0.359496] calling  acpi_fan_init+0x0/0x4a @ 1
> [    0.359649] initcall acpi_fan_init+0x0/0x4a returned 0 after 61 usecs
> [    0.359741] calling  acpi_video_init+0x0/0x6b @ 1
> [    0.360402] input: Video Bus as /class/input/input3
> [    0.360492] ACPI: Video Device [VID] (multi-head: yes  rom: no  post: no)
> [    0.360659] initcall acpi_video_init+0x0/0x6b returned 0 after 807 usecs
> [    0.360753] calling  acpi_processor_init+0x0/0xe9 @ 1
> [    0.361333] ACPI: SSDT 7f6e609e 001ED (v01  PmRef  Cpu0Ist 00000100 INTL 20050513)
> [    0.362054] ACPI: SSDT 7f6e5de1 00238 (v01  PmRef  Cpu0Cst 00000100 INTL 20050513)
> [    0.363535] ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])
> [    0.363866] processor LNXCPU:00: registered as cooling_device0
> [    0.363960] ACPI: Processor [CPU0] (supports 8 throttling states)
> [    0.364541] ACPI: SSDT 7f6e628b 00094 (v01  PmRef  Cpu1Ist 00000100 INTL 20050513)
> [    0.365193] ACPI: SSDT 7f6e6019 00085 (v01  PmRef  Cpu1Cst 00000100 INTL 20050513)
> [    0.366681] ACPI: CPU1 (power states: C1[C1] C2[C2] C3[C3])
> [    0.367015] processor LNXCPU:01: registered as cooling_device1
> [    0.367108] ACPI: Processor [CPU1] (supports 8 throttling states)
> [    0.367390] initcall acpi_processor_init+0x0/0xe9 returned 0 after 6391 usecs
> [    0.367484] calling  acpi_container_init+0x0/0x3d @ 1
> [    0.372921] initcall acpi_container_init+0x0/0x3d returned 0 after 5219 usecs
> [    0.373026] calling  acpi_thermal_init+0x0/0x6f @ 1
> [    0.376397] thermal LNXTHERM:01: registered as thermal_zone0
> [    0.376493] ACPI: Thermal Zone [THM0] (55 C)
> [    0.378159] thermal LNXTHERM:02: registered as thermal_zone1
> [    0.378256] ACPI: Thermal Zone [THM1] (56 C)
> [    0.378400] initcall acpi_thermal_init+0x0/0x6f returned 0 after 5157 usecs
> [    0.378494] calling  acpi_battery_init+0x0/0x13 @ 1
> [    0.420206] ACPI: Battery Slot [BAT0] (battery present)
> [    0.420371] initcall acpi_battery_init+0x0/0x13 returned 0 after 40805 usecs
> [    0.420467] calling  rand_initialize+0x0/0x25 @ 1
> [    0.420582] initcall rand_initialize+0x0/0x25 returned 0 after 23 usecs
> [    0.420675] calling  tty_init+0x0/0xd5 @ 1
> [    0.425266] initcall tty_init+0x0/0xd5 returned 0 after 4393 usecs
> [    0.425361] calling  pty_init+0x0/0x20d @ 1
> [    0.425540] initcall pty_init+0x0/0x20d returned 0 after 86 usecs
> [    0.425633] calling  sysrq_init+0x0/0x1f @ 1
> [    0.425726] initcall sysrq_init+0x0/0x1f returned 0 after 4 usecs
> [    0.425818] calling  hpet_init+0x0/0x57 @ 1
> [    0.426111] initcall hpet_init+0x0/0x57 returned 0 after 197 usecs
> [    0.426202] calling  nvram_init+0x0/0x70 @ 1
> [    0.426358] Non-volatile memory driver v1.3
> [    0.426448] initcall nvram_init+0x0/0x70 returned 0 after 144 usecs
> [    0.426540] calling  mod_init+0x0/0x1ba @ 1
> [    0.426734] intel_rng: FWH not detected
> [    0.426854] initcall mod_init+0x0/0x1ba returned -19 after 219 usecs
> [    0.426948] calling  mod_init+0x0/0x9f @ 1
> [    0.427073] initcall mod_init+0x0/0x9f returned -19 after 16 usecs
> [    0.427165] calling  mod_init+0x0/0x91 @ 1
> [    0.427270] initcall mod_init+0x0/0x91 returned -19 after 15 usecs
> [    0.427362] calling  mod_init+0x0/0x41 @ 1
> [    0.427451] initcall mod_init+0x0/0x41 returned -19 after 0 usecs
> [    0.427543] calling  agp_init+0x0/0x21 @ 1
> [    0.427631] Linux agpgart interface v0.103
> [    0.427720] initcall agp_init+0x0/0x21 returned 0 after 85 usecs
> [    0.427811] calling  agp_amd64_init+0x0/0xc0 @ 1
> [    0.427970] initcall agp_amd64_init+0x0/0xc0 returned -19 after 65 usecs
> [    0.428083] calling  agp_intel_init+0x0/0x24 @ 1
> [    0.428184] agpgart-intel 0000:00:00.0: Intel 945GM Chipset
> [    0.428933] agpgart-intel 0000:00:00.0: detected 7932K stolen memory
> [    0.432042] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000
> [    0.432221] initcall agp_intel_init+0x0/0x24 returned 0 after 3948 usecs
> [    0.432324] calling  drm_core_init+0x0/0xea @ 1
> [    0.432486] [drm] Initialized drm 1.1.0 20060810
> [    0.432577] initcall drm_core_init+0x0/0xea returned 0 after 159 usecs
> [    0.432669] calling  i915_init+0x0/0x58 @ 1
> [    0.432856] pci 0000:00:02.0: power state changed by ACPI to D0
> [    0.432952] pci 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [    0.433066] pci 0000:00:02.0: setting latency timer to 64
> [    0.435959] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
> [    0.436130] initcall i915_init+0x0/0x58 returned 0 after 3288 usecs
> [    0.436223] calling  cn_proc_init+0x0/0x30 @ 1
> [    0.436325] initcall cn_proc_init+0x0/0x30 returned 0 after 3 usecs
> [    0.436416] calling  serial8250_init+0x0/0x113 @ 1
> [    0.436506] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> [    0.436900] async_waiting @ 1
> [    0.436986] async_continuing @ 1 after 1 usec
> [    0.558108] async_waiting @ 1
> [    0.558195] async_continuing @ 1 after 1 usec
> [    0.680159] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
> [    0.680516] Platform driver 'serial8250' needs updating - please use dev_pm_ops
> [    0.680720] initcall serial8250_init+0x0/0x113 returned 0 after 238488 usecs
> [    0.680814] calling  serial8250_pnp_init+0x0/0xf @ 1
> [    0.681118] initcall serial8250_pnp_init+0x0/0xf returned 0 after 208 usecs
> [    0.681212] calling  serial8250_pci_init+0x0/0x16 @ 1
> [    0.681414] initcall serial8250_pci_init+0x0/0x16 returned 0 after 99 usecs
> [    0.681510] calling  topology_sysfs_init+0x0/0x3f @ 1
> [    0.681615] initcall topology_sysfs_init+0x0/0x3f returned 0 after 14 usecs
> [    0.681709] calling  brd_init+0x0/0x14e @ 1
> [    0.684430] brd: module loaded
> [    0.684519] initcall brd_init+0x0/0x14e returned 0 after 2657 usecs
> [    0.684612] calling  loop_init+0x0/0x166 @ 1
> [    0.685961] loop: module loaded
> [    0.686059] initcall loop_init+0x0/0x166 returned 0 after 1325 usecs
> [    0.686152] calling  cpqarray_init+0x0/0x22b @ 1
> [    0.686240] Compaq SMART2 Driver (v 2.6.0)
> [    0.686452] initcall cpqarray_init+0x0/0x22b returned -19 after 204 usecs
> [    0.686546] calling  mac_hid_init+0x0/0x75 @ 1
> [    0.686729] input: Macintosh mouse button emulation as /class/input/input4
> [    0.686851] initcall mac_hid_init+0x0/0x75 returned 0 after 209 usecs
> [    0.686943] calling  spi_transport_init+0x0/0x6c @ 1
> [    0.687171] initcall spi_transport_init+0x0/0x6c returned 0 after 101 usecs
> [    0.687272] calling  ahc_linux_init+0x0/0x5c @ 1
> [    0.687446] initcall ahc_linux_init+0x0/0x5c returned 0 after 81 usecs
> [    0.687538] calling  init_sd+0x0/0xb6 @ 1
> [    0.687733] initcall init_sd+0x0/0xb6 returned 0 after 103 usecs
> [    0.687825] calling  init_sr+0x0/0x3d @ 1
> [    0.687968] initcall init_sr+0x0/0x3d returned 0 after 52 usecs
> [    0.688080] calling  init_sg+0x0/0x133 @ 1
> [    0.688234] initcall init_sg+0x0/0x133 returned 0 after 62 usecs
> [    0.688333] calling  ahci_init+0x0/0x16 @ 1
> [    0.688446] ahci 0000:00:1f.2: version 3.0
> [    0.688549] ahci 0000:00:1f.2: PCI INT B -> GSI 16 (level, low) -> IRQ 16
> [    0.688679]   alloc irq_desc for 28 on node -1
> [    0.688767]   alloc kstat_irqs on node -1
> [    0.688863] ahci 0000:00:1f.2: irq 28 for MSI/MSI-X
> [    0.689024] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 4 ports 1.5 Gbps 0x1 impl SATA mode
> [    0.689157] ahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part 
> [    0.689255] ahci 0000:00:1f.2: setting latency timer to 64
> [    0.689459] scsi0 : ahci
> [    0.689686] scsi1 : ahci
> [    0.689879] scsi2 : ahci
> [    0.690070] scsi3 : ahci
> [    0.690291] ata1: SATA max UDMA/133 abar m1024@0xee444400 port 0xee444500 irq 28
> [    0.690419] ata2: DUMMY
> [    0.690502] ata3: DUMMY
> [    0.690585] ata4: DUMMY
> [    1.250038] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> [    1.251600] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 succeeded
> [    1.251693] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 filtered out
> [    1.251785] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 filtered out
> [    1.253078] ata1.00: ATA-7: HTS541080G9SA00, MB4IC60H, max UDMA/100
> [    1.253170] ata1.00: 156301488 sectors, multi 16: LBA48 
> [    1.254937] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 succeeded
> [    1.255050] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 filtered out
> [    1.255932] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 filtered out
> [    1.257229] ata1.00: configured for UDMA/100
> [    1.270677] ata1.00: configured for UDMA/100
> [    1.270768] ata1: EH complete
> [    1.270855] async_waiting @ 1
> [    1.270941] async_continuing @ 1 after 1 usec
> [    1.271148] scsi 0:0:0:0: Direct-Access     ATA      HTS541080G9SA00  MB4I PQ: 0 ANSI: 5
> [    1.271477] sd 0:0:0:0: [sda] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
> [    1.271659] sd 0:0:0:0: [sda] Write Protect is off
> [    1.271748] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
> [    1.271864] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [    1.272142]  sda: sda1 sda2
> [    1.659535] sd 0:0:0:0: [sda] Attached SCSI disk
> [    1.659772] sd 0:0:0:0: Attached scsi generic sg0 type 0
> [    1.659958] async_waiting @ 1
> [    1.660055] async_continuing @ 1 after 1 usec
> [    1.660159] async_waiting @ 1
> [    1.660245] async_continuing @ 1 after 1 usec
> [    1.660355] async_waiting @ 1
> [    1.660442] async_continuing @ 1 after 1 usec
> [    1.660601] initcall ahci_init+0x0/0x16 returned 0 after 949390 usecs
> [    1.660693] calling  piix_init+0x0/0x27 @ 1
> [    1.660798] ata_piix 0000:00:1f.1: version 2.13
> [    1.660893] ata_piix 0000:00:1f.1: PCI INT C -> GSI 16 (level, low) -> IRQ 16
> [    1.661028] ata_piix 0000:00:1f.1: setting latency timer to 64
> [    1.661196] scsi4 : ata_piix
> [    1.661393] scsi5 : ata_piix
> [    1.662298] ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x1810 irq 14
> [    1.662391] ata6: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x1818 irq 15
> [    1.816409] ata5.00: ATAPI: HL-DT-STCD-RW/DVD DRIVE GCC-4246N, 0X05, max UDMA/33
> [    1.822317] ata5.00: configured for UDMA/33
> [    1.823055] async_waiting @ 1
> [    1.823142] async_continuing @ 1 after 1 usec
> [    1.827280] scsi 4:0:0:0: CD-ROM            HL-DT-ST RW/DVD GCC-4246N 0X05 PQ: 0 ANSI: 5
> [    1.838286] sr0: scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
> [    1.838379] Uniform CD-ROM driver Revision: 3.20
> [    1.838690] sr 4:0:0:0: Attached scsi CD-ROM sr0
> [    1.838933] sr 4:0:0:0: Attached scsi generic sg1 type 5
> [    1.839145] ata6: port disabled. ignoring.
> [    1.839241] async_waiting @ 1
> [    1.839335] async_continuing @ 1 after 1 usec
> [    1.839489] initcall piix_init+0x0/0x27 returned 0 after 174516 usecs
> [    1.839582] calling  nv_init+0x0/0x16 @ 1
> [    1.839737] initcall nv_init+0x0/0x16 returned 0 after 64 usecs
> [    1.839829] calling  amd_init+0x0/0x16 @ 1
> [    1.839979] initcall amd_init+0x0/0x16 returned 0 after 59 usecs
> [    1.840080] calling  mpiix_init+0x0/0x16 @ 1
> [    1.840230] initcall mpiix_init+0x0/0x16 returned 0 after 58 usecs
> [    1.840327] calling  oldpiix_init+0x0/0x16 @ 1
> [    1.840478] initcall oldpiix_init+0x0/0x16 returned 0 after 59 usecs
> [    1.840570] calling  sch_init+0x0/0x16 @ 1
> [    1.840719] initcall sch_init+0x0/0x16 returned 0 after 57 usecs
> [    1.840810] calling  ata_generic_init+0x0/0x16 @ 1
> [    1.840963] initcall ata_generic_init+0x0/0x16 returned 0 after 60 usecs
> [    1.841065] calling  e1000_init_module+0x0/0x6e @ 1
> [    1.841154] Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
> [    1.841246] Copyright (c) 1999-2006 Intel Corporation.
> [    1.841412] initcall e1000_init_module+0x0/0x6e returned 0 after 251 usecs
> [    1.841505] calling  e1000_init_module+0x0/0x53 @ 1
> [    1.841594] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
> [    1.841683] e1000e: Copyright (c) 1999-2008 Intel Corporation.
> [    1.841874] e1000e 0000:02:00.0: Disabling L1 ASPM
> [    1.842048] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [    1.842149] e1000e 0000:02:00.0: setting latency timer to 64
> [    1.842419]   alloc irq_desc for 29 on node -1
> [    1.842507]   alloc kstat_irqs on node -1
> [    1.842609] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
> [    1.883473] e1000e 0000:02:00.0: Warning: detected ASPM enabled in EEPROM
> [    1.925641] 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:16:41:17:49:d2
> [    1.925771] 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
> [    1.925937] 0000:02:00.0: eth0: MAC: 2, PHY: 2, PBA No: 005301-003
> [    1.926107] initcall e1000_init_module+0x0/0x53 returned 0 after 82530 usecs
> [    1.926200] calling  vortex_init+0x0/0x9b @ 1
> [    1.926364] initcall vortex_init+0x0/0x9b returned 0 after 66 usecs
> [    1.926457] calling  ne2k_pci_init+0x0/0x16 @ 1
> [    1.926608] initcall ne2k_pci_init+0x0/0x16 returned 0 after 60 usecs
> [    1.926701] calling  e100_init_module+0x0/0x4d @ 1
> [    1.926790] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
> [    1.926880] e100: Copyright(c) 1999-2006 Intel Corporation
> [    1.927046] initcall e100_init_module+0x0/0x4d returned 0 after 248 usecs
> [    1.927138] calling  tg3_init+0x0/0x16 @ 1
> [    1.927304] initcall tg3_init+0x0/0x16 returned 0 after 74 usecs
> [    1.927396] calling  bnx2_init+0x0/0x16 @ 1
> [    1.927547] initcall bnx2_init+0x0/0x16 returned 0 after 59 usecs
> [    1.927639] calling  sky2_init_module+0x0/0x20 @ 1
> [    1.927727] sky2 driver version 1.23
> [    1.927880] initcall sky2_init_module+0x0/0x20 returned 0 after 147 usecs
> [    1.927973] calling  net_olddevs_init+0x0/0x81 @ 1
> [    1.928076] initcall net_olddevs_init+0x0/0x81 returned 0 after 5 usecs
> [    1.928169] calling  init_nic+0x0/0x16 @ 1
> [    1.928328] initcall init_nic+0x0/0x16 returned 0 after 66 usecs
> [    1.928420] calling  rtl8139_init_module+0x0/0x16 @ 1
> [    1.928576] initcall rtl8139_init_module+0x0/0x16 returned 0 after 64 usecs
> [    1.928670] calling  rtl8169_init_module+0x0/0x16 @ 1
> [    1.928823] initcall rtl8169_init_module+0x0/0x16 returned 0 after 60 usecs
> [    1.928917] calling  init_ath5k_pci+0x0/0x2d @ 1
> [    1.929084] initcall init_ath5k_pci+0x0/0x2d returned 0 after 68 usecs
> [    1.929176] calling  init_netconsole+0x0/0x1a2 @ 1
> [    1.929275] netconsole: local port 4444
> [    1.929361] netconsole: local IP 10.0.1.15
> [    1.929448] netconsole: interface eth0
> [    1.929535] netconsole: remote port 4444
> [    1.929621] netconsole: remote IP 10.0.1.21
> [    1.929709] netconsole: remote ethernet address 00:30:48:c6:86:26
> [    1.929801] netconsole: device eth0 not up yet, forcing it
> [    1.943283] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
> [    1.994113] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
> [    4.659020] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
> [    4.817190] console [netcon0] enabled
> [    4.817294] netconsole: network logging started
> [    4.817394] initcall init_netconsole+0x0/0x1a2 returned 0 after 2820429 usecs
> [    4.817497] calling  cdrom_init+0x0/0xc @ 1
> [    4.817596] initcall cdrom_init+0x0/0xc returned 0 after 1 usecs
> [    4.817697] calling  nonstatic_sysfs_init+0x0/0xf @ 1
> [    4.817803] initcall nonstatic_sysfs_init+0x0/0xf returned 0 after 5 usecs
> [    4.817906] calling  yenta_socket_init+0x0/0x16 @ 1
> [    4.818039] yenta_cardbus 0000:15:00.0: CardBus bridge found [17aa:2012]
> [    4.818164] yenta_cardbus 0000:15:00.0: Using INTVAL to route CSC interrupts to PCI
> [    4.818312] yenta_cardbus 0000:15:00.0: Routing CardBus interrupts to PCI
> [    4.818417] yenta_cardbus 0000:15:00.0: TI: mfunc 0x01d01002, devctl 0x64
> [    4.919062] async_waiting @ 1
> [    4.919152] async_continuing @ 1 after 1 usec
> [    5.041827] yenta_cardbus 0000:15:00.0: ISA IRQ mask 0x0cf8, PCI irq 16
> [    5.041922] yenta_cardbus 0000:15:00.0: Socket status: 30000007
> [    5.042032] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge I/O window: 0x9000 - 0xcfff
> [    5.042173] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge Memory window: 0xe4300000 - 0xe7ffffff
> [    5.042326] yenta_cardbus 0000:15:00.0: pcmcia: parent PCI bridge Memory window: 0xe0000000 - 0xe3ffffff
> [    5.293140] initcall yenta_socket_init+0x0/0x16 returned 0 after 463995 usecs
> [    5.293235] calling  mon_init+0x0/0xe2 @ 1
> [    5.293480] initcall mon_init+0x0/0xe2 returned 0 after 131 usecs
> [    5.293574] calling  ehci_hcd_init+0x0/0xbf @ 1
> [    5.293672] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [    5.293774] ehci_hcd: block sizes: qh 128 qtd 96 itd 160 sitd 96
> [    5.294375] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
> [    5.294474]   alloc irq_desc for 19 on node -1
> [    5.294564]   alloc kstat_irqs on node -1
> [    5.294664] IOAPIC[0]: Set routing entry (1-19 -> 0xb1 -> IRQ 19 Mode:1 Active:1)
> [    5.294802] ehci_hcd 0000:00:1d.7: PCI INT D -> GSI 19 (level, low) -> IRQ 19
> [    5.294912] ehci_hcd 0000:00:1d.7: setting latency timer to 64
> [    5.295024] ehci_hcd 0000:00:1d.7: EHCI Host Controller
> [    5.295145] drivers/usb/core/inode.c: creating file 'devices'
> [    5.295247] drivers/usb/core/inode.c: creating file '001'
> [    5.295428] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1
> [    5.295566] ehci_hcd 0000:00:1d.7: reset hcs_params 0x104208 dbg=1 cc=4 pcc=2 ordered !ppc ports=8
> [    5.295707] ehci_hcd 0000:00:1d.7: reset hcc_params 6871 thresh 7 uframes 1024 64 bit addr
> [    5.295867] ehci_hcd 0000:00:1d.7: reset command 080022 (park)=0 ithresh=8 Async period=1024 Reset HALT
> [    5.299905] ehci_hcd 0000:00:1d.7: debug port 1
> [    5.300000] ehci_hcd 0000:00:1d.7: cache line size of 32 is not supported
> [    5.300108] ehci_hcd 0000:00:1d.7: supports USB remote wakeup
> [    5.300219] ehci_hcd 0000:00:1d.7: irq 19, io mem 0xee444000
> [    5.300328] ehci_hcd 0000:00:1d.7: reset command 080002 (park)=0 ithresh=8 period=1024 Reset HALT
> [    5.304353] ehci_hcd 0000:00:1d.7: init command 010001 (park)=0 ithresh=1 period=1024 RUN
> [    5.310015] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
> [    5.310158] usb usb1: default language 0x0409
> [    5.310254] usb usb1: udev 1, busnum 1, minor = 0
> [    5.310353] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
> [    5.310454] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    5.310591] usb usb1: Product: EHCI Host Controller
> [    5.310687] usb usb1: Manufacturer: Linux 2.6.31-rc5-tip ehci_hcd
> [    5.310786] usb usb1: SerialNumber: 0000:00:1d.7
> [    5.310930] usb usb1: uevent
> [    5.311098] usb usb1: usb_probe_device
> [    5.311187] usb usb1: configuration #1 chosen from 1 choice
> [    5.311297] usb usb1: adding 1-0:1.0 (config #1, interface 0)
> [    5.311412] usb 1-0:1.0: uevent
> [    5.311563] hub 1-0:1.0: usb_probe_interface
> [    5.311653] hub 1-0:1.0: usb_probe_interface - got id
> [    5.311751] hub 1-0:1.0: USB hub found
> [    5.311851] hub 1-0:1.0: 8 ports detected
> [    5.311946] hub 1-0:1.0: standalone hub
> [    5.312049] hub 1-0:1.0: no power switching (usb 1.0)
> [    5.312145] hub 1-0:1.0: individual port over-current protection
> [    5.312245] hub 1-0:1.0: power on to power good time: 20ms
> [    5.312352] hub 1-0:1.0: local power source is good
> [    5.312450] hub 1-0:1.0: trying to enable port power on non-switchable hub
> [    5.312599] drivers/usb/core/inode.c: creating file '001'
> [    5.312771] initcall ehci_hcd_init+0x0/0xbf returned 0 after 18649 usecs
> [    5.312865] calling  ohci_hcd_mod_init+0x0/0x94 @ 1
> [    5.312963] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> [    5.313070] ohci_hcd: block sizes: ed 64 td 64
> [    5.313243] initcall ohci_hcd_mod_init+0x0/0x94 returned 0 after 271 usecs
> [    5.313344] calling  uhci_hcd_init+0x0/0x10a @ 1
> [    5.313441] uhci_hcd: USB Universal Host Controller Interface driver
> [    5.314123] uhci_hcd 0000:00:1d.0: power state changed by ACPI to D0
> [    5.314220] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [    5.314334] uhci_hcd 0000:00:1d.0: setting latency timer to 64
> [    5.314433] uhci_hcd 0000:00:1d.0: UHCI Host Controller
> [    5.314535] drivers/usb/core/inode.c: creating file '002'
> [    5.314718] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2
> [    5.314853] uhci_hcd 0000:00:1d.0: detected 2 ports
> [    5.314954] uhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: cmd = 0x0000
> [    5.315062] uhci_hcd 0000:00:1d.0: Performing full reset
> [    5.315182] uhci_hcd 0000:00:1d.0: supports USB remote wakeup
> [    5.315284] uhci_hcd 0000:00:1d.0: irq 16, io base 0x00001820
> [    5.315433] usb usb2: default language 0x0409
> [    5.315529] usb usb2: udev 1, busnum 2, minor = 128
> [    5.315627] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
> [    5.315728] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    5.315865] usb usb2: Product: UHCI Host Controller
> [    5.315961] usb usb2: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
> [    5.316068] usb usb2: SerialNumber: 0000:00:1d.0
> [    5.316207] usb usb2: uevent
> [    5.316373] usb usb2: usb_probe_device
> [    5.317244] usb usb2: configuration #1 chosen from 1 choice
> [    5.317354] usb usb2: adding 2-0:1.0 (config #1, interface 0)
> [    5.317470] usb 2-0:1.0: uevent
> [    5.317619] hub 2-0:1.0: usb_probe_interface
> [    5.317717] hub 2-0:1.0: usb_probe_interface - got id
> [    5.317813] hub 2-0:1.0: USB hub found
> [    5.317913] hub 2-0:1.0: 2 ports detected
> [    5.318015] hub 2-0:1.0: standalone hub
> [    5.318111] hub 2-0:1.0: no power switching (usb 1.0)
> [    5.318208] hub 2-0:1.0: individual port over-current protection
> [    5.318315] hub 2-0:1.0: power on to power good time: 2ms
> [    5.318416] hub 2-0:1.0: local power source is good
> [    5.318513] hub 2-0:1.0: trying to enable port power on non-switchable hub
> [    5.318631] drivers/usb/core/inode.c: creating file '001'
> [    5.318767]   alloc irq_desc for 17 on node -1
> [    5.318857]   alloc kstat_irqs on node -1
> [    5.318956] IOAPIC[0]: Set routing entry (1-17 -> 0xb9 -> IRQ 17 Mode:1 Active:1)
> [    5.319103] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 17 (level, low) -> IRQ 17
> [    5.319208] uhci_hcd 0000:00:1d.1: setting latency timer to 64
> [    5.319316] uhci_hcd 0000:00:1d.1: UHCI Host Controller
> [    5.319417] drivers/usb/core/inode.c: creating file '003'
> [    5.319593] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3
> [    5.319729] uhci_hcd 0000:00:1d.1: detected 2 ports
> [    5.319830] uhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: cmd = 0x0000
> [    5.319930] uhci_hcd 0000:00:1d.1: Performing full reset
> [    5.320048] uhci_hcd 0000:00:1d.1: supports USB remote wakeup
> [    5.320159] uhci_hcd 0000:00:1d.1: irq 17, io base 0x00001840
> [    5.320293] usb usb3: default language 0x0409
> [    5.320397] usb usb3: udev 1, busnum 3, minor = 256
> [    5.320494] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
> [    5.320595] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    5.320731] usb usb3: Product: UHCI Host Controller
> [    5.320828] usb usb3: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
> [    5.320927] usb usb3: SerialNumber: 0000:00:1d.1
> [    5.321082] usb usb3: uevent
> [    5.321232] usb usb3: usb_probe_device
> [    5.321327] usb usb3: configuration #1 chosen from 1 choice
> [    5.321430] usb usb3: adding 3-0:1.0 (config #1, interface 0)
> [    5.321545] usb 3-0:1.0: uevent
> [    5.321699] hub 3-0:1.0: usb_probe_interface
> [    5.321787] hub 3-0:1.0: usb_probe_interface - got id
> [    5.321883] hub 3-0:1.0: USB hub found
> [    5.321985] hub 3-0:1.0: 2 ports detected
> [    5.322087] hub 3-0:1.0: standalone hub
> [    5.322182] hub 3-0:1.0: no power switching (usb 1.0)
> [    5.322285] hub 3-0:1.0: individual port over-current protection
> [    5.322385] hub 3-0:1.0: power on to power good time: 2ms
> [    5.322485] hub 3-0:1.0: local power source is good
> [    5.322582] hub 3-0:1.0: trying to enable port power on non-switchable hub
> [    5.322702] drivers/usb/core/inode.c: creating file '001'
> [    5.323510] uhci_hcd 0000:00:1d.2: power state changed by ACPI to D0
> [    5.323605]   alloc irq_desc for 18 on node -1
> [    5.323693]   alloc kstat_irqs on node -1
> [    5.323791] IOAPIC[0]: Set routing entry (1-18 -> 0xc1 -> IRQ 18 Mode:1 Active:1)
> [    5.323929] uhci_hcd 0000:00:1d.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
> [    5.324043] uhci_hcd 0000:00:1d.2: setting latency timer to 64
> [    5.324143] uhci_hcd 0000:00:1d.2: UHCI Host Controller
> [    5.324244] drivers/usb/core/inode.c: creating file '004'
> [    5.324427] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4
> [    5.324563] uhci_hcd 0000:00:1d.2: detected 2 ports
> [    5.324663] uhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: cmd = 0x0000
> [    5.324763] uhci_hcd 0000:00:1d.2: Performing full reset
> [    5.324875] uhci_hcd 0000:00:1d.2: supports USB remote wakeup
> [    5.324985] uhci_hcd 0000:00:1d.2: irq 18, io base 0x00001860
> [    5.325132] usb usb4: default language 0x0409
> [    5.325227] usb usb4: udev 1, busnum 4, minor = 384
> [    5.325331] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
> [    5.325432] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    5.325568] usb usb4: Product: UHCI Host Controller
> [    5.325665] usb usb4: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
> [    5.325765] usb usb4: SerialNumber: 0000:00:1d.2
> [    5.325905] usb usb4: uevent
> [    5.326071] usb usb4: usb_probe_device
> [    5.326160] usb usb4: configuration #1 chosen from 1 choice
> [    5.326264] usb usb4: adding 4-0:1.0 (config #1, interface 0)
> [    5.326382] usb 4-0:1.0: uevent
> [    5.326533] hub 4-0:1.0: usb_probe_interface
> [    5.326622] hub 4-0:1.0: usb_probe_interface - got id
> [    5.326719] hub 4-0:1.0: USB hub found
> [    5.326820] hub 4-0:1.0: 2 ports detected
> [    5.326915] hub 4-0:1.0: standalone hub
> [    5.327017] hub 4-0:1.0: no power switching (usb 1.0)
> [    5.327114] hub 4-0:1.0: individual port over-current protection
> [    5.327213] hub 4-0:1.0: power on to power good time: 2ms
> [    5.327322] hub 4-0:1.0: local power source is good
> [    5.327418] hub 4-0:1.0: trying to enable port power on non-switchable hub
> [    5.327536] drivers/usb/core/inode.c: creating file '001'
> [    5.327677] uhci_hcd 0000:00:1d.3: PCI INT D -> GSI 19 (level, low) -> IRQ 19
> [    5.327774] uhci_hcd 0000:00:1d.3: setting latency timer to 64
> [    5.327876] uhci_hcd 0000:00:1d.3: UHCI Host Controller
> [    5.327977] drivers/usb/core/inode.c: creating file '005'
> [    5.328167] uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 5
> [    5.328311] uhci_hcd 0000:00:1d.3: detected 2 ports
> [    5.328411] uhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: cmd = 0x0000
> [    5.328512] uhci_hcd 0000:00:1d.3: Performing full reset
> [    5.328627] uhci_hcd 0000:00:1d.3: irq 19, io base 0x00001880
> [    5.328768] usb usb5: default language 0x0409
> [    5.328863] usb usb5: udev 1, busnum 5, minor = 512
> [    5.328961] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001
> [    5.329070] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    5.329208] usb usb5: Product: UHCI Host Controller
> [    5.329313] usb usb5: Manufacturer: Linux 2.6.31-rc5-tip uhci_hcd
> [    5.329413] usb usb5: SerialNumber: 0000:00:1d.3
> [    5.329563] usb usb5: uevent
> [    5.329713] usb usb5: usb_probe_device
> [    5.329801] usb usb5: configuration #1 chosen from 1 choice
> [    5.329906] usb usb5: adding 5-0:1.0 (config #1, interface 0)
> [    5.330029] usb 5-0:1.0: uevent
> [    5.330179] hub 5-0:1.0: usb_probe_interface
> [    5.330275] hub 5-0:1.0: usb_probe_interface - got id
> [    5.330372] hub 5-0:1.0: USB hub found
> [    5.330472] hub 5-0:1.0: 2 ports detected
> [    5.330568] hub 5-0:1.0: standalone hub
> [    5.330663] hub 5-0:1.0: no power switching (usb 1.0)
> [    5.330761] hub 5-0:1.0: individual port over-current protection
> [    5.330861] hub 5-0:1.0: power on to power good time: 2ms
> [    5.330961] hub 5-0:1.0: local power source is good
> [    5.331067] hub 5-0:1.0: trying to enable port power on non-switchable hub
> [    5.331184] drivers/usb/core/inode.c: creating file '001'
> [    5.331381] initcall uhci_hcd_init+0x0/0x10a returned 0 after 17516 usecs
> [    5.331476] calling  usblp_init+0x0/0x16 @ 1
> [    5.331635] usbcore: registered new interface driver usblp
> [    5.331730] initcall usblp_init+0x0/0x16 returned 0 after 152 usecs
> [    5.331830] calling  usb_stor_init+0x0/0x42 @ 1
> [    5.331927] Initializing USB Mass Storage driver...
> [    5.332119] usbcore: registered new interface driver usb-storage
> [    5.332211] USB Mass Storage support registered.
> [    5.332319] initcall usb_stor_init+0x0/0x42 returned 0 after 381 usecs
> [    5.332420] calling  usb_usual_init+0x0/0x30 @ 1
> [    5.332603] usbcore: registered new interface driver libusual
> [    5.332699] initcall usb_usual_init+0x0/0x30 returned 0 after 176 usecs
> [    5.332801] calling  i8042_init+0x0/0x35f @ 1
> [    5.333051] PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
> [    5.333202] Platform driver 'i8042' needs updating - please use dev_pm_ops
> [    5.341619] serio: i8042 KBD port at 0x60,0x64 irq 1
> [    5.341716] serio: i8042 AUX port at 0x60,0x64 irq 12
> [    5.341854] initcall i8042_init+0x0/0x35f returned 0 after 8744 usecs
> [    5.341949] calling  serport_init+0x0/0x2b @ 1
> [    5.342057] initcall serport_init+0x0/0x2b returned 0 after 1 usecs
> [    5.342157] calling  mousedev_init+0x0/0x51 @ 1
> [    5.342433] mice: PS/2 mouse device common for all mice
> [    5.342526] initcall mousedev_init+0x0/0x51 returned 0 after 263 usecs
> [    5.342627] calling  evdev_init+0x0/0xf @ 1
> [    5.343079] initcall evdev_init+0x0/0xf returned 0 after 345 usecs
> [    5.343173] calling  atkbd_init+0x0/0x20 @ 1
> [    5.343350] initcall atkbd_init+0x0/0x20 returned 0 after 72 usecs
> [    5.343444] calling  psmouse_init+0x0/0x61 @ 1
> [    5.343667] initcall psmouse_init+0x0/0x61 returned 0 after 121 usecs
> [    5.343761] calling  cmos_init+0x0/0x65 @ 1
> [    5.343890] rtc_cmos 00:07: RTC can wake from S4
> [    5.344078] rtc_cmos 00:07: rtc core: registered rtc_cmos as rtc0
> [    5.344201] rtc0: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
> [    5.344386] initcall cmos_init+0x0/0x65 returned 0 after 513 usecs
> [    5.344480] calling  i2c_i801_init+0x0/0x16 @ 1
> [    5.344596] i801_smbus 0000:00:1f.3: PCI INT A -> GSI 23 (level, low) -> IRQ 23
> [    5.344903] initcall i2c_i801_init+0x0/0x16 returned 0 after 316 usecs
> [    5.344997] calling  dm_init+0x0/0x39 @ 1
> [    5.345454] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
> [    5.345590] initcall dm_init+0x0/0x39 returned 0 after 474 usecs
> [    5.345690] calling  dm_mirror_init+0x0/0x69 @ 1
> [    5.345811] initcall dm_mirror_init+0x0/0x69 returned 0 after 16 usecs
> [    5.345912] calling  dm_dirty_log_init+0x0/0x49 @ 1
> [    5.346021] initcall dm_dirty_log_init+0x0/0x49 returned 0 after 1 usecs
> [    5.346122] calling  dm_zero_init+0x0/0x28 @ 1
> [    5.346221] initcall dm_zero_init+0x0/0x28 returned 0 after 1 usecs
> [    5.346330] calling  cpufreq_gov_dbs_init+0x0/0x9f @ 1
> [    5.346526] initcall cpufreq_gov_dbs_init+0x0/0x9f returned 0 after 88 usecs
> [    5.346621] calling  init_ladder+0x0/0xf @ 1
> [    5.347188] cpuidle: using governor ladder
> [    5.348068] initcall init_ladder+0x0/0xf returned 0 after 1315 usecs
> [    5.348169] calling  init_menu+0x0/0xf @ 1
> [    5.349088] input: AT Translated Set 2 keyboard as /class/input/input5
> [    5.349518] cpuidle: using governor menu
> [    5.349610] initcall init_menu+0x0/0xf returned 0 after 1308 usecs
> [    5.349711] calling  efivars_init+0x0/0x187 @ 1
> [    5.349810] initcall efivars_init+0x0/0x187 returned -19 after 1 usecs
> [    5.349912] calling  hid_init+0x0/0x3d @ 1
> [    5.350186] initcall hid_init+0x0/0x3d returned 0 after 165 usecs
> [    5.350284] calling  a4_init+0x0/0x16 @ 1
> [    5.350470] initcall a4_init+0x0/0x16 returned 0 after 71 usecs
> [    5.350563] calling  apple_init+0x0/0x2d @ 1
> [    5.350740] initcall apple_init+0x0/0x2d returned 0 after 76 usecs
> [    5.350833] calling  belkin_init+0x0/0x16 @ 1
> [    5.350989] initcall belkin_init+0x0/0x16 returned 0 after 56 usecs
> [    5.351097] calling  ch_init+0x0/0x16 @ 1
> [    5.351275] initcall ch_init+0x0/0x16 returned 0 after 77 usecs
> [    5.351369] calling  ch_init+0x0/0x16 @ 1
> [    5.351539] initcall ch_init+0x0/0x16 returned 0 after 70 usecs
> [    5.351632] calling  cp_init+0x0/0x16 @ 1
> [    5.351791] initcall cp_init+0x0/0x16 returned 0 after 60 usecs
> [    5.351885] calling  dr_init+0x0/0x16 @ 1
> [    5.352056] initcall dr_init+0x0/0x16 returned 0 after 71 usecs
> [    5.352149] calling  ez_init+0x0/0x16 @ 1
> [    5.352342] initcall ez_init+0x0/0x16 returned 0 after 93 usecs
> [    5.352435] calling  gyration_init+0x0/0x16 @ 1
> [    5.352620] initcall gyration_init+0x0/0x16 returned 0 after 83 usecs
> [    5.352715] calling  ks_init+0x0/0x16 @ 1
> [    5.352904] initcall ks_init+0x0/0x16 returned 0 after 89 usecs
> [    5.352998] calling  kye_init+0x0/0x16 @ 1
> [    5.353189] initcall kye_init+0x0/0x16 returned 0 after 73 usecs
> [    5.353285] calling  lg_init+0x0/0x16 @ 1
> [    5.353468] initcall lg_init+0x0/0x16 returned 0 after 71 usecs
> [    5.353562] calling  ms_init+0x0/0x16 @ 1
> [    5.353974] initcall ms_init+0x0/0x16 returned 0 after 300 usecs
> [    5.354089] calling  mr_init+0x0/0x16 @ 1
> [    5.354263] initcall mr_init+0x0/0x16 returned 0 after 72 usecs
> [    5.354364] calling  ntrig_init+0x0/0x16 @ 1
> [    5.354534] initcall ntrig_init+0x0/0x16 returned 0 after 69 usecs
> [    5.354628] calling  pl_init+0x0/0x16 @ 1
> [    5.354794] initcall pl_init+0x0/0x16 returned 0 after 66 usecs
> [    5.354887] calling  pl_init+0x0/0x16 @ 1
> [    5.355059] initcall pl_init+0x0/0x16 returned 0 after 72 usecs
> [    5.355151] calling  samsung_init+0x0/0x16 @ 1
> [    5.355343] initcall samsung_init+0x0/0x16 returned 0 after 90 usecs
> [    5.355436] calling  sjoy_init+0x0/0x16 @ 1
> [    5.355616] initcall sjoy_init+0x0/0x16 returned 0 after 79 usecs
> [    5.355710] calling  sony_init+0x0/0x16 @ 1
> [    5.355898] initcall sony_init+0x0/0x16 returned 0 after 87 usecs
> [    5.355992] calling  sp_init+0x0/0x16 @ 1
> [    5.356194] initcall sp_init+0x0/0x16 returned 0 after 85 usecs
> [    5.356290] calling  ga_init+0x0/0x16 @ 1
> [    5.356481] initcall ga_init+0x0/0x16 returned 0 after 75 usecs
> [    5.356574] calling  tm_init+0x0/0x16 @ 1
> [    5.356733] initcall tm_init+0x0/0x16 returned 0 after 59 usecs
> [    5.356826] calling  ts_init+0x0/0x16 @ 1
> [    5.357000] initcall ts_init+0x0/0x16 returned 0 after 67 usecs
> [    5.357106] calling  zp_init+0x0/0x16 @ 1
> [    5.357289] initcall zp_init+0x0/0x16 returned 0 after 82 usecs
> [    5.357382] calling  hid_init+0x0/0xaa @ 1
> [    5.357681] usbcore: registered new interface driver hiddev
> [    5.357859] usbcore: registered new interface driver usbhid
> [    5.357951] usbhid: v2.6:USB HID core driver
> [    5.358071] initcall hid_init+0x0/0xaa returned 0 after 576 usecs
> [    5.358171] calling  usb_mouse_init+0x0/0x2d @ 1
> [    5.358602] usbcore: registered new interface driver usbmouse
> [    5.358695] usbmouse: v1.6:USB HID Boot Protocol mouse driver
> [    5.358797] initcall usb_mouse_init+0x0/0x2d returned 0 after 511 usecs
> [    5.358899] calling  eeepc_laptop_init+0x0/0x3e1 @ 1
> [    5.359180] initcall eeepc_laptop_init+0x0/0x3e1 returned -19 after 176 usecs
> [    5.359277] calling  init_soundcore+0x0/0x64 @ 1
> [    5.359459] initcall init_soundcore+0x0/0x64 returned 0 after 66 usecs
> [    5.359553] calling  alsa_sound_init+0x0/0x77 @ 1
> [    5.359667] Advanced Linux Sound Architecture Driver Version 1.0.20.
> [    5.359770] initcall alsa_sound_init+0x0/0x77 returned 0 after 113 usecs
> [    5.359872] calling  alsa_hwdep_init+0x0/0x46 @ 1
> [    5.359974] initcall alsa_hwdep_init+0x0/0x46 returned 0 after 3 usecs
> [    5.360098] calling  alsa_timer_init+0x0/0x12c @ 1
> [    5.360287] initcall alsa_timer_init+0x0/0x12c returned 0 after 88 usecs
> [    5.360382] calling  snd_hrtimer_init+0x0/0xd4 @ 1
> [    5.360482] initcall snd_hrtimer_init+0x0/0xd4 returned 0 after 1 usecs
> [    5.360584] calling  alsa_pcm_init+0x0/0x4d @ 1
> [    5.360684] initcall alsa_pcm_init+0x0/0x4d returned 0 after 2 usecs
> [    5.360785] calling  snd_mem_init+0x0/0x24 @ 1
> [    5.360887] initcall snd_mem_init+0x0/0x24 returned 0 after 3 usecs
> [    5.360987] calling  alsa_mixer_oss_init+0x0/0x2d @ 1
> [    5.361111] initcall alsa_mixer_oss_init+0x0/0x2d returned 0 after 8 usecs
> [    5.361206] calling  alsa_pcm_oss_init+0x0/0x76 @ 1
> [    5.361322] initcall alsa_pcm_oss_init+0x0/0x76 returned 0 after 1 usecs
> [    5.361431] calling  alsa_seq_init+0x0/0x51 @ 1
> [    5.361905] initcall alsa_seq_init+0x0/0x51 returned 0 after 366 usecs
> [    5.362000] calling  alsa_seq_device_init+0x0/0x4e @ 1
> [    5.362110] initcall alsa_seq_device_init+0x0/0x4e returned 0 after 2 usecs
> [    5.362212] calling  alsa_seq_midi_event_init+0x0/0x7 @ 1
> [    5.362317] initcall alsa_seq_midi_event_init+0x0/0x7 returned 0 after 1 usecs
> [    5.362466] calling  alsa_seq_oss_init+0x0/0x130 @ 1
> [    5.362833] initcall alsa_seq_oss_init+0x0/0x130 returned 0 after 260 usecs
> [    5.362929] calling  alsa_seq_dummy_init+0x0/0xa7 @ 1
> [    5.363059] initcall alsa_seq_dummy_init+0x0/0xa7 returned 0 after 14 usecs
> [    5.363153] calling  patch_realtek_init+0x0/0xf @ 1
> [    5.363258] initcall patch_realtek_init+0x0/0xf returned 0 after 4 usecs
> [    5.363371] calling  patch_cmedia_init+0x0/0xf @ 1
> [    5.363472] initcall patch_cmedia_init+0x0/0xf returned 0 after 1 usecs
> [    5.363572] calling  patch_analog_init+0x0/0xf @ 1
> [    5.363673] initcall patch_analog_init+0x0/0xf returned 0 after 1 usecs
> [    5.363773] calling  patch_sigmatel_init+0x0/0xf @ 1
> [    5.363874] initcall patch_sigmatel_init+0x0/0xf returned 0 after 1 usecs
> [    5.363975] calling  patch_si3054_init+0x0/0xf @ 1
> [    5.364082] initcall patch_si3054_init+0x0/0xf returned 0 after 1 usecs
> [    5.364183] calling  patch_atihdmi_init+0x0/0xf @ 1
> [    5.364286] initcall patch_atihdmi_init+0x0/0xf returned 0 after 1 usecs
> [    5.364397] calling  patch_ca0110_init+0x0/0xf @ 1
> [    5.364497] initcall patch_ca0110_init+0x0/0xf returned 0 after 1 usecs
> [    5.364597] calling  patch_conexant_init+0x0/0xf @ 1
> [    5.364697] initcall patch_conexant_init+0x0/0xf returned 0 after 1 usecs
> [    5.364798] calling  patch_via_init+0x0/0xf @ 1
> [    5.364898] initcall patch_via_init+0x0/0xf returned 0 after 1 usecs
> [    5.364998] calling  patch_nvhdmi_init+0x0/0xf @ 1
> [    5.365106] initcall patch_nvhdmi_init+0x0/0xf returned 0 after 1 usecs
> [    5.365208] calling  patch_intelhdmi_init+0x0/0xf @ 1
> [    5.365312] initcall patch_intelhdmi_init+0x0/0xf returned 0 after 1 usecs
> [    5.365425] calling  alsa_card_azx_init+0x0/0x16 @ 1
> [    5.365557] HDA Intel 0000:00:1b.0: PCI INT B -> GSI 17 (level, low) -> IRQ 17
> [    5.365689] hda_intel: probe_mask set to 0x1 for device 17aa:2010
> [    5.365808] HDA Intel 0000:00:1b.0: setting latency timer to 64
> [    5.399675] initcall alsa_card_azx_init+0x0/0x16 returned 0 after 33348 usecs
> [    5.399772] calling  alsa_sound_last_init+0x0/0x50 @ 1
> [    5.399872] ALSA device list:
> [    5.399965]   #0: HDA Intel at 0xee240000 irq 17
> [    5.400078] initcall alsa_sound_last_init+0x0/0x50 returned 0 after 199 usecs
> [    5.400181] calling  flow_cache_init+0x0/0x141 @ 1
> [    5.400318] initcall flow_cache_init+0x0/0x141 returned 0 after 33 usecs
> [    5.400412] calling  llc_init+0x0/0x1b @ 1
> [    5.400512] initcall llc_init+0x0/0x1b returned 0 after 1 usecs
> [    5.400612] calling  snap_init+0x0/0x31 @ 1
> [    5.400710] initcall snap_init+0x0/0x31 returned 0 after 1 usecs
> [    5.400811] calling  rif_init+0x0/0x6b @ 1
> [    5.400934] initcall rif_init+0x0/0x6b returned 0 after 24 usecs
> [    5.401056] calling  blackhole_module_init+0x0/0xf @ 1
> [    5.401158] initcall blackhole_module_init+0x0/0xf returned 0 after 1 usecs
> [    5.401263] calling  nfnetlink_init+0x0/0x51 @ 1
> [    5.401372] Netfilter messages via NETLINK v0.30.
> [    5.401479] initcall nfnetlink_init+0x0/0x51 returned 0 after 102 usecs
> [    5.401581] calling  nfnetlink_log_init+0x0/0xb3 @ 1
> [    5.401699] initcall nfnetlink_log_init+0x0/0xb3 returned 0 after 10 usecs
> [    5.401802] calling  nf_conntrack_standalone_init+0x0/0xf @ 1
> [    5.401903] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
> [    5.402740] initcall nf_conntrack_standalone_init+0x0/0xf returned 0 after 816 usecs
> [    5.402874] calling  ctnetlink_init+0x0/0x62 @ 1
> [    5.402971] ctnetlink v0.93: registering with nfnetlink.
> [    5.403091] initcall ctnetlink_init+0x0/0x62 returned 0 after 115 usecs
> [    5.403194] calling  nf_conntrack_ftp_init+0x0/0x189 @ 1
> [    5.403300] initcall nf_conntrack_ftp_init+0x0/0x189 returned 0 after 3 usecs
> [    5.403412] calling  nf_conntrack_irc_init+0x0/0x17e @ 1
> [    5.403517] initcall nf_conntrack_irc_init+0x0/0x17e returned 0 after 2 usecs
> [    5.403619] calling  nf_conntrack_sip_init+0x0/0x159 @ 1
> [    5.403721] initcall nf_conntrack_sip_init+0x0/0x159 returned 0 after 1 usecs
> [    5.403823] calling  xt_init+0x0/0xda @ 1
> [    5.403922] initcall xt_init+0x0/0xda returned 0 after 1 usecs
> [    5.404029] calling  tcpudp_mt_init+0x0/0x14 @ 1
> [    5.404130] initcall tcpudp_mt_init+0x0/0x14 returned 0 after 2 usecs
> [    5.404231] calling  connsecmark_tg_init+0x0/0xf @ 1
> [    5.404345] initcall connsecmark_tg_init+0x0/0xf returned 0 after 10 usecs
> [    5.404447] calling  mark_tg_init+0x0/0x14 @ 1
> [    5.404547] initcall mark_tg_init+0x0/0x14 returned 0 after 1 usecs
> [    5.404648] calling  nflog_tg_init+0x0/0xf @ 1
> [    5.404747] initcall nflog_tg_init+0x0/0xf returned 0 after 1 usecs
> [    5.404848] calling  secmark_tg_init+0x0/0xf @ 1
> [    5.404948] initcall secmark_tg_init+0x0/0xf returned 0 after 1 usecs
> [    5.405057] calling  tcpmss_tg_init+0x0/0x14 @ 1
> [    5.405156] initcall tcpmss_tg_init+0x0/0x14 returned 0 after 1 usecs
> [    5.405259] calling  conntrack_mt_init+0x0/0x14 @ 1
> [    5.405374] initcall conntrack_mt_init+0x0/0x14 returned 0 after 1 usecs
> [    5.405475] calling  mark_mt_init+0x0/0x14 @ 1
> [    5.405757] initcall mark_mt_init+0x0/0x14 returned 0 after 172 usecs
> [    5.405851] calling  policy_mt_init+0x0/0x14 @ 1
> [    5.405952] initcall policy_mt_init+0x0/0x14 returned 0 after 1 usecs
> [    5.406838] calling  state_mt_init+0x0/0x14 @ 1
> [    5.406946] initcall state_mt_init+0x0/0x14 returned 0 after 1 usecs
> [    5.407052] calling  sysctl_ipv4_init+0x0/0x3f @ 1
> [    5.407600] initcall sysctl_ipv4_init+0x0/0x3f returned 0 after 438 usecs
> [    5.407694] calling  init_syncookies+0x0/0x16 @ 1
> [    5.407844] initcall init_syncookies+0x0/0x16 returned 0 after 48 usecs
> [    5.407938] calling  tunnel4_init+0x0/0x5a @ 1
> [    5.408045] initcall tunnel4_init+0x0/0x5a returned 0 after 1 usecs
> [    5.408147] calling  ipv4_netfilter_init+0x0/0xf @ 1
> [    5.408248] initcall ipv4_netfilter_init+0x0/0xf returned 0 after 1 usecs
> [    5.408352] calling  nf_conntrack_l3proto_ipv4_init+0x0/0x11d @ 1
> [    5.409022] initcall nf_conntrack_l3proto_ipv4_init+0x0/0x11d returned 0 after 535 usecs
> [    5.409154] calling  nf_nat_init+0x0/0xea @ 1
> [    5.409290] initcall nf_nat_init+0x0/0xea returned 0 after 36 usecs
> [    5.409383] calling  nf_defrag_init+0x0/0x14 @ 1
> [    5.409483] initcall nf_defrag_init+0x0/0x14 returned 0 after 1 usecs
> [    5.409584] calling  nf_nat_ftp_init+0x0/0x1e @ 1
> [    5.409684] initcall nf_nat_ftp_init+0x0/0x1e returned 0 after 1 usecs
> [    5.409784] calling  nf_nat_irc_init+0x0/0x1e @ 1
> [    5.409884] initcall nf_nat_irc_init+0x0/0x1e returned 0 after 1 usecs
> [    5.409983] calling  nf_nat_sip_init+0x0/0x91 @ 1
> [    5.410091] initcall nf_nat_sip_init+0x0/0x91 returned 0 after 1 usecs
> [    5.410191] calling  ip_tables_init+0x0/0x92 @ 1
> [    5.410298] ip_tables: (C) 2000-2006 Netfilter Core Team
> [    5.410407] initcall ip_tables_init+0x0/0x92 returned 0 after 112 usecs
> [    5.410507] calling  iptable_filter_init+0x0/0x5d @ 1
> [    5.410615] initcall iptable_filter_init+0x0/0x5d returned 0 after 8 usecs
> [    5.410716] calling  iptable_mangle_init+0x0/0x38 @ 1
> [    5.410822] initcall iptable_mangle_init+0x0/0x38 returned 0 after 5 usecs
> [    5.410924] calling  nf_nat_standalone_init+0x0/0x73 @ 1
> [    5.411036] initcall nf_nat_standalone_init+0x0/0x73 returned 0 after 5 usecs
> [    5.411139] calling  log_tg_init+0x0/0x24 @ 1
> [    5.411239] initcall log_tg_init+0x0/0x24 returned 0 after 1 usecs
> [    5.411342] calling  masquerade_tg_init+0x0/0x2d @ 1
> [    5.411693] initcall masquerade_tg_init+0x0/0x2d returned 0 after 225 usecs
> [    5.411788] calling  reject_tg_init+0x0/0xf @ 1
> [    5.411888] initcall reject_tg_init+0x0/0xf returned 0 after 1 usecs
> [    5.411989] calling  ulog_tg_init+0x0/0xbe @ 1
> [    5.412099] initcall ulog_tg_init+0x0/0xbe returned 0 after 4 usecs
> [    5.412199] calling  cubictcp_register+0x0/0x93 @ 1
> [    5.412301] TCP cubic registered
> [    5.412410] initcall cubictcp_register+0x0/0x93 returned 0 after 105 usecs
> [    5.412512] calling  xfrm_user_init+0x0/0x40 @ 1
> [    5.412608] Initializing XFRM netlink socket
> [    5.412709] initcall xfrm_user_init+0x0/0x40 returned 0 after 97 usecs
> [    5.412810] calling  inet6_init+0x0/0x277 @ 1
> [    5.413051] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 001803 POWER sig=j CSC CONNECT
> [    5.413184] hub 1-0:1.0: port 8: status 0501 change 0001
> [    5.413671] NET: Registered protocol family 10
> [    5.415678] initcall inet6_init+0x0/0x277 returned 0 after 2703 usecs
> [    5.415774] calling  ah6_init+0x0/0x5a @ 1
> [    5.415875] initcall ah6_init+0x0/0x5a returned 0 after 1 usecs
> [    5.415974] calling  esp6_init+0x0/0x5a @ 1
> [    5.416081] initcall esp6_init+0x0/0x5a returned 0 after 1 usecs
> [    5.416181] calling  xfrm6_transport_init+0x0/0x14 @ 1
> [    5.416285] initcall xfrm6_transport_init+0x0/0x14 returned 0 after 1 usecs
> [    5.416396] calling  xfrm6_mode_tunnel_init+0x0/0x14 @ 1
> [    5.416497] initcall xfrm6_mode_tunnel_init+0x0/0x14 returned 0 after 1 usecs
> [    5.416598] calling  xfrm6_beet_init+0x0/0x14 @ 1
> [    5.416698] initcall xfrm6_beet_init+0x0/0x14 returned 0 after 1 usecs
> [    5.416799] calling  ip6_tables_init+0x0/0x92 @ 1
> [    5.416904] ip6_tables: (C) 2000-2006 Netfilter Core Team
> [    5.417011] initcall ip6_tables_init+0x0/0x92 returned 0 after 110 usecs
> [    5.417113] calling  ip6table_filter_init+0x0/0x5d @ 1
> [    5.417459] initcall ip6table_filter_init+0x0/0x5d returned 0 after 233 usecs
> [    5.417560] calling  ip6table_mangle_init+0x0/0x38 @ 1
> [    5.417668] initcall ip6table_mangle_init+0x0/0x38 returned 0 after 6 usecs
> [    5.417769] calling  nf_conntrack_l3proto_ipv6_init+0x0/0xef @ 1
> [    5.417937] initcall nf_conntrack_l3proto_ipv6_init+0x0/0xef returned 0 after 64 usecs
> [    5.418102] calling  ipv6header_mt6_init+0x0/0xf @ 1
> [    5.418205] initcall ipv6header_mt6_init+0x0/0xf returned 0 after 1 usecs
> [    5.418309] calling  log_tg6_init+0x0/0x24 @ 1
> [    5.418419] initcall log_tg6_init+0x0/0x24 returned 0 after 1 usecs
> [    5.418520] calling  reject_tg6_init+0x0/0xf @ 1
> [    5.418619] initcall reject_tg6_init+0x0/0xf returned 0 after 1 usecs
> [    5.418719] calling  sit_init+0x0/0x5f @ 1
> [    5.418815] IPv6 over IPv4 tunneling driver
> [    5.419018] hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0000
> [    5.419887] initcall sit_init+0x0/0x5f returned 0 after 1044 usecs
> [    5.419980] calling  packet_init+0x0/0x39 @ 1
> [    5.420086] NET: Registered protocol family 17
> [    5.420426] initcall packet_init+0x0/0x39 returned 0 after 329 usecs
> [    5.420528] calling  init_sunrpc+0x0/0x53 @ 1
> [    5.420932] RPC: Registered udp transport module.
> [    5.421031] RPC: Registered tcp transport module.
> [    5.421131] initcall init_sunrpc+0x0/0x53 returned 0 after 492 usecs
> [    5.421232] calling  init_rpcsec_gss+0x0/0x3f @ 1
> [    5.421344] initcall init_rpcsec_gss+0x0/0x3f returned 0 after 8 usecs
> [    5.421453] calling  init_kerberos_module+0x0/0x26 @ 1
> [    5.421556] initcall init_kerberos_module+0x0/0x26 returned 0 after 4 usecs
> [    5.421661] calling  severities_debugfs_init+0x0/0x4e @ 1
> [    5.421770] initcall severities_debugfs_init+0x0/0x4e returned 0 after 9 usecs
> [    5.421910] calling  acpi_cpufreq_init+0x0/0xbf @ 1
> [    5.422347] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
> [    5.426065] initcall acpi_cpufreq_init+0x0/0xbf returned 0 after 3951 usecs
> [    5.426162] calling  hpet_insert_resource+0x0/0x1e @ 1
> [    5.426271] initcall hpet_insert_resource+0x0/0x1e returned 0 after 4 usecs
> [    5.426381] calling  update_mp_table+0x0/0x3ad @ 1
> [    5.426482] initcall update_mp_table+0x0/0x3ad returned 0 after 1 usecs
> [    5.426590] calling  lapic_insert_resource+0x0/0x33 @ 1
> [    5.426691] initcall lapic_insert_resource+0x0/0x33 returned 0 after 1 usecs
> [    5.426793] calling  print_ipi_mode+0x0/0x26 @ 1
> [    5.426890] Using IPI No-Shortcut mode
> [    5.426986] initcall print_ipi_mode+0x0/0x26 returned 0 after 92 usecs
> [    5.427096] calling  init_lapic_nmi_sysfs+0x0/0x33 @ 1
> [    5.427196] initcall init_lapic_nmi_sysfs+0x0/0x33 returned 0 after 1 usecs
> [    5.427301] calling  io_apic_bug_finalize+0x0/0x1c @ 1
> [    5.427415] initcall io_apic_bug_finalize+0x0/0x1c returned 0 after 2 usecs
> [    5.427517] calling  check_early_ioremap_leak+0x0/0x5e @ 1
> [    5.427619] initcall check_early_ioremap_leak+0x0/0x5e returned 0 after 1 usecs
> [    5.427758] calling  pat_memtype_list_init+0x0/0x23 @ 1
> [    5.428110] hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
> [    5.428218] initcall pat_memtype_list_init+0x0/0x23 returned 0 after 351 usecs
> [    5.428361] calling  init_oops_id+0x0/0x3a @ 1
> [    5.428473] initcall init_oops_id+0x0/0x3a returned 0 after 1 usecs
> [    5.428574] calling  disable_boot_consoles+0x0/0x3a @ 1
> [    5.428675] initcall disable_boot_consoles+0x0/0x3a returned 0 after 1 usecs
> [    5.428777] calling  pm_qos_power_init+0x0/0x54 @ 1
> [    5.429120] initcall pm_qos_power_init+0x0/0x54 returned 0 after 237 usecs
> [    5.429216] calling  software_resume+0x0/0x19d @ 1
> [    5.429319] PM: Resume from disk failed.
> [    5.429429] initcall software_resume+0x0/0x19d returned -2 after 105 usecs
> [    5.429531] initcall software_resume+0x0/0x19d returned with error code -2 
> [    5.429635] calling  debugfs_kprobe_init+0x0/0x78 @ 1
> [    5.429742] initcall debugfs_kprobe_init+0x0/0x78 returned 0 after 7 usecs
> [    5.429844] calling  taskstats_init+0x0/0x7d @ 1
> [    5.429945] registered taskstats version 1
> [    5.430051] initcall taskstats_init+0x0/0x7d returned 0 after 107 usecs
> [    5.430153] calling  clear_boot_tracer+0x0/0x27 @ 1
> [    5.430253] initcall clear_boot_tracer+0x0/0x27 returned 0 after 1 usecs
> [    5.430358] calling  max_swapfiles_check+0x0/0x7 @ 1
> [    5.430470] initcall max_swapfiles_check+0x0/0x7 returned 0 after 1 usecs
> [    5.430571] calling  random32_reseed+0x0/0x7e @ 1
> [    5.430684] initcall random32_reseed+0x0/0x7e returned 0 after 14 usecs
> [    5.430786] calling  pci_resource_alignment_sysfs_init+0x0/0x14 @ 1
> [    5.430892] initcall pci_resource_alignment_sysfs_init+0x0/0x14 returned 0 after 3 usecs
> [    5.431048] calling  pci_sysfs_init+0x0/0x44 @ 1
> [    5.431161] uhci_hcd 0000:00:1d.3: port 2 portsc 008a,00
> [    5.431714] initcall pci_sysfs_init+0x0/0x44 returned 0 after 554 usecs
> [    5.431811] calling  seqgen_init+0x0/0xe @ 1
> [    5.431927] initcall seqgen_init+0x0/0xe returned 0 after 16 usecs
> [    5.432038] calling  late_resume_init+0x0/0xc2 @ 1
> [    5.432136]   Magic number: 5:366:74
> [    5.432316] initcall late_resume_init+0x0/0xc2 returned 0 after 174 usecs
> [    5.432410] calling  scsi_complete_async_scans+0x0/0xf4 @ 1
> [    5.432511] initcall scsi_complete_async_scans+0x0/0xf4 returned 0 after 1 usecs
> [    5.432649] calling  memmap_init+0x0/0x8a @ 1
> [    5.432807] initcall memmap_init+0x0/0x8a returned 0 after 59 usecs
> [    5.432901] calling  pci_mmcfg_late_insert_resources+0x0/0x12e @ 1
> [    5.433013] initcall pci_mmcfg_late_insert_resources+0x0/0x12e returned 0 after 10 usecs
> [    5.433153] calling  tcp_congestion_default+0x0/0xf @ 1
> [    5.433257] initcall tcp_congestion_default+0x0/0xf returned 0 after 1 usecs
> [    5.433372] calling  ip_auto_config+0x0/0xd22 @ 1
> [    5.433475] initcall ip_auto_config+0x0/0xd22 returned 0 after 4 usecs
> [    5.433576] calling  initialize_hashrnd+0x0/0x16 @ 1
> [    5.433680] initcall initialize_hashrnd+0x0/0x16 returned 0 after 4 usecs
> [    5.512059] hub 1-0:1.0: state 7 ports 8 chg 0100 evt 0000
> [    5.512156] hub 1-0:1.0: port 8, status 0501, change 0000, 480 Mb/s
> [    5.563254] ehci_hcd 0000:00:1d.7: port 8 full speed --> companion
> [    5.563350] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003801 POWER OWNER sig=j CONNECT
> [    5.563490] hub 1-0:1.0: port 8 not reset yet, waiting 50ms
> [    5.614058] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003002 POWER OWNER sig=se0 CSC
> [    5.614211] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0000
> [    5.614311] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100
> [    5.704097] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
> [    5.704195] uhci_hcd 0000:00:1d.3: port 2 portsc 0093,00
> [    5.704315] hub 5-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
> [    5.808059] hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
> [    5.910056] usb 5-2: new full speed USB device using uhci_hcd and address 2
> [    6.000070] Clocksource tsc unstable (delta = -270104002 ns)
> [    6.011844] Synaptics Touchpad, model: 1, fw: 6.2, id: 0x81a0b1, caps: 0xa04793/0x300000
> [    6.011976] serio: Synaptics pass-through port at isa0060/serio1/input0
> [    6.030026] usb 5-2: ep0 maxpacket = 8
> [    6.053781] usb 5-2: default language 0x0409
> [    6.054626] input: SynPS/2 Synaptics TouchPad as /class/input/input6
> [    6.058807] async_waiting @ 1
> [    6.058903] async_continuing @ 1 after 1 usec
> [    6.059373] md: Waiting for all devices to be available before autodetect
> [    6.059470] md: If you don't use raid, use raid=noautodetect
> [    6.072781] usb 5-2: udev 2, busnum 5, minor = 513
> [    6.072872] usb 5-2: New USB device found, idVendor=0483, idProduct=2016
> [    6.072973] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [    6.073094] usb 5-2: Product: Biometric Coprocessor
> [    6.073190] usb 5-2: Manufacturer: STMicroelectronics
> [    6.073349] usb 5-2: uevent
> [    6.073630] usb 5-2: usb_probe_device
> [    6.073719] usb 5-2: configuration #1 chosen from 1 choice
> [    6.075783] usb 5-2: adding 5-2:1.0 (config #1, interface 0)
> [    6.075892] usb 5-2:1.0: uevent
> [    6.076112] drivers/usb/core/inode.c: creating file '002'
> [    6.076222] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
> [    6.454033] usb usb2: suspend_rh (auto-stop)
> [    6.454146] usb usb3: suspend_rh (auto-stop)
> [    6.454261] usb usb4: suspend_rh (auto-stop)
> [    7.704063] hub 2-0:1.0: hub_suspend
> [    7.704155] usb usb2: bus auto-suspend
> [    7.704249] usb usb2: suspend_rh
> [    7.704367] hub 3-0:1.0: hub_suspend
> [    7.704456] usb usb3: bus auto-suspend
> [    7.704551] usb usb3: suspend_rh
> [    7.704660] hub 4-0:1.0: hub_suspend
> [    7.704748] usb usb4: bus auto-suspend
> [    7.704843] usb usb4: suspend_rh
> [    7.704952] hub 1-0:1.0: hub_suspend
> [    7.705050] usb usb1: bus auto-suspend
> [    7.705154] ehci_hcd 0000:00:1d.7: suspend root hub
> [   11.497204] IBM TrackPoint firmware: 0x0e, buttons: 3/3
> [   11.725545] input: TPPS/2 IBM TrackPoint as /class/input/input7
> [   11.807485] async_waiting @ 1
> [   11.807575] async_continuing @ 1 after 1 usec
> [   11.807943] md: Autodetecting RAID arrays.
> [   11.808049] md: Scanned 0 and added 0 devices.
> [   11.808146] md: autorun ...
> [   11.808240] md: ... autorun DONE.
> [   12.181957] kjournald starting.  Commit interval 5 seconds
> [   12.181982] EXT3-fs: mounted filesystem with writeback data mode.
> [   12.181993] VFS: Mounted root (ext3 filesystem) readonly on device 8:1.
> [   12.182046] async_waiting @ 1
> [   12.182050] async_continuing @ 1 after 1 usec
> [   12.182062] Freeing unused kernel memory: 376k freed
> [   12.182560] Write protecting the kernel text: 4500k
> [   12.182721] Write protecting the kernel read-only data: 2196k
> [   13.464436] sh used greatest stack depth: 6284 bytes left
> [   14.209169] mount used greatest stack depth: 6256 bytes left
> [   15.252079] awk used greatest stack depth: 5956 bytes left
> [   16.155028] eth0: no IPv6 routers present
> [   16.398723] readahead[895]: segfault at 0 ip 00c693b3 sp bfdbd30c error 4 in libc-2.9.so[bf2000+16e000]
> [   16.929854] usb usb2: uevent
> [   16.929976] usb 2-0:1.0: uevent
> [   16.930154] usb usb3: uevent
> [   16.930269] usb 3-0:1.0: uevent
> [   16.930424] usb usb4: uevent
> [   16.930547] usb 4-0:1.0: uevent
> [   16.930696] usb usb5: uevent
> [   16.930809] usb 5-0:1.0: uevent
> [   16.930935] usb 5-2: uevent
> [   16.931069] usb 5-2:1.0: uevent
> [   16.931226] usb usb1: uevent
> [   16.931350] usb 1-0:1.0: uevent
> [   25.714165] EXT3 FS on sda1, internal journal
> [   27.705850] Adding 4096564k swap on /dev/sda2.  Priority:-1 extents:1 across:4096564k 
> [   29.035661] ip used greatest stack depth: 5752 bytes left
> [   45.490796] CPUFREQ: ondemand sampling_rate_max sysfs file is deprecated - used by: cat
> [  102.555904] ssh used greatest stack depth: 5312 bytes left

> # head: baace7ea
> #
> # Automatically generated make config: don't edit
> # Linux kernel version: 2.6.31-rc5
> # Sun Aug  9 12:56:59 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 is not set
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> CONFIG_CONSTRUCTORS=y
> 
> #
> # General setup
> #
> CONFIG_EXPERIMENTAL=y
> # CONFIG_BROKEN_BOOT_ALLOWED4 is not set
> # CONFIG_BROKEN_BOOT_EUROPE is not set
> # CONFIG_BROKEN_BOOT_TITAN is not set
> 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=y
> 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 is not set
> CONFIG_TASKSTATS=y
> CONFIG_TASK_DELAY_ACCT=y
> CONFIG_TASK_XACCT=y
> CONFIG_TASK_IO_ACCOUNTING=y
> 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 is not set
> CONFIG_RCU_FANOUT=32
> # CONFIG_RCU_FANOUT_EXACT is not set
> # CONFIG_TREE_RCU_TRACE is not set
> # CONFIG_PREEMPT_RCU_TRACE is not set
> # CONFIG_IKCONFIG is not set
> CONFIG_LOG_BUF_SHIFT=18
> CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
> CONFIG_GROUP_SCHED=y
> CONFIG_FAIR_GROUP_SCHED=y
> # CONFIG_RT_GROUP_SCHED is not set
> # 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=y
> CONFIG_PROC_PID_CPUSET=y
> CONFIG_CGROUP_CPUACCT=y
> 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=y
> CONFIG_NET_NS=y
> 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 is not set
> CONFIG_UID16=y
> 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=y
> CONFIG_TIMERFD=y
> CONFIG_EVENTFD=y
> CONFIG_SHMEM=y
> 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 is not set
> # 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 is not set
> CONFIG_HAVE_OPROFILE=y
> CONFIG_KPROBES=y
> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
> CONFIG_KRETPROBES=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 is not set
> CONFIG_HAVE_GENERIC_DMA_COHERENT=y
> CONFIG_SLABINFO=y
> CONFIG_RT_MUTEXES=y
> CONFIG_BASE_SMALL=0
> CONFIG_MODULES=y
> # CONFIG_MODULE_FORCE_LOAD is not set
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_FORCE_UNLOAD=y
> # CONFIG_MODVERSIONS is not set
> # CONFIG_MODULE_SRCVERSION_ALL is not set
> CONFIG_STOP_MACHINE=y
> CONFIG_BLOCK=y
> CONFIG_LBDAF=y
> CONFIG_BLK_DEV_BSG=y
> # CONFIG_BLK_DEV_INTEGRITY is not set
> 
> #
> # IO Schedulers
> #
> CONFIG_IOSCHED_NOOP=y
> CONFIG_IOSCHED_AS=y
> CONFIG_IOSCHED_DEADLINE=y
> CONFIG_IOSCHED_CFQ=y
> # CONFIG_DEFAULT_AS is not set
> # CONFIG_DEFAULT_DEADLINE is not set
> CONFIG_DEFAULT_CFQ=y
> # CONFIG_DEFAULT_NOOP is not set
> CONFIG_DEFAULT_IOSCHED="cfq"
> CONFIG_FREEZER=y
> 
> #
> # 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 is not set
> CONFIG_SPARSE_IRQ=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 is not set
> # CONFIG_X86_32_NON_STANDARD is not set
> CONFIG_SCHED_OMIT_FRAME_POINTER=y
> # CONFIG_PARAVIRT_GUEST 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=y
> # 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_WP_WORKS_OK=y
> CONFIG_X86_INVLPG=y
> CONFIG_X86_BSWAP=y
> CONFIG_X86_POPAD_OK=y
> CONFIG_X86_INTEL_USERCOPY=y
> CONFIG_X86_USE_PPRO_CHECKSUM=y
> CONFIG_X86_TSC=y
> CONFIG_X86_CMOV=y
> CONFIG_X86_MINIMUM_CPU_FAMILY=4
> CONFIG_X86_DEBUGCTLMSR=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=y
> CONFIG_CPU_SUP_UMC_32=y
> # CONFIG_X86_DS is not set
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y
> 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 is not set
> CONFIG_X86_THERMAL_VECTOR=y
> CONFIG_VM86=y
> # CONFIG_TOSHIBA is not set
> # CONFIG_I8K is not set
> CONFIG_X86_REBOOTFIXUPS=y
> CONFIG_MICROCODE=y
> CONFIG_MICROCODE_INTEL=y
> CONFIG_MICROCODE_AMD=y
> CONFIG_MICROCODE_OLD_INTERFACE=y
> CONFIG_X86_MSR=y
> CONFIG_X86_CPUID=y
> # CONFIG_X86_CPU_DEBUG is not set
> # CONFIG_UP_WANTED_1 is not set
> CONFIG_SMP=y
> # CONFIG_NOHIGHMEM is not set
> CONFIG_HIGHMEM4G=y
> # CONFIG_HIGHMEM64G 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_DEFAULT_MMAP_MIN_ADDR=4096
> CONFIG_HIGHPTE=y
> CONFIG_X86_CHECK_BIOS_CORRUPTION=y
> CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y
> CONFIG_X86_RESERVE_LOW_64K=y
> # CONFIG_MATH_EMULATION is not set
> CONFIG_MTRR=y
> # CONFIG_MTRR_SANITIZER is not set
> CONFIG_X86_PAT=y
> CONFIG_EFI=y
> CONFIG_SECCOMP=y
> # CONFIG_CC_STACKPROTECTOR is not set
> # 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=y
> # CONFIG_KEXEC_JUMP is not set
> CONFIG_PHYSICAL_START=0x1000000
> CONFIG_RELOCATABLE=y
> CONFIG_X86_NEED_RELOCS=y
> CONFIG_PHYSICAL_ALIGN=0x1000000
> CONFIG_HOTPLUG_CPU=y
> # CONFIG_COMPAT_VDSO is not set
> # CONFIG_CMDLINE_BOOL is not set
> CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
> 
> #
> # Power management and ACPI options
> #
> CONFIG_PM=y
> CONFIG_PM_DEBUG=y
> # CONFIG_PM_VERBOSE is not set
> CONFIG_CAN_PM_TRACE=y
> CONFIG_PM_TRACE=y
> CONFIG_PM_TRACE_RTC=y
> CONFIG_PM_SLEEP_SMP=y
> CONFIG_PM_SLEEP=y
> CONFIG_SUSPEND=y
> CONFIG_SUSPEND_FREEZER=y
> CONFIG_HIBERNATION_NVS=y
> CONFIG_HIBERNATION=y
> CONFIG_PM_STD_PARTITION=""
> CONFIG_ACPI=y
> CONFIG_ACPI_SLEEP=y
> CONFIG_ACPI_PROCFS=y
> CONFIG_ACPI_PROCFS_POWER=y
> CONFIG_ACPI_SYSFS_POWER=y
> CONFIG_ACPI_PROC_EVENT=y
> CONFIG_ACPI_AC=y
> CONFIG_ACPI_BATTERY=y
> CONFIG_ACPI_BUTTON=y
> CONFIG_ACPI_VIDEO=y
> CONFIG_ACPI_FAN=y
> CONFIG_ACPI_DOCK=y
> CONFIG_ACPI_PROCESSOR=y
> CONFIG_ACPI_HOTPLUG_CPU=y
> CONFIG_ACPI_THERMAL=y
> # CONFIG_ACPI_CUSTOM_DSDT is not set
> CONFIG_ACPI_BLACKLIST_YEAR=0
> # CONFIG_ACPI_DEBUG is not set
> # CONFIG_ACPI_PCI_SLOT is not set
> CONFIG_X86_PM_TIMER=y
> CONFIG_ACPI_CONTAINER=y
> # CONFIG_ACPI_SBS is not set
> # CONFIG_APM is not set
> 
> #
> # CPU Frequency scaling
> #
> CONFIG_CPU_FREQ=y
> CONFIG_CPU_FREQ_TABLE=y
> CONFIG_CPU_FREQ_DEBUG=y
> # CONFIG_CPU_FREQ_STAT is not set
> # 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 is not set
> CONFIG_CPU_FREQ_GOV_USERSPACE=y
> CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
> 
> #
> # CPUFreq processor drivers
> #
> CONFIG_X86_ACPI_CPUFREQ=y
> # CONFIG_X86_POWERNOW_K6 is not set
> # CONFIG_X86_POWERNOW_K7 is not set
> # CONFIG_X86_POWERNOW_K8 is not set
> # CONFIG_X86_GX_SUSPMOD is not set
> # CONFIG_X86_SPEEDSTEP_CENTRINO is not set
> # CONFIG_X86_SPEEDSTEP_ICH is not set
> # CONFIG_X86_SPEEDSTEP_SMI is not set
> # CONFIG_X86_P4_CLOCKMOD is not set
> # CONFIG_X86_CPUFREQ_NFORCE2 is not set
> # CONFIG_X86_LONGRUN is not set
> # CONFIG_X86_LONGHAUL is not set
> # CONFIG_X86_E_POWERSAVER 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
> 
> #
> # Bus options (PCI etc.)
> #
> CONFIG_PCI=y
> # CONFIG_PCI_GOBIOS is not set
> # CONFIG_PCI_GOMMCONFIG is not set
> # CONFIG_PCI_GODIRECT is not set
> # CONFIG_PCI_GOOLPC is not set
> CONFIG_PCI_GOANY=y
> CONFIG_PCI_BIOS=y
> CONFIG_PCI_DIRECT=y
> CONFIG_PCI_MMCONFIG=y
> CONFIG_PCI_DOMAINS=y
> # CONFIG_DMAR is not set
> 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 is not set
> CONFIG_ARCH_SUPPORTS_MSI=y
> CONFIG_PCI_MSI=y
> # CONFIG_PCI_LEGACY is not set
> # CONFIG_PCI_DEBUG is not set
> # CONFIG_PCI_STUB is not set
> CONFIG_HT_IRQ=y
> # CONFIG_PCI_IOV is not set
> CONFIG_ISA_DMA_API=y
> # CONFIG_ISA is not set
> # CONFIG_MCA is not set
> # CONFIG_SCx200 is not set
> # CONFIG_OLPC is not set
> CONFIG_K8_NB=y
> CONFIG_PCCARD=y
> # CONFIG_PCMCIA_DEBUG is not set
> CONFIG_PCMCIA=y
> CONFIG_PCMCIA_LOAD_CIS=y
> CONFIG_PCMCIA_IOCTL=y
> CONFIG_CARDBUS=y
> 
> #
> # PC-card bridges
> #
> CONFIG_YENTA=y
> CONFIG_YENTA_O2=y
> CONFIG_YENTA_RICOH=y
> CONFIG_YENTA_TI=y
> CONFIG_YENTA_ENE_TUNE=y
> CONFIG_YENTA_TOSHIBA=y
> # CONFIG_PD6729 is not set
> # CONFIG_I82092 is not set
> CONFIG_PCCARD_NONSTATIC=y
> CONFIG_HOTPLUG_PCI=y
> # CONFIG_HOTPLUG_PCI_FAKE is not set
> # CONFIG_HOTPLUG_PCI_COMPAQ is not set
> # CONFIG_HOTPLUG_PCI_IBM is not set
> # CONFIG_HOTPLUG_PCI_ACPI is not set
> # CONFIG_HOTPLUG_PCI_CPCI is not set
> # CONFIG_HOTPLUG_PCI_SHPC is not set
> 
> #
> # Executable file formats / Emulations
> #
> CONFIG_BINFMT_ELF=y
> CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
> CONFIG_HAVE_AOUT=y
> # CONFIG_BINFMT_AOUT is not set
> CONFIG_BINFMT_MISC=y
> CONFIG_HAVE_ATOMIC_IOMAP=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 is not set
> # CONFIG_XFRM_MIGRATE is not set
> # CONFIG_XFRM_STATISTICS is not set
> # CONFIG_NET_KEY is not set
> CONFIG_INET=y
> CONFIG_IP_MULTICAST=y
> 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=y
> CONFIG_IP_ROUTE_VERBOSE=y
> CONFIG_IP_PNP=y
> CONFIG_IP_PNP_DHCP=y
> CONFIG_IP_PNP_BOOTP=y
> CONFIG_IP_PNP_RARP=y
> # CONFIG_NET_IPIP is not set
> # CONFIG_NET_IPGRE is not set
> CONFIG_IP_MROUTE=y
> CONFIG_IP_PIMSM_V1=y
> CONFIG_IP_PIMSM_V2=y
> # CONFIG_ARPD is not set
> CONFIG_SYN_COOKIES=y
> # CONFIG_INET_AH is not set
> # CONFIG_INET_ESP is not set
> # CONFIG_INET_IPCOMP is not set
> # CONFIG_INET_XFRM_TUNNEL is not set
> CONFIG_INET_TUNNEL=y
> # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
> # CONFIG_INET_XFRM_MODE_TUNNEL is not set
> # CONFIG_INET_XFRM_MODE_BEET is not set
> CONFIG_INET_LRO=y
> # CONFIG_INET_DIAG is not set
> CONFIG_TCP_CONG_ADVANCED=y
> # CONFIG_TCP_CONG_BIC is not set
> CONFIG_TCP_CONG_CUBIC=y
> # CONFIG_TCP_CONG_WESTWOOD is not set
> # CONFIG_TCP_CONG_HTCP is not set
> # CONFIG_TCP_CONG_HSTCP is not set
> # CONFIG_TCP_CONG_HYBLA is not set
> # CONFIG_TCP_CONG_VEGAS is not set
> # CONFIG_TCP_CONG_SCALABLE is not set
> # CONFIG_TCP_CONG_LP is not set
> # CONFIG_TCP_CONG_VENO is not set
> # CONFIG_TCP_CONG_YEAH is not set
> # CONFIG_TCP_CONG_ILLINOIS is not set
> # CONFIG_DEFAULT_BIC is not set
> CONFIG_DEFAULT_CUBIC=y
> # CONFIG_DEFAULT_HTCP is not set
> # CONFIG_DEFAULT_VEGAS is not set
> # CONFIG_DEFAULT_WESTWOOD is not set
> # CONFIG_DEFAULT_RENO is not set
> 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 is not set
> CONFIG_INET6_AH=y
> CONFIG_INET6_ESP=y
> # CONFIG_INET6_IPCOMP is not set
> # CONFIG_IPV6_MIP6 is not set
> # CONFIG_INET6_XFRM_TUNNEL is not set
> # CONFIG_INET6_TUNNEL is not set
> CONFIG_INET6_XFRM_MODE_TRANSPORT=y
> CONFIG_INET6_XFRM_MODE_TUNNEL=y
> CONFIG_INET6_XFRM_MODE_BEET=y
> # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
> CONFIG_IPV6_SIT=y
> CONFIG_IPV6_NDISC_NODETYPE=y
> # CONFIG_IPV6_TUNNEL is not set
> # CONFIG_IPV6_MULTIPLE_TABLES is not set
> # CONFIG_IPV6_MROUTE is not set
> CONFIG_NETLABEL=y
> CONFIG_NETWORK_SECMARK=y
> CONFIG_NETFILTER=y
> # CONFIG_NETFILTER_DEBUG is not set
> # CONFIG_NETFILTER_ADVANCED is not set
> 
> #
> # Core Netfilter Configuration
> #
> CONFIG_NETFILTER_NETLINK=y
> CONFIG_NETFILTER_NETLINK_LOG=y
> CONFIG_NF_CONNTRACK=y
> CONFIG_NF_CONNTRACK_SECMARK=y
> CONFIG_NF_CONNTRACK_FTP=y
> CONFIG_NF_CONNTRACK_IRC=y
> CONFIG_NF_CONNTRACK_SIP=y
> CONFIG_NF_CT_NETLINK=y
> CONFIG_NETFILTER_XTABLES=y
> CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
> CONFIG_NETFILTER_XT_TARGET_MARK=y
> CONFIG_NETFILTER_XT_TARGET_NFLOG=y
> CONFIG_NETFILTER_XT_TARGET_SECMARK=y
> CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
> CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
> CONFIG_NETFILTER_XT_MATCH_MARK=y
> CONFIG_NETFILTER_XT_MATCH_POLICY=y
> CONFIG_NETFILTER_XT_MATCH_STATE=y
> # CONFIG_IP_VS is not set
> 
> #
> # 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=y
> CONFIG_IP_NF_TARGET_REJECT=y
> CONFIG_IP_NF_TARGET_LOG=y
> CONFIG_IP_NF_TARGET_ULOG=y
> CONFIG_NF_NAT=y
> CONFIG_NF_NAT_NEEDED=y
> CONFIG_IP_NF_TARGET_MASQUERADE=y
> CONFIG_NF_NAT_FTP=y
> 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=y
> CONFIG_IP_NF_MANGLE=y
> 
> #
> # IPv6: Netfilter Configuration
> #
> CONFIG_NF_CONNTRACK_IPV6=y
> CONFIG_IP6_NF_IPTABLES=y
> CONFIG_IP6_NF_MATCH_IPV6HEADER=y
> CONFIG_IP6_NF_TARGET_LOG=y
> CONFIG_IP6_NF_FILTER=y
> CONFIG_IP6_NF_TARGET_REJECT=y
> CONFIG_IP6_NF_MANGLE=y
> # CONFIG_IP_DCCP is not set
> # CONFIG_IP_SCTP is not set
> # CONFIG_TIPC is not set
> # CONFIG_ATM is not set
> # CONFIG_BRIDGE is not set
> # CONFIG_NET_DSA is not set
> # CONFIG_VLAN_8021Q is not set
> # CONFIG_DECNET is not set
> CONFIG_LLC=y
> # CONFIG_LLC2 is not set
> # CONFIG_IPX is not set
> # CONFIG_ATALK is not set
> # CONFIG_X25 is not set
> # CONFIG_LAPB is not set
> # CONFIG_ECONET is not set
> # CONFIG_WAN_ROUTER is not set
> # CONFIG_PHONET is not set
> # CONFIG_IEEE802154 is not set
> CONFIG_NET_SCHED=y
> 
> #
> # Queueing/Scheduling
> #
> # CONFIG_NET_SCH_CBQ is not set
> # CONFIG_NET_SCH_HTB is not set
> # CONFIG_NET_SCH_HFSC is not set
> # CONFIG_NET_SCH_PRIO is not set
> # CONFIG_NET_SCH_MULTIQ is not set
> # CONFIG_NET_SCH_RED is not set
> # CONFIG_NET_SCH_SFQ is not set
> # CONFIG_NET_SCH_TEQL is not set
> # CONFIG_NET_SCH_TBF is not set
> # CONFIG_NET_SCH_GRED is not set
> # CONFIG_NET_SCH_DSMARK is not set
> # CONFIG_NET_SCH_NETEM is not set
> # CONFIG_NET_SCH_DRR is not set
> # CONFIG_NET_SCH_INGRESS is not set
> 
> #
> # Classification
> #
> CONFIG_NET_CLS=y
> # CONFIG_NET_CLS_BASIC is not set
> # CONFIG_NET_CLS_TCINDEX is not set
> # CONFIG_NET_CLS_ROUTE4 is not set
> # CONFIG_NET_CLS_FW is not set
> # CONFIG_NET_CLS_U32 is not set
> # CONFIG_NET_CLS_RSVP is not set
> # CONFIG_NET_CLS_RSVP6 is not set
> # CONFIG_NET_CLS_FLOW is not set
> # CONFIG_NET_CLS_CGROUP is not set
> CONFIG_NET_EMATCH=y
> CONFIG_NET_EMATCH_STACK=32
> # CONFIG_NET_EMATCH_CMP is not set
> # CONFIG_NET_EMATCH_NBYTE is not set
> # CONFIG_NET_EMATCH_U32 is not set
> # CONFIG_NET_EMATCH_META is not set
> # CONFIG_NET_EMATCH_TEXT is not set
> CONFIG_NET_CLS_ACT=y
> # CONFIG_NET_ACT_POLICE is not set
> # CONFIG_NET_ACT_GACT is not set
> # CONFIG_NET_ACT_MIRRED is not set
> # CONFIG_NET_ACT_IPT is not set
> # CONFIG_NET_ACT_NAT is not set
> # CONFIG_NET_ACT_PEDIT is not set
> # CONFIG_NET_ACT_SIMP is not set
> # CONFIG_NET_ACT_SKBEDIT is not set
> CONFIG_NET_SCH_FIFO=y
> # CONFIG_DCB is not set
> 
> #
> # Network testing
> #
> # CONFIG_NET_PKTGEN is not set
> # CONFIG_NET_TCPPROBE is not set
> # CONFIG_NET_DROP_MONITOR is not set
> CONFIG_HAMRADIO=y
> 
> #
> # Packet Radio protocols
> #
> # CONFIG_AX25 is not set
> # CONFIG_CAN is not set
> # CONFIG_IRDA is not set
> # CONFIG_BT is not set
> # CONFIG_AF_RXRPC is not set
> CONFIG_FIB_RULES=y
> CONFIG_WIRELESS=y
> CONFIG_CFG80211=y
> # CONFIG_CFG80211_REG_DEBUG is not set
> # CONFIG_CFG80211_DEBUGFS is not set
> CONFIG_WIRELESS_OLD_REGULATORY=y
> CONFIG_WIRELESS_EXT=y
> CONFIG_WIRELESS_EXT_SYSFS=y
> # CONFIG_LIB80211 is not set
> CONFIG_MAC80211=y
> CONFIG_MAC80211_DEFAULT_PS=y
> CONFIG_MAC80211_DEFAULT_PS_VALUE=1
> 
> #
> # Rate control algorithm selection
> #
> 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 is not set
> # CONFIG_WIMAX is not set
> 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 is not set
> CONFIG_PNP=y
> CONFIG_PNP_DEBUG_MESSAGES=y
> 
> #
> # Protocols
> #
> CONFIG_PNPACPI=y
> CONFIG_BLK_DEV=y
> # CONFIG_BLK_DEV_FD is not set
> CONFIG_BLK_CPQ_DA=y
> # CONFIG_BLK_CPQ_CISS_DA is not set
> # CONFIG_BLK_DEV_DAC960 is not set
> # 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 is not set
> # CONFIG_BLK_DEV_SX8 is not set
> # CONFIG_BLK_DEV_UB is not set
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_COUNT=16
> CONFIG_BLK_DEV_RAM_SIZE=16384
> # CONFIG_BLK_DEV_XIP is not set
> # CONFIG_CDROM_PKTCDVD is not set
> # CONFIG_ATA_OVER_ETH is not set
> # CONFIG_BLK_DEV_HD is not set
> CONFIG_MISC_DEVICES=y
> # CONFIG_IBM_ASM is not set
> # CONFIG_PHANTOM is not set
> # CONFIG_SGI_IOC4 is not set
> # CONFIG_TIFM_CORE is not set
> # CONFIG_ICS932S401 is not set
> # CONFIG_ENCLOSURE_SERVICES is not set
> # CONFIG_HP_ILO is not set
> # CONFIG_ISL29003 is not set
> # CONFIG_C2PORT is not set
> 
> #
> # EEPROM support
> #
> # CONFIG_EEPROM_AT24 is not set
> # CONFIG_EEPROM_LEGACY is not set
> # CONFIG_EEPROM_MAX6875 is not set
> # CONFIG_EEPROM_93CX6 is not set
> # CONFIG_CB710_CORE is not set
> CONFIG_HAVE_IDE=y
> 
> #
> # SCSI device support
> #
> # CONFIG_RAID_ATTRS is not set
> CONFIG_SCSI=y
> CONFIG_SCSI_DMA=y
> # CONFIG_SCSI_TGT is not set
> # CONFIG_SCSI_NETLINK is not set
> CONFIG_SCSI_PROC_FS=y
> 
> #
> # SCSI support type (disk, tape, CD-ROM)
> #
> CONFIG_BLK_DEV_SD=y
> # CONFIG_CHR_DEV_ST is not set
> # CONFIG_CHR_DEV_OSST is not set
> 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 is not set
> CONFIG_SCSI_CONSTANTS=y
> # CONFIG_SCSI_LOGGING is not set
> # CONFIG_SCSI_SCAN_ASYNC is not set
> CONFIG_SCSI_WAIT_SCAN=m
> 
> #
> # SCSI Transports
> #
> CONFIG_SCSI_SPI_ATTRS=y
> # CONFIG_SCSI_FC_ATTRS is not set
> # CONFIG_SCSI_ISCSI_ATTRS is not set
> # CONFIG_SCSI_SAS_ATTRS is not set
> # CONFIG_SCSI_SAS_LIBSAS is not set
> # CONFIG_SCSI_LOWLEVEL is not set
> CONFIG_SCSI_AIC7XXX=y
> # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
> # CONFIG_SCSI_DH is not set
> # CONFIG_SCSI_OSD_INITIATOR is not set
> CONFIG_ATA=y
> # CONFIG_ATA_NONSTANDARD is not set
> CONFIG_ATA_ACPI=y
> 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 is not set
> CONFIG_SATA_NV=y
> # CONFIG_PDC_ADMA is not set
> # CONFIG_SATA_QSTOR is not set
> # CONFIG_SATA_PROMISE is not set
> # CONFIG_SATA_SX4 is not set
> # CONFIG_SATA_SIL is not set
> # CONFIG_SATA_SIS is not set
> # CONFIG_SATA_ULI is not set
> # CONFIG_SATA_VIA is not set
> # CONFIG_SATA_VITESSE is not set
> # CONFIG_SATA_INIC162X is not set
> # CONFIG_PATA_ACPI is not set
> # CONFIG_PATA_ALI is not set
> CONFIG_PATA_AMD=y
> # CONFIG_PATA_ARTOP is not set
> # CONFIG_PATA_ATIIXP is not set
> # CONFIG_PATA_CMD640_PCI is not set
> # CONFIG_PATA_CMD64X is not set
> # CONFIG_PATA_CS5520 is not set
> # CONFIG_PATA_CS5530 is not set
> # CONFIG_PATA_CS5535 is not set
> # CONFIG_PATA_CS5536 is not set
> # CONFIG_PATA_CYPRESS is not set
> # CONFIG_PATA_EFAR is not set
> CONFIG_ATA_GENERIC=y
> # CONFIG_PATA_HPT366 is not set
> # CONFIG_PATA_HPT37X is not set
> # CONFIG_PATA_HPT3X2N is not set
> # CONFIG_PATA_HPT3X3 is not set
> # CONFIG_PATA_IT821X is not set
> # CONFIG_PATA_IT8213 is not set
> # CONFIG_PATA_JMICRON is not set
> # CONFIG_PATA_TRIFLEX is not set
> # CONFIG_PATA_MARVELL is not set
> CONFIG_PATA_MPIIX=y
> CONFIG_PATA_OLDPIIX=y
> # CONFIG_PATA_NETCELL is not set
> # CONFIG_PATA_NINJA32 is not set
> # CONFIG_PATA_NS87410 is not set
> # CONFIG_PATA_NS87415 is not set
> # CONFIG_PATA_OPTI is not set
> # CONFIG_PATA_OPTIDMA is not set
> # CONFIG_PATA_PCMCIA is not set
> # CONFIG_PATA_PDC_OLD is not set
> # CONFIG_PATA_RADISYS is not set
> # CONFIG_PATA_RZ1000 is not set
> # CONFIG_PATA_SC1200 is not set
> # CONFIG_PATA_SERVERWORKS is not set
> # CONFIG_PATA_PDC2027X is not set
> # CONFIG_PATA_SIL680 is not set
> # CONFIG_PATA_SIS is not set
> # CONFIG_PATA_VIA is not set
> # CONFIG_PATA_WINBOND is not set
> CONFIG_PATA_SCH=y
> CONFIG_MD=y
> CONFIG_BLK_DEV_MD=y
> CONFIG_MD_AUTODETECT=y
> # CONFIG_MD_LINEAR is not set
> # CONFIG_MD_RAID0 is not set
> # CONFIG_MD_RAID1 is not set
> # CONFIG_MD_RAID10 is not set
> # CONFIG_MD_RAID456 is not set
> # CONFIG_MD_MULTIPATH is not set
> # CONFIG_MD_FAULTY is not set
> CONFIG_BLK_DEV_DM=y
> # CONFIG_DM_DEBUG is not set
> # CONFIG_DM_CRYPT is not set
> # CONFIG_DM_SNAPSHOT is not set
> CONFIG_DM_MIRROR=y
> # CONFIG_DM_LOG_USERSPACE is not set
> CONFIG_DM_ZERO=y
> # CONFIG_DM_MULTIPATH is not set
> # CONFIG_DM_DELAY is not set
> # CONFIG_DM_UEVENT 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 is not set
> # CONFIG_IEEE1394 is not set
> # CONFIG_I2O is not set
> CONFIG_MACINTOSH_DRIVERS=y
> CONFIG_MAC_EMUMOUSEBTN=y
> CONFIG_NETDEVICES=y
> # CONFIG_IFB is not set
> # CONFIG_DUMMY is not set
> # CONFIG_BONDING is not set
> # CONFIG_MACVLAN is not set
> # CONFIG_EQUALIZER is not set
> # CONFIG_TUN is not set
> # CONFIG_VETH is not set
> # CONFIG_NET_SB1000 is not set
> # 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 is not set
> # CONFIG_LXT_PHY is not set
> # CONFIG_CICADA_PHY is not set
> # CONFIG_VITESSE_PHY is not set
> # CONFIG_SMSC_PHY is not set
> # CONFIG_BROADCOM_PHY is not set
> # CONFIG_ICPLUS_PHY is not set
> # CONFIG_REALTEK_PHY is not set
> # CONFIG_NATIONAL_PHY is not set
> # CONFIG_STE10XP is not set
> # CONFIG_LSI_ET1011C_PHY is not set
> # CONFIG_FIXED_PHY is not set
> # CONFIG_MDIO_BITBANG is not set
> CONFIG_NET_ETHERNET=y
> CONFIG_MII=y
> # CONFIG_HAPPYMEAL is not set
> # CONFIG_SUNGEM is not set
> # CONFIG_CASSINI is not set
> CONFIG_NET_VENDOR_3COM=y
> CONFIG_VORTEX=y
> # CONFIG_TYPHOON is not set
> # CONFIG_ETHOC is not set
> # CONFIG_DNET is not set
> CONFIG_NET_TULIP=y
> # CONFIG_DE2104X is not set
> # CONFIG_TULIP is not set
> # CONFIG_DE4X5 is not set
> # CONFIG_WINBOND_840 is not set
> # CONFIG_DM9102 is not set
> # CONFIG_ULI526X is not set
> # CONFIG_PCMCIA_XIRCOM is not set
> # CONFIG_HP100 is not set
> # 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 is not set
> # CONFIG_AMD8111_ETH is not set
> # CONFIG_ADAPTEC_STARFIRE is not set
> # CONFIG_B44 is not set
> CONFIG_FORCEDETH=y
> # CONFIG_FORCEDETH_NAPI is not set
> CONFIG_E100=y
> # CONFIG_FEALNX is not set
> # CONFIG_NATSEMI is not set
> CONFIG_NE2K_PCI=y
> # CONFIG_8139CP is not set
> CONFIG_8139TOO=y
> # CONFIG_8139TOO_PIO is not set
> # CONFIG_8139TOO_TUNE_TWISTER is not set
> # CONFIG_8139TOO_8129 is not set
> # CONFIG_8139_OLD_RX_RESET is not set
> # CONFIG_R6040 is not set
> # CONFIG_SIS900 is not set
> # CONFIG_EPIC100 is not set
> # CONFIG_SMSC9420 is not set
> # CONFIG_SUNDANCE is not set
> # CONFIG_TLAN is not set
> # CONFIG_KS8842 is not set
> # CONFIG_VIA_RHINE is not set
> # CONFIG_SC92031 is not set
> # CONFIG_ATL2 is not set
> CONFIG_NETDEV_1000=y
> # CONFIG_ACENIC is not set
> # CONFIG_DL2K is not set
> CONFIG_E1000=y
> CONFIG_E1000E=y
> # CONFIG_IP1000 is not set
> # CONFIG_IGB is not set
> # CONFIG_IGBVF is not set
> # CONFIG_NS83820 is not set
> # CONFIG_HAMACHI is not set
> # CONFIG_YELLOWFIN is not set
> CONFIG_R8169=y
> # CONFIG_SIS190 is not set
> # CONFIG_SKGE is not set
> CONFIG_SKY2=y
> # CONFIG_SKY2_DEBUG is not set
> # CONFIG_VIA_VELOCITY is not set
> CONFIG_TIGON3=y
> CONFIG_BNX2=y
> # CONFIG_QLA3XXX is not set
> # CONFIG_ATL1 is not set
> # CONFIG_ATL1E is not set
> # CONFIG_ATL1C is not set
> # CONFIG_JME is not set
> CONFIG_NETDEV_10000=y
> # CONFIG_CHELSIO_T1 is not set
> CONFIG_CHELSIO_T3_DEPENDS=y
> # CONFIG_CHELSIO_T3 is not set
> # CONFIG_ENIC is not set
> # CONFIG_IXGBE is not set
> # CONFIG_IXGB is not set
> # CONFIG_S2IO is not set
> # CONFIG_MYRI10GE is not set
> # CONFIG_NIU is not set
> # CONFIG_MLX4_EN is not set
> # CONFIG_MLX4_CORE is not set
> # CONFIG_TEHUTI is not set
> # CONFIG_BNX2X is not set
> # CONFIG_QLGE is not set
> # CONFIG_SFC is not set
> # CONFIG_BE2NET is not set
> CONFIG_TR=y
> # CONFIG_IBMOL is not set
> # CONFIG_IBMLS is not set
> # CONFIG_3C359 is not set
> # CONFIG_TMS380TR is not set
> 
> #
> # Wireless LAN
> #
> # CONFIG_WLAN_PRE80211 is not set
> CONFIG_WLAN_80211=y
> # CONFIG_PCMCIA_RAYCS is not set
> # CONFIG_LIBERTAS is not set
> # CONFIG_LIBERTAS_THINFIRM is not set
> # CONFIG_AIRO is not set
> # CONFIG_ATMEL is not set
> # CONFIG_AT76C50X_USB is not set
> # CONFIG_AIRO_CS is not set
> # CONFIG_PCMCIA_WL3501 is not set
> # CONFIG_PRISM54 is not set
> # CONFIG_USB_ZD1201 is not set
> # CONFIG_USB_NET_RNDIS_WLAN is not set
> # CONFIG_RTL8180 is not set
> # CONFIG_RTL8187 is not set
> # CONFIG_ADM8211 is not set
> # CONFIG_MAC80211_HWSIM is not set
> # CONFIG_MWL8K is not set
> # CONFIG_P54_COMMON is not set
> CONFIG_ATH_COMMON=y
> CONFIG_ATH5K=y
> # CONFIG_ATH5K_DEBUG is not set
> # CONFIG_ATH9K is not set
> # CONFIG_AR9170_USB is not set
> # CONFIG_IPW2100 is not set
> # CONFIG_IPW2200 is not set
> # CONFIG_IWLWIFI is not set
> # CONFIG_HOSTAP is not set
> # CONFIG_B43 is not set
> # CONFIG_B43LEGACY is not set
> # CONFIG_ZD1211RW is not set
> # CONFIG_HERMES is not set
> 
> #
> # Enable WiMAX (Networking options) to see the WiMAX drivers
> #
> 
> #
> # USB Network Adapters
> #
> # CONFIG_USB_CATC is not set
> # CONFIG_USB_KAWETH is not set
> # CONFIG_USB_PEGASUS is not set
> # CONFIG_USB_RTL8150 is not set
> # CONFIG_USB_USBNET is not set
> # CONFIG_USB_HSO is not set
> CONFIG_NET_PCMCIA=y
> # CONFIG_PCMCIA_3C589 is not set
> # CONFIG_PCMCIA_3C574 is not set
> # CONFIG_PCMCIA_FMVJ18X is not set
> # CONFIG_PCMCIA_PCNET is not set
> # CONFIG_PCMCIA_NMCLAN is not set
> # CONFIG_PCMCIA_SMC91C92 is not set
> # CONFIG_PCMCIA_XIRC2PS is not set
> # CONFIG_PCMCIA_AXNET is not set
> # CONFIG_PCMCIA_IBMTR is not set
> # CONFIG_WAN is not set
> CONFIG_FDDI=y
> # CONFIG_DEFXX is not set
> # CONFIG_SKFP is not set
> # CONFIG_HIPPI is not set
> # CONFIG_PPP is not set
> # CONFIG_SLIP is not set
> # CONFIG_NET_FC is not set
> CONFIG_NETCONSOLE=y
> # CONFIG_NETCONSOLE_DYNAMIC is not set
> CONFIG_NETPOLL=y
> # CONFIG_NETPOLL_TRAP is not set
> CONFIG_NET_POLL_CONTROLLER=y
> # CONFIG_ISDN is not set
> # 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 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 is not set
> 
> #
> # Input Device Drivers
> #
> CONFIG_INPUT_KEYBOARD=y
> CONFIG_KEYBOARD_ATKBD=y
> # CONFIG_KEYBOARD_LKKBD is not set
> # CONFIG_KEYBOARD_LM8323 is not set
> # CONFIG_KEYBOARD_NEWTON is not set
> # CONFIG_KEYBOARD_STOWAWAY is not set
> # CONFIG_KEYBOARD_SUNKBD is not set
> # CONFIG_KEYBOARD_XTKBD is not set
> CONFIG_INPUT_MOUSE=y
> CONFIG_MOUSE_PS2=y
> CONFIG_MOUSE_PS2_ALPS=y
> CONFIG_MOUSE_PS2_LOGIPS2PP=y
> CONFIG_MOUSE_PS2_SYNAPTICS=y
> CONFIG_MOUSE_PS2_LIFEBOOK=y
> CONFIG_MOUSE_PS2_TRACKPOINT=y
> # CONFIG_MOUSE_PS2_ELANTECH is not set
> # CONFIG_MOUSE_PS2_TOUCHKIT is not set
> # CONFIG_MOUSE_SERIAL is not set
> # CONFIG_MOUSE_APPLETOUCH is not set
> # CONFIG_MOUSE_BCM5974 is not set
> # CONFIG_MOUSE_VSXXXAA is not set
> # CONFIG_MOUSE_SYNAPTICS_I2C is not set
> CONFIG_INPUT_JOYSTICK=y
> # CONFIG_JOYSTICK_ANALOG is not set
> # CONFIG_JOYSTICK_A3D is not set
> # CONFIG_JOYSTICK_ADI is not set
> # CONFIG_JOYSTICK_COBRA is not set
> # CONFIG_JOYSTICK_GF2K is not set
> # CONFIG_JOYSTICK_GRIP is not set
> # CONFIG_JOYSTICK_GRIP_MP is not set
> # CONFIG_JOYSTICK_GUILLEMOT is not set
> # CONFIG_JOYSTICK_INTERACT is not set
> # CONFIG_JOYSTICK_SIDEWINDER is not set
> # CONFIG_JOYSTICK_TMDC is not set
> # CONFIG_JOYSTICK_IFORCE is not set
> # CONFIG_JOYSTICK_WARRIOR is not set
> # CONFIG_JOYSTICK_MAGELLAN is not set
> # CONFIG_JOYSTICK_SPACEORB is not set
> # CONFIG_JOYSTICK_SPACEBALL is not set
> # CONFIG_JOYSTICK_STINGER is not set
> # CONFIG_JOYSTICK_TWIDJOY is not set
> # CONFIG_JOYSTICK_ZHENHUA is not set
> # CONFIG_JOYSTICK_JOYDUMP is not set
> # CONFIG_JOYSTICK_XPAD is not set
> CONFIG_INPUT_TABLET=y
> # CONFIG_TABLET_USB_ACECAD is not set
> # CONFIG_TABLET_USB_AIPTEK is not set
> # CONFIG_TABLET_USB_GTCO is not set
> # CONFIG_TABLET_USB_KBTAB is not set
> # CONFIG_TABLET_USB_WACOM is not set
> CONFIG_INPUT_TOUCHSCREEN=y
> # CONFIG_TOUCHSCREEN_AD7879_I2C is not set
> # CONFIG_TOUCHSCREEN_AD7879 is not set
> # CONFIG_TOUCHSCREEN_EETI is not set
> # 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 is not set
> # CONFIG_TOUCHSCREEN_INEXIO is not set
> # CONFIG_TOUCHSCREEN_MK712 is not set
> # CONFIG_TOUCHSCREEN_PENMOUNT is not set
> # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
> # CONFIG_TOUCHSCREEN_TOUCHWIN is not set
> # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
> # 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 is not set
> # CONFIG_INPUT_APANEL is not set
> # CONFIG_INPUT_WISTRON_BTNS is not set
> # CONFIG_INPUT_ATLAS_BTNS is not set
> # CONFIG_INPUT_ATI_REMOTE is not set
> # CONFIG_INPUT_ATI_REMOTE2 is not set
> # CONFIG_INPUT_KEYSPAN_REMOTE is not set
> # CONFIG_INPUT_POWERMATE is not set
> # CONFIG_INPUT_YEALINK is not set
> # CONFIG_INPUT_CM109 is not set
> # CONFIG_INPUT_UINPUT is not set
> 
> #
> # Hardware I/O ports
> #
> CONFIG_SERIO=y
> CONFIG_SERIO_I8042=y
> CONFIG_SERIO_SERPORT=y
> # CONFIG_SERIO_CT82C710 is not set
> # CONFIG_SERIO_PCIPS2 is not set
> CONFIG_SERIO_LIBPS2=y
> # CONFIG_SERIO_RAW is not set
> # CONFIG_GAMEPORT 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=y
> CONFIG_SERIAL_NONSTANDARD=y
> # CONFIG_COMPUTONE is not set
> # CONFIG_ROCKETPORT is not set
> # CONFIG_CYCLADES is not set
> # CONFIG_DIGIEPCA is not set
> # CONFIG_MOXA_INTELLIO is not set
> # CONFIG_MOXA_SMARTIO is not set
> # CONFIG_ISI is not set
> # CONFIG_SYNCLINK is not set
> # CONFIG_SYNCLINKMP is not set
> # CONFIG_SYNCLINK_GT is not set
> # CONFIG_N_HDLC is not set
> # CONFIG_RISCOM8 is not set
> # CONFIG_SPECIALIX is not set
> # CONFIG_SX is not set
> # CONFIG_RIO is not set
> # CONFIG_STALDRV is not set
> # CONFIG_NOZOMI is not set
> 
> #
> # Serial drivers
> #
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_FIX_EARLYCON_MEM=y
> CONFIG_SERIAL_8250_PCI=y
> CONFIG_SERIAL_8250_PNP=y
> # CONFIG_SERIAL_8250_CS is not set
> CONFIG_SERIAL_8250_NR_UARTS=32
> CONFIG_SERIAL_8250_RUNTIME_UARTS=4
> CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_MANY_PORTS=y
> CONFIG_SERIAL_8250_SHARE_IRQ=y
> CONFIG_SERIAL_8250_DETECT_IRQ=y
> CONFIG_SERIAL_8250_RSA=y
> 
> #
> # Non-8250 serial port support
> #
> CONFIG_SERIAL_CORE=y
> CONFIG_SERIAL_CORE_CONSOLE=y
> # CONFIG_SERIAL_JSM is not set
> CONFIG_UNIX98_PTYS=y
> # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
> # CONFIG_LEGACY_PTYS is not set
> # CONFIG_IPMI_HANDLER is not set
> CONFIG_HW_RANDOM=y
> # CONFIG_HW_RANDOM_TIMERIOMEM is not set
> CONFIG_HW_RANDOM_INTEL=y
> CONFIG_HW_RANDOM_AMD=y
> CONFIG_HW_RANDOM_GEODE=y
> CONFIG_HW_RANDOM_VIA=y
> CONFIG_NVRAM=y
> # CONFIG_R3964 is not set
> # CONFIG_APPLICOM is not set
> # CONFIG_SONYPI is not set
> 
> #
> # PCMCIA character devices
> #
> # CONFIG_SYNCLINK_CS is not set
> # CONFIG_CARDMAN_4000 is not set
> # CONFIG_CARDMAN_4040 is not set
> # CONFIG_IPWIRELESS is not set
> # CONFIG_MWAVE is not set
> # CONFIG_PC8736x_GPIO is not set
> # CONFIG_NSC_GPIO is not set
> # CONFIG_CS5535_GPIO is not set
> # CONFIG_RAW_DRIVER is not set
> CONFIG_HPET=y
> # CONFIG_HPET_MMAP is not set
> # CONFIG_HANGCHECK_TIMER is not set
> # CONFIG_TCG_TPM is not set
> # CONFIG_TELCLOCK is not set
> 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
> 
> #
> # I2C Hardware Bus support
> #
> 
> #
> # PC SMBus host controller drivers
> #
> # CONFIG_I2C_ALI1535 is not set
> # CONFIG_I2C_ALI1563 is not set
> # CONFIG_I2C_ALI15X3 is not set
> # CONFIG_I2C_AMD756 is not set
> # CONFIG_I2C_AMD8111 is not set
> CONFIG_I2C_I801=y
> # CONFIG_I2C_ISCH is not set
> # CONFIG_I2C_PIIX4 is not set
> # CONFIG_I2C_NFORCE2 is not set
> # CONFIG_I2C_SIS5595 is not set
> # CONFIG_I2C_SIS630 is not set
> # CONFIG_I2C_SIS96X is not set
> # CONFIG_I2C_VIA is not set
> # CONFIG_I2C_VIAPRO is not set
> 
> #
> # I2C system bus drivers (mostly embedded / system-on-chip)
> #
> # CONFIG_I2C_OCORES is not set
> # CONFIG_I2C_SIMTEC is not set
> 
> #
> # External I2C/SMBus adapter drivers
> #
> # CONFIG_I2C_PARPORT_LIGHT is not set
> # CONFIG_I2C_TAOS_EVM is not set
> # CONFIG_I2C_TINY_USB is not set
> 
> #
> # Graphics adapter I2C/DDC channel drivers
> #
> # CONFIG_I2C_VOODOO3 is not set
> 
> #
> # Other I2C/SMBus bus drivers
> #
> # CONFIG_I2C_PCA_PLATFORM is not set
> # CONFIG_I2C_STUB is not set
> # CONFIG_SCx200_ACB is not set
> 
> #
> # Miscellaneous I2C Chip support
> #
> # CONFIG_DS1682 is not set
> # CONFIG_SENSORS_PCF8574 is not set
> # CONFIG_PCF8575 is not set
> # CONFIG_SENSORS_PCA9539 is not set
> # CONFIG_SENSORS_TSL2550 is not set
> # CONFIG_I2C_DEBUG_CORE is not set
> # CONFIG_I2C_DEBUG_ALGO is not set
> # CONFIG_I2C_DEBUG_BUS is not set
> # CONFIG_I2C_DEBUG_CHIP is not set
> # 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 is not set
> CONFIG_POWER_SUPPLY=y
> # CONFIG_POWER_SUPPLY_DEBUG is not set
> # CONFIG_PDA_POWER is not set
> # CONFIG_BATTERY_DS2760 is not set
> # CONFIG_BATTERY_DS2782 is not set
> # CONFIG_BATTERY_BQ27x00 is not set
> # CONFIG_BATTERY_MAX17040 is not set
> CONFIG_HWMON=y
> # CONFIG_HWMON_VID is not set
> # CONFIG_SENSORS_ABITUGURU is not set
> # CONFIG_SENSORS_ABITUGURU3 is not set
> # CONFIG_SENSORS_AD7414 is not set
> # CONFIG_SENSORS_AD7418 is not set
> # CONFIG_SENSORS_ADM1021 is not set
> # CONFIG_SENSORS_ADM1025 is not set
> # CONFIG_SENSORS_ADM1026 is not set
> # CONFIG_SENSORS_ADM1029 is not set
> # CONFIG_SENSORS_ADM1031 is not set
> # CONFIG_SENSORS_ADM9240 is not set
> # CONFIG_SENSORS_ADT7462 is not set
> # CONFIG_SENSORS_ADT7470 is not set
> # CONFIG_SENSORS_ADT7473 is not set
> # CONFIG_SENSORS_ADT7475 is not set
> # CONFIG_SENSORS_K8TEMP is not set
> # CONFIG_SENSORS_ASB100 is not set
> # CONFIG_SENSORS_ATK0110 is not set
> # CONFIG_SENSORS_ATXP1 is not set
> # CONFIG_SENSORS_DS1621 is not set
> # CONFIG_SENSORS_I5K_AMB is not set
> # CONFIG_SENSORS_F71805F is not set
> # CONFIG_SENSORS_F71882FG is not set
> # CONFIG_SENSORS_F75375S is not set
> # CONFIG_SENSORS_FSCHER is not set
> # CONFIG_SENSORS_FSCPOS is not set
> # CONFIG_SENSORS_FSCHMD is not set
> # CONFIG_SENSORS_G760A is not set
> # CONFIG_SENSORS_GL518SM is not set
> # CONFIG_SENSORS_GL520SM is not set
> # CONFIG_SENSORS_CORETEMP is not set
> # CONFIG_SENSORS_IT87 is not set
> # CONFIG_SENSORS_LM63 is not set
> # CONFIG_SENSORS_LM75 is not set
> # CONFIG_SENSORS_LM77 is not set
> # CONFIG_SENSORS_LM78 is not set
> # CONFIG_SENSORS_LM80 is not set
> # CONFIG_SENSORS_LM83 is not set
> # CONFIG_SENSORS_LM85 is not set
> # CONFIG_SENSORS_LM87 is not set
> # CONFIG_SENSORS_LM90 is not set
> # CONFIG_SENSORS_LM92 is not set
> # CONFIG_SENSORS_LM93 is not set
> # CONFIG_SENSORS_LTC4215 is not set
> # CONFIG_SENSORS_LTC4245 is not set
> # CONFIG_SENSORS_LM95241 is not set
> # CONFIG_SENSORS_MAX1619 is not set
> # CONFIG_SENSORS_MAX6650 is not set
> # CONFIG_SENSORS_PC87360 is not set
> # CONFIG_SENSORS_PC87427 is not set
> # CONFIG_SENSORS_PCF8591 is not set
> # CONFIG_SENSORS_SIS5595 is not set
> # CONFIG_SENSORS_DME1737 is not set
> # CONFIG_SENSORS_SMSC47M1 is not set
> # CONFIG_SENSORS_SMSC47M192 is not set
> # CONFIG_SENSORS_SMSC47B397 is not set
> # CONFIG_SENSORS_ADS7828 is not set
> # CONFIG_SENSORS_THMC50 is not set
> # CONFIG_SENSORS_TMP401 is not set
> # CONFIG_SENSORS_VIA686A is not set
> # CONFIG_SENSORS_VT1211 is not set
> # CONFIG_SENSORS_VT8231 is not set
> # CONFIG_SENSORS_W83781D is not set
> # CONFIG_SENSORS_W83791D is not set
> # CONFIG_SENSORS_W83792D is not set
> # CONFIG_SENSORS_W83793 is not set
> # CONFIG_SENSORS_W83L785TS is not set
> # CONFIG_SENSORS_W83L786NG is not set
> # CONFIG_SENSORS_W83627HF is not set
> # CONFIG_SENSORS_W83627EHF is not set
> # CONFIG_SENSORS_HDAPS is not set
> # CONFIG_SENSORS_LIS3LV02D is not set
> # CONFIG_SENSORS_APPLESMC is not set
> # CONFIG_HWMON_DEBUG_CHIP is not set
> CONFIG_THERMAL=y
> # CONFIG_THERMAL_HWMON is not set
> CONFIG_WATCHDOG=y
> # CONFIG_WATCHDOG_NOWAYOUT is not set
> 
> #
> # Watchdog Device Drivers
> #
> # CONFIG_SOFT_WATCHDOG is not set
> # CONFIG_ACQUIRE_WDT is not set
> # CONFIG_ADVANTECH_WDT is not set
> # CONFIG_ALIM1535_WDT is not set
> # CONFIG_ALIM7101_WDT is not set
> # CONFIG_SC520_WDT is not set
> # CONFIG_IB700_WDT is not set
> # CONFIG_IBMASR is not set
> # CONFIG_WAFER_WDT is not set
> # CONFIG_I6300ESB_WDT is not set
> # CONFIG_ITCO_WDT is not set
> # CONFIG_IT8712F_WDT is not set
> # CONFIG_IT87_WDT is not set
> # CONFIG_HP_WATCHDOG is not set
> # CONFIG_SC1200_WDT is not set
> # CONFIG_PC87413_WDT is not set
> # CONFIG_60XX_WDT is not set
> # CONFIG_SBC8360_WDT is not set
> # CONFIG_SBC7240_WDT is not set
> # CONFIG_CPU5_WDT is not set
> # CONFIG_SMSC_SCH311X_WDT is not set
> # CONFIG_SMSC37B787_WDT is not set
> # CONFIG_W83627HF_WDT is not set
> # CONFIG_W83697HF_WDT is not set
> # CONFIG_W83697UG_WDT is not set
> # CONFIG_W83877F_WDT is not set
> # CONFIG_W83977F_WDT is not set
> # CONFIG_MACHZ_WDT is not set
> # CONFIG_SBC_EPX_C3_WATCHDOG is not set
> 
> #
> # PCI-based Watchdog Cards
> #
> # CONFIG_PCIPCWATCHDOG is not set
> # CONFIG_WDTPCI is not set
> 
> #
> # USB-based Watchdog Cards
> #
> # CONFIG_USBPCWATCHDOG is not set
> CONFIG_SSB_POSSIBLE=y
> 
> #
> # Sonics Silicon Backplane
> #
> # CONFIG_SSB is not set
> 
> #
> # Multifunction device drivers
> #
> # CONFIG_MFD_CORE is not set
> # CONFIG_MFD_SM501 is not set
> # CONFIG_HTC_PASIC3 is not set
> # CONFIG_TWL4030_CORE is not set
> # CONFIG_MFD_TMIO is not set
> # CONFIG_PMIC_DA903X is not set
> # CONFIG_MFD_WM8400 is not set
> # CONFIG_MFD_PCF50633 is not set
> # CONFIG_AB3100_CORE is not set
> # CONFIG_REGULATOR is not set
> # CONFIG_MEDIA_SUPPORT is not set
> 
> #
> # Graphics support
> #
> CONFIG_AGP=y
> # CONFIG_AGP_ALI is not set
> # CONFIG_AGP_ATI is not set
> # CONFIG_AGP_AMD is not set
> CONFIG_AGP_AMD64=y
> CONFIG_AGP_INTEL=y
> # CONFIG_AGP_NVIDIA is not set
> # CONFIG_AGP_SIS is not set
> # CONFIG_AGP_SWORKS is not set
> # CONFIG_AGP_VIA is not set
> # CONFIG_AGP_EFFICEON is not set
> CONFIG_DRM=y
> # CONFIG_DRM_TDFX is not set
> # CONFIG_DRM_R128 is not set
> # CONFIG_DRM_RADEON is not set
> # CONFIG_DRM_I810 is not set
> # CONFIG_DRM_I830 is not set
> CONFIG_DRM_I915=y
> # CONFIG_DRM_I915_KMS is not set
> # CONFIG_DRM_MGA is not set
> # CONFIG_DRM_SIS is not set
> # CONFIG_DRM_VIA is not set
> # CONFIG_DRM_SAVAGE is not set
> # CONFIG_VGASTATE is not set
> CONFIG_VIDEO_OUTPUT_CONTROL=y
> CONFIG_FB=y
> # CONFIG_FIRMWARE_EDID is not set
> # CONFIG_FB_DDC is not set
> # CONFIG_FB_BOOT_VESA_SUPPORT is not set
> 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 is not set
> # CONFIG_FB_SYS_COPYAREA is not set
> # CONFIG_FB_SYS_IMAGEBLIT is not set
> # CONFIG_FB_FOREIGN_ENDIAN is not set
> # CONFIG_FB_SYS_FOPS is not set
> # CONFIG_FB_SVGALIB is not set
> # CONFIG_FB_MACMODES is not set
> # CONFIG_FB_BACKLIGHT is not set
> CONFIG_FB_MODE_HELPERS=y
> CONFIG_FB_TILEBLITTING=y
> 
> #
> # Frame buffer hardware drivers
> #
> # CONFIG_FB_PM2 is not set
> # CONFIG_FB_CYBER2000 is not set
> # CONFIG_FB_ARC is not set
> # CONFIG_FB_IMSTT is not set
> # CONFIG_FB_UVESA is not set
> CONFIG_FB_EFI=y
> # CONFIG_FB_N411 is not set
> # CONFIG_FB_HGA is not set
> # CONFIG_FB_S1D13XXX is not set
> # CONFIG_FB_NVIDIA is not set
> # CONFIG_FB_RIVA is not set
> # CONFIG_FB_I810 is not set
> # CONFIG_FB_LE80578 is not set
> # CONFIG_FB_MATROX is not set
> # CONFIG_FB_ATY128 is not set
> # CONFIG_FB_ATY is not set
> # CONFIG_FB_S3 is not set
> # CONFIG_FB_SAVAGE is not set
> # CONFIG_FB_SIS is not set
> # CONFIG_FB_VIA is not set
> # CONFIG_FB_NEOMAGIC is not set
> # CONFIG_FB_KYRO is not set
> # CONFIG_FB_3DFX is not set
> # CONFIG_FB_VOODOO1 is not set
> # CONFIG_FB_VT8623 is not set
> # CONFIG_FB_TRIDENT is not set
> # CONFIG_FB_ARK is not set
> # CONFIG_FB_PM3 is not set
> # CONFIG_FB_CARMINE is not set
> # CONFIG_FB_GEODE is not set
> # CONFIG_FB_METRONOME is not set
> # CONFIG_FB_MB862XX is not set
> # CONFIG_FB_BROADSHEET is not set
> CONFIG_BACKLIGHT_LCD_SUPPORT=y
> # CONFIG_LCD_CLASS_DEVICE is not set
> CONFIG_BACKLIGHT_CLASS_DEVICE=y
> CONFIG_BACKLIGHT_GENERIC=y
> # CONFIG_BACKLIGHT_PROGEAR is not set
> # CONFIG_BACKLIGHT_MBP_NVIDIA is not set
> # CONFIG_BACKLIGHT_SAHARA is not set
> 
> #
> # 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_FRAMEBUFFER_CONSOLE=y
> # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
> # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
> # CONFIG_FONTS is not set
> CONFIG_FONT_8x8=y
> CONFIG_FONT_8x16=y
> CONFIG_LOGO=y
> # CONFIG_LOGO_LINUX_MONO is not set
> # CONFIG_LOGO_LINUX_VGA16 is not set
> CONFIG_LOGO_LINUX_CLUT224=y
> CONFIG_SOUND=y
> CONFIG_SOUND_OSS_CORE=y
> CONFIG_SND=y
> CONFIG_SND_TIMER=y
> CONFIG_SND_PCM=y
> CONFIG_SND_HWDEP=y
> CONFIG_SND_SEQUENCER=y
> CONFIG_SND_SEQ_DUMMY=y
> CONFIG_SND_OSSEMUL=y
> CONFIG_SND_MIXER_OSS=y
> CONFIG_SND_PCM_OSS=y
> CONFIG_SND_PCM_OSS_PLUGINS=y
> CONFIG_SND_SEQUENCER_OSS=y
> CONFIG_SND_HRTIMER=y
> CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
> CONFIG_SND_DYNAMIC_MINORS=y
> CONFIG_SND_SUPPORT_OLD_API=y
> CONFIG_SND_VERBOSE_PROCFS=y
> # CONFIG_SND_VERBOSE_PRINTK is not set
> # CONFIG_SND_DEBUG is not set
> CONFIG_SND_VMASTER=y
> # CONFIG_SND_RAWMIDI_SEQ is not set
> # 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_DRIVERS=y
> # CONFIG_SND_PCSP is not set
> # CONFIG_SND_DUMMY is not set
> # CONFIG_SND_VIRMIDI is not set
> # CONFIG_SND_SERIAL_U16550 is not set
> # CONFIG_SND_MPU401 is not set
> CONFIG_SND_PCI=y
> # CONFIG_SND_AD1889 is not set
> # CONFIG_SND_ALS300 is not set
> # CONFIG_SND_ALS4000 is not set
> # CONFIG_SND_ALI5451 is not set
> # CONFIG_SND_ATIIXP is not set
> # CONFIG_SND_ATIIXP_MODEM is not set
> # CONFIG_SND_AU8810 is not set
> # CONFIG_SND_AU8820 is not set
> # CONFIG_SND_AU8830 is not set
> # CONFIG_SND_AW2 is not set
> # CONFIG_SND_AZT3328 is not set
> # CONFIG_SND_BT87X is not set
> # CONFIG_SND_CA0106 is not set
> # CONFIG_SND_CMIPCI is not set
> # CONFIG_SND_OXYGEN is not set
> # CONFIG_SND_CS4281 is not set
> # CONFIG_SND_CS46XX is not set
> # CONFIG_SND_CS5530 is not set
> # CONFIG_SND_CS5535AUDIO is not set
> # CONFIG_SND_CTXFI is not set
> # CONFIG_SND_DARLA20 is not set
> # CONFIG_SND_GINA20 is not set
> # CONFIG_SND_LAYLA20 is not set
> # CONFIG_SND_DARLA24 is not set
> # CONFIG_SND_GINA24 is not set
> # CONFIG_SND_LAYLA24 is not set
> # CONFIG_SND_MONA is not set
> # CONFIG_SND_MIA is not set
> # CONFIG_SND_ECHO3G is not set
> # CONFIG_SND_INDIGO is not set
> # CONFIG_SND_INDIGOIO is not set
> # CONFIG_SND_INDIGODJ is not set
> # CONFIG_SND_INDIGOIOX is not set
> # CONFIG_SND_INDIGODJX is not set
> # CONFIG_SND_EMU10K1 is not set
> # CONFIG_SND_EMU10K1X is not set
> # CONFIG_SND_ENS1370 is not set
> # CONFIG_SND_ENS1371 is not set
> # CONFIG_SND_ES1938 is not set
> # CONFIG_SND_ES1968 is not set
> # CONFIG_SND_FM801 is not set
> CONFIG_SND_HDA_INTEL=y
> CONFIG_SND_HDA_HWDEP=y
> # CONFIG_SND_HDA_RECONFIG is not set
> # CONFIG_SND_HDA_INPUT_BEEP is not set
> # CONFIG_SND_HDA_INPUT_JACK is not set
> CONFIG_SND_HDA_CODEC_REALTEK=y
> CONFIG_SND_HDA_CODEC_ANALOG=y
> CONFIG_SND_HDA_CODEC_SIGMATEL=y
> CONFIG_SND_HDA_CODEC_VIA=y
> CONFIG_SND_HDA_CODEC_ATIHDMI=y
> CONFIG_SND_HDA_CODEC_NVHDMI=y
> CONFIG_SND_HDA_CODEC_INTELHDMI=y
> CONFIG_SND_HDA_ELD=y
> CONFIG_SND_HDA_CODEC_CONEXANT=y
> CONFIG_SND_HDA_CODEC_CA0110=y
> CONFIG_SND_HDA_CODEC_CMEDIA=y
> CONFIG_SND_HDA_CODEC_SI3054=y
> CONFIG_SND_HDA_GENERIC=y
> # CONFIG_SND_HDA_POWER_SAVE is not set
> # CONFIG_SND_HDSP is not set
> # CONFIG_SND_HDSPM is not set
> # CONFIG_SND_HIFIER is not set
> # CONFIG_SND_ICE1712 is not set
> # CONFIG_SND_ICE1724 is not set
> # CONFIG_SND_INTEL8X0 is not set
> # CONFIG_SND_INTEL8X0M is not set
> # CONFIG_SND_KORG1212 is not set
> # CONFIG_SND_LX6464ES is not set
> # CONFIG_SND_MAESTRO3 is not set
> # CONFIG_SND_MIXART is not set
> # CONFIG_SND_NM256 is not set
> # CONFIG_SND_PCXHR is not set
> # CONFIG_SND_RIPTIDE is not set
> # CONFIG_SND_RME32 is not set
> # CONFIG_SND_RME96 is not set
> # CONFIG_SND_RME9652 is not set
> # CONFIG_SND_SIS7019 is not set
> # CONFIG_SND_SONICVIBES is not set
> # CONFIG_SND_TRIDENT is not set
> # CONFIG_SND_VIA82XX is not set
> # CONFIG_SND_VIA82XX_MODEM is not set
> # CONFIG_SND_VIRTUOSO is not set
> # CONFIG_SND_VX222 is not set
> # CONFIG_SND_YMFPCI is not set
> CONFIG_SND_USB=y
> # CONFIG_SND_USB_AUDIO is not set
> # CONFIG_SND_USB_USX2Y is not set
> # CONFIG_SND_USB_CAIAQ is not set
> # CONFIG_SND_USB_US122L is not set
> CONFIG_SND_PCMCIA=y
> # CONFIG_SND_VXPOCKET is not set
> # CONFIG_SND_PDAUDIOCF is not set
> # CONFIG_SND_SOC is not set
> # CONFIG_SOUND_PRIME 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=y
> CONFIG_HID_APPLE=y
> CONFIG_HID_BELKIN=y
> CONFIG_HID_CHERRY=y
> CONFIG_HID_CHICONY=y
> CONFIG_HID_CYPRESS=y
> CONFIG_HID_DRAGONRISE=y
> # CONFIG_DRAGONRISE_FF is not set
> CONFIG_HID_EZKEY=y
> CONFIG_HID_KYE=y
> CONFIG_HID_GYRATION=y
> CONFIG_HID_KENSINGTON=y
> 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=y
> # CONFIG_SMARTJOYPLUS_FF is not set
> CONFIG_HID_TOPSEED=y
> CONFIG_HID_THRUSTMASTER=y
> CONFIG_THRUSTMASTER_FF=y
> 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=y
> # CONFIG_USB_DEVICE_CLASS is not set
> # CONFIG_USB_DYNAMIC_MINORS is not set
> CONFIG_USB_SUSPEND=y
> # CONFIG_USB_OTG 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 is not set
> # CONFIG_USB_XHCI_HCD is not set
> CONFIG_USB_EHCI_HCD=y
> # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
> # 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 is not set
> CONFIG_USB_OHCI_HCD=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 is not set
> # CONFIG_USB_R8A66597_HCD is not set
> # CONFIG_USB_HWA_HCD is not set
> 
> #
> # USB Device Class drivers
> #
> # CONFIG_USB_ACM is not set
> CONFIG_USB_PRINTER=y
> # CONFIG_USB_WDM is not set
> # 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=y
> # CONFIG_USB_STORAGE_DEBUG is not set
> # CONFIG_USB_STORAGE_DATAFAB is not set
> # CONFIG_USB_STORAGE_FREECOM is not set
> # CONFIG_USB_STORAGE_ISD200 is not set
> # CONFIG_USB_STORAGE_USBAT is not set
> # CONFIG_USB_STORAGE_SDDR09 is not set
> # CONFIG_USB_STORAGE_SDDR55 is not set
> # CONFIG_USB_STORAGE_JUMPSHOT is not set
> # CONFIG_USB_STORAGE_ALAUDA is not set
> # CONFIG_USB_STORAGE_ONETOUCH is not set
> # CONFIG_USB_STORAGE_KARMA is not set
> # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
> CONFIG_USB_LIBUSUAL=y
> 
> #
> # USB Imaging devices
> #
> # CONFIG_USB_MDC800 is not set
> # CONFIG_USB_MICROTEK is not set
> 
> #
> # USB port drivers
> #
> # CONFIG_USB_SERIAL is not set
> 
> #
> # USB Miscellaneous drivers
> #
> # CONFIG_USB_EMI62 is not set
> # CONFIG_USB_EMI26 is not set
> # CONFIG_USB_ADUTUX is not set
> # CONFIG_USB_SEVSEG is not set
> # CONFIG_USB_RIO500 is not set
> # CONFIG_USB_LEGOTOWER is not set
> # CONFIG_USB_LCD is not set
> # CONFIG_USB_BERRY_CHARGE is not set
> # CONFIG_USB_LED is not set
> # CONFIG_USB_CYPRESS_CY7C63 is not set
> # CONFIG_USB_CYTHERM is not set
> # CONFIG_USB_IDMOUSE is not set
> # CONFIG_USB_FTDI_ELAN is not set
> # CONFIG_USB_APPLEDISPLAY is not set
> # CONFIG_USB_SISUSBVGA is not set
> # CONFIG_USB_LD is not set
> # CONFIG_USB_TRANCEVIBRATOR is not set
> # CONFIG_USB_IOWARRIOR is not set
> # CONFIG_USB_TEST is not set
> # CONFIG_USB_ISIGHTFW is not set
> # CONFIG_USB_VST is not set
> 
> #
> # OTG and related infrastructure
> #
> # CONFIG_NOP_USB_XCEIV is not set
> # CONFIG_UWB is not set
> # CONFIG_MMC is not set
> # CONFIG_MEMSTICK is not set
> CONFIG_NEW_LEDS=y
> CONFIG_LEDS_CLASS=y
> 
> #
> # LED drivers
> #
> # CONFIG_LEDS_ALIX2 is not set
> # CONFIG_LEDS_PCA9532 is not set
> # CONFIG_LEDS_LP3944 is not set
> # CONFIG_LEDS_CLEVO_MAIL is not set
> # CONFIG_LEDS_PCA955X is not set
> # CONFIG_LEDS_BD2802 is not set
> 
> #
> # LED Triggers
> #
> CONFIG_LEDS_TRIGGERS=y
> # CONFIG_LEDS_TRIGGER_TIMER is not set
> # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
> # CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
> # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
> 
> #
> # iptables trigger is under Netfilter config (LED target)
> #
> # CONFIG_ACCESSIBILITY is not set
> # CONFIG_INFINIBAND is not set
> CONFIG_EDAC=y
> 
> #
> # Reporting subsystems
> #
> # CONFIG_EDAC_DEBUG is not set
> # CONFIG_EDAC_MM_EDAC is not set
> CONFIG_RTC_LIB=y
> CONFIG_RTC_CLASS=y
> # CONFIG_RTC_HCTOSYS is not set
> # CONFIG_RTC_DEBUG is not set
> 
> #
> # RTC interfaces
> #
> CONFIG_RTC_INTF_SYSFS=y
> CONFIG_RTC_INTF_PROC=y
> CONFIG_RTC_INTF_DEV=y
> # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
> # CONFIG_RTC_DRV_TEST is not set
> 
> #
> # I2C RTC drivers
> #
> # CONFIG_RTC_DRV_DS1307 is not set
> # CONFIG_RTC_DRV_DS1374 is not set
> # CONFIG_RTC_DRV_DS1672 is not set
> # CONFIG_RTC_DRV_MAX6900 is not set
> # CONFIG_RTC_DRV_RS5C372 is not set
> # CONFIG_RTC_DRV_ISL1208 is not set
> # CONFIG_RTC_DRV_X1205 is not set
> # CONFIG_RTC_DRV_PCF8563 is not set
> # CONFIG_RTC_DRV_PCF8583 is not set
> # CONFIG_RTC_DRV_M41T80 is not set
> # CONFIG_RTC_DRV_S35390A is not set
> # CONFIG_RTC_DRV_FM3130 is not set
> # CONFIG_RTC_DRV_RX8581 is not set
> # CONFIG_RTC_DRV_RX8025 is not set
> 
> #
> # SPI RTC drivers
> #
> 
> #
> # Platform RTC drivers
> #
> CONFIG_RTC_DRV_CMOS=y
> # CONFIG_RTC_DRV_DS1286 is not set
> # CONFIG_RTC_DRV_DS1511 is not set
> # CONFIG_RTC_DRV_DS1553 is not set
> # CONFIG_RTC_DRV_DS1742 is not set
> # CONFIG_RTC_DRV_STK17TA8 is not set
> # CONFIG_RTC_DRV_M48T86 is not set
> # CONFIG_RTC_DRV_M48T35 is not set
> # CONFIG_RTC_DRV_M48T59 is not set
> # CONFIG_RTC_DRV_BQ4802 is not set
> # CONFIG_RTC_DRV_V3020 is not set
> 
> #
> # on-CPU RTC drivers
> #
> CONFIG_DMADEVICES=y
> 
> #
> # DMA Devices
> #
> # CONFIG_INTEL_IOATDMA is not set
> # CONFIG_AUXDISPLAY is not set
> # CONFIG_UIO is not set
> 
> #
> # TI VLYNQ
> #
> CONFIG_X86_PLATFORM_DEVICES=y
> # CONFIG_ACER_WMI is not set
> # CONFIG_ASUS_LAPTOP is not set
> # CONFIG_FUJITSU_LAPTOP is not set
> # CONFIG_TC1100_WMI is not set
> # CONFIG_MSI_LAPTOP is not set
> # CONFIG_PANASONIC_LAPTOP is not set
> # CONFIG_COMPAL_LAPTOP is not set
> # CONFIG_SONY_LAPTOP is not set
> # CONFIG_THINKPAD_ACPI is not set
> # CONFIG_INTEL_MENLOW is not set
> CONFIG_EEEPC_LAPTOP=y
> # CONFIG_ACPI_WMI is not set
> # CONFIG_ACPI_ASUS is not set
> # CONFIG_ACPI_TOSHIBA is not set
> 
> #
> # Firmware Drivers
> #
> # CONFIG_EDD is not set
> CONFIG_FIRMWARE_MEMMAP=y
> CONFIG_EFI_VARS=y
> # CONFIG_DELL_RBU is not set
> # CONFIG_DCDBAS is not set
> CONFIG_DMIID=y
> # CONFIG_ISCSI_IBFT_FIND is not set
> 
> #
> # File systems
> #
> # CONFIG_EXT2_FS is not set
> CONFIG_EXT3_FS=y
> # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
> CONFIG_EXT3_FS_XATTR=y
> CONFIG_EXT3_FS_POSIX_ACL=y
> CONFIG_EXT3_FS_SECURITY=y
> # CONFIG_EXT4_FS is not set
> CONFIG_JBD=y
> # CONFIG_JBD_DEBUG is not set
> CONFIG_FS_MBCACHE=y
> # CONFIG_REISERFS_FS is not set
> # CONFIG_JFS_FS is not set
> CONFIG_FS_POSIX_ACL=y
> # CONFIG_XFS_FS is not set
> # CONFIG_GFS2_FS is not set
> # CONFIG_OCFS2_FS is not set
> # CONFIG_BTRFS_FS is not set
> CONFIG_FILE_LOCKING=y
> CONFIG_FSNOTIFY=y
> CONFIG_DNOTIFY=y
> 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 is not set
> CONFIG_AUTOFS4_FS=y
> # CONFIG_FUSE_FS is not set
> CONFIG_GENERIC_ACL=y
> 
> #
> # Caches
> #
> # CONFIG_FSCACHE is not set
> 
> #
> # 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 is not set
> 
> #
> # Pseudo filesystems
> #
> CONFIG_PROC_FS=y
> CONFIG_PROC_KCORE=y
> CONFIG_PROC_VMCORE=y
> 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 is not set
> CONFIG_MISC_FILESYSTEMS=y
> # CONFIG_ADFS_FS is not set
> # CONFIG_AFFS_FS is not set
> # CONFIG_ECRYPT_FS is not set
> # CONFIG_HFS_FS is not set
> # CONFIG_HFSPLUS_FS is not set
> # CONFIG_BEFS_FS is not set
> # CONFIG_BFS_FS is not set
> # CONFIG_EFS_FS is not set
> # CONFIG_CRAMFS is not set
> # CONFIG_SQUASHFS is not set
> # CONFIG_VXFS_FS is not set
> # CONFIG_MINIX_FS is not set
> # CONFIG_OMFS_FS is not set
> # CONFIG_HPFS_FS is not set
> # CONFIG_QNX4FS_FS is not set
> # CONFIG_ROMFS_FS is not set
> # CONFIG_SYSV_FS is not set
> # CONFIG_UFS_FS is not set
> # CONFIG_NILFS2_FS is not set
> CONFIG_NETWORK_FILESYSTEMS=y
> CONFIG_NFS_FS=y
> CONFIG_NFS_V3=y
> CONFIG_NFS_V3_ACL=y
> CONFIG_NFS_V4=y
> # CONFIG_NFS_V4_1 is not set
> CONFIG_ROOT_NFS=y
> # CONFIG_NFSD is not set
> CONFIG_LOCKD=y
> CONFIG_LOCKD_V4=y
> CONFIG_NFS_ACL_SUPPORT=y
> CONFIG_NFS_COMMON=y
> CONFIG_SUNRPC=y
> CONFIG_SUNRPC_GSS=y
> CONFIG_RPCSEC_GSS_KRB5=y
> # CONFIG_RPCSEC_GSS_SPKM3 is not set
> # CONFIG_SMB_FS is not set
> # CONFIG_CIFS is not set
> # CONFIG_NCP_FS is not set
> # CONFIG_CODA_FS is not set
> # CONFIG_AFS_FS is not set
> 
> #
> # Partition Types
> #
> CONFIG_PARTITION_ADVANCED=y
> # CONFIG_ACORN_PARTITION is not set
> CONFIG_OSF_PARTITION=y
> CONFIG_AMIGA_PARTITION=y
> # CONFIG_ATARI_PARTITION is not set
> 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 is not set
> CONFIG_SUN_PARTITION=y
> CONFIG_KARMA_PARTITION=y
> CONFIG_EFI_PARTITION=y
> # CONFIG_SYSV68_PARTITION is not set
> CONFIG_NLS=y
> CONFIG_NLS_DEFAULT="utf8"
> CONFIG_NLS_CODEPAGE_437=y
> # CONFIG_NLS_CODEPAGE_737 is not set
> # CONFIG_NLS_CODEPAGE_775 is not set
> # CONFIG_NLS_CODEPAGE_850 is not set
> # CONFIG_NLS_CODEPAGE_852 is not set
> # CONFIG_NLS_CODEPAGE_855 is not set
> # CONFIG_NLS_CODEPAGE_857 is not set
> # CONFIG_NLS_CODEPAGE_860 is not set
> # CONFIG_NLS_CODEPAGE_861 is not set
> # CONFIG_NLS_CODEPAGE_862 is not set
> # CONFIG_NLS_CODEPAGE_863 is not set
> # CONFIG_NLS_CODEPAGE_864 is not set
> # CONFIG_NLS_CODEPAGE_865 is not set
> # CONFIG_NLS_CODEPAGE_866 is not set
> # CONFIG_NLS_CODEPAGE_869 is not set
> # CONFIG_NLS_CODEPAGE_936 is not set
> # CONFIG_NLS_CODEPAGE_950 is not set
> # CONFIG_NLS_CODEPAGE_932 is not set
> # CONFIG_NLS_CODEPAGE_949 is not set
> # CONFIG_NLS_CODEPAGE_874 is not set
> # CONFIG_NLS_ISO8859_8 is not set
> # CONFIG_NLS_CODEPAGE_1250 is not set
> # CONFIG_NLS_CODEPAGE_1251 is not set
> CONFIG_NLS_ASCII=y
> CONFIG_NLS_ISO8859_1=y
> # CONFIG_NLS_ISO8859_2 is not set
> # CONFIG_NLS_ISO8859_3 is not set
> # CONFIG_NLS_ISO8859_4 is not set
> # CONFIG_NLS_ISO8859_5 is not set
> # CONFIG_NLS_ISO8859_6 is not set
> # CONFIG_NLS_ISO8859_7 is not set
> # CONFIG_NLS_ISO8859_9 is not set
> # CONFIG_NLS_ISO8859_13 is not set
> # CONFIG_NLS_ISO8859_14 is not set
> # CONFIG_NLS_ISO8859_15 is not set
> # CONFIG_NLS_KOI8_R is not set
> # CONFIG_NLS_KOI8_U is not set
> CONFIG_NLS_UTF8=y
> # CONFIG_DLM is not set
> 
> #
> # Kernel hacking
> #
> CONFIG_TRACE_IRQFLAGS_SUPPORT=y
> CONFIG_PRINTK_TIME=y
> CONFIG_ALLOW_WARNINGS=y
> # CONFIG_ENABLE_WARN_DEPRECATED is not set
> CONFIG_ENABLE_MUST_CHECK=y
> CONFIG_FRAME_WARN=2048
> CONFIG_MAGIC_SYSRQ=y
> # CONFIG_UNUSED_SYMBOLS is not set
> CONFIG_DEBUG_FS=y
> # CONFIG_HEADERS_CHECK is not set
> # CONFIG_DEBUG_SECTION_MISMATCH is not set
> CONFIG_DEBUG_KERNEL=y
> # CONFIG_DEBUG_SHIRQ is not set
> # CONFIG_DETECT_SOFTLOCKUP is not set
> # CONFIG_DETECT_HUNG_TASK is not set
> # CONFIG_SCHED_DEBUG is not set
> CONFIG_SCHEDSTATS=y
> CONFIG_TIMER_STATS=y
> # CONFIG_DEBUG_OBJECTS is not set
> # CONFIG_SLUB_DEBUG_ON is not set
> # CONFIG_SLUB_STATS is not set
> # CONFIG_DEBUG_RT_MUTEXES is not set
> # CONFIG_RT_MUTEX_TESTER is not set
> # CONFIG_DEBUG_SPINLOCK is not set
> # CONFIG_DEBUG_MUTEXES is not set
> # CONFIG_DEBUG_LOCK_ALLOC is not set
> # CONFIG_PROVE_LOCKING is not set
> # CONFIG_LOCK_STAT is not set
> # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
> # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
> CONFIG_STACKTRACE=y
> # CONFIG_DEBUG_HIGHMEM is not set
> CONFIG_DEBUG_BUGVERBOSE=y
> # CONFIG_DEBUG_VM is not set
> # CONFIG_DEBUG_VIRTUAL is not set
> # CONFIG_DEBUG_WRITECOUNT is not set
> CONFIG_DEBUG_MEMORY_INIT=y
> # CONFIG_DEBUG_LIST is not set
> # CONFIG_DEBUG_SG is not set
> # CONFIG_DEBUG_NOTIFIERS is not set
> CONFIG_ARCH_WANT_FRAME_POINTERS=y
> CONFIG_FRAME_POINTER=y
> # CONFIG_BOOT_PRINTK_DELAY is not set
> # CONFIG_RCU_TORTURE_TEST is not set
> # CONFIG_RCU_CPU_STALL_DETECTOR is not set
> # CONFIG_KPROBES_SANITY_TEST is not set
> # CONFIG_BACKTRACE_SELF_TEST is not set
> # CONFIG_LKDTM is not set
> # CONFIG_FAULT_INJECTION is not set
> # CONFIG_LATENCYTOP is not set
> CONFIG_SYSCTL_SYSCALL_CHECK=y
> # CONFIG_DEBUG_PAGEALLOC is not set
> CONFIG_USER_STACKTRACE_SUPPORT=y
> CONFIG_NOP_TRACER=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_RING_BUFFER=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 is not set
> # CONFIG_IRQSOFF_TRACER is not set
> # CONFIG_SYSPROF_TRACER is not set
> # CONFIG_SCHED_TRACER is not set
> # CONFIG_FTRACE_SYSCALLS is not set
> # 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 is not set
> # CONFIG_KMEMTRACE is not set
> # CONFIG_WORKQUEUE_TRACER is not set
> CONFIG_BLK_DEV_IO_TRACE=y
> # CONFIG_FTRACE_STARTUP_TEST is not set
> # CONFIG_MMIOTRACE is not set
> # CONFIG_RING_BUFFER_BENCHMARK is not set
> CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
> # CONFIG_DYNAMIC_DEBUG is not set
> # CONFIG_DMA_API_DEBUG is not set
> # CONFIG_SAMPLES is not set
> CONFIG_HAVE_ARCH_KGDB=y
> # CONFIG_KGDB is not set
> CONFIG_HAVE_ARCH_KMEMCHECK=y
> # CONFIG_STRICT_DEVMEM is not set
> CONFIG_X86_VERBOSE_BOOTUP=y
> CONFIG_EARLY_PRINTK=y
> CONFIG_EARLY_PRINTK_DBGP=y
> CONFIG_DEBUG_STACKOVERFLOW=y
> CONFIG_DEBUG_STACK_USAGE=y
> # CONFIG_DEBUG_PER_CPU_MAPS is not set
> # CONFIG_X86_PTDUMP is not set
> CONFIG_DEBUG_RODATA=y
> # CONFIG_DEBUG_RODATA_TEST is not set
> CONFIG_DEBUG_NX_TEST=m
> # 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=y
> 
> #
> # Security options
> #
> CONFIG_KEYS=y
> CONFIG_KEYS_DEBUG_PROC_KEYS=y
> CONFIG_SECURITY=y
> # CONFIG_SECURITYFS is not set
> CONFIG_SECURITY_NETWORK=y
> # CONFIG_SECURITY_NETWORK_XFRM is not set
> # CONFIG_SECURITY_PATH is not set
> CONFIG_SECURITY_FILE_CAPABILITIES=y
> CONFIG_SECURITY_SELINUX=y
> CONFIG_SECURITY_SELINUX_BOOTPARAM=y
> CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
> CONFIG_SECURITY_SELINUX_DISABLE=y
> CONFIG_SECURITY_SELINUX_DEVELOP=y
> CONFIG_SECURITY_SELINUX_AVC_STATS=y
> CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
> # CONFIG_SECURITY_TOMOYO is not set
> # CONFIG_IMA is not set
> CONFIG_CRYPTO=y
> 
> #
> # Crypto core or helper
> #
> # CONFIG_CRYPTO_FIPS is not set
> 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_RNG2=y
> CONFIG_CRYPTO_PCOMP=y
> CONFIG_CRYPTO_MANAGER=y
> CONFIG_CRYPTO_MANAGER2=y
> # CONFIG_CRYPTO_GF128MUL is not set
> # CONFIG_CRYPTO_NULL is not set
> CONFIG_CRYPTO_WORKQUEUE=y
> # CONFIG_CRYPTO_CRYPTD is not set
> CONFIG_CRYPTO_AUTHENC=y
> # CONFIG_CRYPTO_TEST is not set
> 
> #
> # Authenticated Encryption with Associated Data
> #
> # CONFIG_CRYPTO_CCM is not set
> # CONFIG_CRYPTO_GCM is not set
> # CONFIG_CRYPTO_SEQIV is not set
> 
> #
> # Block modes
> #
> CONFIG_CRYPTO_CBC=y
> # CONFIG_CRYPTO_CTR is not set
> # CONFIG_CRYPTO_CTS is not set
> CONFIG_CRYPTO_ECB=y
> # CONFIG_CRYPTO_LRW is not set
> # CONFIG_CRYPTO_PCBC is not set
> # CONFIG_CRYPTO_XTS is not set
> 
> #
> # Hash modes
> #
> CONFIG_CRYPTO_HMAC=y
> # CONFIG_CRYPTO_XCBC is not set
> 
> #
> # Digest
> #
> # CONFIG_CRYPTO_CRC32C is not set
> # CONFIG_CRYPTO_CRC32C_INTEL is not set
> # CONFIG_CRYPTO_MD4 is not set
> CONFIG_CRYPTO_MD5=y
> # CONFIG_CRYPTO_MICHAEL_MIC is not set
> # CONFIG_CRYPTO_RMD128 is not set
> # CONFIG_CRYPTO_RMD160 is not set
> # CONFIG_CRYPTO_RMD256 is not set
> # CONFIG_CRYPTO_RMD320 is not set
> 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 is not set
> 
> #
> # Ciphers
> #
> CONFIG_CRYPTO_AES=y
> CONFIG_CRYPTO_AES_586=y
> # CONFIG_CRYPTO_ANUBIS is not set
> CONFIG_CRYPTO_ARC4=y
> # CONFIG_CRYPTO_BLOWFISH is not set
> # CONFIG_CRYPTO_CAMELLIA is not set
> # CONFIG_CRYPTO_CAST5 is not set
> # CONFIG_CRYPTO_CAST6 is not set
> CONFIG_CRYPTO_DES=y
> # CONFIG_CRYPTO_FCRYPT is not set
> # CONFIG_CRYPTO_KHAZAD is not set
> # CONFIG_CRYPTO_SALSA20 is not set
> # CONFIG_CRYPTO_SALSA20_586 is not set
> # CONFIG_CRYPTO_SEED is not set
> # CONFIG_CRYPTO_SERPENT is not set
> # CONFIG_CRYPTO_TEA is not set
> # CONFIG_CRYPTO_TWOFISH is not set
> # CONFIG_CRYPTO_TWOFISH_586 is not set
> 
> #
> # Compression
> #
> # CONFIG_CRYPTO_DEFLATE is not set
> # CONFIG_CRYPTO_ZLIB is not set
> # 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 is not set
> CONFIG_HAVE_KVM=y
> CONFIG_HAVE_KVM_IRQCHIP=y
> CONFIG_VIRTUALIZATION=y
> # CONFIG_KVM is not set
> # CONFIG_LGUEST is not set
> # CONFIG_VIRTIO_PCI is not set
> # CONFIG_VIRTIO_BALLOON is not set
> 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 is not set
> # CONFIG_CRC16 is not set
> CONFIG_CRC_T10DIF=y
> # CONFIG_CRC_ITU_T is not set
> CONFIG_CRC32=y
> # CONFIG_CRC7 is not set
> # CONFIG_LIBCRC32C is not set
> CONFIG_AUDIT_GENERIC=y
> CONFIG_ZLIB_INFLATE=y
> CONFIG_DECOMPRESS_GZIP=y
> CONFIG_DECOMPRESS_BZIP2=y
> CONFIG_DECOMPRESS_LZMA=y
> CONFIG_HAS_IOMEM=y
> CONFIG_HAS_IOPORT=y
> CONFIG_HAS_DMA=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] 1150+ messages in thread

* Re: [tip:core/rcu] rcu: Add second diagnostic check for a possible CPU-hotplug race
  2009-08-09 18:30                                 ` Paul E. McKenney
@ 2009-08-09 19:23                                   ` Paul E. McKenney
  0 siblings, 0 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2009-08-09 19:23 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, tglx, linux-tip-commits

On Sun, Aug 09, 2009 at 11:30:10AM -0700, Paul E. McKenney wrote:
> On Sun, Aug 09, 2009 at 01:10:08PM +0200, Ingo Molnar wrote:
> > 
> > * Ingo Molnar <mingo@elte.hu> wrote:
> > 
> > > > rcu: Add second diagnostic check for a possible CPU-hotplug race
> > > 
> > > has a build problem too:
> > > 
> > >  kernel/built-in.o: In function `rcu_cpu_notified':
> > >  (.text+0x1d787): undefined reference to `cpu_notified'
> > >  kernel/built-in.o: In function `rcu_init':
> > >  (.init.text+0x1174): undefined reference to `cpu_notified'
> > >  kernel/built-in.o: In function `rcu_init':
> > >  (.init.text+0x11a8): undefined reference to `cpu_notified'
> > > 
> > > Maybe we should simplify all those Kconfig rules? It's a maze.
> 
> Or I could fix up my scripts so that I once again test the relevant
> combinations -before- I submit the patch.  :-/

That said, I could imagine the following simplifications:

o	CONFIG_SMP always implies CONFIG_HOTPLUG_CPU, eliminating the
	need to test CONFIG_SMP&&!CONFIG_HOTPLUG_CPU.

o	Make CONFIG_NO_HZ unconditional.  (Now, -that- should get a
	reaction!  For one thing, I am not sure that all architectures
	support CONFIG_NO_HZ.)

o	Eliminate the combination CONFIG_PREEMPT && CONFIG_TREE_RCU.
	In other words, make a preemptable kernel imply preemptable RCU
	and vice versa.

o	After sufficient testing, eliminate CONFIG_PREEMPT_RCU in favor
	of CONFIG_TREE_PREEMPT_RCU (currently under development).

o	After sufficient testing, make !CONFIG_SMP imply
	CONFIG_TINY_RCU.  This might require a preemptable variant of
	CONFIG_TINY_RCU.

There are probably quite a few similar simplifications.

							Thanx, Paul

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

* [tip:perfcounters/urgent] perf_counter, x86: Fix lapic printk message
       [not found]             ` <new-submission>
                                 ` (293 preceding siblings ...)
  2009-08-06 18:27               ` tip-bot for Arnaldo Carvalho de Melo
@ 2009-08-11 11:33               ` tip-bot for Ingo Molnar
  2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix generic cache events on P6-mobile CPUs tip-bot for Ingo Molnar
                                 ` (411 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-11 11:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, fweisbec,
	tglx, mingo

Commit-ID:  3c581a7f94542341bf0da496a226b44ac63521a8
Gitweb:     http://git.kernel.org/tip/3c581a7f94542341bf0da496a226b44ac63521a8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 11 Aug 2009 10:47:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 11 Aug 2009 10:58:25 +0200

perf_counter, x86: Fix lapic printk message

Instead of this garbled bootup on UP Pentium-M systems:

[    0.015048] Performance Counters:
[    0.016004] no Local APIC, try rebooting with lapicno PMU driver, software counters only.

Print:

[    0.015050] Performance Counters:
[    0.016004] no APIC, boot with the "lapic" boot parameter to force-enable it.
[    0.017003] no PMU driver, software counters only.

Cf: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
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>


---
 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 a7aa8f9..40e233a 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1590,7 +1590,7 @@ static int p6_pmu_init(void)
 	}
 
 	if (!cpu_has_apic) {
-		pr_info("no Local APIC, try rebooting with lapic");
+		pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
 		return -ENODEV;
 	}
 

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

* [tip:perfcounters/urgent] perf_counter, x86: Fix generic cache events on P6-mobile CPUs
       [not found]             ` <new-submission>
                                 ` (294 preceding siblings ...)
  2009-08-11 11:33               ` [tip:perfcounters/urgent] perf_counter, x86: Fix lapic printk message tip-bot for Ingo Molnar
@ 2009-08-11 11:34               ` tip-bot for Ingo Molnar
  2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback tip-bot for Ingo Molnar
                                 ` (410 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-11 11:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo, js

Commit-ID:  f64ccccb8afa43abdd63fcbd230f818d6ea0883f
Gitweb:     http://git.kernel.org/tip/f64ccccb8afa43abdd63fcbd230f818d6ea0883f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 11 Aug 2009 10:26:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 11 Aug 2009 11:35:26 +0200

perf_counter, x86: Fix generic cache events on P6-mobile CPUs

Johannes Stezenbach reported that 'perf stat' does not count
cache-miss and cache-references events on his Pentium-M based
laptop.

This is because we left them blank in p6_perfmon_event_map[],
fill them in.

Reported-by: Johannes Stezenbach <js@sig21.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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 40e233a..fffc126 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -72,8 +72,8 @@ static const u64 p6_perfmon_event_map[] =
 {
   [PERF_COUNT_HW_CPU_CYCLES]		= 0x0079,
   [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0000,
-  [PERF_COUNT_HW_CACHE_MISSES]		= 0x0000,
+  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0f2e,
+  [PERF_COUNT_HW_CACHE_MISSES]		= 0x012e,
   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
   [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
   [PERF_COUNT_HW_BUS_CYCLES]		= 0x0062,

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

* [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback
       [not found]             ` <new-submission>
                                 ` (295 preceding siblings ...)
  2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix generic cache events on P6-mobile CPUs tip-bot for Ingo Molnar
@ 2009-08-11 11:34               ` tip-bot for Ingo Molnar
  2009-08-11 16:23                 ` Johannes Stezenbach
  2009-08-12 12:18               ` tip-bot for Ingo Molnar
                                 ` (409 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-11 11:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo, js

Commit-ID:  83f19150242ee57730a4331b6ae9a9b90ccc718c
Gitweb:     http://git.kernel.org/tip/83f19150242ee57730a4331b6ae9a9b90ccc718c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 11 Aug 2009 10:40:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 11 Aug 2009 13:19:07 +0200

perf_counter, x86: Fix/improve apic fallback

Johannes Stezenbach reported that his Pentium-M based
laptop does not have the local APIC enabled by default,
and hence perfcounters do not get initialized.

Add a fallback for this case: allow non-sampled counters
and return with an error on sampled counters. This allows
'perf stat' to work out of box - and allows 'perf top'
and 'perf record' to fall back on a hrtimer based sampling
method.

( Passing 'lapic' on the boot line will allow hardware
  sampling to occur - but if the APIC is disabled
  permanently by the hardware then this fallback still
  allows more systems to use perfcounters. )

Also decouple perfcounter support from X86_LOCAL_APIC.

Reported-by: Johannes Stezenbach <js@sig21.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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 738bdc6..13ffa5d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_IDE
 	select HAVE_OPROFILE
+	select HAVE_PERF_COUNTERS if (!M386 && !M486)
 	select HAVE_IOREMAP_PROT
 	select HAVE_KPROBES
 	select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -742,7 +743,6 @@ config X86_UP_IOAPIC
 config X86_LOCAL_APIC
 	def_bool y
 	depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC
-	select HAVE_PERF_COUNTERS if (!M386 && !M486)
 
 config X86_IO_APIC
 	def_bool y
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index fffc126..7644186 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -55,6 +55,7 @@ struct x86_pmu {
 	int		num_counters_fixed;
 	int		counter_bits;
 	u64		counter_mask;
+	int		apic;
 	u64		max_period;
 	u64		intel_ctrl;
 };
@@ -613,6 +614,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
 
 static bool reserve_pmc_hardware(void)
 {
+#ifdef X86_LOCAL_APIC
 	int i;
 
 	if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -627,9 +629,11 @@ static bool reserve_pmc_hardware(void)
 		if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
 			goto eventsel_fail;
 	}
+#endif
 
 	return true;
 
+#ifdef X86_LOCAL_APIC
 eventsel_fail:
 	for (i--; i >= 0; i--)
 		release_evntsel_nmi(x86_pmu.eventsel + i);
@@ -644,10 +648,12 @@ perfctr_fail:
 		enable_lapic_nmi_watchdog();
 
 	return false;
+#endif
 }
 
 static void release_pmc_hardware(void)
 {
+#ifdef X86_LOCAL_APIC
 	int i;
 
 	for (i = 0; i < x86_pmu.num_counters; i++) {
@@ -657,6 +663,7 @@ static void release_pmc_hardware(void)
 
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		enable_lapic_nmi_watchdog();
+#endif
 }
 
 static void hw_perf_counter_destroy(struct perf_counter *counter)
@@ -748,6 +755,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 		hwc->sample_period = x86_pmu.max_period;
 		hwc->last_period = hwc->sample_period;
 		atomic64_set(&hwc->period_left, hwc->sample_period);
+	} else {
+		/*
+		 * If we have a PMU initialized but no APIC
+		 * interrupts, we cannot sample hardware
+		 * counters (user-space has to fall back and
+		 * sample via a hrtimer based software counter):
+		 */
+		if (!x86_pmu.apic)
+			return -EOPNOTSUPP;
 	}
 
 	counter->destroy = hw_perf_counter_destroy;
@@ -1449,18 +1465,22 @@ void smp_perf_pending_interrupt(struct pt_regs *regs)
 
 void set_perf_counter_pending(void)
 {
+#ifdef X86_LOCAL_APIC
 	apic->send_IPI_self(LOCAL_PENDING_VECTOR);
+#endif
 }
 
 void perf_counters_lapic_init(void)
 {
-	if (!x86_pmu_initialized())
+#ifdef X86_LOCAL_APIC
+	if (!x86_pmu.apic || !x86_pmu_initialized())
 		return;
 
 	/*
 	 * Always use NMI for PMU
 	 */
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+#endif
 }
 
 static int __kprobes
@@ -1484,7 +1504,9 @@ perf_counter_nmi_handler(struct notifier_block *self,
 
 	regs = args->regs;
 
+#ifdef X86_LOCAL_APIC
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+#endif
 	/*
 	 * 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.
@@ -1515,6 +1537,7 @@ static struct x86_pmu p6_pmu = {
 	.event_map		= p6_pmu_event_map,
 	.raw_event		= p6_pmu_raw_event,
 	.max_events		= ARRAY_SIZE(p6_perfmon_event_map),
+	.apic			= 1,
 	.max_period		= (1ULL << 31) - 1,
 	.version		= 0,
 	.num_counters		= 2,
@@ -1541,6 +1564,7 @@ static struct x86_pmu intel_pmu = {
 	.event_map		= intel_pmu_event_map,
 	.raw_event		= intel_pmu_raw_event,
 	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
+	.apic			= 1,
 	/*
 	 * Intel PMCs cannot be accessed sanely above 32 bit width,
 	 * so we install an artificial 1<<31 period regardless of
@@ -1564,6 +1588,7 @@ static struct x86_pmu amd_pmu = {
 	.num_counters		= 4,
 	.counter_bits		= 48,
 	.counter_mask		= (1ULL << 48) - 1,
+	.apic			= 1,
 	/* use highest bit to detect overflow */
 	.max_period		= (1ULL << 47) - 1,
 };
@@ -1589,13 +1614,14 @@ static int p6_pmu_init(void)
 		return -ENODEV;
 	}
 
+	x86_pmu = p6_pmu;
+
 	if (!cpu_has_apic) {
 		pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
-		return -ENODEV;
+		pr_info("no hardware sampling interrupt available.\n");
+		x86_pmu.apic = 0;
 	}
 
-	x86_pmu				= p6_pmu;
-
 	return 0;
 }
 

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

* Re: [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback
  2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback tip-bot for Ingo Molnar
@ 2009-08-11 16:23                 ` Johannes Stezenbach
  2009-08-11 16:52                   ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Johannes Stezenbach @ 2009-08-11 16:23 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

On Tue, Aug 11, 2009 at 11:34:21AM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  83f19150242ee57730a4331b6ae9a9b90ccc718c
> Gitweb:     http://git.kernel.org/tip/83f19150242ee57730a4331b6ae9a9b90ccc718c
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Tue, 11 Aug 2009 10:40:08 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Tue, 11 Aug 2009 13:19:07 +0200
> 
> perf_counter, x86: Fix/improve apic fallback
> 
> Johannes Stezenbach reported that his Pentium-M based
> laptop does not have the local APIC enabled by default,
> and hence perfcounters do not get initialized.
> 
> Add a fallback for this case: allow non-sampled counters
> and return with an error on sampled counters. This allows
> 'perf stat' to work out of box - and allows 'perf top'
> and 'perf record' to fall back on a hrtimer based sampling
> method.
> 
> ( Passing 'lapic' on the boot line will allow hardware
>   sampling to occur - but if the APIC is disabled
>   permanently by the hardware then this fallback still
>   allows more systems to use perfcounters. )
> 
> Also decouple perfcounter support from X86_LOCAL_APIC.

Seems to work.  From dmesg:

   Performance Counters: 
   no APIC, boot with the "lapic" boot parameter to force-enable it.
   no hardware sampling interrupt available.
   p6 PMU driver.
   ... version:                 0
   ... bit width:               32
   ... generic counters:        2
   ... value mask:              00000000ffffffff
   ... max period:              000000007fffffff
   ... fixed-purpose counters:  0
   ... counter mask:            0000000000000003
   CPU: Intel(R) Pentium(R) M processor 1.80GHz stepping 06

However:

   oprofile: using timer interrupt.

I tried "perf top", "perf stat -a sleep 1", "perf stat java foo",
it all looks good to my untrained eye.


Thanks,
Johannes

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

* Re: [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback
  2009-08-11 16:23                 ` Johannes Stezenbach
@ 2009-08-11 16:52                   ` Ingo Molnar
  0 siblings, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-11 16:52 UTC (permalink / raw)
  To: Johannes Stezenbach
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	fweisbec, tglx


* Johannes Stezenbach <js@sig21.net> wrote:

> On Tue, Aug 11, 2009 at 11:34:21AM +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  83f19150242ee57730a4331b6ae9a9b90ccc718c
> > Gitweb:     http://git.kernel.org/tip/83f19150242ee57730a4331b6ae9a9b90ccc718c
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Tue, 11 Aug 2009 10:40:08 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Tue, 11 Aug 2009 13:19:07 +0200
> > 
> > perf_counter, x86: Fix/improve apic fallback
> > 
> > Johannes Stezenbach reported that his Pentium-M based
> > laptop does not have the local APIC enabled by default,
> > and hence perfcounters do not get initialized.
> > 
> > Add a fallback for this case: allow non-sampled counters
> > and return with an error on sampled counters. This allows
> > 'perf stat' to work out of box - and allows 'perf top'
> > and 'perf record' to fall back on a hrtimer based sampling
> > method.
> > 
> > ( Passing 'lapic' on the boot line will allow hardware
> >   sampling to occur - but if the APIC is disabled
> >   permanently by the hardware then this fallback still
> >   allows more systems to use perfcounters. )
> > 
> > Also decouple perfcounter support from X86_LOCAL_APIC.
> 
> Seems to work.  From dmesg:
> 
>    Performance Counters: 
>    no APIC, boot with the "lapic" boot parameter to force-enable it.
>    no hardware sampling interrupt available.
>    p6 PMU driver.
>    ... version:                 0
>    ... bit width:               32
>    ... generic counters:        2
>    ... value mask:              00000000ffffffff
>    ... max period:              000000007fffffff
>    ... fixed-purpose counters:  0
>    ... counter mask:            0000000000000003
>    CPU: Intel(R) Pentium(R) M processor 1.80GHz stepping 06
> 
> However:
> 
>    oprofile: using timer interrupt.
> 
> I tried "perf top", "perf stat -a sleep 1", "perf stat java foo", 
> it all looks good to my untrained eye.

Ok, thanks for reporting it and for testing it!

The tools fall back to a hrtimer based sampling method - i.e. not 
NMI based. You can still improve the quality of performance 
instrumentation on your box by booting with 'lapic' - in that case 
the APIC and an NMI is used by 'perf top' and 'perf record/report'. 
(perf stat should be unaffected)

	Ingo

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

* [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback
       [not found]             ` <new-submission>
                                 ` (296 preceding siblings ...)
  2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback tip-bot for Ingo Molnar
@ 2009-08-12 12:18               ` tip-bot for Ingo Molnar
  2009-08-12 15:51               ` [tip:irq/urgent] genirq: Prevent race between free_irq() and handle_IRQ_event() tip-bot for Thomas Gleixner
                                 ` (408 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-12 12:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo, js

Commit-ID:  04da8a43da804723a550f00dd158fd5b5e25ae35
Gitweb:     http://git.kernel.org/tip/04da8a43da804723a550f00dd158fd5b5e25ae35
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 11 Aug 2009 10:40:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 12 Aug 2009 14:12:49 +0200

perf_counter, x86: Fix/improve apic fallback

Johannes Stezenbach reported that his Pentium-M based
laptop does not have the local APIC enabled by default,
and hence perfcounters do not get initialized.

Add a fallback for this case: allow non-sampled counters
and return with an error on sampled counters. This allows
'perf stat' to work out of box - and allows 'perf top'
and 'perf record' to fall back on a hrtimer based sampling
method.

( Passing 'lapic' on the boot line will allow hardware
  sampling to occur - but if the APIC is disabled
  permanently by the hardware then this fallback still
  allows more systems to use perfcounters. )

Also decouple perfcounter support from X86_LOCAL_APIC.

-v2: fix typo breaking counters on all other systems ...

Reported-by: Johannes Stezenbach <js@sig21.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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 738bdc6..13ffa5d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_IDE
 	select HAVE_OPROFILE
+	select HAVE_PERF_COUNTERS if (!M386 && !M486)
 	select HAVE_IOREMAP_PROT
 	select HAVE_KPROBES
 	select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -742,7 +743,6 @@ config X86_UP_IOAPIC
 config X86_LOCAL_APIC
 	def_bool y
 	depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC
-	select HAVE_PERF_COUNTERS if (!M386 && !M486)
 
 config X86_IO_APIC
 	def_bool y
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index fffc126..900332b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -55,6 +55,7 @@ struct x86_pmu {
 	int		num_counters_fixed;
 	int		counter_bits;
 	u64		counter_mask;
+	int		apic;
 	u64		max_period;
 	u64		intel_ctrl;
 };
@@ -613,6 +614,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
 
 static bool reserve_pmc_hardware(void)
 {
+#ifdef CONFIG_X86_LOCAL_APIC
 	int i;
 
 	if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -627,9 +629,11 @@ static bool reserve_pmc_hardware(void)
 		if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
 			goto eventsel_fail;
 	}
+#endif
 
 	return true;
 
+#ifdef CONFIG_X86_LOCAL_APIC
 eventsel_fail:
 	for (i--; i >= 0; i--)
 		release_evntsel_nmi(x86_pmu.eventsel + i);
@@ -644,10 +648,12 @@ perfctr_fail:
 		enable_lapic_nmi_watchdog();
 
 	return false;
+#endif
 }
 
 static void release_pmc_hardware(void)
 {
+#ifdef CONFIG_X86_LOCAL_APIC
 	int i;
 
 	for (i = 0; i < x86_pmu.num_counters; i++) {
@@ -657,6 +663,7 @@ static void release_pmc_hardware(void)
 
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		enable_lapic_nmi_watchdog();
+#endif
 }
 
 static void hw_perf_counter_destroy(struct perf_counter *counter)
@@ -748,6 +755,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 		hwc->sample_period = x86_pmu.max_period;
 		hwc->last_period = hwc->sample_period;
 		atomic64_set(&hwc->period_left, hwc->sample_period);
+	} else {
+		/*
+		 * If we have a PMU initialized but no APIC
+		 * interrupts, we cannot sample hardware
+		 * counters (user-space has to fall back and
+		 * sample via a hrtimer based software counter):
+		 */
+		if (!x86_pmu.apic)
+			return -EOPNOTSUPP;
 	}
 
 	counter->destroy = hw_perf_counter_destroy;
@@ -1449,18 +1465,22 @@ void smp_perf_pending_interrupt(struct pt_regs *regs)
 
 void set_perf_counter_pending(void)
 {
+#ifdef CONFIG_X86_LOCAL_APIC
 	apic->send_IPI_self(LOCAL_PENDING_VECTOR);
+#endif
 }
 
 void perf_counters_lapic_init(void)
 {
-	if (!x86_pmu_initialized())
+#ifdef CONFIG_X86_LOCAL_APIC
+	if (!x86_pmu.apic || !x86_pmu_initialized())
 		return;
 
 	/*
 	 * Always use NMI for PMU
 	 */
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+#endif
 }
 
 static int __kprobes
@@ -1484,7 +1504,9 @@ perf_counter_nmi_handler(struct notifier_block *self,
 
 	regs = args->regs;
 
+#ifdef CONFIG_X86_LOCAL_APIC
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+#endif
 	/*
 	 * 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.
@@ -1515,6 +1537,7 @@ static struct x86_pmu p6_pmu = {
 	.event_map		= p6_pmu_event_map,
 	.raw_event		= p6_pmu_raw_event,
 	.max_events		= ARRAY_SIZE(p6_perfmon_event_map),
+	.apic			= 1,
 	.max_period		= (1ULL << 31) - 1,
 	.version		= 0,
 	.num_counters		= 2,
@@ -1541,6 +1564,7 @@ static struct x86_pmu intel_pmu = {
 	.event_map		= intel_pmu_event_map,
 	.raw_event		= intel_pmu_raw_event,
 	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
+	.apic			= 1,
 	/*
 	 * Intel PMCs cannot be accessed sanely above 32 bit width,
 	 * so we install an artificial 1<<31 period regardless of
@@ -1564,6 +1588,7 @@ static struct x86_pmu amd_pmu = {
 	.num_counters		= 4,
 	.counter_bits		= 48,
 	.counter_mask		= (1ULL << 48) - 1,
+	.apic			= 1,
 	/* use highest bit to detect overflow */
 	.max_period		= (1ULL << 47) - 1,
 };
@@ -1589,13 +1614,14 @@ static int p6_pmu_init(void)
 		return -ENODEV;
 	}
 
+	x86_pmu = p6_pmu;
+
 	if (!cpu_has_apic) {
 		pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
-		return -ENODEV;
+		pr_info("no hardware sampling interrupt available.\n");
+		x86_pmu.apic = 0;
 	}
 
-	x86_pmu				= p6_pmu;
-
 	return 0;
 }
 

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

* [tip:irq/urgent] genirq: Prevent race between free_irq() and handle_IRQ_event()
       [not found]             ` <new-submission>
                                 ` (297 preceding siblings ...)
  2009-08-12 12:18               ` tip-bot for Ingo Molnar
@ 2009-08-12 15:51               ` tip-bot for Thomas Gleixner
  2009-08-13  8:39               ` [tip:perfcounters/core] perf_counter: Provide hw_perf_counter_setup_online() APIs tip-bot for Ingo Molnar
                                 ` (407 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-08-12 15:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  84b277af44cadb263d8d588b0c0b7d5d85f5bc2a
Gitweb:     http://git.kernel.org/tip/84b277af44cadb263d8d588b0c0b7d5d85f5bc2a
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 12 Aug 2009 17:22:02 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 12 Aug 2009 17:24:16 +0200

genirq: Prevent race between free_irq() and handle_IRQ_event()

If an interrupt is freed we do not check whether the interrupt is in
progress when we remove the action from the action chain. With
threaded handlers this can race against wake_up_process(action->thread)
in handle_IRQ_event and wake_up_process() might dereference a NULL
pointer.

Check action->thread before we call wake_up_process()

LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 kernel/irq/handle.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 065205b..4e7f17a 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -403,8 +403,16 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
 			 */
 			if (likely(!test_bit(IRQTF_DIED,
 					     &action->thread_flags))) {
+				struct task_struct *tsk = action->thread;
+
 				set_bit(IRQTF_RUNTHREAD, &action->thread_flags);
-				wake_up_process(action->thread);
+				/*
+				 * Check tsk as we might race against
+				 * free_irq which sets action->thread
+				 * to NULL
+				 */
+				if (tsk)
+					wake_up_process(tsk);
 			}
 
 			/* Fall through to add to randomness */

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

* [tip:perfcounters/core] perf_counter: Provide hw_perf_counter_setup_online() APIs
       [not found]             ` <new-submission>
                                 ` (298 preceding siblings ...)
  2009-08-12 15:51               ` [tip:irq/urgent] genirq: Prevent race between free_irq() and handle_IRQ_event() tip-bot for Thomas Gleixner
@ 2009-08-13  8:39               ` tip-bot for Ingo Molnar
  2009-08-13 22:05               ` [tip:tracing/core] tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures tip-bot for Ingo Molnar
                                 ` (406 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-13  8:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, fweisbec, tglx, mingo

Commit-ID:  28402971d869e26271b25301011f667d3a5640c3
Gitweb:     http://git.kernel.org/tip/28402971d869e26271b25301011f667d3a5640c3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 13 Aug 2009 10:13:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 13 Aug 2009 10:13:22 +0200

perf_counter: Provide hw_perf_counter_setup_online() APIs

Provide weak aliases for hw_perf_counter_setup_online(). This is
used by the BTS patches (for v2.6.32), but it interacts with
fixes so propagate this upstream. (it has no effect as of yet)

Also export perf_counter_output() to architecture code.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.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, 11 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index a9d823a..2b36afe 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -694,6 +694,8 @@ struct perf_sample_data {
 
 extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
 				 struct perf_sample_data *data);
+extern void perf_counter_output(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 b0b20a0..e26d2fc 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -88,6 +88,7 @@ void __weak hw_perf_disable(void)		{ barrier(); }
 void __weak hw_perf_enable(void)		{ barrier(); }
 
 void __weak hw_perf_counter_setup(int cpu)	{ barrier(); }
+void __weak hw_perf_counter_setup_online(int cpu)	{ barrier(); }
 
 int __weak
 hw_perf_group_sched_in(struct perf_counter *group_leader,
@@ -2630,7 +2631,7 @@ 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,
+void perf_counter_output(struct perf_counter *counter, int nmi,
 				struct perf_sample_data *data)
 {
 	int ret;
@@ -4592,6 +4593,11 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 		perf_counter_init_cpu(cpu);
 		break;
 
+	case CPU_ONLINE:
+	case CPU_ONLINE_FROZEN:
+		hw_perf_counter_setup_online(cpu);
+		break;
+
 	case CPU_DOWN_PREPARE:
 	case CPU_DOWN_PREPARE_FROZEN:
 		perf_counter_exit_cpu(cpu);
@@ -4616,6 +4622,8 @@ void __init perf_counter_init(void)
 {
 	perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE,
 			(void *)(long)smp_processor_id());
+	perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE,
+			(void *)(long)smp_processor_id());
 	register_cpu_notifier(&perf_cpu_nb);
 }
 

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

* [tip:tracing/core] tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures
       [not found]             ` <new-submission>
                                 ` (299 preceding siblings ...)
  2009-08-13  8:39               ` [tip:perfcounters/core] perf_counter: Provide hw_perf_counter_setup_online() APIs tip-bot for Ingo Molnar
@ 2009-08-13 22:05               ` tip-bot for Ingo Molnar
  2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
                                 ` (405 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-13 22:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, fweisbec, rostedt, tglx, jbaron, mingo

Commit-ID:  60d970c254b95ec7a0fc4c590b510253987b64a0
Gitweb:     http://git.kernel.org/tip/60d970c254b95ec7a0fc4c590b510253987b64a0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 13 Aug 2009 23:37:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 13 Aug 2009 23:38:20 +0200

tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures

The new syscall_regfunc()/unregfunc() functions rely on
the existence of TIF_SYSCALL_FTRACE - but that TIF flag
is only offered by HAVE_FTRACE_SYSCALLS.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 070a42b..35dd27a 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -579,6 +579,8 @@ __initcall(init_tracepoints);
 
 #endif /* CONFIG_MODULES */
 
+#ifdef CONFIG_FTRACE_SYSCALLS
+
 static DEFINE_MUTEX(regfunc_mutex);
 static int sys_tracepoint_refcount;
 
@@ -615,3 +617,4 @@ void syscall_unregfunc(void)
 	}
 	mutex_unlock(&regfunc_mutex);
 }
+#endif

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

* [tip:perfcounters/core] perf: Enable more compiler warnings
       [not found]             ` <new-submission>
                                 ` (300 preceding siblings ...)
  2009-08-13 22:05               ` [tip:tracing/core] tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures tip-bot for Ingo Molnar
@ 2009-08-16  8:57               ` tip-bot for Ingo Molnar
  2009-08-16 12:46                 ` Frederic Weisbecker
                                   ` (2 more replies)
  2009-08-16  9:18               ` [tip:perfcounters/core] perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2 tip-bot for Ingo Molnar
                                 ` (404 subsequent siblings)
  706 siblings, 3 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-16  8:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 16 Aug 2009 10:47:47 +0200

perf: Enable more compiler warnings

Related to a shadowed variable bug fix Valdis Kletnieks noticed
that perf does not get built with -Wshadow, which could have
helped us avoid the bug.

So enable -Wshadow and also enable the following warnings on
perf builds, in addition to the already enabled -Wall -Wextra
-std=gnu99 warnings:

 -Wcast-align
 -Wformat=2
 -Wshadow
 -Winit-self
 -Wpacked
 -Wredundant-decls
 -Wstack-protector
 -Wstrict-aliasing=3
 -Wswitch-default
 -Wswitch-enum
 -Wno-system-headers
 -Wundef
 -Wvolatile-register-var
 -Wwrite-strings
 -Wbad-function-cast
 -Wmissing-declarations
 -Wmissing-prototypes
 -Wnested-externs
 -Wold-style-definition
 -Wstrict-prototypes
 -Wdeclaration-after-statement

And change/fix the perf code to build cleanly under GCC 4.3.2.

The list of warnings enablement is rather arbitrary: it's based
on my (quick) reading of the GCC manpages and trying them on
perf.

I categorized the warnings based on individually enabling them
and looking whether they trigger something in the perf build.
If i liked those warnings (i.e. if they trigger for something
that arguably could be improved) i enabled the warning.

If the warnings seemed to come from language laywers spamming
the build with tons of nuisance warnings i generally kept them
off. Most of the sign conversion related warnings were in
this category. (A second patch enabling some of the sign
warnings might be welcome - sign bugs can be nasty.)

I also kept warnings that seem to make sense from their manpage
description and which produced no actual warnings on our code
base. These warnings might still be turned off if they end up
being a nuisance.

I also left out a few warnings that are not supported in older
compilers.

[ Note that these changes might break the build on older
  compilers i did not test, or on non-x86 architectures that
  produce different warnings, so more testing would be welcome. ]

Reported-by: Valdis.Kletnieks@vt.edu
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             |    7 ++-
 tools/perf/builtin-annotate.c   |   32 ++++++------
 tools/perf/builtin-help.c       |    1 +
 tools/perf/builtin-report.c     |   38 ++++++++-------
 tools/perf/builtin-top.c        |   23 ++++++---
 tools/perf/util/abspath.c       |    3 +-
 tools/perf/util/cache.h         |    1 -
 tools/perf/util/callchain.c     |    2 +
 tools/perf/util/color.c         |    6 +-
 tools/perf/util/color.h         |    2 +-
 tools/perf/util/config.c        |   22 +++++---
 tools/perf/util/exec_cmd.c      |    1 -
 tools/perf/util/module.c        |    4 +-
 tools/perf/util/parse-events.c  |   26 +++++-----
 tools/perf/util/parse-events.h  |    4 +-
 tools/perf/util/parse-options.c |   22 ++++++++
 tools/perf/util/path.c          |   25 ++++++----
 tools/perf/util/run-command.c   |    6 +-
 tools/perf/util/symbol.c        |  104 +++++++++++++++++++-------------------
 tools/perf/util/symbol.h        |    4 +-
 tools/perf/util/values.c        |    7 +--
 tools/perf/util/values.h        |    2 +-
 22 files changed, 194 insertions(+), 148 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0056405..8608c06 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -166,7 +166,12 @@ endif
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
+#
+# Include saner warnings here, which can catch bugs:
+#
+EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+
+CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 $(EXTRA_WARNINGS)
 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 3bedaa5..32ff983 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -81,7 +81,7 @@ struct hist_entry {
 struct sort_entry {
 	struct list_head list;
 
-	char *header;
+	const char *header;
 
 	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
 	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
@@ -225,7 +225,7 @@ static struct sort_entry sort_sym = {
 static int sort__need_collapse = 0;
 
 struct sort_dimension {
-	char			*name;
+	const char		*name;
 	struct sort_entry	*entry;
 	int			taken;
 };
@@ -723,7 +723,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len)
 		const char *path = NULL;
 		unsigned int hits = 0;
 		double percent = 0.0;
-		char *color;
+		const char *color;
 		struct sym_ext *sym_ext = sym->priv;
 
 		offset = line_ip - start;
@@ -805,7 +805,7 @@ static void free_source_line(struct symbol *sym, int len)
 
 /* Get the filename:line for the colored entries */
 static void
-get_source_line(struct symbol *sym, u64 start, int len, char *filename)
+get_source_line(struct symbol *sym, u64 start, int len, const char *filename)
 {
 	int i;
 	char cmd[PATH_MAX * 2];
@@ -851,7 +851,7 @@ get_source_line(struct symbol *sym, u64 start, int len, char *filename)
 	}
 }
 
-static void print_summary(char *filename)
+static void print_summary(const char *filename)
 {
 	struct sym_ext *sym_ext;
 	struct rb_node *node;
@@ -867,7 +867,7 @@ static void print_summary(char *filename)
 	node = rb_first(&root_sym_ext);
 	while (node) {
 		double percent;
-		char *color;
+		const char *color;
 		char *path;
 
 		sym_ext = rb_entry(node, struct sym_ext, node);
@@ -882,7 +882,7 @@ static void print_summary(char *filename)
 
 static void annotate_sym(struct dso *dso, struct symbol *sym)
 {
-	char *filename = dso->name, *d_filename;
+	const char *filename = dso->name, *d_filename;
 	u64 start, end, len;
 	char command[PATH_MAX*2];
 	FILE *file;
@@ -892,7 +892,7 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
 	if (sym->module)
 		filename = sym->module->path;
 	else if (dso == kernel_dso)
-		filename = vmlinux;
+		filename = vmlinux_name;
 
 	start = sym->obj_start;
 	if (!start)
@@ -964,7 +964,7 @@ static int __cmd_annotate(void)
 	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
 	unsigned long head = 0;
-	struct stat stat;
+	struct stat input_stat;
 	event_t *event;
 	uint32_t size;
 	char *buf;
@@ -977,13 +977,13 @@ static int __cmd_annotate(void)
 		exit(-1);
 	}
 
-	ret = fstat(input, &stat);
+	ret = fstat(input, &input_stat);
 	if (ret < 0) {
 		perror("failed to stat file");
 		exit(-1);
 	}
 
-	if (!stat.st_size) {
+	if (!input_stat.st_size) {
 		fprintf(stderr, "zero-sized file, nothing to do!\n");
 		exit(0);
 	}
@@ -1010,10 +1010,10 @@ more:
 
 	if (head + event->header.size >= page_size * mmap_window) {
 		unsigned long shift = page_size * (head / page_size);
-		int ret;
+		int munmap_ret;
 
-		ret = munmap(buf, page_size * mmap_window);
-		assert(ret == 0);
+		munmap_ret = munmap(buf, page_size * mmap_window);
+		assert(munmap_ret == 0);
 
 		offset += shift;
 		head -= shift;
@@ -1049,7 +1049,7 @@ more:
 
 	head += size;
 
-	if (offset + head < (unsigned long)stat.st_size)
+	if (offset + head < (unsigned long)input_stat.st_size)
 		goto more;
 
 	rc = EXIT_SUCCESS;
@@ -1092,7 +1092,7 @@ static const struct option options[] = {
 		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
 	OPT_BOOLEAN('m', "modules", &modules,
 		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
 	OPT_BOOLEAN('l', "print-line", &print_line,
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 2599d86..4fb8734 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -456,6 +456,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __used)
 		break;
 	case HELP_FORMAT_WEB:
 		show_html_page(argv[0]);
+	default:
 		break;
 	}
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 298f26b..3b9d24d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -97,6 +97,7 @@ static int repsep_fprintf(FILE *fp, const char *fmt, ...)
 		n = vasprintf(&bf, fmt, ap);
 		if (n > 0) {
 			char *sep = bf;
+
 			while (1) {
 				sep = strchr(sep, *field_sep);
 				if (sep == NULL)
@@ -144,7 +145,7 @@ struct hist_entry {
 struct sort_entry {
 	struct list_head list;
 
-	char *header;
+	const char *header;
 
 	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
 	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
@@ -328,7 +329,7 @@ static int sort__need_collapse = 0;
 static int sort__has_parent = 0;
 
 struct sort_dimension {
-	char			*name;
+	const char		*name;
 	struct sort_entry	*entry;
 	int			taken;
 };
@@ -343,7 +344,7 @@ static struct sort_dimension sort_dimensions[] = {
 
 static LIST_HEAD(hist_entry__sort_list);
 
-static int sort_dimension__add(char *tok)
+static int sort_dimension__add(const char *tok)
 {
 	unsigned int i;
 
@@ -602,6 +603,7 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
 		case CHAIN_GRAPH_REL:
 			ret += callchain__fprintf_graph(fp, chain,
 							total_samples, 1, 1);
+		case CHAIN_NONE:
 		default:
 			break;
 		}
@@ -1290,7 +1292,7 @@ process_lost_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;
+	const char *color = PERF_COLOR_BLUE;
 	int i, j;
 
 	if (!dump_trace)
@@ -1348,7 +1350,7 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head)
 	struct perf_counter_attr *attr = perf_header__find_attr(event->read.id);
 
 	if (show_threads) {
-		char *name = attr ? __event_name(attr->type, attr->config)
+		const char *name = attr ? __event_name(attr->type, attr->config)
 				   : "unknown";
 		perf_read_values_add_value(&show_threads_values,
 					   event->read.pid, event->read.tid,
@@ -1411,19 +1413,19 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 
 static u64 perf_header__sample_type(void)
 {
-	u64 sample_type = 0;
+	u64 type = 0;
 	int i;
 
 	for (i = 0; i < header->attrs; i++) {
 		struct perf_header_attr *attr = header->attr[i];
 
-		if (!sample_type)
-			sample_type = attr->attr.sample_type;
-		else if (sample_type != attr->attr.sample_type)
+		if (!type)
+			type = attr->attr.sample_type;
+		else if (type != attr->attr.sample_type)
 			die("non matching sample_type");
 	}
 
-	return sample_type;
+	return type;
 }
 
 static int __cmd_report(void)
@@ -1431,7 +1433,7 @@ static int __cmd_report(void)
 	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
 	unsigned long head, shift;
-	struct stat stat;
+	struct stat input_stat;
 	event_t *event;
 	uint32_t size;
 	char *buf;
@@ -1450,13 +1452,13 @@ static int __cmd_report(void)
 		exit(-1);
 	}
 
-	ret = fstat(input, &stat);
+	ret = fstat(input, &input_stat);
 	if (ret < 0) {
 		perror("failed to stat file");
 		exit(-1);
 	}
 
-	if (!stat.st_size) {
+	if (!input_stat.st_size) {
 		fprintf(stderr, "zero-sized file, nothing to do!\n");
 		exit(0);
 	}
@@ -1524,12 +1526,12 @@ more:
 		size = 8;
 
 	if (head + event->header.size >= page_size * mmap_window) {
-		int ret;
+		int munmap_ret;
 
 		shift = page_size * (head / page_size);
 
-		ret = munmap(buf, page_size * mmap_window);
-		assert(ret == 0);
+		munmap_ret = munmap(buf, page_size * mmap_window);
+		assert(munmap_ret == 0);
 
 		offset += shift;
 		head -= shift;
@@ -1568,7 +1570,7 @@ more:
 	if (offset + head >= header->data_offset + header->data_size)
 		goto done;
 
-	if (offset + head < (unsigned long)stat.st_size)
+	if (offset + head < (unsigned long)input_stat.st_size)
 		goto more;
 
 done:
@@ -1666,7 +1668,7 @@ static const struct option options[] = {
 		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
 	OPT_BOOLEAN('m', "modules", &modules,
 		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
 	OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9a6dbbf..06f763e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -120,7 +120,8 @@ static void parse_source(struct sym_entry *syme)
 	struct module *module;
 	struct section *section = NULL;
 	FILE *file;
-	char command[PATH_MAX*2], *path = vmlinux;
+	char command[PATH_MAX*2];
+	const char *path = vmlinux_name;
 	u64 start, end, len;
 
 	if (!syme)
@@ -487,10 +488,12 @@ 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);
+		struct symbol *sym;
 		double pcnt;
 
+		syme = rb_entry(nd, struct sym_entry, rb_node);
+		sym = (struct symbol *)(syme + 1);
+
 		if (++printed > print_entries || (int)syme->snap_count < count_filter)
 			continue;
 
@@ -609,7 +612,7 @@ static void print_mapped_keys(void)
 
 	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
 
-	if (vmlinux) {
+	if (vmlinux_name) {
 		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");
@@ -638,7 +641,9 @@ static int key_mapped(int c)
 		case 'F':
 		case 's':
 		case 'S':
-			return vmlinux ? 1 : 0;
+			return vmlinux_name ? 1 : 0;
+		default:
+			break;
 	}
 
 	return 0;
@@ -724,6 +729,8 @@ static void handle_keypress(int c)
 		case 'z':
 			zero = ~zero;
 			break;
+		default:
+			break;
 	}
 }
 
@@ -812,13 +819,13 @@ static int parse_symbols(void)
 {
 	struct rb_node *node;
 	struct symbol  *sym;
-	int modules = vmlinux ? 1 : 0;
+	int use_modules = vmlinux_name ? 1 : 0;
 
 	kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry));
 	if (kernel_dso == NULL)
 		return -1;
 
-	if (dso__load_kernel(kernel_dso, vmlinux, symbol_filter, verbose, modules) <= 0)
+	if (dso__load_kernel(kernel_dso, vmlinux_name, symbol_filter, verbose, use_modules) <= 0)
 		goto out_delete_dso;
 
 	node = rb_first(&kernel_dso->syms);
@@ -1114,7 +1121,7 @@ static const struct option options[] = {
 			    "system-wide collection from all CPUs"),
 	OPT_INTEGER('C', "CPU", &profile_cpu,
 		    "CPU to profile on"),
-	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
+	OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
 		    "number of mmap data pages"),
 	OPT_INTEGER('r', "realtime", &realtime_prio,
diff --git a/tools/perf/util/abspath.c b/tools/perf/util/abspath.c
index 61d33b8..a791dd4 100644
--- a/tools/perf/util/abspath.c
+++ b/tools/perf/util/abspath.c
@@ -50,7 +50,8 @@ const char *make_absolute_path(const char *path)
 			die ("Could not get current working directory");
 
 		if (last_elem) {
-			int len = strlen(buf);
+			len = strlen(buf);
+
 			if (len + strlen(last_elem) + 2 > PATH_MAX)
 				die ("Too long path name: '%s/%s'",
 						buf, last_elem);
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 4b50c41..6f8ea9d 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -52,7 +52,6 @@ extern const char *perf_mailmap_file;
 extern void maybe_flush_or_die(FILE *, const char *);
 extern int copy_fd(int ifd, int ofd);
 extern int copy_file(const char *dst, const char *src, int mode);
-extern ssize_t read_in_full(int fd, void *buf, size_t count);
 extern ssize_t write_in_full(int fd, const void *buf, size_t count);
 extern void write_or_die(int fd, const void *buf, size_t count);
 extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 0114734..3b8380f 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -50,6 +50,7 @@ rb_insert_callchain(struct rb_root *root, struct callchain_node *chain,
 			else
 				p = &(*p)->rb_right;
 			break;
+		case CHAIN_NONE:
 		default:
 			break;
 		}
@@ -143,6 +144,7 @@ int register_callchain_param(struct callchain_param *param)
 	case CHAIN_FLAT:
 		param->sort = sort_chain_flat;
 		break;
+	case CHAIN_NONE:
 	default:
 		return -1;
 	}
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 90a044d..e47fdeb 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -242,9 +242,9 @@ int color_fwrite_lines(FILE *fp, const char *color,
 	return 0;
 }
 
-char *get_percent_color(double percent)
+const char *get_percent_color(double percent)
 {
-	char *color = PERF_COLOR_NORMAL;
+	const char *color = PERF_COLOR_NORMAL;
 
 	/*
 	 * We color high-overhead entries in red, mid-overhead
@@ -263,7 +263,7 @@ char *get_percent_color(double percent)
 int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
 {
 	int r;
-	char *color;
+	const char *color;
 
 	color = get_percent_color(percent);
 	r = color_fprintf(fp, color, fmt, percent);
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
index 706cec5..43d0d1b 100644
--- a/tools/perf/util/color.h
+++ b/tools/perf/util/color.h
@@ -36,6 +36,6 @@ 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);
 int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
-char *get_percent_color(double percent);
+const char *get_percent_color(double percent);
 
 #endif /* COLOR_H */
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 780df54..8784649 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -160,17 +160,18 @@ static int get_extended_base_var(char *name, int baselen, int c)
 	name[baselen++] = '.';
 
 	for (;;) {
-		int c = get_next_char();
-		if (c == '\n')
+		int ch = get_next_char();
+
+		if (ch == '\n')
 			return -1;
-		if (c == '"')
+		if (ch == '"')
 			break;
-		if (c == '\\') {
-			c = get_next_char();
-			if (c == '\n')
+		if (ch == '\\') {
+			ch = get_next_char();
+			if (ch == '\n')
 				return -1;
 		}
-		name[baselen++] = c;
+		name[baselen++] = ch;
 		if (baselen > MAXNAME / 2)
 			return -1;
 	}
@@ -530,6 +531,8 @@ static int store_aux(const char* key, const char* value, void *cb __used)
 					store.offset[store.seen] = ftell(config_file);
 			}
 		}
+	default:
+		break;
 	}
 	return 0;
 }
@@ -619,6 +622,7 @@ contline:
 		switch (contents[offset]) {
 			case '=': equal_offset = offset; break;
 			case ']': bracket_offset = offset; break;
+			default: break;
 		}
 	if (offset > 0 && contents[offset-1] == '\\') {
 		offset_ = offset;
@@ -742,9 +746,9 @@ int perf_config_set_multivar(const char* key, const char* value,
 			goto write_err_out;
 	} else {
 		struct stat st;
-		char* contents;
+		char *contents;
 		ssize_t contents_sz, copy_begin, copy_end;
-		int i, new_line = 0;
+		int new_line = 0;
 
 		if (value_regex == NULL)
 			store.value_regex = NULL;
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
index 34a3528..2745605 100644
--- a/tools/perf/util/exec_cmd.c
+++ b/tools/perf/util/exec_cmd.c
@@ -6,7 +6,6 @@
 
 #define MAX_ARGS	32
 
-extern char **environ;
 static const char *argv_exec_path;
 static const char *argv0_path;
 
diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c
index ddabe92..3d567fe 100644
--- a/tools/perf/util/module.c
+++ b/tools/perf/util/module.c
@@ -436,9 +436,9 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
 		goto out_failure;
 
 	while (!feof(file)) {
-		char *path, *name, *tmp;
+		char *name, *tmp;
 		struct module *module;
-		int line_len, len;
+		int line_len;
 
 		line_len = getline(&line, &n, file);
 		if (line_len < 0)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 0441784..1cda97b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -14,10 +14,10 @@ int					nr_counters;
 struct perf_counter_attr		attrs[MAX_COUNTERS];
 
 struct event_symbol {
-	u8	type;
-	u64	config;
-	char	*symbol;
-	char	*alias;
+	u8		type;
+	u64		config;
+	const char	*symbol;
+	const char	*alias;
 };
 
 char debugfs_path[MAXPATHLEN];
@@ -51,7 +51,7 @@ static struct event_symbol event_symbols[] = {
 #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[] = {
+static const char *hw_event_names[] = {
 	"cycles",
 	"instructions",
 	"cache-references",
@@ -61,7 +61,7 @@ static char *hw_event_names[] = {
 	"bus-cycles",
 };
 
-static char *sw_event_names[] = {
+static const char *sw_event_names[] = {
 	"cpu-clock-msecs",
 	"task-clock-msecs",
 	"page-faults",
@@ -73,7 +73,7 @@ static char *sw_event_names[] = {
 
 #define MAX_ALIASES 8
 
-static char *hw_cache[][MAX_ALIASES] = {
+static const char *hw_cache[][MAX_ALIASES] = {
  { "L1-dcache",	"l1-d",		"l1d",		"L1-data",		},
  { "L1-icache",	"l1-i",		"l1i",		"L1-instruction",	},
  { "LLC",	"L2"							},
@@ -82,13 +82,13 @@ static char *hw_cache[][MAX_ALIASES] = {
  { "branch",	"branches",	"bpu",		"btb",		"bpc",	},
 };
 
-static char *hw_cache_op[][MAX_ALIASES] = {
+static const char *hw_cache_op[][MAX_ALIASES] = {
  { "load",	"loads",	"read",					},
  { "store",	"stores",	"write",				},
  { "prefetch",	"prefetches",	"speculative-read", "speculative-load",	},
 };
 
-static char *hw_cache_result[][MAX_ALIASES] = {
+static const char *hw_cache_result[][MAX_ALIASES] = {
  { "refs",	"Reference",	"ops",		"access",		},
  { "misses",	"miss",							},
 };
@@ -158,7 +158,7 @@ int valid_debugfs_mount(const char *debugfs)
 	return 0;
 }
 
-static char *tracepoint_id_to_name(u64 config)
+static const char *tracepoint_id_to_name(u64 config)
 {
 	static char tracepoint_name[2 * MAX_EVENT_LENGTH];
 	DIR *sys_dir, *evt_dir;
@@ -235,7 +235,7 @@ static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
 	return name;
 }
 
-char *event_name(int counter)
+const char *event_name(int counter)
 {
 	u64 config = attrs[counter].config;
 	int type = attrs[counter].type;
@@ -243,7 +243,7 @@ char *event_name(int counter)
 	return __event_name(type, config);
 }
 
-char *__event_name(int type, u64 config)
+const char *__event_name(int type, u64 config)
 {
 	static char buf[32];
 
@@ -294,7 +294,7 @@ char *__event_name(int type, u64 config)
 	return "unknown";
 }
 
-static int parse_aliases(const char **str, char *names[][MAX_ALIASES], int size)
+static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size)
 {
 	int i, j;
 	int n, longest = -1;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 192a962..9b1aeea 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -9,8 +9,8 @@ extern int			nr_counters;
 
 extern struct perf_counter_attr attrs[MAX_COUNTERS];
 
-extern char *event_name(int ctr);
-extern char *__event_name(int type, u64 config);
+extern const char *event_name(int ctr);
+extern const char *__event_name(int type, u64 config);
 
 extern int parse_events(const struct option *opt, const char *str, int unset);
 
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 1bf6719..6d8af48 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -53,6 +53,12 @@ static int get_value(struct parse_opt_ctx_t *p,
 		case OPTION_SET_INT:
 		case OPTION_SET_PTR:
 			return opterror(opt, "takes no value", flags);
+		case OPTION_END:
+		case OPTION_ARGUMENT:
+		case OPTION_GROUP:
+		case OPTION_STRING:
+		case OPTION_INTEGER:
+		case OPTION_LONG:
 		default:
 			break;
 		}
@@ -130,6 +136,9 @@ static int get_value(struct parse_opt_ctx_t *p,
 			return opterror(opt, "expects a numerical value", flags);
 		return 0;
 
+	case OPTION_END:
+	case OPTION_ARGUMENT:
+	case OPTION_GROUP:
 	default:
 		die("should not happen, someone must be hit on the forehead");
 	}
@@ -296,6 +305,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 				return parse_options_usage(usagestr, options);
 			case -2:
 				goto unknown;
+			default:
+				break;
 			}
 			if (ctx->opt)
 				check_typos(arg + 1, options);
@@ -314,6 +325,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 					ctx->argv[0] = strdup(ctx->opt - 1);
 					*(char *)ctx->argv[0] = '-';
 					goto unknown;
+				default:
+					break;
 				}
 			}
 			continue;
@@ -336,6 +349,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 			return parse_options_usage(usagestr, options);
 		case -2:
 			goto unknown;
+		default:
+			break;
 		}
 		continue;
 unknown:
@@ -456,6 +471,13 @@ int usage_with_options_internal(const char * const *usagestr,
 			}
 			break;
 		default: /* OPTION_{BIT,BOOLEAN,SET_INT,SET_PTR} */
+		case OPTION_END:
+		case OPTION_GROUP:
+		case OPTION_BIT:
+		case OPTION_BOOLEAN:
+		case OPTION_SET_INT:
+		case OPTION_SET_PTR:
+		case OPTION_LONG:
 			break;
 		}
 
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c
index a501a40..fd1f2fa 100644
--- a/tools/perf/util/path.c
+++ b/tools/perf/util/path.c
@@ -17,7 +17,7 @@ static char bad_path[] = "/bad-path/";
  * Two hacks:
  */
 
-static char *get_perf_dir(void)
+static const char *get_perf_dir(void)
 {
 	return ".";
 }
@@ -38,8 +38,9 @@ size_t strlcpy(char *dest, const char *src, size_t size)
 static char *get_pathname(void)
 {
 	static char pathname_array[4][PATH_MAX];
-	static int index;
-	return pathname_array[3 & ++index];
+	static int idx;
+
+	return pathname_array[3 & ++idx];
 }
 
 static char *cleanup_path(char *path)
@@ -161,20 +162,24 @@ int perf_mkstemp(char *path, size_t len, const char *template)
 }
 
 
-const char *make_relative_path(const char *abs, const char *base)
+const char *make_relative_path(const char *abs_path, const char *base)
 {
 	static char buf[PATH_MAX + 1];
 	int baselen;
+
 	if (!base)
-		return abs;
+		return abs_path;
+
 	baselen = strlen(base);
-	if (prefixcmp(abs, base))
-		return abs;
-	if (abs[baselen] == '/')
+	if (prefixcmp(abs_path, base))
+		return abs_path;
+	if (abs_path[baselen] == '/')
 		baselen++;
 	else if (base[baselen - 1] != '/')
-		return abs;
-	strcpy(buf, abs + baselen);
+		return abs_path;
+
+	strcpy(buf, abs_path + baselen);
+
 	return buf;
 }
 
diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
index a393534..2b615ac 100644
--- a/tools/perf/util/run-command.c
+++ b/tools/perf/util/run-command.c
@@ -262,7 +262,7 @@ int run_hook(const char *index_file, const char *name, ...)
 {
 	struct child_process hook;
 	const char **argv = NULL, *env[2];
-	char index[PATH_MAX];
+	char idx[PATH_MAX];
 	va_list args;
 	int ret;
 	size_t i = 0, alloc = 0;
@@ -284,8 +284,8 @@ int run_hook(const char *index_file, const char *name, ...)
 	hook.no_stdin = 1;
 	hook.stdout_to_stderr = 1;
 	if (index_file) {
-		snprintf(index, sizeof(index), "PERF_INDEX_FILE=%s", index_file);
-		env[0] = index;
+		snprintf(idx, sizeof(idx), "PERF_INDEX_FILE=%s", index_file);
+		env[0] = idx;
 		env[1] = NULL;
 		hook.env = env;
 	}
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0b98623..3159d47 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -21,7 +21,7 @@ enum dso_origin {
 
 static struct symbol *symbol__new(u64 start, u64 len,
 				  const char *name, unsigned int priv_size,
-				  u64 obj_start, int verbose)
+				  u64 obj_start, int v)
 {
 	size_t namelen = strlen(name) + 1;
 	struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
@@ -29,7 +29,7 @@ static struct symbol *symbol__new(u64 start, u64 len,
 	if (!self)
 		return NULL;
 
-	if (verbose >= 2)
+	if (v >= 2)
 		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
 			(u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
 
@@ -156,7 +156,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp)
 	return ret;
 }
 
-static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
+static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v)
 {
 	struct rb_node *nd, *prevnd;
 	char *line = NULL;
@@ -198,7 +198,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, 0, verbose);
+				  self->sym_priv_size, 0, v);
 
 		if (sym == NULL)
 			goto out_delete_line;
@@ -239,7 +239,7 @@ out_failure:
 	return -1;
 }
 
-static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verbose)
+static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int v)
 {
 	char *line = NULL;
 	size_t n;
@@ -277,7 +277,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb
 			continue;
 
 		sym = symbol__new(start, size, line + len,
-				  self->sym_priv_size, start, verbose);
+				  self->sym_priv_size, start, v);
 
 		if (sym == NULL)
 			goto out_delete_line;
@@ -305,13 +305,13 @@ out_failure:
  * elf_symtab__for_each_symbol - iterate thru all the symbols
  *
  * @self: struct elf_symtab instance to iterate
- * @index: uint32_t index
+ * @idx: uint32_t idx
  * @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))
+#define elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) \
+	for (idx = 0, gelf_getsym(syms, idx, &sym);\
+	     idx < nr_syms; \
+	     idx++, gelf_getsym(syms, idx, &sym))
 
 static inline uint8_t elf_sym__type(const GElf_Sym *sym)
 {
@@ -354,7 +354,7 @@ static inline const char *elf_sym__name(const GElf_Sym *sym,
 
 static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 				    GElf_Shdr *shp, const char *name,
-				    size_t *index)
+				    size_t *idx)
 {
 	Elf_Scn *sec = NULL;
 	size_t cnt = 1;
@@ -365,8 +365,8 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 		gelf_getshdr(sec, shp);
 		str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
 		if (!strcmp(name, str)) {
-			if (index)
-				*index = cnt;
+			if (idx)
+				*idx = cnt;
 			break;
 		}
 		++cnt;
@@ -392,7 +392,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
  * And always look at the original dso, not at debuginfo packages, that
  * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
  */
-static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
+static int dso__synthesize_plt_symbols(struct  dso *self, int v)
 {
 	uint32_t nr_rel_entries, idx;
 	GElf_Sym sym;
@@ -442,7 +442,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
 		goto out_elf_end;
 
 	/*
-	 * Fetch the relocation section to find the indexes to the GOT
+	 * Fetch the relocation section to find the idxes to the GOT
 	 * and the symbols in the .dynsym they refer to.
 	 */
 	reldata = elf_getdata(scn_plt_rel, NULL);
@@ -476,7 +476,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname, self->sym_priv_size, 0, verbose);
+					sympltname, self->sym_priv_size, 0, v);
 			if (!f)
 				goto out_elf_end;
 
@@ -494,7 +494,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname, self->sym_priv_size, 0, verbose);
+					sympltname, self->sym_priv_size, 0, v);
 			if (!f)
 				goto out_elf_end;
 
@@ -518,12 +518,12 @@ out:
 }
 
 static int dso__load_sym(struct dso *self, int fd, const char *name,
-			 symbol_filter_t filter, int verbose, struct module *mod)
+			 symbol_filter_t filter, int v, struct module *mod)
 {
 	Elf_Data *symstrs, *secstrs;
 	uint32_t nr_syms;
 	int err = -1;
-	uint32_t index;
+	uint32_t idx;
 	GElf_Ehdr ehdr;
 	GElf_Shdr shdr;
 	Elf_Data *syms;
@@ -534,14 +534,14 @@ 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) {
-		if (verbose)
+		if (v)
 			fprintf(stderr, "%s: cannot read %s ELF file.\n",
 				__func__, name);
 		goto out_close;
 	}
 
 	if (gelf_getehdr(elf, &ehdr) == NULL) {
-		if (verbose)
+		if (v)
 			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
 		goto out_elf_end;
 	}
@@ -583,9 +583,9 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 						     NULL) != NULL);
 	} else self->adjust_symbols = 0;
 
-	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
+	elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
 		struct symbol *f;
-		const char *name;
+		const char *elf_name;
 		char *demangled;
 		u64 obj_start;
 		struct section *section = NULL;
@@ -608,7 +608,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		obj_start = sym.st_value;
 
 		if (self->adjust_symbols) {
-			if (verbose >= 2)
+			if (v >= 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);
 
@@ -630,13 +630,13 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
 		 * DWARF DW_compile_unit has this, but we don't always have access
 		 * to it...
 		 */
-		name = elf_sym__name(&sym, symstrs);
-		demangled = bfd_demangle(NULL, name, DMGL_PARAMS | DMGL_ANSI);
+		elf_name = elf_sym__name(&sym, symstrs);
+		demangled = bfd_demangle(NULL, elf_name, DMGL_PARAMS | DMGL_ANSI);
 		if (demangled != NULL)
-			name = demangled;
+			elf_name = demangled;
 
-		f = symbol__new(sym.st_value, sym.st_size, name,
-				self->sym_priv_size, obj_start, verbose);
+		f = symbol__new(sym.st_value, sym.st_size, elf_name,
+				self->sym_priv_size, obj_start, v);
 		free(demangled);
 		if (!f)
 			goto out_elf_end;
@@ -659,7 +659,7 @@ out_close:
 
 #define BUILD_ID_SIZE 128
 
-static char *dso__read_build_id(struct dso *self, int verbose)
+static char *dso__read_build_id(struct dso *self, int v)
 {
 	int i;
 	GElf_Ehdr ehdr;
@@ -676,14 +676,14 @@ static char *dso__read_build_id(struct dso *self, int verbose)
 
 	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
 	if (elf == NULL) {
-		if (verbose)
+		if (v)
 			fprintf(stderr, "%s: cannot read %s ELF file.\n",
 				__func__, self->name);
 		goto out_close;
 	}
 
 	if (gelf_getehdr(elf, &ehdr) == NULL) {
-		if (verbose)
+		if (v)
 			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
 		goto out_elf_end;
 	}
@@ -706,7 +706,7 @@ static char *dso__read_build_id(struct dso *self, int verbose)
 		++raw;
 		bid += 2;
 	}
-	if (verbose >= 2)
+	if (v >= 2)
 		printf("%s(%s): %s\n", __func__, self->name, build_id);
 out_elf_end:
 	elf_end(elf);
@@ -732,7 +732,7 @@ char dso__symtab_origin(const struct dso *self)
 	return origin[self->origin];
 }
 
-int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
+int dso__load(struct dso *self, symbol_filter_t filter, int v)
 {
 	int size = PATH_MAX;
 	char *name = malloc(size), *build_id = NULL;
@@ -745,7 +745,7 @@ int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
 	self->adjust_symbols = 0;
 
 	if (strncmp(self->name, "/tmp/perf-", 10) == 0) {
-		ret = dso__load_perf_map(self, filter, verbose);
+		ret = dso__load_perf_map(self, filter, v);
 		self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT :
 					 DSO__ORIG_NOT_FOUND;
 		return ret;
@@ -764,7 +764,7 @@ more:
 			snprintf(name, size, "/usr/lib/debug%s", self->name);
 			break;
 		case DSO__ORIG_BUILDID:
-			build_id = dso__read_build_id(self, verbose);
+			build_id = dso__read_build_id(self, v);
 			if (build_id != NULL) {
 				snprintf(name, size,
 					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
@@ -785,7 +785,7 @@ more:
 		fd = open(name, O_RDONLY);
 	} while (fd < 0);
 
-	ret = dso__load_sym(self, fd, name, filter, verbose, NULL);
+	ret = dso__load_sym(self, fd, name, filter, v, NULL);
 	close(fd);
 
 	/*
@@ -795,7 +795,7 @@ more:
 		goto more;
 
 	if (ret > 0) {
-		int nr_plt = dso__synthesize_plt_symbols(self, verbose);
+		int nr_plt = dso__synthesize_plt_symbols(self, v);
 		if (nr_plt > 0)
 			ret += nr_plt;
 	}
@@ -807,7 +807,7 @@ out:
 }
 
 static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *name,
-			     symbol_filter_t filter, int verbose)
+			     symbol_filter_t filter, int v)
 {
 	struct module *mod = mod_dso__find_module(mods, name);
 	int err = 0, fd;
@@ -820,13 +820,13 @@ static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *
 	if (fd < 0)
 		return err;
 
-	err = dso__load_sym(self, fd, name, filter, verbose, mod);
+	err = dso__load_sym(self, fd, name, filter, v, mod);
 	close(fd);
 
 	return err;
 }
 
-int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
+int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
 {
 	struct mod_dso *mods = mod_dso__new_dso("modules");
 	struct module *pos;
@@ -844,7 +844,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
 	next = rb_first(&mods->mods);
 	while (next) {
 		pos = rb_entry(next, struct module, rb_node);
-		err = dso__load_module(self, mods, pos->name, filter, verbose);
+		err = dso__load_module(self, mods, pos->name, filter, v);
 
 		if (err < 0)
 			break;
@@ -887,14 +887,14 @@ static inline void dso__fill_symbol_holes(struct dso *self)
 }
 
 static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
-			     symbol_filter_t filter, int verbose)
+			     symbol_filter_t filter, int v)
 {
 	int err, fd = open(vmlinux, O_RDONLY);
 
 	if (fd < 0)
 		return -1;
 
-	err = dso__load_sym(self, fd, vmlinux, filter, verbose, NULL);
+	err = dso__load_sym(self, fd, vmlinux, filter, v, NULL);
 
 	if (err > 0)
 		dso__fill_symbol_holes(self);
@@ -905,18 +905,18 @@ static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
 }
 
 int dso__load_kernel(struct dso *self, const char *vmlinux,
-		     symbol_filter_t filter, int verbose, int modules)
+		     symbol_filter_t filter, int v, int use_modules)
 {
 	int err = -1;
 
 	if (vmlinux) {
-		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
-		if (err > 0 && modules)
-			err = dso__load_modules(self, filter, verbose);
+		err = dso__load_vmlinux(self, vmlinux, filter, v);
+		if (err > 0 && use_modules)
+			err = dso__load_modules(self, filter, v);
 	}
 
 	if (err <= 0)
-		err = dso__load_kallsyms(self, filter, verbose);
+		err = dso__load_kallsyms(self, filter, v);
 
 	if (err > 0)
 		self->origin = DSO__ORIG_KERNEL;
@@ -929,7 +929,7 @@ struct dso	*kernel_dso;
 struct dso	*vdso;
 struct dso	*hypervisor_dso;
 
-char		*vmlinux = "vmlinux";
+const char	*vmlinux_name = "vmlinux";
 int		modules;
 
 static void dsos__add(struct dso *dso)
@@ -997,7 +997,7 @@ int load_kernel(void)
 	if (!kernel_dso)
 		return -1;
 
-	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules);
+	err = dso__load_kernel(kernel_dso, vmlinux_name, NULL, verbose, modules);
 	if (err <= 0) {
 		dso__delete(kernel_dso);
 		kernel_dso = NULL;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 48b8e57..6e84907 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -55,7 +55,7 @@ struct dso {
 	char		 name[0];
 };
 
-const char *sym_hist_filter;
+extern const char *sym_hist_filter;
 
 typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
 
@@ -87,6 +87,6 @@ extern struct list_head dsos;
 extern struct dso *kernel_dso;
 extern struct dso *vdso;
 extern struct dso *hypervisor_dso;
-extern char *vmlinux;
+extern const char *vmlinux_name;
 extern int   modules;
 #endif /* _PERF_SYMBOL_ */
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index 614cfaf..1c15e39 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -96,7 +96,7 @@ static void perf_read_values__enlarge_counters(struct perf_read_values *values)
 }
 
 static int perf_read_values__findnew_counter(struct perf_read_values *values,
-					     u64 rawid, char *name)
+					     u64 rawid, const char *name)
 {
 	int i;
 
@@ -116,7 +116,7 @@ static int perf_read_values__findnew_counter(struct perf_read_values *values,
 
 void perf_read_values_add_value(struct perf_read_values *values,
 				u32 pid, u32 tid,
-				u64 rawid, char *name, u64 value)
+				u64 rawid, const char *name, u64 value)
 {
 	int tindex, cindex;
 
@@ -221,8 +221,7 @@ static void perf_read_values__display_raw(FILE *fp,
 				countwidth, values->value[i][j]);
 }
 
-void perf_read_values_display(FILE *fp, struct perf_read_values *values,
-			      int raw)
+void perf_read_values_display(FILE *fp, struct perf_read_values *values, int raw)
 {
 	if (raw)
 		perf_read_values__display_raw(fp, values);
diff --git a/tools/perf/util/values.h b/tools/perf/util/values.h
index f8960fd..cadf8cf 100644
--- a/tools/perf/util/values.h
+++ b/tools/perf/util/values.h
@@ -19,7 +19,7 @@ void perf_read_values_destroy(struct perf_read_values *values);
 
 void perf_read_values_add_value(struct perf_read_values *values,
 				u32 pid, u32 tid,
-				u64 rawid, char *name, u64 value);
+				u64 rawid, const char *name, u64 value);
 
 void perf_read_values_display(FILE *fp, struct perf_read_values *values,
 			      int raw);

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

* [tip:perfcounters/core] perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2
       [not found]             ` <new-submission>
                                 ` (301 preceding siblings ...)
  2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
@ 2009-08-16  9:18               ` tip-bot for Ingo Molnar
  2009-08-17  8:46               ` [tip:perfcounters/urgent] perf: Rename perf-examples.txt to examples.txt tip-bot for Carlos R. Mafra
                                 ` (403 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-16  9:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	arjan, fweisbec, tglx, mingo

Commit-ID:  35ba15b737e2cd1d780943189f2138519f81fd42
Gitweb:     http://git.kernel.org/tip/35ba15b737e2cd1d780943189f2138519f81fd42
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 16 Aug 2009 11:09:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 16 Aug 2009 11:09:21 +0200

perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2

Up our defences a bit.

Suggested-by: 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>
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 8608c06..d637aea 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -171,7 +171,7 @@ endif
 #
 EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
 
-CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 $(EXTRA_WARNINGS)
+CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
@ 2009-08-16 12:46                 ` Frederic Weisbecker
  2009-08-16 14:01                   ` Ingo Molnar
  2009-08-16 12:53                 ` [PATCH] perf tools: Revert the -Wswitch-enum flag Frederic Weisbecker
  2009-08-16 14:15                 ` [tip:perfcounters/core] perf: Enable more compiler warnings Frederic Weisbecker
  2 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-08-16 12:46 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits

On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> 
> perf: Enable more compiler warnings
> 
> Related to a shadowed variable bug fix Valdis Kletnieks noticed
> that perf does not get built with -Wshadow, which could have
> helped us avoid the bug.
> 
> So enable -Wshadow and also enable the following warnings on
> perf builds, in addition to the already enabled -Wall -Wextra
> -std=gnu99 warnings:
> 
>  -Wcast-align
>  -Wformat=2
>  -Wshadow
>  -Winit-self
>  -Wpacked
>  -Wredundant-decls
>  -Wstack-protector
>  -Wstrict-aliasing=3
>  -Wswitch-default
>  -Wswitch-enum



This one looks like more a pain than something useful.

I have this code in perf trace:

static int event_item_type(enum event_type type)
{
	switch (type) {
	case EVENT_ITEM:
	case EVENT_DQUOTE:
	case EVENT_SQUOTE:
		return 1;
	default:
		return 0;
	}
}

Which results in:

util/trace-event-parse.c: In function ‘event_item_type’:
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_ERROR’ not handled in switch
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NONE’ not handled in switch
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_SPACE’ not handled in switch
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NEWLINE’ not handled in switch
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_OP’ not handled in switch
util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_DELIM’ not handled in switch

The default case already handles these and I guess we don't want workarounds like:

static int event_item_type(enum event_type type)
{
        switch (type) {
        case EVENT_ITEM:
        case EVENT_DQUOTE:
        case EVENT_SQUOTE:
                return 1;
	case EVENT_ERROR:
	case EVENT_NONE:
	case EVENT_SPACE:
	case EVENT_NEWLINE:
	case EVENT_OP:
	case EVENT_DELIM:
        default:
                return 0;
        }
}


Right? :-)

This warning might be useful for *very* specific cases, but not here IMO.

But -Wswitch-default is indeed useful.

Frederic.


>  -Wno-system-headers
>  -Wundef
>  -Wvolatile-register-var
>  -Wwrite-strings
>  -Wbad-function-cast
>  -Wmissing-declarations
>  -Wmissing-prototypes
>  -Wnested-externs
>  -Wold-style-definition
>  -Wstrict-prototypes
>  -Wdeclaration-after-statement
> 
> And change/fix the perf code to build cleanly under GCC 4.3.2.
> 
> The list of warnings enablement is rather arbitrary: it's based
> on my (quick) reading of the GCC manpages and trying them on
> perf.
> 
> I categorized the warnings based on individually enabling them
> and looking whether they trigger something in the perf build.
> If i liked those warnings (i.e. if they trigger for something
> that arguably could be improved) i enabled the warning.
> 
> If the warnings seemed to come from language laywers spamming
> the build with tons of nuisance warnings i generally kept them
> off. Most of the sign conversion related warnings were in
> this category. (A second patch enabling some of the sign
> warnings might be welcome - sign bugs can be nasty.)
> 
> I also kept warnings that seem to make sense from their manpage
> description and which produced no actual warnings on our code
> base. These warnings might still be turned off if they end up
> being a nuisance.
> 
> I also left out a few warnings that are not supported in older
> compilers.
> 
> [ Note that these changes might break the build on older
>   compilers i did not test, or on non-x86 architectures that
>   produce different warnings, so more testing would be welcome. ]
> 
> Reported-by: Valdis.Kletnieks@vt.edu
> 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             |    7 ++-
>  tools/perf/builtin-annotate.c   |   32 ++++++------
>  tools/perf/builtin-help.c       |    1 +
>  tools/perf/builtin-report.c     |   38 ++++++++-------
>  tools/perf/builtin-top.c        |   23 ++++++---
>  tools/perf/util/abspath.c       |    3 +-
>  tools/perf/util/cache.h         |    1 -
>  tools/perf/util/callchain.c     |    2 +
>  tools/perf/util/color.c         |    6 +-
>  tools/perf/util/color.h         |    2 +-
>  tools/perf/util/config.c        |   22 +++++---
>  tools/perf/util/exec_cmd.c      |    1 -
>  tools/perf/util/module.c        |    4 +-
>  tools/perf/util/parse-events.c  |   26 +++++-----
>  tools/perf/util/parse-events.h  |    4 +-
>  tools/perf/util/parse-options.c |   22 ++++++++
>  tools/perf/util/path.c          |   25 ++++++----
>  tools/perf/util/run-command.c   |    6 +-
>  tools/perf/util/symbol.c        |  104 +++++++++++++++++++-------------------
>  tools/perf/util/symbol.h        |    4 +-
>  tools/perf/util/values.c        |    7 +--
>  tools/perf/util/values.h        |    2 +-
>  22 files changed, 194 insertions(+), 148 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 0056405..8608c06 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -166,7 +166,12 @@ endif
>  
>  # CFLAGS and LDFLAGS are for the users to override from the command line.
>  
> -CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
> +#
> +# Include saner warnings here, which can catch bugs:
> +#
> +EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
> +
> +CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 $(EXTRA_WARNINGS)
>  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 3bedaa5..32ff983 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -81,7 +81,7 @@ struct hist_entry {
>  struct sort_entry {
>  	struct list_head list;
>  
> -	char *header;
> +	const char *header;
>  
>  	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
>  	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
> @@ -225,7 +225,7 @@ static struct sort_entry sort_sym = {
>  static int sort__need_collapse = 0;
>  
>  struct sort_dimension {
> -	char			*name;
> +	const char		*name;
>  	struct sort_entry	*entry;
>  	int			taken;
>  };
> @@ -723,7 +723,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len)
>  		const char *path = NULL;
>  		unsigned int hits = 0;
>  		double percent = 0.0;
> -		char *color;
> +		const char *color;
>  		struct sym_ext *sym_ext = sym->priv;
>  
>  		offset = line_ip - start;
> @@ -805,7 +805,7 @@ static void free_source_line(struct symbol *sym, int len)
>  
>  /* Get the filename:line for the colored entries */
>  static void
> -get_source_line(struct symbol *sym, u64 start, int len, char *filename)
> +get_source_line(struct symbol *sym, u64 start, int len, const char *filename)
>  {
>  	int i;
>  	char cmd[PATH_MAX * 2];
> @@ -851,7 +851,7 @@ get_source_line(struct symbol *sym, u64 start, int len, char *filename)
>  	}
>  }
>  
> -static void print_summary(char *filename)
> +static void print_summary(const char *filename)
>  {
>  	struct sym_ext *sym_ext;
>  	struct rb_node *node;
> @@ -867,7 +867,7 @@ static void print_summary(char *filename)
>  	node = rb_first(&root_sym_ext);
>  	while (node) {
>  		double percent;
> -		char *color;
> +		const char *color;
>  		char *path;
>  
>  		sym_ext = rb_entry(node, struct sym_ext, node);
> @@ -882,7 +882,7 @@ static void print_summary(char *filename)
>  
>  static void annotate_sym(struct dso *dso, struct symbol *sym)
>  {
> -	char *filename = dso->name, *d_filename;
> +	const char *filename = dso->name, *d_filename;
>  	u64 start, end, len;
>  	char command[PATH_MAX*2];
>  	FILE *file;
> @@ -892,7 +892,7 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
>  	if (sym->module)
>  		filename = sym->module->path;
>  	else if (dso == kernel_dso)
> -		filename = vmlinux;
> +		filename = vmlinux_name;
>  
>  	start = sym->obj_start;
>  	if (!start)
> @@ -964,7 +964,7 @@ static int __cmd_annotate(void)
>  	int ret, rc = EXIT_FAILURE;
>  	unsigned long offset = 0;
>  	unsigned long head = 0;
> -	struct stat stat;
> +	struct stat input_stat;
>  	event_t *event;
>  	uint32_t size;
>  	char *buf;
> @@ -977,13 +977,13 @@ static int __cmd_annotate(void)
>  		exit(-1);
>  	}
>  
> -	ret = fstat(input, &stat);
> +	ret = fstat(input, &input_stat);
>  	if (ret < 0) {
>  		perror("failed to stat file");
>  		exit(-1);
>  	}
>  
> -	if (!stat.st_size) {
> +	if (!input_stat.st_size) {
>  		fprintf(stderr, "zero-sized file, nothing to do!\n");
>  		exit(0);
>  	}
> @@ -1010,10 +1010,10 @@ more:
>  
>  	if (head + event->header.size >= page_size * mmap_window) {
>  		unsigned long shift = page_size * (head / page_size);
> -		int ret;
> +		int munmap_ret;
>  
> -		ret = munmap(buf, page_size * mmap_window);
> -		assert(ret == 0);
> +		munmap_ret = munmap(buf, page_size * mmap_window);
> +		assert(munmap_ret == 0);
>  
>  		offset += shift;
>  		head -= shift;
> @@ -1049,7 +1049,7 @@ more:
>  
>  	head += size;
>  
> -	if (offset + head < (unsigned long)stat.st_size)
> +	if (offset + head < (unsigned long)input_stat.st_size)
>  		goto more;
>  
>  	rc = EXIT_SUCCESS;
> @@ -1092,7 +1092,7 @@ static const struct option options[] = {
>  		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_BOOLEAN('m', "modules", &modules,
>  		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
>  	OPT_BOOLEAN('l', "print-line", &print_line,
> diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
> index 2599d86..4fb8734 100644
> --- a/tools/perf/builtin-help.c
> +++ b/tools/perf/builtin-help.c
> @@ -456,6 +456,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __used)
>  		break;
>  	case HELP_FORMAT_WEB:
>  		show_html_page(argv[0]);
> +	default:
>  		break;
>  	}
>  
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 298f26b..3b9d24d 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -97,6 +97,7 @@ static int repsep_fprintf(FILE *fp, const char *fmt, ...)
>  		n = vasprintf(&bf, fmt, ap);
>  		if (n > 0) {
>  			char *sep = bf;
> +
>  			while (1) {
>  				sep = strchr(sep, *field_sep);
>  				if (sep == NULL)
> @@ -144,7 +145,7 @@ struct hist_entry {
>  struct sort_entry {
>  	struct list_head list;
>  
> -	char *header;
> +	const char *header;
>  
>  	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
>  	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
> @@ -328,7 +329,7 @@ static int sort__need_collapse = 0;
>  static int sort__has_parent = 0;
>  
>  struct sort_dimension {
> -	char			*name;
> +	const char		*name;
>  	struct sort_entry	*entry;
>  	int			taken;
>  };
> @@ -343,7 +344,7 @@ static struct sort_dimension sort_dimensions[] = {
>  
>  static LIST_HEAD(hist_entry__sort_list);
>  
> -static int sort_dimension__add(char *tok)
> +static int sort_dimension__add(const char *tok)
>  {
>  	unsigned int i;
>  
> @@ -602,6 +603,7 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
>  		case CHAIN_GRAPH_REL:
>  			ret += callchain__fprintf_graph(fp, chain,
>  							total_samples, 1, 1);
> +		case CHAIN_NONE:
>  		default:
>  			break;
>  		}
> @@ -1290,7 +1292,7 @@ process_lost_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;
> +	const char *color = PERF_COLOR_BLUE;
>  	int i, j;
>  
>  	if (!dump_trace)
> @@ -1348,7 +1350,7 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head)
>  	struct perf_counter_attr *attr = perf_header__find_attr(event->read.id);
>  
>  	if (show_threads) {
> -		char *name = attr ? __event_name(attr->type, attr->config)
> +		const char *name = attr ? __event_name(attr->type, attr->config)
>  				   : "unknown";
>  		perf_read_values_add_value(&show_threads_values,
>  					   event->read.pid, event->read.tid,
> @@ -1411,19 +1413,19 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
>  
>  static u64 perf_header__sample_type(void)
>  {
> -	u64 sample_type = 0;
> +	u64 type = 0;
>  	int i;
>  
>  	for (i = 0; i < header->attrs; i++) {
>  		struct perf_header_attr *attr = header->attr[i];
>  
> -		if (!sample_type)
> -			sample_type = attr->attr.sample_type;
> -		else if (sample_type != attr->attr.sample_type)
> +		if (!type)
> +			type = attr->attr.sample_type;
> +		else if (type != attr->attr.sample_type)
>  			die("non matching sample_type");
>  	}
>  
> -	return sample_type;
> +	return type;
>  }
>  
>  static int __cmd_report(void)
> @@ -1431,7 +1433,7 @@ static int __cmd_report(void)
>  	int ret, rc = EXIT_FAILURE;
>  	unsigned long offset = 0;
>  	unsigned long head, shift;
> -	struct stat stat;
> +	struct stat input_stat;
>  	event_t *event;
>  	uint32_t size;
>  	char *buf;
> @@ -1450,13 +1452,13 @@ static int __cmd_report(void)
>  		exit(-1);
>  	}
>  
> -	ret = fstat(input, &stat);
> +	ret = fstat(input, &input_stat);
>  	if (ret < 0) {
>  		perror("failed to stat file");
>  		exit(-1);
>  	}
>  
> -	if (!stat.st_size) {
> +	if (!input_stat.st_size) {
>  		fprintf(stderr, "zero-sized file, nothing to do!\n");
>  		exit(0);
>  	}
> @@ -1524,12 +1526,12 @@ more:
>  		size = 8;
>  
>  	if (head + event->header.size >= page_size * mmap_window) {
> -		int ret;
> +		int munmap_ret;
>  
>  		shift = page_size * (head / page_size);
>  
> -		ret = munmap(buf, page_size * mmap_window);
> -		assert(ret == 0);
> +		munmap_ret = munmap(buf, page_size * mmap_window);
> +		assert(munmap_ret == 0);
>  
>  		offset += shift;
>  		head -= shift;
> @@ -1568,7 +1570,7 @@ more:
>  	if (offset + head >= header->data_offset + header->data_size)
>  		goto done;
>  
> -	if (offset + head < (unsigned long)stat.st_size)
> +	if (offset + head < (unsigned long)input_stat.st_size)
>  		goto more;
>  
>  done:
> @@ -1666,7 +1668,7 @@ static const struct option options[] = {
>  		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_BOOLEAN('m', "modules", &modules,
>  		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
>  	OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 9a6dbbf..06f763e 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -120,7 +120,8 @@ static void parse_source(struct sym_entry *syme)
>  	struct module *module;
>  	struct section *section = NULL;
>  	FILE *file;
> -	char command[PATH_MAX*2], *path = vmlinux;
> +	char command[PATH_MAX*2];
> +	const char *path = vmlinux_name;
>  	u64 start, end, len;
>  
>  	if (!syme)
> @@ -487,10 +488,12 @@ 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);
> +		struct symbol *sym;
>  		double pcnt;
>  
> +		syme = rb_entry(nd, struct sym_entry, rb_node);
> +		sym = (struct symbol *)(syme + 1);
> +
>  		if (++printed > print_entries || (int)syme->snap_count < count_filter)
>  			continue;
>  
> @@ -609,7 +612,7 @@ static void print_mapped_keys(void)
>  
>  	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
>  
> -	if (vmlinux) {
> +	if (vmlinux_name) {
>  		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");
> @@ -638,7 +641,9 @@ static int key_mapped(int c)
>  		case 'F':
>  		case 's':
>  		case 'S':
> -			return vmlinux ? 1 : 0;
> +			return vmlinux_name ? 1 : 0;
> +		default:
> +			break;
>  	}
>  
>  	return 0;
> @@ -724,6 +729,8 @@ static void handle_keypress(int c)
>  		case 'z':
>  			zero = ~zero;
>  			break;
> +		default:
> +			break;
>  	}
>  }
>  
> @@ -812,13 +819,13 @@ static int parse_symbols(void)
>  {
>  	struct rb_node *node;
>  	struct symbol  *sym;
> -	int modules = vmlinux ? 1 : 0;
> +	int use_modules = vmlinux_name ? 1 : 0;
>  
>  	kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry));
>  	if (kernel_dso == NULL)
>  		return -1;
>  
> -	if (dso__load_kernel(kernel_dso, vmlinux, symbol_filter, verbose, modules) <= 0)
> +	if (dso__load_kernel(kernel_dso, vmlinux_name, symbol_filter, verbose, use_modules) <= 0)
>  		goto out_delete_dso;
>  
>  	node = rb_first(&kernel_dso->syms);
> @@ -1114,7 +1121,7 @@ static const struct option options[] = {
>  			    "system-wide collection from all CPUs"),
>  	OPT_INTEGER('C', "CPU", &profile_cpu,
>  		    "CPU to profile on"),
> -	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
> +	OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
>  		    "number of mmap data pages"),
>  	OPT_INTEGER('r', "realtime", &realtime_prio,
> diff --git a/tools/perf/util/abspath.c b/tools/perf/util/abspath.c
> index 61d33b8..a791dd4 100644
> --- a/tools/perf/util/abspath.c
> +++ b/tools/perf/util/abspath.c
> @@ -50,7 +50,8 @@ const char *make_absolute_path(const char *path)
>  			die ("Could not get current working directory");
>  
>  		if (last_elem) {
> -			int len = strlen(buf);
> +			len = strlen(buf);
> +
>  			if (len + strlen(last_elem) + 2 > PATH_MAX)
>  				die ("Too long path name: '%s/%s'",
>  						buf, last_elem);
> diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
> index 4b50c41..6f8ea9d 100644
> --- a/tools/perf/util/cache.h
> +++ b/tools/perf/util/cache.h
> @@ -52,7 +52,6 @@ extern const char *perf_mailmap_file;
>  extern void maybe_flush_or_die(FILE *, const char *);
>  extern int copy_fd(int ifd, int ofd);
>  extern int copy_file(const char *dst, const char *src, int mode);
> -extern ssize_t read_in_full(int fd, void *buf, size_t count);
>  extern ssize_t write_in_full(int fd, const void *buf, size_t count);
>  extern void write_or_die(int fd, const void *buf, size_t count);
>  extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 0114734..3b8380f 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -50,6 +50,7 @@ rb_insert_callchain(struct rb_root *root, struct callchain_node *chain,
>  			else
>  				p = &(*p)->rb_right;
>  			break;
> +		case CHAIN_NONE:
>  		default:
>  			break;
>  		}
> @@ -143,6 +144,7 @@ int register_callchain_param(struct callchain_param *param)
>  	case CHAIN_FLAT:
>  		param->sort = sort_chain_flat;
>  		break;
> +	case CHAIN_NONE:
>  	default:
>  		return -1;
>  	}
> diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
> index 90a044d..e47fdeb 100644
> --- a/tools/perf/util/color.c
> +++ b/tools/perf/util/color.c
> @@ -242,9 +242,9 @@ int color_fwrite_lines(FILE *fp, const char *color,
>  	return 0;
>  }
>  
> -char *get_percent_color(double percent)
> +const char *get_percent_color(double percent)
>  {
> -	char *color = PERF_COLOR_NORMAL;
> +	const char *color = PERF_COLOR_NORMAL;
>  
>  	/*
>  	 * We color high-overhead entries in red, mid-overhead
> @@ -263,7 +263,7 @@ char *get_percent_color(double percent)
>  int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
>  {
>  	int r;
> -	char *color;
> +	const char *color;
>  
>  	color = get_percent_color(percent);
>  	r = color_fprintf(fp, color, fmt, percent);
> diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
> index 706cec5..43d0d1b 100644
> --- a/tools/perf/util/color.h
> +++ b/tools/perf/util/color.h
> @@ -36,6 +36,6 @@ 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);
>  int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
> -char *get_percent_color(double percent);
> +const char *get_percent_color(double percent);
>  
>  #endif /* COLOR_H */
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 780df54..8784649 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -160,17 +160,18 @@ static int get_extended_base_var(char *name, int baselen, int c)
>  	name[baselen++] = '.';
>  
>  	for (;;) {
> -		int c = get_next_char();
> -		if (c == '\n')
> +		int ch = get_next_char();
> +
> +		if (ch == '\n')
>  			return -1;
> -		if (c == '"')
> +		if (ch == '"')
>  			break;
> -		if (c == '\\') {
> -			c = get_next_char();
> -			if (c == '\n')
> +		if (ch == '\\') {
> +			ch = get_next_char();
> +			if (ch == '\n')
>  				return -1;
>  		}
> -		name[baselen++] = c;
> +		name[baselen++] = ch;
>  		if (baselen > MAXNAME / 2)
>  			return -1;
>  	}
> @@ -530,6 +531,8 @@ static int store_aux(const char* key, const char* value, void *cb __used)
>  					store.offset[store.seen] = ftell(config_file);
>  			}
>  		}
> +	default:
> +		break;
>  	}
>  	return 0;
>  }
> @@ -619,6 +622,7 @@ contline:
>  		switch (contents[offset]) {
>  			case '=': equal_offset = offset; break;
>  			case ']': bracket_offset = offset; break;
> +			default: break;
>  		}
>  	if (offset > 0 && contents[offset-1] == '\\') {
>  		offset_ = offset;
> @@ -742,9 +746,9 @@ int perf_config_set_multivar(const char* key, const char* value,
>  			goto write_err_out;
>  	} else {
>  		struct stat st;
> -		char* contents;
> +		char *contents;
>  		ssize_t contents_sz, copy_begin, copy_end;
> -		int i, new_line = 0;
> +		int new_line = 0;
>  
>  		if (value_regex == NULL)
>  			store.value_regex = NULL;
> diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
> index 34a3528..2745605 100644
> --- a/tools/perf/util/exec_cmd.c
> +++ b/tools/perf/util/exec_cmd.c
> @@ -6,7 +6,6 @@
>  
>  #define MAX_ARGS	32
>  
> -extern char **environ;
>  static const char *argv_exec_path;
>  static const char *argv0_path;
>  
> diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c
> index ddabe92..3d567fe 100644
> --- a/tools/perf/util/module.c
> +++ b/tools/perf/util/module.c
> @@ -436,9 +436,9 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
>  		goto out_failure;
>  
>  	while (!feof(file)) {
> -		char *path, *name, *tmp;
> +		char *name, *tmp;
>  		struct module *module;
> -		int line_len, len;
> +		int line_len;
>  
>  		line_len = getline(&line, &n, file);
>  		if (line_len < 0)
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 0441784..1cda97b 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -14,10 +14,10 @@ int					nr_counters;
>  struct perf_counter_attr		attrs[MAX_COUNTERS];
>  
>  struct event_symbol {
> -	u8	type;
> -	u64	config;
> -	char	*symbol;
> -	char	*alias;
> +	u8		type;
> +	u64		config;
> +	const char	*symbol;
> +	const char	*alias;
>  };
>  
>  char debugfs_path[MAXPATHLEN];
> @@ -51,7 +51,7 @@ static struct event_symbol event_symbols[] = {
>  #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[] = {
> +static const char *hw_event_names[] = {
>  	"cycles",
>  	"instructions",
>  	"cache-references",
> @@ -61,7 +61,7 @@ static char *hw_event_names[] = {
>  	"bus-cycles",
>  };
>  
> -static char *sw_event_names[] = {
> +static const char *sw_event_names[] = {
>  	"cpu-clock-msecs",
>  	"task-clock-msecs",
>  	"page-faults",
> @@ -73,7 +73,7 @@ static char *sw_event_names[] = {
>  
>  #define MAX_ALIASES 8
>  
> -static char *hw_cache[][MAX_ALIASES] = {
> +static const char *hw_cache[][MAX_ALIASES] = {
>   { "L1-dcache",	"l1-d",		"l1d",		"L1-data",		},
>   { "L1-icache",	"l1-i",		"l1i",		"L1-instruction",	},
>   { "LLC",	"L2"							},
> @@ -82,13 +82,13 @@ static char *hw_cache[][MAX_ALIASES] = {
>   { "branch",	"branches",	"bpu",		"btb",		"bpc",	},
>  };
>  
> -static char *hw_cache_op[][MAX_ALIASES] = {
> +static const char *hw_cache_op[][MAX_ALIASES] = {
>   { "load",	"loads",	"read",					},
>   { "store",	"stores",	"write",				},
>   { "prefetch",	"prefetches",	"speculative-read", "speculative-load",	},
>  };
>  
> -static char *hw_cache_result[][MAX_ALIASES] = {
> +static const char *hw_cache_result[][MAX_ALIASES] = {
>   { "refs",	"Reference",	"ops",		"access",		},
>   { "misses",	"miss",							},
>  };
> @@ -158,7 +158,7 @@ int valid_debugfs_mount(const char *debugfs)
>  	return 0;
>  }
>  
> -static char *tracepoint_id_to_name(u64 config)
> +static const char *tracepoint_id_to_name(u64 config)
>  {
>  	static char tracepoint_name[2 * MAX_EVENT_LENGTH];
>  	DIR *sys_dir, *evt_dir;
> @@ -235,7 +235,7 @@ static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
>  	return name;
>  }
>  
> -char *event_name(int counter)
> +const char *event_name(int counter)
>  {
>  	u64 config = attrs[counter].config;
>  	int type = attrs[counter].type;
> @@ -243,7 +243,7 @@ char *event_name(int counter)
>  	return __event_name(type, config);
>  }
>  
> -char *__event_name(int type, u64 config)
> +const char *__event_name(int type, u64 config)
>  {
>  	static char buf[32];
>  
> @@ -294,7 +294,7 @@ char *__event_name(int type, u64 config)
>  	return "unknown";
>  }
>  
> -static int parse_aliases(const char **str, char *names[][MAX_ALIASES], int size)
> +static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size)
>  {
>  	int i, j;
>  	int n, longest = -1;
> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
> index 192a962..9b1aeea 100644
> --- a/tools/perf/util/parse-events.h
> +++ b/tools/perf/util/parse-events.h
> @@ -9,8 +9,8 @@ extern int			nr_counters;
>  
>  extern struct perf_counter_attr attrs[MAX_COUNTERS];
>  
> -extern char *event_name(int ctr);
> -extern char *__event_name(int type, u64 config);
> +extern const char *event_name(int ctr);
> +extern const char *__event_name(int type, u64 config);
>  
>  extern int parse_events(const struct option *opt, const char *str, int unset);
>  
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index 1bf6719..6d8af48 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -53,6 +53,12 @@ static int get_value(struct parse_opt_ctx_t *p,
>  		case OPTION_SET_INT:
>  		case OPTION_SET_PTR:
>  			return opterror(opt, "takes no value", flags);
> +		case OPTION_END:
> +		case OPTION_ARGUMENT:
> +		case OPTION_GROUP:
> +		case OPTION_STRING:
> +		case OPTION_INTEGER:
> +		case OPTION_LONG:
>  		default:
>  			break;
>  		}
> @@ -130,6 +136,9 @@ static int get_value(struct parse_opt_ctx_t *p,
>  			return opterror(opt, "expects a numerical value", flags);
>  		return 0;
>  
> +	case OPTION_END:
> +	case OPTION_ARGUMENT:
> +	case OPTION_GROUP:
>  	default:
>  		die("should not happen, someone must be hit on the forehead");
>  	}
> @@ -296,6 +305,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  				return parse_options_usage(usagestr, options);
>  			case -2:
>  				goto unknown;
> +			default:
> +				break;
>  			}
>  			if (ctx->opt)
>  				check_typos(arg + 1, options);
> @@ -314,6 +325,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  					ctx->argv[0] = strdup(ctx->opt - 1);
>  					*(char *)ctx->argv[0] = '-';
>  					goto unknown;
> +				default:
> +					break;
>  				}
>  			}
>  			continue;
> @@ -336,6 +349,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  			return parse_options_usage(usagestr, options);
>  		case -2:
>  			goto unknown;
> +		default:
> +			break;
>  		}
>  		continue;
>  unknown:
> @@ -456,6 +471,13 @@ int usage_with_options_internal(const char * const *usagestr,
>  			}
>  			break;
>  		default: /* OPTION_{BIT,BOOLEAN,SET_INT,SET_PTR} */
> +		case OPTION_END:
> +		case OPTION_GROUP:
> +		case OPTION_BIT:
> +		case OPTION_BOOLEAN:
> +		case OPTION_SET_INT:
> +		case OPTION_SET_PTR:
> +		case OPTION_LONG:
>  			break;
>  		}
>  
> diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c
> index a501a40..fd1f2fa 100644
> --- a/tools/perf/util/path.c
> +++ b/tools/perf/util/path.c
> @@ -17,7 +17,7 @@ static char bad_path[] = "/bad-path/";
>   * Two hacks:
>   */
>  
> -static char *get_perf_dir(void)
> +static const char *get_perf_dir(void)
>  {
>  	return ".";
>  }
> @@ -38,8 +38,9 @@ size_t strlcpy(char *dest, const char *src, size_t size)
>  static char *get_pathname(void)
>  {
>  	static char pathname_array[4][PATH_MAX];
> -	static int index;
> -	return pathname_array[3 & ++index];
> +	static int idx;
> +
> +	return pathname_array[3 & ++idx];
>  }
>  
>  static char *cleanup_path(char *path)
> @@ -161,20 +162,24 @@ int perf_mkstemp(char *path, size_t len, const char *template)
>  }
>  
>  
> -const char *make_relative_path(const char *abs, const char *base)
> +const char *make_relative_path(const char *abs_path, const char *base)
>  {
>  	static char buf[PATH_MAX + 1];
>  	int baselen;
> +
>  	if (!base)
> -		return abs;
> +		return abs_path;
> +
>  	baselen = strlen(base);
> -	if (prefixcmp(abs, base))
> -		return abs;
> -	if (abs[baselen] == '/')
> +	if (prefixcmp(abs_path, base))
> +		return abs_path;
> +	if (abs_path[baselen] == '/')
>  		baselen++;
>  	else if (base[baselen - 1] != '/')
> -		return abs;
> -	strcpy(buf, abs + baselen);
> +		return abs_path;
> +
> +	strcpy(buf, abs_path + baselen);
> +
>  	return buf;
>  }
>  
> diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
> index a393534..2b615ac 100644
> --- a/tools/perf/util/run-command.c
> +++ b/tools/perf/util/run-command.c
> @@ -262,7 +262,7 @@ int run_hook(const char *index_file, const char *name, ...)
>  {
>  	struct child_process hook;
>  	const char **argv = NULL, *env[2];
> -	char index[PATH_MAX];
> +	char idx[PATH_MAX];
>  	va_list args;
>  	int ret;
>  	size_t i = 0, alloc = 0;
> @@ -284,8 +284,8 @@ int run_hook(const char *index_file, const char *name, ...)
>  	hook.no_stdin = 1;
>  	hook.stdout_to_stderr = 1;
>  	if (index_file) {
> -		snprintf(index, sizeof(index), "PERF_INDEX_FILE=%s", index_file);
> -		env[0] = index;
> +		snprintf(idx, sizeof(idx), "PERF_INDEX_FILE=%s", index_file);
> +		env[0] = idx;
>  		env[1] = NULL;
>  		hook.env = env;
>  	}
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 0b98623..3159d47 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -21,7 +21,7 @@ enum dso_origin {
>  
>  static struct symbol *symbol__new(u64 start, u64 len,
>  				  const char *name, unsigned int priv_size,
> -				  u64 obj_start, int verbose)
> +				  u64 obj_start, int v)
>  {
>  	size_t namelen = strlen(name) + 1;
>  	struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
> @@ -29,7 +29,7 @@ static struct symbol *symbol__new(u64 start, u64 len,
>  	if (!self)
>  		return NULL;
>  
> -	if (verbose >= 2)
> +	if (v >= 2)
>  		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
>  			(u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
>  
> @@ -156,7 +156,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp)
>  	return ret;
>  }
>  
> -static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
> +static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	struct rb_node *nd, *prevnd;
>  	char *line = NULL;
> @@ -198,7 +198,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, 0, verbose);
> +				  self->sym_priv_size, 0, v);
>  
>  		if (sym == NULL)
>  			goto out_delete_line;
> @@ -239,7 +239,7 @@ out_failure:
>  	return -1;
>  }
>  
> -static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verbose)
> +static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	char *line = NULL;
>  	size_t n;
> @@ -277,7 +277,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb
>  			continue;
>  
>  		sym = symbol__new(start, size, line + len,
> -				  self->sym_priv_size, start, verbose);
> +				  self->sym_priv_size, start, v);
>  
>  		if (sym == NULL)
>  			goto out_delete_line;
> @@ -305,13 +305,13 @@ out_failure:
>   * elf_symtab__for_each_symbol - iterate thru all the symbols
>   *
>   * @self: struct elf_symtab instance to iterate
> - * @index: uint32_t index
> + * @idx: uint32_t idx
>   * @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))
> +#define elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) \
> +	for (idx = 0, gelf_getsym(syms, idx, &sym);\
> +	     idx < nr_syms; \
> +	     idx++, gelf_getsym(syms, idx, &sym))
>  
>  static inline uint8_t elf_sym__type(const GElf_Sym *sym)
>  {
> @@ -354,7 +354,7 @@ static inline const char *elf_sym__name(const GElf_Sym *sym,
>  
>  static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>  				    GElf_Shdr *shp, const char *name,
> -				    size_t *index)
> +				    size_t *idx)
>  {
>  	Elf_Scn *sec = NULL;
>  	size_t cnt = 1;
> @@ -365,8 +365,8 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>  		gelf_getshdr(sec, shp);
>  		str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
>  		if (!strcmp(name, str)) {
> -			if (index)
> -				*index = cnt;
> +			if (idx)
> +				*idx = cnt;
>  			break;
>  		}
>  		++cnt;
> @@ -392,7 +392,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>   * And always look at the original dso, not at debuginfo packages, that
>   * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
>   */
> -static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
> +static int dso__synthesize_plt_symbols(struct  dso *self, int v)
>  {
>  	uint32_t nr_rel_entries, idx;
>  	GElf_Sym sym;
> @@ -442,7 +442,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  		goto out_elf_end;
>  
>  	/*
> -	 * Fetch the relocation section to find the indexes to the GOT
> +	 * Fetch the relocation section to find the idxes to the GOT
>  	 * and the symbols in the .dynsym they refer to.
>  	 */
>  	reldata = elf_getdata(scn_plt_rel, NULL);
> @@ -476,7 +476,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size, 0, verbose);
> +					sympltname, self->sym_priv_size, 0, v);
>  			if (!f)
>  				goto out_elf_end;
>  
> @@ -494,7 +494,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size, 0, verbose);
> +					sympltname, self->sym_priv_size, 0, v);
>  			if (!f)
>  				goto out_elf_end;
>  
> @@ -518,12 +518,12 @@ out:
>  }
>  
>  static int dso__load_sym(struct dso *self, int fd, const char *name,
> -			 symbol_filter_t filter, int verbose, struct module *mod)
> +			 symbol_filter_t filter, int v, struct module *mod)
>  {
>  	Elf_Data *symstrs, *secstrs;
>  	uint32_t nr_syms;
>  	int err = -1;
> -	uint32_t index;
> +	uint32_t idx;
>  	GElf_Ehdr ehdr;
>  	GElf_Shdr shdr;
>  	Elf_Data *syms;
> @@ -534,14 +534,14 @@ 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) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot read %s ELF file.\n",
>  				__func__, name);
>  		goto out_close;
>  	}
>  
>  	if (gelf_getehdr(elf, &ehdr) == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
>  		goto out_elf_end;
>  	}
> @@ -583,9 +583,9 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  						     NULL) != NULL);
>  	} else self->adjust_symbols = 0;
>  
> -	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
> +	elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
>  		struct symbol *f;
> -		const char *name;
> +		const char *elf_name;
>  		char *demangled;
>  		u64 obj_start;
>  		struct section *section = NULL;
> @@ -608,7 +608,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  		obj_start = sym.st_value;
>  
>  		if (self->adjust_symbols) {
> -			if (verbose >= 2)
> +			if (v >= 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);
>  
> @@ -630,13 +630,13 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  		 * DWARF DW_compile_unit has this, but we don't always have access
>  		 * to it...
>  		 */
> -		name = elf_sym__name(&sym, symstrs);
> -		demangled = bfd_demangle(NULL, name, DMGL_PARAMS | DMGL_ANSI);
> +		elf_name = elf_sym__name(&sym, symstrs);
> +		demangled = bfd_demangle(NULL, elf_name, DMGL_PARAMS | DMGL_ANSI);
>  		if (demangled != NULL)
> -			name = demangled;
> +			elf_name = demangled;
>  
> -		f = symbol__new(sym.st_value, sym.st_size, name,
> -				self->sym_priv_size, obj_start, verbose);
> +		f = symbol__new(sym.st_value, sym.st_size, elf_name,
> +				self->sym_priv_size, obj_start, v);
>  		free(demangled);
>  		if (!f)
>  			goto out_elf_end;
> @@ -659,7 +659,7 @@ out_close:
>  
>  #define BUILD_ID_SIZE 128
>  
> -static char *dso__read_build_id(struct dso *self, int verbose)
> +static char *dso__read_build_id(struct dso *self, int v)
>  {
>  	int i;
>  	GElf_Ehdr ehdr;
> @@ -676,14 +676,14 @@ static char *dso__read_build_id(struct dso *self, int verbose)
>  
>  	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
>  	if (elf == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot read %s ELF file.\n",
>  				__func__, self->name);
>  		goto out_close;
>  	}
>  
>  	if (gelf_getehdr(elf, &ehdr) == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
>  		goto out_elf_end;
>  	}
> @@ -706,7 +706,7 @@ static char *dso__read_build_id(struct dso *self, int verbose)
>  		++raw;
>  		bid += 2;
>  	}
> -	if (verbose >= 2)
> +	if (v >= 2)
>  		printf("%s(%s): %s\n", __func__, self->name, build_id);
>  out_elf_end:
>  	elf_end(elf);
> @@ -732,7 +732,7 @@ char dso__symtab_origin(const struct dso *self)
>  	return origin[self->origin];
>  }
>  
> -int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
> +int dso__load(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	int size = PATH_MAX;
>  	char *name = malloc(size), *build_id = NULL;
> @@ -745,7 +745,7 @@ int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
>  	self->adjust_symbols = 0;
>  
>  	if (strncmp(self->name, "/tmp/perf-", 10) == 0) {
> -		ret = dso__load_perf_map(self, filter, verbose);
> +		ret = dso__load_perf_map(self, filter, v);
>  		self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT :
>  					 DSO__ORIG_NOT_FOUND;
>  		return ret;
> @@ -764,7 +764,7 @@ more:
>  			snprintf(name, size, "/usr/lib/debug%s", self->name);
>  			break;
>  		case DSO__ORIG_BUILDID:
> -			build_id = dso__read_build_id(self, verbose);
> +			build_id = dso__read_build_id(self, v);
>  			if (build_id != NULL) {
>  				snprintf(name, size,
>  					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
> @@ -785,7 +785,7 @@ more:
>  		fd = open(name, O_RDONLY);
>  	} while (fd < 0);
>  
> -	ret = dso__load_sym(self, fd, name, filter, verbose, NULL);
> +	ret = dso__load_sym(self, fd, name, filter, v, NULL);
>  	close(fd);
>  
>  	/*
> @@ -795,7 +795,7 @@ more:
>  		goto more;
>  
>  	if (ret > 0) {
> -		int nr_plt = dso__synthesize_plt_symbols(self, verbose);
> +		int nr_plt = dso__synthesize_plt_symbols(self, v);
>  		if (nr_plt > 0)
>  			ret += nr_plt;
>  	}
> @@ -807,7 +807,7 @@ out:
>  }
>  
>  static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *name,
> -			     symbol_filter_t filter, int verbose)
> +			     symbol_filter_t filter, int v)
>  {
>  	struct module *mod = mod_dso__find_module(mods, name);
>  	int err = 0, fd;
> @@ -820,13 +820,13 @@ static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *
>  	if (fd < 0)
>  		return err;
>  
> -	err = dso__load_sym(self, fd, name, filter, verbose, mod);
> +	err = dso__load_sym(self, fd, name, filter, v, mod);
>  	close(fd);
>  
>  	return err;
>  }
>  
> -int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
> +int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	struct mod_dso *mods = mod_dso__new_dso("modules");
>  	struct module *pos;
> @@ -844,7 +844,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
>  	next = rb_first(&mods->mods);
>  	while (next) {
>  		pos = rb_entry(next, struct module, rb_node);
> -		err = dso__load_module(self, mods, pos->name, filter, verbose);
> +		err = dso__load_module(self, mods, pos->name, filter, v);
>  
>  		if (err < 0)
>  			break;
> @@ -887,14 +887,14 @@ static inline void dso__fill_symbol_holes(struct dso *self)
>  }
>  
>  static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
> -			     symbol_filter_t filter, int verbose)
> +			     symbol_filter_t filter, int v)
>  {
>  	int err, fd = open(vmlinux, O_RDONLY);
>  
>  	if (fd < 0)
>  		return -1;
>  
> -	err = dso__load_sym(self, fd, vmlinux, filter, verbose, NULL);
> +	err = dso__load_sym(self, fd, vmlinux, filter, v, NULL);
>  
>  	if (err > 0)
>  		dso__fill_symbol_holes(self);
> @@ -905,18 +905,18 @@ static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
>  }
>  
>  int dso__load_kernel(struct dso *self, const char *vmlinux,
> -		     symbol_filter_t filter, int verbose, int modules)
> +		     symbol_filter_t filter, int v, int use_modules)
>  {
>  	int err = -1;
>  
>  	if (vmlinux) {
> -		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
> -		if (err > 0 && modules)
> -			err = dso__load_modules(self, filter, verbose);
> +		err = dso__load_vmlinux(self, vmlinux, filter, v);
> +		if (err > 0 && use_modules)
> +			err = dso__load_modules(self, filter, v);
>  	}
>  
>  	if (err <= 0)
> -		err = dso__load_kallsyms(self, filter, verbose);
> +		err = dso__load_kallsyms(self, filter, v);
>  
>  	if (err > 0)
>  		self->origin = DSO__ORIG_KERNEL;
> @@ -929,7 +929,7 @@ struct dso	*kernel_dso;
>  struct dso	*vdso;
>  struct dso	*hypervisor_dso;
>  
> -char		*vmlinux = "vmlinux";
> +const char	*vmlinux_name = "vmlinux";
>  int		modules;
>  
>  static void dsos__add(struct dso *dso)
> @@ -997,7 +997,7 @@ int load_kernel(void)
>  	if (!kernel_dso)
>  		return -1;
>  
> -	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules);
> +	err = dso__load_kernel(kernel_dso, vmlinux_name, NULL, verbose, modules);
>  	if (err <= 0) {
>  		dso__delete(kernel_dso);
>  		kernel_dso = NULL;
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 48b8e57..6e84907 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -55,7 +55,7 @@ struct dso {
>  	char		 name[0];
>  };
>  
> -const char *sym_hist_filter;
> +extern const char *sym_hist_filter;
>  
>  typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
>  
> @@ -87,6 +87,6 @@ extern struct list_head dsos;
>  extern struct dso *kernel_dso;
>  extern struct dso *vdso;
>  extern struct dso *hypervisor_dso;
> -extern char *vmlinux;
> +extern const char *vmlinux_name;
>  extern int   modules;
>  #endif /* _PERF_SYMBOL_ */
> diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
> index 614cfaf..1c15e39 100644
> --- a/tools/perf/util/values.c
> +++ b/tools/perf/util/values.c
> @@ -96,7 +96,7 @@ static void perf_read_values__enlarge_counters(struct perf_read_values *values)
>  }
>  
>  static int perf_read_values__findnew_counter(struct perf_read_values *values,
> -					     u64 rawid, char *name)
> +					     u64 rawid, const char *name)
>  {
>  	int i;
>  
> @@ -116,7 +116,7 @@ static int perf_read_values__findnew_counter(struct perf_read_values *values,
>  
>  void perf_read_values_add_value(struct perf_read_values *values,
>  				u32 pid, u32 tid,
> -				u64 rawid, char *name, u64 value)
> +				u64 rawid, const char *name, u64 value)
>  {
>  	int tindex, cindex;
>  
> @@ -221,8 +221,7 @@ static void perf_read_values__display_raw(FILE *fp,
>  				countwidth, values->value[i][j]);
>  }
>  
> -void perf_read_values_display(FILE *fp, struct perf_read_values *values,
> -			      int raw)
> +void perf_read_values_display(FILE *fp, struct perf_read_values *values, int raw)
>  {
>  	if (raw)
>  		perf_read_values__display_raw(fp, values);
> diff --git a/tools/perf/util/values.h b/tools/perf/util/values.h
> index f8960fd..cadf8cf 100644
> --- a/tools/perf/util/values.h
> +++ b/tools/perf/util/values.h
> @@ -19,7 +19,7 @@ void perf_read_values_destroy(struct perf_read_values *values);
>  
>  void perf_read_values_add_value(struct perf_read_values *values,
>  				u32 pid, u32 tid,
> -				u64 rawid, char *name, u64 value);
> +				u64 rawid, const char *name, u64 value);
>  
>  void perf_read_values_display(FILE *fp, struct perf_read_values *values,
>  			      int raw);


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

* [PATCH] perf tools: Revert the -Wswitch-enum flag
  2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
  2009-08-16 12:46                 ` Frederic Weisbecker
@ 2009-08-16 12:53                 ` Frederic Weisbecker
  2009-08-16 14:15                 ` [tip:perfcounters/core] perf: Enable more compiler warnings Frederic Weisbecker
  2 siblings, 0 replies; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-08-16 12:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mike Galbraith

-Wswitch-enum warns when a switch statement doesn't handle
every enum values of a given type.

But it also warns whn we have a default case where we handle them.
This forces workarounds like having a rain of ignored enum values
cases falling down to the default case.

We want to be sure that every cases are handled (which is what does
-Wswitch-default), but we don't want to explicitly write what must
fall down to the default case.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
---
 tools/perf/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d637aea..c7c2645 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,7 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
 
 CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm
-- 
1.6.2.3


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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16 12:46                 ` Frederic Weisbecker
@ 2009-08-16 14:01                   ` Ingo Molnar
  2009-08-16 14:06                     ` Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-16 14:01 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> > 
> > perf: Enable more compiler warnings
> > 
> > Related to a shadowed variable bug fix Valdis Kletnieks noticed
> > that perf does not get built with -Wshadow, which could have
> > helped us avoid the bug.
> > 
> > So enable -Wshadow and also enable the following warnings on
> > perf builds, in addition to the already enabled -Wall -Wextra
> > -std=gnu99 warnings:
> > 
> >  -Wcast-align
> >  -Wformat=2
> >  -Wshadow
> >  -Winit-self
> >  -Wpacked
> >  -Wredundant-decls
> >  -Wstack-protector
> >  -Wstrict-aliasing=3
> >  -Wswitch-default
> >  -Wswitch-enum
> 
> 
> 
> This one looks like more a pain than something useful.
> 
> I have this code in perf trace:
> 
> static int event_item_type(enum event_type type)
> {
> 	switch (type) {
> 	case EVENT_ITEM:
> 	case EVENT_DQUOTE:
> 	case EVENT_SQUOTE:
> 		return 1;
> 	default:
> 		return 0;
> 	}
> }
> 
> Which results in:
> 
> util/trace-event-parse.c: In function ‘event_item_type’:
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_ERROR’ not handled in switch
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NONE’ not handled in switch
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_SPACE’ not handled in switch
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NEWLINE’ not handled in switch
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_OP’ not handled in switch
> util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_DELIM’ not handled in switch
> 
> The default case already handles these and I guess we don't want workarounds like:
> 
> static int event_item_type(enum event_type type)
> {
>         switch (type) {
>         case EVENT_ITEM:
>         case EVENT_DQUOTE:
>         case EVENT_SQUOTE:
>                 return 1;
> 	case EVENT_ERROR:
> 	case EVENT_NONE:
> 	case EVENT_SPACE:
> 	case EVENT_NEWLINE:
> 	case EVENT_OP:
> 	case EVENT_DELIM:
>         default:
>                 return 0;
>         }
> }
> 
> 
> Right? :-)
> 
> This warning might be useful for *very* specific cases, but not here IMO.

i think it's useful when an enum gets extended. Say we add a new 
event enum and want to make sure it's handled in _all_ switch 
statements that deals with them. This warning ensures that we 
propagate the new case to all usage sites.

	Ingo

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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16 14:01                   ` Ingo Molnar
@ 2009-08-16 14:06                     ` Frederic Weisbecker
  2009-08-16 15:22                       ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-08-16 14:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits

On Sun, Aug 16, 2009 at 04:01:54PM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> > > Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > > Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > > Author:     Ingo Molnar <mingo@elte.hu>
> > > AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> > > 
> > > perf: Enable more compiler warnings
> > > 
> > > Related to a shadowed variable bug fix Valdis Kletnieks noticed
> > > that perf does not get built with -Wshadow, which could have
> > > helped us avoid the bug.
> > > 
> > > So enable -Wshadow and also enable the following warnings on
> > > perf builds, in addition to the already enabled -Wall -Wextra
> > > -std=gnu99 warnings:
> > > 
> > >  -Wcast-align
> > >  -Wformat=2
> > >  -Wshadow
> > >  -Winit-self
> > >  -Wpacked
> > >  -Wredundant-decls
> > >  -Wstack-protector
> > >  -Wstrict-aliasing=3
> > >  -Wswitch-default
> > >  -Wswitch-enum
> > 
> > 
> > 
> > This one looks like more a pain than something useful.
> > 
> > I have this code in perf trace:
> > 
> > static int event_item_type(enum event_type type)
> > {
> > 	switch (type) {
> > 	case EVENT_ITEM:
> > 	case EVENT_DQUOTE:
> > 	case EVENT_SQUOTE:
> > 		return 1;
> > 	default:
> > 		return 0;
> > 	}
> > }
> > 
> > Which results in:
> > 
> > util/trace-event-parse.c: In function ‘event_item_type’:
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_ERROR’ not handled in switch
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NONE’ not handled in switch
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_SPACE’ not handled in switch
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NEWLINE’ not handled in switch
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_OP’ not handled in switch
> > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_DELIM’ not handled in switch
> > 
> > The default case already handles these and I guess we don't want workarounds like:
> > 
> > static int event_item_type(enum event_type type)
> > {
> >         switch (type) {
> >         case EVENT_ITEM:
> >         case EVENT_DQUOTE:
> >         case EVENT_SQUOTE:
> >                 return 1;
> > 	case EVENT_ERROR:
> > 	case EVENT_NONE:
> > 	case EVENT_SPACE:
> > 	case EVENT_NEWLINE:
> > 	case EVENT_OP:
> > 	case EVENT_DELIM:
> >         default:
> >                 return 0;
> >         }
> > }
> > 
> > 
> > Right? :-)
> > 
> > This warning might be useful for *very* specific cases, but not here IMO.
> 
> i think it's useful when an enum gets extended. Say we add a new 
> event enum and want to make sure it's handled in _all_ switch 
> statements that deals with them. This warning ensures that we 
> propagate the new case to all usage sites.
> 
> 	Ingo


Ok, it's a bit annoying to cover all enum cases but well, I agree
with the above possibility...


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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
  2009-08-16 12:46                 ` Frederic Weisbecker
  2009-08-16 12:53                 ` [PATCH] perf tools: Revert the -Wswitch-enum flag Frederic Weisbecker
@ 2009-08-16 14:15                 ` Frederic Weisbecker
  2009-08-16 15:18                   ` Ingo Molnar
  2 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-08-16 14:15 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, mingo
  Cc: linux-tip-commits

On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> 
> perf: Enable more compiler warnings
> 
> Related to a shadowed variable bug fix Valdis Kletnieks noticed
> that perf does not get built with -Wshadow, which could have
> helped us avoid the bug.
> 
> So enable -Wshadow and also enable the following warnings on
> perf builds, in addition to the already enabled -Wall -Wextra
> -std=gnu99 warnings:
> 
>  -Wcast-align
>  -Wformat=2


I also have code like the following from perf trace:

char format[32];
[...]

memcpy(format, dynamic_built_format, ...)

printf(format, ....)

And that triggers warnings like that:

util/trace-event-parse.c:2280: error: format is not a literal string, argument types can't be checked

Do we also want these?

ftrace uses dynamic format definition, and it's a natural way to copy them
from debugfs and then used like that.

Especially here perf trace checked the format against bad things.

Frederic.



>  -Wshadow
>  -Winit-self
>  -Wpacked
>  -Wredundant-decls
>  -Wstack-protector
>  -Wstrict-aliasing=3
>  -Wswitch-default
>  -Wswitch-enum
>  -Wno-system-headers
>  -Wundef
>  -Wvolatile-register-var
>  -Wwrite-strings
>  -Wbad-function-cast
>  -Wmissing-declarations
>  -Wmissing-prototypes
>  -Wnested-externs
>  -Wold-style-definition
>  -Wstrict-prototypes
>  -Wdeclaration-after-statement
> 
> And change/fix the perf code to build cleanly under GCC 4.3.2.
> 
> The list of warnings enablement is rather arbitrary: it's based
> on my (quick) reading of the GCC manpages and trying them on
> perf.
> 
> I categorized the warnings based on individually enabling them
> and looking whether they trigger something in the perf build.
> If i liked those warnings (i.e. if they trigger for something
> that arguably could be improved) i enabled the warning.
> 
> If the warnings seemed to come from language laywers spamming
> the build with tons of nuisance warnings i generally kept them
> off. Most of the sign conversion related warnings were in
> this category. (A second patch enabling some of the sign
> warnings might be welcome - sign bugs can be nasty.)
> 
> I also kept warnings that seem to make sense from their manpage
> description and which produced no actual warnings on our code
> base. These warnings might still be turned off if they end up
> being a nuisance.
> 
> I also left out a few warnings that are not supported in older
> compilers.
> 
> [ Note that these changes might break the build on older
>   compilers i did not test, or on non-x86 architectures that
>   produce different warnings, so more testing would be welcome. ]
> 
> Reported-by: Valdis.Kletnieks@vt.edu
> 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             |    7 ++-
>  tools/perf/builtin-annotate.c   |   32 ++++++------
>  tools/perf/builtin-help.c       |    1 +
>  tools/perf/builtin-report.c     |   38 ++++++++-------
>  tools/perf/builtin-top.c        |   23 ++++++---
>  tools/perf/util/abspath.c       |    3 +-
>  tools/perf/util/cache.h         |    1 -
>  tools/perf/util/callchain.c     |    2 +
>  tools/perf/util/color.c         |    6 +-
>  tools/perf/util/color.h         |    2 +-
>  tools/perf/util/config.c        |   22 +++++---
>  tools/perf/util/exec_cmd.c      |    1 -
>  tools/perf/util/module.c        |    4 +-
>  tools/perf/util/parse-events.c  |   26 +++++-----
>  tools/perf/util/parse-events.h  |    4 +-
>  tools/perf/util/parse-options.c |   22 ++++++++
>  tools/perf/util/path.c          |   25 ++++++----
>  tools/perf/util/run-command.c   |    6 +-
>  tools/perf/util/symbol.c        |  104 +++++++++++++++++++-------------------
>  tools/perf/util/symbol.h        |    4 +-
>  tools/perf/util/values.c        |    7 +--
>  tools/perf/util/values.h        |    2 +-
>  22 files changed, 194 insertions(+), 148 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 0056405..8608c06 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -166,7 +166,12 @@ endif
>  
>  # CFLAGS and LDFLAGS are for the users to override from the command line.
>  
> -CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
> +#
> +# Include saner warnings here, which can catch bugs:
> +#
> +EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
> +
> +CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 $(EXTRA_WARNINGS)
>  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 3bedaa5..32ff983 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -81,7 +81,7 @@ struct hist_entry {
>  struct sort_entry {
>  	struct list_head list;
>  
> -	char *header;
> +	const char *header;
>  
>  	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
>  	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
> @@ -225,7 +225,7 @@ static struct sort_entry sort_sym = {
>  static int sort__need_collapse = 0;
>  
>  struct sort_dimension {
> -	char			*name;
> +	const char		*name;
>  	struct sort_entry	*entry;
>  	int			taken;
>  };
> @@ -723,7 +723,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len)
>  		const char *path = NULL;
>  		unsigned int hits = 0;
>  		double percent = 0.0;
> -		char *color;
> +		const char *color;
>  		struct sym_ext *sym_ext = sym->priv;
>  
>  		offset = line_ip - start;
> @@ -805,7 +805,7 @@ static void free_source_line(struct symbol *sym, int len)
>  
>  /* Get the filename:line for the colored entries */
>  static void
> -get_source_line(struct symbol *sym, u64 start, int len, char *filename)
> +get_source_line(struct symbol *sym, u64 start, int len, const char *filename)
>  {
>  	int i;
>  	char cmd[PATH_MAX * 2];
> @@ -851,7 +851,7 @@ get_source_line(struct symbol *sym, u64 start, int len, char *filename)
>  	}
>  }
>  
> -static void print_summary(char *filename)
> +static void print_summary(const char *filename)
>  {
>  	struct sym_ext *sym_ext;
>  	struct rb_node *node;
> @@ -867,7 +867,7 @@ static void print_summary(char *filename)
>  	node = rb_first(&root_sym_ext);
>  	while (node) {
>  		double percent;
> -		char *color;
> +		const char *color;
>  		char *path;
>  
>  		sym_ext = rb_entry(node, struct sym_ext, node);
> @@ -882,7 +882,7 @@ static void print_summary(char *filename)
>  
>  static void annotate_sym(struct dso *dso, struct symbol *sym)
>  {
> -	char *filename = dso->name, *d_filename;
> +	const char *filename = dso->name, *d_filename;
>  	u64 start, end, len;
>  	char command[PATH_MAX*2];
>  	FILE *file;
> @@ -892,7 +892,7 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
>  	if (sym->module)
>  		filename = sym->module->path;
>  	else if (dso == kernel_dso)
> -		filename = vmlinux;
> +		filename = vmlinux_name;
>  
>  	start = sym->obj_start;
>  	if (!start)
> @@ -964,7 +964,7 @@ static int __cmd_annotate(void)
>  	int ret, rc = EXIT_FAILURE;
>  	unsigned long offset = 0;
>  	unsigned long head = 0;
> -	struct stat stat;
> +	struct stat input_stat;
>  	event_t *event;
>  	uint32_t size;
>  	char *buf;
> @@ -977,13 +977,13 @@ static int __cmd_annotate(void)
>  		exit(-1);
>  	}
>  
> -	ret = fstat(input, &stat);
> +	ret = fstat(input, &input_stat);
>  	if (ret < 0) {
>  		perror("failed to stat file");
>  		exit(-1);
>  	}
>  
> -	if (!stat.st_size) {
> +	if (!input_stat.st_size) {
>  		fprintf(stderr, "zero-sized file, nothing to do!\n");
>  		exit(0);
>  	}
> @@ -1010,10 +1010,10 @@ more:
>  
>  	if (head + event->header.size >= page_size * mmap_window) {
>  		unsigned long shift = page_size * (head / page_size);
> -		int ret;
> +		int munmap_ret;
>  
> -		ret = munmap(buf, page_size * mmap_window);
> -		assert(ret == 0);
> +		munmap_ret = munmap(buf, page_size * mmap_window);
> +		assert(munmap_ret == 0);
>  
>  		offset += shift;
>  		head -= shift;
> @@ -1049,7 +1049,7 @@ more:
>  
>  	head += size;
>  
> -	if (offset + head < (unsigned long)stat.st_size)
> +	if (offset + head < (unsigned long)input_stat.st_size)
>  		goto more;
>  
>  	rc = EXIT_SUCCESS;
> @@ -1092,7 +1092,7 @@ static const struct option options[] = {
>  		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_BOOLEAN('m', "modules", &modules,
>  		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
>  	OPT_BOOLEAN('l', "print-line", &print_line,
> diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
> index 2599d86..4fb8734 100644
> --- a/tools/perf/builtin-help.c
> +++ b/tools/perf/builtin-help.c
> @@ -456,6 +456,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __used)
>  		break;
>  	case HELP_FORMAT_WEB:
>  		show_html_page(argv[0]);
> +	default:
>  		break;
>  	}
>  
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 298f26b..3b9d24d 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -97,6 +97,7 @@ static int repsep_fprintf(FILE *fp, const char *fmt, ...)
>  		n = vasprintf(&bf, fmt, ap);
>  		if (n > 0) {
>  			char *sep = bf;
> +
>  			while (1) {
>  				sep = strchr(sep, *field_sep);
>  				if (sep == NULL)
> @@ -144,7 +145,7 @@ struct hist_entry {
>  struct sort_entry {
>  	struct list_head list;
>  
> -	char *header;
> +	const char *header;
>  
>  	int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
>  	int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
> @@ -328,7 +329,7 @@ static int sort__need_collapse = 0;
>  static int sort__has_parent = 0;
>  
>  struct sort_dimension {
> -	char			*name;
> +	const char		*name;
>  	struct sort_entry	*entry;
>  	int			taken;
>  };
> @@ -343,7 +344,7 @@ static struct sort_dimension sort_dimensions[] = {
>  
>  static LIST_HEAD(hist_entry__sort_list);
>  
> -static int sort_dimension__add(char *tok)
> +static int sort_dimension__add(const char *tok)
>  {
>  	unsigned int i;
>  
> @@ -602,6 +603,7 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
>  		case CHAIN_GRAPH_REL:
>  			ret += callchain__fprintf_graph(fp, chain,
>  							total_samples, 1, 1);
> +		case CHAIN_NONE:
>  		default:
>  			break;
>  		}
> @@ -1290,7 +1292,7 @@ process_lost_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;
> +	const char *color = PERF_COLOR_BLUE;
>  	int i, j;
>  
>  	if (!dump_trace)
> @@ -1348,7 +1350,7 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head)
>  	struct perf_counter_attr *attr = perf_header__find_attr(event->read.id);
>  
>  	if (show_threads) {
> -		char *name = attr ? __event_name(attr->type, attr->config)
> +		const char *name = attr ? __event_name(attr->type, attr->config)
>  				   : "unknown";
>  		perf_read_values_add_value(&show_threads_values,
>  					   event->read.pid, event->read.tid,
> @@ -1411,19 +1413,19 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
>  
>  static u64 perf_header__sample_type(void)
>  {
> -	u64 sample_type = 0;
> +	u64 type = 0;
>  	int i;
>  
>  	for (i = 0; i < header->attrs; i++) {
>  		struct perf_header_attr *attr = header->attr[i];
>  
> -		if (!sample_type)
> -			sample_type = attr->attr.sample_type;
> -		else if (sample_type != attr->attr.sample_type)
> +		if (!type)
> +			type = attr->attr.sample_type;
> +		else if (type != attr->attr.sample_type)
>  			die("non matching sample_type");
>  	}
>  
> -	return sample_type;
> +	return type;
>  }
>  
>  static int __cmd_report(void)
> @@ -1431,7 +1433,7 @@ static int __cmd_report(void)
>  	int ret, rc = EXIT_FAILURE;
>  	unsigned long offset = 0;
>  	unsigned long head, shift;
> -	struct stat stat;
> +	struct stat input_stat;
>  	event_t *event;
>  	uint32_t size;
>  	char *buf;
> @@ -1450,13 +1452,13 @@ static int __cmd_report(void)
>  		exit(-1);
>  	}
>  
> -	ret = fstat(input, &stat);
> +	ret = fstat(input, &input_stat);
>  	if (ret < 0) {
>  		perror("failed to stat file");
>  		exit(-1);
>  	}
>  
> -	if (!stat.st_size) {
> +	if (!input_stat.st_size) {
>  		fprintf(stderr, "zero-sized file, nothing to do!\n");
>  		exit(0);
>  	}
> @@ -1524,12 +1526,12 @@ more:
>  		size = 8;
>  
>  	if (head + event->header.size >= page_size * mmap_window) {
> -		int ret;
> +		int munmap_ret;
>  
>  		shift = page_size * (head / page_size);
>  
> -		ret = munmap(buf, page_size * mmap_window);
> -		assert(ret == 0);
> +		munmap_ret = munmap(buf, page_size * mmap_window);
> +		assert(munmap_ret == 0);
>  
>  		offset += shift;
>  		head -= shift;
> @@ -1568,7 +1570,7 @@ more:
>  	if (offset + head >= header->data_offset + header->data_size)
>  		goto done;
>  
> -	if (offset + head < (unsigned long)stat.st_size)
> +	if (offset + head < (unsigned long)input_stat.st_size)
>  		goto more;
>  
>  done:
> @@ -1666,7 +1668,7 @@ static const struct option options[] = {
>  		    "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('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_BOOLEAN('m', "modules", &modules,
>  		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
>  	OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 9a6dbbf..06f763e 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -120,7 +120,8 @@ static void parse_source(struct sym_entry *syme)
>  	struct module *module;
>  	struct section *section = NULL;
>  	FILE *file;
> -	char command[PATH_MAX*2], *path = vmlinux;
> +	char command[PATH_MAX*2];
> +	const char *path = vmlinux_name;
>  	u64 start, end, len;
>  
>  	if (!syme)
> @@ -487,10 +488,12 @@ 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);
> +		struct symbol *sym;
>  		double pcnt;
>  
> +		syme = rb_entry(nd, struct sym_entry, rb_node);
> +		sym = (struct symbol *)(syme + 1);
> +
>  		if (++printed > print_entries || (int)syme->snap_count < count_filter)
>  			continue;
>  
> @@ -609,7 +612,7 @@ static void print_mapped_keys(void)
>  
>  	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
>  
> -	if (vmlinux) {
> +	if (vmlinux_name) {
>  		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");
> @@ -638,7 +641,9 @@ static int key_mapped(int c)
>  		case 'F':
>  		case 's':
>  		case 'S':
> -			return vmlinux ? 1 : 0;
> +			return vmlinux_name ? 1 : 0;
> +		default:
> +			break;
>  	}
>  
>  	return 0;
> @@ -724,6 +729,8 @@ static void handle_keypress(int c)
>  		case 'z':
>  			zero = ~zero;
>  			break;
> +		default:
> +			break;
>  	}
>  }
>  
> @@ -812,13 +819,13 @@ static int parse_symbols(void)
>  {
>  	struct rb_node *node;
>  	struct symbol  *sym;
> -	int modules = vmlinux ? 1 : 0;
> +	int use_modules = vmlinux_name ? 1 : 0;
>  
>  	kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry));
>  	if (kernel_dso == NULL)
>  		return -1;
>  
> -	if (dso__load_kernel(kernel_dso, vmlinux, symbol_filter, verbose, modules) <= 0)
> +	if (dso__load_kernel(kernel_dso, vmlinux_name, symbol_filter, verbose, use_modules) <= 0)
>  		goto out_delete_dso;
>  
>  	node = rb_first(&kernel_dso->syms);
> @@ -1114,7 +1121,7 @@ static const struct option options[] = {
>  			    "system-wide collection from all CPUs"),
>  	OPT_INTEGER('C', "CPU", &profile_cpu,
>  		    "CPU to profile on"),
> -	OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
> +	OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
>  	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
>  		    "number of mmap data pages"),
>  	OPT_INTEGER('r', "realtime", &realtime_prio,
> diff --git a/tools/perf/util/abspath.c b/tools/perf/util/abspath.c
> index 61d33b8..a791dd4 100644
> --- a/tools/perf/util/abspath.c
> +++ b/tools/perf/util/abspath.c
> @@ -50,7 +50,8 @@ const char *make_absolute_path(const char *path)
>  			die ("Could not get current working directory");
>  
>  		if (last_elem) {
> -			int len = strlen(buf);
> +			len = strlen(buf);
> +
>  			if (len + strlen(last_elem) + 2 > PATH_MAX)
>  				die ("Too long path name: '%s/%s'",
>  						buf, last_elem);
> diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
> index 4b50c41..6f8ea9d 100644
> --- a/tools/perf/util/cache.h
> +++ b/tools/perf/util/cache.h
> @@ -52,7 +52,6 @@ extern const char *perf_mailmap_file;
>  extern void maybe_flush_or_die(FILE *, const char *);
>  extern int copy_fd(int ifd, int ofd);
>  extern int copy_file(const char *dst, const char *src, int mode);
> -extern ssize_t read_in_full(int fd, void *buf, size_t count);
>  extern ssize_t write_in_full(int fd, const void *buf, size_t count);
>  extern void write_or_die(int fd, const void *buf, size_t count);
>  extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 0114734..3b8380f 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -50,6 +50,7 @@ rb_insert_callchain(struct rb_root *root, struct callchain_node *chain,
>  			else
>  				p = &(*p)->rb_right;
>  			break;
> +		case CHAIN_NONE:
>  		default:
>  			break;
>  		}
> @@ -143,6 +144,7 @@ int register_callchain_param(struct callchain_param *param)
>  	case CHAIN_FLAT:
>  		param->sort = sort_chain_flat;
>  		break;
> +	case CHAIN_NONE:
>  	default:
>  		return -1;
>  	}
> diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
> index 90a044d..e47fdeb 100644
> --- a/tools/perf/util/color.c
> +++ b/tools/perf/util/color.c
> @@ -242,9 +242,9 @@ int color_fwrite_lines(FILE *fp, const char *color,
>  	return 0;
>  }
>  
> -char *get_percent_color(double percent)
> +const char *get_percent_color(double percent)
>  {
> -	char *color = PERF_COLOR_NORMAL;
> +	const char *color = PERF_COLOR_NORMAL;
>  
>  	/*
>  	 * We color high-overhead entries in red, mid-overhead
> @@ -263,7 +263,7 @@ char *get_percent_color(double percent)
>  int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
>  {
>  	int r;
> -	char *color;
> +	const char *color;
>  
>  	color = get_percent_color(percent);
>  	r = color_fprintf(fp, color, fmt, percent);
> diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
> index 706cec5..43d0d1b 100644
> --- a/tools/perf/util/color.h
> +++ b/tools/perf/util/color.h
> @@ -36,6 +36,6 @@ 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);
>  int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
> -char *get_percent_color(double percent);
> +const char *get_percent_color(double percent);
>  
>  #endif /* COLOR_H */
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 780df54..8784649 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -160,17 +160,18 @@ static int get_extended_base_var(char *name, int baselen, int c)
>  	name[baselen++] = '.';
>  
>  	for (;;) {
> -		int c = get_next_char();
> -		if (c == '\n')
> +		int ch = get_next_char();
> +
> +		if (ch == '\n')
>  			return -1;
> -		if (c == '"')
> +		if (ch == '"')
>  			break;
> -		if (c == '\\') {
> -			c = get_next_char();
> -			if (c == '\n')
> +		if (ch == '\\') {
> +			ch = get_next_char();
> +			if (ch == '\n')
>  				return -1;
>  		}
> -		name[baselen++] = c;
> +		name[baselen++] = ch;
>  		if (baselen > MAXNAME / 2)
>  			return -1;
>  	}
> @@ -530,6 +531,8 @@ static int store_aux(const char* key, const char* value, void *cb __used)
>  					store.offset[store.seen] = ftell(config_file);
>  			}
>  		}
> +	default:
> +		break;
>  	}
>  	return 0;
>  }
> @@ -619,6 +622,7 @@ contline:
>  		switch (contents[offset]) {
>  			case '=': equal_offset = offset; break;
>  			case ']': bracket_offset = offset; break;
> +			default: break;
>  		}
>  	if (offset > 0 && contents[offset-1] == '\\') {
>  		offset_ = offset;
> @@ -742,9 +746,9 @@ int perf_config_set_multivar(const char* key, const char* value,
>  			goto write_err_out;
>  	} else {
>  		struct stat st;
> -		char* contents;
> +		char *contents;
>  		ssize_t contents_sz, copy_begin, copy_end;
> -		int i, new_line = 0;
> +		int new_line = 0;
>  
>  		if (value_regex == NULL)
>  			store.value_regex = NULL;
> diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
> index 34a3528..2745605 100644
> --- a/tools/perf/util/exec_cmd.c
> +++ b/tools/perf/util/exec_cmd.c
> @@ -6,7 +6,6 @@
>  
>  #define MAX_ARGS	32
>  
> -extern char **environ;
>  static const char *argv_exec_path;
>  static const char *argv0_path;
>  
> diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c
> index ddabe92..3d567fe 100644
> --- a/tools/perf/util/module.c
> +++ b/tools/perf/util/module.c
> @@ -436,9 +436,9 @@ static int mod_dso__load_module_paths(struct mod_dso *self)
>  		goto out_failure;
>  
>  	while (!feof(file)) {
> -		char *path, *name, *tmp;
> +		char *name, *tmp;
>  		struct module *module;
> -		int line_len, len;
> +		int line_len;
>  
>  		line_len = getline(&line, &n, file);
>  		if (line_len < 0)
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 0441784..1cda97b 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -14,10 +14,10 @@ int					nr_counters;
>  struct perf_counter_attr		attrs[MAX_COUNTERS];
>  
>  struct event_symbol {
> -	u8	type;
> -	u64	config;
> -	char	*symbol;
> -	char	*alias;
> +	u8		type;
> +	u64		config;
> +	const char	*symbol;
> +	const char	*alias;
>  };
>  
>  char debugfs_path[MAXPATHLEN];
> @@ -51,7 +51,7 @@ static struct event_symbol event_symbols[] = {
>  #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[] = {
> +static const char *hw_event_names[] = {
>  	"cycles",
>  	"instructions",
>  	"cache-references",
> @@ -61,7 +61,7 @@ static char *hw_event_names[] = {
>  	"bus-cycles",
>  };
>  
> -static char *sw_event_names[] = {
> +static const char *sw_event_names[] = {
>  	"cpu-clock-msecs",
>  	"task-clock-msecs",
>  	"page-faults",
> @@ -73,7 +73,7 @@ static char *sw_event_names[] = {
>  
>  #define MAX_ALIASES 8
>  
> -static char *hw_cache[][MAX_ALIASES] = {
> +static const char *hw_cache[][MAX_ALIASES] = {
>   { "L1-dcache",	"l1-d",		"l1d",		"L1-data",		},
>   { "L1-icache",	"l1-i",		"l1i",		"L1-instruction",	},
>   { "LLC",	"L2"							},
> @@ -82,13 +82,13 @@ static char *hw_cache[][MAX_ALIASES] = {
>   { "branch",	"branches",	"bpu",		"btb",		"bpc",	},
>  };
>  
> -static char *hw_cache_op[][MAX_ALIASES] = {
> +static const char *hw_cache_op[][MAX_ALIASES] = {
>   { "load",	"loads",	"read",					},
>   { "store",	"stores",	"write",				},
>   { "prefetch",	"prefetches",	"speculative-read", "speculative-load",	},
>  };
>  
> -static char *hw_cache_result[][MAX_ALIASES] = {
> +static const char *hw_cache_result[][MAX_ALIASES] = {
>   { "refs",	"Reference",	"ops",		"access",		},
>   { "misses",	"miss",							},
>  };
> @@ -158,7 +158,7 @@ int valid_debugfs_mount(const char *debugfs)
>  	return 0;
>  }
>  
> -static char *tracepoint_id_to_name(u64 config)
> +static const char *tracepoint_id_to_name(u64 config)
>  {
>  	static char tracepoint_name[2 * MAX_EVENT_LENGTH];
>  	DIR *sys_dir, *evt_dir;
> @@ -235,7 +235,7 @@ static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
>  	return name;
>  }
>  
> -char *event_name(int counter)
> +const char *event_name(int counter)
>  {
>  	u64 config = attrs[counter].config;
>  	int type = attrs[counter].type;
> @@ -243,7 +243,7 @@ char *event_name(int counter)
>  	return __event_name(type, config);
>  }
>  
> -char *__event_name(int type, u64 config)
> +const char *__event_name(int type, u64 config)
>  {
>  	static char buf[32];
>  
> @@ -294,7 +294,7 @@ char *__event_name(int type, u64 config)
>  	return "unknown";
>  }
>  
> -static int parse_aliases(const char **str, char *names[][MAX_ALIASES], int size)
> +static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size)
>  {
>  	int i, j;
>  	int n, longest = -1;
> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
> index 192a962..9b1aeea 100644
> --- a/tools/perf/util/parse-events.h
> +++ b/tools/perf/util/parse-events.h
> @@ -9,8 +9,8 @@ extern int			nr_counters;
>  
>  extern struct perf_counter_attr attrs[MAX_COUNTERS];
>  
> -extern char *event_name(int ctr);
> -extern char *__event_name(int type, u64 config);
> +extern const char *event_name(int ctr);
> +extern const char *__event_name(int type, u64 config);
>  
>  extern int parse_events(const struct option *opt, const char *str, int unset);
>  
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index 1bf6719..6d8af48 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -53,6 +53,12 @@ static int get_value(struct parse_opt_ctx_t *p,
>  		case OPTION_SET_INT:
>  		case OPTION_SET_PTR:
>  			return opterror(opt, "takes no value", flags);
> +		case OPTION_END:
> +		case OPTION_ARGUMENT:
> +		case OPTION_GROUP:
> +		case OPTION_STRING:
> +		case OPTION_INTEGER:
> +		case OPTION_LONG:
>  		default:
>  			break;
>  		}
> @@ -130,6 +136,9 @@ static int get_value(struct parse_opt_ctx_t *p,
>  			return opterror(opt, "expects a numerical value", flags);
>  		return 0;
>  
> +	case OPTION_END:
> +	case OPTION_ARGUMENT:
> +	case OPTION_GROUP:
>  	default:
>  		die("should not happen, someone must be hit on the forehead");
>  	}
> @@ -296,6 +305,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  				return parse_options_usage(usagestr, options);
>  			case -2:
>  				goto unknown;
> +			default:
> +				break;
>  			}
>  			if (ctx->opt)
>  				check_typos(arg + 1, options);
> @@ -314,6 +325,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  					ctx->argv[0] = strdup(ctx->opt - 1);
>  					*(char *)ctx->argv[0] = '-';
>  					goto unknown;
> +				default:
> +					break;
>  				}
>  			}
>  			continue;
> @@ -336,6 +349,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  			return parse_options_usage(usagestr, options);
>  		case -2:
>  			goto unknown;
> +		default:
> +			break;
>  		}
>  		continue;
>  unknown:
> @@ -456,6 +471,13 @@ int usage_with_options_internal(const char * const *usagestr,
>  			}
>  			break;
>  		default: /* OPTION_{BIT,BOOLEAN,SET_INT,SET_PTR} */
> +		case OPTION_END:
> +		case OPTION_GROUP:
> +		case OPTION_BIT:
> +		case OPTION_BOOLEAN:
> +		case OPTION_SET_INT:
> +		case OPTION_SET_PTR:
> +		case OPTION_LONG:
>  			break;
>  		}
>  
> diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c
> index a501a40..fd1f2fa 100644
> --- a/tools/perf/util/path.c
> +++ b/tools/perf/util/path.c
> @@ -17,7 +17,7 @@ static char bad_path[] = "/bad-path/";
>   * Two hacks:
>   */
>  
> -static char *get_perf_dir(void)
> +static const char *get_perf_dir(void)
>  {
>  	return ".";
>  }
> @@ -38,8 +38,9 @@ size_t strlcpy(char *dest, const char *src, size_t size)
>  static char *get_pathname(void)
>  {
>  	static char pathname_array[4][PATH_MAX];
> -	static int index;
> -	return pathname_array[3 & ++index];
> +	static int idx;
> +
> +	return pathname_array[3 & ++idx];
>  }
>  
>  static char *cleanup_path(char *path)
> @@ -161,20 +162,24 @@ int perf_mkstemp(char *path, size_t len, const char *template)
>  }
>  
>  
> -const char *make_relative_path(const char *abs, const char *base)
> +const char *make_relative_path(const char *abs_path, const char *base)
>  {
>  	static char buf[PATH_MAX + 1];
>  	int baselen;
> +
>  	if (!base)
> -		return abs;
> +		return abs_path;
> +
>  	baselen = strlen(base);
> -	if (prefixcmp(abs, base))
> -		return abs;
> -	if (abs[baselen] == '/')
> +	if (prefixcmp(abs_path, base))
> +		return abs_path;
> +	if (abs_path[baselen] == '/')
>  		baselen++;
>  	else if (base[baselen - 1] != '/')
> -		return abs;
> -	strcpy(buf, abs + baselen);
> +		return abs_path;
> +
> +	strcpy(buf, abs_path + baselen);
> +
>  	return buf;
>  }
>  
> diff --git a/tools/perf/util/run-command.c b/tools/perf/util/run-command.c
> index a393534..2b615ac 100644
> --- a/tools/perf/util/run-command.c
> +++ b/tools/perf/util/run-command.c
> @@ -262,7 +262,7 @@ int run_hook(const char *index_file, const char *name, ...)
>  {
>  	struct child_process hook;
>  	const char **argv = NULL, *env[2];
> -	char index[PATH_MAX];
> +	char idx[PATH_MAX];
>  	va_list args;
>  	int ret;
>  	size_t i = 0, alloc = 0;
> @@ -284,8 +284,8 @@ int run_hook(const char *index_file, const char *name, ...)
>  	hook.no_stdin = 1;
>  	hook.stdout_to_stderr = 1;
>  	if (index_file) {
> -		snprintf(index, sizeof(index), "PERF_INDEX_FILE=%s", index_file);
> -		env[0] = index;
> +		snprintf(idx, sizeof(idx), "PERF_INDEX_FILE=%s", index_file);
> +		env[0] = idx;
>  		env[1] = NULL;
>  		hook.env = env;
>  	}
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 0b98623..3159d47 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -21,7 +21,7 @@ enum dso_origin {
>  
>  static struct symbol *symbol__new(u64 start, u64 len,
>  				  const char *name, unsigned int priv_size,
> -				  u64 obj_start, int verbose)
> +				  u64 obj_start, int v)
>  {
>  	size_t namelen = strlen(name) + 1;
>  	struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
> @@ -29,7 +29,7 @@ static struct symbol *symbol__new(u64 start, u64 len,
>  	if (!self)
>  		return NULL;
>  
> -	if (verbose >= 2)
> +	if (v >= 2)
>  		printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
>  			(u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
>  
> @@ -156,7 +156,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp)
>  	return ret;
>  }
>  
> -static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
> +static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	struct rb_node *nd, *prevnd;
>  	char *line = NULL;
> @@ -198,7 +198,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, 0, verbose);
> +				  self->sym_priv_size, 0, v);
>  
>  		if (sym == NULL)
>  			goto out_delete_line;
> @@ -239,7 +239,7 @@ out_failure:
>  	return -1;
>  }
>  
> -static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verbose)
> +static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	char *line = NULL;
>  	size_t n;
> @@ -277,7 +277,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb
>  			continue;
>  
>  		sym = symbol__new(start, size, line + len,
> -				  self->sym_priv_size, start, verbose);
> +				  self->sym_priv_size, start, v);
>  
>  		if (sym == NULL)
>  			goto out_delete_line;
> @@ -305,13 +305,13 @@ out_failure:
>   * elf_symtab__for_each_symbol - iterate thru all the symbols
>   *
>   * @self: struct elf_symtab instance to iterate
> - * @index: uint32_t index
> + * @idx: uint32_t idx
>   * @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))
> +#define elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) \
> +	for (idx = 0, gelf_getsym(syms, idx, &sym);\
> +	     idx < nr_syms; \
> +	     idx++, gelf_getsym(syms, idx, &sym))
>  
>  static inline uint8_t elf_sym__type(const GElf_Sym *sym)
>  {
> @@ -354,7 +354,7 @@ static inline const char *elf_sym__name(const GElf_Sym *sym,
>  
>  static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>  				    GElf_Shdr *shp, const char *name,
> -				    size_t *index)
> +				    size_t *idx)
>  {
>  	Elf_Scn *sec = NULL;
>  	size_t cnt = 1;
> @@ -365,8 +365,8 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>  		gelf_getshdr(sec, shp);
>  		str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
>  		if (!strcmp(name, str)) {
> -			if (index)
> -				*index = cnt;
> +			if (idx)
> +				*idx = cnt;
>  			break;
>  		}
>  		++cnt;
> @@ -392,7 +392,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>   * And always look at the original dso, not at debuginfo packages, that
>   * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
>   */
> -static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
> +static int dso__synthesize_plt_symbols(struct  dso *self, int v)
>  {
>  	uint32_t nr_rel_entries, idx;
>  	GElf_Sym sym;
> @@ -442,7 +442,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  		goto out_elf_end;
>  
>  	/*
> -	 * Fetch the relocation section to find the indexes to the GOT
> +	 * Fetch the relocation section to find the idxes to the GOT
>  	 * and the symbols in the .dynsym they refer to.
>  	 */
>  	reldata = elf_getdata(scn_plt_rel, NULL);
> @@ -476,7 +476,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size, 0, verbose);
> +					sympltname, self->sym_priv_size, 0, v);
>  			if (!f)
>  				goto out_elf_end;
>  
> @@ -494,7 +494,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, int verbose)
>  				 "%s@plt", elf_sym__name(&sym, symstrs));
>  
>  			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
> -					sympltname, self->sym_priv_size, 0, verbose);
> +					sympltname, self->sym_priv_size, 0, v);
>  			if (!f)
>  				goto out_elf_end;
>  
> @@ -518,12 +518,12 @@ out:
>  }
>  
>  static int dso__load_sym(struct dso *self, int fd, const char *name,
> -			 symbol_filter_t filter, int verbose, struct module *mod)
> +			 symbol_filter_t filter, int v, struct module *mod)
>  {
>  	Elf_Data *symstrs, *secstrs;
>  	uint32_t nr_syms;
>  	int err = -1;
> -	uint32_t index;
> +	uint32_t idx;
>  	GElf_Ehdr ehdr;
>  	GElf_Shdr shdr;
>  	Elf_Data *syms;
> @@ -534,14 +534,14 @@ 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) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot read %s ELF file.\n",
>  				__func__, name);
>  		goto out_close;
>  	}
>  
>  	if (gelf_getehdr(elf, &ehdr) == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
>  		goto out_elf_end;
>  	}
> @@ -583,9 +583,9 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  						     NULL) != NULL);
>  	} else self->adjust_symbols = 0;
>  
> -	elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
> +	elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
>  		struct symbol *f;
> -		const char *name;
> +		const char *elf_name;
>  		char *demangled;
>  		u64 obj_start;
>  		struct section *section = NULL;
> @@ -608,7 +608,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  		obj_start = sym.st_value;
>  
>  		if (self->adjust_symbols) {
> -			if (verbose >= 2)
> +			if (v >= 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);
>  
> @@ -630,13 +630,13 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
>  		 * DWARF DW_compile_unit has this, but we don't always have access
>  		 * to it...
>  		 */
> -		name = elf_sym__name(&sym, symstrs);
> -		demangled = bfd_demangle(NULL, name, DMGL_PARAMS | DMGL_ANSI);
> +		elf_name = elf_sym__name(&sym, symstrs);
> +		demangled = bfd_demangle(NULL, elf_name, DMGL_PARAMS | DMGL_ANSI);
>  		if (demangled != NULL)
> -			name = demangled;
> +			elf_name = demangled;
>  
> -		f = symbol__new(sym.st_value, sym.st_size, name,
> -				self->sym_priv_size, obj_start, verbose);
> +		f = symbol__new(sym.st_value, sym.st_size, elf_name,
> +				self->sym_priv_size, obj_start, v);
>  		free(demangled);
>  		if (!f)
>  			goto out_elf_end;
> @@ -659,7 +659,7 @@ out_close:
>  
>  #define BUILD_ID_SIZE 128
>  
> -static char *dso__read_build_id(struct dso *self, int verbose)
> +static char *dso__read_build_id(struct dso *self, int v)
>  {
>  	int i;
>  	GElf_Ehdr ehdr;
> @@ -676,14 +676,14 @@ static char *dso__read_build_id(struct dso *self, int verbose)
>  
>  	elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
>  	if (elf == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot read %s ELF file.\n",
>  				__func__, self->name);
>  		goto out_close;
>  	}
>  
>  	if (gelf_getehdr(elf, &ehdr) == NULL) {
> -		if (verbose)
> +		if (v)
>  			fprintf(stderr, "%s: cannot get elf header.\n", __func__);
>  		goto out_elf_end;
>  	}
> @@ -706,7 +706,7 @@ static char *dso__read_build_id(struct dso *self, int verbose)
>  		++raw;
>  		bid += 2;
>  	}
> -	if (verbose >= 2)
> +	if (v >= 2)
>  		printf("%s(%s): %s\n", __func__, self->name, build_id);
>  out_elf_end:
>  	elf_end(elf);
> @@ -732,7 +732,7 @@ char dso__symtab_origin(const struct dso *self)
>  	return origin[self->origin];
>  }
>  
> -int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
> +int dso__load(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	int size = PATH_MAX;
>  	char *name = malloc(size), *build_id = NULL;
> @@ -745,7 +745,7 @@ int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
>  	self->adjust_symbols = 0;
>  
>  	if (strncmp(self->name, "/tmp/perf-", 10) == 0) {
> -		ret = dso__load_perf_map(self, filter, verbose);
> +		ret = dso__load_perf_map(self, filter, v);
>  		self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT :
>  					 DSO__ORIG_NOT_FOUND;
>  		return ret;
> @@ -764,7 +764,7 @@ more:
>  			snprintf(name, size, "/usr/lib/debug%s", self->name);
>  			break;
>  		case DSO__ORIG_BUILDID:
> -			build_id = dso__read_build_id(self, verbose);
> +			build_id = dso__read_build_id(self, v);
>  			if (build_id != NULL) {
>  				snprintf(name, size,
>  					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
> @@ -785,7 +785,7 @@ more:
>  		fd = open(name, O_RDONLY);
>  	} while (fd < 0);
>  
> -	ret = dso__load_sym(self, fd, name, filter, verbose, NULL);
> +	ret = dso__load_sym(self, fd, name, filter, v, NULL);
>  	close(fd);
>  
>  	/*
> @@ -795,7 +795,7 @@ more:
>  		goto more;
>  
>  	if (ret > 0) {
> -		int nr_plt = dso__synthesize_plt_symbols(self, verbose);
> +		int nr_plt = dso__synthesize_plt_symbols(self, v);
>  		if (nr_plt > 0)
>  			ret += nr_plt;
>  	}
> @@ -807,7 +807,7 @@ out:
>  }
>  
>  static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *name,
> -			     symbol_filter_t filter, int verbose)
> +			     symbol_filter_t filter, int v)
>  {
>  	struct module *mod = mod_dso__find_module(mods, name);
>  	int err = 0, fd;
> @@ -820,13 +820,13 @@ static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *
>  	if (fd < 0)
>  		return err;
>  
> -	err = dso__load_sym(self, fd, name, filter, verbose, mod);
> +	err = dso__load_sym(self, fd, name, filter, v, mod);
>  	close(fd);
>  
>  	return err;
>  }
>  
> -int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
> +int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
>  {
>  	struct mod_dso *mods = mod_dso__new_dso("modules");
>  	struct module *pos;
> @@ -844,7 +844,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose)
>  	next = rb_first(&mods->mods);
>  	while (next) {
>  		pos = rb_entry(next, struct module, rb_node);
> -		err = dso__load_module(self, mods, pos->name, filter, verbose);
> +		err = dso__load_module(self, mods, pos->name, filter, v);
>  
>  		if (err < 0)
>  			break;
> @@ -887,14 +887,14 @@ static inline void dso__fill_symbol_holes(struct dso *self)
>  }
>  
>  static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
> -			     symbol_filter_t filter, int verbose)
> +			     symbol_filter_t filter, int v)
>  {
>  	int err, fd = open(vmlinux, O_RDONLY);
>  
>  	if (fd < 0)
>  		return -1;
>  
> -	err = dso__load_sym(self, fd, vmlinux, filter, verbose, NULL);
> +	err = dso__load_sym(self, fd, vmlinux, filter, v, NULL);
>  
>  	if (err > 0)
>  		dso__fill_symbol_holes(self);
> @@ -905,18 +905,18 @@ static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
>  }
>  
>  int dso__load_kernel(struct dso *self, const char *vmlinux,
> -		     symbol_filter_t filter, int verbose, int modules)
> +		     symbol_filter_t filter, int v, int use_modules)
>  {
>  	int err = -1;
>  
>  	if (vmlinux) {
> -		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
> -		if (err > 0 && modules)
> -			err = dso__load_modules(self, filter, verbose);
> +		err = dso__load_vmlinux(self, vmlinux, filter, v);
> +		if (err > 0 && use_modules)
> +			err = dso__load_modules(self, filter, v);
>  	}
>  
>  	if (err <= 0)
> -		err = dso__load_kallsyms(self, filter, verbose);
> +		err = dso__load_kallsyms(self, filter, v);
>  
>  	if (err > 0)
>  		self->origin = DSO__ORIG_KERNEL;
> @@ -929,7 +929,7 @@ struct dso	*kernel_dso;
>  struct dso	*vdso;
>  struct dso	*hypervisor_dso;
>  
> -char		*vmlinux = "vmlinux";
> +const char	*vmlinux_name = "vmlinux";
>  int		modules;
>  
>  static void dsos__add(struct dso *dso)
> @@ -997,7 +997,7 @@ int load_kernel(void)
>  	if (!kernel_dso)
>  		return -1;
>  
> -	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules);
> +	err = dso__load_kernel(kernel_dso, vmlinux_name, NULL, verbose, modules);
>  	if (err <= 0) {
>  		dso__delete(kernel_dso);
>  		kernel_dso = NULL;
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 48b8e57..6e84907 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -55,7 +55,7 @@ struct dso {
>  	char		 name[0];
>  };
>  
> -const char *sym_hist_filter;
> +extern const char *sym_hist_filter;
>  
>  typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
>  
> @@ -87,6 +87,6 @@ extern struct list_head dsos;
>  extern struct dso *kernel_dso;
>  extern struct dso *vdso;
>  extern struct dso *hypervisor_dso;
> -extern char *vmlinux;
> +extern const char *vmlinux_name;
>  extern int   modules;
>  #endif /* _PERF_SYMBOL_ */
> diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
> index 614cfaf..1c15e39 100644
> --- a/tools/perf/util/values.c
> +++ b/tools/perf/util/values.c
> @@ -96,7 +96,7 @@ static void perf_read_values__enlarge_counters(struct perf_read_values *values)
>  }
>  
>  static int perf_read_values__findnew_counter(struct perf_read_values *values,
> -					     u64 rawid, char *name)
> +					     u64 rawid, const char *name)
>  {
>  	int i;
>  
> @@ -116,7 +116,7 @@ static int perf_read_values__findnew_counter(struct perf_read_values *values,
>  
>  void perf_read_values_add_value(struct perf_read_values *values,
>  				u32 pid, u32 tid,
> -				u64 rawid, char *name, u64 value)
> +				u64 rawid, const char *name, u64 value)
>  {
>  	int tindex, cindex;
>  
> @@ -221,8 +221,7 @@ static void perf_read_values__display_raw(FILE *fp,
>  				countwidth, values->value[i][j]);
>  }
>  
> -void perf_read_values_display(FILE *fp, struct perf_read_values *values,
> -			      int raw)
> +void perf_read_values_display(FILE *fp, struct perf_read_values *values, int raw)
>  {
>  	if (raw)
>  		perf_read_values__display_raw(fp, values);
> diff --git a/tools/perf/util/values.h b/tools/perf/util/values.h
> index f8960fd..cadf8cf 100644
> --- a/tools/perf/util/values.h
> +++ b/tools/perf/util/values.h
> @@ -19,7 +19,7 @@ void perf_read_values_destroy(struct perf_read_values *values);
>  
>  void perf_read_values_add_value(struct perf_read_values *values,
>  				u32 pid, u32 tid,
> -				u64 rawid, char *name, u64 value);
> +				u64 rawid, const char *name, u64 value);
>  
>  void perf_read_values_display(FILE *fp, struct perf_read_values *values,
>  			      int raw);


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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16 14:15                 ` [tip:perfcounters/core] perf: Enable more compiler warnings Frederic Weisbecker
@ 2009-08-16 15:18                   ` Ingo Molnar
  2009-08-16 15:52                     ` [PATCH] perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-16 15:18 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> > 
> > perf: Enable more compiler warnings
> > 
> > Related to a shadowed variable bug fix Valdis Kletnieks noticed
> > that perf does not get built with -Wshadow, which could have
> > helped us avoid the bug.
> > 
> > So enable -Wshadow and also enable the following warnings on
> > perf builds, in addition to the already enabled -Wall -Wextra
> > -std=gnu99 warnings:
> > 
> >  -Wcast-align
> >  -Wformat=2
> 
> 
> I also have code like the following from perf trace:
> 
> char format[32];
> [...]
> 
> memcpy(format, dynamic_built_format, ...)
> 
> printf(format, ....)
> 
> And that triggers warnings like that:
> 
> util/trace-event-parse.c:2280: error: format is not a literal string, argument types can't be checked
> 
> Do we also want these?
> 
> ftrace uses dynamic format definition, and it's a natural way to 
> copy them from debugfs and then used like that.
> 
> Especially here perf trace checked the format against bad things.

ok, lets turn the format warnings off.

	Ingo

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

* Re: [tip:perfcounters/core] perf: Enable more compiler warnings
  2009-08-16 14:06                     ` Frederic Weisbecker
@ 2009-08-16 15:22                       ` Ingo Molnar
  0 siblings, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-16 15:22 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	tglx, linux-tip-commits


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Sun, Aug 16, 2009 at 04:01:54PM +0200, Ingo Molnar wrote:
> > 
> > * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > 
> > > On Sun, Aug 16, 2009 at 08:57:54AM +0000, tip-bot for Ingo Molnar wrote:
> > > > Commit-ID:  83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > > > Gitweb:     http://git.kernel.org/tip/83a0944fa919fb2ebcfc1f8933d86e437b597ca6
> > > > Author:     Ingo Molnar <mingo@elte.hu>
> > > > AuthorDate: Sat, 15 Aug 2009 12:26:57 +0200
> > > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > > CommitDate: Sun, 16 Aug 2009 10:47:47 +0200
> > > > 
> > > > perf: Enable more compiler warnings
> > > > 
> > > > Related to a shadowed variable bug fix Valdis Kletnieks noticed
> > > > that perf does not get built with -Wshadow, which could have
> > > > helped us avoid the bug.
> > > > 
> > > > So enable -Wshadow and also enable the following warnings on
> > > > perf builds, in addition to the already enabled -Wall -Wextra
> > > > -std=gnu99 warnings:
> > > > 
> > > >  -Wcast-align
> > > >  -Wformat=2
> > > >  -Wshadow
> > > >  -Winit-self
> > > >  -Wpacked
> > > >  -Wredundant-decls
> > > >  -Wstack-protector
> > > >  -Wstrict-aliasing=3
> > > >  -Wswitch-default
> > > >  -Wswitch-enum
> > > 
> > > 
> > > 
> > > This one looks like more a pain than something useful.
> > > 
> > > I have this code in perf trace:
> > > 
> > > static int event_item_type(enum event_type type)
> > > {
> > > 	switch (type) {
> > > 	case EVENT_ITEM:
> > > 	case EVENT_DQUOTE:
> > > 	case EVENT_SQUOTE:
> > > 		return 1;
> > > 	default:
> > > 		return 0;
> > > 	}
> > > }
> > > 
> > > Which results in:
> > > 
> > > util/trace-event-parse.c: In function ‘event_item_type’:
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_ERROR’ not handled in switch
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NONE’ not handled in switch
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_SPACE’ not handled in switch
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_NEWLINE’ not handled in switch
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_OP’ not handled in switch
> > > util/trace-event-parse.c:377: erreur: enumeration value ‘EVENT_DELIM’ not handled in switch
> > > 
> > > The default case already handles these and I guess we don't want workarounds like:
> > > 
> > > static int event_item_type(enum event_type type)
> > > {
> > >         switch (type) {
> > >         case EVENT_ITEM:
> > >         case EVENT_DQUOTE:
> > >         case EVENT_SQUOTE:
> > >                 return 1;
> > > 	case EVENT_ERROR:
> > > 	case EVENT_NONE:
> > > 	case EVENT_SPACE:
> > > 	case EVENT_NEWLINE:
> > > 	case EVENT_OP:
> > > 	case EVENT_DELIM:
> > >         default:
> > >                 return 0;
> > >         }
> > > }
> > > 
> > > 
> > > Right? :-)
> > > 
> > > This warning might be useful for *very* specific cases, but not here IMO.
> > 
> > i think it's useful when an enum gets extended. Say we add a new 
> > event enum and want to make sure it's handled in _all_ switch 
> > statements that deals with them. This warning ensures that we 
> > propagate the new case to all usage sites.
> > 
> > 	Ingo
> 
> 
> Ok, it's a bit annoying to cover all enum cases but well, I agree 
> with the above possibility...

Note, there's a GCC extension for a range of enums:

                case OPTION_BIT ... OPTION_SET_PTR:

so in case the enums are in a continuous range, it's just a single 
line to list them.

	Ingo

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

* [PATCH] perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags
  2009-08-16 15:18                   ` Ingo Molnar
@ 2009-08-16 15:52                     ` Frederic Weisbecker
  2009-08-16 16:00                       ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-08-16 15:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mike Galbraith

The soon coming perf trace needs to use printf with dynamically built
formats.

But we are using -Wformat=2 which is a shortcut for the following set:
-Wformat -Wformat-security -Wformat-y2k -Wformat-nonliteral

-Wformat-nonliteral warns when it can't check formats because they are
not builtin constant strings, but we want to feature dynamic formats.
What we want instead is Wformat=2 minus -Wformat-nonliteral, which is
what this patch does.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
---
 tools/perf/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d637aea..5d54ddb 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,7 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+EXTRA_WARNINGS = -Wcast-align -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
 
 CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm
-- 
1.6.2.3


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

* [tip:perfcounters/core] perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags
  2009-08-16 15:52                     ` [PATCH] perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags Frederic Weisbecker
@ 2009-08-16 16:00                       ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2009-08-16 16:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, efault, peterz, fweisbec, tglx, mingo

Commit-ID:  0d31b82dd5c54a0b1e1d789427abdcc180bc4602
Gitweb:     http://git.kernel.org/tip/0d31b82dd5c54a0b1e1d789427abdcc180bc4602
Author:     Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Sun, 16 Aug 2009 17:52:07 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 16 Aug 2009 17:56:09 +0200

perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags

The soon coming perf trace needs to use printf with dynamically
built formats.

But we are using -Wformat=2 which is a shortcut for the
following set: -Wformat -Wformat-security -Wformat-y2k
-Wformat-nonliteral

-Wformat-nonliteral warns when it can't check formats because
they are not builtin constant strings, but we want to feature
dynamic formats. What we want instead is Wformat=2 minus
-Wformat-nonliteral, which is what this patch does.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250437927-25490-1-git-send-email-fweisbec@gmail.com>
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 d637aea..5d54ddb 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,7 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS = -Wcast-align -Wformat=2 -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+EXTRA_WARNINGS = -Wcast-align -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
 
 CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm

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

* [tip:perfcounters/urgent] perf: Rename perf-examples.txt to examples.txt
       [not found]             ` <new-submission>
                                 ` (302 preceding siblings ...)
  2009-08-16  9:18               ` [tip:perfcounters/core] perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2 tip-bot for Ingo Molnar
@ 2009-08-17  8:46               ` tip-bot for Carlos R. Mafra
  2009-08-18  9:15               ` [tip:perfcounters/core] perf tools: Remove obsolete defines tip-bot for Ingo Molnar
                                 ` (402 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Carlos R. Mafra @ 2009-08-17  8:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, crmafra, a.p.zijlstra, tglx, mingo

Commit-ID:  2932cffc89e9a1476b28a59896fa4f81e0d4f131
Gitweb:     http://git.kernel.org/tip/2932cffc89e9a1476b28a59896fa4f81e0d4f131
Author:     Carlos R. Mafra <crmafra@gmail.com>
AuthorDate: Mon, 17 Aug 2009 00:36:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 17 Aug 2009 10:43:42 +0200

perf: Rename perf-examples.txt to examples.txt

Rename it to examples.txt to avoid the perf-*.txt pattern in
the Makefile, otherwise 'make doc' fails because
perf-examples.txt is not formatted to be a man page:

 ERROR: perf-examples.txt: line 1: manpage document title is mandatory

Signed-off-by: Carlos R. Mafra <crmafra@gmail.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>


---
 .../{perf-examples.txt => examples.txt}            |    0
 1 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt
similarity index 100%
rename from tools/perf/Documentation/perf-examples.txt
rename to tools/perf/Documentation/examples.txt

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

* [tip:perfcounters/core] perf tools: Remove obsolete defines
       [not found]             ` <new-submission>
                                 ` (303 preceding siblings ...)
  2009-08-17  8:46               ` [tip:perfcounters/urgent] perf: Rename perf-examples.txt to examples.txt tip-bot for Carlos R. Mafra
@ 2009-08-18  9:15               ` tip-bot for Ingo Molnar
  2009-08-18  9:39               ` [tip:perfcounters/urgent] perf_counter: Fix the PARISC build tip-bot for Ingo Molnar
                                 ` (401 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-18  9:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  1f18345bdfd489fde1085bc85839d5d3645cf511
Gitweb:     http://git.kernel.org/tip/1f18345bdfd489fde1085bc85839d5d3645cf511
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 18 Aug 2009 10:59:47 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 Aug 2009 11:00:05 +0200

perf tools: Remove obsolete defines

The _XOPEN_SOURCE* defines are not really needed on Linux and
it's not like we'll port this to AIX ;-)

The define also broke the build with gcc 4.4.1:

 CC util/trace-event-parse.o
 In file included from util/trace-event-parse.c:32:
 util/util.h:43:1: error: "_XOPEN_SOURCE" redefined

So remove them.

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/util/util.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index d61a6f0..15004d2 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -39,10 +39,6 @@
 /* Approximation of the length of the decimal representation of this type. */
 #define decimal_length(x)	((int)(sizeof(x) * 2.56 + 0.5) + 1)
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
-#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
-#endif
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1

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

* [tip:perfcounters/urgent] perf_counter: Fix the PARISC build
       [not found]             ` <new-submission>
                                 ` (304 preceding siblings ...)
  2009-08-18  9:15               ` [tip:perfcounters/core] perf tools: Remove obsolete defines tip-bot for Ingo Molnar
@ 2009-08-18  9:39               ` tip-bot for Ingo Molnar
  2009-08-18 12:06               ` [tip:perfcounters/urgent] perf annotate: Fix segmentation fault tip-bot for Ingo Molnar
                                 ` (400 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-18  9:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	kyle, fweisbec, tglx, deller, mingo

Commit-ID:  f738eb1b63edf664da1b4ac76895d988749b2f07
Gitweb:     http://git.kernel.org/tip/f738eb1b63edf664da1b4ac76895d988749b2f07
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 18 Aug 2009 11:32:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 Aug 2009 11:34:13 +0200

perf_counter: Fix the PARISC build

PARISC does not build:

/home/mingo/tip/kernel/perf_counter.c: In function 'perf_counter_index':
/home/mingo/tip/kernel/perf_counter.c:2016: error: 'PERF_COUNTER_INDEX_OFFSET' undeclared (first use in this function)
/home/mingo/tip/kernel/perf_counter.c:2016: error: (Each undeclared identifier is reported only once
/home/mingo/tip/kernel/perf_counter.c:2016: error: for each function it appears in.)

As PERF_COUNTER_INDEX_OFFSET is not defined.

Now, we could define it in the architecture - but lets also provide
a core default of 0 (which happens to be what all but one
architecture uses at the moment).

Architectures that need a different index offset should set this
value in their asm/perf_counter.h files.

Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.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>
Cc: Frederic Weisbecker <fweisbec@gmail.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 b8fe739..36f65e2 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2019,6 +2019,10 @@ int perf_counter_task_disable(void)
 	return 0;
 }
 
+#ifndef PERF_COUNTER_INDEX_OFFSET
+# define PERF_COUNTER_INDEX_OFFSET 0
+#endif
+
 static int perf_counter_index(struct perf_counter *counter)
 {
 	if (counter->state != PERF_COUNTER_STATE_ACTIVE)

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

* [tip:perfcounters/urgent] perf annotate: Fix segmentation fault
       [not found]             ` <new-submission>
                                 ` (305 preceding siblings ...)
  2009-08-18  9:39               ` [tip:perfcounters/urgent] perf_counter: Fix the PARISC build tip-bot for Ingo Molnar
@ 2009-08-18 12:06               ` tip-bot for Ingo Molnar
  2009-08-21 11:07               ` [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall() tip-bot for Ingo Molnar
                                 ` (399 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-18 12:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, torvalds,
	efault, fweisbec, tglx, mingo

Commit-ID:  15f3fa4e7f608c5ce19187b3b4a953222fdfa751
Gitweb:     http://git.kernel.org/tip/15f3fa4e7f608c5ce19187b3b4a953222fdfa751
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 18 Aug 2009 13:52:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 Aug 2009 14:00:52 +0200

perf annotate: Fix segmentation fault

Linus reported this perf annotate segfault:

        [torvalds@nehalem git]$ perf annotate unmap_vmas
        Segmentation fault

       	#0  map__clone (self=<value optimized out>) at builtin-annotate.c:236
       	#1  thread__fork (self=<value optimized out>) at builtin-annotate.c:372

The bug here was that builtin-annotate.c was a copy of
builtin-report.c and a threading related fix to builtin-report.c
didnt get propagated to builtin-annotate.c ...

Reported-by: Linus Torvalds <torvalds@linux-foundation.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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 1dba568..343e7b1 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -980,6 +980,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
 		(void *)(long)(event->header.size),
 		event->fork.pid, event->fork.ppid);
 
+	/*
+	 * A thread clone will have the same PID for both
+	 * parent and child.
+	 */
+	if (thread == parent)
+		return 0;
+
 	if (!thread || !parent || thread__fork(thread, parent)) {
 		dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
 		return -1;

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

* [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
       [not found]             ` <new-submission>
                                 ` (306 preceding siblings ...)
  2009-08-18 12:06               ` [tip:perfcounters/urgent] perf annotate: Fix segmentation fault tip-bot for Ingo Molnar
@ 2009-08-21 11:07               ` tip-bot for Ingo Molnar
  2009-08-21 11:14                 ` Ingo Molnar
  2009-08-21 16:05                 ` Linus Torvalds
  2009-08-21 19:18               ` [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown tip-bot for Thomas Gleixner
                                 ` (398 subsequent siblings)
  706 siblings, 2 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-21 11:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, catalin.marinas,
	a.p.zijlstra, jens.axboe, fweisbec, stable, srostedt, tglx,
	mingo

Commit-ID:  4a683bf94b8a10e2bb0da07aec3ac0a55e5de61f
Gitweb:     http://git.kernel.org/tip/4a683bf94b8a10e2bb0da07aec3ac0a55e5de61f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 21 Aug 2009 12:53:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 21 Aug 2009 13:03:22 +0200

tracing: Fix too large stack usage in do_one_initcall()

One of my testboxes triggered this nasty stack overflow crash
during SCSI probing:

[    5.874004] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    5.875004] device: 'sda': device_add
[    5.878004] BUG: unable to handle kernel NULL pointer dereference at 00000a0c
[    5.878004] IP: [<b1008321>] print_context_stack+0x81/0x110
[    5.878004] *pde = 00000000
[    5.878004] Thread overran stack, or stack corrupted
[    5.878004] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[    5.878004] last sysfs file:
[    5.878004]
[    5.878004] Pid: 1, comm: swapper Not tainted (2.6.31-rc6-tip-01272-g9919e28-dirty #5685)
[    5.878004] EIP: 0060:[<b1008321>] EFLAGS: 00010083 CPU: 0
[    5.878004] EIP is at print_context_stack+0x81/0x110
[    5.878004] EAX: cf8a3000 EBX: cf8a3fe4 ECX: 00000049 EDX: 00000000
[    5.878004] ESI: b1cfce84 EDI: 00000000 EBP: cf8a3018 ESP: cf8a2ff4
[    5.878004]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[    5.878004] Process swapper (pid: 1, ti=cf8a2000 task=cf8a8000 task.ti=cf8a3000)
[    5.878004] Stack:
[    5.878004]  b1004867 fffff000 cf8a3ffc
[    5.878004] Call Trace:
[    5.878004]  [<b1004867>] ? kernel_thread_helper+0x7/0x10
[    5.878004] BUG: unable to handle kernel NULL pointer dereference at 00000a0c
[    5.878004] IP: [<b1008321>] print_context_stack+0x81/0x110
[    5.878004] *pde = 00000000
[    5.878004] Thread overran stack, or stack corrupted
[    5.878004] Oops: 0000 [#2] PREEMPT SMP DEBUG_PAGEALLOC

The oops did not reveal any more details about the real stack
that we have and the system got into an infinite loop of
recursive pagefaults.

So i booted with CONFIG_STACK_TRACER=y and the 'stacktrace' boot
parameter. The box did not crash (timings/conditions probably
changed a tiny bit to trigger the catastrophic crash), but the
/debug/tracing/stack_trace file was rather revealing:

        Depth    Size   Location    (72 entries)
        -----    ----   --------
  0)     3704      52   __change_page_attr+0xb8/0x290
  1)     3652      24   __change_page_attr_set_clr+0x43/0x90
  2)     3628      60   kernel_map_pages+0x108/0x120
  3)     3568      40   prep_new_page+0x7d/0x130
  4)     3528      84   get_page_from_freelist+0x106/0x420
  5)     3444     116   __alloc_pages_nodemask+0xd7/0x550
  6)     3328      36   allocate_slab+0xb1/0x100
  7)     3292      36   new_slab+0x1c/0x160
  8)     3256      36   __slab_alloc+0x133/0x2b0
  9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
 10)     3216     108   create_object+0x28/0x250
 11)     3108      40   kmemleak_alloc+0x81/0xc0
 12)     3068      24   kmem_cache_alloc+0x162/0x1d0
 13)     3044      52   scsi_pool_alloc_command+0x29/0x70
 14)     2992      20   scsi_host_alloc_command+0x22/0x70
 15)     2972      24   __scsi_get_command+0x1b/0x90
 16)     2948      28   scsi_get_command+0x35/0x90
 17)     2920      24   scsi_setup_blk_pc_cmnd+0xd4/0x100
 18)     2896     128   sd_prep_fn+0x332/0xa70
 19)     2768      36   blk_peek_request+0xe7/0x1d0
 20)     2732      56   scsi_request_fn+0x54/0x520
 21)     2676      12   __generic_unplug_device+0x2b/0x40
 22)     2664      24   blk_execute_rq_nowait+0x59/0x80
 23)     2640     172   blk_execute_rq+0x6b/0xb0
 24)     2468      32   scsi_execute+0xe0/0x140
 25)     2436      64   scsi_execute_req+0x152/0x160
 26)     2372      60   scsi_vpd_inquiry+0x6c/0x90
 27)     2312      44   scsi_get_vpd_page+0x112/0x160
 28)     2268      52   sd_revalidate_disk+0x1df/0x320
 29)     2216      92   rescan_partitions+0x98/0x330
 30)     2124      52   __blkdev_get+0x309/0x350
 31)     2072       8   blkdev_get+0xf/0x20
 32)     2064      44   register_disk+0xff/0x120
 33)     2020      36   add_disk+0x6e/0xb0
 34)     1984      44   sd_probe_async+0xfb/0x1d0
 35)     1940      44   __async_schedule+0xf4/0x1b0
 36)     1896       8   async_schedule+0x12/0x20
 37)     1888      60   sd_probe+0x305/0x360
 38)     1828      44   really_probe+0x63/0x170
 39)     1784      36   driver_probe_device+0x5d/0x60
 40)     1748      16   __device_attach+0x49/0x50
 41)     1732      32   bus_for_each_drv+0x5b/0x80
 42)     1700      24   device_attach+0x6b/0x70
 43)     1676      16   bus_attach_device+0x47/0x60
 44)     1660      76   device_add+0x33d/0x400
 45)     1584      52   scsi_sysfs_add_sdev+0x6a/0x2c0
 46)     1532     108   scsi_add_lun+0x44b/0x460
 47)     1424     116   scsi_probe_and_add_lun+0x182/0x4e0
 48)     1308      36   __scsi_add_device+0xd9/0xe0
 49)     1272      44   ata_scsi_scan_host+0x10b/0x190
 50)     1228      24   async_port_probe+0x96/0xd0
 51)     1204      44   __async_schedule+0xf4/0x1b0
 52)     1160       8   async_schedule+0x12/0x20
 53)     1152      48   ata_host_register+0x171/0x1d0
 54)     1104      60   ata_pci_sff_activate_host+0xf3/0x230
 55)     1044      44   ata_pci_sff_init_one+0xea/0x100
 56)     1000      48   amd_init_one+0xb2/0x190
 57)      952       8   local_pci_probe+0x13/0x20
 58)      944      32   pci_device_probe+0x68/0x90
 59)      912      44   really_probe+0x63/0x170
 60)      868      36   driver_probe_device+0x5d/0x60
 61)      832      20   __driver_attach+0x89/0xa0
 62)      812      32   bus_for_each_dev+0x5b/0x80
 63)      780      12   driver_attach+0x1e/0x20
 64)      768      72   bus_add_driver+0x14b/0x2d0
 65)      696      36   driver_register+0x6e/0x150
 66)      660      20   __pci_register_driver+0x53/0xc0
 67)      640       8   amd_init+0x14/0x16
 68)      632     572   do_one_initcall+0x2b/0x1d0
 69)       60      12   do_basic_setup+0x56/0x6a
 70)       48      20   kernel_init+0x84/0xce
 71)       28      28   kernel_thread_helper+0x7/0x10

There's a lot of fat functions on that stack trace, but
the largest of all is do_one_initcall(). This is due to
the boot trace entry variables being on the stack.

Fixing this is relatively easy, initcalls are fundamentally
serialized, so we can move the local variables to file scope.

Note that this large stack footprint was present for a
couple of months already - what pushed my system over
the edge was the addition of kmemleak to the call-chain:

  6)     3328      36   allocate_slab+0xb1/0x100
  7)     3292      36   new_slab+0x1c/0x160
  8)     3256      36   __slab_alloc+0x133/0x2b0
  9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
 10)     3216     108   create_object+0x28/0x250
 11)     3108      40   kmemleak_alloc+0x81/0xc0
 12)     3068      24   kmem_cache_alloc+0x162/0x1d0
 13)     3044      52   scsi_pool_alloc_command+0x29/0x70

This pushes the total to ~3800 bytes, only a tiny bit
more was needed to corrupt the on-kernel-stack thread_info.

The fix reduces the stack footprint from 572 bytes
to 28 bytes.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 init/main.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/init/main.c b/init/main.c
index 2c5ade7..98e679e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -733,13 +733,14 @@ static void __init do_ctors(void)
 int initcall_debug;
 core_param(initcall_debug, initcall_debug, bool, 0644);
 
+static char msgbuf[64];
+static struct boot_trace_call call;
+static struct boot_trace_ret ret;
+
 int do_one_initcall(initcall_t fn)
 {
 	int count = preempt_count();
 	ktime_t calltime, delta, rettime;
-	char msgbuf[64];
-	struct boot_trace_call call;
-	struct boot_trace_ret ret;
 
 	if (initcall_debug) {
 		call.caller = task_pid_nr(current);

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 11:07               ` [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall() tip-bot for Ingo Molnar
@ 2009-08-21 11:14                 ` Ingo Molnar
  2009-08-21 11:37                   ` Peter Zijlstra
  2009-08-21 17:48                   ` Andrew Morton
  2009-08-21 16:05                 ` Linus Torvalds
  1 sibling, 2 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-21 11:14 UTC (permalink / raw)
  To: linux-tip-commits, Arjan van de Ven, Alan Cox, Andrew Morton,
	Dave Jones, Kyle McMartin, Greg KH
  Cc: linux-kernel, hpa, mingo, torvalds, catalin.marinas,
	a.p.zijlstra, jens.axboe, fweisbec, stable, srostedt, tglx


* tip-bot for Ingo Molnar <mingo@elte.hu> wrote:

> Commit-ID:  4a683bf94b8a10e2bb0da07aec3ac0a55e5de61f
> Gitweb:     http://git.kernel.org/tip/4a683bf94b8a10e2bb0da07aec3ac0a55e5de61f
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Fri, 21 Aug 2009 12:53:36 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 21 Aug 2009 13:03:22 +0200
> 
> tracing: Fix too large stack usage in do_one_initcall()
> 
> One of my testboxes triggered this nasty stack overflow crash
> during SCSI probing:
> 
> [    5.874004] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [    5.875004] device: 'sda': device_add
> [    5.878004] BUG: unable to handle kernel NULL pointer dereference at 00000a0c
> [    5.878004] IP: [<b1008321>] print_context_stack+0x81/0x110
> [    5.878004] *pde = 00000000
> [    5.878004] Thread overran stack, or stack corrupted
> [    5.878004] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [    5.878004] last sysfs file:
> [    5.878004]
> [    5.878004] Pid: 1, comm: swapper Not tainted (2.6.31-rc6-tip-01272-g9919e28-dirty #5685)
> [    5.878004] EIP: 0060:[<b1008321>] EFLAGS: 00010083 CPU: 0
> [    5.878004] EIP is at print_context_stack+0x81/0x110
> [    5.878004] EAX: cf8a3000 EBX: cf8a3fe4 ECX: 00000049 EDX: 00000000
> [    5.878004] ESI: b1cfce84 EDI: 00000000 EBP: cf8a3018 ESP: cf8a2ff4
> [    5.878004]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
> [    5.878004] Process swapper (pid: 1, ti=cf8a2000 task=cf8a8000 task.ti=cf8a3000)
> [    5.878004] Stack:
> [    5.878004]  b1004867 fffff000 cf8a3ffc
> [    5.878004] Call Trace:
> [    5.878004]  [<b1004867>] ? kernel_thread_helper+0x7/0x10
> [    5.878004] BUG: unable to handle kernel NULL pointer dereference at 00000a0c
> [    5.878004] IP: [<b1008321>] print_context_stack+0x81/0x110
> [    5.878004] *pde = 00000000
> [    5.878004] Thread overran stack, or stack corrupted
> [    5.878004] Oops: 0000 [#2] PREEMPT SMP DEBUG_PAGEALLOC
> 
> The oops did not reveal any more details about the real stack
> that we have and the system got into an infinite loop of
> recursive pagefaults.
> 
> So i booted with CONFIG_STACK_TRACER=y and the 'stacktrace' boot
> parameter. The box did not crash (timings/conditions probably
> changed a tiny bit to trigger the catastrophic crash), but the
> /debug/tracing/stack_trace file was rather revealing:
> 
>         Depth    Size   Location    (72 entries)
>         -----    ----   --------
>   0)     3704      52   __change_page_attr+0xb8/0x290
>   1)     3652      24   __change_page_attr_set_clr+0x43/0x90
>   2)     3628      60   kernel_map_pages+0x108/0x120
>   3)     3568      40   prep_new_page+0x7d/0x130
>   4)     3528      84   get_page_from_freelist+0x106/0x420
>   5)     3444     116   __alloc_pages_nodemask+0xd7/0x550
>   6)     3328      36   allocate_slab+0xb1/0x100
>   7)     3292      36   new_slab+0x1c/0x160
>   8)     3256      36   __slab_alloc+0x133/0x2b0
>   9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
>  10)     3216     108   create_object+0x28/0x250
>  11)     3108      40   kmemleak_alloc+0x81/0xc0
>  12)     3068      24   kmem_cache_alloc+0x162/0x1d0
>  13)     3044      52   scsi_pool_alloc_command+0x29/0x70
>  14)     2992      20   scsi_host_alloc_command+0x22/0x70
>  15)     2972      24   __scsi_get_command+0x1b/0x90
>  16)     2948      28   scsi_get_command+0x35/0x90
>  17)     2920      24   scsi_setup_blk_pc_cmnd+0xd4/0x100
>  18)     2896     128   sd_prep_fn+0x332/0xa70
>  19)     2768      36   blk_peek_request+0xe7/0x1d0
>  20)     2732      56   scsi_request_fn+0x54/0x520
>  21)     2676      12   __generic_unplug_device+0x2b/0x40
>  22)     2664      24   blk_execute_rq_nowait+0x59/0x80
>  23)     2640     172   blk_execute_rq+0x6b/0xb0
>  24)     2468      32   scsi_execute+0xe0/0x140
>  25)     2436      64   scsi_execute_req+0x152/0x160
>  26)     2372      60   scsi_vpd_inquiry+0x6c/0x90
>  27)     2312      44   scsi_get_vpd_page+0x112/0x160
>  28)     2268      52   sd_revalidate_disk+0x1df/0x320
>  29)     2216      92   rescan_partitions+0x98/0x330
>  30)     2124      52   __blkdev_get+0x309/0x350
>  31)     2072       8   blkdev_get+0xf/0x20
>  32)     2064      44   register_disk+0xff/0x120
>  33)     2020      36   add_disk+0x6e/0xb0
>  34)     1984      44   sd_probe_async+0xfb/0x1d0
>  35)     1940      44   __async_schedule+0xf4/0x1b0
>  36)     1896       8   async_schedule+0x12/0x20
>  37)     1888      60   sd_probe+0x305/0x360
>  38)     1828      44   really_probe+0x63/0x170
>  39)     1784      36   driver_probe_device+0x5d/0x60
>  40)     1748      16   __device_attach+0x49/0x50
>  41)     1732      32   bus_for_each_drv+0x5b/0x80
>  42)     1700      24   device_attach+0x6b/0x70
>  43)     1676      16   bus_attach_device+0x47/0x60
>  44)     1660      76   device_add+0x33d/0x400
>  45)     1584      52   scsi_sysfs_add_sdev+0x6a/0x2c0
>  46)     1532     108   scsi_add_lun+0x44b/0x460
>  47)     1424     116   scsi_probe_and_add_lun+0x182/0x4e0
>  48)     1308      36   __scsi_add_device+0xd9/0xe0
>  49)     1272      44   ata_scsi_scan_host+0x10b/0x190
>  50)     1228      24   async_port_probe+0x96/0xd0
>  51)     1204      44   __async_schedule+0xf4/0x1b0
>  52)     1160       8   async_schedule+0x12/0x20
>  53)     1152      48   ata_host_register+0x171/0x1d0
>  54)     1104      60   ata_pci_sff_activate_host+0xf3/0x230
>  55)     1044      44   ata_pci_sff_init_one+0xea/0x100
>  56)     1000      48   amd_init_one+0xb2/0x190
>  57)      952       8   local_pci_probe+0x13/0x20
>  58)      944      32   pci_device_probe+0x68/0x90
>  59)      912      44   really_probe+0x63/0x170
>  60)      868      36   driver_probe_device+0x5d/0x60
>  61)      832      20   __driver_attach+0x89/0xa0
>  62)      812      32   bus_for_each_dev+0x5b/0x80
>  63)      780      12   driver_attach+0x1e/0x20
>  64)      768      72   bus_add_driver+0x14b/0x2d0
>  65)      696      36   driver_register+0x6e/0x150
>  66)      660      20   __pci_register_driver+0x53/0xc0
>  67)      640       8   amd_init+0x14/0x16
>  68)      632     572   do_one_initcall+0x2b/0x1d0
>  69)       60      12   do_basic_setup+0x56/0x6a
>  70)       48      20   kernel_init+0x84/0xce
>  71)       28      28   kernel_thread_helper+0x7/0x10
> 
> There's a lot of fat functions on that stack trace, but
> the largest of all is do_one_initcall(). This is due to
> the boot trace entry variables being on the stack.
> 
> Fixing this is relatively easy, initcalls are fundamentally
> serialized, so we can move the local variables to file scope.
> 
> Note that this large stack footprint was present for a
> couple of months already - what pushed my system over
> the edge was the addition of kmemleak to the call-chain:
> 
>   6)     3328      36   allocate_slab+0xb1/0x100
>   7)     3292      36   new_slab+0x1c/0x160
>   8)     3256      36   __slab_alloc+0x133/0x2b0
>   9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
>  10)     3216     108   create_object+0x28/0x250
>  11)     3108      40   kmemleak_alloc+0x81/0xc0
>  12)     3068      24   kmem_cache_alloc+0x162/0x1d0
>  13)     3044      52   scsi_pool_alloc_command+0x29/0x70
> 
> This pushes the total to ~3800 bytes, only a tiny bit
> more was needed to corrupt the on-kernel-stack thread_info.
> 
> The fix reduces the stack footprint from 572 bytes
> to 28 bytes.

btw., it will just take two more features like kmemleak to trigger 
hard to debug stack overflows again on 32-bit. We are right at the 
edge and this situation is not really fixable in a reliable way 
anymore.

So i think we should be more drastic and solve the real problem: we 
should drop 4K stacks and 8K combo-stacks on 32-bit, and go 
exclusively to 8K split stacks on 32-bit.

I.e. the stack size will be 'unified' too between 64-bit and 32-bit 
to a certain degree: process stacks will be 8K on both 64-bit and 
32-bit x86, IRQ stacks will be separate. (on 64-bit we also have the 
IST stacks for certain exceptions that further isolates things)

This will simplify the 32-bit situation quite a bit and removes a 
contentious config option and makes the kernel more robust in 
general. 8K combo stacks are not safe due to irq nesting and 4K 
isolated stacks are not enough. 8K isolated stacks is the way to go.

Opinions?

	Ingo

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 11:14                 ` Ingo Molnar
@ 2009-08-21 11:37                   ` Peter Zijlstra
  2009-08-21 11:58                     ` Ingo Molnar
  2009-08-21 17:48                   ` Andrew Morton
  1 sibling, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2009-08-21 11:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-tip-commits, Arjan van de Ven, Alan Cox, Andrew Morton,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	torvalds, catalin.marinas, jens.axboe, fweisbec, stable,
	srostedt, tglx

On Fri, 2009-08-21 at 13:14 +0200, Ingo Molnar wrote:

> > There's a lot of fat functions on that stack trace, but
> > the largest of all is do_one_initcall(). This is due to
> > the boot trace entry variables being on the stack.
> > 
> > Fixing this is relatively easy, initcalls are fundamentally
> > serialized, so we can move the local variables to file scope.
> > 
> > Note that this large stack footprint was present for a
> > couple of months already - what pushed my system over
> > the edge was the addition of kmemleak to the call-chain:
> > 
> >   6)     3328      36   allocate_slab+0xb1/0x100
> >   7)     3292      36   new_slab+0x1c/0x160
> >   8)     3256      36   __slab_alloc+0x133/0x2b0
> >   9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
> >  10)     3216     108   create_object+0x28/0x250
> >  11)     3108      40   kmemleak_alloc+0x81/0xc0
> >  12)     3068      24   kmem_cache_alloc+0x162/0x1d0
> >  13)     3044      52   scsi_pool_alloc_command+0x29/0x70
> > 
> > This pushes the total to ~3800 bytes, only a tiny bit
> > more was needed to corrupt the on-kernel-stack thread_info.
> > 
> > The fix reduces the stack footprint from 572 bytes
> > to 28 bytes.
> 
> btw., it will just take two more features like kmemleak to trigger 
> hard to debug stack overflows again on 32-bit. We are right at the 
> edge and this situation is not really fixable in a reliable way 
> anymore.
> 
> So i think we should be more drastic and solve the real problem: we 
> should drop 4K stacks and 8K combo-stacks on 32-bit, and go 
> exclusively to 8K split stacks on 32-bit.
> 
> I.e. the stack size will be 'unified' too between 64-bit and 32-bit 
> to a certain degree: process stacks will be 8K on both 64-bit and 
> 32-bit x86, IRQ stacks will be separate. (on 64-bit we also have the 
> IST stacks for certain exceptions that further isolates things)
> 
> This will simplify the 32-bit situation quite a bit and removes a 
> contentious config option and makes the kernel more robust in 
> general. 8K combo stacks are not safe due to irq nesting and 4K 
> isolated stacks are not enough. 8K isolated stacks is the way to go.
> 
> Opinions?

I'm obviously all in favour of merging the i386 and x86_64 stack code.
Esp after having had to look at the i386 stuff recently.

Now I don't think that unifying all this requires the sizes to be the
same between them, because x86_64 typically has larger stack footprint
due to it being 64 bit. If we need to bump 32 bit stack sizes, then
we're likely to also need a bump in 64 bit as well at some point soon.



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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 11:37                   ` Peter Zijlstra
@ 2009-08-21 11:58                     ` Ingo Molnar
  0 siblings, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-21 11:58 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-tip-commits, Arjan van de Ven, Alan Cox, Andrew Morton,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	torvalds, catalin.marinas, jens.axboe, fweisbec, stable,
	srostedt, tglx


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

> On Fri, 2009-08-21 at 13:14 +0200, Ingo Molnar wrote:
> 
> > > There's a lot of fat functions on that stack trace, but
> > > the largest of all is do_one_initcall(). This is due to
> > > the boot trace entry variables being on the stack.
> > > 
> > > Fixing this is relatively easy, initcalls are fundamentally
> > > serialized, so we can move the local variables to file scope.
> > > 
> > > Note that this large stack footprint was present for a
> > > couple of months already - what pushed my system over
> > > the edge was the addition of kmemleak to the call-chain:
> > > 
> > >   6)     3328      36   allocate_slab+0xb1/0x100
> > >   7)     3292      36   new_slab+0x1c/0x160
> > >   8)     3256      36   __slab_alloc+0x133/0x2b0
> > >   9)     3220       4   kmem_cache_alloc+0x1bb/0x1d0
> > >  10)     3216     108   create_object+0x28/0x250
> > >  11)     3108      40   kmemleak_alloc+0x81/0xc0
> > >  12)     3068      24   kmem_cache_alloc+0x162/0x1d0
> > >  13)     3044      52   scsi_pool_alloc_command+0x29/0x70
> > > 
> > > This pushes the total to ~3800 bytes, only a tiny bit
> > > more was needed to corrupt the on-kernel-stack thread_info.
> > > 
> > > The fix reduces the stack footprint from 572 bytes
> > > to 28 bytes.
> > 
> > btw., it will just take two more features like kmemleak to trigger 
> > hard to debug stack overflows again on 32-bit. We are right at the 
> > edge and this situation is not really fixable in a reliable way 
> > anymore.
> > 
> > So i think we should be more drastic and solve the real problem: we 
> > should drop 4K stacks and 8K combo-stacks on 32-bit, and go 
> > exclusively to 8K split stacks on 32-bit.
> > 
> > I.e. the stack size will be 'unified' too between 64-bit and 32-bit 
> > to a certain degree: process stacks will be 8K on both 64-bit and 
> > 32-bit x86, IRQ stacks will be separate. (on 64-bit we also have the 
> > IST stacks for certain exceptions that further isolates things)
> > 
> > This will simplify the 32-bit situation quite a bit and removes a 
> > contentious config option and makes the kernel more robust in 
> > general. 8K combo stacks are not safe due to irq nesting and 4K 
> > isolated stacks are not enough. 8K isolated stacks is the way to go.
> > 
> > Opinions?
> 
> I'm obviously all in favour of merging the i386 and x86_64 stack 
> code. Esp after having had to look at the i386 stuff recently.

ok.

> Now I don't think that unifying all this requires the sizes to be 
> the same between them, because x86_64 typically has larger stack 
> footprint due to it being 64 bit. If we need to bump 32 bit stack 
> sizes, then we're likely to also need a bump in 64 bit as well at 
> some point soon.

Well 64-bit is larger, but not twice as large. Here are the factors 
('+' increases stack footprint, '.' is neutral, '-' decreases it):

 + pointers are 2x as large
 + alignment can cause 4 byte holes
 . other data is generally the same size
 - it has less register pressure so fewer stack spills

So it's far from 2x size.

Btw., i've measured this precisely: head to head the same .config 
triggers the following worst-case stack footprint critical path:

 32-bit:  0)     3704      52   __change_page_attr+0xb8/0x290
 64-bit:  0)     5672     112   __change_page_attr+0xc1/0x2f0

So 64-bit has almost precisely +50% stack footprint. (same compiler, 
etc.)

And since 64-bit has larger hardware and gets stress-tested more 
these days than 32-bit, i think it's time to flip it around: now the 
pressure is to keep things within the 64-bit 8K stack, not the other 
way around.

	Ingo

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 11:07               ` [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall() tip-bot for Ingo Molnar
  2009-08-21 11:14                 ` Ingo Molnar
@ 2009-08-21 16:05                 ` Linus Torvalds
  2009-08-21 16:22                   ` Ingo Molnar
  2009-08-21 18:33                   ` Arjan van de Ven
  1 sibling, 2 replies; 1150+ messages in thread
From: Linus Torvalds @ 2009-08-21 16:05 UTC (permalink / raw)
  To: mingo, H. Peter Anvin, Linux Kernel Mailing List, a.p.zijlstra,
	catalin.marinas, Jens Axboe, fweisbec, srostedt, tglx,
	Ingo Molnar, Arjan van de Ven


So I obviously agree with fixing do_one_initcall(), but..

Looking at the other cases, I do note (once more) what a horrible thing 
SCSI is, and that the callchains are not only way too deep, but the SCSI 
routines stand out among the cases that have 100+ bytes of stack frame.

We _really_ should fix these:

>   5)     3444     116   __alloc_pages_nodemask+0xd7/0x550   
>  10)     3216     108   create_object+0x28/0x250
>  18)     2896     128   sd_prep_fn+0x332/0xa70
>  23)     2640     172   blk_execute_rq+0x6b/0xb0
>  46)     1532     108   scsi_add_lun+0x44b/0x460
>  47)     1424     116   scsi_probe_and_add_lun+0x182/0x4e0

I also note that in this case, we'd have gotten rid of a _lot_ of the 
callchain if we had actually just executed this thing asynchronously. 
Because we clearly have that __async_schedule() there in the callchain in 
two places: before the port probing and the disk probing.

But it looks like we hit the MAX_WORK limit. Which sounds odd, since that 
is set to 32768, but I guess it can happen. It sounds a bit unlikely. 
Ingo, do you have something set to disable that?

I do wonder, though. Maybe we should never have that MAX_WORK limit, and 
instead limit the parallelism by actively trying to yield when there's too 
much work? That bootup sequence _does_ tend to have deep callchains (with 
all the crazy device register crud), and maybe we should actively see the 
async work code as not just a way to speed up boot, but also as a way to 
avoid deep callchains.

Hmm?  Comments?

			Linus

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 16:05                 ` Linus Torvalds
@ 2009-08-21 16:22                   ` Ingo Molnar
  2009-08-21 18:33                   ` Arjan van de Ven
  1 sibling, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-21 16:22 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mingo, H. Peter Anvin, Linux Kernel Mailing List, a.p.zijlstra,
	catalin.marinas, Jens Axboe, fweisbec, srostedt, tglx,
	Arjan van de Ven


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> So I obviously agree with fixing do_one_initcall(), but..
> 
> Looking at the other cases, I do note (once more) what a horrible 
> thing SCSI is, and that the callchains are not only way too deep, 
> but the SCSI routines stand out among the cases that have 100+ 
> bytes of stack frame.
> 
> We _really_ should fix these:
> 
> >   5)     3444     116   __alloc_pages_nodemask+0xd7/0x550   
> >  10)     3216     108   create_object+0x28/0x250
> >  18)     2896     128   sd_prep_fn+0x332/0xa70
> >  23)     2640     172   blk_execute_rq+0x6b/0xb0
> >  46)     1532     108   scsi_add_lun+0x44b/0x460
> >  47)     1424     116   scsi_probe_and_add_lun+0x182/0x4e0
> 
> I also note that in this case, we'd have gotten rid of a _lot_ of the 
> callchain if we had actually just executed this thing asynchronously. 
> Because we clearly have that __async_schedule() there in the callchain in 
> two places: before the port probing and the disk probing.
> 
> But it looks like we hit the MAX_WORK limit. Which sounds odd, 
> since that is set to 32768, but I guess it can happen. It sounds a 
> bit unlikely. Ingo, do you have something set to disable that?

I have not configured anything odd consciously - but note that the 
config is randconfig derived, so all sorts of debug options (and 
other uncommon options) are set in it.

I already restarted testing on that box so i'm not 100% sure i have 
recovered the right config - the one i suspect is attached below.

	Ingo

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc6
# Fri Aug 21 17:18:33 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_HWEIGHT=y
CONFIG_GENERIC_GPIO=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_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=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 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 is not set
# CONFIG_AUDIT is not set

#
# RCU Subsystem
#
# CONFIG_CLASSIC_RCU is not set
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_TRACE=y
CONFIG_RCU_FANOUT=32
# 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 is not set
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
# CONFIG_CGROUP_NS is not set
# CONFIG_CGROUP_FREEZER is not set
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_RESOURCE_COUNTERS=y
CONFIG_CGROUP_MEM_RES_CTLR=y
CONFIG_MM_OWNER=y
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 is not set
CONFIG_RD_LZMA=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
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=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
# CONFIG_BUG is not set
# CONFIG_ELF_CORE is not set
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_HAVE_PERF_COUNTERS=y

#
# Performance Counters
#
CONFIG_PERF_COUNTERS=y
CONFIG_EVENT_PROFILE=y
# CONFIG_VM_EVENT_COUNTERS is not set
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
# CONFIG_STRIP_ASM_SYMS is not set
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 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

#
# GCOV-based kernel profiling
#
# CONFIG_GCOV_KERNEL is not set
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_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
CONFIG_BLK_DEV_BSG=y
CONFIG_BLK_DEV_INTEGRITY=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
# CONFIG_IOSCHED_AS is not set
CONFIG_IOSCHED_DEADLINE=y
# CONFIG_IOSCHED_CFQ is not set
# CONFIG_DEFAULT_AS is not set
CONFIG_DEFAULT_DEADLINE=y
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="deadline"
# CONFIG_FREEZER is not set

#
# 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=y
CONFIG_SPARSE_IRQ=y
CONFIG_X86_MPPARSE=y
CONFIG_X86_BIGSMP=y
# CONFIG_X86_EXTENDED_PLATFORM is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
CONFIG_PARAVIRT_GUEST=y
# CONFIG_VMI is not set
# CONFIG_KVM_CLOCK is not set
CONFIG_KVM_GUEST=y
CONFIG_LGUEST_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SPINLOCKS=y
# CONFIG_PARAVIRT_CLOCK is not set
CONFIG_PARAVIRT_DEBUG=y
# CONFIG_MEMTEST is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
CONFIG_M586=y
# 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 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=y
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_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=y
CONFIG_CPU_SUP_UMC_32=y
# CONFIG_HPET_TIMER is not set
# CONFIG_DMI is not set
# CONFIG_IOMMU_HELPER is not set
# CONFIG_IOMMU_API is not set
CONFIG_NR_CPUS=32
CONFIG_SCHED_SMT=y
# CONFIG_SCHED_MC is not set
# 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=y
CONFIG_X86_MCE=y
# CONFIG_X86_OLD_MCE is not set
CONFIG_X86_NEW_MCE=y
CONFIG_X86_MCE_INTEL=y
# CONFIG_X86_MCE_AMD is not set
CONFIG_X86_ANCIENT_MCE=y
CONFIG_X86_MCE_THRESHOLD=y
# CONFIG_X86_MCE_INJECT is not set
CONFIG_X86_THERMAL_VECTOR=y
CONFIG_VM86=y
# CONFIG_TOSHIBA is not set
CONFIG_I8K=y
# CONFIG_X86_REBOOTFIXUPS is not set
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
# CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_X86_CPU_DEBUG=y
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
# CONFIG_VMSPLIT_3G is not set
CONFIG_VMSPLIT_3G_OPT=y
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_2G_OPT is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xB0000000
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_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_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_HIGHPTE=y
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
# CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
# CONFIG_X86_RESERVE_LOW_64K is not set
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 is not set
# CONFIG_CC_STACKPROTECTOR is not set
# 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 is not set
# CONFIG_KEXEC is not set
CONFIG_CRASH_DUMP=y
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_X86_NEED_RELOCS=y
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_HOTPLUG_CPU=y
# CONFIG_COMPAT_VDSO is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="stacktrace"
# CONFIG_CMDLINE_OVERRIDE is not set
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=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# 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=y
# 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 is not set
CONFIG_X86_P4_CLOCKMOD=y
CONFIG_X86_CPUFREQ_NFORCE2=y
CONFIG_X86_LONGRUN=y
# CONFIG_X86_E_POWERSAVER is not set

#
# 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 is not set
# CONFIG_PCI_GOMMCONFIG is not set
# CONFIG_PCI_GODIRECT is not set
# CONFIG_PCI_GOOLPC is not set
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_OLPC=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PCIEPORTBUS is not set
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
CONFIG_PCI_LEGACY=y
CONFIG_PCI_DEBUG=y
# CONFIG_PCI_STUB is not set
# CONFIG_HT_IRQ is not set
CONFIG_PCI_IOV=y
CONFIG_ISA_DMA_API=y
# CONFIG_ISA is not set
# CONFIG_MCA is not set
CONFIG_SCx200=y
# CONFIG_SCx200HR_TIMER is not set
CONFIG_OLPC=y
CONFIG_K8_NB=y
# CONFIG_PCCARD is not set
CONFIG_HOTPLUG_PCI=y
# CONFIG_HOTPLUG_PCI_FAKE is not set
CONFIG_HOTPLUG_PCI_COMPAQ=y
CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=y
CONFIG_HOTPLUG_PCI_IBM=y
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_HAVE_AOUT=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_MISC=y
CONFIG_HAVE_ATOMIC_IOMAP=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
CONFIG_UNIX=y
CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE=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=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
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=y
# CONFIG_TCP_CONG_BIC is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=y
# CONFIG_TCP_CONG_HTCP is not set
# CONFIG_TCP_CONG_HSTCP is not set
CONFIG_TCP_CONG_HYBLA=y
CONFIG_TCP_CONG_VEGAS=y
CONFIG_TCP_CONG_SCALABLE=y
CONFIG_TCP_CONG_LP=y
CONFIG_TCP_CONG_VENO=y
CONFIG_TCP_CONG_YEAH=y
# CONFIG_TCP_CONG_ILLINOIS is not set
# CONFIG_DEFAULT_BIC is not set
# CONFIG_DEFAULT_CUBIC is not set
# CONFIG_DEFAULT_HTCP is not set
CONFIG_DEFAULT_VEGAS=y
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="vegas"
# 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 is not set
# CONFIG_NETFILTER_ADVANCED is not set

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NETFILTER_XTABLES=y
# CONFIG_NETFILTER_XT_TARGET_CONNSECMARK is not set
CONFIG_NETFILTER_XT_TARGET_MARK=y
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
# CONFIG_NETFILTER_XT_TARGET_SECMARK is not set
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set
# CONFIG_NETFILTER_XT_MATCH_MARK is not set
# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
# 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 is not set
# CONFIG_IP_VS_PROTO_UDP is not set
CONFIG_IP_VS_PROTO_AH_ESP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
# CONFIG_IP_VS_LC is not set
CONFIG_IP_VS_WLC=y
# CONFIG_IP_VS_LBLC is not set
# CONFIG_IP_VS_LBLCR is not set
CONFIG_IP_VS_DH=y
# CONFIG_IP_VS_SH is not set
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y

#
# IPVS application helper
#

#
# 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=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
CONFIG_IP_NF_TARGET_ULOG=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_NF_NAT_FTP=y
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=y
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_DCCP=y
CONFIG_INET_DCCP_DIAG=y

#
# DCCP CCIDs Configuration (EXPERIMENTAL)
#
CONFIG_IP_DCCP_CCID2_DEBUG=y
CONFIG_IP_DCCP_CCID3=y
# CONFIG_IP_DCCP_CCID3_DEBUG is not set
CONFIG_IP_DCCP_CCID3_RTO=100
CONFIG_IP_DCCP_TFRC_LIB=y

#
# 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=y
# CONFIG_SCTP_HMAC_SHA1 is not set
# CONFIG_SCTP_HMAC_MD5 is not set
CONFIG_TIPC=y
CONFIG_TIPC_ADVANCED=y
CONFIG_TIPC_ZONES=3
CONFIG_TIPC_CLUSTERS=1
CONFIG_TIPC_NODES=255
CONFIG_TIPC_SLAVE_NODES=0
CONFIG_TIPC_PORTS=8191
CONFIG_TIPC_LOG=0
# CONFIG_TIPC_DEBUG is not set
CONFIG_ATM=y
# CONFIG_ATM_CLIP is not set
CONFIG_ATM_LANE=y
CONFIG_ATM_MPOA=y
CONFIG_ATM_BR2684=y
CONFIG_ATM_BR2684_IPFILTER=y
CONFIG_STP=y
CONFIG_GARP=y
# CONFIG_BRIDGE is not set
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 is not set
CONFIG_IPX=y
# CONFIG_IPX_INTERN is not set
CONFIG_ATALK=y
# CONFIG_DEV_APPLETALK is not set
CONFIG_X25=y
# CONFIG_LAPB is not set
CONFIG_ECONET=y
CONFIG_ECONET_AUNUDP=y
CONFIG_ECONET_NATIVE=y
CONFIG_WAN_ROUTER=y
# CONFIG_PHONET is not set
CONFIG_IEEE802154=y
# CONFIG_NET_SCHED is not set
CONFIG_DCB=y

#
# Network testing
#
CONFIG_NET_PKTGEN=y
# CONFIG_NET_DROP_MONITOR is not set
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
CONFIG_AX25=y
CONFIG_AX25_DAMA_SLAVE=y
# CONFIG_NETROM is not set
CONFIG_ROSE=y

#
# AX.25 network device drivers
#
CONFIG_MKISS=y
CONFIG_6PACK=y
CONFIG_BPQETHER=y
CONFIG_BAYCOM_SER_FDX=y
# CONFIG_BAYCOM_SER_HDX is not set
CONFIG_BAYCOM_PAR=y
CONFIG_BAYCOM_EPP=y
CONFIG_YAM=y
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y

#
# CAN Device Drivers
#
CONFIG_CAN_VCAN=y
CONFIG_CAN_DEV=y
# CONFIG_CAN_CALC_BITTIMING is not set
CONFIG_CAN_SJA1000=y
CONFIG_CAN_SJA1000_PLATFORM=y
# CONFIG_CAN_EMS_PCI is not set
CONFIG_CAN_KVASER_PCI=y
CONFIG_CAN_DEBUG_DEVICES=y
CONFIG_IRDA=y

#
# IrDA protocols
#
# CONFIG_IRLAN is not set
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=y
CONFIG_ACTISYS_DONGLE=y
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=y
CONFIG_NSC_FIR=y
# CONFIG_WINBOND_FIR is not set
# CONFIG_TOSHIBA_FIR is not set
CONFIG_SMC_IRCC_FIR=y
CONFIG_ALI_FIR=y
CONFIG_VLSI_FIR=y
# CONFIG_VIA_FIR is not set
CONFIG_MCS_FIR=y
# CONFIG_BT is not set
CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_DEBUG=y
CONFIG_RXKAD=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=y
CONFIG_LIB80211=y
CONFIG_LIB80211_CRYPT_WEP=y
CONFIG_LIB80211_CRYPT_CCMP=y
CONFIG_LIB80211_CRYPT_TKIP=y
CONFIG_LIB80211_DEBUG=y
CONFIG_MAC80211=y
CONFIG_MAC80211_DEFAULT_PS=y
CONFIG_MAC80211_DEFAULT_PS_VALUE=1

#
# Rate control algorithm selection
#
# CONFIG_MAC80211_RC_PID is not set
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=y
# CONFIG_MAC80211_DEBUG_MENU is not set
CONFIG_WIMAX=y
CONFIG_WIMAX_DEBUG_LEVEL=8
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set

#
# 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=y
CONFIG_DEBUG_DEVRES=y
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
# CONFIG_MTD is not set
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_SERIAL=y
CONFIG_PARPORT_PC_FIFO=y
CONFIG_PARPORT_PC_SUPERIO=y
# CONFIG_PARPORT_GSC is not set
CONFIG_PARPORT_AX88796=y
CONFIG_PARPORT_1284=y
CONFIG_PARPORT_NOT_PC=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
# CONFIG_PARIDE is not set
CONFIG_BLK_CPQ_DA=y
# CONFIG_BLK_CPQ_CISS_DA is not set
CONFIG_BLK_DEV_DAC960=y
CONFIG_BLK_DEV_UMEM=y
# 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_OSD=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 is not set
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=y
CONFIG_BLK_DEV_HD=y
# CONFIG_MISC_DEVICES is not set
CONFIG_TIFM_CORE=y
CONFIG_EEPROM_93CX6=y
CONFIG_CB710_CORE=y
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set

#
# SCSI device support
#
CONFIG_RAID_ATTRS=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
# CONFIG_SCSI_TGT is not set
# CONFIG_SCSI_NETLINK is not set
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=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 is not set
CONFIG_SCSI_LOGGING=y
# CONFIG_SCSI_SCAN_ASYNC is not set

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
# CONFIG_SCSI_SAS_ATA is not set
# CONFIG_SCSI_SAS_HOST_SMP is not set
# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
# CONFIG_SCSI_SRP_ATTRS is not set
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_DH is not set
CONFIG_SCSI_OSD_INITIATOR=y
CONFIG_SCSI_OSD_ULD=y
CONFIG_SCSI_OSD_DPRINT_SENSE=1
CONFIG_SCSI_OSD_DEBUG=y
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
# CONFIG_SATA_PMP is not set
CONFIG_SATA_AHCI=y
CONFIG_SATA_SIL24=y
CONFIG_ATA_SFF=y
CONFIG_SATA_SVW=y
CONFIG_ATA_PIIX=y
CONFIG_SATA_MV=y
CONFIG_SATA_NV=y
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
CONFIG_SATA_PROMISE=y
# CONFIG_SATA_SX4 is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
CONFIG_SATA_ULI=y
CONFIG_SATA_VIA=y
CONFIG_SATA_VITESSE=y
# CONFIG_SATA_INIC162X is not set
CONFIG_PATA_ALI=y
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_CMD640_PCI is not set
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=y
CONFIG_PATA_CS5530=y
# CONFIG_PATA_CS5535 is not set
CONFIG_PATA_CS5536=y
# CONFIG_PATA_CYPRESS is not set
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=y
# CONFIG_PATA_IT8213 is not set
CONFIG_PATA_JMICRON=y
# CONFIG_PATA_TRIFLEX is not set
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=y
CONFIG_PATA_OPTI=y
CONFIG_PATA_OPTIDMA=y
CONFIG_PATA_PDC_OLD=y
# CONFIG_PATA_RADISYS is not set
CONFIG_PATA_RZ1000=y
# CONFIG_PATA_SC1200 is not set
CONFIG_PATA_SERVERWORKS=y
CONFIG_PATA_PDC2027X=y
CONFIG_PATA_SIL680=y
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_VIA is not set
CONFIG_PATA_WINBOND=y
CONFIG_PATA_PLATFORM=y
# CONFIG_PATA_SCH is not set
# 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 is not set
# CONFIG_FIREWIRE_SBP2 is not set
# CONFIG_FIREWIRE_NET is not set
# CONFIG_IEEE1394 is not set
CONFIG_I2O=y
# CONFIG_I2O_LCT_NOTIFY_ON_CHANGES is not set
# CONFIG_I2O_EXT_ADAPTEC is not set
# CONFIG_I2O_CONFIG is not set
# CONFIG_I2O_BUS is not set
CONFIG_I2O_BLOCK=y
# CONFIG_I2O_SCSI is not set
# CONFIG_I2O_PROC is not set
CONFIG_MACINTOSH_DRIVERS=y
# CONFIG_MAC_EMUMOUSEBTN is not set
CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
CONFIG_BONDING=y
# CONFIG_MACVLAN is not set
CONFIG_EQUALIZER=y
# CONFIG_TUN is not set
# CONFIG_VETH is not set
CONFIG_ARCNET=y
# CONFIG_ARCNET_1201 is not set
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=y
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=y
CONFIG_CICADA_PHY=y
# CONFIG_VITESSE_PHY is not set
CONFIG_SMSC_PHY=y
CONFIG_BROADCOM_PHY=y
CONFIG_ICPLUS_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_NATIONAL_PHY=y
# CONFIG_STE10XP is not set
CONFIG_LSI_ET1011C_PHY=y
CONFIG_FIXED_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_GPIO=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_HAPPYMEAL=y
# CONFIG_SUNGEM is not set
CONFIG_CASSINI=y
CONFIG_NET_VENDOR_3COM=y
CONFIG_VORTEX=y
CONFIG_TYPHOON=y
CONFIG_ENC28J60=y
CONFIG_ENC28J60_WRITEVERIFY=y
CONFIG_ETHOC=y
# CONFIG_DNET is not set
CONFIG_NET_TULIP=y
CONFIG_DE2104X=y
CONFIG_DE2104X_DSL=0
CONFIG_TULIP=y
CONFIG_TULIP_MWI=y
CONFIG_TULIP_MMIO=y
CONFIG_TULIP_NAPI=y
# CONFIG_TULIP_NAPI_HW_MITIGATION is not set
# CONFIG_DE4X5 is not set
CONFIG_WINBOND_840=y
CONFIG_DM9102=y
CONFIG_ULI526X=y
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 is not set
CONFIG_ADAPTEC_STARFIRE=y
# CONFIG_B44 is not set
CONFIG_FORCEDETH=y
# CONFIG_FORCEDETH_NAPI is not set
CONFIG_E100=y
# CONFIG_FEALNX is not set
CONFIG_NATSEMI=y
CONFIG_NE2K_PCI=y
# CONFIG_8139CP is not set
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
CONFIG_8139TOO_8129=y
CONFIG_8139_OLD_RX_RESET=y
CONFIG_R6040=y
CONFIG_SIS900=y
CONFIG_EPIC100=y
CONFIG_SMSC9420=y
CONFIG_SUNDANCE=y
CONFIG_SUNDANCE_MMIO=y
# CONFIG_TLAN is not set
# CONFIG_KS8842 is not set
CONFIG_KS8851=y
CONFIG_VIA_RHINE=y
CONFIG_VIA_RHINE_MMIO=y
# CONFIG_SC92031 is not set
# CONFIG_NET_POCKET is not set
CONFIG_ATL2=y
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
CONFIG_ACENIC_OMIT_TIGON_I=y
CONFIG_DL2K=y
# CONFIG_E1000 is not set
CONFIG_E1000E=y
CONFIG_IP1000=y
CONFIG_IGB=y
CONFIG_IGBVF=y
# CONFIG_NS83820 is not set
CONFIG_HAMACHI=y
CONFIG_YELLOWFIN=y
# CONFIG_R8169 is not set
CONFIG_SIS190=y
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
CONFIG_VIA_VELOCITY=y
CONFIG_TIGON3=y
CONFIG_BNX2=y
# CONFIG_CNIC is not set
CONFIG_QLA3XXX=y
CONFIG_ATL1=y
CONFIG_ATL1E=y
CONFIG_ATL1C=y
# CONFIG_JME is not set
CONFIG_NETDEV_10000=y
CONFIG_MDIO=y
CONFIG_CHELSIO_T1=y
CONFIG_CHELSIO_T1_1G=y
CONFIG_CHELSIO_T3_DEPENDS=y
CONFIG_CHELSIO_T3=y
# CONFIG_ENIC is not set
# CONFIG_IXGBE is not set
CONFIG_IXGB=y
# CONFIG_S2IO is not set
# CONFIG_VXGE is not set
CONFIG_MYRI10GE=y
# CONFIG_NETXEN_NIC is not set
# CONFIG_NIU is not set
CONFIG_MLX4_EN=y
CONFIG_MLX4_CORE=y
# CONFIG_MLX4_DEBUG is not set
CONFIG_TEHUTI=y
# CONFIG_BNX2X is not set
CONFIG_QLGE=y
CONFIG_SFC=y
CONFIG_BE2NET=y
CONFIG_TR=y
CONFIG_IBMOL=y
# CONFIG_IBMLS is not set
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 is not set
CONFIG_LIBERTAS_SDIO=y
CONFIG_LIBERTAS_SPI=y
# CONFIG_LIBERTAS_DEBUG is not set
CONFIG_LIBERTAS_THINFIRM=y
# CONFIG_LIBERTAS_THINFIRM_USB is not set
CONFIG_AIRO=y
# CONFIG_ATMEL is not set
CONFIG_AT76C50X_USB=y
CONFIG_PRISM54=y
# CONFIG_USB_ZD1201 is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
CONFIG_RTL8180=y
# CONFIG_RTL8187 is not set
# CONFIG_ADM8211 is not set
# CONFIG_MAC80211_HWSIM is not set
# CONFIG_MWL8K is not set
# CONFIG_P54_COMMON is not set
CONFIG_ATH_COMMON=y
CONFIG_ATH5K=y
CONFIG_ATH5K_DEBUG=y
CONFIG_ATH9K=y
CONFIG_ATH9K_DEBUG=y
# CONFIG_AR9170_USB is not set
CONFIG_IPW2100=y
CONFIG_IPW2100_MONITOR=y
# CONFIG_IPW2100_DEBUG 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 is not set
CONFIG_IWLWIFI=y
CONFIG_IWLWIFI_LEDS=y
CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
CONFIG_IWLWIFI_DEBUG=y
# CONFIG_IWLWIFI_DEBUGFS is not set
CONFIG_IWLAGN=y
CONFIG_IWL4965=y
CONFIG_IWL5000=y
# CONFIG_IWL3945 is not set
# CONFIG_HOSTAP is not set
CONFIG_B43=y
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
CONFIG_B43_PIO=y
CONFIG_B43_LEDS=y
CONFIG_B43_HWRNG=y
CONFIG_B43_DEBUG=y
CONFIG_B43_FORCE_PIO=y
# CONFIG_B43LEGACY is not set
CONFIG_ZD1211RW=y
CONFIG_ZD1211RW_DEBUG=y
# CONFIG_RT2X00 is not set
CONFIG_HERMES=y
CONFIG_HERMES_CACHE_FW_ON_INIT=y
CONFIG_PLX_HERMES=y
# CONFIG_TMD_HERMES is not set
# CONFIG_NORTEL_HERMES is not set
CONFIG_PCI_HERMES=y
# CONFIG_WL12XX is not set
# CONFIG_IWM is not set

#
# WiMAX Wireless Broadband devices
#
CONFIG_WIMAX_I2400M=y
# CONFIG_WIMAX_I2400M_USB is not set
CONFIG_WIMAX_I2400M_SDIO=y
CONFIG_WIMAX_I2400M_DEBUG_LEVEL=8

#
# USB Network Adapters
#
CONFIG_USB_CATC=y
# CONFIG_USB_KAWETH is not set
# 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 is not set
CONFIG_USB_NET_NET1080=y
# CONFIG_USB_NET_PLUSB is not set
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
# CONFIG_USB_BELKIN is not set
# CONFIG_USB_ARMLINUX is not set
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_NET_INT51X1=y
CONFIG_WAN=y
# CONFIG_HDLC is not set
CONFIG_DLCI=y
CONFIG_DLCI_MAX=8
# CONFIG_WAN_ROUTER_DRIVERS is not set
# CONFIG_SBNI 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=y
CONFIG_ATM_ENI_BURST_TX_16W=y
# CONFIG_ATM_ENI_BURST_TX_8W is not set
CONFIG_ATM_ENI_BURST_TX_4W=y
CONFIG_ATM_ENI_BURST_TX_2W=y
CONFIG_ATM_ENI_BURST_RX_16W=y
CONFIG_ATM_ENI_BURST_RX_8W=y
CONFIG_ATM_ENI_BURST_RX_4W=y
# CONFIG_ATM_ENI_BURST_RX_2W is not set
CONFIG_ATM_FIRESTREAM=y
# CONFIG_ATM_ZATM is not set
CONFIG_ATM_NICSTAR=y
CONFIG_ATM_NICSTAR_USE_SUNI=y
CONFIG_ATM_NICSTAR_USE_IDT77105=y
CONFIG_ATM_IDT77252=y
CONFIG_ATM_IDT77252_DEBUG=y
CONFIG_ATM_IDT77252_RCV_ALL=y
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=y
CONFIG_ATM_IA_DEBUG=y
# CONFIG_ATM_FORE200E is not set
CONFIG_ATM_HE=y
CONFIG_ATM_HE_USE_SUNI=y
# CONFIG_ATM_SOLOS is not set
CONFIG_IEEE802154_DRIVERS=y
# CONFIG_IEEE802154_FAKEHARD is not set
CONFIG_FDDI=y
# CONFIG_DEFXX is not set
# CONFIG_SKFP is not set
CONFIG_HIPPI=y
# CONFIG_ROADRUNNER is not set
# CONFIG_PLIP is not set
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=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_MPPE=y
# CONFIG_PPPOE is not set
CONFIG_PPPOATM=y
CONFIG_PPPOL2TP=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=y
CONFIG_SLIP_SMART=y
# CONFIG_SLIP_MODE_SLIP6 is not set
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=y
# CONFIG_ISDN is not set
# 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=y
# 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_GPIO is not set
CONFIG_KEYBOARD_MATRIX=y
CONFIG_KEYBOARD_LM8323=y
CONFIG_KEYBOARD_NEWTON=y
# CONFIG_KEYBOARD_STOWAWAY is not set
CONFIG_KEYBOARD_SUNKBD=y
CONFIG_KEYBOARD_XTKBD=y
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
# CONFIG_TABLET_USB_AIPTEK is not set
# CONFIG_TABLET_USB_GTCO is not set
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_WACOM=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ADS7846=y
# CONFIG_TOUCHSCREEN_AD7877 is not set
CONFIG_TOUCHSCREEN_AD7879_I2C=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_EETI=y
CONFIG_TOUCHSCREEN_FUJITSU=y
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_ELO is not set
CONFIG_TOUCHSCREEN_WACOM_W8001=y
CONFIG_TOUCHSCREEN_MTOUCH=y
# CONFIG_TOUCHSCREEN_INEXIO is not set
CONFIG_TOUCHSCREEN_MK712=y
CONFIG_TOUCHSCREEN_PENMOUNT=y
CONFIG_TOUCHSCREEN_TOUCHRIGHT=y
CONFIG_TOUCHSCREEN_TOUCHWIN=y
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
# CONFIG_TOUCHSCREEN_USB_EGALAX is not set
CONFIG_TOUCHSCREEN_USB_PANJIT=y
CONFIG_TOUCHSCREEN_USB_3M=y
# CONFIG_TOUCHSCREEN_USB_ITM is not set
CONFIG_TOUCHSCREEN_USB_ETURBO=y
# CONFIG_TOUCHSCREEN_USB_GUNZE is not set
CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y
CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
# CONFIG_TOUCHSCREEN_USB_GOTOP is not set
# 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_WISTRON_BTNS=y
# CONFIG_INPUT_ATI_REMOTE is not set
# CONFIG_INPUT_ATI_REMOTE2 is not set
# CONFIG_INPUT_KEYSPAN_REMOTE is not set
CONFIG_INPUT_POWERMATE=y
CONFIG_INPUT_YEALINK=y
# CONFIG_INPUT_CM109 is not set
# CONFIG_INPUT_TWL4030_PWRBUTTON is not set
CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_PCF50633_PMU=y
# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_CT82C710=y
CONFIG_SERIO_PARKBD=y
CONFIG_SERIO_PCIPS2=y
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
# CONFIG_GAMEPORT 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=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_COMPUTONE is not set
# CONFIG_ROCKETPORT is not set
# CONFIG_CYCLADES is not set
CONFIG_DIGIEPCA=y
# CONFIG_MOXA_INTELLIO is not set
CONFIG_MOXA_SMARTIO=y
# CONFIG_ISI is not set
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 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=y
CONFIG_SERIAL_8250_MANY_PORTS=y
# CONFIG_SERIAL_8250_SHARE_IRQ is not set
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y

#
# Non-8250 serial port support
#
CONFIG_SERIAL_MAX3100=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_SERIAL_JSM=y
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_PRINTER=y
CONFIG_LP_CONSOLE=y
CONFIG_PPDEV=y
CONFIG_HVC_DRIVER=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_IPMI_HANDLER=y
# CONFIG_IPMI_PANIC_EVENT is not set
CONFIG_IPMI_DEVICE_INTERFACE=y
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 is not set
CONFIG_HW_RANDOM_AMD=y
# CONFIG_HW_RANDOM_GEODE is not set
# CONFIG_HW_RANDOM_VIA is not set
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_NVRAM=y
# CONFIG_R3964 is not set
CONFIG_APPLICOM=y
CONFIG_SONYPI=y
CONFIG_MWAVE=y
# CONFIG_SCx200_GPIO is not set
# CONFIG_PC8736x_GPIO is not set
# CONFIG_NSC_GPIO is not set
CONFIG_CS5535_GPIO=y
CONFIG_RAW_DRIVER=y
CONFIG_MAX_RAW_DEVS=256
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_TCG_TPM=y
CONFIG_TCG_NSC=y
CONFIG_TCG_ATMEL=y
# CONFIG_TELCLOCK is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
# CONFIG_I2C_CHARDEV is not set
# CONFIG_I2C_HELPER_AUTO is not set

#
# I2C Algorithms
#
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCF=y
# CONFIG_I2C_ALGOPCA is not set

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
CONFIG_I2C_ALI1563=y
# CONFIG_I2C_ALI15X3 is not set
CONFIG_I2C_AMD756=y
# CONFIG_I2C_AMD756_S4882 is not set
# CONFIG_I2C_AMD8111 is not set
# CONFIG_I2C_I801 is not set
CONFIG_I2C_ISCH=y
# CONFIG_I2C_PIIX4 is not set
CONFIG_I2C_NFORCE2=y
# CONFIG_I2C_NFORCE2_S4985 is not set
CONFIG_I2C_SIS5595=y
CONFIG_I2C_SIS630=y
CONFIG_I2C_SIS96X=y
# CONFIG_I2C_VIA is not set
CONFIG_I2C_VIAPRO=y

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_GPIO is not set
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_SIMTEC is not set

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT=y
CONFIG_I2C_PARPORT_LIGHT=y
# CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB=y

#
# Graphics adapter I2C/DDC channel drivers
#
CONFIG_I2C_VOODOO3=y

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_SCx200_ACB is not set

#
# Miscellaneous I2C Chip support
#
# CONFIG_DS1682 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=y
CONFIG_SPI_MASTER=y

#
# SPI Master Controller Drivers
#
CONFIG_SPI_BITBANG=y
CONFIG_SPI_BUTTERFLY=y
# CONFIG_SPI_GPIO is not set
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=y
CONFIG_DEBUG_GPIO=y
CONFIG_GPIO_SYSFS=y

#
# Memory mapped GPIO expanders:
#

#
# I2C GPIO expanders:
#
# CONFIG_GPIO_MAX732X is not set
# CONFIG_GPIO_PCA953X is not set
CONFIG_GPIO_PCF857X=y
# CONFIG_GPIO_TWL4030 is not set

#
# PCI GPIO expanders:
#
# CONFIG_GPIO_BT8XX is not set

#
# SPI GPIO expanders:
#
# CONFIG_GPIO_MAX7301 is not set
# CONFIG_GPIO_MCP23S08 is not set
CONFIG_W1=y

#
# 1-wire Bus Masters
#
# CONFIG_W1_MASTER_MATROX is not set
# CONFIG_W1_MASTER_DS2490 is not set
CONFIG_W1_MASTER_DS2482=y
CONFIG_W1_MASTER_GPIO=y

#
# 1-wire Slaves
#
# CONFIG_W1_SLAVE_THERM is not set
# CONFIG_W1_SLAVE_SMEM is not set
# CONFIG_W1_SLAVE_DS2431 is not set
CONFIG_W1_SLAVE_DS2433=y
CONFIG_W1_SLAVE_DS2433_CRC=y
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_OLPC=y
CONFIG_BATTERY_BQ27x00=y
# CONFIG_BATTERY_MAX17040 is not set
CONFIG_CHARGER_PCF50633=y
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
CONFIG_SENSORS_ABITUGURU=y
CONFIG_SENSORS_ABITUGURU3=y
# CONFIG_SENSORS_AD7414 is not set
CONFIG_SENSORS_AD7418=y
CONFIG_SENSORS_ADCXX=y
CONFIG_SENSORS_ADM1021=y
CONFIG_SENSORS_ADM1025=y
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=y
# CONFIG_SENSORS_ADT7475 is not set
CONFIG_SENSORS_K8TEMP=y
# CONFIG_SENSORS_ASB100 is not set
CONFIG_SENSORS_ATXP1=y
# CONFIG_SENSORS_DS1621 is not set
CONFIG_SENSORS_I5K_AMB=y
CONFIG_SENSORS_F71805F=y
# CONFIG_SENSORS_F71882FG is not set
CONFIG_SENSORS_F75375S=y
CONFIG_SENSORS_FSCHER=y
# CONFIG_SENSORS_FSCPOS is not set
# CONFIG_SENSORS_FSCHMD is not set
# CONFIG_SENSORS_G760A is not set
CONFIG_SENSORS_GL518SM=y
CONFIG_SENSORS_GL520SM=y
CONFIG_SENSORS_CORETEMP=y
CONFIG_SENSORS_IBMAEM=y
# CONFIG_SENSORS_IBMPEX is not set
# CONFIG_SENSORS_IT87 is not set
# CONFIG_SENSORS_LM63 is not set
CONFIG_SENSORS_LM70=y
CONFIG_SENSORS_LM75=y
CONFIG_SENSORS_LM77=y
# CONFIG_SENSORS_LM78 is not set
CONFIG_SENSORS_LM80=y
CONFIG_SENSORS_LM83=y
CONFIG_SENSORS_LM85=y
CONFIG_SENSORS_LM87=y
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
CONFIG_SENSORS_LTC4215=y
CONFIG_SENSORS_LTC4245=y
CONFIG_SENSORS_LM95241=y
CONFIG_SENSORS_MAX1111=y
# CONFIG_SENSORS_MAX1619 is not set
CONFIG_SENSORS_MAX6650=y
CONFIG_SENSORS_PC87360=y
# CONFIG_SENSORS_PC87427 is not set
CONFIG_SENSORS_PCF8591=y
CONFIG_SENSORS_SHT15=y
# CONFIG_SENSORS_SIS5595 is not set
CONFIG_SENSORS_DME1737=y
CONFIG_SENSORS_SMSC47M1=y
# CONFIG_SENSORS_SMSC47M192 is not set
CONFIG_SENSORS_SMSC47B397=y
CONFIG_SENSORS_ADS7828=y
CONFIG_SENSORS_THMC50=y
CONFIG_SENSORS_TMP401=y
# CONFIG_SENSORS_VIA686A is not set
CONFIG_SENSORS_VT1211=y
CONFIG_SENSORS_VT8231=y
CONFIG_SENSORS_W83781D=y
# CONFIG_SENSORS_W83791D is not set
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_LIS3_SPI=y
CONFIG_SENSORS_APPLESMC=y
# CONFIG_HWMON_DEBUG_CHIP is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_HWMON=y
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_NOWAYOUT is not set

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=y
CONFIG_TWL4030_WATCHDOG=y
CONFIG_ACQUIRE_WDT=y
CONFIG_ADVANTECH_WDT=y
CONFIG_ALIM1535_WDT=y
CONFIG_ALIM7101_WDT=y
# CONFIG_SC520_WDT is not set
# CONFIG_EUROTECH_WDT is not set
CONFIG_IB700_WDT=y
CONFIG_IBMASR=y
CONFIG_WAFER_WDT=y
# CONFIG_I6300ESB_WDT is not set
CONFIG_ITCO_WDT=y
# CONFIG_ITCO_VENDOR_SUPPORT is not set
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
CONFIG_SC1200_WDT=y
CONFIG_SCx200_WDT=y
# CONFIG_PC87413_WDT is not set
CONFIG_60XX_WDT=y
CONFIG_SBC8360_WDT=y
CONFIG_SBC7240_WDT=y
CONFIG_CPU5_WDT=y
# CONFIG_SMSC_SCH311X_WDT is not set
CONFIG_SMSC37B787_WDT=y
CONFIG_W83627HF_WDT=y
# CONFIG_W83697HF_WDT is not set
# CONFIG_W83697UG_WDT is not set
CONFIG_W83877F_WDT=y
# CONFIG_W83977F_WDT is not set
CONFIG_MACHZ_WDT=y
CONFIG_SBC_EPX_C3_WATCHDOG=y

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
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_BLOCKIO=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=y
CONFIG_MFD_SM501_GPIO=y
CONFIG_HTC_PASIC3=y
CONFIG_TPS65010=y
CONFIG_TWL4030_CORE=y
# CONFIG_MFD_TMIO is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM8350_I2C is not set
CONFIG_MFD_PCF50633=y
CONFIG_PCF50633_ADC=y
CONFIG_PCF50633_GPIO=y
CONFIG_AB3100_CORE=y
CONFIG_EZX_PCAP=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_DEBUG=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
# CONFIG_REGULATOR_BQ24022 is not set
CONFIG_REGULATOR_MAX1586=y
CONFIG_REGULATOR_TWL4030=y
CONFIG_REGULATOR_PCF50633=y
CONFIG_REGULATOR_LP3971=y
CONFIG_MEDIA_SUPPORT=y

#
# Multimedia core support
#
CONFIG_VIDEO_DEV=y
CONFIG_VIDEO_V4L2_COMMON=y
CONFIG_VIDEO_ALLOW_V4L1=y
CONFIG_VIDEO_V4L1_COMPAT=y
# CONFIG_DVB_CORE is not set
CONFIG_VIDEO_MEDIA=y

#
# Multimedia drivers
#
CONFIG_VIDEO_SAA7146=y
CONFIG_VIDEO_SAA7146_VV=y
CONFIG_MEDIA_TUNER=y
CONFIG_MEDIA_TUNER_CUSTOMISE=y
CONFIG_MEDIA_TUNER_SIMPLE=y
CONFIG_MEDIA_TUNER_TDA8290=y
CONFIG_MEDIA_TUNER_TDA827X=y
CONFIG_MEDIA_TUNER_TDA18271=y
CONFIG_MEDIA_TUNER_TDA9887=y
# CONFIG_MEDIA_TUNER_TEA5761 is not set
CONFIG_MEDIA_TUNER_TEA5767=y
CONFIG_MEDIA_TUNER_MT20XX=y
# CONFIG_MEDIA_TUNER_MT2060 is not set
CONFIG_MEDIA_TUNER_MT2266=y
# CONFIG_MEDIA_TUNER_MT2131 is not set
# CONFIG_MEDIA_TUNER_QT1010 is not set
# CONFIG_MEDIA_TUNER_XC2028 is not set
# CONFIG_MEDIA_TUNER_XC5000 is not set
CONFIG_MEDIA_TUNER_MXL5005S=y
CONFIG_MEDIA_TUNER_MXL5007T=y
CONFIG_MEDIA_TUNER_MC44S803=y
CONFIG_VIDEO_V4L2=y
CONFIG_VIDEO_V4L1=y
CONFIG_VIDEOBUF_GEN=y
CONFIG_VIDEOBUF_DMA_SG=y
CONFIG_VIDEOBUF_VMALLOC=y
CONFIG_VIDEO_IR=y
CONFIG_VIDEO_TVEEPROM=y
CONFIG_VIDEO_TUNER=y
CONFIG_VIDEO_CAPTURE_DRIVERS=y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
CONFIG_VIDEO_IR_I2C=y

#
# Encoders/decoders and other helper chips
#

#
# Audio decoders
#
# CONFIG_VIDEO_TVAUDIO is not set
# CONFIG_VIDEO_TDA7432 is not set
# CONFIG_VIDEO_TDA9840 is not set
CONFIG_VIDEO_TDA9875=y
CONFIG_VIDEO_TEA6415C=y
CONFIG_VIDEO_TEA6420=y
CONFIG_VIDEO_MSP3400=y
CONFIG_VIDEO_CS5345=y
CONFIG_VIDEO_CS53L32A=y
CONFIG_VIDEO_M52790=y
CONFIG_VIDEO_TLV320AIC23B=y
CONFIG_VIDEO_WM8775=y
CONFIG_VIDEO_WM8739=y
CONFIG_VIDEO_VP27SMPX=y

#
# RDS decoders
#
# CONFIG_VIDEO_SAA6588 is not set

#
# Video decoders
#
CONFIG_VIDEO_BT819=y
CONFIG_VIDEO_BT856=y
# CONFIG_VIDEO_BT866 is not set
CONFIG_VIDEO_KS0127=y
CONFIG_VIDEO_OV7670=y
# CONFIG_VIDEO_MT9V011 is not set
CONFIG_VIDEO_TCM825X=y
# CONFIG_VIDEO_SAA7110 is not set
CONFIG_VIDEO_SAA711X=y
CONFIG_VIDEO_SAA717X=y
CONFIG_VIDEO_SAA7191=y
# CONFIG_VIDEO_TVP514X is not set
CONFIG_VIDEO_TVP5150=y
CONFIG_VIDEO_VPX3220=y

#
# Video and audio decoders
#
CONFIG_VIDEO_CX25840=y

#
# MPEG video encoders
#
CONFIG_VIDEO_CX2341X=y

#
# Video encoders
#
CONFIG_VIDEO_SAA7127=y
# CONFIG_VIDEO_SAA7185 is not set
# CONFIG_VIDEO_ADV7170 is not set
CONFIG_VIDEO_ADV7175=y
CONFIG_VIDEO_THS7303=y
CONFIG_VIDEO_ADV7343=y

#
# Video improvement chips
#
CONFIG_VIDEO_UPD64031A=y
CONFIG_VIDEO_UPD64083=y
CONFIG_VIDEO_VIVI=y
# CONFIG_VIDEO_BT848 is not set
# CONFIG_VIDEO_BWQCAM is not set
# CONFIG_VIDEO_CQCAM is not set
# CONFIG_VIDEO_W9966 is not set
# CONFIG_VIDEO_CPIA is not set
# CONFIG_VIDEO_CPIA2 is not set
CONFIG_VIDEO_SAA5246A=y
CONFIG_VIDEO_SAA5249=y
CONFIG_VIDEO_STRADIS=y
# CONFIG_VIDEO_ZORAN is not set
# CONFIG_VIDEO_SAA7134 is not set
CONFIG_VIDEO_MXB=y
CONFIG_VIDEO_HEXIUM_ORION=y
CONFIG_VIDEO_HEXIUM_GEMINI=y
# CONFIG_VIDEO_CX88 is not set
CONFIG_VIDEO_IVTV=y
CONFIG_VIDEO_CAFE_CCIC=y
CONFIG_SOC_CAMERA=y
CONFIG_SOC_CAMERA_MT9M001=y
CONFIG_SOC_CAMERA_MT9M111=y
# CONFIG_SOC_CAMERA_MT9T031 is not set
CONFIG_SOC_CAMERA_MT9V022=y
# CONFIG_SOC_CAMERA_TW9910 is not set
CONFIG_SOC_CAMERA_PLATFORM=y
CONFIG_SOC_CAMERA_OV772X=y
# CONFIG_V4L_USB_DRIVERS is not set
CONFIG_RADIO_ADAPTERS=y
CONFIG_RADIO_GEMTEK_PCI=y
CONFIG_RADIO_MAXIRADIO=y
# CONFIG_RADIO_MAESTRO is not set
# CONFIG_USB_DSBR is not set
# CONFIG_USB_SI470X is not set
CONFIG_USB_MR800=y
# CONFIG_RADIO_TEA5764 is not set
# CONFIG_DAB is not set

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_ALI=y
CONFIG_AGP_ATI=y
CONFIG_AGP_AMD=y
CONFIG_AGP_AMD64=y
# CONFIG_AGP_INTEL is not set
CONFIG_AGP_NVIDIA=y
CONFIG_AGP_SIS=y
CONFIG_AGP_SWORKS=y
# CONFIG_AGP_VIA is not set
CONFIG_AGP_EFFICEON=y
# CONFIG_DRM is not set
# 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=y
CONFIG_BACKLIGHT_GENERIC=y
CONFIG_BACKLIGHT_PROGEAR=y
# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
CONFIG_BACKLIGHT_SAHARA=y

#
# Display device support
#
CONFIG_DISPLAY_SUPPORT=y

#
# Display hardware drivers
#

#
# 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_SOUND 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 is not set
CONFIG_USB_HIDDEV=y

#
# Special HID drivers
#
# CONFIG_HID_A4TECH is not set
# CONFIG_HID_APPLE is not set
# CONFIG_HID_BELKIN is not set
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CYPRESS=y
CONFIG_HID_DRAGONRISE=y
# CONFIG_DRAGONRISE_FF is not set
# CONFIG_HID_EZKEY is not set
CONFIG_HID_KYE=y
CONFIG_HID_GYRATION=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LOGITECH=y
CONFIG_LOGITECH_FF=y
CONFIG_LOGIRUMBLEPAD2_FF=y
CONFIG_HID_MICROSOFT=y
# CONFIG_HID_MONTEREY is not set
CONFIG_HID_NTRIG=y
CONFIG_HID_PANTHERLORD=y
# CONFIG_PANTHERLORD_FF is not set
CONFIG_HID_PETALYNX=y
CONFIG_HID_SAMSUNG=y
CONFIG_HID_SONY=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_GREENASIA=y
CONFIG_GREENASIA_FF=y
CONFIG_HID_SMARTJOYPLUS=y
# CONFIG_SMARTJOYPLUS_FF is not set
CONFIG_HID_TOPSEED=y
# CONFIG_HID_THRUSTMASTER 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=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 is not set

#
# 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 is not set
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_OXU210HP_HCD=y
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
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_U132_HCD=y
CONFIG_USB_SL811_HCD=y
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_WHCI_HCD is not set
CONFIG_USB_HWA_HCD=y

#
# USB Device Class drivers
#
# CONFIG_USB_ACM is not set
CONFIG_USB_PRINTER=y
# CONFIG_USB_WDM is not set
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 is not set
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
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 is not set
CONFIG_USB_ADUTUX=y
# CONFIG_USB_SEVSEG is not set
# CONFIG_USB_RIO500 is not set
CONFIG_USB_LEGOTOWER=y
CONFIG_USB_LCD=y
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=y
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_SISUSBVGA_CON=y
CONFIG_USB_LD=y
CONFIG_USB_TRANCEVIBRATOR=y
CONFIG_USB_IOWARRIOR=y
CONFIG_USB_TEST=y
CONFIG_USB_ISIGHTFW=y
CONFIG_USB_VST=y
CONFIG_USB_ATM=y
# CONFIG_USB_SPEEDTOUCH is not set
CONFIG_USB_CXACRU=y
CONFIG_USB_UEAGLEATM=y
# CONFIG_USB_XUSBATM is not set
# CONFIG_USB_GADGET is not set

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
CONFIG_USB_GPIO_VBUS=y
# CONFIG_TWL4030_USB is not set
CONFIG_NOP_USB_XCEIV=y
CONFIG_UWB=y
CONFIG_UWB_HWA=y
CONFIG_UWB_WHCI=y
# CONFIG_UWB_WLP is not set
# CONFIG_UWB_I1480U is not set
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
CONFIG_MMC_UNSAFE_RESUME=y

#
# MMC/SD/SDIO Card Drivers
#
# CONFIG_MMC_BLOCK is not set
CONFIG_SDIO_UART=y
CONFIG_MMC_TEST=y

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_SDHCI is not set
# CONFIG_MMC_WBSD is not set
# CONFIG_MMC_TIFM_SD is not set
CONFIG_MMC_CB710=y
# CONFIG_MMC_VIA_SDMMC is not set
CONFIG_MEMSTICK=y
# CONFIG_MEMSTICK_DEBUG is not set

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
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_GPIO=y
# CONFIG_LEDS_GPIO_PLATFORM is not set
CONFIG_LEDS_LP3944=y
CONFIG_LEDS_PCA955X=y
CONFIG_LEDS_DAC124S085=y
# CONFIG_LEDS_BD2802 is not set

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
CONFIG_ACCESSIBILITY=y
# CONFIG_A11Y_BRAILLE_CONSOLE is not set
# CONFIG_INFINIBAND is not set
CONFIG_EDAC=y

#
# Reporting subsystems
#
# CONFIG_EDAC_DEBUG is not set
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_AMD76X=y
CONFIG_EDAC_E7XXX=y
# CONFIG_EDAC_E752X is not set
CONFIG_EDAC_I82875P=y
CONFIG_EDAC_I82975X=y
CONFIG_EDAC_I3000=y
# CONFIG_EDAC_X38 is not set
CONFIG_EDAC_I5400=y
# CONFIG_EDAC_I82860 is not set
CONFIG_EDAC_R82600=y
CONFIG_EDAC_I5000=y
CONFIG_EDAC_I5100=y
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set

#
# RTC interfaces
#
# CONFIG_RTC_INTF_SYSFS is not set
# CONFIG_RTC_INTF_PROC is not set
# CONFIG_RTC_INTF_DEV is not set
CONFIG_RTC_DRV_TEST=y

#
# I2C RTC drivers
#
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_DS1374=y
CONFIG_RTC_DRV_DS1672=y
CONFIG_RTC_DRV_MAX6900=y
# CONFIG_RTC_DRV_RS5C372 is not set
CONFIG_RTC_DRV_ISL1208=y
CONFIG_RTC_DRV_X1205=y
CONFIG_RTC_DRV_PCF8563=y
CONFIG_RTC_DRV_PCF8583=y
CONFIG_RTC_DRV_M41T80=y
CONFIG_RTC_DRV_M41T80_WDT=y
CONFIG_RTC_DRV_TWL4030=y
CONFIG_RTC_DRV_S35390A=y
# CONFIG_RTC_DRV_FM3130 is not set
CONFIG_RTC_DRV_RX8581=y
CONFIG_RTC_DRV_RX8025=y

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T94 is not set
CONFIG_RTC_DRV_DS1305=y
# CONFIG_RTC_DRV_DS1390 is not set
CONFIG_RTC_DRV_MAX6902=y
CONFIG_RTC_DRV_R9701=y
CONFIG_RTC_DRV_RS5C348=y
CONFIG_RTC_DRV_DS3234=y

#
# Platform RTC drivers
#
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_RTC_DRV_DS1286 is not set
CONFIG_RTC_DRV_DS1511=y
CONFIG_RTC_DRV_DS1553=y
CONFIG_RTC_DRV_DS1742=y
# CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86=y
CONFIG_RTC_DRV_M48T35=y
# CONFIG_RTC_DRV_M48T59 is not set
CONFIG_RTC_DRV_BQ4802=y
CONFIG_RTC_DRV_V3020=y
# CONFIG_RTC_DRV_PCF50633 is not set

#
# on-CPU RTC drivers
#
# CONFIG_DMADEVICES is not set
CONFIG_AUXDISPLAY=y
CONFIG_KS0108=y
CONFIG_KS0108_PORT=0x378
CONFIG_KS0108_DELAY=2
CONFIG_UIO=y
# CONFIG_UIO_CIF is not set
CONFIG_UIO_PDRV=y
# CONFIG_UIO_PDRV_GENIRQ is not set
CONFIG_UIO_SMX=y
CONFIG_UIO_AEC=y
CONFIG_UIO_SERCOS3=y

#
# TI VLYNQ
#
# CONFIG_STAGING is not set
# CONFIG_X86_PLATFORM_DEVICES is not set

#
# Firmware Drivers
#
CONFIG_EDD=y
# CONFIG_EDD_OFF is not set
# CONFIG_FIRMWARE_MEMMAP is not set
# CONFIG_DELL_RBU is not set
# CONFIG_DCDBAS is not set
# CONFIG_ISCSI_IBFT_FIND is not set

#
# File systems
#
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
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=y
# CONFIG_EXT4DEV_COMPAT is not set
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
# CONFIG_EXT4_FS_SECURITY is not set
CONFIG_FS_XIP=y
CONFIG_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_JBD2=y
CONFIG_JBD2_DEBUG=y
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
CONFIG_JFS_FS=y
# CONFIG_JFS_POSIX_ACL is not set
CONFIG_JFS_SECURITY=y
CONFIG_JFS_DEBUG=y
CONFIG_JFS_STATISTICS=y
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
CONFIG_XFS_QUOTA=y
# CONFIG_XFS_POSIX_ACL is not set
# CONFIG_XFS_RT is not set
CONFIG_XFS_DEBUG=y
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=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=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
CONFIG_QUOTACTL=y
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
CONFIG_FUSE_FS=y
# CONFIG_CUSE is not set

#
# Caches
#
CONFIG_FSCACHE=y
CONFIG_FSCACHE_STATS=y
# CONFIG_FSCACHE_HISTOGRAM is not set
CONFIG_FSCACHE_DEBUG=y
CONFIG_CACHEFILES=y
CONFIG_CACHEFILES_DEBUG=y
CONFIG_CACHEFILES_HISTOGRAM=y

#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y

#
# 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 is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not set
# CONFIG_PROC_VMCORE is not set
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
# CONFIG_TMPFS is not set
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_CONFIGFS_FS=y
CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ADFS_FS is not set
CONFIG_AFFS_FS=y
CONFIG_ECRYPT_FS=y
CONFIG_HFS_FS=y
CONFIG_HFSPLUS_FS=y
CONFIG_BEFS_FS=y
CONFIG_BEFS_DEBUG=y
CONFIG_BFS_FS=y
CONFIG_EFS_FS=y
# CONFIG_CRAMFS is not set
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
# CONFIG_VXFS_FS is not set
CONFIG_MINIX_FS=y
CONFIG_OMFS_FS=y
CONFIG_HPFS_FS=y
CONFIG_QNX4FS_FS=y
# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y
CONFIG_UFS_DEBUG=y
CONFIG_EXOFS_FS=y
# CONFIG_EXOFS_DEBUG is not set
CONFIG_NILFS2_FS=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
# CONFIG_ROOT_NFS is not set
CONFIG_NFS_FSCACHE=y
CONFIG_NFSD=y
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_RPCSEC_GSS_KRB5=y
CONFIG_RPCSEC_GSS_SPKM3=y
CONFIG_SMB_FS=y
CONFIG_SMB_NLS_DEFAULT=y
CONFIG_SMB_NLS_REMOTE="cp437"
CONFIG_CIFS=y
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_WEAK_PW_HASH=y
CONFIG_CIFS_UPCALL=y
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_DEBUG2=y
CONFIG_CIFS_DFS_UPCALL=y
# CONFIG_CIFS_EXPERIMENTAL is not set
# CONFIG_NCP_FS is not set
CONFIG_CODA_FS=y
CONFIG_AFS_FS=y
CONFIG_AFS_DEBUG=y
# CONFIG_AFS_FSCACHE is not set

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
# CONFIG_MINIX_SUBPARTITION is not set
CONFIG_SOLARIS_X86_PARTITION=y
# CONFIG_UNIXWARE_DISKLABEL is not set
CONFIG_LDM_PARTITION=y
# CONFIG_LDM_DEBUG is not set
CONFIG_SGI_PARTITION=y
# CONFIG_ULTRIX_PARTITION is not set
CONFIG_SUN_PARTITION=y
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 is not set
CONFIG_NLS_CODEPAGE_737=y
# CONFIG_NLS_CODEPAGE_775 is not set
CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_852 is not set
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
# CONFIG_NLS_CODEPAGE_860 is not set
CONFIG_NLS_CODEPAGE_861=y
CONFIG_NLS_CODEPAGE_862=y
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
# CONFIG_NLS_CODEPAGE_865 is not set
CONFIG_NLS_CODEPAGE_866=y
# CONFIG_NLS_CODEPAGE_869 is not set
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=y
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
# CONFIG_NLS_ISO8859_8 is not set
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 is not set
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=y
CONFIG_NLS_ISO8859_5=y
# CONFIG_NLS_ISO8859_6 is not set
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 is not set

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
CONFIG_ENABLE_WARN_DEPRECATED=y
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_KERNEL=y
CONFIG_DEBUG_SHIRQ=y
# CONFIG_DETECT_SOFTLOCKUP is not set
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_OBJECTS is not set
CONFIG_SLUB_DEBUG_ON=y
CONFIG_SLUB_STATS=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
CONFIG_DEBUG_KMEMLEAK_TEST=y
CONFIG_DEBUG_PREEMPT=y
# CONFIG_DEBUG_RT_MUTEXES is not set
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 is not set
# CONFIG_DEBUG_LOCKDEP is not set
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_HIGHMEM=y
# CONFIG_DEBUG_INFO 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 is not set
CONFIG_RCU_CPU_STALL_DETECTOR=y
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y
# CONFIG_FAIL_PAGE_ALLOC is not set
# CONFIG_FAIL_MAKE_REQUEST is not set
CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAULT_INJECTION_DEBUG_FS=y
# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
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_FUNCTION_GRAPH_TRACER=y
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_PREEMPT_TRACER is not set
# CONFIG_SYSPROF_TRACER is not set
CONFIG_SCHED_TRACER=y
CONFIG_FTRACE_SYSCALLS=y
CONFIG_BOOT_TRACER=y
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
CONFIG_POWER_TRACER=y
CONFIG_STACK_TRACER=y
CONFIG_KMEMTRACE=y
CONFIG_WORKQUEUE_TRACER=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_DYNAMIC_FTRACE=y
# CONFIG_FUNCTION_PROFILER is not set
CONFIG_FTRACE_MCOUNT_RECORD=y
CONFIG_FTRACE_SELFTEST=y
CONFIG_FTRACE_STARTUP_TEST=y
CONFIG_MMIOTRACE=y
# CONFIG_RING_BUFFER_BENCHMARK is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
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 is not set
CONFIG_HAVE_ARCH_KMEMCHECK=y
CONFIG_STRICT_DEVMEM=y
# CONFIG_X86_VERBOSE_BOOTUP is not set
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_STACKOVERFLOW=y
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=y
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 is not set
CONFIG_IO_DELAY_0XED=y
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEFAULT_IO_DELAY_TYPE=1
# CONFIG_DEBUG_BOOT_PARAMS is not set
CONFIG_CPA_DEBUG=y
# CONFIG_OPTIMIZE_INLINING is not set

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_NETWORK_XFRM=y
# CONFIG_SECURITY_PATH is not set
CONFIG_SECURITY_FILE_CAPABILITIES=y
# CONFIG_SECURITY_ROOTPLUG is not set
# CONFIG_SECURITY_TOMOYO is not set
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
# CONFIG_CRYPTO_FIPS is not set
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=y
CONFIG_CRYPTO_AUTHENC=y

#
# Authenticated Encryption with Associated Data
#
# CONFIG_CRYPTO_CCM is not set
# CONFIG_CRYPTO_GCM is not set
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=y

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32C_INTEL=y
CONFIG_CRYPTO_MD4=y
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=y
CONFIG_CRYPTO_SHA512=y
# 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=y
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_CAST5=y
CONFIG_CRYPTO_CAST6=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_FCRYPT=y
CONFIG_CRYPTO_KHAZAD=y
CONFIG_CRYPTO_SALSA20=y
# CONFIG_CRYPTO_SALSA20_586 is not set
CONFIG_CRYPTO_SEED=y
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
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=y
CONFIG_CRYPTO_DEV_HIFN_795X=y
CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
# CONFIG_VIRTUALIZATION is not set
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=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_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=y
# CONFIG_CPUMASK_OFFSTACK is not set
CONFIG_NLATTR=y

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 11:14                 ` Ingo Molnar
  2009-08-21 11:37                   ` Peter Zijlstra
@ 2009-08-21 17:48                   ` Andrew Morton
  2009-08-21 18:13                     ` Linus Torvalds
  2009-08-21 19:17                     ` Ingo Molnar
  1 sibling, 2 replies; 1150+ messages in thread
From: Andrew Morton @ 2009-08-21 17:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-tip-commits, Arjan van de Ven, Alan Cox, Dave Jones,
	Kyle McMartin, Greg KH, linux-kernel, hpa, mingo, torvalds,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx

On Fri, 21 Aug 2009 13:14:50 +0200 Ingo Molnar <mingo@elte.hu> wrote:

> 
> ...
>
> btw., it will just take two more features like kmemleak to trigger 
> hard to debug stack overflows again on 32-bit. We are right at the 
> edge and this situation is not really fixable in a reliable way 
> anymore.
> 
> So i think we should be more drastic and solve the real problem: we 
> should drop 4K stacks and 8K combo-stacks on 32-bit, and go 
> exclusively to 8K split stacks on 32-bit.

We seem to have overrun an 8k stack in
http://bugzilla.kernel.org/show_bug.cgi?id=14029

Do we have a max-stack-depth tracer widget btw?

> I.e. the stack size will be 'unified' too between 64-bit and 32-bit 
> to a certain degree: process stacks will be 8K on both 64-bit and 
> 32-bit x86, IRQ stacks will be separate. (on 64-bit we also have the 
> IST stacks for certain exceptions that further isolates things)
> 
> This will simplify the 32-bit situation quite a bit and removes a 
> contentious config option and makes the kernel more robust in 
> general. 8K combo stacks are not safe due to irq nesting and 4K 
> isolated stacks are not enough. 8K isolated stacks is the way to go.
> 
> Opinions?

I wouldn't lose any sleep over it.

I bet it would be sufficient to have 4k interrupt stacks though.

My main concern would be maintenance.  Over time we'll chew more and
more stack space and eventually we'll get into trouble again.  What
means do we have for holding the line at 8k, and even improving things?



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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 17:48                   ` Andrew Morton
@ 2009-08-21 18:13                     ` Linus Torvalds
  2009-08-21 18:30                       ` Steven Rostedt
  2009-08-21 19:02                       ` Ingo Molnar
  2009-08-21 19:17                     ` Ingo Molnar
  1 sibling, 2 replies; 1150+ messages in thread
From: Linus Torvalds @ 2009-08-21 18:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ingo Molnar, linux-tip-commits, Arjan van de Ven, Alan Cox,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx



On Fri, 21 Aug 2009, Andrew Morton wrote:
> 
> We seem to have overrun an 8k stack in
> http://bugzilla.kernel.org/show_bug.cgi?id=14029

The thread "v2.6.31-rc6: BUG: unable to handle kernel NULL pointer 
dereference at 0000000000000008" also has at least one oops that has 
that "Thread overran stack, or stack corrupted" marker thing.

> Do we have a max-stack-depth tracer widget btw?

Enable FTRACE and then STACK_TRACER. Then just do

	cat /sys/kernel/debug/tracing/stack_trace

and you'll get this.

But if by "widget" you meant something nice and automatic, then I don't 
think so.

> My main concern would be maintenance.  Over time we'll chew more and
> more stack space and eventually we'll get into trouble again.  What
> means do we have for holding the line at 8k, and even improving things?

That's why I think the async thing could fix this - if we _force_ async 
calls to be asynchronous, you won't have the deep callchains for all the 
device discovery thing.

		Linus

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 18:13                     ` Linus Torvalds
@ 2009-08-21 18:30                       ` Steven Rostedt
  2009-08-21 19:02                       ` Ingo Molnar
  1 sibling, 0 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-08-21 18:30 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Ingo Molnar, linux-tip-commits, Arjan van de Ven,
	Alan Cox, Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa,
	mingo, catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec,
	stable, tglx

On Fri, 2009-08-21 at 11:13 -0700, Linus Torvalds wrote:
> 
> On Fri, 21 Aug 2009, Andrew Morton wrote:
> > 
> > Do we have a max-stack-depth tracer widget btw?
> 
> Enable FTRACE and then STACK_TRACER. Then just do
> 
> 	cat /sys/kernel/debug/tracing/stack_trace
> 
> and you'll get this.

Just a nitpick, but you will want to also add "stacktrace" to the kernel
command line otherwise it is default off. If you forget to do that, you
can also enable it with /proc/sys/kernel/stack_tracer_enabled.

But if you forget what to do, the code will remind you:

[root@mxf ~]# cat /sys/kernel/debug/tracing/stack_trace 
        Depth    Size   Location    (-1 entries)
        -----    ----   --------
#
#  Stack tracer disabled
#
# To enable the stack tracer, either add 'stacktrace' to the
# kernel command line
# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'
#


-- Steve



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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 16:05                 ` Linus Torvalds
  2009-08-21 16:22                   ` Ingo Molnar
@ 2009-08-21 18:33                   ` Arjan van de Ven
  1 sibling, 0 replies; 1150+ messages in thread
From: Arjan van de Ven @ 2009-08-21 18:33 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mingo, H. Peter Anvin, Linux Kernel Mailing List, a.p.zijlstra,
	catalin.marinas, Jens Axboe, fweisbec, srostedt, tglx,
	Ingo Molnar

Linus Torvalds wrote:
> 
> I do wonder, though. Maybe we should never have that MAX_WORK limit, and 
> instead limit the parallelism by actively trying to yield when there's too 
> much work? That bootup sequence _does_ tend to have deep callchains (with 
> all the crazy device register crud), and maybe we should actively see the 
> async work code as not just a way to speed up boot, but also as a way to 
> avoid deep callchains.

makes sense; the MAX_WORK was more a sanity check to kill out of hand recursion
than anything else...

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 18:13                     ` Linus Torvalds
  2009-08-21 18:30                       ` Steven Rostedt
@ 2009-08-21 19:02                       ` Ingo Molnar
  2009-08-21 19:13                         ` Linus Torvalds
  1 sibling, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-21 19:02 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, linux-tip-commits, Arjan van de Ven, Alan Cox,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Fri, 21 Aug 2009, Andrew Morton wrote:
> > 
> > We seem to have overrun an 8k stack in
> > http://bugzilla.kernel.org/show_bug.cgi?id=14029

Note that's a 32-bit 8K stack oops, so it doesnt apply.

> The thread "v2.6.31-rc6: BUG: unable to handle kernel NULL pointer 
> dereference at 0000000000000008" also has at least one oops that 
> has that "Thread overran stack, or stack corrupted" marker thing.

This is a 64-bit one, a pty related one and it's not yet clear what 
happened there - but it's certainly possible to overrun any stack.

> > My main concern would be maintenance.  Over time we'll chew more 
> > and more stack space and eventually we'll get into trouble 
> > again.  What means do we have for holding the line at 8k, and 
> > even improving things?
> 
> That's why I think the async thing could fix this - if we _force_ 
> async calls to be asynchronous, you won't have the deep callchains 
> for all the device discovery thing.

Agreed. OTOH we have deep callchains in things like execve() too 
which seem to be a lot harder to fix - and those have been around 
for the past ~10 years since i've been looking at max-stacktraces.
I think 4K doesnt cut it anymore.

	Ingo

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 19:02                       ` Ingo Molnar
@ 2009-08-21 19:13                         ` Linus Torvalds
  2009-08-21 19:19                           ` Linus Torvalds
  0 siblings, 1 reply; 1150+ messages in thread
From: Linus Torvalds @ 2009-08-21 19:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andrew Morton, linux-tip-commits, Arjan van de Ven, Alan Cox,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx



On Fri, 21 Aug 2009, Ingo Molnar wrote:
> > 
> > That's why I think the async thing could fix this - if we _force_ 
> > async calls to be asynchronous, you won't have the deep callchains 
> > for all the device discovery thing.
> 
> Agreed. OTOH we have deep callchains in things like execve() too 
> which seem to be a lot harder to fix - and those have been around 
> for the past ~10 years since i've been looking at max-stacktraces.
> I think 4K doesnt cut it anymore.

I agree that we have stack traces that are too deep in other areas too. At 
the same time, it does tend to be the case that initcalls are special due 
to having those long chains of detection (PCI -> driver -> bus -> device), 
so targeting them specially is probably a good idea. 

(There are other "special" chains that tend to be long, like "mount": 
you often end up doing things like reading root inode information etc down 
a fairly deep chain).

And we probably should really complain more actively about big stack 
frames. We have that CONFIG_FRAME_WARN thing, but it's set very high. 

			Linus

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 17:48                   ` Andrew Morton
  2009-08-21 18:13                     ` Linus Torvalds
@ 2009-08-21 19:17                     ` Ingo Molnar
  2009-08-21 19:37                       ` Steven Rostedt
  1 sibling, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-21 19:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-tip-commits, Arjan van de Ven, Alan Cox, Dave Jones,
	Kyle McMartin, Greg KH, linux-kernel, hpa, mingo, torvalds,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 21 Aug 2009 13:14:50 +0200 Ingo Molnar <mingo@elte.hu> wrote:
> 
> > ...
> >
> > btw., it will just take two more features like kmemleak to 
> > trigger hard to debug stack overflows again on 32-bit. We are 
> > right at the edge and this situation is not really fixable in a 
> > reliable way anymore.
> > 
> > So i think we should be more drastic and solve the real problem: 
> > we should drop 4K stacks and 8K combo-stacks on 32-bit, and go 
> > exclusively to 8K split stacks on 32-bit.
> 
> We seem to have overrun an 8k stack in
> http://bugzilla.kernel.org/show_bug.cgi?id=14029

Btw., this is inapposite because 8K stacks on 32-bit are 'shared' - 
i.e. full process, softirq, hardirq and NMI context will nest on 
each other, into the same 8K stack.

What i suggested in my mail was to up the 4K stacks option to 8K, 
and to keep the separate IRQ/softirq stacks. (similar to 64-bit) 
This is quite different from the 8K shared-stack option on 32-bit.

Plus, i looked at the oops cited above, and it's in the idle thread. 
The idle thread does not do anything process level and if there's a 
stack overflow it generally does not trigger in the idle thread 
(because it has much less stack pressure).

Still, the stack could have overrun in IRQ context - but a more 
likely scenario would be some other memory corruption crippling the 
stack-overflow signature at the end of idle task's stack.

> Do we have a max-stack-depth tracer widget btw?

we do have an ftrace plugin for it, yes. But it has high cost (it 
traces all the time to find the maximum), so i'm not sure how 
realistic it would be to integrate it into the kerneloops daemon for 
example.

It could certainly be done - a sufficiently enabled kernel has to be 
built (perhaps a kernel-debug package) and the 
/debug/tracing/max_stack_trace value can be monitored for 'too much' 
values.

> > I.e. the stack size will be 'unified' too between 64-bit and 
> > 32-bit to a certain degree: process stacks will be 8K on both 
> > 64-bit and 32-bit x86, IRQ stacks will be separate. (on 64-bit 
> > we also have the IST stacks for certain exceptions that further 
> > isolates things)
> > 
> > This will simplify the 32-bit situation quite a bit and removes 
> > a contentious config option and makes the kernel more robust in 
> > general. 8K combo stacks are not safe due to irq nesting and 4K 
> > isolated stacks are not enough. 8K isolated stacks is the way to 
> > go.
> > 
> > Opinions?
> 
> I wouldn't lose any sleep over it.
> 
> I bet it would be sufficient to have 4k interrupt stacks though.
> 
> My main concern would be maintenance.  Over time we'll chew more 
> and more stack space and eventually we'll get into trouble again.  
> What means do we have for holding the line at 8k, and even 
> improving things?

We already have the '8K line'. People who see stack overflows 
_already_ go to the 8K stack kernel. The nasty thing about that is 
that while it might solve their immediate problem, 8K shared stack 
is still fragile in 'once in a blue moon' scenarios.

That's why i'm thinking about introducing the similar parameters all 
across on x86: 8K process stack on both 32-bit and 64-bit, and 8K 
(or larger) IRQ/softirq stacks.

This will have the added benefit of pushing the 'line of defense' 
into the 64-bit space - which generally gets much more (and much 
earlier) stress-testing in server shops - so we could find the 
nastier bugs before they hit the 32-bit desktop en masse.

	Ingo

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

* [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown
       [not found]             ` <new-submission>
                                 ` (307 preceding siblings ...)
  2009-08-21 11:07               ` [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall() tip-bot for Ingo Molnar
@ 2009-08-21 19:18               ` tip-bot for Thomas Gleixner
  2009-08-22 10:35                 ` Ingo Molnar
  2009-08-27 14:43               ` [tip:sched/clock] init: Move sched_clock_init after late_time_init tip-bot for Thomas Gleixner
                                 ` (397 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-08-21 19:18 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, johnstul, schwidefsky, tglx

Commit-ID:  8cab02dc3c58a12235c6d463ce684dded9696848
Gitweb:     http://git.kernel.org/tip/8cab02dc3c58a12235c6d463ce684dded9696848
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 20 Aug 2009 18:19:45 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 21 Aug 2009 21:13:37 +0200

x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown

This basically reverts commit 1a0c009ac (x86: unregister PIT
clocksource when PIT is disabled) because the problem which was tried
to address with that patch has been solved by commit 3f68535ada
(clocksource: sanity check sysfs clocksource changes).

The problem addressed by the original patch is that PIT could be
selected as clocksource after the system switched the PIT off or set
the PIT into one shot mode which would result in complete timekeeping
wreckage.

Now with the sysfs sanity check in place PIT cannot be selected again
when the system is in oneshot mode. The system will not switch to one
shot mode as long as PIT is installed because PIT is not suitable for
one shot.

The shutdown case which happens when the lapic timer is installed is
covered by the fact that init_pit_clocksource() is called after the
lapic timer take over and then does not install the PIT clocksource
at all.

We should have done the sanity checks back then, but ...

This also solves the locking problem which was reported vs. the
clocksource rework.

LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 arch/x86/kernel/i8253.c |   19 -------------------
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index 5cf36c0..23c1679 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -19,12 +19,6 @@
 DEFINE_SPINLOCK(i8253_lock);
 EXPORT_SYMBOL(i8253_lock);
 
-#ifdef CONFIG_X86_32
-static void pit_disable_clocksource(void);
-#else
-static inline void pit_disable_clocksource(void) { }
-#endif
-
 /*
  * HPET replaces the PIT, when enabled. So we need to know, which of
  * the two timers is used
@@ -57,12 +51,10 @@ static void init_pit_timer(enum clock_event_mode mode,
 			outb_pit(0, PIT_CH0);
 			outb_pit(0, PIT_CH0);
 		}
-		pit_disable_clocksource();
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:
 		/* One shot setup */
-		pit_disable_clocksource();
 		outb_pit(0x38, PIT_MODE);
 		break;
 
@@ -200,17 +192,6 @@ static struct clocksource pit_cs = {
 	.shift		= 20,
 };
 
-static void pit_disable_clocksource(void)
-{
-	/*
-	 * Use mult to check whether it is registered or not
-	 */
-	if (pit_cs.mult) {
-		clocksource_unregister(&pit_cs);
-		pit_cs.mult = 0;
-	}
-}
-
 static int __init init_pit_clocksource(void)
 {
 	 /*

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 19:13                         ` Linus Torvalds
@ 2009-08-21 19:19                           ` Linus Torvalds
  0 siblings, 0 replies; 1150+ messages in thread
From: Linus Torvalds @ 2009-08-21 19:19 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andrew Morton, linux-tip-commits, Arjan van de Ven, Alan Cox,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec, stable,
	srostedt, tglx



On Fri, 21 Aug 2009, Linus Torvalds wrote:
> 
> And we probably should really complain more actively about big stack 
> frames. We have that CONFIG_FRAME_WARN thing, but it's set very high. 

Hmm. Setting it down to 256 on x86-64 does cause a fair number of 
warnings even for something like my personal build (that avoids all the 
crazy drivers etc), but it looks "manageable" - ie something where a 
kernel developer should try it, and fix all the ones that they maintain.

And if you don't get any warnings in your area, try lowering it to 100 or 
something.

		Linus

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

* Re: [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall()
  2009-08-21 19:17                     ` Ingo Molnar
@ 2009-08-21 19:37                       ` Steven Rostedt
  0 siblings, 0 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-08-21 19:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andrew Morton, linux-tip-commits, Arjan van de Ven, Alan Cox,
	Dave Jones, Kyle McMartin, Greg KH, linux-kernel, hpa, mingo,
	torvalds, catalin.marinas, a.p.zijlstra, jens.axboe, fweisbec,
	stable, tglx

On Fri, 2009-08-21 at 21:17 +0200, Ingo Molnar wrote:
> 
> we do have an ftrace plugin for it, yes. But it has high cost (it 
> traces all the time to find the maximum), so i'm not sure how 
> realistic it would be to integrate it into the kerneloops daemon for 
> example.
> 
> It could certainly be done - a sufficiently enabled kernel has to be 
> built (perhaps a kernel-debug package) and the 
> /debug/tracing/max_stack_trace value can be monitored for 'too much' 
> values.

Since it uses the function tracer infrastructure, it only has high
overhead when enabled (if the dynamic ftrace is also enabled). But if
the kernel needs to be running with it enabled all the time it may be an
issue. But if someone is seeing problems with the stack, it would be
beneficial to have them enable it.

I recommend that CONFIG_STACK_TRACER to be enabled on all builds.
Because of the nops by the function tracer, it adds no overhead for
being configured in. Only when enabled and running does it add the extra
overhead.

Fedora 11 has it already enabled:

[rostedt@redhat ~]$ uname -r
2.6.29.5-191.fc11.x86_64
[rostedt@redhat ~]$ ls /debug/tracing/stack_trace 
/debug/tracing/stack_trace

Unforturnately, that kernel did not have the text to show how to enable
it:

[rostedt@redhat ~]$ cat /debug/tracing/stack_trace
        Depth   Size      Location    (0 entries)
        -----   ----      --------
[rostedt@redhat ~]$ 


But it still works when one knows how:

[root@redhat rostedt]# echo 1 > /proc/sys/kernel/stack_tracer_enabled 
[root@redhat rostedt]# cat /debug/tracing/stack_trace 
        Depth   Size      Location    (44 entries)
        -----   ----      --------
  0)     3072      48   enqueue_entity+0xe6/0x1b8
  1)     3024      32   enqueue_task_fair+0x2a/0x6d
  2)     2992      32   enqueue_task+0x51/0x5c
  3)     2960      32   activate_task+0x2d/0x35
  4)     2928      96   try_to_wake_up+0x1d3/0x26d
  5)     2832      16   default_wake_function+0x12/0x14
  6)     2816      32   autoremove_wake_function+0x16/0x39
  7)     2784      80   __wake_up_common+0x4e/0x84
  8)     2704      64   __wake_up+0x39/0x4d
  9)     2640      32   insert_work+0x51/0x55
 10)     2608      48   __queue_work+0x2f/0x42
 11)     2560      16   queue_work_on+0x44/0x4b
 12)     2544      16   queue_work+0x1f/0x21
 13)     2528      16   queue_delayed_work+0x13/0x28
 14)     2512      32   ata_pio_queue_task+0x35/0x39
 15)     2480      32   ata_sff_qc_issue+0x1f1/0x22e
 16)     2448      48   ata_qc_issue+0x222/0x25a
 17)     2400      80   __ata_scsi_queuecmd+0x193/0x1ef
 18)     2320      64   ata_scsi_queuecmd+0x5b/0x93
 19)     2256      48   scsi_dispatch_cmd+0x1a9/0x22b
 20)     2208      96   scsi_request_fn+0x46a/0x496
 21)     2112      32   __generic_unplug_device+0x32/0x37
 22)     2080      48   blk_execute_rq_nowait+0x84/0xb5
 23)     2032     160   blk_execute_rq+0x85/0xa7
 24)     1872      80   scsi_execute+0xf6/0x148
 25)     1792     128   scsi_execute_req+0x87/0xb9
 26)     1664      96   sr_test_unit_ready+0x65/0xcb
 27)     1568     144   sr_media_change+0x4f/0x247
 28)     1424      48   media_changed+0x54/0x8c
 29)     1376      16   cdrom_media_changed+0x31/0x37
 30)     1360      16   sr_block_media_changed+0x19/0x1b
 31)     1344      32   check_disk_change+0x29/0x5b
 32)     1312     448   cdrom_open+0x889/0x902
 33)      864      64   sr_block_open+0x90/0xad
 34)      800     112   __blkdev_get+0x26c/0x359
 35)      688      16   blkdev_get+0x10/0x12
 36)      672      48   blkdev_open+0x76/0xac
 37)      624      80   __dentry_open+0x143/0x273
 38)      544      32   nameidata_to_filp+0x42/0x53
 39)      512     304   do_filp_open+0x3fd/0x7b8
 40)      208      64   do_sys_open+0x59/0xda
 41)      144      16   sys_open+0x20/0x22
 42)      128     128   system_call_fastpath+0x16/0x1b

-- Steve



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

* Re: [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown
  2009-08-21 19:18               ` [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown tip-bot for Thomas Gleixner
@ 2009-08-22 10:35                 ` Ingo Molnar
  2009-08-22 21:14                   ` Martin Schwidefsky
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-22 10:35 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, johnstul, schwidefsky, tglx; +Cc: linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 7572 bytes --]


* tip-bot for Thomas Gleixner <tglx@linutronix.de> wrote:

> Commit-ID:  8cab02dc3c58a12235c6d463ce684dded9696848
> Gitweb:     http://git.kernel.org/tip/8cab02dc3c58a12235c6d463ce684dded9696848
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Thu, 20 Aug 2009 18:19:45 +0200
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Fri, 21 Aug 2009 21:13:37 +0200
> 
> x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown

even after this fix, -tip testing found yet another circular locking 
bug, on a 32-bit Core2 laptop:

[    1.198605] initcall cpufreq_gov_performance_init+0x0/0x10 returned 0 after 0 usecs
[    1.198736] calling  init_acpi_pm_clocksource+0x0/0x250 @ 1
[    1.233442] Switching to clocksource acpi_pm
[    1.233626] 
[    1.233627] =======================================================
[    1.233798] [ INFO: possible circular locking dependency detected ]
[    1.233889] 2.6.31-rc6-tip-01322-gd685ec8-dirty #7600
[    1.233977] -------------------------------------------------------
[    1.233999] swapper/1 is trying to acquire lock:
[    1.233999]  (cpu_add_remove_lock){+.+.+.}, at: [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999] 
[    1.233999] but task is already holding lock:
[    1.233999]  (setup_lock){+.+.+.}, at: [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999] 
[    1.233999] which lock already depends on the new lock.
[    1.233999] 
[    1.233999] 
[    1.233999] the existing dependency chain (in reverse order) is:
[    1.233999] 
[    1.233999] -> #3 (setup_lock){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999]        [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]        [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]        [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]        [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]        [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]        [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]        [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #2 (clocksource_mutex){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c105e21d>] clocksource_change_rating+0x1d/0x40
[    1.233999]        [<c100877c>] mark_tsc_unstable+0x4c/0x50
[    1.233999]        [<c15b18df>] check_tsc_sync_source+0x10f/0x120
[    1.233999]        [<c15b0b63>] native_cpu_up+0x423/0x800
[    1.233999]        [<c15b27c9>] _cpu_up+0x89/0x110
[    1.233999]        [<c15b28c9>] cpu_up+0x49/0x70
[    1.233999]        [<c18c598c>] kernel_init+0xcc/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #1 (cpu_hotplug.lock){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c103e70d>] cpu_hotplug_begin+0x1d/0x50
[    1.233999]        [<c15b279b>] _cpu_up+0x5b/0x110
[    1.233999]        [<c15b28c9>] cpu_up+0x49/0x70
[    1.233999]        [<c18c598c>] kernel_init+0xcc/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #0 (cpu_add_remove_lock){+.+.+.}:
[    1.233999]        [<c1068a55>] validate_chain+0x1115/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999]        [<c1050230>] __create_workqueue_key+0x100/0x1f0
[    1.233999]        [<c10788d2>] stop_machine_create+0x42/0xa0
[    1.233999]        [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]        [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]        [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]        [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]        [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]        [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]        [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] other info that might help us debug this:
[    1.233999] 
[    1.233999] 2 locks held by swapper/1:
[    1.233999]  #0:  (clocksource_mutex){+.+.+.}, at: [<c105e256>] clocksource_register+0x16/0x1e0
[    1.233999]  #1:  (setup_lock){+.+.+.}, at: [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999] 
[    1.233999] stack backtrace:
[    1.233999] Pid: 1, comm: swapper Not tainted 2.6.31-rc6-tip-01322-gd685ec8-dirty #7600
[    1.233999] Call Trace:
[    1.233999]  [<c10666fb>] print_circular_bug+0xbb/0xd0
[    1.233999]  [<c1068a55>] validate_chain+0x1115/0x1130
[    1.233999]  [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]  [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c15b53d8>] ? mutex_unlock+0x8/0x10
[    1.233999]  [<c10d566b>] ? pcpu_alloc+0x30b/0x400
[    1.233999]  [<c10d605b>] ? kmemleak_alloc+0x2b/0x60
[    1.233999]  [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c1050230>] __create_workqueue_key+0x100/0x1f0
[    1.233999]  [<c15b59e9>] ? mutex_lock_nested+0x29/0x40
[    1.233999]  [<c10788d2>] stop_machine_create+0x42/0xa0
[    1.233999]  [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]  [<c105c170>] ? change_clocksource+0x0/0x70
[    1.233999]  [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]  [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]  [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]  [<c11ee57e>] ? __const_udelay+0x2e/0x30
[    1.233999]  [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]  [<c105d16f>] ? ktime_get+0x5f/0x110
[    1.233999]  [<c1901ab0>] ? init_acpi_pm_clocksource+0x0/0x250
[    1.233999]  [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]  [<c1901ab0>] ? init_acpi_pm_clocksource+0x0/0x250
[    1.233999]  [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]  [<c18c58c0>] ? kernel_init+0x0/0x1a0
[    1.233999]  [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.234233] initcall init_acpi_pm_clocksource+0x0/0x250 returned 0 after 35202 usecs
[    1.234365] calling  ssb_modinit+0x0/0x60 @ 1
[    1.234455] Switched to high resolution mode on CPU 0

config and full bootlog attached.

	Ingo

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 69547 bytes --]

# head: d685ec87
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc6
# Fri Aug 21 22:10:11 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_KTIME_SCALAR=y
# 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 is not set
# CONFIG_BROKEN_BOOT_EUROPE is not set
# CONFIG_BROKEN_BOOT_TITAN is not set
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 is not set
CONFIG_KERNEL_BZIP2=y
# CONFIG_KERNEL_LZMA is not set
CONFIG_SWAP=y
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 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 is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# 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 is not set
# CONFIG_CGROUPS is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
# CONFIG_RELAY is not set
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
# CONFIG_EMBEDDED is not set
CONFIG_UID16=y
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=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
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 is not set
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=m
# CONFIG_OPROFILE_IBS is not set
# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set
CONFIG_HAVE_OPROFILE=y
CONFIG_KPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_KRETPROBES=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=y
# CONFIG_MODULE_FORCE_LOAD is not set
# CONFIG_MODULE_UNLOAD is not set
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_BLK_DEV_INTEGRITY=y

#
# 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_FREEZER=y

#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
# CONFIG_NO_HZ is not set
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_BIGSMP=y
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_RDC321X is not set
CONFIG_X86_32_NON_STANDARD=y
CONFIG_X86_NUMAQ=y
# CONFIG_X86_VISWS is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
CONFIG_PARAVIRT_GUEST=y
CONFIG_KVM_CLOCK=y
CONFIG_KVM_GUEST=y
# CONFIG_LGUEST_GUEST is not set
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_PARAVIRT_CLOCK=y
CONFIG_PARAVIRT_DEBUG=y
CONFIG_MEMTEST=y
CONFIG_X86_SUMMIT_NUMA=y
CONFIG_X86_CYCLONE_TIMER=y
# 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=y
# 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 is not set
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_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=4
CONFIG_X86_DEBUGCTLMSR=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=y
CONFIG_CPU_SUP_UMC_32=y
# CONFIG_X86_DS 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=32
# CONFIG_SCHED_SMT is not set
# CONFIG_SCHED_MC is not set
# 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 is not set
CONFIG_X86_MCE_AMD=y
# CONFIG_X86_ANCIENT_MCE is not set
CONFIG_X86_MCE_THRESHOLD=y
CONFIG_X86_MCE_INJECT=y
CONFIG_VM86=y
CONFIG_TOSHIBA=m
CONFIG_I8K=m
# CONFIG_X86_REBOOTFIXUPS is not set
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
# CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=y
# CONFIG_X86_CPUID is not set
CONFIG_X86_CPU_DEBUG=m
# CONFIG_UP_WANTED_1 is not set
CONFIG_SMP=y
# CONFIG_NOHIGHMEM is not set
# CONFIG_HIGHMEM4G is not set
CONFIG_HIGHMEM64G=y
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_HIGHMEM=y
CONFIG_X86_PAE=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_NUMA=y
CONFIG_NODES_SHIFT=4
CONFIG_HAVE_ARCH_BOOTMEM=y
CONFIG_ARCH_HAVE_MEMORY_PRESENT=y
CONFIG_NEED_NODE_MEMMAP_SIZE=y
CONFIG_HAVE_ARCH_ALLOC_REMAP=y
CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
CONFIG_ARCH_DISCONTIGMEM_DEFAULT=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 is not set
CONFIG_DISCONTIGMEM_MANUAL=y
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_DISCONTIGMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_NEED_MULTIPLE_NODES=y
CONFIG_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_STATIC=y
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_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_HIGHPTE=y
CONFIG_X86_CHECK_BIOS_CORRUPTION=y
CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y
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_EFI=y
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_X86_NEED_RELOCS=y
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_HOTPLUG_CPU=y
CONFIG_COMPAT_VDSO=y
# CONFIG_CMDLINE_BOOL is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
# CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID is not set

#
# Power management and ACPI options
#
CONFIG_PM=y
CONFIG_PM_DEBUG=y
CONFIG_PM_VERBOSE=y
CONFIG_CAN_PM_TRACE=y
CONFIG_PM_TRACE=y
CONFIG_PM_TRACE_RTC=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_SLEEP=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_PROCFS=y
# CONFIG_ACPI_PROCFS_POWER is not set
# CONFIG_ACPI_SYSFS_POWER is not set
# CONFIG_ACPI_PROC_EVENT is not set
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=m
# CONFIG_ACPI_BUTTON is not set
CONFIG_ACPI_FAN=m
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_PROCESSOR=m
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_THERMAL=m
CONFIG_ACPI_NUMA=y
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
CONFIG_ACPI_DEBUG=y
CONFIG_ACPI_DEBUG_FUNC_TRACE=y
CONFIG_ACPI_PCI_SLOT=y
CONFIG_X86_PM_TIMER=y
CONFIG_ACPI_CONTAINER=m
CONFIG_ACPI_SBS=y
CONFIG_X86_APM_BOOT=y
CONFIG_APM=y
CONFIG_APM_IGNORE_USER_SUSPEND=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_DISPLAY_BLANK=y
CONFIG_APM_ALLOW_INTS=y

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
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 is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=m
# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

#
# CPUFreq processor drivers
#
CONFIG_X86_ACPI_CPUFREQ=m
# CONFIG_X86_POWERNOW_K6 is not set
CONFIG_X86_POWERNOW_K7=m
CONFIG_X86_POWERNOW_K7_ACPI=y
CONFIG_X86_POWERNOW_K8=m
# CONFIG_X86_GX_SUSPMOD is not set
CONFIG_X86_SPEEDSTEP_CENTRINO=y
CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
# CONFIG_X86_SPEEDSTEP_ICH is not set
CONFIG_X86_SPEEDSTEP_SMI=m
# CONFIG_X86_P4_CLOCKMOD is not set
CONFIG_X86_CPUFREQ_NFORCE2=y
# CONFIG_X86_LONGRUN is not set
# CONFIG_X86_LONGHAUL is not set
CONFIG_X86_E_POWERSAVER=m

#
# shared options
#
CONFIG_X86_SPEEDSTEP_LIB=m
CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GOMMCONFIG is not set
CONFIG_PCI_GODIRECT=y
# CONFIG_PCI_GOOLPC is not set
# CONFIG_PCI_GOANY is not set
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_DOMAINS=y
# CONFIG_DMAR is not set
CONFIG_PCIEPORTBUS=y
CONFIG_PCIEAER=y
CONFIG_PCIE_ECRC=y
# CONFIG_PCIEAER_INJECT is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEBUG=y
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
CONFIG_PCI_LEGACY=y
CONFIG_PCI_DEBUG=y
CONFIG_PCI_STUB=y
# CONFIG_HT_IRQ is not set
CONFIG_PCI_IOV=y
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 is not set
CONFIG_SCx200=y
CONFIG_SCx200HR_TIMER=y
# CONFIG_OLPC is not set
CONFIG_PCCARD=m
# CONFIG_PCMCIA_DEBUG is not set
CONFIG_PCMCIA=m
CONFIG_PCMCIA_LOAD_CIS=y
# CONFIG_PCMCIA_IOCTL is not set
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=m
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
CONFIG_PD6729=m
CONFIG_I82092=m
# CONFIG_I82365 is not set
CONFIG_TCIC=m
CONFIG_PCMCIA_PROBE=y
CONFIG_PCCARD_NONSTATIC=m
# CONFIG_HOTPLUG_PCI is not set

#
# Executable file formats / Emulations
#
CONFIG_BINFMT_ELF=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_HAVE_AOUT=y
CONFIG_BINFMT_AOUT=m
CONFIG_BINFMT_MISC=y
CONFIG_HAVE_ATOMIC_IOMAP=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_MMAP=y
CONFIG_UNIX=y
CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
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=y
# CONFIG_ASK_IP_FIB_HASH is not set
CONFIG_IP_FIB_TRIE=y
# CONFIG_IP_FIB_HASH is not set
CONFIG_IP_FIB_TRIE_STATS=y
CONFIG_IP_MULTIPLE_TABLES=y
# CONFIG_IP_ROUTE_MULTIPATH is not set
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
# CONFIG_IP_MROUTE is not set
CONFIG_ARPD=y
CONFIG_SYN_COOKIES=y
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
CONFIG_INET_XFRM_MODE_BEET=y
CONFIG_INET_LRO=y
CONFIG_INET_DIAG=m
CONFIG_INET_TCP_DIAG=m
CONFIG_TCP_CONG_ADVANCED=y
# CONFIG_TCP_CONG_BIC is not set
CONFIG_TCP_CONG_CUBIC=m
# CONFIG_TCP_CONG_WESTWOOD is not set
CONFIG_TCP_CONG_HTCP=y
CONFIG_TCP_CONG_HSTCP=m
CONFIG_TCP_CONG_HYBLA=y
# CONFIG_TCP_CONG_VEGAS is not set
# CONFIG_TCP_CONG_SCALABLE is not set
CONFIG_TCP_CONG_LP=y
CONFIG_TCP_CONG_VENO=y
# CONFIG_TCP_CONG_YEAH is not set
# CONFIG_TCP_CONG_ILLINOIS is not set
# CONFIG_DEFAULT_BIC is not set
# CONFIG_DEFAULT_CUBIC is not set
CONFIG_DEFAULT_HTCP=y
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="htcp"
# CONFIG_TCP_MD5SIG is not set
CONFIG_IPV6=m
CONFIG_IPV6_PRIVACY=y
# CONFIG_IPV6_ROUTER_PREF is not set
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=m
CONFIG_INET6_ESP=m
CONFIG_INET6_IPCOMP=m
CONFIG_IPV6_MIP6=m
CONFIG_INET6_XFRM_TUNNEL=m
CONFIG_INET6_TUNNEL=m
# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
CONFIG_INET6_XFRM_MODE_TUNNEL=m
CONFIG_INET6_XFRM_MODE_BEET=m
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
# CONFIG_IPV6_SIT is not set
CONFIG_IPV6_TUNNEL=m
# CONFIG_IPV6_MULTIPLE_TABLES is not set
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_PIMSM_V2=y
# CONFIG_NETLABEL is not set
# CONFIG_NETWORK_SECMARK is not set
CONFIG_NETFILTER=y
CONFIG_NETFILTER_DEBUG=y
# CONFIG_NETFILTER_ADVANCED is not set

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_LOG=y
# CONFIG_NF_CONNTRACK is not set
CONFIG_NETFILTER_XTABLES=y
# CONFIG_NETFILTER_XT_TARGET_MARK is not set
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
# CONFIG_IP_VS is not set

#
# IP: Netfilter Configuration
#
# CONFIG_NF_DEFRAG_IPV4 is not set
# CONFIG_IP_NF_IPTABLES is not set

#
# IPv6: Netfilter Configuration
#
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
# CONFIG_IP6_NF_TARGET_LOG is not set
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_TARGET_REJECT=m
CONFIG_IP6_NF_MANGLE=m
CONFIG_IP_DCCP=y
CONFIG_INET_DCCP_DIAG=m

#
# DCCP CCIDs Configuration (EXPERIMENTAL)
#
CONFIG_IP_DCCP_CCID2_DEBUG=y
CONFIG_IP_DCCP_CCID3=y
CONFIG_IP_DCCP_CCID3_DEBUG=y
CONFIG_IP_DCCP_CCID3_RTO=100
CONFIG_IP_DCCP_TFRC_LIB=y
CONFIG_IP_DCCP_TFRC_DEBUG=y

#
# DCCP Kernel Hacking
#
CONFIG_IP_DCCP_DEBUG=y
# CONFIG_NET_DCCPPROBE is not set
CONFIG_IP_SCTP=m
# CONFIG_SCTP_DBG_MSG is not set
# CONFIG_SCTP_DBG_OBJCNT is not set
CONFIG_SCTP_HMAC_NONE=y
# CONFIG_SCTP_HMAC_SHA1 is not set
# CONFIG_SCTP_HMAC_MD5 is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
CONFIG_STP=m
CONFIG_GARP=m
CONFIG_BRIDGE=m
CONFIG_NET_DSA=y
CONFIG_NET_DSA_TAG_DSA=y
# CONFIG_NET_DSA_TAG_EDSA is not set
# 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 is not set
CONFIG_VLAN_8021Q=m
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_DECNET=m
CONFIG_DECNET_ROUTER=y
CONFIG_LLC=y
CONFIG_LLC2=y
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
CONFIG_X25=m
# CONFIG_LAPB is not set
CONFIG_ECONET=m
# CONFIG_ECONET_AUNUDP is not set
CONFIG_ECONET_NATIVE=y
CONFIG_WAN_ROUTER=y
CONFIG_PHONET=y
# CONFIG_IEEE802154 is not set
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
# CONFIG_NET_SCH_CBQ is not set
CONFIG_NET_SCH_HTB=y
# CONFIG_NET_SCH_HFSC is not set
CONFIG_NET_SCH_PRIO=m
CONFIG_NET_SCH_MULTIQ=y
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=y
CONFIG_NET_SCH_TEQL=y
CONFIG_NET_SCH_TBF=y
CONFIG_NET_SCH_GRED=m
# CONFIG_NET_SCH_DSMARK is not set
CONFIG_NET_SCH_NETEM=y
# CONFIG_NET_SCH_DRR is not set
# CONFIG_NET_SCH_INGRESS is not set

#
# Classification
#
CONFIG_NET_CLS=y
# CONFIG_NET_CLS_BASIC is not set
# CONFIG_NET_CLS_TCINDEX is not set
CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_ROUTE=y
CONFIG_NET_CLS_FW=m
# CONFIG_NET_CLS_U32 is not set
CONFIG_NET_CLS_RSVP=m
# CONFIG_NET_CLS_RSVP6 is not set
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_CMP=y
CONFIG_NET_EMATCH_NBYTE=m
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_EMATCH_META=m
CONFIG_NET_EMATCH_TEXT=m
CONFIG_NET_CLS_ACT=y
# CONFIG_NET_ACT_POLICE is not set
CONFIG_NET_ACT_GACT=y
CONFIG_GACT_PROB=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_NAT=m
CONFIG_NET_ACT_PEDIT=y
# CONFIG_NET_ACT_SIMP is not set
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_NET_CLS_IND=y
CONFIG_NET_SCH_FIFO=y
CONFIG_DCB=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
CONFIG_NET_TCPPROBE=m
CONFIG_NET_DROP_MONITOR=y
CONFIG_HAMRADIO=y

#
# Packet Radio protocols
#
CONFIG_AX25=m
CONFIG_AX25_DAMA_SLAVE=y
CONFIG_NETROM=m
CONFIG_ROSE=m

#
# AX.25 network device drivers
#
CONFIG_MKISS=m
# CONFIG_6PACK is not set
CONFIG_BPQETHER=m
CONFIG_SCC=m
CONFIG_SCC_DELAY=y
CONFIG_SCC_TRXECHO=y
CONFIG_BAYCOM_SER_FDX=m
CONFIG_BAYCOM_SER_HDX=m
CONFIG_YAM=m
# CONFIG_CAN is not set
CONFIG_IRDA=m

#
# IrDA protocols
#
CONFIG_IRLAN=m
CONFIG_IRNET=m
CONFIG_IRCOMM=m
# CONFIG_IRDA_ULTRA is not set

#
# 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=m

#
# Dongle support
#
CONFIG_DONGLE=y
CONFIG_ESI_DONGLE=m
# CONFIG_ACTISYS_DONGLE is not set
CONFIG_TEKRAM_DONGLE=m
CONFIG_TOIM3232_DONGLE=m
# CONFIG_LITELINK_DONGLE is not set
CONFIG_MA600_DONGLE=m
CONFIG_GIRBIL_DONGLE=m
CONFIG_MCP2120_DONGLE=m
CONFIG_OLD_BELKIN_DONGLE=m
CONFIG_ACT200L_DONGLE=m
# CONFIG_KINGSUN_DONGLE is not set
CONFIG_KSDAZZLE_DONGLE=m
CONFIG_KS959_DONGLE=m

#
# FIR device drivers
#
CONFIG_USB_IRDA=m
CONFIG_SIGMATEL_FIR=m
# CONFIG_NSC_FIR is not set
CONFIG_WINBOND_FIR=m
CONFIG_TOSHIBA_FIR=m
CONFIG_SMC_IRCC_FIR=m
# CONFIG_ALI_FIR is not set
CONFIG_VLSI_FIR=m
# CONFIG_VIA_FIR is not set
# CONFIG_MCS_FIR is not set
# CONFIG_BT is not set
CONFIG_AF_RXRPC=m
# CONFIG_AF_RXRPC_DEBUG is not set
CONFIG_RXKAD=m
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
CONFIG_CFG80211_REG_DEBUG=y
# CONFIG_CFG80211_DEBUGFS 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
# CONFIG_MAC80211 is not set
CONFIG_MAC80211_DEFAULT_PS_VALUE=0
CONFIG_WIMAX=m
CONFIG_WIMAX_DEBUG_LEVEL=8
# CONFIG_RFKILL is not set

#
# 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 is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
# CONFIG_PARPORT is not set
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_ISAPNP=y
CONFIG_PNPBIOS=y
CONFIG_PNPBIOS_PROC_FS=y
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_XD=m
CONFIG_BLK_CPQ_DA=y
CONFIG_BLK_CPQ_CISS_DA=m
# CONFIG_CISS_SCSI_TAPE is not set
# CONFIG_BLK_DEV_DAC960 is not set
CONFIG_BLK_DEV_UMEM=y
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_OSD=m
# CONFIG_BLK_DEV_SX8 is not set
# 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_BLK_DEV_HD=y
# CONFIG_MISC_DEVICES is not set
CONFIG_TIFM_CORE=m
CONFIG_CB710_CORE=m
CONFIG_HAVE_IDE=y

#
# SCSI device support
#
CONFIG_RAID_ATTRS=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
# CONFIG_SCSI_TGT is not set
# CONFIG_SCSI_NETLINK is not set
# CONFIG_SCSI_PROC_FS is not set

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
CONFIG_CHR_DEV_OSST=m
CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set
CONFIG_CHR_DEV_SG=y
CONFIG_CHR_DEV_SCH=m
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y
CONFIG_SCSI_WAIT_SCAN=m

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
# CONFIG_SCSI_FC_ATTRS is not set
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=m
CONFIG_SCSI_SAS_LIBSAS=m
CONFIG_SCSI_SAS_ATA=y
# CONFIG_SCSI_SAS_HOST_SMP is not set
CONFIG_SCSI_SAS_LIBSAS_DEBUG=y
CONFIG_SCSI_SRP_ATTRS=m
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_SCSI_AIC7XXX=y
CONFIG_SCSI_LOWLEVEL_PCMCIA=y
CONFIG_PCMCIA_AHA152X=m
CONFIG_PCMCIA_FDOMAIN=m
CONFIG_PCMCIA_NINJA_SCSI=m
CONFIG_PCMCIA_QLOGIC=m
# CONFIG_PCMCIA_SYM53C500 is not set
# CONFIG_SCSI_DH is not set
CONFIG_SCSI_OSD_INITIATOR=m
CONFIG_SCSI_OSD_ULD=m
CONFIG_SCSI_OSD_DPRINT_SENSE=1
CONFIG_SCSI_OSD_DEBUG=y
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
# CONFIG_ATA_ACPI is not set
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_SIL24=m
CONFIG_ATA_SFF=y
CONFIG_SATA_SVW=m
CONFIG_ATA_PIIX=y
# CONFIG_SATA_MV is not set
CONFIG_SATA_NV=y
CONFIG_PDC_ADMA=m
CONFIG_SATA_QSTOR=m
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SX4 is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_ULI is not set
CONFIG_SATA_VIA=m
CONFIG_SATA_VITESSE=m
CONFIG_SATA_INIC162X=m
# CONFIG_PATA_ALI is not set
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
CONFIG_PATA_ATIIXP=y
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_CMD64X is not set
CONFIG_PATA_CS5520=m
CONFIG_PATA_CS5530=y
CONFIG_PATA_CS5535=m
# CONFIG_PATA_CS5536 is not set
# CONFIG_PATA_CYPRESS is not set
CONFIG_PATA_EFAR=y
CONFIG_ATA_GENERIC=y
# CONFIG_PATA_HPT366 is not set
CONFIG_PATA_HPT37X=m
CONFIG_PATA_HPT3X2N=m
CONFIG_PATA_HPT3X3=y
# CONFIG_PATA_HPT3X3_DMA is not set
# CONFIG_PATA_ISAPNP is not set
# CONFIG_PATA_IT821X is not set
CONFIG_PATA_IT8213=m
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_LEGACY is not set
CONFIG_PATA_TRIFLEX=m
CONFIG_PATA_MARVELL=y
CONFIG_PATA_MPIIX=m
CONFIG_PATA_OLDPIIX=y
CONFIG_PATA_NETCELL=y
CONFIG_PATA_NINJA32=y
CONFIG_PATA_NS87410=y
# CONFIG_PATA_NS87415 is not set
# CONFIG_PATA_OPTI is not set
CONFIG_PATA_OPTIDMA=m
# CONFIG_PATA_PCMCIA is not set
CONFIG_PATA_PDC_OLD=y
CONFIG_PATA_QDI=y
CONFIG_PATA_RADISYS=m
CONFIG_PATA_RZ1000=m
# CONFIG_PATA_SC1200 is not set
CONFIG_PATA_SERVERWORKS=m
CONFIG_PATA_PDC2027X=m
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
CONFIG_PATA_VIA=y
CONFIG_PATA_WINBOND=m
# CONFIG_PATA_WINBOND_VLB is not set
CONFIG_PATA_SCH=y
CONFIG_MD=y
# CONFIG_BLK_DEV_MD is not set
CONFIG_BLK_DEV_DM=m
CONFIG_DM_DEBUG=y
# CONFIG_DM_CRYPT is not set
# CONFIG_DM_SNAPSHOT is not set
CONFIG_DM_MIRROR=m
# CONFIG_DM_LOG_USERSPACE is not set
CONFIG_DM_ZERO=m
# CONFIG_DM_MULTIPATH is not set
# CONFIG_DM_DELAY is not set
CONFIG_DM_UEVENT=y
# 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=m
CONFIG_FIREWIRE_OHCI=m
CONFIG_FIREWIRE_OHCI_DEBUG=y
CONFIG_FIREWIRE_SBP2=m
CONFIG_FIREWIRE_NET=m
# CONFIG_IEEE1394 is not set
CONFIG_I2O=y
CONFIG_I2O_LCT_NOTIFY_ON_CHANGES=y
CONFIG_I2O_EXT_ADAPTEC=y
CONFIG_I2O_EXT_ADAPTEC_DMA64=y
# CONFIG_I2O_CONFIG is not set
CONFIG_I2O_BUS=y
# CONFIG_I2O_BLOCK is not set
# CONFIG_I2O_SCSI is not set
CONFIG_I2O_PROC=y
CONFIG_MACINTOSH_DRIVERS=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_NETDEVICES=y
# CONFIG_IFB is not set
CONFIG_DUMMY=m
CONFIG_BONDING=m
# CONFIG_MACVLAN is not set
CONFIG_EQUALIZER=y
CONFIG_TUN=y
# CONFIG_VETH is not set
CONFIG_NET_SB1000=y
CONFIG_ARCNET=m
CONFIG_ARCNET_1201=m
# CONFIG_ARCNET_1051 is not set
CONFIG_ARCNET_RAW=m
CONFIG_ARCNET_CAP=m
# CONFIG_ARCNET_COM90xx is not set
CONFIG_ARCNET_COM90xxIO=m
# CONFIG_ARCNET_RIM_I is not set
CONFIG_ARCNET_COM20020=m
# CONFIG_ARCNET_COM20020_ISA is not set
CONFIG_ARCNET_COM20020_PCI=m
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=m
CONFIG_VITESSE_PHY=m
CONFIG_SMSC_PHY=y
CONFIG_BROADCOM_PHY=m
CONFIG_ICPLUS_PHY=y
CONFIG_REALTEK_PHY=m
CONFIG_NATIONAL_PHY=m
# CONFIG_STE10XP is not set
CONFIG_LSI_ET1011C_PHY=m
# CONFIG_FIXED_PHY is not set
CONFIG_MDIO_BITBANG=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_HAPPYMEAL=m
CONFIG_SUNGEM=y
CONFIG_CASSINI=m
CONFIG_NET_VENDOR_3COM=y
CONFIG_EL1=y
CONFIG_EL2=m
CONFIG_ELPLUS=m
# CONFIG_EL16 is not set
# CONFIG_EL3 is not set
CONFIG_3C515=m
CONFIG_VORTEX=y
CONFIG_TYPHOON=y
CONFIG_LANCE=m
CONFIG_NET_VENDOR_SMC=y
CONFIG_ULTRA=y
CONFIG_ULTRA32=m
CONFIG_SMC9194=y
# CONFIG_ETHOC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_DNET is not set
# CONFIG_NET_TULIP is not set
CONFIG_AT1700=m
# CONFIG_DEPCA is not set
# CONFIG_HP100 is not set
CONFIG_NET_ISA=y
# CONFIG_E2100 is not set
CONFIG_EWRK3=m
# CONFIG_EEXPRESS is not set
CONFIG_EEXPRESS_PRO=y
CONFIG_HPLAN=y
CONFIG_LP486E=y
CONFIG_ETH16I=y
CONFIG_NE2000=m
# CONFIG_ZNET is not set
CONFIG_SEEQ8005=m
# 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=m
# CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set
CONFIG_AC3200=m
# CONFIG_APRICOT is not set
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=m
CONFIG_E100=y
# CONFIG_LNE390 is not set
CONFIG_FEALNX=y
CONFIG_NATSEMI=y
CONFIG_NE2K_PCI=y
# CONFIG_NE3210 is not set
# CONFIG_ES3210 is not set
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=m
CONFIG_SIS900=y
# CONFIG_EPIC100 is not set
CONFIG_SMSC9420=y
# CONFIG_SUNDANCE is not set
CONFIG_TLAN=y
# CONFIG_KS8842 is not set
CONFIG_VIA_RHINE=m
# CONFIG_VIA_RHINE_MMIO is not set
CONFIG_SC92031=m
CONFIG_ATL2=m
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
CONFIG_ACENIC_OMIT_TIGON_I=y
CONFIG_DL2K=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_IP1000=y
# CONFIG_IGB is not set
CONFIG_IGBVF=m
CONFIG_NS83820=y
CONFIG_HAMACHI=m
# CONFIG_YELLOWFIN is not set
CONFIG_R8169=m
# CONFIG_R8169_VLAN is not set
CONFIG_SIS190=y
# CONFIG_SKGE is not set
CONFIG_SKY2=m
# CONFIG_SKY2_DEBUG is not set
CONFIG_VIA_VELOCITY=m
CONFIG_TIGON3=y
CONFIG_BNX2=y
# CONFIG_QLA3XXX is not set
CONFIG_ATL1=y
# CONFIG_ATL1E is not set
CONFIG_ATL1C=y
CONFIG_JME=y
# CONFIG_NETDEV_10000 is not set
# CONFIG_TR is not set

#
# Wireless LAN
#
# CONFIG_WLAN_PRE80211 is not set
CONFIG_WLAN_80211=y
# CONFIG_PCMCIA_RAYCS is not set
CONFIG_LIBERTAS=y
# CONFIG_LIBERTAS_USB is not set
CONFIG_LIBERTAS_CS=m
# CONFIG_LIBERTAS_SDIO is not set
# CONFIG_LIBERTAS_DEBUG is not set
# CONFIG_AIRO is not set
CONFIG_ATMEL=y
CONFIG_PCI_ATMEL=m
CONFIG_PCMCIA_ATMEL=m
CONFIG_AIRO_CS=m
CONFIG_PCMCIA_WL3501=m
CONFIG_PRISM54=y
# CONFIG_USB_ZD1201 is not set
CONFIG_USB_NET_RNDIS_WLAN=y
# CONFIG_IPW2100 is not set
# CONFIG_IPW2200 is not set
# CONFIG_HOSTAP is not set
# CONFIG_HERMES is not set
# CONFIG_IWM is not set

#
# WiMAX Wireless Broadband devices
#
CONFIG_WIMAX_I2400M=m
CONFIG_WIMAX_I2400M_SDIO=m
CONFIG_WIMAX_I2400M_DEBUG_LEVEL=8

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
CONFIG_USB_PEGASUS=m
CONFIG_USB_RTL8150=m
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=m
# CONFIG_USB_NET_DM9601 is not set
CONFIG_USB_NET_SMSC95XX=y
# CONFIG_USB_NET_GL620A is not set
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_PLUSB=y
# CONFIG_USB_NET_MCS7830 is not set
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET=m
# CONFIG_USB_ALI_M5632 is not set
CONFIG_USB_AN2720=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_ZAURUS=m
# CONFIG_USB_NET_INT51X1 is not set
CONFIG_USB_CDC_PHONET=y
# CONFIG_NET_PCMCIA is not set
CONFIG_WAN=y
# CONFIG_HDLC is not set
# CONFIG_DLCI is not set
CONFIG_WAN_ROUTER_DRIVERS=m
CONFIG_CYCLADES_SYNC=m
CONFIG_CYCLOMX_X25=y
CONFIG_SBNI=m
CONFIG_SBNI_MULTILINE=y
CONFIG_FDDI=m
CONFIG_DEFXX=m
# CONFIG_DEFXX_MMIO is not set
# CONFIG_SKFP is not set
# CONFIG_HIPPI is not set
CONFIG_PPP=m
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
CONFIG_PPP_DEFLATE=m
# CONFIG_PPP_BSDCOMP is not set
CONFIG_PPP_MPPE=m
# CONFIG_PPPOE is not set
# CONFIG_PPPOL2TP is not set
CONFIG_SLIP=m
# CONFIG_SLIP_COMPRESSED is not set
CONFIG_SLHC=m
CONFIG_SLIP_SMART=y
# CONFIG_SLIP_MODE_SLIP6 is not set
CONFIG_NET_FC=y
CONFIG_NETCONSOLE=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_NETPOLL=y
# CONFIG_NETPOLL_TRAP is not set
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_ISDN=y
CONFIG_ISDN_I4L=m
CONFIG_ISDN_PPP=y
# CONFIG_ISDN_PPP_VJ is not set
CONFIG_ISDN_MPP=y
CONFIG_IPPP_FILTER=y
CONFIG_ISDN_PPP_BSDCOMP=m
CONFIG_ISDN_AUDIO=y
CONFIG_ISDN_TTY_FAX=y
CONFIG_ISDN_X25=y

#
# ISDN feature submodules
#
CONFIG_ISDN_DIVERSION=m

#
# ISDN4Linux hardware drivers
#

#
# Passive cards
#
# CONFIG_ISDN_DRV_HISAX is not set

#
# Active cards
#
# CONFIG_ISDN_DRV_PCBIT is not set
CONFIG_ISDN_DRV_SC=m
CONFIG_ISDN_DRV_ACT2000=m
CONFIG_HYSDN=m
CONFIG_HYSDN_CAPI=y
CONFIG_ISDN_CAPI=y
# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set
CONFIG_CAPI_TRACE=y
# CONFIG_ISDN_CAPI_MIDDLEWARE is not set
CONFIG_ISDN_CAPI_CAPI20=y
CONFIG_ISDN_CAPI_CAPIDRV=m

#
# CAPI hardware drivers
#
CONFIG_CAPI_AVM=y
CONFIG_ISDN_DRV_AVMB1_B1ISA=y
# CONFIG_ISDN_DRV_AVMB1_B1PCI is not set
CONFIG_ISDN_DRV_AVMB1_T1ISA=m
CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
# CONFIG_ISDN_DRV_AVMB1_AVM_CS is not set
# CONFIG_ISDN_DRV_AVMB1_T1PCI is not set
CONFIG_ISDN_DRV_AVMB1_C4=y
CONFIG_CAPI_EICON=y
# CONFIG_ISDN_DIVAS is not set
CONFIG_ISDN_DRV_GIGASET=m
# CONFIG_GIGASET_BASE is not set
CONFIG_GIGASET_M105=m
CONFIG_GIGASET_M101=m
CONFIG_GIGASET_DEBUG=y
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=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV=m
CONFIG_INPUT_EVBUG=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
CONFIG_KEYBOARD_LKKBD=y
CONFIG_KEYBOARD_LM8323=m
CONFIG_KEYBOARD_NEWTON=y
CONFIG_KEYBOARD_STOWAWAY=m
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
CONFIG_JOYSTICK_A3D=y
CONFIG_JOYSTICK_ADI=y
CONFIG_JOYSTICK_COBRA=m
CONFIG_JOYSTICK_GF2K=m
CONFIG_JOYSTICK_GRIP=y
# CONFIG_JOYSTICK_GRIP_MP is not set
CONFIG_JOYSTICK_GUILLEMOT=m
# CONFIG_JOYSTICK_INTERACT is not set
CONFIG_JOYSTICK_SIDEWINDER=m
CONFIG_JOYSTICK_TMDC=m
CONFIG_JOYSTICK_IFORCE=y
CONFIG_JOYSTICK_IFORCE_USB=y
CONFIG_JOYSTICK_IFORCE_232=y
CONFIG_JOYSTICK_WARRIOR=m
CONFIG_JOYSTICK_MAGELLAN=m
CONFIG_JOYSTICK_SPACEORB=y
CONFIG_JOYSTICK_SPACEBALL=y
# CONFIG_JOYSTICK_STINGER is not set
CONFIG_JOYSTICK_TWIDJOY=y
# CONFIG_JOYSTICK_ZHENHUA is not set
CONFIG_JOYSTICK_JOYDUMP=m
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=m
CONFIG_TABLET_USB_GTCO=y
CONFIG_TABLET_USB_KBTAB=y
# CONFIG_TABLET_USB_WACOM is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
CONFIG_TOUCHSCREEN_EETI=m
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GUNZE is not set
CONFIG_TOUCHSCREEN_ELO=m
# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
CONFIG_TOUCHSCREEN_INEXIO=m
# CONFIG_TOUCHSCREEN_MK712 is not set
CONFIG_TOUCHSCREEN_HTCPEN=m
CONFIG_TOUCHSCREEN_PENMOUNT=m
CONFIG_TOUCHSCREEN_TOUCHRIGHT=y
CONFIG_TOUCHSCREEN_TOUCHWIN=m
CONFIG_TOUCHSCREEN_WM97XX=m
CONFIG_TOUCHSCREEN_WM9705=y
CONFIG_TOUCHSCREEN_WM9712=y
CONFIG_TOUCHSCREEN_WM9713=y
# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
CONFIG_TOUCHSCREEN_TSC2007=m
# CONFIG_TOUCHSCREEN_W90X900 is not set
# CONFIG_INPUT_MISC is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_CT82C710=y
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
CONFIG_GAMEPORT=y
CONFIG_GAMEPORT_NS558=y
CONFIG_GAMEPORT_L4=m
# CONFIG_GAMEPORT_EMU10K1 is not set
# 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=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_COMPUTONE is not set
# CONFIG_ROCKETPORT is not set
CONFIG_CYCLADES=y
CONFIG_CYZ_INTR=y
CONFIG_DIGIEPCA=y
# CONFIG_MOXA_INTELLIO is not set
CONFIG_MOXA_SMARTIO=m
CONFIG_ISI=m
CONFIG_SYNCLINK=m
# CONFIG_SYNCLINKMP is not set
# CONFIG_SYNCLINK_GT is not set
CONFIG_N_HDLC=y
CONFIG_RISCOM8=y
# CONFIG_SPECIALIX is not set
# CONFIG_SX is not set
CONFIG_RIO=y
CONFIG_RIO_OLDPCI=y
# CONFIG_STALDRV 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_PNP=y
# CONFIG_SERIAL_8250_CS is not set
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_FOURPORT=y
# CONFIG_SERIAL_8250_ACCENT is not set
CONFIG_SERIAL_8250_BOCA=y
# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set
CONFIG_SERIAL_8250_HUB6=y
# CONFIG_SERIAL_8250_SHARE_IRQ is not set
CONFIG_SERIAL_8250_DETECT_IRQ=y
# CONFIG_SERIAL_8250_RSA is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=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_IPMI_HANDLER=y
# CONFIG_IPMI_PANIC_EVENT is not set
CONFIG_IPMI_DEVICE_INTERFACE=y
CONFIG_IPMI_SI=y
# CONFIG_IPMI_WATCHDOG is not set
CONFIG_IPMI_POWEROFF=m
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_TIMERIOMEM=m
# CONFIG_HW_RANDOM_INTEL is not set
CONFIG_HW_RANDOM_AMD=m
# CONFIG_HW_RANDOM_GEODE is not set
# CONFIG_HW_RANDOM_VIA is not set
CONFIG_NVRAM=y
CONFIG_DTLK=m
CONFIG_R3964=y
CONFIG_APPLICOM=m
# CONFIG_SONYPI is not set

#
# PCMCIA character devices
#
# CONFIG_SYNCLINK_CS is not set
CONFIG_CARDMAN_4000=m
CONFIG_CARDMAN_4040=m
CONFIG_IPWIRELESS=m
CONFIG_MWAVE=y
CONFIG_SCx200_GPIO=y
CONFIG_PC8736x_GPIO=m
CONFIG_NSC_GPIO=y
CONFIG_CS5535_GPIO=y
# CONFIG_RAW_DRIVER is not set
# CONFIG_HPET is not set
CONFIG_HANGCHECK_TIMER=y
CONFIG_TCG_TPM=m
CONFIG_TCG_TIS=m
CONFIG_TCG_NSC=m
CONFIG_TCG_ATMEL=m
# CONFIG_TCG_INFINEON is not set
CONFIG_TELCLOCK=m
CONFIG_DEVPORT=y
CONFIG_I2C=m
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=m
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_ALGOBIT=m
CONFIG_I2C_ALGOPCA=m

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
CONFIG_I2C_ALI1563=m
CONFIG_I2C_ALI15X3=m
CONFIG_I2C_AMD756=m
# CONFIG_I2C_AMD8111 is not set
# CONFIG_I2C_I801 is not set
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_PIIX4 is not set
CONFIG_I2C_NFORCE2=m
# CONFIG_I2C_SIS5595 is not set
CONFIG_I2C_SIS630=m
CONFIG_I2C_SIS96X=m
CONFIG_I2C_VIA=m
CONFIG_I2C_VIAPRO=m

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_OCORES is not set
CONFIG_I2C_SIMTEC=m

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_PARPORT_LIGHT=m
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_TINY_USB is not set

#
# Graphics adapter I2C/DDC channel drivers
#
CONFIG_I2C_VOODOO3=m

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_PCA_PLATFORM=m
CONFIG_I2C_STUB=m
CONFIG_SCx200_I2C=m
CONFIG_SCx200_I2C_SCL=12
CONFIG_SCx200_I2C_SDA=13
CONFIG_SCx200_ACB=m

#
# Miscellaneous I2C Chip support
#
# CONFIG_DS1682 is not set
# CONFIG_SENSORS_PCF8574 is not set
CONFIG_PCF8575=m
CONFIG_SENSORS_PCA9539=m
CONFIG_SENSORS_TSL2550=m
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_DEBUG_ALGO=y
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

#
# 1-wire Bus Masters
#
CONFIG_W1_MASTER_MATROX=m
# CONFIG_W1_MASTER_DS2490 is not set
CONFIG_W1_MASTER_DS2482=m

#
# 1-wire Slaves
#
CONFIG_W1_SLAVE_THERM=m
CONFIG_W1_SLAVE_SMEM=y
CONFIG_W1_SLAVE_DS2431=y
CONFIG_W1_SLAVE_DS2433=m
# CONFIG_W1_SLAVE_DS2433_CRC is not set
CONFIG_W1_SLAVE_DS2760=y
CONFIG_W1_SLAVE_BQ27000=m
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
CONFIG_PDA_POWER=m
CONFIG_BATTERY_DS2760=y
CONFIG_BATTERY_DS2782=m
CONFIG_BATTERY_BQ27x00=m
CONFIG_BATTERY_MAX17040=m
CONFIG_CHARGER_PCF50633=m
CONFIG_HWMON=y
CONFIG_HWMON_VID=y
CONFIG_SENSORS_ABITUGURU=m
# CONFIG_SENSORS_ABITUGURU3 is not set
CONFIG_SENSORS_AD7414=m
CONFIG_SENSORS_AD7418=m
CONFIG_SENSORS_ADM1021=m
CONFIG_SENSORS_ADM1025=m
CONFIG_SENSORS_ADM1026=m
# CONFIG_SENSORS_ADM1029 is not set
CONFIG_SENSORS_ADM1031=m
CONFIG_SENSORS_ADM9240=m
# CONFIG_SENSORS_ADT7462 is not set
# CONFIG_SENSORS_ADT7470 is not set
# CONFIG_SENSORS_ADT7473 is not set
CONFIG_SENSORS_ADT7475=m
CONFIG_SENSORS_K8TEMP=y
CONFIG_SENSORS_ASB100=m
CONFIG_SENSORS_ATK0110=m
CONFIG_SENSORS_ATXP1=m
CONFIG_SENSORS_DS1621=m
# CONFIG_SENSORS_I5K_AMB is not set
CONFIG_SENSORS_F71805F=y
CONFIG_SENSORS_F71882FG=y
CONFIG_SENSORS_F75375S=m
CONFIG_SENSORS_FSCHER=m
CONFIG_SENSORS_FSCPOS=m
CONFIG_SENSORS_FSCHMD=m
CONFIG_SENSORS_G760A=m
# CONFIG_SENSORS_GL518SM is not set
CONFIG_SENSORS_GL520SM=m
CONFIG_SENSORS_CORETEMP=m
CONFIG_SENSORS_IBMAEM=y
CONFIG_SENSORS_IBMPEX=m
CONFIG_SENSORS_IT87=y
CONFIG_SENSORS_LM63=m
CONFIG_SENSORS_LM75=m
CONFIG_SENSORS_LM77=m
CONFIG_SENSORS_LM78=m
# CONFIG_SENSORS_LM80 is not set
CONFIG_SENSORS_LM83=m
# CONFIG_SENSORS_LM85 is not set
CONFIG_SENSORS_LM87=m
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_LM92=m
CONFIG_SENSORS_LM93=m
CONFIG_SENSORS_LTC4215=m
CONFIG_SENSORS_LTC4245=m
# CONFIG_SENSORS_LM95241 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX6650 is not set
CONFIG_SENSORS_PC87360=m
CONFIG_SENSORS_PC87427=m
# CONFIG_SENSORS_PCF8591 is not set
CONFIG_SENSORS_SIS5595=m
# CONFIG_SENSORS_DME1737 is not set
CONFIG_SENSORS_SMSC47M1=m
# CONFIG_SENSORS_SMSC47M192 is not set
CONFIG_SENSORS_SMSC47B397=y
CONFIG_SENSORS_ADS7828=m
CONFIG_SENSORS_THMC50=m
CONFIG_SENSORS_TMP401=m
# CONFIG_SENSORS_VIA686A is not set
CONFIG_SENSORS_VT1211=y
CONFIG_SENSORS_VT8231=y
CONFIG_SENSORS_W83781D=m
CONFIG_SENSORS_W83791D=m
CONFIG_SENSORS_W83792D=m
CONFIG_SENSORS_W83793=m
# CONFIG_SENSORS_W83L785TS is not set
CONFIG_SENSORS_W83L786NG=m
CONFIG_SENSORS_W83627HF=y
CONFIG_SENSORS_W83627EHF=y
CONFIG_SENSORS_HDAPS=y
CONFIG_SENSORS_LIS3LV02D=y
# CONFIG_SENSORS_APPLESMC is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
CONFIG_THERMAL=m
# CONFIG_THERMAL_HWMON is not set
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_NOWAYOUT=y

#
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=m
CONFIG_ACQUIRE_WDT=m
CONFIG_ADVANTECH_WDT=y
CONFIG_ALIM1535_WDT=m
CONFIG_ALIM7101_WDT=y
CONFIG_SC520_WDT=y
# CONFIG_IB700_WDT is not set
CONFIG_IBMASR=y
CONFIG_WAFER_WDT=y
CONFIG_I6300ESB_WDT=m
CONFIG_ITCO_WDT=m
# CONFIG_ITCO_VENDOR_SUPPORT is not set
CONFIG_IT8712F_WDT=m
CONFIG_IT87_WDT=m
CONFIG_HP_WATCHDOG=m
# CONFIG_SC1200_WDT is not set
CONFIG_SCx200_WDT=m
CONFIG_PC87413_WDT=y
CONFIG_60XX_WDT=y
CONFIG_SBC8360_WDT=m
CONFIG_SBC7240_WDT=m
CONFIG_CPU5_WDT=m
# CONFIG_SMSC_SCH311X_WDT is not set
CONFIG_SMSC37B787_WDT=y
CONFIG_W83627HF_WDT=y
CONFIG_W83697HF_WDT=m
# CONFIG_W83697UG_WDT is not set
CONFIG_W83877F_WDT=m
# CONFIG_W83977F_WDT is not set
CONFIG_MACHZ_WDT=y
CONFIG_SBC_EPX_C3_WATCHDOG=y

#
# ISA-based Watchdog Cards
#
CONFIG_PCWATCHDOG=y
CONFIG_MIXCOMWD=y

#
# PCI-based Watchdog Cards
#
CONFIG_PCIPCWATCHDOG=y
CONFIG_WDTPCI=m

#
# 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 is not set
CONFIG_SSB_DEBUG=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=y
# CONFIG_MFD_TMIO is not set
CONFIG_MFD_WM8400=m
CONFIG_MFD_PCF50633=m
# CONFIG_PCF50633_ADC is not set
CONFIG_PCF50633_GPIO=m
# CONFIG_AB3100_CORE is not set
CONFIG_REGULATOR=y
CONFIG_REGULATOR_DEBUG=y
# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
CONFIG_REGULATOR_USERSPACE_CONSUMER=y
CONFIG_REGULATOR_BQ24022=y
# CONFIG_REGULATOR_MAX1586 is not set
CONFIG_REGULATOR_WM8400=m
# CONFIG_REGULATOR_PCF50633 is not set
CONFIG_REGULATOR_LP3971=m
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
# CONFIG_AGP is not set
# CONFIG_DRM is not set
CONFIG_VGASTATE=m
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
CONFIG_FB=m
CONFIG_FIRMWARE_EDID=y
CONFIG_FB_DDC=m
# CONFIG_FB_BOOT_VESA_SUPPORT is not set
CONFIG_FB_CFB_FILLRECT=m
CONFIG_FB_CFB_COPYAREA=m
CONFIG_FB_CFB_IMAGEBLIT=m
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=m
CONFIG_FB_SYS_COPYAREA=m
CONFIG_FB_SYS_IMAGEBLIT=m
CONFIG_FB_FOREIGN_ENDIAN=y
CONFIG_FB_BOTH_ENDIAN=y
# CONFIG_FB_BIG_ENDIAN is not set
# CONFIG_FB_LITTLE_ENDIAN is not set
CONFIG_FB_SYS_FOPS=m
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_SVGALIB=m
# 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=m
CONFIG_FB_PM2_FIFO_DISCONNECT=y
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_N411 is not set
CONFIG_FB_HGA=m
# CONFIG_FB_HGA_ACCEL is not set
CONFIG_FB_S1D13XXX=m
CONFIG_FB_NVIDIA=m
# CONFIG_FB_NVIDIA_I2C is not set
CONFIG_FB_NVIDIA_DEBUG=y
CONFIG_FB_NVIDIA_BACKLIGHT=y
# CONFIG_FB_RIVA is not set
CONFIG_FB_LE80578=m
CONFIG_FB_CARILLO_RANCH=m
CONFIG_FB_MATROX=m
# CONFIG_FB_MATROX_MILLENIUM is not set
# CONFIG_FB_MATROX_MYSTIQUE is not set
CONFIG_FB_MATROX_G=y
CONFIG_FB_MATROX_I2C=m
CONFIG_FB_MATROX_MAVEN=m
CONFIG_FB_MATROX_MULTIHEAD=y
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
CONFIG_FB_S3=m
CONFIG_FB_SAVAGE=m
# CONFIG_FB_SAVAGE_I2C is not set
CONFIG_FB_SAVAGE_ACCEL=y
# CONFIG_FB_SIS is not set
CONFIG_FB_VIA=m
CONFIG_FB_NEOMAGIC=m
# CONFIG_FB_KYRO is not set
CONFIG_FB_3DFX=m
CONFIG_FB_3DFX_ACCEL=y
CONFIG_FB_3DFX_I2C=y
# CONFIG_FB_VOODOO1 is not set
CONFIG_FB_VT8623=m
CONFIG_FB_TRIDENT=m
CONFIG_FB_ARK=m
CONFIG_FB_PM3=m
CONFIG_FB_CARMINE=m
CONFIG_FB_CARMINE_DRAM_EVAL=y
# CONFIG_CARMINE_DRAM_CUSTOM is not set
# CONFIG_FB_GEODE is not set
CONFIG_FB_TMIO=m
CONFIG_FB_TMIO_ACCELL=y
CONFIG_FB_SM501=m
CONFIG_FB_METRONOME=m
# CONFIG_FB_MB862XX is not set
CONFIG_FB_BROADSHEET=m
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=m
# CONFIG_BACKLIGHT_PROGEAR is not set
CONFIG_BACKLIGHT_MBP_NVIDIA=m
# CONFIG_BACKLIGHT_SAHARA 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=y
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
CONFIG_DUMMY_CONSOLE=y
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
CONFIG_LOGO_LINUX_VGA16=y
# CONFIG_LOGO_LINUX_CLUT224 is not set
CONFIG_SOUND=m
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=m
CONFIG_SND_SEQ_DUMMY=m
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
# CONFIG_SND_PCM_OSS is not set
# CONFIG_SND_SEQUENCER_OSS is not set
CONFIG_SND_HRTIMER=m
# CONFIG_SND_SEQ_HRTIMER_DEFAULT is not set
CONFIG_SND_DYNAMIC_MINORS=y
# CONFIG_SND_SUPPORT_OLD_API is not set
# CONFIG_SND_VERBOSE_PROCFS is not set
CONFIG_SND_VERBOSE_PRINTK=y
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_VERBOSE=y
CONFIG_SND_VMASTER=y
CONFIG_SND_RAWMIDI_SEQ=m
CONFIG_SND_OPL3_LIB_SEQ=m
CONFIG_SND_OPL4_LIB_SEQ=m
CONFIG_SND_SBAWE_SEQ=m
# CONFIG_SND_EMU10K1_SEQ is not set
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_OPL4_LIB=m
CONFIG_SND_VX_LIB=m
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_DRIVERS=y
CONFIG_SND_PCSP=m
CONFIG_SND_DUMMY=m
CONFIG_SND_VIRMIDI=m
# CONFIG_SND_SERIAL_U16550 is not set
CONFIG_SND_MPU401=m
# CONFIG_SND_AC97_POWER_SAVE is not set
CONFIG_SND_WSS_LIB=m
CONFIG_SND_SB_COMMON=m
CONFIG_SND_SB8_DSP=m
CONFIG_SND_SB16_DSP=m
CONFIG_SND_ISA=y
# CONFIG_SND_ADLIB is not set
CONFIG_SND_AD1816A=m
CONFIG_SND_AD1848=m
# CONFIG_SND_ALS100 is not set
CONFIG_SND_AZT2320=m
# CONFIG_SND_CMI8330 is not set
# CONFIG_SND_CS4231 is not set
CONFIG_SND_CS4236=m
# CONFIG_SND_DT019X is not set
CONFIG_SND_ES968=m
CONFIG_SND_ES1688=m
# CONFIG_SND_ES18XX is not set
CONFIG_SND_SC6000=m
# CONFIG_SND_GUSCLASSIC is not set
CONFIG_SND_GUSEXTREME=m
# CONFIG_SND_GUSMAX is not set
CONFIG_SND_INTERWAVE=m
CONFIG_SND_INTERWAVE_STB=m
# CONFIG_SND_OPL3SA2 is not set
CONFIG_SND_OPTI92X_AD1848=m
# CONFIG_SND_OPTI92X_CS4231 is not set
CONFIG_SND_OPTI93X=m
CONFIG_SND_MIRO=m
# CONFIG_SND_SB8 is not set
# CONFIG_SND_SB16 is not set
CONFIG_SND_SBAWE=m
CONFIG_SND_SB16_CSP=y
# CONFIG_SND_SGALAXY is not set
CONFIG_SND_SSCAPE=m
CONFIG_SND_WAVEFRONT=m
CONFIG_SND_MSND_PINNACLE=m
CONFIG_SND_MSND_CLASSIC=m
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
CONFIG_SND_ALS300=m
CONFIG_SND_ALS4000=m
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ATIIXP is not set
CONFIG_SND_ATIIXP_MODEM=m
CONFIG_SND_AU8810=m
# CONFIG_SND_AU8820 is not set
CONFIG_SND_AU8830=m
CONFIG_SND_AW2=m
CONFIG_SND_AZT3328=m
CONFIG_SND_BT87X=m
CONFIG_SND_BT87X_OVERCLOCK=y
CONFIG_SND_CA0106=m
CONFIG_SND_CMIPCI=m
CONFIG_SND_OXYGEN_LIB=m
CONFIG_SND_OXYGEN=m
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CS5530 is not set
CONFIG_SND_CS5535AUDIO=m
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
CONFIG_SND_GINA20=m
# CONFIG_SND_LAYLA20 is not set
CONFIG_SND_DARLA24=m
CONFIG_SND_GINA24=m
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
CONFIG_SND_MIA=m
CONFIG_SND_ECHO3G=m
# CONFIG_SND_INDIGO is not set
CONFIG_SND_INDIGOIO=m
CONFIG_SND_INDIGODJ=m
CONFIG_SND_INDIGOIOX=m
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
CONFIG_SND_EMU10K1X=m
CONFIG_SND_ENS1370=m
CONFIG_SND_ENS1371=m
CONFIG_SND_ES1938=m
CONFIG_SND_ES1968=m
CONFIG_SND_FM801=m
CONFIG_SND_HDA_INTEL=m
# CONFIG_SND_HDA_HWDEP is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
CONFIG_SND_HDA_INPUT_JACK=y
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
# CONFIG_SND_HDA_CODEC_SIGMATEL is not set
# CONFIG_SND_HDA_CODEC_VIA is not set
CONFIG_SND_HDA_CODEC_ATIHDMI=y
# CONFIG_SND_HDA_CODEC_NVHDMI is not set
CONFIG_SND_HDA_CODEC_INTELHDMI=y
CONFIG_SND_HDA_ELD=y
# CONFIG_SND_HDA_CODEC_CONEXANT is not set
CONFIG_SND_HDA_CODEC_CA0110=y
# CONFIG_SND_HDA_CODEC_CMEDIA is not set
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
CONFIG_SND_HDSP=m
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_HIFIER is not set
# CONFIG_SND_ICE1712 is not set
CONFIG_SND_ICE1724=m
CONFIG_SND_INTEL8X0=m
CONFIG_SND_INTEL8X0M=m
CONFIG_SND_KORG1212=m
CONFIG_SND_LX6464ES=m
# CONFIG_SND_MAESTRO3 is not set
CONFIG_SND_MIXART=m
CONFIG_SND_NM256=m
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
CONFIG_SND_RME32=m
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SIS7019 is not set
CONFIG_SND_SONICVIBES=m
CONFIG_SND_TRIDENT=m
CONFIG_SND_VIA82XX=m
CONFIG_SND_VIA82XX_MODEM=m
CONFIG_SND_VIRTUOSO=m
CONFIG_SND_VX222=m
CONFIG_SND_YMFPCI=m
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
CONFIG_SND_USB_USX2Y=m
# CONFIG_SND_USB_CAIAQ is not set
# CONFIG_SND_USB_US122L is not set
CONFIG_SND_PCMCIA=y
CONFIG_SND_VXPOCKET=m
CONFIG_SND_PDAUDIOCF=m
# CONFIG_SND_SOC is not set
CONFIG_SOUND_PRIME=m
CONFIG_SOUND_MSNDCLAS=m
CONFIG_MSNDCLAS_INIT_FILE="/etc/sound/msndinit.bin"
CONFIG_MSNDCLAS_PERM_FILE="/etc/sound/msndperm.bin"
CONFIG_SOUND_MSNDPIN=m
CONFIG_MSNDPIN_INIT_FILE="/etc/sound/pndspini.bin"
CONFIG_MSNDPIN_PERM_FILE="/etc/sound/pndsperm.bin"
# CONFIG_SOUND_OSS is not set
CONFIG_AC97_BUS=m
CONFIG_HID_SUPPORT=y
CONFIG_HID=m
# CONFIG_HID_DEBUG is not set
CONFIG_HIDRAW=y

#
# USB Input Devices
#
CONFIG_USB_HID=m
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
CONFIG_USB_MOUSE=y

#
# Special HID drivers
#
CONFIG_HID_A4TECH=m
CONFIG_HID_APPLE=m
CONFIG_HID_BELKIN=m
CONFIG_HID_CHERRY=m
CONFIG_HID_CHICONY=m
CONFIG_HID_CYPRESS=m
CONFIG_HID_DRAGONRISE=m
CONFIG_DRAGONRISE_FF=y
CONFIG_HID_EZKEY=m
CONFIG_HID_KYE=m
CONFIG_HID_GYRATION=m
CONFIG_HID_KENSINGTON=m
CONFIG_HID_LOGITECH=m
CONFIG_LOGITECH_FF=y
CONFIG_LOGIRUMBLEPAD2_FF=y
CONFIG_HID_MICROSOFT=m
CONFIG_HID_MONTEREY=m
CONFIG_HID_NTRIG=m
CONFIG_HID_PANTHERLORD=m
CONFIG_PANTHERLORD_FF=y
CONFIG_HID_PETALYNX=m
CONFIG_HID_SAMSUNG=m
CONFIG_HID_SONY=m
CONFIG_HID_SUNPLUS=m
CONFIG_HID_GREENASIA=m
CONFIG_GREENASIA_FF=y
CONFIG_HID_SMARTJOYPLUS=m
CONFIG_SMARTJOYPLUS_FF=y
CONFIG_HID_TOPSEED=m
CONFIG_HID_THRUSTMASTER=m
CONFIG_THRUSTMASTER_FF=y
CONFIG_HID_ZEROPLUS=m
# CONFIG_ZEROPLUS_FF 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=y
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_USB_SUSPEND=y
# CONFIG_USB_OTG is not set
CONFIG_USB_MON=m
CONFIG_USB_WUSB=y
# CONFIG_USB_WUSB_CBAF is not set

#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_HCD_DEBUGGING=y
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
CONFIG_USB_EHCI_TT_NEWSCHED=y
# CONFIG_USB_OXU210HP_HCD is not set
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_ISP1760_HCD=m
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_U132_HCD=m
# CONFIG_USB_SL811_HCD is not set
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_HWA_HCD=y

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=m
# CONFIG_USB_WDM is not set
CONFIG_USB_TMC=m

#
# 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 is not set

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
# CONFIG_USB_MICROTEK is not set

#
# USB port drivers
#
CONFIG_USB_SERIAL=m
CONFIG_USB_EZUSB=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_AIRCABLE=m
CONFIG_USB_SERIAL_ARK3116=m
# CONFIG_USB_SERIAL_BELKIN is not set
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_WHITEHEAT=m
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
CONFIG_USB_SERIAL_CP210X=m
# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
CONFIG_USB_SERIAL_EMPEG=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_FUNSOFT=m
# CONFIG_USB_SERIAL_VISOR is not set
CONFIG_USB_SERIAL_IPAQ=m
CONFIG_USB_SERIAL_IR=m
# CONFIG_USB_SERIAL_EDGEPORT is not set
CONFIG_USB_SERIAL_EDGEPORT_TI=m
CONFIG_USB_SERIAL_GARMIN=m
CONFIG_USB_SERIAL_IPW=m
CONFIG_USB_SERIAL_IUU=m
CONFIG_USB_SERIAL_KEYSPAN_PDA=m
CONFIG_USB_SERIAL_KEYSPAN=m
CONFIG_USB_SERIAL_KLSI=m
CONFIG_USB_SERIAL_KOBIL_SCT=m
CONFIG_USB_SERIAL_MCT_U232=m
CONFIG_USB_SERIAL_MOS7720=m
# CONFIG_USB_SERIAL_MOS7840 is not set
CONFIG_USB_SERIAL_MOTOROLA=m
CONFIG_USB_SERIAL_NAVMAN=m
# CONFIG_USB_SERIAL_PL2303 is not set
CONFIG_USB_SERIAL_OTI6858=m
CONFIG_USB_SERIAL_QUALCOMM=m
CONFIG_USB_SERIAL_SPCP8X5=m
# CONFIG_USB_SERIAL_HP4X is not set
CONFIG_USB_SERIAL_SAFE=m
# CONFIG_USB_SERIAL_SAFE_PADDED is not set
CONFIG_USB_SERIAL_SIEMENS_MPI=m
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
CONFIG_USB_SERIAL_SYMBOL=m
CONFIG_USB_SERIAL_TI=m
CONFIG_USB_SERIAL_CYBERJACK=m
# CONFIG_USB_SERIAL_XIRCOM is not set
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_OMNINET=m
CONFIG_USB_SERIAL_OPTICON=m
CONFIG_USB_SERIAL_DEBUG=m

#
# USB Miscellaneous drivers
#
CONFIG_USB_EMI62=y
# CONFIG_USB_EMI26 is not set
CONFIG_USB_ADUTUX=y
CONFIG_USB_SEVSEG=y
# CONFIG_USB_RIO500 is not set
CONFIG_USB_LEGOTOWER=y
CONFIG_USB_LCD=m
CONFIG_USB_BERRY_CHARGE=m
CONFIG_USB_LED=m
CONFIG_USB_CYPRESS_CY7C63=m
CONFIG_USB_CYTHERM=y
CONFIG_USB_IDMOUSE=y
CONFIG_USB_FTDI_ELAN=m
CONFIG_USB_APPLEDISPLAY=m
# CONFIG_USB_SISUSBVGA is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
CONFIG_USB_IOWARRIOR=m
CONFIG_USB_TEST=y
# CONFIG_USB_ISIGHTFW is not set
CONFIG_USB_VST=y

#
# OTG and related infrastructure
#
# CONFIG_NOP_USB_XCEIV is not set
CONFIG_UWB=y
CONFIG_UWB_HWA=y
# CONFIG_UWB_WHCI is not set
CONFIG_UWB_WLP=m
CONFIG_UWB_I1480U=y
# CONFIG_UWB_I1480U_WLP is not set
CONFIG_MMC=m
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_UNSAFE_RESUME is not set

#
# MMC/SD/SDIO Card Drivers
#
CONFIG_MMC_BLOCK=m
# CONFIG_MMC_BLOCK_BOUNCE is not set
CONFIG_SDIO_UART=m
# CONFIG_MMC_TEST is not set

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_SDHCI is not set
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
# CONFIG_MMC_SDRICOH_CS is not set
CONFIG_MMC_CB710=m
CONFIG_MMC_VIA_SDMMC=m
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=m
CONFIG_MEMSTICK_JMICRON_38X=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
CONFIG_LEDS_NET48XX=m
CONFIG_LEDS_WRAP=m
CONFIG_LEDS_ALIX2=m
CONFIG_LEDS_PCA9532=m
CONFIG_LEDS_LP3944=m
# CONFIG_LEDS_CLEVO_MAIL is not set
CONFIG_LEDS_PCA955X=m
# CONFIG_LEDS_BD2802 is not set

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_ACCESSIBILITY is not set
CONFIG_INFINIBAND=y
# CONFIG_INFINIBAND_USER_MAD is not set
# CONFIG_INFINIBAND_USER_ACCESS is not set
CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_AMSO1100=m
# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set
# CONFIG_MLX4_INFINIBAND is not set
CONFIG_INFINIBAND_NES=y
# CONFIG_INFINIBAND_NES_DEBUG is not set
CONFIG_INFINIBAND_IPOIB=m
# CONFIG_INFINIBAND_IPOIB_CM is not set
CONFIG_INFINIBAND_IPOIB_DEBUG=y
# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
CONFIG_INFINIBAND_SRP=m
CONFIG_EDAC=y

#
# Reporting subsystems
#
CONFIG_EDAC_DEBUG=y
CONFIG_EDAC_DEBUG_VERBOSE=y
# CONFIG_EDAC_MM_EDAC is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_DEBUG=y

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
CONFIG_RTC_DRV_TEST=m

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
CONFIG_RTC_DRV_DS1672=m
CONFIG_RTC_DRV_MAX6900=m
# CONFIG_RTC_DRV_RS5C372 is not set
CONFIG_RTC_DRV_ISL1208=m
# CONFIG_RTC_DRV_X1205 is not set
CONFIG_RTC_DRV_PCF8563=m
CONFIG_RTC_DRV_PCF8583=m
# CONFIG_RTC_DRV_M41T80 is not set
CONFIG_RTC_DRV_S35390A=m
CONFIG_RTC_DRV_FM3130=m
CONFIG_RTC_DRV_RX8581=m
CONFIG_RTC_DRV_RX8025=m

#
# SPI RTC drivers
#

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=m
CONFIG_RTC_DRV_DS1286=m
CONFIG_RTC_DRV_DS1511=y
# CONFIG_RTC_DRV_DS1553 is not set
CONFIG_RTC_DRV_DS1742=y
# CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86=m
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
CONFIG_RTC_DRV_V3020=m
CONFIG_RTC_DRV_PCF50633=m

#
# on-CPU RTC drivers
#
CONFIG_DMADEVICES=y

#
# DMA Devices
#
# CONFIG_INTEL_IOATDMA is not set
# CONFIG_AUXDISPLAY is not set
CONFIG_UIO=m
CONFIG_UIO_CIF=m
CONFIG_UIO_PDRV=m
CONFIG_UIO_PDRV_GENIRQ=m
CONFIG_UIO_SMX=m
CONFIG_UIO_AEC=m
# CONFIG_UIO_SERCOS3 is not set

#
# TI VLYNQ
#
CONFIG_X86_PLATFORM_DEVICES=y
CONFIG_ACER_WMI=y
CONFIG_ASUS_LAPTOP=m
CONFIG_DELL_WMI=y
# CONFIG_FUJITSU_LAPTOP is not set
# CONFIG_TC1100_WMI is not set
# CONFIG_HP_WMI is not set
CONFIG_MSI_LAPTOP=m
CONFIG_PANASONIC_LAPTOP=y
# CONFIG_COMPAL_LAPTOP is not set
CONFIG_THINKPAD_ACPI=y
CONFIG_THINKPAD_ACPI_DEBUGFACILITIES=y
CONFIG_THINKPAD_ACPI_DEBUG=y
CONFIG_THINKPAD_ACPI_UNSAFE_LEDS=y
CONFIG_THINKPAD_ACPI_VIDEO=y
CONFIG_THINKPAD_ACPI_HOTKEY_POLL=y
CONFIG_INTEL_MENLOW=m
CONFIG_ACPI_WMI=y
CONFIG_ACPI_ASUS=m
# CONFIG_ACPI_TOSHIBA is not set

#
# Firmware Drivers
#
# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_EFI_VARS is not set
CONFIG_DELL_RBU=y
# CONFIG_DCDBAS is not set
CONFIG_DMIID=y
CONFIG_ISCSI_IBFT_FIND=y
CONFIG_ISCSI_IBFT=m

#
# File systems
#
# CONFIG_EXT2_FS is not set
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=m
CONFIG_EXT4DEV_COMPAT=y
# CONFIG_EXT4_FS_XATTR is not set
CONFIG_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_JBD2=m
# CONFIG_JBD2_DEBUG is not set
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 is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=m
CONFIG_XFS_QUOTA=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
CONFIG_XFS_DEBUG=y
CONFIG_GFS2_FS=m
CONFIG_GFS2_FS_LOCKING_DLM=y
# CONFIG_OCFS2_FS is not set
CONFIG_BTRFS_FS=m
# CONFIG_BTRFS_FS_POSIX_ACL is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
# CONFIG_INOTIFY_USER is not set
# CONFIG_QUOTA is not set
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
CONFIG_AUTOFS4_FS=m
# CONFIG_FUSE_FS is not set

#
# Caches
#
CONFIG_FSCACHE=m
# CONFIG_FSCACHE_STATS is not set
# CONFIG_FSCACHE_HISTOGRAM is not set
CONFIG_FSCACHE_DEBUG=y
CONFIG_CACHEFILES=m
# CONFIG_CACHEFILES_DEBUG is not set
# CONFIG_CACHEFILES_HISTOGRAM is not set

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=m
# CONFIG_JOLIET is not set
CONFIG_ZISOFS=y
# CONFIG_UDF_FS is not set

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
# CONFIG_VFAT_FS is not set
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_NTFS_FS=m
CONFIG_NTFS_DEBUG=y
CONFIG_NTFS_RW=y

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
# CONFIG_TMPFS is not set
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_CONFIGFS_FS=m
CONFIG_MISC_FILESYSTEMS=y
CONFIG_ADFS_FS=y
# CONFIG_ADFS_FS_RW is not set
CONFIG_AFFS_FS=y
# CONFIG_ECRYPT_FS is not set
CONFIG_HFS_FS=m
CONFIG_HFSPLUS_FS=m
CONFIG_BEFS_FS=y
# CONFIG_BEFS_DEBUG is not set
CONFIG_BFS_FS=m
CONFIG_EFS_FS=m
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
CONFIG_VXFS_FS=m
CONFIG_MINIX_FS=m
# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
CONFIG_QNX4FS_FS=y
CONFIG_ROMFS_FS=y
CONFIG_ROMFS_BACKED_BY_BLOCK=y
# CONFIG_ROMFS_BACKED_BY_MTD is not set
# CONFIG_ROMFS_BACKED_BY_BOTH is not set
CONFIG_ROMFS_ON_BLOCK=y
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_EXOFS_FS=m
CONFIG_EXOFS_DEBUG=y
CONFIG_NILFS2_FS=y
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_EXPORTFS=m

#
# 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 is not set
# CONFIG_ACORN_PARTITION_ADFS is not set
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
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=y
CONFIG_LDM_DEBUG=y
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
# CONFIG_KARMA_PARTITION is not set
# CONFIG_EFI_PARTITION is not set
# CONFIG_SYSV68_PARTITION is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=m
# CONFIG_NLS_CODEPAGE_737 is not set
CONFIG_NLS_CODEPAGE_775=m
CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_852 is not set
CONFIG_NLS_CODEPAGE_855=y
# CONFIG_NLS_CODEPAGE_857 is not set
CONFIG_NLS_CODEPAGE_860=m
CONFIG_NLS_CODEPAGE_861=y
CONFIG_NLS_CODEPAGE_862=y
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
CONFIG_NLS_CODEPAGE_865=m
CONFIG_NLS_CODEPAGE_866=y
CONFIG_NLS_CODEPAGE_869=m
CONFIG_NLS_CODEPAGE_936=m
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
# CONFIG_NLS_ISO8859_8 is not set
CONFIG_NLS_CODEPAGE_1250=m
CONFIG_NLS_CODEPAGE_1251=m
CONFIG_NLS_ASCII=m
CONFIG_NLS_ISO8859_1=m
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 is not set
CONFIG_NLS_ISO8859_7=y
CONFIG_NLS_ISO8859_9=m
# CONFIG_NLS_ISO8859_13 is not set
CONFIG_NLS_ISO8859_14=y
# CONFIG_NLS_ISO8859_15 is not set
CONFIG_NLS_KOI8_R=y
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_UTF8=m
CONFIG_DLM=m
CONFIG_DLM_DEBUG=y

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
# CONFIG_ALLOW_WARNINGS is not set
CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
CONFIG_UNUSED_SYMBOLS=y
CONFIG_DEBUG_FS=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_SHIRQ is not set
CONFIG_DETECT_SOFTLOCKUP=y
# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
# CONFIG_SCHED_DEBUG is not set
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SLUB_DEBUG_ON is not set
CONFIG_SLUB_STATS=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
CONFIG_DEBUG_KMEMLEAK_TEST=y
# CONFIG_DEBUG_RT_MUTEXES is not set
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 is not set
CONFIG_TRACE_IRQFLAGS=y
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
CONFIG_DEBUG_HIGHMEM=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VIRTUAL=y
CONFIG_DEBUG_WRITECOUNT=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y
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 is not set
CONFIG_RCU_CPU_STALL_DETECTOR=y
# CONFIG_KPROBES_SANITY_TEST is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
CONFIG_LKDTM=y
# CONFIG_FAULT_INJECTION is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=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_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
CONFIG_FIREWIRE_OHCI_REMOTE_DMA=y
# CONFIG_DYNAMIC_DEBUG is not set
CONFIG_DMA_API_DEBUG=y
CONFIG_SAMPLES=y
CONFIG_SAMPLE_MARKERS=m
# CONFIG_SAMPLE_TRACEPOINTS is not set
CONFIG_SAMPLE_TRACE_EVENTS=m
CONFIG_SAMPLE_KOBJECT=m
# CONFIG_SAMPLE_KPROBES is not set
CONFIG_SAMPLE_HW_BREAKPOINT=m
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
# CONFIG_KGDB_SERIAL_CONSOLE is not set
# CONFIG_KGDB_TESTS is not set
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=y
CONFIG_DEBUG_STACK_USAGE=y
# CONFIG_DEBUG_PER_CPU_MAPS is not set
CONFIG_X86_PTDUMP=y
# CONFIG_DEBUG_RODATA is not set
# CONFIG_DEBUG_NX_TEST is not set
CONFIG_4KSTACKS=y
CONFIG_DOUBLEFAULT=y
CONFIG_IOMMU_STRESS=y
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 is not set
# CONFIG_IO_DELAY_0XED is not set
CONFIG_IO_DELAY_UDELAY=y
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEFAULT_IO_DELAY_TYPE=2
# CONFIG_DEBUG_BOOT_PARAMS is not set
# CONFIG_CPA_DEBUG is not set
CONFIG_OPTIMIZE_INLINING=y

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
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_IMA is not set
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
# CONFIG_CRYPTO_FIPS is not set
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=m
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_CRYPTO_CRYPTD=y
CONFIG_CRYPTO_AUTHENC=y
CONFIG_CRYPTO_TEST=m

#
# Authenticated Encryption with Associated Data
#
CONFIG_CRYPTO_CCM=m
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
CONFIG_CRYPTO_CTS=m
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=m

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_CRC32C_INTEL=m
CONFIG_CRYPTO_MD4=m
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
CONFIG_CRYPTO_RMD128=y
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
CONFIG_CRYPTO_RMD320=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=m
CONFIG_CRYPTO_SHA512=m
CONFIG_CRYPTO_TGR192=y
# CONFIG_CRYPTO_WP512 is not set

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_586=m
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARC4=m
CONFIG_CRYPTO_BLOWFISH=m
CONFIG_CRYPTO_CAMELLIA=m
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_FCRYPT=m
CONFIG_CRYPTO_KHAZAD=y
CONFIG_CRYPTO_SALSA20=y
CONFIG_CRYPTO_SALSA20_586=m
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
CONFIG_CRYPTO_TEA=m
# CONFIG_CRYPTO_TWOFISH is not set
CONFIG_CRYPTO_TWOFISH_COMMON=m
CONFIG_CRYPTO_TWOFISH_586=m

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=m
# CONFIG_CRYPTO_LZO is not set

#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_VIRTUALIZATION=y
# CONFIG_KVM is not set
# CONFIG_LGUEST is not set
# CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_BALLOON is not set
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=m
CONFIG_CRC16=m
CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=m
CONFIG_CRC32=y
CONFIG_CRC7=m
CONFIG_LIBCRC32C=y
CONFIG_AUDIT_GENERIC=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=m
CONFIG_TEXTSEARCH_BM=m
CONFIG_TEXTSEARCH_FSM=m
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CHECK_SIGNATURE=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

[-- Attachment #3: boot.log --]
[-- Type: text/plain, Size: 258157 bytes --]

[    0.000000] Linux version 2.6.31-rc6-tip-01322-gd685ec8-dirty (mingo@europe) (gcc version 4.2.2) #7600 SMP Fri Aug 21 22:20:30 CEST 2009
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   NSC Geode by NSC
[    0.000000]   Cyrix CyrixInstead
[    0.000000]   Centaur CentaurHauls
[    0.000000]   Transmeta GenuineTMx86
[    0.000000]   Transmeta TransmetaCPU
[    0.000000]   UMC UMC UMC UMC
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
[    0.000000]  BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000d2000 - 00000000000d4000 (reserved)
[    0.000000]  BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000007f6e0000 (usable)
[    0.000000]  BIOS-e820: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
[    0.000000]  BIOS-e820: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000007f700000 - 0000000080000000 (reserved)
[    0.000000]  BIOS-e820: 00000000f0000000 - 00000000f4000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  BIOS-e820: 00000000fed14000 - 00000000fed1a000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed90000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000ff800000 - 0000000100000000 (reserved)
[    0.000000] DMI present.
[    0.000000] last_pfn = 0x7f6e0 max_arch_pfn = 0x1000000
[    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-CFFFF write-protect
[    0.000000]   D0000-DBFFF uncachable
[    0.000000]   DC000-DFFFF write-back
[    0.000000]   E0000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000 mask F80000000 write-back
[    0.000000]   1 base 07F700000 mask FFFF00000 uncachable
[    0.000000]   2 base 07F800000 mask FFF800000 uncachable
[    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: 0000000000002000 - 0000000000006000 (usable) ==> (reserved)
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] modified physical RAM map:
[    0.000000]  modified: 0000000000000000 - 0000000000002000 (usable)
[    0.000000]  modified: 0000000000002000 - 0000000000006000 (reserved)
[    0.000000]  modified: 0000000000006000 - 000000000009f000 (usable)
[    0.000000]  modified: 000000000009f000 - 00000000000a0000 (reserved)
[    0.000000]  modified: 00000000000d2000 - 00000000000d4000 (reserved)
[    0.000000]  modified: 00000000000dc000 - 0000000000100000 (reserved)
[    0.000000]  modified: 0000000000100000 - 000000007f6e0000 (usable)
[    0.000000]  modified: 000000007f6e0000 - 000000007f6f3000 (ACPI data)
[    0.000000]  modified: 000000007f6f3000 - 000000007f700000 (ACPI NVS)
[    0.000000]  modified: 000000007f700000 - 0000000080000000 (reserved)
[    0.000000]  modified: 00000000f0000000 - 00000000f4000000 (reserved)
[    0.000000]  modified: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  modified: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  modified: 00000000fed14000 - 00000000fed1a000 (reserved)
[    0.000000]  modified: 00000000fed1c000 - 00000000fed90000 (reserved)
[    0.000000]  modified: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  modified: 00000000ff800000 - 0000000100000000 (reserved)
[    0.000000] initial memory mapped : 0 - 02600000
[    0.000000] init_memory_mapping: 0000000000000000-00000000375fe000
[    0.000000] NX (Execute Disable) protection: active
[    0.000000]  0000000000 - 00375fe000 page 4k
[    0.000000] kernel direct mapping tables up to 375fe000 @ 100000-2c1000
[    0.000000] ACPI: RSDP 000f68a0 00024 (v02 LENOVO)
[    0.000000] ACPI: XSDT 7f6e631f 00074 (v01 LENOVO TP-79    00001020  LTP 00000000)
[    0.000000] ACPI: FACP 7f6e6400 000F4 (v03 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI Warning: 32/64X length mismatch in Gpe1Block: 0/32 20090521 tbfadt-527
[    0.000000] ACPI Warning: Optional field Gpe1Block has zero address or length: 000000000000102C/0 20090521 tbfadt-558
[    0.000000] ACPI: DSDT 7f6e65e7 0C765 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
[    0.000000] ACPI: FACS 7f6f4000 00040
[    0.000000] ACPI: SSDT 7f6e65b4 00033 (v01 LENOVO TP-79    00001020 MSFT 0100000E)
[    0.000000] ACPI: ECDT 7f6f2d4c 00052 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: TCPA 7f6f2d9e 00032 (v02 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: APIC 7f6f2dd0 00068 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: MCFG 7f6f2e38 0003E (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: HPET 7f6f2e76 00038 (v01 LENOVO TP-79    00001020 LNVO 00000001)
[    0.000000] ACPI: BOOT 7f6f2fd8 00028 (v01 LENOVO TP-79    00001020  LTP 00000001)
[    0.000000] ACPI: SSDT 7f6e58da 00507 (v01 LENOVO TP-79    00001020 INTL 20050513)
[    0.000000] ACPI: SSDT 7f6e5702 001D8 (v01 LENOVO TP-79    00001020 INTL 20050513)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] Scan SMP from c0000000 for 1024 bytes.
[    0.000000] Scan SMP from c009fc00 for 1024 bytes.
[    0.000000] Scan SMP from c00f0000 for 65536 bytes.
[    0.000000] found SMP MP-table at [c00f68e0] f68e0
[    0.000000] could not find any ACPI SRAT memory areas.
[    0.000000] failed to get NUMA memory information from SRAT table
[    0.000000] NUMA - single node, flat memory mode
[    0.000000] Node: 0, start_pfn: 0, end_pfn: 7f6e0
[    0.000000]   Setting physnode_map array to node 0 for pfns:
[    0.000000]   0 4000 8000 c000 10000 14000 18000 1c000 20000 24000 28000 2c000 30000 34000 38000 3c000 40000 44000 48000 4c000 50000 54000 58000 5c000 60000 64000 68000 6c000 70000 74000 78000 7c000 
[    0.000000] node 0 pfn: [0 - 7f6e0]
[    0.000000] Reserving 7680 pages of KVA for lmem_map of node 0 at 7d800
[    0.000000] remove_active_range (0, 514048, 521728)
[    0.000000] Reserving total of 1e00 pages for numa KVA remap
[    0.000000] kva_start_pfn ~ 35600 max_low_pfn ~ 375fe
[    0.000000] max_pfn = 7f6e0
[    0.000000] 1152MB HIGHMEM available.
[    0.000000] 885MB LOWMEM available.
[    0.000000] max_low_pfn = 375fe, highstart_pfn = 375fe
[    0.000000] Low memory ends at vaddr f75fe000
[    0.000000] node 0 will remap to vaddr f5600000 - f7400000
[    0.000000] allocate_pgdat: node 0 NODE_DATA f5600000
[    0.000000] remap_numa_kva: node 0
[    0.000000] remap_numa_kva: f5600000 to pfn 0007d800
[    0.000000] remap_numa_kva: f5800000 to pfn 0007da00
[    0.000000] remap_numa_kva: f5a00000 to pfn 0007dc00
[    0.000000] remap_numa_kva: f5c00000 to pfn 0007de00
[    0.000000] remap_numa_kva: f5e00000 to pfn 0007e000
[    0.000000] remap_numa_kva: f6000000 to pfn 0007e200
[    0.000000] remap_numa_kva: f6200000 to pfn 0007e400
[    0.000000] remap_numa_kva: f6400000 to pfn 0007e600
[    0.000000] remap_numa_kva: f6600000 to pfn 0007e800
[    0.000000] remap_numa_kva: f6800000 to pfn 0007ea00
[    0.000000] remap_numa_kva: f6a00000 to pfn 0007ec00
[    0.000000] remap_numa_kva: f6c00000 to pfn 0007ee00
[    0.000000] remap_numa_kva: f6e00000 to pfn 0007f000
[    0.000000] remap_numa_kva: f7000000 to pfn 0007f200
[    0.000000] remap_numa_kva: f7200000 to pfn 0007f400
[    0.000000] High memory starts at vaddr f75fe000
[    0.000000]   mapped low ram: 0 - 375fe000
[    0.000000]   low ram: 0 - 375fe000
[    0.000000]   node 0 low ram: 00000000 - 375fe000
[    0.000000]   node 0 bootmap 00007000 - 0000dec0
[    0.000000] (10 early reservations) ==> bootmem [0000000000 - 00375fe000]
[    0.000000]   #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
[    0.000000]   #1 [0000001000 - 0000002000]    EX TRAMPOLINE ==> [0000001000 - 0000002000]
[    0.000000]   #2 [0000006000 - 0000007000]       TRAMPOLINE ==> [0000006000 - 0000007000]
[    0.000000]   #3 [0001000000 - 0002177994]    TEXT DATA BSS ==> [0001000000 - 0002177994]
[    0.000000]   #4 [000009f000 - 0000100000]    BIOS reserved ==> [000009f000 - 0000100000]
[    0.000000]   #5 [0002178000 - 000218b138]              BRK ==> [0002178000 - 000218b138]
[    0.000000]   #6 [0000100000 - 00002ab000]          PGTABLE ==> [0000100000 - 00002ab000]
[    0.000000]   #7 [007d800000 - 007f600000]          KVA RAM
[    0.000000]   #8 [0035600000 - 0037400000]           KVA PG ==> [0035600000 - 0037400000]
[    0.000000]   #9 [0000007000 - 000000e000]          BOOTMAP ==> [0000007000 - 000000e000]
[    0.000000] Scan SMP from c0000000 for 1024 bytes.
[    0.000000] Scan SMP from c009fc00 for 1024 bytes.
[    0.000000] Scan SMP from c00f0000 for 65536 bytes.
[    0.000000] found SMP MP-table at [c00f68e0] f68e0
[    0.000000]   mpc: 9f5a1-9f6b5
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000000 -> 0x00001000
[    0.000000]   Normal   0x00001000 -> 0x000375fe
[    0.000000]   HighMem  0x000375fe -> 0x0007f6e0
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[4] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00000002
[    0.000000]     0: 0x00000006 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0007d800
[    0.000000]     0: 0x0007f600 -> 0x0007f6e0
[    0.000000] On node 0 totalpages: 514171
[    0.000000] free_area_init_node: node 0, pgdat f5600000, node_mem_map f5602000
[    0.000000]   DMA zone: 60 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 3935 pages, LIFO batch:0
[    0.000000]   Normal zone: 3263 pages used for memmap
[    0.000000]   Normal zone: 219455 pages, LIFO batch:31
[    0.000000]   HighMem zone: 4324 pages used for memmap
[    0.000000]   HighMem zone: 283134 pages, LIFO batch:31
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0x1008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] SMP: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] mapped APIC to ffffb000 (fee00000)
[    0.000000] mapped IOAPIC to ffffa000 (fec00000)
[    0.000000] nr_irqs_gsi: 24
[    0.000000] Allocating PCI resources starting at 80000000 (gap: 80000000:70000000)
[    0.000000] NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:2 nr_node_ids:16
[    0.000000] PERCPU: Embedded 338 pages at c21af000, static data 1361404 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 506524
[    0.000000] Policy zone: HighMem
[    0.000000] Kernel command line: root=/dev/sda1 console=tty profile=0 debug initcall_debug enforcing=0 apic=verbose sysrq_always_enabled ignore_loglevel selinux=1 relaxed_check=1 3 netconsole=4444@10.0.1.15/eth0,4444@10.0.1.21/00:30:48:c6:86:26
[    0.000000] kernel profiling enabled (shift: 0)
[    0.000000] debug: sysrq always enabled.
[    0.000000] PID hash table entries: 4096 (order: 12, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Enabling fast FPU save and restore... done.
[    0.000000] Enabling unmasked SIMD FPU exception support... done.
[    0.000000] Initializing CPU#0
[    0.000000] Initializing HighMem for node 0 (000375fe:0007f6e0)
[    0.000000] Memory: 2002628k/2087808k available (5870k kernel code, 54052k reserved, 3082k data, 1828k init, 1149832k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xffad6000 - 0xfffff000   (5284 kB)
[    0.000000]     pkmap   : 0xff600000 - 0xff800000   (2048 kB)
[    0.000000]     vmalloc : 0xf7dfe000 - 0xff5fe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf75fe000   ( 885 MB)
[    0.000000]       .init : 0xc18c5000 - 0xc1a8e000   (1828 kB)
[    0.000000]       .data : 0xc15bbab4 - 0xc18be338   (3082 kB)
[    0.000000]       .text : 0xc1000000 - 0xc15bbab4   (5870 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.000000] SLUB: Genslabs=14, HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=16
[    0.000000] Hierarchical RCU implementation.
[    0.000000] RCU-based detection of stalled CPUs is enabled.
[    0.000000] NR_IRQS:1280
[    0.000000] CPU 0 irqstacks, hard=c21af000 soft=c21b0000
[    0.000000] Extended CMOS year: 2000
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 1828.877 MHz processor.
[    0.000999] Console: colour VGA+ 80x25
[    0.000999] console [tty0] enabled
[    0.000999] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.000999] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.000999] ... MAX_LOCK_DEPTH:          48
[    0.000999] ... MAX_LOCKDEP_KEYS:        8191
[    0.000999] ... CLASSHASH_SIZE:          4096
[    0.000999] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.000999] ... MAX_LOCKDEP_CHAINS:      32768
[    0.000999] ... CHAINHASH_SIZE:          16384
[    0.000999]  memory used by lock dependency info: 3823 kB
[    0.000999]  per task-struct memory footprint: 1920 bytes
[    0.001032] Calibrating delay loop (skipped), value calculated using timer frequency.. 3657.75 BogoMIPS (lpj=1828877)
[    0.001305] Security Framework initialized
[    0.001370] TOMOYO Linux initialized
[    0.001609] Mount-cache hash table entries: 512
[    0.003960] CPU: L1 I cache: 32K, L1 D cache: 32K
[    0.004043] CPU: L2 cache: 2048K
[    0.004101] CPU: Physical Processor ID: 0
[    0.004156] CPU: Processor Core ID: 0
[    0.004213] mce: CPU supports 6 MCE banks
[    0.004282] using mwait in idle threads.
[    0.004346] Performance Counters: no PMU driver, software counters only.
[    0.004428] Checking 'hlt' instruction... OK.
[    0.010564] ACPI: Core revision 20090521
[    0.196281] enabled ExtINT on CPU#0
[    0.196591] ESR value before enabling vector: 0x00000040  after: 0x00000000
[    0.196683] Mapping cpu 0 to node 0
[    0.196769] ENABLING IO-APIC IRQs
[    0.196854] init IO_APIC IRQs
[    0.196939]  1-0 (apicid-pin) not connected
[    0.197054] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.197196] IOAPIC[0]: Set routing entry (1-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
[    0.197336] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
[    0.197477] IOAPIC[0]: Set routing entry (1-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
[    0.197617] IOAPIC[0]: Set routing entry (1-5 -> 0x35 -> IRQ 5 Mode:0 Active:0)
[    0.197756] IOAPIC[0]: Set routing entry (1-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
[    0.197898] IOAPIC[0]: Set routing entry (1-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
[    0.198017] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.198157] IOAPIC[0]: Set routing entry (1-9 -> 0x39 -> IRQ 9 Mode:1 Active:0)
[    0.198298] IOAPIC[0]: Set routing entry (1-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
[    0.198439] IOAPIC[0]: Set routing entry (1-11 -> 0x3b -> IRQ 11 Mode:0 Active:0)
[    0.198579] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.198719] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.198860] IOAPIC[0]: Set routing entry (1-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
[    0.199017] IOAPIC[0]: Set routing entry (1-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
[    0.199148]  1-16 1-17 1-18 1-19 1-20 1-21 1-22 1-23 (apicid-pin) not connected
[    0.199866] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.210078] CPU0: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
[    0.210258] Using local APIC timer interrupts.
[    0.210259] calibrating APIC timer ...
[    0.210999] ... lapic delta = 1038908
[    0.210999] ... PM-Timer delta = 357901
[    0.210999] ... PM-Timer result ok
[    0.210999] ..... delta 1038908
[    0.210999] ..... mult: 44627542
[    0.210999] ..... calibration result: 166225
[    0.210999] ..... CPU clock speed is 1828.0479 MHz.
[    0.210999] ..... host bus clock speed is 166.0225 MHz.
[    0.210999] calling  migration_init+0x0/0x50 @ 1
[    0.210999] initcall migration_init+0x0/0x50 returned 0 after 0 usecs
[    0.210999] calling  spawn_ksoftirqd+0x0/0x50 @ 1
[    0.210999] initcall spawn_ksoftirqd+0x0/0x50 returned 0 after 0 usecs
[    0.210999] calling  init_call_single_data+0x0/0x90 @ 1
[    0.210999] initcall init_call_single_data+0x0/0x90 returned 0 after 0 usecs
[    0.210999] calling  spawn_softlockup_task+0x0/0x70 @ 1
[    0.211123] initcall spawn_softlockup_task+0x0/0x70 returned 0 after 976 usecs
[    0.211253] calling  tracer_alloc_buffers+0x0/0x130 @ 1
[    0.211474] initcall tracer_alloc_buffers+0x0/0x130 returned 0 after 0 usecs
[    0.211568] calling  init_trace_printk+0x0/0x10 @ 1
[    0.211659] initcall init_trace_printk+0x0/0x10 returned 0 after 0 usecs
[    0.213101] lockdep: fixing up alternatives.
[    0.213410] CPU 1 irqstacks, hard=c2301000 soft=c2302000
[    0.213502] Booting processor 1 APIC 0x1 ip 0x6000
[    0.000999] Initializing CPU#1
[    0.000999] masked ExtINT on CPU#1
[    0.000999] Mapping cpu 1 to node 0
[    0.000999] Calibrating delay using timer specific routine.. 3657.01 BogoMIPS (lpj=1828507)
[    0.000999] CPU: L1 I cache: 32K, L1 D cache: 32K
[    0.000999] CPU: L2 cache: 2048K
[    0.000999] CPU: Physical Processor ID: 0
[    0.000999] CPU: Processor Core ID: 1
[    0.000999] mce: CPU supports 6 MCE banks
[    0.284613] CPU1: Genuine Intel(R) CPU           T2400  @ 1.83GHz stepping 08
[    0.285149] checking TSC synchronization [CPU#0 -> CPU#1]:
[    0.285999] Measured 580294 cycles TSC warp between CPUs, turning off TSC clock.
[    0.285999] Marking TSC unstable due to check_tsc_sync_source failed
[    0.287132] Brought up 2 CPUs
[    0.287221] Total of 2 processors activated (7314.76 BogoMIPS).
[    0.288250] PM: Adding info for No Bus:platform
[    0.289091] khelper used greatest stack depth: 2408 bytes left
[    0.290709] calling  init_mmap_min_addr+0x0/0x10 @ 1
[    0.290801] initcall init_mmap_min_addr+0x0/0x10 returned 0 after 0 usecs
[    0.290894] calling  init_cpufreq_transition_notifier_list+0x0/0x20 @ 1
[    0.290991] initcall init_cpufreq_transition_notifier_list+0x0/0x20 returned 0 after 0 usecs
[    0.291010] calling  net_ns_init+0x0/0xe0 @ 1
[    0.291303] initcall net_ns_init+0x0/0xe0 returned 0 after 0 usecs
[    0.291397] calling  cpufreq_tsc+0x0/0x30 @ 1
[    0.291485] initcall cpufreq_tsc+0x0/0x30 returned 0 after 0 usecs
[    0.291578] calling  pci_reboot_init+0x0/0x20 @ 1
[    0.291669] initcall pci_reboot_init+0x0/0x20 returned 0 after 0 usecs
[    0.291760] calling  reboot_init+0x0/0x20 @ 1
[    0.291854] initcall reboot_init+0x0/0x20 returned 0 after 0 usecs
[    0.292038] calling  init_lapic_sysfs+0x0/0x30 @ 1
[    0.292681] initcall init_lapic_sysfs+0x0/0x30 returned 0 after 0 usecs
[    0.292775] calling  print_banner+0x0/0x10 @ 1
[    0.292863] Booting paravirtualized kernel on bare hardware
[    0.293024] initcall print_banner+0x0/0x10 returned 0 after 976 usecs
[    0.293119] calling  init_smp_flush+0x0/0x50 @ 1
[    0.294006] initcall init_smp_flush+0x0/0x50 returned 0 after 0 usecs
[    0.294099] calling  alloc_frozen_cpus+0x0/0x10 @ 1
[    0.294189] initcall alloc_frozen_cpus+0x0/0x10 returned 0 after 0 usecs
[    0.294282] calling  sysctl_init+0x0/0x30 @ 1
[    0.294672] initcall sysctl_init+0x0/0x30 returned 0 after 0 usecs
[    0.294764] calling  ksysfs_init+0x0/0xa0 @ 1
[    0.294927] initcall ksysfs_init+0x0/0xa0 returned 0 after 0 usecs
[    0.295006] calling  async_init+0x0/0x50 @ 1
[    0.295095] initcall async_init+0x0/0x50 returned 0 after 0 usecs
[    0.295187] calling  init_jiffies_clocksource+0x0/0x10 @ 1
[    0.295300] initcall init_jiffies_clocksource+0x0/0x10 returned 0 after 0 usecs
[    0.295430] calling  pm_init+0x0/0x30 @ 1
[    0.295569] initcall pm_init+0x0/0x30 returned 0 after 0 usecs
[    0.295660] calling  init_hw_breakpoint+0x0/0x10 @ 1
[    0.295752] initcall init_hw_breakpoint+0x0/0x10 returned 0 after 0 usecs
[    0.295845] calling  filelock_init+0x0/0x30 @ 1
[    0.295941] initcall filelock_init+0x0/0x30 returned 0 after 0 usecs
[    0.296005] calling  init_misc_binfmt+0x0/0x50 @ 1
[    0.296112] initcall init_misc_binfmt+0x0/0x50 returned 0 after 0 usecs
[    0.296204] calling  init_script_binfmt+0x0/0x20 @ 1
[    0.296294] initcall init_script_binfmt+0x0/0x20 returned 0 after 0 usecs
[    0.296387] calling  init_elf_binfmt+0x0/0x20 @ 1
[    0.296477] initcall init_elf_binfmt+0x0/0x20 returned 0 after 0 usecs
[    0.296568] calling  debugfs_init+0x0/0x50 @ 1
[    0.296686] initcall debugfs_init+0x0/0x50 returned 0 after 0 usecs
[    0.296777] calling  securityfs_init+0x0/0x50 @ 1
[    0.296893] initcall securityfs_init+0x0/0x50 returned 0 after 0 usecs
[    0.297008] calling  random32_init+0x0/0xd0 @ 1
[    0.297098] initcall random32_init+0x0/0xd0 returned 0 after 0 usecs
[    0.297190] calling  regulator_init+0x0/0x30 @ 1
[    0.297278] regulator: core version 0.5
[    0.297635] initcall regulator_init+0x0/0x30 returned 0 after 0 usecs
[    0.297730] calling  early_resume_init+0x0/0x1c0 @ 1
[    0.297846] Time: 20:21:23  Date: 08/21/09
[    0.297934] initcall early_resume_init+0x0/0x1c0 returned 0 after 0 usecs
[    0.298038] calling  cpufreq_core_init+0x0/0x70 @ 1
[    0.298130] initcall cpufreq_core_init+0x0/0x70 returned 0 after 0 usecs
[    0.298222] calling  cpuidle_init+0x0/0x40 @ 1
[    0.298344] initcall cpuidle_init+0x0/0x40 returned 0 after 0 usecs
[    0.298436] calling  sock_init+0x0/0x60 @ 1
[    0.298832] initcall sock_init+0x0/0x60 returned 0 after 0 usecs
[    0.299006] calling  net_inuse_init+0x0/0x30 @ 1
[    0.299114] initcall net_inuse_init+0x0/0x30 returned 0 after 0 usecs
[    0.299206] calling  netpoll_init+0x0/0x40 @ 1
[    0.299294] initcall netpoll_init+0x0/0x40 returned 0 after 0 usecs
[    0.299385] calling  netlink_proto_init+0x0/0x1b0 @ 1
[    0.299652] NET: Registered protocol family 16
[    0.299855] initcall netlink_proto_init+0x0/0x1b0 returned 0 after 0 usecs
[    0.299948] calling  bdi_class_init+0x0/0x40 @ 1
[    0.300534] initcall bdi_class_init+0x0/0x40 returned 0 after 0 usecs
[    0.300627] calling  kobject_uevent_init+0x0/0x60 @ 1
[    0.300741] initcall kobject_uevent_init+0x0/0x60 returned 0 after 0 usecs
[    0.300834] calling  pcibus_class_init+0x0/0x20 @ 1
[    0.301303] initcall pcibus_class_init+0x0/0x20 returned 0 after 976 usecs
[    0.301397] calling  pci_driver_init+0x0/0x10 @ 1
[    0.301843] initcall pci_driver_init+0x0/0x10 returned 0 after 0 usecs
[    0.301936] calling  backlight_class_init+0x0/0x60 @ 1
[    0.302380] initcall backlight_class_init+0x0/0x60 returned 0 after 0 usecs
[    0.302474] calling  tty_class_init+0x0/0x30 @ 1
[    0.302861] initcall tty_class_init+0x0/0x30 returned 0 after 0 usecs
[    0.302953] calling  vtconsole_class_init+0x0/0xe0 @ 1
[    0.303425] PM: Adding info for No Bus:vtcon0
[    0.303852] initcall vtconsole_class_init+0x0/0xe0 returned 0 after 0 usecs
[    0.304071] calling  register_node_type+0x0/0x70 @ 1
[    0.304490] initcall register_node_type+0x0/0x70 returned 0 after 0 usecs
[    0.304584] calling  eisa_init+0x0/0x30 @ 1
[    0.305089] EISA bus registered
[    0.305178] initcall eisa_init+0x0/0x30 returned 0 after 976 usecs
[    0.305270] calling  amd_postcore_init+0x0/0x70 @ 1
[    0.305360] initcall amd_postcore_init+0x0/0x70 returned 0 after 0 usecs
[    0.305452] calling  arch_kdebugfs_init+0x0/0x20 @ 1
[    0.305564] initcall arch_kdebugfs_init+0x0/0x20 returned 0 after 0 usecs
[    0.305658] calling  init_pit_clocksource+0x0/0xb0 @ 1
[    0.305748] initcall init_pit_clocksource+0x0/0xb0 returned 0 after 0 usecs
[    0.305841] calling  mtrr_if_init+0x0/0x60 @ 1
[    0.305949] initcall mtrr_if_init+0x0/0x60 returned 0 after 0 usecs
[    0.306016] calling  ffh_cstate_init+0x0/0x30 @ 1
[    0.306108] initcall ffh_cstate_init+0x0/0x30 returned 0 after 0 usecs
[    0.306201] calling  acpi_pci_init+0x0/0x60 @ 1
[    0.306302] ACPI: bus type pci registered
[    0.306391] initcall acpi_pci_init+0x0/0x60 returned 0 after 0 usecs
[    0.306483] calling  dmi_id_init+0x0/0x2f0 @ 1
[    0.307207] PM: Adding info for No Bus:id
[    0.307723] initcall dmi_id_init+0x0/0x2f0 returned 0 after 976 usecs
[    0.307816] calling  init_cyclone_clocksource+0x0/0x200 @ 1
[    0.307907] initcall init_cyclone_clocksource+0x0/0x200 returned -19 after 0 usecs
[    0.308007] calling  pci_arch_init+0x0/0x50 @ 1
[    0.308228] PCI: PCI BIOS revision 2.10 entry at 0xfd84b, last bus=24
[    0.308318] PCI: Using configuration type 1 for base access
[    0.308417] initcall pci_arch_init+0x0/0x50 returned 0 after 0 usecs
[    0.308509] calling  topology_init+0x0/0x80 @ 1
[    0.309710] initcall topology_init+0x0/0x80 returned 0 after 976 usecs
[    0.309803] calling  mtrr_init_finialize+0x0/0x40 @ 1
[    0.309894] initcall mtrr_init_finialize+0x0/0x40 returned 0 after 0 usecs
[    0.309987] calling  param_sysfs_init+0x0/0x230 @ 1
[    0.369106] initcall param_sysfs_init+0x0/0x230 returned 0 after 57617 usecs
[    0.369209] calling  pm_sysrq_init+0x0/0x20 @ 1
[    0.369323] initcall pm_sysrq_init+0x0/0x20 returned 0 after 0 usecs
[    0.369416] calling  audit_watch_init+0x0/0x30 @ 1
[    0.369512] initcall audit_watch_init+0x0/0x30 returned 0 after 0 usecs
[    0.369606] calling  init_slow_work+0x0/0x40 @ 1
[    0.369694] initcall init_slow_work+0x0/0x40 returned 0 after 0 usecs
[    0.369787] calling  default_bdi_init+0x0/0x40 @ 1
[    0.370157] PM: Adding info for No Bus:default
[    0.370617] initcall default_bdi_init+0x0/0x40 returned 0 after 976 usecs
[    0.370711] calling  init_bio+0x0/0x130 @ 1
[    0.371227] bio: create slab <bio-0> at 0
[    0.371417] initcall init_bio+0x0/0x130 returned 0 after 976 usecs
[    0.371509] calling  fsnotify_init+0x0/0x10 @ 1
[    0.371601] initcall fsnotify_init+0x0/0x10 returned 0 after 0 usecs
[    0.371694] calling  fsnotify_notification_init+0x0/0x70 @ 1
[    0.371800] initcall fsnotify_notification_init+0x0/0x70 returned 0 after 0 usecs
[    0.371931] calling  cryptomgr_init+0x0/0x10 @ 1
[    0.372007] initcall cryptomgr_init+0x0/0x10 returned 0 after 0 usecs
[    0.372100] calling  blk_settings_init+0x0/0x20 @ 1
[    0.372189] initcall blk_settings_init+0x0/0x20 returned 0 after 0 usecs
[    0.372282] calling  blk_ioc_init+0x0/0x30 @ 1
[    0.372379] initcall blk_ioc_init+0x0/0x30 returned 0 after 0 usecs
[    0.372471] calling  blk_softirq_init+0x0/0x60 @ 1
[    0.372562] initcall blk_softirq_init+0x0/0x60 returned 0 after 0 usecs
[    0.372654] calling  genhd_device_init+0x0/0x50 @ 1
[    0.373164] initcall genhd_device_init+0x0/0x50 returned 0 after 976 usecs
[    0.373258] calling  blk_dev_integrity_init+0x0/0x30 @ 1
[    0.373356] initcall blk_dev_integrity_init+0x0/0x30 returned 0 after 0 usecs
[    0.373451] calling  pci_slot_init+0x0/0x50 @ 1
[    0.373567] initcall pci_slot_init+0x0/0x50 returned 0 after 0 usecs
[    0.373660] calling  acpi_init+0x0/0x260 @ 1
[    0.383829] ACPI: EC: EC description table is found, configuring boot EC
[    0.525999] ACPI: EC: non-query interrupt received, switching to interrupt mode
[    0.551761] ACPI: Interpreter enabled
[    0.551856] ACPI: (supports S0 S3 S5)
[    0.552390] ACPI: Using IOAPIC for interrupt routing
[    0.553767] PM: Adding info for acpi:LNXSYSTM:00
[    0.554339] PM: Adding info for acpi:LNXPWRBN:00
[    0.555040] PM: Adding info for acpi:LNXCPU:00
[    0.555766] PM: Adding info for acpi:LNXCPU:01
[    0.556763] PM: Adding info for acpi:device:00
[    0.560946] PM: Adding info for acpi:PNP0C0F:00
[    0.565177] PM: Adding info for acpi:PNP0C0F:01
[    0.569669] PM: Adding info for acpi:PNP0C0F:02
[    0.573936] PM: Adding info for acpi:PNP0C0F:03
[    0.578142] PM: Adding info for acpi:PNP0C0F:04
[    0.582601] PM: Adding info for acpi:PNP0C0F:05
[    0.586881] PM: Adding info for acpi:PNP0C0F:06
[    0.591085] PM: Adding info for acpi:PNP0C0F:07
[    0.592231] PM: Adding info for acpi:PNP0C01:00
[    0.595690] PM: Adding info for acpi:PNP0C0D:00
[    0.598885] PM: Adding info for acpi:PNP0C0E:00
[    0.599971] PM: Adding info for acpi:PNP0A08:00
[    0.601104] PM: Adding info for acpi:device:01
[    0.601840] PM: Adding info for acpi:PNP0C02:00
[    0.603061] PM: Adding info for acpi:PNP0000:00
[    0.604058] PM: Adding info for acpi:PNP0100:00
[    0.606350] PM: Adding info for acpi:PNP0103:00
[    0.607369] PM: Adding info for acpi:PNP0200:00
[    0.608377] PM: Adding info for acpi:PNP0800:00
[    0.609445] PM: Adding info for acpi:PNP0C04:00
[    0.610474] PM: Adding info for acpi:PNP0B00:00
[    0.611496] PM: Adding info for acpi:PNP0303:00
[    0.612544] PM: Adding info for acpi:IBM0057:00
[    0.624027] PM: Adding info for acpi:IBM0071:00
[    0.625877] PM: Adding info for acpi:PNP0C09:00
[    0.626921] PM: Adding info for acpi:LNXPOWER:00
[    0.630326] PM: Adding info for acpi:PNP0C0A:00
[    0.632969] PM: Adding info for acpi:ACPI0003:00
[    0.634440] PM: Adding info for acpi:IBM0068:00
[    0.635970] PM: Adding info for acpi:device:02
[    0.636701] PM: Adding info for acpi:device:03
[    0.637497] PM: Adding info for acpi:device:04
[    0.638233] PM: Adding info for acpi:device:05
[    0.638978] PM: Adding info for acpi:device:06
[    0.639835] PM: Adding info for acpi:device:07
[    0.640658] PM: Adding info for acpi:device:08
[    0.641394] PM: Adding info for acpi:device:09
[    0.642637] PM: Adding info for acpi:device:0a
[    0.643908] PM: Adding info for acpi:device:0b
[    0.644894] PM: Adding info for acpi:device:0c
[    0.645871] PM: Adding info for acpi:device:0d
[    0.646615] PM: Adding info for acpi:device:0e
[    0.647589] PM: Adding info for acpi:device:0f
[    0.648321] PM: Adding info for acpi:device:10
[    0.649302] PM: Adding info for acpi:device:11
[    0.650327] PM: Adding info for acpi:device:12
[    0.651082] PM: Adding info for acpi:device:13
[    0.651955] PM: Adding info for acpi:device:14
[    0.655649] PM: Adding info for acpi:device:15
[    0.656770] PM: Adding info for acpi:device:16
[    0.658095] PM: Adding info for acpi:device:17
[    0.658862] PM: Adding info for acpi:device:18
[    0.665721] PM: Adding info for acpi:device:19
[    0.667376] PM: Adding info for acpi:device:1a
[    0.668114] PM: Adding info for acpi:device:1b
[    0.668962] PM: Adding info for acpi:device:1c
[    0.672080] PM: Adding info for acpi:device:1d
[    0.672828] PM: Adding info for acpi:device:1e
[    0.673539] PM: Adding info for acpi:device:1f
[    0.674281] PM: Adding info for acpi:device:20
[    0.676787] PM: Adding info for acpi:device:21
[    0.677537] PM: Adding info for acpi:device:22
[    0.678357] PM: Adding info for acpi:device:23
[    0.679067] PM: Adding info for acpi:device:24
[    0.680240] PM: Adding info for acpi:device:25
[    0.684794] PM: Adding info for acpi:LNXTHERM:00
[    0.685501] PM: Adding info for acpi:LNXTHERM:01
[    0.686202] PM: Adding info for acpi:LNXTHERM:02
[    0.688428] ACPI: EC: GPE = 0x1c, I/O: command/status = 0x66, data = 0x62
[    0.688521] ACPI: EC: driver started in interrupt mode
[    0.690102] ACPI: Power Resource [PUBS] (on)
[    0.691266] initcall acpi_init+0x0/0x260 returned 0 after 310546 usecs
[    0.691359] calling  dock_init+0x0/0x80 @ 1
[    0.692706] PM: Adding info for platform:dock.0
[    0.701856] PM: Adding info for platform:dock.1
[    0.709013] PM: Adding info for platform:dock.2
[    0.719529] ACPI: ACPI Dock Station Driver: 3 docks/bays found
[    0.719623] initcall dock_init+0x0/0x80 returned 0 after 27343 usecs
[    0.719716] calling  acpi_pci_root_init+0x0/0x30 @ 1
[    0.720025] ACPI: PCI Root Bridge [PCI0] (0000:00)
[    0.720421] PM: Adding info for No Bus:pci0000:00
[    0.720674] PM: Adding info for No Bus:0000:00
[    0.721539] PCI: Scanning bus 0000:00
[    0.721694] pci 0000:00:00.0: found [8086:27a0] class 000600 header type 00
[    0.721846] pci 0000:00:00.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.721972] pci 0000:00:00.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.722074] pci 0000:00:02.0: found [8086:27a2] class 000300 header type 00
[    0.722198] pci 0000:00:02.0: reg 10 32bit mmio: [0xee100000-0xee17ffff]
[    0.722296] pci 0000:00:02.0: reg 14 io port: [0x1800-0x1807]
[    0.722393] pci 0000:00:02.0: reg 18 32bit mmio: [0xd0000000-0xdfffffff]
[    0.722492] pci 0000:00:02.0: reg 1c 32bit mmio: [0xee200000-0xee23ffff]
[    0.722608] pci 0000:00:02.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.722702] pci 0000:00:02.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.722867] pci 0000:00:02.1: found [8086:27a6] class 000380 header type 00
[    0.723027] pci 0000:00:02.1: reg 10 32bit mmio: [0xee180000-0xee1fffff]
[    0.723163] pci 0000:00:02.1: calling quirk_resource_alignment+0x0/0x1f0
[    0.723256] pci 0000:00:02.1: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.723512] pci 0000:00:1b.0: found [8086:27d8] class 000403 header type 00
[    0.723648] pci 0000:00:1b.0: reg 10 64bit mmio: [0xee240000-0xee243fff]
[    0.723795] pci 0000:00:1b.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.723888] pci 0000:00:1b.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.724060] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    0.724156] pci 0000:00:1b.0: PME# disabled
[    0.724302] pci 0000:00:1c.0: found [8086:27d0] class 000604 header type 01
[    0.724439] pci 0000:00:1c.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.724532] pci 0000:00:1c.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.724689] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.724784] pci 0000:00:1c.0: PME# disabled
[    0.724935] pci 0000:00:1c.1: found [8086:27d2] class 000604 header type 01
[    0.725049] pci 0000:00:1c.1: calling quirk_resource_alignment+0x0/0x1f0
[    0.725143] pci 0000:00:1c.1: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.725300] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold
[    0.725396] pci 0000:00:1c.1: PME# disabled
[    0.725546] pci 0000:00:1c.2: found [8086:27d4] class 000604 header type 01
[    0.725682] pci 0000:00:1c.2: calling quirk_resource_alignment+0x0/0x1f0
[    0.725774] pci 0000:00:1c.2: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.725932] pci 0000:00:1c.2: PME# supported from D0 D3hot D3cold
[    0.726011] pci 0000:00:1c.2: PME# disabled
[    0.726162] pci 0000:00:1c.3: found [8086:27d6] class 000604 header type 01
[    0.726299] pci 0000:00:1c.3: calling quirk_resource_alignment+0x0/0x1f0
[    0.726393] pci 0000:00:1c.3: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.726551] pci 0000:00:1c.3: PME# supported from D0 D3hot D3cold
[    0.726646] pci 0000:00:1c.3: PME# disabled
[    0.726800] pci 0000:00:1d.0: found [8086:27c8] class 000c03 header type 00
[    0.727037] pci 0000:00:1d.0: reg 20 io port: [0x1820-0x183f]
[    0.727153] pci 0000:00:1d.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.727247] pci 0000:00:1d.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.727383] pci 0000:00:1d.1: found [8086:27c9] class 000c03 header type 00
[    0.727534] pci 0000:00:1d.1: reg 20 io port: [0x1840-0x185f]
[    0.727651] pci 0000:00:1d.1: calling quirk_resource_alignment+0x0/0x1f0
[    0.727744] pci 0000:00:1d.1: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.727878] pci 0000:00:1d.2: found [8086:27ca] class 000c03 header type 00
[    0.728036] pci 0000:00:1d.2: reg 20 io port: [0x1860-0x187f]
[    0.728152] pci 0000:00:1d.2: calling quirk_resource_alignment+0x0/0x1f0
[    0.728245] pci 0000:00:1d.2: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.728377] pci 0000:00:1d.3: found [8086:27cb] class 000c03 header type 00
[    0.728529] pci 0000:00:1d.3: reg 20 io port: [0x1880-0x189f]
[    0.728646] pci 0000:00:1d.3: calling quirk_resource_alignment+0x0/0x1f0
[    0.728740] pci 0000:00:1d.3: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.728895] pci 0000:00:1d.7: found [8086:27cc] class 000c03 header type 00
[    0.729040] pci 0000:00:1d.7: reg 10 32bit mmio: [0xee444000-0xee4443ff]
[    0.729197] pci 0000:00:1d.7: calling quirk_resource_alignment+0x0/0x1f0
[    0.729290] pci 0000:00:1d.7: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.729421] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
[    0.729518] pci 0000:00:1d.7: PME# disabled
[    0.729658] pci 0000:00:1e.0: found [8086:2448] class 000604 header type 01
[    0.729804] pci 0000:00:1e.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.729898] pci 0000:00:1e.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.730082] pci 0000:00:1f.0: found [8086:27b9] class 000601 header type 00
[    0.730290] pci 0000:00:1f.0: calling quirk_ich7_lpc+0x0/0x60
[    0.730387] pci 0000:00:1f.0: quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
[    0.730521] pci 0000:00:1f.0: quirk: region 1180-11bf claimed by ICH6 GPIO
[    0.730616] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 1600 (mask 007f)
[    0.730748] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 2 PIO at 15e0 (mask 000f)
[    0.730881] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 3 PIO at 1680 (mask 001f)
[    0.731009] pci 0000:00:1f.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.731102] pci 0000:00:1f.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.731281] pci 0000:00:1f.1: found [8086:27df] class 000101 header type 00
[    0.731394] pci 0000:00:1f.1: reg 10 io port: [0x00-0x07]
[    0.731493] pci 0000:00:1f.1: reg 14 io port: [0x00-0x03]
[    0.731594] pci 0000:00:1f.1: reg 18 io port: [0x00-0x07]
[    0.731693] pci 0000:00:1f.1: reg 1c io port: [0x00-0x03]
[    0.731793] pci 0000:00:1f.1: reg 20 io port: [0x1810-0x181f]
[    0.731911] pci 0000:00:1f.1: calling quirk_resource_alignment+0x0/0x1f0
[    0.732006] pci 0000:00:1f.1: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.732153] pci 0000:00:1f.2: found [8086:27c5] class 000106 header type 00
[    0.732291] pci 0000:00:1f.2: reg 10 io port: [0x18d0-0x18d7]
[    0.732391] pci 0000:00:1f.2: reg 14 io port: [0x18c4-0x18c7]
[    0.732492] pci 0000:00:1f.2: reg 18 io port: [0x18c8-0x18cf]
[    0.732592] pci 0000:00:1f.2: reg 1c io port: [0x18c0-0x18c3]
[    0.732692] pci 0000:00:1f.2: reg 20 io port: [0x18b0-0x18bf]
[    0.732793] pci 0000:00:1f.2: reg 24 32bit mmio: [0xee444400-0xee4447ff]
[    0.732902] pci 0000:00:1f.2: calling quirk_resource_alignment+0x0/0x1f0
[    0.733006] pci 0000:00:1f.2: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.733143] pci 0000:00:1f.2: PME# supported from D3hot
[    0.733237] pci 0000:00:1f.2: PME# disabled
[    0.733373] pci 0000:00:1f.3: found [8086:27da] class 000c05 header type 00
[    0.733534] pci 0000:00:1f.3: reg 20 io port: [0x18e0-0x18ff]
[    0.733655] pci 0000:00:1f.3: calling quirk_resource_alignment+0x0/0x1f0
[    0.733749] pci 0000:00:1f.3: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.733866] PCI: Fixups for bus 0000:00
[    0.733957] pci 0000:00:1c.0: scanning behind bridge, config 020200, pass 0
[    0.734034] PCI: Scanning bus 0000:02
[    0.734185] pci 0000:02:00.0: found [8086:109a] class 000200 header type 00
[    0.734328] pci 0000:02:00.0: reg 10 32bit mmio: [0xee000000-0xee01ffff]
[    0.734451] pci 0000:02:00.0: reg 18 io port: [0x2000-0x201f]
[    0.734612] pci 0000:02:00.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.734706] pci 0000:02:00.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.734881] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
[    0.735012] pci 0000:02:00.0: PME# disabled
[    0.735240] pci 0000:02:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
[    0.735658] PCI: Fixups for bus 0000:02
[    0.735750] pci 0000:00:1c.0: bridge io port: [0x2000-0x2fff]
[    0.735845] pci 0000:00:1c.0: bridge 32bit mmio: [0xee000000-0xee0fffff]
[    0.735947] PCI: Bus scan for 0000:02 returning with max=02
[    0.736011] pci 0000:00:1c.1: scanning behind bridge, config 030300, pass 0
[    0.736130] PCI: Scanning bus 0000:03
[    0.736350] pci 0000:03:00.0: found [8086:4227] class 000280 header type 00
[    0.736566] pci 0000:03:00.0: reg 10 32bit mmio: [0xedf00000-0xedf00fff]
[    0.736865] pci 0000:03:00.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.737006] pci 0000:03:00.0: calling pci_fixup_transparent_bridge+0x0/0x30
[    0.737271] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
[    0.737414] pci 0000:03:00.0: PME# disabled
[    0.737646] pci 0000:03:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
[    0.738164] PCI: Fixups for bus 0000:03
[    0.738256] pci 0000:00:1c.1: bridge io port: [0x3000-0x4fff]
[    0.738351] pci 0000:00:1c.1: bridge 32bit mmio: [0xec000000-0xedffffff]
[    0.738452] pci 0000:00:1c.1: bridge 64bit mmio pref: [0xe4000000-0xe40fffff]
[    0.738545] PCI: Bus scan for 0000:03 returning with max=03
[    0.738640] pci 0000:00:1c.2: scanning behind bridge, config 0b0400, pass 0
[    0.738759] PCI: Scanning bus 0000:04
[    0.739098] PCI: Fixups for bus 0000:04
[    0.739190] pci 0000:00:1c.2: bridge io port: [0x5000-0x6fff]
[    0.739285] pci 0000:00:1c.2: bridge 32bit mmio: [0xe8000000-0xe9ffffff]
[    0.740014] pci 0000:00:1c.2: bridge 64bit mmio pref: [0xe4100000-0xe41fffff]
[    0.740107] PCI: Bus scan for 0000:04 returning with max=04
[    0.740202] pci 0000:00:1c.3: scanning behind bridge, config 130c00, pass 0
[    0.740320] PCI: Scanning bus 0000:0c
[    0.740500] PCI: Fixups for bus 0000:0c
[    0.740591] pci 0000:00:1c.3: bridge io port: [0x7000-0x8fff]
[    0.740686] pci 0000:00:1c.3: bridge 32bit mmio: [0xea000000-0xebffffff]
[    0.740788] pci 0000:00:1c.3: bridge 64bit mmio pref: [0xe4200000-0xe42fffff]
[    0.740880] PCI: Bus scan for 0000:0c returning with max=0c
[    0.740974] pci 0000:00:1e.0: scanning behind bridge, config 181500, pass 0
[    0.741030] PCI: Scanning bus 0000:15
[    0.741161] pci 0000:15:00.0: found [104c:ac56] class 000607 header type 02
[    0.741296] pci 0000:15:00.0: reg 10 32bit mmio: [0xe4300000-0xe4300fff]
[    0.741397] pci 0000:15:00.0: calling quirk_resource_alignment+0x0/0x1f0
[    0.741525] pci 0000:15:00.0: supports D1 D2
[    0.741613] pci 0000:15:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.741710] pci 0000:15:00.0: PME# disabled
[    0.742013] PCI: Fixups for bus 0000:15
[    0.742099] pci 0000:00:1e.0: transparent bridge
[    0.742191] pci 0000:00:1e.0: bridge io port: [0x9000-0xcfff]
[    0.742286] pci 0000:00:1e.0: bridge 32bit mmio: [0xe4300000-0xe7ffffff]
[    0.742388] pci 0000:00:1e.0: bridge 64bit mmio pref: [0xe0000000-0xe3ffffff]
[    0.742484] pci 0000:15:00.0: scanning behind bridge, config 181615, pass 0
[    0.742587] pci 0000:15:00.0: scanning behind bridge, config 181615, pass 1
[    0.742726] PCI: Bus scan for 0000:15 returning with max=17
[    0.742822] pci 0000:00:1c.0: scanning behind bridge, config 020200, pass 1
[    0.742924] pci 0000:00:1c.1: scanning behind bridge, config 030300, pass 1
[    0.743014] pci 0000:00:1c.2: scanning behind bridge, config 0b0400, pass 1
[    0.743117] pci 0000:00:1c.3: scanning behind bridge, config 130c00, pass 1
[    0.743219] pci 0000:00:1e.0: scanning behind bridge, config 181500, pass 1
[    0.743319] PCI: Bus scan for 0000:00 returning with max=18
[    0.743437] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[    0.747843] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP0._PRT]
[    0.749442] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP1._PRT]
[    0.751046] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP2._PRT]
[    0.752754] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP3._PRT]
[    0.754473] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
[    0.763497] PM: Adding info for pci:0000:00:00.0
[    0.769825] PM: Adding info for pci:0000:00:02.0
[    0.776847] PM: Adding info for pci:0000:00:02.1
[    0.783130] PM: Adding info for pci:0000:00:1b.0
[    0.789756] PM: Adding info for pci:0000:00:1c.0
[    0.796169] PM: Adding info for pci:0000:00:1c.1
[    0.802409] PM: Adding info for pci:0000:00:1c.2
[    0.809061] PM: Adding info for pci:0000:00:1c.3
[    0.815466] PM: Adding info for pci:0000:00:1d.0
[    0.821903] PM: Adding info for pci:0000:00:1d.1
[    0.828484] PM: Adding info for pci:0000:00:1d.2
[    0.834774] PM: Adding info for pci:0000:00:1d.3
[    0.841248] PM: Adding info for pci:0000:00:1d.7
[    0.847445] PM: Adding info for pci:0000:00:1e.0
[    0.854036] PM: Adding info for pci:0000:00:1f.0
[    0.860390] PM: Adding info for pci:0000:00:1f.1
[    0.866797] PM: Adding info for pci:0000:00:1f.2
[    0.873194] PM: Adding info for pci:0000:00:1f.3
[    0.873882] PM: Adding info for pci:0000:02:00.0
[    0.874504] PM: Adding info for No Bus:0000:02
[    0.875225] PM: Adding info for pci:0000:03:00.0
[    0.875741] PM: Adding info for No Bus:0000:03
[    0.876301] PM: Adding info for No Bus:0000:04
[    0.876836] PM: Adding info for No Bus:0000:0c
[    0.878405] PM: Adding info for pci:0000:15:00.0
[    0.878926] PM: Adding info for No Bus:0000:16
[    0.879511] PM: Adding info for No Bus:0000:15
[    0.880349] initcall acpi_pci_root_init+0x0/0x30 returned 0 after 157226 usecs
[    0.880479] calling  acpi_pci_link_init+0x0/0x40 @ 1
[    0.882896] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11)
[    0.885839] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11)
[    0.888776] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 9 10 *11)
[    0.891719] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11)
[    0.894654] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11)
[    0.897592] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 *11)
[    0.900540] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 *11)
[    0.903559] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 10 *11)
[    0.904796] initcall acpi_pci_link_init+0x0/0x40 returned 0 after 23437 usecs
[    0.904891] calling  pnp_init+0x0/0x10 @ 1
[    0.905854] initcall pnp_init+0x0/0x10 returned 0 after 976 usecs
[    0.905947] calling  misc_init+0x0/0xb0 @ 1
[    0.906377] initcall misc_init+0x0/0xb0 returned 0 after 0 usecs
[    0.906469] calling  init_scsi+0x0/0xa0 @ 1
[    0.908722] SCSI subsystem initialized
[    0.908812] initcall init_scsi+0x0/0xa0 returned 0 after 1953 usecs
[    0.908903] calling  ata_init+0x0/0x3a0 @ 1
[    0.909302] libata version 3.00 loaded.
[    0.909392] initcall ata_init+0x0/0x3a0 returned 0 after 976 usecs
[    0.909484] calling  phy_init+0x0/0x30 @ 1
[    0.910556] initcall phy_init+0x0/0x30 returned 0 after 976 usecs
[    0.910649] calling  usb_init+0x0/0x1a0 @ 1
[    0.911716] usbcore: registered new interface driver usbfs
[    0.912512] usbcore: registered new interface driver hub
[    0.913062] usbcore: registered new device driver usb
[    0.913153] initcall usb_init+0x0/0x1a0 returned 0 after 2929 usecs
[    0.913246] calling  serio_init+0x0/0xa0 @ 1
[    0.913786] initcall serio_init+0x0/0xa0 returned 0 after 0 usecs
[    0.913879] calling  gameport_init+0x0/0xa0 @ 1
[    0.914536] initcall gameport_init+0x0/0xa0 returned 0 after 976 usecs
[    0.914630] calling  input_init+0x0/0x130 @ 1
[    0.915200] initcall input_init+0x0/0x130 returned 0 after 976 usecs
[    0.915293] calling  rtc_init+0x0/0x70 @ 1
[    0.915679] initcall rtc_init+0x0/0x70 returned 0 after 0 usecs
[    0.915771] calling  power_supply_class_init+0x0/0x30 @ 1
[    0.916245] initcall power_supply_class_init+0x0/0x30 returned 0 after 976 usecs
[    0.916375] calling  hwmon_init+0x0/0x100 @ 1
[    0.916779] initcall hwmon_init+0x0/0x100 returned 0 after 0 usecs
[    0.916872] calling  leds_init+0x0/0x40 @ 1
[    0.917369] initcall leds_init+0x0/0x40 returned 0 after 976 usecs
[    0.917462] calling  acpi_wmi_init+0x0/0x70 @ 1
[    0.917903] ACPI: WMI: Mapper loaded
[    0.917992] initcall acpi_wmi_init+0x0/0x70 returned 0 after 0 usecs
[    0.918098] calling  pci_subsys_init+0x0/0x130 @ 1
[    0.918187] PCI: Using ACPI for IRQ routing
[    0.920253] initcall pci_subsys_init+0x0/0x130 returned 0 after 1953 usecs
[    0.920346] calling  proto_init+0x0/0x10 @ 1
[    0.920458] initcall proto_init+0x0/0x10 returned 0 after 0 usecs
[    0.920549] calling  net_dev_init+0x0/0x160 @ 1
[    0.921766] PM: Adding info for No Bus:lo
[    0.922376] initcall net_dev_init+0x0/0x160 returned 0 after 1953 usecs
[    0.922469] calling  neigh_init+0x0/0x80 @ 1
[    0.922558] initcall neigh_init+0x0/0x80 returned 0 after 0 usecs
[    0.922649] calling  fib_rules_init+0x0/0xb0 @ 1
[    0.922743] initcall fib_rules_init+0x0/0xb0 returned 0 after 0 usecs
[    0.922834] calling  pktsched_init+0x0/0xd0 @ 1
[    0.922958] initcall pktsched_init+0x0/0xd0 returned 0 after 0 usecs
[    0.923071] calling  tc_filter_init+0x0/0x60 @ 1
[    0.923159] initcall tc_filter_init+0x0/0x60 returned 0 after 0 usecs
[    0.923250] calling  tc_action_init+0x0/0x60 @ 1
[    0.923339] initcall tc_action_init+0x0/0x60 returned 0 after 0 usecs
[    0.923430] calling  genl_init+0x0/0xd0 @ 1
[    0.926089] initcall genl_init+0x0/0xd0 returned 0 after 2929 usecs
[    0.926182] calling  wanrouter_init+0x0/0x60 @ 1
[    0.926270] Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.
[    0.926455] initcall wanrouter_init+0x0/0x60 returned 0 after 0 usecs
[    0.926547] calling  wireless_nlevent_init+0x0/0x40 @ 1
[    0.926637] initcall wireless_nlevent_init+0x0/0x40 returned 0 after 0 usecs
[    0.926732] calling  cfg80211_init+0x0/0x80 @ 1
[    0.941206] PM: Adding info for platform:regulatory.0
[    0.941547] cfg80211: Using static regulatory domain info
[    0.941638] cfg80211: Regulatory domain: US
[    0.941725] 	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    0.941854] 	(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[    0.941946] 	(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.942006] 	(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.942098] 	(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.942190] 	(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[    0.942283] 	(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[    0.942501] cfg80211: Calling CRDA for country: US
[    0.943128] initcall cfg80211_init+0x0/0x80 returned 0 after 16601 usecs
[    0.943222] calling  sysctl_init+0x0/0x40 @ 1
[    0.943314] initcall sysctl_init+0x0/0x40 returned 0 after 0 usecs
[    0.943407] calling  pci_iommu_init+0x0/0x20 @ 1
[    1.091247] DMA-API: preallocated 32768 debug entries
[    1.091344] DMA-API: debugging enabled by kernel config
[    1.091452] initcall pci_iommu_init+0x0/0x20 returned 0 after 144531 usecs
[    1.091547] calling  print_all_ICs+0x0/0x510 @ 1
[    1.091635] 
[    1.091636] printing PIC contents
[    1.091803] ... PIC  IMR: ffff
[    1.091890] ... PIC  IRR: 0801
[    1.091984] ... PIC  ISR: 0000
[    1.092009] ... PIC ELCR: 0800
[    1.092096] printing local APIC contents on CPU#0/0:
[    1.092184] ... APIC ID:      00000000 (0)
[    1.092270] ... APIC VERSION: 00050014
[    1.092356] ... APIC TASKPRI: 00000000 (00)
[    1.092443] ... APIC PROCPRI: 00000000
[    1.092529] ... APIC LDR: 01000000
[    1.092614] ... APIC DFR: ffffffff
[    1.092700] ... APIC SPIV: 000001ff
[    1.092784] ... APIC ISR field:
[    1.092870] 0000000000000000000000000000000000000000000000000000000000000000
[    1.092999] ... APIC TMR field:
[    1.092999] 0000000002000000000000000000000000000000000000000000000000000000
[    1.092999] ... APIC IRR field:
[    1.092999] 0000000000000000000000000000000000000000000000000000000000008000
[    1.092999] ... APIC ESR: 00000000
[    1.092999] ... APIC ICR: 000008fb
[    1.092999] ... APIC ICR2: 02000000
[    1.092999] ... APIC LVTT: 000200ef
[    1.092999] ... APIC LVTPC: 00010000
[    1.092999] ... APIC LVT0: 00010700
[    1.092999] ... APIC LVT1: 00000400
[    1.092999] ... APIC LVTERR: 000000fe
[    1.092999] ... APIC TMICT: 00002895
[    1.092999] ... APIC TMCCT: 000001f0
[    1.092999] ... APIC TDCR: 00000003
[    1.092999] 
[    1.092997] printing local APIC contents on CPU#1/1:
[    1.092997] ... APIC ID:      01000000 (1)
[    1.092997] ... APIC VERSION: 00050014
[    1.092997] ... APIC TASKPRI: 00000000 (00)
[    1.092997] ... APIC PROCPRI: 00000000
[    1.092997] ... APIC LDR: 02000000
[    1.092997] ... APIC DFR: ffffffff
[    1.092997] ... APIC SPIV: 000001ff
[    1.092997] ... APIC ISR field:
[    1.092997] 0000000000000000000000000000000000000000000000000000000000000000
[    1.092999] ... APIC TMR field:
[    1.092999] 0000000000000000000000000000000000000000000000000000000000000000
[    1.092999] ... APIC IRR field:
[    1.092999] 0000000000000000000000000000000000000000000000000000000000008000
[    1.092999] ... APIC ESR: 00000000
[    1.092999] ... APIC ICR: 000008fd
[    1.092999] ... APIC ICR2: 01000000
[    1.092999] ... APIC LVTT: 000200ef
[    1.092999] ... APIC LVTPC: 00010000
[    1.092999] ... APIC LVT0: 00010700
[    1.092999] ... APIC LVT1: 00010400
[    1.092999] ... APIC LVTERR: 000000fe
[    1.092999] ... APIC TMICT: 00002895
[    1.092999] ... APIC TMCCT: 000023d4
[    1.092999] ... APIC TDCR: 00000003
[    1.092999] 
[    1.096481] number of MP IRQ sources: 15.
[    1.096569] number of IO-APIC #1 registers: 24.
[    1.096656] testing the IO APIC.......................
[    1.096752] 
[    1.096834] IO APIC #1......
[    1.096917] .... register #00: 02000000
[    1.097003] .......    : physical APIC id: 02
[    1.097090] .......    : Delivery Type: 0
[    1.097177] .......    : LTS          : 0
[    1.097263] .... register #01: 00170020
[    1.097349] .......     : max redirection entries: 0017
[    1.097437] .......     : PRQ implemented: 0
[    1.097524] .......     : IO APIC version: 0020
[    1.097611] .... IRQ redirection table:
[    1.097696]  NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:   
[    1.097789]  00 000 1    0    0   0   0    0    0    00
[    1.097926]  01 003 0    0    0   0   0    1    1    31
[    1.098007]  02 003 0    0    0   0   0    1    1    30
[    1.098144]  03 003 0    0    0   0   0    1    1    33
[    1.098281]  04 003 0    0    0   0   0    1    1    34
[    1.098416]  05 003 0    0    0   0   0    1    1    35
[    1.098552]  06 003 0    0    0   0   0    1    1    36
[    1.098688]  07 003 0    0    0   0   0    1    1    37
[    1.098824]  08 003 0    0    0   0   0    1    1    38
[    1.099009]  09 003 0    1    0   0   0    1    1    39
[    1.099146]  0a 003 0    0    0   0   0    1    1    3A
[    1.099283]  0b 003 0    0    0   0   0    1    1    3B
[    1.099419]  0c 003 0    0    0   0   0    1    1    3C
[    1.099556]  0d 003 0    0    0   0   0    1    1    3D
[    1.099693]  0e 003 0    0    0   0   0    1    1    3E
[    1.099828]  0f 003 0    0    0   0   0    1    1    3F
[    1.099965]  10 000 1    0    0   0   0    0    0    00
[    1.100092]  11 000 1    0    0   0   0    0    0    00
[    1.100228]  12 000 1    0    0   0   0    0    0    00
[    1.100364]  13 000 1    0    0   0   0    0    0    00
[    1.100501]  14 000 1    0    0   0   0    0    0    00
[    1.100636]  15 000 1    0    0   0   0    0    0    00
[    1.100773]  16 000 1    0    0   0   0    0    0    00
[    1.100909]  17 000 1    0    0   0   0    0    0    00
[    1.101088] IRQ to pin mappings:
[    1.101174] IRQ0 -> 0:2
[    1.101343] IRQ1 -> 0:1
[    1.101512] IRQ3 -> 0:3
[    1.101681] IRQ4 -> 0:4
[    1.101851] IRQ5 -> 0:5
[    1.102003] IRQ6 -> 0:6
[    1.102172] IRQ7 -> 0:7
[    1.102340] IRQ8 -> 0:8
[    1.102509] IRQ9 -> 0:9
[    1.102678] IRQ10 -> 0:10
[    1.102847] IRQ11 -> 0:11
[    1.103005] IRQ12 -> 0:12
[    1.103174] IRQ13 -> 0:13
[    1.103342] IRQ14 -> 0:14
[    1.103511] IRQ15 -> 0:15
[    1.103794] .................................... done.
[    1.103885] initcall print_all_ICs+0x0/0x510 returned 0 after 11718 usecs
[    1.104007] calling  clocksource_done_booting+0x0/0x20 @ 1
[    1.104098] Switching to clocksource jiffies
[    1.104187] initcall clocksource_done_booting+0x0/0x20 returned 0 after 0 usecs
[    1.104316] calling  rb_init_debugfs+0x0/0x30 @ 1
[    1.104485] initcall rb_init_debugfs+0x0/0x30 returned 0 after 0 usecs
[    1.104578] calling  tracer_init_debugfs+0x0/0x300 @ 1
[    1.105718] initcall tracer_init_debugfs+0x0/0x300 returned 0 after 976 usecs
[    1.105812] calling  init_trace_printk_function_export+0x0/0x40 @ 1
[    1.105924] initcall init_trace_printk_function_export+0x0/0x40 returned 0 after 0 usecs
[    1.106006] calling  event_trace_init+0x0/0x220 @ 1
[    1.135539] initcall event_trace_init+0x0/0x220 returned 0 after 28320 usecs
[    1.135638] calling  init_pipe_fs+0x0/0x60 @ 1
[    1.135931] initcall init_pipe_fs+0x0/0x60 returned 0 after 0 usecs
[    1.136007] calling  eventpoll_init+0x0/0xa0 @ 1
[    1.136140] initcall eventpoll_init+0x0/0xa0 returned 0 after 0 usecs
[    1.136233] calling  anon_inode_init+0x0/0x110 @ 1
[    1.136484] initcall anon_inode_init+0x0/0x110 returned 0 after 0 usecs
[    1.136578] calling  tomoyo_initerface_init+0x0/0x110 @ 1
[    1.137158] initcall tomoyo_initerface_init+0x0/0x110 returned 0 after 976 usecs
[    1.137288] calling  blk_scsi_ioctl_init+0x0/0x330 @ 1
[    1.137379] initcall blk_scsi_ioctl_init+0x0/0x330 returned 0 after 0 usecs
[    1.137473] calling  acpi_event_init+0x0/0x50 @ 1
[    1.140065] initcall acpi_event_init+0x0/0x50 returned 0 after 2929 usecs
[    1.140159] calling  pnpacpi_init+0x0/0xa0 @ 1
[    1.140246] pnp: PnP ACPI init
[    1.140431] PM: Adding info for No Bus:pnp0
[    1.140522] ACPI: bus type pnp registered
[    1.156748] PM: Adding info for pnp:00:00
[    1.157746] PM: Adding info for pnp:00:01
[    1.159793] PM: Adding info for pnp:00:02
[    1.161319] PM: Adding info for pnp:00:03
[    1.162223] PM: Adding info for pnp:00:04
[    1.163045] PM: Adding info for pnp:00:05
[    1.163596] IOAPIC[0]: Set routing entry (1-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    1.164263] PM: Adding info for pnp:00:06
[    1.164785] IOAPIC[0]: Set routing entry (1-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    1.165285] PM: Adding info for pnp:00:07
[    1.165819] IOAPIC[0]: Set routing entry (1-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    1.166266] PM: Adding info for pnp:00:08
[    1.166781] IOAPIC[0]: Set routing entry (1-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    1.167245] PM: Adding info for pnp:00:09
[    1.177388] IOAPIC[0]: Set routing entry (1-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
[    1.178171] PM: Adding info for pnp:00:0a
[    1.188025] pnp: PnP ACPI: found 11 devices
[    1.188115] ACPI: ACPI bus type pnp unregistered
[    1.188209] initcall pnpacpi_init+0x0/0xa0 returned 0 after 46875 usecs
[    1.188301] calling  pnpbios_init+0x0/0x400 @ 1
[    1.188391] PnPBIOS: Disabled by ACPI PNP
[    1.188479] initcall pnpbios_init+0x0/0x400 returned -19 after 0 usecs
[    1.188571] calling  pnp_system_init+0x0/0x10 @ 1
[    1.188758] system 00:00: iomem range 0x0-0x9ffff could not be reserved
[    1.188873] system 00:00: iomem range 0xc0000-0xc3fff could not be reserved
[    1.188986] system 00:00: iomem range 0xc4000-0xc7fff could not be reserved
[    1.189025] system 00:00: iomem range 0xc8000-0xcbfff has been reserved
[    1.189140] system 00:00: iomem range 0xcc000-0xcffff could not be reserved
[    1.189255] system 00:00: iomem range 0xd0000-0xd3fff could not be reserved
[    1.189369] system 00:00: iomem range 0xdc000-0xdffff could not be reserved
[    1.189483] system 00:00: iomem range 0xe0000-0xe3fff could not be reserved
[    1.189597] system 00:00: iomem range 0xe4000-0xe7fff could not be reserved
[    1.189711] system 00:00: iomem range 0xe8000-0xebfff could not be reserved
[    1.189826] system 00:00: iomem range 0xec000-0xeffff could not be reserved
[    1.190029] system 00:00: iomem range 0xf0000-0xfffff could not be reserved
[    1.190143] system 00:00: iomem range 0x100000-0x7fffffff could not be reserved
[    1.190300] system 00:00: iomem range 0xfec00000-0xffffffff could not be reserved
[    1.190488] system 00:02: ioport range 0x164e-0x164f has been reserved
[    1.190594] system 00:02: ioport range 0x1000-0x107f has been reserved
[    1.190700] system 00:02: ioport range 0x1180-0x11bf has been reserved
[    1.190807] system 00:02: ioport range 0x800-0x80f has been reserved
[    1.190912] system 00:02: ioport range 0x15e0-0x15ef has been reserved
[    1.191028] system 00:02: ioport range 0x1600-0x165f could not be reserved
[    1.191136] system 00:02: iomem range 0xf0000000-0xf3ffffff has been reserved
[    1.191249] system 00:02: iomem range 0xfed1c000-0xfed1ffff has been reserved
[    1.191357] system 00:02: iomem range 0xfed14000-0xfed17fff has been reserved
[    1.191465] system 00:02: iomem range 0xfed18000-0xfed18fff has been reserved
[    1.192020] system 00:02: iomem range 0xfed19000-0xfed19fff has been reserved
[    1.192419] initcall pnp_system_init+0x0/0x10 returned 0 after 3906 usecs
[    1.192513] calling  chr_dev_init+0x0/0xf0 @ 1
[    1.193443] PM: Adding info for No Bus:mem
[    1.193958] PM: Adding info for No Bus:kmem
[    1.194395] PM: Adding info for No Bus:null
[    1.194878] PM: Adding info for No Bus:port
[    1.195695] PM: Adding info for No Bus:zero
[    1.196191] PM: Adding info for No Bus:full
[    1.196642] PM: Adding info for No Bus:random
[    1.197129] PM: Adding info for No Bus:urandom
[    1.197603] PM: Adding info for No Bus:kmsg
[    1.197964] initcall chr_dev_init+0x0/0xf0 returned 0 after 4882 usecs
[    1.198007] calling  firmware_class_init+0x0/0x80 @ 1
[    1.198396] initcall firmware_class_init+0x0/0x80 returned 0 after 0 usecs
[    1.198492] calling  cpufreq_gov_performance_init+0x0/0x10 @ 1
[    1.198605] initcall cpufreq_gov_performance_init+0x0/0x10 returned 0 after 0 usecs
[    1.198736] calling  init_acpi_pm_clocksource+0x0/0x250 @ 1
[    1.233442] Switching to clocksource acpi_pm
[    1.233626] 
[    1.233627] =======================================================
[    1.233798] [ INFO: possible circular locking dependency detected ]
[    1.233889] 2.6.31-rc6-tip-01322-gd685ec8-dirty #7600
[    1.233977] -------------------------------------------------------
[    1.233999] swapper/1 is trying to acquire lock:
[    1.233999]  (cpu_add_remove_lock){+.+.+.}, at: [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999] 
[    1.233999] but task is already holding lock:
[    1.233999]  (setup_lock){+.+.+.}, at: [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999] 
[    1.233999] which lock already depends on the new lock.
[    1.233999] 
[    1.233999] 
[    1.233999] the existing dependency chain (in reverse order) is:
[    1.233999] 
[    1.233999] -> #3 (setup_lock){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999]        [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]        [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]        [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]        [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]        [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]        [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]        [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #2 (clocksource_mutex){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c105e21d>] clocksource_change_rating+0x1d/0x40
[    1.233999]        [<c100877c>] mark_tsc_unstable+0x4c/0x50
[    1.233999]        [<c15b18df>] check_tsc_sync_source+0x10f/0x120
[    1.233999]        [<c15b0b63>] native_cpu_up+0x423/0x800
[    1.233999]        [<c15b27c9>] _cpu_up+0x89/0x110
[    1.233999]        [<c15b28c9>] cpu_up+0x49/0x70
[    1.233999]        [<c18c598c>] kernel_init+0xcc/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #1 (cpu_hotplug.lock){+.+.+.}:
[    1.233999]        [<c1068410>] validate_chain+0xad0/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c103e70d>] cpu_hotplug_begin+0x1d/0x50
[    1.233999]        [<c15b279b>] _cpu_up+0x5b/0x110
[    1.233999]        [<c15b28c9>] cpu_up+0x49/0x70
[    1.233999]        [<c18c598c>] kernel_init+0xcc/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] -> #0 (cpu_add_remove_lock){+.+.+.}:
[    1.233999]        [<c1068a55>] validate_chain+0x1115/0x1130
[    1.233999]        [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]        [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]        [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]        [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]        [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999]        [<c1050230>] __create_workqueue_key+0x100/0x1f0
[    1.233999]        [<c10788d2>] stop_machine_create+0x42/0xa0
[    1.233999]        [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]        [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]        [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]        [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]        [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]        [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]        [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]        [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.233999] 
[    1.233999] other info that might help us debug this:
[    1.233999] 
[    1.233999] 2 locks held by swapper/1:
[    1.233999]  #0:  (clocksource_mutex){+.+.+.}, at: [<c105e256>] clocksource_register+0x16/0x1e0
[    1.233999]  #1:  (setup_lock){+.+.+.}, at: [<c10788a2>] stop_machine_create+0x12/0xa0
[    1.233999] 
[    1.233999] stack backtrace:
[    1.233999] Pid: 1, comm: swapper Not tainted 2.6.31-rc6-tip-01322-gd685ec8-dirty #7600
[    1.233999] Call Trace:
[    1.233999]  [<c10666fb>] print_circular_bug+0xbb/0xd0
[    1.233999]  [<c1068a55>] validate_chain+0x1115/0x1130
[    1.233999]  [<c1068db1>] __lock_acquire+0x341/0x690
[    1.233999]  [<c106918e>] lock_acquire+0x8e/0xf0
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c15b55b9>] __mutex_lock_common+0x49/0x3d0
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c15b53d8>] ? mutex_unlock+0x8/0x10
[    1.233999]  [<c10d566b>] ? pcpu_alloc+0x30b/0x400
[    1.233999]  [<c10d605b>] ? kmemleak_alloc+0x2b/0x60
[    1.233999]  [<c15b59e9>] mutex_lock_nested+0x29/0x40
[    1.233999]  [<c103e6af>] ? cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c103e6af>] cpu_maps_update_begin+0xf/0x20
[    1.233999]  [<c1050230>] __create_workqueue_key+0x100/0x1f0
[    1.233999]  [<c15b59e9>] ? mutex_lock_nested+0x29/0x40
[    1.233999]  [<c10788d2>] stop_machine_create+0x42/0xa0
[    1.233999]  [<c107894b>] stop_machine+0x1b/0x50
[    1.233999]  [<c105c170>] ? change_clocksource+0x0/0x70
[    1.233999]  [<c105c319>] timekeeping_notify+0x19/0x20
[    1.233999]  [<c105df94>] clocksource_select+0x84/0xb0
[    1.233999]  [<c105e262>] clocksource_register+0x22/0x1e0
[    1.233999]  [<c11ee57e>] ? __const_udelay+0x2e/0x30
[    1.233999]  [<c1901c1c>] init_acpi_pm_clocksource+0x16c/0x250
[    1.233999]  [<c105d16f>] ? ktime_get+0x5f/0x110
[    1.233999]  [<c1901ab0>] ? init_acpi_pm_clocksource+0x0/0x250
[    1.233999]  [<c1001127>] do_one_initcall+0x27/0x190
[    1.233999]  [<c1901ab0>] ? init_acpi_pm_clocksource+0x0/0x250
[    1.233999]  [<c18c5a0a>] kernel_init+0x14a/0x1a0
[    1.233999]  [<c18c58c0>] ? kernel_init+0x0/0x1a0
[    1.233999]  [<c1003bc3>] kernel_thread_helper+0x7/0x14
[    1.234233] initcall init_acpi_pm_clocksource+0x0/0x250 returned 0 after 35202 usecs
[    1.234365] calling  ssb_modinit+0x0/0x60 @ 1
[    1.234455] Switched to high resolution mode on CPU 0
[    1.234376] Switched to high resolution mode on CPU 1
[    1.234777] initcall ssb_modinit+0x0/0x60 returned 0 after 293 usecs
[    1.234869] calling  pcibios_assign_resources+0x0/0xa0 @ 1
[    1.235211] pci 0000:00:1c.0: PCI bridge, secondary bus 0000:02
[    1.235312] pci 0000:00:1c.0:   IO window: 0x2000-0x2fff
[    1.235407] pci 0000:00:1c.0:   MEM window: 0xee000000-0xee0fffff
[    1.235502] pci 0000:00:1c.0:   PREFETCH window: disabled
[    1.235595] pci 0000:00:1c.1: PCI bridge, secondary bus 0000:03
[    1.235687] pci 0000:00:1c.1:   IO window: 0x3000-0x4fff
[    1.235781] pci 0000:00:1c.1:   MEM window: 0xec000000-0xedffffff
[    1.235876] pci 0000:00:1c.1:   PREFETCH window: 0x000000e4000000-0x000000e40fffff
[    1.236066] pci 0000:00:1c.2: PCI bridge, secondary bus 0000:04
[    1.236159] pci 0000:00:1c.2:   IO window: 0x5000-0x6fff
[    1.236255] pci 0000:00:1c.2:   MEM window: 0xe8000000-0xe9ffffff
[    1.236350] pci 0000:00:1c.2:   PREFETCH window: 0x000000e4100000-0x000000e41fffff
[    1.236486] pci 0000:00:1c.3: PCI bridge, secondary bus 0000:0c
[    1.236579] pci 0000:00:1c.3:   IO window: 0x7000-0x8fff
[    1.236673] pci 0000:00:1c.3:   MEM window: 0xea000000-0xebffffff
[    1.236767] pci 0000:00:1c.3:   PREFETCH window: 0x000000e4200000-0x000000e42fffff
[    1.236946] pci 0000:15:00.0: CardBus bridge, secondary bus 0000:16
[    1.237054] pci 0000:15:00.0:   IO window: 0x009000-0x0090ff
[    1.237149] pci 0000:15:00.0:   IO window: 0x009400-0x0094ff
[    1.237244] pci 0000:15:00.0:   PREFETCH window: 0xe0000000-0xe3ffffff
[    1.237341] pci 0000:15:00.0:   MEM window: 0x80000000-0x83ffffff
[    1.237437] pci 0000:00:1e.0: PCI bridge, secondary bus 0000:15
[    1.237529] pci 0000:00:1e.0:   IO window: 0x9000-0xcfff
[    1.237623] pci 0000:00:1e.0:   MEM window: 0xe4300000-0xe7ffffff
[    1.237718] pci 0000:00:1e.0:   PREFETCH window: 0x000000e0000000-0x000000e3ffffff
[    1.237877] IOAPIC[0]: Set routing entry (1-20 -> 0x49 -> IRQ 20 Mode:1 Active:1)
[    1.238025] pci 0000:00:1c.0: PCI INT A -> GSI 20 (level, low) -> IRQ 20
[    1.238901] pci 0000:00:1c.0: setting latency timer to 64
[    1.239023] IOAPIC[0]: Set routing entry (1-21 -> 0x51 -> IRQ 21 Mode:1 Active:1)
[    1.239154] pci 0000:00:1c.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21
[    1.239249] pci 0000:00:1c.1: setting latency timer to 64
[    1.239358] IOAPIC[0]: Set routing entry (1-22 -> 0x59 -> IRQ 22 Mode:1 Active:1)
[    1.239491] pci 0000:00:1c.2: PCI INT C -> GSI 22 (level, low) -> IRQ 22
[    1.239587] pci 0000:00:1c.2: setting latency timer to 64
[    1.239693] IOAPIC[0]: Set routing entry (1-23 -> 0x61 -> IRQ 23 Mode:1 Active:1)
[    1.239824] pci 0000:00:1c.3: PCI INT D -> GSI 23 (level, low) -> IRQ 23
[    1.239920] pci 0000:00:1c.3: setting latency timer to 64
[    1.240030] pci 0000:00:1e.0: enabling device (0005 -> 0007)
[    1.240126] pci 0000:00:1e.0: setting latency timer to 64
[    1.240235] IOAPIC[0]: Set routing entry (1-16 -> 0x69 -> IRQ 16 Mode:1 Active:1)
[    1.240366] pci 0000:15:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    1.240463] pci_bus 0000:00: resource 0 io:  [0x00-0xffff]
[    1.240553] pci_bus 0000:00: resource 1 mem: [0x000000-0xffffffffffffffff]
[    1.240647] pci_bus 0000:02: resource 0 io:  [0x2000-0x2fff]
[    1.240737] pci_bus 0000:02: resource 1 mem: [0xee000000-0xee0fffff]
[    1.240828] pci_bus 0000:03: resource 0 io:  [0x3000-0x4fff]
[    1.240919] pci_bus 0000:03: resource 1 mem: [0xec000000-0xedffffff]
[    1.241025] pci_bus 0000:03: resource 2 pref mem [0xe4000000-0xe40fffff]
[    1.241117] pci_bus 0000:04: resource 0 io:  [0x5000-0x6fff]
[    1.241207] pci_bus 0000:04: resource 1 mem: [0xe8000000-0xe9ffffff]
[    1.241303] pci_bus 0000:04: resource 2 pref mem [0xe4100000-0xe41fffff]
[    1.241395] pci_bus 0000:0c: resource 0 io:  [0x7000-0x8fff]
[    1.241485] pci_bus 0000:0c: resource 1 mem: [0xea000000-0xebffffff]
[    1.241576] pci_bus 0000:0c: resource 2 pref mem [0xe4200000-0xe42fffff]
[    1.241669] pci_bus 0000:15: resource 0 io:  [0x9000-0xcfff]
[    1.241759] pci_bus 0000:15: resource 1 mem: [0xe4300000-0xe7ffffff]
[    1.241850] pci_bus 0000:15: resource 2 pref mem [0xe0000000-0xe3ffffff]
[    1.241942] pci_bus 0000:15: resource 3 io:  [0x00-0xffff]
[    1.242046] pci_bus 0000:15: resource 4 mem: [0x000000-0xffffffffffffffff]
[    1.242138] pci_bus 0000:16: resource 0 io:  [0x9000-0x90ff]
[    1.242228] pci_bus 0000:16: resource 1 io:  [0x9400-0x94ff]
[    1.242322] pci_bus 0000:16: resource 2 pref mem [0xe0000000-0xe3ffffff]
[    1.242415] pci_bus 0000:16: resource 3 mem: [0x80000000-0x83ffffff]
[    1.242509] initcall pcibios_assign_resources+0x0/0xa0 returned 0 after 7368 usecs
[    1.242637] calling  sysctl_core_init+0x0/0x30 @ 1
[    1.242791] initcall sysctl_core_init+0x0/0x30 returned 0 after 62 usecs
[    1.242884] calling  inet_init+0x0/0x200 @ 1
[    1.243039] NET: Registered protocol family 2
[    1.243381] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
[    1.244509] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
[    1.246277] TCP bind hash table entries: 65536 (order: 9, 2621440 bytes)
[    1.248554] TCP: Hash tables configured (established 131072 bind 65536)
[    1.248652] TCP reno registered
[    1.249134] initcall inet_init+0x0/0x200 returned 0 after 6007 usecs
[    1.249231] calling  af_unix_init+0x0/0x60 @ 1
[    1.249338] NET: Registered protocol family 1
[    1.249473] initcall af_unix_init+0x0/0x60 returned 0 after 145 usecs
[    1.249566] calling  default_rootfs+0x0/0x90 @ 1
[    1.249751] initcall default_rootfs+0x0/0x90 returned 0 after 92 usecs
[    1.249843] calling  i8259A_init_sysfs+0x0/0x30 @ 1
[    1.250503] initcall i8259A_init_sysfs+0x0/0x30 returned 0 after 553 usecs
[    1.250596] calling  sbf_init+0x0/0xd0 @ 1
[    1.250690] Simple Boot Flag at 0x35 set to 0x1
[    1.250783] initcall sbf_init+0x0/0xd0 returned 0 after 96 usecs
[    1.250874] calling  i8237A_init_sysfs+0x0/0x30 @ 1
[    1.251469] initcall i8237A_init_sysfs+0x0/0x30 returned 0 after 491 usecs
[    1.251563] calling  add_rtc_cmos+0x0/0xa0 @ 1
[    1.251660] initcall add_rtc_cmos+0x0/0xa0 returned 0 after 6 usecs
[    1.251753] calling  cache_sysfs_init+0x0/0x60 @ 1
[    1.254383] initcall cache_sysfs_init+0x0/0x60 returned 0 after 2477 usecs
[    1.254477] calling  mce_init_device+0x0/0x100 @ 1
[    1.255681] PM: Adding info for No Bus:mcelog
[    1.255989] initcall mce_init_device+0x0/0x100 returned 0 after 1385 usecs
[    1.256130] calling  threshold_init_device+0x0/0x50 @ 1
[    1.256224] initcall threshold_init_device+0x0/0x50 returned 0 after 2 usecs
[    1.256325] calling  inject_init+0x0/0x20 @ 1
[    1.256413] Machine check injector initialized
[    1.256504] initcall inject_init+0x0/0x20 returned 0 after 86 usecs
[    1.256596] calling  nforce2_init+0x0/0x70 @ 1
[    1.256707] cpufreq-nforce2: No nForce2 chipset.
[    1.256799] initcall nforce2_init+0x0/0x70 returned -19 after 109 usecs
[    1.256891] calling  msr_init+0x0/0x100 @ 1
[    1.257359] PM: Adding info for No Bus:msr0
[    1.257775] PM: Adding info for No Bus:msr1
[    1.258112] initcall msr_init+0x0/0x100 returned 0 after 1102 usecs
[    1.258204] calling  apm_init+0x0/0x430 @ 1
[    1.258312] apm: BIOS not found.
[    1.258401] initcall apm_init+0x0/0x430 returned -19 after 98 usecs
[    1.258493] calling  ioapic_init_sysfs+0x0/0xb0 @ 1
[    1.259075] initcall ioapic_init_sysfs+0x0/0xb0 returned 0 after 477 usecs
[    1.259169] calling  add_pcspkr+0x0/0x30 @ 1
[    1.259382] PM: Adding info for platform:pcspkr
[    1.259687] initcall add_pcspkr+0x0/0x30 returned 0 after 415 usecs
[    1.259778] calling  scx200_init+0x0/0x30 @ 1
[    1.259867] scx200: NatSemi SCx200 Driver
[    1.260261] initcall scx200_init+0x0/0x30 returned 0 after 381 usecs
[    1.260355] calling  microcode_init+0x0/0x130 @ 1
[    1.260552] PM: Adding info for platform:microcode
[    1.260892] microcode: CPU0 sig=0x6e8, pf=0x20, revision=0x39
[    1.261088] microcode: CPU1 sig=0x6e8, pf=0x20, revision=0x39
[    1.261283] PM: Adding info for No Bus:microcode
[    1.261597] Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[    1.261730] initcall microcode_init+0x0/0x130 returned 0 after 1254 usecs
[    1.261825] calling  start_periodic_check_for_corruption+0x0/0x40 @ 1
[    1.261916] Scanning for low memory corruption every 60 seconds
[    1.262058] initcall start_periodic_check_for_corruption+0x0/0x40 returned 0 after 135 usecs
[    1.262192] calling  pt_dump_init+0x0/0x70 @ 1
[    1.262312] initcall pt_dump_init+0x0/0x70 returned 0 after 21 usecs
[    1.262405] calling  proc_schedstat_init+0x0/0x30 @ 1
[    1.262516] initcall proc_schedstat_init+0x0/0x30 returned 0 after 18 usecs
[    1.262610] calling  proc_execdomains_init+0x0/0x30 @ 1
[    1.262716] initcall proc_execdomains_init+0x0/0x30 returned 0 after 14 usecs
[    1.262810] calling  ioresources_init+0x0/0x40 @ 1
[    1.262928] initcall ioresources_init+0x0/0x40 returned 0 after 26 usecs
[    1.263040] calling  uid_cache_init+0x0/0x80 @ 1
[    1.263142] initcall uid_cache_init+0x0/0x80 returned 0 after 11 usecs
[    1.263234] calling  init_posix_timers+0x0/0x170 @ 1
[    1.263337] initcall init_posix_timers+0x0/0x170 returned 0 after 9 usecs
[    1.263430] calling  init_posix_cpu_timers+0x0/0xc0 @ 1
[    1.263524] initcall init_posix_cpu_timers+0x0/0xc0 returned 0 after 1 usecs
[    1.263617] calling  nsproxy_cache_init+0x0/0x30 @ 1
[    1.263716] initcall nsproxy_cache_init+0x0/0x30 returned 0 after 7 usecs
[    1.263811] calling  create_proc_profile+0x0/0x250 @ 1
[    1.263932] initcall create_proc_profile+0x0/0x250 returned 0 after 28 usecs
[    1.264042] calling  timekeeping_init_device+0x0/0x30 @ 1
[    1.264598] initcall timekeeping_init_device+0x0/0x30 returned 0 after 453 usecs
[    1.264728] calling  init_clocksource_sysfs+0x0/0x50 @ 1
[    1.265356] initcall init_clocksource_sysfs+0x0/0x50 returned 0 after 521 usecs
[    1.265487] calling  init_timer_list_procfs+0x0/0x30 @ 1
[    1.265595] initcall init_timer_list_procfs+0x0/0x30 returned 0 after 16 usecs
[    1.265725] calling  init_tstats_procfs+0x0/0x30 @ 1
[    1.265832] initcall init_tstats_procfs+0x0/0x30 returned 0 after 14 usecs
[    1.265925] calling  lockdep_proc_init+0x0/0x90 @ 1
[    1.266099] initcall lockdep_proc_init+0x0/0x90 returned 0 after 51 usecs
[    1.266192] calling  futex_init+0x0/0xd0 @ 1
[    1.266302] initcall futex_init+0x0/0xd0 returned 0 after 13 usecs
[    1.266395] calling  init_rttest+0x0/0x130 @ 1
[    1.269474] Initializing RT-Tester: OK
[    1.269565] initcall init_rttest+0x0/0x130 returned 0 after 3006 usecs
[    1.269657] calling  proc_dma_init+0x0/0x30 @ 1
[    1.269764] initcall proc_dma_init+0x0/0x30 returned 0 after 16 usecs
[    1.269856] calling  proc_modules_init+0x0/0x30 @ 1
[    1.269961] initcall proc_modules_init+0x0/0x30 returned 0 after 14 usecs
[    1.270104] calling  kallsyms_init+0x0/0x30 @ 1
[    1.270211] initcall kallsyms_init+0x0/0x30 returned 0 after 15 usecs
[    1.270310] calling  crash_save_vmcoreinfo_init+0x0/0x4d0 @ 1
[    1.270431] initcall crash_save_vmcoreinfo_init+0x0/0x4d0 returned 0 after 27 usecs
[    1.270560] calling  crash_notes_memory_init+0x0/0x40 @ 1
[    1.270658] initcall crash_notes_memory_init+0x0/0x40 returned 0 after 5 usecs
[    1.270788] calling  pid_namespaces_init+0x0/0x30 @ 1
[    1.270888] initcall pid_namespaces_init+0x0/0x30 returned 0 after 8 usecs
[    1.270981] calling  audit_init+0x0/0x160 @ 1
[    1.271167] audit: initializing netlink socket (disabled)
[    1.271300] type=2000 audit(1250886084.271:1): initialized
[    1.271399] initcall audit_init+0x0/0x160 returned 0 after 225 usecs
[    1.271491] calling  init_kprobes+0x0/0x190 @ 1
[    1.282666] initcall init_kprobes+0x0/0x190 returned 0 after 10824 usecs
[    1.282759] calling  hung_task_init+0x0/0x50 @ 1
[    1.282936] initcall hung_task_init+0x0/0x50 returned 0 after 82 usecs
[    1.283087] calling  utsname_sysctl_init+0x0/0x20 @ 1
[    1.283229] initcall utsname_sysctl_init+0x0/0x20 returned 0 after 48 usecs
[    1.283326] calling  init_markers+0x0/0x10 @ 1
[    1.283417] initcall init_markers+0x0/0x10 returned 0 after 1 usecs
[    1.283509] calling  init_tracepoints+0x0/0x10 @ 1
[    1.283602] initcall init_tracepoints+0x0/0x10 returned 0 after 1 usecs
[    1.283694] calling  init_events+0x0/0x70 @ 1
[    1.283788] initcall init_events+0x0/0x70 returned 0 after 4 usecs
[    1.283880] calling  init_sched_switch_trace+0x0/0x10 @ 1
[    1.283976] initcall init_sched_switch_trace+0x0/0x10 returned 0 after 3 usecs
[    1.284121] calling  perf_counter_sysfs_init+0x0/0x20 @ 1
[    1.284245] initcall perf_counter_sysfs_init+0x0/0x20 returned 0 after 30 usecs
[    1.284376] calling  init_per_zone_wmark_min+0x0/0x80 @ 1
[    1.285425] initcall init_per_zone_wmark_min+0x0/0x80 returned 0 after 169 usecs
[    1.285554] calling  pdflush_init+0x0/0x20 @ 1
[    1.285792] initcall pdflush_init+0x0/0x20 returned 0 after 143 usecs
[    1.285884] calling  kswapd_init+0x0/0x60 @ 1
[    1.286121] initcall kswapd_init+0x0/0x60 returned 0 after 141 usecs
[    1.286213] calling  init_tmpfs+0x0/0xd0 @ 1
[    1.286404] initcall init_tmpfs+0x0/0xd0 returned 0 after 91 usecs
[    1.286496] calling  setup_vmstat+0x0/0xd0 @ 1
[    1.286644] initcall setup_vmstat+0x0/0xd0 returned 0 after 57 usecs
[    1.286736] calling  mm_sysfs_init+0x0/0x30 @ 1
[    1.286853] initcall mm_sysfs_init+0x0/0x30 returned 0 after 25 usecs
[    1.286945] calling  proc_vmalloc_init+0x0/0x30 @ 1
[    1.287069] initcall proc_vmalloc_init+0x0/0x30 returned 0 after 15 usecs
[    1.287162] calling  init_emergency_pool+0x0/0x70 @ 1
[    1.287367] highmem bounce pool size: 64 pages
[    1.287458] initcall init_emergency_pool+0x0/0x70 returned 0 after 200 usecs
[    1.287551] calling  procswaps_init+0x0/0x30 @ 1
[    1.287657] initcall procswaps_init+0x0/0x30 returned 0 after 15 usecs
[    1.287750] calling  hugetlb_init+0x0/0x420 @ 1
[    1.287842] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    1.288049] initcall hugetlb_init+0x0/0x420 returned 0 after 201 usecs
[    1.288141] calling  slab_proc_init+0x0/0x30 @ 1
[    1.288247] initcall slab_proc_init+0x0/0x30 returned 0 after 15 usecs
[    1.288340] calling  slab_sysfs_init+0x0/0xf0 @ 1
[    1.322235] initcall slab_sysfs_init+0x0/0xf0 returned 0 after 33008 usecs
[    1.322334] calling  kmemleak_test_init+0x0/0x5b0 @ 1
[    1.322423] Kmemleak testing
[    1.322513] kmemleak: kmalloc(32) = f3d241c0
[    1.322603] kmemleak: kmalloc(32) = f3d241e0
[    1.322693] kmemleak: kmalloc(1024) = f4391000
[    1.322784] kmemleak: kmalloc(1024) = f4391400
[    1.322876] kmemleak: kmalloc(2048) = f4853000
[    1.322967] kmemleak: kmalloc(2048) = f4853800
[    1.323076] kmemleak: kmalloc(4096) = f502c000
[    1.323167] kmemleak: kmalloc(4096) = f502d000
[    1.323284] kmemleak: vmalloc(64) = f9540000
[    1.323394] kmemleak: vmalloc(64) = f9543000
[    1.323507] kmemleak: vmalloc(64) = f9546000
[    1.323615] kmemleak: vmalloc(64) = f9549000
[    1.323723] kmemleak: vmalloc(64) = f954c000
[    1.323814] kmemleak: kmalloc(sizeof(*elem)) = f48a9400
[    1.323906] kmemleak: kmalloc(sizeof(*elem)) = f48a9200
[    1.323998] kmemleak: kmalloc(sizeof(*elem)) = f48a9300
[    1.324106] kmemleak: kmalloc(sizeof(*elem)) = f48a9100
[    1.324197] kmemleak: kmalloc(sizeof(*elem)) = f48a9800
[    1.324295] kmemleak: kmalloc(sizeof(*elem)) = f48a9500
[    1.324386] kmemleak: kmalloc(sizeof(*elem)) = f48a9900
[    1.324479] kmemleak: kmalloc(sizeof(*elem)) = f48a9a00
[    1.324570] kmemleak: kmalloc(sizeof(*elem)) = f48a9b00
[    1.324662] kmemleak: kmalloc(sizeof(*elem)) = f48a9c00
[    1.324758] kmemleak: kmalloc(129) = f489de40
[    1.324850] kmemleak: kmalloc(129) = f489df00
[    1.324941] initcall kmemleak_test_init+0x0/0x5b0 returned 0 after 2457 usecs
[    1.325050] calling  fasync_init+0x0/0x30 @ 1
[    1.325163] initcall fasync_init+0x0/0x30 returned 0 after 22 usecs
[    1.325256] calling  proc_filesystems_init+0x0/0x30 @ 1
[    1.325371] initcall proc_filesystems_init+0x0/0x30 returned 0 after 22 usecs
[    1.325465] calling  dnotify_init+0x0/0x80 @ 1
[    1.325599] initcall dnotify_init+0x0/0x80 returned 0 after 43 usecs
[    1.325691] calling  inotify_setup+0x0/0x10 @ 1
[    1.325782] initcall inotify_setup+0x0/0x10 returned 0 after 1 usecs
[    1.325874] calling  aio_setup+0x0/0x90 @ 1
[    1.326174] initcall aio_setup+0x0/0x90 returned 0 after 204 usecs
[    1.326269] calling  proc_locks_init+0x0/0x30 @ 1
[    1.326375] initcall proc_locks_init+0x0/0x30 returned 0 after 16 usecs
[    1.326467] calling  init_mbcache+0x0/0x20 @ 1
[    1.326559] initcall init_mbcache+0x0/0x20 returned 0 after 2 usecs
[    1.326651] calling  proc_cmdline_init+0x0/0x30 @ 1
[    1.326757] initcall proc_cmdline_init+0x0/0x30 returned 0 after 14 usecs
[    1.326850] calling  proc_cpuinfo_init+0x0/0x30 @ 1
[    1.326956] initcall proc_cpuinfo_init+0x0/0x30 returned 0 after 14 usecs
[    1.327092] calling  proc_devices_init+0x0/0x30 @ 1
[    1.327199] initcall proc_devices_init+0x0/0x30 returned 0 after 15 usecs
[    1.327300] calling  proc_interrupts_init+0x0/0x30 @ 1
[    1.327409] initcall proc_interrupts_init+0x0/0x30 returned 0 after 15 usecs
[    1.327503] calling  proc_loadavg_init+0x0/0x30 @ 1
[    1.327609] initcall proc_loadavg_init+0x0/0x30 returned 0 after 15 usecs
[    1.327701] calling  proc_meminfo_init+0x0/0x30 @ 1
[    1.327806] initcall proc_meminfo_init+0x0/0x30 returned 0 after 14 usecs
[    1.327898] calling  proc_stat_init+0x0/0x30 @ 1
[    1.328019] initcall proc_stat_init+0x0/0x30 returned 0 after 28 usecs
[    1.328111] calling  proc_uptime_init+0x0/0x30 @ 1
[    1.328216] initcall proc_uptime_init+0x0/0x30 returned 0 after 14 usecs
[    1.328314] calling  proc_version_init+0x0/0x30 @ 1
[    1.328420] initcall proc_version_init+0x0/0x30 returned 0 after 15 usecs
[    1.328512] calling  proc_softirqs_init+0x0/0x30 @ 1
[    1.328618] initcall proc_softirqs_init+0x0/0x30 returned 0 after 15 usecs
[    1.328710] calling  proc_kcore_init+0x0/0x50 @ 1
[    1.328814] initcall proc_kcore_init+0x0/0x50 returned 0 after 14 usecs
[    1.328906] calling  proc_kmsg_init+0x0/0x30 @ 1
[    1.329027] initcall proc_kmsg_init+0x0/0x30 returned 0 after 27 usecs
[    1.329120] calling  proc_page_init+0x0/0x50 @ 1
[    1.329240] initcall proc_page_init+0x0/0x50 returned 0 after 28 usecs
[    1.329334] calling  init_devpts_fs+0x0/0x60 @ 1
[    1.329499] initcall init_devpts_fs+0x0/0x60 returned 0 after 73 usecs
[    1.329592] calling  init_reiserfs_fs+0x0/0x80 @ 1
[    1.330324] initcall init_reiserfs_fs+0x0/0x80 returned 0 after 624 usecs
[    1.330418] calling  init_ext3_fs+0x0/0x80 @ 1
[    1.331743] initcall init_ext3_fs+0x0/0x80 returned 0 after 1205 usecs
[    1.331837] calling  journal_init+0x0/0xe0 @ 1
[    1.333827] initcall journal_init+0x0/0xe0 returned 0 after 1854 usecs
[    1.333921] calling  init_ramfs_fs+0x0/0x10 @ 1
[    1.334079] initcall init_ramfs_fs+0x0/0x10 returned 0 after 3 usecs
[    1.334172] calling  init_hugetlbfs_fs+0x0/0xb0 @ 1
[    1.334932] initcall init_hugetlbfs_fs+0x0/0xb0 returned 0 after 653 usecs
[    1.335057] calling  init_nls_cp850+0x0/0x10 @ 1
[    1.335151] initcall init_nls_cp850+0x0/0x10 returned 0 after 3 usecs
[    1.335243] calling  init_nls_cp855+0x0/0x10 @ 1
[    1.335337] initcall init_nls_cp855+0x0/0x10 returned 0 after 1 usecs
[    1.335429] calling  init_nls_cp861+0x0/0x10 @ 1
[    1.335521] initcall init_nls_cp861+0x0/0x10 returned 0 after 1 usecs
[    1.335613] calling  init_nls_cp862+0x0/0x10 @ 1
[    1.335705] initcall init_nls_cp862+0x0/0x10 returned 0 after 1 usecs
[    1.335797] calling  init_nls_cp866+0x0/0x10 @ 1
[    1.335889] initcall init_nls_cp866+0x0/0x10 returned 0 after 1 usecs
[    1.335982] calling  init_nls_cp874+0x0/0x10 @ 1
[    1.336095] initcall init_nls_cp874+0x0/0x10 returned 0 after 1 usecs
[    1.336188] calling  init_nls_cp949+0x0/0x10 @ 1
[    1.336286] initcall init_nls_cp949+0x0/0x10 returned 0 after 1 usecs
[    1.336378] calling  init_nls_iso8859_2+0x0/0x10 @ 1
[    1.336471] initcall init_nls_iso8859_2+0x0/0x10 returned 0 after 1 usecs
[    1.336563] calling  init_nls_iso8859_3+0x0/0x10 @ 1
[    1.336657] initcall init_nls_iso8859_3+0x0/0x10 returned 0 after 1 usecs
[    1.336750] calling  init_nls_iso8859_7+0x0/0x10 @ 1
[    1.336842] initcall init_nls_iso8859_7+0x0/0x10 returned 0 after 1 usecs
[    1.336934] calling  init_nls_iso8859_14+0x0/0x10 @ 1
[    1.337041] initcall init_nls_iso8859_14+0x0/0x10 returned 0 after 1 usecs
[    1.337133] calling  init_nls_koi8_r+0x0/0x10 @ 1
[    1.337225] initcall init_nls_koi8_r+0x0/0x10 returned 0 after 1 usecs
[    1.337323] calling  init_nls_koi8_u+0x0/0x10 @ 1
[    1.337416] initcall init_nls_koi8_u+0x0/0x10 returned 0 after 1 usecs
[    1.337508] calling  init_nls_koi8_ru+0x0/0x40 @ 1
[    1.337600] initcall init_nls_koi8_ru+0x0/0x40 returned 0 after 2 usecs
[    1.337693] calling  init_affs_fs+0x0/0x60 @ 1
[    1.338383] initcall init_affs_fs+0x0/0x60 returned 0 after 584 usecs
[    1.338476] calling  init_romfs_fs+0x0/0x80 @ 1
[    1.338565] ROMFS MTD (C) 2007 Red Hat, Inc.
[    1.339261] initcall init_romfs_fs+0x0/0x80 returned 0 after 676 usecs
[    1.339354] calling  init_qnx4_fs+0x0/0x70 @ 1
[    1.340030] QNX4 filesystem 0.2.3 registered.
[    1.340121] initcall init_qnx4_fs+0x0/0x70 returned 0 after 660 usecs
[    1.340213] calling  init_autofs_fs+0x0/0x10 @ 1
[    1.340313] initcall init_autofs_fs+0x0/0x10 returned 0 after 3 usecs
[    1.340405] calling  init_adfs_fs+0x0/0x60 @ 1
[    1.341084] initcall init_adfs_fs+0x0/0x60 returned 0 after 572 usecs
[    1.341177] calling  init_nilfs_fs+0x0/0x90 @ 1
[    1.343697] initcall init_nilfs_fs+0x0/0x90 returned 0 after 2370 usecs
[    1.343791] calling  init_befs_fs+0x0/0x90 @ 1
[    1.343878] BeFS version: 0.9.3
[    1.344605] initcall init_befs_fs+0x0/0x90 returned 0 after 707 usecs
[    1.344699] calling  ipc_init+0x0/0x20 @ 1
[    1.344809] msgmni has been set to 1665
[    1.344937] initcall ipc_init+0x0/0x20 returned 0 after 146 usecs
[    1.345072] calling  ipc_sysctl_init+0x0/0x20 @ 1
[    1.345238] initcall ipc_sysctl_init+0x0/0x20 returned 0 after 73 usecs
[    1.345331] calling  init_mqueue_fs+0x0/0xc0 @ 1
[    1.346145] initcall init_mqueue_fs+0x0/0xc0 returned 0 after 705 usecs
[    1.346238] calling  key_proc_init+0x0/0x60 @ 1
[    1.346361] initcall key_proc_init+0x0/0x60 returned 0 after 30 usecs
[    1.346453] calling  crypto_wq_init+0x0/0x40 @ 1
[    1.346703] initcall crypto_wq_init+0x0/0x40 returned 0 after 154 usecs
[    1.346797] calling  crypto_algapi_init+0x0/0x10 @ 1
[    1.346905] initcall crypto_algapi_init+0x0/0x10 returned 0 after 16 usecs
[    1.346999] calling  chainiv_module_init+0x0/0x10 @ 1
[    1.347132] initcall chainiv_module_init+0x0/0x10 returned 0 after 3 usecs
[    1.347225] calling  eseqiv_module_init+0x0/0x10 @ 1
[    1.347324] initcall eseqiv_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.347418] calling  seqiv_module_init+0x0/0x10 @ 1
[    1.347511] initcall seqiv_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.347603] calling  hmac_module_init+0x0/0x10 @ 1
[    1.347695] initcall hmac_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.347788] calling  md5_mod_init+0x0/0x10 @ 1
[    1.348063] initcall md5_mod_init+0x0/0x10 returned 0 after 178 usecs
[    1.348158] calling  rmd128_mod_init+0x0/0x10 @ 1
[    1.348423] initcall rmd128_mod_init+0x0/0x10 returned 0 after 169 usecs
[    1.348516] calling  rmd320_mod_init+0x0/0x10 @ 1
[    1.348787] cryptomgr_test used greatest stack depth: 1908 bytes left
[    1.348792] initcall rmd320_mod_init+0x0/0x10 returned 0 after 177 usecs
[    1.348797] calling  sha1_generic_mod_init+0x0/0x10 @ 1
[    1.348975] initcall sha1_generic_mod_init+0x0/0x10 returned 0 after 167 usecs
[    1.348979] calling  tgr192_mod_init+0x0/0x70 @ 1
[    1.349543] initcall tgr192_mod_init+0x0/0x70 returned 0 after 544 usecs
[    1.349548] calling  crypto_ecb_module_init+0x0/0x10 @ 1
[    1.349558] initcall crypto_ecb_module_init+0x0/0x10 returned 0 after 4 usecs
[    1.349561] calling  crypto_cbc_module_init+0x0/0x10 @ 1
[    1.349569] initcall crypto_cbc_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.349573] calling  crypto_pcbc_module_init+0x0/0x10 @ 1
[    1.349581] initcall crypto_pcbc_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.349585] calling  crypto_module_init+0x0/0x10 @ 1
[    1.349593] initcall crypto_module_init+0x0/0x10 returned 0 after 2 usecs
[    1.349596] calling  crypto_ctr_module_init+0x0/0x40 @ 1
[    1.349606] initcall crypto_ctr_module_init+0x0/0x40 returned 0 after 3 usecs
[    1.349609] calling  crypto_gcm_module_init+0x0/0x60 @ 1
[    1.349619] initcall crypto_gcm_module_init+0x0/0x60 returned 0 after 3 usecs
[    1.349622] calling  cryptd_init+0x0/0xd0 @ 1
[    1.349633] initcall cryptd_init+0x0/0xd0 returned 0 after 5 usecs
[    1.349637] calling  des_generic_mod_init+0x0/0x40 @ 1
[    1.350068] initcall des_generic_mod_init+0x0/0x40 returned 0 after 412 usecs
[    1.350072] calling  aes_init+0x0/0x10 @ 1
[    1.350291] initcall aes_init+0x0/0x10 returned 0 after 207 usecs
[    1.350295] calling  khazad_mod_init+0x0/0x10 @ 1
[    1.350546] initcall khazad_mod_init+0x0/0x10 returned 0 after 239 usecs
[    1.350550] calling  anubis_mod_init+0x0/0x10 @ 1
[    1.350813] initcall anubis_mod_init+0x0/0x10 returned 0 after 250 usecs
[    1.350817] calling  salsa20_generic_mod_init+0x0/0x10 @ 1
[    1.350926] initcall salsa20_generic_mod_init+0x0/0x10 returned 0 after 100 usecs
[    1.350930] calling  deflate_mod_init+0x0/0x10 @ 1
[    1.352589] initcall deflate_mod_init+0x0/0x10 returned 0 after 1612 usecs
[    1.352686] calling  michael_mic_init+0x0/0x10 @ 1
[    1.352985] initcall michael_mic_init+0x0/0x10 returned 0 after 203 usecs
[    1.353098] calling  crc32c_mod_init+0x0/0x10 @ 1
[    1.353436] initcall crc32c_mod_init+0x0/0x10 returned 0 after 240 usecs
[    1.353529] calling  crypto_authenc_module_init+0x0/0x10 @ 1
[    1.353625] initcall crypto_authenc_module_init+0x0/0x10 returned 0 after 3 usecs
[    1.353756] calling  krng_mod_init+0x0/0x10 @ 1
[    1.353943] alg: No test for stdrng (krng)
[    1.354054] initcall krng_mod_init+0x0/0x10 returned 0 after 199 usecs
[    1.354148] calling  proc_genhd_init+0x0/0x40 @ 1
[    1.354275] initcall proc_genhd_init+0x0/0x40 returned 0 after 34 usecs
[    1.354369] calling  noop_init+0x0/0x20 @ 1
[    1.354459] io scheduler noop registered (default)
[    1.354550] initcall noop_init+0x0/0x20 returned 0 after 88 usecs
[    1.354642] calling  libcrc32c_mod_init+0x0/0x30 @ 1
[    1.354741] initcall libcrc32c_mod_init+0x0/0x30 returned 0 after 7 usecs
[    1.354834] calling  percpu_counter_startup+0x0/0x20 @ 1
[    1.354929] initcall percpu_counter_startup+0x0/0x20 returned 0 after 3 usecs
[    1.355088] calling  audit_classes_init+0x0/0x50 @ 1
[    1.355209] initcall audit_classes_init+0x0/0x50 returned 0 after 27 usecs
[    1.355310] calling  pci_init+0x0/0x30 @ 1
[    1.355414] pci 0000:00:00.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.355508] pci 0000:00:00.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.355601] pci 0000:00:00.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.355694] pci 0000:00:00.0: calling pci_fixup_video+0x0/0xc0
[    1.355793] pci 0000:00:02.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.355886] pci 0000:00:02.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.355978] pci 0000:00:02.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.356087] pci 0000:00:02.0: calling pci_fixup_video+0x0/0xc0
[    1.356180] pci 0000:00:02.0: Boot video device
[    1.356280] pci 0000:00:02.1: calling quirk_e100_interrupt+0x0/0x1e0
[    1.356372] pci 0000:00:02.1: calling quirk_cardbus_legacy+0x0/0x30
[    1.356464] pci 0000:00:02.1: calling quirk_usb_early_handoff+0x0/0x640
[    1.356557] pci 0000:00:02.1: calling pci_fixup_video+0x0/0xc0
[    1.356657] pci 0000:00:1b.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.356749] pci 0000:00:1b.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.356842] pci 0000:00:1b.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.356934] pci 0000:00:1b.0: calling pci_fixup_video+0x0/0xc0
[    1.357047] pci 0000:00:1c.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.357139] pci 0000:00:1c.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.357231] pci 0000:00:1c.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.357327] pci 0000:00:1c.0: calling pci_fixup_video+0x0/0xc0
[    1.357427] pci 0000:00:1c.1: calling quirk_e100_interrupt+0x0/0x1e0
[    1.357519] pci 0000:00:1c.1: calling quirk_cardbus_legacy+0x0/0x30
[    1.357611] pci 0000:00:1c.1: calling quirk_usb_early_handoff+0x0/0x640
[    1.357703] pci 0000:00:1c.1: calling pci_fixup_video+0x0/0xc0
[    1.357802] pci 0000:00:1c.2: calling quirk_e100_interrupt+0x0/0x1e0
[    1.357893] pci 0000:00:1c.2: calling quirk_cardbus_legacy+0x0/0x30
[    1.357986] pci 0000:00:1c.2: calling quirk_usb_early_handoff+0x0/0x640
[    1.358094] pci 0000:00:1c.2: calling pci_fixup_video+0x0/0xc0
[    1.358195] pci 0000:00:1c.3: calling quirk_e100_interrupt+0x0/0x1e0
[    1.358294] pci 0000:00:1c.3: calling quirk_cardbus_legacy+0x0/0x30
[    1.358386] pci 0000:00:1c.3: calling quirk_usb_early_handoff+0x0/0x640
[    1.358479] pci 0000:00:1c.3: calling pci_fixup_video+0x0/0xc0
[    1.358578] pci 0000:00:1d.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.358670] pci 0000:00:1d.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.358762] pci 0000:00:1d.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.358859] pci 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x2000
[    1.358950] pci 0000:00:1d.0: Performing full reset
[    1.359066] pci 0000:00:1d.0: calling pci_fixup_video+0x0/0xc0
[    1.359166] pci 0000:00:1d.1: calling quirk_e100_interrupt+0x0/0x1e0
[    1.359262] pci 0000:00:1d.1: calling quirk_cardbus_legacy+0x0/0x30
[    1.359355] pci 0000:00:1d.1: calling quirk_usb_early_handoff+0x0/0x640
[    1.359449] pci 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x2000
[    1.359541] pci 0000:00:1d.1: Performing full reset
[    1.359642] pci 0000:00:1d.1: calling pci_fixup_video+0x0/0xc0
[    1.359741] pci 0000:00:1d.2: calling quirk_e100_interrupt+0x0/0x1e0
[    1.359833] pci 0000:00:1d.2: calling quirk_cardbus_legacy+0x0/0x30
[    1.359926] pci 0000:00:1d.2: calling quirk_usb_early_handoff+0x0/0x640
[    1.360035] pci 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x2000
[    1.360127] pci 0000:00:1d.2: Performing full reset
[    1.360229] pci 0000:00:1d.2: calling pci_fixup_video+0x0/0xc0
[    1.360332] pci 0000:00:1d.3: calling quirk_e100_interrupt+0x0/0x1e0
[    1.360424] pci 0000:00:1d.3: calling quirk_cardbus_legacy+0x0/0x30
[    1.360516] pci 0000:00:1d.3: calling quirk_usb_early_handoff+0x0/0x640
[    1.360611] pci 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x2000
[    1.360703] pci 0000:00:1d.3: Performing full reset
[    1.360804] pci 0000:00:1d.3: calling pci_fixup_video+0x0/0xc0
[    1.360903] pci 0000:00:1d.7: calling quirk_e100_interrupt+0x0/0x1e0
[    1.360996] pci 0000:00:1d.7: calling quirk_cardbus_legacy+0x0/0x30
[    1.361104] pci 0000:00:1d.7: calling quirk_usb_early_handoff+0x0/0x640
[    1.361241] pci 0000:00:1d.7: calling pci_fixup_video+0x0/0xc0
[    1.361341] pci 0000:00:1e.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.361434] pci 0000:00:1e.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.361527] pci 0000:00:1e.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.361619] pci 0000:00:1e.0: calling pci_fixup_video+0x0/0xc0
[    1.361718] pci 0000:00:1f.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.361810] pci 0000:00:1f.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.361902] pci 0000:00:1f.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.361993] pci 0000:00:1f.0: calling pci_fixup_video+0x0/0xc0
[    1.362108] pci 0000:00:1f.1: calling quirk_e100_interrupt+0x0/0x1e0
[    1.362201] pci 0000:00:1f.1: calling quirk_cardbus_legacy+0x0/0x30
[    1.362300] pci 0000:00:1f.1: calling quirk_usb_early_handoff+0x0/0x640
[    1.362392] pci 0000:00:1f.1: calling pci_fixup_video+0x0/0xc0
[    1.362492] pci 0000:00:1f.2: calling quirk_e100_interrupt+0x0/0x1e0
[    1.362583] pci 0000:00:1f.2: calling quirk_cardbus_legacy+0x0/0x30
[    1.362676] pci 0000:00:1f.2: calling quirk_usb_early_handoff+0x0/0x640
[    1.362767] pci 0000:00:1f.2: calling pci_fixup_video+0x0/0xc0
[    1.362867] pci 0000:00:1f.3: calling quirk_e100_interrupt+0x0/0x1e0
[    1.362958] pci 0000:00:1f.3: calling quirk_cardbus_legacy+0x0/0x30
[    1.363065] pci 0000:00:1f.3: calling quirk_usb_early_handoff+0x0/0x640
[    1.363157] pci 0000:00:1f.3: calling pci_fixup_video+0x0/0xc0
[    1.363256] pci 0000:02:00.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.363349] pci 0000:02:00.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.363442] pci 0000:02:00.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.363534] pci 0000:02:00.0: calling pci_fixup_video+0x0/0xc0
[    1.363633] pci 0000:03:00.0: calling quirk_e100_interrupt+0x0/0x1e0
[    1.363725] pci 0000:03:00.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.363817] pci 0000:03:00.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.363910] pci 0000:03:00.0: calling pci_fixup_video+0x0/0xc0
[    1.364024] pci 0000:15:00.0: calling quirk_cardbus_legacy+0x0/0x30
[    1.364119] pci 0000:15:00.0: calling quirk_usb_early_handoff+0x0/0x640
[    1.364211] pci 0000:15:00.0: calling pci_fixup_video+0x0/0xc0
[    1.364318] initcall pci_init+0x0/0x30 returned 0 after 8708 usecs
[    1.364409] calling  pci_proc_init+0x0/0x70 @ 1
[    1.365060] initcall pci_proc_init+0x0/0x70 returned 0 after 545 usecs
[    1.365153] calling  pcie_portdrv_init+0x0/0x60 @ 1
[    1.365827] pcieport-driver 0000:00:1c.0: irq 24 for MSI/MSI-X
[    1.365929] pcieport-driver 0000:00:1c.0: setting latency timer to 64
[    1.366259] PM: Adding info for pci_express:0000:00:1c.0:pcie01
[    1.366688] PM: Adding info for pci_express:0000:00:1c.0:pcie04
[    1.367302] pcieport-driver 0000:00:1c.1: irq 25 for MSI/MSI-X
[    1.367404] pcieport-driver 0000:00:1c.1: setting latency timer to 64
[    1.367612] PM: Adding info for pci_express:0000:00:1c.1:pcie01
[    1.368107] PM: Adding info for pci_express:0000:00:1c.1:pcie04
[    1.368768] pcieport-driver 0000:00:1c.2: irq 26 for MSI/MSI-X
[    1.368869] pcieport-driver 0000:00:1c.2: setting latency timer to 64
[    1.369122] PM: Adding info for pci_express:0000:00:1c.2:pcie01
[    1.369559] PM: Adding info for pci_express:0000:00:1c.2:pcie04
[    1.370174] pcieport-driver 0000:00:1c.3: irq 27 for MSI/MSI-X
[    1.370278] pcieport-driver 0000:00:1c.3: setting latency timer to 64
[    1.370494] PM: Adding info for pci_express:0000:00:1c.3:pcie01
[    1.370914] PM: Adding info for pci_express:0000:00:1c.3:pcie04
[    1.371604] initcall pcie_portdrv_init+0x0/0x60 returned 0 after 6208 usecs
[    1.371698] calling  aer_service_init+0x0/0x30 @ 1
[    1.372061] initcall aer_service_init+0x0/0x30 returned 0 after 262 usecs
[    1.372155] calling  pci_stub_init+0x0/0x20 @ 1
[    1.372537] initcall pci_stub_init+0x0/0x20 returned 0 after 283 usecs
[    1.372629] calling  display_class_init+0x0/0x70 @ 1
[    1.372958] initcall display_class_init+0x0/0x70 returned 0 after 231 usecs
[    1.373083] calling  acpi_reserve_resources+0x0/0xd0 @ 1
[    1.373202] initcall acpi_reserve_resources+0x0/0xd0 returned 0 after 27 usecs
[    1.373340] calling  irqrouter_init_sysfs+0x0/0x40 @ 1
[    1.373892] initcall irqrouter_init_sysfs+0x0/0x40 returned 0 after 449 usecs
[    1.373986] calling  acpi_ac_init+0x0/0x30 @ 1
[    1.374929] ACPI: AC Adapter [AC] (on-line)
[    1.376150] initcall acpi_ac_init+0x0/0x30 returned 0 after 1988 usecs
[    1.376243] calling  acpi_pci_slot_init+0x0/0x20 @ 1
[    1.378347] pci_bus 0000:15: dev 00, created physical slot 1
[    1.378907] initcall acpi_pci_slot_init+0x0/0x20 returned 0 after 2510 usecs
[    1.379018] calling  acpi_smb_hc_init+0x0/0x20 @ 1
[    1.379404] initcall acpi_smb_hc_init+0x0/0x20 returned 0 after 288 usecs
[    1.379497] calling  acpi_sbs_init+0x0/0x30 @ 1
[    1.379868] initcall acpi_sbs_init+0x0/0x30 returned 0 after 273 usecs
[    1.379960] calling  pnpbios_thread_init+0x0/0x60 @ 1
[    1.380093] initcall pnpbios_thread_init+0x0/0x60 returned 0 after 1 usecs
[    1.380186] calling  isapnp_init+0x0/0xed0 @ 1
[    1.380360] PM: Adding info for No Bus:pnp1
[    1.380448] isapnp: Scanning for PnP cards...
[    1.738267] isapnp: No Plug & Play device found
[    1.738360] initcall isapnp_init+0x0/0xed0 returned 0 after 349684 usecs
[    1.738453] calling  regulator_userspace_consumer_init+0x0/0x10 @ 1
[    1.738822] initcall regulator_userspace_consumer_init+0x0/0x10 returned 0 after 268 usecs
[    1.738954] calling  bq24022_init+0x0/0x20 @ 1
[    1.739540] initcall bq24022_init+0x0/0x20 returned -19 after 474 usecs
[    1.739635] calling  rand_initialize+0x0/0x30 @ 1
[    1.739755] initcall rand_initialize+0x0/0x30 returned 0 after 28 usecs
[    1.739847] calling  tty_init+0x0/0x110 @ 1
[    1.740049] PM: Adding info for No Bus:tty
[    1.740465] PM: Adding info for No Bus:console
[    1.740863] PM: Adding info for No Bus:tty0
[    1.741536] PM: Adding info for No Bus:vcs
[    1.742061] PM: Adding info for No Bus:vcsa
[    1.742512] PM: Adding info for No Bus:vcs1
[    1.742929] PM: Adding info for No Bus:vcsa1
[    1.743399] PM: Adding info for No Bus:tty1
[    1.743823] PM: Adding info for No Bus:tty2
[    1.744298] PM: Adding info for No Bus:tty3
[    1.744736] PM: Adding info for No Bus:tty4
[    1.745248] PM: Adding info for No Bus:tty5
[    1.745686] PM: Adding info for No Bus:tty6
[    1.746125] PM: Adding info for No Bus:tty7
[    1.746561] PM: Adding info for No Bus:tty8
[    1.746984] PM: Adding info for No Bus:tty9
[    1.747412] PM: Adding info for No Bus:tty10
[    1.747830] PM: Adding info for No Bus:tty11
[    1.748397] PM: Adding info for No Bus:tty12
[    1.748812] PM: Adding info for No Bus:tty13
[    1.749229] PM: Adding info for No Bus:tty14
[    1.749671] PM: Adding info for No Bus:tty15
[    1.750104] PM: Adding info for No Bus:tty16
[    1.750570] PM: Adding info for No Bus:tty17
[    1.750989] PM: Adding info for No Bus:tty18
[    1.751417] PM: Adding info for No Bus:tty19
[    1.751843] PM: Adding info for No Bus:tty20
[    1.752316] PM: Adding info for No Bus:tty21
[    1.752751] PM: Adding info for No Bus:tty22
[    1.753280] PM: Adding info for No Bus:tty23
[    1.753708] PM: Adding info for No Bus:tty24
[    1.754143] PM: Adding info for No Bus:tty25
[    1.754577] PM: Adding info for No Bus:tty26
[    1.754998] PM: Adding info for No Bus:tty27
[    1.755427] PM: Adding info for No Bus:tty28
[    1.755855] PM: Adding info for No Bus:tty29
[    1.756396] PM: Adding info for No Bus:tty30
[    1.756810] PM: Adding info for No Bus:tty31
[    1.757237] PM: Adding info for No Bus:tty32
[    1.757676] PM: Adding info for No Bus:tty33
[    1.758105] PM: Adding info for No Bus:tty34
[    1.758565] PM: Adding info for No Bus:tty35
[    1.758988] PM: Adding info for No Bus:tty36
[    1.759419] PM: Adding info for No Bus:tty37
[    1.759839] PM: Adding info for No Bus:tty38
[    1.760306] PM: Adding info for No Bus:tty39
[    1.760733] PM: Adding info for No Bus:tty40
[    1.761278] PM: Adding info for No Bus:tty41
[    1.761708] PM: Adding info for No Bus:tty42
[    1.762146] PM: Adding info for No Bus:tty43
[    1.762584] PM: Adding info for No Bus:tty44
[    1.763016] PM: Adding info for No Bus:tty45
[    1.763443] PM: Adding info for No Bus:tty46
[    1.763869] PM: Adding info for No Bus:tty47
[    1.764407] PM: Adding info for No Bus:tty48
[    1.764825] PM: Adding info for No Bus:tty49
[    1.765267] PM: Adding info for No Bus:tty50
[    1.765693] PM: Adding info for No Bus:tty51
[    1.766135] PM: Adding info for No Bus:tty52
[    1.766604] PM: Adding info for No Bus:tty53
[    1.767044] PM: Adding info for No Bus:tty54
[    1.767479] PM: Adding info for No Bus:tty55
[    1.767900] PM: Adding info for No Bus:tty56
[    1.768353] PM: Adding info for No Bus:tty57
[    1.768786] PM: Adding info for No Bus:tty58
[    1.769387] PM: Adding info for No Bus:tty59
[    1.769807] PM: Adding info for No Bus:tty60
[    1.770227] PM: Adding info for No Bus:tty61
[    1.770677] PM: Adding info for No Bus:tty62
[    1.771115] PM: Adding info for No Bus:tty63
[    1.771672] initcall tty_init+0x0/0x110 returned 0 after 30986 usecs
[    1.771765] calling  pty_init+0x0/0x3e0 @ 1
[    1.772001] PM: Adding info for No Bus:ptyp0
[    1.772429] PM: Adding info for No Bus:ptyp1
[    1.772856] PM: Adding info for No Bus:ptyp2
[    1.773306] PM: Adding info for No Bus:ptyp3
[    1.773732] PM: Adding info for No Bus:ptyp4
[    1.774219] PM: Adding info for No Bus:ptyp5
[    1.774665] PM: Adding info for No Bus:ptyp6
[    1.775096] PM: Adding info for No Bus:ptyp7
[    1.775528] PM: Adding info for No Bus:ptyp8
[    1.775953] PM: Adding info for No Bus:ptyp9
[    1.776401] PM: Adding info for No Bus:ptypa
[    1.776816] PM: Adding info for No Bus:ptypb
[    1.777386] PM: Adding info for No Bus:ptypc
[    1.777800] PM: Adding info for No Bus:ptypd
[    1.778227] PM: Adding info for No Bus:ptype
[    1.778668] PM: Adding info for No Bus:ptypf
[    1.779098] PM: Adding info for No Bus:ptyq0
[    1.779557] PM: Adding info for No Bus:ptyq1
[    1.779973] PM: Adding info for No Bus:ptyq2
[    1.780405] PM: Adding info for No Bus:ptyq3
[    1.780825] PM: Adding info for No Bus:ptyq4
[    1.781304] PM: Adding info for No Bus:ptyq5
[    1.781729] PM: Adding info for No Bus:ptyq6
[    1.782237] PM: Adding info for No Bus:ptyq7
[    1.782682] PM: Adding info for No Bus:ptyq8
[    1.783130] PM: Adding info for No Bus:ptyq9
[    1.783573] PM: Adding info for No Bus:ptyqa
[    1.783992] PM: Adding info for No Bus:ptyqb
[    1.784418] PM: Adding info for No Bus:ptyqc
[    1.784843] PM: Adding info for No Bus:ptyqd
[    1.785401] PM: Adding info for No Bus:ptyqe
[    1.785813] PM: Adding info for No Bus:ptyqf
[    1.786232] PM: Adding info for No Bus:ptyr0
[    1.786671] PM: Adding info for No Bus:ptyr1
[    1.787108] PM: Adding info for No Bus:ptyr2
[    1.787569] PM: Adding info for No Bus:ptyr3
[    1.787990] PM: Adding info for No Bus:ptyr4
[    1.788419] PM: Adding info for No Bus:ptyr5
[    1.788843] PM: Adding info for No Bus:ptyr6
[    1.789314] PM: Adding info for No Bus:ptyr7
[    1.789731] PM: Adding info for No Bus:ptyr8
[    1.790245] PM: Adding info for No Bus:ptyr9
[    1.790692] PM: Adding info for No Bus:ptyra
[    1.791128] PM: Adding info for No Bus:ptyrb
[    1.791563] PM: Adding info for No Bus:ptyrc
[    1.791988] PM: Adding info for No Bus:ptyrd
[    1.792415] PM: Adding info for No Bus:ptyre
[    1.792837] PM: Adding info for No Bus:ptyrf
[    1.793400] PM: Adding info for No Bus:ptys0
[    1.793819] PM: Adding info for No Bus:ptys1
[    1.794244] PM: Adding info for No Bus:ptys2
[    1.794690] PM: Adding info for No Bus:ptys3
[    1.795124] PM: Adding info for No Bus:ptys4
[    1.795589] PM: Adding info for No Bus:ptys5
[    1.796009] PM: Adding info for No Bus:ptys6
[    1.796439] PM: Adding info for No Bus:ptys7
[    1.796860] PM: Adding info for No Bus:ptys8
[    1.797329] PM: Adding info for No Bus:ptys9
[    1.797755] PM: Adding info for No Bus:ptysa
[    1.798286] PM: Adding info for No Bus:ptysb
[    1.798716] PM: Adding info for No Bus:ptysc
[    1.799156] PM: Adding info for No Bus:ptysd
[    1.799600] PM: Adding info for No Bus:ptyse
[    1.800027] PM: Adding info for No Bus:ptysf
[    1.800466] PM: Adding info for No Bus:ptyt0
[    1.800893] PM: Adding info for No Bus:ptyt1
[    1.801411] PM: Adding info for No Bus:ptyt2
[    1.801828] PM: Adding info for No Bus:ptyt3
[    1.802309] PM: Adding info for No Bus:ptyt4
[    1.802731] PM: Adding info for No Bus:ptyt5
[    1.803172] PM: Adding info for No Bus:ptyt6
[    1.803621] PM: Adding info for No Bus:ptyt7
[    1.804065] PM: Adding info for No Bus:ptyt8
[    1.804503] PM: Adding info for No Bus:ptyt9
[    1.804925] PM: Adding info for No Bus:ptyta
[    1.805407] PM: Adding info for No Bus:ptytb
[    1.805961] PM: Adding info for No Bus:ptytc
[    1.806470] PM: Adding info for No Bus:ptytd
[    1.806894] PM: Adding info for No Bus:ptyte
[    1.807352] PM: Adding info for No Bus:ptytf
[    1.807775] PM: Adding info for No Bus:ptyu0
[    1.808312] PM: Adding info for No Bus:ptyu1
[    1.808745] PM: Adding info for No Bus:ptyu2
[    1.809182] PM: Adding info for No Bus:ptyu3
[    1.809641] PM: Adding info for No Bus:ptyu4
[    1.810907] PM: Adding info for No Bus:ptyu5
[    1.811357] PM: Adding info for No Bus:ptyu6
[    1.811780] PM: Adding info for No Bus:ptyu7
[    1.812237] PM: Adding info for No Bus:ptyu8
[    1.812693] PM: Adding info for No Bus:ptyu9
[    1.813129] PM: Adding info for No Bus:ptyua
[    1.813569] PM: Adding info for No Bus:ptyub
[    1.814010] PM: Adding info for No Bus:ptyuc
[    1.814439] PM: Adding info for No Bus:ptyud
[    1.814862] PM: Adding info for No Bus:ptyue
[    1.815316] PM: Adding info for No Bus:ptyuf
[    1.815746] PM: Adding info for No Bus:ptyv0
[    1.816246] PM: Adding info for No Bus:ptyv1
[    1.816694] PM: Adding info for No Bus:ptyv2
[    1.817148] PM: Adding info for No Bus:ptyv3
[    1.817584] PM: Adding info for No Bus:ptyv4
[    1.818018] PM: Adding info for No Bus:ptyv5
[    1.818445] PM: Adding info for No Bus:ptyv6
[    1.818867] PM: Adding info for No Bus:ptyv7
[    1.819396] PM: Adding info for No Bus:ptyv8
[    1.819816] PM: Adding info for No Bus:ptyv9
[    1.820243] PM: Adding info for No Bus:ptyva
[    1.820687] PM: Adding info for No Bus:ptyvb
[    1.821122] PM: Adding info for No Bus:ptyvc
[    1.821588] PM: Adding info for No Bus:ptyvd
[    1.822012] PM: Adding info for No Bus:ptyve
[    1.822447] PM: Adding info for No Bus:ptyvf
[    1.822881] PM: Adding info for No Bus:ptyw0
[    1.823342] PM: Adding info for No Bus:ptyw1
[    1.823767] PM: Adding info for No Bus:ptyw2
[    1.824302] PM: Adding info for No Bus:ptyw3
[    1.824741] PM: Adding info for No Bus:ptyw4
[    1.825193] PM: Adding info for No Bus:ptyw5
[    1.825637] PM: Adding info for No Bus:ptyw6
[    1.826078] PM: Adding info for No Bus:ptyw7
[    1.826520] PM: Adding info for No Bus:ptyw8
[    1.826944] PM: Adding info for No Bus:ptyw9
[    1.827463] PM: Adding info for No Bus:ptywa
[    1.827888] PM: Adding info for No Bus:ptywb
[    1.828357] PM: Adding info for No Bus:ptywc
[    1.828779] PM: Adding info for No Bus:ptywd
[    1.829247] PM: Adding info for No Bus:ptywe
[    1.829718] PM: Adding info for No Bus:ptywf
[    1.830149] PM: Adding info for No Bus:ptyx0
[    1.830608] PM: Adding info for No Bus:ptyx1
[    1.831055] PM: Adding info for No Bus:ptyx2
[    1.831499] PM: Adding info for No Bus:ptyx3
[    1.831931] PM: Adding info for No Bus:ptyx4
[    1.832394] PM: Adding info for No Bus:ptyx5
[    1.832822] PM: Adding info for No Bus:ptyx6
[    1.833385] PM: Adding info for No Bus:ptyx7
[    1.833807] PM: Adding info for No Bus:ptyx8
[    1.834235] PM: Adding info for No Bus:ptyx9
[    1.834678] PM: Adding info for No Bus:ptyxa
[    1.835112] PM: Adding info for No Bus:ptyxb
[    1.835578] PM: Adding info for No Bus:ptyxc
[    1.836005] PM: Adding info for No Bus:ptyxd
[    1.836436] PM: Adding info for No Bus:ptyxe
[    1.836859] PM: Adding info for No Bus:ptyxf
[    1.837319] PM: Adding info for No Bus:ptyy0
[    1.837748] PM: Adding info for No Bus:ptyy1
[    1.838285] PM: Adding info for No Bus:ptyy2
[    1.838731] PM: Adding info for No Bus:ptyy3
[    1.839180] PM: Adding info for No Bus:ptyy4
[    1.839631] PM: Adding info for No Bus:ptyy5
[    1.840071] PM: Adding info for No Bus:ptyy6
[    1.840513] PM: Adding info for No Bus:ptyy7
[    1.840941] PM: Adding info for No Bus:ptyy8
[    1.841449] PM: Adding info for No Bus:ptyy9
[    1.841873] PM: Adding info for No Bus:ptyya
[    1.842332] PM: Adding info for No Bus:ptyyb
[    1.842758] PM: Adding info for No Bus:ptyyc
[    1.843207] PM: Adding info for No Bus:ptyyd
[    1.843661] PM: Adding info for No Bus:ptyye
[    1.844106] PM: Adding info for No Bus:ptyyf
[    1.844556] PM: Adding info for No Bus:ptyz0
[    1.844986] PM: Adding info for No Bus:ptyz1
[    1.845439] PM: Adding info for No Bus:ptyz2
[    1.845864] PM: Adding info for No Bus:ptyz3
[    1.846392] PM: Adding info for No Bus:ptyz4
[    1.846820] PM: Adding info for No Bus:ptyz5
[    1.847269] PM: Adding info for No Bus:ptyz6
[    1.847696] PM: Adding info for No Bus:ptyz7
[    1.848134] PM: Adding info for No Bus:ptyz8
[    1.848613] PM: Adding info for No Bus:ptyz9
[    1.849043] PM: Adding info for No Bus:ptyza
[    1.849487] PM: Adding info for No Bus:ptyzb
[    1.849920] PM: Adding info for No Bus:ptyzc
[    1.850385] PM: Adding info for No Bus:ptyzd
[    1.850822] PM: Adding info for No Bus:ptyze
[    1.851313] PM: Adding info for No Bus:ptyzf
[    1.851741] PM: Adding info for No Bus:ptya0
[    1.852278] PM: Adding info for No Bus:ptya1
[    1.852717] PM: Adding info for No Bus:ptya2
[    1.853171] PM: Adding info for No Bus:ptya3
[    1.853617] PM: Adding info for No Bus:ptya4
[    1.854050] PM: Adding info for No Bus:ptya5
[    1.854497] PM: Adding info for No Bus:ptya6
[    1.854932] PM: Adding info for No Bus:ptya7
[    1.855450] PM: Adding info for No Bus:ptya8
[    1.855883] PM: Adding info for No Bus:ptya9
[    1.856339] PM: Adding info for No Bus:ptyaa
[    1.856764] PM: Adding info for No Bus:ptyab
[    1.857245] PM: Adding info for No Bus:ptyac
[    1.857734] PM: Adding info for No Bus:ptyad
[    1.858183] PM: Adding info for No Bus:ptyae
[    1.858633] PM: Adding info for No Bus:ptyaf
[    1.859068] PM: Adding info for No Bus:ptyb0
[    1.859511] PM: Adding info for No Bus:ptyb1
[    1.859946] PM: Adding info for No Bus:ptyb2
[    1.860463] PM: Adding info for No Bus:ptyb3
[    1.860891] PM: Adding info for No Bus:ptyb4
[    1.861354] PM: Adding info for No Bus:ptyb5
[    1.861783] PM: Adding info for No Bus:ptyb6
[    1.862314] PM: Adding info for No Bus:ptyb7
[    1.862739] PM: Adding info for No Bus:ptyb8
[    1.863190] PM: Adding info for No Bus:ptyb9
[    1.863662] PM: Adding info for No Bus:ptyba
[    1.864109] PM: Adding info for No Bus:ptybb
[    1.864560] PM: Adding info for No Bus:ptybc
[    1.864990] PM: Adding info for No Bus:ptybd
[    1.865426] PM: Adding info for No Bus:ptybe
[    1.865867] PM: Adding info for No Bus:ptybf
[    1.866399] PM: Adding info for No Bus:ptyc0
[    1.866824] PM: Adding info for No Bus:ptyc1
[    1.867276] PM: Adding info for No Bus:ptyc2
[    1.867707] PM: Adding info for No Bus:ptyc3
[    1.868149] PM: Adding info for No Bus:ptyc4
[    1.868629] PM: Adding info for No Bus:ptyc5
[    1.869070] PM: Adding info for No Bus:ptyc6
[    1.869516] PM: Adding info for No Bus:ptyc7
[    1.869956] PM: Adding info for No Bus:ptyc8
[    1.870411] PM: Adding info for No Bus:ptyc9
[    1.870993] PM: Adding info for No Bus:ptyca
[    1.871489] PM: Adding info for No Bus:ptycb
[    1.871921] PM: Adding info for No Bus:ptycc
[    1.872381] PM: Adding info for No Bus:ptycd
[    1.872806] PM: Adding info for No Bus:ptyce
[    1.873320] PM: Adding info for No Bus:ptycf
[    1.873759] PM: Adding info for No Bus:ptyd0
[    1.874208] PM: Adding info for No Bus:ptyd1
[    1.874687] PM: Adding info for No Bus:ptyd2
[    1.875151] PM: Adding info for No Bus:ptyd3
[    1.875594] PM: Adding info for No Bus:ptyd4
[    1.876032] PM: Adding info for No Bus:ptyd5
[    1.876483] PM: Adding info for No Bus:ptyd6
[    1.876912] PM: Adding info for No Bus:ptyd7
[    1.877440] PM: Adding info for No Bus:ptyd8
[    1.877870] PM: Adding info for No Bus:ptyd9
[    1.878339] PM: Adding info for No Bus:ptyda
[    1.878775] PM: Adding info for No Bus:ptydb
[    1.879218] PM: Adding info for No Bus:ptydc
[    1.879666] PM: Adding info for No Bus:ptydd
[    1.880108] PM: Adding info for No Bus:ptyde
[    1.880580] PM: Adding info for No Bus:ptydf
[    1.881012] PM: Adding info for No Bus:ptye0
[    1.881450] PM: Adding info for No Bus:ptye1
[    1.881883] PM: Adding info for No Bus:ptye2
[    1.882350] PM: Adding info for No Bus:ptye3
[    1.882791] PM: Adding info for No Bus:ptye4
[    1.883317] PM: Adding info for No Bus:ptye5
[    1.883750] PM: Adding info for No Bus:ptye6
[    1.884294] PM: Adding info for No Bus:ptye7
[    1.884741] PM: Adding info for No Bus:ptye8
[    1.885200] PM: Adding info for No Bus:ptye9
[    1.885647] PM: Adding info for No Bus:ptyea
[    1.886085] PM: Adding info for No Bus:ptyeb
[    1.886536] PM: Adding info for No Bus:ptyec
[    1.886975] PM: Adding info for No Bus:ptyed
[    1.887471] PM: Adding info for No Bus:ptyee
[    1.887896] PM: Adding info for No Bus:ptyef
[    1.888370] PM: Adding info for No Bus:ttyp0
[    1.888804] PM: Adding info for No Bus:ttyp1
[    1.889291] PM: Adding info for No Bus:ttyp2
[    1.889721] PM: Adding info for No Bus:ttyp3
[    1.890223] PM: Adding info for No Bus:ttyp4
[    1.890677] PM: Adding info for No Bus:ttyp5
[    1.891119] PM: Adding info for No Bus:ttyp6
[    1.891568] PM: Adding info for No Bus:ttyp7
[    1.892006] PM: Adding info for No Bus:ttyp8
[    1.893230] PM: Adding info for No Bus:ttyp9
[    1.893723] PM: Adding info for No Bus:ttypa
[    1.894304] PM: Adding info for No Bus:ttypb
[    1.894742] PM: Adding info for No Bus:ttypc
[    1.895196] PM: Adding info for No Bus:ttypd
[    1.895648] PM: Adding info for No Bus:ttype
[    1.896084] PM: Adding info for No Bus:ttypf
[    1.896553] PM: Adding info for No Bus:ttyq0
[    1.896997] PM: Adding info for No Bus:ttyq1
[    1.897468] PM: Adding info for No Bus:ttyq2
[    1.897895] PM: Adding info for No Bus:ttyq3
[    1.898355] PM: Adding info for No Bus:ttyq4
[    1.898784] PM: Adding info for No Bus:ttyq5
[    1.899324] PM: Adding info for No Bus:ttyq6
[    1.899752] PM: Adding info for No Bus:ttyq7
[    1.900205] PM: Adding info for No Bus:ttyq8
[    1.900688] PM: Adding info for No Bus:ttyq9
[    1.901141] PM: Adding info for No Bus:ttyqa
[    1.901587] PM: Adding info for No Bus:ttyqb
[    1.902034] PM: Adding info for No Bus:ttyqc
[    1.902485] PM: Adding info for No Bus:ttyqd
[    1.902916] PM: Adding info for No Bus:ttyqe
[    1.903440] PM: Adding info for No Bus:ttyqf
[    1.903871] PM: Adding info for No Bus:ttyr0
[    1.904330] PM: Adding info for No Bus:ttyr1
[    1.904766] PM: Adding info for No Bus:ttyr2
[    1.905218] PM: Adding info for No Bus:ttyr3
[    1.905682] PM: Adding info for No Bus:ttyr4
[    1.906138] PM: Adding info for No Bus:ttyr5
[    1.906583] PM: Adding info for No Bus:ttyr6
[    1.907020] PM: Adding info for No Bus:ttyr7
[    1.907459] PM: Adding info for No Bus:ttyr8
[    1.907891] PM: Adding info for No Bus:ttyr9
[    1.908412] PM: Adding info for No Bus:ttyra
[    1.908849] PM: Adding info for No Bus:ttyrb
[    1.909319] PM: Adding info for No Bus:ttyrc
[    1.909756] PM: Adding info for No Bus:ttyrd
[    1.910207] PM: Adding info for No Bus:ttyre
[    1.910685] PM: Adding info for No Bus:ttyrf
[    1.911132] PM: Adding info for No Bus:ttys0
[    1.911586] PM: Adding info for No Bus:ttys1
[    1.912029] PM: Adding info for No Bus:ttys2
[    1.912499] PM: Adding info for No Bus:ttys3
[    1.912934] PM: Adding info for No Bus:ttys4
[    1.913449] PM: Adding info for No Bus:ttys5
[    1.913879] PM: Adding info for No Bus:ttys6
[    1.914345] PM: Adding info for No Bus:ttys7
[    1.914785] PM: Adding info for No Bus:ttys8
[    1.915235] PM: Adding info for No Bus:ttys9
[    1.915694] PM: Adding info for No Bus:ttysa
[    1.916142] PM: Adding info for No Bus:ttysb
[    1.916624] PM: Adding info for No Bus:ttysc
[    1.917077] PM: Adding info for No Bus:ttysd
[    1.917526] PM: Adding info for No Bus:ttyse
[    1.917966] PM: Adding info for No Bus:ttysf
[    1.918418] PM: Adding info for No Bus:ttyt0
[    1.918865] PM: Adding info for No Bus:ttyt1
[    1.919414] PM: Adding info for No Bus:ttyt2
[    1.919849] PM: Adding info for No Bus:ttyt3
[    1.920301] PM: Adding info for No Bus:ttyt4
[    1.920739] PM: Adding info for No Bus:ttyt5
[    1.921311] PM: Adding info for No Bus:ttyt6
[    1.921753] PM: Adding info for No Bus:ttyt7
[    1.922213] PM: Adding info for No Bus:ttyt8
[    1.922662] PM: Adding info for No Bus:ttyt9
[    1.923108] PM: Adding info for No Bus:ttyta
[    1.923566] PM: Adding info for No Bus:ttytb
[    1.924006] PM: Adding info for No Bus:ttytc
[    1.924483] PM: Adding info for No Bus:ttytd
[    1.924918] PM: Adding info for No Bus:ttyte
[    1.925394] PM: Adding info for No Bus:ttytf
[    1.925830] PM: Adding info for No Bus:ttyu0
[    1.926342] PM: Adding info for No Bus:ttyu1
[    1.926781] PM: Adding info for No Bus:ttyu2
[    1.927288] PM: Adding info for No Bus:ttyu3
[    1.927741] PM: Adding info for No Bus:ttyu4
[    1.928308] PM: Adding info for No Bus:ttyu5
[    1.928755] PM: Adding info for No Bus:ttyu6
[    1.929222] PM: Adding info for No Bus:ttyu7
[    1.929679] PM: Adding info for No Bus:ttyu8
[    1.930124] PM: Adding info for No Bus:ttyu9
[    1.930573] PM: Adding info for No Bus:ttyua
[    1.931014] PM: Adding info for No Bus:ttyub
[    1.931474] PM: Adding info for No Bus:ttyuc
[    1.931917] PM: Adding info for No Bus:ttyud
[    1.932392] PM: Adding info for No Bus:ttyue
[    1.932827] PM: Adding info for No Bus:ttyuf
[    1.933341] PM: Adding info for No Bus:ttyv0
[    1.933774] PM: Adding info for No Bus:ttyv1
[    1.934291] PM: Adding info for No Bus:ttyv2
[    1.934744] PM: Adding info for No Bus:ttyv3
[    1.935202] PM: Adding info for No Bus:ttyv4
[    1.935656] PM: Adding info for No Bus:ttyv5
[    1.936109] PM: Adding info for No Bus:ttyv6
[    1.936709] PM: Adding info for No Bus:ttyv7
[    1.937166] PM: Adding info for No Bus:ttyv8
[    1.937692] PM: Adding info for No Bus:ttyv9
[    1.938146] PM: Adding info for No Bus:ttyva
[    1.938597] PM: Adding info for No Bus:ttyvb
[    1.939043] PM: Adding info for No Bus:ttyvc
[    1.939507] PM: Adding info for No Bus:ttyvd
[    1.939957] PM: Adding info for No Bus:ttyve
[    1.940488] PM: Adding info for No Bus:ttyvf
[    1.940922] PM: Adding info for No Bus:ttyw0
[    1.941391] PM: Adding info for No Bus:ttyw1
[    1.941829] PM: Adding info for No Bus:ttyw2
[    1.942328] PM: Adding info for No Bus:ttyw3
[    1.942768] PM: Adding info for No Bus:ttyw4
[    1.943229] PM: Adding info for No Bus:ttyw5
[    1.943728] PM: Adding info for No Bus:ttyw6
[    1.944190] PM: Adding info for No Bus:ttyw7
[    1.944646] PM: Adding info for No Bus:ttyw8
[    1.945099] PM: Adding info for No Bus:ttyw9
[    1.945573] PM: Adding info for No Bus:ttywa
[    1.946015] PM: Adding info for No Bus:ttywb
[    1.946489] PM: Adding info for No Bus:ttywc
[    1.946928] PM: Adding info for No Bus:ttywd
[    1.947402] PM: Adding info for No Bus:ttywe
[    1.947841] PM: Adding info for No Bus:ttywf
[    1.948350] PM: Adding info for No Bus:ttyx0
[    1.948789] PM: Adding info for No Bus:ttyx1
[    1.949293] PM: Adding info for No Bus:ttyx2
[    1.949734] PM: Adding info for No Bus:ttyx3
[    1.950299] PM: Adding info for No Bus:ttyx4
[    1.950744] PM: Adding info for No Bus:ttyx5
[    1.951214] PM: Adding info for No Bus:ttyx6
[    1.951671] PM: Adding info for No Bus:ttyx7
[    1.952120] PM: Adding info for No Bus:ttyx8
[    1.952574] PM: Adding info for No Bus:ttyx9
[    1.953021] PM: Adding info for No Bus:ttyxa
[    1.953536] PM: Adding info for No Bus:ttyxb
[    1.953978] PM: Adding info for No Bus:ttyxc
[    1.954440] PM: Adding info for No Bus:ttyxd
[    1.954882] PM: Adding info for No Bus:ttyxe
[    1.955373] PM: Adding info for No Bus:ttyxf
[    1.955811] PM: Adding info for No Bus:ttyy0
[    1.956303] PM: Adding info for No Bus:ttyy1
[    1.956752] PM: Adding info for No Bus:ttyy2
[    1.957327] PM: Adding info for No Bus:ttyy3
[    1.957779] PM: Adding info for No Bus:ttyy4
[    1.958247] PM: Adding info for No Bus:ttyy5
[    1.958710] PM: Adding info for No Bus:ttyy6
[    1.959159] PM: Adding info for No Bus:ttyy7
[    1.959627] PM: Adding info for No Bus:ttyy8
[    1.960077] PM: Adding info for No Bus:ttyy9
[    1.960592] PM: Adding info for No Bus:ttyya
[    1.961041] PM: Adding info for No Bus:ttyyb
[    1.961550] PM: Adding info for No Bus:ttyyc
[    1.961988] PM: Adding info for No Bus:ttyyd
[    1.962449] PM: Adding info for No Bus:ttyye
[    1.962907] PM: Adding info for No Bus:ttyyf
[    1.963400] PM: Adding info for No Bus:ttyz0
[    1.963844] PM: Adding info for No Bus:ttyz1
[    1.964346] PM: Adding info for No Bus:ttyz2
[    1.964794] PM: Adding info for No Bus:ttyz3
[    1.965318] PM: Adding info for No Bus:ttyz4
[    1.965766] PM: Adding info for No Bus:ttyz5
[    1.966309] PM: Adding info for No Bus:ttyz6
[    1.966765] PM: Adding info for No Bus:ttyz7
[    1.967235] PM: Adding info for No Bus:ttyz8
[    1.967695] PM: Adding info for No Bus:ttyz9
[    1.968157] PM: Adding info for No Bus:ttyza
[    1.968637] PM: Adding info for No Bus:ttyzb
[    1.969086] PM: Adding info for No Bus:ttyzc
[    1.969594] PM: Adding info for No Bus:ttyzd
[    1.970043] PM: Adding info for No Bus:ttyze
[    1.970555] PM: Adding info for No Bus:ttyzf
[    1.971005] PM: Adding info for No Bus:ttya0
[    1.971458] PM: Adding info for No Bus:ttya1
[    1.971905] PM: Adding info for No Bus:ttya2
[    1.972392] PM: Adding info for No Bus:ttya3
[    1.972849] PM: Adding info for No Bus:ttya4
[    1.973356] PM: Adding info for No Bus:ttya5
[    1.973800] PM: Adding info for No Bus:ttya6
[    1.974324] PM: Adding info for No Bus:ttya7
[    1.974775] PM: Adding info for No Bus:ttya8
[    1.975321] PM: Adding info for No Bus:ttya9
[    1.975760] PM: Adding info for No Bus:ttyaa
[    1.976318] PM: Adding info for No Bus:ttyab
[    1.976771] PM: Adding info for No Bus:ttyac
[    1.978008] PM: Adding info for No Bus:ttyad
[    1.978457] PM: Adding info for No Bus:ttyae
[    1.978912] PM: Adding info for No Bus:ttyaf
[    1.979404] PM: Adding info for No Bus:ttyb0
[    1.979845] PM: Adding info for No Bus:ttyb1
[    1.980329] PM: Adding info for No Bus:ttyb2
[    1.980791] PM: Adding info for No Bus:ttyb3
[    1.981238] PM: Adding info for No Bus:ttyb4
[    1.981711] PM: Adding info for No Bus:ttyb5
[    1.982162] PM: Adding info for No Bus:ttyb6
[    1.982646] PM: Adding info for No Bus:ttyb7
[    1.983104] PM: Adding info for No Bus:ttyb8
[    1.983569] PM: Adding info for No Bus:ttyb9
[    1.984023] PM: Adding info for No Bus:ttyba
[    1.984485] PM: Adding info for No Bus:ttybb
[    1.984935] PM: Adding info for No Bus:ttybc
[    1.985470] PM: Adding info for No Bus:ttybd
[    1.985914] PM: Adding info for No Bus:ttybe
[    1.986398] PM: Adding info for No Bus:ttybf
[    1.986846] PM: Adding info for No Bus:ttyc0
[    1.987339] PM: Adding info for No Bus:ttyc1
[    1.987789] PM: Adding info for No Bus:ttyc2
[    1.988241] PM: Adding info for No Bus:ttyc3
[    1.988730] PM: Adding info for No Bus:ttyc4
[    1.989293] PM: Adding info for No Bus:ttyc5
[    1.989746] PM: Adding info for No Bus:ttyc6
[    1.990215] PM: Adding info for No Bus:ttyc7
[    1.990679] PM: Adding info for No Bus:ttyc8
[    1.991139] PM: Adding info for No Bus:ttyc9
[    1.991613] PM: Adding info for No Bus:ttyca
[    1.992070] PM: Adding info for No Bus:ttycb
[    1.992581] PM: Adding info for No Bus:ttycc
[    1.993036] PM: Adding info for No Bus:ttycd
[    1.993506] PM: Adding info for No Bus:ttyce
[    1.993948] PM: Adding info for No Bus:ttycf
[    1.994452] PM: Adding info for No Bus:ttyd0
[    1.994896] PM: Adding info for No Bus:ttyd1
[    1.995371] PM: Adding info for No Bus:ttyd2
[    1.995823] PM: Adding info for No Bus:ttyd3
[    1.996351] PM: Adding info for No Bus:ttyd4
[    1.996795] PM: Adding info for No Bus:ttyd5
[    1.997326] PM: Adding info for No Bus:ttyd6
[    1.997788] PM: Adding info for No Bus:ttyd7
[    1.998317] PM: Adding info for No Bus:ttyd8
[    1.998767] PM: Adding info for No Bus:ttyd9
[    1.999327] PM: Adding info for No Bus:ttyda
[    1.999783] PM: Adding info for No Bus:ttydb
[    2.000278] PM: Adding info for No Bus:ttydc
[    2.000733] PM: Adding info for No Bus:ttydd
[    2.001294] PM: Adding info for No Bus:ttyde
[    2.001750] PM: Adding info for No Bus:ttydf
[    2.002216] PM: Adding info for No Bus:ttye0
[    2.002735] PM: Adding info for No Bus:ttye1
[    2.003370] PM: Adding info for No Bus:ttye2
[    2.003821] PM: Adding info for No Bus:ttye3
[    2.004309] PM: Adding info for No Bus:ttye4
[    2.004884] PM: Adding info for No Bus:ttye5
[    2.005403] PM: Adding info for No Bus:ttye6
[    2.005872] PM: Adding info for No Bus:ttye7
[    2.006424] PM: Adding info for No Bus:ttye8
[    2.006871] PM: Adding info for No Bus:ttye9
[    2.007333] PM: Adding info for No Bus:ttyea
[    2.007786] PM: Adding info for No Bus:ttyeb
[    2.008344] PM: Adding info for No Bus:ttyec
[    2.008793] PM: Adding info for No Bus:ttyed
[    2.009337] PM: Adding info for No Bus:ttyee
[    2.009787] PM: Adding info for No Bus:ttyef
[    2.010380] PM: Adding info for No Bus:ptmx
[    2.010695] initcall pty_init+0x0/0x3e0 returned 0 after 233237 usecs
[    2.010788] calling  sysrq_init+0x0/0x30 @ 1
[    2.010905] initcall sysrq_init+0x0/0x30 returned 0 after 25 usecs
[    2.010998] calling  cy_init+0x0/0x490 @ 1
[    2.011096] Cyclades driver 2.5 (built Aug 21 2009 22:16:19)
[    2.026572] initcall cy_init+0x0/0x490 returned 0 after 15115 usecs
[    2.026665] calling  nozomi_init+0x0/0x110 @ 1
[    2.026754] Initializing Nozomi driver 2.1d (build date: Aug 21 2009 22:16:20)
[    2.027244] initcall nozomi_init+0x0/0x110 returned 0 after 476 usecs
[    2.027353] calling  epca_module_init+0x0/0x480 @ 1
[    2.027452] DIGI epca driver version 1.3.0.1-LK2.6 loaded.
[    2.027985] PM: Adding info for No Bus:ttyD0
[    2.028443] PM: Adding info for No Bus:ttyD1
[    2.028898] PM: Adding info for No Bus:ttyD2
[    2.029371] PM: Adding info for No Bus:ttyD3
[    2.029820] PM: Adding info for No Bus:ttyD4
[    2.030328] PM: Adding info for No Bus:ttyD5
[    2.030782] PM: Adding info for No Bus:ttyD6
[    2.031324] PM: Adding info for No Bus:ttyD7
[    2.031774] PM: Adding info for No Bus:ttyD8
[    2.032310] PM: Adding info for No Bus:ttyD9
[    2.032775] PM: Adding info for No Bus:ttyD10
[    2.033263] PM: Adding info for No Bus:ttyD11
[    2.033720] PM: Adding info for No Bus:ttyD12
[    2.034273] PM: Adding info for No Bus:ttyD13
[    2.034730] PM: Adding info for No Bus:ttyD14
[    2.035198] PM: Adding info for No Bus:ttyD15
[    2.035715] PM: Adding info for No Bus:ttyD16
[    2.036176] PM: Adding info for No Bus:ttyD17
[    2.036698] PM: Adding info for No Bus:ttyD18
[    2.037152] PM: Adding info for No Bus:ttyD19
[    2.037622] PM: Adding info for No Bus:ttyD20
[    2.038073] PM: Adding info for No Bus:ttyD21
[    2.038556] PM: Adding info for No Bus:ttyD22
[    2.039007] PM: Adding info for No Bus:ttyD23
[    2.039504] PM: Adding info for No Bus:ttyD24
[    2.039949] PM: Adding info for No Bus:ttyD25
[    2.040422] PM: Adding info for No Bus:ttyD26
[    2.040868] PM: Adding info for No Bus:ttyD27
[    2.041362] PM: Adding info for No Bus:ttyD28
[    2.041812] PM: Adding info for No Bus:ttyD29
[    2.042315] PM: Adding info for No Bus:ttyD30
[    2.042765] PM: Adding info for No Bus:ttyD31
[    2.043328] PM: Adding info for No Bus:ttyD32
[    2.043786] PM: Adding info for No Bus:ttyD33
[    2.044277] PM: Adding info for No Bus:ttyD34
[    2.044737] PM: Adding info for No Bus:ttyD35
[    2.045281] PM: Adding info for No Bus:ttyD36
[    2.045737] PM: Adding info for No Bus:ttyD37
[    2.046195] PM: Adding info for No Bus:ttyD38
[    2.046712] PM: Adding info for No Bus:ttyD39
[    2.047168] PM: Adding info for No Bus:ttyD40
[    2.047688] PM: Adding info for No Bus:ttyD41
[    2.048146] PM: Adding info for No Bus:ttyD42
[    2.048607] PM: Adding info for No Bus:ttyD43
[    2.049072] PM: Adding info for No Bus:ttyD44
[    2.049564] PM: Adding info for No Bus:ttyD45
[    2.050020] PM: Adding info for No Bus:ttyD46
[    2.050556] PM: Adding info for No Bus:ttyD47
[    2.051003] PM: Adding info for No Bus:ttyD48
[    2.051460] PM: Adding info for No Bus:ttyD49
[    2.051911] PM: Adding info for No Bus:ttyD50
[    2.052403] PM: Adding info for No Bus:ttyD51
[    2.052852] PM: Adding info for No Bus:ttyD52
[    2.053360] PM: Adding info for No Bus:ttyD53
[    2.053818] PM: Adding info for No Bus:ttyD54
[    2.054292] PM: Adding info for No Bus:ttyD55
[    2.054755] PM: Adding info for No Bus:ttyD56
[    2.055326] PM: Adding info for No Bus:ttyD57
[    2.055782] PM: Adding info for No Bus:ttyD58
[    2.056268] PM: Adding info for No Bus:ttyD59
[    2.056724] PM: Adding info for No Bus:ttyD60
[    2.057267] PM: Adding info for No Bus:ttyD61
[    2.057727] PM: Adding info for No Bus:ttyD62
[    2.058203] PM: Adding info for No Bus:ttyD63
[    2.058718] PM: Adding info for No Bus:ttyD64
[    2.059353] PM: Adding info for No Bus:ttyD65
[    2.059810] PM: Adding info for No Bus:ttyD66
[    2.060289] PM: Adding info for No Bus:ttyD67
[    2.060748] PM: Adding info for No Bus:ttyD68
[    2.061299] PM: Adding info for No Bus:ttyD69
[    2.061756] PM: Adding info for No Bus:ttyD70
[    2.062217] PM: Adding info for No Bus:ttyD71
[    2.062753] PM: Adding info for No Bus:ttyD72
[    2.063384] PM: Adding info for No Bus:ttyD73
[    2.063843] PM: Adding info for No Bus:ttyD74
[    2.064314] PM: Adding info for No Bus:ttyD75
[    2.064763] PM: Adding info for No Bus:ttyD76
[    2.065308] PM: Adding info for No Bus:ttyD77
[    2.065769] PM: Adding info for No Bus:ttyD78
[    2.066248] PM: Adding info for No Bus:ttyD79
[    2.066765] PM: Adding info for No Bus:ttyD80
[    2.067427] PM: Adding info for No Bus:ttyD81
[    2.067886] PM: Adding info for No Bus:ttyD82
[    2.068358] PM: Adding info for No Bus:ttyD83
[    2.068814] PM: Adding info for No Bus:ttyD84
[    2.069311] PM: Adding info for No Bus:ttyD85
[    2.069764] PM: Adding info for No Bus:ttyD86
[    2.070237] PM: Adding info for No Bus:ttyD87
[    2.070760] PM: Adding info for No Bus:ttyD88
[    2.071242] PM: Adding info for No Bus:ttyD89
[    2.071710] PM: Adding info for No Bus:ttyD90
[    2.072169] PM: Adding info for No Bus:ttyD91
[    2.072653] PM: Adding info for No Bus:ttyD92
[    2.073129] PM: Adding info for No Bus:ttyD93
[    2.073664] PM: Adding info for No Bus:ttyD94
[    2.074135] PM: Adding info for No Bus:ttyD95
[    2.074656] PM: Adding info for No Bus:ttyD96
[    2.075122] PM: Adding info for No Bus:ttyD97
[    2.075618] PM: Adding info for No Bus:ttyD98
[    2.076080] PM: Adding info for No Bus:ttyD99
[    2.077365] PM: Adding info for No Bus:ttyD100
[    2.077817] PM: Adding info for No Bus:ttyD101
[    2.078333] PM: Adding info for No Bus:ttyD102
[    2.078796] PM: Adding info for No Bus:ttyD103
[    2.079277] PM: Adding info for No Bus:ttyD104
[    2.079738] PM: Adding info for No Bus:ttyD105
[    2.080316] PM: Adding info for No Bus:ttyD106
[    2.080777] PM: Adding info for No Bus:ttyD107
[    2.081277] PM: Adding info for No Bus:ttyD108
[    2.081745] PM: Adding info for No Bus:ttyD109
[    2.082284] PM: Adding info for No Bus:ttyD110
[    2.082751] PM: Adding info for No Bus:ttyD111
[    2.083225] PM: Adding info for No Bus:ttyD112
[    2.083754] PM: Adding info for No Bus:ttyD113
[    2.084405] PM: Adding info for No Bus:ttyD114
[    2.084865] PM: Adding info for No Bus:ttyD115
[    2.085343] PM: Adding info for No Bus:ttyD116
[    2.085807] PM: Adding info for No Bus:ttyD117
[    2.086312] PM: Adding info for No Bus:ttyD118
[    2.086771] PM: Adding info for No Bus:ttyD119
[    2.087242] PM: Adding info for No Bus:ttyD120
[    2.087772] PM: Adding info for No Bus:ttyD121
[    2.088275] PM: Adding info for No Bus:ttyD122
[    2.088734] PM: Adding info for No Bus:ttyD123
[    2.089291] PM: Adding info for No Bus:ttyD124
[    2.089755] PM: Adding info for No Bus:ttyD125
[    2.090227] PM: Adding info for No Bus:ttyD126
[    2.090893] PM: Adding info for No Bus:ttyD127
[    2.091449] PM: Adding info for No Bus:ttyD128
[    2.091912] PM: Adding info for No Bus:ttyD129
[    2.092419] PM: Adding info for No Bus:ttyD130
[    2.092873] PM: Adding info for No Bus:ttyD131
[    2.093386] PM: Adding info for No Bus:ttyD132
[    2.093842] PM: Adding info for No Bus:ttyD133
[    2.094360] PM: Adding info for No Bus:ttyD134
[    2.094817] PM: Adding info for No Bus:ttyD135
[    2.095337] PM: Adding info for No Bus:ttyD136
[    2.095798] PM: Adding info for No Bus:ttyD137
[    2.096322] PM: Adding info for No Bus:ttyD138
[    2.096790] PM: Adding info for No Bus:ttyD139
[    2.097339] PM: Adding info for No Bus:ttyD140
[    2.097801] PM: Adding info for No Bus:ttyD141
[    2.098330] PM: Adding info for No Bus:ttyD142
[    2.098790] PM: Adding info for No Bus:ttyD143
[    2.099330] PM: Adding info for No Bus:ttyD144
[    2.099794] PM: Adding info for No Bus:ttyD145
[    2.100338] PM: Adding info for No Bus:ttyD146
[    2.100804] PM: Adding info for No Bus:ttyD147
[    2.101337] PM: Adding info for No Bus:ttyD148
[    2.101806] PM: Adding info for No Bus:ttyD149
[    2.102336] PM: Adding info for No Bus:ttyD150
[    2.102793] PM: Adding info for No Bus:ttyD151
[    2.103337] PM: Adding info for No Bus:ttyD152
[    2.103797] PM: Adding info for No Bus:ttyD153
[    2.104343] PM: Adding info for No Bus:ttyD154
[    2.104802] PM: Adding info for No Bus:ttyD155
[    2.105333] PM: Adding info for No Bus:ttyD156
[    2.105795] PM: Adding info for No Bus:ttyD157
[    2.106335] PM: Adding info for No Bus:ttyD158
[    2.106792] PM: Adding info for No Bus:ttyD159
[    2.107335] PM: Adding info for No Bus:ttyD160
[    2.107797] PM: Adding info for No Bus:ttyD161
[    2.108333] PM: Adding info for No Bus:ttyD162
[    2.108802] PM: Adding info for No Bus:ttyD163
[    2.109334] PM: Adding info for No Bus:ttyD164
[    2.109796] PM: Adding info for No Bus:ttyD165
[    2.110350] PM: Adding info for No Bus:ttyD166
[    2.110815] PM: Adding info for No Bus:ttyD167
[    2.111340] PM: Adding info for No Bus:ttyD168
[    2.111804] PM: Adding info for No Bus:ttyD169
[    2.112342] PM: Adding info for No Bus:ttyD170
[    2.112801] PM: Adding info for No Bus:ttyD171
[    2.113345] PM: Adding info for No Bus:ttyD172
[    2.113809] PM: Adding info for No Bus:ttyD173
[    2.114340] PM: Adding info for No Bus:ttyD174
[    2.114801] PM: Adding info for No Bus:ttyD175
[    2.115338] PM: Adding info for No Bus:ttyD176
[    2.115804] PM: Adding info for No Bus:ttyD177
[    2.116346] PM: Adding info for No Bus:ttyD178
[    2.116816] PM: Adding info for No Bus:ttyD179
[    2.117344] PM: Adding info for No Bus:ttyD180
[    2.117804] PM: Adding info for No Bus:ttyD181
[    2.118349] PM: Adding info for No Bus:ttyD182
[    2.118808] PM: Adding info for No Bus:ttyD183
[    2.119341] PM: Adding info for No Bus:ttyD184
[    2.119803] PM: Adding info for No Bus:ttyD185
[    2.120342] PM: Adding info for No Bus:ttyD186
[    2.120806] PM: Adding info for No Bus:ttyD187
[    2.121342] PM: Adding info for No Bus:ttyD188
[    2.121808] PM: Adding info for No Bus:ttyD189
[    2.122347] PM: Adding info for No Bus:ttyD190
[    2.122815] PM: Adding info for No Bus:ttyD191
[    2.123345] PM: Adding info for No Bus:ttyD192
[    2.123812] PM: Adding info for No Bus:ttyD193
[    2.124342] PM: Adding info for No Bus:ttyD194
[    2.124809] PM: Adding info for No Bus:ttyD195
[    2.125342] PM: Adding info for No Bus:ttyD196
[    2.125810] PM: Adding info for No Bus:ttyD197
[    2.126342] PM: Adding info for No Bus:ttyD198
[    2.126820] PM: Adding info for No Bus:ttyD199
[    2.127342] PM: Adding info for No Bus:ttyD200
[    2.127803] PM: Adding info for No Bus:ttyD201
[    2.128349] PM: Adding info for No Bus:ttyD202
[    2.128814] PM: Adding info for No Bus:ttyD203
[    2.129344] PM: Adding info for No Bus:ttyD204
[    2.129808] PM: Adding info for No Bus:ttyD205
[    2.130343] PM: Adding info for No Bus:ttyD206
[    2.130811] PM: Adding info for No Bus:ttyD207
[    2.131342] PM: Adding info for No Bus:ttyD208
[    2.131809] PM: Adding info for No Bus:ttyD209
[    2.132347] PM: Adding info for No Bus:ttyD210
[    2.132812] PM: Adding info for No Bus:ttyD211
[    2.133345] PM: Adding info for No Bus:ttyD212
[    2.133810] PM: Adding info for No Bus:ttyD213
[    2.134349] PM: Adding info for No Bus:ttyD214
[    2.134820] PM: Adding info for No Bus:ttyD215
[    2.135340] PM: Adding info for No Bus:ttyD216
[    2.135805] PM: Adding info for No Bus:ttyD217
[    2.136342] PM: Adding info for No Bus:ttyD218
[    2.136810] PM: Adding info for No Bus:ttyD219
[    2.137346] PM: Adding info for No Bus:ttyD220
[    2.137814] PM: Adding info for No Bus:ttyD221
[    2.138350] PM: Adding info for No Bus:ttyD222
[    2.138818] PM: Adding info for No Bus:ttyD223
[    2.139345] PM: Adding info for No Bus:ttyD224
[    2.139815] PM: Adding info for No Bus:ttyD225
[    2.140349] PM: Adding info for No Bus:ttyD226
[    2.140816] PM: Adding info for No Bus:ttyD227
[    2.141346] PM: Adding info for No Bus:ttyD228
[    2.141810] PM: Adding info for No Bus:ttyD229
[    2.142344] PM: Adding info for No Bus:ttyD230
[    2.142810] PM: Adding info for No Bus:ttyD231
[    2.143343] PM: Adding info for No Bus:ttyD232
[    2.143811] PM: Adding info for No Bus:ttyD233
[    2.144346] PM: Adding info for No Bus:ttyD234
[    2.144810] PM: Adding info for No Bus:ttyD235
[    2.145346] PM: Adding info for No Bus:ttyD236
[    2.145815] PM: Adding info for No Bus:ttyD237
[    2.146351] PM: Adding info for No Bus:ttyD238
[    2.146826] PM: Adding info for No Bus:ttyD239
[    2.147347] PM: Adding info for No Bus:ttyD240
[    2.147817] PM: Adding info for No Bus:ttyD241
[    2.148350] PM: Adding info for No Bus:ttyD242
[    2.148818] PM: Adding info for No Bus:ttyD243
[    2.149346] PM: Adding info for No Bus:ttyD244
[    2.149810] PM: Adding info for No Bus:ttyD245
[    2.150348] PM: Adding info for No Bus:ttyD246
[    2.150814] PM: Adding info for No Bus:ttyD247
[    2.151348] PM: Adding info for No Bus:ttyD248
[    2.151823] PM: Adding info for No Bus:ttyD249
[    2.152343] PM: Adding info for No Bus:ttyD250
[    2.152816] PM: Adding info for No Bus:ttyD251
[    2.153346] PM: Adding info for No Bus:ttyD252
[    2.153817] PM: Adding info for No Bus:ttyD253
[    2.154350] PM: Adding info for No Bus:ttyD254
[    2.154824] PM: Adding info for No Bus:ttyD255
[    2.155358] PM: Adding info for No Bus:digi_ctl0
[    2.155813] PM: Adding info for No Bus:digi_ctl1
[    2.156334] PM: Adding info for No Bus:digi_ctl2
[    2.156796] PM: Adding info for No Bus:digi_ctl3
[    2.157337] PM: Adding info for No Bus:digi_ctl4
[    2.157800] PM: Adding info for No Bus:digi_ctl5
[    2.158332] PM: Adding info for No Bus:digi_ctl6
[    2.158795] PM: Adding info for No Bus:digi_ctl7
[    2.159329] PM: Adding info for No Bus:digi_ctl8
[    2.159783] PM: Adding info for No Bus:digi_ctl9
[    2.160335] PM: Adding info for No Bus:digi_ctl10
[    2.160796] PM: Adding info for No Bus:digi_ctl11
[    2.161460] PM: Adding info for No Bus:digi_ctl12
[    2.161937] PM: Adding info for No Bus:digi_ctl13
[    2.162441] PM: Adding info for No Bus:digi_ctl14
[    2.162900] PM: Adding info for No Bus:digi_ctl15
[    2.163387] PM: Adding info for No Bus:digi_ctl16
[    2.163846] PM: Adding info for No Bus:digi_ctl17
[    2.164347] PM: Adding info for No Bus:digi_ctl18
[    2.164814] PM: Adding info for No Bus:digi_ctl19
[    2.165340] PM: Adding info for No Bus:digi_ctl20
[    2.165803] PM: Adding info for No Bus:digi_ctl21
[    2.166335] PM: Adding info for No Bus:digi_ctl22
[    2.166792] PM: Adding info for No Bus:digi_ctl23
[    2.168071] PM: Adding info for No Bus:digi_ctl24
[    2.168549] PM: Adding info for No Bus:digi_ctl25
[    2.169011] PM: Adding info for No Bus:digi_ctl26
[    2.169475] PM: Adding info for No Bus:digi_ctl27
[    2.169942] PM: Adding info for No Bus:digi_ctl28
[    2.170427] PM: Adding info for No Bus:digi_ctl29
[    2.170888] PM: Adding info for No Bus:digi_ctl30
[    2.171386] PM: Adding info for No Bus:digi_ctl31
[    2.171841] PM: Adding info for No Bus:digi_ctl32
[    2.172341] PM: Adding info for No Bus:digi_ctl33
[    2.172798] PM: Adding info for No Bus:digi_ctl34
[    2.173330] PM: Adding info for No Bus:digi_ctl35
[    2.173792] PM: Adding info for No Bus:digi_ctl36
[    2.174332] PM: Adding info for No Bus:digi_ctl37
[    2.174792] PM: Adding info for No Bus:digi_ctl38
[    2.175334] PM: Adding info for No Bus:digi_ctl39
[    2.175793] PM: Adding info for No Bus:digi_ctl40
[    2.176333] PM: Adding info for No Bus:digi_ctl41
[    2.176794] PM: Adding info for No Bus:digi_ctl42
[    2.177344] PM: Adding info for No Bus:digi_ctl43
[    2.177815] PM: Adding info for No Bus:digi_ctl44
[    2.178346] PM: Adding info for No Bus:digi_ctl45
[    2.178808] PM: Adding info for No Bus:digi_ctl46
[    2.179340] PM: Adding info for No Bus:digi_ctl47
[    2.179803] PM: Adding info for No Bus:digi_ctl48
[    2.180336] PM: Adding info for No Bus:digi_ctl49
[    2.180790] PM: Adding info for No Bus:digi_ctl50
[    2.181336] PM: Adding info for No Bus:digi_ctl51
[    2.181800] PM: Adding info for No Bus:digi_ctl52
[    2.182337] PM: Adding info for No Bus:digi_ctl53
[    2.182800] PM: Adding info for No Bus:digi_ctl54
[    2.183341] PM: Adding info for No Bus:digi_ctl55
[    2.183801] PM: Adding info for No Bus:digi_ctl56
[    2.184337] PM: Adding info for No Bus:digi_ctl57
[    2.184801] PM: Adding info for No Bus:digi_ctl58
[    2.185340] PM: Adding info for No Bus:digi_ctl59
[    2.185802] PM: Adding info for No Bus:digi_ctl60
[    2.186340] PM: Adding info for No Bus:digi_ctl61
[    2.186803] PM: Adding info for No Bus:digi_ctl62
[    2.187339] PM: Adding info for No Bus:digi_ctl63
[    2.187804] PM: Adding info for No Bus:digi_ctl64
[    2.188335] PM: Adding info for No Bus:digi_ctl65
[    2.188793] PM: Adding info for No Bus:digi_ctl66
[    2.189338] PM: Adding info for No Bus:digi_ctl67
[    2.189809] PM: Adding info for No Bus:digi_ctl68
[    2.190343] PM: Adding info for No Bus:digi_ctl69
[    2.190806] PM: Adding info for No Bus:digi_ctl70
[    2.191342] PM: Adding info for No Bus:digi_ctl71
[    2.191811] PM: Adding info for No Bus:digi_ctl72
[    2.192349] PM: Adding info for No Bus:digi_ctl73
[    2.192810] PM: Adding info for No Bus:digi_ctl74
[    2.193340] PM: Adding info for No Bus:digi_ctl75
[    2.193799] PM: Adding info for No Bus:digi_ctl76
[    2.194346] PM: Adding info for No Bus:digi_ctl77
[    2.194812] PM: Adding info for No Bus:digi_ctl78
[    2.195344] PM: Adding info for No Bus:digi_ctl79
[    2.195819] PM: Adding info for No Bus:digi_ctl80
[    2.196341] PM: Adding info for No Bus:digi_ctl81
[    2.196802] PM: Adding info for No Bus:digi_ctl82
[    2.197339] PM: Adding info for No Bus:digi_ctl83
[    2.197801] PM: Adding info for No Bus:digi_ctl84
[    2.198340] PM: Adding info for No Bus:digi_ctl85
[    2.198801] PM: Adding info for No Bus:digi_ctl86
[    2.199339] PM: Adding info for No Bus:digi_ctl87
[    2.199808] PM: Adding info for No Bus:digi_ctl88
[    2.200340] PM: Adding info for No Bus:digi_ctl89
[    2.200806] PM: Adding info for No Bus:digi_ctl90
[    2.201340] PM: Adding info for No Bus:digi_ctl91
[    2.201814] PM: Adding info for No Bus:digi_ctl92
[    2.202343] PM: Adding info for No Bus:digi_ctl93
[    2.202819] PM: Adding info for No Bus:digi_ctl94
[    2.203348] PM: Adding info for No Bus:digi_ctl95
[    2.203811] PM: Adding info for No Bus:digi_ctl96
[    2.204344] PM: Adding info for No Bus:digi_ctl97
[    2.204813] PM: Adding info for No Bus:digi_ctl98
[    2.205350] PM: Adding info for No Bus:digi_ctl99
[    2.205823] PM: Adding info for No Bus:digi_ctl100
[    2.206342] PM: Adding info for No Bus:digi_ctl101
[    2.206808] PM: Adding info for No Bus:digi_ctl102
[    2.207344] PM: Adding info for No Bus:digi_ctl103
[    2.207818] PM: Adding info for No Bus:digi_ctl104
[    2.208343] PM: Adding info for No Bus:digi_ctl105
[    2.208812] PM: Adding info for No Bus:digi_ctl106
[    2.209348] PM: Adding info for No Bus:digi_ctl107
[    2.209816] PM: Adding info for No Bus:digi_ctl108
[    2.210362] PM: Adding info for No Bus:digi_ctl109
[    2.210833] PM: Adding info for No Bus:digi_ctl110
[    2.211350] PM: Adding info for No Bus:digi_ctl111
[    2.211820] PM: Adding info for No Bus:digi_ctl112
[    2.212346] PM: Adding info for No Bus:digi_ctl113
[    2.212812] PM: Adding info for No Bus:digi_ctl114
[    2.213348] PM: Adding info for No Bus:digi_ctl115
[    2.213823] PM: Adding info for No Bus:digi_ctl116
[    2.214347] PM: Adding info for No Bus:digi_ctl117
[    2.214815] PM: Adding info for No Bus:digi_ctl118
[    2.215352] PM: Adding info for No Bus:digi_ctl119
[    2.215822] PM: Adding info for No Bus:digi_ctl120
[    2.216350] PM: Adding info for No Bus:digi_ctl121
[    2.216820] PM: Adding info for No Bus:digi_ctl122
[    2.217348] PM: Adding info for No Bus:digi_ctl123
[    2.217817] PM: Adding info for No Bus:digi_ctl124
[    2.218349] PM: Adding info for No Bus:digi_ctl125
[    2.218818] PM: Adding info for No Bus:digi_ctl126
[    2.219353] PM: Adding info for No Bus:digi_ctl127
[    2.219830] PM: Adding info for No Bus:digi_ctl128
[    2.220346] PM: Adding info for No Bus:digi_ctl129
[    2.220816] PM: Adding info for No Bus:digi_ctl130
[    2.221348] PM: Adding info for No Bus:digi_ctl131
[    2.221820] PM: Adding info for No Bus:digi_ctl132
[    2.222352] PM: Adding info for No Bus:digi_ctl133
[    2.222822] PM: Adding info for No Bus:digi_ctl134
[    2.223348] PM: Adding info for No Bus:digi_ctl135
[    2.223816] PM: Adding info for No Bus:digi_ctl136
[    2.224351] PM: Adding info for No Bus:digi_ctl137
[    2.224821] PM: Adding info for No Bus:digi_ctl138
[    2.225355] PM: Adding info for No Bus:digi_ctl139
[    2.225835] PM: Adding info for No Bus:digi_ctl140
[    2.226352] PM: Adding info for No Bus:digi_ctl141
[    2.226819] PM: Adding info for No Bus:digi_ctl142
[    2.227351] PM: Adding info for No Bus:digi_ctl143
[    2.227831] PM: Adding info for No Bus:digi_ctl144
[    2.228355] PM: Adding info for No Bus:digi_ctl145
[    2.228824] PM: Adding info for No Bus:digi_ctl146
[    2.229355] PM: Adding info for No Bus:digi_ctl147
[    2.229825] PM: Adding info for No Bus:digi_ctl148
[    2.230351] PM: Adding info for No Bus:digi_ctl149
[    2.230829] PM: Adding info for No Bus:digi_ctl150
[    2.231349] PM: Adding info for No Bus:digi_ctl151
[    2.231817] PM: Adding info for No Bus:digi_ctl152
[    2.232355] PM: Adding info for No Bus:digi_ctl153
[    2.232946] PM: Adding info for No Bus:digi_ctl154
[    2.233466] PM: Adding info for No Bus:digi_ctl155
[    2.233949] PM: Adding info for No Bus:digi_ctl156
[    2.234448] PM: Adding info for No Bus:digi_ctl157
[    2.234926] PM: Adding info for No Bus:digi_ctl158
[    2.235432] PM: Adding info for No Bus:digi_ctl159
[    2.235901] PM: Adding info for No Bus:digi_ctl160
[    2.236406] PM: Adding info for No Bus:digi_ctl161
[    2.236882] PM: Adding info for No Bus:digi_ctl162
[    2.237380] PM: Adding info for No Bus:digi_ctl163
[    2.237857] PM: Adding info for No Bus:digi_ctl164
[    2.238362] PM: Adding info for No Bus:digi_ctl165
[    2.238828] PM: Adding info for No Bus:digi_ctl166
[    2.239356] PM: Adding info for No Bus:digi_ctl167
[    2.239830] PM: Adding info for No Bus:digi_ctl168
[    2.240357] PM: Adding info for No Bus:digi_ctl169
[    2.240832] PM: Adding info for No Bus:digi_ctl170
[    2.241352] PM: Adding info for No Bus:digi_ctl171
[    2.241825] PM: Adding info for No Bus:digi_ctl172
[    2.242352] PM: Adding info for No Bus:digi_ctl173
[    2.242826] PM: Adding info for No Bus:digi_ctl174
[    2.243357] PM: Adding info for No Bus:digi_ctl175
[    2.243836] PM: Adding info for No Bus:digi_ctl176
[    2.244366] PM: Adding info for No Bus:digi_ctl177
[    2.244847] PM: Adding info for No Bus:digi_ctl178
[    2.245359] PM: Adding info for No Bus:digi_ctl179
[    2.245836] PM: Adding info for No Bus:digi_ctl180
[    2.246356] PM: Adding info for No Bus:digi_ctl181
[    2.246827] PM: Adding info for No Bus:digi_ctl182
[    2.247353] PM: Adding info for No Bus:digi_ctl183
[    2.247823] PM: Adding info for No Bus:digi_ctl184
[    2.248352] PM: Adding info for No Bus:digi_ctl185
[    2.248827] PM: Adding info for No Bus:digi_ctl186
[    2.249357] PM: Adding info for No Bus:digi_ctl187
[    2.249831] PM: Adding info for No Bus:digi_ctl188
[    2.250359] PM: Adding info for No Bus:digi_ctl189
[    2.250829] PM: Adding info for No Bus:digi_ctl190
[    2.251356] PM: Adding info for No Bus:digi_ctl191
[    2.251834] PM: Adding info for No Bus:digi_ctl192
[    2.252355] PM: Adding info for No Bus:digi_ctl193
[    2.252826] PM: Adding info for No Bus:digi_ctl194
[    2.253360] PM: Adding info for No Bus:digi_ctl195
[    2.253832] PM: Adding info for No Bus:digi_ctl196
[    2.254358] PM: Adding info for No Bus:digi_ctl197
[    2.254835] PM: Adding info for No Bus:digi_ctl198
[    2.255357] PM: Adding info for No Bus:digi_ctl199
[    2.255836] PM: Adding info for No Bus:digi_ctl200
[    2.256364] PM: Adding info for No Bus:digi_ctl201
[    2.256835] PM: Adding info for No Bus:digi_ctl202
[    2.257352] PM: Adding info for No Bus:digi_ctl203
[    2.258612] PM: Adding info for No Bus:digi_ctl204
[    2.259087] PM: Adding info for No Bus:digi_ctl205
[    2.259585] PM: Adding info for No Bus:digi_ctl206
[    2.260072] PM: Adding info for No Bus:digi_ctl207
[    2.260563] PM: Adding info for No Bus:digi_ctl208
[    2.261044] PM: Adding info for No Bus:digi_ctl209
[    2.261538] PM: Adding info for No Bus:digi_ctl210
[    2.262014] PM: Adding info for No Bus:digi_ctl211
[    2.262494] PM: Adding info for No Bus:digi_ctl212
[    2.262989] PM: Adding info for No Bus:digi_ctl213
[    2.263470] PM: Adding info for No Bus:digi_ctl214
[    2.263944] PM: Adding info for No Bus:digi_ctl215
[    2.264446] PM: Adding info for No Bus:digi_ctl216
[    2.264917] PM: Adding info for No Bus:digi_ctl217
[    2.265419] PM: Adding info for No Bus:digi_ctl218
[    2.265904] PM: Adding info for No Bus:digi_ctl219
[    2.266406] PM: Adding info for No Bus:digi_ctl220
[    2.266879] PM: Adding info for No Bus:digi_ctl221
[    2.267383] PM: Adding info for No Bus:digi_ctl222
[    2.267858] PM: Adding info for No Bus:digi_ctl223
[    2.268362] PM: Adding info for No Bus:digi_ctl224
[    2.268845] PM: Adding info for No Bus:digi_ctl225
[    2.269357] PM: Adding info for No Bus:digi_ctl226
[    2.269840] PM: Adding info for No Bus:digi_ctl227
[    2.270359] PM: Adding info for No Bus:digi_ctl228
[    2.270836] PM: Adding info for No Bus:digi_ctl229
[    2.271358] PM: Adding info for No Bus:digi_ctl230
[    2.271850] PM: Adding info for No Bus:digi_ctl231
[    2.272359] PM: Adding info for No Bus:digi_ctl232
[    2.272835] PM: Adding info for No Bus:digi_ctl233
[    2.273361] PM: Adding info for No Bus:digi_ctl234
[    2.273839] PM: Adding info for No Bus:digi_ctl235
[    2.274357] PM: Adding info for No Bus:digi_ctl236
[    2.274834] PM: Adding info for No Bus:digi_ctl237
[    2.275364] PM: Adding info for No Bus:digi_ctl238
[    2.275843] PM: Adding info for No Bus:digi_ctl239
[    2.276366] PM: Adding info for No Bus:digi_ctl240
[    2.276846] PM: Adding info for No Bus:digi_ctl241
[    2.277363] PM: Adding info for No Bus:digi_ctl242
[    2.277848] PM: Adding info for No Bus:digi_ctl243
[    2.278369] PM: Adding info for No Bus:digi_ctl244
[    2.278848] PM: Adding info for No Bus:digi_ctl245
[    2.279360] PM: Adding info for No Bus:digi_ctl246
[    2.279848] PM: Adding info for No Bus:digi_ctl247
[    2.280362] PM: Adding info for No Bus:digi_ctl248
[    2.280842] PM: Adding info for No Bus:digi_ctl249
[    2.281367] PM: Adding info for No Bus:digi_ctl250
[    2.281848] PM: Adding info for No Bus:digi_ctl251
[    2.282361] PM: Adding info for No Bus:digi_ctl252
[    2.282844] PM: Adding info for No Bus:digi_ctl253
[    2.283363] PM: Adding info for No Bus:digi_ctl254
[    2.283844] PM: Adding info for No Bus:digi_ctl255
[    2.284182] initcall epca_module_init+0x0/0x480 returned 0 after 250716 usecs
[    2.284293] calling  riscom8_init_module+0x0/0x420 @ 1
[    2.284384] rc: SDL RISCom/8 card driver v1.1, (c) D.Gorodchanin 1994-1996.
[    2.284674] PM: Adding info for No Bus:ttyL0
[    2.285161] PM: Adding info for No Bus:ttyL1
[    2.285655] PM: Adding info for No Bus:ttyL2
[    2.286146] PM: Adding info for No Bus:ttyL3
[    2.286648] PM: Adding info for No Bus:ttyL4
[    2.287131] PM: Adding info for No Bus:ttyL5
[    2.287630] PM: Adding info for No Bus:ttyL6
[    2.288115] PM: Adding info for No Bus:ttyL7
[    2.288610] PM: Adding info for No Bus:ttyL8
[    2.289112] PM: Adding info for No Bus:ttyL9
[    2.289609] PM: Adding info for No Bus:ttyL10
[    2.290100] PM: Adding info for No Bus:ttyL11
[    2.290594] PM: Adding info for No Bus:ttyL12
[    2.291078] PM: Adding info for No Bus:ttyL13
[    2.291574] PM: Adding info for No Bus:ttyL14
[    2.292067] PM: Adding info for No Bus:ttyL15
[    2.292567] PM: Adding info for No Bus:ttyL16
[    2.293059] PM: Adding info for No Bus:ttyL17
[    2.293563] PM: Adding info for No Bus:ttyL18
[    2.294055] PM: Adding info for No Bus:ttyL19
[    2.294556] PM: Adding info for No Bus:ttyL20
[    2.295042] PM: Adding info for No Bus:ttyL21
[    2.295543] PM: Adding info for No Bus:ttyL22
[    2.296023] PM: Adding info for No Bus:ttyL23
[    2.296520] PM: Adding info for No Bus:ttyL24
[    2.297007] PM: Adding info for No Bus:ttyL25
[    2.297497] PM: Adding info for No Bus:ttyL26
[    2.297987] PM: Adding info for No Bus:ttyL27
[    2.298475] PM: Adding info for No Bus:ttyL28
[    2.298958] PM: Adding info for No Bus:ttyL29
[    2.299471] PM: Adding info for No Bus:ttyL30
[    2.299955] PM: Adding info for No Bus:ttyL31
[    2.300362] rc0: RISCom/8 Board at 0x220 not found.
[    2.300538] rc1: RISCom/8 Board at 0x240 not found.
[    2.300713] rc2: RISCom/8 Board at 0x250 not found.
[    2.300890] rc3: RISCom/8 Board at 0x260 not found.
[    2.301485] PM: Removing info for No Bus:ttyL0
[    2.302231] PM: Removing info for No Bus:ttyL1
[    2.302977] PM: Removing info for No Bus:ttyL2
[    2.303723] PM: Removing info for No Bus:ttyL3
[    2.304522] PM: Removing info for No Bus:ttyL4
[    2.305271] PM: Removing info for No Bus:ttyL5
[    2.305988] PM: Removing info for No Bus:ttyL6
[    2.306734] PM: Removing info for No Bus:ttyL7
[    2.307576] PM: Removing info for No Bus:ttyL8
[    2.308313] PM: Removing info for No Bus:ttyL9
[    2.309031] PM: Removing info for No Bus:ttyL10
[    2.309784] PM: Removing info for No Bus:ttyL11
[    2.310551] PM: Removing info for No Bus:ttyL12
[    2.311297] PM: Removing info for No Bus:ttyL13
[    2.312010] PM: Removing info for No Bus:ttyL14
[    2.312745] PM: Removing info for No Bus:ttyL15
[    2.313545] PM: Removing info for No Bus:ttyL16
[    2.314285] PM: Removing info for No Bus:ttyL17
[    2.315001] PM: Removing info for No Bus:ttyL18
[    2.315737] PM: Removing info for No Bus:ttyL19
[    2.316542] PM: Removing info for No Bus:ttyL20
[    2.317285] PM: Removing info for No Bus:ttyL21
[    2.317998] PM: Removing info for No Bus:ttyL22
[    2.318735] PM: Removing info for No Bus:ttyL23
[    2.319549] PM: Removing info for No Bus:ttyL24
[    2.320293] PM: Removing info for No Bus:ttyL25
[    2.321007] PM: Removing info for No Bus:ttyL26
[    2.321757] PM: Removing info for No Bus:ttyL27
[    2.322555] PM: Removing info for No Bus:ttyL28
[    2.323300] PM: Removing info for No Bus:ttyL29
[    2.324017] PM: Removing info for No Bus:ttyL30
[    2.324762] PM: Removing info for No Bus:ttyL31
[    2.325203] rc: No RISCom/8 boards detected.
[    2.325322] initcall riscom8_init_module+0x0/0x420 returned -5 after 39973 usecs
[    2.325453] initcall riscom8_init_module+0x0/0x420 returned with error code -5 
[    2.325583] calling  n_hdlc_init+0x0/0xb0 @ 1
[    2.325672] HDLC line discipline maxframe=4096
[    2.325760] N_HDLC line discipline registered.
[    2.325849] initcall n_hdlc_init+0x0/0xb0 returned 0 after 171 usecs
[    2.325942] calling  rio_init+0x0/0x11f0 @ 1
[    2.326180] PM: Adding info for No Bus:rioctl
[    2.329197] PM: Removing info for No Bus:rioctl
[    2.329662] initcall rio_init+0x0/0x11f0 returned -5 after 3533 usecs
[    2.329756] initcall rio_init+0x0/0x11f0 returned with error code -5 
[    2.329849] calling  r3964_init+0x0/0x40 @ 1
[    2.329937] r3964: Philips r3964 Driver $Revision: 1.10 $
[    2.330035] initcall r3964_init+0x0/0x40 returned 0 after 94 usecs
[    2.330127] calling  nvram_init+0x0/0x90 @ 1
[    2.330370] PM: Adding info for No Bus:nvram
[    2.330696] Non-volatile memory driver v1.3
[    2.330789] initcall nvram_init+0x0/0x90 returned 0 after 556 usecs
[    2.330881] calling  scx200_gpio_init+0x0/0x140 @ 1
[    2.330970] scx200_gpio: no SCx200 gpio present
[    2.331070] initcall scx200_gpio_init+0x0/0x140 returned -19 after 96 usecs
[    2.331165] calling  nsc_gpio_init+0x0/0x20 @ 1
[    2.331273] nsc_gpio initializing
[    2.331362] initcall nsc_gpio_init+0x0/0x20 returned 0 after 85 usecs
[    2.331454] calling  cs5535_gpio_init+0x0/0x1d0 @ 1
[    2.331556] cs5535_gpio: DIVIL not found
[    2.331646] initcall cs5535_gpio_init+0x0/0x1d0 returned -19 after 100 usecs
[    2.331740] calling  mwave_init+0x0/0x350 @ 1
[    2.332493] smapi::smapi_query_DSP_cfg: Error: Could not get DSP modem settings. Aborting.
[    2.332624] mwave: tp3780i::tp3780I_CalcResources: Error: Could not query DSP config. Aborting.
[    2.332755] mwave: mwavedd:mwave_init: Error: Failed to calculate resources
[    2.332847] mwave: mwavedd::mwave_init: Error: Failed to initialize
[    2.332941] initcall mwave_init+0x0/0x350 returned -5 after 1084 usecs
[    2.333038] initcall mwave_init+0x0/0x350 returned with error code -5 
[    2.333131] calling  ipmi_init_msghandler_mod+0x0/0x10 @ 1
[    2.333491] ipmi message handler version 39.2
[    2.333604] initcall ipmi_init_msghandler_mod+0x0/0x10 returned 0 after 369 usecs
[    2.333734] calling  init_ipmi_devintf+0x0/0x100 @ 1
[    2.333823] ipmi device interface
[    2.334172] initcall init_ipmi_devintf+0x0/0x100 returned 0 after 338 usecs
[    2.334283] calling  init_ipmi_si+0x0/0x990 @ 1
[    2.334631] IPMI System Interface driver.
[    2.343766] ipmi_si: Unable to find any System Interface(s)
[    2.343861] initcall init_ipmi_si+0x0/0x990 returned -19 after 9264 usecs
[    2.343954] calling  hangcheck_init+0x0/0xe0 @ 1
[    2.344053] Hangcheck: starting hangcheck timer 0.9.0 (tick is 180 seconds, margin is 60 seconds).
[    2.344183] Hangcheck: Using get_cycles().
[    2.344289] initcall hangcheck_init+0x0/0xe0 returned 0 after 228 usecs
[    2.344381] calling  serial8250_init+0x0/0x170 @ 1
[    2.344470] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    2.345519] PM: Adding info for platform:serial8250
[    2.346174] PM: Adding info for No Bus:ttyS0
[    2.346625] async_waiting @ 1
[    2.346714] async_continuing @ 1 after 2 usec
[    2.470050] async_waiting @ 1
[    2.470139] async_continuing @ 1 after 1 usec
[    2.593101] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
[    2.593458] PM: Adding info for No Bus:ttyS1
[    2.594043] PM: Adding info for No Bus:ttyS2
[    2.594639] PM: Adding info for No Bus:ttyS3
[    2.595290] initcall serial8250_init+0x0/0x170 returned 0 after 244937 usecs
[    2.595384] calling  serial8250_pnp_init+0x0/0x10 @ 1
[    2.595952] initcall serial8250_pnp_init+0x0/0x10 returned 0 after 466 usecs
[    2.596053] calling  serial8250_pci_init+0x0/0x20 @ 1
[    2.596464] initcall serial8250_pci_init+0x0/0x20 returned 0 after 309 usecs
[    2.596557] calling  fourport_init+0x0/0x10 @ 1
[    2.596756] PM: Adding info for platform:serial8250.3
[    2.597607] PM: Removing info for No Bus:ttyS0
[    2.598462] PM: Adding info for No Bus:ttyS0
[    2.599175] PM: Removing info for No Bus:ttyS0
[    2.599981] PM: Adding info for No Bus:ttyS0
[    2.600731] PM: Removing info for No Bus:ttyS0
[    2.601563] PM: Adding info for No Bus:ttyS0
[    2.602299] PM: Removing info for No Bus:ttyS0
[    2.603078] PM: Adding info for No Bus:ttyS0
[    2.603790] PM: Removing info for No Bus:ttyS0
[    2.604606] PM: Adding info for No Bus:ttyS0
[    2.605330] PM: Removing info for No Bus:ttyS0
[    2.606112] PM: Adding info for No Bus:ttyS0
[    2.606827] PM: Removing info for No Bus:ttyS0
[    2.607635] PM: Adding info for No Bus:ttyS0
[    2.608357] PM: Removing info for No Bus:ttyS0
[    2.609142] PM: Adding info for No Bus:ttyS0
[    2.609519] initcall fourport_init+0x0/0x10 returned 0 after 12566 usecs
[    2.609613] calling  boca_init+0x0/0x10 @ 1
[    2.609807] PM: Adding info for platform:serial8250.5
[    2.610563] PM: Removing info for No Bus:ttyS0
[    2.611372] PM: Adding info for No Bus:ttyS0
[    2.612074] PM: Removing info for No Bus:ttyS0
[    2.612875] PM: Adding info for No Bus:ttyS0
[    2.613602] PM: Removing info for No Bus:ttyS0
[    2.614465] PM: Adding info for No Bus:ttyS0
[    2.615174] PM: Removing info for No Bus:ttyS0
[    2.615975] PM: Adding info for No Bus:ttyS0
[    2.616704] PM: Removing info for No Bus:ttyS0
[    2.617569] PM: Adding info for No Bus:ttyS0
[    2.618288] PM: Removing info for No Bus:ttyS0
[    2.619074] PM: Adding info for No Bus:ttyS0
[    2.619803] PM: Removing info for No Bus:ttyS0
[    2.620615] PM: Adding info for No Bus:ttyS0
[    2.621340] PM: Removing info for No Bus:ttyS0
[    2.622121] PM: Adding info for No Bus:ttyS0
[    2.622832] PM: Removing info for No Bus:ttyS0
[    2.623636] PM: Adding info for No Bus:ttyS0
[    2.624358] PM: Removing info for No Bus:ttyS0
[    2.625139] PM: Adding info for No Bus:ttyS0
[    2.625852] PM: Removing info for No Bus:ttyS0
[    2.626653] PM: Adding info for No Bus:ttyS0
[    2.627371] PM: Removing info for No Bus:ttyS0
[    2.628157] PM: Adding info for No Bus:ttyS0
[    2.628868] PM: Removing info for No Bus:ttyS0
[    2.629670] PM: Adding info for No Bus:ttyS0
[    2.630488] PM: Removing info for No Bus:ttyS0
[    2.631293] PM: Adding info for No Bus:ttyS0
[    2.631989] PM: Removing info for No Bus:ttyS0
[    2.632827] PM: Adding info for No Bus:ttyS0
[    2.633846] PM: Removing info for No Bus:ttyS0
[    2.634642] PM: Adding info for No Bus:ttyS0
[    2.635000] initcall boca_init+0x0/0x10 returned 0 after 24702 usecs
[    2.635095] calling  hub6_init+0x0/0x10 @ 1
[    2.635320] PM: Adding info for platform:serial8250.7
[    2.635993] PM: Removing info for No Bus:ttyS0
[    2.636821] PM: Adding info for No Bus:ttyS0
[    2.637563] PM: Removing info for No Bus:ttyS0
[    2.638373] PM: Adding info for No Bus:ttyS0
[    2.639073] PM: Removing info for No Bus:ttyS0
[    2.639881] PM: Adding info for No Bus:ttyS0
[    2.640607] PM: Removing info for No Bus:ttyS0
[    2.641418] PM: Adding info for No Bus:ttyS0
[    2.642129] PM: Removing info for No Bus:ttyS0
[    2.642939] PM: Adding info for No Bus:ttyS0
[    2.643648] PM: Removing info for No Bus:ttyS0
[    2.644558] PM: Adding info for No Bus:ttyS0
[    2.645282] PM: Removing info for No Bus:ttyS0
[    2.646073] PM: Adding info for No Bus:ttyS0
[    2.646825] PM: Removing info for No Bus:ttyS0
[    2.647639] PM: Adding info for No Bus:ttyS0
[    2.648370] PM: Removing info for No Bus:ttyS0
[    2.649156] PM: Adding info for No Bus:ttyS0
[    2.649869] PM: Removing info for No Bus:ttyS0
[    2.650677] PM: Adding info for No Bus:ttyS0
[    2.651440] PM: Removing info for No Bus:ttyS0
[    2.652236] PM: Adding info for No Bus:ttyS0
[    2.652945] PM: Removing info for No Bus:ttyS0
[    2.653764] PM: Adding info for No Bus:ttyS0
[    2.654160] initcall hub6_init+0x0/0x10 returned 0 after 18527 usecs
[    2.654298] calling  isa_bus_init+0x0/0x40 @ 1
[    2.654724] PM: Adding info for No Bus:isa
[    2.654816] initcall isa_bus_init+0x0/0x40 returned 0 after 418 usecs
[    2.654910] calling  topology_sysfs_init+0x0/0x50 @ 1
[    2.655107] initcall topology_sysfs_init+0x0/0x50 returned 0 after 101 usecs
[    2.655201] calling  floppy_init+0x0/0xe80 @ 1
[    5.666280] floppy0: no floppy controllers found
[    5.666711] initcall floppy_init+0x0/0xe80 returned -19 after 2940818 usecs
[    5.666804] calling  brd_init+0x0/0x1a0 @ 1
[    5.667600] PM: Adding info for No Bus:ram0
[    5.668179] PM: Adding info for No Bus:1:0
[    5.668738] PM: Adding info for No Bus:ram1
[    5.669350] PM: Adding info for No Bus:1:1
[    5.669865] PM: Adding info for No Bus:ram2
[    5.670452] PM: Adding info for No Bus:1:2
[    5.670954] PM: Adding info for No Bus:ram3
[    5.671669] PM: Adding info for No Bus:1:3
[    5.672204] PM: Adding info for No Bus:ram4
[    5.672812] PM: Adding info for No Bus:1:4
[    5.673328] PM: Adding info for No Bus:ram5
[    5.673906] PM: Adding info for No Bus:1:5
[    5.674445] PM: Adding info for No Bus:ram6
[    5.675015] PM: Adding info for No Bus:1:6
[    5.675524] PM: Adding info for No Bus:ram7
[    5.676103] PM: Adding info for No Bus:1:7
[    5.676630] PM: Adding info for No Bus:ram8
[    5.677207] PM: Adding info for No Bus:1:8
[    5.677724] PM: Adding info for No Bus:ram9
[    5.678389] PM: Adding info for No Bus:1:9
[    5.678898] PM: Adding info for No Bus:ram10
[    5.679495] PM: Adding info for No Bus:1:10
[    5.680006] PM: Adding info for No Bus:ram11
[    5.680599] PM: Adding info for No Bus:1:11
[    5.681116] PM: Adding info for No Bus:ram12
[    5.681731] PM: Adding info for No Bus:1:12
[    5.682283] PM: Adding info for No Bus:ram13
[    5.682877] PM: Adding info for No Bus:1:13
[    5.683404] PM: Adding info for No Bus:ram14
[    5.683983] PM: Adding info for No Bus:1:14
[    5.684498] PM: Adding info for No Bus:ram15
[    5.685085] PM: Adding info for No Bus:1:15
[    5.685480] brd: module loaded
[    5.685571] initcall brd_init+0x0/0x1a0 returned 0 after 18235 usecs
[    5.685663] calling  loop_init+0x0/0x1b0 @ 1
[    5.686216] PM: Adding info for No Bus:loop0
[    5.686813] PM: Adding info for No Bus:7:0
[    5.687343] PM: Adding info for No Bus:loop1
[    5.687918] PM: Adding info for No Bus:7:1
[    5.688455] PM: Adding info for No Bus:loop2
[    5.689024] PM: Adding info for No Bus:7:2
[    5.689553] PM: Adding info for No Bus:loop3
[    5.690135] PM: Adding info for No Bus:7:3
[    5.690657] PM: Adding info for No Bus:loop4
[    5.691235] PM: Adding info for No Bus:7:4
[    5.691761] PM: Adding info for No Bus:loop5
[    5.692364] PM: Adding info for No Bus:7:5
[    5.692878] PM: Adding info for No Bus:loop6
[    5.693475] PM: Adding info for No Bus:7:6
[    5.693976] PM: Adding info for No Bus:loop7
[    5.694618] PM: Adding info for No Bus:7:7
[    5.694968] loop: module loaded
[    5.695068] initcall loop_init+0x0/0x1b0 returned 0 after 9095 usecs
[    5.695163] calling  cpqarray_init+0x0/0x2c0 @ 1
[    5.695268] Compaq SMART2 Driver (v 2.6.0)
[    5.695891] initcall cpqarray_init+0x0/0x2c0 returned -19 after 606 usecs
[    5.695985] calling  mm_init+0x0/0x1a0 @ 1
[    5.696441] MM: desc_per_page = 128
[    5.696531] initcall mm_init+0x0/0x1a0 returned 0 after 441 usecs
[    5.696623] calling  nbd_init+0x0/0x330 @ 1
[    5.698013] nbd: registered device at major 43
[    5.698277] PM: Adding info for No Bus:nbd0
[    5.698891] PM: Adding info for No Bus:43:0
[    5.699425] PM: Adding info for No Bus:nbd1
[    5.700018] PM: Adding info for No Bus:43:1
[    5.700556] PM: Adding info for No Bus:nbd2
[    5.701169] PM: Adding info for No Bus:43:2
[    5.701703] PM: Adding info for No Bus:nbd3
[    5.702509] PM: Adding info for No Bus:43:3
[    5.703037] PM: Adding info for No Bus:nbd4
[    5.703651] PM: Adding info for No Bus:43:4
[    5.704174] PM: Adding info for No Bus:nbd5
[    5.704791] PM: Adding info for No Bus:43:5
[    5.705348] PM: Adding info for No Bus:nbd6
[    5.705945] PM: Adding info for No Bus:43:6
[    5.707332] PM: Adding info for No Bus:nbd7
[    5.707936] PM: Adding info for No Bus:43:7
[    5.708469] PM: Adding info for No Bus:nbd8
[    5.709077] PM: Adding info for No Bus:43:8
[    5.709600] PM: Adding info for No Bus:nbd9
[    5.710207] PM: Adding info for No Bus:43:9
[    5.710757] PM: Adding info for No Bus:nbd10
[    5.711374] PM: Adding info for No Bus:43:10
[    5.711893] PM: Adding info for No Bus:nbd11
[    5.712522] PM: Adding info for No Bus:43:11
[    5.713039] PM: Adding info for No Bus:nbd12
[    5.713654] PM: Adding info for No Bus:43:12
[    5.714178] PM: Adding info for No Bus:nbd13
[    5.714803] PM: Adding info for No Bus:43:13
[    5.715381] PM: Adding info for No Bus:nbd14
[    5.715979] PM: Adding info for No Bus:43:14
[    5.716494] PM: Adding info for No Bus:nbd15
[    5.717104] PM: Adding info for No Bus:43:15
[    5.717466] initcall nbd_init+0x0/0x330 returned 0 after 20264 usecs
[    5.717560] calling  lkdtm_module_init+0x0/0x210 @ 1
[    5.717649] lkdtm : Invalid command
[    5.717737] initcall lkdtm_module_init+0x0/0x210 returned -22 after 84 usecs
[    5.717831] initcall lkdtm_module_init+0x0/0x210 returned with error code -22 
[    5.717960] calling  sm501_base_init+0x0/0x20 @ 1
[    5.718614] initcall sm501_base_init+0x0/0x20 returned 0 after 538 usecs
[    5.718707] calling  pasic3_base_init+0x0/0x20 @ 1
[    5.719401] initcall pasic3_base_init+0x0/0x20 returned -19 after 586 usecs
[    5.719495] calling  mac_hid_init+0x0/0xd0 @ 1
[    5.719810] PM: Adding info for No Bus:input0
[    5.720142] input: Macintosh mouse button emulation as /class/input/input0
[    5.720303] initcall mac_hid_init+0x0/0xd0 returned 0 after 699 usecs
[    5.720395] calling  raid_init+0x0/0x10 @ 1
[    5.720724] initcall raid_init+0x0/0x10 returned 0 after 232 usecs
[    5.720816] calling  spi_transport_init+0x0/0x90 @ 1
[    5.721422] initcall spi_transport_init+0x0/0x90 returned 0 after 500 usecs
[    5.721515] calling  iscsi_transport_init+0x0/0x140 @ 1
[    5.721606] Loading iSCSI transport class v2.0-870.
[    5.723000] initcall iscsi_transport_init+0x0/0x140 returned 0 after 1359 usecs
[    5.723134] calling  ahc_linux_init+0x0/0x70 @ 1
[    5.723850] initcall ahc_linux_init+0x0/0x70 returned 0 after 608 usecs
[    5.723943] calling  init_sd+0x0/0xe0 @ 1
[    5.724630] initcall init_sd+0x0/0xe0 returned 0 after 575 usecs
[    5.724722] calling  init_sr+0x0/0x50 @ 1
[    5.725176] initcall init_sr+0x0/0x50 returned 0 after 355 usecs
[    5.725287] calling  init_sg+0x0/0xc0 @ 1
[    5.725630] initcall init_sg+0x0/0xc0 returned 0 after 247 usecs
[    5.725723] calling  ahci_init+0x0/0x20 @ 1
[    5.725967] ahci 0000:00:1f.2: version 3.0
[    5.726187] ahci 0000:00:1f.2: PCI INT B -> GSI 16 (level, low) -> IRQ 16
[    5.726424] ahci 0000:00:1f.2: irq 28 for MSI/MSI-X
[    5.726644] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 4 ports 1.5 Gbps 0x1 impl SATA mode
[    5.726775] ahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part 
[    5.726872] ahci 0000:00:1f.2: setting latency timer to 64
[    5.727310] scsi0 : ahci
[    5.727561] PM: Adding info for No Bus:host0
[    5.727917] PM: Adding info for No Bus:host0
[    5.728506] scsi1 : ahci
[    5.728677] PM: Adding info for No Bus:host1
[    5.729052] PM: Adding info for No Bus:host1
[    5.729557] scsi2 : ahci
[    5.729724] PM: Adding info for No Bus:host2
[    5.730186] PM: Adding info for No Bus:host2
[    5.730642] scsi3 : ahci
[    5.730810] PM: Adding info for No Bus:host3
[    5.731209] PM: Adding info for No Bus:host3
[    5.731578] ata1: SATA max UDMA/133 abar m1024@0xee444400 port 0xee444500 irq 28
[    5.731707] ata2: DUMMY
[    5.731791] ata3: DUMMY
[    5.731875] ata4: DUMMY
[    6.291278] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    6.292579] ata1.00: ATA-7: HTS541080G9SA00, MB4IC60H, max UDMA/100
[    6.292671] ata1.00: 156301488 sectors, multi 16: LBA48 
[    6.294242] ata1.00: configured for UDMA/100
[    6.305024] async_waiting @ 1854
[    6.305112] async_continuing @ 1854 after 1 usec
[    6.305667] scsi 0:0:0:0: Direct-Access     ATA      HTS541080G9SA00  MB4I PQ: 0 ANSI: 5
[    6.305885] PM: Adding info for No Bus:target0:0:0
[    6.306349] PM: Adding info for scsi:0:0:0:0
[    6.307272] PM: Adding info for No Bus:0:0:0:0
[    6.307969] sd 0:0:0:0: [sda] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
[    6.308891] sd 0:0:0:0: [sda] Write Protect is off
[    6.308980] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    6.309482] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.310066] PM: Adding info for No Bus:sda
[    6.311900]  sda: sda1 sda2
[    6.691374] PM: Adding info for No Bus:sda1
[    6.691839] PM: Adding info for No Bus:sda2
[    6.693460] PM: Adding info for No Bus:8:0
[    6.695453] sd 0:0:0:0: [sda] Attached SCSI disk
[    6.695712] PM: Adding info for No Bus:0:0:0:0
[    6.696703] PM: Adding info for No Bus:sg0
[    6.697128] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    6.697297] async_waiting @ 1854
[    6.697389] async_continuing @ 1854 after 1 usec
[    6.697498] async_waiting @ 1854
[    6.697586] async_continuing @ 1854 after 1 usec
[    6.697704] async_waiting @ 1854
[    6.697793] async_continuing @ 1854 after 1 usec
[    6.697890] work_for_cpu used greatest stack depth: 924 bytes left
[    6.698219] initcall ahci_init+0x0/0x20 returned 0 after 949611 usecs
[    6.698337] calling  piix_init+0x0/0x30 @ 1
[    6.698573] ata_piix 0000:00:1f.1: version 2.13
[    6.698682] ata_piix 0000:00:1f.1: PCI INT C -> GSI 16 (level, low) -> IRQ 16
[    6.698923] ata_piix 0000:00:1f.1: setting latency timer to 64
[    6.699281] scsi4 : ata_piix
[    6.699453] PM: Adding info for No Bus:host4
[    6.699796] PM: Adding info for No Bus:host4
[    6.700239] scsi5 : ata_piix
[    6.700403] PM: Adding info for No Bus:host5
[    6.700741] PM: Adding info for No Bus:host5
[    6.701088] ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x1810 irq 14
[    6.701181] ata6: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x1818 irq 15
[    6.855651] ata5.00: ATAPI: HL-DT-STCD-RW/DVD DRIVE GCC-4246N, 0X05, max UDMA/33
[    6.861557] ata5.00: configured for UDMA/33
[    6.862570] async_waiting @ 1872
[    6.862659] async_continuing @ 1872 after 1 usec
[    6.867443] scsi 4:0:0:0: CD-ROM            HL-DT-ST RW/DVD GCC-4246N 0X05 PQ: 0 ANSI: 5
[    6.867674] PM: Adding info for No Bus:target4:0:0
[    6.868115] PM: Adding info for scsi:4:0:0:0
[    6.879849] sr0: scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
[    6.879944] Uniform CD-ROM driver Revision: 3.20
[    6.880525] PM: Adding info for No Bus:sr0
[    6.881766] PM: Adding info for No Bus:11:0
[    6.882214] sr 4:0:0:0: Attached scsi CD-ROM sr0
[    6.882480] PM: Adding info for No Bus:4:0:0:0
[    6.883239] PM: Adding info for No Bus:sg1
[    6.883631] sr 4:0:0:0: Attached scsi generic sg1 type 5
[    6.883809] ata6: port disabled. ignoring.
[    6.883905] async_waiting @ 1872
[    6.883994] async_continuing @ 1872 after 1 usec
[    6.884400] initcall piix_init+0x0/0x30 returned 0 after 181612 usecs
[    6.884493] calling  nv_init+0x0/0x20 @ 1
[    6.884938] initcall nv_init+0x0/0x20 returned 0 after 345 usecs
[    6.885037] calling  amd_init+0x0/0x20 @ 1
[    6.885431] initcall amd_init+0x0/0x20 returned 0 after 295 usecs
[    6.885524] calling  atiixp_init+0x0/0x20 @ 1
[    6.885898] initcall atiixp_init+0x0/0x20 returned 0 after 276 usecs
[    6.885992] calling  cs5530_init+0x0/0x20 @ 1
[    6.886411] initcall cs5530_init+0x0/0x20 returned 0 after 316 usecs
[    6.886505] calling  efar_init+0x0/0x20 @ 1
[    6.886870] initcall efar_init+0x0/0x20 returned 0 after 269 usecs
[    6.886963] calling  hpt3x3_init+0x0/0x20 @ 1
[    6.887416] initcall hpt3x3_init+0x0/0x20 returned 0 after 342 usecs
[    6.887509] calling  netcell_init+0x0/0x20 @ 1
[    6.887885] initcall netcell_init+0x0/0x20 returned 0 after 277 usecs
[    6.887977] calling  ninja32_init+0x0/0x20 @ 1
[    6.888369] initcall ninja32_init+0x0/0x20 returned 0 after 284 usecs
[    6.888462] calling  ns87410_init+0x0/0x20 @ 1
[    6.888834] initcall ns87410_init+0x0/0x20 returned 0 after 274 usecs
[    6.888926] calling  marvell_init+0x0/0x20 @ 1
[    6.889319] initcall marvell_init+0x0/0x20 returned 0 after 292 usecs
[    6.889411] calling  oldpiix_init+0x0/0x20 @ 1
[    6.889783] initcall oldpiix_init+0x0/0x20 returned 0 after 273 usecs
[    6.889875] calling  pdc202xx_init+0x0/0x20 @ 1
[    6.890302] initcall pdc202xx_init+0x0/0x20 returned 0 after 325 usecs
[    6.890395] calling  qdi_init+0x0/0x270 @ 1
[    6.890487] initcall qdi_init+0x0/0x270 returned -19 after 1 usecs
[    6.890579] calling  via_init+0x0/0x20 @ 1
[    6.890943] initcall via_init+0x0/0x20 returned 0 after 267 usecs
[    6.891042] calling  sch_init+0x0/0x20 @ 1
[    6.891429] initcall sch_init+0x0/0x20 returned 0 after 286 usecs
[    6.891521] calling  ata_generic_init+0x0/0x20 @ 1
[    6.891897] initcall ata_generic_init+0x0/0x20 returned 0 after 276 usecs
[    6.891991] calling  e1000_init_module+0x0/0x90 @ 1
[    6.892084] Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
[    6.892175] Copyright (c) 1999-2006 Intel Corporation.
[    6.892642] initcall e1000_init_module+0x0/0x90 returned 0 after 541 usecs
[    6.892736] calling  e1000_init_module+0x0/0x70 @ 1
[    6.892827] e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
[    6.892915] e1000e: Copyright (c) 1999-2008 Intel Corporation.
[    6.893198] e1000e 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    6.894168] e1000e 0000:02:00.0: pci_enable_pcie_error_reporting failed 0xfffffffb
[    6.894312] e1000e 0000:02:00.0: setting latency timer to 64
[    6.894660] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    6.936460] e1000e 0000:02:00.0: Warning: detected ASPM enabled in EEPROM
[    6.979519] PM: Adding info for No Bus:eth0
[    6.980330] 0000:02:00.0: eth0: (PCI Express:2.5GB/s:Width x1) 00:16:41:17:49:d2
[    6.980460] 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
[    6.980626] 0000:02:00.0: eth0: MAC: 2, PHY: 2, PBA No: 005301-003
[    6.981054] initcall e1000_init_module+0x0/0x70 returned 0 after 86157 usecs
[    6.981148] calling  ipg_init_module+0x0/0x20 @ 1
[    6.981564] initcall ipg_init_module+0x0/0x20 returned 0 after 314 usecs
[    6.981657] calling  atl1_init_module+0x0/0x20 @ 1
[    6.982031] initcall atl1_init_module+0x0/0x20 returned 0 after 277 usecs
[    6.982124] calling  atl1c_init_module+0x0/0x20 @ 1
[    6.982546] initcall atl1c_init_module+0x0/0x20 returned 0 after 320 usecs
[    6.982640] calling  jme_init_module+0x0/0x30 @ 1
[    6.982729] jme: JMicron JMC2XX ethernet driver version 1.0.4
[    6.983110] initcall jme_init_module+0x0/0x30 returned 0 after 369 usecs
[    6.983204] calling  gem_init+0x0/0x20 @ 1
[    6.983599] initcall gem_init+0x0/0x20 returned 0 after 284 usecs
[    6.983691] calling  vortex_init+0x0/0xe0 @ 1
[    6.984396] initcall vortex_init+0x0/0xe0 returned 0 after 597 usecs
[    6.984488] calling  typhoon_init+0x0/0x20 @ 1
[    6.984868] initcall typhoon_init+0x0/0x20 returned 0 after 280 usecs
[    6.984960] calling  ne2k_pci_init+0x0/0x20 @ 1
[    6.985417] initcall ne2k_pci_init+0x0/0x20 returned 0 after 346 usecs
[    6.985511] calling  e100_init_module+0x0/0x60 @ 1
[    6.985600] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    6.985690] e100: Copyright(c) 1999-2006 Intel Corporation
[    6.986158] initcall e100_init_module+0x0/0x60 returned 0 after 543 usecs
[    6.986269] calling  tlan_probe+0x0/0x360 @ 1
[    6.986358] ThunderLAN driver v1.15a
[    6.986743] TLAN: 0 devices installed, PCI: 0  EISA: 0
[    6.987083] initcall tlan_probe+0x0/0x360 returned -19 after 706 usecs
[    6.987176] calling  smsc9420_init_module+0x0/0x40 @ 1
[    6.987581] initcall smsc9420_init_module+0x0/0x40 returned 0 after 284 usecs
[    6.987675] calling  sis190_init_module+0x0/0x20 @ 1
[    6.988111] initcall sis190_init_module+0x0/0x20 returned 0 after 335 usecs
[    6.988205] calling  sis900_init_module+0x0/0x20 @ 1
[    6.988738] initcall sis900_init_module+0x0/0x20 returned 0 after 342 usecs
[    6.988832] calling  acenic_init+0x0/0x20 @ 1
[    6.989222] initcall acenic_init+0x0/0x20 returned 0 after 292 usecs
[    6.989329] calling  natsemi_init_mod+0x0/0x20 @ 1
[    6.989757] initcall natsemi_init_mod+0x0/0x20 returned 0 after 327 usecs
[    6.989850] calling  ns83820_init+0x0/0x30 @ 1
[    6.989940] ns83820.c: National Semiconductor DP83820 10/100/1000 driver.
[    6.990333] initcall ns83820_init+0x0/0x30 returned 0 after 380 usecs
[    6.990425] calling  fealnx_init+0x0/0x20 @ 1
[    6.990794] initcall fealnx_init+0x0/0x20 returned 0 after 272 usecs
[    6.990886] calling  tg3_init+0x0/0x20 @ 1
[    6.991340] initcall tg3_init+0x0/0x20 returned 0 after 353 usecs
[    6.991433] calling  bnx2_init+0x0/0x20 @ 1
[    6.991801] initcall bnx2_init+0x0/0x20 returned 0 after 271 usecs
[    6.991894] calling  davicom_init+0x0/0x60 @ 1
[    6.992768] initcall davicom_init+0x0/0x60 returned 0 after 764 usecs
[    6.992862] calling  smsc_init+0x0/0x90 @ 1
[    6.994292] initcall smsc_init+0x0/0x90 returned 0 after 1306 usecs
[    6.994385] calling  ip175c_init+0x0/0x10 @ 1
[    6.994725] initcall ip175c_init+0x0/0x10 returned 0 after 242 usecs
[    6.994817] calling  net_olddevs_init+0x0/0x90 @ 1
[    6.995812] initcall net_olddevs_init+0x0/0x90 returned 0 after 881 usecs
[    6.995905] calling  sb1000_init+0x0/0x10 @ 1
[    6.996278] initcall sb1000_init+0x0/0x10 returned 0 after 274 usecs
[    6.996371] calling  NS8390p_init_module+0x0/0x10 @ 1
[    6.996463] initcall NS8390p_init_module+0x0/0x10 returned 0 after 1 usecs
[    6.996556] calling  b44_init+0x0/0x70 @ 1
[    6.997187] initcall b44_init+0x0/0x70 returned 0 after 529 usecs
[    6.997332] calling  init_nic+0x0/0x20 @ 1
[    6.997702] initcall init_nic+0x0/0x20 returned 0 after 273 usecs
[    6.997794] calling  cp_init+0x0/0x20 @ 1
[    6.998167] initcall cp_init+0x0/0x20 returned 0 after 276 usecs
[    6.998276] calling  rtl8139_init_module+0x0/0x20 @ 1
[    6.998651] initcall rtl8139_init_module+0x0/0x20 returned 0 after 277 usecs
[    6.998744] calling  lp486e_init_module+0x0/0x2d0 @ 1
[    6.999492] eth%d: i82596 initialization timed out
[    6.999592] initcall lp486e_init_module+0x0/0x2d0 returned -19 after 738 usecs
[    6.999721] calling  eql_init_module+0x0/0x60 @ 1
[    6.999811] Equalizer2002: Simon Janes (simon@ncm.com) and David S. Miller (davem@redhat.com)
[    7.000347] PM: Adding info for No Bus:eql
[    7.001163] initcall eql_init_module+0x0/0x60 returned 0 after 1317 usecs
[    7.001272] calling  tun_init+0x0/0xa0 @ 1
[    7.001361] tun: Universal TUN/TAP device driver, 1.6
[    7.001449] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    7.001732] PM: Adding info for No Bus:tun
[    7.002121] initcall tun_init+0x0/0xa0 returned 0 after 741 usecs
[    7.002213] calling  rio_init+0x0/0x20 @ 1
[    7.002613] initcall rio_init+0x0/0x20 returned 0 after 282 usecs
[    7.002705] calling  asix_init+0x0/0x20 @ 1
[    7.003069] usbcore: registered new interface driver asix
[    7.003172] initcall asix_init+0x0/0x20 returned 0 after 369 usecs
[    7.003277] calling  cdc_init+0x0/0x20 @ 1
[    7.003622] usbcore: registered new interface driver cdc_ether
[    7.003723] initcall cdc_init+0x0/0x20 returned 0 after 348 usecs
[    7.003815] calling  smsc95xx_init+0x0/0x20 @ 1
[    7.004223] usbcore: registered new interface driver smsc95xx
[    7.004343] initcall smsc95xx_init+0x0/0x20 returned 0 after 426 usecs
[    7.004435] calling  net1080_init+0x0/0x20 @ 1
[    7.004789] usbcore: registered new interface driver net1080
[    7.004889] initcall net1080_init+0x0/0x20 returned 0 after 355 usecs
[    7.004982] calling  plusb_init+0x0/0x20 @ 1
[    7.005395] usbcore: registered new interface driver plusb
[    7.005495] initcall plusb_init+0x0/0x20 returned 0 after 408 usecs
[    7.005587] calling  rndis_init+0x0/0x20 @ 1
[    7.005925] usbcore: registered new interface driver rndis_host
[    7.006031] initcall rndis_init+0x0/0x20 returned 0 after 345 usecs
[    7.006124] calling  usbnet_init+0x0/0x30 @ 1
[    7.006223] initcall usbnet_init+0x0/0x30 returned 0 after 8 usecs
[    7.006330] calling  usbpn_init+0x0/0x20 @ 1
[    7.006673] usbcore: registered new interface driver cdc_phonet
[    7.006775] initcall usbpn_init+0x0/0x20 returned 0 after 346 usecs
[    7.006867] calling  prism54_module_init+0x0/0x40 @ 1
[    7.006958] Loaded prism54 driver, version 1.2
[    7.007340] initcall prism54_module_init+0x0/0x40 returned 0 after 370 usecs
[    7.007433] calling  rndis_wlan_init+0x0/0x20 @ 1
[    7.007855] usbcore: registered new interface driver rndis_wlan
[    7.007957] initcall rndis_wlan_init+0x0/0x20 returned 0 after 422 usecs
[    7.008059] calling  lbs_init_module+0x0/0x50 @ 1
[    7.008173] initcall lbs_init_module+0x0/0x50 returned 0 after 21 usecs
[    7.008304] calling  init_netconsole+0x0/0x200 @ 1
[    7.008401] netconsole: local port 4444
[    7.008487] netconsole: local IP 10.0.1.15
[    7.008574] netconsole: interface eth0
[    7.008660] netconsole: remote port 4444
[    7.008746] netconsole: remote IP 10.0.1.21
[    7.008833] netconsole: remote ethernet address 00:30:48:c6:86:26
[    7.008929] netconsole: device eth0 not up yet, forcing it
[    7.029077] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    7.080380] e1000e 0000:02:00.0: irq 29 for MSI/MSI-X
[    8.628601] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[    8.628731] 0000:02:00.0: eth0: 10/100 speed: disabling TSO
[    9.029819] console [netcon0] enabled
[    9.029932] netconsole: network logging started
[    9.030062] initcall init_netconsole+0x0/0x200 returned 0 after 1974278 usecs
[    9.030184] calling  cdrom_init+0x0/0x10 @ 1
[    9.030309] initcall cdrom_init+0x0/0x10 returned 0 after 1 usecs
[    9.030423] calling  uwb_subsys_init+0x0/0x60 @ 1
[    9.030901] initcall uwb_subsys_init+0x0/0x60 returned 0 after 355 usecs
[    9.031019] calling  hwarc_driver_init+0x0/0x20 @ 1
[    9.031417] usbcore: registered new interface driver hwa-rc
[    9.031545] initcall hwarc_driver_init+0x0/0x20 returned 0 after 396 usecs
[    9.031660] calling  i1480_dfu_driver_init+0x0/0x20 @ 1
[    9.032080] usbcore: registered new interface driver i1480-dfu-usb
[    9.032207] initcall i1480_dfu_driver_init+0x0/0x20 returned 0 after 422 usecs
[    9.032377] calling  i1480_est_init+0x0/0xb0 @ 1
[    9.032500] initcall i1480_est_init+0x0/0xb0 returned 0 after 10 usecs
[    9.032614] calling  ehci_hcd_init+0x0/0x110 @ 1
[    9.032728] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    9.032841] ehci_hcd: block sizes: qh 128 qtd 96 itd 160 sitd 96
[    9.034239] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[    9.034388] IOAPIC[0]: Set routing entry (1-19 -> 0xb1 -> IRQ 19 Mode:1 Active:1)
[    9.034553] ehci_hcd 0000:00:1d.7: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[    9.034720] ehci_hcd 0000:00:1d.7: setting latency timer to 64
[    9.034840] ehci_hcd 0000:00:1d.7: EHCI Host Controller
[    9.035176] drivers/usb/core/inode.c: creating file 'devices'
[    9.035321] drivers/usb/core/inode.c: creating file '001'
[    9.035468] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1
[    9.035645] ehci_hcd 0000:00:1d.7: reset hcs_params 0x104208 dbg=1 cc=4 pcc=2 ordered !ppc ports=8
[    9.035812] ehci_hcd 0000:00:1d.7: reset hcc_params 6871 thresh 7 uframes 1024 64 bit addr
[    9.036166] ehci_hcd 0000:00:1d.7: reset command 080022 (park)=0 ithresh=8 Async period=1024 Reset HALT
[    9.040230] ehci_hcd 0000:00:1d.7: debug port 1
[    9.040363] ehci_hcd 0000:00:1d.7: cache line size of 32 is not supported
[    9.040489] ehci_hcd 0000:00:1d.7: supports USB remote wakeup
[    9.040699] ehci_hcd 0000:00:1d.7: irq 19, io mem 0xee444000
[    9.040820] ehci_hcd 0000:00:1d.7: reset command 080002 (park)=0 ithresh=8 period=1024 Reset HALT
[    9.044854] ehci_hcd 0000:00:1d.7: init command 010001 (park)=0 ithresh=1 period=1024 RUN
[    9.051051] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[    9.051453] usb usb1: default language 0x0409
[    9.051705] usb usb1: udev 1, busnum 1, minor = 0
[    9.051824] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    9.051945] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    9.052153] usb usb1: Product: EHCI Host Controller
[    9.052273] usb usb1: Manufacturer: Linux 2.6.31-rc6-tip-01322-gd685ec8-dirty ehci_hcd
[    9.052432] usb usb1: SerialNumber: 0000:00:1d.7
[    9.053108] PM: Adding info for usb:usb1
[    9.053319] usb usb1: uevent
[    9.053733] usb usb1: usb_probe_device
[    9.053857] usb usb1: configuration #1 chosen from 1 choice
[    9.054092] usb usb1: adding 1-0:1.0 (config #1, interface 0)
[    9.054471] PM: Adding info for usb:1-0:1.0
[    9.054625] usb 1-0:1.0: uevent
[    9.055098] hub 1-0:1.0: usb_probe_interface
[    9.055230] hub 1-0:1.0: usb_probe_interface - got id
[    9.055367] hub 1-0:1.0: USB hub found
[    9.055606] hub 1-0:1.0: 8 ports detected
[    9.055742] hub 1-0:1.0: standalone hub
[    9.055876] hub 1-0:1.0: no power switching (usb 1.0)
[    9.056848] hub 1-0:1.0: individual port over-current protection
[    9.056996] hub 1-0:1.0: power on to power good time: 20ms
[    9.057227] hub 1-0:1.0: local power source is good
[    9.057381] hub 1-0:1.0: trying to enable port power on non-switchable hub
[    9.058076] PM: Adding info for No Bus:ep_81
[    9.058436] PM: Adding info for No Bus:usbdev1.1
[    9.058850] drivers/usb/core/inode.c: creating file '001'
[    9.059212] PM: Adding info for No Bus:ep_00
[    9.059707] initcall ehci_hcd_init+0x0/0x110 returned 0 after 26342 usecs
[    9.059825] calling  isp116x_init+0x0/0x50 @ 1
[    9.059937] 116x: driver isp116x-hcd, 03 Nov 2005
[    9.060355] initcall isp116x_init+0x0/0x50 returned 0 after 405 usecs
[    9.060471] calling  ohci_hcd_mod_init+0x0/0x100 @ 1
[    9.060584] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    9.060698] ohci_hcd: block sizes: ed 64 td 64
[    9.061726] initcall ohci_hcd_mod_init+0x0/0x100 returned 0 after 1112 usecs
[    9.061843] calling  uhci_hcd_init+0x0/0x160 @ 1
[    9.061954] uhci_hcd: USB Universal Host Controller Interface driver
[    9.063314] uhci_hcd 0000:00:1d.0: power state changed by ACPI to D0
[    9.063447] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    9.063587] uhci_hcd 0000:00:1d.0: setting latency timer to 64
[    9.063707] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[    9.063865] drivers/usb/core/inode.c: creating file '002'
[    9.064145] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2
[    9.064322] uhci_hcd 0000:00:1d.0: detected 2 ports
[    9.064442] uhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: cmd = 0x0000
[    9.064565] uhci_hcd 0000:00:1d.0: Performing full reset
[    9.064698] uhci_hcd 0000:00:1d.0: supports USB remote wakeup
[    9.064918] uhci_hcd 0000:00:1d.0: irq 16, io base 0x00001820
[    9.065402] usb usb2: default language 0x0409
[    9.065663] usb usb2: udev 1, busnum 2, minor = 128
[    9.065782] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    9.065903] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    9.066104] usb usb2: Product: UHCI Host Controller
[    9.066223] usb usb2: Manufacturer: Linux 2.6.31-rc6-tip-01322-gd685ec8-dirty uhci_hcd
[    9.066386] usb usb2: SerialNumber: 0000:00:1d.0
[    9.066941] PM: Adding info for usb:usb2
[    9.067204] usb usb2: uevent
[    9.067593] usb usb2: usb_probe_device
[    9.067715] usb usb2: configuration #1 chosen from 1 choice
[    9.067907] usb usb2: adding 2-0:1.0 (config #1, interface 0)
[    9.068338] PM: Adding info for usb:2-0:1.0
[    9.068491] usb 2-0:1.0: uevent
[    9.068913] hub 2-0:1.0: usb_probe_interface
[    9.069087] hub 2-0:1.0: usb_probe_interface - got id
[    9.069221] hub 2-0:1.0: USB hub found
[    9.069461] hub 2-0:1.0: 2 ports detected
[    9.069597] hub 2-0:1.0: standalone hub
[    9.069732] hub 2-0:1.0: no power switching (usb 1.0)
[    9.069868] hub 2-0:1.0: individual port over-current protection
[    9.070123] hub 2-0:1.0: power on to power good time: 2ms
[    9.070364] hub 2-0:1.0: local power source is good
[    9.070513] hub 2-0:1.0: trying to enable port power on non-switchable hub
[    9.070940] PM: Adding info for No Bus:ep_81
[    9.071350] PM: Adding info for No Bus:usbdev2.1
[    9.071761] drivers/usb/core/inode.c: creating file '001'
[    9.072108] PM: Adding info for No Bus:ep_00
[    9.072397] IOAPIC[0]: Set routing entry (1-17 -> 0xb9 -> IRQ 17 Mode:1 Active:1)
[    9.072563] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[    9.072699] uhci_hcd 0000:00:1d.1: setting latency timer to 64
[    9.072817] uhci_hcd 0000:00:1d.1: UHCI Host Controller
[    9.073044] drivers/usb/core/inode.c: creating file '003'
[    9.073187] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3
[    9.073368] uhci_hcd 0000:00:1d.1: detected 2 ports
[    9.073488] uhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: cmd = 0x0000
[    9.073610] uhci_hcd 0000:00:1d.1: Performing full reset
[    9.073744] uhci_hcd 0000:00:1d.1: supports USB remote wakeup
[    9.073959] uhci_hcd 0000:00:1d.1: irq 17, io base 0x00001840
[    9.074395] usb usb3: default language 0x0409
[    9.074648] usb usb3: udev 1, busnum 3, minor = 256
[    9.074766] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001
[    9.074887] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    9.075090] usb usb3: Product: UHCI Host Controller
[    9.075209] usb usb3: Manufacturer: Linux 2.6.31-rc6-tip-01322-gd685ec8-dirty uhci_hcd
[    9.075374] usb usb3: SerialNumber: 0000:00:1d.1
[    9.075882] PM: Adding info for usb:usb3
[    9.076134] usb usb3: uevent
[    9.076513] usb usb3: usb_probe_device
[    9.076635] usb usb3: configuration #1 chosen from 1 choice
[    9.076826] usb usb3: adding 3-0:1.0 (config #1, interface 0)
[    9.077277] PM: Adding info for usb:3-0:1.0
[    9.077431] usb 3-0:1.0: uevent
[    9.077849] hub 3-0:1.0: usb_probe_interface
[    9.078023] hub 3-0:1.0: usb_probe_interface - got id
[    9.078157] hub 3-0:1.0: USB hub found
[    9.078393] hub 3-0:1.0: 2 ports detected
[    9.078528] hub 3-0:1.0: standalone hub
[    9.078661] hub 3-0:1.0: no power switching (usb 1.0)
[    9.078795] hub 3-0:1.0: individual port over-current protection
[    9.078932] hub 3-0:1.0: power on to power good time: 2ms
[    9.079228] hub 3-0:1.0: local power source is good
[    9.079380] hub 3-0:1.0: trying to enable port power on non-switchable hub
[    9.079801] PM: Adding info for No Bus:ep_81
[    9.080196] PM: Adding info for No Bus:usbdev3.1
[    9.080620] drivers/usb/core/inode.c: creating file '001'
[    9.080943] PM: Adding info for No Bus:ep_00
[    9.082323] uhci_hcd 0000:00:1d.2: power state changed by ACPI to D0
[    9.082460] IOAPIC[0]: Set routing entry (1-18 -> 0xc1 -> IRQ 18 Mode:1 Active:1)
[    9.082625] uhci_hcd 0000:00:1d.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[    9.082762] uhci_hcd 0000:00:1d.2: setting latency timer to 64
[    9.082880] uhci_hcd 0000:00:1d.2: UHCI Host Controller
[    9.083099] drivers/usb/core/inode.c: creating file '004'
[    9.083242] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4
[    9.083421] uhci_hcd 0000:00:1d.2: detected 2 ports
[    9.083542] uhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: cmd = 0x0000
[    9.083664] uhci_hcd 0000:00:1d.2: Performing full reset
[    9.083800] uhci_hcd 0000:00:1d.2: supports USB remote wakeup
[    9.084065] uhci_hcd 0000:00:1d.2: irq 18, io base 0x00001860
[    9.084445] usb usb4: default language 0x0409
[    9.084703] usb usb4: udev 1, busnum 4, minor = 384
[    9.084822] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
[    9.084948] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    9.085156] usb usb4: Product: UHCI Host Controller
[    9.085276] usb usb4: Manufacturer: Linux 2.6.31-rc6-tip-01322-gd685ec8-dirty uhci_hcd
[    9.085435] usb usb4: SerialNumber: 0000:00:1d.2
[    9.085983] PM: Adding info for usb:usb4
[    9.086204] usb usb4: uevent
[    9.086599] usb usb4: usb_probe_device
[    9.086722] usb usb4: configuration #1 chosen from 1 choice
[    9.086909] usb usb4: adding 4-0:1.0 (config #1, interface 0)
[    9.087367] PM: Adding info for usb:4-0:1.0
[    9.087522] usb 4-0:1.0: uevent
[    9.087935] hub 4-0:1.0: usb_probe_interface
[    9.088108] hub 4-0:1.0: usb_probe_interface - got id
[    9.088242] hub 4-0:1.0: USB hub found
[    9.088476] hub 4-0:1.0: 2 ports detected
[    9.088611] hub 4-0:1.0: standalone hub
[    9.088744] hub 4-0:1.0: no power switching (usb 1.0)
[    9.088879] hub 4-0:1.0: individual port over-current protection
[    9.089101] hub 4-0:1.0: power on to power good time: 2ms
[    9.089335] hub 4-0:1.0: local power source is good
[    9.089483] hub 4-0:1.0: trying to enable port power on non-switchable hub
[    9.089906] PM: Adding info for No Bus:ep_81
[    9.090316] PM: Adding info for No Bus:usbdev4.1
[    9.090726] drivers/usb/core/inode.c: creating file '001'
[    9.091076] PM: Adding info for No Bus:ep_00
[    9.091355] uhci_hcd 0000:00:1d.3: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[    9.091493] uhci_hcd 0000:00:1d.3: setting latency timer to 64
[    9.091612] uhci_hcd 0000:00:1d.3: UHCI Host Controller
[    9.091767] drivers/usb/core/inode.c: creating file '005'
[    9.091908] uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 5
[    9.092138] uhci_hcd 0000:00:1d.3: detected 2 ports
[    9.092262] uhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: cmd = 0x0000
[    9.092385] uhci_hcd 0000:00:1d.3: Performing full reset
[    9.092549] uhci_hcd 0000:00:1d.3: irq 19, io base 0x00001880
[    9.092923] usb usb5: default language 0x0409
[    9.093236] usb usb5: udev 1, busnum 5, minor = 512
[    9.093355] usb usb5: New USB device found, idVendor=1d6b, idProduct=0001
[    9.093475] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    9.093632] usb usb5: Product: UHCI Host Controller
[    9.093749] usb usb5: Manufacturer: Linux 2.6.31-rc6-tip-01322-gd685ec8-dirty uhci_hcd
[    9.093908] usb usb5: SerialNumber: 0000:00:1d.3
[    9.094466] PM: Adding info for usb:usb5
[    9.094674] usb usb5: uevent
[    9.095087] usb usb5: usb_probe_device
[    9.095210] usb usb5: configuration #1 chosen from 1 choice
[    9.095404] usb usb5: adding 5-0:1.0 (config #1, interface 0)
[    9.095788] PM: Adding info for usb:5-0:1.0
[    9.095940] usb 5-0:1.0: uevent
[    9.096413] hub 5-0:1.0: usb_probe_interface
[    9.096545] hub 5-0:1.0: usb_probe_interface - got id
[    9.096684] hub 5-0:1.0: USB hub found
[    9.096915] hub 5-0:1.0: 2 ports detected
[    9.097114] hub 5-0:1.0: standalone hub
[    9.097248] hub 5-0:1.0: no power switching (usb 1.0)
[    9.097388] hub 5-0:1.0: individual port over-current protection
[    9.098336] hub 5-0:1.0: power on to power good time: 2ms
[    9.098553] hub 5-0:1.0: local power source is good
[    9.098701] hub 5-0:1.0: trying to enable port power on non-switchable hub
[    9.099163] PM: Adding info for No Bus:ep_81
[    9.099526] PM: Adding info for No Bus:usbdev5.1
[    9.099935] drivers/usb/core/inode.c: creating file '001'
[    9.100465] PM: Adding info for No Bus:ep_00
[    9.100968] initcall uhci_hcd_init+0x0/0x160 returned 0 after 38094 usecs
[    9.101093] calling  r8a66597_init+0x0/0x50 @ 1
[    9.101204] r8a66597_hcd: driver r8a66597_hcd, 2009-05-26
[    9.101629] initcall r8a66597_init+0x0/0x50 returned 0 after 411 usecs
[    9.101746] calling  hwahc_driver_init+0x0/0x20 @ 1
[    9.102133] usbcore: registered new interface driver hwa-hc
[    9.102337] initcall hwahc_driver_init+0x0/0x20 returned 0 after 465 usecs
[    9.102454] calling  wusbcore_init+0x0/0x80 @ 1
[    9.102647] initcall wusbcore_init+0x0/0x80 returned 0 after 78 usecs
[    9.102762] calling  acm_init+0x0/0xe0 @ 1
[    9.103165] usbcore: registered new interface driver cdc_acm
[    9.103317] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
[    9.103472] initcall acm_init+0x0/0xe0 returned 0 after 583 usecs
[    9.103585] calling  usb_mdc800_init+0x0/0x380 @ 1
[    9.104016] usbcore: registered new interface driver mdc800
[    9.104140] mdc800: v0.7.5 (30/10/2000):USB Driver for Mustek MDC800 Digital Camera
[    9.104335] initcall usb_mdc800_init+0x0/0x380 returned 0 after 621 usecs
[    9.104452] calling  adu_init+0x0/0xa0 @ 1
[    9.104563] drivers/usb/misc/adutux.c :  adu_init : enter 
[    9.105011] usbcore: registered new interface driver adutux
[    9.105135] adutux adutux (see www.ontrak.net) v0.0.13
[    9.105246] adutux is an experimental driver. Use at your own risk
[    9.105379] drivers/usb/misc/adutux.c :  adu_init : leave, return value 0 
[    9.105499] initcall adu_init+0x0/0xa0 returned 0 after 912 usecs
[    9.105612] calling  usb_cytherm_init+0x0/0x50 @ 1
[    9.106084] usbcore: registered new interface driver cytherm
[    9.106207] cytherm: v1.0:Cypress USB Thermometer driver
[    9.106370] initcall usb_cytherm_init+0x0/0x50 returned 0 after 628 usecs
[    9.106486] calling  emi62_init+0x0/0x30 @ 1
[    9.106867] usbcore: registered new interface driver emi62 - firmware loader
[    9.107001] initcall emi62_init+0x0/0x30 returned 0 after 393 usecs
[    9.107118] calling  usb_idmouse_init+0x0/0x50 @ 1
[    9.107230] idmouse: 0.6:Siemens ID Mouse FingerTIP Sensor Driver
[    9.107627] usbcore: registered new interface driver idmouse
[    9.107759] initcall usb_idmouse_init+0x0/0x50 returned 0 after 513 usecs
[    9.107874] calling  lego_usb_tower_init+0x0/0x90 @ 1
[    9.107994] drivers/usb/misc/legousbtower.c: lego_usb_tower_init: enter
[    9.108488] usbcore: registered new interface driver legousbtower
[    9.108612] legousbtower: v0.96:LEGO USB Tower Driver
[    9.108724] drivers/usb/misc/legousbtower.c: lego_usb_tower_init: leave, return value 0
[    9.108880] initcall lego_usb_tower_init+0x0/0x90 returned 0 after 863 usecs
[    9.109003] calling  usbtest_init+0x0/0x40 @ 1
[    9.109462] usbcore: registered new interface driver usbtest
[    9.109589] initcall usbtest_init+0x0/0x40 returned 0 after 458 usecs
[    9.109704] calling  usb_sevseg_init+0x0/0x40 @ 1
[    9.110122] usbcore: registered new interface driver usbsevseg
[    9.110249] initcall usb_sevseg_init+0x0/0x40 returned 0 after 422 usecs
[    9.110395] calling  vstusb_init+0x0/0x40 @ 1
[    9.110768] usbcore: registered new interface driver vstusb
[    9.110894] initcall vstusb_init+0x0/0x40 returned 0 after 376 usecs
[    9.111018] calling  i8042_init+0x0/0x430 @ 1
[    9.111774] PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    9.112360] PM: Adding info for platform:i8042
[    9.122190] serio: i8042 KBD port at 0x60,0x64 irq 1
[    9.122337] serio: i8042 AUX port at 0x60,0x64 irq 12
[    9.122461] PM: Adding info for serio:serio0
[    9.122482] initcall i8042_init+0x0/0x430 returned 0 after 11082 usecs
[    9.122486] calling  serport_init+0x0/0x30 @ 1
[    9.122493] initcall serport_init+0x0/0x30 returned 0 after 2 usecs
[    9.122497] calling  ct82c710_init+0x0/0x1a0 @ 1
[    9.122533] initcall ct82c710_init+0x0/0x1a0 returned -19 after 30 usecs
[    9.122536] calling  serio_raw_init+0x0/0x20 @ 1
[    9.123516] initcall serio_raw_init+0x0/0x20 returned 0 after 951 usecs
[    9.123634] calling  ns558_init+0x0/0x470 @ 1
[    9.124173] PM: Adding info for serio:serio1
[    9.155065] initcall ns558_init+0x0/0x470 returned 0 after 30581 usecs
[    9.155182] calling  mousedev_init+0x0/0x90 @ 1
[    9.155455] PM: Adding info for No Bus:mice
[    9.156148] PM: Adding info for No Bus:mouse0
[    9.156625] PM: Adding info for No Bus:psaux
[    9.156959] mice: PS/2 mouse device common for all mice
[    9.157095] initcall mousedev_init+0x0/0x90 returned 0 after 1754 usecs
[    9.157212] calling  evbug_init+0x0/0x10 @ 1
[    9.157499] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 001803 POWER sig=j CSC CONNECT
[    9.157680] hub 1-0:1.0: port 8: status 0501 change 0001
[    9.157829] evbug.c: Connected device: input0 (Macintosh mouse button emulation at unknown)
[    9.158092] initcall evbug_init+0x0/0x10 returned 0 after 742 usecs
[    9.158208] calling  atkbd_init+0x0/0x20 @ 1
[    9.158620] initcall atkbd_init+0x0/0x20 returned 0 after 283 usecs
[    9.158741] calling  lkkbd_init+0x0/0x20 @ 1
[    9.159168] initcall lkkbd_init+0x0/0x20 returned 0 after 306 usecs
[    9.159295] calling  nkbd_init+0x0/0x20 @ 1
[    9.159692] initcall nkbd_init+0x0/0x20 returned 0 after 277 usecs
[    9.159807] calling  a3d_init+0x0/0x20 @ 1
[    9.160260] initcall a3d_init+0x0/0x20 returned 0 after 292 usecs
[    9.160377] calling  adi_init+0x0/0x20 @ 1
[    9.160762] initcall adi_init+0x0/0x20 returned 0 after 268 usecs
[    9.160879] calling  grip_init+0x0/0x20 @ 1
[    9.161353] initcall grip_init+0x0/0x20 returned 0 after 291 usecs
[    9.161469] calling  iforce_init+0x0/0x50 @ 1
[    9.161867] usbcore: registered new interface driver iforce
[    9.162372] initcall iforce_init+0x0/0x50 returned 0 after 770 usecs
[    9.162488] calling  spaceball_init+0x0/0x20 @ 1
[    9.162889] initcall spaceball_init+0x0/0x20 returned 0 after 273 usecs
[    9.163066] calling  spaceorb_init+0x0/0x20 @ 1
[    9.163560] initcall spaceorb_init+0x0/0x20 returned 0 after 369 usecs
[    9.163678] calling  twidjoy_init+0x0/0x20 @ 1
[    9.163687] PM: Adding info for No Bus:input1
[    9.164342] input: AT Translated Set 2 keyboard as /class/input/input1
[    9.164433] initcall twidjoy_init+0x0/0x20 returned 0 after 519 usecs
[    9.164437] calling  usb_xpad_init+0x0/0x30 @ 1
[    9.164730] evbug.c: Connected device: input1 (AT Translated Set 2 keyboard at isa0060/serio0/input0)
[    9.164783] usbcore: registered new interface driver xpad
[    9.164793] xpad: X-Box pad driver
[    9.164799] initcall usb_xpad_init+0x0/0x30 returned 0 after 348 usecs
[    9.164802] calling  usb_acecad_init+0x0/0x30 @ 1
[    9.165131] usbcore: registered new interface driver usb_acecad
[    9.165143] acecad: v3.2:USB Acecad Flair tablet driver
[    9.165149] initcall usb_acecad_init+0x0/0x30 returned 0 after 331 usecs
[    9.165152] calling  gtco_init+0x0/0x60 @ 1
[    9.165432] usbcore: registered new interface driver gtco
[    9.165443] GTCO usb driver version: 2.00.0006initcall gtco_init+0x0/0x60 returned 0 after 284 usecs
[    9.165451] calling  kbtab_init+0x0/0x30 @ 1
[    9.165725] usbcore: registered new interface driver kbtab
[    9.165735] kbtab: v0.0.2:USB KB Gear JamStudio Tablet driver
[    9.165741] initcall kbtab_init+0x0/0x30 returned 0 after 278 usecs
[    9.165744] calling  tr_init+0x0/0x20 @ 1
[    9.166125] initcall tr_init+0x0/0x20 returned 0 after 364 usecs
[    9.166129] calling  i2o_iop_init+0x0/0x50 @ 1
[    9.166132] I2O subsystem v1.325
[    9.166135] i2o: max drivers = 8
[    9.167265] initcall i2o_iop_init+0x0/0x50 returned 0 after 1102 usecs
[    9.167390] calling  i2o_bus_init+0x0/0x40 @ 1
[    9.167503] I2O Bus Adapter OSM v1.317
[    9.167883] initcall i2o_bus_init+0x0/0x40 returned 0 after 369 usecs
[    9.168102] calling  i2o_proc_init+0x0/0x1a0 @ 1
[    9.168215] I2O ProcFS OSM v1.316
[    9.168614] initcall i2o_proc_init+0x0/0x1a0 returned 0 after 387 usecs
[    9.168729] calling  ds1511_rtc_init+0x0/0x10 @ 1
[    9.169238] initcall ds1511_rtc_init+0x0/0x10 returned 0 after 384 usecs
[    9.169357] calling  ds1742_init+0x0/0x10 @ 1
[    9.169723] initcall ds1742_init+0x0/0x10 returned 0 after 247 usecs
[    9.169841] calling  w1_init+0x0/0xa0 @ 1
[    9.169984] Driver for 1-wire Dallas network protocol.
[    9.170394] hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    9.171374] initcall w1_init+0x0/0xa0 returned 0 after 1354 usecs
[    9.171490] calling  w1_smem_init+0x0/0x40 @ 1
[    9.171607] initcall w1_smem_init+0x0/0x40 returned 0 after 3 usecs
[    9.171722] calling  w1_f2d_init+0x0/0x10 @ 1
[    9.171835] initcall w1_f2d_init+0x0/0x10 returned 0 after 2 usecs
[    9.171985] calling  w1_ds2760_init+0x0/0x30 @ 1
[    9.172152] 1-Wire driver for the DS2760 battery monitor  chip  - (c) 2004-2005, Szabolcs Gyurko
[    9.172315] initcall w1_ds2760_init+0x0/0x30 returned 0 after 158 usecs
[    9.172439] calling  ds2760_battery_init+0x0/0x10 @ 1
[    9.172810] initcall ds2760_battery_init+0x0/0x10 returned 0 after 248 usecs
[    9.172963] calling  sensors_w83627hf_init+0x0/0x170 @ 1
[    9.173166] initcall sensors_w83627hf_init+0x0/0x170 returned -19 after 19 usecs
[    9.173329] calling  f71805f_init+0x0/0x190 @ 1
[    9.173470] initcall f71805f_init+0x0/0x190 returned -19 after 26 usecs
[    9.173584] calling  f71882fg_init+0x0/0x160 @ 1
[    9.173725] initcall f71882fg_init+0x0/0x160 returned -19 after 26 usecs
[    9.173839] calling  hdaps_init+0x0/0x200 @ 1
[    9.174018] hdaps: inverting axis (3) readings.
[    9.174129] hdaps: LENOVO ThinkPad T60 detected.
[    9.174610] PM: Adding info for platform:hdaps
[    9.175857] PM: Adding info for No Bus:input2
[    9.176224] input: hdaps as /class/input/input2
[    9.176431] evbug.c: Connected device: input2 (hdaps at isa1600/input0)
[    9.176551] hdaps: driver successfully loaded.
[    9.176665] initcall hdaps_init+0x0/0x200 returned 0 after 2603 usecs
[    9.176780] calling  aem_init+0x0/0x50 @ 1
[    9.177229] initcall aem_init+0x0/0x50 returned 0 after 327 usecs
[    9.177350] calling  sm_it87_init+0x0/0x340 @ 1
[    9.178322] initcall sm_it87_init+0x0/0x340 returned -19 after 22 usecs
[    9.178439] calling  k8temp_init+0x0/0x20 @ 1
[    9.178839] initcall k8temp_init+0x0/0x20 returned 0 after 280 usecs
[    9.178982] calling  lis3lv02d_init_module+0x0/0x40 @ 1
[    9.179173] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    9.179593] lis3lv02d driver loaded.
[    9.179708] initcall lis3lv02d_init_module+0x0/0x40 returned 0 after 579 usecs
[    9.179860] calling  smsc47b397_init+0x0/0x1a0 @ 1
[    9.180038] initcall smsc47b397_init+0x0/0x1a0 returned -19 after 10 usecs
[    9.180155] calling  vt1211_init+0x0/0x180 @ 1
[    9.180288] initcall vt1211_init+0x0/0x180 returned -19 after 20 usecs
[    9.180404] calling  sm_vt8231_init+0x0/0x20 @ 1
[    9.180800] initcall sm_vt8231_init+0x0/0x20 returned 0 after 274 usecs
[    9.180953] calling  sensors_w83627ehf_init+0x0/0x180 @ 1
[    9.181121] initcall sensors_w83627ehf_init+0x0/0x180 returned -19 after 30 usecs
[    9.181276] calling  pcwd_init_module+0x0/0x20 @ 1
[    9.181745] PM: Adding info for isa:pcwd.0
[    9.182139] PM: Removing info for isa:pcwd.0
[    9.182627] PM: Adding info for isa:pcwd.1
[    9.182965] PM: Removing info for isa:pcwd.1
[    9.183510] PM: Adding info for isa:pcwd.2
[    9.183849] PM: Removing info for isa:pcwd.2
[    9.184507] initcall pcwd_init_module+0x0/0x20 returned -19 after 3043 usecs
[    9.184625] calling  mixcomwd_init+0x0/0x180 @ 1
[    9.184958] mixcomwd: No card detected, or port not available.
[    9.185100] initcall mixcomwd_init+0x0/0x180 returned -19 after 351 usecs
[    9.185216] calling  pcipcwd_init_module+0x0/0x30 @ 1
[    9.185626] initcall pcipcwd_init_module+0x0/0x30 returned 0 after 279 usecs
[    9.185742] calling  usb_pcwd_init+0x0/0x50 @ 1
[    9.186181] usbcore: registered new interface driver pcwd_usb
[    9.186313] pcwd_usb: Berkshire USB-PC Watchdog driver v1.02
[    9.186430] initcall usb_pcwd_init+0x0/0x50 returned 0 after 560 usecs
[    9.186545] calling  advwdt_init+0x0/0x70 @ 1
[    9.186656] WDT driver for Advantech single board computer initialising.
[    9.187172] PM: Adding info for platform:advantechwdt
[    9.187760] PM: Adding info for No Bus:watchdog
[    9.188154] advantechwdt: initialized. timeout=60 sec (nowayout=1)
[    9.188284] initcall advwdt_init+0x0/0x70 returned 0 after 1586 usecs
[    9.188401] calling  alim7101_wdt_init+0x0/0x200 @ 1
[    9.188513] alim7101_wdt: Steve Hill <steve@navaho.co.uk>.
[    9.188640] alim7101_wdt: ALi M7101 PMU not present - WDT not set
[    9.188756] initcall alim7101_wdt_init+0x0/0x200 returned -16 after 235 usecs
[    9.188873] initcall alim7101_wdt_init+0x0/0x200 returned with error code -16 
[    9.189092] calling  sc520_wdt_init+0x0/0x110 @ 1
[    9.189276] hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    9.189421] sc520_wdt: cannot register miscdev on minor=130 (err=-16)
[    9.189549] initcall sc520_wdt_init+0x0/0x110 returned -16 after 334 usecs
[    9.189667] initcall sc520_wdt_init+0x0/0x110 returned with error code -16 
[    9.189783] calling  ibmasr_init+0x0/0x290 @ 1
[    9.189940] initcall ibmasr_init+0x0/0x290 returned -19 after 1 usecs
[    9.190075] calling  wafwdt_init+0x0/0x1c0 @ 1
[    9.190186] WDT driver for Wafer 5823 single board computer initialising.
[    9.190322] Wafer 5823 WDT: I/O address 0x0443 already in use
[    9.190442] initcall wafwdt_init+0x0/0x1c0 returned -5 after 249 usecs
[    9.190557] initcall wafwdt_init+0x0/0x1c0 returned with error code -5 
[    9.190671] calling  pc87413_init+0x0/0xa0 @ 1
[    9.190783] pc87413 WDT: Version 1.1 at io 0x2E
[    9.190945] pc87413 WDT: cannot register miscdev on minor=130 (err=-16)
[    9.191078] initcall pc87413_init+0x0/0xa0 returned -16 after 285 usecs
[    9.191194] initcall pc87413_init+0x0/0xa0 returned with error code -16 
[    9.191313] calling  sbc60xxwdt_init+0x0/0x1e0 @ 1
[    9.191434] sbc60xxwdt: I/O address 0x0443 already in use
[    9.191549] initcall sbc60xxwdt_init+0x0/0x1e0 returned -5 after 118 usecs
[    9.191664] initcall sbc60xxwdt_init+0x0/0x1e0 returned with error code -5 
[    9.191778] calling  wb_smsc_wdt_init+0x0/0x1d0 @ 1
[    9.191941] SMsC 37B787 watchdog component driver 1.1 initialising...
[    9.193116] smsc37b787_wdt: Unable to register miscdev on minor 130
[    9.193236] initcall wb_smsc_wdt_init+0x0/0x1d0 returned -16 after 1262 usecs
[    9.193354] initcall wb_smsc_wdt_init+0x0/0x1d0 returned with error code -16 
[    9.193469] calling  wdt_init+0x0/0x220 @ 1
[    9.193580] WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.
[    9.193774] w83627hf/thf/hg WDT: Watchdog already running. Resetting timeout to 60 sec
[    9.193999] w83627hf/thf/hg WDT: cannot register miscdev on minor=130 (err=-16)
[    9.194173] initcall wdt_init+0x0/0x220 returned -16 after 576 usecs
[    9.194290] initcall wdt_init+0x0/0x220 returned with error code -16 
[    9.194404] calling  zf_init+0x0/0x1b0 @ 1
[    9.194514] machzwd: MachZ ZF-Logic Watchdog driver initializing.
[    9.194630] machzwd: no ZF-Logic found
[    9.194742] initcall zf_init+0x0/0x1b0 returned -19 after 220 usecs
[    9.194856] calling  watchdog_init+0x0/0xd0 @ 1
[    9.195037] epx_c3: cannot register miscdev on minor=130 (err=-16)
[    9.195157] initcall watchdog_init+0x0/0xd0 returned -16 after 121 usecs
[    9.195273] initcall watchdog_init+0x0/0xd0 returned with error code -16 
[    9.195388] calling  telephony_init+0x0/0x50 @ 1
[    9.195499] Linux telephony interface: v1.00
[    9.195632] initcall telephony_init+0x0/0x50 returned 0 after 128 usecs
[    9.195748] calling  kcapi_init+0x0/0xa0 @ 1
[    9.196035] CAPI Subsystem Rev 1.1.2.8
[    9.196154] initcall kcapi_init+0x0/0xa0 returned 0 after 286 usecs
[    9.196268] calling  capi_init+0x0/0x180 @ 1
[    9.196784] PM: Adding info for No Bus:capi
[    9.197193] capi20: Rev 1.1.2.7: started up with major 68 (no middleware)
[    9.197320] initcall capi_init+0x0/0x180 returned 0 after 917 usecs
[    9.197435] calling  b1isa_init+0x0/0x100 @ 1
[    9.197546] b1isa: revision 1.1.2.3
[    9.197658] initcall b1isa_init+0x0/0x100 returned 0 after 108 usecs
[    9.197772] calling  b1_init+0x0/0x80 @ 1
[    9.197924] b1: revision 1.1.2.2
[    9.198081] initcall b1_init+0x0/0x80 returned 0 after 150 usecs
[    9.198196] calling  c4_init+0x0/0xd0 @ 1
[    9.198370] uhci_hcd 0000:00:1d.3: port 2 portsc 008a,00
[    9.198838] c4: revision 1.1.2.2
[    9.198987] initcall c4_init+0x0/0xd0 returned 0 after 657 usecs
[    9.199118] calling  pci_eisa_init_module+0x0/0x20 @ 1
[    9.199528] initcall pci_eisa_init_module+0x0/0x20 returned 0 after 288 usecs
[    9.199645] calling  init_ladder+0x0/0x10 @ 1
[    9.199757] cpuidle: using governor ladder
[    9.199869] initcall init_ladder+0x0/0x10 returned 0 after 110 usecs
[    9.200045] calling  memstick_init+0x0/0x90 @ 1
[    9.200756] initcall memstick_init+0x0/0x90 returned 0 after 582 usecs
[    9.200873] calling  mspro_block_init+0x0/0x90 @ 1
[    9.201343] initcall mspro_block_init+0x0/0x90 returned 0 after 307 usecs
[    9.201461] calling  jmb38x_ms_init+0x0/0x20 @ 1
[    9.201952] initcall jmb38x_ms_init+0x0/0x20 returned 0 after 368 usecs
[    9.202097] calling  heartbeat_trig_init+0x0/0x10 @ 1
[    9.202214] initcall heartbeat_trig_init+0x0/0x10 returned 0 after 2 usecs
[    9.202340] calling  bl_trig_init+0x0/0x10 @ 1
[    9.202458] initcall bl_trig_init+0x0/0x10 returned 0 after 3 usecs
[    9.202572] calling  ib_core_init+0x0/0x40 @ 1
[    9.202943] initcall ib_core_init+0x0/0x40 returned 0 after 252 usecs
[    9.203080] calling  ib_mad_init_module+0x0/0xb0 @ 1
[    9.203233] initcall ib_mad_init_module+0x0/0xb0 returned 0 after 37 usecs
[    9.203351] calling  ib_sa_init+0x0/0x90 @ 1
[    9.203553] initcall ib_sa_init+0x0/0x90 returned 0 after 87 usecs
[    9.203669] calling  ib_cm_init+0x0/0x140 @ 1
[    9.204402] initcall ib_cm_init+0x0/0x140 returned 0 after 604 usecs
[    9.204519] calling  iw_cm_init+0x0/0x40 @ 1
[    9.204710] initcall iw_cm_init+0x0/0x40 returned 0 after 75 usecs
[    9.204826] calling  nes_init_module+0x0/0x140 @ 1
[    9.205573] initcall nes_init_module+0x0/0x140 returned 0 after 585 usecs
[    9.205690] calling  dcdrbu_init+0x0/0x140 @ 1
[    9.205936] PM: Adding info for platform:dell_rbu
[    9.206351] initcall dcdrbu_init+0x0/0x140 returned 0 after 527 usecs
[    9.206468] calling  init_hrt_clocksource+0x0/0x190 @ 1
[    9.206584] initcall init_hrt_clocksource+0x0/0x190 returned -19 after 1 usecs
[    9.206734] calling  dell_wmi_init+0x0/0x130 @ 1
[    9.206847] dell-wmi: No known WMI GUID found
[    9.207031] initcall dell_wmi_init+0x0/0x130 returned 0 after 178 usecs
[    9.207146] calling  acer_wmi_init+0x0/0x580 @ 1
[    9.207258] acer-wmi: Acer Laptop ACPI-WMI Extras
[    9.207377] acer-wmi: No or unsupported WMI interface, unable to load
[    9.207494] initcall acer_wmi_init+0x0/0x580 returned -19 after 228 usecs
[    9.207608] calling  thinkpad_acpi_module_init+0x0/0xaa0 @ 1
[    9.208779] PM: Adding info for platform:thinkpad_acpi
[    9.209307] PM: Adding info for platform:thinkpad_hwmon
[    9.209903] PM: Adding info for No Bus:hwmon0
[    9.210297] thinkpad_acpi: ThinkPad ACPI Extras v0.23
[    9.210411] thinkpad_acpi: http://ibm-acpi.sf.net/
[    9.210523] thinkpad_acpi: ThinkPad BIOS 79ET56WW (1.02 ), EC 79HT42WW-1.01
[    9.210638] thinkpad_acpi: Lenovo ThinkPad T60, model 1951A26
[    9.211965] thinkpad_acpi: radio switch found; radios are disabled
[    9.226445] evbug.c: Event. Dev: input2, Type: 0, Code: 0, Value: 0
[    9.254206] PM: Adding info for No Bus:tpacpi::thinklight
[    9.255084] Registered led device: tpacpi::thinklight
[    9.255418] PM: Adding info for No Bus:tpacpi::power
[    9.255786] Registered led device: tpacpi::power
[    9.256091] PM: Adding info for No Bus:tpacpi:orange:batt
[    9.256462] Registered led device: tpacpi:orange:batt
[    9.256705] PM: Adding info for No Bus:tpacpi:green:batt
[    9.257043] hub 1-0:1.0: state 7 ports 8 chg 0100 evt 0000
[    9.257192] hub 1-0:1.0: port 8, status 0501, change 0000, 480 Mb/s
[    9.257397] Registered led device: tpacpi:green:batt
[    9.257642] PM: Adding info for No Bus:tpacpi::dock_active
[    9.258063] Registered led device: tpacpi::dock_active
[    9.258322] PM: Adding info for No Bus:tpacpi::bay_active
[    9.258694] Registered led device: tpacpi::bay_active
[    9.258968] PM: Adding info for No Bus:tpacpi::dock_batt
[    9.259391] Registered led device: tpacpi::dock_batt
[    9.259641] PM: Adding info for No Bus:tpacpi::unknown_led
[    9.260059] Registered led device: tpacpi::unknown_led
[    9.260313] PM: Adding info for No Bus:tpacpi::standby
[    9.260681] Registered led device: tpacpi::standby
[    9.260959] PM: Adding info for No Bus:tpacpi::dock_status1
[    9.262148] Registered led device: tpacpi::dock_status1
[    9.262408] PM: Adding info for No Bus:tpacpi::dock_status2
[    9.262777] Registered led device: tpacpi::dock_status2
[    9.263075] PM: Adding info for No Bus:tpacpi::unknown_led2
[    9.263447] Registered led device: tpacpi::unknown_led2
[    9.263697] PM: Adding info for No Bus:tpacpi::unknown_led3
[    9.264115] Registered led device: tpacpi::unknown_led3
[    9.264379] PM: Adding info for No Bus:tpacpi::thinkvantage
[    9.264753] Registered led device: tpacpi::thinkvantage
[    9.264895] thinkpad_acpi: warning: userspace override of important firmware LEDs is enabled
[    9.267665] PM: Adding info for No Bus:thinkpad_screen
[    9.268603] PM: Adding info for No Bus:input3
[    9.268972] input: ThinkPad Extra Buttons as /class/input/input3
[    9.269124] evbug.c: Connected device: input3 (ThinkPad Extra Buttons at thinkpad_acpi/input0)
[    9.269297] initcall thinkpad_acpi_module_init+0x0/0xaa0 returned 0 after 60126 usecs
[    9.269450] calling  acpi_pcc_init+0x0/0x30 @ 1
[    9.269878] initcall acpi_pcc_init+0x0/0x30 returned 0 after 306 usecs
[    9.269994] calling  flow_cache_init+0x0/0x180 @ 1
[    9.270169] initcall flow_cache_init+0x0/0x180 returned 0 after 44 usecs
[    9.270290] calling  llc_init+0x0/0x20 @ 1
[    9.270405] initcall llc_init+0x0/0x20 returned 0 after 3 usecs
[    9.270519] calling  llc2_init+0x0/0xd0 @ 1
[    9.270800] NET: Registered protocol family 26
[    9.270968] initcall llc2_init+0x0/0xd0 returned 0 after 329 usecs
[    9.271103] calling  snap_init+0x0/0x40 @ 1
[    9.271221] initcall snap_init+0x0/0x40 returned 0 after 6 usecs
[    9.271339] calling  blackhole_module_init+0x0/0x10 @ 1
[    9.271455] initcall blackhole_module_init+0x0/0x10 returned 0 after 2 usecs
[    9.271570] calling  gact_init_module+0x0/0x20 @ 1
[    9.271680] GACT probability on
[    9.271790] initcall gact_init_module+0x0/0x20 returned 0 after 105 usecs
[    9.271957] calling  mirred_init_module+0x0/0x20 @ 1
[    9.272085] Mirror/redirect action on
[    9.272196] initcall mirred_init_module+0x0/0x20 returned 0 after 107 usecs
[    9.272319] calling  pedit_init_module+0x0/0x10 @ 1
[    9.272433] initcall pedit_init_module+0x0/0x10 returned 0 after 1 usecs
[    9.272548] calling  skbedit_init_module+0x0/0x10 @ 1
[    9.272662] initcall skbedit_init_module+0x0/0x10 returned 0 after 1 usecs
[    9.272776] calling  htb_module_init+0x0/0x10 @ 1
[    9.272942] initcall htb_module_init+0x0/0x10 returned 0 after 1 usecs
[    9.273071] calling  sfq_module_init+0x0/0x10 @ 1
[    9.273190] initcall sfq_module_init+0x0/0x10 returned 0 after 1 usecs
[    9.273309] calling  tbf_module_init+0x0/0x10 @ 1
[    9.273423] initcall tbf_module_init+0x0/0x10 returned 0 after 1 usecs
[    9.273537] calling  teql_init+0x0/0xc0 @ 1
[    9.274115] PM: Adding info for No Bus:teql0
[    9.275038] initcall teql_init+0x0/0xc0 returned 0 after 1356 usecs
[    9.275154] calling  multiq_module_init+0x0/0x10 @ 1
[    9.275270] initcall multiq_module_init+0x0/0x10 returned 0 after 1 usecs
[    9.275386] calling  netem_module_init+0x0/0x20 @ 1
[    9.275497] netem: version 1.2
[    9.275608] initcall netem_module_init+0x0/0x20 returned 0 after 106 usecs
[    9.275723] calling  init_route4+0x0/0x10 @ 1
[    9.275885] initcall init_route4+0x0/0x10 returned 0 after 2 usecs
[    9.275998] calling  cls_flow_init+0x0/0x10 @ 1
[    9.276127] initcall cls_flow_init+0x0/0x10 returned 0 after 1 usecs
[    9.276243] calling  init_em_cmp+0x0/0x10 @ 1
[    9.276359] initcall init_em_cmp+0x0/0x10 returned 0 after 2 usecs
[    9.276474] calling  init_em_u32+0x0/0x10 @ 1
[    9.276592] initcall init_em_u32+0x0/0x10 returned 0 after 1 usecs
[    9.276706] calling  nfnetlink_init+0x0/0x70 @ 1
[    9.276818] Netfilter messages via NETLINK v0.30.
[    9.277034] initcall nfnetlink_init+0x0/0x70 returned 0 after 207 usecs
[    9.277150] calling  nfnetlink_log_init+0x0/0xe0 @ 1
[    9.277290] initcall nfnetlink_log_init+0x0/0xe0 returned 0 after 25 usecs
[    9.277405] calling  xt_init+0x0/0x140 @ 1
[    9.277524] initcall xt_init+0x0/0x140 returned 0 after 8 usecs
[    9.277636] calling  tcpudp_mt_init+0x0/0x20 @ 1
[    9.277752] initcall tcpudp_mt_init+0x0/0x20 returned 0 after 4 usecs
[    9.277916] calling  mark_mt_init+0x0/0x20 @ 1
[    9.278046] initcall mark_mt_init+0x0/0x20 returned 0 after 2 usecs
[    9.278159] calling  policy_mt_init+0x0/0x20 @ 1
[    9.278274] initcall policy_mt_init+0x0/0x20 returned 0 after 2 usecs
[    9.278388] calling  sysctl_ipv4_init+0x0/0x50 @ 1
[    9.279411] initcall sysctl_ipv4_init+0x0/0x50 returned 0 after 889 usecs
[    9.279526] calling  init_syncookies+0x0/0x20 @ 1
[    9.279684] initcall init_syncookies+0x0/0x20 returned 0 after 44 usecs
[    9.279799] calling  ah4_init+0x0/0x70 @ 1
[    9.279948] initcall ah4_init+0x0/0x70 returned 0 after 3 usecs
[    9.280077] calling  esp4_init+0x0/0x70 @ 1
[    9.280191] initcall esp4_init+0x0/0x70 returned 0 after 2 usecs
[    9.280309] calling  ipcomp4_init+0x0/0x70 @ 1
[    9.280424] initcall ipcomp4_init+0x0/0x70 returned 0 after 3 usecs
[    9.280537] calling  ipip_init+0x0/0xb0 @ 1
[    9.280651] initcall ipip_init+0x0/0xb0 returned 0 after 3 usecs
[    9.280764] calling  xfrm4_beet_init+0x0/0x20 @ 1
[    9.280927] initcall xfrm4_beet_init+0x0/0x20 returned 0 after 2 usecs
[    9.281056] calling  tunnel4_init+0x0/0x70 @ 1
[    9.281175] initcall tunnel4_init+0x0/0x70 returned 0 after 2 usecs
[    9.281292] calling  ipv4_netfilter_init+0x0/0x10 @ 1
[    9.281409] initcall ipv4_netfilter_init+0x0/0x10 returned 0 after 3 usecs
[    9.281524] calling  hybla_register+0x0/0x10 @ 1
[    9.281636] TCP hybla registered
[    9.281745] initcall hybla_register+0x0/0x10 returned 0 after 106 usecs
[    9.281909] calling  htcp_register+0x0/0x10 @ 1
[    9.282036] TCP htcp registered
[    9.282147] initcall htcp_register+0x0/0x10 returned 0 after 107 usecs
[    9.282262] calling  tcp_veno_register+0x0/0x20 @ 1
[    9.282378] TCP veno registered
[    9.282489] initcall tcp_veno_register+0x0/0x20 returned 0 after 107 usecs
[    9.282603] calling  tcp_lp_register+0x0/0x10 @ 1
[    9.282714] TCP lp registered
[    9.282873] initcall tcp_lp_register+0x0/0x10 returned 0 after 153 usecs
[    9.282987] calling  packet_init+0x0/0x40 @ 1
[    9.283115] NET: Registered protocol family 17
[    9.283249] initcall packet_init+0x0/0x40 returned 0 after 130 usecs
[    9.283365] calling  ipsec_pfkey_init+0x0/0x80 @ 1
[    9.283481] NET: Registered protocol family 15
[    9.283691] initcall ipsec_pfkey_init+0x0/0x80 returned 0 after 204 usecs
[    9.283808] calling  dsa_init_module+0x0/0x20 @ 1
[    9.283973] initcall dsa_init_module+0x0/0x20 returned 0 after 2 usecs
[    9.284108] calling  mv88e6131_init+0x0/0x20 @ 1
[    9.284225] initcall mv88e6131_init+0x0/0x20 returned 0 after 3 usecs
[    9.284344] calling  dsa_init_module+0x0/0x10 @ 1
[    9.284723] initcall dsa_init_module+0x0/0x10 returned 0 after 259 usecs
[    9.284876] calling  phonet_init+0x0/0x80 @ 1
[    9.285041] NET: Registered protocol family 35
[    9.285214] initcall phonet_init+0x0/0x80 returned 0 after 218 usecs
[    9.285336] calling  pep_register+0x0/0x20 @ 1
[    9.285472] initcall pep_register+0x0/0x20 returned 0 after 22 usecs
[    9.285587] calling  dccp_init+0x0/0x380 @ 1
[    9.292737] CCID: Activated CCID 2 (TCP-like)
[    9.292932] CCID: Activated CCID 3 (TCP-Friendly Rate Control)
[    9.293121] initcall dccp_init+0x0/0x380 returned 0 after 7241 usecs
[    9.293238] calling  dccp_v4_init+0x0/0x80 @ 1
[    9.294681] initcall dccp_v4_init+0x0/0x80 returned 0 after 1291 usecs
[    9.294798] calling  lib80211_init+0x0/0x20 @ 1
[    9.294909] lib80211: common routines for IEEE802.11 drivers
[    9.295047] lib80211_crypt: registered algorithm 'NULL'
[    9.295162] initcall lib80211_init+0x0/0x20 returned 0 after 244 usecs
[    9.295280] calling  dcbnl_init+0x0/0x40 @ 1
[    9.295397] initcall dcbnl_init+0x0/0x40 returned 0 after 1 usecs
[    9.295512] calling  severities_debugfs_init+0x0/0x60 @ 1
[    9.295677] initcall severities_debugfs_init+0x0/0x60 returned 0 after 48 usecs
[    9.295891] calling  centrino_init+0x0/0x30 @ 1
[    9.296047] initcall centrino_init+0x0/0x30 returned -19 after 26 usecs
[    9.296163] calling  update_mp_table+0x0/0x490 @ 1
[    9.296279] initcall update_mp_table+0x0/0x490 returned 0 after 1 usecs
[    9.296393] calling  lapic_insert_resource+0x0/0x50 @ 1
[    9.296514] initcall lapic_insert_resource+0x0/0x50 returned 0 after 6 usecs
[    9.296630] calling  print_ipi_mode+0x0/0x30 @ 1
[    9.296741] Using IPI No-Shortcut mode
[    9.296904] initcall print_ipi_mode+0x0/0x30 returned 0 after 158 usecs
[    9.297035] calling  init_lapic_nmi_sysfs+0x0/0x40 @ 1
[    9.297150] initcall init_lapic_nmi_sysfs+0x0/0x40 returned 0 after 1 usecs
[    9.297265] calling  io_apic_bug_finalize+0x0/0x20 @ 1
[    9.297381] initcall io_apic_bug_finalize+0x0/0x20 returned 0 after 1 usecs
[    9.297497] calling  check_early_ioremap_leak+0x0/0x70 @ 1
[    9.297614] initcall check_early_ioremap_leak+0x0/0x70 returned 0 after 1 usecs
[    9.297766] calling  init_oops_id+0x0/0x50 @ 1
[    9.297936] initcall init_oops_id+0x0/0x50 returned 0 after 6 usecs
[    9.298075] calling  disable_boot_consoles+0x0/0x50 @ 1
[    9.298191] initcall disable_boot_consoles+0x0/0x50 returned 0 after 1 usecs
[    9.298309] calling  pm_qos_power_init+0x0/0x80 @ 1
[    9.298881] PM: Adding info for No Bus:cpu_dma_latency
[    9.299433] PM: Adding info for No Bus:network_latency
[    9.299944] PM: Adding info for No Bus:network_throughput
[    9.300338] initcall pm_qos_power_init+0x0/0x80 returned 0 after 1870 usecs
[    9.300457] calling  debugfs_kprobe_init+0x0/0x90 @ 1
[    9.300617] initcall debugfs_kprobe_init+0x0/0x90 returned 0 after 43 usecs
[    9.300733] calling  clear_boot_tracer+0x0/0x30 @ 1
[    9.300884] initcall clear_boot_tracer+0x0/0x30 returned 0 after 1 usecs
[    9.301000] calling  max_swapfiles_check+0x0/0x10 @ 1
[    9.301132] initcall max_swapfiles_check+0x0/0x10 returned 0 after 1 usecs
[    9.301246] calling  kmemleak_late_init+0x0/0x90 @ 1
[    9.301451] kmemleak: Kernel memory leak detector initialized
[    9.301454] kmemleak: Automatic memory scanning thread started
[    9.301677] initcall kmemleak_late_init+0x0/0x90 returned 0 after 309 usecs
[    9.301794] calling  random32_reseed+0x0/0x90 @ 1
[    9.301976] initcall random32_reseed+0x0/0x90 returned 0 after 17 usecs
[    9.302139] calling  pci_resource_alignment_sysfs_init+0x0/0x20 @ 1
[    9.302270] initcall pci_resource_alignment_sysfs_init+0x0/0x20 returned 0 after 11 usecs
[    9.302423] calling  pci_sysfs_init+0x0/0x60 @ 1
[    9.303286] initcall pci_sysfs_init+0x0/0x60 returned 0 after 731 usecs
[    9.304194] calling  regulator_init_complete+0x0/0x150 @ 1
[    9.304317] initcall regulator_init_complete+0x0/0x150 returned 0 after 2 usecs
[    9.304474] calling  seqgen_init+0x0/0x10 @ 1
[    9.304607] initcall seqgen_init+0x0/0x10 returned 0 after 21 usecs
[    9.304724] calling  late_resume_init+0x0/0x110 @ 1
[    9.304878]   Magic number: 5:535:397
[    9.305174] tty ttyD75: hash matches
[    9.305452] mem random: hash matches
[    9.305596] initcall late_resume_init+0x0/0x110 returned 0 after 699 usecs
[    9.305712] calling  hd_init+0x0/0x360 @ 1
[    9.305938] hd: no drives specified - use hd=cyl,head,sectors on kernel command line
[    9.306149] initcall hd_init+0x0/0x360 returned -1 after 281 usecs
[    9.306265] initcall hd_init+0x0/0x360 returned with error code -1 
[    9.306380] calling  scsi_complete_async_scans+0x0/0x150 @ 1
[    9.306498] initcall scsi_complete_async_scans+0x0/0x150 returned 0 after 1 usecs
[    9.306651] calling  rtc_hctosys+0x0/0x160 @ 1
[    9.306768] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    9.306934] initcall rtc_hctosys+0x0/0x160 returned -19 after 162 usecs
[    9.307065] calling  memmap_init+0x0/0xb0 @ 1
[    9.307769] initcall memmap_init+0x0/0xb0 returned 0 after 576 usecs
[    9.307911] calling  init_net_drop_monitor+0x0/0x150 @ 1
[    9.308043] Initalizing network drop monitor service
[    9.308346] ehci_hcd 0000:00:1d.7: port 8 full speed --> companion
[    9.308489] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003801 POWER OWNER sig=j CONNECT
[    9.308678] hub 1-0:1.0: port 8 not reset yet, waiting 50ms
[    9.308921] initcall init_net_drop_monitor+0x0/0x150 returned 0 after 856 usecs
[    9.309127] calling  tcp_congestion_default+0x0/0x10 @ 1
[    9.309246] initcall tcp_congestion_default+0x0/0x10 returned 0 after 2 usecs
[    9.309366] calling  ip_auto_config+0x0/0xfc0 @ 1
[    9.309504] initcall ip_auto_config+0x0/0xfc0 returned 0 after 26 usecs
[    9.309618] calling  initialize_hashrnd+0x0/0x20 @ 1
[    9.309739] initcall initialize_hashrnd+0x0/0x20 returned 0 after 6 usecs
[    9.309927] async_waiting @ 1
[    9.310056] async_continuing @ 1 after 2 usec
[    9.359040] ehci_hcd 0000:00:1d.7: GetStatus port 8 status 003002 POWER OWNER sig=se0 CSC
[    9.359318] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0000
[    9.359467] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100
[    9.359696] kjournald starting.  Commit interval 5 seconds
[    9.359727] EXT3-fs: mounted filesystem with ordered data mode.
[    9.359755] VFS: Mounted root (ext3 filesystem) readonly on device 8:1.
[    9.359819] async_waiting @ 1
[    9.359825] async_continuing @ 1 after 1 usec
[    9.359828] debug: unmapping init memory c18c5000..c1a8e000
[    9.454066] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
[    9.454209] uhci_hcd 0000:00:1d.3: port 2 portsc 0093,00
[    9.454379] hub 5-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
[    9.486062] Not activating Mandatory Access Control now since /sbin/tomoyo-init doesn't exist.
[    9.558045] hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
[    9.660046] usb 5-2: new full speed USB device using uhci_hcd and address 2
[    9.780018] usb 5-2: ep0 maxpacket = 8
[    9.803698] usb 5-2: default language 0x0409
[    9.822710] usb 5-2: udev 2, busnum 5, minor = 513
[    9.822829] usb 5-2: New USB device found, idVendor=0483, idProduct=2016
[    9.822951] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    9.823088] usb 5-2: Product: Biometric Coprocessor
[    9.823208] usb 5-2: Manufacturer: STMicroelectronics
[    9.823866] PM: Adding info for usb:5-2
[    9.824108] usb 5-2: uevent
[    9.824529] usb 5-2: usb_probe_device
[    9.824653] usb 5-2: configuration #1 chosen from 1 choice
[    9.827710] usb 5-2: adding 5-2:1.0 (config #1, interface 0)
[    9.828116] PM: Adding info for usb:5-2:1.0
[    9.828273] usb 5-2:1.0: uevent
[    9.828810] usbtest 5-2:1.0: usb_probe_interface
[    9.828945] usbtest 5-2:1.0: usb_probe_interface - got id
[    9.829479] PM: Adding info for No Bus:ep_81
[    9.829947] PM: Adding info for No Bus:ep_02
[    9.830317] PM: Adding info for No Bus:ep_83
[    9.830725] PM: Adding info for No Bus:usbdev5.2
[    9.831155] drivers/usb/core/inode.c: creating file '002'
[    9.831505] PM: Adding info for No Bus:ep_00
[    9.831631] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004
[   10.204051] usb usb2: suspend_rh (auto-stop)
[   10.204215] usb usb3: suspend_rh (auto-stop)
[   10.204379] usb usb4: suspend_rh (auto-stop)
[   11.704042] hub 2-0:1.0: hub_suspend
[   11.704179] usb usb2: bus auto-suspend
[   11.704296] usb usb2: suspend_rh
[   11.704433] hub 3-0:1.0: hub_suspend
[   11.704550] usb usb3: bus auto-suspend
[   11.704668] usb usb3: suspend_rh
[   11.704804] hub 4-0:1.0: hub_suspend
[   11.704924] usb usb4: bus auto-suspend
[   11.705062] usb usb4: suspend_rh
[   11.705330] hub 1-0:1.0: hub_suspend
[   11.705450] usb usb1: bus auto-suspend
[   11.705567] ehci_hcd 0000:00:1d.7: suspend root hub
[   69.087846] udevd version 127 started
[   69.671810] usb usb2: uevent
[   69.671903] usb 2-0:1.0: uevent
[   69.672128] usb usb3: uevent
[   69.672344] usb 3-0:1.0: uevent
[   69.672720] usb usb4: uevent
[   69.672953] usb 4-0:1.0: uevent
[   69.673327] usb usb5: uevent
[   69.673546] usb 5-0:1.0: uevent
[   69.673818] usb 5-2: uevent
[   69.674203] usb 5-2:1.0: uevent
[   69.674580] usb usb1: uevent
[   69.674802] usb 1-0:1.0: uevent
[   69.705803] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   69.991557] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   70.133322] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   70.275401] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   70.550423] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   70.951606] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   70.951865] Warning: dev (tty1) tty->count(11) != #fd's(10) in tty_release_dev
[   71.089998] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   71.269651] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   71.270153] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   71.413123] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   71.413843] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.044655] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.066937] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.093997] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.117835] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.164335] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.213832] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.256087] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.366249] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.369702] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   72.374754] Warning: dev (tty1) tty->count(4) != #fd's(3) in tty_release_dev
[   72.441678] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   72.507837] Warning: dev (tty1) tty->count(6) != #fd's(5) in tty_release_dev
[   72.533223] Warning: dev (tty1) tty->count(6) != #fd's(5) in tty_release_dev
[   72.625930] Warning: dev (tty1) tty->count(6) != #fd's(5) in tty_release_dev
[   72.630936] Warning: dev (tty1) tty->count(7) != #fd's(6) in tty_release_dev
[   72.800570] Warning: dev (tty1) tty->count(6) != #fd's(5) in tty_release_dev
[   72.805231] Warning: dev (tty1) tty->count(6) != #fd's(5) in tty_release_dev
[   72.818270] loadkeys used greatest stack depth: 792 bytes left
[   73.184460] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   73.746193] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   73.975089] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.139967] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.178181] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.199863] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.201141] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.210271] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.262115] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.313972] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.336756] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.349931] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.402295] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.458213] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.458739] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.479365] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.583896] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.611121] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.648035] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.650056] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.672278] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.696078] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.697359] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.722086] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.722397] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.743478] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.783873] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.866064] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.896742] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.918553] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.966126] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   74.966632] Warning: dev (tty1) tty->count(5) != #fd's(4) in tty_release_dev
[   75.010404] Warning: dev (tty1) tty->count(7) != #fd's(6) in tty_release_dev
[   75.011769] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   75.012303] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   75.013592] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   75.014081] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   75.014573] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   75.014849] Warning: dev (tty1) tty->count(10) != #fd's(9) in tty_release_dev
[   79.735900] kmemleak: 15 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[   96.717991] IPv4 FIB: Using LC-trie version 0.408
[  162.557802] EXT3 FS on sda1, internal journal
[  164.798005] Adding 4096564k swap on /dev/sda2.  Priority:-1 extents:1 across:4096564k 
[  180.301620] PM: Adding info for No Bus:vcs8
[  180.301866] PM: Adding info for No Bus:vcsa8
[  180.303174] PM: Adding info for No Bus:vcs4
[  180.303428] PM: Adding info for No Bus:vcsa4
[  180.304898] PM: Adding info for No Bus:vcs3
[  180.305135] PM: Adding info for No Bus:vcsa3
[  180.306360] PM: Adding info for No Bus:vcs10
[  180.306601] PM: Adding info for No Bus:vcsa10
[  180.308007] PM: Adding info for No Bus:vcs9
[  180.308240] PM: Adding info for No Bus:vcsa9
[  180.353266] PM: Adding info for No Bus:vcs6
[  180.353506] PM: Adding info for No Bus:vcsa6
[  180.354065] PM: Adding info for No Bus:vcs2
[  180.354342] PM: Adding info for No Bus:vcsa2
[  180.355728] PM: Adding info for No Bus:vcs11
[  180.355961] PM: Adding info for No Bus:vcsa11
[  180.356669] PM: Adding info for No Bus:vcs5
[  180.356900] PM: Adding info for No Bus:vcsa5
[  180.357585] PM: Adding info for No Bus:vcs7
[  180.357820] PM: Adding info for No Bus:vcsa7
[ 1295.596466] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 2511.564568] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 3119.550078] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 3727.521955] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 4335.441675] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 5551.291720] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 6767.178293] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 7375.105563] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 8590.954210] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[ 9198.878163] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[10414.730095] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[15278.333097] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[15886.267970] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[16494.201503] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[18318.001954] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[21357.673340] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[23205.818058] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[23838.141986] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[25734.400245] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[26366.474613] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[27630.623886] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[28262.700037] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[30159.152950] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[30791.425441] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[31423.499238] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[32055.576537] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[33319.726227] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[33951.800407] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[34584.155586] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[35216.271372] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[35848.382003] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[36480.491299] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[37112.616569] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[37744.799710] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[39009.189672] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[39641.426505] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[40273.539884] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[41537.770046] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[42802.152102] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[43434.263250] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[44066.373177] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[44698.476800] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[45330.577701] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[45962.678294] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[46594.781002] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[47226.922484] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[47859.179511] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[48491.248780] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[50387.455083] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

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

* Re: [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown
  2009-08-22 10:35                 ` Ingo Molnar
@ 2009-08-22 21:14                   ` Martin Schwidefsky
  0 siblings, 0 replies; 1150+ messages in thread
From: Martin Schwidefsky @ 2009-08-22 21:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mingo, hpa, linux-kernel, johnstul, tglx, linux-tip-commits

On Sat, 22 Aug 2009 12:35:41 +0200
Ingo Molnar <mingo@elte.hu> wrote:

> even after this fix, -tip testing found yet another circular locking 
> bug, on a 32-bit Core2 laptop:

You got to love lockdep .. another ugly one:
clocksource_register: has clocksource_mutex, get cpu_add_remove_lock
native_cpu_up: has cpu_add_remove_lock, get clocksource_mutex

To register a clocksource the clocksource_mutex is acquired and if
necessary timekeeping_notify is called to install the clocksource as
the timekeeper clock. timekeeping_notify uses stop_machine which needs
to take cpu_add_remove_lock mutex.
Starting a new cpu is done with the cpu_add_remove_lock mutex held.
native_cpu_up checks the tsc of the new cpu and if the tsc is no good
clocksource_change_rating is called. Which needs the clocksource_mutex
and the deadlock is complete.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


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

* [tip:sched/clock] init: Move sched_clock_init after late_time_init
       [not found]             ` <new-submission>
                                 ` (308 preceding siblings ...)
  2009-08-21 19:18               ` [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown tip-bot for Thomas Gleixner
@ 2009-08-27 14:43               ` tip-bot for Thomas Gleixner
  2009-08-28 11:51               ` [tip:perfcounters/urgent] perf_counters: Increase paranoia level tip-bot for Ingo Molnar
                                 ` (396 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-08-27 14:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  fa84e9eecfff478df2d00e94deb3fc40fe4634ad
Gitweb:     http://git.kernel.org/tip/fa84e9eecfff478df2d00e94deb3fc40fe4634ad
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 21 Aug 2009 22:01:12 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 27 Aug 2009 16:38:18 +0200

init: Move sched_clock_init after late_time_init

Some architectures initialize clocks and timers in late_time_init and
x86 wants to do the same to avoid FIXMAP hackery for calibrating the
TSC. That would result in undefined sched_clock readout and wreckaged
printk timestamps again. We probably have those already on archs which
do all their time/clock setup in late_time_init.

There is no harm to move that after late_time_init except that a few
more boot timestamps are stale. The scheduler is not active at that
point so no real wreckage is expected.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: linux-arch@vger.kernel.org


---
 init/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/init/main.c b/init/main.c
index 11f4f14..0ec75ce 100644
--- a/init/main.c
+++ b/init/main.c
@@ -631,7 +631,6 @@ asmlinkage void __init start_kernel(void)
 	softirq_init();
 	timekeeping_init();
 	time_init();
-	sched_clock_init();
 	profile_init();
 	if (!irqs_disabled())
 		printk(KERN_CRIT "start_kernel(): bug: interrupts were "
@@ -682,6 +681,7 @@ asmlinkage void __init start_kernel(void)
 	numa_policy_init();
 	if (late_time_init)
 		late_time_init();
+	sched_clock_init();
 	calibrate_delay();
 	pidmap_init();
 	anon_vma_init();

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

* [tip:perfcounters/urgent] perf_counters: Increase paranoia level
       [not found]             ` <new-submission>
                                 ` (309 preceding siblings ...)
  2009-08-27 14:43               ` [tip:sched/clock] init: Move sched_clock_init after late_time_init tip-bot for Thomas Gleixner
@ 2009-08-28 11:51               ` tip-bot for Ingo Molnar
  2009-08-28 18:34               ` [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable tip-bot for Thomas Gleixner
                                 ` (395 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-08-28 11:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  6bb56347f5162d1a7cb1dc461023360781ecd4c0
Gitweb:     http://git.kernel.org/tip/6bb56347f5162d1a7cb1dc461023360781ecd4c0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 28 Aug 2009 13:44:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 28 Aug 2009 13:44:53 +0200

perf_counters: Increase paranoia level

Per-cpu counters are an ASLR information leak as they show
the execution other tasks do. Increase the paranoia level
to 1, which disallows per-cpu counters. (they still allow
counting/profiling of own tasks - and admin can profile
everything.)

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>
Cc: Frederic Weisbecker <fweisbec@gmail.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 f274e19..7d4bb83 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -50,7 +50,7 @@ static atomic_t nr_task_counters __read_mostly;
  *  1 - disallow cpu counters to unpriv
  *  2 - disallow kernel profiling to unpriv
  */
-int sysctl_perf_counter_paranoid __read_mostly;
+int sysctl_perf_counter_paranoid __read_mostly = 1;
 
 static inline bool perf_paranoid_cpu(void)
 {

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

* [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
       [not found]             ` <new-submission>
                                 ` (310 preceding siblings ...)
  2009-08-28 11:51               ` [tip:perfcounters/urgent] perf_counters: Increase paranoia level tip-bot for Ingo Molnar
@ 2009-08-28 18:34               ` tip-bot for Thomas Gleixner
  2009-08-31  8:19                 ` Martin Schwidefsky
  2009-09-02  6:25               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
                                 ` (394 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-08-28 18:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, johnstul, schwidefsky, tglx

Commit-ID:  7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
Gitweb:     http://git.kernel.org/tip/7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 28 Aug 2009 20:25:24 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 28 Aug 2009 20:25:24 +0200

clocksource: Resolve cpu hotplug dead lock with TSC unstable

Martin Schwidefsky analyzed it:
To register a clocksource the clocksource_mutex is acquired and if
necessary timekeeping_notify is called to install the clocksource as
the timekeeper clock. timekeeping_notify uses stop_machine which needs
to take cpu_add_remove_lock mutex.
Starting a new cpu is done with the cpu_add_remove_lock mutex held.
native_cpu_up checks the tsc of the new cpu and if the tsc is no good
clocksource_change_rating is called. Which needs the clocksource_mutex
and the deadlock is complete.

The solution is to replace the TSC via the clocksource watchdog
mechanism. Mark the TSC as unstable and schedule the watchdog work so
it gets removed in the watchdog thread context.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>


---
 arch/x86/kernel/tsc.c       |    8 +++++---
 include/linux/clocksource.h |    1 +
 kernel/time/clocksource.c   |   33 ++++++++++++++++++++++++++++++---
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9684254..fc3672a 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -767,12 +767,14 @@ void mark_tsc_unstable(char *reason)
 {
 	if (!tsc_unstable) {
 		tsc_unstable = 1;
-		printk("Marking TSC unstable due to %s\n", reason);
+		printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
 		/* Change only the rating, when not registered */
 		if (clocksource_tsc.mult)
-			clocksource_change_rating(&clocksource_tsc, 0);
-		else
+			clocksource_mark_unstable(&clocksource_tsc);
+		else {
+			clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
 			clocksource_tsc.rating = 0;
+		}
 	}
 }
 
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9ea40ff..83d2fbd 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -277,6 +277,7 @@ extern struct clocksource* clocksource_get_next(void);
 extern void clocksource_change_rating(struct clocksource *cs, int rating);
 extern void clocksource_resume(void);
 extern struct clocksource * __init __weak clocksource_default_clock(void);
+extern void clocksource_mark_unstable(struct clocksource *cs);
 
 #ifdef CONFIG_GENERIC_TIME_VSYSCALL
 extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e0c86ad..a0af4ff 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -149,15 +149,42 @@ static void clocksource_watchdog_work(struct work_struct *work)
 	kthread_run(clocksource_watchdog_kthread, NULL, "kwatchdog");
 }
 
-static void clocksource_unstable(struct clocksource *cs, int64_t delta)
+static void __clocksource_unstable(struct clocksource *cs)
 {
-	printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n",
-	       cs->name, delta);
 	cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
 	cs->flags |= CLOCK_SOURCE_UNSTABLE;
 	schedule_work(&watchdog_work);
 }
 
+static void clocksource_unstable(struct clocksource *cs, int64_t delta)
+{
+	printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n",
+	       cs->name, delta);
+	__clocksource_unstable(cs);
+}
+
+/**
+ * clocksource_mark_unstable - mark clocksource unstable via watchdog
+ * @cs:		clocksource to be marked unstable
+ *
+ * This function is called instead of clocksource_change_rating from
+ * cpu hotplug code to avoid a deadlock between the clocksource mutex
+ * and the cpu hotplug mutex. It defers the update of the clocksource
+ * to the watchdog thread.
+ */
+void clocksource_mark_unstable(struct clocksource *cs)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&watchdog_lock, flags);
+	if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) {
+		if (list_empty(&cs->wd_list))
+			list_add(&cs->wd_list, &watchdog_list);
+		__clocksource_unstable(cs);
+	}
+	spin_unlock_irqrestore(&watchdog_lock, flags);
+}
+
 static void clocksource_watchdog(unsigned long data)
 {
 	struct clocksource *cs;

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

* Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-08-28 18:34               ` [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable tip-bot for Thomas Gleixner
@ 2009-08-31  8:19                 ` Martin Schwidefsky
  2009-08-31 14:38                   ` Ingo Molnar
  2009-08-31 15:59                   ` Thomas Gleixner
  0 siblings, 2 replies; 1150+ messages in thread
From: Martin Schwidefsky @ 2009-08-31  8:19 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, johnstul, schwidefsky, tglx
  Cc: tglx, linux-tip-commits, linux-kernel, hpa, mingo, johnstul

On Fri, 28 Aug 2009 18:34:00 GMT
tip-bot for Thomas Gleixner <tglx@linutronix.de> wrote:

> Commit-ID:  7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
> Gitweb:     http://git.kernel.org/tip/7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Fri, 28 Aug 2009 20:25:24 +0200
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Fri, 28 Aug 2009 20:25:24 +0200
> 
> clocksource: Resolve cpu hotplug dead lock with TSC unstable
> 
> Martin Schwidefsky analyzed it:
> To register a clocksource the clocksource_mutex is acquired and if
> necessary timekeeping_notify is called to install the clocksource as
> the timekeeper clock. timekeeping_notify uses stop_machine which needs
> to take cpu_add_remove_lock mutex.
> Starting a new cpu is done with the cpu_add_remove_lock mutex held.
> native_cpu_up checks the tsc of the new cpu and if the tsc is no good
> clocksource_change_rating is called. Which needs the clocksource_mutex
> and the deadlock is complete.
> 
> The solution is to replace the TSC via the clocksource watchdog
> mechanism. Mark the TSC as unstable and schedule the watchdog work so
> it gets removed in the watchdog thread context.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> LKML-Reference: <new-submission>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: John Stultz <johnstul@us.ibm.com>

Ah, very good. I've been going round in circles to find a solution that
allows to  downgrade the tsc rating when the second cpu is enabled.
Could not find a solution. Your approach changes semantics slightly:
the tsc clock will continue with its old rating for a while until the
watchdog will do the downgrade. If that is acceptable then this is a
good solution.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


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

* Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-08-31  8:19                 ` Martin Schwidefsky
@ 2009-08-31 14:38                   ` Ingo Molnar
  2009-08-31 15:59                   ` Thomas Gleixner
  1 sibling, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-08-31 14:38 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: mingo, hpa, linux-kernel, johnstul, tglx, linux-tip-commits


* Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:

> On Fri, 28 Aug 2009 18:34:00 GMT
> tip-bot for Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > Commit-ID:  7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
> > Gitweb:     http://git.kernel.org/tip/7285dd7fd375763bfb8ab1ac9cf3f1206f503c16
> > Author:     Thomas Gleixner <tglx@linutronix.de>
> > AuthorDate: Fri, 28 Aug 2009 20:25:24 +0200
> > Committer:  Thomas Gleixner <tglx@linutronix.de>
> > CommitDate: Fri, 28 Aug 2009 20:25:24 +0200
> > 
> > clocksource: Resolve cpu hotplug dead lock with TSC unstable
> > 
> > Martin Schwidefsky analyzed it:
> > To register a clocksource the clocksource_mutex is acquired and if
> > necessary timekeeping_notify is called to install the clocksource as
> > the timekeeper clock. timekeeping_notify uses stop_machine which needs
> > to take cpu_add_remove_lock mutex.
> > Starting a new cpu is done with the cpu_add_remove_lock mutex held.
> > native_cpu_up checks the tsc of the new cpu and if the tsc is no good
> > clocksource_change_rating is called. Which needs the clocksource_mutex
> > and the deadlock is complete.
> > 
> > The solution is to replace the TSC via the clocksource watchdog
> > mechanism. Mark the TSC as unstable and schedule the watchdog work so
> > it gets removed in the watchdog thread context.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > LKML-Reference: <new-submission>
> > Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > Cc: John Stultz <johnstul@us.ibm.com>
> 
> Ah, very good. I've been going round in circles to find a solution 
> that allows to downgrade the tsc rating when the second cpu is 
> enabled. Could not find a solution. Your approach changes 
> semantics slightly: the tsc clock will continue with its old 
> rating for a while until the watchdog will do the downgrade. If 
> that is acceptable then this is a good solution.

Latest timers/core also passed thousands of iterations of -tip 
testing so far, so that painful series of locking and stability 
troubles has been solved and the bits look good for v2.6.32.

	Ingo

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

* Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-08-31  8:19                 ` Martin Schwidefsky
  2009-08-31 14:38                   ` Ingo Molnar
@ 2009-08-31 15:59                   ` Thomas Gleixner
  2009-09-03 18:17                     ` [boot crash] " Ingo Molnar
  1 sibling, 1 reply; 1150+ messages in thread
From: Thomas Gleixner @ 2009-08-31 15:59 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: mingo, hpa, linux-kernel, johnstul, linux-tip-commits

On Mon, 31 Aug 2009, Martin Schwidefsky wrote:
> Ah, very good. I've been going round in circles to find a solution that
> allows to  downgrade the tsc rating when the second cpu is enabled.
> Could not find a solution. Your approach changes semantics slightly:
> the tsc clock will continue with its old rating for a while until the
> watchdog will do the downgrade. If that is acceptable then this is a
> good solution.

Even the old code did not switch right away. The TSC was used until
the next timer interrupt. Also we survive the detection of unstable
TSCs with the watchdog which can happen quite after the fact that it
became unusable. The important point is that we detect it at all and
replace it with something useable.

Thanks,

	tglx

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

* [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
       [not found]             ` <new-submission>
                                 ` (311 preceding siblings ...)
  2009-08-28 18:34               ` [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable tip-bot for Thomas Gleixner
@ 2009-09-02  6:25               ` tip-bot for Peter Zijlstra
  2009-09-02  7:01               ` tip-bot for Peter Zijlstra
                                 ` (393 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-02  6:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, a.p.zijlstra, fweisbec, rostedt,
	tglx, mingo

Commit-ID:  feb107de940aeab2ff812662a4ace3bca81e82cf
Gitweb:     http://git.kernel.org/tip/feb107de940aeab2ff812662a4ace3bca81e82cf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 08:21:26 +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.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
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 342000b..22da9d9 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -304,6 +304,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
 	}
 
 	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
+				trace_sched_stat_iowait(tsk, delta);
 }
 
 /*
@@ -546,6 +547,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 +642,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;

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

* [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
       [not found]             ` <new-submission>
                                 ` (312 preceding siblings ...)
  2009-09-02  6:25               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
@ 2009-09-02  7:01               ` tip-bot for Peter Zijlstra
  2009-09-02  7:15               ` tip-bot for Peter Zijlstra
                                 ` (392 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-02  7:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, a.p.zijlstra, fweisbec, rostedt,
	tglx, mingo

Commit-ID:  0486aef5e10a6b2f83c16cff1ff1b13ba5375ca9
Gitweb:     http://git.kernel.org/tip/0486aef5e10a6b2f83c16cff1ff1b13ba5375ca9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 08:44:09 +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.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
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] 1150+ messages in thread

* [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints
       [not found]             ` <new-submission>
                                 ` (313 preceding siblings ...)
  2009-09-02  7:01               ` tip-bot for Peter Zijlstra
@ 2009-09-02  7:15               ` tip-bot for Peter Zijlstra
  2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Clean up warnings list in the Makefile tip-bot for Ingo Molnar
                                 ` (391 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-02  7:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, a.p.zijlstra, fweisbec, rostedt,
	tglx, mingo

Commit-ID:  768d0c27226e6587cad2fcf543f9711da3f3774e
Gitweb:     http://git.kernel.org/tip/768d0c27226e6587cad2fcf543f9711da3f3774e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 23 Jul 2009 20:13:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 09:12:18 +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.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <new-submission>
[ build fix for the !CONFIG_SCHEDSTATS case ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/trace/events/sched.h |   95 ++++++++++++++++++++++++++++++++++++++++++
 kernel/sched_fair.c          |   12 +++++-
 2 files changed, 106 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..2ff850f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -546,6 +546,13 @@ 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);
+
+#ifdef CONFIG_SCHEDSTATS
+	if (entity_is_task(se)) {
+		trace_sched_stat_wait(task_of(se),
+			rq_of(cfs_rq)->clock - se->wait_start);
+	}
+#endif
 }
 
 static inline void
@@ -636,8 +643,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 +664,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] 1150+ messages in thread

* [tip:perfcounters/core] perf tools: Clean up warnings list in the Makefile
       [not found]             ` <new-submission>
                                 ` (314 preceding siblings ...)
  2009-09-02  7:15               ` tip-bot for Peter Zijlstra
@ 2009-09-02 13:00               ` tip-bot for Ingo Molnar
  2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Work around strict aliasing related warnings tip-bot for Ingo Molnar
                                 ` (390 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-02 13:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	arjan, fweisbec, tglx, mingo

Commit-ID:  61562445c80452ec417fb6a6895b991f6c1dd930
Gitweb:     http://git.kernel.org/tip/61562445c80452ec417fb6a6895b991f6c1dd930
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 2 Sep 2009 14:50:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 14:50:23 +0200

perf tools: Clean up warnings list in the Makefile

Make it easier to turn warnings on/off by using a separate
line for each warning added.

Some of the warnings have too much of a nuisance factor and
we might want to turn them off in the future.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/Makefile |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c481a51..9f8d207 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,30 @@ endif
 #
 # Include saner warnings here, which can catch bugs:
 #
-EXTRA_WARNINGS = -Wcast-align -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+
+EXTRA_WARNINGS := -Wcast-align
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstack-protector
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wvolatile-register-var
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
+EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
 
 CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm

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

* [tip:perfcounters/core] perf tools: Work around strict aliasing related warnings
       [not found]             ` <new-submission>
                                 ` (315 preceding siblings ...)
  2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Clean up warnings list in the Makefile tip-bot for Ingo Molnar
@ 2009-09-02 13:00               ` tip-bot for Ingo Molnar
  2009-09-02 19:31               ` [tip:perfcounters/core] perf trace: Sample the CPU too tip-bot for Ingo Molnar
                                 ` (389 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-02 13:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  65014ab36196f6d86edc9ee23759d6930b9d89a8
Gitweb:     http://git.kernel.org/tip/65014ab36196f6d86edc9ee23759d6930b9d89a8
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 2 Sep 2009 14:55:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 14:56:33 +0200

perf tools: Work around strict aliasing related warnings

Older versions of GCC are rather stupid about strict aliasing:

  util/trace-event-parse.c: In function 'parse_cmdlines':
  util/trace-event-parse.c:93: warning: dereferencing type-punned pointer will break strict-aliasing rules
  util/trace-event-parse.c: In function 'parse_proc_kallsyms':
  util/trace-event-parse.c:155: warning: dereferencing type-punned pointer will break strict-aliasing rules
  util/trace-event-parse.c:157: warning: dereferencing type-punned pointer will break strict-aliasing rules
  util/trace-event-parse.c:158: warning: dereferencing type-punned pointer will break strict-aliasing rules
  util/trace-event-parse.c: In function 'parse_ftrace_printk':
  util/trace-event-parse.c:294: warning: dereferencing type-punned pointer will break strict-aliasing rules
  util/trace-event-parse.c:295: warning: dereferencing type-punned pointer will break strict-aliasing rules
  make: *** [util/trace-event-parse.o] Error 1

Make it clear to GCC that we intend with those pointers, by passing
them through via an explicit (void *) cast.

We might want to add -fno-strict-aliasing as well, like the kernel
itself does.

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/util/trace-event-info.c  |    2 +-
 tools/perf/util/trace-event-parse.c |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 8161527..6c9302a 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -188,7 +188,7 @@ int bigendian(void)
 	unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0};
 	unsigned int *ptr;
 
-	ptr = (unsigned int *)str;
+	ptr = (unsigned int *)(void *)str;
 	return *ptr == 0x01020304;
 }
 
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 665dac2..37b10c2 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -90,7 +90,7 @@ void parse_cmdlines(char *file, int size __unused)
 	while (line) {
 		item = malloc_or_die(sizeof(*item));
 		sscanf(line, "%d %as", &item->pid,
-		       (float *)&item->comm); /* workaround gcc warning */
+		       (float *)(void *)&item->comm); /* workaround gcc warning */
 		item->next = list;
 		list = item;
 		line = strtok_r(NULL, "\n", &next);
@@ -152,10 +152,10 @@ void parse_proc_kallsyms(char *file, unsigned int size __unused)
 		item = malloc_or_die(sizeof(*item));
 		item->mod = NULL;
 		ret = sscanf(line, "%as %c %as\t[%as",
-			     (float *)&addr_str, /* workaround gcc warning */
+			     (float *)(void *)&addr_str, /* workaround gcc warning */
 			     &ch,
-			     (float *)&item->func,
-			     (float *)&item->mod);
+			     (float *)(void *)&item->func,
+			     (float *)(void *)&item->mod);
 		item->addr = strtoull(addr_str, NULL, 16);
 		free(addr_str);
 
@@ -291,8 +291,8 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
 	while (line) {
 		item = malloc_or_die(sizeof(*item));
 		ret = sscanf(line, "%as : %as",
-			     (float *)&addr_str, /* workaround gcc warning */
-			     (float *)&item->printk);
+			     (float *)(void *)&addr_str, /* workaround gcc warning */
+			     (float *)(void *)&item->printk);
 		item->addr = strtoull(addr_str, NULL, 16);
 		free(addr_str);
 

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

* [tip:perfcounters/core] perf trace: Sample the CPU too
       [not found]             ` <new-submission>
                                 ` (316 preceding siblings ...)
  2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Work around strict aliasing related warnings tip-bot for Ingo Molnar
@ 2009-09-02 19:31               ` tip-bot for Ingo Molnar
  2009-09-02 21:44                 ` Frederic Weisbecker
  2009-09-02 19:51               ` [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access tip-bot for Ingo Molnar
                                 ` (388 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-02 19:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, lizf, a.p.zijlstra,
	efault, fweisbec, tglx, mingo

Commit-ID:  cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
Gitweb:     http://git.kernel.org/tip/cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 2 Sep 2009 20:20:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 21:28:50 +0200

perf trace: Sample the CPU too

Sample, record, parse and print the CPU field - it had all zeroes before.

Before (watch the second column, the CPU values):

            perf-32685 [000]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
            perf-32685 [000]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
            perf-32685 [000]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
            true-32686 [000]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
            true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
            true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
            perf-32685 [000]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
            true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
            true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
            true-32686 [000]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
            true-32686 [000]     0.000000: sched_process_exit: task true:32686 [120]
            true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
            true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
            true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
            true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]

After:

            perf-32685 [001]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
            perf-32685 [001]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
            perf-32685 [001]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
            true-32686 [011]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
            true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
            true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
            perf-32685 [001]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
            true-32686 [011]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
            true-32686 [015]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
            true-32686 [015]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
            true-32686 [015]     0.000000: sched_process_exit: task true:32686 [120]
            true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
            true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
            true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
            true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]

So we can now see how this workload migrated between CPUs.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
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>


---
 tools/perf/builtin-record.c |    4 +++-
 tools/perf/builtin-trace.c  |    9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index add514d..ff93f8e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -403,8 +403,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	if (call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
-	if (raw_samples)
+	if (raw_samples) {
 		attr->sample_type	|= PERF_SAMPLE_RAW;
+		attr->sample_type	|= PERF_SAMPLE_CPU;
+	}
 
 	attr->mmap		= track;
 	attr->comm		= track;
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 8247fd0..bbe4c44 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -58,12 +58,19 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 	struct dso *dso = NULL;
 	struct thread *thread;
 	u64 ip = event->ip.ip;
+	u32 cpu = -1;
 	u64 period = 1;
 	void *more_data = event->ip.__more_data;
 	int cpumode;
 
 	thread = threads__findnew(event->ip.pid, &threads, &last_match);
 
+	if (sample_type & PERF_SAMPLE_CPU) {
+		cpu = *(u32 *)more_data;
+		more_data += sizeof(u32);
+		more_data += sizeof(u32); /* reserved */
+	}
+
 	if (sample_type & PERF_SAMPLE_PERIOD) {
 		period = *(u64 *)more_data;
 		more_data += sizeof(u64);
@@ -120,7 +127,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		 * field, although it should be the same than this perf
 		 * event pid
 		 */
-		print_event(0, raw->data, raw->size, 0, thread->comm);
+		print_event(cpu, raw->data, raw->size, 0, thread->comm);
 	}
 	total += period;
 

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

* [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
       [not found]             ` <new-submission>
                                 ` (317 preceding siblings ...)
  2009-09-02 19:31               ` [tip:perfcounters/core] perf trace: Sample the CPU too tip-bot for Ingo Molnar
@ 2009-09-02 19:51               ` tip-bot for Ingo Molnar
  2009-09-03  1:11                 ` Li Zefan
  2009-09-03  6:46               ` tip-bot for Ingo Molnar
                                 ` (387 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-02 19:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  5380c1056d267eff49854c1fa03399bfe761da1e
Gitweb:     http://git.kernel.org/tip/5380c1056d267eff49854c1fa03399bfe761da1e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 2 Sep 2009 21:46:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 21:47:06 +0200

perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access

I want to sample inherited tracepoint workloads as a normal
user and the CAP_SYS_ADMIN check prevents me from doing that
right 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>


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

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d988dfb..53ca946 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -46,12 +46,18 @@ static atomic_t nr_task_counters __read_mostly;
 
 /*
  * perf counter paranoia level:
- *  0 - not paranoid
- *  1 - disallow cpu counters to unpriv
- *  2 - disallow kernel profiling to unpriv
+ *  -1 - not paranoid at all
+ *   0 - disallow raw tracepoint access for unpriv
+ *   1 - disallow cpu counters for unpriv
+ *   2 - disallow kernel profiling for unpriv
  */
 int sysctl_perf_counter_paranoid __read_mostly = 1;
 
+static inline bool perf_paranoid_tracepoint_raw(void)
+{
+	return sysctl_perf_counter_paranoid > -1;
+}
+
 static inline bool perf_paranoid_cpu(void)
 {
 	return sysctl_perf_counter_paranoid > 0;
@@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 	 * have these.
 	 */
 	if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
+			&& perf_paranoid_tracepoint_raw() &&
 			!capable(CAP_SYS_ADMIN))
 		return ERR_PTR(-EPERM);
 

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

* Re: [tip:perfcounters/core] perf trace: Sample the CPU too
  2009-09-02 19:31               ` [tip:perfcounters/core] perf trace: Sample the CPU too tip-bot for Ingo Molnar
@ 2009-09-02 21:44                 ` Frederic Weisbecker
  2009-09-02 21:54                   ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-09-02 21:44 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, lizf,
	efault, tglx, mingo
  Cc: linux-tip-commits

On Wed, Sep 02, 2009 at 07:31:51PM +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> Gitweb:     http://git.kernel.org/tip/cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Wed, 2 Sep 2009 20:20:38 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 2 Sep 2009 21:28:50 +0200
> 
> perf trace: Sample the CPU too
> 
> Sample, record, parse and print the CPU field - it had all zeroes before.
> 
> Before (watch the second column, the CPU values):
> 
>             perf-32685 [000]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
>             perf-32685 [000]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
>             perf-32685 [000]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
>             true-32686 [000]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
>             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
>             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
>             perf-32685 [000]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
>             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
>             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
>             true-32686 [000]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
>             true-32686 [000]     0.000000: sched_process_exit: task true:32686 [120]
>             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
>             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
>             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
>             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> 
> After:
> 
>             perf-32685 [001]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
>             perf-32685 [001]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
>             perf-32685 [001]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
>             true-32686 [011]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
>             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
>             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
>             perf-32685 [001]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
>             true-32686 [011]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
>             true-32686 [015]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
>             true-32686 [015]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
>             true-32686 [015]     0.000000: sched_process_exit: task true:32686 [120]
>             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
>             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
>             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
>             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> 
> So we can now see how this workload migrated between CPUs.
> 
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Li Zefan <lizf@cn.fujitsu.com>
> 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>
> 
> 
> ---
>  tools/perf/builtin-record.c |    4 +++-
>  tools/perf/builtin-trace.c  |    9 ++++++++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index add514d..ff93f8e 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -403,8 +403,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
>  	if (call_graph)
>  		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
>  
> -	if (raw_samples)
> +	if (raw_samples) {
>  		attr->sample_type	|= PERF_SAMPLE_RAW;
> +		attr->sample_type	|= PERF_SAMPLE_CPU;
> +	}
>  
>  	attr->mmap		= track;
>  	attr->comm		= track;
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 8247fd0..bbe4c44 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -58,12 +58,19 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
>  	struct dso *dso = NULL;
>  	struct thread *thread;
>  	u64 ip = event->ip.ip;
> +	u32 cpu = -1;
>  	u64 period = 1;
>  	void *more_data = event->ip.__more_data;
>  	int cpumode;
>  
>  	thread = threads__findnew(event->ip.pid, &threads, &last_match);
>  
> +	if (sample_type & PERF_SAMPLE_CPU) {
> +		cpu = *(u32 *)more_data;
> +		more_data += sizeof(u32);
> +		more_data += sizeof(u32); /* reserved */
> +	}
> +


Cool, I've searched an easy way to have the cpu and I wasn't even aware of
this type of event :-)


What about the timestamp now? I guess a specific field should be filled
for tracepoint raw samples.
Or may be for every raw samples?



>  	if (sample_type & PERF_SAMPLE_PERIOD) {
>  		period = *(u64 *)more_data;
>  		more_data += sizeof(u64);
> @@ -120,7 +127,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
>  		 * field, although it should be the same than this perf
>  		 * event pid
>  		 */
> -		print_event(0, raw->data, raw->size, 0, thread->comm);
> +		print_event(cpu, raw->data, raw->size, 0, thread->comm);
>  	}
>  	total += period;
>  


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

* Re: [tip:perfcounters/core] perf trace: Sample the CPU too
  2009-09-02 21:44                 ` Frederic Weisbecker
@ 2009-09-02 21:54                   ` Ingo Molnar
  2009-09-03  1:52                     ` Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-02 21:54 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, lizf,
	efault, tglx, linux-tip-commits


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Wed, Sep 02, 2009 at 07:31:51PM +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> > Gitweb:     http://git.kernel.org/tip/cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Wed, 2 Sep 2009 20:20:38 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Wed, 2 Sep 2009 21:28:50 +0200
> > 
> > perf trace: Sample the CPU too
> > 
> > Sample, record, parse and print the CPU field - it had all zeroes before.
> > 
> > Before (watch the second column, the CPU values):
> > 
> >             perf-32685 [000]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
> >             perf-32685 [000]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
> >             perf-32685 [000]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
> >             true-32686 [000]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
> >             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> >             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> >             perf-32685 [000]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
> >             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
> >             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
> >             true-32686 [000]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
> >             true-32686 [000]     0.000000: sched_process_exit: task true:32686 [120]
> >             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
> >             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
> >             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
> >             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> > 
> > After:
> > 
> >             perf-32685 [001]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
> >             perf-32685 [001]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
> >             perf-32685 [001]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
> >             true-32686 [011]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
> >             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> >             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> >             perf-32685 [001]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
> >             true-32686 [011]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
> >             true-32686 [015]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
> >             true-32686 [015]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
> >             true-32686 [015]     0.000000: sched_process_exit: task true:32686 [120]
> >             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
> >             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
> >             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
> >             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> > 
> > So we can now see how this workload migrated between CPUs.
> > 
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Li Zefan <lizf@cn.fujitsu.com>
> > 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>
> > 
> > 
> > ---
> >  tools/perf/builtin-record.c |    4 +++-
> >  tools/perf/builtin-trace.c  |    9 ++++++++-
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > index add514d..ff93f8e 100644
> > --- a/tools/perf/builtin-record.c
> > +++ b/tools/perf/builtin-record.c
> > @@ -403,8 +403,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
> >  	if (call_graph)
> >  		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
> >  
> > -	if (raw_samples)
> > +	if (raw_samples) {
> >  		attr->sample_type	|= PERF_SAMPLE_RAW;
> > +		attr->sample_type	|= PERF_SAMPLE_CPU;
> > +	}
> >  
> >  	attr->mmap		= track;
> >  	attr->comm		= track;
> > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > index 8247fd0..bbe4c44 100644
> > --- a/tools/perf/builtin-trace.c
> > +++ b/tools/perf/builtin-trace.c
> > @@ -58,12 +58,19 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
> >  	struct dso *dso = NULL;
> >  	struct thread *thread;
> >  	u64 ip = event->ip.ip;
> > +	u32 cpu = -1;
> >  	u64 period = 1;
> >  	void *more_data = event->ip.__more_data;
> >  	int cpumode;
> >  
> >  	thread = threads__findnew(event->ip.pid, &threads, &last_match);
> >  
> > +	if (sample_type & PERF_SAMPLE_CPU) {
> > +		cpu = *(u32 *)more_data;
> > +		more_data += sizeof(u32);
> > +		more_data += sizeof(u32); /* reserved */
> > +	}
> > +
> 
> 
> Cool, I've searched an easy way to have the cpu and I wasn't even 
> aware of this type of event :-)
> 
> 
> What about the timestamp now? I guess a specific field should be 
> filled for tracepoint raw samples. Or may be for every raw 
> samples?

how about:

         *      { u64                   time;     } && PERF_SAMPLE_TIME

?

Here's the full list of sample options btw:

	/*
	 * struct {
	 *	struct perf_event_header	header;
	 *
	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
	 *	{ u64			time;     } && PERF_SAMPLE_TIME
	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
	 *	{ u64			id;	  } && PERF_SAMPLE_ID
	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
	 * 	{ u64			period;   } && PERF_SAMPLE_PERIOD
	 *
	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
	 *
	 *	{ u64			nr,
	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
	 *

	Ingo

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

* Re: [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
  2009-09-02 19:51               ` [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access tip-bot for Ingo Molnar
@ 2009-09-03  1:11                 ` Li Zefan
  2009-09-03  6:47                   ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Li Zefan @ 2009-09-03  1:11 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, fweisbec, a.p.zijlstra,
	efault, tglx, mingo
  Cc: linux-tip-commits

>  static inline bool perf_paranoid_cpu(void)
>  {
>  	return sysctl_perf_counter_paranoid > 0;
> @@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
>  	 * have these.
>  	 */
>  	if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
> +			&& perf_paranoid_tracepoint_raw() &&

"&& &&"

This leads to build failure.

>  			!capable(CAP_SYS_ADMIN))
>  		return ERR_PTR(-EPERM);
>  

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

* Re: [tip:perfcounters/core] perf trace: Sample the CPU too
  2009-09-02 21:54                   ` Ingo Molnar
@ 2009-09-03  1:52                     ` Frederic Weisbecker
  0 siblings, 0 replies; 1150+ messages in thread
From: Frederic Weisbecker @ 2009-09-03  1:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, lizf,
	efault, tglx, linux-tip-commits

On Wed, Sep 02, 2009 at 11:54:56PM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > On Wed, Sep 02, 2009 at 07:31:51PM +0000, tip-bot for Ingo Molnar wrote:
> > > Commit-ID:  cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> > > Gitweb:     http://git.kernel.org/tip/cd6feeeafddbef6abfe4d90fb26e42fd844d34ed
> > > Author:     Ingo Molnar <mingo@elte.hu>
> > > AuthorDate: Wed, 2 Sep 2009 20:20:38 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Wed, 2 Sep 2009 21:28:50 +0200
> > > 
> > > perf trace: Sample the CPU too
> > > 
> > > Sample, record, parse and print the CPU field - it had all zeroes before.
> > > 
> > > Before (watch the second column, the CPU values):
> > > 
> > >             perf-32685 [000]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
> > >             perf-32685 [000]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
> > >             perf-32685 [000]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
> > >             true-32686 [000]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
> > >             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> > >             true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> > >             perf-32685 [000]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
> > >             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
> > >             true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
> > >             true-32686 [000]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
> > >             true-32686 [000]     0.000000: sched_process_exit: task true:32686 [120]
> > >             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
> > >             true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
> > >             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
> > >             true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> > > 
> > > After:
> > > 
> > >             perf-32685 [001]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
> > >             perf-32685 [001]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
> > >             perf-32685 [001]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
> > >             true-32686 [011]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
> > >             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> > >             true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
> > >             perf-32685 [001]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
> > >             true-32686 [011]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
> > >             true-32686 [015]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
> > >             true-32686 [015]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
> > >             true-32686 [015]     0.000000: sched_process_exit: task true:32686 [120]
> > >             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
> > >             true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
> > >             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
> > >             true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
> > > 
> > > So we can now see how this workload migrated between CPUs.
> > > 
> > > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > Cc: Paul Mackerras <paulus@samba.org>
> > > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > > Cc: Li Zefan <lizf@cn.fujitsu.com>
> > > 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>
> > > 
> > > 
> > > ---
> > >  tools/perf/builtin-record.c |    4 +++-
> > >  tools/perf/builtin-trace.c  |    9 ++++++++-
> > >  2 files changed, 11 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > > index add514d..ff93f8e 100644
> > > --- a/tools/perf/builtin-record.c
> > > +++ b/tools/perf/builtin-record.c
> > > @@ -403,8 +403,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
> > >  	if (call_graph)
> > >  		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
> > >  
> > > -	if (raw_samples)
> > > +	if (raw_samples) {
> > >  		attr->sample_type	|= PERF_SAMPLE_RAW;
> > > +		attr->sample_type	|= PERF_SAMPLE_CPU;
> > > +	}
> > >  
> > >  	attr->mmap		= track;
> > >  	attr->comm		= track;
> > > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > > index 8247fd0..bbe4c44 100644
> > > --- a/tools/perf/builtin-trace.c
> > > +++ b/tools/perf/builtin-trace.c
> > > @@ -58,12 +58,19 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
> > >  	struct dso *dso = NULL;
> > >  	struct thread *thread;
> > >  	u64 ip = event->ip.ip;
> > > +	u32 cpu = -1;
> > >  	u64 period = 1;
> > >  	void *more_data = event->ip.__more_data;
> > >  	int cpumode;
> > >  
> > >  	thread = threads__findnew(event->ip.pid, &threads, &last_match);
> > >  
> > > +	if (sample_type & PERF_SAMPLE_CPU) {
> > > +		cpu = *(u32 *)more_data;
> > > +		more_data += sizeof(u32);
> > > +		more_data += sizeof(u32); /* reserved */
> > > +	}
> > > +
> > 
> > 
> > Cool, I've searched an easy way to have the cpu and I wasn't even 
> > aware of this type of event :-)
> > 
> > 
> > What about the timestamp now? I guess a specific field should be 
> > filled for tracepoint raw samples. Or may be for every raw 
> > samples?
> 
> how about:
> 
>          *      { u64                   time;     } && PERF_SAMPLE_TIME
> 
> ?
> 
> Here's the full list of sample options btw:
> 
> 	/*
> 	 * struct {
> 	 *	struct perf_event_header	header;
> 	 *
> 	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
> 	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
> 	 *	{ u64			time;     } && PERF_SAMPLE_TIME
> 	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
> 	 *	{ u64			id;	  } && PERF_SAMPLE_ID
> 	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
> 	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
> 	 * 	{ u64			period;   } && PERF_SAMPLE_PERIOD
> 	 *
> 	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
> 	 *
> 	 *	{ u64			nr,
> 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
> 	 *
> 
> 	Ingo


Looks pretty good!

I'll implement that, thanks.


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

* [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
       [not found]             ` <new-submission>
                                 ` (318 preceding siblings ...)
  2009-09-02 19:51               ` [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access tip-bot for Ingo Molnar
@ 2009-09-03  6:46               ` tip-bot for Ingo Molnar
  2009-09-03 11:09               ` [tip:perfcounters/core] perf trace: Sample timestamps as well tip-bot for Ingo Molnar
                                 ` (386 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03  6:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  0fbdea19e9394a5cb5f2f5081b028c50b558910a
Gitweb:     http://git.kernel.org/tip/0fbdea19e9394a5cb5f2f5081b028c50b558910a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 2 Sep 2009 21:46:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Sep 2009 21:53:02 +0200

perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access

I want to sample inherited tracepoint workloads as a normal
user and the CAP_SYS_ADMIN check prevents me from doing that
right 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>


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

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d988dfb..0aa609f 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -46,12 +46,18 @@ static atomic_t nr_task_counters __read_mostly;
 
 /*
  * perf counter paranoia level:
- *  0 - not paranoid
- *  1 - disallow cpu counters to unpriv
- *  2 - disallow kernel profiling to unpriv
+ *  -1 - not paranoid at all
+ *   0 - disallow raw tracepoint access for unpriv
+ *   1 - disallow cpu counters for unpriv
+ *   2 - disallow kernel profiling for unpriv
  */
 int sysctl_perf_counter_paranoid __read_mostly = 1;
 
+static inline bool perf_paranoid_tracepoint_raw(void)
+{
+	return sysctl_perf_counter_paranoid > -1;
+}
+
 static inline bool perf_paranoid_cpu(void)
 {
 	return sysctl_perf_counter_paranoid > 0;
@@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
 	 * have these.
 	 */
 	if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
+			perf_paranoid_tracepoint_raw() &&
 			!capable(CAP_SYS_ADMIN))
 		return ERR_PTR(-EPERM);
 

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

* Re: [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
  2009-09-03  1:11                 ` Li Zefan
@ 2009-09-03  6:47                   ` Ingo Molnar
  0 siblings, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-03  6:47 UTC (permalink / raw)
  To: Li Zefan
  Cc: mingo, hpa, paulus, acme, linux-kernel, fweisbec, a.p.zijlstra,
	efault, tglx, linux-tip-commits


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> >  static inline bool perf_paranoid_cpu(void)
> >  {
> >  	return sysctl_perf_counter_paranoid > 0;
> > @@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
> >  	 * have these.
> >  	 */
> >  	if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
> > +			&& perf_paranoid_tracepoint_raw() &&
> 
> "&& &&"
> 
> This leads to build failure.

Yeah - fixed that yesterday, forgot to push out :-/

	Ingo

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

* [tip:perfcounters/core] perf trace: Sample timestamps as well
       [not found]             ` <new-submission>
                                 ` (319 preceding siblings ...)
  2009-09-03  6:46               ` tip-bot for Ingo Molnar
@ 2009-09-03 11:09               ` tip-bot for Ingo Molnar
  2009-09-03 13:48               ` tip-bot for Ingo Molnar
                                 ` (385 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 11:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  b7bca89827d0601c4ad3acbeeac43c0c8e6ceb67
Gitweb:     http://git.kernel.org/tip/b7bca89827d0601c4ad3acbeeac43c0c8e6ceb67
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 12:00:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 13:05:41 +0200

perf trace: Sample timestamps as well

Before:

            perf-21082 [013]     0.000000: sched_wakeup_new: task perf:21083 [120] success=1 [015]
            perf-21082 [013]     0.000000: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
            perf-21082 [013]     0.000000: sched_process_fork: parent perf:21082  child perf:21083
            true-21083 [015]     0.000000: sched_wakeup: task migration/15:33 [0] success=1 [015]
            perf-21082 [013]     0.000000: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
            true-21083 [015]     0.000000: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
            true-21083 [011]     0.000000: sched_process_exit: task true:21083 [120]

After:

            perf-21082 [013] 14674.797613: sched_wakeup_new: task perf:21083 [120] success=1 [015]
            perf-21082 [013] 14674.797506: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
            perf-21082 [013] 14674.797610: sched_process_fork: parent perf:21082  child perf:21083
            true-21083 [015] 14674.797725: sched_wakeup: task migration/15:33 [0] success=1 [015]
            perf-21082 [013] 14674.797722: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
            true-21083 [015] 14674.797729: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
            true-21083 [011] 14674.798159: sched_process_exit: task true:21083 [120]

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/builtin-record.c |    1 +
 tools/perf/builtin-trace.c  |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ff93f8e..99a12fe 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -404,6 +404,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
 	if (raw_samples) {
+		attr->sample_type	|= PERF_SAMPLE_TIME;
 		attr->sample_type	|= PERF_SAMPLE_RAW;
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 	}
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index bbe4c44..c56da6b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -58,6 +58,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 	struct dso *dso = NULL;
 	struct thread *thread;
 	u64 ip = event->ip.ip;
+	u64 timestamp;
 	u32 cpu = -1;
 	u64 period = 1;
 	void *more_data = event->ip.__more_data;
@@ -65,6 +66,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 
 	thread = threads__findnew(event->ip.pid, &threads, &last_match);
 
+	if (sample_type & PERF_SAMPLE_TIME) {
+		timestamp = *(u64 *)more_data;
+		more_data += sizeof(u64);
+	}
+
 	if (sample_type & PERF_SAMPLE_CPU) {
 		cpu = *(u32 *)more_data;
 		more_data += sizeof(u32);
@@ -127,7 +133,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		 * field, although it should be the same than this perf
 		 * event pid
 		 */
-		print_event(cpu, raw->data, raw->size, 0, thread->comm);
+		print_event(cpu, raw->data, raw->size, timestamp, thread->comm);
 	}
 	total += period;
 

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

* [tip:perfcounters/core] perf trace: Sample timestamps as well
       [not found]             ` <new-submission>
                                 ` (320 preceding siblings ...)
  2009-09-03 11:09               ` [tip:perfcounters/core] perf trace: Sample timestamps as well tip-bot for Ingo Molnar
@ 2009-09-03 13:48               ` tip-bot for Ingo Molnar
  2009-09-03 14:27               ` [tip:perfcounters/core] perf trace: Fix parsing of perf.data tip-bot for Ingo Molnar
                                 ` (384 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 13:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  6ddf259da76cab6555c2086386f8bcd10bbb86d2
Gitweb:     http://git.kernel.org/tip/6ddf259da76cab6555c2086386f8bcd10bbb86d2
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 12:00:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 15:45:49 +0200

perf trace: Sample timestamps as well

Before:

            perf-21082 [013]     0.000000: sched_wakeup_new: task perf:21083 [120] success=1 [015]
            perf-21082 [013]     0.000000: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
            perf-21082 [013]     0.000000: sched_process_fork: parent perf:21082  child perf:21083
            true-21083 [015]     0.000000: sched_wakeup: task migration/15:33 [0] success=1 [015]
            perf-21082 [013]     0.000000: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
            true-21083 [015]     0.000000: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
            true-21083 [011]     0.000000: sched_process_exit: task true:21083 [120]

After:

            perf-21082 [013] 14674.797613: sched_wakeup_new: task perf:21083 [120] success=1 [015]
            perf-21082 [013] 14674.797506: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
            perf-21082 [013] 14674.797610: sched_process_fork: parent perf:21082  child perf:21083
            true-21083 [015] 14674.797725: sched_wakeup: task migration/15:33 [0] success=1 [015]
            perf-21082 [013] 14674.797722: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
            true-21083 [015] 14674.797729: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
            true-21083 [011] 14674.798159: sched_process_exit: task true:21083 [120]

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/builtin-record.c |    1 +
 tools/perf/builtin-trace.c  |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ff93f8e..99a12fe 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -404,6 +404,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
 	if (raw_samples) {
+		attr->sample_type	|= PERF_SAMPLE_TIME;
 		attr->sample_type	|= PERF_SAMPLE_RAW;
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 	}
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index bbe4c44..d59bf8a 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -58,6 +58,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 	struct dso *dso = NULL;
 	struct thread *thread;
 	u64 ip = event->ip.ip;
+	u64 timestamp = -1;
 	u32 cpu = -1;
 	u64 period = 1;
 	void *more_data = event->ip.__more_data;
@@ -65,6 +66,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 
 	thread = threads__findnew(event->ip.pid, &threads, &last_match);
 
+	if (sample_type & PERF_SAMPLE_TIME) {
+		timestamp = *(u64 *)more_data;
+		more_data += sizeof(u64);
+	}
+
 	if (sample_type & PERF_SAMPLE_CPU) {
 		cpu = *(u32 *)more_data;
 		more_data += sizeof(u32);
@@ -127,7 +133,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		 * field, although it should be the same than this perf
 		 * event pid
 		 */
-		print_event(cpu, raw->data, raw->size, 0, thread->comm);
+		print_event(cpu, raw->data, raw->size, timestamp, thread->comm);
 	}
 	total += period;
 

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

* [tip:perfcounters/core] perf trace: Fix parsing of perf.data
       [not found]             ` <new-submission>
                                 ` (321 preceding siblings ...)
  2009-09-03 13:48               ` tip-bot for Ingo Molnar
@ 2009-09-03 14:27               ` tip-bot for Ingo Molnar
  2009-09-03 14:27               ` [tip:perfcounters/core] perf tools: Seek to the end of the header area tip-bot for Ingo Molnar
                                 ` (383 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 14:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  8886f42d6d8dabeb488c706c339634a0e3e08df4
Gitweb:     http://git.kernel.org/tip/8886f42d6d8dabeb488c706c339634a0e3e08df4
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 16:19:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 16:19:57 +0200

perf trace: Fix parsing of perf.data

We started parsing perf.data at head 0. This caused -D to
segfault and it could possibly also case incorrect trace
entries to be displayed.

Parse it at data_offset instead.

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/builtin-trace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d59bf8a..914ab36 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -196,6 +196,7 @@ static int __cmd_trace(void)
 		exit(0);
 	}
 	header = perf_header__read(input);
+	head = header->data_offset;
 	sample_type = perf_header__sample_type(header);
 
 	if (!(sample_type & PERF_SAMPLE_RAW))

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

* [tip:perfcounters/core] perf tools: Seek to the end of the header area
       [not found]             ` <new-submission>
                                 ` (322 preceding siblings ...)
  2009-09-03 14:27               ` [tip:perfcounters/core] perf trace: Fix parsing of perf.data tip-bot for Ingo Molnar
@ 2009-09-03 14:27               ` tip-bot for Ingo Molnar
  2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Print out in nanoseconds tip-bot for Ingo Molnar
                                 ` (382 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 14:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  2e01d1791168bb824226d8cc70e50374767dcc42
Gitweb:     http://git.kernel.org/tip/2e01d1791168bb824226d8cc70e50374767dcc42
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 16:21:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 16:21:11 +0200

perf tools: Seek to the end of the header area

Leave the input fd at the data area.

It does not matter right now - but seeking at the end of it
certainly did not make 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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/util/header.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a37a222..ec4d4c2 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -237,7 +237,7 @@ struct perf_header *perf_header__read(int fd)
 	self->data_offset = f_header.data.offset;
 	self->data_size   = f_header.data.size;
 
-	lseek(fd, self->data_offset + self->data_size, SEEK_SET);
+	lseek(fd, self->data_offset, SEEK_SET);
 
 	self->frozen = 1;
 

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

* [tip:perfcounters/core] perf trace: Print out in nanoseconds
       [not found]             ` <new-submission>
                                 ` (323 preceding siblings ...)
  2009-09-03 14:27               ` [tip:perfcounters/core] perf tools: Seek to the end of the header area tip-bot for Ingo Molnar
@ 2009-09-03 14:28               ` tip-bot for Ingo Molnar
  2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Fix read_string() tip-bot for Ingo Molnar
                                 ` (381 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 14:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  00fc97863c21c41e257a941e83410c56341e2a5d
Gitweb:     http://git.kernel.org/tip/00fc97863c21c41e257a941e83410c56341e2a5d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 16:22:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 16:22:02 +0200

perf trace: Print out in nanoseconds

Print out more accurate timestamps - usecs does not cut it
anymore on fast enough boxes ;-)

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/util/trace-event-parse.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 37b10c2..629e602 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -2708,9 +2708,9 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs,
 		return pretty_print_func_graph(data, size, event, cpu,
 					       pid, comm, secs, usecs);
 
-	printf("%16s-%-5d [%03d] %5lu.%06lu: %s: ",
+	printf("%16s-%-5d [%03d] %5lu.%09Lu: %s: ",
 	       comm, pid,  cpu,
-	       secs, usecs, event->name);
+	       secs, nsecs, event->name);
 
 	pretty_print(data, size, event);
 	printf("\n");

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

* [tip:perfcounters/core] perf trace: Fix read_string()
       [not found]             ` <new-submission>
                                 ` (324 preceding siblings ...)
  2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Print out in nanoseconds tip-bot for Ingo Molnar
@ 2009-09-03 14:28               ` tip-bot for Ingo Molnar
  2009-09-03 16:55               ` [tip:perfcounters/core] perf_counter: Fix output-sharing error path tip-bot for Ingo Molnar
                                 ` (380 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 14:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  6f4596d9312ba5fbf5f3231ef484823c4e684d2e
Gitweb:     http://git.kernel.org/tip/6f4596d9312ba5fbf5f3231ef484823c4e684d2e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 16:22:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 16:22:45 +0200

perf trace: Fix read_string()

We did not account for the enclosing \0. Depending on what malloc()
gave us this resulted in corrupted version string printouts.

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/util/trace-event-read.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index b12e490..a1217a1 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -113,8 +113,11 @@ static char *read_string(void)
 		}
 	}
 
+	/* trailing \0: */
+	i++;
+
 	/* move the file descriptor to the end of the string */
-	r = lseek(input_fd, -(r - (i+1)), SEEK_CUR);
+	r = lseek(input_fd, -(r - i), SEEK_CUR);
 	if (r < 0)
 		die("lseek");
 

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

* [tip:perfcounters/core] perf_counter: Fix output-sharing error path
       [not found]             ` <new-submission>
                                 ` (325 preceding siblings ...)
  2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Fix read_string() tip-bot for Ingo Molnar
@ 2009-09-03 16:55               ` tip-bot for Ingo Molnar
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Clean up topology.h tip-bot for Ingo Molnar
                                 ` (379 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-03 16:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  dc86cabe4b242446ea9aa8492c727e1220817898
Gitweb:     http://git.kernel.org/tip/dc86cabe4b242446ea9aa8492c727e1220817898
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 3 Sep 2009 18:03:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 3 Sep 2009 18:46:23 +0200

perf_counter: Fix output-sharing error path

We forget to release the fd in the PERF_FLAG_FD_OUTPUT
error path.

Reorganize the error flow here to be a clean fall-through
logic.

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>


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

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 0aa609f..e0d91fd 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -4316,15 +4316,15 @@ SYSCALL_DEFINE5(perf_counter_open,
 	struct file *group_file = NULL;
 	int fput_needed = 0;
 	int fput_needed2 = 0;
-	int ret;
+	int err;
 
 	/* for future expandability... */
 	if (flags & ~(PERF_FLAG_FD_NO_GROUP | PERF_FLAG_FD_OUTPUT))
 		return -EINVAL;
 
-	ret = perf_copy_attr(attr_uptr, &attr);
-	if (ret)
-		return ret;
+	err = perf_copy_attr(attr_uptr, &attr);
+	if (err)
+		return err;
 
 	if (!attr.exclude_kernel) {
 		if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
@@ -4348,7 +4348,7 @@ SYSCALL_DEFINE5(perf_counter_open,
 	 */
 	group_leader = NULL;
 	if (group_fd != -1 && !(flags & PERF_FLAG_FD_NO_GROUP)) {
-		ret = -EINVAL;
+		err = -EINVAL;
 		group_file = fget_light(group_fd, &fput_needed);
 		if (!group_file)
 			goto err_put_context;
@@ -4377,22 +4377,22 @@ SYSCALL_DEFINE5(perf_counter_open,
 
 	counter = perf_counter_alloc(&attr, cpu, ctx, group_leader,
 				     NULL, GFP_KERNEL);
-	ret = PTR_ERR(counter);
+	err = PTR_ERR(counter);
 	if (IS_ERR(counter))
 		goto err_put_context;
 
-	ret = anon_inode_getfd("[perf_counter]", &perf_fops, counter, 0);
-	if (ret < 0)
+	err = anon_inode_getfd("[perf_counter]", &perf_fops, counter, 0);
+	if (err < 0)
 		goto err_free_put_context;
 
-	counter_file = fget_light(ret, &fput_needed2);
+	counter_file = fget_light(err, &fput_needed2);
 	if (!counter_file)
 		goto err_free_put_context;
 
 	if (flags & PERF_FLAG_FD_OUTPUT) {
-		ret = perf_counter_set_output(counter, group_fd);
-		if (ret)
-			goto err_free_put_context;
+		err = perf_counter_set_output(counter, group_fd);
+		if (err)
+			goto err_fput_free_put_context;
 	}
 
 	counter->filp = counter_file;
@@ -4408,20 +4408,20 @@ SYSCALL_DEFINE5(perf_counter_open,
 	list_add_tail(&counter->owner_entry, &current->perf_counter_list);
 	mutex_unlock(&current->perf_counter_mutex);
 
+err_fput_free_put_context:
 	fput_light(counter_file, fput_needed2);
 
-out_fput:
-	fput_light(group_file, fput_needed);
-
-	return ret;
-
 err_free_put_context:
-	kfree(counter);
+	if (err < 0)
+		kfree(counter);
 
 err_put_context:
-	put_ctx(ctx);
+	if (err < 0)
+		put_ctx(ctx);
+
+	fput_light(group_file, fput_needed);
 
-	goto out_fput;
+	return err;
 }
 
 /*

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

* [boot crash] Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-08-31 15:59                   ` Thomas Gleixner
@ 2009-09-03 18:17                     ` Ingo Molnar
  2009-09-03 18:21                       ` Ingo Molnar
  2009-09-03 18:58                       ` Ingo Molnar
  0 siblings, 2 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-03 18:17 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Martin Schwidefsky, mingo, hpa, linux-kernel, johnstul,
	linux-tip-commits

[-- Attachment #1: Type: text/plain, Size: 5203 bytes --]


-tip testing found the following boot crash on a 64-bit x86 system:

[    0.405247] initcall spawn_softlockup_task+0x0/0xa5 returned 0 after 0 usecs
[    0.410004] calling  relay_init+0x0/0x40 @ 1
[    0.420005] initcall relay_init+0x0/0x40 returned 0 after 0 usecs
[    0.426355] lockdep: fixing up alternatives.
[    0.430110] Booting processor 1 APIC 0x1 ip 0x6000
[    0.030000] Initializing CPU#1
[    0.030000] masked ExtINT on CPU#1
[    0.520060] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[    0.530000] IP: [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000] PGD 0 
[    0.530000] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[    0.530000] last sysfs file: 
[    0.530000] CPU 0 
[    0.530000] Modules linked in:
[    0.530000] Pid: 1, comm: swapper Not tainted 2.6.31-rc8-tip #1613         
[    0.530000] RIP: 0010:[<ffffffff81071317>]  [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000] RSP: 0018:ffff880009007d40  EFLAGS: 00010246
[    0.530000] RAX: 0000000000000000 RBX: ffffffff81e1d0c0 RCX: 0000000000000000
[    0.530000] RDX: ffffffff824a1fa0 RSI: 0000000000000000 RDI: 0000000000000000
[    0.530000] RBP: ffff880009007d50 R08: 0000000000000000 R09: 0000000000000000
[    0.530000] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000025cb39a8
[    0.530000] R13: ffffffff824a0c40 R14: ffff880009007e50 R15: 0000000000000100
[    0.530000] FS:  0000000000000000(0000) GS:ffff880009004000(0000) knlGS:0000000000000000
[    0.530000] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    0.530000] CR2: 0000000000000020 CR3: 0000000001001000 CR4: 00000000000006b0
[    0.530000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    0.530000] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    0.530000] Process swapper (pid: 1, threadinfo ffff88003f0da000, task ffff88003f0e0000)
[    0.530000] Stack:
[    0.530000]  ffffffff824a0c40 00000000b4b7426a ffff880009007d70 ffffffff8107157d
[    0.530000] <0> ffffffff81083846 00000000b4b7426a ffff880009007d90 ffffffff810715c9
[    0.530000] <0> 0000000000000000 00000000b4b7426a ffff880009007dc0 ffffffff81083927
[    0.530000] Call Trace:
[    0.530000]  <IRQ> 
[    0.530000]  [<ffffffff8107157d>] queue_work+0x2d/0x50
[    0.530000]  [<ffffffff81083846>] ? clocksource_watchdog+0x26/0x240
[    0.530000]  [<ffffffff810715c9>] schedule_work+0x29/0x50
[    0.530000]  [<ffffffff81083927>] clocksource_watchdog+0x107/0x240
[    0.530000]  [<ffffffff81065eee>] run_timer_softirq+0x21e/0x380
[    0.530000]  [<ffffffff81065e29>] ? run_timer_softirq+0x159/0x380
[    0.530000]  [<ffffffff81083820>] ? clocksource_watchdog+0x0/0x240
[    0.530000]  [<ffffffff810600aa>] __do_softirq+0x10a/0x200
[    0.530000]  [<ffffffff8100cb1c>] call_softirq+0x1c/0x90
[    0.530000]  [<ffffffff8100e955>] do_softirq+0x95/0xc0
[    0.530000]  [<ffffffff8105f4c5>] irq_exit+0x75/0x90
[    0.530000]  [<ffffffff81029c20>] smp_apic_timer_interrupt+0x80/0xd0
[    0.530000]  [<ffffffff8100c4f3>] apic_timer_interrupt+0x13/0x20
[    0.530000]  <EOI> 
[    0.530000]  [<ffffffff812ff997>] ? delay_tsc+0x47/0x80
[    0.530000]  [<ffffffff812ffab4>] ? __const_udelay+0x64/0x80
[    0.530000]  [<ffffffff818b3fff>] ? do_boot_cpu+0x498/0x6b3
[    0.530000]  [<ffffffff818b4567>] ? do_fork_idle+0x0/0x56
[    0.530000]  [<ffffffff810468d2>] ? complete+0x32/0x80
[    0.530000]  [<ffffffff818b4375>] ? native_cpu_up+0x15b/0x208
[    0.530000]  [<ffffffff818b69d8>] ? _cpu_up+0xf3/0x1a4
[    0.530000]  [<ffffffff818b6b4d>] ? cpu_up+0xc4/0xd7
[    0.530000]  [<ffffffff821d3f97>] ? smp_init+0x118/0x126
[    0.530000]  [<ffffffff821d40c7>] ? kernel_init+0x82/0xec
[    0.530000]  [<ffffffff8100ca1a>] ? child_rip+0xa/0x20
[    0.530000]  [<ffffffff8100c3bc>] ? restore_args+0x0/0x30
[    0.530000]  [<ffffffff821d4045>] ? kernel_init+0x0/0xec
[    0.530000]  [<ffffffff8100ca10>] ? child_rip+0x0/0x20
[    0.530000] Code: ff 0f 1f 00 55 41 89 f8 48 89 e5 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 45 f8 31 c0 f0 0f ba 2a 00 19 c0 31 c9 85 c0 75 2a <44> 8b 4e 20 48 8b 3e 48 89 d6 45 85 c9 44 0f 45 05 b4 f4 f7 00 
[    0.530000] RIP  [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000]  RSP <ffff880009007d40>
[    0.530000] CR2: 0000000000000020
[    0.530006] ---[ end trace a7919e7f17c0a725 ]---
[    0.540001] Kernel panic - not syncing: Fatal exception in interrupt

Config and full bootlog attached.

Note, i have other systems that do not trigger this crash, so it's 
something specific to this one. It has an hpet for example:

[    0.000000] ACPI: HPET 000000003fef7e90 00038 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] hpet clockevent registered

i tried to bisect it but it's inconclusive:

 # bad:  [32beef9c] Merge branch 'perfcounters/core'
 # bad:  [b6413360] manual merge of x86/platform
 # bad:  [d9e5f39a] Merge branch 'auto-oprofile-next' into auto-latest
 # bad:  [cbaff272] Merge branch 'auto-timers-next' into auto-latest

as the bisection comes up with that merge commit. Perhaps the 
combination of the x86/platform changes and the clocksource changes 
triggered it?

	Ingo

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 59561 bytes --]

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-rc8
# Thu Sep  3 19:11:02 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_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_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=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 is not set
CONFIG_KERNEL_BZIP2=y
# CONFIG_KERNEL_LZMA is not set
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_AUDIT is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_TREE_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_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=21
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_GROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_USER_SCHED=y
# CONFIG_CGROUP_SCHED is not set
# CONFIG_CGROUPS is not set
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
# CONFIG_NAMESPACES is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
# CONFIG_RD_LZMA is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
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 is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
# CONFIG_BUG is not set
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
# CONFIG_BASE_FULL is not set
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
# CONFIG_TIMERFD is not set
# CONFIG_EVENTFD is not set
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_HAVE_PERF_COUNTERS=y

#
# Performance Counters
#
CONFIG_PERF_COUNTERS=y
# CONFIG_VM_EVENT_COUNTERS is not set
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 is not set
CONFIG_TRACEPOINTS=y
CONFIG_MARKERS=y
CONFIG_HAVE_OPROFILE=y
CONFIG_KPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_KRETPROBES=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=1
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS=y
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
# CONFIG_BLK_DEV_BSG is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
CONFIG_BLOCK_COMPAT=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=m
CONFIG_IOSCHED_DEADLINE=m
CONFIG_IOSCHED_CFQ=y
# 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 is not set
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_SMP=y
# CONFIG_SPARSE_IRQ is not set
CONFIG_X86_MPPARSE=y
# CONFIG_X86_EXTENDED_PLATFORM is not set
CONFIG_SCHED_OMIT_FRAME_POINTER=y
# CONFIG_PARAVIRT_GUEST is not set
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 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=y
# 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_MATOM is not set
# CONFIG_GENERIC_CPU is not set
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_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=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=y
# CONFIG_CPU_SUP_INTEL is not set
CONFIG_CPU_SUP_AMD=y
CONFIG_CPU_SUP_CENTAUR=y
# CONFIG_X86_DS is not set
CONFIG_HPET_TIMER=y
CONFIG_DMI=y
CONFIG_GART_IOMMU=y
CONFIG_CALGARY_IOMMU=y
# CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT is not set
CONFIG_AMD_IOMMU=y
CONFIG_AMD_IOMMU_STATS=y
CONFIG_SWIOTLB=y
CONFIG_IOMMU_HELPER=y
CONFIG_IOMMU_API=y
CONFIG_MAXSMP=y
CONFIG_NR_CPUS=4096
CONFIG_SCHED_SMT=y
# CONFIG_SCHED_MC is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# 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_MCE_THRESHOLD=y
CONFIG_X86_MCE_INJECT=m
CONFIG_X86_THERMAL_VECTOR=y
# CONFIG_I8K is not set
CONFIG_MICROCODE=m
CONFIG_MICROCODE_INTEL=y
CONFIG_MICROCODE_AMD=y
CONFIG_MICROCODE_OLD_INTERFACE=y
# CONFIG_X86_MSR is not set
CONFIG_X86_CPUID=m
# CONFIG_X86_CPU_DEBUG is not set
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_DIRECT_GBPAGES=y
# CONFIG_NUMA is not set
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_HAVE_MEMORY_PRESENT=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not set

#
# Memory hotplug is currently incompatible with Software Suspend
#
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
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=y
CONFIG_X86_RESERVE_LOW_64K=y
CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set
CONFIG_X86_PAT=y
CONFIG_ARCH_USES_PG_UNCACHED=y
# CONFIG_EFI is not set
CONFIG_SECCOMP=y
CONFIG_CC_STACKPROTECTOR_ALL=y
CONFIG_CC_STACKPROTECTOR=y
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y
# CONFIG_KEXEC is not set
# CONFIG_CRASH_DUMP is not set
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_PHYSICAL_ALIGN=0x1000000
CONFIG_HOTPLUG_CPU=y
CONFIG_COMPAT_VDSO=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y

#
# Power management and ACPI options
#
CONFIG_ARCH_HIBERNATION_HEADER=y
CONFIG_PM=y
# CONFIG_PM_DEBUG is not set
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_SLEEP=y
# CONFIG_SUSPEND is not set
CONFIG_HIBERNATION_NVS=y
CONFIG_HIBERNATION=y
CONFIG_PM_STD_PARTITION=""
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_PROCFS=y
CONFIG_ACPI_PROCFS_POWER=y
CONFIG_ACPI_SYSFS_POWER=y
# CONFIG_ACPI_PROC_EVENT is not set
# CONFIG_ACPI_AC is not set
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=m
CONFIG_ACPI_FAN=m
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_PROCESSOR=m
CONFIG_ACPI_HOTPLUG_CPU=y
# CONFIG_ACPI_THERMAL is not set
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
CONFIG_ACPI_DEBUG=y
CONFIG_ACPI_DEBUG_FUNC_TRACE=y
CONFIG_ACPI_PCI_SLOT=m
CONFIG_X86_PM_TIMER=y
CONFIG_ACPI_CONTAINER=y
CONFIG_ACPI_SBS=m

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=m
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=m
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

#
# CPUFreq processor drivers
#
CONFIG_X86_ACPI_CPUFREQ=m
CONFIG_X86_POWERNOW_K8=m
CONFIG_X86_SPEEDSTEP_CENTRINO=m
CONFIG_X86_P4_CLOCKMOD=y

#
# shared options
#
CONFIG_X86_SPEEDSTEP_LIB=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y

#
# Memory power savings
#
# CONFIG_I7300_IDLE is not set

#
# Bus options (PCI etc.)
#
CONFIG_PCI=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_DOMAINS=y
# CONFIG_DMAR is not set
# CONFIG_INTR_REMAP is not set
# CONFIG_PCIEPORTBUS is not set
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
CONFIG_PCI_LEGACY=y
# CONFIG_PCI_DEBUG is not set
CONFIG_PCI_STUB=y
CONFIG_HT_IRQ=y
CONFIG_PCI_IOV=y
CONFIG_ISA_DMA_API=y
CONFIG_K8_NB=y
CONFIG_PCCARD=y
CONFIG_PCMCIA_DEBUG=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
# CONFIG_PCMCIA_IOCTL is not set
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
# CONFIG_PD6729 is not set
CONFIG_I82092=y
CONFIG_PCCARD_NONSTATIC=y
CONFIG_HOTPLUG_PCI=m
# CONFIG_HOTPLUG_PCI_FAKE is not set
# CONFIG_HOTPLUG_PCI_ACPI is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
CONFIG_HOTPLUG_PCI_SHPC=m

#
# 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=m
CONFIG_IA32_EMULATION=y
CONFIG_IA32_AOUT=m
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=m
CONFIG_NET_KEY_MIGRATE=y
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
CONFIG_IP_ADVANCED_ROUTER=y
# CONFIG_ASK_IP_FIB_HASH is not set
CONFIG_IP_FIB_TRIE=y
# CONFIG_IP_FIB_HASH is not set
CONFIG_IP_FIB_TRIE_STATS=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
# CONFIG_IP_PNP_DHCP is not set
# CONFIG_IP_PNP_BOOTP is not set
CONFIG_IP_PNP_RARP=y
# CONFIG_NET_IPIP is not set
CONFIG_NET_IPGRE=y
# CONFIG_ARPD is not set
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=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
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 is not set
CONFIG_INET6_AH=m
# 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=y
# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
# CONFIG_INET6_XFRM_MODE_BEET is not set
CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=m
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=y
CONFIG_NETFILTER_DEBUG=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_BRIDGE_NETFILTER=y

#
# Core Netfilter Configuration
#
# CONFIG_NETFILTER_NETLINK_QUEUE is not set
# CONFIG_NETFILTER_NETLINK_LOG is not set
# CONFIG_NF_CONNTRACK is not set
CONFIG_NETFILTER_XTABLES=m
# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
CONFIG_NETFILTER_XT_TARGET_MARK=m
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
CONFIG_NETFILTER_XT_TARGET_RATEEST=m
# CONFIG_NETFILTER_XT_TARGET_SECMARK is not set
# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
CONFIG_NETFILTER_XT_MATCH_DCCP=m
CONFIG_NETFILTER_XT_MATCH_DSCP=m
# CONFIG_NETFILTER_XT_MATCH_ESP is not set
# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
CONFIG_NETFILTER_XT_MATCH_HL=m
CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
CONFIG_NETFILTER_XT_MATCH_LENGTH=m
# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_MAC is not set
CONFIG_NETFILTER_XT_MATCH_MARK=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
CONFIG_NETFILTER_XT_MATCH_OWNER=m
CONFIG_NETFILTER_XT_MATCH_POLICY=m
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
CONFIG_NETFILTER_XT_MATCH_QUOTA=m
CONFIG_NETFILTER_XT_MATCH_RATEEST=m
# CONFIG_NETFILTER_XT_MATCH_REALM is not set
# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
CONFIG_NETFILTER_XT_MATCH_SCTP=m
CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
CONFIG_NETFILTER_XT_MATCH_STRING=m
# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
CONFIG_NETFILTER_XT_MATCH_TIME=m
# CONFIG_NETFILTER_XT_MATCH_U32 is not set
CONFIG_IP_VS=y
# CONFIG_IP_VS_IPV6 is not set
# 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_AH_ESP=y
# CONFIG_IP_VS_PROTO_ESP is not set
CONFIG_IP_VS_PROTO_AH=y

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=m
# CONFIG_IP_VS_WRR is not set
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=m
# CONFIG_IP_VS_LBLC is not set
# CONFIG_IP_VS_LBLCR is not set
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
# CONFIG_IP_VS_SED is not set
CONFIG_IP_VS_NQ=y

#
# IPVS application helper
#
# CONFIG_IP_VS_FTP is not set

#
# IP: Netfilter Configuration
#
# CONFIG_NF_DEFRAG_IPV4 is not set
# CONFIG_IP_NF_QUEUE is not set
# CONFIG_IP_NF_IPTABLES is not set
# CONFIG_IP_NF_ARPTABLES is not set

#
# IPv6: Netfilter Configuration
#
# CONFIG_IP6_NF_QUEUE is not set
# CONFIG_IP6_NF_IPTABLES is not set
CONFIG_BRIDGE_NF_EBTABLES=m
CONFIG_BRIDGE_EBT_BROUTE=m
CONFIG_BRIDGE_EBT_T_FILTER=m
# CONFIG_BRIDGE_EBT_T_NAT is not set
CONFIG_BRIDGE_EBT_802_3=m
# CONFIG_BRIDGE_EBT_AMONG is not set
CONFIG_BRIDGE_EBT_ARP=m
# CONFIG_BRIDGE_EBT_IP is not set
# CONFIG_BRIDGE_EBT_IP6 is not set
# CONFIG_BRIDGE_EBT_LIMIT is not set
# CONFIG_BRIDGE_EBT_MARK is not set
CONFIG_BRIDGE_EBT_PKTTYPE=m
CONFIG_BRIDGE_EBT_STP=m
CONFIG_BRIDGE_EBT_VLAN=m
# CONFIG_BRIDGE_EBT_ARPREPLY is not set
CONFIG_BRIDGE_EBT_DNAT=m
CONFIG_BRIDGE_EBT_MARK_T=m
CONFIG_BRIDGE_EBT_REDIRECT=m
# CONFIG_BRIDGE_EBT_SNAT is not set
# CONFIG_BRIDGE_EBT_LOG is not set
CONFIG_BRIDGE_EBT_ULOG=m
CONFIG_BRIDGE_EBT_NFLOG=m
# CONFIG_IP_DCCP is not set
CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_MSG is not set
CONFIG_SCTP_DBG_OBJCNT=y
# CONFIG_SCTP_HMAC_NONE is not set
CONFIG_SCTP_HMAC_SHA1=y
# CONFIG_SCTP_HMAC_MD5 is not set
CONFIG_RDS=m
CONFIG_RDS_DEBUG=y
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
CONFIG_STP=y
CONFIG_BRIDGE=y
CONFIG_NET_DSA=y
# CONFIG_NET_DSA_TAG_DSA is not set
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 is not set
# CONFIG_NET_DSA_MV88E6131 is not set
CONFIG_NET_DSA_MV88E6123_61_65=y
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
CONFIG_LLC=y
CONFIG_LLC2=m
CONFIG_IPX=m
CONFIG_IPX_INTERN=y
# CONFIG_ATALK is not set
CONFIG_X25=y
# CONFIG_LAPB is not set
CONFIG_ECONET=m
CONFIG_ECONET_AUNUDP=y
CONFIG_ECONET_NATIVE=y
CONFIG_WAN_ROUTER=m
CONFIG_PHONET=m
# CONFIG_IEEE802154 is not set
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
CONFIG_NET_TCPPROBE=m
CONFIG_NET_DROP_MONITOR=y
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
CONFIG_BT=m
CONFIG_BT_L2CAP=m
CONFIG_BT_SCO=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
# CONFIG_BT_BNEP_MC_FILTER is not set
CONFIG_BT_BNEP_PROTO_FILTER=y
# CONFIG_BT_CMTP is not set
CONFIG_BT_HIDP=m

#
# Bluetooth device drivers
#
CONFIG_BT_HCIBTUSB=m
# CONFIG_BT_HCIBTSDIO is not set
# CONFIG_BT_HCIUART is not set
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
# CONFIG_BT_HCIBFUSB is not set
CONFIG_BT_HCIDTL1=m
CONFIG_BT_HCIBT3C=m
# CONFIG_BT_HCIBLUECARD is not set
CONFIG_BT_HCIBTUART=m
CONFIG_BT_HCIVHCI=m
CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_DEBUG=y
# CONFIG_RXKAD is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_CFG80211=y
CONFIG_CFG80211_REG_DEBUG=y
CONFIG_CFG80211_DEBUGFS=y
# CONFIG_WIRELESS_OLD_REGULATORY is not set
CONFIG_WIRELESS_EXT=y
CONFIG_WIRELESS_EXT_SYSFS=y
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 is not set
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=y
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_MTD is not set
CONFIG_PARPORT=y
CONFIG_PARPORT_PC=y
CONFIG_PARPORT_SERIAL=m
CONFIG_PARPORT_PC_FIFO=y
CONFIG_PARPORT_PC_SUPERIO=y
# CONFIG_PARPORT_PC_PCMCIA is not set
# CONFIG_PARPORT_GSC is not set
CONFIG_PARPORT_AX88796=m
CONFIG_PARPORT_1284=y
CONFIG_PARPORT_NOT_PC=y
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
# CONFIG_PARIDE is not set
CONFIG_BLK_CPQ_DA=y
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
CONFIG_BLK_DEV_UMEM=m
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_SX8=m
CONFIG_BLK_DEV_UB=y
# CONFIG_BLK_DEV_RAM is not set
# CONFIG_CDROM_PKTCDVD is not set
CONFIG_ATA_OVER_ETH=m
CONFIG_VIRTIO_BLK=m
CONFIG_BLK_DEV_HD=y
CONFIG_MISC_DEVICES=y
CONFIG_IBM_ASM=y
CONFIG_PHANTOM=m
# CONFIG_SGI_IOC4 is not set
CONFIG_TIFM_CORE=y
# CONFIG_TIFM_7XX1 is not set
CONFIG_ENCLOSURE_SERVICES=m
CONFIG_HP_ILO=y
CONFIG_C2PORT=m
# CONFIG_C2PORT_DURAMAR_2150 is not set

#
# EEPROM support
#
# CONFIG_EEPROM_93CX6 is not set
CONFIG_CB710_CORE=y
CONFIG_CB710_DEBUG=y
CONFIG_CB710_DEBUG_ASSUMPTIONS=y
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set

#
# 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=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=m
CONFIG_CHR_DEV_OSST=y
CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set
CONFIG_CHR_DEV_SG=y
# CONFIG_CHR_DEV_SCH is not set
# CONFIG_SCSI_ENCLOSURE is not set
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y
CONFIG_SCSI_WAIT_SCAN=m

#
# 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=m
CONFIG_SCSI_SAS_LIBSAS=m
CONFIG_SCSI_SAS_ATA=y
# CONFIG_SCSI_SAS_HOST_SMP is not set
# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
CONFIG_SCSI_SRP_ATTRS=m
CONFIG_SCSI_SRP_TGT_ATTRS=y
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
CONFIG_SCSI_DH=m
# CONFIG_SCSI_DH_RDAC is not set
# CONFIG_SCSI_DH_HP_SW is not set
# CONFIG_SCSI_DH_EMC is not set
CONFIG_SCSI_DH_ALUA=m
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
# CONFIG_ATA_ACPI is not set
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_SIL24=y
CONFIG_ATA_SFF=y
CONFIG_SATA_SVW=m
CONFIG_ATA_PIIX=y
CONFIG_SATA_MV=y
CONFIG_SATA_NV=y
CONFIG_PDC_ADMA=m
CONFIG_SATA_QSTOR=m
CONFIG_SATA_PROMISE=y
CONFIG_SATA_SX4=m
CONFIG_SATA_SIL=y
# CONFIG_SATA_SIS is not set
CONFIG_SATA_ULI=y
CONFIG_SATA_VIA=m
# CONFIG_SATA_VITESSE is not set
# CONFIG_SATA_INIC162X is not set
CONFIG_PATA_ALI=m
CONFIG_PATA_AMD=y
CONFIG_PATA_ARTOP=y
CONFIG_PATA_ATIIXP=y
CONFIG_PATA_CMD640_PCI=y
CONFIG_PATA_CMD64X=y
CONFIG_PATA_CS5520=m
# CONFIG_PATA_CS5530 is not set
# CONFIG_PATA_CYPRESS is not set
CONFIG_PATA_EFAR=y
# CONFIG_ATA_GENERIC is not set
CONFIG_PATA_HPT366=m
CONFIG_PATA_HPT37X=y
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
CONFIG_PATA_IT821X=m
CONFIG_PATA_IT8213=y
CONFIG_PATA_JMICRON=m
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_MARVELL is not set
CONFIG_PATA_MPIIX=m
CONFIG_PATA_OLDPIIX=y
CONFIG_PATA_NETCELL=y
# CONFIG_PATA_NINJA32 is not set
CONFIG_PATA_NS87410=m
# CONFIG_PATA_NS87415 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PCMCIA is not set
# CONFIG_PATA_PDC_OLD is not set
CONFIG_PATA_RADISYS=y
CONFIG_PATA_RZ1000=y
CONFIG_PATA_SC1200=y
CONFIG_PATA_SERVERWORKS=m
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_SIL680 is not set
CONFIG_PATA_SIS=m
CONFIG_PATA_VIA=y
# CONFIG_PATA_WINBOND is not set
CONFIG_PATA_PLATFORM=m
# CONFIG_PATA_SCH is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
# CONFIG_MD_LINEAR is not set
CONFIG_MD_RAID0=m
CONFIG_MD_RAID1=m
CONFIG_MD_RAID10=m
CONFIG_MD_RAID456=m
CONFIG_MD_RAID6_PQ=m
CONFIG_MD_MULTIPATH=m
# CONFIG_MD_FAULTY is not set
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
CONFIG_DM_CRYPT=m
CONFIG_DM_SNAPSHOT=m
# CONFIG_DM_MIRROR is not set
CONFIG_DM_ZERO=m
CONFIG_DM_MULTIPATH=m
CONFIG_DM_MULTIPATH_QL=m
CONFIG_DM_MULTIPATH_ST=m
CONFIG_DM_DELAY=m
CONFIG_DM_UEVENT=y
CONFIG_FUSION=y
# CONFIG_FUSION_SPI is not set
CONFIG_FUSION_FC=y
CONFIG_FUSION_SAS=m
CONFIG_FUSION_MAX_SGE=128
CONFIG_FUSION_CTL=m
CONFIG_FUSION_LAN=m
CONFIG_FUSION_LOGGING=y

#
# 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 is not set
# CONFIG_FIREWIRE_NET is not set
# CONFIG_IEEE1394 is not set
CONFIG_I2O=m
CONFIG_I2O_LCT_NOTIFY_ON_CHANGES=y
# CONFIG_I2O_EXT_ADAPTEC is not set
CONFIG_I2O_BUS=m
# CONFIG_I2O_BLOCK is not set
# CONFIG_I2O_SCSI is not set
# CONFIG_I2O_PROC is not set
# CONFIG_MACINTOSH_DRIVERS is not set
CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
CONFIG_BONDING=y
CONFIG_MACVLAN=m
CONFIG_EQUALIZER=y
CONFIG_TUN=m
CONFIG_VETH=y
CONFIG_NET_SB1000=m
# CONFIG_ARCNET is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
CONFIG_MARVELL_PHY=m
CONFIG_DAVICOM_PHY=y
CONFIG_QSEMI_PHY=m
CONFIG_LXT_PHY=y
CONFIG_CICADA_PHY=m
CONFIG_VITESSE_PHY=m
CONFIG_SMSC_PHY=y
CONFIG_BROADCOM_PHY=y
CONFIG_ICPLUS_PHY=m
# CONFIG_REALTEK_PHY is not set
CONFIG_NATIONAL_PHY=y
CONFIG_STE10XP=m
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_FIXED_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_HAPPYMEAL is not set
CONFIG_SUNGEM=m
CONFIG_CASSINI=m
CONFIG_NET_VENDOR_3COM=y
CONFIG_VORTEX=y
# CONFIG_TYPHOON is not set
# CONFIG_ETHOC is not set
# CONFIG_DNET is not set
CONFIG_NET_TULIP=y
CONFIG_DE2104X=y
CONFIG_DE2104X_DSL=0
CONFIG_TULIP=m
CONFIG_TULIP_MWI=y
CONFIG_TULIP_MMIO=y
CONFIG_TULIP_NAPI=y
CONFIG_TULIP_NAPI_HW_MITIGATION=y
CONFIG_DE4X5=y
# CONFIG_WINBOND_840 is not set
CONFIG_DM9102=m
CONFIG_ULI526X=y
CONFIG_PCMCIA_XIRCOM=m
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 is not set
CONFIG_AMD8111_ETH=y
CONFIG_ADAPTEC_STARFIRE=y
# CONFIG_B44 is not set
CONFIG_FORCEDETH=y
CONFIG_FORCEDETH_NAPI=y
CONFIG_E100=y
CONFIG_FEALNX=y
CONFIG_NATSEMI=y
# CONFIG_NE2K_PCI is not set
# CONFIG_8139CP is not set
CONFIG_8139TOO=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
CONFIG_8139TOO_8129=y
CONFIG_8139_OLD_RX_RESET=y
# CONFIG_R6040 is not set
CONFIG_SIS900=y
# CONFIG_EPIC100 is not set
CONFIG_SMSC9420=y
# CONFIG_SUNDANCE is not set
CONFIG_TLAN=m
# CONFIG_KS8842 is not set
CONFIG_VIA_RHINE=y
CONFIG_VIA_RHINE_MMIO=y
CONFIG_SC92031=m
CONFIG_NET_POCKET=y
CONFIG_ATP=y
CONFIG_DE600=m
CONFIG_DE620=m
CONFIG_ATL2=m
CONFIG_NETDEV_1000=y
CONFIG_ACENIC=y
# CONFIG_ACENIC_OMIT_TIGON_I is not set
# CONFIG_DL2K is not set
# CONFIG_E1000 is not set
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
CONFIG_IGB=y
CONFIG_IGBVF=m
CONFIG_NS83820=y
# CONFIG_HAMACHI is not set
CONFIG_YELLOWFIN=y
CONFIG_R8169=m
CONFIG_SIS190=m
CONFIG_SKGE=y
CONFIG_SKGE_DEBUG=y
CONFIG_SKY2=y
CONFIG_SKY2_DEBUG=y
CONFIG_VIA_VELOCITY=m
CONFIG_TIGON3=y
CONFIG_BNX2=m
# CONFIG_QLA3XXX is not set
CONFIG_ATL1=y
CONFIG_ATL1E=m
CONFIG_ATL1C=y
CONFIG_JME=y
# CONFIG_NETDEV_10000 is not set
CONFIG_MLX4_CORE=m
CONFIG_TR=m
CONFIG_IBMOL=m
CONFIG_3C359=m
CONFIG_TMS380TR=m
CONFIG_TMSPCI=m
CONFIG_ABYSS=m

#
# Wireless LAN
#
CONFIG_WLAN_PRE80211=y
CONFIG_STRIP=m
CONFIG_PCMCIA_WAVELAN=y
CONFIG_PCMCIA_NETWAVE=m
CONFIG_WLAN_80211=y
CONFIG_PCMCIA_RAYCS=y
CONFIG_LIBERTAS=y
CONFIG_LIBERTAS_USB=y
# CONFIG_LIBERTAS_CS is not set
CONFIG_LIBERTAS_SDIO=y
# CONFIG_LIBERTAS_DEBUG is not set
# CONFIG_AIRO is not set
# CONFIG_ATMEL is not set
CONFIG_AIRO_CS=m
CONFIG_PCMCIA_WL3501=m
CONFIG_PRISM54=m
# CONFIG_USB_ZD1201 is not set
CONFIG_USB_NET_RNDIS_WLAN=y
CONFIG_IPW2100=y
CONFIG_IPW2100_MONITOR=y
# CONFIG_IPW2100_DEBUG 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_HOSTAP=m
# CONFIG_HOSTAP_FIRMWARE is not set
CONFIG_HOSTAP_PLX=m
CONFIG_HOSTAP_PCI=m
# CONFIG_HOSTAP_CS is not set
CONFIG_HERMES=m
CONFIG_HERMES_CACHE_FW_ON_INIT=y
CONFIG_PLX_HERMES=m
CONFIG_TMD_HERMES=m
CONFIG_NORTEL_HERMES=m
# CONFIG_PCI_HERMES is not set
# CONFIG_PCMCIA_HERMES is not set
CONFIG_PCMCIA_SPECTRUM=m
CONFIG_IWM=m
CONFIG_IWM_DEBUG=y

#
# WiMAX Wireless Broadband devices
#
CONFIG_WIMAX_I2400M=m
CONFIG_WIMAX_I2400M_SDIO=m
CONFIG_WIMAX_I2400M_DEBUG_LEVEL=8

#
# USB Network Adapters
#
CONFIG_USB_CATC=m
CONFIG_USB_KAWETH=m
CONFIG_USB_PEGASUS=m
CONFIG_USB_RTL8150=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
# CONFIG_USB_NET_CDC_EEM is not set
CONFIG_USB_NET_DM9601=y
# CONFIG_USB_NET_SMSC95XX is not set
CONFIG_USB_NET_GL620A=y
CONFIG_USB_NET_NET1080=m
CONFIG_USB_NET_PLUSB=m
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
# CONFIG_USB_NET_CDC_SUBSET is not set
CONFIG_USB_NET_ZAURUS=m
CONFIG_USB_HSO=m
CONFIG_USB_NET_INT51X1=m
# CONFIG_USB_CDC_PHONET is not set
CONFIG_NET_PCMCIA=y
CONFIG_PCMCIA_3C589=y
# CONFIG_PCMCIA_3C574 is not set
# CONFIG_PCMCIA_FMVJ18X is not set
CONFIG_PCMCIA_PCNET=m
# CONFIG_PCMCIA_NMCLAN is not set
CONFIG_PCMCIA_SMC91C92=m
CONFIG_PCMCIA_XIRC2PS=y
CONFIG_PCMCIA_AXNET=y
CONFIG_PCMCIA_IBMTR=m
# CONFIG_WAN is not set
CONFIG_FDDI=y
CONFIG_DEFXX=m
CONFIG_DEFXX_MMIO=y
CONFIG_SKFP=y
CONFIG_HIPPI=y
# CONFIG_ROADRUNNER is not set
# CONFIG_PLIP is not set
CONFIG_PPP=m
CONFIG_PPP_MULTILINK=y
# CONFIG_PPP_FILTER is not set
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
# CONFIG_PPP_DEFLATE is not set
CONFIG_PPP_BSDCOMP=m
CONFIG_PPP_MPPE=m
# CONFIG_PPPOE is not set
CONFIG_PPPOL2TP=m
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=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_VIRTIO_NET=y
CONFIG_ISDN=y
# CONFIG_ISDN_I4L is not set
CONFIG_ISDN_CAPI=y
CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
# CONFIG_CAPI_TRACE is not set
# CONFIG_ISDN_CAPI_MIDDLEWARE is not set
CONFIG_ISDN_CAPI_CAPI20=y

#
# CAPI hardware drivers
#
CONFIG_CAPI_AVM=y
# CONFIG_ISDN_DRV_AVMB1_B1PCI is not set
CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=y
# CONFIG_ISDN_DRV_AVMB1_AVM_CS is not set
# CONFIG_ISDN_DRV_AVMB1_T1PCI is not set
CONFIG_ISDN_DRV_AVMB1_C4=y
CONFIG_CAPI_EICON=y
CONFIG_ISDN_DIVAS=y
CONFIG_ISDN_DIVAS_BRIPCI=y
CONFIG_ISDN_DIVAS_PRIPCI=y
# CONFIG_ISDN_DIVAS_DIVACAPI is not set
# CONFIG_ISDN_DIVAS_USERIDI is not set
CONFIG_ISDN_DIVAS_MAINT=m
# 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=m
CONFIG_INPUT_EVDEV=m
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
CONFIG_KEYBOARD_LKKBD=y
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
CONFIG_KEYBOARD_SUNKBD=y
CONFIG_KEYBOARD_XTKBD=y
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=m
CONFIG_MOUSE_PS2_ALPS=y
# CONFIG_MOUSE_PS2_LOGIPS2PP is not set
# CONFIG_MOUSE_PS2_SYNAPTICS is not set
CONFIG_MOUSE_PS2_LIFEBOOK=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
CONFIG_MOUSE_PS2_ELANTECH=y
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
# CONFIG_MOUSE_SERIAL is not set
CONFIG_MOUSE_APPLETOUCH=m
CONFIG_MOUSE_BCM5974=y
# CONFIG_MOUSE_VSXXXAA is not set
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_ANALOG=y
CONFIG_JOYSTICK_A3D=m
CONFIG_JOYSTICK_ADI=y
# CONFIG_JOYSTICK_COBRA is not set
CONFIG_JOYSTICK_GF2K=m
CONFIG_JOYSTICK_GRIP=y
CONFIG_JOYSTICK_GRIP_MP=m
CONFIG_JOYSTICK_GUILLEMOT=m
CONFIG_JOYSTICK_INTERACT=y
CONFIG_JOYSTICK_SIDEWINDER=y
CONFIG_JOYSTICK_TMDC=y
CONFIG_JOYSTICK_IFORCE=m
# CONFIG_JOYSTICK_IFORCE_USB is not set
CONFIG_JOYSTICK_IFORCE_232=y
# CONFIG_JOYSTICK_WARRIOR is not set
CONFIG_JOYSTICK_MAGELLAN=y
# CONFIG_JOYSTICK_SPACEORB is not set
# CONFIG_JOYSTICK_SPACEBALL is not set
CONFIG_JOYSTICK_STINGER=m
# CONFIG_JOYSTICK_TWIDJOY is not set
CONFIG_JOYSTICK_ZHENHUA=m
# CONFIG_JOYSTICK_DB9 is not set
CONFIG_JOYSTICK_GAMECON=y
CONFIG_JOYSTICK_TURBOGRAFX=m
CONFIG_JOYSTICK_JOYDUMP=y
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
# CONFIG_JOYSTICK_WALKERA0701 is not set
CONFIG_INPUT_TABLET=y
# CONFIG_TABLET_USB_ACECAD is not set
CONFIG_TABLET_USB_AIPTEK=m
CONFIG_TABLET_USB_GTCO=m
CONFIG_TABLET_USB_KBTAB=y
# CONFIG_TABLET_USB_WACOM is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_PCSPKR is not set
CONFIG_INPUT_ATLAS_BTNS=m
CONFIG_INPUT_ATI_REMOTE=y
# CONFIG_INPUT_ATI_REMOTE2 is not set
# CONFIG_INPUT_KEYSPAN_REMOTE is not set
CONFIG_INPUT_POWERMATE=y
# CONFIG_INPUT_YEALINK is not set
CONFIG_INPUT_CM109=m
CONFIG_INPUT_UINPUT=m

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_CT82C710=y
CONFIG_SERIO_PARKBD=m
CONFIG_SERIO_PCIPS2=m
CONFIG_SERIO_LIBPS2=y
CONFIG_SERIO_RAW=y
CONFIG_GAMEPORT=y
CONFIG_GAMEPORT_NS558=m
CONFIG_GAMEPORT_L4=y
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=y
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_COMPUTONE=m
CONFIG_ROCKETPORT=y
CONFIG_CYCLADES=y
# CONFIG_CYZ_INTR is not set
CONFIG_DIGIEPCA=y
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
# CONFIG_ISI is not set
CONFIG_SYNCLINK=y
CONFIG_SYNCLINKMP=y
CONFIG_SYNCLINK_GT=m
CONFIG_N_HDLC=m
CONFIG_RISCOM8=m
# CONFIG_SPECIALIX is not set
CONFIG_SX=m
CONFIG_RIO=y
CONFIG_RIO_OLDPCI=y
# CONFIG_STALDRV is not set
# CONFIG_NOZOMI is not set

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_PCI=m
CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_CS=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
# CONFIG_SERIAL_8250_DETECT_IRQ is not set
CONFIG_SERIAL_8250_RSA=y

#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_CONSOLE_POLL=y
CONFIG_SERIAL_JSM=m
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_PRINTER=m
CONFIG_LP_CONSOLE=y
CONFIG_PPDEV=m
CONFIG_HVC_DRIVER=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_IPMI_HANDLER=y
CONFIG_IPMI_PANIC_EVENT=y
CONFIG_IPMI_PANIC_STRING=y
CONFIG_IPMI_DEVICE_INTERFACE=y
CONFIG_IPMI_SI=m
# CONFIG_IPMI_WATCHDOG is not set
# CONFIG_IPMI_POWEROFF is not set
# CONFIG_HW_RANDOM is not set
CONFIG_NVRAM=y
# CONFIG_RTC is not set
CONFIG_GEN_RTC=m
CONFIG_GEN_RTC_X=y
# CONFIG_R3964 is not set
CONFIG_APPLICOM=y

#
# PCMCIA character devices
#
CONFIG_SYNCLINK_CS=m
# CONFIG_CARDMAN_4000 is not set
# CONFIG_CARDMAN_4040 is not set
# CONFIG_IPWIRELESS is not set
# CONFIG_MWAVE is not set
# CONFIG_PC8736x_GPIO is not set
# CONFIG_RAW_DRIVER is not set
CONFIG_HPET=y
CONFIG_HPET_MMAP=y
CONFIG_HANGCHECK_TIMER=m
CONFIG_TCG_TPM=y
CONFIG_TCG_TIS=y
CONFIG_TCG_NSC=m
CONFIG_TCG_ATMEL=m
CONFIG_TCG_INFINEON=m
CONFIG_TELCLOCK=m
CONFIG_DEVPORT=y
# CONFIG_I2C is not set
# CONFIG_SPI is not set

#
# PPS support
#
CONFIG_PPS=y
CONFIG_PPS_DEBUG=y
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_SUPPLY_DEBUG=y
# CONFIG_PDA_POWER is not set
# CONFIG_BATTERY_DS2760 is not set
CONFIG_HWMON=m
CONFIG_HWMON_VID=m
CONFIG_SENSORS_ABITUGURU=m
CONFIG_SENSORS_ABITUGURU3=m
CONFIG_SENSORS_K8TEMP=m
# CONFIG_SENSORS_ATK0110 is not set
CONFIG_SENSORS_I5K_AMB=m
CONFIG_SENSORS_F71805F=m
CONFIG_SENSORS_F71882FG=m
CONFIG_SENSORS_CORETEMP=m
# CONFIG_SENSORS_IBMAEM is not set
# CONFIG_SENSORS_IBMPEX is not set
CONFIG_SENSORS_IT87=m
# CONFIG_SENSORS_PC87360 is not set
CONFIG_SENSORS_PC87427=m
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
CONFIG_SENSORS_SMSC47B397=m
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
CONFIG_SENSORS_W83627HF=m
CONFIG_SENSORS_W83627EHF=m
CONFIG_SENSORS_HDAPS=m
CONFIG_SENSORS_LIS3LV02D=m
# CONFIG_SENSORS_APPLESMC is not set
CONFIG_HWMON_DEBUG_CHIP=y
CONFIG_THERMAL=m
# CONFIG_THERMAL_HWMON is not set
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_NOWAYOUT is not set

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
CONFIG_ACQUIRE_WDT=y
CONFIG_ADVANTECH_WDT=m
CONFIG_ALIM1535_WDT=m
# CONFIG_ALIM7101_WDT is not set
CONFIG_SC520_WDT=m
# CONFIG_EUROTECH_WDT is not set
CONFIG_IB700_WDT=y
CONFIG_IBMASR=m
CONFIG_WAFER_WDT=m
CONFIG_I6300ESB_WDT=m
CONFIG_ITCO_WDT=m
CONFIG_ITCO_VENDOR_SUPPORT=y
CONFIG_IT8712F_WDT=y
CONFIG_IT87_WDT=m
# CONFIG_HP_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
CONFIG_PC87413_WDT=m
CONFIG_60XX_WDT=m
CONFIG_SBC8360_WDT=m
CONFIG_CPU5_WDT=m
CONFIG_SMSC_SCH311X_WDT=m
CONFIG_SMSC37B787_WDT=m
CONFIG_W83627HF_WDT=m
# CONFIG_W83697HF_WDT is not set
CONFIG_W83697UG_WDT=m
CONFIG_W83877F_WDT=y
CONFIG_W83977F_WDT=y
CONFIG_MACHZ_WDT=y
CONFIG_SBC_EPX_C3_WATCHDOG=m

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
CONFIG_WDTPCI=y

#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=m
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
# CONFIG_SSB is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
CONFIG_MFD_SM501=y
CONFIG_HTC_PASIC3=y
# CONFIG_MFD_TMIO is not set
CONFIG_REGULATOR=y
CONFIG_REGULATOR_DEBUG=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
CONFIG_REGULATOR_USERSPACE_CONSUMER=m
# CONFIG_REGULATOR_BQ24022 is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
# CONFIG_AGP_INTEL is not set
CONFIG_AGP_SIS=y
CONFIG_AGP_VIA=y
# CONFIG_DRM is not set
# CONFIG_VGASTATE is not set
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
# CONFIG_FB is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_GENERIC is not set
CONFIG_BACKLIGHT_PROGEAR=m
# CONFIG_BACKLIGHT_MBP_NVIDIA is not set
CONFIG_BACKLIGHT_SAHARA=y

#
# Display device support
#
CONFIG_DISPLAY_SUPPORT=m

#
# Display hardware drivers
#

#
# 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_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=m
CONFIG_SND_SEQ_DUMMY=m
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=m
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_DYNAMIC_MINORS=y
# CONFIG_SND_SUPPORT_OLD_API is not set
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_VERBOSE=y
CONFIG_SND_PCM_XRUN_DEBUG=y
CONFIG_SND_VMASTER=y
CONFIG_SND_RAWMIDI_SEQ=m
CONFIG_SND_OPL3_LIB_SEQ=m
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
CONFIG_SND_EMU10K1_SEQ=m
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_VX_LIB=m
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_DRIVERS=y
CONFIG_SND_PCSP=m
# CONFIG_SND_DUMMY is not set
CONFIG_SND_VIRMIDI=m
# CONFIG_SND_MTS64 is not set
# CONFIG_SND_SERIAL_U16550 is not set
CONFIG_SND_MPU401=m
CONFIG_SND_PORTMAN2X4=m
CONFIG_SND_AC97_POWER_SAVE=y
CONFIG_SND_AC97_POWER_SAVE_DEFAULT=0
CONFIG_SND_SB_COMMON=m
CONFIG_SND_SB16_DSP=m
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
CONFIG_SND_ALS300=m
# CONFIG_SND_ALS4000 is not set
CONFIG_SND_ALI5451=m
CONFIG_SND_ATIIXP=m
# CONFIG_SND_ATIIXP_MODEM is not set
CONFIG_SND_AU8810=m
CONFIG_SND_AU8820=m
# CONFIG_SND_AU8830 is not set
CONFIG_SND_AW2=m
CONFIG_SND_AZT3328=m
# CONFIG_SND_BT87X is not set
CONFIG_SND_CA0106=m
# CONFIG_SND_CMIPCI is not set
CONFIG_SND_OXYGEN_LIB=m
# CONFIG_SND_OXYGEN is not set
CONFIG_SND_CS4281=m
CONFIG_SND_CS46XX=m
# CONFIG_SND_CS46XX_NEW_DSP is not set
CONFIG_SND_CS5530=m
CONFIG_SND_CTXFI=m
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
CONFIG_SND_LAYLA20=m
CONFIG_SND_DARLA24=m
# CONFIG_SND_GINA24 is not set
CONFIG_SND_LAYLA24=m
CONFIG_SND_MONA=m
CONFIG_SND_MIA=m
CONFIG_SND_ECHO3G=m
# CONFIG_SND_INDIGO is not set
CONFIG_SND_INDIGOIO=m
CONFIG_SND_INDIGODJ=m
CONFIG_SND_INDIGOIOX=m
CONFIG_SND_INDIGODJX=m
CONFIG_SND_EMU10K1=m
CONFIG_SND_EMU10K1X=m
CONFIG_SND_ENS1370=m
CONFIG_SND_ENS1371=m
CONFIG_SND_ES1938=m
CONFIG_SND_ES1968=m
CONFIG_SND_FM801=m
CONFIG_SND_HDA_INTEL=m
# CONFIG_SND_HDA_HWDEP is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
CONFIG_SND_HDA_INPUT_JACK=y
# CONFIG_SND_HDA_CODEC_REALTEK is not set
# CONFIG_SND_HDA_CODEC_ANALOG is not set
CONFIG_SND_HDA_CODEC_SIGMATEL=y
# CONFIG_SND_HDA_CODEC_VIA is not set
CONFIG_SND_HDA_CODEC_ATIHDMI=y
CONFIG_SND_HDA_CODEC_NVHDMI=y
CONFIG_SND_HDA_CODEC_INTELHDMI=y
CONFIG_SND_HDA_ELD=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
CONFIG_SND_HDSP=m
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_HIFIER is not set
CONFIG_SND_ICE1712=m
CONFIG_SND_ICE1724=m
CONFIG_SND_INTEL8X0=m
CONFIG_SND_INTEL8X0M=m
# CONFIG_SND_KORG1212 is not set
CONFIG_SND_LX6464ES=m
CONFIG_SND_MAESTRO3=m
CONFIG_SND_MIXART=m
# CONFIG_SND_NM256 is not set
CONFIG_SND_PCXHR=m
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
CONFIG_SND_RME96=m
# CONFIG_SND_RME9652 is not set
CONFIG_SND_SONICVIBES=m
CONFIG_SND_TRIDENT=m
# CONFIG_SND_VIA82XX is not set
CONFIG_SND_VIA82XX_MODEM=m
CONFIG_SND_VIRTUOSO=m
CONFIG_SND_VX222=m
# CONFIG_SND_YMFPCI is not set
# CONFIG_SND_USB is not set
CONFIG_SND_PCMCIA=y
CONFIG_SND_VXPOCKET=m
CONFIG_SND_PDAUDIOCF=m
CONFIG_SND_SOC=m
CONFIG_SND_SOC_ALL_CODECS=m
CONFIG_SND_SOC_L3=m
CONFIG_SND_SOC_PCM3008=m
CONFIG_SND_SOC_SPDIF=m
CONFIG_SND_SOC_UDA134X=m
# CONFIG_SOUND_PRIME is not set
CONFIG_AC97_BUS=m
# CONFIG_HID_SUPPORT is not set
CONFIG_HID=m
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 is not set

#
# Miscellaneous USB options
#
# CONFIG_USB_DEVICEFS is not set
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_USB_SUSPEND=y
# CONFIG_USB_OTG is not set
CONFIG_USB_OTG_WHITELIST=y
CONFIG_USB_OTG_BLACKLIST_HUB=y
CONFIG_USB_MON=m
CONFIG_USB_WUSB=y
# CONFIG_USB_WUSB_CBAF is not set

#
# USB Host Controller Drivers
#
CONFIG_USB_C67X00_HCD=m
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 is not set
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=m
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_OHCI_HCD=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 is not set
CONFIG_USB_R8A66597_HCD=y
# CONFIG_USB_HWA_HCD is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=m
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_WDM is not set
# 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=y
# CONFIG_USB_STORAGE_DEBUG is not set
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=m
# CONFIG_USB_STORAGE_ISD200 is not set
CONFIG_USB_STORAGE_USBAT=y
# CONFIG_USB_STORAGE_SDDR09 is not set
CONFIG_USB_STORAGE_SDDR55=y
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
CONFIG_USB_STORAGE_KARMA=m
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
CONFIG_USB_LIBUSUAL=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=m
# CONFIG_USB_MICROTEK is not set

#
# USB port drivers
#
# CONFIG_USB_USS720 is not set
CONFIG_USB_SERIAL=m
CONFIG_USB_EZUSB=y
# CONFIG_USB_SERIAL_GENERIC is not set
# CONFIG_USB_SERIAL_AIRCABLE is not set
CONFIG_USB_SERIAL_ARK3116=m
CONFIG_USB_SERIAL_BELKIN=m
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_WHITEHEAT=m
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
CONFIG_USB_SERIAL_CP210X=m
CONFIG_USB_SERIAL_CYPRESS_M8=m
CONFIG_USB_SERIAL_EMPEG=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_FUNSOFT=m
# CONFIG_USB_SERIAL_VISOR is not set
# CONFIG_USB_SERIAL_IPAQ is not set
CONFIG_USB_SERIAL_IR=m
# CONFIG_USB_SERIAL_EDGEPORT is not set
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
CONFIG_USB_SERIAL_GARMIN=m
# CONFIG_USB_SERIAL_IPW is not set
CONFIG_USB_SERIAL_IUU=m
CONFIG_USB_SERIAL_KEYSPAN_PDA=m
CONFIG_USB_SERIAL_KEYSPAN=m
CONFIG_USB_SERIAL_KEYSPAN_MPR=y
CONFIG_USB_SERIAL_KEYSPAN_USA28=y
CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
CONFIG_USB_SERIAL_KEYSPAN_USA19=y
CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set
CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
CONFIG_USB_SERIAL_KLSI=m
CONFIG_USB_SERIAL_KOBIL_SCT=m
CONFIG_USB_SERIAL_MCT_U232=m
CONFIG_USB_SERIAL_MOS7720=m
# CONFIG_USB_SERIAL_MOS7840 is not set
CONFIG_USB_SERIAL_MOTOROLA=m
CONFIG_USB_SERIAL_NAVMAN=m
CONFIG_USB_SERIAL_PL2303=m
# CONFIG_USB_SERIAL_OTI6858 is not set
# CONFIG_USB_SERIAL_QUALCOMM is not set
CONFIG_USB_SERIAL_SPCP8X5=m
CONFIG_USB_SERIAL_HP4X=m
CONFIG_USB_SERIAL_SAFE=m
# CONFIG_USB_SERIAL_SAFE_PADDED is not set
# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
CONFIG_USB_SERIAL_SYMBOL=m
CONFIG_USB_SERIAL_TI=m
CONFIG_USB_SERIAL_CYBERJACK=m
# CONFIG_USB_SERIAL_XIRCOM is not set
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_OMNINET=m
CONFIG_USB_SERIAL_OPTICON=m
# CONFIG_USB_SERIAL_DEBUG is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
CONFIG_USB_EMI26=m
CONFIG_USB_ADUTUX=m
CONFIG_USB_SEVSEG=y
CONFIG_USB_RIO500=m
CONFIG_USB_LEGOTOWER=y
# CONFIG_USB_LCD is not set
CONFIG_USB_BERRY_CHARGE=y
CONFIG_USB_LED=m
CONFIG_USB_CYPRESS_CY7C63=m
CONFIG_USB_CYTHERM=y
CONFIG_USB_IDMOUSE=m
# CONFIG_USB_FTDI_ELAN is not set
CONFIG_USB_APPLEDISPLAY=y
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_SISUSBVGA_CON=y
# CONFIG_USB_LD is not set
CONFIG_USB_TRANCEVIBRATOR=m
# CONFIG_USB_IOWARRIOR is not set
CONFIG_USB_TEST=y
CONFIG_USB_ISIGHTFW=y
CONFIG_USB_VST=m

#
# OTG and related infrastructure
#
CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=m
CONFIG_UWB=y
# CONFIG_UWB_HWA is not set
CONFIG_UWB_WHCI=m
CONFIG_UWB_WLP=m
CONFIG_MMC=y
CONFIG_MMC_DEBUG=y
CONFIG_MMC_UNSAFE_RESUME=y

#
# MMC/SD/SDIO Card Drivers
#
CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_BOUNCE=y
CONFIG_SDIO_UART=m
CONFIG_MMC_TEST=y

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_SDHCI is not set
CONFIG_MMC_WBSD=y
CONFIG_MMC_TIFM_SD=y
CONFIG_MMC_SDRICOH_CS=y
CONFIG_MMC_CB710=y
CONFIG_MMC_VIA_SDMMC=m
CONFIG_MEMSTICK=m
# CONFIG_MEMSTICK_DEBUG is not set

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
CONFIG_MSPRO_BLOCK=m

#
# MemoryStick Host Controller Drivers
#
CONFIG_MEMSTICK_TIFM_MS=m
CONFIG_MEMSTICK_JMICRON_38X=m
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=m

#
# LED drivers
#
CONFIG_LEDS_ALIX2=m
CONFIG_LEDS_CLEVO_MAIL=m

#
# LED Triggers
#
# CONFIG_LEDS_TRIGGERS is not set
# CONFIG_ACCESSIBILITY is not set
CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_MAD=m
CONFIG_INFINIBAND_USER_ACCESS=m
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_MTHCA_DEBUG=y
# CONFIG_INFINIBAND_IPATH is not set
CONFIG_INFINIBAND_AMSO1100=m
CONFIG_INFINIBAND_AMSO1100_DEBUG=y
CONFIG_MLX4_INFINIBAND=m
CONFIG_INFINIBAND_NES=m
CONFIG_INFINIBAND_NES_DEBUG=y
CONFIG_INFINIBAND_IPOIB=m
CONFIG_INFINIBAND_IPOIB_CM=y
CONFIG_INFINIBAND_IPOIB_DEBUG=y
CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
CONFIG_INFINIBAND_SRP=m
CONFIG_INFINIBAND_ISER=m
CONFIG_EDAC=y

#
# Reporting subsystems
#
CONFIG_EDAC_DEBUG=y
CONFIG_EDAC_DEBUG_VERBOSE=y
CONFIG_EDAC_MM_EDAC=m
# CONFIG_EDAC_AMD64 is not set
CONFIG_EDAC_E752X=m
# CONFIG_EDAC_I82975X is not set
CONFIG_EDAC_I3000=m
CONFIG_EDAC_X38=m
# CONFIG_EDAC_I5400 is not set
# CONFIG_EDAC_I5000 is not set
# CONFIG_EDAC_I5100 is not set
# CONFIG_RTC_CLASS is not set
CONFIG_DMADEVICES=y

#
# DMA Devices
#
CONFIG_INTEL_IOATDMA=m
CONFIG_DMA_ENGINE=y

#
# DMA Clients
#
# CONFIG_NET_DMA is not set
CONFIG_ASYNC_TX_DMA=y
CONFIG_DMATEST=m
CONFIG_DCA=m
CONFIG_AUXDISPLAY=y
# CONFIG_KS0108 is not set
CONFIG_UIO=m
CONFIG_UIO_CIF=m
# CONFIG_UIO_PDRV is not set
CONFIG_UIO_PDRV_GENIRQ=m
# CONFIG_UIO_SMX is not set
CONFIG_UIO_AEC=m
CONFIG_UIO_SERCOS3=m

#
# TI VLYNQ
#
# CONFIG_STAGING is not set
CONFIG_X86_PLATFORM_DEVICES=y
# CONFIG_ACER_WMI is not set
# CONFIG_DELL_WMI is not set
# CONFIG_FUJITSU_LAPTOP is not set
CONFIG_HP_WMI=y
# CONFIG_MSI_LAPTOP is not set
CONFIG_PANASONIC_LAPTOP=y
CONFIG_COMPAL_LAPTOP=y
CONFIG_SONY_LAPTOP=y
CONFIG_SONYPI_COMPAT=y
CONFIG_THINKPAD_ACPI=m
CONFIG_THINKPAD_ACPI_DEBUGFACILITIES=y
CONFIG_THINKPAD_ACPI_DEBUG=y
# CONFIG_THINKPAD_ACPI_UNSAFE_LEDS is not set
# CONFIG_THINKPAD_ACPI_VIDEO is not set
CONFIG_THINKPAD_ACPI_HOTKEY_POLL=y
CONFIG_EEEPC_LAPTOP=m
CONFIG_ACPI_WMI=y
CONFIG_ACPI_ASUS=y
# CONFIG_ACPI_TOSHIBA is not set

#
# Firmware Drivers
#
# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_DELL_RBU is not set
# CONFIG_DCDBAS is not set
CONFIG_DMIID=y
# CONFIG_ISCSI_IBFT_FIND is not set

#
# File systems
#
# CONFIG_EXT2_FS is not set
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_JBD=y
CONFIG_JBD_DEBUG=y
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
CONFIG_JFS_FS=y
CONFIG_JFS_POSIX_ACL=y
# CONFIG_JFS_SECURITY is not set
CONFIG_JFS_DEBUG=y
CONFIG_JFS_STATISTICS=y
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=m
CONFIG_XFS_QUOTA=y
# CONFIG_XFS_POSIX_ACL is not set
CONFIG_XFS_RT=y
# CONFIG_XFS_DEBUG is not set
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=y
# CONFIG_OCFS2_FS is not set
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
# CONFIG_AUTOFS4_FS is not set
CONFIG_FUSE_FS=y
# CONFIG_CUSE is not set

#
# 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 is not set

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=m
CONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
CONFIG_UDF_FS=m
CONFIG_UDF_NLS=y

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
# CONFIG_MSDOS_FS is not set
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_NTFS_FS=y
# CONFIG_NTFS_DEBUG is not set
# CONFIG_NTFS_RW is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
# CONFIG_TMPFS is not set
# CONFIG_HUGETLBFS is not set
# CONFIG_HUGETLB_PAGE is not set
CONFIG_CONFIGFS_FS=y
# CONFIG_MISC_FILESYSTEMS is not set
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_NFS_FS is not set
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
# CONFIG_NFSD_V4 is not set
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=m
CONFIG_NFS_ACL_SUPPORT=m
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=m
CONFIG_SUNRPC_GSS=m
CONFIG_SUNRPC_XPRT_RDMA=m
CONFIG_RPCSEC_GSS_KRB5=m
CONFIG_RPCSEC_GSS_SPKM3=m
# CONFIG_SMB_FS is not set
CONFIG_CIFS=m
CONFIG_CIFS_STATS=y
CONFIG_CIFS_STATS2=y
# CONFIG_CIFS_WEAK_PW_HASH is not set
# CONFIG_CIFS_UPCALL is not set
# CONFIG_CIFS_XATTR is not set
# CONFIG_CIFS_DEBUG2 is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_EXPERIMENTAL=y
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
CONFIG_ACORN_PARTITION_CUMANA=y
# CONFIG_ACORN_PARTITION_EESOX is not set
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 is not set
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=y
# CONFIG_LDM_DEBUG is not set
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_SYSV68_PARTITION=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=m
CONFIG_NLS_CODEPAGE_737=m
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
CONFIG_NLS_CODEPAGE_852=y
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
CONFIG_NLS_CODEPAGE_860=m
CONFIG_NLS_CODEPAGE_861=y
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
CONFIG_NLS_CODEPAGE_864=y
# CONFIG_NLS_CODEPAGE_865 is not set
CONFIG_NLS_CODEPAGE_866=y
# CONFIG_NLS_CODEPAGE_869 is not set
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=m
CONFIG_NLS_CODEPAGE_932=y
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
CONFIG_NLS_ISO8859_8=m
# CONFIG_NLS_CODEPAGE_1250 is not set
CONFIG_NLS_CODEPAGE_1251=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_2=y
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
CONFIG_NLS_ISO8859_13=m
CONFIG_NLS_ISO8859_14=y
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_UTF8=m
CONFIG_DLM=y
# CONFIG_DLM_DEBUG is not set

#
# Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_PRINTK_TIME=y
CONFIG_ALLOW_WARNINGS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
# CONFIG_ENABLE_MUST_CHECK is not set
CONFIG_FRAME_WARN=2048
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=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1
# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_SCHEDSTATS=y
# CONFIG_TIMER_STATS is not set
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SLUB_DEBUG_ON is not set
CONFIG_SLUB_STATS=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
CONFIG_DEBUG_KMEMLEAK_TEST=m
# CONFIG_DEBUG_RT_MUTEXES is not set
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=y
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_INFO is not set
CONFIG_DEBUG_VM=y
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y
CONFIG_DEBUG_SG=y
CONFIG_DEBUG_NOTIFIERS=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
# CONFIG_BOOT_PRINTK_DELAY is not set
CONFIG_RCU_TORTURE_TEST=m
CONFIG_RCU_CPU_STALL_DETECTOR=y
CONFIG_KPROBES_SANITY_TEST=y
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
CONFIG_LKDTM=y
# CONFIG_FAULT_INJECTION is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_USER_STACKTRACE_SUPPORT=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_SYSCALL_TRACEPOINTS=y
CONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE 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 is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=m
# CONFIG_KGDB_TESTS is not set
CONFIG_HAVE_ARCH_KMEMCHECK=y
# CONFIG_KMEMCHECK is not set
# CONFIG_STRICT_DEVMEM is not set
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_PER_CPU_MAPS=y
CONFIG_X86_PTDUMP=y
CONFIG_DEBUG_RODATA=y
# CONFIG_DEBUG_RODATA_TEST is not set
CONFIG_DEBUG_NX_TEST=m
CONFIG_IOMMU_DEBUG=y
CONFIG_IOMMU_STRESS=y
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=y
# 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 is not set
# CONFIG_SECURITY_ROOTPLUG is not set
CONFIG_SECURITY_TOMOYO=y
CONFIG_IMA=y
CONFIG_IMA_MEASURE_PCR_IDX=10
CONFIG_IMA_AUDIT=y
CONFIG_XOR_BLOCKS=m
CONFIG_ASYNC_CORE=m
CONFIG_ASYNC_MEMCPY=m
CONFIG_ASYNC_XOR=m
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=m
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_CRYPTO_CRYPTD=m
CONFIG_CRYPTO_AUTHENC=y
CONFIG_CRYPTO_TEST=m

#
# Authenticated Encryption with Associated Data
#
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_SEQIV=y

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_PCBC=m
# CONFIG_CRYPTO_XTS is not set
CONFIG_CRYPTO_FPU=m

#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32C_INTEL is not set
CONFIG_CRYPTO_MD4=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=y
CONFIG_CRYPTO_RMD128=m
CONFIG_CRYPTO_RMD160=m
CONFIG_CRYPTO_RMD256=m
CONFIG_CRYPTO_RMD320=m
CONFIG_CRYPTO_SHA1=y
# CONFIG_CRYPTO_SHA256 is not set
CONFIG_CRYPTO_SHA512=y
# CONFIG_CRYPTO_TGR192 is not set
CONFIG_CRYPTO_WP512=m

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_AES_X86_64=y
CONFIG_CRYPTO_AES_NI_INTEL=m
# CONFIG_CRYPTO_ANUBIS is not set
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAST5=m
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_FCRYPT is not set
CONFIG_CRYPTO_KHAZAD=y
# CONFIG_CRYPTO_SALSA20 is not set
CONFIG_CRYPTO_SALSA20_X86_64=m
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
CONFIG_CRYPTO_TEA=y
# CONFIG_CRYPTO_TWOFISH is not set
CONFIG_CRYPTO_TWOFISH_COMMON=m
CONFIG_CRYPTO_TWOFISH_X86_64=m

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=m
CONFIG_CRYPTO_LZO=y

#
# Random Number Generation
#
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_HW=y
# CONFIG_CRYPTO_DEV_PADLOCK is not set
# CONFIG_CRYPTO_DEV_HIFN_795X is not set
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_TRACE=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_BALLOON=y
# CONFIG_BINARY_PRINTF is not set

#
# 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=m
CONFIG_CRC16=m
CONFIG_CRC_T10DIF=m
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
CONFIG_LIBCRC32C=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=m
CONFIG_TEXTSEARCH_BM=m
CONFIG_TEXTSEARCH_FSM=m
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_CPUMASK_OFFSTACK=y
CONFIG_NLATTR=y

[-- Attachment #3: crash.log --]
[-- Type: text/plain, Size: 24130 bytes --]

[    0.000000] Linux version 2.6.31-rc8-tip (mingo@aldebaran) (gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) ) #1613 SMP Thu Sep 3 19:09:03 CEST 2009
[    0.000000] Command line: root=/dev/sda1 console=ttyS0,115200 3 profile=0 debug initcall_debug apic=debug apic=verbose ignore_loglevel sysrq_always_enabled pci=nomsi
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] KERNEL supported cpus:
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] CPU: vendor_id 'GenuineIntel' unknown, using generic init.
[    0.000000] CPU: Your system may be unstable.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[    0.000000]  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000003ed94000 (usable)
[    0.000000]  BIOS-e820: 000000003ed94000 - 000000003ee4e000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000003ee4e000 - 000000003fea2000 (usable)
[    0.000000]  BIOS-e820: 000000003fea2000 - 000000003fee9000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000003fee9000 - 000000003feed000 (usable)
[    0.000000]  BIOS-e820: 000000003feed000 - 000000003feff000 (ACPI data)
[    0.000000]  BIOS-e820: 000000003feff000 - 000000003ff00000 (usable)
[    0.000000] DMI 2.3 present.
[    0.000000] last_pfn = 0x3ff00 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-FFFFF uncachable
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000 mask FC0000000 write-back
[    0.000000]   1 base 03FF00000 mask FFFF00000 uncachable
[    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] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    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 - 000000000009fc00 (usable)
[    0.000000]  modified: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  modified: 00000000000e0000 - 0000000000100000 (reserved)
[    0.000000]  modified: 0000000000100000 - 000000003ed94000 (usable)
[    0.000000]  modified: 000000003ed94000 - 000000003ee4e000 (ACPI NVS)
[    0.000000]  modified: 000000003ee4e000 - 000000003fea2000 (usable)
[    0.000000]  modified: 000000003fea2000 - 000000003fee9000 (ACPI NVS)
[    0.000000]  modified: 000000003fee9000 - 000000003feed000 (usable)
[    0.000000]  modified: 000000003feed000 - 000000003feff000 (ACPI data)
[    0.000000]  modified: 000000003feff000 - 000000003ff00000 (usable)
[    0.000000] initial memory mapped : 0 - 20000000
[    0.000000] init_memory_mapping: 0000000000000000-000000003ff00000
[    0.000000]  0000000000 - 003ff00000 page 4k
[    0.000000] kernel direct mapping tables up to 3ff00000 @ 100000-302000
[    0.000000] ACPI: RSDP 00000000000fe020 00014 (v00 INTEL )
[    0.000000] ACPI: RSDT 000000003fefde48 00050 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: FACP 000000003fefcf10 00074 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: DSDT 000000003fef8010 03E70 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: FACS 000000003fedfc40 00040
[    0.000000] ACPI: APIC 000000003fefce10 00078 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: WDDT 000000003fef7f90 00040 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: MCFG 000000003fef7f10 0003C (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: ASF! 000000003fefcd10 000A6 (v32 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: HPET 000000003fef7e90 00038 (v01 INTEL  D975XBX  000004B9 MSFT 01000013)
[    0.000000] ACPI: SSDT 000000003fefdc10 001BC (v01 INTEL     CpuPm 000004B9 MSFT 01000013)
[    0.000000] ACPI: SSDT 000000003fefda10 001B7 (v01 INTEL   Cpu0Ist 000004B9 MSFT 01000013)
[    0.000000] ACPI: SSDT 000000003fefd810 001B7 (v01 INTEL   Cpu1Ist 000004B9 MSFT 01000013)
[    0.000000] ACPI: SSDT 000000003fefd610 001B7 (v01 INTEL   Cpu2Ist 000004B9 MSFT 01000013)
[    0.000000] ACPI: SSDT 000000003fefd410 001B7 (v01 INTEL   Cpu3Ist 000004B9 MSFT 01000013)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] (6 early reservations) ==> bootmem [0000000000 - 003ff00000]
[    0.000000]   #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
[    0.000000]   #1 [0000006000 - 0000008000]       TRAMPOLINE ==> [0000006000 - 0000008000]
[    0.000000]   #2 [0001000000 - 0007200d20]    TEXT DATA BSS ==> [0001000000 - 0007200d20]
[    0.000000]   #3 [000009fc00 - 0000100000]    BIOS reserved ==> [000009fc00 - 0000100000]
[    0.000000]   #4 [0007201000 - 000720122c]              BRK ==> [0007201000 - 000720122c]
[    0.000000]   #5 [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 [ffff8800000fe680] fe680
[    0.000000]   mpc: fe690-fe6d0
[    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[6] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00000001
[    0.000000]     0: 0x00000006 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0003ed94
[    0.000000]     0: 0x0003ee4e -> 0x0003fea2
[    0.000000]     0: 0x0003fee9 -> 0x0003feed
[    0.000000]     0: 0x0003feff -> 0x0003ff00
[    0.000000] On node 0 totalpages: 261511
[    0.000000]   DMA zone: 104 pages used for memmap
[    0.000000]   DMA zone: 611 pages reserved
[    0.000000]   DMA zone: 3279 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 6546 pages used for memmap
[    0.000000]   DMA32 zone: 250971 pages, LIFO batch:31
[    0.000000] ACPI: PM-Timer IO Port: 0x408
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x02] dfl dfl lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] SMP: Allowing 4 CPUs, 2 hotplug CPUs
[    0.000000] mapped APIC to ffffffffff5fc000 (fee00000)
[    0.000000] mapped IOAPIC to ffffffffff5fb000 (fec00000)
[    0.000000] nr_irqs_gsi: 24
[    0.000000] PM: Registered nosave memory: 0000000000001000 - 0000000000006000
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e0000
[    0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000
[    0.000000] PM: Registered nosave memory: 000000003ed94000 - 000000003ee4e000
[    0.000000] PM: Registered nosave memory: 000000003fea2000 - 000000003fee9000
[    0.000000] PM: Registered nosave memory: 000000003feed000 - 000000003feff000
[    0.000000] Allocating PCI resources starting at 3ff00000 (gap: 3ff00000:c0100000)
[    0.000000] NR_CPUS:4096 nr_cpumask_bits:4 nr_cpu_ids:4 nr_node_ids:1
[    0.000000] PERCPU: Embedded 486 pages at ffff880009004000, static data 1959456 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 254250
[    0.000000] Kernel command line: root=/dev/sda1 console=ttyS0,115200 3 profile=0 debug initcall_debug apic=debug apic=verbose ignore_loglevel sysrq_always_enabled pci=nomsi
[    0.000000] debug: sysrq always enabled.
[    0.000000] PID hash table entries: 4096 (order: 12, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Memory: 906828k/1047552k available (8977k kernel code, 1508k absent, 138524k reserved, 7356k data, 2420k init)
[    0.000000] SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] RCU-based detection of stalled CPUs is enabled.
[    0.000000] NR_IRQS:4352
[    0.000000] kmemleak: Early log buffer exceeded
[    0.000000] kmemleak: Kernel memory leak detector disabled
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.000000] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.000000] ... MAX_LOCK_DEPTH:          48
[    0.000000] ... MAX_LOCKDEP_KEYS:        8191
[    0.000000] ... CLASSHASH_SIZE:          4096
[    0.000000] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.000000] ... MAX_LOCKDEP_CHAINS:      32768
[    0.000000] ... CHAINHASH_SIZE:          16384
[    0.000000]  memory used by lock dependency info: 6367 kB
[    0.000000]  per task-struct memory footprint: 2688 bytes
[    0.000000] ------------------------
[    0.000000] | Locking API testsuite:
[    0.000000] ----------------------------------------------------------------------------
[    0.000000]                                  | spin |wlock |rlock |mutex | wsem | rsem |
[    0.000000]   --------------------------------------------------------------------------
[    0.000000]                      A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]                  A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]              A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]              A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]          A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]          A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]          A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]                     double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]                   initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]                  bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
[    0.000000]   --------------------------------------------------------------------------
[    0.000000]               recursive read-lock:             |  ok  |             |  ok  |
[    0.000000]            recursive read-lock #2:             |  ok  |             |  ok  |
[    0.000000]             mixed read-write-lock:             |  ok  |             |  ok  |
[    0.000000]             mixed write-read-lock:             |  ok  |             |  ok  |
[    0.000000]   --------------------------------------------------------------------------
[    0.000000]      hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
[    0.000000]      soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
[    0.000000]      hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
[    0.000000]      soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
[    0.000000]        sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
[    0.000000]        sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
[    0.000000]          hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
[    0.000000]          soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
[    0.000000]          hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
[    0.000000]          soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
[    0.000000]     hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
[    0.000000]     soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
[    0.000000]       soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
[    0.000000]       hard-irq read-recursion/123:  ok  |
[    0.000000]       soft-irq read-recursion/123:  ok  |
[    0.000000]       hard-irq read-recursion/132:  ok  |
[    0.000000]       soft-irq read-recursion/132:  ok  |
[    0.000000]       hard-irq read-recursion/213:  ok  |
[    0.000000]       soft-irq read-recursion/213:  ok  |
[    0.000000]       hard-irq read-recursion/231:  ok  |
[    0.000000]       soft-irq read-recursion/231:  ok  |
[    0.000000]       hard-irq read-recursion/312:  ok  |
[    0.000000]       soft-irq read-recursion/312:  ok  |
[    0.000000]       hard-irq read-recursion/321:  ok  |
[    0.000000]       soft-irq read-recursion/321:  ok  |
[    0.000000] -------------------------------------------------------
[    0.000000] Good, all 218 testcases passed! |
[    0.000000] ---------------------------------
[    0.000000] hpet clockevent registered
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 2933.228 MHz processor.
[    0.000000] Marking TSC unstable due to TSCs unsynchronized
[    0.025564] Calibrating delay loop (skipped), value calculated using timer frequency.. 5866.45 BogoMIPS (lpj=29332280)
[    0.032958] Security Framework initialized
[    0.040018] TOMOYO Linux initialized
[    0.043671] Mount-cache hash table entries: 256
[    0.050918] CPU: L1 I Cache: 0K (0 bytes/line), D cache 0K (0 bytes/line)
[    0.057676] CPU: L2 Cache: 4096K (64 bytes/line)
[    0.060005] CPU: Physical Processor ID: 0
[    0.063995] CPU: Processor Core ID: 0
[    0.070005] mce: CPU supports 6 MCE banks
[    0.073998] MCE: unknown CPU type - not enabling MCE support.
[    0.080005] using mwait in idle threads.
[    0.083906] Performance Counters: 
[    0.087146] ACPI: Core revision 20090521
[    0.103609] Setting APIC routing to flat
[    0.107518] enabled ExtINT on CPU#0
[    0.110160] ENABLING IO-APIC IRQs
[    0.113460] init IO_APIC IRQs
[    0.116413]  2-0 (apicid-pin) not connected
[    0.120014] IOAPIC[0]: Set routing entry (2-1 -> 0x31 -> IRQ 1 Mode:0 Active:0)
[    0.127298] IOAPIC[0]: Set routing entry (2-2 -> 0x30 -> IRQ 0 Mode:0 Active:0)
[    0.130010] IOAPIC[0]: Set routing entry (2-3 -> 0x33 -> IRQ 3 Mode:0 Active:0)
[    0.140008] IOAPIC[0]: Set routing entry (2-4 -> 0x34 -> IRQ 4 Mode:0 Active:0)
[    0.150008] IOAPIC[0]: Set routing entry (2-5 -> 0x35 -> IRQ 5 Mode:0 Active:0)
[    0.157292] IOAPIC[0]: Set routing entry (2-6 -> 0x36 -> IRQ 6 Mode:0 Active:0)
[    0.160008] IOAPIC[0]: Set routing entry (2-7 -> 0x37 -> IRQ 7 Mode:0 Active:0)
[    0.170008] IOAPIC[0]: Set routing entry (2-8 -> 0x38 -> IRQ 8 Mode:0 Active:0)
[    0.177292] IOAPIC[0]: Set routing entry (2-9 -> 0x39 -> IRQ 9 Mode:1 Active:0)
[    0.180008] IOAPIC[0]: Set routing entry (2-10 -> 0x3a -> IRQ 10 Mode:0 Active:0)
[    0.190008] IOAPIC[0]: Set routing entry (2-11 -> 0x3b -> IRQ 11 Mode:0 Active:0)
[    0.200008] IOAPIC[0]: Set routing entry (2-12 -> 0x3c -> IRQ 12 Mode:0 Active:0)
[    0.207465] IOAPIC[0]: Set routing entry (2-13 -> 0x3d -> IRQ 13 Mode:0 Active:0)
[    0.210008] IOAPIC[0]: Set routing entry (2-14 -> 0x3e -> IRQ 14 Mode:0 Active:0)
[    0.220008] IOAPIC[0]: Set routing entry (2-15 -> 0x3f -> IRQ 15 Mode:0 Active:0)
[    0.230006]  2-16 2-17 2-18 2-19 2-20 2-21 2-22 2-23 (apicid-pin) not connected
[    0.237799] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.345462] CPU0: GenuineIntel Intel(R) Core(TM)2 CPU         E6800  @ 2.93GHz stepping 05
[    0.351225] Using local APIC timer interrupts.
[    0.351226] calibrating APIC timer ...
[    0.370000] ... lapic delta = 1666650
[    0.370000] ... PM-Timer delta = 357952
[    0.370000] ... PM-Timer result ok
[    0.370000] ..... delta 1666650
[    0.370000] ..... mult: 71582072
[    0.370000] ..... calibration result: 2666640
[    0.370000] ..... CPU clock speed is 2933.3021 MHz.
[    0.370000] ..... host bus clock speed is 266.6640 MHz.
[    0.370014] calling  migration_init+0x0/0x77 @ 1
[    0.374756] initcall migration_init+0x0/0x77 returned 0 after 0 usecs
[    0.380005] calling  spawn_ksoftirqd+0x0/0x74 @ 1
[    0.384734] initcall spawn_ksoftirqd+0x0/0x74 returned 0 after 0 usecs
[    0.390006] calling  init_call_single_data+0x0/0xf5 @ 1
[    0.395214] initcall init_call_single_data+0x0/0xf5 returned 0 after 0 usecs
[    0.400004] calling  spawn_softlockup_task+0x0/0xa5 @ 1
[    0.405247] initcall spawn_softlockup_task+0x0/0xa5 returned 0 after 0 usecs
[    0.410004] calling  relay_init+0x0/0x40 @ 1
[    0.420005] initcall relay_init+0x0/0x40 returned 0 after 0 usecs
[    0.426355] lockdep: fixing up alternatives.
[    0.430110] Booting processor 1 APIC 0x1 ip 0x6000
[    0.030000] Initializing CPU#1
[    0.030000] masked ExtINT on CPU#1
[    0.520060] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[    0.530000] IP: [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000] PGD 0 
[    0.530000] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[    0.530000] last sysfs file: 
[    0.530000] CPU 0 
[    0.530000] Modules linked in:
[    0.530000] Pid: 1, comm: swapper Not tainted 2.6.31-rc8-tip #1613         
[    0.530000] RIP: 0010:[<ffffffff81071317>]  [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000] RSP: 0018:ffff880009007d40  EFLAGS: 00010246
[    0.530000] RAX: 0000000000000000 RBX: ffffffff81e1d0c0 RCX: 0000000000000000
[    0.530000] RDX: ffffffff824a1fa0 RSI: 0000000000000000 RDI: 0000000000000000
[    0.530000] RBP: ffff880009007d50 R08: 0000000000000000 R09: 0000000000000000
[    0.530000] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000025cb39a8
[    0.530000] R13: ffffffff824a0c40 R14: ffff880009007e50 R15: 0000000000000100
[    0.530000] FS:  0000000000000000(0000) GS:ffff880009004000(0000) knlGS:0000000000000000
[    0.530000] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    0.530000] CR2: 0000000000000020 CR3: 0000000001001000 CR4: 00000000000006b0
[    0.530000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    0.530000] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    0.530000] Process swapper (pid: 1, threadinfo ffff88003f0da000, task ffff88003f0e0000)
[    0.530000] Stack:
[    0.530000]  ffffffff824a0c40 00000000b4b7426a ffff880009007d70 ffffffff8107157d
[    0.530000] <0> ffffffff81083846 00000000b4b7426a ffff880009007d90 ffffffff810715c9
[    0.530000] <0> 0000000000000000 00000000b4b7426a ffff880009007dc0 ffffffff81083927
[    0.530000] Call Trace:
[    0.530000]  <IRQ> 
[    0.530000]  [<ffffffff8107157d>] queue_work+0x2d/0x50
[    0.530000]  [<ffffffff81083846>] ? clocksource_watchdog+0x26/0x240
[    0.530000]  [<ffffffff810715c9>] schedule_work+0x29/0x50
[    0.530000]  [<ffffffff81083927>] clocksource_watchdog+0x107/0x240
[    0.530000]  [<ffffffff81065eee>] run_timer_softirq+0x21e/0x380
[    0.530000]  [<ffffffff81065e29>] ? run_timer_softirq+0x159/0x380
[    0.530000]  [<ffffffff81083820>] ? clocksource_watchdog+0x0/0x240
[    0.530000]  [<ffffffff810600aa>] __do_softirq+0x10a/0x200
[    0.530000]  [<ffffffff8100cb1c>] call_softirq+0x1c/0x90
[    0.530000]  [<ffffffff8100e955>] do_softirq+0x95/0xc0
[    0.530000]  [<ffffffff8105f4c5>] irq_exit+0x75/0x90
[    0.530000]  [<ffffffff81029c20>] smp_apic_timer_interrupt+0x80/0xd0
[    0.530000]  [<ffffffff8100c4f3>] apic_timer_interrupt+0x13/0x20
[    0.530000]  <EOI> 
[    0.530000]  [<ffffffff812ff997>] ? delay_tsc+0x47/0x80
[    0.530000]  [<ffffffff812ffab4>] ? __const_udelay+0x64/0x80
[    0.530000]  [<ffffffff818b3fff>] ? do_boot_cpu+0x498/0x6b3
[    0.530000]  [<ffffffff818b4567>] ? do_fork_idle+0x0/0x56
[    0.530000]  [<ffffffff810468d2>] ? complete+0x32/0x80
[    0.530000]  [<ffffffff818b4375>] ? native_cpu_up+0x15b/0x208
[    0.530000]  [<ffffffff818b69d8>] ? _cpu_up+0xf3/0x1a4
[    0.530000]  [<ffffffff818b6b4d>] ? cpu_up+0xc4/0xd7
[    0.530000]  [<ffffffff821d3f97>] ? smp_init+0x118/0x126
[    0.530000]  [<ffffffff821d40c7>] ? kernel_init+0x82/0xec
[    0.530000]  [<ffffffff8100ca1a>] ? child_rip+0xa/0x20
[    0.530000]  [<ffffffff8100c3bc>] ? restore_args+0x0/0x30
[    0.530000]  [<ffffffff821d4045>] ? kernel_init+0x0/0xec
[    0.530000]  [<ffffffff8100ca10>] ? child_rip+0x0/0x20
[    0.530000] Code: ff 0f 1f 00 55 41 89 f8 48 89 e5 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 45 f8 31 c0 f0 0f ba 2a 00 19 c0 31 c9 85 c0 75 2a <44> 8b 4e 20 48 8b 3e 48 89 d6 45 85 c9 44 0f 45 05 b4 f4 f7 00 
[    0.530000] RIP  [<ffffffff81071317>] queue_work_on+0x27/0x70
[    0.530000]  RSP <ffff880009007d40>
[    0.530000] CR2: 0000000000000020
[    0.530006] ---[ end trace a7919e7f17c0a725 ]---
[    0.540001] Kernel panic - not syncing: Fatal exception in interrupt

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

* Re: [boot crash] Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-09-03 18:17                     ` [boot crash] " Ingo Molnar
@ 2009-09-03 18:21                       ` Ingo Molnar
  2009-09-03 18:58                       ` Ingo Molnar
  1 sibling, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-03 18:21 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Martin Schwidefsky, mingo, hpa, linux-kernel, johnstul,
	linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> -tip testing found the following boot crash on a 64-bit x86 system:
> 
> [    0.405247] initcall spawn_softlockup_task+0x0/0xa5 returned 0 after 0 usecs
> [    0.410004] calling  relay_init+0x0/0x40 @ 1
> [    0.420005] initcall relay_init+0x0/0x40 returned 0 after 0 usecs
> [    0.426355] lockdep: fixing up alternatives.
> [    0.430110] Booting processor 1 APIC 0x1 ip 0x6000
> [    0.030000] Initializing CPU#1
> [    0.030000] masked ExtINT on CPU#1
> [    0.520060] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
> [    0.530000] IP: [<ffffffff81071317>] queue_work_on+0x27/0x70
> [    0.530000] PGD 0 
> [    0.530000] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
> [    0.530000] last sysfs file: 
> [    0.530000] CPU 0 
> [    0.530000] Modules linked in:
> [    0.530000] Pid: 1, comm: swapper Not tainted 2.6.31-rc8-tip #1613         
> [    0.530000] RIP: 0010:[<ffffffff81071317>]  [<ffffffff81071317>] queue_work_on+0x27/0x70
> [    0.530000] RSP: 0018:ffff880009007d40  EFLAGS: 00010246
> [    0.530000] RAX: 0000000000000000 RBX: ffffffff81e1d0c0 RCX: 0000000000000000
> [    0.530000] RDX: ffffffff824a1fa0 RSI: 0000000000000000 RDI: 0000000000000000
> [    0.530000] RBP: ffff880009007d50 R08: 0000000000000000 R09: 0000000000000000
> [    0.530000] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000025cb39a8
> [    0.530000] R13: ffffffff824a0c40 R14: ffff880009007e50 R15: 0000000000000100
> [    0.530000] FS:  0000000000000000(0000) GS:ffff880009004000(0000) knlGS:0000000000000000
> [    0.530000] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
> [    0.530000] CR2: 0000000000000020 CR3: 0000000001001000 CR4: 00000000000006b0
> [    0.530000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [    0.530000] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> [    0.530000] Process swapper (pid: 1, threadinfo ffff88003f0da000, task ffff88003f0e0000)
> [    0.530000] Stack:
> [    0.530000]  ffffffff824a0c40 00000000b4b7426a ffff880009007d70 ffffffff8107157d
> [    0.530000] <0> ffffffff81083846 00000000b4b7426a ffff880009007d90 ffffffff810715c9
> [    0.530000] <0> 0000000000000000 00000000b4b7426a ffff880009007dc0 ffffffff81083927
> [    0.530000] Call Trace:
> [    0.530000]  <IRQ> 
> [    0.530000]  [<ffffffff8107157d>] queue_work+0x2d/0x50
> [    0.530000]  [<ffffffff81083846>] ? clocksource_watchdog+0x26/0x240
> [    0.530000]  [<ffffffff810715c9>] schedule_work+0x29/0x50
> [    0.530000]  [<ffffffff81083927>] clocksource_watchdog+0x107/0x240
> [    0.530000]  [<ffffffff81065eee>] run_timer_softirq+0x21e/0x380
> [    0.530000]  [<ffffffff81065e29>] ? run_timer_softirq+0x159/0x380
> [    0.530000]  [<ffffffff81083820>] ? clocksource_watchdog+0x0/0x240
> [    0.530000]  [<ffffffff810600aa>] __do_softirq+0x10a/0x200
> [    0.530000]  [<ffffffff8100cb1c>] call_softirq+0x1c/0x90
> [    0.530000]  [<ffffffff8100e955>] do_softirq+0x95/0xc0
> [    0.530000]  [<ffffffff8105f4c5>] irq_exit+0x75/0x90
> [    0.530000]  [<ffffffff81029c20>] smp_apic_timer_interrupt+0x80/0xd0
> [    0.530000]  [<ffffffff8100c4f3>] apic_timer_interrupt+0x13/0x20
> [    0.530000]  <EOI> 
> [    0.530000]  [<ffffffff812ff997>] ? delay_tsc+0x47/0x80
> [    0.530000]  [<ffffffff812ffab4>] ? __const_udelay+0x64/0x80
> [    0.530000]  [<ffffffff818b3fff>] ? do_boot_cpu+0x498/0x6b3
> [    0.530000]  [<ffffffff818b4567>] ? do_fork_idle+0x0/0x56
> [    0.530000]  [<ffffffff810468d2>] ? complete+0x32/0x80
> [    0.530000]  [<ffffffff818b4375>] ? native_cpu_up+0x15b/0x208
> [    0.530000]  [<ffffffff818b69d8>] ? _cpu_up+0xf3/0x1a4
> [    0.530000]  [<ffffffff818b6b4d>] ? cpu_up+0xc4/0xd7
> [    0.530000]  [<ffffffff821d3f97>] ? smp_init+0x118/0x126
> [    0.530000]  [<ffffffff821d40c7>] ? kernel_init+0x82/0xec
> [    0.530000]  [<ffffffff8100ca1a>] ? child_rip+0xa/0x20

btw., the crash itself seems to happen because we got a timer IRQ on 
CPU#0, which tries to queue work to CPU#1 but CPU#1 is not fully 
initialized yet?

	Ingo

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

* Re: [boot crash] Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-09-03 18:17                     ` [boot crash] " Ingo Molnar
  2009-09-03 18:21                       ` Ingo Molnar
@ 2009-09-03 18:58                       ` Ingo Molnar
  2009-09-08 21:43                         ` john stultz
  1 sibling, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-03 18:58 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Martin Schwidefsky, mingo, hpa, linux-kernel, johnstul,
	linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> i tried to bisect it but it's inconclusive:
> 
>  # bad:  [32beef9c] Merge branch 'perfcounters/core'
>  # bad:  [b6413360] manual merge of x86/platform
>  # bad:  [d9e5f39a] Merge branch 'auto-oprofile-next' into auto-latest
>  # bad:  [cbaff272] Merge branch 'auto-timers-next' into auto-latest
> 
> as the bisection comes up with that merge commit. Perhaps the 
> combination of the x86/platform changes and the clocksource 
> changes triggered it?

That seems to be the case - i just tested a combination merge of 
tip:auto-timers-next and tip:auto-x86-next and the result crashed in 
a similar way too.

Since normal bisection cannot find such breakages, i did a topical 
bisection (merging the finegrained tip:x86/* topics into the timer 
tree gradually and testing each merge).

That way i could exclude: x86/platform, x86/pat, x86/asm, x86/apic, 
x86/percpu, x86/cpu, x86/mm and arrived to x86/tsc - which contains 
a single commit:

  d3b8f88: x86: Make tsc=reliable override boot time stability checks

Reverting that commit from tip:master gives me a non-crashing 
bootup.

	Ingo

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

* [tip:sched/balancing] sched: Clean up topology.h
       [not found]             ` <new-submission>
                                 ` (326 preceding siblings ...)
  2009-09-03 16:55               ` [tip:perfcounters/core] perf_counter: Fix output-sharing error path tip-bot for Ingo Molnar
@ 2009-09-04 10:25               ` tip-bot for Ingo Molnar
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_BALANCE_NEWIDLE tip-bot for Ingo Molnar
                                 ` (378 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-04 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, ego, hpa, mingo, andreas.herrmann3, a.p.zijlstra,
	balbir, tglx, mingo

Commit-ID:  47734f89be0614b5acbd6a532390f9c72f019648
Gitweb:     http://git.kernel.org/tip/47734f89be0614b5acbd6a532390f9c72f019648
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 4 Sep 2009 11:21:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 11:52:53 +0200

sched: Clean up topology.h

Re-organize the flag settings so that it's visible at a glance
which sched-domains flags are set and which not.

With the new balancer code we'll need to re-tune these details
anyway, so make it cleaner to make fewer mistakes down the
road ;-)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/include/asm/topology.h |   47 +++++++-----
 include/linux/topology.h        |  169 +++++++++++++++++++++++----------------
 2 files changed, 129 insertions(+), 87 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 066ef59..be29eb8 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -129,25 +129,34 @@ extern unsigned long node_remap_size[];
 #endif
 
 /* sched_domains SD_NODE_INIT for NUMA machines */
-#define SD_NODE_INIT (struct sched_domain) {		\
-	.min_interval		= 8,			\
-	.max_interval		= 32,			\
-	.busy_factor		= 32,			\
-	.imbalance_pct		= 125,			\
-	.cache_nice_tries	= SD_CACHE_NICE_TRIES,	\
-	.busy_idx		= 3,			\
-	.idle_idx		= SD_IDLE_IDX,		\
-	.newidle_idx		= SD_NEWIDLE_IDX,	\
-	.wake_idx		= 1,			\
-	.forkexec_idx		= SD_FORKEXEC_IDX,	\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_FORK	\
-				| SD_WAKE_AFFINE	\
-				| SD_WAKE_BALANCE	\
-				| SD_SERIALIZE,		\
-	.last_balance		= jiffies,		\
-	.balance_interval	= 1,			\
+#define SD_NODE_INIT (struct sched_domain) {				\
+	.min_interval		= 8,					\
+	.max_interval		= 32,					\
+	.busy_factor		= 32,					\
+	.imbalance_pct		= 125,					\
+	.cache_nice_tries	= SD_CACHE_NICE_TRIES,			\
+	.busy_idx		= 3,					\
+	.idle_idx		= SD_IDLE_IDX,				\
+	.newidle_idx		= SD_NEWIDLE_IDX,			\
+	.wake_idx		= 1,					\
+	.forkexec_idx		= SD_FORKEXEC_IDX,			\
+									\
+	.flags			= 1*SD_LOAD_BALANCE			\
+				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_EXEC			\
+				| 1*SD_BALANCE_FORK			\
+				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_BALANCE			\
+				| 0*SD_SHARE_CPUPOWER			\
+				| 0*SD_POWERSAVINGS_BALANCE		\
+				| 0*SD_SHARE_PKG_RESOURCES		\
+				| 1*SD_SERIALIZE			\
+				| 0*SD_WAKE_IDLE_FAR			\
+				| 0*SD_PREFER_SIBLING			\
+				,					\
+	.last_balance		= jiffies,				\
+	.balance_interval	= 1,					\
 }
 
 #ifdef CONFIG_X86_64_ACPI_NUMA
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 6203ae5..fe2c032 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -85,21 +85,29 @@ int arch_update_cpu_topology(void);
 #define ARCH_HAS_SCHED_WAKE_IDLE
 /* Common values for SMT siblings */
 #ifndef SD_SIBLING_INIT
-#define SD_SIBLING_INIT (struct sched_domain) {		\
-	.min_interval		= 1,			\
-	.max_interval		= 2,			\
-	.busy_factor		= 64,			\
-	.imbalance_pct		= 110,			\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_NEWIDLE	\
-				| SD_BALANCE_FORK	\
-				| SD_BALANCE_EXEC	\
-				| SD_WAKE_AFFINE	\
-				| SD_WAKE_BALANCE	\
-				| SD_SHARE_CPUPOWER,	\
-	.last_balance		= jiffies,		\
-	.balance_interval	= 1,			\
-	.smt_gain		= 1178,	/* 15% */	\
+#define SD_SIBLING_INIT (struct sched_domain) {				\
+	.min_interval		= 1,					\
+	.max_interval		= 2,					\
+	.busy_factor		= 64,					\
+	.imbalance_pct		= 110,					\
+									\
+	.flags			= 1*SD_LOAD_BALANCE			\
+				| 1*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_EXEC			\
+				| 1*SD_BALANCE_FORK			\
+				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_BALANCE			\
+				| 1*SD_SHARE_CPUPOWER			\
+				| 0*SD_POWERSAVINGS_BALANCE		\
+				| 0*SD_SHARE_PKG_RESOURCES		\
+				| 0*SD_SERIALIZE			\
+				| 0*SD_WAKE_IDLE_FAR			\
+				| 0*SD_PREFER_SIBLING			\
+				,					\
+	.last_balance		= jiffies,				\
+	.balance_interval	= 1,					\
+	.smt_gain		= 1178,	/* 15% */			\
 }
 #endif
 #endif /* CONFIG_SCHED_SMT */
@@ -107,69 +115,94 @@ int arch_update_cpu_topology(void);
 #ifdef CONFIG_SCHED_MC
 /* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
 #ifndef SD_MC_INIT
-#define SD_MC_INIT (struct sched_domain) {		\
-	.min_interval		= 1,			\
-	.max_interval		= 4,			\
-	.busy_factor		= 64,			\
-	.imbalance_pct		= 125,			\
-	.cache_nice_tries	= 1,			\
-	.busy_idx		= 2,			\
-	.wake_idx		= 1,			\
-	.forkexec_idx		= 1,			\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_FORK	\
-				| SD_BALANCE_EXEC	\
-				| SD_WAKE_AFFINE	\
-				| SD_WAKE_BALANCE	\
-				| SD_SHARE_PKG_RESOURCES\
-				| sd_balance_for_mc_power()\
-				| sd_power_saving_flags(),\
-	.last_balance		= jiffies,		\
-	.balance_interval	= 1,			\
+#define SD_MC_INIT (struct sched_domain) {				\
+	.min_interval		= 1,					\
+	.max_interval		= 4,					\
+	.busy_factor		= 64,					\
+	.imbalance_pct		= 125,					\
+	.cache_nice_tries	= 1,					\
+	.busy_idx		= 2,					\
+	.wake_idx		= 1,					\
+	.forkexec_idx		= 1,					\
+									\
+	.flags			= 1*SD_LOAD_BALANCE			\
+				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_EXEC			\
+				| 1*SD_BALANCE_FORK			\
+				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_BALANCE			\
+				| 0*SD_SHARE_CPUPOWER			\
+				| 1*SD_SHARE_PKG_RESOURCES		\
+				| 0*SD_SERIALIZE			\
+				| 0*SD_WAKE_IDLE_FAR			\
+				| sd_balance_for_mc_power()		\
+				| sd_power_saving_flags()		\
+				,					\
+	.last_balance		= jiffies,				\
+	.balance_interval	= 1,					\
 }
 #endif
 #endif /* CONFIG_SCHED_MC */
 
 /* Common values for CPUs */
 #ifndef SD_CPU_INIT
-#define SD_CPU_INIT (struct sched_domain) {		\
-	.min_interval		= 1,			\
-	.max_interval		= 4,			\
-	.busy_factor		= 64,			\
-	.imbalance_pct		= 125,			\
-	.cache_nice_tries	= 1,			\
-	.busy_idx		= 2,			\
-	.idle_idx		= 1,			\
-	.newidle_idx		= 2,			\
-	.wake_idx		= 1,			\
-	.forkexec_idx		= 1,			\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_FORK	\
-				| SD_WAKE_AFFINE	\
-				| SD_WAKE_BALANCE	\
-				| sd_balance_for_package_power()\
-				| sd_power_saving_flags(),\
-	.last_balance		= jiffies,		\
-	.balance_interval	= 1,			\
+#define SD_CPU_INIT (struct sched_domain) {				\
+	.min_interval		= 1,					\
+	.max_interval		= 4,					\
+	.busy_factor		= 64,					\
+	.imbalance_pct		= 125,					\
+	.cache_nice_tries	= 1,					\
+	.busy_idx		= 2,					\
+	.idle_idx		= 1,					\
+	.newidle_idx		= 2,					\
+	.wake_idx		= 1,					\
+	.forkexec_idx		= 1,					\
+									\
+	.flags			= 1*SD_LOAD_BALANCE			\
+				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_EXEC			\
+				| 1*SD_BALANCE_FORK			\
+				| 0*SD_WAKE_IDLE			\
+				| 0*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_BALANCE			\
+				| 0*SD_SHARE_CPUPOWER			\
+				| 0*SD_SHARE_PKG_RESOURCES		\
+				| 0*SD_SERIALIZE			\
+				| 0*SD_WAKE_IDLE_FAR			\
+				| sd_balance_for_package_power()	\
+				| sd_power_saving_flags()		\
+				,					\
+	.last_balance		= jiffies,				\
+	.balance_interval	= 1,					\
 }
 #endif
 
 /* sched_domains SD_ALLNODES_INIT for NUMA machines */
-#define SD_ALLNODES_INIT (struct sched_domain) {	\
-	.min_interval		= 64,			\
-	.max_interval		= 64*num_online_cpus(),	\
-	.busy_factor		= 128,			\
-	.imbalance_pct		= 133,			\
-	.cache_nice_tries	= 1,			\
-	.busy_idx		= 3,			\
-	.idle_idx		= 3,			\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_NEWIDLE	\
-				| SD_WAKE_AFFINE	\
-				| SD_SERIALIZE,		\
-	.last_balance		= jiffies,		\
-	.balance_interval	= 64,			\
+#define SD_ALLNODES_INIT (struct sched_domain) {			\
+	.min_interval		= 64,					\
+	.max_interval		= 64*num_online_cpus(),			\
+	.busy_factor		= 128,					\
+	.imbalance_pct		= 133,					\
+	.cache_nice_tries	= 1,					\
+	.busy_idx		= 3,					\
+	.idle_idx		= 3,					\
+	.flags			= 1*SD_LOAD_BALANCE			\
+				| 1*SD_BALANCE_NEWIDLE			\
+				| 0*SD_BALANCE_EXEC			\
+				| 0*SD_BALANCE_FORK			\
+				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_AFFINE			\
+				| 0*SD_WAKE_BALANCE			\
+				| 0*SD_SHARE_CPUPOWER			\
+				| 0*SD_POWERSAVINGS_BALANCE		\
+				| 0*SD_SHARE_PKG_RESOURCES		\
+				| 1*SD_SERIALIZE			\
+				| 0*SD_WAKE_IDLE_FAR			\
+				| 0*SD_PREFER_SIBLING			\
+				,					\
+	.last_balance		= jiffies,				\
+	.balance_interval	= 64,					\
 }
 
 #ifdef CONFIG_NUMA

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

* [tip:sched/balancing] sched: Turn on SD_BALANCE_NEWIDLE
       [not found]             ` <new-submission>
                                 ` (327 preceding siblings ...)
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Clean up topology.h tip-bot for Ingo Molnar
@ 2009-09-04 10:25               ` tip-bot for Ingo Molnar
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_WAKE_IDLE for 'close' domains tip-bot for Ingo Molnar
                                 ` (377 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-04 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, ego, hpa, mingo, andreas.herrmann3, a.p.zijlstra,
	balbir, tglx, mingo

Commit-ID:  840a0653100dbde599ae8ddf83fa214dfa5fd1aa
Gitweb:     http://git.kernel.org/tip/840a0653100dbde599ae8ddf83fa214dfa5fd1aa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 4 Sep 2009 11:32:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 11:52:54 +0200

sched: Turn on SD_BALANCE_NEWIDLE

Start the re-tuning of the balancer by turning on newidle.

It improves hackbench performance and parallelism on a 4x4 box.
The "perf stat --repeat 10" measurements give us:

  domain0             domain1
  .......................................
 -SD_BALANCE_NEWIDLE -SD_BALANCE_NEWIDLE:
   2041.273208  task-clock-msecs         #      9.354 CPUs    ( +-   0.363% )

 +SD_BALANCE_NEWIDLE -SD_BALANCE_NEWIDLE:
   2086.326925  task-clock-msecs         #     11.934 CPUs    ( +-   0.301% )

 +SD_BALANCE_NEWIDLE +SD_BALANCE_NEWIDLE:
   2115.289791  task-clock-msecs         #     12.158 CPUs    ( +-   0.263% )

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/include/asm/topology.h |    2 +-
 include/linux/topology.h        |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index be29eb8..ef7bc7f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -142,7 +142,7 @@ extern unsigned long node_remap_size[];
 	.forkexec_idx		= SD_FORKEXEC_IDX,			\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
-				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_WAKE_IDLE			\
diff --git a/include/linux/topology.h b/include/linux/topology.h
index fe2c032..66774fd 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -126,7 +126,7 @@ int arch_update_cpu_topology(void);
 	.forkexec_idx		= 1,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
-				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_WAKE_IDLE			\
@@ -160,7 +160,7 @@ int arch_update_cpu_topology(void);
 	.forkexec_idx		= 1,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
-				| 0*SD_BALANCE_NEWIDLE			\
+				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_WAKE_IDLE			\

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

* [tip:sched/balancing] sched: Turn on SD_WAKE_IDLE for 'close' domains
       [not found]             ` <new-submission>
                                 ` (328 preceding siblings ...)
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_BALANCE_NEWIDLE tip-bot for Ingo Molnar
@ 2009-09-04 10:25               ` tip-bot for Ingo Molnar
  2009-09-04 15:42               ` [tip:perfcounters/core] perf stat: Change noise calculation to use stddev tip-bot for Peter Zijlstra
                                 ` (376 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-04 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, ego, hpa, mingo, andreas.herrmann3, a.p.zijlstra,
	balbir, tglx, mingo

Commit-ID:  e54c7073fae0683b90b3157e97142202c7334b79
Gitweb:     http://git.kernel.org/tip/e54c7073fae0683b90b3157e97142202c7334b79
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 4 Sep 2009 11:38:07 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 12:17:06 +0200

sched: Turn on SD_WAKE_IDLE for 'close' domains

Turn it on for the thread, core and cpu domain defaults.

Same argument as for NEWIDLE: we want to err on the side of
over-balancing, and mute the effect of that when it hurts
a workload.

On a NUMA box (4x4) i get better CPU utilization:

 Performance counter stats for './hackbench 10' (10 runs):

 Before:    2124.478000  task-clock-msecs         #     12.196 CPUs    ( +- 0.614% )
 After:     2232.558805  task-clock-msecs         #     12.601 CPUs    ( +- 0.852% )

It's probably not worth turning it on for the NUMA domain though,
as even on this fast-NUMA box it's break-even in terms of cost
versus improvement:

 After #2:  2288.062034  task-clock-msecs         #     12.909 CPUs    ( +- 0.864% )

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/topology.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/topology.h b/include/linux/topology.h
index 66774fd..f13ff3a 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -95,7 +95,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_IDLE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_WAKE_BALANCE			\
 				| 1*SD_SHARE_CPUPOWER			\
@@ -129,7 +129,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_IDLE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
@@ -163,7 +163,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_IDLE			\
 				| 0*SD_WAKE_AFFINE			\
 				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\

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

* [tip:perfcounters/core] perf stat: Change noise calculation to use stddev
       [not found]             ` <new-submission>
                                 ` (329 preceding siblings ...)
  2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_WAKE_IDLE for 'close' domains tip-bot for Ingo Molnar
@ 2009-09-04 15:42               ` tip-bot for Peter Zijlstra
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Remove the limit on repeat tip-bot for Peter Zijlstra
                                 ` (375 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-04 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  506d4bc8d5dab20d84624aa07cdc6dcd77915d52
Gitweb:     http://git.kernel.org/tip/506d4bc8d5dab20d84624aa07cdc6dcd77915d52
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Sep 2009 15:36:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 16:33:07 +0200

perf stat: Change noise calculation to use stddev

The current noise computation does:

 \Sum abs(n_i - avg(n)) * N^-1.5

Which is (afaik) not a regular noise function, and needs the
complete sample set available to post-process.

Change this to use a regular stddev computation which can be
done by keeping a two sums:

 stddev = sqrt( 1/N (\Sum n_i^2) - avg(n)^2 )

For which we only need to keep \Sum n_i and \Sum n_i^2.

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


---
 tools/perf/builtin-stat.c |  170 ++++++++++++++++++---------------------------
 1 files changed, 69 insertions(+), 101 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 1a26262..31ffc4d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -83,19 +83,32 @@ static u64			runtime_cycles[MAX_RUN];
 static u64			event_res[MAX_RUN][MAX_COUNTERS][3];
 static u64			event_scaled[MAX_RUN][MAX_COUNTERS];
 
-static u64			event_res_avg[MAX_COUNTERS][3];
-static u64			event_res_noise[MAX_COUNTERS][3];
+struct stats
+{
+	double sum;
+	double sum_sq;
+};
 
-static u64			event_scaled_avg[MAX_COUNTERS];
+static double avg_stats(struct stats *stats)
+{
+	return stats->sum / run_count;
+}
 
-static u64			runtime_nsecs_avg;
-static u64			runtime_nsecs_noise;
+/*
+ * stddev = sqrt(1/N (\Sum n_i^2) - avg(n)^2)
+ */
+static double stddev_stats(struct stats *stats)
+{
+	double avg = stats->sum / run_count;
 
-static u64			walltime_nsecs_avg;
-static u64			walltime_nsecs_noise;
+	return sqrt(stats->sum_sq/run_count - avg*avg);
+}
 
-static u64			runtime_cycles_avg;
-static u64			runtime_cycles_noise;
+struct stats			event_res_stats[MAX_COUNTERS][3];
+struct stats			event_scaled_stats[MAX_COUNTERS];
+struct stats			runtime_nsecs_stats;
+struct stats			walltime_nsecs_stats;
+struct stats			runtime_cycles_stats;
 
 #define MATCH_EVENT(t, c, counter)			\
 	(attrs[counter].type == PERF_TYPE_##t &&	\
@@ -279,42 +292,37 @@ static int run_perf_stat(int argc __used, const char **argv)
 	return WEXITSTATUS(status);
 }
 
-static void print_noise(u64 *count, u64 *noise)
+static void print_noise(double avg, double stddev)
 {
 	if (run_count > 1)
-		fprintf(stderr, "   ( +- %7.3f%% )",
-			(double)noise[0]/(count[0]+1)*100.0);
+		fprintf(stderr, "   ( +- %7.3f%% )", 100*stddev / avg);
 }
 
-static void nsec_printout(int counter, u64 *count, u64 *noise)
+static void nsec_printout(int counter, double avg, double stddev)
 {
-	double msecs = (double)count[0] / 1000000;
+	double msecs = avg / 1e6;
 
 	fprintf(stderr, " %14.6f  %-24s", msecs, event_name(counter));
 
 	if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) {
-		if (walltime_nsecs_avg)
-			fprintf(stderr, " # %10.3f CPUs ",
-				(double)count[0] / (double)walltime_nsecs_avg);
+		fprintf(stderr, " # %10.3f CPUs ",
+				avg / avg_stats(&walltime_nsecs_stats));
 	}
-	print_noise(count, noise);
+	print_noise(avg, stddev);
 }
 
-static void abs_printout(int counter, u64 *count, u64 *noise)
+static void abs_printout(int counter, double avg, double stddev)
 {
-	fprintf(stderr, " %14Ld  %-24s", count[0], event_name(counter));
+	fprintf(stderr, " %14.0f  %-24s", avg, event_name(counter));
 
-	if (runtime_cycles_avg &&
-	    MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
+	if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
 		fprintf(stderr, " # %10.3f IPC  ",
-			(double)count[0] / (double)runtime_cycles_avg);
+				avg / avg_stats(&runtime_cycles_stats));
 	} else {
-		if (runtime_nsecs_avg) {
-			fprintf(stderr, " # %10.3f M/sec",
-				(double)count[0]/runtime_nsecs_avg*1000.0);
-		}
+		fprintf(stderr, " # %10.3f M/sec",
+				1000.0 * avg / avg_stats(&runtime_nsecs_stats));
 	}
-	print_noise(count, noise);
+	print_noise(avg, stddev);
 }
 
 /*
@@ -322,12 +330,12 @@ static void abs_printout(int counter, u64 *count, u64 *noise)
  */
 static void print_counter(int counter)
 {
-	u64 *count, *noise;
+	double avg, stddev;
 	int scaled;
 
-	count = event_res_avg[counter];
-	noise = event_res_noise[counter];
-	scaled = event_scaled_avg[counter];
+	avg    = avg_stats(&event_res_stats[counter][0]);
+	stddev = stddev_stats(&event_res_stats[counter][0]);
+	scaled = avg_stats(&event_scaled_stats[counter]);
 
 	if (scaled == -1) {
 		fprintf(stderr, " %14s  %-24s\n",
@@ -336,36 +344,34 @@ static void print_counter(int counter)
 	}
 
 	if (nsec_counter(counter))
-		nsec_printout(counter, count, noise);
+		nsec_printout(counter, avg, stddev);
 	else
-		abs_printout(counter, count, noise);
+		abs_printout(counter, avg, stddev);
+
+	if (scaled) {
+		double avg_enabled, avg_running;
+
+		avg_enabled = avg_stats(&event_res_stats[counter][1]);
+		avg_running = avg_stats(&event_res_stats[counter][2]);
 
-	if (scaled)
 		fprintf(stderr, "  (scaled from %.2f%%)",
-			(double) count[2] / count[1] * 100);
+				100 * avg_running / avg_enabled);
+	}
 
 	fprintf(stderr, "\n");
 }
 
-/*
- * normalize_noise noise values down to stddev:
- */
-static void normalize_noise(u64 *val)
+static void update_stats(const char *name, int idx, struct stats *stats, u64 *val)
 {
-	double res;
+	double sq = *val;
 
-	res = (double)*val / (run_count * sqrt((double)run_count));
-
-	*val = (u64)res;
-}
-
-static void update_avg(const char *name, int idx, u64 *avg, u64 *val)
-{
-	*avg += *val;
+	stats->sum += *val;
+	stats->sum_sq += sq * sq;
 
 	if (verbose > 1)
 		fprintf(stderr, "debug: %20s[%d]: %Ld\n", name, idx, *val);
 }
+
 /*
  * Calculate the averages and noises:
  */
@@ -377,61 +383,22 @@ static void calc_avg(void)
 		fprintf(stderr, "\n");
 
 	for (i = 0; i < run_count; 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);
+		update_stats("runtime", 0, &runtime_nsecs_stats, runtime_nsecs + i);
+		update_stats("walltime", 0, &walltime_nsecs_stats, walltime_nsecs + i);
+		update_stats("runtime_cycles", 0, &runtime_cycles_stats, runtime_cycles + i);
 
 		for (j = 0; j < nr_counters; 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_stats("counter/0", j,
+				event_res_stats[j]+0, event_res[i][j]+0);
+			update_stats("counter/1", j,
+				event_res_stats[j]+1, event_res[i][j]+1);
+			update_stats("counter/2", j,
+				event_res_stats[j]+2, event_res[i][j]+2);
 			if (event_scaled[i][j] != (u64)-1)
-				update_avg("scaled", j,
-					event_scaled_avg + j, event_scaled[i]+j);
-			else
-				event_scaled_avg[j] = -1;
+				update_stats("scaled", j,
+					event_scaled_stats + 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;
-	}
-
-	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]));
-		}
-	}
-
-	normalize_noise(&runtime_nsecs_noise);
-	normalize_noise(&walltime_nsecs_noise);
-	normalize_noise(&runtime_cycles_noise);
-
-	for (j = 0; j < nr_counters; j++) {
-		normalize_noise(&event_res_noise[j][0]);
-		normalize_noise(&event_res_noise[j][1]);
-		normalize_noise(&event_res_noise[j][2]);
-	}
 }
 
 static void print_stat(int argc, const char **argv)
@@ -458,10 +425,11 @@ static void print_stat(int argc, const char **argv)
 
 	fprintf(stderr, "\n");
 	fprintf(stderr, " %14.9f  seconds time elapsed",
-			(double)walltime_nsecs_avg/1e9);
+			avg_stats(&walltime_nsecs_stats)/1e9);
 	if (run_count > 1) {
 		fprintf(stderr, "   ( +- %7.3f%% )",
-			100.0*(double)walltime_nsecs_noise/(double)walltime_nsecs_avg);
+				100*stddev_stats(&walltime_nsecs_stats) /
+				avg_stats(&walltime_nsecs_stats));
 	}
 	fprintf(stderr, "\n\n");
 }

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

* [tip:perfcounters/core] perf stat: Remove the limit on repeat
       [not found]             ` <new-submission>
                                 ` (330 preceding siblings ...)
  2009-09-04 15:42               ` [tip:perfcounters/core] perf stat: Change noise calculation to use stddev tip-bot for Peter Zijlstra
@ 2009-09-04 15:43               ` tip-bot for Peter Zijlstra
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Use stddev_mean in stead of stddev tip-bot for Peter Zijlstra
                                 ` (374 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-04 15:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  9e9772c458d50dabdb5327821da3803254638cd1
Gitweb:     http://git.kernel.org/tip/9e9772c458d50dabdb5327821da3803254638cd1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Sep 2009 15:36:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 16:33:08 +0200

perf stat: Remove the limit on repeat

Since we don't need all the individual samples to calculate the
error remove both the limit and the storage overhead associated
with that.

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-stat.c |   84 ++++++++++++++------------------------------
 1 files changed, 27 insertions(+), 57 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 31ffc4d..9c6377f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -62,8 +62,6 @@ static struct perf_counter_attr default_attrs[] = {
 
 };
 
-#define MAX_RUN			100
-
 static int			system_wide			=  0;
 static unsigned int		nr_cpus				=  0;
 static int			run_idx				=  0;
@@ -76,12 +74,8 @@ static int			null_run			=  0;
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static u64			runtime_nsecs[MAX_RUN];
-static u64			walltime_nsecs[MAX_RUN];
-static u64			runtime_cycles[MAX_RUN];
-
-static u64			event_res[MAX_RUN][MAX_COUNTERS][3];
-static u64			event_scaled[MAX_RUN][MAX_COUNTERS];
+static u64			event_res[MAX_COUNTERS][3];
+static u64			event_scaled[MAX_COUNTERS];
 
 struct stats
 {
@@ -89,6 +83,14 @@ struct stats
 	double sum_sq;
 };
 
+static void update_stats(struct stats *stats, u64 val)
+{
+	double sq = val;
+
+	stats->sum += val;
+	stats->sum_sq += sq * sq;
+}
+
 static double avg_stats(struct stats *stats)
 {
 	return stats->sum / run_count;
@@ -167,8 +169,9 @@ static void read_counter(int counter)
 	unsigned int cpu;
 	size_t res, nv;
 	int scaled;
+	int i;
 
-	count = event_res[run_idx][counter];
+	count = event_res[counter];
 
 	count[0] = count[1] = count[2] = 0;
 
@@ -193,24 +196,33 @@ static void read_counter(int counter)
 	scaled = 0;
 	if (scale) {
 		if (count[2] == 0) {
-			event_scaled[run_idx][counter] = -1;
+			event_scaled[counter] = -1;
 			count[0] = 0;
 			return;
 		}
 
 		if (count[2] < count[1]) {
-			event_scaled[run_idx][counter] = 1;
+			event_scaled[counter] = 1;
 			count[0] = (unsigned long long)
 				((double)count[0] * count[1] / count[2] + 0.5);
 		}
 	}
+
+	for (i = 0; i < 3; i++)
+		update_stats(&event_res_stats[counter][i], count[i]);
+
+	if (verbose) {
+		fprintf(stderr, "%s: %Ld %Ld %Ld\n", event_name(counter),
+				count[0], count[1], count[2]);
+	}
+
 	/*
 	 * Save the full runtime - to allow normalization during printout:
 	 */
 	if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
-		runtime_nsecs[run_idx] = count[0];
+		update_stats(&runtime_nsecs_stats, count[0]);
 	if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter))
-		runtime_cycles[run_idx] = count[0];
+		update_stats(&runtime_cycles_stats, count[0]);
 }
 
 static int run_perf_stat(int argc __used, const char **argv)
@@ -284,7 +296,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 
 	t1 = rdclock();
 
-	walltime_nsecs[run_idx] = t1 - t0;
+	update_stats(&walltime_nsecs_stats, t1 - t0);
 
 	for (counter = 0; counter < nr_counters; counter++)
 		read_counter(counter);
@@ -361,52 +373,10 @@ static void print_counter(int counter)
 	fprintf(stderr, "\n");
 }
 
-static void update_stats(const char *name, int idx, struct stats *stats, u64 *val)
-{
-	double sq = *val;
-
-	stats->sum += *val;
-	stats->sum_sq += sq * sq;
-
-	if (verbose > 1)
-		fprintf(stderr, "debug: %20s[%d]: %Ld\n", name, idx, *val);
-}
-
-/*
- * Calculate the averages and noises:
- */
-static void calc_avg(void)
-{
-	int i, j;
-
-	if (verbose > 1)
-		fprintf(stderr, "\n");
-
-	for (i = 0; i < run_count; i++) {
-		update_stats("runtime", 0, &runtime_nsecs_stats, runtime_nsecs + i);
-		update_stats("walltime", 0, &walltime_nsecs_stats, walltime_nsecs + i);
-		update_stats("runtime_cycles", 0, &runtime_cycles_stats, runtime_cycles + i);
-
-		for (j = 0; j < nr_counters; j++) {
-			update_stats("counter/0", j,
-				event_res_stats[j]+0, event_res[i][j]+0);
-			update_stats("counter/1", j,
-				event_res_stats[j]+1, event_res[i][j]+1);
-			update_stats("counter/2", j,
-				event_res_stats[j]+2, event_res[i][j]+2);
-			if (event_scaled[i][j] != (u64)-1)
-				update_stats("scaled", j,
-					event_scaled_stats + j, event_scaled[i]+j);
-		}
-	}
-}
-
 static void print_stat(int argc, const char **argv)
 {
 	int i, counter;
 
-	calc_avg();
-
 	fflush(stdout);
 
 	fprintf(stderr, "\n");
@@ -484,7 +454,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		PARSE_OPT_STOP_AT_NON_OPTION);
 	if (!argc)
 		usage_with_options(stat_usage, options);
-	if (run_count <= 0 || run_count > MAX_RUN)
+	if (run_count <= 0)
 		usage_with_options(stat_usage, options);
 
 	/* Set attrs and nr_counters if no event is selected and !null_run */

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

* [tip:perfcounters/core] perf stat: Use stddev_mean in stead of stddev
       [not found]             ` <new-submission>
                                 ` (331 preceding siblings ...)
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Remove the limit on repeat tip-bot for Peter Zijlstra
@ 2009-09-04 15:43               ` tip-bot for Peter Zijlstra
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: More advanced variance computation tip-bot for Peter Zijlstra
                                 ` (373 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-04 15:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  63d40deb2e7c64ed55943d49f078e09fc4b64b54
Gitweb:     http://git.kernel.org/tip/63d40deb2e7c64ed55943d49f078e09fc4b64b54
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Sep 2009 17:03:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 17:38:14 +0200

perf stat: Use stddev_mean in stead of stddev

When we're computing the mean by sampling the distribution,
then the std dev of the mean is related to the std dev of the
sample set by:

  stddev_mean = std_dev / sqrt(N)

Which is exactly what we want.

This results in the error on the mean decreasing with
increasing number of samples.

Also fix the scaled == -1, aka not counted case.

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-stat.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9c6377f..e9424fa 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -75,7 +75,7 @@ static int			null_run			=  0;
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static u64			event_res[MAX_COUNTERS][3];
-static u64			event_scaled[MAX_COUNTERS];
+static int			event_scaled[MAX_COUNTERS];
 
 struct stats
 {
@@ -97,17 +97,31 @@ static double avg_stats(struct stats *stats)
 }
 
 /*
- * stddev = sqrt(1/N (\Sum n_i^2) - avg(n)^2)
+ * http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
+ *
+ *      (\Sum n_i^2) - ((\Sum n_i)^2)/n
+ * s^2  -------------------------------
+ *                   n - 1
+ *
+ * http://en.wikipedia.org/wiki/Stddev
+ *
+ * The std dev of the mean is related to the std dev by:
+ *
+ *             s
+ * s_mean = -------
+ *          sqrt(n)
+ *
  */
 static double stddev_stats(struct stats *stats)
 {
 	double avg = stats->sum / run_count;
+	double variance = (stats->sum_sq - stats->sum*avg)/(run_count - 1);
+	double variance_mean = variance / run_count;
 
-	return sqrt(stats->sum_sq/run_count - avg*avg);
+	return sqrt(variance_mean);
 }
 
 struct stats			event_res_stats[MAX_COUNTERS][3];
-struct stats			event_scaled_stats[MAX_COUNTERS];
 struct stats			runtime_nsecs_stats;
 struct stats			walltime_nsecs_stats;
 struct stats			runtime_cycles_stats;
@@ -343,11 +357,10 @@ static void abs_printout(int counter, double avg, double stddev)
 static void print_counter(int counter)
 {
 	double avg, stddev;
-	int scaled;
+	int scaled = event_scaled[counter];
 
 	avg    = avg_stats(&event_res_stats[counter][0]);
 	stddev = stddev_stats(&event_res_stats[counter][0]);
-	scaled = avg_stats(&event_scaled_stats[counter]);
 
 	if (scaled == -1) {
 		fprintf(stderr, " %14s  %-24s\n",

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

* [tip:perfcounters/core] perf stat: More advanced variance computation
       [not found]             ` <new-submission>
                                 ` (332 preceding siblings ...)
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Use stddev_mean in stead of stddev tip-bot for Peter Zijlstra
@ 2009-09-04 15:43               ` tip-bot for Peter Zijlstra
  2009-09-04 18:34               ` [tip:perfcounters/core] perf stat: Clean up statistics calculations a bit more tip-bot for Peter Zijlstra
                                 ` (372 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-04 15:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8a02631a470d6f2ccec7bcf79c1058b0d4240bce
Gitweb:     http://git.kernel.org/tip/8a02631a470d6f2ccec7bcf79c1058b0d4240bce
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Sep 2009 17:26:26 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 17:38:15 +0200

perf stat: More advanced variance computation

Use the more advanced single pass variance algorithm outlined
on the wikipedia page. This is numerically more stable for
larger sample sets.

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-stat.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e9424fa..32b5c00 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -79,29 +79,30 @@ static int			event_scaled[MAX_COUNTERS];
 
 struct stats
 {
-	double sum;
-	double sum_sq;
+	double n, mean, M2;
 };
 
 static void update_stats(struct stats *stats, u64 val)
 {
-	double sq = val;
+	double delta;
 
-	stats->sum += val;
-	stats->sum_sq += sq * sq;
+	stats->n++;
+	delta = val - stats->mean;
+	stats->mean += delta / stats->n;
+	stats->M2 += delta*(val - stats->mean);
 }
 
 static double avg_stats(struct stats *stats)
 {
-	return stats->sum / run_count;
+	return stats->mean;
 }
 
 /*
  * http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
  *
- *      (\Sum n_i^2) - ((\Sum n_i)^2)/n
- * s^2  -------------------------------
- *                   n - 1
+ *       (\Sum n_i^2) - ((\Sum n_i)^2)/n
+ * s^2 = -------------------------------
+ *                  n - 1
  *
  * http://en.wikipedia.org/wiki/Stddev
  *
@@ -114,9 +115,8 @@ static double avg_stats(struct stats *stats)
  */
 static double stddev_stats(struct stats *stats)
 {
-	double avg = stats->sum / run_count;
-	double variance = (stats->sum_sq - stats->sum*avg)/(run_count - 1);
-	double variance_mean = variance / run_count;
+	double variance = stats->M2 / (stats->n - 1);
+	double variance_mean = variance / stats->n;
 
 	return sqrt(variance_mean);
 }

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

* [tip:perfcounters/core] perf stat: Clean up statistics calculations a bit more
       [not found]             ` <new-submission>
                                 ` (333 preceding siblings ...)
  2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: More advanced variance computation tip-bot for Peter Zijlstra
@ 2009-09-04 18:34               ` tip-bot for Peter Zijlstra
  2009-09-07 20:37               ` [tip:sched/balancing] sched: Remove short cut from select_task_rq_fair() tip-bot for Peter Zijlstra
                                 ` (371 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-04 18:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  849abde92bd3314a4894f2b4f70b30c2accf8653
Gitweb:     http://git.kernel.org/tip/849abde92bd3314a4894f2b4f70b30c2accf8653
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Sep 2009 18:23:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 20:27:26 +0200

perf stat: Clean up statistics calculations a bit more

Remove some, now useless, global storage.
Don't calculate the stddev when not needed.

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-stat.c |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 32b5c00..61b8282 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -74,7 +74,6 @@ static int			null_run			=  0;
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static u64			event_res[MAX_COUNTERS][3];
 static int			event_scaled[MAX_COUNTERS];
 
 struct stats
@@ -179,14 +178,12 @@ static inline int nsec_counter(int counter)
  */
 static void read_counter(int counter)
 {
-	u64 *count, single_count[3];
+	u64 count[3], single_count[3];
 	unsigned int cpu;
 	size_t res, nv;
 	int scaled;
 	int i;
 
-	count = event_res[counter];
-
 	count[0] = count[1] = count[2] = 0;
 
 	nv = scale ? 3 : 1;
@@ -318,13 +315,16 @@ static int run_perf_stat(int argc __used, const char **argv)
 	return WEXITSTATUS(status);
 }
 
-static void print_noise(double avg, double stddev)
+static void print_noise(int counter, double avg)
 {
-	if (run_count > 1)
-		fprintf(stderr, "   ( +- %7.3f%% )", 100*stddev / avg);
+	if (run_count == 1)
+		return;
+
+	fprintf(stderr, "   ( +- %7.3f%% )",
+			100 * stddev_stats(&event_res_stats[counter][0]) / avg);
 }
 
-static void nsec_printout(int counter, double avg, double stddev)
+static void nsec_printout(int counter, double avg)
 {
 	double msecs = avg / 1e6;
 
@@ -334,10 +334,9 @@ static void nsec_printout(int counter, double avg, double stddev)
 		fprintf(stderr, " # %10.3f CPUs ",
 				avg / avg_stats(&walltime_nsecs_stats));
 	}
-	print_noise(avg, stddev);
 }
 
-static void abs_printout(int counter, double avg, double stddev)
+static void abs_printout(int counter, double avg)
 {
 	fprintf(stderr, " %14.0f  %-24s", avg, event_name(counter));
 
@@ -348,7 +347,6 @@ static void abs_printout(int counter, double avg, double stddev)
 		fprintf(stderr, " # %10.3f M/sec",
 				1000.0 * avg / avg_stats(&runtime_nsecs_stats));
 	}
-	print_noise(avg, stddev);
 }
 
 /*
@@ -356,12 +354,9 @@ static void abs_printout(int counter, double avg, double stddev)
  */
 static void print_counter(int counter)
 {
-	double avg, stddev;
+	double avg = avg_stats(&event_res_stats[counter][0]);
 	int scaled = event_scaled[counter];
 
-	avg    = avg_stats(&event_res_stats[counter][0]);
-	stddev = stddev_stats(&event_res_stats[counter][0]);
-
 	if (scaled == -1) {
 		fprintf(stderr, " %14s  %-24s\n",
 			"<not counted>", event_name(counter));
@@ -369,9 +364,11 @@ static void print_counter(int counter)
 	}
 
 	if (nsec_counter(counter))
-		nsec_printout(counter, avg, stddev);
+		nsec_printout(counter, avg);
 	else
-		abs_printout(counter, avg, stddev);
+		abs_printout(counter, avg);
+
+	print_noise(counter, avg);
 
 	if (scaled) {
 		double avg_enabled, avg_running;

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

* [tip:sched/balancing] sched: Remove short cut from select_task_rq_fair()
       [not found]             ` <new-submission>
                                 ` (334 preceding siblings ...)
  2009-09-04 18:34               ` [tip:perfcounters/core] perf stat: Clean up statistics calculations a bit more tip-bot for Peter Zijlstra
@ 2009-09-07 20:37               ` tip-bot for Peter Zijlstra
  2009-09-07 20:37               ` [tip:sched/balancing] sched: Deal with low-load in wake_affine() tip-bot for Peter Zijlstra
                                 ` (370 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-07 20:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cdd2ab3de4301728b20efd6225681d3ff591a938
Gitweb:     http://git.kernel.org/tip/cdd2ab3de4301728b20efd6225681d3ff591a938
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 7 Sep 2009 18:12:06 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Sep 2009 20:39:05 +0200

sched: Remove short cut from select_task_rq_fair()

select_task_rq_fair() incorrectly skips the wake_affine()
logic, remove this.

When prev_cpu == this_cpu, the code jumps straight to the
wake_idle() logic, this doesn't give the wake_affine() logic
the chance to pin the task to this cpu.

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 |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 2ff850f..d7fda41 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1305,8 +1305,6 @@ static int select_task_rq_fair(struct task_struct *p, int sync)
 	this_rq		= cpu_rq(this_cpu);
 	new_cpu		= prev_cpu;
 
-	if (prev_cpu == this_cpu)
-		goto out;
 	/*
 	 * 'this_sd' is the first domain that both
 	 * this_cpu and prev_cpu are present in:

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

* [tip:sched/balancing] sched: Deal with low-load in wake_affine()
       [not found]             ` <new-submission>
                                 ` (335 preceding siblings ...)
  2009-09-07 20:37               ` [tip:sched/balancing] sched: Remove short cut from select_task_rq_fair() tip-bot for Peter Zijlstra
@ 2009-09-07 20:37               ` tip-bot for Peter Zijlstra
  2009-09-07 20:37               ` [tip:sched/balancing] sched: enable SD_WAKE_IDLE tip-bot for Peter Zijlstra
                                 ` (369 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-07 20:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  71a29aa7b600595d0ef373ea605ac656876d1f2f
Gitweb:     http://git.kernel.org/tip/71a29aa7b600595d0ef373ea605ac656876d1f2f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 7 Sep 2009 18:28:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Sep 2009 20:39:06 +0200

sched: Deal with low-load in wake_affine()

wake_affine() would always fail under low-load situations where
both prev and this were idle, because adding a single task will
always be a significant imbalance, even if there's nothing
around that could balance it.

Deal with this by allowing imbalance when there's nothing you
can do about 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 |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index d7fda41..cc97ea4 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1262,7 +1262,17 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 	tg = task_group(p);
 	weight = p->se.load.weight;
 
-	balanced = 100*(tl + effective_load(tg, this_cpu, weight, weight)) <=
+	/*
+	 * In low-load situations, where prev_cpu is idle and this_cpu is idle
+	 * due to the sync cause above having dropped tl to 0, we'll always have
+	 * an imbalance, but there's really nothing you can do about that, so
+	 * that's good too.
+	 *
+	 * Otherwise check if either cpus are near enough in load to allow this
+	 * task to be woken on this_cpu.
+	 */
+	balanced = !tl ||
+		100*(tl + effective_load(tg, this_cpu, weight, weight)) <=
 		imbalance*(load + effective_load(tg, prev_cpu, 0, weight));
 
 	/*

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

* [tip:sched/balancing] sched: enable SD_WAKE_IDLE
       [not found]             ` <new-submission>
                                 ` (336 preceding siblings ...)
  2009-09-07 20:37               ` [tip:sched/balancing] sched: Deal with low-load in wake_affine() tip-bot for Peter Zijlstra
@ 2009-09-07 20:37               ` tip-bot for Peter Zijlstra
  2009-09-08 11:19               ` [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork() tip-bot for Mike Galbraith
                                 ` (368 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-07 20:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  a8fae3ec5f118dc92517dcbed3ecf69ddb641d0f
Gitweb:     http://git.kernel.org/tip/a8fae3ec5f118dc92517dcbed3ecf69ddb641d0f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 7 Sep 2009 18:32:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Sep 2009 22:00:17 +0200

sched: enable SD_WAKE_IDLE

Now that SD_WAKE_IDLE doesn't make pipe-test suck anymore,
enable it by default for MC, CPU and NUMA domains.

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


---
 arch/x86/include/asm/topology.h |    2 +-
 include/linux/topology.h        |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index ef7bc7f..26d06e0 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -152,7 +152,7 @@ extern unsigned long node_remap_size[];
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 1*SD_SERIALIZE			\
-				| 0*SD_WAKE_IDLE_FAR			\
+				| 1*SD_WAKE_IDLE_FAR			\
 				| 0*SD_PREFER_SIBLING			\
 				,					\
 	.last_balance		= jiffies,				\
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 66774fd..85e8cf7 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -129,7 +129,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_IDLE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
@@ -163,7 +163,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_WAKE_IDLE			\
 				| 0*SD_WAKE_AFFINE			\
 				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
@@ -198,7 +198,7 @@ int arch_update_cpu_topology(void);
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 1*SD_SERIALIZE			\
-				| 0*SD_WAKE_IDLE_FAR			\
+				| 1*SD_WAKE_IDLE_FAR			\
 				| 0*SD_PREFER_SIBLING			\
 				,					\
 	.last_balance		= jiffies,				\

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

* [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork()
       [not found]             ` <new-submission>
                                 ` (337 preceding siblings ...)
  2009-09-07 20:37               ` [tip:sched/balancing] sched: enable SD_WAKE_IDLE tip-bot for Peter Zijlstra
@ 2009-09-08 11:19               ` tip-bot for Mike Galbraith
  2009-09-08 11:49                 ` Ingo Molnar
  2009-09-14 20:04               ` [tip:timers/core] clocksource: clocksource_select must be called with mutex locked tip-bot for Thomas Gleixner
                                 ` (367 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-09-08 11:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, jens.axboe, tglx, mingo

Commit-ID:  b5d9d734a53e0204aab0089079cbde2a1285a38f
Gitweb:     http://git.kernel.org/tip/b5d9d734a53e0204aab0089079cbde2a1285a38f
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Tue, 8 Sep 2009 11:12:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 8 Sep 2009 13:15:34 +0200

sched: Ensure that a child can't gain time over it's parent after fork()

A fork/exec load is usually "pass the baton", so the child
should never be placed behind the parent.  With START_DEBIT we
make room for the new task, but with child_runs_first, that
room comes out of the _parent's_ hide. There's nothing to say
that the parent wasn't ahead of min_vruntime at fork() time,
which means that the "baton carrier", who is essentially the
parent in drag, can gain time and increase scheduling latencies
for waiters.

With NEW_FAIR_SLEEPERS + START_DEBIT + child_runs_first
enabled, we essentially pass the sleeper fairness off to the
child, which is fine, but if we don't base placement on the
parent's updated vruntime, we can end up compounding latency
woes if the child itself then does fork/exec.  The debit
incurred at fork doesn't hurt the parent who is then going to
sleep and maybe exit, but the child who acquires the error
harms all comers.

This improves latencies of make -j<n> kernel build workloads.

Reported-by: Jens Axboe <jens.axboe@oracle.com>
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>


---
 kernel/sched_fair.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index cc97ea4..e386e5d 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -728,11 +728,11 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 
 			vruntime -= thresh;
 		}
-
-		/* ensure we never gain time by being placed backwards. */
-		vruntime = max_vruntime(se->vruntime, vruntime);
 	}
 
+	/* ensure we never gain time by being placed backwards. */
+	vruntime = max_vruntime(se->vruntime, vruntime);
+
 	se->vruntime = vruntime;
 }
 
@@ -1756,6 +1756,8 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
 	sched_info_queued(p);
 
 	update_curr(cfs_rq);
+	if (curr)
+		se->vruntime = curr->vruntime;
 	place_entity(cfs_rq, se, 1);
 
 	/* 'curr' will be NULL if the child belongs to a different group */

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

* Re: [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork()
  2009-09-08 11:19               ` [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork() tip-bot for Mike Galbraith
@ 2009-09-08 11:49                 ` Ingo Molnar
  2009-09-08 11:53                   ` Jens Axboe
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-08 11:49 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, a.p.zijlstra, efault, jens.axboe, tglx
  Cc: linux-tip-commits


* tip-bot for Mike Galbraith <efault@gmx.de> wrote:

> Commit-ID:  b5d9d734a53e0204aab0089079cbde2a1285a38f
> Gitweb:     http://git.kernel.org/tip/b5d9d734a53e0204aab0089079cbde2a1285a38f
> Author:     Mike Galbraith <efault@gmx.de>
> AuthorDate: Tue, 8 Sep 2009 11:12:28 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Tue, 8 Sep 2009 13:15:34 +0200
> 
> sched: Ensure that a child can't gain time over it's parent after fork()

> This improves latencies of make -j<n> kernel build workloads.
> 
> Reported-by: Jens Axboe <jens.axboe@oracle.com>

Jens, mind trying this patch (or latest tip:master) with your make 
-j4 workload, does it improve in any way?

	Ingo

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

* Re: [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork()
  2009-09-08 11:49                 ` Ingo Molnar
@ 2009-09-08 11:53                   ` Jens Axboe
  2009-09-08 12:42                     ` Mike Galbraith
  0 siblings, 1 reply; 1150+ messages in thread
From: Jens Axboe @ 2009-09-08 11:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, a.p.zijlstra, efault, tglx, linux-tip-commits

On Tue, Sep 08 2009, Ingo Molnar wrote:
> 
> * tip-bot for Mike Galbraith <efault@gmx.de> wrote:
> 
> > Commit-ID:  b5d9d734a53e0204aab0089079cbde2a1285a38f
> > Gitweb:     http://git.kernel.org/tip/b5d9d734a53e0204aab0089079cbde2a1285a38f
> > Author:     Mike Galbraith <efault@gmx.de>
> > AuthorDate: Tue, 8 Sep 2009 11:12:28 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Tue, 8 Sep 2009 13:15:34 +0200
> > 
> > sched: Ensure that a child can't gain time over it's parent after fork()
> 
> > This improves latencies of make -j<n> kernel build workloads.
> > 
> > Reported-by: Jens Axboe <jens.axboe@oracle.com>
> 
> Jens, mind trying this patch (or latest tip:master) with your make 
> -j4 workload, does it improve in any way?

Already booted it, makes no real difference... I'm trying with NO_HZ
disabled now to see if that changes the picture.

-- 
Jens Axboe


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

* Re: [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork()
  2009-09-08 11:53                   ` Jens Axboe
@ 2009-09-08 12:42                     ` Mike Galbraith
  0 siblings, 0 replies; 1150+ messages in thread
From: Mike Galbraith @ 2009-09-08 12:42 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ingo Molnar, mingo, hpa, linux-kernel, a.p.zijlstra, tglx,
	linux-tip-commits

On Tue, 2009-09-08 at 13:53 +0200, Jens Axboe wrote:
> On Tue, Sep 08 2009, Ingo Molnar wrote:
> > 
> > * tip-bot for Mike Galbraith <efault@gmx.de> wrote:
> > 
> > > Commit-ID:  b5d9d734a53e0204aab0089079cbde2a1285a38f
> > > Gitweb:     http://git.kernel.org/tip/b5d9d734a53e0204aab0089079cbde2a1285a38f
> > > Author:     Mike Galbraith <efault@gmx.de>
> > > AuthorDate: Tue, 8 Sep 2009 11:12:28 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Tue, 8 Sep 2009 13:15:34 +0200
> > > 
> > > sched: Ensure that a child can't gain time over it's parent after fork()
> > 
> > > This improves latencies of make -j<n> kernel build workloads.
> > > 
> > > Reported-by: Jens Axboe <jens.axboe@oracle.com>
> > 
> > Jens, mind trying this patch (or latest tip:master) with your make 
> > -j4 workload, does it improve in any way?
> 
> Already booted it, makes no real difference... I'm trying with NO_HZ
> disabled now to see if that changes the picture.

Oh well, BTTODB.  Thanks for trying it out.

	-Mike


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

* Re: [boot crash] Re: [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable
  2009-09-03 18:58                       ` Ingo Molnar
@ 2009-09-08 21:43                         ` john stultz
  0 siblings, 0 replies; 1150+ messages in thread
From: john stultz @ 2009-09-08 21:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Thomas Gleixner, Martin Schwidefsky, mingo, hpa, linux-kernel,
	linux-tip-commits

On Thu, 2009-09-03 at 20:58 +0200, Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > i tried to bisect it but it's inconclusive:
> > 
> >  # bad:  [32beef9c] Merge branch 'perfcounters/core'
> >  # bad:  [b6413360] manual merge of x86/platform
> >  # bad:  [d9e5f39a] Merge branch 'auto-oprofile-next' into auto-latest
> >  # bad:  [cbaff272] Merge branch 'auto-timers-next' into auto-latest
> > 
> > as the bisection comes up with that merge commit. Perhaps the 
> > combination of the x86/platform changes and the clocksource 
> > changes triggered it?
> 
> That seems to be the case - i just tested a combination merge of 
> tip:auto-timers-next and tip:auto-x86-next and the result crashed in 
> a similar way too.
> 
> Since normal bisection cannot find such breakages, i did a topical 
> bisection (merging the finegrained tip:x86/* topics into the timer 
> tree gradually and testing each merge).
> 
> That way i could exclude: x86/platform, x86/pat, x86/asm, x86/apic, 
> x86/percpu, x86/cpu, x86/mm and arrived to x86/tsc - which contains 
> a single commit:
> 
>   d3b8f88: x86: Make tsc=reliable override boot time stability checks
> 
> Reverting that commit from tip:master gives me a non-crashing 
> bootup.

Huh. Does dropping the last chunk of the patch make the issue go away?

I'm suspecting fixing the bug Thomas noticed in the tsc_unstable
assignment (we set tsc_unstable before calling mark_tsc_unstable,
causing the TSC rating to not change) that I included in this patch is
colliding with the clocksource rework from Martin.

Although I'm not sure I see that in the backtrace, so I'm likely wrong.
Hrmm..

-john





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

* [tip:timers/core] clocksource: clocksource_select must be called with mutex locked
       [not found]             ` <new-submission>
                                 ` (338 preceding siblings ...)
  2009-09-08 11:19               ` [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork() tip-bot for Mike Galbraith
@ 2009-09-14 20:04               ` tip-bot for Thomas Gleixner
  2009-09-14 20:04               ` [tip:timers/core] clocksource: Delay clocksource down rating to late boot tip-bot for Thomas Gleixner
                                 ` (366 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-09-14 20:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, schwidefsky, tglx

Commit-ID:  e6c733050faa93ce616bfedccd279ab12cffdd7b
Gitweb:     http://git.kernel.org/tip/e6c733050faa93ce616bfedccd279ab12cffdd7b
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 14 Sep 2009 19:51:11 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 14 Sep 2009 21:59:32 +0200

clocksource: clocksource_select must be called with mutex locked

The callers of clocksource_select must hold clocksource_mutex to
protect the clocksource_list.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>


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

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 5697155..2c2e5ba 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -471,7 +471,9 @@ static void clocksource_select(void)
 static int __init clocksource_done_booting(void)
 {
 	finished_booting = 1;
+	mutex_lock(&clocksource_mutex);
 	clocksource_select();
+	mutex_unlock(&clocksource_mutex);
 	return 0;
 }
 fs_initcall(clocksource_done_booting);

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

* [tip:timers/core] clocksource: Delay clocksource down rating to late boot
       [not found]             ` <new-submission>
                                 ` (339 preceding siblings ...)
  2009-09-14 20:04               ` [tip:timers/core] clocksource: clocksource_select must be called with mutex locked tip-bot for Thomas Gleixner
@ 2009-09-14 20:04               ` tip-bot for Thomas Gleixner
  2009-09-15  8:22               ` [tip:timers/core] time: Prevent 32 bit overflow with set_normalized_timespec() tip-bot for Thomas Gleixner
                                 ` (365 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-09-14 20:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, schwidefsky, tglx

Commit-ID:  54a6bc0b071c50150bc6d1da16c2cd9a963e288c
Gitweb:     http://git.kernel.org/tip/54a6bc0b071c50150bc6d1da16c2cd9a963e288c
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 14 Sep 2009 19:49:02 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 14 Sep 2009 21:59:32 +0200

clocksource: Delay clocksource down rating to late boot

The down rating of clock sources in the early boot process via the
clock source watchdog mechanism can happen way before the per cpu
event queues are initialized. This leads to a boot crash on x86 when
the TSC is marked unstable in the SMP bring up.

The selection of a clock source for time keeping happens in the late
boot process so we can safely delay the list manipulation until
clocksource_done_booting() is called.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>


---
 kernel/time/clocksource.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 2c2e5ba..0911334 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -121,6 +121,7 @@ static struct clocksource *curr_clocksource;
 static LIST_HEAD(clocksource_list);
 static DEFINE_MUTEX(clocksource_mutex);
 static char override_name[32];
+static int finished_booting;
 
 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
 static void clocksource_watchdog_work(struct work_struct *work);
@@ -155,7 +156,8 @@ static void __clocksource_unstable(struct clocksource *cs)
 {
 	cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
 	cs->flags |= CLOCK_SOURCE_UNSTABLE;
-	schedule_work(&watchdog_work);
+	if (finished_booting)
+		schedule_work(&watchdog_work);
 }
 
 static void clocksource_unstable(struct clocksource *cs, int64_t delta)
@@ -207,7 +209,8 @@ static void clocksource_watchdog(unsigned long data)
 
 		/* Clocksource already marked unstable? */
 		if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
-			schedule_work(&watchdog_work);
+			if (finished_booting)
+				schedule_work(&watchdog_work);
 			continue;
 		}
 
@@ -380,6 +383,7 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs)
 
 static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { }
 static inline void clocksource_resume_watchdog(void) { }
+static inline int clocksource_watchdog_kthread(void *data) { return 0; }
 
 #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
 
@@ -415,8 +419,6 @@ void clocksource_touch_watchdog(void)
 
 #ifdef CONFIG_GENERIC_TIME
 
-static int finished_booting;
-
 /**
  * clocksource_select - Select the best clocksource available
  *
@@ -461,6 +463,12 @@ static void clocksource_select(void)
 	}
 }
 
+#else /* CONFIG_GENERIC_TIME */
+
+static inline void clocksource_select(void) { }
+
+#endif
+
 /*
  * clocksource_done_booting - Called near the end of core bootup
  *
@@ -471,6 +479,12 @@ static void clocksource_select(void)
 static int __init clocksource_done_booting(void)
 {
 	finished_booting = 1;
+
+	/*
+	 * Run the watchdog first to eliminate unstable clock sources
+	 */
+	clocksource_watchdog_kthread(NULL);
+
 	mutex_lock(&clocksource_mutex);
 	clocksource_select();
 	mutex_unlock(&clocksource_mutex);
@@ -478,12 +492,6 @@ static int __init clocksource_done_booting(void)
 }
 fs_initcall(clocksource_done_booting);
 
-#else /* CONFIG_GENERIC_TIME */
-
-static inline void clocksource_select(void) { }
-
-#endif
-
 /*
  * Enqueue the clocksource sorted by rating
  */

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

* [tip:timers/core] time: Prevent 32 bit overflow with set_normalized_timespec()
       [not found]             ` <new-submission>
                                 ` (340 preceding siblings ...)
  2009-09-14 20:04               ` [tip:timers/core] clocksource: Delay clocksource down rating to late boot tip-bot for Thomas Gleixner
@ 2009-09-15  8:22               ` tip-bot for Thomas Gleixner
  2009-09-15  9:30               ` [tip:perfcounters/core] perf: Add 'perf sched' tool tip-bot for Ingo Molnar
                                 ` (364 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-09-15  8:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, johnstul, schwidefsky, tglx, carsten.emde

Commit-ID:  12e09337fe238981cb0c87543306e23775d1a143
Gitweb:     http://git.kernel.org/tip/12e09337fe238981cb0c87543306e23775d1a143
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 14 Sep 2009 23:37:40 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 15 Sep 2009 10:17:30 +0200

time: Prevent 32 bit overflow with set_normalized_timespec()

set_normalized_timespec() nsec argument is of type long. The recent
timekeeping changes of ktime_get_ts() feed 

	ts->tv_nsec + tomono.tv_nsec + nsecs

to set_normalized_timespec(). On 32 bit machines that sum can be
larger than (1 << 31) and therefor result in a negative value which
screws up the result completely.

Make the nsec argument of set_normalized_timespec() s64 to fix the
problem at hand. This also prevents similar problems for future users
of set_normalized_timespec().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Carsten Emde <carsten.emde@osadl.org>
LKML-Reference: <new-submission>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>



---
 include/linux/time.h |    2 +-
 kernel/time.c        |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 256232f..56787c0 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
 			    const unsigned int day, const unsigned int hour,
 			    const unsigned int min, const unsigned int sec);
 
-extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
+extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
 extern struct timespec timespec_add_safe(const struct timespec lhs,
 					 const struct timespec rhs);
 
diff --git a/kernel/time.c b/kernel/time.c
index 2951194..2e2e469 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -370,13 +370,20 @@ EXPORT_SYMBOL(mktime);
  *	0 <= tv_nsec < NSEC_PER_SEC
  * For negative values only the tv_sec field is negative !
  */
-void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)
+void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec)
 {
 	while (nsec >= NSEC_PER_SEC) {
+		/*
+		 * The following asm() prevents the compiler from
+		 * optimising this loop into a modulo operation. See
+		 * also __iter_div_u64_rem() in include/linux/time.h
+		 */
+		asm("" : "+rm"(nsec));
 		nsec -= NSEC_PER_SEC;
 		++sec;
 	}
 	while (nsec < 0) {
+		asm("" : "+rm"(nsec));
 		nsec += NSEC_PER_SEC;
 		--sec;
 	}

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

* [tip:perfcounters/core] perf: Add 'perf sched' tool
       [not found]             ` <new-submission>
                                 ` (341 preceding siblings ...)
  2009-09-15  8:22               ` [tip:timers/core] time: Prevent 32 bit overflow with set_normalized_timespec() tip-bot for Thomas Gleixner
@ 2009-09-15  9:30               ` tip-bot for Ingo Molnar
  2009-09-15  9:30               ` [tip:perfcounters/core] perf sched: Import schedbench.c tip-bot for Ingo Molnar
                                 ` (363 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  0a02ad9331dd4db56c29c60db2e99c4daaad8a48
Gitweb:     http://git.kernel.org/tip/0a02ad9331dd4db56c29c60db2e99c4daaad8a48
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:36 +0200

perf: Add 'perf sched' tool

This turn-key tool allows scheduler measurements to be
conducted and the results be displayed numerically.

First baby step towards that goal: clone the new command off of
perf trace.

Fix a few other details along the way:

 - add (minimal) perf trace documentation

 - reorder a few places

 - list perf trace in the mainporcelain list as well
   as it's a very useful utility.

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/Documentation/perf-sched.txt |   25 +++
 tools/perf/Documentation/perf-trace.txt |   25 +++
 tools/perf/Makefile                     |    1 +
 tools/perf/builtin-sched.c              |  297 +++++++++++++++++++++++++++++++
 tools/perf/builtin.h                    |    5 +-
 tools/perf/command-list.txt             |    2 +
 tools/perf/perf.c                       |    1 +
 7 files changed, 354 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
new file mode 100644
index 0000000..056320e
--- /dev/null
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -0,0 +1,25 @@
+perf-sched(1)
+==============
+
+NAME
+----
+perf-sched - Read perf.data (created by perf record) and display sched output
+
+SYNOPSIS
+--------
+[verse]
+'perf sched' [-i <file> | --input=file] symbol_name
+
+DESCRIPTION
+-----------
+This command reads the input file and displays the latencies recorded.
+
+OPTIONS
+-------
+-D::
+--dump-raw-trace=::
+        Display verbose dump of the sched data.
+
+SEE ALSO
+--------
+linkperf:perf-record[1]
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
new file mode 100644
index 0000000..41ed753
--- /dev/null
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -0,0 +1,25 @@
+perf-trace(1)
+==============
+
+NAME
+----
+perf-trace - Read perf.data (created by perf record) and display trace output
+
+SYNOPSIS
+--------
+[verse]
+'perf trace' [-i <file> | --input=file] symbol_name
+
+DESCRIPTION
+-----------
+This command reads the input file and displays the trace recorded.
+
+OPTIONS
+-------
+-D::
+--dump-raw-trace=::
+        Display verbose dump of the trace data.
+
+SEE ALSO
+--------
+linkperf:perf-record[1]
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9f8d207..2cb8cc3 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -376,6 +376,7 @@ LIB_OBJS += util/trace-event-info.o
 
 BUILTIN_OBJS += builtin-annotate.o
 BUILTIN_OBJS += builtin-help.o
+BUILTIN_OBJS += builtin-sched.o
 BUILTIN_OBJS += builtin-list.o
 BUILTIN_OBJS += builtin-record.o
 BUILTIN_OBJS += builtin-report.o
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
new file mode 100644
index 0000000..60228d9
--- /dev/null
+++ b/tools/perf/builtin-sched.c
@@ -0,0 +1,297 @@
+#include "builtin.h"
+
+#include "util/util.h"
+#include "util/cache.h"
+#include "util/symbol.h"
+#include "util/thread.h"
+#include "util/header.h"
+
+#include "util/parse-options.h"
+
+#include "perf.h"
+#include "util/debug.h"
+
+#include "util/trace-event.h"
+
+static char		const *input_name = "perf.data";
+static int		input;
+static unsigned long	page_size;
+static unsigned long	mmap_window = 32;
+
+static unsigned long	total = 0;
+static unsigned long	total_comm = 0;
+
+static struct rb_root	threads;
+static struct thread	*last_match;
+
+static struct perf_header *header;
+static u64		sample_type;
+
+
+static int
+process_comm_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	struct thread *thread;
+
+	thread = threads__findnew(event->comm.pid, &threads, &last_match);
+
+	dump_printf("%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)) {
+		dump_printf("problem processing PERF_EVENT_COMM, skipping event.\n");
+		return -1;
+	}
+	total_comm++;
+
+	return 0;
+}
+
+static int
+process_sample_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	char level;
+	int show = 0;
+	struct dso *dso = NULL;
+	struct thread *thread;
+	u64 ip = event->ip.ip;
+	u64 timestamp = -1;
+	u32 cpu = -1;
+	u64 period = 1;
+	void *more_data = event->ip.__more_data;
+	int cpumode;
+
+	thread = threads__findnew(event->ip.pid, &threads, &last_match);
+
+	if (sample_type & PERF_SAMPLE_TIME) {
+		timestamp = *(u64 *)more_data;
+		more_data += sizeof(u64);
+	}
+
+	if (sample_type & PERF_SAMPLE_CPU) {
+		cpu = *(u32 *)more_data;
+		more_data += sizeof(u32);
+		more_data += sizeof(u32); /* reserved */
+	}
+
+	if (sample_type & PERF_SAMPLE_PERIOD) {
+		period = *(u64 *)more_data;
+		more_data += sizeof(u64);
+	}
+
+	dump_printf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n",
+		(void *)(offset + head),
+		(void *)(long)(event->header.size),
+		event->header.misc,
+		event->ip.pid, event->ip.tid,
+		(void *)(long)ip,
+		(long long)period);
+
+	dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
+	if (thread == NULL) {
+		eprintf("problem processing %d event, skipping it.\n",
+			event->header.type);
+		return -1;
+	}
+
+	cpumode = event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK;
+
+	if (cpumode == PERF_EVENT_MISC_KERNEL) {
+		show = SHOW_KERNEL;
+		level = 'k';
+
+		dso = kernel_dso;
+
+		dump_printf(" ...... dso: %s\n", dso->name);
+
+	} else if (cpumode == PERF_EVENT_MISC_USER) {
+
+		show = SHOW_USER;
+		level = '.';
+
+	} else {
+		show = SHOW_HV;
+		level = 'H';
+
+		dso = hypervisor_dso;
+
+		dump_printf(" ...... dso: [hypervisor]\n");
+	}
+
+	if (sample_type & PERF_SAMPLE_RAW) {
+		struct {
+			u32 size;
+			char data[0];
+		} *raw = more_data;
+
+		/*
+		 * FIXME: better resolve from pid from the struct trace_entry
+		 * field, although it should be the same than this perf
+		 * event pid
+		 */
+		print_event(cpu, raw->data, raw->size, timestamp, thread->comm);
+	}
+	total += period;
+
+	return 0;
+}
+
+static int
+process_event(event_t *event, unsigned long offset, unsigned long head)
+{
+	trace_event(event);
+
+	switch (event->header.type) {
+	case PERF_EVENT_MMAP ... PERF_EVENT_LOST:
+		return 0;
+
+	case PERF_EVENT_COMM:
+		return process_comm_event(event, offset, head);
+
+	case PERF_EVENT_EXIT ... PERF_EVENT_READ:
+		return 0;
+
+	case PERF_EVENT_SAMPLE:
+		return process_sample_event(event, offset, head);
+
+	case PERF_EVENT_MAX:
+	default:
+		return -1;
+	}
+
+	return 0;
+}
+
+static int __cmd_sched(void)
+{
+	int ret, rc = EXIT_FAILURE;
+	unsigned long offset = 0;
+	unsigned long head = 0;
+	struct stat perf_stat;
+	event_t *event;
+	uint32_t size;
+	char *buf;
+
+	trace_report();
+	register_idle_thread(&threads, &last_match);
+
+	input = open(input_name, O_RDONLY);
+	if (input < 0) {
+		perror("failed to open file");
+		exit(-1);
+	}
+
+	ret = fstat(input, &perf_stat);
+	if (ret < 0) {
+		perror("failed to stat file");
+		exit(-1);
+	}
+
+	if (!perf_stat.st_size) {
+		fprintf(stderr, "zero-sized file, nothing to do!\n");
+		exit(0);
+	}
+	header = perf_header__read(input);
+	head = header->data_offset;
+	sample_type = perf_header__sample_type(header);
+
+	if (!(sample_type & PERF_SAMPLE_RAW))
+		die("No trace sample to read. Did you call perf record "
+		    "without -R?");
+
+	if (load_kernel() < 0) {
+		perror("failed to load kernel symbols");
+		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);
+
+	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 res;
+
+		res = munmap(buf, page_size * mmap_window);
+		assert(res == 0);
+
+		offset += shift;
+		head -= shift;
+		goto remap;
+	}
+
+	size = event->header.size;
+
+
+	if (!size || process_event(event, offset, head) < 0) {
+
+		/*
+		 * 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 < (unsigned long)perf_stat.st_size)
+		goto more;
+
+	rc = EXIT_SUCCESS;
+	close(input);
+
+	return rc;
+}
+
+static const char * const annotate_usage[] = {
+	"perf trace [<options>] <command>",
+	NULL
+};
+
+static const struct option options[] = {
+	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
+		    "dump raw trace in ASCII"),
+	OPT_BOOLEAN('v', "verbose", &verbose,
+		    "be more verbose (show symbol address, etc)"),
+	OPT_END()
+};
+
+int cmd_sched(int argc, const char **argv, const char *prefix __used)
+{
+	symbol__init();
+	page_size = getpagesize();
+
+	argc = parse_options(argc, argv, options, annotate_usage, 0);
+	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);
+	}
+
+
+	setup_pager();
+
+	return __cmd_sched();
+}
diff --git a/tools/perf/builtin.h b/tools/perf/builtin.h
index 3a63e41..b09cadb 100644
--- a/tools/perf/builtin.h
+++ b/tools/perf/builtin.h
@@ -16,12 +16,13 @@ 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_sched(int argc, const char **argv, const char *prefix);
+extern int cmd_list(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);
-extern int cmd_list(int argc, const char **argv, const char *prefix);
 extern int cmd_trace(int argc, const char **argv, const char *prefix);
+extern int cmd_version(int argc, const char **argv, const char *prefix);
 
 #endif
diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt
index eebce30..3133c74 100644
--- a/tools/perf/command-list.txt
+++ b/tools/perf/command-list.txt
@@ -4,7 +4,9 @@
 #
 perf-annotate			mainporcelain common
 perf-list			mainporcelain common
+perf-sched			mainporcelain common
 perf-record			mainporcelain common
 perf-report			mainporcelain common
 perf-stat			mainporcelain common
 perf-top			mainporcelain common
+perf-trace			mainporcelain common
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index fe4589d..c972d1c 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -293,6 +293,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "annotate", cmd_annotate, 0 },
 		{ "version", cmd_version, 0 },
 		{ "trace", cmd_trace, 0 },
+		{ "sched", cmd_sched, 0 },
 	};
 	unsigned int i;
 	static const char ext[] = STRIP_EXTENSION;

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

* [tip:perfcounters/core] perf sched: Import schedbench.c
       [not found]             ` <new-submission>
                                 ` (342 preceding siblings ...)
  2009-09-15  9:30               ` [tip:perfcounters/core] perf: Add 'perf sched' tool tip-bot for Ingo Molnar
@ 2009-09-15  9:30               ` tip-bot for Ingo Molnar
  2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Implement the scheduling workload replay engine tip-bot for Ingo Molnar
                                 ` (362 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  ec156764d424dd67283c2cd5e9f6f1b8388364ac
Gitweb:     http://git.kernel.org/tip/ec156764d424dd67283c2cd5e9f6f1b8388364ac
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:37 +0200

perf sched: Import schedbench.c

Import the schedbench.c tool that i wrote some time ago to
simulate scheduler behavior but never finished. It's a good
basis for perf sched nevertheless.

Most of its guts are not hooked up to the perf event loop
yet - that will be done in the patches to come.

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/builtin-sched.c          |  842 +++++++++++++++++++++++++++++++++-
 tools/perf/util/trace-event-parse.c |   16 +-
 tools/perf/util/trace-event.h       |    2 +
 3 files changed, 827 insertions(+), 33 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 60228d9..c66e6a3 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -12,22 +12,770 @@
 #include "util/debug.h"
 
 #include "util/trace-event.h"
+#include <sys/types.h>
 
-static char		const *input_name = "perf.data";
-static int		input;
-static unsigned long	page_size;
-static unsigned long	mmap_window = 32;
+static char			const *input_name = "perf.data";
+static int			input;
+static unsigned long		page_size;
+static unsigned long		mmap_window = 32;
 
-static unsigned long	total = 0;
-static unsigned long	total_comm = 0;
+static unsigned long		total_comm = 0;
 
-static struct rb_root	threads;
-static struct thread	*last_match;
+static struct rb_root		threads;
+static struct thread		*last_match;
 
-static struct perf_header *header;
-static u64		sample_type;
+static struct perf_header	*header;
+static u64			sample_type;
 
 
+/*
+ * Scheduler benchmarks
+ */
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/prctl.h>
+
+#include <linux/unistd.h>
+
+#include <semaphore.h>
+#include <pthread.h>
+#include <signal.h>
+#include <values.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <time.h>
+#include <math.h>
+
+#include <stdio.h>
+
+#define PR_SET_NAME	15               /* Set process name */
+
+#define BUG_ON(x)	assert(!(x))
+
+#define DEBUG		1
+
+typedef unsigned long long nsec_t;
+
+#define printk(x...)		do { printf(x); fflush(stdout); } while (0)
+
+nsec_t prev_printk;
+
+#define __dprintk(x,y...) do {						 \
+	nsec_t __now = get_nsecs(), __delta = __now - prev_printk;	 \
+									 \
+	prev_printk = __now;						 \
+									 \
+	printf("%.3f [%Ld] [%.3f]: " x, (double)__now/1e6, __now, (double)__delta/1e6, y);\
+} while (0)
+
+#if !DEBUG
+# define dprintk(x...)	do { } while (0)
+#else
+# define dprintk(x...)	__dprintk(x)
+#endif
+
+#define __DP()		__dprintk("parent: line %d\n", __LINE__)
+#define DP()		dprintk("parent: line %d\n", __LINE__)
+#define D()		dprintk("task %ld: line %d\n", this_task->nr, __LINE__)
+
+
+static nsec_t run_measurement_overhead;
+static nsec_t sleep_measurement_overhead;
+
+static nsec_t get_nsecs(void)
+{
+	struct timespec ts;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+
+	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+}
+
+static void burn_nsecs(nsec_t nsecs)
+{
+	nsec_t T0 = get_nsecs(), T1;
+
+	do {
+		T1 = get_nsecs();
+	} while (T1 + run_measurement_overhead < T0 + nsecs);
+}
+
+static void sleep_nsecs(nsec_t nsecs)
+{
+	struct timespec ts;
+
+	ts.tv_nsec = nsecs % 999999999;
+	ts.tv_sec = nsecs / 999999999;
+
+	nanosleep(&ts, NULL);
+}
+
+static void calibrate_run_measurement_overhead(void)
+{
+	nsec_t T0, T1, delta, min_delta = 1000000000ULL;
+	int i;
+
+	for (i = 0; i < 10; i++) {
+		T0 = get_nsecs();
+		burn_nsecs(0);
+		T1 = get_nsecs();
+		delta = T1-T0;
+		min_delta = min(min_delta, delta);
+	}
+	run_measurement_overhead = min_delta;
+
+	printk("run measurement overhead: %Ld nsecs\n", min_delta);
+}
+
+static void calibrate_sleep_measurement_overhead(void)
+{
+	nsec_t T0, T1, delta, min_delta = 1000000000ULL;
+	int i;
+
+	for (i = 0; i < 10; i++) {
+		T0 = get_nsecs();
+		sleep_nsecs(10000);
+		T1 = get_nsecs();
+		delta = T1-T0;
+		min_delta = min(min_delta, delta);
+	}
+	min_delta -= 10000;
+	sleep_measurement_overhead = min_delta;
+
+	printk("sleep measurement overhead: %Ld nsecs\n", min_delta);
+}
+
+#define COMM_LEN	20
+#define SYM_LEN		129
+
+#define MAX_PID		65536
+
+static unsigned long nr_tasks;
+
+struct sched_event;
+
+struct task_desc {
+	unsigned long		nr;
+	unsigned long		pid;
+	char			comm[COMM_LEN];
+
+	unsigned long		nr_events;
+	unsigned long		curr_event;
+	struct sched_event	**events;
+
+	pthread_t		thread;
+	sem_t			sleep_sem;
+
+	sem_t			ready_for_work;
+	sem_t			work_done_sem;
+
+	nsec_t			cpu_usage;
+};
+
+enum sched_event_type {
+	SCHED_EVENT_RUN,
+	SCHED_EVENT_SLEEP,
+	SCHED_EVENT_WAKEUP,
+};
+
+struct sched_event {
+	enum sched_event_type	type;
+	nsec_t			timestamp;
+	nsec_t			duration;
+	unsigned long		nr;
+	int			specific_wait;
+	sem_t			*wait_sem;
+	struct task_desc	*wakee;
+};
+
+static struct task_desc		*pid_to_task[MAX_PID];
+
+static struct task_desc		**tasks;
+
+static pthread_mutex_t		start_work_mutex = PTHREAD_MUTEX_INITIALIZER;
+static nsec_t			start_time;
+
+static pthread_mutex_t		work_done_wait_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static unsigned long		nr_run_events;
+static unsigned long		nr_sleep_events;
+static unsigned long		nr_wakeup_events;
+
+static unsigned long		nr_sleep_corrections;
+static unsigned long		nr_run_events_optimized;
+
+static struct sched_event *
+get_new_event(struct task_desc *task, nsec_t timestamp)
+{
+	struct sched_event *event = calloc(1, sizeof(*event));
+	unsigned long idx = task->nr_events;
+	size_t size;
+
+	event->timestamp = timestamp;
+	event->nr = idx;
+
+	task->nr_events++;
+	size = sizeof(struct sched_event *) * task->nr_events;
+	task->events = realloc(task->events, size);
+	BUG_ON(!task->events);
+
+	task->events[idx] = event;
+
+	return event;
+}
+
+static struct sched_event *last_event(struct task_desc *task)
+{
+	if (!task->nr_events)
+		return NULL;
+
+	return task->events[task->nr_events - 1];
+}
+
+static void
+add_sched_event_run(struct task_desc *task, nsec_t timestamp,
+		    unsigned long duration)
+{
+	struct sched_event *event, *curr_event = last_event(task);
+
+	/*
+ 	 * optimize an existing RUN event by merging this one
+ 	 * to it:
+ 	 */
+	if (curr_event && curr_event->type == SCHED_EVENT_RUN) {
+		nr_run_events_optimized++;
+		curr_event->duration += duration;
+		return;
+	}
+
+	event = get_new_event(task, timestamp);
+
+	event->type = SCHED_EVENT_RUN;
+	event->duration = duration;
+
+	nr_run_events++;
+}
+
+static unsigned long targetless_wakeups;
+static unsigned long multitarget_wakeups;
+
+static void
+add_sched_event_wakeup(struct task_desc *task, nsec_t timestamp,
+		       struct task_desc *wakee)
+{
+	struct sched_event *event, *wakee_event;
+
+	event = get_new_event(task, timestamp);
+	event->type = SCHED_EVENT_WAKEUP;
+	event->wakee = wakee;
+
+	wakee_event = last_event(wakee);
+	if (!wakee_event || wakee_event->type != SCHED_EVENT_SLEEP) {
+		targetless_wakeups++;
+		return;
+	}
+	if (wakee_event->wait_sem) {
+		multitarget_wakeups++;
+		return;
+	}
+
+	wakee_event->wait_sem = calloc(1, sizeof(*wakee_event->wait_sem));
+	sem_init(wakee_event->wait_sem, 0, 0);
+	wakee_event->specific_wait = 1;
+	event->wait_sem = wakee_event->wait_sem;
+
+	nr_wakeup_events++;
+}
+
+static void
+add_sched_event_sleep(struct task_desc *task, nsec_t timestamp,
+		      unsigned long uninterruptible __used)
+{
+	struct sched_event *event = get_new_event(task, timestamp);
+
+	event->type = SCHED_EVENT_SLEEP;
+
+	nr_sleep_events++;
+}
+
+static struct task_desc *register_pid(unsigned long pid, const char *comm)
+{
+	struct task_desc *task;
+
+	BUG_ON(pid >= MAX_PID);
+
+	task = pid_to_task[pid];
+
+	if (task)
+		return task;
+
+	task = calloc(1, sizeof(*task));
+	task->pid = pid;
+	task->nr = nr_tasks;
+	strcpy(task->comm, comm);
+	/*
+	 * every task starts in sleeping state - this gets ignored
+	 * if there's no wakeup pointing to this sleep state:
+	 */
+	add_sched_event_sleep(task, 0, 0);
+
+	pid_to_task[pid] = task;
+	nr_tasks++;
+	tasks = realloc(tasks, nr_tasks*sizeof(struct task_task *));
+	BUG_ON(!tasks);
+	tasks[task->nr] = task;
+
+	printk("registered task #%ld, PID %ld (%s)\n", nr_tasks, pid, comm);
+
+	return task;
+}
+
+
+static int first_trace_line = 1;
+
+static nsec_t first_timestamp;
+static nsec_t prev_timestamp;
+
+void parse_line(char *line);
+
+void parse_line(char *line)
+{
+	unsigned long param1 = 0, param2 = 0;
+	char comm[COMM_LEN], comm2[COMM_LEN];
+	unsigned long pid, pid2, timestamp0;
+	struct task_desc *task, *task2;
+	char func_str[SYM_LEN];
+	nsec_t timestamp;
+	int ret;
+
+	//"   <idle> 0     0D.s3    0us+: try_to_wake_up <events/0 9> (1 0)"
+	ret = sscanf(line, "%20s %5ld %*s %ldus%*c:"
+			   " %128s <%20s %ld> (%ld %ld)\n",
+		comm, &pid, &timestamp0,
+		func_str, comm2, &pid2, &param1, &param2);
+	dprintk("ret: %d\n", ret);
+	if (ret != 8)
+		return;
+
+	timestamp = timestamp0 * 1000LL;
+
+	if (first_trace_line) {
+		first_trace_line = 0;
+		first_timestamp = timestamp;
+	}
+
+	timestamp -= first_timestamp;
+	BUG_ON(timestamp < prev_timestamp);
+	prev_timestamp = timestamp;
+
+	dprintk("parsed: %s - %ld %Ld: %s - <%s %ld> (%ld %ld)\n",
+		comm,
+		pid,
+		timestamp, 
+		func_str,
+		comm2,
+		pid2,
+		param1,
+		param2);
+
+	task = register_pid(pid, comm);
+	task2 = register_pid(pid2, comm2);
+
+	if (!strcmp(func_str, "update_curr")) {
+		dprintk("%Ld: task %ld runs for %ld nsecs\n",
+			timestamp, task->nr, param1);
+		add_sched_event_run(task, timestamp, param1);
+	} else if (!strcmp(func_str, "try_to_wake_up")) {
+		dprintk("%Ld: task %ld wakes up task %ld\n",
+			timestamp, task->nr, task2->nr);
+		add_sched_event_wakeup(task, timestamp, task2);
+	} else if (!strcmp(func_str, "deactivate_task")) {
+		dprintk("%Ld: task %ld goes to sleep (uninterruptible: %ld)\n",
+			timestamp, task->nr, param1);
+		add_sched_event_sleep(task, timestamp, param1);
+	}
+}
+
+static void print_task_traces(void)
+{
+	struct task_desc *task;
+	unsigned long i;
+
+	for (i = 0; i < nr_tasks; i++) {
+		task = tasks[i];
+		printk("task %6ld (%20s:%10ld), nr_events: %ld\n",
+			task->nr, task->comm, task->pid, task->nr_events);
+	}
+}
+
+static void add_cross_task_wakeups(void)
+{
+	struct task_desc *task1, *task2;
+	unsigned long i, j;
+
+	for (i = 0; i < nr_tasks; i++) {
+		task1 = tasks[i];
+		j = i + 1;
+		if (j == nr_tasks)
+			j = 0;
+		task2 = tasks[j];
+		add_sched_event_wakeup(task1, 0, task2);
+	}
+}
+
+static void
+process_sched_event(struct task_desc *this_task, struct sched_event *event)
+{
+	int ret = 0;
+	nsec_t now;
+	long long delta;
+
+	now = get_nsecs();
+	delta = start_time + event->timestamp - now;
+
+	dprintk("task %ld, event #%ld, %Ld, delta: %.3f (%Ld)\n",
+		this_task->nr, event->nr, event->timestamp,
+		(double)delta/1e6, delta);
+
+	if (0 && delta > 0) {
+		dprintk("%.3f: task %ld FIX %.3f\n",
+			(double)event->timestamp/1e6,
+			this_task->nr,
+			(double)delta/1e6);
+		sleep_nsecs(start_time + event->timestamp - now);
+		nr_sleep_corrections++;
+	}
+
+	switch (event->type) {
+		case SCHED_EVENT_RUN:
+			dprintk("%.3f: task %ld RUN for %.3f\n",
+				(double)event->timestamp/1e6,
+				this_task->nr,
+				(double)event->duration/1e6);
+			burn_nsecs(event->duration);
+			break;
+		case SCHED_EVENT_SLEEP:
+			dprintk("%.3f: task %ld %s SLEEP\n",
+				(double)event->timestamp/1e6,
+				this_task->nr, event->wait_sem ? "" : "SKIP");
+			if (event->wait_sem)
+				ret = sem_wait(event->wait_sem);
+			BUG_ON(ret);
+			break;
+		case SCHED_EVENT_WAKEUP:
+			dprintk("%.3f: task %ld WAKEUP => task %ld\n",
+				(double)event->timestamp/1e6,
+				this_task->nr,
+				event->wakee->nr);
+			if (event->wait_sem)
+				ret = sem_post(event->wait_sem);
+			BUG_ON(ret);
+			break;
+		default:
+			BUG_ON(1);
+	}
+}
+
+static nsec_t get_cpu_usage_nsec_parent(void)
+{
+	struct rusage ru;
+	nsec_t sum;
+	int err;
+
+	err = getrusage(RUSAGE_SELF, &ru);
+	BUG_ON(err);
+
+	sum =  ru.ru_utime.tv_sec*1e9 + ru.ru_utime.tv_usec*1e3;
+	sum += ru.ru_stime.tv_sec*1e9 + ru.ru_stime.tv_usec*1e3;
+
+	return sum;
+}
+
+static nsec_t get_cpu_usage_nsec_self(void)
+{
+	char filename [] = "/proc/1234567890/sched";
+	unsigned long msecs, nsecs;
+	char *line = NULL;
+	nsec_t total = 0;
+	size_t len = 0;
+	ssize_t chars;
+	FILE *file;
+	int ret;
+
+	sprintf(filename, "/proc/%d/sched", getpid());
+	file = fopen(filename, "r");
+	BUG_ON(!file);
+
+	while ((chars = getline(&line, &len, file)) != -1) {
+		dprintk("got line with length %zu :\n", chars);
+		dprintk("%s", line);
+		ret = sscanf(line, "se.sum_exec_runtime : %ld.%06ld\n",
+			&msecs, &nsecs);
+		if (ret == 2) {
+			total = msecs*1e6 + nsecs;
+			dprintk("total: (%ld.%06ld) %Ld\n",
+				msecs, nsecs, total);
+			break;
+		}
+	}
+	if (line)
+		free(line);
+	fclose(file);
+
+	return total;
+}
+
+static void *thread_func(void *ctx)
+{
+	struct task_desc *this_task = ctx;
+	nsec_t cpu_usage_0, cpu_usage_1;
+	unsigned long i, ret;
+	char comm2[22];
+
+	dprintk("task %ld started up.\n", this_task->nr);
+	sprintf(comm2, ":%s", this_task->comm);
+	prctl(PR_SET_NAME, comm2);
+
+again:
+	ret = sem_post(&this_task->ready_for_work);
+	BUG_ON(ret);
+	D();
+	ret = pthread_mutex_lock(&start_work_mutex);
+	BUG_ON(ret);
+	ret = pthread_mutex_unlock(&start_work_mutex);
+	BUG_ON(ret);
+	D();
+
+	cpu_usage_0 = get_cpu_usage_nsec_self();
+
+	for (i = 0; i < this_task->nr_events; i++) {
+		this_task->curr_event = i;
+		process_sched_event(this_task, this_task->events[i]);
+	}
+
+	cpu_usage_1 = get_cpu_usage_nsec_self();
+	this_task->cpu_usage = cpu_usage_1 - cpu_usage_0;
+
+	dprintk("task %ld cpu usage: %0.3f msecs\n",
+		this_task->nr, (double)this_task->cpu_usage / 1e6);
+
+	D();
+	ret = sem_post(&this_task->work_done_sem);
+	BUG_ON(ret);
+	D();
+
+	ret = pthread_mutex_lock(&work_done_wait_mutex);
+	BUG_ON(ret);
+	ret = pthread_mutex_unlock(&work_done_wait_mutex);
+	BUG_ON(ret);
+	D();
+
+	goto again;
+}
+
+static void create_tasks(void)
+{
+	struct task_desc *task;
+	pthread_attr_t attr;
+	unsigned long i;
+	int err;
+
+	err = pthread_attr_init(&attr);
+	BUG_ON(err);
+	err = pthread_attr_setstacksize(&attr, (size_t)(16*1024));
+	BUG_ON(err);
+	err = pthread_mutex_lock(&start_work_mutex);
+	BUG_ON(err);
+	err = pthread_mutex_lock(&work_done_wait_mutex);
+	BUG_ON(err);
+	for (i = 0; i < nr_tasks; i++) {
+		task = tasks[i];
+		sem_init(&task->sleep_sem, 0, 0);
+		sem_init(&task->ready_for_work, 0, 0);
+		sem_init(&task->work_done_sem, 0, 0);
+		task->curr_event = 0;
+		err = pthread_create(&task->thread, &attr, thread_func, task);
+		BUG_ON(err);
+	}
+}
+
+static nsec_t cpu_usage;
+static nsec_t runavg_cpu_usage;
+static nsec_t parent_cpu_usage;
+static nsec_t runavg_parent_cpu_usage;
+
+static void wait_for_tasks(void)
+{
+	nsec_t cpu_usage_0, cpu_usage_1;
+	struct task_desc *task;
+	unsigned long i, ret;
+
+	DP();
+	start_time = get_nsecs();
+	DP();
+	cpu_usage = 0;
+	pthread_mutex_unlock(&work_done_wait_mutex);
+
+	for (i = 0; i < nr_tasks; i++) {
+		task = tasks[i];
+		ret = sem_wait(&task->ready_for_work);
+		BUG_ON(ret);
+		sem_init(&task->ready_for_work, 0, 0);
+	}
+	ret = pthread_mutex_lock(&work_done_wait_mutex);
+	BUG_ON(ret);
+
+	cpu_usage_0 = get_cpu_usage_nsec_parent();
+
+	pthread_mutex_unlock(&start_work_mutex);
+
+#if 0
+	for (i = 0; i < nr_tasks; i++) {
+		unsigned long missed;
+
+		task = tasks[i];
+		while (task->curr_event + 1 < task->nr_events) {
+			dprintk("parent waiting for %ld (%ld != %ld)\n",
+				i, task->curr_event, task->nr_events);
+			sleep_nsecs(100000000);
+		}
+		missed = task->nr_events - 1 - task->curr_event;
+		if (missed)
+			printk("task %ld missed events: %ld\n", i, missed);
+		ret = sem_post(&task->sleep_sem);
+		BUG_ON(ret);
+	}
+#endif
+	DP();
+	for (i = 0; i < nr_tasks; i++) {
+		task = tasks[i];
+		ret = sem_wait(&task->work_done_sem);
+		BUG_ON(ret);
+		sem_init(&task->work_done_sem, 0, 0);
+		cpu_usage += task->cpu_usage;
+		task->cpu_usage = 0;
+	}
+
+	cpu_usage_1 = get_cpu_usage_nsec_parent();
+	if (!runavg_cpu_usage)
+		runavg_cpu_usage = cpu_usage;
+	runavg_cpu_usage = (runavg_cpu_usage*9 + cpu_usage)/10;
+
+	parent_cpu_usage = cpu_usage_1 - cpu_usage_0;
+	if (!runavg_parent_cpu_usage)
+		runavg_parent_cpu_usage = parent_cpu_usage;
+	runavg_parent_cpu_usage = (runavg_parent_cpu_usage*9 +
+				   parent_cpu_usage)/10;
+
+	ret = pthread_mutex_lock(&start_work_mutex);
+	BUG_ON(ret);
+
+	for (i = 0; i < nr_tasks; i++) {
+		task = tasks[i];
+		sem_init(&task->sleep_sem, 0, 0);
+		task->curr_event = 0;
+	}
+}
+
+static int __cmd_sched(void);
+
+static void parse_trace(void)
+{
+	__cmd_sched();
+
+	printk("nr_run_events:        %ld\n", nr_run_events);
+	printk("nr_sleep_events:      %ld\n", nr_sleep_events);
+	printk("nr_wakeup_events:     %ld\n", nr_wakeup_events);
+
+	if (targetless_wakeups)
+		printk("target-less wakeups:  %ld\n", targetless_wakeups);
+	if (multitarget_wakeups)
+		printk("multi-target wakeups: %ld\n", multitarget_wakeups);
+	if (nr_run_events_optimized)
+		printk("run events optimized: %ld\n",
+			nr_run_events_optimized);
+}
+
+static unsigned long nr_runs;
+static nsec_t sum_runtime;
+static nsec_t sum_fluct;
+static nsec_t run_avg;
+
+static void run_one_test(void)
+{
+	nsec_t T0, T1, delta, avg_delta, fluct, std_dev;
+
+	T0 = get_nsecs();
+	wait_for_tasks();
+	T1 = get_nsecs();
+
+	delta = T1 - T0;
+	sum_runtime += delta;
+	nr_runs++;
+
+	avg_delta = sum_runtime / nr_runs;
+	if (delta < avg_delta)
+		fluct = avg_delta - delta;
+	else
+		fluct = delta - avg_delta;
+	sum_fluct += fluct;
+	std_dev = sum_fluct / nr_runs / sqrt(nr_runs);
+	if (!run_avg)
+		run_avg = delta;
+	run_avg = (run_avg*9 + delta)/10;
+
+	printk("#%-3ld: %0.3f, ",
+		nr_runs, (double)delta/1000000.0);
+
+#if 0
+	printk("%0.2f +- %0.2f, ",
+		(double)avg_delta/1e6, (double)std_dev/1e6);
+#endif
+	printk("ravg: %0.2f, ",
+		(double)run_avg/1e6);
+
+	printk("cpu: %0.2f / %0.2f",
+		(double)cpu_usage/1e6, (double)runavg_cpu_usage/1e6);
+
+#if 0
+	/*
+ 	 * rusage statistics done by the parent, these are less
+ 	 * accurate than the sum_exec_runtime based statistics:
+ 	 */
+	printk(" [%0.2f / %0.2f]",
+		(double)parent_cpu_usage/1e6,
+		(double)runavg_parent_cpu_usage/1e6);
+#endif
+
+	printk("\n");
+
+	if (nr_sleep_corrections)
+		printk(" (%ld sleep corrections)\n", nr_sleep_corrections);
+	nr_sleep_corrections = 0;
+}
+
+static void test_calibrations(void)
+{
+	nsec_t T0, T1;
+
+	T0 = get_nsecs();
+	burn_nsecs(1e6);
+	T1 = get_nsecs();
+
+	printk("the run test took %Ld nsecs\n", T1-T0);
+
+	T0 = get_nsecs();
+	sleep_nsecs(1e6);
+	T1 = get_nsecs();
+
+	printk("the sleep test took %Ld nsecs\n", T1-T0);
+}
+
 static int
 process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 {
@@ -50,6 +798,46 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
+static void process_sched_wakeup_event(struct event *event,
+		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
+{
+	printf("sched_wakeup event %p\n", event);
+}
+
+static void process_sched_switch_event(struct event *event,
+		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
+{
+	printf("sched_switch event %p\n", event);
+}
+
+static void
+process_raw_event(event_t *raw_event, void *more_data,
+		  int cpu, u64 timestamp, struct thread *thread)
+{
+	struct {
+		u32 size;
+		char data[0];
+	} *raw = more_data;
+	struct event *event;
+	int type;
+
+	type = trace_parse_common_type(raw->data);
+	event = trace_find_event(type);
+
+	/*
+	 * FIXME: better resolve from pid from the struct trace_entry
+	 * field, although it should be the same than this perf
+	 * event pid
+	 */
+	printf("id %d, type: %d, event: %s\n",
+		raw_event->header.type, type, event->name);
+
+	if (!strcmp(event->name, "sched_switch"))
+		process_sched_switch_event(event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_wakeup"))
+		process_sched_wakeup_event(event, cpu, timestamp, thread);
+}
+
 static int
 process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 {
@@ -122,20 +910,8 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		dump_printf(" ...... dso: [hypervisor]\n");
 	}
 
-	if (sample_type & PERF_SAMPLE_RAW) {
-		struct {
-			u32 size;
-			char data[0];
-		} *raw = more_data;
-
-		/*
-		 * FIXME: better resolve from pid from the struct trace_entry
-		 * field, although it should be the same than this perf
-		 * event pid
-		 */
-		print_event(cpu, raw->data, raw->size, timestamp, thread->comm);
-	}
-	total += period;
+	if (sample_type & PERF_SAMPLE_RAW)
+		process_raw_event(event, more_data, cpu, timestamp, thread);
 
 	return 0;
 }
@@ -277,6 +1053,8 @@ static const struct option options[] = {
 
 int cmd_sched(int argc, const char **argv, const char *prefix __used)
 {
+	long nr_iterations = LONG_MAX, i;
+
 	symbol__init();
 	page_size = getpagesize();
 
@@ -293,5 +1071,19 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 
 	setup_pager();
 
-	return __cmd_sched();
+	calibrate_run_measurement_overhead();
+	calibrate_sleep_measurement_overhead();
+
+	test_calibrations();
+
+	parse_trace();
+	print_task_traces();
+	add_cross_task_wakeups();
+
+	create_tasks();
+	printk("------------------------------------------------------------\n");
+	for (i = 0; i < nr_iterations; i++)
+		run_one_test();
+
+	return 0;
 }
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 629e602..16cf2d5 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1799,7 +1799,7 @@ static int get_common_info(const char *type, int *offset, int *size)
 	return 0;
 }
 
-static int parse_common_type(void *data)
+int trace_parse_common_type(void *data)
 {
 	static int type_offset;
 	static int type_size;
@@ -1832,7 +1832,7 @@ static int parse_common_pid(void *data)
 	return read_size(data + pid_offset, pid_size);
 }
 
-static struct event *find_event(int id)
+struct event *trace_find_event(int id)
 {
 	struct event *event;
 
@@ -2420,8 +2420,8 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func,
 	int type;
 	int pid;
 
-	type = parse_common_type(next->data);
-	event = find_event(type);
+	type = trace_parse_common_type(next->data);
+	event = trace_find_event(type);
 	if (!event)
 		return NULL;
 
@@ -2502,8 +2502,8 @@ print_graph_entry_leaf(struct event *event, void *data, struct record *ret_rec)
 	int type;
 	int i;
 
-	type = parse_common_type(ret_rec->data);
-	ret_event = find_event(type);
+	type = trace_parse_common_type(ret_rec->data);
+	ret_event = trace_find_event(type);
 
 	field = find_field(ret_event, "rettime");
 	if (!field)
@@ -2696,9 +2696,9 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs,
 	nsecs -= secs * NSECS_PER_SEC;
 	usecs = nsecs / NSECS_PER_USEC;
 
-	type = parse_common_type(data);
+	type = trace_parse_common_type(data);
 
-	event = find_event(type);
+	event = trace_find_event(type);
 	if (!event)
 		die("ug! no event found for type %d", type);
 
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 420294a..bc81612 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -234,6 +234,8 @@ extern int header_page_data_offset;
 extern int header_page_data_size;
 
 int parse_header_page(char *buf, unsigned long size);
+int trace_parse_common_type(void *data);
+struct event *trace_find_event(int id);
 
 void read_tracing_data(struct perf_counter_attr *pattrs, int nb_counters);
 

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

* [tip:perfcounters/core] perf sched: Implement the scheduling workload replay engine
       [not found]             ` <new-submission>
                                 ` (343 preceding siblings ...)
  2009-09-15  9:30               ` [tip:perfcounters/core] perf sched: Import schedbench.c tip-bot for Ingo Molnar
@ 2009-09-15  9:31               ` tip-bot for Ingo Molnar
  2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Tighten up the code tip-bot for Ingo Molnar
                                 ` (361 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  fbf9482911825f965829567aea8acff3bbc5279c
Gitweb:     http://git.kernel.org/tip/fbf9482911825f965829567aea8acff3bbc5279c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:38 +0200

perf sched: Implement the scheduling workload replay engine

Integrate the schedbench.c bits with the raw trace events
that we get from the perf machinery, and activate the
workload replayer/simulator.

Example of a captured 'make -j' workload:

$ perf sched

  run measurement overhead: 90 nsecs
  sleep measurement overhead: 2724743 nsecs
  the run test took 1000081 nsecs
  the sleep test took 2981111 nsecs
  version = 0.5
  ...
  nr_run_events:        70
  nr_sleep_events:      66
  nr_wakeup_events:     9
  target-less wakeups:  71
  multi-target wakeups: 47
  run events optimized: 139
  task      0 (                perf:      6607), nr_events: 2
  task      1 (                perf:      6608), nr_events: 6
  task      2 (                    :         0), nr_events: 1
  task      3 (                make:      6609), nr_events: 5
  task      4 (                  sh:      6610), nr_events: 4
  task      5 (                make:      6611), nr_events: 6
  task      6 (                  sh:      6612), nr_events: 4
  task      7 (                make:      6613), nr_events: 5
  task      8 (        migration/11:        25), nr_events: 1
  task      9 (        migration/13:        29), nr_events: 1
  task     10 (        migration/15:        33), nr_events: 1
  task     11 (         migration/9:        21), nr_events: 1
  task     12 (                  sh:      6614), nr_events: 4
  task     13 (                make:      6615), nr_events: 5
  task     14 (                  sh:      6616), nr_events: 4
  task     15 (                make:      6617), nr_events: 7
  task     16 (         migration/3:         9), nr_events: 1
  task     17 (         migration/5:        13), nr_events: 1
  task     18 (         migration/7:        17), nr_events: 1
  task     19 (         migration/1:         5), nr_events: 1
  task     20 (                  sh:      6618), nr_events: 4
  task     21 (                make:      6619), nr_events: 5
  task     22 (                  sh:      6620), nr_events: 4
  task     23 (                make:      6621), nr_events: 10
  task     24 (                  sh:      6623), nr_events: 3
  task     25 (                 gcc:      6624), nr_events: 4
  task     26 (                 gcc:      6625), nr_events: 4
  task     27 (                 gcc:      6626), nr_events: 5
  task     28 (            collect2:      6627), nr_events: 5
  task     29 (                  sh:      6622), nr_events: 1
  task     30 (                make:      6628), nr_events: 7
  task     31 (                  sh:      6630), nr_events: 4
  task     32 (                 gcc:      6631), nr_events: 4
  task     33 (                  sh:      6629), nr_events: 1
  task     34 (                 gcc:      6632), nr_events: 4
  task     35 (                 gcc:      6633), nr_events: 4
  task     36 (            collect2:      6634), nr_events: 4
  task     37 (                make:      6635), nr_events: 8
  task     38 (                  sh:      6637), nr_events: 4
  task     39 (                  sh:      6636), nr_events: 1
  task     40 (                 gcc:      6638), nr_events: 4
  task     41 (                 gcc:      6639), nr_events: 4
  task     42 (                 gcc:      6640), nr_events: 4
  task     43 (            collect2:      6641), nr_events: 4
  task     44 (                make:      6642), nr_events: 6
  task     45 (                  sh:      6643), nr_events: 5
  task     46 (                  sh:      6644), nr_events: 3
  task     47 (                  sh:      6645), nr_events: 4
  task     48 (                make:      6646), nr_events: 6
  task     49 (                  sh:      6647), nr_events: 3
  task     50 (                make:      6648), nr_events: 5
  task     51 (                  sh:      6649), nr_events: 5
  task     52 (                  sh:      6650), nr_events: 6
  task     53 (                make:      6651), nr_events: 4
  task     54 (                make:      6652), nr_events: 5
  task     55 (                make:      6653), nr_events: 4
  task     56 (                make:      6654), nr_events: 4
  task     57 (                make:      6655), nr_events: 5
  task     58 (                  sh:      6656), nr_events: 4
  task     59 (                 gcc:      6657), nr_events: 9
  task     60 (         ksoftirqd/3:        10), nr_events: 1
  task     61 (                 gcc:      6658), nr_events: 4
  task     62 (                make:      6659), nr_events: 5
  task     63 (                  sh:      6660), nr_events: 3
  task     64 (                 gcc:      6661), nr_events: 5
  task     65 (            collect2:      6662), nr_events: 4
  ------------------------------------------------------------
  #1  : 256.745, ravg: 256.74, cpu: 0.00 / 0.00
  #2  : 439.372, ravg: 275.01, cpu: 0.00 / 0.00
  #3  : 411.971, ravg: 288.70, cpu: 0.00 / 0.00
  #4  : 385.500, ravg: 298.38, cpu: 0.00 / 0.00
  #5  : 366.526, ravg: 305.20, cpu: 0.00 / 0.00
  #6  : 381.281, ravg: 312.81, cpu: 0.00 / 0.00
  #7  : 410.756, ravg: 322.60, cpu: 0.00 / 0.00
  #8  : 368.009, ravg: 327.14, cpu: 0.00 / 0.00
  #9  : 408.098, ravg: 335.24, cpu: 0.00 / 0.00
  #10 : 368.582, ravg: 338.57, cpu: 0.00 / 0.00

I.e. we successfully analyzed the trace, replayed it
via real threads and measured the replayed workload's
scheduling properties.

This is how it looked like in 'top' output:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  7164 mingo     20   0 1434m 8080  888 R 57.0  0.1   0:02.04 :perf
  7165 mingo     20   0 1434m 8080  888 R 41.8  0.1   0:01.52 :perf
  7228 mingo     20   0 1434m 8080  888 R 39.8  0.1   0:01.44 :gcc
  7225 mingo     20   0 1434m 8080  888 R 33.8  0.1   0:01.26 :gcc
  7202 mingo     20   0 1434m 8080  888 R 31.2  0.1   0:01.16 :sh
  7222 mingo     20   0 1434m 8080  888 R 25.2  0.1   0:00.96 :sh
  7211 mingo     20   0 1434m 8080  888 R 21.9  0.1   0:00.82 :sh
  7213 mingo     20   0 1434m 8080  888 D 19.2  0.1   0:00.74 :sh
  7194 mingo     20   0 1434m 8080  888 D 18.6  0.1   0:00.72 :make

There's still various kinks in it - more patches to come.

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/builtin-sched.c |  152 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 134 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c66e6a3..6ec4f51 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -57,7 +57,7 @@ static u64			sample_type;
 
 #define BUG_ON(x)	assert(!(x))
 
-#define DEBUG		1
+#define DEBUG		0
 
 typedef unsigned long long nsec_t;
 
@@ -238,15 +238,14 @@ static struct sched_event *last_event(struct task_desc *task)
 }
 
 static void
-add_sched_event_run(struct task_desc *task, nsec_t timestamp,
-		    unsigned long duration)
+add_sched_event_run(struct task_desc *task, nsec_t timestamp, u64 duration)
 {
 	struct sched_event *event, *curr_event = last_event(task);
 
 	/*
- 	 * optimize an existing RUN event by merging this one
- 	 * to it:
- 	 */
+	 * optimize an existing RUN event by merging this one
+	 * to it:
+	 */
 	if (curr_event && curr_event->type == SCHED_EVENT_RUN) {
 		nr_run_events_optimized++;
 		curr_event->duration += duration;
@@ -376,7 +375,7 @@ void parse_line(char *line)
 	dprintk("parsed: %s - %ld %Ld: %s - <%s %ld> (%ld %ld)\n",
 		comm,
 		pid,
-		timestamp, 
+		timestamp,
 		func_str,
 		comm2,
 		pid2,
@@ -429,7 +428,7 @@ static void add_cross_task_wakeups(void)
 }
 
 static void
-process_sched_event(struct task_desc *this_task, struct sched_event *event)
+process_sched_event(struct task_desc *this_task __used, struct sched_event *event)
 {
 	int ret = 0;
 	nsec_t now;
@@ -744,9 +743,9 @@ static void run_one_test(void)
 
 #if 0
 	/*
- 	 * rusage statistics done by the parent, these are less
- 	 * accurate than the sum_exec_runtime based statistics:
- 	 */
+	 * rusage statistics done by the parent, these are less
+	 * accurate than the sum_exec_runtime based statistics:
+	 */
 	printk(" [%0.2f / %0.2f]",
 		(double)parent_cpu_usage/1e6,
 		(double)runavg_parent_cpu_usage/1e6);
@@ -798,16 +797,128 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
-static void process_sched_wakeup_event(struct event *event,
+struct trace_wakeup_event {
+	u32 size;
+
+	u16 common_type;
+	u8 common_flags;
+	u8 common_preempt_count;
+	u32 common_pid;
+	u32 common_tgid;
+
+	char comm[16];
+	u32 pid;
+
+	u32 prio;
+	u32 success;
+	u32 cpu;
+};
+
+static void
+process_sched_wakeup_event(struct trace_wakeup_event *wakeup_event, struct event *event,
 		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
 {
+	struct task_desc *waker, *wakee;
+
 	printf("sched_wakeup event %p\n", event);
+
+	printf(" ... pid %d woke up %s/%d\n",
+		wakeup_event->common_pid,
+		wakeup_event->comm,
+		wakeup_event->pid);
+
+	waker = register_pid(wakeup_event->common_pid, "<unknown>");
+	wakee = register_pid(wakeup_event->pid, wakeup_event->comm);
+
+	add_sched_event_wakeup(waker, timestamp, wakee);
 }
 
-static void process_sched_switch_event(struct event *event,
+struct trace_switch_event {
+	u32 size;
+
+	u16 common_type;
+	u8 common_flags;
+	u8 common_preempt_count;
+	u32 common_pid;
+	u32 common_tgid;
+
+	char prev_comm[16];
+	u32 prev_pid;
+	u32 prev_prio;
+	u64 prev_state;
+	char next_comm[16];
+	u32 next_pid;
+	u32 next_prio;
+};
+
+#define MAX_CPUS 4096
+
+unsigned long cpu_last_switched[MAX_CPUS];
+
+static void
+process_sched_switch_event(struct trace_switch_event *switch_event, struct event *event,
 		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
 {
+	struct task_desc *prev, *next;
+	u64 timestamp0;
+	s64 delta;
+
 	printf("sched_switch event %p\n", event);
+	if (cpu >= MAX_CPUS || cpu < 0)
+		return;
+
+	timestamp0 = cpu_last_switched[cpu];
+	if (timestamp0)
+		delta = timestamp - timestamp0;
+	else
+		delta = 0;
+
+	if (delta < 0)
+		die("hm, delta: %Ld < 0 ?\n", delta);
+
+	printf(" ... switch from %s/%d to %s/%d [ran %Ld nsecs]\n",
+		switch_event->prev_comm, switch_event->prev_pid,
+		switch_event->next_comm, switch_event->next_pid,
+		delta);
+
+	prev = register_pid(switch_event->prev_pid, switch_event->prev_comm);
+	next = register_pid(switch_event->next_pid, switch_event->next_comm);
+
+	cpu_last_switched[cpu] = timestamp;
+
+	add_sched_event_run(prev, timestamp, delta);
+}
+
+struct trace_fork_event {
+	u32 size;
+
+	u16 common_type;
+	u8 common_flags;
+	u8 common_preempt_count;
+	u32 common_pid;
+	u32 common_tgid;
+
+	char parent_comm[16];
+	u32 parent_pid;
+	char child_comm[16];
+	u32 child_pid;
+};
+
+static void
+process_sched_fork_event(struct trace_fork_event *fork_event, struct event *event,
+		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
+{
+	printf("sched_fork event %p\n", event);
+	printf("... parent: %s/%d\n", fork_event->parent_comm, fork_event->parent_pid);
+	printf("...  child: %s/%d\n", fork_event->child_comm, fork_event->child_pid);
+	register_pid(fork_event->parent_pid, fork_event->parent_comm);
+	register_pid(fork_event->child_pid, fork_event->child_comm);
+}
+
+static void process_sched_exit_event(struct event *event,
+		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
+{
+	printf("sched_exit event %p\n", event);
 }
 
 static void
@@ -833,9 +944,15 @@ process_raw_event(event_t *raw_event, void *more_data,
 		raw_event->header.type, type, event->name);
 
 	if (!strcmp(event->name, "sched_switch"))
-		process_sched_switch_event(event, cpu, timestamp, thread);
+		process_sched_switch_event(more_data, event, cpu, timestamp, thread);
 	if (!strcmp(event->name, "sched_wakeup"))
-		process_sched_wakeup_event(event, cpu, timestamp, thread);
+		process_sched_wakeup_event(more_data, event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_wakeup_new"))
+		process_sched_wakeup_event(more_data, event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_process_fork"))
+		process_sched_fork_event(more_data, event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_process_exit"))
+		process_sched_exit_event(event, cpu, timestamp, thread);
 }
 
 static int
@@ -1053,7 +1170,7 @@ static const struct option options[] = {
 
 int cmd_sched(int argc, const char **argv, const char *prefix __used)
 {
-	long nr_iterations = LONG_MAX, i;
+	long nr_iterations = 10, i;
 
 	symbol__init();
 	page_size = getpagesize();
@@ -1068,8 +1185,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 			usage_with_options(annotate_usage, options);
 	}
 
-
-	setup_pager();
+//	setup_pager();
 
 	calibrate_run_measurement_overhead();
 	calibrate_sleep_measurement_overhead();

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

* [tip:perfcounters/core] perf sched: Tighten up the code
       [not found]             ` <new-submission>
                                 ` (344 preceding siblings ...)
  2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Implement the scheduling workload replay engine tip-bot for Ingo Molnar
@ 2009-09-15  9:31               ` tip-bot for Ingo Molnar
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Clean up latency and replay sub-commands tip-bot for Ingo Molnar
                                 ` (360 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  ad236fd23b6d6372dcacd549983cce051d2ccff6
Gitweb:     http://git.kernel.org/tip/ad236fd23b6d6372dcacd549983cce051d2ccff6
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:39 +0200

perf sched: Tighten up the code

Various small cleanups - removal of debug printks and dead
functions, etc.

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/builtin-sched.c |  236 +++++++++-----------------------------------
 1 files changed, 47 insertions(+), 189 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 6ec4f51..de93a26 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -61,29 +61,6 @@ static u64			sample_type;
 
 typedef unsigned long long nsec_t;
 
-#define printk(x...)		do { printf(x); fflush(stdout); } while (0)
-
-nsec_t prev_printk;
-
-#define __dprintk(x,y...) do {						 \
-	nsec_t __now = get_nsecs(), __delta = __now - prev_printk;	 \
-									 \
-	prev_printk = __now;						 \
-									 \
-	printf("%.3f [%Ld] [%.3f]: " x, (double)__now/1e6, __now, (double)__delta/1e6, y);\
-} while (0)
-
-#if !DEBUG
-# define dprintk(x...)	do { } while (0)
-#else
-# define dprintk(x...)	__dprintk(x)
-#endif
-
-#define __DP()		__dprintk("parent: line %d\n", __LINE__)
-#define DP()		dprintk("parent: line %d\n", __LINE__)
-#define D()		dprintk("task %ld: line %d\n", this_task->nr, __LINE__)
-
-
 static nsec_t run_measurement_overhead;
 static nsec_t sleep_measurement_overhead;
 
@@ -129,7 +106,7 @@ static void calibrate_run_measurement_overhead(void)
 	}
 	run_measurement_overhead = min_delta;
 
-	printk("run measurement overhead: %Ld nsecs\n", min_delta);
+	printf("run measurement overhead: %Ld nsecs\n", min_delta);
 }
 
 static void calibrate_sleep_measurement_overhead(void)
@@ -147,7 +124,7 @@ static void calibrate_sleep_measurement_overhead(void)
 	min_delta -= 10000;
 	sleep_measurement_overhead = min_delta;
 
-	printk("sleep measurement overhead: %Ld nsecs\n", min_delta);
+	printf("sleep measurement overhead: %Ld nsecs\n", min_delta);
 }
 
 #define COMM_LEN	20
@@ -293,7 +270,7 @@ add_sched_event_wakeup(struct task_desc *task, nsec_t timestamp,
 
 static void
 add_sched_event_sleep(struct task_desc *task, nsec_t timestamp,
-		      unsigned long uninterruptible __used)
+		      u64 task_state __used)
 {
 	struct sched_event *event = get_new_event(task, timestamp);
 
@@ -329,77 +306,13 @@ static struct task_desc *register_pid(unsigned long pid, const char *comm)
 	BUG_ON(!tasks);
 	tasks[task->nr] = task;
 
-	printk("registered task #%ld, PID %ld (%s)\n", nr_tasks, pid, comm);
+	if (verbose)
+		printf("registered task #%ld, PID %ld (%s)\n", nr_tasks, pid, comm);
 
 	return task;
 }
 
 
-static int first_trace_line = 1;
-
-static nsec_t first_timestamp;
-static nsec_t prev_timestamp;
-
-void parse_line(char *line);
-
-void parse_line(char *line)
-{
-	unsigned long param1 = 0, param2 = 0;
-	char comm[COMM_LEN], comm2[COMM_LEN];
-	unsigned long pid, pid2, timestamp0;
-	struct task_desc *task, *task2;
-	char func_str[SYM_LEN];
-	nsec_t timestamp;
-	int ret;
-
-	//"   <idle> 0     0D.s3    0us+: try_to_wake_up <events/0 9> (1 0)"
-	ret = sscanf(line, "%20s %5ld %*s %ldus%*c:"
-			   " %128s <%20s %ld> (%ld %ld)\n",
-		comm, &pid, &timestamp0,
-		func_str, comm2, &pid2, &param1, &param2);
-	dprintk("ret: %d\n", ret);
-	if (ret != 8)
-		return;
-
-	timestamp = timestamp0 * 1000LL;
-
-	if (first_trace_line) {
-		first_trace_line = 0;
-		first_timestamp = timestamp;
-	}
-
-	timestamp -= first_timestamp;
-	BUG_ON(timestamp < prev_timestamp);
-	prev_timestamp = timestamp;
-
-	dprintk("parsed: %s - %ld %Ld: %s - <%s %ld> (%ld %ld)\n",
-		comm,
-		pid,
-		timestamp,
-		func_str,
-		comm2,
-		pid2,
-		param1,
-		param2);
-
-	task = register_pid(pid, comm);
-	task2 = register_pid(pid2, comm2);
-
-	if (!strcmp(func_str, "update_curr")) {
-		dprintk("%Ld: task %ld runs for %ld nsecs\n",
-			timestamp, task->nr, param1);
-		add_sched_event_run(task, timestamp, param1);
-	} else if (!strcmp(func_str, "try_to_wake_up")) {
-		dprintk("%Ld: task %ld wakes up task %ld\n",
-			timestamp, task->nr, task2->nr);
-		add_sched_event_wakeup(task, timestamp, task2);
-	} else if (!strcmp(func_str, "deactivate_task")) {
-		dprintk("%Ld: task %ld goes to sleep (uninterruptible: %ld)\n",
-			timestamp, task->nr, param1);
-		add_sched_event_sleep(task, timestamp, param1);
-	}
-}
-
 static void print_task_traces(void)
 {
 	struct task_desc *task;
@@ -407,7 +320,7 @@ static void print_task_traces(void)
 
 	for (i = 0; i < nr_tasks; i++) {
 		task = tasks[i];
-		printk("task %6ld (%20s:%10ld), nr_events: %ld\n",
+		printf("task %6ld (%20s:%10ld), nr_events: %ld\n",
 			task->nr, task->comm, task->pid, task->nr_events);
 	}
 }
@@ -437,40 +350,16 @@ process_sched_event(struct task_desc *this_task __used, struct sched_event *even
 	now = get_nsecs();
 	delta = start_time + event->timestamp - now;
 
-	dprintk("task %ld, event #%ld, %Ld, delta: %.3f (%Ld)\n",
-		this_task->nr, event->nr, event->timestamp,
-		(double)delta/1e6, delta);
-
-	if (0 && delta > 0) {
-		dprintk("%.3f: task %ld FIX %.3f\n",
-			(double)event->timestamp/1e6,
-			this_task->nr,
-			(double)delta/1e6);
-		sleep_nsecs(start_time + event->timestamp - now);
-		nr_sleep_corrections++;
-	}
-
 	switch (event->type) {
 		case SCHED_EVENT_RUN:
-			dprintk("%.3f: task %ld RUN for %.3f\n",
-				(double)event->timestamp/1e6,
-				this_task->nr,
-				(double)event->duration/1e6);
 			burn_nsecs(event->duration);
 			break;
 		case SCHED_EVENT_SLEEP:
-			dprintk("%.3f: task %ld %s SLEEP\n",
-				(double)event->timestamp/1e6,
-				this_task->nr, event->wait_sem ? "" : "SKIP");
 			if (event->wait_sem)
 				ret = sem_wait(event->wait_sem);
 			BUG_ON(ret);
 			break;
 		case SCHED_EVENT_WAKEUP:
-			dprintk("%.3f: task %ld WAKEUP => task %ld\n",
-				(double)event->timestamp/1e6,
-				this_task->nr,
-				event->wakee->nr);
 			if (event->wait_sem)
 				ret = sem_post(event->wait_sem);
 			BUG_ON(ret);
@@ -511,14 +400,10 @@ static nsec_t get_cpu_usage_nsec_self(void)
 	BUG_ON(!file);
 
 	while ((chars = getline(&line, &len, file)) != -1) {
-		dprintk("got line with length %zu :\n", chars);
-		dprintk("%s", line);
 		ret = sscanf(line, "se.sum_exec_runtime : %ld.%06ld\n",
 			&msecs, &nsecs);
 		if (ret == 2) {
 			total = msecs*1e6 + nsecs;
-			dprintk("total: (%ld.%06ld) %Ld\n",
-				msecs, nsecs, total);
 			break;
 		}
 	}
@@ -536,19 +421,16 @@ static void *thread_func(void *ctx)
 	unsigned long i, ret;
 	char comm2[22];
 
-	dprintk("task %ld started up.\n", this_task->nr);
 	sprintf(comm2, ":%s", this_task->comm);
 	prctl(PR_SET_NAME, comm2);
 
 again:
 	ret = sem_post(&this_task->ready_for_work);
 	BUG_ON(ret);
-	D();
 	ret = pthread_mutex_lock(&start_work_mutex);
 	BUG_ON(ret);
 	ret = pthread_mutex_unlock(&start_work_mutex);
 	BUG_ON(ret);
-	D();
 
 	cpu_usage_0 = get_cpu_usage_nsec_self();
 
@@ -560,19 +442,13 @@ again:
 	cpu_usage_1 = get_cpu_usage_nsec_self();
 	this_task->cpu_usage = cpu_usage_1 - cpu_usage_0;
 
-	dprintk("task %ld cpu usage: %0.3f msecs\n",
-		this_task->nr, (double)this_task->cpu_usage / 1e6);
-
-	D();
 	ret = sem_post(&this_task->work_done_sem);
 	BUG_ON(ret);
-	D();
 
 	ret = pthread_mutex_lock(&work_done_wait_mutex);
 	BUG_ON(ret);
 	ret = pthread_mutex_unlock(&work_done_wait_mutex);
 	BUG_ON(ret);
-	D();
 
 	goto again;
 }
@@ -614,9 +490,7 @@ static void wait_for_tasks(void)
 	struct task_desc *task;
 	unsigned long i, ret;
 
-	DP();
 	start_time = get_nsecs();
-	DP();
 	cpu_usage = 0;
 	pthread_mutex_unlock(&work_done_wait_mutex);
 
@@ -633,24 +507,6 @@ static void wait_for_tasks(void)
 
 	pthread_mutex_unlock(&start_work_mutex);
 
-#if 0
-	for (i = 0; i < nr_tasks; i++) {
-		unsigned long missed;
-
-		task = tasks[i];
-		while (task->curr_event + 1 < task->nr_events) {
-			dprintk("parent waiting for %ld (%ld != %ld)\n",
-				i, task->curr_event, task->nr_events);
-			sleep_nsecs(100000000);
-		}
-		missed = task->nr_events - 1 - task->curr_event;
-		if (missed)
-			printk("task %ld missed events: %ld\n", i, missed);
-		ret = sem_post(&task->sleep_sem);
-		BUG_ON(ret);
-	}
-#endif
-	DP();
 	for (i = 0; i < nr_tasks; i++) {
 		task = tasks[i];
 		ret = sem_wait(&task->work_done_sem);
@@ -687,16 +543,16 @@ static void parse_trace(void)
 {
 	__cmd_sched();
 
-	printk("nr_run_events:        %ld\n", nr_run_events);
-	printk("nr_sleep_events:      %ld\n", nr_sleep_events);
-	printk("nr_wakeup_events:     %ld\n", nr_wakeup_events);
+	printf("nr_run_events:        %ld\n", nr_run_events);
+	printf("nr_sleep_events:      %ld\n", nr_sleep_events);
+	printf("nr_wakeup_events:     %ld\n", nr_wakeup_events);
 
 	if (targetless_wakeups)
-		printk("target-less wakeups:  %ld\n", targetless_wakeups);
+		printf("target-less wakeups:  %ld\n", targetless_wakeups);
 	if (multitarget_wakeups)
-		printk("multi-target wakeups: %ld\n", multitarget_wakeups);
+		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
 	if (nr_run_events_optimized)
-		printk("run events optimized: %ld\n",
+		printf("run events optimized: %ld\n",
 			nr_run_events_optimized);
 }
 
@@ -728,17 +584,17 @@ static void run_one_test(void)
 		run_avg = delta;
 	run_avg = (run_avg*9 + delta)/10;
 
-	printk("#%-3ld: %0.3f, ",
+	printf("#%-3ld: %0.3f, ",
 		nr_runs, (double)delta/1000000.0);
 
 #if 0
-	printk("%0.2f +- %0.2f, ",
+	printf("%0.2f +- %0.2f, ",
 		(double)avg_delta/1e6, (double)std_dev/1e6);
 #endif
-	printk("ravg: %0.2f, ",
+	printf("ravg: %0.2f, ",
 		(double)run_avg/1e6);
 
-	printk("cpu: %0.2f / %0.2f",
+	printf("cpu: %0.2f / %0.2f",
 		(double)cpu_usage/1e6, (double)runavg_cpu_usage/1e6);
 
 #if 0
@@ -746,15 +602,15 @@ static void run_one_test(void)
 	 * rusage statistics done by the parent, these are less
 	 * accurate than the sum_exec_runtime based statistics:
 	 */
-	printk(" [%0.2f / %0.2f]",
+	printf(" [%0.2f / %0.2f]",
 		(double)parent_cpu_usage/1e6,
 		(double)runavg_parent_cpu_usage/1e6);
 #endif
 
-	printk("\n");
+	printf("\n");
 
 	if (nr_sleep_corrections)
-		printk(" (%ld sleep corrections)\n", nr_sleep_corrections);
+		printf(" (%ld sleep corrections)\n", nr_sleep_corrections);
 	nr_sleep_corrections = 0;
 }
 
@@ -766,13 +622,13 @@ static void test_calibrations(void)
 	burn_nsecs(1e6);
 	T1 = get_nsecs();
 
-	printk("the run test took %Ld nsecs\n", T1-T0);
+	printf("the run test took %Ld nsecs\n", T1-T0);
 
 	T0 = get_nsecs();
 	sleep_nsecs(1e6);
 	T1 = get_nsecs();
 
-	printk("the sleep test took %Ld nsecs\n", T1-T0);
+	printf("the sleep test took %Ld nsecs\n", T1-T0);
 }
 
 static int
@@ -820,12 +676,14 @@ process_sched_wakeup_event(struct trace_wakeup_event *wakeup_event, struct event
 {
 	struct task_desc *waker, *wakee;
 
-	printf("sched_wakeup event %p\n", event);
+	if (verbose) {
+		printf("sched_wakeup event %p\n", event);
 
-	printf(" ... pid %d woke up %s/%d\n",
-		wakeup_event->common_pid,
-		wakeup_event->comm,
-		wakeup_event->pid);
+		printf(" ... pid %d woke up %s/%d\n",
+			wakeup_event->common_pid,
+			wakeup_event->comm,
+			wakeup_event->pid);
+	}
 
 	waker = register_pid(wakeup_event->common_pid, "<unknown>");
 	wakee = register_pid(wakeup_event->pid, wakeup_event->comm);
@@ -863,7 +721,9 @@ process_sched_switch_event(struct trace_switch_event *switch_event, struct event
 	u64 timestamp0;
 	s64 delta;
 
-	printf("sched_switch event %p\n", event);
+	if (verbose)
+		printf("sched_switch event %p\n", event);
+
 	if (cpu >= MAX_CPUS || cpu < 0)
 		return;
 
@@ -876,10 +736,12 @@ process_sched_switch_event(struct trace_switch_event *switch_event, struct event
 	if (delta < 0)
 		die("hm, delta: %Ld < 0 ?\n", delta);
 
-	printf(" ... switch from %s/%d to %s/%d [ran %Ld nsecs]\n",
-		switch_event->prev_comm, switch_event->prev_pid,
-		switch_event->next_comm, switch_event->next_pid,
-		delta);
+	if (verbose) {
+		printf(" ... switch from %s/%d to %s/%d [ran %Ld nsecs]\n",
+			switch_event->prev_comm, switch_event->prev_pid,
+			switch_event->next_comm, switch_event->next_pid,
+			delta);
+	}
 
 	prev = register_pid(switch_event->prev_pid, switch_event->prev_comm);
 	next = register_pid(switch_event->next_pid, switch_event->next_comm);
@@ -887,6 +749,7 @@ process_sched_switch_event(struct trace_switch_event *switch_event, struct event
 	cpu_last_switched[cpu] = timestamp;
 
 	add_sched_event_run(prev, timestamp, delta);
+	add_sched_event_sleep(prev, timestamp, switch_event->prev_state);
 }
 
 struct trace_fork_event {
@@ -908,9 +771,11 @@ static void
 process_sched_fork_event(struct trace_fork_event *fork_event, struct event *event,
 		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
 {
-	printf("sched_fork event %p\n", event);
-	printf("... parent: %s/%d\n", fork_event->parent_comm, fork_event->parent_pid);
-	printf("...  child: %s/%d\n", fork_event->child_comm, fork_event->child_pid);
+	if (verbose) {
+		printf("sched_fork event %p\n", event);
+		printf("... parent: %s/%d\n", fork_event->parent_comm, fork_event->parent_pid);
+		printf("...  child: %s/%d\n", fork_event->child_comm, fork_event->child_pid);
+	}
 	register_pid(fork_event->parent_pid, fork_event->parent_comm);
 	register_pid(fork_event->child_pid, fork_event->child_comm);
 }
@@ -918,11 +783,12 @@ process_sched_fork_event(struct trace_fork_event *fork_event, struct event *even
 static void process_sched_exit_event(struct event *event,
 		  int cpu __used, u64 timestamp __used, struct thread *thread __used)
 {
-	printf("sched_exit event %p\n", event);
+	if (verbose)
+		printf("sched_exit event %p\n", event);
 }
 
 static void
-process_raw_event(event_t *raw_event, void *more_data,
+process_raw_event(event_t *raw_event __used, void *more_data,
 		  int cpu, u64 timestamp, struct thread *thread)
 {
 	struct {
@@ -935,14 +801,6 @@ process_raw_event(event_t *raw_event, void *more_data,
 	type = trace_parse_common_type(raw->data);
 	event = trace_find_event(type);
 
-	/*
-	 * FIXME: better resolve from pid from the struct trace_entry
-	 * field, although it should be the same than this perf
-	 * event pid
-	 */
-	printf("id %d, type: %d, event: %s\n",
-		raw_event->header.type, type, event->name);
-
 	if (!strcmp(event->name, "sched_switch"))
 		process_sched_switch_event(more_data, event, cpu, timestamp, thread);
 	if (!strcmp(event->name, "sched_wakeup"))
@@ -1197,7 +1055,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 	add_cross_task_wakeups();
 
 	create_tasks();
-	printk("------------------------------------------------------------\n");
+	printf("------------------------------------------------------------\n");
 	for (i = 0; i < nr_iterations; i++)
 		run_one_test();
 

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

* [tip:perfcounters/core] perf sched: Clean up latency and replay sub-commands
       [not found]             ` <new-submission>
                                 ` (345 preceding siblings ...)
  2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Tighten up the code tip-bot for Ingo Molnar
@ 2009-09-15  9:32               ` tip-bot for Ingo Molnar
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Display time in milliseconds, reorganize output tip-bot for Ingo Molnar
                                 ` (359 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  46f392c97f9fd772426ed3361c5179a0d44b8c3f
Gitweb:     http://git.kernel.org/tip/46f392c97f9fd772426ed3361c5179a0d44b8c3f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 12 Sep 2009 10:08:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:44 +0200

perf sched: Clean up latency and replay sub-commands

- Separate the latency and the replay commands more cleanly

 - Use consistent naming

 - Display help page on 'perf sched' outlining comments,
   instead of aborting

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/builtin-sched.c |   99 ++++++++++++++++++++++----------------------
 1 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 4f9e943..84699cf 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -543,24 +543,7 @@ static void wait_for_tasks(void)
 	}
 }
 
-static int __cmd_sched(void);
-
-static void parse_trace(void)
-{
-	__cmd_sched();
-
-	printf("nr_run_events:        %ld\n", nr_run_events);
-	printf("nr_sleep_events:      %ld\n", nr_sleep_events);
-	printf("nr_wakeup_events:     %ld\n", nr_wakeup_events);
-
-	if (targetless_wakeups)
-		printf("target-less wakeups:  %ld\n", targetless_wakeups);
-	if (multitarget_wakeups)
-		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
-	if (nr_run_events_optimized)
-		printf("run events optimized: %ld\n",
-			nr_run_events_optimized);
-}
+static int read_events(void);
 
 static unsigned long nr_runs;
 static nsec_t sum_runtime;
@@ -637,6 +620,38 @@ static void test_calibrations(void)
 	printf("the sleep test took %Ld nsecs\n", T1-T0);
 }
 
+static void __cmd_replay(void)
+{
+	long nr_iterations = 10, i;
+
+	calibrate_run_measurement_overhead();
+	calibrate_sleep_measurement_overhead();
+
+	test_calibrations();
+
+	read_events();
+
+	printf("nr_run_events:        %ld\n", nr_run_events);
+	printf("nr_sleep_events:      %ld\n", nr_sleep_events);
+	printf("nr_wakeup_events:     %ld\n", nr_wakeup_events);
+
+	if (targetless_wakeups)
+		printf("target-less wakeups:  %ld\n", targetless_wakeups);
+	if (multitarget_wakeups)
+		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
+	if (nr_run_events_optimized)
+		printf("run events optimized: %ld\n",
+			nr_run_events_optimized);
+
+	print_task_traces();
+	add_cross_task_wakeups();
+
+	create_tasks();
+	printf("------------------------------------------------------------\n");
+	for (i = 0; i < nr_iterations; i++)
+		run_one_test();
+}
+
 static int
 process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 {
@@ -1091,10 +1106,13 @@ static void output_lat_thread(struct thread_latency *lat)
 	printf("%5d        %10llu       %10llu      %10llu\n", count, total, avg, max);
 }
 
-static void output_lat_results(void)
+static void __cmd_lat(void)
 {
 	struct rb_node *next;
 
+	setup_pager();
+	read_events();
+
 	printf(" Tasks");
 	printf("                     count");
 	printf("          total");
@@ -1312,7 +1330,7 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 	return 0;
 }
 
-static int __cmd_sched(void)
+static int read_events(void)
 {
 	int ret, rc = EXIT_FAILURE;
 	unsigned long offset = 0;
@@ -1408,8 +1426,8 @@ more:
 	return rc;
 }
 
-static const char * const annotate_usage[] = {
-	"perf trace [<options>] <command>",
+static const char * const sched_usage[] = {
+	"perf sched [<options>] <command>",
 	NULL
 };
 
@@ -1427,49 +1445,30 @@ static const struct option options[] = {
 
 int cmd_sched(int argc, const char **argv, const char *prefix __used)
 {
-	long nr_iterations = 10, i;
-
 	symbol__init();
 	page_size = getpagesize();
 
-	argc = parse_options(argc, argv, options, annotate_usage, 0);
+	argc = parse_options(argc, argv, options, sched_usage, 0);
 	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);
+			usage_with_options(sched_usage, options);
 	}
 
-//	setup_pager();
-
 	if (replay_mode)
 		trace_handler = &replay_ops;
 	else if (lat_mode)
 		trace_handler = &lat_ops;
-	else /* We may need a default subcommand (perf trace?) */
-		die("Please select a sub command (-r)\n");
-
-	if (replay_mode) {
-		calibrate_run_measurement_overhead();
-		calibrate_sleep_measurement_overhead();
-
-		test_calibrations();
-
-		parse_trace();
-		print_task_traces();
-		add_cross_task_wakeups();
-
-		create_tasks();
-		printf("------------------------------------------------------------\n");
-		for (i = 0; i < nr_iterations; i++)
-			run_one_test();
-	} else if (lat_mode) {
-		setup_pager();
-		__cmd_sched();
-		output_lat_results();
-	}
+	else
+		usage_with_options(sched_usage, options);
+
+	if (replay_mode)
+		__cmd_replay();
+	else if (lat_mode)
+		__cmd_lat();
 
 	return 0;
 }

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

* [tip:perfcounters/core] perf sched: Display time in milliseconds, reorganize output
       [not found]             ` <new-submission>
                                 ` (346 preceding siblings ...)
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Clean up latency and replay sub-commands tip-bot for Ingo Molnar
@ 2009-09-15  9:32               ` tip-bot for Ingo Molnar
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Add runtime stats tip-bot for Ingo Molnar
                                 ` (358 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  d9340c1db3f52460a8335eeb127a2728c5bba6ce
Gitweb:     http://git.kernel.org/tip/d9340c1db3f52460a8335eeb127a2728c5bba6ce
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 12 Sep 2009 10:08:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:44 +0200

perf sched: Display time in milliseconds, reorganize output

After:

-----------------------------------------------------------------------------------
 Task              |  runtime ms | switches | average delay ms | maximum delay ms |
-----------------------------------------------------------------------------------
 migration/0       |    0.000 ms |        1 | avg:    0.047 ms | max:    0.047 ms |
 ksoftirqd/0       |    0.000 ms |        1 | avg:    0.039 ms | max:    0.039 ms |
 migration/1       |    0.000 ms |        3 | avg:    0.013 ms | max:    0.016 ms |
 migration/3       |    0.000 ms |        2 | avg:    0.003 ms | max:    0.004 ms |
 migration/4       |    0.000 ms |        1 | avg:    0.022 ms | max:    0.022 ms |
 distccd           |    0.000 ms |        1 | avg:    0.004 ms | max:    0.004 ms |
 distccd           |    0.000 ms |        1 | avg:    0.014 ms | max:    0.014 ms |
 distccd           |    0.000 ms |        2 | avg:    0.000 ms | max:    0.000 ms |
 distccd           |    0.000 ms |        2 | avg:    0.012 ms | max:    0.019 ms |
 distccd           |    0.000 ms |        1 | avg:    0.002 ms | max:    0.002 ms |
 as                |    0.000 ms |        2 | avg:    0.019 ms | max:    0.019 ms |
 as                |    0.000 ms |        3 | avg:    0.015 ms | max:    0.017 ms |
 as                |    0.000 ms |        1 | avg:    0.009 ms | max:    0.009 ms |
 perf              |    0.000 ms |        1 | avg:    0.001 ms | max:    0.001 ms |
 gcc               |    0.000 ms |        1 | avg:    0.021 ms | max:    0.021 ms |
 run-mozilla.sh    |    0.000 ms |        2 | avg:    0.010 ms | max:    0.017 ms |
 mozilla-plugin-   |    0.000 ms |        1 | avg:    0.006 ms | max:    0.006 ms |
 gcc               |    0.000 ms |        2 | avg:    0.013 ms | max:    0.013 ms |
-----------------------------------------------------------------------------------

(The runtime ms column is not filled in yet.)

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/builtin-sched.c         |   17 +++++++++--------
 tools/perf/util/trace-event-read.c |    6 ++++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 84699cf..a084c28 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1096,14 +1096,15 @@ static void output_lat_thread(struct thread_latency *lat)
 	if (!count)
 		return;
 
-	ret = printf("%s", lat->thread->comm);
+	ret = printf(" %s ", lat->thread->comm);
 
-	for (i = 0; i < 25 - ret; i++)
+	for (i = 0; i < 19 - ret; i++)
 		printf(" ");
 
 	avg = total / count;
 
-	printf("%5d        %10llu       %10llu      %10llu\n", count, total, avg, max);
+	printf("|%9.3f ms |%9d | avg:%9.3f ms | max:%9.3f ms |\n",
+		0.0, count, (double)avg/1e9, (double)max/1e9);
 }
 
 static void __cmd_lat(void)
@@ -1113,11 +1114,9 @@ static void __cmd_lat(void)
 	setup_pager();
 	read_events();
 
-	printf(" Tasks");
-	printf("                     count");
-	printf("          total");
-	printf("              avg");
-	printf("            max\n\n");
+	printf("-----------------------------------------------------------------------------------\n");
+	printf(" Task              |  runtime ms | switches | average delay ms | maximum delay ms |\n");
+	printf("-----------------------------------------------------------------------------------\n");
 
 	next = rb_first(&lat_snapshot_root);
 
@@ -1128,6 +1127,8 @@ static void __cmd_lat(void)
 		output_lat_thread(lat);
 		next = rb_next(next);
 	}
+
+	printf("-----------------------------------------------------------------------------------\n");
 }
 
 static struct trace_sched_handler *trace_handler;
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index a1217a1..1b5c847 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -458,12 +458,13 @@ struct record *trace_read_data(int cpu)
 	return data;
 }
 
-void trace_report (void)
+void trace_report(void)
 {
 	const char *input_file = "trace.info";
 	char buf[BUFSIZ];
 	char test[] = { 23, 8, 68 };
 	char *version;
+	int show_version = 0;
 	int show_funcs = 0;
 	int show_printk = 0;
 
@@ -480,7 +481,8 @@ void trace_report (void)
 		die("not a trace file (missing tracing)");
 
 	version = read_string();
-	printf("version = %s\n", version);
+	if (show_version)
+		printf("version = %s\n", version);
 	free(version);
 
 	read_or_die(buf, 1);

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

* [tip:perfcounters/core] perf sched: Add runtime stats
       [not found]             ` <new-submission>
                                 ` (347 preceding siblings ...)
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Display time in milliseconds, reorganize output tip-bot for Ingo Molnar
@ 2009-09-15  9:32               ` tip-bot for Ingo Molnar
  2009-09-15  9:33               ` [tip:perfcounters/core] perf sched: Output runtime and context switch totals tip-bot for Ingo Molnar
                                 ` (357 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  ea92ed5a8f4e6c638efe7de2efe8a875d580ad3f
Gitweb:     http://git.kernel.org/tip/ea92ed5a8f4e6c638efe7de2efe8a875d580ad3f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 12 Sep 2009 10:08:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:45 +0200

perf sched: Add runtime stats

Extend the latency tracking structure with scheduling atom
runtime info - and sum it up during per task display.

(Also clean up a few details.)

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/builtin-sched.c |   58 ++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index a084c28..c382f53 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -243,8 +243,8 @@ add_sched_event_run(struct task_desc *task, nsec_t timestamp, u64 duration)
 	nr_run_events++;
 }
 
-static unsigned long targetless_wakeups;
-static unsigned long multitarget_wakeups;
+static unsigned long		targetless_wakeups;
+static unsigned long		multitarget_wakeups;
 
 static void
 add_sched_event_wakeup(struct task_desc *task, nsec_t timestamp,
@@ -485,10 +485,10 @@ static void create_tasks(void)
 	}
 }
 
-static nsec_t cpu_usage;
-static nsec_t runavg_cpu_usage;
-static nsec_t parent_cpu_usage;
-static nsec_t runavg_parent_cpu_usage;
+static nsec_t			cpu_usage;
+static nsec_t			runavg_cpu_usage;
+static nsec_t			parent_cpu_usage;
+static nsec_t			runavg_parent_cpu_usage;
 
 static void wait_for_tasks(void)
 {
@@ -858,9 +858,9 @@ replay_fork_event(struct trace_fork_event *fork_event,
 }
 
 static struct trace_sched_handler replay_ops  = {
-	.wakeup_event = replay_wakeup_event,
-	.switch_event = replay_switch_event,
-	.fork_event = replay_fork_event,
+	.wakeup_event		= replay_wakeup_event,
+	.switch_event		= replay_switch_event,
+	.fork_event		= replay_fork_event,
 };
 
 #define TASK_STATE_TO_CHAR_STR "RSDTtZX"
@@ -877,6 +877,7 @@ struct lat_snapshot {
 	enum thread_state	state;
 	u64			wake_up_time;
 	u64			sched_in_time;
+	u64			runtime;
 };
 
 struct thread_latency {
@@ -951,6 +952,7 @@ latency_fork_event(struct trace_fork_event *fork_event __used,
 	/* should insert the newcomer */
 }
 
+__used
 static char sched_out_state(struct trace_switch_event *switch_event)
 {
 	const char *str = TASK_STATE_TO_CHAR_STR;
@@ -960,17 +962,15 @@ static char sched_out_state(struct trace_switch_event *switch_event)
 
 static void
 lat_sched_out(struct thread_latency *lat,
-	     struct trace_switch_event *switch_event)
+	     struct trace_switch_event *switch_event __used, u64 delta)
 {
 	struct lat_snapshot *snapshot;
 
-	if (sched_out_state(switch_event) == 'R')
-		return;
-
 	snapshot = calloc(sizeof(*snapshot), 1);
 	if (!snapshot)
 		die("Non memory");
 
+	snapshot->runtime = delta;
 	list_add_tail(&snapshot->list, &lat->snapshot_list);
 }
 
@@ -997,16 +997,31 @@ lat_sched_in(struct thread_latency *lat, u64 timestamp)
 	snapshot->sched_in_time = timestamp;
 }
 
-
 static void
 latency_switch_event(struct trace_switch_event *switch_event,
 		     struct event *event __used,
-		     int cpu __used,
+		     int cpu,
 		     u64 timestamp,
 		     struct thread *thread __used)
 {
 	struct thread_latency *out_lat, *in_lat;
 	struct thread *sched_out, *sched_in;
+	u64 timestamp0;
+	s64 delta;
+
+	if (cpu >= MAX_CPUS || cpu < 0)
+		return;
+
+	timestamp0 = cpu_last_switched[cpu];
+	cpu_last_switched[cpu] = timestamp;
+	if (timestamp0)
+		delta = timestamp - timestamp0;
+	else
+		delta = 0;
+
+	if (delta < 0)
+		die("hm, delta: %Ld < 0 ?\n", delta);
+
 
 	sched_out = threads__findnew(switch_event->prev_pid, &threads, &last_match);
 	sched_in = threads__findnew(switch_event->next_pid, &threads, &last_match);
@@ -1028,7 +1043,7 @@ latency_switch_event(struct trace_switch_event *switch_event,
 	}
 
 	lat_sched_in(in_lat, timestamp);
-	lat_sched_out(out_lat, switch_event);
+	lat_sched_out(out_lat, switch_event, delta);
 }
 
 static void
@@ -1067,9 +1082,9 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 }
 
 static struct trace_sched_handler lat_ops  = {
-	.wakeup_event = latency_wakeup_event,
-	.switch_event = latency_switch_event,
-	.fork_event = latency_fork_event,
+	.wakeup_event		= latency_wakeup_event,
+	.switch_event		= latency_switch_event,
+	.fork_event		= latency_fork_event,
 };
 
 static void output_lat_thread(struct thread_latency *lat)
@@ -1080,8 +1095,11 @@ static void output_lat_thread(struct thread_latency *lat)
 	int ret;
 	u64 max = 0, avg;
 	u64 total = 0, delta;
+	u64 total_runtime = 0;
 
 	list_for_each_entry(shot, &lat->snapshot_list, list) {
+		total_runtime += shot->runtime;
+
 		if (shot->state != THREAD_SCHED_IN)
 			continue;
 
@@ -1104,7 +1122,7 @@ static void output_lat_thread(struct thread_latency *lat)
 	avg = total / count;
 
 	printf("|%9.3f ms |%9d | avg:%9.3f ms | max:%9.3f ms |\n",
-		0.0, count, (double)avg/1e9, (double)max/1e9);
+		(double)total_runtime/1e9, count, (double)avg/1e9, (double)max/1e9);
 }
 
 static void __cmd_lat(void)

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

* [tip:perfcounters/core] perf sched: Output runtime and context switch totals
       [not found]             ` <new-submission>
                                 ` (348 preceding siblings ...)
  2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Add runtime stats tip-bot for Ingo Molnar
@ 2009-09-15  9:33               ` tip-bot for Ingo Molnar
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Add 'perf sched latency' and 'perf sched replay' tip-bot for Ingo Molnar
                                 ` (356 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  3e304147cdb404ce6d1dd0e50cb19f52142bb363
Gitweb:     http://git.kernel.org/tip/3e304147cdb404ce6d1dd0e50cb19f52142bb363
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 12 Sep 2009 10:08:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:45 +0200

perf sched: Output runtime and context switch totals

After:

-----------------------------------------------------------------------------------
 Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
-----------------------------------------------------------------------------------
 make              |    0.678 ms |       13 | avg:    0.018 ms | max:    0.050 ms |
 gcc               |    0.014 ms |        2 | avg:    0.320 ms | max:    0.627 ms |
 gcc               |    0.000 ms |        2 | avg:    0.185 ms | max:    0.369 ms |
...
-----------------------------------------------------------------------------------
 TOTAL:            |   21.316 ms |       63 |
---------------------------------------------

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/builtin-sched.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c382f53..727cc5b 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1087,6 +1087,9 @@ static struct trace_sched_handler lat_ops  = {
 	.fork_event		= latency_fork_event,
 };
 
+static u64 all_runtime;
+static u64 all_count;
+
 static void output_lat_thread(struct thread_latency *lat)
 {
 	struct lat_snapshot *shot;
@@ -1111,6 +1114,9 @@ static void output_lat_thread(struct thread_latency *lat)
 		total += delta;
 	}
 
+	all_runtime += total_runtime;
+	all_count += count;
+
 	if (!count)
 		return;
 
@@ -1133,7 +1139,7 @@ static void __cmd_lat(void)
 	read_events();
 
 	printf("-----------------------------------------------------------------------------------\n");
-	printf(" Task              |  runtime ms | switches | average delay ms | maximum delay ms |\n");
+	printf(" Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |\n");
 	printf("-----------------------------------------------------------------------------------\n");
 
 	next = rb_first(&lat_snapshot_root);
@@ -1147,6 +1153,9 @@ static void __cmd_lat(void)
 	}
 
 	printf("-----------------------------------------------------------------------------------\n");
+	printf(" TOTAL:            |%9.3f ms |%9Ld |\n",
+		(double)all_runtime/1e9, all_count);
+	printf("---------------------------------------------\n");
 }
 
 static struct trace_sched_handler *trace_handler;

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

* [tip:perfcounters/core] perf sched: Add 'perf sched latency' and 'perf sched replay'
       [not found]             ` <new-submission>
                                 ` (349 preceding siblings ...)
  2009-09-15  9:33               ` [tip:perfcounters/core] perf sched: Output runtime and context switch totals tip-bot for Ingo Molnar
@ 2009-09-15  9:34               ` tip-bot for Ingo Molnar
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Finish latency => atom rename and misc cleanups tip-bot for Ingo Molnar
                                 ` (355 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  f2858d8ad9858e63c87257553c5721cba5db95ae
Gitweb:     http://git.kernel.org/tip/f2858d8ad9858e63c87257553c5721cba5db95ae
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:49 +0200

perf sched: Add 'perf sched latency' and 'perf sched replay'

Separate the option parsing cleanly and add two variants:

 - 'perf sched latency' (can be abbreviated via 'perf sched lat')
 - 'perf sched replay'  (can be abbreviated via 'perf sched rep')

Also add a repeat count option to replay and add a separation
set of options for replay.

Do the sorting setup only in the latency sub-command.

Display separate help screens for 'perf sched' and
'perf sched replay -h' - i.e. further separation of the
sub-commands.

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/builtin-sched.c |   90 ++++++++++++++++++++++++++++---------------
 1 files changed, 58 insertions(+), 32 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 10fcd49..e01cc63 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -30,9 +30,6 @@ static struct thread		*last_match;
 static struct perf_header	*header;
 static u64			sample_type;
 
-static int			replay_mode;
-static int			lat_mode;
-
 static char			default_sort_order[] = "avg, max, switch, runtime";
 static char			*sort_order = default_sort_order;
 
@@ -623,9 +620,11 @@ static void test_calibrations(void)
 	printf("the sleep test took %Ld nsecs\n", T1-T0);
 }
 
+static unsigned long replay_repeat = 10;
+
 static void __cmd_replay(void)
 {
-	long nr_iterations = 10, i;
+	unsigned long i;
 
 	calibrate_run_measurement_overhead();
 	calibrate_sleep_measurement_overhead();
@@ -651,7 +650,7 @@ static void __cmd_replay(void)
 
 	create_tasks();
 	printf("------------------------------------------------------------\n");
-	for (i = 0; i < nr_iterations; i++)
+	for (i = 0; i < replay_repeat; i++)
 		run_one_test();
 }
 
@@ -1623,21 +1622,45 @@ more:
 }
 
 static const char * const sched_usage[] = {
-	"perf sched [<options>] <command>",
+	"perf sched [<options>] {record|latency|replay}",
 	NULL
 };
 
-static const struct option options[] = {
+static const struct option sched_options[] = {
+	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_BOOLEAN('r', "replay", &replay_mode,
-		    "replay sched behaviour from traces"),
-	OPT_BOOLEAN('l', "latency", &lat_mode,
-		    "measure various latencies"),
+	OPT_END()
+};
+
+static const char * const latency_usage[] = {
+	"perf sched latency [<options>]",
+	NULL
+};
+
+static const struct option latency_options[] = {
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): runtime, switch, avg, max"),
 	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_END()
+};
+
+static const char * const replay_usage[] = {
+	"perf sched replay [<options>]",
+	NULL
+};
+
+static const struct option replay_options[] = {
+	OPT_INTEGER('r', "repeat", &replay_repeat,
+		    "repeat the workload replay N times (-1: infinite)"),
+	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_END()
 };
 
@@ -1649,7 +1672,7 @@ static void setup_sorting(void)
 			tok; tok = strtok_r(NULL, ", ", &tmp)) {
 		if (sort_dimension__add(tok, &sort_list) < 0) {
 			error("Unknown --sort key: `%s'", tok);
-			usage_with_options(sched_usage, options);
+			usage_with_options(latency_usage, latency_options);
 		}
 	}
 
@@ -1663,29 +1686,32 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 	symbol__init();
 	page_size = getpagesize();
 
-	argc = parse_options(argc, argv, options, sched_usage, 0);
-	if (argc) {
-		/*
-		 * Special case: if there's an argument left then assume tha
-		 * it's a symbol filter:
-		 */
-		if (argc > 1)
-			usage_with_options(sched_usage, options);
-	}
+	argc = parse_options(argc, argv, sched_options, sched_usage,
+			     PARSE_OPT_STOP_AT_NON_OPTION);
+	if (!argc)
+		usage_with_options(sched_usage, sched_options);
 
-	if (replay_mode)
-		trace_handler = &replay_ops;
-	else if (lat_mode)
+	if (!strncmp(argv[0], "lat", 3)) {
 		trace_handler = &lat_ops;
-	else
-		usage_with_options(sched_usage, options);
-
-	setup_sorting();
-
-	if (replay_mode)
-		__cmd_replay();
-	else if (lat_mode)
+		if (argc > 1) {
+			argc = parse_options(argc, argv, latency_options, latency_usage, 0);
+			if (argc)
+				usage_with_options(latency_usage, latency_options);
+			setup_sorting();
+		}
 		__cmd_lat();
+	} else if (!strncmp(argv[0], "rep", 3)) {
+		trace_handler = &replay_ops;
+		if (argc) {
+			argc = parse_options(argc, argv, replay_options, replay_usage, 0);
+			if (argc)
+				usage_with_options(replay_usage, replay_options);
+		}
+		__cmd_replay();
+	} else {
+		usage_with_options(sched_usage, sched_options);
+	}
+
 
 	return 0;
 }

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

* [tip:perfcounters/core] perf sched: Finish latency => atom rename and misc cleanups
       [not found]             ` <new-submission>
                                 ` (350 preceding siblings ...)
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Add 'perf sched latency' and 'perf sched replay' tip-bot for Ingo Molnar
@ 2009-09-15  9:34               ` tip-bot for Ingo Molnar
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Clean up PID sorting logic tip-bot for Ingo Molnar
                                 ` (354 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  b1ffe8f3e0c96f5527a89e24410d6b0e59b3554a
Gitweb:     http://git.kernel.org/tip/b1ffe8f3e0c96f5527a89e24410d6b0e59b3554a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:49 +0200

perf sched: Finish latency => atom rename and misc cleanups

- Rename 'latency' field/variable names to the better 'atom' ones

 - Reduce the number of #include lines and consolidate them

 - Gather file scope variables at the top of the file

 - Remove unused bits

No change in functionality.

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/builtin-sched.c |  399 ++++++++++++++++++++------------------------
 1 files changed, 184 insertions(+), 215 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e01cc63..cc2dbd5 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "perf.h"
 
 #include "util/util.h"
 #include "util/cache.h"
@@ -7,15 +8,16 @@
 #include "util/header.h"
 
 #include "util/parse-options.h"
+#include "util/trace-event.h"
 
-#include "perf.h"
 #include "util/debug.h"
 
-#include "util/trace-event.h"
 #include <sys/types.h>
+#include <sys/prctl.h>
 
-
-#define MAX_CPUS 4096
+#include <semaphore.h>
+#include <pthread.h>
+#include <math.h>
 
 static char			const *input_name = "perf.data";
 static int			input;
@@ -33,44 +35,126 @@ static u64			sample_type;
 static char			default_sort_order[] = "avg, max, switch, runtime";
 static char			*sort_order = default_sort_order;
 
+#define PR_SET_NAME		15               /* Set process name */
+#define MAX_CPUS		4096
 
-/*
- * Scheduler benchmarks
- */
-#include <sys/resource.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/prctl.h>
+#define BUG_ON(x)		assert(!(x))
 
-#include <linux/unistd.h>
+static u64			run_measurement_overhead;
+static u64			sleep_measurement_overhead;
 
-#include <semaphore.h>
-#include <pthread.h>
-#include <signal.h>
-#include <values.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <time.h>
-#include <math.h>
+#define COMM_LEN		20
+#define SYM_LEN			129
 
-#include <stdio.h>
+#define MAX_PID			65536
 
-#define PR_SET_NAME	15               /* Set process name */
+static unsigned long		nr_tasks;
 
-#define BUG_ON(x)	assert(!(x))
+struct sched_event;
 
-#define DEBUG		0
+struct task_desc {
+	unsigned long		nr;
+	unsigned long		pid;
+	char			comm[COMM_LEN];
 
-typedef unsigned long long nsec_t;
+	unsigned long		nr_events;
+	unsigned long		curr_event;
+	struct sched_event	**events;
+
+	pthread_t		thread;
+	sem_t			sleep_sem;
 
-static nsec_t run_measurement_overhead;
-static nsec_t sleep_measurement_overhead;
+	sem_t			ready_for_work;
+	sem_t			work_done_sem;
+
+	u64			cpu_usage;
+};
+
+enum sched_event_type {
+	SCHED_EVENT_RUN,
+	SCHED_EVENT_SLEEP,
+	SCHED_EVENT_WAKEUP,
+};
+
+struct sched_event {
+	enum sched_event_type	type;
+	u64			timestamp;
+	u64			duration;
+	unsigned long		nr;
+	int			specific_wait;
+	sem_t			*wait_sem;
+	struct task_desc	*wakee;
+};
+
+static struct task_desc		*pid_to_task[MAX_PID];
+
+static struct task_desc		**tasks;
+
+static pthread_mutex_t		start_work_mutex = PTHREAD_MUTEX_INITIALIZER;
+static u64			start_time;
+
+static pthread_mutex_t		work_done_wait_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static nsec_t get_nsecs(void)
+static unsigned long		nr_run_events;
+static unsigned long		nr_sleep_events;
+static unsigned long		nr_wakeup_events;
+
+static unsigned long		nr_sleep_corrections;
+static unsigned long		nr_run_events_optimized;
+
+static unsigned long		targetless_wakeups;
+static unsigned long		multitarget_wakeups;
+
+static u64			cpu_usage;
+static u64			runavg_cpu_usage;
+static u64			parent_cpu_usage;
+static u64			runavg_parent_cpu_usage;
+
+static unsigned long		nr_runs;
+static u64			sum_runtime;
+static u64			sum_fluct;
+static u64			run_avg;
+
+static unsigned long		replay_repeat = 10;
+
+#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
+
+enum thread_state {
+	THREAD_SLEEPING = 0,
+	THREAD_WAIT_CPU,
+	THREAD_SCHED_IN,
+	THREAD_IGNORE
+};
+
+struct work_atom {
+	struct list_head	list;
+	enum thread_state	state;
+	u64			wake_up_time;
+	u64			sched_in_time;
+	u64			runtime;
+};
+
+struct task_atoms {
+	struct list_head	atom_list;
+	struct thread		*thread;
+	struct rb_node		node;
+	u64			max_lat;
+	u64			total_lat;
+	u64			nb_atoms;
+	u64			total_runtime;
+};
+
+typedef int (*sort_thread_lat)(struct task_atoms *, struct task_atoms *);
+
+static struct rb_root		atom_root, sorted_atom_root;
+
+static u64			all_runtime;
+static u64			all_count;
+
+static int read_events(void);
+
+
+static u64 get_nsecs(void)
 {
 	struct timespec ts;
 
@@ -79,16 +163,16 @@ static nsec_t get_nsecs(void)
 	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
 }
 
-static void burn_nsecs(nsec_t nsecs)
+static void burn_nsecs(u64 nsecs)
 {
-	nsec_t T0 = get_nsecs(), T1;
+	u64 T0 = get_nsecs(), T1;
 
 	do {
 		T1 = get_nsecs();
 	} while (T1 + run_measurement_overhead < T0 + nsecs);
 }
 
-static void sleep_nsecs(nsec_t nsecs)
+static void sleep_nsecs(u64 nsecs)
 {
 	struct timespec ts;
 
@@ -100,7 +184,7 @@ static void sleep_nsecs(nsec_t nsecs)
 
 static void calibrate_run_measurement_overhead(void)
 {
-	nsec_t T0, T1, delta, min_delta = 1000000000ULL;
+	u64 T0, T1, delta, min_delta = 1000000000ULL;
 	int i;
 
 	for (i = 0; i < 10; i++) {
@@ -117,7 +201,7 @@ static void calibrate_run_measurement_overhead(void)
 
 static void calibrate_sleep_measurement_overhead(void)
 {
-	nsec_t T0, T1, delta, min_delta = 1000000000ULL;
+	u64 T0, T1, delta, min_delta = 1000000000ULL;
 	int i;
 
 	for (i = 0; i < 10; i++) {
@@ -133,67 +217,8 @@ static void calibrate_sleep_measurement_overhead(void)
 	printf("sleep measurement overhead: %Ld nsecs\n", min_delta);
 }
 
-#define COMM_LEN	20
-#define SYM_LEN		129
-
-#define MAX_PID		65536
-
-static unsigned long nr_tasks;
-
-struct sched_event;
-
-struct task_desc {
-	unsigned long		nr;
-	unsigned long		pid;
-	char			comm[COMM_LEN];
-
-	unsigned long		nr_events;
-	unsigned long		curr_event;
-	struct sched_event	**events;
-
-	pthread_t		thread;
-	sem_t			sleep_sem;
-
-	sem_t			ready_for_work;
-	sem_t			work_done_sem;
-
-	nsec_t			cpu_usage;
-};
-
-enum sched_event_type {
-	SCHED_EVENT_RUN,
-	SCHED_EVENT_SLEEP,
-	SCHED_EVENT_WAKEUP,
-};
-
-struct sched_event {
-	enum sched_event_type	type;
-	nsec_t			timestamp;
-	nsec_t			duration;
-	unsigned long		nr;
-	int			specific_wait;
-	sem_t			*wait_sem;
-	struct task_desc	*wakee;
-};
-
-static struct task_desc		*pid_to_task[MAX_PID];
-
-static struct task_desc		**tasks;
-
-static pthread_mutex_t		start_work_mutex = PTHREAD_MUTEX_INITIALIZER;
-static nsec_t			start_time;
-
-static pthread_mutex_t		work_done_wait_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static unsigned long		nr_run_events;
-static unsigned long		nr_sleep_events;
-static unsigned long		nr_wakeup_events;
-
-static unsigned long		nr_sleep_corrections;
-static unsigned long		nr_run_events_optimized;
-
 static struct sched_event *
-get_new_event(struct task_desc *task, nsec_t timestamp)
+get_new_event(struct task_desc *task, u64 timestamp)
 {
 	struct sched_event *event = calloc(1, sizeof(*event));
 	unsigned long idx = task->nr_events;
@@ -221,7 +246,7 @@ static struct sched_event *last_event(struct task_desc *task)
 }
 
 static void
-add_sched_event_run(struct task_desc *task, nsec_t timestamp, u64 duration)
+add_sched_event_run(struct task_desc *task, u64 timestamp, u64 duration)
 {
 	struct sched_event *event, *curr_event = last_event(task);
 
@@ -243,11 +268,8 @@ add_sched_event_run(struct task_desc *task, nsec_t timestamp, u64 duration)
 	nr_run_events++;
 }
 
-static unsigned long		targetless_wakeups;
-static unsigned long		multitarget_wakeups;
-
 static void
-add_sched_event_wakeup(struct task_desc *task, nsec_t timestamp,
+add_sched_event_wakeup(struct task_desc *task, u64 timestamp,
 		       struct task_desc *wakee)
 {
 	struct sched_event *event, *wakee_event;
@@ -275,7 +297,7 @@ add_sched_event_wakeup(struct task_desc *task, nsec_t timestamp,
 }
 
 static void
-add_sched_event_sleep(struct task_desc *task, nsec_t timestamp,
+add_sched_event_sleep(struct task_desc *task, u64 timestamp,
 		      u64 task_state __used)
 {
 	struct sched_event *event = get_new_event(task, timestamp);
@@ -350,7 +372,7 @@ static void
 process_sched_event(struct task_desc *this_task __used, struct sched_event *event)
 {
 	int ret = 0;
-	nsec_t now;
+	u64 now;
 	long long delta;
 
 	now = get_nsecs();
@@ -375,10 +397,10 @@ process_sched_event(struct task_desc *this_task __used, struct sched_event *even
 	}
 }
 
-static nsec_t get_cpu_usage_nsec_parent(void)
+static u64 get_cpu_usage_nsec_parent(void)
 {
 	struct rusage ru;
-	nsec_t sum;
+	u64 sum;
 	int err;
 
 	err = getrusage(RUSAGE_SELF, &ru);
@@ -390,12 +412,12 @@ static nsec_t get_cpu_usage_nsec_parent(void)
 	return sum;
 }
 
-static nsec_t get_cpu_usage_nsec_self(void)
+static u64 get_cpu_usage_nsec_self(void)
 {
 	char filename [] = "/proc/1234567890/sched";
 	unsigned long msecs, nsecs;
 	char *line = NULL;
-	nsec_t total = 0;
+	u64 total = 0;
 	size_t len = 0;
 	ssize_t chars;
 	FILE *file;
@@ -423,7 +445,7 @@ static nsec_t get_cpu_usage_nsec_self(void)
 static void *thread_func(void *ctx)
 {
 	struct task_desc *this_task = ctx;
-	nsec_t cpu_usage_0, cpu_usage_1;
+	u64 cpu_usage_0, cpu_usage_1;
 	unsigned long i, ret;
 	char comm2[22];
 
@@ -485,14 +507,9 @@ static void create_tasks(void)
 	}
 }
 
-static nsec_t			cpu_usage;
-static nsec_t			runavg_cpu_usage;
-static nsec_t			parent_cpu_usage;
-static nsec_t			runavg_parent_cpu_usage;
-
 static void wait_for_tasks(void)
 {
-	nsec_t cpu_usage_0, cpu_usage_1;
+	u64 cpu_usage_0, cpu_usage_1;
 	struct task_desc *task;
 	unsigned long i, ret;
 
@@ -543,16 +560,9 @@ static void wait_for_tasks(void)
 	}
 }
 
-static int read_events(void);
-
-static unsigned long nr_runs;
-static nsec_t sum_runtime;
-static nsec_t sum_fluct;
-static nsec_t run_avg;
-
 static void run_one_test(void)
 {
-	nsec_t T0, T1, delta, avg_delta, fluct, std_dev;
+	u64 T0, T1, delta, avg_delta, fluct, std_dev;
 
 	T0 = get_nsecs();
 	wait_for_tasks();
@@ -576,10 +586,6 @@ static void run_one_test(void)
 	printf("#%-3ld: %0.3f, ",
 		nr_runs, (double)delta/1000000.0);
 
-#if 0
-	printf("%0.2f +- %0.2f, ",
-		(double)avg_delta/1e6, (double)std_dev/1e6);
-#endif
 	printf("ravg: %0.2f, ",
 		(double)run_avg/1e6);
 
@@ -605,7 +611,7 @@ static void run_one_test(void)
 
 static void test_calibrations(void)
 {
-	nsec_t T0, T1;
+	u64 T0, T1;
 
 	T0 = get_nsecs();
 	burn_nsecs(1e6);
@@ -620,8 +626,6 @@ static void test_calibrations(void)
 	printf("the sleep test took %Ld nsecs\n", T1-T0);
 }
 
-static unsigned long replay_repeat = 10;
-
 static void __cmd_replay(void)
 {
 	unsigned long i;
@@ -865,47 +869,8 @@ static struct trace_sched_handler replay_ops  = {
 	.fork_event		= replay_fork_event,
 };
 
-#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
-
-enum thread_state {
-	THREAD_SLEEPING = 0,
-	THREAD_WAIT_CPU,
-	THREAD_SCHED_IN,
-	THREAD_IGNORE
-};
-
-struct work_atom {
-	struct list_head	list;
-	enum thread_state	state;
-	u64			wake_up_time;
-	u64			sched_in_time;
-	u64			runtime;
-};
-
-struct task_atoms {
-	struct list_head	snapshot_list;
-	struct thread		*thread;
-	struct rb_node		node;
-	u64			max_lat;
-	u64			total_lat;
-	u64			nb_atoms;
-	u64			total_runtime;
-};
-
-typedef int (*sort_thread_lat)(struct task_atoms *, struct task_atoms *);
-
-struct sort_dimension {
-	const char 		*name;
-	sort_thread_lat		cmp;
-	struct list_head 	list;
-};
-
-static LIST_HEAD(cmp_pid);
-
-static struct rb_root lat_snapshot_root, sorted_lat_snapshot_root;
-
 static struct task_atoms *
-thread_atom_list_search(struct rb_root *root, struct thread *thread)
+thread_atoms_search(struct rb_root *root, struct thread *thread)
 {
 	struct rb_node *node = root->rb_node;
 
@@ -924,6 +889,14 @@ thread_atom_list_search(struct rb_root *root, struct thread *thread)
 	return NULL;
 }
 
+struct sort_dimension {
+	const char		*name;
+	sort_thread_lat		cmp;
+	struct list_head	list;
+};
+
+static LIST_HEAD(cmp_pid);
+
 static int
 thread_lat_cmp(struct list_head *list, struct task_atoms *l,
 	       struct task_atoms *r)
@@ -965,16 +938,17 @@ __thread_latency_insert(struct rb_root *root, struct task_atoms *data,
 	rb_insert_color(&data->node, root);
 }
 
-static void thread_atom_list_insert(struct thread *thread)
+static void thread_atoms_insert(struct thread *thread)
 {
 	struct task_atoms *atoms;
+
 	atoms = calloc(sizeof(*atoms), 1);
 	if (!atoms)
 		die("No memory");
 
 	atoms->thread = thread;
-	INIT_LIST_HEAD(&atoms->snapshot_list);
-	__thread_latency_insert(&lat_snapshot_root, atoms, &cmp_pid);
+	INIT_LIST_HEAD(&atoms->atom_list);
+	__thread_latency_insert(&atom_root, atoms, &cmp_pid);
 }
 
 static void
@@ -1001,50 +975,49 @@ lat_sched_out(struct task_atoms *atoms,
 	      u64 delta,
 	      u64 timestamp)
 {
-	struct work_atom *snapshot;
+	struct work_atom *atom;
 
-	snapshot = calloc(sizeof(*snapshot), 1);
-	if (!snapshot)
+	atom = calloc(sizeof(*atom), 1);
+	if (!atom)
 		die("Non memory");
 
 	if (sched_out_state(switch_event) == 'R') {
-		snapshot->state = THREAD_WAIT_CPU;
-		snapshot->wake_up_time = timestamp;
+		atom->state = THREAD_WAIT_CPU;
+		atom->wake_up_time = timestamp;
 	}
 
-	snapshot->runtime = delta;
-	list_add_tail(&snapshot->list, &atoms->snapshot_list);
+	atom->runtime = delta;
+	list_add_tail(&atom->list, &atoms->atom_list);
 }
 
 static void
 lat_sched_in(struct task_atoms *atoms, u64 timestamp)
 {
-	struct work_atom *snapshot;
+	struct work_atom *atom;
 	u64 delta;
 
-	if (list_empty(&atoms->snapshot_list))
+	if (list_empty(&atoms->atom_list))
 		return;
 
-	snapshot = list_entry(atoms->snapshot_list.prev, struct work_atom,
-			      list);
+	atom = list_entry(atoms->atom_list.prev, struct work_atom, list);
 
-	if (snapshot->state != THREAD_WAIT_CPU)
+	if (atom->state != THREAD_WAIT_CPU)
 		return;
 
-	if (timestamp < snapshot->wake_up_time) {
-		snapshot->state = THREAD_IGNORE;
+	if (timestamp < atom->wake_up_time) {
+		atom->state = THREAD_IGNORE;
 		return;
 	}
 
-	snapshot->state = THREAD_SCHED_IN;
-	snapshot->sched_in_time = timestamp;
+	atom->state = THREAD_SCHED_IN;
+	atom->sched_in_time = timestamp;
 
-	delta = snapshot->sched_in_time - snapshot->wake_up_time;
+	delta = atom->sched_in_time - atom->wake_up_time;
 	atoms->total_lat += delta;
 	if (delta > atoms->max_lat)
 		atoms->max_lat = delta;
 	atoms->nb_atoms++;
-	atoms->total_runtime += snapshot->runtime;
+	atoms->total_runtime += atom->runtime;
 }
 
 static void
@@ -1076,20 +1049,20 @@ latency_switch_event(struct trace_switch_event *switch_event,
 	sched_out = threads__findnew(switch_event->prev_pid, &threads, &last_match);
 	sched_in = threads__findnew(switch_event->next_pid, &threads, &last_match);
 
-	in_atoms = thread_atom_list_search(&lat_snapshot_root, sched_in);
+	in_atoms = thread_atoms_search(&atom_root, sched_in);
 	if (!in_atoms) {
-		thread_atom_list_insert(sched_in);
-		in_atoms = thread_atom_list_search(&lat_snapshot_root, sched_in);
+		thread_atoms_insert(sched_in);
+		in_atoms = thread_atoms_search(&atom_root, sched_in);
 		if (!in_atoms)
-			die("Internal latency tree error");
+			die("in-atom: Internal tree error");
 	}
 
-	out_atoms = thread_atom_list_search(&lat_snapshot_root, sched_out);
+	out_atoms = thread_atoms_search(&atom_root, sched_out);
 	if (!out_atoms) {
-		thread_atom_list_insert(sched_out);
-		out_atoms = thread_atom_list_search(&lat_snapshot_root, sched_out);
+		thread_atoms_insert(sched_out);
+		out_atoms = thread_atoms_search(&atom_root, sched_out);
 		if (!out_atoms)
-			die("Internal latency tree error");
+			die("out-atom: Internal tree error");
 	}
 
 	lat_sched_in(in_atoms, timestamp);
@@ -1104,7 +1077,7 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 		     struct thread *thread __used)
 {
 	struct task_atoms *atoms;
-	struct work_atom *snapshot;
+	struct work_atom *atom;
 	struct thread *wakee;
 
 	/* Note for later, it may be interesting to observe the failing cases */
@@ -1112,23 +1085,22 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 		return;
 
 	wakee = threads__findnew(wakeup_event->pid, &threads, &last_match);
-	atoms = thread_atom_list_search(&lat_snapshot_root, wakee);
+	atoms = thread_atoms_search(&atom_root, wakee);
 	if (!atoms) {
-		thread_atom_list_insert(wakee);
+		thread_atoms_insert(wakee);
 		return;
 	}
 
-	if (list_empty(&atoms->snapshot_list))
+	if (list_empty(&atoms->atom_list))
 		return;
 
-	snapshot = list_entry(atoms->snapshot_list.prev, struct work_atom,
-			      list);
+	atom = list_entry(atoms->atom_list.prev, struct work_atom, list);
 
-	if (snapshot->state != THREAD_SLEEPING)
+	if (atom->state != THREAD_SLEEPING)
 		return;
 
-	snapshot->state = THREAD_WAIT_CPU;
-	snapshot->wake_up_time = timestamp;
+	atom->state = THREAD_WAIT_CPU;
+	atom->wake_up_time = timestamp;
 }
 
 static struct trace_sched_handler lat_ops  = {
@@ -1137,9 +1109,6 @@ static struct trace_sched_handler lat_ops  = {
 	.fork_event		= latency_fork_event,
 };
 
-static u64 all_runtime;
-static u64 all_count;
-
 static void output_lat_thread(struct task_atoms *atom_list)
 {
 	int i;
@@ -1287,13 +1256,13 @@ static void sort_lat(void)
 
 	for (;;) {
 		struct task_atoms *data;
-		node = rb_first(&lat_snapshot_root);
+		node = rb_first(&atom_root);
 		if (!node)
 			break;
 
-		rb_erase(node, &lat_snapshot_root);
+		rb_erase(node, &atom_root);
 		data = rb_entry(node, struct task_atoms, node);
-		__thread_latency_insert(&sorted_lat_snapshot_root, data, &sort_list);
+		__thread_latency_insert(&sorted_atom_root, data, &sort_list);
 	}
 }
 
@@ -1309,7 +1278,7 @@ static void __cmd_lat(void)
 	printf(" Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |\n");
 	printf("-----------------------------------------------------------------------------------\n");
 
-	next = rb_first(&sorted_lat_snapshot_root);
+	next = rb_first(&sorted_atom_root);
 
 	while (next) {
 		struct task_atoms *atom_list;

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

* [tip:perfcounters/core] perf sched: Clean up PID sorting logic
       [not found]             ` <new-submission>
                                 ` (351 preceding siblings ...)
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Finish latency => atom rename and misc cleanups tip-bot for Ingo Molnar
@ 2009-09-15  9:34               ` tip-bot for Ingo Molnar
  2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter: Allow mmap if paranoid checks are turned off tip-bot for Ingo Molnar
                                 ` (353 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  b5fae128e41021889777f8ead810cbd2a8b249fc
Gitweb:     http://git.kernel.org/tip/b5fae128e41021889777f8ead810cbd2a8b249fc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 11 Sep 2009 12:12:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 10:22:50 +0200

perf sched: Clean up PID sorting logic

Use a sort list for thread atoms insertion as well - instead of
hardcoded for PID.

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/builtin-sched.c |   88 +++++++++++++++++++++++--------------------
 tools/perf/util/thread.h   |    8 ++--
 2 files changed, 51 insertions(+), 45 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index cc2dbd5..b72544f 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -144,7 +144,7 @@ struct task_atoms {
 	u64			total_runtime;
 };
 
-typedef int (*sort_thread_lat)(struct task_atoms *, struct task_atoms *);
+typedef int (*sort_fn_t)(struct task_atoms *, struct task_atoms *);
 
 static struct rb_root		atom_root, sorted_atom_root;
 
@@ -869,41 +869,22 @@ static struct trace_sched_handler replay_ops  = {
 	.fork_event		= replay_fork_event,
 };
 
-static struct task_atoms *
-thread_atoms_search(struct rb_root *root, struct thread *thread)
-{
-	struct rb_node *node = root->rb_node;
-
-	while (node) {
-		struct task_atoms *atoms;
-
-		atoms = container_of(node, struct task_atoms, node);
-		if (thread->pid > atoms->thread->pid)
-			node = node->rb_left;
-		else if (thread->pid < atoms->thread->pid)
-			node = node->rb_right;
-		else {
-			return atoms;
-		}
-	}
-	return NULL;
-}
-
 struct sort_dimension {
 	const char		*name;
-	sort_thread_lat		cmp;
+	sort_fn_t		cmp;
 	struct list_head	list;
 };
 
 static LIST_HEAD(cmp_pid);
 
 static int
-thread_lat_cmp(struct list_head *list, struct task_atoms *l,
-	       struct task_atoms *r)
+thread_lat_cmp(struct list_head *list, struct task_atoms *l, struct task_atoms *r)
 {
 	struct sort_dimension *sort;
 	int ret = 0;
 
+	BUG_ON(list_empty(list));
+
 	list_for_each_entry(sort, list, list) {
 		ret = sort->cmp(l, r);
 		if (ret)
@@ -913,6 +894,32 @@ thread_lat_cmp(struct list_head *list, struct task_atoms *l,
 	return ret;
 }
 
+static struct task_atoms *
+thread_atoms_search(struct rb_root *root, struct thread *thread,
+			 struct list_head *sort_list)
+{
+	struct rb_node *node = root->rb_node;
+	struct task_atoms key = { .thread = thread };
+
+	while (node) {
+		struct task_atoms *atoms;
+		int cmp;
+
+		atoms = container_of(node, struct task_atoms, node);
+
+		cmp = thread_lat_cmp(sort_list, &key, atoms);
+		if (cmp > 0)
+			node = node->rb_left;
+		else if (cmp < 0)
+			node = node->rb_right;
+		else {
+			BUG_ON(thread != atoms->thread);
+			return atoms;
+		}
+	}
+	return NULL;
+}
+
 static void
 __thread_latency_insert(struct rb_root *root, struct task_atoms *data,
 			 struct list_head *sort_list)
@@ -1049,18 +1056,18 @@ latency_switch_event(struct trace_switch_event *switch_event,
 	sched_out = threads__findnew(switch_event->prev_pid, &threads, &last_match);
 	sched_in = threads__findnew(switch_event->next_pid, &threads, &last_match);
 
-	in_atoms = thread_atoms_search(&atom_root, sched_in);
+	in_atoms = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
 	if (!in_atoms) {
 		thread_atoms_insert(sched_in);
-		in_atoms = thread_atoms_search(&atom_root, sched_in);
+		in_atoms = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
 		if (!in_atoms)
 			die("in-atom: Internal tree error");
 	}
 
-	out_atoms = thread_atoms_search(&atom_root, sched_out);
+	out_atoms = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
 	if (!out_atoms) {
 		thread_atoms_insert(sched_out);
-		out_atoms = thread_atoms_search(&atom_root, sched_out);
+		out_atoms = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
 		if (!out_atoms)
 			die("out-atom: Internal tree error");
 	}
@@ -1085,7 +1092,7 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 		return;
 
 	wakee = threads__findnew(wakeup_event->pid, &threads, &last_match);
-	atoms = thread_atoms_search(&atom_root, wakee);
+	atoms = thread_atoms_search(&atom_root, wakee, &cmp_pid);
 	if (!atoms) {
 		thread_atoms_insert(wakee);
 		return;
@@ -1136,7 +1143,6 @@ static void output_lat_thread(struct task_atoms *atom_list)
 
 static int pid_cmp(struct task_atoms *l, struct task_atoms *r)
 {
-
 	if (l->thread->pid < r->thread->pid)
 		return -1;
 	if (l->thread->pid > r->thread->pid)
@@ -1146,8 +1152,8 @@ static int pid_cmp(struct task_atoms *l, struct task_atoms *r)
 }
 
 static struct sort_dimension pid_sort_dimension = {
-	.name = "pid",
-	.cmp = pid_cmp,
+	.name			= "pid",
+	.cmp			= pid_cmp,
 };
 
 static int avg_cmp(struct task_atoms *l, struct task_atoms *r)
@@ -1172,8 +1178,8 @@ static int avg_cmp(struct task_atoms *l, struct task_atoms *r)
 }
 
 static struct sort_dimension avg_sort_dimension = {
-	.name 	= "avg",
-	.cmp	= avg_cmp,
+	.name			= "avg",
+	.cmp			= avg_cmp,
 };
 
 static int max_cmp(struct task_atoms *l, struct task_atoms *r)
@@ -1187,8 +1193,8 @@ static int max_cmp(struct task_atoms *l, struct task_atoms *r)
 }
 
 static struct sort_dimension max_sort_dimension = {
-	.name 	= "max",
-	.cmp	= max_cmp,
+	.name			= "max",
+	.cmp			= max_cmp,
 };
 
 static int switch_cmp(struct task_atoms *l, struct task_atoms *r)
@@ -1202,8 +1208,8 @@ static int switch_cmp(struct task_atoms *l, struct task_atoms *r)
 }
 
 static struct sort_dimension switch_sort_dimension = {
-	.name 	= "switch",
-	.cmp	= switch_cmp,
+	.name			= "switch",
+	.cmp			= switch_cmp,
 };
 
 static int runtime_cmp(struct task_atoms *l, struct task_atoms *r)
@@ -1217,8 +1223,8 @@ static int runtime_cmp(struct task_atoms *l, struct task_atoms *r)
 }
 
 static struct sort_dimension runtime_sort_dimension = {
-	.name 	= "runtime",
-	.cmp	= runtime_cmp,
+	.name			= "runtime",
+	.cmp			= runtime_cmp,
 };
 
 static struct sort_dimension *available_sorts[] = {
@@ -1666,8 +1672,8 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 			argc = parse_options(argc, argv, latency_options, latency_usage, 0);
 			if (argc)
 				usage_with_options(latency_usage, latency_options);
-			setup_sorting();
 		}
+		setup_sorting();
 		__cmd_lat();
 	} else if (!strncmp(argv[0], "rep", 3)) {
 		trace_handler = &replay_ops;
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 634f280..665d1f3 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -4,10 +4,10 @@
 #include "symbol.h"
 
 struct thread {
-	struct rb_node	 rb_node;
-	struct list_head maps;
-	pid_t		 pid;
-	char		 *comm;
+	struct rb_node		rb_node;
+	struct list_head	maps;
+	pid_t			pid;
+	char			*comm;
 };
 
 int thread__set_comm(struct thread *self, const char *comm);

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

* [tip:perfcounters/core] perf_counter: Allow mmap if paranoid checks are turned off
       [not found]             ` <new-submission>
                                 ` (352 preceding siblings ...)
  2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Clean up PID sorting logic tip-bot for Ingo Molnar
@ 2009-09-15  9:35               ` tip-bot for Ingo Molnar
  2009-09-15  9:35               ` [tip:perfcounters/core] perf sched: Add 'perf sched trace', improve documentation tip-bot for Ingo Molnar
                                 ` (352 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  459ec28ab404d7afcd512ce9b855959ad301605a
Gitweb:     http://git.kernel.org/tip/459ec28ab404d7afcd512ce9b855959ad301605a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 13 Sep 2009 17:33:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 17:33:44 +0200

perf_counter: Allow mmap if paranoid checks are turned off

Before:

  $ perf sched record -f sleep 1
  Error: failed to mmap with 1 (Operation not permitted)

After:

  $ perf sched record -f sleep 1
  [ perf record: Captured and wrote 0.095 MB perf.data (~4161 samples) ]

Note, this is only allowed if perfcounter_paranoid is set to
the most permissive (non-default) value of -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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index e0d91fd..667ab25 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2315,7 +2315,8 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	lock_limit >>= PAGE_SHIFT;
 	locked = vma->vm_mm->locked_vm + extra;
 
-	if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
+	if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
+		!capable(CAP_IPC_LOCK)) {
 		ret = -EPERM;
 		goto unlock;
 	}

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

* [tip:perfcounters/core] perf sched: Add 'perf sched trace', improve documentation
       [not found]             ` <new-submission>
                                 ` (353 preceding siblings ...)
  2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter: Allow mmap if paranoid checks are turned off tip-bot for Ingo Molnar
@ 2009-09-15  9:35               ` tip-bot for Ingo Molnar
  2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter, sched: Add sched_stat_runtime tracepoint tip-bot for Ingo Molnar
                                 ` (351 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  c13f0d3c8165e9592102687fa999da0a0d9c3724
Gitweb:     http://git.kernel.org/tip/c13f0d3c8165e9592102687fa999da0a0d9c3724
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 13 Sep 2009 16:51:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 17:55:23 +0200

perf sched: Add 'perf sched trace', improve documentation

Alias 'perf sched trace' to 'perf trace', for workflow completeness.

Add a bit of documentation for perf sched.

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/Documentation/perf-sched.txt |   22 +++++++++++++++++++---
 tools/perf/builtin-sched.c              |    7 ++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 056320e..1ce7919 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -3,16 +3,32 @@ perf-sched(1)
 
 NAME
 ----
-perf-sched - Read perf.data (created by perf record) and display sched output
+perf-sched - Tool to trace/measure scheduler properties (latencies)
 
 SYNOPSIS
 --------
 [verse]
-'perf sched' [-i <file> | --input=file] symbol_name
+'perf sched' {record|latency|replay|trace}
 
 DESCRIPTION
 -----------
-This command reads the input file and displays the latencies recorded.
+There's four variants of perf sched:
+
+  'perf sched record <command>' to record the scheduling events
+  of an arbitrary workload.
+
+  'perf sched latency' to report the per task scheduling latencies
+  and other scheduling properties of the workload.
+
+  'perf sched trace' to see a detailed trace of the workload that
+  was recorded.
+
+  'perf sched replay' to simulate the workload that was recorded
+  via perf sched record. (this is done by starting up mockup threads
+  that mimic the workload based on the events in the trace. These
+  threads can then replay the timings (CPU runtime and sleep patterns)
+  of the workload as it occured when it was recorded - and can repeat
+  it a number of times, measuring its performance.)
 
 OPTIONS
 -------
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ede40c1..8db0fd2 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1597,7 +1597,7 @@ more:
 }
 
 static const char * const sched_usage[] = {
-	"perf sched [<options>] {record|latency|replay}",
+	"perf sched [<options>] {record|latency|replay|trace}",
 	NULL
 };
 
@@ -1719,6 +1719,11 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 				usage_with_options(replay_usage, replay_options);
 		}
 		__cmd_replay();
+	} else if (!strcmp(argv[0], "trace")) {
+		/*
+		 * Aliased to 'perf trace' for now:
+		 */
+		return cmd_trace(argc, argv, prefix);
 	} else {
 		usage_with_options(sched_usage, sched_options);
 	}

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

* [tip:perfcounters/core] perf_counter, sched: Add sched_stat_runtime tracepoint
       [not found]             ` <new-submission>
                                 ` (354 preceding siblings ...)
  2009-09-15  9:35               ` [tip:perfcounters/core] perf sched: Add 'perf sched trace', improve documentation tip-bot for Ingo Molnar
@ 2009-09-15  9:35               ` tip-bot for Ingo Molnar
  2009-09-15  9:36               ` [tip:perfcounters/core] perf tools: Implement counter output multiplexing tip-bot for Ingo Molnar
                                 ` (350 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  f977bb4937857994312fff4f9c2cad336a36a932
Gitweb:     http://git.kernel.org/tip/f977bb4937857994312fff4f9c2cad336a36a932
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 13 Sep 2009 18:15:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 13 Sep 2009 18:17:28 +0200

perf_counter, sched: Add sched_stat_runtime tracepoint

This allows more precise tracking of how the scheduler accounts
(and acts upon) a task having spent N nanoseconds of CPU time.

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>


---
 include/trace/events/sched.h |   33 +++++++++++++++++++++++++++++++++
 kernel/sched_fair.c          |    1 +
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b48f1ad..4069c43 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -380,6 +380,39 @@ TRACE_EVENT(sched_stat_wait,
 );
 
 /*
+ * Tracepoint for accounting runtime (time the task is executing
+ * on a CPU).
+ */
+TRACE_EVENT(sched_stat_runtime,
+
+	TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
+
+	TP_ARGS(tsk, runtime, vruntime),
+
+	TP_STRUCT__entry(
+		__array( char,	comm,	TASK_COMM_LEN	)
+		__field( pid_t,	pid			)
+		__field( u64,	runtime			)
+		__field( u64,	vruntime			)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid		= tsk->pid;
+		__entry->runtime	= runtime;
+		__entry->vruntime	= vruntime;
+	)
+	TP_perf_assign(
+		__perf_count(runtime);
+	),
+
+	TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]",
+			__entry->comm, __entry->pid,
+			(unsigned long long)__entry->runtime,
+			(unsigned long long)__entry->vruntime)
+);
+
+/*
  * Tracepoint for accounting sleep time (time the task is not runnable,
  * including iowait, see below).
  */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index aa7f841..a097e90 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -513,6 +513,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
 	if (entity_is_task(curr)) {
 		struct task_struct *curtask = task_of(curr);
 
+		trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
 		cpuacct_charge(curtask, delta_exec);
 		account_group_exec_runtime(curtask, delta_exec);
 	}

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

* [tip:perfcounters/core] perf tools: Implement counter output multiplexing
       [not found]             ` <new-submission>
                                 ` (355 preceding siblings ...)
  2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter, sched: Add sched_stat_runtime tracepoint tip-bot for Ingo Molnar
@ 2009-09-15  9:36               ` tip-bot for Ingo Molnar
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Fix 'perf sched latency' output on 32-bit systems tip-bot for Ingo Molnar
                                 ` (349 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  ea57c4f5203d82c7844c54cdef54e972cf4e9d1f
Gitweb:     http://git.kernel.org/tip/ea57c4f5203d82c7844c54cdef54e972cf4e9d1f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 13 Sep 2009 18:15:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Sep 2009 15:45:11 +0200

perf tools: Implement counter output multiplexing

Finish the -M/--multiplex option implementation:

 - separate it out from group_fd

 - correctly set it via the ioctl and dont mmap counters that
   are multiplexed

 - modify the perf record event loop to deal with buffer-less
   counters.

 - remove the -g option from perf sched record

 - account for unordered events in perf sched latency

 - (add -f to perf sched record to ease measurements)

 - skip idle threads (pid==0) in latency output

The result is better latency output by 'perf sched latency':

 -----------------------------------------------------------------------------------
  Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
 -----------------------------------------------------------------------------------
  ksoftirqd/8       |    0.071 ms |        2 | avg:    0.458 ms | max:    0.913 ms |
  at-spi-registry   |    0.609 ms |       19 | avg:    0.013 ms | max:    0.023 ms |
  perf              |    3.316 ms |       16 | avg:    0.013 ms | max:    0.054 ms |
  Xorg              |    0.392 ms |       19 | avg:    0.011 ms | max:    0.018 ms |
  sleep             |    0.537 ms |        2 | avg:    0.009 ms | max:    0.009 ms |
 -----------------------------------------------------------------------------------
  TOTAL:            |    4.925 ms |       58 |
 ---------------------------------------------

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/builtin-record.c         |   43 +++++++++++++++++++++-------------
 tools/perf/builtin-sched.c          |   25 ++++++++++++++++++--
 tools/perf/util/trace-event-parse.c |    6 +++-
 3 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 79f99db..5f3127e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -49,6 +49,7 @@ static int			inherit_stat			= 0;
 static int			no_samples			= 0;
 static int			sample_address			= 0;
 static int			multiplex			= 0;
+static int			multiplex_fd			= -1;
 
 static long			samples;
 static struct timeval		last_read;
@@ -471,23 +472,29 @@ try_again:
 	 */
 	if (group && group_fd == -1)
 		group_fd = fd[nr_cpu][counter];
+	if (multiplex && multiplex_fd == -1)
+		multiplex_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|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);
-	}
+	if (multiplex && fd[nr_cpu][counter] != multiplex_fd) {
+		int ret;
 
-	if (multiplex && fd[nr_cpu][counter] != group_fd)
-		ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_SET_OUTPUT, group_fd);
+		ret = ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_SET_OUTPUT, multiplex_fd);
+		assert(ret != -1);
+	} else {
+		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|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);
+		}
+	}
 
 	ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_ENABLE);
 }
@@ -618,8 +625,10 @@ static int __cmd_record(int argc, const char **argv)
 		int hits = samples;
 
 		for (i = 0; i < nr_cpu; i++) {
-			for (counter = 0; counter < nr_counters; counter++)
-				mmap_read(&mmap_array[i][counter]);
+			for (counter = 0; counter < nr_counters; counter++) {
+				if (mmap_array[i][counter].base)
+					mmap_read(&mmap_array[i][counter]);
+			}
 		}
 
 		if (hits == samples) {
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 3e00323..2ce87ef 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -116,6 +116,8 @@ static u64			sum_fluct;
 static u64			run_avg;
 
 static unsigned long		replay_repeat = 10;
+static unsigned long		nr_timestamps;
+static unsigned long		unordered_timestamps;
 
 #define TASK_STATE_TO_CHAR_STR "RSDTtZX"
 
@@ -1109,8 +1111,11 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 	if (atom->state != THREAD_SLEEPING)
 		return;
 
-	if (atom->sched_out_time > timestamp)
+	nr_timestamps++;
+	if (atom->sched_out_time > timestamp) {
+		unordered_timestamps++;
 		return;
+	}
 
 	atom->state = THREAD_WAIT_CPU;
 	atom->wake_up_time = timestamp;
@@ -1130,6 +1135,11 @@ static void output_lat_thread(struct task_atoms *atom_list)
 
 	if (!atom_list->nb_atoms)
 		return;
+	/*
+	 * Ignore idle threads:
+	 */
+	if (!atom_list->thread->pid)
+		return;
 
 	all_runtime += atom_list->total_runtime;
 	all_count += atom_list->nb_atoms;
@@ -1301,8 +1311,16 @@ static void __cmd_lat(void)
 	}
 
 	printf("-----------------------------------------------------------------------------------\n");
-	printf(" TOTAL:            |%9.3f ms |%9Ld |\n",
+	printf(" TOTAL:            |%9.3f ms |%9Ld |",
 		(double)all_runtime/1e6, all_count);
+
+	if (unordered_timestamps && nr_timestamps) {
+		printf(" INFO: %.2f%% unordered events.\n",
+			(double)unordered_timestamps/(double)nr_timestamps*100.0);
+	} else {
+		printf("\n");
+	}
+
 	printf("---------------------------------------------\n");
 }
 
@@ -1667,12 +1685,13 @@ static const char *record_args[] = {
 	"-a",
 	"-R",
 	"-M",
-	"-g",
+	"-f",
 	"-c", "1",
 	"-e", "sched:sched_switch:r",
 	"-e", "sched:sched_stat_wait:r",
 	"-e", "sched:sched_stat_sleep:r",
 	"-e", "sched:sched_stat_iowait:r",
+	"-e", "sched:sched_stat_runtime:r",
 	"-e", "sched:sched_process_exit:r",
 	"-e", "sched:sched_process_fork:r",
 	"-e", "sched:sched_wakeup:r",
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 64d6e30..f6a8437 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -2722,8 +2722,10 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs,
 	type = trace_parse_common_type(data);
 
 	event = trace_find_event(type);
-	if (!event)
-		die("ug! no event found for type %d", type);
+	if (!event) {
+		printf("ug! no event found for type %d\n", type);
+		return;
+	}
 
 	pid = parse_common_pid(data);
 

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

* [tip:perfcounters/core] perf sched: Fix 'perf sched latency' output on 32-bit systems
       [not found]             ` <new-submission>
                                 ` (356 preceding siblings ...)
  2009-09-15  9:36               ` [tip:perfcounters/core] perf tools: Implement counter output multiplexing tip-bot for Ingo Molnar
@ 2009-09-15  9:36               ` tip-bot for Ingo Molnar
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Print PIDs too tip-bot for mingo
                                 ` (348 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-15  9:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  d11533893b31ab7806ff04bfa69ae646068610ce
Gitweb:     http://git.kernel.org/tip/d11533893b31ab7806ff04bfa69ae646068610ce
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 14 Sep 2009 18:22:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Sep 2009 18:22:53 +0200

perf sched: Fix 'perf sched latency' output on 32-bit systems

Before:

  -----------------------------------------------------------------------------------
   Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
  -----------------------------------------------------------------------------------
   perf              |4853313.251 ms |       10 | avg:    0.046 ms | max:    0.337 ms |
   flush-8:0         |2426659.202 ms |        5 | avg:    0.015 ms | max:    0.016 ms |
   sleep             |485331.966 ms |        1 | avg:    0.012 ms | max:    0.012 ms |
   ksoftirqd/1       |485331.320 ms |        1 | avg:    0.005 ms | max:    0.005 ms |
  -----------------------------------------------------------------------------------
   TOTAL:            |8250635.739 ms |       17 |
  ---------------------------------------------

After:

  -----------------------------------------------------------------------------------
   Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
  -----------------------------------------------------------------------------------
   perf              |    0.206 ms |       10 | avg:    0.046 ms | max:    0.337 ms |
   flush-8:0         |    2.680 ms |        5 | avg:    0.015 ms | max:    0.016 ms |
   sleep             |    0.662 ms |        1 | avg:    0.012 ms | max:    0.012 ms |
   ksoftirqd/1       |    0.015 ms |        1 | avg:    0.005 ms | max:    0.005 ms |
  -----------------------------------------------------------------------------------
   TOTAL:            |    3.563 ms |       17 |
  ---------------------------------------------

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/builtin-sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 2ce87ef..f856a02 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -805,7 +805,7 @@ replay_wakeup_event(struct trace_wakeup_event *wakeup_event,
 	add_sched_event_wakeup(waker, timestamp, wakee);
 }
 
-static unsigned long cpu_last_switched[MAX_CPUS];
+static u64 cpu_last_switched[MAX_CPUS];
 
 static void
 replay_switch_event(struct trace_switch_event *switch_event,

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

* [tip:perfcounters/core] perf sched: Print PIDs too
       [not found]             ` <new-submission>
                                 ` (357 preceding siblings ...)
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Fix 'perf sched latency' output on 32-bit systems tip-bot for Ingo Molnar
@ 2009-09-15  9:36               ` tip-bot for mingo
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Add support for sched:sched_stat_runtime events tip-bot for mingo
                                 ` (347 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for mingo @ 2009-09-15  9:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  08f69e6c2e59b3d73343f8c9ecf758e0133dbc22
Gitweb:     http://git.kernel.org/tip/08f69e6c2e59b3d73343f8c9ecf758e0133dbc22
Author:     mingo <mingo@europe.(none)>
AuthorDate: Mon, 14 Sep 2009 18:30:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Sep 2009 18:34:57 +0200

perf sched: Print PIDs too

Often it's useful to know the PID of the task as well - print it
out too.

( While at it, reformat the output to be a bit more
  paste-into-commit-logs friendly. )

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/builtin-sched.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index f856a02..93ef7b2 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1144,9 +1144,9 @@ static void output_lat_thread(struct task_atoms *atom_list)
 	all_runtime += atom_list->total_runtime;
 	all_count += atom_list->nb_atoms;
 
-	ret = printf(" %s ", atom_list->thread->comm);
+	ret = printf("  %s-%d ", atom_list->thread->comm, atom_list->thread->pid);
 
-	for (i = 0; i < 19 - ret; i++)
+	for (i = 0; i < 24 - ret; i++)
 		printf(" ");
 
 	avg = atom_list->total_lat / atom_list->nb_atoms;
@@ -1296,9 +1296,9 @@ static void __cmd_lat(void)
 	read_events();
 	sort_lat();
 
-	printf("-----------------------------------------------------------------------------------\n");
-	printf(" Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |\n");
-	printf("-----------------------------------------------------------------------------------\n");
+	printf("\n ---------------------------------------------------------------------------------------\n");
+	printf("  Task                  |  Runtime ms | Switches | Average delay ms | Maximum delay ms |\n");
+	printf(" ---------------------------------------------------------------------------------------\n");
 
 	next = rb_first(&sorted_atom_root);
 
@@ -1310,8 +1310,8 @@ static void __cmd_lat(void)
 		next = rb_next(next);
 	}
 
-	printf("-----------------------------------------------------------------------------------\n");
-	printf(" TOTAL:            |%9.3f ms |%9Ld |",
+	printf(" ---------------------------------------------------------------------------------------\n");
+	printf("  TOTAL:                |%9.3f ms |%9Ld |",
 		(double)all_runtime/1e6, all_count);
 
 	if (unordered_timestamps && nr_timestamps) {
@@ -1321,7 +1321,7 @@ static void __cmd_lat(void)
 		printf("\n");
 	}
 
-	printf("---------------------------------------------\n");
+	printf(" -------------------------------------------------\n\n");
 }
 
 static struct trace_sched_handler *trace_handler;

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

* [tip:perfcounters/core] perf sched: Add support for sched:sched_stat_runtime events
       [not found]             ` <new-submission>
                                 ` (358 preceding siblings ...)
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Print PIDs too tip-bot for mingo
@ 2009-09-15  9:36               ` tip-bot for mingo
  2009-09-16 10:19               ` [tip:sched/core] sched: Fix double_rq_lock() compile warning tip-bot for Peter Zijlstra
                                 ` (346 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for mingo @ 2009-09-15  9:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  39aeb52f99f2380c1f16036deed2f7bb8b2e0559
Gitweb:     http://git.kernel.org/tip/39aeb52f99f2380c1f16036deed2f7bb8b2e0559
Author:     mingo <mingo@europe.(none)>
AuthorDate: Mon, 14 Sep 2009 20:04:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Sep 2009 20:08:23 +0200

perf sched: Add support for sched:sched_stat_runtime events

This allows more precise 'perf sched latency' output:

 ---------------------------------------------------------------------------------------
  Task                  |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
 ---------------------------------------------------------------------------------------
  ksoftirqd/0-4         |    0.010 ms |        2 | avg:    2.476 ms | max:    2.977 ms |
  perf-12328            |   15.844 ms |       66 | avg:    1.118 ms | max:    9.979 ms |
  bdi-default-235       |    0.009 ms |        1 | avg:    0.998 ms | max:    0.998 ms |
  events/1-8            |    0.020 ms |        2 | avg:    0.998 ms | max:    0.998 ms |
  events/0-7            |    0.018 ms |        2 | avg:    0.992 ms | max:    0.996 ms |
  sleep-12329           |    0.742 ms |        3 | avg:    0.906 ms | max:    2.289 ms |
  sshd-12122            |    0.163 ms |        2 | avg:    0.283 ms | max:    0.562 ms |
  loop-getpid-lon-12322 | 1023.636 ms |       69 | avg:    0.208 ms | max:    5.996 ms |
  loop-getpid-lon-12321 | 1038.638 ms |        5 | avg:    0.073 ms | max:    0.171 ms |
  migration/1-5         |    0.000 ms |        1 | avg:    0.006 ms | max:    0.006 ms |
 ---------------------------------------------------------------------------------------
  TOTAL:                | 2079.078 ms |      153 |
 -------------------------------------------------

Also, streamline the code a bit more, add asserts for various state
machine failures (they should be debugged if they occur) and fix
a few odd ends.

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/builtin-sched.c |  264 +++++++++++++++++++++++++++++---------------
 1 files changed, 173 insertions(+), 91 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 93ef7b2..adcb563 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -50,7 +50,7 @@ static u64			sleep_measurement_overhead;
 
 static unsigned long		nr_tasks;
 
-struct sched_event;
+struct sched_atom;
 
 struct task_desc {
 	unsigned long		nr;
@@ -59,7 +59,7 @@ struct task_desc {
 
 	unsigned long		nr_events;
 	unsigned long		curr_event;
-	struct sched_event	**events;
+	struct sched_atom	**atoms;
 
 	pthread_t		thread;
 	sem_t			sleep_sem;
@@ -76,7 +76,7 @@ enum sched_event_type {
 	SCHED_EVENT_WAKEUP,
 };
 
-struct sched_event {
+struct sched_atom {
 	enum sched_event_type	type;
 	u64			timestamp;
 	u64			duration;
@@ -137,8 +137,8 @@ struct work_atom {
 	u64			runtime;
 };
 
-struct task_atoms {
-	struct list_head	atom_list;
+struct work_atoms {
+	struct list_head	work_list;
 	struct thread		*thread;
 	struct rb_node		node;
 	u64			max_lat;
@@ -147,7 +147,7 @@ struct task_atoms {
 	u64			total_runtime;
 };
 
-typedef int (*sort_fn_t)(struct task_atoms *, struct task_atoms *);
+typedef int (*sort_fn_t)(struct work_atoms *, struct work_atoms *);
 
 static struct rb_root		atom_root, sorted_atom_root;
 
@@ -220,10 +220,10 @@ static void calibrate_sleep_measurement_overhead(void)
 	printf("sleep measurement overhead: %Ld nsecs\n", min_delta);
 }
 
-static struct sched_event *
+static struct sched_atom *
 get_new_event(struct task_desc *task, u64 timestamp)
 {
-	struct sched_event *event = calloc(1, sizeof(*event));
+	struct sched_atom *event = calloc(1, sizeof(*event));
 	unsigned long idx = task->nr_events;
 	size_t size;
 
@@ -231,27 +231,27 @@ get_new_event(struct task_desc *task, u64 timestamp)
 	event->nr = idx;
 
 	task->nr_events++;
-	size = sizeof(struct sched_event *) * task->nr_events;
-	task->events = realloc(task->events, size);
-	BUG_ON(!task->events);
+	size = sizeof(struct sched_atom *) * task->nr_events;
+	task->atoms = realloc(task->atoms, size);
+	BUG_ON(!task->atoms);
 
-	task->events[idx] = event;
+	task->atoms[idx] = event;
 
 	return event;
 }
 
-static struct sched_event *last_event(struct task_desc *task)
+static struct sched_atom *last_event(struct task_desc *task)
 {
 	if (!task->nr_events)
 		return NULL;
 
-	return task->events[task->nr_events - 1];
+	return task->atoms[task->nr_events - 1];
 }
 
 static void
 add_sched_event_run(struct task_desc *task, u64 timestamp, u64 duration)
 {
-	struct sched_event *event, *curr_event = last_event(task);
+	struct sched_atom *event, *curr_event = last_event(task);
 
 	/*
 	 * optimize an existing RUN event by merging this one
@@ -275,7 +275,7 @@ static void
 add_sched_event_wakeup(struct task_desc *task, u64 timestamp,
 		       struct task_desc *wakee)
 {
-	struct sched_event *event, *wakee_event;
+	struct sched_atom *event, *wakee_event;
 
 	event = get_new_event(task, timestamp);
 	event->type = SCHED_EVENT_WAKEUP;
@@ -303,7 +303,7 @@ static void
 add_sched_event_sleep(struct task_desc *task, u64 timestamp,
 		      u64 task_state __used)
 {
-	struct sched_event *event = get_new_event(task, timestamp);
+	struct sched_atom *event = get_new_event(task, timestamp);
 
 	event->type = SCHED_EVENT_SLEEP;
 
@@ -372,27 +372,27 @@ static void add_cross_task_wakeups(void)
 }
 
 static void
-process_sched_event(struct task_desc *this_task __used, struct sched_event *event)
+process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom)
 {
 	int ret = 0;
 	u64 now;
 	long long delta;
 
 	now = get_nsecs();
-	delta = start_time + event->timestamp - now;
+	delta = start_time + atom->timestamp - now;
 
-	switch (event->type) {
+	switch (atom->type) {
 		case SCHED_EVENT_RUN:
-			burn_nsecs(event->duration);
+			burn_nsecs(atom->duration);
 			break;
 		case SCHED_EVENT_SLEEP:
-			if (event->wait_sem)
-				ret = sem_wait(event->wait_sem);
+			if (atom->wait_sem)
+				ret = sem_wait(atom->wait_sem);
 			BUG_ON(ret);
 			break;
 		case SCHED_EVENT_WAKEUP:
-			if (event->wait_sem)
-				ret = sem_post(event->wait_sem);
+			if (atom->wait_sem)
+				ret = sem_post(atom->wait_sem);
 			BUG_ON(ret);
 			break;
 		default:
@@ -467,7 +467,7 @@ again:
 
 	for (i = 0; i < this_task->nr_events; i++) {
 		this_task->curr_event = i;
-		process_sched_event(this_task, this_task->events[i]);
+		process_sched_event(this_task, this_task->atoms[i]);
 	}
 
 	cpu_usage_1 = get_cpu_usage_nsec_self();
@@ -649,7 +649,7 @@ static void __cmd_replay(void)
 	if (multitarget_wakeups)
 		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
 	if (nr_run_events_optimized)
-		printf("run events optimized: %ld\n",
+		printf("run atoms optimized: %ld\n",
 			nr_run_events_optimized);
 
 	print_task_traces();
@@ -727,6 +727,20 @@ struct trace_switch_event {
 	u32 next_prio;
 };
 
+struct trace_runtime_event {
+	u32 size;
+
+	u16 common_type;
+	u8 common_flags;
+	u8 common_preempt_count;
+	u32 common_pid;
+	u32 common_tgid;
+
+	char comm[16];
+	u32 pid;
+	u64 runtime;
+	u64 vruntime;
+};
 
 struct trace_wakeup_event {
 	u32 size;
@@ -767,6 +781,12 @@ struct trace_sched_handler {
 			     u64 timestamp,
 			     struct thread *thread);
 
+	void (*runtime_event)(struct trace_runtime_event *,
+			      struct event *,
+			      int cpu,
+			      u64 timestamp,
+			      struct thread *thread);
+
 	void (*wakeup_event)(struct trace_wakeup_event *,
 			     struct event *,
 			     int cpu,
@@ -881,7 +901,7 @@ struct sort_dimension {
 static LIST_HEAD(cmp_pid);
 
 static int
-thread_lat_cmp(struct list_head *list, struct task_atoms *l, struct task_atoms *r)
+thread_lat_cmp(struct list_head *list, struct work_atoms *l, struct work_atoms *r)
 {
 	struct sort_dimension *sort;
 	int ret = 0;
@@ -897,18 +917,18 @@ thread_lat_cmp(struct list_head *list, struct task_atoms *l, struct task_atoms *
 	return ret;
 }
 
-static struct task_atoms *
+static struct work_atoms *
 thread_atoms_search(struct rb_root *root, struct thread *thread,
 			 struct list_head *sort_list)
 {
 	struct rb_node *node = root->rb_node;
-	struct task_atoms key = { .thread = thread };
+	struct work_atoms key = { .thread = thread };
 
 	while (node) {
-		struct task_atoms *atoms;
+		struct work_atoms *atoms;
 		int cmp;
 
-		atoms = container_of(node, struct task_atoms, node);
+		atoms = container_of(node, struct work_atoms, node);
 
 		cmp = thread_lat_cmp(sort_list, &key, atoms);
 		if (cmp > 0)
@@ -924,16 +944,16 @@ thread_atoms_search(struct rb_root *root, struct thread *thread,
 }
 
 static void
-__thread_latency_insert(struct rb_root *root, struct task_atoms *data,
+__thread_latency_insert(struct rb_root *root, struct work_atoms *data,
 			 struct list_head *sort_list)
 {
 	struct rb_node **new = &(root->rb_node), *parent = NULL;
 
 	while (*new) {
-		struct task_atoms *this;
+		struct work_atoms *this;
 		int cmp;
 
-		this = container_of(*new, struct task_atoms, node);
+		this = container_of(*new, struct work_atoms, node);
 		parent = *new;
 
 		cmp = thread_lat_cmp(sort_list, data, this);
@@ -950,14 +970,14 @@ __thread_latency_insert(struct rb_root *root, struct task_atoms *data,
 
 static void thread_atoms_insert(struct thread *thread)
 {
-	struct task_atoms *atoms;
+	struct work_atoms *atoms;
 
 	atoms = calloc(sizeof(*atoms), 1);
 	if (!atoms)
 		die("No memory");
 
 	atoms->thread = thread;
-	INIT_LIST_HEAD(&atoms->atom_list);
+	INIT_LIST_HEAD(&atoms->work_list);
 	__thread_latency_insert(&atom_root, atoms, &cmp_pid);
 }
 
@@ -980,10 +1000,9 @@ static char sched_out_state(struct trace_switch_event *switch_event)
 }
 
 static void
-lat_sched_out(struct task_atoms *atoms,
-	      struct trace_switch_event *switch_event __used,
-	      u64 delta,
-	      u64 timestamp)
+add_sched_out_event(struct work_atoms *atoms,
+		    char run_state,
+		    u64 timestamp)
 {
 	struct work_atom *atom;
 
@@ -993,25 +1012,37 @@ lat_sched_out(struct task_atoms *atoms,
 
 	atom->sched_out_time = timestamp;
 
-	if (sched_out_state(switch_event) == 'R') {
+	if (run_state == 'R') {
 		atom->state = THREAD_WAIT_CPU;
 		atom->wake_up_time = atom->sched_out_time;
 	}
 
-	atom->runtime = delta;
-	list_add_tail(&atom->list, &atoms->atom_list);
+	list_add_tail(&atom->list, &atoms->work_list);
+}
+
+static void
+add_runtime_event(struct work_atoms *atoms, u64 delta, u64 timestamp __used)
+{
+	struct work_atom *atom;
+
+	BUG_ON(list_empty(&atoms->work_list));
+
+	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
+
+	atom->runtime += delta;
+	atoms->total_runtime += delta;
 }
 
 static void
-lat_sched_in(struct task_atoms *atoms, u64 timestamp)
+add_sched_in_event(struct work_atoms *atoms, u64 timestamp)
 {
 	struct work_atom *atom;
 	u64 delta;
 
-	if (list_empty(&atoms->atom_list))
+	if (list_empty(&atoms->work_list))
 		return;
 
-	atom = list_entry(atoms->atom_list.prev, struct work_atom, list);
+	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
 
 	if (atom->state != THREAD_WAIT_CPU)
 		return;
@@ -1029,7 +1060,6 @@ lat_sched_in(struct task_atoms *atoms, u64 timestamp)
 	if (delta > atoms->max_lat)
 		atoms->max_lat = delta;
 	atoms->nb_atoms++;
-	atoms->total_runtime += atom->runtime;
 }
 
 static void
@@ -1039,13 +1069,12 @@ latency_switch_event(struct trace_switch_event *switch_event,
 		     u64 timestamp,
 		     struct thread *thread __used)
 {
-	struct task_atoms *out_atoms, *in_atoms;
+	struct work_atoms *out_events, *in_events;
 	struct thread *sched_out, *sched_in;
 	u64 timestamp0;
 	s64 delta;
 
-	if (cpu >= MAX_CPUS || cpu < 0)
-		return;
+	BUG_ON(cpu >= MAX_CPUS || cpu < 0);
 
 	timestamp0 = cpu_last_switched[cpu];
 	cpu_last_switched[cpu] = timestamp;
@@ -1061,34 +1090,63 @@ latency_switch_event(struct trace_switch_event *switch_event,
 	sched_out = threads__findnew(switch_event->prev_pid, &threads, &last_match);
 	sched_in = threads__findnew(switch_event->next_pid, &threads, &last_match);
 
-	in_atoms = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
-	if (!in_atoms) {
+	out_events = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
+	if (!out_events) {
+		thread_atoms_insert(sched_out);
+		out_events = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
+		if (!out_events)
+			die("out-event: Internal tree error");
+	}
+	add_sched_out_event(out_events, sched_out_state(switch_event), timestamp);
+
+	in_events = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
+	if (!in_events) {
 		thread_atoms_insert(sched_in);
-		in_atoms = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
-		if (!in_atoms)
-			die("in-atom: Internal tree error");
+		in_events = thread_atoms_search(&atom_root, sched_in, &cmp_pid);
+		if (!in_events)
+			die("in-event: Internal tree error");
+		/*
+		 * Take came in we have not heard about yet,
+		 * add in an initial atom in runnable state:
+		 */
+		add_sched_out_event(in_events, 'R', timestamp);
 	}
+	add_sched_in_event(in_events, timestamp);
+}
 
-	out_atoms = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
-	if (!out_atoms) {
-		thread_atoms_insert(sched_out);
-		out_atoms = thread_atoms_search(&atom_root, sched_out, &cmp_pid);
-		if (!out_atoms)
-			die("out-atom: Internal tree error");
+static void
+latency_runtime_event(struct trace_runtime_event *runtime_event,
+		     struct event *event __used,
+		     int cpu,
+		     u64 timestamp,
+		     struct thread *this_thread __used)
+{
+	struct work_atoms *atoms;
+	struct thread *thread;
+
+	BUG_ON(cpu >= MAX_CPUS || cpu < 0);
+
+	thread = threads__findnew(runtime_event->pid, &threads, &last_match);
+	atoms = thread_atoms_search(&atom_root, thread, &cmp_pid);
+	if (!atoms) {
+		thread_atoms_insert(thread);
+		atoms = thread_atoms_search(&atom_root, thread, &cmp_pid);
+		if (!atoms)
+			die("in-event: Internal tree error");
+		add_sched_out_event(atoms, 'R', timestamp);
 	}
 
-	lat_sched_in(in_atoms, timestamp);
-	lat_sched_out(out_atoms, switch_event, delta, timestamp);
+	add_runtime_event(atoms, runtime_event->runtime, timestamp);
 }
 
 static void
 latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
-		     struct event *event __used,
+		     struct event *__event __used,
 		     int cpu __used,
 		     u64 timestamp,
 		     struct thread *thread __used)
 {
-	struct task_atoms *atoms;
+	struct work_atoms *atoms;
 	struct work_atom *atom;
 	struct thread *wakee;
 
@@ -1100,16 +1158,20 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 	atoms = thread_atoms_search(&atom_root, wakee, &cmp_pid);
 	if (!atoms) {
 		thread_atoms_insert(wakee);
-		return;
+		atoms = thread_atoms_search(&atom_root, wakee, &cmp_pid);
+		if (!atoms)
+			die("wakeup-event: Internal tree error");
+		add_sched_out_event(atoms, 'S', timestamp);
 	}
 
-	if (list_empty(&atoms->atom_list))
-		return;
+	BUG_ON(list_empty(&atoms->work_list));
 
-	atom = list_entry(atoms->atom_list.prev, struct work_atom, list);
+	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
 
-	if (atom->state != THREAD_SLEEPING)
+	if (atom->state != THREAD_SLEEPING) {
+		printf("boo2\n");
 		return;
+	}
 
 	nr_timestamps++;
 	if (atom->sched_out_time > timestamp) {
@@ -1124,40 +1186,41 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 static struct trace_sched_handler lat_ops  = {
 	.wakeup_event		= latency_wakeup_event,
 	.switch_event		= latency_switch_event,
+	.runtime_event		= latency_runtime_event,
 	.fork_event		= latency_fork_event,
 };
 
-static void output_lat_thread(struct task_atoms *atom_list)
+static void output_lat_thread(struct work_atoms *work_list)
 {
 	int i;
 	int ret;
 	u64 avg;
 
-	if (!atom_list->nb_atoms)
+	if (!work_list->nb_atoms)
 		return;
 	/*
 	 * Ignore idle threads:
 	 */
-	if (!atom_list->thread->pid)
+	if (!work_list->thread->pid)
 		return;
 
-	all_runtime += atom_list->total_runtime;
-	all_count += atom_list->nb_atoms;
+	all_runtime += work_list->total_runtime;
+	all_count += work_list->nb_atoms;
 
-	ret = printf("  %s-%d ", atom_list->thread->comm, atom_list->thread->pid);
+	ret = printf("  %s-%d ", work_list->thread->comm, work_list->thread->pid);
 
 	for (i = 0; i < 24 - ret; i++)
 		printf(" ");
 
-	avg = atom_list->total_lat / atom_list->nb_atoms;
+	avg = work_list->total_lat / work_list->nb_atoms;
 
 	printf("|%9.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms |\n",
-	      (double)atom_list->total_runtime / 1e6,
-		 atom_list->nb_atoms, (double)avg / 1e6,
-		 (double)atom_list->max_lat / 1e6);
+	      (double)work_list->total_runtime / 1e6,
+		 work_list->nb_atoms, (double)avg / 1e6,
+		 (double)work_list->max_lat / 1e6);
 }
 
-static int pid_cmp(struct task_atoms *l, struct task_atoms *r)
+static int pid_cmp(struct work_atoms *l, struct work_atoms *r)
 {
 	if (l->thread->pid < r->thread->pid)
 		return -1;
@@ -1172,7 +1235,7 @@ static struct sort_dimension pid_sort_dimension = {
 	.cmp			= pid_cmp,
 };
 
-static int avg_cmp(struct task_atoms *l, struct task_atoms *r)
+static int avg_cmp(struct work_atoms *l, struct work_atoms *r)
 {
 	u64 avgl, avgr;
 
@@ -1198,7 +1261,7 @@ static struct sort_dimension avg_sort_dimension = {
 	.cmp			= avg_cmp,
 };
 
-static int max_cmp(struct task_atoms *l, struct task_atoms *r)
+static int max_cmp(struct work_atoms *l, struct work_atoms *r)
 {
 	if (l->max_lat < r->max_lat)
 		return -1;
@@ -1213,7 +1276,7 @@ static struct sort_dimension max_sort_dimension = {
 	.cmp			= max_cmp,
 };
 
-static int switch_cmp(struct task_atoms *l, struct task_atoms *r)
+static int switch_cmp(struct work_atoms *l, struct work_atoms *r)
 {
 	if (l->nb_atoms < r->nb_atoms)
 		return -1;
@@ -1228,7 +1291,7 @@ static struct sort_dimension switch_sort_dimension = {
 	.cmp			= switch_cmp,
 };
 
-static int runtime_cmp(struct task_atoms *l, struct task_atoms *r)
+static int runtime_cmp(struct work_atoms *l, struct work_atoms *r)
 {
 	if (l->total_runtime < r->total_runtime)
 		return -1;
@@ -1277,13 +1340,13 @@ static void sort_lat(void)
 	struct rb_node *node;
 
 	for (;;) {
-		struct task_atoms *data;
+		struct work_atoms *data;
 		node = rb_first(&atom_root);
 		if (!node)
 			break;
 
 		rb_erase(node, &atom_root);
-		data = rb_entry(node, struct task_atoms, node);
+		data = rb_entry(node, struct work_atoms, node);
 		__thread_latency_insert(&sorted_atom_root, data, &sort_list);
 	}
 }
@@ -1303,10 +1366,10 @@ static void __cmd_lat(void)
 	next = rb_first(&sorted_atom_root);
 
 	while (next) {
-		struct task_atoms *atom_list;
+		struct work_atoms *work_list;
 
-		atom_list = rb_entry(next, struct task_atoms, node);
-		output_lat_thread(atom_list);
+		work_list = rb_entry(next, struct work_atoms, node);
+		output_lat_thread(work_list);
 		next = rb_next(next);
 	}
 
@@ -1369,6 +1432,23 @@ process_sched_switch_event(struct raw_event_sample *raw,
 }
 
 static void
+process_sched_runtime_event(struct raw_event_sample *raw,
+			   struct event *event,
+			   int cpu __used,
+			   u64 timestamp __used,
+			   struct thread *thread __used)
+{
+	struct trace_runtime_event runtime_event;
+
+	FILL_ARRAY(runtime_event, comm, event, raw->data);
+	FILL_FIELD(runtime_event, pid, event, raw->data);
+	FILL_FIELD(runtime_event, runtime, event, raw->data);
+	FILL_FIELD(runtime_event, vruntime, event, raw->data);
+
+	trace_handler->runtime_event(&runtime_event, event, cpu, timestamp, thread);
+}
+
+static void
 process_sched_fork_event(struct raw_event_sample *raw,
 			 struct event *event,
 			 int cpu __used,
@@ -1410,6 +1490,8 @@ process_raw_event(event_t *raw_event __used, void *more_data,
 
 	if (!strcmp(event->name, "sched_switch"))
 		process_sched_switch_event(raw, event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_stat_runtime"))
+		process_sched_runtime_event(raw, event, cpu, timestamp, thread);
 	if (!strcmp(event->name, "sched_wakeup"))
 		process_sched_wakeup_event(raw, event, cpu, timestamp, thread);
 	if (!strcmp(event->name, "sched_wakeup_new"))

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

* [tip:sched/core] sched: Fix double_rq_lock() compile warning
       [not found]             ` <new-submission>
                                 ` (359 preceding siblings ...)
  2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Add support for sched:sched_stat_runtime events tip-bot for mingo
@ 2009-09-16 10:19               ` tip-bot for Peter Zijlstra
  2009-09-16 10:19               ` [tip:sched/core] sched: Split WAKEUP_OVERLAP tip-bot for Peter Zijlstra
                                 ` (345 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  b78bb868c54bebbf8d8786a3f8320700d6d2b864
Gitweb:     http://git.kernel.org/tip/b78bb868c54bebbf8d8786a3f8320700d6d2b864
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Sep 2009 14:23:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:01 +0200

sched: Fix double_rq_lock() compile warning

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index e27a536..17e4391 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -119,8 +119,6 @@
  */
 #define RUNTIME_INF	((u64)~0ULL)
 
-static void double_rq_lock(struct rq *rq1, struct rq *rq2);
-
 static inline int rt_policy(int policy)
 {
 	if (unlikely(policy == SCHED_FIFO || policy == SCHED_RR))
@@ -1695,6 +1693,8 @@ static inline void update_shares_locked(struct rq *rq, struct sched_domain *sd)
 
 #ifdef CONFIG_PREEMPT
 
+static void double_rq_lock(struct rq *rq1, struct rq *rq2);
+
 /*
  * fair double_lock_balance: Safely acquires both rq->locks in a fair
  * way at the expense of forcing extra atomic operations in all

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

* [tip:sched/core] sched: Split WAKEUP_OVERLAP
       [not found]             ` <new-submission>
                                 ` (360 preceding siblings ...)
  2009-09-16 10:19               ` [tip:sched/core] sched: Fix double_rq_lock() compile warning tip-bot for Peter Zijlstra
@ 2009-09-16 10:19               ` tip-bot for Peter Zijlstra
  2009-09-16 10:19               ` [tip:sched/core] sched: Complete buddy switches tip-bot for Mike Galbraith
                                 ` (344 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e6b1b2c9c0461c4e0971ed905ce3cda6512ee82a
Gitweb:     http://git.kernel.org/tip/e6b1b2c9c0461c4e0971ed905ce3cda6512ee82a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Sep 2009 11:59:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:02 +0200

sched: Split WAKEUP_OVERLAP

It consists of two conditions, split them out in separate toggles
so we can test them independently.

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     |    7 ++++---
 kernel/sched_features.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index aa7f841..cea5b82 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1526,9 +1526,10 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
 	if (!sched_feat(WAKEUP_PREEMPT))
 		return;
 
-	if (sched_feat(WAKEUP_OVERLAP) && (sync ||
-			(se->avg_overlap < sysctl_sched_migration_cost &&
-			 pse->avg_overlap < sysctl_sched_migration_cost))) {
+	if ((sched_feat(WAKEUP_SYNC) && sync) ||
+	    (sched_feat(WAKEUP_OVERLAP) &&
+	     (se->avg_overlap < sysctl_sched_migration_cost &&
+	      pse->avg_overlap < sysctl_sched_migration_cost))) {
 		resched_task(curr);
 		return;
 	}
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index e2dc63a..07c8250 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -12,6 +12,7 @@ SCHED_FEAT(ASYM_GRAN, 1)
 SCHED_FEAT(LB_BIAS, 1)
 SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
+SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 SCHED_FEAT(LAST_BUDDY, 1)
 SCHED_FEAT(OWNER_SPIN, 1)

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

* [tip:sched/core] sched: Complete buddy switches
       [not found]             ` <new-submission>
                                 ` (361 preceding siblings ...)
  2009-09-16 10:19               ` [tip:sched/core] sched: Split WAKEUP_OVERLAP tip-bot for Peter Zijlstra
@ 2009-09-16 10:19               ` tip-bot for Mike Galbraith
  2009-09-16 10:19               ` [tip:sched/core] sched: Add come comments to the sched features tip-bot for Peter Zijlstra
                                 ` (343 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-09-16 10:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  3cb63d527f76e25dbccce4f577f21aecfa2abac7
Gitweb:     http://git.kernel.org/tip/3cb63d527f76e25dbccce4f577f21aecfa2abac7
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 11 Sep 2009 12:01:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:02 +0200

sched: Complete buddy switches

Add a NEXT_BUDDY feature flag to aid in debugging.

Signed-off-by: Mike Galbraith <efault@gmx.de>
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     |    3 ++-
 kernel/sched_features.h |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index cea5b82..4f6356e 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1501,7 +1501,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
 	 */
 	if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
 		set_last_buddy(se);
-	set_next_buddy(pse);
+	if (sched_feat(NEXT_BUDDY))
+		set_next_buddy(pse);
 
 	/*
 	 * We can come here with TIF_NEED_RESCHED already set from new task
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 07c8250..6174c12 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -14,5 +14,6 @@ SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
 SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
+SCHED_FEAT(NEXT_BUDDY, 1)
 SCHED_FEAT(LAST_BUDDY, 1)
 SCHED_FEAT(OWNER_SPIN, 1)

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

* [tip:sched/core] sched: Add come comments to the sched features
       [not found]             ` <new-submission>
                                 ` (362 preceding siblings ...)
  2009-09-16 10:19               ` [tip:sched/core] sched: Complete buddy switches tip-bot for Mike Galbraith
@ 2009-09-16 10:19               ` tip-bot for Peter Zijlstra
  2009-09-16 10:19               ` [tip:sched/core] sched: Move code around tip-bot for Peter Zijlstra
                                 ` (342 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e26af0e8b2c9916f1e8a12ddaf52057bbe8ff600
Gitweb:     http://git.kernel.org/tip/e26af0e8b2c9916f1e8a12ddaf52057bbe8ff600
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Sep 2009 12:31:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:03 +0200

sched: Add come comments to the sched features

Add text...

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


---
 kernel/sched_features.h |   93 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 6174c12..891ea0f 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -1,19 +1,96 @@
+/*
+ * Disregards a certain amount of sleep time (sched_latency_ns) and
+ * considers the task to be running during that period. This gives it
+ * a service deficit on wakeup, allowing it to run sooner.
+ */
 SCHED_FEAT(NEW_FAIR_SLEEPERS, 0)
+
+/*
+ * By not normalizing the sleep time, heavy tasks get an effective
+ * longer period, and lighter task an effective shorter period they
+ * are considered running.
+ */
 SCHED_FEAT(NORMALIZED_SLEEPER, 0)
-SCHED_FEAT(ADAPTIVE_GRAN, 1)
-SCHED_FEAT(WAKEUP_PREEMPT, 1)
+
+/*
+ * Place new tasks ahead so that they do not starve already running
+ * tasks
+ */
 SCHED_FEAT(START_DEBIT, 1)
+
+/*
+ * Should wakeups try to preempt running tasks.
+ */
+SCHED_FEAT(WAKEUP_PREEMPT, 1)
+
+/*
+ * Compute wakeup_gran based on task behaviour, clipped to
+ *  [0, sched_wakeup_gran_ns]
+ */
+SCHED_FEAT(ADAPTIVE_GRAN, 1)
+
+/*
+ * When converting the wakeup granularity to virtual time, do it such
+ * that heavier tasks preempting a lighter task have an edge.
+ */
+SCHED_FEAT(ASYM_GRAN, 1)
+
+/*
+ * Always wakeup-preempt SYNC wakeups, see SYNC_WAKEUPS.
+ */
+SCHED_FEAT(WAKEUP_SYNC, 0)
+
+/*
+ * Wakeup preempt based on task behaviour. Tasks that do not overlap
+ * don't get preempted.
+ */
+SCHED_FEAT(WAKEUP_OVERLAP, 0)
+
+/*
+ * Use the SYNC wakeup hint, pipes and the likes use this to indicate
+ * the remote end is likely to consume the data we just wrote, and
+ * therefore has cache benefit from being placed on the same cpu, see
+ * also AFFINE_WAKEUPS.
+ */
+SCHED_FEAT(SYNC_WAKEUPS, 1)
+
+/*
+ * Based on load and program behaviour, see if it makes sense to place
+ * a newly woken task on the same cpu as the task that woke it --
+ * improve cache locality. Typically used with SYNC wakeups as
+ * generated by pipes and the like, see also SYNC_WAKEUPS.
+ */
 SCHED_FEAT(AFFINE_WAKEUPS, 1)
+
+/*
+ * Prefer to schedule the task we woke last (assuming it failed
+ * wakeup-preemption), since its likely going to consume data we
+ * touched, increases cache locality.
+ */
+SCHED_FEAT(NEXT_BUDDY, 1)
+
+/*
+ * Prefer to schedule the task that ran last (when we did
+ * wake-preempt) as that likely will touch the same data, increases
+ * cache locality.
+ */
+SCHED_FEAT(LAST_BUDDY, 1)
+
+/*
+ * Consider buddies to be cache hot, decreases the likelyness of a
+ * cache buddy being migrated away, increases cache locality.
+ */
 SCHED_FEAT(CACHE_HOT_BUDDY, 1)
-SCHED_FEAT(SYNC_WAKEUPS, 1)
+
 SCHED_FEAT(HRTICK, 0)
 SCHED_FEAT(DOUBLE_TICK, 0)
-SCHED_FEAT(ASYM_GRAN, 1)
 SCHED_FEAT(LB_BIAS, 1)
 SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
-SCHED_FEAT(WAKEUP_SYNC, 0)
-SCHED_FEAT(WAKEUP_OVERLAP, 0)
-SCHED_FEAT(NEXT_BUDDY, 1)
-SCHED_FEAT(LAST_BUDDY, 1)
+
+/*
+ * Spin-wait on mutex acquisition when the mutex owner is running on
+ * another cpu -- assumes that when the owner is running, it will soon
+ * release the lock. Decreases scheduling overhead.
+ */
 SCHED_FEAT(OWNER_SPIN, 1)

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

* [tip:sched/core] sched: Move code around
       [not found]             ` <new-submission>
                                 ` (363 preceding siblings ...)
  2009-09-16 10:19               ` [tip:sched/core] sched: Add come comments to the sched features tip-bot for Peter Zijlstra
@ 2009-09-16 10:19               ` tip-bot for Peter Zijlstra
  2009-09-16 10:20               ` [tip:sched/core] sched: Move sched_balance_self() into sched_fair.c tip-bot for Peter Zijlstra
                                 ` (341 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  f5f08f39ee4c5fd0a757d25d9e04d696676b3df7
Gitweb:     http://git.kernel.org/tip/f5f08f39ee4c5fd0a757d25d9e04d696676b3df7
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 13:35:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:03 +0200

sched: Move code around

In preparation to other code movement, move weighted_cpuload(),
source_load() and target_load() before the class includes.

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


---
 kernel/sched.c |   81 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 17e4391..b56d150 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1507,8 +1507,45 @@ static int tg_nop(struct task_group *tg, void *data)
 #endif
 
 #ifdef CONFIG_SMP
-static unsigned long source_load(int cpu, int type);
-static unsigned long target_load(int cpu, int type);
+/* Used instead of source_load when we know the type == 0 */
+static unsigned long weighted_cpuload(const int cpu)
+{
+	return cpu_rq(cpu)->load.weight;
+}
+
+/*
+ * Return a low guess at the load of a migration-source cpu weighted
+ * according to the scheduling class and "nice" value.
+ *
+ * We want to under-estimate the load of migration sources, to
+ * balance conservatively.
+ */
+static unsigned long source_load(int cpu, int type)
+{
+	struct rq *rq = cpu_rq(cpu);
+	unsigned long total = weighted_cpuload(cpu);
+
+	if (type == 0 || !sched_feat(LB_BIAS))
+		return total;
+
+	return min(rq->cpu_load[type-1], total);
+}
+
+/*
+ * Return a high guess at the load of a migration-target cpu weighted
+ * according to the scheduling class and "nice" value.
+ */
+static unsigned long target_load(int cpu, int type)
+{
+	struct rq *rq = cpu_rq(cpu);
+	unsigned long total = weighted_cpuload(cpu);
+
+	if (type == 0 || !sched_feat(LB_BIAS))
+		return total;
+
+	return max(rq->cpu_load[type-1], total);
+}
+
 static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
 
 static unsigned long cpu_avg_load_per_task(int cpu)
@@ -1959,13 +1996,6 @@ static inline void check_class_changed(struct rq *rq, struct task_struct *p,
 }
 
 #ifdef CONFIG_SMP
-
-/* Used instead of source_load when we know the type == 0 */
-static unsigned long weighted_cpuload(const int cpu)
-{
-	return cpu_rq(cpu)->load.weight;
-}
-
 /*
  * Is this task likely cache-hot:
  */
@@ -2241,39 +2271,6 @@ void kick_process(struct task_struct *p)
 EXPORT_SYMBOL_GPL(kick_process);
 
 /*
- * Return a low guess at the load of a migration-source cpu weighted
- * according to the scheduling class and "nice" value.
- *
- * We want to under-estimate the load of migration sources, to
- * balance conservatively.
- */
-static unsigned long source_load(int cpu, int type)
-{
-	struct rq *rq = cpu_rq(cpu);
-	unsigned long total = weighted_cpuload(cpu);
-
-	if (type == 0 || !sched_feat(LB_BIAS))
-		return total;
-
-	return min(rq->cpu_load[type-1], total);
-}
-
-/*
- * Return a high guess at the load of a migration-target cpu weighted
- * according to the scheduling class and "nice" value.
- */
-static unsigned long target_load(int cpu, int type)
-{
-	struct rq *rq = cpu_rq(cpu);
-	unsigned long total = weighted_cpuload(cpu);
-
-	if (type == 0 || !sched_feat(LB_BIAS))
-		return total;
-
-	return max(rq->cpu_load[type-1], total);
-}
-
-/*
  * find_idlest_group finds and returns the least busy CPU group within the
  * domain.
  */

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

* [tip:sched/core] sched: Move sched_balance_self() into sched_fair.c
       [not found]             ` <new-submission>
                                 ` (364 preceding siblings ...)
  2009-09-16 10:19               ` [tip:sched/core] sched: Move code around tip-bot for Peter Zijlstra
@ 2009-09-16 10:20               ` tip-bot for Peter Zijlstra
  2009-09-16 10:20               ` [tip:sched/core] sched: Hook sched_balance_self() into sched_class::select_task_rq() tip-bot for Peter Zijlstra
                                 ` (340 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  aaee1203ca52b9db799433c33c9bffc33cdf8909
Gitweb:     http://git.kernel.org/tip/aaee1203ca52b9db799433c33c9bffc33cdf8909
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 13:36:25 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:04 +0200

sched: Move sched_balance_self() into sched_fair.c

Move the sched_balance_self() code into sched_fair.c

This facilitates the merger of sched_balance_self() and
sched_fair::select_task_rq().

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


---
 kernel/sched.c      |  146 ---------------------------------------------------
 kernel/sched_fair.c |  145 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+), 146 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index b56d150..60400a2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2269,152 +2269,6 @@ void kick_process(struct task_struct *p)
 	preempt_enable();
 }
 EXPORT_SYMBOL_GPL(kick_process);
-
-/*
- * find_idlest_group finds and returns the least busy CPU group within the
- * domain.
- */
-static struct sched_group *
-find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
-{
-	struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
-	unsigned long min_load = ULONG_MAX, this_load = 0;
-	int load_idx = sd->forkexec_idx;
-	int imbalance = 100 + (sd->imbalance_pct-100)/2;
-
-	do {
-		unsigned long load, avg_load;
-		int local_group;
-		int i;
-
-		/* Skip over this group if it has no CPUs allowed */
-		if (!cpumask_intersects(sched_group_cpus(group),
-					&p->cpus_allowed))
-			continue;
-
-		local_group = cpumask_test_cpu(this_cpu,
-					       sched_group_cpus(group));
-
-		/* Tally up the load of all CPUs in the group */
-		avg_load = 0;
-
-		for_each_cpu(i, sched_group_cpus(group)) {
-			/* Bias balancing toward cpus of our domain */
-			if (local_group)
-				load = source_load(i, load_idx);
-			else
-				load = target_load(i, load_idx);
-
-			avg_load += load;
-		}
-
-		/* Adjust by relative CPU power of the group */
-		avg_load = (avg_load * SCHED_LOAD_SCALE) / group->cpu_power;
-
-		if (local_group) {
-			this_load = avg_load;
-			this = group;
-		} else if (avg_load < min_load) {
-			min_load = avg_load;
-			idlest = group;
-		}
-	} while (group = group->next, group != sd->groups);
-
-	if (!idlest || 100*this_load < imbalance*min_load)
-		return NULL;
-	return idlest;
-}
-
-/*
- * find_idlest_cpu - find the idlest cpu among the cpus in group.
- */
-static int
-find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
-{
-	unsigned long load, min_load = ULONG_MAX;
-	int idlest = -1;
-	int i;
-
-	/* Traverse only the allowed CPUs */
-	for_each_cpu_and(i, sched_group_cpus(group), &p->cpus_allowed) {
-		load = weighted_cpuload(i);
-
-		if (load < min_load || (load == min_load && i == this_cpu)) {
-			min_load = load;
-			idlest = i;
-		}
-	}
-
-	return idlest;
-}
-
-/*
- * sched_balance_self: balance the current task (running on cpu) in domains
- * that have the 'flag' flag set. In practice, this is SD_BALANCE_FORK and
- * SD_BALANCE_EXEC.
- *
- * Balance, ie. select the least loaded group.
- *
- * Returns the target CPU number, or the same CPU if no balancing is needed.
- *
- * preempt must be disabled.
- */
-static int sched_balance_self(int cpu, int flag)
-{
-	struct task_struct *t = current;
-	struct sched_domain *tmp, *sd = NULL;
-
-	for_each_domain(cpu, tmp) {
-		/*
-		 * If power savings logic is enabled for a domain, stop there.
-		 */
-		if (tmp->flags & SD_POWERSAVINGS_BALANCE)
-			break;
-		if (tmp->flags & flag)
-			sd = tmp;
-	}
-
-	if (sd)
-		update_shares(sd);
-
-	while (sd) {
-		struct sched_group *group;
-		int new_cpu, weight;
-
-		if (!(sd->flags & flag)) {
-			sd = sd->child;
-			continue;
-		}
-
-		group = find_idlest_group(sd, t, cpu);
-		if (!group) {
-			sd = sd->child;
-			continue;
-		}
-
-		new_cpu = find_idlest_cpu(group, t, cpu);
-		if (new_cpu == -1 || new_cpu == cpu) {
-			/* Now try balancing at a lower domain level of cpu */
-			sd = sd->child;
-			continue;
-		}
-
-		/* Now try balancing at a lower domain level of new_cpu */
-		cpu = new_cpu;
-		weight = cpumask_weight(sched_domain_span(sd));
-		sd = NULL;
-		for_each_domain(cpu, tmp) {
-			if (weight <= cpumask_weight(sched_domain_span(tmp)))
-				break;
-			if (tmp->flags & flag)
-				sd = tmp;
-		}
-		/* while loop will break here if sd == NULL */
-	}
-
-	return cpu;
-}
-
 #endif /* CONFIG_SMP */
 
 /**
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 4f6356e..a82d71d 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1360,6 +1360,151 @@ static int select_task_rq_fair(struct task_struct *p, int sync)
 out:
 	return wake_idle(new_cpu, p);
 }
+
+/*
+ * find_idlest_group finds and returns the least busy CPU group within the
+ * domain.
+ */
+static struct sched_group *
+find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
+{
+	struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
+	unsigned long min_load = ULONG_MAX, this_load = 0;
+	int load_idx = sd->forkexec_idx;
+	int imbalance = 100 + (sd->imbalance_pct-100)/2;
+
+	do {
+		unsigned long load, avg_load;
+		int local_group;
+		int i;
+
+		/* Skip over this group if it has no CPUs allowed */
+		if (!cpumask_intersects(sched_group_cpus(group),
+					&p->cpus_allowed))
+			continue;
+
+		local_group = cpumask_test_cpu(this_cpu,
+					       sched_group_cpus(group));
+
+		/* Tally up the load of all CPUs in the group */
+		avg_load = 0;
+
+		for_each_cpu(i, sched_group_cpus(group)) {
+			/* Bias balancing toward cpus of our domain */
+			if (local_group)
+				load = source_load(i, load_idx);
+			else
+				load = target_load(i, load_idx);
+
+			avg_load += load;
+		}
+
+		/* Adjust by relative CPU power of the group */
+		avg_load = (avg_load * SCHED_LOAD_SCALE) / group->cpu_power;
+
+		if (local_group) {
+			this_load = avg_load;
+			this = group;
+		} else if (avg_load < min_load) {
+			min_load = avg_load;
+			idlest = group;
+		}
+	} while (group = group->next, group != sd->groups);
+
+	if (!idlest || 100*this_load < imbalance*min_load)
+		return NULL;
+	return idlest;
+}
+
+/*
+ * find_idlest_cpu - find the idlest cpu among the cpus in group.
+ */
+static int
+find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
+{
+	unsigned long load, min_load = ULONG_MAX;
+	int idlest = -1;
+	int i;
+
+	/* Traverse only the allowed CPUs */
+	for_each_cpu_and(i, sched_group_cpus(group), &p->cpus_allowed) {
+		load = weighted_cpuload(i);
+
+		if (load < min_load || (load == min_load && i == this_cpu)) {
+			min_load = load;
+			idlest = i;
+		}
+	}
+
+	return idlest;
+}
+
+/*
+ * sched_balance_self: balance the current task (running on cpu) in domains
+ * that have the 'flag' flag set. In practice, this is SD_BALANCE_FORK and
+ * SD_BALANCE_EXEC.
+ *
+ * Balance, ie. select the least loaded group.
+ *
+ * Returns the target CPU number, or the same CPU if no balancing is needed.
+ *
+ * preempt must be disabled.
+ */
+static int sched_balance_self(int cpu, int flag)
+{
+	struct task_struct *t = current;
+	struct sched_domain *tmp, *sd = NULL;
+
+	for_each_domain(cpu, tmp) {
+		/*
+		 * If power savings logic is enabled for a domain, stop there.
+		 */
+		if (tmp->flags & SD_POWERSAVINGS_BALANCE)
+			break;
+		if (tmp->flags & flag)
+			sd = tmp;
+	}
+
+	if (sd)
+		update_shares(sd);
+
+	while (sd) {
+		struct sched_group *group;
+		int new_cpu, weight;
+
+		if (!(sd->flags & flag)) {
+			sd = sd->child;
+			continue;
+		}
+
+		group = find_idlest_group(sd, t, cpu);
+		if (!group) {
+			sd = sd->child;
+			continue;
+		}
+
+		new_cpu = find_idlest_cpu(group, t, cpu);
+		if (new_cpu == -1 || new_cpu == cpu) {
+			/* Now try balancing at a lower domain level of cpu */
+			sd = sd->child;
+			continue;
+		}
+
+		/* Now try balancing at a lower domain level of new_cpu */
+		cpu = new_cpu;
+		weight = cpumask_weight(sched_domain_span(sd));
+		sd = NULL;
+		for_each_domain(cpu, tmp) {
+			if (weight <= cpumask_weight(sched_domain_span(tmp)))
+				break;
+			if (tmp->flags & flag)
+				sd = tmp;
+		}
+		/* while loop will break here if sd == NULL */
+	}
+
+	return cpu;
+}
 #endif /* CONFIG_SMP */
 
 /*

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

* [tip:sched/core] sched: Hook sched_balance_self() into sched_class::select_task_rq()
       [not found]             ` <new-submission>
                                 ` (365 preceding siblings ...)
  2009-09-16 10:20               ` [tip:sched/core] sched: Move sched_balance_self() into sched_fair.c tip-bot for Peter Zijlstra
@ 2009-09-16 10:20               ` tip-bot for Peter Zijlstra
  2009-09-16 10:20               ` [tip:sched/core] sched: Add TASK_WAKING tip-bot for Peter Zijlstra
                                 ` (339 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5f3edc1b1ead6d9bd45a85c551f44eff8fe76b9f
Gitweb:     http://git.kernel.org/tip/5f3edc1b1ead6d9bd45a85c551f44eff8fe76b9f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 13:42:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:04 +0200

sched: Hook sched_balance_self() into sched_class::select_task_rq()

Rather ugly patch to fully place the sched_balance_self() code
inside the fair class.

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


---
 include/linux/sched.h   |    3 ++-
 kernel/sched.c          |   14 +++++++-------
 kernel/sched_fair.c     |    7 ++++++-
 kernel/sched_idletask.c |    2 +-
 kernel/sched_rt.c       |    5 ++++-
 5 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f3d74bd..5d3c990 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -811,6 +811,7 @@ enum cpu_idle_type {
 #define SD_SERIALIZE		0x0400	/* Only a single load balancing instance */
 #define SD_WAKE_IDLE_FAR	0x0800	/* Gain latency sacrificing cache hit */
 #define SD_PREFER_SIBLING	0x1000	/* Prefer to place tasks in a sibling domain */
+#define SD_BALANCE_WAKE		0x2000  /* Balance on wakeup */
 
 enum powersavings_balance_level {
 	POWERSAVINGS_BALANCE_NONE = 0,  /* No power saving load balance */
@@ -1032,7 +1033,7 @@ struct sched_class {
 	void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
-	int  (*select_task_rq)(struct task_struct *p, int sync);
+	int  (*select_task_rq)(struct task_struct *p, int flag, int sync);
 
 	unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
 			struct rq *busiest, unsigned long max_load_move,
diff --git a/kernel/sched.c b/kernel/sched.c
index 60400a2..32b7a81 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2350,7 +2350,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 	if (unlikely(task_running(rq, p)))
 		goto out_activate;
 
-	cpu = p->sched_class->select_task_rq(p, sync);
+	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, sync);
 	if (cpu != orig_cpu) {
 		set_task_cpu(p, cpu);
 		task_rq_unlock(rq, &flags);
@@ -2525,11 +2525,6 @@ void sched_fork(struct task_struct *p, int clone_flags)
 
 	__sched_fork(p);
 
-#ifdef CONFIG_SMP
-	cpu = sched_balance_self(cpu, SD_BALANCE_FORK);
-#endif
-	set_task_cpu(p, cpu);
-
 	/*
 	 * Make sure we do not leak PI boosting priority to the child.
 	 */
@@ -2560,6 +2555,11 @@ void sched_fork(struct task_struct *p, int clone_flags)
 	if (!rt_prio(p->prio))
 		p->sched_class = &fair_sched_class;
 
+#ifdef CONFIG_SMP
+	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0);
+#endif
+	set_task_cpu(p, cpu);
+
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))
 		memset(&p->sched_info, 0, sizeof(p->sched_info));
@@ -3114,7 +3114,7 @@ out:
 void sched_exec(void)
 {
 	int new_cpu, this_cpu = get_cpu();
-	new_cpu = sched_balance_self(this_cpu, SD_BALANCE_EXEC);
+	new_cpu = current->sched_class->select_task_rq(current, SD_BALANCE_EXEC, 0);
 	put_cpu();
 	if (new_cpu != this_cpu)
 		sched_migrate_task(current, new_cpu);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index a82d71d..f2eb5b9 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1300,7 +1300,9 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 	return 0;
 }
 
-static int select_task_rq_fair(struct task_struct *p, int sync)
+static int sched_balance_self(int cpu, int flag);
+
+static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 {
 	struct sched_domain *sd, *this_sd = NULL;
 	int prev_cpu, this_cpu, new_cpu;
@@ -1314,6 +1316,9 @@ static int select_task_rq_fair(struct task_struct *p, int sync)
 	this_rq		= cpu_rq(this_cpu);
 	new_cpu		= prev_cpu;
 
+	if (flag != SD_BALANCE_WAKE)
+		return sched_balance_self(this_cpu, flag);
+
 	/*
 	 * 'this_sd' is the first domain that both
 	 * this_cpu and prev_cpu are present in:
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 499672c..99b2f03 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -6,7 +6,7 @@
  */
 
 #ifdef CONFIG_SMP
-static int select_task_rq_idle(struct task_struct *p, int sync)
+static int select_task_rq_idle(struct task_struct *p, int flag, int sync)
 {
 	return task_cpu(p); /* IDLE tasks as never migrated */
 }
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 2eb4bd6..4383808 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -938,10 +938,13 @@ static void yield_task_rt(struct rq *rq)
 #ifdef CONFIG_SMP
 static int find_lowest_rq(struct task_struct *task);
 
-static int select_task_rq_rt(struct task_struct *p, int sync)
+static int select_task_rq_rt(struct task_struct *p, int flag, int sync)
 {
 	struct rq *rq = task_rq(p);
 
+	if (flag != SD_BALANCE_WAKE)
+		return smp_processor_id();
+
 	/*
 	 * If the current task is an RT task, then
 	 * try to see if we can wake this RT task up on another

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

* [tip:sched/core] sched: Add TASK_WAKING
       [not found]             ` <new-submission>
                                 ` (366 preceding siblings ...)
  2009-09-16 10:20               ` [tip:sched/core] sched: Hook sched_balance_self() into sched_class::select_task_rq() tip-bot for Peter Zijlstra
@ 2009-09-16 10:20               ` tip-bot for Peter Zijlstra
  2009-09-16 10:20               ` [tip:sched/core] sched: Merge select_task_rq_fair() and sched_balance_self() tip-bot for Peter Zijlstra
                                 ` (338 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e9c8431185d6c406887190519f6dbdd112641686
Gitweb:     http://git.kernel.org/tip/e9c8431185d6c406887190519f6dbdd112641686
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Sep 2009 14:43:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:05 +0200

sched: Add TASK_WAKING

We're going to want to drop rq->lock in try_to_wake_up() for a
longer period of time, however we also want to deal with concurrent
waking of the same task, which is currently handled by holding
rq->lock.

So introduce a new TASK state, namely TASK_WAKING, which indicates
someone is already waking the task (other wakers will fail p->state
& state).

We also keep preemption disabled over the whole ttwu().

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


---
 include/linux/sched.h |    1 +
 kernel/sched.c        |   31 +++++++++++++++----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5d3c990..3b0ca66 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -190,6 +190,7 @@ extern unsigned long long time_sync_thresh;
 /* in tsk->state again */
 #define TASK_DEAD		64
 #define TASK_WAKEKILL		128
+#define TASK_WAKING		256
 
 /* Convenience macros for the sake of set_task_state */
 #define TASK_KILLABLE		(TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
diff --git a/kernel/sched.c b/kernel/sched.c
index 32b7a81..fc6fda8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2310,7 +2310,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 {
 	int cpu, orig_cpu, this_cpu, success = 0;
 	unsigned long flags;
-	long old_state;
 	struct rq *rq;
 
 	if (!sched_feat(SYNC_WAKEUPS))
@@ -2332,11 +2331,12 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 	}
 #endif
 
+	this_cpu = get_cpu();
+
 	smp_wmb();
 	rq = task_rq_lock(p, &flags);
 	update_rq_clock(rq);
-	old_state = p->state;
-	if (!(old_state & state))
+	if (!(p->state & state))
 		goto out;
 
 	if (p->se.on_rq)
@@ -2344,27 +2344,25 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 
 	cpu = task_cpu(p);
 	orig_cpu = cpu;
-	this_cpu = smp_processor_id();
 
 #ifdef CONFIG_SMP
 	if (unlikely(task_running(rq, p)))
 		goto out_activate;
 
+	/*
+	 * In order to handle concurrent wakeups and release the rq->lock
+	 * we put the task in TASK_WAKING state.
+	 */
+	p->state = TASK_WAKING;
+	task_rq_unlock(rq, &flags);
+
 	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, sync);
-	if (cpu != orig_cpu) {
+	if (cpu != orig_cpu)
 		set_task_cpu(p, cpu);
-		task_rq_unlock(rq, &flags);
-		/* might preempt at this point */
-		rq = task_rq_lock(p, &flags);
-		old_state = p->state;
-		if (!(old_state & state))
-			goto out;
-		if (p->se.on_rq)
-			goto out_running;
 
-		this_cpu = smp_processor_id();
-		cpu = task_cpu(p);
-	}
+	rq = task_rq_lock(p, &flags);
+	WARN_ON(p->state != TASK_WAKING);
+	cpu = task_cpu(p);
 
 #ifdef CONFIG_SCHEDSTATS
 	schedstat_inc(rq, ttwu_count);
@@ -2422,6 +2420,7 @@ out_running:
 #endif
 out:
 	task_rq_unlock(rq, &flags);
+	put_cpu();
 
 	return success;
 }

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

* [tip:sched/core] sched: Merge select_task_rq_fair() and sched_balance_self()
       [not found]             ` <new-submission>
                                 ` (367 preceding siblings ...)
  2009-09-16 10:20               ` [tip:sched/core] sched: Add TASK_WAKING tip-bot for Peter Zijlstra
@ 2009-09-16 10:20               ` tip-bot for Peter Zijlstra
  2009-09-16 10:21               ` [tip:sched/core] sched: Weaken SD_POWERSAVINGS_BALANCE tip-bot for Peter Zijlstra
                                 ` (337 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  c88d5910890ad35af283344417891344604f0438
Gitweb:     http://git.kernel.org/tip/c88d5910890ad35af283344417891344604f0438
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 13:50:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:05 +0200

sched: Merge select_task_rq_fair() and sched_balance_self()

The problem with wake_idle() is that is doesn't respect things like
cpu_power, which means it doesn't deal well with SMT nor the recent
RT interaction.

To cure this, it needs to do what sched_balance_self() does, which
leads to the possibility of merging select_task_rq_fair() and
sched_balance_self().

Modify sched_balance_self() to:

  - update_shares() when walking up the domain tree,
    (it only called it for the top domain, but it should
     have done this anyway), which allows us to remove
    this ugly bit from try_to_wake_up().

  - do wake_affine() on the smallest domain that contains
    both this (the waking) and the prev (the wakee) cpu for
    WAKE invocations.

Then use the top-down balance steps it had to replace wake_idle().

This leads to the dissapearance of SD_WAKE_BALANCE and
SD_WAKE_IDLE_FAR, with SD_WAKE_IDLE replaced with SD_BALANCE_WAKE.

SD_WAKE_AFFINE needs SD_BALANCE_WAKE to be effective.

Touch all topology bits to replace the old with new SD flags --
platforms might need re-tuning, enabling SD_BALANCE_WAKE
conditionally on a NUMA distance seems like a good additional
feature, magny-core and small nehalem systems would want this
enabled, systems with slow interconnects would not.

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


---
 arch/ia64/include/asm/topology.h           |    5 +-
 arch/mips/include/asm/mach-ip27/topology.h |    2 +-
 arch/powerpc/include/asm/topology.h        |    5 +-
 arch/sh/include/asm/topology.h             |    4 +-
 arch/sparc/include/asm/topology_64.h       |    4 +-
 arch/x86/include/asm/topology.h            |    4 +-
 include/linux/sched.h                      |    7 +-
 include/linux/topology.h                   |   16 +--
 kernel/sched.c                             |   41 +-----
 kernel/sched_fair.c                        |  233 ++++++++--------------------
 10 files changed, 84 insertions(+), 237 deletions(-)

diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 7b4c8c7..cf6053b 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -67,6 +67,7 @@ void build_cpu_to_node_map(void);
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_WAKE	\
 				| SD_WAKE_AFFINE,	\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
@@ -91,8 +92,8 @@ void build_cpu_to_node_map(void);
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
 				| SD_BALANCE_FORK	\
-				| SD_SERIALIZE		\
-				| SD_WAKE_BALANCE,	\
+				| SD_BALANCE_WAKE	\
+				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 64,			\
 	.nr_balance_failed	= 0,			\
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index 0754723..d833239 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -48,7 +48,7 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
 	.cache_nice_tries	= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
-				| SD_WAKE_BALANCE,	\
+				| SD_BALANCE_WAKE,	\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
 	.nr_balance_failed	= 0,			\
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 054a16d..c634331 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -62,9 +62,8 @@ static inline int pcibus_to_node(struct pci_bus *bus)
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
 				| SD_BALANCE_NEWIDLE	\
-				| SD_WAKE_IDLE		\
-				| SD_SERIALIZE		\
-				| SD_WAKE_BALANCE,	\
+				| SD_BALANCE_WAKE	\
+				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
 	.nr_balance_failed	= 0,			\
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index b69ee85..dc1531e 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -21,8 +21,8 @@
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
-				| SD_SERIALIZE		\
-				| SD_WAKE_BALANCE,	\
+				| SD_BALANCE_WAKE	\
+				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
 	.nr_balance_failed	= 0,			\
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index e5ea8d3..1d091ab 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -57,8 +57,8 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
-				| SD_SERIALIZE		\
-				| SD_WAKE_BALANCE,	\
+				| SD_BALANCE_WAKE	\
+				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
 }
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 26d06e0..966d58d 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -145,14 +145,12 @@ extern unsigned long node_remap_size[];
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 1*SD_SERIALIZE			\
-				| 1*SD_WAKE_IDLE_FAR			\
 				| 0*SD_PREFER_SIBLING			\
 				,					\
 	.last_balance		= jiffies,				\
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3b0ca66..c30bf3d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -803,16 +803,15 @@ enum cpu_idle_type {
 #define SD_BALANCE_NEWIDLE	0x0002	/* Balance when about to become idle */
 #define SD_BALANCE_EXEC		0x0004	/* Balance on exec */
 #define SD_BALANCE_FORK		0x0008	/* Balance on fork, clone */
-#define SD_WAKE_IDLE		0x0010	/* Wake to idle CPU on task wakeup */
+#define SD_BALANCE_WAKE		0x0010  /* Balance on wakeup */
 #define SD_WAKE_AFFINE		0x0020	/* Wake task to waking CPU */
-#define SD_WAKE_BALANCE		0x0040	/* Perform balancing at task wakeup */
+
 #define SD_SHARE_CPUPOWER	0x0080	/* Domain members share cpu power */
 #define SD_POWERSAVINGS_BALANCE	0x0100	/* Balance for power savings */
 #define SD_SHARE_PKG_RESOURCES	0x0200	/* Domain members share cpu pkg resources */
 #define SD_SERIALIZE		0x0400	/* Only a single load balancing instance */
-#define SD_WAKE_IDLE_FAR	0x0800	/* Gain latency sacrificing cache hit */
+
 #define SD_PREFER_SIBLING	0x1000	/* Prefer to place tasks in a sibling domain */
-#define SD_BALANCE_WAKE		0x2000  /* Balance on wakeup */
 
 enum powersavings_balance_level {
 	POWERSAVINGS_BALANCE_NONE = 0,  /* No power saving load balance */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 85e8cf7..6a8cd15 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -95,14 +95,12 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 1*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 1*SD_WAKE_BALANCE			\
 				| 1*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
-				| 0*SD_WAKE_IDLE_FAR			\
 				| 0*SD_PREFER_SIBLING			\
 				,					\
 	.last_balance		= jiffies,				\
@@ -129,13 +127,11 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_WAKE_IDLE			\
+				| 1*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 1*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
-				| 0*SD_WAKE_IDLE_FAR			\
 				| sd_balance_for_mc_power()		\
 				| sd_power_saving_flags()		\
 				,					\
@@ -163,13 +159,11 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_WAKE_IDLE			\
+				| 1*SD_BALANCE_WAKE			\
 				| 0*SD_WAKE_AFFINE			\
-				| 1*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
-				| 0*SD_WAKE_IDLE_FAR			\
 				| sd_balance_for_package_power()	\
 				| sd_power_saving_flags()		\
 				,					\
@@ -191,14 +185,12 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 0*SD_BALANCE_EXEC			\
 				| 0*SD_BALANCE_FORK			\
-				| 0*SD_WAKE_IDLE			\
+				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 0*SD_WAKE_BALANCE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 1*SD_SERIALIZE			\
-				| 1*SD_WAKE_IDLE_FAR			\
 				| 0*SD_PREFER_SIBLING			\
 				,					\
 	.last_balance		= jiffies,				\
diff --git a/kernel/sched.c b/kernel/sched.c
index fc6fda8..6c819f3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -512,14 +512,6 @@ struct root_domain {
 #ifdef CONFIG_SMP
 	struct cpupri cpupri;
 #endif
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-	/*
-	 * Preferred wake up cpu nominated by sched_mc balance that will be
-	 * used when most cpus are idle in the system indicating overall very
-	 * low system utilisation. Triggered at POWERSAVINGS_BALANCE_WAKEUP(2)
-	 */
-	unsigned int sched_mc_preferred_wakeup_cpu;
-#endif
 };
 
 /*
@@ -2315,22 +2307,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 	if (!sched_feat(SYNC_WAKEUPS))
 		sync = 0;
 
-#ifdef CONFIG_SMP
-	if (sched_feat(LB_WAKEUP_UPDATE) && !root_task_group_empty()) {
-		struct sched_domain *sd;
-
-		this_cpu = raw_smp_processor_id();
-		cpu = task_cpu(p);
-
-		for_each_domain(this_cpu, sd) {
-			if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
-				update_shares(sd);
-				break;
-			}
-		}
-	}
-#endif
-
 	this_cpu = get_cpu();
 
 	smp_wmb();
@@ -3533,11 +3509,6 @@ static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
 	*imbalance = sds->min_load_per_task;
 	sds->busiest = sds->group_min;
 
-	if (sched_mc_power_savings >= POWERSAVINGS_BALANCE_WAKEUP) {
-		cpu_rq(this_cpu)->rd->sched_mc_preferred_wakeup_cpu =
-			group_first_cpu(sds->group_leader);
-	}
-
 	return 1;
 
 }
@@ -7850,9 +7821,7 @@ static int sd_degenerate(struct sched_domain *sd)
 	}
 
 	/* Following flags don't use groups */
-	if (sd->flags & (SD_WAKE_IDLE |
-			 SD_WAKE_AFFINE |
-			 SD_WAKE_BALANCE))
+	if (sd->flags & (SD_WAKE_AFFINE))
 		return 0;
 
 	return 1;
@@ -7869,10 +7838,6 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
 	if (!cpumask_equal(sched_domain_span(sd), sched_domain_span(parent)))
 		return 0;
 
-	/* Does parent contain flags not in child? */
-	/* WAKE_BALANCE is a subset of WAKE_AFFINE */
-	if (cflags & SD_WAKE_AFFINE)
-		pflags &= ~SD_WAKE_BALANCE;
 	/* Flags needing groups don't count if only 1 group in parent */
 	if (parent->groups == parent->groups->next) {
 		pflags &= ~(SD_LOAD_BALANCE |
@@ -8558,10 +8523,10 @@ static void set_domain_attribute(struct sched_domain *sd,
 		request = attr->relax_domain_level;
 	if (request < sd->level) {
 		/* turn off idle balance on this domain */
-		sd->flags &= ~(SD_WAKE_IDLE|SD_BALANCE_NEWIDLE);
+		sd->flags &= ~(SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
 	} else {
 		/* turn on idle balance on this domain */
-		sd->flags |= (SD_WAKE_IDLE_FAR|SD_BALANCE_NEWIDLE);
+		sd->flags |= (SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
 	}
 }
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index f2eb5b9..09d19f7 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1062,83 +1062,6 @@ static void yield_task_fair(struct rq *rq)
 	se->vruntime = rightmost->vruntime + 1;
 }
 
-/*
- * wake_idle() will wake a task on an idle cpu if task->cpu is
- * not idle and an idle cpu is available.  The span of cpus to
- * search starts with cpus closest then further out as needed,
- * so we always favor a closer, idle cpu.
- * Domains may include CPUs that are not usable for migration,
- * hence we need to mask them out (rq->rd->online)
- *
- * Returns the CPU we should wake onto.
- */
-#if defined(ARCH_HAS_SCHED_WAKE_IDLE)
-
-#define cpu_rd_active(cpu, rq) cpumask_test_cpu(cpu, rq->rd->online)
-
-static int wake_idle(int cpu, struct task_struct *p)
-{
-	struct sched_domain *sd;
-	int i;
-	unsigned int chosen_wakeup_cpu;
-	int this_cpu;
-	struct rq *task_rq = task_rq(p);
-
-	/*
-	 * At POWERSAVINGS_BALANCE_WAKEUP level, if both this_cpu and prev_cpu
-	 * are idle and this is not a kernel thread and this task's affinity
-	 * allows it to be moved to preferred cpu, then just move!
-	 */
-
-	this_cpu = smp_processor_id();
-	chosen_wakeup_cpu =
-		cpu_rq(this_cpu)->rd->sched_mc_preferred_wakeup_cpu;
-
-	if (sched_mc_power_savings >= POWERSAVINGS_BALANCE_WAKEUP &&
-		idle_cpu(cpu) && idle_cpu(this_cpu) &&
-		p->mm && !(p->flags & PF_KTHREAD) &&
-		cpu_isset(chosen_wakeup_cpu, p->cpus_allowed))
-		return chosen_wakeup_cpu;
-
-	/*
-	 * If it is idle, then it is the best cpu to run this task.
-	 *
-	 * This cpu is also the best, if it has more than one task already.
-	 * Siblings must be also busy(in most cases) as they didn't already
-	 * pickup the extra load from this cpu and hence we need not check
-	 * sibling runqueue info. This will avoid the checks and cache miss
-	 * penalities associated with that.
-	 */
-	if (idle_cpu(cpu) || cpu_rq(cpu)->cfs.nr_running > 1)
-		return cpu;
-
-	for_each_domain(cpu, sd) {
-		if ((sd->flags & SD_WAKE_IDLE)
-		    || ((sd->flags & SD_WAKE_IDLE_FAR)
-			&& !task_hot(p, task_rq->clock, sd))) {
-			for_each_cpu_and(i, sched_domain_span(sd),
-					 &p->cpus_allowed) {
-				if (cpu_rd_active(i, task_rq) && idle_cpu(i)) {
-					if (i != task_cpu(p)) {
-						schedstat_inc(p,
-						       se.nr_wakeups_idle);
-					}
-					return i;
-				}
-			}
-		} else {
-			break;
-		}
-	}
-	return cpu;
-}
-#else /* !ARCH_HAS_SCHED_WAKE_IDLE*/
-static inline int wake_idle(int cpu, struct task_struct *p)
-{
-	return cpu;
-}
-#endif
-
 #ifdef CONFIG_SMP
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1225,21 +1148,22 @@ static inline unsigned long effective_load(struct task_group *tg, int cpu,
 
 #endif
 
-static int
-wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
-	    struct task_struct *p, int prev_cpu, int this_cpu, int sync,
-	    int idx, unsigned long load, unsigned long this_load,
-	    unsigned int imbalance)
+static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
 {
-	struct task_struct *curr = this_rq->curr;
-	struct task_group *tg;
-	unsigned long tl = this_load;
+	struct task_struct *curr = current;
+	unsigned long this_load, load;
+	int idx, this_cpu, prev_cpu;
 	unsigned long tl_per_task;
+	unsigned int imbalance;
+	struct task_group *tg;
 	unsigned long weight;
 	int balanced;
 
-	if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
-		return 0;
+	idx	  = sd->wake_idx;
+	this_cpu  = smp_processor_id();
+	prev_cpu  = task_cpu(p);
+	load	  = source_load(prev_cpu, idx);
+	this_load = target_load(this_cpu, idx);
 
 	if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
 			p->se.avg_overlap > sysctl_sched_migration_cost))
@@ -1254,24 +1178,26 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 		tg = task_group(current);
 		weight = current->se.load.weight;
 
-		tl += effective_load(tg, this_cpu, -weight, -weight);
+		this_load += effective_load(tg, this_cpu, -weight, -weight);
 		load += effective_load(tg, prev_cpu, 0, -weight);
 	}
 
 	tg = task_group(p);
 	weight = p->se.load.weight;
 
+	imbalance = 100 + (sd->imbalance_pct - 100) / 2;
+
 	/*
 	 * In low-load situations, where prev_cpu is idle and this_cpu is idle
-	 * due to the sync cause above having dropped tl to 0, we'll always have
-	 * an imbalance, but there's really nothing you can do about that, so
-	 * that's good too.
+	 * due to the sync cause above having dropped this_load to 0, we'll
+	 * always have an imbalance, but there's really nothing you can do
+	 * about that, so that's good too.
 	 *
 	 * Otherwise check if either cpus are near enough in load to allow this
 	 * task to be woken on this_cpu.
 	 */
-	balanced = !tl ||
-		100*(tl + effective_load(tg, this_cpu, weight, weight)) <=
+	balanced = !this_load ||
+		100*(this_load + effective_load(tg, this_cpu, weight, weight)) <=
 		imbalance*(load + effective_load(tg, prev_cpu, 0, weight));
 
 	/*
@@ -1285,14 +1211,15 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 	schedstat_inc(p, se.nr_wakeups_affine_attempts);
 	tl_per_task = cpu_avg_load_per_task(this_cpu);
 
-	if (balanced || (tl <= load && tl + target_load(prev_cpu, idx) <=
-			tl_per_task)) {
+	if (balanced ||
+	    (this_load <= load &&
+	     this_load + target_load(prev_cpu, idx) <= tl_per_task)) {
 		/*
 		 * This domain has SD_WAKE_AFFINE and
 		 * p is cache cold in this domain, and
 		 * there is no bad imbalance.
 		 */
-		schedstat_inc(this_sd, ttwu_move_affine);
+		schedstat_inc(sd, ttwu_move_affine);
 		schedstat_inc(p, se.nr_wakeups_affine);
 
 		return 1;
@@ -1300,72 +1227,6 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 	return 0;
 }
 
-static int sched_balance_self(int cpu, int flag);
-
-static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
-{
-	struct sched_domain *sd, *this_sd = NULL;
-	int prev_cpu, this_cpu, new_cpu;
-	unsigned long load, this_load;
-	struct rq *this_rq;
-	unsigned int imbalance;
-	int idx;
-
-	prev_cpu	= task_cpu(p);
-	this_cpu	= smp_processor_id();
-	this_rq		= cpu_rq(this_cpu);
-	new_cpu		= prev_cpu;
-
-	if (flag != SD_BALANCE_WAKE)
-		return sched_balance_self(this_cpu, flag);
-
-	/*
-	 * 'this_sd' is the first domain that both
-	 * this_cpu and prev_cpu are present in:
-	 */
-	for_each_domain(this_cpu, sd) {
-		if (cpumask_test_cpu(prev_cpu, sched_domain_span(sd))) {
-			this_sd = sd;
-			break;
-		}
-	}
-
-	if (unlikely(!cpumask_test_cpu(this_cpu, &p->cpus_allowed)))
-		goto out;
-
-	/*
-	 * Check for affine wakeup and passive balancing possibilities.
-	 */
-	if (!this_sd)
-		goto out;
-
-	idx = this_sd->wake_idx;
-
-	imbalance = 100 + (this_sd->imbalance_pct - 100) / 2;
-
-	load = source_load(prev_cpu, idx);
-	this_load = target_load(this_cpu, idx);
-
-	if (wake_affine(this_sd, this_rq, p, prev_cpu, this_cpu, sync, idx,
-				     load, this_load, imbalance))
-		return this_cpu;
-
-	/*
-	 * Start passive balancing when half the imbalance_pct
-	 * limit is reached.
-	 */
-	if (this_sd->flags & SD_WAKE_BALANCE) {
-		if (imbalance*this_load <= 100*load) {
-			schedstat_inc(this_sd, ttwu_move_balance);
-			schedstat_inc(p, se.nr_wakeups_passive);
-			return this_cpu;
-		}
-	}
-
-out:
-	return wake_idle(new_cpu, p);
-}
-
 /*
  * find_idlest_group finds and returns the least busy CPU group within the
  * domain.
@@ -1455,10 +1316,20 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  *
  * preempt must be disabled.
  */
-static int sched_balance_self(int cpu, int flag)
+static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 {
 	struct task_struct *t = current;
 	struct sched_domain *tmp, *sd = NULL;
+	int cpu = smp_processor_id();
+	int prev_cpu = task_cpu(p);
+	int new_cpu = cpu;
+	int want_affine = 0;
+
+	if (flag & SD_BALANCE_WAKE) {
+		if (sched_feat(AFFINE_WAKEUPS))
+			want_affine = 1;
+		new_cpu = prev_cpu;
+	}
 
 	for_each_domain(cpu, tmp) {
 		/*
@@ -1466,16 +1337,38 @@ static int sched_balance_self(int cpu, int flag)
 		 */
 		if (tmp->flags & SD_POWERSAVINGS_BALANCE)
 			break;
-		if (tmp->flags & flag)
-			sd = tmp;
-	}
 
-	if (sd)
-		update_shares(sd);
+		switch (flag) {
+		case SD_BALANCE_WAKE:
+			if (!sched_feat(LB_WAKEUP_UPDATE))
+				break;
+		case SD_BALANCE_FORK:
+		case SD_BALANCE_EXEC:
+			if (root_task_group_empty())
+				break;
+			update_shares(tmp);
+		default:
+			break;
+		}
+
+		if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
+		    cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
+
+			if (wake_affine(tmp, p, sync))
+				return cpu;
+
+			want_affine = 0;
+		}
+
+		if (!(tmp->flags & flag))
+			continue;
+
+		sd = tmp;
+	}
 
 	while (sd) {
 		struct sched_group *group;
-		int new_cpu, weight;
+		int weight;
 
 		if (!(sd->flags & flag)) {
 			sd = sd->child;
@@ -1508,7 +1401,7 @@ static int sched_balance_self(int cpu, int flag)
 		/* while loop will break here if sd == NULL */
 	}
 
-	return cpu;
+	return new_cpu;
 }
 #endif /* CONFIG_SMP */
 

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

* [tip:sched/core] sched: Weaken SD_POWERSAVINGS_BALANCE
       [not found]             ` <new-submission>
                                 ` (368 preceding siblings ...)
  2009-09-16 10:20               ` [tip:sched/core] sched: Merge select_task_rq_fair() and sched_balance_self() tip-bot for Peter Zijlstra
@ 2009-09-16 10:21               ` tip-bot for Peter Zijlstra
  2009-09-16 10:21               ` [tip:sched/core] sched: for_each_domain() vs RCU tip-bot for Peter Zijlstra
                                 ` (336 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  ae154be1f34a674e6cbb43ccf6e442f56acd7a70
Gitweb:     http://git.kernel.org/tip/ae154be1f34a674e6cbb43ccf6e442f56acd7a70
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 14:40:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:06 +0200

sched: Weaken SD_POWERSAVINGS_BALANCE

One of the problems of power-saving balancing is that under certain
scenarios it is too slow and allows tons of real work to pile up.

Avoid this by ignoring the powersave stuff when there's real work
to be done.

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


---
 kernel/sched.c      |   40 ++++++++++++++++++++--------------------
 kernel/sched_fair.c |   21 ++++++++++++++++++---
 2 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 6c819f3..f0ccb8b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1538,6 +1538,26 @@ static unsigned long target_load(int cpu, int type)
 	return max(rq->cpu_load[type-1], total);
 }
 
+static struct sched_group *group_of(int cpu)
+{
+	struct sched_domain *sd = rcu_dereference(cpu_rq(cpu)->sd);
+
+	if (!sd)
+		return NULL;
+
+	return sd->groups;
+}
+
+static unsigned long power_of(int cpu)
+{
+	struct sched_group *group = group_of(cpu);
+
+	if (!group)
+		return SCHED_LOAD_SCALE;
+
+	return group->cpu_power;
+}
+
 static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
 
 static unsigned long cpu_avg_load_per_task(int cpu)
@@ -3982,26 +4002,6 @@ ret:
 	return NULL;
 }
 
-static struct sched_group *group_of(int cpu)
-{
-	struct sched_domain *sd = rcu_dereference(cpu_rq(cpu)->sd);
-
-	if (!sd)
-		return NULL;
-
-	return sd->groups;
-}
-
-static unsigned long power_of(int cpu)
-{
-	struct sched_group *group = group_of(cpu);
-
-	if (!group)
-		return SCHED_LOAD_SCALE;
-
-	return group->cpu_power;
-}
-
 /*
  * find_busiest_queue - find the busiest runqueue among the cpus in group.
  */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 09d19f7..eaa0001 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1333,10 +1333,25 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 
 	for_each_domain(cpu, tmp) {
 		/*
-		 * If power savings logic is enabled for a domain, stop there.
+		 * If power savings logic is enabled for a domain, see if we
+		 * are not overloaded, if so, don't balance wider.
 		 */
-		if (tmp->flags & SD_POWERSAVINGS_BALANCE)
-			break;
+		if (tmp->flags & SD_POWERSAVINGS_BALANCE) {
+			unsigned long power = 0;
+			unsigned long nr_running = 0;
+			unsigned long capacity;
+			int i;
+
+			for_each_cpu(i, sched_domain_span(tmp)) {
+				power += power_of(i);
+				nr_running += cpu_rq(i)->cfs.nr_running;
+			}
+
+			capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
+
+			if (nr_running/2 < capacity)
+				break;
+		}
 
 		switch (flag) {
 		case SD_BALANCE_WAKE:

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

* [tip:sched/core] sched: for_each_domain() vs RCU
       [not found]             ` <new-submission>
                                 ` (369 preceding siblings ...)
  2009-09-16 10:21               ` [tip:sched/core] sched: Weaken SD_POWERSAVINGS_BALANCE tip-bot for Peter Zijlstra
@ 2009-09-16 10:21               ` tip-bot for Peter Zijlstra
  2009-09-16 10:21               ` [tip:sched/core] sched: Fix task affinity for select_task_rq_fair tip-bot for Peter Zijlstra
                                 ` (335 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  83f54960c11a14942ab00b54c51e91906b9d8235
Gitweb:     http://git.kernel.org/tip/83f54960c11a14942ab00b54c51e91906b9d8235
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 10 Sep 2009 18:18:47 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:06 +0200

sched: for_each_domain() vs RCU

for_each_domain() uses RCU to serialize the sched_domains, except
it doesn't actually use rcu_read_lock() and instead relies on
disabling preemption -> FAIL.

XXX: audit other sched_domain code.

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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index eaa0001..43dc6d1 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1331,6 +1331,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 		new_cpu = prev_cpu;
 	}
 
+	rcu_read_lock();
 	for_each_domain(cpu, tmp) {
 		/*
 		 * If power savings logic is enabled for a domain, see if we
@@ -1369,8 +1370,10 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 		if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
 		    cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
 
-			if (wake_affine(tmp, p, sync))
-				return cpu;
+			if (wake_affine(tmp, p, sync)) {
+				new_cpu = cpu;
+				goto out;
+			}
 
 			want_affine = 0;
 		}
@@ -1416,6 +1419,8 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 		/* while loop will break here if sd == NULL */
 	}
 
+out:
+	rcu_read_unlock();
 	return new_cpu;
 }
 #endif /* CONFIG_SMP */

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

* [tip:sched/core] sched: Fix task affinity for select_task_rq_fair
       [not found]             ` <new-submission>
                                 ` (370 preceding siblings ...)
  2009-09-16 10:21               ` [tip:sched/core] sched: for_each_domain() vs RCU tip-bot for Peter Zijlstra
@ 2009-09-16 10:21               ` tip-bot for Peter Zijlstra
  2009-09-16 10:21               ` [tip:sched/core] sched: Tweak wake_idx tip-bot for Peter Zijlstra
                                 ` (334 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  d7c33c4930f569caf6b2ece597432853c4151a45
Gitweb:     http://git.kernel.org/tip/d7c33c4930f569caf6b2ece597432853c4151a45
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Sep 2009 12:45:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:07 +0200

sched: Fix task affinity for select_task_rq_fair

While merging select_task_rq_fair() and sched_balance_self() I made
a mistake that leads to testing the wrong task affinty.

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 |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 43dc6d1..8b3eddb 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1318,7 +1318,6 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  */
 static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 {
-	struct task_struct *t = current;
 	struct sched_domain *tmp, *sd = NULL;
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
@@ -1393,13 +1392,13 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 			continue;
 		}
 
-		group = find_idlest_group(sd, t, cpu);
+		group = find_idlest_group(sd, p, cpu);
 		if (!group) {
 			sd = sd->child;
 			continue;
 		}
 
-		new_cpu = find_idlest_cpu(group, t, cpu);
+		new_cpu = find_idlest_cpu(group, p, cpu);
 		if (new_cpu == -1 || new_cpu == cpu) {
 			/* Now try balancing at a lower domain level of cpu */
 			sd = sd->child;

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

* [tip:sched/core] sched: Tweak wake_idx
       [not found]             ` <new-submission>
                                 ` (371 preceding siblings ...)
  2009-09-16 10:21               ` [tip:sched/core] sched: Fix task affinity for select_task_rq_fair tip-bot for Peter Zijlstra
@ 2009-09-16 10:21               ` tip-bot for Peter Zijlstra
  2009-09-16 10:21               ` [tip:sched/core] sched: Fix some domain tunings tip-bot for Peter Zijlstra
                                 ` (333 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  78e7ed53c9f42f04f9401ada6f7047db60781676
Gitweb:     http://git.kernel.org/tip/78e7ed53c9f42f04f9401ada6f7047db60781676
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 3 Sep 2009 13:16:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:07 +0200

sched: Tweak wake_idx

When merging select_task_rq_fair() and sched_balance_self() we lost
the use of wake_idx, restore that and set them to 0 to make wake
balancing more aggressive.

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


---
 arch/ia64/include/asm/topology.h     |    5 +++--
 arch/powerpc/include/asm/topology.h  |    3 ++-
 arch/sh/include/asm/topology.h       |    2 +-
 arch/sparc/include/asm/topology_64.h |    2 +-
 arch/x86/include/asm/topology.h      |    2 +-
 include/linux/topology.h             |    4 ++--
 kernel/sched_fair.c                  |   21 ++++++++++++++++++---
 7 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index cf6053b..47f3c51 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -62,11 +62,12 @@ void build_cpu_to_node_map(void);
 	.busy_idx		= 2,			\
 	.idle_idx		= 1,			\
 	.newidle_idx		= 2,			\
-	.wake_idx		= 1,			\
+	.wake_idx		= 0,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_FORK	\
 				| SD_BALANCE_WAKE	\
 				| SD_WAKE_AFFINE,	\
 	.last_balance		= jiffies,		\
@@ -87,7 +88,7 @@ void build_cpu_to_node_map(void);
 	.busy_idx		= 3,			\
 	.idle_idx		= 2,			\
 	.newidle_idx		= 2,			\
-	.wake_idx		= 1,			\
+	.wake_idx		= 0,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index c634331..a6b220a 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -58,9 +58,10 @@ static inline int pcibus_to_node(struct pci_bus *bus)
 	.busy_idx		= 3,			\
 	.idle_idx		= 1,			\
 	.newidle_idx		= 2,			\
-	.wake_idx		= 1,			\
+	.wake_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_FORK	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_WAKE	\
 				| SD_SERIALIZE,		\
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index dc1531e..9054e5c 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -16,7 +16,7 @@
 	.busy_idx		= 3,			\
 	.idle_idx		= 2,			\
 	.newidle_idx		= 2,			\
-	.wake_idx		= 1,			\
+	.wake_idx		= 0,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 1d091ab..bc3a093 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -52,7 +52,7 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 	.busy_idx		= 3,			\
 	.idle_idx		= 2,			\
 	.newidle_idx		= 0, 			\
-	.wake_idx		= 1,			\
+	.wake_idx		= 0,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 966d58d..4b1b335 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -138,7 +138,7 @@ extern unsigned long node_remap_size[];
 	.busy_idx		= 3,					\
 	.idle_idx		= SD_IDLE_IDX,				\
 	.newidle_idx		= SD_NEWIDLE_IDX,			\
-	.wake_idx		= 1,					\
+	.wake_idx		= 0,					\
 	.forkexec_idx		= SD_FORKEXEC_IDX,			\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 6a8cd15..fef5704 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -120,7 +120,7 @@ int arch_update_cpu_topology(void);
 	.imbalance_pct		= 125,					\
 	.cache_nice_tries	= 1,					\
 	.busy_idx		= 2,					\
-	.wake_idx		= 1,					\
+	.wake_idx		= 0,					\
 	.forkexec_idx		= 1,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
@@ -152,7 +152,7 @@ int arch_update_cpu_topology(void);
 	.busy_idx		= 2,					\
 	.idle_idx		= 1,					\
 	.newidle_idx		= 2,					\
-	.wake_idx		= 1,					\
+	.wake_idx		= 0,					\
 	.forkexec_idx		= 1,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 8b3eddb..1959356 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1232,12 +1232,27 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
  * domain.
  */
 static struct sched_group *
-find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
+find_idlest_group(struct sched_domain *sd, struct task_struct *p,
+		  int this_cpu, int flag)
 {
 	struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
 	unsigned long min_load = ULONG_MAX, this_load = 0;
-	int load_idx = sd->forkexec_idx;
 	int imbalance = 100 + (sd->imbalance_pct-100)/2;
+	int load_idx = 0;
+
+	switch (flag) {
+	case SD_BALANCE_FORK:
+	case SD_BALANCE_EXEC:
+		load_idx = sd->forkexec_idx;
+		break;
+
+	case SD_BALANCE_WAKE:
+		load_idx = sd->wake_idx;
+		break;
+
+	default:
+		break;
+	}
 
 	do {
 		unsigned long load, avg_load;
@@ -1392,7 +1407,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 			continue;
 		}
 
-		group = find_idlest_group(sd, p, cpu);
+		group = find_idlest_group(sd, p, cpu, flag);
 		if (!group) {
 			sd = sd->child;
 			continue;

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

* [tip:sched/core] sched: Fix some domain tunings
       [not found]             ` <new-submission>
                                 ` (372 preceding siblings ...)
  2009-09-16 10:21               ` [tip:sched/core] sched: Tweak wake_idx tip-bot for Peter Zijlstra
@ 2009-09-16 10:21               ` tip-bot for Peter Zijlstra
  2009-09-16 10:22               ` [tip:sched/core] sched: Reduce forkexec_idx tip-bot for Peter Zijlstra
                                 ` (332 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6bd7821f905a8d6c471f0d6675f5cb7ea448d791
Gitweb:     http://git.kernel.org/tip/6bd7821f905a8d6c471f0d6675f5cb7ea448d791
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Sep 2009 18:42:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:01:08 +0200

sched: Fix some domain tunings

CPU level should have WAKE_AFFINE, whereas ALLNODES is dubious.

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


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

diff --git a/include/linux/topology.h b/include/linux/topology.h
index fef5704..c87edcd 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -160,7 +160,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 1*SD_BALANCE_WAKE			\
-				| 0*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_AFFINE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
@@ -186,7 +186,7 @@ int arch_update_cpu_topology(void);
 				| 0*SD_BALANCE_EXEC			\
 				| 0*SD_BALANCE_FORK			\
 				| 0*SD_BALANCE_WAKE			\
-				| 1*SD_WAKE_AFFINE			\
+				| 0*SD_WAKE_AFFINE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\

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

* [tip:sched/core] sched: Reduce forkexec_idx
       [not found]             ` <new-submission>
                                 ` (373 preceding siblings ...)
  2009-09-16 10:21               ` [tip:sched/core] sched: Fix some domain tunings tip-bot for Peter Zijlstra
@ 2009-09-16 10:22               ` tip-bot for Peter Zijlstra
  2009-09-16 10:22               ` [tip:sched/core] sched: Provide arch_scale_freq_power tip-bot for Peter Zijlstra
                                 ` (331 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:22 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  b8a543ea5a5896830a9969bacfd047f9d15940b2
Gitweb:     http://git.kernel.org/tip/b8a543ea5a5896830a9969bacfd047f9d15940b2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Sep 2009 15:22:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:23 +0200

sched: Reduce forkexec_idx

If we're looking to place a new task, we might as well find the
idlest position _now_, not 1 tick ago.

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


---
 arch/ia64/include/asm/topology.h     |    4 ++--
 arch/sh/include/asm/topology.h       |    2 +-
 arch/sparc/include/asm/topology_64.h |    2 +-
 arch/x86/include/asm/topology.h      |    4 +---
 include/linux/topology.h             |    4 ++--
 5 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 42f1673..569b9da 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -63,7 +63,7 @@ void build_cpu_to_node_map(void);
 	.idle_idx		= 1,			\
 	.newidle_idx		= 0,			\
 	.wake_idx		= 0,			\
-	.forkexec_idx		= 1,			\
+	.forkexec_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
@@ -89,7 +89,7 @@ void build_cpu_to_node_map(void);
 	.idle_idx		= 2,			\
 	.newidle_idx		= 0,			\
 	.wake_idx		= 0,			\
-	.forkexec_idx		= 1,			\
+	.forkexec_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index c843677..a8cc564 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -17,7 +17,7 @@
 	.idle_idx		= 2,			\
 	.newidle_idx		= 0,			\
 	.wake_idx		= 0,			\
-	.forkexec_idx		= 1,			\
+	.forkexec_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index bc3a093..10b979d 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -53,7 +53,7 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 	.idle_idx		= 2,			\
 	.newidle_idx		= 0, 			\
 	.wake_idx		= 0,			\
-	.forkexec_idx		= 1,			\
+	.forkexec_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 7fafd1b..589f123 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -116,13 +116,11 @@ extern unsigned long node_remap_size[];
 
 # define SD_CACHE_NICE_TRIES	1
 # define SD_IDLE_IDX		1
-# define SD_FORKEXEC_IDX	0
 
 #else
 
 # define SD_CACHE_NICE_TRIES	2
 # define SD_IDLE_IDX		2
-# define SD_FORKEXEC_IDX	1
 
 #endif
 
@@ -137,7 +135,7 @@ extern unsigned long node_remap_size[];
 	.idle_idx		= SD_IDLE_IDX,				\
 	.newidle_idx		= 0,					\
 	.wake_idx		= 0,					\
-	.forkexec_idx		= SD_FORKEXEC_IDX,			\
+	.forkexec_idx		= 0,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
 				| 1*SD_BALANCE_NEWIDLE			\
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 4298745..936ab2b 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -121,7 +121,7 @@ int arch_update_cpu_topology(void);
 	.cache_nice_tries	= 1,					\
 	.busy_idx		= 2,					\
 	.wake_idx		= 0,					\
-	.forkexec_idx		= 1,					\
+	.forkexec_idx		= 0,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
 				| 1*SD_BALANCE_NEWIDLE			\
@@ -153,7 +153,7 @@ int arch_update_cpu_topology(void);
 	.idle_idx		= 1,					\
 	.newidle_idx		= 0,					\
 	.wake_idx		= 0,					\
-	.forkexec_idx		= 1,					\
+	.forkexec_idx		= 0,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
 				| 1*SD_BALANCE_NEWIDLE			\

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

* [tip:sched/core] sched: Provide arch_scale_freq_power
       [not found]             ` <new-submission>
                                 ` (374 preceding siblings ...)
  2009-09-16 10:22               ` [tip:sched/core] sched: Reduce forkexec_idx tip-bot for Peter Zijlstra
@ 2009-09-16 10:22               ` tip-bot for Peter Zijlstra
  2009-09-16 10:22               ` [tip:sched/core] x86: Move APERF/MPERF into a X86_FEATURE tip-bot for Peter Zijlstra
                                 ` (330 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:22 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  d6a59aa3a2b1ca8411884c833a313b33b5f76e20
Gitweb:     http://git.kernel.org/tip/d6a59aa3a2b1ca8411884c833a313b33b5f76e20
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 2 Sep 2009 13:28:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:24 +0200

sched: Provide arch_scale_freq_power

Provide an ach specific hook for cpufreq based scaling of
cpu_power.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
[ego@in.ibm.com: spotting bugs]
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/kernel/sched.c b/kernel/sched.c
index f0ccb8b..c210321 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3552,7 +3552,18 @@ static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
 }
 #endif /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
 
-unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
+
+unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+	return SCHED_LOAD_SCALE;
+}
+
+unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+	return default_scale_freq_power(sd, cpu);
+}
+
+unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
 {
 	unsigned long weight = cpumask_weight(sched_domain_span(sd));
 	unsigned long smt_gain = sd->smt_gain;
@@ -3562,6 +3573,11 @@ unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
 	return smt_gain;
 }
 
+unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+	return default_scale_smt_power(sd, cpu);
+}
+
 unsigned long scale_rt_power(int cpu)
 {
 	struct rq *rq = cpu_rq(cpu);
@@ -3586,7 +3602,8 @@ static void update_cpu_power(struct sched_domain *sd, int cpu)
 	unsigned long power = SCHED_LOAD_SCALE;
 	struct sched_group *sdg = sd->groups;
 
-	/* here we could scale based on cpufreq */
+	power *= arch_scale_freq_power(sd, cpu);
+	power >>= SCHED_LOAD_SHIFT;
 
 	if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
 		power *= arch_scale_smt_power(sd, cpu);

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

* [tip:sched/core] x86: Move APERF/MPERF into a X86_FEATURE
       [not found]             ` <new-submission>
                                 ` (375 preceding siblings ...)
  2009-09-16 10:22               ` [tip:sched/core] sched: Provide arch_scale_freq_power tip-bot for Peter Zijlstra
@ 2009-09-16 10:22               ` tip-bot for Peter Zijlstra
  2009-09-16 10:23               ` [tip:sched/core] x86: Add generic aperf/mperf code tip-bot for Peter Zijlstra
                                 ` (329 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, yanmin_zhang,
	venkatesh.pallipadi, davej, yhlu.kernel, tglx, mingo, len.brown

Commit-ID:  a8303aaf2b2f74714db6d204ab4fcb810942664e
Gitweb:     http://git.kernel.org/tip/a8303aaf2b2f74714db6d204ab4fcb810942664e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 2 Sep 2009 10:56:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:25 +0200

x86: Move APERF/MPERF into a X86_FEATURE

Move the APERFMPERF capacility into a X86_FEATURE flag so that it
can be used outside of the acpi cpufreq driver.

Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: cpufreq@vger.kernel.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/include/asm/cpufeature.h          |    1 +
 arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c |    9 ++-------
 arch/x86/kernel/cpu/intel.c                |    6 ++++++
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 847fee6..9cfc88b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -96,6 +96,7 @@
 #define X86_FEATURE_CLFLUSH_MONITOR (3*32+25) /* "" clflush reqd with monitor */
 #define X86_FEATURE_EXTD_APICID	(3*32+26) /* has extended APICID (8 bits) */
 #define X86_FEATURE_AMD_DCM     (3*32+27) /* multi-node processor */
+#define X86_FEATURE_APERFMPERF	(3*32+28) /* APERFMPERF */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* "pni" SSE-3 */
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index ae9b503..509e6a7 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -60,7 +60,6 @@ enum {
 };
 
 #define INTEL_MSR_RANGE		(0xffff)
-#define CPUID_6_ECX_APERFMPERF_CAPABILITY	(0x1)
 
 struct acpi_cpufreq_data {
 	struct acpi_processor_performance *acpi_data;
@@ -731,12 +730,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	acpi_processor_notify_smm(THIS_MODULE);
 
 	/* Check for APERF/MPERF support in hardware */
-	if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) {
-		unsigned int ecx;
-		ecx = cpuid_ecx(6);
-		if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY)
-			acpi_cpufreq_driver.getavg = get_measured_perf;
-	}
+	if (cpu_has(c, X86_FEATURE_APERFMPERF))
+		acpi_cpufreq_driver.getavg = get_measured_perf;
 
 	dprintk("CPU%u - ACPI performance management activated.\n", cpu);
 	for (i = 0; i < perf->state_count; i++)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 80a722a..40e1835 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -350,6 +350,12 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 			set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
 	}
 
+	if (c->cpuid_level > 6) {
+		unsigned ecx = cpuid_ecx(6);
+		if (ecx & 0x01)
+			set_cpu_cap(c, X86_FEATURE_APERFMPERF);
+	}
+
 	if (cpu_has_xmm2)
 		set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
 	if (cpu_has_ds) {

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

* [tip:sched/core] x86: Add generic aperf/mperf code
       [not found]             ` <new-submission>
                                 ` (376 preceding siblings ...)
  2009-09-16 10:22               ` [tip:sched/core] x86: Move APERF/MPERF into a X86_FEATURE tip-bot for Peter Zijlstra
@ 2009-09-16 10:23               ` tip-bot for Peter Zijlstra
  2009-09-16 10:23               ` [tip:sched/core] x86: sched: Provide arch implementations using aperf/mperf tip-bot for Peter Zijlstra
                                 ` (328 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, yanmin_zhang,
	venkatesh.pallipadi, davej, yhlu.kernel, tglx, mingo, len.brown

Commit-ID:  5cbc19a983141729d716be17197028434127b376
Gitweb:     http://git.kernel.org/tip/5cbc19a983141729d716be17197028434127b376
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 2 Sep 2009 11:49:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:26 +0200

x86: Add generic aperf/mperf code

Move some of the aperf/mperf code out from the cpufreq driver
thingy so that other people can enjoy it too.

Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: cpufreq@vger.kernel.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/include/asm/processor.h           |   30 +++++++++++
 arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c |   79 +++------------------------
 2 files changed, 39 insertions(+), 70 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index e08ea04..4ae2ccf 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -27,6 +27,7 @@ struct mm_struct;
 #include <linux/cpumask.h>
 #include <linux/cache.h>
 #include <linux/threads.h>
+#include <linux/math64.h>
 #include <linux/init.h>
 
 /*
@@ -1020,4 +1021,33 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 extern int get_tsc_mode(unsigned long adr);
 extern int set_tsc_mode(unsigned int val);
 
+struct aperfmperf {
+	u64 aperf, mperf;
+};
+
+static inline void get_aperfmperf(struct aperfmperf *am)
+{
+	WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_APERFMPERF));
+
+	rdmsrl(MSR_IA32_APERF, am->aperf);
+	rdmsrl(MSR_IA32_MPERF, am->mperf);
+}
+
+#define APERFMPERF_SHIFT 10
+
+static inline
+unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
+				    struct aperfmperf *new)
+{
+	u64 aperf = new->aperf - old->aperf;
+	u64 mperf = new->mperf - old->mperf;
+	unsigned long ratio = aperf;
+
+	mperf >>= APERFMPERF_SHIFT;
+	if (mperf)
+		ratio = div64_u64(aperf, mperf);
+
+	return ratio;
+}
+
 #endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 509e6a7..4109679 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -70,11 +70,7 @@ struct acpi_cpufreq_data {
 
 static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data);
 
-struct acpi_msr_data {
-	u64 saved_aperf, saved_mperf;
-};
-
-static DEFINE_PER_CPU(struct acpi_msr_data, msr_data);
+static DEFINE_PER_CPU(struct aperfmperf, old_perf);
 
 DEFINE_TRACE(power_mark);
 
@@ -243,23 +239,12 @@ static u32 get_cur_val(const struct cpumask *mask)
 	return cmd.val;
 }
 
-struct perf_pair {
-	union {
-		struct {
-			u32 lo;
-			u32 hi;
-		} split;
-		u64 whole;
-	} aperf, mperf;
-};
-
 /* Called via smp_call_function_single(), on the target CPU */
 static void read_measured_perf_ctrs(void *_cur)
 {
-	struct perf_pair *cur = _cur;
+	struct aperfmperf *am = _cur;
 
-	rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi);
-	rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi);
+	get_aperfmperf(am);
 }
 
 /*
@@ -278,63 +263,17 @@ static void read_measured_perf_ctrs(void *_cur)
 static unsigned int get_measured_perf(struct cpufreq_policy *policy,
 				      unsigned int cpu)
 {
-	struct perf_pair readin, cur;
-	unsigned int perf_percent;
+	struct aperfmperf perf;
+	unsigned long ratio;
 	unsigned int retval;
 
-	if (smp_call_function_single(cpu, read_measured_perf_ctrs, &readin, 1))
+	if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1))
 		return 0;
 
-	cur.aperf.whole = readin.aperf.whole -
-				per_cpu(msr_data, cpu).saved_aperf;
-	cur.mperf.whole = readin.mperf.whole -
-				per_cpu(msr_data, cpu).saved_mperf;
-	per_cpu(msr_data, cpu).saved_aperf = readin.aperf.whole;
-	per_cpu(msr_data, cpu).saved_mperf = readin.mperf.whole;
-
-#ifdef __i386__
-	/*
-	 * We dont want to do 64 bit divide with 32 bit kernel
-	 * Get an approximate value. Return failure in case we cannot get
-	 * an approximate value.
-	 */
-	if (unlikely(cur.aperf.split.hi || cur.mperf.split.hi)) {
-		int shift_count;
-		u32 h;
-
-		h = max_t(u32, cur.aperf.split.hi, cur.mperf.split.hi);
-		shift_count = fls(h);
-
-		cur.aperf.whole >>= shift_count;
-		cur.mperf.whole >>= shift_count;
-	}
-
-	if (((unsigned long)(-1) / 100) < cur.aperf.split.lo) {
-		int shift_count = 7;
-		cur.aperf.split.lo >>= shift_count;
-		cur.mperf.split.lo >>= shift_count;
-	}
-
-	if (cur.aperf.split.lo && cur.mperf.split.lo)
-		perf_percent = (cur.aperf.split.lo * 100) / cur.mperf.split.lo;
-	else
-		perf_percent = 0;
-
-#else
-	if (unlikely(((unsigned long)(-1) / 100) < cur.aperf.whole)) {
-		int shift_count = 7;
-		cur.aperf.whole >>= shift_count;
-		cur.mperf.whole >>= shift_count;
-	}
-
-	if (cur.aperf.whole && cur.mperf.whole)
-		perf_percent = (cur.aperf.whole * 100) / cur.mperf.whole;
-	else
-		perf_percent = 0;
-
-#endif
+	ratio = calc_aperfmperf_ratio(&per_cpu(old_perf, cpu), &perf);
+	per_cpu(old_perf, cpu) = perf;
 
-	retval = (policy->cpuinfo.max_freq * perf_percent) / 100;
+	retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT;
 
 	return retval;
 }

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

* [tip:sched/core] x86: sched: Provide arch implementations using aperf/mperf
       [not found]             ` <new-submission>
                                 ` (377 preceding siblings ...)
  2009-09-16 10:23               ` [tip:sched/core] x86: Add generic aperf/mperf code tip-bot for Peter Zijlstra
@ 2009-09-16 10:23               ` tip-bot for Peter Zijlstra
  2009-09-16 10:23               ` [tip:sched/core] sched: Feature to disable APERF/MPERF cpu_power tip-bot for Peter Zijlstra
                                 ` (327 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:23 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  47fe38fcff0517e67d395c039d2e26d2de688a60
Gitweb:     http://git.kernel.org/tip/47fe38fcff0517e67d395c039d2e26d2de688a60
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 2 Sep 2009 13:49:18 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:27 +0200

x86: sched: Provide arch implementations using aperf/mperf

APERF/MPERF support for cpu_power.

APERF/MPERF is arch defined to be a relative scale of work capacity
per logical cpu, this is assumed to include SMT and Turbo mode.

APERF/MPERF are specified to both reset to 0 when either counter
wraps, which is highly inconvenient, since that'll give a blimp
when that happens. The manual specifies writing 0 to the counters
after each read, but that's 1) too expensive, and 2) destroys the
possibility of sharing these counters with other users, so we live
with the blimp - the other existing user does too.

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/Makefile |    2 +-
 arch/x86/kernel/cpu/sched.c  |   55 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/sched.h        |    4 +++
 3 files changed, 60 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index c1f253d..8dd3063 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -13,7 +13,7 @@ CFLAGS_common.o		:= $(nostackp)
 
 obj-y			:= intel_cacheinfo.o addon_cpuid_features.o
 obj-y			+= proc.o capflags.o powerflags.o common.o
-obj-y			+= vmware.o hypervisor.o
+obj-y			+= vmware.o hypervisor.o sched.o
 
 obj-$(CONFIG_X86_32)	+= bugs.o cmpxchg.o
 obj-$(CONFIG_X86_64)	+= bugs_64.o
diff --git a/arch/x86/kernel/cpu/sched.c b/arch/x86/kernel/cpu/sched.c
new file mode 100644
index 0000000..6c00a8f
--- /dev/null
+++ b/arch/x86/kernel/cpu/sched.c
@@ -0,0 +1,55 @@
+#include <linux/sched.h>
+#include <linux/math64.h>
+#include <linux/percpu.h>
+#include <linux/irqflags.h>
+
+#include <asm/cpufeature.h>
+#include <asm/processor.h>
+
+#ifdef CONFIG_SMP
+
+static DEFINE_PER_CPU(struct aperfmperf, old_perf);
+
+static unsigned long scale_aperfmperf(void)
+{
+	struct aperfmperf val, *old = &__get_cpu_var(old_perf);
+	unsigned long ratio, flags;
+
+	local_irq_save(flags);
+	get_aperfmperf(&val);
+	local_irq_restore(flags);
+
+	ratio = calc_aperfmperf_ratio(old, &val);
+	*old = val;
+
+	return ratio;
+}
+
+unsigned long arch_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+	/*
+	 * do aperf/mperf on the cpu level because it includes things
+	 * like turbo mode, which are relevant to full cores.
+	 */
+	if (boot_cpu_has(X86_FEATURE_APERFMPERF))
+		return scale_aperfmperf();
+
+	/*
+	 * maybe have something cpufreq here
+	 */
+
+	return default_scale_freq_power(sd, cpu);
+}
+
+unsigned long arch_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+	/*
+	 * aperf/mperf already includes the smt gain
+	 */
+	if (boot_cpu_has(X86_FEATURE_APERFMPERF))
+		return SCHED_LOAD_SCALE;
+
+	return default_scale_smt_power(sd, cpu);
+}
+
+#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c30bf3d..fc4c0f9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -992,6 +992,9 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
 	return 0;
 }
 
+unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
+unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
+
 #else /* CONFIG_SMP */
 
 struct sched_domain_attr;
@@ -1003,6 +1006,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
 }
 #endif	/* !CONFIG_SMP */
 
+
 struct io_context;			/* See blkdev.h */
 
 

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

* [tip:sched/core] sched: Feature to disable APERF/MPERF cpu_power
       [not found]             ` <new-submission>
                                 ` (378 preceding siblings ...)
  2009-09-16 10:23               ` [tip:sched/core] x86: sched: Provide arch implementations using aperf/mperf tip-bot for Peter Zijlstra
@ 2009-09-16 10:23               ` tip-bot for Peter Zijlstra
  2009-09-16 10:23               ` [tip:sched/core] sched: Rename select_task_rq() argument tip-bot for Peter Zijlstra
                                 ` (326 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:23 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8e6598af3f35629c37249a610cf13e73f70db279
Gitweb:     http://git.kernel.org/tip/8e6598af3f35629c37249a610cf13e73f70db279
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 3 Sep 2009 13:20:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:28 +0200

sched: Feature to disable APERF/MPERF cpu_power

I suspect a feed-back loop between cpuidle and the aperf/mperf
cpu_power bits, where when we have idle C-states lower the ratio,
which leads to lower cpu_power and then less load, which generates
more idle time, etc..

Put in a knob to disable 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.c          |   12 ++++++++++--
 kernel/sched_features.h |    5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index c210321..e8e603b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3602,11 +3602,19 @@ static void update_cpu_power(struct sched_domain *sd, int cpu)
 	unsigned long power = SCHED_LOAD_SCALE;
 	struct sched_group *sdg = sd->groups;
 
-	power *= arch_scale_freq_power(sd, cpu);
+	if (sched_feat(ARCH_POWER))
+		power *= arch_scale_freq_power(sd, cpu);
+	else
+		power *= default_scale_freq_power(sd, cpu);
+
 	power >>= SCHED_LOAD_SHIFT;
 
 	if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
-		power *= arch_scale_smt_power(sd, cpu);
+		if (sched_feat(ARCH_POWER))
+			power *= arch_scale_smt_power(sd, cpu);
+		else
+			power *= default_scale_smt_power(sd, cpu);
+
 		power >>= SCHED_LOAD_SHIFT;
 	}
 
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index e98c2e8..294e10e 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -82,6 +82,11 @@ SCHED_FEAT(LAST_BUDDY, 1)
  */
 SCHED_FEAT(CACHE_HOT_BUDDY, 1)
 
+/*
+ * Use arch dependent cpu power functions
+ */
+SCHED_FEAT(ARCH_POWER, 0)
+
 SCHED_FEAT(HRTICK, 0)
 SCHED_FEAT(DOUBLE_TICK, 0)
 SCHED_FEAT(LB_BIAS, 1)

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

* [tip:sched/core] sched: Rename select_task_rq() argument
       [not found]             ` <new-submission>
                                 ` (379 preceding siblings ...)
  2009-09-16 10:23               ` [tip:sched/core] sched: Feature to disable APERF/MPERF cpu_power tip-bot for Peter Zijlstra
@ 2009-09-16 10:23               ` tip-bot for Peter Zijlstra
  2009-09-16 10:24               ` [tip:sched/core] sched: Rename sync arguments tip-bot for Peter Zijlstra
                                 ` (325 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:23 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  0763a660a84220cc3900fd32abdd7ad109e2278d
Gitweb:     http://git.kernel.org/tip/0763a660a84220cc3900fd32abdd7ad109e2278d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 14 Sep 2009 19:37:39 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:29 +0200

sched: Rename select_task_rq() argument

In order to be able to rename the sync argument, we need to rename
the current flag argument.

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


---
 include/linux/sched.h   |    2 +-
 kernel/sched_fair.c     |   14 +++++++-------
 kernel/sched_idletask.c |    2 +-
 kernel/sched_rt.c       |    4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index fc4c0f9..5c116f0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1037,7 +1037,7 @@ struct sched_class {
 	void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
-	int  (*select_task_rq)(struct task_struct *p, int flag, int sync);
+	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int sync);
 
 	unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
 			struct rq *busiest, unsigned long max_load_move,
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 1959356..b554e63 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1331,7 +1331,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  *
  * preempt must be disabled.
  */
-static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
+static int select_task_rq_fair(struct task_struct *p, int sd_flag, int sync)
 {
 	struct sched_domain *tmp, *sd = NULL;
 	int cpu = smp_processor_id();
@@ -1339,7 +1339,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 	int new_cpu = cpu;
 	int want_affine = 0;
 
-	if (flag & SD_BALANCE_WAKE) {
+	if (sd_flag & SD_BALANCE_WAKE) {
 		if (sched_feat(AFFINE_WAKEUPS))
 			want_affine = 1;
 		new_cpu = prev_cpu;
@@ -1368,7 +1368,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 				break;
 		}
 
-		switch (flag) {
+		switch (sd_flag) {
 		case SD_BALANCE_WAKE:
 			if (!sched_feat(LB_WAKEUP_UPDATE))
 				break;
@@ -1392,7 +1392,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 			want_affine = 0;
 		}
 
-		if (!(tmp->flags & flag))
+		if (!(tmp->flags & sd_flag))
 			continue;
 
 		sd = tmp;
@@ -1402,12 +1402,12 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 		struct sched_group *group;
 		int weight;
 
-		if (!(sd->flags & flag)) {
+		if (!(sd->flags & sd_flag)) {
 			sd = sd->child;
 			continue;
 		}
 
-		group = find_idlest_group(sd, p, cpu, flag);
+		group = find_idlest_group(sd, p, cpu, sd_flag);
 		if (!group) {
 			sd = sd->child;
 			continue;
@@ -1427,7 +1427,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
 		for_each_domain(cpu, tmp) {
 			if (weight <= cpumask_weight(sched_domain_span(tmp)))
 				break;
-			if (tmp->flags & flag)
+			if (tmp->flags & sd_flag)
 				sd = tmp;
 		}
 		/* while loop will break here if sd == NULL */
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 99b2f03..9ff7697 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -6,7 +6,7 @@
  */
 
 #ifdef CONFIG_SMP
-static int select_task_rq_idle(struct task_struct *p, int flag, int sync)
+static int select_task_rq_idle(struct task_struct *p, int sd_flag, int sync)
 {
 	return task_cpu(p); /* IDLE tasks as never migrated */
 }
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 4383808..97c53f3 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -938,11 +938,11 @@ static void yield_task_rt(struct rq *rq)
 #ifdef CONFIG_SMP
 static int find_lowest_rq(struct task_struct *task);
 
-static int select_task_rq_rt(struct task_struct *p, int flag, int sync)
+static int select_task_rq_rt(struct task_struct *p, int sd_flag, int sync)
 {
 	struct rq *rq = task_rq(p);
 
-	if (flag != SD_BALANCE_WAKE)
+	if (sd_flag != SD_BALANCE_WAKE)
 		return smp_processor_id();
 
 	/*

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

* [tip:sched/core] sched: Rename sync arguments
       [not found]             ` <new-submission>
                                 ` (380 preceding siblings ...)
  2009-09-16 10:23               ` [tip:sched/core] sched: Rename select_task_rq() argument tip-bot for Peter Zijlstra
@ 2009-09-16 10:24               ` tip-bot for Peter Zijlstra
  2009-09-16 10:24               ` [tip:sched/core] sched: Add WF_FORK tip-bot for Peter Zijlstra
                                 ` (324 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  7d47872146398dbede13223299fe1cb368ebc781
Gitweb:     http://git.kernel.org/tip/7d47872146398dbede13223299fe1cb368ebc781
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 14 Sep 2009 19:55:44 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:30 +0200

sched: Rename sync arguments

In order to extend the functions to have more than 1 flag (sync),
rename the argument to flags, and explicitly define a WF_ space for
individual flags.

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


---
 include/linux/sched.h   |    9 +++++++--
 include/linux/wait.h    |    4 ++--
 kernel/sched.c          |   30 ++++++++++++++++--------------
 kernel/sched_fair.c     |    6 ++++--
 kernel/sched_idletask.c |    4 ++--
 kernel/sched_rt.c       |    4 ++--
 6 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c116f0..3b07168 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1024,6 +1024,11 @@ struct uts_namespace;
 struct rq;
 struct sched_domain;
 
+/*
+ * wake flags
+ */
+#define WF_SYNC		0x01		/* waker goes to sleep after wakup */
+
 struct sched_class {
 	const struct sched_class *next;
 
@@ -1031,13 +1036,13 @@ struct sched_class {
 	void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
 	void (*yield_task) (struct rq *rq);
 
-	void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
+	void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
 
 	struct task_struct * (*pick_next_task) (struct rq *rq);
 	void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
-	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int sync);
+	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
 
 	unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
 			struct rq *busiest, unsigned long max_load_move,
diff --git a/include/linux/wait.h b/include/linux/wait.h
index cf3c2f5..a48e16b 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -26,8 +26,8 @@
 #include <asm/current.h>
 
 typedef struct __wait_queue wait_queue_t;
-typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int sync, void *key);
-int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
+typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
+int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
 
 struct __wait_queue {
 	unsigned int flags;
diff --git a/kernel/sched.c b/kernel/sched.c
index e8e603b..4da335c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -636,9 +636,10 @@ struct rq {
 
 static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 
-static inline void check_preempt_curr(struct rq *rq, struct task_struct *p, int sync)
+static inline
+void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
 {
-	rq->curr->sched_class->check_preempt_curr(rq, p, sync);
+	rq->curr->sched_class->check_preempt_curr(rq, p, flags);
 }
 
 static inline int cpu_of(struct rq *rq)
@@ -2318,14 +2319,15 @@ void task_oncpu_function_call(struct task_struct *p,
  *
  * returns failure only if the task is already active.
  */
-static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
+static int try_to_wake_up(struct task_struct *p, unsigned int state,
+			  int wake_flags)
 {
 	int cpu, orig_cpu, this_cpu, success = 0;
 	unsigned long flags;
 	struct rq *rq;
 
 	if (!sched_feat(SYNC_WAKEUPS))
-		sync = 0;
+		wake_flags &= ~WF_SYNC;
 
 	this_cpu = get_cpu();
 
@@ -2352,7 +2354,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 
-	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, sync);
+	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
 	if (cpu != orig_cpu)
 		set_task_cpu(p, cpu);
 
@@ -2378,7 +2380,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 out_activate:
 #endif /* CONFIG_SMP */
 	schedstat_inc(p, se.nr_wakeups);
-	if (sync)
+	if (wake_flags & WF_SYNC)
 		schedstat_inc(p, se.nr_wakeups_sync);
 	if (orig_cpu != cpu)
 		schedstat_inc(p, se.nr_wakeups_migrate);
@@ -2407,7 +2409,7 @@ out_activate:
 
 out_running:
 	trace_sched_wakeup(rq, p, success);
-	check_preempt_curr(rq, p, sync);
+	check_preempt_curr(rq, p, wake_flags);
 
 	p->state = TASK_RUNNING;
 #ifdef CONFIG_SMP
@@ -5562,10 +5564,10 @@ asmlinkage void __sched preempt_schedule_irq(void)
 
 #endif /* CONFIG_PREEMPT */
 
-int default_wake_function(wait_queue_t *curr, unsigned mode, int sync,
+int default_wake_function(wait_queue_t *curr, unsigned mode, int flags,
 			  void *key)
 {
-	return try_to_wake_up(curr->private, mode, sync);
+	return try_to_wake_up(curr->private, mode, flags);
 }
 EXPORT_SYMBOL(default_wake_function);
 
@@ -5579,14 +5581,14 @@ EXPORT_SYMBOL(default_wake_function);
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
  */
 static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
-			int nr_exclusive, int sync, void *key)
+			int nr_exclusive, int flags, void *key)
 {
 	wait_queue_t *curr, *next;
 
 	list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
 		unsigned flags = curr->flags;
 
-		if (curr->func(curr, mode, sync, key) &&
+		if (curr->func(curr, mode, flags, key) &&
 				(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
 			break;
 	}
@@ -5647,16 +5649,16 @@ void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode,
 			int nr_exclusive, void *key)
 {
 	unsigned long flags;
-	int sync = 1;
+	int wake_flags = WF_SYNC;
 
 	if (unlikely(!q))
 		return;
 
 	if (unlikely(!nr_exclusive))
-		sync = 0;
+		wake_flags = 0;
 
 	spin_lock_irqsave(&q->lock, flags);
-	__wake_up_common(q, mode, nr_exclusive, sync, key);
+	__wake_up_common(q, mode, nr_exclusive, wake_flags, key);
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 EXPORT_SYMBOL_GPL(__wake_up_sync_key);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index b554e63..007958e 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1331,13 +1331,14 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  *
  * preempt must be disabled.
  */
-static int select_task_rq_fair(struct task_struct *p, int sd_flag, int sync)
+static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 {
 	struct sched_domain *tmp, *sd = NULL;
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
 	int new_cpu = cpu;
 	int want_affine = 0;
+	int sync = flags & WF_SYNC;
 
 	if (sd_flag & SD_BALANCE_WAKE) {
 		if (sched_feat(AFFINE_WAKEUPS))
@@ -1548,11 +1549,12 @@ static void set_next_buddy(struct sched_entity *se)
 /*
  * Preempt the current task with a newly woken task if needed:
  */
-static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
+static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct task_struct *curr = rq->curr;
 	struct sched_entity *se = &curr->se, *pse = &p->se;
 	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
+	int sync = flags & WF_SYNC;
 
 	update_curr(cfs_rq);
 
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 9ff7697..a8b448a 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -6,7 +6,7 @@
  */
 
 #ifdef CONFIG_SMP
-static int select_task_rq_idle(struct task_struct *p, int sd_flag, int sync)
+static int select_task_rq_idle(struct task_struct *p, int sd_flag, int flags)
 {
 	return task_cpu(p); /* IDLE tasks as never migrated */
 }
@@ -14,7 +14,7 @@ static int select_task_rq_idle(struct task_struct *p, int sd_flag, int sync)
 /*
  * Idle tasks are unconditionally rescheduled:
  */
-static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int sync)
+static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int flags)
 {
 	resched_task(rq->idle);
 }
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 97c53f3..13de712 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -938,7 +938,7 @@ static void yield_task_rt(struct rq *rq)
 #ifdef CONFIG_SMP
 static int find_lowest_rq(struct task_struct *task);
 
-static int select_task_rq_rt(struct task_struct *p, int sd_flag, int sync)
+static int select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 {
 	struct rq *rq = task_rq(p);
 
@@ -1002,7 +1002,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 /*
  * Preempt the current task with a newly woken task if needed:
  */
-static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int sync)
+static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int flags)
 {
 	if (p->prio < rq->curr->prio) {
 		resched_task(rq->curr);

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

* [tip:sched/core] sched: Add WF_FORK
       [not found]             ` <new-submission>
                                 ` (381 preceding siblings ...)
  2009-09-16 10:24               ` [tip:sched/core] sched: Rename sync arguments tip-bot for Peter Zijlstra
@ 2009-09-16 10:24               ` tip-bot for Peter Zijlstra
  2009-09-16 10:24               ` [tip:sched/core] sched: Fix sync wakeups again tip-bot for Peter Zijlstra
                                 ` (323 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  a7558e01056f5191ff2ecff53b075dcb9e484188
Gitweb:     http://git.kernel.org/tip/a7558e01056f5191ff2ecff53b075dcb9e484188
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 14 Sep 2009 20:02:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 16:51:31 +0200

sched: Add WF_FORK

Avoid the cache buddies from biasing the time distribution away
from fork()ers. Normally the next buddy will be the preferred
scheduling target, but this makes fork()s prefer to run the new
child, whereas we prefer to run the parent, since that will
generate more work.

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


---
 include/linux/sched.h |    1 +
 kernel/sched.c        |    2 +-
 kernel/sched_fair.c   |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3b07168..ee1f889 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1028,6 +1028,7 @@ struct sched_domain;
  * wake flags
  */
 #define WF_SYNC		0x01		/* waker goes to sleep after wakup */
+#define WF_FORK		0x02		/* child wakeup after fork */
 
 struct sched_class {
 	const struct sched_class *next;
diff --git a/kernel/sched.c b/kernel/sched.c
index 4da335c..0d4c4fe 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2602,7 +2602,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
 		inc_nr_running(rq);
 	}
 	trace_sched_wakeup_new(rq, p, 1);
-	check_preempt_curr(rq, p, 0);
+	check_preempt_curr(rq, p, WF_FORK);
 #ifdef CONFIG_SMP
 	if (p->sched_class->task_wake_up)
 		p->sched_class->task_wake_up(rq, p);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 007958e..6766959 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1580,7 +1580,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int flags
 	 */
 	if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
 		set_last_buddy(se);
-	if (sched_feat(NEXT_BUDDY))
+	if (sched_feat(NEXT_BUDDY) && !(flags & WF_FORK))
 		set_next_buddy(pse);
 
 	/*

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

* [tip:sched/core] sched: Fix sync wakeups again
       [not found]             ` <new-submission>
                                 ` (382 preceding siblings ...)
  2009-09-16 10:24               ` [tip:sched/core] sched: Add WF_FORK tip-bot for Peter Zijlstra
@ 2009-09-16 10:24               ` tip-bot for Peter Zijlstra
  2009-09-16 10:24               ` [tip:sched/core] sched: Add a few SYNC hint knobs to play with tip-bot for Peter Zijlstra
                                 ` (322 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  63859d4fe4c97b737e7adbfe60acb1c2b2e668cb
Gitweb:     http://git.kernel.org/tip/63859d4fe4c97b737e7adbfe60acb1c2b2e668cb
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Sep 2009 19:14:42 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 19:47:22 +0200

sched: Fix sync wakeups again

The sync argument rename to introduce WF_* broke stuff by missing a
local alias for an argument in __wake_up_common, fix it by using
the more descriptive wake_flags name.

This restores WF_SYNC propagation, which fixes wake_affine()
behaviour, which fixes pipe-test.

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index 0d4c4fe..af04ede 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5564,10 +5564,10 @@ asmlinkage void __sched preempt_schedule_irq(void)
 
 #endif /* CONFIG_PREEMPT */
 
-int default_wake_function(wait_queue_t *curr, unsigned mode, int flags,
+int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags,
 			  void *key)
 {
-	return try_to_wake_up(curr->private, mode, flags);
+	return try_to_wake_up(curr->private, mode, wake_flags);
 }
 EXPORT_SYMBOL(default_wake_function);
 
@@ -5581,14 +5581,14 @@ EXPORT_SYMBOL(default_wake_function);
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
  */
 static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
-			int nr_exclusive, int flags, void *key)
+			int nr_exclusive, int wake_flags, void *key)
 {
 	wait_queue_t *curr, *next;
 
 	list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
 		unsigned flags = curr->flags;
 
-		if (curr->func(curr, mode, flags, key) &&
+		if (curr->func(curr, mode, wake_flags, key) &&
 				(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
 			break;
 	}

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

* [tip:sched/core] sched: Add a few SYNC hint knobs to play with
       [not found]             ` <new-submission>
                                 ` (383 preceding siblings ...)
  2009-09-16 10:24               ` [tip:sched/core] sched: Fix sync wakeups again tip-bot for Peter Zijlstra
@ 2009-09-16 10:24               ` tip-bot for Peter Zijlstra
  2009-09-16 10:24               ` [tip:sched/core] sched: Add SD_PREFER_LOCAL tip-bot for Peter Zijlstra
                                 ` (321 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e69b0f1b41c0e57bb1e29100b5810a5914efcb45
Gitweb:     http://git.kernel.org/tip/e69b0f1b41c0e57bb1e29100b5810a5914efcb45
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Sep 2009 19:38:52 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Sep 2009 19:47:23 +0200

sched: Add a few SYNC hint knobs to play with

Currently we use overlap to weaken the SYNC hint, but allow it to
set the hint as well.

 echo NO_SYNC_WAKEUP > /debug/sched_features
 echo SYNC_MORE > /debug/sched_features

preserves pipe-test behaviour without using the WF_SYNC hint.

Worth playing with on more workloads...

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     |   14 +++++++++++---
 kernel/sched_features.h |   10 ++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 6766959..280892e 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1165,9 +1165,17 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
 	load	  = source_load(prev_cpu, idx);
 	this_load = target_load(this_cpu, idx);
 
-	if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
-			p->se.avg_overlap > sysctl_sched_migration_cost))
-		sync = 0;
+	if (sync) {
+	       if (sched_feat(SYNC_LESS) &&
+		   (curr->se.avg_overlap > sysctl_sched_migration_cost ||
+		    p->se.avg_overlap > sysctl_sched_migration_cost))
+		       sync = 0;
+	} else {
+		if (sched_feat(SYNC_MORE) &&
+		    (curr->se.avg_overlap < sysctl_sched_migration_cost &&
+		     p->se.avg_overlap < sysctl_sched_migration_cost))
+			sync = 1;
+	}
 
 	/*
 	 * If sync wakeup then subtract the (maximum possible)
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 294e10e..70115c6 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -63,6 +63,16 @@ SCHED_FEAT(SYNC_WAKEUPS, 1)
 SCHED_FEAT(AFFINE_WAKEUPS, 1)
 
 /*
+ * Weaken SYNC hint based on overlap
+ */
+SCHED_FEAT(SYNC_LESS, 1)
+
+/*
+ * Add SYNC hint based on overlap
+ */
+SCHED_FEAT(SYNC_MORE, 0)
+
+/*
  * Prefer to schedule the task we woke last (assuming it failed
  * wakeup-preemption), since its likely going to consume data we
  * touched, increases cache locality.

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

* [tip:sched/core] sched: Add SD_PREFER_LOCAL
       [not found]             ` <new-submission>
                                 ` (384 preceding siblings ...)
  2009-09-16 10:24               ` [tip:sched/core] sched: Add a few SYNC hint knobs to play with tip-bot for Peter Zijlstra
@ 2009-09-16 10:24               ` tip-bot for Peter Zijlstra
  2009-09-16 10:25               ` [tip:sched/core] sched: Implement a gentler fair-sleepers feature tip-bot for Ingo Molnar
                                 ` (320 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  59abf02644c45f1591e1374ee7bb45dc757fcb88
Gitweb:     http://git.kernel.org/tip/59abf02644c45f1591e1374ee7bb45dc757fcb88
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 08:28:30 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 08:42:40 +0200

sched: Add SD_PREFER_LOCAL

And turn it on for NUMA and MC domains. This improves
locality in balancing decisions by keeping up to
capacity amount of tasks local before looking for idle
CPUs. (and twice the capacity if SD_POWERSAVINGS_BALANCE
is set.)

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


---
 include/linux/sched.h    |    2 +-
 include/linux/topology.h |    2 ++
 kernel/sched_fair.c      |    7 +++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index ee1f889..b4a39bb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -805,7 +805,7 @@ enum cpu_idle_type {
 #define SD_BALANCE_FORK		0x0008	/* Balance on fork, clone */
 #define SD_BALANCE_WAKE		0x0010  /* Balance on wakeup */
 #define SD_WAKE_AFFINE		0x0020	/* Wake task to waking CPU */
-
+#define SD_PREFER_LOCAL		0x0040  /* Prefer to keep tasks local to this domain */
 #define SD_SHARE_CPUPOWER	0x0080	/* Domain members share cpu power */
 #define SD_POWERSAVINGS_BALANCE	0x0100	/* Balance for power savings */
 #define SD_SHARE_PKG_RESOURCES	0x0200	/* Domain members share cpu pkg resources */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 936ab2b..a6614b0 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -129,6 +129,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_FORK			\
 				| 1*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
+				| 1*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 1*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
@@ -161,6 +162,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_FORK			\
 				| 1*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
+				| 1*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_SHARE_PKG_RESOURCES		\
 				| 0*SD_SERIALIZE			\
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 280892e..a37f311 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1360,7 +1360,7 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 		 * If power savings logic is enabled for a domain, see if we
 		 * are not overloaded, if so, don't balance wider.
 		 */
-		if (tmp->flags & SD_POWERSAVINGS_BALANCE) {
+		if (tmp->flags & (SD_POWERSAVINGS_BALANCE|SD_PREFER_LOCAL)) {
 			unsigned long power = 0;
 			unsigned long nr_running = 0;
 			unsigned long capacity;
@@ -1373,7 +1373,10 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 
 			capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
 
-			if (nr_running/2 < capacity)
+			if (tmp->flags & SD_POWERSAVINGS_BALANCE)
+				nr_running /= 2;
+
+			if (nr_running < capacity)
 				break;
 		}
 

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

* [tip:sched/core] sched: Implement a gentler fair-sleepers feature
       [not found]             ` <new-submission>
                                 ` (385 preceding siblings ...)
  2009-09-16 10:24               ` [tip:sched/core] sched: Add SD_PREFER_LOCAL tip-bot for Peter Zijlstra
@ 2009-09-16 10:25               ` tip-bot for Ingo Molnar
  2009-09-16 10:25               ` [tip:sched/core] sched: x86: Name old_perf in a unique way tip-bot for Peter Zijlstra
                                 ` (319 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  51e0304ce6e55a6e59658558916b4f74da085ff0
Gitweb:     http://git.kernel.org/tip/51e0304ce6e55a6e59658558916b4f74da085ff0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 08:54:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 09:05:20 +0200

sched: Implement a gentler fair-sleepers feature

Add back FAIR_SLEEPERS and GENTLE_FAIR_SLEEPERS.

FAIR_SLEEPERS is the old logic: credit sleepers with their sleep time.

GENTLE_FAIR_SLEEPERS dampens this a bit: 50% of their sleep time gets
credited.

The hope here is to still give the benefits of fair-sleepers logic
(quick wakeups, etc.) while not allow them to have 100% of their
sleep time as if they were running.

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


---
 kernel/sched_fair.c     |    9 ++++++++-
 kernel/sched_features.h |    9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index a37f311..acf16a8 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -711,7 +711,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 
 	if (!initial) {
 		/* sleeps upto a single latency don't count. */
-		if (sched_feat(NEW_FAIR_SLEEPERS)) {
+		if (sched_feat(FAIR_SLEEPERS)) {
 			unsigned long thresh = sysctl_sched_latency;
 
 			/*
@@ -725,6 +725,13 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 					 task_of(se)->policy != SCHED_IDLE))
 				thresh = calc_delta_fair(thresh, se);
 
+			/*
+			 * Halve their sleep time's effect, to allow
+			 * for a gentler effect of sleepers:
+			 */
+			if (sched_feat(GENTLE_FAIR_SLEEPERS))
+				thresh >>= 1;
+
 			vruntime -= thresh;
 		}
 	}
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 70115c6..fd37567 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -3,7 +3,14 @@
  * considers the task to be running during that period. This gives it
  * a service deficit on wakeup, allowing it to run sooner.
  */
-SCHED_FEAT(NEW_FAIR_SLEEPERS, 0)
+SCHED_FEAT(FAIR_SLEEPERS, 1)
+
+/*
+ * Only give sleepers 50% of their service deficit. This allows
+ * them to run sooner, but does not allow tons of sleepers to
+ * rip the spread apart.
+ */
+SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 1)
 
 /*
  * By not normalizing the sleep time, heavy tasks get an effective

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

* [tip:sched/core] sched: x86: Name old_perf in a unique way
       [not found]             ` <new-submission>
                                 ` (386 preceding siblings ...)
  2009-09-16 10:25               ` [tip:sched/core] sched: Implement a gentler fair-sleepers feature tip-bot for Ingo Molnar
@ 2009-09-16 10:25               ` tip-bot for Peter Zijlstra
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Account for lost events, increase default buffering tip-bot for Ingo Molnar
                                 ` (318 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 10:25 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx

Commit-ID:  7c423e98856df9b941223a7e7845b2502ad84b00
Gitweb:     http://git.kernel.org/tip/7c423e98856df9b941223a7e7845b2502ad84b00
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 09:38:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 11:21:07 +0200

sched: x86: Name old_perf in a unique way

Silly percpu bits don't respect static..

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>


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

diff --git a/arch/x86/kernel/cpu/sched.c b/arch/x86/kernel/cpu/sched.c
index 6c00a8f..a640ae5 100644
--- a/arch/x86/kernel/cpu/sched.c
+++ b/arch/x86/kernel/cpu/sched.c
@@ -8,11 +8,11 @@
 
 #ifdef CONFIG_SMP
 
-static DEFINE_PER_CPU(struct aperfmperf, old_perf);
+static DEFINE_PER_CPU(struct aperfmperf, old_perf_sched);
 
 static unsigned long scale_aperfmperf(void)
 {
-	struct aperfmperf val, *old = &__get_cpu_var(old_perf);
+	struct aperfmperf val, *old = &__get_cpu_var(old_perf_sched);
 	unsigned long ratio, flags;
 
 	local_irq_save(flags);

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

* [tip:perfcounters/core] perf sched: Account for lost events, increase default buffering
       [not found]             ` <new-submission>
                                 ` (387 preceding siblings ...)
  2009-09-16 10:25               ` [tip:sched/core] sched: x86: Name old_perf in a unique way tip-bot for Peter Zijlstra
@ 2009-09-16 10:25               ` tip-bot for Ingo Molnar
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Sanity check context switch events tip-bot for Ingo Molnar
                                 ` (317 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  dc02bf7178c8e2cb3d442ae19027b736d51c7dd5
Gitweb:     http://git.kernel.org/tip/dc02bf7178c8e2cb3d442ae19027b736d51c7dd5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 13:45:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 11:48:05 +0200

perf sched: Account for lost events, increase default buffering

Output such lost event and state machine weirdness stats:

   TOTAL:                |  14974.910 ms |    46384 |
  ---------------------------------------------------
   INFO: 8.865% lost events (19132 out of 215819, in 8 chunks)
   INFO: 0.198% state machine bugs (49 out of 24708) (due to lost events?)

And increase buffering to -m 1024 (4 MB) by default. Since we
use output multiplexing that kind of space is needed.

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/builtin-sched.c |   60 ++++++++++++++++++++++++++++++--------------
 tools/perf/util/event.h    |    2 +-
 2 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index adcb563..1f0f9be 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -117,7 +117,11 @@ static u64			run_avg;
 
 static unsigned long		replay_repeat = 10;
 static unsigned long		nr_timestamps;
-static unsigned long		unordered_timestamps;
+static unsigned long		nr_unordered_timestamps;
+static unsigned long		nr_state_machine_bugs;
+static unsigned long		nr_events;
+static unsigned long		nr_lost_chunks;
+static unsigned long		nr_lost_events;
 
 #define TASK_STATE_TO_CHAR_STR "RSDTtZX"
 
@@ -668,14 +672,14 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 
 	thread = threads__findnew(event->comm.pid, &threads, &last_match);
 
-	dump_printf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+	dump_printf("%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)) {
-		dump_printf("problem processing PERF_EVENT_COMM, skipping event.\n");
+		dump_printf("problem processing perf_event_comm, skipping event.\n");
 		return -1;
 	}
 	total_comm++;
@@ -1168,14 +1172,12 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 
 	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
 
-	if (atom->state != THREAD_SLEEPING) {
-		printf("boo2\n");
-		return;
-	}
+	if (atom->state != THREAD_SLEEPING)
+		nr_state_machine_bugs++;
 
 	nr_timestamps++;
 	if (atom->sched_out_time > timestamp) {
-		unordered_timestamps++;
+		nr_unordered_timestamps++;
 		return;
 	}
 
@@ -1214,7 +1216,7 @@ static void output_lat_thread(struct work_atoms *work_list)
 
 	avg = work_list->total_lat / work_list->nb_atoms;
 
-	printf("|%9.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms |\n",
+	printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms |\n",
 	      (double)work_list->total_runtime / 1e6,
 		 work_list->nb_atoms, (double)avg / 1e6,
 		 (double)work_list->max_lat / 1e6);
@@ -1359,9 +1361,9 @@ static void __cmd_lat(void)
 	read_events();
 	sort_lat();
 
-	printf("\n ---------------------------------------------------------------------------------------\n");
-	printf("  Task                  |  Runtime ms | Switches | Average delay ms | Maximum delay ms |\n");
-	printf(" ---------------------------------------------------------------------------------------\n");
+	printf("\n -----------------------------------------------------------------------------------------\n");
+	printf("  Task                  |   Runtime ms  | Switches | Average delay ms | Maximum delay ms |\n");
+	printf(" -----------------------------------------------------------------------------------------\n");
 
 	next = rb_first(&sorted_atom_root);
 
@@ -1373,18 +1375,32 @@ static void __cmd_lat(void)
 		next = rb_next(next);
 	}
 
-	printf(" ---------------------------------------------------------------------------------------\n");
-	printf("  TOTAL:                |%9.3f ms |%9Ld |",
+	printf(" -----------------------------------------------------------------------------------------\n");
+	printf("  TOTAL:                |%11.3f ms |%9Ld |\n",
 		(double)all_runtime/1e6, all_count);
 
-	if (unordered_timestamps && nr_timestamps) {
-		printf(" INFO: %.2f%% unordered events.\n",
-			(double)unordered_timestamps/(double)nr_timestamps*100.0);
+	printf(" ---------------------------------------------------\n");
+	if (nr_unordered_timestamps && nr_timestamps) {
+		printf("  INFO: %.3f%% unordered timestamps (%ld out of %ld)\n",
+			(double)nr_unordered_timestamps/(double)nr_timestamps*100.0,
+			nr_unordered_timestamps, nr_timestamps);
 	} else {
+	}
+	if (nr_lost_events && nr_events) {
+		printf("  INFO: %.3f%% lost events (%ld out of %ld, in %ld chunks)\n",
+			(double)nr_lost_events/(double)nr_events*100.0,
+			nr_lost_events, nr_events, nr_lost_chunks);
+	}
+	if (nr_state_machine_bugs && nr_timestamps) {
+		printf("  INFO: %.3f%% state machine bugs (%ld out of %ld)",
+			(double)nr_state_machine_bugs/(double)nr_timestamps*100.0,
+			nr_state_machine_bugs, nr_timestamps);
+		if (nr_lost_events)
+			printf(" (due to lost events?)");
 		printf("\n");
 	}
+	printf("\n");
 
-	printf(" -------------------------------------------------\n\n");
 }
 
 static struct trace_sched_handler *trace_handler;
@@ -1585,8 +1601,13 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
 {
 	trace_event(event);
 
+	nr_events++;
 	switch (event->header.type) {
-	case PERF_EVENT_MMAP ... PERF_EVENT_LOST:
+	case PERF_EVENT_MMAP:
+		return 0;
+	case PERF_EVENT_LOST:
+		nr_lost_chunks++;
+		nr_lost_events += event->lost.lost;
 		return 0;
 
 	case PERF_EVENT_COMM:
@@ -1768,6 +1789,7 @@ static const char *record_args[] = {
 	"-R",
 	"-M",
 	"-f",
+	"-m", "1024",
 	"-c", "1",
 	"-e", "sched:sched_switch:r",
 	"-e", "sched:sched_stat_wait:r",
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index fa2d4e9..2495529 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -52,7 +52,7 @@ struct lost_event {
  */
 struct read_event {
 	struct perf_event_header header;
-	u32 pid,tid;
+	u32 pid, tid;
 	u64 value;
 	u64 time_enabled;
 	u64 time_running;

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

* [tip:perfcounters/core] perf sched: Sanity check context switch events
       [not found]             ` <new-submission>
                                 ` (388 preceding siblings ...)
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Account for lost events, increase default buffering tip-bot for Ingo Molnar
@ 2009-09-16 10:25               ` tip-bot for Ingo Molnar
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Make idle thread and comm/pid names more consistent tip-bot for Ingo Molnar
                                 ` (316 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  c8a37751043427c6e4397a2cbfd617cb5f215c72
Gitweb:     http://git.kernel.org/tip/c8a37751043427c6e4397a2cbfd617cb5f215c72
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 14:07:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 12:08:28 +0200

perf sched: Sanity check context switch events

Use 'perf sched latency' to track the current task based on
context-switch events, and flag the cases where there's some
impossible transition: such as a PID being switched out that
was not switched in.

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/builtin-sched.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 1f0f9be..2d54236 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -119,6 +119,7 @@ static unsigned long		replay_repeat = 10;
 static unsigned long		nr_timestamps;
 static unsigned long		nr_unordered_timestamps;
 static unsigned long		nr_state_machine_bugs;
+static unsigned long		nr_context_switch_bugs;
 static unsigned long		nr_events;
 static unsigned long		nr_lost_chunks;
 static unsigned long		nr_lost_events;
@@ -1399,6 +1400,14 @@ static void __cmd_lat(void)
 			printf(" (due to lost events?)");
 		printf("\n");
 	}
+	if (nr_context_switch_bugs && nr_timestamps) {
+		printf("  INFO: %.3f%% context switch bugs (%ld out of %ld)",
+			(double)nr_context_switch_bugs/(double)nr_timestamps*100.0,
+			nr_context_switch_bugs, nr_timestamps);
+		if (nr_lost_events)
+			printf(" (due to lost events?)");
+		printf("\n");
+	}
 	printf("\n");
 
 }
@@ -1425,10 +1434,16 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
 	trace_handler->wakeup_event(&wakeup_event, event, cpu, timestamp, thread);
 }
 
+/*
+ * Track the current task - that way we can know whether there's any
+ * weird events, such as a task being switched away that is not current.
+ */
+static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
+
 static void
 process_sched_switch_event(struct raw_event_sample *raw,
 			   struct event *event,
-			   int cpu __used,
+			   int cpu,
 			   u64 timestamp __used,
 			   struct thread *thread __used)
 {
@@ -1444,6 +1459,16 @@ process_sched_switch_event(struct raw_event_sample *raw,
 	FILL_FIELD(switch_event, next_pid, event, raw->data);
 	FILL_FIELD(switch_event, next_prio, event, raw->data);
 
+	if (curr_pid[cpu] != (u32)-1) {
+		/*
+		 * Are we trying to switch away a PID that is
+		 * not current?
+		 */
+		if (curr_pid[cpu] != switch_event.prev_pid)
+			nr_context_switch_bugs++;
+	}
+	curr_pid[cpu] = switch_event.next_pid;
+
 	trace_handler->switch_event(&switch_event, event, cpu, timestamp, thread);
 }
 

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

* [tip:perfcounters/core] perf sched: Make idle thread and comm/pid names more consistent
       [not found]             ` <new-submission>
                                 ` (389 preceding siblings ...)
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Sanity check context switch events tip-bot for Ingo Molnar
@ 2009-09-16 10:25               ` tip-bot for Ingo Molnar
  2009-09-16 12:36               ` [tip:x86/platform] x86: Move get/set_wallclock to x86_platform_ops tip-bot for Feng Tang
                                 ` (315 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  80ed0987f363d7eb50193df3e6f6d71451f74bc3
Gitweb:     http://git.kernel.org/tip/80ed0987f363d7eb50193df3e6f6d71451f74bc3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 14:12:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 12:15:47 +0200

perf sched: Make idle thread and comm/pid names more consistent

Peter noticed that we have 3 ways of referring to the idle thread:

 [idle]:0
 swapper:0
 swapper-0

Standardize on 'swapper:0'.

Reported-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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-sched.c |    4 ++--
 tools/perf/util/thread.c   |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 2d54236..da8f674 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1204,13 +1204,13 @@ static void output_lat_thread(struct work_atoms *work_list)
 	/*
 	 * Ignore idle threads:
 	 */
-	if (!work_list->thread->pid)
+	if (!strcmp(work_list->thread->comm, "swapper"))
 		return;
 
 	all_runtime += work_list->total_runtime;
 	all_count += work_list->nb_atoms;
 
-	ret = printf("  %s-%d ", work_list->thread->comm, work_list->thread->pid);
+	ret = printf("  %s:%d ", work_list->thread->comm, work_list->thread->pid);
 
 	for (i = 0; i < 24 - ret; i++)
 		printf(" ");
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 7635928..12c4341 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -85,7 +85,7 @@ register_idle_thread(struct rb_root *threads, struct thread **last_match)
 {
 	struct thread *thread = threads__findnew(0, threads, last_match);
 
-	if (!thread || thread__set_comm(thread, "[init]")) {
+	if (!thread || thread__set_comm(thread, "swapper")) {
 		fprintf(stderr, "problem inserting idle task.\n");
 		exit(-1);
 	}

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

* [tip:x86/platform] x86: Move get/set_wallclock to x86_platform_ops
       [not found]             ` <new-submission>
                                 ` (390 preceding siblings ...)
  2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Make idle thread and comm/pid names more consistent tip-bot for Ingo Molnar
@ 2009-09-16 12:36               ` tip-bot for Feng Tang
  2009-09-16 14:45               ` [tip:perfcounters/core] perf sched: Add 'perf sched map' scheduling event map printout tip-bot for Ingo Molnar
                                 ` (314 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Feng Tang @ 2009-09-16 12:36 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, feng.tang

Commit-ID:  7bd867dfb4e0357e06a3211ab2bd0e714110def3
Gitweb:     http://git.kernel.org/tip/7bd867dfb4e0357e06a3211ab2bd0e714110def3
Author:     Feng Tang <feng.tang@intel.com>
AuthorDate: Thu, 10 Sep 2009 10:48:56 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 16 Sep 2009 14:34:50 +0200

x86: Move get/set_wallclock to x86_platform_ops

get/set_wallclock() have already a set of platform dependent
implementations (default, EFI, paravirt). MRST will add another
variant.

Moving them to platform ops simplifies the existing code and minimizes
the effort to integrate new variants.

Signed-off-by: Feng Tang <feng.tang@intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
 arch/x86/include/asm/paravirt.h       |   10 ------
 arch/x86/include/asm/paravirt_types.h |    4 --
 arch/x86/include/asm/time.h           |   50 ---------------------------------
 arch/x86/include/asm/x86_init.h       |    4 ++
 arch/x86/kernel/efi.c                 |    4 ++
 arch/x86/kernel/kvmclock.c            |    4 +-
 arch/x86/kernel/paravirt.c            |    2 -
 arch/x86/kernel/rtc.c                 |   12 ++-----
 arch/x86/kernel/vmi_32.c              |    4 +-
 arch/x86/kernel/x86_init.c            |    2 +
 arch/x86/lguest/boot.c                |    4 +--
 arch/x86/xen/enlighten.c              |    4 +-
 12 files changed, 21 insertions(+), 83 deletions(-)

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 1e458a5..a69ae87 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -24,16 +24,6 @@ static inline void load_sp0(struct tss_struct *tss,
 	PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread);
 }
 
-static inline unsigned long get_wallclock(void)
-{
-	return PVOP_CALL0(unsigned long, pv_time_ops.get_wallclock);
-}
-
-static inline int set_wallclock(unsigned long nowtime)
-{
-	return PVOP_CALL1(int, pv_time_ops.set_wallclock, nowtime);
-}
-
 /* The paravirtualized CPUID instruction. */
 static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
 			   unsigned int *ecx, unsigned int *edx)
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 0d812e5..c25d5e3 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -88,10 +88,6 @@ struct pv_lazy_ops {
 };
 
 struct pv_time_ops {
-	/* Set and set time of day */
-	unsigned long (*get_wallclock)(void);
-	int (*set_wallclock)(unsigned long);
-
 	unsigned long long (*sched_clock)(void);
 	unsigned long (*get_tsc_khz)(void);
 };
diff --git a/arch/x86/include/asm/time.h b/arch/x86/include/asm/time.h
index 9c5608b..7bdec4e 100644
--- a/arch/x86/include/asm/time.h
+++ b/arch/x86/include/asm/time.h
@@ -4,57 +4,7 @@
 extern void hpet_time_init(void);
 
 #include <asm/mc146818rtc.h>
-#ifdef CONFIG_X86_32
-#include <linux/efi.h>
-
-static inline unsigned long native_get_wallclock(void)
-{
-	unsigned long retval;
-
-	if (efi_enabled)
-		retval = efi_get_time();
-	else
-		retval = mach_get_cmos_time();
-
-	return retval;
-}
-
-static inline int native_set_wallclock(unsigned long nowtime)
-{
-	int retval;
-
-	if (efi_enabled)
-		retval = efi_set_rtc_mmss(nowtime);
-	else
-		retval = mach_set_rtc_mmss(nowtime);
-
-	return retval;
-}
-
-#else
-extern void native_time_init_hook(void);
-
-static inline unsigned long native_get_wallclock(void)
-{
-	return mach_get_cmos_time();
-}
-
-static inline int native_set_wallclock(unsigned long nowtime)
-{
-	return mach_set_rtc_mmss(nowtime);
-}
-
-#endif
 
 extern void time_init(void);
 
-#ifdef CONFIG_PARAVIRT
-#include <asm/paravirt.h>
-#else /* !CONFIG_PARAVIRT */
-
-#define get_wallclock() native_get_wallclock()
-#define set_wallclock(x) native_set_wallclock(x)
-
-#endif /* CONFIG_PARAVIRT */
-
 #endif /* _ASM_X86_TIME_H */
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index b6c8942..2c756fd 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -114,9 +114,13 @@ struct x86_cpuinit_ops {
 /**
  * struct x86_platform_ops - platform specific runtime functions
  * @calibrate_tsc:		calibrate TSC
+ * @get_wallclock:		get time from HW clock like RTC etc.
+ * @set_wallclock:		set time back to HW clock
  */
 struct x86_platform_ops {
 	unsigned long (*calibrate_tsc)(void);
+	unsigned long (*get_wallclock)(void);
+	int (*set_wallclock)(unsigned long nowtime);
 };
 
 extern struct x86_init_ops x86_init;
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index fe26ba3..ad5bd98 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -42,6 +42,7 @@
 #include <asm/time.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
+#include <asm/x86_init.h>
 
 #define EFI_DEBUG	1
 #define PFX 		"EFI: "
@@ -453,6 +454,9 @@ void __init efi_init(void)
 	if (add_efi_memmap)
 		do_add_efi_memmap();
 
+	x86_platform.get_wallclock = efi_get_time;
+	x86_platform.set_wallclock = efi_set_rtc_mmss;
+
 	/* Setup for EFI runtime service */
 	reboot_type = BOOT_EFI;
 
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 75a21b6..59ab94d 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -184,10 +184,10 @@ void __init kvmclock_init(void)
 	if (kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)) {
 		if (kvm_register_clock("boot clock"))
 			return;
-		pv_time_ops.get_wallclock = kvm_get_wallclock;
-		pv_time_ops.set_wallclock = kvm_set_wallclock;
 		pv_time_ops.sched_clock = kvm_clock_read;
 		x86_platform.calibrate_tsc = kvm_get_tsc_khz;
+		x86_platform.get_wallclock = kvm_get_wallclock;
+		x86_platform.set_wallclock = kvm_set_wallclock;
 #ifdef CONFIG_X86_LOCAL_APIC
 		x86_cpuinit.setup_percpu_clockev =
 			kvm_setup_secondary_clock;
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 7cbf898..c0fb85a 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -306,8 +306,6 @@ struct pv_init_ops pv_init_ops = {
 };
 
 struct pv_time_ops pv_time_ops = {
-	.get_wallclock = native_get_wallclock,
-	.set_wallclock = native_set_wallclock,
 	.sched_clock = native_sched_clock,
 };
 
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 5d465b2..b8652f2 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -8,6 +8,7 @@
 #include <linux/pnp.h>
 
 #include <asm/vsyscall.h>
+#include <asm/x86_init.h>
 #include <asm/time.h>
 
 #ifdef CONFIG_X86_32
@@ -165,13 +166,13 @@ void rtc_cmos_write(unsigned char val, unsigned char addr)
 }
 EXPORT_SYMBOL(rtc_cmos_write);
 
-static int set_rtc_mmss(unsigned long nowtime)
+int update_persistent_clock(struct timespec now)
 {
 	unsigned long flags;
 	int retval;
 
 	spin_lock_irqsave(&rtc_lock, flags);
-	retval = set_wallclock(nowtime);
+	retval = x86_platform.set_wallclock(now.tv_sec);
 	spin_unlock_irqrestore(&rtc_lock, flags);
 
 	return retval;
@@ -183,17 +184,12 @@ unsigned long read_persistent_clock(void)
 	unsigned long retval, flags;
 
 	spin_lock_irqsave(&rtc_lock, flags);
-	retval = get_wallclock();
+	retval = x86_platform.get_wallclock();
 	spin_unlock_irqrestore(&rtc_lock, flags);
 
 	return retval;
 }
 
-int update_persistent_clock(struct timespec now)
-{
-	return set_rtc_mmss(now.tv_sec);
-}
-
 unsigned long long native_read_tsc(void)
 {
 	return __native_read_tsc();
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 052ae81..31e6f6c 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -818,14 +818,14 @@ static inline int __init activate_vmi(void)
 		vmi_timer_ops.cancel_alarm =
 			 vmi_get_function(VMI_CALL_CancelAlarm);
 		x86_init.timers.timer_init = vmi_time_init;
-		pv_time_ops.get_wallclock = vmi_get_wallclock;
-		pv_time_ops.set_wallclock = vmi_set_wallclock;
 #ifdef CONFIG_X86_LOCAL_APIC
 		x86_init.timers.setup_percpu_clockev = vmi_time_bsp_init;
 		x86_cpuinit.setup_percpu_clockev = vmi_time_ap_init;
 #endif
 		pv_time_ops.sched_clock = vmi_sched_clock;
 		x86_platform.calibrate_tsc = vmi_tsc_khz;
+		x86_platform.get_wallclock = vmi_get_wallclock;
+		x86_platform.set_wallclock = vmi_set_wallclock;
 
 		/* We have true wallclock functions; disable CMOS clock sync */
 		no_sync_cmos_clock = 1;
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 68824c7..4449a4a 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -70,4 +70,6 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
 
 struct x86_platform_ops x86_platform = {
 	.calibrate_tsc			= native_calibrate_tsc,
+	.get_wallclock			= mach_get_cmos_time,
+	.set_wallclock			= mach_set_rtc_mmss,
 };
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index fabe745..4cb7d5d 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1318,13 +1318,11 @@ __init void lguest_init(void)
 	set_lguest_basic_apic_ops();
 #endif
 
-	/* Time operations */
-	pv_time_ops.get_wallclock = lguest_get_wallclock;
-
 	x86_init.resources.memory_setup = lguest_memory_setup;
 	x86_init.irqs.intr_init = lguest_init_IRQ;
 	x86_init.timers.timer_init = lguest_time_init;
 	x86_platform.calibrate_tsc = lguest_tsc_khz;
+	x86_platform.get_wallclock =  lguest_get_wallclock;
 
 	/*
 	 * Now is a good time to look at the implementations of these functions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ee8cac7..b5bf8b9 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -842,8 +842,6 @@ static const struct pv_init_ops xen_init_ops __initdata = {
 };
 
 static const struct pv_time_ops xen_time_ops __initdata = {
-	.set_wallclock = xen_set_wallclock,
-	.get_wallclock = xen_get_wallclock,
 	.sched_clock = xen_sched_clock,
 };
 
@@ -980,6 +978,8 @@ asmlinkage void __init xen_start_kernel(void)
 	x86_cpuinit.setup_percpu_clockev = x86_init_noop;
 
 	x86_platform.calibrate_tsc = xen_tsc_khz;
+	x86_platform.get_wallclock = xen_get_wallclock;
+	x86_platform.set_wallclock = xen_set_wallclock;
 
 #ifdef CONFIG_X86_64
 	/*

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

* [tip:perfcounters/core] perf sched: Add 'perf sched map' scheduling event map printout
       [not found]             ` <new-submission>
                                 ` (391 preceding siblings ...)
  2009-09-16 12:36               ` [tip:x86/platform] x86: Move get/set_wallclock to x86_platform_ops tip-bot for Feng Tang
@ 2009-09-16 14:45               ` tip-bot for Ingo Molnar
  2009-09-16 15:09               ` [tip:sched/core] sched: Optimize cgroup vs wakeup a bit tip-bot for Peter Zijlstra
                                 ` (313 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 14:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  0ec04e16d08b69d8da46abbcfa3e3f2cd9738852
Gitweb:     http://git.kernel.org/tip/0ec04e16d08b69d8da46abbcfa3e3f2cd9738852
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 17:40:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 16:41:30 +0200

perf sched: Add 'perf sched map' scheduling event map printout

This prints a textual context-switching outline of workload
captured via perf sched record.

For example, on a 16 CPU box it outputs:

   N1  O1  .   .   .   S1  .   .   .   B0  .  *I0  C1  .   M1  .    23002.773423 secs
   N1  O1  .  *Q0  .   S1  .   .   .   B0  .   I0  C1  .   M1  .    23002.773423 secs
   N1  O1  .   Q0  .   S1  .   .   .   B0  .  *R1  C1  .   M1  .    23002.773485 secs
   N1  O1  .   Q0  .   S1  .  *S0  .   B0  .   R1  C1  .   M1  .    23002.773478 secs
  *L0  O1  .   Q0  .   S1  .   S0  .   B0  .   R1  C1  .   M1  .    23002.773523 secs
   L0  O1  .  *.   .   S1  .   S0  .   B0  .   R1  C1  .   M1  .    23002.773531 secs
   L0  O1  .   .   .   S1  .   S0  .   B0  .   R1  C1 *T1  M1  .    23002.773547 secs T1 => irqbalance:2089
   L0  O1  .   .   .   S1  .   S0  .  *P0  .   R1  C1  T1  M1  .    23002.773549 secs
  *N1  O1  .   .   .   S1  .   S0  .   P0  .   R1  C1  T1  M1  .    23002.773566 secs
   N1  O1  .   .   .  *J0  .   S0  .   P0  .   R1  C1  T1  M1  .    23002.773571 secs
   N1  O1  .   .   .   J0  .   S0 *B0  P0  .   R1  C1  T1  M1  .    23002.773592 secs
   N1  O1  .   .   .   J0  .  *U0  B0  P0  .   R1  C1  T1  M1  .    23002.773582 secs
   N1  O1  .   .   .  *S1  .   U0  B0  P0  .   R1  C1  T1  M1  .    23002.773604 secs
   N1  O1  .   .   .   S1  .   U0  B0 *.   .   R1  C1  T1  M1  .    23002.773615 secs
   N1  O1  .   .   .   S1  .   U0  B0  .   .  *K0  C1  T1  M1  .    23002.773631 secs
   N1  O1  .  *M0  .   S1  .   U0  B0  .   .   K0  C1  T1  M1  .    23002.773624 secs
   N1  O1  .   M0  .   S1  .   U0 *.   .   .   K0  C1  T1  M1  .    23002.773644 secs
   N1  O1  .   M0  .   S1  .   U0  .   .   .  *R1  C1  T1  M1  .    23002.773662 secs
   N1  O1  .   M0  .   S1  .  *.   .   .   .   R1  C1  T1  M1  .    23002.773648 secs
   N1  O1  .  *.   .   S1  .   .   .   .   .   R1  C1  T1  M1  .    23002.773680 secs
   N1  O1  .   .   .  *L0  .   .   .   .   .   R1  C1  T1  M1  .    23002.773717 secs
  *N0  O1  .   .   .   L0  .   .   .   .   .   R1  C1  T1  M1  .    23002.773709 secs
  *N1  O1  .   .   .   L0  .   .   .   .   .   R1  C1  T1  M1  .    23002.773747 secs

Columns stand for individual CPUs, from CPU0 to CPU15, and the
two-letter shortcuts stand for tasks that are running on a CPU.

'*' denotes the CPU that had the event.

A dot signals an idle CPU.

New tasks are assigned new two-letter shortcuts - when they occur
first they are printed. In the above example 'T1' stood for irqbalance:

      T1 => irqbalance:2089

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/builtin-sched.c |  312 ++++++++++++++++++++++++++++++--------------
 tools/perf/util/thread.c   |    2 +-
 tools/perf/util/thread.h   |    1 +
 3 files changed, 214 insertions(+), 101 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index da8f674..f67e351 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -159,8 +159,6 @@ static struct rb_root		atom_root, sorted_atom_root;
 static u64			all_runtime;
 static u64			all_count;
 
-static int read_events(void);
-
 
 static u64 get_nsecs(void)
 {
@@ -634,38 +632,6 @@ static void test_calibrations(void)
 	printf("the sleep test took %Ld nsecs\n", T1-T0);
 }
 
-static void __cmd_replay(void)
-{
-	unsigned long i;
-
-	calibrate_run_measurement_overhead();
-	calibrate_sleep_measurement_overhead();
-
-	test_calibrations();
-
-	read_events();
-
-	printf("nr_run_events:        %ld\n", nr_run_events);
-	printf("nr_sleep_events:      %ld\n", nr_sleep_events);
-	printf("nr_wakeup_events:     %ld\n", nr_wakeup_events);
-
-	if (targetless_wakeups)
-		printf("target-less wakeups:  %ld\n", targetless_wakeups);
-	if (multitarget_wakeups)
-		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
-	if (nr_run_events_optimized)
-		printf("run atoms optimized: %ld\n",
-			nr_run_events_optimized);
-
-	print_task_traces();
-	add_cross_task_wakeups();
-
-	create_tasks();
-	printf("------------------------------------------------------------\n");
-	for (i = 0; i < replay_repeat; i++)
-		run_one_test();
-}
-
 static int
 process_comm_event(event_t *event, unsigned long offset, unsigned long head)
 {
@@ -1354,64 +1320,6 @@ static void sort_lat(void)
 	}
 }
 
-static void __cmd_lat(void)
-{
-	struct rb_node *next;
-
-	setup_pager();
-	read_events();
-	sort_lat();
-
-	printf("\n -----------------------------------------------------------------------------------------\n");
-	printf("  Task                  |   Runtime ms  | Switches | Average delay ms | Maximum delay ms |\n");
-	printf(" -----------------------------------------------------------------------------------------\n");
-
-	next = rb_first(&sorted_atom_root);
-
-	while (next) {
-		struct work_atoms *work_list;
-
-		work_list = rb_entry(next, struct work_atoms, node);
-		output_lat_thread(work_list);
-		next = rb_next(next);
-	}
-
-	printf(" -----------------------------------------------------------------------------------------\n");
-	printf("  TOTAL:                |%11.3f ms |%9Ld |\n",
-		(double)all_runtime/1e6, all_count);
-
-	printf(" ---------------------------------------------------\n");
-	if (nr_unordered_timestamps && nr_timestamps) {
-		printf("  INFO: %.3f%% unordered timestamps (%ld out of %ld)\n",
-			(double)nr_unordered_timestamps/(double)nr_timestamps*100.0,
-			nr_unordered_timestamps, nr_timestamps);
-	} else {
-	}
-	if (nr_lost_events && nr_events) {
-		printf("  INFO: %.3f%% lost events (%ld out of %ld, in %ld chunks)\n",
-			(double)nr_lost_events/(double)nr_events*100.0,
-			nr_lost_events, nr_events, nr_lost_chunks);
-	}
-	if (nr_state_machine_bugs && nr_timestamps) {
-		printf("  INFO: %.3f%% state machine bugs (%ld out of %ld)",
-			(double)nr_state_machine_bugs/(double)nr_timestamps*100.0,
-			nr_state_machine_bugs, nr_timestamps);
-		if (nr_lost_events)
-			printf(" (due to lost events?)");
-		printf("\n");
-	}
-	if (nr_context_switch_bugs && nr_timestamps) {
-		printf("  INFO: %.3f%% context switch bugs (%ld out of %ld)",
-			(double)nr_context_switch_bugs/(double)nr_timestamps*100.0,
-			nr_context_switch_bugs, nr_timestamps);
-		if (nr_lost_events)
-			printf(" (due to lost events?)");
-		printf("\n");
-	}
-	printf("\n");
-
-}
-
 static struct trace_sched_handler *trace_handler;
 
 static void
@@ -1431,19 +1339,106 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
 	FILL_FIELD(wakeup_event, success, event, raw->data);
 	FILL_FIELD(wakeup_event, cpu, event, raw->data);
 
-	trace_handler->wakeup_event(&wakeup_event, event, cpu, timestamp, thread);
+	if (trace_handler->wakeup_event)
+		trace_handler->wakeup_event(&wakeup_event, event, cpu, timestamp, thread);
 }
 
 /*
  * Track the current task - that way we can know whether there's any
  * weird events, such as a task being switched away that is not current.
  */
+static int max_cpu = 15;
+
 static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
 
+static struct thread *curr_thread[MAX_CPUS];
+
+static char next_shortname1 = 'A';
+static char next_shortname2 = '0';
+
+static void
+map_switch_event(struct trace_switch_event *switch_event,
+		 struct event *event __used,
+		 int this_cpu,
+		 u64 timestamp,
+		 struct thread *thread __used)
+{
+	struct thread *sched_out, *sched_in;
+	int new_shortname;
+	u64 timestamp0;
+	s64 delta;
+	int cpu;
+
+	BUG_ON(this_cpu >= MAX_CPUS || this_cpu < 0);
+
+	if (this_cpu > max_cpu)
+		max_cpu = this_cpu;
+
+	timestamp0 = cpu_last_switched[this_cpu];
+	cpu_last_switched[this_cpu] = timestamp;
+	if (timestamp0)
+		delta = timestamp - timestamp0;
+	else
+		delta = 0;
+
+	if (delta < 0)
+		die("hm, delta: %Ld < 0 ?\n", delta);
+
+
+	sched_out = threads__findnew(switch_event->prev_pid, &threads, &last_match);
+	sched_in = threads__findnew(switch_event->next_pid, &threads, &last_match);
+
+	curr_thread[this_cpu] = sched_in;
+
+	printf("  ");
+
+	new_shortname = 0;
+	if (!sched_in->shortname[0]) {
+		sched_in->shortname[0] = next_shortname1;
+		sched_in->shortname[1] = next_shortname2;
+
+		if (next_shortname1 < 'Z') {
+			next_shortname1++;
+		} else {
+			next_shortname1='A';
+			if (next_shortname2 < '9') {
+				next_shortname2++;
+			} else {
+				next_shortname2='0';
+			}
+		}
+		new_shortname = 1;
+	}
+
+	for (cpu = 0; cpu <= max_cpu; cpu++) {
+		if (cpu != this_cpu)
+			printf(" ");
+		else
+			printf("*");
+
+		if (curr_thread[cpu]) {
+			if (curr_thread[cpu]->pid)
+				printf("%2s ", curr_thread[cpu]->shortname);
+			else
+				printf(".  ");
+		} else
+			printf("   ");
+	}
+
+	printf("  %12.6f secs ", (double)timestamp/1e9);
+	if (new_shortname) {
+		printf("%s => %s:%d\n",
+			sched_in->shortname, sched_in->comm, sched_in->pid);
+	} else {
+		printf("\n");
+	}
+}
+
+
 static void
 process_sched_switch_event(struct raw_event_sample *raw,
 			   struct event *event,
-			   int cpu,
+			   int this_cpu,
 			   u64 timestamp __used,
 			   struct thread *thread __used)
 {
@@ -1459,17 +1454,18 @@ process_sched_switch_event(struct raw_event_sample *raw,
 	FILL_FIELD(switch_event, next_pid, event, raw->data);
 	FILL_FIELD(switch_event, next_prio, event, raw->data);
 
-	if (curr_pid[cpu] != (u32)-1) {
+	if (curr_pid[this_cpu] != (u32)-1) {
 		/*
 		 * Are we trying to switch away a PID that is
 		 * not current?
 		 */
-		if (curr_pid[cpu] != switch_event.prev_pid)
+		if (curr_pid[this_cpu] != switch_event.prev_pid)
 			nr_context_switch_bugs++;
 	}
-	curr_pid[cpu] = switch_event.next_pid;
+	if (trace_handler->switch_event)
+		trace_handler->switch_event(&switch_event, event, this_cpu, timestamp, thread);
 
-	trace_handler->switch_event(&switch_event, event, cpu, timestamp, thread);
+	curr_pid[this_cpu] = switch_event.next_pid;
 }
 
 static void
@@ -1486,7 +1482,8 @@ process_sched_runtime_event(struct raw_event_sample *raw,
 	FILL_FIELD(runtime_event, runtime, event, raw->data);
 	FILL_FIELD(runtime_event, vruntime, event, raw->data);
 
-	trace_handler->runtime_event(&runtime_event, event, cpu, timestamp, thread);
+	if (trace_handler->runtime_event)
+		trace_handler->runtime_event(&runtime_event, event, cpu, timestamp, thread);
 }
 
 static void
@@ -1505,7 +1502,8 @@ process_sched_fork_event(struct raw_event_sample *raw,
 	FILL_ARRAY(fork_event, child_comm, event, raw->data);
 	FILL_FIELD(fork_event, child_pid, event, raw->data);
 
-	trace_handler->fork_event(&fork_event, event, cpu, timestamp, thread);
+	if (trace_handler->fork_event)
+		trace_handler->fork_event(&fork_event, event, cpu, timestamp, thread);
 }
 
 static void
@@ -1748,6 +1746,116 @@ more:
 	return rc;
 }
 
+static void print_bad_events(void)
+{
+	if (nr_unordered_timestamps && nr_timestamps) {
+		printf("  INFO: %.3f%% unordered timestamps (%ld out of %ld)\n",
+			(double)nr_unordered_timestamps/(double)nr_timestamps*100.0,
+			nr_unordered_timestamps, nr_timestamps);
+	}
+	if (nr_lost_events && nr_events) {
+		printf("  INFO: %.3f%% lost events (%ld out of %ld, in %ld chunks)\n",
+			(double)nr_lost_events/(double)nr_events*100.0,
+			nr_lost_events, nr_events, nr_lost_chunks);
+	}
+	if (nr_state_machine_bugs && nr_timestamps) {
+		printf("  INFO: %.3f%% state machine bugs (%ld out of %ld)",
+			(double)nr_state_machine_bugs/(double)nr_timestamps*100.0,
+			nr_state_machine_bugs, nr_timestamps);
+		if (nr_lost_events)
+			printf(" (due to lost events?)");
+		printf("\n");
+	}
+	if (nr_context_switch_bugs && nr_timestamps) {
+		printf("  INFO: %.3f%% context switch bugs (%ld out of %ld)",
+			(double)nr_context_switch_bugs/(double)nr_timestamps*100.0,
+			nr_context_switch_bugs, nr_timestamps);
+		if (nr_lost_events)
+			printf(" (due to lost events?)");
+		printf("\n");
+	}
+}
+
+static void __cmd_lat(void)
+{
+	struct rb_node *next;
+
+	setup_pager();
+	read_events();
+	sort_lat();
+
+	printf("\n -----------------------------------------------------------------------------------------\n");
+	printf("  Task                  |   Runtime ms  | Switches | Average delay ms | Maximum delay ms |\n");
+	printf(" -----------------------------------------------------------------------------------------\n");
+
+	next = rb_first(&sorted_atom_root);
+
+	while (next) {
+		struct work_atoms *work_list;
+
+		work_list = rb_entry(next, struct work_atoms, node);
+		output_lat_thread(work_list);
+		next = rb_next(next);
+	}
+
+	printf(" -----------------------------------------------------------------------------------------\n");
+	printf("  TOTAL:                |%11.3f ms |%9Ld |\n",
+		(double)all_runtime/1e6, all_count);
+
+	printf(" ---------------------------------------------------\n");
+
+	print_bad_events();
+	printf("\n");
+
+}
+
+static struct trace_sched_handler map_ops  = {
+	.wakeup_event		= NULL,
+	.switch_event		= map_switch_event,
+	.runtime_event		= NULL,
+	.fork_event		= NULL,
+};
+
+static void __cmd_map(void)
+{
+	setup_pager();
+	read_events();
+	print_bad_events();
+}
+
+static void __cmd_replay(void)
+{
+	unsigned long i;
+
+	calibrate_run_measurement_overhead();
+	calibrate_sleep_measurement_overhead();
+
+	test_calibrations();
+
+	read_events();
+
+	printf("nr_run_events:        %ld\n", nr_run_events);
+	printf("nr_sleep_events:      %ld\n", nr_sleep_events);
+	printf("nr_wakeup_events:     %ld\n", nr_wakeup_events);
+
+	if (targetless_wakeups)
+		printf("target-less wakeups:  %ld\n", targetless_wakeups);
+	if (multitarget_wakeups)
+		printf("multi-target wakeups: %ld\n", multitarget_wakeups);
+	if (nr_run_events_optimized)
+		printf("run atoms optimized: %ld\n",
+			nr_run_events_optimized);
+
+	print_task_traces();
+	add_cross_task_wakeups();
+
+	create_tasks();
+	printf("------------------------------------------------------------\n");
+	for (i = 0; i < replay_repeat; i++)
+		run_one_test();
+}
+
+
 static const char * const sched_usage[] = {
 	"perf sched [<options>] {record|latency|replay|trace}",
 	NULL
@@ -1867,6 +1975,10 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used)
 		}
 		setup_sorting();
 		__cmd_lat();
+	} else if (!strcmp(argv[0], "map")) {
+		trace_handler = &map_ops;
+		setup_sorting();
+		__cmd_map();
 	} else if (!strncmp(argv[0], "rep", 3)) {
 		trace_handler = &replay_ops;
 		if (argc) {
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 12c4341..45efb5d 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -8,7 +8,7 @@
 
 static struct thread *thread__new(pid_t pid)
 {
-	struct thread *self = malloc(sizeof(*self));
+	struct thread *self = calloc(1, sizeof(*self));
 
 	if (self != NULL) {
 		self->pid = pid;
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 665d1f3..32aea3c 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -7,6 +7,7 @@ struct thread {
 	struct rb_node		rb_node;
 	struct list_head	maps;
 	pid_t			pid;
+	char			shortname[3];
 	char			*comm;
 };
 

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

* [tip:sched/core] sched: Optimize cgroup vs wakeup a bit
       [not found]             ` <new-submission>
                                 ` (392 preceding siblings ...)
  2009-09-16 14:45               ` [tip:perfcounters/core] perf sched: Add 'perf sched map' scheduling event map printout tip-bot for Ingo Molnar
@ 2009-09-16 15:09               ` tip-bot for Peter Zijlstra
  2009-09-16 15:09               ` [tip:sched/core] sched: Clean up the load_idx selection in select_task_rq_fair tip-bot for Peter Zijlstra
                                 ` (312 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 15:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  3b6408942206f940dd538e980e9904e48f4b64f8
Gitweb:     http://git.kernel.org/tip/3b6408942206f940dd538e980e9904e48f4b64f8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 13:44:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 16:44:32 +0200

sched: Optimize cgroup vs wakeup a bit

We don't need to call update_shares() for each domain we iterate,
just got the largets one.

However, we should call it before wake_affine() as well, so that
that can use up-to-date values too.

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


---
 kernel/sched.c          |    7 -------
 kernel/sched_fair.c     |   23 +++++++++--------------
 kernel/sched_features.h |    2 +-
 3 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index af04ede..5049d95 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -376,13 +376,6 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
 
 #else
 
-#ifdef CONFIG_SMP
-static int root_task_group_empty(void)
-{
-	return 1;
-}
-#endif
-
 static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
 static inline struct task_group *task_group(struct task_struct *p)
 {
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index acf16a8..722d392 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1348,7 +1348,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  */
 static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 {
-	struct sched_domain *tmp, *sd = NULL;
+	struct sched_domain *tmp, *shares = NULL, *sd = NULL;
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
 	int new_cpu = cpu;
@@ -1387,22 +1387,14 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 				break;
 		}
 
-		switch (sd_flag) {
-		case SD_BALANCE_WAKE:
-			if (!sched_feat(LB_WAKEUP_UPDATE))
-				break;
-		case SD_BALANCE_FORK:
-		case SD_BALANCE_EXEC:
-			if (root_task_group_empty())
-				break;
-			update_shares(tmp);
-		default:
-			break;
-		}
-
 		if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
 		    cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
 
+			if (sched_feat(LB_SHARES_UPDATE)) {
+				update_shares(tmp);
+				shares = tmp;
+			}
+
 			if (wake_affine(tmp, p, sync)) {
 				new_cpu = cpu;
 				goto out;
@@ -1417,6 +1409,9 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 		sd = tmp;
 	}
 
+	if (sd && sd != shares && sched_feat(LB_SHARES_UPDATE))
+		update_shares(sd);
+
 	while (sd) {
 		struct sched_group *group;
 		int weight;
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index fd37567..d5059fd 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -107,7 +107,7 @@ SCHED_FEAT(ARCH_POWER, 0)
 SCHED_FEAT(HRTICK, 0)
 SCHED_FEAT(DOUBLE_TICK, 0)
 SCHED_FEAT(LB_BIAS, 1)
-SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
+SCHED_FEAT(LB_SHARES_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
 
 /*

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

* [tip:sched/core] sched: Clean up the load_idx selection in select_task_rq_fair
       [not found]             ` <new-submission>
                                 ` (393 preceding siblings ...)
  2009-09-16 15:09               ` [tip:sched/core] sched: Optimize cgroup vs wakeup a bit tip-bot for Peter Zijlstra
@ 2009-09-16 15:09               ` tip-bot for Peter Zijlstra
  2009-09-16 15:10               ` [tip:sched/core] sched: Rename flags to wake_flags tip-bot for Peter Zijlstra
                                 ` (311 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 15:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5158f4e4428c6b8d52796b3b460e95796123a114
Gitweb:     http://git.kernel.org/tip/5158f4e4428c6b8d52796b3b460e95796123a114
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 13:46:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 16:44:32 +0200

sched: Clean up the load_idx selection in select_task_rq_fair

Clean up the code a little.

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 |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 722d392..aeff40e 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1248,26 +1248,11 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
  */
 static struct sched_group *
 find_idlest_group(struct sched_domain *sd, struct task_struct *p,
-		  int this_cpu, int flag)
+		  int this_cpu, int load_idx)
 {
 	struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
 	unsigned long min_load = ULONG_MAX, this_load = 0;
 	int imbalance = 100 + (sd->imbalance_pct-100)/2;
-	int load_idx = 0;
-
-	switch (flag) {
-	case SD_BALANCE_FORK:
-	case SD_BALANCE_EXEC:
-		load_idx = sd->forkexec_idx;
-		break;
-
-	case SD_BALANCE_WAKE:
-		load_idx = sd->wake_idx;
-		break;
-
-	default:
-		break;
-	}
 
 	do {
 		unsigned long load, avg_load;
@@ -1346,14 +1331,14 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  *
  * preempt must be disabled.
  */
-static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
+static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
 {
 	struct sched_domain *tmp, *shares = NULL, *sd = NULL;
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
 	int new_cpu = cpu;
 	int want_affine = 0;
-	int sync = flags & WF_SYNC;
+	int sync = wake_flags & WF_SYNC;
 
 	if (sd_flag & SD_BALANCE_WAKE) {
 		if (sched_feat(AFFINE_WAKEUPS))
@@ -1413,6 +1398,7 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 		update_shares(sd);
 
 	while (sd) {
+		int load_idx = sd->forkexec_idx;
 		struct sched_group *group;
 		int weight;
 
@@ -1421,7 +1407,10 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int flags)
 			continue;
 		}
 
-		group = find_idlest_group(sd, p, cpu, sd_flag);
+		if (sd_flag & SD_BALANCE_WAKE)
+			load_idx = sd->wake_idx;
+
+		group = find_idlest_group(sd, p, cpu, load_idx);
 		if (!group) {
 			sd = sd->child;
 			continue;

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

* [tip:sched/core] sched: Rename flags to wake_flags
       [not found]             ` <new-submission>
                                 ` (394 preceding siblings ...)
  2009-09-16 15:09               ` [tip:sched/core] sched: Clean up the load_idx selection in select_task_rq_fair tip-bot for Peter Zijlstra
@ 2009-09-16 15:10               ` tip-bot for Peter Zijlstra
  2009-09-16 15:10               ` [tip:sched/core] sched: Disable wakeup balancing tip-bot for Peter Zijlstra
                                 ` (310 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 15:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5a9b86f647a56862cdc0a1362bfb015ae921af7f
Gitweb:     http://git.kernel.org/tip/5a9b86f647a56862cdc0a1362bfb015ae921af7f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 13:47:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 16:44:33 +0200

sched: Rename flags to wake_flags

For consistencies sake, rename the argument (again).

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 |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index aeff40e..c741cd9 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1551,12 +1551,12 @@ static void set_next_buddy(struct sched_entity *se)
 /*
  * Preempt the current task with a newly woken task if needed:
  */
-static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int flags)
+static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 {
 	struct task_struct *curr = rq->curr;
 	struct sched_entity *se = &curr->se, *pse = &p->se;
 	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
-	int sync = flags & WF_SYNC;
+	int sync = wake_flags & WF_SYNC;
 
 	update_curr(cfs_rq);
 
@@ -1582,7 +1582,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int flags
 	 */
 	if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
 		set_last_buddy(se);
-	if (sched_feat(NEXT_BUDDY) && !(flags & WF_FORK))
+	if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK))
 		set_next_buddy(pse);
 
 	/*

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

* [tip:sched/core] sched: Disable wakeup balancing
       [not found]             ` <new-submission>
                                 ` (395 preceding siblings ...)
  2009-09-16 15:10               ` [tip:sched/core] sched: Rename flags to wake_flags tip-bot for Peter Zijlstra
@ 2009-09-16 15:10               ` tip-bot for Peter Zijlstra
  2009-09-16 18:50                 ` Peter Zijlstra
  2009-09-16 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
                                 ` (309 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-16 15:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  182a85f8a119c789610a9d464f4129ded9f3c107
Gitweb:     http://git.kernel.org/tip/182a85f8a119c789610a9d464f4129ded9f3c107
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Sep 2009 13:24:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 16:44:33 +0200

sched: Disable wakeup balancing

Sysbench thinks SD_BALANCE_WAKE is too agressive and kbuild doesn't
really mind too much, SD_BALANCE_NEWIDLE picks up most of the
slack.

On a dual socket, quad core, dual thread nehalem system:

sysbench (--num_threads=16):

 SD_BALANCE_WAKE-: 13982 tx/s
 SD_BALANCE_WAKE+: 15688 tx/s

kbuild (-j16):

 SD_BALANCE_WAKE-: 47.648295846  seconds time elapsed   ( +-   0.312% )
 SD_BALANCE_WAKE+: 47.608607360  seconds time elapsed   ( +-   0.026% )

(same within noise)

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


---
 arch/ia64/include/asm/topology.h           |    2 --
 arch/mips/include/asm/mach-ip27/topology.h |    1 -
 arch/powerpc/include/asm/topology.h        |    1 -
 arch/sh/include/asm/topology.h             |    1 -
 arch/sparc/include/asm/topology_64.h       |    1 -
 arch/x86/include/asm/topology.h            |    2 +-
 include/linux/topology.h                   |    6 +++---
 7 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 569b9da..d0141fb 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -68,7 +68,6 @@ void build_cpu_to_node_map(void);
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
 				| SD_BALANCE_FORK	\
-				| SD_BALANCE_WAKE	\
 				| SD_WAKE_AFFINE,	\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
@@ -94,7 +93,6 @@ void build_cpu_to_node_map(void);
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
 				| SD_BALANCE_FORK	\
-				| SD_BALANCE_WAKE	\
 				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 64,			\
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index d833239..2305917 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -48,7 +48,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
 	.cache_nice_tries	= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_WAKE,	\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
 	.nr_balance_failed	= 0,			\
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 1a2c9eb..394edcb 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -63,7 +63,6 @@ static inline int pcibus_to_node(struct pci_bus *bus)
 				| SD_BALANCE_EXEC	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_NEWIDLE	\
-				| SD_BALANCE_WAKE	\
 				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index a8cc564..f8c40cc 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -21,7 +21,6 @@
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_WAKE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 10b979d..26cd25c 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -57,7 +57,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_FORK	\
 				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_WAKE	\
 				| SD_SERIALIZE,		\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 589f123..6f0695d 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -141,7 +141,7 @@ extern unsigned long node_remap_size[];
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_BALANCE_WAKE			\
+				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
diff --git a/include/linux/topology.h b/include/linux/topology.h
index a6614b0..809b26c 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -95,7 +95,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_BALANCE_WAKE			\
+				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
@@ -127,7 +127,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_BALANCE_WAKE			\
+				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
@@ -160,7 +160,7 @@ int arch_update_cpu_topology(void);
 				| 1*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
-				| 1*SD_BALANCE_WAKE			\
+				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
 				| 1*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\

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

* Re: [tip:sched/core] sched: Disable wakeup balancing
  2009-09-16 15:10               ` [tip:sched/core] sched: Disable wakeup balancing tip-bot for Peter Zijlstra
@ 2009-09-16 18:50                 ` Peter Zijlstra
  0 siblings, 0 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2009-09-16 18:50 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, tglx, mingo; +Cc: linux-tip-commits

On Wed, 2009-09-16 at 15:10 +0000, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  182a85f8a119c789610a9d464f4129ded9f3c107
> Gitweb:     http://git.kernel.org/tip/182a85f8a119c789610a9d464f4129ded9f3c107
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Wed, 16 Sep 2009 13:24:49 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 16 Sep 2009 16:44:33 +0200
> 
> sched: Disable wakeup balancing
> 
> Sysbench thinks SD_BALANCE_WAKE is too agressive and kbuild doesn't
> really mind too much, SD_BALANCE_NEWIDLE picks up most of the
> slack.
> 
> On a dual socket, quad core, dual thread nehalem system:
> 
> sysbench (--num_threads=16):
> 
>  SD_BALANCE_WAKE-: 13982 tx/s
>  SD_BALANCE_WAKE+: 15688 tx/s

I got the + and - confused it seems.. sysbench is faster without
BALANCE_WAKE.

> kbuild (-j16):
> 
>  SD_BALANCE_WAKE-: 47.648295846  seconds time elapsed   ( +-   0.312% )
>  SD_BALANCE_WAKE+: 47.608607360  seconds time elapsed   ( +-   0.026% )



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

* [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage
       [not found]             ` <new-submission>
                                 ` (396 preceding siblings ...)
  2009-09-16 15:10               ` [tip:sched/core] sched: Disable wakeup balancing tip-bot for Peter Zijlstra
@ 2009-09-16 19:13               ` tip-bot for Ingo Molnar
  2009-09-16 19:15               ` tip-bot for Ingo Molnar
                                 ` (308 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 19:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  bf2add6a0aacf632a71237ac5fc818a82ea12684
Gitweb:     http://git.kernel.org/tip/bf2add6a0aacf632a71237ac5fc818a82ea12684
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 21:09:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 21:09:13 +0200

sched: Fix TASK_WAKING & loadaverage breakage

Fix this:

top - 21:54:00 up  2:59,  1 user,  load average: 432512.33, 426421.74, 417432.74

Which happens because we now set TASK_WAKING before activate_task().

Spread out activate_task() in two parts - this is also
a micro-optimization as try_to_wake_up() is one of the
hottest path.

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index 5049d95..e3fbd83 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2343,7 +2343,11 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	/*
 	 * In order to handle concurrent wakeups and release the rq->lock
 	 * we put the task in TASK_WAKING state.
+	 *
+	 * First fix up the nr_uninterruptible count:
 	 */
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible--;
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 
@@ -2381,7 +2385,9 @@ out_activate:
 		schedstat_inc(p, se.nr_wakeups_local);
 	else
 		schedstat_inc(p, se.nr_wakeups_remote);
-	activate_task(rq, p, 1);
+
+	enqueue_task(rq, p, wakeup);
+	inc_nr_running(rq);
 	success = 1;
 
 	/*

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

* [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage
       [not found]             ` <new-submission>
                                 ` (397 preceding siblings ...)
  2009-09-16 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
@ 2009-09-16 19:15               ` tip-bot for Ingo Molnar
  2009-09-17  7:48               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
                                 ` (307 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-16 19:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  035e5274f713b8c00afa86abd9b5d70317ae9305
Gitweb:     http://git.kernel.org/tip/035e5274f713b8c00afa86abd9b5d70317ae9305
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 21:09:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Sep 2009 21:12:31 +0200

sched: Fix TASK_WAKING & loadaverage breakage

Fix this:

top - 21:54:00 up  2:59,  1 user,  load average: 432512.33, 426421.74, 417432.74

Which happens because we now set TASK_WAKING before activate_task().

Spread out activate_task() in two parts - this is also
a micro-optimization as try_to_wake_up() is one of the
hottest path.

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index 5049d95..63a4995 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2343,7 +2343,11 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	/*
 	 * In order to handle concurrent wakeups and release the rq->lock
 	 * we put the task in TASK_WAKING state.
+	 *
+	 * First fix up the nr_uninterruptible count:
 	 */
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible--;
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 
@@ -2381,7 +2385,9 @@ out_activate:
 		schedstat_inc(p, se.nr_wakeups_local);
 	else
 		schedstat_inc(p, se.nr_wakeups_remote);
-	activate_task(rq, p, 1);
+
+	enqueue_task(rq, p, 1);
+	inc_nr_running(rq);
 	success = 1;
 
 	/*

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

* [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING
       [not found]             ` <new-submission>
                                 ` (398 preceding siblings ...)
  2009-09-16 19:15               ` tip-bot for Ingo Molnar
@ 2009-09-17  7:48               ` tip-bot for Peter Zijlstra
  2009-09-17  7:49               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
                                 ` (306 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  7:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, peterz, tglx, mingo

Commit-ID:  e334d174b6c916c4a9a2e4ba626c760c7e98cb78
Gitweb:     http://git.kernel.org/tip/e334d174b6c916c4a9a2e4ba626c760c7e98cb78
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 16 Sep 2009 12:31:31 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 09:36:01 +0200

sched: Add new wakeup preemption mode: WAKEUP_RUNNING

Create a new wakeup preemption mode, preempt towards tasks that run
shorter on avg. It sets next buddy to be sure we actually run the task
we preempted for.

Test results:

 root@twins:~# while :; do :; done &
 [1] 6537
 root@twins:~# while :; do :; done &
 [2] 6538
 root@twins:~# while :; do :; done &
 [3] 6539
 root@twins:~# while :; do :; done &
 [4] 6540

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max          4750 usec
        Avg           497 usec
        Stdev         737 usec

 root@twins:/home/peter# echo WAKEUP_RUNNING > /debug/sched_features

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max            14 usec
        Avg             5 usec
        Stdev           3 usec

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


---
 include/linux/sched.h   |    2 ++
 kernel/sched.c          |   17 ++++++++++-------
 kernel/sched_debug.c    |    1 +
 kernel/sched_fair.c     |   14 +++++++++++---
 kernel/sched_features.h |    5 +++++
 5 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b4a39bb..8af3d24 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1113,6 +1113,8 @@ struct sched_entity {
 	u64			start_runtime;
 	u64			avg_wakeup;
 
+	u64			avg_running;
+
 #ifdef CONFIG_SCHEDSTATS
 	u64			wait_start;
 	u64			wait_max;
diff --git a/kernel/sched.c b/kernel/sched.c
index 5049d95..f55133c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2454,6 +2454,7 @@ static void __sched_fork(struct task_struct *p)
 	p->se.avg_overlap		= 0;
 	p->se.start_runtime		= 0;
 	p->se.avg_wakeup		= sysctl_sched_wakeup_granularity;
+	p->se.avg_running		= 0;
 
 #ifdef CONFIG_SCHEDSTATS
 	p->se.wait_start			= 0;
@@ -5306,14 +5307,13 @@ static inline void schedule_debug(struct task_struct *prev)
 #endif
 }
 
-static void put_prev_task(struct rq *rq, struct task_struct *prev)
+static void put_prev_task(struct rq *rq, struct task_struct *p)
 {
-	if (prev->state == TASK_RUNNING) {
-		u64 runtime = prev->se.sum_exec_runtime;
+	u64 runtime = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime;
 
-		runtime -= prev->se.prev_sum_exec_runtime;
-		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+	update_avg(&p->se.avg_running, runtime);
 
+	if (p->state == TASK_RUNNING) {
 		/*
 		 * In order to avoid avg_overlap growing stale when we are
 		 * indeed overlapping and hence not getting put to sleep, grow
@@ -5323,9 +5323,12 @@ static void put_prev_task(struct rq *rq, struct task_struct *prev)
 		 * correlates to the amount of cache footprint a task can
 		 * build up.
 		 */
-		update_avg(&prev->se.avg_overlap, runtime);
+		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+		update_avg(&p->se.avg_overlap, runtime);
+	} else {
+		update_avg(&p->se.avg_running, 0);
 	}
-	prev->sched_class->put_prev_task(rq, prev);
+	p->sched_class->put_prev_task(rq, p);
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5ddbd08..efb8440 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -395,6 +395,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	PN(se.sum_exec_runtime);
 	PN(se.avg_overlap);
 	PN(se.avg_wakeup);
+	PN(se.avg_running);
 
 	nr_switches = p->nvcsw + p->nivcsw;
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c741cd9..3e6f78c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1605,9 +1605,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
-	if (!sched_feat(WAKEUP_PREEMPT))
-		return;
-
 	if ((sched_feat(WAKEUP_SYNC) && sync) ||
 	    (sched_feat(WAKEUP_OVERLAP) &&
 	     (se->avg_overlap < sysctl_sched_migration_cost &&
@@ -1616,6 +1613,17 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
+	if (sched_feat(WAKEUP_RUNNING)) {
+		if (pse->avg_running < se->avg_running) {
+			set_next_buddy(pse);
+			resched_task(curr);
+			return;
+		}
+	}
+
+	if (!sched_feat(WAKEUP_PREEMPT))
+		return;
+
 	find_matching_se(&se, &pse);
 
 	BUG_ON(!pse);
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index d5059fd..eba3faa 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -54,6 +54,11 @@ SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 
 /*
+ * Wakeup preemption towards tasks that run short
+ */
+SCHED_FEAT(WAKEUP_RUNNING, 1)
+
+/*
  * Use the SYNC wakeup hint, pipes and the likes use this to indicate
  * the remote end is likely to consume the data we just wrote, and
  * therefore has cache benefit from being placed on the same cpu, see

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

* [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage
       [not found]             ` <new-submission>
                                 ` (399 preceding siblings ...)
  2009-09-17  7:48               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
@ 2009-09-17  7:49               ` tip-bot for Ingo Molnar
  2009-09-17  7:54               ` tip-bot for Ingo Molnar
                                 ` (305 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-17  7:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  7d3c375e2281ec5f0e63f58e3fbfd0b41e530595
Gitweb:     http://git.kernel.org/tip/7d3c375e2281ec5f0e63f58e3fbfd0b41e530595
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 21:09:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 09:37:08 +0200

sched: Fix TASK_WAKING & loadaverage breakage

Fix this:

top - 21:54:00 up  2:59,  1 user,  load average: 432512.33, 426421.74, 417432.74

Which happens because we now set TASK_WAKING before activate_task().

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index f55133c..3bb4ea2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2343,7 +2343,11 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	/*
 	 * In order to handle concurrent wakeups and release the rq->lock
 	 * we put the task in TASK_WAKING state.
+	 *
+	 * First fix up the nr_uninterruptible count:
 	 */
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible--;
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 

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

* [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage
       [not found]             ` <new-submission>
                                 ` (400 preceding siblings ...)
  2009-09-17  7:49               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
@ 2009-09-17  7:54               ` tip-bot for Ingo Molnar
  2009-09-17  7:54               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING, disable FAIR_SLEEPERS tip-bot for Peter Zijlstra
                                 ` (304 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-17  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  eb24073bc1fe3e569a855cf38d529fb650c35524
Gitweb:     http://git.kernel.org/tip/eb24073bc1fe3e569a855cf38d529fb650c35524
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 16 Sep 2009 21:09:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 09:51:20 +0200

sched: Fix TASK_WAKING & loadaverage breakage

Fix this:

top - 21:54:00 up  2:59,  1 user,  load average: 432512.33, 426421.74, 417432.74

Which happens because we now set TASK_WAKING before activate_task().

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


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

diff --git a/kernel/sched.c b/kernel/sched.c
index 5049d95..969dfae 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2343,7 +2343,11 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	/*
 	 * In order to handle concurrent wakeups and release the rq->lock
 	 * we put the task in TASK_WAKING state.
+	 *
+	 * First fix up the nr_uninterruptible count:
 	 */
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible--;
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 

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

* [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING, disable FAIR_SLEEPERS
       [not found]             ` <new-submission>
                                 ` (401 preceding siblings ...)
  2009-09-17  7:54               ` tip-bot for Ingo Molnar
@ 2009-09-17  7:54               ` tip-bot for Peter Zijlstra
  2009-09-17  8:12               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
                                 ` (303 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, peterz, tglx, mingo

Commit-ID:  b438d34496c3c9fddc46012359e3bb2cf4df901e
Gitweb:     http://git.kernel.org/tip/b438d34496c3c9fddc46012359e3bb2cf4df901e
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 16 Sep 2009 12:31:31 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 09:51:48 +0200

sched: Add new wakeup preemption mode: WAKEUP_RUNNING, disable FAIR_SLEEPERS

Create a new wakeup preemption mode, preempt towards tasks that run
shorter on avg. It sets next buddy to be sure we actually run the task
we preempted for.

Also turn off FAIR_SLEEPERS - this new mechanism replaces it.

Test results:

 root@twins:~# while :; do :; done &
 [1] 6537
 root@twins:~# while :; do :; done &
 [2] 6538
 root@twins:~# while :; do :; done &
 [3] 6539
 root@twins:~# while :; do :; done &
 [4] 6540

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max          4750 usec
        Avg           497 usec
        Stdev         737 usec

 root@twins:/home/peter# echo WAKEUP_RUNNING > /debug/sched_features

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max            14 usec
        Avg             5 usec
        Stdev           3 usec

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


---
 include/linux/sched.h   |    2 ++
 kernel/sched.c          |   17 ++++++++++-------
 kernel/sched_debug.c    |    1 +
 kernel/sched_fair.c     |   14 +++++++++++---
 kernel/sched_features.h |    7 ++++++-
 5 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b4a39bb..8af3d24 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1113,6 +1113,8 @@ struct sched_entity {
 	u64			start_runtime;
 	u64			avg_wakeup;
 
+	u64			avg_running;
+
 #ifdef CONFIG_SCHEDSTATS
 	u64			wait_start;
 	u64			wait_max;
diff --git a/kernel/sched.c b/kernel/sched.c
index 969dfae..3bb4ea2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2458,6 +2458,7 @@ static void __sched_fork(struct task_struct *p)
 	p->se.avg_overlap		= 0;
 	p->se.start_runtime		= 0;
 	p->se.avg_wakeup		= sysctl_sched_wakeup_granularity;
+	p->se.avg_running		= 0;
 
 #ifdef CONFIG_SCHEDSTATS
 	p->se.wait_start			= 0;
@@ -5310,14 +5311,13 @@ static inline void schedule_debug(struct task_struct *prev)
 #endif
 }
 
-static void put_prev_task(struct rq *rq, struct task_struct *prev)
+static void put_prev_task(struct rq *rq, struct task_struct *p)
 {
-	if (prev->state == TASK_RUNNING) {
-		u64 runtime = prev->se.sum_exec_runtime;
+	u64 runtime = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime;
 
-		runtime -= prev->se.prev_sum_exec_runtime;
-		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+	update_avg(&p->se.avg_running, runtime);
 
+	if (p->state == TASK_RUNNING) {
 		/*
 		 * In order to avoid avg_overlap growing stale when we are
 		 * indeed overlapping and hence not getting put to sleep, grow
@@ -5327,9 +5327,12 @@ static void put_prev_task(struct rq *rq, struct task_struct *prev)
 		 * correlates to the amount of cache footprint a task can
 		 * build up.
 		 */
-		update_avg(&prev->se.avg_overlap, runtime);
+		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+		update_avg(&p->se.avg_overlap, runtime);
+	} else {
+		update_avg(&p->se.avg_running, 0);
 	}
-	prev->sched_class->put_prev_task(rq, prev);
+	p->sched_class->put_prev_task(rq, p);
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5ddbd08..efb8440 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -395,6 +395,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	PN(se.sum_exec_runtime);
 	PN(se.avg_overlap);
 	PN(se.avg_wakeup);
+	PN(se.avg_running);
 
 	nr_switches = p->nvcsw + p->nivcsw;
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c741cd9..3e6f78c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1605,9 +1605,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
-	if (!sched_feat(WAKEUP_PREEMPT))
-		return;
-
 	if ((sched_feat(WAKEUP_SYNC) && sync) ||
 	    (sched_feat(WAKEUP_OVERLAP) &&
 	     (se->avg_overlap < sysctl_sched_migration_cost &&
@@ -1616,6 +1613,17 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
+	if (sched_feat(WAKEUP_RUNNING)) {
+		if (pse->avg_running < se->avg_running) {
+			set_next_buddy(pse);
+			resched_task(curr);
+			return;
+		}
+	}
+
+	if (!sched_feat(WAKEUP_PREEMPT))
+		return;
+
 	find_matching_se(&se, &pse);
 
 	BUG_ON(!pse);
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index d5059fd..929308c 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -3,7 +3,7 @@
  * considers the task to be running during that period. This gives it
  * a service deficit on wakeup, allowing it to run sooner.
  */
-SCHED_FEAT(FAIR_SLEEPERS, 1)
+SCHED_FEAT(FAIR_SLEEPERS, 0)
 
 /*
  * Only give sleepers 50% of their service deficit. This allows
@@ -54,6 +54,11 @@ SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 
 /*
+ * Wakeup preemption towards tasks that run short
+ */
+SCHED_FEAT(WAKEUP_RUNNING, 1)
+
+/*
  * Use the SYNC wakeup hint, pipes and the likes use this to indicate
  * the remote end is likely to consume the data we just wrote, and
  * therefore has cache benefit from being placed on the same cpu, see

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

* [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING
       [not found]             ` <new-submission>
                                 ` (402 preceding siblings ...)
  2009-09-17  7:54               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING, disable FAIR_SLEEPERS tip-bot for Peter Zijlstra
@ 2009-09-17  8:12               ` tip-bot for Peter Zijlstra
  2009-09-17  8:18               ` tip-bot for Peter Zijlstra
                                 ` (302 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  8:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, peterz, tglx, mingo

Commit-ID:  ea3725c5ef1c51023c8ca3b61a433c0915aa7ce4
Gitweb:     http://git.kernel.org/tip/ea3725c5ef1c51023c8ca3b61a433c0915aa7ce4
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 16 Sep 2009 12:31:31 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 10:09:43 +0200

sched: Add new wakeup preemption mode: WAKEUP_RUNNING

Create a new wakeup preemption mode, preempt towards tasks that run
shorter on avg. It sets next buddy to be sure we actually run the task
we preempted for.

Test results:

 root@twins:~# while :; do :; done &
 [1] 6537
 root@twins:~# while :; do :; done &
 [2] 6538
 root@twins:~# while :; do :; done &
 [3] 6539
 root@twins:~# while :; do :; done &
 [4] 6540

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max          4750 usec
        Avg           497 usec
        Stdev         737 usec

 root@twins:/home/peter# echo WAKEUP_RUNNING > /debug/sched_features

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max            14 usec
        Avg             5 usec
        Stdev           3 usec

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


---
 include/linux/sched.h   |    2 ++
 kernel/sched.c          |   17 ++++++++++-------
 kernel/sched_debug.c    |    1 +
 kernel/sched_fair.c     |   14 +++++++++++---
 kernel/sched_features.h |    5 +++++
 5 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b4a39bb..8af3d24 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1113,6 +1113,8 @@ struct sched_entity {
 	u64			start_runtime;
 	u64			avg_wakeup;
 
+	u64			avg_running;
+
 #ifdef CONFIG_SCHEDSTATS
 	u64			wait_start;
 	u64			wait_max;
diff --git a/kernel/sched.c b/kernel/sched.c
index 969dfae..3bb4ea2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2458,6 +2458,7 @@ static void __sched_fork(struct task_struct *p)
 	p->se.avg_overlap		= 0;
 	p->se.start_runtime		= 0;
 	p->se.avg_wakeup		= sysctl_sched_wakeup_granularity;
+	p->se.avg_running		= 0;
 
 #ifdef CONFIG_SCHEDSTATS
 	p->se.wait_start			= 0;
@@ -5310,14 +5311,13 @@ static inline void schedule_debug(struct task_struct *prev)
 #endif
 }
 
-static void put_prev_task(struct rq *rq, struct task_struct *prev)
+static void put_prev_task(struct rq *rq, struct task_struct *p)
 {
-	if (prev->state == TASK_RUNNING) {
-		u64 runtime = prev->se.sum_exec_runtime;
+	u64 runtime = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime;
 
-		runtime -= prev->se.prev_sum_exec_runtime;
-		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+	update_avg(&p->se.avg_running, runtime);
 
+	if (p->state == TASK_RUNNING) {
 		/*
 		 * In order to avoid avg_overlap growing stale when we are
 		 * indeed overlapping and hence not getting put to sleep, grow
@@ -5327,9 +5327,12 @@ static void put_prev_task(struct rq *rq, struct task_struct *prev)
 		 * correlates to the amount of cache footprint a task can
 		 * build up.
 		 */
-		update_avg(&prev->se.avg_overlap, runtime);
+		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+		update_avg(&p->se.avg_overlap, runtime);
+	} else {
+		update_avg(&p->se.avg_running, 0);
 	}
-	prev->sched_class->put_prev_task(rq, prev);
+	p->sched_class->put_prev_task(rq, p);
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5ddbd08..efb8440 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -395,6 +395,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	PN(se.sum_exec_runtime);
 	PN(se.avg_overlap);
 	PN(se.avg_wakeup);
+	PN(se.avg_running);
 
 	nr_switches = p->nvcsw + p->nivcsw;
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c741cd9..3e6f78c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1605,9 +1605,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
-	if (!sched_feat(WAKEUP_PREEMPT))
-		return;
-
 	if ((sched_feat(WAKEUP_SYNC) && sync) ||
 	    (sched_feat(WAKEUP_OVERLAP) &&
 	     (se->avg_overlap < sysctl_sched_migration_cost &&
@@ -1616,6 +1613,17 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
+	if (sched_feat(WAKEUP_RUNNING)) {
+		if (pse->avg_running < se->avg_running) {
+			set_next_buddy(pse);
+			resched_task(curr);
+			return;
+		}
+	}
+
+	if (!sched_feat(WAKEUP_PREEMPT))
+		return;
+
 	find_matching_se(&se, &pse);
 
 	BUG_ON(!pse);
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index d5059fd..eba3faa 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -54,6 +54,11 @@ SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 
 /*
+ * Wakeup preemption towards tasks that run short
+ */
+SCHED_FEAT(WAKEUP_RUNNING, 1)
+
+/*
  * Use the SYNC wakeup hint, pipes and the likes use this to indicate
  * the remote end is likely to consume the data we just wrote, and
  * therefore has cache benefit from being placed on the same cpu, see

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

* [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING
       [not found]             ` <new-submission>
                                 ` (403 preceding siblings ...)
  2009-09-17  8:12               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
@ 2009-09-17  8:18               ` tip-bot for Peter Zijlstra
  2009-09-17  8:54               ` [tip:sched/core] sched: Stop buddies from hogging the system tip-bot for Peter Zijlstra
                                 ` (301 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  8:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, peterz, tglx, mingo

Commit-ID:  ad4b78bbcbab66998b05d422ac6106b645796e54
Gitweb:     http://git.kernel.org/tip/ad4b78bbcbab66998b05d422ac6106b645796e54
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 16 Sep 2009 12:31:31 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 10:17:25 +0200

sched: Add new wakeup preemption mode: WAKEUP_RUNNING

Create a new wakeup preemption mode, preempt towards tasks that run
shorter on avg. It sets next buddy to be sure we actually run the task
we preempted for.

Test results:

 root@twins:~# while :; do :; done &
 [1] 6537
 root@twins:~# while :; do :; done &
 [2] 6538
 root@twins:~# while :; do :; done &
 [3] 6539
 root@twins:~# while :; do :; done &
 [4] 6540

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max          4750 usec
        Avg           497 usec
        Stdev         737 usec

 root@twins:/home/peter# echo WAKEUP_RUNNING > /debug/sched_features

 root@twins:/home/peter# ./latt -c4 sleep 4
 Entries: 48 (clients=4)

 Averages:
 ------------------------------
        Max            14 usec
        Avg             5 usec
        Stdev           3 usec

Disabled by default - needs more testing.

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


---
 include/linux/sched.h   |    2 ++
 kernel/sched.c          |   17 ++++++++++-------
 kernel/sched_debug.c    |    1 +
 kernel/sched_fair.c     |   14 +++++++++++---
 kernel/sched_features.h |    5 +++++
 5 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b4a39bb..8af3d24 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1113,6 +1113,8 @@ struct sched_entity {
 	u64			start_runtime;
 	u64			avg_wakeup;
 
+	u64			avg_running;
+
 #ifdef CONFIG_SCHEDSTATS
 	u64			wait_start;
 	u64			wait_max;
diff --git a/kernel/sched.c b/kernel/sched.c
index 969dfae..3bb4ea2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2458,6 +2458,7 @@ static void __sched_fork(struct task_struct *p)
 	p->se.avg_overlap		= 0;
 	p->se.start_runtime		= 0;
 	p->se.avg_wakeup		= sysctl_sched_wakeup_granularity;
+	p->se.avg_running		= 0;
 
 #ifdef CONFIG_SCHEDSTATS
 	p->se.wait_start			= 0;
@@ -5310,14 +5311,13 @@ static inline void schedule_debug(struct task_struct *prev)
 #endif
 }
 
-static void put_prev_task(struct rq *rq, struct task_struct *prev)
+static void put_prev_task(struct rq *rq, struct task_struct *p)
 {
-	if (prev->state == TASK_RUNNING) {
-		u64 runtime = prev->se.sum_exec_runtime;
+	u64 runtime = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime;
 
-		runtime -= prev->se.prev_sum_exec_runtime;
-		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+	update_avg(&p->se.avg_running, runtime);
 
+	if (p->state == TASK_RUNNING) {
 		/*
 		 * In order to avoid avg_overlap growing stale when we are
 		 * indeed overlapping and hence not getting put to sleep, grow
@@ -5327,9 +5327,12 @@ static void put_prev_task(struct rq *rq, struct task_struct *prev)
 		 * correlates to the amount of cache footprint a task can
 		 * build up.
 		 */
-		update_avg(&prev->se.avg_overlap, runtime);
+		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
+		update_avg(&p->se.avg_overlap, runtime);
+	} else {
+		update_avg(&p->se.avg_running, 0);
 	}
-	prev->sched_class->put_prev_task(rq, prev);
+	p->sched_class->put_prev_task(rq, p);
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5ddbd08..efb8440 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -395,6 +395,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	PN(se.sum_exec_runtime);
 	PN(se.avg_overlap);
 	PN(se.avg_wakeup);
+	PN(se.avg_running);
 
 	nr_switches = p->nvcsw + p->nivcsw;
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c741cd9..3e6f78c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1605,9 +1605,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
-	if (!sched_feat(WAKEUP_PREEMPT))
-		return;
-
 	if ((sched_feat(WAKEUP_SYNC) && sync) ||
 	    (sched_feat(WAKEUP_OVERLAP) &&
 	     (se->avg_overlap < sysctl_sched_migration_cost &&
@@ -1616,6 +1613,17 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 	}
 
+	if (sched_feat(WAKEUP_RUNNING)) {
+		if (pse->avg_running < se->avg_running) {
+			set_next_buddy(pse);
+			resched_task(curr);
+			return;
+		}
+	}
+
+	if (!sched_feat(WAKEUP_PREEMPT))
+		return;
+
 	find_matching_se(&se, &pse);
 
 	BUG_ON(!pse);
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index d5059fd..0d94083 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -54,6 +54,11 @@ SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 
 /*
+ * Wakeup preemption towards tasks that run short
+ */
+SCHED_FEAT(WAKEUP_RUNNING, 0)
+
+/*
  * Use the SYNC wakeup hint, pipes and the likes use this to indicate
  * the remote end is likely to consume the data we just wrote, and
  * therefore has cache benefit from being placed on the same cpu, see

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

* [tip:sched/core] sched: Stop buddies from hogging the system
       [not found]             ` <new-submission>
                                 ` (404 preceding siblings ...)
  2009-09-17  8:18               ` tip-bot for Peter Zijlstra
@ 2009-09-17  8:54               ` tip-bot for Peter Zijlstra
  2009-09-17  8:54               ` [tip:sched/core] sched: Fix SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL vs SD_WAKE_AFFINE tip-bot for Peter Zijlstra
                                 ` (300 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  8:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  de69a80be32445b0a71e8e3b757e584d7beb90f7
Gitweb:     http://git.kernel.org/tip/de69a80be32445b0a71e8e3b757e584d7beb90f7
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 09:01:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 10:40:30 +0200

sched: Stop buddies from hogging the system

Clear buddies more agressively.

The (theoretical, haven't actually observed any of this) problem is
that when we do not select either buddy in pick_next_entity()
because they are too far ahead of the left-most task, we do not
clear the buddies.

This means that as soon as we service the left-most task, these
same buddies will be tried again on the next schedule. Now if the
left-most task was a pure hog, it wouldn't have done any wakeups
and it wouldn't have set buddies of its own. That leads to the old
buddies dominating, which would lead to bad latencies.

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


---
 kernel/sched_fair.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 3e6f78c..ffee827 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -764,10 +764,10 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
 
 static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-	if (cfs_rq->last == se)
+	if (!se || cfs_rq->last == se)
 		cfs_rq->last = NULL;
 
-	if (cfs_rq->next == se)
+	if (!se || cfs_rq->next == se)
 		cfs_rq->next = NULL;
 }
 
@@ -1646,8 +1646,13 @@ static struct task_struct *pick_next_task_fair(struct rq *rq)
 		/*
 		 * If se was a buddy, clear it so that it will have to earn
 		 * the favour again.
+		 *
+		 * If se was not a buddy, clear the buddies because neither
+		 * was elegible to run, let them earn it again.
+		 *
+		 * IOW. unconditionally clear buddies.
 		 */
-		__clear_buddies(cfs_rq, se);
+		__clear_buddies(cfs_rq, NULL);
 		set_next_entity(cfs_rq, se);
 		cfs_rq = group_cfs_rq(se);
 	} while (cfs_rq);

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

* [tip:sched/core] sched: Fix SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL vs SD_WAKE_AFFINE
       [not found]             ` <new-submission>
                                 ` (405 preceding siblings ...)
  2009-09-17  8:54               ` [tip:sched/core] sched: Stop buddies from hogging the system tip-bot for Peter Zijlstra
@ 2009-09-17  8:54               ` tip-bot for Peter Zijlstra
  2009-09-17 18:07               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
                                 ` (299 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17  8:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  29cd8bae396583a2ee9a3340db8c5102acf9f6fd
Gitweb:     http://git.kernel.org/tip/29cd8bae396583a2ee9a3340db8c5102acf9f6fd
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 09:01:14 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 10:40:31 +0200

sched: Fix SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL vs SD_WAKE_AFFINE

The SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL code can break out of
the domain iteration early, making us miss the SD_WAKE_AFFINE bits.

Fix this by continuing iteration until there is no need for a
larger domain.

This also cleans up the cgroup stuff a bit, but not having two
update_shares() invocations.

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 |   42 +++++++++++++++++++++++++++---------------
 1 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ffee827..10d218a 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1333,11 +1333,12 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
  */
 static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
 {
-	struct sched_domain *tmp, *shares = NULL, *sd = NULL;
+	struct sched_domain *tmp, *affine_sd = NULL, *sd = NULL;
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
 	int new_cpu = cpu;
 	int want_affine = 0;
+	int want_sd = 1;
 	int sync = wake_flags & WF_SYNC;
 
 	if (sd_flag & SD_BALANCE_WAKE) {
@@ -1369,33 +1370,44 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 				nr_running /= 2;
 
 			if (nr_running < capacity)
-				break;
+				want_sd = 0;
 		}
 
 		if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
 		    cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
 
-			if (sched_feat(LB_SHARES_UPDATE)) {
-				update_shares(tmp);
-				shares = tmp;
-			}
-
-			if (wake_affine(tmp, p, sync)) {
-				new_cpu = cpu;
-				goto out;
-			}
-
+			affine_sd = tmp;
 			want_affine = 0;
 		}
 
+		if (!want_sd && !want_affine)
+			break;
+
 		if (!(tmp->flags & sd_flag))
 			continue;
 
-		sd = tmp;
+		if (want_sd)
+			sd = tmp;
+	}
+
+	if (sched_feat(LB_SHARES_UPDATE)) {
+		/*
+		 * Pick the largest domain to update shares over
+		 */
+		tmp = sd;
+		if (affine_sd && (!tmp ||
+				  cpumask_weight(sched_domain_span(affine_sd)) >
+				  cpumask_weight(sched_domain_span(sd))))
+			tmp = affine_sd;
+
+		if (tmp)
+			update_shares(tmp);
 	}
 
-	if (sd && sd != shares && sched_feat(LB_SHARES_UPDATE))
-		update_shares(sd);
+	if (affine_sd && wake_affine(affine_sd, p, sync)) {
+		new_cpu = cpu;
+		goto out;
+	}
 
 	while (sd) {
 		int load_idx = sd->forkexec_idx;

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

* [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically
       [not found]             ` <new-submission>
                                 ` (406 preceding siblings ...)
  2009-09-17  8:54               ` [tip:sched/core] sched: Fix SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL vs SD_WAKE_AFFINE tip-bot for Peter Zijlstra
@ 2009-09-17 18:07               ` tip-bot for Ingo Molnar
  2009-09-17 19:34                 ` Arjan van de Ven
  2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
                                 ` (298 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-17 18:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  5349256ab12dcbc766495cd1cf3651f7203f8564
Gitweb:     http://git.kernel.org/tip/5349256ab12dcbc766495cd1cf3651f7203f8564
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 17 Sep 2009 18:24:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 18:24:55 +0200

perf sched: Determine the number of CPUs automatically

For 'perf sched map' output, determine max_cpu automatically,
instead of the static default of 15.

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/builtin-sched.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index f67e351..947fd71 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1347,7 +1347,7 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
  * Track the current task - that way we can know whether there's any
  * weird events, such as a task being switched away that is not current.
  */
-static int max_cpu = 15;
+static int max_cpu;
 
 static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
 
@@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops  = {
 
 static void __cmd_map(void)
 {
+	max_cpu = system("exit `grep ^processor /proc/cpuinfo  | wc -l`");
+	max_cpu = WEXITSTATUS(max_cpu)-1;
+
 	setup_pager();
 	read_events();
 	print_bad_events();

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

* [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events
       [not found]             ` <new-submission>
                                 ` (407 preceding siblings ...)
  2009-09-17 18:07               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
@ 2009-09-17 18:07               ` tip-bot for Peter Zijlstra
  2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
                                 ` (297 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 18:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  584f7ccaaf27eb67ad137d867518db5c53286304
Gitweb:     http://git.kernel.org/tip/584f7ccaaf27eb67ad137d867518db5c53286304
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 18:47:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 20:02:46 +0200

perf_counter: Do not throttle single swcounter events

We can have swcounter events that contribute more than a single
count per event, when used with a non-zero period, those can
generate multiple events, which is when we need throttling.

However, swcounter that contribute only a single count per event
can only come as fast as we can run code, hence don't throttle
them.

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 |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 667ab25..fe0d1ad 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3494,14 +3494,15 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
  * Generic counter overflow handling, sampling.
  */
 
-int perf_counter_overflow(struct perf_counter *counter, int nmi,
-			  struct perf_sample_data *data)
+static int __perf_counter_overflow(struct perf_counter *counter, int nmi,
+				   int throttle, struct perf_sample_data *data)
 {
 	int events = atomic_read(&counter->event_limit);
-	int throttle = counter->pmu->unthrottle != NULL;
 	struct hw_perf_counter *hwc = &counter->hw;
 	int ret = 0;
 
+	throttle = (throttle && counter->pmu->unthrottle != NULL);
+
 	if (!throttle) {
 		hwc->interrupts++;
 	} else {
@@ -3554,6 +3555,12 @@ int perf_counter_overflow(struct perf_counter *counter, int nmi,
 	return ret;
 }
 
+int perf_counter_overflow(struct perf_counter *counter, int nmi,
+			  struct perf_sample_data *data)
+{
+	return __perf_counter_overflow(counter, nmi, 1, data);
+}
+
 /*
  * Generic software counter infrastructure
  */
@@ -3592,6 +3599,7 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 				    int nmi, struct perf_sample_data *data)
 {
 	struct hw_perf_counter *hwc = &counter->hw;
+	int throttle = 0;
 	u64 overflow;
 
 	data->period = counter->hw.last_period;
@@ -3601,13 +3609,14 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 		return;
 
 	for (; overflow; overflow--) {
-		if (perf_counter_overflow(counter, nmi, data)) {
+		if (__perf_counter_overflow(counter, nmi, throttle, data)) {
 			/*
 			 * We inhibit the overflow from happening when
 			 * hwc->interrupts == MAX_INTERRUPTS.
 			 */
 			break;
 		}
+		throttle = 0;
 	}
 }
 

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

* [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark
       [not found]             ` <new-submission>
                                 ` (408 preceding siblings ...)
  2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
@ 2009-09-17 18:07               ` tip-bot for Peter Zijlstra
  2009-09-17 18:07               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
                                 ` (296 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 18:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  0c733e0676f27fa325f6ba42f4035db8523abc90
Gitweb:     http://git.kernel.org/tip/0c733e0676f27fa325f6ba42f4035db8523abc90
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 19:01:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 20:02:46 +0200

perf_counter: Allow for a wakeup watermark

Currently we wake the mmap() consumer once every PAGE_SIZE of data
and/or once event wakeup_events when specified.

For high speed sampling this results in too many wakeups wrt. the
buffer size, hence change this.

We move the default wakeup limit to 1/4-th the buffer size, and
provide for means to manually specify this limit.

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        |   32 +++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 972f90d..6c1ef72 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -199,10 +199,14 @@ struct perf_counter_attr {
 				inherit_stat   :  1, /* per task counts       */
 				enable_on_exec :  1, /* next exec enables     */
 				task           :  1, /* trace fork/exit       */
+				watermark      :  1, /* wakeup_watermark      */
 
-				__reserved_1   : 50;
+				__reserved_1   : 49;
 
-	__u32			wakeup_events;	/* wakeup every n events */
+	union {
+		__u32		wakeup_events;	  /* wakeup every n events */
+		__u32		wakeup_watermark; /* bytes before wakeup   */
+	};
 	__u32			__reserved_2;
 
 	__u64			__reserved_3;
@@ -521,6 +525,8 @@ struct perf_mmap_data {
 	atomic_t			wakeup;		/* needs a wakeup    */
 	atomic_t			lost;		/* nr records lost   */
 
+	long				watermark;	/* wakeup watermark  */
+
 	struct perf_counter_mmap_page   *user_page;
 	void				*data_pages[0];
 };
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index fe0d1ad..29b73b6 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2176,6 +2176,13 @@ static int perf_mmap_data_alloc(struct perf_counter *counter, int nr_pages)
 	data->nr_pages = nr_pages;
 	atomic_set(&data->lock, -1);
 
+	if (counter->attr.watermark) {
+		data->watermark = min_t(long, PAGE_SIZE * nr_pages,
+				      counter->attr.wakeup_watermark);
+	}
+	if (!data->watermark)
+		data->watermark = max(PAGE_SIZE, PAGE_SIZE * nr_pages / 4);
+
 	rcu_assign_pointer(counter->data, data);
 
 	return 0;
@@ -2517,23 +2524,15 @@ struct perf_output_handle {
 	unsigned long		flags;
 };
 
-static bool perf_output_space(struct perf_mmap_data *data,
-			      unsigned int offset, unsigned int head)
+static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
+			      unsigned long offset, unsigned long 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;
@@ -2679,7 +2678,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
 {
 	struct perf_counter *output_counter;
 	struct perf_mmap_data *data;
-	unsigned int offset, head;
+	unsigned long tail, offset, head;
 	int have_lost;
 	struct {
 		struct perf_event_header header;
@@ -2717,16 +2716,23 @@ static int perf_output_begin(struct perf_output_handle *handle,
 	perf_output_lock(handle);
 
 	do {
+		/*
+		 * 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 = head = atomic_long_read(&data->head);
 		head += size;
-		if (unlikely(!perf_output_space(data, offset, head)))
+		if (unlikely(!perf_output_space(data, tail, offset, head)))
 			goto fail;
 	} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
 
 	handle->offset	= offset;
 	handle->head	= head;
 
-	if ((offset >> PAGE_SHIFT) != (head >> PAGE_SHIFT))
+	if (head - tail > data->watermark)
 		atomic_set(&data->wakeup, 1);
 
 	if (have_lost) {

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

* [tip:perfcounters/core] perf record: Disable profiling before draining the buffer
       [not found]             ` <new-submission>
                                 ` (409 preceding siblings ...)
  2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
@ 2009-09-17 18:07               ` tip-bot for Peter Zijlstra
  2009-09-17 20:12               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
                                 ` (295 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 18:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5abfd8bf28feeb633afdea2309fb0927d17606be
Gitweb:     http://git.kernel.org/tip/5abfd8bf28feeb633afdea2309fb0927d17606be
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 19:59:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 20:02:47 +0200

perf record: Disable profiling before draining the buffer

I noticed that perf-record continues profiling itself after the
child terminated and we're draining the buffer.

This can cause a _lot_ of overhead with --all recording - we keep
and keep recording, which produces new and new events.

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 |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5f3127e..2459e5a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -524,6 +524,7 @@ static int __cmd_record(int argc, const char **argv)
 	pid_t pid = 0;
 	int flags;
 	int ret;
+	unsigned long waking = 0;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -634,10 +635,20 @@ static int __cmd_record(int argc, const char **argv)
 		if (hits == samples) {
 			if (done)
 				break;
-			ret = poll(event_array, nr_poll, 100);
+			ret = poll(event_array, nr_poll, -1);
+			waking++;
+		}
+
+		if (done) {
+			for (i = 0; i < nr_cpu; i++) {
+				for (counter = 0; counter < nr_counters; counter++)
+					ioctl(fd[i][counter], PERF_COUNTER_IOC_DISABLE);
+			}
 		}
 	}
 
+	fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
+
 	/*
 	 * Approximate RIP event size: 24 bytes.
 	 */

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

* Re: [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically
  2009-09-17 18:07               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
@ 2009-09-17 19:34                 ` Arjan van de Ven
  2009-09-17 19:45                   ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Arjan van de Ven @ 2009-09-17 19:34 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, fweisbec, a.p.zijlstra,
	efault, tglx, mingo
  Cc: mingo, linux-tip-commits, linux-kernel, acme, paulus, hpa, mingo,
	a.p.zijlstra, efault, fweisbec, tglx

On Thu, 17 Sep 2009 18:07:09 GMT
> 
> perf sched: Determine the number of CPUs automatically
> 
> For 'perf sched map' output, determine max_cpu automatically,
> instead of the static default of 15.
>  
>  static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
>  
> @@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops  = {
>  
>  static void __cmd_map(void)
>  {
> +	max_cpu = system("exit `grep ^processor /proc/cpuinfo  | wc
> -l`");

YUCK.

what is wrong with
   max_cpu = sysconf(_SC_NPROCESSORS_CONF); 
??

-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* Re: [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically
  2009-09-17 19:34                 ` Arjan van de Ven
@ 2009-09-17 19:45                   ` Ingo Molnar
  2009-09-17 20:09                     ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-17 19:45 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: mingo, hpa, paulus, acme, linux-kernel, fweisbec, a.p.zijlstra,
	efault, tglx, linux-tip-commits


* Arjan van de Ven <arjan@infradead.org> wrote:

> On Thu, 17 Sep 2009 18:07:09 GMT
> > 
> > perf sched: Determine the number of CPUs automatically
> > 
> > For 'perf sched map' output, determine max_cpu automatically,
> > instead of the static default of 15.
> >  
> >  static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
> >  
> > @@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops  = {
> >  
> >  static void __cmd_map(void)
> >  {
> > +	max_cpu = system("exit `grep ^processor /proc/cpuinfo  | wc
> > -l`");
> 
> YUCK.
> 
> what is wrong with
>    max_cpu = sysconf(_SC_NPROCESSORS_CONF); 
> ??

That's nicer - mind sending a patch?

	Ingo

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

* Re: [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically
  2009-09-17 19:45                   ` Ingo Molnar
@ 2009-09-17 20:09                     ` Ingo Molnar
  0 siblings, 0 replies; 1150+ messages in thread
From: Ingo Molnar @ 2009-09-17 20:09 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: mingo, hpa, paulus, acme, linux-kernel, fweisbec, a.p.zijlstra,
	efault, tglx, linux-tip-commits


* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Arjan van de Ven <arjan@infradead.org> wrote:
> 
> > On Thu, 17 Sep 2009 18:07:09 GMT
> > > 
> > > perf sched: Determine the number of CPUs automatically
> > > 
> > > For 'perf sched map' output, determine max_cpu automatically,
> > > instead of the static default of 15.
> > >  
> > >  static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
> > >  
> > > @@ -1818,6 +1818,9 @@ static struct trace_sched_handler map_ops  = {
> > >  
> > >  static void __cmd_map(void)
> > >  {
> > > +	max_cpu = system("exit `grep ^processor /proc/cpuinfo  | wc
> > > -l`");
> > 
> > YUCK.
> > 
> > what is wrong with
> >    max_cpu = sysconf(_SC_NPROCESSORS_CONF); 
> > ??
> 
> That's nicer - mind sending a patch?

fixed this up myself.

	Ingo

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

* [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events
       [not found]             ` <new-submission>
                                 ` (410 preceding siblings ...)
  2009-09-17 18:07               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
@ 2009-09-17 20:12               ` tip-bot for Peter Zijlstra
  2009-09-17 20:13               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
                                 ` (294 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 20:12 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  850bc73ffcc99cddfb52bc23217c60810c508853
Gitweb:     http://git.kernel.org/tip/850bc73ffcc99cddfb52bc23217c60810c508853
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 18:47:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 22:08:25 +0200

perf_counter: Do not throttle single swcounter events

We can have swcounter events that contribute more than a single
count per event, when used with a non-zero period, those can
generate multiple events, which is when we need throttling.

However, swcounter that contribute only a single count per event
can only come as fast as we can run code, hence don't throttle
them.

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 |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 667ab25..fe0d1ad 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3494,14 +3494,15 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
  * Generic counter overflow handling, sampling.
  */
 
-int perf_counter_overflow(struct perf_counter *counter, int nmi,
-			  struct perf_sample_data *data)
+static int __perf_counter_overflow(struct perf_counter *counter, int nmi,
+				   int throttle, struct perf_sample_data *data)
 {
 	int events = atomic_read(&counter->event_limit);
-	int throttle = counter->pmu->unthrottle != NULL;
 	struct hw_perf_counter *hwc = &counter->hw;
 	int ret = 0;
 
+	throttle = (throttle && counter->pmu->unthrottle != NULL);
+
 	if (!throttle) {
 		hwc->interrupts++;
 	} else {
@@ -3554,6 +3555,12 @@ int perf_counter_overflow(struct perf_counter *counter, int nmi,
 	return ret;
 }
 
+int perf_counter_overflow(struct perf_counter *counter, int nmi,
+			  struct perf_sample_data *data)
+{
+	return __perf_counter_overflow(counter, nmi, 1, data);
+}
+
 /*
  * Generic software counter infrastructure
  */
@@ -3592,6 +3599,7 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 				    int nmi, struct perf_sample_data *data)
 {
 	struct hw_perf_counter *hwc = &counter->hw;
+	int throttle = 0;
 	u64 overflow;
 
 	data->period = counter->hw.last_period;
@@ -3601,13 +3609,14 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 		return;
 
 	for (; overflow; overflow--) {
-		if (perf_counter_overflow(counter, nmi, data)) {
+		if (__perf_counter_overflow(counter, nmi, throttle, data)) {
 			/*
 			 * We inhibit the overflow from happening when
 			 * hwc->interrupts == MAX_INTERRUPTS.
 			 */
 			break;
 		}
+		throttle = 0;
 	}
 }
 

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

* [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark
       [not found]             ` <new-submission>
                                 ` (411 preceding siblings ...)
  2009-09-17 20:12               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
@ 2009-09-17 20:13               ` tip-bot for Peter Zijlstra
  2009-09-17 20:13               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
                                 ` (293 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 20:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  2667de81f3256c944b06abdf2c56c2f192fcb724
Gitweb:     http://git.kernel.org/tip/2667de81f3256c944b06abdf2c56c2f192fcb724
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 19:01:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 22:08:26 +0200

perf_counter: Allow for a wakeup watermark

Currently we wake the mmap() consumer once every PAGE_SIZE of data
and/or once event wakeup_events when specified.

For high speed sampling this results in too many wakeups wrt. the
buffer size, hence change this.

We move the default wakeup limit to 1/4-th the buffer size, and
provide for means to manually specify this limit.

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        |   32 +++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 972f90d..6c1ef72 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -199,10 +199,14 @@ struct perf_counter_attr {
 				inherit_stat   :  1, /* per task counts       */
 				enable_on_exec :  1, /* next exec enables     */
 				task           :  1, /* trace fork/exit       */
+				watermark      :  1, /* wakeup_watermark      */
 
-				__reserved_1   : 50;
+				__reserved_1   : 49;
 
-	__u32			wakeup_events;	/* wakeup every n events */
+	union {
+		__u32		wakeup_events;	  /* wakeup every n events */
+		__u32		wakeup_watermark; /* bytes before wakeup   */
+	};
 	__u32			__reserved_2;
 
 	__u64			__reserved_3;
@@ -521,6 +525,8 @@ struct perf_mmap_data {
 	atomic_t			wakeup;		/* needs a wakeup    */
 	atomic_t			lost;		/* nr records lost   */
 
+	long				watermark;	/* wakeup watermark  */
+
 	struct perf_counter_mmap_page   *user_page;
 	void				*data_pages[0];
 };
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index fe0d1ad..29b73b6 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2176,6 +2176,13 @@ static int perf_mmap_data_alloc(struct perf_counter *counter, int nr_pages)
 	data->nr_pages = nr_pages;
 	atomic_set(&data->lock, -1);
 
+	if (counter->attr.watermark) {
+		data->watermark = min_t(long, PAGE_SIZE * nr_pages,
+				      counter->attr.wakeup_watermark);
+	}
+	if (!data->watermark)
+		data->watermark = max(PAGE_SIZE, PAGE_SIZE * nr_pages / 4);
+
 	rcu_assign_pointer(counter->data, data);
 
 	return 0;
@@ -2517,23 +2524,15 @@ struct perf_output_handle {
 	unsigned long		flags;
 };
 
-static bool perf_output_space(struct perf_mmap_data *data,
-			      unsigned int offset, unsigned int head)
+static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
+			      unsigned long offset, unsigned long 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;
@@ -2679,7 +2678,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
 {
 	struct perf_counter *output_counter;
 	struct perf_mmap_data *data;
-	unsigned int offset, head;
+	unsigned long tail, offset, head;
 	int have_lost;
 	struct {
 		struct perf_event_header header;
@@ -2717,16 +2716,23 @@ static int perf_output_begin(struct perf_output_handle *handle,
 	perf_output_lock(handle);
 
 	do {
+		/*
+		 * 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 = head = atomic_long_read(&data->head);
 		head += size;
-		if (unlikely(!perf_output_space(data, offset, head)))
+		if (unlikely(!perf_output_space(data, tail, offset, head)))
 			goto fail;
 	} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
 
 	handle->offset	= offset;
 	handle->head	= head;
 
-	if ((offset >> PAGE_SHIFT) != (head >> PAGE_SHIFT))
+	if (head - tail > data->watermark)
 		atomic_set(&data->wakeup, 1);
 
 	if (have_lost) {

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

* [tip:perfcounters/core] perf record: Disable profiling before draining the buffer
       [not found]             ` <new-submission>
                                 ` (412 preceding siblings ...)
  2009-09-17 20:13               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
@ 2009-09-17 20:13               ` tip-bot for Peter Zijlstra
  2009-09-17 20:13               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
                                 ` (292 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-17 20:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8b412664d0a487c2e16ac43f4fcede346df33254
Gitweb:     http://git.kernel.org/tip/8b412664d0a487c2e16ac43f4fcede346df33254
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Sep 2009 19:59:05 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 22:08:27 +0200

perf record: Disable profiling before draining the buffer

I noticed that perf-record continues profiling itself after the
child terminated and we're draining the buffer.

This can cause a _lot_ of overhead with --all recording - we keep
and keep recording, which produces new and new events.

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 |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5f3127e..2459e5a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -524,6 +524,7 @@ static int __cmd_record(int argc, const char **argv)
 	pid_t pid = 0;
 	int flags;
 	int ret;
+	unsigned long waking = 0;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -634,10 +635,20 @@ static int __cmd_record(int argc, const char **argv)
 		if (hits == samples) {
 			if (done)
 				break;
-			ret = poll(event_array, nr_poll, 100);
+			ret = poll(event_array, nr_poll, -1);
+			waking++;
+		}
+
+		if (done) {
+			for (i = 0; i < nr_cpu; i++) {
+				for (counter = 0; counter < nr_counters; counter++)
+					ioctl(fd[i][counter], PERF_COUNTER_IOC_DISABLE);
+			}
 		}
 	}
 
+	fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
+
 	/*
 	 * Approximate RIP event size: 24 bytes.
 	 */

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

* [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically
       [not found]             ` <new-submission>
                                 ` (413 preceding siblings ...)
  2009-09-17 20:13               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
@ 2009-09-17 20:13               ` tip-bot for Ingo Molnar
  2009-09-18 19:18               ` [tip:perfcounters/core] perf_counter: Fix up swcounter throttling tip-bot for Peter Zijlstra
                                 ` (291 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-17 20:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  40749d0ff49f99c3661b336fe5e5625207bd925a
Gitweb:     http://git.kernel.org/tip/40749d0ff49f99c3661b336fe5e5625207bd925a
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 17 Sep 2009 18:24:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Sep 2009 22:09:19 +0200

perf sched: Determine the number of CPUs automatically

For 'perf sched map' output, determine max_cpu automatically,
instead of the static default of 15.

[ v2: use sysconf() pointed out by 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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-sched.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index f67e351..9e04827 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1347,7 +1347,7 @@ process_sched_wakeup_event(struct raw_event_sample *raw,
  * Track the current task - that way we can know whether there's any
  * weird events, such as a task being switched away that is not current.
  */
-static int max_cpu = 15;
+static int max_cpu;
 
 static u32 curr_pid[MAX_CPUS] = { [0 ... MAX_CPUS-1] = -1 };
 
@@ -1818,6 +1818,8 @@ static struct trace_sched_handler map_ops  = {
 
 static void __cmd_map(void)
 {
+	max_cpu = sysconf(_SC_NPROCESSORS_CONF);
+
 	setup_pager();
 	read_events();
 	print_bad_events();

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

* [tip:perfcounters/core] perf_counter: Fix up swcounter throttling
       [not found]             ` <new-submission>
                                 ` (414 preceding siblings ...)
  2009-09-17 20:13               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
@ 2009-09-18 19:18               ` tip-bot for Peter Zijlstra
  2009-09-18 19:19               ` [tip:perfcounters/core] sched_clock: Make it NMI safe tip-bot for Peter Zijlstra
                                 ` (290 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-18 19:18 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cf450a7355a116af793998c118a6bcf7f5a8367e
Gitweb:     http://git.kernel.org/tip/cf450a7355a116af793998c118a6bcf7f5a8367e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 18 Sep 2009 12:18:14 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 18 Sep 2009 20:43:22 +0200

perf_counter: Fix up swcounter throttling

/me dons the brown paper bag.

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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 2158452..6944bd5 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3634,7 +3634,7 @@ static void perf_swcounter_overflow(struct perf_counter *counter,
 			 */
 			break;
 		}
-		throttle = 0;
+		throttle = 1;
 	}
 }
 

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

* [tip:perfcounters/core] sched_clock: Make it NMI safe
       [not found]             ` <new-submission>
                                 ` (415 preceding siblings ...)
  2009-09-18 19:18               ` [tip:perfcounters/core] perf_counter: Fix up swcounter throttling tip-bot for Peter Zijlstra
@ 2009-09-18 19:19               ` tip-bot for Peter Zijlstra
  2009-09-19 15:16               ` [tip:sched/urgent] sched: Re-add lost cpu_allowed check to sched_fair.c::select_task_rq_fair() tip-bot for Mike Galbraith
                                 ` (289 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-18 19:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  def0a9b2573e00ab0b486cb5382625203ab4c4a6
Gitweb:     http://git.kernel.org/tip/def0a9b2573e00ab0b486cb5382625203ab4c4a6
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 18 Sep 2009 20:14:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 18 Sep 2009 20:47:30 +0200

sched_clock: Make it NMI safe

Arjan complained about the suckyness of TSC on modern machines, and
asked if we could do something about that for PERF_SAMPLE_TIME.

Make cpu_clock() NMI safe by removing the spinlock and using
cmpxchg. This also makes it smaller and more robust.

Affects architectures that use HAVE_UNSTABLE_SCHED_CLOCK, i.e. IA64
and x86.

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 |    9 +--
 kernel/sched_clock.c  |  122 +++++++++++++++++++++---------------------------
 2 files changed, 56 insertions(+), 75 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 6944bd5..06d233a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2955,10 +2955,7 @@ void perf_prepare_sample(struct perf_event_header *header,
 	}
 
 	if (sample_type & PERF_SAMPLE_TIME) {
-		/*
-		 * Maybe do better on x86 and provide cpu_clock_nmi()
-		 */
-		data->time = sched_clock();
+		data->time = perf_clock();
 
 		header->size += sizeof(data->time);
 	}
@@ -3488,7 +3485,7 @@ static void perf_log_throttle(struct perf_counter *counter, int enable)
 			.misc = 0,
 			.size = sizeof(throttle_event),
 		},
-		.time		= sched_clock(),
+		.time		= perf_clock(),
 		.id		= primary_counter_id(counter),
 		.stream_id	= counter->id,
 	};
@@ -3540,7 +3537,7 @@ static int __perf_counter_overflow(struct perf_counter *counter, int nmi,
 	}
 
 	if (counter->attr.freq) {
-		u64 now = sched_clock();
+		u64 now = perf_clock();
 		s64 delta = now - hwc->freq_stamp;
 
 		hwc->freq_stamp = now;
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index e1d16c9..ac2e1dc 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -48,13 +48,6 @@ static __read_mostly int sched_clock_running;
 __read_mostly int sched_clock_stable;
 
 struct sched_clock_data {
-	/*
-	 * Raw spinlock - this is a special case: this might be called
-	 * from within instrumentation code so we dont want to do any
-	 * instrumentation ourselves.
-	 */
-	raw_spinlock_t		lock;
-
 	u64			tick_raw;
 	u64			tick_gtod;
 	u64			clock;
@@ -80,7 +73,6 @@ void sched_clock_init(void)
 	for_each_possible_cpu(cpu) {
 		struct sched_clock_data *scd = cpu_sdc(cpu);
 
-		scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
 		scd->tick_raw = 0;
 		scd->tick_gtod = ktime_now;
 		scd->clock = ktime_now;
@@ -109,14 +101,19 @@ static inline u64 wrap_max(u64 x, u64 y)
  *  - filter out backward motion
  *  - use the GTOD tick value to create a window to filter crazy TSC values
  */
-static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
+static u64 sched_clock_local(struct sched_clock_data *scd)
 {
-	s64 delta = now - scd->tick_raw;
-	u64 clock, min_clock, max_clock;
+	u64 now, clock, old_clock, min_clock, max_clock;
+	s64 delta;
 
+again:
+	now = sched_clock();
+	delta = now - scd->tick_raw;
 	if (unlikely(delta < 0))
 		delta = 0;
 
+	old_clock = scd->clock;
+
 	/*
 	 * scd->clock = clamp(scd->tick_gtod + delta,
 	 *		      max(scd->tick_gtod, scd->clock),
@@ -124,84 +121,73 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
 	 */
 
 	clock = scd->tick_gtod + delta;
-	min_clock = wrap_max(scd->tick_gtod, scd->clock);
-	max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC);
+	min_clock = wrap_max(scd->tick_gtod, old_clock);
+	max_clock = wrap_max(old_clock, scd->tick_gtod + TICK_NSEC);
 
 	clock = wrap_max(clock, min_clock);
 	clock = wrap_min(clock, max_clock);
 
-	scd->clock = clock;
+	if (cmpxchg(&scd->clock, old_clock, clock) != old_clock)
+		goto again;
 
-	return scd->clock;
+	return clock;
 }
 
-static void lock_double_clock(struct sched_clock_data *data1,
-				struct sched_clock_data *data2)
+static u64 sched_clock_remote(struct sched_clock_data *scd)
 {
-	if (data1 < data2) {
-		__raw_spin_lock(&data1->lock);
-		__raw_spin_lock(&data2->lock);
+	struct sched_clock_data *my_scd = this_scd();
+	u64 this_clock, remote_clock;
+	u64 *ptr, old_val, val;
+
+	sched_clock_local(my_scd);
+again:
+	this_clock = my_scd->clock;
+	remote_clock = scd->clock;
+
+	/*
+	 * Use the opportunity that we have both locks
+	 * taken to couple the two clocks: we take the
+	 * larger time as the latest time for both
+	 * runqueues. (this creates monotonic movement)
+	 */
+	if (likely((s64)(remote_clock - this_clock) < 0)) {
+		ptr = &scd->clock;
+		old_val = remote_clock;
+		val = this_clock;
 	} else {
-		__raw_spin_lock(&data2->lock);
-		__raw_spin_lock(&data1->lock);
+		/*
+		 * Should be rare, but possible:
+		 */
+		ptr = &my_scd->clock;
+		old_val = this_clock;
+		val = remote_clock;
 	}
+
+	if (cmpxchg(ptr, old_val, val) != old_val)
+		goto again;
+
+	return val;
 }
 
 u64 sched_clock_cpu(int cpu)
 {
-	u64 now, clock, this_clock, remote_clock;
 	struct sched_clock_data *scd;
+	u64 clock;
+
+	WARN_ON_ONCE(!irqs_disabled());
 
 	if (sched_clock_stable)
 		return sched_clock();
 
-	scd = cpu_sdc(cpu);
-
-	/*
-	 * Normally this is not called in NMI context - but if it is,
-	 * trying to do any locking here is totally lethal.
-	 */
-	if (unlikely(in_nmi()))
-		return scd->clock;
-
 	if (unlikely(!sched_clock_running))
 		return 0ull;
 
-	WARN_ON_ONCE(!irqs_disabled());
-	now = sched_clock();
-
-	if (cpu != raw_smp_processor_id()) {
-		struct sched_clock_data *my_scd = this_scd();
-
-		lock_double_clock(scd, my_scd);
-
-		this_clock = __update_sched_clock(my_scd, now);
-		remote_clock = scd->clock;
-
-		/*
-		 * Use the opportunity that we have both locks
-		 * taken to couple the two clocks: we take the
-		 * larger time as the latest time for both
-		 * runqueues. (this creates monotonic movement)
-		 */
-		if (likely((s64)(remote_clock - this_clock) < 0)) {
-			clock = this_clock;
-			scd->clock = clock;
-		} else {
-			/*
-			 * Should be rare, but possible:
-			 */
-			clock = remote_clock;
-			my_scd->clock = remote_clock;
-		}
-
-		__raw_spin_unlock(&my_scd->lock);
-	} else {
-		__raw_spin_lock(&scd->lock);
-		clock = __update_sched_clock(scd, now);
-	}
+	scd = cpu_sdc(cpu);
 
-	__raw_spin_unlock(&scd->lock);
+	if (cpu != smp_processor_id())
+		clock = sched_clock_remote(scd);
+	else
+		clock = sched_clock_local(scd);
 
 	return clock;
 }
@@ -223,11 +209,9 @@ void sched_clock_tick(void)
 	now_gtod = ktime_to_ns(ktime_get());
 	now = sched_clock();
 
-	__raw_spin_lock(&scd->lock);
 	scd->tick_raw = now;
 	scd->tick_gtod = now_gtod;
-	__update_sched_clock(scd, now);
-	__raw_spin_unlock(&scd->lock);
+	sched_clock_local(scd);
 }
 
 /*

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

* [tip:sched/urgent] sched: Re-add lost cpu_allowed check to sched_fair.c::select_task_rq_fair()
       [not found]             ` <new-submission>
                                 ` (416 preceding siblings ...)
  2009-09-18 19:19               ` [tip:perfcounters/core] sched_clock: Make it NMI safe tip-bot for Peter Zijlstra
@ 2009-09-19 15:16               ` tip-bot for Mike Galbraith
  2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename list_entry -> group_entry, counter_list -> group_list tip-bot for Ingo Molnar
                                 ` (288 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-09-19 15:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  3f04e8cd5b24727a2500f8ab8f3de730ba47b02c
Gitweb:     http://git.kernel.org/tip/3f04e8cd5b24727a2500f8ab8f3de730ba47b02c
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Sat, 19 Sep 2009 16:52:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 19 Sep 2009 17:11:31 +0200

sched: Re-add lost cpu_allowed check to sched_fair.c::select_task_rq_fair()

While doing some testing, I pinned mplayer, only to find it
following X around like a puppy. Looking at commit c88d591, I found
a cpu_allowed check that went AWOL.  I plugged it back in where it
looks like it needs to go, and now when I say "sit, stay!", mplayer
obeys again.

'c88d591 sched: Merge select_task_rq_fair() and
sched_balance_self()' accidentally dropped the check, causing
wake_affine() to pull pinned tasks - put it back.

[ v2: use a cheaper version from Peter ]

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>


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

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 29b35a7..566e3bb 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1339,7 +1339,8 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 	int sync = wake_flags & WF_SYNC;
 
 	if (sd_flag & SD_BALANCE_WAKE) {
-		if (sched_feat(AFFINE_WAKEUPS))
+		if (sched_feat(AFFINE_WAKEUPS) &&
+		    cpumask_test_cpu(cpu, &p->cpus_allowed))
 			want_affine = 1;
 		new_cpu = prev_cpu;
 	}

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

* [tip:perfcounters/rename] perf_counter: Rename list_entry -> group_entry, counter_list -> group_list
       [not found]             ` <new-submission>
                                 ` (417 preceding siblings ...)
  2009-09-19 15:16               ` [tip:sched/urgent] sched: Re-add lost cpu_allowed check to sched_fair.c::select_task_rq_fair() tip-bot for Mike Galbraith
@ 2009-09-21 12:52               ` tip-bot for Ingo Molnar
  2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename 'event' to event_id/hw_event tip-bot for Ingo Molnar
                                 ` (287 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-21 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, fweisbec, tglx, mingo

Commit-ID:  65abc8653c282ded3dbdb9ec1227784140ba28cd
Gitweb:     http://git.kernel.org/tip/65abc8653c282ded3dbdb9ec1227784140ba28cd
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 21 Sep 2009 10:18:27 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 21 Sep 2009 12:54:51 +0200

perf_counter: Rename list_entry -> group_entry, counter_list -> group_list

This is in preparation of the big rename, but also makes sense
in a standalone way: 'list_entry' is a bad name as we already
have a list_entry() in list.h.

Also, the 'counter list' is too vague, it doesnt tell us the
purpose of that list.

Clarify these names to show that it's all about the group
hiearchy.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/perf_counter.h |    4 +-
 kernel/perf_counter.c        |   71 ++++++++++++++++++++---------------------
 2 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 740caad..f648627 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -543,7 +543,7 @@ struct perf_pending_entry {
  */
 struct perf_counter {
 #ifdef CONFIG_PERF_COUNTERS
-	struct list_head		list_entry;
+	struct list_head		group_entry;
 	struct list_head		event_entry;
 	struct list_head		sibling_list;
 	int				nr_siblings;
@@ -649,7 +649,7 @@ struct perf_counter_context {
 	 */
 	struct mutex			mutex;
 
-	struct list_head		counter_list;
+	struct list_head		group_list;
 	struct list_head		event_list;
 	int				nr_counters;
 	int				nr_active;
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index cc768ab..13ad73a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -258,9 +258,9 @@ list_add_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 	 * leader's sibling list:
 	 */
 	if (group_leader == counter)
-		list_add_tail(&counter->list_entry, &ctx->counter_list);
+		list_add_tail(&counter->group_entry, &ctx->group_list);
 	else {
-		list_add_tail(&counter->list_entry, &group_leader->sibling_list);
+		list_add_tail(&counter->group_entry, &group_leader->sibling_list);
 		group_leader->nr_siblings++;
 	}
 
@@ -279,13 +279,13 @@ list_del_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 {
 	struct perf_counter *sibling, *tmp;
 
-	if (list_empty(&counter->list_entry))
+	if (list_empty(&counter->group_entry))
 		return;
 	ctx->nr_counters--;
 	if (counter->attr.inherit_stat)
 		ctx->nr_stat--;
 
-	list_del_init(&counter->list_entry);
+	list_del_init(&counter->group_entry);
 	list_del_rcu(&counter->event_entry);
 
 	if (counter->group_leader != counter)
@@ -296,10 +296,9 @@ list_del_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
 	 * upgrade the siblings to singleton counters by adding them
 	 * to the context list directly:
 	 */
-	list_for_each_entry_safe(sibling, tmp,
-				 &counter->sibling_list, list_entry) {
+	list_for_each_entry_safe(sibling, tmp, &counter->sibling_list, group_entry) {
 
-		list_move_tail(&sibling->list_entry, &ctx->counter_list);
+		list_move_tail(&sibling->group_entry, &ctx->group_list);
 		sibling->group_leader = sibling;
 	}
 }
@@ -343,7 +342,7 @@ group_sched_out(struct perf_counter *group_counter,
 	/*
 	 * Schedule out siblings (if any):
 	 */
-	list_for_each_entry(counter, &group_counter->sibling_list, list_entry)
+	list_for_each_entry(counter, &group_counter->sibling_list, group_entry)
 		counter_sched_out(counter, cpuctx, ctx);
 
 	if (group_counter->attr.exclusive)
@@ -435,7 +434,7 @@ retry:
 	/*
 	 * If the context is active we need to retry the smp call.
 	 */
-	if (ctx->nr_active && !list_empty(&counter->list_entry)) {
+	if (ctx->nr_active && !list_empty(&counter->group_entry)) {
 		spin_unlock_irq(&ctx->lock);
 		goto retry;
 	}
@@ -445,7 +444,7 @@ retry:
 	 * can remove the counter safely, if the call above did not
 	 * succeed.
 	 */
-	if (!list_empty(&counter->list_entry)) {
+	if (!list_empty(&counter->group_entry)) {
 		list_del_counter(counter, ctx);
 	}
 	spin_unlock_irq(&ctx->lock);
@@ -497,7 +496,7 @@ static void update_group_times(struct perf_counter *leader)
 	struct perf_counter *counter;
 
 	update_counter_times(leader);
-	list_for_each_entry(counter, &leader->sibling_list, list_entry)
+	list_for_each_entry(counter, &leader->sibling_list, group_entry)
 		update_counter_times(counter);
 }
 
@@ -643,7 +642,7 @@ group_sched_in(struct perf_counter *group_counter,
 	/*
 	 * Schedule in siblings as one group (if any):
 	 */
-	list_for_each_entry(counter, &group_counter->sibling_list, list_entry) {
+	list_for_each_entry(counter, &group_counter->sibling_list, group_entry) {
 		if (counter_sched_in(counter, cpuctx, ctx, cpu)) {
 			partial_group = counter;
 			goto group_error;
@@ -657,7 +656,7 @@ group_error:
 	 * Groups can be scheduled in as one unit only, so undo any
 	 * partial group before returning:
 	 */
-	list_for_each_entry(counter, &group_counter->sibling_list, list_entry) {
+	list_for_each_entry(counter, &group_counter->sibling_list, group_entry) {
 		if (counter == partial_group)
 			break;
 		counter_sched_out(counter, cpuctx, ctx);
@@ -678,7 +677,7 @@ static int is_software_only_group(struct perf_counter *leader)
 	if (!is_software_counter(leader))
 		return 0;
 
-	list_for_each_entry(counter, &leader->sibling_list, list_entry)
+	list_for_each_entry(counter, &leader->sibling_list, group_entry)
 		if (!is_software_counter(counter))
 			return 0;
 
@@ -842,7 +841,7 @@ retry:
 	/*
 	 * we need to retry the smp call.
 	 */
-	if (ctx->is_active && list_empty(&counter->list_entry)) {
+	if (ctx->is_active && list_empty(&counter->group_entry)) {
 		spin_unlock_irq(&ctx->lock);
 		goto retry;
 	}
@@ -852,7 +851,7 @@ retry:
 	 * can add the counter safely, if it the call above did not
 	 * succeed.
 	 */
-	if (list_empty(&counter->list_entry))
+	if (list_empty(&counter->group_entry))
 		add_counter_to_ctx(counter, ctx);
 	spin_unlock_irq(&ctx->lock);
 }
@@ -872,7 +871,7 @@ static void __perf_counter_mark_enabled(struct perf_counter *counter,
 
 	counter->state = PERF_COUNTER_STATE_INACTIVE;
 	counter->tstamp_enabled = ctx->time - counter->total_time_enabled;
-	list_for_each_entry(sub, &counter->sibling_list, list_entry)
+	list_for_each_entry(sub, &counter->sibling_list, group_entry)
 		if (sub->state >= PERF_COUNTER_STATE_INACTIVE)
 			sub->tstamp_enabled =
 				ctx->time - sub->total_time_enabled;
@@ -1032,7 +1031,7 @@ void __perf_counter_sched_out(struct perf_counter_context *ctx,
 
 	perf_disable();
 	if (ctx->nr_active) {
-		list_for_each_entry(counter, &ctx->counter_list, list_entry) {
+		list_for_each_entry(counter, &ctx->group_list, group_entry) {
 			if (counter != counter->group_leader)
 				counter_sched_out(counter, cpuctx, ctx);
 			else
@@ -1252,7 +1251,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 	 * First go through the list and put on any pinned groups
 	 * in order to give them the best chance of going on.
 	 */
-	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
+	list_for_each_entry(counter, &ctx->group_list, group_entry) {
 		if (counter->state <= PERF_COUNTER_STATE_OFF ||
 		    !counter->attr.pinned)
 			continue;
@@ -1276,7 +1275,7 @@ __perf_counter_sched_in(struct perf_counter_context *ctx,
 		}
 	}
 
-	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
+	list_for_each_entry(counter, &ctx->group_list, group_entry) {
 		/*
 		 * Ignore counters in OFF or ERROR state, and
 		 * ignore pinned counters since we did them already.
@@ -1369,7 +1368,7 @@ static void perf_ctx_adjust_freq(struct perf_counter_context *ctx)
 	u64 interrupts, freq;
 
 	spin_lock(&ctx->lock);
-	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
+	list_for_each_entry(counter, &ctx->group_list, group_entry) {
 		if (counter->state != PERF_COUNTER_STATE_ACTIVE)
 			continue;
 
@@ -1441,8 +1440,8 @@ static void rotate_ctx(struct perf_counter_context *ctx)
 	 * Rotate the first entry last (works just fine for group counters too):
 	 */
 	perf_disable();
-	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
-		list_move_tail(&counter->list_entry, &ctx->counter_list);
+	list_for_each_entry(counter, &ctx->group_list, group_entry) {
+		list_move_tail(&counter->group_entry, &ctx->group_list);
 		break;
 	}
 	perf_enable();
@@ -1498,7 +1497,7 @@ static void perf_counter_enable_on_exec(struct task_struct *task)
 
 	spin_lock(&ctx->lock);
 
-	list_for_each_entry(counter, &ctx->counter_list, list_entry) {
+	list_for_each_entry(counter, &ctx->group_list, group_entry) {
 		if (!counter->attr.enable_on_exec)
 			continue;
 		counter->attr.enable_on_exec = 0;
@@ -1575,7 +1574,7 @@ __perf_counter_init_context(struct perf_counter_context *ctx,
 	memset(ctx, 0, sizeof(*ctx));
 	spin_lock_init(&ctx->lock);
 	mutex_init(&ctx->mutex);
-	INIT_LIST_HEAD(&ctx->counter_list);
+	INIT_LIST_HEAD(&ctx->group_list);
 	INIT_LIST_HEAD(&ctx->event_list);
 	atomic_set(&ctx->refcount, 1);
 	ctx->task = task;
@@ -1818,7 +1817,7 @@ static int perf_counter_read_group(struct perf_counter *counter,
 
 	size += err;
 
-	list_for_each_entry(sub, &leader->sibling_list, list_entry) {
+	list_for_each_entry(sub, &leader->sibling_list, group_entry) {
 		err = perf_counter_read_entry(sub, read_format,
 				buf + size);
 		if (err < 0)
@@ -1948,7 +1947,7 @@ static void perf_counter_for_each(struct perf_counter *counter,
 
 	perf_counter_for_each_child(counter, func);
 	func(counter);
-	list_for_each_entry(sibling, &counter->sibling_list, list_entry)
+	list_for_each_entry(sibling, &counter->sibling_list, group_entry)
 		perf_counter_for_each_child(counter, func);
 	mutex_unlock(&ctx->mutex);
 }
@@ -2832,7 +2831,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
 
 	perf_output_copy(handle, values, n * sizeof(u64));
 
-	list_for_each_entry(sub, &leader->sibling_list, list_entry) {
+	list_for_each_entry(sub, &leader->sibling_list, group_entry) {
 		n = 0;
 
 		if (sub != counter)
@@ -4118,7 +4117,7 @@ perf_counter_alloc(struct perf_counter_attr *attr,
 	mutex_init(&counter->child_mutex);
 	INIT_LIST_HEAD(&counter->child_list);
 
-	INIT_LIST_HEAD(&counter->list_entry);
+	INIT_LIST_HEAD(&counter->group_entry);
 	INIT_LIST_HEAD(&counter->event_entry);
 	INIT_LIST_HEAD(&counter->sibling_list);
 	init_waitqueue_head(&counter->waitq);
@@ -4544,7 +4543,7 @@ static int inherit_group(struct perf_counter *parent_counter,
 				 child, NULL, child_ctx);
 	if (IS_ERR(leader))
 		return PTR_ERR(leader);
-	list_for_each_entry(sub, &parent_counter->sibling_list, list_entry) {
+	list_for_each_entry(sub, &parent_counter->sibling_list, group_entry) {
 		child_ctr = inherit_counter(sub, parent, parent_ctx,
 					    child, leader, child_ctx);
 		if (IS_ERR(child_ctr))
@@ -4670,8 +4669,8 @@ void perf_counter_exit_task(struct task_struct *child)
 	mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING);
 
 again:
-	list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,
-				 list_entry)
+	list_for_each_entry_safe(child_counter, tmp, &child_ctx->group_list,
+				 group_entry)
 		__perf_counter_exit_task(child_counter, child_ctx, child);
 
 	/*
@@ -4679,7 +4678,7 @@ again:
 	 * its siblings to the list, but we obtained 'tmp' before that which
 	 * will still point to the list head terminating the iteration.
 	 */
-	if (!list_empty(&child_ctx->counter_list))
+	if (!list_empty(&child_ctx->group_list))
 		goto again;
 
 	mutex_unlock(&child_ctx->mutex);
@@ -4701,7 +4700,7 @@ void perf_counter_free_task(struct task_struct *task)
 
 	mutex_lock(&ctx->mutex);
 again:
-	list_for_each_entry_safe(counter, tmp, &ctx->counter_list, list_entry) {
+	list_for_each_entry_safe(counter, tmp, &ctx->group_list, group_entry) {
 		struct perf_counter *parent = counter->parent;
 
 		if (WARN_ON_ONCE(!parent))
@@ -4717,7 +4716,7 @@ again:
 		free_counter(counter);
 	}
 
-	if (!list_empty(&ctx->counter_list))
+	if (!list_empty(&ctx->group_list))
 		goto again;
 
 	mutex_unlock(&ctx->mutex);
@@ -4847,7 +4846,7 @@ static void __perf_counter_exit_cpu(void *info)
 	struct perf_counter_context *ctx = &cpuctx->ctx;
 	struct perf_counter *counter, *tmp;
 
-	list_for_each_entry_safe(counter, tmp, &ctx->counter_list, list_entry)
+	list_for_each_entry_safe(counter, tmp, &ctx->group_list, group_entry)
 		__perf_counter_remove_from_context(counter);
 }
 static void perf_counter_exit_cpu(int cpu)

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

* [tip:perfcounters/rename] perf_counter: Rename 'event' to event_id/hw_event
       [not found]             ` <new-submission>
                                 ` (418 preceding siblings ...)
  2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename list_entry -> group_entry, counter_list -> group_list tip-bot for Ingo Molnar
@ 2009-09-21 12:52               ` tip-bot for Ingo Molnar
  2009-09-21 12:53               ` [tip:perfcounters/rename] perf: Tidy up after the big rename tip-bot for Ingo Molnar
                                 ` (286 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-21 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, fweisbec, tglx, mingo

Commit-ID:  dfc65094d0313cc48969fa60bcf33d693aeb05a7
Gitweb:     http://git.kernel.org/tip/dfc65094d0313cc48969fa60bcf33d693aeb05a7
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 21 Sep 2009 11:31:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 21 Sep 2009 12:54:59 +0200

perf_counter: Rename 'event' to event_id/hw_event

In preparation to the renames, to avoid a namespace clash.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index a6c8b27..b1f1156 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -124,9 +124,9 @@ static const u64 p6_perfmon_event_map[] =
   [PERF_COUNT_HW_BUS_CYCLES]		= 0x0062,
 };
 
-static u64 p6_pmu_event_map(int event)
+static u64 p6_pmu_event_map(int hw_event)
 {
-	return p6_perfmon_event_map[event];
+	return p6_perfmon_event_map[hw_event];
 }
 
 /*
@@ -137,7 +137,7 @@ static u64 p6_pmu_event_map(int event)
  */
 #define P6_NOP_COUNTER			0x0000002EULL
 
-static u64 p6_pmu_raw_event(u64 event)
+static u64 p6_pmu_raw_event(u64 hw_event)
 {
 #define P6_EVNTSEL_EVENT_MASK		0x000000FFULL
 #define P6_EVNTSEL_UNIT_MASK		0x0000FF00ULL
@@ -152,7 +152,7 @@ static u64 p6_pmu_raw_event(u64 event)
 	 P6_EVNTSEL_INV_MASK   |	\
 	 P6_EVNTSEL_COUNTER_MASK)
 
-	return event & P6_EVNTSEL_MASK;
+	return hw_event & P6_EVNTSEL_MASK;
 }
 
 
@@ -170,16 +170,16 @@ static const u64 intel_perfmon_event_map[] =
   [PERF_COUNT_HW_BUS_CYCLES]		= 0x013c,
 };
 
-static u64 intel_pmu_event_map(int event)
+static u64 intel_pmu_event_map(int hw_event)
 {
-	return intel_perfmon_event_map[event];
+	return intel_perfmon_event_map[hw_event];
 }
 
 /*
- * Generalized hw caching related event table, filled
+ * Generalized hw caching related hw_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
+ * 'not supported', -1 means 'hw_event makes no sense on
+ * this CPU', any other value means the raw hw_event
  * ID.
  */
 
@@ -463,7 +463,7 @@ static const u64 atom_hw_cache_event_ids
  },
 };
 
-static u64 intel_pmu_raw_event(u64 event)
+static u64 intel_pmu_raw_event(u64 hw_event)
 {
 #define CORE_EVNTSEL_EVENT_MASK		0x000000FFULL
 #define CORE_EVNTSEL_UNIT_MASK		0x0000FF00ULL
@@ -478,7 +478,7 @@ static u64 intel_pmu_raw_event(u64 event)
 	 CORE_EVNTSEL_INV_MASK  |	\
 	 CORE_EVNTSEL_COUNTER_MASK)
 
-	return event & CORE_EVNTSEL_MASK;
+	return hw_event & CORE_EVNTSEL_MASK;
 }
 
 static const u64 amd_hw_cache_event_ids
@@ -585,12 +585,12 @@ static const u64 amd_perfmon_event_map[] =
   [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
 };
 
-static u64 amd_pmu_event_map(int event)
+static u64 amd_pmu_event_map(int hw_event)
 {
-	return amd_perfmon_event_map[event];
+	return amd_perfmon_event_map[hw_event];
 }
 
-static u64 amd_pmu_raw_event(u64 event)
+static u64 amd_pmu_raw_event(u64 hw_event)
 {
 #define K7_EVNTSEL_EVENT_MASK	0x7000000FFULL
 #define K7_EVNTSEL_UNIT_MASK	0x00000FF00ULL
@@ -605,7 +605,7 @@ static u64 amd_pmu_raw_event(u64 event)
 	 K7_EVNTSEL_INV_MASK   |	\
 	 K7_EVNTSEL_COUNTER_MASK)
 
-	return event & K7_EVNTSEL_MASK;
+	return hw_event & K7_EVNTSEL_MASK;
 }
 
 /*
@@ -956,7 +956,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 	}
 
 	/*
-	 * Raw event type provide the config in the event structure
+	 * Raw hw_event type provide the config in the hw_event structure
 	 */
 	if (attr->type == PERF_TYPE_RAW) {
 		hwc->config |= x86_pmu.raw_event(attr->config);
@@ -1245,7 +1245,7 @@ x86_perf_counter_set_period(struct perf_counter *counter,
 		ret = 1;
 	}
 	/*
-	 * Quirk: certain CPUs dont like it if just 1 event is left:
+	 * Quirk: certain CPUs dont like it if just 1 hw_event is left:
 	 */
 	if (unlikely(left < 2))
 		left = 2;
@@ -1337,11 +1337,11 @@ static void amd_pmu_enable_counter(struct hw_perf_counter *hwc, int idx)
 static int
 fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
 {
-	unsigned int event;
+	unsigned int hw_event;
 
-	event = hwc->config & ARCH_PERFMON_EVENT_MASK;
+	hw_event = hwc->config & ARCH_PERFMON_EVENT_MASK;
 
-	if (unlikely((event ==
+	if (unlikely((hw_event ==
 		      x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
 		     (hwc->sample_period == 1)))
 		return X86_PMC_IDX_FIXED_BTS;
@@ -1349,11 +1349,11 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
 	if (!x86_pmu.num_counters_fixed)
 		return -1;
 
-	if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
+	if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
 		return X86_PMC_IDX_FIXED_INSTRUCTIONS;
-	if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
+	if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
 		return X86_PMC_IDX_FIXED_CPU_CYCLES;
-	if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES)))
+	if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES)))
 		return X86_PMC_IDX_FIXED_BUS_CYCLES;
 
 	return -1;
@@ -1970,7 +1970,7 @@ static int intel_pmu_init(void)
 
 	/*
 	 * Check whether the Architectural PerfMon supports
-	 * Branch Misses Retired Event or not.
+	 * Branch Misses Retired hw_event or not.
 	 */
 	cpuid(10, &eax.full, &ebx, &unused, &edx.full);
 	if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 13ad73a..62de0db 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3044,22 +3044,22 @@ perf_counter_read_event(struct perf_counter *counter,
 			struct task_struct *task)
 {
 	struct perf_output_handle handle;
-	struct perf_read_event event = {
+	struct perf_read_event read_event = {
 		.header = {
 			.type = PERF_EVENT_READ,
 			.misc = 0,
-			.size = sizeof(event) + perf_counter_read_size(counter),
+			.size = sizeof(read_event) + perf_counter_read_size(counter),
 		},
 		.pid = perf_counter_pid(counter, task),
 		.tid = perf_counter_tid(counter, task),
 	};
 	int ret;
 
-	ret = perf_output_begin(&handle, counter, event.header.size, 0, 0);
+	ret = perf_output_begin(&handle, counter, read_event.header.size, 0, 0);
 	if (ret)
 		return;
 
-	perf_output_put(&handle, event);
+	perf_output_put(&handle, read_event);
 	perf_output_read(&handle, counter);
 
 	perf_output_end(&handle);
@@ -3698,14 +3698,14 @@ static int perf_swcounter_is_counting(struct perf_counter *counter)
 
 static int perf_swcounter_match(struct perf_counter *counter,
 				enum perf_type_id type,
-				u32 event, struct pt_regs *regs)
+				u32 event_id, struct pt_regs *regs)
 {
 	if (!perf_swcounter_is_counting(counter))
 		return 0;
 
 	if (counter->attr.type != type)
 		return 0;
-	if (counter->attr.config != event)
+	if (counter->attr.config != event_id)
 		return 0;
 
 	if (regs) {
@@ -3721,7 +3721,7 @@ static int perf_swcounter_match(struct perf_counter *counter,
 
 static void perf_swcounter_ctx_event(struct perf_counter_context *ctx,
 				     enum perf_type_id type,
-				     u32 event, u64 nr, int nmi,
+				     u32 event_id, u64 nr, int nmi,
 				     struct perf_sample_data *data,
 				     struct pt_regs *regs)
 {
@@ -3732,7 +3732,7 @@ 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))
+		if (perf_swcounter_match(counter, type, event_id, regs))
 			perf_swcounter_add(counter, nr, nmi, data, regs);
 	}
 	rcu_read_unlock();
@@ -4036,17 +4036,17 @@ atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
 
 static void sw_perf_counter_destroy(struct perf_counter *counter)
 {
-	u64 event = counter->attr.config;
+	u64 event_id = counter->attr.config;
 
 	WARN_ON(counter->parent);
 
-	atomic_dec(&perf_swcounter_enabled[event]);
+	atomic_dec(&perf_swcounter_enabled[event_id]);
 }
 
 static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 {
 	const struct pmu *pmu = NULL;
-	u64 event = counter->attr.config;
+	u64 event_id = counter->attr.config;
 
 	/*
 	 * Software counters (currently) can't in general distinguish
@@ -4055,7 +4055,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 (event) {
+	switch (event_id) {
 	case PERF_COUNT_SW_CPU_CLOCK:
 		pmu = &perf_ops_cpu_clock;
 
@@ -4077,7 +4077,7 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
 	case PERF_COUNT_SW_CONTEXT_SWITCHES:
 	case PERF_COUNT_SW_CPU_MIGRATIONS:
 		if (!counter->parent) {
-			atomic_inc(&perf_swcounter_enabled[event]);
+			atomic_inc(&perf_swcounter_enabled[event_id]);
 			counter->destroy = sw_perf_counter_destroy;
 		}
 		pmu = &perf_ops_generic;

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

* [tip:perfcounters/rename] perf: Tidy up after the big rename
       [not found]             ` <new-submission>
                                 ` (419 preceding siblings ...)
  2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename 'event' to event_id/hw_event tip-bot for Ingo Molnar
@ 2009-09-21 12:53               ` tip-bot for Ingo Molnar
  2009-09-22 13:34               ` [tip:core/printk] ratelimit: Use per ratelimit context locking tip-bot for Ingo Molnar
                                 ` (285 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-21 12:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, arjan, efault,
	fweisbec, benh, tglx, mingo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 27493 bytes --]

Commit-ID:  57c0c15b5244320065374ad2c54f4fbec77a6428
Gitweb:     http://git.kernel.org/tip/57c0c15b5244320065374ad2c54f4fbec77a6428
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 21 Sep 2009 12:20:38 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 21 Sep 2009 14:34:11 +0200

perf: Tidy up after the big rename

 - provide compatibility Kconfig entry for existing PERF_COUNTERS .config's

 - provide courtesy copy of old perf_counter.h, for user-space projects

 - small indentation fixups

 - fix up MAINTAINERS

 - fix small x86 printout fallout

 - fix up small PowerPC comment fallout (use 'counter' as in register)

Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 MAINTAINERS                      |    2 +-
 arch/powerpc/include/asm/paca.h  |    2 +-
 arch/powerpc/kernel/perf_event.c |   12 +-
 arch/x86/kernel/cpu/perf_event.c |   14 +-
 include/linux/perf_counter.h     |  441 ++++++++++++++++++++++++++++++++++++++
 include/linux/perf_event.h       |   98 +++++-----
 init/Kconfig                     |   37 +++-
 kernel/perf_event.c              |    4 +-
 8 files changed, 534 insertions(+), 76 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 43761a0..751a307 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4000,7 +4000,7 @@ S:	Maintained
 F:	include/linux/delayacct.h
 F:	kernel/delayacct.c
 
-PERFORMANCE COUNTER SUBSYSTEM
+PERFORMANCE EVENTS SUBSYSTEM
 M:	Peter Zijlstra <a.p.zijlstra@chello.nl>
 M:	Paul Mackerras <paulus@samba.org>
 M:	Ingo Molnar <mingo@elte.hu>
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 154f405..7d8514c 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -122,7 +122,7 @@ struct paca_struct {
 	u8 soft_enabled;		/* irq soft-enable flag */
 	u8 hard_enabled;		/* set if irqs are enabled in MSR */
 	u8 io_sync;			/* writel() needs spin_unlock sync */
-	u8 perf_event_pending;	/* PM interrupt while soft-disabled */
+	u8 perf_event_pending;		/* PM interrupt while soft-disabled */
 
 	/* Stuff for accurate time accounting */
 	u64 user_time;			/* accumulated usermode TB ticks */
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index c98321f..197b7d9 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -41,7 +41,7 @@ DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
 struct power_pmu *ppmu;
 
 /*
- * Normally, to ignore kernel events we set the FCS (freeze events
+ * Normally, to ignore kernel events we set the FCS (freeze counters
  * in supervisor mode) bit in MMCR0, but if the kernel runs with the
  * hypervisor bit set in the MSR, or if we are running on a processor
  * where the hypervisor bit is forced to 1 (as on Apple G5 processors),
@@ -159,7 +159,7 @@ void perf_event_print_debug(void)
 }
 
 /*
- * Read one performance monitor event (PMC).
+ * Read one performance monitor counter (PMC).
  */
 static unsigned long read_pmc(int idx)
 {
@@ -409,7 +409,7 @@ static void power_pmu_read(struct perf_event *event)
 		val = read_pmc(event->hw.idx);
 	} while (atomic64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
 
-	/* The events are only 32 bits wide */
+	/* The counters are only 32 bits wide */
 	delta = (val - prev) & 0xfffffffful;
 	atomic64_add(delta, &event->count);
 	atomic64_sub(delta, &event->hw.period_left);
@@ -543,7 +543,7 @@ void hw_perf_disable(void)
 		}
 
 		/*
-		 * Set the 'freeze events' bit.
+		 * Set the 'freeze counters' bit.
 		 * The barrier is to make sure the mtspr has been
 		 * executed and the PMU has frozen the events
 		 * before we return.
@@ -1124,7 +1124,7 @@ const struct pmu *hw_perf_event_init(struct perf_event *event)
 }
 
 /*
- * A event has overflowed; update its count and record
+ * A counter has overflowed; update its count and record
  * things if requested.  Note that interrupts are hard-disabled
  * here so there is no possibility of being interrupted.
  */
@@ -1271,7 +1271,7 @@ static void perf_event_interrupt(struct pt_regs *regs)
 
 	/*
 	 * Reset MMCR0 to its normal value.  This will set PMXE and
-	 * clear FC (freeze events) and PMAO (perf mon alert occurred)
+	 * clear FC (freeze counters) and PMAO (perf mon alert occurred)
 	 * and thus allow interrupts to occur again.
 	 * XXX might want to use MSR.PM to keep the events frozen until
 	 * we get back out of this interrupt.
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 0d03629..a3c7adb 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2081,13 +2081,13 @@ void __init init_hw_perf_events(void)
 	perf_events_lapic_init();
 	register_die_notifier(&perf_event_nmi_notifier);
 
-	pr_info("... version:                 %d\n",     x86_pmu.version);
-	pr_info("... bit width:               %d\n",     x86_pmu.event_bits);
-	pr_info("... generic events:        %d\n",     x86_pmu.num_events);
-	pr_info("... value mask:              %016Lx\n", x86_pmu.event_mask);
-	pr_info("... max period:              %016Lx\n", x86_pmu.max_period);
-	pr_info("... fixed-purpose events:  %d\n",     x86_pmu.num_events_fixed);
-	pr_info("... event mask:            %016Lx\n", perf_event_mask);
+	pr_info("... version:                %d\n",     x86_pmu.version);
+	pr_info("... bit width:              %d\n",     x86_pmu.event_bits);
+	pr_info("... generic registers:      %d\n",     x86_pmu.num_events);
+	pr_info("... value mask:             %016Lx\n", x86_pmu.event_mask);
+	pr_info("... max period:             %016Lx\n", x86_pmu.max_period);
+	pr_info("... fixed-purpose events:   %d\n",     x86_pmu.num_events_fixed);
+	pr_info("... event mask:             %016Lx\n", perf_event_mask);
 }
 
 static inline void x86_pmu_read(struct perf_event *event)
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
new file mode 100644
index 0000000..368bd70
--- /dev/null
+++ b/include/linux/perf_counter.h
@@ -0,0 +1,441 @@
+/*
+ *  NOTE: this file will be removed in a future kernel release, it is
+ *  provided as a courtesy copy of user-space code that relies on the
+ *  old (pre-rename) symbols and constants.
+ *
+ *  Performance events:
+ *
+ *    Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
+ *    Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
+ *    Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
+ *
+ *  Data type definitions, declarations, prototypes.
+ *
+ *    Started by: Thomas Gleixner and Ingo Molnar
+ *
+ *  For licencing details see kernel-base/COPYING
+ */
+#ifndef _LINUX_PERF_COUNTER_H
+#define _LINUX_PERF_COUNTER_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#include <asm/byteorder.h>
+
+/*
+ * User-space ABI bits:
+ */
+
+/*
+ * attr.type
+ */
+enum perf_type_id {
+	PERF_TYPE_HARDWARE			= 0,
+	PERF_TYPE_SOFTWARE			= 1,
+	PERF_TYPE_TRACEPOINT			= 2,
+	PERF_TYPE_HW_CACHE			= 3,
+	PERF_TYPE_RAW				= 4,
+
+	PERF_TYPE_MAX,				/* non-ABI */
+};
+
+/*
+ * Generalized performance counter event types, used by the
+ * attr.event_id parameter of the sys_perf_counter_open()
+ * syscall:
+ */
+enum perf_hw_id {
+	/*
+	 * Common hardware events, generalized by the kernel:
+	 */
+	PERF_COUNT_HW_CPU_CYCLES		= 0,
+	PERF_COUNT_HW_INSTRUCTIONS		= 1,
+	PERF_COUNT_HW_CACHE_REFERENCES		= 2,
+	PERF_COUNT_HW_CACHE_MISSES		= 3,
+	PERF_COUNT_HW_BRANCH_INSTRUCTIONS	= 4,
+	PERF_COUNT_HW_BRANCH_MISSES		= 5,
+	PERF_COUNT_HW_BUS_CYCLES		= 6,
+
+	PERF_COUNT_HW_MAX,			/* non-ABI */
+};
+
+/*
+ * Generalized hardware cache counters:
+ *
+ *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
+ *       { read, write, prefetch } x
+ *       { accesses, misses }
+ */
+enum perf_hw_cache_id {
+	PERF_COUNT_HW_CACHE_L1D			= 0,
+	PERF_COUNT_HW_CACHE_L1I			= 1,
+	PERF_COUNT_HW_CACHE_LL			= 2,
+	PERF_COUNT_HW_CACHE_DTLB		= 3,
+	PERF_COUNT_HW_CACHE_ITLB		= 4,
+	PERF_COUNT_HW_CACHE_BPU			= 5,
+
+	PERF_COUNT_HW_CACHE_MAX,		/* non-ABI */
+};
+
+enum perf_hw_cache_op_id {
+	PERF_COUNT_HW_CACHE_OP_READ		= 0,
+	PERF_COUNT_HW_CACHE_OP_WRITE		= 1,
+	PERF_COUNT_HW_CACHE_OP_PREFETCH		= 2,
+
+	PERF_COUNT_HW_CACHE_OP_MAX,		/* non-ABI */
+};
+
+enum perf_hw_cache_op_result_id {
+	PERF_COUNT_HW_CACHE_RESULT_ACCESS	= 0,
+	PERF_COUNT_HW_CACHE_RESULT_MISS		= 1,
+
+	PERF_COUNT_HW_CACHE_RESULT_MAX,		/* non-ABI */
+};
+
+/*
+ * 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
+ * well):
+ */
+enum perf_sw_ids {
+	PERF_COUNT_SW_CPU_CLOCK			= 0,
+	PERF_COUNT_SW_TASK_CLOCK		= 1,
+	PERF_COUNT_SW_PAGE_FAULTS		= 2,
+	PERF_COUNT_SW_CONTEXT_SWITCHES		= 3,
+	PERF_COUNT_SW_CPU_MIGRATIONS		= 4,
+	PERF_COUNT_SW_PAGE_FAULTS_MIN		= 5,
+	PERF_COUNT_SW_PAGE_FAULTS_MAJ		= 6,
+
+	PERF_COUNT_SW_MAX,			/* non-ABI */
+};
+
+/*
+ * Bits that can be set in attr.sample_type to request information
+ * in the overflow packets.
+ */
+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_READ			= 1U << 4,
+	PERF_SAMPLE_CALLCHAIN			= 1U << 5,
+	PERF_SAMPLE_ID				= 1U << 6,
+	PERF_SAMPLE_CPU				= 1U << 7,
+	PERF_SAMPLE_PERIOD			= 1U << 8,
+	PERF_SAMPLE_STREAM_ID			= 1U << 9,
+	PERF_SAMPLE_RAW				= 1U << 10,
+
+	PERF_SAMPLE_MAX = 1U << 11,		/* non-ABI */
+};
+
+/*
+ * The format of the data returned by read() on a perf counter fd,
+ * as specified by attr.read_format:
+ *
+ * struct read_format {
+ *	{ u64		value;
+ *	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_RUNNING
+ *	  { u64		id;           } && PERF_FORMAT_ID
+ *	} && !PERF_FORMAT_GROUP
+ *
+ *	{ u64		nr;
+ *	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_RUNNING
+ *	  { u64		value;
+ *	    { u64	id;           } && PERF_FORMAT_ID
+ *	  }		cntr[nr];
+ *	} && PERF_FORMAT_GROUP
+ * };
+ */
+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_GROUP			= 1U << 3,
+
+	PERF_FORMAT_MAX = 1U << 4, 		/* 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;
+
+	/*
+	 * Size of the attr structure, for fwd/bwd compat.
+	 */
+	__u32			size;
+
+	/*
+	 * Type specific configuration information.
+	 */
+	__u64			config;
+
+	union {
+		__u64		sample_period;
+		__u64		sample_freq;
+	};
+
+	__u64			sample_type;
+	__u64			read_format;
+
+	__u64			disabled       :  1, /* off by default        */
+				inherit	       :  1, /* children inherit it   */
+				pinned	       :  1, /* must always be on PMU */
+				exclusive      :  1, /* only group on PMU     */
+				exclude_user   :  1, /* don't count user      */
+				exclude_kernel :  1, /* ditto kernel          */
+				exclude_hv     :  1, /* ditto hypervisor      */
+				exclude_idle   :  1, /* don't count when idle */
+				mmap           :  1, /* include mmap data     */
+				comm	       :  1, /* include comm data     */
+				freq           :  1, /* use freq, not period  */
+				inherit_stat   :  1, /* per task counts       */
+				enable_on_exec :  1, /* next exec enables     */
+				task           :  1, /* trace fork/exit       */
+				watermark      :  1, /* wakeup_watermark      */
+
+				__reserved_1   : 49;
+
+	union {
+		__u32		wakeup_events;	  /* wakeup every n events */
+		__u32		wakeup_watermark; /* bytes before wakeup   */
+	};
+	__u32			__reserved_2;
+
+	__u64			__reserved_3;
+};
+
+/*
+ * Ioctls that can be done on a perf counter fd:
+ */
+#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)
+#define PERF_COUNTER_IOC_SET_OUTPUT	_IO ('$', 5)
+
+enum perf_counter_ioc_flags {
+	PERF_IOC_FLAG_GROUP		= 1U << 0,
+};
+
+/*
+ * Structure of the page that can be mapped via mmap
+ */
+struct perf_counter_mmap_page {
+	__u32	version;		/* version number of this structure */
+	__u32	compat_version;		/* lowest version this is compat with */
+
+	/*
+	 * Bits needed to read the hw counters in user-space.
+	 *
+	 *   u32 seq;
+	 *   s64 count;
+	 *
+	 *   do {
+	 *     seq = pc->lock;
+	 *
+	 *     barrier()
+	 *     if (pc->index) {
+	 *       count = pmc_read(pc->index - 1);
+	 *       count += pc->offset;
+	 *     } else
+	 *       goto regular_read;
+	 *
+	 *     barrier();
+	 *   } while (pc->lock != seq);
+	 *
+	 * NOTE: for obvious reason this only works on self-monitoring
+	 *       processes.
+	 */
+	__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[123];	/* align to 1k */
+
+	/*
+	 * Control data for the mmap() data buffer.
+	 *
+	 * 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)
+#define PERF_EVENT_MISC_CPUMODE_UNKNOWN		(0 << 0)
+#define PERF_EVENT_MISC_KERNEL			(1 << 0)
+#define PERF_EVENT_MISC_USER			(2 << 0)
+#define PERF_EVENT_MISC_HYPERVISOR		(3 << 0)
+
+struct perf_event_header {
+	__u32	type;
+	__u16	misc;
+	__u16	size;
+};
+
+enum perf_event_type {
+
+	/*
+	 * The MMAP events record the PROT_EXEC mappings so that we can
+	 * correlate userspace IPs to code. They have the following structure:
+	 *
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	u32				pid, tid;
+	 *	u64				addr;
+	 *	u64				len;
+	 *	u64				pgoff;
+	 *	char				filename[];
+	 * };
+	 */
+	PERF_EVENT_MMAP			= 1,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				id;
+	 *	u64				lost;
+	 * };
+	 */
+	PERF_EVENT_LOST			= 2,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	u32				pid, tid;
+	 *	char				comm[];
+	 * };
+	 */
+	PERF_EVENT_COMM			= 3,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, ppid;
+	 *	u32				tid, ptid;
+	 *	u64				time;
+	 * };
+	 */
+	PERF_EVENT_EXIT			= 4,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				time;
+	 *	u64				id;
+	 *	u64				stream_id;
+	 * };
+	 */
+	PERF_EVENT_THROTTLE		= 5,
+	PERF_EVENT_UNTHROTTLE		= 6,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, ppid;
+	 *	u32				tid, ptid;
+	 *	{ u64				time;     } && PERF_SAMPLE_TIME
+	 * };
+	 */
+	PERF_EVENT_FORK			= 7,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, tid;
+	 *
+	 *	struct read_format		values;
+	 * };
+	 */
+	PERF_EVENT_READ			= 8,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
+	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
+	 *	{ u64			time;     } && PERF_SAMPLE_TIME
+	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
+	 *	{ u64			id;	  } && PERF_SAMPLE_ID
+	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
+	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
+	 *	{ u64			period;   } && PERF_SAMPLE_PERIOD
+	 *
+	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
+	 *
+	 *	{ u64			nr,
+	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
+	 *
+	 *	#
+	 *	# The RAW record below is opaque data wrt the ABI
+	 *	#
+	 *	# That is, the ABI doesn't make any promises wrt to
+	 *	# the stability of its content, it may vary depending
+	 *	# on event, hardware, kernel version and phase of
+	 *	# the moon.
+	 *	#
+	 *	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
+	 *	#
+	 *
+	 *	{ u32			size;
+	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
+	 * };
+	 */
+	PERF_EVENT_SAMPLE		= 9,
+
+	PERF_EVENT_MAX,			/* non-ABI */
+};
+
+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,
+};
+
+#define PERF_FLAG_FD_NO_GROUP		(1U << 0)
+#define PERF_FLAG_FD_OUTPUT		(1U << 1)
+
+/*
+ * In case some app still references the old symbols:
+ */
+
+#define __NR_perf_counter_open		__NR_perf_event_open
+
+#define PR_TASK_PERF_COUNTERS_DISABLE	PR_TASK_PERF_EVENTS_DISABLE
+#define PR_TASK_PERF_COUNTERS_ENABLE	PR_TASK_PERF_EVENTS_ENABLE
+
+#endif /* _LINUX_PERF_COUNTER_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ae9d9ed..acefaf7 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1,15 +1,15 @@
 /*
- *  Performance events:
+ * Performance events:
  *
  *    Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
  *    Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
  *    Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
  *
- *  Data type definitions, declarations, prototypes.
+ * Data type definitions, declarations, prototypes.
  *
  *    Started by: Thomas Gleixner and Ingo Molnar
  *
- *  For licencing details see kernel-base/COPYING
+ * For licencing details see kernel-base/COPYING
  */
 #ifndef _LINUX_PERF_EVENT_H
 #define _LINUX_PERF_EVENT_H
@@ -131,19 +131,19 @@ enum perf_event_sample_format {
  * as specified by attr.read_format:
  *
  * struct read_format {
- * 	{ u64		value;
- * 	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
- * 	  { u64		time_running; } && PERF_FORMAT_RUNNING
- * 	  { u64		id;           } && PERF_FORMAT_ID
- * 	} && !PERF_FORMAT_GROUP
+ *	{ u64		value;
+ *	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_RUNNING
+ *	  { u64		id;           } && PERF_FORMAT_ID
+ *	} && !PERF_FORMAT_GROUP
  *
- * 	{ u64		nr;
- * 	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
- * 	  { u64		time_running; } && PERF_FORMAT_RUNNING
- * 	  { u64		value;
- * 	    { u64	id;           } && PERF_FORMAT_ID
- * 	  }		cntr[nr];
- * 	} && PERF_FORMAT_GROUP
+ *	{ u64		nr;
+ *	  { u64		time_enabled; } && PERF_FORMAT_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_RUNNING
+ *	  { u64		value;
+ *	    { u64	id;           } && PERF_FORMAT_ID
+ *	  }		cntr[nr];
+ *	} && PERF_FORMAT_GROUP
  * };
  */
 enum perf_event_read_format {
@@ -152,7 +152,7 @@ enum perf_event_read_format {
 	PERF_FORMAT_ID				= 1U << 2,
 	PERF_FORMAT_GROUP			= 1U << 3,
 
-	PERF_FORMAT_MAX = 1U << 4, 		/* non-ABI */
+	PERF_FORMAT_MAX = 1U << 4,		/* non-ABI */
 };
 
 #define PERF_ATTR_SIZE_VER0	64	/* sizeof first published struct */
@@ -216,8 +216,8 @@ struct perf_event_attr {
  * Ioctls that can be done on a perf event fd:
  */
 #define PERF_EVENT_IOC_ENABLE		_IO ('$', 0)
-#define PERF_EVENT_IOC_DISABLE	_IO ('$', 1)
-#define PERF_EVENT_IOC_REFRESH	_IO ('$', 2)
+#define PERF_EVENT_IOC_DISABLE		_IO ('$', 1)
+#define PERF_EVENT_IOC_REFRESH		_IO ('$', 2)
 #define PERF_EVENT_IOC_RESET		_IO ('$', 3)
 #define PERF_EVENT_IOC_PERIOD		_IOW('$', 4, u64)
 #define PERF_EVENT_IOC_SET_OUTPUT	_IO ('$', 5)
@@ -314,9 +314,9 @@ enum perf_event_type {
 
 	/*
 	 * struct {
-	 * 	struct perf_event_header	header;
-	 * 	u64				id;
-	 * 	u64				lost;
+	 *	struct perf_event_header	header;
+	 *	u64				id;
+	 *	u64				lost;
 	 * };
 	 */
 	PERF_RECORD_LOST			= 2,
@@ -383,23 +383,23 @@ enum perf_event_type {
 	 *	{ u64			id;	  } && PERF_SAMPLE_ID
 	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
 	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
-	 * 	{ u64			period;   } && PERF_SAMPLE_PERIOD
+	 *	{ u64			period;   } && PERF_SAMPLE_PERIOD
 	 *
 	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
 	 *
 	 *	{ u64			nr,
 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
 	 *
-	 * 	#
-	 * 	# The RAW record below is opaque data wrt the ABI
-	 * 	#
-	 * 	# That is, the ABI doesn't make any promises wrt to
-	 * 	# the stability of its content, it may vary depending
-	 * 	# on event_id, hardware, kernel version and phase of
-	 * 	# the moon.
-	 * 	#
-	 * 	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
-	 * 	#
+	 *	#
+	 *	# The RAW record below is opaque data wrt the ABI
+	 *	#
+	 *	# That is, the ABI doesn't make any promises wrt to
+	 *	# the stability of its content, it may vary depending
+	 *	# on event, hardware, kernel version and phase of
+	 *	# the moon.
+	 *	#
+	 *	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
+	 *	#
 	 *
 	 *	{ u32			size;
 	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
@@ -503,10 +503,10 @@ struct pmu {
  * enum perf_event_active_state - the states of a event
  */
 enum perf_event_active_state {
-	PERF_EVENT_STATE_ERROR	= -2,
+	PERF_EVENT_STATE_ERROR		= -2,
 	PERF_EVENT_STATE_OFF		= -1,
 	PERF_EVENT_STATE_INACTIVE	=  0,
-	PERF_EVENT_STATE_ACTIVE	=  1,
+	PERF_EVENT_STATE_ACTIVE		=  1,
 };
 
 struct file;
@@ -529,7 +529,7 @@ struct perf_mmap_data {
 
 	long				watermark;	/* wakeup watermark  */
 
-	struct perf_event_mmap_page   *user_page;
+	struct perf_event_mmap_page	*user_page;
 	void				*data_pages[0];
 };
 
@@ -694,14 +694,14 @@ struct perf_cpu_context {
 };
 
 struct perf_output_handle {
-	struct perf_event	*event;
-	struct perf_mmap_data	*data;
-	unsigned long		head;
-	unsigned long		offset;
-	int			nmi;
-	int			sample;
-	int			locked;
-	unsigned long		flags;
+	struct perf_event		*event;
+	struct perf_mmap_data		*data;
+	unsigned long			head;
+	unsigned long			offset;
+	int				nmi;
+	int				sample;
+	int				locked;
+	unsigned long			flags;
 };
 
 #ifdef CONFIG_PERF_EVENTS
@@ -829,22 +829,22 @@ static inline void
 perf_event_task_sched_out(struct task_struct *task,
 			    struct task_struct *next, int cpu)		{ }
 static inline void
-perf_event_task_tick(struct task_struct *task, int cpu)		{ }
+perf_event_task_tick(struct task_struct *task, int cpu)			{ }
 static inline int perf_event_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
-static inline void perf_event_do_pending(void)			{ }
-static inline void perf_event_print_debug(void)			{ }
+static inline void perf_event_do_pending(void)				{ }
+static inline void perf_event_print_debug(void)				{ }
 static inline void perf_disable(void)					{ }
 static inline void perf_enable(void)					{ }
-static inline int perf_event_task_disable(void)	{ return -EINVAL; }
-static inline int perf_event_task_enable(void)	{ return -EINVAL; }
+static inline int perf_event_task_disable(void)				{ return -EINVAL; }
+static inline int perf_event_task_enable(void)				{ return -EINVAL; }
 
 static inline void
 perf_sw_event(u32 event_id, u64 nr, int nmi,
 		     struct pt_regs *regs, u64 addr)			{ }
 
-static inline void perf_event_mmap(struct vm_area_struct *vma)	{ }
+static inline void perf_event_mmap(struct vm_area_struct *vma)		{ }
 static inline void perf_event_comm(struct task_struct *tsk)		{ }
 static inline void perf_event_fork(struct task_struct *tsk)		{ }
 static inline void perf_event_init(void)				{ }
diff --git a/init/Kconfig b/init/Kconfig
index cfdf5c3..706728b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -920,26 +920,31 @@ config HAVE_PERF_EVENTS
 	help
 	  See tools/perf/design.txt for details.
 
-menu "Performance Counters"
+menu "Kernel Performance Events And Counters"
 
 config PERF_EVENTS
-	bool "Kernel Performance Counters"
-	default y if PROFILING
+	bool "Kernel performance events and counters"
+	default y if (PROFILING || PERF_COUNTERS)
 	depends on HAVE_PERF_EVENTS
 	select ANON_INODES
 	help
-	  Enable kernel support for performance counter hardware.
+	  Enable kernel support for various performance events provided
+	  by software and hardware.
 
-	  Performance counters are special hardware registers available
-	  on most modern CPUs. These registers count the number of certain
+	  Software events are supported either build-in or via the
+	  use of generic tracepoints.
+
+	  Most modern CPUs support performance events via performance
+	  counter registers. These registers count the number of certain
 	  types of hw events: such as instructions executed, cachemisses
 	  suffered, or branches mis-predicted - without slowing down the
 	  kernel or applications. These registers can also trigger interrupts
 	  when a threshold number of events have passed - and can thus be
 	  used to profile the code that runs on that CPU.
 
-	  The Linux Performance Counter subsystem provides an abstraction of
-	  these hardware capabilities, available via a system call. It
+	  The Linux Performance Event subsystem provides an abstraction of
+	  these software and hardware cevent apabilities, available via a
+	  system call and used by the "perf" utility in tools/perf/. It
 	  provides per task and per CPU counters, and it provides event
 	  capabilities on top of those.
 
@@ -950,14 +955,26 @@ config EVENT_PROFILE
 	depends on PERF_EVENTS && EVENT_TRACING
 	default y
 	help
-	 Allow the use of tracepoints as software performance counters.
+	 Allow the use of tracepoints as software performance events.
 
-	 When this is enabled, you can create perf counters based on
+	 When this is enabled, you can create perf events based on
 	 tracepoints using PERF_TYPE_TRACEPOINT and the tracepoint ID
 	 found in debugfs://tracing/events/*/*/id. (The -e/--events
 	 option to the perf tool can parse and interpret symbolic
 	 tracepoints, in the subsystem:tracepoint_name format.)
 
+config PERF_COUNTERS
+	bool "Kernel performance counters (old config option)"
+	depends on HAVE_PERF_EVENTS
+	help
+	  This config has been obsoleted by the PERF_EVENTS
+	  config option - please see that one for details.
+
+	  It has no effect on the kernel whether you enable
+	  it or not, it is a compatibility placeholder.
+
+	  Say N if unsure.
+
 endmenu
 
 config VM_EVENT_COUNTERS
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 6e8b99a..76ac4db 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1,12 +1,12 @@
 /*
- * Performance event core code
+ * Performance events core code:
  *
  *  Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de>
  *  Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
  *  Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
  *  Copyright  ©  2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
  *
- *  For licensing details see kernel-base/COPYING
+ * For licensing details see kernel-base/COPYING
  */
 
 #include <linux/fs.h>

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

* [tip:core/printk] ratelimit: Use per ratelimit context locking
       [not found]             ` <new-submission>
                                 ` (420 preceding siblings ...)
  2009-09-21 12:53               ` [tip:perfcounters/rename] perf: Tidy up after the big rename tip-bot for Ingo Molnar
@ 2009-09-22 13:34               ` tip-bot for Ingo Molnar
  2009-09-22 13:34               ` [tip:core/printk] ratelimit: Fix/allow use in atomic contexts tip-bot for Ingo Molnar
                                 ` (284 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 13:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, a.p.zijlstra, davem, akpm,
	tglx, mingo

Commit-ID:  979f693def9084a452846365dfde5dcb28366333
Gitweb:     http://git.kernel.org/tip/979f693def9084a452846365dfde5dcb28366333
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 14:44:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 15:31:34 +0200

ratelimit: Use per ratelimit context locking

I'd like to use printk_ratelimit() in atomic context, but that's
not possible right now due to the spinlock usage this commit
introduced more than a year ago:

  717115e: printk ratelimiting rewrite

As a first step push the lock into the ratelimit state structure.
This allows us to deal with locking failures to be considered as an
event related to that state being too busy.

Also clean up the code a bit (without changing functionality):

 - tidy up the definitions

 - clean up the code flow

This also shrinks the code a tiny bit:

   text	   data	    bss	    dec	    hex	filename
    264	      0	      4	    268	    10c	ratelimit.o.before
    255	      0	      0	    255	     ff	ratelimit.o.after

( Whole-kernel data size got a bit larger, because we have
  two ratelimit-state data structures right now. )

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: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/ratelimit.h |   30 ++++++++++++++++++++----------
 lib/ratelimit.c           |   29 +++++++++++++----------------
 2 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 00044b8..187bc16 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -1,20 +1,30 @@
 #ifndef _LINUX_RATELIMIT_H
 #define _LINUX_RATELIMIT_H
+
 #include <linux/param.h>
+#include <linux/spinlock_types.h>
 
-#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
-#define DEFAULT_RATELIMIT_BURST 10
+#define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
+#define DEFAULT_RATELIMIT_BURST		10
 
 struct ratelimit_state {
-	int interval;
-	int burst;
-	int printed;
-	int missed;
-	unsigned long begin;
+	spinlock_t	lock;		/* protect the state */
+
+	int		interval;
+	int		burst;
+	int		printed;
+	int		missed;
+	unsigned long	begin;
 };
 
-#define DEFINE_RATELIMIT_STATE(name, interval, burst)		\
-		struct ratelimit_state name = {interval, burst,}
+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
+									\
+	struct ratelimit_state name = {					\
+		.lock		= __SPIN_LOCK_UNLOCKED(name.lock),	\
+		.interval	= interval_init,			\
+		.burst		= burst_init,				\
+	}
 
 extern int __ratelimit(struct ratelimit_state *rs);
-#endif
+
+#endif /* _LINUX_RATELIMIT_H */
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 26187ed..0e2c28e 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -7,15 +7,12 @@
  * parameter. Now every user can use their own standalone ratelimit_state.
  *
  * This file is released under the GPLv2.
- *
  */
 
 #include <linux/kernel.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
 
-static DEFINE_SPINLOCK(ratelimit_lock);
-
 /*
  * __ratelimit - rate limiting
  * @rs: ratelimit_state data
@@ -26,11 +23,12 @@ static DEFINE_SPINLOCK(ratelimit_lock);
 int __ratelimit(struct ratelimit_state *rs)
 {
 	unsigned long flags;
+	int ret;
 
 	if (!rs->interval)
 		return 1;
 
-	spin_lock_irqsave(&ratelimit_lock, flags);
+	spin_lock_irqsave(&rs->lock, flags);
 	if (!rs->begin)
 		rs->begin = jiffies;
 
@@ -38,20 +36,19 @@ int __ratelimit(struct ratelimit_state *rs)
 		if (rs->missed)
 			printk(KERN_WARNING "%s: %d callbacks suppressed\n",
 				__func__, rs->missed);
-		rs->begin = 0;
+		rs->begin   = 0;
 		rs->printed = 0;
-		rs->missed = 0;
+		rs->missed  = 0;
 	}
-	if (rs->burst && rs->burst > rs->printed)
-		goto print;
-
-	rs->missed++;
-	spin_unlock_irqrestore(&ratelimit_lock, flags);
-	return 0;
+	if (rs->burst && rs->burst > rs->printed) {
+		rs->printed++;
+		ret = 1;
+	} else {
+		rs->missed++;
+		ret = 0;
+	}
+	spin_unlock_irqrestore(&rs->lock, flags);
 
-print:
-	rs->printed++;
-	spin_unlock_irqrestore(&ratelimit_lock, flags);
-	return 1;
+	return ret;
 }
 EXPORT_SYMBOL(__ratelimit);

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

* [tip:core/printk] ratelimit: Fix/allow use in atomic contexts
       [not found]             ` <new-submission>
                                 ` (421 preceding siblings ...)
  2009-09-22 13:34               ` [tip:core/printk] ratelimit: Use per ratelimit context locking tip-bot for Ingo Molnar
@ 2009-09-22 13:34               ` tip-bot for Ingo Molnar
  2009-09-22 14:46                 ` Linus Torvalds
  2009-09-22 13:34               ` [tip:perf/urgent] perf stat: Fix zero total printouts tip-bot for Ingo Molnar
                                 ` (283 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 13:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, a.p.zijlstra, davem, akpm,
	tglx, mingo

Commit-ID:  edaac8e3167501cda336231d00611bf59c164346
Gitweb:     http://git.kernel.org/tip/edaac8e3167501cda336231d00611bf59c164346
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 14:44:11 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 14:05:48 +0200

ratelimit: Fix/allow use in atomic contexts

I'd like to use printk_ratelimit() in NMI context, but it's not
robust right now due to spinlock usage in lib/ratelimit.c. If an
NMI is unlucky enough to hit just that spot we might lock up trying
to take the spinlock again.

Fix that by using a trylock variant. If we contend on that lock we
can genuinely skip the message because the state is just being
accessed by another CPU (or by this CPU).

( We could use atomics for the suppressed messages field, but
  i doubt it matters in practice and it makes the code heavier. )

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: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/ratelimit.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 0e2c28e..69bfcac 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -28,7 +28,15 @@ int __ratelimit(struct ratelimit_state *rs)
 	if (!rs->interval)
 		return 1;
 
-	spin_lock_irqsave(&rs->lock, flags);
+	/*
+	 * If we contend on this state's lock then almost
+	 * by definition we are too busy to print a message,
+	 * in addition to the one that will be printed by
+	 * the entity that is holding the lock already:
+	 */
+	if (!spin_trylock_irqsave(&rs->lock, flags))
+		return 1;
+
 	if (!rs->begin)
 		rs->begin = jiffies;
 

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

* [tip:perf/urgent] perf stat: Fix zero total printouts
       [not found]             ` <new-submission>
                                 ` (422 preceding siblings ...)
  2009-09-22 13:34               ` [tip:core/printk] ratelimit: Fix/allow use in atomic contexts tip-bot for Ingo Molnar
@ 2009-09-22 13:34               ` tip-bot for Ingo Molnar
  2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Clean up thermal throttling state tracking code tip-bot for Ingo Molnar
                                 ` (282 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 13:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  c7f7fea30b7e52c9d4b9cef271110a98d59adcbc
Gitweb:     http://git.kernel.org/tip/c7f7fea30b7e52c9d4b9cef271110a98d59adcbc
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 14:53:51 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 15:01:47 +0200

perf stat: Fix zero total printouts

Before:

           0  sched:sched_switch #        nan M/sec

After:

           0  sched:sched_switch #      0.000 M/sec

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/builtin-stat.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 16af2d8..e5f6ece 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -338,14 +338,24 @@ static void nsec_printout(int counter, double avg)
 
 static void abs_printout(int counter, double avg)
 {
+	double total, ratio = 0.0;
+
 	fprintf(stderr, " %14.0f  %-24s", avg, event_name(counter));
 
 	if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
-		fprintf(stderr, " # %10.3f IPC  ",
-				avg / avg_stats(&runtime_cycles_stats));
+		total = avg_stats(&runtime_cycles_stats);
+
+		if (total)
+			ratio = avg / total;
+
+		fprintf(stderr, " # %10.3f IPC  ", ratio);
 	} else {
-		fprintf(stderr, " # %10.3f M/sec",
-				1000.0 * avg / avg_stats(&runtime_nsecs_stats));
+		total = avg_stats(&runtime_nsecs_stats);
+
+		if (total)
+			ratio = 1000.0 * avg / total;
+
+		fprintf(stderr, " # %10.3f M/sec", ratio);
 	}
 }
 

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

* [tip:x86/urgent] x86: mce: Clean up thermal throttling state tracking code
       [not found]             ` <new-submission>
                                 ` (423 preceding siblings ...)
  2009-09-22 13:34               ` [tip:perf/urgent] perf stat: Fix zero total printouts tip-bot for Ingo Molnar
@ 2009-09-22 13:34               ` tip-bot for Ingo Molnar
  2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Fix thermal throttling message storm tip-bot for Ingo Molnar
                                 ` (281 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 13:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, seto.hidetoshi, ying.huang, ak, tglx, mingo

Commit-ID:  3967684006f30c253bc6d4a6604d1bad4a7fc672
Gitweb:     http://git.kernel.org/tip/3967684006f30c253bc6d4a6604d1bad4a7fc672
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 15:50:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 17:30:41 +0200

x86: mce: Clean up thermal throttling state tracking code

Instead of a mess of three separate percpu variables, consolidate
the state into a single structure.

Also clean up therm_throt_process(), use cleaner and more
understandable variable names and a clearer logic.

This, without changing the logic, makes the code more
streamlined, more readable and smaller as well:

   text	   data	    bss	    dec	    hex	filename
   1487	    169	      4	   1660	    67c	therm_throt.o.before
   1432	    176	      4	   1612	    64c	therm_throt.o.after

Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/mcheck/therm_throt.c |   63 ++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 24 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 63a56d1..db80b57 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -34,20 +34,30 @@
 /* How long to wait between reporting thermal events */
 #define CHECK_INTERVAL		(300 * HZ)
 
-static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES;
-static DEFINE_PER_CPU(unsigned long, thermal_throttle_count);
-static DEFINE_PER_CPU(bool, thermal_throttle_active);
+/*
+ * Current thermal throttling state:
+ */
+struct thermal_state {
+	bool			is_throttled;
+
+	u64			next_check;
+	unsigned long		throttle_count;
+};
+
+static DEFINE_PER_CPU(struct thermal_state, thermal_state);
 
-static atomic_t therm_throt_en		= ATOMIC_INIT(0);
+static atomic_t therm_throt_en	= ATOMIC_INIT(0);
 
 #ifdef CONFIG_SYSFS
 #define define_therm_throt_sysdev_one_ro(_name)				\
 	static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL)
 
 #define define_therm_throt_sysdev_show_func(name)			\
-static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev,	\
-					struct sysdev_attribute *attr,	\
-					      char *buf)		\
+									\
+static ssize_t therm_throt_sysdev_show_##name(				\
+			struct sys_device *dev,				\
+			struct sysdev_attribute *attr,			\
+			char *buf)					\
 {									\
 	unsigned int cpu = dev->id;					\
 	ssize_t ret;							\
@@ -55,7 +65,7 @@ static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev,	\
 	preempt_disable();	/* CPU hotplug */			\
 	if (cpu_online(cpu))						\
 		ret = sprintf(buf, "%lu\n",				\
-			      per_cpu(thermal_throttle_##name, cpu));	\
+			      per_cpu(thermal_state, cpu).name);	\
 	else								\
 		ret = 0;						\
 	preempt_enable();						\
@@ -63,11 +73,11 @@ static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev,	\
 	return ret;							\
 }
 
-define_therm_throt_sysdev_show_func(count);
-define_therm_throt_sysdev_one_ro(count);
+define_therm_throt_sysdev_show_func(throttle_count);
+define_therm_throt_sysdev_one_ro(throttle_count);
 
 static struct attribute *thermal_throttle_attrs[] = {
-	&attr_count.attr,
+	&attr_throttle_count.attr,
 	NULL
 };
 
@@ -93,33 +103,38 @@ static struct attribute_group thermal_throttle_attr_group = {
  *          1 : Event should be logged further, and a message has been
  *              printed to the syslog.
  */
-static int therm_throt_process(int curr)
+static int therm_throt_process(bool is_throttled)
 {
-	unsigned int cpu = smp_processor_id();
-	__u64 tmp_jiffs = get_jiffies_64();
-	bool was_throttled = __get_cpu_var(thermal_throttle_active);
-	bool is_throttled = __get_cpu_var(thermal_throttle_active) = curr;
+	struct thermal_state *state;
+	unsigned int this_cpu;
+	bool was_throttled;
+	u64 now;
+
+	this_cpu = smp_processor_id();
+	now = get_jiffies_64();
+	state = &per_cpu(thermal_state, this_cpu);
+
+	was_throttled = state->is_throttled;
+	state->is_throttled = is_throttled;
 
 	if (is_throttled)
-		__get_cpu_var(thermal_throttle_count)++;
+		state->throttle_count++;
 
 	if (!(was_throttled ^ is_throttled) &&
-	    time_before64(tmp_jiffs, __get_cpu_var(next_check)))
+			time_before64(now, state->next_check))
 		return 0;
 
-	__get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL;
+	state->next_check = now + CHECK_INTERVAL;
 
 	/* if we just entered the thermal event */
 	if (is_throttled) {
-		printk(KERN_CRIT "CPU%d: Temperature above threshold, "
-		       "cpu clock throttled (total events = %lu)\n",
-		       cpu, __get_cpu_var(thermal_throttle_count));
+		printk(KERN_CRIT "CPU%d: Temperature above threshold, cpu clock throttled (total events = %lu)\n", this_cpu, state->throttle_count);
 
 		add_taint(TAINT_MACHINE_CHECK);
 		return 1;
 	}
 	if (was_throttled) {
-		printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu);
+		printk(KERN_INFO "CPU%d: Temperature/speed normal\n", this_cpu);
 		return 1;
 	}
 
@@ -213,7 +228,7 @@ static void intel_thermal_interrupt(void)
 	__u64 msr_val;
 
 	rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
-	if (therm_throt_process(msr_val & THERM_STATUS_PROCHOT))
+	if (therm_throt_process((msr_val & THERM_STATUS_PROCHOT) != 0))
 		mce_log_therm_throt_event(msr_val);
 }
 

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

* [tip:x86/urgent] x86: mce: Fix thermal throttling message storm
       [not found]             ` <new-submission>
                                 ` (424 preceding siblings ...)
  2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Clean up thermal throttling state tracking code tip-bot for Ingo Molnar
@ 2009-09-22 13:34               ` tip-bot for Ingo Molnar
  2009-09-22 14:26               ` [tip:core/printk] printk: Remove ratelimit.h from kernel.h tip-bot for Ingo Molnar
                                 ` (280 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 13:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, seto.hidetoshi, ying.huang, ak, tglx, mingo

Commit-ID:  b417c9fd8690637f0c91479435ab3e2bf450c038
Gitweb:     http://git.kernel.org/tip/b417c9fd8690637f0c91479435ab3e2bf450c038
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 15:50:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 17:30:45 +0200

x86: mce: Fix thermal throttling message storm

If a system switches back and forth between hot and cold mode,
the MCE code will print a stream of critical kernel messages.

Extend the throttling code to properly notice this, by
only printing the first hot + cold transition and omitting
the rest up to CHECK_INTERVAL (5 minutes).

This way we'll only get a single incident of:

 [  102.356584] CPU0: Temperature above threshold, cpu clock throttled (total events = 1)
 [  102.357000] Disabling lock debugging due to kernel taint
 [  102.369223] CPU0: Temperature/speed normal

Every 5 minutes. The 'total events' count tells the number of cold/hot
transitions detected, should overheating occur after 5 minutes again:

[  402.357580] CPU0: Temperature above threshold, cpu clock throttled (total events = 24891)
[  402.358001] CPU0: Temperature/speed normal
[  450.704142] Machine check events logged

Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/mcheck/therm_throt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index db80b57..b3a1dba 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -42,6 +42,7 @@ struct thermal_state {
 
 	u64			next_check;
 	unsigned long		throttle_count;
+	unsigned long		last_throttle_count;
 };
 
 static DEFINE_PER_CPU(struct thermal_state, thermal_state);
@@ -120,11 +121,12 @@ static int therm_throt_process(bool is_throttled)
 	if (is_throttled)
 		state->throttle_count++;
 
-	if (!(was_throttled ^ is_throttled) &&
-			time_before64(now, state->next_check))
+	if (time_before64(now, state->next_check) &&
+			state->throttle_count != state->last_throttle_count)
 		return 0;
 
 	state->next_check = now + CHECK_INTERVAL;
+	state->last_throttle_count = state->throttle_count;
 
 	/* if we just entered the thermal event */
 	if (is_throttled) {

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

* [tip:core/printk] printk: Remove ratelimit.h from kernel.h
       [not found]             ` <new-submission>
                                 ` (425 preceding siblings ...)
  2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Fix thermal throttling message storm tip-bot for Ingo Molnar
@ 2009-09-22 14:26               ` tip-bot for Ingo Molnar
  2009-09-25  8:49               ` [tip:perf/urgent] perf_event: Provide vmalloc() based mmap() backing tip-bot for Peter Zijlstra
                                 ` (279 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-09-22 14:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, a.p.zijlstra, davem, akpm,
	tglx, mingo

Commit-ID:  3fff4c42bd0a89869a0eb1e7874cc06ffa4aa0f5
Gitweb:     http://git.kernel.org/tip/3fff4c42bd0a89869a0eb1e7874cc06ffa4aa0f5
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 22 Sep 2009 16:18:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 22 Sep 2009 16:18:09 +0200

printk: Remove ratelimit.h from kernel.h

Decouple kernel.h from ratelimit.h: the global declaration of
printk's ratelimit_state is not needed, and it leads to messy
circular dependencies due to ratelimit.h's (new) adding of a
spinlock_types.h include.

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: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/kernel.h     |    2 --
 include/linux/net.h        |    1 +
 kernel/printk.c            |    1 +
 kernel/sysctl.c            |    3 +++
 lib/ratelimit.c            |    2 +-
 net/core/sysctl_net_core.c |    2 ++
 net/core/utils.c           |    2 ++
 7 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2b5b1e0..3305f33 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -15,7 +15,6 @@
 #include <linux/bitops.h>
 #include <linux/log2.h>
 #include <linux/typecheck.h>
-#include <linux/ratelimit.h>
 #include <linux/dynamic_debug.h>
 #include <asm/byteorder.h>
 #include <asm/bug.h>
@@ -241,7 +240,6 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 asmlinkage int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2))) __cold;
 
-extern struct ratelimit_state printk_ratelimit_state;
 extern int printk_ratelimit(void);
 extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
 				   unsigned int interval_msec);
diff --git a/include/linux/net.h b/include/linux/net.h
index 9040a10..df20f68 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -358,6 +358,7 @@ static const struct proto_ops name##_ops = {			\
 
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
+#include <linux/ratelimit.h>
 extern struct ratelimit_state net_ratelimit_state;
 #endif
 
diff --git a/kernel/printk.c b/kernel/printk.c
index 602033a..b997c89 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -33,6 +33,7 @@
 #include <linux/bootmem.h>
 #include <linux/syscalls.h>
 #include <linux/kexec.h>
+#include <linux/ratelimit.h>
 
 #include <asm/uaccess.h>
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1a631ba..6c37048 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -37,6 +37,7 @@
 #include <linux/sysrq.h>
 #include <linux/highuid.h>
 #include <linux/writeback.h>
+#include <linux/ratelimit.h>
 #include <linux/hugetlb.h>
 #include <linux/initrd.h>
 #include <linux/key.h>
@@ -155,6 +156,8 @@ extern int no_unaligned_warning;
 extern int unaligned_dump_stack;
 #endif
 
+extern struct ratelimit_state printk_ratelimit_state;
+
 #ifdef CONFIG_RT_MUTEXES
 extern int max_lock_depth;
 #endif
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 69bfcac..5551731 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -9,7 +9,7 @@
  * This file is released under the GPLv2.
  */
 
-#include <linux/kernel.h>
+#include <linux/ratelimit.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
 
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 7db1de0..887c03c 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -10,7 +10,9 @@
 #include <linux/module.h>
 #include <linux/socket.h>
 #include <linux/netdevice.h>
+#include <linux/ratelimit.h>
 #include <linux/init.h>
+
 #include <net/ip.h>
 #include <net/sock.h>
 
diff --git a/net/core/utils.c b/net/core/utils.c
index 83221ae..8382502 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -24,6 +24,8 @@
 #include <linux/types.h>
 #include <linux/percpu.h>
 #include <linux/init.h>
+#include <linux/ratelimit.h>
+
 #include <net/sock.h>
 
 #include <asm/byteorder.h>

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

* Re: [tip:core/printk] ratelimit: Fix/allow use in atomic contexts
  2009-09-22 13:34               ` [tip:core/printk] ratelimit: Fix/allow use in atomic contexts tip-bot for Ingo Molnar
@ 2009-09-22 14:46                 ` Linus Torvalds
  0 siblings, 0 replies; 1150+ messages in thread
From: Linus Torvalds @ 2009-09-22 14:46 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, a.p.zijlstra, davem, akpm, tglx, mingo
  Cc: linux-tip-commits




On Tue, 22 Sep 2009, tip-bot for Ingo Molnar wrote:
> 
> ratelimit: Fix/allow use in atomic contexts
> 
> I'd like to use printk_ratelimit() in NMI context, but it's not
> robust right now due to spinlock usage in lib/ratelimit.c. If an
> NMI is unlucky enough to hit just that spot we might lock up trying
> to take the spinlock again.
> 
> Fix that by using a trylock variant. If we contend on that lock we
> can genuinely skip the message because the state is just being
> accessed by another CPU (or by this CPU).

Ack to both this and the patch leading up to it. Looks sane and simple.

		Linus

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

* [tip:perf/urgent] perf_event: Provide vmalloc() based mmap() backing
       [not found]             ` <new-submission>
                                 ` (426 preceding siblings ...)
  2009-09-22 14:26               ` [tip:core/printk] printk: Remove ratelimit.h from kernel.h tip-bot for Ingo Molnar
@ 2009-09-25  8:49               ` tip-bot for Peter Zijlstra
  2009-10-04  7:54               ` [tip:core/futexes] futex: Fix locking imbalance tip-bot for Thomas Gleixner
                                 ` (278 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-09-25  8:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jens.axboe,
	davem, akpm, tglx, mingo

Commit-ID:  9c4bcf34b02533056f59f8d35fb5894c2f5b84bc
Gitweb:     http://git.kernel.org/tip/9c4bcf34b02533056f59f8d35fb5894c2f5b84bc
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 21 Sep 2009 16:08:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 25 Sep 2009 10:42:44 +0200

perf_event: Provide vmalloc() based mmap() backing

Some architectures such as Sparc, ARM and MIPS (basically
everything with flush_dcache_page()) need to deal with dcache
aliases by carefully placing pages in both kernel and user maps.

These architectures typically have to use vmalloc_user() for this.

However, on other architectures, vmalloc() is not needed and has
the downsides of being more restricted and slower than regular
allocations.

Acked-by: David Miller <davem@davemloft.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/sparc/Kconfig         |    2 +
 include/linux/perf_event.h |    5 +
 init/Kconfig               |   17 +++
 kernel/perf_event.c        |  248 +++++++++++++++++++++++++++++++++-----------
 tools/perf/design.txt      |    3 +
 5 files changed, 213 insertions(+), 62 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 97fca46..5658826 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -26,6 +26,7 @@ config SPARC
 	select RTC_CLASS
 	select RTC_DRV_M48T59
 	select HAVE_PERF_EVENTS
+	select PERF_NEEDS_VMALLOC
 	select HAVE_DMA_ATTRS
 	select HAVE_DMA_API_DEBUG
 
@@ -48,6 +49,7 @@ config SPARC64
 	select RTC_DRV_SUN4V
 	select RTC_DRV_STARFIRE
 	select HAVE_PERF_EVENTS
+	select PERF_NEEDS_VMALLOC
 
 config ARCH_DEFCONFIG
 	string
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3a9d36d..ae24947 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -442,6 +442,7 @@ enum perf_callchain_context {
 #include <linux/hrtimer.h>
 #include <linux/fs.h>
 #include <linux/pid_namespace.h>
+#include <linux/workqueue.h>
 #include <asm/atomic.h>
 
 #define PERF_MAX_STACK_DEPTH		255
@@ -513,6 +514,10 @@ struct file;
 
 struct perf_mmap_data {
 	struct rcu_head			rcu_head;
+#ifdef CONFIG_PERF_WANTS_VMALLOC
+	struct work_struct		work;
+#endif
+	int				data_order;
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
diff --git a/init/Kconfig b/init/Kconfig
index 0aa6579..b18c709 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -921,6 +921,11 @@ config HAVE_PERF_EVENTS
 	help
 	  See tools/perf/design.txt for details.
 
+config PERF_NEEDS_VMALLOC
+	bool
+	help
+	  See tools/perf/design.txt for details
+
 menu "Kernel Performance Events And Counters"
 
 config PERF_EVENTS
@@ -976,6 +981,18 @@ config PERF_COUNTERS
 
 	  Say N if unsure.
 
+config PERF_WANTS_VMALLOC
+	bool "Use vmalloc to back perf mmap() buffers"
+	default y if (PERF_NEEDS_VMALLOC)
+	depends on PERF_EVENTS
+	help
+	 Use vmalloc memory to back perf mmap() buffers.
+
+	 Mostly useful for debugging the vmalloc code on platforms
+	 that don't require it.
+
+	 Say N if unsure.
+
 endmenu
 
 config VM_EVENT_COUNTERS
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 76ac4db..2f7c08f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -20,6 +20,7 @@
 #include <linux/percpu.h>
 #include <linux/ptrace.h>
 #include <linux/vmstat.h>
+#include <linux/vmalloc.h>
 #include <linux/hardirq.h>
 #include <linux/rculist.h>
 #include <linux/uaccess.h>
@@ -2105,49 +2106,31 @@ unlock:
 	rcu_read_unlock();
 }
 
-static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+static unsigned long perf_data_size(struct perf_mmap_data *data)
 {
-	struct perf_event *event = vma->vm_file->private_data;
-	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(event->data);
-	if (!data)
-		goto unlock;
-
-	if (vmf->pgoff == 0) {
-		vmf->page = virt_to_page(data->user_page);
-	} else {
-		int nr = vmf->pgoff - 1;
-
-		if ((unsigned)nr > data->nr_pages)
-			goto unlock;
+	return data->nr_pages << (PAGE_SHIFT + data->data_order);
+}
 
-		if (vmf->flags & FAULT_FLAG_WRITE)
-			goto unlock;
+#ifndef CONFIG_PERF_WANTS_VMALLOC
 
-		vmf->page = virt_to_page(data->data_pages[nr]);
-	}
+/*
+ * Back perf_mmap() with regular GFP_KERNEL-0 pages.
+ */
 
-	get_page(vmf->page);
-	vmf->page->mapping = vma->vm_file->f_mapping;
-	vmf->page->index   = vmf->pgoff;
+static struct page *
+perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
+{
+	if (pgoff > data->nr_pages)
+		return NULL;
 
-	ret = 0;
-unlock:
-	rcu_read_unlock();
+	if (pgoff == 0)
+		return virt_to_page(data->user_page);
 
-	return ret;
+	return virt_to_page(data->data_pages[pgoff - 1]);
 }
 
-static int perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
+static struct perf_mmap_data *
+perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 {
 	struct perf_mmap_data *data;
 	unsigned long size;
@@ -2172,19 +2155,10 @@ static int perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 			goto fail_data_pages;
 	}
 
+	data->data_order = 0;
 	data->nr_pages = nr_pages;
-	atomic_set(&data->lock, -1);
-
-	if (event->attr.watermark) {
-		data->watermark = min_t(long, PAGE_SIZE * nr_pages,
-				      event->attr.wakeup_watermark);
-	}
-	if (!data->watermark)
-		data->watermark = max(PAGE_SIZE, PAGE_SIZE * nr_pages / 4);
 
-	rcu_assign_pointer(event->data, data);
-
-	return 0;
+	return data;
 
 fail_data_pages:
 	for (i--; i >= 0; i--)
@@ -2196,7 +2170,7 @@ fail_user_page:
 	kfree(data);
 
 fail:
-	return -ENOMEM;
+	return NULL;
 }
 
 static void perf_mmap_free_page(unsigned long addr)
@@ -2207,28 +2181,169 @@ static void perf_mmap_free_page(unsigned long addr)
 	__free_page(page);
 }
 
-static void __perf_mmap_data_free(struct rcu_head *rcu_head)
+static void perf_mmap_data_free(struct perf_mmap_data *data)
 {
-	struct perf_mmap_data *data;
 	int i;
 
-	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
-
 	perf_mmap_free_page((unsigned long)data->user_page);
 	for (i = 0; i < data->nr_pages; i++)
 		perf_mmap_free_page((unsigned long)data->data_pages[i]);
+}
+
+#else
+
+/*
+ * Back perf_mmap() with vmalloc memory.
+ *
+ * Required for architectures that have d-cache aliasing issues.
+ */
+
+static struct page *
+perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
+{
+	if (pgoff > (1UL << data->data_order))
+		return NULL;
+
+	return vmalloc_to_page((void *)data->user_page + pgoff * PAGE_SIZE);
+}
+
+static void perf_mmap_unmark_page(void *addr)
+{
+	struct page *page = vmalloc_to_page(addr);
+
+	page->mapping = NULL;
+}
+
+static void perf_mmap_data_free_work(struct work_struct *work)
+{
+	struct perf_mmap_data *data;
+	void *base;
+	int i, nr;
+
+	data = container_of(work, struct perf_mmap_data, work);
+	nr = 1 << data->data_order;
+
+	base = data->user_page;
+	for (i = 0; i < nr + 1; i++)
+		perf_mmap_unmark_page(base + (i * PAGE_SIZE));
+
+	vfree(base);
+}
+
+static void perf_mmap_data_free(struct perf_mmap_data *data)
+{
+	schedule_work(&data->work);
+}
+
+static struct perf_mmap_data *
+perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
+{
+	struct perf_mmap_data *data;
+	unsigned long size;
+	void *all_buf;
 
+	WARN_ON(atomic_read(&event->mmap_count));
+
+	size = sizeof(struct perf_mmap_data);
+	size += sizeof(void *);
+
+	data = kzalloc(size, GFP_KERNEL);
+	if (!data)
+		goto fail;
+
+	INIT_WORK(&data->work, perf_mmap_data_free_work);
+
+	all_buf = vmalloc_user((nr_pages + 1) * PAGE_SIZE);
+	if (!all_buf)
+		goto fail_all_buf;
+
+	data->user_page = all_buf;
+	data->data_pages[0] = all_buf + PAGE_SIZE;
+	data->data_order = ilog2(nr_pages);
+	data->nr_pages = 1;
+
+	return data;
+
+fail_all_buf:
+	kfree(data);
+
+fail:
+	return NULL;
+}
+
+#endif
+
+static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+	struct perf_event *event = vma->vm_file->private_data;
+	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(event->data);
+	if (!data)
+		goto unlock;
+
+	if (vmf->pgoff && (vmf->flags & FAULT_FLAG_WRITE))
+		goto unlock;
+
+	vmf->page = perf_mmap_to_page(data, vmf->pgoff);
+	if (!vmf->page)
+		goto unlock;
+
+	get_page(vmf->page);
+	vmf->page->mapping = vma->vm_file->f_mapping;
+	vmf->page->index   = vmf->pgoff;
+
+	ret = 0;
+unlock:
+	rcu_read_unlock();
+
+	return ret;
+}
+
+static void
+perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
+{
+	long max_size = perf_data_size(data);
+
+	atomic_set(&data->lock, -1);
+
+	if (event->attr.watermark) {
+		data->watermark = min_t(long, max_size,
+					event->attr.wakeup_watermark);
+	}
+
+	if (!data->watermark)
+		data->watermark = max_t(long, PAGE_SIZE, max_size / 2);
+
+
+	rcu_assign_pointer(event->data, data);
+}
+
+static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head)
+{
+	struct perf_mmap_data *data;
+
+	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
+	perf_mmap_data_free(data);
 	kfree(data);
 }
 
-static void perf_mmap_data_free(struct perf_event *event)
+static void perf_mmap_data_release(struct perf_event *event)
 {
 	struct perf_mmap_data *data = event->data;
 
 	WARN_ON(atomic_read(&event->mmap_count));
 
 	rcu_assign_pointer(event->data, NULL);
-	call_rcu(&data->rcu_head, __perf_mmap_data_free);
+	call_rcu(&data->rcu_head, perf_mmap_data_free_rcu);
 }
 
 static void perf_mmap_open(struct vm_area_struct *vma)
@@ -2244,11 +2359,12 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 
 	WARN_ON_ONCE(event->ctx->parent_ctx);
 	if (atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) {
+		unsigned long size = perf_data_size(event->data);
 		struct user_struct *user = current_user();
 
-		atomic_long_sub(event->data->nr_pages + 1, &user->locked_vm);
+		atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
 		vma->vm_mm->locked_vm -= event->data->nr_locked;
-		perf_mmap_data_free(event);
+		perf_mmap_data_release(event);
 		mutex_unlock(&event->mmap_mutex);
 	}
 }
@@ -2266,6 +2382,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	unsigned long user_locked, user_lock_limit;
 	struct user_struct *user = current_user();
 	unsigned long locked, lock_limit;
+	struct perf_mmap_data *data;
 	unsigned long vma_size;
 	unsigned long nr_pages;
 	long user_extra, extra;
@@ -2328,10 +2445,15 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	}
 
 	WARN_ON(event->data);
-	ret = perf_mmap_data_alloc(event, nr_pages);
-	if (ret)
+
+	data = perf_mmap_data_alloc(event, nr_pages);
+	ret = -ENOMEM;
+	if (!data)
 		goto unlock;
 
+	ret = 0;
+	perf_mmap_data_init(event, data);
+
 	atomic_set(&event->mmap_count, 1);
 	atomic_long_add(user_extra, &user->locked_vm);
 	vma->vm_mm->locked_vm += extra;
@@ -2519,7 +2641,7 @@ static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
 	if (!data->writable)
 		return true;
 
-	mask = (data->nr_pages << PAGE_SHIFT) - 1;
+	mask = perf_data_size(data) - 1;
 
 	offset = (offset - tail) & mask;
 	head   = (head   - tail) & mask;
@@ -2624,7 +2746,7 @@ void perf_output_copy(struct perf_output_handle *handle,
 		      const void *buf, unsigned int len)
 {
 	unsigned int pages_mask;
-	unsigned int offset;
+	unsigned long offset;
 	unsigned int size;
 	void **pages;
 
@@ -2633,12 +2755,14 @@ void perf_output_copy(struct perf_output_handle *handle,
 	pages		= handle->data->data_pages;
 
 	do {
-		unsigned int page_offset;
+		unsigned long page_offset;
+		unsigned long page_size;
 		int nr;
 
 		nr	    = (offset >> PAGE_SHIFT) & pages_mask;
-		page_offset = offset & (PAGE_SIZE - 1);
-		size	    = min_t(unsigned int, PAGE_SIZE - page_offset, len);
+		page_size   = 1UL << (handle->data->data_order + PAGE_SHIFT);
+		page_offset = offset & (page_size - 1);
+		size	    = min_t(unsigned int, page_size - page_offset, len);
 
 		memcpy(pages[nr] + page_offset, buf, size);
 
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index f1946d1..97398b0 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -455,3 +455,6 @@ will need at least this:
 
 If your architecture does have hardware capabilities, you can override the
 weak stub hw_perf_event_init() to register hardware counters.
+
+Architectures that have d-cache aliassing issues, such as Sparc and ARM,
+should select PERF_NEEDS_VMALLOC in order to avoid these for perf mmap().

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

* [tip:core/futexes] futex: Fix locking imbalance
       [not found]             ` <new-submission>
                                 ` (427 preceding siblings ...)
  2009-09-25  8:49               ` [tip:perf/urgent] perf_event: Provide vmalloc() based mmap() backing tip-bot for Peter Zijlstra
@ 2009-10-04  7:54               ` tip-bot for Thomas Gleixner
  2009-10-04 15:48               ` [tip:core/urgent] " tip-bot for Thomas Gleixner
                                 ` (277 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-10-04  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dvhltc, linux-kernel, hpa, mingo, a.p.zijlstra, stable, rercola,
	tglx, mingo

Commit-ID:  9694d494b7f462bffb86654fabe9e1ec2b2b0c47
Gitweb:     http://git.kernel.org/tip/9694d494b7f462bffb86654fabe9e1ec2b2b0c47
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 4 Oct 2009 09:34:17 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 4 Oct 2009 09:46:56 +0200

futex: Fix locking imbalance

Rich reported a lock imbalance in the futex code.
(http://bugzilla.kernel.org/show_bug.cgi?id=14288)

It's caused by the displacement of the retry_private label in
futex_wake_op(). The code unlocks the hash bucket locks in the error
handling path and retries without locking them again which makes the
next unlock fail.

Move retry_private so we lock the hash bucket locks when we retry.

Reported-by: Rich Ercolany <rercola@acm.jhu.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: stable-2.6.31 <stable@kernel.org>


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

diff --git a/kernel/futex.c b/kernel/futex.c
index b911adc..a2f7538 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -916,8 +916,8 @@ retry:
 	hb1 = hash_futex(&key1);
 	hb2 = hash_futex(&key2);
 
-	double_lock_hb(hb1, hb2);
 retry_private:
+	double_lock_hb(hb1, hb2);
 	op_ret = futex_atomic_op_inuser(op, uaddr2);
 	if (unlikely(op_ret < 0)) {
 

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

* [tip:core/urgent] futex: Fix locking imbalance
       [not found]             ` <new-submission>
                                 ` (428 preceding siblings ...)
  2009-10-04  7:54               ` [tip:core/futexes] futex: Fix locking imbalance tip-bot for Thomas Gleixner
@ 2009-10-04 15:48               ` tip-bot for Thomas Gleixner
  2009-10-05 19:11               ` tip-bot for Thomas Gleixner
                                 ` (276 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-10-04 15:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dvhltc, hpa, mingo, a.p.zijlstra, rercola, stable,
	tglx, mingo

Commit-ID:  bfeed8fcf9970d2c3bcd7950124e77fd49930e36
Gitweb:     http://git.kernel.org/tip/bfeed8fcf9970d2c3bcd7950124e77fd49930e36
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 4 Oct 2009 09:34:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 4 Oct 2009 17:46:13 +0200

futex: Fix locking imbalance

Rich reported a lock imbalance in the futex code:

   http://bugzilla.kernel.org/show_bug.cgi?id=14288

It's caused by the displacement of the retry_private label in
futex_wake_op(). The code unlocks the hash bucket locks in the
error handling path and retries without locking them again which
makes the next unlock fail.

Move retry_private so we lock the hash bucket locks when we retry.

Reported-by: Rich Ercolany <rercola@acm.jhu.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: stable-2.6.31 <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/kernel/futex.c b/kernel/futex.c
index 463af2e..1e176f3 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -916,8 +916,8 @@ retry:
 	hb1 = hash_futex(&key1);
 	hb2 = hash_futex(&key2);
 
-	double_lock_hb(hb1, hb2);
 retry_private:
+	double_lock_hb(hb1, hb2);
 	op_ret = futex_atomic_op_inuser(op, uaddr2);
 	if (unlikely(op_ret < 0)) {
 

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

* [tip:core/urgent] futex: Fix locking imbalance
       [not found]             ` <new-submission>
                                 ` (429 preceding siblings ...)
  2009-10-04 15:48               ` [tip:core/urgent] " tip-bot for Thomas Gleixner
@ 2009-10-05 19:11               ` tip-bot for Thomas Gleixner
  2009-10-06 13:18               ` [tip:perf/core] perf tools: Default to 1 KHz auto-sampling freq events tip-bot for Ingo Molnar
                                 ` (275 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-10-05 19:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dvhltc, hpa, mingo, a.p.zijlstra, rercola, stable,
	tglx, mingo

Commit-ID:  eaaea8036d0261d87d7072c5bc88c7ea730c18ac
Gitweb:     http://git.kernel.org/tip/eaaea8036d0261d87d7072c5bc88c7ea730c18ac
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 4 Oct 2009 09:34:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 5 Oct 2009 21:08:14 +0200

futex: Fix locking imbalance

Rich reported a lock imbalance in the futex code:

   http://bugzilla.kernel.org/show_bug.cgi?id=14288

It's caused by the displacement of the retry_private label in
futex_wake_op(). The code unlocks the hash bucket locks in the
error handling path and retries without locking them again which
makes the next unlock fail.

Move retry_private so we lock the hash bucket locks when we retry.

Reported-by: Rich Ercolany <rercola@acm.jhu.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: stable-2.6.31 <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/kernel/futex.c b/kernel/futex.c
index 463af2e..1e176f3 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -916,8 +916,8 @@ retry:
 	hb1 = hash_futex(&key1);
 	hb2 = hash_futex(&key2);
 
-	double_lock_hb(hb1, hb2);
 retry_private:
+	double_lock_hb(hb1, hb2);
 	op_ret = futex_atomic_op_inuser(op, uaddr2);
 	if (unlikely(op_ret < 0)) {
 

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

* [tip:perf/core] perf tools: Default to 1 KHz auto-sampling freq events
       [not found]             ` <new-submission>
                                 ` (430 preceding siblings ...)
  2009-10-05 19:11               ` tip-bot for Thomas Gleixner
@ 2009-10-06 13:18               ` tip-bot for Ingo Molnar
  2009-10-06 13:42               ` tip-bot for Ingo Molnar
                                 ` (274 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-10-06 13:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  94cad86678b8037a0379605289a531e4f44c1801
Gitweb:     http://git.kernel.org/tip/94cad86678b8037a0379605289a531e4f44c1801
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 6 Oct 2009 15:14:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 6 Oct 2009 15:16:13 +0200

perf tools: Default to 1 KHz auto-sampling freq events

Use auto-freq events by default in perf record and
perf top.

This allows more consistent hardware event sampling,
regardless of the intensity of the underlying event.

It also keeps us from over-sampling on larger/busier
systems.

(also make surrounding initializations more consistent)

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/builtin-record.c |   58 +++++++++++++++++++++---------------------
 tools/perf/builtin-top.c    |   38 ++++++++++++++--------------
 2 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3eeef33..1a3fe4f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -29,43 +29,43 @@ static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static long			default_interval		= 100000;
 
-static int			nr_cpus				= 0;
+static int			nr_cpus				=      0;
 static unsigned int		page_size;
-static unsigned int		mmap_pages			= 128;
-static int			freq				= 0;
+static unsigned int		mmap_pages			=    128;
+static int			freq				=   1000;
 static int			output;
 static const char		*output_name			= "perf.data";
-static int			group				= 0;
-static unsigned int		realtime_prio			= 0;
-static int			raw_samples			= 0;
-static int			system_wide			= 0;
-static int			profile_cpu			= -1;
-static pid_t			target_pid			= -1;
-static pid_t			child_pid			= -1;
-static int			inherit				= 1;
-static int			force				= 0;
-static int			append_file			= 0;
-static int			call_graph			= 0;
-static int			inherit_stat			= 0;
-static int			no_samples			= 0;
-static int			sample_address			= 0;
-static int			multiplex			= 0;
-static int			multiplex_fd			= -1;
-
-static long			samples;
-static struct timeval		last_read;
-static struct timeval		this_read;
-
-static u64			bytes_written;
+static int			group				=      0;
+static unsigned int		realtime_prio			=      0;
+static int			raw_samples			=      0;
+static int			system_wide			=      0;
+static int			profile_cpu			=     -1;
+static pid_t			target_pid			=     -1;
+static pid_t			child_pid			=     -1;
+static int			inherit				=      1;
+static int			force				=      0;
+static int			append_file			=      0;
+static int			call_graph			=      0;
+static int			inherit_stat			=      0;
+static int			no_samples			=      0;
+static int			sample_address			=      0;
+static int			multiplex			=      0;
+static int			multiplex_fd			=     -1;
+
+static long			samples				=      0;
+static struct timeval		last_read			=      0;
+static struct timeval		this_read			=      0;
+
+static u64			bytes_written			=      0;
 
 static struct pollfd		event_array[MAX_NR_CPUS * MAX_COUNTERS];
 
-static int			nr_poll;
-static int			nr_cpu;
+static int			nr_poll				=      0;
+static int			nr_cpu				=      0;
 
-static int			file_new = 1;
+static int			file_new			=      1;
 
-struct perf_header		*header;
+struct perf_header		*header				=   NULL;
 
 struct mmap_data {
 	int			counter;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c574c5b..d978dc9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -55,26 +55,26 @@
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static int			system_wide			=  0;
+static int			system_wide			=      0;
 
 static int			default_interval		= 100000;
 
-static int			count_filter			=  5;
-static int			print_entries			= 15;
+static int			count_filter			=      5;
+static int			print_entries			=     15;
 
-static int			target_pid			= -1;
-static int			inherit				=  0;
-static int			profile_cpu			= -1;
-static int			nr_cpus				=  0;
-static unsigned int		realtime_prio			=  0;
-static int			group				=  0;
+static int			target_pid			=     -1;
+static int			inherit				=      0;
+static int			profile_cpu			=     -1;
+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				=   1000; /* 1 KHz */
 
-static int			delay_secs			=  2;
-static int			zero;
-static int			dump_symtab;
+static int			delay_secs			=      2;
+static int			zero                            =      0;
+static int			dump_symtab                     =      0;
 
 /*
  * Source
@@ -87,11 +87,11 @@ struct source_line {
 	struct source_line	*next;
 };
 
-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;
+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

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

* [tip:perf/core] perf tools: Default to 1 KHz auto-sampling freq events
       [not found]             ` <new-submission>
                                 ` (431 preceding siblings ...)
  2009-10-06 13:18               ` [tip:perf/core] perf tools: Default to 1 KHz auto-sampling freq events tip-bot for Ingo Molnar
@ 2009-10-06 13:42               ` tip-bot for Ingo Molnar
  2009-10-06 15:03               ` [tip:core/urgent] futex: Nullify robust lists after cleanup tip-bot for Peter Zijlstra
                                 ` (273 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-10-06 13:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  42e59d7d19dc4b49feab2a860fd9a8ca3248c833
Gitweb:     http://git.kernel.org/tip/42e59d7d19dc4b49feab2a860fd9a8ca3248c833
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 6 Oct 2009 15:14:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 6 Oct 2009 15:41:09 +0200

perf tools: Default to 1 KHz auto-sampling freq events

Use auto-freq events by default in perf record and
perf top.

This allows more consistent hardware event sampling,
regardless of the intensity of the underlying event.

It also keeps us from over-sampling on larger/busier
systems.

(also make surrounding initializations more consistent)

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/builtin-record.c |   52 +++++++++++++++++++++---------------------
 tools/perf/builtin-top.c    |   38 +++++++++++++++---------------
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3eeef33..494f8c7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -29,43 +29,43 @@ static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
 static long			default_interval		= 100000;
 
-static int			nr_cpus				= 0;
+static int			nr_cpus				=      0;
 static unsigned int		page_size;
-static unsigned int		mmap_pages			= 128;
-static int			freq				= 0;
+static unsigned int		mmap_pages			=    128;
+static int			freq				=   1000;
 static int			output;
 static const char		*output_name			= "perf.data";
-static int			group				= 0;
-static unsigned int		realtime_prio			= 0;
-static int			raw_samples			= 0;
-static int			system_wide			= 0;
-static int			profile_cpu			= -1;
-static pid_t			target_pid			= -1;
-static pid_t			child_pid			= -1;
-static int			inherit				= 1;
-static int			force				= 0;
-static int			append_file			= 0;
-static int			call_graph			= 0;
-static int			inherit_stat			= 0;
-static int			no_samples			= 0;
-static int			sample_address			= 0;
-static int			multiplex			= 0;
-static int			multiplex_fd			= -1;
-
-static long			samples;
+static int			group				=      0;
+static unsigned int		realtime_prio			=      0;
+static int			raw_samples			=      0;
+static int			system_wide			=      0;
+static int			profile_cpu			=     -1;
+static pid_t			target_pid			=     -1;
+static pid_t			child_pid			=     -1;
+static int			inherit				=      1;
+static int			force				=      0;
+static int			append_file			=      0;
+static int			call_graph			=      0;
+static int			inherit_stat			=      0;
+static int			no_samples			=      0;
+static int			sample_address			=      0;
+static int			multiplex			=      0;
+static int			multiplex_fd			=     -1;
+
+static long			samples				=      0;
 static struct timeval		last_read;
 static struct timeval		this_read;
 
-static u64			bytes_written;
+static u64			bytes_written			=      0;
 
 static struct pollfd		event_array[MAX_NR_CPUS * MAX_COUNTERS];
 
-static int			nr_poll;
-static int			nr_cpu;
+static int			nr_poll				=      0;
+static int			nr_cpu				=      0;
 
-static int			file_new = 1;
+static int			file_new			=      1;
 
-struct perf_header		*header;
+struct perf_header		*header				=   NULL;
 
 struct mmap_data {
 	int			counter;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c574c5b..d978dc9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -55,26 +55,26 @@
 
 static int			fd[MAX_NR_CPUS][MAX_COUNTERS];
 
-static int			system_wide			=  0;
+static int			system_wide			=      0;
 
 static int			default_interval		= 100000;
 
-static int			count_filter			=  5;
-static int			print_entries			= 15;
+static int			count_filter			=      5;
+static int			print_entries			=     15;
 
-static int			target_pid			= -1;
-static int			inherit				=  0;
-static int			profile_cpu			= -1;
-static int			nr_cpus				=  0;
-static unsigned int		realtime_prio			=  0;
-static int			group				=  0;
+static int			target_pid			=     -1;
+static int			inherit				=      0;
+static int			profile_cpu			=     -1;
+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				=   1000; /* 1 KHz */
 
-static int			delay_secs			=  2;
-static int			zero;
-static int			dump_symtab;
+static int			delay_secs			=      2;
+static int			zero                            =      0;
+static int			dump_symtab                     =      0;
 
 /*
  * Source
@@ -87,11 +87,11 @@ struct source_line {
 	struct source_line	*next;
 };
 
-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;
+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

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

* [tip:core/urgent] futex: Nullify robust lists after cleanup
       [not found]             ` <new-submission>
                                 ` (432 preceding siblings ...)
  2009-10-06 13:42               ` tip-bot for Ingo Molnar
@ 2009-10-06 15:03               ` tip-bot for Peter Zijlstra
  2009-10-06 15:54                 ` Anirban Sinha
  2009-10-06 15:03               ` [tip:core/urgent] futex: Move exit_pi_state() call to release_mm() tip-bot for Thomas Gleixner
                                 ` (272 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-10-06 15:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, ani

Commit-ID:  fc6b177dee33365ccb29fe6d2092223cf8d679f9
Gitweb:     http://git.kernel.org/tip/fc6b177dee33365ccb29fe6d2092223cf8d679f9
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 5 Oct 2009 18:17:32 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 6 Oct 2009 17:00:01 +0200

futex: Nullify robust lists after cleanup

The robust list pointers of user space held futexes are kept intact
over an exec() call. When the exec'ed task exits exit_robust_list() is
called with the stale pointer. The risk of corruption is minimal, but
still it is incorrect to keep the pointers valid. Actually glibc
should uninstall the robust list before calling exec() but we have to
deal with it anyway.

Nullify the pointers after [compat_]exit_robust_list() has been
called.

Reported-by: Anirban Sinha <ani@anirban.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: stable@kernel.org
---
 kernel/fork.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index bfee931..88ef51c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -543,11 +543,15 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
 
 	/* Get rid of any futexes when releasing the mm */
 #ifdef CONFIG_FUTEX
-	if (unlikely(tsk->robust_list))
+	if (unlikely(tsk->robust_list)) {
 		exit_robust_list(tsk);
+		tsk->robust_list = NULL;
+	}
 #ifdef CONFIG_COMPAT
-	if (unlikely(tsk->compat_robust_list))
+	if (unlikely(tsk->compat_robust_list)) {
 		compat_exit_robust_list(tsk);
+		tsk->compat_robust_list = NULL;
+	}
 #endif
 #endif
 

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

* [tip:core/urgent] futex: Move exit_pi_state() call to release_mm()
       [not found]             ` <new-submission>
                                 ` (433 preceding siblings ...)
  2009-10-06 15:03               ` [tip:core/urgent] futex: Nullify robust lists after cleanup tip-bot for Peter Zijlstra
@ 2009-10-06 15:03               ` tip-bot for Thomas Gleixner
  2009-10-12  7:13               ` [tip:perf/core] perf sched: Add -C option to measure on a specific CPU tip-bot for Mike Galbraith
                                 ` (271 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-10-06 15:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, ani

Commit-ID:  322a2c100a8998158445599ea437fb556aa95b11
Gitweb:     http://git.kernel.org/tip/322a2c100a8998158445599ea437fb556aa95b11
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 5 Oct 2009 18:18:03 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 6 Oct 2009 17:00:01 +0200

futex: Move exit_pi_state() call to release_mm()

exit_pi_state() is called from do_exit() but not from do_execve().
Move it to release_mm() so it gets called from do_execve() as well.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: stable@kernel.org
Cc: Anirban Sinha <ani@anirban.org>
Cc: Peter Zijlstra <peterz@infradead.org>

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

diff --git a/kernel/exit.c b/kernel/exit.c
index ae5d866..bc2b1fd 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -989,8 +989,6 @@ NORET_TYPE void do_exit(long code)
 	tsk->mempolicy = NULL;
 #endif
 #ifdef CONFIG_FUTEX
-	if (unlikely(!list_empty(&tsk->pi_state_list)))
-		exit_pi_state_list(tsk);
 	if (unlikely(current->pi_state_cache))
 		kfree(current->pi_state_cache);
 #endif
diff --git a/kernel/fork.c b/kernel/fork.c
index 88ef51c..341965b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -553,6 +553,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
 		tsk->compat_robust_list = NULL;
 	}
 #endif
+	if (unlikely(!list_empty(&tsk->pi_state_list)))
+		exit_pi_state_list(tsk);
 #endif
 
 	/* Get rid of any cached register state */

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

* Re: [tip:core/urgent] futex: Nullify robust lists after cleanup
  2009-10-06 15:03               ` [tip:core/urgent] futex: Nullify robust lists after cleanup tip-bot for Peter Zijlstra
@ 2009-10-06 15:54                 ` Anirban Sinha
  0 siblings, 0 replies; 1150+ messages in thread
From: Anirban Sinha @ 2009-10-06 15:54 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, peterz, tglx, ani, asinha; +Cc: linux-tip-commits



Once upon a time, like on 09-10-06 8:03 AM, tip-bot for Peter Zijlstra wrote:

> futex: Nullify robust lists after cleanup
> 
> The robust list pointers of user space held futexes are kept intact
> over an exec() call. When the exec'ed task exits exit_robust_list() is
> called with the stale pointer. The risk of corruption is minimal, but
> still it is incorrect to keep the pointers valid. Actually glibc
> should uninstall the robust list before calling exec() but we have to
> deal with it anyway.
> 
> Nullify the pointers after [compat_]exit_robust_list() has been
> called.
> 
> Reported-by: Anirban Sinha <ani@anirban.org>
> Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> LKML-Reference: <new-submission>
> Cc: stable@kernel.org

Excellent! I very much like the solution because:

(a)  it reiterates the fact that an execve() call is indeed logically the
'death' of a process.
'(b) cleans up state that should not logically propagate across an execve() call.
(c) Does not introduce new EWOULDBLOCK semantics that can potentially break user
land.
(d) Restores the 'robust' behavior of futexes by waking up other processes
waiting on it on an exec() call.
(e) handles potentially broken/buggy applications gracefully.
(f) as far as I can see, the world would be better and no worse with this patch :)

I'll let you guys know if something else strikes my eyes as being odd in the
course of my digging through the code.

Ani


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

* [tip:perf/core] perf sched: Add -C option to measure on a specific CPU
       [not found]             ` <new-submission>
                                 ` (434 preceding siblings ...)
  2009-10-06 15:03               ` [tip:core/urgent] futex: Move exit_pi_state() call to release_mm() tip-bot for Thomas Gleixner
@ 2009-10-12  7:13               ` tip-bot for Mike Galbraith
  2009-10-13 19:04               ` [tip:core/urgent] futex: Handle spurious wake up tip-bot for Thomas Gleixner
                                 ` (270 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-10-12  7:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, efault, tglx, mingo

Commit-ID:  55ffb7a6bd45d0083ffb132381cb46964a4afe01
Gitweb:     http://git.kernel.org/tip/55ffb7a6bd45d0083ffb132381cb46964a4afe01
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Sat, 10 Oct 2009 14:46:04 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 12 Oct 2009 09:10:55 +0200

perf sched: Add -C option to measure on a specific CPU

To refresh, trying to sched record only one CPU results in bogus
latencies as below.

I fixed^Wmade it stop doing the bad thing today, by
following task migration events properly.

Before:

  marge:/root/tmp # taskset -c 1 perf sched record -C 0 -- sleep 10
  marge:/root/tmp # perf sched lat
   -----------------------------------------------------------------------------------------
    Task                  |   Runtime ms  | Switches | Average delay ms | Maximum delay ms |
   -----------------------------------------------------------------------------------------
    Xorg:4943             |      1.290 ms |        1 | avg: 1670.132 ms | max: 1670.132 ms |
    hald-addon-stor:3569  |      0.091 ms |        3 | avg:  658.609 ms | max: 1975.797 ms |
    hald-addon-stor:3573  |      0.209 ms |        4 | avg:  499.138 ms | max: 1990.565 ms |
    audispd:4270          |      0.012 ms |        1 | avg:    0.015 ms | max:    0.015 ms |
  ....

  marge:/root/tmp # perf sched trace|grep 'Xorg:4943'
           swapper-0     [000]   401.184013288: sched_stat_runtime: task: Xorg:4943 runtime: 1233188 [ns], vruntime: 19105169779 [ns]
   rt2870TimerQHan-4947  [000]   402.854140127: sched_stat_wait: task: Xorg:4943 wait: 580073 [ns]
   rt2870TimerQHan-4947  [000]   402.854141770: sched_migrate_task: task Xorg:4943 [140] from: 1  to: 0
   rt2870TimerQHan-4947  [000]   402.854143854: sched_stat_wait: task: Xorg:4943 wait: 0 [ns]
   rt2870TimerQHan-4947  [000]   402.854145397: sched_switch: task rt2870TimerQHan:4947 [140] (D) ==> Xorg:4943 [140]
              Xorg-4943  [000]   402.854193133: sched_stat_runtime: task: Xorg:4943 runtime: 56546 [ns], vruntime: 11766332500 [ns]
              Xorg-4943  [000]   402.854196842: sched_switch: task Xorg:4943 [140] (S) ==> swapper:0 [140]

After:

  marge:/root/tmp # taskset -c 1 perf sched record -C 0 -- sleep 10
  marge:/root/tmp # perf sched lat
   -----------------------------------------------------------------------------------------
    Task                  |   Runtime ms  | Switches | Average delay ms | Maximum delay ms |
   -----------------------------------------------------------------------------------------
    amarokapp:11150       |    271.297 ms |      878 | avg:    0.130 ms | max:    1.057 ms |
    konsole:5965          |      1.370 ms |       12 | avg:    0.092 ms | max:    0.855 ms |
    Xorg:4943             |    179.980 ms |     1109 | avg:    0.087 ms | max:    1.206 ms |
    hald-addon-stor:3574  |      0.212 ms |        9 | avg:    0.040 ms | max:    0.169 ms |
    hald-addon-stor:3570  |      0.223 ms |        9 | avg:    0.037 ms | max:    0.223 ms |
    klauncher:5864        |      0.550 ms |        8 | avg:    0.032 ms | max:    0.048 ms |

The 'Maximum delay ms' results are now sane.

Signed-off-by: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-sched.c |  101 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 100 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 6b00529..387a442 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -33,6 +33,8 @@ static u64			sample_type;
 static char			default_sort_order[] = "avg, max, switch, runtime";
 static char			*sort_order = default_sort_order;
 
+static int			profile_cpu = -1;
+
 static char			*cwd;
 static int			cwdlen;
 
@@ -75,6 +77,7 @@ enum sched_event_type {
 	SCHED_EVENT_RUN,
 	SCHED_EVENT_SLEEP,
 	SCHED_EVENT_WAKEUP,
+	SCHED_EVENT_MIGRATION,
 };
 
 struct sched_atom {
@@ -399,6 +402,8 @@ process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom)
 				ret = sem_post(atom->wait_sem);
 			BUG_ON(ret);
 			break;
+		case SCHED_EVENT_MIGRATION:
+			break;
 		default:
 			BUG_ON(1);
 	}
@@ -746,6 +751,22 @@ struct trace_fork_event {
 	u32 child_pid;
 };
 
+struct trace_migrate_task_event {
+	u32 size;
+
+	u16 common_type;
+	u8 common_flags;
+	u8 common_preempt_count;
+	u32 common_pid;
+	u32 common_tgid;
+
+	char comm[16];
+	u32 pid;
+
+	u32 prio;
+	u32 cpu;
+};
+
 struct trace_sched_handler {
 	void (*switch_event)(struct trace_switch_event *,
 			     struct event *,
@@ -770,6 +791,12 @@ struct trace_sched_handler {
 			   int cpu,
 			   u64 timestamp,
 			   struct thread *thread);
+
+	void (*migrate_task_event)(struct trace_migrate_task_event *,
+			   struct event *,
+			   int cpu,
+			   u64 timestamp,
+			   struct thread *thread);
 };
 
 
@@ -1140,7 +1167,12 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 
 	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
 
-	if (atom->state != THREAD_SLEEPING)
+	/*
+	 * You WILL be missing events if you've recorded only
+	 * one CPU, or are only looking at only one, so don't
+	 * make useless noise.
+	 */
+	if (profile_cpu == -1 && atom->state != THREAD_SLEEPING)
 		nr_state_machine_bugs++;
 
 	nr_timestamps++;
@@ -1153,11 +1185,51 @@ latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
 	atom->wake_up_time = timestamp;
 }
 
+static void
+latency_migrate_task_event(struct trace_migrate_task_event *migrate_task_event,
+		     struct event *__event __used,
+		     int cpu __used,
+		     u64 timestamp,
+		     struct thread *thread __used)
+{
+	struct work_atoms *atoms;
+	struct work_atom *atom;
+	struct thread *migrant;
+
+	/*
+	 * Only need to worry about migration when profiling one CPU.
+	 */
+	if (profile_cpu == -1)
+		return;
+
+	migrant = threads__findnew(migrate_task_event->pid, &threads, &last_match);
+	atoms = thread_atoms_search(&atom_root, migrant, &cmp_pid);
+	if (!atoms) {
+		thread_atoms_insert(migrant);
+		register_pid(migrant->pid, migrant->comm);
+		atoms = thread_atoms_search(&atom_root, migrant, &cmp_pid);
+		if (!atoms)
+			die("migration-event: Internal tree error");
+		add_sched_out_event(atoms, 'R', timestamp);
+	}
+
+	BUG_ON(list_empty(&atoms->work_list));
+
+	atom = list_entry(atoms->work_list.prev, struct work_atom, list);
+	atom->sched_in_time = atom->sched_out_time = atom->wake_up_time = timestamp;
+
+	nr_timestamps++;
+
+	if (atom->sched_out_time > timestamp)
+		nr_unordered_timestamps++;
+}
+
 static struct trace_sched_handler lat_ops  = {
 	.wakeup_event		= latency_wakeup_event,
 	.switch_event		= latency_switch_event,
 	.runtime_event		= latency_runtime_event,
 	.fork_event		= latency_fork_event,
+	.migrate_task_event	= latency_migrate_task_event,
 };
 
 static void output_lat_thread(struct work_atoms *work_list)
@@ -1518,6 +1590,26 @@ process_sched_exit_event(struct event *event,
 }
 
 static void
+process_sched_migrate_task_event(struct raw_event_sample *raw,
+			   struct event *event,
+			   int cpu __used,
+			   u64 timestamp __used,
+			   struct thread *thread __used)
+{
+	struct trace_migrate_task_event migrate_task_event;
+
+	FILL_COMMON_FIELDS(migrate_task_event, event, raw->data);
+
+	FILL_ARRAY(migrate_task_event, comm, event, raw->data);
+	FILL_FIELD(migrate_task_event, pid, event, raw->data);
+	FILL_FIELD(migrate_task_event, prio, event, raw->data);
+	FILL_FIELD(migrate_task_event, cpu, event, raw->data);
+
+	if (trace_handler->migrate_task_event)
+		trace_handler->migrate_task_event(&migrate_task_event, event, cpu, timestamp, thread);
+}
+
+static void
 process_raw_event(event_t *raw_event __used, void *more_data,
 		  int cpu, u64 timestamp, struct thread *thread)
 {
@@ -1540,6 +1632,8 @@ process_raw_event(event_t *raw_event __used, void *more_data,
 		process_sched_fork_event(raw, event, cpu, timestamp, thread);
 	if (!strcmp(event->name, "sched_process_exit"))
 		process_sched_exit_event(event, cpu, timestamp, thread);
+	if (!strcmp(event->name, "sched_migrate_task"))
+		process_sched_migrate_task_event(raw, event, cpu, timestamp, thread);
 }
 
 static int
@@ -1589,6 +1683,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		return -1;
 	}
 
+	if (profile_cpu != -1 && profile_cpu != (int) cpu)
+		return 0;
+
 	process_raw_event(event, more_data, cpu, timestamp, thread);
 
 	return 0;
@@ -1771,6 +1868,8 @@ static const struct option latency_options[] = {
 		   "sort by key(s): runtime, switch, avg, max"),
 	OPT_BOOLEAN('v', "verbose", &verbose,
 		    "be more verbose (show symbol address, etc)"),
+	OPT_INTEGER('C', "CPU", &profile_cpu,
+		    "CPU to profile on"),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_END()

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

* [tip:core/urgent] futex: Handle spurious wake up
       [not found]             ` <new-submission>
                                 ` (435 preceding siblings ...)
  2009-10-12  7:13               ` [tip:perf/core] perf sched: Add -C option to measure on a specific CPU tip-bot for Mike Galbraith
@ 2009-10-13 19:04               ` tip-bot for Thomas Gleixner
  2009-10-15 10:46               ` [tip:perf/core] events: Harmonize event field names and print output names tip-bot for Ingo Molnar
                                 ` (269 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-10-13 19:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, dvhltc, hpa, mingo, peterz, blaise, tglx

Commit-ID:  d58e6576b0deec6f0b9ff8450fe282da18c50883
Gitweb:     http://git.kernel.org/tip/d58e6576b0deec6f0b9ff8450fe282da18c50883
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 13 Oct 2009 20:40:43 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 13 Oct 2009 20:40:43 +0200

futex: Handle spurious wake up

The futex code does not handle spurious wake up in futex_wait and
futex_wait_requeue_pi.

The code assumes that any wake up which was not caused by futex_wake /
requeue or by a timeout was caused by a signal wake up and returns one
of the syscall restart error codes.

In case of a spurious wake up the signal delivery code which deals
with the restart error codes is not invoked and we return that error
code to user space. That causes applications which actually check the
return codes to fail. Blaise reported that on preempt-rt a python test
program run into a exception trap. -rt exposed that due to a built in
spurious wake up accelerator :)

Solve this by checking signal_pending(current) in the wake up path and
handle the spurious wake up case w/o returning to user space.

Reported-by: Blaise Gassend <blaise@willowgarage.com>
Debugged-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@kernel.org
LKML-Reference: <new-submission>
---
 kernel/futex.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 4949d33..5c88839 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1791,6 +1791,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
 					     current->timer_slack_ns);
 	}
 
+retry:
 	/* Prepare to wait on uaddr. */
 	ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
 	if (ret)
@@ -1808,9 +1809,14 @@ static int futex_wait(u32 __user *uaddr, int fshared,
 		goto out_put_key;
 
 	/*
-	 * We expect signal_pending(current), but another thread may
-	 * have handled it for us already.
+	 * We expect signal_pending(current), but we might be the
+	 * victim of a spurious wakeup as well.
 	 */
+	if (!signal_pending(current)) {
+		put_futex_key(fshared, &q.key);
+		goto retry;
+	}
+
 	ret = -ERESTARTSYS;
 	if (!abs_time)
 		goto out_put_key;
@@ -2118,9 +2124,11 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
 		 */
 		plist_del(&q->list, &q->list.plist);
 
+		/* Handle spurious wakeups gracefully */
+		ret = -EAGAIN;
 		if (timeout && !timeout->task)
 			ret = -ETIMEDOUT;
-		else
+		else if (signal_pending(current))
 			ret = -ERESTARTNOINTR;
 	}
 	return ret;
@@ -2198,6 +2206,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
 	debug_rt_mutex_init_waiter(&rt_waiter);
 	rt_waiter.task = NULL;
 
+retry:
 	key2 = FUTEX_KEY_INIT;
 	ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
 	if (unlikely(ret != 0))
@@ -2292,6 +2301,9 @@ out_put_keys:
 out_key2:
 	put_futex_key(fshared, &key2);
 
+	/* Spurious wakeup ? */
+	if (ret == -EAGAIN)
+		goto retry;
 out:
 	if (to) {
 		hrtimer_cancel(&to->timer);

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

* [tip:perf/core] events: Harmonize event field names and print output names
       [not found]             ` <new-submission>
                                 ` (436 preceding siblings ...)
  2009-10-13 19:04               ` [tip:core/urgent] futex: Handle spurious wake up tip-bot for Thomas Gleixner
@ 2009-10-15 10:46               ` tip-bot for Ingo Molnar
  2009-10-16  8:40               ` [tip:perf/urgent] perf tools: Bump version to 0.0.2 tip-bot for Ingo Molnar
                                 ` (268 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-10-15 10:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, tzanussi, a.p.zijlstra,
	lizf, efault, fweisbec, tglx, mingo

Commit-ID:  434a83c3fbb951908a3a52040f7f0e0b8ba00dd0
Gitweb:     http://git.kernel.org/tip/434a83c3fbb951908a3a52040f7f0e0b8ba00dd0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 15 Oct 2009 11:50:39 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 15 Oct 2009 12:42:03 +0200

events: Harmonize event field names and print output names

Now that we can filter based on fields via perf record, people
will start using filter expressions and will expect them to
be obvious.

The primary way to see which fields are available is by looking
at the trace output, such as:

  gcc-18676 [000]   343.011728: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.012727: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.032692: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.033690: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.034687: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.035686: irq_handler_entry: irq=0 handler=timer
  cc1-18677 [000]   343.036684: irq_handler_entry: irq=0 handler=timer

While 'irq==0' filters work, the 'handler==<x>' filter expression
does not work:

  $ perf record -R -f -a -e irq:irq_handler_entry --filter handler=timer sleep 1
   Error: failed to set filter with 22 (Invalid argument)

The problem is that while an 'irq' field exists and is recognized
as a filter field - 'handler' does not exist - its name is 'name'
in the output.

To solve this, we need to synchronize the printout and the field
names, wherever possible.

In cases where the printout prints a non-field, we enclose
that information in square brackets, such as:

  perf-1380  [013]   724.903505: softirq_exit: vec=9 [action=RCU]
  perf-1380  [013]   724.904482: softirq_exit: vec=1 [action=TIMER]

This way users can use filter expressions more intuitively: all
fields that show up as 'primary' (non-bracketed) information is
filterable.

This patch harmonizes the field names for all irq, bkl, power,
sched and timer events.

We might in fact think about dropping the print format bit of
generic tracepoints altogether, and just print the fields that
are being recorded.

Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Frederic Weisbecker <fweisbec@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>
---
 include/trace/events/bkl.h   |   18 +++++-----
 include/trace/events/irq.h   |    8 ++--
 include/trace/events/power.h |    2 -
 include/trace/events/sched.h |   44 ++++++++++++------------
 include/trace/events/timer.h |   79 ++++++++++++++++++++---------------------
 5 files changed, 74 insertions(+), 77 deletions(-)

diff --git a/include/trace/events/bkl.h b/include/trace/events/bkl.h
index 8abd620..1af72dc 100644
--- a/include/trace/events/bkl.h
+++ b/include/trace/events/bkl.h
@@ -13,7 +13,7 @@ TRACE_EVENT(lock_kernel,
 	TP_ARGS(func, file, line),
 
 	TP_STRUCT__entry(
-		__field(	int,		lock_depth		)
+		__field(	int,		depth			)
 		__field_ext(	const char *,	func, FILTER_PTR_STRING	)
 		__field_ext(	const char *,	file, FILTER_PTR_STRING	)
 		__field(	int,		line			)
@@ -21,13 +21,13 @@ TRACE_EVENT(lock_kernel,
 
 	TP_fast_assign(
 		/* We want to record the lock_depth after lock is acquired */
-		__entry->lock_depth = current->lock_depth + 1;
+		__entry->depth = current->lock_depth + 1;
 		__entry->func = func;
 		__entry->file = file;
 		__entry->line = line;
 	),
 
-	TP_printk("depth: %d, %s:%d %s()", __entry->lock_depth,
+	TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
 		  __entry->file, __entry->line, __entry->func)
 );
 
@@ -38,20 +38,20 @@ TRACE_EVENT(unlock_kernel,
 	TP_ARGS(func, file, line),
 
 	TP_STRUCT__entry(
-		__field(int,		lock_depth)
-		__field(const char *,	func)
-		__field(const char *,	file)
-		__field(int,		line)
+		__field(int,		depth		)
+		__field(const char *,	func		)
+		__field(const char *,	file		)
+		__field(int,		line		)
 	),
 
 	TP_fast_assign(
-		__entry->lock_depth = current->lock_depth;
+		__entry->depth = current->lock_depth;
 		__entry->func = func;
 		__entry->file = file;
 		__entry->line = line;
 	),
 
-	TP_printk("depth: %d, %s:%d %s()", __entry->lock_depth,
+	TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
 		  __entry->file, __entry->line, __entry->func)
 );
 
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index b89f9db..dcfcd44 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -48,7 +48,7 @@ TRACE_EVENT(irq_handler_entry,
 		__assign_str(name, action->name);
 	),
 
-	TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name))
+	TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
 );
 
 /**
@@ -78,7 +78,7 @@ TRACE_EVENT(irq_handler_exit,
 		__entry->ret	= ret;
 	),
 
-	TP_printk("irq=%d return=%s",
+	TP_printk("irq=%d ret=%s",
 		  __entry->irq, __entry->ret ? "handled" : "unhandled")
 );
 
@@ -107,7 +107,7 @@ TRACE_EVENT(softirq_entry,
 		__entry->vec = (int)(h - vec);
 	),
 
-	TP_printk("softirq=%d action=%s", __entry->vec,
+	TP_printk("vec=%d [action=%s]", __entry->vec,
 		  show_softirq_name(__entry->vec))
 );
 
@@ -136,7 +136,7 @@ TRACE_EVENT(softirq_exit,
 		__entry->vec = (int)(h - vec);
 	),
 
-	TP_printk("softirq=%d action=%s", __entry->vec,
+	TP_printk("vec=%d [action=%s]", __entry->vec,
 		  show_softirq_name(__entry->vec))
 );
 
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index ea6d579..9bb96e5 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -16,8 +16,6 @@ enum {
 };
 #endif
 
-
-
 TRACE_EVENT(power_start,
 
 	TP_PROTO(unsigned int type, unsigned int state),
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 4069c43..b50b985 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -26,7 +26,7 @@ TRACE_EVENT(sched_kthread_stop,
 		__entry->pid	= t->pid;
 	),
 
-	TP_printk("task %s:%d", __entry->comm, __entry->pid)
+	TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
 );
 
 /*
@@ -46,7 +46,7 @@ TRACE_EVENT(sched_kthread_stop_ret,
 		__entry->ret	= ret;
 	),
 
-	TP_printk("ret %d", __entry->ret)
+	TP_printk("ret=%d", __entry->ret)
 );
 
 /*
@@ -73,7 +73,7 @@ TRACE_EVENT(sched_wait_task,
 		__entry->prio	= p->prio;
 	),
 
-	TP_printk("task %s:%d [%d]",
+	TP_printk("comm=%s pid=%d prio=%d",
 		  __entry->comm, __entry->pid, __entry->prio)
 );
 
@@ -94,7 +94,7 @@ TRACE_EVENT(sched_wakeup,
 		__field(	pid_t,	pid			)
 		__field(	int,	prio			)
 		__field(	int,	success			)
-		__field(	int,	cpu			)
+		__field(	int,	target_cpu		)
 	),
 
 	TP_fast_assign(
@@ -102,12 +102,12 @@ TRACE_EVENT(sched_wakeup,
 		__entry->pid		= p->pid;
 		__entry->prio		= p->prio;
 		__entry->success	= success;
-		__entry->cpu		= task_cpu(p);
+		__entry->target_cpu	= task_cpu(p);
 	),
 
-	TP_printk("task %s:%d [%d] success=%d [%03d]",
+	TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
 		  __entry->comm, __entry->pid, __entry->prio,
-		  __entry->success, __entry->cpu)
+		  __entry->success, __entry->target_cpu)
 );
 
 /*
@@ -127,7 +127,7 @@ TRACE_EVENT(sched_wakeup_new,
 		__field(	pid_t,	pid			)
 		__field(	int,	prio			)
 		__field(	int,	success			)
-		__field(	int,	cpu			)
+		__field(	int,	target_cpu		)
 	),
 
 	TP_fast_assign(
@@ -135,12 +135,12 @@ TRACE_EVENT(sched_wakeup_new,
 		__entry->pid		= p->pid;
 		__entry->prio		= p->prio;
 		__entry->success	= success;
-		__entry->cpu		= task_cpu(p);
+		__entry->target_cpu	= task_cpu(p);
 	),
 
-	TP_printk("task %s:%d [%d] success=%d [%03d]",
+	TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
 		  __entry->comm, __entry->pid, __entry->prio,
-		  __entry->success, __entry->cpu)
+		  __entry->success, __entry->target_cpu)
 );
 
 /*
@@ -176,7 +176,7 @@ TRACE_EVENT(sched_switch,
 		__entry->next_prio	= next->prio;
 	),
 
-	TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]",
+	TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_pid=%d next_prio=%d",
 		__entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
 		__entry->prev_state ?
 		  __print_flags(__entry->prev_state, "|",
@@ -211,7 +211,7 @@ TRACE_EVENT(sched_migrate_task,
 		__entry->dest_cpu	= dest_cpu;
 	),
 
-	TP_printk("task %s:%d [%d] from: %d  to: %d",
+	TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d",
 		  __entry->comm, __entry->pid, __entry->prio,
 		  __entry->orig_cpu, __entry->dest_cpu)
 );
@@ -237,7 +237,7 @@ TRACE_EVENT(sched_process_free,
 		__entry->prio		= p->prio;
 	),
 
-	TP_printk("task %s:%d [%d]",
+	TP_printk("comm=%s pid=%d prio=%d",
 		  __entry->comm, __entry->pid, __entry->prio)
 );
 
@@ -262,7 +262,7 @@ TRACE_EVENT(sched_process_exit,
 		__entry->prio		= p->prio;
 	),
 
-	TP_printk("task %s:%d [%d]",
+	TP_printk("comm=%s pid=%d prio=%d",
 		  __entry->comm, __entry->pid, __entry->prio)
 );
 
@@ -287,7 +287,7 @@ TRACE_EVENT(sched_process_wait,
 		__entry->prio		= current->prio;
 	),
 
-	TP_printk("task %s:%d [%d]",
+	TP_printk("comm=%s pid=%d prio=%d",
 		  __entry->comm, __entry->pid, __entry->prio)
 );
 
@@ -314,7 +314,7 @@ TRACE_EVENT(sched_process_fork,
 		__entry->child_pid	= child->pid;
 	),
 
-	TP_printk("parent %s:%d  child %s:%d",
+	TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d",
 		__entry->parent_comm, __entry->parent_pid,
 		__entry->child_comm, __entry->child_pid)
 );
@@ -340,7 +340,7 @@ TRACE_EVENT(sched_signal_send,
 		__entry->sig	= sig;
 	),
 
-	TP_printk("sig: %d  task %s:%d",
+	TP_printk("sig=%d comm=%s pid=%d",
 		  __entry->sig, __entry->comm, __entry->pid)
 );
 
@@ -374,7 +374,7 @@ TRACE_EVENT(sched_stat_wait,
 		__perf_count(delay);
 	),
 
-	TP_printk("task: %s:%d wait: %Lu [ns]",
+	TP_printk("comm=%s pid=%d delay=%Lu [ns]",
 			__entry->comm, __entry->pid,
 			(unsigned long long)__entry->delay)
 );
@@ -406,7 +406,7 @@ TRACE_EVENT(sched_stat_runtime,
 		__perf_count(runtime);
 	),
 
-	TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]",
+	TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
 			__entry->comm, __entry->pid,
 			(unsigned long long)__entry->runtime,
 			(unsigned long long)__entry->vruntime)
@@ -437,7 +437,7 @@ TRACE_EVENT(sched_stat_sleep,
 		__perf_count(delay);
 	),
 
-	TP_printk("task: %s:%d sleep: %Lu [ns]",
+	TP_printk("comm=%s pid=%d delay=%Lu [ns]",
 			__entry->comm, __entry->pid,
 			(unsigned long long)__entry->delay)
 );
@@ -467,7 +467,7 @@ TRACE_EVENT(sched_stat_iowait,
 		__perf_count(delay);
 	),
 
-	TP_printk("task: %s:%d iowait: %Lu [ns]",
+	TP_printk("comm=%s pid=%d delay=%Lu [ns]",
 			__entry->comm, __entry->pid,
 			(unsigned long long)__entry->delay)
 );
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 1844c48..e5ce87a 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -26,7 +26,7 @@ TRACE_EVENT(timer_init,
 		__entry->timer	= timer;
 	),
 
-	TP_printk("timer %p", __entry->timer)
+	TP_printk("timer=%p", __entry->timer)
 );
 
 /**
@@ -54,7 +54,7 @@ TRACE_EVENT(timer_start,
 		__entry->now		= jiffies;
 	),
 
-	TP_printk("timer %p: func %pf, expires %lu, timeout %ld",
+	TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
 		  __entry->timer, __entry->function, __entry->expires,
 		  (long)__entry->expires - __entry->now)
 );
@@ -81,7 +81,7 @@ TRACE_EVENT(timer_expire_entry,
 		__entry->now		= jiffies;
 	),
 
-	TP_printk("timer %p: now %lu", __entry->timer, __entry->now)
+	TP_printk("timer=%p now=%lu", __entry->timer, __entry->now)
 );
 
 /**
@@ -108,7 +108,7 @@ TRACE_EVENT(timer_expire_exit,
 		__entry->timer	= timer;
 	),
 
-	TP_printk("timer %p", __entry->timer)
+	TP_printk("timer=%p", __entry->timer)
 );
 
 /**
@@ -129,7 +129,7 @@ TRACE_EVENT(timer_cancel,
 		__entry->timer	= timer;
 	),
 
-	TP_printk("timer %p", __entry->timer)
+	TP_printk("timer=%p", __entry->timer)
 );
 
 /**
@@ -140,24 +140,24 @@ TRACE_EVENT(timer_cancel,
  */
 TRACE_EVENT(hrtimer_init,
 
-	TP_PROTO(struct hrtimer *timer, clockid_t clockid,
+	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
 		 enum hrtimer_mode mode),
 
-	TP_ARGS(timer, clockid, mode),
+	TP_ARGS(hrtimer, clockid, mode),
 
 	TP_STRUCT__entry(
-		__field( void *,		timer		)
+		__field( void *,		hrtimer		)
 		__field( clockid_t,		clockid		)
 		__field( enum hrtimer_mode,	mode		)
 	),
 
 	TP_fast_assign(
-		__entry->timer		= timer;
+		__entry->hrtimer	= hrtimer;
 		__entry->clockid	= clockid;
 		__entry->mode		= mode;
 	),
 
-	TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer,
+	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
 		  __entry->clockid == CLOCK_REALTIME ?
 			"CLOCK_REALTIME" : "CLOCK_MONOTONIC",
 		  __entry->mode == HRTIMER_MODE_ABS ?
@@ -170,26 +170,26 @@ TRACE_EVENT(hrtimer_init,
  */
 TRACE_EVENT(hrtimer_start,
 
-	TP_PROTO(struct hrtimer *timer),
+	TP_PROTO(struct hrtimer *hrtimer),
 
-	TP_ARGS(timer),
+	TP_ARGS(hrtimer),
 
 	TP_STRUCT__entry(
-		__field( void *,	timer		)
+		__field( void *,	hrtimer		)
 		__field( void *,	function	)
 		__field( s64,		expires		)
 		__field( s64,		softexpires	)
 	),
 
 	TP_fast_assign(
-		__entry->timer		= timer;
-		__entry->function	= timer->function;
-		__entry->expires	= hrtimer_get_expires(timer).tv64;
-		__entry->softexpires	= hrtimer_get_softexpires(timer).tv64;
+		__entry->hrtimer	= hrtimer;
+		__entry->function	= hrtimer->function;
+		__entry->expires	= hrtimer_get_expires(hrtimer).tv64;
+		__entry->softexpires	= hrtimer_get_softexpires(hrtimer).tv64;
 	),
 
-	TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu",
-		  __entry->timer, __entry->function,
+	TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
+		  __entry->hrtimer, __entry->function,
 		  (unsigned long long)ktime_to_ns((ktime_t) {
 				  .tv64 = __entry->expires }),
 		  (unsigned long long)ktime_to_ns((ktime_t) {
@@ -206,23 +206,22 @@ TRACE_EVENT(hrtimer_start,
  */
 TRACE_EVENT(hrtimer_expire_entry,
 
-	TP_PROTO(struct hrtimer *timer, ktime_t *now),
+	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
 
-	TP_ARGS(timer, now),
+	TP_ARGS(hrtimer, now),
 
 	TP_STRUCT__entry(
-		__field( void *,	timer	)
+		__field( void *,	hrtimer	)
 		__field( s64,		now	)
 	),
 
 	TP_fast_assign(
-		__entry->timer	= timer;
-		__entry->now	= now->tv64;
+		__entry->hrtimer	= hrtimer;
+		__entry->now		= now->tv64;
 	),
 
-	TP_printk("hrtimer %p, now %llu", __entry->timer,
-		  (unsigned long long)ktime_to_ns((ktime_t) {
-				  .tv64 = __entry->now }))
+	TP_printk("hrtimer=%p now=%llu", __entry->hrtimer,
+		  (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
  );
 
 /**
@@ -234,40 +233,40 @@ TRACE_EVENT(hrtimer_expire_entry,
  */
 TRACE_EVENT(hrtimer_expire_exit,
 
-	TP_PROTO(struct hrtimer *timer),
+	TP_PROTO(struct hrtimer *hrtimer),
 
-	TP_ARGS(timer),
+	TP_ARGS(hrtimer),
 
 	TP_STRUCT__entry(
-		__field( void *,	timer	)
+		__field( void *,	hrtimer	)
 	),
 
 	TP_fast_assign(
-		__entry->timer	= timer;
+		__entry->hrtimer	= hrtimer;
 	),
 
-	TP_printk("hrtimer %p", __entry->timer)
+	TP_printk("hrtimer=%p", __entry->hrtimer)
 );
 
 /**
  * hrtimer_cancel - called when the hrtimer is canceled
- * @timer:	pointer to struct hrtimer
+ * @hrtimer:	pointer to struct hrtimer
  */
 TRACE_EVENT(hrtimer_cancel,
 
-	TP_PROTO(struct hrtimer *timer),
+	TP_PROTO(struct hrtimer *hrtimer),
 
-	TP_ARGS(timer),
+	TP_ARGS(hrtimer),
 
 	TP_STRUCT__entry(
-		__field( void *,	timer	)
+		__field( void *,	hrtimer	)
 	),
 
 	TP_fast_assign(
-		__entry->timer	= timer;
+		__entry->hrtimer	= hrtimer;
 	),
 
-	TP_printk("hrtimer %p", __entry->timer)
+	TP_printk("hrtimer=%p", __entry->hrtimer)
 );
 
 /**
@@ -302,7 +301,7 @@ TRACE_EVENT(itimer_state,
 		__entry->interval_usec	= value->it_interval.tv_usec;
 	),
 
-	TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu",
+	TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu",
 		  __entry->which, __entry->expires,
 		  __entry->value_sec, __entry->value_usec,
 		  __entry->interval_sec, __entry->interval_usec)
@@ -332,7 +331,7 @@ TRACE_EVENT(itimer_expire,
 		__entry->pid	= pid_nr(pid);
 	),
 
-	    TP_printk("which %d, pid %d, now %lu", __entry->which,
+	    TP_printk("which=%d pid=%d now=%lu", __entry->which,
 		      (int) __entry->pid, __entry->now)
 );
 

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

* [tip:perf/urgent] perf tools: Bump version to 0.0.2
       [not found]             ` <new-submission>
                                 ` (437 preceding siblings ...)
  2009-10-15 10:46               ` [tip:perf/core] events: Harmonize event field names and print output names tip-bot for Ingo Molnar
@ 2009-10-16  8:40               ` tip-bot for Ingo Molnar
  2009-10-24  1:04               ` [tip:branch?] sched: Strengthen buddies and mitigate buddy induced latencies tip-bot for Mike Galbraith
                                 ` (267 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-10-16  8:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  210f9cb2cf2effca690271085f4bd6a3ea286e6c
Gitweb:     http://git.kernel.org/tip/210f9cb2cf2effca690271085f4bd6a3ea286e6c
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri, 16 Oct 2009 10:34:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 16 Oct 2009 10:34:28 +0200

perf tools: Bump version to 0.0.2

We released the first version of perf with 0.0.1 in v2.6.31,
time to double our version number to 0.0.2 ;-)

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/util/PERF-VERSION-GEN |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index c561d15..54552a0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=PERF-VERSION-FILE
-DEF_VER=v0.0.1.PERF
+DEF_VER=v0.0.2.PERF
 
 LF='
 '

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

* [tip:branch?] sched: Strengthen buddies and mitigate buddy induced latencies
       [not found]             ` <new-submission>
                                 ` (438 preceding siblings ...)
  2009-10-16  8:40               ` [tip:perf/urgent] perf tools: Bump version to 0.0.2 tip-bot for Ingo Molnar
@ 2009-10-24  1:04               ` tip-bot for Mike Galbraith
  2009-11-02  9:30               ` [tip:x86/urgent] x86: Fix printk message typo in mtrr cleanup code tip-bot for Dave Jones
                                 ` (266 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-10-24  1:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  f685ceacab07d3f6c236f04803e2f2f0dbcc5afb
Gitweb:     http://git.kernel.org/tip/f685ceacab07d3f6c236f04803e2f2f0dbcc5afb
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Fri, 23 Oct 2009 23:09:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 23 Oct 2009 23:48:28 +0200

sched: Strengthen buddies and mitigate buddy induced latencies

This patch restores the effectiveness of LAST_BUDDY in preventing
pgsql+oltp from collapsing due to wakeup preemption. It also
switches LAST_BUDDY to exclusively do what it does best, namely
mitigate the effects of aggressive wakeup preemption, which
improves vmark throughput markedly, and restores mysql+oltp
scalability.

Since buddies are about scalability, enable them beginning at the
point where we begin expanding sched_latency, namely
sched_nr_latency. Previously, buddies were cleared aggressively,
which seriously reduced their effectiveness. Not clearing
aggressively however, produces a small drop in mysql+oltp
throughput immediately after peak, indicating that LAST_BUDDY is
actually doing some harm. This is right at the point where X on the
desktop in competition with another load wants low latency service.
Ergo, do not enable until we need to scale.

To mitigate latency induced by buddies, or by a task just missing
wakeup preemption, check latency at tick time.

Last hunk prevents buddies from stymieing BALANCE_NEWIDLE via
CACHE_HOT_BUDDY.

Supporting performance tests:

 tip   = v2.6.32-rc5-1497-ga525b32
 tipx  = NO_GENTLE_FAIR_SLEEPERS NEXT_BUDDY granularity knobs = 31 knobs + 31 buddies
 tip+x = NO_GENTLE_FAIR_SLEEPERS granularity knobs = 31 knobs

(Three run averages except where noted.)

 vmark:
 ------
 tip           108466 messages per second
 tip+          125307 messages per second
 tip+x         125335 messages per second
 tipx          117781 messages per second
 2.6.31.3      122729 messages per second

 mysql+oltp:
 -----------
 clients          1        2        4        8       16       32       64        128    256
 ..........................................................................................
 tip        9949.89 18690.20 34801.24 34460.04 32682.88 30765.97 28305.27 25059.64 19548.08
 tip+      10013.90 18526.84 34900.38 34420.14 33069.83 32083.40 30578.30 28010.71 25605.47
 tipx       9698.71 18002.70 34477.56 33420.01 32634.30 31657.27 29932.67 26827.52 21487.18
 2.6.31.3   8243.11 18784.20 34404.83 33148.38 31900.32 31161.90 29663.81 25995.94 18058.86

 pgsql+oltp:
 -----------
 clients          1        2        4        8       16       32       64      128      256
 ..........................................................................................
 tip       13686.37 26609.25 51934.28 51347.81 49479.51 45312.65 36691.91 26851.57 24145.35
 tip+ (1x) 13907.85 27135.87 52951.98 52514.04 51742.52 50705.43 49947.97 48374.19 46227.94
 tip+x     13906.78 27065.81 52951.19 52542.59 52176.11 51815.94 50838.90 49439.46 46891.00
 tipx      13742.46 26769.81 52351.99 51891.73 51320.79 50938.98 50248.65 48908.70 46553.84
 2.6.31.3  13815.35 26906.46 52683.34 52061.31 51937.10 51376.80 50474.28 49394.47 47003.25

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>
---
 kernel/sched.c      |    2 +-
 kernel/sched_fair.c |   73 ++++++++++++++++++++++++++++++++------------------
 2 files changed, 48 insertions(+), 27 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 789001d..cae6700 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2008,7 +2008,7 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
 	/*
 	 * Buddy candidates are cache hot:
 	 */
-	if (sched_feat(CACHE_HOT_BUDDY) &&
+	if (sched_feat(CACHE_HOT_BUDDY) && this_rq()->nr_running &&
 			(&p->se == cfs_rq_of(&p->se)->next ||
 			 &p->se == cfs_rq_of(&p->se)->last))
 		return 1;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c32c3e6..37087a7 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -822,6 +822,26 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 		 * re-elected due to buddy favours.
 		 */
 		clear_buddies(cfs_rq, curr);
+		return;
+	}
+
+	/*
+	 * Ensure that a task that missed wakeup preemption by a
+	 * narrow margin doesn't have to wait for a full slice.
+	 * This also mitigates buddy induced latencies under load.
+	 */
+	if (!sched_feat(WAKEUP_PREEMPT))
+		return;
+
+	if (delta_exec < sysctl_sched_min_granularity)
+		return;
+
+	if (cfs_rq->nr_running > 1) {
+		struct sched_entity *se = __pick_next_entity(cfs_rq);
+		s64 delta = curr->vruntime - se->vruntime;
+
+		if (delta > ideal_runtime)
+			resched_task(rq_of(cfs_rq)->curr);
 	}
 }
 
@@ -861,21 +881,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se);
 static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
 {
 	struct sched_entity *se = __pick_next_entity(cfs_rq);
-	struct sched_entity *buddy;
+	struct sched_entity *left = se;
 
-	if (cfs_rq->next) {
-		buddy = cfs_rq->next;
-		cfs_rq->next = NULL;
-		if (wakeup_preempt_entity(buddy, se) < 1)
-			return buddy;
-	}
+	if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1)
+		se = cfs_rq->next;
 
-	if (cfs_rq->last) {
-		buddy = cfs_rq->last;
-		cfs_rq->last = NULL;
-		if (wakeup_preempt_entity(buddy, se) < 1)
-			return buddy;
-	}
+	/*
+	 * Prefer last buddy, try to return the CPU to a preempted task.
+	 */
+	if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1)
+		se = cfs_rq->last;
+
+	clear_buddies(cfs_rq, se);
 
 	return se;
 }
@@ -1577,6 +1594,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 	struct sched_entity *se = &curr->se, *pse = &p->se;
 	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
 	int sync = wake_flags & WF_SYNC;
+	int scale = cfs_rq->nr_running >= sched_nr_latency;
 
 	update_curr(cfs_rq);
 
@@ -1591,18 +1609,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 	if (unlikely(se == pse))
 		return;
 
-	/*
-	 * Only set the backward buddy when the current task is still on the
-	 * rq. This can happen when a wakeup gets interleaved with schedule on
-	 * the ->pre_schedule() or idle_balance() point, either of which can
-	 * drop the rq lock.
-	 *
-	 * Also, during early boot the idle thread is in the fair class, for
-	 * obvious reasons its a bad idea to schedule back to the idle thread.
-	 */
-	if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
-		set_last_buddy(se);
-	if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK))
+	if (sched_feat(NEXT_BUDDY) && scale && !(wake_flags & WF_FORK))
 		set_next_buddy(pse);
 
 	/*
@@ -1648,8 +1655,22 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 
 	BUG_ON(!pse);
 
-	if (wakeup_preempt_entity(se, pse) == 1)
+	if (wakeup_preempt_entity(se, pse) == 1) {
 		resched_task(curr);
+		/*
+		 * Only set the backward buddy when the current task is still
+		 * on the rq. This can happen when a wakeup gets interleaved
+		 * with schedule on the ->pre_schedule() or idle_balance()
+		 * point, either of which can * drop the rq lock.
+		 *
+		 * Also, during early boot the idle thread is in the fair class,
+		 * for obvious reasons its a bad idea to schedule back to it.
+		 */
+		if (unlikely(!se->on_rq || curr == rq->idle))
+			return;
+		if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se))
+			set_last_buddy(se);
+	}
 }
 
 static struct task_struct *pick_next_task_fair(struct rq *rq)

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

* [tip:x86/urgent] x86: Fix printk message typo in mtrr cleanup code
       [not found]             ` <new-submission>
                                 ` (439 preceding siblings ...)
  2009-10-24  1:04               ` [tip:branch?] sched: Strengthen buddies and mitigate buddy induced latencies tip-bot for Mike Galbraith
@ 2009-11-02  9:30               ` tip-bot for Dave Jones
  2009-11-02 19:45               ` [tip:sched/urgent] sched: Disable SD_PREFER_LOCAL at node level tip-bot for Mike Galbraith
                                 ` (265 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Jones @ 2009-11-02  9:30 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, davej, tglx, mingo

Commit-ID:  16121d70fdf9eeb05ead46b241a293156323dbbe
Gitweb:     http://git.kernel.org/tip/16121d70fdf9eeb05ead46b241a293156323dbbe
Author:     Dave Jones <davej@redhat.com>
AuthorDate: Sun, 1 Nov 2009 19:27:05 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 2 Nov 2009 08:36:18 +0100

x86: Fix printk message typo in mtrr cleanup code

Trivial typo.

Signed-off-by: Dave Jones <davej@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/mtrr/cleanup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index 315738c..73c86db 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -846,7 +846,7 @@ int __init mtrr_cleanup(unsigned address_bits)
 	sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL);
 
 	range_sums = sum_ranges(range, nr_range);
-	printk(KERN_INFO "total RAM coverred: %ldM\n",
+	printk(KERN_INFO "total RAM covered: %ldM\n",
 	       range_sums >> (20 - PAGE_SHIFT));
 
 	if (mtrr_chunk_size && mtrr_gran_size) {

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

* [tip:sched/urgent] sched: Disable SD_PREFER_LOCAL at node level
       [not found]             ` <new-submission>
                                 ` (440 preceding siblings ...)
  2009-11-02  9:30               ` [tip:x86/urgent] x86: Fix printk message typo in mtrr cleanup code tip-bot for Dave Jones
@ 2009-11-02 19:45               ` tip-bot for Mike Galbraith
  2009-11-03  7:03               ` tip-bot for Mike Galbraith
                                 ` (264 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-11-02 19:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, yanmin_zhang, efault,
	tglx, mingo

Commit-ID:  753c72119743e8a12f5e9d34312988c810458917
Gitweb:     http://git.kernel.org/tip/753c72119743e8a12f5e9d34312988c810458917
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Mon, 2 Nov 2009 20:36:51 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 2 Nov 2009 20:43:07 +0100

sched: Disable SD_PREFER_LOCAL at node level

Yanmin Zhang reported that SD_PREFER_LOCAL induces an order of
magnitude increase in select_task_rq_fair() overhead while
running heavy wakeup benchmarks (tbench and vmark).

Since SD_BALANCE_WAKE is off at node level, turn SD_PREFER_LOCAL
off as well pending further investigation.

Reported-by: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
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>
---
 arch/x86/include/asm/topology.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d823c24..40e37b1 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -143,7 +143,7 @@ extern unsigned long node_remap_size[];
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 1*SD_PREFER_LOCAL			\
+				| 0*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\

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

* [tip:sched/urgent] sched: Disable SD_PREFER_LOCAL at node level
       [not found]             ` <new-submission>
                                 ` (441 preceding siblings ...)
  2009-11-02 19:45               ` [tip:sched/urgent] sched: Disable SD_PREFER_LOCAL at node level tip-bot for Mike Galbraith
@ 2009-11-03  7:03               ` tip-bot for Mike Galbraith
  2009-11-04 19:33               ` [tip:sched/core] sched: Rate-limit newidle tip-bot for Mike Galbraith
                                 ` (263 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-11-03  7:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, yanmin_zhang, efault,
	tglx, mingo

Commit-ID:  6b9de613ae9c79b637e070136585dde029578065
Gitweb:     http://git.kernel.org/tip/6b9de613ae9c79b637e070136585dde029578065
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Mon, 2 Nov 2009 20:36:51 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 3 Nov 2009 07:24:07 +0100

sched: Disable SD_PREFER_LOCAL at node level

Yanmin Zhang reported that SD_PREFER_LOCAL induces an order of
magnitude increase in select_task_rq_fair() overhead while
running heavy wakeup benchmarks (tbench and vmark).

Since SD_BALANCE_WAKE is off at node level, turn SD_PREFER_LOCAL
off as well pending further investigation.

Reported-by: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
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>
---
 arch/x86/include/asm/topology.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d823c24..40e37b1 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -143,7 +143,7 @@ extern unsigned long node_remap_size[];
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_BALANCE_WAKE			\
 				| 1*SD_WAKE_AFFINE			\
-				| 1*SD_PREFER_LOCAL			\
+				| 0*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
 				| 0*SD_SHARE_PKG_RESOURCES		\

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

* [tip:sched/core] sched: Rate-limit newidle
       [not found]             ` <new-submission>
                                 ` (442 preceding siblings ...)
  2009-11-03  7:03               ` tip-bot for Mike Galbraith
@ 2009-11-04 19:33               ` tip-bot for Mike Galbraith
  2009-11-12 11:33               ` [tip:sched/urgent] sched: Fix/add missing update_rq_clock() calls tip-bot for Mike Galbraith
                                 ` (262 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-11-04 19:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  1b9508f6831e10d53256825de8904caa22d1ca2c
Gitweb:     http://git.kernel.org/tip/1b9508f6831e10d53256825de8904caa22d1ca2c
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Wed, 4 Nov 2009 17:53:50 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Nov 2009 19:13:48 +0100

sched: Rate-limit newidle

Rate limit newidle to migration_cost. It's a win for all
stages of sysbench oltp tests.

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>
---
 kernel/sched.c       |   22 +++++++++++++++++++++-
 kernel/sched_debug.c |    4 ++++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index ae026aa..f849212 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -589,6 +589,8 @@ struct rq {
 
 	u64 rt_avg;
 	u64 age_stamp;
+	u64 idle_stamp;
+	u64 avg_idle;
 #endif
 
 	/* calc_load related fields */
@@ -2353,6 +2355,17 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	if (rq != orig_rq)
 		update_rq_clock(rq);
 
+	if (rq->idle_stamp) {
+		u64 delta = rq->clock - rq->idle_stamp;
+		u64 max = 2*sysctl_sched_migration_cost;
+
+		if (delta > max)
+			rq->avg_idle = max;
+		else
+			update_avg(&rq->avg_idle, delta);
+		rq->idle_stamp = 0;
+	}
+
 	WARN_ON(p->state != TASK_WAKING);
 	cpu = task_cpu(p);
 
@@ -4389,6 +4402,11 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
 	int pulled_task = 0;
 	unsigned long next_balance = jiffies + HZ;
 
+	this_rq->idle_stamp = this_rq->clock;
+
+	if (this_rq->avg_idle < sysctl_sched_migration_cost)
+		return;
+
 	for_each_domain(this_cpu, sd) {
 		unsigned long interval;
 
@@ -4403,8 +4421,10 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
 		interval = msecs_to_jiffies(sd->balance_interval);
 		if (time_after(next_balance, sd->last_balance + interval))
 			next_balance = sd->last_balance + interval;
-		if (pulled_task)
+		if (pulled_task) {
+			this_rq->idle_stamp = 0;
 			break;
+		}
 	}
 	if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
 		/*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index efb8440..6988cf0 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -285,12 +285,16 @@ static void print_cpu(struct seq_file *m, int cpu)
 
 #ifdef CONFIG_SCHEDSTATS
 #define P(n) SEQ_printf(m, "  .%-30s: %d\n", #n, rq->n);
+#define P64(n) SEQ_printf(m, "  .%-30s: %Ld\n", #n, rq->n);
 
 	P(yld_count);
 
 	P(sched_switch);
 	P(sched_count);
 	P(sched_goidle);
+#ifdef CONFIG_SMP
+	P64(avg_idle);
+#endif
 
 	P(ttwu_count);
 	P(ttwu_local);

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

* [patch] sched: fix/add missing update_rq_clock() calls
@ 2009-11-12 10:07 Mike Galbraith
  2009-11-12 11:01 ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Mike Galbraith @ 2009-11-12 10:07 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: LKML


sched: fix/add missing update_rq_clock() calls.

kthread_bind(), migrate_task() and sched_fork were missing updates, and
try_to_wake_up() was updating after having already used the stale clock.

Aside from preventing potential latency hits, there' a side benefit in that
early boot printk time stamps become monotonic.

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>

---
 kernel/sched.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Index: linux-2.6.32.git/kernel/sched.c
===================================================================
--- linux-2.6.32.git.orig/kernel/sched.c
+++ linux-2.6.32.git/kernel/sched.c
@@ -2019,6 +2019,7 @@ void kthread_bind(struct task_struct *p,
 	}
 
 	spin_lock_irqsave(&rq->lock, flags);
+	update_rq_clock(rq);
 	set_task_cpu(p, cpu);
 	p->cpus_allowed = cpumask_of_cpu(cpu);
 	p->rt.nr_cpus_allowed = 1;
@@ -2117,6 +2118,7 @@ migrate_task(struct task_struct *p, int
 	 * it is sufficient to simply update the task's cpu field.
 	 */
 	if (!p->se.on_rq && !task_running(rq, p)) {
+		update_rq_clock(rq);
 		set_task_cpu(p, dest_cpu);
 		return 0;
 	}
@@ -2378,14 +2380,15 @@ static int try_to_wake_up(struct task_st
 	task_rq_unlock(rq, &flags);
 
 	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
-	if (cpu != orig_cpu)
+	if (cpu != orig_cpu) {
+		local_irq_save(flags);
+		rq = cpu_rq(cpu);
+		update_rq_clock(rq);
 		set_task_cpu(p, cpu);
-
+		local_irq_restore(flags);
+	}
 	rq = task_rq_lock(p, &flags);
 
-	if (rq != orig_rq)
-		update_rq_clock(rq);
-
 	WARN_ON(p->state != TASK_WAKING);
 	cpu = task_cpu(p);
 
@@ -2558,6 +2561,7 @@ static void __sched_fork(struct task_str
 void sched_fork(struct task_struct *p, int clone_flags)
 {
 	int cpu = get_cpu();
+	unsigned long flags;
 
 	__sched_fork(p);
 
@@ -2594,7 +2598,10 @@ void sched_fork(struct task_struct *p, i
 #ifdef CONFIG_SMP
 	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0);
 #endif
+	local_irq_save(flags);
+	update_rq_clock(cpu_rq(cpu));
 	set_task_cpu(p, cpu);
+	local_irq_restore(flags);
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))



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

* Re: [patch] sched: fix/add missing update_rq_clock() calls
  2009-11-12 10:07 [patch] sched: fix/add missing update_rq_clock() calls Mike Galbraith
@ 2009-11-12 11:01 ` Peter Zijlstra
  2009-11-12 11:27   ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2009-11-12 11:01 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Ingo Molnar, LKML

On Thu, 2009-11-12 at 11:07 +0100, Mike Galbraith wrote:
> sched: fix/add missing update_rq_clock() calls.
> 
> kthread_bind(), migrate_task() and sched_fork were missing updates, and
> try_to_wake_up() was updating after having already used the stale clock.


I'm almost at the point where I think we should ditch rq->clock
alltogether and simply call cpu_clock() directly when we need it. This
trying to optimize and avoid calling it game has brought way too many
head-aches.


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

* Re: [patch] sched: fix/add missing update_rq_clock() calls
  2009-11-12 11:01 ` Peter Zijlstra
@ 2009-11-12 11:27   ` Ingo Molnar
  2009-11-12 11:29     ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-11-12 11:27 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Mike Galbraith, LKML


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Thu, 2009-11-12 at 11:07 +0100, Mike Galbraith wrote:
> > sched: fix/add missing update_rq_clock() calls.
> > 
> > kthread_bind(), migrate_task() and sched_fork were missing updates, and
> > try_to_wake_up() was updating after having already used the stale clock.
> 
> 
> I'm almost at the point where I think we should ditch rq->clock 
> alltogether and simply call cpu_clock() directly when we need it. This 
> trying to optimize and avoid calling it game has brought way too many 
> head-aches.

It's not just about optimization - it's also accounting precision - we 
want to handle the full act of schedule() at a single timestamp - not a 
series of timestamps.

But ... we can get rid of it if it can be done sanely.

	Ingo

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

* Re: [patch] sched: fix/add missing update_rq_clock() calls
  2009-11-12 11:27   ` Ingo Molnar
@ 2009-11-12 11:29     ` Peter Zijlstra
  2009-11-12 11:34       ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2009-11-12 11:29 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Mike Galbraith, LKML

On Thu, 2009-11-12 at 12:27 +0100, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Thu, 2009-11-12 at 11:07 +0100, Mike Galbraith wrote:
> > > sched: fix/add missing update_rq_clock() calls.
> > > 
> > > kthread_bind(), migrate_task() and sched_fork were missing updates, and
> > > try_to_wake_up() was updating after having already used the stale clock.
> > 
> > 
> > I'm almost at the point where I think we should ditch rq->clock 
> > alltogether and simply call cpu_clock() directly when we need it. This 
> > trying to optimize and avoid calling it game has brought way too many 
> > head-aches.
> 
> It's not just about optimization - it's also accounting precision - we 
> want to handle the full act of schedule() at a single timestamp - not a 
> series of timestamps.
> 
> But ... we can get rid of it if it can be done sanely.

Ah, good point, hard to do for the migration paths though.


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

* [tip:sched/urgent] sched: Fix/add missing update_rq_clock() calls
       [not found]             ` <new-submission>
                                 ` (443 preceding siblings ...)
  2009-11-04 19:33               ` [tip:sched/core] sched: Rate-limit newidle tip-bot for Mike Galbraith
@ 2009-11-12 11:33               ` tip-bot for Mike Galbraith
  2009-11-13 19:49               ` [tip:timers/core] nohz: Type cast printk argument tip-bot for Thomas Gleixner
                                 ` (261 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-11-12 11:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  055a00865dcfc8e61f3cbefbb879c9577bd36ae5
Gitweb:     http://git.kernel.org/tip/055a00865dcfc8e61f3cbefbb879c9577bd36ae5
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Thu, 12 Nov 2009 11:07:44 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 12 Nov 2009 12:28:29 +0100

sched: Fix/add missing update_rq_clock() calls

kthread_bind(), migrate_task() and sched_fork were missing
updates, and try_to_wake_up() was updating after having already
used the stale clock.

Aside from preventing potential latency hits, there' a side
benefit in that early boot printk time stamps become monotonic.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1258020464.6491.2.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <new-submission>
---
 kernel/sched.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3c11ae0..701eca4 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2017,6 +2017,7 @@ void kthread_bind(struct task_struct *p, unsigned int cpu)
 	}
 
 	spin_lock_irqsave(&rq->lock, flags);
+	update_rq_clock(rq);
 	set_task_cpu(p, cpu);
 	p->cpus_allowed = cpumask_of_cpu(cpu);
 	p->rt.nr_cpus_allowed = 1;
@@ -2115,6 +2116,7 @@ migrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req)
 	 * it is sufficient to simply update the task's cpu field.
 	 */
 	if (!p->se.on_rq && !task_running(rq, p)) {
+		update_rq_clock(rq);
 		set_task_cpu(p, dest_cpu);
 		return 0;
 	}
@@ -2376,14 +2378,15 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	task_rq_unlock(rq, &flags);
 
 	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
-	if (cpu != orig_cpu)
+	if (cpu != orig_cpu) {
+		local_irq_save(flags);
+		rq = cpu_rq(cpu);
+		update_rq_clock(rq);
 		set_task_cpu(p, cpu);
-
+		local_irq_restore(flags);
+	}
 	rq = task_rq_lock(p, &flags);
 
-	if (rq != orig_rq)
-		update_rq_clock(rq);
-
 	WARN_ON(p->state != TASK_WAKING);
 	cpu = task_cpu(p);
 
@@ -2545,6 +2548,7 @@ static void __sched_fork(struct task_struct *p)
 void sched_fork(struct task_struct *p, int clone_flags)
 {
 	int cpu = get_cpu();
+	unsigned long flags;
 
 	__sched_fork(p);
 
@@ -2581,7 +2585,10 @@ void sched_fork(struct task_struct *p, int clone_flags)
 #ifdef CONFIG_SMP
 	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0);
 #endif
+	local_irq_save(flags);
+	update_rq_clock(cpu_rq(cpu));
 	set_task_cpu(p, cpu);
+	local_irq_restore(flags);
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))

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

* Re: [patch] sched: fix/add missing update_rq_clock() calls
  2009-11-12 11:29     ` Peter Zijlstra
@ 2009-11-12 11:34       ` Ingo Molnar
  2009-11-12 11:36         ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-11-12 11:34 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Mike Galbraith, LKML


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Thu, 2009-11-12 at 12:27 +0100, Ingo Molnar wrote:
> > * Peter Zijlstra <peterz@infradead.org> wrote:
> > 
> > > On Thu, 2009-11-12 at 11:07 +0100, Mike Galbraith wrote:
> > > > sched: fix/add missing update_rq_clock() calls.
> > > > 
> > > > kthread_bind(), migrate_task() and sched_fork were missing updates, and
> > > > try_to_wake_up() was updating after having already used the stale clock.
> > > 
> > > 
> > > I'm almost at the point where I think we should ditch rq->clock 
> > > alltogether and simply call cpu_clock() directly when we need it. This 
> > > trying to optimize and avoid calling it game has brought way too many 
> > > head-aches.
> > 
> > It's not just about optimization - it's also accounting precision - we 
> > want to handle the full act of schedule() at a single timestamp - not a 
> > series of timestamps.
> > 
> > But ... we can get rid of it if it can be done sanely.
> 
> Ah, good point, hard to do for the migration paths though.

yes, migration is always the odd one out anyway, unless the hardware 
does cross-CPU-synchronous timestamps.

	Ingo

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

* Re: [patch] sched: fix/add missing update_rq_clock() calls
  2009-11-12 11:34       ` Ingo Molnar
@ 2009-11-12 11:36         ` Peter Zijlstra
  0 siblings, 0 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2009-11-12 11:36 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Mike Galbraith, LKML

On Thu, 2009-11-12 at 12:34 +0100, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Thu, 2009-11-12 at 12:27 +0100, Ingo Molnar wrote:
> > > * Peter Zijlstra <peterz@infradead.org> wrote:
> > > 
> > > > On Thu, 2009-11-12 at 11:07 +0100, Mike Galbraith wrote:
> > > > > sched: fix/add missing update_rq_clock() calls.
> > > > > 
> > > > > kthread_bind(), migrate_task() and sched_fork were missing updates, and
> > > > > try_to_wake_up() was updating after having already used the stale clock.
> > > > 
> > > > 
> > > > I'm almost at the point where I think we should ditch rq->clock 
> > > > alltogether and simply call cpu_clock() directly when we need it. This 
> > > > trying to optimize and avoid calling it game has brought way too many 
> > > > head-aches.
> > > 
> > > It's not just about optimization - it's also accounting precision - we 
> > > want to handle the full act of schedule() at a single timestamp - not a 
> > > series of timestamps.
> > > 
> > > But ... we can get rid of it if it can be done sanely.
> > 
> > Ah, good point, hard to do for the migration paths though.
> 
> yes, migration is always the odd one out anyway, unless the hardware 
> does cross-CPU-synchronous timestamps.

Even if it has, we currently only update remote rq->clock variables once
we end up in a migration path, which is always after updating the
current rq->clock variable. So there's always a slight difference
between the two rq clock, even if the hw clock is perfect.


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

* [tip:timers/core] nohz: Type cast printk argument
       [not found]             ` <new-submission>
                                 ` (444 preceding siblings ...)
  2009-11-12 11:33               ` [tip:sched/urgent] sched: Fix/add missing update_rq_clock() calls tip-bot for Mike Galbraith
@ 2009-11-13 19:49               ` tip-bot for Thomas Gleixner
  2009-11-13 19:50               ` [tip:timers/core] nohz: Track last do_timer() cpu tip-bot for Thomas Gleixner
                                 ` (260 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-11-13 19:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  529eaccd900a59724619b4a6ef6579fd518d5218
Gitweb:     http://git.kernel.org/tip/529eaccd900a59724619b4a6ef6579fd518d5218
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 13 Nov 2009 14:32:19 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 13 Nov 2009 20:46:24 +0100

nohz: Type cast printk argument

On some archs local_softirq_pending() has a data type of unsigned long
on others its unsigned int. Type cast it to (unsigned int) in the
printk to avoid the compiler warning.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
---
 kernel/time/tick-sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 3840f6d..c65ba0f 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -250,7 +250,7 @@ void tick_nohz_stop_sched_tick(int inidle)
 
 		if (ratelimit < 10) {
 			printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
-			       local_softirq_pending());
+			       (unsigned int) local_softirq_pending());
 			ratelimit++;
 		}
 		goto end;

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

* [tip:timers/core] nohz: Track last do_timer() cpu
       [not found]             ` <new-submission>
                                 ` (445 preceding siblings ...)
  2009-11-13 19:49               ` [tip:timers/core] nohz: Type cast printk argument tip-bot for Thomas Gleixner
@ 2009-11-13 19:50               ` tip-bot for Thomas Gleixner
  2009-11-17 17:18               ` [tip:perf/urgent] perf annotate: Allocate history size correctly tip-bot for Nick Piggin
                                 ` (259 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2009-11-13 19:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, johnstul, jon-hunter, tglx

Commit-ID:  27185016b806d5a1181ff501cae120582b2b27dd
Gitweb:     http://git.kernel.org/tip/27185016b806d5a1181ff501cae120582b2b27dd
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 12 Nov 2009 22:12:06 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 13 Nov 2009 20:46:24 +0100

nohz: Track last do_timer() cpu

The previous patch which limits the sleep time to the maximum
deferment time of the time keeping clocksource has some limitations on
SMP machines: if all CPUs are idle then for all CPUs the maximum sleep
time is limited.

Solve this by keeping track of which cpu had the do_timer() duty
assigned last and limit the sleep time only for this cpu.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: Jon Hunter <jon-hunter@ti.com>
Cc: John Stultz <johnstul@us.ibm.com>
---
 include/linux/tick.h     |    2 +
 kernel/time/tick-sched.c |   52 ++++++++++++++++++++++++---------------------
 2 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index 8dc0821..d2ae79e 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -43,6 +43,7 @@ enum tick_nohz_mode {
  * @idle_exittime:	Time when the idle state was left
  * @idle_sleeptime:	Sum of the time slept in idle with sched tick stopped
  * @sleep_length:	Duration of the current idle sleep
+ * @do_timer_lst:	CPU was the last one doing do_timer before going idle
  */
 struct tick_sched {
 	struct hrtimer			sched_timer;
@@ -64,6 +65,7 @@ struct tick_sched {
 	unsigned long			last_jiffies;
 	unsigned long			next_jiffies;
 	ktime_t				idle_expires;
+	int				do_timer_last;
 };
 
 extern void __init tick_init(void);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index a80b464..df133bc 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -263,17 +263,7 @@ void tick_nohz_stop_sched_tick(int inidle)
 		seq = read_seqbegin(&xtime_lock);
 		last_update = last_jiffies_update;
 		last_jiffies = jiffies;
-
-		/*
-		 * On SMP we really should only care for the CPU which
-		 * has the do_timer duty assigned. All other CPUs can
-		 * sleep as long as they want.
-		 */
-		if (cpu == tick_do_timer_cpu ||
-		    tick_do_timer_cpu == TICK_DO_TIMER_NONE)
-			time_delta = timekeeping_max_deferment();
-		else
-			time_delta = KTIME_MAX;
+		time_delta = timekeeping_max_deferment();
 	} while (read_seqretry(&xtime_lock, seq));
 
 	if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
@@ -296,6 +286,29 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if ((long)delta_jiffies >= 1) {
 
 		/*
+		 * If this cpu is the one which updates jiffies, then
+		 * give up the assignment and let it be taken by the
+		 * cpu which runs the tick timer next, which might be
+		 * this cpu as well. If we don't drop this here the
+		 * jiffies might be stale and do_timer() never
+		 * invoked. Keep track of the fact that it was the one
+		 * which had the do_timer() duty last. If this cpu is
+		 * the one which had the do_timer() duty last, we
+		 * limit the sleep time to the timekeeping
+		 * max_deferement value which we retrieved
+		 * above. Otherwise we can sleep as long as we want.
+		 */
+		if (cpu == tick_do_timer_cpu) {
+			tick_do_timer_cpu = TICK_DO_TIMER_NONE;
+			ts->do_timer_last = 1;
+		} else if (tick_do_timer_cpu != TICK_DO_TIMER_NONE) {
+			time_delta = KTIME_MAX;
+			ts->do_timer_last = 0;
+		} else if (!ts->do_timer_last) {
+			time_delta = KTIME_MAX;
+		}
+
+		/*
 		 * calculate the expiry time for the next timer wheel
 		 * timer. delta_jiffies >= NEXT_TIMER_MAX_DELTA signals
 		 * that there is no timer pending or at least extremely
@@ -312,21 +325,12 @@ void tick_nohz_stop_sched_tick(int inidle)
 			 */
 			time_delta = min_t(u64, time_delta,
 					   tick_period.tv64 * delta_jiffies);
-			expires = ktime_add_ns(last_update, time_delta);
-		} else {
-			expires.tv64 = KTIME_MAX;
 		}
 
-		/*
-		 * If this cpu is the one which updates jiffies, then
-		 * give up the assignment and let it be taken by the
-		 * cpu which runs the tick timer next, which might be
-		 * this cpu as well. If we don't drop this here the
-		 * jiffies might be stale and do_timer() never
-		 * invoked.
-		 */
-		if (cpu == tick_do_timer_cpu)
-			tick_do_timer_cpu = TICK_DO_TIMER_NONE;
+		if (time_delta < KTIME_MAX)
+			expires = ktime_add_ns(last_update, time_delta);
+		else
+			expires.tv64 = KTIME_MAX;
 
 		if (delta_jiffies > 1)
 			cpumask_set_cpu(cpu, nohz_cpu_mask);

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

* [tip:perf/urgent] perf annotate: Allocate history size correctly
       [not found]             ` <new-submission>
                                 ` (446 preceding siblings ...)
  2009-11-13 19:50               ` [tip:timers/core] nohz: Track last do_timer() cpu tip-bot for Thomas Gleixner
@ 2009-11-17 17:18               ` tip-bot for Nick Piggin
  2009-11-23  7:15               ` [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19 tip-bot for Ingo Molnar
                                 ` (258 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Nick Piggin @ 2009-11-17 17:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	npiggin, fweisbec, tglx, mingo

Commit-ID:  d62d77fd18cc82e839e49b7ef3360e4411f7d2e5
Gitweb:     http://git.kernel.org/tip/d62d77fd18cc82e839e49b7ef3360e4411f7d2e5
Author:     Nick Piggin <npiggin@suse.de>
AuthorDate: Tue, 17 Nov 2009 12:29:38 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 17 Nov 2009 16:47:09 +0100

perf annotate: Allocate history size correctly

Symbol offset history table size does not get updated properly
when it is being resized. This leads to garbage results in
perf annotate.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/symbol.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 226f44a..cbac575 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -227,6 +227,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v)
 			      *curr = rb_entry(nd, struct symbol, rb_node);
 
 		prev->end = curr->start - 1;
+		if (prev->hist) {
+			free(prev->hist);
+			prev->hist = calloc(sizeof(u64), prev->end - prev->start);
+		}
 		prevnd = nd;
 	}
 
@@ -883,6 +887,10 @@ static inline void dso__fill_symbol_holes(struct dso *self)
 					pos->end = prev->end;
 				else if (hole)
 					pos->end = prev->start - 1;
+				if (pos->hist) {
+					free(pos->hist);
+					pos->hist = calloc(sizeof(u64), pos->end - pos->start);
+				}
 			}
 		}
 		prev = pos;

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

* [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
       [not found]             ` <new-submission>
                                 ` (447 preceding siblings ...)
  2009-11-17 17:18               ` [tip:perf/urgent] perf annotate: Allocate history size correctly tip-bot for Nick Piggin
@ 2009-11-23  7:15               ` tip-bot for Ingo Molnar
  2009-11-24 14:16                 ` Steven Rostedt
  2009-11-23 11:52               ` [tip:perf/core] perf events: Do not generate function trace entries in perf code tip-bot for Ingo Molnar
                                 ` (257 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-23  7:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, fweisbec,
	rostedt, tglx, mingo

Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Nov 2009 08:03:09 +0100

ring-buffer benchmark: Run producer/consumer threads at nice +19

The ring-buffer benchmark threads run on nice 0 by default, using
up a lot of CPU time and slowing down the system:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
  1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
 21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
     1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init

Renice them to +19 to make them less intrusive.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/trace/ring_buffer_benchmark.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c
index 70df73e..3875d49 100644
--- a/kernel/trace/ring_buffer_benchmark.c
+++ b/kernel/trace/ring_buffer_benchmark.c
@@ -399,6 +399,12 @@ static int __init ring_buffer_benchmark_init(void)
 	if (IS_ERR(producer))
 		goto out_kill;
 
+	/*
+	 * Run them as low-prio background tasks by default:
+	 */
+	set_user_nice(consumer, 19);
+	set_user_nice(producer, 19);
+
 	return 0;
 
  out_kill:

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

* [tip:perf/core] perf events: Do not generate function trace entries in perf code
       [not found]             ` <new-submission>
                                 ` (448 preceding siblings ...)
  2009-11-23  7:15               ` [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19 tip-bot for Ingo Molnar
@ 2009-11-23 11:52               ` tip-bot for Ingo Molnar
  2009-11-23 11:53               ` [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage tip-bot for Ingo Molnar
                                 ` (256 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-23 11:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  6e3d8330ae2c4b2c11a9577a0130d2ecda1c610d
Gitweb:     http://git.kernel.org/tip/6e3d8330ae2c4b2c11a9577a0130d2ecda1c610d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 23 Nov 2009 10:19:20 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Nov 2009 10:19:20 +0100

perf events: Do not generate function trace entries in perf code

Decreases perf overhead when function tracing is enabled,
by about 50%.

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>
---
 arch/x86/kernel/cpu/Makefile |    1 +
 kernel/Makefile              |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 68537e9..1d2cb38 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -5,6 +5,7 @@
 # Don't trace early stages of a secondary CPU boot
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_common.o = -pg
+CFLAGS_REMOVE_perf_event.o = -pg
 endif
 
 # Make sure load_percpu_segment has no stackprotector
diff --git a/kernel/Makefile b/kernel/Makefile
index 17b575e..6b7ce81 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -21,6 +21,7 @@ CFLAGS_REMOVE_mutex-debug.o = -pg
 CFLAGS_REMOVE_rtmutex-debug.o = -pg
 CFLAGS_REMOVE_cgroup-debug.o = -pg
 CFLAGS_REMOVE_sched_clock.o = -pg
+CFLAGS_REMOVE_perf_event.o = -pg
 endif
 
 obj-$(CONFIG_FREEZER) += freezer.o

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

* [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage
       [not found]             ` <new-submission>
                                 ` (449 preceding siblings ...)
  2009-11-23 11:52               ` [tip:perf/core] perf events: Do not generate function trace entries in perf code tip-bot for Ingo Molnar
@ 2009-11-23 11:53               ` tip-bot for Ingo Molnar
  2009-11-24 14:15                 ` Steven Rostedt
  2009-11-23 11:53               ` [tip:perf/core] perf_events: Optimize the swcounter hotpath tip-bot for Ingo Molnar
                                 ` (255 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-23 11:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  457dc928f586f3f4b930206965e6db270034e97e
Gitweb:     http://git.kernel.org/tip/457dc928f586f3f4b930206965e6db270034e97e
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 23 Nov 2009 11:03:28 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Nov 2009 11:04:07 +0100

tracing, function tracer: Clean up strstrip() usage

Clean up strstrip() usage - which also addresses this build warning:

  kernel/trace/ftrace.c: In function 'ftrace_pid_write':
  kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@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>
---
 kernel/trace/ftrace.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7f9b51e..1dc101d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2985,7 +2985,7 @@ static ssize_t
 ftrace_pid_write(struct file *filp, const char __user *ubuf,
 		   size_t cnt, loff_t *ppos)
 {
-	char buf[64];
+	char buf[64], *tmp;
 	long val;
 	int ret;
 
@@ -3001,11 +3001,11 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
 	 * Allow "echo > set_ftrace_pid" or "echo -n '' > set_ftrace_pid"
 	 * to clean the filter quietly.
 	 */
-	strstrip(buf);
-	if (strlen(buf) == 0)
+	tmp = strstrip(buf);
+	if (strlen(tmp) == 0)
 		return 1;
 
-	ret = strict_strtol(buf, 10, &val);
+	ret = strict_strtol(tmp, 10, &val);
 	if (ret < 0)
 		return ret;
 
@@ -3391,4 +3391,3 @@ void ftrace_graph_stop(void)
 	ftrace_stop();
 }
 #endif
-

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

* [tip:perf/core] perf_events: Optimize the swcounter hotpath
       [not found]             ` <new-submission>
                                 ` (450 preceding siblings ...)
  2009-11-23 11:53               ` [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage tip-bot for Ingo Molnar
@ 2009-11-23 11:53               ` tip-bot for Ingo Molnar
  2009-11-26  8:15               ` [tip:x86/debug] x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details tip-bot for Ingo Molnar
                                 ` (254 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-23 11:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  a4234bfcf4d72a10a99176cdef007345e9c3b4aa
Gitweb:     http://git.kernel.org/tip/a4234bfcf4d72a10a99176cdef007345e9c3b4aa
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 23 Nov 2009 10:57:59 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Nov 2009 11:48:27 +0100

perf_events: Optimize the swcounter hotpath

The structure init creates a bit memcpy, which shows
up big time in perf annotate output:

          :      ffffffff810a859d <__perf_sw_event>:
     1.68 :      ffffffff810a859d:       55                      push   %rbp
     1.69 :      ffffffff810a859e:       41 89 fa                mov    %edi,%r10d
     0.01 :      ffffffff810a85a1:       49 89 c9                mov    %rcx,%r9
     0.00 :      ffffffff810a85a4:       31 c0                   xor    %eax,%eax
     1.71 :      ffffffff810a85a6:       b9 16 00 00 00          mov    $0x16,%ecx
     0.00 :      ffffffff810a85ab:       48 89 e5                mov    %rsp,%rbp
     0.00 :      ffffffff810a85ae:       48 83 ec 60             sub    $0x60,%rsp
     1.52 :      ffffffff810a85b2:       48 8d 7d a0             lea    -0x60(%rbp),%rdi
    85.20 :      ffffffff810a85b6:       f3 ab                   rep stos %eax,%es:(%rdi)

None of the callees depends on the structure being pre-initialized,
so only initialize ->addr. This gets rid of the memcpy overhead.

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>
---
 kernel/perf_event.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index abe1ef4..20df8ab 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3954,12 +3954,12 @@ out:
 void __perf_sw_event(u32 event_id, u64 nr, int nmi,
 			    struct pt_regs *regs, u64 addr)
 {
-	struct perf_sample_data data = {
-		.addr = addr,
-	};
+	struct perf_sample_data data;
 
-	do_perf_sw_event(PERF_TYPE_SOFTWARE, event_id, nr, nmi,
-				&data, regs);
+	data.addr = addr;
+	data.raw  = NULL;
+
+	do_perf_sw_event(PERF_TYPE_SOFTWARE, event_id, nr, nmi, &data, regs);
 }
 
 static void perf_swevent_read(struct perf_event *event)

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

* Re: [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage
  2009-11-23 11:53               ` [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage tip-bot for Ingo Molnar
@ 2009-11-24 14:15                 ` Steven Rostedt
  0 siblings, 0 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-11-24 14:15 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Ingo,

Not sure if you noticed, but this was the first change in the git pull I
sent earlier. It was from Javier Martinez Canillas which he first posted
back on October 31st.

-- Steve

On Mon, 2009-11-23 at 11:53 +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  457dc928f586f3f4b930206965e6db270034e97e
> Gitweb:     http://git.kernel.org/tip/457dc928f586f3f4b930206965e6db270034e97e
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Mon, 23 Nov 2009 11:03:28 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 23 Nov 2009 11:04:07 +0100
> 
> tracing, function tracer: Clean up strstrip() usage
> 
> Clean up strstrip() usage - which also addresses this build warning:
> 
>   kernel/trace/ftrace.c: In function 'ftrace_pid_write':
>   kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Frederic Weisbecker <fweisbec@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>
> ---
>  kernel/trace/ftrace.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 7f9b51e..1dc101d 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2985,7 +2985,7 @@ static ssize_t
>  ftrace_pid_write(struct file *filp, const char __user *ubuf,
>  		   size_t cnt, loff_t *ppos)
>  {
> -	char buf[64];
> +	char buf[64], *tmp;
>  	long val;
>  	int ret;
>  
> @@ -3001,11 +3001,11 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
>  	 * Allow "echo > set_ftrace_pid" or "echo -n '' > set_ftrace_pid"
>  	 * to clean the filter quietly.
>  	 */
> -	strstrip(buf);
> -	if (strlen(buf) == 0)
> +	tmp = strstrip(buf);
> +	if (strlen(tmp) == 0)
>  		return 1;
>  
> -	ret = strict_strtol(buf, 10, &val);
> +	ret = strict_strtol(tmp, 10, &val);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -3391,4 +3391,3 @@ void ftrace_graph_stop(void)
>  	ftrace_stop();
>  }
>  #endif
> -


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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-23  7:15               ` [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19 tip-bot for Ingo Molnar
@ 2009-11-24 14:16                 ` Steven Rostedt
  2009-11-24 14:20                   ` Steven Rostedt
  2009-11-24 14:39                   ` Ingo Molnar
  0 siblings, 2 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-11-24 14:16 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx, mingo
  Cc: linux-tip-commits

On Mon, 2009-11-23 at 07:15 +0000, tip-bot for Ingo Molnar wrote:
> Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
> Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
> Author:     Ingo Molnar <mingo@elte.hu>
> AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 23 Nov 2009 08:03:09 +0100
> 
> ring-buffer benchmark: Run producer/consumer threads at nice +19
> 
> The ring-buffer benchmark threads run on nice 0 by default, using
> up a lot of CPU time and slowing down the system:
> 
>    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>   1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
>   1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
>  21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
>      1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init
> 
> Renice them to +19 to make them less intrusive.

Ingo, that is the point of a benchmark!

This module is not made to be run all the time. I know you do it for
testing. But running it at lowest priority kills the reason this module
was made in the first place!

-- Steve



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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-24 14:16                 ` Steven Rostedt
@ 2009-11-24 14:20                   ` Steven Rostedt
  2009-11-24 14:39                   ` Ingo Molnar
  1 sibling, 0 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-11-24 14:20 UTC (permalink / raw)
  To: mingo
  Cc: hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx, mingo,
	linux-tip-commits

On Tue, 2009-11-24 at 09:16 -0500, Steven Rostedt wrote:

> > Renice them to +19 to make them less intrusive.
> 
> Ingo, that is the point of a benchmark!
> 
> This module is not made to be run all the time. I know you do it for
> testing. But running it at lowest priority kills the reason this module
> was made in the first place!

Note, I first wrote this where the threads ran at SCHED_FIFO (but never
published it that way). I was afraid if something went wrong, it would
lock up the system. But still, it is a benchmark module. It is for
developers and analyzers only. Not for common users.

-- Steve



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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-24 14:16                 ` Steven Rostedt
  2009-11-24 14:20                   ` Steven Rostedt
@ 2009-11-24 14:39                   ` Ingo Molnar
  2009-11-24 15:01                     ` Steven Rostedt
  1 sibling, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-11-24 14:39 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx,
	linux-tip-commits


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

> On Mon, 2009-11-23 at 07:15 +0000, tip-bot for Ingo Molnar wrote:
> > Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
> > Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
> > Author:     Ingo Molnar <mingo@elte.hu>
> > AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Mon, 23 Nov 2009 08:03:09 +0100
> > 
> > ring-buffer benchmark: Run producer/consumer threads at nice +19
> > 
> > The ring-buffer benchmark threads run on nice 0 by default, using
> > up a lot of CPU time and slowing down the system:
> > 
> >    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
> >   1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
> >   1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
> >  21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
> >      1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init
> > 
> > Renice them to +19 to make them less intrusive.
> 
> Ingo, that is the point of a benchmark!
> 
> This module is not made to be run all the time. I know you do it for 
> testing. But running it at lowest priority kills the reason this 
> module was made in the first place!

Well, it also found quite a few bugs in the ring-buffer code, beyond 
benchmarking so i'd like to use it even without looking at the numbers.

	Ingo

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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-24 14:39                   ` Ingo Molnar
@ 2009-11-24 15:01                     ` Steven Rostedt
  2009-11-24 15:22                       ` Ingo Molnar
  0 siblings, 1 reply; 1150+ messages in thread
From: Steven Rostedt @ 2009-11-24 15:01 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx,
	linux-tip-commits

On Tue, 2009-11-24 at 15:39 +0100, Ingo Molnar wrote:

> > This module is not made to be run all the time. I know you do it for 
> > testing. But running it at lowest priority kills the reason this 
> > module was made in the first place!
> 
> Well, it also found quite a few bugs in the ring-buffer code, beyond 
> benchmarking so i'd like to use it even without looking at the numbers.

OK, then lets make a module option (and command line) that will allow
the setting of the priority of the threads. Either nice or even fifo
(use at your own risk ;-)

I can write something up for that.

-- Steve



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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-24 15:01                     ` Steven Rostedt
@ 2009-11-24 15:22                       ` Ingo Molnar
  2009-11-24 15:40                         ` Steven Rostedt
  0 siblings, 1 reply; 1150+ messages in thread
From: Ingo Molnar @ 2009-11-24 15:22 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx,
	linux-tip-commits


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

> On Tue, 2009-11-24 at 15:39 +0100, Ingo Molnar wrote:
> 
> > > This module is not made to be run all the time. I know you do it 
> > > for testing. But running it at lowest priority kills the reason 
> > > this module was made in the first place!
> > 
> > Well, it also found quite a few bugs in the ring-buffer code, beyond 
> > benchmarking so i'd like to use it even without looking at the 
> > numbers.
> 
> OK, then lets make a module option (and command line) that will allow 
> the setting of the priority of the threads. Either nice or even fifo 
> (use at your own risk ;-)

Yeah, that's fine to me - as long as the default is unintrusive. (i.e. 
like the rcutorture threads, which run at nice +19 too - and kmemcheck 
which runs at +19 as well.)

We still have the perl overhead in function-tracing kernel builds btw
:-/

	Ingo

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

* Re: [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19
  2009-11-24 15:22                       ` Ingo Molnar
@ 2009-11-24 15:40                         ` Steven Rostedt
  0 siblings, 0 replies; 1150+ messages in thread
From: Steven Rostedt @ 2009-11-24 15:40 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, fweisbec, a.p.zijlstra, efault, tglx,
	linux-tip-commits

On Tue, 2009-11-24 at 16:22 +0100, Ingo Molnar wrote:
> * Steven Rostedt <rostedt@goodmis.org> wrote:

> We still have the perl overhead in function-tracing kernel builds btw
> :-/

Yes I know. Someone did send me a patch to start the conversion to C,
but it needs to be audited quite thoroughly.

-- Steve



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

* [tip:x86/debug] x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details
       [not found]             ` <new-submission>
                                 ` (451 preceding siblings ...)
  2009-11-23 11:53               ` [tip:perf/core] perf_events: Optimize the swcounter hotpath tip-bot for Ingo Molnar
@ 2009-11-26  8:15               ` tip-bot for Ingo Molnar
  2009-11-30  8:23               ` [tip:perf/scripting] perf scripting: Fix build tip-bot for Ingo Molnar
                                 ` (253 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-26  8:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo

Commit-ID:  b803090615ccec669681ff85ce28671e7bfefa3d
Gitweb:     http://git.kernel.org/tip/b803090615ccec669681ff85ce28671e7bfefa3d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 26 Nov 2009 08:17:31 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 26 Nov 2009 08:24:33 +0100

x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details

Make the initialization more readable, plus tidy up a few small
visual details as well.

No change in functionality.

LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/dumpstack_32.c |    9 ++++-----
 arch/x86/kernel/dumpstack_64.c |   25 +++++++++++++------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index f7dd2a7..e0ed4c7 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -10,9 +10,9 @@
 #include <linux/module.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
+#include <linux/sysfs.h>
 #include <linux/bug.h>
 #include <linux/nmi.h>
-#include <linux/sysfs.h>
 
 #include <asm/stacktrace.h>
 
@@ -35,6 +35,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 
 	if (!stack) {
 		unsigned long dummy;
+
 		stack = &dummy;
 		if (task && task != current)
 			stack = (unsigned long *)task->thread.sp;
@@ -57,8 +58,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 
 		context = (struct thread_info *)
 			((unsigned long)stack & (~(THREAD_SIZE - 1)));
-		bp = print_context_stack(context, stack, bp, ops,
-					 data, NULL, &graph);
+		bp = print_context_stack(context, stack, bp, ops, data, NULL, &graph);
 
 		stack = (unsigned long *)context->previous_esp;
 		if (!stack)
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(dump_trace);
 
 void
 show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
-		unsigned long *sp, unsigned long bp, char *log_lvl)
+		   unsigned long *sp, unsigned long bp, char *log_lvl)
 {
 	unsigned long *stack;
 	int i;
@@ -156,4 +156,3 @@ int is_valid_bugaddr(unsigned long ip)
 
 	return ud2 == 0x0b0f;
 }
-
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index a071e6b..cfec478 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -10,26 +10,28 @@
 #include <linux/module.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
+#include <linux/sysfs.h>
 #include <linux/bug.h>
 #include <linux/nmi.h>
-#include <linux/sysfs.h>
 
 #include <asm/stacktrace.h>
 
 #include "dumpstack.h"
 
+#define N_EXCEPTION_STACKS_END \
+		(N_EXCEPTION_STACKS + DEBUG_STKSZ/EXCEPTION_STKSZ - 2)
 
 static char x86_stack_ids[][8] = {
-		[DEBUG_STACK - 1] = "#DB",
-		[NMI_STACK - 1] = "NMI",
-		[DOUBLEFAULT_STACK - 1] = "#DF",
-		[STACKFAULT_STACK - 1] = "#SS",
-		[MCE_STACK - 1] = "#MC",
+		[ DEBUG_STACK-1			]	= "#DB",
+		[ NMI_STACK-1			]	= "NMI",
+		[ DOUBLEFAULT_STACK-1		]	= "#DF",
+		[ STACKFAULT_STACK-1		]	= "#SS",
+		[ MCE_STACK-1			]	= "#MC",
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
-		[N_EXCEPTION_STACKS ...
-			N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
+		[ N_EXCEPTION_STACKS ...
+		  N_EXCEPTION_STACKS_END	]	= "#DB[?]"
 #endif
-	};
+};
 
 int x86_is_stack_id(int id, char *name)
 {
@@ -37,7 +39,7 @@ int x86_is_stack_id(int id, char *name)
 }
 
 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
-					unsigned *usedp, char **idp)
+					 unsigned *usedp, char **idp)
 {
 	unsigned k;
 
@@ -202,7 +204,7 @@ EXPORT_SYMBOL(dump_trace);
 
 void
 show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
-		unsigned long *sp, unsigned long bp, char *log_lvl)
+		   unsigned long *sp, unsigned long bp, char *log_lvl)
 {
 	unsigned long *stack;
 	int i;
@@ -303,4 +305,3 @@ int is_valid_bugaddr(unsigned long ip)
 
 	return ud2 == 0x0b0f;
 }
-

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

* [tip:perf/scripting] perf scripting: Fix build
       [not found]             ` <new-submission>
                                 ` (452 preceding siblings ...)
  2009-11-26  8:15               ` [tip:x86/debug] x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details tip-bot for Ingo Molnar
@ 2009-11-30  8:23               ` tip-bot for Ingo Molnar
  2009-12-06 20:27               ` [tip:sched/urgent] sched: Fix balance vs hotplug race tip-bot for Peter Zijlstra
                                 ` (252 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-11-30  8:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  cf72344d1ad7b33805ef8d65e758b267e6f4cb8d
Gitweb:     http://git.kernel.org/tip/cf72344d1ad7b33805ef8d65e758b267e6f4cb8d
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 28 Nov 2009 10:11:00 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 28 Nov 2009 10:11:00 +0100

perf scripting: Fix build

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/builtin-trace.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index ca8ebf1..abb914a 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -5,6 +5,8 @@
 #include "util/symbol.h"
 #include "util/thread.h"
 #include "util/header.h"
+#include "util/exec_cmd.h"
+#include "util/trace-event.h"
 
 static char const		*script_name;
 static char const		*generate_script_lang;

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

* [tip:sched/urgent] sched: Fix balance vs hotplug race
       [not found]             ` <new-submission>
                                 ` (453 preceding siblings ...)
  2009-11-30  8:23               ` [tip:perf/scripting] perf scripting: Fix build tip-bot for Ingo Molnar
@ 2009-12-06 20:27               ` tip-bot for Peter Zijlstra
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove sysctl.sched_features tip-bot for Peter Zijlstra
                                 ` (251 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-06 20:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6ad4c18884e864cf4c77f9074d3d1816063f99cd
Gitweb:     http://git.kernel.org/tip/6ad4c18884e864cf4c77f9074d3d1816063f99cd
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 25 Nov 2009 13:31:39 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 6 Dec 2009 21:10:56 +0100

sched: Fix balance vs hotplug race

Since (e761b77: cpu hotplug, sched: Introduce cpu_active_map and redo
sched domain managment) we have cpu_active_mask which is suppose to rule
scheduler migration and load-balancing, except it never (fully) did.

The particular problem being solved here is a crash in try_to_wake_up()
where select_task_rq() ends up selecting an offline cpu because
select_task_rq_fair() trusts the sched_domain tree to reflect the
current state of affairs, similarly select_task_rq_rt() trusts the
root_domain.

However, the sched_domains are updated from CPU_DEAD, which is after the
cpu is taken offline and after stop_machine is done. Therefore it can
race perfectly well with code assuming the domains are right.

Cure this by building the domains from cpu_active_mask on
CPU_DOWN_PREPARE.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/cpumask.h |    2 ++
 kernel/cpu.c            |   18 +++++++++++++-----
 kernel/cpuset.c         |   16 +++++++++-------
 kernel/sched.c          |   32 +++++++++++++++++---------------
 4 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 789cf5f..d77b547 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -84,6 +84,7 @@ extern const struct cpumask *const cpu_active_mask;
 #define num_online_cpus()	cpumask_weight(cpu_online_mask)
 #define num_possible_cpus()	cpumask_weight(cpu_possible_mask)
 #define num_present_cpus()	cpumask_weight(cpu_present_mask)
+#define num_active_cpus()	cpumask_weight(cpu_active_mask)
 #define cpu_online(cpu)		cpumask_test_cpu((cpu), cpu_online_mask)
 #define cpu_possible(cpu)	cpumask_test_cpu((cpu), cpu_possible_mask)
 #define cpu_present(cpu)	cpumask_test_cpu((cpu), cpu_present_mask)
@@ -92,6 +93,7 @@ extern const struct cpumask *const cpu_active_mask;
 #define num_online_cpus()	1
 #define num_possible_cpus()	1
 #define num_present_cpus()	1
+#define num_active_cpus()	1
 #define cpu_online(cpu)		((cpu) == 0)
 #define cpu_possible(cpu)	((cpu) == 0)
 #define cpu_present(cpu)	((cpu) == 0)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6ba0f1e..b216886 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -212,6 +212,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 	err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
 					hcpu, -1, &nr_calls);
 	if (err == NOTIFY_BAD) {
+		set_cpu_active(cpu, true);
+
 		nr_calls--;
 		__raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
 					  hcpu, nr_calls, NULL);
@@ -223,11 +225,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 
 	/* Ensure that we are not runnable on dying cpu */
 	cpumask_copy(old_allowed, &current->cpus_allowed);
-	set_cpus_allowed_ptr(current,
-			     cpumask_of(cpumask_any_but(cpu_online_mask, cpu)));
+	set_cpus_allowed_ptr(current, cpu_active_mask);
 
 	err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
 	if (err) {
+		set_cpu_active(cpu, true);
 		/* CPU didn't die: tell everyone.  Can't complain. */
 		if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
 					    hcpu) == NOTIFY_BAD)
@@ -292,9 +294,6 @@ int __ref cpu_down(unsigned int cpu)
 
 	err = _cpu_down(cpu, 0);
 
-	if (cpu_online(cpu))
-		set_cpu_active(cpu, true);
-
 out:
 	cpu_maps_update_done();
 	stop_machine_destroy();
@@ -387,6 +386,15 @@ int disable_nonboot_cpus(void)
 	 * with the userspace trying to use the CPU hotplug at the same time
 	 */
 	cpumask_clear(frozen_cpus);
+
+	for_each_online_cpu(cpu) {
+		if (cpu == first_cpu)
+			continue;
+		set_cpu_active(cpu, false);
+	}
+
+	synchronize_sched();
+
 	printk("Disabling non-boot CPUs ...\n");
 	for_each_online_cpu(cpu) {
 		if (cpu == first_cpu)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 43fb7e8..ba401fa 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -872,7 +872,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
 		if (retval < 0)
 			return retval;
 
-		if (!cpumask_subset(trialcs->cpus_allowed, cpu_online_mask))
+		if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask))
 			return -EINVAL;
 	}
 	retval = validate_change(cs, trialcs);
@@ -2010,7 +2010,7 @@ static void scan_for_empty_cpusets(struct cpuset *root)
 		}
 
 		/* Continue past cpusets with all cpus, mems online */
-		if (cpumask_subset(cp->cpus_allowed, cpu_online_mask) &&
+		if (cpumask_subset(cp->cpus_allowed, cpu_active_mask) &&
 		    nodes_subset(cp->mems_allowed, node_states[N_HIGH_MEMORY]))
 			continue;
 
@@ -2019,7 +2019,7 @@ static void scan_for_empty_cpusets(struct cpuset *root)
 		/* Remove offline cpus and mems from this cpuset. */
 		mutex_lock(&callback_mutex);
 		cpumask_and(cp->cpus_allowed, cp->cpus_allowed,
-			    cpu_online_mask);
+			    cpu_active_mask);
 		nodes_and(cp->mems_allowed, cp->mems_allowed,
 						node_states[N_HIGH_MEMORY]);
 		mutex_unlock(&callback_mutex);
@@ -2057,8 +2057,10 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
 	switch (phase) {
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
+	case CPU_DOWN_PREPARE:
+	case CPU_DOWN_PREPARE_FROZEN:
+	case CPU_DOWN_FAILED:
+	case CPU_DOWN_FAILED_FROZEN:
 		break;
 
 	default:
@@ -2067,7 +2069,7 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
 
 	cgroup_lock();
 	mutex_lock(&callback_mutex);
-	cpumask_copy(top_cpuset.cpus_allowed, cpu_online_mask);
+	cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
 	mutex_unlock(&callback_mutex);
 	scan_for_empty_cpusets(&top_cpuset);
 	ndoms = generate_sched_domains(&doms, &attr);
@@ -2114,7 +2116,7 @@ static int cpuset_track_online_nodes(struct notifier_block *self,
 
 void __init cpuset_init_smp(void)
 {
-	cpumask_copy(top_cpuset.cpus_allowed, cpu_online_mask);
+	cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
 	top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
 
 	hotcpu_notifier(cpuset_track_online_cpus, 0);
diff --git a/kernel/sched.c b/kernel/sched.c
index aa31244..281da29 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4134,7 +4134,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
 	unsigned long flags;
 	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
 
-	cpumask_copy(cpus, cpu_online_mask);
+	cpumask_copy(cpus, cpu_active_mask);
 
 	/*
 	 * When power savings policy is enabled for the parent domain, idle
@@ -4297,7 +4297,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
 	int all_pinned = 0;
 	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
 
-	cpumask_copy(cpus, cpu_online_mask);
+	cpumask_copy(cpus, cpu_active_mask);
 
 	/*
 	 * When power savings policy is enabled for the parent domain, idle
@@ -4694,7 +4694,7 @@ int select_nohz_load_balancer(int stop_tick)
 		cpumask_set_cpu(cpu, nohz.cpu_mask);
 
 		/* time for ilb owner also to sleep */
-		if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
+		if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
 			if (atomic_read(&nohz.load_balancer) == cpu)
 				atomic_set(&nohz.load_balancer, -1);
 			return 0;
@@ -7093,7 +7093,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
 	int ret = 0;
 
 	rq = task_rq_lock(p, &flags);
-	if (!cpumask_intersects(new_mask, cpu_online_mask)) {
+	if (!cpumask_intersects(new_mask, cpu_active_mask)) {
 		ret = -EINVAL;
 		goto out;
 	}
@@ -7115,7 +7115,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
 	if (cpumask_test_cpu(task_cpu(p), new_mask))
 		goto out;
 
-	if (migrate_task(p, cpumask_any_and(cpu_online_mask, new_mask), &req)) {
+	if (migrate_task(p, cpumask_any_and(cpu_active_mask, new_mask), &req)) {
 		/* Need help from migration thread: drop lock and wait. */
 		struct task_struct *mt = rq->migration_thread;
 
@@ -7269,19 +7269,19 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
 
 again:
 	/* Look for allowed, online CPU in same node. */
-	for_each_cpu_and(dest_cpu, nodemask, cpu_online_mask)
+	for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask)
 		if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
 			goto move;
 
 	/* Any allowed, online CPU? */
-	dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_online_mask);
+	dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask);
 	if (dest_cpu < nr_cpu_ids)
 		goto move;
 
 	/* No more Mr. Nice Guy. */
 	if (dest_cpu >= nr_cpu_ids) {
 		cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
-		dest_cpu = cpumask_any_and(cpu_online_mask, &p->cpus_allowed);
+		dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed);
 
 		/*
 		 * Don't tell them about moving exiting tasks or
@@ -7310,7 +7310,7 @@ move:
  */
 static void migrate_nr_uninterruptible(struct rq *rq_src)
 {
-	struct rq *rq_dest = cpu_rq(cpumask_any(cpu_online_mask));
+	struct rq *rq_dest = cpu_rq(cpumask_any(cpu_active_mask));
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -7564,7 +7564,7 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
 static struct ctl_table_header *sd_sysctl_header;
 static void register_sched_domain_sysctl(void)
 {
-	int i, cpu_num = num_online_cpus();
+	int i, cpu_num = num_possible_cpus();
 	struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
 	char buf[32];
 
@@ -7574,7 +7574,7 @@ static void register_sched_domain_sysctl(void)
 	if (entry == NULL)
 		return;
 
-	for_each_online_cpu(i) {
+	for_each_possible_cpu(i) {
 		snprintf(buf, 32, "cpu%d", i);
 		entry->procname = kstrdup(buf, GFP_KERNEL);
 		entry->mode = 0555;
@@ -9100,7 +9100,7 @@ match1:
 	if (doms_new == NULL) {
 		ndoms_cur = 0;
 		doms_new = &fallback_doms;
-		cpumask_andnot(doms_new[0], cpu_online_mask, cpu_isolated_map);
+		cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map);
 		WARN_ON_ONCE(dattr_new);
 	}
 
@@ -9231,8 +9231,10 @@ static int update_sched_domains(struct notifier_block *nfb,
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
+	case CPU_DOWN_PREPARE:
+	case CPU_DOWN_PREPARE_FROZEN:
+	case CPU_DOWN_FAILED:
+	case CPU_DOWN_FAILED_FROZEN:
 		partition_sched_domains(1, NULL, NULL);
 		return NOTIFY_OK;
 
@@ -9279,7 +9281,7 @@ void __init sched_init_smp(void)
 #endif
 	get_online_cpus();
 	mutex_lock(&sched_domains_mutex);
-	arch_init_sched_domains(cpu_online_mask);
+	arch_init_sched_domains(cpu_active_mask);
 	cpumask_andnot(non_isolated_cpus, cpu_possible_mask, cpu_isolated_map);
 	if (cpumask_empty(non_isolated_cpus))
 		cpumask_set_cpu(smp_processor_id(), non_isolated_cpus);

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

* [tip:sched/urgent] sched: Remove sysctl.sched_features
       [not found]             ` <new-submission>
                                 ` (454 preceding siblings ...)
  2009-12-06 20:27               ` [tip:sched/urgent] sched: Fix balance vs hotplug race tip-bot for Peter Zijlstra
@ 2009-12-09  9:53               ` tip-bot for Peter Zijlstra
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Consolidate select_task_rq() callers tip-bot for Peter Zijlstra
                                 ` (250 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6b314d0e11924c803bf8cd944e87fd58cdb5088c
Gitweb:     http://git.kernel.org/tip/6b314d0e11924c803bf8cd944e87fd58cdb5088c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 2 Dec 2009 18:58:05 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:01 +0100

sched: Remove sysctl.sched_features

Since we've had a much saner debugfs interface to this, remove the
sysctl one.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
[ v2: build fix ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h |    1 -
 kernel/sysctl.c       |    8 --------
 2 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9b24027..ca72ed4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1905,7 +1905,6 @@ extern unsigned int sysctl_sched_shares_ratelimit;
 extern unsigned int sysctl_sched_shares_thresh;
 extern unsigned int sysctl_sched_child_runs_first;
 #ifdef CONFIG_SCHED_DEBUG
-extern unsigned int sysctl_sched_features;
 extern unsigned int sysctl_sched_migration_cost;
 extern unsigned int sysctl_sched_nr_migrate;
 extern unsigned int sysctl_sched_time_avg;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4dbf93a..e5cc535 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -316,14 +316,6 @@ static struct ctl_table kern_table[] = {
 	},
 	{
 		.ctl_name	= CTL_UNNUMBERED,
-		.procname	= "sched_features",
-		.data		= &sysctl_sched_features,
-		.maxlen		= sizeof(unsigned int),
-		.mode		= 0644,
-		.proc_handler	= &proc_dointvec,
-	},
-	{
-		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "sched_migration_cost",
 		.data		= &sysctl_sched_migration_cost,
 		.maxlen		= sizeof(unsigned int),

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

* [tip:sched/urgent] sched: Consolidate select_task_rq() callers
       [not found]             ` <new-submission>
                                 ` (455 preceding siblings ...)
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove sysctl.sched_features tip-bot for Peter Zijlstra
@ 2009-12-09  9:53               ` tip-bot for Peter Zijlstra
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove rq->clock coupling from set_task_cpu() tip-bot for Peter Zijlstra
                                 ` (249 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  970b13bacba14a8cef6f642861947df1d175b0b3
Gitweb:     http://git.kernel.org/tip/970b13bacba14a8cef6f642861947df1d175b0b3
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 25 Nov 2009 13:31:39 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:02 +0100

sched: Consolidate select_task_rq() callers

Small cleanup.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
[ v2: build fix ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 68db5a2..01fd131 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2323,6 +2323,14 @@ void task_oncpu_function_call(struct task_struct *p,
 	preempt_enable();
 }
 
+#ifdef CONFIG_SMP
+static inline
+int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
+{
+	return p->sched_class->select_task_rq(p, sd_flags, wake_flags);
+}
+#endif
+
 /***
  * try_to_wake_up - wake up a thread
  * @p: the to-be-woken-up thread
@@ -2376,7 +2384,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	p->state = TASK_WAKING;
 	task_rq_unlock(rq, &flags);
 
-	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
+	cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
 	if (cpu != orig_cpu) {
 		local_irq_save(flags);
 		rq = cpu_rq(cpu);
@@ -2593,7 +2601,7 @@ void sched_fork(struct task_struct *p, int clone_flags)
 		p->sched_class = &fair_sched_class;
 
 #ifdef CONFIG_SMP
-	cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0);
+	cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
 #endif
 	local_irq_save(flags);
 	update_rq_clock(cpu_rq(cpu));
@@ -3156,7 +3164,7 @@ out:
 void sched_exec(void)
 {
 	int new_cpu, this_cpu = get_cpu();
-	new_cpu = current->sched_class->select_task_rq(current, SD_BALANCE_EXEC, 0);
+	new_cpu = select_task_rq(current, SD_BALANCE_EXEC, 0);
 	put_cpu();
 	if (new_cpu != this_cpu)
 		sched_migrate_task(current, new_cpu);

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

* [tip:sched/urgent] sched: Remove rq->clock coupling from set_task_cpu()
       [not found]             ` <new-submission>
                                 ` (456 preceding siblings ...)
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Consolidate select_task_rq() callers tip-bot for Peter Zijlstra
@ 2009-12-09  9:53               ` tip-bot for Peter Zijlstra
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up ttwu() rq locking tip-bot for Peter Zijlstra
                                 ` (248 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5afcdab706d6002cb02b567ba46e650215e694e8
Gitweb:     http://git.kernel.org/tip/5afcdab706d6002cb02b567ba46e650215e694e8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 27 Nov 2009 14:12:25 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:03 +0100

sched: Remove rq->clock coupling from set_task_cpu()

set_task_cpu() should be rq invariant and only touch task state, it
currently fails to do so, which opens up a few races, since not all
callers hold both rq->locks.

Remove the relyance on rq->clock, as any site calling set_task_cpu()
should also do a remote clock update, which should ensure the observed
time between these two cpus is monotonic, as per
kernel/sched_clock.c:sched_clock_remote().

Therefore we can simply remove the clock_offset bits and be happy.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 01fd131..1f9c6d9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2060,23 +2060,12 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
 void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 {
 	int old_cpu = task_cpu(p);
-	struct rq *old_rq = cpu_rq(old_cpu), *new_rq = cpu_rq(new_cpu);
+	struct rq *old_rq = cpu_rq(old_cpu);
 	struct cfs_rq *old_cfsrq = task_cfs_rq(p),
 		      *new_cfsrq = cpu_cfs_rq(old_cfsrq, new_cpu);
-	u64 clock_offset;
-
-	clock_offset = old_rq->clock - new_rq->clock;
 
 	trace_sched_migrate_task(p, new_cpu);
 
-#ifdef CONFIG_SCHEDSTATS
-	if (p->se.wait_start)
-		p->se.wait_start -= clock_offset;
-	if (p->se.sleep_start)
-		p->se.sleep_start -= clock_offset;
-	if (p->se.block_start)
-		p->se.block_start -= clock_offset;
-#endif
 	if (old_cpu != new_cpu) {
 		p->se.nr_migrations++;
 #ifdef CONFIG_SCHEDSTATS

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

* [tip:sched/urgent] sched: Clean up ttwu() rq locking
       [not found]             ` <new-submission>
                                 ` (457 preceding siblings ...)
  2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove rq->clock coupling from set_task_cpu() tip-bot for Peter Zijlstra
@ 2009-12-09  9:54               ` tip-bot for Peter Zijlstra
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Sanitize fork() handling tip-bot for Peter Zijlstra
                                 ` (247 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  ab19cb23313733c55e0517607844b86720b35f5f
Gitweb:     http://git.kernel.org/tip/ab19cb23313733c55e0517607844b86720b35f5f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 27 Nov 2009 15:44:43 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:04 +0100

sched: Clean up ttwu() rq locking

Since set_task_clock() doesn't rely on rq->clock anymore we can simplyfy
the mess in ttwu().

Optimize things a bit by not fiddling with the IRQ state there.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 1f9c6d9..c92670f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2371,17 +2371,14 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	if (task_contributes_to_load(p))
 		rq->nr_uninterruptible--;
 	p->state = TASK_WAKING;
-	task_rq_unlock(rq, &flags);
+	__task_rq_unlock(rq);
 
 	cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
-	if (cpu != orig_cpu) {
-		local_irq_save(flags);
-		rq = cpu_rq(cpu);
-		update_rq_clock(rq);
+	if (cpu != orig_cpu)
 		set_task_cpu(p, cpu);
-		local_irq_restore(flags);
-	}
-	rq = task_rq_lock(p, &flags);
+
+	rq = __task_rq_lock(p);
+	update_rq_clock(rq);
 
 	WARN_ON(p->state != TASK_WAKING);
 	cpu = task_cpu(p);

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

* [tip:sched/urgent] sched: Sanitize fork() handling
       [not found]             ` <new-submission>
                                 ` (458 preceding siblings ...)
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up ttwu() rq locking tip-bot for Peter Zijlstra
@ 2009-12-09  9:54               ` tip-bot for Peter Zijlstra
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up check_preempt_wakeup() tip-bot for Peter Zijlstra
                                 ` (246 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cd29fe6f2637cc2ccbda5ac65f5332d6bf5fa3c6
Gitweb:     http://git.kernel.org/tip/cd29fe6f2637cc2ccbda5ac65f5332d6bf5fa3c6
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 27 Nov 2009 17:32:46 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:05 +0100

sched: Sanitize fork() handling

Currently we try to do task placement in wake_up_new_task() after we do
the load-balance pass in sched_fork(). This yields complicated semantics
in that we have to deal with tasks on different RQs and the
set_task_cpu() calls in copy_process() and sched_fork()

Rename ->task_new() to ->task_fork() and call it from sched_fork()
before the balancing, this gives the policy a clear point to place the
task.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h |    2 +-
 kernel/sched.c        |   47 ++++++++++++++++++-----------------------------
 kernel/sched_fair.c   |   28 +++++++++++++++-------------
 3 files changed, 34 insertions(+), 43 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index ca72ed4..31d9dec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1102,7 +1102,7 @@ struct sched_class {
 
 	void (*set_curr_task) (struct rq *rq);
 	void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
-	void (*task_new) (struct rq *rq, struct task_struct *p);
+	void (*task_fork) (struct task_struct *p);
 
 	void (*switched_from) (struct rq *this_rq, struct task_struct *task,
 			       int running);
diff --git a/kernel/sched.c b/kernel/sched.c
index c92670f..33c9035 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1811,6 +1811,20 @@ static void cfs_rq_set_shares(struct cfs_rq *cfs_rq, unsigned long shares)
 
 static void calc_load_account_active(struct rq *this_rq);
 
+static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
+{
+	set_task_rq(p, cpu);
+#ifdef CONFIG_SMP
+	/*
+	 * After ->cpu is set up to a new value, task_rq_lock(p, ...) can be
+	 * successfuly executed on another CPU. We must ensure that updates of
+	 * per-task data have been completed by this moment.
+	 */
+	smp_wmb();
+	task_thread_info(p)->cpu = cpu;
+#endif
+}
+
 #include "sched_stats.h"
 #include "sched_idletask.c"
 #include "sched_fair.c"
@@ -1967,20 +1981,6 @@ inline int task_curr(const struct task_struct *p)
 	return cpu_curr(task_cpu(p)) == p;
 }
 
-static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
-{
-	set_task_rq(p, cpu);
-#ifdef CONFIG_SMP
-	/*
-	 * After ->cpu is set up to a new value, task_rq_lock(p, ...) can be
-	 * successfuly executed on another CPU. We must ensure that updates of
-	 * per-task data have been completed by this moment.
-	 */
-	smp_wmb();
-	task_thread_info(p)->cpu = cpu;
-#endif
-}
-
 static inline void check_class_changed(struct rq *rq, struct task_struct *p,
 				       const struct sched_class *prev_class,
 				       int oldprio, int running)
@@ -2552,7 +2552,6 @@ static void __sched_fork(struct task_struct *p)
 void sched_fork(struct task_struct *p, int clone_flags)
 {
 	int cpu = get_cpu();
-	unsigned long flags;
 
 	__sched_fork(p);
 
@@ -2586,13 +2585,13 @@ void sched_fork(struct task_struct *p, int clone_flags)
 	if (!rt_prio(p->prio))
 		p->sched_class = &fair_sched_class;
 
+	if (p->sched_class->task_fork)
+		p->sched_class->task_fork(p);
+
 #ifdef CONFIG_SMP
 	cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
 #endif
-	local_irq_save(flags);
-	update_rq_clock(cpu_rq(cpu));
 	set_task_cpu(p, cpu);
-	local_irq_restore(flags);
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))
@@ -2625,17 +2624,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
 	rq = task_rq_lock(p, &flags);
 	BUG_ON(p->state != TASK_RUNNING);
 	update_rq_clock(rq);
-
-	if (!p->sched_class->task_new || !current->se.on_rq) {
-		activate_task(rq, p, 0);
-	} else {
-		/*
-		 * Let the scheduling class do new task startup
-		 * management (if any):
-		 */
-		p->sched_class->task_new(rq, p);
-		inc_nr_running(rq);
-	}
+	activate_task(rq, p, 0);
 	trace_sched_wakeup_new(rq, p, 1);
 	check_preempt_curr(rq, p, WF_FORK);
 #ifdef CONFIG_SMP
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 613c1c7..44ec80c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1922,28 +1922,30 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
 }
 
 /*
- * Share the fairness runtime between parent and child, thus the
- * total amount of pressure for CPU stays equal - new tasks
- * get a chance to run but frequent forkers are not allowed to
- * monopolize the CPU. Note: the parent runqueue is locked,
- * the child is not running yet.
+ * called on fork with the child task as argument from the parent's context
+ *  - child not yet on the tasklist
+ *  - preemption disabled
  */
-static void task_new_fair(struct rq *rq, struct task_struct *p)
+static void task_fork_fair(struct task_struct *p)
 {
-	struct cfs_rq *cfs_rq = task_cfs_rq(p);
+	struct cfs_rq *cfs_rq = task_cfs_rq(current);
 	struct sched_entity *se = &p->se, *curr = cfs_rq->curr;
 	int this_cpu = smp_processor_id();
+	struct rq *rq = this_rq();
+	unsigned long flags;
+
+	spin_lock_irqsave(&rq->lock, flags);
 
-	sched_info_queued(p);
+	if (unlikely(task_cpu(p) != this_cpu))
+		__set_task_cpu(p, this_cpu);
 
 	update_curr(cfs_rq);
+
 	if (curr)
 		se->vruntime = curr->vruntime;
 	place_entity(cfs_rq, se, 1);
 
-	/* 'curr' will be NULL if the child belongs to a different group */
-	if (sysctl_sched_child_runs_first && this_cpu == task_cpu(p) &&
-			curr && entity_before(curr, se)) {
+	if (sysctl_sched_child_runs_first && curr && entity_before(curr, se)) {
 		/*
 		 * Upon rescheduling, sched_class::put_prev_task() will place
 		 * 'current' within the tree based on its new key value.
@@ -1952,7 +1954,7 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
 		resched_task(rq->curr);
 	}
 
-	enqueue_task_fair(rq, p, 0);
+	spin_unlock_irqrestore(&rq->lock, flags);
 }
 
 /*
@@ -2052,7 +2054,7 @@ static const struct sched_class fair_sched_class = {
 
 	.set_curr_task          = set_curr_task_fair,
 	.task_tick		= task_tick_fair,
-	.task_new		= task_new_fair,
+	.task_fork		= task_fork_fair,
 
 	.prio_changed		= prio_changed_fair,
 	.switched_to		= switched_to_fair,

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

* [tip:sched/urgent] sched: Clean up check_preempt_wakeup()
       [not found]             ` <new-submission>
                                 ` (459 preceding siblings ...)
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Sanitize fork() handling tip-bot for Peter Zijlstra
@ 2009-12-09  9:54               ` tip-bot for Peter Zijlstra
  2009-12-09  9:55               ` [tip:sched/urgent] sched: Discard some old bits tip-bot for Peter Zijlstra
                                 ` (245 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  3a7e73a2e26fffdbc46ba95fc0425418984f5140
Gitweb:     http://git.kernel.org/tip/3a7e73a2e26fffdbc46ba95fc0425418984f5140
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 28 Nov 2009 18:51:02 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:07 +0100

sched: Clean up check_preempt_wakeup()

Streamline the wakeup preemption code a bit, unifying the preempt path
so that they all do the same.

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 |   73 +++++++++++++++++++++++----------------------------
 1 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 4dec185..76b5792 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1651,10 +1651,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 	int sync = wake_flags & WF_SYNC;
 	int scale = cfs_rq->nr_running >= sched_nr_latency;
 
-	if (unlikely(rt_prio(p->prio))) {
-		resched_task(curr);
-		return;
-	}
+	if (unlikely(rt_prio(p->prio)))
+		goto preempt;
 
 	if (unlikely(p->sched_class != &fair_sched_class))
 		return;
@@ -1680,52 +1678,47 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 		return;
 
 	/* Idle tasks are by definition preempted by everybody. */
-	if (unlikely(curr->policy == SCHED_IDLE)) {
-		resched_task(curr);
-		return;
-	}
+	if (unlikely(curr->policy == SCHED_IDLE))
+		goto preempt;
 
-	if ((sched_feat(WAKEUP_SYNC) && sync) ||
-	    (sched_feat(WAKEUP_OVERLAP) &&
-	     (se->avg_overlap < sysctl_sched_migration_cost &&
-	      pse->avg_overlap < sysctl_sched_migration_cost))) {
-		resched_task(curr);
-		return;
-	}
+	if (sched_feat(WAKEUP_SYNC) && sync)
+		goto preempt;
 
-	if (sched_feat(WAKEUP_RUNNING)) {
-		if (pse->avg_running < se->avg_running) {
-			set_next_buddy(pse);
-			resched_task(curr);
-			return;
-		}
-	}
+	if (sched_feat(WAKEUP_OVERLAP) &&
+			se->avg_overlap < sysctl_sched_migration_cost &&
+			pse->avg_overlap < sysctl_sched_migration_cost)
+		goto preempt;
+
+	if (sched_feat(WAKEUP_RUNNING) && pse->avg_running < se->avg_running)
+		goto preempt;
 
 	if (!sched_feat(WAKEUP_PREEMPT))
 		return;
 
+	update_curr(cfs_rq);
 	find_matching_se(&se, &pse);
-
 	BUG_ON(!pse);
+	if (wakeup_preempt_entity(se, pse) == 1)
+		goto preempt;
 
-	update_curr(cfs_rq);
+	return;
 
-	if (wakeup_preempt_entity(se, pse) == 1) {
-		resched_task(curr);
-		/*
-		 * Only set the backward buddy when the current task is still
-		 * on the rq. This can happen when a wakeup gets interleaved
-		 * with schedule on the ->pre_schedule() or idle_balance()
-		 * point, either of which can * drop the rq lock.
-		 *
-		 * Also, during early boot the idle thread is in the fair class,
-		 * for obvious reasons its a bad idea to schedule back to it.
-		 */
-		if (unlikely(!se->on_rq || curr == rq->idle))
-			return;
-		if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se))
-			set_last_buddy(se);
-	}
+preempt:
+	resched_task(curr);
+	/*
+	 * Only set the backward buddy when the current task is still
+	 * on the rq. This can happen when a wakeup gets interleaved
+	 * with schedule on the ->pre_schedule() or idle_balance()
+	 * point, either of which can * drop the rq lock.
+	 *
+	 * Also, during early boot the idle thread is in the fair class,
+	 * for obvious reasons its a bad idea to schedule back to it.
+	 */
+	if (unlikely(!se->on_rq || curr == rq->idle))
+		return;
+
+	if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se))
+		set_last_buddy(se);
 }
 
 static struct task_struct *pick_next_task_fair(struct rq *rq)

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

* [tip:sched/urgent] sched: Discard some old bits
       [not found]             ` <new-submission>
                                 ` (460 preceding siblings ...)
  2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up check_preempt_wakeup() tip-bot for Peter Zijlstra
@ 2009-12-09  9:55               ` tip-bot for Peter Zijlstra
  2009-12-09  9:55               ` [tip:sched/urgent] sched: Remove unnecessary RCU exclusion tip-bot for Peter Zijlstra
                                 ` (244 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6cecd084d0fd27bb1e498e2829fd45846d806856
Gitweb:     http://git.kernel.org/tip/6cecd084d0fd27bb1e498e2829fd45846d806856
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 30 Nov 2009 13:00:37 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:07 +0100

sched: Discard some old bits

WAKEUP_RUNNING was an experiment, not sure why that ever ended up being
merged...

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h   |    2 --
 kernel/sched.c          |   17 +++++++----------
 kernel/sched_debug.c    |    1 -
 kernel/sched_fair.c     |    3 ---
 kernel/sched_features.h |    5 -----
 5 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 31d9dec..4b1ebd3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1152,8 +1152,6 @@ struct sched_entity {
 	u64			start_runtime;
 	u64			avg_wakeup;
 
-	u64			avg_running;
-
 #ifdef CONFIG_SCHEDSTATS
 	u64			wait_start;
 	u64			wait_max;
diff --git a/kernel/sched.c b/kernel/sched.c
index 33c9035..0170735 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2493,7 +2493,6 @@ static void __sched_fork(struct task_struct *p)
 	p->se.avg_overlap		= 0;
 	p->se.start_runtime		= 0;
 	p->se.avg_wakeup		= sysctl_sched_wakeup_granularity;
-	p->se.avg_running		= 0;
 
 #ifdef CONFIG_SCHEDSTATS
 	p->se.wait_start			= 0;
@@ -5379,13 +5378,14 @@ static inline void schedule_debug(struct task_struct *prev)
 #endif
 }
 
-static void put_prev_task(struct rq *rq, struct task_struct *p)
+static void put_prev_task(struct rq *rq, struct task_struct *prev)
 {
-	u64 runtime = p->se.sum_exec_runtime - p->se.prev_sum_exec_runtime;
+	if (prev->state == TASK_RUNNING) {
+		u64 runtime = prev->se.sum_exec_runtime;
 
-	update_avg(&p->se.avg_running, runtime);
+		runtime -= prev->se.prev_sum_exec_runtime;
+		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
 
-	if (p->state == TASK_RUNNING) {
 		/*
 		 * In order to avoid avg_overlap growing stale when we are
 		 * indeed overlapping and hence not getting put to sleep, grow
@@ -5395,12 +5395,9 @@ static void put_prev_task(struct rq *rq, struct task_struct *p)
 		 * correlates to the amount of cache footprint a task can
 		 * build up.
 		 */
-		runtime = min_t(u64, runtime, 2*sysctl_sched_migration_cost);
-		update_avg(&p->se.avg_overlap, runtime);
-	} else {
-		update_avg(&p->se.avg_running, 0);
+		update_avg(&prev->se.avg_overlap, runtime);
 	}
-	p->sched_class->put_prev_task(rq, p);
+	prev->sched_class->put_prev_task(rq, prev);
 }
 
 /*
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 6988cf0..5fda666 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -399,7 +399,6 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	PN(se.sum_exec_runtime);
 	PN(se.avg_overlap);
 	PN(se.avg_wakeup);
-	PN(se.avg_running);
 
 	nr_switches = p->nvcsw + p->nivcsw;
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 76b5792..e9f5dae 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1689,9 +1689,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 			pse->avg_overlap < sysctl_sched_migration_cost)
 		goto preempt;
 
-	if (sched_feat(WAKEUP_RUNNING) && pse->avg_running < se->avg_running)
-		goto preempt;
-
 	if (!sched_feat(WAKEUP_PREEMPT))
 		return;
 
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 0d94083..d5059fd 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -54,11 +54,6 @@ SCHED_FEAT(WAKEUP_SYNC, 0)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 
 /*
- * Wakeup preemption towards tasks that run short
- */
-SCHED_FEAT(WAKEUP_RUNNING, 0)
-
-/*
  * Use the SYNC wakeup hint, pipes and the likes use this to indicate
  * the remote end is likely to consume the data we just wrote, and
  * therefore has cache benefit from being placed on the same cpu, see

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

* [tip:sched/urgent] sched: Remove unnecessary RCU exclusion
       [not found]             ` <new-submission>
                                 ` (461 preceding siblings ...)
  2009-12-09  9:55               ` [tip:sched/urgent] sched: Discard some old bits tip-bot for Peter Zijlstra
@ 2009-12-09  9:55               ` tip-bot for Peter Zijlstra
  2009-12-10  8:43               ` [tip:sched/urgent] sched: Fix build warning in get_update_sysctl_factor() tip-bot for Mike Galbraith
                                 ` (243 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-09  9:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, npiggin, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  fb58bac5c75bfff8bbf7d02071a10a62f32fe28b
Gitweb:     http://git.kernel.org/tip/fb58bac5c75bfff8bbf7d02071a10a62f32fe28b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 1 Dec 2009 12:21:47 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 10:03:08 +0100

sched: Remove unnecessary RCU exclusion

As Nick pointed out, and realized by myself when doing:
   sched: Fix balance vs hotplug race
the patch:
   sched: for_each_domain() vs RCU

is wrong, sched_domains are freed after synchronize_sched(), which
means disabling preemption is enough.

Reported-by: Nick Piggin <npiggin@suse.de>
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 |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index e9f5dae..c163a28 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1403,7 +1403,6 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 		new_cpu = prev_cpu;
 	}
 
-	rcu_read_lock();
 	for_each_domain(cpu, tmp) {
 		/*
 		 * If power savings logic is enabled for a domain, see if we
@@ -1484,10 +1483,8 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 			update_shares(tmp);
 	}
 
-	if (affine_sd && wake_affine(affine_sd, p, sync)) {
-		new_cpu = cpu;
-		goto out;
-	}
+	if (affine_sd && wake_affine(affine_sd, p, sync))
+		return cpu;
 
 	while (sd) {
 		int load_idx = sd->forkexec_idx;
@@ -1528,8 +1525,6 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 		/* while loop will break here if sd == NULL */
 	}
 
-out:
-	rcu_read_unlock();
 	return new_cpu;
 }
 #endif /* CONFIG_SMP */

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

* [tip:sched/urgent] sched: Fix build warning in get_update_sysctl_factor()
       [not found]             ` <new-submission>
                                 ` (462 preceding siblings ...)
  2009-12-09  9:55               ` [tip:sched/urgent] sched: Remove unnecessary RCU exclusion tip-bot for Peter Zijlstra
@ 2009-12-10  8:43               ` tip-bot for Mike Galbraith
  2009-12-10 19:36               ` [tip:sched/urgent] sched: Remove forced2_migrations stats tip-bot for Ingo Molnar
                                 ` (242 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Mike Galbraith @ 2009-12-10  8:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  4ca3ef71f54655af98b66e8ff308a47a2a580a53
Gitweb:     http://git.kernel.org/tip/4ca3ef71f54655af98b66e8ff308a47a2a580a53
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Thu, 10 Dec 2009 09:25:53 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 10 Dec 2009 09:34:50 +0100

sched: Fix build warning in get_update_sysctl_factor()

Signed-off-by: Mike Galbraith <efault@gmx.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <new-submission>
---
 kernel/sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 0a60e8e..3de3dea 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7033,7 +7033,7 @@ cpumask_var_t nohz_cpu_mask;
  */
 static int get_update_sysctl_factor(void)
 {
-	unsigned int cpus = min(num_online_cpus(), 8);
+	unsigned int cpus = min_t(int, num_online_cpus(), 8);
 	unsigned int factor;
 
 	switch (sysctl_sched_tunable_scaling) {

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

* [tip:sched/urgent] sched: Remove forced2_migrations stats
       [not found]             ` <new-submission>
                                 ` (463 preceding siblings ...)
  2009-12-10  8:43               ` [tip:sched/urgent] sched: Fix build warning in get_update_sysctl_factor() tip-bot for Mike Galbraith
@ 2009-12-10 19:36               ` tip-bot for Ingo Molnar
  2009-12-15  9:27               ` [tip:perf/diff] perf diff: Improve the help text tip-bot for Ingo Molnar
                                 ` (241 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-12-10 19:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  b9889ed1ddeca5a3f3569c8de7354e9e97d803ae
Gitweb:     http://git.kernel.org/tip/b9889ed1ddeca5a3f3569c8de7354e9e97d803ae
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 10 Dec 2009 20:32:39 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 10 Dec 2009 20:32:39 +0100

sched: Remove forced2_migrations stats

This build warning:

 kernel/sched.c: In function 'set_task_cpu':
 kernel/sched.c:2070: warning: unused variable 'old_rq'

Made me realize that the forced2_migrations stat looks pretty
pointless (and a misnomer) - remove it.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h |    1 -
 kernel/sched.c        |    6 ------
 kernel/sched_debug.c  |    2 --
 3 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index ee9f200..87b89a8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1174,7 +1174,6 @@ struct sched_entity {
 	u64			nr_failed_migrations_running;
 	u64			nr_failed_migrations_hot;
 	u64			nr_forced_migrations;
-	u64			nr_forced2_migrations;
 
 	u64			nr_wakeups;
 	u64			nr_wakeups_sync;
diff --git a/kernel/sched.c b/kernel/sched.c
index 36cc05a..bc68037 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2067,7 +2067,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
 void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 {
 	int old_cpu = task_cpu(p);
-	struct rq *old_rq = cpu_rq(old_cpu);
 	struct cfs_rq *old_cfsrq = task_cfs_rq(p),
 		      *new_cfsrq = cpu_cfs_rq(old_cfsrq, new_cpu);
 
@@ -2075,10 +2074,6 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 
 	if (old_cpu != new_cpu) {
 		p->se.nr_migrations++;
-#ifdef CONFIG_SCHEDSTATS
-		if (task_hot(p, old_rq->clock, NULL))
-			schedstat_inc(p, se.nr_forced2_migrations);
-#endif
 		perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS,
 				     1, 1, NULL, 0);
 	}
@@ -2521,7 +2516,6 @@ static void __sched_fork(struct task_struct *p)
 	p->se.nr_failed_migrations_running	= 0;
 	p->se.nr_failed_migrations_hot		= 0;
 	p->se.nr_forced_migrations		= 0;
-	p->se.nr_forced2_migrations		= 0;
 
 	p->se.nr_wakeups			= 0;
 	p->se.nr_wakeups_sync			= 0;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 0fc5287..5ae24fc 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -432,7 +432,6 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 	P(se.nr_failed_migrations_running);
 	P(se.nr_failed_migrations_hot);
 	P(se.nr_forced_migrations);
-	P(se.nr_forced2_migrations);
 	P(se.nr_wakeups);
 	P(se.nr_wakeups_sync);
 	P(se.nr_wakeups_migrate);
@@ -508,7 +507,6 @@ void proc_sched_set_task(struct task_struct *p)
 	p->se.nr_failed_migrations_running	= 0;
 	p->se.nr_failed_migrations_hot		= 0;
 	p->se.nr_forced_migrations		= 0;
-	p->se.nr_forced2_migrations		= 0;
 	p->se.nr_wakeups			= 0;
 	p->se.nr_wakeups_sync			= 0;
 	p->se.nr_wakeups_migrate		= 0;

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

* [tip:perf/diff] perf diff: Improve the help text
       [not found]             ` <new-submission>
                                 ` (464 preceding siblings ...)
  2009-12-10 19:36               ` [tip:sched/urgent] sched: Remove forced2_migrations stats tip-bot for Ingo Molnar
@ 2009-12-15  9:27               ` tip-bot for Ingo Molnar
  2009-12-15 14:30               ` tip-bot for Ingo Molnar
                                 ` (240 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-12-15  9:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  0afd1f750292da52e4b1129be82de9c065275764
Gitweb:     http://git.kernel.org/tip/0afd1f750292da52e4b1129be82de9c065275764
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 15 Dec 2009 10:24:08 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Dec 2009 10:24:08 +0100

perf diff: Improve the help text

Fix the short line displayed by 'perf' and also fix some other
details in the longer text.

Cc: 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: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/Documentation/perf-diff.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index bd1ee55..b7c393b 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -3,7 +3,7 @@ perf-diff(1)
 
 NAME
 ----
-perf-diff - Read perf.data (created by perf record) and display the profile
+perf-diff - Read two perf.data files and display the differential profile
 
 SYNOPSIS
 --------
@@ -12,7 +12,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This command displays the performance difference among two perf.data files
+This command displays the performance difference amongst two perf.data files
 captured via perf record.
 
 If no parameters are passed it will assume perf.data.old and perf.data.
@@ -21,10 +21,10 @@ OPTIONS
 -------
 -p::
 --percentage::
-	Show percentages instead of raw counters
+	Show percentages instead of raw counts
 -v::
 --verbose::
-	Be verbose, for instance, show the raw counters in addition to the
+	Be verbose, for instance, show the raw counts in addition to the
 	diff.
 SEE ALSO
 --------

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

* [tip:perf/diff] perf diff: Improve the help text
       [not found]             ` <new-submission>
                                 ` (465 preceding siblings ...)
  2009-12-15  9:27               ` [tip:perf/diff] perf diff: Improve the help text tip-bot for Ingo Molnar
@ 2009-12-15 14:30               ` tip-bot for Ingo Molnar
  2009-12-28 10:07               ` [tip:perf/core] perf events: Remove arg from perf sched hooks tip-bot for Peter Zijlstra
                                 ` (239 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2009-12-15 14:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  d30531c67210f4c73d0f9661998ceeebb0a230ee
Gitweb:     http://git.kernel.org/tip/d30531c67210f4c73d0f9661998ceeebb0a230ee
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 15 Dec 2009 10:24:08 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 15 Dec 2009 15:26:18 +0100

perf diff: Improve the help text

Fix the short line displayed by 'perf' and also fix some other
details in the longer text.

Cc: 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: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/Documentation/perf-diff.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index bd1ee55..b7c393b 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -3,7 +3,7 @@ perf-diff(1)
 
 NAME
 ----
-perf-diff - Read perf.data (created by perf record) and display the profile
+perf-diff - Read two perf.data files and display the differential profile
 
 SYNOPSIS
 --------
@@ -12,7 +12,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This command displays the performance difference among two perf.data files
+This command displays the performance difference amongst two perf.data files
 captured via perf record.
 
 If no parameters are passed it will assume perf.data.old and perf.data.
@@ -21,10 +21,10 @@ OPTIONS
 -------
 -p::
 --percentage::
-	Show percentages instead of raw counters
+	Show percentages instead of raw counts
 -v::
 --verbose::
-	Be verbose, for instance, show the raw counters in addition to the
+	Be verbose, for instance, show the raw counts in addition to the
 	diff.
 SEE ALSO
 --------

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

* [tip:perf/core] perf events: Remove arg from perf sched hooks
       [not found]             ` <new-submission>
                                 ` (466 preceding siblings ...)
  2009-12-15 14:30               ` tip-bot for Ingo Molnar
@ 2009-12-28 10:07               ` tip-bot for Peter Zijlstra
  2010-01-21 13:52               ` [tip:sched/core] sched: Move load balance code into sched_fair.c tip-bot for Peter Zijlstra
                                 ` (238 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2009-12-28 10:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  49f474331e563a6ecf3b1e87ec27ec5482b3e4f1
Gitweb:     http://git.kernel.org/tip/49f474331e563a6ecf3b1e87ec27ec5482b3e4f1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sun, 27 Dec 2009 11:51:52 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 28 Dec 2009 09:21:33 +0100

perf events: Remove arg from perf sched hooks

Since we only ever schedule the local cpu, there is no need to pass the
cpu number to the perf sched hooks.

This micro-optimizes things a bit.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |   12 ++++++------
 kernel/perf_event.c        |   27 ++++++++++++++-------------
 kernel/sched.c             |    6 +++---
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c66b34f..a494e75 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -746,10 +746,10 @@ extern int perf_max_events;
 
 extern const struct pmu *hw_perf_event_init(struct perf_event *event);
 
-extern void perf_event_task_sched_in(struct task_struct *task, int cpu);
+extern void perf_event_task_sched_in(struct task_struct *task);
 extern void perf_event_task_sched_out(struct task_struct *task,
-					struct task_struct *next, int cpu);
-extern void perf_event_task_tick(struct task_struct *task, int cpu);
+					struct task_struct *next);
+extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
@@ -870,12 +870,12 @@ extern void perf_event_enable(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 #else
 static inline void
-perf_event_task_sched_in(struct task_struct *task, int cpu)		{ }
+perf_event_task_sched_in(struct task_struct *task)			{ }
 static inline void
 perf_event_task_sched_out(struct task_struct *task,
-			    struct task_struct *next, int cpu)		{ }
+			    struct task_struct *next)			{ }
 static inline void
-perf_event_task_tick(struct task_struct *task, int cpu)			{ }
+perf_event_task_tick(struct task_struct *task)				{ }
 static inline int perf_event_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 03cc061..099bd66 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1170,9 +1170,9 @@ static void perf_event_sync_stat(struct perf_event_context *ctx,
  * not restart the event.
  */
 void perf_event_task_sched_out(struct task_struct *task,
-				 struct task_struct *next, int cpu)
+				 struct task_struct *next)
 {
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = task->perf_event_ctxp;
 	struct perf_event_context *next_ctx;
 	struct perf_event_context *parent;
@@ -1252,8 +1252,9 @@ static void perf_event_cpu_sched_out(struct perf_cpu_context *cpuctx)
 
 static void
 __perf_event_sched_in(struct perf_event_context *ctx,
-			struct perf_cpu_context *cpuctx, int cpu)
+			struct perf_cpu_context *cpuctx)
 {
+	int cpu = smp_processor_id();
 	struct perf_event *event;
 	int can_add_hw = 1;
 
@@ -1326,24 +1327,24 @@ __perf_event_sched_in(struct perf_event_context *ctx,
  * accessing the event control register. If a NMI hits, then it will
  * keep the event running.
  */
-void perf_event_task_sched_in(struct task_struct *task, int cpu)
+void perf_event_task_sched_in(struct task_struct *task)
 {
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = task->perf_event_ctxp;
 
 	if (likely(!ctx))
 		return;
 	if (cpuctx->task_ctx == ctx)
 		return;
-	__perf_event_sched_in(ctx, cpuctx, cpu);
+	__perf_event_sched_in(ctx, cpuctx);
 	cpuctx->task_ctx = ctx;
 }
 
-static void perf_event_cpu_sched_in(struct perf_cpu_context *cpuctx, int cpu)
+static void perf_event_cpu_sched_in(struct perf_cpu_context *cpuctx)
 {
 	struct perf_event_context *ctx = &cpuctx->ctx;
 
-	__perf_event_sched_in(ctx, cpuctx, cpu);
+	__perf_event_sched_in(ctx, cpuctx);
 }
 
 #define MAX_INTERRUPTS (~0ULL)
@@ -1461,7 +1462,7 @@ static void rotate_ctx(struct perf_event_context *ctx)
 	raw_spin_unlock(&ctx->lock);
 }
 
-void perf_event_task_tick(struct task_struct *curr, int cpu)
+void perf_event_task_tick(struct task_struct *curr)
 {
 	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx;
@@ -1469,7 +1470,7 @@ void perf_event_task_tick(struct task_struct *curr, int cpu)
 	if (!atomic_read(&nr_events))
 		return;
 
-	cpuctx = &per_cpu(perf_cpu_context, cpu);
+	cpuctx = &__get_cpu_var(perf_cpu_context);
 	ctx = curr->perf_event_ctxp;
 
 	perf_ctx_adjust_freq(&cpuctx->ctx);
@@ -1484,9 +1485,9 @@ void perf_event_task_tick(struct task_struct *curr, int cpu)
 	if (ctx)
 		rotate_ctx(ctx);
 
-	perf_event_cpu_sched_in(cpuctx, cpu);
+	perf_event_cpu_sched_in(cpuctx);
 	if (ctx)
-		perf_event_task_sched_in(curr, cpu);
+		perf_event_task_sched_in(curr);
 }
 
 /*
@@ -1527,7 +1528,7 @@ static void perf_event_enable_on_exec(struct task_struct *task)
 
 	raw_spin_unlock(&ctx->lock);
 
-	perf_event_task_sched_in(task, smp_processor_id());
+	perf_event_task_sched_in(task);
  out:
 	local_irq_restore(flags);
 }
diff --git a/kernel/sched.c b/kernel/sched.c
index 18cceee..d6527ac 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2752,7 +2752,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
 	 */
 	prev_state = prev->state;
 	finish_arch_switch(prev);
-	perf_event_task_sched_in(current, cpu_of(rq));
+	perf_event_task_sched_in(current);
 	finish_lock_switch(rq, prev);
 
 	fire_sched_in_preempt_notifiers(current);
@@ -5266,7 +5266,7 @@ void scheduler_tick(void)
 	curr->sched_class->task_tick(rq, curr, 0);
 	raw_spin_unlock(&rq->lock);
 
-	perf_event_task_tick(curr, cpu);
+	perf_event_task_tick(curr);
 
 #ifdef CONFIG_SMP
 	rq->idle_at_tick = idle_cpu(cpu);
@@ -5480,7 +5480,7 @@ need_resched_nonpreemptible:
 
 	if (likely(prev != next)) {
 		sched_info_switch(prev, next);
-		perf_event_task_sched_out(prev, next, cpu);
+		perf_event_task_sched_out(prev, next);
 
 		rq->nr_switches++;
 		rq->curr = next;

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

* [tip:sched/core] sched: Move load balance code into sched_fair.c
       [not found]             ` <new-submission>
                                 ` (467 preceding siblings ...)
  2009-12-28 10:07               ` [tip:perf/core] perf events: Remove arg from perf sched hooks tip-bot for Peter Zijlstra
@ 2010-01-21 13:52               ` tip-bot for Peter Zijlstra
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove the sched_class load_balance methods tip-bot for Peter Zijlstra
                                 ` (237 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  1e3c88bdeb1260edc341e45c9fb8efd182a5c511
Gitweb:     http://git.kernel.org/tip/1e3c88bdeb1260edc341e45c9fb8efd182a5c511
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 17:00:43 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:08 +0100

sched: Move load balance code into sched_fair.c

Straight fwd code movement.

Since non of the load-balance abstractions are used anymore, do away with
them and simplify the code some. In preparation move the code around.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c      | 1919 +++------------------------------------------------
 kernel/sched_fair.c | 1765 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1844 insertions(+), 1840 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 64298a5..13a2acf 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1805,6 +1805,51 @@ static inline void double_unlock_balance(struct rq *this_rq, struct rq *busiest)
 	raw_spin_unlock(&busiest->lock);
 	lock_set_subclass(&this_rq->lock.dep_map, 0, _RET_IP_);
 }
+
+/*
+ * double_rq_lock - safely lock two runqueues
+ *
+ * Note this does not disable interrupts like task_rq_lock,
+ * you need to do so manually before calling.
+ */
+static void double_rq_lock(struct rq *rq1, struct rq *rq2)
+	__acquires(rq1->lock)
+	__acquires(rq2->lock)
+{
+	BUG_ON(!irqs_disabled());
+	if (rq1 == rq2) {
+		raw_spin_lock(&rq1->lock);
+		__acquire(rq2->lock);	/* Fake it out ;) */
+	} else {
+		if (rq1 < rq2) {
+			raw_spin_lock(&rq1->lock);
+			raw_spin_lock_nested(&rq2->lock, SINGLE_DEPTH_NESTING);
+		} else {
+			raw_spin_lock(&rq2->lock);
+			raw_spin_lock_nested(&rq1->lock, SINGLE_DEPTH_NESTING);
+		}
+	}
+	update_rq_clock(rq1);
+	update_rq_clock(rq2);
+}
+
+/*
+ * double_rq_unlock - safely unlock two runqueues
+ *
+ * Note this does not restore interrupts like task_rq_unlock,
+ * you need to do so manually after calling.
+ */
+static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
+	__releases(rq1->lock)
+	__releases(rq2->lock)
+{
+	raw_spin_unlock(&rq1->lock);
+	if (rq1 != rq2)
+		raw_spin_unlock(&rq2->lock);
+	else
+		__release(rq2->lock);
+}
+
 #endif
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1834,18 +1879,14 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
 #endif
 }
 
-#include "sched_stats.h"
-#include "sched_idletask.c"
-#include "sched_fair.c"
-#include "sched_rt.c"
-#ifdef CONFIG_SCHED_DEBUG
-# include "sched_debug.c"
-#endif
+static const struct sched_class rt_sched_class;
 
 #define sched_class_highest (&rt_sched_class)
 #define for_each_class(class) \
    for (class = sched_class_highest; class; class = class->next)
 
+#include "sched_stats.h"
+
 static void inc_nr_running(struct rq *rq)
 {
 	rq->nr_running++;
@@ -1912,6 +1953,37 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
 }
 
 /*
+ * activate_task - move a task to the runqueue.
+ */
+static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
+{
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible--;
+
+	enqueue_task(rq, p, wakeup);
+	inc_nr_running(rq);
+}
+
+/*
+ * deactivate_task - remove a task from the runqueue.
+ */
+static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
+{
+	if (task_contributes_to_load(p))
+		rq->nr_uninterruptible++;
+
+	dequeue_task(rq, p, sleep);
+	dec_nr_running(rq);
+}
+
+#include "sched_idletask.c"
+#include "sched_fair.c"
+#include "sched_rt.c"
+#ifdef CONFIG_SCHED_DEBUG
+# include "sched_debug.c"
+#endif
+
+/*
  * __normal_prio - return the priority that is based on the static prio
  */
 static inline int __normal_prio(struct task_struct *p)
@@ -1957,30 +2029,6 @@ static int effective_prio(struct task_struct *p)
 	return p->prio;
 }
 
-/*
- * activate_task - move a task to the runqueue.
- */
-static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
-{
-	if (task_contributes_to_load(p))
-		rq->nr_uninterruptible--;
-
-	enqueue_task(rq, p, wakeup);
-	inc_nr_running(rq);
-}
-
-/*
- * deactivate_task - remove a task from the runqueue.
- */
-static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
-{
-	if (task_contributes_to_load(p))
-		rq->nr_uninterruptible++;
-
-	dequeue_task(rq, p, sleep);
-	dec_nr_running(rq);
-}
-
 /**
  * task_curr - is this task currently executing on a CPU?
  * @p: the task in question.
@@ -3088,50 +3136,6 @@ static void update_cpu_load(struct rq *this_rq)
 #ifdef CONFIG_SMP
 
 /*
- * double_rq_lock - safely lock two runqueues
- *
- * Note this does not disable interrupts like task_rq_lock,
- * you need to do so manually before calling.
- */
-static void double_rq_lock(struct rq *rq1, struct rq *rq2)
-	__acquires(rq1->lock)
-	__acquires(rq2->lock)
-{
-	BUG_ON(!irqs_disabled());
-	if (rq1 == rq2) {
-		raw_spin_lock(&rq1->lock);
-		__acquire(rq2->lock);	/* Fake it out ;) */
-	} else {
-		if (rq1 < rq2) {
-			raw_spin_lock(&rq1->lock);
-			raw_spin_lock_nested(&rq2->lock, SINGLE_DEPTH_NESTING);
-		} else {
-			raw_spin_lock(&rq2->lock);
-			raw_spin_lock_nested(&rq1->lock, SINGLE_DEPTH_NESTING);
-		}
-	}
-	update_rq_clock(rq1);
-	update_rq_clock(rq2);
-}
-
-/*
- * double_rq_unlock - safely unlock two runqueues
- *
- * Note this does not restore interrupts like task_rq_unlock,
- * you need to do so manually after calling.
- */
-static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
-	__releases(rq1->lock)
-	__releases(rq2->lock)
-{
-	raw_spin_unlock(&rq1->lock);
-	if (rq1 != rq2)
-		raw_spin_unlock(&rq2->lock);
-	else
-		__release(rq2->lock);
-}
-
-/*
  * sched_exec - execve() is a valuable balancing opportunity, because at
  * this point the task has the smallest effective memory and cache footprint.
  */
@@ -3179,1771 +3183,6 @@ again:
 	task_rq_unlock(rq, &flags);
 }
 
-/*
- * pull_task - move a task from a remote runqueue to the local runqueue.
- * Both runqueues must be locked.
- */
-static void pull_task(struct rq *src_rq, struct task_struct *p,
-		      struct rq *this_rq, int this_cpu)
-{
-	deactivate_task(src_rq, p, 0);
-	set_task_cpu(p, this_cpu);
-	activate_task(this_rq, p, 0);
-	check_preempt_curr(this_rq, p, 0);
-}
-
-/*
- * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
- */
-static
-int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
-		     struct sched_domain *sd, enum cpu_idle_type idle,
-		     int *all_pinned)
-{
-	int tsk_cache_hot = 0;
-	/*
-	 * We do not migrate tasks that are:
-	 * 1) running (obviously), or
-	 * 2) cannot be migrated to this CPU due to cpus_allowed, or
-	 * 3) are cache-hot on their current CPU.
-	 */
-	if (!cpumask_test_cpu(this_cpu, &p->cpus_allowed)) {
-		schedstat_inc(p, se.nr_failed_migrations_affine);
-		return 0;
-	}
-	*all_pinned = 0;
-
-	if (task_running(rq, p)) {
-		schedstat_inc(p, se.nr_failed_migrations_running);
-		return 0;
-	}
-
-	/*
-	 * Aggressive migration if:
-	 * 1) task is cache cold, or
-	 * 2) too many balance attempts have failed.
-	 */
-
-	tsk_cache_hot = task_hot(p, rq->clock, sd);
-	if (!tsk_cache_hot ||
-		sd->nr_balance_failed > sd->cache_nice_tries) {
-#ifdef CONFIG_SCHEDSTATS
-		if (tsk_cache_hot) {
-			schedstat_inc(sd, lb_hot_gained[idle]);
-			schedstat_inc(p, se.nr_forced_migrations);
-		}
-#endif
-		return 1;
-	}
-
-	if (tsk_cache_hot) {
-		schedstat_inc(p, se.nr_failed_migrations_hot);
-		return 0;
-	}
-	return 1;
-}
-
-static unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-	      unsigned long max_load_move, struct sched_domain *sd,
-	      enum cpu_idle_type idle, int *all_pinned,
-	      int *this_best_prio, struct rq_iterator *iterator)
-{
-	int loops = 0, pulled = 0, pinned = 0;
-	struct task_struct *p;
-	long rem_load_move = max_load_move;
-
-	if (max_load_move == 0)
-		goto out;
-
-	pinned = 1;
-
-	/*
-	 * Start the load-balancing iterator:
-	 */
-	p = iterator->start(iterator->arg);
-next:
-	if (!p || loops++ > sysctl_sched_nr_migrate)
-		goto out;
-
-	if ((p->se.load.weight >> 1) > rem_load_move ||
-	    !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-		p = iterator->next(iterator->arg);
-		goto next;
-	}
-
-	pull_task(busiest, p, this_rq, this_cpu);
-	pulled++;
-	rem_load_move -= p->se.load.weight;
-
-#ifdef CONFIG_PREEMPT
-	/*
-	 * NEWIDLE balancing is a source of latency, so preemptible kernels
-	 * will stop after the first task is pulled to minimize the critical
-	 * section.
-	 */
-	if (idle == CPU_NEWLY_IDLE)
-		goto out;
-#endif
-
-	/*
-	 * We only want to steal up to the prescribed amount of weighted load.
-	 */
-	if (rem_load_move > 0) {
-		if (p->prio < *this_best_prio)
-			*this_best_prio = p->prio;
-		p = iterator->next(iterator->arg);
-		goto next;
-	}
-out:
-	/*
-	 * Right now, this is one of only two places pull_task() is called,
-	 * so we can safely collect pull_task() stats here rather than
-	 * inside pull_task().
-	 */
-	schedstat_add(sd, lb_gained[idle], pulled);
-
-	if (all_pinned)
-		*all_pinned = pinned;
-
-	return max_load_move - rem_load_move;
-}
-
-/*
- * move_tasks tries to move up to max_load_move weighted load from busiest to
- * this_rq, as part of a balancing operation within domain "sd".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		      unsigned long max_load_move,
-		      struct sched_domain *sd, enum cpu_idle_type idle,
-		      int *all_pinned)
-{
-	const struct sched_class *class = sched_class_highest;
-	unsigned long total_load_moved = 0;
-	int this_best_prio = this_rq->curr->prio;
-
-	do {
-		total_load_moved +=
-			class->load_balance(this_rq, this_cpu, busiest,
-				max_load_move - total_load_moved,
-				sd, idle, all_pinned, &this_best_prio);
-		class = class->next;
-
-#ifdef CONFIG_PREEMPT
-		/*
-		 * NEWIDLE balancing is a source of latency, so preemptible
-		 * kernels will stop after the first task is pulled to minimize
-		 * the critical section.
-		 */
-		if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
-			break;
-#endif
-	} while (class && max_load_move > total_load_moved);
-
-	return total_load_moved > 0;
-}
-
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		   struct sched_domain *sd, enum cpu_idle_type idle,
-		   struct rq_iterator *iterator)
-{
-	struct task_struct *p = iterator->start(iterator->arg);
-	int pinned = 0;
-
-	while (p) {
-		if (can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-			pull_task(busiest, p, this_rq, this_cpu);
-			/*
-			 * Right now, this is only the second place pull_task()
-			 * is called, so we can safely collect pull_task()
-			 * stats here rather than inside pull_task().
-			 */
-			schedstat_inc(sd, lb_gained[idle]);
-
-			return 1;
-		}
-		p = iterator->next(iterator->arg);
-	}
-
-	return 0;
-}
-
-/*
- * move_one_task tries to move exactly one task from busiest to this_rq, as
- * part of active balancing operations within "domain".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-			 struct sched_domain *sd, enum cpu_idle_type idle)
-{
-	const struct sched_class *class;
-
-	for_each_class(class) {
-		if (class->move_one_task(this_rq, this_cpu, busiest, sd, idle))
-			return 1;
-	}
-
-	return 0;
-}
-/********** Helpers for find_busiest_group ************************/
-/*
- * sd_lb_stats - Structure to store the statistics of a sched_domain
- * 		during load balancing.
- */
-struct sd_lb_stats {
-	struct sched_group *busiest; /* Busiest group in this sd */
-	struct sched_group *this;  /* Local group in this sd */
-	unsigned long total_load;  /* Total load of all groups in sd */
-	unsigned long total_pwr;   /*	Total power of all groups in sd */
-	unsigned long avg_load;	   /* Average load across all groups in sd */
-
-	/** Statistics of this group */
-	unsigned long this_load;
-	unsigned long this_load_per_task;
-	unsigned long this_nr_running;
-
-	/* Statistics of the busiest group */
-	unsigned long max_load;
-	unsigned long busiest_load_per_task;
-	unsigned long busiest_nr_running;
-
-	int group_imb; /* Is there imbalance in this sd */
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-	int power_savings_balance; /* Is powersave balance needed for this sd */
-	struct sched_group *group_min; /* Least loaded group in sd */
-	struct sched_group *group_leader; /* Group which relieves group_min */
-	unsigned long min_load_per_task; /* load_per_task in group_min */
-	unsigned long leader_nr_running; /* Nr running of group_leader */
-	unsigned long min_nr_running; /* Nr running of group_min */
-#endif
-};
-
-/*
- * sg_lb_stats - stats of a sched_group required for load_balancing
- */
-struct sg_lb_stats {
-	unsigned long avg_load; /*Avg load across the CPUs of the group */
-	unsigned long group_load; /* Total load over the CPUs of the group */
-	unsigned long sum_nr_running; /* Nr tasks running in the group */
-	unsigned long sum_weighted_load; /* Weighted load of group's tasks */
-	unsigned long group_capacity;
-	int group_imb; /* Is there an imbalance in the group ? */
-};
-
-/**
- * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
- * @group: The group whose first cpu is to be returned.
- */
-static inline unsigned int group_first_cpu(struct sched_group *group)
-{
-	return cpumask_first(sched_group_cpus(group));
-}
-
-/**
- * get_sd_load_idx - Obtain the load index for a given sched domain.
- * @sd: The sched_domain whose load_idx is to be obtained.
- * @idle: The Idle status of the CPU for whose sd load_icx is obtained.
- */
-static inline int get_sd_load_idx(struct sched_domain *sd,
-					enum cpu_idle_type idle)
-{
-	int load_idx;
-
-	switch (idle) {
-	case CPU_NOT_IDLE:
-		load_idx = sd->busy_idx;
-		break;
-
-	case CPU_NEWLY_IDLE:
-		load_idx = sd->newidle_idx;
-		break;
-	default:
-		load_idx = sd->idle_idx;
-		break;
-	}
-
-	return load_idx;
-}
-
-
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-/**
- * init_sd_power_savings_stats - Initialize power savings statistics for
- * the given sched_domain, during load balancing.
- *
- * @sd: Sched domain whose power-savings statistics are to be initialized.
- * @sds: Variable containing the statistics for sd.
- * @idle: Idle status of the CPU at which we're performing load-balancing.
- */
-static inline void init_sd_power_savings_stats(struct sched_domain *sd,
-	struct sd_lb_stats *sds, enum cpu_idle_type idle)
-{
-	/*
-	 * Busy processors will not participate in power savings
-	 * balance.
-	 */
-	if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
-		sds->power_savings_balance = 0;
-	else {
-		sds->power_savings_balance = 1;
-		sds->min_nr_running = ULONG_MAX;
-		sds->leader_nr_running = 0;
-	}
-}
-
-/**
- * update_sd_power_savings_stats - Update the power saving stats for a
- * sched_domain while performing load balancing.
- *
- * @group: sched_group belonging to the sched_domain under consideration.
- * @sds: Variable containing the statistics of the sched_domain
- * @local_group: Does group contain the CPU for which we're performing
- * 		load balancing ?
- * @sgs: Variable containing the statistics of the group.
- */
-static inline void update_sd_power_savings_stats(struct sched_group *group,
-	struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
-{
-
-	if (!sds->power_savings_balance)
-		return;
-
-	/*
-	 * If the local group is idle or completely loaded
-	 * no need to do power savings balance at this domain
-	 */
-	if (local_group && (sds->this_nr_running >= sgs->group_capacity ||
-				!sds->this_nr_running))
-		sds->power_savings_balance = 0;
-
-	/*
-	 * If a group is already running at full capacity or idle,
-	 * don't include that group in power savings calculations
-	 */
-	if (!sds->power_savings_balance ||
-		sgs->sum_nr_running >= sgs->group_capacity ||
-		!sgs->sum_nr_running)
-		return;
-
-	/*
-	 * Calculate the group which has the least non-idle load.
-	 * This is the group from where we need to pick up the load
-	 * for saving power
-	 */
-	if ((sgs->sum_nr_running < sds->min_nr_running) ||
-	    (sgs->sum_nr_running == sds->min_nr_running &&
-	     group_first_cpu(group) > group_first_cpu(sds->group_min))) {
-		sds->group_min = group;
-		sds->min_nr_running = sgs->sum_nr_running;
-		sds->min_load_per_task = sgs->sum_weighted_load /
-						sgs->sum_nr_running;
-	}
-
-	/*
-	 * Calculate the group which is almost near its
-	 * capacity but still has some space to pick up some load
-	 * from other group and save more power
-	 */
-	if (sgs->sum_nr_running + 1 > sgs->group_capacity)
-		return;
-
-	if (sgs->sum_nr_running > sds->leader_nr_running ||
-	    (sgs->sum_nr_running == sds->leader_nr_running &&
-	     group_first_cpu(group) < group_first_cpu(sds->group_leader))) {
-		sds->group_leader = group;
-		sds->leader_nr_running = sgs->sum_nr_running;
-	}
-}
-
-/**
- * check_power_save_busiest_group - see if there is potential for some power-savings balance
- * @sds: Variable containing the statistics of the sched_domain
- *	under consideration.
- * @this_cpu: Cpu at which we're currently performing load-balancing.
- * @imbalance: Variable to store the imbalance.
- *
- * Description:
- * Check if we have potential to perform some power-savings balance.
- * If yes, set the busiest group to be the least loaded group in the
- * sched_domain, so that it's CPUs can be put to idle.
- *
- * Returns 1 if there is potential to perform power-savings balance.
- * Else returns 0.
- */
-static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
-					int this_cpu, unsigned long *imbalance)
-{
-	if (!sds->power_savings_balance)
-		return 0;
-
-	if (sds->this != sds->group_leader ||
-			sds->group_leader == sds->group_min)
-		return 0;
-
-	*imbalance = sds->min_load_per_task;
-	sds->busiest = sds->group_min;
-
-	return 1;
-
-}
-#else /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
-static inline void init_sd_power_savings_stats(struct sched_domain *sd,
-	struct sd_lb_stats *sds, enum cpu_idle_type idle)
-{
-	return;
-}
-
-static inline void update_sd_power_savings_stats(struct sched_group *group,
-	struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
-{
-	return;
-}
-
-static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
-					int this_cpu, unsigned long *imbalance)
-{
-	return 0;
-}
-#endif /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
-
-
-unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
-{
-	return SCHED_LOAD_SCALE;
-}
-
-unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
-{
-	return default_scale_freq_power(sd, cpu);
-}
-
-unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
-{
-	unsigned long weight = cpumask_weight(sched_domain_span(sd));
-	unsigned long smt_gain = sd->smt_gain;
-
-	smt_gain /= weight;
-
-	return smt_gain;
-}
-
-unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
-{
-	return default_scale_smt_power(sd, cpu);
-}
-
-unsigned long scale_rt_power(int cpu)
-{
-	struct rq *rq = cpu_rq(cpu);
-	u64 total, available;
-
-	sched_avg_update(rq);
-
-	total = sched_avg_period() + (rq->clock - rq->age_stamp);
-	available = total - rq->rt_avg;
-
-	if (unlikely((s64)total < SCHED_LOAD_SCALE))
-		total = SCHED_LOAD_SCALE;
-
-	total >>= SCHED_LOAD_SHIFT;
-
-	return div_u64(available, total);
-}
-
-static void update_cpu_power(struct sched_domain *sd, int cpu)
-{
-	unsigned long weight = cpumask_weight(sched_domain_span(sd));
-	unsigned long power = SCHED_LOAD_SCALE;
-	struct sched_group *sdg = sd->groups;
-
-	if (sched_feat(ARCH_POWER))
-		power *= arch_scale_freq_power(sd, cpu);
-	else
-		power *= default_scale_freq_power(sd, cpu);
-
-	power >>= SCHED_LOAD_SHIFT;
-
-	if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
-		if (sched_feat(ARCH_POWER))
-			power *= arch_scale_smt_power(sd, cpu);
-		else
-			power *= default_scale_smt_power(sd, cpu);
-
-		power >>= SCHED_LOAD_SHIFT;
-	}
-
-	power *= scale_rt_power(cpu);
-	power >>= SCHED_LOAD_SHIFT;
-
-	if (!power)
-		power = 1;
-
-	sdg->cpu_power = power;
-}
-
-static void update_group_power(struct sched_domain *sd, int cpu)
-{
-	struct sched_domain *child = sd->child;
-	struct sched_group *group, *sdg = sd->groups;
-	unsigned long power;
-
-	if (!child) {
-		update_cpu_power(sd, cpu);
-		return;
-	}
-
-	power = 0;
-
-	group = child->groups;
-	do {
-		power += group->cpu_power;
-		group = group->next;
-	} while (group != child->groups);
-
-	sdg->cpu_power = power;
-}
-
-/**
- * update_sg_lb_stats - Update sched_group's statistics for load balancing.
- * @sd: The sched_domain whose statistics are to be updated.
- * @group: sched_group whose statistics are to be updated.
- * @this_cpu: Cpu for which load balance is currently performed.
- * @idle: Idle status of this_cpu
- * @load_idx: Load index of sched_domain of this_cpu for load calc.
- * @sd_idle: Idle status of the sched_domain containing group.
- * @local_group: Does group contain this_cpu.
- * @cpus: Set of cpus considered for load balancing.
- * @balance: Should we balance.
- * @sgs: variable to hold the statistics for this group.
- */
-static inline void update_sg_lb_stats(struct sched_domain *sd,
-			struct sched_group *group, int this_cpu,
-			enum cpu_idle_type idle, int load_idx, int *sd_idle,
-			int local_group, const struct cpumask *cpus,
-			int *balance, struct sg_lb_stats *sgs)
-{
-	unsigned long load, max_cpu_load, min_cpu_load;
-	int i;
-	unsigned int balance_cpu = -1, first_idle_cpu = 0;
-	unsigned long sum_avg_load_per_task;
-	unsigned long avg_load_per_task;
-
-	if (local_group) {
-		balance_cpu = group_first_cpu(group);
-		if (balance_cpu == this_cpu)
-			update_group_power(sd, this_cpu);
-	}
-
-	/* Tally up the load of all CPUs in the group */
-	sum_avg_load_per_task = avg_load_per_task = 0;
-	max_cpu_load = 0;
-	min_cpu_load = ~0UL;
-
-	for_each_cpu_and(i, sched_group_cpus(group), cpus) {
-		struct rq *rq = cpu_rq(i);
-
-		if (*sd_idle && rq->nr_running)
-			*sd_idle = 0;
-
-		/* Bias balancing toward cpus of our domain */
-		if (local_group) {
-			if (idle_cpu(i) && !first_idle_cpu) {
-				first_idle_cpu = 1;
-				balance_cpu = i;
-			}
-
-			load = target_load(i, load_idx);
-		} else {
-			load = source_load(i, load_idx);
-			if (load > max_cpu_load)
-				max_cpu_load = load;
-			if (min_cpu_load > load)
-				min_cpu_load = load;
-		}
-
-		sgs->group_load += load;
-		sgs->sum_nr_running += rq->nr_running;
-		sgs->sum_weighted_load += weighted_cpuload(i);
-
-		sum_avg_load_per_task += cpu_avg_load_per_task(i);
-	}
-
-	/*
-	 * First idle cpu or the first cpu(busiest) in this sched group
-	 * is eligible for doing load balancing at this and above
-	 * domains. In the newly idle case, we will allow all the cpu's
-	 * to do the newly idle load balance.
-	 */
-	if (idle != CPU_NEWLY_IDLE && local_group &&
-	    balance_cpu != this_cpu && balance) {
-		*balance = 0;
-		return;
-	}
-
-	/* Adjust by relative CPU power of the group */
-	sgs->avg_load = (sgs->group_load * SCHED_LOAD_SCALE) / group->cpu_power;
-
-
-	/*
-	 * Consider the group unbalanced when the imbalance is larger
-	 * than the average weight of two tasks.
-	 *
-	 * APZ: with cgroup the avg task weight can vary wildly and
-	 *      might not be a suitable number - should we keep a
-	 *      normalized nr_running number somewhere that negates
-	 *      the hierarchy?
-	 */
-	avg_load_per_task = (sum_avg_load_per_task * SCHED_LOAD_SCALE) /
-		group->cpu_power;
-
-	if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task)
-		sgs->group_imb = 1;
-
-	sgs->group_capacity =
-		DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
-}
-
-/**
- * update_sd_lb_stats - Update sched_group's statistics for load balancing.
- * @sd: sched_domain whose statistics are to be updated.
- * @this_cpu: Cpu for which load balance is currently performed.
- * @idle: Idle status of this_cpu
- * @sd_idle: Idle status of the sched_domain containing group.
- * @cpus: Set of cpus considered for load balancing.
- * @balance: Should we balance.
- * @sds: variable to hold the statistics for this sched_domain.
- */
-static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
-			enum cpu_idle_type idle, int *sd_idle,
-			const struct cpumask *cpus, int *balance,
-			struct sd_lb_stats *sds)
-{
-	struct sched_domain *child = sd->child;
-	struct sched_group *group = sd->groups;
-	struct sg_lb_stats sgs;
-	int load_idx, prefer_sibling = 0;
-
-	if (child && child->flags & SD_PREFER_SIBLING)
-		prefer_sibling = 1;
-
-	init_sd_power_savings_stats(sd, sds, idle);
-	load_idx = get_sd_load_idx(sd, idle);
-
-	do {
-		int local_group;
-
-		local_group = cpumask_test_cpu(this_cpu,
-					       sched_group_cpus(group));
-		memset(&sgs, 0, sizeof(sgs));
-		update_sg_lb_stats(sd, group, this_cpu, idle, load_idx, sd_idle,
-				local_group, cpus, balance, &sgs);
-
-		if (local_group && balance && !(*balance))
-			return;
-
-		sds->total_load += sgs.group_load;
-		sds->total_pwr += group->cpu_power;
-
-		/*
-		 * In case the child domain prefers tasks go to siblings
-		 * first, lower the group capacity to one so that we'll try
-		 * and move all the excess tasks away.
-		 */
-		if (prefer_sibling)
-			sgs.group_capacity = min(sgs.group_capacity, 1UL);
-
-		if (local_group) {
-			sds->this_load = sgs.avg_load;
-			sds->this = group;
-			sds->this_nr_running = sgs.sum_nr_running;
-			sds->this_load_per_task = sgs.sum_weighted_load;
-		} else if (sgs.avg_load > sds->max_load &&
-			   (sgs.sum_nr_running > sgs.group_capacity ||
-				sgs.group_imb)) {
-			sds->max_load = sgs.avg_load;
-			sds->busiest = group;
-			sds->busiest_nr_running = sgs.sum_nr_running;
-			sds->busiest_load_per_task = sgs.sum_weighted_load;
-			sds->group_imb = sgs.group_imb;
-		}
-
-		update_sd_power_savings_stats(group, sds, local_group, &sgs);
-		group = group->next;
-	} while (group != sd->groups);
-}
-
-/**
- * fix_small_imbalance - Calculate the minor imbalance that exists
- *			amongst the groups of a sched_domain, during
- *			load balancing.
- * @sds: Statistics of the sched_domain whose imbalance is to be calculated.
- * @this_cpu: The cpu at whose sched_domain we're performing load-balance.
- * @imbalance: Variable to store the imbalance.
- */
-static inline void fix_small_imbalance(struct sd_lb_stats *sds,
-				int this_cpu, unsigned long *imbalance)
-{
-	unsigned long tmp, pwr_now = 0, pwr_move = 0;
-	unsigned int imbn = 2;
-
-	if (sds->this_nr_running) {
-		sds->this_load_per_task /= sds->this_nr_running;
-		if (sds->busiest_load_per_task >
-				sds->this_load_per_task)
-			imbn = 1;
-	} else
-		sds->this_load_per_task =
-			cpu_avg_load_per_task(this_cpu);
-
-	if (sds->max_load - sds->this_load + sds->busiest_load_per_task >=
-			sds->busiest_load_per_task * imbn) {
-		*imbalance = sds->busiest_load_per_task;
-		return;
-	}
-
-	/*
-	 * OK, we don't have enough imbalance to justify moving tasks,
-	 * however we may be able to increase total CPU power used by
-	 * moving them.
-	 */
-
-	pwr_now += sds->busiest->cpu_power *
-			min(sds->busiest_load_per_task, sds->max_load);
-	pwr_now += sds->this->cpu_power *
-			min(sds->this_load_per_task, sds->this_load);
-	pwr_now /= SCHED_LOAD_SCALE;
-
-	/* Amount of load we'd subtract */
-	tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
-		sds->busiest->cpu_power;
-	if (sds->max_load > tmp)
-		pwr_move += sds->busiest->cpu_power *
-			min(sds->busiest_load_per_task, sds->max_load - tmp);
-
-	/* Amount of load we'd add */
-	if (sds->max_load * sds->busiest->cpu_power <
-		sds->busiest_load_per_task * SCHED_LOAD_SCALE)
-		tmp = (sds->max_load * sds->busiest->cpu_power) /
-			sds->this->cpu_power;
-	else
-		tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
-			sds->this->cpu_power;
-	pwr_move += sds->this->cpu_power *
-			min(sds->this_load_per_task, sds->this_load + tmp);
-	pwr_move /= SCHED_LOAD_SCALE;
-
-	/* Move if we gain throughput */
-	if (pwr_move > pwr_now)
-		*imbalance = sds->busiest_load_per_task;
-}
-
-/**
- * calculate_imbalance - Calculate the amount of imbalance present within the
- *			 groups of a given sched_domain during load balance.
- * @sds: statistics of the sched_domain whose imbalance is to be calculated.
- * @this_cpu: Cpu for which currently load balance is being performed.
- * @imbalance: The variable to store the imbalance.
- */
-static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu,
-		unsigned long *imbalance)
-{
-	unsigned long max_pull;
-	/*
-	 * In the presence of smp nice balancing, certain scenarios can have
-	 * max load less than avg load(as we skip the groups at or below
-	 * its cpu_power, while calculating max_load..)
-	 */
-	if (sds->max_load < sds->avg_load) {
-		*imbalance = 0;
-		return fix_small_imbalance(sds, this_cpu, imbalance);
-	}
-
-	/* Don't want to pull so many tasks that a group would go idle */
-	max_pull = min(sds->max_load - sds->avg_load,
-			sds->max_load - sds->busiest_load_per_task);
-
-	/* How much load to actually move to equalise the imbalance */
-	*imbalance = min(max_pull * sds->busiest->cpu_power,
-		(sds->avg_load - sds->this_load) * sds->this->cpu_power)
-			/ SCHED_LOAD_SCALE;
-
-	/*
-	 * if *imbalance is less than the average load per runnable task
-	 * there is no gaurantee that any tasks will be moved so we'll have
-	 * a think about bumping its value to force at least one task to be
-	 * moved
-	 */
-	if (*imbalance < sds->busiest_load_per_task)
-		return fix_small_imbalance(sds, this_cpu, imbalance);
-
-}
-/******* find_busiest_group() helpers end here *********************/
-
-/**
- * find_busiest_group - Returns the busiest group within the sched_domain
- * if there is an imbalance. If there isn't an imbalance, and
- * the user has opted for power-savings, it returns a group whose
- * CPUs can be put to idle by rebalancing those tasks elsewhere, if
- * such a group exists.
- *
- * Also calculates the amount of weighted load which should be moved
- * to restore balance.
- *
- * @sd: The sched_domain whose busiest group is to be returned.
- * @this_cpu: The cpu for which load balancing is currently being performed.
- * @imbalance: Variable which stores amount of weighted load which should
- *		be moved to restore balance/put a group to idle.
- * @idle: The idle status of this_cpu.
- * @sd_idle: The idleness of sd
- * @cpus: The set of CPUs under consideration for load-balancing.
- * @balance: Pointer to a variable indicating if this_cpu
- *	is the appropriate cpu to perform load balancing at this_level.
- *
- * Returns:	- the busiest group if imbalance exists.
- *		- If no imbalance and user has opted for power-savings balance,
- *		   return the least loaded group whose CPUs can be
- *		   put to idle by rebalancing its tasks onto our group.
- */
-static struct sched_group *
-find_busiest_group(struct sched_domain *sd, int this_cpu,
-		   unsigned long *imbalance, enum cpu_idle_type idle,
-		   int *sd_idle, const struct cpumask *cpus, int *balance)
-{
-	struct sd_lb_stats sds;
-
-	memset(&sds, 0, sizeof(sds));
-
-	/*
-	 * Compute the various statistics relavent for load balancing at
-	 * this level.
-	 */
-	update_sd_lb_stats(sd, this_cpu, idle, sd_idle, cpus,
-					balance, &sds);
-
-	/* Cases where imbalance does not exist from POV of this_cpu */
-	/* 1) this_cpu is not the appropriate cpu to perform load balancing
-	 *    at this level.
-	 * 2) There is no busy sibling group to pull from.
-	 * 3) This group is the busiest group.
-	 * 4) This group is more busy than the avg busieness at this
-	 *    sched_domain.
-	 * 5) The imbalance is within the specified limit.
-	 * 6) Any rebalance would lead to ping-pong
-	 */
-	if (balance && !(*balance))
-		goto ret;
-
-	if (!sds.busiest || sds.busiest_nr_running == 0)
-		goto out_balanced;
-
-	if (sds.this_load >= sds.max_load)
-		goto out_balanced;
-
-	sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr;
-
-	if (sds.this_load >= sds.avg_load)
-		goto out_balanced;
-
-	if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
-		goto out_balanced;
-
-	sds.busiest_load_per_task /= sds.busiest_nr_running;
-	if (sds.group_imb)
-		sds.busiest_load_per_task =
-			min(sds.busiest_load_per_task, sds.avg_load);
-
-	/*
-	 * We're trying to get all the cpus to the average_load, so we don't
-	 * want to push ourselves above the average load, nor do we wish to
-	 * reduce the max loaded cpu below the average load, as either of these
-	 * actions would just result in more rebalancing later, and ping-pong
-	 * tasks around. Thus we look for the minimum possible imbalance.
-	 * Negative imbalances (*we* are more loaded than anyone else) will
-	 * be counted as no imbalance for these purposes -- we can't fix that
-	 * by pulling tasks to us. Be careful of negative numbers as they'll
-	 * appear as very large values with unsigned longs.
-	 */
-	if (sds.max_load <= sds.busiest_load_per_task)
-		goto out_balanced;
-
-	/* Looks like there is an imbalance. Compute it */
-	calculate_imbalance(&sds, this_cpu, imbalance);
-	return sds.busiest;
-
-out_balanced:
-	/*
-	 * There is no obvious imbalance. But check if we can do some balancing
-	 * to save power.
-	 */
-	if (check_power_save_busiest_group(&sds, this_cpu, imbalance))
-		return sds.busiest;
-ret:
-	*imbalance = 0;
-	return NULL;
-}
-
-/*
- * find_busiest_queue - find the busiest runqueue among the cpus in group.
- */
-static struct rq *
-find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
-		   unsigned long imbalance, const struct cpumask *cpus)
-{
-	struct rq *busiest = NULL, *rq;
-	unsigned long max_load = 0;
-	int i;
-
-	for_each_cpu(i, sched_group_cpus(group)) {
-		unsigned long power = power_of(i);
-		unsigned long capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
-		unsigned long wl;
-
-		if (!cpumask_test_cpu(i, cpus))
-			continue;
-
-		rq = cpu_rq(i);
-		wl = weighted_cpuload(i) * SCHED_LOAD_SCALE;
-		wl /= power;
-
-		if (capacity && rq->nr_running == 1 && wl > imbalance)
-			continue;
-
-		if (wl > max_load) {
-			max_load = wl;
-			busiest = rq;
-		}
-	}
-
-	return busiest;
-}
-
-/*
- * Max backoff if we encounter pinned tasks. Pretty arbitrary value, but
- * so long as it is large enough.
- */
-#define MAX_PINNED_INTERVAL	512
-
-/* Working cpumask for load_balance and load_balance_newidle. */
-static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
-
-/*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- */
-static int load_balance(int this_cpu, struct rq *this_rq,
-			struct sched_domain *sd, enum cpu_idle_type idle,
-			int *balance)
-{
-	int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
-	struct sched_group *group;
-	unsigned long imbalance;
-	struct rq *busiest;
-	unsigned long flags;
-	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
-
-	cpumask_copy(cpus, cpu_active_mask);
-
-	/*
-	 * When power savings policy is enabled for the parent domain, idle
-	 * sibling can pick up load irrespective of busy siblings. In this case,
-	 * let the state of idle sibling percolate up as CPU_IDLE, instead of
-	 * portraying it as CPU_NOT_IDLE.
-	 */
-	if (idle != CPU_NOT_IDLE && sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		sd_idle = 1;
-
-	schedstat_inc(sd, lb_count[idle]);
-
-redo:
-	update_shares(sd);
-	group = find_busiest_group(sd, this_cpu, &imbalance, idle, &sd_idle,
-				   cpus, balance);
-
-	if (*balance == 0)
-		goto out_balanced;
-
-	if (!group) {
-		schedstat_inc(sd, lb_nobusyg[idle]);
-		goto out_balanced;
-	}
-
-	busiest = find_busiest_queue(group, idle, imbalance, cpus);
-	if (!busiest) {
-		schedstat_inc(sd, lb_nobusyq[idle]);
-		goto out_balanced;
-	}
-
-	BUG_ON(busiest == this_rq);
-
-	schedstat_add(sd, lb_imbalance[idle], imbalance);
-
-	ld_moved = 0;
-	if (busiest->nr_running > 1) {
-		/*
-		 * Attempt to move tasks. If find_busiest_group has found
-		 * an imbalance but busiest->nr_running <= 1, the group is
-		 * still unbalanced. ld_moved simply stays zero, so it is
-		 * correctly treated as an imbalance.
-		 */
-		local_irq_save(flags);
-		double_rq_lock(this_rq, busiest);
-		ld_moved = move_tasks(this_rq, this_cpu, busiest,
-				      imbalance, sd, idle, &all_pinned);
-		double_rq_unlock(this_rq, busiest);
-		local_irq_restore(flags);
-
-		/*
-		 * some other cpu did the load balance for us.
-		 */
-		if (ld_moved && this_cpu != smp_processor_id())
-			resched_cpu(this_cpu);
-
-		/* All tasks on this runqueue were pinned by CPU affinity */
-		if (unlikely(all_pinned)) {
-			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
-				goto redo;
-			goto out_balanced;
-		}
-	}
-
-	if (!ld_moved) {
-		schedstat_inc(sd, lb_failed[idle]);
-		sd->nr_balance_failed++;
-
-		if (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {
-
-			raw_spin_lock_irqsave(&busiest->lock, flags);
-
-			/* don't kick the migration_thread, if the curr
-			 * task on busiest cpu can't be moved to this_cpu
-			 */
-			if (!cpumask_test_cpu(this_cpu,
-					      &busiest->curr->cpus_allowed)) {
-				raw_spin_unlock_irqrestore(&busiest->lock,
-							    flags);
-				all_pinned = 1;
-				goto out_one_pinned;
-			}
-
-			if (!busiest->active_balance) {
-				busiest->active_balance = 1;
-				busiest->push_cpu = this_cpu;
-				active_balance = 1;
-			}
-			raw_spin_unlock_irqrestore(&busiest->lock, flags);
-			if (active_balance)
-				wake_up_process(busiest->migration_thread);
-
-			/*
-			 * We've kicked active balancing, reset the failure
-			 * counter.
-			 */
-			sd->nr_balance_failed = sd->cache_nice_tries+1;
-		}
-	} else
-		sd->nr_balance_failed = 0;
-
-	if (likely(!active_balance)) {
-		/* We were unbalanced, so reset the balancing interval */
-		sd->balance_interval = sd->min_interval;
-	} else {
-		/*
-		 * If we've begun active balancing, start to back off. This
-		 * case may not be covered by the all_pinned logic if there
-		 * is only 1 task on the busy runqueue (because we don't call
-		 * move_tasks).
-		 */
-		if (sd->balance_interval < sd->max_interval)
-			sd->balance_interval *= 2;
-	}
-
-	if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		ld_moved = -1;
-
-	goto out;
-
-out_balanced:
-	schedstat_inc(sd, lb_balanced[idle]);
-
-	sd->nr_balance_failed = 0;
-
-out_one_pinned:
-	/* tune up the balancing interval */
-	if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
-			(sd->balance_interval < sd->max_interval))
-		sd->balance_interval *= 2;
-
-	if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		ld_moved = -1;
-	else
-		ld_moved = 0;
-out:
-	if (ld_moved)
-		update_shares(sd);
-	return ld_moved;
-}
-
-/*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- *
- * Called from schedule when this_rq is about to become idle (CPU_NEWLY_IDLE).
- * this_rq is locked.
- */
-static int
-load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
-{
-	struct sched_group *group;
-	struct rq *busiest = NULL;
-	unsigned long imbalance;
-	int ld_moved = 0;
-	int sd_idle = 0;
-	int all_pinned = 0;
-	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
-
-	cpumask_copy(cpus, cpu_active_mask);
-
-	/*
-	 * When power savings policy is enabled for the parent domain, idle
-	 * sibling can pick up load irrespective of busy siblings. In this case,
-	 * let the state of idle sibling percolate up as IDLE, instead of
-	 * portraying it as CPU_NOT_IDLE.
-	 */
-	if (sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		sd_idle = 1;
-
-	schedstat_inc(sd, lb_count[CPU_NEWLY_IDLE]);
-redo:
-	update_shares_locked(this_rq, sd);
-	group = find_busiest_group(sd, this_cpu, &imbalance, CPU_NEWLY_IDLE,
-				   &sd_idle, cpus, NULL);
-	if (!group) {
-		schedstat_inc(sd, lb_nobusyg[CPU_NEWLY_IDLE]);
-		goto out_balanced;
-	}
-
-	busiest = find_busiest_queue(group, CPU_NEWLY_IDLE, imbalance, cpus);
-	if (!busiest) {
-		schedstat_inc(sd, lb_nobusyq[CPU_NEWLY_IDLE]);
-		goto out_balanced;
-	}
-
-	BUG_ON(busiest == this_rq);
-
-	schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
-
-	ld_moved = 0;
-	if (busiest->nr_running > 1) {
-		/* Attempt to move tasks */
-		double_lock_balance(this_rq, busiest);
-		/* this_rq->clock is already updated */
-		update_rq_clock(busiest);
-		ld_moved = move_tasks(this_rq, this_cpu, busiest,
-					imbalance, sd, CPU_NEWLY_IDLE,
-					&all_pinned);
-		double_unlock_balance(this_rq, busiest);
-
-		if (unlikely(all_pinned)) {
-			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
-				goto redo;
-		}
-	}
-
-	if (!ld_moved) {
-		int active_balance = 0;
-
-		schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
-		if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-		    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-			return -1;
-
-		if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
-			return -1;
-
-		if (sd->nr_balance_failed++ < 2)
-			return -1;
-
-		/*
-		 * The only task running in a non-idle cpu can be moved to this
-		 * cpu in an attempt to completely freeup the other CPU
-		 * package. The same method used to move task in load_balance()
-		 * have been extended for load_balance_newidle() to speedup
-		 * consolidation at sched_mc=POWERSAVINGS_BALANCE_WAKEUP (2)
-		 *
-		 * The package power saving logic comes from
-		 * find_busiest_group().  If there are no imbalance, then
-		 * f_b_g() will return NULL.  However when sched_mc={1,2} then
-		 * f_b_g() will select a group from which a running task may be
-		 * pulled to this cpu in order to make the other package idle.
-		 * If there is no opportunity to make a package idle and if
-		 * there are no imbalance, then f_b_g() will return NULL and no
-		 * action will be taken in load_balance_newidle().
-		 *
-		 * Under normal task pull operation due to imbalance, there
-		 * will be more than one task in the source run queue and
-		 * move_tasks() will succeed.  ld_moved will be true and this
-		 * active balance code will not be triggered.
-		 */
-
-		/* Lock busiest in correct order while this_rq is held */
-		double_lock_balance(this_rq, busiest);
-
-		/*
-		 * don't kick the migration_thread, if the curr
-		 * task on busiest cpu can't be moved to this_cpu
-		 */
-		if (!cpumask_test_cpu(this_cpu, &busiest->curr->cpus_allowed)) {
-			double_unlock_balance(this_rq, busiest);
-			all_pinned = 1;
-			return ld_moved;
-		}
-
-		if (!busiest->active_balance) {
-			busiest->active_balance = 1;
-			busiest->push_cpu = this_cpu;
-			active_balance = 1;
-		}
-
-		double_unlock_balance(this_rq, busiest);
-		/*
-		 * Should not call ttwu while holding a rq->lock
-		 */
-		raw_spin_unlock(&this_rq->lock);
-		if (active_balance)
-			wake_up_process(busiest->migration_thread);
-		raw_spin_lock(&this_rq->lock);
-
-	} else
-		sd->nr_balance_failed = 0;
-
-	update_shares_locked(this_rq, sd);
-	return ld_moved;
-
-out_balanced:
-	schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
-	if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		return -1;
-	sd->nr_balance_failed = 0;
-
-	return 0;
-}
-
-/*
- * idle_balance is called by schedule() if this_cpu is about to become
- * idle. Attempts to pull tasks from other CPUs.
- */
-static void idle_balance(int this_cpu, struct rq *this_rq)
-{
-	struct sched_domain *sd;
-	int pulled_task = 0;
-	unsigned long next_balance = jiffies + HZ;
-
-	this_rq->idle_stamp = this_rq->clock;
-
-	if (this_rq->avg_idle < sysctl_sched_migration_cost)
-		return;
-
-	for_each_domain(this_cpu, sd) {
-		unsigned long interval;
-
-		if (!(sd->flags & SD_LOAD_BALANCE))
-			continue;
-
-		if (sd->flags & SD_BALANCE_NEWIDLE)
-			/* If we've pulled tasks over stop searching: */
-			pulled_task = load_balance_newidle(this_cpu, this_rq,
-							   sd);
-
-		interval = msecs_to_jiffies(sd->balance_interval);
-		if (time_after(next_balance, sd->last_balance + interval))
-			next_balance = sd->last_balance + interval;
-		if (pulled_task) {
-			this_rq->idle_stamp = 0;
-			break;
-		}
-	}
-	if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
-		/*
-		 * We are going idle. next_balance may be set based on
-		 * a busy processor. So reset next_balance.
-		 */
-		this_rq->next_balance = next_balance;
-	}
-}
-
-/*
- * active_load_balance is run by migration threads. It pushes running tasks
- * off the busiest CPU onto idle CPUs. It requires at least 1 task to be
- * running on each physical CPU where possible, and avoids physical /
- * logical imbalances.
- *
- * Called with busiest_rq locked.
- */
-static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
-{
-	int target_cpu = busiest_rq->push_cpu;
-	struct sched_domain *sd;
-	struct rq *target_rq;
-
-	/* Is there any task to move? */
-	if (busiest_rq->nr_running <= 1)
-		return;
-
-	target_rq = cpu_rq(target_cpu);
-
-	/*
-	 * This condition is "impossible", if it occurs
-	 * we need to fix it. Originally reported by
-	 * Bjorn Helgaas on a 128-cpu setup.
-	 */
-	BUG_ON(busiest_rq == target_rq);
-
-	/* move a task from busiest_rq to target_rq */
-	double_lock_balance(busiest_rq, target_rq);
-	update_rq_clock(busiest_rq);
-	update_rq_clock(target_rq);
-
-	/* Search for an sd spanning us and the target CPU. */
-	for_each_domain(target_cpu, sd) {
-		if ((sd->flags & SD_LOAD_BALANCE) &&
-		    cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
-				break;
-	}
-
-	if (likely(sd)) {
-		schedstat_inc(sd, alb_count);
-
-		if (move_one_task(target_rq, target_cpu, busiest_rq,
-				  sd, CPU_IDLE))
-			schedstat_inc(sd, alb_pushed);
-		else
-			schedstat_inc(sd, alb_failed);
-	}
-	double_unlock_balance(busiest_rq, target_rq);
-}
-
-#ifdef CONFIG_NO_HZ
-static struct {
-	atomic_t load_balancer;
-	cpumask_var_t cpu_mask;
-	cpumask_var_t ilb_grp_nohz_mask;
-} nohz ____cacheline_aligned = {
-	.load_balancer = ATOMIC_INIT(-1),
-};
-
-int get_nohz_load_balancer(void)
-{
-	return atomic_read(&nohz.load_balancer);
-}
-
-#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-/**
- * lowest_flag_domain - Return lowest sched_domain containing flag.
- * @cpu:	The cpu whose lowest level of sched domain is to
- *		be returned.
- * @flag:	The flag to check for the lowest sched_domain
- *		for the given cpu.
- *
- * Returns the lowest sched_domain of a cpu which contains the given flag.
- */
-static inline struct sched_domain *lowest_flag_domain(int cpu, int flag)
-{
-	struct sched_domain *sd;
-
-	for_each_domain(cpu, sd)
-		if (sd && (sd->flags & flag))
-			break;
-
-	return sd;
-}
-
-/**
- * for_each_flag_domain - Iterates over sched_domains containing the flag.
- * @cpu:	The cpu whose domains we're iterating over.
- * @sd:		variable holding the value of the power_savings_sd
- *		for cpu.
- * @flag:	The flag to filter the sched_domains to be iterated.
- *
- * Iterates over all the scheduler domains for a given cpu that has the 'flag'
- * set, starting from the lowest sched_domain to the highest.
- */
-#define for_each_flag_domain(cpu, sd, flag) \
-	for (sd = lowest_flag_domain(cpu, flag); \
-		(sd && (sd->flags & flag)); sd = sd->parent)
-
-/**
- * is_semi_idle_group - Checks if the given sched_group is semi-idle.
- * @ilb_group:	group to be checked for semi-idleness
- *
- * Returns:	1 if the group is semi-idle. 0 otherwise.
- *
- * We define a sched_group to be semi idle if it has atleast one idle-CPU
- * and atleast one non-idle CPU. This helper function checks if the given
- * sched_group is semi-idle or not.
- */
-static inline int is_semi_idle_group(struct sched_group *ilb_group)
-{
-	cpumask_and(nohz.ilb_grp_nohz_mask, nohz.cpu_mask,
-					sched_group_cpus(ilb_group));
-
-	/*
-	 * A sched_group is semi-idle when it has atleast one busy cpu
-	 * and atleast one idle cpu.
-	 */
-	if (cpumask_empty(nohz.ilb_grp_nohz_mask))
-		return 0;
-
-	if (cpumask_equal(nohz.ilb_grp_nohz_mask, sched_group_cpus(ilb_group)))
-		return 0;
-
-	return 1;
-}
-/**
- * find_new_ilb - Finds the optimum idle load balancer for nomination.
- * @cpu:	The cpu which is nominating a new idle_load_balancer.
- *
- * Returns:	Returns the id of the idle load balancer if it exists,
- *		Else, returns >= nr_cpu_ids.
- *
- * This algorithm picks the idle load balancer such that it belongs to a
- * semi-idle powersavings sched_domain. The idea is to try and avoid
- * completely idle packages/cores just for the purpose of idle load balancing
- * when there are other idle cpu's which are better suited for that job.
- */
-static int find_new_ilb(int cpu)
-{
-	struct sched_domain *sd;
-	struct sched_group *ilb_group;
-
-	/*
-	 * Have idle load balancer selection from semi-idle packages only
-	 * when power-aware load balancing is enabled
-	 */
-	if (!(sched_smt_power_savings || sched_mc_power_savings))
-		goto out_done;
-
-	/*
-	 * Optimize for the case when we have no idle CPUs or only one
-	 * idle CPU. Don't walk the sched_domain hierarchy in such cases
-	 */
-	if (cpumask_weight(nohz.cpu_mask) < 2)
-		goto out_done;
-
-	for_each_flag_domain(cpu, sd, SD_POWERSAVINGS_BALANCE) {
-		ilb_group = sd->groups;
-
-		do {
-			if (is_semi_idle_group(ilb_group))
-				return cpumask_first(nohz.ilb_grp_nohz_mask);
-
-			ilb_group = ilb_group->next;
-
-		} while (ilb_group != sd->groups);
-	}
-
-out_done:
-	return cpumask_first(nohz.cpu_mask);
-}
-#else /*  (CONFIG_SCHED_MC || CONFIG_SCHED_SMT) */
-static inline int find_new_ilb(int call_cpu)
-{
-	return cpumask_first(nohz.cpu_mask);
-}
-#endif
-
-/*
- * This routine will try to nominate the ilb (idle load balancing)
- * owner among the cpus whose ticks are stopped. ilb owner will do the idle
- * load balancing on behalf of all those cpus. If all the cpus in the system
- * go into this tickless mode, then there will be no ilb owner (as there is
- * no need for one) and all the cpus will sleep till the next wakeup event
- * arrives...
- *
- * For the ilb owner, tick is not stopped. And this tick will be used
- * for idle load balancing. ilb owner will still be part of
- * nohz.cpu_mask..
- *
- * While stopping the tick, this cpu will become the ilb owner if there
- * is no other owner. And will be the owner till that cpu becomes busy
- * or if all cpus in the system stop their ticks at which point
- * there is no need for ilb owner.
- *
- * When the ilb owner becomes busy, it nominates another owner, during the
- * next busy scheduler_tick()
- */
-int select_nohz_load_balancer(int stop_tick)
-{
-	int cpu = smp_processor_id();
-
-	if (stop_tick) {
-		cpu_rq(cpu)->in_nohz_recently = 1;
-
-		if (!cpu_active(cpu)) {
-			if (atomic_read(&nohz.load_balancer) != cpu)
-				return 0;
-
-			/*
-			 * If we are going offline and still the leader,
-			 * give up!
-			 */
-			if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
-				BUG();
-
-			return 0;
-		}
-
-		cpumask_set_cpu(cpu, nohz.cpu_mask);
-
-		/* time for ilb owner also to sleep */
-		if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
-			if (atomic_read(&nohz.load_balancer) == cpu)
-				atomic_set(&nohz.load_balancer, -1);
-			return 0;
-		}
-
-		if (atomic_read(&nohz.load_balancer) == -1) {
-			/* make me the ilb owner */
-			if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
-				return 1;
-		} else if (atomic_read(&nohz.load_balancer) == cpu) {
-			int new_ilb;
-
-			if (!(sched_smt_power_savings ||
-						sched_mc_power_savings))
-				return 1;
-			/*
-			 * Check to see if there is a more power-efficient
-			 * ilb.
-			 */
-			new_ilb = find_new_ilb(cpu);
-			if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
-				atomic_set(&nohz.load_balancer, -1);
-				resched_cpu(new_ilb);
-				return 0;
-			}
-			return 1;
-		}
-	} else {
-		if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
-			return 0;
-
-		cpumask_clear_cpu(cpu, nohz.cpu_mask);
-
-		if (atomic_read(&nohz.load_balancer) == cpu)
-			if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
-				BUG();
-	}
-	return 0;
-}
-#endif
-
-static DEFINE_SPINLOCK(balancing);
-
-/*
- * It checks each scheduling domain to see if it is due to be balanced,
- * and initiates a balancing operation if so.
- *
- * Balancing parameters are set up in arch_init_sched_domains.
- */
-static void rebalance_domains(int cpu, enum cpu_idle_type idle)
-{
-	int balance = 1;
-	struct rq *rq = cpu_rq(cpu);
-	unsigned long interval;
-	struct sched_domain *sd;
-	/* Earliest time when we have to do rebalance again */
-	unsigned long next_balance = jiffies + 60*HZ;
-	int update_next_balance = 0;
-	int need_serialize;
-
-	for_each_domain(cpu, sd) {
-		if (!(sd->flags & SD_LOAD_BALANCE))
-			continue;
-
-		interval = sd->balance_interval;
-		if (idle != CPU_IDLE)
-			interval *= sd->busy_factor;
-
-		/* scale ms to jiffies */
-		interval = msecs_to_jiffies(interval);
-		if (unlikely(!interval))
-			interval = 1;
-		if (interval > HZ*NR_CPUS/10)
-			interval = HZ*NR_CPUS/10;
-
-		need_serialize = sd->flags & SD_SERIALIZE;
-
-		if (need_serialize) {
-			if (!spin_trylock(&balancing))
-				goto out;
-		}
-
-		if (time_after_eq(jiffies, sd->last_balance + interval)) {
-			if (load_balance(cpu, rq, sd, idle, &balance)) {
-				/*
-				 * We've pulled tasks over so either we're no
-				 * longer idle, or one of our SMT siblings is
-				 * not idle.
-				 */
-				idle = CPU_NOT_IDLE;
-			}
-			sd->last_balance = jiffies;
-		}
-		if (need_serialize)
-			spin_unlock(&balancing);
-out:
-		if (time_after(next_balance, sd->last_balance + interval)) {
-			next_balance = sd->last_balance + interval;
-			update_next_balance = 1;
-		}
-
-		/*
-		 * Stop the load balance at this level. There is another
-		 * CPU in our sched group which is doing load balancing more
-		 * actively.
-		 */
-		if (!balance)
-			break;
-	}
-
-	/*
-	 * next_balance will be updated only when there is a need.
-	 * When the cpu is attached to null domain for ex, it will not be
-	 * updated.
-	 */
-	if (likely(update_next_balance))
-		rq->next_balance = next_balance;
-}
-
-/*
- * run_rebalance_domains is triggered when needed from the scheduler tick.
- * In CONFIG_NO_HZ case, the idle load balance owner will do the
- * rebalancing for all the cpus for whom scheduler ticks are stopped.
- */
-static void run_rebalance_domains(struct softirq_action *h)
-{
-	int this_cpu = smp_processor_id();
-	struct rq *this_rq = cpu_rq(this_cpu);
-	enum cpu_idle_type idle = this_rq->idle_at_tick ?
-						CPU_IDLE : CPU_NOT_IDLE;
-
-	rebalance_domains(this_cpu, idle);
-
-#ifdef CONFIG_NO_HZ
-	/*
-	 * If this cpu is the owner for idle load balancing, then do the
-	 * balancing on behalf of the other idle cpus whose ticks are
-	 * stopped.
-	 */
-	if (this_rq->idle_at_tick &&
-	    atomic_read(&nohz.load_balancer) == this_cpu) {
-		struct rq *rq;
-		int balance_cpu;
-
-		for_each_cpu(balance_cpu, nohz.cpu_mask) {
-			if (balance_cpu == this_cpu)
-				continue;
-
-			/*
-			 * If this cpu gets work to do, stop the load balancing
-			 * work being done for other cpus. Next load
-			 * balancing owner will pick it up.
-			 */
-			if (need_resched())
-				break;
-
-			rebalance_domains(balance_cpu, CPU_IDLE);
-
-			rq = cpu_rq(balance_cpu);
-			if (time_after(this_rq->next_balance, rq->next_balance))
-				this_rq->next_balance = rq->next_balance;
-		}
-	}
-#endif
-}
-
-static inline int on_null_domain(int cpu)
-{
-	return !rcu_dereference(cpu_rq(cpu)->sd);
-}
-
-/*
- * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing.
- *
- * In case of CONFIG_NO_HZ, this is the place where we nominate a new
- * idle load balancing owner or decide to stop the periodic load balancing,
- * if the whole system is idle.
- */
-static inline void trigger_load_balance(struct rq *rq, int cpu)
-{
-#ifdef CONFIG_NO_HZ
-	/*
-	 * If we were in the nohz mode recently and busy at the current
-	 * scheduler tick, then check if we need to nominate new idle
-	 * load balancer.
-	 */
-	if (rq->in_nohz_recently && !rq->idle_at_tick) {
-		rq->in_nohz_recently = 0;
-
-		if (atomic_read(&nohz.load_balancer) == cpu) {
-			cpumask_clear_cpu(cpu, nohz.cpu_mask);
-			atomic_set(&nohz.load_balancer, -1);
-		}
-
-		if (atomic_read(&nohz.load_balancer) == -1) {
-			int ilb = find_new_ilb(cpu);
-
-			if (ilb < nr_cpu_ids)
-				resched_cpu(ilb);
-		}
-	}
-
-	/*
-	 * If this cpu is idle and doing idle load balancing for all the
-	 * cpus with ticks stopped, is it time for that to stop?
-	 */
-	if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) == cpu &&
-	    cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
-		resched_cpu(cpu);
-		return;
-	}
-
-	/*
-	 * If this cpu is idle and the idle load balancing is done by
-	 * someone else, then no need raise the SCHED_SOFTIRQ
-	 */
-	if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) != cpu &&
-	    cpumask_test_cpu(cpu, nohz.cpu_mask))
-		return;
-#endif
-	/* Don't need to rebalance while attached to NULL domain */
-	if (time_after_eq(jiffies, rq->next_balance) &&
-	    likely(!on_null_domain(cpu)))
-		raise_softirq(SCHED_SOFTIRQ);
-}
-
-#else	/* CONFIG_SMP */
-
-/*
- * on UP we do not need to balance between CPUs:
- */
-static inline void idle_balance(int cpu, struct rq *rq)
-{
-}
-
 #endif
 
 DEFINE_PER_CPU(struct kernel_stat, kstat);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 7177860..5116b81 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1952,6 +1952,1762 @@ move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 	return 0;
 }
 
+/*
+ * pull_task - move a task from a remote runqueue to the local runqueue.
+ * Both runqueues must be locked.
+ */
+static void pull_task(struct rq *src_rq, struct task_struct *p,
+		      struct rq *this_rq, int this_cpu)
+{
+	deactivate_task(src_rq, p, 0);
+	set_task_cpu(p, this_cpu);
+	activate_task(this_rq, p, 0);
+	check_preempt_curr(this_rq, p, 0);
+}
+
+/*
+ * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
+ */
+static
+int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
+		     struct sched_domain *sd, enum cpu_idle_type idle,
+		     int *all_pinned)
+{
+	int tsk_cache_hot = 0;
+	/*
+	 * We do not migrate tasks that are:
+	 * 1) running (obviously), or
+	 * 2) cannot be migrated to this CPU due to cpus_allowed, or
+	 * 3) are cache-hot on their current CPU.
+	 */
+	if (!cpumask_test_cpu(this_cpu, &p->cpus_allowed)) {
+		schedstat_inc(p, se.nr_failed_migrations_affine);
+		return 0;
+	}
+	*all_pinned = 0;
+
+	if (task_running(rq, p)) {
+		schedstat_inc(p, se.nr_failed_migrations_running);
+		return 0;
+	}
+
+	/*
+	 * Aggressive migration if:
+	 * 1) task is cache cold, or
+	 * 2) too many balance attempts have failed.
+	 */
+
+	tsk_cache_hot = task_hot(p, rq->clock, sd);
+	if (!tsk_cache_hot ||
+		sd->nr_balance_failed > sd->cache_nice_tries) {
+#ifdef CONFIG_SCHEDSTATS
+		if (tsk_cache_hot) {
+			schedstat_inc(sd, lb_hot_gained[idle]);
+			schedstat_inc(p, se.nr_forced_migrations);
+		}
+#endif
+		return 1;
+	}
+
+	if (tsk_cache_hot) {
+		schedstat_inc(p, se.nr_failed_migrations_hot);
+		return 0;
+	}
+	return 1;
+}
+
+static unsigned long
+balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
+	      unsigned long max_load_move, struct sched_domain *sd,
+	      enum cpu_idle_type idle, int *all_pinned,
+	      int *this_best_prio, struct rq_iterator *iterator)
+{
+	int loops = 0, pulled = 0, pinned = 0;
+	struct task_struct *p;
+	long rem_load_move = max_load_move;
+
+	if (max_load_move == 0)
+		goto out;
+
+	pinned = 1;
+
+	/*
+	 * Start the load-balancing iterator:
+	 */
+	p = iterator->start(iterator->arg);
+next:
+	if (!p || loops++ > sysctl_sched_nr_migrate)
+		goto out;
+
+	if ((p->se.load.weight >> 1) > rem_load_move ||
+	    !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
+		p = iterator->next(iterator->arg);
+		goto next;
+	}
+
+	pull_task(busiest, p, this_rq, this_cpu);
+	pulled++;
+	rem_load_move -= p->se.load.weight;
+
+#ifdef CONFIG_PREEMPT
+	/*
+	 * NEWIDLE balancing is a source of latency, so preemptible kernels
+	 * will stop after the first task is pulled to minimize the critical
+	 * section.
+	 */
+	if (idle == CPU_NEWLY_IDLE)
+		goto out;
+#endif
+
+	/*
+	 * We only want to steal up to the prescribed amount of weighted load.
+	 */
+	if (rem_load_move > 0) {
+		if (p->prio < *this_best_prio)
+			*this_best_prio = p->prio;
+		p = iterator->next(iterator->arg);
+		goto next;
+	}
+out:
+	/*
+	 * Right now, this is one of only two places pull_task() is called,
+	 * so we can safely collect pull_task() stats here rather than
+	 * inside pull_task().
+	 */
+	schedstat_add(sd, lb_gained[idle], pulled);
+
+	if (all_pinned)
+		*all_pinned = pinned;
+
+	return max_load_move - rem_load_move;
+}
+
+/*
+ * move_tasks tries to move up to max_load_move weighted load from busiest to
+ * this_rq, as part of a balancing operation within domain "sd".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		      unsigned long max_load_move,
+		      struct sched_domain *sd, enum cpu_idle_type idle,
+		      int *all_pinned)
+{
+	const struct sched_class *class = sched_class_highest;
+	unsigned long total_load_moved = 0;
+	int this_best_prio = this_rq->curr->prio;
+
+	do {
+		total_load_moved +=
+			class->load_balance(this_rq, this_cpu, busiest,
+				max_load_move - total_load_moved,
+				sd, idle, all_pinned, &this_best_prio);
+		class = class->next;
+
+#ifdef CONFIG_PREEMPT
+		/*
+		 * NEWIDLE balancing is a source of latency, so preemptible
+		 * kernels will stop after the first task is pulled to minimize
+		 * the critical section.
+		 */
+		if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
+			break;
+#endif
+	} while (class && max_load_move > total_load_moved);
+
+	return total_load_moved > 0;
+}
+
+static int
+iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		   struct sched_domain *sd, enum cpu_idle_type idle,
+		   struct rq_iterator *iterator)
+{
+	struct task_struct *p = iterator->start(iterator->arg);
+	int pinned = 0;
+
+	while (p) {
+		if (can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
+			pull_task(busiest, p, this_rq, this_cpu);
+			/*
+			 * Right now, this is only the second place pull_task()
+			 * is called, so we can safely collect pull_task()
+			 * stats here rather than inside pull_task().
+			 */
+			schedstat_inc(sd, lb_gained[idle]);
+
+			return 1;
+		}
+		p = iterator->next(iterator->arg);
+	}
+
+	return 0;
+}
+
+/*
+ * move_one_task tries to move exactly one task from busiest to this_rq, as
+ * part of active balancing operations within "domain".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+			 struct sched_domain *sd, enum cpu_idle_type idle)
+{
+	const struct sched_class *class;
+
+	for_each_class(class) {
+		if (class->move_one_task(this_rq, this_cpu, busiest, sd, idle))
+			return 1;
+	}
+
+	return 0;
+}
+/********** Helpers for find_busiest_group ************************/
+/*
+ * sd_lb_stats - Structure to store the statistics of a sched_domain
+ * 		during load balancing.
+ */
+struct sd_lb_stats {
+	struct sched_group *busiest; /* Busiest group in this sd */
+	struct sched_group *this;  /* Local group in this sd */
+	unsigned long total_load;  /* Total load of all groups in sd */
+	unsigned long total_pwr;   /*	Total power of all groups in sd */
+	unsigned long avg_load;	   /* Average load across all groups in sd */
+
+	/** Statistics of this group */
+	unsigned long this_load;
+	unsigned long this_load_per_task;
+	unsigned long this_nr_running;
+
+	/* Statistics of the busiest group */
+	unsigned long max_load;
+	unsigned long busiest_load_per_task;
+	unsigned long busiest_nr_running;
+
+	int group_imb; /* Is there imbalance in this sd */
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+	int power_savings_balance; /* Is powersave balance needed for this sd */
+	struct sched_group *group_min; /* Least loaded group in sd */
+	struct sched_group *group_leader; /* Group which relieves group_min */
+	unsigned long min_load_per_task; /* load_per_task in group_min */
+	unsigned long leader_nr_running; /* Nr running of group_leader */
+	unsigned long min_nr_running; /* Nr running of group_min */
+#endif
+};
+
+/*
+ * sg_lb_stats - stats of a sched_group required for load_balancing
+ */
+struct sg_lb_stats {
+	unsigned long avg_load; /*Avg load across the CPUs of the group */
+	unsigned long group_load; /* Total load over the CPUs of the group */
+	unsigned long sum_nr_running; /* Nr tasks running in the group */
+	unsigned long sum_weighted_load; /* Weighted load of group's tasks */
+	unsigned long group_capacity;
+	int group_imb; /* Is there an imbalance in the group ? */
+};
+
+/**
+ * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
+ * @group: The group whose first cpu is to be returned.
+ */
+static inline unsigned int group_first_cpu(struct sched_group *group)
+{
+	return cpumask_first(sched_group_cpus(group));
+}
+
+/**
+ * get_sd_load_idx - Obtain the load index for a given sched domain.
+ * @sd: The sched_domain whose load_idx is to be obtained.
+ * @idle: The Idle status of the CPU for whose sd load_icx is obtained.
+ */
+static inline int get_sd_load_idx(struct sched_domain *sd,
+					enum cpu_idle_type idle)
+{
+	int load_idx;
+
+	switch (idle) {
+	case CPU_NOT_IDLE:
+		load_idx = sd->busy_idx;
+		break;
+
+	case CPU_NEWLY_IDLE:
+		load_idx = sd->newidle_idx;
+		break;
+	default:
+		load_idx = sd->idle_idx;
+		break;
+	}
+
+	return load_idx;
+}
+
+
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+/**
+ * init_sd_power_savings_stats - Initialize power savings statistics for
+ * the given sched_domain, during load balancing.
+ *
+ * @sd: Sched domain whose power-savings statistics are to be initialized.
+ * @sds: Variable containing the statistics for sd.
+ * @idle: Idle status of the CPU at which we're performing load-balancing.
+ */
+static inline void init_sd_power_savings_stats(struct sched_domain *sd,
+	struct sd_lb_stats *sds, enum cpu_idle_type idle)
+{
+	/*
+	 * Busy processors will not participate in power savings
+	 * balance.
+	 */
+	if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
+		sds->power_savings_balance = 0;
+	else {
+		sds->power_savings_balance = 1;
+		sds->min_nr_running = ULONG_MAX;
+		sds->leader_nr_running = 0;
+	}
+}
+
+/**
+ * update_sd_power_savings_stats - Update the power saving stats for a
+ * sched_domain while performing load balancing.
+ *
+ * @group: sched_group belonging to the sched_domain under consideration.
+ * @sds: Variable containing the statistics of the sched_domain
+ * @local_group: Does group contain the CPU for which we're performing
+ * 		load balancing ?
+ * @sgs: Variable containing the statistics of the group.
+ */
+static inline void update_sd_power_savings_stats(struct sched_group *group,
+	struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
+{
+
+	if (!sds->power_savings_balance)
+		return;
+
+	/*
+	 * If the local group is idle or completely loaded
+	 * no need to do power savings balance at this domain
+	 */
+	if (local_group && (sds->this_nr_running >= sgs->group_capacity ||
+				!sds->this_nr_running))
+		sds->power_savings_balance = 0;
+
+	/*
+	 * If a group is already running at full capacity or idle,
+	 * don't include that group in power savings calculations
+	 */
+	if (!sds->power_savings_balance ||
+		sgs->sum_nr_running >= sgs->group_capacity ||
+		!sgs->sum_nr_running)
+		return;
+
+	/*
+	 * Calculate the group which has the least non-idle load.
+	 * This is the group from where we need to pick up the load
+	 * for saving power
+	 */
+	if ((sgs->sum_nr_running < sds->min_nr_running) ||
+	    (sgs->sum_nr_running == sds->min_nr_running &&
+	     group_first_cpu(group) > group_first_cpu(sds->group_min))) {
+		sds->group_min = group;
+		sds->min_nr_running = sgs->sum_nr_running;
+		sds->min_load_per_task = sgs->sum_weighted_load /
+						sgs->sum_nr_running;
+	}
+
+	/*
+	 * Calculate the group which is almost near its
+	 * capacity but still has some space to pick up some load
+	 * from other group and save more power
+	 */
+	if (sgs->sum_nr_running + 1 > sgs->group_capacity)
+		return;
+
+	if (sgs->sum_nr_running > sds->leader_nr_running ||
+	    (sgs->sum_nr_running == sds->leader_nr_running &&
+	     group_first_cpu(group) < group_first_cpu(sds->group_leader))) {
+		sds->group_leader = group;
+		sds->leader_nr_running = sgs->sum_nr_running;
+	}
+}
+
+/**
+ * check_power_save_busiest_group - see if there is potential for some power-savings balance
+ * @sds: Variable containing the statistics of the sched_domain
+ *	under consideration.
+ * @this_cpu: Cpu at which we're currently performing load-balancing.
+ * @imbalance: Variable to store the imbalance.
+ *
+ * Description:
+ * Check if we have potential to perform some power-savings balance.
+ * If yes, set the busiest group to be the least loaded group in the
+ * sched_domain, so that it's CPUs can be put to idle.
+ *
+ * Returns 1 if there is potential to perform power-savings balance.
+ * Else returns 0.
+ */
+static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
+					int this_cpu, unsigned long *imbalance)
+{
+	if (!sds->power_savings_balance)
+		return 0;
+
+	if (sds->this != sds->group_leader ||
+			sds->group_leader == sds->group_min)
+		return 0;
+
+	*imbalance = sds->min_load_per_task;
+	sds->busiest = sds->group_min;
+
+	return 1;
+
+}
+#else /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
+static inline void init_sd_power_savings_stats(struct sched_domain *sd,
+	struct sd_lb_stats *sds, enum cpu_idle_type idle)
+{
+	return;
+}
+
+static inline void update_sd_power_savings_stats(struct sched_group *group,
+	struct sd_lb_stats *sds, int local_group, struct sg_lb_stats *sgs)
+{
+	return;
+}
+
+static inline int check_power_save_busiest_group(struct sd_lb_stats *sds,
+					int this_cpu, unsigned long *imbalance)
+{
+	return 0;
+}
+#endif /* CONFIG_SCHED_MC || CONFIG_SCHED_SMT */
+
+
+unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+	return SCHED_LOAD_SCALE;
+}
+
+unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+	return default_scale_freq_power(sd, cpu);
+}
+
+unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+	unsigned long weight = cpumask_weight(sched_domain_span(sd));
+	unsigned long smt_gain = sd->smt_gain;
+
+	smt_gain /= weight;
+
+	return smt_gain;
+}
+
+unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu)
+{
+	return default_scale_smt_power(sd, cpu);
+}
+
+unsigned long scale_rt_power(int cpu)
+{
+	struct rq *rq = cpu_rq(cpu);
+	u64 total, available;
+
+	sched_avg_update(rq);
+
+	total = sched_avg_period() + (rq->clock - rq->age_stamp);
+	available = total - rq->rt_avg;
+
+	if (unlikely((s64)total < SCHED_LOAD_SCALE))
+		total = SCHED_LOAD_SCALE;
+
+	total >>= SCHED_LOAD_SHIFT;
+
+	return div_u64(available, total);
+}
+
+static void update_cpu_power(struct sched_domain *sd, int cpu)
+{
+	unsigned long weight = cpumask_weight(sched_domain_span(sd));
+	unsigned long power = SCHED_LOAD_SCALE;
+	struct sched_group *sdg = sd->groups;
+
+	if (sched_feat(ARCH_POWER))
+		power *= arch_scale_freq_power(sd, cpu);
+	else
+		power *= default_scale_freq_power(sd, cpu);
+
+	power >>= SCHED_LOAD_SHIFT;
+
+	if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
+		if (sched_feat(ARCH_POWER))
+			power *= arch_scale_smt_power(sd, cpu);
+		else
+			power *= default_scale_smt_power(sd, cpu);
+
+		power >>= SCHED_LOAD_SHIFT;
+	}
+
+	power *= scale_rt_power(cpu);
+	power >>= SCHED_LOAD_SHIFT;
+
+	if (!power)
+		power = 1;
+
+	sdg->cpu_power = power;
+}
+
+static void update_group_power(struct sched_domain *sd, int cpu)
+{
+	struct sched_domain *child = sd->child;
+	struct sched_group *group, *sdg = sd->groups;
+	unsigned long power;
+
+	if (!child) {
+		update_cpu_power(sd, cpu);
+		return;
+	}
+
+	power = 0;
+
+	group = child->groups;
+	do {
+		power += group->cpu_power;
+		group = group->next;
+	} while (group != child->groups);
+
+	sdg->cpu_power = power;
+}
+
+/**
+ * update_sg_lb_stats - Update sched_group's statistics for load balancing.
+ * @sd: The sched_domain whose statistics are to be updated.
+ * @group: sched_group whose statistics are to be updated.
+ * @this_cpu: Cpu for which load balance is currently performed.
+ * @idle: Idle status of this_cpu
+ * @load_idx: Load index of sched_domain of this_cpu for load calc.
+ * @sd_idle: Idle status of the sched_domain containing group.
+ * @local_group: Does group contain this_cpu.
+ * @cpus: Set of cpus considered for load balancing.
+ * @balance: Should we balance.
+ * @sgs: variable to hold the statistics for this group.
+ */
+static inline void update_sg_lb_stats(struct sched_domain *sd,
+			struct sched_group *group, int this_cpu,
+			enum cpu_idle_type idle, int load_idx, int *sd_idle,
+			int local_group, const struct cpumask *cpus,
+			int *balance, struct sg_lb_stats *sgs)
+{
+	unsigned long load, max_cpu_load, min_cpu_load;
+	int i;
+	unsigned int balance_cpu = -1, first_idle_cpu = 0;
+	unsigned long sum_avg_load_per_task;
+	unsigned long avg_load_per_task;
+
+	if (local_group) {
+		balance_cpu = group_first_cpu(group);
+		if (balance_cpu == this_cpu)
+			update_group_power(sd, this_cpu);
+	}
+
+	/* Tally up the load of all CPUs in the group */
+	sum_avg_load_per_task = avg_load_per_task = 0;
+	max_cpu_load = 0;
+	min_cpu_load = ~0UL;
+
+	for_each_cpu_and(i, sched_group_cpus(group), cpus) {
+		struct rq *rq = cpu_rq(i);
+
+		if (*sd_idle && rq->nr_running)
+			*sd_idle = 0;
+
+		/* Bias balancing toward cpus of our domain */
+		if (local_group) {
+			if (idle_cpu(i) && !first_idle_cpu) {
+				first_idle_cpu = 1;
+				balance_cpu = i;
+			}
+
+			load = target_load(i, load_idx);
+		} else {
+			load = source_load(i, load_idx);
+			if (load > max_cpu_load)
+				max_cpu_load = load;
+			if (min_cpu_load > load)
+				min_cpu_load = load;
+		}
+
+		sgs->group_load += load;
+		sgs->sum_nr_running += rq->nr_running;
+		sgs->sum_weighted_load += weighted_cpuload(i);
+
+		sum_avg_load_per_task += cpu_avg_load_per_task(i);
+	}
+
+	/*
+	 * First idle cpu or the first cpu(busiest) in this sched group
+	 * is eligible for doing load balancing at this and above
+	 * domains. In the newly idle case, we will allow all the cpu's
+	 * to do the newly idle load balance.
+	 */
+	if (idle != CPU_NEWLY_IDLE && local_group &&
+	    balance_cpu != this_cpu && balance) {
+		*balance = 0;
+		return;
+	}
+
+	/* Adjust by relative CPU power of the group */
+	sgs->avg_load = (sgs->group_load * SCHED_LOAD_SCALE) / group->cpu_power;
+
+
+	/*
+	 * Consider the group unbalanced when the imbalance is larger
+	 * than the average weight of two tasks.
+	 *
+	 * APZ: with cgroup the avg task weight can vary wildly and
+	 *      might not be a suitable number - should we keep a
+	 *      normalized nr_running number somewhere that negates
+	 *      the hierarchy?
+	 */
+	avg_load_per_task = (sum_avg_load_per_task * SCHED_LOAD_SCALE) /
+		group->cpu_power;
+
+	if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task)
+		sgs->group_imb = 1;
+
+	sgs->group_capacity =
+		DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
+}
+
+/**
+ * update_sd_lb_stats - Update sched_group's statistics for load balancing.
+ * @sd: sched_domain whose statistics are to be updated.
+ * @this_cpu: Cpu for which load balance is currently performed.
+ * @idle: Idle status of this_cpu
+ * @sd_idle: Idle status of the sched_domain containing group.
+ * @cpus: Set of cpus considered for load balancing.
+ * @balance: Should we balance.
+ * @sds: variable to hold the statistics for this sched_domain.
+ */
+static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
+			enum cpu_idle_type idle, int *sd_idle,
+			const struct cpumask *cpus, int *balance,
+			struct sd_lb_stats *sds)
+{
+	struct sched_domain *child = sd->child;
+	struct sched_group *group = sd->groups;
+	struct sg_lb_stats sgs;
+	int load_idx, prefer_sibling = 0;
+
+	if (child && child->flags & SD_PREFER_SIBLING)
+		prefer_sibling = 1;
+
+	init_sd_power_savings_stats(sd, sds, idle);
+	load_idx = get_sd_load_idx(sd, idle);
+
+	do {
+		int local_group;
+
+		local_group = cpumask_test_cpu(this_cpu,
+					       sched_group_cpus(group));
+		memset(&sgs, 0, sizeof(sgs));
+		update_sg_lb_stats(sd, group, this_cpu, idle, load_idx, sd_idle,
+				local_group, cpus, balance, &sgs);
+
+		if (local_group && balance && !(*balance))
+			return;
+
+		sds->total_load += sgs.group_load;
+		sds->total_pwr += group->cpu_power;
+
+		/*
+		 * In case the child domain prefers tasks go to siblings
+		 * first, lower the group capacity to one so that we'll try
+		 * and move all the excess tasks away.
+		 */
+		if (prefer_sibling)
+			sgs.group_capacity = min(sgs.group_capacity, 1UL);
+
+		if (local_group) {
+			sds->this_load = sgs.avg_load;
+			sds->this = group;
+			sds->this_nr_running = sgs.sum_nr_running;
+			sds->this_load_per_task = sgs.sum_weighted_load;
+		} else if (sgs.avg_load > sds->max_load &&
+			   (sgs.sum_nr_running > sgs.group_capacity ||
+				sgs.group_imb)) {
+			sds->max_load = sgs.avg_load;
+			sds->busiest = group;
+			sds->busiest_nr_running = sgs.sum_nr_running;
+			sds->busiest_load_per_task = sgs.sum_weighted_load;
+			sds->group_imb = sgs.group_imb;
+		}
+
+		update_sd_power_savings_stats(group, sds, local_group, &sgs);
+		group = group->next;
+	} while (group != sd->groups);
+}
+
+/**
+ * fix_small_imbalance - Calculate the minor imbalance that exists
+ *			amongst the groups of a sched_domain, during
+ *			load balancing.
+ * @sds: Statistics of the sched_domain whose imbalance is to be calculated.
+ * @this_cpu: The cpu at whose sched_domain we're performing load-balance.
+ * @imbalance: Variable to store the imbalance.
+ */
+static inline void fix_small_imbalance(struct sd_lb_stats *sds,
+				int this_cpu, unsigned long *imbalance)
+{
+	unsigned long tmp, pwr_now = 0, pwr_move = 0;
+	unsigned int imbn = 2;
+
+	if (sds->this_nr_running) {
+		sds->this_load_per_task /= sds->this_nr_running;
+		if (sds->busiest_load_per_task >
+				sds->this_load_per_task)
+			imbn = 1;
+	} else
+		sds->this_load_per_task =
+			cpu_avg_load_per_task(this_cpu);
+
+	if (sds->max_load - sds->this_load + sds->busiest_load_per_task >=
+			sds->busiest_load_per_task * imbn) {
+		*imbalance = sds->busiest_load_per_task;
+		return;
+	}
+
+	/*
+	 * OK, we don't have enough imbalance to justify moving tasks,
+	 * however we may be able to increase total CPU power used by
+	 * moving them.
+	 */
+
+	pwr_now += sds->busiest->cpu_power *
+			min(sds->busiest_load_per_task, sds->max_load);
+	pwr_now += sds->this->cpu_power *
+			min(sds->this_load_per_task, sds->this_load);
+	pwr_now /= SCHED_LOAD_SCALE;
+
+	/* Amount of load we'd subtract */
+	tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
+		sds->busiest->cpu_power;
+	if (sds->max_load > tmp)
+		pwr_move += sds->busiest->cpu_power *
+			min(sds->busiest_load_per_task, sds->max_load - tmp);
+
+	/* Amount of load we'd add */
+	if (sds->max_load * sds->busiest->cpu_power <
+		sds->busiest_load_per_task * SCHED_LOAD_SCALE)
+		tmp = (sds->max_load * sds->busiest->cpu_power) /
+			sds->this->cpu_power;
+	else
+		tmp = (sds->busiest_load_per_task * SCHED_LOAD_SCALE) /
+			sds->this->cpu_power;
+	pwr_move += sds->this->cpu_power *
+			min(sds->this_load_per_task, sds->this_load + tmp);
+	pwr_move /= SCHED_LOAD_SCALE;
+
+	/* Move if we gain throughput */
+	if (pwr_move > pwr_now)
+		*imbalance = sds->busiest_load_per_task;
+}
+
+/**
+ * calculate_imbalance - Calculate the amount of imbalance present within the
+ *			 groups of a given sched_domain during load balance.
+ * @sds: statistics of the sched_domain whose imbalance is to be calculated.
+ * @this_cpu: Cpu for which currently load balance is being performed.
+ * @imbalance: The variable to store the imbalance.
+ */
+static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu,
+		unsigned long *imbalance)
+{
+	unsigned long max_pull;
+	/*
+	 * In the presence of smp nice balancing, certain scenarios can have
+	 * max load less than avg load(as we skip the groups at or below
+	 * its cpu_power, while calculating max_load..)
+	 */
+	if (sds->max_load < sds->avg_load) {
+		*imbalance = 0;
+		return fix_small_imbalance(sds, this_cpu, imbalance);
+	}
+
+	/* Don't want to pull so many tasks that a group would go idle */
+	max_pull = min(sds->max_load - sds->avg_load,
+			sds->max_load - sds->busiest_load_per_task);
+
+	/* How much load to actually move to equalise the imbalance */
+	*imbalance = min(max_pull * sds->busiest->cpu_power,
+		(sds->avg_load - sds->this_load) * sds->this->cpu_power)
+			/ SCHED_LOAD_SCALE;
+
+	/*
+	 * if *imbalance is less than the average load per runnable task
+	 * there is no gaurantee that any tasks will be moved so we'll have
+	 * a think about bumping its value to force at least one task to be
+	 * moved
+	 */
+	if (*imbalance < sds->busiest_load_per_task)
+		return fix_small_imbalance(sds, this_cpu, imbalance);
+
+}
+/******* find_busiest_group() helpers end here *********************/
+
+/**
+ * find_busiest_group - Returns the busiest group within the sched_domain
+ * if there is an imbalance. If there isn't an imbalance, and
+ * the user has opted for power-savings, it returns a group whose
+ * CPUs can be put to idle by rebalancing those tasks elsewhere, if
+ * such a group exists.
+ *
+ * Also calculates the amount of weighted load which should be moved
+ * to restore balance.
+ *
+ * @sd: The sched_domain whose busiest group is to be returned.
+ * @this_cpu: The cpu for which load balancing is currently being performed.
+ * @imbalance: Variable which stores amount of weighted load which should
+ *		be moved to restore balance/put a group to idle.
+ * @idle: The idle status of this_cpu.
+ * @sd_idle: The idleness of sd
+ * @cpus: The set of CPUs under consideration for load-balancing.
+ * @balance: Pointer to a variable indicating if this_cpu
+ *	is the appropriate cpu to perform load balancing at this_level.
+ *
+ * Returns:	- the busiest group if imbalance exists.
+ *		- If no imbalance and user has opted for power-savings balance,
+ *		   return the least loaded group whose CPUs can be
+ *		   put to idle by rebalancing its tasks onto our group.
+ */
+static struct sched_group *
+find_busiest_group(struct sched_domain *sd, int this_cpu,
+		   unsigned long *imbalance, enum cpu_idle_type idle,
+		   int *sd_idle, const struct cpumask *cpus, int *balance)
+{
+	struct sd_lb_stats sds;
+
+	memset(&sds, 0, sizeof(sds));
+
+	/*
+	 * Compute the various statistics relavent for load balancing at
+	 * this level.
+	 */
+	update_sd_lb_stats(sd, this_cpu, idle, sd_idle, cpus,
+					balance, &sds);
+
+	/* Cases where imbalance does not exist from POV of this_cpu */
+	/* 1) this_cpu is not the appropriate cpu to perform load balancing
+	 *    at this level.
+	 * 2) There is no busy sibling group to pull from.
+	 * 3) This group is the busiest group.
+	 * 4) This group is more busy than the avg busieness at this
+	 *    sched_domain.
+	 * 5) The imbalance is within the specified limit.
+	 * 6) Any rebalance would lead to ping-pong
+	 */
+	if (balance && !(*balance))
+		goto ret;
+
+	if (!sds.busiest || sds.busiest_nr_running == 0)
+		goto out_balanced;
+
+	if (sds.this_load >= sds.max_load)
+		goto out_balanced;
+
+	sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr;
+
+	if (sds.this_load >= sds.avg_load)
+		goto out_balanced;
+
+	if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
+		goto out_balanced;
+
+	sds.busiest_load_per_task /= sds.busiest_nr_running;
+	if (sds.group_imb)
+		sds.busiest_load_per_task =
+			min(sds.busiest_load_per_task, sds.avg_load);
+
+	/*
+	 * We're trying to get all the cpus to the average_load, so we don't
+	 * want to push ourselves above the average load, nor do we wish to
+	 * reduce the max loaded cpu below the average load, as either of these
+	 * actions would just result in more rebalancing later, and ping-pong
+	 * tasks around. Thus we look for the minimum possible imbalance.
+	 * Negative imbalances (*we* are more loaded than anyone else) will
+	 * be counted as no imbalance for these purposes -- we can't fix that
+	 * by pulling tasks to us. Be careful of negative numbers as they'll
+	 * appear as very large values with unsigned longs.
+	 */
+	if (sds.max_load <= sds.busiest_load_per_task)
+		goto out_balanced;
+
+	/* Looks like there is an imbalance. Compute it */
+	calculate_imbalance(&sds, this_cpu, imbalance);
+	return sds.busiest;
+
+out_balanced:
+	/*
+	 * There is no obvious imbalance. But check if we can do some balancing
+	 * to save power.
+	 */
+	if (check_power_save_busiest_group(&sds, this_cpu, imbalance))
+		return sds.busiest;
+ret:
+	*imbalance = 0;
+	return NULL;
+}
+
+/*
+ * find_busiest_queue - find the busiest runqueue among the cpus in group.
+ */
+static struct rq *
+find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
+		   unsigned long imbalance, const struct cpumask *cpus)
+{
+	struct rq *busiest = NULL, *rq;
+	unsigned long max_load = 0;
+	int i;
+
+	for_each_cpu(i, sched_group_cpus(group)) {
+		unsigned long power = power_of(i);
+		unsigned long capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
+		unsigned long wl;
+
+		if (!cpumask_test_cpu(i, cpus))
+			continue;
+
+		rq = cpu_rq(i);
+		wl = weighted_cpuload(i) * SCHED_LOAD_SCALE;
+		wl /= power;
+
+		if (capacity && rq->nr_running == 1 && wl > imbalance)
+			continue;
+
+		if (wl > max_load) {
+			max_load = wl;
+			busiest = rq;
+		}
+	}
+
+	return busiest;
+}
+
+/*
+ * Max backoff if we encounter pinned tasks. Pretty arbitrary value, but
+ * so long as it is large enough.
+ */
+#define MAX_PINNED_INTERVAL	512
+
+/* Working cpumask for load_balance and load_balance_newidle. */
+static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
+
+/*
+ * Check this_cpu to ensure it is balanced within domain. Attempt to move
+ * tasks if there is an imbalance.
+ */
+static int load_balance(int this_cpu, struct rq *this_rq,
+			struct sched_domain *sd, enum cpu_idle_type idle,
+			int *balance)
+{
+	int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
+	struct sched_group *group;
+	unsigned long imbalance;
+	struct rq *busiest;
+	unsigned long flags;
+	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
+
+	cpumask_copy(cpus, cpu_active_mask);
+
+	/*
+	 * When power savings policy is enabled for the parent domain, idle
+	 * sibling can pick up load irrespective of busy siblings. In this case,
+	 * let the state of idle sibling percolate up as CPU_IDLE, instead of
+	 * portraying it as CPU_NOT_IDLE.
+	 */
+	if (idle != CPU_NOT_IDLE && sd->flags & SD_SHARE_CPUPOWER &&
+	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+		sd_idle = 1;
+
+	schedstat_inc(sd, lb_count[idle]);
+
+redo:
+	update_shares(sd);
+	group = find_busiest_group(sd, this_cpu, &imbalance, idle, &sd_idle,
+				   cpus, balance);
+
+	if (*balance == 0)
+		goto out_balanced;
+
+	if (!group) {
+		schedstat_inc(sd, lb_nobusyg[idle]);
+		goto out_balanced;
+	}
+
+	busiest = find_busiest_queue(group, idle, imbalance, cpus);
+	if (!busiest) {
+		schedstat_inc(sd, lb_nobusyq[idle]);
+		goto out_balanced;
+	}
+
+	BUG_ON(busiest == this_rq);
+
+	schedstat_add(sd, lb_imbalance[idle], imbalance);
+
+	ld_moved = 0;
+	if (busiest->nr_running > 1) {
+		/*
+		 * Attempt to move tasks. If find_busiest_group has found
+		 * an imbalance but busiest->nr_running <= 1, the group is
+		 * still unbalanced. ld_moved simply stays zero, so it is
+		 * correctly treated as an imbalance.
+		 */
+		local_irq_save(flags);
+		double_rq_lock(this_rq, busiest);
+		ld_moved = move_tasks(this_rq, this_cpu, busiest,
+				      imbalance, sd, idle, &all_pinned);
+		double_rq_unlock(this_rq, busiest);
+		local_irq_restore(flags);
+
+		/*
+		 * some other cpu did the load balance for us.
+		 */
+		if (ld_moved && this_cpu != smp_processor_id())
+			resched_cpu(this_cpu);
+
+		/* All tasks on this runqueue were pinned by CPU affinity */
+		if (unlikely(all_pinned)) {
+			cpumask_clear_cpu(cpu_of(busiest), cpus);
+			if (!cpumask_empty(cpus))
+				goto redo;
+			goto out_balanced;
+		}
+	}
+
+	if (!ld_moved) {
+		schedstat_inc(sd, lb_failed[idle]);
+		sd->nr_balance_failed++;
+
+		if (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {
+
+			raw_spin_lock_irqsave(&busiest->lock, flags);
+
+			/* don't kick the migration_thread, if the curr
+			 * task on busiest cpu can't be moved to this_cpu
+			 */
+			if (!cpumask_test_cpu(this_cpu,
+					      &busiest->curr->cpus_allowed)) {
+				raw_spin_unlock_irqrestore(&busiest->lock,
+							    flags);
+				all_pinned = 1;
+				goto out_one_pinned;
+			}
+
+			if (!busiest->active_balance) {
+				busiest->active_balance = 1;
+				busiest->push_cpu = this_cpu;
+				active_balance = 1;
+			}
+			raw_spin_unlock_irqrestore(&busiest->lock, flags);
+			if (active_balance)
+				wake_up_process(busiest->migration_thread);
+
+			/*
+			 * We've kicked active balancing, reset the failure
+			 * counter.
+			 */
+			sd->nr_balance_failed = sd->cache_nice_tries+1;
+		}
+	} else
+		sd->nr_balance_failed = 0;
+
+	if (likely(!active_balance)) {
+		/* We were unbalanced, so reset the balancing interval */
+		sd->balance_interval = sd->min_interval;
+	} else {
+		/*
+		 * If we've begun active balancing, start to back off. This
+		 * case may not be covered by the all_pinned logic if there
+		 * is only 1 task on the busy runqueue (because we don't call
+		 * move_tasks).
+		 */
+		if (sd->balance_interval < sd->max_interval)
+			sd->balance_interval *= 2;
+	}
+
+	if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+		ld_moved = -1;
+
+	goto out;
+
+out_balanced:
+	schedstat_inc(sd, lb_balanced[idle]);
+
+	sd->nr_balance_failed = 0;
+
+out_one_pinned:
+	/* tune up the balancing interval */
+	if ((all_pinned && sd->balance_interval < MAX_PINNED_INTERVAL) ||
+			(sd->balance_interval < sd->max_interval))
+		sd->balance_interval *= 2;
+
+	if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+		ld_moved = -1;
+	else
+		ld_moved = 0;
+out:
+	if (ld_moved)
+		update_shares(sd);
+	return ld_moved;
+}
+
+/*
+ * Check this_cpu to ensure it is balanced within domain. Attempt to move
+ * tasks if there is an imbalance.
+ *
+ * Called from schedule when this_rq is about to become idle (CPU_NEWLY_IDLE).
+ * this_rq is locked.
+ */
+static int
+load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
+{
+	struct sched_group *group;
+	struct rq *busiest = NULL;
+	unsigned long imbalance;
+	int ld_moved = 0;
+	int sd_idle = 0;
+	int all_pinned = 0;
+	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
+
+	cpumask_copy(cpus, cpu_active_mask);
+
+	/*
+	 * When power savings policy is enabled for the parent domain, idle
+	 * sibling can pick up load irrespective of busy siblings. In this case,
+	 * let the state of idle sibling percolate up as IDLE, instead of
+	 * portraying it as CPU_NOT_IDLE.
+	 */
+	if (sd->flags & SD_SHARE_CPUPOWER &&
+	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+		sd_idle = 1;
+
+	schedstat_inc(sd, lb_count[CPU_NEWLY_IDLE]);
+redo:
+	update_shares_locked(this_rq, sd);
+	group = find_busiest_group(sd, this_cpu, &imbalance, CPU_NEWLY_IDLE,
+				   &sd_idle, cpus, NULL);
+	if (!group) {
+		schedstat_inc(sd, lb_nobusyg[CPU_NEWLY_IDLE]);
+		goto out_balanced;
+	}
+
+	busiest = find_busiest_queue(group, CPU_NEWLY_IDLE, imbalance, cpus);
+	if (!busiest) {
+		schedstat_inc(sd, lb_nobusyq[CPU_NEWLY_IDLE]);
+		goto out_balanced;
+	}
+
+	BUG_ON(busiest == this_rq);
+
+	schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
+
+	ld_moved = 0;
+	if (busiest->nr_running > 1) {
+		/* Attempt to move tasks */
+		double_lock_balance(this_rq, busiest);
+		/* this_rq->clock is already updated */
+		update_rq_clock(busiest);
+		ld_moved = move_tasks(this_rq, this_cpu, busiest,
+					imbalance, sd, CPU_NEWLY_IDLE,
+					&all_pinned);
+		double_unlock_balance(this_rq, busiest);
+
+		if (unlikely(all_pinned)) {
+			cpumask_clear_cpu(cpu_of(busiest), cpus);
+			if (!cpumask_empty(cpus))
+				goto redo;
+		}
+	}
+
+	if (!ld_moved) {
+		int active_balance = 0;
+
+		schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
+		if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+		    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+			return -1;
+
+		if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
+			return -1;
+
+		if (sd->nr_balance_failed++ < 2)
+			return -1;
+
+		/*
+		 * The only task running in a non-idle cpu can be moved to this
+		 * cpu in an attempt to completely freeup the other CPU
+		 * package. The same method used to move task in load_balance()
+		 * have been extended for load_balance_newidle() to speedup
+		 * consolidation at sched_mc=POWERSAVINGS_BALANCE_WAKEUP (2)
+		 *
+		 * The package power saving logic comes from
+		 * find_busiest_group().  If there are no imbalance, then
+		 * f_b_g() will return NULL.  However when sched_mc={1,2} then
+		 * f_b_g() will select a group from which a running task may be
+		 * pulled to this cpu in order to make the other package idle.
+		 * If there is no opportunity to make a package idle and if
+		 * there are no imbalance, then f_b_g() will return NULL and no
+		 * action will be taken in load_balance_newidle().
+		 *
+		 * Under normal task pull operation due to imbalance, there
+		 * will be more than one task in the source run queue and
+		 * move_tasks() will succeed.  ld_moved will be true and this
+		 * active balance code will not be triggered.
+		 */
+
+		/* Lock busiest in correct order while this_rq is held */
+		double_lock_balance(this_rq, busiest);
+
+		/*
+		 * don't kick the migration_thread, if the curr
+		 * task on busiest cpu can't be moved to this_cpu
+		 */
+		if (!cpumask_test_cpu(this_cpu, &busiest->curr->cpus_allowed)) {
+			double_unlock_balance(this_rq, busiest);
+			all_pinned = 1;
+			return ld_moved;
+		}
+
+		if (!busiest->active_balance) {
+			busiest->active_balance = 1;
+			busiest->push_cpu = this_cpu;
+			active_balance = 1;
+		}
+
+		double_unlock_balance(this_rq, busiest);
+		/*
+		 * Should not call ttwu while holding a rq->lock
+		 */
+		raw_spin_unlock(&this_rq->lock);
+		if (active_balance)
+			wake_up_process(busiest->migration_thread);
+		raw_spin_lock(&this_rq->lock);
+
+	} else
+		sd->nr_balance_failed = 0;
+
+	update_shares_locked(this_rq, sd);
+	return ld_moved;
+
+out_balanced:
+	schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
+	if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+		return -1;
+	sd->nr_balance_failed = 0;
+
+	return 0;
+}
+
+/*
+ * idle_balance is called by schedule() if this_cpu is about to become
+ * idle. Attempts to pull tasks from other CPUs.
+ */
+static void idle_balance(int this_cpu, struct rq *this_rq)
+{
+	struct sched_domain *sd;
+	int pulled_task = 0;
+	unsigned long next_balance = jiffies + HZ;
+
+	this_rq->idle_stamp = this_rq->clock;
+
+	if (this_rq->avg_idle < sysctl_sched_migration_cost)
+		return;
+
+	for_each_domain(this_cpu, sd) {
+		unsigned long interval;
+
+		if (!(sd->flags & SD_LOAD_BALANCE))
+			continue;
+
+		if (sd->flags & SD_BALANCE_NEWIDLE)
+			/* If we've pulled tasks over stop searching: */
+			pulled_task = load_balance_newidle(this_cpu, this_rq,
+							   sd);
+
+		interval = msecs_to_jiffies(sd->balance_interval);
+		if (time_after(next_balance, sd->last_balance + interval))
+			next_balance = sd->last_balance + interval;
+		if (pulled_task) {
+			this_rq->idle_stamp = 0;
+			break;
+		}
+	}
+	if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
+		/*
+		 * We are going idle. next_balance may be set based on
+		 * a busy processor. So reset next_balance.
+		 */
+		this_rq->next_balance = next_balance;
+	}
+}
+
+/*
+ * active_load_balance is run by migration threads. It pushes running tasks
+ * off the busiest CPU onto idle CPUs. It requires at least 1 task to be
+ * running on each physical CPU where possible, and avoids physical /
+ * logical imbalances.
+ *
+ * Called with busiest_rq locked.
+ */
+static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
+{
+	int target_cpu = busiest_rq->push_cpu;
+	struct sched_domain *sd;
+	struct rq *target_rq;
+
+	/* Is there any task to move? */
+	if (busiest_rq->nr_running <= 1)
+		return;
+
+	target_rq = cpu_rq(target_cpu);
+
+	/*
+	 * This condition is "impossible", if it occurs
+	 * we need to fix it. Originally reported by
+	 * Bjorn Helgaas on a 128-cpu setup.
+	 */
+	BUG_ON(busiest_rq == target_rq);
+
+	/* move a task from busiest_rq to target_rq */
+	double_lock_balance(busiest_rq, target_rq);
+	update_rq_clock(busiest_rq);
+	update_rq_clock(target_rq);
+
+	/* Search for an sd spanning us and the target CPU. */
+	for_each_domain(target_cpu, sd) {
+		if ((sd->flags & SD_LOAD_BALANCE) &&
+		    cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
+				break;
+	}
+
+	if (likely(sd)) {
+		schedstat_inc(sd, alb_count);
+
+		if (move_one_task(target_rq, target_cpu, busiest_rq,
+				  sd, CPU_IDLE))
+			schedstat_inc(sd, alb_pushed);
+		else
+			schedstat_inc(sd, alb_failed);
+	}
+	double_unlock_balance(busiest_rq, target_rq);
+}
+
+#ifdef CONFIG_NO_HZ
+static struct {
+	atomic_t load_balancer;
+	cpumask_var_t cpu_mask;
+	cpumask_var_t ilb_grp_nohz_mask;
+} nohz ____cacheline_aligned = {
+	.load_balancer = ATOMIC_INIT(-1),
+};
+
+int get_nohz_load_balancer(void)
+{
+	return atomic_read(&nohz.load_balancer);
+}
+
+#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
+/**
+ * lowest_flag_domain - Return lowest sched_domain containing flag.
+ * @cpu:	The cpu whose lowest level of sched domain is to
+ *		be returned.
+ * @flag:	The flag to check for the lowest sched_domain
+ *		for the given cpu.
+ *
+ * Returns the lowest sched_domain of a cpu which contains the given flag.
+ */
+static inline struct sched_domain *lowest_flag_domain(int cpu, int flag)
+{
+	struct sched_domain *sd;
+
+	for_each_domain(cpu, sd)
+		if (sd && (sd->flags & flag))
+			break;
+
+	return sd;
+}
+
+/**
+ * for_each_flag_domain - Iterates over sched_domains containing the flag.
+ * @cpu:	The cpu whose domains we're iterating over.
+ * @sd:		variable holding the value of the power_savings_sd
+ *		for cpu.
+ * @flag:	The flag to filter the sched_domains to be iterated.
+ *
+ * Iterates over all the scheduler domains for a given cpu that has the 'flag'
+ * set, starting from the lowest sched_domain to the highest.
+ */
+#define for_each_flag_domain(cpu, sd, flag) \
+	for (sd = lowest_flag_domain(cpu, flag); \
+		(sd && (sd->flags & flag)); sd = sd->parent)
+
+/**
+ * is_semi_idle_group - Checks if the given sched_group is semi-idle.
+ * @ilb_group:	group to be checked for semi-idleness
+ *
+ * Returns:	1 if the group is semi-idle. 0 otherwise.
+ *
+ * We define a sched_group to be semi idle if it has atleast one idle-CPU
+ * and atleast one non-idle CPU. This helper function checks if the given
+ * sched_group is semi-idle or not.
+ */
+static inline int is_semi_idle_group(struct sched_group *ilb_group)
+{
+	cpumask_and(nohz.ilb_grp_nohz_mask, nohz.cpu_mask,
+					sched_group_cpus(ilb_group));
+
+	/*
+	 * A sched_group is semi-idle when it has atleast one busy cpu
+	 * and atleast one idle cpu.
+	 */
+	if (cpumask_empty(nohz.ilb_grp_nohz_mask))
+		return 0;
+
+	if (cpumask_equal(nohz.ilb_grp_nohz_mask, sched_group_cpus(ilb_group)))
+		return 0;
+
+	return 1;
+}
+/**
+ * find_new_ilb - Finds the optimum idle load balancer for nomination.
+ * @cpu:	The cpu which is nominating a new idle_load_balancer.
+ *
+ * Returns:	Returns the id of the idle load balancer if it exists,
+ *		Else, returns >= nr_cpu_ids.
+ *
+ * This algorithm picks the idle load balancer such that it belongs to a
+ * semi-idle powersavings sched_domain. The idea is to try and avoid
+ * completely idle packages/cores just for the purpose of idle load balancing
+ * when there are other idle cpu's which are better suited for that job.
+ */
+static int find_new_ilb(int cpu)
+{
+	struct sched_domain *sd;
+	struct sched_group *ilb_group;
+
+	/*
+	 * Have idle load balancer selection from semi-idle packages only
+	 * when power-aware load balancing is enabled
+	 */
+	if (!(sched_smt_power_savings || sched_mc_power_savings))
+		goto out_done;
+
+	/*
+	 * Optimize for the case when we have no idle CPUs or only one
+	 * idle CPU. Don't walk the sched_domain hierarchy in such cases
+	 */
+	if (cpumask_weight(nohz.cpu_mask) < 2)
+		goto out_done;
+
+	for_each_flag_domain(cpu, sd, SD_POWERSAVINGS_BALANCE) {
+		ilb_group = sd->groups;
+
+		do {
+			if (is_semi_idle_group(ilb_group))
+				return cpumask_first(nohz.ilb_grp_nohz_mask);
+
+			ilb_group = ilb_group->next;
+
+		} while (ilb_group != sd->groups);
+	}
+
+out_done:
+	return cpumask_first(nohz.cpu_mask);
+}
+#else /*  (CONFIG_SCHED_MC || CONFIG_SCHED_SMT) */
+static inline int find_new_ilb(int call_cpu)
+{
+	return cpumask_first(nohz.cpu_mask);
+}
+#endif
+
+/*
+ * This routine will try to nominate the ilb (idle load balancing)
+ * owner among the cpus whose ticks are stopped. ilb owner will do the idle
+ * load balancing on behalf of all those cpus. If all the cpus in the system
+ * go into this tickless mode, then there will be no ilb owner (as there is
+ * no need for one) and all the cpus will sleep till the next wakeup event
+ * arrives...
+ *
+ * For the ilb owner, tick is not stopped. And this tick will be used
+ * for idle load balancing. ilb owner will still be part of
+ * nohz.cpu_mask..
+ *
+ * While stopping the tick, this cpu will become the ilb owner if there
+ * is no other owner. And will be the owner till that cpu becomes busy
+ * or if all cpus in the system stop their ticks at which point
+ * there is no need for ilb owner.
+ *
+ * When the ilb owner becomes busy, it nominates another owner, during the
+ * next busy scheduler_tick()
+ */
+int select_nohz_load_balancer(int stop_tick)
+{
+	int cpu = smp_processor_id();
+
+	if (stop_tick) {
+		cpu_rq(cpu)->in_nohz_recently = 1;
+
+		if (!cpu_active(cpu)) {
+			if (atomic_read(&nohz.load_balancer) != cpu)
+				return 0;
+
+			/*
+			 * If we are going offline and still the leader,
+			 * give up!
+			 */
+			if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
+				BUG();
+
+			return 0;
+		}
+
+		cpumask_set_cpu(cpu, nohz.cpu_mask);
+
+		/* time for ilb owner also to sleep */
+		if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
+			if (atomic_read(&nohz.load_balancer) == cpu)
+				atomic_set(&nohz.load_balancer, -1);
+			return 0;
+		}
+
+		if (atomic_read(&nohz.load_balancer) == -1) {
+			/* make me the ilb owner */
+			if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
+				return 1;
+		} else if (atomic_read(&nohz.load_balancer) == cpu) {
+			int new_ilb;
+
+			if (!(sched_smt_power_savings ||
+						sched_mc_power_savings))
+				return 1;
+			/*
+			 * Check to see if there is a more power-efficient
+			 * ilb.
+			 */
+			new_ilb = find_new_ilb(cpu);
+			if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
+				atomic_set(&nohz.load_balancer, -1);
+				resched_cpu(new_ilb);
+				return 0;
+			}
+			return 1;
+		}
+	} else {
+		if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
+			return 0;
+
+		cpumask_clear_cpu(cpu, nohz.cpu_mask);
+
+		if (atomic_read(&nohz.load_balancer) == cpu)
+			if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
+				BUG();
+	}
+	return 0;
+}
+#endif
+
+static DEFINE_SPINLOCK(balancing);
+
+/*
+ * It checks each scheduling domain to see if it is due to be balanced,
+ * and initiates a balancing operation if so.
+ *
+ * Balancing parameters are set up in arch_init_sched_domains.
+ */
+static void rebalance_domains(int cpu, enum cpu_idle_type idle)
+{
+	int balance = 1;
+	struct rq *rq = cpu_rq(cpu);
+	unsigned long interval;
+	struct sched_domain *sd;
+	/* Earliest time when we have to do rebalance again */
+	unsigned long next_balance = jiffies + 60*HZ;
+	int update_next_balance = 0;
+	int need_serialize;
+
+	for_each_domain(cpu, sd) {
+		if (!(sd->flags & SD_LOAD_BALANCE))
+			continue;
+
+		interval = sd->balance_interval;
+		if (idle != CPU_IDLE)
+			interval *= sd->busy_factor;
+
+		/* scale ms to jiffies */
+		interval = msecs_to_jiffies(interval);
+		if (unlikely(!interval))
+			interval = 1;
+		if (interval > HZ*NR_CPUS/10)
+			interval = HZ*NR_CPUS/10;
+
+		need_serialize = sd->flags & SD_SERIALIZE;
+
+		if (need_serialize) {
+			if (!spin_trylock(&balancing))
+				goto out;
+		}
+
+		if (time_after_eq(jiffies, sd->last_balance + interval)) {
+			if (load_balance(cpu, rq, sd, idle, &balance)) {
+				/*
+				 * We've pulled tasks over so either we're no
+				 * longer idle, or one of our SMT siblings is
+				 * not idle.
+				 */
+				idle = CPU_NOT_IDLE;
+			}
+			sd->last_balance = jiffies;
+		}
+		if (need_serialize)
+			spin_unlock(&balancing);
+out:
+		if (time_after(next_balance, sd->last_balance + interval)) {
+			next_balance = sd->last_balance + interval;
+			update_next_balance = 1;
+		}
+
+		/*
+		 * Stop the load balance at this level. There is another
+		 * CPU in our sched group which is doing load balancing more
+		 * actively.
+		 */
+		if (!balance)
+			break;
+	}
+
+	/*
+	 * next_balance will be updated only when there is a need.
+	 * When the cpu is attached to null domain for ex, it will not be
+	 * updated.
+	 */
+	if (likely(update_next_balance))
+		rq->next_balance = next_balance;
+}
+
+/*
+ * run_rebalance_domains is triggered when needed from the scheduler tick.
+ * In CONFIG_NO_HZ case, the idle load balance owner will do the
+ * rebalancing for all the cpus for whom scheduler ticks are stopped.
+ */
+static void run_rebalance_domains(struct softirq_action *h)
+{
+	int this_cpu = smp_processor_id();
+	struct rq *this_rq = cpu_rq(this_cpu);
+	enum cpu_idle_type idle = this_rq->idle_at_tick ?
+						CPU_IDLE : CPU_NOT_IDLE;
+
+	rebalance_domains(this_cpu, idle);
+
+#ifdef CONFIG_NO_HZ
+	/*
+	 * If this cpu is the owner for idle load balancing, then do the
+	 * balancing on behalf of the other idle cpus whose ticks are
+	 * stopped.
+	 */
+	if (this_rq->idle_at_tick &&
+	    atomic_read(&nohz.load_balancer) == this_cpu) {
+		struct rq *rq;
+		int balance_cpu;
+
+		for_each_cpu(balance_cpu, nohz.cpu_mask) {
+			if (balance_cpu == this_cpu)
+				continue;
+
+			/*
+			 * If this cpu gets work to do, stop the load balancing
+			 * work being done for other cpus. Next load
+			 * balancing owner will pick it up.
+			 */
+			if (need_resched())
+				break;
+
+			rebalance_domains(balance_cpu, CPU_IDLE);
+
+			rq = cpu_rq(balance_cpu);
+			if (time_after(this_rq->next_balance, rq->next_balance))
+				this_rq->next_balance = rq->next_balance;
+		}
+	}
+#endif
+}
+
+static inline int on_null_domain(int cpu)
+{
+	return !rcu_dereference(cpu_rq(cpu)->sd);
+}
+
+/*
+ * Trigger the SCHED_SOFTIRQ if it is time to do periodic load balancing.
+ *
+ * In case of CONFIG_NO_HZ, this is the place where we nominate a new
+ * idle load balancing owner or decide to stop the periodic load balancing,
+ * if the whole system is idle.
+ */
+static inline void trigger_load_balance(struct rq *rq, int cpu)
+{
+#ifdef CONFIG_NO_HZ
+	/*
+	 * If we were in the nohz mode recently and busy at the current
+	 * scheduler tick, then check if we need to nominate new idle
+	 * load balancer.
+	 */
+	if (rq->in_nohz_recently && !rq->idle_at_tick) {
+		rq->in_nohz_recently = 0;
+
+		if (atomic_read(&nohz.load_balancer) == cpu) {
+			cpumask_clear_cpu(cpu, nohz.cpu_mask);
+			atomic_set(&nohz.load_balancer, -1);
+		}
+
+		if (atomic_read(&nohz.load_balancer) == -1) {
+			int ilb = find_new_ilb(cpu);
+
+			if (ilb < nr_cpu_ids)
+				resched_cpu(ilb);
+		}
+	}
+
+	/*
+	 * If this cpu is idle and doing idle load balancing for all the
+	 * cpus with ticks stopped, is it time for that to stop?
+	 */
+	if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) == cpu &&
+	    cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
+		resched_cpu(cpu);
+		return;
+	}
+
+	/*
+	 * If this cpu is idle and the idle load balancing is done by
+	 * someone else, then no need raise the SCHED_SOFTIRQ
+	 */
+	if (rq->idle_at_tick && atomic_read(&nohz.load_balancer) != cpu &&
+	    cpumask_test_cpu(cpu, nohz.cpu_mask))
+		return;
+#endif
+	/* Don't need to rebalance while attached to NULL domain */
+	if (time_after_eq(jiffies, rq->next_balance) &&
+	    likely(!on_null_domain(cpu)))
+		raise_softirq(SCHED_SOFTIRQ);
+}
+
 static void rq_online_fair(struct rq *rq)
 {
 	update_sysctl();
@@ -1962,6 +3718,15 @@ static void rq_offline_fair(struct rq *rq)
 	update_sysctl();
 }
 
+#else	/* CONFIG_SMP */
+
+/*
+ * on UP we do not need to balance between CPUs:
+ */
+static inline void idle_balance(int cpu, struct rq *rq)
+{
+}
+
 #endif /* CONFIG_SMP */
 
 /*

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

* [tip:sched/core] sched: Remove the sched_class load_balance methods
       [not found]             ` <new-submission>
                                 ` (468 preceding siblings ...)
  2010-01-21 13:52               ` [tip:sched/core] sched: Move load balance code into sched_fair.c tip-bot for Peter Zijlstra
@ 2010-01-21 13:52               ` tip-bot for Peter Zijlstra
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator usage from load_balance_fair tip-bot for Peter Zijlstra
                                 ` (236 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  3d45fd804a95055ecab5b3eed81f5ab2dbb047a2
Gitweb:     http://git.kernel.org/tip/3d45fd804a95055ecab5b3eed81f5ab2dbb047a2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 17:12:46 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:09 +0100

sched: Remove the sched_class load_balance methods

Take out the sched_class methods for load-balancing.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h   |    8 -----
 kernel/sched.c          |   26 ------------------
 kernel/sched_fair.c     |   66 ++++++++++++++++++++++++++--------------------
 kernel/sched_idletask.c |   21 ---------------
 kernel/sched_rt.c       |   20 --------------
 5 files changed, 37 insertions(+), 104 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f2f842d..50d685c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1087,14 +1087,6 @@ struct sched_class {
 #ifdef CONFIG_SMP
 	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
 
-	unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
-			struct rq *busiest, unsigned long max_load_move,
-			struct sched_domain *sd, enum cpu_idle_type idle,
-			int *all_pinned, int *this_best_prio);
-
-	int (*move_one_task) (struct rq *this_rq, int this_cpu,
-			      struct rq *busiest, struct sched_domain *sd,
-			      enum cpu_idle_type idle);
 	void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
 	void (*post_schedule) (struct rq *this_rq);
 	void (*task_waking) (struct rq *this_rq, struct task_struct *task);
diff --git a/kernel/sched.c b/kernel/sched.c
index 13a2acf..c0be079 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1390,32 +1390,6 @@ static const u32 prio_to_wmult[40] = {
  /*  15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
 };
 
-static void activate_task(struct rq *rq, struct task_struct *p, int wakeup);
-
-/*
- * runqueue iterator, to support SMP load-balancing between different
- * scheduling classes, without having to expose their internal data
- * structures to the load-balancing proper:
- */
-struct rq_iterator {
-	void *arg;
-	struct task_struct *(*start)(void *);
-	struct task_struct *(*next)(void *);
-};
-
-#ifdef CONFIG_SMP
-static unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-	      unsigned long max_load_move, struct sched_domain *sd,
-	      enum cpu_idle_type idle, int *all_pinned,
-	      int *this_best_prio, struct rq_iterator *iterator);
-
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		   struct sched_domain *sd, enum cpu_idle_type idle,
-		   struct rq_iterator *iterator);
-#endif
-
 /* Time spent by the tasks of the cpu accounting group executing in ... */
 enum cpuacct_stat_index {
 	CPUACCT_STAT_USER,	/* ... user mode */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5116b81..faf9a2f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1851,6 +1851,24 @@ static struct task_struct *load_balance_next_fair(void *arg)
 	return __load_balance_iterator(cfs_rq, cfs_rq->balance_iterator);
 }
 
+/*
+ * runqueue iterator, to support SMP load-balancing between different
+ * scheduling classes, without having to expose their internal data
+ * structures to the load-balancing proper:
+ */
+struct rq_iterator {
+	void *arg;
+	struct task_struct *(*start)(void *);
+	struct task_struct *(*next)(void *);
+};
+
+static unsigned long
+balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		unsigned long max_load_move, struct sched_domain *sd,
+		enum cpu_idle_type idle, int *all_pinned,
+		int *this_best_prio, struct rq_iterator *iterator);
+
+
 static unsigned long
 __load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		unsigned long max_load_move, struct sched_domain *sd,
@@ -1929,8 +1947,20 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 #endif
 
 static int
-move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		   struct sched_domain *sd, enum cpu_idle_type idle)
+iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		struct sched_domain *sd, enum cpu_idle_type idle,
+		struct rq_iterator *iterator);
+
+/*
+ * move_one_task tries to move exactly one task from busiest to this_rq, as
+ * part of active balancing operations within "domain".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int
+move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+	      struct sched_domain *sd, enum cpu_idle_type idle)
 {
 	struct cfs_rq *busy_cfs_rq;
 	struct rq_iterator cfs_rq_iterator;
@@ -2094,16 +2124,15 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		      struct sched_domain *sd, enum cpu_idle_type idle,
 		      int *all_pinned)
 {
-	const struct sched_class *class = sched_class_highest;
-	unsigned long total_load_moved = 0;
+	unsigned long total_load_moved = 0, load_moved;
 	int this_best_prio = this_rq->curr->prio;
 
 	do {
-		total_load_moved +=
-			class->load_balance(this_rq, this_cpu, busiest,
+		load_moved = load_balance_fair(this_rq, this_cpu, busiest,
 				max_load_move - total_load_moved,
 				sd, idle, all_pinned, &this_best_prio);
-		class = class->next;
+
+		total_load_moved += load_moved;
 
 #ifdef CONFIG_PREEMPT
 		/*
@@ -2114,7 +2143,7 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
 			break;
 #endif
-	} while (class && max_load_move > total_load_moved);
+	} while (load_moved && max_load_move > total_load_moved);
 
 	return total_load_moved > 0;
 }
@@ -2145,25 +2174,6 @@ iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
 	return 0;
 }
 
-/*
- * move_one_task tries to move exactly one task from busiest to this_rq, as
- * part of active balancing operations within "domain".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-			 struct sched_domain *sd, enum cpu_idle_type idle)
-{
-	const struct sched_class *class;
-
-	for_each_class(class) {
-		if (class->move_one_task(this_rq, this_cpu, busiest, sd, idle))
-			return 1;
-	}
-
-	return 0;
-}
 /********** Helpers for find_busiest_group ************************/
 /*
  * sd_lb_stats - Structure to store the statistics of a sched_domain
@@ -3873,8 +3883,6 @@ static const struct sched_class fair_sched_class = {
 #ifdef CONFIG_SMP
 	.select_task_rq		= select_task_rq_fair,
 
-	.load_balance		= load_balance_fair,
-	.move_one_task		= move_one_task_fair,
 	.rq_online		= rq_online_fair,
 	.rq_offline		= rq_offline_fair,
 
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 01332bf..a8a6d8a 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -44,24 +44,6 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
 {
 }
 
-#ifdef CONFIG_SMP
-static unsigned long
-load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		  unsigned long max_load_move,
-		  struct sched_domain *sd, enum cpu_idle_type idle,
-		  int *all_pinned, int *this_best_prio)
-{
-	return 0;
-}
-
-static int
-move_one_task_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		   struct sched_domain *sd, enum cpu_idle_type idle)
-{
-	return 0;
-}
-#endif
-
 static void task_tick_idle(struct rq *rq, struct task_struct *curr, int queued)
 {
 }
@@ -119,9 +101,6 @@ static const struct sched_class idle_sched_class = {
 
 #ifdef CONFIG_SMP
 	.select_task_rq		= select_task_rq_idle,
-
-	.load_balance		= load_balance_idle,
-	.move_one_task		= move_one_task_idle,
 #endif
 
 	.set_curr_task          = set_curr_task_idle,
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 072b3fc..502bb61 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1481,24 +1481,6 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
 		push_rt_tasks(rq);
 }
 
-static unsigned long
-load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		unsigned long max_load_move,
-		struct sched_domain *sd, enum cpu_idle_type idle,
-		int *all_pinned, int *this_best_prio)
-{
-	/* don't touch RT tasks */
-	return 0;
-}
-
-static int
-move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		 struct sched_domain *sd, enum cpu_idle_type idle)
-{
-	/* don't touch RT tasks */
-	return 0;
-}
-
 static void set_cpus_allowed_rt(struct task_struct *p,
 				const struct cpumask *new_mask)
 {
@@ -1746,8 +1728,6 @@ static const struct sched_class rt_sched_class = {
 #ifdef CONFIG_SMP
 	.select_task_rq		= select_task_rq_rt,
 
-	.load_balance		= load_balance_rt,
-	.move_one_task		= move_one_task_rt,
 	.set_cpus_allowed       = set_cpus_allowed_rt,
 	.rq_online              = rq_online_rt,
 	.rq_offline             = rq_offline_rt,

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

* [tip:sched/core] sched: Remove rq_iterator usage from load_balance_fair
       [not found]             ` <new-submission>
                                 ` (469 preceding siblings ...)
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove the sched_class load_balance methods tip-bot for Peter Zijlstra
@ 2010-01-21 13:52               ` tip-bot for Peter Zijlstra
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator from move_one_task tip-bot for Peter Zijlstra
                                 ` (235 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  ee00e66ffff250fb0d3a789e5565462f71c7c9a7
Gitweb:     http://git.kernel.org/tip/ee00e66ffff250fb0d3a789e5565462f71c7c9a7
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 17:25:20 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:10 +0100

sched: Remove rq_iterator usage from load_balance_fair

Since we only ever iterate the fair class, do away with this abstraction.

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 |   80 ++++++++++++++++++--------------------------------
 1 files changed, 29 insertions(+), 51 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index faf9a2f..709deb3 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1866,26 +1866,9 @@ static unsigned long
 balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		unsigned long max_load_move, struct sched_domain *sd,
 		enum cpu_idle_type idle, int *all_pinned,
-		int *this_best_prio, struct rq_iterator *iterator);
+		int *this_best_prio, struct cfs_rq *busiest_cfs_rq);
 
 
-static unsigned long
-__load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		unsigned long max_load_move, struct sched_domain *sd,
-		enum cpu_idle_type idle, int *all_pinned, int *this_best_prio,
-		struct cfs_rq *cfs_rq)
-{
-	struct rq_iterator cfs_rq_iterator;
-
-	cfs_rq_iterator.start = load_balance_start_fair;
-	cfs_rq_iterator.next = load_balance_next_fair;
-	cfs_rq_iterator.arg = cfs_rq;
-
-	return balance_tasks(this_rq, this_cpu, busiest,
-			max_load_move, sd, idle, all_pinned,
-			this_best_prio, &cfs_rq_iterator);
-}
-
 #ifdef CONFIG_FAIR_GROUP_SCHED
 static unsigned long
 load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
@@ -1915,9 +1898,9 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		rem_load = (u64)rem_load_move * busiest_weight;
 		rem_load = div_u64(rem_load, busiest_h_load + 1);
 
-		moved_load = __load_balance_fair(this_rq, this_cpu, busiest,
+		moved_load = balance_tasks(this_rq, this_cpu, busiest,
 				rem_load, sd, idle, all_pinned, this_best_prio,
-				tg->cfs_rq[busiest_cpu]);
+				busiest_cfs_rq);
 
 		if (!moved_load)
 			continue;
@@ -1940,7 +1923,7 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		  struct sched_domain *sd, enum cpu_idle_type idle,
 		  int *all_pinned, int *this_best_prio)
 {
-	return __load_balance_fair(this_rq, this_cpu, busiest,
+	return balance_tasks(this_rq, this_cpu, busiest,
 			max_load_move, sd, idle, all_pinned,
 			this_best_prio, &busiest->cfs);
 }
@@ -2050,53 +2033,48 @@ static unsigned long
 balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 	      unsigned long max_load_move, struct sched_domain *sd,
 	      enum cpu_idle_type idle, int *all_pinned,
-	      int *this_best_prio, struct rq_iterator *iterator)
+	      int *this_best_prio, struct cfs_rq *busiest_cfs_rq)
 {
 	int loops = 0, pulled = 0, pinned = 0;
-	struct task_struct *p;
 	long rem_load_move = max_load_move;
+	struct task_struct *p, *n;
 
 	if (max_load_move == 0)
 		goto out;
 
 	pinned = 1;
 
-	/*
-	 * Start the load-balancing iterator:
-	 */
-	p = iterator->start(iterator->arg);
-next:
-	if (!p || loops++ > sysctl_sched_nr_migrate)
-		goto out;
+	list_for_each_entry_safe(p, n, &busiest_cfs_rq->tasks, se.group_node) {
+		if (loops++ > sysctl_sched_nr_migrate)
+			break;
 
-	if ((p->se.load.weight >> 1) > rem_load_move ||
-	    !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-		p = iterator->next(iterator->arg);
-		goto next;
-	}
+		if ((p->se.load.weight >> 1) > rem_load_move ||
+		    !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned))
+			continue;
 
-	pull_task(busiest, p, this_rq, this_cpu);
-	pulled++;
-	rem_load_move -= p->se.load.weight;
+		pull_task(busiest, p, this_rq, this_cpu);
+		pulled++;
+		rem_load_move -= p->se.load.weight;
 
 #ifdef CONFIG_PREEMPT
-	/*
-	 * NEWIDLE balancing is a source of latency, so preemptible kernels
-	 * will stop after the first task is pulled to minimize the critical
-	 * section.
-	 */
-	if (idle == CPU_NEWLY_IDLE)
-		goto out;
+		/*
+		 * NEWIDLE balancing is a source of latency, so preemptible
+		 * kernels will stop after the first task is pulled to minimize
+		 * the critical section.
+		 */
+		if (idle == CPU_NEWLY_IDLE)
+			break;
 #endif
 
-	/*
-	 * We only want to steal up to the prescribed amount of weighted load.
-	 */
-	if (rem_load_move > 0) {
+		/*
+		 * We only want to steal up to the prescribed amount of
+		 * weighted load.
+		 */
+		if (rem_load_move <= 0)
+			break;
+
 		if (p->prio < *this_best_prio)
 			*this_best_prio = p->prio;
-		p = iterator->next(iterator->arg);
-		goto next;
 	}
 out:
 	/*

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

* [tip:sched/core] sched: Remove rq_iterator from move_one_task
       [not found]             ` <new-submission>
                                 ` (470 preceding siblings ...)
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator usage from load_balance_fair tip-bot for Peter Zijlstra
@ 2010-01-21 13:52               ` tip-bot for Peter Zijlstra
  2010-01-21 13:53               ` [tip:sched/core] sched: Remove from fwd decls tip-bot for Peter Zijlstra
                                 ` (234 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  897c395f4c94ae19302f92393a0b8304e414ee06
Gitweb:     http://git.kernel.org/tip/897c395f4c94ae19302f92393a0b8304e414ee06
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 17:45:42 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:11 +0100

sched: Remove rq_iterator from move_one_task

Again, since we only iterate the fair class, remove the abstraction.

Since this is the last user of the rq_iterator, remove all that too.

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 |  146 +++++++++++++--------------------------------------
 1 files changed, 36 insertions(+), 110 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 709deb3..e48e459 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1814,54 +1814,6 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
  * Fair scheduling class load-balancing methods:
  */
 
-/*
- * Load-balancing iterator. Note: while the runqueue stays locked
- * during the whole iteration, the current task might be
- * dequeued so the iterator has to be dequeue-safe. Here we
- * achieve that by always pre-iterating before returning
- * the current task:
- */
-static struct task_struct *
-__load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next)
-{
-	struct task_struct *p = NULL;
-	struct sched_entity *se;
-
-	if (next == &cfs_rq->tasks)
-		return NULL;
-
-	se = list_entry(next, struct sched_entity, group_node);
-	p = task_of(se);
-	cfs_rq->balance_iterator = next->next;
-
-	return p;
-}
-
-static struct task_struct *load_balance_start_fair(void *arg)
-{
-	struct cfs_rq *cfs_rq = arg;
-
-	return __load_balance_iterator(cfs_rq, cfs_rq->tasks.next);
-}
-
-static struct task_struct *load_balance_next_fair(void *arg)
-{
-	struct cfs_rq *cfs_rq = arg;
-
-	return __load_balance_iterator(cfs_rq, cfs_rq->balance_iterator);
-}
-
-/*
- * runqueue iterator, to support SMP load-balancing between different
- * scheduling classes, without having to expose their internal data
- * structures to the load-balancing proper:
- */
-struct rq_iterator {
-	void *arg;
-	struct task_struct *(*start)(void *);
-	struct task_struct *(*next)(void *);
-};
-
 static unsigned long
 balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		unsigned long max_load_move, struct sched_domain *sd,
@@ -1929,42 +1881,6 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
 }
 #endif
 
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		struct sched_domain *sd, enum cpu_idle_type idle,
-		struct rq_iterator *iterator);
-
-/*
- * move_one_task tries to move exactly one task from busiest to this_rq, as
- * part of active balancing operations within "domain".
- * Returns 1 if successful and 0 otherwise.
- *
- * Called with both runqueues locked.
- */
-static int
-move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-	      struct sched_domain *sd, enum cpu_idle_type idle)
-{
-	struct cfs_rq *busy_cfs_rq;
-	struct rq_iterator cfs_rq_iterator;
-
-	cfs_rq_iterator.start = load_balance_start_fair;
-	cfs_rq_iterator.next = load_balance_next_fair;
-
-	for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
-		/*
-		 * pass busy_cfs_rq argument into
-		 * load_balance_[start|next]_fair iterators
-		 */
-		cfs_rq_iterator.arg = busy_cfs_rq;
-		if (iter_move_one_task(this_rq, this_cpu, busiest, sd, idle,
-				       &cfs_rq_iterator))
-		    return 1;
-	}
-
-	return 0;
-}
-
 /*
  * pull_task - move a task from a remote runqueue to the local runqueue.
  * Both runqueues must be locked.
@@ -2029,6 +1945,42 @@ int can_migrate_task(struct task_struct *p, struct rq *rq, int this_cpu,
 	return 1;
 }
 
+/*
+ * move_one_task tries to move exactly one task from busiest to this_rq, as
+ * part of active balancing operations within "domain".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int
+move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+	      struct sched_domain *sd, enum cpu_idle_type idle)
+{
+	struct task_struct *p, *n;
+	struct cfs_rq *cfs_rq;
+	int pinned = 0;
+
+	for_each_leaf_cfs_rq(busiest, cfs_rq) {
+		list_for_each_entry_safe(p, n, &cfs_rq->tasks, se.group_node) {
+
+			if (!can_migrate_task(p, busiest, this_cpu,
+						sd, idle, &pinned))
+				continue;
+
+			pull_task(busiest, p, this_rq, this_cpu);
+			/*
+			 * Right now, this is only the second place pull_task()
+			 * is called, so we can safely collect pull_task()
+			 * stats here rather than inside pull_task().
+			 */
+			schedstat_inc(sd, lb_gained[idle]);
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 static unsigned long
 balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 	      unsigned long max_load_move, struct sched_domain *sd,
@@ -2126,32 +2078,6 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 	return total_load_moved > 0;
 }
 
-static int
-iter_move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		   struct sched_domain *sd, enum cpu_idle_type idle,
-		   struct rq_iterator *iterator)
-{
-	struct task_struct *p = iterator->start(iterator->arg);
-	int pinned = 0;
-
-	while (p) {
-		if (can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-			pull_task(busiest, p, this_rq, this_cpu);
-			/*
-			 * Right now, this is only the second place pull_task()
-			 * is called, so we can safely collect pull_task()
-			 * stats here rather than inside pull_task().
-			 */
-			schedstat_inc(sd, lb_gained[idle]);
-
-			return 1;
-		}
-		p = iterator->next(iterator->arg);
-	}
-
-	return 0;
-}
-
 /********** Helpers for find_busiest_group ************************/
 /*
  * sd_lb_stats - Structure to store the statistics of a sched_domain

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

* [tip:sched/core] sched: Remove from fwd decls
       [not found]             ` <new-submission>
                                 ` (471 preceding siblings ...)
  2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator from move_one_task tip-bot for Peter Zijlstra
@ 2010-01-21 13:53               ` tip-bot for Peter Zijlstra
  2010-01-21 13:53               ` [tip:sched/core] sched: Add a lock break for PREEMPT=y tip-bot for Peter Zijlstra
                                 ` (233 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  230059de77a4e0f6afba98073e73bc9fd471506e
Gitweb:     http://git.kernel.org/tip/230059de77a4e0f6afba98073e73bc9fd471506e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 17:47:12 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:12 +0100

sched: Remove from fwd decls

Move code around to get rid of fwd declarations.

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 |  127 ++++++++++++++++++++++++---------------------------
 1 files changed, 60 insertions(+), 67 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index e48e459..93fccba 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1814,73 +1814,6 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
  * Fair scheduling class load-balancing methods:
  */
 
-static unsigned long
-balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		unsigned long max_load_move, struct sched_domain *sd,
-		enum cpu_idle_type idle, int *all_pinned,
-		int *this_best_prio, struct cfs_rq *busiest_cfs_rq);
-
-
-#ifdef CONFIG_FAIR_GROUP_SCHED
-static unsigned long
-load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		  unsigned long max_load_move,
-		  struct sched_domain *sd, enum cpu_idle_type idle,
-		  int *all_pinned, int *this_best_prio)
-{
-	long rem_load_move = max_load_move;
-	int busiest_cpu = cpu_of(busiest);
-	struct task_group *tg;
-
-	rcu_read_lock();
-	update_h_load(busiest_cpu);
-
-	list_for_each_entry_rcu(tg, &task_groups, list) {
-		struct cfs_rq *busiest_cfs_rq = tg->cfs_rq[busiest_cpu];
-		unsigned long busiest_h_load = busiest_cfs_rq->h_load;
-		unsigned long busiest_weight = busiest_cfs_rq->load.weight;
-		u64 rem_load, moved_load;
-
-		/*
-		 * empty group
-		 */
-		if (!busiest_cfs_rq->task_weight)
-			continue;
-
-		rem_load = (u64)rem_load_move * busiest_weight;
-		rem_load = div_u64(rem_load, busiest_h_load + 1);
-
-		moved_load = balance_tasks(this_rq, this_cpu, busiest,
-				rem_load, sd, idle, all_pinned, this_best_prio,
-				busiest_cfs_rq);
-
-		if (!moved_load)
-			continue;
-
-		moved_load *= busiest_h_load;
-		moved_load = div_u64(moved_load, busiest_weight + 1);
-
-		rem_load_move -= moved_load;
-		if (rem_load_move < 0)
-			break;
-	}
-	rcu_read_unlock();
-
-	return max_load_move - rem_load_move;
-}
-#else
-static unsigned long
-load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-		  unsigned long max_load_move,
-		  struct sched_domain *sd, enum cpu_idle_type idle,
-		  int *all_pinned, int *this_best_prio)
-{
-	return balance_tasks(this_rq, this_cpu, busiest,
-			max_load_move, sd, idle, all_pinned,
-			this_best_prio, &busiest->cfs);
-}
-#endif
-
 /*
  * pull_task - move a task from a remote runqueue to the local runqueue.
  * Both runqueues must be locked.
@@ -2042,6 +1975,66 @@ out:
 	return max_load_move - rem_load_move;
 }
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
+static unsigned long
+load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		  unsigned long max_load_move,
+		  struct sched_domain *sd, enum cpu_idle_type idle,
+		  int *all_pinned, int *this_best_prio)
+{
+	long rem_load_move = max_load_move;
+	int busiest_cpu = cpu_of(busiest);
+	struct task_group *tg;
+
+	rcu_read_lock();
+	update_h_load(busiest_cpu);
+
+	list_for_each_entry_rcu(tg, &task_groups, list) {
+		struct cfs_rq *busiest_cfs_rq = tg->cfs_rq[busiest_cpu];
+		unsigned long busiest_h_load = busiest_cfs_rq->h_load;
+		unsigned long busiest_weight = busiest_cfs_rq->load.weight;
+		u64 rem_load, moved_load;
+
+		/*
+		 * empty group
+		 */
+		if (!busiest_cfs_rq->task_weight)
+			continue;
+
+		rem_load = (u64)rem_load_move * busiest_weight;
+		rem_load = div_u64(rem_load, busiest_h_load + 1);
+
+		moved_load = balance_tasks(this_rq, this_cpu, busiest,
+				rem_load, sd, idle, all_pinned, this_best_prio,
+				busiest_cfs_rq);
+
+		if (!moved_load)
+			continue;
+
+		moved_load *= busiest_h_load;
+		moved_load = div_u64(moved_load, busiest_weight + 1);
+
+		rem_load_move -= moved_load;
+		if (rem_load_move < 0)
+			break;
+	}
+	rcu_read_unlock();
+
+	return max_load_move - rem_load_move;
+}
+#else
+static unsigned long
+load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
+		  unsigned long max_load_move,
+		  struct sched_domain *sd, enum cpu_idle_type idle,
+		  int *all_pinned, int *this_best_prio)
+{
+	return balance_tasks(this_rq, this_cpu, busiest,
+			max_load_move, sd, idle, all_pinned,
+			this_best_prio, &busiest->cfs);
+}
+#endif
+
 /*
  * move_tasks tries to move up to max_load_move weighted load from busiest to
  * this_rq, as part of a balancing operation within domain "sd".

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

* [tip:sched/core] sched: Add a lock break for PREEMPT=y
       [not found]             ` <new-submission>
                                 ` (472 preceding siblings ...)
  2010-01-21 13:53               ` [tip:sched/core] sched: Remove from fwd decls tip-bot for Peter Zijlstra
@ 2010-01-21 13:53               ` tip-bot for Peter Zijlstra
  2010-01-21 13:53               ` [tip:sched/core] sched: Unify load_balance{,_newidle}() tip-bot for Peter Zijlstra
                                 ` (232 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  baa8c1102f0cd86e69c1497d61d2ee177e663663
Gitweb:     http://git.kernel.org/tip/baa8c1102f0cd86e69c1497d61d2ee177e663663
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 17 Dec 2009 18:10:09 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:13 +0100

sched: Add a lock break for PREEMPT=y

Since load-balancing can hold rq->locks for quite a long while, allow
breaking out early when there is lock contention.

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 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 93fccba..65d0820 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -2065,6 +2065,10 @@ static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 		 */
 		if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
 			break;
+
+		if (raw_spin_is_contended(&this_rq->lock) ||
+				raw_spin_is_contended(&busiest->lock))
+			break;
 #endif
 	} while (load_moved && max_load_move > total_load_moved);
 

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

* [tip:sched/core] sched: Unify load_balance{,_newidle}()
       [not found]             ` <new-submission>
                                 ` (473 preceding siblings ...)
  2010-01-21 13:53               ` [tip:sched/core] sched: Add a lock break for PREEMPT=y tip-bot for Peter Zijlstra
@ 2010-01-21 13:53               ` tip-bot for Peter Zijlstra
  2010-01-21 13:53               ` [tip:sched/core] sched: Remove load_balance_newidle() tip-bot for Peter Zijlstra
                                 ` (231 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  1af3ed3ddf27499c3f57662c4c29871e2b95e5f9
Gitweb:     http://git.kernel.org/tip/1af3ed3ddf27499c3f57662c4c29871e2b95e5f9
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 23 Dec 2009 15:10:31 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:13 +0100

sched: Unify load_balance{,_newidle}()

load_balance() and load_balance_newidle() look remarkably similar, one
key point they differ in is the condition on when to active balance.

So split out that logic into a separate function.

One side effect is that previously load_balance_newidle() used to fail
and return -1 under these conditions, whereas now it doesn't. I've not
yet fully figured out the whole -1 return case for either
load_balance{,_newidle}().

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 |  115 ++++++++++++++++++++++++++-------------------------
 1 files changed, 59 insertions(+), 56 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 65d0820..1040832 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -2816,6 +2816,39 @@ find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
 /* Working cpumask for load_balance and load_balance_newidle. */
 static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
 
+static int need_active_balance(struct sched_domain *sd, int sd_idle, int idle)
+{
+	if (idle == CPU_NEWLY_IDLE) {
+		/*
+		 * The only task running in a non-idle cpu can be moved to this
+		 * cpu in an attempt to completely freeup the other CPU
+		 * package.
+		 *
+		 * The package power saving logic comes from
+		 * find_busiest_group(). If there are no imbalance, then
+		 * f_b_g() will return NULL. However when sched_mc={1,2} then
+		 * f_b_g() will select a group from which a running task may be
+		 * pulled to this cpu in order to make the other package idle.
+		 * If there is no opportunity to make a package idle and if
+		 * there are no imbalance, then f_b_g() will return NULL and no
+		 * action will be taken in load_balance_newidle().
+		 *
+		 * Under normal task pull operation due to imbalance, there
+		 * will be more than one task in the source run queue and
+		 * move_tasks() will succeed.  ld_moved will be true and this
+		 * active balance code will not be triggered.
+		 */
+		if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+		    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
+			return 0;
+
+		if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
+			return 0;
+	}
+
+	return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2);
+}
+
 /*
  * Check this_cpu to ensure it is balanced within domain. Attempt to move
  * tasks if there is an imbalance.
@@ -2902,8 +2935,7 @@ redo:
 		schedstat_inc(sd, lb_failed[idle]);
 		sd->nr_balance_failed++;
 
-		if (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {
-
+		if (need_active_balance(sd, sd_idle, idle)) {
 			raw_spin_lock_irqsave(&busiest->lock, flags);
 
 			/* don't kick the migration_thread, if the curr
@@ -3049,66 +3081,37 @@ redo:
 		int active_balance = 0;
 
 		schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
-		if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-		    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-			return -1;
-
-		if (sched_mc_power_savings < POWERSAVINGS_BALANCE_WAKEUP)
-			return -1;
+		sd->nr_balance_failed++;
 
-		if (sd->nr_balance_failed++ < 2)
-			return -1;
+		if (need_active_balance(sd, sd_idle, CPU_NEWLY_IDLE)) {
+			double_lock_balance(this_rq, busiest);
 
-		/*
-		 * The only task running in a non-idle cpu can be moved to this
-		 * cpu in an attempt to completely freeup the other CPU
-		 * package. The same method used to move task in load_balance()
-		 * have been extended for load_balance_newidle() to speedup
-		 * consolidation at sched_mc=POWERSAVINGS_BALANCE_WAKEUP (2)
-		 *
-		 * The package power saving logic comes from
-		 * find_busiest_group().  If there are no imbalance, then
-		 * f_b_g() will return NULL.  However when sched_mc={1,2} then
-		 * f_b_g() will select a group from which a running task may be
-		 * pulled to this cpu in order to make the other package idle.
-		 * If there is no opportunity to make a package idle and if
-		 * there are no imbalance, then f_b_g() will return NULL and no
-		 * action will be taken in load_balance_newidle().
-		 *
-		 * Under normal task pull operation due to imbalance, there
-		 * will be more than one task in the source run queue and
-		 * move_tasks() will succeed.  ld_moved will be true and this
-		 * active balance code will not be triggered.
-		 */
+			/*
+			 * don't kick the migration_thread, if the curr
+			 * task on busiest cpu can't be moved to this_cpu
+			 */
+			if (!cpumask_test_cpu(this_cpu,
+					      &busiest->curr->cpus_allowed)) {
+				double_unlock_balance(this_rq, busiest);
+				all_pinned = 1;
+				return ld_moved;
+			}
 
-		/* Lock busiest in correct order while this_rq is held */
-		double_lock_balance(this_rq, busiest);
+			if (!busiest->active_balance) {
+				busiest->active_balance = 1;
+				busiest->push_cpu = this_cpu;
+				active_balance = 1;
+			}
 
-		/*
-		 * don't kick the migration_thread, if the curr
-		 * task on busiest cpu can't be moved to this_cpu
-		 */
-		if (!cpumask_test_cpu(this_cpu, &busiest->curr->cpus_allowed)) {
 			double_unlock_balance(this_rq, busiest);
-			all_pinned = 1;
-			return ld_moved;
-		}
-
-		if (!busiest->active_balance) {
-			busiest->active_balance = 1;
-			busiest->push_cpu = this_cpu;
-			active_balance = 1;
+			/*
+			 * Should not call ttwu while holding a rq->lock
+			 */
+			raw_spin_unlock(&this_rq->lock);
+			if (active_balance)
+				wake_up_process(busiest->migration_thread);
+			raw_spin_lock(&this_rq->lock);
 		}
-
-		double_unlock_balance(this_rq, busiest);
-		/*
-		 * Should not call ttwu while holding a rq->lock
-		 */
-		raw_spin_unlock(&this_rq->lock);
-		if (active_balance)
-			wake_up_process(busiest->migration_thread);
-		raw_spin_lock(&this_rq->lock);
-
 	} else
 		sd->nr_balance_failed = 0;
 

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

* [tip:sched/core] sched: Remove load_balance_newidle()
       [not found]             ` <new-submission>
                                 ` (474 preceding siblings ...)
  2010-01-21 13:53               ` [tip:sched/core] sched: Unify load_balance{,_newidle}() tip-bot for Peter Zijlstra
@ 2010-01-21 13:53               ` tip-bot for Peter Zijlstra
  2010-01-21 13:54               ` [tip:sched/core] sched: Assume *balance is valid tip-bot for Peter Zijlstra
                                 ` (230 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  f492e12ef050e02bf0185b6b57874992591b9be1
Gitweb:     http://git.kernel.org/tip/f492e12ef050e02bf0185b6b57874992591b9be1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 23 Dec 2009 15:29:42 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:14 +0100

sched: Remove load_balance_newidle()

The two functions: load_balance{,_newidle}() are very similar, with the
following differences:

 - rq->lock usage
 - sb->balance_interval updates
 - *balance check

So remove the load_balance_newidle() call with load_balance(.idle =
CPU_NEWLY_IDLE), explicitly unlock the rq->lock before calling (would be
done by double_lock_balance() anyway), and ignore the other differences
for now.

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 |  135 +++++----------------------------------------------
 1 files changed, 13 insertions(+), 122 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 1040832..de5ab12 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -3010,125 +3010,6 @@ out:
 }
 
 /*
- * Check this_cpu to ensure it is balanced within domain. Attempt to move
- * tasks if there is an imbalance.
- *
- * Called from schedule when this_rq is about to become idle (CPU_NEWLY_IDLE).
- * this_rq is locked.
- */
-static int
-load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
-{
-	struct sched_group *group;
-	struct rq *busiest = NULL;
-	unsigned long imbalance;
-	int ld_moved = 0;
-	int sd_idle = 0;
-	int all_pinned = 0;
-	struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
-
-	cpumask_copy(cpus, cpu_active_mask);
-
-	/*
-	 * When power savings policy is enabled for the parent domain, idle
-	 * sibling can pick up load irrespective of busy siblings. In this case,
-	 * let the state of idle sibling percolate up as IDLE, instead of
-	 * portraying it as CPU_NOT_IDLE.
-	 */
-	if (sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		sd_idle = 1;
-
-	schedstat_inc(sd, lb_count[CPU_NEWLY_IDLE]);
-redo:
-	update_shares_locked(this_rq, sd);
-	group = find_busiest_group(sd, this_cpu, &imbalance, CPU_NEWLY_IDLE,
-				   &sd_idle, cpus, NULL);
-	if (!group) {
-		schedstat_inc(sd, lb_nobusyg[CPU_NEWLY_IDLE]);
-		goto out_balanced;
-	}
-
-	busiest = find_busiest_queue(group, CPU_NEWLY_IDLE, imbalance, cpus);
-	if (!busiest) {
-		schedstat_inc(sd, lb_nobusyq[CPU_NEWLY_IDLE]);
-		goto out_balanced;
-	}
-
-	BUG_ON(busiest == this_rq);
-
-	schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
-
-	ld_moved = 0;
-	if (busiest->nr_running > 1) {
-		/* Attempt to move tasks */
-		double_lock_balance(this_rq, busiest);
-		/* this_rq->clock is already updated */
-		update_rq_clock(busiest);
-		ld_moved = move_tasks(this_rq, this_cpu, busiest,
-					imbalance, sd, CPU_NEWLY_IDLE,
-					&all_pinned);
-		double_unlock_balance(this_rq, busiest);
-
-		if (unlikely(all_pinned)) {
-			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
-				goto redo;
-		}
-	}
-
-	if (!ld_moved) {
-		int active_balance = 0;
-
-		schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
-		sd->nr_balance_failed++;
-
-		if (need_active_balance(sd, sd_idle, CPU_NEWLY_IDLE)) {
-			double_lock_balance(this_rq, busiest);
-
-			/*
-			 * don't kick the migration_thread, if the curr
-			 * task on busiest cpu can't be moved to this_cpu
-			 */
-			if (!cpumask_test_cpu(this_cpu,
-					      &busiest->curr->cpus_allowed)) {
-				double_unlock_balance(this_rq, busiest);
-				all_pinned = 1;
-				return ld_moved;
-			}
-
-			if (!busiest->active_balance) {
-				busiest->active_balance = 1;
-				busiest->push_cpu = this_cpu;
-				active_balance = 1;
-			}
-
-			double_unlock_balance(this_rq, busiest);
-			/*
-			 * Should not call ttwu while holding a rq->lock
-			 */
-			raw_spin_unlock(&this_rq->lock);
-			if (active_balance)
-				wake_up_process(busiest->migration_thread);
-			raw_spin_lock(&this_rq->lock);
-		}
-	} else
-		sd->nr_balance_failed = 0;
-
-	update_shares_locked(this_rq, sd);
-	return ld_moved;
-
-out_balanced:
-	schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
-	if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
-	    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
-		return -1;
-	sd->nr_balance_failed = 0;
-
-	return 0;
-}
-
-/*
  * idle_balance is called by schedule() if this_cpu is about to become
  * idle. Attempts to pull tasks from other CPUs.
  */
@@ -3143,16 +3024,23 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
 	if (this_rq->avg_idle < sysctl_sched_migration_cost)
 		return;
 
+	/*
+	 * Drop the rq->lock, but keep IRQ/preempt disabled.
+	 */
+	raw_spin_unlock(&this_rq->lock);
+
 	for_each_domain(this_cpu, sd) {
 		unsigned long interval;
+		int balance = 1;
 
 		if (!(sd->flags & SD_LOAD_BALANCE))
 			continue;
 
-		if (sd->flags & SD_BALANCE_NEWIDLE)
+		if (sd->flags & SD_BALANCE_NEWIDLE) {
 			/* If we've pulled tasks over stop searching: */
-			pulled_task = load_balance_newidle(this_cpu, this_rq,
-							   sd);
+			pulled_task = load_balance(this_cpu, this_rq,
+						   sd, CPU_NEWLY_IDLE, &balance);
+		}
 
 		interval = msecs_to_jiffies(sd->balance_interval);
 		if (time_after(next_balance, sd->last_balance + interval))
@@ -3162,6 +3050,9 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
 			break;
 		}
 	}
+
+	raw_spin_lock(&this_rq->lock);
+
 	if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
 		/*
 		 * We are going idle. next_balance may be set based on

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

* [tip:sched/core] sched: Assume *balance is valid
       [not found]             ` <new-submission>
                                 ` (475 preceding siblings ...)
  2010-01-21 13:53               ` [tip:sched/core] sched: Remove load_balance_newidle() tip-bot for Peter Zijlstra
@ 2010-01-21 13:54               ` tip-bot for Peter Zijlstra
  2010-01-21 13:55               ` [tip:perf/urgent] perf: Change the is_software_event() definition tip-bot for Peter Zijlstra
                                 ` (229 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8f190fb3f7a405682666d3723f6ec370b5afe4da
Gitweb:     http://git.kernel.org/tip/8f190fb3f7a405682666d3723f6ec370b5afe4da
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 24 Dec 2009 14:18:21 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:15 +0100

sched: Assume *balance is valid

Since all load_balance() callers will have !NULL balance parameters we
can now assume so and remove a few checks.

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 |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index de5ab12..0b482f5 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -2465,7 +2465,7 @@ static inline void update_sg_lb_stats(struct sched_domain *sd,
 	 * to do the newly idle load balance.
 	 */
 	if (idle != CPU_NEWLY_IDLE && local_group &&
-	    balance_cpu != this_cpu && balance) {
+	    balance_cpu != this_cpu) {
 		*balance = 0;
 		return;
 	}
@@ -2528,7 +2528,7 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
 		update_sg_lb_stats(sd, group, this_cpu, idle, load_idx, sd_idle,
 				local_group, cpus, balance, &sgs);
 
-		if (local_group && balance && !(*balance))
+		if (local_group && !(*balance))
 			return;
 
 		sds->total_load += sgs.group_load;
@@ -2720,7 +2720,7 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
 	 * 5) The imbalance is within the specified limit.
 	 * 6) Any rebalance would lead to ping-pong
 	 */
-	if (balance && !(*balance))
+	if (!(*balance))
 		goto ret;
 
 	if (!sds.busiest || sds.busiest_nr_running == 0)

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

* [tip:perf/urgent] perf: Change the is_software_event() definition
       [not found]             ` <new-submission>
                                 ` (476 preceding siblings ...)
  2010-01-21 13:54               ` [tip:sched/core] sched: Assume *balance is valid tip-bot for Peter Zijlstra
@ 2010-01-21 13:55               ` tip-bot for Peter Zijlstra
  2010-01-27 13:16               ` [tip:perf/core] perf: Reimplement frequency driven sampling tip-bot for Peter Zijlstra
                                 ` (228 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-21 13:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  92b6759857ea3ad19bc6871044e373f6251841d3
Gitweb:     http://git.kernel.org/tip/92b6759857ea3ad19bc6871044e373f6251841d3
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 18 Jan 2010 14:02:16 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jan 2010 13:40:40 +0100

perf: Change the is_software_event() definition

The is_software_event() definition always confuses me because its an
exclusive expression, make it an inclusive one.

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_event.h |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c66b34f..8fa7187 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -814,9 +814,14 @@ extern int perf_event_overflow(struct perf_event *event, int nmi,
  */
 static inline int is_software_event(struct perf_event *event)
 {
-	return (event->attr.type != PERF_TYPE_RAW) &&
-		(event->attr.type != PERF_TYPE_HARDWARE) &&
-		(event->attr.type != PERF_TYPE_HW_CACHE);
+	switch (event->attr.type) {
+	case PERF_TYPE_SOFTWARE:
+	case PERF_TYPE_TRACEPOINT:
+	/* for now the breakpoint stuff also works as software event */
+	case PERF_TYPE_BREAKPOINT:
+		return 1;
+	}
+	return 0;
 }
 
 extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];

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

* [tip:perf/core] perf: Reimplement frequency driven sampling
       [not found]             ` <new-submission>
                                 ` (477 preceding siblings ...)
  2010-01-21 13:55               ` [tip:perf/urgent] perf: Change the is_software_event() definition tip-bot for Peter Zijlstra
@ 2010-01-27 13:16               ` tip-bot for Peter Zijlstra
  2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Optimize x86_pmu_disable() tip-bot for Peter Zijlstra
                                 ` (227 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-27 13:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  abd50713944c8ea9e0af5b7bffa0aacae21cc91a
Gitweb:     http://git.kernel.org/tip/abd50713944c8ea9e0af5b7bffa0aacae21cc91a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 26 Jan 2010 18:50:16 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 Jan 2010 08:39:33 +0100

perf: Reimplement frequency driven sampling

There was a bug in the old period code that caused intel_pmu_enable_all()
or native_write_msr_safe() to show up quite high in the profiles.

In staring at that code it made my head hurt, so I rewrote it in a
hopefully simpler fashion. Its now fully symetric between tick and
overflow driven adjustments and uses less data to boot.

The only complication is that it basically wants to do a u128 division.
The code approximates that in a rather simple truncate until it fits
fashion, taking care to balance the terms while truncating.

This version does not generate that sampling artefact.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    5 +-
 kernel/perf_event.c        |  132 ++++++++++++++++++++++++++++++-------------
 2 files changed, 94 insertions(+), 43 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c6f812e..72b2615 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -498,9 +498,8 @@ struct hw_perf_event {
 	atomic64_t			period_left;
 	u64				interrupts;
 
-	u64				freq_count;
-	u64				freq_interrupts;
-	u64				freq_stamp;
+	u64				freq_time_stamp;
+	u64				freq_count_stamp;
 #endif
 };
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index edc46b9..251fb95 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1423,14 +1423,83 @@ void perf_event_task_sched_in(struct task_struct *task)
 
 static void perf_log_throttle(struct perf_event *event, int enable);
 
-static void perf_adjust_period(struct perf_event *event, u64 events)
+static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)
+{
+	u64 frequency = event->attr.sample_freq;
+	u64 sec = NSEC_PER_SEC;
+	u64 divisor, dividend;
+
+	int count_fls, nsec_fls, frequency_fls, sec_fls;
+
+	count_fls = fls64(count);
+	nsec_fls = fls64(nsec);
+	frequency_fls = fls64(frequency);
+	sec_fls = 30;
+
+	/*
+	 * We got @count in @nsec, with a target of sample_freq HZ
+	 * the target period becomes:
+	 *
+	 *             @count * 10^9
+	 * period = -------------------
+	 *          @nsec * sample_freq
+	 *
+	 */
+
+	/*
+	 * Reduce accuracy by one bit such that @a and @b converge
+	 * to a similar magnitude.
+	 */
+#define REDUCE_FLS(a, b) 		\
+do {					\
+	if (a##_fls > b##_fls) {	\
+		a >>= 1;		\
+		a##_fls--;		\
+	} else {			\
+		b >>= 1;		\
+		b##_fls--;		\
+	}				\
+} while (0)
+
+	/*
+	 * Reduce accuracy until either term fits in a u64, then proceed with
+	 * the other, so that finally we can do a u64/u64 division.
+	 */
+	while (count_fls + sec_fls > 64 && nsec_fls + frequency_fls > 64) {
+		REDUCE_FLS(nsec, frequency);
+		REDUCE_FLS(sec, count);
+	}
+
+	if (count_fls + sec_fls > 64) {
+		divisor = nsec * frequency;
+
+		while (count_fls + sec_fls > 64) {
+			REDUCE_FLS(count, sec);
+			divisor >>= 1;
+		}
+
+		dividend = count * sec;
+	} else {
+		dividend = count * sec;
+
+		while (nsec_fls + frequency_fls > 64) {
+			REDUCE_FLS(nsec, frequency);
+			dividend >>= 1;
+		}
+
+		divisor = nsec * frequency;
+	}
+
+	return div64_u64(dividend, divisor);
+}
+
+static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	u64 period, sample_period;
 	s64 delta;
 
-	events *= hwc->sample_period;
-	period = div64_u64(events, event->attr.sample_freq);
+	period = perf_calculate_period(event, nsec, count);
 
 	delta = (s64)(period - hwc->sample_period);
 	delta = (delta + 7) / 8; /* low pass filter */
@@ -1441,13 +1510,22 @@ static void perf_adjust_period(struct perf_event *event, u64 events)
 		sample_period = 1;
 
 	hwc->sample_period = sample_period;
+
+	if (atomic64_read(&hwc->period_left) > 8*sample_period) {
+		perf_disable();
+		event->pmu->disable(event);
+		atomic64_set(&hwc->period_left, 0);
+		event->pmu->enable(event);
+		perf_enable();
+	}
 }
 
 static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 {
 	struct perf_event *event;
 	struct hw_perf_event *hwc;
-	u64 interrupts, freq;
+	u64 interrupts, now;
+	s64 delta;
 
 	raw_spin_lock(&ctx->lock);
 	list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
@@ -1468,44 +1546,18 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(event, 1);
 			event->pmu->unthrottle(event);
-			interrupts = 2*sysctl_perf_event_sample_rate/HZ;
 		}
 
 		if (!event->attr.freq || !event->attr.sample_freq)
 			continue;
 
-		/*
-		 * if the specified freq < HZ then we need to skip ticks
-		 */
-		if (event->attr.sample_freq < HZ) {
-			freq = event->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;
-
-		perf_adjust_period(event, freq * interrupts);
+		event->pmu->read(event);
+		now = atomic64_read(&event->count);
+		delta = now - hwc->freq_count_stamp;
+		hwc->freq_count_stamp = now;
 
-		/*
-		 * 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();
-			event->pmu->disable(event);
-			atomic64_set(&hwc->period_left, 0);
-			event->pmu->enable(event);
-			perf_enable();
-		}
+		if (delta > 0)
+			perf_adjust_period(event, TICK_NSEC, delta);
 	}
 	raw_spin_unlock(&ctx->lock);
 }
@@ -3768,12 +3820,12 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
 
 	if (event->attr.freq) {
 		u64 now = perf_clock();
-		s64 delta = now - hwc->freq_stamp;
+		s64 delta = now - hwc->freq_time_stamp;
 
-		hwc->freq_stamp = now;
+		hwc->freq_time_stamp = now;
 
-		if (delta > 0 && delta < TICK_NSEC)
-			perf_adjust_period(event, NSEC_PER_SEC / (int)delta);
+		if (delta > 0 && delta < 2*TICK_NSEC)
+			perf_adjust_period(event, delta, hwc->last_period);
 	}
 
 	/*

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

* [tip:perf/core] perf_event: x86: Optimize x86_pmu_disable()
       [not found]             ` <new-submission>
                                 ` (478 preceding siblings ...)
  2010-01-27 13:16               ` [tip:perf/core] perf: Reimplement frequency driven sampling tip-bot for Peter Zijlstra
@ 2010-01-29  9:29               ` tip-bot for Peter Zijlstra
  2010-01-29  9:29               ` [tip:perf/core] perf, x86: Clean up event constraints code a bit tip-bot for Ingo Molnar
                                 ` (226 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-29  9:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6c9687abeb24d5b7aae7db5be070c2139ad29e29
Gitweb:     http://git.kernel.org/tip/6c9687abeb24d5b7aae7db5be070c2139ad29e29
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 25 Jan 2010 11:57:25 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 Jan 2010 09:01:43 +0100

perf_event: x86: Optimize x86_pmu_disable()

x86_pmu_disable() removes the event from the cpuc->event_list[], however
since an event can only be on that list once, stop looking after we found
it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 33c889f..66de282 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1884,6 +1884,7 @@ static void x86_pmu_disable(struct perf_event *event)
 				cpuc->event_list[i-1] = cpuc->event_list[i];
 
 			--cpuc->n_events;
+			break;
 		}
 	}
 	perf_event_update_userpage(event);

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

* [tip:perf/core] perf, x86: Clean up event constraints code a bit
       [not found]             ` <new-submission>
                                 ` (479 preceding siblings ...)
  2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Optimize x86_pmu_disable() tip-bot for Peter Zijlstra
@ 2010-01-29  9:29               ` tip-bot for Ingo Molnar
  2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Deduplicate the disable code tip-bot for Peter Zijlstra
                                 ` (225 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-01-29  9:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  184f412c3341cd24fbd26604634a5800b83dbdc3
Gitweb:     http://git.kernel.org/tip/184f412c3341cd24fbd26604634a5800b83dbdc3
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 27 Jan 2010 08:39:39 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 Jan 2010 09:01:44 +0100

perf, x86: Clean up event constraints code a bit

- Remove stray debug code
 - Improve ugly macros a bit
 - Remove some whitespace damage
 - (Also fix up some accumulated damage in perf_event.h)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
---
 arch/x86/kernel/cpu/perf_event.c |   37 ++++++++-----------------------------
 include/linux/perf_event.h       |   24 +++++++++++-------------
 2 files changed, 19 insertions(+), 42 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 66de282..fdbe248 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -93,24 +93,19 @@ struct cpu_hw_events {
 	struct perf_event	*event_list[X86_PMC_IDX_MAX]; /* in enabled order */
 };
 
-#define EVENT_CONSTRAINT(c, n, m) { 	\
+#define EVENT_CONSTRAINT(c, n, m) {	\
 	{ .idxmsk64[0] = (n) },		\
 	.code = (c),			\
 	.cmask = (m),			\
 	.weight = HWEIGHT64((u64)(n)),	\
 }
 
-#define INTEL_EVENT_CONSTRAINT(c, n)	\
-	EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
+#define INTEL_EVENT_CONSTRAINT(c, n)		EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
+#define FIXED_EVENT_CONSTRAINT(c, n)		EVENT_CONSTRAINT(c, n, INTEL_ARCH_FIXED_MASK)
 
-#define FIXED_EVENT_CONSTRAINT(c, n)	\
-	EVENT_CONSTRAINT(c, n, INTEL_ARCH_FIXED_MASK)
+#define EVENT_CONSTRAINT_END			EVENT_CONSTRAINT(0, 0, 0)
 
-#define EVENT_CONSTRAINT_END \
-	EVENT_CONSTRAINT(0, 0, 0)
-
-#define for_each_event_constraint(e, c) \
-	for ((e) = (c); (e)->cmask; (e)++)
+#define for_each_event_constraint(e, c)		for ((e) = (c); (e)->cmask; (e)++)
 
 /*
  * struct x86_pmu - generic x86 pmu
@@ -1276,14 +1271,6 @@ static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
 		if (test_bit(hwc->idx, used_mask))
 			break;
 
-#if 0
-		pr_debug("CPU%d fast config=0x%llx idx=%d assign=%c\n",
-			 smp_processor_id(),
-			 hwc->config,
-			 hwc->idx,
-			 assign ? 'y' : 'n');
-#endif
-
 		set_bit(hwc->idx, used_mask);
 		if (assign)
 			assign[i] = hwc->idx;
@@ -1333,14 +1320,6 @@ static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
 			if (j == X86_PMC_IDX_MAX)
 				break;
 
-#if 0
-			pr_debug("CPU%d slow config=0x%llx idx=%d assign=%c\n",
-				smp_processor_id(),
-				hwc->config,
-				j,
-				assign ? 'y' : 'n');
-#endif
-
 			set_bit(j, used_mask);
 
 			if (assign)
@@ -2596,9 +2575,9 @@ static const struct pmu pmu = {
  * validate a single event group
  *
  * validation include:
- * 	- check events are compatible which each other
- * 	- events do not compete for the same counter
- * 	- number of events <= number of counters
+ *	- check events are compatible which each other
+ *	- events do not compete for the same counter
+ *	- number of events <= number of counters
  *
  * validation ensures the group can be loaded onto the
  * PMU if it was the only group available.
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 72b2615..953c177 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -290,7 +290,7 @@ struct perf_event_mmap_page {
 };
 
 #define PERF_RECORD_MISC_CPUMODE_MASK		(3 << 0)
-#define PERF_RECORD_MISC_CPUMODE_UNKNOWN		(0 << 0)
+#define PERF_RECORD_MISC_CPUMODE_UNKNOWN	(0 << 0)
 #define PERF_RECORD_MISC_KERNEL			(1 << 0)
 #define PERF_RECORD_MISC_USER			(2 << 0)
 #define PERF_RECORD_MISC_HYPERVISOR		(3 << 0)
@@ -356,8 +356,8 @@ enum perf_event_type {
 	 *	u64				stream_id;
 	 * };
 	 */
-	PERF_RECORD_THROTTLE		= 5,
-	PERF_RECORD_UNTHROTTLE		= 6,
+	PERF_RECORD_THROTTLE			= 5,
+	PERF_RECORD_UNTHROTTLE			= 6,
 
 	/*
 	 * struct {
@@ -371,10 +371,10 @@ enum perf_event_type {
 
 	/*
 	 * struct {
-	 * 	struct perf_event_header	header;
-	 * 	u32				pid, tid;
+	 *	struct perf_event_header	header;
+	 *	u32				pid, tid;
 	 *
-	 * 	struct read_format		values;
+	 *	struct read_format		values;
 	 * };
 	 */
 	PERF_RECORD_READ			= 8,
@@ -412,7 +412,7 @@ enum perf_event_type {
 	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
 	 * };
 	 */
-	PERF_RECORD_SAMPLE		= 9,
+	PERF_RECORD_SAMPLE			= 9,
 
 	PERF_RECORD_MAX,			/* non-ABI */
 };
@@ -752,8 +752,7 @@ extern int perf_max_events;
 extern const struct pmu *hw_perf_event_init(struct perf_event *event);
 
 extern void perf_event_task_sched_in(struct task_struct *task);
-extern void perf_event_task_sched_out(struct task_struct *task,
-					struct task_struct *next);
+extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
 extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
@@ -853,8 +852,7 @@ extern int sysctl_perf_event_mlock;
 extern int sysctl_perf_event_sample_rate;
 
 extern void perf_event_init(void);
-extern void perf_tp_event(int event_id, u64 addr, u64 count,
-				 void *record, int entry_size);
+extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
@@ -895,13 +893,13 @@ static inline void
 perf_sw_event(u32 event_id, u64 nr, int nmi,
 		     struct pt_regs *regs, u64 addr)			{ }
 static inline void
-perf_bp_event(struct perf_event *event, void *data)		{ }
+perf_bp_event(struct perf_event *event, void *data)			{ }
 
 static inline void perf_event_mmap(struct vm_area_struct *vma)		{ }
 static inline void perf_event_comm(struct task_struct *tsk)		{ }
 static inline void perf_event_fork(struct task_struct *tsk)		{ }
 static inline void perf_event_init(void)				{ }
-static inline int  perf_swevent_get_recursion_context(void)  { return -1; }
+static inline int  perf_swevent_get_recursion_context(void)		{ return -1; }
 static inline void perf_swevent_put_recursion_context(int rctx)		{ }
 static inline void perf_event_enable(struct perf_event *event)		{ }
 static inline void perf_event_disable(struct perf_event *event)		{ }

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

* [tip:perf/core] perf_event: x86: Deduplicate the disable code
       [not found]             ` <new-submission>
                                 ` (480 preceding siblings ...)
  2010-01-29  9:29               ` [tip:perf/core] perf, x86: Clean up event constraints code a bit tip-bot for Ingo Molnar
@ 2010-01-29  9:29               ` tip-bot for Peter Zijlstra
  2010-01-31  8:30               ` [tip:perf/core] Revert "perf record: Intercept all events" tip-bot for Hitoshi Mitake
                                 ` (224 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-01-29  9:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  2e8418736dff9c6fdadb2f87dcc2087cebf32167
Gitweb:     http://git.kernel.org/tip/2e8418736dff9c6fdadb2f87dcc2087cebf32167
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 25 Jan 2010 15:58:43 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 29 Jan 2010 09:01:45 +0100

perf_event: x86: Deduplicate the disable code

Share the meat of the x86_pmu_disable() code with hw_perf_enable().

Also remove the barrier() from that code, since I could not convince
myself we actually need it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index fdbe248..07fa0c2 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1401,6 +1401,8 @@ static inline void x86_assign_hw_event(struct perf_event *event,
 	}
 }
 
+static void __x86_pmu_disable(struct perf_event *event, struct cpu_hw_events *cpuc);
+
 void hw_perf_enable(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1426,13 +1428,7 @@ void hw_perf_enable(void)
 			if (hwc->idx == -1 || hwc->idx == cpuc->assign[i])
 				continue;
 
-			x86_pmu.disable(hwc, hwc->idx);
-
-			clear_bit(hwc->idx, cpuc->active_mask);
-			barrier();
-			cpuc->events[hwc->idx] = NULL;
-
-			x86_perf_event_update(event, hwc, hwc->idx);
+			__x86_pmu_disable(event, cpuc);
 
 			hwc->idx = -1;
 		}
@@ -1822,11 +1818,10 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
 	event->pending_kill = POLL_IN;
 }
 
-static void x86_pmu_disable(struct perf_event *event)
+static void __x86_pmu_disable(struct perf_event *event, struct cpu_hw_events *cpuc)
 {
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	int i, idx = hwc->idx;
+	int idx = hwc->idx;
 
 	/*
 	 * Must be done before we disable, otherwise the nmi handler
@@ -1836,12 +1831,6 @@ static void x86_pmu_disable(struct perf_event *event)
 	x86_pmu.disable(hwc, idx);
 
 	/*
-	 * Make sure the cleared pointer becomes visible before we
-	 * (potentially) free the event:
-	 */
-	barrier();
-
-	/*
 	 * Drain the remaining delta count out of a event
 	 * that we are disabling:
 	 */
@@ -1852,6 +1841,14 @@ static void x86_pmu_disable(struct perf_event *event)
 		intel_pmu_drain_bts_buffer(cpuc);
 
 	cpuc->events[idx] = NULL;
+}
+
+static void x86_pmu_disable(struct perf_event *event)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int i;
+
+	__x86_pmu_disable(event, cpuc);
 
 	for (i = 0; i < cpuc->n_events; i++) {
 		if (event == cpuc->event_list[i]) {

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

* [tip:perf/core] Revert "perf record: Intercept all events"
       [not found]             ` <new-submission>
                                 ` (481 preceding siblings ...)
  2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Deduplicate the disable code tip-bot for Peter Zijlstra
@ 2010-01-31  8:30               ` tip-bot for Hitoshi Mitake
  2010-02-04  9:52               ` [tip:x86/debug] x86_64: Print modules like i386 does tip-bot for Alexey Dobriyan
                                 ` (223 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Hitoshi Mitake @ 2010-01-31  8:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	mitake, fweisbec, tglx, mingo

Commit-ID:  a8e6f734ce9a79d44ebb296f2a341f435227b34e
Gitweb:     http://git.kernel.org/tip/a8e6f734ce9a79d44ebb296f2a341f435227b34e
Author:     Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
AuthorDate: Sat, 30 Jan 2010 20:55:41 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 31 Jan 2010 08:27:52 +0100

Revert "perf record: Intercept all events"

This reverts commit f5a2c3dce03621b55f84496f58adc2d1a87ca16f.

This patch is required for making "perf lock rec" work.
The commit f5a2c3dce0 changes write_event() of builtin-record.c
. And changed write_event() sometimes doesn't stop with perf
lock rec.

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>
[ that commit also causes perf record to not be Ctrl-C-able,
  and it's concetually wrong to parse the data at record time
  (unconditionally - even when not needed), as we eventually
  want to be able to do zero-copy recording, at least for
  non-archive recordings.  ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-record.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 9034522..eea5691 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -113,24 +113,16 @@ static void write_output(void *buf, size_t size)
 
 static void write_event(event_t *buf, size_t size)
 {
-	size_t processed_size = buf->header.size;
-	event_t *ev = buf;
-
-	do {
-		/*
-		* Add it to the list of DSOs, so that when we finish this
-		 * record session we can pick the available build-ids.
-		 */
-		if (ev->header.type == PERF_RECORD_MMAP) {
-			struct list_head *head = &dsos__user;
-			if (ev->header.misc == 1)
-				head = &dsos__kernel;
-			__dsos__findnew(head, ev->mmap.filename);
-		}
-
-		ev = ((void *)ev) + ev->header.size;
-		processed_size += ev->header.size;
-	} while (processed_size < size);
+	/*
+	* Add it to the list of DSOs, so that when we finish this
+	 * record session we can pick the available build-ids.
+	 */
+	if (buf->header.type == PERF_RECORD_MMAP) {
+		struct list_head *head = &dsos__user;
+		if (buf->mmap.header.misc == 1)
+			head = &dsos__kernel;
+		__dsos__findnew(head, buf->mmap.filename);
+	}
 
 	write_output(buf, size);
 }

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

* [tip:x86/debug] x86_64: Print modules like i386 does
       [not found]             ` <new-submission>
                                 ` (482 preceding siblings ...)
  2010-01-31  8:30               ` [tip:perf/core] Revert "perf record: Intercept all events" tip-bot for Hitoshi Mitake
@ 2010-02-04  9:52               ` tip-bot for Alexey Dobriyan
  2010-02-04  9:56               ` [tip:perf/core] perf_events: Optimize perf_event_task_tick() tip-bot for Peter Zijlstra
                                 ` (222 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Alexey Dobriyan @ 2010-02-04  9:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, arjan, akpm, tglx, mingo, adobriyan

Commit-ID:  f266d7f5f89652a68e21e9882c44ee9104ad8d61
Gitweb:     http://git.kernel.org/tip/f266d7f5f89652a68e21e9882c44ee9104ad8d61
Author:     Alexey Dobriyan <adobriyan@gmail.com>
AuthorDate: Wed, 3 Feb 2010 21:21:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Feb 2010 09:27:56 +0100

x86_64: Print modules like i386 does

Print modules list during kernel BUG.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/dumpstack_64.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 0ad9597..907a90e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -291,6 +291,7 @@ void show_registers(struct pt_regs *regs)
 
 	sp = regs->sp;
 	printk("CPU %d ", cpu);
+	print_modules();
 	__show_regs(regs, 1);
 	printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
 		cur->comm, cur->pid, task_thread_info(cur), cur);

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

* [tip:perf/core] perf_events: Optimize perf_event_task_tick()
       [not found]             ` <new-submission>
                                 ` (483 preceding siblings ...)
  2010-02-04  9:52               ` [tip:x86/debug] x86_64: Print modules like i386 does tip-bot for Alexey Dobriyan
@ 2010-02-04  9:56               ` tip-bot for Peter Zijlstra
  2010-02-04  9:56               ` [tip:perf/core] perf_events, x86: Implement intel core solo/duo support tip-bot for Peter Zijlstra
                                 ` (221 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-04  9:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  9717e6cd3db22eade7dbae0fc9235c66325a7132
Gitweb:     http://git.kernel.org/tip/9717e6cd3db22eade7dbae0fc9235c66325a7132
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 28 Jan 2010 13:57:44 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Feb 2010 09:59:49 +0100

perf_events: Optimize perf_event_task_tick()

Pretty much all of the calls do perf_disable/perf_enable cycles, pull
that out to cut back on hardware programming.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 40f8b07..087025f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1573,12 +1573,8 @@ static void rotate_ctx(struct perf_event_context *ctx)
 	raw_spin_lock(&ctx->lock);
 
 	/* Rotate the first entry last of non-pinned groups */
-	perf_disable();
-
 	list_rotate_left(&ctx->flexible_groups);
 
-	perf_enable();
-
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -1593,6 +1589,8 @@ void perf_event_task_tick(struct task_struct *curr)
 	cpuctx = &__get_cpu_var(perf_cpu_context);
 	ctx = curr->perf_event_ctxp;
 
+	perf_disable();
+
 	perf_ctx_adjust_freq(&cpuctx->ctx);
 	if (ctx)
 		perf_ctx_adjust_freq(ctx);
@@ -1608,6 +1606,8 @@ void perf_event_task_tick(struct task_struct *curr)
 	cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
 		task_ctx_sched_in(curr, EVENT_FLEXIBLE);
+
+	perf_enable();
 }
 
 static int event_enable_on_exec(struct perf_event *event,

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

* [tip:perf/core] perf_events, x86: Implement intel core solo/duo support
       [not found]             ` <new-submission>
                                 ` (484 preceding siblings ...)
  2010-02-04  9:56               ` [tip:perf/core] perf_events: Optimize perf_event_task_tick() tip-bot for Peter Zijlstra
@ 2010-02-04  9:56               ` tip-bot for Peter Zijlstra
  2010-02-04  9:57               ` [tip:perf/core] bitops: Ensure the compile time HWEIGHT is only used for such tip-bot for Peter Zijlstra
                                 ` (220 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-04  9:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, arjan, a.p.zijlstra,
	efault, fweisbec, tglx, mingo

Commit-ID:  8c48e444191de0ff84e85d41180d7bc3e74f14ef
Gitweb:     http://git.kernel.org/tip/8c48e444191de0ff84e85d41180d7bc3e74f14ef
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 29 Jan 2010 13:25:31 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Feb 2010 09:59:49 +0100

perf_events, x86: Implement intel core solo/duo support

Implement Intel Core Solo/Duo, aka.
Intel Architectural Performance Monitoring Version 1.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |  133 +++++++++++++++++--------------------
 1 files changed, 61 insertions(+), 72 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 1846ead..5b91992 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -228,6 +228,17 @@ static const u64 intel_perfmon_event_map[] =
 
 static struct event_constraint intel_core_event_constraints[] =
 {
+	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
+	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
+	INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
+	INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
+	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
+	INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FP_COMP_INSTR_RET */
+	EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_core2_event_constraints[] =
+{
 	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
 	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
 	INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
@@ -1216,7 +1227,7 @@ static void intel_pmu_disable_all(void)
 		intel_pmu_disable_bts();
 }
 
-static void amd_pmu_disable_all(void)
+static void x86_pmu_disable_all(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int idx;
@@ -1226,11 +1237,11 @@ static void amd_pmu_disable_all(void)
 
 		if (!test_bit(idx, cpuc->active_mask))
 			continue;
-		rdmsrl(MSR_K7_EVNTSEL0 + idx, val);
+		rdmsrl(x86_pmu.eventsel + idx, val);
 		if (!(val & ARCH_PERFMON_EVENTSEL0_ENABLE))
 			continue;
 		val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
-		wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
+		wrmsrl(x86_pmu.eventsel + idx, val);
 	}
 }
 
@@ -1278,7 +1289,7 @@ static void intel_pmu_enable_all(void)
 	}
 }
 
-static void amd_pmu_enable_all(void)
+static void x86_pmu_enable_all(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int idx;
@@ -1292,7 +1303,7 @@ static void amd_pmu_enable_all(void)
 
 		val = event->hw.config;
 		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-		wrmsrl(MSR_K7_EVNTSEL0 + idx, val);
+		wrmsrl(x86_pmu.eventsel + idx, val);
 	}
 }
 
@@ -1546,7 +1557,7 @@ static inline void intel_pmu_ack_status(u64 ack)
 	wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
 }
 
-static inline void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 {
 	(void)checking_wrmsrl(hwc->config_base + idx,
 			      hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE);
@@ -1598,12 +1609,6 @@ intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
 	x86_pmu_disable_event(hwc, idx);
 }
 
-static inline void
-amd_pmu_disable_event(struct hw_perf_event *hwc, int idx)
-{
-	x86_pmu_disable_event(hwc, idx);
-}
-
 static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
 
 /*
@@ -1723,15 +1728,14 @@ static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 		return;
 	}
 
-	x86_pmu_enable_event(hwc, idx);
+	__x86_pmu_enable_event(hwc, idx);
 }
 
-static void amd_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+static void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-
 	if (cpuc->enabled)
-		x86_pmu_enable_event(hwc, idx);
+		__x86_pmu_enable_event(hwc, idx);
 }
 
 /*
@@ -1988,50 +1992,6 @@ static void intel_pmu_reset(void)
 	local_irq_restore(flags);
 }
 
-static int p6_pmu_handle_irq(struct pt_regs *regs)
-{
-	struct perf_sample_data data;
-	struct cpu_hw_events *cpuc;
-	struct perf_event *event;
-	struct hw_perf_event *hwc;
-	int idx, handled = 0;
-	u64 val;
-
-	data.addr = 0;
-	data.raw = NULL;
-
-	cpuc = &__get_cpu_var(cpu_hw_events);
-
-	for (idx = 0; idx < x86_pmu.num_events; idx++) {
-		if (!test_bit(idx, cpuc->active_mask))
-			continue;
-
-		event = cpuc->events[idx];
-		hwc = &event->hw;
-
-		val = x86_perf_event_update(event, hwc, idx);
-		if (val & (1ULL << (x86_pmu.event_bits - 1)))
-			continue;
-
-		/*
-		 * event overflow
-		 */
-		handled		= 1;
-		data.period	= event->hw.last_period;
-
-		if (!x86_perf_event_set_period(event, hwc, idx))
-			continue;
-
-		if (perf_event_overflow(event, 1, &data, regs))
-			p6_pmu_disable_event(hwc, idx);
-	}
-
-	if (handled)
-		inc_irq_stat(apic_perf_irqs);
-
-	return handled;
-}
-
 /*
  * This handler is triggered by the local APIC, so the APIC IRQ handling
  * rules apply:
@@ -2098,7 +2058,7 @@ again:
 	return 1;
 }
 
-static int amd_pmu_handle_irq(struct pt_regs *regs)
+static int x86_pmu_handle_irq(struct pt_regs *regs)
 {
 	struct perf_sample_data data;
 	struct cpu_hw_events *cpuc;
@@ -2133,7 +2093,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
 			continue;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			amd_pmu_disable_event(hwc, idx);
+			x86_pmu.disable(hwc, idx);
 	}
 
 	if (handled)
@@ -2374,7 +2334,7 @@ static __read_mostly struct notifier_block perf_event_nmi_notifier = {
 
 static __initconst struct x86_pmu p6_pmu = {
 	.name			= "p6",
-	.handle_irq		= p6_pmu_handle_irq,
+	.handle_irq		= x86_pmu_handle_irq,
 	.disable_all		= p6_pmu_disable_all,
 	.enable_all		= p6_pmu_enable_all,
 	.enable			= p6_pmu_enable_event,
@@ -2401,6 +2361,29 @@ static __initconst struct x86_pmu p6_pmu = {
 	.event_constraints	= intel_p6_event_constraints
 };
 
+static __initconst struct x86_pmu core_pmu = {
+	.name			= "core",
+	.handle_irq		= x86_pmu_handle_irq,
+	.disable_all		= x86_pmu_disable_all,
+	.enable_all		= x86_pmu_enable_all,
+	.enable			= x86_pmu_enable_event,
+	.disable		= x86_pmu_disable_event,
+	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
+	.perfctr		= MSR_ARCH_PERFMON_PERFCTR0,
+	.event_map		= intel_pmu_event_map,
+	.raw_event		= intel_pmu_raw_event,
+	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
+	.apic			= 1,
+	/*
+	 * Intel PMCs cannot be accessed sanely above 32 bit width,
+	 * so we install an artificial 1<<31 period regardless of
+	 * the generic event period:
+	 */
+	.max_period		= (1ULL << 31) - 1,
+	.get_event_constraints	= intel_get_event_constraints,
+	.event_constraints	= intel_core_event_constraints,
+};
+
 static __initconst struct x86_pmu intel_pmu = {
 	.name			= "Intel",
 	.handle_irq		= intel_pmu_handle_irq,
@@ -2427,11 +2410,11 @@ static __initconst struct x86_pmu intel_pmu = {
 
 static __initconst struct x86_pmu amd_pmu = {
 	.name			= "AMD",
-	.handle_irq		= amd_pmu_handle_irq,
-	.disable_all		= amd_pmu_disable_all,
-	.enable_all		= amd_pmu_enable_all,
-	.enable			= amd_pmu_enable_event,
-	.disable		= amd_pmu_disable_event,
+	.handle_irq		= x86_pmu_handle_irq,
+	.disable_all		= x86_pmu_disable_all,
+	.enable_all		= x86_pmu_enable_all,
+	.enable			= x86_pmu_enable_event,
+	.disable		= x86_pmu_disable_event,
 	.eventsel		= MSR_K7_EVNTSEL0,
 	.perfctr		= MSR_K7_PERFCTR0,
 	.event_map		= amd_pmu_event_map,
@@ -2498,9 +2481,10 @@ static __init int intel_pmu_init(void)
 
 	version = eax.split.version_id;
 	if (version < 2)
-		return -ENODEV;
+		x86_pmu = core_pmu;
+	else
+		x86_pmu = intel_pmu;
 
-	x86_pmu				= intel_pmu;
 	x86_pmu.version			= version;
 	x86_pmu.num_events		= eax.split.num_events;
 	x86_pmu.event_bits		= eax.split.bit_width;
@@ -2510,12 +2494,17 @@ static __init int intel_pmu_init(void)
 	 * Quirk: v2 perfmon does not report fixed-purpose events, so
 	 * assume at least 3 events:
 	 */
-	x86_pmu.num_events_fixed	= max((int)edx.split.num_events_fixed, 3);
+	if (version > 1)
+		x86_pmu.num_events_fixed = max((int)edx.split.num_events_fixed, 3);
 
 	/*
 	 * Install the hw-cache-events table:
 	 */
 	switch (boot_cpu_data.x86_model) {
+	case 14: /* 65 nm core solo/duo, "Yonah" */
+		pr_cont("Core events, ");
+		break;
+
 	case 15: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
 	case 22: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
 	case 23: /* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
@@ -2523,7 +2512,7 @@ static __init int intel_pmu_init(void)
 		memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 
-		x86_pmu.event_constraints = intel_core_event_constraints;
+		x86_pmu.event_constraints = intel_core2_event_constraints;
 		pr_cont("Core2 events, ");
 		break;
 

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

* [tip:perf/core] bitops: Ensure the compile time HWEIGHT is only used for such
       [not found]             ` <new-submission>
                                 ` (485 preceding siblings ...)
  2010-02-04  9:56               ` [tip:perf/core] perf_events, x86: Implement intel core solo/duo support tip-bot for Peter Zijlstra
@ 2010-02-04  9:57               ` tip-bot for Peter Zijlstra
  2010-02-04 10:27                 ` [PATCH] bitops: Optimize hweight() by making use of compile-time evaluation Peter Zijlstra
  2010-02-26 10:24               ` [tip:perf/core] perf_events: Report the MMAP pgoff value in bytes tip-bot for Peter Zijlstra
                                 ` (219 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-04  9:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, akpm, a.p.zijlstra, tglx, mingo

Commit-ID:  fce877e3a429940a986e085a41e8b57f2d922e36
Gitweb:     http://git.kernel.org/tip/fce877e3a429940a986e085a41e8b57f2d922e36
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 29 Jan 2010 13:25:12 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Feb 2010 09:59:50 +0100

bitops: Ensure the compile time HWEIGHT is only used for such

Avoid accidental misuse by failing to compile things

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |   10 +++++++---
 include/linux/bitops.h           |   33 ++++++++++++++++++++++-----------
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5b91992..96cfc1a 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -93,13 +93,16 @@ struct cpu_hw_events {
 	struct perf_event	*event_list[X86_PMC_IDX_MAX]; /* in enabled order */
 };
 
-#define EVENT_CONSTRAINT(c, n, m) {	\
+#define __EVENT_CONSTRAINT(c, n, m, w) {\
 	{ .idxmsk64[0] = (n) },		\
 	.code = (c),			\
 	.cmask = (m),			\
-	.weight = HWEIGHT64((u64)(n)),	\
+	.weight = (w),			\
 }
 
+#define EVENT_CONSTRAINT(c, n, m)	\
+	__EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
+
 #define INTEL_EVENT_CONSTRAINT(c, n)	\
 	EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVTSEL_MASK)
 
@@ -2622,7 +2625,8 @@ void __init init_hw_perf_events(void)
 	register_die_notifier(&perf_event_nmi_notifier);
 
 	unconstrained = (struct event_constraint)
-		EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_events) - 1, 0);
+		__EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_events) - 1,
+				   0, x86_pmu.num_events);
 
 	pr_info("... version:                %d\n",     x86_pmu.version);
 	pr_info("... bit width:              %d\n",     x86_pmu.event_bits);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index ba0fd1e..25b8b2f 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -45,19 +45,30 @@ static inline unsigned long hweight_long(unsigned long w)
 	return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
-#define HWEIGHT8(w)			\
-      (	(!!((w) & (1ULL << 0))) +	\
-	(!!((w) & (1ULL << 1))) +	\
-	(!!((w) & (1ULL << 2))) +	\
-	(!!((w) & (1ULL << 3))) +	\
-	(!!((w) & (1ULL << 4))) +	\
-	(!!((w) & (1ULL << 5))) +	\
-	(!!((w) & (1ULL << 6))) +	\
+/*
+ * Clearly slow versions of the hweightN() functions, their benefit is
+ * of course compile time evaluation of constant arguments.
+ */
+#define HWEIGHT8(w)					\
+      (	BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) +	\
+	(!!((w) & (1ULL << 0))) +			\
+	(!!((w) & (1ULL << 1))) +			\
+	(!!((w) & (1ULL << 2))) +			\
+	(!!((w) & (1ULL << 3))) +			\
+	(!!((w) & (1ULL << 4))) +			\
+	(!!((w) & (1ULL << 5))) +			\
+	(!!((w) & (1ULL << 6))) +			\
 	(!!((w) & (1ULL << 7)))	)
 
-#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8(w >> 8))
-#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16(w >> 16))
-#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32(w >> 32))
+#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8((w) >> 8))
+#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
+#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
+
+/*
+ * Type invariant version that simply casts things to the
+ * largest type.
+ */
+#define HWEIGHT(w)   HWEIGHT64((u64)(w))
 
 /**
  * rol32 - rotate a 32-bit value left

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

* [PATCH] bitops: Optimize hweight() by making use of compile-time evaluation
  2010-02-04  9:57               ` [tip:perf/core] bitops: Ensure the compile time HWEIGHT is only used for such tip-bot for Peter Zijlstra
@ 2010-02-04 10:27                 ` Peter Zijlstra
  0 siblings, 0 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2010-02-04 10:27 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, akpm, torvalds, tglx, mingo; +Cc: linux-tip-commits

Hi Andrew,

Ingo suggested you take this patch through -mm since it touches !x86
arch bits.

It should apply nicely once fce877e3a429940a986e085a41e8b57f2d922e36
makes in into -next.

---
Subject: bitops: Optimize hweight() by making use of compile-time evaluation
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Mon Feb 01 15:03:07 CET 2010

Rename the extisting runtime hweight() implementations to 
__arch_hweight(), rename the compile-time versions to __const_hweight()
and then have hweight() pick between them.

Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: H. Peter Anvin <hpa@zytor.com>
LKML-Reference: <1265028224.24455.154.camel@laptop>
---
 arch/alpha/include/asm/bitops.h            |   18 ++++++------
 arch/ia64/include/asm/bitops.h             |   11 ++++---
 arch/sparc/include/asm/bitops_64.h         |   11 ++++---
 include/asm-generic/bitops/arch_hweight.h  |   11 +++++++
 include/asm-generic/bitops/const_hweight.h |   42 +++++++++++++++++++++++++++++
 include/asm-generic/bitops/hweight.h       |    8 +----
 include/linux/bitops.h                     |   25 -----------------
 lib/hweight.c                              |   19 ++++++-------
 8 files changed, 87 insertions(+), 58 deletions(-)

Index: linux-2.6/arch/alpha/include/asm/bitops.h
===================================================================
--- linux-2.6.orig/arch/alpha/include/asm/bitops.h
+++ linux-2.6/arch/alpha/include/asm/bitops.h
@@ -405,29 +405,31 @@ static inline int fls(int x)
 
 #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
 /* Whee.  EV67 can calculate it directly.  */
-static inline unsigned long hweight64(unsigned long w)
+static inline unsigned long __arch_hweight64(unsigned long w)
 {
 	return __kernel_ctpop(w);
 }
 
-static inline unsigned int hweight32(unsigned int w)
+static inline unsigned int __arch_weight32(unsigned int w)
 {
-	return hweight64(w);
+	return __arch_hweight64(w);
 }
 
-static inline unsigned int hweight16(unsigned int w)
+static inline unsigned int __arch_hweight16(unsigned int w)
 {
-	return hweight64(w & 0xffff);
+	return __arch_hweight64(w & 0xffff);
 }
 
-static inline unsigned int hweight8(unsigned int w)
+static inline unsigned int __arch_hweight8(unsigned int w)
 {
-	return hweight64(w & 0xff);
+	return __arch_hweight64(w & 0xff);
 }
 #else
-#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/arch_hweight.h>
 #endif
 
+#include <asm-generic/bitops/const_hweight.h>
+
 #endif /* __KERNEL__ */
 
 #include <asm-generic/bitops/find.h>
Index: linux-2.6/arch/ia64/include/asm/bitops.h
===================================================================
--- linux-2.6.orig/arch/ia64/include/asm/bitops.h
+++ linux-2.6/arch/ia64/include/asm/bitops.h
@@ -437,17 +437,18 @@ __fls (unsigned long x)
  * hweightN: returns the hamming weight (i.e. the number
  * of bits set) of a N-bit word
  */
-static __inline__ unsigned long
-hweight64 (unsigned long x)
+static __inline__ unsigned long __arch_hweight64(unsigned long x)
 {
 	unsigned long result;
 	result = ia64_popcnt(x);
 	return result;
 }
 
-#define hweight32(x)	(unsigned int) hweight64((x) & 0xfffffffful)
-#define hweight16(x)	(unsigned int) hweight64((x) & 0xfffful)
-#define hweight8(x)	(unsigned int) hweight64((x) & 0xfful)
+#define __arch_hweight32(x) ((unsigned int) __arch_hweight64((x) & 0xfffffffful))
+#define __arch_hweight16(x) ((unsigned int) __arch_hweight64((x) & 0xfffful))
+#define __arch_hweight8(x)  ((unsigned int) __arch_hweight64((x) & 0xfful))
+
+#include <asm-generic/bitops/const_hweight.h>
 
 #endif /* __KERNEL__ */
 
Index: linux-2.6/arch/sparc/include/asm/bitops_64.h
===================================================================
--- linux-2.6.orig/arch/sparc/include/asm/bitops_64.h
+++ linux-2.6/arch/sparc/include/asm/bitops_64.h
@@ -44,7 +44,7 @@ extern void change_bit(unsigned long nr,
 
 #ifdef ULTRA_HAS_POPULATION_COUNT
 
-static inline unsigned int hweight64(unsigned long w)
+static inline unsigned int __arch_hweight64(unsigned long w)
 {
 	unsigned int res;
 
@@ -52,7 +52,7 @@ static inline unsigned int hweight64(uns
 	return res;
 }
 
-static inline unsigned int hweight32(unsigned int w)
+static inline unsigned int __arch_hweight32(unsigned int w)
 {
 	unsigned int res;
 
@@ -60,7 +60,7 @@ static inline unsigned int hweight32(uns
 	return res;
 }
 
-static inline unsigned int hweight16(unsigned int w)
+static inline unsigned int __arch_hweight16(unsigned int w)
 {
 	unsigned int res;
 
@@ -68,7 +68,7 @@ static inline unsigned int hweight16(uns
 	return res;
 }
 
-static inline unsigned int hweight8(unsigned int w)
+static inline unsigned int __arch_hweight8(unsigned int w)
 {
 	unsigned int res;
 
@@ -78,9 +78,10 @@ static inline unsigned int hweight8(unsi
 
 #else
 
-#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/arch_hweight.h>
 
 #endif
+#include <asm-generic/bitops/const_hweight.h>
 #include <asm-generic/bitops/lock.h>
 #endif /* __KERNEL__ */
 
Index: linux-2.6/include/asm-generic/bitops/arch_hweight.h
===================================================================
--- /dev/null
+++ linux-2.6/include/asm-generic/bitops/arch_hweight.h
@@ -0,0 +1,11 @@
+#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
+#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
+
+#include <asm/types.h>
+
+extern unsigned int __arch_hweight32(unsigned int w);
+extern unsigned int __arch_hweight16(unsigned int w);
+extern unsigned int __arch_hweight8(unsigned int w);
+extern unsigned long __arch_hweight64(__u64 w);
+
+#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
Index: linux-2.6/include/asm-generic/bitops/const_hweight.h
===================================================================
--- /dev/null
+++ linux-2.6/include/asm-generic/bitops/const_hweight.h
@@ -0,0 +1,42 @@
+#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
+#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
+
+/*
+ * Compile time versions of __arch_hweightN()
+ */
+#define __const_hweight8(w)		\
+      (	(!!((w) & (1ULL << 0))) +	\
+	(!!((w) & (1ULL << 1))) +	\
+	(!!((w) & (1ULL << 2))) +	\
+	(!!((w) & (1ULL << 3))) +	\
+	(!!((w) & (1ULL << 4))) +	\
+	(!!((w) & (1ULL << 5))) +	\
+	(!!((w) & (1ULL << 6))) +	\
+	(!!((w) & (1ULL << 7)))	)
+
+#define __const_hweight16(w) (__const_hweight8(w)  + __const_hweight8((w)  >> 8 ))
+#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
+#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
+
+/*
+ * Generic interface.
+ */
+#define hweight8(w)  (__builtin_constant_p(w) ? __const_hweight8(w)  : __arch_hweight8(w))
+#define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w))
+#define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
+#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
+
+/*
+ * Interface for known constant arguments
+ */
+#define HWEIGHT8(w)  (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w))
+#define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w))
+#define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w))
+#define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w))
+
+/*
+ * Type invariant interface to the compile time constant hweight functions.
+ */
+#define HWEIGHT(w)   HWEIGHT64((u64)w)
+
+#endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */
Index: linux-2.6/include/asm-generic/bitops/hweight.h
===================================================================
--- linux-2.6.orig/include/asm-generic/bitops/hweight.h
+++ linux-2.6/include/asm-generic/bitops/hweight.h
@@ -1,11 +1,7 @@
 #ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
 #define _ASM_GENERIC_BITOPS_HWEIGHT_H_
 
-#include <asm/types.h>
-
-extern unsigned int hweight32(unsigned int w);
-extern unsigned int hweight16(unsigned int w);
-extern unsigned int hweight8(unsigned int w);
-extern unsigned long hweight64(__u64 w);
+#include <asm-generic/bitops/arch_hweight.h>
+#include <asm-generic/bitops/const_hweight.h>
 
 #endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
Index: linux-2.6/include/linux/bitops.h
===================================================================
--- linux-2.6.orig/include/linux/bitops.h
+++ linux-2.6/include/linux/bitops.h
@@ -45,31 +45,6 @@ static inline unsigned long hweight_long
 	return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
-/*
- * Clearly slow versions of the hweightN() functions, their benefit is
- * of course compile time evaluation of constant arguments.
- */
-#define HWEIGHT8(w)					\
-      (	BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) +	\
-	(!!((w) & (1ULL << 0))) +			\
-	(!!((w) & (1ULL << 1))) +			\
-	(!!((w) & (1ULL << 2))) +			\
-	(!!((w) & (1ULL << 3))) +			\
-	(!!((w) & (1ULL << 4))) +			\
-	(!!((w) & (1ULL << 5))) +			\
-	(!!((w) & (1ULL << 6))) +			\
-	(!!((w) & (1ULL << 7)))	)
-
-#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8((w) >> 8))
-#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
-#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
-
-/*
- * Type invariant version that simply casts things to the
- * largest type.
- */
-#define HWEIGHT(w)   HWEIGHT64((u64)(w))
-
 /**
  * rol32 - rotate a 32-bit value left
  * @word: value to rotate
Index: linux-2.6/lib/hweight.c
===================================================================
--- linux-2.6.orig/lib/hweight.c
+++ linux-2.6/lib/hweight.c
@@ -9,7 +9,7 @@
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 
-unsigned int hweight32(unsigned int w)
+unsigned int __arch_hweight32(unsigned int w)
 {
 #ifdef ARCH_HAS_FAST_MULTIPLIER
 	w -= (w >> 1) & 0x55555555;
@@ -24,29 +24,30 @@ unsigned int hweight32(unsigned int w)
 	return (res + (res >> 16)) & 0x000000FF;
 #endif
 }
-EXPORT_SYMBOL(hweight32);
+EXPORT_SYMBOL(__arch_hweight32);
 
-unsigned int hweight16(unsigned int w)
+unsigned int __arch_hweight16(unsigned int w)
 {
 	unsigned int res = w - ((w >> 1) & 0x5555);
 	res = (res & 0x3333) + ((res >> 2) & 0x3333);
 	res = (res + (res >> 4)) & 0x0F0F;
 	return (res + (res >> 8)) & 0x00FF;
 }
-EXPORT_SYMBOL(hweight16);
+EXPORT_SYMBOL(__arch_hweight16);
 
-unsigned int hweight8(unsigned int w)
+unsigned int __arch_hweight8(unsigned int w)
 {
 	unsigned int res = w - ((w >> 1) & 0x55);
 	res = (res & 0x33) + ((res >> 2) & 0x33);
 	return (res + (res >> 4)) & 0x0F;
 }
-EXPORT_SYMBOL(hweight8);
+EXPORT_SYMBOL(__arch_hweight8);
 
-unsigned long hweight64(__u64 w)
+unsigned long __arch_hweight64(__u64 w)
 {
 #if BITS_PER_LONG == 32
-	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
+	return __arch_hweight32((unsigned int)(w >> 32)) +
+	       __arch_hweight32((unsigned int)w);
 #elif BITS_PER_LONG == 64
 #ifdef ARCH_HAS_FAST_MULTIPLIER
 	w -= (w >> 1) & 0x5555555555555555ul;
@@ -63,4 +64,4 @@ unsigned long hweight64(__u64 w)
 #endif
 #endif
 }
-EXPORT_SYMBOL(hweight64);
+EXPORT_SYMBOL(__arch_hweight64);



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

* [tip:perf/core] perf_events: Report the MMAP pgoff value in bytes
       [not found]             ` <new-submission>
                                 ` (486 preceding siblings ...)
  2010-02-04  9:57               ` [tip:perf/core] bitops: Ensure the compile time HWEIGHT is only used for such tip-bot for Peter Zijlstra
@ 2010-02-26 10:24               ` tip-bot for Peter Zijlstra
  2010-02-26 10:25               ` [tip:perf/core] perf_events, x86: Remove superflous MSR writes tip-bot for Peter Zijlstra
                                 ` (218 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-26 10:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo, davem

Commit-ID:  3a0304e90aa5a2c0c308a05d28f7d109a48d8539
Gitweb:     http://git.kernel.org/tip/3a0304e90aa5a2c0c308a05d28f7d109a48d8539
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 26 Feb 2010 10:33:41 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Feb 2010 10:56:52 +0100

perf_events: Report the MMAP pgoff value in bytes

DaveM reported that currently perf interprets the pgoff value reported by
the MMAP events as a byte range, but the kernel reports it as a page
offset.

Since its broken (and unusable) anyway, change the kernel behaviour (ABI)
to report bytes indeed, avoiding the need for userspace to deal with
PAGE_SIZE things.

Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 087025f..5a69abb 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3749,7 +3749,7 @@ void __perf_event_mmap(struct vm_area_struct *vma)
 			/* .tid */
 			.start  = vma->vm_start,
 			.len    = vma->vm_end - vma->vm_start,
-			.pgoff  = vma->vm_pgoff,
+			.pgoff  = (u64)vma->vm_pgoff << PAGE_SHIFT,
 		},
 	};
 

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

* [tip:perf/core] perf_events, x86: Remove superflous MSR writes
       [not found]             ` <new-submission>
                                 ` (487 preceding siblings ...)
  2010-02-26 10:24               ` [tip:perf/core] perf_events: Report the MMAP pgoff value in bytes tip-bot for Peter Zijlstra
@ 2010-02-26 10:25               ` tip-bot for Peter Zijlstra
  2010-02-26 14:54               ` [tip:perf/core] perf_events, x86: Split PMU definitions into separate files tip-bot for Peter Zijlstra
                                 ` (217 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-26 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, arjan, a.p.zijlstra, tglx, mingo

Commit-ID:  6667661df4bc76083edf1e08831c20f64429709d
Gitweb:     http://git.kernel.org/tip/6667661df4bc76083edf1e08831c20f64429709d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Feb 2010 16:10:48 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Feb 2010 10:56:54 +0100

perf_events, x86: Remove superflous MSR writes

We re-program the event control register every time we reset the count,
this appears to be superflous, hence remove it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index ad09656..dd09ccc 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2009,9 +2009,6 @@ static int intel_pmu_save_and_restart(struct perf_event *event)
 	x86_perf_event_update(event, hwc, idx);
 	ret = x86_perf_event_set_period(event, hwc, idx);
 
-	if (event->state == PERF_EVENT_STATE_ACTIVE)
-		intel_pmu_enable_event(hwc, idx);
-
 	return ret;
 }
 

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

* [tip:perf/core] perf_events, x86: Split PMU definitions into separate files
       [not found]             ` <new-submission>
                                 ` (488 preceding siblings ...)
  2010-02-26 10:25               ` [tip:perf/core] perf_events, x86: Remove superflous MSR writes tip-bot for Peter Zijlstra
@ 2010-02-26 14:54               ` tip-bot for Peter Zijlstra
  2010-03-02 14:30               ` [tip:perf/nmi] nmi_watchdog: Tell the world we're active tip-bot for Peter Zijlstra
                                 ` (216 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-02-26 14:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  f22f54f4491acd987a6c5a92de52b60ca8b58b61
Gitweb:     http://git.kernel.org/tip/f22f54f4491acd987a6c5a92de52b60ca8b58b61
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 26 Feb 2010 12:05:05 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Feb 2010 15:44:04 +0100

perf_events, x86: Split PMU definitions into separate files

Split amd,p6,intel into separate files so that we can easily deal with
CONFIG_CPU_SUP_* things, needed to make things build now that perf_event.c
relies on symbols from amd.c

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_event.c       | 1524 +-------------------------------
 arch/x86/kernel/cpu/perf_event_amd.c   |  416 +++++++++
 arch/x86/kernel/cpu/perf_event_intel.c |  971 ++++++++++++++++++++
 arch/x86/kernel/cpu/perf_event_p6.c    |  157 ++++
 4 files changed, 1554 insertions(+), 1514 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index dd09ccc..641ccb9 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -161,8 +161,6 @@ struct x86_pmu {
 
 static struct x86_pmu x86_pmu __read_mostly;
 
-static raw_spinlock_t amd_nb_lock;
-
 static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
 	.enabled = 1,
 };
@@ -171,140 +169,6 @@ static int x86_perf_event_set_period(struct perf_event *event,
 			     struct hw_perf_event *hwc, int idx);
 
 /*
- * Not sure about some of these
- */
-static const u64 p6_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]		= 0x0079,
-  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0f2e,
-  [PERF_COUNT_HW_CACHE_MISSES]		= 0x012e,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
-  [PERF_COUNT_HW_BUS_CYCLES]		= 0x0062,
-};
-
-static u64 p6_pmu_event_map(int hw_event)
-{
-	return p6_perfmon_event_map[hw_event];
-}
-
-/*
- * Event 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_EVENT			0x0000002EULL
-
-static u64 p6_pmu_raw_event(u64 hw_event)
-{
-#define P6_EVNTSEL_EVENT_MASK		0x000000FFULL
-#define P6_EVNTSEL_UNIT_MASK		0x0000FF00ULL
-#define P6_EVNTSEL_EDGE_MASK		0x00040000ULL
-#define P6_EVNTSEL_INV_MASK		0x00800000ULL
-#define P6_EVNTSEL_REG_MASK		0xFF000000ULL
-
-#define P6_EVNTSEL_MASK			\
-	(P6_EVNTSEL_EVENT_MASK |	\
-	 P6_EVNTSEL_UNIT_MASK  |	\
-	 P6_EVNTSEL_EDGE_MASK  |	\
-	 P6_EVNTSEL_INV_MASK   |	\
-	 P6_EVNTSEL_REG_MASK)
-
-	return hw_event & P6_EVNTSEL_MASK;
-}
-
-static struct event_constraint intel_p6_event_constraints[] =
-{
-	INTEL_EVENT_CONSTRAINT(0xc1, 0x1),	/* FLOPS */
-	INTEL_EVENT_CONSTRAINT(0x10, 0x1),	/* FP_COMP_OPS_EXE */
-	INTEL_EVENT_CONSTRAINT(0x11, 0x1),	/* FP_ASSIST */
-	INTEL_EVENT_CONSTRAINT(0x12, 0x2),	/* MUL */
-	INTEL_EVENT_CONSTRAINT(0x13, 0x2),	/* DIV */
-	INTEL_EVENT_CONSTRAINT(0x14, 0x1),	/* CYCLES_DIV_BUSY */
-	EVENT_CONSTRAINT_END
-};
-
-/*
- * Intel PerfMon v3. Used on Core2 and later.
- */
-static const u64 intel_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]		= 0x003c,
-  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x4f2e,
-  [PERF_COUNT_HW_CACHE_MISSES]		= 0x412e,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
-  [PERF_COUNT_HW_BUS_CYCLES]		= 0x013c,
-};
-
-static struct event_constraint intel_core_event_constraints[] =
-{
-	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
-	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
-	INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
-	INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
-	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
-	INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FP_COMP_INSTR_RET */
-	EVENT_CONSTRAINT_END
-};
-
-static struct event_constraint intel_core2_event_constraints[] =
-{
-	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
-	INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
-	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
-	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
-	INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
-	INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
-	INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
-	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
-	INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
-	INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED */
-	EVENT_CONSTRAINT_END
-};
-
-static struct event_constraint intel_nehalem_event_constraints[] =
-{
-	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
-	INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */
-	INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */
-	INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */
-	INTEL_EVENT_CONSTRAINT(0x43, 0x3), /* L1D_ALL_REF */
-	INTEL_EVENT_CONSTRAINT(0x48, 0x3), /* L1D_PEND_MISS */
-	INTEL_EVENT_CONSTRAINT(0x4e, 0x3), /* L1D_PREFETCH */
-	INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
-	INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
-	EVENT_CONSTRAINT_END
-};
-
-static struct event_constraint intel_westmere_event_constraints[] =
-{
-	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
-	INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
-	INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
-	INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
-	EVENT_CONSTRAINT_END
-};
-
-static struct event_constraint intel_gen_event_constraints[] =
-{
-	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
-	EVENT_CONSTRAINT_END
-};
-
-static u64 intel_pmu_event_map(int hw_event)
-{
-	return intel_perfmon_event_map[hw_event];
-}
-
-/*
  * Generalized hw caching related hw_event table, filled
  * in on a per model basis. A value of 0 means
  * 'not supported', -1 means 'hw_event makes no sense on
@@ -319,515 +183,6 @@ static u64 __read_mostly hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX];
 
-static __initconst u64 westmere_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) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
-		[ C(RESULT_MISS)   ] = 0x0151, /* L1D.REPL                     */
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
-		[ C(RESULT_MISS)   ] = 0x0251, /* L1D.M_REPL                   */
-	},
-	[ 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) ] = 0x0380, /* 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(LL  ) ] = {
-	[ 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) ] = 0x4f2e, /* LLC Reference                */
-		[ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
-	},
- },
- [ C(DTLB) ] = {
-	[ C(OP_READ) ] = {
-		[ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
-		[ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
-		[ 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_MISSES.ANY              */
-	},
-	[ 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 __initconst 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) ] = 0x0380, /* 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(LL  ) ] = {
-	[ 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) ] = 0x4f2e, /* LLC Reference                */
-		[ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
-	},
- },
- [ 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)   ] = 0x20c8, /* 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 __initconst u64 core2_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) ] = 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(LL  ) ] = {
-	[ 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 __initconst u64 atom_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) ] = 0x2140, /* L1D_CACHE.LD               */
-		[ C(RESULT_MISS)   ] = 0,
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x2240, /* 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) ] = 0x0380, /* 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) ] = 0,
-		[ C(RESULT_MISS)   ] = 0,
-	},
- },
- [ C(LL  ) ] = {
-	[ 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) ] = 0x2140, /* L1D_CACHE_LD.MESI  (alias) */
-		[ C(RESULT_MISS)   ] = 0x0508, /* DTLB_MISSES.MISS_LD        */
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x2240, /* 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 hw_event)
-{
-#define CORE_EVNTSEL_EVENT_MASK		0x000000FFULL
-#define CORE_EVNTSEL_UNIT_MASK		0x0000FF00ULL
-#define CORE_EVNTSEL_EDGE_MASK		0x00040000ULL
-#define CORE_EVNTSEL_INV_MASK		0x00800000ULL
-#define CORE_EVNTSEL_REG_MASK		0xFF000000ULL
-
-#define CORE_EVNTSEL_MASK		\
-	(INTEL_ARCH_EVTSEL_MASK |	\
-	 INTEL_ARCH_UNIT_MASK   |	\
-	 INTEL_ARCH_EDGE_MASK   |	\
-	 INTEL_ARCH_INV_MASK    |	\
-	 INTEL_ARCH_CNT_MASK)
-
-	return hw_event & CORE_EVNTSEL_MASK;
-}
-
-static __initconst u64 amd_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) ] = 0x0040, /* Data Cache Accesses        */
-		[ C(RESULT_MISS)   ] = 0x0041, /* Data Cache Misses          */
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */
-		[ C(RESULT_MISS)   ] = 0,
-	},
-	[ C(OP_PREFETCH) ] = {
-		[ C(RESULT_ACCESS) ] = 0x0267, /* Data Prefetcher :attempts  */
-		[ C(RESULT_MISS)   ] = 0x0167, /* Data Prefetcher :cancelled */
-	},
- },
- [ 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) ] = 0x014B, /* Prefetch Instructions :Load */
-		[ C(RESULT_MISS)   ] = 0,
-	},
- },
- [ C(LL  ) ] = {
-	[ C(OP_READ) ] = {
-		[ C(RESULT_ACCESS) ] = 0x037D, /* Requests to L2 Cache :IC+DC */
-		[ C(RESULT_MISS)   ] = 0x037E, /* L2 Cache Misses : IC+DC     */
-	},
-	[ C(OP_WRITE) ] = {
-		[ C(RESULT_ACCESS) ] = 0x017F, /* L2 Fill/Writeback           */
-		[ C(RESULT_MISS)   ] = 0,
-	},
-	[ C(OP_PREFETCH) ] = {
-		[ C(RESULT_ACCESS) ] = 0,
-		[ C(RESULT_MISS)   ] = 0,
-	},
- },
- [ C(DTLB) ] = {
-	[ C(OP_READ) ] = {
-		[ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
-		[ C(RESULT_MISS)   ] = 0x0046, /* L1 DTLB and L2 DLTB 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,
-	},
- },
- [ 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.
- */
-static const u64 amd_perfmon_event_map[] =
-{
-  [PERF_COUNT_HW_CPU_CYCLES]		= 0x0076,
-  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0080,
-  [PERF_COUNT_HW_CACHE_MISSES]		= 0x0081,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
-  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
-};
-
-static u64 amd_pmu_event_map(int hw_event)
-{
-	return amd_perfmon_event_map[hw_event];
-}
-
-static u64 amd_pmu_raw_event(u64 hw_event)
-{
-#define K7_EVNTSEL_EVENT_MASK	0xF000000FFULL
-#define K7_EVNTSEL_UNIT_MASK	0x00000FF00ULL
-#define K7_EVNTSEL_EDGE_MASK	0x000040000ULL
-#define K7_EVNTSEL_INV_MASK	0x000800000ULL
-#define K7_EVNTSEL_REG_MASK	0x0FF000000ULL
-
-#define K7_EVNTSEL_MASK			\
-	(K7_EVNTSEL_EVENT_MASK |	\
-	 K7_EVNTSEL_UNIT_MASK  |	\
-	 K7_EVNTSEL_EDGE_MASK  |	\
-	 K7_EVNTSEL_INV_MASK   |	\
-	 K7_EVNTSEL_REG_MASK)
-
-	return hw_event & K7_EVNTSEL_MASK;
-}
-
 /*
  * Propagate event elapsed time into the generic event.
  * Can only be executed on the CPU where the event is active.
@@ -1079,42 +434,6 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event_attr *attr)
 	return 0;
 }
 
-static void intel_pmu_enable_bts(u64 config)
-{
-	unsigned long debugctlmsr;
-
-	debugctlmsr = get_debugctlmsr();
-
-	debugctlmsr |= X86_DEBUGCTL_TR;
-	debugctlmsr |= X86_DEBUGCTL_BTS;
-	debugctlmsr |= X86_DEBUGCTL_BTINT;
-
-	if (!(config & ARCH_PERFMON_EVENTSEL_OS))
-		debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS;
-
-	if (!(config & ARCH_PERFMON_EVENTSEL_USR))
-		debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR;
-
-	update_debugctlmsr(debugctlmsr);
-}
-
-static void intel_pmu_disable_bts(void)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	unsigned long debugctlmsr;
-
-	if (!cpuc->ds)
-		return;
-
-	debugctlmsr = get_debugctlmsr();
-
-	debugctlmsr &=
-		~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT |
-		  X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR);
-
-	update_debugctlmsr(debugctlmsr);
-}
-
 /*
  * Setup the hardware configuration for a given attr_type
  */
@@ -1223,26 +542,6 @@ static int __hw_perf_event_init(struct perf_event *event)
 	return 0;
 }
 
-static void p6_pmu_disable_all(void)
-{
-	u64 val;
-
-	/* p6 only has one enable register */
-	rdmsrl(MSR_P6_EVNTSEL0, val);
-	val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
-	wrmsrl(MSR_P6_EVNTSEL0, val);
-}
-
-static void intel_pmu_disable_all(void)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-
-	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
-
-	if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask))
-		intel_pmu_disable_bts();
-}
-
 static void x86_pmu_disable_all(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1278,33 +577,6 @@ void hw_perf_disable(void)
 	x86_pmu.disable_all();
 }
 
-static void p6_pmu_enable_all(void)
-{
-	unsigned long val;
-
-	/* p6 only has one enable register */
-	rdmsrl(MSR_P6_EVNTSEL0, val);
-	val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-	wrmsrl(MSR_P6_EVNTSEL0, val);
-}
-
-static void intel_pmu_enable_all(void)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-
-	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
-
-	if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
-		struct perf_event *event =
-			cpuc->events[X86_PMC_IDX_FIXED_BTS];
-
-		if (WARN_ON_ONCE(!event))
-			return;
-
-		intel_pmu_enable_bts(event->hw.config);
-	}
-}
-
 static void x86_pmu_enable_all(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1578,20 +850,6 @@ void hw_perf_enable(void)
 	x86_pmu.enable_all();
 }
 
-static inline u64 intel_pmu_get_status(void)
-{
-	u64 status;
-
-	rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
-
-	return status;
-}
-
-static inline void intel_pmu_ack_status(u64 ack)
-{
-	wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
-}
-
 static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 {
 	(void)checking_wrmsrl(hwc->config_base + idx,
@@ -1603,47 +861,6 @@ static inline void x86_pmu_disable_event(struct hw_perf_event *hwc, int idx)
 	(void)checking_wrmsrl(hwc->config_base + idx, hwc->config);
 }
 
-static inline void
-intel_pmu_disable_fixed(struct hw_perf_event *hwc, int __idx)
-{
-	int idx = __idx - X86_PMC_IDX_FIXED;
-	u64 ctrl_val, mask;
-
-	mask = 0xfULL << (idx * 4);
-
-	rdmsrl(hwc->config_base, ctrl_val);
-	ctrl_val &= ~mask;
-	(void)checking_wrmsrl(hwc->config_base, ctrl_val);
-}
-
-static inline void
-p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	u64 val = P6_NOP_EVENT;
-
-	if (cpuc->enabled)
-		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-
-	(void)checking_wrmsrl(hwc->config_base + idx, val);
-}
-
-static inline void
-intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
-{
-	if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
-		intel_pmu_disable_bts();
-		return;
-	}
-
-	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
-		intel_pmu_disable_fixed(hwc, idx);
-		return;
-	}
-
-	x86_pmu_disable_event(hwc, idx);
-}
-
 static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
 
 /*
@@ -1702,70 +919,6 @@ x86_perf_event_set_period(struct perf_event *event,
 	return ret;
 }
 
-static inline void
-intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx)
-{
-	int idx = __idx - X86_PMC_IDX_FIXED;
-	u64 ctrl_val, bits, mask;
-	int err;
-
-	/*
-	 * Enable IRQ generation (0x8),
-	 * and enable ring-3 counting (0x2) and ring-0 counting (0x1)
-	 * if requested:
-	 */
-	bits = 0x8ULL;
-	if (hwc->config & ARCH_PERFMON_EVENTSEL_USR)
-		bits |= 0x2;
-	if (hwc->config & ARCH_PERFMON_EVENTSEL_OS)
-		bits |= 0x1;
-
-	/*
-	 * ANY bit is supported in v3 and up
-	 */
-	if (x86_pmu.version > 2 && hwc->config & ARCH_PERFMON_EVENTSEL_ANY)
-		bits |= 0x4;
-
-	bits <<= (idx * 4);
-	mask = 0xfULL << (idx * 4);
-
-	rdmsrl(hwc->config_base, ctrl_val);
-	ctrl_val &= ~mask;
-	ctrl_val |= bits;
-	err = checking_wrmsrl(hwc->config_base, ctrl_val);
-}
-
-static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	u64 val;
-
-	val = hwc->config;
-	if (cpuc->enabled)
-		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-
-	(void)checking_wrmsrl(hwc->config_base + idx, val);
-}
-
-
-static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
-{
-	if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
-		if (!__get_cpu_var(cpu_hw_events).enabled)
-			return;
-
-		intel_pmu_enable_bts(hwc->config);
-		return;
-	}
-
-	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
-		intel_pmu_enable_fixed(hwc, idx);
-		return;
-	}
-
-	__x86_pmu_enable_event(hwc, idx);
-}
-
 static void x86_pmu_enable_event(struct hw_perf_event *hwc, int idx)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1887,66 +1040,6 @@ void perf_event_print_debug(void)
 	local_irq_restore(flags);
 }
 
-static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
-{
-	struct debug_store *ds = cpuc->ds;
-	struct bts_record {
-		u64	from;
-		u64	to;
-		u64	flags;
-	};
-	struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
-	struct bts_record *at, *top;
-	struct perf_output_handle handle;
-	struct perf_event_header header;
-	struct perf_sample_data data;
-	struct pt_regs regs;
-
-	if (!event)
-		return;
-
-	if (!ds)
-		return;
-
-	at  = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
-	top = (struct bts_record *)(unsigned long)ds->bts_index;
-
-	if (top <= at)
-		return;
-
-	ds->bts_index = ds->bts_buffer_base;
-
-
-	data.period	= event->hw.last_period;
-	data.addr	= 0;
-	data.raw	= NULL;
-	regs.ip		= 0;
-
-	/*
-	 * Prepare a generic sample, i.e. fill in the invariant fields.
-	 * We will overwrite the from and to address before we output
-	 * the sample.
-	 */
-	perf_prepare_sample(&header, &data, event, &regs);
-
-	if (perf_output_begin(&handle, event,
-			      header.size * (top - at), 1, 1))
-		return;
-
-	for (; at < top; at++) {
-		data.ip		= at->from;
-		data.addr	= at->to;
-
-		perf_output_sample(&handle, &header, &data, event);
-	}
-
-	perf_output_end(&handle);
-
-	/* There's new data available. */
-	event->hw.interrupts++;
-	event->pending_kill = POLL_IN;
-}
-
 static void x86_pmu_stop(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -1966,10 +1059,6 @@ static void x86_pmu_stop(struct perf_event *event)
 	 */
 	x86_perf_event_update(event, hwc, idx);
 
-	/* Drain the remaining BTS records. */
-	if (unlikely(idx == X86_PMC_IDX_FIXED_BTS))
-		intel_pmu_drain_bts_buffer(cpuc);
-
 	cpuc->events[idx] = NULL;
 }
 
@@ -1996,114 +1085,6 @@ static void x86_pmu_disable(struct perf_event *event)
 	perf_event_update_userpage(event);
 }
 
-/*
- * Save and restart an expired event. Called by NMI contexts,
- * so it has to be careful about preempting normal event ops:
- */
-static int intel_pmu_save_and_restart(struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-	int idx = hwc->idx;
-	int ret;
-
-	x86_perf_event_update(event, hwc, idx);
-	ret = x86_perf_event_set_period(event, hwc, idx);
-
-	return ret;
-}
-
-static void intel_pmu_reset(void)
-{
-	struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds;
-	unsigned long flags;
-	int idx;
-
-	if (!x86_pmu.num_events)
-		return;
-
-	local_irq_save(flags);
-
-	printk("clearing PMU state on CPU#%d\n", smp_processor_id());
-
-	for (idx = 0; idx < x86_pmu.num_events; idx++) {
-		checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
-		checking_wrmsrl(x86_pmu.perfctr  + idx, 0ull);
-	}
-	for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
-		checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
-	}
-	if (ds)
-		ds->bts_index = ds->bts_buffer_base;
-
-	local_irq_restore(flags);
-}
-
-/*
- * This handler is triggered by the local APIC, so the APIC IRQ handling
- * rules apply:
- */
-static int intel_pmu_handle_irq(struct pt_regs *regs)
-{
-	struct perf_sample_data data;
-	struct cpu_hw_events *cpuc;
-	int bit, loops;
-	u64 ack, status;
-
-	data.addr = 0;
-	data.raw = NULL;
-
-	cpuc = &__get_cpu_var(cpu_hw_events);
-
-	perf_disable();
-	intel_pmu_drain_bts_buffer(cpuc);
-	status = intel_pmu_get_status();
-	if (!status) {
-		perf_enable();
-		return 0;
-	}
-
-	loops = 0;
-again:
-	if (++loops > 100) {
-		WARN_ONCE(1, "perfevents: irq loop stuck!\n");
-		perf_event_print_debug();
-		intel_pmu_reset();
-		perf_enable();
-		return 1;
-	}
-
-	inc_irq_stat(apic_perf_irqs);
-	ack = status;
-	for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
-		struct perf_event *event = cpuc->events[bit];
-
-		clear_bit(bit, (unsigned long *) &status);
-		if (!test_bit(bit, cpuc->active_mask))
-			continue;
-
-		if (!intel_pmu_save_and_restart(event))
-			continue;
-
-		data.period = event->hw.last_period;
-
-		if (perf_event_overflow(event, 1, &data, regs))
-			intel_pmu_disable_event(&event->hw, bit);
-	}
-
-	intel_pmu_ack_status(ack);
-
-	/*
-	 * Repeat if there is more work to be done:
-	 */
-	status = intel_pmu_get_status();
-	if (status)
-		goto again;
-
-	perf_enable();
-
-	return 1;
-}
-
 static int x86_pmu_handle_irq(struct pt_regs *regs)
 {
 	struct perf_sample_data data;
@@ -2216,37 +1197,20 @@ perf_event_nmi_handler(struct notifier_block *self,
 	return NOTIFY_STOP;
 }
 
+static __read_mostly struct notifier_block perf_event_nmi_notifier = {
+	.notifier_call		= perf_event_nmi_handler,
+	.next			= NULL,
+	.priority		= 1
+};
+
 static struct event_constraint unconstrained;
 static struct event_constraint emptyconstraint;
 
-static struct event_constraint bts_constraint =
-	EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
-
-static struct event_constraint *
-intel_special_constraints(struct perf_event *event)
-{
-	unsigned int hw_event;
-
-	hw_event = event->hw.config & INTEL_ARCH_EVENT_MASK;
-
-	if (unlikely((hw_event ==
-		      x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
-		     (event->hw.sample_period == 1))) {
-
-		return &bts_constraint;
-	}
-	return NULL;
-}
-
 static struct event_constraint *
-intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
 {
 	struct event_constraint *c;
 
-	c = intel_special_constraints(event);
-	if (c)
-		return c;
-
 	if (x86_pmu.event_constraints) {
 		for_each_event_constraint(c, x86_pmu.event_constraints) {
 			if ((event->hw.config & c->cmask) == c->code)
@@ -2257,148 +1221,6 @@ intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event
 	return &unconstrained;
 }
 
-/*
- * AMD64 events are detected based on their event codes.
- */
-static inline int amd_is_nb_event(struct hw_perf_event *hwc)
-{
-	return (hwc->config & 0xe0) == 0xe0;
-}
-
-static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
-				      struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-	struct amd_nb *nb = cpuc->amd_nb;
-	int i;
-
-	/*
-	 * only care about NB events
-	 */
-	if (!(nb && amd_is_nb_event(hwc)))
-		return;
-
-	/*
-	 * need to scan whole list because event may not have
-	 * been assigned during scheduling
-	 *
-	 * no race condition possible because event can only
-	 * be removed on one CPU at a time AND PMU is disabled
-	 * when we come here
-	 */
-	for (i = 0; i < x86_pmu.num_events; i++) {
-		if (nb->owners[i] == event) {
-			cmpxchg(nb->owners+i, event, NULL);
-			break;
-		}
-	}
-}
-
- /*
-  * AMD64 NorthBridge events need special treatment because
-  * counter access needs to be synchronized across all cores
-  * of a package. Refer to BKDG section 3.12
-  *
-  * NB events are events measuring L3 cache, Hypertransport
-  * traffic. They are identified by an event code >= 0xe00.
-  * They measure events on the NorthBride which is shared
-  * by all cores on a package. NB events are counted on a
-  * shared set of counters. When a NB event is programmed
-  * in a counter, the data actually comes from a shared
-  * counter. Thus, access to those counters needs to be
-  * synchronized.
-  *
-  * We implement the synchronization such that no two cores
-  * can be measuring NB events using the same counters. Thus,
-  * we maintain a per-NB allocation table. The available slot
-  * is propagated using the event_constraint structure.
-  *
-  * We provide only one choice for each NB event based on
-  * the fact that only NB events have restrictions. Consequently,
-  * if a counter is available, there is a guarantee the NB event
-  * will be assigned to it. If no slot is available, an empty
-  * constraint is returned and scheduling will eventually fail
-  * for this event.
-  *
-  * Note that all cores attached the same NB compete for the same
-  * counters to host NB events, this is why we use atomic ops. Some
-  * multi-chip CPUs may have more than one NB.
-  *
-  * Given that resources are allocated (cmpxchg), they must be
-  * eventually freed for others to use. This is accomplished by
-  * calling amd_put_event_constraints().
-  *
-  * Non NB events are not impacted by this restriction.
-  */
-static struct event_constraint *
-amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-	struct amd_nb *nb = cpuc->amd_nb;
-	struct perf_event *old = NULL;
-	int max = x86_pmu.num_events;
-	int i, j, k = -1;
-
-	/*
-	 * if not NB event or no NB, then no constraints
-	 */
-	if (!(nb && amd_is_nb_event(hwc)))
-		return &unconstrained;
-
-	/*
-	 * detect if already present, if so reuse
-	 *
-	 * cannot merge with actual allocation
-	 * because of possible holes
-	 *
-	 * event can already be present yet not assigned (in hwc->idx)
-	 * because of successive calls to x86_schedule_events() from
-	 * hw_perf_group_sched_in() without hw_perf_enable()
-	 */
-	for (i = 0; i < max; i++) {
-		/*
-		 * keep track of first free slot
-		 */
-		if (k == -1 && !nb->owners[i])
-			k = i;
-
-		/* already present, reuse */
-		if (nb->owners[i] == event)
-			goto done;
-	}
-	/*
-	 * not present, so grab a new slot
-	 * starting either at:
-	 */
-	if (hwc->idx != -1) {
-		/* previous assignment */
-		i = hwc->idx;
-	} else if (k != -1) {
-		/* start from free slot found */
-		i = k;
-	} else {
-		/*
-		 * event not found, no slot found in
-		 * first pass, try again from the
-		 * beginning
-		 */
-		i = 0;
-	}
-	j = i;
-	do {
-		old = cmpxchg(nb->owners+i, NULL, event);
-		if (!old)
-			break;
-		if (++i == max)
-			i = 0;
-	} while (i != j);
-done:
-	if (!old)
-		return &nb->event_constraints[i];
-
-	return &emptyconstraint;
-}
-
 static int x86_event_sched_in(struct perf_event *event,
 			  struct perf_cpu_context *cpuctx)
 {
@@ -2509,335 +1331,9 @@ undo:
 	return ret;
 }
 
-static __read_mostly struct notifier_block perf_event_nmi_notifier = {
-	.notifier_call		= perf_event_nmi_handler,
-	.next			= NULL,
-	.priority		= 1
-};
-
-static __initconst struct x86_pmu p6_pmu = {
-	.name			= "p6",
-	.handle_irq		= x86_pmu_handle_irq,
-	.disable_all		= p6_pmu_disable_all,
-	.enable_all		= p6_pmu_enable_all,
-	.enable			= p6_pmu_enable_event,
-	.disable		= p6_pmu_disable_event,
-	.eventsel		= MSR_P6_EVNTSEL0,
-	.perfctr		= MSR_P6_PERFCTR0,
-	.event_map		= p6_pmu_event_map,
-	.raw_event		= p6_pmu_raw_event,
-	.max_events		= ARRAY_SIZE(p6_perfmon_event_map),
-	.apic			= 1,
-	.max_period		= (1ULL << 31) - 1,
-	.version		= 0,
-	.num_events		= 2,
-	/*
-	 * Events have 40 bits implemented. However they are designed such
-	 * that bits [32-39] are sign extensions of bit 31. As such the
-	 * effective width of a event for P6-like PMU is 32 bits only.
-	 *
-	 * See IA-32 Intel Architecture Software developer manual Vol 3B
-	 */
-	.event_bits		= 32,
-	.event_mask		= (1ULL << 32) - 1,
-	.get_event_constraints	= intel_get_event_constraints,
-	.event_constraints	= intel_p6_event_constraints
-};
-
-static __initconst struct x86_pmu core_pmu = {
-	.name			= "core",
-	.handle_irq		= x86_pmu_handle_irq,
-	.disable_all		= x86_pmu_disable_all,
-	.enable_all		= x86_pmu_enable_all,
-	.enable			= x86_pmu_enable_event,
-	.disable		= x86_pmu_disable_event,
-	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
-	.perfctr		= MSR_ARCH_PERFMON_PERFCTR0,
-	.event_map		= intel_pmu_event_map,
-	.raw_event		= intel_pmu_raw_event,
-	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
-	.apic			= 1,
-	/*
-	 * Intel PMCs cannot be accessed sanely above 32 bit width,
-	 * so we install an artificial 1<<31 period regardless of
-	 * the generic event period:
-	 */
-	.max_period		= (1ULL << 31) - 1,
-	.get_event_constraints	= intel_get_event_constraints,
-	.event_constraints	= intel_core_event_constraints,
-};
-
-static __initconst struct x86_pmu intel_pmu = {
-	.name			= "Intel",
-	.handle_irq		= intel_pmu_handle_irq,
-	.disable_all		= intel_pmu_disable_all,
-	.enable_all		= intel_pmu_enable_all,
-	.enable			= intel_pmu_enable_event,
-	.disable		= intel_pmu_disable_event,
-	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
-	.perfctr		= MSR_ARCH_PERFMON_PERFCTR0,
-	.event_map		= intel_pmu_event_map,
-	.raw_event		= intel_pmu_raw_event,
-	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
-	.apic			= 1,
-	/*
-	 * Intel PMCs cannot be accessed sanely above 32 bit width,
-	 * so we install an artificial 1<<31 period regardless of
-	 * the generic event period:
-	 */
-	.max_period		= (1ULL << 31) - 1,
-	.enable_bts		= intel_pmu_enable_bts,
-	.disable_bts		= intel_pmu_disable_bts,
-	.get_event_constraints	= intel_get_event_constraints
-};
-
-static __initconst struct x86_pmu amd_pmu = {
-	.name			= "AMD",
-	.handle_irq		= x86_pmu_handle_irq,
-	.disable_all		= x86_pmu_disable_all,
-	.enable_all		= x86_pmu_enable_all,
-	.enable			= x86_pmu_enable_event,
-	.disable		= x86_pmu_disable_event,
-	.eventsel		= MSR_K7_EVNTSEL0,
-	.perfctr		= MSR_K7_PERFCTR0,
-	.event_map		= amd_pmu_event_map,
-	.raw_event		= amd_pmu_raw_event,
-	.max_events		= ARRAY_SIZE(amd_perfmon_event_map),
-	.num_events		= 4,
-	.event_bits		= 48,
-	.event_mask		= (1ULL << 48) - 1,
-	.apic			= 1,
-	/* use highest bit to detect overflow */
-	.max_period		= (1ULL << 47) - 1,
-	.get_event_constraints	= amd_get_event_constraints,
-	.put_event_constraints	= amd_put_event_constraints
-};
-
-static __init int p6_pmu_init(void)
-{
-	switch (boot_cpu_data.x86_model) {
-	case 1:
-	case 3:  /* Pentium Pro */
-	case 5:
-	case 6:  /* Pentium II */
-	case 7:
-	case 8:
-	case 11: /* Pentium III */
-	case 9:
-	case 13:
-		/* Pentium M */
-		break;
-	default:
-		pr_cont("unsupported p6 CPU model %d ",
-			boot_cpu_data.x86_model);
-		return -ENODEV;
-	}
-
-	x86_pmu = p6_pmu;
-
-	return 0;
-}
-
-static __init int intel_pmu_init(void)
-{
-	union cpuid10_edx edx;
-	union cpuid10_eax eax;
-	unsigned int unused;
-	unsigned int ebx;
-	int version;
-
-	if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
-		/* check for P6 processor family */
-	   if (boot_cpu_data.x86 == 6) {
-		return p6_pmu_init();
-	   } else {
-		return -ENODEV;
-	   }
-	}
-
-	/*
-	 * Check whether the Architectural PerfMon supports
-	 * Branch Misses Retired hw_event or not.
-	 */
-	cpuid(10, &eax.full, &ebx, &unused, &edx.full);
-	if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
-		return -ENODEV;
-
-	version = eax.split.version_id;
-	if (version < 2)
-		x86_pmu = core_pmu;
-	else
-		x86_pmu = intel_pmu;
-
-	x86_pmu.version			= version;
-	x86_pmu.num_events		= eax.split.num_events;
-	x86_pmu.event_bits		= eax.split.bit_width;
-	x86_pmu.event_mask		= (1ULL << eax.split.bit_width) - 1;
-
-	/*
-	 * Quirk: v2 perfmon does not report fixed-purpose events, so
-	 * assume at least 3 events:
-	 */
-	if (version > 1)
-		x86_pmu.num_events_fixed = max((int)edx.split.num_events_fixed, 3);
-
-	/*
-	 * Install the hw-cache-events table:
-	 */
-	switch (boot_cpu_data.x86_model) {
-	case 14: /* 65 nm core solo/duo, "Yonah" */
-		pr_cont("Core events, ");
-		break;
-
-	case 15: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
-	case 22: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
-	case 23: /* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
-	case 29: /* six-core 45 nm xeon "Dunnington" */
-		memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
-		       sizeof(hw_cache_event_ids));
-
-		x86_pmu.event_constraints = intel_core2_event_constraints;
-		pr_cont("Core2 events, ");
-		break;
-
-	case 26: /* 45 nm nehalem, "Bloomfield" */
-	case 30: /* 45 nm nehalem, "Lynnfield" */
-		memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
-		       sizeof(hw_cache_event_ids));
-
-		x86_pmu.event_constraints = intel_nehalem_event_constraints;
-		pr_cont("Nehalem/Corei7 events, ");
-		break;
-	case 28:
-		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
-		       sizeof(hw_cache_event_ids));
-
-		x86_pmu.event_constraints = intel_gen_event_constraints;
-		pr_cont("Atom events, ");
-		break;
-
-	case 37: /* 32 nm nehalem, "Clarkdale" */
-	case 44: /* 32 nm nehalem, "Gulftown" */
-		memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
-		       sizeof(hw_cache_event_ids));
-
-		x86_pmu.event_constraints = intel_westmere_event_constraints;
-		pr_cont("Westmere events, ");
-		break;
-	default:
-		/*
-		 * default constraints for v2 and up
-		 */
-		x86_pmu.event_constraints = intel_gen_event_constraints;
-		pr_cont("generic architected perfmon, ");
-	}
-	return 0;
-}
-
-static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
-{
-	struct amd_nb *nb;
-	int i;
-
-	nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
-	if (!nb)
-		return NULL;
-
-	memset(nb, 0, sizeof(*nb));
-	nb->nb_id = nb_id;
-
-	/*
-	 * initialize all possible NB constraints
-	 */
-	for (i = 0; i < x86_pmu.num_events; i++) {
-		set_bit(i, nb->event_constraints[i].idxmsk);
-		nb->event_constraints[i].weight = 1;
-	}
-	return nb;
-}
-
-static void amd_pmu_cpu_online(int cpu)
-{
-	struct cpu_hw_events *cpu1, *cpu2;
-	struct amd_nb *nb = NULL;
-	int i, nb_id;
-
-	if (boot_cpu_data.x86_max_cores < 2)
-		return;
-
-	/*
-	 * function may be called too early in the
-	 * boot process, in which case nb_id is bogus
-	 */
-	nb_id = amd_get_nb_id(cpu);
-	if (nb_id == BAD_APICID)
-		return;
-
-	cpu1 = &per_cpu(cpu_hw_events, cpu);
-	cpu1->amd_nb = NULL;
-
-	raw_spin_lock(&amd_nb_lock);
-
-	for_each_online_cpu(i) {
-		cpu2 = &per_cpu(cpu_hw_events, i);
-		nb = cpu2->amd_nb;
-		if (!nb)
-			continue;
-		if (nb->nb_id == nb_id)
-			goto found;
-	}
-
-	nb = amd_alloc_nb(cpu, nb_id);
-	if (!nb) {
-		pr_err("perf_events: failed NB allocation for CPU%d\n", cpu);
-		raw_spin_unlock(&amd_nb_lock);
-		return;
-	}
-found:
-	nb->refcnt++;
-	cpu1->amd_nb = nb;
-
-	raw_spin_unlock(&amd_nb_lock);
-}
-
-static void amd_pmu_cpu_offline(int cpu)
-{
-	struct cpu_hw_events *cpuhw;
-
-	if (boot_cpu_data.x86_max_cores < 2)
-		return;
-
-	cpuhw = &per_cpu(cpu_hw_events, cpu);
-
-	raw_spin_lock(&amd_nb_lock);
-
-	if (--cpuhw->amd_nb->refcnt == 0)
-		kfree(cpuhw->amd_nb);
-
-	cpuhw->amd_nb = NULL;
-
-	raw_spin_unlock(&amd_nb_lock);
-}
-
-static __init int amd_pmu_init(void)
-{
-	/* Performance-monitoring supported from K7 and later: */
-	if (boot_cpu_data.x86 < 6)
-		return -ENODEV;
-
-	x86_pmu = amd_pmu;
-
-	/* Events are common for all AMDs */
-	memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
-	       sizeof(hw_cache_event_ids));
-
-	/*
-	 * explicitly initialize the boot cpu, other cpus will get
-	 * the cpu hotplug callbacks from smp_init()
-	 */
-	amd_pmu_cpu_online(smp_processor_id());
-	return 0;
-}
+#include "perf_event_amd.c"
+#include "perf_event_p6.c"
+#include "perf_event_intel.c"
 
 static void __init pmu_check_apic(void)
 {
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
new file mode 100644
index 0000000..6d28e08
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -0,0 +1,416 @@
+#ifdef CONFIG_CPU_SUP_AMD
+
+static raw_spinlock_t amd_nb_lock;
+
+static __initconst u64 amd_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) ] = 0x0040, /* Data Cache Accesses        */
+		[ C(RESULT_MISS)   ] = 0x0041, /* Data Cache Misses          */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0267, /* Data Prefetcher :attempts  */
+		[ C(RESULT_MISS)   ] = 0x0167, /* Data Prefetcher :cancelled */
+	},
+ },
+ [ 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) ] = 0x014B, /* Prefetch Instructions :Load */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(LL  ) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x037D, /* Requests to L2 Cache :IC+DC */
+		[ C(RESULT_MISS)   ] = 0x037E, /* L2 Cache Misses : IC+DC     */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x017F, /* L2 Fill/Writeback           */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_PREFETCH) ] = {
+		[ C(RESULT_ACCESS) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses        */
+		[ C(RESULT_MISS)   ] = 0x0046, /* L1 DTLB and L2 DLTB 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,
+	},
+ },
+ [ 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.
+ */
+static const u64 amd_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]		= 0x0076,
+  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0080,
+  [PERF_COUNT_HW_CACHE_MISSES]		= 0x0081,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
+};
+
+static u64 amd_pmu_event_map(int hw_event)
+{
+	return amd_perfmon_event_map[hw_event];
+}
+
+static u64 amd_pmu_raw_event(u64 hw_event)
+{
+#define K7_EVNTSEL_EVENT_MASK	0xF000000FFULL
+#define K7_EVNTSEL_UNIT_MASK	0x00000FF00ULL
+#define K7_EVNTSEL_EDGE_MASK	0x000040000ULL
+#define K7_EVNTSEL_INV_MASK	0x000800000ULL
+#define K7_EVNTSEL_REG_MASK	0x0FF000000ULL
+
+#define K7_EVNTSEL_MASK			\
+	(K7_EVNTSEL_EVENT_MASK |	\
+	 K7_EVNTSEL_UNIT_MASK  |	\
+	 K7_EVNTSEL_EDGE_MASK  |	\
+	 K7_EVNTSEL_INV_MASK   |	\
+	 K7_EVNTSEL_REG_MASK)
+
+	return hw_event & K7_EVNTSEL_MASK;
+}
+
+/*
+ * AMD64 events are detected based on their event codes.
+ */
+static inline int amd_is_nb_event(struct hw_perf_event *hwc)
+{
+	return (hwc->config & 0xe0) == 0xe0;
+}
+
+static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
+				      struct perf_event *event)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	struct amd_nb *nb = cpuc->amd_nb;
+	int i;
+
+	/*
+	 * only care about NB events
+	 */
+	if (!(nb && amd_is_nb_event(hwc)))
+		return;
+
+	/*
+	 * need to scan whole list because event may not have
+	 * been assigned during scheduling
+	 *
+	 * no race condition possible because event can only
+	 * be removed on one CPU at a time AND PMU is disabled
+	 * when we come here
+	 */
+	for (i = 0; i < x86_pmu.num_events; i++) {
+		if (nb->owners[i] == event) {
+			cmpxchg(nb->owners+i, event, NULL);
+			break;
+		}
+	}
+}
+
+ /*
+  * AMD64 NorthBridge events need special treatment because
+  * counter access needs to be synchronized across all cores
+  * of a package. Refer to BKDG section 3.12
+  *
+  * NB events are events measuring L3 cache, Hypertransport
+  * traffic. They are identified by an event code >= 0xe00.
+  * They measure events on the NorthBride which is shared
+  * by all cores on a package. NB events are counted on a
+  * shared set of counters. When a NB event is programmed
+  * in a counter, the data actually comes from a shared
+  * counter. Thus, access to those counters needs to be
+  * synchronized.
+  *
+  * We implement the synchronization such that no two cores
+  * can be measuring NB events using the same counters. Thus,
+  * we maintain a per-NB allocation table. The available slot
+  * is propagated using the event_constraint structure.
+  *
+  * We provide only one choice for each NB event based on
+  * the fact that only NB events have restrictions. Consequently,
+  * if a counter is available, there is a guarantee the NB event
+  * will be assigned to it. If no slot is available, an empty
+  * constraint is returned and scheduling will eventually fail
+  * for this event.
+  *
+  * Note that all cores attached the same NB compete for the same
+  * counters to host NB events, this is why we use atomic ops. Some
+  * multi-chip CPUs may have more than one NB.
+  *
+  * Given that resources are allocated (cmpxchg), they must be
+  * eventually freed for others to use. This is accomplished by
+  * calling amd_put_event_constraints().
+  *
+  * Non NB events are not impacted by this restriction.
+  */
+static struct event_constraint *
+amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	struct amd_nb *nb = cpuc->amd_nb;
+	struct perf_event *old = NULL;
+	int max = x86_pmu.num_events;
+	int i, j, k = -1;
+
+	/*
+	 * if not NB event or no NB, then no constraints
+	 */
+	if (!(nb && amd_is_nb_event(hwc)))
+		return &unconstrained;
+
+	/*
+	 * detect if already present, if so reuse
+	 *
+	 * cannot merge with actual allocation
+	 * because of possible holes
+	 *
+	 * event can already be present yet not assigned (in hwc->idx)
+	 * because of successive calls to x86_schedule_events() from
+	 * hw_perf_group_sched_in() without hw_perf_enable()
+	 */
+	for (i = 0; i < max; i++) {
+		/*
+		 * keep track of first free slot
+		 */
+		if (k == -1 && !nb->owners[i])
+			k = i;
+
+		/* already present, reuse */
+		if (nb->owners[i] == event)
+			goto done;
+	}
+	/*
+	 * not present, so grab a new slot
+	 * starting either at:
+	 */
+	if (hwc->idx != -1) {
+		/* previous assignment */
+		i = hwc->idx;
+	} else if (k != -1) {
+		/* start from free slot found */
+		i = k;
+	} else {
+		/*
+		 * event not found, no slot found in
+		 * first pass, try again from the
+		 * beginning
+		 */
+		i = 0;
+	}
+	j = i;
+	do {
+		old = cmpxchg(nb->owners+i, NULL, event);
+		if (!old)
+			break;
+		if (++i == max)
+			i = 0;
+	} while (i != j);
+done:
+	if (!old)
+		return &nb->event_constraints[i];
+
+	return &emptyconstraint;
+}
+
+static __initconst struct x86_pmu amd_pmu = {
+	.name			= "AMD",
+	.handle_irq		= x86_pmu_handle_irq,
+	.disable_all		= x86_pmu_disable_all,
+	.enable_all		= x86_pmu_enable_all,
+	.enable			= x86_pmu_enable_event,
+	.disable		= x86_pmu_disable_event,
+	.eventsel		= MSR_K7_EVNTSEL0,
+	.perfctr		= MSR_K7_PERFCTR0,
+	.event_map		= amd_pmu_event_map,
+	.raw_event		= amd_pmu_raw_event,
+	.max_events		= ARRAY_SIZE(amd_perfmon_event_map),
+	.num_events		= 4,
+	.event_bits		= 48,
+	.event_mask		= (1ULL << 48) - 1,
+	.apic			= 1,
+	/* use highest bit to detect overflow */
+	.max_period		= (1ULL << 47) - 1,
+	.get_event_constraints	= amd_get_event_constraints,
+	.put_event_constraints	= amd_put_event_constraints
+};
+
+static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
+{
+	struct amd_nb *nb;
+	int i;
+
+	nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
+	if (!nb)
+		return NULL;
+
+	memset(nb, 0, sizeof(*nb));
+	nb->nb_id = nb_id;
+
+	/*
+	 * initialize all possible NB constraints
+	 */
+	for (i = 0; i < x86_pmu.num_events; i++) {
+		set_bit(i, nb->event_constraints[i].idxmsk);
+		nb->event_constraints[i].weight = 1;
+	}
+	return nb;
+}
+
+static void amd_pmu_cpu_online(int cpu)
+{
+	struct cpu_hw_events *cpu1, *cpu2;
+	struct amd_nb *nb = NULL;
+	int i, nb_id;
+
+	if (boot_cpu_data.x86_max_cores < 2)
+		return;
+
+	/*
+	 * function may be called too early in the
+	 * boot process, in which case nb_id is bogus
+	 */
+	nb_id = amd_get_nb_id(cpu);
+	if (nb_id == BAD_APICID)
+		return;
+
+	cpu1 = &per_cpu(cpu_hw_events, cpu);
+	cpu1->amd_nb = NULL;
+
+	raw_spin_lock(&amd_nb_lock);
+
+	for_each_online_cpu(i) {
+		cpu2 = &per_cpu(cpu_hw_events, i);
+		nb = cpu2->amd_nb;
+		if (!nb)
+			continue;
+		if (nb->nb_id == nb_id)
+			goto found;
+	}
+
+	nb = amd_alloc_nb(cpu, nb_id);
+	if (!nb) {
+		pr_err("perf_events: failed NB allocation for CPU%d\n", cpu);
+		raw_spin_unlock(&amd_nb_lock);
+		return;
+	}
+found:
+	nb->refcnt++;
+	cpu1->amd_nb = nb;
+
+	raw_spin_unlock(&amd_nb_lock);
+}
+
+static void amd_pmu_cpu_offline(int cpu)
+{
+	struct cpu_hw_events *cpuhw;
+
+	if (boot_cpu_data.x86_max_cores < 2)
+		return;
+
+	cpuhw = &per_cpu(cpu_hw_events, cpu);
+
+	raw_spin_lock(&amd_nb_lock);
+
+	if (--cpuhw->amd_nb->refcnt == 0)
+		kfree(cpuhw->amd_nb);
+
+	cpuhw->amd_nb = NULL;
+
+	raw_spin_unlock(&amd_nb_lock);
+}
+
+static __init int amd_pmu_init(void)
+{
+	/* Performance-monitoring supported from K7 and later: */
+	if (boot_cpu_data.x86 < 6)
+		return -ENODEV;
+
+	x86_pmu = amd_pmu;
+
+	/* Events are common for all AMDs */
+	memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
+	       sizeof(hw_cache_event_ids));
+
+	/*
+	 * explicitly initialize the boot cpu, other cpus will get
+	 * the cpu hotplug callbacks from smp_init()
+	 */
+	amd_pmu_cpu_online(smp_processor_id());
+	return 0;
+}
+
+#else /* CONFIG_CPU_SUP_AMD */
+
+static int amd_pmu_init(void)
+{
+	return 0;
+}
+
+static void amd_pmu_cpu_online(int cpu)
+{
+}
+
+static void amd_pmu_cpu_offline(int cpu)
+{
+}
+
+#endif
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
new file mode 100644
index 0000000..cf6590c
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -0,0 +1,971 @@
+#ifdef CONFIG_CPU_SUP_INTEL
+
+/*
+ * Intel PerfMon v3. Used on Core2 and later.
+ */
+static const u64 intel_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]		= 0x003c,
+  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x4f2e,
+  [PERF_COUNT_HW_CACHE_MISSES]		= 0x412e,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
+  [PERF_COUNT_HW_BUS_CYCLES]		= 0x013c,
+};
+
+static struct event_constraint intel_core_event_constraints[] =
+{
+	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
+	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
+	INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
+	INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
+	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
+	INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FP_COMP_INSTR_RET */
+	EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_core2_event_constraints[] =
+{
+	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
+	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
+	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
+	INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */
+	INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */
+	INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
+	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
+	INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
+	INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED */
+	EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_nehalem_event_constraints[] =
+{
+	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */
+	INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */
+	INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */
+	INTEL_EVENT_CONSTRAINT(0x43, 0x3), /* L1D_ALL_REF */
+	INTEL_EVENT_CONSTRAINT(0x48, 0x3), /* L1D_PEND_MISS */
+	INTEL_EVENT_CONSTRAINT(0x4e, 0x3), /* L1D_PREFETCH */
+	INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
+	INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
+	EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_westmere_event_constraints[] =
+{
+	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
+	INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
+	INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
+	EVENT_CONSTRAINT_END
+};
+
+static struct event_constraint intel_gen_event_constraints[] =
+{
+	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
+	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	EVENT_CONSTRAINT_END
+};
+
+static u64 intel_pmu_event_map(int hw_event)
+{
+	return intel_perfmon_event_map[hw_event];
+}
+
+static __initconst u64 westmere_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) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
+		[ C(RESULT_MISS)   ] = 0x0151, /* L1D.REPL                     */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
+		[ C(RESULT_MISS)   ] = 0x0251, /* L1D.M_REPL                   */
+	},
+	[ 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) ] = 0x0380, /* 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(LL  ) ] = {
+	[ 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) ] = 0x4f2e, /* LLC Reference                */
+		[ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
+	},
+ },
+ [ C(DTLB) ] = {
+	[ C(OP_READ) ] = {
+		[ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS       */
+		[ C(RESULT_MISS)   ] = 0x0108, /* DTLB_LOAD_MISSES.ANY         */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES      */
+		[ 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_MISSES.ANY              */
+	},
+	[ 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 __initconst 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) ] = 0x0380, /* 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(LL  ) ] = {
+	[ 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) ] = 0x4f2e, /* LLC Reference                */
+		[ C(RESULT_MISS)   ] = 0x412e, /* LLC Misses                   */
+	},
+ },
+ [ 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)   ] = 0x20c8, /* 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 __initconst u64 core2_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) ] = 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(LL  ) ] = {
+	[ 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 __initconst u64 atom_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) ] = 0x2140, /* L1D_CACHE.LD               */
+		[ C(RESULT_MISS)   ] = 0,
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x2240, /* 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) ] = 0x0380, /* 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) ] = 0,
+		[ C(RESULT_MISS)   ] = 0,
+	},
+ },
+ [ C(LL  ) ] = {
+	[ 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) ] = 0x2140, /* L1D_CACHE_LD.MESI  (alias) */
+		[ C(RESULT_MISS)   ] = 0x0508, /* DTLB_MISSES.MISS_LD        */
+	},
+	[ C(OP_WRITE) ] = {
+		[ C(RESULT_ACCESS) ] = 0x2240, /* 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 hw_event)
+{
+#define CORE_EVNTSEL_EVENT_MASK		0x000000FFULL
+#define CORE_EVNTSEL_UNIT_MASK		0x0000FF00ULL
+#define CORE_EVNTSEL_EDGE_MASK		0x00040000ULL
+#define CORE_EVNTSEL_INV_MASK		0x00800000ULL
+#define CORE_EVNTSEL_REG_MASK		0xFF000000ULL
+
+#define CORE_EVNTSEL_MASK		\
+	(INTEL_ARCH_EVTSEL_MASK |	\
+	 INTEL_ARCH_UNIT_MASK   |	\
+	 INTEL_ARCH_EDGE_MASK   |	\
+	 INTEL_ARCH_INV_MASK    |	\
+	 INTEL_ARCH_CNT_MASK)
+
+	return hw_event & CORE_EVNTSEL_MASK;
+}
+
+static void intel_pmu_enable_bts(u64 config)
+{
+	unsigned long debugctlmsr;
+
+	debugctlmsr = get_debugctlmsr();
+
+	debugctlmsr |= X86_DEBUGCTL_TR;
+	debugctlmsr |= X86_DEBUGCTL_BTS;
+	debugctlmsr |= X86_DEBUGCTL_BTINT;
+
+	if (!(config & ARCH_PERFMON_EVENTSEL_OS))
+		debugctlmsr |= X86_DEBUGCTL_BTS_OFF_OS;
+
+	if (!(config & ARCH_PERFMON_EVENTSEL_USR))
+		debugctlmsr |= X86_DEBUGCTL_BTS_OFF_USR;
+
+	update_debugctlmsr(debugctlmsr);
+}
+
+static void intel_pmu_disable_bts(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	unsigned long debugctlmsr;
+
+	if (!cpuc->ds)
+		return;
+
+	debugctlmsr = get_debugctlmsr();
+
+	debugctlmsr &=
+		~(X86_DEBUGCTL_TR | X86_DEBUGCTL_BTS | X86_DEBUGCTL_BTINT |
+		  X86_DEBUGCTL_BTS_OFF_OS | X86_DEBUGCTL_BTS_OFF_USR);
+
+	update_debugctlmsr(debugctlmsr);
+}
+
+static void intel_pmu_disable_all(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
+
+	if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask))
+		intel_pmu_disable_bts();
+}
+
+static void intel_pmu_enable_all(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
+
+	if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
+		struct perf_event *event =
+			cpuc->events[X86_PMC_IDX_FIXED_BTS];
+
+		if (WARN_ON_ONCE(!event))
+			return;
+
+		intel_pmu_enable_bts(event->hw.config);
+	}
+}
+
+static inline u64 intel_pmu_get_status(void)
+{
+	u64 status;
+
+	rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
+
+	return status;
+}
+
+static inline void intel_pmu_ack_status(u64 ack)
+{
+	wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, ack);
+}
+
+static inline void
+intel_pmu_disable_fixed(struct hw_perf_event *hwc, int __idx)
+{
+	int idx = __idx - X86_PMC_IDX_FIXED;
+	u64 ctrl_val, mask;
+
+	mask = 0xfULL << (idx * 4);
+
+	rdmsrl(hwc->config_base, ctrl_val);
+	ctrl_val &= ~mask;
+	(void)checking_wrmsrl(hwc->config_base, ctrl_val);
+}
+
+static void intel_pmu_drain_bts_buffer(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	struct debug_store *ds = cpuc->ds;
+	struct bts_record {
+		u64	from;
+		u64	to;
+		u64	flags;
+	};
+	struct perf_event *event = cpuc->events[X86_PMC_IDX_FIXED_BTS];
+	struct bts_record *at, *top;
+	struct perf_output_handle handle;
+	struct perf_event_header header;
+	struct perf_sample_data data;
+	struct pt_regs regs;
+
+	if (!event)
+		return;
+
+	if (!ds)
+		return;
+
+	at  = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
+	top = (struct bts_record *)(unsigned long)ds->bts_index;
+
+	if (top <= at)
+		return;
+
+	ds->bts_index = ds->bts_buffer_base;
+
+
+	data.period	= event->hw.last_period;
+	data.addr	= 0;
+	data.raw	= NULL;
+	regs.ip		= 0;
+
+	/*
+	 * Prepare a generic sample, i.e. fill in the invariant fields.
+	 * We will overwrite the from and to address before we output
+	 * the sample.
+	 */
+	perf_prepare_sample(&header, &data, event, &regs);
+
+	if (perf_output_begin(&handle, event,
+			      header.size * (top - at), 1, 1))
+		return;
+
+	for (; at < top; at++) {
+		data.ip		= at->from;
+		data.addr	= at->to;
+
+		perf_output_sample(&handle, &header, &data, event);
+	}
+
+	perf_output_end(&handle);
+
+	/* There's new data available. */
+	event->hw.interrupts++;
+	event->pending_kill = POLL_IN;
+}
+
+static inline void
+intel_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+{
+	if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
+		intel_pmu_disable_bts();
+		intel_pmu_drain_bts_buffer();
+		return;
+	}
+
+	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
+		intel_pmu_disable_fixed(hwc, idx);
+		return;
+	}
+
+	x86_pmu_disable_event(hwc, idx);
+}
+
+static inline void
+intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx)
+{
+	int idx = __idx - X86_PMC_IDX_FIXED;
+	u64 ctrl_val, bits, mask;
+	int err;
+
+	/*
+	 * Enable IRQ generation (0x8),
+	 * and enable ring-3 counting (0x2) and ring-0 counting (0x1)
+	 * if requested:
+	 */
+	bits = 0x8ULL;
+	if (hwc->config & ARCH_PERFMON_EVENTSEL_USR)
+		bits |= 0x2;
+	if (hwc->config & ARCH_PERFMON_EVENTSEL_OS)
+		bits |= 0x1;
+
+	/*
+	 * ANY bit is supported in v3 and up
+	 */
+	if (x86_pmu.version > 2 && hwc->config & ARCH_PERFMON_EVENTSEL_ANY)
+		bits |= 0x4;
+
+	bits <<= (idx * 4);
+	mask = 0xfULL << (idx * 4);
+
+	rdmsrl(hwc->config_base, ctrl_val);
+	ctrl_val &= ~mask;
+	ctrl_val |= bits;
+	err = checking_wrmsrl(hwc->config_base, ctrl_val);
+}
+
+static void intel_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+{
+	if (unlikely(idx == X86_PMC_IDX_FIXED_BTS)) {
+		if (!__get_cpu_var(cpu_hw_events).enabled)
+			return;
+
+		intel_pmu_enable_bts(hwc->config);
+		return;
+	}
+
+	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
+		intel_pmu_enable_fixed(hwc, idx);
+		return;
+	}
+
+	__x86_pmu_enable_event(hwc, idx);
+}
+
+/*
+ * Save and restart an expired event. Called by NMI contexts,
+ * so it has to be careful about preempting normal event ops:
+ */
+static int intel_pmu_save_and_restart(struct perf_event *event)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	int idx = hwc->idx;
+	int ret;
+
+	x86_perf_event_update(event, hwc, idx);
+	ret = x86_perf_event_set_period(event, hwc, idx);
+
+	return ret;
+}
+
+static void intel_pmu_reset(void)
+{
+	struct debug_store *ds = __get_cpu_var(cpu_hw_events).ds;
+	unsigned long flags;
+	int idx;
+
+	if (!x86_pmu.num_events)
+		return;
+
+	local_irq_save(flags);
+
+	printk("clearing PMU state on CPU#%d\n", smp_processor_id());
+
+	for (idx = 0; idx < x86_pmu.num_events; idx++) {
+		checking_wrmsrl(x86_pmu.eventsel + idx, 0ull);
+		checking_wrmsrl(x86_pmu.perfctr  + idx, 0ull);
+	}
+	for (idx = 0; idx < x86_pmu.num_events_fixed; idx++) {
+		checking_wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, 0ull);
+	}
+	if (ds)
+		ds->bts_index = ds->bts_buffer_base;
+
+	local_irq_restore(flags);
+}
+
+/*
+ * This handler is triggered by the local APIC, so the APIC IRQ handling
+ * rules apply:
+ */
+static int intel_pmu_handle_irq(struct pt_regs *regs)
+{
+	struct perf_sample_data data;
+	struct cpu_hw_events *cpuc;
+	int bit, loops;
+	u64 ack, status;
+
+	data.addr = 0;
+	data.raw = NULL;
+
+	cpuc = &__get_cpu_var(cpu_hw_events);
+
+	perf_disable();
+	intel_pmu_drain_bts_buffer();
+	status = intel_pmu_get_status();
+	if (!status) {
+		perf_enable();
+		return 0;
+	}
+
+	loops = 0;
+again:
+	if (++loops > 100) {
+		WARN_ONCE(1, "perfevents: irq loop stuck!\n");
+		perf_event_print_debug();
+		intel_pmu_reset();
+		perf_enable();
+		return 1;
+	}
+
+	inc_irq_stat(apic_perf_irqs);
+	ack = status;
+	for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
+		struct perf_event *event = cpuc->events[bit];
+
+		clear_bit(bit, (unsigned long *) &status);
+		if (!test_bit(bit, cpuc->active_mask))
+			continue;
+
+		if (!intel_pmu_save_and_restart(event))
+			continue;
+
+		data.period = event->hw.last_period;
+
+		if (perf_event_overflow(event, 1, &data, regs))
+			intel_pmu_disable_event(&event->hw, bit);
+	}
+
+	intel_pmu_ack_status(ack);
+
+	/*
+	 * Repeat if there is more work to be done:
+	 */
+	status = intel_pmu_get_status();
+	if (status)
+		goto again;
+
+	perf_enable();
+
+	return 1;
+}
+
+static struct event_constraint bts_constraint =
+	EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
+
+static struct event_constraint *
+intel_special_constraints(struct perf_event *event)
+{
+	unsigned int hw_event;
+
+	hw_event = event->hw.config & INTEL_ARCH_EVENT_MASK;
+
+	if (unlikely((hw_event ==
+		      x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) &&
+		     (event->hw.sample_period == 1))) {
+
+		return &bts_constraint;
+	}
+	return NULL;
+}
+
+static struct event_constraint *
+intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
+{
+	struct event_constraint *c;
+
+	c = intel_special_constraints(event);
+	if (c)
+		return c;
+
+	return x86_get_event_constraints(cpuc, event);
+}
+
+static __initconst struct x86_pmu core_pmu = {
+	.name			= "core",
+	.handle_irq		= x86_pmu_handle_irq,
+	.disable_all		= x86_pmu_disable_all,
+	.enable_all		= x86_pmu_enable_all,
+	.enable			= x86_pmu_enable_event,
+	.disable		= x86_pmu_disable_event,
+	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
+	.perfctr		= MSR_ARCH_PERFMON_PERFCTR0,
+	.event_map		= intel_pmu_event_map,
+	.raw_event		= intel_pmu_raw_event,
+	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
+	.apic			= 1,
+	/*
+	 * Intel PMCs cannot be accessed sanely above 32 bit width,
+	 * so we install an artificial 1<<31 period regardless of
+	 * the generic event period:
+	 */
+	.max_period		= (1ULL << 31) - 1,
+	.get_event_constraints	= intel_get_event_constraints,
+	.event_constraints	= intel_core_event_constraints,
+};
+
+static __initconst struct x86_pmu intel_pmu = {
+	.name			= "Intel",
+	.handle_irq		= intel_pmu_handle_irq,
+	.disable_all		= intel_pmu_disable_all,
+	.enable_all		= intel_pmu_enable_all,
+	.enable			= intel_pmu_enable_event,
+	.disable		= intel_pmu_disable_event,
+	.eventsel		= MSR_ARCH_PERFMON_EVENTSEL0,
+	.perfctr		= MSR_ARCH_PERFMON_PERFCTR0,
+	.event_map		= intel_pmu_event_map,
+	.raw_event		= intel_pmu_raw_event,
+	.max_events		= ARRAY_SIZE(intel_perfmon_event_map),
+	.apic			= 1,
+	/*
+	 * Intel PMCs cannot be accessed sanely above 32 bit width,
+	 * so we install an artificial 1<<31 period regardless of
+	 * the generic event period:
+	 */
+	.max_period		= (1ULL << 31) - 1,
+	.enable_bts		= intel_pmu_enable_bts,
+	.disable_bts		= intel_pmu_disable_bts,
+	.get_event_constraints	= intel_get_event_constraints
+};
+
+static __init int intel_pmu_init(void)
+{
+	union cpuid10_edx edx;
+	union cpuid10_eax eax;
+	unsigned int unused;
+	unsigned int ebx;
+	int version;
+
+	if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
+		/* check for P6 processor family */
+	   if (boot_cpu_data.x86 == 6) {
+		return p6_pmu_init();
+	   } else {
+		return -ENODEV;
+	   }
+	}
+
+	/*
+	 * Check whether the Architectural PerfMon supports
+	 * Branch Misses Retired hw_event or not.
+	 */
+	cpuid(10, &eax.full, &ebx, &unused, &edx.full);
+	if (eax.split.mask_length <= ARCH_PERFMON_BRANCH_MISSES_RETIRED)
+		return -ENODEV;
+
+	version = eax.split.version_id;
+	if (version < 2)
+		x86_pmu = core_pmu;
+	else
+		x86_pmu = intel_pmu;
+
+	x86_pmu.version			= version;
+	x86_pmu.num_events		= eax.split.num_events;
+	x86_pmu.event_bits		= eax.split.bit_width;
+	x86_pmu.event_mask		= (1ULL << eax.split.bit_width) - 1;
+
+	/*
+	 * Quirk: v2 perfmon does not report fixed-purpose events, so
+	 * assume at least 3 events:
+	 */
+	if (version > 1)
+		x86_pmu.num_events_fixed = max((int)edx.split.num_events_fixed, 3);
+
+	/*
+	 * Install the hw-cache-events table:
+	 */
+	switch (boot_cpu_data.x86_model) {
+	case 14: /* 65 nm core solo/duo, "Yonah" */
+		pr_cont("Core events, ");
+		break;
+
+	case 15: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
+	case 22: /* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */
+	case 23: /* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
+	case 29: /* six-core 45 nm xeon "Dunnington" */
+		memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		x86_pmu.event_constraints = intel_core2_event_constraints;
+		pr_cont("Core2 events, ");
+		break;
+
+	case 26: /* 45 nm nehalem, "Bloomfield" */
+	case 30: /* 45 nm nehalem, "Lynnfield" */
+		memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		x86_pmu.event_constraints = intel_nehalem_event_constraints;
+		pr_cont("Nehalem/Corei7 events, ");
+		break;
+	case 28:
+		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		x86_pmu.event_constraints = intel_gen_event_constraints;
+		pr_cont("Atom events, ");
+		break;
+
+	case 37: /* 32 nm nehalem, "Clarkdale" */
+	case 44: /* 32 nm nehalem, "Gulftown" */
+		memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
+		       sizeof(hw_cache_event_ids));
+
+		x86_pmu.event_constraints = intel_westmere_event_constraints;
+		pr_cont("Westmere events, ");
+		break;
+	default:
+		/*
+		 * default constraints for v2 and up
+		 */
+		x86_pmu.event_constraints = intel_gen_event_constraints;
+		pr_cont("generic architected perfmon, ");
+	}
+	return 0;
+}
+
+#else /* CONFIG_CPU_SUP_INTEL */
+
+static int intel_pmu_init(void)
+{
+	return 0;
+}
+
+#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
new file mode 100644
index 0000000..1ca5ba0
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -0,0 +1,157 @@
+#ifdef CONFIG_CPU_SUP_INTEL
+
+/*
+ * Not sure about some of these
+ */
+static const u64 p6_perfmon_event_map[] =
+{
+  [PERF_COUNT_HW_CPU_CYCLES]		= 0x0079,
+  [PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
+  [PERF_COUNT_HW_CACHE_REFERENCES]	= 0x0f2e,
+  [PERF_COUNT_HW_CACHE_MISSES]		= 0x012e,
+  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c4,
+  [PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c5,
+  [PERF_COUNT_HW_BUS_CYCLES]		= 0x0062,
+};
+
+static u64 p6_pmu_event_map(int hw_event)
+{
+	return p6_perfmon_event_map[hw_event];
+}
+
+/*
+ * Event 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_EVENT			0x0000002EULL
+
+static u64 p6_pmu_raw_event(u64 hw_event)
+{
+#define P6_EVNTSEL_EVENT_MASK		0x000000FFULL
+#define P6_EVNTSEL_UNIT_MASK		0x0000FF00ULL
+#define P6_EVNTSEL_EDGE_MASK		0x00040000ULL
+#define P6_EVNTSEL_INV_MASK		0x00800000ULL
+#define P6_EVNTSEL_REG_MASK		0xFF000000ULL
+
+#define P6_EVNTSEL_MASK			\
+	(P6_EVNTSEL_EVENT_MASK |	\
+	 P6_EVNTSEL_UNIT_MASK  |	\
+	 P6_EVNTSEL_EDGE_MASK  |	\
+	 P6_EVNTSEL_INV_MASK   |	\
+	 P6_EVNTSEL_REG_MASK)
+
+	return hw_event & P6_EVNTSEL_MASK;
+}
+
+static struct event_constraint p6_event_constraints[] =
+{
+	INTEL_EVENT_CONSTRAINT(0xc1, 0x1),	/* FLOPS */
+	INTEL_EVENT_CONSTRAINT(0x10, 0x1),	/* FP_COMP_OPS_EXE */
+	INTEL_EVENT_CONSTRAINT(0x11, 0x1),	/* FP_ASSIST */
+	INTEL_EVENT_CONSTRAINT(0x12, 0x2),	/* MUL */
+	INTEL_EVENT_CONSTRAINT(0x13, 0x2),	/* DIV */
+	INTEL_EVENT_CONSTRAINT(0x14, 0x1),	/* CYCLES_DIV_BUSY */
+	EVENT_CONSTRAINT_END
+};
+
+static void p6_pmu_disable_all(void)
+{
+	u64 val;
+
+	/* p6 only has one enable register */
+	rdmsrl(MSR_P6_EVNTSEL0, val);
+	val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE;
+	wrmsrl(MSR_P6_EVNTSEL0, val);
+}
+
+static void p6_pmu_enable_all(void)
+{
+	unsigned long val;
+
+	/* p6 only has one enable register */
+	rdmsrl(MSR_P6_EVNTSEL0, val);
+	val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+	wrmsrl(MSR_P6_EVNTSEL0, val);
+}
+
+static inline void
+p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	u64 val = P6_NOP_EVENT;
+
+	if (cpuc->enabled)
+		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+
+	(void)checking_wrmsrl(hwc->config_base + idx, val);
+}
+
+static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	u64 val;
+
+	val = hwc->config;
+	if (cpuc->enabled)
+		val |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+
+	(void)checking_wrmsrl(hwc->config_base + idx, val);
+}
+
+static __initconst struct x86_pmu p6_pmu = {
+	.name			= "p6",
+	.handle_irq		= x86_pmu_handle_irq,
+	.disable_all		= p6_pmu_disable_all,
+	.enable_all		= p6_pmu_enable_all,
+	.enable			= p6_pmu_enable_event,
+	.disable		= p6_pmu_disable_event,
+	.eventsel		= MSR_P6_EVNTSEL0,
+	.perfctr		= MSR_P6_PERFCTR0,
+	.event_map		= p6_pmu_event_map,
+	.raw_event		= p6_pmu_raw_event,
+	.max_events		= ARRAY_SIZE(p6_perfmon_event_map),
+	.apic			= 1,
+	.max_period		= (1ULL << 31) - 1,
+	.version		= 0,
+	.num_events		= 2,
+	/*
+	 * Events have 40 bits implemented. However they are designed such
+	 * that bits [32-39] are sign extensions of bit 31. As such the
+	 * effective width of a event for P6-like PMU is 32 bits only.
+	 *
+	 * See IA-32 Intel Architecture Software developer manual Vol 3B
+	 */
+	.event_bits		= 32,
+	.event_mask		= (1ULL << 32) - 1,
+	.get_event_constraints	= x86_get_event_constraints,
+	.event_constraints	= p6_event_constraints,
+};
+
+static __init int p6_pmu_init(void)
+{
+	switch (boot_cpu_data.x86_model) {
+	case 1:
+	case 3:  /* Pentium Pro */
+	case 5:
+	case 6:  /* Pentium II */
+	case 7:
+	case 8:
+	case 11: /* Pentium III */
+	case 9:
+	case 13:
+		/* Pentium M */
+		break;
+	default:
+		pr_cont("unsupported p6 CPU model %d ",
+			boot_cpu_data.x86_model);
+		return -ENODEV;
+	}
+
+	x86_pmu = p6_pmu;
+
+	return 0;
+}
+
+#endif /* CONFIG_CPU_SUP_INTEL */

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

* [tip:perf/nmi] nmi_watchdog: Tell the world we're active
       [not found]             ` <new-submission>
                                 ` (489 preceding siblings ...)
  2010-02-26 14:54               ` [tip:perf/core] perf_events, x86: Split PMU definitions into separate files tip-bot for Peter Zijlstra
@ 2010-03-02 14:30               ` tip-bot for Peter Zijlstra
  2010-03-02 14:30               ` [tip:perf/core] perf, x86: Restrict the ANY flag tip-bot for Peter Zijlstra
                                 ` (215 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-02 14:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo, dzickus

Commit-ID:  5671a10e2bc7f99d9157c6044faf8be2ef302361
Gitweb:     http://git.kernel.org/tip/5671a10e2bc7f99d9157c6044faf8be2ef302361
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Mar 2010 14:20:14 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Mar 2010 15:02:05 +0100

nmi_watchdog: Tell the world we're active

Because I was wondering why perf stat wasn't working as expected..

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Don Zickus <dzickus@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/nmi_watchdog.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/nmi_watchdog.c b/kernel/nmi_watchdog.c
index 0a6f57f..a79d211 100644
--- a/kernel/nmi_watchdog.c
+++ b/kernel/nmi_watchdog.c
@@ -244,6 +244,8 @@ static int __init spawn_nmi_watchdog_task(void)
 	if (nonmi_watchdog)
 		return 0;
 
+	printk(KERN_INFO "NMI watchdog enabled, takes one hw-pmu counter.\n");
+
 	err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
 	if (err == NOTIFY_BAD) {
 		BUG();

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

* [tip:perf/core] perf, x86: Restrict the ANY flag
       [not found]             ` <new-submission>
                                 ` (490 preceding siblings ...)
  2010-03-02 14:30               ` [tip:perf/nmi] nmi_watchdog: Tell the world we're active tip-bot for Peter Zijlstra
@ 2010-03-02 14:30               ` tip-bot for Peter Zijlstra
  2010-03-02 14:31               ` [tip:perf/core] perf_events, x86: Fixup fixed counter constraints tip-bot for Peter Zijlstra
                                 ` (214 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-02 14:30 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  320ebf09cbb6d01954c9a060266aa8e0d27f4638
Gitweb:     http://git.kernel.org/tip/320ebf09cbb6d01954c9a060266aa8e0d27f4638
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 2 Mar 2010 12:35:37 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Mar 2010 15:06:46 +0100

perf, x86: Restrict the ANY flag

The ANY flag can show SMT data of another task (like 'top'),
so we want to disable it when system-wide profiling is
disabled.

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_event.c |    3 +++
 include/linux/perf_event.h       |   15 +++++++++++++++
 kernel/perf_event.c              |   15 ---------------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 6531b4b..aab2e1c 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -503,6 +503,9 @@ static int __hw_perf_event_init(struct perf_event *event)
 	 */
 	if (attr->type == PERF_TYPE_RAW) {
 		hwc->config |= x86_pmu.raw_event(attr->config);
+		if ((hwc->config & ARCH_PERFMON_EVENTSEL_ANY) &&
+		    perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
+			return -EACCES;
 		return 0;
 	}
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 04f06b4..90e0521 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -857,6 +857,21 @@ extern int sysctl_perf_event_paranoid;
 extern int sysctl_perf_event_mlock;
 extern int sysctl_perf_event_sample_rate;
 
+static inline bool perf_paranoid_tracepoint_raw(void)
+{
+	return sysctl_perf_event_paranoid > -1;
+}
+
+static inline bool perf_paranoid_cpu(void)
+{
+	return sysctl_perf_event_paranoid > 0;
+}
+
+static inline bool perf_paranoid_kernel(void)
+{
+	return sysctl_perf_event_paranoid > 1;
+}
+
 extern void perf_event_init(void);
 extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
 extern void perf_bp_event(struct perf_event *event, void *data);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a661e79..482d5e1 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -56,21 +56,6 @@ static atomic_t nr_task_events __read_mostly;
  */
 int sysctl_perf_event_paranoid __read_mostly = 1;
 
-static inline bool perf_paranoid_tracepoint_raw(void)
-{
-	return sysctl_perf_event_paranoid > -1;
-}
-
-static inline bool perf_paranoid_cpu(void)
-{
-	return sysctl_perf_event_paranoid > 0;
-}
-
-static inline bool perf_paranoid_kernel(void)
-{
-	return sysctl_perf_event_paranoid > 1;
-}
-
 int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */
 
 /*

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

* [tip:perf/core] perf_events, x86: Fixup fixed counter constraints
       [not found]             ` <new-submission>
                                 ` (491 preceding siblings ...)
  2010-03-02 14:30               ` [tip:perf/core] perf, x86: Restrict the ANY flag tip-bot for Peter Zijlstra
@ 2010-03-02 14:31               ` tip-bot for Peter Zijlstra
  2010-03-02 16:26                 ` Stephane Eranian
  2010-03-09  8:21               ` [tip:perf/urgent] MAINTAINERS: Add Arnaldo as tools/perf/ co-maintainer tip-bot for Ingo Molnar
                                 ` (213 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-02 14:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  b622d644c7d61a5cb95b74e7b143c263bed21f0a
Gitweb:     http://git.kernel.org/tip/b622d644c7d61a5cb95b74e7b143c263bed21f0a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 1 Feb 2010 15:36:30 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 2 Mar 2010 15:06:47 +0100

perf_events, x86: Fixup fixed counter constraints

Patch 1da53e0230 ("perf_events, x86: Improve x86 event scheduling")
lost us one of the fixed purpose counters and then ed8777fc13
("perf_events, x86: Fix event constraint masks") broke it even
further.

Widen the fixed event mask to event+umask and specify the full config
for each of the 3 fixed purpose counters. Then let the init code fill
out the placement for the GP regs based on the cpuid info.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/include/asm/perf_event.h      |    2 +-
 arch/x86/kernel/cpu/perf_event.c       |   25 ++++++++++++++++++-------
 arch/x86/kernel/cpu/perf_event_intel.c |   31 +++++++++++++++++++++----------
 3 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 80e6936..db6109a 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -50,7 +50,7 @@
 	 INTEL_ARCH_INV_MASK| \
 	 INTEL_ARCH_EDGE_MASK|\
 	 INTEL_ARCH_UNIT_MASK|\
-	 INTEL_ARCH_EVTSEL_MASK)
+	 INTEL_ARCH_EVENT_MASK)
 
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL		      0x3c
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK		(0x00 << 8)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index aab2e1c..bfc43fa 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -73,10 +73,10 @@ struct debug_store {
 struct event_constraint {
 	union {
 		unsigned long	idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
-		u64		idxmsk64[1];
+		u64		idxmsk64;
 	};
-	int	code;
-	int	cmask;
+	u64	code;
+	u64	cmask;
 	int	weight;
 };
 
@@ -103,7 +103,7 @@ struct cpu_hw_events {
 };
 
 #define __EVENT_CONSTRAINT(c, n, m, w) {\
-	{ .idxmsk64[0] = (n) },		\
+	{ .idxmsk64 = (n) },		\
 	.code = (c),			\
 	.cmask = (m),			\
 	.weight = (w),			\
@@ -116,7 +116,7 @@ struct cpu_hw_events {
 	EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVTSEL_MASK)
 
 #define FIXED_EVENT_CONSTRAINT(c, n)	\
-	EVENT_CONSTRAINT(c, n, INTEL_ARCH_FIXED_MASK)
+	EVENT_CONSTRAINT(c, (1ULL << (32+n)), INTEL_ARCH_FIXED_MASK)
 
 #define EVENT_CONSTRAINT_END		\
 	EVENT_CONSTRAINT(0, 0, 0)
@@ -615,8 +615,8 @@ static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
 	bitmap_zero(used_mask, X86_PMC_IDX_MAX);
 
 	for (i = 0; i < n; i++) {
-		constraints[i] =
-		  x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
+		c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
+		constraints[i] = c;
 	}
 
 	/*
@@ -1350,6 +1350,7 @@ static void __init pmu_check_apic(void)
 
 void __init init_hw_perf_events(void)
 {
+	struct event_constraint *c;
 	int err;
 
 	pr_info("Performance Events: ");
@@ -1398,6 +1399,16 @@ void __init init_hw_perf_events(void)
 		__EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_events) - 1,
 				   0, x86_pmu.num_events);
 
+	if (x86_pmu.event_constraints) {
+		for_each_event_constraint(c, x86_pmu.event_constraints) {
+			if (c->cmask != INTEL_ARCH_FIXED_MASK)
+				continue;
+
+			c->idxmsk64 |= (1ULL << x86_pmu.num_events) - 1;
+			c->weight += x86_pmu.num_events;
+		}
+	}
+
 	pr_info("... version:                %d\n",     x86_pmu.version);
 	pr_info("... bit width:              %d\n",     x86_pmu.event_bits);
 	pr_info("... generic registers:      %d\n",     x86_pmu.num_events);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index cf6590c..4fbdfe5 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1,7 +1,7 @@
 #ifdef CONFIG_CPU_SUP_INTEL
 
 /*
- * Intel PerfMon v3. Used on Core2 and later.
+ * Intel PerfMon, used on Core and later.
  */
 static const u64 intel_perfmon_event_map[] =
 {
@@ -27,8 +27,14 @@ static struct event_constraint intel_core_event_constraints[] =
 
 static struct event_constraint intel_core2_event_constraints[] =
 {
-	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
+	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
+	/*
+	 * Core2 has Fixed Counter 2 listed as CPU_CLK_UNHALTED.REF and event
+	 * 0x013c as CPU_CLK_UNHALTED.BUS and specifies there is a fixed
+	 * ratio between these counters.
+	 */
+	/* FIXED_EVENT_CONSTRAINT(0x013c, 2),  CPU_CLK_UNHALTED.REF */
 	INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
 	INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
 	INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
@@ -37,14 +43,16 @@ static struct event_constraint intel_core2_event_constraints[] =
 	INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
 	INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
 	INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
+	INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* ITLB_MISS_RETIRED (T30-9) */
 	INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED */
 	EVENT_CONSTRAINT_END
 };
 
 static struct event_constraint intel_nehalem_event_constraints[] =
 {
-	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
+	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
+	/* FIXED_EVENT_CONSTRAINT(0x013c, 2), CPU_CLK_UNHALTED.REF */
 	INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */
 	INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */
 	INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */
@@ -58,8 +66,9 @@ static struct event_constraint intel_nehalem_event_constraints[] =
 
 static struct event_constraint intel_westmere_event_constraints[] =
 {
-	FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
+	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
+	/* FIXED_EVENT_CONSTRAINT(0x013c, 2), CPU_CLK_UNHALTED.REF */
 	INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
 	INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
 	INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
@@ -68,8 +77,9 @@ static struct event_constraint intel_westmere_event_constraints[] =
 
 static struct event_constraint intel_gen_event_constraints[] =
 {
-	FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
-	FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
+	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
+	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
+	/* FIXED_EVENT_CONSTRAINT(0x013c, 2), CPU_CLK_UNHALTED.REF */
 	EVENT_CONSTRAINT_END
 };
 
@@ -935,7 +945,7 @@ static __init int intel_pmu_init(void)
 		x86_pmu.event_constraints = intel_nehalem_event_constraints;
 		pr_cont("Nehalem/Corei7 events, ");
 		break;
-	case 28:
+	case 28: /* Atom */
 		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
 		       sizeof(hw_cache_event_ids));
 
@@ -951,6 +961,7 @@ static __init int intel_pmu_init(void)
 		x86_pmu.event_constraints = intel_westmere_event_constraints;
 		pr_cont("Westmere events, ");
 		break;
+
 	default:
 		/*
 		 * default constraints for v2 and up

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

* Re: [tip:perf/core] perf_events, x86: Fixup fixed counter constraints
  2010-03-02 14:31               ` [tip:perf/core] perf_events, x86: Fixup fixed counter constraints tip-bot for Peter Zijlstra
@ 2010-03-02 16:26                 ` Stephane Eranian
  2010-03-02 17:54                   ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Stephane Eranian @ 2010-03-02 16:26 UTC (permalink / raw)
  To: mingo, hpa, eranian, linux-kernel, a.p.zijlstra, tglx, mingo
  Cc: linux-tip-commits

On Tue, Mar 2, 2010 at 3:31 PM, tip-bot for Peter Zijlstra
<a.p.zijlstra@chello.nl> wrote:
>
> Commit-ID:  b622d644c7d61a5cb95b74e7b143c263bed21f0a
> Gitweb:     http://git.kernel.org/tip/b622d644c7d61a5cb95b74e7b143c263bed21f0a
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Mon, 1 Feb 2010 15:36:30 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Tue, 2 Mar 2010 15:06:47 +0100
>
> perf_events, x86: Fixup fixed counter constraints
>
> Patch 1da53e0230 ("perf_events, x86: Improve x86 event scheduling")
> lost us one of the fixed purpose counters and then ed8777fc13
> ("perf_events, x86: Fix event constraint masks") broke it even
> further.
>
> Widen the fixed event mask to event+umask and specify the full config
> for each of the 3 fixed purpose counters. Then let the init code fill
> out the placement for the GP regs based on the cpuid info.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Stephane Eranian <eranian@google.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

>  static struct event_constraint intel_core2_event_constraints[] =
>  {
> -       FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
> -       FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
> +       FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
> +       FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
> +       /*
> +        * Core2 has Fixed Counter 2 listed as CPU_CLK_UNHALTED.REF and event
> +        * 0x013c as CPU_CLK_UNHALTED.BUS and specifies there is a fixed
> +        * ratio between these counters.
> +        */
> +       /* FIXED_EVENT_CONSTRAINT(0x013c, 2),  CPU_CLK_UNHALTED.REF */
>        INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
>        INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
>        INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
> @@ -37,14 +43,16 @@ static struct event_constraint intel_core2_event_constraints[] =
>        INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
>        INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
>        INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
> +       INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* ITLB_MISS_RETIRED (T30-9) */

Where does the constraint on ITLB_MISS_RETIRED come from?

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

* Re: [tip:perf/core] perf_events, x86: Fixup fixed counter constraints
  2010-03-02 16:26                 ` Stephane Eranian
@ 2010-03-02 17:54                   ` Peter Zijlstra
  2010-03-03  6:16                     ` Stephane Eranian
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-03-02 17:54 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: mingo, hpa, linux-kernel, tglx, mingo, linux-tip-commits

On Tue, 2010-03-02 at 17:26 +0100, Stephane Eranian wrote:
> > @@ -37,14 +43,16 @@ static struct event_constraint intel_core2_event_constraints[] =
> >        INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
> >        INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
> >        INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
> > +       INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* ITLB_MISS_RETIRED (T30-9) */
> 
> Where does the constraint on ITLB_MISS_RETIRED come from?

Intel® 64 and IA-32 Architectures Software Developer’s Manual
Volume 3B: System Programming Guide, Part 2

Dec 2009 (253669)

Section 30.4.3, Table 30-9


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

* Re: [tip:perf/core] perf_events, x86: Fixup fixed counter constraints
  2010-03-02 17:54                   ` Peter Zijlstra
@ 2010-03-03  6:16                     ` Stephane Eranian
  0 siblings, 0 replies; 1150+ messages in thread
From: Stephane Eranian @ 2010-03-03  6:16 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, hpa, linux-kernel, tglx, mingo, linux-tip-commits

On Tue, Mar 2, 2010 at 9:54 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, 2010-03-02 at 17:26 +0100, Stephane Eranian wrote:
>> > @@ -37,14 +43,16 @@ static struct event_constraint intel_core2_event_constraints[] =
>> >        INTEL_EVENT_CONSTRAINT(0x18, 0x1), /* IDLE_DURING_DIV */
>> >        INTEL_EVENT_CONSTRAINT(0x19, 0x2), /* DELAYED_BYPASS */
>> >        INTEL_EVENT_CONSTRAINT(0xa1, 0x1), /* RS_UOPS_DISPATCH_CYCLES */
>> > +       INTEL_EVENT_CONSTRAINT(0xc9, 0x1), /* ITLB_MISS_RETIRED (T30-9) */
>>
>> Where does the constraint on ITLB_MISS_RETIRED come from?
>
> Intel® 64 and IA-32 Architectures Software Developer’s Manual
> Volume 3B: System Programming Guide, Part 2
>
> Dec 2009 (253669)
>
> Section 30.4.3, Table 30-9
>
I am not so sure about this one. I will double check.

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

* [tip:perf/urgent] MAINTAINERS: Add Arnaldo as tools/perf/ co-maintainer
       [not found]             ` <new-submission>
                                 ` (492 preceding siblings ...)
  2010-03-02 14:31               ` [tip:perf/core] perf_events, x86: Fixup fixed counter constraints tip-bot for Peter Zijlstra
@ 2010-03-09  8:21               ` tip-bot for Ingo Molnar
  2010-03-10 13:10               ` [tip:perf/urgent] perf: Optimize perf_disable tip-bot for Peter Zijlstra
                                 ` (212 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-03-09  8:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cfb581bcd4f8c158c6f2b48bf5e232bb9e6855c0
Gitweb:     http://git.kernel.org/tip/cfb581bcd4f8c158c6f2b48bf5e232bb9e6855c0
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Mon, 8 Mar 2010 15:20:50 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 9 Mar 2010 07:03:48 +0100

MAINTAINERS: Add Arnaldo as tools/perf/ co-maintainer

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 MAINTAINERS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2533fc4..40ed22e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4221,6 +4221,7 @@ PERFORMANCE EVENTS SUBSYSTEM
 M:	Peter Zijlstra <a.p.zijlstra@chello.nl>
 M:	Paul Mackerras <paulus@samba.org>
 M:	Ingo Molnar <mingo@elte.hu>
+M:	Arnaldo Carvalho de Melo <acme@redhat.com>
 S:	Supported
 F:	kernel/perf_event.c
 F:	include/linux/perf_event.h

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

* [tip:perf/urgent] perf: Optimize perf_disable
       [not found]             ` <new-submission>
                                 ` (493 preceding siblings ...)
  2010-03-09  8:21               ` [tip:perf/urgent] MAINTAINERS: Add Arnaldo as tools/perf/ co-maintainer tip-bot for Ingo Molnar
@ 2010-03-10 13:10               ` tip-bot for Peter Zijlstra
  2010-03-10 13:10               ` [tip:perf/urgent] perf, x86, Do not user perf_disable from NMI context tip-bot for Peter Zijlstra
                                 ` (211 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  32975a4f114be52286f9a5bf6c230dbb8c0e1903
Gitweb:     http://git.kernel.org/tip/32975a4f114be52286f9a5bf6c230dbb8c0e1903
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 19:49:19 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:25 +0100

perf: Optimize perf_disable

Currently we always call hw_perf_disable(), even if its already disabled,
this seems superflous, esp. since it cannot be made NMI safe (see further
patches).

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 73329de..d810846 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -93,25 +93,15 @@ void __weak perf_event_print_debug(void)	{ }
 
 static DEFINE_PER_CPU(int, perf_disable_count);
 
-void __perf_disable(void)
-{
-	__get_cpu_var(perf_disable_count)++;
-}
-
-bool __perf_enable(void)
-{
-	return !--__get_cpu_var(perf_disable_count);
-}
-
 void perf_disable(void)
 {
-	__perf_disable();
-	hw_perf_disable();
+	if (!__get_cpu_var(perf_disable_count)++)
+		hw_perf_disable();
 }
 
 void perf_enable(void)
 {
-	if (__perf_enable())
+	if (!--__get_cpu_var(perf_disable_count))
 		hw_perf_enable();
 }
 

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

* [tip:perf/urgent] perf, x86, Do not user perf_disable from NMI context
       [not found]             ` <new-submission>
                                 ` (494 preceding siblings ...)
  2010-03-10 13:10               ` [tip:perf/urgent] perf: Optimize perf_disable tip-bot for Peter Zijlstra
@ 2010-03-10 13:10               ` tip-bot for Peter Zijlstra
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix x86_pmu_start tip-bot for Peter Zijlstra
                                 ` (210 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  3fb2b8ddcc6a7aa62af6bd2cb939edfd4c460506
Gitweb:     http://git.kernel.org/tip/3fb2b8ddcc6a7aa62af6bd2cb939edfd4c460506
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 13:51:01 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:26 +0100

perf, x86, Do not user perf_disable from NMI context

Explicitly use intel_pmu_{disable,enable}_all() in intel_pmu_handle_irq()
to avoid the NMI race conditions in perf_{disable,enable}

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 12e811a..c582449 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -745,11 +745,11 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
 
 	cpuc = &__get_cpu_var(cpu_hw_events);
 
-	perf_disable();
+	intel_pmu_disable_all();
 	intel_pmu_drain_bts_buffer();
 	status = intel_pmu_get_status();
 	if (!status) {
-		perf_enable();
+		intel_pmu_enable_all();
 		return 0;
 	}
 
@@ -759,8 +759,7 @@ again:
 		WARN_ONCE(1, "perfevents: irq loop stuck!\n");
 		perf_event_print_debug();
 		intel_pmu_reset();
-		perf_enable();
-		return 1;
+		goto done;
 	}
 
 	inc_irq_stat(apic_perf_irqs);
@@ -790,8 +789,8 @@ again:
 	if (status)
 		goto again;
 
-	perf_enable();
-
+done:
+	intel_pmu_enable_all();
 	return 1;
 }
 

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

* [tip:perf/urgent] perf, x86: Fix x86_pmu_start
       [not found]             ` <new-submission>
                                 ` (495 preceding siblings ...)
  2010-03-10 13:10               ` [tip:perf/urgent] perf, x86, Do not user perf_disable from NMI context tip-bot for Peter Zijlstra
@ 2010-03-10 13:12               ` tip-bot for Peter Zijlstra
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
                                 ` (209 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  c08053e627d23490a03431285b78b7a5b617fbad
Gitweb:     http://git.kernel.org/tip/c08053e627d23490a03431285b78b7a5b617fbad
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:19:24 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:30 +0100

perf, x86: Fix x86_pmu_start

pmu::start should undo pmu::stop, make it so.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 01b1667..9757b96 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -785,6 +785,7 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
 		hwc->last_tag == cpuc->tags[i];
 }
 
+static int x86_pmu_start(struct perf_event *event);
 static void x86_pmu_stop(struct perf_event *event);
 
 void hw_perf_enable(void)
@@ -833,20 +834,10 @@ void hw_perf_enable(void)
 			event = cpuc->event_list[i];
 			hwc = &event->hw;
 
-			if (hwc->idx == -1) {
+			if (hwc->idx == -1)
 				x86_assign_hw_event(event, cpuc, i);
-				x86_perf_event_set_period(event);
-			}
-			/*
-			 * need to mark as active because x86_pmu_disable()
-			 * clear active_mask and events[] yet it preserves
-			 * idx
-			 */
-			__set_bit(hwc->idx, cpuc->active_mask);
-			cpuc->events[hwc->idx] = event;
 
-			x86_pmu.enable(event);
-			perf_event_update_userpage(event);
+			x86_pmu_start(event);
 		}
 		cpuc->n_added = 0;
 		perf_events_lapic_init();
@@ -975,11 +966,17 @@ static int x86_pmu_enable(struct perf_event *event)
 
 static int x86_pmu_start(struct perf_event *event)
 {
-	if (event->hw.idx == -1)
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int idx = event->hw.idx;
+
+	if (idx == -1)
 		return -EAGAIN;
 
 	x86_perf_event_set_period(event);
+	cpuc->events[idx] = event;
+	__set_bit(idx, cpuc->active_mask);
 	x86_pmu.enable(event);
+	perf_event_update_userpage(event);
 
 	return 0;
 }

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

* [tip:perf/urgent] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE)
       [not found]             ` <new-submission>
                                 ` (496 preceding siblings ...)
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix x86_pmu_start tip-bot for Peter Zijlstra
@ 2010-03-10 13:12               ` tip-bot for Peter Zijlstra
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Properly account n_added tip-bot for Peter Zijlstra
                                 ` (208 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  71e2d2828046133ed985696a02e2e1499ca0bfb8
Gitweb:     http://git.kernel.org/tip/71e2d2828046133ed985696a02e2e1499ca0bfb8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 17:51:33 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:31 +0100

perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE)

Calling ioctl(PERF_EVENT_IOC_DISABLE) on a thottled counter would result
in a double disable, cure this by using x86_pmu_{start,stop} for
throttle/unthrottle and teach x86_pmu_stop() to check ->active_mask.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c       |   20 ++++++--------------
 arch/x86/kernel/cpu/perf_event_intel.c |    2 +-
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 9757b96..b68c4fb 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -983,14 +983,8 @@ static int x86_pmu_start(struct perf_event *event)
 
 static void x86_pmu_unthrottle(struct perf_event *event)
 {
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	struct hw_perf_event *hwc = &event->hw;
-
-	if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX ||
-				cpuc->events[hwc->idx] != event))
-		return;
-
-	x86_pmu.enable(event);
+	int ret = x86_pmu_start(event);
+	WARN_ON_ONCE(ret);
 }
 
 void perf_event_print_debug(void)
@@ -1050,11 +1044,9 @@ static void x86_pmu_stop(struct perf_event *event)
 	struct hw_perf_event *hwc = &event->hw;
 	int idx = hwc->idx;
 
-	/*
-	 * Must be done before we disable, otherwise the nmi handler
-	 * could reenable again:
-	 */
-	__clear_bit(idx, cpuc->active_mask);
+	if (!__test_and_clear_bit(idx, cpuc->active_mask))
+		return;
+
 	x86_pmu.disable(event);
 
 	/*
@@ -1123,7 +1115,7 @@ static int x86_pmu_handle_irq(struct pt_regs *regs)
 			continue;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			x86_pmu.disable(event);
+			x86_pmu_stop(event);
 	}
 
 	if (handled)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index d87421c..84bfde6 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -774,7 +774,7 @@ again:
 		data.period = event->hw.last_period;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			intel_pmu_disable_event(event);
+			x86_pmu_stop(event);
 	}
 
 	intel_pmu_ack_status(ack);

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

* [tip:perf/urgent] perf, x86: Properly account n_added
       [not found]             ` <new-submission>
                                 ` (497 preceding siblings ...)
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
@ 2010-03-10 13:12               ` tip-bot for Peter Zijlstra
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix double disable calls tip-bot for Peter Zijlstra
                                 ` (207 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  356e1f2e0ace2d4b100c8eda9d49b709e8323da5
Gitweb:     http://git.kernel.org/tip/356e1f2e0ace2d4b100c8eda9d49b709e8323da5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:49:56 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:32 +0100

perf, x86: Properly account n_added

Make sure n_added is properly accounted so that we can rely on the value
to reflect the number of added counters. This is needed if its going to
be used for more than a boolean check.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index b68c4fb..071c840 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -959,7 +959,7 @@ static int x86_pmu_enable(struct perf_event *event)
 	memcpy(cpuc->assign, assign, n*sizeof(int));
 
 	cpuc->n_events = n;
-	cpuc->n_added  = n - n0;
+	cpuc->n_added += n - n0;
 
 	return 0;
 }
@@ -1302,7 +1302,7 @@ int hw_perf_group_sched_in(struct perf_event *leader,
 	memcpy(cpuc->assign, assign, n0*sizeof(int));
 
 	cpuc->n_events  = n0;
-	cpuc->n_added   = n1;
+	cpuc->n_added  += n1;
 	ctx->nr_active += n1;
 
 	/*

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

* [tip:perf/urgent] perf, x86: Fix double disable calls
       [not found]             ` <new-submission>
                                 ` (498 preceding siblings ...)
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Properly account n_added tip-bot for Peter Zijlstra
@ 2010-03-10 13:12               ` tip-bot for Peter Zijlstra
  2010-03-10 13:13               ` [tip:perf/urgent] perf, x86: Fix double enable calls tip-bot for Peter Zijlstra
                                 ` (206 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  19925ce778f9fc371b9607625de3bff04c60121e
Gitweb:     http://git.kernel.org/tip/19925ce778f9fc371b9607625de3bff04c60121e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:20:40 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:33 +0100

perf, x86: Fix double disable calls

hw_perf_enable() would disable events that were not yet enabled.

This causes problems with code that assumes that ->enable/->disable calls
are balanced (like the LBR code does).

What happens is that we disable newly added counters that match their
previous assignment, even though they are not yet programmed on the
hardware.

Avoid this by only doing the first pass over the existing events.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 071c840..045cc0b 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -802,6 +802,7 @@ void hw_perf_enable(void)
 		return;
 
 	if (cpuc->n_added) {
+		int n_running = cpuc->n_events - cpuc->n_added;
 		/*
 		 * apply assignment obtained either from
 		 * hw_perf_group_sched_in() or x86_pmu_enable()
@@ -809,7 +810,7 @@ void hw_perf_enable(void)
 		 * step1: save events moving to new counters
 		 * step2: reprogram moved events into new counters
 		 */
-		for (i = 0; i < cpuc->n_events; i++) {
+		for (i = 0; i < n_running; i++) {
 
 			event = cpuc->event_list[i];
 			hwc = &event->hw;

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

* [tip:perf/urgent] perf, x86: Fix double enable calls
       [not found]             ` <new-submission>
                                 ` (499 preceding siblings ...)
  2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix double disable calls tip-bot for Peter Zijlstra
@ 2010-03-10 13:13               ` tip-bot for Peter Zijlstra
  2010-03-10 13:13               ` [tip:perf/urgent] perf: Provide better condition for event rotation tip-bot for Peter Zijlstra
                                 ` (205 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  f3d46b2e6fa57547f9884330798792afc83f4b04
Gitweb:     http://git.kernel.org/tip/f3d46b2e6fa57547f9884330798792afc83f4b04
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:24:58 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:35 +0100

perf, x86: Fix double enable calls

hw_perf_enable() would enable already enabled events.

This causes problems with code that assumes that ->enable/->disable calls
are balanced (like the LBR code does).

What happens is that events that were already running and left in place
would get enabled again.

Avoid this by only enabling new events that match their previous
assignment.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 045cc0b..1d665a0 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -835,6 +835,10 @@ void hw_perf_enable(void)
 			event = cpuc->event_list[i];
 			hwc = &event->hw;
 
+			if (i < n_running &&
+			    match_prev_assignment(hwc, cpuc, i))
+				continue;
+
 			if (hwc->idx == -1)
 				x86_assign_hw_event(event, cpuc, i);
 

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

* [tip:perf/urgent] perf: Provide better condition for event rotation
       [not found]             ` <new-submission>
                                 ` (500 preceding siblings ...)
  2010-03-10 13:13               ` [tip:perf/urgent] perf, x86: Fix double enable calls tip-bot for Peter Zijlstra
@ 2010-03-10 13:13               ` tip-bot for Peter Zijlstra
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
                                 ` (204 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  d4944a06666054707d23e11888e480af239e5abf
Gitweb:     http://git.kernel.org/tip/d4944a06666054707d23e11888e480af239e5abf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 13:51:20 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:22:36 +0100

perf: Provide better condition for event rotation

Try to avoid useless rotation and PMU disables.

[ Could be improved by keeping a nr_runnable count to better account
  for the < PERF_STAT_INACTIVE counters ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index d810846..52c69a3 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1524,12 +1524,15 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 		 */
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(event, 1);
+			perf_disable();
 			event->pmu->unthrottle(event);
+			perf_enable();
 		}
 
 		if (!event->attr.freq || !event->attr.sample_freq)
 			continue;
 
+		perf_disable();
 		event->pmu->read(event);
 		now = atomic64_read(&event->count);
 		delta = now - hwc->freq_count_stamp;
@@ -1537,6 +1540,7 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 
 		if (delta > 0)
 			perf_adjust_period(event, TICK_NSEC, delta);
+		perf_enable();
 	}
 	raw_spin_unlock(&ctx->lock);
 }
@@ -1546,9 +1550,6 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
  */
 static void rotate_ctx(struct perf_event_context *ctx)
 {
-	if (!ctx->nr_events)
-		return;
-
 	raw_spin_lock(&ctx->lock);
 
 	/* Rotate the first entry last of non-pinned groups */
@@ -1561,19 +1562,28 @@ void perf_event_task_tick(struct task_struct *curr)
 {
 	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx;
+	int rotate = 0;
 
 	if (!atomic_read(&nr_events))
 		return;
 
 	cpuctx = &__get_cpu_var(perf_cpu_context);
-	ctx = curr->perf_event_ctxp;
+	if (cpuctx->ctx.nr_events &&
+	    cpuctx->ctx.nr_events != cpuctx->ctx.nr_active)
+		rotate = 1;
 
-	perf_disable();
+	ctx = curr->perf_event_ctxp;
+	if (ctx && ctx->nr_events && ctx->nr_events != ctx->nr_active)
+		rotate = 1;
 
 	perf_ctx_adjust_freq(&cpuctx->ctx);
 	if (ctx)
 		perf_ctx_adjust_freq(ctx);
 
+	if (!rotate)
+		return;
+
+	perf_disable();
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
 		task_ctx_sched_out(ctx, EVENT_FLEXIBLE);
@@ -1585,7 +1595,6 @@ void perf_event_task_tick(struct task_struct *curr)
 	cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
 		task_ctx_sched_in(curr, EVENT_FLEXIBLE);
-
 	perf_enable();
 }
 

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

* [tip:perf/pebs] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE)
       [not found]             ` <new-submission>
                                 ` (501 preceding siblings ...)
  2010-03-10 13:13               ` [tip:perf/urgent] perf: Provide better condition for event rotation tip-bot for Peter Zijlstra
@ 2010-03-10 13:22               ` tip-bot for Peter Zijlstra
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix pebs drains tip-bot for Peter Zijlstra
                                 ` (203 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  cc7f00820b2f3be656569c41158d9323e425bcfe
Gitweb:     http://git.kernel.org/tip/cc7f00820b2f3be656569c41158d9323e425bcfe
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 17:51:33 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:36 +0100

perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE)

Calling ioctl(PERF_EVENT_IOC_DISABLE) on a thottled counter would result
in a double disable, cure this by using x86_pmu_{start,stop} for
throttle/unthrottle and teach x86_pmu_stop() to check ->active_mask.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index e7ac517..a7401e4 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -461,7 +461,6 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
 }
 
 static int intel_pmu_save_and_restart(struct perf_event *event);
-static void intel_pmu_disable_event(struct perf_event *event);
 
 static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 {
@@ -528,7 +527,7 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 		regs.flags &= ~PERF_EFLAGS_EXACT;
 
 	if (perf_event_overflow(event, 1, &data, &regs))
-		intel_pmu_disable_event(event);
+		x86_pmu_stop(event);
 
 out:
 	intel_pmu_pebs_enable_all();
@@ -603,7 +602,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 			regs.flags &= ~PERF_EFLAGS_EXACT;
 
 		if (perf_event_overflow(event, 1, &data, &regs))
-			intel_pmu_disable_event(event);
+			x86_pmu_stop(event);
 	}
 out:
 	intel_pmu_pebs_enable_all();

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

* [tip:perf/pebs] perf, x86: Fix pebs drains
       [not found]             ` <new-submission>
                                 ` (502 preceding siblings ...)
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
@ 2010-03-10 13:22               ` tip-bot for Peter Zijlstra
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix PEBS enable/disable vs cpuc->enabled tip-bot for Peter Zijlstra
                                 ` (202 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  8f4aebd2be9892bf8fb79a2d8576d3f3ee7f00f6
Gitweb:     http://git.kernel.org/tip/8f4aebd2be9892bf8fb79a2d8576d3f3ee7f00f6
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:26:11 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:36 +0100

perf, x86: Fix pebs drains

I overlooked the perf_disable()/perf_enable() calls in
intel_pmu_handle_irq(), (pointed out by Markus) so we should not
explicitly disable_all/enable_all pebs counters in the drain functions,
these are already disabled and enabling them early is confusing.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index a7401e4..66c6962 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -476,18 +476,16 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	if (!event || !ds || !x86_pmu.pebs)
 		return;
 
-	intel_pmu_pebs_disable_all();
-
 	at  = (struct pebs_record_core *)(unsigned long)ds->pebs_buffer_base;
 	top = (struct pebs_record_core *)(unsigned long)ds->pebs_index;
 
 	if (top <= at)
-		goto out;
+		return;
 
 	ds->pebs_index = ds->pebs_buffer_base;
 
 	if (!intel_pmu_save_and_restart(event))
-		goto out;
+		return;
 
 	perf_sample_data_init(&data, 0);
 	data.period = event->hw.last_period;
@@ -528,9 +526,6 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 
 	if (perf_event_overflow(event, 1, &data, &regs))
 		x86_pmu_stop(event);
-
-out:
-	intel_pmu_pebs_enable_all();
 }
 
 static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
@@ -547,13 +542,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 	if (!ds || !x86_pmu.pebs)
 		return;
 
-	intel_pmu_pebs_disable_all();
-
 	at  = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
 	top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
 
 	if (top <= at)
-		goto out;
+		return;
 
 	ds->pebs_index = ds->pebs_buffer_base;
 
@@ -604,8 +597,6 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 		if (perf_event_overflow(event, 1, &data, &regs))
 			x86_pmu_stop(event);
 	}
-out:
-	intel_pmu_pebs_enable_all();
 }
 
 /*

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

* [tip:perf/pebs] perf, x86: Fix PEBS enable/disable vs cpuc->enabled
       [not found]             ` <new-submission>
                                 ` (503 preceding siblings ...)
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix pebs drains tip-bot for Peter Zijlstra
@ 2010-03-10 13:22               ` tip-bot for Peter Zijlstra
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix LBR " tip-bot for Peter Zijlstra
                                 ` (201 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  4807e3d5dc7bb7057dd6ca3abb09f3da2eb8c323
Gitweb:     http://git.kernel.org/tip/4807e3d5dc7bb7057dd6ca3abb09f3da2eb8c323
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:47:07 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:36 +0100

perf, x86: Fix PEBS enable/disable vs cpuc->enabled

We should never call ->enable with the pmu enabled, and we _can_ have
->disable called with the pmu enabled.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 66c6962..9ad0e67 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -338,7 +338,7 @@ static void intel_pmu_pebs_enable(struct perf_event *event)
 	hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;
 
 	val |= 1ULL << hwc->idx;
-	wrmsrl(MSR_IA32_PEBS_ENABLE, val);
+	WARN_ON_ONCE(cpuc->enabled);
 
 	if (x86_pmu.intel_cap.pebs_trap)
 		intel_pmu_lbr_enable(event);
@@ -351,7 +351,8 @@ static void intel_pmu_pebs_disable(struct perf_event *event)
 	u64 val = cpuc->pebs_enabled;
 
 	val &= ~(1ULL << hwc->idx);
-	wrmsrl(MSR_IA32_PEBS_ENABLE, val);
+	if (cpuc->enabled)
+		wrmsrl(MSR_IA32_PEBS_ENABLE, val);
 
 	hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
 

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

* [tip:perf/pebs] perf, x86: Fix LBR enable/disable vs cpuc->enabled
       [not found]             ` <new-submission>
                                 ` (504 preceding siblings ...)
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix PEBS enable/disable vs cpuc->enabled tip-bot for Peter Zijlstra
@ 2010-03-10 13:22               ` tip-bot for Peter Zijlstra
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Reorder intel_pmu_enable_all() tip-bot for Peter Zijlstra
                                 ` (200 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  2df202bf7520eaffcbfb07e45dfa3cfb0aeee2c0
Gitweb:     http://git.kernel.org/tip/2df202bf7520eaffcbfb07e45dfa3cfb0aeee2c0
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 13:48:54 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:37 +0100

perf, x86: Fix LBR enable/disable vs cpuc->enabled

We should never call ->enable with the pmu enabled, and we _can_ have
->disable called with the pmu enabled.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_lbr.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index dcec765..0145f99 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -69,7 +69,7 @@ static void intel_pmu_lbr_enable(struct perf_event *event)
 	if (!x86_pmu.lbr_nr)
 		return;
 
-	WARN_ON(cpuc->enabled);
+	WARN_ON_ONCE(cpuc->enabled);
 
 	/*
 	 * Reset the LBR stack if this is the first LBR user or
@@ -93,9 +93,10 @@ static void intel_pmu_lbr_disable(struct perf_event *event)
 		return;
 
 	cpuc->lbr_users--;
-
 	BUG_ON(cpuc->lbr_users < 0);
-	WARN_ON(cpuc->enabled);
+
+	if (cpuc->enabled && !cpuc->lbr_users)
+		__intel_pmu_lbr_disable();
 }
 
 static void intel_pmu_lbr_enable_all(void)

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

* [tip:perf/pebs] perf, x86: Reorder intel_pmu_enable_all()
       [not found]             ` <new-submission>
                                 ` (505 preceding siblings ...)
  2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix LBR " tip-bot for Peter Zijlstra
@ 2010-03-10 13:23               ` tip-bot for Peter Zijlstra
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Deal with multiple state bits for pebs-fmt1 tip-bot for Peter Zijlstra
                                 ` (199 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  d329527e47851f84b1e7944ed9601205f35f1b93
Gitweb:     http://git.kernel.org/tip/d329527e47851f84b1e7944ed9601205f35f1b93
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 13:57:14 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:37 +0100

perf, x86: Reorder intel_pmu_enable_all()

The documentation says we have to enable PEBS before we enable the PMU
proper.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index c135ed7..d3e2424 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -487,6 +487,8 @@ static void intel_pmu_enable_all(void)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
+	intel_pmu_pebs_enable_all();
+	intel_pmu_lbr_enable_all();
 	wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
 
 	if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
@@ -498,9 +500,6 @@ static void intel_pmu_enable_all(void)
 
 		intel_pmu_enable_bts(event->hw.config);
 	}
-
-	intel_pmu_pebs_enable_all();
-	intel_pmu_lbr_enable_all();
 }
 
 static inline u64 intel_pmu_get_status(void)

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

* [tip:perf/pebs] perf, x86: Deal with multiple state bits for pebs-fmt1
       [not found]             ` <new-submission>
                                 ` (506 preceding siblings ...)
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Reorder intel_pmu_enable_all() tip-bot for Peter Zijlstra
@ 2010-03-10 13:23               ` tip-bot for Peter Zijlstra
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Fix silly bug in intel_pmu_pebs_{enable,disable} tip-bot for Peter Zijlstra
                                 ` (198 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  12ab854d744f04bfc5c6c4db723b7e31fc03eb29
Gitweb:     http://git.kernel.org/tip/12ab854d744f04bfc5c6c4db723b7e31fc03eb29
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 18:57:38 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:38 +0100

perf, x86: Deal with multiple state bits for pebs-fmt1

Its unclear if the PEBS state record will have only a single bit set, in
case it does not and accumulates bits, deal with that by only processing
each event once.

Also, robustify some of the code.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 9ad0e67..b4680da 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -538,6 +538,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 	struct perf_event *event = NULL;
 	struct perf_raw_record raw;
 	struct pt_regs regs;
+	u64 status = 0;
 	int bit, n;
 
 	if (!ds || !x86_pmu.pebs)
@@ -561,13 +562,22 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 
 	for ( ; at < top; at++) {
 		for_each_bit(bit, (unsigned long *)&at->status, MAX_PEBS_EVENTS) {
-			if (!cpuc->events[bit]->attr.precise)
+			event = cpuc->events[bit];
+			if (!test_bit(bit, cpuc->active_mask))
 				continue;
 
-			event = cpuc->events[bit];
+			WARN_ON_ONCE(!event);
+
+			if (!event->attr.precise)
+				continue;
+
+			if (__test_and_set_bit(bit, (unsigned long *)&status))
+				continue;
+
+			break;
 		}
 
-		if (!event)
+		if (!event || bit >= MAX_PEBS_EVENTS)
 			continue;
 
 		if (!intel_pmu_save_and_restart(event))

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

* [tip:perf/pebs] perf, x86: Fix silly bug in intel_pmu_pebs_{enable,disable}
       [not found]             ` <new-submission>
                                 ` (507 preceding siblings ...)
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Deal with multiple state bits for pebs-fmt1 tip-bot for Peter Zijlstra
@ 2010-03-10 13:23               ` tip-bot for Peter Zijlstra
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Don't reset the LBR as frequently tip-bot for Peter Zijlstra
                                 ` (197 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  ad0e6cfe2a2a61d7b5530188e571d508146cb43b
Gitweb:     http://git.kernel.org/tip/ad0e6cfe2a2a61d7b5530188e571d508146cb43b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 6 Mar 2010 19:49:06 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:38 +0100

perf, x86: Fix silly bug in intel_pmu_pebs_{enable,disable}

We need to use the actual cpuc->pebs_enabled value, not a local copy for
the changes to take effect.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index b4680da..2423694 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -333,11 +333,10 @@ static void intel_pmu_pebs_enable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	u64 val = cpuc->pebs_enabled;
 
 	hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;
 
-	val |= 1ULL << hwc->idx;
+	cpuc->pebs_enabled |= 1ULL << hwc->idx;
 	WARN_ON_ONCE(cpuc->enabled);
 
 	if (x86_pmu.intel_cap.pebs_trap)
@@ -348,11 +347,10 @@ static void intel_pmu_pebs_disable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	u64 val = cpuc->pebs_enabled;
 
-	val &= ~(1ULL << hwc->idx);
+	cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
 	if (cpuc->enabled)
-		wrmsrl(MSR_IA32_PEBS_ENABLE, val);
+		wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
 
 	hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
 

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

* [tip:perf/pebs] perf, x86: Don't reset the LBR as frequently
       [not found]             ` <new-submission>
                                 ` (508 preceding siblings ...)
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Fix silly bug in intel_pmu_pebs_{enable,disable} tip-bot for Peter Zijlstra
@ 2010-03-10 13:23               ` tip-bot for Peter Zijlstra
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Remove checking_{wr,rd}msr() usage tip-bot for Peter Zijlstra
                                 ` (196 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  b83a46e7da4a948cc852ba7805dfb1a392dec861
Gitweb:     http://git.kernel.org/tip/b83a46e7da4a948cc852ba7805dfb1a392dec861
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 13:51:12 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:38 +0100

perf, x86: Don't reset the LBR as frequently

If we reset the LBR on each first counter, simple counter rotation which
first deschedules all counters and then reschedules the new ones will
lead to LBR reset, even though we're still in the same task context.

Reduce this by not flushing on the first counter but only flushing on
different task contexts.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_lbr.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index 0145f99..f278136 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -72,12 +72,11 @@ static void intel_pmu_lbr_enable(struct perf_event *event)
 	WARN_ON_ONCE(cpuc->enabled);
 
 	/*
-	 * Reset the LBR stack if this is the first LBR user or
-	 * we changed task context so as to avoid data leaks.
+	 * Reset the LBR stack if we changed task context to
+	 * avoid data leaks.
 	 */
 
-	if (!cpuc->lbr_users ||
-	    (event->ctx->task && cpuc->lbr_context != event->ctx)) {
+	if (event->ctx->task && cpuc->lbr_context != event->ctx) {
 		intel_pmu_lbr_reset();
 		cpuc->lbr_context = event->ctx;
 	}
@@ -93,7 +92,7 @@ static void intel_pmu_lbr_disable(struct perf_event *event)
 		return;
 
 	cpuc->lbr_users--;
-	BUG_ON(cpuc->lbr_users < 0);
+	WARN_ON_ONCE(cpuc->lbr_users < 0);
 
 	if (cpuc->enabled && !cpuc->lbr_users)
 		__intel_pmu_lbr_disable();

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

* [tip:perf/pebs] perf, x86: Remove checking_{wr,rd}msr() usage
       [not found]             ` <new-submission>
                                 ` (509 preceding siblings ...)
  2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Don't reset the LBR as frequently tip-bot for Peter Zijlstra
@ 2010-03-10 13:24               ` tip-bot for Peter Zijlstra
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fixup the PEBS handler for Core2 cpus tip-bot for Peter Zijlstra
                                 ` (195 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  7645a24cbd01cbf4865d1273d5ddaa8d8c2ccb3a
Gitweb:     http://git.kernel.org/tip/7645a24cbd01cbf4865d1273d5ddaa8d8c2ccb3a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 8 Mar 2010 13:51:31 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:39 +0100

perf, x86: Remove checking_{wr,rd}msr() usage

We don't need checking_{wr,rd}msr() calls, since we should know what cpu
we're running on and not use blindly poke at msrs.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c       |   24 ++++++++++++++++++------
 arch/x86/kernel/cpu/perf_event_intel.c |    5 ++---
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 335ee1d..e24f637 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -29,6 +29,17 @@
 #include <asm/stacktrace.h>
 #include <asm/nmi.h>
 
+#if 0
+#undef wrmsrl
+#define wrmsrl(msr, val) 					\
+do {								\
+	trace_printk("wrmsrl(%lx, %lx)\n", (unsigned long)(msr),\
+			(unsigned long)(val));			\
+	native_write_msr((msr), (u32)((u64)(val)), 		\
+			(u32)((u64)(val) >> 32));		\
+} while (0)
+#endif
+
 /*
  * best effort, GUP based copy_from_user() that assumes IRQ or NMI context
  */
@@ -821,14 +832,15 @@ void hw_perf_enable(void)
 
 static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc)
 {
-	(void)checking_wrmsrl(hwc->config_base + hwc->idx,
+	wrmsrl(hwc->config_base + hwc->idx,
 			      hwc->config | ARCH_PERFMON_EVENTSEL_ENABLE);
 }
 
 static inline void x86_pmu_disable_event(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
-	(void)checking_wrmsrl(hwc->config_base + hwc->idx, hwc->config);
+
+	wrmsrl(hwc->config_base + hwc->idx, hwc->config);
 }
 
 static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
@@ -843,7 +855,7 @@ x86_perf_event_set_period(struct perf_event *event)
 	struct hw_perf_event *hwc = &event->hw;
 	s64 left = atomic64_read(&hwc->period_left);
 	s64 period = hwc->sample_period;
-	int err, ret = 0, idx = hwc->idx;
+	int ret = 0, idx = hwc->idx;
 
 	if (idx == X86_PMC_IDX_FIXED_BTS)
 		return 0;
@@ -881,8 +893,8 @@ x86_perf_event_set_period(struct perf_event *event)
 	 */
 	atomic64_set(&hwc->prev_count, (u64)-left);
 
-	err = checking_wrmsrl(hwc->event_base + idx,
-			     (u64)(-left) & x86_pmu.event_mask);
+	wrmsrl(hwc->event_base + idx,
+			(u64)(-left) & x86_pmu.event_mask);
 
 	perf_event_update_userpage(event);
 
@@ -987,7 +999,7 @@ void perf_event_print_debug(void)
 		pr_info("CPU#%d: fixed:      %016llx\n", cpu, fixed);
 		pr_info("CPU#%d: pebs:       %016llx\n", cpu, pebs);
 	}
-	pr_info("CPU#%d: active:       %016llx\n", cpu, *(u64 *)cpuc->active_mask);
+	pr_info("CPU#%d: active:     %016llx\n", cpu, *(u64 *)cpuc->active_mask);
 
 	for (idx = 0; idx < x86_pmu.num_events; idx++) {
 		rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index d3e2424..971dc6e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -525,7 +525,7 @@ static void intel_pmu_disable_fixed(struct hw_perf_event *hwc)
 
 	rdmsrl(hwc->config_base, ctrl_val);
 	ctrl_val &= ~mask;
-	(void)checking_wrmsrl(hwc->config_base, ctrl_val);
+	wrmsrl(hwc->config_base, ctrl_val);
 }
 
 static void intel_pmu_disable_event(struct perf_event *event)
@@ -553,7 +553,6 @@ static void intel_pmu_enable_fixed(struct hw_perf_event *hwc)
 {
 	int idx = hwc->idx - X86_PMC_IDX_FIXED;
 	u64 ctrl_val, bits, mask;
-	int err;
 
 	/*
 	 * Enable IRQ generation (0x8),
@@ -578,7 +577,7 @@ static void intel_pmu_enable_fixed(struct hw_perf_event *hwc)
 	rdmsrl(hwc->config_base, ctrl_val);
 	ctrl_val &= ~mask;
 	ctrl_val |= bits;
-	err = checking_wrmsrl(hwc->config_base, ctrl_val);
+	wrmsrl(hwc->config_base, ctrl_val);
 }
 
 static void intel_pmu_enable_event(struct perf_event *event)

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

* [tip:perf/pebs] perf, x86: Fixup the PEBS handler for Core2 cpus
       [not found]             ` <new-submission>
                                 ` (510 preceding siblings ...)
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Remove checking_{wr,rd}msr() usage tip-bot for Peter Zijlstra
@ 2010-03-10 13:24               ` tip-bot for Peter Zijlstra
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fix LBR read-out tip-bot for Peter Zijlstra
                                 ` (194 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  d80c7502ff63aa0d99d8c0c5803d28bbef67a74e
Gitweb:     http://git.kernel.org/tip/d80c7502ff63aa0d99d8c0c5803d28bbef67a74e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 9 Mar 2010 11:41:02 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:39 +0100

perf, x86: Fixup the PEBS handler for Core2 cpus

Pull the core handler in line with the nhm one, also make sure we always
drain the buffer.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |   38 ++++++++++++++++++----------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 2423694..1bfd59b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -472,20 +472,39 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	struct pt_regs regs;
 	int n;
 
-	if (!event || !ds || !x86_pmu.pebs)
+	if (!ds || !x86_pmu.pebs)
 		return;
 
 	at  = (struct pebs_record_core *)(unsigned long)ds->pebs_buffer_base;
 	top = (struct pebs_record_core *)(unsigned long)ds->pebs_index;
 
-	if (top <= at)
+	/*
+	 * Whatever else happens, drain the thing
+	 */
+	ds->pebs_index = ds->pebs_buffer_base;
+
+	if (!test_bit(0, cpuc->active_mask))
 		return;
 
-	ds->pebs_index = ds->pebs_buffer_base;
+	WARN_ON_ONCE(!event);
+
+	if (!event->attr.precise)
+		return;
+
+	n = top - at;
+	if (n <= 0)
+		return;
 
 	if (!intel_pmu_save_and_restart(event))
 		return;
 
+	/*
+	 * Should not happen, we program the threshold at 1 and do not
+	 * set a reset value.
+	 */
+	WARN_ON_ONCE(n > 1);
+	at += n - 1;
+
 	perf_sample_data_init(&data, 0);
 	data.period = event->hw.last_period;
 
@@ -495,14 +514,6 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 		data.raw = &raw;
 	}
 
-	n = top - at;
-
-	/*
-	 * Should not happen, we program the threshold at 1 and do not
-	 * set a reset value.
-	 */
-	WARN_ON_ONCE(n > 1);
-
 	/*
 	 * We use the interrupt regs as a base because the PEBS record
 	 * does not contain a full regs set, specifically it seems to
@@ -545,12 +556,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 	at  = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
 	top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
 
-	if (top <= at)
-		return;
-
 	ds->pebs_index = ds->pebs_buffer_base;
 
 	n = top - at;
+	if (n <= 0)
+		return;
 
 	/*
 	 * Should not happen, we program the threshold at 1 and do not

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

* [tip:perf/pebs] perf, x86: Fix LBR read-out
       [not found]             ` <new-submission>
                                 ` (511 preceding siblings ...)
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fixup the PEBS handler for Core2 cpus tip-bot for Peter Zijlstra
@ 2010-03-10 13:24               ` tip-bot for Peter Zijlstra
  2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Add INSTRUCTION_DECODER config flag tip-bot for Ingo Molnar
                                 ` (193 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-10 13:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, acme, a.p.zijlstra, tglx, mingo

Commit-ID:  63fb3f9b2312e131be5a0a2dddb63f2fb123db9b
Gitweb:     http://git.kernel.org/tip/63fb3f9b2312e131be5a0a2dddb63f2fb123db9b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 9 Mar 2010 11:51:02 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:23:39 +0100

perf, x86: Fix LBR read-out

Don't decrement the TOS twice...

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event_intel_lbr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index f278136..df4c98e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -129,7 +129,7 @@ static void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc)
 	u64 tos = intel_pmu_lbr_tos();
 	int i;
 
-	for (i = 0; i < x86_pmu.lbr_nr; i++, tos--) {
+	for (i = 0; i < x86_pmu.lbr_nr; i++) {
 		unsigned long lbr_idx = (tos - i) & mask;
 		union {
 			struct {
@@ -162,7 +162,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
 	u64 tos = intel_pmu_lbr_tos();
 	int i;
 
-	for (i = 0; i < x86_pmu.lbr_nr; i++, tos--) {
+	for (i = 0; i < x86_pmu.lbr_nr; i++) {
 		unsigned long lbr_idx = (tos - i) & mask;
 		u64 from, to, flags = 0;
 

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

* [tip:perf/pebs] perf, x86: Add INSTRUCTION_DECODER config flag
       [not found]             ` <new-submission>
                                 ` (512 preceding siblings ...)
  2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fix LBR read-out tip-bot for Peter Zijlstra
@ 2010-03-10 13:25               ` tip-bot for Ingo Molnar
  2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Fix the !CONFIG_CPU_SUP_INTEL build tip-bot for Ingo Molnar
                                 ` (192 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-03-10 13:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, fweisbec,
	tglx, mhiramat, mingo

Commit-ID:  ba7e4d13fc7e25af1d167d40e6f028298dfc55ad
Gitweb:     http://git.kernel.org/tip/ba7e4d13fc7e25af1d167d40e6f028298dfc55ad
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 13:58:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:34:12 +0100

perf, x86: Add INSTRUCTION_DECODER config flag

The PEBS+LBR decoding magic needs the insn_get_length() infrastructure
to be able to decode x86 instruction length.

So split it out of KPROBES dependency and make it enabled when either
KPROBES or PERF_EVENTS is enabled.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
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/Kconfig      |    3 +++
 arch/x86/lib/Makefile |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e984403..e1240f6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -58,6 +58,9 @@ config X86
 	select HAVE_ARCH_KMEMCHECK
 	select HAVE_USER_RETURN_NOTIFIER
 
+config INSTRUCTION_DECODER
+	def_bool (KPROBES || PERF_EVENTS)
+
 config OUTPUT_FORMAT
 	string
 	default "elf32-i386" if X86_32
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 419386c..cbaf8f2 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -20,7 +20,7 @@ lib-y := delay.o
 lib-y += thunk_$(BITS).o
 lib-y += usercopy_$(BITS).o getuser.o putuser.o
 lib-y += memcpy_$(BITS).o
-lib-$(CONFIG_KPROBES) += insn.o inat.o
+lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o
 
 obj-y += msr.o msr-reg.o msr-reg-export.o
 

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

* [tip:perf/pebs] perf, x86: Fix the !CONFIG_CPU_SUP_INTEL build
       [not found]             ` <new-submission>
                                 ` (513 preceding siblings ...)
  2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Add INSTRUCTION_DECODER config flag tip-bot for Ingo Molnar
@ 2010-03-10 13:25               ` tip-bot for Ingo Molnar
  2010-03-11 14:41               ` [tip:perf/urgent] perf, ppc: Fix compile error due to new cpu notifiers tip-bot for Peter Zijlstra
                                 ` (191 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-03-10 13:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, fweisbec,
	tglx, mingo

Commit-ID:  caa0142d84ceb0fc83e28f0475d0a7316cb6df77
Gitweb:     http://git.kernel.org/tip/caa0142d84ceb0fc83e28f0475d0a7316cb6df77
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Sat, 6 Jun 2009 13:58:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 10 Mar 2010 13:40:44 +0100

perf, x86: Fix the !CONFIG_CPU_SUP_INTEL build

Fix typo. But the modularization here is ugly and should be improved.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
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_event_intel_ds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 1bfd59b..c59678a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -661,7 +661,7 @@ static void intel_ds_init(void)
 
 #else /* CONFIG_CPU_SUP_INTEL */
 
-static int reseve_ds_buffers(void)
+static int reserve_ds_buffers(void)
 {
 	return 0;
 }

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

* [tip:perf/urgent] perf, ppc: Fix compile error due to new cpu notifiers
       [not found]             ` <new-submission>
                                 ` (514 preceding siblings ...)
  2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Fix the !CONFIG_CPU_SUP_INTEL build tip-bot for Ingo Molnar
@ 2010-03-11 14:41               ` tip-bot for Peter Zijlstra
  2010-03-11 14:41               ` [tip:sched/core] sched: Fix pick_next_highest_task_rt() for cgroups tip-bot for Peter Zijlstra
                                 ` (190 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-11 14:41 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  85cfabbcd10f8d112feee6e2ec64ee78033b6d3c
Gitweb:     http://git.kernel.org/tip/85cfabbcd10f8d112feee6e2ec64ee78033b6d3c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 11 Mar 2010 13:06:56 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Mar 2010 15:21:27 +0100

perf, ppc: Fix compile error due to new cpu notifiers

Fix:

  arch/powerpc/kernel/perf_event.c:1334: error: 'power_pmu_notifier' undeclared (first use in this function)
  arch/powerpc/kernel/perf_event.c:1334: error: (Each undeclared identifier is reported only once
  arch/powerpc/kernel/perf_event.c:1334: error: for each function it appears in.)
  arch/powerpc/kernel/perf_event.c:1334: error: implicit declaration of function 'power_pmu_notifier'
  arch/powerpc/kernel/perf_event.c:1334: error: implicit declaration of function 'register_cpu_notifier'

Due to commit 3f6da390 (perf: Rework and fix the arch CPU-hotplug hooks).

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/powerpc/kernel/perf_event.c |    2 +-
 include/linux/perf_event.h       |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index fbe101d..08460a2 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -1298,7 +1298,7 @@ static void power_pmu_setup(int cpu)
 }
 
 static int __cpuinit
-power_pmu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
+power_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
 {
 	unsigned int cpu = (long)hcpu;
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 70cffd0..9547703 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -453,6 +453,7 @@ enum perf_callchain_context {
 #include <linux/pid_namespace.h>
 #include <linux/workqueue.h>
 #include <linux/ftrace.h>
+#include <linux/cpu.h>
 #include <asm/atomic.h>
 
 #define PERF_MAX_STACK_DEPTH		255

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

* [tip:sched/core] sched: Fix pick_next_highest_task_rt() for cgroups
       [not found]             ` <new-submission>
                                 ` (515 preceding siblings ...)
  2010-03-11 14:41               ` [tip:perf/urgent] perf, ppc: Fix compile error due to new cpu notifiers tip-bot for Peter Zijlstra
@ 2010-03-11 14:41               ` tip-bot for Peter Zijlstra
  2010-04-02 19:10               ` [tip:perf/core] perf, x86: Fix __initconst vs const tip-bot for Peter Zijlstra
                                 ` (189 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-03-11 14:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dhaval.giani, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  3d07467b7aa91623b31d7b5888a123a2c8c8e9cc
Gitweb:     http://git.kernel.org/tip/3d07467b7aa91623b31d7b5888a123a2c8c8e9cc
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Mar 2010 17:07:24 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 11 Mar 2010 15:21:50 +0100

sched: Fix pick_next_highest_task_rt() for cgroups

Since pick_next_highest_task_rt() already iterates all the cgroups and
is really only interested in tasks, skip over the !task entries.

Reported-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Dhaval Giani <dhaval.giani@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched_rt.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index bf3e38f..c4fb42a 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1146,7 +1146,12 @@ static struct task_struct *pick_next_highest_task_rt(struct rq *rq, int cpu)
 		if (next && next->prio < idx)
 			continue;
 		list_for_each_entry(rt_se, array->queue + idx, run_list) {
-			struct task_struct *p = rt_task_of(rt_se);
+			struct task_struct *p;
+
+			if (!rt_entity_is_task(rt_se))
+				continue;
+
+			p = rt_task_of(rt_se);
 			if (pick_rt_task(rq, p, cpu)) {
 				next = p;
 				break;

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

* [tip:perf/core] perf, x86: Fix __initconst vs const
       [not found]             ` <new-submission>
                                 ` (516 preceding siblings ...)
  2010-03-11 14:41               ` [tip:sched/core] sched: Fix pick_next_highest_task_rt() for cgroups tip-bot for Peter Zijlstra
@ 2010-04-02 19:10               ` tip-bot for Peter Zijlstra
  2010-04-02 19:10               ` [tip:perf/core] perf, x86: Add Nehalem programming quirk to Westmere tip-bot for Peter Zijlstra
                                 ` (188 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, sfr, tglx, mingo

Commit-ID:  caaa8be3b6707cb9664e573a28b00f845ce9f32e
Gitweb:     http://git.kernel.org/tip/caaa8be3b6707cb9664e573a28b00f845ce9f32e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 29 Mar 2010 13:09:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 19:52:05 +0200

perf, x86: Fix __initconst vs const

All variables that have __initconst should also be const.

Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
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_event_amd.c   |    4 ++--
 arch/x86/kernel/cpu/perf_event_intel.c |   12 ++++++------
 arch/x86/kernel/cpu/perf_event_p4.c    |    4 ++--
 arch/x86/kernel/cpu/perf_event_p6.c    |    2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index bbd7339..611df11 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -2,7 +2,7 @@
 
 static DEFINE_RAW_SPINLOCK(amd_nb_lock);
 
-static __initconst u64 amd_hw_cache_event_ids
+static __initconst const u64 amd_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -368,7 +368,7 @@ static void amd_pmu_cpu_dead(int cpu)
 	raw_spin_unlock(&amd_nb_lock);
 }
 
-static __initconst struct x86_pmu amd_pmu = {
+static __initconst const struct x86_pmu amd_pmu = {
 	.name			= "AMD",
 	.handle_irq		= x86_pmu_handle_irq,
 	.disable_all		= x86_pmu_disable_all,
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 30bf10c..1957e3f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -88,7 +88,7 @@ static u64 intel_pmu_event_map(int hw_event)
 	return intel_perfmon_event_map[hw_event];
 }
 
-static __initconst u64 westmere_hw_cache_event_ids
+static __initconst const u64 westmere_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -179,7 +179,7 @@ static __initconst u64 westmere_hw_cache_event_ids
  },
 };
 
-static __initconst u64 nehalem_hw_cache_event_ids
+static __initconst const u64 nehalem_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -270,7 +270,7 @@ static __initconst u64 nehalem_hw_cache_event_ids
  },
 };
 
-static __initconst u64 core2_hw_cache_event_ids
+static __initconst const u64 core2_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -361,7 +361,7 @@ static __initconst u64 core2_hw_cache_event_ids
  },
 };
 
-static __initconst u64 atom_hw_cache_event_ids
+static __initconst const u64 atom_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -782,7 +782,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
 	return 0;
 }
 
-static __initconst struct x86_pmu core_pmu = {
+static __initconst const struct x86_pmu core_pmu = {
 	.name			= "core",
 	.handle_irq		= x86_pmu_handle_irq,
 	.disable_all		= x86_pmu_disable_all,
@@ -820,7 +820,7 @@ static void intel_pmu_cpu_dying(int cpu)
 	fini_debug_store_on_cpu(cpu);
 }
 
-static __initconst struct x86_pmu intel_pmu = {
+static __initconst const struct x86_pmu intel_pmu = {
 	.name			= "Intel",
 	.handle_irq		= intel_pmu_handle_irq,
 	.disable_all		= intel_pmu_disable_all,
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index acd237d..15367cc 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -287,7 +287,7 @@ static struct p4_event_bind p4_event_bind_map[] = {
 	p4_config_pack_cccr(cache_event					| \
 			    P4_CCCR_ESEL(P4_OPCODE_ESEL(P4_OPCODE(event))))
 
-static __initconst u64 p4_hw_cache_event_ids
+static __initconst const u64 p4_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
 				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -780,7 +780,7 @@ done:
 	return num ? -ENOSPC : 0;
 }
 
-static __initconst struct x86_pmu p4_pmu = {
+static __initconst const struct x86_pmu p4_pmu = {
 	.name			= "Netburst P4/Xeon",
 	.handle_irq		= p4_pmu_handle_irq,
 	.disable_all		= p4_pmu_disable_all,
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
index 9123e8e..34ba07b 100644
--- a/arch/x86/kernel/cpu/perf_event_p6.c
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -84,7 +84,7 @@ static void p6_pmu_enable_event(struct perf_event *event)
 	(void)checking_wrmsrl(hwc->config_base + hwc->idx, val);
 }
 
-static __initconst struct x86_pmu p6_pmu = {
+static __initconst const struct x86_pmu p6_pmu = {
 	.name			= "p6",
 	.handle_irq		= x86_pmu_handle_irq,
 	.disable_all		= p6_pmu_disable_all,

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

* [tip:perf/core] perf, x86: Add Nehalem programming quirk to Westmere
       [not found]             ` <new-submission>
                                 ` (517 preceding siblings ...)
  2010-04-02 19:10               ` [tip:perf/core] perf, x86: Fix __initconst vs const tip-bot for Peter Zijlstra
@ 2010-04-02 19:10               ` tip-bot for Peter Zijlstra
  2010-04-02 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING vs fork deadlock tip-bot for Peter Zijlstra
                                 ` (187 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  40b91cd10f000b4c4934e48e2e5c0bec66def144
Gitweb:     http://git.kernel.org/tip/40b91cd10f000b4c4934e48e2e5c0bec66def144
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 29 Mar 2010 16:37:17 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 19:52:06 +0200

perf, x86: Add Nehalem programming quirk to Westmere

According to the Xeon-5600 errata the Westmere suffers the same PMU
programming bug as the original Nehalem did.

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_event_intel.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 1957e3f..f168b40 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -488,6 +488,7 @@ static void intel_pmu_enable_all(int added)
  * Workaround for:
  *   Intel Errata AAK100 (model 26)
  *   Intel Errata AAP53  (model 30)
+ *   Intel Errata BD53   (model 44)
  *
  * These chips need to be 'reset' when adding counters by programming
  * the magic three (non counting) events 0x4300D2, 0x4300B1 and 0x4300B5
@@ -980,6 +981,7 @@ static __init int intel_pmu_init(void)
 		intel_pmu_lbr_init_nhm();
 
 		x86_pmu.event_constraints = intel_westmere_event_constraints;
+		x86_pmu.enable_all = intel_pmu_nhm_enable_all;
 		pr_cont("Westmere events, ");
 		break;
 

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

* [tip:sched/core] sched: Fix TASK_WAKING vs fork deadlock
       [not found]             ` <new-submission>
                                 ` (518 preceding siblings ...)
  2010-04-02 19:10               ` [tip:perf/core] perf, x86: Add Nehalem programming quirk to Westmere tip-bot for Peter Zijlstra
@ 2010-04-02 19:13               ` tip-bot for Peter Zijlstra
  2010-04-02 19:13               ` [tip:sched/core] sched: Optimize task_rq_lock() tip-bot for Peter Zijlstra
                                 ` (186 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, oleg, tglx, mingo

Commit-ID:  0017d735092844118bef006696a750a0e4ef6ebd
Gitweb:     http://git.kernel.org/tip/0017d735092844118bef006696a750a0e4ef6ebd
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Mar 2010 18:34:10 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 20:12:03 +0200

sched: Fix TASK_WAKING vs fork deadlock

Oleg noticed a few races with the TASK_WAKING usage on fork.

 - since TASK_WAKING is basically a spinlock, it should be IRQ safe
 - since we set TASK_WAKING (*) without holding rq->lock it could
   be there still is a rq->lock holder, thereby not actually
   providing full serialization.

(*) in fact we clear PF_STARTING, which in effect enables TASK_WAKING.

Cure the second issue by not setting TASK_WAKING in sched_fork(), but
only temporarily in wake_up_new_task() while calling select_task_rq().

Cure the first by holding rq->lock around the select_task_rq() call,
this will disable IRQs, this however requires that we push down the
rq->lock release into select_task_rq_fair()'s cgroup stuff.

Because select_task_rq_fair() still needs to drop the rq->lock we
cannot fully get rid of TASK_WAKING.

Reported-by: Oleg Nesterov <oleg@redhat.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/sched.h   |    3 +-
 kernel/sched.c          |   65 +++++++++++++++++-----------------------------
 kernel/sched_fair.c     |    8 ++++-
 kernel/sched_idletask.c |    3 +-
 kernel/sched_rt.c       |    5 +--
 5 files changed, 36 insertions(+), 48 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8bea407..fb6c188 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1046,7 +1046,8 @@ struct sched_class {
 	void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
-	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
+	int  (*select_task_rq)(struct rq *rq, struct task_struct *p,
+			       int sd_flag, int flags);
 
 	void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
 	void (*post_schedule) (struct rq *this_rq);
diff --git a/kernel/sched.c b/kernel/sched.c
index 9a38c7a..dcd1773 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -916,14 +916,10 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
 /*
  * Check whether the task is waking, we use this to synchronize against
  * ttwu() so that task_cpu() reports a stable number.
- *
- * We need to make an exception for PF_STARTING tasks because the fork
- * path might require task_rq_lock() to work, eg. it can call
- * set_cpus_allowed_ptr() from the cpuset clone_ns code.
  */
 static inline int task_is_waking(struct task_struct *p)
 {
-	return unlikely((p->state == TASK_WAKING) && !(p->flags & PF_STARTING));
+	return unlikely(p->state == TASK_WAKING);
 }
 
 /*
@@ -2320,9 +2316,9 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
  * The caller (fork, wakeup) owns TASK_WAKING, ->cpus_allowed is stable.
  */
 static inline
-int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
+int select_task_rq(struct rq *rq, struct task_struct *p, int sd_flags, int wake_flags)
 {
-	int cpu = p->sched_class->select_task_rq(p, sd_flags, wake_flags);
+	int cpu = p->sched_class->select_task_rq(rq, p, sd_flags, wake_flags);
 
 	/*
 	 * In order not to call set_task_cpu() on a blocking task we need
@@ -2393,17 +2389,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	if (p->sched_class->task_waking)
 		p->sched_class->task_waking(rq, p);
 
-	__task_rq_unlock(rq);
-
-	cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
-	if (cpu != orig_cpu) {
-		/*
-		 * Since we migrate the task without holding any rq->lock,
-		 * we need to be careful with task_rq_lock(), since that
-		 * might end up locking an invalid rq.
-		 */
+	cpu = select_task_rq(rq, p, SD_BALANCE_WAKE, wake_flags);
+	if (cpu != orig_cpu)
 		set_task_cpu(p, cpu);
-	}
+	__task_rq_unlock(rq);
 
 	rq = cpu_rq(cpu);
 	raw_spin_lock(&rq->lock);
@@ -2530,11 +2519,11 @@ void sched_fork(struct task_struct *p, int clone_flags)
 
 	__sched_fork(p);
 	/*
-	 * We mark the process as waking here. This guarantees that
+	 * We mark the process as running here. This guarantees that
 	 * nobody will actually run it, and a signal or other external
 	 * event cannot wake it up and insert it on the runqueue either.
 	 */
-	p->state = TASK_WAKING;
+	p->state = TASK_RUNNING;
 
 	/*
 	 * Revert to default priority/policy on fork if requested.
@@ -2601,28 +2590,25 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
 	int cpu __maybe_unused = get_cpu();
 
 #ifdef CONFIG_SMP
+	rq = task_rq_lock(p, &flags);
+	p->state = TASK_WAKING;
+
 	/*
 	 * Fork balancing, do it here and not earlier because:
 	 *  - cpus_allowed can change in the fork path
 	 *  - any previously selected cpu might disappear through hotplug
 	 *
-	 * We still have TASK_WAKING but PF_STARTING is gone now, meaning
-	 * ->cpus_allowed is stable, we have preemption disabled, meaning
-	 * cpu_online_mask is stable.
+	 * We set TASK_WAKING so that select_task_rq() can drop rq->lock
+	 * without people poking at ->cpus_allowed.
 	 */
-	cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
+	cpu = select_task_rq(rq, p, SD_BALANCE_FORK, 0);
 	set_task_cpu(p, cpu);
-#endif
-
-	/*
-	 * Since the task is not on the rq and we still have TASK_WAKING set
-	 * nobody else will migrate this task.
-	 */
-	rq = cpu_rq(cpu);
-	raw_spin_lock_irqsave(&rq->lock, flags);
 
-	BUG_ON(p->state != TASK_WAKING);
 	p->state = TASK_RUNNING;
+	task_rq_unlock(rq, &flags);
+#endif
+
+	rq = task_rq_lock(p, &flags);
 	activate_task(rq, p, 0);
 	trace_sched_wakeup_new(rq, p, 1);
 	check_preempt_curr(rq, p, WF_FORK);
@@ -3068,19 +3054,15 @@ void sched_exec(void)
 {
 	struct task_struct *p = current;
 	struct migration_req req;
-	int dest_cpu, this_cpu;
 	unsigned long flags;
 	struct rq *rq;
-
-	this_cpu = get_cpu();
-	dest_cpu = p->sched_class->select_task_rq(p, SD_BALANCE_EXEC, 0);
-	if (dest_cpu == this_cpu) {
-		put_cpu();
-		return;
-	}
+	int dest_cpu;
 
 	rq = task_rq_lock(p, &flags);
-	put_cpu();
+	dest_cpu = p->sched_class->select_task_rq(rq, p, SD_BALANCE_EXEC, 0);
+	if (dest_cpu == smp_processor_id())
+		goto unlock;
+
 	/*
 	 * select_task_rq() can race against ->cpus_allowed
 	 */
@@ -3098,6 +3080,7 @@ void sched_exec(void)
 
 		return;
 	}
+unlock:
 	task_rq_unlock(rq, &flags);
 }
 
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 49ad993..8a5e763 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1423,7 +1423,8 @@ select_idle_sibling(struct task_struct *p, struct sched_domain *sd, int target)
  *
  * preempt must be disabled.
  */
-static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
+static int
+select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_flags)
 {
 	struct sched_domain *tmp, *affine_sd = NULL, *sd = NULL;
 	int cpu = smp_processor_id();
@@ -1521,8 +1522,11 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
 				  cpumask_weight(sched_domain_span(sd))))
 			tmp = affine_sd;
 
-		if (tmp)
+		if (tmp) {
+			raw_spin_unlock(&rq->lock);
 			update_shares(tmp);
+			raw_spin_lock(&rq->lock);
+		}
 	}
 #endif
 
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index a8a6d8a..5af709f 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -6,7 +6,8 @@
  */
 
 #ifdef CONFIG_SMP
-static int select_task_rq_idle(struct task_struct *p, int sd_flag, int flags)
+static int
+select_task_rq_idle(struct rq *rq, struct task_struct *p, int sd_flag, int flags)
 {
 	return task_cpu(p); /* IDLE tasks as never migrated */
 }
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 012d69b..fde895f 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -948,10 +948,9 @@ static void yield_task_rt(struct rq *rq)
 #ifdef CONFIG_SMP
 static int find_lowest_rq(struct task_struct *task);
 
-static int select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
+static int
+select_task_rq_rt(struct rq *rq, struct task_struct *p, int sd_flag, int flags)
 {
-	struct rq *rq = task_rq(p);
-
 	if (sd_flag != SD_BALANCE_WAKE)
 		return smp_processor_id();
 

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

* [tip:sched/core] sched: Optimize task_rq_lock()
       [not found]             ` <new-submission>
                                 ` (519 preceding siblings ...)
  2010-04-02 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING vs fork deadlock tip-bot for Peter Zijlstra
@ 2010-04-02 19:13               ` tip-bot for Peter Zijlstra
  2010-04-02 19:13               ` [tip:sched/core] sched: Fix nr_uninterruptible count tip-bot for Peter Zijlstra
                                 ` (185 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, oleg, tglx, mingo

Commit-ID:  65cc8e4859ff29a9ddc989c88557d6059834c2a2
Gitweb:     http://git.kernel.org/tip/65cc8e4859ff29a9ddc989c88557d6059834c2a2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 25 Mar 2010 21:05:16 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 20:12:04 +0200

sched: Optimize task_rq_lock()

Now that we hold the rq->lock over set_task_cpu() again, we can do
away with most of the TASK_WAKING checks and reduce them again to
set_cpus_allowed_ptr().

Removes some conditionals from scheduling hot-paths.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Oleg Nesterov <oleg@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index dcd1773..51d336e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -914,8 +914,8 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
 #endif /* __ARCH_WANT_UNLOCKED_CTXSW */
 
 /*
- * Check whether the task is waking, we use this to synchronize against
- * ttwu() so that task_cpu() reports a stable number.
+ * Check whether the task is waking, we use this to synchronize ->cpus_allowed
+ * against ttwu().
  */
 static inline int task_is_waking(struct task_struct *p)
 {
@@ -932,11 +932,9 @@ static inline struct rq *__task_rq_lock(struct task_struct *p)
 	struct rq *rq;
 
 	for (;;) {
-		while (task_is_waking(p))
-			cpu_relax();
 		rq = task_rq(p);
 		raw_spin_lock(&rq->lock);
-		if (likely(rq == task_rq(p) && !task_is_waking(p)))
+		if (likely(rq == task_rq(p)))
 			return rq;
 		raw_spin_unlock(&rq->lock);
 	}
@@ -953,12 +951,10 @@ static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags)
 	struct rq *rq;
 
 	for (;;) {
-		while (task_is_waking(p))
-			cpu_relax();
 		local_irq_save(*flags);
 		rq = task_rq(p);
 		raw_spin_lock(&rq->lock);
-		if (likely(rq == task_rq(p) && !task_is_waking(p)))
+		if (likely(rq == task_rq(p)))
 			return rq;
 		raw_spin_unlock_irqrestore(&rq->lock, *flags);
 	}
@@ -5262,7 +5258,18 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
 	struct rq *rq;
 	int ret = 0;
 
+	/*
+	 * Serialize against TASK_WAKING so that ttwu() and wunt() can
+	 * drop the rq->lock and still rely on ->cpus_allowed.
+	 */
+again:
+	while (task_is_waking(p))
+		cpu_relax();
 	rq = task_rq_lock(p, &flags);
+	if (task_is_waking(p)) {
+		task_rq_unlock(rq, &flags);
+		goto again;
+	}
 
 	if (!cpumask_intersects(new_mask, cpu_active_mask)) {
 		ret = -EINVAL;

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

* [tip:sched/core] sched: Fix nr_uninterruptible count
       [not found]             ` <new-submission>
                                 ` (520 preceding siblings ...)
  2010-04-02 19:13               ` [tip:sched/core] sched: Optimize task_rq_lock() tip-bot for Peter Zijlstra
@ 2010-04-02 19:13               ` tip-bot for Peter Zijlstra
  2010-04-02 19:14               ` [tip:sched/core] sched: Add enqueue/dequeue flags tip-bot for Peter Zijlstra
                                 ` (184 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cc87f76a601d2d256118f7bab15e35254356ae21
Gitweb:     http://git.kernel.org/tip/cc87f76a601d2d256118f7bab15e35254356ae21
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 26 Mar 2010 12:22:14 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 20:12:04 +0200

sched: Fix nr_uninterruptible count

The cpuload calculation in calc_load_account_active() assumes
rq->nr_uninterruptible will not change on an offline cpu after
migrate_nr_uninterruptible(). However the recent migrate on wakeup
changes broke that and would result in decrementing the offline cpu's
rq->nr_uninterruptible.

Fix this by accounting the nr_uninterruptible on the waking cpu.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 51d336e..14c8d2a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2378,8 +2378,12 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	 *
 	 * First fix up the nr_uninterruptible count:
 	 */
-	if (task_contributes_to_load(p))
-		rq->nr_uninterruptible--;
+	if (task_contributes_to_load(p)) {
+		if (likely(cpu_online(orig_cpu)))
+			rq->nr_uninterruptible--;
+		else
+			this_rq()->nr_uninterruptible--;
+	}
 	p->state = TASK_WAKING;
 
 	if (p->sched_class->task_waking)

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

* [tip:sched/core] sched: Add enqueue/dequeue flags
       [not found]             ` <new-submission>
                                 ` (521 preceding siblings ...)
  2010-04-02 19:13               ` [tip:sched/core] sched: Fix nr_uninterruptible count tip-bot for Peter Zijlstra
@ 2010-04-02 19:14               ` tip-bot for Peter Zijlstra
  2010-04-23 10:50               ` [tip:sched/core] sched: Pre-compute cpumask_weight(sched_domain_span(sd)) tip-bot for Peter Zijlstra
                                 ` (183 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-02 19:14 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  371fd7e7a56a5c136d31aa980011bd2f131c3ef5
Gitweb:     http://git.kernel.org/tip/371fd7e7a56a5c136d31aa980011bd2f131c3ef5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Mar 2010 16:38:48 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 2 Apr 2010 20:12:05 +0200

sched: Add enqueue/dequeue flags

In order to reduce the dependency on TASK_WAKING rework the enqueue
interface to support a proper flags field.

Replace the int wakeup, bool head arguments with an int flags argument
and create the following flags:

  ENQUEUE_WAKEUP - the enqueue is a wakeup of a sleeping task,
  ENQUEUE_WAKING - the enqueue has relative vruntime due to
                   having sched_class::task_waking() called,
  ENQUEUE_HEAD - the waking task should be places on the head
                 of the priority queue (where appropriate).

For symmetry also convert sched_class::dequeue() to a flags scheme.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h   |   11 ++++++++---
 kernel/sched.c          |   32 +++++++++++++++++---------------
 kernel/sched_fair.c     |   25 ++++++++-----------------
 kernel/sched_idletask.c |    2 +-
 kernel/sched_rt.c       |    8 ++++----
 5 files changed, 38 insertions(+), 40 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index fb6c188..e3e900f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1032,12 +1032,17 @@ struct sched_domain;
 #define WF_SYNC		0x01		/* waker goes to sleep after wakup */
 #define WF_FORK		0x02		/* child wakeup after fork */
 
+#define ENQUEUE_WAKEUP		1
+#define ENQUEUE_WAKING		2
+#define ENQUEUE_HEAD		4
+
+#define DEQUEUE_SLEEP		1
+
 struct sched_class {
 	const struct sched_class *next;
 
-	void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup,
-			      bool head);
-	void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
+	void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
+	void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
 	void (*yield_task) (struct rq *rq);
 
 	void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
diff --git a/kernel/sched.c b/kernel/sched.c
index 14c8d2a..4a57e96 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1877,44 +1877,43 @@ static void update_avg(u64 *avg, u64 sample)
 	*avg += diff >> 3;
 }
 
-static void
-enqueue_task(struct rq *rq, struct task_struct *p, int wakeup, bool head)
+static void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
 {
 	update_rq_clock(rq);
 	sched_info_queued(p);
-	p->sched_class->enqueue_task(rq, p, wakeup, head);
+	p->sched_class->enqueue_task(rq, p, flags);
 	p->se.on_rq = 1;
 }
 
-static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
+static void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
 {
 	update_rq_clock(rq);
 	sched_info_dequeued(p);
-	p->sched_class->dequeue_task(rq, p, sleep);
+	p->sched_class->dequeue_task(rq, p, flags);
 	p->se.on_rq = 0;
 }
 
 /*
  * activate_task - move a task to the runqueue.
  */
-static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
+static void activate_task(struct rq *rq, struct task_struct *p, int flags)
 {
 	if (task_contributes_to_load(p))
 		rq->nr_uninterruptible--;
 
-	enqueue_task(rq, p, wakeup, false);
+	enqueue_task(rq, p, flags);
 	inc_nr_running(rq);
 }
 
 /*
  * deactivate_task - remove a task from the runqueue.
  */
-static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
+static void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
 {
 	if (task_contributes_to_load(p))
 		rq->nr_uninterruptible++;
 
-	dequeue_task(rq, p, sleep);
+	dequeue_task(rq, p, flags);
 	dec_nr_running(rq);
 }
 
@@ -2353,6 +2352,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 {
 	int cpu, orig_cpu, this_cpu, success = 0;
 	unsigned long flags;
+	unsigned long en_flags = ENQUEUE_WAKEUP;
 	struct rq *rq;
 
 	this_cpu = get_cpu();
@@ -2386,8 +2386,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
 	}
 	p->state = TASK_WAKING;
 
-	if (p->sched_class->task_waking)
+	if (p->sched_class->task_waking) {
 		p->sched_class->task_waking(rq, p);
+		en_flags |= ENQUEUE_WAKING;
+	}
 
 	cpu = select_task_rq(rq, p, SD_BALANCE_WAKE, wake_flags);
 	if (cpu != orig_cpu)
@@ -2432,7 +2434,7 @@ out_activate:
 		schedstat_inc(p, se.statistics.nr_wakeups_local);
 	else
 		schedstat_inc(p, se.statistics.nr_wakeups_remote);
-	activate_task(rq, p, 1);
+	activate_task(rq, p, en_flags);
 	success = 1;
 
 out_running:
@@ -3623,7 +3625,7 @@ need_resched_nonpreemptible:
 		if (unlikely(signal_pending_state(prev->state, prev)))
 			prev->state = TASK_RUNNING;
 		else
-			deactivate_task(rq, prev, 1);
+			deactivate_task(rq, prev, DEQUEUE_SLEEP);
 		switch_count = &prev->nvcsw;
 	}
 
@@ -4193,7 +4195,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 	if (running)
 		p->sched_class->set_curr_task(rq);
 	if (on_rq) {
-		enqueue_task(rq, p, 0, oldprio < prio);
+		enqueue_task(rq, p, oldprio < prio ? ENQUEUE_HEAD : 0);
 
 		check_class_changed(rq, p, prev_class, oldprio, running);
 	}
@@ -4236,7 +4238,7 @@ void set_user_nice(struct task_struct *p, long nice)
 	delta = p->prio - old_prio;
 
 	if (on_rq) {
-		enqueue_task(rq, p, 0, false);
+		enqueue_task(rq, p, 0);
 		/*
 		 * If the task increased its priority or is running and
 		 * lowered its priority, then reschedule its CPU:
@@ -8180,7 +8182,7 @@ void sched_move_task(struct task_struct *tsk)
 	if (unlikely(running))
 		tsk->sched_class->set_curr_task(rq);
 	if (on_rq)
-		enqueue_task(rq, tsk, 0, false);
+		enqueue_task(rq, tsk, 0);
 
 	task_rq_unlock(rq, &flags);
 }
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 8a5e763..88d3053 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -757,9 +757,6 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 	se->vruntime = vruntime;
 }
 
-#define ENQUEUE_WAKEUP	1
-#define ENQUEUE_MIGRATE 2
-
 static void
 enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 {
@@ -767,7 +764,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 	 * Update the normalized vruntime before updating min_vruntime
 	 * through callig update_curr().
 	 */
-	if (!(flags & ENQUEUE_WAKEUP) || (flags & ENQUEUE_MIGRATE))
+	if (!(flags & ENQUEUE_WAKEUP) || (flags & ENQUEUE_WAKING))
 		se->vruntime += cfs_rq->min_vruntime;
 
 	/*
@@ -803,7 +800,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
 }
 
 static void
-dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
+dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 {
 	/*
 	 * Update run-time statistics of the 'current'.
@@ -811,7 +808,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
 	update_curr(cfs_rq);
 
 	update_stats_dequeue(cfs_rq, se);
-	if (sleep) {
+	if (flags & DEQUEUE_SLEEP) {
 #ifdef CONFIG_SCHEDSTATS
 		if (entity_is_task(se)) {
 			struct task_struct *tsk = task_of(se);
@@ -836,7 +833,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
 	 * update can refer to the ->curr item and we need to reflect this
 	 * movement in our normalized position.
 	 */
-	if (!sleep)
+	if (!(flags & DEQUEUE_SLEEP))
 		se->vruntime -= cfs_rq->min_vruntime;
 }
 
@@ -1045,16 +1042,10 @@ static inline void hrtick_update(struct rq *rq)
  * then put the task into the rbtree:
  */
 static void
-enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, bool head)
+enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct cfs_rq *cfs_rq;
 	struct sched_entity *se = &p->se;
-	int flags = 0;
-
-	if (wakeup)
-		flags |= ENQUEUE_WAKEUP;
-	if (p->state == TASK_WAKING)
-		flags |= ENQUEUE_MIGRATE;
 
 	for_each_sched_entity(se) {
 		if (se->on_rq)
@@ -1072,18 +1063,18 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, bool head)
  * decreased. We remove the task from the rbtree and
  * update the fair scheduling stats:
  */
-static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
+static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct cfs_rq *cfs_rq;
 	struct sched_entity *se = &p->se;
 
 	for_each_sched_entity(se) {
 		cfs_rq = cfs_rq_of(se);
-		dequeue_entity(cfs_rq, se, sleep);
+		dequeue_entity(cfs_rq, se, flags);
 		/* Don't dequeue parent if it has other entities besides us */
 		if (cfs_rq->load.weight)
 			break;
-		sleep = 1;
+		flags |= DEQUEUE_SLEEP;
 	}
 
 	hrtick_update(rq);
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c
index 5af709f..bea2b8f 100644
--- a/kernel/sched_idletask.c
+++ b/kernel/sched_idletask.c
@@ -33,7 +33,7 @@ static struct task_struct *pick_next_task_idle(struct rq *rq)
  * message if some code attempts to do it:
  */
 static void
-dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
+dequeue_task_idle(struct rq *rq, struct task_struct *p, int flags)
 {
 	raw_spin_unlock_irq(&rq->lock);
 	printk(KERN_ERR "bad: scheduling from the idle thread!\n");
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index fde895f..8afb953 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -888,20 +888,20 @@ static void dequeue_rt_entity(struct sched_rt_entity *rt_se)
  * Adding/removing a task to/from a priority array:
  */
 static void
-enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, bool head)
+enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct sched_rt_entity *rt_se = &p->rt;
 
-	if (wakeup)
+	if (flags & ENQUEUE_WAKEUP)
 		rt_se->timeout = 0;
 
-	enqueue_rt_entity(rt_se, head);
+	enqueue_rt_entity(rt_se, flags & ENQUEUE_HEAD);
 
 	if (!task_current(rq, p) && p->rt.nr_cpus_allowed > 1)
 		enqueue_pushable_task(rq, p);
 }
 
-static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
+static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct sched_rt_entity *rt_se = &p->rt;
 

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

* [tip:sched/core] sched: Pre-compute cpumask_weight(sched_domain_span(sd))
       [not found]             ` <new-submission>
                                 ` (522 preceding siblings ...)
  2010-04-02 19:14               ` [tip:sched/core] sched: Add enqueue/dequeue flags tip-bot for Peter Zijlstra
@ 2010-04-23 10:50               ` tip-bot for Peter Zijlstra
  2010-05-07 18:41               ` [tip:perf/core] perf: Annotate perf_event_read_group() vs perf_event_release_kernel() tip-bot for Peter Zijlstra
                                 ` (182 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-04-23 10:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo, davem

Commit-ID:  669c55e9f99b90e46eaa0f98a67ec53d46dc969a
Gitweb:     http://git.kernel.org/tip/669c55e9f99b90e46eaa0f98a67ec53d46dc969a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 16 Apr 2010 14:59:29 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 23 Apr 2010 11:02:02 +0200

sched: Pre-compute cpumask_weight(sched_domain_span(sd))

Dave reported that his large SPARC machines spend lots of time in
hweight64(), try and optimize some of those needless cpumask_weight()
invocations (esp. with the large offstack cpumasks these are very
expensive indeed).

Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h |    1 +
 kernel/sched.c        |    3 +++
 kernel/sched_fair.c   |   12 +++++-------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index e3e900f..dfea405 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -960,6 +960,7 @@ struct sched_domain {
 	char *name;
 #endif
 
+	unsigned int span_weight;
 	/*
 	 * Span of all CPUs in this domain.
 	 *
diff --git a/kernel/sched.c b/kernel/sched.c
index 0cc913a..4956ed0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6271,6 +6271,9 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
 	struct rq *rq = cpu_rq(cpu);
 	struct sched_domain *tmp;
 
+	for (tmp = sd; tmp; tmp = tmp->parent)
+		tmp->span_weight = cpumask_weight(sched_domain_span(tmp));
+
 	/* Remove the sched domains which do not contribute to scheduling. */
 	for (tmp = sd; tmp; ) {
 		struct sched_domain *parent = tmp->parent;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 88d3053..0a413c7 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1508,9 +1508,7 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_
 		 * Pick the largest domain to update shares over
 		 */
 		tmp = sd;
-		if (affine_sd && (!tmp ||
-				  cpumask_weight(sched_domain_span(affine_sd)) >
-				  cpumask_weight(sched_domain_span(sd))))
+		if (affine_sd && (!tmp || affine_sd->span_weight > sd->span_weight))
 			tmp = affine_sd;
 
 		if (tmp) {
@@ -1554,10 +1552,10 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_
 
 		/* Now try balancing at a lower domain level of new_cpu */
 		cpu = new_cpu;
-		weight = cpumask_weight(sched_domain_span(sd));
+		weight = sd->span_weight;
 		sd = NULL;
 		for_each_domain(cpu, tmp) {
-			if (weight <= cpumask_weight(sched_domain_span(tmp)))
+			if (weight <= tmp->span_weight)
 				break;
 			if (tmp->flags & sd_flag)
 				sd = tmp;
@@ -2243,7 +2241,7 @@ unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)
 
 unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
 {
-	unsigned long weight = cpumask_weight(sched_domain_span(sd));
+	unsigned long weight = sd->span_weight;
 	unsigned long smt_gain = sd->smt_gain;
 
 	smt_gain /= weight;
@@ -2276,7 +2274,7 @@ unsigned long scale_rt_power(int cpu)
 
 static void update_cpu_power(struct sched_domain *sd, int cpu)
 {
-	unsigned long weight = cpumask_weight(sched_domain_span(sd));
+	unsigned long weight = sd->span_weight;
 	unsigned long power = SCHED_LOAD_SCALE;
 	struct sched_group *sdg = sd->groups;
 

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

* [tip:perf/core] perf: Annotate perf_event_read_group() vs perf_event_release_kernel()
       [not found]             ` <new-submission>
                                 ` (523 preceding siblings ...)
  2010-04-23 10:50               ` [tip:sched/core] sched: Pre-compute cpumask_weight(sched_domain_span(sd)) tip-bot for Peter Zijlstra
@ 2010-05-07 18:41               ` tip-bot for Peter Zijlstra
  2010-05-07 18:43               ` [tip:perf/core] perf, x86: Remove PEBS SAMPLE_RAW support tip-bot for Peter Zijlstra
                                 ` (181 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-07 18:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  a0507c84bf47dfd204299774f45fd16da33f0619
Gitweb:     http://git.kernel.org/tip/a0507c84bf47dfd204299774f45fd16da33f0619
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 6 May 2010 15:42:53 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 May 2010 11:30:59 +0200

perf: Annotate perf_event_read_group() vs perf_event_release_kernel()

Stephane reported a lockdep warning while using PERF_FORMAT_GROUP.

The issue is that perf_event_read_group() takes faults while holding
the ctx->mutex, while perf_event_release_kernel() can be called from
munmap(). Which makes for an AB-BA deadlock.

Except we can never establish the deadlock because we'll only ever
call perf_event_release_kernel() after all file descriptors are dead
so there is no concurrency possible.

Reported-by: Stephane Eranian <eranian@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 49d8be5..34659d4 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1867,7 +1867,19 @@ int perf_event_release_kernel(struct perf_event *event)
 	event->state = PERF_EVENT_STATE_FREE;
 
 	WARN_ON_ONCE(ctx->parent_ctx);
-	mutex_lock(&ctx->mutex);
+	/*
+	 * There are two ways this annotation is useful:
+	 *
+	 *  1) there is a lock recursion from perf_event_exit_task
+	 *     see the comment there.
+	 *
+	 *  2) there is a lock-inversion with mmap_sem through
+	 *     perf_event_read_group(), which takes faults while
+	 *     holding ctx->mutex, however this is called after
+	 *     the last filedesc died, so there is no possibility
+	 *     to trigger the AB-BA case.
+	 */
+	mutex_lock_nested(&ctx->mutex, SINGLE_DEPTH_NESTING);
 	perf_event_remove_from_context(event);
 	mutex_unlock(&ctx->mutex);
 
@@ -5305,7 +5317,7 @@ void perf_event_exit_task(struct task_struct *child)
 	 *
 	 * But since its the parent context it won't be the same instance.
 	 */
-	mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING);
+	mutex_lock(&child_ctx->mutex);
 
 again:
 	list_for_each_entry_safe(child_event, tmp, &child_ctx->pinned_groups,

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

* [tip:perf/core] perf, x86: Remove PEBS SAMPLE_RAW support
       [not found]             ` <new-submission>
                                 ` (524 preceding siblings ...)
  2010-05-07 18:41               ` [tip:perf/core] perf: Annotate perf_event_read_group() vs perf_event_release_kernel() tip-bot for Peter Zijlstra
@ 2010-05-07 18:43               ` tip-bot for Peter Zijlstra
  2010-05-07 18:43               ` [tip:perf/core] perf, x86: Consolidate some code repetition tip-bot for Peter Zijlstra
                                 ` (180 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-07 18:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  1e9a6d8d44cb6dcd2799b36ceb23007e6a423bfe
Gitweb:     http://git.kernel.org/tip/1e9a6d8d44cb6dcd2799b36ceb23007e6a423bfe
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 4 May 2010 16:30:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 May 2010 11:31:01 +0200

perf, x86: Remove PEBS SAMPLE_RAW support

Its broken, we really should get PERF_SAMPLE_REGS sorted.

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_event_intel_ds.c |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index ec8b2e1..080b9b0 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -459,7 +459,6 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	struct perf_event *event = cpuc->events[0]; /* PMC0 only */
 	struct pebs_record_core *at, *top;
 	struct perf_sample_data data;
-	struct perf_raw_record raw;
 	struct pt_regs regs;
 	int n;
 
@@ -499,12 +498,6 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	perf_sample_data_init(&data, 0);
 	data.period = event->hw.last_period;
 
-	if (event->attr.sample_type & PERF_SAMPLE_RAW) {
-		raw.size = x86_pmu.pebs_record_size;
-		raw.data = at;
-		data.raw = &raw;
-	}
-
 	/*
 	 * We use the interrupt regs as a base because the PEBS record
 	 * does not contain a full regs set, specifically it seems to
@@ -536,7 +529,6 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 	struct pebs_record_nhm *at, *top;
 	struct perf_sample_data data;
 	struct perf_event *event = NULL;
-	struct perf_raw_record raw;
 	struct pt_regs regs;
 	u64 status = 0;
 	int bit, n;
@@ -585,12 +577,6 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 		perf_sample_data_init(&data, 0);
 		data.period = event->hw.last_period;
 
-		if (event->attr.sample_type & PERF_SAMPLE_RAW) {
-			raw.size = x86_pmu.pebs_record_size;
-			raw.data = at;
-			data.raw = &raw;
-		}
-
 		/*
 		 * See the comment in intel_pmu_drain_pebs_core()
 		 */

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

* [tip:perf/core] perf, x86: Consolidate some code repetition
       [not found]             ` <new-submission>
                                 ` (525 preceding siblings ...)
  2010-05-07 18:43               ` [tip:perf/core] perf, x86: Remove PEBS SAMPLE_RAW support tip-bot for Peter Zijlstra
@ 2010-05-07 18:43               ` tip-bot for Peter Zijlstra
  2010-05-07 18:44               ` [tip:perf/core] perf, x86: Improve the PEBS ABI tip-bot for Peter Zijlstra
                                 ` (179 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-07 18:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, peterz, tglx, mingo

Commit-ID:  2b0b5c6fe9b383f3cf35a0a6371c9d577bd523ff
Gitweb:     http://git.kernel.org/tip/2b0b5c6fe9b383f3cf35a0a6371c9d577bd523ff
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 8 Apr 2010 23:03:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 May 2010 11:31:02 +0200

perf, x86: Consolidate some code repetition

Remove some duplicated logic.

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_event_intel_ds.c |   97 +++++++++++++----------------
 1 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 080b9b0..35056f7 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -452,14 +452,54 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
 
 static int intel_pmu_save_and_restart(struct perf_event *event);
 
+static void __intel_pmu_pebs_event(struct perf_event *event,
+				   struct pt_regs *iregs, void *__pebs)
+{
+	/*
+	 * We cast to pebs_record_core since that is a subset of
+	 * both formats and we don't use the other fields in this
+	 * routine.
+	 */
+	struct pebs_record_core *pebs = __pebs;
+	struct perf_sample_data data;
+	struct pt_regs regs;
+
+	if (!intel_pmu_save_and_restart(event))
+		return;
+
+	perf_sample_data_init(&data, 0);
+	data.period = event->hw.last_period;
+
+	/*
+	 * We use the interrupt regs as a base because the PEBS record
+	 * does not contain a full regs set, specifically it seems to
+	 * lack segment descriptors, which get used by things like
+	 * user_mode().
+	 *
+	 * In the simple case fix up only the IP and BP,SP regs, for
+	 * PERF_SAMPLE_IP and PERF_SAMPLE_CALLCHAIN to function properly.
+	 * A possible PERF_SAMPLE_REGS will have to transfer all regs.
+	 */
+	regs = *iregs;
+	regs.ip = pebs->ip;
+	regs.bp = pebs->bp;
+	regs.sp = pebs->sp;
+
+	if (intel_pmu_pebs_fixup_ip(regs))
+		regs.flags |= PERF_EFLAGS_EXACT;
+	else
+		regs.flags &= ~PERF_EFLAGS_EXACT;
+
+	if (perf_event_overflow(event, 1, &data, &regs))
+		x86_pmu_stop(event);
+}
+
 static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct debug_store *ds = cpuc->ds;
 	struct perf_event *event = cpuc->events[0]; /* PMC0 only */
 	struct pebs_record_core *at, *top;
-	struct perf_sample_data data;
-	struct pt_regs regs;
 	int n;
 
 	if (!ds || !x86_pmu.pebs)
@@ -485,9 +525,6 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	if (n <= 0)
 		return;
 
-	if (!intel_pmu_save_and_restart(event))
-		return;
-
 	/*
 	 * Should not happen, we program the threshold at 1 and do not
 	 * set a reset value.
@@ -495,31 +532,7 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 	WARN_ON_ONCE(n > 1);
 	at += n - 1;
 
-	perf_sample_data_init(&data, 0);
-	data.period = event->hw.last_period;
-
-	/*
-	 * We use the interrupt regs as a base because the PEBS record
-	 * does not contain a full regs set, specifically it seems to
-	 * lack segment descriptors, which get used by things like
-	 * user_mode().
-	 *
-	 * In the simple case fix up only the IP and BP,SP regs, for
-	 * PERF_SAMPLE_IP and PERF_SAMPLE_CALLCHAIN to function properly.
-	 * A possible PERF_SAMPLE_REGS will have to transfer all regs.
-	 */
-	regs = *iregs;
-	regs.ip = at->ip;
-	regs.bp = at->bp;
-	regs.sp = at->sp;
-
-	if (intel_pmu_pebs_fixup_ip(&regs))
-		regs.flags |= PERF_EFLAGS_EXACT;
-	else
-		regs.flags &= ~PERF_EFLAGS_EXACT;
-
-	if (perf_event_overflow(event, 1, &data, &regs))
-		x86_pmu_stop(event);
+	__intel_pmu_pebs_event(event, iregs, at);
 }
 
 static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
@@ -527,9 +540,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct debug_store *ds = cpuc->ds;
 	struct pebs_record_nhm *at, *top;
-	struct perf_sample_data data;
 	struct perf_event *event = NULL;
-	struct pt_regs regs;
 	u64 status = 0;
 	int bit, n;
 
@@ -571,27 +582,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 		if (!event || bit >= MAX_PEBS_EVENTS)
 			continue;
 
-		if (!intel_pmu_save_and_restart(event))
-			continue;
-
-		perf_sample_data_init(&data, 0);
-		data.period = event->hw.last_period;
-
-		/*
-		 * See the comment in intel_pmu_drain_pebs_core()
-		 */
-		regs = *iregs;
-		regs.ip = at->ip;
-		regs.bp = at->bp;
-		regs.sp = at->sp;
-
-		if (intel_pmu_pebs_fixup_ip(&regs))
-			regs.flags |= PERF_EFLAGS_EXACT;
-		else
-			regs.flags &= ~PERF_EFLAGS_EXACT;
-
-		if (perf_event_overflow(event, 1, &data, &regs))
-			x86_pmu_stop(event);
+		__intel_pmu_pebs_event(event, iregs, at);
 	}
 }
 

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

* [tip:perf/core] perf, x86: Improve the PEBS ABI
       [not found]             ` <new-submission>
                                 ` (526 preceding siblings ...)
  2010-05-07 18:43               ` [tip:perf/core] perf, x86: Consolidate some code repetition tip-bot for Peter Zijlstra
@ 2010-05-07 18:44               ` tip-bot for Peter Zijlstra
  2010-05-11  7:24               ` [tip:perf/core] Revert "perf: Fix exit() vs PERF_FORMAT_GROUP" tip-bot for Ingo Molnar
                                 ` (178 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-07 18:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, hpa, mingo, a.p.zijlstra, peterz,
	tglx, mingo

Commit-ID:  ab608344bcbde4f55ec4cd911b686b0ce3eae076
Gitweb:     http://git.kernel.org/tip/ab608344bcbde4f55ec4cd911b686b0ce3eae076
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 8 Apr 2010 23:03:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 May 2010 11:31:02 +0200

perf, x86: Improve the PEBS ABI

Rename perf_event_attr::precise to perf_event_attr::precise_ip and
widen it to 2 bits. This new field describes the required precision of
the PERF_SAMPLE_IP field:

  0 - SAMPLE_IP can have arbitrary skid
  1 - SAMPLE_IP must have constant skid
  2 - SAMPLE_IP requested to have 0 skid
  3 - SAMPLE_IP must have 0 skid

And modify the Intel PEBS code accordingly. The PEBS implementation
now supports up to precise_ip == 2, where we perform the IP fixup.

Also s/PERF_RECORD_MISC_EXACT/&_IP/ to clarify its meaning, this bit
should be set for each PERF_SAMPLE_IP field known to match the actual
instruction triggering the event.

This new scheme allows for a PEBS mode that uses the buffer for more
than a single event.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c          |   17 ++++++++++++++++-
 arch/x86/kernel/cpu/perf_event_intel.c    |    4 ++--
 arch/x86/kernel/cpu/perf_event_intel_ds.c |   12 ++++++------
 include/linux/perf_event.h                |   23 +++++++++++++++++++----
 tools/perf/builtin-top.c                  |    2 +-
 tools/perf/util/parse-events.c            |   25 ++++++++++++++++---------
 6 files changed, 60 insertions(+), 23 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4a3f1f2..27fa9ee 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -488,6 +488,21 @@ static int x86_setup_perfctr(struct perf_event *event)
 
 static int x86_pmu_hw_config(struct perf_event *event)
 {
+	if (event->attr.precise_ip) {
+		int precise = 0;
+
+		/* Support for constant skid */
+		if (x86_pmu.pebs)
+			precise++;
+
+		/* Support for IP fixup */
+		if (x86_pmu.lbr_nr)
+			precise++;
+
+		if (event->attr.precise_ip > precise)
+			return -EOPNOTSUPP;
+	}
+
 	/*
 	 * Generate PMC IRQs:
 	 * (keep 'enabled' bit clear for now)
@@ -1780,7 +1795,7 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
 	}
 
 	if (regs->flags & PERF_EFLAGS_EXACT)
-		misc |= PERF_RECORD_MISC_EXACT;
+		misc |= PERF_RECORD_MISC_EXACT_IP;
 
 	return misc;
 }
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index a4b56ac..fdbc652 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -563,7 +563,7 @@ static void intel_pmu_disable_event(struct perf_event *event)
 
 	x86_pmu_disable_event(event);
 
-	if (unlikely(event->attr.precise))
+	if (unlikely(event->attr.precise_ip))
 		intel_pmu_pebs_disable(event);
 }
 
@@ -615,7 +615,7 @@ static void intel_pmu_enable_event(struct perf_event *event)
 		return;
 	}
 
-	if (unlikely(event->attr.precise))
+	if (unlikely(event->attr.precise_ip))
 		intel_pmu_pebs_enable(event);
 
 	__x86_pmu_enable_event(hwc, ARCH_PERFMON_EVENTSEL_ENABLE);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 35056f7..18018d1 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -307,7 +307,7 @@ intel_pebs_constraints(struct perf_event *event)
 {
 	struct event_constraint *c;
 
-	if (!event->attr.precise)
+	if (!event->attr.precise_ip)
 		return NULL;
 
 	if (x86_pmu.pebs_constraints) {
@@ -330,7 +330,7 @@ static void intel_pmu_pebs_enable(struct perf_event *event)
 	cpuc->pebs_enabled |= 1ULL << hwc->idx;
 	WARN_ON_ONCE(cpuc->enabled);
 
-	if (x86_pmu.intel_cap.pebs_trap)
+	if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1)
 		intel_pmu_lbr_enable(event);
 }
 
@@ -345,7 +345,7 @@ static void intel_pmu_pebs_disable(struct perf_event *event)
 
 	hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
 
-	if (x86_pmu.intel_cap.pebs_trap)
+	if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1)
 		intel_pmu_lbr_disable(event);
 }
 
@@ -485,7 +485,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
 	regs.bp = pebs->bp;
 	regs.sp = pebs->sp;
 
-	if (intel_pmu_pebs_fixup_ip(regs))
+	if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(&regs))
 		regs.flags |= PERF_EFLAGS_EXACT;
 	else
 		regs.flags &= ~PERF_EFLAGS_EXACT;
@@ -518,7 +518,7 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
 
 	WARN_ON_ONCE(!event);
 
-	if (!event->attr.precise)
+	if (!event->attr.precise_ip)
 		return;
 
 	n = top - at;
@@ -570,7 +570,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
 
 			WARN_ON_ONCE(!event);
 
-			if (!event->attr.precise)
+			if (!event->attr.precise_ip)
 				continue;
 
 			if (__test_and_set_bit(bit, (unsigned long *)&status))
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 6be4a0f..23cd005 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -203,9 +203,19 @@ struct perf_event_attr {
 				enable_on_exec :  1, /* next exec enables     */
 				task           :  1, /* trace fork/exit       */
 				watermark      :  1, /* wakeup_watermark      */
-				precise        :  1, /* OoO invariant counter */
-
-				__reserved_1   : 48;
+				/*
+				 * precise_ip:
+				 *
+				 *  0 - SAMPLE_IP can have arbitrary skid
+				 *  1 - SAMPLE_IP must have constant skid
+				 *  2 - SAMPLE_IP requested to have 0 skid
+				 *  3 - SAMPLE_IP must have 0 skid
+				 *
+				 *  See also PERF_RECORD_MISC_EXACT_IP
+				 */
+				precise_ip     :  2, /* skid constraint       */
+
+				__reserved_1   : 47;
 
 	union {
 		__u32		wakeup_events;	  /* wakeup every n events */
@@ -296,7 +306,12 @@ struct perf_event_mmap_page {
 #define PERF_RECORD_MISC_GUEST_KERNEL		(4 << 0)
 #define PERF_RECORD_MISC_GUEST_USER		(5 << 0)
 
-#define PERF_RECORD_MISC_EXACT			(1 << 14)
+/*
+ * Indicates that the content of PERF_SAMPLE_IP points to
+ * the actual instruction that triggered the event. See also
+ * perf_event_attr::precise_ip.
+ */
+#define PERF_RECORD_MISC_EXACT_IP		(1 << 14)
 /*
  * Reserve the last bit to indicate some extended misc field
  */
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 3de3977..ed9b5b6 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1021,7 +1021,7 @@ static void event__process_sample(const event_t *self,
 		return;
 	}
 
-	if (self->header.misc & PERF_RECORD_MISC_EXACT)
+	if (self->header.misc & PERF_RECORD_MISC_EXACT_IP)
 		exact_samples++;
 
 	if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index bc8b7e6..ae7f591 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -654,10 +654,6 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr)
 		return EVT_FAILED;
 	n = hex2u64(str + 1, &config);
 	if (n > 0) {
-		if (str[n+1] == 'p') {
-			attr->precise = 1;
-			n++;
-		}
 		*strp = str + n + 1;
 		attr->type = PERF_TYPE_RAW;
 		attr->config = config;
@@ -692,19 +688,29 @@ static enum event_result
 parse_event_modifier(const char **strp, struct perf_event_attr *attr)
 {
 	const char *str = *strp;
-	int eu = 1, ek = 1, eh = 1;
+	int exclude = 0;
+	int eu = 0, ek = 0, eh = 0, precise = 0;
 
 	if (*str++ != ':')
 		return 0;
 	while (*str) {
-		if (*str == 'u')
+		if (*str == 'u') {
+			if (!exclude)
+				exclude = eu = ek = eh = 1;
 			eu = 0;
-		else if (*str == 'k')
+		} else if (*str == 'k') {
+			if (!exclude)
+				exclude = eu = ek = eh = 1;
 			ek = 0;
-		else if (*str == 'h')
+		} else if (*str == 'h') {
+			if (!exclude)
+				exclude = eu = ek = eh = 1;
 			eh = 0;
-		else
+		} else if (*str == 'p') {
+			precise++;
+		} else
 			break;
+
 		++str;
 	}
 	if (str >= *strp + 2) {
@@ -712,6 +718,7 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr)
 		attr->exclude_user   = eu;
 		attr->exclude_kernel = ek;
 		attr->exclude_hv     = eh;
+		attr->precise_ip     = precise;
 		return 1;
 	}
 	return 0;

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

* [tip:perf/core] Revert "perf: Fix exit() vs PERF_FORMAT_GROUP"
       [not found]             ` <new-submission>
                                 ` (527 preceding siblings ...)
  2010-05-07 18:44               ` [tip:perf/core] perf, x86: Improve the PEBS ABI tip-bot for Peter Zijlstra
@ 2010-05-11  7:24               ` tip-bot for Ingo Molnar
  2010-05-17 21:09               ` [tip:perf/core] perf symbols: symbol inconsistency message should be done only at verbose=1 tip-bot for Arnaldo Carvalho de Melo
                                 ` (177 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-05-11  7:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, eranian, hpa, mingo, a.p.zijlstra,
	efault, fweisbec, ming.m.lin, tglx, cjashfor, mingo

Commit-ID:  e3174cfd2a1e28fff774681f00a0eef3d31da970
Gitweb:     http://git.kernel.org/tip/e3174cfd2a1e28fff774681f00a0eef3d31da970
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Tue, 11 May 2010 08:31:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 11 May 2010 08:31:49 +0200

Revert "perf: Fix exit() vs PERF_FORMAT_GROUP"

This reverts commit 4fd38e4595e2f6c9d27732c042a0e16b2753049c.

It causes various crashes and hangs when events are activated.

The cause is not fully understood yet but we need to revert it
because the effects are severe.

Reported-by: Stephane Eranian <eranian@google.com>
Reported-by: Lin Ming <ming.m.lin@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
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>
---
 include/linux/perf_event.h |    1 -
 kernel/perf_event.c        |    5 -----
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 4924c96..3fd5c82 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -575,7 +575,6 @@ struct pmu {
  * enum perf_event_active_state - the states of a event
  */
 enum perf_event_active_state {
-	PERF_EVENT_STATE_FREE		= -3,
 	PERF_EVENT_STATE_ERROR		= -2,
 	PERF_EVENT_STATE_OFF		= -1,
 	PERF_EVENT_STATE_INACTIVE	=  0,
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 180151f..a904746 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -334,9 +334,6 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
 	if (event->state > PERF_EVENT_STATE_OFF)
 		event->state = PERF_EVENT_STATE_OFF;
 
-	if (event->state > PERF_EVENT_STATE_FREE)
-		return;
-
 	/*
 	 * If this was a group event with sibling events then
 	 * upgrade the siblings to singleton events by adding them
@@ -1871,8 +1868,6 @@ int perf_event_release_kernel(struct perf_event *event)
 {
 	struct perf_event_context *ctx = event->ctx;
 
-	event->state = PERF_EVENT_STATE_FREE;
-
 	WARN_ON_ONCE(ctx->parent_ctx);
 	/*
 	 * There are two ways this annotation is useful:

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

* [tip:perf/core] perf symbols: symbol inconsistency message should be done only at verbose=1
       [not found]             ` <new-submission>
                                 ` (528 preceding siblings ...)
  2010-05-11  7:24               ` [tip:perf/core] Revert "perf: Fix exit() vs PERF_FORMAT_GROUP" tip-bot for Ingo Molnar
@ 2010-05-17 21:09               ` tip-bot for Arnaldo Carvalho de Melo
  2010-05-17 22:33               ` [tip:perf/core] perf tools: Add mode to build without newt support tip-bot for Arnaldo Carvalho de Melo
                                 ` (176 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-05-17 21:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx, mingo

Commit-ID:  2f51903bc3139e25ec908f8944a0001c7b868e90
Gitweb:     http://git.kernel.org/tip/2f51903bc3139e25ec908f8944a0001c7b868e90
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 17 May 2010 17:57:59 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 May 2010 17:57:59 -0300

perf symbols: symbol inconsistency message should be done only at verbose=1

That happened for an old perf.data file that had no fake MMAP events for
the kernel modules, but even then it should warn once for each module,
not one time for every symbol in every module not found.

Reported-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 ecccc8d..a06131f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -525,7 +525,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
 				curr_map = map_groups__find_by_name(kmaps,
 							map->type, module);
 				if (curr_map == NULL) {
-					pr_err("%s/proc/{kallsyms,modules} "
+					pr_debug("%s/proc/{kallsyms,modules} "
 					         "inconsistency while looking "
 						 "for \"%s\" module!\n",
 						 machine->root_dir, module);

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

* [tip:perf/core] perf tools: Add mode to build without newt support
       [not found]             ` <new-submission>
                                 ` (529 preceding siblings ...)
  2010-05-17 21:09               ` [tip:perf/core] perf symbols: symbol inconsistency message should be done only at verbose=1 tip-bot for Arnaldo Carvalho de Melo
@ 2010-05-17 22:33               ` tip-bot for Arnaldo Carvalho de Melo
  2010-05-18 17:15               ` [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events tip-bot for Peter Zijlstra
                                 ` (175 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-05-17 22:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx, mingo

Commit-ID:  94f3ca95787ada3d64339a4ecb2754236ab563f6
Gitweb:     http://git.kernel.org/tip/94f3ca95787ada3d64339a4ecb2754236ab563f6
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 17 May 2010 18:18:11 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 May 2010 18:18:11 -0300

perf tools: Add mode to build without newt support

make NO_NEWT=1

Will avoid building the newt (tui) support.

Suggested-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e2729fc..3d8f31e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -558,6 +558,9 @@ else
 endif # PERF_HAVE_DWARF_REGS
 endif # NO_DWARF
 
+ifdef NO_NEWT
+	BASIC_CFLAGS += -DNO_NEWT_SUPPORT
+else
 ifneq ($(shell sh -c "(echo '\#include <newt.h>'; echo 'int main(void) { newtInit(); newtCls(); return newtFinished(); }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -lnewt -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
 	msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
 	BASIC_CFLAGS += -DNO_NEWT_SUPPORT
@@ -567,6 +570,7 @@ else
 	EXTLIBS += -lnewt -lslang
 	LIB_OBJS += $(OUTPUT)util/newt.o
 endif
+endif # NO_NEWT
 
 ifndef NO_LIBPERL
 PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`

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

* [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
       [not found]             ` <new-submission>
                                 ` (530 preceding siblings ...)
  2010-05-17 22:33               ` [tip:perf/core] perf tools: Add mode to build without newt support tip-bot for Arnaldo Carvalho de Melo
@ 2010-05-18 17:15               ` tip-bot for Peter Zijlstra
  2010-05-19  7:58                 ` Frederic Weisbecker
  2010-05-18 17:16               ` [tip:perf/core] perf: Disallow mmap() on per-task inherited events tip-bot for Peter Zijlstra
                                 ` (174 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-18 17:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  4f41c013f553957765902fb01475972f0af3e8e7
Gitweb:     http://git.kernel.org/tip/4f41c013f553957765902fb01475972f0af3e8e7
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 18 May 2010 18:08:32 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:46 +0200

perf/ftrace: Optimize perf/tracepoint interaction for single events

When we've got but a single event per tracepoint
there is no reason to try and multiplex it so don't.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
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/ftrace_event.h    |    8 +++++---
 include/linux/perf_event.h      |    2 +-
 include/trace/ftrace.h          |    3 ++-
 kernel/perf_event.c             |   15 ++++++++++-----
 kernel/trace/trace_event_perf.c |   11 +++++++----
 kernel/trace/trace_kprobe.c     |    4 ++--
 kernel/trace/trace_syscalls.c   |    6 ++++--
 7 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c0f4b36..c809100 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -132,6 +132,7 @@ struct ftrace_event_call {
 	void			*data;
 
 	int			perf_refcount;
+	void			*perf_data;
 	int			(*perf_event_enable)(struct ftrace_event_call *);
 	void			(*perf_event_disable)(struct ftrace_event_call *);
 };
@@ -190,7 +191,7 @@ struct perf_event;
 
 DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
 
-extern int perf_trace_enable(int event_id);
+extern int perf_trace_enable(int event_id, void *data);
 extern void perf_trace_disable(int event_id);
 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
 				     char *filter_str);
@@ -201,11 +202,12 @@ perf_trace_buf_prepare(int size, unsigned short type, int *rctxp,
 
 static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
-		       u64 count, unsigned long irq_flags, struct pt_regs *regs)
+		       u64 count, unsigned long irq_flags, struct pt_regs *regs,
+		       void *event)
 {
 	struct trace_entry *entry = raw_data;
 
-	perf_tp_event(entry->type, addr, count, raw_data, size, regs);
+	perf_tp_event(entry->type, addr, count, raw_data, size, regs, event);
 	perf_swevent_put_recursion_context(rctx);
 	local_irq_restore(irq_flags);
 }
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3fd5c82..0b521fc 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -994,7 +994,7 @@ static inline bool perf_paranoid_kernel(void)
 
 extern void perf_event_init(void);
 extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
-			  int entry_size, struct pt_regs *regs);
+			  int entry_size, struct pt_regs *regs, void *event);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 882c648..0a29df0 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -785,7 +785,8 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call,		\
 	{ assign; }							\
 									\
 	perf_trace_buf_submit(entry, __entry_size, rctx, __addr,	\
-			       __count, irq_flags, __regs);		\
+			       __count, irq_flags, __regs, 		\
+			      event_call->perf_data);			\
 }
 
 #undef DEFINE_EVENT
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a4fa381..17ac47f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4468,8 +4468,9 @@ static int swevent_hlist_get(struct perf_event *event)
 #ifdef CONFIG_EVENT_TRACING
 
 void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
-		   int entry_size, struct pt_regs *regs)
+		   int entry_size, struct pt_regs *regs, void *event)
 {
+	const int type = PERF_TYPE_TRACEPOINT;
 	struct perf_sample_data data;
 	struct perf_raw_record raw = {
 		.size = entry_size,
@@ -4479,9 +4480,13 @@ void perf_tp_event(int event_id, u64 addr, u64 count, void *record,
 	perf_sample_data_init(&data, addr);
 	data.raw = &raw;
 
-	/* Trace events already protected against recursion */
-	do_perf_sw_event(PERF_TYPE_TRACEPOINT, event_id, count, 1,
-			 &data, regs);
+	if (!event) {
+		do_perf_sw_event(type, event_id, count, 1, &data, regs);
+		return;
+	}
+
+	if (perf_swevent_match(event, type, event_id, &data, regs))
+		perf_swevent_add(event, count, 1, &data, regs);
 }
 EXPORT_SYMBOL_GPL(perf_tp_event);
 
@@ -4514,7 +4519,7 @@ static const struct pmu *tp_perf_event_init(struct perf_event *event)
 			!capable(CAP_SYS_ADMIN))
 		return ERR_PTR(-EPERM);
 
-	if (perf_trace_enable(event->attr.config))
+	if (perf_trace_enable(event->attr.config, event))
 		return NULL;
 
 	event->destroy = tp_perf_event_destroy;
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 0565bb4..89b780a 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -27,13 +27,15 @@ typedef typeof(unsigned long [PERF_MAX_TRACE_SIZE / sizeof(unsigned long)])
 /* Count the events in use (per event id, not per instance) */
 static int	total_ref_count;
 
-static int perf_trace_event_enable(struct ftrace_event_call *event)
+static int perf_trace_event_enable(struct ftrace_event_call *event, void *data)
 {
 	char *buf;
 	int ret = -ENOMEM;
 
-	if (event->perf_refcount++ > 0)
+	if (event->perf_refcount++ > 0) {
+		event->perf_data = NULL;
 		return 0;
+	}
 
 	if (!total_ref_count) {
 		buf = (char *)alloc_percpu(perf_trace_t);
@@ -51,6 +53,7 @@ static int perf_trace_event_enable(struct ftrace_event_call *event)
 
 	ret = event->perf_event_enable(event);
 	if (!ret) {
+		event->perf_data = data;
 		total_ref_count++;
 		return 0;
 	}
@@ -68,7 +71,7 @@ fail_buf:
 	return ret;
 }
 
-int perf_trace_enable(int event_id)
+int perf_trace_enable(int event_id, void *data)
 {
 	struct ftrace_event_call *event;
 	int ret = -EINVAL;
@@ -77,7 +80,7 @@ int perf_trace_enable(int event_id)
 	list_for_each_entry(event, &ftrace_events, list) {
 		if (event->id == event_id && event->perf_event_enable &&
 		    try_module_get(event->mod)) {
-			ret = perf_trace_event_enable(event);
+			ret = perf_trace_event_enable(event, data);
 			break;
 		}
 	}
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a751432..2d7bf41 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1362,7 +1362,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
 	for (i = 0; i < tp->nr_args; i++)
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
-	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs);
+	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs, call->perf_data);
 }
 
 /* Kretprobe profile handler */
@@ -1395,7 +1395,7 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
 	perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1,
-			       irq_flags, regs);
+			       irq_flags, regs, call->perf_data);
 }
 
 static int probe_perf_enable(struct ftrace_event_call *call)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 4d6d711..9eff1a4 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -468,7 +468,8 @@ static void perf_syscall_enter(struct pt_regs *regs, long id)
 	rec->nr = syscall_nr;
 	syscall_get_arguments(current, regs, 0, sys_data->nb_args,
 			       (unsigned long *)&rec->args);
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs);
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+			sys_data->enter_event->perf_data);
 }
 
 int perf_sysenter_enable(struct ftrace_event_call *call)
@@ -543,7 +544,8 @@ static void perf_syscall_exit(struct pt_regs *regs, long ret)
 	rec->nr = syscall_nr;
 	rec->ret = syscall_get_return_value(current, regs);
 
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs);
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+			sys_data->exit_event->perf_data);
 }
 
 int perf_sysexit_enable(struct ftrace_event_call *call)

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

* [tip:perf/core] perf: Disallow mmap() on per-task inherited events
       [not found]             ` <new-submission>
                                 ` (531 preceding siblings ...)
  2010-05-18 17:15               ` [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events tip-bot for Peter Zijlstra
@ 2010-05-18 17:16               ` tip-bot for Peter Zijlstra
  2010-05-18 17:16               ` [tip:perf/core] perf: Optimize the perf_output() path by removing IRQ-disables tip-bot for Peter Zijlstra
                                 ` (173 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-18 17:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  c7920614cebbf269a7c8397ff959a8dcf727465c
Gitweb:     http://git.kernel.org/tip/c7920614cebbf269a7c8397ff959a8dcf727465c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 18 May 2010 10:33:24 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:48 +0200

perf: Disallow mmap() on per-task inherited events

Since we now have working per-task-per-cpu events for
a while, disallow mmap() on per-task inherited
events. Those things were a performance problem
anyway, and doing away with it allows us to optimize
the buffer somewhat by assuming there is only a
single writer.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 6ae6218..ff5d430 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2593,6 +2593,14 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	long user_extra, extra;
 	int ret = 0;
 
+	/*
+	 * Don't allow mmap() of inherited per-task counters. This would
+	 * create a performance issue due to all children writing to the
+	 * same buffer.
+	 */
+	if (event->cpu == -1 && event->attr.inherit)
+		return -EINVAL;
+
 	if (!(vma->vm_flags & VM_SHARED))
 		return -EINVAL;
 

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

* [tip:perf/core] perf: Optimize the perf_output() path by removing IRQ-disables
       [not found]             ` <new-submission>
                                 ` (532 preceding siblings ...)
  2010-05-18 17:16               ` [tip:perf/core] perf: Disallow mmap() on per-task inherited events tip-bot for Peter Zijlstra
@ 2010-05-18 17:16               ` tip-bot for Peter Zijlstra
  2010-05-18 17:17               ` [tip:perf/core] perf: Optimize the hotpath by converting the perf output buffer to local_t tip-bot for Peter Zijlstra
                                 ` (172 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-18 17:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, tglx, mingo

Commit-ID:  ef60777c9abd999db5eb4e338aae3eb593ae8e10
Gitweb:     http://git.kernel.org/tip/ef60777c9abd999db5eb4e338aae3eb593ae8e10
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 18 May 2010 10:50:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:48 +0200

perf: Optimize the perf_output() path by removing IRQ-disables

Since we can now assume there is only a single writer
to each buffer, we can remove per-cpu lock thingy and
use a simply nest-count to the same effect.

This removes the need to disable IRQs.

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>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    5 +-
 kernel/perf_event.c        |   94 +++++++++++++-------------------------------
 2 files changed, 30 insertions(+), 69 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 0b521fc..f1f853a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -597,12 +597,12 @@ struct perf_mmap_data {
 	atomic_t			events;		/* event_id limit       */
 
 	atomic_long_t			head;		/* write position    */
-	atomic_long_t			done_head;	/* completed head    */
 
-	atomic_t			lock;		/* concurrent writes */
 	atomic_t			wakeup;		/* needs a wakeup    */
 	atomic_t			lost;		/* nr records lost   */
 
+	atomic_t			nest;		/* nested writers    */
+
 	long				watermark;	/* wakeup watermark  */
 
 	struct perf_event_mmap_page	*user_page;
@@ -807,7 +807,6 @@ struct perf_output_handle {
 	unsigned long			offset;
 	int				nmi;
 	int				sample;
-	int				locked;
 };
 
 #ifdef CONFIG_PERF_EVENTS
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index ff5d430..8cf737d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2519,8 +2519,6 @@ perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
 {
 	long max_size = perf_data_size(data);
 
-	atomic_set(&data->lock, -1);
-
 	if (event->attr.watermark) {
 		data->watermark = min_t(long, max_size,
 					event->attr.wakeup_watermark);
@@ -2906,82 +2904,56 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
 }
 
 /*
- * Curious locking construct.
- *
  * We need to ensure a later event_id doesn't publish a head when a former
- * event_id isn't done writing. However since we need to deal with NMIs we
+ * event isn't done writing. However since we need to deal with NMIs we
  * cannot fully serialize things.
  *
- * What we do is serialize between CPUs so we only have to deal with NMI
- * nesting on a single CPU.
- *
  * We only publish the head (and generate a wakeup) when the outer-most
- * event_id completes.
+ * event completes.
  */
-static void perf_output_lock(struct perf_output_handle *handle)
+static void perf_output_get_handle(struct perf_output_handle *handle)
 {
 	struct perf_mmap_data *data = handle->data;
-	int cur, cpu = get_cpu();
 
-	handle->locked = 0;
-
-	for (;;) {
-		cur = atomic_cmpxchg(&data->lock, -1, cpu);
-		if (cur == -1) {
-			handle->locked = 1;
-			break;
-		}
-		if (cur == cpu)
-			break;
-
-		cpu_relax();
-	}
+	preempt_disable();
+	atomic_inc(&data->nest);
 }
 
-static void perf_output_unlock(struct perf_output_handle *handle)
+static void perf_output_put_handle(struct perf_output_handle *handle)
 {
 	struct perf_mmap_data *data = handle->data;
 	unsigned long head;
-	int cpu;
-
-	data->done_head = data->head;
-
-	if (!handle->locked)
-		goto out;
 
 again:
-	/*
-	 * The xchg implies a full barrier that ensures all writes are done
-	 * before we publish the new head, matched by a rmb() in userspace when
-	 * reading this position.
-	 */
-	while ((head = atomic_long_xchg(&data->done_head, 0)))
-		data->user_page->data_head = head;
+	head = atomic_long_read(&data->head);
 
 	/*
-	 * NMI can happen here, which means we can miss a done_head update.
+	 * IRQ/NMI can happen here, which means we can miss a head update.
 	 */
 
-	cpu = atomic_xchg(&data->lock, -1);
-	WARN_ON_ONCE(cpu != smp_processor_id());
+	if (!atomic_dec_and_test(&data->nest))
+		return;
 
 	/*
-	 * Therefore we have to validate we did not indeed do so.
+	 * Publish the known good head. Rely on the full barrier implied
+	 * by atomic_dec_and_test() order the data->head read and this
+	 * write.
 	 */
-	if (unlikely(atomic_long_read(&data->done_head))) {
-		/*
-		 * Since we had it locked, we can lock it again.
-		 */
-		while (atomic_cmpxchg(&data->lock, -1, cpu) != -1)
-			cpu_relax();
+	data->user_page->data_head = head;
 
+	/*
+	 * Now check if we missed an update, rely on the (compiler)
+	 * barrier in atomic_dec_and_test() to re-read data->head.
+	 */
+	if (unlikely(head != atomic_long_read(&data->head))) {
+		atomic_inc(&data->nest);
 		goto again;
 	}
 
 	if (atomic_xchg(&data->wakeup, 0))
 		perf_output_wakeup(handle);
-out:
-	put_cpu();
+
+	preempt_enable();
 }
 
 void perf_output_copy(struct perf_output_handle *handle,
@@ -3063,7 +3035,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 	if (have_lost)
 		size += sizeof(lost_event);
 
-	perf_output_lock(handle);
+	perf_output_get_handle(handle);
 
 	do {
 		/*
@@ -3083,7 +3055,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 	handle->head	= head;
 
 	if (head - tail > data->watermark)
-		atomic_set(&data->wakeup, 1);
+		atomic_inc(&data->wakeup);
 
 	if (have_lost) {
 		lost_event.header.type = PERF_RECORD_LOST;
@@ -3099,7 +3071,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 
 fail:
 	atomic_inc(&data->lost);
-	perf_output_unlock(handle);
+	perf_output_put_handle(handle);
 out:
 	rcu_read_unlock();
 
@@ -3117,11 +3089,11 @@ void perf_output_end(struct perf_output_handle *handle)
 		int events = atomic_inc_return(&data->events);
 		if (events >= wakeup_events) {
 			atomic_sub(wakeup_events, &data->events);
-			atomic_set(&data->wakeup, 1);
+			atomic_inc(&data->wakeup);
 		}
 	}
 
-	perf_output_unlock(handle);
+	perf_output_put_handle(handle);
 	rcu_read_unlock();
 }
 
@@ -3457,22 +3429,13 @@ static void perf_event_task_output(struct perf_event *event,
 {
 	struct perf_output_handle handle;
 	struct task_struct *task = task_event->task;
-	unsigned long flags;
 	int size, ret;
 
-	/*
-	 * If this CPU attempts to acquire an rq lock held by a CPU spinning
-	 * in perf_output_lock() from interrupt context, it's game over.
-	 */
-	local_irq_save(flags);
-
 	size  = task_event->event_id.header.size;
 	ret = perf_output_begin(&handle, event, size, 0, 0);
 
-	if (ret) {
-		local_irq_restore(flags);
+	if (ret)
 		return;
-	}
 
 	task_event->event_id.pid = perf_event_pid(event, task);
 	task_event->event_id.ppid = perf_event_pid(event, current);
@@ -3483,7 +3446,6 @@ static void perf_event_task_output(struct perf_event *event,
 	perf_output_put(&handle, task_event->event_id);
 
 	perf_output_end(&handle);
-	local_irq_restore(flags);
 }
 
 static int perf_event_task_match(struct perf_event *event)

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

* [tip:perf/core] perf: Optimize the hotpath by converting the perf output buffer to local_t
       [not found]             ` <new-submission>
                                 ` (533 preceding siblings ...)
  2010-05-18 17:16               ` [tip:perf/core] perf: Optimize the perf_output() path by removing IRQ-disables tip-bot for Peter Zijlstra
@ 2010-05-18 17:17               ` tip-bot for Peter Zijlstra
  2010-05-18 17:17               ` [tip:perf/core] perf: Optimize perf_output_*() by avoiding local_xchg() tip-bot for Peter Zijlstra
                                 ` (171 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-18 17:17 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  fa5881514ef9c9bcb29319aad85cf2d8889d91f1
Gitweb:     http://git.kernel.org/tip/fa5881514ef9c9bcb29319aad85cf2d8889d91f1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 18 May 2010 10:54:20 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:49 +0200

perf: Optimize the hotpath by converting the perf output buffer to local_t

Since there is now only a single writer, we can use
local_t instead and avoid all these pesky LOCK insn.

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_event.h |   15 +++++++--------
 kernel/perf_event.c        |   30 +++++++++++++++---------------
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f1f853a..ce76676 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -485,6 +485,7 @@ struct perf_guest_info_callbacks {
 #include <linux/ftrace.h>
 #include <linux/cpu.h>
 #include <asm/atomic.h>
+#include <asm/local.h>
 
 #define PERF_MAX_STACK_DEPTH		255
 
@@ -588,20 +589,18 @@ struct perf_mmap_data {
 #ifdef CONFIG_PERF_USE_VMALLOC
 	struct work_struct		work;
 #endif
-	int				data_order;
+	int				data_order;	/* allocation order  */
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
-	atomic_t			events;		/* event_id limit       */
 
-	atomic_long_t			head;		/* write position    */
-
-	atomic_t			wakeup;		/* needs a wakeup    */
-	atomic_t			lost;		/* nr records lost   */
-
-	atomic_t			nest;		/* nested writers    */
+	local_t				head;		/* write position    */
+	local_t				nest;		/* nested writers    */
+	local_t				events;		/* event limit       */
+	local_t				wakeup;		/* needs a wakeup    */
+	local_t				lost;		/* nr records lost   */
 
 	long				watermark;	/* wakeup watermark  */
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 8cf737d..1f98c78 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2916,7 +2916,7 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
 	struct perf_mmap_data *data = handle->data;
 
 	preempt_disable();
-	atomic_inc(&data->nest);
+	local_inc(&data->nest);
 }
 
 static void perf_output_put_handle(struct perf_output_handle *handle)
@@ -2925,13 +2925,13 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
 	unsigned long head;
 
 again:
-	head = atomic_long_read(&data->head);
+	head = local_read(&data->head);
 
 	/*
 	 * IRQ/NMI can happen here, which means we can miss a head update.
 	 */
 
-	if (!atomic_dec_and_test(&data->nest))
+	if (!local_dec_and_test(&data->nest))
 		return;
 
 	/*
@@ -2945,12 +2945,12 @@ again:
 	 * Now check if we missed an update, rely on the (compiler)
 	 * barrier in atomic_dec_and_test() to re-read data->head.
 	 */
-	if (unlikely(head != atomic_long_read(&data->head))) {
-		atomic_inc(&data->nest);
+	if (unlikely(head != local_read(&data->head))) {
+		local_inc(&data->nest);
 		goto again;
 	}
 
-	if (atomic_xchg(&data->wakeup, 0))
+	if (local_xchg(&data->wakeup, 0))
 		perf_output_wakeup(handle);
 
 	preempt_enable();
@@ -3031,7 +3031,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 	if (!data->nr_pages)
 		goto out;
 
-	have_lost = atomic_read(&data->lost);
+	have_lost = local_read(&data->lost);
 	if (have_lost)
 		size += sizeof(lost_event);
 
@@ -3045,24 +3045,24 @@ int perf_output_begin(struct perf_output_handle *handle,
 		 */
 		tail = ACCESS_ONCE(data->user_page->data_tail);
 		smp_rmb();
-		offset = head = atomic_long_read(&data->head);
+		offset = head = local_read(&data->head);
 		head += size;
 		if (unlikely(!perf_output_space(data, tail, offset, head)))
 			goto fail;
-	} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
+	} while (local_cmpxchg(&data->head, offset, head) != offset);
 
 	handle->offset	= offset;
 	handle->head	= head;
 
 	if (head - tail > data->watermark)
-		atomic_inc(&data->wakeup);
+		local_inc(&data->wakeup);
 
 	if (have_lost) {
 		lost_event.header.type = PERF_RECORD_LOST;
 		lost_event.header.misc = 0;
 		lost_event.header.size = sizeof(lost_event);
 		lost_event.id          = event->id;
-		lost_event.lost        = atomic_xchg(&data->lost, 0);
+		lost_event.lost        = local_xchg(&data->lost, 0);
 
 		perf_output_put(handle, lost_event);
 	}
@@ -3070,7 +3070,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 	return 0;
 
 fail:
-	atomic_inc(&data->lost);
+	local_inc(&data->lost);
 	perf_output_put_handle(handle);
 out:
 	rcu_read_unlock();
@@ -3086,10 +3086,10 @@ void perf_output_end(struct perf_output_handle *handle)
 	int wakeup_events = event->attr.wakeup_events;
 
 	if (handle->sample && wakeup_events) {
-		int events = atomic_inc_return(&data->events);
+		int events = local_inc_return(&data->events);
 		if (events >= wakeup_events) {
-			atomic_sub(wakeup_events, &data->events);
-			atomic_inc(&data->wakeup);
+			local_sub(wakeup_events, &data->events);
+			local_inc(&data->wakeup);
 		}
 	}
 

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

* [tip:perf/core] perf: Optimize perf_output_*() by avoiding local_xchg()
       [not found]             ` <new-submission>
                                 ` (534 preceding siblings ...)
  2010-05-18 17:17               ` [tip:perf/core] perf: Optimize the hotpath by converting the perf output buffer to local_t tip-bot for Peter Zijlstra
@ 2010-05-18 17:17               ` tip-bot for Peter Zijlstra
  2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races and clean up perf_event and perf_mmap_data interaction tip-bot for Peter Zijlstra
                                 ` (170 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-18 17:17 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  6d1acfd5c6bfd5231c13a8f2858d7f2afbaa1b62
Gitweb:     http://git.kernel.org/tip/6d1acfd5c6bfd5231c13a8f2858d7f2afbaa1b62
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 18 May 2010 11:12:48 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 May 2010 18:35:49 +0200

perf: Optimize perf_output_*() by avoiding local_xchg()

Since the x86 XCHG ins implies LOCK, avoid the use by
using a sequence count instead.

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_event.h |    1 +
 kernel/perf_event.c        |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ce76676..fe50347 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -804,6 +804,7 @@ struct perf_output_handle {
 	struct perf_mmap_data		*data;
 	unsigned long			head;
 	unsigned long			offset;
+	unsigned long			wakeup;
 	int				nmi;
 	int				sample;
 };
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 1f98c78..7e3bcf1 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2917,6 +2917,7 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
 
 	preempt_disable();
 	local_inc(&data->nest);
+	handle->wakeup = local_read(&data->wakeup);
 }
 
 static void perf_output_put_handle(struct perf_output_handle *handle)
@@ -2950,7 +2951,7 @@ again:
 		goto again;
 	}
 
-	if (local_xchg(&data->wakeup, 0))
+	if (handle->wakeup != local_read(&data->wakeup))
 		perf_output_wakeup(handle);
 
 	preempt_enable();

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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-18 17:15               ` [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events tip-bot for Peter Zijlstra
@ 2010-05-19  7:58                 ` Frederic Weisbecker
  2010-05-19  8:18                   ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2010-05-19  7:58 UTC (permalink / raw)
  To: mingo, hpa, paulus, acme, linux-kernel, a.p.zijlstra, efault,
	rostedt, tglx, mingo
  Cc: linux-tip-commits

On Tue, May 18, 2010 at 05:15:42PM +0000, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  4f41c013f553957765902fb01475972f0af3e8e7
> Gitweb:     http://git.kernel.org/tip/4f41c013f553957765902fb01475972f0af3e8e7
> Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Tue, 18 May 2010 18:08:32 +0200
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Tue, 18 May 2010 18:35:46 +0200
> 
> perf/ftrace: Optimize perf/tracepoint interaction for single events
> 
> When we've got but a single event per tracepoint
> there is no reason to try and multiplex it so don't.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Tested-by: Ingo Molnar <mingo@elte.hu>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> 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>
> ---


I haven't seen this patch going.

But yeah that's a nice optimization for UP machines.


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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  7:58                 ` Frederic Weisbecker
@ 2010-05-19  8:18                   ` Peter Zijlstra
  2010-05-19  8:23                     ` Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-05-19  8:18 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, 2010-05-19 at 09:58 +0200, Frederic Weisbecker wrote:
> On Tue, May 18, 2010 at 05:15:42PM +0000, tip-bot for Peter Zijlstra wrote:
> > Commit-ID:  4f41c013f553957765902fb01475972f0af3e8e7
> > Gitweb:     http://git.kernel.org/tip/4f41c013f553957765902fb01475972f0af3e8e7
> > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > AuthorDate: Tue, 18 May 2010 18:08:32 +0200
> > Committer:  Ingo Molnar <mingo@elte.hu>
> > CommitDate: Tue, 18 May 2010 18:35:46 +0200
> > 
> > perf/ftrace: Optimize perf/tracepoint interaction for single events
> > 
> > When we've got but a single event per tracepoint
> > there is no reason to try and multiplex it so don't.
> > 

> I haven't seen this patch going.
> 
> But yeah that's a nice optimization for UP machines.

Uhm, doesn't have anything to do with UP machines... it works quite well
on SMP as well.

Its about tracepoints with a single event attached.

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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  8:18                   ` Peter Zijlstra
@ 2010-05-19  8:23                     ` Frederic Weisbecker
  2010-05-19  8:31                       ` Peter Zijlstra
  2010-05-19  8:58                       ` Peter Zijlstra
  0 siblings, 2 replies; 1150+ messages in thread
From: Frederic Weisbecker @ 2010-05-19  8:23 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, May 19, 2010 at 10:18:43AM +0200, Peter Zijlstra wrote:
> On Wed, 2010-05-19 at 09:58 +0200, Frederic Weisbecker wrote:
> > On Tue, May 18, 2010 at 05:15:42PM +0000, tip-bot for Peter Zijlstra wrote:
> > > Commit-ID:  4f41c013f553957765902fb01475972f0af3e8e7
> > > Gitweb:     http://git.kernel.org/tip/4f41c013f553957765902fb01475972f0af3e8e7
> > > Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > AuthorDate: Tue, 18 May 2010 18:08:32 +0200
> > > Committer:  Ingo Molnar <mingo@elte.hu>
> > > CommitDate: Tue, 18 May 2010 18:35:46 +0200
> > > 
> > > perf/ftrace: Optimize perf/tracepoint interaction for single events
> > > 
> > > When we've got but a single event per tracepoint
> > > there is no reason to try and multiplex it so don't.
> > > 
> 
> > I haven't seen this patch going.
> > 
> > But yeah that's a nice optimization for UP machines.
> 
> Uhm, doesn't have anything to do with UP machines... it works quite well
> on SMP as well.
> 
> Its about tracepoints with a single event attached.


Yeah, then if you launch perf sched for example, you'll have NR_CPU perf events
attached to each lock trace events, since we create one event per cpu.

Or may be I'm somewhat confused...


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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  8:23                     ` Frederic Weisbecker
@ 2010-05-19  8:31                       ` Peter Zijlstra
  2010-05-19  8:58                       ` Peter Zijlstra
  1 sibling, 0 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2010-05-19  8:31 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, 2010-05-19 at 10:23 +0200, Frederic Weisbecker wrote:

> Yeah, then if you launch perf sched for example, you'll have NR_CPU perf events
> attached to each lock trace events, since we create one event per cpu.

Right, but simple per task (non-inherited) would have only 1.

But yeah, plenty of room to improve here.

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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  8:23                     ` Frederic Weisbecker
  2010-05-19  8:31                       ` Peter Zijlstra
@ 2010-05-19  8:58                       ` Peter Zijlstra
  2010-05-19  9:06                         ` Frederic Weisbecker
  2010-05-21 11:27                         ` [tip:perf/core] perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction tip-bot for Peter Zijlstra
  1 sibling, 2 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2010-05-19  8:58 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

How about something like the below?


---
Subject: perf, trace: Remove IRQ-disable from perf/tracepoint interaction
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Wed May 19 10:52:27 CEST 2010



Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 include/linux/ftrace_event.h    |    9 +----
 include/trace/ftrace.h          |   17 ++++------
 kernel/trace/trace_event_perf.c |   67 ++++++++++++++++------------------------
 kernel/trace/trace_kprobe.c     |   10 ++---
 kernel/trace/trace_syscalls.c   |   10 ++---
 5 files changed, 46 insertions(+), 67 deletions(-)

Index: linux-2.6/include/linux/ftrace_event.h
===================================================================
--- linux-2.6.orig/include/linux/ftrace_event.h
+++ linux-2.6/include/linux/ftrace_event.h
@@ -197,20 +197,17 @@ extern void perf_trace_disable(int event
 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
 				     char *filter_str);
 extern void ftrace_profile_free_filter(struct perf_event *event);
-extern void *
-perf_trace_buf_prepare(int size, unsigned short type, int *rctxp,
-			 unsigned long *irq_flags);
+extern void *perf_trace_buf_prepare(int size, unsigned short type,
+				    struct pt_regs *regs, int *rctxp);
 
 static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
-		       u64 count, unsigned long irq_flags, struct pt_regs *regs,
-		       void *event)
+		       u64 count, struct pt_regs *regs, void *event)
 {
 	struct trace_entry *entry = raw_data;
 
 	perf_tp_event(entry->type, addr, count, raw_data, size, regs, event);
 	perf_swevent_put_recursion_context(rctx);
-	local_irq_restore(irq_flags);
 }
 #endif
 
Index: linux-2.6/include/trace/ftrace.h
===================================================================
--- linux-2.6.orig/include/trace/ftrace.h
+++ linux-2.6/include/trace/ftrace.h
@@ -768,7 +768,6 @@ perf_trace_templ_##call(struct ftrace_ev
 	struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
 	struct ftrace_raw_##call *entry;				\
 	u64 __addr = 0, __count = 1;					\
-	unsigned long irq_flags;					\
 	int __entry_size;						\
 	int __data_size;						\
 	int rctx;							\
@@ -781,17 +780,18 @@ perf_trace_templ_##call(struct ftrace_ev
 	if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE,		\
 		      "profile buffer not large enough"))		\
 		return;							\
+									\
 	entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare(	\
-		__entry_size, event_call->id, &rctx, &irq_flags);	\
+		__entry_size, event_call->id, __regs, &rctx);		\
 	if (!entry)							\
 		return;							\
+									\
 	tstruct								\
 									\
 	{ assign; }							\
 									\
 	perf_trace_buf_submit(entry, __entry_size, rctx, __addr,	\
-			       __count, irq_flags, __regs, 		\
-			      event_call->perf_data);			\
+			       __count, __regs, event_call->perf_data);	\
 }
 
 #undef DEFINE_EVENT
@@ -799,13 +799,10 @@ perf_trace_templ_##call(struct ftrace_ev
 static notrace void perf_trace_##call(proto)				\
 {									\
 	struct ftrace_event_call *event_call = &event_##call;		\
-	struct pt_regs *__regs = &get_cpu_var(perf_trace_regs);		\
-									\
-	perf_fetch_caller_regs(__regs, 1);				\
-									\
-	perf_trace_templ_##template(event_call, __regs, args);		\
+	struct pt_regs __regs;						\
 									\
-	put_cpu_var(perf_trace_regs);					\
+	perf_fetch_caller_regs(&__regs, 1);				\
+	perf_trace_templ_##template(event_call, &__regs, args);		\
 }
 
 #undef DEFINE_EVENT_PRINT
Index: linux-2.6/kernel/trace/trace_event_perf.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_event_perf.c
+++ linux-2.6/kernel/trace/trace_event_perf.c
@@ -9,13 +9,9 @@
 #include <linux/kprobes.h>
 #include "trace.h"
 
-DEFINE_PER_CPU(struct pt_regs, perf_trace_regs);
-EXPORT_PER_CPU_SYMBOL_GPL(perf_trace_regs);
-
 EXPORT_SYMBOL_GPL(perf_arch_fetch_caller_regs);
 
-static char *perf_trace_buf;
-static char *perf_trace_buf_nmi;
+static char *perf_trace_buf[4];
 
 /*
  * Force it to be aligned to unsigned long to avoid misaligned accesses
@@ -38,17 +34,16 @@ static int perf_trace_event_enable(struc
 	}
 
 	if (!total_ref_count) {
-		buf = (char *)alloc_percpu(perf_trace_t);
-		if (!buf)
-			goto fail_buf;
-
-		rcu_assign_pointer(perf_trace_buf, buf);
+		char *buf;
+		int i;
 
-		buf = (char *)alloc_percpu(perf_trace_t);
-		if (!buf)
-			goto fail_buf_nmi;
+		for (i = 0; i < 4; i++) {
+			buf = (char *)alloc_percpu(perf_trace_t);
+			if (!buf)
+				goto fail_buf;
 
-		rcu_assign_pointer(perf_trace_buf_nmi, buf);
+			rcu_assign_pointer(perf_trace_buf[i], buf);
+		}
 	}
 
 	ret = event->perf_event_enable(event);
@@ -60,10 +55,12 @@ static int perf_trace_event_enable(struc
 
 fail_buf_nmi:
 	if (!total_ref_count) {
-		free_percpu(perf_trace_buf_nmi);
-		free_percpu(perf_trace_buf);
-		perf_trace_buf_nmi = NULL;
-		perf_trace_buf = NULL;
+		int i;
+
+		for (i = 0; i < 4; i++) {
+			free_percpu(perf_trace_buf[i]);
+			perf_trace_buf[i] = NULL;
+		}
 	}
 fail_buf:
 	event->perf_refcount--;
@@ -99,11 +96,13 @@ static void perf_trace_event_disable(str
 	event->perf_event_disable(event);
 
 	if (!--total_ref_count) {
-		buf = perf_trace_buf;
-		rcu_assign_pointer(perf_trace_buf, NULL);
+		char *buf[4];
+		int i;
 
-		nmi_buf = perf_trace_buf_nmi;
-		rcu_assign_pointer(perf_trace_buf_nmi, NULL);
+		for (i = 0; i < 4; i++) {
+			buf[i] = perf_trace_buf[i];
+			rcu_assign_pointer(perf_trace_buf[i], NULL);
+		}
 
 		/*
 		 * Ensure every events in profiling have finished before
@@ -111,8 +110,8 @@ static void perf_trace_event_disable(str
 		 */
 		synchronize_sched();
 
-		free_percpu(buf);
-		free_percpu(nmi_buf);
+		for (i = 0; i < 4; i++)
+			free_percpu(buf[i]);
 	}
 }
 
@@ -132,47 +131,37 @@ void perf_trace_disable(int event_id)
 }
 
 __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
-				       int *rctxp, unsigned long *irq_flags)
+				       struct pt_regs *regs, int *rctxp)
 {
 	struct trace_entry *entry;
 	char *trace_buf, *raw_data;
-	int pc, cpu;
+	int pc;
 
 	BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(unsigned long));
 
 	pc = preempt_count();
 
-	/* Protect the per cpu buffer, begin the rcu read side */
-	local_irq_save(*irq_flags);
-
 	*rctxp = perf_swevent_get_recursion_context();
 	if (*rctxp < 0)
 		goto err_recursion;
 
-	cpu = smp_processor_id();
-
-	if (in_nmi())
-		trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
-	else
-		trace_buf = rcu_dereference_sched(perf_trace_buf);
-
+	trace_buf = rcu_dereference_sched(perf_trace_buf[*rctxp]);
 	if (!trace_buf)
 		goto err;
 
-	raw_data = per_cpu_ptr(trace_buf, cpu);
+	raw_data = per_cpu_ptr(trace_buf, smp_processor_id());
 
 	/* zero the dead bytes from align to not leak stack to user */
 	memset(&raw_data[size - sizeof(u64)], 0, sizeof(u64));
 
 	entry = (struct trace_entry *)raw_data;
-	tracing_generic_entry_update(entry, *irq_flags, pc);
+	tracing_generic_entry_update(entry, regs->flags, pc);
 	entry->type = type;
 
 	return raw_data;
 err:
 	perf_swevent_put_recursion_context(*rctxp);
 err_recursion:
-	local_irq_restore(*irq_flags);
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(perf_trace_buf_prepare);
Index: linux-2.6/kernel/trace/trace_kprobe.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_kprobe.c
+++ linux-2.6/kernel/trace/trace_kprobe.c
@@ -1343,7 +1343,6 @@ static __kprobes void kprobe_perf_func(s
 	struct kprobe_trace_entry_head *entry;
 	u8 *data;
 	int size, __size, i;
-	unsigned long irq_flags;
 	int rctx;
 
 	__size = sizeof(*entry) + tp->size;
@@ -1353,7 +1352,7 @@ static __kprobes void kprobe_perf_func(s
 		     "profile buffer not large enough"))
 		return;
 
-	entry = perf_trace_buf_prepare(size, call->id, &rctx, &irq_flags);
+	entry = perf_trace_buf_prepare(size, call->id, regs, &rctx);
 	if (!entry)
 		return;
 
@@ -1362,7 +1361,7 @@ static __kprobes void kprobe_perf_func(s
 	for (i = 0; i < tp->nr_args; i++)
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
-	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs, call->perf_data);
+	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, call->perf_data);
 }
 
 /* Kretprobe profile handler */
@@ -1374,7 +1373,6 @@ static __kprobes void kretprobe_perf_fun
 	struct kretprobe_trace_entry_head *entry;
 	u8 *data;
 	int size, __size, i;
-	unsigned long irq_flags;
 	int rctx;
 
 	__size = sizeof(*entry) + tp->size;
@@ -1384,7 +1382,7 @@ static __kprobes void kretprobe_perf_fun
 		     "profile buffer not large enough"))
 		return;
 
-	entry = perf_trace_buf_prepare(size, call->id, &rctx, &irq_flags);
+	entry = perf_trace_buf_prepare(size, call->id, regs, &rctx);
 	if (!entry)
 		return;
 
@@ -1395,7 +1393,7 @@ static __kprobes void kretprobe_perf_fun
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
 	perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1,
-			       irq_flags, regs, call->perf_data);
+			      regs, call->perf_data);
 }
 
 static int probe_perf_enable(struct ftrace_event_call *call)
Index: linux-2.6/kernel/trace/trace_syscalls.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_syscalls.c
+++ linux-2.6/kernel/trace/trace_syscalls.c
@@ -438,7 +438,6 @@ static void perf_syscall_enter(struct pt
 {
 	struct syscall_metadata *sys_data;
 	struct syscall_trace_enter *rec;
-	unsigned long flags;
 	int syscall_nr;
 	int rctx;
 	int size;
@@ -461,14 +460,14 @@ static void perf_syscall_enter(struct pt
 		return;
 
 	rec = (struct syscall_trace_enter *)perf_trace_buf_prepare(size,
-				sys_data->enter_event->id, &rctx, &flags);
+				sys_data->enter_event->id, regs, &rctx);
 	if (!rec)
 		return;
 
 	rec->nr = syscall_nr;
 	syscall_get_arguments(current, regs, 0, sys_data->nb_args,
 			       (unsigned long *)&rec->args);
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, regs,
 			sys_data->enter_event->perf_data);
 }
 
@@ -511,7 +510,6 @@ static void perf_syscall_exit(struct pt_
 {
 	struct syscall_metadata *sys_data;
 	struct syscall_trace_exit *rec;
-	unsigned long flags;
 	int syscall_nr;
 	int rctx;
 	int size;
@@ -537,14 +535,14 @@ static void perf_syscall_exit(struct pt_
 		return;
 
 	rec = (struct syscall_trace_exit *)perf_trace_buf_prepare(size,
-				sys_data->exit_event->id, &rctx, &flags);
+				sys_data->exit_event->id, regs, &rctx);
 	if (!rec)
 		return;
 
 	rec->nr = syscall_nr;
 	rec->ret = syscall_get_return_value(current, regs);
 
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, regs,
 			sys_data->exit_event->perf_data);
 }
 


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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  8:58                       ` Peter Zijlstra
@ 2010-05-19  9:06                         ` Frederic Weisbecker
  2010-05-19  9:12                           ` Peter Zijlstra
  2010-05-21 11:27                         ` [tip:perf/core] perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction tip-bot for Peter Zijlstra
  1 sibling, 1 reply; 1150+ messages in thread
From: Frederic Weisbecker @ 2010-05-19  9:06 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, May 19, 2010 at 10:58:45AM +0200, Peter Zijlstra wrote:
> How about something like the below?
> 
> 
> ---
> Subject: perf, trace: Remove IRQ-disable from perf/tracepoint interaction
> From: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Date: Wed May 19 10:52:27 CEST 2010
> 
> 
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---



Looks fine if we don't have nested irqs.


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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  9:06                         ` Frederic Weisbecker
@ 2010-05-19  9:12                           ` Peter Zijlstra
  2010-05-19  9:13                             ` Frederic Weisbecker
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-05-19  9:12 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, 2010-05-19 at 11:06 +0200, Frederic Weisbecker wrote:
> On Wed, May 19, 2010 at 10:58:45AM +0200, Peter Zijlstra wrote:
> > How about something like the below?
> > 
> > 
> > ---
> > Subject: perf, trace: Remove IRQ-disable from perf/tracepoint interaction
> > From: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Date: Wed May 19 10:52:27 CEST 2010
> > 
> > 
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > ---
> 
> 
> 
> Looks fine if we don't have nested irqs.

Well, I was thinking the per-context recursion thing would sort that
out. We can have 1 event per context in-flight.

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

* Re: [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events
  2010-05-19  9:12                           ` Peter Zijlstra
@ 2010-05-19  9:13                             ` Frederic Weisbecker
  0 siblings, 0 replies; 1150+ messages in thread
From: Frederic Weisbecker @ 2010-05-19  9:13 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, hpa, paulus, acme, linux-kernel, efault, rostedt, tglx,
	mingo, linux-tip-commits

On Wed, May 19, 2010 at 11:12:28AM +0200, Peter Zijlstra wrote:
> On Wed, 2010-05-19 at 11:06 +0200, Frederic Weisbecker wrote:
> > On Wed, May 19, 2010 at 10:58:45AM +0200, Peter Zijlstra wrote:
> > > How about something like the below?
> > > 
> > > 
> > > ---
> > > Subject: perf, trace: Remove IRQ-disable from perf/tracepoint interaction
> > > From: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > Date: Wed May 19 10:52:27 CEST 2010
> > > 
> > > 
> > > 
> > > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > ---
> > 
> > 
> > 
> > Looks fine if we don't have nested irqs.
> 
> Well, I was thinking the per-context recursion thing would sort that
> out. We can have 1 event per context in-flight.


Ah good point.


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

* [tip:perf/core] perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction
  2010-05-19  8:58                       ` Peter Zijlstra
  2010-05-19  9:06                         ` Frederic Weisbecker
@ 2010-05-21 11:27                         ` tip-bot for Peter Zijlstra
  1 sibling, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-21 11:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  b7e2ecef92d2e7785e6d76b41e5ba8bcbc45259d
Gitweb:     http://git.kernel.org/tip/b7e2ecef92d2e7785e6d76b41e5ba8bcbc45259d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 19 May 2010 10:52:27 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 21 May 2010 11:37:56 +0200

perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction

Improves performance.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1274259525.5605.10352.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/ftrace_event.h    |    9 ++---
 include/trace/ftrace.h          |   17 ++++-----
 kernel/trace/trace_event_perf.c |   73 +++++++++++++++-----------------------
 kernel/trace/trace_kprobe.c     |   10 ++---
 kernel/trace/trace_syscalls.c   |   10 ++---
 5 files changed, 47 insertions(+), 72 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index a9775dd..126071b 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -197,20 +197,17 @@ extern void perf_trace_disable(int event_id);
 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
 				     char *filter_str);
 extern void ftrace_profile_free_filter(struct perf_event *event);
-extern void *
-perf_trace_buf_prepare(int size, unsigned short type, int *rctxp,
-			 unsigned long *irq_flags);
+extern void *perf_trace_buf_prepare(int size, unsigned short type,
+				    struct pt_regs *regs, int *rctxp);
 
 static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
-		       u64 count, unsigned long irq_flags, struct pt_regs *regs,
-		       void *event)
+		       u64 count, struct pt_regs *regs, void *event)
 {
 	struct trace_entry *entry = raw_data;
 
 	perf_tp_event(entry->type, addr, count, raw_data, size, regs, event);
 	perf_swevent_put_recursion_context(rctx);
-	local_irq_restore(irq_flags);
 }
 #endif
 
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1016b21..f282885 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -768,7 +768,6 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call,		\
 	struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
 	struct ftrace_raw_##call *entry;				\
 	u64 __addr = 0, __count = 1;					\
-	unsigned long irq_flags;					\
 	int __entry_size;						\
 	int __data_size;						\
 	int rctx;							\
@@ -781,17 +780,18 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call,		\
 	if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE,		\
 		      "profile buffer not large enough"))		\
 		return;							\
+									\
 	entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare(	\
-		__entry_size, event_call->id, &rctx, &irq_flags);	\
+		__entry_size, event_call->id, __regs, &rctx);		\
 	if (!entry)							\
 		return;							\
+									\
 	tstruct								\
 									\
 	{ assign; }							\
 									\
 	perf_trace_buf_submit(entry, __entry_size, rctx, __addr,	\
-			       __count, irq_flags, __regs, 		\
-			      event_call->perf_data);			\
+			       __count, __regs, event_call->perf_data);	\
 }
 
 #undef DEFINE_EVENT
@@ -799,13 +799,10 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call,		\
 static notrace void perf_trace_##call(proto)				\
 {									\
 	struct ftrace_event_call *event_call = &event_##call;		\
-	struct pt_regs *__regs = &get_cpu_var(perf_trace_regs);		\
-									\
-	perf_fetch_caller_regs(__regs, 1);				\
-									\
-	perf_trace_templ_##template(event_call, __regs, args);		\
+	struct pt_regs __regs;						\
 									\
-	put_cpu_var(perf_trace_regs);					\
+	perf_fetch_caller_regs(&__regs, 1);				\
+	perf_trace_templ_##template(event_call, &__regs, args);		\
 }
 
 #undef DEFINE_EVENT_PRINT
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 89b780a..a1304f8 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -9,13 +9,9 @@
 #include <linux/kprobes.h>
 #include "trace.h"
 
-DEFINE_PER_CPU(struct pt_regs, perf_trace_regs);
-EXPORT_PER_CPU_SYMBOL_GPL(perf_trace_regs);
-
 EXPORT_SYMBOL_GPL(perf_arch_fetch_caller_regs);
 
-static char *perf_trace_buf;
-static char *perf_trace_buf_nmi;
+static char *perf_trace_buf[4];
 
 /*
  * Force it to be aligned to unsigned long to avoid misaligned accesses
@@ -29,7 +25,6 @@ static int	total_ref_count;
 
 static int perf_trace_event_enable(struct ftrace_event_call *event, void *data)
 {
-	char *buf;
 	int ret = -ENOMEM;
 
 	if (event->perf_refcount++ > 0) {
@@ -38,17 +33,16 @@ static int perf_trace_event_enable(struct ftrace_event_call *event, void *data)
 	}
 
 	if (!total_ref_count) {
-		buf = (char *)alloc_percpu(perf_trace_t);
-		if (!buf)
-			goto fail_buf;
-
-		rcu_assign_pointer(perf_trace_buf, buf);
+		char *buf;
+		int i;
 
-		buf = (char *)alloc_percpu(perf_trace_t);
-		if (!buf)
-			goto fail_buf_nmi;
+		for (i = 0; i < 4; i++) {
+			buf = (char *)alloc_percpu(perf_trace_t);
+			if (!buf)
+				goto fail_buf;
 
-		rcu_assign_pointer(perf_trace_buf_nmi, buf);
+			rcu_assign_pointer(perf_trace_buf[i], buf);
+		}
 	}
 
 	ret = event->perf_event_enable(event);
@@ -58,14 +52,15 @@ static int perf_trace_event_enable(struct ftrace_event_call *event, void *data)
 		return 0;
 	}
 
-fail_buf_nmi:
+fail_buf:
 	if (!total_ref_count) {
-		free_percpu(perf_trace_buf_nmi);
-		free_percpu(perf_trace_buf);
-		perf_trace_buf_nmi = NULL;
-		perf_trace_buf = NULL;
+		int i;
+
+		for (i = 0; i < 4; i++) {
+			free_percpu(perf_trace_buf[i]);
+			perf_trace_buf[i] = NULL;
+		}
 	}
-fail_buf:
 	event->perf_refcount--;
 
 	return ret;
@@ -91,19 +86,19 @@ int perf_trace_enable(int event_id, void *data)
 
 static void perf_trace_event_disable(struct ftrace_event_call *event)
 {
-	char *buf, *nmi_buf;
-
 	if (--event->perf_refcount > 0)
 		return;
 
 	event->perf_event_disable(event);
 
 	if (!--total_ref_count) {
-		buf = perf_trace_buf;
-		rcu_assign_pointer(perf_trace_buf, NULL);
+		char *buf[4];
+		int i;
 
-		nmi_buf = perf_trace_buf_nmi;
-		rcu_assign_pointer(perf_trace_buf_nmi, NULL);
+		for (i = 0; i < 4; i++) {
+			buf[i] = perf_trace_buf[i];
+			rcu_assign_pointer(perf_trace_buf[i], NULL);
+		}
 
 		/*
 		 * Ensure every events in profiling have finished before
@@ -111,8 +106,8 @@ static void perf_trace_event_disable(struct ftrace_event_call *event)
 		 */
 		synchronize_sched();
 
-		free_percpu(buf);
-		free_percpu(nmi_buf);
+		for (i = 0; i < 4; i++)
+			free_percpu(buf[i]);
 	}
 }
 
@@ -132,47 +127,37 @@ void perf_trace_disable(int event_id)
 }
 
 __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
-				       int *rctxp, unsigned long *irq_flags)
+				       struct pt_regs *regs, int *rctxp)
 {
 	struct trace_entry *entry;
 	char *trace_buf, *raw_data;
-	int pc, cpu;
+	int pc;
 
 	BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(unsigned long));
 
 	pc = preempt_count();
 
-	/* Protect the per cpu buffer, begin the rcu read side */
-	local_irq_save(*irq_flags);
-
 	*rctxp = perf_swevent_get_recursion_context();
 	if (*rctxp < 0)
 		goto err_recursion;
 
-	cpu = smp_processor_id();
-
-	if (in_nmi())
-		trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
-	else
-		trace_buf = rcu_dereference_sched(perf_trace_buf);
-
+	trace_buf = rcu_dereference_sched(perf_trace_buf[*rctxp]);
 	if (!trace_buf)
 		goto err;
 
-	raw_data = per_cpu_ptr(trace_buf, cpu);
+	raw_data = per_cpu_ptr(trace_buf, smp_processor_id());
 
 	/* zero the dead bytes from align to not leak stack to user */
 	memset(&raw_data[size - sizeof(u64)], 0, sizeof(u64));
 
 	entry = (struct trace_entry *)raw_data;
-	tracing_generic_entry_update(entry, *irq_flags, pc);
+	tracing_generic_entry_update(entry, regs->flags, pc);
 	entry->type = type;
 
 	return raw_data;
 err:
 	perf_swevent_put_recursion_context(*rctxp);
 err_recursion:
-	local_irq_restore(*irq_flags);
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(perf_trace_buf_prepare);
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 2d7bf41..20c96de 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1343,7 +1343,6 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
 	struct kprobe_trace_entry_head *entry;
 	u8 *data;
 	int size, __size, i;
-	unsigned long irq_flags;
 	int rctx;
 
 	__size = sizeof(*entry) + tp->size;
@@ -1353,7 +1352,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
 		     "profile buffer not large enough"))
 		return;
 
-	entry = perf_trace_buf_prepare(size, call->id, &rctx, &irq_flags);
+	entry = perf_trace_buf_prepare(size, call->id, regs, &rctx);
 	if (!entry)
 		return;
 
@@ -1362,7 +1361,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
 	for (i = 0; i < tp->nr_args; i++)
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
-	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs, call->perf_data);
+	perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, call->perf_data);
 }
 
 /* Kretprobe profile handler */
@@ -1374,7 +1373,6 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
 	struct kretprobe_trace_entry_head *entry;
 	u8 *data;
 	int size, __size, i;
-	unsigned long irq_flags;
 	int rctx;
 
 	__size = sizeof(*entry) + tp->size;
@@ -1384,7 +1382,7 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
 		     "profile buffer not large enough"))
 		return;
 
-	entry = perf_trace_buf_prepare(size, call->id, &rctx, &irq_flags);
+	entry = perf_trace_buf_prepare(size, call->id, regs, &rctx);
 	if (!entry)
 		return;
 
@@ -1395,7 +1393,7 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
 		call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
 
 	perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1,
-			       irq_flags, regs, call->perf_data);
+			      regs, call->perf_data);
 }
 
 static int probe_perf_enable(struct ftrace_event_call *call)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 9eff1a4..a657cef 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -438,7 +438,6 @@ static void perf_syscall_enter(struct pt_regs *regs, long id)
 {
 	struct syscall_metadata *sys_data;
 	struct syscall_trace_enter *rec;
-	unsigned long flags;
 	int syscall_nr;
 	int rctx;
 	int size;
@@ -461,14 +460,14 @@ static void perf_syscall_enter(struct pt_regs *regs, long id)
 		return;
 
 	rec = (struct syscall_trace_enter *)perf_trace_buf_prepare(size,
-				sys_data->enter_event->id, &rctx, &flags);
+				sys_data->enter_event->id, regs, &rctx);
 	if (!rec)
 		return;
 
 	rec->nr = syscall_nr;
 	syscall_get_arguments(current, regs, 0, sys_data->nb_args,
 			       (unsigned long *)&rec->args);
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, regs,
 			sys_data->enter_event->perf_data);
 }
 
@@ -511,7 +510,6 @@ static void perf_syscall_exit(struct pt_regs *regs, long ret)
 {
 	struct syscall_metadata *sys_data;
 	struct syscall_trace_exit *rec;
-	unsigned long flags;
 	int syscall_nr;
 	int rctx;
 	int size;
@@ -537,14 +535,14 @@ static void perf_syscall_exit(struct pt_regs *regs, long ret)
 		return;
 
 	rec = (struct syscall_trace_exit *)perf_trace_buf_prepare(size,
-				sys_data->exit_event->id, &rctx, &flags);
+				sys_data->exit_event->id, regs, &rctx);
 	if (!rec)
 		return;
 
 	rec->nr = syscall_nr;
 	rec->ret = syscall_get_return_value(current, regs);
 
-	perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
+	perf_trace_buf_submit(rec, size, rctx, 0, 1, regs,
 			sys_data->exit_event->perf_data);
 }
 

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

* [tip:perf/urgent] perf_events: Fix races and clean up perf_event and perf_mmap_data interaction
       [not found]             ` <new-submission>
                                 ` (535 preceding siblings ...)
  2010-05-18 17:17               ` [tip:perf/core] perf: Optimize perf_output_*() by avoiding local_xchg() tip-bot for Peter Zijlstra
@ 2010-05-31  7:19               ` tip-bot for Peter Zijlstra
  2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races in group composition tip-bot for Peter Zijlstra
                                 ` (169 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-31  7:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  ac9721f3f54b27a16c7e1afb2481e7ee95a70318
Gitweb:     http://git.kernel.org/tip/ac9721f3f54b27a16c7e1afb2481e7ee95a70318
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 27 May 2010 12:54:41 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 May 2010 08:46:08 +0200

perf_events: Fix races and clean up perf_event and perf_mmap_data interaction

In order to move toward separate buffer objects, rework the whole
perf_mmap_data construct to be a more self-sufficient entity, one
with its own lifetime rules.

This greatly sanitizes the whole output redirection code, which
was riddled with bugs and races.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    5 +-
 kernel/perf_event.c        |  224 +++++++++++++++++++++++++-------------------
 2 files changed, 129 insertions(+), 100 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index fb6c91e..4906985 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -585,6 +585,7 @@ enum perf_event_active_state {
 struct file;
 
 struct perf_mmap_data {
+	atomic_t			refcount;
 	struct rcu_head			rcu_head;
 #ifdef CONFIG_PERF_USE_VMALLOC
 	struct work_struct		work;
@@ -592,7 +593,6 @@ struct perf_mmap_data {
 #endif
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
-	int				nr_locked;	/* nr pages mlocked  */
 
 	atomic_t			poll;		/* POLL_ for wakeups */
 
@@ -643,7 +643,6 @@ struct perf_event {
 	int				nr_siblings;
 	int				group_flags;
 	struct perf_event		*group_leader;
-	struct perf_event		*output;
 	const struct pmu		*pmu;
 
 	enum perf_event_active_state	state;
@@ -704,6 +703,8 @@ struct perf_event {
 	/* mmap bits */
 	struct mutex			mmap_mutex;
 	atomic_t			mmap_count;
+	int				mmap_locked;
+	struct user_struct		*mmap_user;
 	struct perf_mmap_data		*data;
 
 	/* poll related */
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bd7ce8c..848d49a 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1841,6 +1841,7 @@ static void free_event_rcu(struct rcu_head *head)
 }
 
 static void perf_pending_sync(struct perf_event *event);
+static void perf_mmap_data_put(struct perf_mmap_data *data);
 
 static void free_event(struct perf_event *event)
 {
@@ -1856,9 +1857,9 @@ static void free_event(struct perf_event *event)
 			atomic_dec(&nr_task_events);
 	}
 
-	if (event->output) {
-		fput(event->output->filp);
-		event->output = NULL;
+	if (event->data) {
+		perf_mmap_data_put(event->data);
+		event->data = NULL;
 	}
 
 	if (event->destroy)
@@ -2175,7 +2176,27 @@ unlock:
 	return ret;
 }
 
-static int perf_event_set_output(struct perf_event *event, int output_fd);
+static const struct file_operations perf_fops;
+
+static struct perf_event *perf_fget_light(int fd, int *fput_needed)
+{
+	struct file *file;
+
+	file = fget_light(fd, fput_needed);
+	if (!file)
+		return ERR_PTR(-EBADF);
+
+	if (file->f_op != &perf_fops) {
+		fput_light(file, *fput_needed);
+		*fput_needed = 0;
+		return ERR_PTR(-EBADF);
+	}
+
+	return file->private_data;
+}
+
+static int perf_event_set_output(struct perf_event *event,
+				 struct perf_event *output_event);
 static int perf_event_set_filter(struct perf_event *event, void __user *arg);
 
 static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -2202,7 +2223,23 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return perf_event_period(event, (u64 __user *)arg);
 
 	case PERF_EVENT_IOC_SET_OUTPUT:
-		return perf_event_set_output(event, arg);
+	{
+		struct perf_event *output_event = NULL;
+		int fput_needed = 0;
+		int ret;
+
+		if (arg != -1) {
+			output_event = perf_fget_light(arg, &fput_needed);
+			if (IS_ERR(output_event))
+				return PTR_ERR(output_event);
+		}
+
+		ret = perf_event_set_output(event, output_event);
+		if (output_event)
+			fput_light(output_event->filp, fput_needed);
+
+		return ret;
+	}
 
 	case PERF_EVENT_IOC_SET_FILTER:
 		return perf_event_set_filter(event, (void __user *)arg);
@@ -2335,8 +2372,6 @@ perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 	unsigned long size;
 	int i;
 
-	WARN_ON(atomic_read(&event->mmap_count));
-
 	size = sizeof(struct perf_mmap_data);
 	size += nr_pages * sizeof(void *);
 
@@ -2452,8 +2487,6 @@ perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
 	unsigned long size;
 	void *all_buf;
 
-	WARN_ON(atomic_read(&event->mmap_count));
-
 	size = sizeof(struct perf_mmap_data);
 	size += sizeof(void *);
 
@@ -2536,7 +2569,7 @@ perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
 	if (!data->watermark)
 		data->watermark = max_size / 2;
 
-
+	atomic_set(&data->refcount, 1);
 	rcu_assign_pointer(event->data, data);
 }
 
@@ -2548,13 +2581,26 @@ static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head)
 	perf_mmap_data_free(data);
 }
 
-static void perf_mmap_data_release(struct perf_event *event)
+static struct perf_mmap_data *perf_mmap_data_get(struct perf_event *event)
 {
-	struct perf_mmap_data *data = event->data;
+	struct perf_mmap_data *data;
+
+	rcu_read_lock();
+	data = rcu_dereference(event->data);
+	if (data) {
+		if (!atomic_inc_not_zero(&data->refcount))
+			data = NULL;
+	}
+	rcu_read_unlock();
+
+	return data;
+}
 
-	WARN_ON(atomic_read(&event->mmap_count));
+static void perf_mmap_data_put(struct perf_mmap_data *data)
+{
+	if (!atomic_dec_and_test(&data->refcount))
+		return;
 
-	rcu_assign_pointer(event->data, NULL);
 	call_rcu(&data->rcu_head, perf_mmap_data_free_rcu);
 }
 
@@ -2569,15 +2615,18 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 {
 	struct perf_event *event = vma->vm_file->private_data;
 
-	WARN_ON_ONCE(event->ctx->parent_ctx);
 	if (atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) {
 		unsigned long size = perf_data_size(event->data);
-		struct user_struct *user = current_user();
+		struct user_struct *user = event->mmap_user;
+		struct perf_mmap_data *data = event->data;
 
 		atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
-		vma->vm_mm->locked_vm -= event->data->nr_locked;
-		perf_mmap_data_release(event);
+		vma->vm_mm->locked_vm -= event->mmap_locked;
+		rcu_assign_pointer(event->data, NULL);
 		mutex_unlock(&event->mmap_mutex);
+
+		perf_mmap_data_put(data);
+		free_uid(user);
 	}
 }
 
@@ -2629,13 +2678,10 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	WARN_ON_ONCE(event->ctx->parent_ctx);
 	mutex_lock(&event->mmap_mutex);
-	if (event->output) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
-	if (atomic_inc_not_zero(&event->mmap_count)) {
-		if (nr_pages != event->data->nr_pages)
+	if (event->data) {
+		if (event->data->nr_pages == nr_pages)
+			atomic_inc(&event->data->refcount);
+		else
 			ret = -EINVAL;
 		goto unlock;
 	}
@@ -2667,21 +2713,23 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	WARN_ON(event->data);
 
 	data = perf_mmap_data_alloc(event, nr_pages);
-	ret = -ENOMEM;
-	if (!data)
+	if (!data) {
+		ret = -ENOMEM;
 		goto unlock;
+	}
 
-	ret = 0;
 	perf_mmap_data_init(event, data);
-
-	atomic_set(&event->mmap_count, 1);
-	atomic_long_add(user_extra, &user->locked_vm);
-	vma->vm_mm->locked_vm += extra;
-	event->data->nr_locked = extra;
 	if (vma->vm_flags & VM_WRITE)
 		event->data->writable = 1;
 
+	atomic_long_add(user_extra, &user->locked_vm);
+	event->mmap_locked = extra;
+	event->mmap_user = get_current_user();
+	vma->vm_mm->locked_vm += event->mmap_locked;
+
 unlock:
+	if (!ret)
+		atomic_inc(&event->mmap_count);
 	mutex_unlock(&event->mmap_mutex);
 
 	vma->vm_flags |= VM_RESERVED;
@@ -2993,7 +3041,6 @@ int perf_output_begin(struct perf_output_handle *handle,
 		      struct perf_event *event, unsigned int size,
 		      int nmi, int sample)
 {
-	struct perf_event *output_event;
 	struct perf_mmap_data *data;
 	unsigned long tail, offset, head;
 	int have_lost;
@@ -3010,10 +3057,6 @@ int perf_output_begin(struct perf_output_handle *handle,
 	if (event->parent)
 		event = event->parent;
 
-	output_event = rcu_dereference(event->output);
-	if (output_event)
-		event = output_event;
-
 	data = rcu_dereference(event->data);
 	if (!data)
 		goto out;
@@ -4912,39 +4955,17 @@ err_size:
 	goto out;
 }
 
-static int perf_event_set_output(struct perf_event *event, int output_fd)
+static int
+perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
 {
-	struct perf_event *output_event = NULL;
-	struct file *output_file = NULL;
-	struct perf_event *old_output;
-	int fput_needed = 0;
+	struct perf_mmap_data *data = NULL, *old_data = NULL;
 	int ret = -EINVAL;
 
-	/*
-	 * Don't allow output of inherited per-task events. This would
-	 * create performance issues due to cross cpu access.
-	 */
-	if (event->cpu == -1 && event->attr.inherit)
-		return -EINVAL;
-
-	if (!output_fd)
+	if (!output_event)
 		goto set;
 
-	output_file = fget_light(output_fd, &fput_needed);
-	if (!output_file)
-		return -EBADF;
-
-	if (output_file->f_op != &perf_fops)
-		goto out;
-
-	output_event = output_file->private_data;
-
-	/* Don't chain output fds */
-	if (output_event->output)
-		goto out;
-
-	/* Don't set an output fd when we already have an output channel */
-	if (event->data)
+	/* don't allow circular references */
+	if (event == output_event)
 		goto out;
 
 	/*
@@ -4959,26 +4980,28 @@ static int perf_event_set_output(struct perf_event *event, int output_fd)
 	if (output_event->cpu == -1 && output_event->ctx != event->ctx)
 		goto out;
 
-	atomic_long_inc(&output_file->f_count);
-
 set:
 	mutex_lock(&event->mmap_mutex);
-	old_output = event->output;
-	rcu_assign_pointer(event->output, output_event);
-	mutex_unlock(&event->mmap_mutex);
+	/* Can't redirect output if we've got an active mmap() */
+	if (atomic_read(&event->mmap_count))
+		goto unlock;
 
-	if (old_output) {
-		/*
-		 * we need to make sure no existing perf_output_*()
-		 * is still referencing this event.
-		 */
-		synchronize_rcu();
-		fput(old_output->filp);
+	if (output_event) {
+		/* get the buffer we want to redirect to */
+		data = perf_mmap_data_get(output_event);
+		if (!data)
+			goto unlock;
 	}
 
+	old_data = event->data;
+	rcu_assign_pointer(event->data, data);
 	ret = 0;
+unlock:
+	mutex_unlock(&event->mmap_mutex);
+
+	if (old_data)
+		perf_mmap_data_put(old_data);
 out:
-	fput_light(output_file, fput_needed);
 	return ret;
 }
 
@@ -4994,7 +5017,7 @@ SYSCALL_DEFINE5(perf_event_open,
 		struct perf_event_attr __user *, attr_uptr,
 		pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
 {
-	struct perf_event *event, *group_leader;
+	struct perf_event *event, *group_leader = NULL, *output_event = NULL;
 	struct perf_event_attr attr;
 	struct perf_event_context *ctx;
 	struct file *event_file = NULL;
@@ -5034,19 +5057,25 @@ SYSCALL_DEFINE5(perf_event_open,
 		goto err_fd;
 	}
 
+	if (group_fd != -1) {
+		group_leader = perf_fget_light(group_fd, &fput_needed);
+		if (IS_ERR(group_leader)) {
+			err = PTR_ERR(group_leader);
+			goto err_put_context;
+		}
+		group_file = group_leader->filp;
+		if (flags & PERF_FLAG_FD_OUTPUT)
+			output_event = group_leader;
+		if (flags & PERF_FLAG_FD_NO_GROUP)
+			group_leader = NULL;
+	}
+
 	/*
 	 * Look up the group leader (we will attach this event to it):
 	 */
-	group_leader = NULL;
-	if (group_fd != -1 && !(flags & PERF_FLAG_FD_NO_GROUP)) {
+	if (group_leader) {
 		err = -EINVAL;
-		group_file = fget_light(group_fd, &fput_needed);
-		if (!group_file)
-			goto err_put_context;
-		if (group_file->f_op != &perf_fops)
-			goto err_put_context;
 
-		group_leader = group_file->private_data;
 		/*
 		 * Do not allow a recursive hierarchy (this new sibling
 		 * becoming part of another group-sibling):
@@ -5068,9 +5097,16 @@ SYSCALL_DEFINE5(perf_event_open,
 
 	event = perf_event_alloc(&attr, cpu, ctx, group_leader,
 				     NULL, NULL, GFP_KERNEL);
-	err = PTR_ERR(event);
-	if (IS_ERR(event))
+	if (IS_ERR(event)) {
+		err = PTR_ERR(event);
 		goto err_put_context;
+	}
+
+	if (output_event) {
+		err = perf_event_set_output(event, output_event);
+		if (err)
+			goto err_free_put_context;
+	}
 
 	event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR);
 	if (IS_ERR(event_file)) {
@@ -5078,12 +5114,6 @@ SYSCALL_DEFINE5(perf_event_open,
 		goto err_free_put_context;
 	}
 
-	if (flags & PERF_FLAG_FD_OUTPUT) {
-		err = perf_event_set_output(event, group_fd);
-		if (err)
-			goto err_fput_free_put_context;
-	}
-
 	event->filp = event_file;
 	WARN_ON_ONCE(ctx->parent_ctx);
 	mutex_lock(&ctx->mutex);
@@ -5101,8 +5131,6 @@ SYSCALL_DEFINE5(perf_event_open,
 	fd_install(event_fd, event_file);
 	return event_fd;
 
-err_fput_free_put_context:
-	fput(event_file);
 err_free_put_context:
 	free_event(event);
 err_put_context:

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

* [tip:perf/urgent] perf_events: Fix races in group composition
       [not found]             ` <new-submission>
                                 ` (536 preceding siblings ...)
  2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races and clean up perf_event and perf_mmap_data interaction tip-bot for Peter Zijlstra
@ 2010-05-31  7:19               ` tip-bot for Peter Zijlstra
  2010-06-08 20:55               ` [tip:perf/core] perf: Fix signed comparison in perf_adjust_period() tip-bot for Peter Zijlstra
                                 ` (168 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-05-31  7:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  8a49542c0554af7d0073aac0ee73ee65b807ef34
Gitweb:     http://git.kernel.org/tip/8a49542c0554af7d0073aac0ee73ee65b807ef34
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 27 May 2010 15:47:49 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 May 2010 08:46:09 +0200

perf_events: Fix races in group composition

Group siblings don't pin each-other or the parent, so when we destroy
events we must make sure to clean up all cross referencing pointers.

In particular, for destruction of a group leader we must be able to
find all its siblings and remove their reference to it.

This means that detaching an event from its context must not detach it
from the group, otherwise we can end up failing to clear all pointers.

Solve this by clearly separating the attachment to a context and
attachment to a group, and keep the group composed until we destroy
the events.

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_event.h |    4 ++
 kernel/perf_event.c        |   91 ++++++++++++++++++++++++++++++++-----------
 2 files changed, 71 insertions(+), 24 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 4906985..5d0266d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -631,6 +631,9 @@ struct swevent_hlist {
 	struct rcu_head		rcu_head;
 };
 
+#define PERF_ATTACH_CONTEXT	0x01
+#define PERF_ATTACH_GROUP	0x02
+
 /**
  * struct perf_event - performance event kernel representation:
  */
@@ -646,6 +649,7 @@ struct perf_event {
 	const struct pmu		*pmu;
 
 	enum perf_event_active_state	state;
+	unsigned int			attach_state;
 	atomic64_t			count;
 
 	/*
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 848d49a..10a1aee 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -283,14 +283,15 @@ ctx_group_list(struct perf_event *event, struct perf_event_context *ctx)
 static void
 list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 {
-	struct perf_event *group_leader = event->group_leader;
+	WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);
+	event->attach_state |= PERF_ATTACH_CONTEXT;
 
 	/*
-	 * Depending on whether it is a standalone or sibling event,
-	 * add it straight to the context's event list, or to the group
-	 * leader's sibling list:
+	 * If we're a stand alone event or group leader, we go to the context
+	 * list, group events are kept attached to the group so that
+	 * perf_group_detach can, at all times, locate all siblings.
 	 */
-	if (group_leader == event) {
+	if (event->group_leader == event) {
 		struct list_head *list;
 
 		if (is_software_event(event))
@@ -298,13 +299,6 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 
 		list = ctx_group_list(event, ctx);
 		list_add_tail(&event->group_entry, list);
-	} else {
-		if (group_leader->group_flags & PERF_GROUP_SOFTWARE &&
-		    !is_software_event(event))
-			group_leader->group_flags &= ~PERF_GROUP_SOFTWARE;
-
-		list_add_tail(&event->group_entry, &group_leader->sibling_list);
-		group_leader->nr_siblings++;
 	}
 
 	list_add_rcu(&event->event_entry, &ctx->event_list);
@@ -313,6 +307,24 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 		ctx->nr_stat++;
 }
 
+static void perf_group_attach(struct perf_event *event)
+{
+	struct perf_event *group_leader = event->group_leader;
+
+	WARN_ON_ONCE(event->attach_state & PERF_ATTACH_GROUP);
+	event->attach_state |= PERF_ATTACH_GROUP;
+
+	if (group_leader == event)
+		return;
+
+	if (group_leader->group_flags & PERF_GROUP_SOFTWARE &&
+			!is_software_event(event))
+		group_leader->group_flags &= ~PERF_GROUP_SOFTWARE;
+
+	list_add_tail(&event->group_entry, &group_leader->sibling_list);
+	group_leader->nr_siblings++;
+}
+
 /*
  * Remove a event from the lists for its context.
  * Must be called with ctx->mutex and ctx->lock held.
@@ -320,17 +332,22 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 static void
 list_del_event(struct perf_event *event, struct perf_event_context *ctx)
 {
-	if (list_empty(&event->group_entry))
+	/*
+	 * We can have double detach due to exit/hot-unplug + close.
+	 */
+	if (!(event->attach_state & PERF_ATTACH_CONTEXT))
 		return;
+
+	event->attach_state &= ~PERF_ATTACH_CONTEXT;
+
 	ctx->nr_events--;
 	if (event->attr.inherit_stat)
 		ctx->nr_stat--;
 
-	list_del_init(&event->group_entry);
 	list_del_rcu(&event->event_entry);
 
-	if (event->group_leader != event)
-		event->group_leader->nr_siblings--;
+	if (event->group_leader == event)
+		list_del_init(&event->group_entry);
 
 	update_group_times(event);
 
@@ -345,21 +362,39 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
 		event->state = PERF_EVENT_STATE_OFF;
 }
 
-static void
-perf_destroy_group(struct perf_event *event, struct perf_event_context *ctx)
+static void perf_group_detach(struct perf_event *event)
 {
 	struct perf_event *sibling, *tmp;
+	struct list_head *list = NULL;
+
+	/*
+	 * We can have double detach due to exit/hot-unplug + close.
+	 */
+	if (!(event->attach_state & PERF_ATTACH_GROUP))
+		return;
+
+	event->attach_state &= ~PERF_ATTACH_GROUP;
+
+	/*
+	 * If this is a sibling, remove it from its group.
+	 */
+	if (event->group_leader != event) {
+		list_del_init(&event->group_entry);
+		event->group_leader->nr_siblings--;
+		return;
+	}
+
+	if (!list_empty(&event->group_entry))
+		list = &event->group_entry;
 
 	/*
 	 * If this was a group event with sibling events then
 	 * upgrade the siblings to singleton events by adding them
-	 * to the context list directly:
+	 * to whatever list we are on.
 	 */
 	list_for_each_entry_safe(sibling, tmp, &event->sibling_list, group_entry) {
-		struct list_head *list;
-
-		list = ctx_group_list(event, ctx);
-		list_move_tail(&sibling->group_entry, list);
+		if (list)
+			list_move_tail(&sibling->group_entry, list);
 		sibling->group_leader = sibling;
 
 		/* Inherit group flags from the previous leader */
@@ -727,6 +762,7 @@ static void add_event_to_ctx(struct perf_event *event,
 			       struct perf_event_context *ctx)
 {
 	list_add_event(event, ctx);
+	perf_group_attach(event);
 	event->tstamp_enabled = ctx->time;
 	event->tstamp_running = ctx->time;
 	event->tstamp_stopped = ctx->time;
@@ -1894,8 +1930,8 @@ int perf_event_release_kernel(struct perf_event *event)
 	 */
 	mutex_lock_nested(&ctx->mutex, SINGLE_DEPTH_NESTING);
 	raw_spin_lock_irq(&ctx->lock);
+	perf_group_detach(event);
 	list_del_event(event, ctx);
-	perf_destroy_group(event, ctx);
 	raw_spin_unlock_irq(&ctx->lock);
 	mutex_unlock(&ctx->mutex);
 
@@ -5127,6 +5163,12 @@ SYSCALL_DEFINE5(perf_event_open,
 	list_add_tail(&event->owner_entry, &current->perf_event_list);
 	mutex_unlock(&current->perf_event_mutex);
 
+	/*
+	 * Drop the reference on the group_event after placing the
+	 * new event on the sibling_list. This ensures destruction
+	 * of the group leader will find the pointer to itself in
+	 * perf_group_detach().
+	 */
 	fput_light(group_file, fput_needed);
 	fd_install(event_fd, event_file);
 	return event_fd;
@@ -5448,6 +5490,7 @@ static void perf_free_event(struct perf_event *event,
 
 	fput(parent->filp);
 
+	perf_group_detach(event);
 	list_del_event(event, ctx);
 	free_event(event);
 }

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

* [tip:perf/core] perf: Fix signed comparison in perf_adjust_period()
       [not found]             ` <new-submission>
                                 ` (537 preceding siblings ...)
  2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races in group composition tip-bot for Peter Zijlstra
@ 2010-06-08 20:55               ` tip-bot for Peter Zijlstra
  2010-06-08 20:55               ` [tip:sched/core] sched: Fix PROVE_RCU vs cpu_cgroup tip-bot for Peter Zijlstra
                                 ` (167 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-08 20:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  f6ab91add6355e231e1c47897027b2a6ee4fa268
Gitweb:     http://git.kernel.org/tip/f6ab91add6355e231e1c47897027b2a6ee4fa268
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 4 Jun 2010 15:18:01 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 8 Jun 2010 18:43:00 +0200

perf: Fix signed comparison in perf_adjust_period()

Frederic reported that frequency driven swevents didn't work properly
and even caused a division-by-zero error.

It turns out there are two bugs, the division-by-zero comes from a
failure to deal with that in perf_calculate_period().

The other was more interesting and turned out to be a wrong comparison
in perf_adjust_period(). The comparison was between an s64 and u64 and
got implicitly converted to an unsigned comparison. The problem is
that period_left is typically < 0, so it ended up being always true.

Cure this by making the local period variables s64.

Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 31d6afe..ff86c55 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1507,6 +1507,9 @@ do {					\
 		divisor = nsec * frequency;
 	}
 
+	if (!divisor)
+		return dividend;
+
 	return div64_u64(dividend, divisor);
 }
 
@@ -1529,7 +1532,7 @@ static int perf_event_start(struct perf_event *event)
 static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 {
 	struct hw_perf_event *hwc = &event->hw;
-	u64 period, sample_period;
+	s64 period, sample_period;
 	s64 delta;
 
 	period = perf_calculate_period(event, nsec, count);

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

* [tip:sched/core] sched: Fix PROVE_RCU vs cpu_cgroup
       [not found]             ` <new-submission>
                                 ` (538 preceding siblings ...)
  2010-06-08 20:55               ` [tip:perf/core] perf: Fix signed comparison in perf_adjust_period() tip-bot for Peter Zijlstra
@ 2010-06-08 20:55               ` tip-bot for Peter Zijlstra
  2010-06-08 20:55               ` [tip:perf/core] perf, x86: Small fix to cpuid10_edx tip-bot for Livio Soares
                                 ` (166 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-08 20:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulmck, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  dc61b1d65e353d638b2445f71fb8e5b5630f2415
Gitweb:     http://git.kernel.org/tip/dc61b1d65e353d638b2445f71fb8e5b5630f2415
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 8 Jun 2010 11:40:42 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 8 Jun 2010 18:44:04 +0200

sched: Fix PROVE_RCU vs cpu_cgroup

PROVE_RCU has a few issues with the cpu_cgroup because the scheduler
typically holds rq->lock around the css rcu derefs but the generic
cgroup code doesn't (and can't) know about that lock.

Provide means to add extra checks to the css dereference and use that
in the scheduler to annotate its users.

The addition of rq->lock to these checks is correct because the
cgroup_subsys::attach() method takes the rq->lock for each task it
moves, therefore by holding that lock, we ensure the task is pinned to
the current cgroup and the RCU derefence is valid.

That leaves one genuine race in __sched_setscheduler() where we used
task_group() without holding any of the required locks and thus raced
with the cgroup code. Solve this by moving the check under the
appropriate lock.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/cgroup.h |   20 ++++++---
 kernel/sched.c         |  115 ++++++++++++++++++++++++-----------------------
 2 files changed, 73 insertions(+), 62 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 0c62160..e3d00fd 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -525,13 +525,21 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
 	return cgrp->subsys[subsys_id];
 }
 
-static inline struct cgroup_subsys_state *task_subsys_state(
-	struct task_struct *task, int subsys_id)
+/*
+ * function to get the cgroup_subsys_state which allows for extra
+ * rcu_dereference_check() conditions, such as locks used during the
+ * cgroup_subsys::attach() methods.
+ */
+#define task_subsys_state_check(task, subsys_id, __c)			\
+	rcu_dereference_check(task->cgroups->subsys[subsys_id],		\
+			      rcu_read_lock_held() ||			\
+			      lockdep_is_held(&task->alloc_lock) ||	\
+			      cgroup_lock_is_held() || (__c))
+
+static inline struct cgroup_subsys_state *
+task_subsys_state(struct task_struct *task, int subsys_id)
 {
-	return rcu_dereference_check(task->cgroups->subsys[subsys_id],
-				     rcu_read_lock_held() ||
-				     lockdep_is_held(&task->alloc_lock) ||
-				     cgroup_lock_is_held());
+	return task_subsys_state_check(task, subsys_id, false);
 }
 
 static inline struct cgroup* task_cgroup(struct task_struct *task,
diff --git a/kernel/sched.c b/kernel/sched.c
index f8b8996..2aaceeb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -306,52 +306,6 @@ static int init_task_group_load = INIT_TASK_GROUP_LOAD;
  */
 struct task_group init_task_group;
 
-/* return group to which a task belongs */
-static inline struct task_group *task_group(struct task_struct *p)
-{
-	struct task_group *tg;
-
-#ifdef CONFIG_CGROUP_SCHED
-	tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
-				struct task_group, css);
-#else
-	tg = &init_task_group;
-#endif
-	return tg;
-}
-
-/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
-static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
-{
-	/*
-	 * Strictly speaking this rcu_read_lock() is not needed since the
-	 * task_group is tied to the cgroup, which in turn can never go away
-	 * as long as there are tasks attached to it.
-	 *
-	 * However since task_group() uses task_subsys_state() which is an
-	 * rcu_dereference() user, this quiets CONFIG_PROVE_RCU.
-	 */
-	rcu_read_lock();
-#ifdef CONFIG_FAIR_GROUP_SCHED
-	p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
-	p->se.parent = task_group(p)->se[cpu];
-#endif
-
-#ifdef CONFIG_RT_GROUP_SCHED
-	p->rt.rt_rq  = task_group(p)->rt_rq[cpu];
-	p->rt.parent = task_group(p)->rt_se[cpu];
-#endif
-	rcu_read_unlock();
-}
-
-#else
-
-static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
-static inline struct task_group *task_group(struct task_struct *p)
-{
-	return NULL;
-}
-
 #endif	/* CONFIG_CGROUP_SCHED */
 
 /* CFS-related fields in a runqueue */
@@ -644,6 +598,49 @@ static inline int cpu_of(struct rq *rq)
 #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
 #define raw_rq()		(&__raw_get_cpu_var(runqueues))
 
+#ifdef CONFIG_CGROUP_SCHED
+
+/*
+ * Return the group to which this tasks belongs.
+ *
+ * We use task_subsys_state_check() and extend the RCU verification
+ * with lockdep_is_held(&task_rq(p)->lock) because cpu_cgroup_attach()
+ * holds that lock for each task it moves into the cgroup. Therefore
+ * by holding that lock, we pin the task to the current cgroup.
+ */
+static inline struct task_group *task_group(struct task_struct *p)
+{
+	struct cgroup_subsys_state *css;
+
+	css = task_subsys_state_check(p, cpu_cgroup_subsys_id,
+			lockdep_is_held(&task_rq(p)->lock));
+	return container_of(css, struct task_group, css);
+}
+
+/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
+static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
+{
+#ifdef CONFIG_FAIR_GROUP_SCHED
+	p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
+	p->se.parent = task_group(p)->se[cpu];
+#endif
+
+#ifdef CONFIG_RT_GROUP_SCHED
+	p->rt.rt_rq  = task_group(p)->rt_rq[cpu];
+	p->rt.parent = task_group(p)->rt_se[cpu];
+#endif
+}
+
+#else /* CONFIG_CGROUP_SCHED */
+
+static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
+static inline struct task_group *task_group(struct task_struct *p)
+{
+	return NULL;
+}
+
+#endif /* CONFIG_CGROUP_SCHED */
+
 inline void update_rq_clock(struct rq *rq)
 {
 	if (!rq->skip_clock_update)
@@ -4465,16 +4462,6 @@ recheck:
 	}
 
 	if (user) {
-#ifdef CONFIG_RT_GROUP_SCHED
-		/*
-		 * Do not allow realtime tasks into groups that have no runtime
-		 * assigned.
-		 */
-		if (rt_bandwidth_enabled() && rt_policy(policy) &&
-				task_group(p)->rt_bandwidth.rt_runtime == 0)
-			return -EPERM;
-#endif
-
 		retval = security_task_setscheduler(p, policy, param);
 		if (retval)
 			return retval;
@@ -4490,6 +4477,22 @@ recheck:
 	 * runqueue lock must be held.
 	 */
 	rq = __task_rq_lock(p);
+
+#ifdef CONFIG_RT_GROUP_SCHED
+	if (user) {
+		/*
+		 * Do not allow realtime tasks into groups that have no runtime
+		 * assigned.
+		 */
+		if (rt_bandwidth_enabled() && rt_policy(policy) &&
+				task_group(p)->rt_bandwidth.rt_runtime == 0) {
+			__task_rq_unlock(rq);
+			raw_spin_unlock_irqrestore(&p->pi_lock, flags);
+			return -EPERM;
+		}
+	}
+#endif
+
 	/* recheck policy now with rq lock held */
 	if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
 		policy = oldpolicy = -1;

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

* [tip:perf/core] perf, x86: Small fix to cpuid10_edx
       [not found]             ` <new-submission>
                                 ` (539 preceding siblings ...)
  2010-06-08 20:55               ` [tip:sched/core] sched: Fix PROVE_RCU vs cpu_cgroup tip-bot for Peter Zijlstra
@ 2010-06-08 20:55               ` tip-bot for Livio Soares
  2010-06-09 10:14               ` [tip:perf/core] perf, trace: Inline perf_swevent_put_recursion_context() tip-bot for Peter Zijlstra
                                 ` (165 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Livio Soares @ 2010-06-08 20:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, arjan, a.p.zijlstra, livio, tglx, mingo

Commit-ID:  e768aee89c687a50e6a2110e30c5cae1fbf0d2da
Gitweb:     http://git.kernel.org/tip/e768aee89c687a50e6a2110e30c5cae1fbf0d2da
Author:     Livio Soares <livio@eecg.toronto.edu>
AuthorDate: Thu, 3 Jun 2010 15:00:31 -0400
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 8 Jun 2010 20:27:04 +0200

perf, x86: Small fix to cpuid10_edx

Fixes to 'cpuid10_edx' to comply with Intel documentation.
According to the Intel Manual, Volume 2A, Table 3-12, the cpuid for
architecture performance monitoring returns, in EDX, two pieces of
information:

  1) Number of fixed-function counters (5 bits, not 4)
  2) Width of fixed-function counters (8 bits)

Signed-off-by: Livio Soares <livio@eecg.toronto.edu>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/include/asm/perf_event.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 254883d..6ed3ae4 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -68,8 +68,9 @@ union cpuid10_eax {
 
 union cpuid10_edx {
 	struct {
-		unsigned int num_counters_fixed:4;
-		unsigned int reserved:28;
+		unsigned int num_counters_fixed:5;
+		unsigned int bit_width_fixed:8;
+		unsigned int reserved:19;
 	} split;
 	unsigned int full;
 };

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

* [tip:perf/core] perf, trace: Inline perf_swevent_put_recursion_context()
       [not found]             ` <new-submission>
                                 ` (540 preceding siblings ...)
  2010-06-08 20:55               ` [tip:perf/core] perf, x86: Small fix to cpuid10_edx tip-bot for Livio Soares
@ 2010-06-09 10:14               ` tip-bot for Peter Zijlstra
  2010-06-09 10:15               ` [tip:perf/core] perf, trace: Remove superfluous rcu_read_lock() tip-bot for Peter Zijlstra
                                 ` (164 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:14 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  ecc55f84b2e9741f29daa787ded93986df6cbe17
Gitweb:     http://git.kernel.org/tip/ecc55f84b2e9741f29daa787ded93986df6cbe17
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 15:11:34 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:33 +0200

perf, trace: Inline perf_swevent_put_recursion_context()

Inline perf_swevent_put_recursion_context into perf_tp_event(), this
shrinks the per trace template code footprint and saves a function
call.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/ftrace_event.h |    3 +--
 include/linux/perf_event.h   |    2 +-
 kernel/perf_event.c          |    8 ++++----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 3167f2d..0af31cd 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -257,8 +257,7 @@ static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
 		       u64 count, struct pt_regs *regs, void *head)
 {
-	perf_tp_event(addr, count, raw_data, size, regs, head);
-	perf_swevent_put_recursion_context(rctx);
+	perf_tp_event(addr, count, raw_data, size, regs, head, rctx);
 }
 #endif
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 5d0266d..c691a0b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1001,7 +1001,7 @@ static inline bool perf_paranoid_kernel(void)
 extern void perf_event_init(void);
 extern void perf_tp_event(u64 addr, u64 count, void *record,
 			  int entry_size, struct pt_regs *regs,
-			  struct hlist_head *head);
+			  struct hlist_head *head, int rctx);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index ff86c55..4bd3b59 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4213,14 +4213,12 @@ int perf_swevent_get_recursion_context(void)
 }
 EXPORT_SYMBOL_GPL(perf_swevent_get_recursion_context);
 
-void perf_swevent_put_recursion_context(int rctx)
+void inline perf_swevent_put_recursion_context(int rctx)
 {
 	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	barrier();
 	cpuctx->recursion[rctx]--;
 }
-EXPORT_SYMBOL_GPL(perf_swevent_put_recursion_context);
-
 
 void __perf_sw_event(u32 event_id, u64 nr, int nmi,
 			    struct pt_regs *regs, u64 addr)
@@ -4601,7 +4599,7 @@ static int perf_tp_event_match(struct perf_event *event,
 }
 
 void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
-		   struct pt_regs *regs, struct hlist_head *head)
+		   struct pt_regs *regs, struct hlist_head *head, int rctx)
 {
 	struct perf_sample_data data;
 	struct perf_event *event;
@@ -4621,6 +4619,8 @@ void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
 			perf_swevent_add(event, count, 1, &data, regs);
 	}
 	rcu_read_unlock();
+
+	perf_swevent_put_recursion_context(rctx);
 }
 EXPORT_SYMBOL_GPL(perf_tp_event);
 

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

* [tip:perf/core] perf, trace: Remove superfluous rcu_read_lock()
       [not found]             ` <new-submission>
                                 ` (541 preceding siblings ...)
  2010-06-09 10:14               ` [tip:perf/core] perf, trace: Inline perf_swevent_put_recursion_context() tip-bot for Peter Zijlstra
@ 2010-06-09 10:15               ` tip-bot for Peter Zijlstra
  2010-06-09 10:16               ` [tip:perf/core] perf: Rename perf_mmap_data to perf_buffer tip-bot for Peter Zijlstra
                                 ` (163 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, rostedt, a.p.zijlstra, tglx, mingo

Commit-ID:  8ed92280be013180e24c84456ab6babcb07037cc
Gitweb:     http://git.kernel.org/tip/8ed92280be013180e24c84456ab6babcb07037cc
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 15:13:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:33 +0200

perf, trace: Remove superfluous rcu_read_lock()

__DO_TRACE() already calls the callbacks under rcu_read_lock_sched(),
which is sufficient for our needs, avoid doing it again.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 4bd3b59..b39bec3 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4613,12 +4613,10 @@ void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
 	perf_sample_data_init(&data, addr);
 	data.raw = &raw;
 
-	rcu_read_lock();
 	hlist_for_each_entry_rcu(event, node, head, hlist_entry) {
 		if (perf_tp_event_match(event, &data, regs))
 			perf_swevent_add(event, count, 1, &data, regs);
 	}
-	rcu_read_unlock();
 
 	perf_swevent_put_recursion_context(rctx);
 }

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

* [tip:perf/core] perf: Rename perf_mmap_data to perf_buffer
       [not found]             ` <new-submission>
                                 ` (542 preceding siblings ...)
  2010-06-09 10:15               ` [tip:perf/core] perf, trace: Remove superfluous rcu_read_lock() tip-bot for Peter Zijlstra
@ 2010-06-09 10:16               ` tip-bot for Peter Zijlstra
  2010-06-09 10:16               ` [tip:perf/core] perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed tip-bot for Peter Zijlstra
                                 ` (162 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  ca5135e6b4a3cbc7e187737520fbc4b508f6f7a2
Gitweb:     http://git.kernel.org/tip/ca5135e6b4a3cbc7e187737520fbc4b508f6f7a2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 28 May 2010 19:33:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:35 +0200

perf: Rename perf_mmap_data to perf_buffer

Rename to clarify code.

s/perf_mmap_data/perf_buffer/g and selective s/data/buffer/g

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    6 +-
 kernel/perf_event.c        |  308 ++++++++++++++++++++++----------------------
 2 files changed, 157 insertions(+), 157 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f1b6ba0..2a0da02 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -602,7 +602,7 @@ enum perf_event_active_state {
 
 struct file;
 
-struct perf_mmap_data {
+struct perf_buffer {
 	atomic_t			refcount;
 	struct rcu_head			rcu_head;
 #ifdef CONFIG_PERF_USE_VMALLOC
@@ -727,7 +727,7 @@ struct perf_event {
 	atomic_t			mmap_count;
 	int				mmap_locked;
 	struct user_struct		*mmap_user;
-	struct perf_mmap_data		*data;
+	struct perf_buffer		*buffer;
 
 	/* poll related */
 	wait_queue_head_t		waitq;
@@ -825,7 +825,7 @@ struct perf_cpu_context {
 
 struct perf_output_handle {
 	struct perf_event		*event;
-	struct perf_mmap_data		*data;
+	struct perf_buffer		*buffer;
 	unsigned long			wakeup;
 	unsigned long			size;
 	void				*addr;
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 6f60920..93d5458 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1876,7 +1876,7 @@ static void free_event_rcu(struct rcu_head *head)
 }
 
 static void perf_pending_sync(struct perf_event *event);
-static void perf_mmap_data_put(struct perf_mmap_data *data);
+static void perf_buffer_put(struct perf_buffer *buffer);
 
 static void free_event(struct perf_event *event)
 {
@@ -1892,9 +1892,9 @@ static void free_event(struct perf_event *event)
 			atomic_dec(&nr_task_events);
 	}
 
-	if (event->data) {
-		perf_mmap_data_put(event->data);
-		event->data = NULL;
+	if (event->buffer) {
+		perf_buffer_put(event->buffer);
+		event->buffer = NULL;
 	}
 
 	if (event->destroy)
@@ -2119,13 +2119,13 @@ perf_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 static unsigned int perf_poll(struct file *file, poll_table *wait)
 {
 	struct perf_event *event = file->private_data;
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	unsigned int events = POLL_HUP;
 
 	rcu_read_lock();
-	data = rcu_dereference(event->data);
-	if (data)
-		events = atomic_xchg(&data->poll, 0);
+	buffer = rcu_dereference(event->buffer);
+	if (buffer)
+		events = atomic_xchg(&buffer->poll, 0);
 	rcu_read_unlock();
 
 	poll_wait(file, &event->waitq, wait);
@@ -2335,14 +2335,14 @@ static int perf_event_index(struct perf_event *event)
 void perf_event_update_userpage(struct perf_event *event)
 {
 	struct perf_event_mmap_page *userpg;
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 
 	rcu_read_lock();
-	data = rcu_dereference(event->data);
-	if (!data)
+	buffer = rcu_dereference(event->buffer);
+	if (!buffer)
 		goto unlock;
 
-	userpg = data->user_page;
+	userpg = buffer->user_page;
 
 	/*
 	 * Disable preemption so as to not let the corresponding user-space
@@ -2376,15 +2376,15 @@ unlock:
  */
 
 static struct page *
-perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
+perf_mmap_to_page(struct perf_buffer *buffer, unsigned long pgoff)
 {
-	if (pgoff > data->nr_pages)
+	if (pgoff > buffer->nr_pages)
 		return NULL;
 
 	if (pgoff == 0)
-		return virt_to_page(data->user_page);
+		return virt_to_page(buffer->user_page);
 
-	return virt_to_page(data->data_pages[pgoff - 1]);
+	return virt_to_page(buffer->data_pages[pgoff - 1]);
 }
 
 static void *perf_mmap_alloc_page(int cpu)
@@ -2400,42 +2400,42 @@ static void *perf_mmap_alloc_page(int cpu)
 	return page_address(page);
 }
 
-static struct perf_mmap_data *
-perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
+static struct perf_buffer *
+perf_buffer_alloc(struct perf_event *event, int nr_pages)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	unsigned long size;
 	int i;
 
-	size = sizeof(struct perf_mmap_data);
+	size = sizeof(struct perf_buffer);
 	size += nr_pages * sizeof(void *);
 
-	data = kzalloc(size, GFP_KERNEL);
-	if (!data)
+	buffer = kzalloc(size, GFP_KERNEL);
+	if (!buffer)
 		goto fail;
 
-	data->user_page = perf_mmap_alloc_page(event->cpu);
-	if (!data->user_page)
+	buffer->user_page = perf_mmap_alloc_page(event->cpu);
+	if (!buffer->user_page)
 		goto fail_user_page;
 
 	for (i = 0; i < nr_pages; i++) {
-		data->data_pages[i] = perf_mmap_alloc_page(event->cpu);
-		if (!data->data_pages[i])
+		buffer->data_pages[i] = perf_mmap_alloc_page(event->cpu);
+		if (!buffer->data_pages[i])
 			goto fail_data_pages;
 	}
 
-	data->nr_pages = nr_pages;
+	buffer->nr_pages = nr_pages;
 
-	return data;
+	return buffer;
 
 fail_data_pages:
 	for (i--; i >= 0; i--)
-		free_page((unsigned long)data->data_pages[i]);
+		free_page((unsigned long)buffer->data_pages[i]);
 
-	free_page((unsigned long)data->user_page);
+	free_page((unsigned long)buffer->user_page);
 
 fail_user_page:
-	kfree(data);
+	kfree(buffer);
 
 fail:
 	return NULL;
@@ -2449,17 +2449,17 @@ static void perf_mmap_free_page(unsigned long addr)
 	__free_page(page);
 }
 
-static void perf_mmap_data_free(struct perf_mmap_data *data)
+static void perf_buffer_free(struct perf_buffer *buffer)
 {
 	int i;
 
-	perf_mmap_free_page((unsigned long)data->user_page);
-	for (i = 0; i < data->nr_pages; i++)
-		perf_mmap_free_page((unsigned long)data->data_pages[i]);
-	kfree(data);
+	perf_mmap_free_page((unsigned long)buffer->user_page);
+	for (i = 0; i < buffer->nr_pages; i++)
+		perf_mmap_free_page((unsigned long)buffer->data_pages[i]);
+	kfree(buffer);
 }
 
-static inline int page_order(struct perf_mmap_data *data)
+static inline int page_order(struct perf_buffer *buffer)
 {
 	return 0;
 }
@@ -2472,18 +2472,18 @@ static inline int page_order(struct perf_mmap_data *data)
  * Required for architectures that have d-cache aliasing issues.
  */
 
-static inline int page_order(struct perf_mmap_data *data)
+static inline int page_order(struct perf_buffer *buffer)
 {
-	return data->page_order;
+	return buffer->page_order;
 }
 
 static struct page *
-perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
+perf_mmap_to_page(struct perf_buffer *buffer, unsigned long pgoff)
 {
-	if (pgoff > (1UL << page_order(data)))
+	if (pgoff > (1UL << page_order(buffer)))
 		return NULL;
 
-	return vmalloc_to_page((void *)data->user_page + pgoff * PAGE_SIZE);
+	return vmalloc_to_page((void *)buffer->user_page + pgoff * PAGE_SIZE);
 }
 
 static void perf_mmap_unmark_page(void *addr)
@@ -2493,57 +2493,57 @@ static void perf_mmap_unmark_page(void *addr)
 	page->mapping = NULL;
 }
 
-static void perf_mmap_data_free_work(struct work_struct *work)
+static void perf_buffer_free_work(struct work_struct *work)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	void *base;
 	int i, nr;
 
-	data = container_of(work, struct perf_mmap_data, work);
-	nr = 1 << page_order(data);
+	buffer = container_of(work, struct perf_buffer, work);
+	nr = 1 << page_order(buffer);
 
-	base = data->user_page;
+	base = buffer->user_page;
 	for (i = 0; i < nr + 1; i++)
 		perf_mmap_unmark_page(base + (i * PAGE_SIZE));
 
 	vfree(base);
-	kfree(data);
+	kfree(buffer);
 }
 
-static void perf_mmap_data_free(struct perf_mmap_data *data)
+static void perf_buffer_free(struct perf_buffer *buffer)
 {
-	schedule_work(&data->work);
+	schedule_work(&buffer->work);
 }
 
-static struct perf_mmap_data *
-perf_mmap_data_alloc(struct perf_event *event, int nr_pages)
+static struct perf_buffer *
+perf_buffer_alloc(struct perf_event *event, int nr_pages)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	unsigned long size;
 	void *all_buf;
 
-	size = sizeof(struct perf_mmap_data);
+	size = sizeof(struct perf_buffer);
 	size += sizeof(void *);
 
-	data = kzalloc(size, GFP_KERNEL);
-	if (!data)
+	buffer = kzalloc(size, GFP_KERNEL);
+	if (!buffer)
 		goto fail;
 
-	INIT_WORK(&data->work, perf_mmap_data_free_work);
+	INIT_WORK(&buffer->work, perf_buffer_free_work);
 
 	all_buf = vmalloc_user((nr_pages + 1) * PAGE_SIZE);
 	if (!all_buf)
 		goto fail_all_buf;
 
-	data->user_page = all_buf;
-	data->data_pages[0] = all_buf + PAGE_SIZE;
-	data->page_order = ilog2(nr_pages);
-	data->nr_pages = 1;
+	buffer->user_page = all_buf;
+	buffer->data_pages[0] = all_buf + PAGE_SIZE;
+	buffer->page_order = ilog2(nr_pages);
+	buffer->nr_pages = 1;
 
-	return data;
+	return buffer;
 
 fail_all_buf:
-	kfree(data);
+	kfree(buffer);
 
 fail:
 	return NULL;
@@ -2551,15 +2551,15 @@ fail:
 
 #endif
 
-static unsigned long perf_data_size(struct perf_mmap_data *data)
+static unsigned long perf_data_size(struct perf_buffer *buffer)
 {
-	return data->nr_pages << (PAGE_SHIFT + page_order(data));
+	return buffer->nr_pages << (PAGE_SHIFT + page_order(buffer));
 }
 
 static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct perf_event *event = vma->vm_file->private_data;
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	int ret = VM_FAULT_SIGBUS;
 
 	if (vmf->flags & FAULT_FLAG_MKWRITE) {
@@ -2569,14 +2569,14 @@ static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	}
 
 	rcu_read_lock();
-	data = rcu_dereference(event->data);
-	if (!data)
+	buffer = rcu_dereference(event->buffer);
+	if (!buffer)
 		goto unlock;
 
 	if (vmf->pgoff && (vmf->flags & FAULT_FLAG_WRITE))
 		goto unlock;
 
-	vmf->page = perf_mmap_to_page(data, vmf->pgoff);
+	vmf->page = perf_mmap_to_page(buffer, vmf->pgoff);
 	if (!vmf->page)
 		goto unlock;
 
@@ -2592,51 +2592,51 @@ unlock:
 }
 
 static void
-perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
+perf_buffer_init(struct perf_event *event, struct perf_buffer *buffer)
 {
-	long max_size = perf_data_size(data);
+	long max_size = perf_data_size(buffer);
 
 	if (event->attr.watermark) {
-		data->watermark = min_t(long, max_size,
+		buffer->watermark = min_t(long, max_size,
 					event->attr.wakeup_watermark);
 	}
 
-	if (!data->watermark)
-		data->watermark = max_size / 2;
+	if (!buffer->watermark)
+		buffer->watermark = max_size / 2;
 
-	atomic_set(&data->refcount, 1);
-	rcu_assign_pointer(event->data, data);
+	atomic_set(&buffer->refcount, 1);
+	rcu_assign_pointer(event->buffer, buffer);
 }
 
-static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head)
+static void perf_buffer_free_rcu(struct rcu_head *rcu_head)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 
-	data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
-	perf_mmap_data_free(data);
+	buffer = container_of(rcu_head, struct perf_buffer, rcu_head);
+	perf_buffer_free(buffer);
 }
 
-static struct perf_mmap_data *perf_mmap_data_get(struct perf_event *event)
+static struct perf_buffer *perf_buffer_get(struct perf_event *event)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 
 	rcu_read_lock();
-	data = rcu_dereference(event->data);
-	if (data) {
-		if (!atomic_inc_not_zero(&data->refcount))
-			data = NULL;
+	buffer = rcu_dereference(event->buffer);
+	if (buffer) {
+		if (!atomic_inc_not_zero(&buffer->refcount))
+			buffer = NULL;
 	}
 	rcu_read_unlock();
 
-	return data;
+	return buffer;
 }
 
-static void perf_mmap_data_put(struct perf_mmap_data *data)
+static void perf_buffer_put(struct perf_buffer *buffer)
 {
-	if (!atomic_dec_and_test(&data->refcount))
+	if (!atomic_dec_and_test(&buffer->refcount))
 		return;
 
-	call_rcu(&data->rcu_head, perf_mmap_data_free_rcu);
+	call_rcu(&buffer->rcu_head, perf_buffer_free_rcu);
 }
 
 static void perf_mmap_open(struct vm_area_struct *vma)
@@ -2651,16 +2651,16 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 	struct perf_event *event = vma->vm_file->private_data;
 
 	if (atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) {
-		unsigned long size = perf_data_size(event->data);
+		unsigned long size = perf_data_size(event->buffer);
 		struct user_struct *user = event->mmap_user;
-		struct perf_mmap_data *data = event->data;
+		struct perf_buffer *buffer = event->buffer;
 
 		atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
 		vma->vm_mm->locked_vm -= event->mmap_locked;
-		rcu_assign_pointer(event->data, NULL);
+		rcu_assign_pointer(event->buffer, NULL);
 		mutex_unlock(&event->mmap_mutex);
 
-		perf_mmap_data_put(data);
+		perf_buffer_put(buffer);
 		free_uid(user);
 	}
 }
@@ -2678,7 +2678,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	unsigned long user_locked, user_lock_limit;
 	struct user_struct *user = current_user();
 	unsigned long locked, lock_limit;
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	unsigned long vma_size;
 	unsigned long nr_pages;
 	long user_extra, extra;
@@ -2699,7 +2699,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	nr_pages = (vma_size / PAGE_SIZE) - 1;
 
 	/*
-	 * If we have data pages ensure they're a power-of-two number, so we
+	 * If we have buffer pages ensure they're a power-of-two number, so we
 	 * can do bitmasks instead of modulo.
 	 */
 	if (nr_pages != 0 && !is_power_of_2(nr_pages))
@@ -2713,9 +2713,9 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	WARN_ON_ONCE(event->ctx->parent_ctx);
 	mutex_lock(&event->mmap_mutex);
-	if (event->data) {
-		if (event->data->nr_pages == nr_pages)
-			atomic_inc(&event->data->refcount);
+	if (event->buffer) {
+		if (event->buffer->nr_pages == nr_pages)
+			atomic_inc(&event->buffer->refcount);
 		else
 			ret = -EINVAL;
 		goto unlock;
@@ -2745,17 +2745,17 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 		goto unlock;
 	}
 
-	WARN_ON(event->data);
+	WARN_ON(event->buffer);
 
-	data = perf_mmap_data_alloc(event, nr_pages);
-	if (!data) {
+	buffer = perf_buffer_alloc(event, nr_pages);
+	if (!buffer) {
 		ret = -ENOMEM;
 		goto unlock;
 	}
 
-	perf_mmap_data_init(event, data);
+	perf_buffer_init(event, buffer);
 	if (vma->vm_flags & VM_WRITE)
-		event->data->writable = 1;
+		event->buffer->writable = 1;
 
 	atomic_long_add(user_extra, &user->locked_vm);
 	event->mmap_locked = extra;
@@ -2964,15 +2964,15 @@ EXPORT_SYMBOL_GPL(perf_unregister_guest_info_callbacks);
 /*
  * Output
  */
-static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
+static bool perf_output_space(struct perf_buffer *buffer, unsigned long tail,
 			      unsigned long offset, unsigned long head)
 {
 	unsigned long mask;
 
-	if (!data->writable)
+	if (!buffer->writable)
 		return true;
 
-	mask = perf_data_size(data) - 1;
+	mask = perf_data_size(buffer) - 1;
 
 	offset = (offset - tail) & mask;
 	head   = (head   - tail) & mask;
@@ -2985,7 +2985,7 @@ static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail,
 
 static void perf_output_wakeup(struct perf_output_handle *handle)
 {
-	atomic_set(&handle->data->poll, POLL_IN);
+	atomic_set(&handle->buffer->poll, POLL_IN);
 
 	if (handle->nmi) {
 		handle->event->pending_wakeup = 1;
@@ -3005,45 +3005,45 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
  */
 static void perf_output_get_handle(struct perf_output_handle *handle)
 {
-	struct perf_mmap_data *data = handle->data;
+	struct perf_buffer *buffer = handle->buffer;
 
 	preempt_disable();
-	local_inc(&data->nest);
-	handle->wakeup = local_read(&data->wakeup);
+	local_inc(&buffer->nest);
+	handle->wakeup = local_read(&buffer->wakeup);
 }
 
 static void perf_output_put_handle(struct perf_output_handle *handle)
 {
-	struct perf_mmap_data *data = handle->data;
+	struct perf_buffer *buffer = handle->buffer;
 	unsigned long head;
 
 again:
-	head = local_read(&data->head);
+	head = local_read(&buffer->head);
 
 	/*
 	 * IRQ/NMI can happen here, which means we can miss a head update.
 	 */
 
-	if (!local_dec_and_test(&data->nest))
+	if (!local_dec_and_test(&buffer->nest))
 		goto out;
 
 	/*
 	 * Publish the known good head. Rely on the full barrier implied
-	 * by atomic_dec_and_test() order the data->head read and this
+	 * by atomic_dec_and_test() order the buffer->head read and this
 	 * write.
 	 */
-	data->user_page->data_head = head;
+	buffer->user_page->data_head = head;
 
 	/*
 	 * Now check if we missed an update, rely on the (compiler)
-	 * barrier in atomic_dec_and_test() to re-read data->head.
+	 * barrier in atomic_dec_and_test() to re-read buffer->head.
 	 */
-	if (unlikely(head != local_read(&data->head))) {
-		local_inc(&data->nest);
+	if (unlikely(head != local_read(&buffer->head))) {
+		local_inc(&buffer->nest);
 		goto again;
 	}
 
-	if (handle->wakeup != local_read(&data->wakeup))
+	if (handle->wakeup != local_read(&buffer->wakeup))
 		perf_output_wakeup(handle);
 
  out:
@@ -3063,12 +3063,12 @@ __always_inline void perf_output_copy(struct perf_output_handle *handle,
 		buf += size;
 		handle->size -= size;
 		if (!handle->size) {
-			struct perf_mmap_data *data = handle->data;
+			struct perf_buffer *buffer = handle->buffer;
 
 			handle->page++;
-			handle->page &= data->nr_pages - 1;
-			handle->addr = data->data_pages[handle->page];
-			handle->size = PAGE_SIZE << page_order(data);
+			handle->page &= buffer->nr_pages - 1;
+			handle->addr = buffer->data_pages[handle->page];
+			handle->size = PAGE_SIZE << page_order(buffer);
 		}
 	} while (len);
 }
@@ -3077,7 +3077,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 		      struct perf_event *event, unsigned int size,
 		      int nmi, int sample)
 {
-	struct perf_mmap_data *data;
+	struct perf_buffer *buffer;
 	unsigned long tail, offset, head;
 	int have_lost;
 	struct {
@@ -3093,19 +3093,19 @@ int perf_output_begin(struct perf_output_handle *handle,
 	if (event->parent)
 		event = event->parent;
 
-	data = rcu_dereference(event->data);
-	if (!data)
+	buffer = rcu_dereference(event->buffer);
+	if (!buffer)
 		goto out;
 
-	handle->data	= data;
+	handle->buffer	= buffer;
 	handle->event	= event;
 	handle->nmi	= nmi;
 	handle->sample	= sample;
 
-	if (!data->nr_pages)
+	if (!buffer->nr_pages)
 		goto out;
 
-	have_lost = local_read(&data->lost);
+	have_lost = local_read(&buffer->lost);
 	if (have_lost)
 		size += sizeof(lost_event);
 
@@ -3117,30 +3117,30 @@ int perf_output_begin(struct perf_output_handle *handle,
 		 * tail pointer. So that all reads will be completed before the
 		 * write is issued.
 		 */
-		tail = ACCESS_ONCE(data->user_page->data_tail);
+		tail = ACCESS_ONCE(buffer->user_page->data_tail);
 		smp_rmb();
-		offset = head = local_read(&data->head);
+		offset = head = local_read(&buffer->head);
 		head += size;
-		if (unlikely(!perf_output_space(data, tail, offset, head)))
+		if (unlikely(!perf_output_space(buffer, tail, offset, head)))
 			goto fail;
-	} while (local_cmpxchg(&data->head, offset, head) != offset);
+	} while (local_cmpxchg(&buffer->head, offset, head) != offset);
 
-	if (head - local_read(&data->wakeup) > data->watermark)
-		local_add(data->watermark, &data->wakeup);
+	if (head - local_read(&buffer->wakeup) > buffer->watermark)
+		local_add(buffer->watermark, &buffer->wakeup);
 
-	handle->page = offset >> (PAGE_SHIFT + page_order(data));
-	handle->page &= data->nr_pages - 1;
-	handle->size = offset & ((PAGE_SIZE << page_order(data)) - 1);
-	handle->addr = data->data_pages[handle->page];
+	handle->page = offset >> (PAGE_SHIFT + page_order(buffer));
+	handle->page &= buffer->nr_pages - 1;
+	handle->size = offset & ((PAGE_SIZE << page_order(buffer)) - 1);
+	handle->addr = buffer->data_pages[handle->page];
 	handle->addr += handle->size;
-	handle->size = (PAGE_SIZE << page_order(data)) - handle->size;
+	handle->size = (PAGE_SIZE << page_order(buffer)) - handle->size;
 
 	if (have_lost) {
 		lost_event.header.type = PERF_RECORD_LOST;
 		lost_event.header.misc = 0;
 		lost_event.header.size = sizeof(lost_event);
 		lost_event.id          = event->id;
-		lost_event.lost        = local_xchg(&data->lost, 0);
+		lost_event.lost        = local_xchg(&buffer->lost, 0);
 
 		perf_output_put(handle, lost_event);
 	}
@@ -3148,7 +3148,7 @@ int perf_output_begin(struct perf_output_handle *handle,
 	return 0;
 
 fail:
-	local_inc(&data->lost);
+	local_inc(&buffer->lost);
 	perf_output_put_handle(handle);
 out:
 	rcu_read_unlock();
@@ -3159,15 +3159,15 @@ out:
 void perf_output_end(struct perf_output_handle *handle)
 {
 	struct perf_event *event = handle->event;
-	struct perf_mmap_data *data = handle->data;
+	struct perf_buffer *buffer = handle->buffer;
 
 	int wakeup_events = event->attr.wakeup_events;
 
 	if (handle->sample && wakeup_events) {
-		int events = local_inc_return(&data->events);
+		int events = local_inc_return(&buffer->events);
 		if (events >= wakeup_events) {
-			local_sub(wakeup_events, &data->events);
-			local_inc(&data->wakeup);
+			local_sub(wakeup_events, &buffer->events);
+			local_inc(&buffer->wakeup);
 		}
 	}
 
@@ -5010,7 +5010,7 @@ err_size:
 static int
 perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
 {
-	struct perf_mmap_data *data = NULL, *old_data = NULL;
+	struct perf_buffer *buffer = NULL, *old_buffer = NULL;
 	int ret = -EINVAL;
 
 	if (!output_event)
@@ -5040,19 +5040,19 @@ set:
 
 	if (output_event) {
 		/* get the buffer we want to redirect to */
-		data = perf_mmap_data_get(output_event);
-		if (!data)
+		buffer = perf_buffer_get(output_event);
+		if (!buffer)
 			goto unlock;
 	}
 
-	old_data = event->data;
-	rcu_assign_pointer(event->data, data);
+	old_buffer = event->buffer;
+	rcu_assign_pointer(event->buffer, buffer);
 	ret = 0;
 unlock:
 	mutex_unlock(&event->mmap_mutex);
 
-	if (old_data)
-		perf_mmap_data_put(old_data);
+	if (old_buffer)
+		perf_buffer_put(old_buffer);
 out:
 	return ret;
 }

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

* [tip:perf/core] perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed
       [not found]             ` <new-submission>
                                 ` (543 preceding siblings ...)
  2010-06-09 10:16               ` [tip:perf/core] perf: Rename perf_mmap_data to perf_buffer tip-bot for Peter Zijlstra
@ 2010-06-09 10:16               ` tip-bot for Peter Zijlstra
  2010-06-09 10:17               ` [tip:perf/core] arch: Implement local64_t tip-bot for Peter Zijlstra
                                 ` (161 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  d57e34fdd60be7ffd0b1d86bfa1a553df86b7172
Gitweb:     http://git.kernel.org/tip/d57e34fdd60be7ffd0b1d86bfa1a553df86b7172
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 28 May 2010 19:41:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:35 +0200

perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed

Currently there are perf_buffer_alloc() + perf_buffer_init() + some
separate bits, fold it all into a single perf_buffer_alloc() and only
leave the attachment to the event separate.

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_event.h |    2 +
 kernel/perf_event.c        |   61 ++++++++++++++++++++++++-------------------
 2 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2a0da02..441992a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -602,6 +602,8 @@ enum perf_event_active_state {
 
 struct file;
 
+#define PERF_BUFFER_WRITABLE		0x01
+
 struct perf_buffer {
 	atomic_t			refcount;
 	struct rcu_head			rcu_head;
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 93d5458..f75c9c9 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2369,6 +2369,25 @@ unlock:
 	rcu_read_unlock();
 }
 
+static unsigned long perf_data_size(struct perf_buffer *buffer);
+
+static void
+perf_buffer_init(struct perf_buffer *buffer, long watermark, int flags)
+{
+	long max_size = perf_data_size(buffer);
+
+	if (watermark)
+		buffer->watermark = min(max_size, watermark);
+
+	if (!buffer->watermark)
+		buffer->watermark = max_size / 2;
+
+	if (flags & PERF_BUFFER_WRITABLE)
+		buffer->writable = 1;
+
+	atomic_set(&buffer->refcount, 1);
+}
+
 #ifndef CONFIG_PERF_USE_VMALLOC
 
 /*
@@ -2401,7 +2420,7 @@ static void *perf_mmap_alloc_page(int cpu)
 }
 
 static struct perf_buffer *
-perf_buffer_alloc(struct perf_event *event, int nr_pages)
+perf_buffer_alloc(int nr_pages, long watermark, int cpu, int flags)
 {
 	struct perf_buffer *buffer;
 	unsigned long size;
@@ -2414,18 +2433,20 @@ perf_buffer_alloc(struct perf_event *event, int nr_pages)
 	if (!buffer)
 		goto fail;
 
-	buffer->user_page = perf_mmap_alloc_page(event->cpu);
+	buffer->user_page = perf_mmap_alloc_page(cpu);
 	if (!buffer->user_page)
 		goto fail_user_page;
 
 	for (i = 0; i < nr_pages; i++) {
-		buffer->data_pages[i] = perf_mmap_alloc_page(event->cpu);
+		buffer->data_pages[i] = perf_mmap_alloc_page(cpu);
 		if (!buffer->data_pages[i])
 			goto fail_data_pages;
 	}
 
 	buffer->nr_pages = nr_pages;
 
+	perf_buffer_init(buffer, watermark, flags);
+
 	return buffer;
 
 fail_data_pages:
@@ -2516,7 +2537,7 @@ static void perf_buffer_free(struct perf_buffer *buffer)
 }
 
 static struct perf_buffer *
-perf_buffer_alloc(struct perf_event *event, int nr_pages)
+perf_buffer_alloc(int nr_pages, long watermark, int cpu, int flags)
 {
 	struct perf_buffer *buffer;
 	unsigned long size;
@@ -2540,6 +2561,8 @@ perf_buffer_alloc(struct perf_event *event, int nr_pages)
 	buffer->page_order = ilog2(nr_pages);
 	buffer->nr_pages = 1;
 
+	perf_buffer_init(buffer, watermark, flags);
+
 	return buffer;
 
 fail_all_buf:
@@ -2591,23 +2614,6 @@ unlock:
 	return ret;
 }
 
-static void
-perf_buffer_init(struct perf_event *event, struct perf_buffer *buffer)
-{
-	long max_size = perf_data_size(buffer);
-
-	if (event->attr.watermark) {
-		buffer->watermark = min_t(long, max_size,
-					event->attr.wakeup_watermark);
-	}
-
-	if (!buffer->watermark)
-		buffer->watermark = max_size / 2;
-
-	atomic_set(&buffer->refcount, 1);
-	rcu_assign_pointer(event->buffer, buffer);
-}
-
 static void perf_buffer_free_rcu(struct rcu_head *rcu_head)
 {
 	struct perf_buffer *buffer;
@@ -2682,7 +2688,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	unsigned long vma_size;
 	unsigned long nr_pages;
 	long user_extra, extra;
-	int ret = 0;
+	int ret = 0, flags = 0;
 
 	/*
 	 * Don't allow mmap() of inherited per-task counters. This would
@@ -2747,15 +2753,16 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 
 	WARN_ON(event->buffer);
 
-	buffer = perf_buffer_alloc(event, nr_pages);
+	if (vma->vm_flags & VM_WRITE)
+		flags |= PERF_BUFFER_WRITABLE;
+
+	buffer = perf_buffer_alloc(nr_pages, event->attr.wakeup_watermark,
+				   event->cpu, flags);
 	if (!buffer) {
 		ret = -ENOMEM;
 		goto unlock;
 	}
-
-	perf_buffer_init(event, buffer);
-	if (vma->vm_flags & VM_WRITE)
-		event->buffer->writable = 1;
+	rcu_assign_pointer(event->buffer, buffer);
 
 	atomic_long_add(user_extra, &user->locked_vm);
 	event->mmap_locked = extra;

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

* [tip:perf/core] arch: Implement local64_t
       [not found]             ` <new-submission>
                                 ` (544 preceding siblings ...)
  2010-06-09 10:16               ` [tip:perf/core] perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed tip-bot for Peter Zijlstra
@ 2010-06-09 10:17               ` tip-bot for Peter Zijlstra
  2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event_count() tip-bot for Peter Zijlstra
                                 ` (160 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, akpm, a.p.zijlstra, tglx, mingo

Commit-ID:  1996bda2a42480c275656233e631ee0966574be4
Gitweb:     http://git.kernel.org/tip/1996bda2a42480c275656233e631ee0966574be4
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 14:05:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:36 +0200

arch: Implement local64_t

On 64bit, local_t is of size long, and thus we make local64_t an alias.
On 32bit, we fall back to atomic64_t. (architecture can provide optimized
32-bit version)

(This new facility is to be used by perf events optimizations.)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-arch@vger.kernel.org
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/alpha/include/asm/local64.h      |    1 +
 arch/arm/include/asm/local64.h        |    1 +
 arch/avr32/include/asm/local64.h      |    1 +
 arch/blackfin/include/asm/local64.h   |    1 +
 arch/cris/include/asm/local64.h       |    1 +
 arch/frv/include/asm/local64.h        |    1 +
 arch/frv/kernel/local64.h             |    1 +
 arch/h8300/include/asm/local64.h      |    1 +
 arch/ia64/include/asm/local64.h       |    1 +
 arch/m32r/include/asm/local64.h       |    1 +
 arch/m68k/include/asm/local64.h       |    1 +
 arch/microblaze/include/asm/local64.h |    1 +
 arch/mips/include/asm/local64.h       |    1 +
 arch/mn10300/include/asm/local64.h    |    1 +
 arch/parisc/include/asm/local64.h     |    1 +
 arch/powerpc/include/asm/local64.h    |    1 +
 arch/s390/include/asm/local64.h       |    1 +
 arch/score/include/asm/local64.h      |    1 +
 arch/sh/include/asm/local64.h         |    1 +
 arch/sparc/include/asm/local64.h      |    1 +
 arch/x86/include/asm/local64.h        |    1 +
 arch/xtensa/include/asm/local64.h     |    1 +
 include/asm-generic/local64.h         |   96 +++++++++++++++++++++++++++++++++
 23 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/local64.h b/arch/alpha/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/alpha/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/arm/include/asm/local64.h b/arch/arm/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/arm/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/avr32/include/asm/local64.h b/arch/avr32/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/avr32/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/blackfin/include/asm/local64.h b/arch/blackfin/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/blackfin/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/cris/include/asm/local64.h b/arch/cris/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/cris/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/frv/include/asm/local64.h b/arch/frv/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/frv/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/frv/kernel/local64.h b/arch/frv/kernel/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/frv/kernel/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/h8300/include/asm/local64.h b/arch/h8300/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/h8300/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/ia64/include/asm/local64.h b/arch/ia64/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/ia64/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/m32r/include/asm/local64.h b/arch/m32r/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/m32r/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/m68k/include/asm/local64.h b/arch/m68k/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/m68k/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/microblaze/include/asm/local64.h b/arch/microblaze/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/microblaze/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/mips/include/asm/local64.h b/arch/mips/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/mips/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/mn10300/include/asm/local64.h b/arch/mn10300/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/mn10300/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/parisc/include/asm/local64.h b/arch/parisc/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/parisc/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/powerpc/include/asm/local64.h b/arch/powerpc/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/powerpc/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/s390/include/asm/local64.h b/arch/s390/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/s390/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/score/include/asm/local64.h b/arch/score/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/score/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/sh/include/asm/local64.h b/arch/sh/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/sh/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/sparc/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/x86/include/asm/local64.h b/arch/x86/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/x86/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/arch/xtensa/include/asm/local64.h b/arch/xtensa/include/asm/local64.h
new file mode 100644
index 0000000..36c93b5
--- /dev/null
+++ b/arch/xtensa/include/asm/local64.h
@@ -0,0 +1 @@
+#include <asm-generic/local64.h>
diff --git a/include/asm-generic/local64.h b/include/asm-generic/local64.h
new file mode 100644
index 0000000..02ac760
--- /dev/null
+++ b/include/asm-generic/local64.h
@@ -0,0 +1,96 @@
+#ifndef _ASM_GENERIC_LOCAL64_H
+#define _ASM_GENERIC_LOCAL64_H
+
+#include <linux/percpu.h>
+#include <asm/types.h>
+
+/*
+ * A signed long type for operations which are atomic for a single CPU.
+ * Usually used in combination with per-cpu variables.
+ *
+ * This is the default implementation, which uses atomic64_t.  Which is
+ * rather pointless.  The whole point behind local64_t is that some processors
+ * can perform atomic adds and subtracts in a manner which is atomic wrt IRQs
+ * running on this CPU.  local64_t allows exploitation of such capabilities.
+ */
+
+/* Implement in terms of atomics. */
+
+#if BITS_PER_LONG == 64
+
+#include <asm/local.h>
+
+typedef struct {
+	local_t a;
+} local64_t;
+
+#define LOCAL64_INIT(i)	{ LOCAL_INIT(i) }
+
+#define local64_read(l)		local_read(&(l)->a)
+#define local64_set(l,i)	local_set((&(l)->a),(i))
+#define local64_inc(l)		local_inc(&(l)->a)
+#define local64_dec(l)		local_dec(&(l)->a)
+#define local64_add(i,l)	local_add((i),(&(l)->a))
+#define local64_sub(i,l)	local_sub((i),(&(l)->a))
+
+#define local64_sub_and_test(i, l) local_sub_and_test((i), (&(l)->a))
+#define local64_dec_and_test(l) local_dec_and_test(&(l)->a)
+#define local64_inc_and_test(l) local_inc_and_test(&(l)->a)
+#define local64_add_negative(i, l) local_add_negative((i), (&(l)->a))
+#define local64_add_return(i, l) local_add_return((i), (&(l)->a))
+#define local64_sub_return(i, l) local_sub_return((i), (&(l)->a))
+#define local64_inc_return(l)	local_inc_return(&(l)->a)
+
+#define local64_cmpxchg(l, o, n) local_cmpxchg((&(l)->a), (o), (n))
+#define local64_xchg(l, n)	local_xchg((&(l)->a), (n))
+#define local64_add_unless(l, _a, u) local_add_unless((&(l)->a), (_a), (u))
+#define local64_inc_not_zero(l)	local_inc_not_zero(&(l)->a)
+
+/* Non-atomic variants, ie. preemption disabled and won't be touched
+ * in interrupt, etc.  Some archs can optimize this case well. */
+#define __local64_inc(l)	local64_set((l), local64_read(l) + 1)
+#define __local64_dec(l)	local64_set((l), local64_read(l) - 1)
+#define __local64_add(i,l)	local64_set((l), local64_read(l) + (i))
+#define __local64_sub(i,l)	local64_set((l), local64_read(l) - (i))
+
+#else /* BITS_PER_LONG != 64 */
+
+#include <asm/atomic.h>
+
+/* Don't use typedef: don't want them to be mixed with atomic_t's. */
+typedef struct {
+	atomic64_t a;
+} local64_t;
+
+#define LOCAL64_INIT(i)	{ ATOMIC_LONG_INIT(i) }
+
+#define local64_read(l)		atomic64_read(&(l)->a)
+#define local64_set(l,i)	atomic64_set((&(l)->a),(i))
+#define local64_inc(l)		atomic64_inc(&(l)->a)
+#define local64_dec(l)		atomic64_dec(&(l)->a)
+#define local64_add(i,l)	atomic64_add((i),(&(l)->a))
+#define local64_sub(i,l)	atomic64_sub((i),(&(l)->a))
+
+#define local64_sub_and_test(i, l) atomic64_sub_and_test((i), (&(l)->a))
+#define local64_dec_and_test(l) atomic64_dec_and_test(&(l)->a)
+#define local64_inc_and_test(l) atomic64_inc_and_test(&(l)->a)
+#define local64_add_negative(i, l) atomic64_add_negative((i), (&(l)->a))
+#define local64_add_return(i, l) atomic64_add_return((i), (&(l)->a))
+#define local64_sub_return(i, l) atomic64_sub_return((i), (&(l)->a))
+#define local64_inc_return(l)	atomic64_inc_return(&(l)->a)
+
+#define local64_cmpxchg(l, o, n) atomic64_cmpxchg((&(l)->a), (o), (n))
+#define local64_xchg(l, n)	atomic64_xchg((&(l)->a), (n))
+#define local64_add_unless(l, _a, u) atomic64_add_unless((&(l)->a), (_a), (u))
+#define local64_inc_not_zero(l)	atomic64_inc_not_zero(&(l)->a)
+
+/* Non-atomic variants, ie. preemption disabled and won't be touched
+ * in interrupt, etc.  Some archs can optimize this case well. */
+#define __local64_inc(l)	local64_set((l), local64_read(l) + 1)
+#define __local64_dec(l)	local64_set((l), local64_read(l) - 1)
+#define __local64_add(i,l)	local64_set((l), local64_read(l) + (i))
+#define __local64_sub(i,l)	local64_set((l), local64_read(l) - (i))
+
+#endif /* BITS_PER_LONG != 64 */
+
+#endif /* _ASM_GENERIC_LOCAL64_H */

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

* [tip:perf/core] perf: Add perf_event_count()
       [not found]             ` <new-submission>
                                 ` (545 preceding siblings ...)
  2010-06-09 10:17               ` [tip:perf/core] arch: Implement local64_t tip-bot for Peter Zijlstra
@ 2010-06-09 10:17               ` tip-bot for Peter Zijlstra
  2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event::child_count tip-bot for Peter Zijlstra
                                 ` (159 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  b5e58793c7a8ec35e72ea6ec6c353499dd189809
Gitweb:     http://git.kernel.org/tip/b5e58793c7a8ec35e72ea6ec6c353499dd189809
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 14:43:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:36 +0200

perf: Add perf_event_count()

Create a helper function for those sites that want to read the event count.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f75c9c9..ab4c0ff 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1736,6 +1736,11 @@ static void __perf_event_read(void *info)
 	event->pmu->read(event);
 }
 
+static inline u64 perf_event_count(struct perf_event *event)
+{
+	return atomic64_read(&event->count);
+}
+
 static u64 perf_event_read(struct perf_event *event)
 {
 	/*
@@ -1755,7 +1760,7 @@ static u64 perf_event_read(struct perf_event *event)
 		raw_spin_unlock_irqrestore(&ctx->lock, flags);
 	}
 
-	return atomic64_read(&event->count);
+	return perf_event_count(event);
 }
 
 /*
@@ -2352,7 +2357,7 @@ void perf_event_update_userpage(struct perf_event *event)
 	++userpg->lock;
 	barrier();
 	userpg->index = perf_event_index(event);
-	userpg->offset = atomic64_read(&event->count);
+	userpg->offset = perf_event_count(event);
 	if (event->state == PERF_EVENT_STATE_ACTIVE)
 		userpg->offset -= atomic64_read(&event->hw.prev_count);
 
@@ -3211,7 +3216,7 @@ static void perf_output_read_one(struct perf_output_handle *handle,
 	u64 values[4];
 	int n = 0;
 
-	values[n++] = atomic64_read(&event->count);
+	values[n++] = perf_event_count(event);
 	if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
 		values[n++] = event->total_time_enabled +
 			atomic64_read(&event->child_total_time_enabled);
@@ -3248,7 +3253,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
 	if (leader != event)
 		leader->pmu->read(leader);
 
-	values[n++] = atomic64_read(&leader->count);
+	values[n++] = perf_event_count(leader);
 	if (read_format & PERF_FORMAT_ID)
 		values[n++] = primary_event_id(leader);
 
@@ -3260,7 +3265,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
 		if (sub != event)
 			sub->pmu->read(sub);
 
-		values[n++] = atomic64_read(&sub->count);
+		values[n++] = perf_event_count(sub);
 		if (read_format & PERF_FORMAT_ID)
 			values[n++] = primary_event_id(sub);
 
@@ -5369,7 +5374,7 @@ static void sync_child_event(struct perf_event *child_event,
 	if (child_event->attr.inherit_stat)
 		perf_event_read_event(child_event, child);
 
-	child_val = atomic64_read(&child_event->count);
+	child_val = perf_event_count(child_event);
 
 	/*
 	 * Add back the child's count to the parent's count:

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

* [tip:perf/core] perf: Add perf_event::child_count
       [not found]             ` <new-submission>
                                 ` (546 preceding siblings ...)
  2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event_count() tip-bot for Peter Zijlstra
@ 2010-06-09 10:17               ` tip-bot for Peter Zijlstra
  2010-06-09 10:18               ` [tip:perf/core] perf: Convert perf_event to local_t tip-bot for Peter Zijlstra
                                 ` (158 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, efault,
	fweisbec, rostedt, tglx, mingo

Commit-ID:  a6e6dea68c18f705957573ee5596097c7e82d0e5
Gitweb:     http://git.kernel.org/tip/a6e6dea68c18f705957573ee5596097c7e82d0e5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 14:27:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:37 +0200

perf: Add perf_event::child_count

Only child counters adding back their values into the parent counter
are responsible for cross-cpu updates to event->count.

So if we pull that out into a new child_count variable, we get an
event->count that is only modified locally.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    1 +
 kernel/perf_event.c        |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 441992a..f34dab9 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -671,6 +671,7 @@ struct perf_event {
 	enum perf_event_active_state	state;
 	unsigned int			attach_state;
 	atomic64_t			count;
+	atomic64_t			child_count;
 
 	/*
 	 * These are the total time in nanoseconds that the event
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index ab4c0ff..a395fda 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1738,7 +1738,7 @@ static void __perf_event_read(void *info)
 
 static inline u64 perf_event_count(struct perf_event *event)
 {
-	return atomic64_read(&event->count);
+	return atomic64_read(&event->count) + atomic64_read(&event->child_count);
 }
 
 static u64 perf_event_read(struct perf_event *event)
@@ -5379,7 +5379,7 @@ static void sync_child_event(struct perf_event *child_event,
 	/*
 	 * Add back the child's count to the parent's count:
 	 */
-	atomic64_add(child_val, &parent_event->count);
+	atomic64_add(child_val, &parent_event->child_count);
 	atomic64_add(child_event->total_time_enabled,
 		     &parent_event->child_total_time_enabled);
 	atomic64_add(child_event->total_time_running,

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

* [tip:perf/core] perf: Convert perf_event to local_t
       [not found]             ` <new-submission>
                                 ` (547 preceding siblings ...)
  2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event::child_count tip-bot for Peter Zijlstra
@ 2010-06-09 10:18               ` tip-bot for Peter Zijlstra
  2010-06-09 10:18               ` [tip:perf/core] perf: Fix build breakage for architecutes without atomic64_t tip-bot for Peter Zijlstra
                                 ` (157 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:18 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e78505958cf123048fb48cb56b79cebb8edd15fb
Gitweb:     http://git.kernel.org/tip/e78505958cf123048fb48cb56b79cebb8edd15fb
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 21 May 2010 14:43:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 11:12:37 +0200

perf: Convert perf_event to local_t

Since now all modification to event->count (and ->prev_count
and ->period_left) are local to a cpu, change then to local64_t so we
avoid the LOCK'ed ops.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/arm/kernel/perf_event.c     |   18 ++++++++--------
 arch/powerpc/kernel/perf_event.c |   34 +++++++++++++++---------------
 arch/sh/kernel/perf_event.c      |    6 ++--
 arch/sparc/kernel/perf_event.c   |   18 ++++++++--------
 arch/x86/kernel/cpu/perf_event.c |   18 ++++++++--------
 include/linux/perf_event.h       |    7 +++--
 kernel/perf_event.c              |   42 +++++++++++++++++++-------------------
 7 files changed, 72 insertions(+), 71 deletions(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index c457686..5b7cfaf 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -164,20 +164,20 @@ armpmu_event_set_period(struct perf_event *event,
 			struct hw_perf_event *hwc,
 			int idx)
 {
-	s64 left = atomic64_read(&hwc->period_left);
+	s64 left = local64_read(&hwc->period_left);
 	s64 period = hwc->sample_period;
 	int ret = 0;
 
 	if (unlikely(left <= -period)) {
 		left = period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
@@ -185,7 +185,7 @@ armpmu_event_set_period(struct perf_event *event,
 	if (left > (s64)armpmu->max_period)
 		left = armpmu->max_period;
 
-	atomic64_set(&hwc->prev_count, (u64)-left);
+	local64_set(&hwc->prev_count, (u64)-left);
 
 	armpmu->write_counter(idx, (u64)(-left) & 0xffffffff);
 
@@ -204,18 +204,18 @@ armpmu_event_update(struct perf_event *event,
 	s64 delta;
 
 again:
-	prev_raw_count = atomic64_read(&hwc->prev_count);
+	prev_raw_count = local64_read(&hwc->prev_count);
 	new_raw_count = armpmu->read_counter(idx);
 
-	if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+	if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
 			     new_raw_count) != prev_raw_count)
 		goto again;
 
 	delta = (new_raw_count << shift) - (prev_raw_count << shift);
 	delta >>= shift;
 
-	atomic64_add(delta, &event->count);
-	atomic64_sub(delta, &hwc->period_left);
+	local64_add(delta, &event->count);
+	local64_sub(delta, &hwc->period_left);
 
 	return new_raw_count;
 }
@@ -478,7 +478,7 @@ __hw_perf_event_init(struct perf_event *event)
 	if (!hwc->sample_period) {
 		hwc->sample_period  = armpmu->max_period;
 		hwc->last_period    = hwc->sample_period;
-		atomic64_set(&hwc->period_left, hwc->sample_period);
+		local64_set(&hwc->period_left, hwc->sample_period);
 	}
 
 	err = 0;
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index ac2a8c2..af1d9a7 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -410,15 +410,15 @@ static void power_pmu_read(struct perf_event *event)
 	 * Therefore we treat them like NMIs.
 	 */
 	do {
-		prev = atomic64_read(&event->hw.prev_count);
+		prev = local64_read(&event->hw.prev_count);
 		barrier();
 		val = read_pmc(event->hw.idx);
-	} while (atomic64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
+	} while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
 
 	/* The counters are only 32 bits wide */
 	delta = (val - prev) & 0xfffffffful;
-	atomic64_add(delta, &event->count);
-	atomic64_sub(delta, &event->hw.period_left);
+	local64_add(delta, &event->count);
+	local64_sub(delta, &event->hw.period_left);
 }
 
 /*
@@ -444,10 +444,10 @@ static void freeze_limited_counters(struct cpu_hw_events *cpuhw,
 		if (!event->hw.idx)
 			continue;
 		val = (event->hw.idx == 5) ? pmc5 : pmc6;
-		prev = atomic64_read(&event->hw.prev_count);
+		prev = local64_read(&event->hw.prev_count);
 		event->hw.idx = 0;
 		delta = (val - prev) & 0xfffffffful;
-		atomic64_add(delta, &event->count);
+		local64_add(delta, &event->count);
 	}
 }
 
@@ -462,7 +462,7 @@ static void thaw_limited_counters(struct cpu_hw_events *cpuhw,
 		event = cpuhw->limited_counter[i];
 		event->hw.idx = cpuhw->limited_hwidx[i];
 		val = (event->hw.idx == 5) ? pmc5 : pmc6;
-		atomic64_set(&event->hw.prev_count, val);
+		local64_set(&event->hw.prev_count, val);
 		perf_event_update_userpage(event);
 	}
 }
@@ -666,11 +666,11 @@ void hw_perf_enable(void)
 		}
 		val = 0;
 		if (event->hw.sample_period) {
-			left = atomic64_read(&event->hw.period_left);
+			left = local64_read(&event->hw.period_left);
 			if (left < 0x80000000L)
 				val = 0x80000000L - left;
 		}
-		atomic64_set(&event->hw.prev_count, val);
+		local64_set(&event->hw.prev_count, val);
 		event->hw.idx = idx;
 		write_pmc(idx, val);
 		perf_event_update_userpage(event);
@@ -842,8 +842,8 @@ static void power_pmu_unthrottle(struct perf_event *event)
 	if (left < 0x80000000L)
 		val = 0x80000000L - left;
 	write_pmc(event->hw.idx, val);
-	atomic64_set(&event->hw.prev_count, val);
-	atomic64_set(&event->hw.period_left, left);
+	local64_set(&event->hw.prev_count, val);
+	local64_set(&event->hw.period_left, left);
 	perf_event_update_userpage(event);
 	perf_enable();
 	local_irq_restore(flags);
@@ -1109,7 +1109,7 @@ const struct pmu *hw_perf_event_init(struct perf_event *event)
 	event->hw.config = events[n];
 	event->hw.event_base = cflags[n];
 	event->hw.last_period = event->hw.sample_period;
-	atomic64_set(&event->hw.period_left, event->hw.last_period);
+	local64_set(&event->hw.period_left, event->hw.last_period);
 
 	/*
 	 * See if we need to reserve the PMU.
@@ -1147,16 +1147,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 	int record = 0;
 
 	/* we don't have to worry about interrupts here */
-	prev = atomic64_read(&event->hw.prev_count);
+	prev = local64_read(&event->hw.prev_count);
 	delta = (val - prev) & 0xfffffffful;
-	atomic64_add(delta, &event->count);
+	local64_add(delta, &event->count);
 
 	/*
 	 * See if the total period for this event has expired,
 	 * and update for the next period.
 	 */
 	val = 0;
-	left = atomic64_read(&event->hw.period_left) - delta;
+	left = local64_read(&event->hw.period_left) - delta;
 	if (period) {
 		if (left <= 0) {
 			left += period;
@@ -1194,8 +1194,8 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 	}
 
 	write_pmc(event->hw.idx, val);
-	atomic64_set(&event->hw.prev_count, val);
-	atomic64_set(&event->hw.period_left, left);
+	local64_set(&event->hw.prev_count, val);
+	local64_set(&event->hw.period_left, left);
 	perf_event_update_userpage(event);
 }
 
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 81b6de4..7a3dc35 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -185,10 +185,10 @@ static void sh_perf_event_update(struct perf_event *event,
 	 * this is the simplest approach for maintaining consistency.
 	 */
 again:
-	prev_raw_count = atomic64_read(&hwc->prev_count);
+	prev_raw_count = local64_read(&hwc->prev_count);
 	new_raw_count = sh_pmu->read(idx);
 
-	if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+	if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
 			     new_raw_count) != prev_raw_count)
 		goto again;
 
@@ -203,7 +203,7 @@ again:
 	delta = (new_raw_count << shift) - (prev_raw_count << shift);
 	delta >>= shift;
 
-	atomic64_add(delta, &event->count);
+	local64_add(delta, &event->count);
 }
 
 static void sh_pmu_disable(struct perf_event *event)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index beeb92f..8a6660d 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -572,18 +572,18 @@ static u64 sparc_perf_event_update(struct perf_event *event,
 	s64 delta;
 
 again:
-	prev_raw_count = atomic64_read(&hwc->prev_count);
+	prev_raw_count = local64_read(&hwc->prev_count);
 	new_raw_count = read_pmc(idx);
 
-	if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+	if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
 			     new_raw_count) != prev_raw_count)
 		goto again;
 
 	delta = (new_raw_count << shift) - (prev_raw_count << shift);
 	delta >>= shift;
 
-	atomic64_add(delta, &event->count);
-	atomic64_sub(delta, &hwc->period_left);
+	local64_add(delta, &event->count);
+	local64_sub(delta, &hwc->period_left);
 
 	return new_raw_count;
 }
@@ -591,27 +591,27 @@ again:
 static int sparc_perf_event_set_period(struct perf_event *event,
 				       struct hw_perf_event *hwc, int idx)
 {
-	s64 left = atomic64_read(&hwc->period_left);
+	s64 left = local64_read(&hwc->period_left);
 	s64 period = hwc->sample_period;
 	int ret = 0;
 
 	if (unlikely(left <= -period)) {
 		left = period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
 	if (left > MAX_PERIOD)
 		left = MAX_PERIOD;
 
-	atomic64_set(&hwc->prev_count, (u64)-left);
+	local64_set(&hwc->prev_count, (u64)-left);
 
 	write_pmc(idx, (u64)(-left) & 0xffffffff);
 
@@ -1087,7 +1087,7 @@ static int __hw_perf_event_init(struct perf_event *event)
 	if (!hwc->sample_period) {
 		hwc->sample_period = MAX_PERIOD;
 		hwc->last_period = hwc->sample_period;
-		atomic64_set(&hwc->period_left, hwc->sample_period);
+		local64_set(&hwc->period_left, hwc->sample_period);
 	}
 
 	return 0;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 79e1998..2d0d290 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -296,10 +296,10 @@ x86_perf_event_update(struct perf_event *event)
 	 * count to the generic event atomically:
 	 */
 again:
-	prev_raw_count = atomic64_read(&hwc->prev_count);
+	prev_raw_count = local64_read(&hwc->prev_count);
 	rdmsrl(hwc->event_base + idx, new_raw_count);
 
-	if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+	if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
 					new_raw_count) != prev_raw_count)
 		goto again;
 
@@ -314,8 +314,8 @@ again:
 	delta = (new_raw_count << shift) - (prev_raw_count << shift);
 	delta >>= shift;
 
-	atomic64_add(delta, &event->count);
-	atomic64_sub(delta, &hwc->period_left);
+	local64_add(delta, &event->count);
+	local64_sub(delta, &hwc->period_left);
 
 	return new_raw_count;
 }
@@ -439,7 +439,7 @@ static int x86_setup_perfctr(struct perf_event *event)
 	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);
+		local64_set(&hwc->period_left, hwc->sample_period);
 	} else {
 		/*
 		 * If we have a PMU initialized but no APIC
@@ -886,7 +886,7 @@ static int
 x86_perf_event_set_period(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
-	s64 left = atomic64_read(&hwc->period_left);
+	s64 left = local64_read(&hwc->period_left);
 	s64 period = hwc->sample_period;
 	int ret = 0, idx = hwc->idx;
 
@@ -898,14 +898,14 @@ x86_perf_event_set_period(struct perf_event *event)
 	 */
 	if (unlikely(left <= -period)) {
 		left = period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
 
 	if (unlikely(left <= 0)) {
 		left += period;
-		atomic64_set(&hwc->period_left, left);
+		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
 		ret = 1;
 	}
@@ -924,7 +924,7 @@ x86_perf_event_set_period(struct perf_event *event)
 	 * The hw event starts counting from this event offset,
 	 * mark it to be able to extra future deltas:
 	 */
-	atomic64_set(&hwc->prev_count, (u64)-left);
+	local64_set(&hwc->prev_count, (u64)-left);
 
 	wrmsrl(hwc->event_base + idx, (u64)(-left) & x86_pmu.cntval_mask);
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f34dab9..7342979 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -487,6 +487,7 @@ struct perf_guest_info_callbacks {
 #include <linux/cpu.h>
 #include <asm/atomic.h>
 #include <asm/local.h>
+#include <asm/local64.h>
 
 #define PERF_MAX_STACK_DEPTH		255
 
@@ -536,10 +537,10 @@ struct hw_perf_event {
 		struct arch_hw_breakpoint	info;
 #endif
 	};
-	atomic64_t			prev_count;
+	local64_t			prev_count;
 	u64				sample_period;
 	u64				last_period;
-	atomic64_t			period_left;
+	local64_t			period_left;
 	u64				interrupts;
 
 	u64				freq_time_stamp;
@@ -670,7 +671,7 @@ struct perf_event {
 
 	enum perf_event_active_state	state;
 	unsigned int			attach_state;
-	atomic64_t			count;
+	local64_t			count;
 	atomic64_t			child_count;
 
 	/*
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a395fda..97c7301 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1148,9 +1148,9 @@ static void __perf_event_sync_stat(struct perf_event *event,
 	 * In order to keep per-task stats reliable we need to flip the event
 	 * values when we flip the contexts.
 	 */
-	value = atomic64_read(&next_event->count);
-	value = atomic64_xchg(&event->count, value);
-	atomic64_set(&next_event->count, value);
+	value = local64_read(&next_event->count);
+	value = local64_xchg(&event->count, value);
+	local64_set(&next_event->count, value);
 
 	swap(event->total_time_enabled, next_event->total_time_enabled);
 	swap(event->total_time_running, next_event->total_time_running);
@@ -1540,10 +1540,10 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 
 	hwc->sample_period = sample_period;
 
-	if (atomic64_read(&hwc->period_left) > 8*sample_period) {
+	if (local64_read(&hwc->period_left) > 8*sample_period) {
 		perf_disable();
 		perf_event_stop(event);
-		atomic64_set(&hwc->period_left, 0);
+		local64_set(&hwc->period_left, 0);
 		perf_event_start(event);
 		perf_enable();
 	}
@@ -1584,7 +1584,7 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 
 		perf_disable();
 		event->pmu->read(event);
-		now = atomic64_read(&event->count);
+		now = local64_read(&event->count);
 		delta = now - hwc->freq_count_stamp;
 		hwc->freq_count_stamp = now;
 
@@ -1738,7 +1738,7 @@ static void __perf_event_read(void *info)
 
 static inline u64 perf_event_count(struct perf_event *event)
 {
-	return atomic64_read(&event->count) + atomic64_read(&event->child_count);
+	return local64_read(&event->count) + atomic64_read(&event->child_count);
 }
 
 static u64 perf_event_read(struct perf_event *event)
@@ -2141,7 +2141,7 @@ static unsigned int perf_poll(struct file *file, poll_table *wait)
 static void perf_event_reset(struct perf_event *event)
 {
 	(void)perf_event_read(event);
-	atomic64_set(&event->count, 0);
+	local64_set(&event->count, 0);
 	perf_event_update_userpage(event);
 }
 
@@ -2359,7 +2359,7 @@ void perf_event_update_userpage(struct perf_event *event)
 	userpg->index = perf_event_index(event);
 	userpg->offset = perf_event_count(event);
 	if (event->state == PERF_EVENT_STATE_ACTIVE)
-		userpg->offset -= atomic64_read(&event->hw.prev_count);
+		userpg->offset -= local64_read(&event->hw.prev_count);
 
 	userpg->time_enabled = event->total_time_enabled +
 			atomic64_read(&event->child_total_time_enabled);
@@ -4035,14 +4035,14 @@ static u64 perf_swevent_set_period(struct perf_event *event)
 	hwc->last_period = hwc->sample_period;
 
 again:
-	old = val = atomic64_read(&hwc->period_left);
+	old = val = local64_read(&hwc->period_left);
 	if (val < 0)
 		return 0;
 
 	nr = div64_u64(period + val, period);
 	offset = nr * period;
 	val -= offset;
-	if (atomic64_cmpxchg(&hwc->period_left, old, val) != old)
+	if (local64_cmpxchg(&hwc->period_left, old, val) != old)
 		goto again;
 
 	return nr;
@@ -4081,7 +4081,7 @@ static void perf_swevent_add(struct perf_event *event, u64 nr,
 {
 	struct hw_perf_event *hwc = &event->hw;
 
-	atomic64_add(nr, &event->count);
+	local64_add(nr, &event->count);
 
 	if (!regs)
 		return;
@@ -4092,7 +4092,7 @@ static void perf_swevent_add(struct perf_event *event, u64 nr,
 	if (nr == 1 && hwc->sample_period == 1 && !event->attr.freq)
 		return perf_swevent_overflow(event, 1, nmi, data, regs);
 
-	if (atomic64_add_negative(nr, &hwc->period_left))
+	if (local64_add_negative(nr, &hwc->period_left))
 		return;
 
 	perf_swevent_overflow(event, 0, nmi, data, regs);
@@ -4383,8 +4383,8 @@ static void cpu_clock_perf_event_update(struct perf_event *event)
 	u64 now;
 
 	now = cpu_clock(cpu);
-	prev = atomic64_xchg(&event->hw.prev_count, now);
-	atomic64_add(now - prev, &event->count);
+	prev = local64_xchg(&event->hw.prev_count, now);
+	local64_add(now - prev, &event->count);
 }
 
 static int cpu_clock_perf_event_enable(struct perf_event *event)
@@ -4392,7 +4392,7 @@ static int cpu_clock_perf_event_enable(struct perf_event *event)
 	struct hw_perf_event *hwc = &event->hw;
 	int cpu = raw_smp_processor_id();
 
-	atomic64_set(&hwc->prev_count, cpu_clock(cpu));
+	local64_set(&hwc->prev_count, cpu_clock(cpu));
 	perf_swevent_start_hrtimer(event);
 
 	return 0;
@@ -4424,9 +4424,9 @@ static void task_clock_perf_event_update(struct perf_event *event, u64 now)
 	u64 prev;
 	s64 delta;
 
-	prev = atomic64_xchg(&event->hw.prev_count, now);
+	prev = local64_xchg(&event->hw.prev_count, now);
 	delta = now - prev;
-	atomic64_add(delta, &event->count);
+	local64_add(delta, &event->count);
 }
 
 static int task_clock_perf_event_enable(struct perf_event *event)
@@ -4436,7 +4436,7 @@ static int task_clock_perf_event_enable(struct perf_event *event)
 
 	now = event->ctx->time;
 
-	atomic64_set(&hwc->prev_count, now);
+	local64_set(&hwc->prev_count, now);
 
 	perf_swevent_start_hrtimer(event);
 
@@ -4879,7 +4879,7 @@ perf_event_alloc(struct perf_event_attr *attr,
 		hwc->sample_period = 1;
 	hwc->last_period = hwc->sample_period;
 
-	atomic64_set(&hwc->period_left, hwc->sample_period);
+	local64_set(&hwc->period_left, hwc->sample_period);
 
 	/*
 	 * we currently do not support PERF_FORMAT_GROUP on inherited events
@@ -5313,7 +5313,7 @@ inherit_event(struct perf_event *parent_event,
 		hwc->sample_period = sample_period;
 		hwc->last_period   = sample_period;
 
-		atomic64_set(&hwc->period_left, sample_period);
+		local64_set(&hwc->period_left, sample_period);
 	}
 
 	child_event->overflow_handler = parent_event->overflow_handler;

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

* [tip:perf/core] perf: Fix build breakage for architecutes without atomic64_t
       [not found]             ` <new-submission>
                                 ` (548 preceding siblings ...)
  2010-06-09 10:18               ` [tip:perf/core] perf: Convert perf_event to local_t tip-bot for Peter Zijlstra
@ 2010-06-09 10:18               ` tip-bot for Peter Zijlstra
  2010-07-17 11:12               ` [tip:sched/urgent] sched: Revert nohz_ratelimit() for now tip-bot for Peter Zijlstra
                                 ` (156 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-06-09 10:18 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx

Commit-ID:  7be7923633a142402266d642ccebf74f556a649b
Gitweb:     http://git.kernel.org/tip/7be7923633a142402266d642ccebf74f556a649b
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 9 Jun 2010 11:57:23 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Jun 2010 12:03:00 +0200

perf: Fix build breakage for architecutes without atomic64_t

The local64.h include dependency was not dependent on PERF_EVENT=y,
which meant that arch's without atomic64_t support ended up including
it and failed to build.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
---
 include/linux/perf_event.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 7342979..1218d05 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -462,6 +462,7 @@ enum perf_callchain_context {
 
 #ifdef CONFIG_PERF_EVENTS
 # include <asm/perf_event.h>
+# include <asm/local64.h>
 #endif
 
 struct perf_guest_info_callbacks {
@@ -487,7 +488,6 @@ struct perf_guest_info_callbacks {
 #include <linux/cpu.h>
 #include <asm/atomic.h>
 #include <asm/local.h>
-#include <asm/local64.h>
 
 #define PERF_MAX_STACK_DEPTH		255
 

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

* [tip:sched/urgent] sched: Revert nohz_ratelimit() for now
       [not found]             ` <new-submission>
                                 ` (549 preceding siblings ...)
  2010-06-09 10:18               ` [tip:perf/core] perf: Fix build breakage for architecutes without atomic64_t tip-bot for Peter Zijlstra
@ 2010-07-17 11:12               ` tip-bot for Peter Zijlstra
  2010-07-18 10:33               ` [tip:perf/core] perf ui: Make END go to the last entry, not the top of the last page tip-bot for Arnaldo Carvalho de Melo
                                 ` (155 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-07-17 11:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, preining, arjan,
	tglx, mingo

Commit-ID:  396e894d289d69bacf5acd983c97cd6e21a14c08
Gitweb:     http://git.kernel.org/tip/396e894d289d69bacf5acd983c97cd6e21a14c08
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 9 Jul 2010 15:12:27 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 17 Jul 2010 12:05:44 +0200

sched: Revert nohz_ratelimit() for now

Norbert reported that nohz_ratelimit() causes his laptop to burn about
4W (40%) extra. For now back out the change and see if we can adjust
the power management code to make better decisions.

Reported-by: Norbert Preining <preining@logic.at>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Mike Galbraith <efault@gmx.de>
Cc: Arjan van de Ven <arjan@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/sched.h    |    6 ------
 kernel/sched.c           |   10 ----------
 kernel/time/tick-sched.c |    2 +-
 3 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 747fcae..6e0bb86 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -273,17 +273,11 @@ extern cpumask_var_t nohz_cpu_mask;
 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
 extern int select_nohz_load_balancer(int cpu);
 extern int get_nohz_load_balancer(void);
-extern int nohz_ratelimit(int cpu);
 #else
 static inline int select_nohz_load_balancer(int cpu)
 {
 	return 0;
 }
-
-static inline int nohz_ratelimit(int cpu)
-{
-	return 0;
-}
 #endif
 
 /*
diff --git a/kernel/sched.c b/kernel/sched.c
index f52a880..63b4a14 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1232,16 +1232,6 @@ void wake_up_idle_cpu(int cpu)
 		smp_send_reschedule(cpu);
 }
 
-int nohz_ratelimit(int cpu)
-{
-	struct rq *rq = cpu_rq(cpu);
-	u64 diff = rq->clock - rq->nohz_stamp;
-
-	rq->nohz_stamp = rq->clock;
-
-	return diff < (NSEC_PER_SEC / HZ) >> 1;
-}
-
 #endif /* CONFIG_NO_HZ */
 
 static u64 sched_avg_period(void)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 813993b..f898af6 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -325,7 +325,7 @@ void tick_nohz_stop_sched_tick(int inidle)
 	} while (read_seqretry(&xtime_lock, seq));
 
 	if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
-	    arch_needs_cpu(cpu) || nohz_ratelimit(cpu)) {
+	    arch_needs_cpu(cpu)) {
 		next_jiffies = last_jiffies + 1;
 		delta_jiffies = 1;
 	} else {

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

* [tip:perf/core] perf ui: Make END go to the last entry, not the top of the last page
       [not found]             ` <new-submission>
                                 ` (550 preceding siblings ...)
  2010-07-17 11:12               ` [tip:sched/urgent] sched: Revert nohz_ratelimit() for now tip-bot for Peter Zijlstra
@ 2010-07-18 10:33               ` tip-bot for Arnaldo Carvalho de Melo
  2010-07-18 10:34               ` [tip:perf/core] perf hists: Factor out duplicated code tip-bot for Arnaldo Carvalho de Melo
                                 ` (154 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-07-18 10:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  63f20e744a595444f7ab1d47a29c5b74830feb47
Gitweb:     http://git.kernel.org/tip/63f20e744a595444f7ab1d47a29c5b74830feb47
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 15 Jul 2010 07:21:07 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 17 Jul 2010 15:44:43 -0300

perf ui: Make END go to the last entry, not the top of the last page

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 06f248f..932f124 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -491,11 +491,11 @@ static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 			break;
 		case NEWT_KEY_END:
 			offset = self->height - 1;
+			if (offset >= self->nr_entries)
+				offset = self->nr_entries - 1;
 
-			if (offset > self->nr_entries)
-				offset = self->nr_entries;
-
-			self->index = self->first_visible_entry_idx = self->nr_entries - 1 - offset;
+			self->index = self->nr_entries - 1;
+			self->first_visible_entry_idx = self->index - offset;
 			self->seek(self, -offset, SEEK_END);
 			break;
 		case NEWT_KEY_RIGHT:

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

* [tip:perf/core] perf hists: Factor out duplicated code
       [not found]             ` <new-submission>
                                 ` (551 preceding siblings ...)
  2010-07-18 10:33               ` [tip:perf/core] perf ui: Make END go to the last entry, not the top of the last page tip-bot for Arnaldo Carvalho de Melo
@ 2010-07-18 10:34               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:49               ` [tip:perf/core] perf sort: Make column width code per hists instance tip-bot for Arnaldo Carvalho de Melo
                                 ` (153 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-07-18 10:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, peterz, efault,
	fweisbec, tglx, mingo

Commit-ID:  cc5edb0eb9ce892b530e34a5d110382483587942
Gitweb:     http://git.kernel.org/tip/cc5edb0eb9ce892b530e34a5d110382483587942
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 16 Jul 2010 12:35:07 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 17 Jul 2010 15:45:55 -0300

perf hists: Factor out duplicated code

Introducing hists__remove_entry_filter.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 68d288c..7b5848c 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -795,6 +795,21 @@ enum hist_filter {
 	HIST_FILTER__THREAD,
 };
 
+static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h,
+				       enum hist_filter filter)
+{
+	h->filtered &= ~(1 << filter);
+	if (h->filtered)
+		return;
+
+	++self->nr_entries;
+	self->stats.total_period += h->period;
+	self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events;
+
+	if (h->ms.sym && self->max_sym_namelen < h->ms.sym->namelen)
+		self->max_sym_namelen = h->ms.sym->namelen;
+}
+
 void hists__filter_by_dso(struct hists *self, const struct dso *dso)
 {
 	struct rb_node *nd;
@@ -814,15 +829,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso)
 			continue;
 		}
 
-		h->filtered &= ~(1 << HIST_FILTER__DSO);
-		if (!h->filtered) {
-			++self->nr_entries;
-			self->stats.total_period += h->period;
-			self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events;
-			if (h->ms.sym &&
-			    self->max_sym_namelen < h->ms.sym->namelen)
-				self->max_sym_namelen = h->ms.sym->namelen;
-		}
+		hists__remove_entry_filter(self, h, HIST_FILTER__DSO);
 	}
 }
 
@@ -841,15 +848,8 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread)
 			h->filtered |= (1 << HIST_FILTER__THREAD);
 			continue;
 		}
-		h->filtered &= ~(1 << HIST_FILTER__THREAD);
-		if (!h->filtered) {
-			++self->nr_entries;
-			self->stats.total_period += h->period;
-			self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events;
-			if (h->ms.sym &&
-			    self->max_sym_namelen < h->ms.sym->namelen)
-				self->max_sym_namelen = h->ms.sym->namelen;
-		}
+
+		hists__remove_entry_filter(self, h, HIST_FILTER__THREAD);
 	}
 }
 

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

* [tip:perf/core] perf sort: Make column width code per hists instance
       [not found]             ` <new-submission>
                                 ` (552 preceding siblings ...)
  2010-07-18 10:34               ` [tip:perf/core] perf hists: Factor out duplicated code tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:49               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:49               ` [tip:perf/core] perf ui: Restore SPACE as an alias to PGDN in annotate tip-bot for Arnaldo Carvalho de Melo
                                 ` (152 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  8a6c5b261c1188379469807d84bfb1365d0f6823
Gitweb:     http://git.kernel.org/tip/8a6c5b261c1188379469807d84bfb1365d0f6823
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 20 Jul 2010 14:42:52 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 23 Jul 2010 08:55:59 -0300

perf sort: Make column width code per hists instance

They were globals, and since we support multiple hists and sessions
at the same time, it doesn't make sense to calculate those values
considereing all symbols in all sessions.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c  |   34 ++++++-------
 tools/perf/util/hist.c   |  115 +++++++++++++++++++++++++++++++--------------
 tools/perf/util/hist.h   |   27 ++++++++--
 tools/perf/util/newt.c   |    9 ++--
 tools/perf/util/sort.c   |   17 +++----
 tools/perf/util/sort.h   |    6 +--
 tools/perf/util/symbol.c |    9 ++++
 tools/perf/util/symbol.h |    2 +
 8 files changed, 140 insertions(+), 79 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index d7f21d7..121339f 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -340,30 +340,29 @@ int event__synthesize_kernel_mmap(event__handler_t process,
 	return process(&ev, session);
 }
 
-static void thread__comm_adjust(struct thread *self)
+static void thread__comm_adjust(struct thread *self, struct hists *hists)
 {
 	char *comm = self->comm;
 
 	if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
 	    (!symbol_conf.comm_list ||
 	     strlist__has_entry(symbol_conf.comm_list, comm))) {
-		unsigned int slen = strlen(comm);
+		u16 slen = strlen(comm);
 
-		if (slen > comms__col_width) {
-			comms__col_width = slen;
-			threads__col_width = slen + 6;
-		}
+		if (hists__new_col_len(hists, HISTC_COMM, slen))
+			hists__set_col_len(hists, HISTC_THREAD, slen + 6);
 	}
 }
 
-static int thread__set_comm_adjust(struct thread *self, const char *comm)
+static int thread__set_comm_adjust(struct thread *self, const char *comm,
+				   struct hists *hists)
 {
 	int ret = thread__set_comm(self, comm);
 
 	if (ret)
 		return ret;
 
-	thread__comm_adjust(self);
+	thread__comm_adjust(self, hists);
 
 	return 0;
 }
@@ -374,7 +373,8 @@ int event__process_comm(event_t *self, struct perf_session *session)
 
 	dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid);
 
-	if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) {
+	if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm,
+						      &session->hists)) {
 		dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
 		return -1;
 	}
@@ -641,16 +641,13 @@ void thread__find_addr_location(struct thread *self,
 		al->sym = NULL;
 }
 
-static void dso__calc_col_width(struct dso *self)
+static void dso__calc_col_width(struct dso *self, struct hists *hists)
 {
 	if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
 	    (!symbol_conf.dso_list ||
 	     strlist__has_entry(symbol_conf.dso_list, self->name))) {
-		u16 slen = self->short_name_len;
-		if (verbose)
-			slen = self->long_name_len;
-		if (dsos__col_width < slen)
-			dsos__col_width = slen;
+		u16 slen = dso__name_len(self);
+		hists__new_col_len(hists, HISTC_DSO, slen);
 	}
 
 	self->slen_calculated = 1;
@@ -729,16 +726,17 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
 		 * sampled.
 		 */
 		if (!sort_dso.elide && !al->map->dso->slen_calculated)
-			dso__calc_col_width(al->map->dso);
+			dso__calc_col_width(al->map->dso, &session->hists);
 
 		al->sym = map__find_symbol(al->map, al->addr, filter);
 	} else {
 		const unsigned int unresolved_col_width = BITS_PER_LONG / 4;
 
-		if (dsos__col_width < unresolved_col_width &&
+		if (hists__col_len(&session->hists, HISTC_DSO) < unresolved_col_width &&
 		    !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
 		    !symbol_conf.dso_list)
-			dsos__col_width = unresolved_col_width;
+			hists__set_col_len(&session->hists, HISTC_DSO,
+					   unresolved_col_width);
 	}
 
 	if (symbol_conf.sym_list && al->sym &&
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d998d1d..0bc6790 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -16,6 +16,50 @@ struct callchain_param	callchain_param = {
 	.min_percent = 0.5
 };
 
+u16 hists__col_len(struct hists *self, enum hist_column col)
+{
+	return self->col_len[col];
+}
+
+void hists__set_col_len(struct hists *self, enum hist_column col, u16 len)
+{
+	self->col_len[col] = len;
+}
+
+bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len)
+{
+	if (len > hists__col_len(self, col)) {
+		hists__set_col_len(self, col, len);
+		return true;
+	}
+	return false;
+}
+
+static void hists__reset_col_len(struct hists *self)
+{
+	enum hist_column col;
+
+	for (col = 0; col < HISTC_NR_COLS; ++col)
+		hists__set_col_len(self, col, 0);
+}
+
+static void hists__calc_col_len(struct hists *self, struct hist_entry *h)
+{
+	u16 len;
+
+	if (h->ms.sym)
+		hists__new_col_len(self, HISTC_SYMBOL, h->ms.sym->namelen);
+
+	len = thread__comm_len(h->thread);
+	if (hists__new_col_len(self, HISTC_COMM, len))
+		hists__set_col_len(self, HISTC_THREAD, len + 6);
+
+	if (h->ms.map) {
+		len = dso__name_len(h->ms.map->dso);
+		hists__new_col_len(self, HISTC_DSO, len);
+	}
+}
+
 static void hist_entry__add_cpumode_period(struct hist_entry *self,
 					   unsigned int cpumode, u64 period)
 {
@@ -56,13 +100,12 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
 	return self;
 }
 
-static void hists__inc_nr_entries(struct hists *self, struct hist_entry *entry)
+static void hists__inc_nr_entries(struct hists *self, struct hist_entry *h)
 {
-	if (entry->filtered)
-		return;
-	if (entry->ms.sym && self->max_sym_namelen < entry->ms.sym->namelen)
-		self->max_sym_namelen = entry->ms.sym->namelen;
-	++self->nr_entries;
+	if (!h->filtered) {
+		hists__calc_col_len(self, h);
+		++self->nr_entries;
+	}
 }
 
 static u8 symbol__parent_filter(const struct symbol *parent)
@@ -208,7 +251,7 @@ void hists__collapse_resort(struct hists *self)
 	tmp = RB_ROOT;
 	next = rb_first(&self->entries);
 	self->nr_entries = 0;
-	self->max_sym_namelen = 0;
+	hists__reset_col_len(self);
 
 	while (next) {
 		n = rb_entry(next, struct hist_entry, rb_node);
@@ -265,7 +308,7 @@ void hists__output_resort(struct hists *self)
 	next = rb_first(&self->entries);
 
 	self->nr_entries = 0;
-	self->max_sym_namelen = 0;
+	hists__reset_col_len(self);
 
 	while (next) {
 		n = rb_entry(next, struct hist_entry, rb_node);
@@ -532,8 +575,9 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
 }
 
 int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
-			 struct hists *pair_hists, bool show_displacement,
-			 long displacement, bool color, u64 session_total)
+			 struct hists *hists, struct hists *pair_hists,
+			 bool show_displacement, long displacement,
+			 bool color, u64 session_total)
 {
 	struct sort_entry *se;
 	u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us;
@@ -637,24 +681,25 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
 
 		ret += snprintf(s + ret, size - ret, "%s", sep ?: "  ");
 		ret += se->se_snprintf(self, s + ret, size - ret,
-				       se->se_width ? *se->se_width : 0);
+				       hists__col_len(hists, se->se_width_idx));
 	}
 
 	return ret;
 }
 
-int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
-			bool show_displacement, long displacement, FILE *fp,
-			u64 session_total)
+int hist_entry__fprintf(struct hist_entry *self, struct hists *hists,
+			struct hists *pair_hists, bool show_displacement,
+			long displacement, FILE *fp, u64 session_total)
 {
 	char bf[512];
-	hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
+	hist_entry__snprintf(self, bf, sizeof(bf), hists, pair_hists,
 			     show_displacement, displacement,
 			     true, session_total);
 	return fprintf(fp, "%s\n", bf);
 }
 
-static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp,
+static size_t hist_entry__fprintf_callchain(struct hist_entry *self,
+					    struct hists *hists, FILE *fp,
 					    u64 session_total)
 {
 	int left_margin = 0;
@@ -662,7 +707,7 @@ static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp,
 	if (sort__first_dimension == SORT_COMM) {
 		struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
 							 typeof(*se), list);
-		left_margin = se->se_width ? *se->se_width : 0;
+		left_margin = hists__col_len(hists, se->se_width_idx);
 		left_margin -= thread__comm_len(self->thread);
 	}
 
@@ -733,17 +778,17 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 			continue;
 		}
 		width = strlen(se->se_header);
-		if (se->se_width) {
-			if (symbol_conf.col_width_list_str) {
-				if (col_width) {
-					*se->se_width = atoi(col_width);
-					col_width = strchr(col_width, ',');
-					if (col_width)
-						++col_width;
-				}
+		if (symbol_conf.col_width_list_str) {
+			if (col_width) {
+				hists__set_col_len(self, se->se_width_idx,
+						   atoi(col_width));
+				col_width = strchr(col_width, ',');
+				if (col_width)
+					++col_width;
 			}
-			width = *se->se_width = max(*se->se_width, width);
 		}
+		if (!hists__new_col_len(self, se->se_width_idx, width))
+			width = hists__col_len(self, se->se_width_idx);
 		fprintf(fp, "  %*s", width, se->se_header);
 	}
 	fprintf(fp, "\n");
@@ -766,9 +811,8 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 			continue;
 
 		fprintf(fp, "  ");
-		if (se->se_width)
-			width = *se->se_width;
-		else
+		width = hists__col_len(self, se->se_width_idx);
+		if (width == 0)
 			width = strlen(se->se_header);
 		for (i = 0; i < width; i++)
 			fprintf(fp, ".");
@@ -788,12 +832,12 @@ print_entries:
 				displacement = 0;
 			++position;
 		}
-		ret += hist_entry__fprintf(h, pair, show_displacement,
+		ret += hist_entry__fprintf(h, self, pair, show_displacement,
 					   displacement, fp, self->stats.total_period);
 
 		if (symbol_conf.use_callchain)
-			ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period);
-
+			ret += hist_entry__fprintf_callchain(h, self, fp,
+							     self->stats.total_period);
 		if (h->ms.map == NULL && verbose > 1) {
 			__map_groups__fprintf_maps(&h->thread->mg,
 						   MAP__FUNCTION, verbose, fp);
@@ -817,8 +861,7 @@ static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h,
 	self->stats.total_period += h->period;
 	self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events;
 
-	if (h->ms.sym && self->max_sym_namelen < h->ms.sym->namelen)
-		self->max_sym_namelen = h->ms.sym->namelen;
+	hists__calc_col_len(self, h);
 }
 
 void hists__filter_by_dso(struct hists *self, const struct dso *dso)
@@ -827,7 +870,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso)
 
 	self->nr_entries = self->stats.total_period = 0;
 	self->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
-	self->max_sym_namelen = 0;
+	hists__reset_col_len(self);
 
 	for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
@@ -850,7 +893,7 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread)
 
 	self->nr_entries = self->stats.total_period = 0;
 	self->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
-	self->max_sym_namelen = 0;
+	hists__reset_col_len(self);
 
 	for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 83fa33a..92962b2 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -56,6 +56,16 @@ struct events_stats {
 	u32 nr_unknown_events;
 };
 
+enum hist_column {
+	HISTC_SYMBOL,
+	HISTC_DSO,
+	HISTC_THREAD,
+	HISTC_COMM,
+	HISTC_PARENT,
+	HISTC_CPU,
+	HISTC_NR_COLS, /* Last entry */
+};
+
 struct hists {
 	struct rb_node		rb_node;
 	struct rb_root		entries;
@@ -64,7 +74,7 @@ struct hists {
 	u64			config;
 	u64			event_stream;
 	u32			type;
-	u32			max_sym_namelen;
+	u16			col_len[HISTC_NR_COLS];
 };
 
 struct hist_entry *__hists__add_entry(struct hists *self,
@@ -72,12 +82,13 @@ struct hist_entry *__hists__add_entry(struct hists *self,
 				      struct symbol *parent, u64 period);
 extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
 extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
-int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
-			bool show_displacement, long displacement, FILE *fp,
-			u64 total);
+int hist_entry__fprintf(struct hist_entry *self, struct hists *hists,
+			struct hists *pair_hists, bool show_displacement,
+			long displacement, FILE *fp, u64 total);
 int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
-			 struct hists *pair_hists, bool show_displacement,
-			 long displacement, bool color, u64 total);
+			 struct hists *hists, struct hists *pair_hists,
+			 bool show_displacement, long displacement,
+			 bool color, u64 total);
 void hist_entry__free(struct hist_entry *);
 
 void hists__output_resort(struct hists *self);
@@ -95,6 +106,10 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
 void hists__filter_by_dso(struct hists *self, const struct dso *dso);
 void hists__filter_by_thread(struct hists *self, const struct thread *thread);
 
+u16 hists__col_len(struct hists *self, enum hist_column col);
+void hists__set_col_len(struct hists *self, enum hist_column col, u16 len);
+bool hists__new_col_len(struct hists *self, enum hist_column col, u16 len);
+
 #ifdef NO_NEWT_SUPPORT
 static inline int hists__browse(struct hists *self __used,
 				const char *helpline __used,
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 7979003..ab6eb36 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -692,7 +692,8 @@ static void hist_entry__append_callchain_browser(struct hist_entry *self,
 }
 
 static size_t hist_entry__append_browser(struct hist_entry *self,
-					 newtComponent tree, u64 total)
+					 newtComponent tree,
+					 struct hists *hists)
 {
 	char s[256];
 	size_t ret;
@@ -700,8 +701,8 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
 	if (symbol_conf.exclude_other && !self->parent)
 		return 0;
 
-	ret = hist_entry__snprintf(self, s, sizeof(s), NULL,
-				   false, 0, false, total);
+	ret = hist_entry__snprintf(self, s, sizeof(s), hists, NULL,
+				   false, 0, false, hists->stats.total_period);
 	if (symbol_conf.use_callchain) {
 		int indexes[2];
 
@@ -842,7 +843,7 @@ static int hist_browser__populate(struct hist_browser *self, struct hists *hists
 		if (h->filtered)
 			continue;
 
-		len = hist_entry__append_browser(h, self->tree, hists->stats.total_period);
+		len = hist_entry__append_browser(h, self->tree, hists);
 		if (len > max_len)
 			max_len = len;
 		if (symbol_conf.use_callchain)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index c27b4b0..1c61a4f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,4 +1,5 @@
 #include "sort.h"
+#include "hist.h"
 
 regex_t		parent_regex;
 const char	default_parent_pattern[] = "^sys_|^do_page_fault";
@@ -10,11 +11,6 @@ int		sort__has_parent = 0;
 
 enum sort_type	sort__first_dimension;
 
-unsigned int dsos__col_width;
-unsigned int comms__col_width;
-unsigned int threads__col_width;
-unsigned int cpus__col_width;
-static unsigned int parent_symbol__col_width;
 char * field_sep;
 
 LIST_HEAD(hist_entry__sort_list);
@@ -36,7 +32,7 @@ struct sort_entry sort_thread = {
 	.se_header	= "Command:  Pid",
 	.se_cmp		= sort__thread_cmp,
 	.se_snprintf	= hist_entry__thread_snprintf,
-	.se_width	= &threads__col_width,
+	.se_width_idx	= HISTC_THREAD,
 };
 
 struct sort_entry sort_comm = {
@@ -44,34 +40,35 @@ struct sort_entry sort_comm = {
 	.se_cmp		= sort__comm_cmp,
 	.se_collapse	= sort__comm_collapse,
 	.se_snprintf	= hist_entry__comm_snprintf,
-	.se_width	= &comms__col_width,
+	.se_width_idx	= HISTC_COMM,
 };
 
 struct sort_entry sort_dso = {
 	.se_header	= "Shared Object",
 	.se_cmp		= sort__dso_cmp,
 	.se_snprintf	= hist_entry__dso_snprintf,
-	.se_width	= &dsos__col_width,
+	.se_width_idx	= HISTC_DSO,
 };
 
 struct sort_entry sort_sym = {
 	.se_header	= "Symbol",
 	.se_cmp		= sort__sym_cmp,
 	.se_snprintf	= hist_entry__sym_snprintf,
+	.se_width_idx	= HISTC_SYMBOL,
 };
 
 struct sort_entry sort_parent = {
 	.se_header	= "Parent symbol",
 	.se_cmp		= sort__parent_cmp,
 	.se_snprintf	= hist_entry__parent_snprintf,
-	.se_width	= &parent_symbol__col_width,
+	.se_width_idx	= HISTC_PARENT,
 };
  
 struct sort_entry sort_cpu = {
 	.se_header      = "CPU",
 	.se_cmp	        = sort__cpu_cmp,
 	.se_snprintf    = hist_entry__cpu_snprintf,
-	.se_width	= &cpus__col_width,
+	.se_width_idx	= HISTC_CPU,
 };
 
 struct sort_dimension {
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 560c855..03a1722 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -36,10 +36,6 @@ extern struct sort_entry sort_comm;
 extern struct sort_entry sort_dso;
 extern struct sort_entry sort_sym;
 extern struct sort_entry sort_parent;
-extern unsigned int dsos__col_width;
-extern unsigned int comms__col_width;
-extern unsigned int threads__col_width;
-extern unsigned int cpus__col_width;
 extern enum sort_type sort__first_dimension;
 
 struct hist_entry {
@@ -87,7 +83,7 @@ struct sort_entry {
 	int64_t (*se_collapse)(struct hist_entry *, struct hist_entry *);
 	int	(*se_snprintf)(struct hist_entry *self, char *bf, size_t size,
 			       unsigned int width);
-	unsigned int *se_width;
+	u8	se_width_idx;
 	bool	elide;
 };
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 971d0a0..bc6e7e8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -12,6 +12,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include "build-id.h"
+#include "debug.h"
 #include "symbol.h"
 #include "strlist.h"
 
@@ -40,6 +41,14 @@ struct symbol_conf symbol_conf = {
 	.try_vmlinux_path = true,
 };
 
+int dso__name_len(const struct dso *self)
+{
+	if (verbose)
+		return self->long_name_len;
+
+	return self->short_name_len;
+}
+
 bool dso__loaded(const struct dso *self, enum map_type type)
 {
 	return self->loaded & (1 << type);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 80e569b..d436ee3 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -146,6 +146,8 @@ struct dso *dso__new(const char *name);
 struct dso *dso__new_kernel(const char *name);
 void dso__delete(struct dso *self);
 
+int dso__name_len(const struct dso *self);
+
 bool dso__loaded(const struct dso *self, enum map_type type);
 bool dso__sorted_by_name(const struct dso *self, enum map_type type);
 

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

* [tip:perf/core] perf ui: Restore SPACE as an alias to PGDN in annotate
       [not found]             ` <new-submission>
                                 ` (553 preceding siblings ...)
  2010-08-02  7:49               ` [tip:perf/core] perf sort: Make column width code per hists instance tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:49               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:49               ` [tip:perf/core] perf hist: Introduce routine to measure lenght of formatted entry tip-bot for Arnaldo Carvalho de Melo
                                 ` (151 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  b61b55ed995fd2765cd4ec0b22f0348dee272070
Gitweb:     http://git.kernel.org/tip/b61b55ed995fd2765cd4ec0b22f0348dee272070
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 21 Jul 2010 17:55:32 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:24:31 -0300

perf ui: Restore SPACE as an alias to PGDN in annotate

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index ab6eb36..2f5f7a1 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -750,6 +750,7 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 
 	browser.width += 18; /* Percentage */
 	ui_browser__show(&browser, self->ms.sym->name);
+	newtFormAddHotKey(browser.form, ' ');
 	ret = ui_browser__run(&browser, &es);
 	newtFormDestroy(browser.form);
 	newtPopWindow();

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

* [tip:perf/core] perf hist: Introduce routine to measure lenght of formatted entry
       [not found]             ` <new-submission>
                                 ` (554 preceding siblings ...)
  2010-08-02  7:49               ` [tip:perf/core] perf ui: Restore SPACE as an alias to PGDN in annotate tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:49               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:50               ` [tip:perf/core] perf ui: Consider the refreshed dimensions in ui_browser__show tip-bot for Arnaldo Carvalho de Melo
                                 ` (150 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  06daaaba7c211ca6a8227b9a54dbc86dd837f034
Gitweb:     http://git.kernel.org/tip/06daaaba7c211ca6a8227b9a54dbc86dd837f034
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 21 Jul 2010 17:58:25 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:24:31 -0300

perf hist: Introduce routine to measure lenght of formatted entry

Will be used to figure out the window width needed in the new tree
widget.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |   27 +++++++++++++++++++++++++++
 tools/perf/util/hist.h |    3 +++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 0bc6790..f93095f 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -850,6 +850,33 @@ print_entries:
 	return ret;
 }
 
+/*
+ * See hists__fprintf to match the column widths
+ */
+unsigned int hists__sort_list_width(struct hists *self)
+{
+	struct sort_entry *se;
+	int ret = 9; /* total % */
+
+	if (symbol_conf.show_cpu_utilization) {
+		ret += 7; /* count_sys % */
+		ret += 6; /* count_us % */
+		if (perf_guest) {
+			ret += 13; /* count_guest_sys % */
+			ret += 12; /* count_guest_us % */
+		}
+	}
+
+	if (symbol_conf.show_nr_samples)
+		ret += 11;
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		if (!se->elide)
+			ret += 2 + hists__col_len(self, se->se_width_idx);
+
+	return ret;
+}
+
 static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h,
 				       enum hist_filter filter)
 {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 92962b2..65a48db 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -141,4 +141,7 @@ int hist_entry__tui_annotate(struct hist_entry *self);
 
 int hists__tui_browse_tree(struct rb_root *self, const char *help);
 #endif
+
+unsigned int hists__sort_list_width(struct hists *self);
+
 #endif	/* __PERF_HIST_H */

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

* [tip:perf/core] perf ui: Consider the refreshed dimensions in ui_browser__show
       [not found]             ` <new-submission>
                                 ` (555 preceding siblings ...)
  2010-08-02  7:49               ` [tip:perf/core] perf hist: Introduce routine to measure lenght of formatted entry tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:50               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:50               ` [tip:perf/core] perf ui: Show the scroll bar over the left window frame tip-bot for Arnaldo Carvalho de Melo
                                 ` (149 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  63160f73e7baa6618f19d7681bcab5be5c557205
Gitweb:     http://git.kernel.org/tip/63160f73e7baa6618f19d7681bcab5be5c557205
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 26 Jul 2010 13:47:15 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:24:31 -0300

perf ui: Consider the refreshed dimensions in ui_browser__show

When we call ui_browser__show we may have called
ui_browser__refresh_dimensions to check if the maximum lenght for the
contained entries changed, such as when zooming in and out DSOs or
threads in the hist browser.

For that to happen we must delete the old form, that will take care of
deleting the vertical scrollbar, etc, and then recreate them, with the
new dimensions.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 2f5f7a1..aed2149 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -342,8 +342,10 @@ static void ui_browser__reset_index(struct ui_browser *self)
 
 static int ui_browser__show(struct ui_browser *self, const char *title)
 {
-	if (self->form != NULL)
-		return 0;
+	if (self->form != NULL) {
+		newtFormDestroy(self->form);
+		newtPopWindow();
+	}
 	ui_browser__refresh_dimensions(self);
 	newtCenteredWindow(self->width + 2, self->height, title);
 	self->form = newt_form__new();

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

* [tip:perf/core] perf ui: Show the scroll bar over the left window frame
       [not found]             ` <new-submission>
                                 ` (556 preceding siblings ...)
  2010-08-02  7:50               ` [tip:perf/core] perf ui: Consider the refreshed dimensions in ui_browser__show tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:50               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:50               ` [tip:perf/core] perf ui: New hists tree widget tip-bot for Arnaldo Carvalho de Melo
                                 ` (148 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  8d8c369f3d697e31e04133ca18b516952549ee33
Gitweb:     http://git.kernel.org/tip/8d8c369f3d697e31e04133ca18b516952549ee33
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 26 Jul 2010 14:08:48 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:24:31 -0300

perf ui: Show the scroll bar over the left window frame

So that we gain two columns and look more like classical (at least in
TUIs) scroll bars bars.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index aed2149..cdd958e 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -347,12 +347,12 @@ static int ui_browser__show(struct ui_browser *self, const char *title)
 		newtPopWindow();
 	}
 	ui_browser__refresh_dimensions(self);
-	newtCenteredWindow(self->width + 2, self->height, title);
+	newtCenteredWindow(self->width, self->height, title);
 	self->form = newt_form__new();
 	if (self->form == NULL)
 		return -1;
 
-	self->sb = newtVerticalScrollbar(self->width + 1, 0, self->height,
+	self->sb = newtVerticalScrollbar(self->width, 0, self->height,
 					 HE_COLORSET_NORMAL,
 					 HE_COLORSET_SELECTED);
 	if (self->sb == NULL)

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

* [tip:perf/core] perf ui: New hists tree widget
       [not found]             ` <new-submission>
                                 ` (557 preceding siblings ...)
  2010-08-02  7:50               ` [tip:perf/core] perf ui: Show the scroll bar over the left window frame tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:50               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:51               ` [tip:perf/core] perf report: Don't abbreviate file paths relative to the cwd tip-bot for Dave Martin
                                 ` (147 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  0f0cbf7aa3d3460a3eb201a772326739a0c0210a
Gitweb:     http://git.kernel.org/tip/0f0cbf7aa3d3460a3eb201a772326739a0c0210a
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 26 Jul 2010 17:13:40 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:24:31 -0300

perf ui: New hists tree widget

The stock newt checkbox tree widget we were using was not really
suitable for hist entry + callchain browsing.

The problems with it were manifold:

- We needed to traverse the whole hist_entry rb_tree to add each entry +
  callchains beforehand.

- No control over the colors used for each row

So a new tree widget, based mostly on slang, was written.

It extends the ui_browser class already used for annotate to allow the
user to fold/unfold branches in the callchains tree, using extra fields
in the symbol_map class that is embedded in hist_entry and
callchain_node instances to store the folding state and when changing
this state calculates the number of rows that are produced when showing
a particular hist_entry instance.

This greatly speeds up browsing as we don't have to upfront touch all
the entries and only calculate callchain related operations when some
callchain branch is actually unfolded.

The memory footprint is also reduced as the data structure is not
duplicated, just some extra fields for controling callchain state and to
simplify the process of seeking thru entries (nr_rows, row_offset) were
added.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c   |    3 +
 tools/perf/util/newt.c   |  972 +++++++++++++++++++++++++++++++---------------
 tools/perf/util/sort.h   |   12 +
 tools/perf/util/symbol.h |    2 +
 4 files changed, 678 insertions(+), 311 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index f93095f..d0f07f7 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -885,6 +885,9 @@ static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h,
 		return;
 
 	++self->nr_entries;
+	if (h->ms.unfolded)
+		self->nr_entries += h->nr_rows;
+	h->row_offset = 0;
 	self->stats.total_period += h->period;
 	self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events;
 
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index cdd958e..28f74eb 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -509,38 +509,6 @@ static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 	return 0;
 }
 
-/*
- * When debugging newt problems it was useful to be able to "unroll"
- * the calls to newtCheckBoxTreeAdd{Array,Item}, so that we can generate
- * a source file with the sequence of calls to these methods, to then
- * tweak the arrays to get the intended results, so I'm keeping this code
- * here, may be useful again in the future.
- */
-#undef NEWT_DEBUG
-
-static void newt_checkbox_tree__add(newtComponent tree, const char *str,
-				    void *priv, int *indexes)
-{
-#ifdef NEWT_DEBUG
-	/* Print the newtCheckboxTreeAddArray to tinker with its index arrays */
-	int i = 0, len = 40 - strlen(str);
-
-	fprintf(stderr,
-		"\tnewtCheckboxTreeAddItem(tree, %*.*s\"%s\", (void *)%p, 0, ",
-		len, len, " ", str, priv);
-	while (indexes[i] != NEWT_ARG_LAST) {
-		if (indexes[i] != NEWT_ARG_APPEND)
-			fprintf(stderr, " %d,", indexes[i]);
-		else
-			fprintf(stderr, " %s,", "NEWT_ARG_APPEND");
-		++i;
-	}
-	fprintf(stderr, " %s", " NEWT_ARG_LAST);\n");
-	fflush(stderr);
-#endif
-	newtCheckboxTreeAddArray(tree, str, priv, 0, indexes);
-}
-
 static char *callchain_list__sym_name(struct callchain_list *self,
 				      char *bf, size_t bfsize)
 {
@@ -576,147 +544,6 @@ static unsigned int hist_entry__annotate_browser_refresh(struct ui_browser *self
 	return row;
 }
 
-static void __callchain__append_graph_browser(struct callchain_node *self,
-					      newtComponent tree, u64 total,
-					      int *indexes, int depth)
-{
-	struct rb_node *node;
-	u64 new_total, remaining;
-	int idx = 0;
-
-	if (callchain_param.mode == CHAIN_GRAPH_REL)
-		new_total = self->children_hit;
-	else
-		new_total = total;
-
-	remaining = new_total;
-	node = rb_first(&self->rb_root);
-	while (node) {
-		struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
-		struct rb_node *next = rb_next(node);
-		u64 cumul = cumul_hits(child);
-		struct callchain_list *chain;
-		int first = true, printed = 0;
-		int chain_idx = -1;
-		remaining -= cumul;
-
-		indexes[depth] = NEWT_ARG_APPEND;
-		indexes[depth + 1] = NEWT_ARG_LAST;
-
-		list_for_each_entry(chain, &child->val, list) {
-			char ipstr[BITS_PER_LONG / 4 + 1],
-			     *alloc_str = NULL;
-			const char *str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-
-			if (first) {
-				double percent = cumul * 100.0 / new_total;
-
-				first = false;
-				if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0)
-					str = "Not enough memory!";
-				else
-					str = alloc_str;
-			} else {
-				indexes[depth] = idx;
-				indexes[depth + 1] = NEWT_ARG_APPEND;
-				indexes[depth + 2] = NEWT_ARG_LAST;
-				++chain_idx;
-			}
-			newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
-			free(alloc_str);
-			++printed;
-		}
-
-		indexes[depth] = idx;
-		if (chain_idx != -1)
-			indexes[depth + 1] = chain_idx;
-		if (printed != 0)
-			++idx;
-		__callchain__append_graph_browser(child, tree, new_total, indexes,
-						  depth + (chain_idx != -1 ? 2 : 1));
-		node = next;
-	}
-}
-
-static void callchain__append_graph_browser(struct callchain_node *self,
-					    newtComponent tree, u64 total,
-					    int *indexes, int parent_idx)
-{
-	struct callchain_list *chain;
-	int i = 0;
-
-	indexes[1] = NEWT_ARG_APPEND;
-	indexes[2] = NEWT_ARG_LAST;
-
-	list_for_each_entry(chain, &self->val, list) {
-		char ipstr[BITS_PER_LONG / 4 + 1], *str;
-
-		if (chain->ip >= PERF_CONTEXT_MAX)
-			continue;
-
-		if (!i++ && sort__first_dimension == SORT_SYM)
-			continue;
-
-		str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-		newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
-	}
-
-	indexes[1] = parent_idx;
-	indexes[2] = NEWT_ARG_APPEND;
-	indexes[3] = NEWT_ARG_LAST;
-	__callchain__append_graph_browser(self, tree, total, indexes, 2);
-}
-
-static void hist_entry__append_callchain_browser(struct hist_entry *self,
-						 newtComponent tree, u64 total, int parent_idx)
-{
-	struct rb_node *rb_node;
-	int indexes[1024] = { [0] = parent_idx, };
-	int idx = 0;
-	struct callchain_node *chain;
-
-	rb_node = rb_first(&self->sorted_chain);
-	while (rb_node) {
-		chain = rb_entry(rb_node, struct callchain_node, rb_node);
-		switch (callchain_param.mode) {
-		case CHAIN_FLAT:
-			break;
-		case CHAIN_GRAPH_ABS: /* falldown */
-		case CHAIN_GRAPH_REL:
-			callchain__append_graph_browser(chain, tree, total, indexes, idx++);
-			break;
-		case CHAIN_NONE:
-		default:
-			break;
-		}
-		rb_node = rb_next(rb_node);
-	}
-}
-
-static size_t hist_entry__append_browser(struct hist_entry *self,
-					 newtComponent tree,
-					 struct hists *hists)
-{
-	char s[256];
-	size_t ret;
-
-	if (symbol_conf.exclude_other && !self->parent)
-		return 0;
-
-	ret = hist_entry__snprintf(self, s, sizeof(s), hists, NULL,
-				   false, 0, false, hists->stats.total_period);
-	if (symbol_conf.use_callchain) {
-		int indexes[2];
-
-		indexes[0] = NEWT_ARG_APPEND;
-		indexes[1] = NEWT_ARG_LAST;
-		newt_checkbox_tree__add(tree, s, &self->ms, indexes);
-	} else
-		newtListboxAppendEntry(tree, s, &self->ms);
-
-	return ret;
-}
-
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
 	struct ui_browser browser;
@@ -764,157 +591,48 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 	return ret;
 }
 
-static const void *newt__symbol_tree_get_current(newtComponent self)
-{
-	if (symbol_conf.use_callchain)
-		return newtCheckboxTreeGetCurrent(self);
-	return newtListboxGetCurrent(self);
-}
-
-static void hist_browser__selection(newtComponent self, void *data)
-{
-	const struct map_symbol **symbol_ptr = data;
-	*symbol_ptr = newt__symbol_tree_get_current(self);
-}
-
 struct hist_browser {
-	newtComponent		form, tree;
-	const struct map_symbol *selection;
+	struct ui_browser   b;
+	struct hists	    *hists;
+	struct hist_entry   *he_selection;
+	struct map_symbol   *selection;
 };
 
-static struct hist_browser *hist_browser__new(void)
+static void hist_browser__reset(struct hist_browser *self);
+static int hist_browser__run(struct hist_browser *self, const char *title,
+			     struct newtExitStruct *es);
+static unsigned int hist_browser__refresh_entries(struct ui_browser *self);
+static void ui_browser__hists_seek(struct ui_browser *self,
+				   off_t offset, int whence);
+
+static struct hist_browser *hist_browser__new(struct hists *hists)
 {
-	struct hist_browser *self = malloc(sizeof(*self));
+	struct hist_browser *self = zalloc(sizeof(*self));
 
-	if (self != NULL)
-		self->form = NULL;
+	if (self) {
+		self->hists = hists;
+		self->b.refresh_entries = hist_browser__refresh_entries;
+		self->b.seek = ui_browser__hists_seek;
+	}
 
 	return self;
 }
 
 static void hist_browser__delete(struct hist_browser *self)
 {
-	newtFormDestroy(self->form);
+	newtFormDestroy(self->b.form);
 	newtPopWindow();
 	free(self);
 }
 
-static int hist_browser__populate(struct hist_browser *self, struct hists *hists,
-				  const char *title)
-{
-	int max_len = 0, idx, cols, rows;
-	struct ui_progress *progress;
-	struct rb_node *nd;
-	u64 curr_hist = 0;
-	char seq[] = ".", unit;
-	char str[256];
-	unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE];
-
-	if (self->form) {
-		newtFormDestroy(self->form);
-		newtPopWindow();
-	}
-
-	nr_events = convert_unit(nr_events, &unit);
-	snprintf(str, sizeof(str), "Events: %lu%c                            ",
-		 nr_events, unit);
-	newtDrawRootText(0, 0, str);
-
-	newtGetScreenSize(NULL, &rows);
-
-	if (symbol_conf.use_callchain)
-		self->tree = newtCheckboxTreeMulti(0, 0, rows - 5, seq,
-						   NEWT_FLAG_SCROLL);
-	else
-		self->tree = newtListbox(0, 0, rows - 5,
-					(NEWT_FLAG_SCROLL |
-					 NEWT_FLAG_RETURNEXIT));
-
-	newtComponentAddCallback(self->tree, hist_browser__selection,
-				 &self->selection);
-
-	progress = ui_progress__new("Adding entries to the browser...",
-				    hists->nr_entries);
-	if (progress == NULL)
-		return -1;
-
-	idx = 0;
-	for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
-		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
-		int len;
-
-		if (h->filtered)
-			continue;
-
-		len = hist_entry__append_browser(h, self->tree, hists);
-		if (len > max_len)
-			max_len = len;
-		if (symbol_conf.use_callchain)
-			hist_entry__append_callchain_browser(h, self->tree,
-							     hists->stats.total_period, idx++);
-		++curr_hist;
-		if (curr_hist % 5)
-			ui_progress__update(progress, curr_hist);
-	}
-
-	ui_progress__delete(progress);
-
-	newtGetScreenSize(&cols, &rows);
-
-	if (max_len > cols)
-		max_len = cols - 3;
-
-	if (!symbol_conf.use_callchain)
-		newtListboxSetWidth(self->tree, max_len);
-
-	newtCenteredWindow(max_len + (symbol_conf.use_callchain ? 5 : 0),
-			   rows - 5, title);
-	self->form = newt_form__new();
-	if (self->form == NULL)
-		return -1;
-
-	newtFormAddHotKey(self->form, 'A');
-	newtFormAddHotKey(self->form, 'a');
-	newtFormAddHotKey(self->form, 'D');
-	newtFormAddHotKey(self->form, 'd');
-	newtFormAddHotKey(self->form, 'T');
-	newtFormAddHotKey(self->form, 't');
-	newtFormAddHotKey(self->form, '?');
-	newtFormAddHotKey(self->form, 'H');
-	newtFormAddHotKey(self->form, 'h');
-	newtFormAddHotKey(self->form, NEWT_KEY_F1);
-	newtFormAddHotKey(self->form, NEWT_KEY_RIGHT);
-	newtFormAddHotKey(self->form, NEWT_KEY_TAB);
-	newtFormAddHotKey(self->form, NEWT_KEY_UNTAB);
-	newtFormAddComponents(self->form, self->tree, NULL);
-	self->selection = newt__symbol_tree_get_current(self->tree);
-
-	return 0;
-}
-
 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *self)
 {
-	int *indexes;
-
-	if (!symbol_conf.use_callchain)
-		goto out;
-
-	indexes = newtCheckboxTreeFindItem(self->tree, (void *)self->selection);
-	if (indexes) {
-		bool is_hist_entry = indexes[1] == NEWT_ARG_LAST;
-		free(indexes);
-		if (is_hist_entry)
-			goto out;
-	}
-	return NULL;
-out:
-	return container_of(self->selection, struct hist_entry, ms);
+	return self->he_selection;
 }
 
 static struct thread *hist_browser__selected_thread(struct hist_browser *self)
 {
-	struct hist_entry *he = hist_browser__selected_entry(self);
-	return he ? he->thread : NULL;
+	return self->he_selection->thread;
 }
 
 static int hist_browser__title(char *bf, size_t size, const char *ev_name,
@@ -936,7 +654,7 @@ static int hist_browser__title(char *bf, size_t size, const char *ev_name,
 
 int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 {
-	struct hist_browser *browser = hist_browser__new();
+	struct hist_browser *browser = hist_browser__new(self);
 	struct pstack *fstack;
 	const struct thread *thread_filter = NULL;
 	const struct dso *dso_filter = NULL;
@@ -955,8 +673,6 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 
 	hist_browser__title(msg, sizeof(msg), ev_name,
 			    dso_filter, thread_filter);
-	if (hist_browser__populate(browser, self, msg) < 0)
-		goto out_free_stack;
 
 	while (1) {
 		const struct thread *thread;
@@ -965,7 +681,8 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 		int nr_options = 0, choice = 0, i,
 		    annotate = -2, zoom_dso = -2, zoom_thread = -2;
 
-		newtFormRun(browser->form, &es);
+		if (hist_browser__run(browser, msg, &es))
+			break;
 
 		thread = hist_browser__selected_thread(browser);
 		dso = browser->selection->map ? browser->selection->map->dso : NULL;
@@ -1100,8 +817,7 @@ zoom_out_dso:
 			hists__filter_by_dso(self, dso_filter);
 			hist_browser__title(msg, sizeof(msg), ev_name,
 					    dso_filter, thread_filter);
-			if (hist_browser__populate(browser, self, msg) < 0)
-				goto out;
+			hist_browser__reset(browser);
 		} else if (choice == zoom_thread) {
 zoom_thread:
 			if (thread_filter) {
@@ -1119,8 +835,7 @@ zoom_out_thread:
 			hists__filter_by_thread(self, thread_filter);
 			hist_browser__title(msg, sizeof(msg), ev_name,
 					    dso_filter, thread_filter);
-			if (hist_browser__populate(browser, self, msg) < 0)
-				goto out;
+			hist_browser__reset(browser);
 		}
 	}
 out_free_stack:
@@ -1207,3 +922,638 @@ void exit_browser(bool wait_for_ok)
 		newtFinished();
 	}
 }
+
+static void hist_browser__refresh_dimensions(struct hist_browser *self)
+{
+	/* 3 == +/- toggle symbol before actual hist_entry rendering */
+	self->b.width = 3 + (hists__sort_list_width(self->hists) +
+			     sizeof("[k]"));
+}
+
+static void hist_browser__reset(struct hist_browser *self)
+{
+	self->b.nr_entries = self->hists->nr_entries;
+	hist_browser__refresh_dimensions(self);
+	ui_browser__reset_index(&self->b);
+}
+
+static char tree__folded_sign(bool unfolded)
+{
+	return unfolded ? '-' : '+';
+}
+
+static char map_symbol__folded(const struct map_symbol *self)
+{
+	return self->has_children ? tree__folded_sign(self->unfolded) : ' ';
+}
+
+static char hist_entry__folded(const struct hist_entry *self)
+{
+	return map_symbol__folded(&self->ms);
+}
+
+static char callchain_list__folded(const struct callchain_list *self)
+{
+	return map_symbol__folded(&self->ms);
+}
+
+static bool map_symbol__toggle_fold(struct map_symbol *self)
+{
+	if (!self->has_children)
+		return false;
+
+	self->unfolded = !self->unfolded;
+	return true;
+}
+
+#define LEVEL_OFFSET_STEP 3
+
+static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
+						     struct callchain_node *chain_node,
+						     u64 total, int level,
+						     unsigned short row,
+						     off_t *row_offset,
+						     bool *is_current_entry)
+{
+	struct rb_node *node;
+	int first_row = row, width, offset = level * LEVEL_OFFSET_STEP;
+	u64 new_total, remaining;
+
+	if (callchain_param.mode == CHAIN_GRAPH_REL)
+		new_total = chain_node->children_hit;
+	else
+		new_total = total;
+
+	remaining = new_total;
+	node = rb_first(&chain_node->rb_root);
+	while (node) {
+		struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
+		struct rb_node *next = rb_next(node);
+		u64 cumul = cumul_hits(child);
+		struct callchain_list *chain;
+		char folded_sign = ' ';
+		int first = true;
+		int extra_offset = 0;
+
+		remaining -= cumul;
+
+		list_for_each_entry(chain, &child->val, list) {
+			char ipstr[BITS_PER_LONG / 4 + 1], *alloc_str;
+			const char *str;
+			int color;
+			bool was_first = first;
+
+			if (first) {
+				first = false;
+				chain->ms.has_children = chain->list.next != &child->val ||
+							 rb_first(&child->rb_root) != NULL;
+			} else {
+				extra_offset = LEVEL_OFFSET_STEP;
+				chain->ms.has_children = chain->list.next == &child->val &&
+							 rb_first(&child->rb_root) != NULL;
+			}
+
+			folded_sign = callchain_list__folded(chain);
+			if (*row_offset != 0) {
+				--*row_offset;
+				goto do_next;
+			}
+
+			alloc_str = NULL;
+			str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
+			if (was_first) {
+				double percent = cumul * 100.0 / new_total;
+
+				if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0)
+					str = "Not enough memory!";
+				else
+					str = alloc_str;
+			}
+
+			color = HE_COLORSET_NORMAL;
+			width = self->b.width - (offset + extra_offset + 2);
+			if (ui_browser__is_current_entry(&self->b, row)) {
+				self->selection = &chain->ms;
+				color = HE_COLORSET_SELECTED;
+				*is_current_entry = true;
+			}
+
+			SLsmg_set_color(color);
+			SLsmg_gotorc(self->b.top + row, self->b.left);
+			slsmg_write_nstring(" ", offset + extra_offset);
+			slsmg_printf("%c ", folded_sign);
+			slsmg_write_nstring(str, width);
+			free(alloc_str);
+
+			if (++row == self->b.height)
+				goto out;
+do_next:
+			if (folded_sign == '+')
+				break;
+		}
+
+		if (folded_sign == '-') {
+			const int new_level = level + (extra_offset ? 2 : 1);
+			row += hist_browser__show_callchain_node_rb_tree(self, child, new_total,
+									 new_level, row, row_offset,
+									 is_current_entry);
+		}
+		if (row == self->b.height)
+			goto out;
+		node = next;
+	}
+out:
+	return row - first_row;
+}
+
+static int hist_browser__show_callchain_node(struct hist_browser *self,
+					     struct callchain_node *node,
+					     int level, unsigned short row,
+					     off_t *row_offset,
+					     bool *is_current_entry)
+{
+	struct callchain_list *chain;
+	int first_row = row,
+	     offset = level * LEVEL_OFFSET_STEP,
+	     width = self->b.width - offset;
+	char folded_sign = ' ';
+
+	list_for_each_entry(chain, &node->val, list) {
+		char ipstr[BITS_PER_LONG / 4 + 1], *s;
+		int color;
+		/*
+		 * FIXME: This should be moved to somewhere else,
+		 * probably when the callchain is created, so as not to
+		 * traverse it all over again
+		 */
+		chain->ms.has_children = rb_first(&node->rb_root) != NULL;
+		folded_sign = callchain_list__folded(chain);
+
+		if (*row_offset != 0) {
+			--*row_offset;
+			continue;
+		}
+
+		color = HE_COLORSET_NORMAL;
+		if (ui_browser__is_current_entry(&self->b, row)) {
+			self->selection = &chain->ms;
+			color = HE_COLORSET_SELECTED;
+			*is_current_entry = true;
+		}
+
+		s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
+		SLsmg_gotorc(self->b.top + row, self->b.left);
+		SLsmg_set_color(color);
+		slsmg_write_nstring(" ", offset);
+		slsmg_printf("%c ", folded_sign);
+		slsmg_write_nstring(s, width - 2);
+
+		if (++row == self->b.height)
+			goto out;
+	}
+
+	if (folded_sign == '-')
+		row += hist_browser__show_callchain_node_rb_tree(self, node,
+								 self->hists->stats.total_period,
+								 level + 1, row,
+								 row_offset,
+								 is_current_entry);
+out:
+	return row - first_row;
+}
+
+static int hist_browser__show_callchain(struct hist_browser *self,
+					struct rb_root *chain,
+					int level, unsigned short row,
+					off_t *row_offset,
+					bool *is_current_entry)
+{
+	struct rb_node *nd;
+	int first_row = row;
+
+	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+
+		row += hist_browser__show_callchain_node(self, node, level,
+							 row, row_offset,
+							 is_current_entry);
+		if (row == self->b.height)
+			break;
+	}
+
+	return row - first_row;
+}
+
+static int hist_browser__show_entry(struct hist_browser *self,
+				    struct hist_entry *entry,
+				    unsigned short row)
+{
+	char s[256];
+	double percent;
+	int printed = 0;
+	int color, width = self->b.width;
+	char folded_sign = ' ';
+	bool current_entry = ui_browser__is_current_entry(&self->b, row);
+	off_t row_offset = entry->row_offset;
+
+	if (current_entry) {
+		self->he_selection = entry;
+		self->selection = &entry->ms;
+	}
+
+	if (symbol_conf.use_callchain) {
+		entry->ms.has_children = !RB_EMPTY_ROOT(&entry->sorted_chain);
+		folded_sign = hist_entry__folded(entry);
+	}
+
+	if (row_offset == 0) {
+		hist_entry__snprintf(entry, s, sizeof(s), self->hists, NULL, false,
+				     0, false, self->hists->stats.total_period);
+		percent = (entry->period * 100.0) / self->hists->stats.total_period;
+
+		color = HE_COLORSET_SELECTED;
+		if (!current_entry) {
+			if (percent >= MIN_RED)
+				color = HE_COLORSET_TOP;
+			else if (percent >= MIN_GREEN)
+				color = HE_COLORSET_MEDIUM;
+			else
+				color = HE_COLORSET_NORMAL;
+		}
+
+		SLsmg_set_color(color);
+		SLsmg_gotorc(self->b.top + row, self->b.left);
+		if (symbol_conf.use_callchain) {
+			slsmg_printf("%c ", folded_sign);
+			width -= 2;
+		}
+		slsmg_write_nstring(s, width);
+		++row;
+		++printed;
+	} else
+		--row_offset;
+
+	if (folded_sign == '-' && row != self->b.height) {
+		printed += hist_browser__show_callchain(self, &entry->sorted_chain,
+							1, row, &row_offset,
+							&current_entry);
+		if (current_entry)
+			self->he_selection = entry;
+	}
+
+	return printed;
+}
+
+static unsigned int hist_browser__refresh_entries(struct ui_browser *self)
+{
+	unsigned row = 0;
+	struct rb_node *nd;
+	struct hist_browser *hb = container_of(self, struct hist_browser, b);
+
+	if (self->first_visible_entry == NULL)
+		self->first_visible_entry = rb_first(&hb->hists->entries);
+
+	for (nd = self->first_visible_entry; nd; nd = rb_next(nd)) {
+		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+		if (h->filtered)
+			continue;
+
+		row += hist_browser__show_entry(hb, h, row);
+		if (row == self->height)
+			break;
+	}
+
+	return row;
+}
+
+static void callchain_node__init_have_children_rb_tree(struct callchain_node *self)
+{
+	struct rb_node *nd = rb_first(&self->rb_root);
+
+	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
+		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_list *chain;
+		int first = true;
+
+		list_for_each_entry(chain, &child->val, list) {
+			if (first) {
+				first = false;
+				chain->ms.has_children = chain->list.next != &child->val ||
+							 rb_first(&child->rb_root) != NULL;
+			} else
+				chain->ms.has_children = chain->list.next == &child->val &&
+							 rb_first(&child->rb_root) != NULL;
+		}
+
+		callchain_node__init_have_children_rb_tree(child);
+	}
+}
+
+static void callchain_node__init_have_children(struct callchain_node *self)
+{
+	struct callchain_list *chain;
+
+	list_for_each_entry(chain, &self->val, list)
+		chain->ms.has_children = rb_first(&self->rb_root) != NULL;
+
+	callchain_node__init_have_children_rb_tree(self);
+}
+
+static void callchain__init_have_children(struct rb_root *self)
+{
+	struct rb_node *nd;
+
+	for (nd = rb_first(self); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+		callchain_node__init_have_children(node);
+	}
+}
+
+static void hist_entry__init_have_children(struct hist_entry *self)
+{
+	if (!self->init_have_children) {
+		callchain__init_have_children(&self->sorted_chain);
+		self->init_have_children = true;
+	}
+}
+
+static struct rb_node *hists__filter_entries(struct rb_node *nd)
+{
+	while (nd != NULL) {
+		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+		if (!h->filtered)
+			return nd;
+
+		nd = rb_next(nd);
+	}
+
+	return NULL;
+}
+
+static struct rb_node *hists__filter_prev_entries(struct rb_node *nd)
+{
+	while (nd != NULL) {
+		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+		if (!h->filtered)
+			return nd;
+
+		nd = rb_prev(nd);
+	}
+
+	return NULL;
+}
+
+static void ui_browser__hists_seek(struct ui_browser *self,
+				   off_t offset, int whence)
+{
+	struct hist_entry *h;
+	struct rb_node *nd;
+	bool first = true;
+
+	switch (whence) {
+	case SEEK_SET:
+		nd = hists__filter_entries(rb_first(self->entries));
+		break;
+	case SEEK_CUR:
+		nd = self->first_visible_entry;
+		goto do_offset;
+	case SEEK_END:
+		nd = hists__filter_prev_entries(rb_last(self->entries));
+		first = false;
+		break;
+	default:
+		return;
+	}
+
+	/*
+	 * Moves not relative to the first visible entry invalidates its
+	 * row_offset:
+	 */
+	h = rb_entry(self->first_visible_entry, struct hist_entry, rb_node);
+	h->row_offset = 0;
+
+	/*
+	 * Here we have to check if nd is expanded (+), if it is we can't go
+	 * the next top level hist_entry, instead we must compute an offset of
+	 * what _not_ to show and not change the first visible entry.
+	 *
+	 * This offset increments when we are going from top to bottom and
+	 * decreases when we're going from bottom to top.
+	 *
+	 * As we don't have backpointers to the top level in the callchains
+	 * structure, we need to always print the whole hist_entry callchain,
+	 * skipping the first ones that are before the first visible entry
+	 * and stop when we printed enough lines to fill the screen.
+	 */
+do_offset:
+	if (offset > 0) {
+		do {
+			h = rb_entry(nd, struct hist_entry, rb_node);
+			if (h->ms.unfolded) {
+				u16 remaining = h->nr_rows - h->row_offset;
+				if (offset > remaining) {
+					offset -= remaining;
+					h->row_offset = 0;
+				} else {
+					h->row_offset += offset;
+					offset = 0;
+					self->first_visible_entry = nd;
+					break;
+				}
+			}
+			nd = hists__filter_entries(rb_next(nd));
+			if (nd == NULL)
+				break;
+			--offset;
+			self->first_visible_entry = nd;
+		} while (offset != 0);
+	} else if (offset < 0) {
+		while (1) {
+			h = rb_entry(nd, struct hist_entry, rb_node);
+			if (h->ms.unfolded) {
+				if (first) {
+					if (-offset > h->row_offset) {
+						offset += h->row_offset;
+						h->row_offset = 0;
+					} else {
+						h->row_offset += offset;
+						offset = 0;
+						self->first_visible_entry = nd;
+						break;
+					}
+				} else {
+					if (-offset > h->nr_rows) {
+						offset += h->nr_rows;
+						h->row_offset = 0;
+					} else {
+						h->row_offset = h->nr_rows + offset;
+						offset = 0;
+						self->first_visible_entry = nd;
+						break;
+					}
+				}
+			}
+
+			nd = hists__filter_prev_entries(rb_prev(nd));
+			if (nd == NULL)
+				break;
+			++offset;
+			self->first_visible_entry = nd;
+			if (offset == 0) {
+				/*
+				 * Last unfiltered hist_entry, check if it is
+				 * unfolded, if it is then we should have
+				 * row_offset at its last entry.
+				 */
+				h = rb_entry(nd, struct hist_entry, rb_node);
+				if (h->ms.unfolded)
+					h->row_offset = h->nr_rows;
+				break;
+			}
+			first = false;
+		}
+	} else {
+		self->first_visible_entry = nd;
+		h = rb_entry(nd, struct hist_entry, rb_node);
+		h->row_offset = 0;
+	}
+}
+
+static int callchain_node__count_rows_rb_tree(struct callchain_node *self)
+{
+	int n = 0;
+	struct rb_node *nd;
+
+	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
+		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_list *chain;
+		char folded_sign = ' '; /* No children */
+
+		list_for_each_entry(chain, &child->val, list) {
+			++n;
+			/* We need this because we may not have children */
+			folded_sign = callchain_list__folded(chain);
+			if (folded_sign == '+')
+				break;
+		}
+
+		if (folded_sign == '-') /* Have children and they're unfolded */
+			n += callchain_node__count_rows_rb_tree(child);
+	}
+
+	return n;
+}
+
+static int callchain_node__count_rows(struct callchain_node *node)
+{
+	struct callchain_list *chain;
+	bool unfolded = false;
+	int n = 0;
+
+	list_for_each_entry(chain, &node->val, list) {
+		++n;
+		unfolded = chain->ms.unfolded;
+	}
+
+	if (unfolded)
+		n += callchain_node__count_rows_rb_tree(node);
+
+	return n;
+}
+
+static int callchain__count_rows(struct rb_root *chain)
+{
+	struct rb_node *nd;
+	int n = 0;
+
+	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+		n += callchain_node__count_rows(node);
+	}
+
+	return n;
+}
+
+static bool hist_browser__toggle_fold(struct hist_browser *self)
+{
+	if (map_symbol__toggle_fold(self->selection)) {
+		struct hist_entry *he = self->he_selection;
+
+		hist_entry__init_have_children(he);
+		self->hists->nr_entries -= he->nr_rows;
+
+		if (he->ms.unfolded)
+			he->nr_rows = callchain__count_rows(&he->sorted_chain);
+		else
+			he->nr_rows = 0;
+		self->hists->nr_entries += he->nr_rows;
+		self->b.nr_entries = self->hists->nr_entries;
+
+		return true;
+	}
+
+	/* If it doesn't have children, no toggling performed */
+	return false;
+}
+
+static int hist_browser__run(struct hist_browser *self, const char *title,
+			     struct newtExitStruct *es)
+{
+	char str[256], unit;
+	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
+
+	self->b.entries = &self->hists->entries;
+	self->b.nr_entries = self->hists->nr_entries;
+
+	hist_browser__refresh_dimensions(self);
+
+	nr_events = convert_unit(nr_events, &unit);
+	snprintf(str, sizeof(str), "Events: %lu%c                            ",
+		 nr_events, unit);
+	newtDrawRootText(0, 0, str);
+
+	if (ui_browser__show(&self->b, title) < 0)
+		return -1;
+
+	newtFormAddHotKey(self->b.form, 'A');
+	newtFormAddHotKey(self->b.form, 'a');
+	newtFormAddHotKey(self->b.form, '?');
+	newtFormAddHotKey(self->b.form, 'h');
+	newtFormAddHotKey(self->b.form, 'H');
+	newtFormAddHotKey(self->b.form, 'd');
+
+	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+
+	while (1) {
+		ui_browser__run(&self->b, es);
+
+		if (es->reason != NEWT_EXIT_HOTKEY)
+			break;
+		switch (es->u.key) {
+		case 'd': { /* Debug */
+			static int seq;
+			struct hist_entry *h = rb_entry(self->b.first_visible_entry,
+							struct hist_entry, rb_node);
+			ui_helpline__pop();
+			ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
+					   seq++, self->b.nr_entries,
+					   self->hists->nr_entries,
+					   self->b.height,
+					   self->b.index,
+					   self->b.first_visible_entry_idx,
+					   h->row_offset, h->nr_rows);
+		}
+			continue;
+		case NEWT_KEY_ENTER:
+			if (hist_browser__toggle_fold(self))
+				break;
+			/* fall thru */
+		default:
+			return 0;
+		}
+	}
+	return 0;
+}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 03a1722..46e531d 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -38,6 +38,12 @@ extern struct sort_entry sort_sym;
 extern struct sort_entry sort_parent;
 extern enum sort_type sort__first_dimension;
 
+/**
+ * struct hist_entry - histogram entry
+ *
+ * @row_offset - offset from the first callchain expanded to appear on screen
+ * @nr_rows - rows expanded in callchain, recalculated on folding/unfolding
+ */
 struct hist_entry {
 	struct rb_node		rb_node;
 	u64			period;
@@ -50,6 +56,12 @@ struct hist_entry {
 	u64			ip;
 	s32			cpu;
 	u32			nr_events;
+
+	/* XXX These two should move to some tree widget lib */
+	u16			row_offset;
+	u16			nr_rows;
+
+	bool			init_have_children;
 	char			level;
 	u8			filtered;
 	struct symbol		*parent;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index d436ee3..bb1aab9 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -102,6 +102,8 @@ struct ref_reloc_sym {
 struct map_symbol {
 	struct map    *map;
 	struct symbol *sym;
+	bool	      unfolded;
+	bool	      has_children;
 };
 
 struct addr_location {

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

* [tip:perf/core] perf report: Don't abbreviate file paths relative to the cwd
       [not found]             ` <new-submission>
                                 ` (558 preceding siblings ...)
  2010-08-02  7:50               ` [tip:perf/core] perf ui: New hists tree widget tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:51               ` tip-bot for Dave Martin
  2010-08-02  7:51               ` [tip:perf/core] perf tools: Remove unneeded code for tracking the cwd in perf sessions tip-bot for Dave Martin
                                 ` (146 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-02  7:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx

Commit-ID:  361d13462585474267a0c41e956f1a1c19a93f17
Gitweb:     http://git.kernel.org/tip/361d13462585474267a0c41e956f1a1c19a93f17
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Tue, 27 Jul 2010 16:40:02 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:39:04 -0300

perf report: Don't abbreviate file paths relative to the cwd

This avoids around some problems where the full path is executables and DSOs it
needed for finding debug symbols on platforms with separated debug symbol files
such as Ubuntu.  This is simpler than tracking an extra name for each image.

The only impact should be that paths in verbose output from the perf tools
become absolute, instead of relative to .

LKML-Reference: <new-submission>
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c |    2 +-
 tools/perf/util/map.c   |   22 +---------------------
 tools/perf/util/map.h   |    2 +-
 3 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 121339f..5b81bb2 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -517,7 +517,7 @@ int event__process_mmap(event_t *self, struct perf_session *session)
 	map = map__new(&machine->user_dsos, self->mmap.start,
 			self->mmap.len, self->mmap.pgoff,
 			self->mmap.pid, self->mmap.filename,
-			MAP__FUNCTION, session->cwd, session->cwdlen);
+			MAP__FUNCTION);
 
 	if (thread == NULL || map == NULL)
 		goto out_problem;
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index e672f2f..37cab90 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -17,16 +17,6 @@ static inline int is_anon_memory(const char *filename)
 	return strcmp(filename, "//anon") == 0;
 }
 
-static int strcommon(const char *pathname, char *cwd, int cwdlen)
-{
-	int n = 0;
-
-	while (n < cwdlen && pathname[n] == cwd[n])
-		++n;
-
-	return n;
-}
-
 void map__init(struct map *self, enum map_type type,
 	       u64 start, u64 end, u64 pgoff, struct dso *dso)
 {
@@ -43,7 +33,7 @@ void map__init(struct map *self, enum map_type type,
 
 struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 		     u64 pgoff, u32 pid, char *filename,
-		     enum map_type type, char *cwd, int cwdlen)
+		     enum map_type type)
 {
 	struct map *self = malloc(sizeof(*self));
 
@@ -52,16 +42,6 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 		struct dso *dso;
 		int anon;
 
-		if (cwd) {
-			int n = strcommon(filename, cwd, cwdlen);
-
-			if (n == cwdlen) {
-				snprintf(newfilename, sizeof(newfilename),
-					 ".%s", filename + n);
-				filename = newfilename;
-			}
-		}
-
 		anon = is_anon_memory(filename);
 
 		if (anon) {
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index f391345..3b2f706 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -106,7 +106,7 @@ void map__init(struct map *self, enum map_type type,
 	       u64 start, u64 end, u64 pgoff, struct dso *dso);
 struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 		     u64 pgoff, u32 pid, char *filename,
-		     enum map_type type, char *cwd, int cwdlen);
+		     enum map_type type);
 void map__delete(struct map *self);
 struct map *map__clone(struct map *self);
 int map__overlap(struct map *l, struct map *r);

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

* [tip:perf/core] perf tools: Remove unneeded code for tracking the cwd in perf sessions
       [not found]             ` <new-submission>
                                 ` (559 preceding siblings ...)
  2010-08-02  7:51               ` [tip:perf/core] perf report: Don't abbreviate file paths relative to the cwd tip-bot for Dave Martin
@ 2010-08-02  7:51               ` tip-bot for Dave Martin
  2010-08-02  7:51               ` [tip:perf/core] perf man pages: Fix cut'n'paste error tip-bot for Arnaldo Carvalho de Melo
                                 ` (145 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-02  7:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx

Commit-ID:  88ca895dd4e0e64ebd942adb7925fa60ca5b2a98
Gitweb:     http://git.kernel.org/tip/88ca895dd4e0e64ebd942adb7925fa60ca5b2a98
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Tue, 27 Jul 2010 11:46:12 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 27 Jul 2010 11:46:12 -0300

perf tools: Remove unneeded code for tracking the cwd in perf sessions

Tidy-up patch to remove some code and struct perf_session data members
which are no longer needed due to the previous patch: "perf tools: Don't
abbreviate file paths relative to the cwd".

LKML-Reference: <new-submission>
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-buildid-list.c |    4 +---
 tools/perf/builtin-diff.c         |    2 --
 tools/perf/builtin-report.c       |    2 --
 tools/perf/util/session.c         |   22 +---------------------
 tools/perf/util/symbol.h          |    1 -
 5 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 9989072..44a47e1 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -43,10 +43,8 @@ static int __cmd_buildid_list(void)
 	if (session == NULL)
 		return -1;
 
-	if (with_hits) {
-		symbol_conf.full_paths = true;
+	if (with_hits)
 		perf_session__process_events(session, &build_id__mark_dso_hit_ops);
-	}
 
 	perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
 
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 39e6627..fca1d44 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -180,8 +180,6 @@ static const struct option options[] = {
 	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
 	OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
 		    "load module symbols - WARNING: use only with -k and LIVE kernel"),
-	OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
-		    "Don't shorten the pathnames taking into account the cwd"),
 	OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
 		   "only consider symbols in these dsos"),
 	OPT_STRING('C', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ce42bba..2f4b929 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -441,8 +441,6 @@ static const struct option options[] = {
 		   "pretty printing style key: normal raw"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): pid, comm, dso, symbol, parent"),
-	OPT_BOOLEAN('P', "full-paths", &symbol_conf.full_paths,
-		    "Don't shorten the pathnames taking into account the cwd"),
 	OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
 		    "Show sample percentage for different cpu modes"),
 	OPT_STRING('p', "parent", &parent_pattern, "regex",
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0307918..8cbea12 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -96,8 +96,6 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
 	self->hists_tree = RB_ROOT;
 	self->last_match = NULL;
 	self->mmap_window = 32;
-	self->cwd = NULL;
-	self->cwdlen = 0;
 	self->machines = RB_ROOT;
 	self->repipe = repipe;
 	INIT_LIST_HEAD(&self->ordered_samples.samples_head);
@@ -130,7 +128,6 @@ void perf_session__delete(struct perf_session *self)
 {
 	perf_header__exit(&self->header);
 	close(self->fd);
-	free(self->cwd);
 	free(self);
 }
 
@@ -832,23 +829,6 @@ int perf_session__process_events(struct perf_session *self,
 	if (perf_session__register_idle_thread(self) == NULL)
 		return -ENOMEM;
 
-	if (!symbol_conf.full_paths) {
-		char bf[PATH_MAX];
-
-		if (getcwd(bf, sizeof(bf)) == NULL) {
-			err = -errno;
-out_getcwd_err:
-			pr_err("failed to get the current directory\n");
-			goto out_err;
-		}
-		self->cwd = strdup(bf);
-		if (self->cwd == NULL) {
-			err = -ENOMEM;
-			goto out_getcwd_err;
-		}
-		self->cwdlen = strlen(self->cwd);
-	}
-
 	if (!self->fd_pipe)
 		err = __perf_session__process_events(self,
 						     self->header.data_offset,
@@ -856,7 +836,7 @@ out_getcwd_err:
 						     self->size, ops);
 	else
 		err = __perf_session__process_pipe_events(self, ops);
-out_err:
+
 	return err;
 }
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index bb1aab9..6452a07 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -68,7 +68,6 @@ struct symbol_conf {
 			show_nr_samples,
 			use_callchain,
 			exclude_other,
-			full_paths,
 			show_cpu_utilization;
 	const char	*vmlinux_name,
 			*source_prefix,

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

* [tip:perf/core] perf man pages: Fix cut'n'paste error
       [not found]             ` <new-submission>
                                 ` (560 preceding siblings ...)
  2010-08-02  7:51               ` [tip:perf/core] perf tools: Remove unneeded code for tracking the cwd in perf sessions tip-bot for Dave Martin
@ 2010-08-02  7:51               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:52               ` [tip:perf/core] perf record: Release resources at exit tip-bot for Arnaldo Carvalho de Melo
                                 ` (144 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  8c31a1e049a0c26f78558d7cc5a9ab6956c86694
Gitweb:     http://git.kernel.org/tip/8c31a1e049a0c26f78558d7cc5a9ab6956c86694
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 28 Jul 2010 11:30:10 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 28 Jul 2010 11:30:10 -0300

perf man pages: Fix cut'n'paste error

We remove files _from_ the cache.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-buildid-cache.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt
index 5d1a950..c105770 100644
--- a/tools/perf/Documentation/perf-buildid-cache.txt
+++ b/tools/perf/Documentation/perf-buildid-cache.txt
@@ -12,9 +12,9 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This command manages the build-id cache. It can add and remove files to the
-cache. In the future it should as well purge older entries, set upper limits
-for the space used by the cache, etc.
+This command manages the build-id cache. It can add and remove files to/from
+the cache. In the future it should as well purge older entries, set upper
+limits for the space used by the cache, etc.
 
 OPTIONS
 -------
@@ -23,7 +23,7 @@ OPTIONS
         Add specified file to the cache.
 -r::
 --remove=::
-        Remove specified file to the cache.
+        Remove specified file from the cache.
 -v::
 --verbose::
 	Be more verbose.

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

* [tip:perf/core] perf record: Release resources at exit
       [not found]             ` <new-submission>
                                 ` (561 preceding siblings ...)
  2010-08-02  7:51               ` [tip:perf/core] perf man pages: Fix cut'n'paste error tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:52               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:52               ` [tip:perf/core] perf symbols: Precisely specify if dso->{long,short}_name should be freed tip-bot for Arnaldo Carvalho de Melo
                                 ` (143 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  39d17dacb3c25df878b56aa80a170d6088e041f9
Gitweb:     http://git.kernel.org/tip/39d17dacb3c25df878b56aa80a170d6088e041f9
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 29 Jul 2010 14:08:55 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 29 Jul 2010 14:08:55 -0300

perf record: Release resources at exit

So that we can reduce the noise on valgrind when looking for memory
leaks.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b938796..5ae0d93 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -439,6 +439,7 @@ static void atexit_header(void)
 
 		process_buildids();
 		perf_header__write(&session->header, output, true);
+		perf_session__delete(session);
 	}
 }
 
@@ -558,12 +559,15 @@ static int __cmd_record(int argc, const char **argv)
 	if (!file_new) {
 		err = perf_header__read(session, output);
 		if (err < 0)
-			return err;
+			goto out_delete_session;
 	}
 
 	if (have_tracepoints(attrs, nr_counters))
 		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
 
+	/*
+ 	 * perf_session__delete(session) will be called at atexit_header()
+	 */
 	atexit(atexit_header);
 
 	if (forks) {
@@ -768,6 +772,10 @@ static int __cmd_record(int argc, const char **argv)
 		bytes_written / 24);
 
 	return 0;
+
+out_delete_session:
+	perf_session__delete(session);
+	return err;
 }
 
 static const char * const record_usage[] = {
@@ -824,7 +832,7 @@ static const struct option options[] = {
 
 int cmd_record(int argc, const char **argv, const char *prefix __used)
 {
-	int i,j;
+	int i, j, err = -ENOMEM;
 
 	argc = parse_options(argc, argv, options, record_usage,
 			    PARSE_OPT_STOP_AT_NON_OPTION);
@@ -873,13 +881,13 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		for (j = 0; j < MAX_COUNTERS; j++) {
 			fd[i][j] = malloc(sizeof(int)*thread_num);
 			if (!fd[i][j])
-				return -ENOMEM;
+				goto out_free_fd;
 		}
 	}
 	event_array = malloc(
 		sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
 	if (!event_array)
-		return -ENOMEM;
+		goto out_free_fd;
 
 	if (user_interval != ULLONG_MAX)
 		default_interval = user_interval;
@@ -895,8 +903,20 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		default_interval = freq;
 	} else {
 		fprintf(stderr, "frequency and count are zero, aborting\n");
-		exit(EXIT_FAILURE);
+		err = -EINVAL;
+		goto out_free_event_array;
 	}
 
-	return __cmd_record(argc, argv);
+	err = __cmd_record(argc, argv);
+
+out_free_event_array:
+	free(event_array);
+out_free_fd:
+	for (i = 0; i < MAX_NR_CPUS; i++) {
+		for (j = 0; j < MAX_COUNTERS; j++)
+			free(fd[i][j]);
+	}
+	free(all_tids);
+	all_tids = NULL;
+	return err;
 }

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

* [tip:perf/core] perf symbols: Precisely specify if dso->{long,short}_name should be freed
       [not found]             ` <new-submission>
                                 ` (562 preceding siblings ...)
  2010-08-02  7:52               ` [tip:perf/core] perf record: Release resources at exit tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:52               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:52               ` [tip:perf/core] perf tools: Factor out buildid reading and make it implicit in dso__load tip-bot for Dave Martin
                                 ` (142 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  6e406257b3794009e3b7a6d48b54beb547719565
Gitweb:     http://git.kernel.org/tip/6e406257b3794009e3b7a6d48b54beb547719565
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 29 Jul 2010 15:11:30 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 29 Jul 2010 15:11:30 -0300

perf symbols: Precisely specify if dso->{long,short}_name should be freed

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c  |    1 +
 tools/perf/util/symbol.c |    5 ++++-
 tools/perf/util/symbol.h |    4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 5b81bb2..8151d23 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -456,6 +456,7 @@ static int event__process_kernel_mmap(event_t *self,
 			goto out_problem;
 
 		map->dso->short_name = name;
+		map->dso->sname_alloc = 1;
 		map->end = map->start + self->mmap.len;
 	} else if (is_kernel_mmap) {
 		const char *symbol_name = (self->mmap.filename +
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index bc6e7e8..242d2b2 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -224,7 +224,9 @@ void dso__delete(struct dso *self)
 	int i;
 	for (i = 0; i < MAP__NR_TYPES; ++i)
 		symbols__delete(&self->symbols[i]);
-	if (self->long_name != self->name)
+	if (self->sname_alloc)
+		free((char *)self->short_name);
+	if (self->lname_alloc)
 		free(self->long_name);
 	free(self);
 }
@@ -1530,6 +1532,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
 			if (long_name == NULL)
 				goto failure;
 			dso__set_long_name(map->dso, long_name);
+			map->dso->lname_alloc = 1;
 			dso__kernel_module_get_build_id(map->dso, "");
 		}
 	}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 6452a07..f29f73c 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -126,12 +126,14 @@ struct dso {
 	struct list_head node;
 	struct rb_root	 symbols[MAP__NR_TYPES];
 	struct rb_root	 symbol_names[MAP__NR_TYPES];
+	enum dso_kernel_type	kernel;
 	u8		 adjust_symbols:1;
 	u8		 slen_calculated:1;
 	u8		 has_build_id:1;
-	enum dso_kernel_type	kernel;
 	u8		 hit:1;
 	u8		 annotate_warned:1;
+	u8		 sname_alloc:1;
+	u8		 lname_alloc:1;
 	unsigned char	 origin;
 	u8		 sorted_by_name;
 	u8		 loaded;

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

* [tip:perf/core] perf tools: Factor out buildid reading and make it implicit in dso__load
       [not found]             ` <new-submission>
                                 ` (563 preceding siblings ...)
  2010-08-02  7:52               ` [tip:perf/core] perf symbols: Precisely specify if dso->{long,short}_name should be freed tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:52               ` tip-bot for Dave Martin
  2010-08-02  7:52               ` [tip:perf/core] perf tools: remove extra build-id check factored into dso__load tip-bot for Dave Martin
                                 ` (141 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-02  7:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx

Commit-ID:  21916c380d93ab59d6d07ee198fb31c8f1338e26
Gitweb:     http://git.kernel.org/tip/21916c380d93ab59d6d07ee198fb31c8f1338e26
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Fri, 30 Jul 2010 09:08:08 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 09:53:30 -0300

perf tools: Factor out buildid reading and make it implicit in dso__load

If we have a buildid, then we never want to load an image which has no buildid,
or which has a different buildid, so it makes sense for the check to be built
into dso__load and not done separately.  This is fine for old distros which
don't use buildid at all since we do no check in that case.

This refactoring also alleviates some subtle race condition issues by not
opening ELF images twice to check the buildid and then load the symbols, which
could lead to weirdness if an image is replaced under our feet.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   80 +++++++++++++++++++++++++++-------------------
 1 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 242d2b2..b812ace 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -26,6 +26,8 @@
 #define NT_GNU_BUILD_ID 3
 #endif
 
+static bool dso__build_id_equal(const struct dso *self, u8 *build_id);
+static int elf_read_build_id(Elf *elf, void *bf, size_t size);
 static void dsos__add(struct list_head *head, struct dso *dso);
 static struct map *map__new2(u64 start, struct dso *dso, enum map_type type);
 static int dso__load_kernel_sym(struct dso *self, struct map *map,
@@ -993,6 +995,17 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
 		goto out_elf_end;
 	}
 
+	if (self->has_build_id) {
+		u8 build_id[BUILD_ID_SIZE];
+
+		if (elf_read_build_id(elf, build_id,
+				      BUILD_ID_SIZE) != BUILD_ID_SIZE)
+			goto out_elf_end;
+
+		if (!dso__build_id_equal(self, build_id))
+			goto out_elf_end;
+	}
+
 	sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
 	if (sec == NULL) {
 		sec = elf_section_by_name(elf, &ehdr, &shdr, ".dynsym", NULL);
@@ -1193,37 +1206,26 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits)
  */
 #define NOTE_ALIGN(n) (((n) + 3) & -4U)
 
-int filename__read_build_id(const char *filename, void *bf, size_t size)
+static int elf_read_build_id(Elf *elf, void *bf, size_t size)
 {
-	int fd, err = -1;
+	int err = -1;
 	GElf_Ehdr ehdr;
 	GElf_Shdr shdr;
 	Elf_Data *data;
 	Elf_Scn *sec;
 	Elf_Kind ek;
 	void *ptr;
-	Elf *elf;
 
 	if (size < BUILD_ID_SIZE)
 		goto out;
 
-	fd = open(filename, O_RDONLY);
-	if (fd < 0)
-		goto out;
-
-	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
-	if (elf == NULL) {
-		pr_debug2("%s: cannot read %s ELF file.\n", __func__, filename);
-		goto out_close;
-	}
-
 	ek = elf_kind(elf);
 	if (ek != ELF_K_ELF)
-		goto out_elf_end;
+		goto out;
 
 	if (gelf_getehdr(elf, &ehdr) == NULL) {
 		pr_err("%s: cannot get elf header.\n", __func__);
-		goto out_elf_end;
+		goto out;
 	}
 
 	sec = elf_section_by_name(elf, &ehdr, &shdr,
@@ -1232,12 +1234,12 @@ int filename__read_build_id(const char *filename, void *bf, size_t size)
 		sec = elf_section_by_name(elf, &ehdr, &shdr,
 					  ".notes", NULL);
 		if (sec == NULL)
-			goto out_elf_end;
+			goto out;
 	}
 
 	data = elf_getdata(sec, NULL);
 	if (data == NULL)
-		goto out_elf_end;
+		goto out;
 
 	ptr = data->d_buf;
 	while (ptr < (data->d_buf + data->d_size)) {
@@ -1259,7 +1261,31 @@ int filename__read_build_id(const char *filename, void *bf, size_t size)
 		}
 		ptr += descsz;
 	}
-out_elf_end:
+
+out:
+	return err;
+}
+
+int filename__read_build_id(const char *filename, void *bf, size_t size)
+{
+	int fd, err = -1;
+	Elf *elf;
+
+	if (size < BUILD_ID_SIZE)
+		goto out;
+
+	fd = open(filename, O_RDONLY);
+	if (fd < 0)
+		goto out;
+
+	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
+	if (elf == NULL) {
+		pr_debug2("%s: cannot read %s ELF file.\n", __func__, filename);
+		goto out_close;
+	}
+
+	err = elf_read_build_id(elf, bf, size);
+
 	elf_end(elf);
 out_close:
 	close(fd);
@@ -1335,7 +1361,6 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
 {
 	int size = PATH_MAX;
 	char *name;
-	u8 build_id[BUILD_ID_SIZE];
 	int ret = -1;
 	int fd;
 	struct machine *machine;
@@ -1382,16 +1407,14 @@ more:
 				 self->long_name);
 			break;
 		case DSO__ORIG_BUILDID:
-			if (filename__read_build_id(self->long_name, build_id,
-						    sizeof(build_id))) {
+			if (self->has_build_id) {
 				char build_id_hex[BUILD_ID_SIZE * 2 + 1];
-				build_id__sprintf(build_id, sizeof(build_id),
+				build_id__sprintf(self->build_id,
+						  sizeof(self->build_id),
 						  build_id_hex);
 				snprintf(name, size,
 					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
 					build_id_hex, build_id_hex + 2);
-				if (self->has_build_id)
-					goto compare_build_id;
 				break;
 			}
 			self->origin++;
@@ -1410,15 +1433,6 @@ more:
 		default:
 			goto out;
 		}
-
-		if (self->has_build_id) {
-			if (filename__read_build_id(name, build_id,
-						    sizeof(build_id)) < 0)
-				goto more;
-compare_build_id:
-			if (!dso__build_id_equal(self, build_id))
-				goto more;
-		}
 open_file:
 		fd = open(name, O_RDONLY);
 	} while (fd < 0);

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

* [tip:perf/core] perf tools: remove extra build-id check factored into dso__load
       [not found]             ` <new-submission>
                                 ` (564 preceding siblings ...)
  2010-08-02  7:52               ` [tip:perf/core] perf tools: Factor out buildid reading and make it implicit in dso__load tip-bot for Dave Martin
@ 2010-08-02  7:52               ` tip-bot for Dave Martin
  2010-08-02  7:53               ` [tip:perf/core] perf symbols: Improve debug image search when loading symbols tip-bot for Dave Martin
                                 ` (140 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-02  7:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx

Commit-ID:  8b1389ef93b36621c6acdeb623bd85aee3c405c9
Gitweb:     http://git.kernel.org/tip/8b1389ef93b36621c6acdeb623bd85aee3c405c9
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Fri, 30 Jul 2010 09:36:08 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 09:54:41 -0300

perf tools: remove extra build-id check factored into dso__load

Signed-off-by: Dave Martin <dave.martin@linaro.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   28 ++--------------------------
 1 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b812ace..e0d9480 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -986,12 +986,12 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
 
 	elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
 	if (elf == NULL) {
-		pr_err("%s: cannot read %s ELF file.\n", __func__, name);
+		pr_debug("%s: cannot read %s ELF file.\n", __func__, name);
 		goto out_close;
 	}
 
 	if (gelf_getehdr(elf, &ehdr) == NULL) {
-		pr_err("%s: cannot get elf header.\n", __func__);
+		pr_debug("%s: cannot get elf header.\n", __func__);
 		goto out_elf_end;
 	}
 
@@ -1710,30 +1710,6 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
 {
 	int err = -1, fd;
 
-	if (self->has_build_id) {
-		u8 build_id[BUILD_ID_SIZE];
-
-		if (filename__read_build_id(vmlinux, build_id,
-					    sizeof(build_id)) < 0) {
-			pr_debug("No build_id in %s, ignoring it\n", vmlinux);
-			return -1;
-		}
-		if (!dso__build_id_equal(self, build_id)) {
-			char expected_build_id[BUILD_ID_SIZE * 2 + 1],
-			     vmlinux_build_id[BUILD_ID_SIZE * 2 + 1];
-
-			build_id__sprintf(self->build_id,
-					  sizeof(self->build_id),
-					  expected_build_id);
-			build_id__sprintf(build_id, sizeof(build_id),
-					  vmlinux_build_id);
-			pr_debug("build_id in %s is %s while expected is %s, "
-				 "ignoring it\n", vmlinux, vmlinux_build_id,
-				 expected_build_id);
-			return -1;
-		}
-	}
-
 	fd = open(vmlinux, O_RDONLY);
 	if (fd < 0)
 		return -1;

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

* [tip:perf/core] perf symbols: Improve debug image search when loading symbols
       [not found]             ` <new-submission>
                                 ` (565 preceding siblings ...)
  2010-08-02  7:52               ` [tip:perf/core] perf tools: remove extra build-id check factored into dso__load tip-bot for Dave Martin
@ 2010-08-02  7:53               ` tip-bot for Dave Martin
  2010-08-02  7:53               ` [tip:perf/core] perf tui: Make CTRL+Z suspend perf tip-bot for Arnaldo Carvalho de Melo
                                 ` (139 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-02  7:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx

Commit-ID:  6da80ce8c43ddda153208cbb46b75290cf566fac
Gitweb:     http://git.kernel.org/tip/6da80ce8c43ddda153208cbb46b75290cf566fac
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Fri, 30 Jul 2010 09:50:09 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 09:54:49 -0300

perf symbols: Improve debug image search when loading symbols

Changes:
	* Simplification of the main search loop on dso__load()
	* Replace the search with a 2-pass search:
		* First, try to find an image with a proper symtab.
		* Second, repeat the search, accepting dynsym.

A second scan should only ever happen when needed debug images are
missing from the buildid cache or stale, i.e., when the cache is out of
sync.

Currently, the second scan also happens when using separated debug
images, since the caching logic doesn't currently know how to cache
those.  Improvements to the cache behaviour ought to solve that.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   96 +++++++++++++++++++++++++++++-----------------
 1 files changed, 61 insertions(+), 35 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e0d9480..d99497e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -966,7 +966,8 @@ static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr)
 }
 
 static int dso__load_sym(struct dso *self, struct map *map, const char *name,
-			 int fd, symbol_filter_t filter, int kmodule)
+			 int fd, symbol_filter_t filter, int kmodule,
+			 int want_symtab)
 {
 	struct kmap *kmap = self->kernel ? map__kmap(map) : NULL;
 	struct map *curr_map = map;
@@ -995,6 +996,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
 		goto out_elf_end;
 	}
 
+	/* Always reject images with a mismatched build-id: */
 	if (self->has_build_id) {
 		u8 build_id[BUILD_ID_SIZE];
 
@@ -1008,6 +1010,9 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
 
 	sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
 	if (sec == NULL) {
+		if (want_symtab)
+			goto out_elf_end;
+
 		sec = elf_section_by_name(elf, &ehdr, &shdr, ".dynsym", NULL);
 		if (sec == NULL)
 			goto out_elf_end;
@@ -1365,6 +1370,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
 	int fd;
 	struct machine *machine;
 	const char *root_dir;
+	int want_symtab;
 
 	dso__set_loaded(self, map->type);
 
@@ -1391,13 +1397,18 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
 		return ret;
 	}
 
-	self->origin = DSO__ORIG_BUILD_ID_CACHE;
-	if (dso__build_id_filename(self, name, size) != NULL)
-		goto open_file;
-more:
-	do {
-		self->origin++;
+	/* Iterate over candidate debug images.
+	 * On the first pass, only load images if they have a full symtab.
+	 * Failing that, do a second pass where we accept .dynsym also
+	 */
+	for (self->origin = DSO__ORIG_BUILD_ID_CACHE, want_symtab = 1;
+	     self->origin != DSO__ORIG_NOT_FOUND;
+	     self->origin++) {
 		switch (self->origin) {
+		case DSO__ORIG_BUILD_ID_CACHE:
+			if (dso__build_id_filename(self, name, size) == NULL)
+				continue;
+			break;
 		case DSO__ORIG_FEDORA:
 			snprintf(name, size, "/usr/lib/debug%s.debug",
 				 self->long_name);
@@ -1406,19 +1417,20 @@ more:
 			snprintf(name, size, "/usr/lib/debug%s",
 				 self->long_name);
 			break;
-		case DSO__ORIG_BUILDID:
-			if (self->has_build_id) {
-				char build_id_hex[BUILD_ID_SIZE * 2 + 1];
-				build_id__sprintf(self->build_id,
-						  sizeof(self->build_id),
-						  build_id_hex);
-				snprintf(name, size,
-					 "/usr/lib/debug/.build-id/%.2s/%s.debug",
-					build_id_hex, build_id_hex + 2);
-				break;
+		case DSO__ORIG_BUILDID: {
+			char build_id_hex[BUILD_ID_SIZE * 2 + 1];
+
+			if (!self->has_build_id)
+				continue;
+
+			build_id__sprintf(self->build_id,
+					  sizeof(self->build_id),
+					  build_id_hex);
+			snprintf(name, size,
+				 "/usr/lib/debug/.build-id/%.2s/%s.debug",
+				 build_id_hex, build_id_hex + 2);
 			}
-			self->origin++;
-			/* Fall thru */
+			break;
 		case DSO__ORIG_DSO:
 			snprintf(name, size, "%s", self->long_name);
 			break;
@@ -1431,27 +1443,41 @@ more:
 			break;
 
 		default:
-			goto out;
+			/*
+			 * If we wanted a full symtab but no image had one,
+			 * relax our requirements and repeat the search.
+			 */
+			if (want_symtab) {
+				want_symtab = 0;
+				self->origin = DSO__ORIG_BUILD_ID_CACHE;
+			} else
+				continue;
 		}
-open_file:
+
+		/* Name is now the name of the next image to try */
 		fd = open(name, O_RDONLY);
-	} while (fd < 0);
+		if (fd < 0)
+			continue;
 
-	ret = dso__load_sym(self, map, name, fd, filter, 0);
-	close(fd);
+		ret = dso__load_sym(self, map, name, fd, filter, 0,
+				    want_symtab);
+		close(fd);
 
-	/*
-	 * Some people seem to have debuginfo files _WITHOUT_ debug info!?!?
-	 */
-	if (!ret)
-		goto more;
+		/*
+		 * Some people seem to have debuginfo files _WITHOUT_ debug
+		 * info!?!?
+		 */
+		if (!ret)
+			continue;
 
-	if (ret > 0) {
-		int nr_plt = dso__synthesize_plt_symbols(self, map, filter);
-		if (nr_plt > 0)
-			ret += nr_plt;
+		if (ret > 0) {
+			int nr_plt = dso__synthesize_plt_symbols(self, map, filter);
+			if (nr_plt > 0)
+				ret += nr_plt;
+			break;
+		}
 	}
-out:
+
 	free(name);
 	if (ret < 0 && strstr(self->name, " (deleted)") != NULL)
 		return 0;
@@ -1715,7 +1741,7 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
 		return -1;
 
 	dso__set_loaded(self, map->type);
-	err = dso__load_sym(self, map, vmlinux, fd, filter, 0);
+	err = dso__load_sym(self, map, vmlinux, fd, filter, 0, 0);
 	close(fd);
 
 	if (err > 0)

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

* [tip:perf/core] perf tui: Make CTRL+Z suspend perf
       [not found]             ` <new-submission>
                                 ` (566 preceding siblings ...)
  2010-08-02  7:53               ` [tip:perf/core] perf symbols: Improve debug image search when loading symbols tip-bot for Dave Martin
@ 2010-08-02  7:53               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:54               ` [tip:perf/core] perf tools: Release thread resources on PERF_RECORD_EXIT tip-bot for Arnaldo Carvalho de Melo
                                 ` (138 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  73ae8f85fda49410a59d7b532ce69a0b811ef6d5
Gitweb:     http://git.kernel.org/tip/73ae8f85fda49410a59d7b532ce69a0b811ef6d5
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 30 Jul 2010 10:06:06 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 10:06:06 -0300

perf tui: Make CTRL+Z suspend perf

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 28f74eb..91de99b 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -11,6 +11,7 @@
 #define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
 #endif
 #include <slang.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <newt.h>
 #include <sys/ttydefaults.h>
@@ -891,6 +892,13 @@ static struct newtPercentTreeColors {
 	"blue",	     "lightgray",
 };
 
+static void newt_suspend(void *d __used)
+{
+	newtSuspend();
+	raise(SIGTSTP);
+	newtResume();
+}
+
 void setup_browser(void)
 {
 	struct newtPercentTreeColors *c = &defaultPercentTreeColors;
@@ -904,6 +912,7 @@ void setup_browser(void)
 	use_browser = 1;
 	newtInit();
 	newtCls();
+	newtSetSuspendCallback(newt_suspend, NULL);
 	ui_helpline__puts(" ");
 	sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
 	sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);

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

* [tip:perf/core] perf tools: Release thread resources on PERF_RECORD_EXIT
       [not found]             ` <new-submission>
                                 ` (567 preceding siblings ...)
  2010-08-02  7:53               ` [tip:perf/core] perf tui: Make CTRL+Z suspend perf tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:54               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-02  7:54               ` [tip:perf/core] perf tools: Release session and symbol resources on exit tip-bot for Arnaldo Carvalho de Melo
                                 ` (137 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  591765fdaf7ea1888157f342b67b0461f2e5ed9b
Gitweb:     http://git.kernel.org/tip/591765fdaf7ea1888157f342b67b0461f2e5ed9b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 30 Jul 2010 18:28:42 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 18:28:42 -0300

perf tools: Release thread resources on PERF_RECORD_EXIT

For long running sessions with many threads with short lifetimes the
amount of memory that the buildid process takes is too much.

Since we don't have hist_entries that may be pointing to them, we can
just release the resources associated with each thread when the exit
(PERF_RECORD_EXIT) event is received.

For normal processing we need to annotate maps with hits, and thus
hist_entries pointing to it and drop the ones that had none. Will be
done in a followup patch.

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/build-id.c |   18 ++++++++++++++++++
 tools/perf/util/map.c      |   33 +++++++++++++++++++++++++++++++++
 tools/perf/util/map.h      |    1 +
 tools/perf/util/thread.c   |    7 +++++++
 tools/perf/util/thread.h   |    2 ++
 5 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 5c26e2d..e437edb 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -12,6 +12,7 @@
 #include "event.h"
 #include "symbol.h"
 #include <linux/kernel.h>
+#include "debug.h"
 
 static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
 {
@@ -34,10 +35,27 @@ static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
 	return 0;
 }
 
+static int event__exit_del_thread(event_t *self, struct perf_session *session)
+{
+	struct thread *thread = perf_session__findnew(session, self->fork.tid);
+
+	dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid,
+		    self->fork.ppid, self->fork.ptid);
+
+	if (thread) {
+		rb_erase(&thread->rb_node, &session->threads);
+		session->last_match = NULL;
+		thread__delete(thread);
+	}
+
+	return 0;
+}
+
 struct perf_event_ops build_id__mark_dso_hit_ops = {
 	.sample	= build_id__mark_dso_hit,
 	.mmap	= event__process_mmap,
 	.fork	= event__process_task,
+	.exit	= event__exit_del_thread,
 };
 
 char *dso__build_id_filename(struct dso *self, char *bf, size_t size)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 37cab90..2ddbae3 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -228,6 +228,39 @@ void map_groups__init(struct map_groups *self)
 	self->machine = NULL;
 }
 
+static void maps__delete(struct rb_root *self)
+{
+	struct rb_node *next = rb_first(self);
+
+	while (next) {
+		struct map *pos = rb_entry(next, struct map, rb_node);
+
+		next = rb_next(&pos->rb_node);
+		rb_erase(&pos->rb_node, self);
+		map__delete(pos);
+	}
+}
+
+static void maps__delete_removed(struct list_head *self)
+{
+	struct map *pos, *n;
+
+	list_for_each_entry_safe(pos, n, self, node) {
+		list_del(&pos->node);
+		map__delete(pos);
+	}
+}
+
+void map_groups__exit(struct map_groups *self)
+{
+	int i;
+
+	for (i = 0; i < MAP__NR_TYPES; ++i) {
+		maps__delete(&self->maps[i]);
+		maps__delete_removed(&self->removed_maps[i]);
+	}
+}
+
 void map_groups__flush(struct map_groups *self)
 {
 	int type;
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 3b2f706..20eba42 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -127,6 +127,7 @@ size_t __map_groups__fprintf_maps(struct map_groups *self,
 void maps__insert(struct rb_root *maps, struct map *map);
 struct map *maps__find(struct rb_root *maps, u64 addr);
 void map_groups__init(struct map_groups *self);
+void map_groups__exit(struct map_groups *self);
 int map_groups__clone(struct map_groups *self,
 		      struct map_groups *parent, enum map_type type);
 size_t map_groups__fprintf(struct map_groups *self, int verbose, FILE *fp);
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 9a448b4..8c72d88 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -62,6 +62,13 @@ static struct thread *thread__new(pid_t pid)
 	return self;
 }
 
+void thread__delete(struct thread *self)
+{
+	map_groups__exit(&self->mg);
+	free(self->comm);
+	free(self);
+}
+
 int thread__set_comm(struct thread *self, const char *comm)
 {
 	int err;
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index ee6bbcf..688500f 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -20,6 +20,8 @@ struct thread {
 
 struct perf_session;
 
+void thread__delete(struct thread *self);
+
 int find_all_tid(int pid, pid_t ** all_tid);
 int thread__set_comm(struct thread *self, const char *comm);
 int thread__comm_len(struct thread *self);

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

* [tip:perf/core] perf tools: Release session and symbol resources on exit
       [not found]             ` <new-submission>
                                 ` (568 preceding siblings ...)
  2010-08-02  7:54               ` [tip:perf/core] perf tools: Release thread resources on PERF_RECORD_EXIT tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-02  7:54               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-03  5:54               ` [tip:perf/core] perf session: Free the ref_reloc_sym memory at the right place tip-bot for Arnaldo Carvalho de Melo
                                 ` (136 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-02  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  d65a458b348cd458413b3cfec66e43ebd0367646
Gitweb:     http://git.kernel.org/tip/d65a458b348cd458413b3cfec66e43ebd0367646
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 30 Jul 2010 18:31:28 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 30 Jul 2010 18:31:28 -0300

perf tools: Release session and symbol resources on exit

So that we reduce the noise when looking for leaks using tools such as
valgrind.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    5 ++++-
 tools/perf/util/event.c     |    5 +++--
 tools/perf/util/map.c       |   26 ++++++++++++++++++++++++++
 tools/perf/util/map.h       |    1 +
 tools/perf/util/session.c   |   26 ++++++++++++++++++++++++++
 tools/perf/util/symbol.c    |    9 +++++++++
 tools/perf/util/symbol.h    |    1 +
 7 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5ae0d93..ff77b80 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -440,6 +440,7 @@ static void atexit_header(void)
 		process_buildids();
 		perf_header__write(&session->header, output, true);
 		perf_session__delete(session);
+		symbol__exit();
 	}
 }
 
@@ -871,7 +872,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	} else {
 		all_tids=malloc(sizeof(pid_t));
 		if (!all_tids)
-			return -ENOMEM;
+			goto out_symbol_exit;
 
 		all_tids[0] = target_tid;
 		thread_num = 1;
@@ -918,5 +919,7 @@ out_free_fd:
 	}
 	free(all_tids);
 	all_tids = NULL;
+out_symbol_exit:
+	symbol__exit();
 	return err;
 }
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 8151d23..6b0db55 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -515,12 +515,13 @@ int event__process_mmap(event_t *self, struct perf_session *session)
 	if (machine == NULL)
 		goto out_problem;
 	thread = perf_session__findnew(session, self->mmap.pid);
+	if (thread == NULL)
+		goto out_problem;
 	map = map__new(&machine->user_dsos, self->mmap.start,
 			self->mmap.len, self->mmap.pgoff,
 			self->mmap.pid, self->mmap.filename,
 			MAP__FUNCTION);
-
-	if (thread == NULL || map == NULL)
+	if (map == NULL)
 		goto out_problem;
 
 	thread__insert_map(thread, map);
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 2ddbae3..15d6a6d 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -539,6 +539,32 @@ int machine__init(struct machine *self, const char *root_dir, pid_t pid)
 	return self->root_dir == NULL ? -ENOMEM : 0;
 }
 
+static void dsos__delete(struct list_head *self)
+{
+	struct dso *pos, *n;
+
+	list_for_each_entry_safe(pos, n, self, node) {
+		list_del(&pos->node);
+		dso__delete(pos);
+	}
+}
+
+void machine__exit(struct machine *self)
+{
+	struct kmap *kmap = map__kmap(self->vmlinux_maps[MAP__FUNCTION]);
+
+	if (kmap->ref_reloc_sym) {
+		free((char *)kmap->ref_reloc_sym->name);
+		free(kmap->ref_reloc_sym);
+	}
+
+	map_groups__exit(&self->kmaps);
+	dsos__delete(&self->user_dsos);
+	dsos__delete(&self->kernel_dsos);
+	free(self->root_dir);
+	self->root_dir = NULL;
+}
+
 struct machine *machines__add(struct rb_root *self, pid_t pid,
 			      const char *root_dir)
 {
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 20eba42..0e0984e 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -143,6 +143,7 @@ struct machine *machines__find(struct rb_root *self, pid_t pid);
 struct machine *machines__findnew(struct rb_root *self, pid_t pid);
 char *machine__mmap_name(struct machine *self, char *bf, size_t size);
 int machine__init(struct machine *self, const char *root_dir, pid_t pid);
+void machine__exit(struct machine *self);
 
 /*
  * Default guest kernel is defined by parameter --guestkallsyms
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8cbea12..04a3b3d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -124,9 +124,35 @@ out_delete:
 	return NULL;
 }
 
+static void perf_session__delete_dead_threads(struct perf_session *self)
+{
+	struct thread *n, *t;
+
+	list_for_each_entry_safe(t, n, &self->dead_threads, node) {
+		list_del(&t->node);
+		thread__delete(t);
+	}
+}
+
+static void perf_session__delete_threads(struct perf_session *self)
+{
+	struct rb_node *nd = rb_first(&self->threads);
+
+	while (nd) {
+		struct thread *t = rb_entry(nd, struct thread, rb_node);
+
+		rb_erase(&t->rb_node, &self->threads);
+		nd = rb_next(nd);
+		thread__delete(t);
+	}
+}
+
 void perf_session__delete(struct perf_session *self)
 {
 	perf_header__exit(&self->header);
+	perf_session__delete_dead_threads(self);
+	perf_session__delete_threads(self);
+	machine__exit(&self->host_machine);
 	close(self->fd);
 	free(self);
 }
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index d99497e..94cdf68 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2245,6 +2245,15 @@ out_free_comm_list:
 	return -1;
 }
 
+void symbol__exit(void)
+{
+	strlist__delete(symbol_conf.sym_list);
+	strlist__delete(symbol_conf.dso_list);
+	strlist__delete(symbol_conf.comm_list);
+	vmlinux_path__exit();
+	symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL;
+}
+
 int machines__create_kernel_maps(struct rb_root *self, pid_t pid)
 {
 	struct machine *machine = machines__findnew(self, pid);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index f29f73c..33d53ce 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -219,6 +219,7 @@ int machines__create_kernel_maps(struct rb_root *self, pid_t pid);
 int machines__create_guest_kernel_maps(struct rb_root *self);
 
 int symbol__init(void);
+void symbol__exit(void);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 
 size_t machine__fprintf_vmlinux_path(struct machine *self, FILE *fp);

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

* [tip:perf/core] perf session: Free the ref_reloc_sym memory at the right place
       [not found]             ` <new-submission>
                                 ` (569 preceding siblings ...)
  2010-08-02  7:54               ` [tip:perf/core] perf tools: Release session and symbol resources on exit tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-03  5:54               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-03  5:54               ` [tip:perf/core] perf session: Invalidate last_match when removing threads from rb_tree tip-bot for Arnaldo Carvalho de Melo
                                 ` (135 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-03  5:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  076c6e45215aea0de1ed34d3d5079fabeaabf5e1
Gitweb:     http://git.kernel.org/tip/076c6e45215aea0de1ed34d3d5079fabeaabf5e1
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 2 Aug 2010 18:18:28 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Aug 2010 18:18:28 -0300

perf session: Free the ref_reloc_sym memory at the right place

Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.

Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.

The problem was introduced in d65a458, thus post .35.

This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/map.c     |   18 +++++++++++-------
 tools/perf/util/map.h     |    7 +++++++
 tools/perf/util/session.c |    7 +++++++
 tools/perf/util/symbol.c  |   43 +++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/symbol.h  |    2 ++
 5 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 15d6a6d..801e696 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -506,6 +506,11 @@ void maps__insert(struct rb_root *maps, struct map *map)
 	rb_insert_color(&map->rb_node, maps);
 }
 
+void maps__remove(struct rb_root *self, struct map *map)
+{
+	rb_erase(&map->rb_node, self);
+}
+
 struct map *maps__find(struct rb_root *maps, u64 ip)
 {
 	struct rb_node **p = &maps->rb_node;
@@ -551,13 +556,6 @@ static void dsos__delete(struct list_head *self)
 
 void machine__exit(struct machine *self)
 {
-	struct kmap *kmap = map__kmap(self->vmlinux_maps[MAP__FUNCTION]);
-
-	if (kmap->ref_reloc_sym) {
-		free((char *)kmap->ref_reloc_sym->name);
-		free(kmap->ref_reloc_sym);
-	}
-
 	map_groups__exit(&self->kmaps);
 	dsos__delete(&self->user_dsos);
 	dsos__delete(&self->kernel_dsos);
@@ -565,6 +563,12 @@ void machine__exit(struct machine *self)
 	self->root_dir = NULL;
 }
 
+void machine__delete(struct machine *self)
+{
+	machine__exit(self);
+	free(self);
+}
+
 struct machine *machines__add(struct rb_root *self, pid_t pid,
 			      const char *root_dir)
 {
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 0e0984e..5b51bbd 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -125,6 +125,7 @@ void map__reloc_vmlinux(struct map *self);
 size_t __map_groups__fprintf_maps(struct map_groups *self,
 				  enum map_type type, int verbose, FILE *fp);
 void maps__insert(struct rb_root *maps, struct map *map);
+void maps__remove(struct rb_root *self, struct map *map);
 struct map *maps__find(struct rb_root *maps, u64 addr);
 void map_groups__init(struct map_groups *self);
 void map_groups__exit(struct map_groups *self);
@@ -144,6 +145,7 @@ struct machine *machines__findnew(struct rb_root *self, pid_t pid);
 char *machine__mmap_name(struct machine *self, char *bf, size_t size);
 int machine__init(struct machine *self, const char *root_dir, pid_t pid);
 void machine__exit(struct machine *self);
+void machine__delete(struct machine *self);
 
 /*
  * Default guest kernel is defined by parameter --guestkallsyms
@@ -165,6 +167,11 @@ static inline void map_groups__insert(struct map_groups *self, struct map *map)
 	map->groups = self;
 }
 
+static inline void map_groups__remove(struct map_groups *self, struct map *map)
+{
+	maps__remove(&self->maps[map->type], map);
+}
+
 static inline struct map *map_groups__find(struct map_groups *self,
 					   enum map_type type, u64 addr)
 {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 04a3b3d..5d2fd52 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -79,6 +79,12 @@ int perf_session__create_kernel_maps(struct perf_session *self)
 	return ret;
 }
 
+static void perf_session__destroy_kernel_maps(struct perf_session *self)
+{
+	machine__destroy_kernel_maps(&self->host_machine);
+	machines__destroy_guest_kernel_maps(&self->machines);
+}
+
 struct perf_session *perf_session__new(const char *filename, int mode, bool force, bool repipe)
 {
 	size_t len = filename ? strlen(filename) + 1 : 0;
@@ -150,6 +156,7 @@ static void perf_session__delete_threads(struct perf_session *self)
 void perf_session__delete(struct perf_session *self)
 {
 	perf_header__exit(&self->header);
+	perf_session__destroy_kernel_maps(self);
 	perf_session__delete_dead_threads(self);
 	perf_session__delete_threads(self);
 	machine__exit(&self->host_machine);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 3b8c005..6f0dd90 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2107,6 +2107,36 @@ int __machine__create_kernel_maps(struct machine *self, struct dso *kernel)
 	return 0;
 }
 
+void machine__destroy_kernel_maps(struct machine *self)
+{
+	enum map_type type;
+
+	for (type = 0; type < MAP__NR_TYPES; ++type) {
+		struct kmap *kmap;
+
+		if (self->vmlinux_maps[type] == NULL)
+			continue;
+
+		kmap = map__kmap(self->vmlinux_maps[type]);
+		map_groups__remove(&self->kmaps, self->vmlinux_maps[type]);
+		if (kmap->ref_reloc_sym) {
+			/*
+			 * ref_reloc_sym is shared among all maps, so free just
+			 * on one of them.
+			 */
+			if (type == MAP__FUNCTION) {
+				free((char *)kmap->ref_reloc_sym->name);
+				kmap->ref_reloc_sym->name = NULL;
+				free(kmap->ref_reloc_sym);
+			}
+			kmap->ref_reloc_sym = NULL;
+		}
+
+		map__delete(self->vmlinux_maps[type]);
+		self->vmlinux_maps[type] = NULL;
+	}
+}
+
 int machine__create_kernel_maps(struct machine *self)
 {
 	struct dso *kernel = machine__create_kernel(self);
@@ -2351,6 +2381,19 @@ failure:
 	return ret;
 }
 
+void machines__destroy_guest_kernel_maps(struct rb_root *self)
+{
+	struct rb_node *next = rb_first(self);
+
+	while (next) {
+		struct machine *pos = rb_entry(next, struct machine, rb_node);
+
+		next = rb_next(&pos->rb_node);
+		rb_erase(&pos->rb_node, self);
+		machine__delete(pos);
+	}
+}
+
 int machine__load_kallsyms(struct machine *self, const char *filename,
 			   enum map_type type, symbol_filter_t filter)
 {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 33d53ce..906be20 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -212,11 +212,13 @@ int kallsyms__parse(const char *filename, void *arg,
 		    int (*process_symbol)(void *arg, const char *name,
 					  char type, u64 start));
 
+void machine__destroy_kernel_maps(struct machine *self);
 int __machine__create_kernel_maps(struct machine *self, struct dso *kernel);
 int machine__create_kernel_maps(struct machine *self);
 
 int machines__create_kernel_maps(struct rb_root *self, pid_t pid);
 int machines__create_guest_kernel_maps(struct rb_root *self);
+void machines__destroy_guest_kernel_maps(struct rb_root *self);
 
 int symbol__init(void);
 void symbol__exit(void);

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

* [tip:perf/core] perf session: Invalidate last_match when removing threads from rb_tree
       [not found]             ` <new-submission>
                                 ` (570 preceding siblings ...)
  2010-08-03  5:54               ` [tip:perf/core] perf session: Free the ref_reloc_sym memory at the right place tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-03  5:54               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-03  5:55               ` [tip:perf/core] perf tools: Don't keep unreferenced maps when unmaps are detected tip-bot for Arnaldo Carvalho de Melo
                                 ` (134 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-03  5:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  70597f21f128b7dd6a2490078bea99d704b6f8c3
Gitweb:     http://git.kernel.org/tip/70597f21f128b7dd6a2490078bea99d704b6f8c3
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 2 Aug 2010 18:59:28 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Aug 2010 19:01:09 -0300

perf session: Invalidate last_match when removing threads from rb_tree

If we receive two PERF_RECORD_EXIT for the same thread, we can end up
reusing session->last_match and trying to remove the thread twice from
the rb_tree, causing a segfault, so invalidade last_match in
perf_session__remove_thread.

Receiving two PERF_RECORD_EXIT for the same thread is a bug, but its a
harmless one if we make the tool more robust, like this patch does.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 5d2fd52..fa9d652 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -166,6 +166,7 @@ void perf_session__delete(struct perf_session *self)
 
 void perf_session__remove_thread(struct perf_session *self, struct thread *th)
 {
+	self->last_match = NULL;
 	rb_erase(&th->rb_node, &self->threads);
 	/*
 	 * We may have references to this thread, for instance in some hist_entry

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

* [tip:perf/core] perf tools: Don't keep unreferenced maps when unmaps are detected
       [not found]             ` <new-submission>
                                 ` (571 preceding siblings ...)
  2010-08-03  5:54               ` [tip:perf/core] perf session: Invalidate last_match when removing threads from rb_tree tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-03  5:55               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:04               ` [tip:perf/core] perf symbols: Store the symbol binding tip-bot for Arnaldo Carvalho de Melo
                                 ` (133 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-03  5:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  0a1eae391d0d92b60cff9f55cdaf3861b4e33922
Gitweb:     http://git.kernel.org/tip/0a1eae391d0d92b60cff9f55cdaf3861b4e33922
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 2 Aug 2010 19:45:23 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Aug 2010 19:45:23 -0300

perf tools: Don't keep unreferenced maps when unmaps are detected

For a file with:

[root@emilia linux-2.6-tip]# perf report -D -fi allmodconfig-j32.perf.data | grep events:
     TOTAL events:      36933
      MMAP events:       9056
      LOST events:          0
      COMM events:       1702
      EXIT events:       1887
  THROTTLE events:          8
UNTHROTTLE events:          8
      FORK events:       1894
      READ events:          0
    SAMPLE events:      22378
      ATTR events:          0
EVENT_TYPE events:          0
TRACING_DATA events:          0
  BUILD_ID events:          0
[root@emilia linux-2.6-tip]#

Testing with valgrind and making perf_session__delete() a nop, so that
we can notice how many maps were actually deleted due to not having any
samples on it:

==== HEAP SUMMARY:

Before:

==10339==     in use at exit: 8,909,997 bytes in 68,690 blocks
==10339==   total heap usage: 78,696 allocs, 10,007 frees, 11,925,853 bytes allocated

After:

==10506==     in use at exit: 8,902,605 bytes in 68,606 blocks
==10506==   total heap usage: 78,696 allocs, 10,091 frees, 11,925,853 bytes allocated

I.e. just 84 detected unmaps with no hits out of 9056 for this workload,
not much, but in some other long running workload this may save more
bytes.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |    2 ++
 tools/perf/util/map.c  |   31 +++++++++++++++++++++----------
 tools/perf/util/map.h  |    3 ++-
 3 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index a6cea28..e7263d4 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -93,6 +93,8 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
 	if (self != NULL) {
 		*self = *template;
 		self->nr_events = 1;
+		if (self->ms.map)
+			self->ms.map->referenced = true;
 		if (symbol_conf.use_callchain)
 			callchain_init(self->callchain);
 	}
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 801e696..3a7eb6e 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -29,6 +29,7 @@ void map__init(struct map *self, enum map_type type,
 	self->unmap_ip = map__unmap_ip;
 	RB_CLEAR_NODE(&self->rb_node);
 	self->groups   = NULL;
+	self->referenced = false;
 }
 
 struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
@@ -387,6 +388,7 @@ int map_groups__fixup_overlappings(struct map_groups *self, struct map *map,
 {
 	struct rb_root *root = &self->maps[map->type];
 	struct rb_node *next = rb_first(root);
+	int err = 0;
 
 	while (next) {
 		struct map *pos = rb_entry(next, struct map, rb_node);
@@ -403,20 +405,16 @@ int map_groups__fixup_overlappings(struct map_groups *self, struct map *map,
 
 		rb_erase(&pos->rb_node, root);
 		/*
-		 * We may have references to this map, for instance in some
-		 * hist_entry instances, so just move them to a separate
-		 * list.
-		 */
-		list_add_tail(&pos->node, &self->removed_maps[map->type]);
-		/*
 		 * Now check if we need to create new maps for areas not
 		 * overlapped by the new map:
 		 */
 		if (map->start > pos->start) {
 			struct map *before = map__clone(pos);
 
-			if (before == NULL)
-				return -ENOMEM;
+			if (before == NULL) {
+				err = -ENOMEM;
+				goto move_map;
+			}
 
 			before->end = map->start - 1;
 			map_groups__insert(self, before);
@@ -427,14 +425,27 @@ int map_groups__fixup_overlappings(struct map_groups *self, struct map *map,
 		if (map->end < pos->end) {
 			struct map *after = map__clone(pos);
 
-			if (after == NULL)
-				return -ENOMEM;
+			if (after == NULL) {
+				err = -ENOMEM;
+				goto move_map;
+			}
 
 			after->start = map->end + 1;
 			map_groups__insert(self, after);
 			if (verbose >= 2)
 				map__fprintf(after, fp);
 		}
+move_map:
+		/*
+		 * If we have references, just move them to a separate list.
+		 */
+		if (pos->referenced)
+			list_add_tail(&pos->node, &self->removed_maps[map->type]);
+		else
+			map__delete(pos);
+
+		if (err)
+			return err;
 	}
 
 	return 0;
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 5b51bbd..7857579 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -29,7 +29,8 @@ struct map {
 	};
 	u64			start;
 	u64			end;
-	enum map_type		type;
+	u8 /* enum map_type */	type;
+	bool			referenced;
 	u32			priv;
 	u64			pgoff;
 

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

* [tip:perf/core] perf symbols: Store the symbol binding
       [not found]             ` <new-submission>
                                 ` (572 preceding siblings ...)
  2010-08-03  5:55               ` [tip:perf/core] perf tools: Don't keep unreferenced maps when unmaps are detected tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:04               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:04               ` [tip:perf/core] perf ui: Add a map browser tip-bot for Arnaldo Carvalho de Melo
                                 ` (132 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault,
	fweisbec, srikar, tglx

Commit-ID:  c408fedfc4a1fa16e611ffd6f3280301b38614be
Gitweb:     http://git.kernel.org/tip/c408fedfc4a1fa16e611ffd6f3280301b38614be
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 12:59:47 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:01 -0300

perf symbols: Store the symbol binding

So that tools that wan't to act only on a subset of (weak, global,
local) symbols can do so, such as the upcoming uprobes support in 'perf
probe'.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   30 ++++++++++++++++++++++--------
 tools/perf/util/symbol.h |    1 +
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 6f0dd90..b6f5970 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -131,7 +131,8 @@ static void map_groups__fixup_end(struct map_groups *self)
 		__map_groups__fixup_end(self, i);
 }
 
-static struct symbol *symbol__new(u64 start, u64 len, const char *name)
+static struct symbol *symbol__new(u64 start, u64 len, u8 binding,
+				  const char *name)
 {
 	size_t namelen = strlen(name) + 1;
 	struct symbol *self = calloc(1, (symbol_conf.priv_size +
@@ -144,6 +145,7 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name)
 
 	self->start   = start;
 	self->end     = len ? start + len - 1 : start;
+	self->binding = binding;
 	self->namelen = namelen - 1;
 
 	pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
@@ -160,8 +162,11 @@ void symbol__delete(struct symbol *self)
 
 static size_t symbol__fprintf(struct symbol *self, FILE *fp)
 {
-	return fprintf(fp, " %llx-%llx %s\n",
-		       self->start, self->end, self->name);
+	return fprintf(fp, " %llx-%llx %c %s\n",
+		       self->start, self->end,
+		       self->binding == STB_GLOBAL ? 'g' :
+		       self->binding == STB_LOCAL  ? 'l' : 'w',
+		       self->name);
 }
 
 void dso__set_long_name(struct dso *self, char *name)
@@ -453,6 +458,14 @@ struct process_kallsyms_args {
 	struct dso *dso;
 };
 
+static u8 kallsyms2elf_type(char type)
+{
+	if (type == 'W')
+		return STB_WEAK;
+
+	return isupper(type) ? STB_GLOBAL : STB_LOCAL;
+}
+
 static int map__process_kallsym_symbol(void *arg, const char *name,
 				       char type, u64 start)
 {
@@ -466,7 +479,7 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
 	/*
 	 * Will fix up the end later, when we have all symbols sorted.
 	 */
-	sym = symbol__new(start, 0, name);
+	sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
 
 	if (sym == NULL)
 		return -ENOMEM;
@@ -661,7 +674,7 @@ static int dso__load_perf_map(struct dso *self, struct map *map,
 		if (len + 2 >= line_len)
 			continue;
 
-		sym = symbol__new(start, size, line + len);
+		sym = symbol__new(start, size, STB_GLOBAL, line + len);
 
 		if (sym == NULL)
 			goto out_delete_line;
@@ -873,7 +886,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, struct map *map,
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname);
+					STB_GLOBAL, sympltname);
 			if (!f)
 				goto out_elf_end;
 
@@ -895,7 +908,7 @@ static int dso__synthesize_plt_symbols(struct  dso *self, struct map *map,
 				 "%s@plt", elf_sym__name(&sym, symstrs));
 
 			f = symbol__new(plt_offset, shdr_plt.sh_entsize,
-					sympltname);
+					STB_GLOBAL, sympltname);
 			if (!f)
 				goto out_elf_end;
 
@@ -1146,7 +1159,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
 		if (demangled != NULL)
 			elf_name = demangled;
 new_symbol:
-		f = symbol__new(sym.st_value, sym.st_size, elf_name);
+		f = symbol__new(sym.st_value, sym.st_size,
+				GELF_ST_BIND(sym.st_info), elf_name);
 		free(demangled);
 		if (!f)
 			goto out_elf_end;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 906be20..b7a8da4 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -53,6 +53,7 @@ struct symbol {
 	u64		start;
 	u64		end;
 	u16		namelen;
+	u8		binding;
 	char		name[0];
 };
 

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

* [tip:perf/core] perf ui: Add a map browser
       [not found]             ` <new-submission>
                                 ` (573 preceding siblings ...)
  2010-08-06 17:04               ` [tip:perf/core] perf symbols: Store the symbol binding tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:04               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:04               ` [tip:perf/core] perf ui: Shorten ui_browser->refresh_entries to refresh tip-bot for Arnaldo Carvalho de Melo
                                 ` (131 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault,
	fweisbec, srikar, tglx

Commit-ID:  9a725995e88fd3fd79daf99819c51d676ba37ad9
Gitweb:     http://git.kernel.org/tip/9a725995e88fd3fd79daf99819c51d676ba37ad9
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 17:00:42 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:01 -0300

perf ui: Add a map browser

Press -> and then "Browse map details" to see the DSO long name as the title
and the list of symbols in the DSO used by the map where the current symbol is.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |  129 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 91de99b..fc4a2b3 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -13,6 +13,7 @@
 #include <slang.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <elf.h>
 #include <newt.h>
 #include <sys/ttydefaults.h>
 
@@ -280,6 +281,7 @@ struct ui_browser {
 	u16		top, left, width, height;
 	void		*priv;
 	unsigned int	(*refresh_entries)(struct ui_browser *self);
+	void		(*write)(struct ui_browser *self, void *entry, int row);
 	void		(*seek)(struct ui_browser *self,
 				off_t offset, int whence);
 	u32		nr_entries;
@@ -316,6 +318,58 @@ static void ui_browser__list_head_seek(struct ui_browser *self,
 	self->first_visible_entry = pos;
 }
 
+static void ui_browser__rb_tree_seek(struct ui_browser *self,
+				     off_t offset, int whence)
+{
+	struct rb_root *root = self->entries;
+	struct rb_node *nd;
+
+	switch (whence) {
+	case SEEK_SET:
+		nd = rb_first(root);
+		break;
+	case SEEK_CUR:
+		nd = self->first_visible_entry;
+		break;
+	case SEEK_END:
+		nd = rb_last(root);
+		break;
+	default:
+		return;
+	}
+
+	if (offset > 0) {
+		while (offset-- != 0)
+			nd = rb_next(nd);
+	} else {
+		while (offset++ != 0)
+			nd = rb_prev(nd);
+	}
+
+	self->first_visible_entry = nd;
+}
+
+static unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
+{
+	struct rb_node *nd;
+	int row = 0;
+
+	if (self->first_visible_entry == NULL)
+                self->first_visible_entry = rb_first(self->entries);
+
+	nd = self->first_visible_entry;
+
+	while (nd != NULL) {
+		SLsmg_gotorc(self->top + row, self->left);
+		self->write(self, nd, row);
+		if (++row == self->height)
+			break;
+		nd = rb_next(nd);
+	}
+
+	return row;
+}
+
 static bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
 {
 	return (self->first_visible_entry_idx + row) == self->index;
@@ -592,6 +646,70 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 	return ret;
 }
 
+/* -------------------------------------------------------------------- */
+
+struct map_browser {
+	struct ui_browser b;
+	struct map	  *map;
+	u16		  namelen;
+	u8		  addrlen;
+};
+
+static void map_browser__write(struct ui_browser *self, void *nd, int row)
+{
+	struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
+	struct map_browser *mb = container_of(self, struct map_browser, b);
+	bool current_entry = ui_browser__is_current_entry(self, row);
+	int color = ui_browser__percent_color(0, current_entry);
+
+	SLsmg_set_color(color);
+	slsmg_printf("%*llx %*llx %c ",
+		     mb->addrlen, sym->start, mb->addrlen, sym->end,
+		     sym->binding == STB_GLOBAL ? 'g' :
+		     sym->binding == STB_LOCAL  ? 'l' : 'w');
+	slsmg_write_nstring(sym->name, mb->namelen);
+}
+
+static int map__browse(struct map *self)
+{
+	struct map_browser mb = {
+		.b = {
+			.entries = &self->dso->symbols[self->type],
+			.refresh_entries = ui_browser__rb_tree_refresh,
+			.seek	 = ui_browser__rb_tree_seek,
+			.write	 = map_browser__write,
+		},
+	};
+	struct newtExitStruct es;
+	struct rb_node *nd;
+	char tmp[BITS_PER_LONG / 4];
+	u64 maxaddr = 0;
+	int ret;
+
+	ui_helpline__push("Press <- or ESC to exit");
+
+	for (nd = rb_first(mb.b.entries); nd; nd = rb_next(nd)) {
+		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
+
+		if (mb.namelen < pos->namelen)
+			mb.namelen = pos->namelen;
+		if (maxaddr < pos->end)
+			maxaddr = pos->end;
+		++mb.b.nr_entries;
+	}
+
+	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
+	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
+	ui_browser__show(&mb.b, self->dso->long_name);
+	ret = ui_browser__run(&mb.b, &es);
+	newtFormDestroy(mb.b.form);
+	newtPopWindow();
+	ui_helpline__pop();
+	return ret;
+}
+
+/* -------------------------------------------------------------------- */
+
 struct hist_browser {
 	struct ui_browser   b;
 	struct hists	    *hists;
@@ -680,7 +798,8 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 		const struct dso *dso;
 		char *options[16];
 		int nr_options = 0, choice = 0, i,
-		    annotate = -2, zoom_dso = -2, zoom_thread = -2;
+		    annotate = -2, zoom_dso = -2, zoom_thread = -2,
+		    browse_map = -2;
 
 		if (hist_browser__run(browser, msg, &es))
 			break;
@@ -771,6 +890,10 @@ do_help:
 			     (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
 			zoom_dso = nr_options++;
 
+		if (browser->selection->map != NULL &&
+		    asprintf(&options[nr_options], "Browse map details") > 0)
+			browse_map = nr_options++;
+
 		options[nr_options++] = (char *)"Exit";
 
 		choice = popup_menu(nr_options, options);
@@ -800,7 +923,9 @@ do_annotate:
 				continue;
 
 			hist_entry__tui_annotate(he);
-		} else if (choice == zoom_dso) {
+		} else if (choice == browse_map)
+			map__browse(browser->selection->map);
+		else if (choice == zoom_dso) {
 zoom_dso:
 			if (dso_filter) {
 				pstack__remove(fstack, &dso_filter);

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

* [tip:perf/core] perf ui: Shorten ui_browser->refresh_entries to refresh
       [not found]             ` <new-submission>
                                 ` (574 preceding siblings ...)
  2010-08-06 17:04               ` [tip:perf/core] perf ui: Add a map browser tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:04               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:05               ` [tip:perf/core] perf hists: Handle verbose in hists__sort_list_width tip-bot for Arnaldo Carvalho de Melo
                                 ` (130 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  76ce93d0b61fa8c61b9cd917d9f7190b40fb29b6
Gitweb:     http://git.kernel.org/tip/76ce93d0b61fa8c61b9cd917d9f7190b40fb29b6
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 17:02:54 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:01 -0300

perf ui: Shorten ui_browser->refresh_entries to refresh

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index fc4a2b3..f98a240 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -280,7 +280,7 @@ struct ui_browser {
 	void		*first_visible_entry, *entries;
 	u16		top, left, width, height;
 	void		*priv;
-	unsigned int	(*refresh_entries)(struct ui_browser *self);
+	unsigned int	(*refresh)(struct ui_browser *self);
 	void		(*write)(struct ui_browser *self, void *entry, int row);
 	void		(*seek)(struct ui_browser *self,
 				off_t offset, int whence);
@@ -472,12 +472,12 @@ static int objdump_line__show(struct objdump_line *self, struct list_head *head,
 	return 0;
 }
 
-static int ui_browser__refresh_entries(struct ui_browser *self)
+static int ui_browser__refresh(struct ui_browser *self)
 {
 	int row;
 
 	newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
-	row = self->refresh_entries(self);
+	row = self->refresh(self);
 	SLsmg_set_color(HE_COLORSET_NORMAL);
 	SLsmg_fill_region(self->top + row, self->left,
 			  self->height - row, self->width, ' ');
@@ -487,7 +487,7 @@ static int ui_browser__refresh_entries(struct ui_browser *self)
 
 static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 {
-	if (ui_browser__refresh_entries(self) < 0)
+	if (ui_browser__refresh(self) < 0)
 		return -1;
 
 	while (1) {
@@ -558,7 +558,7 @@ static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 		default:
 			return es->u.key;
 		}
-		if (ui_browser__refresh_entries(self) < 0)
+		if (ui_browser__refresh(self) < 0)
 			return -1;
 	}
 	return 0;
@@ -621,9 +621,9 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 	ui_helpline__push("Press <- or ESC to exit");
 
 	memset(&browser, 0, sizeof(browser));
-	browser.entries		= &head;
-	browser.refresh_entries = hist_entry__annotate_browser_refresh;
-	browser.seek		= ui_browser__list_head_seek;
+	browser.entries	= &head;
+	browser.refresh = hist_entry__annotate_browser_refresh;
+	browser.seek	= ui_browser__list_head_seek;
 	browser.priv = self;
 	list_for_each_entry(pos, &head, node) {
 		size_t line_len = strlen(pos->line);
@@ -675,7 +675,7 @@ static int map__browse(struct map *self)
 	struct map_browser mb = {
 		.b = {
 			.entries = &self->dso->symbols[self->type],
-			.refresh_entries = ui_browser__rb_tree_refresh,
+			.refresh = ui_browser__rb_tree_refresh,
 			.seek	 = ui_browser__rb_tree_seek,
 			.write	 = map_browser__write,
 		},
@@ -720,7 +720,7 @@ struct hist_browser {
 static void hist_browser__reset(struct hist_browser *self);
 static int hist_browser__run(struct hist_browser *self, const char *title,
 			     struct newtExitStruct *es);
-static unsigned int hist_browser__refresh_entries(struct ui_browser *self);
+static unsigned int hist_browser__refresh(struct ui_browser *self);
 static void ui_browser__hists_seek(struct ui_browser *self,
 				   off_t offset, int whence);
 
@@ -730,7 +730,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
 
 	if (self) {
 		self->hists = hists;
-		self->b.refresh_entries = hist_browser__refresh_entries;
+		self->b.refresh = hist_browser__refresh;
 		self->b.seek = ui_browser__hists_seek;
 	}
 
@@ -1338,7 +1338,7 @@ static int hist_browser__show_entry(struct hist_browser *self,
 	return printed;
 }
 
-static unsigned int hist_browser__refresh_entries(struct ui_browser *self)
+static unsigned int hist_browser__refresh(struct ui_browser *self)
 {
 	unsigned row = 0;
 	struct rb_node *nd;

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

* [tip:perf/core] perf hists: Handle verbose in hists__sort_list_width
       [not found]             ` <new-submission>
                                 ` (575 preceding siblings ...)
  2010-08-06 17:04               ` [tip:perf/core] perf ui: Shorten ui_browser->refresh_entries to refresh tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:05               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:05               ` [tip:perf/core] perf hists: Fixup addr snprintf width on 32 bit arches tip-bot for Arnaldo Carvalho de Melo
                                 ` (129 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  903cce6eb9117550755de9bf92f3b48367b7dfe0
Gitweb:     http://git.kernel.org/tip/903cce6eb9117550755de9bf92f3b48367b7dfe0
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 19:15:48 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:01 -0300

perf hists: Handle verbose in hists__sort_list_width

Otherwise entries will get chopped up on the window.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e7263d4..62ec9b0 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -876,6 +876,9 @@ unsigned int hists__sort_list_width(struct hists *self)
 		if (!se->elide)
 			ret += 2 + hists__col_len(self, se->se_width_idx);
 
+	if (verbose) /* Addr + origin */
+		ret += 3 + BITS_PER_LONG / 4;
+
 	return ret;
 }
 

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

* [tip:perf/core] perf hists: Fixup addr snprintf width on 32 bit arches
       [not found]             ` <new-submission>
                                 ` (576 preceding siblings ...)
  2010-08-06 17:05               ` [tip:perf/core] perf hists: Handle verbose in hists__sort_list_width tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:05               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:05               ` [tip:perf/core] perf ui: Add search by name/addr to the map__browser tip-bot for Arnaldo Carvalho de Melo
                                 ` (128 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  fb89941ea761f53201959cc217a2c73f6fe13855
Gitweb:     http://git.kernel.org/tip/fb89941ea761f53201959cc217a2c73f6fe13855
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 19:17:22 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:01 -0300

perf hists: Fixup addr snprintf width on 32 bit arches

By using BITS_PER_LONG/4 as the width specifier.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 1c61a4f..b62a553 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -196,7 +196,8 @@ static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf,
 
 	if (verbose) {
 		char o = self->ms.map ? dso__symtab_origin(self->ms.map->dso) : '!';
-		ret += repsep_snprintf(bf, size, "%#018llx %c ", self->ip, o);
+		ret += repsep_snprintf(bf, size, "%*Lx %c ",
+				       BITS_PER_LONG / 4, self->ip, o);
 	}
 
 	ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", self->level);
@@ -204,7 +205,8 @@ static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf,
 		ret += repsep_snprintf(bf + ret, size - ret, "%s",
 				       self->ms.sym->name);
 	else
-		ret += repsep_snprintf(bf + ret, size - ret, "%#016llx", self->ip);
+		ret += repsep_snprintf(bf + ret, size - ret, "%*Lx",
+				       BITS_PER_LONG / 4, self->ip);
 
 	return ret;
 }

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

* [tip:perf/core] perf ui: Add search by name/addr to the map__browser
       [not found]             ` <new-submission>
                                 ` (577 preceding siblings ...)
  2010-08-06 17:05               ` [tip:perf/core] perf hists: Fixup addr snprintf width on 32 bit arches tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:05               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-06 17:06               ` [tip:perf/core] perf report: Speed up exit path tip-bot for Arnaldo Carvalho de Melo
                                 ` (127 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault,
	fweisbec, srikar, tglx

Commit-ID:  80d50cae1b9cc958171c36fffc7357a5abad808c
Gitweb:     http://git.kernel.org/tip/80d50cae1b9cc958171c36fffc7357a5abad808c
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 19:28:27 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:38:02 -0300

perf ui: Add search by name/addr to the map__browser

Only in verbose mode so as not to bloat struct symbol too much.

The key used is '/', just like in vi, less, etc.

More work is needed to allocate space on the symbol in a more clear way.

This experiment shows how to do it for the hist_browser, in the main
window.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |   18 +++++++-
 tools/perf/util/newt.c      |  109 +++++++++++++++++++++++++++++++++++++++----
 2 files changed, 117 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2f4b929..4a7a743 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -478,8 +478,24 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
 	 * so don't allocate extra space that won't be used in the stdio
 	 * implementation.
 	 */
-	if (use_browser > 0)
+	if (use_browser > 0) {
 		symbol_conf.priv_size = sizeof(struct sym_priv);
+		/*
+ 		 * For searching by name on the "Browse map details".
+ 		 * providing it only in verbose mode not to bloat too
+ 		 * much struct symbol.
+ 		 */
+		if (verbose) {
+			/*
+			 * XXX: Need to provide a less kludgy way to ask for
+			 * more space per symbol, the u32 is for the index on
+			 * the ui browser.
+			 * See symbol__browser_index.
+			 */
+			symbol_conf.priv_size += sizeof(u32);
+			symbol_conf.sort_by_name = true;
+		}
+	}
 
 	if (symbol__init() < 0)
 		return -1;
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index f98a240..e2deae0 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -128,6 +128,39 @@ static void ui_helpline__puts(const char *msg)
 	ui_helpline__push(msg);
 }
 
+static int ui_entry__read(const char *title, char *bf, size_t size, int width)
+{
+	struct newtExitStruct es;
+	newtComponent form, entry;
+	const char *result;
+	int err = -1;
+
+	newtCenteredWindow(width, 1, title);
+	form = newtForm(NULL, NULL, 0);
+	if (form == NULL)
+		return -1;
+
+	entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL);
+	if (entry == NULL)
+		goto out_free_form;
+
+	newtFormAddComponent(form, entry);
+	newtFormAddHotKey(form, NEWT_KEY_ENTER);
+	newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
+	newtFormAddHotKey(form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(form, CTRL('c'));
+	newtFormRun(form, &es);
+
+	if (result != NULL) {
+		strncpy(bf, result, size);
+		err = 0;
+	}
+out_free_form:
+	newtPopWindow();
+	newtFormDestroy(form);
+	return 0;
+}
+
 static char browser__last_msg[1024];
 
 int browser__show_help(const char *format, va_list ap)
@@ -670,6 +703,67 @@ static void map_browser__write(struct ui_browser *self, void *nd, int row)
 	slsmg_write_nstring(sym->name, mb->namelen);
 }
 
+/* FIXME uber-kludgy, see comment on cmd_report... */
+static u32 *symbol__browser_index(struct symbol *self)
+{
+	return ((void *)self) - sizeof(struct rb_node) - sizeof(u32);
+}
+
+static int map_browser__search(struct map_browser *self)
+{
+	char target[512];
+	struct symbol *sym;
+	int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40);
+
+	if (err)
+		return err;
+
+	if (target[0] == '0' && tolower(target[1]) == 'x') {
+		u64 addr = strtoull(target, NULL, 16);
+		sym = map__find_symbol(self->map, addr, NULL);
+	} else
+		sym = map__find_symbol_by_name(self->map, target, NULL);
+
+	if (sym != NULL) {
+		u32 *idx = symbol__browser_index(sym);
+			
+		self->b.first_visible_entry = &sym->rb_node;
+		self->b.index = self->b.first_visible_entry_idx = *idx;
+	} else
+		ui_helpline__fpush("%s not found!", target);
+
+	return 0;
+}
+
+static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
+{
+	if (ui_browser__show(&self->b, self->map->dso->long_name) < 0)
+		return -1;
+
+	ui_helpline__fpush("Press <- or ESC to exit, %s / to search",
+			   verbose ? "" : "restart with -v to use");
+	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+	if (verbose)
+		newtFormAddHotKey(self->b.form, '/');
+
+	while (1) {
+		ui_browser__run(&self->b, es);
+
+		if (es->reason != NEWT_EXIT_HOTKEY)
+			break;
+		if (verbose && es->u.key == '/')
+			map_browser__search(self);
+		else
+			break;
+	}
+
+	newtFormDestroy(self->b.form);
+	newtPopWindow();
+	ui_helpline__pop();
+	return 0;
+}
+
 static int map__browse(struct map *self)
 {
 	struct map_browser mb = {
@@ -679,14 +773,12 @@ static int map__browse(struct map *self)
 			.seek	 = ui_browser__rb_tree_seek,
 			.write	 = map_browser__write,
 		},
+		.map = self,
 	};
 	struct newtExitStruct es;
 	struct rb_node *nd;
 	char tmp[BITS_PER_LONG / 4];
 	u64 maxaddr = 0;
-	int ret;
-
-	ui_helpline__push("Press <- or ESC to exit");
 
 	for (nd = rb_first(mb.b.entries); nd; nd = rb_next(nd)) {
 		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
@@ -695,17 +787,16 @@ static int map__browse(struct map *self)
 			mb.namelen = pos->namelen;
 		if (maxaddr < pos->end)
 			maxaddr = pos->end;
+		if (verbose) {
+			u32 *idx = symbol__browser_index(pos);
+			*idx = mb.b.nr_entries;
+		}
 		++mb.b.nr_entries;
 	}
 
 	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
 	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
-	ui_browser__show(&mb.b, self->dso->long_name);
-	ret = ui_browser__run(&mb.b, &es);
-	newtFormDestroy(mb.b.form);
-	newtPopWindow();
-	ui_helpline__pop();
-	return ret;
+	return map_browser__run(&mb, &es);
 }
 
 /* -------------------------------------------------------------------- */

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

* [tip:perf/core] perf report: Speed up exit path
       [not found]             ` <new-submission>
                                 ` (578 preceding siblings ...)
  2010-08-06 17:05               ` [tip:perf/core] perf ui: Add search by name/addr to the map__browser tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-06 17:06               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-07  7:01               ` [tip:perf/core] perf tui: Introduce list_head based generic ui_browser refresh routine tip-bot for Arnaldo Carvalho de Melo
                                 ` (126 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-06 17:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, npiggin,
	fweisbec, tglx

Commit-ID:  71e7cf3a37ba6189fa7215555e8e760b400fc23b
Gitweb:     http://git.kernel.org/tip/71e7cf3a37ba6189fa7215555e8e760b400fc23b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 5 Aug 2010 19:41:44 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 Aug 2010 19:46:47 -0300

perf report: Speed up exit path

When cmd_record exits the whole perf binary will exit right after,
so no need to traverse lots of complex data structures freeing them.

Sticked a comment for leak detectives and for a experiment with obstacks
to be performed so that we can speed up freeing that memory.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4a7a743..55fc1f4 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -348,7 +348,18 @@ static int __cmd_report(void)
 		hists__tty_browse_tree(&session->hists_tree, help);
 
 out_delete:
-	perf_session__delete(session);
+	/*
+	 * Speed up the exit process, for large files this can
+	 * take quite a while.
+	 *
+	 * XXX Enable this when using valgrind or if we ever
+	 * librarize this command.
+	 *
+	 * Also experiment with obstacks to see how much speed
+	 * up we'll get here.
+	 *
+ 	 * perf_session__delete(session);
+ 	 */
 	return ret;
 }
 

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

* [tip:perf/core] perf tui: Introduce list_head based generic ui_browser refresh routine
       [not found]             ` <new-submission>
                                 ` (579 preceding siblings ...)
  2010-08-06 17:06               ` [tip:perf/core] perf report: Speed up exit path tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-07  7:01               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-07  7:01               ` [tip:perf/core] perf ui: Start breaking down newt.c into multiple files tip-bot for Arnaldo Carvalho de Melo
                                 ` (125 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-07  7:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  43730982c3e9355dd8bd6b31f0a0a3508ad4209d
Gitweb:     http://git.kernel.org/tip/43730982c3e9355dd8bd6b31f0a0a3508ad4209d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 6 Aug 2010 16:51:12 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 6 Aug 2010 16:51:12 -0300

perf tui: Introduce list_head based generic ui_browser refresh routine

So that building other browser based on structures linked via a linked
list can be as easy as it is already for the ones linked via an rb_tree.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/include/linux/list.h |    8 +++++
 tools/perf/util/newt.c               |   49 ++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/tools/perf/util/include/linux/list.h b/tools/perf/util/include/linux/list.h
index dbe4b81..f5ca26e 100644
--- a/tools/perf/util/include/linux/list.h
+++ b/tools/perf/util/include/linux/list.h
@@ -15,4 +15,12 @@ static inline void list_del_range(struct list_head *begin,
 	begin->prev->next = end->next;
 	end->next->prev = begin->prev;
 }
+
+/**
+ * list_for_each_from	-	iterate over a list from one of its nodes
+ * @pos:  the &struct list_head to use as a loop cursor, from where to start
+ * @head: the head for your list.
+ */
+#define list_for_each_from(pos, head) \
+	for (; prefetch(pos->next), pos != (head); pos = pos->next)
 #endif
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index e2deae0..37fe8eb 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -456,20 +456,24 @@ static int ui_browser__show(struct ui_browser *self, const char *title)
 	return 0;
 }
 
-static int objdump_line__show(struct objdump_line *self, struct list_head *head,
-			      int width, struct hist_entry *he, int len,
-			      bool current_entry)
+static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
 {
-	if (self->offset != -1) {
+	struct objdump_line *ol = rb_entry(entry, struct objdump_line, node);
+	bool current_entry = ui_browser__is_current_entry(self, row);
+	int width = self->width;
+
+	if (ol->offset != -1) {
+		struct hist_entry *he = self->priv;
 		struct symbol *sym = he->ms.sym;
+		int len = he->ms.sym->end - he->ms.sym->start;
 		unsigned int hits = 0;
 		double percent = 0.0;
 		int color;
 		struct sym_priv *priv = symbol__priv(sym);
 		struct sym_ext *sym_ext = priv->ext;
 		struct sym_hist *h = priv->hist;
-		s64 offset = self->offset;
-		struct objdump_line *next = objdump__get_next_ip_line(head, self);
+		s64 offset = ol->offset;
+		struct objdump_line *next = objdump__get_next_ip_line(self->entries, ol);
 
 		while (offset < (s64)len &&
 		       (next == NULL || offset < next->offset)) {
@@ -497,12 +501,10 @@ static int objdump_line__show(struct objdump_line *self, struct list_head *head,
 
 	SLsmg_write_char(':');
 	slsmg_write_nstring(" ", 8);
-	if (!*self->line)
+	if (!*ol->line)
 		slsmg_write_nstring(" ", width - 18);
 	else
-		slsmg_write_nstring(self->line, width - 18);
-
-	return 0;
+		slsmg_write_nstring(ol->line, width - 18);
 }
 
 static int ui_browser__refresh(struct ui_browser *self)
@@ -607,24 +609,20 @@ static char *callchain_list__sym_name(struct callchain_list *self,
 	return bf;
 }
 
-static unsigned int hist_entry__annotate_browser_refresh(struct ui_browser *self)
+static unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
 {
-	struct objdump_line *pos;
+	struct list_head *pos;
 	struct list_head *head = self->entries;
-	struct hist_entry *he = self->priv;
 	int row = 0;
-	int len = he->ms.sym->end - he->ms.sym->start;
 
 	if (self->first_visible_entry == NULL || self->first_visible_entry == self->entries)
                 self->first_visible_entry = head->next;
 
-	pos = list_entry(self->first_visible_entry, struct objdump_line, node);
+	pos = self->first_visible_entry;
 
-	list_for_each_entry_from(pos, head, node) {
-		bool current_entry = ui_browser__is_current_entry(self, row);
+	list_for_each_from(pos, head) {
 		SLsmg_gotorc(self->top + row, self->left);
-		objdump_line__show(pos, head, self->width,
-				   he, len, current_entry);
+		self->write(self, pos, row);
 		if (++row == self->height)
 			break;
 	}
@@ -634,10 +632,16 @@ static unsigned int hist_entry__annotate_browser_refresh(struct ui_browser *self
 
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
-	struct ui_browser browser;
 	struct newtExitStruct es;
 	struct objdump_line *pos, *n;
 	LIST_HEAD(head);
+	struct ui_browser browser = {
+		.entries = &head,
+		.refresh = ui_browser__list_head_refresh,
+		.seek	 = ui_browser__list_head_seek,
+		.write	 = annotate_browser__write,
+		.priv	 = self,
+	};
 	int ret;
 
 	if (self->ms.sym == NULL)
@@ -653,11 +657,6 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 
 	ui_helpline__push("Press <- or ESC to exit");
 
-	memset(&browser, 0, sizeof(browser));
-	browser.entries	= &head;
-	browser.refresh = hist_entry__annotate_browser_refresh;
-	browser.seek	= ui_browser__list_head_seek;
-	browser.priv = self;
 	list_for_each_entry(pos, &head, node) {
 		size_t line_len = strlen(pos->line);
 		if (browser.width < line_len)

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

* [tip:perf/core] perf ui: Start breaking down newt.c into multiple files
       [not found]             ` <new-submission>
                                 ` (580 preceding siblings ...)
  2010-08-07  7:01               ` [tip:perf/core] perf tui: Introduce list_head based generic ui_browser refresh routine tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-07  7:01               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:39               ` [tip:perf/core] perf ui: Shorten ui_browser member names tip-bot for Arnaldo Carvalho de Melo
                                 ` (124 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-07  7:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  ef8f34aabf2450a9fb36b2c87fe0ea0b86a38195
Gitweb:     http://git.kernel.org/tip/ef8f34aabf2450a9fb36b2c87fe0ea0b86a38195
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 6 Aug 2010 17:35:02 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 6 Aug 2010 21:50:41 -0300

perf ui: Start breaking down newt.c into multiple files

As new TUI features get added the newt.c file is growing a lot and its
name is growing misleading as an effort is being made to reduce the
coupling with libnewt.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile          |   10 +-
 tools/perf/util/newt.c       |  306 +----------------------------------------
 tools/perf/util/ui/browser.c |  313 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/ui/browser.h |   43 ++++++
 4 files changed, 368 insertions(+), 304 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 26f626d..d5bce76 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -157,9 +157,8 @@ all::
 #
 # Define NO_DWARF if you do not want debug-info analysis feature at all.
 
-$(shell sh -c 'mkdir -p $(OUTPUT)scripts/python/Perf-Trace-Util/' 2> /dev/null)
-$(shell sh -c 'mkdir -p $(OUTPUT)scripts/perl/Perf-Trace-Util/' 2> /dev/null)
-$(shell sh -c 'mkdir -p $(OUTPUT)util/scripting-engines/' 2> /dev/null)
+$(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null)
+$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui,scripting-engines}/' 2> /dev/null)
 $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null)
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@@ -569,6 +568,8 @@ else
 		BASIC_CFLAGS += -I/usr/include/slang
 		EXTLIBS += -lnewt -lslang
 		LIB_OBJS += $(OUTPUT)util/newt.o
+		LIB_OBJS += $(OUTPUT)util/ui/browser.o
+		LIB_H += util/ui/browser.h
 	endif
 endif
 
@@ -969,6 +970,9 @@ $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/newt.o: util/newt.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 37fe8eb..266a9e0 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -23,6 +23,7 @@
 #include "session.h"
 #include "sort.h"
 #include "symbol.h"
+#include "ui/browser.h"
 
 #if SLANG_VERSION < 20104
 #define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args)
@@ -35,6 +36,8 @@
 #define sltt_set_color SLtt_set_color
 #endif
 
+newtComponent newt_form__new(void);
+
 struct ui_progress {
 	newtComponent form, scale;
 };
@@ -190,7 +193,7 @@ static void newt_form__set_exit_keys(newtComponent self)
 	newtFormAddHotKey(self, CTRL('c'));
 }
 
-static newtComponent newt_form__new(void)
+newtComponent newt_form__new(void)
 {
 	newtComponent self = newtForm(NULL, NULL, 0);
 	if (self)
@@ -290,172 +293,6 @@ static void ui__error_window(const char *fmt, ...)
 	va_end(ap);
 }
 
-#define HE_COLORSET_TOP		50
-#define HE_COLORSET_MEDIUM	51
-#define HE_COLORSET_NORMAL	52
-#define HE_COLORSET_SELECTED	53
-#define HE_COLORSET_CODE	54
-
-static int ui_browser__percent_color(double percent, bool current)
-{
-	if (current)
-		return HE_COLORSET_SELECTED;
-	if (percent >= MIN_RED)
-		return HE_COLORSET_TOP;
-	if (percent >= MIN_GREEN)
-		return HE_COLORSET_MEDIUM;
-	return HE_COLORSET_NORMAL;
-}
-
-struct ui_browser {
-	newtComponent	form, sb;
-	u64		index, first_visible_entry_idx;
-	void		*first_visible_entry, *entries;
-	u16		top, left, width, height;
-	void		*priv;
-	unsigned int	(*refresh)(struct ui_browser *self);
-	void		(*write)(struct ui_browser *self, void *entry, int row);
-	void		(*seek)(struct ui_browser *self,
-				off_t offset, int whence);
-	u32		nr_entries;
-};
-
-static void ui_browser__list_head_seek(struct ui_browser *self,
-				       off_t offset, int whence)
-{
-	struct list_head *head = self->entries;
-	struct list_head *pos;
-
-	switch (whence) {
-	case SEEK_SET:
-		pos = head->next;
-		break;
-	case SEEK_CUR:
-		pos = self->first_visible_entry;
-		break;
-	case SEEK_END:
-		pos = head->prev;
-		break;
-	default:
-		return;
-	}
-
-	if (offset > 0) {
-		while (offset-- != 0)
-			pos = pos->next;
-	} else {
-		while (offset++ != 0)
-			pos = pos->prev;
-	}
-
-	self->first_visible_entry = pos;
-}
-
-static void ui_browser__rb_tree_seek(struct ui_browser *self,
-				     off_t offset, int whence)
-{
-	struct rb_root *root = self->entries;
-	struct rb_node *nd;
-
-	switch (whence) {
-	case SEEK_SET:
-		nd = rb_first(root);
-		break;
-	case SEEK_CUR:
-		nd = self->first_visible_entry;
-		break;
-	case SEEK_END:
-		nd = rb_last(root);
-		break;
-	default:
-		return;
-	}
-
-	if (offset > 0) {
-		while (offset-- != 0)
-			nd = rb_next(nd);
-	} else {
-		while (offset++ != 0)
-			nd = rb_prev(nd);
-	}
-
-	self->first_visible_entry = nd;
-}
-
-static unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
-{
-	struct rb_node *nd;
-	int row = 0;
-
-	if (self->first_visible_entry == NULL)
-                self->first_visible_entry = rb_first(self->entries);
-
-	nd = self->first_visible_entry;
-
-	while (nd != NULL) {
-		SLsmg_gotorc(self->top + row, self->left);
-		self->write(self, nd, row);
-		if (++row == self->height)
-			break;
-		nd = rb_next(nd);
-	}
-
-	return row;
-}
-
-static bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
-{
-	return (self->first_visible_entry_idx + row) == self->index;
-}
-
-static void ui_browser__refresh_dimensions(struct ui_browser *self)
-{
-	int cols, rows;
-	newtGetScreenSize(&cols, &rows);
-
-	if (self->width > cols - 4)
-		self->width = cols - 4;
-	self->height = rows - 5;
-	if (self->height > self->nr_entries)
-		self->height = self->nr_entries;
-	self->top  = (rows - self->height) / 2;
-	self->left = (cols - self->width) / 2;
-}
-
-static void ui_browser__reset_index(struct ui_browser *self)
-{
-	self->index = self->first_visible_entry_idx = 0;
-	self->seek(self, 0, SEEK_SET);
-}
-
-static int ui_browser__show(struct ui_browser *self, const char *title)
-{
-	if (self->form != NULL) {
-		newtFormDestroy(self->form);
-		newtPopWindow();
-	}
-	ui_browser__refresh_dimensions(self);
-	newtCenteredWindow(self->width, self->height, title);
-	self->form = newt_form__new();
-	if (self->form == NULL)
-		return -1;
-
-	self->sb = newtVerticalScrollbar(self->width, 0, self->height,
-					 HE_COLORSET_NORMAL,
-					 HE_COLORSET_SELECTED);
-	if (self->sb == NULL)
-		return -1;
-
-	newtFormAddHotKey(self->form, NEWT_KEY_UP);
-	newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
-	newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
-	newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
-	newtFormAddHotKey(self->form, NEWT_KEY_HOME);
-	newtFormAddHotKey(self->form, NEWT_KEY_END);
-	newtFormAddComponent(self->form, self->sb);
-	return 0;
-}
-
 static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
 {
 	struct objdump_line *ol = rb_entry(entry, struct objdump_line, node);
@@ -507,98 +344,6 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 		slsmg_write_nstring(ol->line, width - 18);
 }
 
-static int ui_browser__refresh(struct ui_browser *self)
-{
-	int row;
-
-	newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
-	row = self->refresh(self);
-	SLsmg_set_color(HE_COLORSET_NORMAL);
-	SLsmg_fill_region(self->top + row, self->left,
-			  self->height - row, self->width, ' ');
-
-	return 0;
-}
-
-static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
-{
-	if (ui_browser__refresh(self) < 0)
-		return -1;
-
-	while (1) {
-		off_t offset;
-
-		newtFormRun(self->form, es);
-
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-		if (is_exit_key(es->u.key))
-			return es->u.key;
-		switch (es->u.key) {
-		case NEWT_KEY_DOWN:
-			if (self->index == self->nr_entries - 1)
-				break;
-			++self->index;
-			if (self->index == self->first_visible_entry_idx + self->height) {
-				++self->first_visible_entry_idx;
-				self->seek(self, +1, SEEK_CUR);
-			}
-			break;
-		case NEWT_KEY_UP:
-			if (self->index == 0)
-				break;
-			--self->index;
-			if (self->index < self->first_visible_entry_idx) {
-				--self->first_visible_entry_idx;
-				self->seek(self, -1, SEEK_CUR);
-			}
-			break;
-		case NEWT_KEY_PGDN:
-		case ' ':
-			if (self->first_visible_entry_idx + self->height > self->nr_entries - 1)
-				break;
-
-			offset = self->height;
-			if (self->index + offset > self->nr_entries - 1)
-				offset = self->nr_entries - 1 - self->index;
-			self->index += offset;
-			self->first_visible_entry_idx += offset;
-			self->seek(self, +offset, SEEK_CUR);
-			break;
-		case NEWT_KEY_PGUP:
-			if (self->first_visible_entry_idx == 0)
-				break;
-
-			if (self->first_visible_entry_idx < self->height)
-				offset = self->first_visible_entry_idx;
-			else
-				offset = self->height;
-
-			self->index -= offset;
-			self->first_visible_entry_idx -= offset;
-			self->seek(self, -offset, SEEK_CUR);
-			break;
-		case NEWT_KEY_HOME:
-			ui_browser__reset_index(self);
-			break;
-		case NEWT_KEY_END:
-			offset = self->height - 1;
-			if (offset >= self->nr_entries)
-				offset = self->nr_entries - 1;
-
-			self->index = self->nr_entries - 1;
-			self->first_visible_entry_idx = self->index - offset;
-			self->seek(self, -offset, SEEK_END);
-			break;
-		default:
-			return es->u.key;
-		}
-		if (ui_browser__refresh(self) < 0)
-			return -1;
-	}
-	return 0;
-}
-
 static char *callchain_list__sym_name(struct callchain_list *self,
 				      char *bf, size_t bfsize)
 {
@@ -609,27 +354,6 @@ static char *callchain_list__sym_name(struct callchain_list *self,
 	return bf;
 }
 
-static unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
-{
-	struct list_head *pos;
-	struct list_head *head = self->entries;
-	int row = 0;
-
-	if (self->first_visible_entry == NULL || self->first_visible_entry == self->entries)
-                self->first_visible_entry = head->next;
-
-	pos = self->first_visible_entry;
-
-	list_for_each_from(pos, head) {
-		SLsmg_gotorc(self->top + row, self->left);
-		self->write(self, pos, row);
-		if (++row == self->height)
-			break;
-	}
-
-	return row;
-}
-
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
 	struct newtExitStruct es;
@@ -1093,20 +817,6 @@ int hists__tui_browse_tree(struct rb_root *self, const char *help)
 	return key;
 }
 
-static struct newtPercentTreeColors {
-	const char *topColorFg, *topColorBg;
-	const char *mediumColorFg, *mediumColorBg;
-	const char *normalColorFg, *normalColorBg;
-	const char *selColorFg, *selColorBg;
-	const char *codeColorFg, *codeColorBg;
-} defaultPercentTreeColors = {
-	"red",       "lightgray",
-	"green",     "lightgray",
-	"black",     "lightgray",
-	"lightgray", "magenta",
-	"blue",	     "lightgray",
-};
-
 static void newt_suspend(void *d __used)
 {
 	newtSuspend();
@@ -1116,8 +826,6 @@ static void newt_suspend(void *d __used)
 
 void setup_browser(void)
 {
-	struct newtPercentTreeColors *c = &defaultPercentTreeColors;
-
 	if (!isatty(1) || !use_browser || dump_trace) {
 		use_browser = 0;
 		setup_pager();
@@ -1129,11 +837,7 @@ void setup_browser(void)
 	newtCls();
 	newtSetSuspendCallback(newt_suspend, NULL);
 	ui_helpline__puts(" ");
-	sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
-	sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);
-	sltt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg);
-	sltt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg);
-	sltt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg);
+	ui_browser__init();
 }
 
 void exit_browser(bool wait_for_ok)
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
new file mode 100644
index 0000000..0b2b930
--- /dev/null
+++ b/tools/perf/util/ui/browser.c
@@ -0,0 +1,313 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#undef _GNU_SOURCE
+/*
+ * slang versions <= 2.0.6 have a "#if HAVE_LONG_LONG" that breaks
+ * the build if it isn't defined. Use the equivalent one that glibc
+ * has on features.h.
+ */
+#include <features.h>
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
+#endif
+#include <slang.h>
+#include <linux/list.h>
+#include <linux/rbtree.h>
+#include <stdlib.h>
+#include <sys/ttydefaults.h>
+#include "browser.h"
+#include "../color.h"
+#include "../util.h"
+
+#if SLANG_VERSION < 20104
+#define sltt_set_color(obj, name, fg, bg) \
+	SLtt_set_color(obj,(char *)name, (char *)fg, (char *)bg)
+#else
+#define sltt_set_color SLtt_set_color
+#endif
+
+newtComponent newt_form__new(void);
+
+int ui_browser__percent_color(double percent, bool current)
+{
+	if (current)
+		return HE_COLORSET_SELECTED;
+	if (percent >= MIN_RED)
+		return HE_COLORSET_TOP;
+	if (percent >= MIN_GREEN)
+		return HE_COLORSET_MEDIUM;
+	return HE_COLORSET_NORMAL;
+}
+
+void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence)
+{
+	struct list_head *head = self->entries;
+	struct list_head *pos;
+
+	switch (whence) {
+	case SEEK_SET:
+		pos = head->next;
+		break;
+	case SEEK_CUR:
+		pos = self->first_visible_entry;
+		break;
+	case SEEK_END:
+		pos = head->prev;
+		break;
+	default:
+		return;
+	}
+
+	if (offset > 0) {
+		while (offset-- != 0)
+			pos = pos->next;
+	} else {
+		while (offset++ != 0)
+			pos = pos->prev;
+	}
+
+	self->first_visible_entry = pos;
+}
+
+void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
+{
+	struct rb_root *root = self->entries;
+	struct rb_node *nd;
+
+	switch (whence) {
+	case SEEK_SET:
+		nd = rb_first(root);
+		break;
+	case SEEK_CUR:
+		nd = self->first_visible_entry;
+		break;
+	case SEEK_END:
+		nd = rb_last(root);
+		break;
+	default:
+		return;
+	}
+
+	if (offset > 0) {
+		while (offset-- != 0)
+			nd = rb_next(nd);
+	} else {
+		while (offset++ != 0)
+			nd = rb_prev(nd);
+	}
+
+	self->first_visible_entry = nd;
+}
+
+unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
+{
+	struct rb_node *nd;
+	int row = 0;
+
+	if (self->first_visible_entry == NULL)
+                self->first_visible_entry = rb_first(self->entries);
+
+	nd = self->first_visible_entry;
+
+	while (nd != NULL) {
+		SLsmg_gotorc(self->top + row, self->left);
+		self->write(self, nd, row);
+		if (++row == self->height)
+			break;
+		nd = rb_next(nd);
+	}
+
+	return row;
+}
+
+bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
+{
+	return (self->first_visible_entry_idx + row) == self->index;
+}
+
+void ui_browser__refresh_dimensions(struct ui_browser *self)
+{
+	int cols, rows;
+	newtGetScreenSize(&cols, &rows);
+
+	if (self->width > cols - 4)
+		self->width = cols - 4;
+	self->height = rows - 5;
+	if (self->height > self->nr_entries)
+		self->height = self->nr_entries;
+	self->top  = (rows - self->height) / 2;
+	self->left = (cols - self->width) / 2;
+}
+
+void ui_browser__reset_index(struct ui_browser *self)
+{
+	self->index = self->first_visible_entry_idx = 0;
+	self->seek(self, 0, SEEK_SET);
+}
+
+int ui_browser__show(struct ui_browser *self, const char *title)
+{
+	if (self->form != NULL) {
+		newtFormDestroy(self->form);
+		newtPopWindow();
+	}
+	ui_browser__refresh_dimensions(self);
+	newtCenteredWindow(self->width, self->height, title);
+	self->form = newt_form__new();
+	if (self->form == NULL)
+		return -1;
+
+	self->sb = newtVerticalScrollbar(self->width, 0, self->height,
+					 HE_COLORSET_NORMAL,
+					 HE_COLORSET_SELECTED);
+	if (self->sb == NULL)
+		return -1;
+
+	newtFormAddHotKey(self->form, NEWT_KEY_UP);
+	newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
+	newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
+	newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
+	newtFormAddHotKey(self->form, NEWT_KEY_HOME);
+	newtFormAddHotKey(self->form, NEWT_KEY_END);
+	newtFormAddComponent(self->form, self->sb);
+	return 0;
+}
+
+int ui_browser__refresh(struct ui_browser *self)
+{
+	int row;
+
+	newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
+	row = self->refresh(self);
+	SLsmg_set_color(HE_COLORSET_NORMAL);
+	SLsmg_fill_region(self->top + row, self->left,
+			  self->height - row, self->width, ' ');
+
+	return 0;
+}
+
+int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
+{
+	if (ui_browser__refresh(self) < 0)
+		return -1;
+
+	while (1) {
+		off_t offset;
+
+		newtFormRun(self->form, es);
+
+		if (es->reason != NEWT_EXIT_HOTKEY)
+			break;
+		if (is_exit_key(es->u.key))
+			return es->u.key;
+		switch (es->u.key) {
+		case NEWT_KEY_DOWN:
+			if (self->index == self->nr_entries - 1)
+				break;
+			++self->index;
+			if (self->index == self->first_visible_entry_idx + self->height) {
+				++self->first_visible_entry_idx;
+				self->seek(self, +1, SEEK_CUR);
+			}
+			break;
+		case NEWT_KEY_UP:
+			if (self->index == 0)
+				break;
+			--self->index;
+			if (self->index < self->first_visible_entry_idx) {
+				--self->first_visible_entry_idx;
+				self->seek(self, -1, SEEK_CUR);
+			}
+			break;
+		case NEWT_KEY_PGDN:
+		case ' ':
+			if (self->first_visible_entry_idx + self->height > self->nr_entries - 1)
+				break;
+
+			offset = self->height;
+			if (self->index + offset > self->nr_entries - 1)
+				offset = self->nr_entries - 1 - self->index;
+			self->index += offset;
+			self->first_visible_entry_idx += offset;
+			self->seek(self, +offset, SEEK_CUR);
+			break;
+		case NEWT_KEY_PGUP:
+			if (self->first_visible_entry_idx == 0)
+				break;
+
+			if (self->first_visible_entry_idx < self->height)
+				offset = self->first_visible_entry_idx;
+			else
+				offset = self->height;
+
+			self->index -= offset;
+			self->first_visible_entry_idx -= offset;
+			self->seek(self, -offset, SEEK_CUR);
+			break;
+		case NEWT_KEY_HOME:
+			ui_browser__reset_index(self);
+			break;
+		case NEWT_KEY_END:
+			offset = self->height - 1;
+			if (offset >= self->nr_entries)
+				offset = self->nr_entries - 1;
+
+			self->index = self->nr_entries - 1;
+			self->first_visible_entry_idx = self->index - offset;
+			self->seek(self, -offset, SEEK_END);
+			break;
+		default:
+			return es->u.key;
+		}
+		if (ui_browser__refresh(self) < 0)
+			return -1;
+	}
+	return 0;
+}
+
+unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
+{
+	struct list_head *pos;
+	struct list_head *head = self->entries;
+	int row = 0;
+
+	if (self->first_visible_entry == NULL ||
+	    self->first_visible_entry == self->entries)
+                self->first_visible_entry = head->next;
+
+	pos = self->first_visible_entry;
+
+	list_for_each_from(pos, head) {
+		SLsmg_gotorc(self->top + row, self->left);
+		self->write(self, pos, row);
+		if (++row == self->height)
+			break;
+	}
+
+	return row;
+}
+
+static struct newtPercentTreeColors {
+	const char *topColorFg, *topColorBg;
+	const char *mediumColorFg, *mediumColorBg;
+	const char *normalColorFg, *normalColorBg;
+	const char *selColorFg, *selColorBg;
+	const char *codeColorFg, *codeColorBg;
+} defaultPercentTreeColors = {
+	"red",       "lightgray",
+	"green",     "lightgray",
+	"black",     "lightgray",
+	"lightgray", "magenta",
+	"blue",	     "lightgray",
+};
+
+void ui_browser__init(void)
+{
+	struct newtPercentTreeColors *c = &defaultPercentTreeColors;
+
+	sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
+	sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);
+	sltt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg);
+	sltt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg);
+	sltt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg);
+}
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
new file mode 100644
index 0000000..bcc4391
--- /dev/null
+++ b/tools/perf/util/ui/browser.h
@@ -0,0 +1,43 @@
+#ifndef _PERF_UI_BROWSER_H_
+#define _PERF_UI_BROWSER_H_ 1
+
+#include <stdbool.h>
+#include <newt.h>
+#include "../types.h"
+
+#define HE_COLORSET_TOP		50
+#define HE_COLORSET_MEDIUM	51
+#define HE_COLORSET_NORMAL	52
+#define HE_COLORSET_SELECTED	53
+#define HE_COLORSET_CODE	54
+
+struct ui_browser {
+	newtComponent form, sb;
+	u64	      index, first_visible_entry_idx;
+	void	      *first_visible_entry, *entries;
+	u16	      top, left, width, height;
+	void	      *priv;
+	unsigned int  (*refresh)(struct ui_browser *self);
+	void	      (*write)(struct ui_browser *self, void *entry, int row);
+	void	      (*seek)(struct ui_browser *self, off_t offset, int whence);
+	u32	      nr_entries;
+};
+
+
+int ui_browser__percent_color(double percent, bool current);
+bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
+void ui_browser__refresh_dimensions(struct ui_browser *self);
+void ui_browser__reset_index(struct ui_browser *self);
+
+int ui_browser__show(struct ui_browser *self, const char *title);
+int ui_browser__refresh(struct ui_browser *self);
+int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es);
+
+void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence);
+unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self);
+
+void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence);
+unsigned int ui_browser__list_head_refresh(struct ui_browser *self);
+
+void ui_browser__init(void);
+#endif /* _PERF_UI_BROWSER_H_ */

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

* [tip:perf/core] perf ui: Shorten ui_browser member names
       [not found]             ` <new-submission>
                                 ` (581 preceding siblings ...)
  2010-08-07  7:01               ` [tip:perf/core] perf ui: Start breaking down newt.c into multiple files tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:39               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_helpline routines to separate file in util/ui/ tip-bot for Arnaldo Carvalho de Melo
                                 ` (123 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:39 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  d247eb6b924bbc2f13748c89b6c72c7a3d46645c
Gitweb:     http://git.kernel.org/tip/d247eb6b924bbc2f13748c89b6c72c7a3d46645c
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 7 Aug 2010 13:56:04 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:08:33 -0300

perf ui: Shorten ui_browser member names

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c       |   36 +++++++++++++-------------
 tools/perf/util/ui/browser.c |   57 ++++++++++++++++++++---------------------
 tools/perf/util/ui/browser.h |    6 ++--
 3 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 266a9e0..9768be3 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -450,8 +450,8 @@ static int map_browser__search(struct map_browser *self)
 	if (sym != NULL) {
 		u32 *idx = symbol__browser_index(sym);
 			
-		self->b.first_visible_entry = &sym->rb_node;
-		self->b.index = self->b.first_visible_entry_idx = *idx;
+		self->b.top = &sym->rb_node;
+		self->b.index = self->b.top_idx = *idx;
 	} else
 		ui_helpline__fpush("%s not found!", target);
 
@@ -967,7 +967,7 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
 			}
 
 			SLsmg_set_color(color);
-			SLsmg_gotorc(self->b.top + row, self->b.left);
+			SLsmg_gotorc(self->b.y + row, self->b.x);
 			slsmg_write_nstring(" ", offset + extra_offset);
 			slsmg_printf("%c ", folded_sign);
 			slsmg_write_nstring(str, width);
@@ -1030,7 +1030,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *self,
 		}
 
 		s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-		SLsmg_gotorc(self->b.top + row, self->b.left);
+		SLsmg_gotorc(self->b.y + row, self->b.x);
 		SLsmg_set_color(color);
 		slsmg_write_nstring(" ", offset);
 		slsmg_printf("%c ", folded_sign);
@@ -1110,7 +1110,7 @@ static int hist_browser__show_entry(struct hist_browser *self,
 		}
 
 		SLsmg_set_color(color);
-		SLsmg_gotorc(self->b.top + row, self->b.left);
+		SLsmg_gotorc(self->b.y + row, self->b.x);
 		if (symbol_conf.use_callchain) {
 			slsmg_printf("%c ", folded_sign);
 			width -= 2;
@@ -1138,10 +1138,10 @@ static unsigned int hist_browser__refresh(struct ui_browser *self)
 	struct rb_node *nd;
 	struct hist_browser *hb = container_of(self, struct hist_browser, b);
 
-	if (self->first_visible_entry == NULL)
-		self->first_visible_entry = rb_first(&hb->hists->entries);
+	if (self->top == NULL)
+		self->top = rb_first(&hb->hists->entries);
 
-	for (nd = self->first_visible_entry; nd; nd = rb_next(nd)) {
+	for (nd = self->top; nd; nd = rb_next(nd)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
 
 		if (h->filtered)
@@ -1244,7 +1244,7 @@ static void ui_browser__hists_seek(struct ui_browser *self,
 		nd = hists__filter_entries(rb_first(self->entries));
 		break;
 	case SEEK_CUR:
-		nd = self->first_visible_entry;
+		nd = self->top;
 		goto do_offset;
 	case SEEK_END:
 		nd = hists__filter_prev_entries(rb_last(self->entries));
@@ -1258,7 +1258,7 @@ static void ui_browser__hists_seek(struct ui_browser *self,
 	 * Moves not relative to the first visible entry invalidates its
 	 * row_offset:
 	 */
-	h = rb_entry(self->first_visible_entry, struct hist_entry, rb_node);
+	h = rb_entry(self->top, struct hist_entry, rb_node);
 	h->row_offset = 0;
 
 	/*
@@ -1286,7 +1286,7 @@ do_offset:
 				} else {
 					h->row_offset += offset;
 					offset = 0;
-					self->first_visible_entry = nd;
+					self->top = nd;
 					break;
 				}
 			}
@@ -1294,7 +1294,7 @@ do_offset:
 			if (nd == NULL)
 				break;
 			--offset;
-			self->first_visible_entry = nd;
+			self->top = nd;
 		} while (offset != 0);
 	} else if (offset < 0) {
 		while (1) {
@@ -1307,7 +1307,7 @@ do_offset:
 					} else {
 						h->row_offset += offset;
 						offset = 0;
-						self->first_visible_entry = nd;
+						self->top = nd;
 						break;
 					}
 				} else {
@@ -1317,7 +1317,7 @@ do_offset:
 					} else {
 						h->row_offset = h->nr_rows + offset;
 						offset = 0;
-						self->first_visible_entry = nd;
+						self->top = nd;
 						break;
 					}
 				}
@@ -1327,7 +1327,7 @@ do_offset:
 			if (nd == NULL)
 				break;
 			++offset;
-			self->first_visible_entry = nd;
+			self->top = nd;
 			if (offset == 0) {
 				/*
 				 * Last unfiltered hist_entry, check if it is
@@ -1342,7 +1342,7 @@ do_offset:
 			first = false;
 		}
 	} else {
-		self->first_visible_entry = nd;
+		self->top = nd;
 		h = rb_entry(nd, struct hist_entry, rb_node);
 		h->row_offset = 0;
 	}
@@ -1463,7 +1463,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 		switch (es->u.key) {
 		case 'd': { /* Debug */
 			static int seq;
-			struct hist_entry *h = rb_entry(self->b.first_visible_entry,
+			struct hist_entry *h = rb_entry(self->b.top,
 							struct hist_entry, rb_node);
 			ui_helpline__pop();
 			ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
@@ -1471,7 +1471,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 					   self->hists->nr_entries,
 					   self->b.height,
 					   self->b.index,
-					   self->b.first_visible_entry_idx,
+					   self->b.top_idx,
 					   h->row_offset, h->nr_rows);
 		}
 			continue;
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 0b2b930..edbb7dd 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -49,7 +49,7 @@ void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whenc
 		pos = head->next;
 		break;
 	case SEEK_CUR:
-		pos = self->first_visible_entry;
+		pos = self->top;
 		break;
 	case SEEK_END:
 		pos = head->prev;
@@ -66,7 +66,7 @@ void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whenc
 			pos = pos->prev;
 	}
 
-	self->first_visible_entry = pos;
+	self->top = pos;
 }
 
 void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
@@ -79,7 +79,7 @@ void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
 		nd = rb_first(root);
 		break;
 	case SEEK_CUR:
-		nd = self->first_visible_entry;
+		nd = self->top;
 		break;
 	case SEEK_END:
 		nd = rb_last(root);
@@ -96,7 +96,7 @@ void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence)
 			nd = rb_prev(nd);
 	}
 
-	self->first_visible_entry = nd;
+	self->top = nd;
 }
 
 unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
@@ -104,13 +104,13 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
 	struct rb_node *nd;
 	int row = 0;
 
-	if (self->first_visible_entry == NULL)
-                self->first_visible_entry = rb_first(self->entries);
+	if (self->top == NULL)
+                self->top = rb_first(self->entries);
 
-	nd = self->first_visible_entry;
+	nd = self->top;
 
 	while (nd != NULL) {
-		SLsmg_gotorc(self->top + row, self->left);
+		SLsmg_gotorc(self->y + row, self->x);
 		self->write(self, nd, row);
 		if (++row == self->height)
 			break;
@@ -122,7 +122,7 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
 
 bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row)
 {
-	return (self->first_visible_entry_idx + row) == self->index;
+	return self->top_idx + row == self->index;
 }
 
 void ui_browser__refresh_dimensions(struct ui_browser *self)
@@ -135,13 +135,13 @@ void ui_browser__refresh_dimensions(struct ui_browser *self)
 	self->height = rows - 5;
 	if (self->height > self->nr_entries)
 		self->height = self->nr_entries;
-	self->top  = (rows - self->height) / 2;
-	self->left = (cols - self->width) / 2;
+	self->y  = (rows - self->height) / 2;
+	self->x = (cols - self->width) / 2;
 }
 
 void ui_browser__reset_index(struct ui_browser *self)
 {
-	self->index = self->first_visible_entry_idx = 0;
+	self->index = self->top_idx = 0;
 	self->seek(self, 0, SEEK_SET);
 }
 
@@ -180,7 +180,7 @@ int ui_browser__refresh(struct ui_browser *self)
 	newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
 	row = self->refresh(self);
 	SLsmg_set_color(HE_COLORSET_NORMAL);
-	SLsmg_fill_region(self->top + row, self->left,
+	SLsmg_fill_region(self->y + row, self->x,
 			  self->height - row, self->width, ' ');
 
 	return 0;
@@ -205,8 +205,8 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 			if (self->index == self->nr_entries - 1)
 				break;
 			++self->index;
-			if (self->index == self->first_visible_entry_idx + self->height) {
-				++self->first_visible_entry_idx;
+			if (self->index == self->top_idx + self->height) {
+				++self->top_idx;
 				self->seek(self, +1, SEEK_CUR);
 			}
 			break;
@@ -214,34 +214,34 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 			if (self->index == 0)
 				break;
 			--self->index;
-			if (self->index < self->first_visible_entry_idx) {
-				--self->first_visible_entry_idx;
+			if (self->index < self->top_idx) {
+				--self->top_idx;
 				self->seek(self, -1, SEEK_CUR);
 			}
 			break;
 		case NEWT_KEY_PGDN:
 		case ' ':
-			if (self->first_visible_entry_idx + self->height > self->nr_entries - 1)
+			if (self->top_idx + self->height > self->nr_entries - 1)
 				break;
 
 			offset = self->height;
 			if (self->index + offset > self->nr_entries - 1)
 				offset = self->nr_entries - 1 - self->index;
 			self->index += offset;
-			self->first_visible_entry_idx += offset;
+			self->top_idx += offset;
 			self->seek(self, +offset, SEEK_CUR);
 			break;
 		case NEWT_KEY_PGUP:
-			if (self->first_visible_entry_idx == 0)
+			if (self->top_idx == 0)
 				break;
 
-			if (self->first_visible_entry_idx < self->height)
-				offset = self->first_visible_entry_idx;
+			if (self->top_idx < self->height)
+				offset = self->top_idx;
 			else
 				offset = self->height;
 
 			self->index -= offset;
-			self->first_visible_entry_idx -= offset;
+			self->top_idx -= offset;
 			self->seek(self, -offset, SEEK_CUR);
 			break;
 		case NEWT_KEY_HOME:
@@ -253,7 +253,7 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 				offset = self->nr_entries - 1;
 
 			self->index = self->nr_entries - 1;
-			self->first_visible_entry_idx = self->index - offset;
+			self->top_idx = self->index - offset;
 			self->seek(self, -offset, SEEK_END);
 			break;
 		default:
@@ -271,14 +271,13 @@ unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
 	struct list_head *head = self->entries;
 	int row = 0;
 
-	if (self->first_visible_entry == NULL ||
-	    self->first_visible_entry == self->entries)
-                self->first_visible_entry = head->next;
+	if (self->top == NULL || self->top == self->entries)
+                self->top = head->next;
 
-	pos = self->first_visible_entry;
+	pos = self->top;
 
 	list_for_each_from(pos, head) {
-		SLsmg_gotorc(self->top + row, self->left);
+		SLsmg_gotorc(self->y + row, self->x);
 		self->write(self, pos, row);
 		if (++row == self->height)
 			break;
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index bcc4391..8eed24c 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -13,9 +13,9 @@
 
 struct ui_browser {
 	newtComponent form, sb;
-	u64	      index, first_visible_entry_idx;
-	void	      *first_visible_entry, *entries;
-	u16	      top, left, width, height;
+	u64	      index, top_idx;
+	void	      *top, *entries;
+	u16	      y, x, width, height;
 	void	      *priv;
 	unsigned int  (*refresh)(struct ui_browser *self);
 	void	      (*write)(struct ui_browser *self, void *entry, int row);

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

* [tip:perf/core] perf ui: Move ui_helpline routines to separate file in util/ui/
       [not found]             ` <new-submission>
                                 ` (582 preceding siblings ...)
  2010-08-11  7:39               ` [tip:perf/core] perf ui: Shorten ui_browser member names tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:40               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_progress " tip-bot for Arnaldo Carvalho de Melo
                                 ` (122 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  5575536fc7ad7577a4e687a13e2f49acebc519f3
Gitweb:     http://git.kernel.org/tip/5575536fc7ad7577a4e687a13e2f49acebc519f3
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sun, 8 Aug 2010 19:48:31 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:08:51 -0300

perf ui: Move ui_helpline routines to separate file in util/ui/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile           |    2 +
 tools/perf/util/newt.c        |   38 +-----------------------------------
 tools/perf/util/ui/helpline.c |   43 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/ui/helpline.h |    9 ++++++++
 4 files changed, 55 insertions(+), 37 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d5bce76..d77a101 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -569,7 +569,9 @@ else
 		EXTLIBS += -lnewt -lslang
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
+		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_H += util/ui/browser.h
+		LIB_H += util/ui/helpline.h
 	endif
 endif
 
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 9768be3..23f3b7d 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -24,6 +24,7 @@
 #include "sort.h"
 #include "symbol.h"
 #include "ui/browser.h"
+#include "ui/helpline.h"
 
 #if SLANG_VERSION < 20104
 #define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args)
@@ -94,43 +95,6 @@ void ui_progress__delete(struct ui_progress *self)
 	free(self);
 }
 
-static void ui_helpline__pop(void)
-{
-	newtPopHelpLine();
-}
-
-static void ui_helpline__push(const char *msg)
-{
-	newtPushHelpLine(msg);
-}
-
-static void ui_helpline__vpush(const char *fmt, va_list ap)
-{
-	char *s;
-
-	if (vasprintf(&s, fmt, ap) < 0)
-		vfprintf(stderr, fmt, ap);
-	else {
-		ui_helpline__push(s);
-		free(s);
-	}
-}
-
-static void ui_helpline__fpush(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	ui_helpline__vpush(fmt, ap);
-	va_end(ap);
-}
-
-static void ui_helpline__puts(const char *msg)
-{
-	ui_helpline__pop();
-	ui_helpline__push(msg);
-}
-
 static int ui_entry__read(const char *title, char *bf, size_t size, int width)
 {
 	struct newtExitStruct es;
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c
new file mode 100644
index 0000000..6a11e13
--- /dev/null
+++ b/tools/perf/util/ui/helpline.c
@@ -0,0 +1,43 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <newt.h>
+
+#include "helpline.h"
+
+void ui_helpline__pop(void)
+{
+	newtPopHelpLine();
+}
+
+void ui_helpline__push(const char *msg)
+{
+	newtPushHelpLine(msg);
+}
+
+static void ui_helpline__vpush(const char *fmt, va_list ap)
+{
+	char *s;
+
+	if (vasprintf(&s, fmt, ap) < 0)
+		vfprintf(stderr, fmt, ap);
+	else {
+		ui_helpline__push(s);
+		free(s);
+	}
+}
+
+void ui_helpline__fpush(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	ui_helpline__vpush(fmt, ap);
+	va_end(ap);
+}
+
+void ui_helpline__puts(const char *msg)
+{
+	ui_helpline__pop();
+	ui_helpline__push(msg);
+}
diff --git a/tools/perf/util/ui/helpline.h b/tools/perf/util/ui/helpline.h
new file mode 100644
index 0000000..56d8c1d
--- /dev/null
+++ b/tools/perf/util/ui/helpline.h
@@ -0,0 +1,9 @@
+#ifndef _PERF_UI_HELPLINE_H_
+#define _PERF_UI_HELPLINE_H_ 1
+
+void ui_helpline__pop(void);
+void ui_helpline__push(const char *msg);
+void ui_helpline__fpush(const char *fmt, ...);
+void ui_helpline__puts(const char *msg);
+
+#endif /* _PERF_UI_HELPLINE_H_ */

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

* [tip:perf/core] perf ui: Move ui_progress routines to separate file in util/ui/
       [not found]             ` <new-submission>
                                 ` (583 preceding siblings ...)
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_helpline routines to separate file in util/ui/ tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:40               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move annotate browser to util/ui/browsers/ tip-bot for Arnaldo Carvalho de Melo
                                 ` (121 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  34cea7f7c0620c964676eece258ef431a6608bce
Gitweb:     http://git.kernel.org/tip/34cea7f7c0620c964676eece258ef431a6608bce
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sun, 8 Aug 2010 19:56:47 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:09:14 -0300

perf ui: Move ui_progress routines to separate file in util/ui/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile           |    2 +
 tools/perf/util/debug.h       |    4 +--
 tools/perf/util/newt.c        |   56 --------------------------------------
 tools/perf/util/ui/progress.c |   60 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/ui/progress.h |   11 +++++++
 5 files changed, 74 insertions(+), 59 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d77a101..528c914 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -570,8 +570,10 @@ else
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
+		LIB_OBJS += $(OUTPUT)util/ui/progress.o
 		LIB_H += util/ui/browser.h
 		LIB_H += util/ui/helpline.h
+		LIB_H += util/ui/progress.h
 	endif
 endif
 
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 047ac33..a929b06 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -31,9 +31,7 @@ static inline void ui_progress__update(struct ui_progress *self __used,
 static inline void ui_progress__delete(struct ui_progress *self __used) {}
 #else
 int browser__show_help(const char *format, va_list ap);
-struct ui_progress *ui_progress__new(const char *title, u64 total);
-void ui_progress__update(struct ui_progress *self, u64 curr);
-void ui_progress__delete(struct ui_progress *self);
+#include "ui/progress.h"
 #endif
 
 #endif	/* __PERF_DEBUG_H */
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 23f3b7d..c0986d3 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -39,62 +39,6 @@
 
 newtComponent newt_form__new(void);
 
-struct ui_progress {
-	newtComponent form, scale;
-};
-
-struct ui_progress *ui_progress__new(const char *title, u64 total)
-{
-	struct ui_progress *self = malloc(sizeof(*self));
-
-	if (self != NULL) {
-		int cols;
-
-		if (use_browser <= 0)	
-			return self;
-		newtGetScreenSize(&cols, NULL);
-		cols -= 4;
-		newtCenteredWindow(cols, 1, title);
-		self->form  = newtForm(NULL, NULL, 0);
-		if (self->form == NULL)
-			goto out_free_self;
-		self->scale = newtScale(0, 0, cols, total);
-		if (self->scale == NULL)
-			goto out_free_form;
-		newtFormAddComponent(self->form, self->scale);
-		newtRefresh();
-	}
-
-	return self;
-
-out_free_form:
-	newtFormDestroy(self->form);
-out_free_self:
-	free(self);
-	return NULL;
-}
-
-void ui_progress__update(struct ui_progress *self, u64 curr)
-{
-	/*
-	 * FIXME: We should have a per UI backend way of showing progress,
-	 * stdio will just show a percentage as NN%, etc.
-	 */
-	if (use_browser <= 0)
-		return;
-	newtScaleSet(self->scale, curr);
-	newtRefresh();
-}
-
-void ui_progress__delete(struct ui_progress *self)
-{
-	if (use_browser > 0) {
-		newtFormDestroy(self->form);
-		newtPopWindow();
-	}
-	free(self);
-}
-
 static int ui_entry__read(const char *title, char *bf, size_t size, int width)
 {
 	struct newtExitStruct es;
diff --git a/tools/perf/util/ui/progress.c b/tools/perf/util/ui/progress.c
new file mode 100644
index 0000000..d7fc399
--- /dev/null
+++ b/tools/perf/util/ui/progress.c
@@ -0,0 +1,60 @@
+#include <stdlib.h>
+#include <newt.h>
+#include "../cache.h"
+#include "progress.h"
+
+struct ui_progress {
+	newtComponent form, scale;
+};
+
+struct ui_progress *ui_progress__new(const char *title, u64 total)
+{
+	struct ui_progress *self = malloc(sizeof(*self));
+
+	if (self != NULL) {
+		int cols;
+
+		if (use_browser <= 0)
+			return self;
+		newtGetScreenSize(&cols, NULL);
+		cols -= 4;
+		newtCenteredWindow(cols, 1, title);
+		self->form  = newtForm(NULL, NULL, 0);
+		if (self->form == NULL)
+			goto out_free_self;
+		self->scale = newtScale(0, 0, cols, total);
+		if (self->scale == NULL)
+			goto out_free_form;
+		newtFormAddComponent(self->form, self->scale);
+		newtRefresh();
+	}
+
+	return self;
+
+out_free_form:
+	newtFormDestroy(self->form);
+out_free_self:
+	free(self);
+	return NULL;
+}
+
+void ui_progress__update(struct ui_progress *self, u64 curr)
+{
+	/*
+	 * FIXME: We should have a per UI backend way of showing progress,
+	 * stdio will just show a percentage as NN%, etc.
+	 */
+	if (use_browser <= 0)
+		return;
+	newtScaleSet(self->scale, curr);
+	newtRefresh();
+}
+
+void ui_progress__delete(struct ui_progress *self)
+{
+	if (use_browser > 0) {
+		newtFormDestroy(self->form);
+		newtPopWindow();
+	}
+	free(self);
+}
diff --git a/tools/perf/util/ui/progress.h b/tools/perf/util/ui/progress.h
new file mode 100644
index 0000000..a3820a0
--- /dev/null
+++ b/tools/perf/util/ui/progress.h
@@ -0,0 +1,11 @@
+#ifndef _PERF_UI_PROGRESS_H_
+#define _PERF_UI_PROGRESS_H_ 1
+
+struct ui_progress;
+
+struct ui_progress *ui_progress__new(const char *title, u64 total);
+void ui_progress__delete(struct ui_progress *self);
+
+void ui_progress__update(struct ui_progress *self, u64 curr);
+
+#endif

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

* [tip:perf/core] perf ui: Move annotate browser to util/ui/browsers/
       [not found]             ` <new-submission>
                                 ` (584 preceding siblings ...)
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_progress " tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:40               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:41               ` [tip:perf/core] perf ui: Move map " tip-bot for Arnaldo Carvalho de Melo
                                 ` (120 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  211ef12771e759a08e10c3c606e6a8b1663519e7
Gitweb:     http://git.kernel.org/tip/211ef12771e759a08e10c3c606e6a8b1663519e7
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 14:54:09 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:09:41 -0300

perf ui: Move annotate browser to util/ui/browsers/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                    |    7 ++-
 tools/perf/util/debug.h                |    1 +
 tools/perf/util/newt.c                 |  132 +-------------------------------
 tools/perf/util/ui/browser.h           |    1 +
 tools/perf/util/ui/browsers/annotate.c |  114 +++++++++++++++++++++++++++
 tools/perf/util/ui/libslang.h          |   27 +++++++
 6 files changed, 151 insertions(+), 131 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 528c914..ae443b6 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -158,7 +158,7 @@ all::
 # Define NO_DWARF if you do not want debug-info analysis feature at all.
 
 $(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null)
-$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui,scripting-engines}/' 2> /dev/null)
+$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null)
 $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null)
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@@ -569,10 +569,12 @@ else
 		EXTLIBS += -lnewt -lslang
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
+		LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_OBJS += $(OUTPUT)util/ui/progress.o
 		LIB_H += util/ui/browser.h
 		LIB_H += util/ui/helpline.h
+		LIB_H += util/ui/libslang.h
 		LIB_H += util/ui/progress.h
 	endif
 endif
@@ -977,6 +979,9 @@ $(OUTPUT)util/newt.o: util/newt.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/ui/browsers/annotate.o: util/ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index a929b06..ba4892e 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -30,6 +30,7 @@ static inline void ui_progress__update(struct ui_progress *self __used,
 
 static inline void ui_progress__delete(struct ui_progress *self __used) {}
 #else
+extern char browser__last_msg[];
 int browser__show_help(const char *format, va_list ap);
 #include "ui/progress.h"
 #endif
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index c0986d3..f188258 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -1,16 +1,7 @@
 #define _GNU_SOURCE
 #include <stdio.h>
 #undef _GNU_SOURCE
-/*
- * slang versions <= 2.0.6 have a "#if HAVE_LONG_LONG" that breaks
- * the build if it isn't defined. Use the equivalent one that glibc
- * has on features.h.
- */
-#include <features.h>
-#ifndef HAVE_LONG_LONG
-#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
-#endif
-#include <slang.h>
+#include "ui/libslang.h"
 #include <signal.h>
 #include <stdlib.h>
 #include <elf.h>
@@ -26,17 +17,6 @@
 #include "ui/browser.h"
 #include "ui/helpline.h"
 
-#if SLANG_VERSION < 20104
-#define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args)
-#define slsmg_write_nstring(msg, len) SLsmg_write_nstring((char *)msg, len)
-#define sltt_set_color(obj, name, fg, bg) SLtt_set_color(obj,(char *)name,\
-							 (char *)fg, (char *)bg)
-#else
-#define slsmg_printf SLsmg_printf
-#define slsmg_write_nstring SLsmg_write_nstring
-#define sltt_set_color SLtt_set_color
-#endif
-
 newtComponent newt_form__new(void);
 
 static int ui_entry__read(const char *title, char *bf, size_t size, int width)
@@ -72,7 +52,7 @@ out_free_form:
 	return 0;
 }
 
-static char browser__last_msg[1024];
+char browser__last_msg[1024];
 
 int browser__show_help(const char *format, va_list ap)
 {
@@ -192,66 +172,6 @@ static bool dialog_yesno(const char *msg)
 	return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
 }
 
-static void ui__error_window(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	newtWinMessagev((char *)"Error", (char *)"Ok", (char *)fmt, ap);
-	va_end(ap);
-}
-
-static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
-{
-	struct objdump_line *ol = rb_entry(entry, struct objdump_line, node);
-	bool current_entry = ui_browser__is_current_entry(self, row);
-	int width = self->width;
-
-	if (ol->offset != -1) {
-		struct hist_entry *he = self->priv;
-		struct symbol *sym = he->ms.sym;
-		int len = he->ms.sym->end - he->ms.sym->start;
-		unsigned int hits = 0;
-		double percent = 0.0;
-		int color;
-		struct sym_priv *priv = symbol__priv(sym);
-		struct sym_ext *sym_ext = priv->ext;
-		struct sym_hist *h = priv->hist;
-		s64 offset = ol->offset;
-		struct objdump_line *next = objdump__get_next_ip_line(self->entries, ol);
-
-		while (offset < (s64)len &&
-		       (next == NULL || offset < next->offset)) {
-			if (sym_ext) {
-				percent += sym_ext[offset].percent;
-			} else
-				hits += h->ip[offset];
-
-			++offset;
-		}
-
-		if (sym_ext == NULL && h->sum)
-			percent = 100.0 * hits / h->sum;
-
-		color = ui_browser__percent_color(percent, current_entry);
-		SLsmg_set_color(color);
-		slsmg_printf(" %7.2f ", percent);
-		if (!current_entry)
-			SLsmg_set_color(HE_COLORSET_CODE);
-	} else {
-		int color = ui_browser__percent_color(0, current_entry);
-		SLsmg_set_color(color);
-		slsmg_write_nstring(" ", 9);
-	}
-
-	SLsmg_write_char(':');
-	slsmg_write_nstring(" ", 8);
-	if (!*ol->line)
-		slsmg_write_nstring(" ", width - 18);
-	else
-		slsmg_write_nstring(ol->line, width - 18);
-}
-
 static char *callchain_list__sym_name(struct callchain_list *self,
 				      char *bf, size_t bfsize)
 {
@@ -262,54 +182,6 @@ static char *callchain_list__sym_name(struct callchain_list *self,
 	return bf;
 }
 
-int hist_entry__tui_annotate(struct hist_entry *self)
-{
-	struct newtExitStruct es;
-	struct objdump_line *pos, *n;
-	LIST_HEAD(head);
-	struct ui_browser browser = {
-		.entries = &head,
-		.refresh = ui_browser__list_head_refresh,
-		.seek	 = ui_browser__list_head_seek,
-		.write	 = annotate_browser__write,
-		.priv	 = self,
-	};
-	int ret;
-
-	if (self->ms.sym == NULL)
-		return -1;
-
-	if (self->ms.map->dso->annotate_warned)
-		return -1;
-
-	if (hist_entry__annotate(self, &head) < 0) {
-		ui__error_window(browser__last_msg);
-		return -1;
-	}
-
-	ui_helpline__push("Press <- or ESC to exit");
-
-	list_for_each_entry(pos, &head, node) {
-		size_t line_len = strlen(pos->line);
-		if (browser.width < line_len)
-			browser.width = line_len;
-		++browser.nr_entries;
-	}
-
-	browser.width += 18; /* Percentage */
-	ui_browser__show(&browser, self->ms.sym->name);
-	newtFormAddHotKey(browser.form, ' ');
-	ret = ui_browser__run(&browser, &es);
-	newtFormDestroy(browser.form);
-	newtPopWindow();
-	list_for_each_entry_safe(pos, n, &head, node) {
-		list_del(&pos->node);
-		objdump_line__free(pos);
-	}
-	ui_helpline__pop();
-	return ret;
-}
-
 /* -------------------------------------------------------------------- */
 
 struct map_browser {
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 8eed24c..856e343 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -3,6 +3,7 @@
 
 #include <stdbool.h>
 #include <newt.h>
+#include <sys/types.h>
 #include "../types.h"
 
 #define HE_COLORSET_TOP		50
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
new file mode 100644
index 0000000..783d277
--- /dev/null
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -0,0 +1,114 @@
+#include "../browser.h"
+#include "../helpline.h"
+#include "../libslang.h"
+#include "../../hist.h"
+#include "../../sort.h"
+#include "../../symbol.h"
+
+static void ui__error_window(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	newtWinMessagev((char *)"Error", (char *)"Ok", (char *)fmt, ap);
+	va_end(ap);
+}
+
+static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
+{
+	struct objdump_line *ol = rb_entry(entry, struct objdump_line, node);
+	bool current_entry = ui_browser__is_current_entry(self, row);
+	int width = self->width;
+
+	if (ol->offset != -1) {
+		struct hist_entry *he = self->priv;
+		struct symbol *sym = he->ms.sym;
+		int len = he->ms.sym->end - he->ms.sym->start;
+		unsigned int hits = 0;
+		double percent = 0.0;
+		int color;
+		struct sym_priv *priv = symbol__priv(sym);
+		struct sym_ext *sym_ext = priv->ext;
+		struct sym_hist *h = priv->hist;
+		s64 offset = ol->offset;
+		struct objdump_line *next = objdump__get_next_ip_line(self->entries, ol);
+
+		while (offset < (s64)len &&
+		       (next == NULL || offset < next->offset)) {
+			if (sym_ext) {
+				percent += sym_ext[offset].percent;
+			} else
+				hits += h->ip[offset];
+
+			++offset;
+		}
+
+		if (sym_ext == NULL && h->sum)
+			percent = 100.0 * hits / h->sum;
+
+		color = ui_browser__percent_color(percent, current_entry);
+		SLsmg_set_color(color);
+		slsmg_printf(" %7.2f ", percent);
+		if (!current_entry)
+			SLsmg_set_color(HE_COLORSET_CODE);
+	} else {
+		int color = ui_browser__percent_color(0, current_entry);
+		SLsmg_set_color(color);
+		slsmg_write_nstring(" ", 9);
+	}
+
+	SLsmg_write_char(':');
+	slsmg_write_nstring(" ", 8);
+	if (!*ol->line)
+		slsmg_write_nstring(" ", width - 18);
+	else
+		slsmg_write_nstring(ol->line, width - 18);
+}
+
+int hist_entry__tui_annotate(struct hist_entry *self)
+{
+	struct newtExitStruct es;
+	struct objdump_line *pos, *n;
+	LIST_HEAD(head);
+	struct ui_browser browser = {
+		.entries = &head,
+		.refresh = ui_browser__list_head_refresh,
+		.seek	 = ui_browser__list_head_seek,
+		.write	 = annotate_browser__write,
+		.priv	 = self,
+	};
+	int ret;
+
+	if (self->ms.sym == NULL)
+		return -1;
+
+	if (self->ms.map->dso->annotate_warned)
+		return -1;
+
+	if (hist_entry__annotate(self, &head) < 0) {
+		ui__error_window(browser__last_msg);
+		return -1;
+	}
+
+	ui_helpline__push("Press <- or ESC to exit");
+
+	list_for_each_entry(pos, &head, node) {
+		size_t line_len = strlen(pos->line);
+		if (browser.width < line_len)
+			browser.width = line_len;
+		++browser.nr_entries;
+	}
+
+	browser.width += 18; /* Percentage */
+	ui_browser__show(&browser, self->ms.sym->name);
+	newtFormAddHotKey(browser.form, ' ');
+	ret = ui_browser__run(&browser, &es);
+	newtFormDestroy(browser.form);
+	newtPopWindow();
+	list_for_each_entry_safe(pos, n, &head, node) {
+		list_del(&pos->node);
+		objdump_line__free(pos);
+	}
+	ui_helpline__pop();
+	return ret;
+}
diff --git a/tools/perf/util/ui/libslang.h b/tools/perf/util/ui/libslang.h
new file mode 100644
index 0000000..5623da8
--- /dev/null
+++ b/tools/perf/util/ui/libslang.h
@@ -0,0 +1,27 @@
+#ifndef _PERF_UI_SLANG_H_
+#define _PERF_UI_SLANG_H_ 1
+/*
+ * slang versions <= 2.0.6 have a "#if HAVE_LONG_LONG" that breaks
+ * the build if it isn't defined. Use the equivalent one that glibc
+ * has on features.h.
+ */
+#include <features.h>
+#ifndef HAVE_LONG_LONG
+#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
+#endif
+#include <slang.h>
+
+#if SLANG_VERSION < 20104
+#define slsmg_printf(msg, args...) \
+	SLsmg_printf((char *)msg, ##args)
+#define slsmg_write_nstring(msg, len) \
+	SLsmg_write_nstring((char *)msg, len)
+#define sltt_set_color(obj, name, fg, bg) \
+	SLtt_set_color(obj,(char *)name, (char *)fg, (char *)bg)
+#else
+#define slsmg_printf SLsmg_printf
+#define slsmg_write_nstring SLsmg_write_nstring
+#define sltt_set_color SLtt_set_color
+#endif
+
+#endif /* _PERF_UI_SLANG_H_ */

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

* [tip:perf/core] perf ui: Move map browser to util/ui/browsers/
       [not found]             ` <new-submission>
                                 ` (585 preceding siblings ...)
  2010-08-11  7:40               ` [tip:perf/core] perf ui: Move annotate browser to util/ui/browsers/ tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:41               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:41               ` [tip:perf/core] perf ui: Move hists " tip-bot for Arnaldo Carvalho de Melo
                                 ` (119 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:41 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  b1b0267336b1b74eeb8884bac4be96296b719e67
Gitweb:     http://git.kernel.org/tip/b1b0267336b1b74eeb8884bac4be96296b719e67
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:37:34 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:10:09 -0300

perf ui: Move map browser to util/ui/browsers/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile               |    5 +
 tools/perf/util/newt.c            |  156 +-----------------------------------
 tools/perf/util/ui/browsers/map.c |  163 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/ui/browsers/map.h |    6 ++
 4 files changed, 175 insertions(+), 155 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index ae443b6..d118020 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -570,9 +570,11 @@ else
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o
+		LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_OBJS += $(OUTPUT)util/ui/progress.o
 		LIB_H += util/ui/browser.h
+		LIB_H += util/ui/browsers/map.h
 		LIB_H += util/ui/helpline.h
 		LIB_H += util/ui/libslang.h
 		LIB_H += util/ui/progress.h
@@ -982,6 +984,9 @@ $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/ui/browsers/annotate.o: util/ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index f188258..b596926 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -16,42 +16,10 @@
 #include "symbol.h"
 #include "ui/browser.h"
 #include "ui/helpline.h"
+#include "ui/browsers/map.h"
 
 newtComponent newt_form__new(void);
 
-static int ui_entry__read(const char *title, char *bf, size_t size, int width)
-{
-	struct newtExitStruct es;
-	newtComponent form, entry;
-	const char *result;
-	int err = -1;
-
-	newtCenteredWindow(width, 1, title);
-	form = newtForm(NULL, NULL, 0);
-	if (form == NULL)
-		return -1;
-
-	entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL);
-	if (entry == NULL)
-		goto out_free_form;
-
-	newtFormAddComponent(form, entry);
-	newtFormAddHotKey(form, NEWT_KEY_ENTER);
-	newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
-	newtFormAddHotKey(form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(form, CTRL('c'));
-	newtFormRun(form, &es);
-
-	if (result != NULL) {
-		strncpy(bf, result, size);
-		err = 0;
-	}
-out_free_form:
-	newtPopWindow();
-	newtFormDestroy(form);
-	return 0;
-}
-
 char browser__last_msg[1024];
 
 int browser__show_help(const char *format, va_list ap)
@@ -182,128 +150,6 @@ static char *callchain_list__sym_name(struct callchain_list *self,
 	return bf;
 }
 
-/* -------------------------------------------------------------------- */
-
-struct map_browser {
-	struct ui_browser b;
-	struct map	  *map;
-	u16		  namelen;
-	u8		  addrlen;
-};
-
-static void map_browser__write(struct ui_browser *self, void *nd, int row)
-{
-	struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
-	struct map_browser *mb = container_of(self, struct map_browser, b);
-	bool current_entry = ui_browser__is_current_entry(self, row);
-	int color = ui_browser__percent_color(0, current_entry);
-
-	SLsmg_set_color(color);
-	slsmg_printf("%*llx %*llx %c ",
-		     mb->addrlen, sym->start, mb->addrlen, sym->end,
-		     sym->binding == STB_GLOBAL ? 'g' :
-		     sym->binding == STB_LOCAL  ? 'l' : 'w');
-	slsmg_write_nstring(sym->name, mb->namelen);
-}
-
-/* FIXME uber-kludgy, see comment on cmd_report... */
-static u32 *symbol__browser_index(struct symbol *self)
-{
-	return ((void *)self) - sizeof(struct rb_node) - sizeof(u32);
-}
-
-static int map_browser__search(struct map_browser *self)
-{
-	char target[512];
-	struct symbol *sym;
-	int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40);
-
-	if (err)
-		return err;
-
-	if (target[0] == '0' && tolower(target[1]) == 'x') {
-		u64 addr = strtoull(target, NULL, 16);
-		sym = map__find_symbol(self->map, addr, NULL);
-	} else
-		sym = map__find_symbol_by_name(self->map, target, NULL);
-
-	if (sym != NULL) {
-		u32 *idx = symbol__browser_index(sym);
-			
-		self->b.top = &sym->rb_node;
-		self->b.index = self->b.top_idx = *idx;
-	} else
-		ui_helpline__fpush("%s not found!", target);
-
-	return 0;
-}
-
-static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
-{
-	if (ui_browser__show(&self->b, self->map->dso->long_name) < 0)
-		return -1;
-
-	ui_helpline__fpush("Press <- or ESC to exit, %s / to search",
-			   verbose ? "" : "restart with -v to use");
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
-	if (verbose)
-		newtFormAddHotKey(self->b.form, '/');
-
-	while (1) {
-		ui_browser__run(&self->b, es);
-
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-		if (verbose && es->u.key == '/')
-			map_browser__search(self);
-		else
-			break;
-	}
-
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
-	ui_helpline__pop();
-	return 0;
-}
-
-static int map__browse(struct map *self)
-{
-	struct map_browser mb = {
-		.b = {
-			.entries = &self->dso->symbols[self->type],
-			.refresh = ui_browser__rb_tree_refresh,
-			.seek	 = ui_browser__rb_tree_seek,
-			.write	 = map_browser__write,
-		},
-		.map = self,
-	};
-	struct newtExitStruct es;
-	struct rb_node *nd;
-	char tmp[BITS_PER_LONG / 4];
-	u64 maxaddr = 0;
-
-	for (nd = rb_first(mb.b.entries); nd; nd = rb_next(nd)) {
-		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
-
-		if (mb.namelen < pos->namelen)
-			mb.namelen = pos->namelen;
-		if (maxaddr < pos->end)
-			maxaddr = pos->end;
-		if (verbose) {
-			u32 *idx = symbol__browser_index(pos);
-			*idx = mb.b.nr_entries;
-		}
-		++mb.b.nr_entries;
-	}
-
-	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
-	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
-	return map_browser__run(&mb, &es);
-}
-
-/* -------------------------------------------------------------------- */
-
 struct hist_browser {
 	struct ui_browser   b;
 	struct hists	    *hists;
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
new file mode 100644
index 0000000..b79f0c9
--- /dev/null
+++ b/tools/perf/util/ui/browsers/map.c
@@ -0,0 +1,163 @@
+#include "../libslang.h"
+#include <elf.h>
+#include <newt.h>
+#include <sys/ttydefaults.h>
+#include <ctype.h>
+#include <string.h>
+#include <linux/bitops.h>
+#include "../../debug.h"
+#include "../../symbol.h"
+#include "../browser.h"
+#include "../helpline.h"
+#include "map.h"
+
+static int ui_entry__read(const char *title, char *bf, size_t size, int width)
+{
+	struct newtExitStruct es;
+	newtComponent form, entry;
+	const char *result;
+	int err = -1;
+
+	newtCenteredWindow(width, 1, title);
+	form = newtForm(NULL, NULL, 0);
+	if (form == NULL)
+		return -1;
+
+	entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL);
+	if (entry == NULL)
+		goto out_free_form;
+
+	newtFormAddComponent(form, entry);
+	newtFormAddHotKey(form, NEWT_KEY_ENTER);
+	newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
+	newtFormAddHotKey(form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(form, CTRL('c'));
+	newtFormRun(form, &es);
+
+	if (result != NULL) {
+		strncpy(bf, result, size);
+		err = 0;
+	}
+out_free_form:
+	newtPopWindow();
+	newtFormDestroy(form);
+	return 0;
+}
+
+struct map_browser {
+	struct ui_browser b;
+	struct map	  *map;
+	u16		  namelen;
+	u8		  addrlen;
+};
+
+static void map_browser__write(struct ui_browser *self, void *nd, int row)
+{
+	struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
+	struct map_browser *mb = container_of(self, struct map_browser, b);
+	bool current_entry = ui_browser__is_current_entry(self, row);
+	int color = ui_browser__percent_color(0, current_entry);
+
+	SLsmg_set_color(color);
+	slsmg_printf("%*llx %*llx %c ",
+		     mb->addrlen, sym->start, mb->addrlen, sym->end,
+		     sym->binding == STB_GLOBAL ? 'g' :
+		     sym->binding == STB_LOCAL  ? 'l' : 'w');
+	slsmg_write_nstring(sym->name, mb->namelen);
+}
+
+/* FIXME uber-kludgy, see comment on cmd_report... */
+static u32 *symbol__browser_index(struct symbol *self)
+{
+	return ((void *)self) - sizeof(struct rb_node) - sizeof(u32);
+}
+
+static int map_browser__search(struct map_browser *self)
+{
+	char target[512];
+	struct symbol *sym;
+	int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40);
+
+	if (err)
+		return err;
+
+	if (target[0] == '0' && tolower(target[1]) == 'x') {
+		u64 addr = strtoull(target, NULL, 16);
+		sym = map__find_symbol(self->map, addr, NULL);
+	} else
+		sym = map__find_symbol_by_name(self->map, target, NULL);
+
+	if (sym != NULL) {
+		u32 *idx = symbol__browser_index(sym);
+
+		self->b.top = &sym->rb_node;
+		self->b.index = self->b.top_idx = *idx;
+	} else
+		ui_helpline__fpush("%s not found!", target);
+
+	return 0;
+}
+
+static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
+{
+	if (ui_browser__show(&self->b, self->map->dso->long_name) < 0)
+		return -1;
+
+	ui_helpline__fpush("Press <- or ESC to exit, %s / to search",
+			   verbose ? "" : "restart with -v to use");
+	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+	if (verbose)
+		newtFormAddHotKey(self->b.form, '/');
+
+	while (1) {
+		ui_browser__run(&self->b, es);
+
+		if (es->reason != NEWT_EXIT_HOTKEY)
+			break;
+		if (verbose && es->u.key == '/')
+			map_browser__search(self);
+		else
+			break;
+	}
+
+	newtFormDestroy(self->b.form);
+	newtPopWindow();
+	ui_helpline__pop();
+	return 0;
+}
+
+int map__browse(struct map *self)
+{
+	struct map_browser mb = {
+		.b = {
+			.entries = &self->dso->symbols[self->type],
+			.refresh = ui_browser__rb_tree_refresh,
+			.seek	 = ui_browser__rb_tree_seek,
+			.write	 = map_browser__write,
+		},
+		.map = self,
+	};
+	struct newtExitStruct es;
+	struct rb_node *nd;
+	char tmp[BITS_PER_LONG / 4];
+	u64 maxaddr = 0;
+
+	for (nd = rb_first(mb.b.entries); nd; nd = rb_next(nd)) {
+		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
+
+		if (mb.namelen < pos->namelen)
+			mb.namelen = pos->namelen;
+		if (maxaddr < pos->end)
+			maxaddr = pos->end;
+		if (verbose) {
+			u32 *idx = symbol__browser_index(pos);
+			*idx = mb.b.nr_entries;
+		}
+		++mb.b.nr_entries;
+	}
+
+	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
+	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
+	return map_browser__run(&mb, &es);
+}
diff --git a/tools/perf/util/ui/browsers/map.h b/tools/perf/util/ui/browsers/map.h
new file mode 100644
index 0000000..df8581a
--- /dev/null
+++ b/tools/perf/util/ui/browsers/map.h
@@ -0,0 +1,6 @@
+#ifndef _PERF_UI_MAP_BROWSER_H_
+#define _PERF_UI_MAP_BROWSER_H_ 1
+struct map;
+
+int map__browse(struct map *self);
+#endif /* _PERF_UI_MAP_BROWSER_H_ */

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

* [tip:perf/core] perf ui: Move hists browser to util/ui/browsers/
       [not found]             ` <new-submission>
                                 ` (586 preceding siblings ...)
  2010-08-11  7:41               ` [tip:perf/core] perf ui: Move map " tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:41               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:42               ` [tip:perf/core] perf ui: Complete the breakdown of util/newt.c tip-bot for Arnaldo Carvalho de Melo
                                 ` (118 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:41 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  d1b4f2491c3341c61c752049f73ba12553f978d8
Gitweb:     http://git.kernel.org/tip/d1b4f2491c3341c61c752049f73ba12553f978d8
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:49:07 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:11:08 -0300

perf ui: Move hists browser to util/ui/browsers/

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                             |    4 +
 tools/perf/util/newt.c                          |  965 +---------------------
 tools/perf/util/pstack.h                        |    2 +
 tools/perf/util/{newt.c => ui/browsers/hists.c} | 1037 ++++++++++-------------
 4 files changed, 454 insertions(+), 1554 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d118020..62e4d6f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -570,6 +570,7 @@ else
 		LIB_OBJS += $(OUTPUT)util/newt.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o
+		LIB_OBJS += $(OUTPUT)util/ui/browsers/hists.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_OBJS += $(OUTPUT)util/ui/progress.o
@@ -984,6 +985,9 @@ $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/ui/browsers/annotate.o: util/ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/ui/browsers/hists.o: util/ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+
 $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index b596926..6bccdaa 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -1,24 +1,19 @@
-#define _GNU_SOURCE
-#include <stdio.h>
-#undef _GNU_SOURCE
-#include "ui/libslang.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <elf.h>
 #include <newt.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
 #include <sys/ttydefaults.h>
 
 #include "cache.h"
-#include "hist.h"
-#include "pstack.h"
-#include "session.h"
-#include "sort.h"
-#include "symbol.h"
+#include "debug.h"
 #include "ui/browser.h"
 #include "ui/helpline.h"
-#include "ui/browsers/map.h"
 
 newtComponent newt_form__new(void);
+int popup_menu(int argc, char * const argv[]);
+int ui__help_window(const char *text);
+bool dialog_yesno(const char *msg);
 
 char browser__last_msg[1024];
 
@@ -57,7 +52,7 @@ newtComponent newt_form__new(void)
 	return self;
 }
 
-static int popup_menu(int argc, char * const argv[])
+int popup_menu(int argc, char * const argv[])
 {
 	struct newtExitStruct es;
 	int i, rc = -1, max_len = 5;
@@ -91,7 +86,7 @@ out_destroy_form:
 	return rc;
 }
 
-static int ui__help_window(const char *text)
+int ui__help_window(const char *text)
 {
 	struct newtExitStruct es;
 	newtComponent tb, form = newt_form__new();
@@ -133,316 +128,13 @@ out_destroy_form:
 	return rc;
 }
 
-static bool dialog_yesno(const char *msg)
+bool dialog_yesno(const char *msg)
 {
 	/* newtWinChoice should really be accepting const char pointers... */
 	char yes[] = "Yes", no[] = "No";
 	return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
 }
 
-static char *callchain_list__sym_name(struct callchain_list *self,
-				      char *bf, size_t bfsize)
-{
-	if (self->ms.sym)
-		return self->ms.sym->name;
-
-	snprintf(bf, bfsize, "%#Lx", self->ip);
-	return bf;
-}
-
-struct hist_browser {
-	struct ui_browser   b;
-	struct hists	    *hists;
-	struct hist_entry   *he_selection;
-	struct map_symbol   *selection;
-};
-
-static void hist_browser__reset(struct hist_browser *self);
-static int hist_browser__run(struct hist_browser *self, const char *title,
-			     struct newtExitStruct *es);
-static unsigned int hist_browser__refresh(struct ui_browser *self);
-static void ui_browser__hists_seek(struct ui_browser *self,
-				   off_t offset, int whence);
-
-static struct hist_browser *hist_browser__new(struct hists *hists)
-{
-	struct hist_browser *self = zalloc(sizeof(*self));
-
-	if (self) {
-		self->hists = hists;
-		self->b.refresh = hist_browser__refresh;
-		self->b.seek = ui_browser__hists_seek;
-	}
-
-	return self;
-}
-
-static void hist_browser__delete(struct hist_browser *self)
-{
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
-	free(self);
-}
-
-static struct hist_entry *hist_browser__selected_entry(struct hist_browser *self)
-{
-	return self->he_selection;
-}
-
-static struct thread *hist_browser__selected_thread(struct hist_browser *self)
-{
-	return self->he_selection->thread;
-}
-
-static int hist_browser__title(char *bf, size_t size, const char *ev_name,
-			       const struct dso *dso, const struct thread *thread)
-{
-	int printed = 0;
-
-	if (thread)
-		printed += snprintf(bf + printed, size - printed,
-				    "Thread: %s(%d)",
-				    (thread->comm_set ?  thread->comm : ""),
-				    thread->pid);
-	if (dso)
-		printed += snprintf(bf + printed, size - printed,
-				    "%sDSO: %s", thread ? " " : "",
-				    dso->short_name);
-	return printed ?: snprintf(bf, size, "Event: %s", ev_name);
-}
-
-int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
-{
-	struct hist_browser *browser = hist_browser__new(self);
-	struct pstack *fstack;
-	const struct thread *thread_filter = NULL;
-	const struct dso *dso_filter = NULL;
-	struct newtExitStruct es;
-	char msg[160];
-	int key = -1;
-
-	if (browser == NULL)
-		return -1;
-
-	fstack = pstack__new(2);
-	if (fstack == NULL)
-		goto out;
-
-	ui_helpline__push(helpline);
-
-	hist_browser__title(msg, sizeof(msg), ev_name,
-			    dso_filter, thread_filter);
-
-	while (1) {
-		const struct thread *thread;
-		const struct dso *dso;
-		char *options[16];
-		int nr_options = 0, choice = 0, i,
-		    annotate = -2, zoom_dso = -2, zoom_thread = -2,
-		    browse_map = -2;
-
-		if (hist_browser__run(browser, msg, &es))
-			break;
-
-		thread = hist_browser__selected_thread(browser);
-		dso = browser->selection->map ? browser->selection->map->dso : NULL;
-
-		if (es.reason == NEWT_EXIT_HOTKEY) {
-			key = es.u.key;
-
-			switch (key) {
-			case NEWT_KEY_F1:
-				goto do_help;
-			case NEWT_KEY_TAB:
-			case NEWT_KEY_UNTAB:
-				/*
-				 * Exit the browser, let hists__browser_tree
-				 * go to the next or previous
-				 */
-				goto out_free_stack;
-			default:;
-			}
-
-			key = toupper(key);
-			switch (key) {
-			case 'A':
-				if (browser->selection->map == NULL &&
-				    browser->selection->map->dso->annotate_warned)
-					continue;
-				goto do_annotate;
-			case 'D':
-				goto zoom_dso;
-			case 'T':
-				goto zoom_thread;
-			case 'H':
-			case '?':
-do_help:
-				ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
-						"<-        Zoom out\n"
-						"a         Annotate current symbol\n"
-						"h/?/F1    Show this window\n"
-						"d         Zoom into current DSO\n"
-						"t         Zoom into current Thread\n"
-						"q/CTRL+C  Exit browser");
-				continue;
-			default:;
-			}
-			if (is_exit_key(key)) {
-				if (key == NEWT_KEY_ESCAPE) {
-					if (dialog_yesno("Do you really want to exit?"))
-						break;
-					else
-						continue;
-				} else
-					break;
-			}
-
-			if (es.u.key == NEWT_KEY_LEFT) {
-				const void *top;
-
-				if (pstack__empty(fstack))
-					continue;
-				top = pstack__pop(fstack);
-				if (top == &dso_filter)
-					goto zoom_out_dso;
-				if (top == &thread_filter)
-					goto zoom_out_thread;
-				continue;
-			}
-		}
-
-		if (browser->selection->sym != NULL &&
-		    !browser->selection->map->dso->annotate_warned &&
-		    asprintf(&options[nr_options], "Annotate %s",
-			     browser->selection->sym->name) > 0)
-			annotate = nr_options++;
-
-		if (thread != NULL &&
-		    asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
-			     (thread_filter ? "out of" : "into"),
-			     (thread->comm_set ? thread->comm : ""),
-			     thread->pid) > 0)
-			zoom_thread = nr_options++;
-
-		if (dso != NULL &&
-		    asprintf(&options[nr_options], "Zoom %s %s DSO",
-			     (dso_filter ? "out of" : "into"),
-			     (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
-			zoom_dso = nr_options++;
-
-		if (browser->selection->map != NULL &&
-		    asprintf(&options[nr_options], "Browse map details") > 0)
-			browse_map = nr_options++;
-
-		options[nr_options++] = (char *)"Exit";
-
-		choice = popup_menu(nr_options, options);
-
-		for (i = 0; i < nr_options - 1; ++i)
-			free(options[i]);
-
-		if (choice == nr_options - 1)
-			break;
-
-		if (choice == -1)
-			continue;
-
-		if (choice == annotate) {
-			struct hist_entry *he;
-do_annotate:
-			if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
-				browser->selection->map->dso->annotate_warned = 1;
-				ui_helpline__puts("No vmlinux file found, can't "
-						 "annotate with just a "
-						 "kallsyms file");
-				continue;
-			}
-
-			he = hist_browser__selected_entry(browser);
-			if (he == NULL)
-				continue;
-
-			hist_entry__tui_annotate(he);
-		} else if (choice == browse_map)
-			map__browse(browser->selection->map);
-		else if (choice == zoom_dso) {
-zoom_dso:
-			if (dso_filter) {
-				pstack__remove(fstack, &dso_filter);
-zoom_out_dso:
-				ui_helpline__pop();
-				dso_filter = NULL;
-			} else {
-				if (dso == NULL)
-					continue;
-				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s DSO\"",
-						   dso->kernel ? "the Kernel" : dso->short_name);
-				dso_filter = dso;
-				pstack__push(fstack, &dso_filter);
-			}
-			hists__filter_by_dso(self, dso_filter);
-			hist_browser__title(msg, sizeof(msg), ev_name,
-					    dso_filter, thread_filter);
-			hist_browser__reset(browser);
-		} else if (choice == zoom_thread) {
-zoom_thread:
-			if (thread_filter) {
-				pstack__remove(fstack, &thread_filter);
-zoom_out_thread:
-				ui_helpline__pop();
-				thread_filter = NULL;
-			} else {
-				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"",
-						   thread->comm_set ? thread->comm : "",
-						   thread->pid);
-				thread_filter = thread;
-				pstack__push(fstack, &thread_filter);
-			}
-			hists__filter_by_thread(self, thread_filter);
-			hist_browser__title(msg, sizeof(msg), ev_name,
-					    dso_filter, thread_filter);
-			hist_browser__reset(browser);
-		}
-	}
-out_free_stack:
-	pstack__delete(fstack);
-out:
-	hist_browser__delete(browser);
-	return key;
-}
-
-int hists__tui_browse_tree(struct rb_root *self, const char *help)
-{
-	struct rb_node *first = rb_first(self), *nd = first, *next;
-	int key = 0;
-
-	while (nd) {
-		struct hists *hists = rb_entry(nd, struct hists, rb_node);
-		const char *ev_name = __event_name(hists->type, hists->config);
-
-		key = hists__browse(hists, help, ev_name);
-
-		if (is_exit_key(key))
-			break;
-
-		switch (key) {
-		case NEWT_KEY_TAB:
-			next = rb_next(nd);
-			if (next)
-				nd = next;
-			break;
-		case NEWT_KEY_UNTAB:
-			if (nd == first)
-				continue;
-			nd = rb_prev(nd);
-		default:
-			break;
-		}
-	}
-
-	return key;
-}
-
 static void newt_suspend(void *d __used)
 {
 	newtSuspend();
@@ -476,638 +168,3 @@ void exit_browser(bool wait_for_ok)
 		newtFinished();
 	}
 }
-
-static void hist_browser__refresh_dimensions(struct hist_browser *self)
-{
-	/* 3 == +/- toggle symbol before actual hist_entry rendering */
-	self->b.width = 3 + (hists__sort_list_width(self->hists) +
-			     sizeof("[k]"));
-}
-
-static void hist_browser__reset(struct hist_browser *self)
-{
-	self->b.nr_entries = self->hists->nr_entries;
-	hist_browser__refresh_dimensions(self);
-	ui_browser__reset_index(&self->b);
-}
-
-static char tree__folded_sign(bool unfolded)
-{
-	return unfolded ? '-' : '+';
-}
-
-static char map_symbol__folded(const struct map_symbol *self)
-{
-	return self->has_children ? tree__folded_sign(self->unfolded) : ' ';
-}
-
-static char hist_entry__folded(const struct hist_entry *self)
-{
-	return map_symbol__folded(&self->ms);
-}
-
-static char callchain_list__folded(const struct callchain_list *self)
-{
-	return map_symbol__folded(&self->ms);
-}
-
-static bool map_symbol__toggle_fold(struct map_symbol *self)
-{
-	if (!self->has_children)
-		return false;
-
-	self->unfolded = !self->unfolded;
-	return true;
-}
-
-#define LEVEL_OFFSET_STEP 3
-
-static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
-						     struct callchain_node *chain_node,
-						     u64 total, int level,
-						     unsigned short row,
-						     off_t *row_offset,
-						     bool *is_current_entry)
-{
-	struct rb_node *node;
-	int first_row = row, width, offset = level * LEVEL_OFFSET_STEP;
-	u64 new_total, remaining;
-
-	if (callchain_param.mode == CHAIN_GRAPH_REL)
-		new_total = chain_node->children_hit;
-	else
-		new_total = total;
-
-	remaining = new_total;
-	node = rb_first(&chain_node->rb_root);
-	while (node) {
-		struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
-		struct rb_node *next = rb_next(node);
-		u64 cumul = cumul_hits(child);
-		struct callchain_list *chain;
-		char folded_sign = ' ';
-		int first = true;
-		int extra_offset = 0;
-
-		remaining -= cumul;
-
-		list_for_each_entry(chain, &child->val, list) {
-			char ipstr[BITS_PER_LONG / 4 + 1], *alloc_str;
-			const char *str;
-			int color;
-			bool was_first = first;
-
-			if (first) {
-				first = false;
-				chain->ms.has_children = chain->list.next != &child->val ||
-							 rb_first(&child->rb_root) != NULL;
-			} else {
-				extra_offset = LEVEL_OFFSET_STEP;
-				chain->ms.has_children = chain->list.next == &child->val &&
-							 rb_first(&child->rb_root) != NULL;
-			}
-
-			folded_sign = callchain_list__folded(chain);
-			if (*row_offset != 0) {
-				--*row_offset;
-				goto do_next;
-			}
-
-			alloc_str = NULL;
-			str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-			if (was_first) {
-				double percent = cumul * 100.0 / new_total;
-
-				if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0)
-					str = "Not enough memory!";
-				else
-					str = alloc_str;
-			}
-
-			color = HE_COLORSET_NORMAL;
-			width = self->b.width - (offset + extra_offset + 2);
-			if (ui_browser__is_current_entry(&self->b, row)) {
-				self->selection = &chain->ms;
-				color = HE_COLORSET_SELECTED;
-				*is_current_entry = true;
-			}
-
-			SLsmg_set_color(color);
-			SLsmg_gotorc(self->b.y + row, self->b.x);
-			slsmg_write_nstring(" ", offset + extra_offset);
-			slsmg_printf("%c ", folded_sign);
-			slsmg_write_nstring(str, width);
-			free(alloc_str);
-
-			if (++row == self->b.height)
-				goto out;
-do_next:
-			if (folded_sign == '+')
-				break;
-		}
-
-		if (folded_sign == '-') {
-			const int new_level = level + (extra_offset ? 2 : 1);
-			row += hist_browser__show_callchain_node_rb_tree(self, child, new_total,
-									 new_level, row, row_offset,
-									 is_current_entry);
-		}
-		if (row == self->b.height)
-			goto out;
-		node = next;
-	}
-out:
-	return row - first_row;
-}
-
-static int hist_browser__show_callchain_node(struct hist_browser *self,
-					     struct callchain_node *node,
-					     int level, unsigned short row,
-					     off_t *row_offset,
-					     bool *is_current_entry)
-{
-	struct callchain_list *chain;
-	int first_row = row,
-	     offset = level * LEVEL_OFFSET_STEP,
-	     width = self->b.width - offset;
-	char folded_sign = ' ';
-
-	list_for_each_entry(chain, &node->val, list) {
-		char ipstr[BITS_PER_LONG / 4 + 1], *s;
-		int color;
-		/*
-		 * FIXME: This should be moved to somewhere else,
-		 * probably when the callchain is created, so as not to
-		 * traverse it all over again
-		 */
-		chain->ms.has_children = rb_first(&node->rb_root) != NULL;
-		folded_sign = callchain_list__folded(chain);
-
-		if (*row_offset != 0) {
-			--*row_offset;
-			continue;
-		}
-
-		color = HE_COLORSET_NORMAL;
-		if (ui_browser__is_current_entry(&self->b, row)) {
-			self->selection = &chain->ms;
-			color = HE_COLORSET_SELECTED;
-			*is_current_entry = true;
-		}
-
-		s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-		SLsmg_gotorc(self->b.y + row, self->b.x);
-		SLsmg_set_color(color);
-		slsmg_write_nstring(" ", offset);
-		slsmg_printf("%c ", folded_sign);
-		slsmg_write_nstring(s, width - 2);
-
-		if (++row == self->b.height)
-			goto out;
-	}
-
-	if (folded_sign == '-')
-		row += hist_browser__show_callchain_node_rb_tree(self, node,
-								 self->hists->stats.total_period,
-								 level + 1, row,
-								 row_offset,
-								 is_current_entry);
-out:
-	return row - first_row;
-}
-
-static int hist_browser__show_callchain(struct hist_browser *self,
-					struct rb_root *chain,
-					int level, unsigned short row,
-					off_t *row_offset,
-					bool *is_current_entry)
-{
-	struct rb_node *nd;
-	int first_row = row;
-
-	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-
-		row += hist_browser__show_callchain_node(self, node, level,
-							 row, row_offset,
-							 is_current_entry);
-		if (row == self->b.height)
-			break;
-	}
-
-	return row - first_row;
-}
-
-static int hist_browser__show_entry(struct hist_browser *self,
-				    struct hist_entry *entry,
-				    unsigned short row)
-{
-	char s[256];
-	double percent;
-	int printed = 0;
-	int color, width = self->b.width;
-	char folded_sign = ' ';
-	bool current_entry = ui_browser__is_current_entry(&self->b, row);
-	off_t row_offset = entry->row_offset;
-
-	if (current_entry) {
-		self->he_selection = entry;
-		self->selection = &entry->ms;
-	}
-
-	if (symbol_conf.use_callchain) {
-		entry->ms.has_children = !RB_EMPTY_ROOT(&entry->sorted_chain);
-		folded_sign = hist_entry__folded(entry);
-	}
-
-	if (row_offset == 0) {
-		hist_entry__snprintf(entry, s, sizeof(s), self->hists, NULL, false,
-				     0, false, self->hists->stats.total_period);
-		percent = (entry->period * 100.0) / self->hists->stats.total_period;
-
-		color = HE_COLORSET_SELECTED;
-		if (!current_entry) {
-			if (percent >= MIN_RED)
-				color = HE_COLORSET_TOP;
-			else if (percent >= MIN_GREEN)
-				color = HE_COLORSET_MEDIUM;
-			else
-				color = HE_COLORSET_NORMAL;
-		}
-
-		SLsmg_set_color(color);
-		SLsmg_gotorc(self->b.y + row, self->b.x);
-		if (symbol_conf.use_callchain) {
-			slsmg_printf("%c ", folded_sign);
-			width -= 2;
-		}
-		slsmg_write_nstring(s, width);
-		++row;
-		++printed;
-	} else
-		--row_offset;
-
-	if (folded_sign == '-' && row != self->b.height) {
-		printed += hist_browser__show_callchain(self, &entry->sorted_chain,
-							1, row, &row_offset,
-							&current_entry);
-		if (current_entry)
-			self->he_selection = entry;
-	}
-
-	return printed;
-}
-
-static unsigned int hist_browser__refresh(struct ui_browser *self)
-{
-	unsigned row = 0;
-	struct rb_node *nd;
-	struct hist_browser *hb = container_of(self, struct hist_browser, b);
-
-	if (self->top == NULL)
-		self->top = rb_first(&hb->hists->entries);
-
-	for (nd = self->top; nd; nd = rb_next(nd)) {
-		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
-
-		if (h->filtered)
-			continue;
-
-		row += hist_browser__show_entry(hb, h, row);
-		if (row == self->height)
-			break;
-	}
-
-	return row;
-}
-
-static void callchain_node__init_have_children_rb_tree(struct callchain_node *self)
-{
-	struct rb_node *nd = rb_first(&self->rb_root);
-
-	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
-		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
-		struct callchain_list *chain;
-		int first = true;
-
-		list_for_each_entry(chain, &child->val, list) {
-			if (first) {
-				first = false;
-				chain->ms.has_children = chain->list.next != &child->val ||
-							 rb_first(&child->rb_root) != NULL;
-			} else
-				chain->ms.has_children = chain->list.next == &child->val &&
-							 rb_first(&child->rb_root) != NULL;
-		}
-
-		callchain_node__init_have_children_rb_tree(child);
-	}
-}
-
-static void callchain_node__init_have_children(struct callchain_node *self)
-{
-	struct callchain_list *chain;
-
-	list_for_each_entry(chain, &self->val, list)
-		chain->ms.has_children = rb_first(&self->rb_root) != NULL;
-
-	callchain_node__init_have_children_rb_tree(self);
-}
-
-static void callchain__init_have_children(struct rb_root *self)
-{
-	struct rb_node *nd;
-
-	for (nd = rb_first(self); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-		callchain_node__init_have_children(node);
-	}
-}
-
-static void hist_entry__init_have_children(struct hist_entry *self)
-{
-	if (!self->init_have_children) {
-		callchain__init_have_children(&self->sorted_chain);
-		self->init_have_children = true;
-	}
-}
-
-static struct rb_node *hists__filter_entries(struct rb_node *nd)
-{
-	while (nd != NULL) {
-		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
-		if (!h->filtered)
-			return nd;
-
-		nd = rb_next(nd);
-	}
-
-	return NULL;
-}
-
-static struct rb_node *hists__filter_prev_entries(struct rb_node *nd)
-{
-	while (nd != NULL) {
-		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
-		if (!h->filtered)
-			return nd;
-
-		nd = rb_prev(nd);
-	}
-
-	return NULL;
-}
-
-static void ui_browser__hists_seek(struct ui_browser *self,
-				   off_t offset, int whence)
-{
-	struct hist_entry *h;
-	struct rb_node *nd;
-	bool first = true;
-
-	switch (whence) {
-	case SEEK_SET:
-		nd = hists__filter_entries(rb_first(self->entries));
-		break;
-	case SEEK_CUR:
-		nd = self->top;
-		goto do_offset;
-	case SEEK_END:
-		nd = hists__filter_prev_entries(rb_last(self->entries));
-		first = false;
-		break;
-	default:
-		return;
-	}
-
-	/*
-	 * Moves not relative to the first visible entry invalidates its
-	 * row_offset:
-	 */
-	h = rb_entry(self->top, struct hist_entry, rb_node);
-	h->row_offset = 0;
-
-	/*
-	 * Here we have to check if nd is expanded (+), if it is we can't go
-	 * the next top level hist_entry, instead we must compute an offset of
-	 * what _not_ to show and not change the first visible entry.
-	 *
-	 * This offset increments when we are going from top to bottom and
-	 * decreases when we're going from bottom to top.
-	 *
-	 * As we don't have backpointers to the top level in the callchains
-	 * structure, we need to always print the whole hist_entry callchain,
-	 * skipping the first ones that are before the first visible entry
-	 * and stop when we printed enough lines to fill the screen.
-	 */
-do_offset:
-	if (offset > 0) {
-		do {
-			h = rb_entry(nd, struct hist_entry, rb_node);
-			if (h->ms.unfolded) {
-				u16 remaining = h->nr_rows - h->row_offset;
-				if (offset > remaining) {
-					offset -= remaining;
-					h->row_offset = 0;
-				} else {
-					h->row_offset += offset;
-					offset = 0;
-					self->top = nd;
-					break;
-				}
-			}
-			nd = hists__filter_entries(rb_next(nd));
-			if (nd == NULL)
-				break;
-			--offset;
-			self->top = nd;
-		} while (offset != 0);
-	} else if (offset < 0) {
-		while (1) {
-			h = rb_entry(nd, struct hist_entry, rb_node);
-			if (h->ms.unfolded) {
-				if (first) {
-					if (-offset > h->row_offset) {
-						offset += h->row_offset;
-						h->row_offset = 0;
-					} else {
-						h->row_offset += offset;
-						offset = 0;
-						self->top = nd;
-						break;
-					}
-				} else {
-					if (-offset > h->nr_rows) {
-						offset += h->nr_rows;
-						h->row_offset = 0;
-					} else {
-						h->row_offset = h->nr_rows + offset;
-						offset = 0;
-						self->top = nd;
-						break;
-					}
-				}
-			}
-
-			nd = hists__filter_prev_entries(rb_prev(nd));
-			if (nd == NULL)
-				break;
-			++offset;
-			self->top = nd;
-			if (offset == 0) {
-				/*
-				 * Last unfiltered hist_entry, check if it is
-				 * unfolded, if it is then we should have
-				 * row_offset at its last entry.
-				 */
-				h = rb_entry(nd, struct hist_entry, rb_node);
-				if (h->ms.unfolded)
-					h->row_offset = h->nr_rows;
-				break;
-			}
-			first = false;
-		}
-	} else {
-		self->top = nd;
-		h = rb_entry(nd, struct hist_entry, rb_node);
-		h->row_offset = 0;
-	}
-}
-
-static int callchain_node__count_rows_rb_tree(struct callchain_node *self)
-{
-	int n = 0;
-	struct rb_node *nd;
-
-	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
-		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
-		struct callchain_list *chain;
-		char folded_sign = ' '; /* No children */
-
-		list_for_each_entry(chain, &child->val, list) {
-			++n;
-			/* We need this because we may not have children */
-			folded_sign = callchain_list__folded(chain);
-			if (folded_sign == '+')
-				break;
-		}
-
-		if (folded_sign == '-') /* Have children and they're unfolded */
-			n += callchain_node__count_rows_rb_tree(child);
-	}
-
-	return n;
-}
-
-static int callchain_node__count_rows(struct callchain_node *node)
-{
-	struct callchain_list *chain;
-	bool unfolded = false;
-	int n = 0;
-
-	list_for_each_entry(chain, &node->val, list) {
-		++n;
-		unfolded = chain->ms.unfolded;
-	}
-
-	if (unfolded)
-		n += callchain_node__count_rows_rb_tree(node);
-
-	return n;
-}
-
-static int callchain__count_rows(struct rb_root *chain)
-{
-	struct rb_node *nd;
-	int n = 0;
-
-	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-		n += callchain_node__count_rows(node);
-	}
-
-	return n;
-}
-
-static bool hist_browser__toggle_fold(struct hist_browser *self)
-{
-	if (map_symbol__toggle_fold(self->selection)) {
-		struct hist_entry *he = self->he_selection;
-
-		hist_entry__init_have_children(he);
-		self->hists->nr_entries -= he->nr_rows;
-
-		if (he->ms.unfolded)
-			he->nr_rows = callchain__count_rows(&he->sorted_chain);
-		else
-			he->nr_rows = 0;
-		self->hists->nr_entries += he->nr_rows;
-		self->b.nr_entries = self->hists->nr_entries;
-
-		return true;
-	}
-
-	/* If it doesn't have children, no toggling performed */
-	return false;
-}
-
-static int hist_browser__run(struct hist_browser *self, const char *title,
-			     struct newtExitStruct *es)
-{
-	char str[256], unit;
-	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
-
-	self->b.entries = &self->hists->entries;
-	self->b.nr_entries = self->hists->nr_entries;
-
-	hist_browser__refresh_dimensions(self);
-
-	nr_events = convert_unit(nr_events, &unit);
-	snprintf(str, sizeof(str), "Events: %lu%c                            ",
-		 nr_events, unit);
-	newtDrawRootText(0, 0, str);
-
-	if (ui_browser__show(&self->b, title) < 0)
-		return -1;
-
-	newtFormAddHotKey(self->b.form, 'A');
-	newtFormAddHotKey(self->b.form, 'a');
-	newtFormAddHotKey(self->b.form, '?');
-	newtFormAddHotKey(self->b.form, 'h');
-	newtFormAddHotKey(self->b.form, 'H');
-	newtFormAddHotKey(self->b.form, 'd');
-
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
-
-	while (1) {
-		ui_browser__run(&self->b, es);
-
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-		switch (es->u.key) {
-		case 'd': { /* Debug */
-			static int seq;
-			struct hist_entry *h = rb_entry(self->b.top,
-							struct hist_entry, rb_node);
-			ui_helpline__pop();
-			ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
-					   seq++, self->b.nr_entries,
-					   self->hists->nr_entries,
-					   self->b.height,
-					   self->b.index,
-					   self->b.top_idx,
-					   h->row_offset, h->nr_rows);
-		}
-			continue;
-		case NEWT_KEY_ENTER:
-			if (hist_browser__toggle_fold(self))
-				break;
-			/* fall thru */
-		default:
-			return 0;
-		}
-	}
-	return 0;
-}
diff --git a/tools/perf/util/pstack.h b/tools/perf/util/pstack.h
index 5ad0702..4cedea5 100644
--- a/tools/perf/util/pstack.h
+++ b/tools/perf/util/pstack.h
@@ -1,6 +1,8 @@
 #ifndef _PERF_PSTACK_
 #define _PERF_PSTACK_
 
+#include <stdbool.h>
+
 struct pstack;
 struct pstack *pstack__new(unsigned short max_nr_entries);
 void pstack__delete(struct pstack *self);
diff --git a/tools/perf/util/newt.c b/tools/perf/util/ui/browsers/hists.c
similarity index 85%
copy from tools/perf/util/newt.c
copy to tools/perf/util/ui/browsers/hists.c
index b596926..9d32a41 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -1,523 +1,273 @@
 #define _GNU_SOURCE
 #include <stdio.h>
 #undef _GNU_SOURCE
-#include "ui/libslang.h"
-#include <signal.h>
+#include "../libslang.h"
 #include <stdlib.h>
-#include <elf.h>
+#include <string.h>
 #include <newt.h>
-#include <sys/ttydefaults.h>
+#include <linux/rbtree.h>
 
-#include "cache.h"
-#include "hist.h"
-#include "pstack.h"
-#include "session.h"
-#include "sort.h"
-#include "symbol.h"
-#include "ui/browser.h"
-#include "ui/helpline.h"
-#include "ui/browsers/map.h"
+#include "../../hist.h"
+#include "../../pstack.h"
+#include "../../sort.h"
+#include "../../util.h"
 
-newtComponent newt_form__new(void);
+#include "../browser.h"
+#include "../helpline.h"
+#include "../util.h"
+#include "map.h"
 
-char browser__last_msg[1024];
+int ui__help_window(const char *text);
+bool dialog_yesno(const char *msg);
+int popup_menu(int argc, char * const argv[]);
 
-int browser__show_help(const char *format, va_list ap)
-{
-	int ret;
-	static int backlog;
+struct hist_browser {
+	struct ui_browser   b;
+	struct hists	    *hists;
+	struct hist_entry   *he_selection;
+	struct map_symbol   *selection;
+};
 
-        ret = vsnprintf(browser__last_msg + backlog,
-			sizeof(browser__last_msg) - backlog, format, ap);
-	backlog += ret;
+static void hist_browser__refresh_dimensions(struct hist_browser *self)
+{
+	/* 3 == +/- toggle symbol before actual hist_entry rendering */
+	self->b.width = 3 + (hists__sort_list_width(self->hists) +
+			     sizeof("[k]"));
+}
 
-	if (browser__last_msg[backlog - 1] == '\n') {
-		ui_helpline__puts(browser__last_msg);
-		newtRefresh();
-		backlog = 0;
-	}
+static void hist_browser__reset(struct hist_browser *self)
+{
+	self->b.nr_entries = self->hists->nr_entries;
+	hist_browser__refresh_dimensions(self);
+	ui_browser__reset_index(&self->b);
+}
 
-	return ret;
+static char tree__folded_sign(bool unfolded)
+{
+	return unfolded ? '-' : '+';
 }
 
-static void newt_form__set_exit_keys(newtComponent self)
+static char map_symbol__folded(const struct map_symbol *self)
 {
-	newtFormAddHotKey(self, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self, NEWT_KEY_ESCAPE);
-	newtFormAddHotKey(self, 'Q');
-	newtFormAddHotKey(self, 'q');
-	newtFormAddHotKey(self, CTRL('c'));
+	return self->has_children ? tree__folded_sign(self->unfolded) : ' ';
 }
 
-newtComponent newt_form__new(void)
+static char hist_entry__folded(const struct hist_entry *self)
 {
-	newtComponent self = newtForm(NULL, NULL, 0);
-	if (self)
-		newt_form__set_exit_keys(self);
-	return self;
+	return map_symbol__folded(&self->ms);
 }
 
-static int popup_menu(int argc, char * const argv[])
+static char callchain_list__folded(const struct callchain_list *self)
 {
-	struct newtExitStruct es;
-	int i, rc = -1, max_len = 5;
-	newtComponent listbox, form = newt_form__new();
+	return map_symbol__folded(&self->ms);
+}
 
-	if (form == NULL)
-		return -1;
+static int callchain_node__count_rows_rb_tree(struct callchain_node *self)
+{
+	int n = 0;
+	struct rb_node *nd;
 
-	listbox = newtListbox(0, 0, argc, NEWT_FLAG_RETURNEXIT);
-	if (listbox == NULL)
-		goto out_destroy_form;
+	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
+		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_list *chain;
+		char folded_sign = ' '; /* No children */
 
-	newtFormAddComponent(form, listbox);
+		list_for_each_entry(chain, &child->val, list) {
+			++n;
+			/* We need this because we may not have children */
+			folded_sign = callchain_list__folded(chain);
+			if (folded_sign == '+')
+				break;
+		}
 
-	for (i = 0; i < argc; ++i) {
-		int len = strlen(argv[i]);
-		if (len > max_len)
-			max_len = len;
-		if (newtListboxAddEntry(listbox, argv[i], (void *)(long)i))
-			goto out_destroy_form;
+		if (folded_sign == '-') /* Have children and they're unfolded */
+			n += callchain_node__count_rows_rb_tree(child);
 	}
 
-	newtCenteredWindow(max_len, argc, NULL);
-	newtFormRun(form, &es);
-	rc = newtListboxGetCurrent(listbox) - NULL;
-	if (es.reason == NEWT_EXIT_HOTKEY)
-		rc = -1;
-	newtPopWindow();
-out_destroy_form:
-	newtFormDestroy(form);
-	return rc;
+	return n;
 }
 
-static int ui__help_window(const char *text)
+static int callchain_node__count_rows(struct callchain_node *node)
 {
-	struct newtExitStruct es;
-	newtComponent tb, form = newt_form__new();
-	int rc = -1;
-	int max_len = 0, nr_lines = 0;
-	const char *t;
-
-	if (form == NULL)
-		return -1;
+	struct callchain_list *chain;
+	bool unfolded = false;
+	int n = 0;
 
-	t = text;
-	while (1) {
-		const char *sep = strchr(t, '\n');
-		int len;
-
-		if (sep == NULL)
-			sep = strchr(t, '\0');
-		len = sep - t;
-		if (max_len < len)
-			max_len = len;
-		++nr_lines;
-		if (*sep == '\0')
-			break;
-		t = sep + 1;
+	list_for_each_entry(chain, &node->val, list) {
+		++n;
+		unfolded = chain->ms.unfolded;
 	}
 
-	tb = newtTextbox(0, 0, max_len, nr_lines, 0);
-	if (tb == NULL)
-		goto out_destroy_form;
+	if (unfolded)
+		n += callchain_node__count_rows_rb_tree(node);
 
-	newtTextboxSetText(tb, text);
-	newtFormAddComponent(form, tb);
-	newtCenteredWindow(max_len, nr_lines, NULL);
-	newtFormRun(form, &es);
-	newtPopWindow();
-	rc = 0;
-out_destroy_form:
-	newtFormDestroy(form);
-	return rc;
+	return n;
 }
 
-static bool dialog_yesno(const char *msg)
+static int callchain__count_rows(struct rb_root *chain)
 {
-	/* newtWinChoice should really be accepting const char pointers... */
-	char yes[] = "Yes", no[] = "No";
-	return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
+	struct rb_node *nd;
+	int n = 0;
+
+	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+		n += callchain_node__count_rows(node);
+	}
+
+	return n;
 }
 
-static char *callchain_list__sym_name(struct callchain_list *self,
-				      char *bf, size_t bfsize)
+static bool map_symbol__toggle_fold(struct map_symbol *self)
 {
-	if (self->ms.sym)
-		return self->ms.sym->name;
+	if (!self->has_children)
+		return false;
 
-	snprintf(bf, bfsize, "%#Lx", self->ip);
-	return bf;
+	self->unfolded = !self->unfolded;
+	return true;
 }
 
-struct hist_browser {
-	struct ui_browser   b;
-	struct hists	    *hists;
-	struct hist_entry   *he_selection;
-	struct map_symbol   *selection;
-};
+static void callchain_node__init_have_children_rb_tree(struct callchain_node *self)
+{
+	struct rb_node *nd = rb_first(&self->rb_root);
 
-static void hist_browser__reset(struct hist_browser *self);
-static int hist_browser__run(struct hist_browser *self, const char *title,
-			     struct newtExitStruct *es);
-static unsigned int hist_browser__refresh(struct ui_browser *self);
-static void ui_browser__hists_seek(struct ui_browser *self,
-				   off_t offset, int whence);
+	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
+		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_list *chain;
+		int first = true;
 
-static struct hist_browser *hist_browser__new(struct hists *hists)
-{
-	struct hist_browser *self = zalloc(sizeof(*self));
+		list_for_each_entry(chain, &child->val, list) {
+			if (first) {
+				first = false;
+				chain->ms.has_children = chain->list.next != &child->val ||
+							 rb_first(&child->rb_root) != NULL;
+			} else
+				chain->ms.has_children = chain->list.next == &child->val &&
+							 rb_first(&child->rb_root) != NULL;
+		}
 
-	if (self) {
-		self->hists = hists;
-		self->b.refresh = hist_browser__refresh;
-		self->b.seek = ui_browser__hists_seek;
+		callchain_node__init_have_children_rb_tree(child);
 	}
-
-	return self;
 }
 
-static void hist_browser__delete(struct hist_browser *self)
+static void callchain_node__init_have_children(struct callchain_node *self)
 {
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
-	free(self);
+	struct callchain_list *chain;
+
+	list_for_each_entry(chain, &self->val, list)
+		chain->ms.has_children = rb_first(&self->rb_root) != NULL;
+
+	callchain_node__init_have_children_rb_tree(self);
 }
 
-static struct hist_entry *hist_browser__selected_entry(struct hist_browser *self)
+static void callchain__init_have_children(struct rb_root *self)
 {
-	return self->he_selection;
+	struct rb_node *nd;
+
+	for (nd = rb_first(self); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+		callchain_node__init_have_children(node);
+	}
 }
 
-static struct thread *hist_browser__selected_thread(struct hist_browser *self)
+static void hist_entry__init_have_children(struct hist_entry *self)
 {
-	return self->he_selection->thread;
+	if (!self->init_have_children) {
+		callchain__init_have_children(&self->sorted_chain);
+		self->init_have_children = true;
+	}
 }
 
-static int hist_browser__title(char *bf, size_t size, const char *ev_name,
-			       const struct dso *dso, const struct thread *thread)
+static bool hist_browser__toggle_fold(struct hist_browser *self)
 {
-	int printed = 0;
+	if (map_symbol__toggle_fold(self->selection)) {
+		struct hist_entry *he = self->he_selection;
 
-	if (thread)
-		printed += snprintf(bf + printed, size - printed,
-				    "Thread: %s(%d)",
-				    (thread->comm_set ?  thread->comm : ""),
-				    thread->pid);
-	if (dso)
-		printed += snprintf(bf + printed, size - printed,
-				    "%sDSO: %s", thread ? " " : "",
-				    dso->short_name);
-	return printed ?: snprintf(bf, size, "Event: %s", ev_name);
+		hist_entry__init_have_children(he);
+		self->hists->nr_entries -= he->nr_rows;
+
+		if (he->ms.unfolded)
+			he->nr_rows = callchain__count_rows(&he->sorted_chain);
+		else
+			he->nr_rows = 0;
+		self->hists->nr_entries += he->nr_rows;
+		self->b.nr_entries = self->hists->nr_entries;
+
+		return true;
+	}
+
+	/* If it doesn't have children, no toggling performed */
+	return false;
 }
 
-int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
+static int hist_browser__run(struct hist_browser *self, const char *title,
+			     struct newtExitStruct *es)
 {
-	struct hist_browser *browser = hist_browser__new(self);
-	struct pstack *fstack;
-	const struct thread *thread_filter = NULL;
-	const struct dso *dso_filter = NULL;
-	struct newtExitStruct es;
-	char msg[160];
-	int key = -1;
+	char str[256], unit;
+	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
 
-	if (browser == NULL)
-		return -1;
+	self->b.entries = &self->hists->entries;
+	self->b.nr_entries = self->hists->nr_entries;
 
-	fstack = pstack__new(2);
-	if (fstack == NULL)
-		goto out;
+	hist_browser__refresh_dimensions(self);
 
-	ui_helpline__push(helpline);
+	nr_events = convert_unit(nr_events, &unit);
+	snprintf(str, sizeof(str), "Events: %lu%c                            ",
+		 nr_events, unit);
+	newtDrawRootText(0, 0, str);
 
-	hist_browser__title(msg, sizeof(msg), ev_name,
-			    dso_filter, thread_filter);
+	if (ui_browser__show(&self->b, title) < 0)
+		return -1;
+
+	newtFormAddHotKey(self->b.form, 'A');
+	newtFormAddHotKey(self->b.form, 'a');
+	newtFormAddHotKey(self->b.form, '?');
+	newtFormAddHotKey(self->b.form, 'h');
+	newtFormAddHotKey(self->b.form, 'H');
+	newtFormAddHotKey(self->b.form, 'd');
+
+	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
 
 	while (1) {
-		const struct thread *thread;
-		const struct dso *dso;
-		char *options[16];
-		int nr_options = 0, choice = 0, i,
-		    annotate = -2, zoom_dso = -2, zoom_thread = -2,
-		    browse_map = -2;
+		ui_browser__run(&self->b, es);
 
-		if (hist_browser__run(browser, msg, &es))
+		if (es->reason != NEWT_EXIT_HOTKEY)
 			break;
+		switch (es->u.key) {
+		case 'd': { /* Debug */
+			static int seq;
+			struct hist_entry *h = rb_entry(self->b.top,
+							struct hist_entry, rb_node);
+			ui_helpline__pop();
+			ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
+					   seq++, self->b.nr_entries,
+					   self->hists->nr_entries,
+					   self->b.height,
+					   self->b.index,
+					   self->b.top_idx,
+					   h->row_offset, h->nr_rows);
+		}
+			continue;
+		case NEWT_KEY_ENTER:
+			if (hist_browser__toggle_fold(self))
+				break;
+			/* fall thru */
+		default:
+			return 0;
+		}
+	}
+	return 0;
+}
 
-		thread = hist_browser__selected_thread(browser);
-		dso = browser->selection->map ? browser->selection->map->dso : NULL;
-
-		if (es.reason == NEWT_EXIT_HOTKEY) {
-			key = es.u.key;
-
-			switch (key) {
-			case NEWT_KEY_F1:
-				goto do_help;
-			case NEWT_KEY_TAB:
-			case NEWT_KEY_UNTAB:
-				/*
-				 * Exit the browser, let hists__browser_tree
-				 * go to the next or previous
-				 */
-				goto out_free_stack;
-			default:;
-			}
-
-			key = toupper(key);
-			switch (key) {
-			case 'A':
-				if (browser->selection->map == NULL &&
-				    browser->selection->map->dso->annotate_warned)
-					continue;
-				goto do_annotate;
-			case 'D':
-				goto zoom_dso;
-			case 'T':
-				goto zoom_thread;
-			case 'H':
-			case '?':
-do_help:
-				ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
-						"<-        Zoom out\n"
-						"a         Annotate current symbol\n"
-						"h/?/F1    Show this window\n"
-						"d         Zoom into current DSO\n"
-						"t         Zoom into current Thread\n"
-						"q/CTRL+C  Exit browser");
-				continue;
-			default:;
-			}
-			if (is_exit_key(key)) {
-				if (key == NEWT_KEY_ESCAPE) {
-					if (dialog_yesno("Do you really want to exit?"))
-						break;
-					else
-						continue;
-				} else
-					break;
-			}
-
-			if (es.u.key == NEWT_KEY_LEFT) {
-				const void *top;
-
-				if (pstack__empty(fstack))
-					continue;
-				top = pstack__pop(fstack);
-				if (top == &dso_filter)
-					goto zoom_out_dso;
-				if (top == &thread_filter)
-					goto zoom_out_thread;
-				continue;
-			}
-		}
-
-		if (browser->selection->sym != NULL &&
-		    !browser->selection->map->dso->annotate_warned &&
-		    asprintf(&options[nr_options], "Annotate %s",
-			     browser->selection->sym->name) > 0)
-			annotate = nr_options++;
-
-		if (thread != NULL &&
-		    asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
-			     (thread_filter ? "out of" : "into"),
-			     (thread->comm_set ? thread->comm : ""),
-			     thread->pid) > 0)
-			zoom_thread = nr_options++;
-
-		if (dso != NULL &&
-		    asprintf(&options[nr_options], "Zoom %s %s DSO",
-			     (dso_filter ? "out of" : "into"),
-			     (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
-			zoom_dso = nr_options++;
-
-		if (browser->selection->map != NULL &&
-		    asprintf(&options[nr_options], "Browse map details") > 0)
-			browse_map = nr_options++;
-
-		options[nr_options++] = (char *)"Exit";
-
-		choice = popup_menu(nr_options, options);
-
-		for (i = 0; i < nr_options - 1; ++i)
-			free(options[i]);
-
-		if (choice == nr_options - 1)
-			break;
-
-		if (choice == -1)
-			continue;
-
-		if (choice == annotate) {
-			struct hist_entry *he;
-do_annotate:
-			if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
-				browser->selection->map->dso->annotate_warned = 1;
-				ui_helpline__puts("No vmlinux file found, can't "
-						 "annotate with just a "
-						 "kallsyms file");
-				continue;
-			}
-
-			he = hist_browser__selected_entry(browser);
-			if (he == NULL)
-				continue;
-
-			hist_entry__tui_annotate(he);
-		} else if (choice == browse_map)
-			map__browse(browser->selection->map);
-		else if (choice == zoom_dso) {
-zoom_dso:
-			if (dso_filter) {
-				pstack__remove(fstack, &dso_filter);
-zoom_out_dso:
-				ui_helpline__pop();
-				dso_filter = NULL;
-			} else {
-				if (dso == NULL)
-					continue;
-				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s DSO\"",
-						   dso->kernel ? "the Kernel" : dso->short_name);
-				dso_filter = dso;
-				pstack__push(fstack, &dso_filter);
-			}
-			hists__filter_by_dso(self, dso_filter);
-			hist_browser__title(msg, sizeof(msg), ev_name,
-					    dso_filter, thread_filter);
-			hist_browser__reset(browser);
-		} else if (choice == zoom_thread) {
-zoom_thread:
-			if (thread_filter) {
-				pstack__remove(fstack, &thread_filter);
-zoom_out_thread:
-				ui_helpline__pop();
-				thread_filter = NULL;
-			} else {
-				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"",
-						   thread->comm_set ? thread->comm : "",
-						   thread->pid);
-				thread_filter = thread;
-				pstack__push(fstack, &thread_filter);
-			}
-			hists__filter_by_thread(self, thread_filter);
-			hist_browser__title(msg, sizeof(msg), ev_name,
-					    dso_filter, thread_filter);
-			hist_browser__reset(browser);
-		}
-	}
-out_free_stack:
-	pstack__delete(fstack);
-out:
-	hist_browser__delete(browser);
-	return key;
-}
-
-int hists__tui_browse_tree(struct rb_root *self, const char *help)
-{
-	struct rb_node *first = rb_first(self), *nd = first, *next;
-	int key = 0;
-
-	while (nd) {
-		struct hists *hists = rb_entry(nd, struct hists, rb_node);
-		const char *ev_name = __event_name(hists->type, hists->config);
-
-		key = hists__browse(hists, help, ev_name);
-
-		if (is_exit_key(key))
-			break;
-
-		switch (key) {
-		case NEWT_KEY_TAB:
-			next = rb_next(nd);
-			if (next)
-				nd = next;
-			break;
-		case NEWT_KEY_UNTAB:
-			if (nd == first)
-				continue;
-			nd = rb_prev(nd);
-		default:
-			break;
-		}
-	}
-
-	return key;
-}
-
-static void newt_suspend(void *d __used)
-{
-	newtSuspend();
-	raise(SIGTSTP);
-	newtResume();
-}
-
-void setup_browser(void)
-{
-	if (!isatty(1) || !use_browser || dump_trace) {
-		use_browser = 0;
-		setup_pager();
-		return;
-	}
-
-	use_browser = 1;
-	newtInit();
-	newtCls();
-	newtSetSuspendCallback(newt_suspend, NULL);
-	ui_helpline__puts(" ");
-	ui_browser__init();
-}
-
-void exit_browser(bool wait_for_ok)
-{
-	if (use_browser > 0) {
-		if (wait_for_ok) {
-			char title[] = "Fatal Error", ok[] = "Ok";
-			newtWinMessage(title, ok, browser__last_msg);
-		}
-		newtFinished();
-	}
-}
-
-static void hist_browser__refresh_dimensions(struct hist_browser *self)
-{
-	/* 3 == +/- toggle symbol before actual hist_entry rendering */
-	self->b.width = 3 + (hists__sort_list_width(self->hists) +
-			     sizeof("[k]"));
-}
-
-static void hist_browser__reset(struct hist_browser *self)
-{
-	self->b.nr_entries = self->hists->nr_entries;
-	hist_browser__refresh_dimensions(self);
-	ui_browser__reset_index(&self->b);
-}
-
-static char tree__folded_sign(bool unfolded)
-{
-	return unfolded ? '-' : '+';
-}
-
-static char map_symbol__folded(const struct map_symbol *self)
-{
-	return self->has_children ? tree__folded_sign(self->unfolded) : ' ';
-}
-
-static char hist_entry__folded(const struct hist_entry *self)
-{
-	return map_symbol__folded(&self->ms);
-}
-
-static char callchain_list__folded(const struct callchain_list *self)
-{
-	return map_symbol__folded(&self->ms);
-}
-
-static bool map_symbol__toggle_fold(struct map_symbol *self)
+static char *callchain_list__sym_name(struct callchain_list *self,
+				      char *bf, size_t bfsize)
 {
-	if (!self->has_children)
-		return false;
+	if (self->ms.sym)
+		return self->ms.sym->name;
 
-	self->unfolded = !self->unfolded;
-	return true;
+	snprintf(bf, bfsize, "%#Lx", self->ip);
+	return bf;
 }
 
 #define LEVEL_OFFSET_STEP 3
@@ -781,58 +531,7 @@ static unsigned int hist_browser__refresh(struct ui_browser *self)
 	return row;
 }
 
-static void callchain_node__init_have_children_rb_tree(struct callchain_node *self)
-{
-	struct rb_node *nd = rb_first(&self->rb_root);
-
-	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
-		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
-		struct callchain_list *chain;
-		int first = true;
-
-		list_for_each_entry(chain, &child->val, list) {
-			if (first) {
-				first = false;
-				chain->ms.has_children = chain->list.next != &child->val ||
-							 rb_first(&child->rb_root) != NULL;
-			} else
-				chain->ms.has_children = chain->list.next == &child->val &&
-							 rb_first(&child->rb_root) != NULL;
-		}
-
-		callchain_node__init_have_children_rb_tree(child);
-	}
-}
-
-static void callchain_node__init_have_children(struct callchain_node *self)
-{
-	struct callchain_list *chain;
-
-	list_for_each_entry(chain, &self->val, list)
-		chain->ms.has_children = rb_first(&self->rb_root) != NULL;
-
-	callchain_node__init_have_children_rb_tree(self);
-}
-
-static void callchain__init_have_children(struct rb_root *self)
-{
-	struct rb_node *nd;
-
-	for (nd = rb_first(self); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-		callchain_node__init_have_children(node);
-	}
-}
-
-static void hist_entry__init_have_children(struct hist_entry *self)
-{
-	if (!self->init_have_children) {
-		callchain__init_have_children(&self->sorted_chain);
-		self->init_have_children = true;
-	}
-}
-
-static struct rb_node *hists__filter_entries(struct rb_node *nd)
+static struct rb_node *hists__filter_entries(struct rb_node *nd)
 {
 	while (nd != NULL) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
@@ -974,140 +673,278 @@ do_offset:
 	}
 }
 
-static int callchain_node__count_rows_rb_tree(struct callchain_node *self)
+static struct hist_browser *hist_browser__new(struct hists *hists)
 {
-	int n = 0;
-	struct rb_node *nd;
-
-	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
-		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
-		struct callchain_list *chain;
-		char folded_sign = ' '; /* No children */
-
-		list_for_each_entry(chain, &child->val, list) {
-			++n;
-			/* We need this because we may not have children */
-			folded_sign = callchain_list__folded(chain);
-			if (folded_sign == '+')
-				break;
-		}
+	struct hist_browser *self = zalloc(sizeof(*self));
 
-		if (folded_sign == '-') /* Have children and they're unfolded */
-			n += callchain_node__count_rows_rb_tree(child);
+	if (self) {
+		self->hists = hists;
+		self->b.refresh = hist_browser__refresh;
+		self->b.seek = ui_browser__hists_seek;
 	}
 
-	return n;
+	return self;
 }
 
-static int callchain_node__count_rows(struct callchain_node *node)
+static void hist_browser__delete(struct hist_browser *self)
 {
-	struct callchain_list *chain;
-	bool unfolded = false;
-	int n = 0;
-
-	list_for_each_entry(chain, &node->val, list) {
-		++n;
-		unfolded = chain->ms.unfolded;
-	}
-
-	if (unfolded)
-		n += callchain_node__count_rows_rb_tree(node);
+	newtFormDestroy(self->b.form);
+	newtPopWindow();
+	free(self);
+}
 
-	return n;
+static struct hist_entry *hist_browser__selected_entry(struct hist_browser *self)
+{
+	return self->he_selection;
 }
 
-static int callchain__count_rows(struct rb_root *chain)
+static struct thread *hist_browser__selected_thread(struct hist_browser *self)
 {
-	struct rb_node *nd;
-	int n = 0;
+	return self->he_selection->thread;
+}
 
-	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-		n += callchain_node__count_rows(node);
-	}
+static int hist_browser__title(char *bf, size_t size, const char *ev_name,
+			       const struct dso *dso, const struct thread *thread)
+{
+	int printed = 0;
 
-	return n;
+	if (thread)
+		printed += snprintf(bf + printed, size - printed,
+				    "Thread: %s(%d)",
+				    (thread->comm_set ?  thread->comm : ""),
+				    thread->pid);
+	if (dso)
+		printed += snprintf(bf + printed, size - printed,
+				    "%sDSO: %s", thread ? " " : "",
+				    dso->short_name);
+	return printed ?: snprintf(bf, size, "Event: %s", ev_name);
 }
 
-static bool hist_browser__toggle_fold(struct hist_browser *self)
+int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 {
-	if (map_symbol__toggle_fold(self->selection)) {
-		struct hist_entry *he = self->he_selection;
+	struct hist_browser *browser = hist_browser__new(self);
+	struct pstack *fstack;
+	const struct thread *thread_filter = NULL;
+	const struct dso *dso_filter = NULL;
+	struct newtExitStruct es;
+	char msg[160];
+	int key = -1;
 
-		hist_entry__init_have_children(he);
-		self->hists->nr_entries -= he->nr_rows;
+	if (browser == NULL)
+		return -1;
 
-		if (he->ms.unfolded)
-			he->nr_rows = callchain__count_rows(&he->sorted_chain);
-		else
-			he->nr_rows = 0;
-		self->hists->nr_entries += he->nr_rows;
-		self->b.nr_entries = self->hists->nr_entries;
+	fstack = pstack__new(2);
+	if (fstack == NULL)
+		goto out;
 
-		return true;
-	}
+	ui_helpline__push(helpline);
 
-	/* If it doesn't have children, no toggling performed */
-	return false;
-}
+	hist_browser__title(msg, sizeof(msg), ev_name,
+			    dso_filter, thread_filter);
 
-static int hist_browser__run(struct hist_browser *self, const char *title,
-			     struct newtExitStruct *es)
-{
-	char str[256], unit;
-	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
+	while (1) {
+		const struct thread *thread;
+		const struct dso *dso;
+		char *options[16];
+		int nr_options = 0, choice = 0, i,
+		    annotate = -2, zoom_dso = -2, zoom_thread = -2,
+		    browse_map = -2;
 
-	self->b.entries = &self->hists->entries;
-	self->b.nr_entries = self->hists->nr_entries;
+		if (hist_browser__run(browser, msg, &es))
+			break;
 
-	hist_browser__refresh_dimensions(self);
+		thread = hist_browser__selected_thread(browser);
+		dso = browser->selection->map ? browser->selection->map->dso : NULL;
 
-	nr_events = convert_unit(nr_events, &unit);
-	snprintf(str, sizeof(str), "Events: %lu%c                            ",
-		 nr_events, unit);
-	newtDrawRootText(0, 0, str);
+		if (es.reason == NEWT_EXIT_HOTKEY) {
+			key = es.u.key;
 
-	if (ui_browser__show(&self->b, title) < 0)
-		return -1;
+			switch (key) {
+			case NEWT_KEY_F1:
+				goto do_help;
+			case NEWT_KEY_TAB:
+			case NEWT_KEY_UNTAB:
+				/*
+				 * Exit the browser, let hists__browser_tree
+				 * go to the next or previous
+				 */
+				goto out_free_stack;
+			default:;
+			}
 
-	newtFormAddHotKey(self->b.form, 'A');
-	newtFormAddHotKey(self->b.form, 'a');
-	newtFormAddHotKey(self->b.form, '?');
-	newtFormAddHotKey(self->b.form, 'h');
-	newtFormAddHotKey(self->b.form, 'H');
-	newtFormAddHotKey(self->b.form, 'd');
+			key = toupper(key);
+			switch (key) {
+			case 'A':
+				if (browser->selection->map == NULL &&
+				    browser->selection->map->dso->annotate_warned)
+					continue;
+				goto do_annotate;
+			case 'D':
+				goto zoom_dso;
+			case 'T':
+				goto zoom_thread;
+			case 'H':
+			case '?':
+do_help:
+				ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
+						"<-        Zoom out\n"
+						"a         Annotate current symbol\n"
+						"h/?/F1    Show this window\n"
+						"d         Zoom into current DSO\n"
+						"t         Zoom into current Thread\n"
+						"q/CTRL+C  Exit browser");
+				continue;
+			default:;
+			}
+			if (is_exit_key(key)) {
+				if (key == NEWT_KEY_ESCAPE &&
+				    !dialog_yesno("Do you really want to exit?"))
+					continue;
+				break;
+			}
 
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+			if (es.u.key == NEWT_KEY_LEFT) {
+				const void *top;
 
-	while (1) {
-		ui_browser__run(&self->b, es);
+				if (pstack__empty(fstack))
+					continue;
+				top = pstack__pop(fstack);
+				if (top == &dso_filter)
+					goto zoom_out_dso;
+				if (top == &thread_filter)
+					goto zoom_out_thread;
+				continue;
+			}
+		}
 
-		if (es->reason != NEWT_EXIT_HOTKEY)
+		if (browser->selection->sym != NULL &&
+		    !browser->selection->map->dso->annotate_warned &&
+		    asprintf(&options[nr_options], "Annotate %s",
+			     browser->selection->sym->name) > 0)
+			annotate = nr_options++;
+
+		if (thread != NULL &&
+		    asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
+			     (thread_filter ? "out of" : "into"),
+			     (thread->comm_set ? thread->comm : ""),
+			     thread->pid) > 0)
+			zoom_thread = nr_options++;
+
+		if (dso != NULL &&
+		    asprintf(&options[nr_options], "Zoom %s %s DSO",
+			     (dso_filter ? "out of" : "into"),
+			     (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
+			zoom_dso = nr_options++;
+
+		if (browser->selection->map != NULL &&
+		    asprintf(&options[nr_options], "Browse map details") > 0)
+			browse_map = nr_options++;
+
+		options[nr_options++] = (char *)"Exit";
+
+		choice = popup_menu(nr_options, options);
+
+		for (i = 0; i < nr_options - 1; ++i)
+			free(options[i]);
+
+		if (choice == nr_options - 1)
 			break;
-		switch (es->u.key) {
-		case 'd': { /* Debug */
-			static int seq;
-			struct hist_entry *h = rb_entry(self->b.top,
-							struct hist_entry, rb_node);
-			ui_helpline__pop();
-			ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
-					   seq++, self->b.nr_entries,
-					   self->hists->nr_entries,
-					   self->b.height,
-					   self->b.index,
-					   self->b.top_idx,
-					   h->row_offset, h->nr_rows);
-		}
+
+		if (choice == -1)
 			continue;
-		case NEWT_KEY_ENTER:
-			if (hist_browser__toggle_fold(self))
-				break;
-			/* fall thru */
+
+		if (choice == annotate) {
+			struct hist_entry *he;
+do_annotate:
+			if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
+				browser->selection->map->dso->annotate_warned = 1;
+				ui_helpline__puts("No vmlinux file found, can't "
+						 "annotate with just a "
+						 "kallsyms file");
+				continue;
+			}
+
+			he = hist_browser__selected_entry(browser);
+			if (he == NULL)
+				continue;
+
+			hist_entry__tui_annotate(he);
+		} else if (choice == browse_map)
+			map__browse(browser->selection->map);
+		else if (choice == zoom_dso) {
+zoom_dso:
+			if (dso_filter) {
+				pstack__remove(fstack, &dso_filter);
+zoom_out_dso:
+				ui_helpline__pop();
+				dso_filter = NULL;
+			} else {
+				if (dso == NULL)
+					continue;
+				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s DSO\"",
+						   dso->kernel ? "the Kernel" : dso->short_name);
+				dso_filter = dso;
+				pstack__push(fstack, &dso_filter);
+			}
+			hists__filter_by_dso(self, dso_filter);
+			hist_browser__title(msg, sizeof(msg), ev_name,
+					    dso_filter, thread_filter);
+			hist_browser__reset(browser);
+		} else if (choice == zoom_thread) {
+zoom_thread:
+			if (thread_filter) {
+				pstack__remove(fstack, &thread_filter);
+zoom_out_thread:
+				ui_helpline__pop();
+				thread_filter = NULL;
+			} else {
+				ui_helpline__fpush("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"",
+						   thread->comm_set ? thread->comm : "",
+						   thread->pid);
+				thread_filter = thread;
+				pstack__push(fstack, &thread_filter);
+			}
+			hists__filter_by_thread(self, thread_filter);
+			hist_browser__title(msg, sizeof(msg), ev_name,
+					    dso_filter, thread_filter);
+			hist_browser__reset(browser);
+		}
+	}
+out_free_stack:
+	pstack__delete(fstack);
+out:
+	hist_browser__delete(browser);
+	return key;
+}
+
+int hists__tui_browse_tree(struct rb_root *self, const char *help)
+{
+	struct rb_node *first = rb_first(self), *nd = first, *next;
+	int key = 0;
+
+	while (nd) {
+		struct hists *hists = rb_entry(nd, struct hists, rb_node);
+		const char *ev_name = __event_name(hists->type, hists->config);
+
+		key = hists__browse(hists, help, ev_name);
+
+		if (is_exit_key(key))
+			break;
+
+		switch (key) {
+		case NEWT_KEY_TAB:
+			next = rb_next(nd);
+			if (next)
+				nd = next;
+			break;
+		case NEWT_KEY_UNTAB:
+			if (nd == first)
+				continue;
+			nd = rb_prev(nd);
 		default:
-			return 0;
+			break;
 		}
 	}
-	return 0;
+
+	return key;
 }

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

* [tip:perf/core] perf ui: Complete the breakdown of util/newt.c
       [not found]             ` <new-submission>
                                 ` (587 preceding siblings ...)
  2010-08-11  7:41               ` [tip:perf/core] perf ui: Move hists " tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:42               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:42               ` [tip:perf/core] perf annotate: Sort by hottest lines in the TUI tip-bot for Arnaldo Carvalho de Melo
                                 ` (117 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  1e6dd077a880ba5570beb690523b7a78a91a7615
Gitweb:     http://git.kernel.org/tip/1e6dd077a880ba5570beb690523b7a78a91a7615
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:58:50 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:11:38 -0300

perf ui: Complete the breakdown of util/newt.c

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                    |    7 +--
 tools/perf/util/debug.c                |    2 +-
 tools/perf/util/debug.h                |    6 +-
 tools/perf/util/ui/browsers/annotate.c |    2 +-
 tools/perf/util/ui/browsers/hists.c    |    8 +---
 tools/perf/util/ui/helpline.c          |   26 ++++++++++++
 tools/perf/util/ui/helpline.h          |    1 +
 tools/perf/util/ui/setup.c             |   42 +++++++++++++++++++
 tools/perf/util/{newt.c => ui/util.c}  |   70 +++----------------------------
 tools/perf/util/ui/util.h              |   10 +++++
 10 files changed, 96 insertions(+), 78 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 62e4d6f..41abb90 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -567,18 +567,20 @@ else
 		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
 		BASIC_CFLAGS += -I/usr/include/slang
 		EXTLIBS += -lnewt -lslang
-		LIB_OBJS += $(OUTPUT)util/newt.o
+		LIB_OBJS += $(OUTPUT)util/ui/setup.o
 		LIB_OBJS += $(OUTPUT)util/ui/browser.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/hists.o
 		LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o
 		LIB_OBJS += $(OUTPUT)util/ui/helpline.o
 		LIB_OBJS += $(OUTPUT)util/ui/progress.o
+		LIB_OBJS += $(OUTPUT)util/ui/util.o
 		LIB_H += util/ui/browser.h
 		LIB_H += util/ui/browsers/map.h
 		LIB_H += util/ui/helpline.h
 		LIB_H += util/ui/libslang.h
 		LIB_H += util/ui/progress.h
+		LIB_H += util/ui/util.h
 	endif
 endif
 
@@ -976,9 +978,6 @@ $(OUTPUT)builtin-init-db.o: builtin-init-db.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
-$(OUTPUT)util/newt.o: util/newt.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
 $(OUTPUT)util/ui/browser.o: util/ui/browser.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 318dab1..f9c7e3a 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -23,7 +23,7 @@ int eprintf(int level, const char *fmt, ...)
 	if (verbose >= level) {
 		va_start(args, fmt);
 		if (use_browser > 0)
-			ret = browser__show_help(fmt, args);
+			ret = ui_helpline__show_help(fmt, args);
 		else
 			ret = vfprintf(stderr, fmt, args);
 		va_end(args);
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index ba4892e..7a17ee0 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -14,7 +14,7 @@ void trace_event(event_t *event);
 struct ui_progress;
 
 #ifdef NO_NEWT_SUPPORT
-static inline int browser__show_help(const char *format __used, va_list ap __used)
+static inline int ui_helpline__show_help(const char *format __used, va_list ap __used)
 {
 	return 0;
 }
@@ -30,8 +30,8 @@ static inline void ui_progress__update(struct ui_progress *self __used,
 
 static inline void ui_progress__delete(struct ui_progress *self __used) {}
 #else
-extern char browser__last_msg[];
-int browser__show_help(const char *format, va_list ap);
+extern char ui_helpline__last_msg[];
+int ui_helpline__show_help(const char *format, va_list ap);
 #include "ui/progress.h"
 #endif
 
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 783d277..5b01df6 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -86,7 +86,7 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 		return -1;
 
 	if (hist_entry__annotate(self, &head) < 0) {
-		ui__error_window(browser__last_msg);
+		ui__error_window(ui_helpline__last_msg);
 		return -1;
 	}
 
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 9d32a41..cee7998 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -17,10 +17,6 @@
 #include "../util.h"
 #include "map.h"
 
-int ui__help_window(const char *text);
-bool dialog_yesno(const char *msg);
-int popup_menu(int argc, char * const argv[]);
-
 struct hist_browser {
 	struct ui_browser   b;
 	struct hists	    *hists;
@@ -798,7 +794,7 @@ do_help:
 			}
 			if (is_exit_key(key)) {
 				if (key == NEWT_KEY_ESCAPE &&
-				    !dialog_yesno("Do you really want to exit?"))
+				    !ui__dialog_yesno("Do you really want to exit?"))
 					continue;
 				break;
 			}
@@ -842,7 +838,7 @@ do_help:
 
 		options[nr_options++] = (char *)"Exit";
 
-		choice = popup_menu(nr_options, options);
+		choice = ui__popup_menu(nr_options, options);
 
 		for (i = 0; i < nr_options - 1; ++i)
 			free(options[i]);
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c
index 6a11e13..ff58460 100644
--- a/tools/perf/util/ui/helpline.c
+++ b/tools/perf/util/ui/helpline.c
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <newt.h>
 
+#include "../debug.h"
 #include "helpline.h"
 
 void ui_helpline__pop(void)
@@ -41,3 +42,28 @@ void ui_helpline__puts(const char *msg)
 	ui_helpline__pop();
 	ui_helpline__push(msg);
 }
+
+void ui_helpline__init(void)
+{
+	ui_helpline__puts(" ");
+}
+
+char ui_helpline__last_msg[1024];
+
+int ui_helpline__show_help(const char *format, va_list ap)
+{
+	int ret;
+	static int backlog;
+
+        ret = vsnprintf(ui_helpline__last_msg + backlog,
+			sizeof(ui_helpline__last_msg) - backlog, format, ap);
+	backlog += ret;
+
+	if (ui_helpline__last_msg[backlog - 1] == '\n') {
+		ui_helpline__puts(ui_helpline__last_msg);
+		newtRefresh();
+		backlog = 0;
+	}
+
+	return ret;
+}
diff --git a/tools/perf/util/ui/helpline.h b/tools/perf/util/ui/helpline.h
index 56d8c1d..5d1e5e7 100644
--- a/tools/perf/util/ui/helpline.h
+++ b/tools/perf/util/ui/helpline.h
@@ -1,6 +1,7 @@
 #ifndef _PERF_UI_HELPLINE_H_
 #define _PERF_UI_HELPLINE_H_ 1
 
+void ui_helpline__init(void);
 void ui_helpline__pop(void);
 void ui_helpline__push(const char *msg);
 void ui_helpline__fpush(const char *fmt, ...);
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/util/ui/setup.c
new file mode 100644
index 0000000..6620850
--- /dev/null
+++ b/tools/perf/util/ui/setup.c
@@ -0,0 +1,42 @@
+#include <newt.h>
+#include <signal.h>
+#include <stdbool.h>
+
+#include "../cache.h"
+#include "../debug.h"
+#include "browser.h"
+#include "helpline.h"
+
+static void newt_suspend(void *d __used)
+{
+	newtSuspend();
+	raise(SIGTSTP);
+	newtResume();
+}
+
+void setup_browser(void)
+{
+	if (!isatty(1) || !use_browser || dump_trace) {
+		use_browser = 0;
+		setup_pager();
+		return;
+	}
+
+	use_browser = 1;
+	newtInit();
+	newtCls();
+	newtSetSuspendCallback(newt_suspend, NULL);
+	ui_helpline__init();
+	ui_browser__init();
+}
+
+void exit_browser(bool wait_for_ok)
+{
+	if (use_browser > 0) {
+		if (wait_for_ok) {
+			char title[] = "Fatal Error", ok[] = "Ok";
+			newtWinMessage(title, ok, ui_helpline__last_msg);
+		}
+		newtFinished();
+	}
+}
diff --git a/tools/perf/util/newt.c b/tools/perf/util/ui/util.c
similarity index 63%
rename from tools/perf/util/newt.c
rename to tools/perf/util/ui/util.c
index 6bccdaa..04600e2 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/ui/util.c
@@ -5,35 +5,13 @@
 #include <string.h>
 #include <sys/ttydefaults.h>
 
-#include "cache.h"
-#include "debug.h"
-#include "ui/browser.h"
-#include "ui/helpline.h"
+#include "../cache.h"
+#include "../debug.h"
+#include "browser.h"
+#include "helpline.h"
+#include "util.h"
 
 newtComponent newt_form__new(void);
-int popup_menu(int argc, char * const argv[]);
-int ui__help_window(const char *text);
-bool dialog_yesno(const char *msg);
-
-char browser__last_msg[1024];
-
-int browser__show_help(const char *format, va_list ap)
-{
-	int ret;
-	static int backlog;
-
-        ret = vsnprintf(browser__last_msg + backlog,
-			sizeof(browser__last_msg) - backlog, format, ap);
-	backlog += ret;
-
-	if (browser__last_msg[backlog - 1] == '\n') {
-		ui_helpline__puts(browser__last_msg);
-		newtRefresh();
-		backlog = 0;
-	}
-
-	return ret;
-}
 
 static void newt_form__set_exit_keys(newtComponent self)
 {
@@ -52,7 +30,7 @@ newtComponent newt_form__new(void)
 	return self;
 }
 
-int popup_menu(int argc, char * const argv[])
+int ui__popup_menu(int argc, char * const argv[])
 {
 	struct newtExitStruct es;
 	int i, rc = -1, max_len = 5;
@@ -128,43 +106,9 @@ out_destroy_form:
 	return rc;
 }
 
-bool dialog_yesno(const char *msg)
+bool ui__dialog_yesno(const char *msg)
 {
 	/* newtWinChoice should really be accepting const char pointers... */
 	char yes[] = "Yes", no[] = "No";
 	return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
 }
-
-static void newt_suspend(void *d __used)
-{
-	newtSuspend();
-	raise(SIGTSTP);
-	newtResume();
-}
-
-void setup_browser(void)
-{
-	if (!isatty(1) || !use_browser || dump_trace) {
-		use_browser = 0;
-		setup_pager();
-		return;
-	}
-
-	use_browser = 1;
-	newtInit();
-	newtCls();
-	newtSetSuspendCallback(newt_suspend, NULL);
-	ui_helpline__puts(" ");
-	ui_browser__init();
-}
-
-void exit_browser(bool wait_for_ok)
-{
-	if (use_browser > 0) {
-		if (wait_for_ok) {
-			char title[] = "Fatal Error", ok[] = "Ok";
-			newtWinMessage(title, ok, browser__last_msg);
-		}
-		newtFinished();
-	}
-}
diff --git a/tools/perf/util/ui/util.h b/tools/perf/util/ui/util.h
new file mode 100644
index 0000000..afcbc1d
--- /dev/null
+++ b/tools/perf/util/ui/util.h
@@ -0,0 +1,10 @@
+#ifndef _PERF_UI_UTIL_H_
+#define _PERF_UI_UTIL_H_ 1
+
+#include <stdbool.h>
+
+int ui__popup_menu(int argc, char * const argv[]);
+int ui__help_window(const char *text);
+bool ui__dialog_yesno(const char *msg);
+
+#endif /* _PERF_UI_UTIL_H_ */

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

* [tip:perf/core] perf annotate: Sort by hottest lines in the TUI
       [not found]             ` <new-submission>
                                 ` (588 preceding siblings ...)
  2010-08-11  7:42               ` [tip:perf/core] perf ui: Complete the breakdown of util/newt.c tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:42               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:42               ` [tip:perf/core] perf ui: Make SPACE work as PGDN in all browsers tip-bot for Arnaldo Carvalho de Melo
                                 ` (116 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  92221162875ec48913d3f9710046e48d599c9cf2
Gitweb:     http://git.kernel.org/tip/92221162875ec48913d3f9710046e48d599c9cf2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 9 Aug 2010 15:30:40 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:11:42 -0300

perf annotate: Sort by hottest lines in the TUI

Right now it will just sort and position at the hottest line, i.e.
the one where more samples were taken.

It will be at the center of the screen and later TAB/shift-TAB will
cycle thru the hottest lines.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c          |    2 +-
 tools/perf/util/hist.c                 |   13 ++--
 tools/perf/util/hist.h                 |    3 +-
 tools/perf/util/ui/browsers/annotate.c |  153 ++++++++++++++++++++++++--------
 4 files changed, 125 insertions(+), 46 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index fd20670..1478dc6 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -285,7 +285,7 @@ static int hist_entry__tty_annotate(struct hist_entry *he)
 	LIST_HEAD(head);
 	struct objdump_line *pos, *n;
 
-	if (hist_entry__annotate(he, &head) < 0)
+	if (hist_entry__annotate(he, &head, 0) < 0)
 		return -1;
 
 	if (full_paths)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 62ec9b0..be22ae6 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -983,9 +983,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip)
 	return 0;
 }
 
-static struct objdump_line *objdump_line__new(s64 offset, char *line)
+static struct objdump_line *objdump_line__new(s64 offset, char *line, size_t privsize)
 {
-	struct objdump_line *self = malloc(sizeof(*self));
+	struct objdump_line *self = malloc(sizeof(*self) + privsize);
 
 	if (self != NULL) {
 		self->offset = offset;
@@ -1017,7 +1017,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
 }
 
 static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
-					  struct list_head *head)
+					  struct list_head *head, size_t privsize)
 {
 	struct symbol *sym = self->ms.sym;
 	struct objdump_line *objdump_line;
@@ -1068,7 +1068,7 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
 			offset = -1;
 	}
 
-	objdump_line = objdump_line__new(offset, line);
+	objdump_line = objdump_line__new(offset, line, privsize);
 	if (objdump_line == NULL) {
 		free(line);
 		return -1;
@@ -1078,7 +1078,8 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
 	return 0;
 }
 
-int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
+int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
+			 size_t privsize)
 {
 	struct symbol *sym = self->ms.sym;
 	struct map *map = self->ms.map;
@@ -1143,7 +1144,7 @@ fallback:
 		goto out_free_filename;
 
 	while (!feof(file))
-		if (hist_entry__parse_objdump_line(self, file, head) < 0)
+		if (hist_entry__parse_objdump_line(self, file, head, privsize) < 0)
 			break;
 
 	pclose(file);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 65a48db..587d375 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -101,7 +101,8 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 		      bool show_displacement, FILE *fp);
 
 int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip);
-int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
+int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
+			 size_t privsize);
 
 void hists__filter_by_dso(struct hists *self, const struct dso *dso);
 void hists__filter_by_thread(struct hists *self, const struct thread *thread);
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 5b01df6..763592b 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -14,6 +14,23 @@ static void ui__error_window(const char *fmt, ...)
 	va_end(ap);
 }
 
+struct annotate_browser {
+	struct ui_browser b;
+	struct rb_root	  entries;
+};
+
+struct objdump_line_rb_node {
+	struct rb_node	rb_node;
+	double		percent;
+	u32		idx;
+};
+
+static inline
+struct objdump_line_rb_node *objdump_line__rb(struct objdump_line *self)
+{
+	return (struct objdump_line_rb_node *)(self + 1);
+}
+
 static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
 {
 	struct objdump_line *ol = rb_entry(entry, struct objdump_line, node);
@@ -21,17 +38,41 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 	int width = self->width;
 
 	if (ol->offset != -1) {
-		struct hist_entry *he = self->priv;
-		struct symbol *sym = he->ms.sym;
-		int len = he->ms.sym->end - he->ms.sym->start;
+		struct objdump_line_rb_node *olrb = objdump_line__rb(ol);
+		int color = ui_browser__percent_color(olrb->percent, current_entry);
+		SLsmg_set_color(color);
+		slsmg_printf(" %7.2f ", olrb->percent);
+		if (!current_entry)
+			SLsmg_set_color(HE_COLORSET_CODE);
+	} else {
+		int color = ui_browser__percent_color(0, current_entry);
+		SLsmg_set_color(color);
+		slsmg_write_nstring(" ", 9);
+	}
+
+	SLsmg_write_char(':');
+	slsmg_write_nstring(" ", 8);
+	if (!*ol->line)
+		slsmg_write_nstring(" ", width - 18);
+	else
+		slsmg_write_nstring(ol->line, width - 18);
+}
+
+static double objdump_line__calc_percent(struct objdump_line *self,
+					 struct list_head *head,
+					 struct symbol *sym)
+{
+	double percent = 0.0;
+
+	if (self->offset != -1) {
+		int len = sym->end - sym->start;
 		unsigned int hits = 0;
-		double percent = 0.0;
-		int color;
 		struct sym_priv *priv = symbol__priv(sym);
 		struct sym_ext *sym_ext = priv->ext;
 		struct sym_hist *h = priv->hist;
-		s64 offset = ol->offset;
-		struct objdump_line *next = objdump__get_next_ip_line(self->entries, ol);
+		s64 offset = self->offset;
+		struct objdump_line *next = objdump__get_next_ip_line(head, self);
+
 
 		while (offset < (s64)len &&
 		       (next == NULL || offset < next->offset)) {
@@ -45,37 +86,45 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 
 		if (sym_ext == NULL && h->sum)
 			percent = 100.0 * hits / h->sum;
-
-		color = ui_browser__percent_color(percent, current_entry);
-		SLsmg_set_color(color);
-		slsmg_printf(" %7.2f ", percent);
-		if (!current_entry)
-			SLsmg_set_color(HE_COLORSET_CODE);
-	} else {
-		int color = ui_browser__percent_color(0, current_entry);
-		SLsmg_set_color(color);
-		slsmg_write_nstring(" ", 9);
 	}
 
-	SLsmg_write_char(':');
-	slsmg_write_nstring(" ", 8);
-	if (!*ol->line)
-		slsmg_write_nstring(" ", width - 18);
-	else
-		slsmg_write_nstring(ol->line, width - 18);
+	return percent;
+}
+
+static void objdump__insert_line(struct rb_root *self,
+				 struct objdump_line_rb_node *line)
+{
+	struct rb_node **p = &self->rb_node;
+	struct rb_node *parent = NULL;
+	struct objdump_line_rb_node *l;
+
+	while (*p != NULL) {
+		parent = *p;
+		l = rb_entry(parent, struct objdump_line_rb_node, rb_node);
+		if (line->percent < l->percent)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+	rb_link_node(&line->rb_node, parent, p);
+	rb_insert_color(&line->rb_node, self);
 }
 
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
 	struct newtExitStruct es;
 	struct objdump_line *pos, *n;
+	struct objdump_line_rb_node *rbpos;
+	struct rb_node *nd;
 	LIST_HEAD(head);
-	struct ui_browser browser = {
-		.entries = &head,
-		.refresh = ui_browser__list_head_refresh,
-		.seek	 = ui_browser__list_head_seek,
-		.write	 = annotate_browser__write,
-		.priv	 = self,
+	struct annotate_browser browser = {
+		.b = {
+			.entries = &head,
+			.refresh = ui_browser__list_head_refresh,
+			.seek	 = ui_browser__list_head_seek,
+			.write	 = annotate_browser__write,
+			.priv	 = self,
+		},
 	};
 	int ret;
 
@@ -85,7 +134,7 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 	if (self->ms.map->dso->annotate_warned)
 		return -1;
 
-	if (hist_entry__annotate(self, &head) < 0) {
+	if (hist_entry__annotate(self, &head, sizeof(*rbpos)) < 0) {
 		ui__error_window(ui_helpline__last_msg);
 		return -1;
 	}
@@ -94,16 +143,44 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 
 	list_for_each_entry(pos, &head, node) {
 		size_t line_len = strlen(pos->line);
-		if (browser.width < line_len)
-			browser.width = line_len;
-		++browser.nr_entries;
+		if (browser.b.width < line_len)
+			browser.b.width = line_len;
+		rbpos = objdump_line__rb(pos);
+		rbpos->idx = browser.b.nr_entries++;
+		rbpos->percent = objdump_line__calc_percent(pos, &head, self->ms.sym);
+		if (rbpos->percent < 0.01)
+			continue;
+		objdump__insert_line(&browser.entries, rbpos);
+	}
+
+	/*
+	 * Position the browser at the hottest line.
+	 */
+	nd = rb_last(&browser.entries);
+	if (nd != NULL) {
+		unsigned back;
+
+		ui_browser__refresh_dimensions(&browser.b);
+		back = browser.b.height / 2;
+		rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node);
+		pos = ((struct objdump_line *)rbpos) - 1;
+		browser.b.top_idx = browser.b.index = rbpos->idx;
+
+		while (browser.b.top_idx != 0 && back != 0) {
+			pos = list_entry(pos->node.prev, struct objdump_line, node);
+
+			--browser.b.top_idx;
+			--back;
+		}
+
+		browser.b.top = pos;
 	}
 
-	browser.width += 18; /* Percentage */
-	ui_browser__show(&browser, self->ms.sym->name);
-	newtFormAddHotKey(browser.form, ' ');
-	ret = ui_browser__run(&browser, &es);
-	newtFormDestroy(browser.form);
+	browser.b.width += 18; /* Percentage */
+	ui_browser__show(&browser.b, self->ms.sym->name);
+	newtFormAddHotKey(browser.b.form, ' ');
+	ret = ui_browser__run(&browser.b, &es);
+	newtFormDestroy(browser.b.form);
 	newtPopWindow();
 	list_for_each_entry_safe(pos, n, &head, node) {
 		list_del(&pos->node);

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

* [tip:perf/core] perf ui: Make SPACE work as PGDN in all browsers
       [not found]             ` <new-submission>
                                 ` (589 preceding siblings ...)
  2010-08-11  7:42               ` [tip:perf/core] perf annotate: Sort by hottest lines in the TUI tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:42               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:43               ` [tip:perf/core] perf annotate: Cycle thru sorted lines with samples tip-bot for Arnaldo Carvalho de Melo
                                 ` (115 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  9e22d6377ce6f31b1cc0bff16daeda2780495061
Gitweb:     http://git.kernel.org/tip/9e22d6377ce6f31b1cc0bff16daeda2780495061
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:09:02 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 15:09:02 -0300

perf ui: Make SPACE work as PGDN in all browsers

Not just on the annotate one.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browser.c           |    1 +
 tools/perf/util/ui/browsers/annotate.c |    1 -
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index edbb7dd..83d5748 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -169,6 +169,7 @@ int ui_browser__show(struct ui_browser *self, const char *title)
 	newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
 	newtFormAddHotKey(self->form, NEWT_KEY_HOME);
 	newtFormAddHotKey(self->form, NEWT_KEY_END);
+	newtFormAddHotKey(self->form, ' ');
 	newtFormAddComponent(self->form, self->sb);
 	return 0;
 }
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 763592b..d2156ae 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -178,7 +178,6 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 
 	browser.b.width += 18; /* Percentage */
 	ui_browser__show(&browser.b, self->ms.sym->name);
-	newtFormAddHotKey(browser.b.form, ' ');
 	ret = ui_browser__run(&browser.b, &es);
 	newtFormDestroy(browser.b.form);
 	newtPopWindow();

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

* [tip:perf/core] perf annotate: Cycle thru sorted lines with samples
       [not found]             ` <new-submission>
                                 ` (590 preceding siblings ...)
  2010-08-11  7:42               ` [tip:perf/core] perf ui: Make SPACE work as PGDN in all browsers tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:43               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:43               ` [tip:perf/core] perf ui browser: Add ui_browser__show counterpart: __hide tip-bot for Arnaldo Carvalho de Melo
                                 ` (114 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  f1e9214cc99644101d957c5c660946c6f2f86d7c
Gitweb:     http://git.kernel.org/tip/f1e9214cc99644101d957c5c660946c6f2f86d7c
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:14:53 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 15:14:53 -0300

perf annotate: Cycle thru sorted lines with samples

The annotate TUI now starts centered on the line with most samples, i.e.
the hottest line in the annotated function. Pressing TAB will center on
the second hottest function and so on. Shift+TAB goes in the other
direction.

This way one can more easily sift thru the function hotspots.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |  102 ++++++++++++++++++++++++--------
 1 files changed, 77 insertions(+), 25 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index d2156ae..73e78ef 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -17,6 +17,7 @@ static void ui__error_window(const char *fmt, ...)
 struct annotate_browser {
 	struct ui_browser b;
 	struct rb_root	  entries;
+	struct rb_node	  *curr_hot;
 };
 
 struct objdump_line_rb_node {
@@ -110,12 +111,83 @@ static void objdump__insert_line(struct rb_root *self,
 	rb_insert_color(&line->rb_node, self);
 }
 
+static void annotate_browser__set_top(struct annotate_browser *self,
+				      struct rb_node *nd)
+{
+	struct objdump_line_rb_node *rbpos;
+	struct objdump_line *pos;
+	unsigned back;
+
+	ui_browser__refresh_dimensions(&self->b);
+	back = self->b.height / 2;
+	rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node);
+	pos = ((struct objdump_line *)rbpos) - 1;
+	self->b.top_idx = self->b.index = rbpos->idx;
+
+	while (self->b.top_idx != 0 && back != 0) {
+		pos = list_entry(pos->node.prev, struct objdump_line, node);
+
+		--self->b.top_idx;
+		--back;
+	}
+
+	self->b.top = pos;
+	self->curr_hot = nd;
+}
+
+static int annotate_browser__run(struct annotate_browser *self,
+				 struct newtExitStruct *es)
+{
+	struct rb_node *nd;
+	struct hist_entry *he = self->b.priv;
+
+	if (ui_browser__show(&self->b, he->ms.sym->name) < 0)
+		return -1;
+
+	ui_helpline__fpush("<- or ESC: exit, TAB/shift+TAB: cycle thru samples");
+	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+
+	nd = self->curr_hot;
+	if (nd) {
+		newtFormAddHotKey(self->b.form, NEWT_KEY_TAB);
+		newtFormAddHotKey(self->b.form, NEWT_KEY_UNTAB);
+	}
+
+	while (1) {
+		ui_browser__run(&self->b, es);
+
+		if (es->reason != NEWT_EXIT_HOTKEY)
+			break;
+
+		switch (es->u.key) {
+		case NEWT_KEY_TAB:
+			nd = rb_prev(nd);
+			if (nd == NULL)
+				nd = rb_last(&self->entries);
+			annotate_browser__set_top(self, nd);
+			break;
+		case NEWT_KEY_UNTAB:
+			nd = rb_next(nd);
+			if (nd == NULL)
+				nd = rb_first(&self->entries);
+			annotate_browser__set_top(self, nd);
+			break;
+		default:
+			goto out;
+		}
+	}
+out:
+	newtFormDestroy(self->b.form);
+	newtPopWindow();
+	ui_helpline__pop();
+	return 0;
+}
+
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
 	struct newtExitStruct es;
 	struct objdump_line *pos, *n;
 	struct objdump_line_rb_node *rbpos;
-	struct rb_node *nd;
 	LIST_HEAD(head);
 	struct annotate_browser browser = {
 		.b = {
@@ -156,35 +228,15 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 	/*
 	 * Position the browser at the hottest line.
 	 */
-	nd = rb_last(&browser.entries);
-	if (nd != NULL) {
-		unsigned back;
-
-		ui_browser__refresh_dimensions(&browser.b);
-		back = browser.b.height / 2;
-		rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node);
-		pos = ((struct objdump_line *)rbpos) - 1;
-		browser.b.top_idx = browser.b.index = rbpos->idx;
-
-		while (browser.b.top_idx != 0 && back != 0) {
-			pos = list_entry(pos->node.prev, struct objdump_line, node);
-
-			--browser.b.top_idx;
-			--back;
-		}
-
-		browser.b.top = pos;
-	}
+	browser.curr_hot = rb_last(&browser.entries);
+	if (browser.curr_hot)
+		annotate_browser__set_top(&browser, browser.curr_hot);
 
 	browser.b.width += 18; /* Percentage */
-	ui_browser__show(&browser.b, self->ms.sym->name);
-	ret = ui_browser__run(&browser.b, &es);
-	newtFormDestroy(browser.b.form);
-	newtPopWindow();
+	ret = annotate_browser__run(&browser, &es);
 	list_for_each_entry_safe(pos, n, &head, node) {
 		list_del(&pos->node);
 		objdump_line__free(pos);
 	}
-	ui_helpline__pop();
 	return ret;
 }

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

* [tip:perf/core] perf ui browser: Add ui_browser__show counterpart: __hide
       [not found]             ` <new-submission>
                                 ` (591 preceding siblings ...)
  2010-08-11  7:43               ` [tip:perf/core] perf annotate: Cycle thru sorted lines with samples tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:43               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-11  7:43               ` [tip:perf/core] perf ui hist browser: Fixup key bindings tip-bot for Arnaldo Carvalho de Melo
                                 ` (113 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  59e8fe32fc0cc9dff6b0c269d099a49e004dc45e
Gitweb:     http://git.kernel.org/tip/59e8fe32fc0cc9dff6b0c269d099a49e004dc45e
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:44:20 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 15:44:20 -0300

perf ui browser: Add ui_browser__show counterpart: __hide

So that the common tasks of providing a helpline at __run entry and
destroying the window and releasing resourses at exit can be abstracted
away, reducing a bit more the coupling with libnewt.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browser.c           |   18 +++++++++++++++++-
 tools/perf/util/ui/browser.h           |    4 +++-
 tools/perf/util/ui/browsers/annotate.c |    8 +++-----
 tools/perf/util/ui/browsers/hists.c    |    5 ++++-
 tools/perf/util/ui/browsers/map.c      |   10 ++++------
 tools/perf/util/ui/helpline.c          |    2 +-
 tools/perf/util/ui/helpline.h          |    1 +
 7 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 83d5748..66f2d58 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <sys/ttydefaults.h>
 #include "browser.h"
+#include "helpline.h"
 #include "../color.h"
 #include "../util.h"
 
@@ -145,8 +146,11 @@ void ui_browser__reset_index(struct ui_browser *self)
 	self->seek(self, 0, SEEK_SET);
 }
 
-int ui_browser__show(struct ui_browser *self, const char *title)
+int ui_browser__show(struct ui_browser *self, const char *title,
+		     const char *helpline, ...)
 {
+	va_list ap;
+
 	if (self->form != NULL) {
 		newtFormDestroy(self->form);
 		newtPopWindow();
@@ -171,9 +175,21 @@ int ui_browser__show(struct ui_browser *self, const char *title)
 	newtFormAddHotKey(self->form, NEWT_KEY_END);
 	newtFormAddHotKey(self->form, ' ');
 	newtFormAddComponent(self->form, self->sb);
+
+	va_start(ap, helpline);
+	ui_helpline__vpush(helpline, ap);
+	va_end(ap);
 	return 0;
 }
 
+void ui_browser__hide(struct ui_browser *self)
+{
+	newtFormDestroy(self->form);
+	newtPopWindow();
+	self->form = NULL;
+	ui_helpline__pop();
+}
+
 int ui_browser__refresh(struct ui_browser *self)
 {
 	int row;
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 856e343..0b9f829 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -30,7 +30,9 @@ bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
 void ui_browser__refresh_dimensions(struct ui_browser *self);
 void ui_browser__reset_index(struct ui_browser *self);
 
-int ui_browser__show(struct ui_browser *self, const char *title);
+int ui_browser__show(struct ui_browser *self, const char *title,
+		     const char *helpline, ...);
+void ui_browser__hide(struct ui_browser *self);
 int ui_browser__refresh(struct ui_browser *self);
 int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es);
 
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 73e78ef..55ff792 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -141,10 +141,10 @@ static int annotate_browser__run(struct annotate_browser *self,
 	struct rb_node *nd;
 	struct hist_entry *he = self->b.priv;
 
-	if (ui_browser__show(&self->b, he->ms.sym->name) < 0)
+	if (ui_browser__show(&self->b, he->ms.sym->name,
+			     "<- or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
 		return -1;
 
-	ui_helpline__fpush("<- or ESC: exit, TAB/shift+TAB: cycle thru samples");
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
 
 	nd = self->curr_hot;
@@ -177,9 +177,7 @@ static int annotate_browser__run(struct annotate_browser *self,
 		}
 	}
 out:
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
-	ui_helpline__pop();
+	ui_browser__hide(&self->b);
 	return 0;
 }
 
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index cee7998..dd512b7 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -211,7 +211,8 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 		 nr_events, unit);
 	newtDrawRootText(0, 0, str);
 
-	if (ui_browser__show(&self->b, title) < 0)
+	if (ui_browser__show(&self->b, title,
+			     "Press '?' for help on key bindings") < 0)
 		return -1;
 
 	newtFormAddHotKey(self->b.form, 'A');
@@ -253,6 +254,8 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 			return 0;
 		}
 	}
+
+	ui_browser__hide(&self->b);
 	return 0;
 }
 
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
index b79f0c9..142b825 100644
--- a/tools/perf/util/ui/browsers/map.c
+++ b/tools/perf/util/ui/browsers/map.c
@@ -100,11 +100,11 @@ static int map_browser__search(struct map_browser *self)
 
 static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
 {
-	if (ui_browser__show(&self->b, self->map->dso->long_name) < 0)
+	if (ui_browser__show(&self->b, self->map->dso->long_name,
+			     "Press <- or ESC to exit, %s / to search",
+			     verbose ? "" : "restart with -v to use") < 0)
 		return -1;
 
-	ui_helpline__fpush("Press <- or ESC to exit, %s / to search",
-			   verbose ? "" : "restart with -v to use");
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
 	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
 	if (verbose)
@@ -121,9 +121,7 @@ static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
 			break;
 	}
 
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
-	ui_helpline__pop();
+	ui_browser__hide(&self->b);
 	return 0;
 }
 
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c
index ff58460..8d79daa 100644
--- a/tools/perf/util/ui/helpline.c
+++ b/tools/perf/util/ui/helpline.c
@@ -16,7 +16,7 @@ void ui_helpline__push(const char *msg)
 	newtPushHelpLine(msg);
 }
 
-static void ui_helpline__vpush(const char *fmt, va_list ap)
+void ui_helpline__vpush(const char *fmt, va_list ap)
 {
 	char *s;
 
diff --git a/tools/perf/util/ui/helpline.h b/tools/perf/util/ui/helpline.h
index 5d1e5e7..ab6028d 100644
--- a/tools/perf/util/ui/helpline.h
+++ b/tools/perf/util/ui/helpline.h
@@ -4,6 +4,7 @@
 void ui_helpline__init(void);
 void ui_helpline__pop(void);
 void ui_helpline__push(const char *msg);
+void ui_helpline__vpush(const char *fmt, va_list ap);
 void ui_helpline__fpush(const char *fmt, ...);
 void ui_helpline__puts(const char *msg);
 

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

* [tip:perf/core] perf ui hist browser: Fixup key bindings
       [not found]             ` <new-submission>
                                 ` (592 preceding siblings ...)
  2010-08-11  7:43               ` [tip:perf/core] perf ui browser: Add ui_browser__show counterpart: __hide tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-11  7:43               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-12 20:03               ` [tip:perf/urgent] perf: Add back list_head data types tip-bot for Ingo Molnar
                                 ` (112 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-11  7:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  4694153c252a6ae19704b5bb66466050256395a4
Gitweb:     http://git.kernel.org/tip/4694153c252a6ae19704b5bb66466050256395a4
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 10 Aug 2010 15:50:07 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 15:50:07 -0300

perf ui hist browser: Fixup key bindings

To match what is shown when '?' or 'H' is pressed, i.e. the keybind help
window.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/hists.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index dd512b7..dafdf67 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -215,12 +215,12 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 			     "Press '?' for help on key bindings") < 0)
 		return -1;
 
-	newtFormAddHotKey(self->b.form, 'A');
 	newtFormAddHotKey(self->b.form, 'a');
 	newtFormAddHotKey(self->b.form, '?');
 	newtFormAddHotKey(self->b.form, 'h');
-	newtFormAddHotKey(self->b.form, 'H');
 	newtFormAddHotKey(self->b.form, 'd');
+	newtFormAddHotKey(self->b.form, 'D');
+	newtFormAddHotKey(self->b.form, 't');
 
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
 	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
@@ -232,7 +232,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 		if (es->reason != NEWT_EXIT_HOTKEY)
 			break;
 		switch (es->u.key) {
-		case 'd': { /* Debug */
+		case 'D': { /* Debug */
 			static int seq;
 			struct hist_entry *h = rb_entry(self->b.top,
 							struct hist_entry, rb_node);
@@ -771,18 +771,17 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 			default:;
 			}
 
-			key = toupper(key);
 			switch (key) {
-			case 'A':
+			case 'a':
 				if (browser->selection->map == NULL &&
 				    browser->selection->map->dso->annotate_warned)
 					continue;
 				goto do_annotate;
-			case 'D':
+			case 'd':
 				goto zoom_dso;
-			case 'T':
+			case 't':
 				goto zoom_thread;
-			case 'H':
+			case 'h':
 			case '?':
 do_help:
 				ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"

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

* [tip:perf/urgent] perf: Add back list_head data types
       [not found]             ` <new-submission>
                                 ` (593 preceding siblings ...)
  2010-08-11  7:43               ` [tip:perf/core] perf ui hist browser: Fixup key bindings tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-12 20:03               ` tip-bot for Ingo Molnar
  2010-08-16 17:32               ` [tip:perf/urgent] perf annotate tui: Fix exit and RIGHT keys handling tip-bot for Arnaldo Carvalho de Melo
                                 ` (111 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Ingo Molnar @ 2010-08-12 20:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, fweisbec,
	rostedt, tglx, mingo

Commit-ID:  88d89da64951377962334b684634cfc1468aa93f
Gitweb:     http://git.kernel.org/tip/88d89da64951377962334b684634cfc1468aa93f
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Thu, 12 Aug 2010 21:50:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 12 Aug 2010 21:50:00 +0200

perf: Add back list_head data types

This commit:

 de5d9bf: Move list types from <linux/list.h> to <linux/types.h>.

Moved the list head data types out of list.h, breaking the build.
Add them to the perf types.h as well.

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/include/linux/types.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/include/linux/types.h b/tools/perf/util/include/linux/types.h
index 196862a..12de3b8 100644
--- a/tools/perf/util/include/linux/types.h
+++ b/tools/perf/util/include/linux/types.h
@@ -6,4 +6,16 @@
 #define DECLARE_BITMAP(name,bits) \
 	unsigned long name[BITS_TO_LONGS(bits)]
 
+struct list_head {
+	struct list_head *next, *prev;
+};
+
+struct hlist_head {
+	struct hlist_node *first;
+};
+
+struct hlist_node {
+	struct hlist_node *next, **pprev;
+};
+
 #endif

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

* [tip:perf/urgent] perf annotate tui: Fix exit and RIGHT keys handling
       [not found]             ` <new-submission>
                                 ` (594 preceding siblings ...)
  2010-08-12 20:03               ` [tip:perf/urgent] perf: Add back list_head data types tip-bot for Ingo Molnar
@ 2010-08-16 17:32               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-20 12:39               ` [tip:perf/core] perf ui browser: Abstract some more slang operations tip-bot for Arnaldo Carvalho de Melo
                                 ` (110 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-16 17:32 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, fweisbec, peterz, tglx

Commit-ID:  e91846213241e3c46da8cbe992bceb1697de8d78
Gitweb:     http://git.kernel.org/tip/e91846213241e3c46da8cbe992bceb1697de8d78
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 16 Aug 2010 10:43:54 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 16 Aug 2010 10:43:54 -0300

perf annotate tui: Fix exit and RIGHT keys handling

As part of ongoing effort to reduce the coupling with libnewt, browsers
are being changed to return the exit key.

The annotate browser is not returning it as expected by builtin-annotate
when annotating multiple symbols (when 'perf annotate' is called without
specifying a symbol name).

Fix it by returning the exit key and also adding the RIGHT key as a exit
key so that going to the next symbol in the TUI can work again.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 55ff792..a90273e 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -146,6 +146,7 @@ static int annotate_browser__run(struct annotate_browser *self,
 		return -1;
 
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
 
 	nd = self->curr_hot;
 	if (nd) {
@@ -178,7 +179,7 @@ static int annotate_browser__run(struct annotate_browser *self,
 	}
 out:
 	ui_browser__hide(&self->b);
-	return 0;
+	return es->u.key;
 }
 
 int hist_entry__tui_annotate(struct hist_entry *self)

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

* [tip:perf/core] perf ui browser: Abstract some more slang operations
       [not found]             ` <new-submission>
                                 ` (595 preceding siblings ...)
  2010-08-16 17:32               ` [tip:perf/urgent] perf annotate tui: Fix exit and RIGHT keys handling tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-20 12:39               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Return the exit key in all browsers tip-bot for Arnaldo Carvalho de Melo
                                 ` (109 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-20 12:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  8f9bbc408b6f704e84d0ae78e6093005ad58d4fe
Gitweb:     http://git.kernel.org/tip/8f9bbc408b6f704e84d0ae78e6093005ad58d4fe
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 11 Aug 2010 14:51:47 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 19 Aug 2010 19:33:16 -0300

perf ui browser: Abstract some more slang operations

Browsers don't have to deal with absolute coordinates, just using (row,
column) and leaving the rest to ui_browser is better and removes one
more UI backend detail from the browsers.

Also shorten the percent_color setting idiom, removing some more direct
libslang calls.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browser.c           |   47 ++++++++++++++++---------------
 tools/perf/util/ui/browser.h           |    5 +++-
 tools/perf/util/ui/browsers/annotate.c |    8 ++---
 tools/perf/util/ui/browsers/hists.c    |   12 ++++----
 tools/perf/util/ui/browsers/map.c      |    3 +-
 5 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 66f2d58..d237410 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -1,16 +1,6 @@
-#define _GNU_SOURCE
-#include <stdio.h>
-#undef _GNU_SOURCE
-/*
- * slang versions <= 2.0.6 have a "#if HAVE_LONG_LONG" that breaks
- * the build if it isn't defined. Use the equivalent one that glibc
- * has on features.h.
- */
-#include <features.h>
-#ifndef HAVE_LONG_LONG
-#define HAVE_LONG_LONG __GLIBC_HAVE_LONG_LONG
-#endif
 #include <slang.h>
+#include "libslang.h"
+#include <linux/compiler.h>
 #include <linux/list.h>
 #include <linux/rbtree.h>
 #include <stdlib.h>
@@ -19,17 +9,11 @@
 #include "helpline.h"
 #include "../color.h"
 #include "../util.h"
-
-#if SLANG_VERSION < 20104
-#define sltt_set_color(obj, name, fg, bg) \
-	SLtt_set_color(obj,(char *)name, (char *)fg, (char *)bg)
-#else
-#define sltt_set_color SLtt_set_color
-#endif
+#include <stdio.h>
 
 newtComponent newt_form__new(void);
 
-int ui_browser__percent_color(double percent, bool current)
+static int ui_browser__percent_color(double percent, bool current)
 {
 	if (current)
 		return HE_COLORSET_SELECTED;
@@ -40,6 +24,23 @@ int ui_browser__percent_color(double percent, bool current)
 	return HE_COLORSET_NORMAL;
 }
 
+void ui_browser__set_color(struct ui_browser *self __used, int color)
+{
+	SLsmg_set_color(color);
+}
+
+void ui_browser__set_percent_color(struct ui_browser *self,
+				   double percent, bool current)
+{
+	 int color = ui_browser__percent_color(percent, current);
+	 ui_browser__set_color(self, color);
+}
+
+void ui_browser__gotorc(struct ui_browser *self, int y, int x)
+{
+	SLsmg_gotorc(self->y + y, self->x + x);
+}
+
 void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence)
 {
 	struct list_head *head = self->entries;
@@ -111,7 +112,7 @@ unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self)
 	nd = self->top;
 
 	while (nd != NULL) {
-		SLsmg_gotorc(self->y + row, self->x);
+		ui_browser__gotorc(self, row, 0);
 		self->write(self, nd, row);
 		if (++row == self->height)
 			break;
@@ -196,7 +197,7 @@ int ui_browser__refresh(struct ui_browser *self)
 
 	newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
 	row = self->refresh(self);
-	SLsmg_set_color(HE_COLORSET_NORMAL);
+	ui_browser__set_color(self, HE_COLORSET_NORMAL);
 	SLsmg_fill_region(self->y + row, self->x,
 			  self->height - row, self->width, ' ');
 
@@ -294,7 +295,7 @@ unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
 	pos = self->top;
 
 	list_for_each_from(pos, head) {
-		SLsmg_gotorc(self->y + row, self->x);
+		ui_browser__gotorc(self, row, 0);
 		self->write(self, pos, row);
 		if (++row == self->height)
 			break;
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 0b9f829..27c23c2 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -25,11 +25,14 @@ struct ui_browser {
 };
 
 
-int ui_browser__percent_color(double percent, bool current);
+void ui_browser__set_color(struct ui_browser *self, int color);
+void ui_browser__set_percent_color(struct ui_browser *self,
+				   double percent, bool current);
 bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
 void ui_browser__refresh_dimensions(struct ui_browser *self);
 void ui_browser__reset_index(struct ui_browser *self);
 
+void ui_browser__gotorc(struct ui_browser *self, int y, int x);
 int ui_browser__show(struct ui_browser *self, const char *title,
 		     const char *helpline, ...);
 void ui_browser__hide(struct ui_browser *self);
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index a90273e..a00d529 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -40,14 +40,12 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 
 	if (ol->offset != -1) {
 		struct objdump_line_rb_node *olrb = objdump_line__rb(ol);
-		int color = ui_browser__percent_color(olrb->percent, current_entry);
-		SLsmg_set_color(color);
+		ui_browser__set_percent_color(self, olrb->percent, current_entry);
 		slsmg_printf(" %7.2f ", olrb->percent);
 		if (!current_entry)
-			SLsmg_set_color(HE_COLORSET_CODE);
+			ui_browser__set_color(self, HE_COLORSET_CODE);
 	} else {
-		int color = ui_browser__percent_color(0, current_entry);
-		SLsmg_set_color(color);
+		ui_browser__set_percent_color(self, 0, current_entry);
 		slsmg_write_nstring(" ", 9);
 	}
 
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index dafdf67..5723091 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -341,8 +341,8 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
 				*is_current_entry = true;
 			}
 
-			SLsmg_set_color(color);
-			SLsmg_gotorc(self->b.y + row, self->b.x);
+			ui_browser__set_color(&self->b, color);
+			ui_browser__gotorc(&self->b, row, 0);
 			slsmg_write_nstring(" ", offset + extra_offset);
 			slsmg_printf("%c ", folded_sign);
 			slsmg_write_nstring(str, width);
@@ -405,8 +405,8 @@ static int hist_browser__show_callchain_node(struct hist_browser *self,
 		}
 
 		s = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
-		SLsmg_gotorc(self->b.y + row, self->b.x);
-		SLsmg_set_color(color);
+		ui_browser__gotorc(&self->b, row, 0);
+		ui_browser__set_color(&self->b, color);
 		slsmg_write_nstring(" ", offset);
 		slsmg_printf("%c ", folded_sign);
 		slsmg_write_nstring(s, width - 2);
@@ -484,8 +484,8 @@ static int hist_browser__show_entry(struct hist_browser *self,
 				color = HE_COLORSET_NORMAL;
 		}
 
-		SLsmg_set_color(color);
-		SLsmg_gotorc(self->b.y + row, self->b.x);
+		ui_browser__set_color(&self->b, color);
+		ui_browser__gotorc(&self->b, row, 0);
 		if (symbol_conf.use_callchain) {
 			slsmg_printf("%c ", folded_sign);
 			width -= 2;
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
index 142b825..733daba 100644
--- a/tools/perf/util/ui/browsers/map.c
+++ b/tools/perf/util/ui/browsers/map.c
@@ -56,9 +56,8 @@ static void map_browser__write(struct ui_browser *self, void *nd, int row)
 	struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
 	struct map_browser *mb = container_of(self, struct map_browser, b);
 	bool current_entry = ui_browser__is_current_entry(self, row);
-	int color = ui_browser__percent_color(0, current_entry);
 
-	SLsmg_set_color(color);
+	ui_browser__set_percent_color(self, 0, current_entry);
 	slsmg_printf("%*llx %*llx %c ",
 		     mb->addrlen, sym->start, mb->addrlen, sym->end,
 		     sym->binding == STB_GLOBAL ? 'g' :

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

* [tip:perf/core] perf ui browser: Return the exit key in all browsers
       [not found]             ` <new-submission>
                                 ` (596 preceding siblings ...)
  2010-08-20 12:39               ` [tip:perf/core] perf ui browser: Abstract some more slang operations tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-20 12:40               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Add routines to compactly specify exit keys tip-bot for Arnaldo Carvalho de Melo
                                 ` (108 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-20 12:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  b50e003db13848dd74572ffd221047683313981d
Gitweb:     http://git.kernel.org/tip/b50e003db13848dd74572ffd221047683313981d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 11 Aug 2010 10:07:43 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 19 Aug 2010 19:39:52 -0300

perf ui browser: Return the exit key in all browsers

Make all browsers return the exit key uniformly and remove the
newtExitStruct parameter, removing one more newt specific thing from the
ui API.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c          |   17 ++--
 tools/perf/util/ui/browser.c           |   16 ++--
 tools/perf/util/ui/browser.h           |    2 +-
 tools/perf/util/ui/browsers/annotate.c |   18 ++---
 tools/perf/util/ui/browsers/hists.c    |  132 ++++++++++++++------------------
 tools/perf/util/ui/browsers/map.c      |   20 +++--
 tools/perf/util/util.h                 |   13 ---
 7 files changed, 93 insertions(+), 125 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 1478dc6..20ee21d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -321,7 +321,7 @@ static int hist_entry__tty_annotate(struct hist_entry *he)
 
 static void hists__find_annotations(struct hists *self)
 {
-	struct rb_node *first = rb_first(&self->entries), *nd = first;
+	struct rb_node *nd = rb_first(&self->entries), *next;
 	int key = KEY_RIGHT;
 
 	while (nd) {
@@ -343,20 +343,19 @@ find_next:
 
 		if (use_browser > 0) {
 			key = hist_entry__tui_annotate(he);
-			if (is_exit_key(key))
-				break;
 			switch (key) {
 			case KEY_RIGHT:
-			case '\t':
-				nd = rb_next(nd);
+				next = rb_next(nd);
 				break;
 			case KEY_LEFT:
-				if (nd == first)
-					continue;
-				nd = rb_prev(nd);
-			default:
+				next = rb_prev(nd);
 				break;
+			default:
+				return;
 			}
+
+			if (next != NULL)
+				nd = next;
 		} else {
 			hist_entry__tty_annotate(he);
 			nd = rb_next(nd);
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index d237410..669a980 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -204,21 +204,21 @@ int ui_browser__refresh(struct ui_browser *self)
 	return 0;
 }
 
-int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
+int ui_browser__run(struct ui_browser *self)
 {
+	struct newtExitStruct es;
+
 	if (ui_browser__refresh(self) < 0)
 		return -1;
 
 	while (1) {
 		off_t offset;
 
-		newtFormRun(self->form, es);
+		newtFormRun(self->form, &es);
 
-		if (es->reason != NEWT_EXIT_HOTKEY)
+		if (es.reason != NEWT_EXIT_HOTKEY)
 			break;
-		if (is_exit_key(es->u.key))
-			return es->u.key;
-		switch (es->u.key) {
+		switch (es.u.key) {
 		case NEWT_KEY_DOWN:
 			if (self->index == self->nr_entries - 1)
 				break;
@@ -275,12 +275,12 @@ int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
 			self->seek(self, -offset, SEEK_END);
 			break;
 		default:
-			return es->u.key;
+			return es.u.key;
 		}
 		if (ui_browser__refresh(self) < 0)
 			return -1;
 	}
-	return 0;
+	return -1;
 }
 
 unsigned int ui_browser__list_head_refresh(struct ui_browser *self)
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 27c23c2..332a675 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -37,7 +37,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
 		     const char *helpline, ...);
 void ui_browser__hide(struct ui_browser *self);
 int ui_browser__refresh(struct ui_browser *self);
-int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es);
+int ui_browser__run(struct ui_browser *self);
 
 void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence);
 unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self);
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index a00d529..a8bc2c0 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -133,14 +133,14 @@ static void annotate_browser__set_top(struct annotate_browser *self,
 	self->curr_hot = nd;
 }
 
-static int annotate_browser__run(struct annotate_browser *self,
-				 struct newtExitStruct *es)
+static int annotate_browser__run(struct annotate_browser *self)
 {
 	struct rb_node *nd;
 	struct hist_entry *he = self->b.priv;
+	int key;
 
 	if (ui_browser__show(&self->b, he->ms.sym->name,
-			     "<- or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
+			     "<-, -> or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
 		return -1;
 
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
@@ -153,12 +153,9 @@ static int annotate_browser__run(struct annotate_browser *self,
 	}
 
 	while (1) {
-		ui_browser__run(&self->b, es);
+		key = ui_browser__run(&self->b);
 
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-
-		switch (es->u.key) {
+		switch (key) {
 		case NEWT_KEY_TAB:
 			nd = rb_prev(nd);
 			if (nd == NULL)
@@ -177,12 +174,11 @@ static int annotate_browser__run(struct annotate_browser *self,
 	}
 out:
 	ui_browser__hide(&self->b);
-	return es->u.key;
+	return key;
 }
 
 int hist_entry__tui_annotate(struct hist_entry *self)
 {
-	struct newtExitStruct es;
 	struct objdump_line *pos, *n;
 	struct objdump_line_rb_node *rbpos;
 	LIST_HEAD(head);
@@ -230,7 +226,7 @@ int hist_entry__tui_annotate(struct hist_entry *self)
 		annotate_browser__set_top(&browser, browser.curr_hot);
 
 	browser.b.width += 18; /* Percentage */
-	ret = annotate_browser__run(&browser, &es);
+	ret = annotate_browser__run(&browser);
 	list_for_each_entry_safe(pos, n, &head, node) {
 		list_del(&pos->node);
 		objdump_line__free(pos);
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 5723091..1735c48 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -195,9 +195,9 @@ static bool hist_browser__toggle_fold(struct hist_browser *self)
 	return false;
 }
 
-static int hist_browser__run(struct hist_browser *self, const char *title,
-			     struct newtExitStruct *es)
+static int hist_browser__run(struct hist_browser *self, const char *title)
 {
+	int key;
 	char str[256], unit;
 	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
 
@@ -227,11 +227,9 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
 
 	while (1) {
-		ui_browser__run(&self->b, es);
+		key = ui_browser__run(&self->b);
 
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-		switch (es->u.key) {
+		switch (key) {
 		case 'D': { /* Debug */
 			static int seq;
 			struct hist_entry *h = rb_entry(self->b.top,
@@ -251,12 +249,12 @@ static int hist_browser__run(struct hist_browser *self, const char *title,
 				break;
 			/* fall thru */
 		default:
-			return 0;
+			goto out;
 		}
 	}
-
+out:
 	ui_browser__hide(&self->b);
-	return 0;
+	return key;
 }
 
 static char *callchain_list__sym_name(struct callchain_list *self,
@@ -687,8 +685,6 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
 
 static void hist_browser__delete(struct hist_browser *self)
 {
-	newtFormDestroy(self->b.form);
-	newtPopWindow();
 	free(self);
 }
 
@@ -725,7 +721,6 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 	struct pstack *fstack;
 	const struct thread *thread_filter = NULL;
 	const struct dso *dso_filter = NULL;
-	struct newtExitStruct es;
 	char msg[160];
 	int key = -1;
 
@@ -749,70 +744,63 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 		    annotate = -2, zoom_dso = -2, zoom_thread = -2,
 		    browse_map = -2;
 
-		if (hist_browser__run(browser, msg, &es))
-			break;
+		key = hist_browser__run(browser, msg);
 
 		thread = hist_browser__selected_thread(browser);
 		dso = browser->selection->map ? browser->selection->map->dso : NULL;
 
-		if (es.reason == NEWT_EXIT_HOTKEY) {
-			key = es.u.key;
-
-			switch (key) {
-			case NEWT_KEY_F1:
-				goto do_help;
-			case NEWT_KEY_TAB:
-			case NEWT_KEY_UNTAB:
-				/*
-				 * Exit the browser, let hists__browser_tree
-				 * go to the next or previous
-				 */
-				goto out_free_stack;
-			default:;
-			}
-
-			switch (key) {
-			case 'a':
-				if (browser->selection->map == NULL &&
-				    browser->selection->map->dso->annotate_warned)
-					continue;
-				goto do_annotate;
-			case 'd':
-				goto zoom_dso;
-			case 't':
-				goto zoom_thread;
-			case 'h':
-			case '?':
-do_help:
-				ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
-						"<-        Zoom out\n"
-						"a         Annotate current symbol\n"
-						"h/?/F1    Show this window\n"
-						"d         Zoom into current DSO\n"
-						"t         Zoom into current Thread\n"
-						"q/CTRL+C  Exit browser");
+		switch (key) {
+		case NEWT_KEY_F1:
+			goto do_help;
+		case NEWT_KEY_TAB:
+		case NEWT_KEY_UNTAB:
+			/*
+			 * Exit the browser, let hists__browser_tree
+			 * go to the next or previous
+			 */
+			goto out_free_stack;
+		case 'a':
+			if (browser->selection->map == NULL &&
+			    browser->selection->map->dso->annotate_warned)
 				continue;
-			default:;
-			}
-			if (is_exit_key(key)) {
-				if (key == NEWT_KEY_ESCAPE &&
-				    !ui__dialog_yesno("Do you really want to exit?"))
-					continue;
-				break;
-			}
-
-			if (es.u.key == NEWT_KEY_LEFT) {
-				const void *top;
+			goto do_annotate;
+		case 'd':
+			goto zoom_dso;
+		case 't':
+			goto zoom_thread;
+		case 'h':
+		case '?':
+do_help:
+			ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
+					"<-        Zoom out\n"
+					"a         Annotate current symbol\n"
+					"h/?/F1    Show this window\n"
+					"d         Zoom into current DSO\n"
+					"t         Zoom into current Thread\n"
+					"q/CTRL+C  Exit browser");
+			continue;
+		case NEWT_KEY_ENTER:
+		case NEWT_KEY_RIGHT:
+			/* menu */
+			break;
+		case NEWT_KEY_LEFT: {
+			const void *top;
 
-				if (pstack__empty(fstack))
-					continue;
-				top = pstack__pop(fstack);
-				if (top == &dso_filter)
-					goto zoom_out_dso;
-				if (top == &thread_filter)
-					goto zoom_out_thread;
+			if (pstack__empty(fstack))
 				continue;
-			}
+			top = pstack__pop(fstack);
+			if (top == &dso_filter)
+				goto zoom_out_dso;
+			if (top == &thread_filter)
+				goto zoom_out_thread;
+			continue;
+		}
+		case NEWT_KEY_ESCAPE:
+			if (!ui__dialog_yesno("Do you really want to exit?"))
+				continue;
+			/* Fall thru */
+		default:
+			goto out_free_stack;
 		}
 
 		if (browser->selection->sym != NULL &&
@@ -925,10 +913,6 @@ int hists__tui_browse_tree(struct rb_root *self, const char *help)
 		const char *ev_name = __event_name(hists->type, hists->config);
 
 		key = hists__browse(hists, help, ev_name);
-
-		if (is_exit_key(key))
-			break;
-
 		switch (key) {
 		case NEWT_KEY_TAB:
 			next = rb_next(nd);
@@ -940,7 +924,7 @@ int hists__tui_browse_tree(struct rb_root *self, const char *help)
 				continue;
 			nd = rb_prev(nd);
 		default:
-			break;
+			return key;
 		}
 	}
 
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
index 733daba..16b7d70 100644
--- a/tools/perf/util/ui/browsers/map.c
+++ b/tools/perf/util/ui/browsers/map.c
@@ -97,31 +97,34 @@ static int map_browser__search(struct map_browser *self)
 	return 0;
 }
 
-static int map_browser__run(struct map_browser *self, struct newtExitStruct *es)
+static int map_browser__run(struct map_browser *self)
 {
+	int key;
+
 	if (ui_browser__show(&self->b, self->map->dso->long_name,
 			     "Press <- or ESC to exit, %s / to search",
 			     verbose ? "" : "restart with -v to use") < 0)
 		return -1;
 
 	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+	newtFormAddHotKey(self->b.form, NEWT_KEY_ESCAPE);
+	newtFormAddHotKey(self->b.form, 'Q');
+	newtFormAddHotKey(self->b.form, 'q');
+	newtFormAddHotKey(self->b.form, CTRL('c'));
 	if (verbose)
 		newtFormAddHotKey(self->b.form, '/');
 
 	while (1) {
-		ui_browser__run(&self->b, es);
+		key = ui_browser__run(&self->b);
 
-		if (es->reason != NEWT_EXIT_HOTKEY)
-			break;
-		if (verbose && es->u.key == '/')
+		if (verbose && key == '/')
 			map_browser__search(self);
 		else
 			break;
 	}
 
 	ui_browser__hide(&self->b);
-	return 0;
+	return key;
 }
 
 int map__browse(struct map *self)
@@ -135,7 +138,6 @@ int map__browse(struct map *self)
 		},
 		.map = self,
 	};
-	struct newtExitStruct es;
 	struct rb_node *nd;
 	char tmp[BITS_PER_LONG / 4];
 	u64 maxaddr = 0;
@@ -156,5 +158,5 @@ int map__browse(struct map *self)
 
 	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
 	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
-	return map_browser__run(&mb, &es);
+	return map_browser__run(&mb);
 }
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f380fed..7562707 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -266,19 +266,6 @@ bool strglobmatch(const char *str, const char *pat);
 bool strlazymatch(const char *str, const char *pat);
 unsigned long convert_unit(unsigned long value, char *unit);
 
-#ifndef ESC
-#define ESC 27
-#endif
-
-static inline bool is_exit_key(int key)
-{
-	char up;
-	if (key == CTRL('c') || key == ESC)
-		return true;
-	up = toupper(key);
-	return up == 'Q';
-}
-
 #define _STR(x) #x
 #define STR(x) _STR(x)
 

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

* [tip:perf/core] perf ui browser: Add routines to compactly specify exit keys
       [not found]             ` <new-submission>
                                 ` (597 preceding siblings ...)
  2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Return the exit key in all browsers tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-20 12:40               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-21 20:18               ` [tip:perf/core] perf tools: Add --tui and --stdio to choose the UI tip-bot for Arnaldo Carvalho de Melo
                                 ` (107 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-20 12:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  4c1c952e37c7511a52f617ceddbc10c855d45d7b
Gitweb:     http://git.kernel.org/tip/4c1c952e37c7511a52f617ceddbc10c855d45d7b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 12 Aug 2010 12:37:51 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 19 Aug 2010 19:44:18 -0300

perf ui browser: Add routines to compactly specify exit keys

This makes the usual idiom for specifying a series of key codes to exit
ui_browser__run() for specialized processing (search, annotate, etc) or
plain exiting the browser more compact.

It also abstracts away some more libnewt operations. At some point we'll
also replace NEWT_KEY_foo with something that can be mapped to NEWT or,
say, gtk.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browser.c           |   30 ++++++++++++++++++++----------
 tools/perf/util/ui/browser.h           |    2 ++
 tools/perf/util/ui/browsers/annotate.c |   12 +++++++-----
 tools/perf/util/ui/browsers/hists.c    |   13 +++----------
 tools/perf/util/ui/browsers/map.c      |    8 +-------
 tools/perf/util/ui/util.c              |    4 +---
 6 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 669a980..930c4ac 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -11,8 +11,6 @@
 #include "../util.h"
 #include <stdio.h>
 
-newtComponent newt_form__new(void);
-
 static int ui_browser__percent_color(double percent, bool current)
 {
 	if (current)
@@ -147,10 +145,28 @@ void ui_browser__reset_index(struct ui_browser *self)
 	self->seek(self, 0, SEEK_SET);
 }
 
+void ui_browser__add_exit_key(struct ui_browser *self, int key)
+{
+	newtFormAddHotKey(self->form, key);
+}
+
+void ui_browser__add_exit_keys(struct ui_browser *self, int keys[])
+{
+	int i = 0;
+
+	while (keys[i] && i < 64) {
+		ui_browser__add_exit_key(self, keys[i]);
+		++i;
+	}
+}
+
 int ui_browser__show(struct ui_browser *self, const char *title,
 		     const char *helpline, ...)
 {
 	va_list ap;
+	int keys[] = { NEWT_KEY_UP, NEWT_KEY_DOWN, NEWT_KEY_PGUP,
+		       NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ',
+		       NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 };
 
 	if (self->form != NULL) {
 		newtFormDestroy(self->form);
@@ -158,7 +174,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
 	}
 	ui_browser__refresh_dimensions(self);
 	newtCenteredWindow(self->width, self->height, title);
-	self->form = newt_form__new();
+	self->form = newtForm(NULL, NULL, 0);
 	if (self->form == NULL)
 		return -1;
 
@@ -168,13 +184,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
 	if (self->sb == NULL)
 		return -1;
 
-	newtFormAddHotKey(self->form, NEWT_KEY_UP);
-	newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
-	newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
-	newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
-	newtFormAddHotKey(self->form, NEWT_KEY_HOME);
-	newtFormAddHotKey(self->form, NEWT_KEY_END);
-	newtFormAddHotKey(self->form, ' ');
+	ui_browser__add_exit_keys(self, keys);
 	newtFormAddComponent(self->form, self->sb);
 
 	va_start(ap, helpline);
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 332a675..0dc7e4d 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -33,6 +33,8 @@ void ui_browser__refresh_dimensions(struct ui_browser *self);
 void ui_browser__reset_index(struct ui_browser *self);
 
 void ui_browser__gotorc(struct ui_browser *self, int y, int x);
+void ui_browser__add_exit_key(struct ui_browser *self, int key);
+void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]);
 int ui_browser__show(struct ui_browser *self, const char *title,
 		     const char *helpline, ...);
 void ui_browser__hide(struct ui_browser *self);
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index a8bc2c0..82b78f9 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -142,14 +142,16 @@ static int annotate_browser__run(struct annotate_browser *self)
 	if (ui_browser__show(&self->b, he->ms.sym->name,
 			     "<-, -> or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0)
 		return -1;
-
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
+	/*
+	 * To allow builtin-annotate to cycle thru multiple symbols by
+	 * examining the exit key for this function.
+	 */
+	ui_browser__add_exit_key(&self->b, NEWT_KEY_RIGHT);
 
 	nd = self->curr_hot;
 	if (nd) {
-		newtFormAddHotKey(self->b.form, NEWT_KEY_TAB);
-		newtFormAddHotKey(self->b.form, NEWT_KEY_UNTAB);
+		int tabs[] = { NEWT_KEY_TAB, NEWT_KEY_UNTAB, 0 };
+		ui_browser__add_exit_keys(&self->b, tabs);
 	}
 
 	while (1) {
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 1735c48..b13b978 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -198,6 +198,8 @@ static bool hist_browser__toggle_fold(struct hist_browser *self)
 static int hist_browser__run(struct hist_browser *self, const char *title)
 {
 	int key;
+	int exit_keys[] = { 'a', '?', 'h', 'd', 'D', 't', NEWT_KEY_ENTER,
+			    NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, };
 	char str[256], unit;
 	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
 
@@ -215,16 +217,7 @@ static int hist_browser__run(struct hist_browser *self, const char *title)
 			     "Press '?' for help on key bindings") < 0)
 		return -1;
 
-	newtFormAddHotKey(self->b.form, 'a');
-	newtFormAddHotKey(self->b.form, '?');
-	newtFormAddHotKey(self->b.form, 'h');
-	newtFormAddHotKey(self->b.form, 'd');
-	newtFormAddHotKey(self->b.form, 'D');
-	newtFormAddHotKey(self->b.form, 't');
-
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER);
+	ui_browser__add_exit_keys(&self->b, exit_keys);
 
 	while (1) {
 		key = ui_browser__run(&self->b);
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
index 16b7d70..1bf0979 100644
--- a/tools/perf/util/ui/browsers/map.c
+++ b/tools/perf/util/ui/browsers/map.c
@@ -1,6 +1,5 @@
 #include "../libslang.h"
 #include <elf.h>
-#include <newt.h>
 #include <sys/ttydefaults.h>
 #include <ctype.h>
 #include <string.h>
@@ -106,13 +105,8 @@ static int map_browser__run(struct map_browser *self)
 			     verbose ? "" : "restart with -v to use") < 0)
 		return -1;
 
-	newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT);
-	newtFormAddHotKey(self->b.form, NEWT_KEY_ESCAPE);
-	newtFormAddHotKey(self->b.form, 'Q');
-	newtFormAddHotKey(self->b.form, 'q');
-	newtFormAddHotKey(self->b.form, CTRL('c'));
 	if (verbose)
-		newtFormAddHotKey(self->b.form, '/');
+		ui_browser__add_exit_key(&self->b, '/');
 
 	while (1) {
 		key = ui_browser__run(&self->b);
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 04600e2..9706d9d 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -11,8 +11,6 @@
 #include "helpline.h"
 #include "util.h"
 
-newtComponent newt_form__new(void);
-
 static void newt_form__set_exit_keys(newtComponent self)
 {
 	newtFormAddHotKey(self, NEWT_KEY_LEFT);
@@ -22,7 +20,7 @@ static void newt_form__set_exit_keys(newtComponent self)
 	newtFormAddHotKey(self, CTRL('c'));
 }
 
-newtComponent newt_form__new(void)
+static newtComponent newt_form__new(void)
 {
 	newtComponent self = newtForm(NULL, NULL, 0);
 	if (self)

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

* [tip:perf/core] perf tools: Add --tui and --stdio to choose the UI
       [not found]             ` <new-submission>
                                 ` (598 preceding siblings ...)
  2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Add routines to compactly specify exit keys tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-21 20:18               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-30  8:33               ` [tip:perf/core] perf hists: Fix hist_entry__init_have_children tip-bot for Arnaldo Carvalho de Melo
                                 ` (106 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-21 20:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, hch,
	fweisbec, tglx

Commit-ID:  8b9e74eb8af808807192d16b76565c27154ae7ed
Gitweb:     http://git.kernel.org/tip/8b9e74eb8af808807192d16b76565c27154ae7ed
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 21 Aug 2010 10:38:16 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 21 Aug 2010 10:49:46 -0300

perf tools: Add --tui and --stdio to choose the UI

Relying just on ~/.perfconfig or rebuilding the tool disabling support
for the TUI is too cumbersome, so allow specifying which UI to use and
make the command line switch override whatever is in ~/.perfconfig.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-annotate.txt |   11 +++++++++--
 tools/perf/Documentation/perf-report.txt   |    7 +++++++
 tools/perf/builtin-annotate.c              |    9 ++++++++-
 tools/perf/builtin-report.c                |   11 ++++++++++-
 4 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index 5164a65..b2c6330 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -8,7 +8,7 @@ perf-annotate - Read perf.data (created by perf record) and display annotated co
 SYNOPSIS
 --------
 [verse]
-'perf annotate' [-i <file> | --input=file] symbol_name
+'perf annotate' [-i <file> | --input=file] [symbol_name]
 
 DESCRIPTION
 -----------
@@ -24,6 +24,13 @@ OPTIONS
 --input=::
         Input file name. (default: perf.data)
 
+--stdio:: Use the stdio interface.
+
+--tui:: Use the TUI interface Use of --tui requires a tty, if one is not
+	present, as when piping to other commands, the stdio interface is
+	used. This interfaces starts by centering on the line with more
+	samples, TAB/UNTAB cycles thru the lines with more samples.
+
 SEE ALSO
 --------
-linkperf:perf-record[1]
+linkperf:perf-record[1], linkperf:perf-report[1]
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index abfabe9..12052c9 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -65,6 +65,13 @@ OPTIONS
 		 the tree is considered as a new profiled object. +
 	Default: fractal,0.5.
 
+--stdio:: Use the stdio interface.
+
+--tui:: Use the TUI interface, that is integrated with annotate and allows
+        zooming into DSOs or threads, among other features. Use of --tui
+	requires a tty, if one is not present, as when piping to other
+	commands, the stdio interface is used.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1]
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 20ee21d..6d5604d8d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -28,7 +28,7 @@
 
 static char		const *input_name = "perf.data";
 
-static bool		force;
+static bool		force, use_tui, use_stdio;
 
 static bool		full_paths;
 
@@ -427,6 +427,8 @@ static const struct option options[] = {
 		    "be more verbose (show symbol address, etc)"),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
+	OPT_BOOLEAN(0, "tui", &use_tui, "Use the TUI interface"),
+	OPT_BOOLEAN(0, "stdio", &use_stdio, "Use the stdio interface"),
 	OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
 		   "file", "vmlinux pathname"),
 	OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
@@ -442,6 +444,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 {
 	argc = parse_options(argc, argv, options, annotate_usage, 0);
 
+	if (use_stdio)
+		use_browser = 0;
+	else if (use_tui)
+		use_browser = 1;
+
 	setup_browser();
 
 	symbol_conf.priv_size = sizeof(struct sym_priv);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 55fc1f4..7d35a71 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -32,7 +32,7 @@
 
 static char		const *input_name = "perf.data";
 
-static bool		force;
+static bool		force, use_tui, use_stdio;
 static bool		hide_unresolved;
 static bool		dont_use_callchains;
 
@@ -450,6 +450,8 @@ static const struct option options[] = {
 		    "Show per-thread event counters"),
 	OPT_STRING(0, "pretty", &pretty_printing_style, "key",
 		   "pretty printing style key: normal raw"),
+	OPT_BOOLEAN(0, "tui", &use_tui, "Use the TUI interface"),
+	OPT_BOOLEAN(0, "stdio", &use_stdio, "Use the stdio interface"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): pid, comm, dso, symbol, parent"),
 	OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
@@ -482,8 +484,15 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
 {
 	argc = parse_options(argc, argv, options, report_usage, 0);
 
+	if (use_stdio)
+		use_browser = 0;
+	else if (use_tui)
+		use_browser = 1;
+
 	if (strcmp(input_name, "-") != 0)
 		setup_browser();
+	else
+		use_browser = 0;
 	/*
 	 * Only in the newt browser we are doing integrated annotation,
 	 * so don't allocate extra space that won't be used in the stdio

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

* [tip:perf/core] perf hists: Fix hist_entry__init_have_children
       [not found]             ` <new-submission>
                                 ` (599 preceding siblings ...)
  2010-08-21 20:18               ` [tip:perf/core] perf tools: Add --tui and --stdio to choose the UI tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-30  8:33               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT() tip-bot for Arnaldo Carvalho de Melo
                                 ` (105 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-30  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  18b308d7994e0e2a360b979f159fa7d2b91a26b1
Gitweb:     http://git.kernel.org/tip/18b308d7994e0e2a360b979f159fa7d2b91a26b1
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 25 Aug 2010 12:47:44 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Aug 2010 14:39:09 -0300

perf hists: Fix hist_entry__init_have_children

It wasn't setting the ms.has_children for the hist_entry itself, just
for the callchain

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/hists.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index b13b978..39ba230 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -168,6 +168,7 @@ static void callchain__init_have_children(struct rb_root *self)
 static void hist_entry__init_have_children(struct hist_entry *self)
 {
 	if (!self->init_have_children) {
+		self->ms.has_children = !RB_EMPTY_ROOT(&self->sorted_chain);
 		callchain__init_have_children(&self->sorted_chain);
 		self->init_have_children = true;
 	}

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

* [tip:perf/core] perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT()
       [not found]             ` <new-submission>
                                 ` (600 preceding siblings ...)
  2010-08-30  8:33               ` [tip:perf/core] perf hists: Fix hist_entry__init_have_children tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-30  8:34               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Init the has_children fields just once tip-bot for Arnaldo Carvalho de Melo
                                 ` (104 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-30  8:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  293db47f4753f5746e5aaa998ceb24dff662cf7e
Gitweb:     http://git.kernel.org/tip/293db47f4753f5746e5aaa998ceb24dff662cf7e
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 25 Aug 2010 16:05:36 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Aug 2010 16:05:36 -0300

perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT()

Its way too stupid to use rb_first() for just caching if there are
children, use the cheaper RB_EMPTY_ROOT() instead.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/hists.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 39ba230..e61355e 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -129,16 +129,16 @@ static void callchain_node__init_have_children_rb_tree(struct callchain_node *se
 	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
 		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
 		struct callchain_list *chain;
-		int first = true;
+		bool first = true;
 
 		list_for_each_entry(chain, &child->val, list) {
 			if (first) {
 				first = false;
 				chain->ms.has_children = chain->list.next != &child->val ||
-							 rb_first(&child->rb_root) != NULL;
+							 !RB_EMPTY_ROOT(&child->rb_root);
 			} else
 				chain->ms.has_children = chain->list.next == &child->val &&
-							 rb_first(&child->rb_root) != NULL;
+							 !RB_EMPTY_ROOT(&child->rb_root);
 		}
 
 		callchain_node__init_have_children_rb_tree(child);
@@ -150,7 +150,7 @@ static void callchain_node__init_have_children(struct callchain_node *self)
 	struct callchain_list *chain;
 
 	list_for_each_entry(chain, &self->val, list)
-		chain->ms.has_children = rb_first(&self->rb_root) != NULL;
+		chain->ms.has_children = !RB_EMPTY_ROOT(&self->rb_root);
 
 	callchain_node__init_have_children_rb_tree(self);
 }
@@ -301,11 +301,11 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
 			if (first) {
 				first = false;
 				chain->ms.has_children = chain->list.next != &child->val ||
-							 rb_first(&child->rb_root) != NULL;
+							 !RB_EMPTY_ROOT(&child->rb_root);
 			} else {
 				extra_offset = LEVEL_OFFSET_STEP;
 				chain->ms.has_children = chain->list.next == &child->val &&
-							 rb_first(&child->rb_root) != NULL;
+							 !RB_EMPTY_ROOT(&child->rb_root);
 			}
 
 			folded_sign = callchain_list__folded(chain);
@@ -381,7 +381,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *self,
 		 * probably when the callchain is created, so as not to
 		 * traverse it all over again
 		 */
-		chain->ms.has_children = rb_first(&node->rb_root) != NULL;
+		chain->ms.has_children = !RB_EMPTY_ROOT(&node->rb_root);
 		folded_sign = callchain_list__folded(chain);
 
 		if (*row_offset != 0) {

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

* [tip:perf/core] perf hists browser: Init the has_children fields just once
       [not found]             ` <new-submission>
                                 ` (601 preceding siblings ...)
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT() tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-30  8:34               ` tip-bot for Arnaldo Carvalho de Melo
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Introduce "expand/collapse all callchains" action tip-bot for Arnaldo Carvalho de Melo
                                 ` (103 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-30  8:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, fweisbec, tglx

Commit-ID:  163caed90203a7cab66326ce2be138715dc7c5da
Gitweb:     http://git.kernel.org/tip/163caed90203a7cab66326ce2be138715dc7c5da
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 25 Aug 2010 16:30:03 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Aug 2010 16:30:03 -0300

perf hists browser: Init the has_children fields just once

Not everytime we show the callchains, removing duplicated initialization
of this field.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/hists.c |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index e61355e..c17611f 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -298,15 +298,10 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self,
 			int color;
 			bool was_first = first;
 
-			if (first) {
+			if (first)
 				first = false;
-				chain->ms.has_children = chain->list.next != &child->val ||
-							 !RB_EMPTY_ROOT(&child->rb_root);
-			} else {
+			else
 				extra_offset = LEVEL_OFFSET_STEP;
-				chain->ms.has_children = chain->list.next == &child->val &&
-							 !RB_EMPTY_ROOT(&child->rb_root);
-			}
 
 			folded_sign = callchain_list__folded(chain);
 			if (*row_offset != 0) {
@@ -376,12 +371,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *self,
 	list_for_each_entry(chain, &node->val, list) {
 		char ipstr[BITS_PER_LONG / 4 + 1], *s;
 		int color;
-		/*
-		 * FIXME: This should be moved to somewhere else,
-		 * probably when the callchain is created, so as not to
-		 * traverse it all over again
-		 */
-		chain->ms.has_children = !RB_EMPTY_ROOT(&node->rb_root);
+
 		folded_sign = callchain_list__folded(chain);
 
 		if (*row_offset != 0) {
@@ -457,7 +447,7 @@ static int hist_browser__show_entry(struct hist_browser *self,
 	}
 
 	if (symbol_conf.use_callchain) {
-		entry->ms.has_children = !RB_EMPTY_ROOT(&entry->sorted_chain);
+		hist_entry__init_have_children(entry);
 		folded_sign = hist_entry__folded(entry);
 	}
 

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

* [tip:perf/core] perf hists browser: Introduce "expand/collapse all callchains" action
       [not found]             ` <new-submission>
                                 ` (602 preceding siblings ...)
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Init the has_children fields just once tip-bot for Arnaldo Carvalho de Melo
@ 2010-08-30  8:34               ` tip-bot for Arnaldo Carvalho de Melo
  2010-09-09 19:45               ` [tip:perf/core] perf: Fix CPU hotplug tip-bot for Peter Zijlstra
                                 ` (102 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-08-30  8:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, acme, hpa, mingo, peterz, efault, hch,
	fweisbec, tglx

Commit-ID:  3c916cc28ca31892d96215eaf99c1d592884961d
Gitweb:     http://git.kernel.org/tip/3c916cc28ca31892d96215eaf99c1d592884961d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 25 Aug 2010 17:18:35 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Aug 2010 17:18:35 -0300

perf hists browser: Introduce "expand/collapse all callchains" action

When looking at a callchains enabled perf data file one can find it
tiresome to start with all callchains collapsed and then to have to go
one by one expanding them.

So associate 'E' with "Expand all callchains" and 'C' with "Collapse all
callchains".

This way now one can have the top level view and then switch to/from
having all callchains expanded.

More work is needed to allow expanding just from one branch down to its
leaves.

Reported-by: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/hists.c |  112 +++++++++++++++++++++++++++++++++--
 1 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index c17611f..2fc1ba3 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -58,6 +58,11 @@ static char callchain_list__folded(const struct callchain_list *self)
 	return map_symbol__folded(&self->ms);
 }
 
+static void map_symbol__set_folding(struct map_symbol *self, bool unfold)
+{
+	self->unfolded = unfold ? self->has_children : false;
+}
+
 static int callchain_node__count_rows_rb_tree(struct callchain_node *self)
 {
 	int n = 0;
@@ -196,11 +201,98 @@ static bool hist_browser__toggle_fold(struct hist_browser *self)
 	return false;
 }
 
+static int callchain_node__set_folding_rb_tree(struct callchain_node *self, bool unfold)
+{
+	int n = 0;
+	struct rb_node *nd;
+
+	for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) {
+		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_list *chain;
+		bool has_children = false;
+
+		list_for_each_entry(chain, &child->val, list) {
+			++n;
+			map_symbol__set_folding(&chain->ms, unfold);
+			has_children = chain->ms.has_children;
+		}
+
+		if (has_children)
+			n += callchain_node__set_folding_rb_tree(child, unfold);
+	}
+
+	return n;
+}
+
+static int callchain_node__set_folding(struct callchain_node *node, bool unfold)
+{
+	struct callchain_list *chain;
+	bool has_children = false;
+	int n = 0;
+
+	list_for_each_entry(chain, &node->val, list) {
+		++n;
+		map_symbol__set_folding(&chain->ms, unfold);
+		has_children = chain->ms.has_children;
+	}
+
+	if (has_children)
+		n += callchain_node__set_folding_rb_tree(node, unfold);
+
+	return n;
+}
+
+static int callchain__set_folding(struct rb_root *chain, bool unfold)
+{
+	struct rb_node *nd;
+	int n = 0;
+
+	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
+		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
+		n += callchain_node__set_folding(node, unfold);
+	}
+
+	return n;
+}
+
+static void hist_entry__set_folding(struct hist_entry *self, bool unfold)
+{
+	hist_entry__init_have_children(self);
+	map_symbol__set_folding(&self->ms, unfold);
+
+	if (self->ms.has_children) {
+		int n = callchain__set_folding(&self->sorted_chain, unfold);
+		self->nr_rows = unfold ? n : 0;
+	} else
+		self->nr_rows = 0;
+}
+
+static void hists__set_folding(struct hists *self, bool unfold)
+{
+	struct rb_node *nd;
+
+	self->nr_entries = 0;
+
+	for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
+		struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
+		hist_entry__set_folding(he, unfold);
+		self->nr_entries += 1 + he->nr_rows;
+	}
+}
+
+static void hist_browser__set_folding(struct hist_browser *self, bool unfold)
+{
+	hists__set_folding(self->hists, unfold);
+	self->b.nr_entries = self->hists->nr_entries;
+	/* Go to the start, we may be way after valid entries after a collapse */
+	ui_browser__reset_index(&self->b);
+}
+
 static int hist_browser__run(struct hist_browser *self, const char *title)
 {
 	int key;
-	int exit_keys[] = { 'a', '?', 'h', 'd', 'D', 't', NEWT_KEY_ENTER,
-			    NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, };
+	int exit_keys[] = { 'a', '?', 'h', 'C', 'd', 'D', 'E', 't',
+			    NEWT_KEY_ENTER, NEWT_KEY_RIGHT, NEWT_KEY_LEFT, 0, };
 	char str[256], unit;
 	unsigned long nr_events = self->hists->stats.nr_events[PERF_RECORD_SAMPLE];
 
@@ -237,7 +329,15 @@ static int hist_browser__run(struct hist_browser *self, const char *title)
 					   self->b.top_idx,
 					   h->row_offset, h->nr_rows);
 		}
-			continue;
+			break;
+		case 'C':
+			/* Collapse the whole world. */
+			hist_browser__set_folding(self, false);
+			break;
+		case 'E':
+			/* Expand the whole world. */
+			hist_browser__set_folding(self, true);
+			break;
 		case NEWT_KEY_ENTER:
 			if (hist_browser__toggle_fold(self))
 				break;
@@ -734,8 +834,6 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 		dso = browser->selection->map ? browser->selection->map->dso : NULL;
 
 		switch (key) {
-		case NEWT_KEY_F1:
-			goto do_help;
 		case NEWT_KEY_TAB:
 		case NEWT_KEY_UNTAB:
 			/*
@@ -752,13 +850,15 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name)
 			goto zoom_dso;
 		case 't':
 			goto zoom_thread;
+		case NEWT_KEY_F1:
 		case 'h':
 		case '?':
-do_help:
 			ui__help_window("->        Zoom into DSO/Threads & Annotate current symbol\n"
 					"<-        Zoom out\n"
 					"a         Annotate current symbol\n"
 					"h/?/F1    Show this window\n"
+					"C         Collapse all callchains\n"
+					"E         Expand all callchains\n"
 					"d         Zoom into current DSO\n"
 					"t         Zoom into current Thread\n"
 					"q/CTRL+C  Exit browser");

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

* [tip:perf/core] perf: Fix CPU hotplug
       [not found]             ` <new-submission>
                                 ` (603 preceding siblings ...)
  2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Introduce "expand/collapse all callchains" action tip-bot for Arnaldo Carvalho de Melo
@ 2010-09-09 19:45               ` tip-bot for Peter Zijlstra
  2010-09-09 19:47               ` [tip:perf/core] perf: Deconstify struct pmu tip-bot for Peter Zijlstra
                                 ` (101 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5e11637e2c929e34dcc0fbbfb48bdb638937701a
Gitweb:     http://git.kernel.org/tip/5e11637e2c929e34dcc0fbbfb48bdb638937701a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Jun 2010 13:35:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:38:52 +0200

perf: Fix CPU hotplug

Since we have UP_PREPARE, we should also have UP_CANCELED.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 657555a..db5b560 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5761,15 +5761,15 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 {
 	unsigned int cpu = (long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
+	case CPU_DOWN_FAILED:
 		perf_event_init_cpu(cpu);
 		break;
 
+	case CPU_UP_CANCELED:
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		perf_event_exit_cpu(cpu);
 		break;
 

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

* [tip:perf/core] perf: Deconstify struct pmu
       [not found]             ` <new-submission>
                                 ` (604 preceding siblings ...)
  2010-09-09 19:45               ` [tip:perf/core] perf: Fix CPU hotplug tip-bot for Peter Zijlstra
@ 2010-09-09 19:47               ` tip-bot for Peter Zijlstra
  2010-09-09 19:47               ` [tip:perf/core] perf: Register PMU implementations tip-bot for Peter Zijlstra
                                 ` (100 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  51b0fe39549a04858001922919ab355dee9bdfcf
Gitweb:     http://git.kernel.org/tip/51b0fe39549a04858001922919ab355dee9bdfcf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Jun 2010 13:35:57 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:27 +0200

perf: Deconstify struct pmu

sed -ie 's/const struct pmu\>/struct pmu/g' `git grep -l "const struct pmu\>"`

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c           |    4 ++--
 arch/arm/kernel/perf_event.c             |    2 +-
 arch/powerpc/kernel/perf_event.c         |    8 ++++----
 arch/powerpc/kernel/perf_event_fsl_emb.c |    2 +-
 arch/sh/kernel/perf_event.c              |    4 ++--
 arch/sparc/kernel/perf_event.c           |   10 +++++-----
 arch/x86/kernel/cpu/perf_event.c         |   14 +++++++-------
 include/linux/perf_event.h               |   10 +++++-----
 kernel/perf_event.c                      |   26 +++++++++++++-------------
 9 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 51c39fa..56fa415 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -642,7 +642,7 @@ static int __hw_perf_event_init(struct perf_event *event)
 	return 0;
 }
 
-static const struct pmu pmu = {
+static struct pmu pmu = {
 	.enable		= alpha_pmu_enable,
 	.disable	= alpha_pmu_disable,
 	.read		= alpha_pmu_read,
@@ -653,7 +653,7 @@ static const struct pmu pmu = {
 /*
  * Main entry point to initialise a HW performance event.
  */
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	int err;
 
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 64ca8c3..0671e92 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -491,7 +491,7 @@ __hw_perf_event_init(struct perf_event *event)
 	return err;
 }
 
-const struct pmu *
+struct pmu *
 hw_perf_event_init(struct perf_event *event)
 {
 	int err = 0;
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index d301a30..5f78681 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -857,7 +857,7 @@ static void power_pmu_unthrottle(struct perf_event *event)
  * Set the flag to make pmu::enable() not perform the
  * schedulability test, it will be performed at commit time
  */
-void power_pmu_start_txn(const struct pmu *pmu)
+void power_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
@@ -870,7 +870,7 @@ void power_pmu_start_txn(const struct pmu *pmu)
  * Clear the flag and pmu::enable() will perform the
  * schedulability test.
  */
-void power_pmu_cancel_txn(const struct pmu *pmu)
+void power_pmu_cancel_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
@@ -882,7 +882,7 @@ void power_pmu_cancel_txn(const struct pmu *pmu)
  * Perform the group schedulability test as a whole
  * Return 0 if success
  */
-int power_pmu_commit_txn(const struct pmu *pmu)
+int power_pmu_commit_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	long i, n;
@@ -1014,7 +1014,7 @@ static int hw_perf_cache_event(u64 config, u64 *eventp)
 	return 0;
 }
 
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	u64 ev;
 	unsigned long flags;
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index 1ba4547..d7619b5 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -428,7 +428,7 @@ static int hw_perf_cache_event(u64 config, u64 *eventp)
 	return 0;
 }
 
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	u64 ev;
 	struct perf_event *events[MAX_HWEVENTS];
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 7a3dc35..395572c 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -257,13 +257,13 @@ static void sh_pmu_read(struct perf_event *event)
 	sh_perf_event_update(event, &event->hw, event->hw.idx);
 }
 
-static const struct pmu pmu = {
+static struct pmu pmu = {
 	.enable		= sh_pmu_enable,
 	.disable	= sh_pmu_disable,
 	.read		= sh_pmu_read,
 };
 
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	int err = __hw_perf_event_init(event);
 	if (unlikely(err)) {
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 4bc4029..481b894 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1099,7 +1099,7 @@ static int __hw_perf_event_init(struct perf_event *event)
  * Set the flag to make pmu::enable() not perform the
  * schedulability test, it will be performed at commit time
  */
-static void sparc_pmu_start_txn(const struct pmu *pmu)
+static void sparc_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
@@ -1111,7 +1111,7 @@ static void sparc_pmu_start_txn(const struct pmu *pmu)
  * Clear the flag and pmu::enable() will perform the
  * schedulability test.
  */
-static void sparc_pmu_cancel_txn(const struct pmu *pmu)
+static void sparc_pmu_cancel_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
@@ -1123,7 +1123,7 @@ static void sparc_pmu_cancel_txn(const struct pmu *pmu)
  * Perform the group schedulability test as a whole
  * Return 0 if success
  */
-static int sparc_pmu_commit_txn(const struct pmu *pmu)
+static int sparc_pmu_commit_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int n;
@@ -1142,7 +1142,7 @@ static int sparc_pmu_commit_txn(const struct pmu *pmu)
 	return 0;
 }
 
-static const struct pmu pmu = {
+static struct pmu pmu = {
 	.enable		= sparc_pmu_enable,
 	.disable	= sparc_pmu_disable,
 	.read		= sparc_pmu_read,
@@ -1152,7 +1152,7 @@ static const struct pmu pmu = {
 	.commit_txn	= sparc_pmu_commit_txn,
 };
 
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	int err = __hw_perf_event_init(event);
 
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index de6569c..fdd97f2 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -618,7 +618,7 @@ static void x86_pmu_enable_all(int added)
 	}
 }
 
-static const struct pmu pmu;
+static struct pmu pmu;
 
 static inline int is_x86_event(struct perf_event *event)
 {
@@ -1427,7 +1427,7 @@ static inline void x86_pmu_read(struct perf_event *event)
  * Set the flag to make pmu::enable() not perform the
  * schedulability test, it will be performed at commit time
  */
-static void x86_pmu_start_txn(const struct pmu *pmu)
+static void x86_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1440,7 +1440,7 @@ static void x86_pmu_start_txn(const struct pmu *pmu)
  * Clear the flag and pmu::enable() will perform the
  * schedulability test.
  */
-static void x86_pmu_cancel_txn(const struct pmu *pmu)
+static void x86_pmu_cancel_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -1457,7 +1457,7 @@ static void x86_pmu_cancel_txn(const struct pmu *pmu)
  * Perform the group schedulability test as a whole
  * Return 0 if success
  */
-static int x86_pmu_commit_txn(const struct pmu *pmu)
+static int x86_pmu_commit_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int assign[X86_PMC_IDX_MAX];
@@ -1483,7 +1483,7 @@ static int x86_pmu_commit_txn(const struct pmu *pmu)
 	return 0;
 }
 
-static const struct pmu pmu = {
+static struct pmu pmu = {
 	.enable		= x86_pmu_enable,
 	.disable	= x86_pmu_disable,
 	.start		= x86_pmu_start,
@@ -1569,9 +1569,9 @@ out:
 	return ret;
 }
 
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+struct pmu *hw_perf_event_init(struct perf_event *event)
 {
-	const struct pmu *tmp;
+	struct pmu *tmp;
 	int err;
 
 	err = __hw_perf_event_init(event);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 000610c..09d048b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -578,19 +578,19 @@ struct pmu {
 	 * Start the transaction, after this ->enable() doesn't need
 	 * to do schedulability tests.
 	 */
-	void (*start_txn)	(const struct pmu *pmu);
+	void (*start_txn)	(struct pmu *pmu);
 	/*
 	 * If ->start_txn() disabled the ->enable() schedulability test
 	 * then ->commit_txn() is required to perform one. On success
 	 * the transaction is closed. On error the transaction is kept
 	 * open until ->cancel_txn() is called.
 	 */
-	int  (*commit_txn)	(const struct pmu *pmu);
+	int  (*commit_txn)	(struct pmu *pmu);
 	/*
 	 * Will cancel the transaction, assumes ->disable() is called for
 	 * each successfull ->enable() during the transaction.
 	 */
-	void (*cancel_txn)	(const struct pmu *pmu);
+	void (*cancel_txn)	(struct pmu *pmu);
 };
 
 /**
@@ -669,7 +669,7 @@ struct perf_event {
 	int				nr_siblings;
 	int				group_flags;
 	struct perf_event		*group_leader;
-	const struct pmu		*pmu;
+	struct pmu		*pmu;
 
 	enum perf_event_active_state	state;
 	unsigned int			attach_state;
@@ -849,7 +849,7 @@ struct perf_output_handle {
  */
 extern int perf_max_events;
 
-extern const struct pmu *hw_perf_event_init(struct perf_event *event);
+extern struct pmu *hw_perf_event_init(struct perf_event *event);
 
 extern void perf_event_task_sched_in(struct task_struct *task);
 extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2d74f31..fb46fd1 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -75,7 +75,7 @@ static DEFINE_SPINLOCK(perf_resource_lock);
 /*
  * Architecture provided APIs - weak aliases:
  */
-extern __weak const struct pmu *hw_perf_event_init(struct perf_event *event)
+extern __weak struct pmu *hw_perf_event_init(struct perf_event *event)
 {
 	return NULL;
 }
@@ -691,7 +691,7 @@ group_sched_in(struct perf_event *group_event,
 	       struct perf_event_context *ctx)
 {
 	struct perf_event *event, *partial_group = NULL;
-	const struct pmu *pmu = group_event->pmu;
+	struct pmu *pmu = group_event->pmu;
 	bool txn = false;
 
 	if (group_event->state == PERF_EVENT_STATE_OFF)
@@ -4501,7 +4501,7 @@ static int perf_swevent_int(struct perf_event *event)
 	return 0;
 }
 
-static const struct pmu perf_ops_generic = {
+static struct pmu perf_ops_generic = {
 	.enable		= perf_swevent_enable,
 	.disable	= perf_swevent_disable,
 	.start		= perf_swevent_int,
@@ -4614,7 +4614,7 @@ static void cpu_clock_perf_event_read(struct perf_event *event)
 	cpu_clock_perf_event_update(event);
 }
 
-static const struct pmu perf_ops_cpu_clock = {
+static struct pmu perf_ops_cpu_clock = {
 	.enable		= cpu_clock_perf_event_enable,
 	.disable	= cpu_clock_perf_event_disable,
 	.read		= cpu_clock_perf_event_read,
@@ -4671,7 +4671,7 @@ static void task_clock_perf_event_read(struct perf_event *event)
 	task_clock_perf_event_update(event, time);
 }
 
-static const struct pmu perf_ops_task_clock = {
+static struct pmu perf_ops_task_clock = {
 	.enable		= task_clock_perf_event_enable,
 	.disable	= task_clock_perf_event_disable,
 	.read		= task_clock_perf_event_read,
@@ -4785,7 +4785,7 @@ static int swevent_hlist_get(struct perf_event *event)
 
 #ifdef CONFIG_EVENT_TRACING
 
-static const struct pmu perf_ops_tracepoint = {
+static struct pmu perf_ops_tracepoint = {
 	.enable		= perf_trace_enable,
 	.disable	= perf_trace_disable,
 	.start		= perf_swevent_int,
@@ -4849,7 +4849,7 @@ static void tp_perf_event_destroy(struct perf_event *event)
 	perf_trace_destroy(event);
 }
 
-static const struct pmu *tp_perf_event_init(struct perf_event *event)
+static struct pmu *tp_perf_event_init(struct perf_event *event)
 {
 	int err;
 
@@ -4896,7 +4896,7 @@ static void perf_event_free_filter(struct perf_event *event)
 
 #else
 
-static const struct pmu *tp_perf_event_init(struct perf_event *event)
+static struct pmu *tp_perf_event_init(struct perf_event *event)
 {
 	return NULL;
 }
@@ -4918,7 +4918,7 @@ static void bp_perf_event_destroy(struct perf_event *event)
 	release_bp_slot(event);
 }
 
-static const struct pmu *bp_perf_event_init(struct perf_event *bp)
+static struct pmu *bp_perf_event_init(struct perf_event *bp)
 {
 	int err;
 
@@ -4942,7 +4942,7 @@ void perf_bp_event(struct perf_event *bp, void *data)
 		perf_swevent_add(bp, 1, 1, &sample, regs);
 }
 #else
-static const struct pmu *bp_perf_event_init(struct perf_event *bp)
+static struct pmu *bp_perf_event_init(struct perf_event *bp)
 {
 	return NULL;
 }
@@ -4964,9 +4964,9 @@ static void sw_perf_event_destroy(struct perf_event *event)
 	swevent_hlist_put(event);
 }
 
-static const struct pmu *sw_perf_event_init(struct perf_event *event)
+static struct pmu *sw_perf_event_init(struct perf_event *event)
 {
-	const struct pmu *pmu = NULL;
+	struct pmu *pmu = NULL;
 	u64 event_id = event->attr.config;
 
 	/*
@@ -5028,7 +5028,7 @@ perf_event_alloc(struct perf_event_attr *attr,
 		   perf_overflow_handler_t overflow_handler,
 		   gfp_t gfpflags)
 {
-	const struct pmu *pmu;
+	struct pmu *pmu;
 	struct perf_event *event;
 	struct hw_perf_event *hwc;
 	long err;

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

* [tip:perf/core] perf: Register PMU implementations
       [not found]             ` <new-submission>
                                 ` (605 preceding siblings ...)
  2010-09-09 19:47               ` [tip:perf/core] perf: Deconstify struct pmu tip-bot for Peter Zijlstra
@ 2010-09-09 19:47               ` tip-bot for Peter Zijlstra
  2010-09-09 19:48               ` [tip:perf/core] perf: Unindent labels tip-bot for Peter Zijlstra
                                 ` (99 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  b0a873ebbf87bf38bf70b5e39a7cadc96099fa13
Gitweb:     http://git.kernel.org/tip/b0a873ebbf87bf38bf70b5e39a7cadc96099fa13
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Jun 2010 13:35:08 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:28 +0200

perf: Register PMU implementations

Simple registration interface for struct pmu, this provides the
infrastructure for removing all the weak functions.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c           |   37 ++-
 arch/arm/kernel/perf_event.c             |   38 ++-
 arch/powerpc/kernel/perf_event.c         |   46 ++--
 arch/powerpc/kernel/perf_event_fsl_emb.c |   37 +-
 arch/sh/kernel/perf_event.c              |   35 ++-
 arch/sparc/kernel/perf_event.c           |   29 +-
 arch/x86/kernel/cpu/perf_event.c         |   45 ++-
 include/linux/perf_event.h               |   10 +-
 kernel/hw_breakpoint.c                   |   35 ++-
 kernel/perf_event.c                      |  588 +++++++++++++++---------------
 10 files changed, 488 insertions(+), 412 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 56fa415..19660b5 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -642,34 +642,39 @@ static int __hw_perf_event_init(struct perf_event *event)
 	return 0;
 }
 
-static struct pmu pmu = {
-	.enable		= alpha_pmu_enable,
-	.disable	= alpha_pmu_disable,
-	.read		= alpha_pmu_read,
-	.unthrottle	= alpha_pmu_unthrottle,
-};
-
-
 /*
  * Main entry point to initialise a HW performance event.
  */
-struct pmu *hw_perf_event_init(struct perf_event *event)
+static int alpha_pmu_event_init(struct perf_event *event)
 {
 	int err;
 
+	switch (event->attr.type) {
+	case PERF_TYPE_RAW:
+	case PERF_TYPE_HARDWARE:
+	case PERF_TYPE_HW_CACHE:
+		break;
+
+	default:
+		return -ENOENT;
+	}
+
 	if (!alpha_pmu)
-		return ERR_PTR(-ENODEV);
+		return -ENODEV;
 
 	/* Do the real initialisation work. */
 	err = __hw_perf_event_init(event);
 
-	if (err)
-		return ERR_PTR(err);
-
-	return &pmu;
+	return err;
 }
 
-
+static struct pmu pmu = {
+	.event_init	= alpha_pmu_event_init,
+	.enable		= alpha_pmu_enable,
+	.disable	= alpha_pmu_disable,
+	.read		= alpha_pmu_read,
+	.unthrottle	= alpha_pmu_unthrottle,
+};
 
 /*
  * Main entry point - enable HW performance counters.
@@ -838,5 +843,7 @@ void __init init_hw_perf_events(void)
 	/* And set up PMU specification */
 	alpha_pmu = &ev67_pmu;
 	perf_max_events = alpha_pmu->num_pmcs;
+
+	perf_pmu_register(&pmu);
 }
 
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 0671e92..f62f9db 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -306,12 +306,7 @@ out:
 	return err;
 }
 
-static struct pmu pmu = {
-	.enable	    = armpmu_enable,
-	.disable    = armpmu_disable,
-	.unthrottle = armpmu_unthrottle,
-	.read	    = armpmu_read,
-};
+static struct pmu pmu;
 
 static int
 validate_event(struct cpu_hw_events *cpuc,
@@ -491,20 +486,29 @@ __hw_perf_event_init(struct perf_event *event)
 	return err;
 }
 
-struct pmu *
-hw_perf_event_init(struct perf_event *event)
+static int armpmu_event_init(struct perf_event *event)
 {
 	int err = 0;
 
+	switch (event->attr.type) {
+	case PERF_TYPE_RAW:
+	case PERF_TYPE_HARDWARE:
+	case PERF_TYPE_HW_CACHE:
+		break;
+
+	default:
+		return -ENOENT;
+	}
+
 	if (!armpmu)
-		return ERR_PTR(-ENODEV);
+		return -ENODEV;
 
 	event->destroy = hw_perf_event_destroy;
 
 	if (!atomic_inc_not_zero(&active_events)) {
 		if (atomic_read(&active_events) > perf_max_events) {
 			atomic_dec(&active_events);
-			return ERR_PTR(-ENOSPC);
+			return -ENOSPC;
 		}
 
 		mutex_lock(&pmu_reserve_mutex);
@@ -518,15 +522,23 @@ hw_perf_event_init(struct perf_event *event)
 	}
 
 	if (err)
-		return ERR_PTR(err);
+		return err;
 
 	err = __hw_perf_event_init(event);
 	if (err)
 		hw_perf_event_destroy(event);
 
-	return err ? ERR_PTR(err) : &pmu;
+	return err;
 }
 
+static struct pmu pmu = {
+	.event_init = armpmu_event_init,
+	.enable	    = armpmu_enable,
+	.disable    = armpmu_disable,
+	.unthrottle = armpmu_unthrottle,
+	.read	    = armpmu_read,
+};
+
 void
 hw_perf_enable(void)
 {
@@ -2994,6 +3006,8 @@ init_hw_perf_events(void)
 		perf_max_events = -1;
 	}
 
+	perf_pmu_register(&pmu);
+
 	return 0;
 }
 arch_initcall(init_hw_perf_events);
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index 5f78681..19131b2 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -904,16 +904,6 @@ int power_pmu_commit_txn(struct pmu *pmu)
 	return 0;
 }
 
-struct pmu power_pmu = {
-	.enable		= power_pmu_enable,
-	.disable	= power_pmu_disable,
-	.read		= power_pmu_read,
-	.unthrottle	= power_pmu_unthrottle,
-	.start_txn	= power_pmu_start_txn,
-	.cancel_txn	= power_pmu_cancel_txn,
-	.commit_txn	= power_pmu_commit_txn,
-};
-
 /*
  * Return 1 if we might be able to put event on a limited PMC,
  * or 0 if not.
@@ -1014,7 +1004,7 @@ static int hw_perf_cache_event(u64 config, u64 *eventp)
 	return 0;
 }
 
-struct pmu *hw_perf_event_init(struct perf_event *event)
+static int power_pmu_event_init(struct perf_event *event)
 {
 	u64 ev;
 	unsigned long flags;
@@ -1026,25 +1016,27 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	struct cpu_hw_events *cpuhw;
 
 	if (!ppmu)
-		return ERR_PTR(-ENXIO);
+		return -ENOENT;
+
 	switch (event->attr.type) {
 	case PERF_TYPE_HARDWARE:
 		ev = event->attr.config;
 		if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
-			return ERR_PTR(-EOPNOTSUPP);
+			return -EOPNOTSUPP;
 		ev = ppmu->generic_events[ev];
 		break;
 	case PERF_TYPE_HW_CACHE:
 		err = hw_perf_cache_event(event->attr.config, &ev);
 		if (err)
-			return ERR_PTR(err);
+			return err;
 		break;
 	case PERF_TYPE_RAW:
 		ev = event->attr.config;
 		break;
 	default:
-		return ERR_PTR(-EINVAL);
+		return -ENOENT;
 	}
+
 	event->hw.config_base = ev;
 	event->hw.idx = 0;
 
@@ -1081,7 +1073,7 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 			 */
 			ev = normal_pmc_alternative(ev, flags);
 			if (!ev)
-				return ERR_PTR(-EINVAL);
+				return -EINVAL;
 		}
 	}
 
@@ -1095,19 +1087,19 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 		n = collect_events(event->group_leader, ppmu->n_counter - 1,
 				   ctrs, events, cflags);
 		if (n < 0)
-			return ERR_PTR(-EINVAL);
+			return -EINVAL;
 	}
 	events[n] = ev;
 	ctrs[n] = event;
 	cflags[n] = flags;
 	if (check_excludes(ctrs, cflags, n, 1))
-		return ERR_PTR(-EINVAL);
+		return -EINVAL;
 
 	cpuhw = &get_cpu_var(cpu_hw_events);
 	err = power_check_constraints(cpuhw, events, cflags, n + 1);
 	put_cpu_var(cpu_hw_events);
 	if (err)
-		return ERR_PTR(-EINVAL);
+		return -EINVAL;
 
 	event->hw.config = events[n];
 	event->hw.event_base = cflags[n];
@@ -1132,11 +1124,20 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	}
 	event->destroy = hw_perf_event_destroy;
 
-	if (err)
-		return ERR_PTR(err);
-	return &power_pmu;
+	return err;
 }
 
+struct pmu power_pmu = {
+	.event_init	= power_pmu_event_init,
+	.enable		= power_pmu_enable,
+	.disable	= power_pmu_disable,
+	.read		= power_pmu_read,
+	.unthrottle	= power_pmu_unthrottle,
+	.start_txn	= power_pmu_start_txn,
+	.cancel_txn	= power_pmu_cancel_txn,
+	.commit_txn	= power_pmu_commit_txn,
+};
+
 /*
  * A counter has overflowed; update its count and record
  * things if requested.  Note that interrupts are hard-disabled
@@ -1342,6 +1343,7 @@ int register_power_pmu(struct power_pmu *pmu)
 		freeze_events_kernel = MMCR0_FCHV;
 #endif /* CONFIG_PPC64 */
 
+	perf_pmu_register(&power_pmu);
 	perf_cpu_notifier(power_pmu_notifier);
 
 	return 0;
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index d7619b5..ea6a804 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -378,13 +378,6 @@ static void fsl_emb_pmu_unthrottle(struct perf_event *event)
 	local_irq_restore(flags);
 }
 
-static struct pmu fsl_emb_pmu = {
-	.enable		= fsl_emb_pmu_enable,
-	.disable	= fsl_emb_pmu_disable,
-	.read		= fsl_emb_pmu_read,
-	.unthrottle	= fsl_emb_pmu_unthrottle,
-};
-
 /*
  * Release the PMU if this is the last perf_event.
  */
@@ -428,7 +421,7 @@ static int hw_perf_cache_event(u64 config, u64 *eventp)
 	return 0;
 }
 
-struct pmu *hw_perf_event_init(struct perf_event *event)
+static int fsl_emb_pmu_event_init(struct perf_event *event)
 {
 	u64 ev;
 	struct perf_event *events[MAX_HWEVENTS];
@@ -441,14 +434,14 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	case PERF_TYPE_HARDWARE:
 		ev = event->attr.config;
 		if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
-			return ERR_PTR(-EOPNOTSUPP);
+			return -EOPNOTSUPP;
 		ev = ppmu->generic_events[ev];
 		break;
 
 	case PERF_TYPE_HW_CACHE:
 		err = hw_perf_cache_event(event->attr.config, &ev);
 		if (err)
-			return ERR_PTR(err);
+			return err;
 		break;
 
 	case PERF_TYPE_RAW:
@@ -456,12 +449,12 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 		break;
 
 	default:
-		return ERR_PTR(-EINVAL);
+		return -ENOENT;
 	}
 
 	event->hw.config = ppmu->xlate_event(ev);
 	if (!(event->hw.config & FSL_EMB_EVENT_VALID))
-		return ERR_PTR(-EINVAL);
+		return -EINVAL;
 
 	/*
 	 * If this is in a group, check if it can go on with all the
@@ -473,7 +466,7 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 		n = collect_events(event->group_leader,
 		                   ppmu->n_counter - 1, events);
 		if (n < 0)
-			return ERR_PTR(-EINVAL);
+			return -EINVAL;
 	}
 
 	if (event->hw.config & FSL_EMB_EVENT_RESTRICTED) {
@@ -484,7 +477,7 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 		}
 
 		if (num_restricted >= ppmu->n_restricted)
-			return ERR_PTR(-EINVAL);
+			return -EINVAL;
 	}
 
 	event->hw.idx = -1;
@@ -497,7 +490,7 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	if (event->attr.exclude_kernel)
 		event->hw.config_base |= PMLCA_FCS;
 	if (event->attr.exclude_idle)
-		return ERR_PTR(-ENOTSUPP);
+		return -ENOTSUPP;
 
 	event->hw.last_period = event->hw.sample_period;
 	local64_set(&event->hw.period_left, event->hw.last_period);
@@ -523,11 +516,17 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	}
 	event->destroy = hw_perf_event_destroy;
 
-	if (err)
-		return ERR_PTR(err);
-	return &fsl_emb_pmu;
+	return err;
 }
 
+static struct pmu fsl_emb_pmu = {
+	.event_init	= fsl_emb_pmu_event_init,
+	.enable		= fsl_emb_pmu_enable,
+	.disable	= fsl_emb_pmu_disable,
+	.read		= fsl_emb_pmu_read,
+	.unthrottle	= fsl_emb_pmu_unthrottle,
+};
+
 /*
  * A counter has overflowed; update its count and record
  * things if requested.  Note that interrupts are hard-disabled
@@ -651,5 +650,7 @@ int register_fsl_emb_pmu(struct fsl_emb_pmu *pmu)
 	pr_info("%s performance monitor hardware support registered\n",
 		pmu->name);
 
+	perf_pmu_register(&fsl_emb_pmu);
+
 	return 0;
 }
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 395572c..8cb2065 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -257,26 +257,38 @@ static void sh_pmu_read(struct perf_event *event)
 	sh_perf_event_update(event, &event->hw, event->hw.idx);
 }
 
-static struct pmu pmu = {
-	.enable		= sh_pmu_enable,
-	.disable	= sh_pmu_disable,
-	.read		= sh_pmu_read,
-};
-
-struct pmu *hw_perf_event_init(struct perf_event *event)
+static int sh_pmu_event_init(struct perf_event *event)
 {
-	int err = __hw_perf_event_init(event);
+	int err;
+
+	switch (event->attr.type) {
+	case PERF_TYPE_RAW:
+	case PERF_TYPE_HW_CACHE:
+	case PERF_TYPE_HARDWARE:
+		err = __hw_perf_event_init(event);
+		break;
+
+	default:
+		return -ENOENT;
+	}
+
 	if (unlikely(err)) {
 		if (event->destroy)
 			event->destroy(event);
-		return ERR_PTR(err);
 	}
 
-	return &pmu;
+	return err;
 }
 
+static struct pmu pmu = {
+	.event_init	= sh_pmu_event_init,
+	.enable		= sh_pmu_enable,
+	.disable	= sh_pmu_disable,
+	.read		= sh_pmu_read,
+};
+
 static void sh_pmu_setup(int cpu)
-{
+
 	struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
 
 	memset(cpuhw, 0, sizeof(struct cpu_hw_events));
@@ -325,6 +337,7 @@ int __cpuinit register_sh_pmu(struct sh_pmu *pmu)
 
 	WARN_ON(pmu->num_events > MAX_HWEVENTS);
 
+	perf_pmu_register(&pmu);
 	perf_cpu_notifier(sh_pmu_notifier);
 	return 0;
 }
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 481b894..bed4327 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1025,7 +1025,7 @@ out:
 	return ret;
 }
 
-static int __hw_perf_event_init(struct perf_event *event)
+static int sparc_pmu_event_init(struct perf_event *event)
 {
 	struct perf_event_attr *attr = &event->attr;
 	struct perf_event *evts[MAX_HWEVENTS];
@@ -1038,17 +1038,27 @@ static int __hw_perf_event_init(struct perf_event *event)
 	if (atomic_read(&nmi_active) < 0)
 		return -ENODEV;
 
-	if (attr->type == PERF_TYPE_HARDWARE) {
+	switch (attr->type) {
+	case PERF_TYPE_HARDWARE:
 		if (attr->config >= sparc_pmu->max_events)
 			return -EINVAL;
 		pmap = sparc_pmu->event_map(attr->config);
-	} else if (attr->type == PERF_TYPE_HW_CACHE) {
+		break;
+
+	case PERF_TYPE_HW_CACHE:
 		pmap = sparc_map_cache_event(attr->config);
 		if (IS_ERR(pmap))
 			return PTR_ERR(pmap);
-	} else
+		break;
+
+	case PERF_TYPE_RAW:
 		return -EOPNOTSUPP;
 
+	default:
+		return -ENOENT;
+
+	}
+
 	/* We save the enable bits in the config_base.  */
 	hwc->config_base = sparc_pmu->irq_bit;
 	if (!attr->exclude_user)
@@ -1143,6 +1153,7 @@ static int sparc_pmu_commit_txn(struct pmu *pmu)
 }
 
 static struct pmu pmu = {
+	.event_init	= sparc_pmu_event_init,
 	.enable		= sparc_pmu_enable,
 	.disable	= sparc_pmu_disable,
 	.read		= sparc_pmu_read,
@@ -1152,15 +1163,6 @@ static struct pmu pmu = {
 	.commit_txn	= sparc_pmu_commit_txn,
 };
 
-struct pmu *hw_perf_event_init(struct perf_event *event)
-{
-	int err = __hw_perf_event_init(event);
-
-	if (err)
-		return ERR_PTR(err);
-	return &pmu;
-}
-
 void perf_event_print_debug(void)
 {
 	unsigned long flags;
@@ -1280,6 +1282,7 @@ void __init init_hw_perf_events(void)
 	/* All sparc64 PMUs currently have 2 events.  */
 	perf_max_events = 2;
 
+	perf_pmu_register(&pmu);
 	register_die_notifier(&perf_event_nmi_notifier);
 }
 
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index fdd97f2..2c89264 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -530,7 +530,7 @@ static int x86_pmu_hw_config(struct perf_event *event)
 /*
  * Setup the hardware configuration for a given attr_type
  */
-static int __hw_perf_event_init(struct perf_event *event)
+static int __x86_pmu_event_init(struct perf_event *event)
 {
 	int err;
 
@@ -1414,6 +1414,7 @@ void __init init_hw_perf_events(void)
 	pr_info("... fixed-purpose events:   %d\n",     x86_pmu.num_counters_fixed);
 	pr_info("... event mask:             %016Lx\n", x86_pmu.intel_ctrl);
 
+	perf_pmu_register(&pmu);
 	perf_cpu_notifier(x86_pmu_notifier);
 }
 
@@ -1483,18 +1484,6 @@ static int x86_pmu_commit_txn(struct pmu *pmu)
 	return 0;
 }
 
-static struct pmu pmu = {
-	.enable		= x86_pmu_enable,
-	.disable	= x86_pmu_disable,
-	.start		= x86_pmu_start,
-	.stop		= x86_pmu_stop,
-	.read		= x86_pmu_read,
-	.unthrottle	= x86_pmu_unthrottle,
-	.start_txn	= x86_pmu_start_txn,
-	.cancel_txn	= x86_pmu_cancel_txn,
-	.commit_txn	= x86_pmu_commit_txn,
-};
-
 /*
  * validate that we can schedule this event
  */
@@ -1569,12 +1558,22 @@ out:
 	return ret;
 }
 
-struct pmu *hw_perf_event_init(struct perf_event *event)
+int x86_pmu_event_init(struct perf_event *event)
 {
 	struct pmu *tmp;
 	int err;
 
-	err = __hw_perf_event_init(event);
+	switch (event->attr.type) {
+	case PERF_TYPE_RAW:
+	case PERF_TYPE_HARDWARE:
+	case PERF_TYPE_HW_CACHE:
+		break;
+
+	default:
+		return -ENOENT;
+	}
+
+	err = __x86_pmu_event_init(event);
 	if (!err) {
 		/*
 		 * we temporarily connect event to its pmu
@@ -1594,12 +1593,24 @@ struct pmu *hw_perf_event_init(struct perf_event *event)
 	if (err) {
 		if (event->destroy)
 			event->destroy(event);
-		return ERR_PTR(err);
 	}
 
-	return &pmu;
+	return err;
 }
 
+static struct pmu pmu = {
+	.event_init	= x86_pmu_event_init,
+	.enable		= x86_pmu_enable,
+	.disable	= x86_pmu_disable,
+	.start		= x86_pmu_start,
+	.stop		= x86_pmu_stop,
+	.read		= x86_pmu_read,
+	.unthrottle	= x86_pmu_unthrottle,
+	.start_txn	= x86_pmu_start_txn,
+	.cancel_txn	= x86_pmu_cancel_txn,
+	.commit_txn	= x86_pmu_commit_txn,
+};
+
 /*
  * callchain support
  */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 09d048b..ab72f56 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -561,6 +561,13 @@ struct perf_event;
  * struct pmu - generic performance monitoring unit
  */
 struct pmu {
+	struct list_head		entry;
+
+	/*
+	 * Should return -ENOENT when the @event doesn't match this pmu
+	 */
+	int (*event_init)		(struct perf_event *event);
+
 	int (*enable)			(struct perf_event *event);
 	void (*disable)			(struct perf_event *event);
 	int (*start)			(struct perf_event *event);
@@ -849,7 +856,8 @@ struct perf_output_handle {
  */
 extern int perf_max_events;
 
-extern struct pmu *hw_perf_event_init(struct perf_event *event);
+extern int perf_pmu_register(struct pmu *pmu);
+extern void perf_pmu_unregister(struct pmu *pmu);
 
 extern void perf_event_task_sched_in(struct task_struct *task);
 extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index d71a987..e9c5cfa 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -565,6 +565,34 @@ static struct notifier_block hw_breakpoint_exceptions_nb = {
 	.priority = 0x7fffffff
 };
 
+static void bp_perf_event_destroy(struct perf_event *event)
+{
+	release_bp_slot(event);
+}
+
+static int hw_breakpoint_event_init(struct perf_event *bp)
+{
+	int err;
+
+	if (bp->attr.type != PERF_TYPE_BREAKPOINT)
+		return -ENOENT;
+
+	err = register_perf_hw_breakpoint(bp);
+	if (err)
+		return err;
+
+	bp->destroy = bp_perf_event_destroy;
+
+	return 0;
+}
+
+static struct pmu perf_breakpoint = {
+	.event_init	= hw_breakpoint_event_init,
+	.enable		= arch_install_hw_breakpoint,
+	.disable	= arch_uninstall_hw_breakpoint,
+	.read		= hw_breakpoint_pmu_read,
+};
+
 static int __init init_hw_breakpoint(void)
 {
 	unsigned int **task_bp_pinned;
@@ -586,6 +614,8 @@ static int __init init_hw_breakpoint(void)
 
 	constraints_initialized = 1;
 
+	perf_pmu_register(&perf_breakpoint);
+
 	return register_die_notifier(&hw_breakpoint_exceptions_nb);
 
  err_alloc:
@@ -601,8 +631,3 @@ static int __init init_hw_breakpoint(void)
 core_initcall(init_hw_breakpoint);
 
 
-struct pmu perf_ops_bp = {
-	.enable		= arch_install_hw_breakpoint,
-	.disable	= arch_uninstall_hw_breakpoint,
-	.read		= hw_breakpoint_pmu_read,
-};
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index fb46fd1..288ce43 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -31,7 +31,6 @@
 #include <linux/kernel_stat.h>
 #include <linux/perf_event.h>
 #include <linux/ftrace_event.h>
-#include <linux/hw_breakpoint.h>
 
 #include <asm/irq_regs.h>
 
@@ -72,14 +71,6 @@ static atomic64_t perf_event_id;
  */
 static DEFINE_SPINLOCK(perf_resource_lock);
 
-/*
- * Architecture provided APIs - weak aliases:
- */
-extern __weak struct pmu *hw_perf_event_init(struct perf_event *event)
-{
-	return NULL;
-}
-
 void __weak hw_perf_disable(void)		{ barrier(); }
 void __weak hw_perf_enable(void)		{ barrier(); }
 
@@ -4501,182 +4492,6 @@ static int perf_swevent_int(struct perf_event *event)
 	return 0;
 }
 
-static struct pmu perf_ops_generic = {
-	.enable		= perf_swevent_enable,
-	.disable	= perf_swevent_disable,
-	.start		= perf_swevent_int,
-	.stop		= perf_swevent_void,
-	.read		= perf_swevent_read,
-	.unthrottle	= perf_swevent_void, /* hwc->interrupts already reset */
-};
-
-/*
- * hrtimer based swevent callback
- */
-
-static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
-{
-	enum hrtimer_restart ret = HRTIMER_RESTART;
-	struct perf_sample_data data;
-	struct pt_regs *regs;
-	struct perf_event *event;
-	u64 period;
-
-	event = container_of(hrtimer, struct perf_event, hw.hrtimer);
-	event->pmu->read(event);
-
-	perf_sample_data_init(&data, 0);
-	data.period = event->hw.last_period;
-	regs = get_irq_regs();
-
-	if (regs && !perf_exclude_event(event, regs)) {
-		if (!(event->attr.exclude_idle && current->pid == 0))
-			if (perf_event_overflow(event, 0, &data, regs))
-				ret = HRTIMER_NORESTART;
-	}
-
-	period = max_t(u64, 10000, event->hw.sample_period);
-	hrtimer_forward_now(hrtimer, ns_to_ktime(period));
-
-	return ret;
-}
-
-static void perf_swevent_start_hrtimer(struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-
-	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hwc->hrtimer.function = perf_swevent_hrtimer;
-	if (hwc->sample_period) {
-		u64 period;
-
-		if (hwc->remaining) {
-			if (hwc->remaining < 0)
-				period = 10000;
-			else
-				period = hwc->remaining;
-			hwc->remaining = 0;
-		} else {
-			period = max_t(u64, 10000, hwc->sample_period);
-		}
-		__hrtimer_start_range_ns(&hwc->hrtimer,
-				ns_to_ktime(period), 0,
-				HRTIMER_MODE_REL, 0);
-	}
-}
-
-static void perf_swevent_cancel_hrtimer(struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-
-	if (hwc->sample_period) {
-		ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
-		hwc->remaining = ktime_to_ns(remaining);
-
-		hrtimer_cancel(&hwc->hrtimer);
-	}
-}
-
-/*
- * Software event: cpu wall time clock
- */
-
-static void cpu_clock_perf_event_update(struct perf_event *event)
-{
-	int cpu = raw_smp_processor_id();
-	s64 prev;
-	u64 now;
-
-	now = cpu_clock(cpu);
-	prev = local64_xchg(&event->hw.prev_count, now);
-	local64_add(now - prev, &event->count);
-}
-
-static int cpu_clock_perf_event_enable(struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-	int cpu = raw_smp_processor_id();
-
-	local64_set(&hwc->prev_count, cpu_clock(cpu));
-	perf_swevent_start_hrtimer(event);
-
-	return 0;
-}
-
-static void cpu_clock_perf_event_disable(struct perf_event *event)
-{
-	perf_swevent_cancel_hrtimer(event);
-	cpu_clock_perf_event_update(event);
-}
-
-static void cpu_clock_perf_event_read(struct perf_event *event)
-{
-	cpu_clock_perf_event_update(event);
-}
-
-static struct pmu perf_ops_cpu_clock = {
-	.enable		= cpu_clock_perf_event_enable,
-	.disable	= cpu_clock_perf_event_disable,
-	.read		= cpu_clock_perf_event_read,
-};
-
-/*
- * Software event: task time clock
- */
-
-static void task_clock_perf_event_update(struct perf_event *event, u64 now)
-{
-	u64 prev;
-	s64 delta;
-
-	prev = local64_xchg(&event->hw.prev_count, now);
-	delta = now - prev;
-	local64_add(delta, &event->count);
-}
-
-static int task_clock_perf_event_enable(struct perf_event *event)
-{
-	struct hw_perf_event *hwc = &event->hw;
-	u64 now;
-
-	now = event->ctx->time;
-
-	local64_set(&hwc->prev_count, now);
-
-	perf_swevent_start_hrtimer(event);
-
-	return 0;
-}
-
-static void task_clock_perf_event_disable(struct perf_event *event)
-{
-	perf_swevent_cancel_hrtimer(event);
-	task_clock_perf_event_update(event, event->ctx->time);
-
-}
-
-static void task_clock_perf_event_read(struct perf_event *event)
-{
-	u64 time;
-
-	if (!in_nmi()) {
-		update_context_time(event->ctx);
-		time = event->ctx->time;
-	} else {
-		u64 now = perf_clock();
-		u64 delta = now - event->ctx->timestamp;
-		time = event->ctx->time + delta;
-	}
-
-	task_clock_perf_event_update(event, time);
-}
-
-static struct pmu perf_ops_task_clock = {
-	.enable		= task_clock_perf_event_enable,
-	.disable	= task_clock_perf_event_disable,
-	.read		= task_clock_perf_event_read,
-};
-
 /* Deref the hlist from the update side */
 static inline struct swevent_hlist *
 swevent_hlist_deref(struct perf_cpu_context *cpuctx)
@@ -4783,17 +4598,63 @@ static int swevent_hlist_get(struct perf_event *event)
 	return err;
 }
 
-#ifdef CONFIG_EVENT_TRACING
+atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
 
-static struct pmu perf_ops_tracepoint = {
-	.enable		= perf_trace_enable,
-	.disable	= perf_trace_disable,
+static void sw_perf_event_destroy(struct perf_event *event)
+{
+	u64 event_id = event->attr.config;
+
+	WARN_ON(event->parent);
+
+	atomic_dec(&perf_swevent_enabled[event_id]);
+	swevent_hlist_put(event);
+}
+
+static int perf_swevent_init(struct perf_event *event)
+{
+	int event_id = event->attr.config;
+
+	if (event->attr.type != PERF_TYPE_SOFTWARE)
+		return -ENOENT;
+
+	switch (event_id) {
+	case PERF_COUNT_SW_CPU_CLOCK:
+	case PERF_COUNT_SW_TASK_CLOCK:
+		return -ENOENT;
+
+	default:
+		break;
+	}
+
+	if (event_id > PERF_COUNT_SW_MAX)
+		return -ENOENT;
+
+	if (!event->parent) {
+		int err;
+
+		err = swevent_hlist_get(event);
+		if (err)
+			return err;
+
+		atomic_inc(&perf_swevent_enabled[event_id]);
+		event->destroy = sw_perf_event_destroy;
+	}
+
+	return 0;
+}
+
+static struct pmu perf_swevent = {
+	.event_init	= perf_swevent_init,
+	.enable		= perf_swevent_enable,
+	.disable	= perf_swevent_disable,
 	.start		= perf_swevent_int,
 	.stop		= perf_swevent_void,
 	.read		= perf_swevent_read,
-	.unthrottle	= perf_swevent_void,
+	.unthrottle	= perf_swevent_void, /* hwc->interrupts already reset */
 };
 
+#ifdef CONFIG_EVENT_TRACING
+
 static int perf_tp_filter_match(struct perf_event *event,
 				struct perf_sample_data *data)
 {
@@ -4849,10 +4710,13 @@ static void tp_perf_event_destroy(struct perf_event *event)
 	perf_trace_destroy(event);
 }
 
-static struct pmu *tp_perf_event_init(struct perf_event *event)
+static int perf_tp_event_init(struct perf_event *event)
 {
 	int err;
 
+	if (event->attr.type != PERF_TYPE_TRACEPOINT)
+		return -ENOENT;
+
 	/*
 	 * Raw tracepoint data is a severe data leak, only allow root to
 	 * have these.
@@ -4860,15 +4724,30 @@ static struct pmu *tp_perf_event_init(struct perf_event *event)
 	if ((event->attr.sample_type & PERF_SAMPLE_RAW) &&
 			perf_paranoid_tracepoint_raw() &&
 			!capable(CAP_SYS_ADMIN))
-		return ERR_PTR(-EPERM);
+		return -EPERM;
 
 	err = perf_trace_init(event);
 	if (err)
-		return NULL;
+		return err;
 
 	event->destroy = tp_perf_event_destroy;
 
-	return &perf_ops_tracepoint;
+	return 0;
+}
+
+static struct pmu perf_tracepoint = {
+	.event_init	= perf_tp_event_init,
+	.enable		= perf_trace_enable,
+	.disable	= perf_trace_disable,
+	.start		= perf_swevent_int,
+	.stop		= perf_swevent_void,
+	.read		= perf_swevent_read,
+	.unthrottle	= perf_swevent_void,
+};
+
+static inline void perf_tp_register(void)
+{
+	perf_pmu_register(&perf_tracepoint);
 }
 
 static int perf_event_set_filter(struct perf_event *event, void __user *arg)
@@ -4896,9 +4775,8 @@ static void perf_event_free_filter(struct perf_event *event)
 
 #else
 
-static struct pmu *tp_perf_event_init(struct perf_event *event)
+static inline void perf_tp_register(void)
 {
-	return NULL;
 }
 
 static int perf_event_set_filter(struct perf_event *event, void __user *arg)
@@ -4913,105 +4791,247 @@ static void perf_event_free_filter(struct perf_event *event)
 #endif /* CONFIG_EVENT_TRACING */
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
-static void bp_perf_event_destroy(struct perf_event *event)
+void perf_bp_event(struct perf_event *bp, void *data)
 {
-	release_bp_slot(event);
+	struct perf_sample_data sample;
+	struct pt_regs *regs = data;
+
+	perf_sample_data_init(&sample, bp->attr.bp_addr);
+
+	if (!perf_exclude_event(bp, regs))
+		perf_swevent_add(bp, 1, 1, &sample, regs);
 }
+#endif
+
+/*
+ * hrtimer based swevent callback
+ */
 
-static struct pmu *bp_perf_event_init(struct perf_event *bp)
+static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
 {
-	int err;
+	enum hrtimer_restart ret = HRTIMER_RESTART;
+	struct perf_sample_data data;
+	struct pt_regs *regs;
+	struct perf_event *event;
+	u64 period;
 
-	err = register_perf_hw_breakpoint(bp);
-	if (err)
-		return ERR_PTR(err);
+	event = container_of(hrtimer, struct perf_event, hw.hrtimer);
+	event->pmu->read(event);
+
+	perf_sample_data_init(&data, 0);
+	data.period = event->hw.last_period;
+	regs = get_irq_regs();
+
+	if (regs && !perf_exclude_event(event, regs)) {
+		if (!(event->attr.exclude_idle && current->pid == 0))
+			if (perf_event_overflow(event, 0, &data, regs))
+				ret = HRTIMER_NORESTART;
+	}
 
-	bp->destroy = bp_perf_event_destroy;
+	period = max_t(u64, 10000, event->hw.sample_period);
+	hrtimer_forward_now(hrtimer, ns_to_ktime(period));
 
-	return &perf_ops_bp;
+	return ret;
 }
 
-void perf_bp_event(struct perf_event *bp, void *data)
+static void perf_swevent_start_hrtimer(struct perf_event *event)
 {
-	struct perf_sample_data sample;
-	struct pt_regs *regs = data;
+	struct hw_perf_event *hwc = &event->hw;
 
-	perf_sample_data_init(&sample, bp->attr.bp_addr);
+	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	hwc->hrtimer.function = perf_swevent_hrtimer;
+	if (hwc->sample_period) {
+		u64 period;
 
-	if (!perf_exclude_event(bp, regs))
-		perf_swevent_add(bp, 1, 1, &sample, regs);
+		if (hwc->remaining) {
+			if (hwc->remaining < 0)
+				period = 10000;
+			else
+				period = hwc->remaining;
+			hwc->remaining = 0;
+		} else {
+			period = max_t(u64, 10000, hwc->sample_period);
+		}
+		__hrtimer_start_range_ns(&hwc->hrtimer,
+				ns_to_ktime(period), 0,
+				HRTIMER_MODE_REL, 0);
+	}
 }
-#else
-static struct pmu *bp_perf_event_init(struct perf_event *bp)
+
+static void perf_swevent_cancel_hrtimer(struct perf_event *event)
 {
-	return NULL;
+	struct hw_perf_event *hwc = &event->hw;
+
+	if (hwc->sample_period) {
+		ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
+		hwc->remaining = ktime_to_ns(remaining);
+
+		hrtimer_cancel(&hwc->hrtimer);
+	}
 }
 
-void perf_bp_event(struct perf_event *bp, void *regs)
+/*
+ * Software event: cpu wall time clock
+ */
+
+static void cpu_clock_event_update(struct perf_event *event)
 {
+	int cpu = raw_smp_processor_id();
+	s64 prev;
+	u64 now;
+
+	now = cpu_clock(cpu);
+	prev = local64_xchg(&event->hw.prev_count, now);
+	local64_add(now - prev, &event->count);
 }
-#endif
 
-atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
+static int cpu_clock_event_enable(struct perf_event *event)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	int cpu = raw_smp_processor_id();
 
-static void sw_perf_event_destroy(struct perf_event *event)
+	local64_set(&hwc->prev_count, cpu_clock(cpu));
+	perf_swevent_start_hrtimer(event);
+
+	return 0;
+}
+
+static void cpu_clock_event_disable(struct perf_event *event)
 {
-	u64 event_id = event->attr.config;
+	perf_swevent_cancel_hrtimer(event);
+	cpu_clock_event_update(event);
+}
 
-	WARN_ON(event->parent);
+static void cpu_clock_event_read(struct perf_event *event)
+{
+	cpu_clock_event_update(event);
+}
 
-	atomic_dec(&perf_swevent_enabled[event_id]);
-	swevent_hlist_put(event);
+static int cpu_clock_event_init(struct perf_event *event)
+{
+	if (event->attr.type != PERF_TYPE_SOFTWARE)
+		return -ENOENT;
+
+	if (event->attr.config != PERF_COUNT_SW_CPU_CLOCK)
+		return -ENOENT;
+
+	return 0;
 }
 
-static struct pmu *sw_perf_event_init(struct perf_event *event)
+static struct pmu perf_cpu_clock = {
+	.event_init	= cpu_clock_event_init,
+	.enable		= cpu_clock_event_enable,
+	.disable	= cpu_clock_event_disable,
+	.read		= cpu_clock_event_read,
+};
+
+/*
+ * Software event: task time clock
+ */
+
+static void task_clock_event_update(struct perf_event *event, u64 now)
 {
-	struct pmu *pmu = NULL;
-	u64 event_id = event->attr.config;
+	u64 prev;
+	s64 delta;
 
-	/*
-	 * Software events (currently) can't in general distinguish
-	 * between user, kernel and hypervisor events.
-	 * However, context switches and cpu migrations are considered
-	 * to be kernel events, and page faults are never hypervisor
-	 * events.
-	 */
-	switch (event_id) {
-	case PERF_COUNT_SW_CPU_CLOCK:
-		pmu = &perf_ops_cpu_clock;
+	prev = local64_xchg(&event->hw.prev_count, now);
+	delta = now - prev;
+	local64_add(delta, &event->count);
+}
 
-		break;
-	case PERF_COUNT_SW_TASK_CLOCK:
-		/*
-		 * If the user instantiates this as a per-cpu event,
-		 * use the cpu_clock event instead.
-		 */
-		if (event->ctx->task)
-			pmu = &perf_ops_task_clock;
-		else
-			pmu = &perf_ops_cpu_clock;
+static int task_clock_event_enable(struct perf_event *event)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	u64 now;
 
-		break;
-	case PERF_COUNT_SW_PAGE_FAULTS:
-	case PERF_COUNT_SW_PAGE_FAULTS_MIN:
-	case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
-	case PERF_COUNT_SW_CONTEXT_SWITCHES:
-	case PERF_COUNT_SW_CPU_MIGRATIONS:
-	case PERF_COUNT_SW_ALIGNMENT_FAULTS:
-	case PERF_COUNT_SW_EMULATION_FAULTS:
-		if (!event->parent) {
-			int err;
-
-			err = swevent_hlist_get(event);
-			if (err)
-				return ERR_PTR(err);
+	now = event->ctx->time;
 
-			atomic_inc(&perf_swevent_enabled[event_id]);
-			event->destroy = sw_perf_event_destroy;
+	local64_set(&hwc->prev_count, now);
+
+	perf_swevent_start_hrtimer(event);
+
+	return 0;
+}
+
+static void task_clock_event_disable(struct perf_event *event)
+{
+	perf_swevent_cancel_hrtimer(event);
+	task_clock_event_update(event, event->ctx->time);
+
+}
+
+static void task_clock_event_read(struct perf_event *event)
+{
+	u64 time;
+
+	if (!in_nmi()) {
+		update_context_time(event->ctx);
+		time = event->ctx->time;
+	} else {
+		u64 now = perf_clock();
+		u64 delta = now - event->ctx->timestamp;
+		time = event->ctx->time + delta;
+	}
+
+	task_clock_event_update(event, time);
+}
+
+static int task_clock_event_init(struct perf_event *event)
+{
+	if (event->attr.type != PERF_TYPE_SOFTWARE)
+		return -ENOENT;
+
+	if (event->attr.config != PERF_COUNT_SW_TASK_CLOCK)
+		return -ENOENT;
+
+	return 0;
+}
+
+static struct pmu perf_task_clock = {
+	.event_init	= task_clock_event_init,
+	.enable		= task_clock_event_enable,
+	.disable	= task_clock_event_disable,
+	.read		= task_clock_event_read,
+};
+
+static LIST_HEAD(pmus);
+static DEFINE_MUTEX(pmus_lock);
+static struct srcu_struct pmus_srcu;
+
+int perf_pmu_register(struct pmu *pmu)
+{
+	mutex_lock(&pmus_lock);
+	list_add_rcu(&pmu->entry, &pmus);
+	mutex_unlock(&pmus_lock);
+
+	return 0;
+}
+
+void perf_pmu_unregister(struct pmu *pmu)
+{
+	mutex_lock(&pmus_lock);
+	list_del_rcu(&pmu->entry);
+	mutex_unlock(&pmus_lock);
+
+	synchronize_srcu(&pmus_srcu);
+}
+
+struct pmu *perf_init_event(struct perf_event *event)
+{
+	struct pmu *pmu = NULL;
+	int idx;
+
+	idx = srcu_read_lock(&pmus_srcu);
+	list_for_each_entry_rcu(pmu, &pmus, entry) {
+		int ret = pmu->event_init(event);
+		if (!ret)
+			break;
+		if (ret != -ENOENT) {
+			pmu = ERR_PTR(ret);
+			break;
 		}
-		pmu = &perf_ops_generic;
-		break;
 	}
+	srcu_read_unlock(&pmus_srcu, idx);
 
 	return pmu;
 }
@@ -5092,29 +5112,8 @@ perf_event_alloc(struct perf_event_attr *attr,
 	if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP))
 		goto done;
 
-	switch (attr->type) {
-	case PERF_TYPE_RAW:
-	case PERF_TYPE_HARDWARE:
-	case PERF_TYPE_HW_CACHE:
-		pmu = hw_perf_event_init(event);
-		break;
-
-	case PERF_TYPE_SOFTWARE:
-		pmu = sw_perf_event_init(event);
-		break;
-
-	case PERF_TYPE_TRACEPOINT:
-		pmu = tp_perf_event_init(event);
-		break;
+	pmu = perf_init_event(event);
 
-	case PERF_TYPE_BREAKPOINT:
-		pmu = bp_perf_event_init(event);
-		break;
-
-
-	default:
-		break;
-	}
 done:
 	err = 0;
 	if (!pmu)
@@ -5979,22 +5978,15 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 	return NOTIFY_OK;
 }
 
-/*
- * This has to have a higher priority than migration_notifier in sched.c.
- */
-static struct notifier_block __cpuinitdata perf_cpu_nb = {
-	.notifier_call		= perf_cpu_notify,
-	.priority		= 20,
-};
-
 void __init perf_event_init(void)
 {
 	perf_event_init_all_cpus();
-	perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE,
-			(void *)(long)smp_processor_id());
-	perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE,
-			(void *)(long)smp_processor_id());
-	register_cpu_notifier(&perf_cpu_nb);
+	init_srcu_struct(&pmus_srcu);
+	perf_pmu_register(&perf_swevent);
+	perf_pmu_register(&perf_cpu_clock);
+	perf_pmu_register(&perf_task_clock);
+	perf_tp_register();
+	perf_cpu_notifier(perf_cpu_notify);
 }
 
 static ssize_t perf_show_reserve_percpu(struct sysdev_class *class,

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

* [tip:perf/core] perf: Unindent labels
       [not found]             ` <new-submission>
                                 ` (606 preceding siblings ...)
  2010-09-09 19:47               ` [tip:perf/core] perf: Register PMU implementations tip-bot for Peter Zijlstra
@ 2010-09-09 19:48               ` tip-bot for Peter Zijlstra
  2010-09-09 19:48               ` [tip:perf/core] perf: Reduce perf_disable() usage tip-bot for Peter Zijlstra
                                 ` (98 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  9ed6060d286b1eb55974d09080f442f809408c42
Gitweb:     http://git.kernel.org/tip/9ed6060d286b1eb55974d09080f442f809408c42
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Jun 2010 17:36:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:28 +0200

perf: Unindent labels

Fixup random annoying style bits.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 288ce43..149ca18 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -147,7 +147,7 @@ perf_lock_task_context(struct task_struct *task, unsigned long *flags)
 	struct perf_event_context *ctx;
 
 	rcu_read_lock();
- retry:
+retry:
 	ctx = rcu_dereference(task->perf_event_ctxp);
 	if (ctx) {
 		/*
@@ -619,7 +619,7 @@ void perf_event_disable(struct perf_event *event)
 		return;
 	}
 
- retry:
+retry:
 	task_oncpu_function_call(task, __perf_event_disable, event);
 
 	raw_spin_lock_irq(&ctx->lock);
@@ -849,7 +849,7 @@ static void __perf_install_in_context(void *info)
 	if (!err && !ctx->task && cpuctx->max_pertask)
 		cpuctx->max_pertask--;
 
- unlock:
+unlock:
 	perf_enable();
 
 	raw_spin_unlock(&ctx->lock);
@@ -922,10 +922,12 @@ static void __perf_event_mark_enabled(struct perf_event *event,
 
 	event->state = PERF_EVENT_STATE_INACTIVE;
 	event->tstamp_enabled = ctx->time - event->total_time_enabled;
-	list_for_each_entry(sub, &event->sibling_list, group_entry)
-		if (sub->state >= PERF_EVENT_STATE_INACTIVE)
+	list_for_each_entry(sub, &event->sibling_list, group_entry) {
+		if (sub->state >= PERF_EVENT_STATE_INACTIVE) {
 			sub->tstamp_enabled =
 				ctx->time - sub->total_time_enabled;
+		}
+	}
 }
 
 /*
@@ -991,7 +993,7 @@ static void __perf_event_enable(void *info)
 		}
 	}
 
- unlock:
+unlock:
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -1032,7 +1034,7 @@ void perf_event_enable(struct perf_event *event)
 	if (event->state == PERF_EVENT_STATE_ERROR)
 		event->state = PERF_EVENT_STATE_OFF;
 
- retry:
+retry:
 	raw_spin_unlock_irq(&ctx->lock);
 	task_oncpu_function_call(task, __perf_event_enable, event);
 
@@ -1052,7 +1054,7 @@ void perf_event_enable(struct perf_event *event)
 	if (event->state == PERF_EVENT_STATE_OFF)
 		__perf_event_mark_enabled(event, ctx);
 
- out:
+out:
 	raw_spin_unlock_irq(&ctx->lock);
 }
 
@@ -1092,17 +1094,19 @@ static void ctx_sched_out(struct perf_event_context *ctx,
 	if (!ctx->nr_active)
 		goto out_enable;
 
-	if (event_type & EVENT_PINNED)
+	if (event_type & EVENT_PINNED) {
 		list_for_each_entry(event, &ctx->pinned_groups, group_entry)
 			group_sched_out(event, cpuctx, ctx);
+	}
 
-	if (event_type & EVENT_FLEXIBLE)
+	if (event_type & EVENT_FLEXIBLE) {
 		list_for_each_entry(event, &ctx->flexible_groups, group_entry)
 			group_sched_out(event, cpuctx, ctx);
+	}
 
  out_enable:
 	perf_enable();
- out:
+out:
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -1341,9 +1345,10 @@ ctx_flexible_sched_in(struct perf_event_context *ctx,
 		if (event->cpu != -1 && event->cpu != smp_processor_id())
 			continue;
 
-		if (group_can_go_on(event, cpuctx, can_add_hw))
+		if (group_can_go_on(event, cpuctx, can_add_hw)) {
 			if (group_sched_in(event, cpuctx, ctx))
 				can_add_hw = 0;
+		}
 	}
 }
 
@@ -1373,7 +1378,7 @@ ctx_sched_in(struct perf_event_context *ctx,
 		ctx_flexible_sched_in(ctx, cpuctx);
 
 	perf_enable();
- out:
+out:
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -1714,7 +1719,7 @@ static void perf_event_enable_on_exec(struct task_struct *task)
 	raw_spin_unlock(&ctx->lock);
 
 	perf_event_task_sched_in(task);
- out:
+out:
 	local_irq_restore(flags);
 }
 
@@ -2053,7 +2058,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
 	if (!ptrace_may_access(task, PTRACE_MODE_READ))
 		goto errout;
 
- retry:
+retry:
 	ctx = perf_lock_task_context(task, &flags);
 	if (ctx) {
 		unclone_ctx(ctx);
@@ -2081,7 +2086,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
 	put_task_struct(task);
 	return ctx;
 
- errout:
+errout:
 	put_task_struct(task);
 	return ERR_PTR(err);
 }
@@ -3264,7 +3269,7 @@ again:
 	if (handle->wakeup != local_read(&buffer->wakeup))
 		perf_output_wakeup(handle);
 
- out:
+out:
 	preempt_enable();
 }
 
@@ -4562,7 +4567,7 @@ static int swevent_hlist_get_cpu(struct perf_event *event, int cpu)
 		rcu_assign_pointer(cpuctx->swevent_hlist, hlist);
 	}
 	cpuctx->hlist_refcount++;
- exit:
+exit:
 	mutex_unlock(&cpuctx->hlist_mutex);
 
 	return err;
@@ -4587,7 +4592,7 @@ static int swevent_hlist_get(struct perf_event *event)
 	put_online_cpus();
 
 	return 0;
- fail:
+fail:
 	for_each_possible_cpu(cpu) {
 		if (cpu == failed_cpu)
 			break;

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

* [tip:perf/core] perf: Reduce perf_disable() usage
       [not found]             ` <new-submission>
                                 ` (607 preceding siblings ...)
  2010-09-09 19:48               ` [tip:perf/core] perf: Unindent labels tip-bot for Peter Zijlstra
@ 2010-09-09 19:48               ` tip-bot for Peter Zijlstra
  2010-09-09 19:49               ` [tip:perf/core] perf: Per PMU disable tip-bot for Peter Zijlstra
                                 ` (97 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  24cd7f54a0d47e1d5b3de29e2456bfbd2d8447b7
Gitweb:     http://git.kernel.org/tip/24cd7f54a0d47e1d5b3de29e2456bfbd2d8447b7
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 11 Jun 2010 17:32:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:29 +0200

perf: Reduce perf_disable() usage

Since the current perf_disable() usage is only an optimization,
remove it for now. This eases the removal of the __weak
hw_perf_enable() interface.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/arm/kernel/perf_event.c             |    3 ++
 arch/powerpc/kernel/perf_event.c         |    3 ++
 arch/powerpc/kernel/perf_event_fsl_emb.c |    8 +++++-
 arch/sh/kernel/perf_event.c              |   11 ++++++--
 arch/sparc/kernel/perf_event.c           |    3 ++
 arch/x86/kernel/cpu/perf_event.c         |   22 +++++++++++------
 include/linux/perf_event.h               |   20 ++++++++--------
 kernel/perf_event.c                      |   37 +-----------------------------
 8 files changed, 48 insertions(+), 59 deletions(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index f62f9db..afc92c5 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -277,6 +277,8 @@ armpmu_enable(struct perf_event *event)
 	int idx;
 	int err = 0;
 
+	perf_disable();
+
 	/* If we don't have a space for the counter then finish early. */
 	idx = armpmu->get_event_idx(cpuc, hwc);
 	if (idx < 0) {
@@ -303,6 +305,7 @@ armpmu_enable(struct perf_event *event)
 	perf_event_update_userpage(event);
 
 out:
+	perf_enable();
 	return err;
 }
 
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index 19131b2..c140882 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -861,6 +861,7 @@ void power_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
+	perf_disable();
 	cpuhw->group_flag |= PERF_EVENT_TXN;
 	cpuhw->n_txn_start = cpuhw->n_events;
 }
@@ -875,6 +876,7 @@ void power_pmu_cancel_txn(struct pmu *pmu)
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
+	perf_enable();
 }
 
 /*
@@ -901,6 +903,7 @@ int power_pmu_commit_txn(struct pmu *pmu)
 		cpuhw->event[i]->hw.config = cpuhw->events[i];
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
+	perf_enable();
 	return 0;
 }
 
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index ea6a804..9bc84a7 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -262,7 +262,7 @@ static int collect_events(struct perf_event *group, int max_count,
 	return n;
 }
 
-/* perf must be disabled, context locked on entry */
+/* context locked on entry */
 static int fsl_emb_pmu_enable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuhw;
@@ -271,6 +271,7 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 	u64 val;
 	int i;
 
+	perf_disable();
 	cpuhw = &get_cpu_var(cpu_hw_events);
 
 	if (event->hw.config & FSL_EMB_EVENT_RESTRICTED)
@@ -310,15 +311,17 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 	ret = 0;
  out:
 	put_cpu_var(cpu_hw_events);
+	perf_enable();
 	return ret;
 }
 
-/* perf must be disabled, context locked on entry */
+/* context locked on entry */
 static void fsl_emb_pmu_disable(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuhw;
 	int i = event->hw.idx;
 
+	perf_disable();
 	if (i < 0)
 		goto out;
 
@@ -346,6 +349,7 @@ static void fsl_emb_pmu_disable(struct perf_event *event)
 	cpuhw->n_events--;
 
  out:
+	perf_enable();
 	put_cpu_var(cpu_hw_events);
 }
 
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 8cb2065..d042989 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -230,11 +230,14 @@ static int sh_pmu_enable(struct perf_event *event)
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
 	int idx = hwc->idx;
+	int ret = -EAGAIN;
+
+	perf_disable();
 
 	if (test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, sh_pmu->num_events);
 		if (idx == sh_pmu->num_events)
-			return -EAGAIN;
+			goto out;
 
 		set_bit(idx, cpuc->used_mask);
 		hwc->idx = idx;
@@ -248,8 +251,10 @@ static int sh_pmu_enable(struct perf_event *event)
 	sh_pmu->enable(hwc, idx);
 
 	perf_event_update_userpage(event);
-
-	return 0;
+	ret = 0;
+out:
+	perf_enable();
+	return ret;
 }
 
 static void sh_pmu_read(struct perf_event *event)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index bed4327..d0131de 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1113,6 +1113,7 @@ static void sparc_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
+	perf_disable();
 	cpuhw->group_flag |= PERF_EVENT_TXN;
 }
 
@@ -1126,6 +1127,7 @@ static void sparc_pmu_cancel_txn(struct pmu *pmu)
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
+	perf_enable();
 }
 
 /*
@@ -1149,6 +1151,7 @@ static int sparc_pmu_commit_txn(struct pmu *pmu)
 		return -EAGAIN;
 
 	cpuc->group_flag &= ~PERF_EVENT_TXN;
+	perf_enable();
 	return 0;
 }
 
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 2c89264..846070c 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -969,10 +969,11 @@ static int x86_pmu_enable(struct perf_event *event)
 
 	hwc = &event->hw;
 
+	perf_disable();
 	n0 = cpuc->n_events;
-	n = collect_events(cpuc, event, false);
-	if (n < 0)
-		return n;
+	ret = n = collect_events(cpuc, event, false);
+	if (ret < 0)
+		goto out;
 
 	/*
 	 * If group events scheduling transaction was started,
@@ -980,23 +981,26 @@ static int x86_pmu_enable(struct perf_event *event)
 	 * at commit time(->commit_txn) as a whole
 	 */
 	if (cpuc->group_flag & PERF_EVENT_TXN)
-		goto out;
+		goto done_collect;
 
 	ret = x86_pmu.schedule_events(cpuc, n, assign);
 	if (ret)
-		return ret;
+		goto out;
 	/*
 	 * copy new assignment, now we know it is possible
 	 * will be used by hw_perf_enable()
 	 */
 	memcpy(cpuc->assign, assign, n*sizeof(int));
 
-out:
+done_collect:
 	cpuc->n_events = n;
 	cpuc->n_added += n - n0;
 	cpuc->n_txn += n - n0;
 
-	return 0;
+	ret = 0;
+out:
+	perf_enable();
+	return ret;
 }
 
 static int x86_pmu_start(struct perf_event *event)
@@ -1432,6 +1436,7 @@ static void x86_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
+	perf_disable();
 	cpuc->group_flag |= PERF_EVENT_TXN;
 	cpuc->n_txn = 0;
 }
@@ -1451,6 +1456,7 @@ static void x86_pmu_cancel_txn(struct pmu *pmu)
 	 */
 	cpuc->n_added -= cpuc->n_txn;
 	cpuc->n_events -= cpuc->n_txn;
+	perf_enable();
 }
 
 /*
@@ -1480,7 +1486,7 @@ static int x86_pmu_commit_txn(struct pmu *pmu)
 	memcpy(cpuc->assign, assign, n*sizeof(int));
 
 	cpuc->group_flag &= ~PERF_EVENT_TXN;
-
+	perf_enable();
 	return 0;
 }
 
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ab72f56..243286a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -564,26 +564,26 @@ struct pmu {
 	struct list_head		entry;
 
 	/*
-	 * Should return -ENOENT when the @event doesn't match this pmu
+	 * Should return -ENOENT when the @event doesn't match this PMU.
 	 */
 	int (*event_init)		(struct perf_event *event);
 
-	int (*enable)			(struct perf_event *event);
+	int  (*enable)			(struct perf_event *event);
 	void (*disable)			(struct perf_event *event);
-	int (*start)			(struct perf_event *event);
+	int  (*start)			(struct perf_event *event);
 	void (*stop)			(struct perf_event *event);
 	void (*read)			(struct perf_event *event);
 	void (*unthrottle)		(struct perf_event *event);
 
 	/*
-	 * Group events scheduling is treated as a transaction, add group
-	 * events as a whole and perform one schedulability test. If the test
-	 * fails, roll back the whole group
+	 * Group events scheduling is treated as a transaction, add
+	 * group events as a whole and perform one schedulability test.
+	 * If the test fails, roll back the whole group
 	 */
 
 	/*
-	 * Start the transaction, after this ->enable() doesn't need
-	 * to do schedulability tests.
+	 * Start the transaction, after this ->enable() doesn't need to
+	 * do schedulability tests.
 	 */
 	void (*start_txn)	(struct pmu *pmu);
 	/*
@@ -594,8 +594,8 @@ struct pmu {
 	 */
 	int  (*commit_txn)	(struct pmu *pmu);
 	/*
-	 * Will cancel the transaction, assumes ->disable() is called for
-	 * each successfull ->enable() during the transaction.
+	 * Will cancel the transaction, assumes ->disable() is called
+	 * for each successfull ->enable() during the transaction.
 	 */
 	void (*cancel_txn)	(struct pmu *pmu);
 };
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 149ca18..9a98ce9 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -478,11 +478,6 @@ static void __perf_event_remove_from_context(void *info)
 		return;
 
 	raw_spin_lock(&ctx->lock);
-	/*
-	 * Protect the list operation against NMI by disabling the
-	 * events on a global level.
-	 */
-	perf_disable();
 
 	event_sched_out(event, cpuctx, ctx);
 
@@ -498,7 +493,6 @@ static void __perf_event_remove_from_context(void *info)
 			    perf_max_events - perf_reserved_percpu);
 	}
 
-	perf_enable();
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -803,12 +797,6 @@ static void __perf_install_in_context(void *info)
 	ctx->is_active = 1;
 	update_context_time(ctx);
 
-	/*
-	 * Protect the list operation against NMI by disabling the
-	 * events on a global level. NOP for non NMI based events.
-	 */
-	perf_disable();
-
 	add_event_to_ctx(event, ctx);
 
 	if (event->cpu != -1 && event->cpu != smp_processor_id())
@@ -850,8 +838,6 @@ static void __perf_install_in_context(void *info)
 		cpuctx->max_pertask--;
 
 unlock:
-	perf_enable();
-
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -972,12 +958,10 @@ static void __perf_event_enable(void *info)
 	if (!group_can_go_on(event, cpuctx, 1)) {
 		err = -EEXIST;
 	} else {
-		perf_disable();
 		if (event == leader)
 			err = group_sched_in(event, cpuctx, ctx);
 		else
 			err = event_sched_in(event, cpuctx, ctx);
-		perf_enable();
 	}
 
 	if (err) {
@@ -1090,9 +1074,8 @@ static void ctx_sched_out(struct perf_event_context *ctx,
 		goto out;
 	update_context_time(ctx);
 
-	perf_disable();
 	if (!ctx->nr_active)
-		goto out_enable;
+		goto out;
 
 	if (event_type & EVENT_PINNED) {
 		list_for_each_entry(event, &ctx->pinned_groups, group_entry)
@@ -1103,9 +1086,6 @@ static void ctx_sched_out(struct perf_event_context *ctx,
 		list_for_each_entry(event, &ctx->flexible_groups, group_entry)
 			group_sched_out(event, cpuctx, ctx);
 	}
-
- out_enable:
-	perf_enable();
 out:
 	raw_spin_unlock(&ctx->lock);
 }
@@ -1364,8 +1344,6 @@ ctx_sched_in(struct perf_event_context *ctx,
 
 	ctx->timestamp = perf_clock();
 
-	perf_disable();
-
 	/*
 	 * First go through the list and put on any pinned groups
 	 * in order to give them the best chance of going on.
@@ -1377,7 +1355,6 @@ ctx_sched_in(struct perf_event_context *ctx,
 	if (event_type & EVENT_FLEXIBLE)
 		ctx_flexible_sched_in(ctx, cpuctx);
 
-	perf_enable();
 out:
 	raw_spin_unlock(&ctx->lock);
 }
@@ -1425,8 +1402,6 @@ void perf_event_task_sched_in(struct task_struct *task)
 	if (cpuctx->task_ctx == ctx)
 		return;
 
-	perf_disable();
-
 	/*
 	 * We want to keep the following priority order:
 	 * cpu pinned (that don't need to move), task pinned,
@@ -1439,8 +1414,6 @@ void perf_event_task_sched_in(struct task_struct *task)
 	ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE);
 
 	cpuctx->task_ctx = ctx;
-
-	perf_enable();
 }
 
 #define MAX_INTERRUPTS (~0ULL)
@@ -1555,11 +1528,9 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 	hwc->sample_period = sample_period;
 
 	if (local64_read(&hwc->period_left) > 8*sample_period) {
-		perf_disable();
 		perf_event_stop(event);
 		local64_set(&hwc->period_left, 0);
 		perf_event_start(event);
-		perf_enable();
 	}
 }
 
@@ -1588,15 +1559,12 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 		 */
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(event, 1);
-			perf_disable();
 			event->pmu->unthrottle(event);
-			perf_enable();
 		}
 
 		if (!event->attr.freq || !event->attr.sample_freq)
 			continue;
 
-		perf_disable();
 		event->pmu->read(event);
 		now = local64_read(&event->count);
 		delta = now - hwc->freq_count_stamp;
@@ -1604,7 +1572,6 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 
 		if (delta > 0)
 			perf_adjust_period(event, TICK_NSEC, delta);
-		perf_enable();
 	}
 	raw_spin_unlock(&ctx->lock);
 }
@@ -1647,7 +1614,6 @@ void perf_event_task_tick(struct task_struct *curr)
 	if (!rotate)
 		return;
 
-	perf_disable();
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
 		task_ctx_sched_out(ctx, EVENT_FLEXIBLE);
@@ -1659,7 +1625,6 @@ void perf_event_task_tick(struct task_struct *curr)
 	cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
 		task_ctx_sched_in(curr, EVENT_FLEXIBLE);
-	perf_enable();
 }
 
 static int event_enable_on_exec(struct perf_event *event,

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

* [tip:perf/core] perf: Per PMU disable
       [not found]             ` <new-submission>
                                 ` (608 preceding siblings ...)
  2010-09-09 19:48               ` [tip:perf/core] perf: Reduce perf_disable() usage tip-bot for Peter Zijlstra
@ 2010-09-09 19:49               ` tip-bot for Peter Zijlstra
  2010-09-09 19:49               ` [tip:perf/core] perf: Default PMU ops tip-bot for Peter Zijlstra
                                 ` (96 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  33696fc0d141bbbcb12f75b69608ea83282e3117
Gitweb:     http://git.kernel.org/tip/33696fc0d141bbbcb12f75b69608ea83282e3117
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 14 Jun 2010 08:49:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:29 +0200

perf: Per PMU disable

Changes perf_disable() into perf_pmu_disable().

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c           |   30 ++++++++++++-----------
 arch/arm/kernel/perf_event.c             |   28 +++++++++++-----------
 arch/powerpc/kernel/perf_event.c         |   24 ++++++++++--------
 arch/powerpc/kernel/perf_event_fsl_emb.c |   18 ++++++++------
 arch/sh/kernel/perf_event.c              |   38 +++++++++++++++--------------
 arch/sparc/kernel/perf_event.c           |   20 ++++++++-------
 arch/x86/kernel/cpu/perf_event.c         |   16 +++++++-----
 include/linux/perf_event.h               |   13 +++++----
 kernel/perf_event.c                      |   31 +++++++++++++++---------
 9 files changed, 119 insertions(+), 99 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 19660b5..3e26073 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -435,7 +435,7 @@ static int alpha_pmu_enable(struct perf_event *event)
 	 * nevertheless we disable the PMCs first to enable a potential
 	 * final PMI to occur before we disable interrupts.
 	 */
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	local_irq_save(flags);
 
 	/* Default to error to be returned */
@@ -456,7 +456,7 @@ static int alpha_pmu_enable(struct perf_event *event)
 	}
 
 	local_irq_restore(flags);
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 
 	return ret;
 }
@@ -474,7 +474,7 @@ static void alpha_pmu_disable(struct perf_event *event)
 	unsigned long flags;
 	int j;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	local_irq_save(flags);
 
 	for (j = 0; j < cpuc->n_events; j++) {
@@ -502,7 +502,7 @@ static void alpha_pmu_disable(struct perf_event *event)
 	}
 
 	local_irq_restore(flags);
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 }
 
 
@@ -668,18 +668,10 @@ static int alpha_pmu_event_init(struct perf_event *event)
 	return err;
 }
 
-static struct pmu pmu = {
-	.event_init	= alpha_pmu_event_init,
-	.enable		= alpha_pmu_enable,
-	.disable	= alpha_pmu_disable,
-	.read		= alpha_pmu_read,
-	.unthrottle	= alpha_pmu_unthrottle,
-};
-
 /*
  * Main entry point - enable HW performance counters.
  */
-void hw_perf_enable(void)
+static void alpha_pmu_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -705,7 +697,7 @@ void hw_perf_enable(void)
  * Main entry point - disable HW performance counters.
  */
 
-void hw_perf_disable(void)
+static void alpha_pmu_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -718,6 +710,16 @@ void hw_perf_disable(void)
 	wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
 }
 
+static struct pmu pmu = {
+	.pmu_enable	= alpha_pmu_pmu_enable,
+	.pmu_disable	= alpha_pmu_pmu_disable,
+	.event_init	= alpha_pmu_event_init,
+	.enable		= alpha_pmu_enable,
+	.disable	= alpha_pmu_disable,
+	.read		= alpha_pmu_read,
+	.unthrottle	= alpha_pmu_unthrottle,
+};
+
 
 /*
  * Main entry point - don't know when this is called but it
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index afc92c5..3343f3f 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -277,7 +277,7 @@ armpmu_enable(struct perf_event *event)
 	int idx;
 	int err = 0;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	/* If we don't have a space for the counter then finish early. */
 	idx = armpmu->get_event_idx(cpuc, hwc);
@@ -305,7 +305,7 @@ armpmu_enable(struct perf_event *event)
 	perf_event_update_userpage(event);
 
 out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	return err;
 }
 
@@ -534,16 +534,7 @@ static int armpmu_event_init(struct perf_event *event)
 	return err;
 }
 
-static struct pmu pmu = {
-	.event_init = armpmu_event_init,
-	.enable	    = armpmu_enable,
-	.disable    = armpmu_disable,
-	.unthrottle = armpmu_unthrottle,
-	.read	    = armpmu_read,
-};
-
-void
-hw_perf_enable(void)
+static void armpmu_pmu_enable(struct pmu *pmu)
 {
 	/* Enable all of the perf events on hardware. */
 	int idx;
@@ -564,13 +555,22 @@ hw_perf_enable(void)
 	armpmu->start();
 }
 
-void
-hw_perf_disable(void)
+static void armpmu_pmu_disable(struct pmu *pmu)
 {
 	if (armpmu)
 		armpmu->stop();
 }
 
+static struct pmu pmu = {
+	.pmu_enable = armpmu_pmu_enable,
+	.pmu_disable= armpmu_pmu_disable,
+	.event_init = armpmu_event_init,
+	.enable	    = armpmu_enable,
+	.disable    = armpmu_disable,
+	.unthrottle = armpmu_unthrottle,
+	.read	    = armpmu_read,
+};
+
 /*
  * ARMv6 Performance counter handling code.
  *
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index c140882..deb84bb 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -517,7 +517,7 @@ static void write_mmcr0(struct cpu_hw_events *cpuhw, unsigned long mmcr0)
  * Disable all events to prevent PMU interrupts and to allow
  * events to be added or removed.
  */
-void hw_perf_disable(void)
+static void power_pmu_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -565,7 +565,7 @@ void hw_perf_disable(void)
  * If we were previously disabled and events were added, then
  * put the new config on the PMU.
  */
-void hw_perf_enable(void)
+static void power_pmu_pmu_enable(struct pmu *pmu)
 {
 	struct perf_event *event;
 	struct cpu_hw_events *cpuhw;
@@ -735,7 +735,7 @@ static int power_pmu_enable(struct perf_event *event)
 	int ret = -EAGAIN;
 
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	/*
 	 * Add the event to the list (if there is room)
@@ -769,7 +769,7 @@ nocheck:
 
 	ret = 0;
  out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 	return ret;
 }
@@ -784,7 +784,7 @@ static void power_pmu_disable(struct perf_event *event)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	power_pmu_read(event);
 
@@ -821,7 +821,7 @@ static void power_pmu_disable(struct perf_event *event)
 		cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE);
 	}
 
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 }
 
@@ -837,7 +837,7 @@ static void power_pmu_unthrottle(struct perf_event *event)
 	if (!event->hw.idx || !event->hw.sample_period)
 		return;
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	power_pmu_read(event);
 	left = event->hw.sample_period;
 	event->hw.last_period = left;
@@ -848,7 +848,7 @@ static void power_pmu_unthrottle(struct perf_event *event)
 	local64_set(&event->hw.prev_count, val);
 	local64_set(&event->hw.period_left, left);
 	perf_event_update_userpage(event);
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 }
 
@@ -861,7 +861,7 @@ void power_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
-	perf_disable();
+	perf_pmu_disable(pmu);
 	cpuhw->group_flag |= PERF_EVENT_TXN;
 	cpuhw->n_txn_start = cpuhw->n_events;
 }
@@ -876,7 +876,7 @@ void power_pmu_cancel_txn(struct pmu *pmu)
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
-	perf_enable();
+	perf_pmu_enable(pmu);
 }
 
 /*
@@ -903,7 +903,7 @@ int power_pmu_commit_txn(struct pmu *pmu)
 		cpuhw->event[i]->hw.config = cpuhw->events[i];
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
-	perf_enable();
+	perf_pmu_enable(pmu);
 	return 0;
 }
 
@@ -1131,6 +1131,8 @@ static int power_pmu_event_init(struct perf_event *event)
 }
 
 struct pmu power_pmu = {
+	.pmu_enable	= power_pmu_pmu_enable,
+	.pmu_disable	= power_pmu_pmu_disable,
 	.event_init	= power_pmu_event_init,
 	.enable		= power_pmu_enable,
 	.disable	= power_pmu_disable,
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index 9bc84a7..84b1974 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -177,7 +177,7 @@ static void fsl_emb_pmu_read(struct perf_event *event)
  * Disable all events to prevent PMU interrupts and to allow
  * events to be added or removed.
  */
-void hw_perf_disable(void)
+static void fsl_emb_pmu_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -216,7 +216,7 @@ void hw_perf_disable(void)
  * If we were previously disabled and events were added, then
  * put the new config on the PMU.
  */
-void hw_perf_enable(void)
+static void fsl_emb_pmu_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -271,7 +271,7 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 	u64 val;
 	int i;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	cpuhw = &get_cpu_var(cpu_hw_events);
 
 	if (event->hw.config & FSL_EMB_EVENT_RESTRICTED)
@@ -311,7 +311,7 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 	ret = 0;
  out:
 	put_cpu_var(cpu_hw_events);
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	return ret;
 }
 
@@ -321,7 +321,7 @@ static void fsl_emb_pmu_disable(struct perf_event *event)
 	struct cpu_hw_events *cpuhw;
 	int i = event->hw.idx;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	if (i < 0)
 		goto out;
 
@@ -349,7 +349,7 @@ static void fsl_emb_pmu_disable(struct perf_event *event)
 	cpuhw->n_events--;
 
  out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	put_cpu_var(cpu_hw_events);
 }
 
@@ -367,7 +367,7 @@ static void fsl_emb_pmu_unthrottle(struct perf_event *event)
 	if (event->hw.idx < 0 || !event->hw.sample_period)
 		return;
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	fsl_emb_pmu_read(event);
 	left = event->hw.sample_period;
 	event->hw.last_period = left;
@@ -378,7 +378,7 @@ static void fsl_emb_pmu_unthrottle(struct perf_event *event)
 	local64_set(&event->hw.prev_count, val);
 	local64_set(&event->hw.period_left, left);
 	perf_event_update_userpage(event);
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 }
 
@@ -524,6 +524,8 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
 }
 
 static struct pmu fsl_emb_pmu = {
+	.pmu_enable	= fsl_emb_pmu_pmu_enable,
+	.pmu_disable	= fsl_emb_pmu_pmu_disable,
 	.event_init	= fsl_emb_pmu_event_init,
 	.enable		= fsl_emb_pmu_enable,
 	.disable	= fsl_emb_pmu_disable,
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index d042989..4bbe190 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -232,7 +232,7 @@ static int sh_pmu_enable(struct perf_event *event)
 	int idx = hwc->idx;
 	int ret = -EAGAIN;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	if (test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, sh_pmu->num_events);
@@ -253,7 +253,7 @@ static int sh_pmu_enable(struct perf_event *event)
 	perf_event_update_userpage(event);
 	ret = 0;
 out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	return ret;
 }
 
@@ -285,7 +285,25 @@ static int sh_pmu_event_init(struct perf_event *event)
 	return err;
 }
 
+static void sh_pmu_pmu_enable(struct pmu *pmu)
+{
+	if (!sh_pmu_initialized())
+		return;
+
+	sh_pmu->enable_all();
+}
+
+static void sh_pmu_pmu_disable(struct pmu *pmu)
+{
+	if (!sh_pmu_initialized())
+		return;
+
+	sh_pmu->disable_all();
+}
+
 static struct pmu pmu = {
+	.pmu_enable	= sh_pmu_pmu_enable,
+	.pmu_disable	= sh_pmu_pmu_disable,
 	.event_init	= sh_pmu_event_init,
 	.enable		= sh_pmu_enable,
 	.disable	= sh_pmu_disable,
@@ -316,22 +334,6 @@ sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
 	return NOTIFY_OK;
 }
 
-void hw_perf_enable(void)
-{
-	if (!sh_pmu_initialized())
-		return;
-
-	sh_pmu->enable_all();
-}
-
-void hw_perf_disable(void)
-{
-	if (!sh_pmu_initialized())
-		return;
-
-	sh_pmu->disable_all();
-}
-
 int __cpuinit register_sh_pmu(struct sh_pmu *pmu)
 {
 	if (sh_pmu)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index d0131de..37cae67 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -664,7 +664,7 @@ out:
 	return pcr;
 }
 
-void hw_perf_enable(void)
+static void sparc_pmu_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	u64 pcr;
@@ -691,7 +691,7 @@ void hw_perf_enable(void)
 	pcr_ops->write(cpuc->pcr);
 }
 
-void hw_perf_disable(void)
+static void sparc_pmu_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	u64 val;
@@ -718,7 +718,7 @@ static void sparc_pmu_disable(struct perf_event *event)
 	int i;
 
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	for (i = 0; i < cpuc->n_events; i++) {
 		if (event == cpuc->event[i]) {
@@ -748,7 +748,7 @@ static void sparc_pmu_disable(struct perf_event *event)
 		}
 	}
 
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 }
 
@@ -991,7 +991,7 @@ static int sparc_pmu_enable(struct perf_event *event)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 
 	n0 = cpuc->n_events;
 	if (n0 >= perf_max_events)
@@ -1020,7 +1020,7 @@ nocheck:
 
 	ret = 0;
 out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 	return ret;
 }
@@ -1113,7 +1113,7 @@ static void sparc_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
-	perf_disable();
+	perf_pmu_disable(pmu);
 	cpuhw->group_flag |= PERF_EVENT_TXN;
 }
 
@@ -1127,7 +1127,7 @@ static void sparc_pmu_cancel_txn(struct pmu *pmu)
 	struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
 
 	cpuhw->group_flag &= ~PERF_EVENT_TXN;
-	perf_enable();
+	perf_pmu_enable(pmu);
 }
 
 /*
@@ -1151,11 +1151,13 @@ static int sparc_pmu_commit_txn(struct pmu *pmu)
 		return -EAGAIN;
 
 	cpuc->group_flag &= ~PERF_EVENT_TXN;
-	perf_enable();
+	perf_pmu_enable(pmu);
 	return 0;
 }
 
 static struct pmu pmu = {
+	.pmu_enable	= sparc_pmu_pmu_enable,
+	.pmu_disable	= sparc_pmu_pmu_disable,
 	.event_init	= sparc_pmu_event_init,
 	.enable		= sparc_pmu_enable,
 	.disable	= sparc_pmu_disable,
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 846070c..79705ac 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -583,7 +583,7 @@ static void x86_pmu_disable_all(void)
 	}
 }
 
-void hw_perf_disable(void)
+static void x86_pmu_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -803,7 +803,7 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
 static int x86_pmu_start(struct perf_event *event);
 static void x86_pmu_stop(struct perf_event *event);
 
-void hw_perf_enable(void)
+static void x86_pmu_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct perf_event *event;
@@ -969,7 +969,7 @@ static int x86_pmu_enable(struct perf_event *event)
 
 	hwc = &event->hw;
 
-	perf_disable();
+	perf_pmu_disable(event->pmu);
 	n0 = cpuc->n_events;
 	ret = n = collect_events(cpuc, event, false);
 	if (ret < 0)
@@ -999,7 +999,7 @@ done_collect:
 
 	ret = 0;
 out:
-	perf_enable();
+	perf_pmu_enable(event->pmu);
 	return ret;
 }
 
@@ -1436,7 +1436,7 @@ static void x86_pmu_start_txn(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
-	perf_disable();
+	perf_pmu_disable(pmu);
 	cpuc->group_flag |= PERF_EVENT_TXN;
 	cpuc->n_txn = 0;
 }
@@ -1456,7 +1456,7 @@ static void x86_pmu_cancel_txn(struct pmu *pmu)
 	 */
 	cpuc->n_added -= cpuc->n_txn;
 	cpuc->n_events -= cpuc->n_txn;
-	perf_enable();
+	perf_pmu_enable(pmu);
 }
 
 /*
@@ -1486,7 +1486,7 @@ static int x86_pmu_commit_txn(struct pmu *pmu)
 	memcpy(cpuc->assign, assign, n*sizeof(int));
 
 	cpuc->group_flag &= ~PERF_EVENT_TXN;
-	perf_enable();
+	perf_pmu_enable(pmu);
 	return 0;
 }
 
@@ -1605,6 +1605,8 @@ int x86_pmu_event_init(struct perf_event *event)
 }
 
 static struct pmu pmu = {
+	.pmu_enable	= x86_pmu_pmu_enable,
+	.pmu_disable	= x86_pmu_pmu_disable,
 	.event_init	= x86_pmu_event_init,
 	.enable		= x86_pmu_enable,
 	.disable	= x86_pmu_disable,
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 243286a..6abf103 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -563,6 +563,11 @@ struct perf_event;
 struct pmu {
 	struct list_head		entry;
 
+	int				*pmu_disable_count;
+
+	void (*pmu_enable)		(struct pmu *pmu);
+	void (*pmu_disable)		(struct pmu *pmu);
+
 	/*
 	 * Should return -ENOENT when the @event doesn't match this PMU.
 	 */
@@ -868,10 +873,8 @@ extern void perf_event_free_task(struct task_struct *task);
 extern void set_perf_event_pending(void);
 extern void perf_event_do_pending(void);
 extern void perf_event_print_debug(void);
-extern void __perf_disable(void);
-extern bool __perf_enable(void);
-extern void perf_disable(void);
-extern void perf_enable(void);
+extern void perf_pmu_disable(struct pmu *pmu);
+extern void perf_pmu_enable(struct pmu *pmu);
 extern int perf_event_task_disable(void);
 extern int perf_event_task_enable(void);
 extern void perf_event_update_userpage(struct perf_event *event);
@@ -1056,8 +1059,6 @@ static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
 static inline void perf_event_do_pending(void)				{ }
 static inline void perf_event_print_debug(void)				{ }
-static inline void perf_disable(void)					{ }
-static inline void perf_enable(void)					{ }
 static inline int perf_event_task_disable(void)				{ return -EINVAL; }
 static inline int perf_event_task_enable(void)				{ return -EINVAL; }
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9a98ce9..5ed0c06 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -71,23 +71,20 @@ static atomic64_t perf_event_id;
  */
 static DEFINE_SPINLOCK(perf_resource_lock);
 
-void __weak hw_perf_disable(void)		{ barrier(); }
-void __weak hw_perf_enable(void)		{ barrier(); }
-
 void __weak perf_event_print_debug(void)	{ }
 
-static DEFINE_PER_CPU(int, perf_disable_count);
-
-void perf_disable(void)
+void perf_pmu_disable(struct pmu *pmu)
 {
-	if (!__get_cpu_var(perf_disable_count)++)
-		hw_perf_disable();
+	int *count = this_cpu_ptr(pmu->pmu_disable_count);
+	if (!(*count)++)
+		pmu->pmu_disable(pmu);
 }
 
-void perf_enable(void)
+void perf_pmu_enable(struct pmu *pmu)
 {
-	if (!--__get_cpu_var(perf_disable_count))
-		hw_perf_enable();
+	int *count = this_cpu_ptr(pmu->pmu_disable_count);
+	if (!--(*count))
+		pmu->pmu_enable(pmu);
 }
 
 static void get_ctx(struct perf_event_context *ctx)
@@ -4970,11 +4967,19 @@ static struct srcu_struct pmus_srcu;
 
 int perf_pmu_register(struct pmu *pmu)
 {
+	int ret;
+
 	mutex_lock(&pmus_lock);
+	ret = -ENOMEM;
+	pmu->pmu_disable_count = alloc_percpu(int);
+	if (!pmu->pmu_disable_count)
+		goto unlock;
 	list_add_rcu(&pmu->entry, &pmus);
+	ret = 0;
+unlock:
 	mutex_unlock(&pmus_lock);
 
-	return 0;
+	return ret;
 }
 
 void perf_pmu_unregister(struct pmu *pmu)
@@ -4984,6 +4989,8 @@ void perf_pmu_unregister(struct pmu *pmu)
 	mutex_unlock(&pmus_lock);
 
 	synchronize_srcu(&pmus_srcu);
+
+	free_percpu(pmu->pmu_disable_count);
 }
 
 struct pmu *perf_init_event(struct perf_event *event)

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

* [tip:perf/core] perf: Default PMU ops
       [not found]             ` <new-submission>
                                 ` (609 preceding siblings ...)
  2010-09-09 19:49               ` [tip:perf/core] perf: Per PMU disable tip-bot for Peter Zijlstra
@ 2010-09-09 19:49               ` tip-bot for Peter Zijlstra
  2010-09-09 19:49               ` [tip:perf/core] perf: Shrink hw_perf_event tip-bot for Peter Zijlstra
                                 ` (95 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  ad5133b7030d04ce7701aa7cbe98f561347c79c2
Gitweb:     http://git.kernel.org/tip/ad5133b7030d04ce7701aa7cbe98f561347c79c2
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 15 Jun 2010 12:22:39 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:30 +0200

perf: Default PMU ops

Provide default implementations for the pmu txn methods, this
allows us to remove some conditional code.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |   10 +++---
 kernel/perf_event.c        |   64 +++++++++++++++++++++++++++++++++++--------
 2 files changed, 57 insertions(+), 17 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 6abf103..bf85733 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -565,8 +565,8 @@ struct pmu {
 
 	int				*pmu_disable_count;
 
-	void (*pmu_enable)		(struct pmu *pmu);
-	void (*pmu_disable)		(struct pmu *pmu);
+	void (*pmu_enable)		(struct pmu *pmu); /* optional */
+	void (*pmu_disable)		(struct pmu *pmu); /* optional */
 
 	/*
 	 * Should return -ENOENT when the @event doesn't match this PMU.
@@ -590,19 +590,19 @@ struct pmu {
 	 * Start the transaction, after this ->enable() doesn't need to
 	 * do schedulability tests.
 	 */
-	void (*start_txn)	(struct pmu *pmu);
+	void (*start_txn)	(struct pmu *pmu); /* optional */
 	/*
 	 * If ->start_txn() disabled the ->enable() schedulability test
 	 * then ->commit_txn() is required to perform one. On success
 	 * the transaction is closed. On error the transaction is kept
 	 * open until ->cancel_txn() is called.
 	 */
-	int  (*commit_txn)	(struct pmu *pmu);
+	int  (*commit_txn)	(struct pmu *pmu); /* optional */
 	/*
 	 * Will cancel the transaction, assumes ->disable() is called
 	 * for each successfull ->enable() during the transaction.
 	 */
-	void (*cancel_txn)	(struct pmu *pmu);
+	void (*cancel_txn)	(struct pmu *pmu); /* optional */
 };
 
 /**
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 5ed0c06..8ef4ba3 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -674,21 +674,14 @@ group_sched_in(struct perf_event *group_event,
 {
 	struct perf_event *event, *partial_group = NULL;
 	struct pmu *pmu = group_event->pmu;
-	bool txn = false;
 
 	if (group_event->state == PERF_EVENT_STATE_OFF)
 		return 0;
 
-	/* Check if group transaction availabe */
-	if (pmu->start_txn)
-		txn = true;
-
-	if (txn)
-		pmu->start_txn(pmu);
+	pmu->start_txn(pmu);
 
 	if (event_sched_in(group_event, cpuctx, ctx)) {
-		if (txn)
-			pmu->cancel_txn(pmu);
+		pmu->cancel_txn(pmu);
 		return -EAGAIN;
 	}
 
@@ -702,7 +695,7 @@ group_sched_in(struct perf_event *group_event,
 		}
 	}
 
-	if (!txn || !pmu->commit_txn(pmu))
+	if (!pmu->commit_txn(pmu))
 		return 0;
 
 group_error:
@@ -717,8 +710,7 @@ group_error:
 	}
 	event_sched_out(group_event, cpuctx, ctx);
 
-	if (txn)
-		pmu->cancel_txn(pmu);
+	pmu->cancel_txn(pmu);
 
 	return -EAGAIN;
 }
@@ -4965,6 +4957,31 @@ static LIST_HEAD(pmus);
 static DEFINE_MUTEX(pmus_lock);
 static struct srcu_struct pmus_srcu;
 
+static void perf_pmu_nop_void(struct pmu *pmu)
+{
+}
+
+static int perf_pmu_nop_int(struct pmu *pmu)
+{
+	return 0;
+}
+
+static void perf_pmu_start_txn(struct pmu *pmu)
+{
+	perf_pmu_disable(pmu);
+}
+
+static int perf_pmu_commit_txn(struct pmu *pmu)
+{
+	perf_pmu_enable(pmu);
+	return 0;
+}
+
+static void perf_pmu_cancel_txn(struct pmu *pmu)
+{
+	perf_pmu_enable(pmu);
+}
+
 int perf_pmu_register(struct pmu *pmu)
 {
 	int ret;
@@ -4974,6 +4991,29 @@ int perf_pmu_register(struct pmu *pmu)
 	pmu->pmu_disable_count = alloc_percpu(int);
 	if (!pmu->pmu_disable_count)
 		goto unlock;
+
+	if (!pmu->start_txn) {
+		if (pmu->pmu_enable) {
+			/*
+			 * If we have pmu_enable/pmu_disable calls, install
+			 * transaction stubs that use that to try and batch
+			 * hardware accesses.
+			 */
+			pmu->start_txn  = perf_pmu_start_txn;
+			pmu->commit_txn = perf_pmu_commit_txn;
+			pmu->cancel_txn = perf_pmu_cancel_txn;
+		} else {
+			pmu->start_txn  = perf_pmu_nop_void;
+			pmu->commit_txn = perf_pmu_nop_int;
+			pmu->cancel_txn = perf_pmu_nop_void;
+		}
+	}
+
+	if (!pmu->pmu_enable) {
+		pmu->pmu_enable  = perf_pmu_nop_void;
+		pmu->pmu_disable = perf_pmu_nop_void;
+	}
+
 	list_add_rcu(&pmu->entry, &pmus);
 	ret = 0;
 unlock:

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

* [tip:perf/core] perf: Shrink hw_perf_event
       [not found]             ` <new-submission>
                                 ` (610 preceding siblings ...)
  2010-09-09 19:49               ` [tip:perf/core] perf: Default PMU ops tip-bot for Peter Zijlstra
@ 2010-09-09 19:49               ` tip-bot for Peter Zijlstra
  2010-09-09 19:50               ` [tip:perf/core] perf: Rework the PMU methods tip-bot for Peter Zijlstra
                                 ` (94 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, fweisbec, a.p.zijlstra, tglx, mingo

Commit-ID:  fa407f35e0298d841e4088f95a7f9cf6e725c6d5
Gitweb:     http://git.kernel.org/tip/fa407f35e0298d841e4088f95a7f9cf6e725c6d5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 24 Jun 2010 12:35:12 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:30 +0200

perf: Shrink hw_perf_event

Use hw_perf_event::period_left instead of hw_perf_event::remaining
and win back 8 bytes.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    1 -
 kernel/perf_event.c        |   13 ++++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bf85733..8cafa15 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -529,7 +529,6 @@ struct hw_perf_event {
 			int		last_cpu;
 		};
 		struct { /* software */
-			s64		remaining;
 			struct hrtimer	hrtimer;
 		};
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 8ef4ba3..1a6cdbf 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4800,14 +4800,13 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
 	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	hwc->hrtimer.function = perf_swevent_hrtimer;
 	if (hwc->sample_period) {
-		u64 period;
+		s64 period = local64_read(&hwc->period_left);
 
-		if (hwc->remaining) {
-			if (hwc->remaining < 0)
+		if (period) {
+			if (period < 0)
 				period = 10000;
-			else
-				period = hwc->remaining;
-			hwc->remaining = 0;
+
+			local64_set(&hwc->period_left, 0);
 		} else {
 			period = max_t(u64, 10000, hwc->sample_period);
 		}
@@ -4823,7 +4822,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event)
 
 	if (hwc->sample_period) {
 		ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
-		hwc->remaining = ktime_to_ns(remaining);
+		local64_set(&hwc->period_left, ktime_to_ns(remaining));
 
 		hrtimer_cancel(&hwc->hrtimer);
 	}

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

* [tip:perf/core] perf: Rework the PMU methods
       [not found]             ` <new-submission>
                                 ` (611 preceding siblings ...)
  2010-09-09 19:49               ` [tip:perf/core] perf: Shrink hw_perf_event tip-bot for Peter Zijlstra
@ 2010-09-09 19:50               ` tip-bot for Peter Zijlstra
  2010-09-11  8:16                   ` Michael Cree
  2010-09-09 19:50               ` [tip:perf/core] perf: Remove the sysfs bits tip-bot for Peter Zijlstra
                                 ` (93 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo, mcree

Commit-ID:  a4eaf7f14675cb512d69f0c928055e73d0c6d252
Gitweb:     http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:30 +0200

perf: Rework the PMU methods

Replace pmu::{enable,disable,start,stop,unthrottle} with
pmu::{add,del,start,stop}, all of which take a flags argument.

The new interface extends the capability to stop a counter while
keeping it scheduled on the PMU. We replace the throttled state with
the generic stopped state.

This also allows us to efficiently stop/start counters over certain
code paths (like IRQ handlers).

It also allows scheduling a counter without it starting, allowing for
a generic frozen state (useful for rotating stopped counters).

The stopped state is implemented in two different ways, depending on
how the architecture implemented the throttled state:

 1) We disable the counter:
    a) the pmu has per-counter enable bits, we flip that
    b) we program a NOP event, preserving the counter state

 2) We store the counter state and ignore all read/overflow events

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Michael Cree <mcree@orcon.net.nz>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c            |   71 +++++++++++----
 arch/arm/kernel/perf_event.c              |   96 +++++++++++++-------
 arch/powerpc/kernel/perf_event.c          |  105 ++++++++++++++--------
 arch/powerpc/kernel/perf_event_fsl_emb.c  |  107 ++++++++++++++---------
 arch/sh/kernel/perf_event.c               |   75 +++++++++++-----
 arch/sparc/kernel/perf_event.c            |  109 ++++++++++++++---------
 arch/x86/kernel/cpu/perf_event.c          |  106 +++++++++++++---------
 arch/x86/kernel/cpu/perf_event_intel.c    |    2 +-
 arch/x86/kernel/cpu/perf_event_intel_ds.c |    2 +-
 include/linux/ftrace_event.h              |    4 +-
 include/linux/perf_event.h                |   54 +++++++++---
 kernel/hw_breakpoint.c                    |   29 ++++++-
 kernel/perf_event.c                       |  140 +++++++++++++++--------------
 kernel/trace/trace_event_perf.c           |    7 +-
 14 files changed, 576 insertions(+), 331 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 3e26073..380ef02 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -307,7 +307,7 @@ again:
 			     new_raw_count) != prev_raw_count)
 		goto again;
 
-	delta = (new_raw_count  - (prev_raw_count & alpha_pmu->pmc_count_mask[idx])) + ovf;
+	delta = (new_raw_count - (prev_raw_count & alpha_pmu->pmc_count_mask[idx])) + ovf;
 
 	/* It is possible on very rare occasions that the PMC has overflowed
 	 * but the interrupt is yet to come.  Detect and fix this situation.
@@ -402,14 +402,13 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
 		struct hw_perf_event *hwc = &pe->hw;
 		int idx = hwc->idx;
 
-		if (cpuc->current_idx[j] != PMC_NO_INDEX) {
-			cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
-			continue;
+		if (cpuc->current_idx[j] == PMC_NO_INDEX) {
+			alpha_perf_event_set_period(pe, hwc, idx);
+			cpuc->current_idx[j] = idx;
 		}
 
-		alpha_perf_event_set_period(pe, hwc, idx);
-		cpuc->current_idx[j] = idx;
-		cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
+		if (!(hwc->state & PERF_HES_STOPPED))
+			cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
 	}
 	cpuc->config = cpuc->event[0]->hw.config_base;
 }
@@ -420,7 +419,7 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
  *  - this function is called from outside this module via the pmu struct
  *    returned from perf event initialisation.
  */
-static int alpha_pmu_enable(struct perf_event *event)
+static int alpha_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int n0;
@@ -455,6 +454,10 @@ static int alpha_pmu_enable(struct perf_event *event)
 		}
 	}
 
+	hwc->state = PERF_HES_UPTODATE;
+	if (!(flags & PERF_EF_START))
+		hwc->state |= PERF_HES_STOPPED;
+
 	local_irq_restore(flags);
 	perf_pmu_enable(event->pmu);
 
@@ -467,7 +470,7 @@ static int alpha_pmu_enable(struct perf_event *event)
  *  - this function is called from outside this module via the pmu struct
  *    returned from perf event initialisation.
  */
-static void alpha_pmu_disable(struct perf_event *event)
+static void alpha_pmu_del(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
@@ -514,13 +517,44 @@ static void alpha_pmu_read(struct perf_event *event)
 }
 
 
-static void alpha_pmu_unthrottle(struct perf_event *event)
+static void alpha_pmu_stop(struct perf_event *event, int flags)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
+	if (!(hwc->state & PERF_HES_STOPPED)) {
+		cpuc->idx_mask &= !(1UL<<hwc->idx);
+		hwc->state |= PERF_HES_STOPPED;
+	}
+
+	if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
+		alpha_perf_event_update(event, hwc, hwc->idx, 0);
+		hwc->state |= PERF_HES_UPTODATE;
+	}
+
+	if (cpuc->enabled)
+		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
+}
+
+
+static void alpha_pmu_start(struct perf_event *event, int flags)
+{
+	struct hw_perf_event *hwc = &event->hw;
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
+		return;
+
+	if (flags & PERF_EF_RELOAD) {
+		WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
+		alpha_perf_event_set_period(event, hwc, hwc->idx);
+	}
+
+	hwc->state = 0;
+
 	cpuc->idx_mask |= 1UL<<hwc->idx;
-	wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
+	if (cpuc->enabled)
+		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
 }
 
 
@@ -671,7 +705,7 @@ static int alpha_pmu_event_init(struct perf_event *event)
 /*
  * Main entry point - enable HW performance counters.
  */
-static void alpha_pmu_pmu_enable(struct pmu *pmu)
+static void alpha_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -697,7 +731,7 @@ static void alpha_pmu_pmu_enable(struct pmu *pmu)
  * Main entry point - disable HW performance counters.
  */
 
-static void alpha_pmu_pmu_disable(struct pmu *pmu)
+static void alpha_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -711,13 +745,14 @@ static void alpha_pmu_pmu_disable(struct pmu *pmu)
 }
 
 static struct pmu pmu = {
-	.pmu_enable	= alpha_pmu_pmu_enable,
-	.pmu_disable	= alpha_pmu_pmu_disable,
+	.pmu_enable	= alpha_pmu_enable,
+	.pmu_disable	= alpha_pmu_disable,
 	.event_init	= alpha_pmu_event_init,
-	.enable		= alpha_pmu_enable,
-	.disable	= alpha_pmu_disable,
+	.add		= alpha_pmu_add,
+	.del		= alpha_pmu_del,
+	.start		= alpha_pmu_start,
+	.stop		= alpha_pmu_stop,
 	.read		= alpha_pmu_read,
-	.unthrottle	= alpha_pmu_unthrottle,
 };
 
 
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 3343f3f..448cfa6 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -221,46 +221,56 @@ again:
 }
 
 static void
-armpmu_disable(struct perf_event *event)
+armpmu_read(struct perf_event *event)
 {
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	int idx = hwc->idx;
-
-	WARN_ON(idx < 0);
-
-	clear_bit(idx, cpuc->active_mask);
-	armpmu->disable(hwc, idx);
-
-	barrier();
 
-	armpmu_event_update(event, hwc, idx);
-	cpuc->events[idx] = NULL;
-	clear_bit(idx, cpuc->used_mask);
+	/* Don't read disabled counters! */
+	if (hwc->idx < 0)
+		return;
 
-	perf_event_update_userpage(event);
+	armpmu_event_update(event, hwc, hwc->idx);
 }
 
 static void
-armpmu_read(struct perf_event *event)
+armpmu_stop(struct perf_event *event, int flags)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
-	/* Don't read disabled counters! */
-	if (hwc->idx < 0)
+	if (!armpmu)
 		return;
 
-	armpmu_event_update(event, hwc, hwc->idx);
+	/*
+	 * ARM pmu always has to update the counter, so ignore
+	 * PERF_EF_UPDATE, see comments in armpmu_start().
+	 */
+	if (!(hwc->state & PERF_HES_STOPPED)) {
+		armpmu->disable(hwc, hwc->idx);
+		barrier(); /* why? */
+		armpmu_event_update(event, hwc, hwc->idx);
+		hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
+	}
 }
 
 static void
-armpmu_unthrottle(struct perf_event *event)
+armpmu_start(struct perf_event *event, int flags)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
+	if (!armpmu)
+		return;
+
+	/*
+	 * ARM pmu always has to reprogram the period, so ignore
+	 * PERF_EF_RELOAD, see the comment below.
+	 */
+	if (flags & PERF_EF_RELOAD)
+		WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
+
+	hwc->state = 0;
 	/*
 	 * Set the period again. Some counters can't be stopped, so when we
-	 * were throttled we simply disabled the IRQ source and the counter
+	 * were stopped we simply disabled the IRQ source and the counter
 	 * may have been left counting. If we don't do this step then we may
 	 * get an interrupt too soon or *way* too late if the overflow has
 	 * happened since disabling.
@@ -269,8 +279,25 @@ armpmu_unthrottle(struct perf_event *event)
 	armpmu->enable(hwc, hwc->idx);
 }
 
+static void
+armpmu_del(struct perf_event *event, int flags)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	struct hw_perf_event *hwc = &event->hw;
+	int idx = hwc->idx;
+
+	WARN_ON(idx < 0);
+
+	clear_bit(idx, cpuc->active_mask);
+	armpmu_stop(event, PERF_EF_UPDATE);
+	cpuc->events[idx] = NULL;
+	clear_bit(idx, cpuc->used_mask);
+
+	perf_event_update_userpage(event);
+}
+
 static int
-armpmu_enable(struct perf_event *event)
+armpmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
@@ -295,11 +322,9 @@ armpmu_enable(struct perf_event *event)
 	cpuc->events[idx] = event;
 	set_bit(idx, cpuc->active_mask);
 
-	/* Set the period for the event. */
-	armpmu_event_set_period(event, hwc, idx);
-
-	/* Enable the event. */
-	armpmu->enable(hwc, idx);
+	hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
+	if (flags & PERF_EF_START)
+		armpmu_start(event, PERF_EF_RELOAD);
 
 	/* Propagate our changes to the userspace mapping. */
 	perf_event_update_userpage(event);
@@ -534,7 +559,7 @@ static int armpmu_event_init(struct perf_event *event)
 	return err;
 }
 
-static void armpmu_pmu_enable(struct pmu *pmu)
+static void armpmu_enable(struct pmu *pmu)
 {
 	/* Enable all of the perf events on hardware. */
 	int idx;
@@ -555,20 +580,21 @@ static void armpmu_pmu_enable(struct pmu *pmu)
 	armpmu->start();
 }
 
-static void armpmu_pmu_disable(struct pmu *pmu)
+static void armpmu_disable(struct pmu *pmu)
 {
 	if (armpmu)
 		armpmu->stop();
 }
 
 static struct pmu pmu = {
-	.pmu_enable = armpmu_pmu_enable,
-	.pmu_disable= armpmu_pmu_disable,
-	.event_init = armpmu_event_init,
-	.enable	    = armpmu_enable,
-	.disable    = armpmu_disable,
-	.unthrottle = armpmu_unthrottle,
-	.read	    = armpmu_read,
+	.pmu_enable	= armpmu_enable,
+	.pmu_disable	= armpmu_disable,
+	.event_init	= armpmu_event_init,
+	.add		= armpmu_add,
+	.del		= armpmu_del,
+	.start		= armpmu_start,
+	.stop		= armpmu_stop,
+	.read		= armpmu_read,
 };
 
 /*
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index deb84bb..9cb4924 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -402,6 +402,9 @@ static void power_pmu_read(struct perf_event *event)
 {
 	s64 val, delta, prev;
 
+	if (event->hw.state & PERF_HES_STOPPED)
+		return;
+
 	if (!event->hw.idx)
 		return;
 	/*
@@ -517,7 +520,7 @@ static void write_mmcr0(struct cpu_hw_events *cpuhw, unsigned long mmcr0)
  * Disable all events to prevent PMU interrupts and to allow
  * events to be added or removed.
  */
-static void power_pmu_pmu_disable(struct pmu *pmu)
+static void power_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -565,7 +568,7 @@ static void power_pmu_pmu_disable(struct pmu *pmu)
  * If we were previously disabled and events were added, then
  * put the new config on the PMU.
  */
-static void power_pmu_pmu_enable(struct pmu *pmu)
+static void power_pmu_enable(struct pmu *pmu)
 {
 	struct perf_event *event;
 	struct cpu_hw_events *cpuhw;
@@ -672,6 +675,8 @@ static void power_pmu_pmu_enable(struct pmu *pmu)
 		}
 		local64_set(&event->hw.prev_count, val);
 		event->hw.idx = idx;
+		if (event->hw.state & PERF_HES_STOPPED)
+			val = 0;
 		write_pmc(idx, val);
 		perf_event_update_userpage(event);
 	}
@@ -727,7 +732,7 @@ static int collect_events(struct perf_event *group, int max_count,
  * 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_event *event)
+static int power_pmu_add(struct perf_event *event, int ef_flags)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -749,6 +754,9 @@ static int power_pmu_enable(struct perf_event *event)
 	cpuhw->events[n0] = event->hw.config;
 	cpuhw->flags[n0] = event->hw.event_base;
 
+	if (!(ef_flags & PERF_EF_START))
+		event->hw.state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
+
 	/*
 	 * If group events scheduling transaction was started,
 	 * skip the schedulability test here, it will be peformed
@@ -777,7 +785,7 @@ nocheck:
 /*
  * Remove a event from the PMU.
  */
-static void power_pmu_disable(struct perf_event *event)
+static void power_pmu_del(struct perf_event *event, int ef_flags)
 {
 	struct cpu_hw_events *cpuhw;
 	long i;
@@ -826,27 +834,53 @@ static void power_pmu_disable(struct perf_event *event)
 }
 
 /*
- * Re-enable interrupts on a event after they were throttled
- * because they were coming too fast.
+ * POWER-PMU does not support disabling individual counters, hence
+ * program their cycle counter to their max value and ignore the interrupts.
  */
-static void power_pmu_unthrottle(struct perf_event *event)
+
+static void power_pmu_start(struct perf_event *event, int ef_flags)
 {
-	s64 val, left;
 	unsigned long flags;
+	s64 left;
 
 	if (!event->hw.idx || !event->hw.sample_period)
 		return;
+
+	if (!(event->hw.state & PERF_HES_STOPPED))
+		return;
+
+	if (ef_flags & PERF_EF_RELOAD)
+		WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
+
+	local_irq_save(flags);
+	perf_pmu_disable(event->pmu);
+
+	event->hw.state = 0;
+	left = local64_read(&event->hw.period_left);
+	write_pmc(event->hw.idx, left);
+
+	perf_event_update_userpage(event);
+	perf_pmu_enable(event->pmu);
+	local_irq_restore(flags);
+}
+
+static void power_pmu_stop(struct perf_event *event, int ef_flags)
+{
+	unsigned long flags;
+
+	if (!event->hw.idx || !event->hw.sample_period)
+		return;
+
+	if (event->hw.state & PERF_HES_STOPPED)
+		return;
+
 	local_irq_save(flags);
 	perf_pmu_disable(event->pmu);
+
 	power_pmu_read(event);
-	left = event->hw.sample_period;
-	event->hw.last_period = left;
-	val = 0;
-	if (left < 0x80000000L)
-		val = 0x80000000L - left;
-	write_pmc(event->hw.idx, val);
-	local64_set(&event->hw.prev_count, val);
-	local64_set(&event->hw.period_left, left);
+	event->hw.state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
+	write_pmc(event->hw.idx, 0);
+
 	perf_event_update_userpage(event);
 	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
@@ -1131,13 +1165,14 @@ static int power_pmu_event_init(struct perf_event *event)
 }
 
 struct pmu power_pmu = {
-	.pmu_enable	= power_pmu_pmu_enable,
-	.pmu_disable	= power_pmu_pmu_disable,
+	.pmu_enable	= power_pmu_enable,
+	.pmu_disable	= power_pmu_disable,
 	.event_init	= power_pmu_event_init,
-	.enable		= power_pmu_enable,
-	.disable	= power_pmu_disable,
+	.add		= power_pmu_add,
+	.del		= power_pmu_del,
+	.start		= power_pmu_start,
+	.stop		= power_pmu_stop,
 	.read		= power_pmu_read,
-	.unthrottle	= power_pmu_unthrottle,
 	.start_txn	= power_pmu_start_txn,
 	.cancel_txn	= power_pmu_cancel_txn,
 	.commit_txn	= power_pmu_commit_txn,
@@ -1155,6 +1190,11 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 	s64 prev, delta, left;
 	int record = 0;
 
+	if (event->hw.state & PERF_HES_STOPPED) {
+		write_pmc(event->hw.idx, 0);
+		return;
+	}
+
 	/* we don't have to worry about interrupts here */
 	prev = local64_read(&event->hw.prev_count);
 	delta = (val - prev) & 0xfffffffful;
@@ -1177,6 +1217,11 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 			val = 0x80000000LL - left;
 	}
 
+	write_pmc(event->hw.idx, val);
+	local64_set(&event->hw.prev_count, val);
+	local64_set(&event->hw.period_left, left);
+	perf_event_update_userpage(event);
+
 	/*
 	 * Finally record data if requested.
 	 */
@@ -1189,23 +1234,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 		if (event->attr.sample_type & PERF_SAMPLE_ADDR)
 			perf_get_data_addr(regs, &data.addr);
 
-		if (perf_event_overflow(event, nmi, &data, regs)) {
-			/*
-			 * Interrupts are coming too fast - throttle them
-			 * by setting the event to 0, so it will be
-			 * at least 2^30 cycles until the next interrupt
-			 * (assuming each event counts at most 2 counts
-			 * per cycle).
-			 */
-			val = 0;
-			left = ~0ULL >> 1;
-		}
+		if (perf_event_overflow(event, nmi, &data, regs))
+			power_pmu_stop(event, 0);
 	}
-
-	write_pmc(event->hw.idx, val);
-	local64_set(&event->hw.prev_count, val);
-	local64_set(&event->hw.period_left, left);
-	perf_event_update_userpage(event);
 }
 
 /*
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index 84b1974..7ecca59 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -156,6 +156,9 @@ static void fsl_emb_pmu_read(struct perf_event *event)
 {
 	s64 val, delta, prev;
 
+	if (event->hw.state & PERF_HES_STOPPED)
+		return;
+
 	/*
 	 * Performance monitor interrupts come even when interrupts
 	 * are soft-disabled, as long as interrupts are hard-enabled.
@@ -177,7 +180,7 @@ static void fsl_emb_pmu_read(struct perf_event *event)
  * Disable all events to prevent PMU interrupts and to allow
  * events to be added or removed.
  */
-static void fsl_emb_pmu_pmu_disable(struct pmu *pmu)
+static void fsl_emb_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -216,7 +219,7 @@ static void fsl_emb_pmu_pmu_disable(struct pmu *pmu)
  * If we were previously disabled and events were added, then
  * put the new config on the PMU.
  */
-static void fsl_emb_pmu_pmu_enable(struct pmu *pmu)
+static void fsl_emb_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuhw;
 	unsigned long flags;
@@ -263,7 +266,7 @@ static int collect_events(struct perf_event *group, int max_count,
 }
 
 /* context locked on entry */
-static int fsl_emb_pmu_enable(struct perf_event *event)
+static int fsl_emb_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuhw;
 	int ret = -EAGAIN;
@@ -302,6 +305,12 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 			val = 0x80000000L - left;
 	}
 	local64_set(&event->hw.prev_count, val);
+
+	if (!(flags & PERF_EF_START)) {
+		event->hw.state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
+		val = 0;
+	}
+
 	write_pmc(i, val);
 	perf_event_update_userpage(event);
 
@@ -316,7 +325,7 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
 }
 
 /* context locked on entry */
-static void fsl_emb_pmu_disable(struct perf_event *event)
+static void fsl_emb_pmu_del(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuhw;
 	int i = event->hw.idx;
@@ -353,30 +362,49 @@ static void fsl_emb_pmu_disable(struct perf_event *event)
 	put_cpu_var(cpu_hw_events);
 }
 
-/*
- * Re-enable interrupts on a event after they were throttled
- * because they were coming too fast.
- *
- * Context is locked on entry, but perf is not disabled.
- */
-static void fsl_emb_pmu_unthrottle(struct perf_event *event)
+static void fsl_emb_pmu_start(struct perf_event *event, int ef_flags)
+{
+	unsigned long flags;
+	s64 left;
+
+	if (event->hw.idx < 0 || !event->hw.sample_period)
+		return;
+
+	if (!(event->hw.state & PERF_HES_STOPPED))
+		return;
+
+	if (ef_flags & PERF_EF_RELOAD)
+		WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
+
+	local_irq_save(flags);
+	perf_pmu_disable(event->pmu);
+
+	event->hw.state = 0;
+	left = local64_read(&event->hw.period_left);
+	write_pmc(event->hw.idx, left);
+
+	perf_event_update_userpage(event);
+	perf_pmu_enable(event->pmu);
+	local_irq_restore(flags);
+}
+
+static void fsl_emb_pmu_stop(struct perf_event *event, int ef_flags)
 {
-	s64 val, left;
 	unsigned long flags;
 
 	if (event->hw.idx < 0 || !event->hw.sample_period)
 		return;
+
+	if (event->hw.state & PERF_HES_STOPPED)
+		return;
+
 	local_irq_save(flags);
 	perf_pmu_disable(event->pmu);
+
 	fsl_emb_pmu_read(event);
-	left = event->hw.sample_period;
-	event->hw.last_period = left;
-	val = 0;
-	if (left < 0x80000000L)
-		val = 0x80000000L - left;
-	write_pmc(event->hw.idx, val);
-	local64_set(&event->hw.prev_count, val);
-	local64_set(&event->hw.period_left, left);
+	event->hw.state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
+	write_pmc(event->hw.idx, 0);
+
 	perf_event_update_userpage(event);
 	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
@@ -524,13 +552,14 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
 }
 
 static struct pmu fsl_emb_pmu = {
-	.pmu_enable	= fsl_emb_pmu_pmu_enable,
-	.pmu_disable	= fsl_emb_pmu_pmu_disable,
+	.pmu_enable	= fsl_emb_pmu_enable,
+	.pmu_disable	= fsl_emb_pmu_disable,
 	.event_init	= fsl_emb_pmu_event_init,
-	.enable		= fsl_emb_pmu_enable,
-	.disable	= fsl_emb_pmu_disable,
+	.add		= fsl_emb_pmu_add,
+	.del		= fsl_emb_pmu_del,
+	.start		= fsl_emb_pmu_start,
+	.stop		= fsl_emb_pmu_stop,
 	.read		= fsl_emb_pmu_read,
-	.unthrottle	= fsl_emb_pmu_unthrottle,
 };
 
 /*
@@ -545,6 +574,11 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 	s64 prev, delta, left;
 	int record = 0;
 
+	if (event->hw.state & PERF_HES_STOPPED) {
+		write_pmc(event->hw.idx, 0);
+		return;
+	}
+
 	/* we don't have to worry about interrupts here */
 	prev = local64_read(&event->hw.prev_count);
 	delta = (val - prev) & 0xfffffffful;
@@ -567,6 +601,11 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 			val = 0x80000000LL - left;
 	}
 
+	write_pmc(event->hw.idx, val);
+	local64_set(&event->hw.prev_count, val);
+	local64_set(&event->hw.period_left, left);
+	perf_event_update_userpage(event);
+
 	/*
 	 * Finally record data if requested.
 	 */
@@ -576,23 +615,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 		perf_sample_data_init(&data, 0);
 		data.period = event->hw.last_period;
 
-		if (perf_event_overflow(event, nmi, &data, regs)) {
-			/*
-			 * Interrupts are coming too fast - throttle them
-			 * by setting the event to 0, so it will be
-			 * at least 2^30 cycles until the next interrupt
-			 * (assuming each event counts at most 2 counts
-			 * per cycle).
-			 */
-			val = 0;
-			left = ~0ULL >> 1;
-		}
+		if (perf_event_overflow(event, nmi, &data, regs))
+			fsl_emb_pmu_stop(event, 0);
 	}
-
-	write_pmc(event->hw.idx, val);
-	local64_set(&event->hw.prev_count, val);
-	local64_set(&event->hw.period_left, left);
-	perf_event_update_userpage(event);
 }
 
 static void perf_event_interrupt(struct pt_regs *regs)
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 4bbe190..cf39c48 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -206,26 +206,52 @@ again:
 	local64_add(delta, &event->count);
 }
 
-static void sh_pmu_disable(struct perf_event *event)
+static void sh_pmu_stop(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
 	int idx = hwc->idx;
 
-	clear_bit(idx, cpuc->active_mask);
-	sh_pmu->disable(hwc, idx);
+	if (!(event->hw.state & PERF_HES_STOPPED)) {
+		sh_pmu->disable(hwc, idx);
+		cpuc->events[idx] = NULL;
+		event->hw.state |= PERF_HES_STOPPED;
+	}
 
-	barrier();
+	if ((flags & PERF_EF_UPDATE) && !(event->hw.state & PERF_HES_UPTODATE)) {
+		sh_perf_event_update(event, &event->hw, idx);
+		event->hw.state |= PERF_HES_UPTODATE;
+	}
+}
 
-	sh_perf_event_update(event, &event->hw, idx);
+static void sh_pmu_start(struct perf_event *event, int flags)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	struct hw_perf_event *hwc = &event->hw;
+	int idx = hwc->idx;
 
-	cpuc->events[idx] = NULL;
-	clear_bit(idx, cpuc->used_mask);
+	if (WARN_ON_ONCE(idx == -1))
+		return;
+
+	if (flags & PERF_EF_RELOAD)
+		WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
+
+	cpuc->events[idx] = event;
+	event->hw.state = 0;
+	sh_pmu->enable(hwc, idx);
+}
+
+static void sh_pmu_del(struct perf_event *event, int flags)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	sh_pmu_stop(event, PERF_EF_UPDATE);
+	__clear_bit(event->hw.idx, cpuc->used_mask);
 
 	perf_event_update_userpage(event);
 }
 
-static int sh_pmu_enable(struct perf_event *event)
+static int sh_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
@@ -234,21 +260,20 @@ static int sh_pmu_enable(struct perf_event *event)
 
 	perf_pmu_disable(event->pmu);
 
-	if (test_and_set_bit(idx, cpuc->used_mask)) {
+	if (__test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, sh_pmu->num_events);
 		if (idx == sh_pmu->num_events)
 			goto out;
 
-		set_bit(idx, cpuc->used_mask);
+		__set_bit(idx, cpuc->used_mask);
 		hwc->idx = idx;
 	}
 
 	sh_pmu->disable(hwc, idx);
 
-	cpuc->events[idx] = event;
-	set_bit(idx, cpuc->active_mask);
-
-	sh_pmu->enable(hwc, idx);
+	event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
+	if (flags & PERF_EF_START)
+		sh_pmu_start(event, PERF_EF_RELOAD);
 
 	perf_event_update_userpage(event);
 	ret = 0;
@@ -285,7 +310,7 @@ static int sh_pmu_event_init(struct perf_event *event)
 	return err;
 }
 
-static void sh_pmu_pmu_enable(struct pmu *pmu)
+static void sh_pmu_enable(struct pmu *pmu)
 {
 	if (!sh_pmu_initialized())
 		return;
@@ -293,7 +318,7 @@ static void sh_pmu_pmu_enable(struct pmu *pmu)
 	sh_pmu->enable_all();
 }
 
-static void sh_pmu_pmu_disable(struct pmu *pmu)
+static void sh_pmu_disable(struct pmu *pmu)
 {
 	if (!sh_pmu_initialized())
 		return;
@@ -302,11 +327,13 @@ static void sh_pmu_pmu_disable(struct pmu *pmu)
 }
 
 static struct pmu pmu = {
-	.pmu_enable	= sh_pmu_pmu_enable,
-	.pmu_disable	= sh_pmu_pmu_disable,
+	.pmu_enable	= sh_pmu_enable,
+	.pmu_disable	= sh_pmu_disable,
 	.event_init	= sh_pmu_event_init,
-	.enable		= sh_pmu_enable,
-	.disable	= sh_pmu_disable,
+	.add		= sh_pmu_add,
+	.del		= sh_pmu_del,
+	.start		= sh_pmu_start,
+	.stop		= sh_pmu_stop,
 	.read		= sh_pmu_read,
 };
 
@@ -334,15 +361,15 @@ sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
 	return NOTIFY_OK;
 }
 
-int __cpuinit register_sh_pmu(struct sh_pmu *pmu)
+int __cpuinit register_sh_pmu(struct sh_pmu *_pmu)
 {
 	if (sh_pmu)
 		return -EBUSY;
-	sh_pmu = pmu;
+	sh_pmu = _pmu;
 
-	pr_info("Performance Events: %s support registered\n", pmu->name);
+	pr_info("Performance Events: %s support registered\n", _pmu->name);
 
-	WARN_ON(pmu->num_events > MAX_HWEVENTS);
+	WARN_ON(_pmu->num_events > MAX_HWEVENTS);
 
 	perf_pmu_register(&pmu);
 	perf_cpu_notifier(sh_pmu_notifier);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 37cae67..516be23 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -658,13 +658,16 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
 
 		enc = perf_event_get_enc(cpuc->events[i]);
 		pcr &= ~mask_for_index(idx);
-		pcr |= event_encoding(enc, idx);
+		if (hwc->state & PERF_HES_STOPPED)
+			pcr |= nop_for_index(idx);
+		else
+			pcr |= event_encoding(enc, idx);
 	}
 out:
 	return pcr;
 }
 
-static void sparc_pmu_pmu_enable(struct pmu *pmu)
+static void sparc_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	u64 pcr;
@@ -691,7 +694,7 @@ static void sparc_pmu_pmu_enable(struct pmu *pmu)
 	pcr_ops->write(cpuc->pcr);
 }
 
-static void sparc_pmu_pmu_disable(struct pmu *pmu)
+static void sparc_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	u64 val;
@@ -710,10 +713,53 @@ static void sparc_pmu_pmu_disable(struct pmu *pmu)
 	pcr_ops->write(cpuc->pcr);
 }
 
-static void sparc_pmu_disable(struct perf_event *event)
+static int active_event_index(struct cpu_hw_events *cpuc,
+			      struct perf_event *event)
+{
+	int i;
+
+	for (i = 0; i < cpuc->n_events; i++) {
+		if (cpuc->event[i] == event)
+			break;
+	}
+	BUG_ON(i == cpuc->n_events);
+	return cpuc->current_idx[i];
+}
+
+static void sparc_pmu_start(struct perf_event *event, int flags)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int idx = active_event_index(cpuc, event);
+
+	if (flags & PERF_EF_RELOAD) {
+		WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
+		sparc_perf_event_set_period(event, &event->hw, idx);
+	}
+
+	event->hw.state = 0;
+
+	sparc_pmu_enable_event(cpuc, &event->hw, idx);
+}
+
+static void sparc_pmu_stop(struct perf_event *event, int flags)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	int idx = active_event_index(cpuc, event);
+
+	if (!(event->hw.state & PERF_HES_STOPPED)) {
+		sparc_pmu_disable_event(cpuc, &event->hw, idx);
+		event->hw.state |= PERF_HES_STOPPED;
+	}
+
+	if (!(event->hw.state & PERF_HES_UPTODATE) && (flags & PERF_EF_UPDATE)) {
+		sparc_perf_event_update(event, &event->hw, idx);
+		event->hw.state |= PERF_HES_UPTODATE;
+	}
+}
+
+static void sparc_pmu_del(struct perf_event *event, int _flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	struct hw_perf_event *hwc = &event->hw;
 	unsigned long flags;
 	int i;
 
@@ -722,7 +768,10 @@ static void sparc_pmu_disable(struct perf_event *event)
 
 	for (i = 0; i < cpuc->n_events; i++) {
 		if (event == cpuc->event[i]) {
-			int idx = cpuc->current_idx[i];
+			/* Absorb the final count and turn off the
+			 * event.
+			 */
+			sparc_pmu_stop(event, PERF_EF_UPDATE);
 
 			/* Shift remaining entries down into
 			 * the existing slot.
@@ -734,13 +783,6 @@ static void sparc_pmu_disable(struct perf_event *event)
 					cpuc->current_idx[i];
 			}
 
-			/* Absorb the final count and turn off the
-			 * event.
-			 */
-			sparc_pmu_disable_event(cpuc, hwc, idx);
-			barrier();
-			sparc_perf_event_update(event, hwc, idx);
-
 			perf_event_update_userpage(event);
 
 			cpuc->n_events--;
@@ -752,19 +794,6 @@ static void sparc_pmu_disable(struct perf_event *event)
 	local_irq_restore(flags);
 }
 
-static int active_event_index(struct cpu_hw_events *cpuc,
-			      struct perf_event *event)
-{
-	int i;
-
-	for (i = 0; i < cpuc->n_events; i++) {
-		if (cpuc->event[i] == event)
-			break;
-	}
-	BUG_ON(i == cpuc->n_events);
-	return cpuc->current_idx[i];
-}
-
 static void sparc_pmu_read(struct perf_event *event)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -774,15 +803,6 @@ static void sparc_pmu_read(struct perf_event *event)
 	sparc_perf_event_update(event, hwc, idx);
 }
 
-static void sparc_pmu_unthrottle(struct perf_event *event)
-{
-	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
-	int idx = active_event_index(cpuc, event);
-	struct hw_perf_event *hwc = &event->hw;
-
-	sparc_pmu_enable_event(cpuc, hwc, idx);
-}
-
 static atomic_t active_events = ATOMIC_INIT(0);
 static DEFINE_MUTEX(pmc_grab_mutex);
 
@@ -984,7 +1004,7 @@ static int collect_events(struct perf_event *group, int max_count,
 	return n;
 }
 
-static int sparc_pmu_enable(struct perf_event *event)
+static int sparc_pmu_add(struct perf_event *event, int ef_flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int n0, ret = -EAGAIN;
@@ -1001,6 +1021,10 @@ static int sparc_pmu_enable(struct perf_event *event)
 	cpuc->events[n0] = event->hw.event_base;
 	cpuc->current_idx[n0] = PIC_NO_INDEX;
 
+	event->hw.state = PERF_HES_UPTODATE;
+	if (!(ef_flags & PERF_EF_START))
+		event->hw.state |= PERF_HES_STOPPED;
+
 	/*
 	 * If group events scheduling transaction was started,
 	 * skip the schedulability test here, it will be peformed
@@ -1156,13 +1180,14 @@ static int sparc_pmu_commit_txn(struct pmu *pmu)
 }
 
 static struct pmu pmu = {
-	.pmu_enable	= sparc_pmu_pmu_enable,
-	.pmu_disable	= sparc_pmu_pmu_disable,
+	.pmu_enable	= sparc_pmu_enable,
+	.pmu_disable	= sparc_pmu_disable,
 	.event_init	= sparc_pmu_event_init,
-	.enable		= sparc_pmu_enable,
-	.disable	= sparc_pmu_disable,
+	.add		= sparc_pmu_add,
+	.del		= sparc_pmu_del,
+	.start		= sparc_pmu_start,
+	.stop		= sparc_pmu_stop,
 	.read		= sparc_pmu_read,
-	.unthrottle	= sparc_pmu_unthrottle,
 	.start_txn	= sparc_pmu_start_txn,
 	.cancel_txn	= sparc_pmu_cancel_txn,
 	.commit_txn	= sparc_pmu_commit_txn,
@@ -1243,7 +1268,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
 			continue;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			sparc_pmu_disable_event(cpuc, hwc, idx);
+			sparc_pmu_stop(event, 0);
 	}
 
 	return NOTIFY_STOP;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 79705ac..dd6fec7 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -583,7 +583,7 @@ static void x86_pmu_disable_all(void)
 	}
 }
 
-static void x86_pmu_pmu_disable(struct pmu *pmu)
+static void x86_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
@@ -800,10 +800,10 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
 		hwc->last_tag == cpuc->tags[i];
 }
 
-static int x86_pmu_start(struct perf_event *event);
-static void x86_pmu_stop(struct perf_event *event);
+static void x86_pmu_start(struct perf_event *event, int flags);
+static void x86_pmu_stop(struct perf_event *event, int flags);
 
-static void x86_pmu_pmu_enable(struct pmu *pmu)
+static void x86_pmu_enable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct perf_event *event;
@@ -839,7 +839,14 @@ static void x86_pmu_pmu_enable(struct pmu *pmu)
 			    match_prev_assignment(hwc, cpuc, i))
 				continue;
 
-			x86_pmu_stop(event);
+			/*
+			 * Ensure we don't accidentally enable a stopped
+			 * counter simply because we rescheduled.
+			 */
+			if (hwc->state & PERF_HES_STOPPED)
+				hwc->state |= PERF_HES_ARCH;
+
+			x86_pmu_stop(event, PERF_EF_UPDATE);
 		}
 
 		for (i = 0; i < cpuc->n_events; i++) {
@@ -851,7 +858,10 @@ static void x86_pmu_pmu_enable(struct pmu *pmu)
 			else if (i < n_running)
 				continue;
 
-			x86_pmu_start(event);
+			if (hwc->state & PERF_HES_ARCH)
+				continue;
+
+			x86_pmu_start(event, PERF_EF_RELOAD);
 		}
 		cpuc->n_added = 0;
 		perf_events_lapic_init();
@@ -952,15 +962,12 @@ static void x86_pmu_enable_event(struct perf_event *event)
 }
 
 /*
- * activate a single event
+ * Add a single event to the PMU.
  *
  * The event is added to the group of enabled events
  * but only if it can be scehduled with existing events.
- *
- * Called with PMU disabled. If successful and return value 1,
- * then guaranteed to call perf_enable() and hw_perf_enable()
  */
-static int x86_pmu_enable(struct perf_event *event)
+static int x86_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc;
@@ -975,10 +982,14 @@ static int x86_pmu_enable(struct perf_event *event)
 	if (ret < 0)
 		goto out;
 
+	hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
+	if (!(flags & PERF_EF_START))
+		hwc->state |= PERF_HES_ARCH;
+
 	/*
 	 * If group events scheduling transaction was started,
 	 * skip the schedulability test here, it will be peformed
-	 * at commit time(->commit_txn) as a whole
+	 * at commit time (->commit_txn) as a whole
 	 */
 	if (cpuc->group_flag & PERF_EVENT_TXN)
 		goto done_collect;
@@ -1003,27 +1014,28 @@ out:
 	return ret;
 }
 
-static int x86_pmu_start(struct perf_event *event)
+static void x86_pmu_start(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int idx = event->hw.idx;
 
-	if (idx == -1)
-		return -EAGAIN;
+	if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED)))
+		return;
+
+	if (WARN_ON_ONCE(idx == -1))
+		return;
+
+	if (flags & PERF_EF_RELOAD) {
+		WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
+		x86_perf_event_set_period(event);
+	}
+
+	event->hw.state = 0;
 
-	x86_perf_event_set_period(event);
 	cpuc->events[idx] = event;
 	__set_bit(idx, cpuc->active_mask);
 	x86_pmu.enable(event);
 	perf_event_update_userpage(event);
-
-	return 0;
-}
-
-static void x86_pmu_unthrottle(struct perf_event *event)
-{
-	int ret = x86_pmu_start(event);
-	WARN_ON_ONCE(ret);
 }
 
 void perf_event_print_debug(void)
@@ -1080,27 +1092,29 @@ void perf_event_print_debug(void)
 	local_irq_restore(flags);
 }
 
-static void x86_pmu_stop(struct perf_event *event)
+static void x86_pmu_stop(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	int idx = hwc->idx;
-
-	if (!__test_and_clear_bit(idx, cpuc->active_mask))
-		return;
-
-	x86_pmu.disable(event);
 
-	/*
-	 * Drain the remaining delta count out of a event
-	 * that we are disabling:
-	 */
-	x86_perf_event_update(event);
+	if (__test_and_clear_bit(hwc->idx, cpuc->active_mask)) {
+		x86_pmu.disable(event);
+		cpuc->events[hwc->idx] = NULL;
+		WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
+		hwc->state |= PERF_HES_STOPPED;
+	}
 
-	cpuc->events[idx] = NULL;
+	if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
+		/*
+		 * Drain the remaining delta count out of a event
+		 * that we are disabling:
+		 */
+		x86_perf_event_update(event);
+		hwc->state |= PERF_HES_UPTODATE;
+	}
 }
 
-static void x86_pmu_disable(struct perf_event *event)
+static void x86_pmu_del(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	int i;
@@ -1113,7 +1127,7 @@ static void x86_pmu_disable(struct perf_event *event)
 	if (cpuc->group_flag & PERF_EVENT_TXN)
 		return;
 
-	x86_pmu_stop(event);
+	x86_pmu_stop(event, PERF_EF_UPDATE);
 
 	for (i = 0; i < cpuc->n_events; i++) {
 		if (event == cpuc->event_list[i]) {
@@ -1165,7 +1179,7 @@ static int x86_pmu_handle_irq(struct pt_regs *regs)
 			continue;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			x86_pmu_stop(event);
+			x86_pmu_stop(event, 0);
 	}
 
 	if (handled)
@@ -1605,15 +1619,17 @@ int x86_pmu_event_init(struct perf_event *event)
 }
 
 static struct pmu pmu = {
-	.pmu_enable	= x86_pmu_pmu_enable,
-	.pmu_disable	= x86_pmu_pmu_disable,
+	.pmu_enable	= x86_pmu_enable,
+	.pmu_disable	= x86_pmu_disable,
+
 	.event_init	= x86_pmu_event_init,
-	.enable		= x86_pmu_enable,
-	.disable	= x86_pmu_disable,
+
+	.add		= x86_pmu_add,
+	.del		= x86_pmu_del,
 	.start		= x86_pmu_start,
 	.stop		= x86_pmu_stop,
 	.read		= x86_pmu_read,
-	.unthrottle	= x86_pmu_unthrottle,
+
 	.start_txn	= x86_pmu_start_txn,
 	.cancel_txn	= x86_pmu_cancel_txn,
 	.commit_txn	= x86_pmu_commit_txn,
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index ee05c90..82395f2 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -763,7 +763,7 @@ again:
 		data.period = event->hw.last_period;
 
 		if (perf_event_overflow(event, 1, &data, regs))
-			x86_pmu_stop(event);
+			x86_pmu_stop(event, 0);
 	}
 
 	/*
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 18018d1..9893a2f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -491,7 +491,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
 		regs.flags &= ~PERF_EFLAGS_EXACT;
 
 	if (perf_event_overflow(event, 1, &data, &regs))
-		x86_pmu_stop(event);
+		x86_pmu_stop(event, 0);
 }
 
 static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5f8ad7b..8beabb9 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -252,8 +252,8 @@ DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
 
 extern int  perf_trace_init(struct perf_event *event);
 extern void perf_trace_destroy(struct perf_event *event);
-extern int  perf_trace_enable(struct perf_event *event);
-extern void perf_trace_disable(struct perf_event *event);
+extern int  perf_trace_add(struct perf_event *event, int flags);
+extern void perf_trace_del(struct perf_event *event, int flags);
 extern int  ftrace_profile_set_filter(struct perf_event *event, int event_id,
 				     char *filter_str);
 extern void ftrace_profile_free_filter(struct perf_event *event);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8cafa15..402073c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -538,6 +538,7 @@ struct hw_perf_event {
 		};
 #endif
 	};
+	int				state;
 	local64_t			prev_count;
 	u64				sample_period;
 	u64				last_period;
@@ -549,6 +550,13 @@ struct hw_perf_event {
 #endif
 };
 
+/*
+ * hw_perf_event::state flags
+ */
+#define PERF_HES_STOPPED	0x01 /* the counter is stopped */
+#define PERF_HES_UPTODATE	0x02 /* event->count up-to-date */
+#define PERF_HES_ARCH		0x04
+
 struct perf_event;
 
 /*
@@ -564,42 +572,62 @@ struct pmu {
 
 	int				*pmu_disable_count;
 
+	/*
+	 * Fully disable/enable this PMU, can be used to protect from the PMI
+	 * as well as for lazy/batch writing of the MSRs.
+	 */
 	void (*pmu_enable)		(struct pmu *pmu); /* optional */
 	void (*pmu_disable)		(struct pmu *pmu); /* optional */
 
 	/*
+	 * Try and initialize the event for this PMU.
 	 * Should return -ENOENT when the @event doesn't match this PMU.
 	 */
 	int (*event_init)		(struct perf_event *event);
 
-	int  (*enable)			(struct perf_event *event);
-	void (*disable)			(struct perf_event *event);
-	int  (*start)			(struct perf_event *event);
-	void (*stop)			(struct perf_event *event);
+#define PERF_EF_START	0x01		/* start the counter when adding    */
+#define PERF_EF_RELOAD	0x02		/* reload the counter when starting */
+#define PERF_EF_UPDATE	0x04		/* update the counter when stopping */
+
+	/*
+	 * Adds/Removes a counter to/from the PMU, can be done inside
+	 * a transaction, see the ->*_txn() methods.
+	 */
+	int  (*add)			(struct perf_event *event, int flags);
+	void (*del)			(struct perf_event *event, int flags);
+
+	/*
+	 * Starts/Stops a counter present on the PMU. The PMI handler
+	 * should stop the counter when perf_event_overflow() returns
+	 * !0. ->start() will be used to continue.
+	 */
+	void (*start)			(struct perf_event *event, int flags);
+	void (*stop)			(struct perf_event *event, int flags);
+
+	/*
+	 * Updates the counter value of the event.
+	 */
 	void (*read)			(struct perf_event *event);
-	void (*unthrottle)		(struct perf_event *event);
 
 	/*
 	 * Group events scheduling is treated as a transaction, add
 	 * group events as a whole and perform one schedulability test.
 	 * If the test fails, roll back the whole group
-	 */
-
-	/*
-	 * Start the transaction, after this ->enable() doesn't need to
+	 *
+	 * Start the transaction, after this ->add() doesn't need to
 	 * do schedulability tests.
 	 */
 	void (*start_txn)	(struct pmu *pmu); /* optional */
 	/*
-	 * If ->start_txn() disabled the ->enable() schedulability test
+	 * If ->start_txn() disabled the ->add() schedulability test
 	 * then ->commit_txn() is required to perform one. On success
 	 * the transaction is closed. On error the transaction is kept
 	 * open until ->cancel_txn() is called.
 	 */
 	int  (*commit_txn)	(struct pmu *pmu); /* optional */
 	/*
-	 * Will cancel the transaction, assumes ->disable() is called
-	 * for each successfull ->enable() during the transaction.
+	 * Will cancel the transaction, assumes ->del() is called
+	 * for each successfull ->add() during the transaction.
 	 */
 	void (*cancel_txn)	(struct pmu *pmu); /* optional */
 };
@@ -680,7 +708,7 @@ struct perf_event {
 	int				nr_siblings;
 	int				group_flags;
 	struct perf_event		*group_leader;
-	struct pmu		*pmu;
+	struct pmu			*pmu;
 
 	enum perf_event_active_state	state;
 	unsigned int			attach_state;
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index e9c5cfa..6f15009 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -586,10 +586,35 @@ static int hw_breakpoint_event_init(struct perf_event *bp)
 	return 0;
 }
 
+static int hw_breakpoint_add(struct perf_event *bp, int flags)
+{
+	if (!(flags & PERF_EF_START))
+		bp->hw.state = PERF_HES_STOPPED;
+
+	return arch_install_hw_breakpoint(bp);
+}
+
+static void hw_breakpoint_del(struct perf_event *bp, int flags)
+{
+	arch_uninstall_hw_breakpoint(bp);
+}
+
+static void hw_breakpoint_start(struct perf_event *bp, int flags)
+{
+	bp->hw.state = 0;
+}
+
+static void hw_breakpoint_stop(struct perf_event *bp, int flags)
+{
+	bp->hw.state = PERF_HES_STOPPED;
+}
+
 static struct pmu perf_breakpoint = {
 	.event_init	= hw_breakpoint_event_init,
-	.enable		= arch_install_hw_breakpoint,
-	.disable	= arch_uninstall_hw_breakpoint,
+	.add		= hw_breakpoint_add,
+	.del		= hw_breakpoint_del,
+	.start		= hw_breakpoint_start,
+	.stop		= hw_breakpoint_stop,
 	.read		= hw_breakpoint_pmu_read,
 };
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 1a6cdbf..3bace4f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -424,7 +424,7 @@ event_sched_out(struct perf_event *event,
 		event->state = PERF_EVENT_STATE_OFF;
 	}
 	event->tstamp_stopped = ctx->time;
-	event->pmu->disable(event);
+	event->pmu->del(event, 0);
 	event->oncpu = -1;
 
 	if (!is_software_event(event))
@@ -649,7 +649,7 @@ event_sched_in(struct perf_event *event,
 	 */
 	smp_wmb();
 
-	if (event->pmu->enable(event)) {
+	if (event->pmu->add(event, PERF_EF_START)) {
 		event->state = PERF_EVENT_STATE_INACTIVE;
 		event->oncpu = -1;
 		return -EAGAIN;
@@ -1482,22 +1482,6 @@ do {					\
 	return div64_u64(dividend, divisor);
 }
 
-static void perf_event_stop(struct perf_event *event)
-{
-	if (!event->pmu->stop)
-		return event->pmu->disable(event);
-
-	return event->pmu->stop(event);
-}
-
-static int perf_event_start(struct perf_event *event)
-{
-	if (!event->pmu->start)
-		return event->pmu->enable(event);
-
-	return event->pmu->start(event);
-}
-
 static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 {
 	struct hw_perf_event *hwc = &event->hw;
@@ -1517,9 +1501,9 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 	hwc->sample_period = sample_period;
 
 	if (local64_read(&hwc->period_left) > 8*sample_period) {
-		perf_event_stop(event);
+		event->pmu->stop(event, PERF_EF_UPDATE);
 		local64_set(&hwc->period_left, 0);
-		perf_event_start(event);
+		event->pmu->start(event, PERF_EF_RELOAD);
 	}
 }
 
@@ -1548,7 +1532,7 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 		 */
 		if (interrupts == MAX_INTERRUPTS) {
 			perf_log_throttle(event, 1);
-			event->pmu->unthrottle(event);
+			event->pmu->start(event, 0);
 		}
 
 		if (!event->attr.freq || !event->attr.sample_freq)
@@ -2506,6 +2490,9 @@ int perf_event_task_disable(void)
 
 static int perf_event_index(struct perf_event *event)
 {
+	if (event->hw.state & PERF_HES_STOPPED)
+		return 0;
+
 	if (event->state != PERF_EVENT_STATE_ACTIVE)
 		return 0;
 
@@ -4120,8 +4107,6 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
 	struct hw_perf_event *hwc = &event->hw;
 	int ret = 0;
 
-	throttle = (throttle && event->pmu->unthrottle != NULL);
-
 	if (!throttle) {
 		hwc->interrupts++;
 	} else {
@@ -4246,7 +4231,7 @@ static void perf_swevent_overflow(struct perf_event *event, u64 overflow,
 	}
 }
 
-static void perf_swevent_add(struct perf_event *event, u64 nr,
+static void perf_swevent_event(struct perf_event *event, u64 nr,
 			       int nmi, struct perf_sample_data *data,
 			       struct pt_regs *regs)
 {
@@ -4272,6 +4257,9 @@ static void perf_swevent_add(struct perf_event *event, u64 nr,
 static int perf_exclude_event(struct perf_event *event,
 			      struct pt_regs *regs)
 {
+	if (event->hw.state & PERF_HES_STOPPED)
+		return 0;
+
 	if (regs) {
 		if (event->attr.exclude_user && user_mode(regs))
 			return 1;
@@ -4371,7 +4359,7 @@ static void do_perf_sw_event(enum perf_type_id type, u32 event_id,
 
 	hlist_for_each_entry_rcu(event, node, head, hlist_entry) {
 		if (perf_swevent_match(event, type, event_id, data, regs))
-			perf_swevent_add(event, nr, nmi, data, regs);
+			perf_swevent_event(event, nr, nmi, data, regs);
 	}
 end:
 	rcu_read_unlock();
@@ -4415,7 +4403,7 @@ static void perf_swevent_read(struct perf_event *event)
 {
 }
 
-static int perf_swevent_enable(struct perf_event *event)
+static int perf_swevent_add(struct perf_event *event, int flags)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	struct perf_cpu_context *cpuctx;
@@ -4428,6 +4416,8 @@ static int perf_swevent_enable(struct perf_event *event)
 		perf_swevent_set_period(event);
 	}
 
+	hwc->state = !(flags & PERF_EF_START);
+
 	head = find_swevent_head(cpuctx, event);
 	if (WARN_ON_ONCE(!head))
 		return -EINVAL;
@@ -4437,18 +4427,19 @@ static int perf_swevent_enable(struct perf_event *event)
 	return 0;
 }
 
-static void perf_swevent_disable(struct perf_event *event)
+static void perf_swevent_del(struct perf_event *event, int flags)
 {
 	hlist_del_rcu(&event->hlist_entry);
 }
 
-static void perf_swevent_void(struct perf_event *event)
+static void perf_swevent_start(struct perf_event *event, int flags)
 {
+	event->hw.state = 0;
 }
 
-static int perf_swevent_int(struct perf_event *event)
+static void perf_swevent_stop(struct perf_event *event, int flags)
 {
-	return 0;
+	event->hw.state = PERF_HES_STOPPED;
 }
 
 /* Deref the hlist from the update side */
@@ -4604,12 +4595,11 @@ static int perf_swevent_init(struct perf_event *event)
 
 static struct pmu perf_swevent = {
 	.event_init	= perf_swevent_init,
-	.enable		= perf_swevent_enable,
-	.disable	= perf_swevent_disable,
-	.start		= perf_swevent_int,
-	.stop		= perf_swevent_void,
+	.add		= perf_swevent_add,
+	.del		= perf_swevent_del,
+	.start		= perf_swevent_start,
+	.stop		= perf_swevent_stop,
 	.read		= perf_swevent_read,
-	.unthrottle	= perf_swevent_void, /* hwc->interrupts already reset */
 };
 
 #ifdef CONFIG_EVENT_TRACING
@@ -4657,7 +4647,7 @@ void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
 
 	hlist_for_each_entry_rcu(event, node, head, hlist_entry) {
 		if (perf_tp_event_match(event, &data, regs))
-			perf_swevent_add(event, count, 1, &data, regs);
+			perf_swevent_event(event, count, 1, &data, regs);
 	}
 
 	perf_swevent_put_recursion_context(rctx);
@@ -4696,12 +4686,11 @@ static int perf_tp_event_init(struct perf_event *event)
 
 static struct pmu perf_tracepoint = {
 	.event_init	= perf_tp_event_init,
-	.enable		= perf_trace_enable,
-	.disable	= perf_trace_disable,
-	.start		= perf_swevent_int,
-	.stop		= perf_swevent_void,
+	.add		= perf_trace_add,
+	.del		= perf_trace_del,
+	.start		= perf_swevent_start,
+	.stop		= perf_swevent_stop,
 	.read		= perf_swevent_read,
-	.unthrottle	= perf_swevent_void,
 };
 
 static inline void perf_tp_register(void)
@@ -4757,8 +4746,8 @@ void perf_bp_event(struct perf_event *bp, void *data)
 
 	perf_sample_data_init(&sample, bp->attr.bp_addr);
 
-	if (!perf_exclude_event(bp, regs))
-		perf_swevent_add(bp, 1, 1, &sample, regs);
+	if (!bp->hw.state && !perf_exclude_event(bp, regs))
+		perf_swevent_event(bp, 1, 1, &sample, regs);
 }
 #endif
 
@@ -4834,32 +4823,39 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event)
 
 static void cpu_clock_event_update(struct perf_event *event)
 {
-	int cpu = raw_smp_processor_id();
 	s64 prev;
 	u64 now;
 
-	now = cpu_clock(cpu);
+	now = local_clock();
 	prev = local64_xchg(&event->hw.prev_count, now);
 	local64_add(now - prev, &event->count);
 }
 
-static int cpu_clock_event_enable(struct perf_event *event)
+static void cpu_clock_event_start(struct perf_event *event, int flags)
 {
-	struct hw_perf_event *hwc = &event->hw;
-	int cpu = raw_smp_processor_id();
-
-	local64_set(&hwc->prev_count, cpu_clock(cpu));
+	local64_set(&event->hw.prev_count, local_clock());
 	perf_swevent_start_hrtimer(event);
-
-	return 0;
 }
 
-static void cpu_clock_event_disable(struct perf_event *event)
+static void cpu_clock_event_stop(struct perf_event *event, int flags)
 {
 	perf_swevent_cancel_hrtimer(event);
 	cpu_clock_event_update(event);
 }
 
+static int cpu_clock_event_add(struct perf_event *event, int flags)
+{
+	if (flags & PERF_EF_START)
+		cpu_clock_event_start(event, flags);
+
+	return 0;
+}
+
+static void cpu_clock_event_del(struct perf_event *event, int flags)
+{
+	cpu_clock_event_stop(event, flags);
+}
+
 static void cpu_clock_event_read(struct perf_event *event)
 {
 	cpu_clock_event_update(event);
@@ -4878,8 +4874,10 @@ static int cpu_clock_event_init(struct perf_event *event)
 
 static struct pmu perf_cpu_clock = {
 	.event_init	= cpu_clock_event_init,
-	.enable		= cpu_clock_event_enable,
-	.disable	= cpu_clock_event_disable,
+	.add		= cpu_clock_event_add,
+	.del		= cpu_clock_event_del,
+	.start		= cpu_clock_event_start,
+	.stop		= cpu_clock_event_stop,
 	.read		= cpu_clock_event_read,
 };
 
@@ -4897,25 +4895,29 @@ static void task_clock_event_update(struct perf_event *event, u64 now)
 	local64_add(delta, &event->count);
 }
 
-static int task_clock_event_enable(struct perf_event *event)
+static void task_clock_event_start(struct perf_event *event, int flags)
 {
-	struct hw_perf_event *hwc = &event->hw;
-	u64 now;
-
-	now = event->ctx->time;
-
-	local64_set(&hwc->prev_count, now);
-
+	local64_set(&event->hw.prev_count, event->ctx->time);
 	perf_swevent_start_hrtimer(event);
-
-	return 0;
 }
 
-static void task_clock_event_disable(struct perf_event *event)
+static void task_clock_event_stop(struct perf_event *event, int flags)
 {
 	perf_swevent_cancel_hrtimer(event);
 	task_clock_event_update(event, event->ctx->time);
+}
+
+static int task_clock_event_add(struct perf_event *event, int flags)
+{
+	if (flags & PERF_EF_START)
+		task_clock_event_start(event, flags);
 
+	return 0;
+}
+
+static void task_clock_event_del(struct perf_event *event, int flags)
+{
+	task_clock_event_stop(event, PERF_EF_UPDATE);
 }
 
 static void task_clock_event_read(struct perf_event *event)
@@ -4947,8 +4949,10 @@ static int task_clock_event_init(struct perf_event *event)
 
 static struct pmu perf_task_clock = {
 	.event_init	= task_clock_event_init,
-	.enable		= task_clock_event_enable,
-	.disable	= task_clock_event_disable,
+	.add		= task_clock_event_add,
+	.del		= task_clock_event_del,
+	.start		= task_clock_event_start,
+	.stop		= task_clock_event_stop,
 	.read		= task_clock_event_read,
 };
 
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index f3bbcd1..39c059c 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -101,7 +101,7 @@ int perf_trace_init(struct perf_event *p_event)
 	return ret;
 }
 
-int perf_trace_enable(struct perf_event *p_event)
+int perf_trace_add(struct perf_event *p_event, int flags)
 {
 	struct ftrace_event_call *tp_event = p_event->tp_event;
 	struct hlist_head __percpu *pcpu_list;
@@ -111,13 +111,16 @@ int perf_trace_enable(struct perf_event *p_event)
 	if (WARN_ON_ONCE(!pcpu_list))
 		return -EINVAL;
 
+	if (!(flags & PERF_EF_START))
+		p_event->hw.state = PERF_HES_STOPPED;
+
 	list = this_cpu_ptr(pcpu_list);
 	hlist_add_head_rcu(&p_event->hlist_entry, list);
 
 	return 0;
 }
 
-void perf_trace_disable(struct perf_event *p_event)
+void perf_trace_del(struct perf_event *p_event, int flags)
 {
 	hlist_del_rcu(&p_event->hlist_entry);
 }

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

* [tip:perf/core] perf: Remove the sysfs bits
       [not found]             ` <new-submission>
                                 ` (612 preceding siblings ...)
  2010-09-09 19:50               ` [tip:perf/core] perf: Rework the PMU methods tip-bot for Peter Zijlstra
@ 2010-09-09 19:50               ` tip-bot for Peter Zijlstra
  2010-09-09 19:50               ` [tip:perf/core] perf: Separate find_get_context() from event initialization tip-bot for Peter Zijlstra
                                 ` (92 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  15ac9a395a753cb28c674e7ea80386ffdff21785
Gitweb:     http://git.kernel.org/tip/15ac9a395a753cb28c674e7ea80386ffdff21785
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 6 Sep 2010 15:51:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:31 +0200

perf: Remove the sysfs bits

Neither the overcommit nor the reservation sysfs parameter were
actually working, remove them as they'll only get in the way.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c   |    3 +-
 arch/arm/kernel/perf_event.c     |    9 +---
 arch/sparc/kernel/perf_event.c   |    9 +--
 arch/x86/kernel/cpu/perf_event.c |    1 -
 include/linux/perf_event.h       |    6 --
 kernel/perf_event.c              |  124 --------------------------------------
 6 files changed, 5 insertions(+), 147 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 380ef02..9bb8c02 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -808,7 +808,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
 	wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
 
 	/* la_ptr is the counter that overflowed. */
-	if (unlikely(la_ptr >= perf_max_events)) {
+	if (unlikely(la_ptr >= alpha_pmu->num_pmcs)) {
 		/* This should never occur! */
 		irq_err_count++;
 		pr_warning("PMI: silly index %ld\n", la_ptr);
@@ -879,7 +879,6 @@ void __init init_hw_perf_events(void)
 
 	/* And set up PMU specification */
 	alpha_pmu = &ev67_pmu;
-	perf_max_events = alpha_pmu->num_pmcs;
 
 	perf_pmu_register(&pmu);
 }
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 448cfa6..45d6a35 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -534,7 +534,7 @@ static int armpmu_event_init(struct perf_event *event)
 	event->destroy = hw_perf_event_destroy;
 
 	if (!atomic_inc_not_zero(&active_events)) {
-		if (atomic_read(&active_events) > perf_max_events) {
+		if (atomic_read(&active_events) > armpmu.num_events) {
 			atomic_dec(&active_events);
 			return -ENOSPC;
 		}
@@ -2974,14 +2974,12 @@ init_hw_perf_events(void)
 			armpmu = &armv6pmu;
 			memcpy(armpmu_perf_cache_map, armv6_perf_cache_map,
 					sizeof(armv6_perf_cache_map));
-			perf_max_events	= armv6pmu.num_events;
 			break;
 		case 0xB020:	/* ARM11mpcore */
 			armpmu = &armv6mpcore_pmu;
 			memcpy(armpmu_perf_cache_map,
 			       armv6mpcore_perf_cache_map,
 			       sizeof(armv6mpcore_perf_cache_map));
-			perf_max_events = armv6mpcore_pmu.num_events;
 			break;
 		case 0xC080:	/* Cortex-A8 */
 			armv7pmu.id = ARM_PERF_PMU_ID_CA8;
@@ -2993,7 +2991,6 @@ init_hw_perf_events(void)
 			/* Reset PMNC and read the nb of CNTx counters
 			    supported */
 			armv7pmu.num_events = armv7_reset_read_pmnc();
-			perf_max_events = armv7pmu.num_events;
 			break;
 		case 0xC090:	/* Cortex-A9 */
 			armv7pmu.id = ARM_PERF_PMU_ID_CA9;
@@ -3005,7 +3002,6 @@ init_hw_perf_events(void)
 			/* Reset PMNC and read the nb of CNTx counters
 			    supported */
 			armv7pmu.num_events = armv7_reset_read_pmnc();
-			perf_max_events = armv7pmu.num_events;
 			break;
 		}
 	/* Intel CPUs [xscale]. */
@@ -3016,13 +3012,11 @@ init_hw_perf_events(void)
 			armpmu = &xscale1pmu;
 			memcpy(armpmu_perf_cache_map, xscale_perf_cache_map,
 					sizeof(xscale_perf_cache_map));
-			perf_max_events	= xscale1pmu.num_events;
 			break;
 		case 2:
 			armpmu = &xscale2pmu;
 			memcpy(armpmu_perf_cache_map, xscale_perf_cache_map,
 					sizeof(xscale_perf_cache_map));
-			perf_max_events	= xscale2pmu.num_events;
 			break;
 		}
 	}
@@ -3032,7 +3026,6 @@ init_hw_perf_events(void)
 				arm_pmu_names[armpmu->id], armpmu->num_events);
 	} else {
 		pr_info("no hardware support available\n");
-		perf_max_events = -1;
 	}
 
 	perf_pmu_register(&pmu);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 516be23..f9a7067 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -897,7 +897,7 @@ static int sparc_check_constraints(struct perf_event **evts,
 	if (!n_ev)
 		return 0;
 
-	if (n_ev > perf_max_events)
+	if (n_ev > MAX_HWEVENTS)
 		return -1;
 
 	msk0 = perf_event_get_msk(events[0]);
@@ -1014,7 +1014,7 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags)
 	perf_pmu_disable(event->pmu);
 
 	n0 = cpuc->n_events;
-	if (n0 >= perf_max_events)
+	if (n0 >= MAX_HWEVENTS)
 		goto out;
 
 	cpuc->event[n0] = event;
@@ -1097,7 +1097,7 @@ static int sparc_pmu_event_init(struct perf_event *event)
 	n = 0;
 	if (event->group_leader != event) {
 		n = collect_events(event->group_leader,
-				   perf_max_events - 1,
+				   MAX_HWEVENTS - 1,
 				   evts, events, current_idx_dmy);
 		if (n < 0)
 			return -EINVAL;
@@ -1309,9 +1309,6 @@ void __init init_hw_perf_events(void)
 
 	pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type);
 
-	/* All sparc64 PMUs currently have 2 events.  */
-	perf_max_events = 2;
-
 	perf_pmu_register(&pmu);
 	register_die_notifier(&perf_event_nmi_notifier);
 }
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index dd6fec7..0fb1705 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1396,7 +1396,6 @@ void __init init_hw_perf_events(void)
 		x86_pmu.num_counters = X86_PMC_MAX_GENERIC;
 	}
 	x86_pmu.intel_ctrl = (1 << x86_pmu.num_counters) - 1;
-	perf_max_events = x86_pmu.num_counters;
 
 	if (x86_pmu.num_counters_fixed > X86_PMC_MAX_FIXED) {
 		WARN(1, KERN_ERR "hw perf events fixed %d > max(%d), clipping!",
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 402073c..b22176d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -860,7 +860,6 @@ struct perf_cpu_context {
 	struct perf_event_context	ctx;
 	struct perf_event_context	*task_ctx;
 	int				active_oncpu;
-	int				max_pertask;
 	int				exclusive;
 	struct swevent_hlist		*swevent_hlist;
 	struct mutex			hlist_mutex;
@@ -883,11 +882,6 @@ struct perf_output_handle {
 
 #ifdef CONFIG_PERF_EVENTS
 
-/*
- * Set by architecture code:
- */
-extern int perf_max_events;
-
 extern int perf_pmu_register(struct pmu *pmu);
 extern void perf_pmu_unregister(struct pmu *pmu);
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 3bace4f..8462e69 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -39,10 +39,6 @@
  */
 static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context);
 
-int perf_max_events __read_mostly = 1;
-static int perf_reserved_percpu __read_mostly;
-static int perf_overcommit __read_mostly = 1;
-
 static atomic_t nr_events __read_mostly;
 static atomic_t nr_mmap_events __read_mostly;
 static atomic_t nr_comm_events __read_mostly;
@@ -66,11 +62,6 @@ int sysctl_perf_event_sample_rate __read_mostly = 100000;
 
 static atomic64_t perf_event_id;
 
-/*
- * Lock for (sysadmin-configurable) event reservations:
- */
-static DEFINE_SPINLOCK(perf_resource_lock);
-
 void __weak perf_event_print_debug(void)	{ }
 
 void perf_pmu_disable(struct pmu *pmu)
@@ -480,16 +471,6 @@ static void __perf_event_remove_from_context(void *info)
 
 	list_del_event(event, ctx);
 
-	if (!ctx->task) {
-		/*
-		 * Allow more per task events with respect to the
-		 * reservation:
-		 */
-		cpuctx->max_pertask =
-			min(perf_max_events - ctx->nr_events,
-			    perf_max_events - perf_reserved_percpu);
-	}
-
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -823,9 +804,6 @@ static void __perf_install_in_context(void *info)
 		}
 	}
 
-	if (!err && !ctx->task && cpuctx->max_pertask)
-		cpuctx->max_pertask--;
-
 unlock:
 	raw_spin_unlock(&ctx->lock);
 }
@@ -5930,10 +5908,6 @@ static void __cpuinit perf_event_init_cpu(int cpu)
 
 	cpuctx = &per_cpu(perf_cpu_context, cpu);
 
-	spin_lock(&perf_resource_lock);
-	cpuctx->max_pertask = perf_max_events - perf_reserved_percpu;
-	spin_unlock(&perf_resource_lock);
-
 	mutex_lock(&cpuctx->hlist_mutex);
 	if (cpuctx->hlist_refcount > 0) {
 		struct swevent_hlist *hlist;
@@ -6008,101 +5982,3 @@ void __init perf_event_init(void)
 	perf_tp_register();
 	perf_cpu_notifier(perf_cpu_notify);
 }
-
-static ssize_t perf_show_reserve_percpu(struct sysdev_class *class,
-					struct sysdev_class_attribute *attr,
-					char *buf)
-{
-	return sprintf(buf, "%d\n", perf_reserved_percpu);
-}
-
-static ssize_t
-perf_set_reserve_percpu(struct sysdev_class *class,
-			struct sysdev_class_attribute *attr,
-			const char *buf,
-			size_t count)
-{
-	struct perf_cpu_context *cpuctx;
-	unsigned long val;
-	int err, cpu, mpt;
-
-	err = strict_strtoul(buf, 10, &val);
-	if (err)
-		return err;
-	if (val > perf_max_events)
-		return -EINVAL;
-
-	spin_lock(&perf_resource_lock);
-	perf_reserved_percpu = val;
-	for_each_online_cpu(cpu) {
-		cpuctx = &per_cpu(perf_cpu_context, cpu);
-		raw_spin_lock_irq(&cpuctx->ctx.lock);
-		mpt = min(perf_max_events - cpuctx->ctx.nr_events,
-			  perf_max_events - perf_reserved_percpu);
-		cpuctx->max_pertask = mpt;
-		raw_spin_unlock_irq(&cpuctx->ctx.lock);
-	}
-	spin_unlock(&perf_resource_lock);
-
-	return count;
-}
-
-static ssize_t perf_show_overcommit(struct sysdev_class *class,
-				    struct sysdev_class_attribute *attr,
-				    char *buf)
-{
-	return sprintf(buf, "%d\n", perf_overcommit);
-}
-
-static ssize_t
-perf_set_overcommit(struct sysdev_class *class,
-		    struct sysdev_class_attribute *attr,
-		    const char *buf, size_t count)
-{
-	unsigned long val;
-	int err;
-
-	err = strict_strtoul(buf, 10, &val);
-	if (err)
-		return err;
-	if (val > 1)
-		return -EINVAL;
-
-	spin_lock(&perf_resource_lock);
-	perf_overcommit = val;
-	spin_unlock(&perf_resource_lock);
-
-	return count;
-}
-
-static SYSDEV_CLASS_ATTR(
-				reserve_percpu,
-				0644,
-				perf_show_reserve_percpu,
-				perf_set_reserve_percpu
-			);
-
-static SYSDEV_CLASS_ATTR(
-				overcommit,
-				0644,
-				perf_show_overcommit,
-				perf_set_overcommit
-			);
-
-static struct attribute *perfclass_attrs[] = {
-	&attr_reserve_percpu.attr,
-	&attr_overcommit.attr,
-	NULL
-};
-
-static struct attribute_group perfclass_attr_group = {
-	.attrs			= perfclass_attrs,
-	.name			= "perf_events",
-};
-
-static int __init perf_event_sysfs_init(void)
-{
-	return sysfs_create_group(&cpu_sysdev_class.kset.kobj,
-				  &perfclass_attr_group);
-}
-device_initcall(perf_event_sysfs_init);

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

* [tip:perf/core] perf: Separate find_get_context() from event initialization
       [not found]             ` <new-submission>
                                 ` (613 preceding siblings ...)
  2010-09-09 19:50               ` [tip:perf/core] perf: Remove the sysfs bits tip-bot for Peter Zijlstra
@ 2010-09-09 19:50               ` tip-bot for Peter Zijlstra
  2010-09-09 19:51               ` [tip:perf/core] perf: Remove the swevent hash-table from the cpu context tip-bot for Peter Zijlstra
                                 ` (91 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  c3f00c70276d8ae82578c8b773e2db657f69a478
Gitweb:     http://git.kernel.org/tip/c3f00c70276d8ae82578c8b773e2db657f69a478
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 18 Aug 2010 14:37:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:31 +0200

perf: Separate find_get_context() from event initialization

Separate find_get_context() from the event allocation and
initialization so that we may make find_get_context() depend
on the event pmu in a later patch.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   73 ++++++++++++++++++++++++--------------------------
 1 files changed, 35 insertions(+), 38 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 8462e69..a3c86a8 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -827,6 +827,8 @@ perf_install_in_context(struct perf_event_context *ctx,
 {
 	struct task_struct *task = ctx->task;
 
+	event->ctx = ctx;
+
 	if (!task) {
 		/*
 		 * Per cpu events are installed via an smp call and
@@ -5038,20 +5040,17 @@ struct pmu *perf_init_event(struct perf_event *event)
  * Allocate and initialize a event structure
  */
 static struct perf_event *
-perf_event_alloc(struct perf_event_attr *attr,
-		   int cpu,
-		   struct perf_event_context *ctx,
+perf_event_alloc(struct perf_event_attr *attr, int cpu,
 		   struct perf_event *group_leader,
 		   struct perf_event *parent_event,
-		   perf_overflow_handler_t overflow_handler,
-		   gfp_t gfpflags)
+		   perf_overflow_handler_t overflow_handler)
 {
 	struct pmu *pmu;
 	struct perf_event *event;
 	struct hw_perf_event *hwc;
 	long err;
 
-	event = kzalloc(sizeof(*event), gfpflags);
+	event = kzalloc(sizeof(*event), GFP_KERNEL);
 	if (!event)
 		return ERR_PTR(-ENOMEM);
 
@@ -5076,7 +5075,6 @@ perf_event_alloc(struct perf_event_attr *attr,
 	event->attr		= *attr;
 	event->group_leader	= group_leader;
 	event->pmu		= NULL;
-	event->ctx		= ctx;
 	event->oncpu		= -1;
 
 	event->parent		= parent_event;
@@ -5321,20 +5319,26 @@ SYSCALL_DEFINE5(perf_event_open,
 	if (event_fd < 0)
 		return event_fd;
 
+	event = perf_event_alloc(&attr, cpu, group_leader, NULL, NULL);
+	if (IS_ERR(event)) {
+		err = PTR_ERR(event);
+		goto err_fd;
+	}
+
 	/*
 	 * Get the target context (task or percpu):
 	 */
 	ctx = find_get_context(pid, cpu);
 	if (IS_ERR(ctx)) {
 		err = PTR_ERR(ctx);
-		goto err_fd;
+		goto err_alloc;
 	}
 
 	if (group_fd != -1) {
 		group_leader = perf_fget_light(group_fd, &fput_needed);
 		if (IS_ERR(group_leader)) {
 			err = PTR_ERR(group_leader);
-			goto err_put_context;
+			goto err_context;
 		}
 		group_file = group_leader->filp;
 		if (flags & PERF_FLAG_FD_OUTPUT)
@@ -5354,37 +5358,30 @@ SYSCALL_DEFINE5(perf_event_open,
 		 * becoming part of another group-sibling):
 		 */
 		if (group_leader->group_leader != group_leader)
-			goto err_put_context;
+			goto err_context;
 		/*
 		 * Do not allow to attach to a group in a different
 		 * task or CPU context:
 		 */
 		if (group_leader->ctx != ctx)
-			goto err_put_context;
+			goto err_context;
 		/*
 		 * Only a group leader can be exclusive or pinned
 		 */
 		if (attr.exclusive || attr.pinned)
-			goto err_put_context;
-	}
-
-	event = perf_event_alloc(&attr, cpu, ctx, group_leader,
-				     NULL, NULL, GFP_KERNEL);
-	if (IS_ERR(event)) {
-		err = PTR_ERR(event);
-		goto err_put_context;
+			goto err_context;
 	}
 
 	if (output_event) {
 		err = perf_event_set_output(event, output_event);
 		if (err)
-			goto err_free_put_context;
+			goto err_context;
 	}
 
 	event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR);
 	if (IS_ERR(event_file)) {
 		err = PTR_ERR(event_file);
-		goto err_free_put_context;
+		goto err_context;
 	}
 
 	event->filp = event_file;
@@ -5410,11 +5407,11 @@ SYSCALL_DEFINE5(perf_event_open,
 	fd_install(event_fd, event_file);
 	return event_fd;
 
-err_free_put_context:
-	free_event(event);
-err_put_context:
+err_context:
 	fput_light(group_file, fput_needed);
 	put_ctx(ctx);
+err_alloc:
+	free_event(event);
 err_fd:
 	put_unused_fd(event_fd);
 	return err;
@@ -5432,25 +5429,24 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 				 pid_t pid,
 				 perf_overflow_handler_t overflow_handler)
 {
-	struct perf_event *event;
 	struct perf_event_context *ctx;
+	struct perf_event *event;
 	int err;
 
 	/*
 	 * Get the target context (task or percpu):
 	 */
 
+	event = perf_event_alloc(attr, cpu, NULL, NULL, overflow_handler);
+	if (IS_ERR(event)) {
+		err = PTR_ERR(event);
+		goto err;
+	}
+
 	ctx = find_get_context(pid, cpu);
 	if (IS_ERR(ctx)) {
 		err = PTR_ERR(ctx);
-		goto err_exit;
-	}
-
-	event = perf_event_alloc(attr, cpu, ctx, NULL,
-				 NULL, overflow_handler, GFP_KERNEL);
-	if (IS_ERR(event)) {
-		err = PTR_ERR(event);
-		goto err_put_context;
+		goto err_free;
 	}
 
 	event->filp = NULL;
@@ -5468,9 +5464,9 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 
 	return event;
 
- err_put_context:
-	put_ctx(ctx);
- err_exit:
+err_free:
+	free_event(event);
+err:
 	return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(perf_event_create_kernel_counter);
@@ -5498,9 +5494,9 @@ inherit_event(struct perf_event *parent_event,
 		parent_event = parent_event->parent;
 
 	child_event = perf_event_alloc(&parent_event->attr,
-					   parent_event->cpu, child_ctx,
+					   parent_event->cpu,
 					   group_leader, parent_event,
-					   NULL, GFP_KERNEL);
+					   NULL);
 	if (IS_ERR(child_event))
 		return child_event;
 	get_ctx(child_ctx);
@@ -5525,6 +5521,7 @@ inherit_event(struct perf_event *parent_event,
 		local64_set(&hwc->period_left, sample_period);
 	}
 
+	child_event->ctx = child_ctx;
 	child_event->overflow_handler = parent_event->overflow_handler;
 
 	/*

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

* [tip:perf/core] perf: Remove the swevent hash-table from the cpu context
       [not found]             ` <new-submission>
                                 ` (614 preceding siblings ...)
  2010-09-09 19:50               ` [tip:perf/core] perf: Separate find_get_context() from event initialization tip-bot for Peter Zijlstra
@ 2010-09-09 19:51               ` tip-bot for Peter Zijlstra
  2010-09-09 19:51               ` [tip:perf/core] perf: Per cpu-context rotation timer tip-bot for Peter Zijlstra
                                 ` (90 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  b28ab83c595e767f2028276b7398d17f2253cec0
Gitweb:     http://git.kernel.org/tip/b28ab83c595e767f2028276b7398d17f2253cec0
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 6 Sep 2010 14:48:15 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:32 +0200

perf: Remove the swevent hash-table from the cpu context

Separate the swevent hash-table from the cpu_context bits in
preparation for per pmu cpu contexts.

This keeps the swevent hash a global entity.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    6 ---
 kernel/perf_event.c        |  104 ++++++++++++++++++++++++-------------------
 2 files changed, 58 insertions(+), 52 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index b22176d..4ab4f0c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -861,12 +861,6 @@ struct perf_cpu_context {
 	struct perf_event_context	*task_ctx;
 	int				active_oncpu;
 	int				exclusive;
-	struct swevent_hlist		*swevent_hlist;
-	struct mutex			hlist_mutex;
-	int				hlist_refcount;
-
-	/* Recursion avoidance in each contexts */
-	int				recursion[PERF_NR_CONTEXTS];
 };
 
 struct perf_output_handle {
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a3c86a8..2c47ed6 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4154,6 +4154,17 @@ int perf_event_overflow(struct perf_event *event, int nmi,
  * Generic software event infrastructure
  */
 
+struct swevent_htable {
+	struct swevent_hlist		*swevent_hlist;
+	struct mutex			hlist_mutex;
+	int				hlist_refcount;
+
+	/* Recursion avoidance in each contexts */
+	int				recursion[PERF_NR_CONTEXTS];
+};
+
+static DEFINE_PER_CPU(struct swevent_htable, swevent_htable);
+
 /*
  * We directly increment event->count and keep a second value in
  * event->hw.period_left to count intervals. This period event
@@ -4286,11 +4297,11 @@ __find_swevent_head(struct swevent_hlist *hlist, u64 type, u32 event_id)
 
 /* For the read side: events when they trigger */
 static inline struct hlist_head *
-find_swevent_head_rcu(struct perf_cpu_context *ctx, u64 type, u32 event_id)
+find_swevent_head_rcu(struct swevent_htable *swhash, u64 type, u32 event_id)
 {
 	struct swevent_hlist *hlist;
 
-	hlist = rcu_dereference(ctx->swevent_hlist);
+	hlist = rcu_dereference(swhash->swevent_hlist);
 	if (!hlist)
 		return NULL;
 
@@ -4299,7 +4310,7 @@ find_swevent_head_rcu(struct perf_cpu_context *ctx, u64 type, u32 event_id)
 
 /* For the event head insertion and removal in the hlist */
 static inline struct hlist_head *
-find_swevent_head(struct perf_cpu_context *ctx, struct perf_event *event)
+find_swevent_head(struct swevent_htable *swhash, struct perf_event *event)
 {
 	struct swevent_hlist *hlist;
 	u32 event_id = event->attr.config;
@@ -4310,7 +4321,7 @@ find_swevent_head(struct perf_cpu_context *ctx, struct perf_event *event)
 	 * and release. Which makes the protected version suitable here.
 	 * The context lock guarantees that.
 	 */
-	hlist = rcu_dereference_protected(ctx->swevent_hlist,
+	hlist = rcu_dereference_protected(swhash->swevent_hlist,
 					  lockdep_is_held(&event->ctx->lock));
 	if (!hlist)
 		return NULL;
@@ -4323,17 +4334,13 @@ static void do_perf_sw_event(enum perf_type_id type, u32 event_id,
 				    struct perf_sample_data *data,
 				    struct pt_regs *regs)
 {
-	struct perf_cpu_context *cpuctx;
+	struct swevent_htable *swhash = &__get_cpu_var(swevent_htable);
 	struct perf_event *event;
 	struct hlist_node *node;
 	struct hlist_head *head;
 
-	cpuctx = &__get_cpu_var(perf_cpu_context);
-
 	rcu_read_lock();
-
-	head = find_swevent_head_rcu(cpuctx, type, event_id);
-
+	head = find_swevent_head_rcu(swhash, type, event_id);
 	if (!head)
 		goto end;
 
@@ -4347,17 +4354,17 @@ end:
 
 int perf_swevent_get_recursion_context(void)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+	struct swevent_htable *swhash = &__get_cpu_var(swevent_htable);
 
-	return get_recursion_context(cpuctx->recursion);
+	return get_recursion_context(swhash->recursion);
 }
 EXPORT_SYMBOL_GPL(perf_swevent_get_recursion_context);
 
 void inline perf_swevent_put_recursion_context(int rctx)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+	struct swevent_htable *swhash = &__get_cpu_var(swevent_htable);
 
-	put_recursion_context(cpuctx->recursion, rctx);
+	put_recursion_context(swhash->recursion, rctx);
 }
 
 void __perf_sw_event(u32 event_id, u64 nr, int nmi,
@@ -4385,12 +4392,10 @@ static void perf_swevent_read(struct perf_event *event)
 
 static int perf_swevent_add(struct perf_event *event, int flags)
 {
+	struct swevent_htable *swhash = &__get_cpu_var(swevent_htable);
 	struct hw_perf_event *hwc = &event->hw;
-	struct perf_cpu_context *cpuctx;
 	struct hlist_head *head;
 
-	cpuctx = &__get_cpu_var(perf_cpu_context);
-
 	if (hwc->sample_period) {
 		hwc->last_period = hwc->sample_period;
 		perf_swevent_set_period(event);
@@ -4398,7 +4403,7 @@ static int perf_swevent_add(struct perf_event *event, int flags)
 
 	hwc->state = !(flags & PERF_EF_START);
 
-	head = find_swevent_head(cpuctx, event);
+	head = find_swevent_head(swhash, event);
 	if (WARN_ON_ONCE(!head))
 		return -EINVAL;
 
@@ -4424,10 +4429,10 @@ static void perf_swevent_stop(struct perf_event *event, int flags)
 
 /* Deref the hlist from the update side */
 static inline struct swevent_hlist *
-swevent_hlist_deref(struct perf_cpu_context *cpuctx)
+swevent_hlist_deref(struct swevent_htable *swhash)
 {
-	return rcu_dereference_protected(cpuctx->swevent_hlist,
-					 lockdep_is_held(&cpuctx->hlist_mutex));
+	return rcu_dereference_protected(swhash->swevent_hlist,
+					 lockdep_is_held(&swhash->hlist_mutex));
 }
 
 static void swevent_hlist_release_rcu(struct rcu_head *rcu_head)
@@ -4438,27 +4443,27 @@ static void swevent_hlist_release_rcu(struct rcu_head *rcu_head)
 	kfree(hlist);
 }
 
-static void swevent_hlist_release(struct perf_cpu_context *cpuctx)
+static void swevent_hlist_release(struct swevent_htable *swhash)
 {
-	struct swevent_hlist *hlist = swevent_hlist_deref(cpuctx);
+	struct swevent_hlist *hlist = swevent_hlist_deref(swhash);
 
 	if (!hlist)
 		return;
 
-	rcu_assign_pointer(cpuctx->swevent_hlist, NULL);
+	rcu_assign_pointer(swhash->swevent_hlist, NULL);
 	call_rcu(&hlist->rcu_head, swevent_hlist_release_rcu);
 }
 
 static void swevent_hlist_put_cpu(struct perf_event *event, int cpu)
 {
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+	struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
 
-	mutex_lock(&cpuctx->hlist_mutex);
+	mutex_lock(&swhash->hlist_mutex);
 
-	if (!--cpuctx->hlist_refcount)
-		swevent_hlist_release(cpuctx);
+	if (!--swhash->hlist_refcount)
+		swevent_hlist_release(swhash);
 
-	mutex_unlock(&cpuctx->hlist_mutex);
+	mutex_unlock(&swhash->hlist_mutex);
 }
 
 static void swevent_hlist_put(struct perf_event *event)
@@ -4476,12 +4481,12 @@ static void swevent_hlist_put(struct perf_event *event)
 
 static int swevent_hlist_get_cpu(struct perf_event *event, int cpu)
 {
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+	struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
 	int err = 0;
 
-	mutex_lock(&cpuctx->hlist_mutex);
+	mutex_lock(&swhash->hlist_mutex);
 
-	if (!swevent_hlist_deref(cpuctx) && cpu_online(cpu)) {
+	if (!swevent_hlist_deref(swhash) && cpu_online(cpu)) {
 		struct swevent_hlist *hlist;
 
 		hlist = kzalloc(sizeof(*hlist), GFP_KERNEL);
@@ -4489,11 +4494,11 @@ static int swevent_hlist_get_cpu(struct perf_event *event, int cpu)
 			err = -ENOMEM;
 			goto exit;
 		}
-		rcu_assign_pointer(cpuctx->swevent_hlist, hlist);
+		rcu_assign_pointer(swhash->swevent_hlist, hlist);
 	}
-	cpuctx->hlist_refcount++;
+	swhash->hlist_refcount++;
 exit:
-	mutex_unlock(&cpuctx->hlist_mutex);
+	mutex_unlock(&swhash->hlist_mutex);
 
 	return err;
 }
@@ -5889,12 +5894,15 @@ int perf_event_init_task(struct task_struct *child)
 
 static void __init perf_event_init_all_cpus(void)
 {
-	int cpu;
 	struct perf_cpu_context *cpuctx;
+	struct swevent_htable *swhash;
+	int cpu;
 
 	for_each_possible_cpu(cpu) {
+		swhash = &per_cpu(swevent_htable, cpu);
+		mutex_init(&swhash->hlist_mutex);
+
 		cpuctx = &per_cpu(perf_cpu_context, cpu);
-		mutex_init(&cpuctx->hlist_mutex);
 		__perf_event_init_context(&cpuctx->ctx, NULL);
 	}
 }
@@ -5902,18 +5910,21 @@ static void __init perf_event_init_all_cpus(void)
 static void __cpuinit perf_event_init_cpu(int cpu)
 {
 	struct perf_cpu_context *cpuctx;
+	struct swevent_htable *swhash;
 
 	cpuctx = &per_cpu(perf_cpu_context, cpu);
 
-	mutex_lock(&cpuctx->hlist_mutex);
-	if (cpuctx->hlist_refcount > 0) {
+	swhash = &per_cpu(swevent_htable, cpu);
+
+	mutex_lock(&swhash->hlist_mutex);
+	if (swhash->hlist_refcount > 0) {
 		struct swevent_hlist *hlist;
 
-		hlist = kzalloc(sizeof(*hlist), GFP_KERNEL);
-		WARN_ON_ONCE(!hlist);
-		rcu_assign_pointer(cpuctx->swevent_hlist, hlist);
+		hlist = kzalloc_node(sizeof(*hlist), GFP_KERNEL, cpu_to_node(cpu));
+		WARN_ON(!hlist);
+		rcu_assign_pointer(swhash->swevent_hlist, hlist);
 	}
-	mutex_unlock(&cpuctx->hlist_mutex);
+	mutex_unlock(&swhash->hlist_mutex);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -5931,11 +5942,12 @@ static void __perf_event_exit_cpu(void *info)
 static void perf_event_exit_cpu(int cpu)
 {
 	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
+	struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
 	struct perf_event_context *ctx = &cpuctx->ctx;
 
-	mutex_lock(&cpuctx->hlist_mutex);
-	swevent_hlist_release(cpuctx);
-	mutex_unlock(&cpuctx->hlist_mutex);
+	mutex_lock(&swhash->hlist_mutex);
+	swevent_hlist_release(swhash);
+	mutex_unlock(&swhash->hlist_mutex);
 
 	mutex_lock(&ctx->mutex);
 	smp_call_function_single(cpu, __perf_event_exit_cpu, NULL, 1);

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

* [tip:perf/core] perf: Per cpu-context rotation timer
       [not found]             ` <new-submission>
                                 ` (615 preceding siblings ...)
  2010-09-09 19:51               ` [tip:perf/core] perf: Remove the swevent hash-table from the cpu context tip-bot for Peter Zijlstra
@ 2010-09-09 19:51               ` tip-bot for Peter Zijlstra
  2010-09-09 19:51               ` [tip:perf/core] perf: Per-pmu-per-cpu contexts tip-bot for Peter Zijlstra
                                 ` (89 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  b5ab4cd563e7ab49b27957704112a8ecade54e1f
Gitweb:     http://git.kernel.org/tip/b5ab4cd563e7ab49b27957704112a8ecade54e1f
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 6 Sep 2010 16:32:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:32 +0200

perf: Per cpu-context rotation timer

Give each cpu-context its own timer so that it is a self contained
entity, this eases the way for per-pmu-per-cpu contexts as well as
provides the basic infrastructure to allow different rotation
times per pmu.

Things to look at:
 - folding the tick and these TICK_NSEC timers
 - separate task context rotation

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    5 +--
 kernel/perf_event.c        |   80 ++++++++++++++++++++++++++++++++++---------
 kernel/sched.c             |    2 -
 3 files changed, 65 insertions(+), 22 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 4ab4f0c..fa04537 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -861,6 +861,8 @@ struct perf_cpu_context {
 	struct perf_event_context	*task_ctx;
 	int				active_oncpu;
 	int				exclusive;
+	u64				timer_interval;
+	struct hrtimer			timer;
 };
 
 struct perf_output_handle {
@@ -881,7 +883,6 @@ extern void perf_pmu_unregister(struct pmu *pmu);
 
 extern void perf_event_task_sched_in(struct task_struct *task);
 extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
-extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
@@ -1067,8 +1068,6 @@ perf_event_task_sched_in(struct task_struct *task)			{ }
 static inline void
 perf_event_task_sched_out(struct task_struct *task,
 			    struct task_struct *next)			{ }
-static inline void
-perf_event_task_tick(struct task_struct *task)				{ }
 static inline int perf_event_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2c47ed6..d75e4c8 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -78,6 +78,25 @@ void perf_pmu_enable(struct pmu *pmu)
 		pmu->pmu_enable(pmu);
 }
 
+static void perf_pmu_rotate_start(void)
+{
+	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+
+	if (hrtimer_active(&cpuctx->timer))
+		return;
+
+	__hrtimer_start_range_ns(&cpuctx->timer,
+			ns_to_ktime(cpuctx->timer_interval), 0,
+			HRTIMER_MODE_REL_PINNED, 0);
+}
+
+static void perf_pmu_rotate_stop(void)
+{
+	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+
+	hrtimer_cancel(&cpuctx->timer);
+}
+
 static void get_ctx(struct perf_event_context *ctx)
 {
 	WARN_ON(!atomic_inc_not_zero(&ctx->refcount));
@@ -281,6 +300,8 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 	}
 
 	list_add_rcu(&event->event_entry, &ctx->event_list);
+	if (!ctx->nr_events)
+		perf_pmu_rotate_start();
 	ctx->nr_events++;
 	if (event->attr.inherit_stat)
 		ctx->nr_stat++;
@@ -1383,6 +1404,12 @@ void perf_event_task_sched_in(struct task_struct *task)
 	ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE);
 
 	cpuctx->task_ctx = ctx;
+
+	/*
+	 * Since these rotations are per-cpu, we need to ensure the
+	 * cpu-context we got scheduled on is actually rotating.
+	 */
+	perf_pmu_rotate_start();
 }
 
 #define MAX_INTERRUPTS (~0ULL)
@@ -1487,7 +1514,7 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
 	}
 }
 
-static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
+static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period)
 {
 	struct perf_event *event;
 	struct hw_perf_event *hwc;
@@ -1524,7 +1551,7 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
 		hwc->freq_count_stamp = now;
 
 		if (delta > 0)
-			perf_adjust_period(event, TICK_NSEC, delta);
+			perf_adjust_period(event, period, delta);
 	}
 	raw_spin_unlock(&ctx->lock);
 }
@@ -1542,30 +1569,39 @@ static void rotate_ctx(struct perf_event_context *ctx)
 	raw_spin_unlock(&ctx->lock);
 }
 
-void perf_event_task_tick(struct task_struct *curr)
+/*
+ * Cannot race with ->pmu_rotate_start() because this is ran from hardirq
+ * context, and ->pmu_rotate_start() is called with irqs disabled (both are
+ * cpu affine, so there are no SMP races).
+ */
+static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 {
+	enum hrtimer_restart restart = HRTIMER_NORESTART;
 	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx;
 	int rotate = 0;
 
-	if (!atomic_read(&nr_events))
-		return;
+	cpuctx = container_of(timer, struct perf_cpu_context, timer);
 
-	cpuctx = &__get_cpu_var(perf_cpu_context);
-	if (cpuctx->ctx.nr_events &&
-	    cpuctx->ctx.nr_events != cpuctx->ctx.nr_active)
-		rotate = 1;
+	if (cpuctx->ctx.nr_events) {
+		restart = HRTIMER_RESTART;
+		if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active)
+			rotate = 1;
+	}
 
-	ctx = curr->perf_event_ctxp;
-	if (ctx && ctx->nr_events && ctx->nr_events != ctx->nr_active)
-		rotate = 1;
+	ctx = current->perf_event_ctxp;
+	if (ctx && ctx->nr_events) {
+		restart = HRTIMER_RESTART;
+		if (ctx->nr_events != ctx->nr_active)
+			rotate = 1;
+	}
 
-	perf_ctx_adjust_freq(&cpuctx->ctx);
+	perf_ctx_adjust_freq(&cpuctx->ctx, cpuctx->timer_interval);
 	if (ctx)
-		perf_ctx_adjust_freq(ctx);
+		perf_ctx_adjust_freq(ctx, cpuctx->timer_interval);
 
 	if (!rotate)
-		return;
+		goto done;
 
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
@@ -1577,7 +1613,12 @@ void perf_event_task_tick(struct task_struct *curr)
 
 	cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
-		task_ctx_sched_in(curr, EVENT_FLEXIBLE);
+		task_ctx_sched_in(current, EVENT_FLEXIBLE);
+
+done:
+	hrtimer_forward_now(timer, ns_to_ktime(cpuctx->timer_interval));
+
+	return restart;
 }
 
 static int event_enable_on_exec(struct perf_event *event,
@@ -4786,7 +4827,7 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
 		}
 		__hrtimer_start_range_ns(&hwc->hrtimer,
 				ns_to_ktime(period), 0,
-				HRTIMER_MODE_REL, 0);
+				HRTIMER_MODE_REL_PINNED, 0);
 	}
 }
 
@@ -5904,6 +5945,9 @@ static void __init perf_event_init_all_cpus(void)
 
 		cpuctx = &per_cpu(perf_cpu_context, cpu);
 		__perf_event_init_context(&cpuctx->ctx, NULL);
+		cpuctx->timer_interval = TICK_NSEC;
+		hrtimer_init(&cpuctx->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		cpuctx->timer.function = perf_event_context_tick;
 	}
 }
 
@@ -5934,6 +5978,8 @@ static void __perf_event_exit_cpu(void *info)
 	struct perf_event_context *ctx = &cpuctx->ctx;
 	struct perf_event *event, *tmp;
 
+	perf_pmu_rotate_stop();
+
 	list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
 		__perf_event_remove_from_context(event);
 	list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry)
diff --git a/kernel/sched.c b/kernel/sched.c
index 09b574e..66a02ba 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3578,8 +3578,6 @@ void scheduler_tick(void)
 	curr->sched_class->task_tick(rq, curr, 0);
 	raw_spin_unlock(&rq->lock);
 
-	perf_event_task_tick(curr);
-
 #ifdef CONFIG_SMP
 	rq->idle_at_tick = idle_cpu(cpu);
 	trigger_load_balance(rq, cpu);

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

* [tip:perf/core] perf: Per-pmu-per-cpu contexts
       [not found]             ` <new-submission>
                                 ` (616 preceding siblings ...)
  2010-09-09 19:51               ` [tip:perf/core] perf: Per cpu-context rotation timer tip-bot for Peter Zijlstra
@ 2010-09-09 19:51               ` tip-bot for Peter Zijlstra
  2010-09-10 14:54                 ` Frederic Weisbecker
  2010-09-09 19:52               ` [tip:perf/core] perf: Move some code around tip-bot for Peter Zijlstra
                                 ` (88 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  108b02cfce04ee90b0a07ee0b104baffd39f5934
Gitweb:     http://git.kernel.org/tip/108b02cfce04ee90b0a07ee0b104baffd39f5934
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 6 Sep 2010 14:32:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:32 +0200

perf: Per-pmu-per-cpu contexts

Allocate per-cpu contexts per pmu.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    4 +-
 kernel/perf_event.c        |  178 +++++++++++++++++++++++++++-----------------
 2 files changed, 113 insertions(+), 69 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index fa04537..22155ef 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -570,7 +570,8 @@ struct perf_event;
 struct pmu {
 	struct list_head		entry;
 
-	int				*pmu_disable_count;
+	int * __percpu			pmu_disable_count;
+	struct perf_cpu_context * __percpu pmu_cpu_context;
 
 	/*
 	 * Fully disable/enable this PMU, can be used to protect from the PMI
@@ -808,6 +809,7 @@ struct perf_event {
  * Used as a container for task events and CPU events as well:
  */
 struct perf_event_context {
+	struct pmu			*pmu;
 	/*
 	 * Protect the states of the events in the list,
 	 * nr_active, and the list:
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index d75e4c8..8ca6e69 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -34,16 +34,15 @@
 
 #include <asm/irq_regs.h>
 
-/*
- * Each CPU has a list of per CPU events:
- */
-static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context);
-
 static atomic_t nr_events __read_mostly;
 static atomic_t nr_mmap_events __read_mostly;
 static atomic_t nr_comm_events __read_mostly;
 static atomic_t nr_task_events __read_mostly;
 
+static LIST_HEAD(pmus);
+static DEFINE_MUTEX(pmus_lock);
+static struct srcu_struct pmus_srcu;
+
 /*
  * perf event paranoia level:
  *  -1 - not paranoid at all
@@ -78,9 +77,9 @@ void perf_pmu_enable(struct pmu *pmu)
 		pmu->pmu_enable(pmu);
 }
 
-static void perf_pmu_rotate_start(void)
+static void perf_pmu_rotate_start(struct pmu *pmu)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+	struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 
 	if (hrtimer_active(&cpuctx->timer))
 		return;
@@ -90,9 +89,9 @@ static void perf_pmu_rotate_start(void)
 			HRTIMER_MODE_REL_PINNED, 0);
 }
 
-static void perf_pmu_rotate_stop(void)
+static void perf_pmu_rotate_stop(struct pmu *pmu)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+	struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 
 	hrtimer_cancel(&cpuctx->timer);
 }
@@ -301,7 +300,7 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
 
 	list_add_rcu(&event->event_entry, &ctx->event_list);
 	if (!ctx->nr_events)
-		perf_pmu_rotate_start();
+		perf_pmu_rotate_start(ctx->pmu);
 	ctx->nr_events++;
 	if (event->attr.inherit_stat)
 		ctx->nr_stat++;
@@ -466,6 +465,12 @@ group_sched_out(struct perf_event *group_event,
 		cpuctx->exclusive = 0;
 }
 
+static inline struct perf_cpu_context *
+__get_cpu_context(struct perf_event_context *ctx)
+{
+	return this_cpu_ptr(ctx->pmu->pmu_cpu_context);
+}
+
 /*
  * Cross CPU call to remove a performance event
  *
@@ -474,9 +479,9 @@ group_sched_out(struct perf_event *group_event,
  */
 static void __perf_event_remove_from_context(void *info)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event *event = info;
 	struct perf_event_context *ctx = event->ctx;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 
 	/*
 	 * If this is a task context, we need to check whether it is
@@ -556,8 +561,8 @@ retry:
 static void __perf_event_disable(void *info)
 {
 	struct perf_event *event = info;
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = event->ctx;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 
 	/*
 	 * If this is a per-task event, need to check whether this
@@ -765,10 +770,10 @@ static void add_event_to_ctx(struct perf_event *event,
  */
 static void __perf_install_in_context(void *info)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event *event = info;
 	struct perf_event_context *ctx = event->ctx;
 	struct perf_event *leader = event->group_leader;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 	int err;
 
 	/*
@@ -912,9 +917,9 @@ static void __perf_event_mark_enabled(struct perf_event *event,
 static void __perf_event_enable(void *info)
 {
 	struct perf_event *event = info;
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = event->ctx;
 	struct perf_event *leader = event->group_leader;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 	int err;
 
 	/*
@@ -1188,15 +1193,19 @@ static void perf_event_sync_stat(struct perf_event_context *ctx,
 void perf_event_task_sched_out(struct task_struct *task,
 				 struct task_struct *next)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = task->perf_event_ctxp;
 	struct perf_event_context *next_ctx;
 	struct perf_event_context *parent;
+	struct perf_cpu_context *cpuctx;
 	int do_switch = 1;
 
 	perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
 
-	if (likely(!ctx || !cpuctx->task_ctx))
+	if (likely(!ctx))
+		return;
+
+	cpuctx = __get_cpu_context(ctx);
+	if (!cpuctx->task_ctx)
 		return;
 
 	rcu_read_lock();
@@ -1242,7 +1251,7 @@ void perf_event_task_sched_out(struct task_struct *task,
 static void task_ctx_sched_out(struct perf_event_context *ctx,
 			       enum event_type_t event_type)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 
 	if (!cpuctx->task_ctx)
 		return;
@@ -1360,8 +1369,8 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx,
 static void task_ctx_sched_in(struct task_struct *task,
 			      enum event_type_t event_type)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = task->perf_event_ctxp;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 
 	if (likely(!ctx))
 		return;
@@ -1383,12 +1392,13 @@ static void task_ctx_sched_in(struct task_struct *task,
  */
 void perf_event_task_sched_in(struct task_struct *task)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event_context *ctx = task->perf_event_ctxp;
+	struct perf_cpu_context *cpuctx;
 
 	if (likely(!ctx))
 		return;
 
+	cpuctx = __get_cpu_context(ctx);
 	if (cpuctx->task_ctx == ctx)
 		return;
 
@@ -1409,7 +1419,7 @@ void perf_event_task_sched_in(struct task_struct *task)
 	 * Since these rotations are per-cpu, we need to ensure the
 	 * cpu-context we got scheduled on is actually rotating.
 	 */
-	perf_pmu_rotate_start();
+	perf_pmu_rotate_start(ctx->pmu);
 }
 
 #define MAX_INTERRUPTS (~0ULL)
@@ -1687,9 +1697,9 @@ out:
  */
 static void __perf_event_read(void *info)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
 	struct perf_event *event = info;
 	struct perf_event_context *ctx = event->ctx;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 
 	/*
 	 * If this is a task context, we need to check whether it is
@@ -1962,7 +1972,8 @@ __perf_event_init_context(struct perf_event_context *ctx,
 	ctx->task = task;
 }
 
-static struct perf_event_context *find_get_context(pid_t pid, int cpu)
+static struct perf_event_context *
+find_get_context(struct pmu *pmu, pid_t pid, int cpu)
 {
 	struct perf_event_context *ctx;
 	struct perf_cpu_context *cpuctx;
@@ -1986,7 +1997,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
 		if (!cpu_online(cpu))
 			return ERR_PTR(-ENODEV);
 
-		cpuctx = &per_cpu(perf_cpu_context, cpu);
+		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
 		ctx = &cpuctx->ctx;
 		get_ctx(ctx);
 
@@ -2030,6 +2041,7 @@ retry:
 		if (!ctx)
 			goto errout;
 		__perf_event_init_context(ctx, task);
+		ctx->pmu = pmu;
 		get_ctx(ctx);
 		if (cmpxchg(&task->perf_event_ctxp, NULL, ctx)) {
 			/*
@@ -3745,18 +3757,20 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
 
 static void perf_event_task_event(struct perf_task_event *task_event)
 {
-	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx = task_event->task_ctx;
+	struct perf_cpu_context *cpuctx;
+	struct pmu *pmu;
 
-	rcu_read_lock();
-	cpuctx = &get_cpu_var(perf_cpu_context);
-	perf_event_task_ctx(&cpuctx->ctx, task_event);
+	rcu_read_lock_sched();
+	list_for_each_entry_rcu(pmu, &pmus, entry) {
+		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
+		perf_event_task_ctx(&cpuctx->ctx, task_event);
+	}
 	if (!ctx)
 		ctx = rcu_dereference(current->perf_event_ctxp);
 	if (ctx)
 		perf_event_task_ctx(ctx, task_event);
-	put_cpu_var(perf_cpu_context);
-	rcu_read_unlock();
+	rcu_read_unlock_sched();
 }
 
 static void perf_event_task(struct task_struct *task,
@@ -3861,6 +3875,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx;
 	unsigned int size;
+	struct pmu *pmu;
 	char comm[TASK_COMM_LEN];
 
 	memset(comm, 0, sizeof(comm));
@@ -3872,14 +3887,15 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 
 	comm_event->event_id.header.size = sizeof(comm_event->event_id) + size;
 
-	rcu_read_lock();
-	cpuctx = &get_cpu_var(perf_cpu_context);
-	perf_event_comm_ctx(&cpuctx->ctx, comm_event);
+	rcu_read_lock_sched();
+	list_for_each_entry_rcu(pmu, &pmus, entry) {
+		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
+		perf_event_comm_ctx(&cpuctx->ctx, comm_event);
+	}
 	ctx = rcu_dereference(current->perf_event_ctxp);
 	if (ctx)
 		perf_event_comm_ctx(ctx, comm_event);
-	put_cpu_var(perf_cpu_context);
-	rcu_read_unlock();
+	rcu_read_unlock_sched();
 }
 
 void perf_event_comm(struct task_struct *task)
@@ -3989,6 +4005,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 	char tmp[16];
 	char *buf = NULL;
 	const char *name;
+	struct pmu *pmu;
 
 	memset(tmp, 0, sizeof(tmp));
 
@@ -4040,14 +4057,16 @@ got_name:
 
 	mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
 
-	rcu_read_lock();
-	cpuctx = &get_cpu_var(perf_cpu_context);
-	perf_event_mmap_ctx(&cpuctx->ctx, mmap_event, vma->vm_flags & VM_EXEC);
+	rcu_read_lock_sched();
+	list_for_each_entry_rcu(pmu, &pmus, entry) {
+		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
+		perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
+					vma->vm_flags & VM_EXEC);
+	}
 	ctx = rcu_dereference(current->perf_event_ctxp);
 	if (ctx)
 		perf_event_mmap_ctx(ctx, mmap_event, vma->vm_flags & VM_EXEC);
-	put_cpu_var(perf_cpu_context);
-	rcu_read_unlock();
+	rcu_read_unlock_sched();
 
 	kfree(buf);
 }
@@ -4982,10 +5001,6 @@ static struct pmu perf_task_clock = {
 	.read		= task_clock_event_read,
 };
 
-static LIST_HEAD(pmus);
-static DEFINE_MUTEX(pmus_lock);
-static struct srcu_struct pmus_srcu;
-
 static void perf_pmu_nop_void(struct pmu *pmu)
 {
 }
@@ -5013,7 +5028,7 @@ static void perf_pmu_cancel_txn(struct pmu *pmu)
 
 int perf_pmu_register(struct pmu *pmu)
 {
-	int ret;
+	int cpu, ret;
 
 	mutex_lock(&pmus_lock);
 	ret = -ENOMEM;
@@ -5021,6 +5036,21 @@ int perf_pmu_register(struct pmu *pmu)
 	if (!pmu->pmu_disable_count)
 		goto unlock;
 
+	pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);
+	if (!pmu->pmu_cpu_context)
+		goto free_pdc;
+
+	for_each_possible_cpu(cpu) {
+		struct perf_cpu_context *cpuctx;
+
+		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
+		__perf_event_init_context(&cpuctx->ctx, NULL);
+		cpuctx->ctx.pmu = pmu;
+		cpuctx->timer_interval = TICK_NSEC;
+		hrtimer_init(&cpuctx->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		cpuctx->timer.function = perf_event_context_tick;
+	}
+
 	if (!pmu->start_txn) {
 		if (pmu->pmu_enable) {
 			/*
@@ -5049,6 +5079,10 @@ unlock:
 	mutex_unlock(&pmus_lock);
 
 	return ret;
+
+free_pdc:
+	free_percpu(pmu->pmu_disable_count);
+	goto unlock;
 }
 
 void perf_pmu_unregister(struct pmu *pmu)
@@ -5057,9 +5091,14 @@ void perf_pmu_unregister(struct pmu *pmu)
 	list_del_rcu(&pmu->entry);
 	mutex_unlock(&pmus_lock);
 
+	/*
+	 * We use the pmu list either under SRCU or preempt_disable,
+	 * synchronize_srcu() implies synchronize_sched() so we're good.
+	 */
 	synchronize_srcu(&pmus_srcu);
 
 	free_percpu(pmu->pmu_disable_count);
+	free_percpu(pmu->pmu_cpu_context);
 }
 
 struct pmu *perf_init_event(struct perf_event *event)
@@ -5374,7 +5413,7 @@ SYSCALL_DEFINE5(perf_event_open,
 	/*
 	 * Get the target context (task or percpu):
 	 */
-	ctx = find_get_context(pid, cpu);
+	ctx = find_get_context(event->pmu, pid, cpu);
 	if (IS_ERR(ctx)) {
 		err = PTR_ERR(ctx);
 		goto err_alloc;
@@ -5489,7 +5528,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 		goto err;
 	}
 
-	ctx = find_get_context(pid, cpu);
+	ctx = find_get_context(event->pmu, pid, cpu);
 	if (IS_ERR(ctx)) {
 		err = PTR_ERR(ctx);
 		goto err_free;
@@ -5833,6 +5872,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 			return -ENOMEM;
 
 		__perf_event_init_context(child_ctx, child);
+		child_ctx->pmu = event->pmu;
 		child->perf_event_ctxp = child_ctx;
 		get_task_struct(child);
 	}
@@ -5935,30 +5975,18 @@ int perf_event_init_task(struct task_struct *child)
 
 static void __init perf_event_init_all_cpus(void)
 {
-	struct perf_cpu_context *cpuctx;
 	struct swevent_htable *swhash;
 	int cpu;
 
 	for_each_possible_cpu(cpu) {
 		swhash = &per_cpu(swevent_htable, cpu);
 		mutex_init(&swhash->hlist_mutex);
-
-		cpuctx = &per_cpu(perf_cpu_context, cpu);
-		__perf_event_init_context(&cpuctx->ctx, NULL);
-		cpuctx->timer_interval = TICK_NSEC;
-		hrtimer_init(&cpuctx->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		cpuctx->timer.function = perf_event_context_tick;
 	}
 }
 
 static void __cpuinit perf_event_init_cpu(int cpu)
 {
-	struct perf_cpu_context *cpuctx;
-	struct swevent_htable *swhash;
-
-	cpuctx = &per_cpu(perf_cpu_context, cpu);
-
-	swhash = &per_cpu(swevent_htable, cpu);
+	struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
 
 	mutex_lock(&swhash->hlist_mutex);
 	if (swhash->hlist_refcount > 0) {
@@ -5972,32 +6000,46 @@ static void __cpuinit perf_event_init_cpu(int cpu)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static void __perf_event_exit_cpu(void *info)
+static void __perf_event_exit_context(void *__info)
 {
-	struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
-	struct perf_event_context *ctx = &cpuctx->ctx;
+	struct perf_event_context *ctx = __info;
 	struct perf_event *event, *tmp;
 
-	perf_pmu_rotate_stop();
+	perf_pmu_rotate_stop(ctx->pmu);
 
 	list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
 		__perf_event_remove_from_context(event);
 	list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry)
 		__perf_event_remove_from_context(event);
 }
+
+static void perf_event_exit_cpu_context(int cpu)
+{
+	struct perf_event_context *ctx;
+	struct pmu *pmu;
+	int idx;
+
+	idx = srcu_read_lock(&pmus_srcu);
+	list_for_each_entry_rcu(pmu, &pmus, entry) {
+		ctx = &this_cpu_ptr(pmu->pmu_cpu_context)->ctx;
+
+		mutex_lock(&ctx->mutex);
+		smp_call_function_single(cpu, __perf_event_exit_context, ctx, 1);
+		mutex_unlock(&ctx->mutex);
+	}
+	srcu_read_unlock(&pmus_srcu, idx);
+
+}
+
 static void perf_event_exit_cpu(int cpu)
 {
-	struct perf_cpu_context *cpuctx = &per_cpu(perf_cpu_context, cpu);
 	struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
-	struct perf_event_context *ctx = &cpuctx->ctx;
 
 	mutex_lock(&swhash->hlist_mutex);
 	swevent_hlist_release(swhash);
 	mutex_unlock(&swhash->hlist_mutex);
 
-	mutex_lock(&ctx->mutex);
-	smp_call_function_single(cpu, __perf_event_exit_cpu, NULL, 1);
-	mutex_unlock(&ctx->mutex);
+	perf_event_exit_cpu_context(cpu);
 }
 #else
 static inline void perf_event_exit_cpu(int cpu) { }

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

* [tip:perf/core] perf: Move some code around
       [not found]             ` <new-submission>
                                 ` (617 preceding siblings ...)
  2010-09-09 19:51               ` [tip:perf/core] perf: Per-pmu-per-cpu contexts tip-bot for Peter Zijlstra
@ 2010-09-09 19:52               ` tip-bot for Peter Zijlstra
  2010-09-09 19:52               ` [tip:perf/core] perf: Clean up perf_event_context allocation tip-bot for Peter Zijlstra
                                 ` (87 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  97dee4f3206622f31396dede2b5ddb8670458f56
Gitweb:     http://git.kernel.org/tip/97dee4f3206622f31396dede2b5ddb8670458f56
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 7 Sep 2010 15:35:33 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:33 +0200

perf: Move some code around

Move all inherit code near each other.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |  200 +++++++++++++++++++++++++-------------------------
 1 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 8ca6e69..dae0e2f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5556,106 +5556,6 @@ err:
 }
 EXPORT_SYMBOL_GPL(perf_event_create_kernel_counter);
 
-/*
- * inherit a event from parent task to child task:
- */
-static struct perf_event *
-inherit_event(struct perf_event *parent_event,
-	      struct task_struct *parent,
-	      struct perf_event_context *parent_ctx,
-	      struct task_struct *child,
-	      struct perf_event *group_leader,
-	      struct perf_event_context *child_ctx)
-{
-	struct perf_event *child_event;
-
-	/*
-	 * Instead of creating recursive hierarchies of events,
-	 * we link inherited events back to the original parent,
-	 * which has a filp for sure, which we use as the reference
-	 * count:
-	 */
-	if (parent_event->parent)
-		parent_event = parent_event->parent;
-
-	child_event = perf_event_alloc(&parent_event->attr,
-					   parent_event->cpu,
-					   group_leader, parent_event,
-					   NULL);
-	if (IS_ERR(child_event))
-		return child_event;
-	get_ctx(child_ctx);
-
-	/*
-	 * Make the child state follow the state of the parent event,
-	 * not its attr.disabled bit.  We hold the parent's mutex,
-	 * so we won't race with perf_event_{en, dis}able_family.
-	 */
-	if (parent_event->state >= PERF_EVENT_STATE_INACTIVE)
-		child_event->state = PERF_EVENT_STATE_INACTIVE;
-	else
-		child_event->state = PERF_EVENT_STATE_OFF;
-
-	if (parent_event->attr.freq) {
-		u64 sample_period = parent_event->hw.sample_period;
-		struct hw_perf_event *hwc = &child_event->hw;
-
-		hwc->sample_period = sample_period;
-		hwc->last_period   = sample_period;
-
-		local64_set(&hwc->period_left, sample_period);
-	}
-
-	child_event->ctx = child_ctx;
-	child_event->overflow_handler = parent_event->overflow_handler;
-
-	/*
-	 * Link it up in the child's context:
-	 */
-	add_event_to_ctx(child_event, child_ctx);
-
-	/*
-	 * Get a reference to the parent filp - we will fput it
-	 * when the child event exits. This is safe to do because
-	 * we are in the parent and we know that the filp still
-	 * exists and has a nonzero count:
-	 */
-	atomic_long_inc(&parent_event->filp->f_count);
-
-	/*
-	 * Link this into the parent event's child list
-	 */
-	WARN_ON_ONCE(parent_event->ctx->parent_ctx);
-	mutex_lock(&parent_event->child_mutex);
-	list_add_tail(&child_event->child_list, &parent_event->child_list);
-	mutex_unlock(&parent_event->child_mutex);
-
-	return child_event;
-}
-
-static int inherit_group(struct perf_event *parent_event,
-	      struct task_struct *parent,
-	      struct perf_event_context *parent_ctx,
-	      struct task_struct *child,
-	      struct perf_event_context *child_ctx)
-{
-	struct perf_event *leader;
-	struct perf_event *sub;
-	struct perf_event *child_ctr;
-
-	leader = inherit_event(parent_event, parent, parent_ctx,
-				 child, NULL, child_ctx);
-	if (IS_ERR(leader))
-		return PTR_ERR(leader);
-	list_for_each_entry(sub, &parent_event->sibling_list, group_entry) {
-		child_ctr = inherit_event(sub, parent, parent_ctx,
-					    child, leader, child_ctx);
-		if (IS_ERR(child_ctr))
-			return PTR_ERR(child_ctr);
-	}
-	return 0;
-}
-
 static void sync_child_event(struct perf_event *child_event,
 			       struct task_struct *child)
 {
@@ -5844,6 +5744,106 @@ again:
 	put_ctx(ctx);
 }
 
+/*
+ * inherit a event from parent task to child task:
+ */
+static struct perf_event *
+inherit_event(struct perf_event *parent_event,
+	      struct task_struct *parent,
+	      struct perf_event_context *parent_ctx,
+	      struct task_struct *child,
+	      struct perf_event *group_leader,
+	      struct perf_event_context *child_ctx)
+{
+	struct perf_event *child_event;
+
+	/*
+	 * Instead of creating recursive hierarchies of events,
+	 * we link inherited events back to the original parent,
+	 * which has a filp for sure, which we use as the reference
+	 * count:
+	 */
+	if (parent_event->parent)
+		parent_event = parent_event->parent;
+
+	child_event = perf_event_alloc(&parent_event->attr,
+					   parent_event->cpu,
+					   group_leader, parent_event,
+					   NULL);
+	if (IS_ERR(child_event))
+		return child_event;
+	get_ctx(child_ctx);
+
+	/*
+	 * Make the child state follow the state of the parent event,
+	 * not its attr.disabled bit.  We hold the parent's mutex,
+	 * so we won't race with perf_event_{en, dis}able_family.
+	 */
+	if (parent_event->state >= PERF_EVENT_STATE_INACTIVE)
+		child_event->state = PERF_EVENT_STATE_INACTIVE;
+	else
+		child_event->state = PERF_EVENT_STATE_OFF;
+
+	if (parent_event->attr.freq) {
+		u64 sample_period = parent_event->hw.sample_period;
+		struct hw_perf_event *hwc = &child_event->hw;
+
+		hwc->sample_period = sample_period;
+		hwc->last_period   = sample_period;
+
+		local64_set(&hwc->period_left, sample_period);
+	}
+
+	child_event->ctx = child_ctx;
+	child_event->overflow_handler = parent_event->overflow_handler;
+
+	/*
+	 * Link it up in the child's context:
+	 */
+	add_event_to_ctx(child_event, child_ctx);
+
+	/*
+	 * Get a reference to the parent filp - we will fput it
+	 * when the child event exits. This is safe to do because
+	 * we are in the parent and we know that the filp still
+	 * exists and has a nonzero count:
+	 */
+	atomic_long_inc(&parent_event->filp->f_count);
+
+	/*
+	 * Link this into the parent event's child list
+	 */
+	WARN_ON_ONCE(parent_event->ctx->parent_ctx);
+	mutex_lock(&parent_event->child_mutex);
+	list_add_tail(&child_event->child_list, &parent_event->child_list);
+	mutex_unlock(&parent_event->child_mutex);
+
+	return child_event;
+}
+
+static int inherit_group(struct perf_event *parent_event,
+	      struct task_struct *parent,
+	      struct perf_event_context *parent_ctx,
+	      struct task_struct *child,
+	      struct perf_event_context *child_ctx)
+{
+	struct perf_event *leader;
+	struct perf_event *sub;
+	struct perf_event *child_ctr;
+
+	leader = inherit_event(parent_event, parent, parent_ctx,
+				 child, NULL, child_ctx);
+	if (IS_ERR(leader))
+		return PTR_ERR(leader);
+	list_for_each_entry(sub, &parent_event->sibling_list, group_entry) {
+		child_ctr = inherit_event(sub, parent, parent_ctx,
+					    child, leader, child_ctx);
+		if (IS_ERR(child_ctr))
+			return PTR_ERR(child_ctr);
+	}
+	return 0;
+}
+
 static int
 inherit_task_group(struct perf_event *event, struct task_struct *parent,
 		   struct perf_event_context *parent_ctx,

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

* [tip:perf/core] perf: Clean up perf_event_context allocation
       [not found]             ` <new-submission>
                                 ` (618 preceding siblings ...)
  2010-09-09 19:52               ` [tip:perf/core] perf: Move some code around tip-bot for Peter Zijlstra
@ 2010-09-09 19:52               ` tip-bot for Peter Zijlstra
  2010-09-09 19:52               ` [tip:perf/core] perf: Multiple task contexts tip-bot for Peter Zijlstra
                                 ` (86 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  eb184479874238393ac186c4e054d24311c34aaa
Gitweb:     http://git.kernel.org/tip/eb184479874238393ac186c4e054d24311c34aaa
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 7 Sep 2010 15:55:13 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:33 +0200

perf: Clean up perf_event_context allocation

Unify the two perf_event_context allocation sites.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   41 ++++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index dae0e2f..13d98d7 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1959,9 +1959,7 @@ exit_put:
 /*
  * Initialize the perf_event context in a task_struct:
  */
-static void
-__perf_event_init_context(struct perf_event_context *ctx,
-			    struct task_struct *task)
+static void __perf_event_init_context(struct perf_event_context *ctx)
 {
 	raw_spin_lock_init(&ctx->lock);
 	mutex_init(&ctx->mutex);
@@ -1969,7 +1967,25 @@ __perf_event_init_context(struct perf_event_context *ctx,
 	INIT_LIST_HEAD(&ctx->flexible_groups);
 	INIT_LIST_HEAD(&ctx->event_list);
 	atomic_set(&ctx->refcount, 1);
-	ctx->task = task;
+}
+
+static struct perf_event_context *
+alloc_perf_context(struct pmu *pmu, struct task_struct *task)
+{
+	struct perf_event_context *ctx;
+
+	ctx = kzalloc(sizeof(struct perf_event_context), GFP_KERNEL);
+	if (!ctx)
+		return NULL;
+
+	__perf_event_init_context(ctx);
+	if (task) {
+		ctx->task = task;
+		get_task_struct(task);
+	}
+	ctx->pmu = pmu;
+
+	return ctx;
 }
 
 static struct perf_event_context *
@@ -2036,22 +2052,22 @@ retry:
 	}
 
 	if (!ctx) {
-		ctx = kzalloc(sizeof(struct perf_event_context), GFP_KERNEL);
+		ctx = alloc_perf_context(pmu, task);
 		err = -ENOMEM;
 		if (!ctx)
 			goto errout;
-		__perf_event_init_context(ctx, task);
-		ctx->pmu = pmu;
+
 		get_ctx(ctx);
+
 		if (cmpxchg(&task->perf_event_ctxp, NULL, ctx)) {
 			/*
 			 * We raced with some other task; use
 			 * the context they set.
 			 */
+			put_task_struct(task);
 			kfree(ctx);
 			goto retry;
 		}
-		get_task_struct(task);
 	}
 
 	put_task_struct(task);
@@ -5044,7 +5060,7 @@ int perf_pmu_register(struct pmu *pmu)
 		struct perf_cpu_context *cpuctx;
 
 		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
-		__perf_event_init_context(&cpuctx->ctx, NULL);
+		__perf_event_init_context(&cpuctx->ctx);
 		cpuctx->ctx.pmu = pmu;
 		cpuctx->timer_interval = TICK_NSEC;
 		hrtimer_init(&cpuctx->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
@@ -5866,15 +5882,11 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 		 * child.
 		 */
 
-		child_ctx = kzalloc(sizeof(struct perf_event_context),
-				    GFP_KERNEL);
+		child_ctx = alloc_perf_context(event->pmu, child);
 		if (!child_ctx)
 			return -ENOMEM;
 
-		__perf_event_init_context(child_ctx, child);
-		child_ctx->pmu = event->pmu;
 		child->perf_event_ctxp = child_ctx;
-		get_task_struct(child);
 	}
 
 	ret = inherit_group(event, parent, parent_ctx,
@@ -5886,7 +5898,6 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 	return ret;
 }
 
-
 /*
  * Initialize the perf_event context in task_struct
  */

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

* [tip:perf/core] perf: Multiple task contexts
       [not found]             ` <new-submission>
                                 ` (619 preceding siblings ...)
  2010-09-09 19:52               ` [tip:perf/core] perf: Clean up perf_event_context allocation tip-bot for Peter Zijlstra
@ 2010-09-09 19:52               ` tip-bot for Peter Zijlstra
  2010-09-09 19:53               ` [tip:perf/core] perf: Provide a separate task context for swevents tip-bot for Peter Zijlstra
                                 ` (85 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  8dc85d547285668e509f86c177bcd4ea055bcaaf
Gitweb:     http://git.kernel.org/tip/8dc85d547285668e509f86c177bcd4ea055bcaaf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 2 Sep 2010 16:50:03 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:33 +0200

perf: Multiple task contexts

Provide the infrastructure for multiple task contexts.

A more flexible approach would have resulted in more pointer chases
in the scheduling hot-paths. This approach has the limitation of a
static number of task contexts.

Since I expect most external PMUs to be system wide, or at least node
wide (as per the intel uncore unit) they won't actually need a task
context.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    1 +
 include/linux/sched.h      |    8 +-
 kernel/perf_event.c        |  336 ++++++++++++++++++++++++++++++--------------
 3 files changed, 239 insertions(+), 106 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 22155ef..9ecfd85 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -572,6 +572,7 @@ struct pmu {
 
 	int * __percpu			pmu_disable_count;
 	struct perf_cpu_context * __percpu pmu_cpu_context;
+	int				task_ctx_nr;
 
 	/*
 	 * Fully disable/enable this PMU, can be used to protect from the PMI
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1e2a6db..89d6023 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1160,6 +1160,12 @@ struct sched_rt_entity {
 
 struct rcu_node;
 
+enum perf_event_task_context {
+	perf_invalid_context = -1,
+	perf_hw_context = 0,
+	perf_nr_task_contexts,
+};
+
 struct task_struct {
 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
 	void *stack;
@@ -1431,7 +1437,7 @@ struct task_struct {
 	struct futex_pi_state *pi_state_cache;
 #endif
 #ifdef CONFIG_PERF_EVENTS
-	struct perf_event_context *perf_event_ctxp;
+	struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts];
 	struct mutex perf_event_mutex;
 	struct list_head perf_event_list;
 #endif
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 13d98d7..7223ea8 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -148,13 +148,13 @@ static u64 primary_event_id(struct perf_event *event)
  * the context could get moved to another task.
  */
 static struct perf_event_context *
-perf_lock_task_context(struct task_struct *task, unsigned long *flags)
+perf_lock_task_context(struct task_struct *task, int ctxn, unsigned long *flags)
 {
 	struct perf_event_context *ctx;
 
 	rcu_read_lock();
 retry:
-	ctx = rcu_dereference(task->perf_event_ctxp);
+	ctx = rcu_dereference(task->perf_event_ctxp[ctxn]);
 	if (ctx) {
 		/*
 		 * If this context is a clone of another, it might
@@ -167,7 +167,7 @@ retry:
 		 * can't get swapped on us any more.
 		 */
 		raw_spin_lock_irqsave(&ctx->lock, *flags);
-		if (ctx != rcu_dereference(task->perf_event_ctxp)) {
+		if (ctx != rcu_dereference(task->perf_event_ctxp[ctxn])) {
 			raw_spin_unlock_irqrestore(&ctx->lock, *flags);
 			goto retry;
 		}
@@ -186,12 +186,13 @@ retry:
  * can't get swapped to another task.  This also increments its
  * reference count so that the context can't get freed.
  */
-static struct perf_event_context *perf_pin_task_context(struct task_struct *task)
+static struct perf_event_context *
+perf_pin_task_context(struct task_struct *task, int ctxn)
 {
 	struct perf_event_context *ctx;
 	unsigned long flags;
 
-	ctx = perf_lock_task_context(task, &flags);
+	ctx = perf_lock_task_context(task, ctxn, &flags);
 	if (ctx) {
 		++ctx->pin_count;
 		raw_spin_unlock_irqrestore(&ctx->lock, flags);
@@ -1179,28 +1180,15 @@ static void perf_event_sync_stat(struct perf_event_context *ctx,
 	}
 }
 
-/*
- * Called from scheduler to remove the events of the current task,
- * with interrupts disabled.
- *
- * We stop each event and update the event value in event->count.
- *
- * This does not protect us against NMI, but disable()
- * sets the disabled bit in the control field of event _before_
- * accessing the event control register. If a NMI hits, then it will
- * not restart the event.
- */
-void perf_event_task_sched_out(struct task_struct *task,
-				 struct task_struct *next)
+void perf_event_context_sched_out(struct task_struct *task, int ctxn,
+				  struct task_struct *next)
 {
-	struct perf_event_context *ctx = task->perf_event_ctxp;
+	struct perf_event_context *ctx = task->perf_event_ctxp[ctxn];
 	struct perf_event_context *next_ctx;
 	struct perf_event_context *parent;
 	struct perf_cpu_context *cpuctx;
 	int do_switch = 1;
 
-	perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
-
 	if (likely(!ctx))
 		return;
 
@@ -1210,7 +1198,7 @@ void perf_event_task_sched_out(struct task_struct *task,
 
 	rcu_read_lock();
 	parent = rcu_dereference(ctx->parent_ctx);
-	next_ctx = next->perf_event_ctxp;
+	next_ctx = next->perf_event_ctxp[ctxn];
 	if (parent && next_ctx &&
 	    rcu_dereference(next_ctx->parent_ctx) == parent) {
 		/*
@@ -1229,8 +1217,8 @@ void perf_event_task_sched_out(struct task_struct *task,
 			 * XXX do we need a memory barrier of sorts
 			 * wrt to rcu_dereference() of perf_event_ctxp
 			 */
-			task->perf_event_ctxp = next_ctx;
-			next->perf_event_ctxp = ctx;
+			task->perf_event_ctxp[ctxn] = next_ctx;
+			next->perf_event_ctxp[ctxn] = ctx;
 			ctx->task = next;
 			next_ctx->task = task;
 			do_switch = 0;
@@ -1248,6 +1236,31 @@ void perf_event_task_sched_out(struct task_struct *task,
 	}
 }
 
+#define for_each_task_context_nr(ctxn)					\
+	for ((ctxn) = 0; (ctxn) < perf_nr_task_contexts; (ctxn)++)
+
+/*
+ * Called from scheduler to remove the events of the current task,
+ * with interrupts disabled.
+ *
+ * We stop each event and update the event value in event->count.
+ *
+ * This does not protect us against NMI, but disable()
+ * sets the disabled bit in the control field of event _before_
+ * accessing the event control register. If a NMI hits, then it will
+ * not restart the event.
+ */
+void perf_event_task_sched_out(struct task_struct *task,
+			       struct task_struct *next)
+{
+	int ctxn;
+
+	perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
+
+	for_each_task_context_nr(ctxn)
+		perf_event_context_sched_out(task, ctxn, next);
+}
+
 static void task_ctx_sched_out(struct perf_event_context *ctx,
 			       enum event_type_t event_type)
 {
@@ -1366,38 +1379,23 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx,
 	ctx_sched_in(ctx, cpuctx, event_type);
 }
 
-static void task_ctx_sched_in(struct task_struct *task,
+static void task_ctx_sched_in(struct perf_event_context *ctx,
 			      enum event_type_t event_type)
 {
-	struct perf_event_context *ctx = task->perf_event_ctxp;
-	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
+	struct perf_cpu_context *cpuctx;
 
-	if (likely(!ctx))
-		return;
+       	cpuctx = __get_cpu_context(ctx);
 	if (cpuctx->task_ctx == ctx)
 		return;
+
 	ctx_sched_in(ctx, cpuctx, event_type);
 	cpuctx->task_ctx = ctx;
 }
-/*
- * Called from scheduler to add the events of the current task
- * with interrupts disabled.
- *
- * We restore the event value and then enable it.
- *
- * This does not protect us against NMI, but enable()
- * sets the enabled bit in the control field of event _before_
- * accessing the event control register. If a NMI hits, then it will
- * keep the event running.
- */
-void perf_event_task_sched_in(struct task_struct *task)
+
+void perf_event_context_sched_in(struct perf_event_context *ctx)
 {
-	struct perf_event_context *ctx = task->perf_event_ctxp;
 	struct perf_cpu_context *cpuctx;
 
-	if (likely(!ctx))
-		return;
-
 	cpuctx = __get_cpu_context(ctx);
 	if (cpuctx->task_ctx == ctx)
 		return;
@@ -1422,6 +1420,31 @@ void perf_event_task_sched_in(struct task_struct *task)
 	perf_pmu_rotate_start(ctx->pmu);
 }
 
+/*
+ * Called from scheduler to add the events of the current task
+ * with interrupts disabled.
+ *
+ * We restore the event value and then enable it.
+ *
+ * This does not protect us against NMI, but enable()
+ * sets the enabled bit in the control field of event _before_
+ * accessing the event control register. If a NMI hits, then it will
+ * keep the event running.
+ */
+void perf_event_task_sched_in(struct task_struct *task)
+{
+	struct perf_event_context *ctx;
+	int ctxn;
+
+	for_each_task_context_nr(ctxn) {
+		ctx = task->perf_event_ctxp[ctxn];
+		if (likely(!ctx))
+			continue;
+
+		perf_event_context_sched_in(ctx);
+	}
+}
+
 #define MAX_INTERRUPTS (~0ULL)
 
 static void perf_log_throttle(struct perf_event *event, int enable);
@@ -1588,7 +1611,7 @@ static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 {
 	enum hrtimer_restart restart = HRTIMER_NORESTART;
 	struct perf_cpu_context *cpuctx;
-	struct perf_event_context *ctx;
+	struct perf_event_context *ctx = NULL;
 	int rotate = 0;
 
 	cpuctx = container_of(timer, struct perf_cpu_context, timer);
@@ -1599,7 +1622,7 @@ static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 			rotate = 1;
 	}
 
-	ctx = current->perf_event_ctxp;
+	ctx = cpuctx->task_ctx;
 	if (ctx && ctx->nr_events) {
 		restart = HRTIMER_RESTART;
 		if (ctx->nr_events != ctx->nr_active)
@@ -1623,7 +1646,7 @@ static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 
 	cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE);
 	if (ctx)
-		task_ctx_sched_in(current, EVENT_FLEXIBLE);
+		task_ctx_sched_in(ctx, EVENT_FLEXIBLE);
 
 done:
 	hrtimer_forward_now(timer, ns_to_ktime(cpuctx->timer_interval));
@@ -1650,20 +1673,18 @@ static int event_enable_on_exec(struct perf_event *event,
  * Enable all of a task's events that have been marked enable-on-exec.
  * This expects task == current.
  */
-static void perf_event_enable_on_exec(struct task_struct *task)
+static void perf_event_enable_on_exec(struct perf_event_context *ctx)
 {
-	struct perf_event_context *ctx;
 	struct perf_event *event;
 	unsigned long flags;
 	int enabled = 0;
 	int ret;
 
 	local_irq_save(flags);
-	ctx = task->perf_event_ctxp;
 	if (!ctx || !ctx->nr_events)
 		goto out;
 
-	__perf_event_task_sched_out(ctx);
+	task_ctx_sched_out(ctx, EVENT_ALL);
 
 	raw_spin_lock(&ctx->lock);
 
@@ -1687,7 +1708,7 @@ static void perf_event_enable_on_exec(struct task_struct *task)
 
 	raw_spin_unlock(&ctx->lock);
 
-	perf_event_task_sched_in(task);
+	perf_event_context_sched_in(ctx);
 out:
 	local_irq_restore(flags);
 }
@@ -1995,7 +2016,7 @@ find_get_context(struct pmu *pmu, pid_t pid, int cpu)
 	struct perf_cpu_context *cpuctx;
 	struct task_struct *task;
 	unsigned long flags;
-	int err;
+	int ctxn, err;
 
 	if (pid == -1 && cpu != -1) {
 		/* Must be root to operate on a CPU event: */
@@ -2044,8 +2065,13 @@ find_get_context(struct pmu *pmu, pid_t pid, int cpu)
 	if (!ptrace_may_access(task, PTRACE_MODE_READ))
 		goto errout;
 
+	err = -EINVAL;
+	ctxn = pmu->task_ctx_nr;
+	if (ctxn < 0)
+		goto errout;
+
 retry:
-	ctx = perf_lock_task_context(task, &flags);
+	ctx = perf_lock_task_context(task, ctxn, &flags);
 	if (ctx) {
 		unclone_ctx(ctx);
 		raw_spin_unlock_irqrestore(&ctx->lock, flags);
@@ -2059,7 +2085,7 @@ retry:
 
 		get_ctx(ctx);
 
-		if (cmpxchg(&task->perf_event_ctxp, NULL, ctx)) {
+		if (cmpxchg(&task->perf_event_ctxp[ctxn], NULL, ctx)) {
 			/*
 			 * We raced with some other task; use
 			 * the context they set.
@@ -3773,19 +3799,26 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
 
 static void perf_event_task_event(struct perf_task_event *task_event)
 {
-	struct perf_event_context *ctx = task_event->task_ctx;
 	struct perf_cpu_context *cpuctx;
+	struct perf_event_context *ctx;
 	struct pmu *pmu;
+	int ctxn;
 
 	rcu_read_lock_sched();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_task_ctx(&cpuctx->ctx, task_event);
+
+		ctx = task_event->task_ctx;
+		if (!ctx) {
+			ctxn = pmu->task_ctx_nr;
+			if (ctxn < 0)
+				continue;
+			ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
+		}
+		if (ctx)
+			perf_event_task_ctx(ctx, task_event);
 	}
-	if (!ctx)
-		ctx = rcu_dereference(current->perf_event_ctxp);
-	if (ctx)
-		perf_event_task_ctx(ctx, task_event);
 	rcu_read_unlock_sched();
 }
 
@@ -3890,9 +3923,10 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 {
 	struct perf_cpu_context *cpuctx;
 	struct perf_event_context *ctx;
+	char comm[TASK_COMM_LEN];
 	unsigned int size;
 	struct pmu *pmu;
-	char comm[TASK_COMM_LEN];
+	int ctxn;
 
 	memset(comm, 0, sizeof(comm));
 	strlcpy(comm, comm_event->task->comm, sizeof(comm));
@@ -3907,19 +3941,31 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_comm_ctx(&cpuctx->ctx, comm_event);
+
+		ctxn = pmu->task_ctx_nr;
+		if (ctxn < 0)
+			continue;
+
+		ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
+		if (ctx)
+			perf_event_comm_ctx(ctx, comm_event);
 	}
-	ctx = rcu_dereference(current->perf_event_ctxp);
-	if (ctx)
-		perf_event_comm_ctx(ctx, comm_event);
 	rcu_read_unlock_sched();
 }
 
 void perf_event_comm(struct task_struct *task)
 {
 	struct perf_comm_event comm_event;
+	struct perf_event_context *ctx;
+	int ctxn;
 
-	if (task->perf_event_ctxp)
-		perf_event_enable_on_exec(task);
+	for_each_task_context_nr(ctxn) {
+		ctx = task->perf_event_ctxp[ctxn];
+		if (!ctx)
+			continue;
+
+		perf_event_enable_on_exec(ctx);
+	}
 
 	if (!atomic_read(&nr_comm_events))
 		return;
@@ -4022,6 +4068,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 	char *buf = NULL;
 	const char *name;
 	struct pmu *pmu;
+	int ctxn;
 
 	memset(tmp, 0, sizeof(tmp));
 
@@ -4078,10 +4125,17 @@ got_name:
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
 					vma->vm_flags & VM_EXEC);
+
+		ctxn = pmu->task_ctx_nr;
+		if (ctxn < 0)
+			continue;
+
+		ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
+		if (ctx) {
+			perf_event_mmap_ctx(ctx, mmap_event,
+					vma->vm_flags & VM_EXEC);
+		}
 	}
-	ctx = rcu_dereference(current->perf_event_ctxp);
-	if (ctx)
-		perf_event_mmap_ctx(ctx, mmap_event, vma->vm_flags & VM_EXEC);
 	rcu_read_unlock_sched();
 
 	kfree(buf);
@@ -5042,6 +5096,43 @@ static void perf_pmu_cancel_txn(struct pmu *pmu)
 	perf_pmu_enable(pmu);
 }
 
+/*
+ * Ensures all contexts with the same task_ctx_nr have the same
+ * pmu_cpu_context too.
+ */
+static void *find_pmu_context(int ctxn)
+{
+	struct pmu *pmu;
+
+	if (ctxn < 0)
+		return NULL;
+
+	list_for_each_entry(pmu, &pmus, entry) {
+		if (pmu->task_ctx_nr == ctxn)
+			return pmu->pmu_cpu_context;
+	}
+
+	return NULL;
+}
+
+static void free_pmu_context(void * __percpu cpu_context)
+{
+	struct pmu *pmu;
+
+	mutex_lock(&pmus_lock);
+	/*
+	 * Like a real lame refcount.
+	 */
+	list_for_each_entry(pmu, &pmus, entry) {
+		if (pmu->pmu_cpu_context == cpu_context)
+			goto out;
+	}
+
+	free_percpu(cpu_context);
+out:
+	mutex_unlock(&pmus_lock);
+}
+
 int perf_pmu_register(struct pmu *pmu)
 {
 	int cpu, ret;
@@ -5052,6 +5143,10 @@ int perf_pmu_register(struct pmu *pmu)
 	if (!pmu->pmu_disable_count)
 		goto unlock;
 
+	pmu->pmu_cpu_context = find_pmu_context(pmu->task_ctx_nr);
+	if (pmu->pmu_cpu_context)
+		goto got_cpu_context;
+
 	pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);
 	if (!pmu->pmu_cpu_context)
 		goto free_pdc;
@@ -5067,6 +5162,7 @@ int perf_pmu_register(struct pmu *pmu)
 		cpuctx->timer.function = perf_event_context_tick;
 	}
 
+got_cpu_context:
 	if (!pmu->start_txn) {
 		if (pmu->pmu_enable) {
 			/*
@@ -5114,7 +5210,7 @@ void perf_pmu_unregister(struct pmu *pmu)
 	synchronize_srcu(&pmus_srcu);
 
 	free_percpu(pmu->pmu_disable_count);
-	free_percpu(pmu->pmu_cpu_context);
+	free_pmu_context(pmu->pmu_cpu_context);
 }
 
 struct pmu *perf_init_event(struct perf_event *event)
@@ -5628,16 +5724,13 @@ __perf_event_exit_task(struct perf_event *child_event,
 	}
 }
 
-/*
- * When a child task exits, feed back event values to parent events.
- */
-void perf_event_exit_task(struct task_struct *child)
+static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
 {
 	struct perf_event *child_event, *tmp;
 	struct perf_event_context *child_ctx;
 	unsigned long flags;
 
-	if (likely(!child->perf_event_ctxp)) {
+	if (likely(!child->perf_event_ctxp[ctxn])) {
 		perf_event_task(child, NULL, 0);
 		return;
 	}
@@ -5649,7 +5742,7 @@ void perf_event_exit_task(struct task_struct *child)
 	 * scheduled, so we are now safe from rescheduling changing
 	 * our context.
 	 */
-	child_ctx = child->perf_event_ctxp;
+	child_ctx = child->perf_event_ctxp[ctxn];
 	__perf_event_task_sched_out(child_ctx);
 
 	/*
@@ -5658,7 +5751,7 @@ void perf_event_exit_task(struct task_struct *child)
 	 * incremented the context's refcount before we do put_ctx below.
 	 */
 	raw_spin_lock(&child_ctx->lock);
-	child->perf_event_ctxp = NULL;
+	child->perf_event_ctxp[ctxn] = NULL;
 	/*
 	 * If this context is a clone; unclone it so it can't get
 	 * swapped to another process while we're removing all
@@ -5711,6 +5804,17 @@ again:
 	put_ctx(child_ctx);
 }
 
+/*
+ * When a child task exits, feed back event values to parent events.
+ */
+void perf_event_exit_task(struct task_struct *child)
+{
+	int ctxn;
+
+	for_each_task_context_nr(ctxn)
+		perf_event_exit_task_context(child, ctxn);
+}
+
 static void perf_free_event(struct perf_event *event,
 			    struct perf_event_context *ctx)
 {
@@ -5732,32 +5836,37 @@ static void perf_free_event(struct perf_event *event,
 
 /*
  * free an unexposed, unused context as created by inheritance by
- * init_task below, used by fork() in case of fail.
+ * perf_event_init_task below, used by fork() in case of fail.
  */
 void perf_event_free_task(struct task_struct *task)
 {
-	struct perf_event_context *ctx = task->perf_event_ctxp;
+	struct perf_event_context *ctx;
 	struct perf_event *event, *tmp;
+	int ctxn;
 
-	if (!ctx)
-		return;
+	for_each_task_context_nr(ctxn) {
+		ctx = task->perf_event_ctxp[ctxn];
+		if (!ctx)
+			continue;
 
-	mutex_lock(&ctx->mutex);
+		mutex_lock(&ctx->mutex);
 again:
-	list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry)
-		perf_free_event(event, ctx);
+		list_for_each_entry_safe(event, tmp, &ctx->pinned_groups,
+				group_entry)
+			perf_free_event(event, ctx);
 
-	list_for_each_entry_safe(event, tmp, &ctx->flexible_groups,
-				 group_entry)
-		perf_free_event(event, ctx);
+		list_for_each_entry_safe(event, tmp, &ctx->flexible_groups,
+				group_entry)
+			perf_free_event(event, ctx);
 
-	if (!list_empty(&ctx->pinned_groups) ||
-	    !list_empty(&ctx->flexible_groups))
-		goto again;
+		if (!list_empty(&ctx->pinned_groups) ||
+				!list_empty(&ctx->flexible_groups))
+			goto again;
 
-	mutex_unlock(&ctx->mutex);
+		mutex_unlock(&ctx->mutex);
 
-	put_ctx(ctx);
+		put_ctx(ctx);
+	}
 }
 
 /*
@@ -5863,17 +5972,18 @@ static int inherit_group(struct perf_event *parent_event,
 static int
 inherit_task_group(struct perf_event *event, struct task_struct *parent,
 		   struct perf_event_context *parent_ctx,
-		   struct task_struct *child,
+		   struct task_struct *child, int ctxn,
 		   int *inherited_all)
 {
 	int ret;
-	struct perf_event_context *child_ctx = child->perf_event_ctxp;
+	struct perf_event_context *child_ctx;
 
 	if (!event->attr.inherit) {
 		*inherited_all = 0;
 		return 0;
 	}
 
+       	child_ctx = child->perf_event_ctxp[ctxn];
 	if (!child_ctx) {
 		/*
 		 * This is executed from the parent task context, so
@@ -5886,7 +5996,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 		if (!child_ctx)
 			return -ENOMEM;
 
-		child->perf_event_ctxp = child_ctx;
+		child->perf_event_ctxp[ctxn] = child_ctx;
 	}
 
 	ret = inherit_group(event, parent, parent_ctx,
@@ -5901,7 +6011,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 /*
  * Initialize the perf_event context in task_struct
  */
-int perf_event_init_task(struct task_struct *child)
+int perf_event_init_context(struct task_struct *child, int ctxn)
 {
 	struct perf_event_context *child_ctx, *parent_ctx;
 	struct perf_event_context *cloned_ctx;
@@ -5910,19 +6020,19 @@ int perf_event_init_task(struct task_struct *child)
 	int inherited_all = 1;
 	int ret = 0;
 
-	child->perf_event_ctxp = NULL;
+	child->perf_event_ctxp[ctxn] = NULL;
 
 	mutex_init(&child->perf_event_mutex);
 	INIT_LIST_HEAD(&child->perf_event_list);
 
-	if (likely(!parent->perf_event_ctxp))
+	if (likely(!parent->perf_event_ctxp[ctxn]))
 		return 0;
 
 	/*
 	 * If the parent's context is a clone, pin it so it won't get
 	 * swapped under us.
 	 */
-	parent_ctx = perf_pin_task_context(parent);
+	parent_ctx = perf_pin_task_context(parent, ctxn);
 
 	/*
 	 * No need to check if parent_ctx != NULL here; since we saw
@@ -5942,20 +6052,20 @@ int perf_event_init_task(struct task_struct *child)
 	 * the list, not manipulating it:
 	 */
 	list_for_each_entry(event, &parent_ctx->pinned_groups, group_entry) {
-		ret = inherit_task_group(event, parent, parent_ctx, child,
-					 &inherited_all);
+		ret = inherit_task_group(event, parent, parent_ctx,
+					 child, ctxn, &inherited_all);
 		if (ret)
 			break;
 	}
 
 	list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) {
-		ret = inherit_task_group(event, parent, parent_ctx, child,
-					 &inherited_all);
+		ret = inherit_task_group(event, parent, parent_ctx,
+					 child, ctxn, &inherited_all);
 		if (ret)
 			break;
 	}
 
-	child_ctx = child->perf_event_ctxp;
+	child_ctx = child->perf_event_ctxp[ctxn];
 
 	if (child_ctx && inherited_all) {
 		/*
@@ -5984,6 +6094,22 @@ int perf_event_init_task(struct task_struct *child)
 	return ret;
 }
 
+/*
+ * Initialize the perf_event context in task_struct
+ */
+int perf_event_init_task(struct task_struct *child)
+{
+	int ctxn, ret;
+
+	for_each_task_context_nr(ctxn) {
+		ret = perf_event_init_context(child, ctxn);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static void __init perf_event_init_all_cpus(void)
 {
 	struct swevent_htable *swhash;

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

* [tip:perf/core] perf: Provide a separate task context for swevents
       [not found]             ` <new-submission>
                                 ` (620 preceding siblings ...)
  2010-09-09 19:52               ` [tip:perf/core] perf: Multiple task contexts tip-bot for Peter Zijlstra
@ 2010-09-09 19:53               ` tip-bot for Peter Zijlstra
  2010-09-09 19:53               ` [tip:perf/core] perf: Optimize context ops tip-bot for Peter Zijlstra
                                 ` (84 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  89a1e18731959e9953fae15ddc1a983eb15a4f19
Gitweb:     http://git.kernel.org/tip/89a1e18731959e9953fae15ddc1a983eb15a4f19
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 7 Sep 2010 17:34:50 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:34 +0200

perf: Provide a separate task context for swevents

Since software events are always schedulable, mixing them up with
hardware events (who are not) can lead to funny scheduling oddities.

Giving them their own context solves this.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    9 +--------
 include/linux/sched.h      |    1 +
 kernel/hw_breakpoint.c     |    2 ++
 kernel/perf_event.c        |   40 +++++++++++++++++++++++++++++-----------
 4 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 9ecfd85..c117352 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -952,14 +952,7 @@ extern int perf_event_overflow(struct perf_event *event, int nmi,
  */
 static inline int is_software_event(struct perf_event *event)
 {
-	switch (event->attr.type) {
-	case PERF_TYPE_SOFTWARE:
-	case PERF_TYPE_TRACEPOINT:
-	/* for now the breakpoint stuff also works as software event */
-	case PERF_TYPE_BREAKPOINT:
-		return 1;
-	}
-	return 0;
+	return event->pmu->task_ctx_nr == perf_sw_context;
 }
 
 extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 89d6023..eb3c1ce 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1163,6 +1163,7 @@ struct rcu_node;
 enum perf_event_task_context {
 	perf_invalid_context = -1,
 	perf_hw_context = 0,
+	perf_sw_context,
 	perf_nr_task_contexts,
 };
 
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 6f15009..3b2aaff 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -610,6 +610,8 @@ static void hw_breakpoint_stop(struct perf_event *bp, int flags)
 }
 
 static struct pmu perf_breakpoint = {
+	.task_ctx_nr	= perf_sw_context, /* could eventually get its own */
+
 	.event_init	= hw_breakpoint_event_init,
 	.add		= hw_breakpoint_add,
 	.del		= hw_breakpoint_del,
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 7223ea8..357ee8d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4709,6 +4709,8 @@ static int perf_swevent_init(struct perf_event *event)
 }
 
 static struct pmu perf_swevent = {
+	.task_ctx_nr	= perf_sw_context,
+
 	.event_init	= perf_swevent_init,
 	.add		= perf_swevent_add,
 	.del		= perf_swevent_del,
@@ -4800,6 +4802,8 @@ static int perf_tp_event_init(struct perf_event *event)
 }
 
 static struct pmu perf_tracepoint = {
+	.task_ctx_nr	= perf_sw_context,
+
 	.event_init	= perf_tp_event_init,
 	.add		= perf_trace_add,
 	.del		= perf_trace_del,
@@ -4988,6 +4992,8 @@ static int cpu_clock_event_init(struct perf_event *event)
 }
 
 static struct pmu perf_cpu_clock = {
+	.task_ctx_nr	= perf_sw_context,
+
 	.event_init	= cpu_clock_event_init,
 	.add		= cpu_clock_event_add,
 	.del		= cpu_clock_event_del,
@@ -5063,6 +5069,8 @@ static int task_clock_event_init(struct perf_event *event)
 }
 
 static struct pmu perf_task_clock = {
+	.task_ctx_nr	= perf_sw_context,
+
 	.event_init	= task_clock_event_init,
 	.add		= task_clock_event_add,
 	.del		= task_clock_event_del,
@@ -5490,6 +5498,7 @@ SYSCALL_DEFINE5(perf_event_open,
 	struct perf_event_context *ctx;
 	struct file *event_file = NULL;
 	struct file *group_file = NULL;
+	struct pmu *pmu;
 	int event_fd;
 	int fput_needed = 0;
 	int err;
@@ -5522,20 +5531,11 @@ SYSCALL_DEFINE5(perf_event_open,
 		goto err_fd;
 	}
 
-	/*
-	 * Get the target context (task or percpu):
-	 */
-	ctx = find_get_context(event->pmu, pid, cpu);
-	if (IS_ERR(ctx)) {
-		err = PTR_ERR(ctx);
-		goto err_alloc;
-	}
-
 	if (group_fd != -1) {
 		group_leader = perf_fget_light(group_fd, &fput_needed);
 		if (IS_ERR(group_leader)) {
 			err = PTR_ERR(group_leader);
-			goto err_context;
+			goto err_alloc;
 		}
 		group_file = group_leader->filp;
 		if (flags & PERF_FLAG_FD_OUTPUT)
@@ -5545,6 +5545,23 @@ SYSCALL_DEFINE5(perf_event_open,
 	}
 
 	/*
+	 * Special case software events and allow them to be part of
+	 * any hardware group.
+	 */
+	pmu = event->pmu;
+	if ((pmu->task_ctx_nr == perf_sw_context) && group_leader)
+		pmu = group_leader->pmu;
+
+	/*
+	 * Get the target context (task or percpu):
+	 */
+	ctx = find_get_context(pmu, pid, cpu);
+	if (IS_ERR(ctx)) {
+		err = PTR_ERR(ctx);
+		goto err_group_fd;
+	}
+
+	/*
 	 * Look up the group leader (we will attach this event to it):
 	 */
 	if (group_leader) {
@@ -5605,8 +5622,9 @@ SYSCALL_DEFINE5(perf_event_open,
 	return event_fd;
 
 err_context:
-	fput_light(group_file, fput_needed);
 	put_ctx(ctx);
+err_group_fd:
+	fput_light(group_file, fput_needed);
 err_alloc:
 	free_event(event);
 err_fd:

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

* [tip:perf/core] perf: Optimize context ops
       [not found]             ` <new-submission>
                                 ` (621 preceding siblings ...)
  2010-09-09 19:53               ` [tip:perf/core] perf: Provide a separate task context for swevents tip-bot for Peter Zijlstra
@ 2010-09-09 19:53               ` tip-bot for Peter Zijlstra
  2010-09-09 19:54               ` [tip:perf/core] perf: Fix up delayed_put_task_struct() tip-bot for Peter Zijlstra
                                 ` (83 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, fweisbec, ming.m.lin, tglx, mingo

Commit-ID:  1b9a644fece117cfa5474a2388d6b89d1baf8ddf
Gitweb:     http://git.kernel.org/tip/1b9a644fece117cfa5474a2388d6b89d1baf8ddf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 7 Sep 2010 18:32:22 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 20:46:34 +0200

perf: Optimize context ops

Assuming we don't mix events of different pmus onto a single context
(with the exeption of software events inside a hardware group) we can
now assume that all events on a particular context belong to the same
pmu, hence we can disable the pmu for the entire context operations.

This reduces the amount of hardware writes.

The exception for swevents comes from the fact that the sw pmu disable
is a nop.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 357ee8d..9819a69 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1065,6 +1065,7 @@ static void ctx_sched_out(struct perf_event_context *ctx,
 	struct perf_event *event;
 
 	raw_spin_lock(&ctx->lock);
+	perf_pmu_disable(ctx->pmu);
 	ctx->is_active = 0;
 	if (likely(!ctx->nr_events))
 		goto out;
@@ -1083,6 +1084,7 @@ static void ctx_sched_out(struct perf_event_context *ctx,
 			group_sched_out(event, cpuctx, ctx);
 	}
 out:
+	perf_pmu_enable(ctx->pmu);
 	raw_spin_unlock(&ctx->lock);
 }
 
@@ -1400,6 +1402,7 @@ void perf_event_context_sched_in(struct perf_event_context *ctx)
 	if (cpuctx->task_ctx == ctx)
 		return;
 
+	perf_pmu_disable(ctx->pmu);
 	/*
 	 * We want to keep the following priority order:
 	 * cpu pinned (that don't need to move), task pinned,
@@ -1418,6 +1421,7 @@ void perf_event_context_sched_in(struct perf_event_context *ctx)
 	 * cpu-context we got scheduled on is actually rotating.
 	 */
 	perf_pmu_rotate_start(ctx->pmu);
+	perf_pmu_enable(ctx->pmu);
 }
 
 /*
@@ -1629,6 +1633,7 @@ static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 			rotate = 1;
 	}
 
+	perf_pmu_disable(cpuctx->ctx.pmu);
 	perf_ctx_adjust_freq(&cpuctx->ctx, cpuctx->timer_interval);
 	if (ctx)
 		perf_ctx_adjust_freq(ctx, cpuctx->timer_interval);
@@ -1649,6 +1654,7 @@ static enum hrtimer_restart perf_event_context_tick(struct hrtimer *timer)
 		task_ctx_sched_in(ctx, EVENT_FLEXIBLE);
 
 done:
+	perf_pmu_enable(cpuctx->ctx.pmu);
 	hrtimer_forward_now(timer, ns_to_ktime(cpuctx->timer_interval));
 
 	return restart;

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

* [tip:perf/core] perf: Fix up delayed_put_task_struct()
       [not found]             ` <new-submission>
                                 ` (622 preceding siblings ...)
  2010-09-09 19:53               ` [tip:perf/core] perf: Optimize context ops tip-bot for Peter Zijlstra
@ 2010-09-09 19:54               ` tip-bot for Peter Zijlstra
  2010-09-10 14:32               ` [tip:perf/core] perf: Ensure we call add_event_to_ctx() with the right locks held tip-bot for Peter Zijlstra
                                 ` (82 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-09 19:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  4e231c7962ce711c7d8c2a4dc23ecd1e8fc28363
Gitweb:     http://git.kernel.org/tip/4e231c7962ce711c7d8c2a4dc23ecd1e8fc28363
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 9 Sep 2010 21:01:59 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Sep 2010 21:07:09 +0200

perf: Fix up delayed_put_task_struct()

I missed a perf_event_ctxp user when converting it to an array. Pull this
last user into perf_event.c as well and fix it up.

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_event.h |    2 ++
 kernel/exit.c              |    4 +---
 kernel/perf_event.c        |    8 ++++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c117352..93bf53a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -889,6 +889,7 @@ extern void perf_event_task_sched_out(struct task_struct *task, struct task_stru
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
+extern void perf_event_delayed_put(struct task_struct *task);
 extern void set_perf_event_pending(void);
 extern void perf_event_do_pending(void);
 extern void perf_event_print_debug(void);
@@ -1067,6 +1068,7 @@ perf_event_task_sched_out(struct task_struct *task,
 static inline int perf_event_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
+static inline void perf_event_delayed_put(struct task_struct *task)	{ }
 static inline void perf_event_do_pending(void)				{ }
 static inline void perf_event_print_debug(void)				{ }
 static inline int perf_event_task_disable(void)				{ return -EINVAL; }
diff --git a/kernel/exit.c b/kernel/exit.c
index 0312022..e2bdf37 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -149,9 +149,7 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
 {
 	struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
 
-#ifdef CONFIG_PERF_EVENTS
-	WARN_ON_ONCE(tsk->perf_event_ctxp);
-#endif
+	perf_event_delayed_put(tsk);
 	trace_sched_process_free(tsk);
 	put_task_struct(tsk);
 }
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9819a69..eaf1c5d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5893,6 +5893,14 @@ again:
 	}
 }
 
+void perf_event_delayed_put(struct task_struct *task)
+{
+	int ctxn;
+
+	for_each_task_context_nr(ctxn)
+		WARN_ON_ONCE(task->perf_event_ctxp[ctxn]);
+}
+
 /*
  * inherit a event from parent task to child task:
  */

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

* [tip:perf/core] perf: Ensure we call add_event_to_ctx() with the right locks held
       [not found]             ` <new-submission>
                                 ` (623 preceding siblings ...)
  2010-09-09 19:54               ` [tip:perf/core] perf: Fix up delayed_put_task_struct() tip-bot for Peter Zijlstra
@ 2010-09-10 14:32               ` tip-bot for Peter Zijlstra
  2010-09-10 15:48               ` [tip:perf/core] perf: Fix perf_init_event() tip-bot for Peter Zijlstra
                                 ` (81 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-10 14:32 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  cee010ec5211b96f33c5c2208f5c14ebb04b634a
Gitweb:     http://git.kernel.org/tip/cee010ec5211b96f33c5c2208f5c14ebb04b634a
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 10 Sep 2010 12:51:54 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Sep 2010 16:24:33 +0200

perf: Ensure we call add_event_to_ctx() with the right locks held

Even though we call it from the inherit path, where the child is
not yet accessible, we need to hold ctx->lock, add_event_to_ctx()
assumes IRQs are disabled.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index eaf1c5d..f395fb4 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5913,6 +5913,7 @@ inherit_event(struct perf_event *parent_event,
 	      struct perf_event_context *child_ctx)
 {
 	struct perf_event *child_event;
+	unsigned long flags;
 
 	/*
 	 * Instead of creating recursive hierarchies of events,
@@ -5957,7 +5958,9 @@ inherit_event(struct perf_event *parent_event,
 	/*
 	 * Link it up in the child's context:
 	 */
+	raw_spin_lock_irqsave(&child_ctx->lock, flags);
 	add_event_to_ctx(child_event, child_ctx);
+	raw_spin_unlock_irqrestore(&child_ctx->lock, flags);
 
 	/*
 	 * Get a reference to the parent filp - we will fput it

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

* Re: [tip:perf/core] perf: Per-pmu-per-cpu contexts
  2010-09-09 19:51               ` [tip:perf/core] perf: Per-pmu-per-cpu contexts tip-bot for Peter Zijlstra
@ 2010-09-10 14:54                 ` Frederic Weisbecker
  2010-09-10 15:37                   ` Paul E. McKenney
  2010-09-10 15:56                   ` Peter Zijlstra
  0 siblings, 2 replies; 1150+ messages in thread
From: Frederic Weisbecker @ 2010-09-10 14:54 UTC (permalink / raw)
  To: mingo, hpa, paulus, linux-kernel, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, ming.m.lin, tglx, mingo,
	Paul E. McKenney
  Cc: linux-tip-commits

On Thu, Sep 09, 2010 at 07:51:53PM +0000, tip-bot for Peter Zijlstra wrote:
> @@ -3745,18 +3757,20 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
>  
>  static void perf_event_task_event(struct perf_task_event *task_event)
>  {
> -	struct perf_cpu_context *cpuctx;
>  	struct perf_event_context *ctx = task_event->task_ctx;
> +	struct perf_cpu_context *cpuctx;
> +	struct pmu *pmu;
>  
> -	rcu_read_lock();
> -	cpuctx = &get_cpu_var(perf_cpu_context);
> -	perf_event_task_ctx(&cpuctx->ctx, task_event);
> +	rcu_read_lock_sched();
> +	list_for_each_entry_rcu(pmu, &pmus, entry) {
> +		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
> +		perf_event_task_ctx(&cpuctx->ctx, task_event);
> +	}
>  	if (!ctx)
>  		ctx = rcu_dereference(current->perf_event_ctxp);



So, you say below that it works because synchronize_srcu(), that
waits for qs after touching pmus, implies synchronize_sched(), right?

And I guess you picked rcu_read_lock_sched() here because that preempt_disable()
at the same time.

That looks complicated but I guess that works.

That said there is also this rcu_dereference(current->perf_event_ctxp).
Now, this ctx is released after srcu barrier right? So this should
be srcu_dereference(). But then you seem to actually use rcu_read_lock_sched()
as it's compatible, so this should be rcu_dereference_sched() ?

With the current state, rcu will whine.
Moreover there seem to be too much game between the different rcu
flavours here, and that breaks the reviewers parsing.


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

* Re: [tip:perf/core] perf: Per-pmu-per-cpu contexts
  2010-09-10 14:54                 ` Frederic Weisbecker
@ 2010-09-10 15:37                   ` Paul E. McKenney
  2010-09-10 15:46                     ` Peter Zijlstra
  2010-09-10 15:56                   ` Peter Zijlstra
  1 sibling, 1 reply; 1150+ messages in thread
From: Paul E. McKenney @ 2010-09-10 15:37 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, linux-kernel, eranian, a.p.zijlstra,
	yanmin_zhang, robert.richter, ming.m.lin, tglx, mingo,
	linux-tip-commits

On Fri, Sep 10, 2010 at 04:54:29PM +0200, Frederic Weisbecker wrote:
> On Thu, Sep 09, 2010 at 07:51:53PM +0000, tip-bot for Peter Zijlstra wrote:
> > @@ -3745,18 +3757,20 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
> >  
> >  static void perf_event_task_event(struct perf_task_event *task_event)
> >  {
> > -	struct perf_cpu_context *cpuctx;
> >  	struct perf_event_context *ctx = task_event->task_ctx;
> > +	struct perf_cpu_context *cpuctx;
> > +	struct pmu *pmu;
> >  
> > -	rcu_read_lock();
> > -	cpuctx = &get_cpu_var(perf_cpu_context);
> > -	perf_event_task_ctx(&cpuctx->ctx, task_event);
> > +	rcu_read_lock_sched();
> > +	list_for_each_entry_rcu(pmu, &pmus, entry) {
> > +		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
> > +		perf_event_task_ctx(&cpuctx->ctx, task_event);
> > +	}
> >  	if (!ctx)
> >  		ctx = rcu_dereference(current->perf_event_ctxp);
> 
> 
> 
> So, you say below that it works because synchronize_srcu(), that
> waits for qs after touching pmus, implies synchronize_sched(), right?

Ook...  My current plans to fold SRCU into TREE_RCU would invalidate
this assumption.

Maybe we need some sort of primitive that concurrently waits for
multiple types of RCU grace periods?

							Thanx, Paul

> And I guess you picked rcu_read_lock_sched() here because that preempt_disable()
> at the same time.
> 
> That looks complicated but I guess that works.
> 
> That said there is also this rcu_dereference(current->perf_event_ctxp).
> Now, this ctx is released after srcu barrier right? So this should
> be srcu_dereference(). But then you seem to actually use rcu_read_lock_sched()
> as it's compatible, so this should be rcu_dereference_sched() ?
> 
> With the current state, rcu will whine.
> Moreover there seem to be too much game between the different rcu
> flavours here, and that breaks the reviewers parsing.
> 

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

* Re: [tip:perf/core] perf: Per-pmu-per-cpu contexts
  2010-09-10 15:37                   ` Paul E. McKenney
@ 2010-09-10 15:46                     ` Peter Zijlstra
  2010-09-10 16:05                       ` Paul E. McKenney
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-10 15:46 UTC (permalink / raw)
  To: paulmck
  Cc: Frederic Weisbecker, mingo, hpa, paulus, linux-kernel, eranian,
	yanmin_zhang, robert.richter, ming.m.lin, tglx, mingo,
	linux-tip-commits

On Fri, 2010-09-10 at 08:37 -0700, Paul E. McKenney wrote:
> > So, you say below that it works because synchronize_srcu(), that
> > waits for qs after touching pmus, implies synchronize_sched(), right?
> 
> Ook...  My current plans to fold SRCU into TREE_RCU would invalidate
> this assumption.
> 
> Maybe we need some sort of primitive that concurrently waits for
> multiple types of RCU grace periods? 

Nah, but I was thinking that any kind of preemptible rcu sync would
imply a sched rcu sync.

If not strictly implied I'd have no problem simply writing:

  synchronize_rcu_sched();
  synchronize_srcu();



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

* [tip:perf/core] perf: Fix perf_init_event()
       [not found]             ` <new-submission>
                                 ` (624 preceding siblings ...)
  2010-09-10 14:32               ` [tip:perf/core] perf: Ensure we call add_event_to_ctx() with the right locks held tip-bot for Peter Zijlstra
@ 2010-09-10 15:48               ` tip-bot for Peter Zijlstra
  2010-09-13 15:18               ` [tip:perf/core] perf: Sanitize the RCU logic tip-bot for Peter Zijlstra
                                 ` (80 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-10 15:48 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  e5f4d3394a52ac351f1a479fe136d92fa5228eff
Gitweb:     http://git.kernel.org/tip/e5f4d3394a52ac351f1a479fe136d92fa5228eff
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 10 Sep 2010 17:38:06 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Sep 2010 17:41:55 +0200

perf: Fix perf_init_event()

We ought to return -ENOENT when non of the registered PMUs
recognise the requested event.

This fixes a boot crash that occurs if no PMU is available
but the NMI watchdog tries to register an event.

Reported-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/perf_event.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f395fb4..f29b525 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5236,12 +5236,15 @@ struct pmu *perf_init_event(struct perf_event *event)
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		int ret = pmu->event_init(event);
 		if (!ret)
-			break;
+			goto unlock;
+
 		if (ret != -ENOENT) {
 			pmu = ERR_PTR(ret);
-			break;
+			goto unlock;
 		}
 	}
+	pmu = ERR_PTR(-ENOENT);
+unlock:
 	srcu_read_unlock(&pmus_srcu, idx);
 
 	return pmu;

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

* Re: [tip:perf/core] perf: Per-pmu-per-cpu contexts
  2010-09-10 14:54                 ` Frederic Weisbecker
  2010-09-10 15:37                   ` Paul E. McKenney
@ 2010-09-10 15:56                   ` Peter Zijlstra
  1 sibling, 0 replies; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-10 15:56 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: mingo, hpa, paulus, linux-kernel, eranian, yanmin_zhang,
	robert.richter, ming.m.lin, tglx, mingo, Paul E. McKenney,
	linux-tip-commits

On Fri, 2010-09-10 at 16:54 +0200, Frederic Weisbecker wrote:
> On Thu, Sep 09, 2010 at 07:51:53PM +0000, tip-bot for Peter Zijlstra wrote:
> > @@ -3745,18 +3757,20 @@ static void perf_event_task_ctx(struct perf_event_context *ctx,
> >  
> >  static void perf_event_task_event(struct perf_task_event *task_event)
> >  {
> > -	struct perf_cpu_context *cpuctx;
> >  	struct perf_event_context *ctx = task_event->task_ctx;
> > +	struct perf_cpu_context *cpuctx;
> > +	struct pmu *pmu;
> >  
> > -	rcu_read_lock();
> > -	cpuctx = &get_cpu_var(perf_cpu_context);
> > -	perf_event_task_ctx(&cpuctx->ctx, task_event);
> > +	rcu_read_lock_sched();
> > +	list_for_each_entry_rcu(pmu, &pmus, entry) {
> > +		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
> > +		perf_event_task_ctx(&cpuctx->ctx, task_event);
> > +	}
> >  	if (!ctx)
> >  		ctx = rcu_dereference(current->perf_event_ctxp);
> 
> 
> 
> So, you say below that it works because synchronize_srcu(), that
> waits for qs after touching pmus, implies synchronize_sched(), right?

yep.

> And I guess you picked rcu_read_lock_sched() here because that preempt_disable()
> at the same time.

Mostly because preemption is already disabled there, and sync_srcu() was
implemented using sync_rcu_sched() primitives.

> That looks complicated but I guess that works.

Yeah, similar to the event lists which we protect with a mutex and a
spinlock, hold either to traverse, hold both to modify.

Depending on the situation we need to traverse the pmu list preemptible
-- for example when we need to take the above mentioned mutex (see
perf_event_exit_cpu_context), or non-preemptible, the above. So we need
to guard it using two different flavours of RCU too.

> That said there is also this rcu_dereference(current->perf_event_ctxp).
> Now, this ctx is released after srcu barrier right? So this should
> be srcu_dereference(). But then you seem to actually use rcu_read_lock_sched()
> as it's compatible, so this should be rcu_dereference_sched() ?

The task context is released using call_rcu(), and should be done under
rcu_read_lock(), I guess we should hold both rcu_read_lock() and
rcu_read_lock_sched() there to be correct.

> With the current state, rcu will whine.
> Moreover there seem to be too much game between the different rcu
> flavours here, and that breaks the reviewers parsing.

:-)

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

* Re: [tip:perf/core] perf: Per-pmu-per-cpu contexts
  2010-09-10 15:46                     ` Peter Zijlstra
@ 2010-09-10 16:05                       ` Paul E. McKenney
  0 siblings, 0 replies; 1150+ messages in thread
From: Paul E. McKenney @ 2010-09-10 16:05 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Frederic Weisbecker, mingo, hpa, paulus, linux-kernel, eranian,
	yanmin_zhang, robert.richter, ming.m.lin, tglx, mingo,
	linux-tip-commits

On Fri, Sep 10, 2010 at 05:46:34PM +0200, Peter Zijlstra wrote:
> On Fri, 2010-09-10 at 08:37 -0700, Paul E. McKenney wrote:
> > > So, you say below that it works because synchronize_srcu(), that
> > > waits for qs after touching pmus, implies synchronize_sched(), right?
> > 
> > Ook...  My current plans to fold SRCU into TREE_RCU would invalidate
> > this assumption.
> > 
> > Maybe we need some sort of primitive that concurrently waits for
> > multiple types of RCU grace periods? 
> 
> Nah, but I was thinking that any kind of preemptible rcu sync would
> imply a sched rcu sync.

Ah!

Although disabling interrupts will block preemptible RCU grace periods
in current implementations (but please don't rely on this!), disabling
preemption will -not- block preemptible RCU grace periods, even given
current TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.  Current
SRCU grace periods are blocked by disabling preemption, but folding it
into the tree/tiny implementations would make SRCU grace periods be no
longer blocked by disabling preemption.

This might change if RCU priority boosting is enabled, due to RCU
grace-period computation and callback invocation moving to a kthread,
but I won't have the guts to make TREE_RCU use kthread by default for
some time.  (Probably a year or so trouble-free experience with RCU
priority boosting/kthreads.)

> If not strictly implied I'd have no problem simply writing:
> 
>   synchronize_rcu_sched();
>   synchronize_srcu();

If that works for you, then we are set!  The only reason to introduce
a combined primitive would be if the latency of the above was too large.

							Thanx, Paul

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-09 19:50               ` [tip:perf/core] perf: Rework the PMU methods tip-bot for Peter Zijlstra
@ 2010-09-11  8:16                   ` Michael Cree
  0 siblings, 0 replies; 1150+ messages in thread
From: Michael Cree @ 2010-09-11  8:16 UTC (permalink / raw)
  To: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo
  Cc: linux-alpha

On 10/09/10 07:50, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  a4eaf7f14675cb512d69f0c928055e73d0c6d252
> Gitweb:     http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
> Author:     Peter Zijlstra<a.p.zijlstra@chello.nl>
> AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
> Committer:  Ingo Molnar<mingo@elte.hu>
> CommitDate: Thu, 9 Sep 2010 20:46:30 +0200
>
> perf: Rework the PMU methods
>
> Replace pmu::{enable,disable,start,stop,unthrottle} with
> pmu::{add,del,start,stop}, all of which take a flags argument.

Regarding the new function alpha_pmu_stop() in 
arch/alpha/kernel/perf_event.c:

> -static void alpha_pmu_unthrottle(struct perf_event *event)
> +static void alpha_pmu_stop(struct perf_event *event, int flags)
>   {
>   	struct hw_perf_event *hwc =&event->hw;
>   	struct cpu_hw_events *cpuc =&__get_cpu_var(cpu_hw_events);
>
> +	if (!(hwc->state&  PERF_HES_STOPPED)) {
> +		cpuc->idx_mask&= !(1UL<<hwc->idx);
                                  ^
Presumably ones complement (rather than logical not) is meant.

> +		hwc->state |= PERF_HES_STOPPED;
> +	}
> +
> +	if ((flags&  PERF_EF_UPDATE)&&  !(hwc->state&  PERF_HES_UPTODATE)) {
> +		alpha_perf_event_update(event, hwc, hwc->idx, 0);
> +		hwc->state |= PERF_HES_UPTODATE;
> +	}
> +
> +	if (cpuc->enabled)
> +		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));

By the name of the function (alpha_pmu_stop) I assume that the intent is 
to stop the specific PMC here.  The above fails to do that.  When 
wrperfmon() is used with PERFMON_CMD_ENABLE it enables the PMCs with set 
bits in the second argument.  It does not stop the others.  To do that 
wrperfmon() must be called with PERFMON_CMD_DISABLE and the 
corresponding PMC bits set to disable the PMC.

Cheers
Michael.

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

* Re: [tip:perf/core] perf: Rework the PMU methods
@ 2010-09-11  8:16                   ` Michael Cree
  0 siblings, 0 replies; 1150+ messages in thread
From: Michael Cree @ 2010-09-11  8:16 UTC (permalink / raw)
  To: mingo, dengcheng.zhu, a.p.zijlstra, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin
  Cc: linux-alpha

On 10/09/10 07:50, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  a4eaf7f14675cb512d69f0c928055e73d0c6d252
> Gitweb:     http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
> Author:     Peter Zijlstra<a.p.zijlstra@chello.nl>
> AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
> Committer:  Ingo Molnar<mingo@elte.hu>
> CommitDate: Thu, 9 Sep 2010 20:46:30 +0200
>
> perf: Rework the PMU methods
>
> Replace pmu::{enable,disable,start,stop,unthrottle} with
> pmu::{add,del,start,stop}, all of which take a flags argument.

Regarding the new function alpha_pmu_stop() in 
arch/alpha/kernel/perf_event.c:

> -static void alpha_pmu_unthrottle(struct perf_event *event)
> +static void alpha_pmu_stop(struct perf_event *event, int flags)
>   {
>   	struct hw_perf_event *hwc =&event->hw;
>   	struct cpu_hw_events *cpuc =&__get_cpu_var(cpu_hw_events);
>
> +	if (!(hwc->state&  PERF_HES_STOPPED)) {
> +		cpuc->idx_mask&= !(1UL<<hwc->idx);
                                  ^
Presumably ones complement (rather than logical not) is meant.

> +		hwc->state |= PERF_HES_STOPPED;
> +	}
> +
> +	if ((flags&  PERF_EF_UPDATE)&&  !(hwc->state&  PERF_HES_UPTODATE)) {
> +		alpha_perf_event_update(event, hwc, hwc->idx, 0);
> +		hwc->state |= PERF_HES_UPTODATE;
> +	}
> +
> +	if (cpuc->enabled)
> +		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));

By the name of the function (alpha_pmu_stop) I assume that the intent is 
to stop the specific PMC here.  The above fails to do that.  When 
wrperfmon() is used with PERFMON_CMD_ENABLE it enables the PMCs with set 
bits in the second argument.  It does not stop the others.  To do that 
wrperfmon() must be called with PERFMON_CMD_DISABLE and the 
corresponding PMC bits set to disable the PMC.

Cheers
Michael.

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-11  8:16                   ` Michael Cree
  (?)
@ 2010-09-11  9:40                   ` Peter Zijlstra
  2010-09-12  5:33                     ` Michael Cree
  -1 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-11  9:40 UTC (permalink / raw)
  To: Michael Cree
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On Sat, 2010-09-11 at 20:16 +1200, Michael Cree wrote:
> On 10/09/10 07:50, tip-bot for Peter Zijlstra wrote:
> > Commit-ID:  a4eaf7f14675cb512d69f0c928055e73d0c6d252
> > Gitweb:     http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
> > Author:     Peter Zijlstra<a.p.zijlstra@chello.nl>
> > AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
> > Committer:  Ingo Molnar<mingo@elte.hu>
> > CommitDate: Thu, 9 Sep 2010 20:46:30 +0200
> >
> > perf: Rework the PMU methods
> >
> > Replace pmu::{enable,disable,start,stop,unthrottle} with
> > pmu::{add,del,start,stop}, all of which take a flags argument.
> 
> Regarding the new function alpha_pmu_stop() in 
> arch/alpha/kernel/perf_event.c:
> 
> > -static void alpha_pmu_unthrottle(struct perf_event *event)
> > +static void alpha_pmu_stop(struct perf_event *event, int flags)
> >   {
> >   	struct hw_perf_event *hwc =&event->hw;
> >   	struct cpu_hw_events *cpuc =&__get_cpu_var(cpu_hw_events);
> >
> > +	if (!(hwc->state&  PERF_HES_STOPPED)) {
> > +		cpuc->idx_mask&= !(1UL<<hwc->idx);
>                                   ^
> Presumably ones complement (rather than logical not) is meant.

Yes, typo that, sorry.

> 
> > +		hwc->state |= PERF_HES_STOPPED;
> > +	}
> > +
> > +	if ((flags&  PERF_EF_UPDATE)&&  !(hwc->state&  PERF_HES_UPTODATE)) {
> > +		alpha_perf_event_update(event, hwc, hwc->idx, 0);
> > +		hwc->state |= PERF_HES_UPTODATE;
> > +	}
> > +
> > +	if (cpuc->enabled)
> > +		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
> 
> By the name of the function (alpha_pmu_stop) I assume that the intent is 
> to stop the specific PMC here.  The above fails to do that.  When 
> wrperfmon() is used with PERFMON_CMD_ENABLE it enables the PMCs with set 
> bits in the second argument.  It does not stop the others.  To do that 
> wrperfmon() must be called with PERFMON_CMD_DISABLE and the 
> corresponding PMC bits set to disable the PMC.

Right, so ->add()/->del() schedule the event onto the pmu and deal with
any resource issues where needed. ->stop()/->start() simply leave the
event on the pmu with all resources in tact, but ensure it doesn't
actually count.

Depending on the PMU there's various ways of achieving that, some PMUs
can't disable counter, for those we simply take a counter reading and
disable the interrupt, and reset the counter to the previous value on
->start again and enable the interrupt.

Or when we can't even disable the interrupt, we program it to the
longest possible period, etc..

Apparently ALPHA can nicely disable things, except I seem to have
misunderstood the way how, I assumed it had an enable register, and
writing a 0 to the idx position would stop it.

Could you provide a patch that makes ALPHA work again, or would you like
me to take another stab at it?

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-11  9:40                   ` Peter Zijlstra
@ 2010-09-12  5:33                     ` Michael Cree
  2010-09-12  5:37                       ` [PATCH] alpha: Fix HW performance counters to be stopped properly Michael Cree
  2010-09-13 12:15                       ` [tip:perf/core] perf: Rework the PMU methods Peter Zijlstra
  0 siblings, 2 replies; 1150+ messages in thread
From: Michael Cree @ 2010-09-12  5:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On 11/09/10 21:40, Peter Zijlstra wrote:
> On Sat, 2010-09-11 at 20:16 +1200, Michael Cree wrote:
>> On 10/09/10 07:50, tip-bot for Peter Zijlstra wrote:
>>> Commit-ID:  a4eaf7f14675cb512d69f0c928055e73d0c6d252
>>> Gitweb:     http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
>>> Author:     Peter Zijlstra<a.p.zijlstra@chello.nl>
>>> AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
>>> Committer:  Ingo Molnar<mingo@elte.hu>
>>> CommitDate: Thu, 9 Sep 2010 20:46:30 +0200
>>>
>>> perf: Rework the PMU methods
>>>
>>> Replace pmu::{enable,disable,start,stop,unthrottle} with
>>> pmu::{add,del,start,stop}, all of which take a flags argument.
>>
>> Regarding the new function alpha_pmu_stop() in
>> arch/alpha/kernel/perf_event.c:
>>

> Could you provide a patch that makes ALPHA work again, or would you like
> me to take another stab at it?

Yes, done.  I also took the liberty to fix an undefined variable and 
multiple defined variable errors that were exposed by compilation.  Will 
reply to this with the patch.

I've also tested it on a UP alpha.  It worked well for a little while 
but after running 'perf top' for a number of seconds I got the following 
warning:

[  287.952977] WARNING: at arch/alpha/kernel/perf_event.c:546 
alpha_pmu_start+0xd0/0x120()
[  287.952977] Modules linked in: radeon ttm drm_kms_helper hwmon 
cfbcopyarea cfbimgblt cfbfillrect parport_pc parport nfsd exportfs nfs 
lockd sunrpc ipv6 loop snd_hda_codec_atihdmi snd_hda_intel snd_hda_codec 
snd_pcm snd_seq snd_timer snd_seq_device ftdi_sio sg usbserial sr_mod 
snd cdrom r8169 ohci1394 soundcore ohci_hcd ehci_hcd ieee1394 mii 
snd_page_alloc ata_generic pcspkr tulip evdev usbcore pata_cypress
[  287.952977] fffffc000078fb80 fffffc00007961c8 fffffc000031dbb0 
fffffc002780f400
[  287.952977]        0000000000000000 0000000000000400 00000000000ee6b3 
0000000000000000
[  287.952977]        fffffc000036cf28 fffffc002780f400 fffffc003f006240 
fffffc003f343538
[  287.952977]        fffffc000036d124 0000000000000001 fffffc003f006200 
0000000000000000
[  287.952977]        fffffc003f0062c8 0000000000000000 fffffc002780f410 
fffffc003f0062c8
[  287.952977]        fffffc000034d118 fffffc003f0062c8 fffffc0000795b28 
fffffc0000795b40
[  287.952977] Trace:
[  287.952977] [<fffffc000031dbb0>] alpha_pmu_start+0xd0/0x120
[  287.952977] [<fffffc000036cf28>] perf_ctx_adjust_freq+0x138/0x150
[  287.952977] [<fffffc000036d124>] perf_event_context_tick+0x1e4/0x210
[  287.952977] [<fffffc000034d118>] hrtimer_run_queues+0x1b8/0x2f0
[  287.952977] [<fffffc0000338a48>] run_local_timers+0x18/0x40
[  287.952977] [<fffffc0000338aac>] update_process_times+0x3c/0xb0
[  287.952977] [<fffffc000031895c>] timer_interrupt+0x9c/0x100
[  287.952977] [<fffffc0000361450>] handle_IRQ_event+0x70/0x1a0
[  287.952977] [<fffffc0000361648>] __do_IRQ+0xc8/0x160
[  287.952977] [<fffffc0000315374>] handle_irq+0x54/0xb0
[  287.952977] [<fffffc0000315b04>] do_entInt+0xc4/0x1e0
[  287.952977] [<fffffc0000310c40>] ret_from_sys_call+0x0/0x10
[  287.952977] [<fffffc00003ab414>] file_free_rcu+0x54/0x70
[  287.952977] [<fffffc00003bd0ec>] estimate_accuracy+0xdc/0x120
[  287.952977] [<fffffc0000313108>] cpu_idle+0x48/0x60
[  287.952977] [<fffffc0000367e90>] perf_event_task_sched_in+0x0/0x60
[  287.952977] [<fffffc00003130f0>] cpu_idle+0x30/0x60
[  287.952977] [<fffffc00006338d0>] rest_init+0xb0/0xd0
[  287.952977] [<fffffc000031001c>] _stext+0x1c/0x20
[  287.952977]
[  287.952977] ---[ end trace 6f10adce9e4129fa ]---

which is from the line in alpha_pmu_start() that checks that 
PERF_HES_STOPPED is set.

I see that the backtrace is from the Alpha timer_interrupt() code which 
goes something like this:

[do some stuff updating timer deltas then...]

#ifndef CONFIG_SMP
         while (nticks--)
                 update_process_times(user_mode(get_irq_regs()));
#endif

         if (test_perf_event_pending()) {
                 clear_perf_event_pending();
                 perf_event_do_pending();
         }

         return IRQ_HANDLED;
}


When I added the code for handle pending events to the timer interrupt I 
hadn't realised that update_process_times() could call back into the 
perf code.  I'm speculating here, but could it be that there is pending 
work to stop the HW counter, but the call to re-start it is beating the 
call to stop it?

Cheers
Michael.

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

* [PATCH] alpha:  Fix HW performance counters to be stopped properly.
  2010-09-12  5:33                     ` Michael Cree
@ 2010-09-12  5:37                       ` Michael Cree
  2010-09-15 10:02                         ` [tip:perf/core] " tip-bot for Michael Cree
  2010-09-13 12:15                       ` [tip:perf/core] perf: Rework the PMU methods Peter Zijlstra
  1 sibling, 1 reply; 1150+ messages in thread
From: Michael Cree @ 2010-09-12  5:37 UTC (permalink / raw)
  To: peterz
  Cc: Michael Cree, mingo, dengcheng.zhu, yanmin_zhang, gorcunov,
	fweisbec, robert.richter, ming.m.lin, tglx, hpa, paulus,
	linux-kernel, eranian, will.deacon, lethal, davem, mingo,
	linux-alpha

Also fix a few compile errors due to undefined and duplicated
variables.

Signed-off-by: Michael Cree <mcree@orcon.net.nz>
---
 arch/alpha/kernel/perf_event.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index a25fe9e..41f204f 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -422,9 +422,10 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
 static int alpha_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	struct hw_perf_event *hwc = &event->hw;
 	int n0;
 	int ret;
-	unsigned long flags;
+	unsigned long irq_flags;
 
 	/*
 	 * The Sparc code has the IRQ disable first followed by the perf
@@ -435,7 +436,7 @@ static int alpha_pmu_add(struct perf_event *event, int flags)
 	 * final PMI to occur before we disable interrupts.
 	 */
 	perf_pmu_disable(event->pmu);
-	local_irq_save(flags);
+	local_irq_save(irq_flags);
 
 	/* Default to error to be returned */
 	ret = -EAGAIN;
@@ -458,7 +459,7 @@ static int alpha_pmu_add(struct perf_event *event, int flags)
 	if (!(flags & PERF_EF_START))
 		hwc->state |= PERF_HES_STOPPED;
 
-	local_irq_restore(flags);
+	local_irq_restore(irq_flags);
 	perf_pmu_enable(event->pmu);
 
 	return ret;
@@ -474,11 +475,11 @@ static void alpha_pmu_del(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	unsigned long flags;
+	unsigned long irq_flags;
 	int j;
 
 	perf_pmu_disable(event->pmu);
-	local_irq_save(flags);
+	local_irq_save(irq_flags);
 
 	for (j = 0; j < cpuc->n_events; j++) {
 		if (event == cpuc->event[j]) {
@@ -504,7 +505,7 @@ static void alpha_pmu_del(struct perf_event *event, int flags)
 		}
 	}
 
-	local_irq_restore(flags);
+	local_irq_restore(irq_flags);
 	perf_pmu_enable(event->pmu);
 }
 
@@ -523,7 +524,7 @@ static void alpha_pmu_stop(struct perf_event *event, int flags)
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
 	if (!(hwc->state & PERF_HES_STOPPED)) {
-		cpuc->idx_mask &= !(1UL<<hwc->idx);
+		cpuc->idx_mask &= ~(1UL<<hwc->idx);
 		hwc->state |= PERF_HES_STOPPED;
 	}
 
@@ -533,7 +534,7 @@ static void alpha_pmu_stop(struct perf_event *event, int flags)
 	}
 
 	if (cpuc->enabled)
-		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
+		wrperfmon(PERFMON_CMD_DISABLE, (1UL<<hwc->idx));
 }
 
 
-- 
1.7.1


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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-12  5:33                     ` Michael Cree
  2010-09-12  5:37                       ` [PATCH] alpha: Fix HW performance counters to be stopped properly Michael Cree
@ 2010-09-13 12:15                       ` Peter Zijlstra
  2010-09-13 13:18                         ` Peter Zijlstra
  1 sibling, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-13 12:15 UTC (permalink / raw)
  To: Michael Cree
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On Sun, 2010-09-12 at 17:33 +1200, Michael Cree wrote:

> Yes, done.  I also took the liberty to fix an undefined variable and 
> multiple defined variable errors that were exposed by compilation.  Will 
> reply to this with the patch.

Thanks, and sorry for messing up Alpha that bad.. I have an alpha
compiler and I really through I compile tested it :/

> I've also tested it on a UP alpha.  It worked well for a little while 
> but after running 'perf top' for a number of seconds I got the following 
> warning:

<snip warn>

> which is from the line in alpha_pmu_start() that checks that 
> PERF_HES_STOPPED is set.
> 
> I see that the backtrace is from the Alpha timer_interrupt() code which 
> goes something like this:
> 
> [do some stuff updating timer deltas then...]
> 
> #ifndef CONFIG_SMP
>          while (nticks--)
>                  update_process_times(user_mode(get_irq_regs()));
> #endif
> 
>          if (test_perf_event_pending()) {
>                  clear_perf_event_pending();
>                  perf_event_do_pending();
>          }
> 
>          return IRQ_HANDLED;
> }
> 
> 
> When I added the code for handle pending events to the timer interrupt I 
> hadn't realised that update_process_times() could call back into the 
> perf code.  I'm speculating here, but could it be that there is pending 
> work to stop the HW counter, but the call to re-start it is beating the 
> call to stop it?

Right, so the ->start() call came from perf_ctx_adjust_freq(), which
depending on whether perf_adjust_period() gets inlined, can have two
such calls.

Assuming it didn't inline (there's two callsites, which should defeat
the inline static functions with a single callsite heuristic), you hit
the unthrottle() call.

Ahh, the alpha throttle call should be using the fancy new stop function
too (will fold into your earlier patch if it indeed works):

As to the point you raised above, yes, I think it would be prudent to
call perf_event_do_pending() before update_process_times().


Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
Index: linux-2.6/arch/alpha/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/arch/alpha/kernel/perf_event.c
+++ linux-2.6/arch/alpha/kernel/perf_event.c
@@ -825,14 +825,14 @@ static void alpha_perf_event_irq_handler
 			break;
 	}
 
+	event = cpuc->event[j];
+
 	if (unlikely(j == cpuc->n_events)) {
 		/* This can occur if the event is disabled right on a PMC overflow. */
-		wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
+		alpha_pmu_stop(event, 0);
 		return;
 	}
 
-	event = cpuc->event[j];
-
 	if (unlikely(!event)) {
 		/* This should never occur! */
 		irq_err_count++;


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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-13 12:15                       ` [tip:perf/core] perf: Rework the PMU methods Peter Zijlstra
@ 2010-09-13 13:18                         ` Peter Zijlstra
  2010-09-14 10:11                           ` Michael Cree
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-13 13:18 UTC (permalink / raw)
  To: Michael Cree
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On Mon, 2010-09-13 at 14:15 +0200, Peter Zijlstra wrote:
> On Sun, 2010-09-12 at 17:33 +1200, Michael Cree wrote:
> 
> > Yes, done.  I also took the liberty to fix an undefined variable and 
> > multiple defined variable errors that were exposed by compilation.  Will 
> > reply to this with the patch.
> 
> Thanks, and sorry for messing up Alpha that bad.. I have an alpha
> compiler and I really through I compile tested it :/
> 
> > I've also tested it on a UP alpha.  It worked well for a little while 
> > but after running 'perf top' for a number of seconds I got the following 
> > warning:
> 
> <snip warn>
> 
> > which is from the line in alpha_pmu_start() that checks that 
> > PERF_HES_STOPPED is set.
> > 
> > I see that the backtrace is from the Alpha timer_interrupt() code which 
> > goes something like this:
> > 
> > [do some stuff updating timer deltas then...]
> > 
> > #ifndef CONFIG_SMP
> >          while (nticks--)
> >                  update_process_times(user_mode(get_irq_regs()));
> > #endif
> > 
> >          if (test_perf_event_pending()) {
> >                  clear_perf_event_pending();
> >                  perf_event_do_pending();
> >          }
> > 
> >          return IRQ_HANDLED;
> > }
> > 
> > 
> > When I added the code for handle pending events to the timer interrupt I 
> > hadn't realised that update_process_times() could call back into the 
> > perf code.  I'm speculating here, but could it be that there is pending 
> > work to stop the HW counter, but the call to re-start it is beating the 
> > call to stop it?
> 
> Right, so the ->start() call came from perf_ctx_adjust_freq(), which
> depending on whether perf_adjust_period() gets inlined, can have two
> such calls.
> 
> Assuming it didn't inline (there's two callsites, which should defeat
> the inline static functions with a single callsite heuristic), you hit
> the unthrottle() call.
> 
> Ahh, the alpha throttle call should be using the fancy new stop function
> too (will fold into your earlier patch if it indeed works):
> 
> As to the point you raised above, yes, I think it would be prudent to
> call perf_event_do_pending() before update_process_times().
> 
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

Damn I suck.. Please try this one.

---
Index: linux-2.6/arch/alpha/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/arch/alpha/kernel/perf_event.c
+++ linux-2.6/arch/alpha/kernel/perf_event.c
@@ -850,7 +850,7 @@ static void alpha_perf_event_irq_handler
 			/* Interrupts coming too quickly; "throttle" the
 			 * counter, i.e., disable it for a little while.
 			 */
-			cpuc->idx_mask &= ~(1UL<<idx);
+			alpha_pmu_stop(event, 0);
 		}
 	}
 	wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);


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

* [tip:perf/core] perf: Sanitize the RCU logic
       [not found]             ` <new-submission>
                                 ` (625 preceding siblings ...)
  2010-09-10 15:48               ` [tip:perf/core] perf: Fix perf_init_event() tip-bot for Peter Zijlstra
@ 2010-09-13 15:18               ` tip-bot for Peter Zijlstra
  2010-09-13 15:19               ` [tip:perf/core] perf: Fix free_event() tip-bot for Peter Zijlstra
                                 ` (79 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-13 15:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulmck, hpa, mingo, fweisbec, a.p.zijlstra, tglx, mingo

Commit-ID:  cde8e88498c8de69271fcb6d4dd974979368fa67
Gitweb:     http://git.kernel.org/tip/cde8e88498c8de69271fcb6d4dd974979368fa67
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 13 Sep 2010 11:06:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 13 Sep 2010 17:08:42 +0200

perf: Sanitize the RCU logic

Simplify things and simply synchronize against two RCU variants for
PMU unregister -- we don't care about performance, its module unload
if anything.

Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f29b525..bc46bff 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3810,7 +3810,7 @@ static void perf_event_task_event(struct perf_task_event *task_event)
 	struct pmu *pmu;
 	int ctxn;
 
-	rcu_read_lock_sched();
+	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_task_ctx(&cpuctx->ctx, task_event);
@@ -3825,7 +3825,7 @@ static void perf_event_task_event(struct perf_task_event *task_event)
 		if (ctx)
 			perf_event_task_ctx(ctx, task_event);
 	}
-	rcu_read_unlock_sched();
+	rcu_read_unlock();
 }
 
 static void perf_event_task(struct task_struct *task,
@@ -3943,7 +3943,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 
 	comm_event->event_id.header.size = sizeof(comm_event->event_id) + size;
 
-	rcu_read_lock_sched();
+	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_comm_ctx(&cpuctx->ctx, comm_event);
@@ -3956,7 +3956,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 		if (ctx)
 			perf_event_comm_ctx(ctx, comm_event);
 	}
-	rcu_read_unlock_sched();
+	rcu_read_unlock();
 }
 
 void perf_event_comm(struct task_struct *task)
@@ -4126,7 +4126,7 @@ got_name:
 
 	mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
 
-	rcu_read_lock_sched();
+	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
 		perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
@@ -4142,7 +4142,7 @@ got_name:
 					vma->vm_flags & VM_EXEC);
 		}
 	}
-	rcu_read_unlock_sched();
+	rcu_read_unlock();
 
 	kfree(buf);
 }
@@ -5218,10 +5218,11 @@ void perf_pmu_unregister(struct pmu *pmu)
 	mutex_unlock(&pmus_lock);
 
 	/*
-	 * We use the pmu list either under SRCU or preempt_disable,
-	 * synchronize_srcu() implies synchronize_sched() so we're good.
+	 * We dereference the pmu list under both SRCU and regular RCU, so
+	 * synchronize against both of those.
 	 */
 	synchronize_srcu(&pmus_srcu);
+	synchronize_rcu();
 
 	free_percpu(pmu->pmu_disable_count);
 	free_pmu_context(pmu->pmu_cpu_context);

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

* [tip:perf/core] perf: Fix free_event()
       [not found]             ` <new-submission>
                                 ` (626 preceding siblings ...)
  2010-09-13 15:18               ` [tip:perf/core] perf: Sanitize the RCU logic tip-bot for Peter Zijlstra
@ 2010-09-13 15:19               ` tip-bot for Peter Zijlstra
  2010-10-18 19:15               ` [tip:sched/core] sched: Unindent labels tip-bot for Peter Zijlstra
                                 ` (78 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-09-13 15:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, gorcunov, mingo

Commit-ID:  0c67b40872326a5340cab51d79a192a5fbaeb484
Gitweb:     http://git.kernel.org/tip/0c67b40872326a5340cab51d79a192a5fbaeb484
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 13 Sep 2010 11:15:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 13 Sep 2010 17:08:42 +0200

perf: Fix free_event()

With the context rework stuff we can actually end up freeing an event
before it gets attached to a context.

Reported-by: Cyrill Gorcunov <gorcunov@gmail.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_event.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bc46bff..440f9ca 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2150,7 +2150,9 @@ static void free_event(struct perf_event *event)
 	if (event->destroy)
 		event->destroy(event);
 
-	put_ctx(event->ctx);
+	if (event->ctx)
+		put_ctx(event->ctx);
+
 	call_rcu(&event->rcu_head, free_event_rcu);
 }
 

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-13 13:18                         ` Peter Zijlstra
@ 2010-09-14 10:11                           ` Michael Cree
  2010-09-14 14:07                             ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Michael Cree @ 2010-09-14 10:11 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On 14/09/10 01:18, Peter Zijlstra wrote:
> On Mon, 2010-09-13 at 14:15 +0200, Peter Zijlstra wrote:
>> On Sun, 2010-09-12 at 17:33 +1200, Michael Cree wrote:
>>
>>> I've also tested it on a UP alpha.  It worked well for a little while
>>> but after running 'perf top' for a number of seconds I got the following
>>> warning:

>> Ahh, the alpha throttle call should be using the fancy new stop function
>> too (will fold into your earlier patch if it indeed works):
>>
>> As to the point you raised above, yes, I think it would be prudent to
>> call perf_event_do_pending() before update_process_times().
>>
>>
>> Signed-off-by: Peter Zijlstra<a.p.zijlstra@chello.nl>
>
> Damn I suck.. Please try this one.
>
> ---
> Index: linux-2.6/arch/alpha/kernel/perf_event.c
> ===================================================================
> --- linux-2.6.orig/arch/alpha/kernel/perf_event.c
> +++ linux-2.6/arch/alpha/kernel/perf_event.c
> @@ -850,7 +850,7 @@ static void alpha_perf_event_irq_handler
>   			/* Interrupts coming too quickly; "throttle" the
>   			 * counter, i.e., disable it for a little while.
>   			 */
> -			cpuc->idx_mask&= ~(1UL<<idx);
> +			alpha_pmu_stop(event, 0);
>   		}
>   	}
>   	wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);

Thanks, that does the trick.  I have had it running for a while without 
any problems... Well, except for a new problem which I describe below. 
Anyway the above patch has fixed the original problem so can be rolled 
into my earlier one as you suggest.

I haven't shifted perf_event_do_pending() before update_process_times() 
in the timer interrupt yet.  When I get around to it I'll send a patch 
through the Alpha maintainer as this is independent of the work on the 
core perf event code.

Now to the new problem I saw:  I accidently reran 'perf top' while it 
was already running, and the second instance of 'perf top' seg-faulted 
and the kernel OOPSed with the following:

[  818.575752] Unable to handle kernel paging request at virtual address 
0000000000000060
[  818.575752] perf(4935): Oops 0
[  818.575752] pc = [<fffffc000036b8b8>]  ra = [<fffffc000036ba3c>]  ps 
= 0000    Not tainted
[  818.575752] pc is at put_ctx+0x18/0xb0
[  818.575752] ra is at free_event+0xec/0x220
[  818.575752] v0 = 0000000000000000  t0 = 0000000000000000  t1 = 
0000000000000002
[  818.575752] t2 = 0000000000000000  t3 = 0000000000000000  t4 = 
fffffc000063e4b0
[  818.575752] t5 = fffffc0034837000  t6 = fffffc0034837000  t7 = 
fffffc003abe0000
[  818.575752] s0 = 0000000000000000  s1 = 0000000000000000  s2 = 
0000000000000000
[  818.575752] s3 = ffffffffffffffff  s4 = 0000000000000000  s5 = 
0000000000000053
[  818.575752] s6 = fffffc0034836c00
[  818.575752] a0 = 0000000000000000  a1 = fffffc00311a6980  a2 = 
0000000000000000
[  818.575752] a3 = 0000000000000001  a4 = fffffc0000797110  a5 = 
00000001200055f8
[  818.575752] t8 = 0000000000000001  t9 = 00000001200396f4  t10= 
0000000000000000
[  818.575752] t11= 000000000000000a  pv = fffffc000031d650  at = 
fffffc000036f8bc
[  818.575752] gp = fffffc00007d6e40  sp = fffffc003abe3e18
[  818.575752] Disabling lock debugging due to kernel taint
[  818.575752] Trace:
[  818.575752] [<fffffc000036ba3c>] free_event+0xec/0x220
[  818.575752] [<fffffc000036fa24>] SyS_perf_event_open+0x2a4/0x6f0
[  818.575752] [<fffffc0000310c24>] entSys+0xa4/0xc0
[  818.575752]
[  818.575752] Code: 27bb0047  23bdb5a0  23defff0  b53e0008  b75e0000 
47f00409 <a8500060> 40403121

The first instance of 'perf top' kept running happily.

Cheers
Michael.

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-14 10:11                           ` Michael Cree
@ 2010-09-14 14:07                             ` Peter Zijlstra
  2010-09-15 20:25                               ` Michael Cree
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-09-14 14:07 UTC (permalink / raw)
  To: Michael Cree
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On Tue, 2010-09-14 at 22:11 +1200, Michael Cree wrote:
> 
> [  818.575752] Unable to handle kernel paging request at virtual address 
> 0000000000000060
> [  818.575752] perf(4935): Oops 0
> [  818.575752] pc = [<fffffc000036b8b8>]  ra = [<fffffc000036ba3c>]  ps 
> = 0000    Not tainted
> [  818.575752] pc is at put_ctx+0x18/0xb0
> [  818.575752] ra is at free_event+0xec/0x220
> [  818.575752] v0 = 0000000000000000  t0 = 0000000000000000  t1 = 
> 0000000000000002
> [  818.575752] t2 = 0000000000000000  t3 = 0000000000000000  t4 = 
> fffffc000063e4b0
> [  818.575752] t5 = fffffc0034837000  t6 = fffffc0034837000  t7 = 
> fffffc003abe0000
> [  818.575752] s0 = 0000000000000000  s1 = 0000000000000000  s2 = 
> 0000000000000000
> [  818.575752] s3 = ffffffffffffffff  s4 = 0000000000000000  s5 = 
> 0000000000000053
> [  818.575752] s6 = fffffc0034836c00
> [  818.575752] a0 = 0000000000000000  a1 = fffffc00311a6980  a2 = 
> 0000000000000000
> [  818.575752] a3 = 0000000000000001  a4 = fffffc0000797110  a5 = 
> 00000001200055f8
> [  818.575752] t8 = 0000000000000001  t9 = 00000001200396f4  t10= 
> 0000000000000000
> [  818.575752] t11= 000000000000000a  pv = fffffc000031d650  at = 
> fffffc000036f8bc
> [  818.575752] gp = fffffc00007d6e40  sp = fffffc003abe3e18
> [  818.575752] Disabling lock debugging due to kernel taint
> [  818.575752] Trace:
> [  818.575752] [<fffffc000036ba3c>] free_event+0xec/0x220
> [  818.575752] [<fffffc000036fa24>] SyS_perf_event_open+0x2a4/0x6f0
> [  818.575752] [<fffffc0000310c24>] entSys+0xa4/0xc0
> [  818.575752]
> [  818.575752] Code: 27bb0047  23bdb5a0  23defff0  b53e0008  b75e0000 
> 47f00409 <a8500060> 40403121 

Does the below cure that?

---
commit 0c67b40872326a5340cab51d79a192a5fbaeb484
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date:   Mon Sep 13 11:15:58 2010 +0200

    perf: Fix free_event()
    
    With the context rework stuff we can actually end up freeing an event
    before it gets attached to a context.
    
    Reported-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <new-submission>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bc46bff..440f9ca 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2150,7 +2150,9 @@ static void free_event(struct perf_event *event)
 	if (event->destroy)
 		event->destroy(event);
 
-	put_ctx(event->ctx);
+	if (event->ctx)
+		put_ctx(event->ctx);
+
 	call_rcu(&event->rcu_head, free_event_rcu);
 }
 


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

* [tip:perf/core] alpha: Fix HW performance counters to be stopped properly
  2010-09-12  5:37                       ` [PATCH] alpha: Fix HW performance counters to be stopped properly Michael Cree
@ 2010-09-15 10:02                         ` tip-bot for Michael Cree
  0 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Michael Cree @ 2010-09-15 10:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo, mcree

Commit-ID:  65175c07653534294257f75baa03a36edad86870
Gitweb:     http://git.kernel.org/tip/65175c07653534294257f75baa03a36edad86870
Author:     Michael Cree <mcree@orcon.net.nz>
AuthorDate: Sun, 12 Sep 2010 17:37:24 +1200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 15 Sep 2010 10:43:59 +0200

alpha: Fix HW performance counters to be stopped properly

Also fix a few compile errors due to undefined and duplicated
variables.

Signed-off-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1284269844-23251-1-git-send-email-mcree@orcon.net.nz>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/alpha/kernel/perf_event.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index a25fe9e..1cc4968 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -422,9 +422,10 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
 static int alpha_pmu_add(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+	struct hw_perf_event *hwc = &event->hw;
 	int n0;
 	int ret;
-	unsigned long flags;
+	unsigned long irq_flags;
 
 	/*
 	 * The Sparc code has the IRQ disable first followed by the perf
@@ -435,7 +436,7 @@ static int alpha_pmu_add(struct perf_event *event, int flags)
 	 * final PMI to occur before we disable interrupts.
 	 */
 	perf_pmu_disable(event->pmu);
-	local_irq_save(flags);
+	local_irq_save(irq_flags);
 
 	/* Default to error to be returned */
 	ret = -EAGAIN;
@@ -458,7 +459,7 @@ static int alpha_pmu_add(struct perf_event *event, int flags)
 	if (!(flags & PERF_EF_START))
 		hwc->state |= PERF_HES_STOPPED;
 
-	local_irq_restore(flags);
+	local_irq_restore(irq_flags);
 	perf_pmu_enable(event->pmu);
 
 	return ret;
@@ -474,11 +475,11 @@ static void alpha_pmu_del(struct perf_event *event, int flags)
 {
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 	struct hw_perf_event *hwc = &event->hw;
-	unsigned long flags;
+	unsigned long irq_flags;
 	int j;
 
 	perf_pmu_disable(event->pmu);
-	local_irq_save(flags);
+	local_irq_save(irq_flags);
 
 	for (j = 0; j < cpuc->n_events; j++) {
 		if (event == cpuc->event[j]) {
@@ -504,7 +505,7 @@ static void alpha_pmu_del(struct perf_event *event, int flags)
 		}
 	}
 
-	local_irq_restore(flags);
+	local_irq_restore(irq_flags);
 	perf_pmu_enable(event->pmu);
 }
 
@@ -523,7 +524,7 @@ static void alpha_pmu_stop(struct perf_event *event, int flags)
 	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
 
 	if (!(hwc->state & PERF_HES_STOPPED)) {
-		cpuc->idx_mask &= !(1UL<<hwc->idx);
+		cpuc->idx_mask &= ~(1UL<<hwc->idx);
 		hwc->state |= PERF_HES_STOPPED;
 	}
 
@@ -533,7 +534,7 @@ static void alpha_pmu_stop(struct perf_event *event, int flags)
 	}
 
 	if (cpuc->enabled)
-		wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
+		wrperfmon(PERFMON_CMD_DISABLE, (1UL<<hwc->idx));
 }
 
 
@@ -849,7 +850,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
 			/* Interrupts coming too quickly; "throttle" the
 			 * counter, i.e., disable it for a little while.
 			 */
-			cpuc->idx_mask &= ~(1UL<<idx);
+			alpha_pmu_stop(event, 0);
 		}
 	}
 	wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);

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

* Re: [tip:perf/core] perf: Rework the PMU methods
  2010-09-14 14:07                             ` Peter Zijlstra
@ 2010-09-15 20:25                               ` Michael Cree
  0 siblings, 0 replies; 1150+ messages in thread
From: Michael Cree @ 2010-09-15 20:25 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, dengcheng.zhu, yanmin_zhang, gorcunov, fweisbec,
	robert.richter, ming.m.lin, tglx, hpa, paulus, linux-kernel,
	eranian, will.deacon, lethal, davem, mingo, linux-alpha

On 15/09/2010, at 2:07 AM, Peter Zijlstra wrote:
> On Tue, 2010-09-14 at 22:11 +1200, Michael Cree wrote:
>>
>> [  818.575752] Unable to handle kernel paging request at virtual  
>> address
>> 0000000000000060
>> [  818.575752] perf(4935): Oops 0
>
> Does the below cure that?
>
> ---
> commit 0c67b40872326a5340cab51d79a192a5fbaeb484
> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Date:   Mon Sep 13 11:15:58 2010 +0200
>
>    perf: Fix free_event()

Yes, thanks, that's fixed it.

Cheers
Michael.


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

* [tip:sched/core] sched: Unindent labels
       [not found]             ` <new-submission>
                                 ` (627 preceding siblings ...)
  2010-09-13 15:19               ` [tip:perf/core] perf: Fix free_event() tip-bot for Peter Zijlstra
@ 2010-10-18 19:15               ` tip-bot for Peter Zijlstra
  2010-10-18 19:22               ` [tip:perf/core] perf: Optimize sw events tip-bot for Peter Zijlstra
                                 ` (77 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-10-18 19:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  4924627423d5e286136ad2520f5be536345ae590
Gitweb:     http://git.kernel.org/tip/4924627423d5e286136ad2520f5be536345ae590
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sun, 17 Oct 2010 21:46:10 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 18 Oct 2010 18:41:56 +0200

sched: Unindent labels

Labels should be on column 0.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c    |   12 ++++++------
 kernel/sched_rt.c |    6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 2111491..7f52283 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4891,7 +4891,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
 
 	cpuset_cpus_allowed(p, cpus_allowed);
 	cpumask_and(new_mask, in_mask, cpus_allowed);
- again:
+again:
 	retval = set_cpus_allowed_ptr(p, new_mask);
 
 	if (!retval) {
@@ -8141,9 +8141,9 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
 
 	return 1;
 
- err_free_rq:
+err_free_rq:
 	kfree(cfs_rq);
- err:
+err:
 	return 0;
 }
 
@@ -8231,9 +8231,9 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
 
 	return 1;
 
- err_free_rq:
+err_free_rq:
 	kfree(rt_rq);
- err:
+err:
 	return 0;
 }
 
@@ -8591,7 +8591,7 @@ static int tg_set_bandwidth(struct task_group *tg,
 		raw_spin_unlock(&rt_rq->rt_runtime_lock);
 	}
 	raw_spin_unlock_irq(&tg->rt_bandwidth.rt_runtime_lock);
- unlock:
+unlock:
 	read_unlock(&tasklist_lock);
 	mutex_unlock(&rt_constraints_mutex);
 
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index baef30f..ab77aa0 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1140,7 +1140,7 @@ static struct task_struct *pick_next_highest_task_rt(struct rq *rq, int cpu)
 	for_each_leaf_rt_rq(rt_rq, rq) {
 		array = &rt_rq->active;
 		idx = sched_find_first_bit(array->bitmap);
- next_idx:
+next_idx:
 		if (idx >= MAX_RT_PRIO)
 			continue;
 		if (next && next->prio < idx)
@@ -1316,7 +1316,7 @@ static int push_rt_task(struct rq *rq)
 	if (!next_task)
 		return 0;
 
- retry:
+retry:
 	if (unlikely(next_task == rq->curr)) {
 		WARN_ON(1);
 		return 0;
@@ -1464,7 +1464,7 @@ static int pull_rt_task(struct rq *this_rq)
 			 * but possible)
 			 */
 		}
- skip:
+skip:
 		double_unlock_balance(this_rq, src_rq);
 	}
 

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

* [tip:perf/core] perf: Optimize sw events
       [not found]             ` <new-submission>
                                 ` (628 preceding siblings ...)
  2010-10-18 19:15               ` [tip:sched/core] sched: Unindent labels tip-bot for Peter Zijlstra
@ 2010-10-18 19:22               ` tip-bot for Peter Zijlstra
  2010-10-18 19:22               ` [tip:perf/core] jump_label: Add COND_STMT(), reducer wrappery tip-bot for Peter Zijlstra
                                 ` (76 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-10-18 19:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, a.p.zijlstra, tglx, mingo

Commit-ID:  7e54a5a0b655734326dc78c2b5efc1eb35497bb6
Gitweb:     http://git.kernel.org/tip/7e54a5a0b655734326dc78c2b5efc1eb35497bb6
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 14 Oct 2010 22:32:45 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 18 Oct 2010 19:58:59 +0200

perf: Optimize sw events

Acked-by: Frederic Weisbecker <fweisbec@gmail.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_event.h |   20 +++++++++++---------
 kernel/perf_event.c        |    4 ++--
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 7f0e7f5..3b80cbf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1012,18 +1012,20 @@ static inline void perf_fetch_caller_regs(struct pt_regs *regs)
 	perf_arch_fetch_caller_regs(regs, CALLER_ADDR0);
 }
 
-static inline void
+static __always_inline void
 perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
 {
-	if (atomic_read(&perf_swevent_enabled[event_id])) {
-		struct pt_regs hot_regs;
-
-		if (!regs) {
-			perf_fetch_caller_regs(&hot_regs);
-			regs = &hot_regs;
-		}
-		__perf_sw_event(event_id, nr, nmi, regs, addr);
+	struct pt_regs hot_regs;
+
+	JUMP_LABEL(&perf_swevent_enabled[event_id], have_event);
+	return;
+
+have_event:
+	if (!regs) {
+		perf_fetch_caller_regs(&hot_regs);
+		regs = &hot_regs;
 	}
+	__perf_sw_event(event_id, nr, nmi, regs, addr);
 }
 
 extern void perf_event_mmap(struct vm_area_struct *vma);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f7febb0..05ecf6f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4669,7 +4669,7 @@ static void sw_perf_event_destroy(struct perf_event *event)
 
 	WARN_ON(event->parent);
 
-	atomic_dec(&perf_swevent_enabled[event_id]);
+	jump_label_dec(&perf_swevent_enabled[event_id]);
 	swevent_hlist_put(event);
 }
 
@@ -4699,7 +4699,7 @@ static int perf_swevent_init(struct perf_event *event)
 		if (err)
 			return err;
 
-		atomic_inc(&perf_swevent_enabled[event_id]);
+		jump_label_inc(&perf_swevent_enabled[event_id]);
 		event->destroy = sw_perf_event_destroy;
 	}
 

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

* [tip:perf/core] jump_label: Add COND_STMT(), reducer wrappery
       [not found]             ` <new-submission>
                                 ` (629 preceding siblings ...)
  2010-10-18 19:22               ` [tip:perf/core] perf: Optimize sw events tip-bot for Peter Zijlstra
@ 2010-10-18 19:22               ` tip-bot for Peter Zijlstra
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the failed-syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
                                 ` (75 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-10-18 19:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, acme, hpa, mingo, a.p.zijlstra, fweisbec,
	rostedt, tglx, jbaron, mingo

Commit-ID:  ebf31f502492527e2b6b5e5cf85a4ebc7fc8a52e
Gitweb:     http://git.kernel.org/tip/ebf31f502492527e2b6b5e5cf85a4ebc7fc8a52e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sun, 17 Oct 2010 12:15:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 18 Oct 2010 19:59:01 +0200

jump_label: Add COND_STMT(), reducer wrappery

The use of the JUMP_LABEL() construct ends up creating endless silly
wrappers, create a higher level construct to reduce this clutter.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/jump_label.h |   10 ++++++++++
 include/linux/perf_event.h |   12 ++----------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 81be496..b67cb18 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -61,4 +61,14 @@ static inline int jump_label_text_reserved(void *start, void *end)
 
 #endif
 
+#define COND_STMT(key, stmt)					\
+do {								\
+	__label__ jl_enabled;					\
+	JUMP_LABEL(key, jl_enabled);				\
+	if (0) {						\
+jl_enabled:							\
+		stmt;						\
+	}							\
+} while (0)
+
 #endif
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3b80cbf..057bf22 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -903,21 +903,13 @@ extern atomic_t perf_task_events;
 
 static inline void perf_event_task_sched_in(struct task_struct *task)
 {
-	JUMP_LABEL(&perf_task_events, have_events);
-	return;
-
-have_events:
-	__perf_event_task_sched_in(task);
+	COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
 }
 
 static inline
 void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
 {
-	JUMP_LABEL(&perf_task_events, have_events);
-	return;
-
-have_events:
-	__perf_event_task_sched_out(task, next);
+	COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
 }
 
 extern int perf_event_init_task(struct task_struct *child);

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

* [tip:perf/urgent] perf python scripting: Improve the failed-syscalls-by-pid script
       [not found]             ` <new-submission>
                                 ` (630 preceding siblings ...)
  2010-10-18 19:22               ` [tip:perf/core] jump_label: Add COND_STMT(), reducer wrappery tip-bot for Peter Zijlstra
@ 2010-10-26 10:22               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-counts script tip-bot for Arnaldo Carvalho de Melo
                                 ` (74 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-26 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  6cc7361440e499abb3a30cdbcfedad03e43c92ae
Gitweb:     http://git.kernel.org/tip/6cc7361440e499abb3a30cdbcfedad03e43c92ae
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 25 Oct 2010 15:15:10 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Oct 2010 18:46:41 -0200

perf python scripting: Improve the failed-syscalls-by-pid script

. Print message at script start telling how to get te summary
. Print the syscall name using the audit-lib-python package, if
  installed
. Print the errno string
. Accept both pid (if numeric) or COMM name

Now it looks like this:

[root@emilia ~]# perf trace failed-syscalls-by-pid
Press control+C to stop and show the summary
^C
syscall errors:

comm [pid]                           count
------------------------------  ----------

automount [1670]
  syscall: futex
    err = ETIMEDOUT                     39

irqbalance [1462]
  syscall: openat
    err = ENOENT                         4

perf [7888]
  syscall: lseek
    err = ESPIPE                         1
  syscall: open
    err = ENOENT                        24

perf [7889]
  syscall: ioctl
    err = EINVAL                         1
  syscall: readlink
    err = EINVAL                         2
  syscall: open
    err = ENOENT                       389
  syscall: stat
    err = ENOENT                       141
  syscall: lseek
    err = ESPIPE                         3
[root@emilia ~]#

[root@emilia ~]# perf trace failed-syscalls-by-pid 1670
Press control+C to stop and show the summary
^C
syscall errors:

comm [pid]                           count
------------------------------  ----------

automount [1670]
  syscall: futex
    err = ETIMEDOUT                      2
[root@emilia ~]#
[root@emilia ~]#
[root@emilia ~]#
[root@emilia ~]# perf trace failed-syscalls-by-pid automount
Press control+C to stop and show the summary
^C
syscall errors for automount:

comm [pid]                           count
------------------------------  ----------

automount [1669]
  syscall: futex
    err = ETIMEDOUT                      1

automount [1670]
  syscall: futex
    err = ETIMEDOUT                      5
[root@emilia ~]#

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |   37 ++++++++++++++++++++
 .../perf/scripts/python/failed-syscalls-by-pid.py  |   21 +++++++----
 2 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
index 9689bc0..9d15f48 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
@@ -6,6 +6,8 @@
 # Public License ("GPL") version 2 as published by the Free Software
 # Foundation.
 
+import errno, os
+
 NSECS_PER_SEC    = 1000000000
 
 def avg(total, n):
@@ -26,3 +28,38 @@ def nsecs_str(nsecs):
 
 def clear_term():
     print("\x1b[H\x1b[2J")
+
+audit_package_warned = False
+
+try:
+	import audit
+	machine_to_id = {
+		'x86_64': audit.MACH_86_64,
+		'alpha'	: audit.MACH_ALPHA,
+		'armeb'	: audit.MACH_ARMEB,
+		'ia64'	: audit.MACH_IA64,
+		'ppc'	: audit.MACH_PPC,
+		'ppc64'	: audit.MACH_PPC64,
+		's390'	: audit.MACH_S390,
+		's390x'	: audit.MACH_S390X,
+		'i386'	: audit.MACH_X86,
+		'i586'	: audit.MACH_X86,
+		'i686'	: audit.MACH_X86,
+	}
+	machine_id = machine_to_id[os.uname()[4]]
+except:
+	if not audit_package_warned:
+		audit_package_warned = True
+		print "Install the audit-libs-python package to get syscall names"
+
+def syscall_name(id):
+	try:
+		return audit.audit_syscall_to_name(id, machine_id)
+	except:
+		return str(id)
+
+def strerror(nr):
+	try:
+		return errno.errorcode[abs(nr)]
+	except:
+		return "Unknown %d errno" % nr
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py
index 0ca0227..acd7848 100644
--- a/tools/perf/scripts/python/failed-syscalls-by-pid.py
+++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py
@@ -13,21 +13,26 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 
 from perf_trace_context import *
 from Core import *
+from Util import *
 
-usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
+usage = "perf trace -s syscall-counts-by-pid.py [comm|pid]\n";
 
 for_comm = None
+for_pid = None
 
 if len(sys.argv) > 2:
 	sys.exit(usage)
 
 if len(sys.argv) > 1:
-	for_comm = sys.argv[1]
+	try:
+		for_pid = int(sys.argv[1])
+	except:
+		for_comm = sys.argv[1]
 
 syscalls = autodict()
 
 def trace_begin():
-	pass
+	print "Press control+C to stop and show the summary"
 
 def trace_end():
 	print_error_totals()
@@ -35,9 +40,9 @@ def trace_end():
 def raw_syscalls__sys_exit(event_name, context, common_cpu,
 	common_secs, common_nsecs, common_pid, common_comm,
 	id, ret):
-	if for_comm is not None:
-		if common_comm != for_comm:
-			return
+	if (for_comm and common_comm != for_comm) or \
+	   (for_pid  and common_pid  != for_pid ):
+		return
 
 	if ret < 0:
 		try:
@@ -62,7 +67,7 @@ def print_error_totals():
 		    print "\n%s [%d]\n" % (comm, pid),
 		    id_keys = syscalls[comm][pid].keys()
 		    for id in id_keys:
-			    print "  syscall: %-16d\n" % (id),
+			    print "  syscall: %-16s\n" % syscall_name(id),
 			    ret_keys = syscalls[comm][pid][id].keys()
 			    for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k),  reverse = True):
-				    print "    err = %-20d  %10d\n" % (ret, val),
+				    print "    err = %-20s  %10d\n" % (strerror(ret), val),

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

* [tip:perf/urgent] perf python scripting: Improve the syscalls-counts script
       [not found]             ` <new-submission>
                                 ` (631 preceding siblings ...)
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the failed-syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-26 10:22               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: print the syscall name on sctop tip-bot for Arnaldo Carvalho de Melo
                                 ` (73 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-26 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  6545aaa561b5678c497e94dea22cb2d1af1d6859
Gitweb:     http://git.kernel.org/tip/6545aaa561b5678c497e94dea22cb2d1af1d6859
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 25 Oct 2010 17:11:25 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Oct 2010 18:47:11 -0200

perf python scripting: Improve the syscalls-counts script

. Print message at script start telling how to get te summary
. Print the syscall name

Now it looks like this:

[root@emilia ~]# perf trace syscall-counts
Press control+C to stop and show the summary
^C
syscall events:

event                                          count
----------------------------------------  -----------
read                                          102752
open                                            1293
close                                            878
write                                            319
stat                                             185
fstat                                            149
getdents                                         116
mmap                                              98
brk                                               80
rt_sigaction                                      66
munmap                                            42
mprotect                                          24
lseek                                             21
lstat                                              7
rt_sigprocmask                                     4
futex                                              3
statfs                                             3
ioctl                                              3
readlink                                           2
select                                             2
getegid                                            1
geteuid                                            1
getgid                                             1
getuid                                             1
getrlimit                                          1
fcntl                                              1
uname                                              1
[root@emilia ~]#

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/syscall-counts.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
index f977e85..ea183dc 100644
--- a/tools/perf/scripts/python/syscall-counts.py
+++ b/tools/perf/scripts/python/syscall-counts.py
@@ -13,6 +13,7 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 
 from perf_trace_context import *
 from Core import *
+from Util import syscall_name
 
 usage = "perf trace -s syscall-counts.py [comm]\n";
 
@@ -27,7 +28,7 @@ if len(sys.argv) > 1:
 syscalls = autodict()
 
 def trace_begin():
-	pass
+	print "Press control+C to stop and show the summary"
 
 def trace_end():
 	print_syscall_totals()
@@ -55,4 +56,4 @@ def print_syscall_totals():
 
     for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
 				  reverse = True):
-	    print "%-40d  %10d\n" % (id, val),
+	    print "%-40s  %10d\n" % (syscall_name(id), val),

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

* [tip:perf/urgent] perf python scripting: print the syscall name on sctop
       [not found]             ` <new-submission>
                                 ` (632 preceding siblings ...)
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-counts script tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-26 10:22               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
                                 ` (72 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-26 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  2e7d1e3fb8043380a2fc5d759eb357bf05acf935
Gitweb:     http://git.kernel.org/tip/2e7d1e3fb8043380a2fc5d759eb357bf05acf935
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 25 Oct 2010 18:39:20 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Oct 2010 18:47:27 -0200

perf python scripting: print the syscall name on sctop

[root@emilia tmp]# perf trace sctop 1
syscall events:

event                                          count
----------------------------------------  ----------
read                                          215400
futex                                           4029
write                                            376
brk                                               33
rt_sigprocmask                                    24
select                                            17
lseek                                              2
fsync                                              1
^C[root@emilia tmp]#

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/sctop.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 6cafad4..547cbe9 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -8,10 +8,7 @@
 # will be refreshed every [interval] seconds.  The default interval is
 # 3 seconds.
 
-import thread
-import time
-import os
-import sys
+import os, sys, thread, time
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
@@ -71,7 +68,7 @@ def print_syscall_totals(interval):
 		for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
 					      reverse = True):
 			try:
-				print "%-40d  %10d\n" % (id, val),
+				print "%-40s  %10d\n" % (syscall_name(id), val),
 			except TypeError:
 				pass
 		syscalls.clear()

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

* [tip:perf/urgent] perf python scripting: Improve the syscalls-by-pid script
       [not found]             ` <new-submission>
                                 ` (633 preceding siblings ...)
  2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: print the syscall name on sctop tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-26 10:23               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Support fedora 11 (audit 1.7.17) tip-bot for Arnaldo Carvalho de Melo
                                 ` (71 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-26 10:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  a64fa198ba1cd232871710c37476e006ed5516ed
Gitweb:     http://git.kernel.org/tip/a64fa198ba1cd232871710c37476e006ed5516ed
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 25 Oct 2010 18:44:09 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Oct 2010 18:48:15 -0200

perf python scripting: Improve the syscalls-by-pid script

. Print message at script start telling how to get te summary
. Print the syscall names
. Accept both pid (if numeric) or COMM name

Now it looks like this:

[root@emilia tmp]# perf trace syscall-counts-by-pid
Press control+C to stop and show the summary
^C
syscall events by comm/pid:

comm [pid]/syscalls                            count
----------------------------------------  ----------

automount [1670]
  futex                                            2

sshd [2322]
  rt_sigprocmask                                   4
  select                                           2
  write                                            1
  read                                             1

perf [15178]
  read                                          2506
  open                                           794
  close                                          769
  write                                          240
  getdents                                       112
  lseek                                           16
  stat                                             9
  perf_counter_open                                5
  fcntl                                            5
  mmap                                             5
  statfs                                           2

perf [15179]
  read                                         56701
  open                                           499
  stat                                           176
  fstat                                          149
  close                                          109
  mmap                                            98
  brk                                             75
  rt_sigaction                                    66
  munmap                                          42
  mprotect                                        24
  lstat                                            7
  lseek                                            5
  getdents                                         4
  ioctl                                            3
  readlink                                         2
  futex                                            1
  statfs                                           1
  getegid                                          1
  geteuid                                          1
  getgid                                           1
  getuid                                           1
  getrlimit                                        1
  fcntl                                            1
  uname                                            1
  write                                            1
[root@emilia tmp]# fg
-bash: fg: current: no such job
[root@emilia tmp]# perf trace syscall-counts-by-pid 2322
Press control+C to stop and show the summary
^C
syscall events by comm/pid:

comm [pid]/syscalls                            count
----------------------------------------  ----------

sshd [2322]
  rt_sigprocmask                                   4
  select                                           2
  write                                            1
  read                                             1
[root@emilia tmp]# perf trace syscall-counts-by-pid sshd
Press control+C to stop and show the summary
^C
syscall events for sshd:

comm [pid]/syscalls                            count
----------------------------------------  ----------

sshd [2322]
  rt_sigprocmask                                   4
  select                                           2
  write                                            1
  read                                             1
[root@emilia tmp]#

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/syscall-counts-by-pid.py |   21 ++++++++++++-------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py
index af722d6..d1ee3ec 100644
--- a/tools/perf/scripts/python/syscall-counts-by-pid.py
+++ b/tools/perf/scripts/python/syscall-counts-by-pid.py
@@ -5,29 +5,33 @@
 # Displays system-wide system call totals, broken down by syscall.
 # If a [comm] arg is specified, only syscalls called by [comm] are displayed.
 
-import os
-import sys
+import os, sys
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 
 from perf_trace_context import *
 from Core import *
+from Util import syscall_name
 
 usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
 
 for_comm = None
+for_pid = None
 
 if len(sys.argv) > 2:
 	sys.exit(usage)
 
 if len(sys.argv) > 1:
-	for_comm = sys.argv[1]
+	try:
+		for_pid = int(sys.argv[1])
+	except:
+		for_comm = sys.argv[1]
 
 syscalls = autodict()
 
 def trace_begin():
-	pass
+	print "Press control+C to stop and show the summary"
 
 def trace_end():
 	print_syscall_totals()
@@ -35,9 +39,10 @@ def trace_end():
 def raw_syscalls__sys_enter(event_name, context, common_cpu,
 	common_secs, common_nsecs, common_pid, common_comm,
 	id, args):
-	if for_comm is not None:
-		if common_comm != for_comm:
-			return
+
+	if (for_comm and common_comm != for_comm) or \
+	   (for_pid  and common_pid  != for_pid ):
+		return
 	try:
 		syscalls[common_comm][common_pid][id] += 1
 	except TypeError:
@@ -61,4 +66,4 @@ def print_syscall_totals():
 		    id_keys = syscalls[comm][pid].keys()
 		    for id, val in sorted(syscalls[comm][pid].iteritems(), \
 				  key = lambda(k, v): (v, k),  reverse = True):
-			    print "  %-38d  %10d\n" % (id, val),
+			    print "  %-38s  %10d\n" % (syscall_name(id), val),

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

* [tip:perf/urgent] perf python scripting: Support fedora 11 (audit 1.7.17)
       [not found]             ` <new-submission>
                                 ` (634 preceding siblings ...)
  2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-26 10:23               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-27 11:01               ` [tip:perf/urgent] perf scripting: Shut up 'perf record' final status tip-bot for Arnaldo Carvalho de Melo
                                 ` (70 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-26 10:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, davem, fweisbec, tglx, mingo

Commit-ID:  7f6c1bd50d73d12f8b4ea09edb4515997f6527f5
Gitweb:     http://git.kernel.org/tip/7f6c1bd50d73d12f8b4ea09edb4515997f6527f5
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 25 Oct 2010 22:12:01 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Oct 2010 22:12:01 -0200

perf python scripting: Support fedora 11 (audit 1.7.17)

Where we don't have the audit.MACH_ARMEB constant.

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
index 9d15f48..99ff1b7 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
@@ -36,7 +36,6 @@ try:
 	machine_to_id = {
 		'x86_64': audit.MACH_86_64,
 		'alpha'	: audit.MACH_ALPHA,
-		'armeb'	: audit.MACH_ARMEB,
 		'ia64'	: audit.MACH_IA64,
 		'ppc'	: audit.MACH_PPC,
 		'ppc64'	: audit.MACH_PPC64,
@@ -46,6 +45,10 @@ try:
 		'i586'	: audit.MACH_X86,
 		'i686'	: audit.MACH_X86,
 	}
+	try:
+		machine_to_id['armeb'] = audit.MACH_ARMEB
+	except:
+		pass
 	machine_id = machine_to_id[os.uname()[4]]
 except:
 	if not audit_package_warned:

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

* [tip:perf/urgent] perf scripting: Shut up 'perf record' final status
       [not found]             ` <new-submission>
                                 ` (635 preceding siblings ...)
  2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Support fedora 11 (audit 1.7.17) tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-27 11:01               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-27 11:01               ` [tip:perf/urgent] perf python scripting: Fixup cut'n'paste error in sctop script tip-bot for Arnaldo Carvalho de Melo
                                 ` (69 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-27 11:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  b44308f54062a4c1dee2602946f481f03739b76d
Gitweb:     http://git.kernel.org/tip/b44308f54062a4c1dee2602946f481f03739b76d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 26 Oct 2010 15:20:09 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Oct 2010 15:20:09 -0200

perf scripting: Shut up 'perf record' final status

We want just the script output, not internal details about the record phase.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt |    4 ++++
 tools/perf/builtin-record.c              |    4 ++++
 tools/perf/builtin-trace.c               |    9 +++++----
 tools/perf/util/debug.c                  |    4 ++--
 tools/perf/util/debug.h                  |    2 +-
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 3ee27dc..a91f9f9 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -83,6 +83,10 @@ OPTIONS
 --call-graph::
 	Do call-graph (stack chain/backtrace) recording.
 
+-q::
+--quiet::
+	Don't print any message, useful for scripting.
+
 -v::
 --verbose::
 	Be more verbose (show counter open errors, etc).
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b530bee..4e75583 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -761,6 +761,9 @@ static int __cmd_record(int argc, const char **argv)
 		}
 	}
 
+	if (quiet)
+		return 0;
+
 	fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
 
 	/*
@@ -820,6 +823,7 @@ static const struct option options[] = {
 		    "do call-graph (stack chain/backtrace) recording"),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
+	OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
 	OPT_BOOLEAN('s', "stat", &inherit_stat,
 		    "per thread counts"),
 	OPT_BOOLEAN('d', "data", &sample_address,
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index deda1a9..2f8df45 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -625,12 +625,13 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
 			dup2(live_pipe[1], 1);
 			close(live_pipe[0]);
 
-			__argv = malloc(5 * sizeof(const char *));
+			__argv = malloc(6 * sizeof(const char *));
 			__argv[0] = "/bin/sh";
 			__argv[1] = record_script_path;
-			__argv[2] = "-o";
-			__argv[3] = "-";
-			__argv[4] = NULL;
+			__argv[2] = "-q";
+			__argv[3] = "-o";
+			__argv[4] = "-";
+			__argv[5] = NULL;
 
 			execvp("/bin/sh", (char **)__argv);
 			exit(-1);
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index f9c7e3a..c8d81b0 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -12,8 +12,8 @@
 #include "debug.h"
 #include "util.h"
 
-int verbose = 0;
-bool dump_trace = false;
+int verbose;
+bool dump_trace = false, quiet = false;
 
 int eprintf(int level, const char *fmt, ...)
 {
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 7a17ee0..7b51408 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -6,7 +6,7 @@
 #include "event.h"
 
 extern int verbose;
-extern bool dump_trace;
+extern bool quiet, dump_trace;
 
 int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
 void trace_event(event_t *event);

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

* [tip:perf/urgent] perf python scripting: Fixup cut'n'paste error in sctop script
       [not found]             ` <new-submission>
                                 ` (636 preceding siblings ...)
  2010-10-27 11:01               ` [tip:perf/urgent] perf scripting: Shut up 'perf record' final status tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-27 11:01               ` tip-bot for Arnaldo Carvalho de Melo
  2010-10-27 11:02               ` [tip:perf/urgent] perf python scripting: Add futex-contention script tip-bot for Arnaldo Carvalho de Melo
                                 ` (68 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-27 11:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  22d0594b31046793dfb58b7ce866d7cb0a9862e5
Gitweb:     http://git.kernel.org/tip/22d0594b31046793dfb58b7ce866d7cb0a9862e5
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 26 Oct 2010 15:21:15 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Oct 2010 15:21:15 -0200

perf python scripting: Fixup cut'n'paste error in sctop script

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/sctop.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 547cbe9..7a6ec2c 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -17,7 +17,7 @@ from perf_trace_context import *
 from Core import *
 from Util import *
 
-usage = "perf trace -s syscall-counts.py [comm] [interval]\n";
+usage = "perf trace -s sctop.py [comm] [interval]\n";
 
 for_comm = None
 default_interval = 3

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

* [tip:perf/urgent] perf python scripting: Add futex-contention script
       [not found]             ` <new-submission>
                                 ` (637 preceding siblings ...)
  2010-10-27 11:01               ` [tip:perf/urgent] perf python scripting: Fixup cut'n'paste error in sctop script tip-bot for Arnaldo Carvalho de Melo
@ 2010-10-27 11:02               ` tip-bot for Arnaldo Carvalho de Melo
  2010-11-21 13:43               ` [tip:perf/core] perf tools: Change my maintainer address tip-bot for Arnaldo Carvalho de Melo
                                 ` (67 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-10-27 11:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	a.p.zijlstra, efault, fweisbec, tglx

Commit-ID:  00204c3396469f407bac56e1475ea16e4a279b13
Gitweb:     http://git.kernel.org/tip/00204c3396469f407bac56e1475ea16e4a279b13
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 26 Oct 2010 17:07:33 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Oct 2010 17:07:33 -0200

perf python scripting: Add futex-contention script

The equivalent to this SystemTAP script:

http://sourceware.org/systemtap/wiki/WSFutexContention

[root@doppio ~]# perf trace futex-contention
Press control+C to stop and show the summary
^Cnpviewer.bin[15242] lock 7f0a8be19104 contended 29 times, 72806 avg ns
npviewer.bin[15242] lock 7f0a8be19130 contended 2 times, 1355 avg ns
synergyc[17245] lock f127f4 contended 1 times, 1830569 avg ns
firefox[15116] lock 7f2b7238af0c contended 168 times, 1230390 avg ns
synergyc[17245] lock f2fc20 contended 1 times, 33149 avg ns
npviewer.bin[15255] lock 7f0a8be19074 contended 155 times, 73047 avg ns
npviewer.bin[15255] lock 7f0a8be190a0 contended 127 times, 7088 avg ns
synergyc[17247] lock f12854 contended 1 times, 46741 avg ns
synergyc[17245] lock f12610 contended 1 times, 7358 avg ns
[root@doppio ~]#

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |   18 +++++++
 .../scripts/python/bin/futex-contention-record     |    2 +
 .../scripts/python/bin/futex-contention-report     |    4 ++
 tools/perf/scripts/python/futex-contention.py      |   50 ++++++++++++++++++++
 4 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
index 99ff1b7..13cc02b 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
@@ -8,6 +8,12 @@
 
 import errno, os
 
+FUTEX_WAIT = 0
+FUTEX_WAKE = 1
+FUTEX_PRIVATE_FLAG = 128
+FUTEX_CLOCK_REALTIME = 256
+FUTEX_CMD_MASK = ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
+
 NSECS_PER_SEC    = 1000000000
 
 def avg(total, n):
@@ -26,6 +32,18 @@ def nsecs_str(nsecs):
     str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
     return str
 
+def add_stats(dict, key, value):
+	if not dict.has_key(key):
+		dict[key] = (value, value, value, 1)
+	else:
+		min, max, avg, count = dict[key]
+		if value < min:
+			min = value
+		if value > max:
+			max = value
+		avg = (avg + value) / 2
+		dict[key] = (min, max, avg, count + 1)
+
 def clear_term():
     print("\x1b[H\x1b[2J")
 
diff --git a/tools/perf/scripts/python/bin/futex-contention-record b/tools/perf/scripts/python/bin/futex-contention-record
new file mode 100644
index 0000000..5ecbb43
--- /dev/null
+++ b/tools/perf/scripts/python/bin/futex-contention-record
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -a -e syscalls:sys_enter_futex -e syscalls:sys_exit_futex $@
diff --git a/tools/perf/scripts/python/bin/futex-contention-report b/tools/perf/scripts/python/bin/futex-contention-report
new file mode 100644
index 0000000..c826813
--- /dev/null
+++ b/tools/perf/scripts/python/bin/futex-contention-report
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: futext contention measurement
+
+perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/futex-contention.py
diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
new file mode 100644
index 0000000..11e70a3
--- /dev/null
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -0,0 +1,50 @@
+# futex contention
+# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
+# Licensed under the terms of the GNU GPL License version 2
+#
+# Translation of:
+#
+# http://sourceware.org/systemtap/wiki/WSFutexContention
+#
+# to perf python scripting.
+#
+# Measures futex contention
+
+import os, sys
+sys.path.append(os.environ['PERF_EXEC_PATH'] + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+from Util import *
+
+process_names = {}
+thread_thislock = {}
+thread_blocktime = {}
+
+lock_waits = {} # long-lived stats on (tid,lock) blockage elapsed time
+process_names = {} # long-lived pid-to-execname mapping
+
+def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm,
+			      nr, uaddr, op, val, utime, uaddr2, val3):
+	cmd = op & FUTEX_CMD_MASK
+	if cmd != FUTEX_WAIT:
+		return # we don't care about originators of WAKE events
+
+	process_names[tid] = comm
+	thread_thislock[tid] = uaddr
+	thread_blocktime[tid] = nsecs(s, ns)
+
+def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm,
+			     nr, ret):
+	if thread_blocktime.has_key(tid):
+		elapsed = nsecs(s, ns) - thread_blocktime[tid]
+		add_stats(lock_waits, (tid, thread_thislock[tid]), elapsed)
+		del thread_blocktime[tid]
+		del thread_thislock[tid]
+
+def trace_begin():
+	print "Press control+C to stop and show the summary"
+
+def trace_end():
+	for (tid, lock) in lock_waits:
+		min, max, avg, count = lock_waits[tid, lock]
+		print "%s[%d] lock %x contended %d times, %d avg ns" % \
+		      (process_names[tid], tid, lock, count, avg)
+

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

* [tip:perf/core] perf tools: Change my maintainer address
       [not found]             ` <new-submission>
                                 ` (638 preceding siblings ...)
  2010-10-27 11:02               ` [tip:perf/urgent] perf python scripting: Add futex-contention script tip-bot for Arnaldo Carvalho de Melo
@ 2010-11-21 13:43               ` tip-bot for Arnaldo Carvalho de Melo
  2010-11-23 10:22               ` [tip:sched/core] sched: Fix UP build breakage tip-bot for Peter Zijlstra
                                 ` (66 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-11-21 13:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, acme, hpa, mingo, tglx

Commit-ID:  4aafd3f71a257a3522932944b5204262dfdff147
Gitweb:     http://git.kernel.org/tip/4aafd3f71a257a3522932944b5204262dfdff147
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 19 Nov 2010 16:46:26 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 19 Nov 2010 16:46:26 -0200

perf tools: Change my maintainer address

Also remove old snail mail address from CREDITS, moved years ago.

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 CREDITS     |    2 --
 MAINTAINERS |    2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/CREDITS b/CREDITS
index 41d8e63..494b6e4 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2365,8 +2365,6 @@ E: acme@redhat.com
 W: http://oops.ghostprotocols.net:81/blog/
 P: 1024D/9224DF01 D5DF E3BB E3C8 BCBB F8AD  841A B6AB 4681 9224 DF01
 D: IPX, LLC, DCCP, cyc2x, wl3501_cs, net/ hacks
-S: R. Brasílio Itiberê, 4270/1010 - Água Verde
-S: 80240-060 - Curitiba - Paraná
 S: Brazil
 
 N: Karsten Merker
diff --git a/MAINTAINERS b/MAINTAINERS
index 8e6548d..f94cd37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4602,7 +4602,7 @@ PERFORMANCE EVENTS SUBSYSTEM
 M:	Peter Zijlstra <a.p.zijlstra@chello.nl>
 M:	Paul Mackerras <paulus@samba.org>
 M:	Ingo Molnar <mingo@elte.hu>
-M:	Arnaldo Carvalho de Melo <acme@redhat.com>
+M:	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 S:	Supported
 F:	kernel/perf_event*.c
 F:	include/linux/perf_event.h

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

* [tip:sched/core] sched: Fix UP build breakage
       [not found]             ` <new-submission>
                                 ` (639 preceding siblings ...)
  2010-11-21 13:43               ` [tip:perf/core] perf tools: Change my maintainer address tip-bot for Arnaldo Carvalho de Melo
@ 2010-11-23 10:22               ` tip-bot for Peter Zijlstra
  2010-11-23 10:22               ` [tip:sched/core] cpu: Remove incorrect BUG_ON tip-bot for Peter Zijlstra
                                 ` (65 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-11-23 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, pjt, tglx, mingo

Commit-ID:  70caf8a6c13c2279b35f2ad6b644815533d6c476
Gitweb:     http://git.kernel.org/tip/70caf8a6c13c2279b35f2ad6b644815533d6c476
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Sat, 20 Nov 2010 00:53:51 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Nov 2010 10:29:07 +0100

sched: Fix UP build breakage

The recent cgroup-scheduling rework caused a UP build problem.

Cc: Paul Turner <pjt@google.com>
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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 390ce30..82fd884 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -562,7 +562,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
 	curr->vruntime += delta_exec_weighted;
 	update_min_vruntime(cfs_rq);
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
+#if defined CONFIG_SMP && defined CONFIG_FAIR_GROUP_SCHED
 	cfs_rq->load_unacc_exec_time += delta_exec;
 	if (cfs_rq->load_unacc_exec_time > sysctl_sched_shares_window) {
 		update_cfs_load(cfs_rq, 0);

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

* [tip:sched/core] cpu: Remove incorrect BUG_ON
       [not found]             ` <new-submission>
                                 ` (640 preceding siblings ...)
  2010-11-23 10:22               ` [tip:sched/core] sched: Fix UP build breakage tip-bot for Peter Zijlstra
@ 2010-11-23 10:22               ` tip-bot for Peter Zijlstra
  2010-11-23 14:39                 ` Oleg Nesterov
  2010-11-23 10:23               ` [tip:sched/core] sched: Add some clock info to sched_debug tip-bot for Peter Zijlstra
                                 ` (64 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-11-23 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, oleg, tglx, mingo

Commit-ID:  51a96c77815e7f139892a6e9c8275a50e9baebdf
Gitweb:     http://git.kernel.org/tip/51a96c77815e7f139892a6e9c8275a50e9baebdf
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Nov 2010 20:37:53 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Nov 2010 10:29:08 +0100

cpu: Remove incorrect BUG_ON

Oleg mentioned that there is no actual guarantee the dying cpu's
migration thread is actually finished running when we get there, so
replace the BUG_ON() with a spinloop waiting for it.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/cpu.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3945066..cb7a1ef 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -249,8 +249,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 	 * The migration_call() CPU_DYING callback will have removed all
 	 * runnable tasks from the cpu, there's only the idle task left now
 	 * that the migration thread is done doing the stop_machine thing.
+	 *
+	 * Wait for the stop thread to go away.
 	 */
-	BUG_ON(!idle_cpu(cpu));
+	while (!idle_cpu(cpu))
+		cpu_relax();
 
 	/* This actually kills the CPU. */
 	__cpu_die(cpu);

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

* [tip:sched/core] sched: Add some clock info to sched_debug
       [not found]             ` <new-submission>
                                 ` (641 preceding siblings ...)
  2010-11-23 10:22               ` [tip:sched/core] cpu: Remove incorrect BUG_ON tip-bot for Peter Zijlstra
@ 2010-11-23 10:23               ` tip-bot for Peter Zijlstra
  2010-11-23 19:51               ` [tip:perf/urgent] perf record: Handle restrictive permissions in /proc/{kallsyms,modules} tip-bot for Arnaldo Carvalho de Melo
                                 ` (63 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-11-23 10:23 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5bb6b1ea67a73f0665a41726dd7138977b992c6c
Gitweb:     http://git.kernel.org/tip/5bb6b1ea67a73f0665a41726dd7138977b992c6c
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 19 Nov 2010 21:11:09 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 23 Nov 2010 10:29:08 +0100

sched: Add some clock info to sched_debug

Add more clock information to /proc/sched_debug, Thomas wanted to see
the sched_clock_stable state.

Requested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched_clock.c |    2 +-
 kernel/sched_debug.c |   31 +++++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 52f1a14..9d8af0b 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -79,7 +79,7 @@ unsigned long long __attribute__((weak)) sched_clock(void)
 }
 EXPORT_SYMBOL_GPL(sched_clock);
 
-static __read_mostly int sched_clock_running;
+__read_mostly int sched_clock_running;
 
 #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
 __read_mostly int sched_clock_stable;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index e6590e7..e95b774 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -250,6 +250,8 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 #undef P
 }
 
+extern __read_mostly int sched_clock_running;
+
 static void print_cpu(struct seq_file *m, int cpu)
 {
 	struct rq *rq = cpu_rq(cpu);
@@ -321,21 +323,42 @@ static const char *sched_tunable_scaling_names[] = {
 
 static int sched_debug_show(struct seq_file *m, void *v)
 {
-	u64 now = ktime_to_ns(ktime_get());
+	u64 ktime, sched_clk, cpu_clk;
+	unsigned long flags;
 	int cpu;
 
-	SEQ_printf(m, "Sched Debug Version: v0.09, %s %.*s\n",
+	local_irq_save(flags);
+	ktime = ktime_to_ns(ktime_get());
+	sched_clk = sched_clock();
+	cpu_clk = local_clock();
+	local_irq_restore(flags);
+
+	SEQ_printf(m, "Sched Debug Version: v0.10, %s %.*s\n",
 		init_utsname()->release,
 		(int)strcspn(init_utsname()->version, " "),
 		init_utsname()->version);
 
-	SEQ_printf(m, "now at %Lu.%06ld msecs\n", SPLIT_NS(now));
+#define P(x) \
+	SEQ_printf(m, "%-40s: %Ld\n", #x, (long long)(x))
+#define PN(x) \
+	SEQ_printf(m, "%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
+	PN(ktime);
+	PN(sched_clk);
+	PN(cpu_clk);
+	P(jiffies);
+#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
+	P(sched_clock_stable);
+#endif
+#undef PN
+#undef P
+
+	SEQ_printf(m, "\n");
+	SEQ_printf(m, "sysctl_sched\n");
 
 #define P(x) \
 	SEQ_printf(m, "  .%-40s: %Ld\n", #x, (long long)(x))
 #define PN(x) \
 	SEQ_printf(m, "  .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
-	P(jiffies);
 	PN(sysctl_sched_latency);
 	PN(sysctl_sched_min_granularity);
 	PN(sysctl_sched_wakeup_granularity);

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

* Re: [tip:sched/core] cpu: Remove incorrect BUG_ON
  2010-11-23 10:22               ` [tip:sched/core] cpu: Remove incorrect BUG_ON tip-bot for Peter Zijlstra
@ 2010-11-23 14:39                 ` Oleg Nesterov
  2010-11-23 15:05                   ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Oleg Nesterov @ 2010-11-23 14:39 UTC (permalink / raw)
  To: tip-bot for Peter Zijlstra
  Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx, mingo

On 11/23, tip-bot for Peter Zijlstra wrote:
>
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -249,8 +249,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
>  	 * The migration_call() CPU_DYING callback will have removed all
>  	 * runnable tasks from the cpu, there's only the idle task left now
>  	 * that the migration thread is done doing the stop_machine thing.
> +	 *
> +	 * Wait for the stop thread to go away.
>  	 */
> -	BUG_ON(!idle_cpu(cpu));
> +	while (!idle_cpu(cpu))
> +		cpu_relax();

Yes... but I still can't understand why should we wait at all.

Peter, I am just curious, help ;)

Oleg.


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

* Re: [tip:sched/core] cpu: Remove incorrect BUG_ON
  2010-11-23 14:39                 ` Oleg Nesterov
@ 2010-11-23 15:05                   ` Peter Zijlstra
  2010-11-23 15:08                     ` Oleg Nesterov
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-11-23 15:05 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx, mingo

On Tue, 2010-11-23 at 15:39 +0100, Oleg Nesterov wrote:
> On 11/23, tip-bot for Peter Zijlstra wrote:
> >
> > --- a/kernel/cpu.c
> > +++ b/kernel/cpu.c
> > @@ -249,8 +249,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
> >  	 * The migration_call() CPU_DYING callback will have removed all
> >  	 * runnable tasks from the cpu, there's only the idle task left now
> >  	 * that the migration thread is done doing the stop_machine thing.
> > +	 *
> > +	 * Wait for the stop thread to go away.
> >  	 */
> > -	BUG_ON(!idle_cpu(cpu));
> > +	while (!idle_cpu(cpu))
> > +		cpu_relax();
> 
> Yes... but I still can't understand why should we wait at all.
> 
> Peter, I am just curious, help ;)

Ah,. uhm,. you mean, not do anything at all?

Dunno, really, let me try and read the code there.



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

* Re: [tip:sched/core] cpu: Remove incorrect BUG_ON
  2010-11-23 15:05                   ` Peter Zijlstra
@ 2010-11-23 15:08                     ` Oleg Nesterov
  2010-11-23 17:16                       ` Peter Zijlstra
  0 siblings, 1 reply; 1150+ messages in thread
From: Oleg Nesterov @ 2010-11-23 15:08 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx, mingo

On 11/23, Peter Zijlstra wrote:
>
> Ah,. uhm,. you mean, not do anything at all?
>
> Dunno, really, let me try and read the code there.

Thanks. This is very minor of course, but it would be nice to
undestand the reason. To me it looks unneeded, but I don't trust
myself.  (snippets from my previous email below).



With or without this change, even if we know that rq->idle is running
we can't know if it (say) already started play_dead_common() or not.

We are going to call __cpu_die(), afaics it should do the necessary
synchronization in any case.

For example, native_cpu_die() waits for cpu_state == CPU_DEAD in a
loop. Of course it should work in practice (it also does msleep),
but in theory there is no guarantee.

So. Can't we just remove this wait-loop? We know that rq->idle
will be scheduled "soon", I don't understand why it is necessary
to ensure that context_switch() has already happened.

Oleg.


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

* Re: [tip:sched/core] cpu: Remove incorrect BUG_ON
  2010-11-23 15:08                     ` Oleg Nesterov
@ 2010-11-23 17:16                       ` Peter Zijlstra
  2010-11-23 17:31                         ` Oleg Nesterov
  0 siblings, 1 reply; 1150+ messages in thread
From: Peter Zijlstra @ 2010-11-23 17:16 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx, mingo

On Tue, 2010-11-23 at 16:08 +0100, Oleg Nesterov wrote:
> > Ah,. uhm,. you mean, not do anything at all?
> >
> > Dunno, really, let me try and read the code there.
> 
> Thanks. This is very minor of course, but it would be nice to
> undestand the reason. To me it looks unneeded, but I don't trust
> myself.  (snippets from my previous email below).
> 
> 
I think because the call to __cpu_die (-> native_cpu_die) relies on the
remote cpu running the idle thread, and the CPU_DEAD notifier callback
wants to run with the guarantee the remote cpu is in fact dead as a
doornail.

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

* Re: [tip:sched/core] cpu: Remove incorrect BUG_ON
  2010-11-23 17:16                       ` Peter Zijlstra
@ 2010-11-23 17:31                         ` Oleg Nesterov
  0 siblings, 0 replies; 1150+ messages in thread
From: Oleg Nesterov @ 2010-11-23 17:31 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, tglx, mingo

On 11/23, Peter Zijlstra wrote:
>
> On Tue, 2010-11-23 at 16:08 +0100, Oleg Nesterov wrote:
> > > Ah,. uhm,. you mean, not do anything at all?
> > >
> > > Dunno, really, let me try and read the code there.
> >
> > Thanks. This is very minor of course, but it would be nice to
> > undestand the reason. To me it looks unneeded, but I don't trust
> > myself.  (snippets from my previous email below).
> >
> I think because the call to __cpu_die (-> native_cpu_die) relies on the
> remote cpu running the idle thread,

How? It can't. By the time __cpu_die() is called, we do not even
know whether context_switch() was finished. All we know is that
rq->curr = idle.

native_cpu_die() correctly waits in a loop until the idle thread
sets CPU_DEAD.

And I think every smp_ops->cpu_die() implementation should synhcronize
with ->cpu_disable(), otherwise it is buggy.

> and the CPU_DEAD notifier callback
> wants to run with the guarantee the remote cpu is in fact dead as a
> doornail.

I think __cpu_die() should ensure it is dead.


OK. This is really minor. Perhaps it is safer to keep this wait just
to preserve the current behaviour.

Oleg.


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

* [tip:perf/urgent] perf record: Handle restrictive permissions in /proc/{kallsyms,modules}
       [not found]             ` <new-submission>
                                 ` (642 preceding siblings ...)
  2010-11-23 10:23               ` [tip:sched/core] sched: Add some clock info to sched_debug tip-bot for Peter Zijlstra
@ 2010-11-23 19:51               ` tip-bot for Arnaldo Carvalho de Melo
  2010-11-26 15:00               ` [tip:perf/core] perf: Fix inherit vs. context rotation bug tip-bot for Thomas Gleixner
                                 ` (62 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-11-23 19:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, acme, mingo, peterz, efault, fweisbec, jj, tglx, hpa,
	paulus, linux-kernel, tzanussi, sarah.a.sharp, eugeneteo, tj,
	meissner, mingo

Commit-ID:  c1a3a4b90a5a47adcca0e587f5d7e9ea61329b26
Gitweb:     http://git.kernel.org/tip/c1a3a4b90a5a47adcca0e587f5d7e9ea61329b26
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 22 Nov 2010 14:01:55 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 22 Nov 2010 14:01:55 -0200

perf record: Handle restrictive permissions in /proc/{kallsyms,modules}

The 59365d1 commit, even being reverted by 33e0d57, showed a non robust
behavior in 'perf record': it really should just warn the user that some
functionality will not be available.

The new behavior then becomes:

	[acme@felicio linux]$ ls -la /proc/{kallsyms,modules}
	-r-------- 1 root root 0 Nov 22 12:19 /proc/kallsyms
	-r-------- 1 root root 0 Nov 22 12:19 /proc/modules
	[acme@felicio linux]$ perf record ls -R > /dev/null
	Couldn't record kernel reference relocation symbol
	Symbol resolution may be skewed if relocation was used (e.g. kexec).
	Check /proc/kallsyms permission or run as root.
	[ perf record: Woken up 1 times to write data ]
	[ perf record: Captured and wrote 0.004 MB perf.data (~161 samples) ]
	[acme@felicio linux]$ perf report --stdio
	[kernel.kallsyms] with build id 77b05e00e64e4de1c9347d83879779b540d69f00 not found, continuing without symbols
	# Events: 98  cycles
	#
	# Overhead  Command    Shared Object                Symbol
	# ........  .......  ...............  ....................
	#
	    48.26%       ls  [kernel]         [k] ffffffff8102b92b
	    22.49%       ls  libc-2.12.90.so  [.] __strlen_sse2
	     8.35%       ls  libc-2.12.90.so  [.] __GI___strcoll_l
	     8.17%       ls  ls               [.]            11580
	     3.35%       ls  libc-2.12.90.so  [.] _IO_new_file_xsputn
	     3.33%       ls  libc-2.12.90.so  [.] _int_malloc
	     1.88%       ls  libc-2.12.90.so  [.] _int_free
	     0.84%       ls  libc-2.12.90.so  [.] malloc_consolidate
	     0.84%       ls  libc-2.12.90.so  [.] __readdir64
	     0.83%       ls  ls               [.] strlen@plt
	     0.83%       ls  libc-2.12.90.so  [.] __GI_fwrite_unlocked
	     0.83%       ls  libc-2.12.90.so  [.] __memcpy_sse2

	#
	# (For a higher level overview, try: perf report --sort comm,dso)
	#
[acme@felicio linux]$

It still has the build-ids for DSOs in the maps with hits:

[acme@felicio linux]$ perf buildid-list
77b05e00e64e4de1c9347d83879779b540d69f00 [kernel.kallsyms]
09c4a431a4a8b648fcfc2c2bdda70f56050ddff1 /bin/ls
af75ea9ad951d25e0f038901a11b3846dccb29a4 /lib64/libc-2.12.90.so
[acme@felicio linux]$

That can be used in another machine to resolve kernel symbols.

Cc: Eugene Teo <eugeneteo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Marcus Meissner <meissner@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 93bd2ff..e2c2de2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -697,17 +697,18 @@ static int __cmd_record(int argc, const char **argv)
 	if (err < 0)
 		err = event__synthesize_kernel_mmap(process_synthesized_event,
 						    session, machine, "_stext");
-	if (err < 0) {
-		pr_err("Couldn't record kernel reference relocation symbol.\n");
-		return err;
-	}
+	if (err < 0)
+		pr_err("Couldn't record kernel reference relocation symbol\n"
+		       "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+		       "Check /proc/kallsyms permission or run as root.\n");
 
 	err = event__synthesize_modules(process_synthesized_event,
 					session, machine);
-	if (err < 0) {
-		pr_err("Couldn't record kernel reference relocation symbol.\n");
-		return err;
-	}
+	if (err < 0)
+		pr_err("Couldn't record kernel module information.\n"
+		       "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+		       "Check /proc/modules permission or run as root.\n");
+
 	if (perf_guest)
 		perf_session__process_machines(session, event__synthesize_guest_os);
 

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

* [tip:perf/core] perf: Fix inherit vs. context rotation bug
       [not found]             ` <new-submission>
                                 ` (643 preceding siblings ...)
  2010-11-23 19:51               ` [tip:perf/urgent] perf record: Handle restrictive permissions in /proc/{kallsyms,modules} tip-bot for Arnaldo Carvalho de Melo
@ 2010-11-26 15:00               ` tip-bot for Thomas Gleixner
  2010-11-28  4:36                 ` Rakib Mullick
  2010-11-26 15:01               ` [tip:perf/core] perf: Fix the software context switch counter tip-bot for Peter Zijlstra
                                 ` (61 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-11-26 15:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, stable, tglx, mingo

Commit-ID:  dddd3379a619a4cb8247bfd3c94ca9ae3797aa2e
Gitweb:     http://git.kernel.org/tip/dddd3379a619a4cb8247bfd3c94ca9ae3797aa2e
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 24 Nov 2010 10:05:55 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Nov 2010 15:00:56 +0100

perf: Fix inherit vs. context rotation bug

It was found that sometimes children of tasks with inherited events had
one extra event. Eventually it turned out to be due to the list rotation
no being exclusive with the list iteration in the inheritance code.

Cure this by temporarily disabling the rotation while we inherit the events.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    1 +
 kernel/perf_event.c        |   22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 40150f3..142e3d6 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -850,6 +850,7 @@ struct perf_event_context {
 	int				nr_active;
 	int				is_active;
 	int				nr_stat;
+	int				rotate_disable;
 	atomic_t			refcount;
 	struct task_struct		*task;
 
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 671f6c8..f365dd8 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1622,8 +1622,12 @@ static void rotate_ctx(struct perf_event_context *ctx)
 {
 	raw_spin_lock(&ctx->lock);
 
-	/* Rotate the first entry last of non-pinned groups */
-	list_rotate_left(&ctx->flexible_groups);
+	/*
+	 * Rotate the first entry last of non-pinned groups. Rotation might be
+	 * disabled by the inheritance code.
+	 */
+	if (!ctx->rotate_disable)
+		list_rotate_left(&ctx->flexible_groups);
 
 	raw_spin_unlock(&ctx->lock);
 }
@@ -6162,6 +6166,7 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 	struct perf_event *event;
 	struct task_struct *parent = current;
 	int inherited_all = 1;
+	unsigned long flags;
 	int ret = 0;
 
 	child->perf_event_ctxp[ctxn] = NULL;
@@ -6202,6 +6207,15 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 			break;
 	}
 
+	/*
+	 * We can't hold ctx->lock when iterating the ->flexible_group list due
+	 * to allocations, but we need to prevent rotation because
+	 * rotate_ctx() will change the list from interrupt context.
+	 */
+	raw_spin_lock_irqsave(&parent_ctx->lock, flags);
+	parent_ctx->rotate_disable = 1;
+	raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
+
 	list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) {
 		ret = inherit_task_group(event, parent, parent_ctx,
 					 child, ctxn, &inherited_all);
@@ -6209,6 +6223,10 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 			break;
 	}
 
+	raw_spin_lock_irqsave(&parent_ctx->lock, flags);
+	parent_ctx->rotate_disable = 0;
+	raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
+
 	child_ctx = child->perf_event_ctxp[ctxn];
 
 	if (child_ctx && inherited_all) {

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

* [tip:perf/core] perf: Fix the software context switch counter
       [not found]             ` <new-submission>
                                 ` (644 preceding siblings ...)
  2010-11-26 15:00               ` [tip:perf/core] perf: Fix inherit vs. context rotation bug tip-bot for Thomas Gleixner
@ 2010-11-26 15:01               ` tip-bot for Peter Zijlstra
  2010-11-26 15:04               ` [tip:perf/core] perf: Ignore non-sampling overflows tip-bot for Peter Zijlstra
                                 ` (60 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-11-26 15:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  ee6dcfa40a50fe12a3ae0fb4d2653c66c3ed6556
Gitweb:     http://git.kernel.org/tip/ee6dcfa40a50fe12a3ae0fb4d2653c66c3ed6556
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 26 Nov 2010 13:49:04 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Nov 2010 15:00:59 +0100

perf: Fix the software context switch counter

Stephane noticed that because the perf_sw_event() call is inside the
perf_event_task_sched_out() call it won't get called unless we
have a per-task counter.

Reported-by: Stephane Eranian <eranian@google.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_event.h |   29 +++++++++++++++--------------
 kernel/perf_event.c        |    2 --
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 142e3d6..de2c417 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -909,20 +909,6 @@ extern int perf_num_counters(void);
 extern const char *perf_pmu_name(void);
 extern void __perf_event_task_sched_in(struct task_struct *task);
 extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
-
-extern atomic_t perf_task_events;
-
-static inline void perf_event_task_sched_in(struct task_struct *task)
-{
-	COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
-}
-
-static inline
-void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
-{
-	COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
-}
-
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
@@ -1031,6 +1017,21 @@ have_event:
 	__perf_sw_event(event_id, nr, nmi, regs, addr);
 }
 
+extern atomic_t perf_task_events;
+
+static inline void perf_event_task_sched_in(struct task_struct *task)
+{
+	COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
+}
+
+static inline
+void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
+{
+	perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
+
+	COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
+}
+
 extern void perf_event_mmap(struct vm_area_struct *vma);
 extern struct perf_guest_info_callbacks *perf_guest_cbs;
 extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f365dd8..eac7e33 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1287,8 +1287,6 @@ void __perf_event_task_sched_out(struct task_struct *task,
 {
 	int ctxn;
 
-	perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
-
 	for_each_task_context_nr(ctxn)
 		perf_event_context_sched_out(task, ctxn, next);
 }

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

* [tip:perf/core] perf: Ignore non-sampling overflows
       [not found]             ` <new-submission>
                                 ` (645 preceding siblings ...)
  2010-11-26 15:01               ` [tip:perf/core] perf: Fix the software context switch counter tip-bot for Peter Zijlstra
@ 2010-11-26 15:04               ` tip-bot for Peter Zijlstra
  2010-11-26 19:20                 ` Francis Moreau
  2010-11-28  8:33               ` [tip:perf/core] perf record: Add option to disable collecting build-ids tip-bot for Arnaldo Carvalho de Melo
                                 ` (59 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-11-26 15:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, francis.moro, a.p.zijlstra, tglx, mingo

Commit-ID:  963988262c3c8f4234f64a0dde59446a295e07bb
Gitweb:     http://git.kernel.org/tip/963988262c3c8f4234f64a0dde59446a295e07bb
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 24 Nov 2010 18:55:29 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Nov 2010 15:14:55 +0100

perf: Ignore non-sampling overflows

Some arch implementations call perf_event_overflow() by 'accident',
ignore this.

Reported-by: Francis Moreau <francis.moro@gmail.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_event.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 98c5549..af1e63f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4240,6 +4240,13 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
 	struct hw_perf_event *hwc = &event->hw;
 	int ret = 0;
 
+	/*
+	 * Non-sampling counters might still use the PMI to fold short
+	 * hardware counters, ignore those.
+	 */
+	if (unlikely(!is_sampling_event(event)))
+		return 0;
+
 	if (!throttle) {
 		hwc->interrupts++;
 	} else {

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

* Re: [tip:perf/core] perf: Ignore non-sampling overflows
  2010-11-26 15:04               ` [tip:perf/core] perf: Ignore non-sampling overflows tip-bot for Peter Zijlstra
@ 2010-11-26 19:20                 ` Francis Moreau
  0 siblings, 0 replies; 1150+ messages in thread
From: Francis Moreau @ 2010-11-26 19:20 UTC (permalink / raw)
  To: mingo; +Cc: hpa, linux-kernel, a.p.zijlstra, tglx, mingo, linux-tip-commits

Peter,

tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl> writes:
>
> perf: Ignore non-sampling overflows
>
> Some arch implementations call perf_event_overflow() by 'accident',
> ignore this.
>
> Reported-by: Francis Moreau <francis.moro@gmail.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_event.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 98c5549..af1e63f 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -4240,6 +4240,13 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
>  	struct hw_perf_event *hwc = &event->hw;
>  	int ret = 0;
>  
> +	/*
> +	 * Non-sampling counters might still use the PMI to fold short
> +	 * hardware counters, ignore those.
> +	 */
> +	if (unlikely(!is_sampling_event(event)))
> +		return 0;
> +
>  	if (!throttle) {
>  		hwc->interrupts++;
>  	} else {

Couldn't we place this in perf_event_overflow() instead, like the
following ?

--8<---------------cut here---------------start------------->8---

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index df27fd8..1dabb54 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4267,7 +4267,9 @@ int perf_event_overflow(struct perf_event *event,
int nmi,
                  struct perf_sample_data *data,
                                            struct pt_regs *regs)
 {
-       return __perf_event_overflow(event, nmi, 1, data, regs);
+       if (is_sampling_event(event))
+          return __perf_event_overflow(event, nmi, 1, data, regs);
+          return 0;
 }
 
 /*

--8<---------------cut here---------------end--------------->8---

thanks,
-- 
Francis

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

* Re: [tip:perf/core] perf: Fix inherit vs. context rotation bug
  2010-11-26 15:00               ` [tip:perf/core] perf: Fix inherit vs. context rotation bug tip-bot for Thomas Gleixner
@ 2010-11-28  4:36                 ` Rakib Mullick
  0 siblings, 0 replies; 1150+ messages in thread
From: Rakib Mullick @ 2010-11-28  4:36 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, a.p.zijlstra, stable, tglx, mingo
  Cc: linux-tip-commits

On Fri, Nov 26, 2010 at 9:00 PM, tip-bot for Thomas Gleixner
<tglx@linutronix.de> wrote:
> Commit-ID:  dddd3379a619a4cb8247bfd3c94ca9ae3797aa2e
> Gitweb:     http://git.kernel.org/tip/dddd3379a619a4cb8247bfd3c94ca9ae3797aa2e
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Wed, 24 Nov 2010 10:05:55 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 26 Nov 2010 15:00:56 +0100
>
> perf: Fix inherit vs. context rotation bug
>
> It was found that sometimes children of tasks with inherited events had
> one extra event. Eventually it turned out to be due to the list rotation
> no being exclusive with the list iteration in the inheritance code.
>
> Cure this by temporarily disabling the rotation while we inherit the events.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> LKML-Reference: <new-submission>
> Cc: <stable@kernel.org>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  include/linux/perf_event.h |    1 +
>  kernel/perf_event.c        |   22 ++++++++++++++++++++--
>  2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 40150f3..142e3d6 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -850,6 +850,7 @@ struct perf_event_context {
>        int                             nr_active;
>        int                             is_active;
>        int                             nr_stat;
> +       int                             rotate_disable;

Isn't it convincing to use atomic_t instead of int as rotate_disable
type. Since, we just have to increment or decrement it  inside
raw_spin_lock_irqsave(), we could've easily do it using
atomic_inc/atomic_dec and atomic_read while calling
list_rotate_left(). It will allow us to remove raw_spin_lock_irqsave()
at increment/decrement. Am I missing anyting?

thanks,
rakib

>        atomic_t                        refcount;
>        struct task_struct              *task;
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 671f6c8..f365dd8 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -1622,8 +1622,12 @@ static void rotate_ctx(struct perf_event_context *ctx)
>  {
>        raw_spin_lock(&ctx->lock);
>
> -       /* Rotate the first entry last of non-pinned groups */
> -       list_rotate_left(&ctx->flexible_groups);
> +       /*
> +        * Rotate the first entry last of non-pinned groups. Rotation might be
> +        * disabled by the inheritance code.
> +        */
> +       if (!ctx->rotate_disable)
> +               list_rotate_left(&ctx->flexible_groups);
>
>        raw_spin_unlock(&ctx->lock);
>  }
> @@ -6162,6 +6166,7 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
>        struct perf_event *event;
>        struct task_struct *parent = current;
>        int inherited_all = 1;
> +       unsigned long flags;
>        int ret = 0;
>
>        child->perf_event_ctxp[ctxn] = NULL;
> @@ -6202,6 +6207,15 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
>                        break;
>        }
>
> +       /*
> +        * We can't hold ctx->lock when iterating the ->flexible_group list due
> +        * to allocations, but we need to prevent rotation because
> +        * rotate_ctx() will change the list from interrupt context.
> +        */
> +       raw_spin_lock_irqsave(&parent_ctx->lock, flags);
> +       parent_ctx->rotate_disable = 1;
> +       raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
> +
>        list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) {
>                ret = inherit_task_group(event, parent, parent_ctx,
>                                         child, ctxn, &inherited_all);
> @@ -6209,6 +6223,10 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
>                        break;
>        }
>
> +       raw_spin_lock_irqsave(&parent_ctx->lock, flags);
> +       parent_ctx->rotate_disable = 0;
> +       raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
> +
>        child_ctx = child->perf_event_ctxp[ctxn];
>
>        if (child_ctx && inherited_all) {
> --
> 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] 1150+ messages in thread

* [tip:perf/core] perf record: Add option to disable collecting build-ids
       [not found]             ` <new-submission>
                                 ` (646 preceding siblings ...)
  2010-11-26 15:04               ` [tip:perf/core] perf: Ignore non-sampling overflows tip-bot for Peter Zijlstra
@ 2010-11-28  8:33               ` tip-bot for Arnaldo Carvalho de Melo
  2010-11-29 10:22                 ` Stephane Eranian
  2010-11-28  8:34               ` [tip:perf/core] perf events: Default to using event__process_lost tip-bot for Arnaldo Carvalho de Melo
                                 ` (58 subsequent siblings)
  706 siblings, 1 reply; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-11-28  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	a.p.zijlstra, efault, fweisbec, tglx

Commit-ID:  baa2f6cedbfae962f04281a31f08ec29667d31a0
Gitweb:     http://git.kernel.org/tip/baa2f6cedbfae962f04281a31f08ec29667d31a0
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 26 Nov 2010 19:39:15 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Nov 2010 19:39:15 -0200

perf record: Add option to disable collecting build-ids

Collecting build-ids for long running sessions may take a long time
because it needs to traverse the whole just collected perf.data stream
of events, marking the DSOs that had hits and then looking for the
.note.gnu.build-id ELF section.

For things like the 'trace' tool that records and right away consumes
the data on systems where its unlikely that the DSOs being monitored
will change while 'trace' runs, it is desirable to remove build id
collection, so add a -B/--no-buildid option to perf record to allow such
use case.

Longer term we'll avoid all this if we, at DSO load time, in the kernel,
take advantage of this slow code path to collect the build-id and stash
it somewhere, so that we can insert it in the PERF_RECORD_MMAP event.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c            |   14 +++++++++++---
 tools/perf/util/header.c               |   11 +++++++++--
 tools/perf/util/header.h               |    1 +
 tools/perf/util/include/linux/bitops.h |    5 +++++
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3d2cb48..024e144 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -61,6 +61,7 @@ static bool			inherit_stat			=  false;
 static bool			no_samples			=  false;
 static bool			sample_address			=  false;
 static bool			no_buildid			=  false;
+static bool			no_buildid_cache		=  false;
 
 static long			samples				=      0;
 static u64			bytes_written			=      0;
@@ -437,7 +438,8 @@ static void atexit_header(void)
 	if (!pipe_output) {
 		session->header.data_size += bytes_written;
 
-		process_buildids();
+		if (!no_buildid)
+			process_buildids();
 		perf_header__write(&session->header, output, true);
 		perf_session__delete(session);
 		symbol__exit();
@@ -557,6 +559,9 @@ static int __cmd_record(int argc, const char **argv)
 		return -1;
 	}
 
+	if (!no_buildid)
+		perf_header__set_feat(&session->header, HEADER_BUILD_ID);
+
 	if (!file_new) {
 		err = perf_header__read(session, output);
 		if (err < 0)
@@ -831,8 +836,10 @@ const struct option record_options[] = {
 		    "Sample addresses"),
 	OPT_BOOLEAN('n', "no-samples", &no_samples,
 		    "don't sample"),
-	OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid,
+	OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid_cache,
 		    "do not update the buildid cache"),
+	OPT_BOOLEAN('B', "no-buildid", &no_buildid,
+		    "do not collect buildids in perf.data"),
 	OPT_END()
 };
 
@@ -857,7 +864,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	}
 
 	symbol__init();
-	if (no_buildid)
+
+	if (no_buildid_cache || no_buildid)
 		disable_buildid_cache();
 
 	if (!nr_counters) {
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d7e67b1..f65d7dc 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -152,6 +152,11 @@ void perf_header__set_feat(struct perf_header *self, int feat)
 	set_bit(feat, self->adds_features);
 }
 
+void perf_header__clear_feat(struct perf_header *self, int feat)
+{
+	clear_bit(feat, self->adds_features);
+}
+
 bool perf_header__has_feat(const struct perf_header *self, int feat)
 {
 	return test_bit(feat, self->adds_features);
@@ -431,8 +436,10 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
 	int idx = 0, err;
 
 	session = container_of(self, struct perf_session, header);
-	if (perf_session__read_build_ids(session, true))
-		perf_header__set_feat(self, HEADER_BUILD_ID);
+
+	if (perf_header__has_feat(self, HEADER_BUILD_ID &&
+	    !perf_session__read_build_ids(session, true)))
+		perf_header__clear_feat(self, HEADER_BUILD_ID);
 
 	nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
 	if (!nr_sections)
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 402ac24..ed550bf 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -84,6 +84,7 @@ u64 perf_header__sample_type(struct perf_header *header);
 struct perf_event_attr *
 perf_header__find_attr(u64 id, struct perf_header *header);
 void perf_header__set_feat(struct perf_header *self, int feat);
+void perf_header__clear_feat(struct perf_header *self, int feat);
 bool perf_header__has_feat(const struct perf_header *self, int feat);
 
 int perf_header__process_sections(struct perf_header *self, int fd,
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
index bb4ac2e..8be0b96 100644
--- a/tools/perf/util/include/linux/bitops.h
+++ b/tools/perf/util/include/linux/bitops.h
@@ -13,6 +13,11 @@ static inline void set_bit(int nr, unsigned long *addr)
 	addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
 }
 
+static inline void clear_bit(int nr, unsigned long *addr)
+{
+	addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
+}
+
 static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
 {
 	return ((1UL << (nr % BITS_PER_LONG)) &

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

* [tip:perf/core] perf events: Default to using event__process_lost
       [not found]             ` <new-submission>
                                 ` (647 preceding siblings ...)
  2010-11-28  8:33               ` [tip:perf/core] perf record: Add option to disable collecting build-ids tip-bot for Arnaldo Carvalho de Melo
@ 2010-11-28  8:34               ` tip-bot for Arnaldo Carvalho de Melo
  2010-12-07  7:06               ` [tip:perf/urgent] perf record: Fix eternal wait for stillborn child tip-bot for Arnaldo Carvalho de Melo
                                 ` (57 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-11-28  8:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	a.p.zijlstra, efault, fweisbec, tglx

Commit-ID:  37982ba0a0630066a6a0844a66aedaf91c66db84
Gitweb:     http://git.kernel.org/tip/37982ba0a0630066a6a0844a66aedaf91c66db84
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 26 Nov 2010 18:31:54 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Nov 2010 19:39:47 -0200

perf events: Default to using event__process_lost

Tool developers have to fill in a 'perf_event_ops' method table to
specify how to handle each event, so far the ones that were not
explicitely especified would get a stub that would just discard the
event.

Change that so that tool developers can get the lost event details and
the total number of such events at the end of 'perf report -D' output.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index fa9d652..3d56047 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -262,7 +262,7 @@ static void perf_event_ops__fill_defaults(struct perf_event_ops *handler)
 	if (handler->exit == NULL)
 		handler->exit = process_event_stub;
 	if (handler->lost == NULL)
-		handler->lost = process_event_stub;
+		handler->lost = event__process_lost;
 	if (handler->read == NULL)
 		handler->read = process_event_stub;
 	if (handler->throttle == NULL)

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

* Re: [tip:perf/core] perf record: Add option to disable collecting build-ids
  2010-11-28  8:33               ` [tip:perf/core] perf record: Add option to disable collecting build-ids tip-bot for Arnaldo Carvalho de Melo
@ 2010-11-29 10:22                 ` Stephane Eranian
  2010-11-29 15:14                   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 1150+ messages in thread
From: Stephane Eranian @ 2010-11-29 10:22 UTC (permalink / raw)
  To: acme
  Cc: mingo, hpa, paulus, eranian, linux-kernel, tzanussi,
	a.p.zijlstra, efault, fweisbec, tglx

Arnaldo,

Indeed, collecting buildids at the end of a perf record session
is a very time AND memory consuming phase. I have seen
system oom because of this when running inside cgroup with
low memory.

This is easy to reproduce running: perf record -a -- ./Run shell.
With this, you see perf record reaching a RSS first plateau during
the active collection of the samples, i.e., dumping the kernel
buffer on disk. But then, when it calls process_buildids(), it shoots
way up in memory consumption. For instance, I have seen a
perf record running at 10MB RSS shooting all the way to 250MB
RSS during that phase. At first, I thought there was a memory
leak somewhere. But after instrumenting for a while, nothing
really showed up.

I think the problem for RSS is not so much reloading the entire
buffer, but rather that you are recreating the entire addresses spaces
of all processes captured. The reason: you only want to save the
buildids of the DSO for which you had at least one sample. Thus,
you have to allocate/de-allocate tons of threads and map structures.
I wonder if simply looking for MMAP samples and storing the buildids
(even if they have no samples) wouldn't be more efficient in some
cases. I believe it would be faster and less memory greedy.


On Sun, Nov 28, 2010 at 9:33 AM, tip-bot for Arnaldo Carvalho de Melo
<acme@redhat.com> wrote:
> Commit-ID:  baa2f6cedbfae962f04281a31f08ec29667d31a0
> Gitweb:     http://git.kernel.org/tip/baa2f6cedbfae962f04281a31f08ec29667d31a0
> Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
> AuthorDate: Fri, 26 Nov 2010 19:39:15 -0200
> Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
> CommitDate: Fri, 26 Nov 2010 19:39:15 -0200
>
> perf record: Add option to disable collecting build-ids
>
> Collecting build-ids for long running sessions may take a long time
> because it needs to traverse the whole just collected perf.data stream
> of events, marking the DSOs that had hits and then looking for the
> .note.gnu.build-id ELF section.
>
> For things like the 'trace' tool that records and right away consumes
> the data on systems where its unlikely that the DSOs being monitored
> will change while 'trace' runs, it is desirable to remove build id
> collection, so add a -B/--no-buildid option to perf record to allow such
> use case.
>
> Longer term we'll avoid all this if we, at DSO load time, in the kernel,
> take advantage of this slow code path to collect the build-id and stash
> it somewhere, so that we can insert it in the PERF_RECORD_MMAP event.
>
> Reported-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Tom Zanussi <tzanussi@gmail.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/builtin-record.c            |   14 +++++++++++---
>  tools/perf/util/header.c               |   11 +++++++++--
>  tools/perf/util/header.h               |    1 +
>  tools/perf/util/include/linux/bitops.h |    5 +++++
>  4 files changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 3d2cb48..024e144 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -61,6 +61,7 @@ static bool                   inherit_stat                    =  false;
>  static bool                    no_samples                      =  false;
>  static bool                    sample_address                  =  false;
>  static bool                    no_buildid                      =  false;
> +static bool                    no_buildid_cache                =  false;
>
>  static long                    samples                         =      0;
>  static u64                     bytes_written                   =      0;
> @@ -437,7 +438,8 @@ static void atexit_header(void)
>        if (!pipe_output) {
>                session->header.data_size += bytes_written;
>
> -               process_buildids();
> +               if (!no_buildid)
> +                       process_buildids();
>                perf_header__write(&session->header, output, true);
>                perf_session__delete(session);
>                symbol__exit();
> @@ -557,6 +559,9 @@ static int __cmd_record(int argc, const char **argv)
>                return -1;
>        }
>
> +       if (!no_buildid)
> +               perf_header__set_feat(&session->header, HEADER_BUILD_ID);
> +
>        if (!file_new) {
>                err = perf_header__read(session, output);
>                if (err < 0)
> @@ -831,8 +836,10 @@ const struct option record_options[] = {
>                    "Sample addresses"),
>        OPT_BOOLEAN('n', "no-samples", &no_samples,
>                    "don't sample"),
> -       OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid,
> +       OPT_BOOLEAN('N', "no-buildid-cache", &no_buildid_cache,
>                    "do not update the buildid cache"),
> +       OPT_BOOLEAN('B', "no-buildid", &no_buildid,
> +                   "do not collect buildids in perf.data"),
>        OPT_END()
>  };
>
> @@ -857,7 +864,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
>        }
>
>        symbol__init();
> -       if (no_buildid)
> +
> +       if (no_buildid_cache || no_buildid)
>                disable_buildid_cache();
>
>        if (!nr_counters) {
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index d7e67b1..f65d7dc 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -152,6 +152,11 @@ void perf_header__set_feat(struct perf_header *self, int feat)
>        set_bit(feat, self->adds_features);
>  }
>
> +void perf_header__clear_feat(struct perf_header *self, int feat)
> +{
> +       clear_bit(feat, self->adds_features);
> +}
> +
>  bool perf_header__has_feat(const struct perf_header *self, int feat)
>  {
>        return test_bit(feat, self->adds_features);
> @@ -431,8 +436,10 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
>        int idx = 0, err;
>
>        session = container_of(self, struct perf_session, header);
> -       if (perf_session__read_build_ids(session, true))
> -               perf_header__set_feat(self, HEADER_BUILD_ID);
> +
> +       if (perf_header__has_feat(self, HEADER_BUILD_ID &&
> +           !perf_session__read_build_ids(session, true)))
> +               perf_header__clear_feat(self, HEADER_BUILD_ID);
>
>        nr_sections = bitmap_weight(self->adds_features, HEADER_FEAT_BITS);
>        if (!nr_sections)
> diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
> index 402ac24..ed550bf 100644
> --- a/tools/perf/util/header.h
> +++ b/tools/perf/util/header.h
> @@ -84,6 +84,7 @@ u64 perf_header__sample_type(struct perf_header *header);
>  struct perf_event_attr *
>  perf_header__find_attr(u64 id, struct perf_header *header);
>  void perf_header__set_feat(struct perf_header *self, int feat);
> +void perf_header__clear_feat(struct perf_header *self, int feat);
>  bool perf_header__has_feat(const struct perf_header *self, int feat);
>
>  int perf_header__process_sections(struct perf_header *self, int fd,
> diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
> index bb4ac2e..8be0b96 100644
> --- a/tools/perf/util/include/linux/bitops.h
> +++ b/tools/perf/util/include/linux/bitops.h
> @@ -13,6 +13,11 @@ static inline void set_bit(int nr, unsigned long *addr)
>        addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
>  }
>
> +static inline void clear_bit(int nr, unsigned long *addr)
> +{
> +       addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
> +}
> +
>  static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
>  {
>        return ((1UL << (nr % BITS_PER_LONG)) &
>

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

* Re: [tip:perf/core] perf record: Add option to disable collecting build-ids
  2010-11-29 10:22                 ` Stephane Eranian
@ 2010-11-29 15:14                   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 1150+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-11-29 15:14 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: mingo, hpa, paulus, linux-kernel, tzanussi, a.p.zijlstra, efault,
	fweisbec, tglx

Em Mon, Nov 29, 2010 at 11:22:50AM +0100, Stephane Eranian escreveu:
> Arnaldo,
 
> Indeed, collecting buildids at the end of a perf record session is a
> very time AND memory consuming phase. I have seen system oom because
> of this when running inside cgroup with low memory.
 
> This is easy to reproduce running: perf record -a -- ./Run shell.
> With this, you see perf record reaching a RSS first plateau during the
> active collection of the samples, i.e., dumping the kernel buffer on
> disk. But then, when it calls process_buildids(), it shoots way up in
> memory consumption. For instance, I have seen a perf record running at
> 10MB RSS shooting all the way to 250MB RSS during that phase. At
> first, I thought there was a memory leak somewhere. But after
> instrumenting for a while, nothing really showed up.
 
> I think the problem for RSS is not so much reloading the entire
> buffer, but rather that you are recreating the entire addresses spaces
> of all processes captured. The reason: you only want to save the
> buildids of the DSO for which you had at least one sample. Thus, you
> have to allocate/de-allocate tons of threads and map structures.  I
> wonder if simply looking for MMAP samples and storing the buildids
> (even if they have no samples) wouldn't be more efficient in some
> cases. I believe it would be faster and less memory greedy.

Indeed, probably it is better to do that and only when doing a 'perf
archive' to try to compact the resulting perf.data.tar.bz2 file by
picking just the ones with hits.

I'll look into that, possibly today.

- Arnaldo

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

* [tip:perf/urgent] perf record: Fix eternal wait for stillborn child
       [not found]             ` <new-submission>
                                 ` (648 preceding siblings ...)
  2010-11-28  8:34               ` [tip:perf/core] perf events: Default to using event__process_lost tip-bot for Arnaldo Carvalho de Melo
@ 2010-12-07  7:06               ` tip-bot for Arnaldo Carvalho de Melo
  2010-12-08 20:39               ` [tip:perf/urgent] perf: Fix duplicate events with multiple-pmu vs software events tip-bot for Peter Zijlstra
                                 ` (56 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-12-07  7:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  18483b81ee7e70ee68d4b18be618be5cfcc0b290
Gitweb:     http://git.kernel.org/tip/18483b81ee7e70ee68d4b18be618be5cfcc0b290
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 6 Dec 2010 15:13:38 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 6 Dec 2010 15:13:38 -0200

perf record: Fix eternal wait for stillborn child

When execvp fails to find the specified command on the path we won't get
SIGCHLD, so send a SIGUSR1 and exit right away.

Current situation would require a SIGINT performed by the user and would
produce meaningless summary.

Now:

[acme@emilia linux]$ ./foo
-bash: ./foo: No such file or directory
[acme@emilia linux]$ perf record ./foo
./foo: No such file or directory
[acme@emilia linux]$

Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e2c2de2..564491f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -197,7 +197,7 @@ static void sig_atexit(void)
 	if (child_pid > 0)
 		kill(child_pid, SIGTERM);
 
-	if (signr == -1)
+	if (signr == -1 || signr == SIGUSR1)
 		return;
 
 	signal(signr, SIG_DFL);
@@ -515,6 +515,7 @@ static int __cmd_record(int argc, const char **argv)
 	atexit(sig_atexit);
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
+	signal(SIGUSR1, sig_handler);
 
 	if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
 		perror("failed to create pipes");
@@ -606,6 +607,7 @@ static int __cmd_record(int argc, const char **argv)
 			execvp(argv[0], (char **)argv);
 
 			perror(argv[0]);
+			kill(getppid(), SIGUSR1);
 			exit(-1);
 		}
 
@@ -762,7 +764,7 @@ static int __cmd_record(int argc, const char **argv)
 		}
 	}
 
-	if (quiet)
+	if (quiet || signr == SIGUSR1)
 		return 0;
 
 	fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);

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

* [tip:perf/urgent] perf: Fix duplicate events with multiple-pmu vs software events
       [not found]             ` <new-submission>
                                 ` (649 preceding siblings ...)
  2010-12-07  7:06               ` [tip:perf/urgent] perf record: Fix eternal wait for stillborn child tip-bot for Arnaldo Carvalho de Melo
@ 2010-12-08 20:39               ` tip-bot for Peter Zijlstra
  2010-12-08 20:42               ` [tip:perf/core] perf, amd: Remove the nb lock tip-bot for Peter Zijlstra
                                 ` (55 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-12-08 20:39 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  5167695753c63444a9e6cbbef136200a16c7a225
Gitweb:     http://git.kernel.org/tip/5167695753c63444a9e6cbbef136200a16c7a225
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 7 Dec 2010 14:18:20 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 8 Dec 2010 20:14:08 +0100

perf: Fix duplicate events with multiple-pmu vs software events

Because the multi-pmu bits can share contexts between struct pmu
instances we could get duplicate events by iterating the pmu list.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/perf_event.h |    1 +
 kernel/perf_event.c        |   35 +++++++++++++++++++++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index de2c417..4f1279e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -887,6 +887,7 @@ struct perf_cpu_context {
 	int				exclusive;
 	struct list_head		rotation_list;
 	int				jiffies_interval;
+	struct pmu			*active_pmu;
 };
 
 struct perf_output_handle {
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index eac7e33..7b87017 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3824,6 +3824,8 @@ static void perf_event_task_event(struct perf_task_event *task_event)
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
+		if (cpuctx->active_pmu != pmu)
+			goto next;
 		perf_event_task_ctx(&cpuctx->ctx, task_event);
 
 		ctx = task_event->task_ctx;
@@ -3959,6 +3961,8 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
+		if (cpuctx->active_pmu != pmu)
+			goto next;
 		perf_event_comm_ctx(&cpuctx->ctx, comm_event);
 
 		ctxn = pmu->task_ctx_nr;
@@ -4144,6 +4148,8 @@ got_name:
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
+		if (cpuctx->active_pmu != pmu)
+			goto next;
 		perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
 					vma->vm_flags & VM_EXEC);
 
@@ -5145,20 +5151,36 @@ static void *find_pmu_context(int ctxn)
 	return NULL;
 }
 
-static void free_pmu_context(void * __percpu cpu_context)
+static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu)
 {
-	struct pmu *pmu;
+	int cpu;
+
+	for_each_possible_cpu(cpu) {
+		struct perf_cpu_context *cpuctx;
+
+		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
+
+		if (cpuctx->active_pmu == old_pmu)
+			cpuctx->active_pmu = pmu;
+	}
+}
+
+static void free_pmu_context(struct pmu *pmu)
+{
+	struct pmu *i;
 
 	mutex_lock(&pmus_lock);
 	/*
 	 * Like a real lame refcount.
 	 */
-	list_for_each_entry(pmu, &pmus, entry) {
-		if (pmu->pmu_cpu_context == cpu_context)
+	list_for_each_entry(i, &pmus, entry) {
+		if (i->pmu_cpu_context == pmu->pmu_cpu_context) {
+			update_pmu_context(i, pmu);
 			goto out;
+		}
 	}
 
-	free_percpu(cpu_context);
+	free_percpu(pmu->pmu_cpu_context);
 out:
 	mutex_unlock(&pmus_lock);
 }
@@ -5190,6 +5212,7 @@ int perf_pmu_register(struct pmu *pmu)
 		cpuctx->ctx.pmu = pmu;
 		cpuctx->jiffies_interval = 1;
 		INIT_LIST_HEAD(&cpuctx->rotation_list);
+		cpuctx->active_pmu = pmu;
 	}
 
 got_cpu_context:
@@ -5241,7 +5264,7 @@ void perf_pmu_unregister(struct pmu *pmu)
 	synchronize_rcu();
 
 	free_percpu(pmu->pmu_disable_count);
-	free_pmu_context(pmu->pmu_cpu_context);
+	free_pmu_context(pmu);
 }
 
 struct pmu *perf_init_event(struct perf_event *event)

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

* [tip:perf/core] perf, amd: Remove the nb lock
       [not found]             ` <new-submission>
                                 ` (650 preceding siblings ...)
  2010-12-08 20:39               ` [tip:perf/urgent] perf: Fix duplicate events with multiple-pmu vs software events tip-bot for Peter Zijlstra
@ 2010-12-08 20:42               ` tip-bot for Peter Zijlstra
  2010-12-08 20:42               ` [tip:perf/core] perf: Stop all counters on reboot tip-bot for Peter Zijlstra
                                 ` (54 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-12-08 20:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  c079c791c5a0627fc7b752d31d72e274e0596ba8
Gitweb:     http://git.kernel.org/tip/c079c791c5a0627fc7b752d31d72e274e0596ba8
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 25 Nov 2010 08:56:17 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 8 Dec 2010 20:16:30 +0100

perf, amd: Remove the nb lock

Since all the hotplug stuff is serialized by the hotplug mutex,
do away with the amd_nb_lock.

Cc: Stephane Eranian <eranian@google.com>
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_event_amd.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index e421b8c..67e2202 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,7 +1,5 @@
 #ifdef CONFIG_CPU_SUP_AMD
 
-static DEFINE_RAW_SPINLOCK(amd_nb_lock);
-
 static __initconst const u64 amd_hw_cache_event_ids
 				[PERF_COUNT_HW_CACHE_MAX]
 				[PERF_COUNT_HW_CACHE_OP_MAX]
@@ -275,7 +273,7 @@ done:
 	return &emptyconstraint;
 }
 
-static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
+static struct amd_nb *amd_alloc_nb(int cpu)
 {
 	struct amd_nb *nb;
 	int i;
@@ -285,7 +283,7 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
 	if (!nb)
 		return NULL;
 
-	nb->nb_id = nb_id;
+	nb->nb_id = -1;
 
 	/*
 	 * initialize all possible NB constraints
@@ -306,7 +304,7 @@ static int amd_pmu_cpu_prepare(int cpu)
 	if (boot_cpu_data.x86_max_cores < 2)
 		return NOTIFY_OK;
 
-	cpuc->amd_nb = amd_alloc_nb(cpu, -1);
+	cpuc->amd_nb = amd_alloc_nb(cpu);
 	if (!cpuc->amd_nb)
 		return NOTIFY_BAD;
 
@@ -325,8 +323,6 @@ static void amd_pmu_cpu_starting(int cpu)
 	nb_id = amd_get_nb_id(cpu);
 	WARN_ON_ONCE(nb_id == BAD_APICID);
 
-	raw_spin_lock(&amd_nb_lock);
-
 	for_each_online_cpu(i) {
 		nb = per_cpu(cpu_hw_events, i).amd_nb;
 		if (WARN_ON_ONCE(!nb))
@@ -341,8 +337,6 @@ static void amd_pmu_cpu_starting(int cpu)
 
 	cpuc->amd_nb->nb_id = nb_id;
 	cpuc->amd_nb->refcnt++;
-
-	raw_spin_unlock(&amd_nb_lock);
 }
 
 static void amd_pmu_cpu_dead(int cpu)
@@ -354,8 +348,6 @@ static void amd_pmu_cpu_dead(int cpu)
 
 	cpuhw = &per_cpu(cpu_hw_events, cpu);
 
-	raw_spin_lock(&amd_nb_lock);
-
 	if (cpuhw->amd_nb) {
 		struct amd_nb *nb = cpuhw->amd_nb;
 
@@ -364,8 +356,6 @@ static void amd_pmu_cpu_dead(int cpu)
 
 		cpuhw->amd_nb = NULL;
 	}
-
-	raw_spin_unlock(&amd_nb_lock);
 }
 
 static __initconst const struct x86_pmu amd_pmu = {

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

* [tip:perf/core] perf: Stop all counters on reboot
       [not found]             ` <new-submission>
                                 ` (651 preceding siblings ...)
  2010-12-08 20:42               ` [tip:perf/core] perf, amd: Remove the nb lock tip-bot for Peter Zijlstra
@ 2010-12-08 20:42               ` tip-bot for Peter Zijlstra
  2010-12-09 23:39               ` [tip:perf/core] perf session: Remove unneeded dump_printf calls tip-bot for Arnaldo Carvalho de Melo
                                 ` (53 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-12-08 20:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, jason.wessel, a.p.zijlstra,
	vgoyal, ebiederm, tglx, mingo, dzickus

Commit-ID:  c277443cfc29b1623b4923219ff0bdb48b91b589
Gitweb:     http://git.kernel.org/tip/c277443cfc29b1623b4923219ff0bdb48b91b589
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 8 Dec 2010 15:29:02 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 8 Dec 2010 20:16:31 +0100

perf: Stop all counters on reboot

Use the reboot notifier to detach all running counters on reboot, this
solves a problem with kexec where the new kernel doesn't expect
running counters (rightly so).

It will however decrease the coverage of the NMI watchdog. Making a
kexec specific reboot notifier callback would be best, however that
would require touching all notifier callback handlers as they are not
properly structured to deal with new state.

As a compromise, place the perf reboot notifier at the very last
position in the list.

Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Don Zickus <dzickus@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 77ad22c..f9d2645 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -21,6 +21,7 @@
 #include <linux/dcache.h>
 #include <linux/percpu.h>
 #include <linux/ptrace.h>
+#include <linux/reboot.h>
 #include <linux/vmstat.h>
 #include <linux/vmalloc.h>
 #include <linux/hardirq.h>
@@ -6429,7 +6430,7 @@ static void __cpuinit perf_event_init_cpu(int cpu)
 	mutex_unlock(&swhash->hlist_mutex);
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
+#if defined CONFIG_HOTPLUG_CPU || defined CONFIG_KEXEC
 static void perf_pmu_rotate_stop(struct pmu *pmu)
 {
 	struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
@@ -6483,6 +6484,26 @@ static void perf_event_exit_cpu(int cpu)
 static inline void perf_event_exit_cpu(int cpu) { }
 #endif
 
+static int
+perf_reboot(struct notifier_block *notifier, unsigned long val, void *v)
+{
+	int cpu;
+
+	for_each_online_cpu(cpu)
+		perf_event_exit_cpu(cpu);
+
+	return NOTIFY_OK;
+}
+
+/*
+ * Run the perf reboot notifier at the very last possible moment so that
+ * the generic watchdog code runs as long as possible.
+ */
+static struct notifier_block perf_reboot_notifier = {
+	.notifier_call = perf_reboot,
+	.priority = INT_MIN,
+};
+
 static int __cpuinit
 perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 {
@@ -6518,6 +6539,7 @@ void __init perf_event_init(void)
 	perf_pmu_register(&perf_task_clock);
 	perf_tp_register();
 	perf_cpu_notifier(perf_cpu_notify);
+	register_reboot_notifier(&perf_reboot_notifier);
 
 	ret = init_hw_breakpoint();
 	WARN(ret, "hw_breakpoint initialization failed with: %d", ret);

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

* [tip:perf/core] perf session: Remove unneeded dump_printf calls
       [not found]             ` <new-submission>
                                 ` (652 preceding siblings ...)
  2010-12-08 20:42               ` [tip:perf/core] perf: Stop all counters on reboot tip-bot for Peter Zijlstra
@ 2010-12-09 23:39               ` tip-bot for Arnaldo Carvalho de Melo
  2010-12-16 12:31               ` [tip:perf/core] perf, x86: Detect broken BIOSes that corrupt the PMU tip-bot for Peter Zijlstra
                                 ` (52 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-12-09 23:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, imunsie, fweisbec, tglx, mingo

Commit-ID:  ddbc24b72c2c3f3f0182bbc2cb70b31c52a6f45b
Gitweb:     http://git.kernel.org/tip/ddbc24b72c2c3f3f0182bbc2cb70b31c52a6f45b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 9 Dec 2010 12:20:20 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 9 Dec 2010 12:20:20 -0200

perf session: Remove unneeded dump_printf calls

Since we check at the beginning of the callers, no need to ask if
dump_trace is set multiple times.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 69760cd..b59abf5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -639,13 +639,10 @@ static int perf_session_queue_event(struct perf_session *s, event_t *event,
 	return 0;
 }
 
-static void callchain__dump(struct sample_data *sample)
+static void callchain__printf(struct sample_data *sample)
 {
 	unsigned int i;
 
-	if (!dump_trace)
-		return;
-
 	printf("... chain: nr:%Lu\n", sample->callchain->nr);
 
 	for (i = 0; i < sample->callchain->nr; i++)
@@ -675,27 +672,29 @@ static void dump_event(struct perf_session *session, event_t *event,
 	if (!dump_trace)
 		return;
 
-	dump_printf("\n%#Lx [%#x]: event: %d\n", file_offset,
-		    event->header.size, event->header.type);
+	printf("\n%#Lx [%#x]: event: %d\n", file_offset, event->header.size,
+	       event->header.type);
 
 	trace_event(event);
 
 	if (sample)
 		perf_session__print_tstamp(session, event, sample);
 
-	dump_printf("%#Lx [%#x]: PERF_RECORD_%s",
-		    file_offset, event->header.size,
-		    event__get_event_name(event->header.type));
+	printf("%#Lx [%#x]: PERF_RECORD_%s", file_offset, event->header.size,
+	       event__get_event_name(event->header.type));
 }
 
 static void dump_sample(struct perf_session *session, event_t *event,
 			struct sample_data *sample)
 {
-	dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
-		    sample->pid, sample->tid, sample->ip, sample->period);
+	if (!dump_trace)
+		return;
+
+	printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+	       sample->pid, sample->tid, sample->ip, sample->period);
 
 	if (session->sample_type & PERF_SAMPLE_CALLCHAIN)
-		callchain__dump(sample);
+		callchain__printf(sample);
 }
 
 static int perf_session_deliver_event(struct perf_session *session,

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

* [tip:perf/core] perf, x86: Detect broken BIOSes that corrupt the PMU
       [not found]             ` <new-submission>
                                 ` (653 preceding siblings ...)
  2010-12-09 23:39               ` [tip:perf/core] perf session: Remove unneeded dump_printf calls tip-bot for Arnaldo Carvalho de Melo
@ 2010-12-16 12:31               ` tip-bot for Peter Zijlstra
  2010-12-16 12:33               ` [tip:perf/core] perf, x86: Provide a PEBS capable cycle event tip-bot for Peter Zijlstra
                                 ` (51 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-12-16 12:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, jason.wessel, a.p.zijlstra,
	tglx, mingo, dzickus

Commit-ID:  4407204c5c9037763aadce39b025529dfbfcac9e
Gitweb:     http://git.kernel.org/tip/4407204c5c9037763aadce39b025529dfbfcac9e
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 8 Dec 2010 15:56:23 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 16 Dec 2010 11:36:42 +0100

perf, x86: Detect broken BIOSes that corrupt the PMU

Some BIOSes use PMU resources, which can cause various bugs:

 - Non-working or erratic PMU based statistics - the PMU can end up
   counting the wrong thing, resulting in misleading statistics

 - Profiling can stop working or it can profile the wrong thing

 - A non-working or erratic NMI watchdog that cannot be relied on

 - The kernel may disturb whatever thing the BIOS tries to use the
   PMU for - possibly causing hardware malfunction in extreme cases.

 - ... and other forms of potential misbehavior

Various forms of such misbehavior has been observed in practice - there are
BIOSes that just corrupt the PMU state, consequences be damned.

The PMU is a CPU resource that is handled by the kernel and the BIOS
stealing+corrupting it is not acceptable nor robust, so we detect it,
warn about it and further refuse to touch the PMU ourselves.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |   48 +++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 817d2b1..ce27c54 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -375,15 +375,53 @@ static void release_pmc_hardware(void) {}
 static bool check_hw_exists(void)
 {
 	u64 val, val_new = 0;
-	int ret = 0;
+	int i, reg, ret = 0;
+
+	/*
+	 * Check to see if the BIOS enabled any of the counters, if so
+	 * complain and bail.
+	 */
+	for (i = 0; i < x86_pmu.num_counters; i++) {
+		reg = x86_pmu.eventsel + i;
+		ret = rdmsrl_safe(reg, &val);
+		if (ret)
+			goto msr_fail;
+		if (val & ARCH_PERFMON_EVENTSEL_ENABLE)
+			goto bios_fail;
+	}
+
+	if (x86_pmu.num_counters_fixed) {
+		reg = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
+		ret = rdmsrl_safe(reg, &val);
+		if (ret)
+			goto msr_fail;
+		for (i = 0; i < x86_pmu.num_counters_fixed; i++) {
+			if (val & (0x03 << i*4))
+				goto bios_fail;
+		}
+	}
 
+	/*
+	 * Now write a value and read it back to see if it matches,
+	 * this is needed to detect certain hardware emulators (qemu/kvm)
+	 * that don't trap on the MSR access and always return 0s.
+	 */
 	val = 0xabcdUL;
-	ret |= checking_wrmsrl(x86_pmu.perfctr, val);
+	ret = checking_wrmsrl(x86_pmu.perfctr, val);
 	ret |= rdmsrl_safe(x86_pmu.perfctr, &val_new);
 	if (ret || val != val_new)
-		return false;
+		goto msr_fail;
 
 	return true;
+
+bios_fail:
+	printk(KERN_CONT "Broken BIOS detected, using software events only.\n");
+	printk(KERN_ERR FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n", reg, val);
+	return false;
+
+msr_fail:
+	printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n");
+	return false;
 }
 
 static void reserve_ds_buffers(void);
@@ -1378,10 +1416,8 @@ int __init init_hw_perf_events(void)
 	pmu_check_apic();
 
 	/* sanity check that the hardware exists or is emulated */
-	if (!check_hw_exists()) {
-		pr_cont("Broken PMU hardware detected, software events only.\n");
+	if (!check_hw_exists())
 		return 0;
-	}
 
 	pr_cont("%s PMU driver.\n", x86_pmu.name);
 

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

* [tip:perf/core] perf, x86: Provide a PEBS capable cycle event
       [not found]             ` <new-submission>
                                 ` (654 preceding siblings ...)
  2010-12-16 12:31               ` [tip:perf/core] perf, x86: Detect broken BIOSes that corrupt the PMU tip-bot for Peter Zijlstra
@ 2010-12-16 12:33               ` tip-bot for Peter Zijlstra
  2010-12-22 11:28               ` [tip:perf/urgent] perf buildid-list: Fix error return for success tip-bot for Arnaldo Carvalho de Melo
                                 ` (50 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2010-12-16 12:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  7639dae0ca11038286bbbcda05f2bef601c1eb8d
Gitweb:     http://git.kernel.org/tip/7639dae0ca11038286bbbcda05f2bef601c1eb8d
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 14 Dec 2010 21:26:40 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 16 Dec 2010 11:36:44 +0100

perf, x86: Provide a PEBS capable cycle event

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_event_intel.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index c8f5c08..24e390e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -816,6 +816,32 @@ static int intel_pmu_hw_config(struct perf_event *event)
 	if (ret)
 		return ret;
 
+	if (event->attr.precise_ip &&
+	    (event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) {
+		/*
+		 * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P
+		 * (0x003c) so that we can use it with PEBS.
+		 *
+		 * The regular CPU_CLK_UNHALTED.THREAD_P event (0x003c) isn't
+		 * PEBS capable. However we can use INST_RETIRED.ANY_P
+		 * (0x00c0), which is a PEBS capable event, to get the same
+		 * count.
+		 *
+		 * INST_RETIRED.ANY_P counts the number of cycles that retires
+		 * CNTMASK instructions. By setting CNTMASK to a value (16)
+		 * larger than the maximum number of instructions that can be
+		 * retired per cycle (4) and then inverting the condition, we
+		 * count all cycles that retire 16 or less instructions, which
+		 * is every cycle.
+		 *
+		 * Thereby we gain a PEBS capable cycle counter.
+		 */
+		u64 alt_config = 0x108000c0; /* INST_RETIRED.TOTAL_CYCLES */
+
+		alt_config |= (event->hw.config & ~X86_RAW_EVENT_MASK);
+		event->hw.config = alt_config;
+	}
+
 	if (event->attr.type != PERF_TYPE_RAW)
 		return 0;
 

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

* [tip:perf/urgent] perf buildid-list: Fix error return for success
       [not found]             ` <new-submission>
                                 ` (655 preceding siblings ...)
  2010-12-16 12:33               ` [tip:perf/core] perf, x86: Provide a PEBS capable cycle event tip-bot for Peter Zijlstra
@ 2010-12-22 11:28               ` tip-bot for Arnaldo Carvalho de Melo
  2010-12-25  8:57               ` [tip:perf/core] perf symbols: Improve kallsyms symbol end addr calculation tip-bot for Arnaldo Carvalho de Melo
                                 ` (49 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-12-22 11:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, phan, fweisbec, tglx, mingo

Commit-ID:  bbde588bfacb990542eed043d89c8591d4ae9211
Gitweb:     http://git.kernel.org/tip/bbde588bfacb990542eed043d89c8591d4ae9211
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 16 Dec 2010 09:43:47 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Dec 2010 09:43:47 -0200

perf buildid-list: Fix error return for success

It was always returning -1 (255), confusing test scripts.

Reported-by: Han Pingtian <phan@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-buildid-list.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 44a47e1..c49837d 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -36,7 +36,6 @@ static const struct option options[] = {
 
 static int __cmd_buildid_list(void)
 {
-	int err = -1;
 	struct perf_session *session;
 
 	session = perf_session__new(input_name, O_RDONLY, force, false);
@@ -49,7 +48,7 @@ static int __cmd_buildid_list(void)
 	perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
 
 	perf_session__delete(session);
-	return err;
+	return 0;
 }
 
 int cmd_buildid_list(int argc, const char **argv, const char *prefix __used)

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

* [tip:perf/core] perf symbols: Improve kallsyms symbol end addr calculation
       [not found]             ` <new-submission>
                                 ` (656 preceding siblings ...)
  2010-12-22 11:28               ` [tip:perf/urgent] perf buildid-list: Fix error return for success tip-bot for Arnaldo Carvalho de Melo
@ 2010-12-25  8:57               ` tip-bot for Arnaldo Carvalho de Melo
  2010-12-25  8:58               ` [tip:perf/core] perf test: Look forward for symbol aliases tip-bot for Arnaldo Carvalho de Melo
                                 ` (48 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-12-25  8:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, a.p.zijlstra,
	efault, fweisbec, tglx

Commit-ID:  3b01a413c196c91040d41c86e5b56f76bb369f74
Gitweb:     http://git.kernel.org/tip/3b01a413c196c91040d41c86e5b56f76bb369f74
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 22 Dec 2010 01:08:36 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Dec 2010 20:31:45 -0200

perf symbols: Improve kallsyms symbol end addr calculation

For kallsyms we don't have the symbol address end, so we do an extra pass and
set the symbol end addr as being the start of the next minus one.

But this was being done just after we filtered the symbols of a
particular type (functions, variables), so the symbol end was sometimes
after what it really is.

Fixing up symbol end also was falling apart when we have symbol aliases,
then the end address of all but the last alias was being set to be
before its start.

Fix it up by checking for symbol aliases and making the kallsyms__parse
routine use the next symbol, whatever its type, as the limit for the
previous symbol, passing that end address to the callback.

This was detected by the 'perf test' synthetic paranoid regression
tests, fix it up so that even that case doesn't mislead us.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c  |    3 +-
 tools/perf/util/symbol.c |   56 ++++++++++++++++++++++++++++++++++-----------
 tools/perf/util/symbol.h |    2 +-
 3 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 183aedd..2302ec0 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -332,7 +332,8 @@ struct process_symbol_args {
 	u64	   start;
 };
 
-static int find_symbol_cb(void *arg, const char *name, char type, u64 start)
+static int find_symbol_cb(void *arg, const char *name, char type,
+			  u64 start, u64 end __used)
 {
 	struct process_symbol_args *args = arg;
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 561db63..2ea1a2e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -22,6 +22,10 @@
 #include <limits.h>
 #include <sys/utsname.h>
 
+#ifndef KSYM_NAME_LEN
+#define KSYM_NAME_LEN 128
+#endif
+
 #ifndef NT_GNU_BUILD_ID
 #define NT_GNU_BUILD_ID 3
 #endif
@@ -93,7 +97,7 @@ static void symbols__fixup_end(struct rb_root *self)
 		prev = curr;
 		curr = rb_entry(nd, struct symbol, rb_node);
 
-		if (prev->end == prev->start)
+		if (prev->end == prev->start && prev->end != curr->start)
 			prev->end = curr->start - 1;
 	}
 
@@ -426,16 +430,25 @@ size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
 
 int kallsyms__parse(const char *filename, void *arg,
 		    int (*process_symbol)(void *arg, const char *name,
-						     char type, u64 start))
+					  char type, u64 start, u64 end))
 {
 	char *line = NULL;
 	size_t n;
-	int err = 0;
+	int err = -1;
+	u64 prev_start = 0;
+	char prev_symbol_type = 0;
+	char *prev_symbol_name;
 	FILE *file = fopen(filename, "r");
 
 	if (file == NULL)
 		goto out_failure;
 
+	prev_symbol_name = malloc(KSYM_NAME_LEN);
+	if (prev_symbol_name == NULL)
+		goto out_close;
+
+	err = 0;
+
 	while (!feof(file)) {
 		u64 start;
 		int line_len, len;
@@ -455,14 +468,33 @@ int kallsyms__parse(const char *filename, void *arg,
 			continue;
 
 		symbol_type = toupper(line[len]);
-		symbol_name = line + len + 2;
+		len += 2;
+		symbol_name = line + len;
+		len = line_len - len;
 
-		err = process_symbol(arg, symbol_name, symbol_type, start);
-		if (err)
+		if (len >= KSYM_NAME_LEN) {
+			err = -1;
 			break;
+		}
+
+		if (prev_symbol_type) {
+			u64 end = start;
+			if (end != prev_start)
+				--end;
+			err = process_symbol(arg, prev_symbol_name,
+					     prev_symbol_type, prev_start, end);
+			if (err)
+				break;
+		}
+
+		memcpy(prev_symbol_name, symbol_name, len + 1);
+		prev_symbol_type = symbol_type;
+		prev_start = start;
 	}
 
+	free(prev_symbol_name);
 	free(line);
+out_close:
 	fclose(file);
 	return err;
 
@@ -484,7 +516,7 @@ static u8 kallsyms2elf_type(char type)
 }
 
 static int map__process_kallsym_symbol(void *arg, const char *name,
-				       char type, u64 start)
+				       char type, u64 start, u64 end)
 {
 	struct symbol *sym;
 	struct process_kallsyms_args *a = arg;
@@ -493,11 +525,8 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
 	if (!symbol_type__is_a(type, a->map->type))
 		return 0;
 
-	/*
-	 * Will fix up the end later, when we have all symbols sorted.
-	 */
-	sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
-
+	sym = symbol__new(start, end - start + 1,
+			  kallsyms2elf_type(type), name);
 	if (sym == NULL)
 		return -ENOMEM;
 	/*
@@ -650,7 +679,6 @@ int dso__load_kallsyms(struct dso *self, const char *filename,
 	if (dso__load_all_kallsyms(self, filename, map) < 0)
 		return -1;
 
-	symbols__fixup_end(&self->symbols[map->type]);
 	if (self->kernel == DSO_TYPE_GUEST_KERNEL)
 		self->origin = DSO__ORIG_GUEST_KERNEL;
 	else
@@ -2162,7 +2190,7 @@ struct process_args {
 };
 
 static int symbol__in_kernel(void *arg, const char *name,
-			     char type __used, u64 start)
+			     char type __used, u64 start, u64 end __used)
 {
 	struct process_args *args = arg;
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index bcd2f98..7b8c27b 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -215,7 +215,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
 int build_id__sprintf(const u8 *self, int len, char *bf);
 int kallsyms__parse(const char *filename, void *arg,
 		    int (*process_symbol)(void *arg, const char *name,
-					  char type, u64 start));
+					  char type, u64 start, u64 end));
 
 void machine__destroy_kernel_maps(struct machine *self);
 int __machine__create_kernel_maps(struct machine *self, struct dso *kernel);

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

* [tip:perf/core] perf test: Look forward for symbol aliases
       [not found]             ` <new-submission>
                                 ` (657 preceding siblings ...)
  2010-12-25  8:57               ` [tip:perf/core] perf symbols: Improve kallsyms symbol end addr calculation tip-bot for Arnaldo Carvalho de Melo
@ 2010-12-25  8:58               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:19               ` [tip:perf/core] perf script: Finish the rename from trace to script tip-bot for Arnaldo Carvalho de Melo
                                 ` (47 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2010-12-25  8:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, a.p.zijlstra,
	efault, fweisbec, phan, tglx

Commit-ID:  d3678758048308049cdad31ec3eae063be17c0db
Gitweb:     http://git.kernel.org/tip/d3678758048308049cdad31ec3eae063be17c0db
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 21 Dec 2010 23:38:37 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Dec 2010 20:31:59 -0200

perf test: Look forward for symbol aliases

Not just before, fixing these false positives:

[acme@mica linux]$ perf test -v 1
 1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (6 entries long)
Using //lib/modules/2.6.37-rc5-00180-ge06b6bf/build/vmlinux for symbols
0xffffffff81058dc0: diff name v: sys_vm86old k: sys_ni_syscall
0xffffffff81058dc0: diff name v: sys_vm86 k: sys_ni_syscall
0xffffffff81058dc0: diff name v: sys_subpage_prot k: sys_ni_syscall
0xffffffff810b5f7c: diff name v: probe_kernel_write k: __probe_kernel_write
0xffffffff810b5fe5: diff name v: probe_kernel_read k: __probe_kernel_read
0xffffffff811bc380: diff name v: __memset k: memset
0xffffffff81384a98: diff name v: __sched_text_start k: sleep_on_common
0xffffffff81386750: diff name v: __sched_text_end k: _raw_spin_trylock
0xffffffff8138cee8: diff name v: __irqentry_text_start k: do_IRQ
0xffffffff8138f079: diff name v: __start_notes k: _etext
0xffffffff8138f079: diff name v: __stop_notes k: _etext
---- end ----
vmlinux symtab matches kallsyms: FAILED!

[acme@mica linux]$

Some are weak functions, others are just markers, etc. They get in the rb tree
with the same addr, so we need to look around to find the symbol with the same
name.

We were looking just at the previous entries with the same addr, look forward
too.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 035b9fa..e0c3f47 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -119,10 +119,16 @@ static int test__vmlinux_matches_kallsyms(void)
 	 * end addresses too.
 	 */
 	for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) {
-		struct symbol *pair;
+		struct symbol *pair, *first_pair;
+		bool backwards = true;
 
 		sym  = rb_entry(nd, struct symbol, rb_node);
-		pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL);
+
+		if (sym->start == sym->end)
+			continue;
+
+		first_pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL);
+		pair = first_pair;
 
 		if (pair && pair->start == sym->start) {
 next_pair:
@@ -143,8 +149,10 @@ next_pair:
 				pr_debug("%#Lx: diff end addr for %s v: %#Lx k: %#Lx\n",
 					 sym->start, sym->name, sym->end, pair->end);
 			} else {
-				struct rb_node *nnd = rb_prev(&pair->rb_node);
-
+				struct rb_node *nnd;
+detour:
+				nnd = backwards ? rb_prev(&pair->rb_node) :
+						  rb_next(&pair->rb_node);
 				if (nnd) {
 					struct symbol *next = rb_entry(nnd, struct symbol, rb_node);
 
@@ -153,6 +161,13 @@ next_pair:
 						goto next_pair;
 					}
 				}
+
+				if (backwards) {
+					backwards = false;
+					pair = first_pair;
+					goto detour;
+				}
+
 				pr_debug("%#Lx: diff name v: %s k: %s\n",
 					 sym->start, sym->name, pair->name);
 			}

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

* [tip:perf/core] perf script: Finish the rename from trace to script
       [not found]             ` <new-submission>
                                 ` (658 preceding siblings ...)
  2010-12-25  8:58               ` [tip:perf/core] perf test: Look forward for symbol aliases tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:19               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:19               ` [tip:perf/core] perf record: Fix use of sample_id_all userspace with !sample_id_all kernels tip-bot for Arnaldo Carvalho de Melo
                                 ` (46 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, edwintorok, fweisbec, tglx, mingo

Commit-ID:  765532c8aaac624b5f8687af6d319c6a1138a257
Gitweb:     http://git.kernel.org/tip/765532c8aaac624b5f8687af6d319c6a1138a257
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 23 Dec 2010 13:10:22 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 25 Dec 2010 11:29:02 -0200

perf script: Finish the rename from trace to script

The scripts have calls to 'perf trace' that need to be converted to 'perf script', do it.

This problem was introduced in 133dc4c.

Reported-by: Torok Edwin <edwintorok@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Torok Edwin <edwintorok@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/perl/Perf-Trace-Util/Context.c  |    2 +-
 tools/perf/scripts/perl/Perf-Trace-Util/Context.xs |    4 ++--
 tools/perf/scripts/perl/Perf-Trace-Util/README     |    4 ++--
 .../perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm |    2 +-
 .../perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm    |    4 ++--
 .../perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm    |    4 ++--
 tools/perf/scripts/perl/bin/failed-syscalls-report |    2 +-
 tools/perf/scripts/perl/bin/rw-by-file-report      |    5 +----
 tools/perf/scripts/perl/bin/rw-by-pid-report       |    5 +----
 tools/perf/scripts/perl/bin/rwtop-report           |    5 +----
 tools/perf/scripts/perl/bin/wakeup-latency-report  |    5 +----
 tools/perf/scripts/perl/bin/workqueue-stats-report |    6 +-----
 tools/perf/scripts/perl/check-perf-trace.pl        |    2 +-
 tools/perf/scripts/perl/rw-by-file.pl              |    2 +-
 tools/perf/scripts/perl/workqueue-stats.pl         |    2 +-
 .../python/Perf-Trace-Util/lib/Perf/Trace/Core.py  |    2 +-
 .../Perf-Trace-Util/lib/Perf/Trace/SchedGui.py     |    2 +-
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |    2 +-
 .../python/bin/failed-syscalls-by-pid-report       |    2 +-
 .../scripts/python/bin/futex-contention-report     |    2 +-
 tools/perf/scripts/python/bin/netdev-times-report  |    2 +-
 .../perf/scripts/python/bin/sched-migration-report |    2 +-
 tools/perf/scripts/python/bin/sctop-report         |    2 +-
 .../python/bin/syscall-counts-by-pid-report        |    2 +-
 .../perf/scripts/python/bin/syscall-counts-report  |    2 +-
 tools/perf/scripts/python/check-perf-trace.py      |    2 +-
 .../perf/scripts/python/failed-syscalls-by-pid.py  |    2 +-
 tools/perf/scripts/python/sched-migration.py       |    2 +-
 tools/perf/scripts/python/sctop.py                 |    2 +-
 tools/perf/scripts/python/syscall-counts-by-pid.py |    2 +-
 tools/perf/scripts/python/syscall-counts.py        |    2 +-
 31 files changed, 35 insertions(+), 51 deletions(-)

diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
index 01a64ad..790ceba 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
@@ -8,7 +8,7 @@
 
 #line 1 "Context.xs"
 /*
- * Context.xs.  XS interfaces for perf trace.
+ * Context.xs.  XS interfaces for perf script.
  *
  * Copyright (C) 2009 Tom Zanussi <tzanussi@gmail.com>
  *
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index 549cf04..c1e2ed1 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -1,5 +1,5 @@
 /*
- * Context.xs.  XS interfaces for perf trace.
+ * Context.xs.  XS interfaces for perf script.
  *
  * Copyright (C) 2009 Tom Zanussi <tzanussi@gmail.com>
  *
@@ -23,7 +23,7 @@
 #include "perl.h"
 #include "XSUB.h"
 #include "../../../perf.h"
-#include "../../../util/trace-event.h"
+#include "../../../util/script-event.h"
 
 MODULE = Perf::Trace::Context		PACKAGE = Perf::Trace::Context
 PROTOTYPES: ENABLE
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/README b/tools/perf/scripts/perl/Perf-Trace-Util/README
index 9a97076..2f0c7f3 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/README
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/README
@@ -1,7 +1,7 @@
 Perf-Trace-Util version 0.01
 ============================
 
-This module contains utility functions for use with perf trace.
+This module contains utility functions for use with perf script.
 
 Core.pm and Util.pm are pure Perl modules; Core.pm contains routines
 that the core perf support for Perl calls on and should always be
@@ -33,7 +33,7 @@ After you do that:
 
 INSTALLATION
 
-Building perf with perf trace Perl scripting should install this
+Building perf with perf script Perl scripting should install this
 module in the right place.
 
 You should make sure libperl and ExtUtils/Embed.pm are installed first
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm
index 6c7f365..4e2f6039 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm
@@ -34,7 +34,7 @@ Perf::Trace::Context - Perl extension for accessing functions in perf.
 
 =head1 SEE ALSO
 
-Perf (trace) documentation
+Perf (script) documentation
 
 =head1 AUTHOR
 
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm
index 9df376a..9158458 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm
@@ -163,7 +163,7 @@ sub dump_symbolic_fields
 __END__
 =head1 NAME
 
-Perf::Trace::Core - Perl extension for perf trace
+Perf::Trace::Core - Perl extension for perf script
 
 =head1 SYNOPSIS
 
@@ -171,7 +171,7 @@ Perf::Trace::Core - Perl extension for perf trace
 
 =head1 SEE ALSO
 
-Perf (trace) documentation
+Perf (script) documentation
 
 =head1 AUTHOR
 
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm
index d94b40c..0535001 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm
@@ -65,7 +65,7 @@ sub clear_term
 __END__
 =head1 NAME
 
-Perf::Trace::Util - Perl extension for perf trace
+Perf::Trace::Util - Perl extension for perf script
 
 =head1 SYNOPSIS
 
@@ -73,7 +73,7 @@ Perf::Trace::Util - Perl extension for perf trace
 
 =head1 SEE ALSO
 
-Perf (trace) documentation
+Perf (script) documentation
 
 =head1 AUTHOR
 
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-report b/tools/perf/scripts/perl/bin/failed-syscalls-report
index 4028d92..9f83cc1 100644
--- a/tools/perf/scripts/perl/bin/failed-syscalls-report
+++ b/tools/perf/scripts/perl/bin/failed-syscalls-report
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
 	shift
     fi
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm
diff --git a/tools/perf/scripts/perl/bin/rw-by-file-report b/tools/perf/scripts/perl/bin/rw-by-file-report
index ba25f4d..77200b3 100644
--- a/tools/perf/scripts/perl/bin/rw-by-file-report
+++ b/tools/perf/scripts/perl/bin/rw-by-file-report
@@ -7,7 +7,4 @@ if [ $# -lt 1 ] ; then
 fi
 comm=$1
 shift
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm
-
-
-
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm
diff --git a/tools/perf/scripts/perl/bin/rw-by-pid-report b/tools/perf/scripts/perl/bin/rw-by-pid-report
index 641a3f5..a27b9f3 100644
--- a/tools/perf/scripts/perl/bin/rw-by-pid-report
+++ b/tools/perf/scripts/perl/bin/rw-by-pid-report
@@ -1,6 +1,3 @@
 #!/bin/bash
 # description: system-wide r/w activity
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl
-
-
-
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl
diff --git a/tools/perf/scripts/perl/bin/rwtop-report b/tools/perf/scripts/perl/bin/rwtop-report
index 4918dba..83e11ec 100644
--- a/tools/perf/scripts/perl/bin/rwtop-report
+++ b/tools/perf/scripts/perl/bin/rwtop-report
@@ -17,7 +17,4 @@ if [ "$n_args" -gt 0 ] ; then
     interval=$1
     shift
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval
-
-
-
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval
diff --git a/tools/perf/scripts/perl/bin/wakeup-latency-report b/tools/perf/scripts/perl/bin/wakeup-latency-report
index 49052eb..889e813 100644
--- a/tools/perf/scripts/perl/bin/wakeup-latency-report
+++ b/tools/perf/scripts/perl/bin/wakeup-latency-report
@@ -1,6 +1,3 @@
 #!/bin/bash
 # description: system-wide min/max/avg wakeup latency
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl
-
-
-
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl
diff --git a/tools/perf/scripts/perl/bin/workqueue-stats-report b/tools/perf/scripts/perl/bin/workqueue-stats-report
index df0c65f..6d91411 100644
--- a/tools/perf/scripts/perl/bin/workqueue-stats-report
+++ b/tools/perf/scripts/perl/bin/workqueue-stats-report
@@ -1,7 +1,3 @@
 #!/bin/bash
 # description: workqueue stats (ins/exe/create/destroy)
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/workqueue-stats.pl
-
-
-
-
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/perl/workqueue-stats.pl
diff --git a/tools/perf/scripts/perl/check-perf-trace.pl b/tools/perf/scripts/perl/check-perf-trace.pl
index 4e7dc0a..4e7076c 100644
--- a/tools/perf/scripts/perl/check-perf-trace.pl
+++ b/tools/perf/scripts/perl/check-perf-trace.pl
@@ -1,4 +1,4 @@
-# perf trace event handlers, generated by perf trace -g perl
+# perf script event handlers, generated by perf script -g perl
 # (c) 2009, Tom Zanussi <tzanussi@gmail.com>
 # Licensed under the terms of the GNU GPL License version 2
 
diff --git a/tools/perf/scripts/perl/rw-by-file.pl b/tools/perf/scripts/perl/rw-by-file.pl
index 2a39097..74844ee 100644
--- a/tools/perf/scripts/perl/rw-by-file.pl
+++ b/tools/perf/scripts/perl/rw-by-file.pl
@@ -18,7 +18,7 @@ use lib "./Perf-Trace-Util/lib";
 use Perf::Trace::Core;
 use Perf::Trace::Util;
 
-my $usage = "perf trace -s rw-by-file.pl <comm>\n";
+my $usage = "perf script -s rw-by-file.pl <comm>\n";
 
 my $for_comm = shift or die $usage;
 
diff --git a/tools/perf/scripts/perl/workqueue-stats.pl b/tools/perf/scripts/perl/workqueue-stats.pl
index b84b126..a8eaff5 100644
--- a/tools/perf/scripts/perl/workqueue-stats.pl
+++ b/tools/perf/scripts/perl/workqueue-stats.pl
@@ -10,7 +10,7 @@
 #     workqueue:workqueue_destruction -e workqueue:workqueue_execution
 #     -e workqueue:workqueue_insertion
 #
-#   perf trace -p -s tools/perf/scripts/perl/workqueue-stats.pl
+#   perf script -p -s tools/perf/scripts/perl/workqueue-stats.pl
 
 use 5.010000;
 use strict;
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
index aad7525..de7211e 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
@@ -1,4 +1,4 @@
-# Core.py - Python extension for perf trace, core functions
+# Core.py - Python extension for perf script, core functions
 #
 # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
 #
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
index ae9a56e..fdd92f6 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
@@ -1,4 +1,4 @@
-# SchedGui.py - Python extension for perf trace, basic GUI code for
+# SchedGui.py - Python extension for perf script, basic GUI code for
 #		traces drawing and overview.
 #
 # Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
index 13cc02b..15c8400 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
@@ -1,4 +1,4 @@
-# Util.py - Python extension for perf trace, miscellaneous utility code
+# Util.py - Python extension for perf script, miscellaneous utility code
 #
 # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
 #
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
index 0358702..fda5096 100644
--- a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
+++ b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
 	shift
     fi
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/failed-syscalls-by-pid.py $comm
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/failed-syscalls-by-pid.py $comm
diff --git a/tools/perf/scripts/python/bin/futex-contention-report b/tools/perf/scripts/python/bin/futex-contention-report
index c826813..6c44271 100644
--- a/tools/perf/scripts/python/bin/futex-contention-report
+++ b/tools/perf/scripts/python/bin/futex-contention-report
@@ -1,4 +1,4 @@
 #!/bin/bash
 # description: futext contention measurement
 
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/futex-contention.py
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/futex-contention.py
diff --git a/tools/perf/scripts/python/bin/netdev-times-report b/tools/perf/scripts/python/bin/netdev-times-report
index 4ad361b..8f75929 100644
--- a/tools/perf/scripts/python/bin/netdev-times-report
+++ b/tools/perf/scripts/python/bin/netdev-times-report
@@ -2,4 +2,4 @@
 # description: display a process of packet and processing time
 # args: [tx] [rx] [dev=] [debug]
 
-perf trace -s "$PERF_EXEC_PATH"/scripts/python/netdev-times.py $@
+perf script -s "$PERF_EXEC_PATH"/scripts/python/netdev-times.py $@
diff --git a/tools/perf/scripts/python/bin/sched-migration-report b/tools/perf/scripts/python/bin/sched-migration-report
index df1791f..68b037a 100644
--- a/tools/perf/scripts/python/bin/sched-migration-report
+++ b/tools/perf/scripts/python/bin/sched-migration-report
@@ -1,3 +1,3 @@
 #!/bin/bash
 # description: sched migration overview
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sched-migration.py
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/sched-migration.py
diff --git a/tools/perf/scripts/python/bin/sctop-report b/tools/perf/scripts/python/bin/sctop-report
index 36b409c..c32db29 100644
--- a/tools/perf/scripts/python/bin/sctop-report
+++ b/tools/perf/scripts/python/bin/sctop-report
@@ -21,4 +21,4 @@ elif [ "$n_args" -gt 0 ] ; then
     interval=$1
     shift
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sctop.py $comm $interval
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/sctop.py $comm $interval
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
index 4eb88c9..16eb8d6 100644
--- a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
+++ b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
 	shift
     fi
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts-by-pid.py $comm
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts-by-pid.py $comm
diff --git a/tools/perf/scripts/python/bin/syscall-counts-report b/tools/perf/scripts/python/bin/syscall-counts-report
index cb2f9c5..0f0e9d4 100644
--- a/tools/perf/scripts/python/bin/syscall-counts-report
+++ b/tools/perf/scripts/python/bin/syscall-counts-report
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
 	shift
     fi
 fi
-perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts.py $comm
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts.py $comm
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
index d9f7893..4647a76 100644
--- a/tools/perf/scripts/python/check-perf-trace.py
+++ b/tools/perf/scripts/python/check-perf-trace.py
@@ -1,4 +1,4 @@
-# perf trace event handlers, generated by perf trace -g python
+# perf script event handlers, generated by perf script -g python
 # (c) 2010, Tom Zanussi <tzanussi@gmail.com>
 # Licensed under the terms of the GNU GPL License version 2
 #
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py
index acd7848..85805fa 100644
--- a/tools/perf/scripts/python/failed-syscalls-by-pid.py
+++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py
@@ -15,7 +15,7 @@ from perf_trace_context import *
 from Core import *
 from Util import *
 
-usage = "perf trace -s syscall-counts-by-pid.py [comm|pid]\n";
+usage = "perf script -s syscall-counts-by-pid.py [comm|pid]\n";
 
 for_comm = None
 for_pid = None
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py
index b934383..74d55ec 100644
--- a/tools/perf/scripts/python/sched-migration.py
+++ b/tools/perf/scripts/python/sched-migration.py
@@ -4,7 +4,7 @@
 #
 # Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com>
 #
-# perf trace event handlers have been generated by perf trace -g python
+# perf script event handlers have been generated by perf script -g python
 #
 # This software is distributed under the terms of the GNU General
 # Public License ("GPL") version 2 as published by the Free Software
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 7a6ec2c..42c267e 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -17,7 +17,7 @@ from perf_trace_context import *
 from Core import *
 from Util import *
 
-usage = "perf trace -s sctop.py [comm] [interval]\n";
+usage = "perf script -s sctop.py [comm] [interval]\n";
 
 for_comm = None
 default_interval = 3
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py
index d1ee3ec..c64d1c5 100644
--- a/tools/perf/scripts/python/syscall-counts-by-pid.py
+++ b/tools/perf/scripts/python/syscall-counts-by-pid.py
@@ -14,7 +14,7 @@ from perf_trace_context import *
 from Core import *
 from Util import syscall_name
 
-usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
+usage = "perf script -s syscall-counts-by-pid.py [comm]\n";
 
 for_comm = None
 for_pid = None
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
index ea183dc..b435d3f 100644
--- a/tools/perf/scripts/python/syscall-counts.py
+++ b/tools/perf/scripts/python/syscall-counts.py
@@ -15,7 +15,7 @@ from perf_trace_context import *
 from Core import *
 from Util import syscall_name
 
-usage = "perf trace -s syscall-counts.py [comm]\n";
+usage = "perf script -s syscall-counts.py [comm]\n";
 
 for_comm = None
 

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

* [tip:perf/core] perf record: Fix use of sample_id_all userspace with !sample_id_all kernels
       [not found]             ` <new-submission>
                                 ` (659 preceding siblings ...)
  2011-01-04  8:19               ` [tip:perf/core] perf script: Finish the rename from trace to script tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:19               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:19               ` [tip:perf/core] perf script: Fix event ordering settings to work with older kernels tip-bot for Arnaldo Carvalho de Melo
                                 ` (45 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, edwintorok, imunsie, fweisbec, tglx, mingo

Commit-ID:  a43d3f08c64125edbdfdc3d3aa512d3e37321f37
Gitweb:     http://git.kernel.org/tip/a43d3f08c64125edbdfdc3d3aa512d3e37321f37
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 25 Dec 2010 12:12:25 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 25 Dec 2010 12:12:25 -0200

perf record: Fix use of sample_id_all userspace with !sample_id_all kernels

Check if parse_single_tracepoint_event has already asked for PERF_SAMPLE_TIME.

This is kludgy but short term fix for problems introduced by eac23d1c that
broke 'perf script' by having different sample_types when using multiple
tracepoint events when we use a perf binary that tries to use sample_id_all on
an older kernel.

We need to move counter creation to perf_session, support different
sample_types, etc.

Ongoing work on the perf test infrastructure needs this so that we can create
counters to monitor threads generating specific events, etc.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Torok Edwin <edwintorok@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5149e3d..50efbd5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -243,6 +243,19 @@ static void create_counter(int counter, int cpu)
 		u64 time_running;
 		u64 id;
 	} read_data;
+	/*
+ 	 * Check if parse_single_tracepoint_event has already asked for
+ 	 * PERF_SAMPLE_TIME.
+ 	 *
+	 * XXX this is kludgy but short term fix for problems introduced by
+	 * eac23d1c that broke 'perf script' by having different sample_types
+	 * when using multiple tracepoint events when we use a perf binary
+	 * that tries to use sample_id_all on an older kernel.
+ 	 *
+ 	 * We need to move counter creation to perf_session, support
+ 	 * different sample_types, etc.
+ 	 */
+	bool time_needed = attr->sample_type & PERF_SAMPLE_TIME;
 
 	attr->read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
 				  PERF_FORMAT_TOTAL_TIME_RUNNING |
@@ -285,7 +298,8 @@ static void create_counter(int counter, int cpu)
 	if (system_wide)
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 
-	if (sample_time || system_wide || !no_inherit || cpu_list)
+	if (sample_id_all_avail &&
+	    (sample_time || system_wide || !no_inherit || cpu_list))
 		attr->sample_type	|= PERF_SAMPLE_TIME;
 
 	if (raw_samples) {
@@ -294,9 +308,6 @@ static void create_counter(int counter, int cpu)
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 	}
 
-	if (!sample_type)
-		sample_type = attr->sample_type;
-
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= !no_inherit;
@@ -327,7 +338,7 @@ try_again:
 				 * Old kernel, no attr->sample_id_type_all field
 				 */
 				sample_id_all_avail = false;
-				if (!sample_time && !raw_samples)
+				if (!sample_time && !raw_samples && !time_needed)
 					attr->sample_type &= ~PERF_SAMPLE_TIME;
 
 				goto retry_sample_id;
@@ -428,6 +439,9 @@ try_again:
 			}
 		}
 	}
+
+	if (!sample_type)
+		sample_type = attr->sample_type;
 }
 
 static void open_counters(int cpu)

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

* [tip:perf/core] perf script: Fix event ordering settings to work with older kernels
       [not found]             ` <new-submission>
                                 ` (660 preceding siblings ...)
  2011-01-04  8:19               ` [tip:perf/core] perf record: Fix use of sample_id_all userspace with !sample_id_all kernels tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:19               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:21               ` [tip:perf/core] perf tools: Introduce event selectors tip-bot for Arnaldo Carvalho de Melo
                                 ` (44 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, edwintorok, imunsie, fweisbec, tglx, mingo

Commit-ID:  ce0ac9e1851364fa67c991659ce1db05ab82c6ae
Gitweb:     http://git.kernel.org/tip/ce0ac9e1851364fa67c991659ce1db05ab82c6ae
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 25 Dec 2010 18:33:12 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 25 Dec 2010 18:33:12 -0200

perf script: Fix event ordering settings to work with older kernels

If we don't use .ordering_requires_timestamps we'll end up trying to order
events with no timestamps when running on older kernels.

Problem introduced in eac23d1c.

After the last three fixes, perf scripting is back working, tested with
new perf userspace on old and new (with sample_id_all) kernels.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Torok Edwin <edwintorok@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 6ef65c0..43480fd 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -117,6 +117,7 @@ static struct perf_event_ops event_ops = {
 	.tracing_data = event__process_tracing_data,
 	.build_id = event__process_build_id,
 	.lost = process_lost_event,
+	.ordering_requires_timestamps = true,
 	.ordered_samples = true,
 };
 

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

* [tip:perf/core] perf tools: Introduce event selectors
       [not found]             ` <new-submission>
                                 ` (661 preceding siblings ...)
  2011-01-04  8:19               ` [tip:perf/core] perf script: Fix event ordering settings to work with older kernels tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:21               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:21               ` [tip:perf/core] perf evsel: Adopt MATCH_EVENT macro from 'stat' tip-bot for Arnaldo Carvalho de Melo
                                 ` (43 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  69aad6f1ee69546dea8535ab8f3da9f445d57328
Gitweb:     http://git.kernel.org/tip/69aad6f1ee69546dea8535ab8f3da9f445d57328
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 16:39:04 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 3 Jan 2011 16:39:04 -0200

perf tools: Introduce event selectors

Out of ad-hoc code and global arrays with hard coded sizes.

This is the first step on having a library that will be first
used on regression tests in the 'perf test' tool.

[acme@felicio linux]$ size /tmp/perf.before
   text	   data	    bss	    dec	    hex	filename
1273776	  97384	5104416	6475576	 62cf38	/tmp/perf.before
[acme@felicio linux]$ size /tmp/perf.new
   text	   data	    bss	    dec	    hex	filename
1275422	  97416	1392416	2765254	 2a31c6	/tmp/perf.new

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                |    4 +
 tools/perf/builtin-record.c        |  113 +++++++++++------------
 tools/perf/builtin-stat.c          |  175 ++++++++++++++++++++++--------------
 tools/perf/builtin-top.c           |  176 +++++++++++++++++++++---------------
 tools/perf/util/evsel.c            |   35 +++++++
 tools/perf/util/evsel.h            |   24 +++++
 tools/perf/util/header.c           |    9 +-
 tools/perf/util/header.h           |    3 +-
 tools/perf/util/parse-events.c     |   47 +++++++----
 tools/perf/util/parse-events.h     |   17 +++--
 tools/perf/util/trace-event-info.c |   30 ++++---
 tools/perf/util/trace-event.h      |    5 +-
 tools/perf/util/xyarray.c          |   20 ++++
 tools/perf/util/xyarray.h          |   20 ++++
 14 files changed, 433 insertions(+), 245 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index ac6692c..1b9b13e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -396,6 +396,7 @@ LIB_H += util/build-id.h
 LIB_H += util/debug.h
 LIB_H += util/debugfs.h
 LIB_H += util/event.h
+LIB_H += util/evsel.h
 LIB_H += util/exec_cmd.h
 LIB_H += util/types.h
 LIB_H += util/levenshtein.h
@@ -404,6 +405,7 @@ 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/xyarray.h
 LIB_H += util/header.h
 LIB_H += util/help.h
 LIB_H += util/session.h
@@ -433,6 +435,7 @@ LIB_OBJS += $(OUTPUT)util/ctype.o
 LIB_OBJS += $(OUTPUT)util/debugfs.o
 LIB_OBJS += $(OUTPUT)util/environment.o
 LIB_OBJS += $(OUTPUT)util/event.o
+LIB_OBJS += $(OUTPUT)util/evsel.o
 LIB_OBJS += $(OUTPUT)util/exec_cmd.o
 LIB_OBJS += $(OUTPUT)util/help.o
 LIB_OBJS += $(OUTPUT)util/levenshtein.o
@@ -470,6 +473,7 @@ LIB_OBJS += $(OUTPUT)util/sort.o
 LIB_OBJS += $(OUTPUT)util/hist.o
 LIB_OBJS += $(OUTPUT)util/probe-event.o
 LIB_OBJS += $(OUTPUT)util/util.o
+LIB_OBJS += $(OUTPUT)util/xyarray.o
 LIB_OBJS += $(OUTPUT)util/cpumap.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 50efbd5..e68aee3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -18,6 +18,7 @@
 
 #include "util/header.h"
 #include "util/event.h"
+#include "util/evsel.h"
 #include "util/debug.h"
 #include "util/session.h"
 #include "util/symbol.h"
@@ -27,13 +28,13 @@
 #include <sched.h>
 #include <sys/mman.h>
 
+#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
+
 enum write_mode_t {
 	WRITE_FORCE,
 	WRITE_APPEND
 };
 
-static int			*fd[MAX_NR_CPUS][MAX_COUNTERS];
-
 static u64			user_interval			= ULLONG_MAX;
 static u64			default_interval		=      0;
 static u64			sample_type;
@@ -81,7 +82,6 @@ static struct perf_session	*session;
 static const char		*cpu_list;
 
 struct mmap_data {
-	int			counter;
 	void			*base;
 	unsigned int		mask;
 	unsigned int		prev;
@@ -229,12 +229,12 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n
 	return h_attr;
 }
 
-static void create_counter(int counter, int cpu)
+static void create_counter(struct perf_evsel *evsel, int cpu)
 {
-	char *filter = filters[counter];
-	struct perf_event_attr *attr = attrs + counter;
+	char *filter = evsel->filter;
+	struct perf_event_attr *attr = &evsel->attr;
 	struct perf_header_attr *h_attr;
-	int track = !counter; /* only the first counter needs these */
+	int track = !evsel->idx; /* only the first counter needs these */
 	int thread_index;
 	int ret;
 	struct {
@@ -320,10 +320,9 @@ retry_sample_id:
 
 	for (thread_index = 0; thread_index < thread_num; thread_index++) {
 try_again:
-		fd[nr_cpu][counter][thread_index] = sys_perf_event_open(attr,
-				all_tids[thread_index], cpu, group_fd, 0);
+		FD(evsel, nr_cpu, thread_index) = sys_perf_event_open(attr, all_tids[thread_index], cpu, group_fd, 0);
 
-		if (fd[nr_cpu][counter][thread_index] < 0) {
+		if (FD(evsel, nr_cpu, thread_index) < 0) {
 			int err = errno;
 
 			if (err == EPERM || err == EACCES)
@@ -360,7 +359,7 @@ try_again:
 			}
 			printf("\n");
 			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-					fd[nr_cpu][counter][thread_index], strerror(err));
+			      FD(evsel, nr_cpu, thread_index), strerror(err));
 
 #if defined(__i386__) || defined(__x86_64__)
 			if (attr->type == PERF_TYPE_HARDWARE && err == EOPNOTSUPP)
@@ -374,7 +373,7 @@ try_again:
 			exit(-1);
 		}
 
-		h_attr = get_header_attr(attr, counter);
+		h_attr = get_header_attr(attr, evsel->idx);
 		if (h_attr == NULL)
 			die("nomem\n");
 
@@ -385,7 +384,7 @@ try_again:
 			}
 		}
 
-		if (read(fd[nr_cpu][counter][thread_index], &read_data, sizeof(read_data)) == -1) {
+		if (read(FD(evsel, nr_cpu, thread_index), &read_data, sizeof(read_data)) == -1) {
 			perror("Unable to read perf file descriptor");
 			exit(-1);
 		}
@@ -395,43 +394,44 @@ try_again:
 			exit(-1);
 		}
 
-		assert(fd[nr_cpu][counter][thread_index] >= 0);
-		fcntl(fd[nr_cpu][counter][thread_index], F_SETFL, O_NONBLOCK);
+		assert(FD(evsel, nr_cpu, thread_index) >= 0);
+		fcntl(FD(evsel, nr_cpu, thread_index), F_SETFL, O_NONBLOCK);
 
 		/*
 		 * First counter acts as the group leader:
 		 */
 		if (group && group_fd == -1)
-			group_fd = fd[nr_cpu][counter][thread_index];
-
-		if (counter || thread_index) {
-			ret = ioctl(fd[nr_cpu][counter][thread_index],
-					PERF_EVENT_IOC_SET_OUTPUT,
-					fd[nr_cpu][0][0]);
+			group_fd = FD(evsel, nr_cpu, thread_index);
+
+		if (evsel->idx || thread_index) {
+			struct perf_evsel *first;
+			first = list_entry(evsel_list.next, struct perf_evsel, node);
+			ret = ioctl(FD(evsel, nr_cpu, thread_index),
+				    PERF_EVENT_IOC_SET_OUTPUT,
+				    FD(first, nr_cpu, 0));
 			if (ret) {
 				error("failed to set output: %d (%s)\n", errno,
 						strerror(errno));
 				exit(-1);
 			}
 		} else {
-			mmap_array[nr_cpu].counter = counter;
 			mmap_array[nr_cpu].prev = 0;
 			mmap_array[nr_cpu].mask = mmap_pages*page_size - 1;
 			mmap_array[nr_cpu].base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ|PROT_WRITE, MAP_SHARED, fd[nr_cpu][counter][thread_index], 0);
+				PROT_READ | PROT_WRITE, MAP_SHARED, FD(evsel, nr_cpu, thread_index), 0);
 			if (mmap_array[nr_cpu].base == MAP_FAILED) {
 				error("failed to mmap with %d (%s)\n", errno, strerror(errno));
 				exit(-1);
 			}
 
-			event_array[nr_poll].fd = fd[nr_cpu][counter][thread_index];
+			event_array[nr_poll].fd = FD(evsel, nr_cpu, thread_index);
 			event_array[nr_poll].events = POLLIN;
 			nr_poll++;
 		}
 
 		if (filter != NULL) {
-			ret = ioctl(fd[nr_cpu][counter][thread_index],
-					PERF_EVENT_IOC_SET_FILTER, filter);
+			ret = ioctl(FD(evsel, nr_cpu, thread_index),
+				    PERF_EVENT_IOC_SET_FILTER, filter);
 			if (ret) {
 				error("failed to set filter with %d (%s)\n", errno,
 						strerror(errno));
@@ -446,11 +446,12 @@ try_again:
 
 static void open_counters(int cpu)
 {
-	int counter;
+	struct perf_evsel *pos;
 
 	group_fd = -1;
-	for (counter = 0; counter < nr_counters; counter++)
-		create_counter(counter, cpu);
+
+	list_for_each_entry(pos, &evsel_list, node)
+		create_counter(pos, cpu);
 
 	nr_cpu++;
 }
@@ -537,7 +538,7 @@ static void mmap_read_all(void)
 
 static int __cmd_record(int argc, const char **argv)
 {
-	int i, counter;
+	int i;
 	struct stat st;
 	int flags;
 	int err;
@@ -604,7 +605,7 @@ static int __cmd_record(int argc, const char **argv)
 			goto out_delete_session;
 	}
 
-	if (have_tracepoints(attrs, nr_counters))
+	if (have_tracepoints(&evsel_list))
 		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
 
 	/*
@@ -666,12 +667,6 @@ static int __cmd_record(int argc, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	nr_cpus = read_cpu_map(cpu_list);
-	if (nr_cpus < 1) {
-		perror("failed to collect number of CPUs");
-		return -1;
-	}
-
 	if (!system_wide && no_inherit && !cpu_list) {
 		open_counters(-1);
 	} else {
@@ -711,7 +706,7 @@ static int __cmd_record(int argc, const char **argv)
 			return err;
 		}
 
-		if (have_tracepoints(attrs, nr_counters)) {
+		if (have_tracepoints(&evsel_list)) {
 			/*
 			 * FIXME err <= 0 here actually means that
 			 * there were no tracepoints so its not really
@@ -720,8 +715,7 @@ static int __cmd_record(int argc, const char **argv)
 			 * return this more properly and also
 			 * propagate errors that now are calling die()
 			 */
-			err = event__synthesize_tracing_data(output, attrs,
-							     nr_counters,
+			err = event__synthesize_tracing_data(output, &evsel_list,
 							     process_synthesized_event,
 							     session);
 			if (err <= 0) {
@@ -795,13 +789,13 @@ static int __cmd_record(int argc, const char **argv)
 
 		if (done) {
 			for (i = 0; i < nr_cpu; i++) {
-				for (counter = 0;
-					counter < nr_counters;
-					counter++) {
+				struct perf_evsel *pos;
+
+				list_for_each_entry(pos, &evsel_list, node) {
 					for (thread = 0;
 						thread < thread_num;
 						thread++)
-						ioctl(fd[i][counter][thread],
+						ioctl(FD(pos, i, thread),
 							PERF_EVENT_IOC_DISABLE);
 				}
 			}
@@ -887,7 +881,8 @@ const struct option record_options[] = {
 
 int cmd_record(int argc, const char **argv, const char *prefix __used)
 {
-	int i, j, err = -ENOMEM;
+	int err = -ENOMEM;
+	struct perf_evsel *pos;
 
 	argc = parse_options(argc, argv, record_options, record_usage,
 			    PARSE_OPT_STOP_AT_NON_OPTION);
@@ -910,10 +905,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	if (no_buildid_cache || no_buildid)
 		disable_buildid_cache();
 
-	if (!nr_counters) {
-		nr_counters	= 1;
-		attrs[0].type	= PERF_TYPE_HARDWARE;
-		attrs[0].config = PERF_COUNT_HW_CPU_CYCLES;
+	if (list_empty(&evsel_list) && perf_evsel_list__create_default() < 0) {
+		pr_err("Not enough memory for event selector list\n");
+		goto out_symbol_exit;
 	}
 
 	if (target_pid != -1) {
@@ -933,12 +927,15 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		thread_num = 1;
 	}
 
-	for (i = 0; i < MAX_NR_CPUS; i++) {
-		for (j = 0; j < MAX_COUNTERS; j++) {
-			fd[i][j] = malloc(sizeof(int)*thread_num);
-			if (!fd[i][j])
-				goto out_free_fd;
-		}
+	nr_cpus = read_cpu_map(cpu_list);
+	if (nr_cpus < 1) {
+		perror("failed to collect number of CPUs");
+		return -1;
+	}
+
+	list_for_each_entry(pos, &evsel_list, node) {
+		if (perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+			goto out_free_fd;
 	}
 	event_array = malloc(
 		sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
@@ -968,10 +965,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 out_free_event_array:
 	free(event_array);
 out_free_fd:
-	for (i = 0; i < MAX_NR_CPUS; i++) {
-		for (j = 0; j < MAX_COUNTERS; j++)
-			free(fd[i][j]);
-	}
+	list_for_each_entry(pos, &evsel_list, node)
+		perf_evsel__free_fd(pos);
 	free(all_tids);
 	all_tids = NULL;
 out_symbol_exit:
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 7ff746d..511ebaf 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -43,6 +43,7 @@
 #include "util/parse-options.h"
 #include "util/parse-events.h"
 #include "util/event.h"
+#include "util/evsel.h"
 #include "util/debug.h"
 #include "util/header.h"
 #include "util/cpumap.h"
@@ -52,6 +53,8 @@
 #include <math.h>
 #include <locale.h>
 
+#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
+
 #define DEFAULT_SEPARATOR	" "
 
 static struct perf_event_attr default_attrs[] = {
@@ -90,16 +93,11 @@ static const char		*cpu_list;
 static const char		*csv_sep			= NULL;
 static bool			csv_output			= false;
 
-
-static int			*fd[MAX_NR_CPUS][MAX_COUNTERS];
-
-static int			event_scaled[MAX_COUNTERS];
-
-static struct {
+struct cpu_counts {
 	u64 val;
 	u64 ena;
 	u64 run;
-} cpu_counts[MAX_NR_CPUS][MAX_COUNTERS];
+};
 
 static volatile int done = 0;
 
@@ -108,6 +106,26 @@ struct stats
 	double n, mean, M2;
 };
 
+struct perf_stat {
+	struct stats	  res_stats[3];
+	int		  scaled;
+	struct cpu_counts cpu_counts[];
+};
+
+static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel, int ncpus)
+{
+	size_t priv_size = (sizeof(struct perf_stat) +
+			    (ncpus * sizeof(struct cpu_counts)));
+	evsel->priv = zalloc(priv_size);
+	return evsel->priv == NULL ? -ENOMEM : 0;
+}
+
+static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
+{
+	free(evsel->priv);
+	evsel->priv = NULL;
+}
+
 static void update_stats(struct stats *stats, u64 val)
 {
 	double delta;
@@ -147,22 +165,21 @@ static double stddev_stats(struct stats *stats)
 	return sqrt(variance_mean);
 }
 
-struct stats			event_res_stats[MAX_COUNTERS][3];
 struct stats			runtime_nsecs_stats[MAX_NR_CPUS];
 struct stats			runtime_cycles_stats[MAX_NR_CPUS];
 struct stats			runtime_branches_stats[MAX_NR_CPUS];
 struct stats			walltime_nsecs_stats;
 
-#define MATCH_EVENT(t, c, counter)			\
-	(attrs[counter].type == PERF_TYPE_##t &&	\
-	 attrs[counter].config == PERF_COUNT_##c)
+#define MATCH_EVENT(t, c, evsel)			\
+	(evsel->attr.type == PERF_TYPE_##t &&	\
+	 evsel->attr.config == PERF_COUNT_##c)
 
 #define ERR_PERF_OPEN \
 "counter %d, sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information."
 
-static int create_perf_stat_counter(int counter, bool *perm_err)
+static int create_perf_stat_counter(struct perf_evsel *evsel, bool *perm_err)
 {
-	struct perf_event_attr *attr = attrs + counter;
+	struct perf_event_attr *attr = &evsel->attr;
 	int thread;
 	int ncreated = 0;
 
@@ -174,13 +191,13 @@ static int create_perf_stat_counter(int counter, bool *perm_err)
 		int cpu;
 
 		for (cpu = 0; cpu < nr_cpus; cpu++) {
-			fd[cpu][counter][0] = sys_perf_event_open(attr,
+			FD(evsel, cpu, 0) = sys_perf_event_open(attr,
 					-1, cpumap[cpu], -1, 0);
-			if (fd[cpu][counter][0] < 0) {
+			if (FD(evsel, cpu, 0) < 0) {
 				if (errno == EPERM || errno == EACCES)
 					*perm_err = true;
-				error(ERR_PERF_OPEN, counter,
-					 fd[cpu][counter][0], strerror(errno));
+				error(ERR_PERF_OPEN, evsel->idx,
+					FD(evsel, cpu, 0), strerror(errno));
 			} else {
 				++ncreated;
 			}
@@ -192,13 +209,13 @@ static int create_perf_stat_counter(int counter, bool *perm_err)
 			attr->enable_on_exec = 1;
 		}
 		for (thread = 0; thread < thread_num; thread++) {
-			fd[0][counter][thread] = sys_perf_event_open(attr,
+			FD(evsel, 0, thread) = sys_perf_event_open(attr,
 				all_tids[thread], -1, -1, 0);
-			if (fd[0][counter][thread] < 0) {
+			if (FD(evsel, 0, thread) < 0) {
 				if (errno == EPERM || errno == EACCES)
 					*perm_err = true;
-				error(ERR_PERF_OPEN, counter,
-					 fd[0][counter][thread],
+				error(ERR_PERF_OPEN, evsel->idx,
+					FD(evsel, 0, thread),
 					 strerror(errno));
 			} else {
 				++ncreated;
@@ -212,7 +229,7 @@ static int create_perf_stat_counter(int counter, bool *perm_err)
 /*
  * Does the counter have nsecs as a unit?
  */
-static inline int nsec_counter(int counter)
+static inline int nsec_counter(struct perf_evsel *counter)
 {
 	if (MATCH_EVENT(SOFTWARE, SW_CPU_CLOCK, counter) ||
 	    MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
@@ -225,8 +242,9 @@ static inline int nsec_counter(int counter)
  * Read out the results of a single counter:
  * aggregate counts across CPUs in system-wide mode
  */
-static void read_counter_aggr(int counter)
+static void read_counter_aggr(struct perf_evsel *counter)
 {
+	struct perf_stat *ps = counter->priv;
 	u64 count[3], single_count[3];
 	int cpu;
 	size_t res, nv;
@@ -238,15 +256,15 @@ static void read_counter_aggr(int counter)
 	nv = scale ? 3 : 1;
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
 		for (thread = 0; thread < thread_num; thread++) {
-			if (fd[cpu][counter][thread] < 0)
+			if (FD(counter, cpu, thread) < 0)
 				continue;
 
-			res = read(fd[cpu][counter][thread],
+			res = read(FD(counter, cpu, thread),
 					single_count, nv * sizeof(u64));
 			assert(res == nv * sizeof(u64));
 
-			close(fd[cpu][counter][thread]);
-			fd[cpu][counter][thread] = -1;
+			close(FD(counter, cpu, thread));
+			FD(counter, cpu, thread) = -1;
 
 			count[0] += single_count[0];
 			if (scale) {
@@ -259,20 +277,20 @@ static void read_counter_aggr(int counter)
 	scaled = 0;
 	if (scale) {
 		if (count[2] == 0) {
-			event_scaled[counter] = -1;
+			ps->scaled = -1;
 			count[0] = 0;
 			return;
 		}
 
 		if (count[2] < count[1]) {
-			event_scaled[counter] = 1;
+			ps->scaled = 1;
 			count[0] = (unsigned long long)
 				((double)count[0] * count[1] / count[2] + 0.5);
 		}
 	}
 
 	for (i = 0; i < 3; i++)
-		update_stats(&event_res_stats[counter][i], count[i]);
+		update_stats(&ps->res_stats[i], count[i]);
 
 	if (verbose) {
 		fprintf(stderr, "%s: %Ld %Ld %Ld\n", event_name(counter),
@@ -294,8 +312,9 @@ static void read_counter_aggr(int counter)
  * Read out the results of a single counter:
  * do not aggregate counts across CPUs in system-wide mode
  */
-static void read_counter(int counter)
+static void read_counter(struct perf_evsel *counter)
 {
+	struct cpu_counts *cpu_counts = counter->priv;
 	u64 count[3];
 	int cpu;
 	size_t res, nv;
@@ -306,15 +325,15 @@ static void read_counter(int counter)
 
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
 
-		if (fd[cpu][counter][0] < 0)
+		if (FD(counter, cpu, 0) < 0)
 			continue;
 
-		res = read(fd[cpu][counter][0], count, nv * sizeof(u64));
+		res = read(FD(counter, cpu, 0), count, nv * sizeof(u64));
 
 		assert(res == nv * sizeof(u64));
 
-		close(fd[cpu][counter][0]);
-		fd[cpu][counter][0] = -1;
+		close(FD(counter, cpu, 0));
+		FD(counter, cpu, 0) = -1;
 
 		if (scale) {
 			if (count[2] == 0) {
@@ -324,9 +343,9 @@ static void read_counter(int counter)
 				((double)count[0] * count[1] / count[2] + 0.5);
 			}
 		}
-		cpu_counts[cpu][counter].val = count[0]; /* scaled count */
-		cpu_counts[cpu][counter].ena = count[1];
-		cpu_counts[cpu][counter].run = count[2];
+		cpu_counts[cpu].val = count[0]; /* scaled count */
+		cpu_counts[cpu].ena = count[1];
+		cpu_counts[cpu].run = count[2];
 
 		if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
 			update_stats(&runtime_nsecs_stats[cpu], count[0]);
@@ -340,8 +359,9 @@ static void read_counter(int counter)
 static int run_perf_stat(int argc __used, const char **argv)
 {
 	unsigned long long t0, t1;
+	struct perf_evsel *counter;
 	int status = 0;
-	int counter, ncreated = 0;
+	int ncreated = 0;
 	int child_ready_pipe[2], go_pipe[2];
 	bool perm_err = false;
 	const bool forks = (argc > 0);
@@ -401,7 +421,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	for (counter = 0; counter < nr_counters; counter++)
+	list_for_each_entry(counter, &evsel_list, node)
 		ncreated += create_perf_stat_counter(counter, &perm_err);
 
 	if (ncreated < nr_counters) {
@@ -433,25 +453,28 @@ static int run_perf_stat(int argc __used, const char **argv)
 	update_stats(&walltime_nsecs_stats, t1 - t0);
 
 	if (no_aggr) {
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node)
 			read_counter(counter);
 	} else {
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node)
 			read_counter_aggr(counter);
 	}
 	return WEXITSTATUS(status);
 }
 
-static void print_noise(int counter, double avg)
+static void print_noise(struct perf_evsel *evsel, double avg)
 {
+	struct perf_stat *ps;
+
 	if (run_count == 1)
 		return;
 
+	ps = evsel->priv;
 	fprintf(stderr, "   ( +- %7.3f%% )",
-			100 * stddev_stats(&event_res_stats[counter][0]) / avg);
+			100 * stddev_stats(&ps->res_stats[0]) / avg);
 }
 
-static void nsec_printout(int cpu, int counter, double avg)
+static void nsec_printout(int cpu, struct perf_evsel *counter, double avg)
 {
 	double msecs = avg / 1e6;
 	char cpustr[16] = { '\0', };
@@ -473,7 +496,7 @@ static void nsec_printout(int cpu, int counter, double avg)
 	}
 }
 
-static void abs_printout(int cpu, int counter, double avg)
+static void abs_printout(int cpu, struct perf_evsel *counter, double avg)
 {
 	double total, ratio = 0.0;
 	char cpustr[16] = { '\0', };
@@ -528,10 +551,11 @@ static void abs_printout(int cpu, int counter, double avg)
  * Print out the results of a single counter:
  * aggregated counts in system-wide mode
  */
-static void print_counter_aggr(int counter)
+static void print_counter_aggr(struct perf_evsel *counter)
 {
-	double avg = avg_stats(&event_res_stats[counter][0]);
-	int scaled = event_scaled[counter];
+	struct perf_stat *ps = counter->priv;
+	double avg = avg_stats(&ps->res_stats[0]);
+	int scaled = ps->scaled;
 
 	if (scaled == -1) {
 		fprintf(stderr, "%*s%s%-24s\n",
@@ -555,8 +579,8 @@ static void print_counter_aggr(int counter)
 	if (scaled) {
 		double avg_enabled, avg_running;
 
-		avg_enabled = avg_stats(&event_res_stats[counter][1]);
-		avg_running = avg_stats(&event_res_stats[counter][2]);
+		avg_enabled = avg_stats(&ps->res_stats[1]);
+		avg_running = avg_stats(&ps->res_stats[2]);
 
 		fprintf(stderr, "  (scaled from %.2f%%)",
 				100 * avg_running / avg_enabled);
@@ -569,15 +593,16 @@ static void print_counter_aggr(int counter)
  * Print out the results of a single counter:
  * does not use aggregated count in system-wide
  */
-static void print_counter(int counter)
+static void print_counter(struct perf_evsel *counter)
 {
+	struct perf_stat *ps = counter->priv;
 	u64 ena, run, val;
 	int cpu;
 
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
-		val = cpu_counts[cpu][counter].val;
-		ena = cpu_counts[cpu][counter].ena;
-		run = cpu_counts[cpu][counter].run;
+		val = ps->cpu_counts[cpu].val;
+		ena = ps->cpu_counts[cpu].ena;
+		run = ps->cpu_counts[cpu].run;
 		if (run == 0 || ena == 0) {
 			fprintf(stderr, "CPU%*d%s%*s%s%-24s",
 				csv_output ? 0 : -4,
@@ -609,7 +634,8 @@ static void print_counter(int counter)
 
 static void print_stat(int argc, const char **argv)
 {
-	int i, counter;
+	struct perf_evsel *counter;
+	int i;
 
 	fflush(stdout);
 
@@ -632,10 +658,10 @@ static void print_stat(int argc, const char **argv)
 	}
 
 	if (no_aggr) {
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node)
 			print_counter(counter);
 	} else {
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node)
 			print_counter_aggr(counter);
 	}
 
@@ -720,8 +746,8 @@ static const struct option options[] = {
 
 int cmd_stat(int argc, const char **argv, const char *prefix __used)
 {
-	int status;
-	int i,j;
+	struct perf_evsel *pos;
+	int status = -ENOMEM;
 
 	setlocale(LC_ALL, "");
 
@@ -757,8 +783,18 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 
 	/* Set attrs and nr_counters if no event is selected and !null_run */
 	if (!null_run && !nr_counters) {
-		memcpy(attrs, default_attrs, sizeof(default_attrs));
+		size_t c;
+
 		nr_counters = ARRAY_SIZE(default_attrs);
+
+		for (c = 0; c < ARRAY_SIZE(default_attrs); ++c) {
+			pos = perf_evsel__new(default_attrs[c].type,
+					      default_attrs[c].config,
+					      nr_counters);
+			if (pos == NULL)
+				goto out;
+			list_add(&pos->node, &evsel_list);
+		}
 	}
 
 	if (system_wide)
@@ -786,12 +822,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		thread_num = 1;
 	}
 
-	for (i = 0; i < MAX_NR_CPUS; i++) {
-		for (j = 0; j < MAX_COUNTERS; j++) {
-			fd[i][j] = malloc(sizeof(int)*thread_num);
-			if (!fd[i][j])
-				return -ENOMEM;
-		}
+	list_for_each_entry(pos, &evsel_list, node) {
+		if (perf_evsel__alloc_stat_priv(pos, nr_cpus) < 0 ||
+		    perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+			goto out_free_fd;
 	}
 
 	/*
@@ -814,6 +848,11 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 
 	if (status != -1)
 		print_stat(argc, argv);
-
+out_free_fd:
+	list_for_each_entry(pos, &evsel_list, node) {
+		perf_evsel__free_fd(pos);
+		perf_evsel__free_stat_priv(pos);
+	}
+out:
 	return status;
 }
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ae15f04..13a836e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -21,6 +21,7 @@
 #include "perf.h"
 
 #include "util/color.h"
+#include "util/evsel.h"
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/thread.h"
@@ -29,6 +30,7 @@
 #include "util/parse-options.h"
 #include "util/parse-events.h"
 #include "util/cpumap.h"
+#include "util/xyarray.h"
 
 #include "util/debug.h"
 
@@ -55,7 +57,7 @@
 #include <linux/unistd.h>
 #include <linux/types.h>
 
-static int			*fd[MAX_NR_CPUS][MAX_COUNTERS];
+#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 
 static bool			system_wide			=  false;
 
@@ -100,6 +102,7 @@ struct sym_entry		*sym_filter_entry		=   NULL;
 struct sym_entry		*sym_filter_entry_sched		=   NULL;
 static int			sym_pcnt_filter			=      5;
 static int			sym_counter			=      0;
+static struct perf_evsel	*sym_evsel			=   NULL;
 static int			display_weighted		=     -1;
 static const char		*cpu_list;
 
@@ -353,7 +356,7 @@ static void show_details(struct sym_entry *syme)
 		return;
 
 	symbol = sym_entry__symbol(syme);
-	printf("Showing %s for %s\n", event_name(sym_counter), symbol->name);
+	printf("Showing %s for %s\n", event_name(sym_evsel), symbol->name);
 	printf("  Events  Pcnt (>=%d%%)\n", sym_pcnt_filter);
 
 	pthread_mutex_lock(&syme->src->lock);
@@ -460,7 +463,8 @@ 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, snap = !display_weighted ? sym_counter : 0;
+	struct perf_evsel *counter;
+	int snap = !display_weighted ? sym_counter : 0;
 	float samples_per_sec = samples/delay_secs;
 	float ksamples_per_sec = kernel_samples/delay_secs;
 	float us_samples_per_sec = (us_samples)/delay_secs;
@@ -532,7 +536,9 @@ static void print_sym_table(void)
 	}
 
 	if (nr_counters == 1 || !display_weighted) {
-		printf("%Ld", (u64)attrs[0].sample_period);
+		struct perf_evsel *first;
+		first = list_entry(evsel_list.next, struct perf_evsel, node);
+		printf("%Ld", first->attr.sample_period);
 		if (freq)
 			printf("Hz ");
 		else
@@ -540,9 +546,9 @@ static void print_sym_table(void)
 	}
 
 	if (!display_weighted)
-		printf("%s", event_name(sym_counter));
-	else for (counter = 0; counter < nr_counters; counter++) {
-		if (counter)
+		printf("%s", event_name(sym_evsel));
+	else list_for_each_entry(counter, &evsel_list, node) {
+		if (counter->idx)
 			printf("/");
 
 		printf("%s", event_name(counter));
@@ -739,7 +745,7 @@ static void print_mapped_keys(void)
 	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[E]     active event counter.              \t(%s)\n", event_name(sym_evsel));
 
 	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
 
@@ -826,19 +832,23 @@ static void handle_keypress(struct perf_session *session, int c)
 			break;
 		case 'E':
 			if (nr_counters > 1) {
-				int i;
-
 				fprintf(stderr, "\nAvailable events:");
-				for (i = 0; i < nr_counters; i++)
-					fprintf(stderr, "\n\t%d %s", i, event_name(i));
+
+				list_for_each_entry(sym_evsel, &evsel_list, node)
+					fprintf(stderr, "\n\t%d %s", sym_evsel->idx, event_name(sym_evsel));
 
 				prompt_integer(&sym_counter, "Enter details event counter");
 
 				if (sym_counter >= nr_counters) {
-					fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(0));
+					sym_evsel = list_entry(evsel_list.next, struct perf_evsel, node);
 					sym_counter = 0;
+					fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(sym_evsel));
 					sleep(1);
+					break;
 				}
+				list_for_each_entry(sym_evsel, &evsel_list, node)
+					if (sym_evsel->idx == sym_counter)
+						break;
 			} else sym_counter = 0;
 			break;
 		case 'f':
@@ -978,7 +988,8 @@ static int symbol_filter(struct map *map, struct symbol *sym)
 
 static void event__process_sample(const event_t *self,
 				  struct sample_data *sample,
-				  struct perf_session *session, int counter)
+				  struct perf_session *session,
+				  struct perf_evsel *evsel)
 {
 	u64 ip = self->ip.ip;
 	struct sym_entry *syme;
@@ -1071,9 +1082,9 @@ static void event__process_sample(const event_t *self,
 
 	syme = symbol__priv(al.sym);
 	if (!syme->skip) {
-		syme->count[counter]++;
+		syme->count[evsel->idx]++;
 		syme->origin = origin;
-		record_precise_ip(syme, counter, ip);
+		record_precise_ip(syme, evsel->idx, ip);
 		pthread_mutex_lock(&active_symbols_lock);
 		if (list_empty(&syme->node) || !syme->node.next)
 			__list_insert_active_sym(syme);
@@ -1082,12 +1093,24 @@ static void event__process_sample(const event_t *self,
 }
 
 struct mmap_data {
-	int			counter;
 	void			*base;
 	int			mask;
 	unsigned int		prev;
 };
 
+static int perf_evsel__alloc_mmap_per_thread(struct perf_evsel *evsel,
+					     int ncpus, int nthreads)
+{
+	evsel->priv = xyarray__new(ncpus, nthreads, sizeof(struct mmap_data));
+	return evsel->priv != NULL ? 0 : -ENOMEM;
+}
+
+static void perf_evsel__free_mmap(struct perf_evsel *evsel)
+{
+	xyarray__delete(evsel->priv);
+	evsel->priv = NULL;
+}
+
 static unsigned int mmap_read_head(struct mmap_data *md)
 {
 	struct perf_event_mmap_page *pc = md->base;
@@ -1100,8 +1123,11 @@ static unsigned int mmap_read_head(struct mmap_data *md)
 }
 
 static void perf_session__mmap_read_counter(struct perf_session *self,
-					    struct mmap_data *md)
+					    struct perf_evsel *evsel,
+					    int cpu, int thread_idx)
 {
+	struct xyarray *mmap_array = evsel->priv;
+	struct mmap_data *md = xyarray__entry(mmap_array, cpu, thread_idx);
 	unsigned int head = mmap_read_head(md);
 	unsigned int old = md->prev;
 	unsigned char *data = md->base + page_size;
@@ -1155,7 +1181,7 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
 
 		event__parse_sample(event, self, &sample);
 		if (event->header.type == PERF_RECORD_SAMPLE)
-			event__process_sample(event, &sample, self, md->counter);
+			event__process_sample(event, &sample, self, evsel);
 		else
 			event__process(event, &sample, self);
 		old += size;
@@ -1165,28 +1191,31 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
 }
 
 static struct pollfd *event_array;
-static struct mmap_data *mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
 
 static void perf_session__mmap_read(struct perf_session *self)
 {
-	int i, counter, thread_index;
+	struct perf_evsel *counter;
+	int i, thread_index;
 
 	for (i = 0; i < nr_cpus; i++) {
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node) {
 			for (thread_index = 0;
 				thread_index < thread_num;
 				thread_index++) {
 				perf_session__mmap_read_counter(self,
-					&mmap_array[i][counter][thread_index]);
+					counter, i, thread_index);
 			}
+		}
 	}
 }
 
 int nr_poll;
 int group_fd;
 
-static void start_counter(int i, int counter)
+static void start_counter(int i, struct perf_evsel *evsel)
 {
+	struct xyarray *mmap_array = evsel->priv;
+	struct mmap_data *mm;
 	struct perf_event_attr *attr;
 	int cpu = -1;
 	int thread_index;
@@ -1194,7 +1223,7 @@ static void start_counter(int i, int counter)
 	if (target_tid == -1)
 		cpu = cpumap[i];
 
-	attr = attrs + counter;
+	attr = &evsel->attr;
 
 	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
 
@@ -1209,10 +1238,10 @@ static void start_counter(int i, int counter)
 
 	for (thread_index = 0; thread_index < thread_num; thread_index++) {
 try_again:
-		fd[i][counter][thread_index] = sys_perf_event_open(attr,
+		FD(evsel, i, thread_index) = sys_perf_event_open(attr,
 				all_tids[thread_index], cpu, group_fd, 0);
 
-		if (fd[i][counter][thread_index] < 0) {
+		if (FD(evsel, i, thread_index) < 0) {
 			int err = errno;
 
 			if (err == EPERM || err == EACCES)
@@ -1236,29 +1265,29 @@ try_again:
 			}
 			printf("\n");
 			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-					fd[i][counter][thread_index], strerror(err));
+					FD(evsel, i, thread_index), strerror(err));
 			die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 			exit(-1);
 		}
-		assert(fd[i][counter][thread_index] >= 0);
-		fcntl(fd[i][counter][thread_index], F_SETFL, O_NONBLOCK);
+		assert(FD(evsel, i, thread_index) >= 0);
+		fcntl(FD(evsel, i, thread_index), F_SETFL, O_NONBLOCK);
 
 		/*
 		 * First counter acts as the group leader:
 		 */
 		if (group && group_fd == -1)
-			group_fd = fd[i][counter][thread_index];
+			group_fd = FD(evsel, i, thread_index);
 
-		event_array[nr_poll].fd = fd[i][counter][thread_index];
+		event_array[nr_poll].fd = FD(evsel, i, thread_index);
 		event_array[nr_poll].events = POLLIN;
 		nr_poll++;
 
-		mmap_array[i][counter][thread_index].counter = counter;
-		mmap_array[i][counter][thread_index].prev = 0;
-		mmap_array[i][counter][thread_index].mask = mmap_pages*page_size - 1;
-		mmap_array[i][counter][thread_index].base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ, MAP_SHARED, fd[i][counter][thread_index], 0);
-		if (mmap_array[i][counter][thread_index].base == MAP_FAILED)
+		mm = xyarray__entry(mmap_array, i, thread_index);
+		mm->prev = 0;
+		mm->mask = mmap_pages*page_size - 1;
+		mm->base = mmap(NULL, (mmap_pages+1)*page_size,
+				PROT_READ, MAP_SHARED, FD(evsel, i, thread_index), 0);
+		if (mm->base == MAP_FAILED)
 			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 	}
 }
@@ -1266,8 +1295,8 @@ try_again:
 static int __cmd_top(void)
 {
 	pthread_t thread;
-	int i, counter;
-	int ret;
+	struct perf_evsel *counter;
+	int i, ret;
 	/*
 	 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
 	 * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
@@ -1283,7 +1312,7 @@ static int __cmd_top(void)
 
 	for (i = 0; i < nr_cpus; i++) {
 		group_fd = -1;
-		for (counter = 0; counter < nr_counters; counter++)
+		list_for_each_entry(counter, &evsel_list, node)
 			start_counter(i, counter);
 	}
 
@@ -1372,8 +1401,8 @@ static const struct option options[] = {
 
 int cmd_top(int argc, const char **argv, const char *prefix __used)
 {
-	int counter;
-	int i,j;
+	struct perf_evsel *pos;
+	int status = -ENOMEM;
 
 	page_size = sysconf(_SC_PAGE_SIZE);
 
@@ -1398,15 +1427,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		thread_num = 1;
 	}
 
-	for (i = 0; i < MAX_NR_CPUS; i++) {
-		for (j = 0; j < MAX_COUNTERS; j++) {
-			fd[i][j] = malloc(sizeof(int)*thread_num);
-			mmap_array[i][j] = zalloc(
-				sizeof(struct mmap_data)*thread_num);
-			if (!fd[i][j] || !mmap_array[i][j])
-				return -ENOMEM;
-		}
-	}
 	event_array = malloc(
 		sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
 	if (!event_array)
@@ -1419,15 +1439,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		cpu_list = NULL;
 	}
 
-	if (!nr_counters)
-		nr_counters = 1;
-
-	symbol_conf.priv_size = (sizeof(struct sym_entry) +
-				 (nr_counters + 1) * sizeof(unsigned long));
-
-	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
-	if (symbol__init() < 0)
-		return -1;
+	if (!nr_counters && perf_evsel_list__create_default() < 0) {
+		pr_err("Not enough memory for event selector list\n");
+		return -ENOMEM;
+	}
 
 	if (delay_secs < 1)
 		delay_secs = 1;
@@ -1444,16 +1459,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		exit(EXIT_FAILURE);
 	}
 
-	/*
-	 * Fill in the ones not specifically initialized via -c:
-	 */
-	for (counter = 0; counter < nr_counters; counter++) {
-		if (attrs[counter].sample_period)
-			continue;
-
-		attrs[counter].sample_period = default_interval;
-	}
-
 	if (target_tid != -1)
 		nr_cpus = 1;
 	else
@@ -1462,11 +1467,38 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	if (nr_cpus < 1)
 		usage_with_options(top_usage, options);
 
+	list_for_each_entry(pos, &evsel_list, node) {
+		if (perf_evsel__alloc_mmap_per_thread(pos, nr_cpus, thread_num) < 0 ||
+		    perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+			goto out_free_fd;
+		/*
+		 * Fill in the ones not specifically initialized via -c:
+		 */
+		if (pos->attr.sample_period)
+			continue;
+
+		pos->attr.sample_period = default_interval;
+	}
+
+	symbol_conf.priv_size = (sizeof(struct sym_entry) +
+				 (nr_counters + 1) * sizeof(unsigned long));
+
+	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
+	if (symbol__init() < 0)
+		return -1;
+
 	get_term_dimensions(&winsize);
 	if (print_entries == 0) {
 		update_print_entries(&winsize);
 		signal(SIGWINCH, sig_winch_handler);
 	}
 
-	return __cmd_top();
+	status = __cmd_top();
+out_free_fd:
+	list_for_each_entry(pos, &evsel_list, node) {
+		perf_evsel__free_fd(pos);
+		perf_evsel__free_mmap(pos);
+	}
+
+	return status;
 }
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
new file mode 100644
index 0000000..6539ec9
--- /dev/null
+++ b/tools/perf/util/evsel.c
@@ -0,0 +1,35 @@
+#include "evsel.h"
+#include "util.h"
+
+struct perf_evsel *perf_evsel__new(u32 type, u64 config, int idx)
+{
+	struct perf_evsel *evsel = zalloc(sizeof(*evsel));
+
+	if (evsel != NULL) {
+		evsel->idx	   = idx;
+		evsel->attr.type   = type;
+		evsel->attr.config = config;
+		INIT_LIST_HEAD(&evsel->node);
+	}
+
+	return evsel;
+}
+
+int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
+{
+	evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int));
+	return evsel->fd != NULL ? 0 : -ENOMEM;
+}
+
+void perf_evsel__free_fd(struct perf_evsel *evsel)
+{
+	xyarray__delete(evsel->fd);
+	evsel->fd = NULL;
+}
+
+void perf_evsel__delete(struct perf_evsel *evsel)
+{
+	assert(list_empty(&evsel->node));
+	xyarray__delete(evsel->fd);
+	free(evsel);
+}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
new file mode 100644
index 0000000..3eb3989
--- /dev/null
+++ b/tools/perf/util/evsel.h
@@ -0,0 +1,24 @@
+#ifndef __PERF_EVSEL_H
+#define __PERF_EVSEL_H 1
+
+#include <linux/list.h>
+#include <linux/perf_event.h>
+#include "types.h"
+#include "xyarray.h"
+
+struct perf_evsel {
+	struct list_head	node;
+	struct perf_event_attr	attr;
+	char			*filter;
+	struct xyarray		*fd;
+	int			idx;
+	void			*priv;
+};
+
+struct perf_evsel *perf_evsel__new(u32 type, u64 config, int idx);
+void perf_evsel__delete(struct perf_evsel *evsel);
+
+int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
+void perf_evsel__free_fd(struct perf_evsel *evsel);
+
+#endif /* __PERF_EVSEL_H */
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 16a1602..ecb5a84 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -461,7 +461,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
 
 		/* Write trace info */
 		trace_sec->offset = lseek(fd, 0, SEEK_CUR);
-		read_tracing_data(fd, attrs, nr_counters);
+		read_tracing_data(fd, &evsel_list);
 		trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
 	}
 
@@ -1131,8 +1131,7 @@ int event__process_event_type(event_t *self,
 	return 0;
 }
 
-int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
-				   int nb_events,
+int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
 				   event__handler_t process,
 				   struct perf_session *session __unused)
 {
@@ -1143,7 +1142,7 @@ int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
 	memset(&ev, 0, sizeof(ev));
 
 	ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA;
-	size = read_tracing_data_size(fd, pattrs, nb_events);
+	size = read_tracing_data_size(fd, pattrs);
 	if (size <= 0)
 		return size;
 	aligned_size = ALIGN(size, sizeof(u64));
@@ -1153,7 +1152,7 @@ int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
 
 	process(&ev, NULL, session);
 
-	err = read_tracing_data(fd, pattrs, nb_events);
+	err = read_tracing_data(fd, pattrs);
 	write_padded(fd, NULL, 0, padding);
 
 	return aligned_size;
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 6335965..33f16be 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -113,8 +113,7 @@ int event__synthesize_event_types(event__handler_t process,
 int event__process_event_type(event_t *self,
 			      struct perf_session *session);
 
-int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
-				   int nb_events,
+int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
 				   event__handler_t process,
 				   struct perf_session *session);
 int event__process_tracing_data(event_t *self,
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index c305305..2d948ad 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,6 +1,7 @@
 #include "../../../include/linux/hw_breakpoint.h"
 #include "util.h"
 #include "../perf.h"
+#include "evsel.h"
 #include "parse-options.h"
 #include "parse-events.h"
 #include "exec_cmd.h"
@@ -12,8 +13,7 @@
 
 int				nr_counters;
 
-struct perf_event_attr		attrs[MAX_COUNTERS];
-char				*filters[MAX_COUNTERS];
+LIST_HEAD(evsel_list);
 
 struct event_symbol {
 	u8		type;
@@ -266,10 +266,10 @@ static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
 	return name;
 }
 
-const char *event_name(int counter)
+const char *event_name(struct perf_evsel *evsel)
 {
-	u64 config = attrs[counter].config;
-	int type = attrs[counter].type;
+	u64 config = evsel->attr.config;
+	int type = evsel->attr.type;
 
 	return __event_name(type, config);
 }
@@ -814,9 +814,6 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
 			return -1;
 
 	for (;;) {
-		if (nr_counters == MAX_COUNTERS)
-			return -1;
-
 		memset(&attr, 0, sizeof(attr));
 		ret = parse_event_symbols(&str, &attr);
 		if (ret == EVT_FAILED)
@@ -826,8 +823,13 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
 			return -1;
 
 		if (ret != EVT_HANDLED_ALL) {
-			attrs[nr_counters] = attr;
-			nr_counters++;
+			struct perf_evsel *evsel;
+			evsel = perf_evsel__new(attr.type, attr.config,
+						nr_counters);
+			if (evsel == NULL)
+				return -1;
+			list_add_tail(&evsel->node, &evsel_list);
+			++nr_counters;
 		}
 
 		if (*str == 0)
@@ -844,21 +846,22 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
 int parse_filter(const struct option *opt __used, const char *str,
 		 int unset __used)
 {
-	int i = nr_counters - 1;
-	int len = strlen(str);
+	struct perf_evsel *last = NULL;
 
-	if (i < 0 || attrs[i].type != PERF_TYPE_TRACEPOINT) {
+	if (!list_empty(&evsel_list))
+		last = list_entry(evsel_list.prev, struct perf_evsel, node);
+
+	if (last == NULL || last->attr.type != PERF_TYPE_TRACEPOINT) {
 		fprintf(stderr,
 			"-F option should follow a -e tracepoint option\n");
 		return -1;
 	}
 
-	filters[i] = malloc(len + 1);
-	if (!filters[i]) {
+	last->filter = strdup(str);
+	if (last->filter == NULL) {
 		fprintf(stderr, "not enough memory to hold filter string\n");
 		return -1;
 	}
-	strcpy(filters[i], str);
 
 	return 0;
 }
@@ -967,3 +970,15 @@ void print_events(void)
 
 	exit(129);
 }
+
+int perf_evsel_list__create_default(void)
+{
+	struct perf_evsel *evsel = perf_evsel__new(PERF_TYPE_HARDWARE,
+						   PERF_COUNT_HW_CPU_CYCLES, 0);
+	if (evsel == NULL)
+		return -ENOMEM;
+
+	list_add(&evsel->node, &evsel_list);
+	++nr_counters;
+	return 0;
+}
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index fc4ab3f..0f915a0 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -4,6 +4,15 @@
  * Parse symbolic events/counts passed in as options:
  */
 
+#include <linux/perf_event.h>
+
+struct list_head;
+struct perf_evsel;
+
+extern struct list_head evsel_list;
+
+int perf_evsel_list__create_default(void);
+
 struct option;
 
 struct tracepoint_path {
@@ -13,14 +22,11 @@ struct tracepoint_path {
 };
 
 extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
-extern bool have_tracepoints(struct perf_event_attr *pattrs, int nb_events);
+extern bool have_tracepoints(struct list_head *evsel_list);
 
 extern int			nr_counters;
 
-extern struct perf_event_attr attrs[MAX_COUNTERS];
-extern char *filters[MAX_COUNTERS];
-
-extern const char *event_name(int ctr);
+const char *event_name(struct perf_evsel *event);
 extern const char *__event_name(int type, u64 config);
 
 extern int parse_events(const struct option *opt, const char *str, int unset);
@@ -33,5 +39,4 @@ extern void print_events(void);
 extern char debugfs_path[];
 extern int valid_debugfs_mount(const char *debugfs);
 
-
 #endif /* __PERF_PARSE_EVENTS_H */
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index b157260..35729f4 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -34,11 +34,13 @@
 #include <ctype.h>
 #include <errno.h>
 #include <stdbool.h>
+#include <linux/list.h>
 #include <linux/kernel.h>
 
 #include "../perf.h"
 #include "trace-event.h"
 #include "debugfs.h"
+#include "evsel.h"
 
 #define VERSION "0.5"
 
@@ -469,16 +471,17 @@ out:
 }
 
 static struct tracepoint_path *
-get_tracepoints_path(struct perf_event_attr *pattrs, int nb_events)
+get_tracepoints_path(struct list_head *pattrs)
 {
 	struct tracepoint_path path, *ppath = &path;
-	int i, nr_tracepoints = 0;
+	struct perf_evsel *pos;
+	int nr_tracepoints = 0;
 
-	for (i = 0; i < nb_events; i++) {
-		if (pattrs[i].type != PERF_TYPE_TRACEPOINT)
+	list_for_each_entry(pos, pattrs, node) {
+		if (pos->attr.type != PERF_TYPE_TRACEPOINT)
 			continue;
 		++nr_tracepoints;
-		ppath->next = tracepoint_id_to_path(pattrs[i].config);
+		ppath->next = tracepoint_id_to_path(pos->attr.config);
 		if (!ppath->next)
 			die("%s\n", "No memory to alloc tracepoints list");
 		ppath = ppath->next;
@@ -487,21 +490,21 @@ get_tracepoints_path(struct perf_event_attr *pattrs, int nb_events)
 	return nr_tracepoints > 0 ? path.next : NULL;
 }
 
-bool have_tracepoints(struct perf_event_attr *pattrs, int nb_events)
+bool have_tracepoints(struct list_head *pattrs)
 {
-	int i;
+	struct perf_evsel *pos;
 
-	for (i = 0; i < nb_events; i++)
-		if (pattrs[i].type == PERF_TYPE_TRACEPOINT)
+	list_for_each_entry(pos, pattrs, node)
+		if (pos->attr.type == PERF_TYPE_TRACEPOINT)
 			return true;
 
 	return false;
 }
 
-int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
+int read_tracing_data(int fd, struct list_head *pattrs)
 {
 	char buf[BUFSIZ];
-	struct tracepoint_path *tps = get_tracepoints_path(pattrs, nb_events);
+	struct tracepoint_path *tps = get_tracepoints_path(pattrs);
 
 	/*
 	 * What? No tracepoints? No sense writing anything here, bail out.
@@ -545,14 +548,13 @@ int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events)
 	return 0;
 }
 
-ssize_t read_tracing_data_size(int fd, struct perf_event_attr *pattrs,
-			       int nb_events)
+ssize_t read_tracing_data_size(int fd, struct list_head *pattrs)
 {
 	ssize_t size;
 	int err = 0;
 
 	calc_data_size = 1;
-	err = read_tracing_data(fd, pattrs, nb_events);
+	err = read_tracing_data(fd, pattrs);
 	size = calc_data_size - 1;
 	calc_data_size = 0;
 
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index b3e86b1..b5f12ca 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -262,9 +262,8 @@ raw_field_value(struct event *event, const char *name, void *data);
 void *raw_field_ptr(struct event *event, const char *name, void *data);
 unsigned long long eval_flag(const char *flag);
 
-int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events);
-ssize_t read_tracing_data_size(int fd, struct perf_event_attr *pattrs,
-			       int nb_events);
+int read_tracing_data(int fd, struct list_head *pattrs);
+ssize_t read_tracing_data_size(int fd, struct list_head *pattrs);
 
 /* taken from kernel/trace/trace.h */
 enum trace_flag_type {
diff --git a/tools/perf/util/xyarray.c b/tools/perf/util/xyarray.c
new file mode 100644
index 0000000..22afbf6
--- /dev/null
+++ b/tools/perf/util/xyarray.c
@@ -0,0 +1,20 @@
+#include "xyarray.h"
+#include "util.h"
+
+struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size)
+{
+	size_t row_size = ylen * entry_size;
+	struct xyarray *xy = zalloc(sizeof(*xy) + xlen * row_size);
+
+	if (xy != NULL) {
+		xy->entry_size = entry_size;
+		xy->row_size   = row_size;
+	}
+
+	return xy;
+}
+
+void xyarray__delete(struct xyarray *xy)
+{
+	free(xy);
+}
diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h
new file mode 100644
index 0000000..c488a07
--- /dev/null
+++ b/tools/perf/util/xyarray.h
@@ -0,0 +1,20 @@
+#ifndef _PERF_XYARRAY_H_
+#define _PERF_XYARRAY_H_ 1
+
+#include <sys/types.h>
+
+struct xyarray {
+	size_t row_size;
+	size_t entry_size;
+	char contents[];
+};
+
+struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size);
+void xyarray__delete(struct xyarray *xy);
+
+static inline void *xyarray__entry(struct xyarray *xy, int x, int y)
+{
+	return &xy->contents[x * xy->row_size + y * xy->entry_size];
+}
+
+#endif /* _PERF_XYARRAY_H_ */

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

* [tip:perf/core] perf evsel: Adopt MATCH_EVENT macro from 'stat'
       [not found]             ` <new-submission>
                                 ` (662 preceding siblings ...)
  2011-01-04  8:21               ` [tip:perf/core] perf tools: Introduce event selectors tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:21               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:22               ` [tip:perf/core] perf util: Move do_read from session to util tip-bot for Arnaldo Carvalho de Melo
                                 ` (42 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  daec78a09de3df5fbfbbd167da0304d49d7fcfe5
Gitweb:     http://git.kernel.org/tip/daec78a09de3df5fbfbbd167da0304d49d7fcfe5
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 16:49:44 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 3 Jan 2011 16:49:44 -0200

perf evsel: Adopt MATCH_EVENT macro from 'stat'

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |   37 ++++++++++++++++---------------------
 tools/perf/util/evsel.h   |    4 ++++
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 511ebaf..3e5f356 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -170,10 +170,6 @@ struct stats			runtime_cycles_stats[MAX_NR_CPUS];
 struct stats			runtime_branches_stats[MAX_NR_CPUS];
 struct stats			walltime_nsecs_stats;
 
-#define MATCH_EVENT(t, c, evsel)			\
-	(evsel->attr.type == PERF_TYPE_##t &&	\
-	 evsel->attr.config == PERF_COUNT_##c)
-
 #define ERR_PERF_OPEN \
 "counter %d, sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information."
 
@@ -229,10 +225,10 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, bool *perm_err)
 /*
  * Does the counter have nsecs as a unit?
  */
-static inline int nsec_counter(struct perf_evsel *counter)
+static inline int nsec_counter(struct perf_evsel *evsel)
 {
-	if (MATCH_EVENT(SOFTWARE, SW_CPU_CLOCK, counter) ||
-	    MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
+	if (perf_evsel__match(evsel, SOFTWARE, SW_CPU_CLOCK) ||
+	    perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK))
 		return 1;
 
 	return 0;
@@ -300,11 +296,11 @@ static void read_counter_aggr(struct perf_evsel *counter)
 	/*
 	 * Save the full runtime - to allow normalization during printout:
 	 */
-	if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
+	if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK))
 		update_stats(&runtime_nsecs_stats[0], count[0]);
-	if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter))
+	if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
 		update_stats(&runtime_cycles_stats[0], count[0]);
-	if (MATCH_EVENT(HARDWARE, HW_BRANCH_INSTRUCTIONS, counter))
+	if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
 		update_stats(&runtime_branches_stats[0], count[0]);
 }
 
@@ -347,11 +343,11 @@ static void read_counter(struct perf_evsel *counter)
 		cpu_counts[cpu].ena = count[1];
 		cpu_counts[cpu].run = count[2];
 
-		if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter))
+		if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK))
 			update_stats(&runtime_nsecs_stats[cpu], count[0]);
-		if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter))
+		if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
 			update_stats(&runtime_cycles_stats[cpu], count[0]);
-		if (MATCH_EVENT(HARDWARE, HW_BRANCH_INSTRUCTIONS, counter))
+		if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
 			update_stats(&runtime_branches_stats[cpu], count[0]);
 	}
 }
@@ -474,7 +470,7 @@ static void print_noise(struct perf_evsel *evsel, double avg)
 			100 * stddev_stats(&ps->res_stats[0]) / avg);
 }
 
-static void nsec_printout(int cpu, struct perf_evsel *counter, double avg)
+static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg)
 {
 	double msecs = avg / 1e6;
 	char cpustr[16] = { '\0', };
@@ -485,18 +481,17 @@ static void nsec_printout(int cpu, struct perf_evsel *counter, double avg)
 			csv_output ? 0 : -4,
 			cpumap[cpu], csv_sep);
 
-	fprintf(stderr, fmt, cpustr, msecs, csv_sep, event_name(counter));
+	fprintf(stderr, fmt, cpustr, msecs, csv_sep, event_name(evsel));
 
 	if (csv_output)
 		return;
 
-	if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) {
+	if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK))
 		fprintf(stderr, " # %10.3f CPUs ",
 				avg / avg_stats(&walltime_nsecs_stats));
-	}
 }
 
-static void abs_printout(int cpu, struct perf_evsel *counter, double avg)
+static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
 {
 	double total, ratio = 0.0;
 	char cpustr[16] = { '\0', };
@@ -516,19 +511,19 @@ static void abs_printout(int cpu, struct perf_evsel *counter, double avg)
 	else
 		cpu = 0;
 
-	fprintf(stderr, fmt, cpustr, avg, csv_sep, event_name(counter));
+	fprintf(stderr, fmt, cpustr, avg, csv_sep, event_name(evsel));
 
 	if (csv_output)
 		return;
 
-	if (MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) {
+	if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
 		total = avg_stats(&runtime_cycles_stats[cpu]);
 
 		if (total)
 			ratio = avg / total;
 
 		fprintf(stderr, " # %10.3f IPC  ", ratio);
-	} else if (MATCH_EVENT(HARDWARE, HW_BRANCH_MISSES, counter) &&
+	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES) &&
 			runtime_branches_stats[cpu].n != 0) {
 		total = avg_stats(&runtime_branches_stats[cpu]);
 
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 3eb3989..8a5cfb6 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -21,4 +21,8 @@ void perf_evsel__delete(struct perf_evsel *evsel);
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
 
+#define perf_evsel__match(evsel, t, c)		\
+	(evsel->attr.type == PERF_TYPE_##t &&	\
+	 evsel->attr.config == PERF_COUNT_##c)
+
 #endif /* __PERF_EVSEL_H */

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

* [tip:perf/core] perf util: Move do_read from session to util
       [not found]             ` <new-submission>
                                 ` (663 preceding siblings ...)
  2011-01-04  8:21               ` [tip:perf/core] perf evsel: Adopt MATCH_EVENT macro from 'stat' tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:22               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:22               ` [tip:perf/core] perf evsel: Delete the event selectors at exit tip-bot for Arnaldo Carvalho de Melo
                                 ` (41 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  1e7972cc5c16e06f258b0278d8c9adfb5aa75c68
Gitweb:     http://git.kernel.org/tip/1e7972cc5c16e06f258b0278d8c9adfb5aa75c68
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 16:50:55 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 3 Jan 2011 16:50:55 -0200

perf util: Move do_read from session to util

Not really something to be exported from session.c. Rename it to
'readn' as others did in the past.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c  |    6 +++---
 tools/perf/util/session.c |   22 ++--------------------
 tools/perf/util/session.h |    1 -
 tools/perf/util/util.c    |   17 +++++++++++++++++
 tools/perf/util/util.h    |    1 +
 5 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index ecb5a84..05dec98 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -604,7 +604,7 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit)
 static int perf_header__getbuffer64(struct perf_header *self,
 				    int fd, void *buf, size_t size)
 {
-	if (do_read(fd, buf, size) <= 0)
+	if (readn(fd, buf, size) <= 0)
 		return -1;
 
 	if (self->needs_swap)
@@ -660,7 +660,7 @@ int perf_file_header__read(struct perf_file_header *self,
 {
 	lseek(fd, 0, SEEK_SET);
 
-	if (do_read(fd, self, sizeof(*self)) <= 0 ||
+	if (readn(fd, self, sizeof(*self)) <= 0 ||
 	    memcmp(&self->magic, __perf_magic, sizeof(self->magic)))
 		return -1;
 
@@ -821,7 +821,7 @@ static int perf_file_header__read_pipe(struct perf_pipe_file_header *self,
 				       struct perf_header *ph, int fd,
 				       bool repipe)
 {
-	if (do_read(fd, self, sizeof(*self)) <= 0 ||
+	if (readn(fd, self, sizeof(*self)) <= 0 ||
 	    memcmp(&self->magic, __perf_magic, sizeof(self->magic)))
 		return -1;
 
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0f7e544..b163dfd 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -838,23 +838,6 @@ static struct thread *perf_session__register_idle_thread(struct perf_session *se
 	return thread;
 }
 
-int do_read(int fd, void *buf, size_t size)
-{
-	void *buf_start = buf;
-
-	while (size) {
-		int ret = read(fd, buf, size);
-
-		if (ret <= 0)
-			return ret;
-
-		size -= ret;
-		buf += ret;
-	}
-
-	return buf - buf_start;
-}
-
 #define session_done()	(*(volatile int *)(&session_done))
 volatile int session_done;
 
@@ -872,7 +855,7 @@ static int __perf_session__process_pipe_events(struct perf_session *self,
 
 	head = 0;
 more:
-	err = do_read(self->fd, &event, sizeof(struct perf_event_header));
+	err = readn(self->fd, &event, sizeof(struct perf_event_header));
 	if (err <= 0) {
 		if (err == 0)
 			goto done;
@@ -892,8 +875,7 @@ more:
 	p += sizeof(struct perf_event_header);
 
 	if (size - sizeof(struct perf_event_header)) {
-		err = do_read(self->fd, p,
-			      size - sizeof(struct perf_event_header));
+		err = readn(self->fd, p, size - sizeof(struct perf_event_header));
 		if (err <= 0) {
 			if (err == 0) {
 				pr_err("unexpected end of event stream\n");
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index ffe4b98..decd83f 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -109,7 +109,6 @@ void mem_bswap_64(void *src, int byte_size);
 
 int perf_session__create_kernel_maps(struct perf_session *self);
 
-int do_read(int fd, void *buf, size_t size);
 void perf_session__update_sample_type(struct perf_session *self);
 void perf_session__set_sample_id_all(struct perf_session *session, bool value);
 void perf_session__set_sample_type(struct perf_session *session, u64 type);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 2142656..5b3ea49 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -114,3 +114,20 @@ unsigned long convert_unit(unsigned long value, char *unit)
 
 	return value;
 }
+
+int readn(int fd, void *buf, size_t n)
+{
+	void *buf_start = buf;
+
+	while (n) {
+		int ret = read(fd, buf, n);
+
+		if (ret <= 0)
+			return ret;
+
+		n -= ret;
+		buf += ret;
+	}
+
+	return buf - buf_start;
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 7562707..e833f26 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -265,6 +265,7 @@ void argv_free(char **argv);
 bool strglobmatch(const char *str, const char *pat);
 bool strlazymatch(const char *str, const char *pat);
 unsigned long convert_unit(unsigned long value, char *unit);
+int readn(int fd, void *buf, size_t size);
 
 #define _STR(x) #x
 #define STR(x) _STR(x)

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

* [tip:perf/core] perf evsel: Delete the event selectors at exit
       [not found]             ` <new-submission>
                                 ` (664 preceding siblings ...)
  2011-01-04  8:22               ` [tip:perf/core] perf util: Move do_read from session to util tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:22               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:23               ` [tip:perf/core] perf evsel: Steal the counter reading routines from stat tip-bot for Arnaldo Carvalho de Melo
                                 ` (40 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  70d544d0576775a2b3923a7e68cb49b0313d80c9
Gitweb:     http://git.kernel.org/tip/70d544d0576775a2b3923a7e68cb49b0313d80c9
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 16:51:39 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 3 Jan 2011 16:51:39 -0200

perf evsel: Delete the event selectors at exit

Freeing all the possibly allocated resources, reducing complexity
on each tool exit path.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c    |    2 --
 tools/perf/builtin-stat.c      |    4 +---
 tools/perf/builtin-top.c       |    4 +---
 tools/perf/perf.c              |    2 ++
 tools/perf/util/parse-events.c |   11 +++++++++++
 tools/perf/util/parse-events.h |    1 +
 6 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e68aee3..052de17 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -965,8 +965,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 out_free_event_array:
 	free(event_array);
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list, node)
-		perf_evsel__free_fd(pos);
 	free(all_tids);
 	all_tids = NULL;
 out_symbol_exit:
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3e5f356..589ba3a 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -844,10 +844,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 	if (status != -1)
 		print_stat(argc, argv);
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list, node) {
-		perf_evsel__free_fd(pos);
+	list_for_each_entry(pos, &evsel_list, node)
 		perf_evsel__free_stat_priv(pos);
-	}
 out:
 	return status;
 }
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 13a836e..27b9c14 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1495,10 +1495,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 
 	status = __cmd_top();
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list, node) {
-		perf_evsel__free_fd(pos);
+	list_for_each_entry(pos, &evsel_list, node)
 		perf_evsel__free_mmap(pos);
-	}
 
 	return status;
 }
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 595d0f4..5b1ecd6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -286,6 +286,8 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 	status = p->fn(argc, argv, prefix);
 	exit_browser(status);
 
+	perf_evsel_list__delete();
+
 	if (status)
 		return status & 0xff;
 
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 2d948ad..3a142e9 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -982,3 +982,14 @@ int perf_evsel_list__create_default(void)
 	++nr_counters;
 	return 0;
 }
+
+void perf_evsel_list__delete(void)
+{
+	struct perf_evsel *pos, *n;
+
+	list_for_each_entry_safe(pos, n, &evsel_list, node) {
+		list_del_init(&pos->node);
+		perf_evsel__delete(pos);
+	}
+	nr_counters = 0;
+}
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 0f915a0..0a0abc1 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -12,6 +12,7 @@ struct perf_evsel;
 extern struct list_head evsel_list;
 
 int perf_evsel_list__create_default(void);
+void perf_evsel_list__delete(void);
 
 struct option;
 

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

* [tip:perf/core] perf evsel: Steal the counter reading routines from stat
       [not found]             ` <new-submission>
                                 ` (665 preceding siblings ...)
  2011-01-04  8:22               ` [tip:perf/core] perf evsel: Delete the event selectors at exit tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:23               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:23               ` [tip:perf/core] perf evsel: Introduce per cpu and per thread open helpers tip-bot for Arnaldo Carvalho de Melo
                                 ` (39 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  c52b12ed2511e6c031a0295fd903ea72b93701fb
Gitweb:     http://git.kernel.org/tip/c52b12ed2511e6c031a0295fd903ea72b93701fb
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 17:45:52 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:22:55 -0200

perf evsel: Steal the counter reading routines from stat

Making them hopefully generic enough to be used in 'perf test',
well see.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |  121 +++++++++++----------------------------------
 tools/perf/util/evsel.c   |   88 ++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.h   |   79 +++++++++++++++++++++++++++++
 3 files changed, 196 insertions(+), 92 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 589ba3a..a8b00b4 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -93,12 +93,6 @@ static const char		*cpu_list;
 static const char		*csv_sep			= NULL;
 static bool			csv_output			= false;
 
-struct cpu_counts {
-	u64 val;
-	u64 ena;
-	u64 run;
-};
-
 static volatile int done = 0;
 
 struct stats
@@ -108,15 +102,11 @@ struct stats
 
 struct perf_stat {
 	struct stats	  res_stats[3];
-	int		  scaled;
-	struct cpu_counts cpu_counts[];
 };
 
-static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel, int ncpus)
+static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 {
-	size_t priv_size = (sizeof(struct perf_stat) +
-			    (ncpus * sizeof(struct cpu_counts)));
-	evsel->priv = zalloc(priv_size);
+	evsel->priv = zalloc(sizeof(struct perf_stat));
 	return evsel->priv == NULL ? -ENOMEM : 0;
 }
 
@@ -238,52 +228,14 @@ static inline int nsec_counter(struct perf_evsel *evsel)
  * Read out the results of a single counter:
  * aggregate counts across CPUs in system-wide mode
  */
-static void read_counter_aggr(struct perf_evsel *counter)
+static int read_counter_aggr(struct perf_evsel *counter)
 {
 	struct perf_stat *ps = counter->priv;
-	u64 count[3], single_count[3];
-	int cpu;
-	size_t res, nv;
-	int scaled;
-	int i, thread;
-
-	count[0] = count[1] = count[2] = 0;
-
-	nv = scale ? 3 : 1;
-	for (cpu = 0; cpu < nr_cpus; cpu++) {
-		for (thread = 0; thread < thread_num; thread++) {
-			if (FD(counter, cpu, thread) < 0)
-				continue;
-
-			res = read(FD(counter, cpu, thread),
-					single_count, nv * sizeof(u64));
-			assert(res == nv * sizeof(u64));
-
-			close(FD(counter, cpu, thread));
-			FD(counter, cpu, thread) = -1;
-
-			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) {
-			ps->scaled = -1;
-			count[0] = 0;
-			return;
-		}
+	u64 *count = counter->counts->aggr.values;
+	int i;
 
-		if (count[2] < count[1]) {
-			ps->scaled = 1;
-			count[0] = (unsigned long long)
-				((double)count[0] * count[1] / count[2] + 0.5);
-		}
-	}
+	if (__perf_evsel__read(counter, nr_cpus, thread_num, scale) < 0)
+		return -1;
 
 	for (i = 0; i < 3; i++)
 		update_stats(&ps->res_stats[i], count[i]);
@@ -302,46 +254,24 @@ static void read_counter_aggr(struct perf_evsel *counter)
 		update_stats(&runtime_cycles_stats[0], count[0]);
 	if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
 		update_stats(&runtime_branches_stats[0], count[0]);
+
+	return 0;
 }
 
 /*
  * Read out the results of a single counter:
  * do not aggregate counts across CPUs in system-wide mode
  */
-static void read_counter(struct perf_evsel *counter)
+static int read_counter(struct perf_evsel *counter)
 {
-	struct cpu_counts *cpu_counts = counter->priv;
-	u64 count[3];
+	u64 *count;
 	int cpu;
-	size_t res, nv;
-
-	count[0] = count[1] = count[2] = 0;
-
-	nv = scale ? 3 : 1;
 
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
+		if (__perf_evsel__read_on_cpu(counter, cpu, 0, scale) < 0)
+			return -1;
 
-		if (FD(counter, cpu, 0) < 0)
-			continue;
-
-		res = read(FD(counter, cpu, 0), count, nv * sizeof(u64));
-
-		assert(res == nv * sizeof(u64));
-
-		close(FD(counter, cpu, 0));
-		FD(counter, cpu, 0) = -1;
-
-		if (scale) {
-			if (count[2] == 0) {
-				count[0] = 0;
-			} else if (count[2] < count[1]) {
-				count[0] = (unsigned long long)
-				((double)count[0] * count[1] / count[2] + 0.5);
-			}
-		}
-		cpu_counts[cpu].val = count[0]; /* scaled count */
-		cpu_counts[cpu].ena = count[1];
-		cpu_counts[cpu].run = count[2];
+		count = counter->counts->cpu[cpu].values;
 
 		if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK))
 			update_stats(&runtime_nsecs_stats[cpu], count[0]);
@@ -350,6 +280,8 @@ static void read_counter(struct perf_evsel *counter)
 		if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
 			update_stats(&runtime_branches_stats[cpu], count[0]);
 	}
+
+	return 0;
 }
 
 static int run_perf_stat(int argc __used, const char **argv)
@@ -449,12 +381,17 @@ static int run_perf_stat(int argc __used, const char **argv)
 	update_stats(&walltime_nsecs_stats, t1 - t0);
 
 	if (no_aggr) {
-		list_for_each_entry(counter, &evsel_list, node)
+		list_for_each_entry(counter, &evsel_list, node) {
 			read_counter(counter);
+			perf_evsel__close_fd(counter, nr_cpus, 1);
+		}
 	} else {
-		list_for_each_entry(counter, &evsel_list, node)
+		list_for_each_entry(counter, &evsel_list, node) {
 			read_counter_aggr(counter);
+			perf_evsel__close_fd(counter, nr_cpus, thread_num);
+		}
 	}
+
 	return WEXITSTATUS(status);
 }
 
@@ -550,7 +487,7 @@ static void print_counter_aggr(struct perf_evsel *counter)
 {
 	struct perf_stat *ps = counter->priv;
 	double avg = avg_stats(&ps->res_stats[0]);
-	int scaled = ps->scaled;
+	int scaled = counter->counts->scaled;
 
 	if (scaled == -1) {
 		fprintf(stderr, "%*s%s%-24s\n",
@@ -590,14 +527,13 @@ static void print_counter_aggr(struct perf_evsel *counter)
  */
 static void print_counter(struct perf_evsel *counter)
 {
-	struct perf_stat *ps = counter->priv;
 	u64 ena, run, val;
 	int cpu;
 
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
-		val = ps->cpu_counts[cpu].val;
-		ena = ps->cpu_counts[cpu].ena;
-		run = ps->cpu_counts[cpu].run;
+		val = counter->counts->cpu[cpu].val;
+		ena = counter->counts->cpu[cpu].ena;
+		run = counter->counts->cpu[cpu].run;
 		if (run == 0 || ena == 0) {
 			fprintf(stderr, "CPU%*d%s%*s%s%-24s",
 				csv_output ? 0 : -4,
@@ -818,7 +754,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 	}
 
 	list_for_each_entry(pos, &evsel_list, node) {
-		if (perf_evsel__alloc_stat_priv(pos, nr_cpus) < 0 ||
+		if (perf_evsel__alloc_stat_priv(pos) < 0 ||
+		    perf_evsel__alloc_counts(pos, nr_cpus) < 0 ||
 		    perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
 			goto out_free_fd;
 	}
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6539ec9..3f5de51 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1,6 +1,8 @@
 #include "evsel.h"
 #include "util.h"
 
+#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
+
 struct perf_evsel *perf_evsel__new(u32 type, u64 config, int idx)
 {
 	struct perf_evsel *evsel = zalloc(sizeof(*evsel));
@@ -21,15 +23,101 @@ int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
 	return evsel->fd != NULL ? 0 : -ENOMEM;
 }
 
+int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus)
+{
+	evsel->counts = zalloc((sizeof(*evsel->counts) +
+				(ncpus * sizeof(struct perf_counts_values))));
+	return evsel->counts != NULL ? 0 : -ENOMEM;
+}
+
 void perf_evsel__free_fd(struct perf_evsel *evsel)
 {
 	xyarray__delete(evsel->fd);
 	evsel->fd = NULL;
 }
 
+void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
+{
+	int cpu, thread;
+
+	for (cpu = 0; cpu < ncpus; cpu++)
+		for (thread = 0; thread < nthreads; ++thread) {
+			close(FD(evsel, cpu, thread));
+			FD(evsel, cpu, thread) = -1;
+		}
+}
+
 void perf_evsel__delete(struct perf_evsel *evsel)
 {
 	assert(list_empty(&evsel->node));
 	xyarray__delete(evsel->fd);
 	free(evsel);
 }
+
+int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
+			      int cpu, int thread, bool scale)
+{
+	struct perf_counts_values count;
+	size_t nv = scale ? 3 : 1;
+
+	if (FD(evsel, cpu, thread) < 0)
+		return -EINVAL;
+
+	if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0)
+		return -errno;
+
+	if (scale) {
+		if (count.run == 0)
+			count.val = 0;
+		else if (count.run < count.ena)
+			count.val = (u64)((double)count.val * count.ena / count.run + 0.5);
+	} else
+		count.ena = count.run = 0;
+
+	evsel->counts->cpu[cpu] = count;
+	return 0;
+}
+
+int __perf_evsel__read(struct perf_evsel *evsel,
+		       int ncpus, int nthreads, bool scale)
+{
+	size_t nv = scale ? 3 : 1;
+	int cpu, thread;
+	struct perf_counts_values *aggr = &evsel->counts->aggr, count;
+
+	aggr->val = 0;
+
+	for (cpu = 0; cpu < ncpus; cpu++) {
+		for (thread = 0; thread < nthreads; thread++) {
+			if (FD(evsel, cpu, thread) < 0)
+				continue;
+
+			if (readn(FD(evsel, cpu, thread),
+				  &count, nv * sizeof(u64)) < 0)
+				return -errno;
+
+			aggr->val += count.val;
+			if (scale) {
+				aggr->ena += count.ena;
+				aggr->run += count.run;
+			}
+		}
+	}
+
+	evsel->counts->scaled = 0;
+	if (scale) {
+		if (aggr->run == 0) {
+			evsel->counts->scaled = -1;
+			aggr->val = 0;
+			return 0;
+		}
+
+		if (aggr->run < aggr->ena) {
+			evsel->counts->scaled = 1;
+			aggr->val = (u64)((double)aggr->val * aggr->ena / aggr->run + 0.5);
+		}
+	} else
+		aggr->ena = aggr->run = 0;
+
+	return 0;
+}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8a5cfb6..8b48ef1 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -2,15 +2,34 @@
 #define __PERF_EVSEL_H 1
 
 #include <linux/list.h>
+#include <stdbool.h>
 #include <linux/perf_event.h>
 #include "types.h"
 #include "xyarray.h"
+ 
+struct perf_counts_values {
+	union {
+		struct {
+			u64 val;
+			u64 ena;
+			u64 run;
+		};
+		u64 values[3];
+	};
+};
+
+struct perf_counts {
+	s8		   	  scaled;
+	struct perf_counts_values aggr;
+	struct perf_counts_values cpu[];
+};
 
 struct perf_evsel {
 	struct list_head	node;
 	struct perf_event_attr	attr;
 	char			*filter;
 	struct xyarray		*fd;
+	struct perf_counts	*counts;
 	int			idx;
 	void			*priv;
 };
@@ -19,10 +38,70 @@ struct perf_evsel *perf_evsel__new(u32 type, u64 config, int idx);
 void perf_evsel__delete(struct perf_evsel *evsel);
 
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
+int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
+void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\
 	 evsel->attr.config == PERF_COUNT_##c)
 
+int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
+			      int cpu, int thread, bool scale);
+
+/**
+ * perf_evsel__read_on_cpu - Read out the results on a CPU and thread
+ *
+ * @evsel - event selector to read value
+ * @cpu - CPU of interest
+ * @thread - thread of interest
+ */
+static inline int perf_evsel__read_on_cpu(struct perf_evsel *evsel,
+					  int cpu, int thread)
+{
+	return __perf_evsel__read_on_cpu(evsel, cpu, thread, false);
+}
+
+/**
+ * perf_evsel__read_on_cpu_scaled - Read out the results on a CPU and thread, scaled
+ *
+ * @evsel - event selector to read value
+ * @cpu - CPU of interest
+ * @thread - thread of interest
+ */
+static inline int perf_evsel__read_on_cpu_scaled(struct perf_evsel *evsel,
+						 int cpu, int thread)
+{
+	return __perf_evsel__read_on_cpu(evsel, cpu, thread, true);
+}
+
+int __perf_evsel__read(struct perf_evsel *evsel, int ncpus, int nthreads,
+		       bool scale);
+
+/**
+ * perf_evsel__read - Read the aggregate results on all CPUs
+ *
+ * @evsel - event selector to read value
+ * @ncpus - Number of cpus affected, from zero
+ * @nthreads - Number of threads affected, from zero
+ */
+static inline int perf_evsel__read(struct perf_evsel *evsel,
+				    int ncpus, int nthreads)
+{
+	return __perf_evsel__read(evsel, ncpus, nthreads, false);
+}
+
+/**
+ * perf_evsel__read_scaled - Read the aggregate results on all CPUs, scaled
+ *
+ * @evsel - event selector to read value
+ * @ncpus - Number of cpus affected, from zero
+ * @nthreads - Number of threads affected, from zero
+ */
+static inline int perf_evsel__read_scaled(struct perf_evsel *evsel,
+					  int ncpus, int nthreads)
+{
+	return __perf_evsel__read(evsel, ncpus, nthreads, true);
+}
+
 #endif /* __PERF_EVSEL_H */

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

* [tip:perf/core] perf evsel: Introduce per cpu and per thread open helpers
       [not found]             ` <new-submission>
                                 ` (666 preceding siblings ...)
  2011-01-04  8:23               ` [tip:perf/core] perf evsel: Steal the counter reading routines from stat tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:23               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor cpumap to hold nr and the map tip-bot for Arnaldo Carvalho de Melo
                                 ` (38 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  48290609c0d265f5dac0fca6fd4e3c5732542f67
Gitweb:     http://git.kernel.org/tip/48290609c0d265f5dac0fca6fd4e3c5732542f67
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 17:48:12 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:23:27 -0200

perf evsel: Introduce per cpu and per thread open helpers

Abstracting away the loops needed to create the various event fd handlers.

The users have to pass a confiruged perf->evsel.attr field, which is already
usable after perf_evsel__new (constructor) time, using defaults.

Comes out of the ad-hoc routines in builtin-stat, that now uses it.

Fixed a small silly bug where we were die()ing before killing our
children, dysfunctional family this one 8-)

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |   84 ++++++++++++++-------------------------------
 tools/perf/util/evsel.c   |   52 ++++++++++++++++++++++++++++
 tools/perf/util/evsel.h   |    5 +++
 3 files changed, 83 insertions(+), 58 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a8b00b4..065e79e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -53,8 +53,6 @@
 #include <math.h>
 #include <locale.h>
 
-#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
-
 #define DEFAULT_SEPARATOR	" "
 
 static struct perf_event_attr default_attrs[] = {
@@ -160,56 +158,24 @@ struct stats			runtime_cycles_stats[MAX_NR_CPUS];
 struct stats			runtime_branches_stats[MAX_NR_CPUS];
 struct stats			walltime_nsecs_stats;
 
-#define ERR_PERF_OPEN \
-"counter %d, sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information."
-
-static int create_perf_stat_counter(struct perf_evsel *evsel, bool *perm_err)
+static int create_perf_stat_counter(struct perf_evsel *evsel)
 {
 	struct perf_event_attr *attr = &evsel->attr;
-	int thread;
-	int ncreated = 0;
 
 	if (scale)
 		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(evsel, cpu, 0) = sys_perf_event_open(attr,
-					-1, cpumap[cpu], -1, 0);
-			if (FD(evsel, cpu, 0) < 0) {
-				if (errno == EPERM || errno == EACCES)
-					*perm_err = true;
-				error(ERR_PERF_OPEN, evsel->idx,
-					FD(evsel, cpu, 0), strerror(errno));
-			} else {
-				++ncreated;
-			}
-		}
-	} else {
-		attr->inherit = !no_inherit;
-		if (target_pid == -1 && target_tid == -1) {
-			attr->disabled = 1;
-			attr->enable_on_exec = 1;
-		}
-		for (thread = 0; thread < thread_num; thread++) {
-			FD(evsel, 0, thread) = sys_perf_event_open(attr,
-				all_tids[thread], -1, -1, 0);
-			if (FD(evsel, 0, thread) < 0) {
-				if (errno == EPERM || errno == EACCES)
-					*perm_err = true;
-				error(ERR_PERF_OPEN, evsel->idx,
-					FD(evsel, 0, thread),
-					 strerror(errno));
-			} else {
-				++ncreated;
-			}
-		}
+	if (system_wide)
+		return perf_evsel__open_per_cpu(evsel, nr_cpus, cpumap);
+
+	attr->inherit = !no_inherit;
+	if (target_pid == -1 && target_tid == -1) {
+		attr->disabled = 1;
+		attr->enable_on_exec = 1;
 	}
 
-	return ncreated;
+	return perf_evsel__open_per_thread(evsel, thread_num, all_tids);
 }
 
 /*
@@ -289,9 +255,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 	unsigned long long t0, t1;
 	struct perf_evsel *counter;
 	int status = 0;
-	int ncreated = 0;
 	int child_ready_pipe[2], go_pipe[2];
-	bool perm_err = false;
 	const bool forks = (argc > 0);
 	char buf;
 
@@ -349,19 +313,23 @@ static int run_perf_stat(int argc __used, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	list_for_each_entry(counter, &evsel_list, node)
-		ncreated += create_perf_stat_counter(counter, &perm_err);
-
-	if (ncreated < nr_counters) {
-		if (perm_err)
-			error("You may not have permission to collect %sstats.\n"
-			      "\t Consider tweaking"
-			      " /proc/sys/kernel/perf_event_paranoid or running as root.",
-			      system_wide ? "system-wide " : "");
-		die("Not all events could be opened.\n");
-		if (child_pid != -1)
-			kill(child_pid, SIGTERM);
-		return -1;
+	list_for_each_entry(counter, &evsel_list, node) {
+		if (create_perf_stat_counter(counter) < 0) {
+			if (errno == -EPERM || errno == -EACCES) {
+				error("You may not have permission to collect %sstats.\n"
+				      "\t Consider tweaking"
+				      " /proc/sys/kernel/perf_event_paranoid or running as root.",
+				      system_wide ? "system-wide " : "");
+			} else {
+				error("open_counter returned with %d (%s). "
+				      "/bin/dmesg may provide additional information.\n",
+				       errno, strerror(errno));
+			}
+			if (child_pid != -1)
+				kill(child_pid, SIGTERM);
+			die("Not all events could be opened.\n");
+			return -1;
+		}
 	}
 
 	/*
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3f5de51..e62cc5e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1,4 +1,5 @@
 #include "evsel.h"
+#include "../perf.h"
 #include "util.h"
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
@@ -121,3 +122,54 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 
 	return 0;
 }
+
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel, int ncpus, int *cpu_map)
+{
+	int cpu;
+
+	for (cpu = 0; cpu < ncpus; cpu++) {
+		FD(evsel, cpu, 0) = sys_perf_event_open(&evsel->attr, -1,
+							cpu_map[cpu], -1, 0);
+		if (FD(evsel, cpu, 0) < 0)
+			goto out_close;
+	}
+
+	return 0;
+
+out_close:
+	while (--cpu >= 0) {
+		close(FD(evsel, cpu, 0));
+		FD(evsel, cpu, 0) = -1;
+	}
+	return -1;
+}
+
+int perf_evsel__open_per_thread(struct perf_evsel *evsel, int nthreads, int *thread_map)
+{
+	int thread;
+
+	for (thread = 0; thread < nthreads; thread++) {
+		FD(evsel, 0, thread) = sys_perf_event_open(&evsel->attr,
+							   thread_map[thread], -1, -1, 0);
+		if (FD(evsel, 0, thread) < 0)
+			goto out_close;
+	}
+
+	return 0;
+
+out_close:
+	while (--thread >= 0) {
+		close(FD(evsel, 0, thread));
+		FD(evsel, 0, thread) = -1;
+	}
+	return -1;
+}
+
+int perf_evsel__open(struct perf_evsel *evsel, int ncpus, int nthreads,
+		     int *cpu_map, int *thread_map)
+{
+	if (nthreads < 0)
+		return perf_evsel__open_per_cpu(evsel, ncpus, cpu_map);
+
+	return perf_evsel__open_per_thread(evsel, nthreads, thread_map);
+}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8b48ef1..a62fb55 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -42,6 +42,11 @@ int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel, int ncpus, int *cpu_map);
+int perf_evsel__open_per_thread(struct perf_evsel *evsel, int nthreads, int *thread_map);
+int perf_evsel__open(struct perf_evsel *evsel, int ncpus, int nthreads,
+		     int *cpu_map, int *thread_map);
+
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\
 	 evsel->attr.config == PERF_COUNT_##c)

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

* [tip:perf/core] perf tools: Refactor cpumap to hold nr and the map
       [not found]             ` <new-submission>
                                 ` (667 preceding siblings ...)
  2011-01-04  8:23               ` [tip:perf/core] perf evsel: Introduce per cpu and per thread open helpers tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:24               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor all_tids " tip-bot for Arnaldo Carvalho de Melo
                                 ` (37 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  60d567e2d9187379d642f6aba7c8a52b3fd5d261
Gitweb:     http://git.kernel.org/tip/60d567e2d9187379d642f6aba7c8a52b3fd5d261
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 17:49:48 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:23:55 -0200

perf tools: Refactor cpumap to hold nr and the map

So that later, we can pass the cpu_map instance instead of (nr_cpus, cpu_map)
for things like perf_evsel__open and friends.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   14 +++---
 tools/perf/builtin-stat.c   |   36 ++++++------
 tools/perf/builtin-top.c    |   22 ++++----
 tools/perf/util/cpumap.c    |  123 +++++++++++++++++++++++++++++++++----------
 tools/perf/util/cpumap.h    |   10 +++-
 5 files changed, 138 insertions(+), 67 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 052de17..220e6e7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -39,7 +39,7 @@ static u64			user_interval			= ULLONG_MAX;
 static u64			default_interval		=      0;
 static u64			sample_type;
 
-static int			nr_cpus				=      0;
+static struct cpu_map		*cpus;
 static unsigned int		page_size;
 static unsigned int		mmap_pages			=    128;
 static unsigned int		user_freq 			= UINT_MAX;
@@ -670,8 +670,8 @@ static int __cmd_record(int argc, const char **argv)
 	if (!system_wide && no_inherit && !cpu_list) {
 		open_counters(-1);
 	} else {
-		for (i = 0; i < nr_cpus; i++)
-			open_counters(cpumap[i]);
+		for (i = 0; i < cpus->nr; i++)
+			open_counters(cpus->map[i]);
 	}
 
 	perf_session__set_sample_type(session, sample_type);
@@ -927,14 +927,14 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		thread_num = 1;
 	}
 
-	nr_cpus = read_cpu_map(cpu_list);
-	if (nr_cpus < 1) {
-		perror("failed to collect number of CPUs");
+	cpus = cpu_map__new(cpu_list);
+	if (cpus == NULL) {
+		perror("failed to parse CPUs map");
 		return -1;
 	}
 
 	list_for_each_entry(pos, &evsel_list, node) {
-		if (perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+		if (perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
 			goto out_free_fd;
 	}
 	event_array = malloc(
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 065e79e..3f4a431 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -72,7 +72,7 @@ static struct perf_event_attr default_attrs[] = {
 };
 
 static bool			system_wide			=  false;
-static int			nr_cpus				=  0;
+static struct cpu_map		*cpus;
 static int			run_idx				=  0;
 
 static int			run_count			=  1;
@@ -167,7 +167,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide)
-		return perf_evsel__open_per_cpu(evsel, nr_cpus, cpumap);
+		return perf_evsel__open_per_cpu(evsel, cpus->nr, cpus->map);
 
 	attr->inherit = !no_inherit;
 	if (target_pid == -1 && target_tid == -1) {
@@ -200,7 +200,7 @@ static int read_counter_aggr(struct perf_evsel *counter)
 	u64 *count = counter->counts->aggr.values;
 	int i;
 
-	if (__perf_evsel__read(counter, nr_cpus, thread_num, scale) < 0)
+	if (__perf_evsel__read(counter, cpus->nr, thread_num, scale) < 0)
 		return -1;
 
 	for (i = 0; i < 3; i++)
@@ -233,7 +233,7 @@ static int read_counter(struct perf_evsel *counter)
 	u64 *count;
 	int cpu;
 
-	for (cpu = 0; cpu < nr_cpus; cpu++) {
+	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		if (__perf_evsel__read_on_cpu(counter, cpu, 0, scale) < 0)
 			return -1;
 
@@ -259,9 +259,6 @@ static int run_perf_stat(int argc __used, const char **argv)
 	const bool forks = (argc > 0);
 	char buf;
 
-	if (!system_wide)
-		nr_cpus = 1;
-
 	if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
 		perror("failed to create pipes");
 		exit(1);
@@ -351,12 +348,12 @@ static int run_perf_stat(int argc __used, const char **argv)
 	if (no_aggr) {
 		list_for_each_entry(counter, &evsel_list, node) {
 			read_counter(counter);
-			perf_evsel__close_fd(counter, nr_cpus, 1);
+			perf_evsel__close_fd(counter, cpus->nr, 1);
 		}
 	} else {
 		list_for_each_entry(counter, &evsel_list, node) {
 			read_counter_aggr(counter);
-			perf_evsel__close_fd(counter, nr_cpus, thread_num);
+			perf_evsel__close_fd(counter, cpus->nr, thread_num);
 		}
 	}
 
@@ -384,7 +381,7 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg)
 	if (no_aggr)
 		sprintf(cpustr, "CPU%*d%s",
 			csv_output ? 0 : -4,
-			cpumap[cpu], csv_sep);
+			cpus->map[cpu], csv_sep);
 
 	fprintf(stderr, fmt, cpustr, msecs, csv_sep, event_name(evsel));
 
@@ -412,7 +409,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
 	if (no_aggr)
 		sprintf(cpustr, "CPU%*d%s",
 			csv_output ? 0 : -4,
-			cpumap[cpu], csv_sep);
+			cpus->map[cpu], csv_sep);
 	else
 		cpu = 0;
 
@@ -498,14 +495,14 @@ static void print_counter(struct perf_evsel *counter)
 	u64 ena, run, val;
 	int cpu;
 
-	for (cpu = 0; cpu < nr_cpus; cpu++) {
+	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		val = counter->counts->cpu[cpu].val;
 		ena = counter->counts->cpu[cpu].ena;
 		run = counter->counts->cpu[cpu].run;
 		if (run == 0 || ena == 0) {
 			fprintf(stderr, "CPU%*d%s%*s%s%-24s",
 				csv_output ? 0 : -4,
-				cpumap[cpu], csv_sep,
+				cpus->map[cpu], csv_sep,
 				csv_output ? 0 : 18,
 				"<not counted>", csv_sep,
 				event_name(counter));
@@ -697,12 +694,15 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 	}
 
 	if (system_wide)
-		nr_cpus = read_cpu_map(cpu_list);
+		cpus = cpu_map__new(cpu_list);
 	else
-		nr_cpus = 1;
+		cpus = cpu_map__dummy_new();
 
-	if (nr_cpus < 1)
+	if (cpus == NULL) {
+		perror("failed to parse CPUs map");
 		usage_with_options(stat_usage, options);
+		return -1;
+	}
 
 	if (target_pid != -1) {
 		target_tid = target_pid;
@@ -723,8 +723,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 
 	list_for_each_entry(pos, &evsel_list, node) {
 		if (perf_evsel__alloc_stat_priv(pos) < 0 ||
-		    perf_evsel__alloc_counts(pos, nr_cpus) < 0 ||
-		    perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+		    perf_evsel__alloc_counts(pos, cpus->nr) < 0 ||
+		    perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
 			goto out_free_fd;
 	}
 
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 27b9c14..0e42666 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -71,7 +71,7 @@ static int			target_tid			=     -1;
 static pid_t			*all_tids			=      NULL;
 static int			thread_num			=      0;
 static bool			inherit				=  false;
-static int			nr_cpus				=      0;
+static struct cpu_map		*cpus;
 static int			realtime_prio			=      0;
 static bool			group				=  false;
 static unsigned int		page_size;
@@ -564,12 +564,12 @@ static void print_sym_table(void)
 		printf(" (all");
 
 	if (cpu_list)
-		printf(", CPU%s: %s)\n", nr_cpus > 1 ? "s" : "", cpu_list);
+		printf(", CPU%s: %s)\n", cpus->nr > 1 ? "s" : "", cpu_list);
 	else {
 		if (target_tid != -1)
 			printf(")\n");
 		else
-			printf(", %d CPU%s)\n", nr_cpus, nr_cpus > 1 ? "s" : "");
+			printf(", %d CPU%s)\n", cpus->nr, cpus->nr > 1 ? "s" : "");
 	}
 
 	printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
@@ -1197,7 +1197,7 @@ static void perf_session__mmap_read(struct perf_session *self)
 	struct perf_evsel *counter;
 	int i, thread_index;
 
-	for (i = 0; i < nr_cpus; i++) {
+	for (i = 0; i < cpus->nr; i++) {
 		list_for_each_entry(counter, &evsel_list, node) {
 			for (thread_index = 0;
 				thread_index < thread_num;
@@ -1221,7 +1221,7 @@ static void start_counter(int i, struct perf_evsel *evsel)
 	int thread_index;
 
 	if (target_tid == -1)
-		cpu = cpumap[i];
+		cpu = cpus->map[i];
 
 	attr = &evsel->attr;
 
@@ -1310,7 +1310,7 @@ static int __cmd_top(void)
 	else
 		event__synthesize_threads(event__process, session);
 
-	for (i = 0; i < nr_cpus; i++) {
+	for (i = 0; i < cpus->nr; i++) {
 		group_fd = -1;
 		list_for_each_entry(counter, &evsel_list, node)
 			start_counter(i, counter);
@@ -1460,16 +1460,16 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	}
 
 	if (target_tid != -1)
-		nr_cpus = 1;
+		cpus = cpu_map__dummy_new();
 	else
-		nr_cpus = read_cpu_map(cpu_list);
+		cpus = cpu_map__new(cpu_list);
 
-	if (nr_cpus < 1)
+	if (cpus == NULL)
 		usage_with_options(top_usage, options);
 
 	list_for_each_entry(pos, &evsel_list, node) {
-		if (perf_evsel__alloc_mmap_per_thread(pos, nr_cpus, thread_num) < 0 ||
-		    perf_evsel__alloc_fd(pos, nr_cpus, thread_num) < 0)
+		if (perf_evsel__alloc_mmap_per_thread(pos, cpus->nr, thread_num) < 0 ||
+		    perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
 			goto out_free_fd;
 		/*
 		 * Fill in the ones not specifically initialized via -c:
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 0f9b8d7..3ccaa10 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -4,32 +4,53 @@
 #include <assert.h>
 #include <stdio.h>
 
-int cpumap[MAX_NR_CPUS];
-
-static int default_cpu_map(void)
+static struct cpu_map *cpu_map__default_new(void)
 {
-	int nr_cpus, i;
+	struct cpu_map *cpus;
+	int nr_cpus;
 
 	nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	assert(nr_cpus <= MAX_NR_CPUS);
-	assert((int)nr_cpus >= 0);
+	if (nr_cpus < 0)
+		return NULL;
+
+	cpus = malloc(sizeof(*cpus) + nr_cpus * sizeof(int));
+	if (cpus != NULL) {
+		int i;
+		for (i = 0; i < nr_cpus; ++i)
+			cpus->map[i] = i;
 
-	for (i = 0; i < nr_cpus; ++i)
-		cpumap[i] = i;
+		cpus->nr = nr_cpus;
+	}
 
-	return nr_cpus;
+	return cpus;
 }
 
-static int read_all_cpu_map(void)
+static struct cpu_map *cpu_map__trim_new(int nr_cpus, int *tmp_cpus)
 {
+	size_t payload_size = nr_cpus * sizeof(int);
+	struct cpu_map *cpus = malloc(sizeof(*cpus) + payload_size);
+
+	if (cpus != NULL) {
+		cpus->nr = nr_cpus;
+		memcpy(cpus->map, tmp_cpus, payload_size);
+	}
+
+	return cpus;
+}
+
+static struct cpu_map *cpu_map__read_all_cpu_map(void)
+{
+	struct cpu_map *cpus = NULL;
 	FILE *onlnf;
 	int nr_cpus = 0;
+	int *tmp_cpus = NULL, *tmp;
+	int max_entries = 0;
 	int n, cpu, prev;
 	char sep;
 
 	onlnf = fopen("/sys/devices/system/cpu/online", "r");
 	if (!onlnf)
-		return default_cpu_map();
+		return cpu_map__default_new();
 
 	sep = 0;
 	prev = -1;
@@ -38,12 +59,28 @@ static int read_all_cpu_map(void)
 		if (n <= 0)
 			break;
 		if (prev >= 0) {
-			assert(nr_cpus + cpu - prev - 1 < MAX_NR_CPUS);
+			int new_max = nr_cpus + cpu - prev - 1;
+
+			if (new_max >= max_entries) {
+				max_entries = new_max + MAX_NR_CPUS / 2;
+				tmp = realloc(tmp_cpus, max_entries * sizeof(int));
+				if (tmp == NULL)
+					goto out_free_tmp;
+				tmp_cpus = tmp;
+			}
+
 			while (++prev < cpu)
-				cpumap[nr_cpus++] = prev;
+				tmp_cpus[nr_cpus++] = prev;
+		}
+		if (nr_cpus == max_entries) {
+			max_entries += MAX_NR_CPUS;
+			tmp = realloc(tmp_cpus, max_entries * sizeof(int));
+			if (tmp == NULL)
+				goto out_free_tmp;
+			tmp_cpus = tmp;
 		}
-		assert (nr_cpus < MAX_NR_CPUS);
-		cpumap[nr_cpus++] = cpu;
+
+		tmp_cpus[nr_cpus++] = cpu;
 		if (n == 2 && sep == '-')
 			prev = cpu;
 		else
@@ -51,24 +88,31 @@ static int read_all_cpu_map(void)
 		if (n == 1 || sep == '\n')
 			break;
 	}
-	fclose(onlnf);
-	if (nr_cpus > 0)
-		return nr_cpus;
 
-	return default_cpu_map();
+	if (nr_cpus > 0)
+		cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
+	else
+		cpus = cpu_map__default_new();
+out_free_tmp:
+	free(tmp_cpus);
+	fclose(onlnf);
+	return cpus;
 }
 
-int read_cpu_map(const char *cpu_list)
+struct cpu_map *cpu_map__new(const char *cpu_list)
 {
+	struct cpu_map *cpus = NULL;
 	unsigned long start_cpu, end_cpu = 0;
 	char *p = NULL;
 	int i, nr_cpus = 0;
+	int *tmp_cpus = NULL, *tmp;
+	int max_entries = 0;
 
 	if (!cpu_list)
-		return read_all_cpu_map();
+		return cpu_map__read_all_cpu_map();
 
 	if (!isdigit(*cpu_list))
-		goto invalid;
+		goto out;
 
 	while (isdigit(*cpu_list)) {
 		p = NULL;
@@ -94,21 +138,42 @@ int read_cpu_map(const char *cpu_list)
 		for (; start_cpu <= end_cpu; start_cpu++) {
 			/* check for duplicates */
 			for (i = 0; i < nr_cpus; i++)
-				if (cpumap[i] == (int)start_cpu)
+				if (tmp_cpus[i] == (int)start_cpu)
 					goto invalid;
 
-			assert(nr_cpus < MAX_NR_CPUS);
-			cpumap[nr_cpus++] = (int)start_cpu;
+			if (nr_cpus == max_entries) {
+				max_entries += MAX_NR_CPUS;
+				tmp = realloc(tmp_cpus, max_entries * sizeof(int));
+				if (tmp == NULL)
+					goto invalid;
+				tmp_cpus = tmp;
+			}
+			tmp_cpus[nr_cpus++] = (int)start_cpu;
 		}
 		if (*p)
 			++p;
 
 		cpu_list = p;
 	}
-	if (nr_cpus > 0)
-		return nr_cpus;
 
-	return default_cpu_map();
+	if (nr_cpus > 0)
+		cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
+	else
+		cpus = cpu_map__default_new();
 invalid:
-	return -1;
+	free(tmp_cpus);
+out:
+	return cpus;
+}
+
+struct cpu_map *cpu_map__dummy_new(void)
+{
+	struct cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int));
+
+	if (cpus != NULL) {
+		cpus->nr = 1;
+		cpus->map[0] = -1;
+	}
+
+	return cpus;
 }
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 3e60f56..f7a4f42 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -1,7 +1,13 @@
 #ifndef __PERF_CPUMAP_H
 #define __PERF_CPUMAP_H
 
-extern int read_cpu_map(const char *cpu_list);
-extern int cpumap[];
+struct cpu_map {
+	int nr;
+	int map[];
+};
+
+struct cpu_map *cpu_map__new(const char *cpu_list);
+struct cpu_map *cpu_map__dummy_new(void);
+void *cpu_map__delete(struct cpu_map *map);
 
 #endif /* __PERF_CPUMAP_H */

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

* [tip:perf/core] perf tools: Refactor all_tids to hold nr and the map
       [not found]             ` <new-submission>
                                 ` (668 preceding siblings ...)
  2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor cpumap to hold nr and the map tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:24               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:25               ` [tip:perf/core] perf evsel: Use {cpu,thread}_map to shorten list of parameters tip-bot for Arnaldo Carvalho de Melo
                                 ` (36 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  5c98d466e49267a9221f30958d45cd06f794269a
Gitweb:     http://git.kernel.org/tip/5c98d466e49267a9221f30958d45cd06f794269a
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 17:53:33 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:24:16 -0200

perf tools: Refactor all_tids to hold nr and the map

So that later, we can pass the thread_map instance instead of
(thread_num, thread_map) for things like perf_evsel__open and friends,
just like was done with cpu_map.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   39 +++++++++++++++------------------------
 tools/perf/builtin-stat.c   |   41 +++++++++++++++++------------------------
 tools/perf/builtin-top.c    |   35 +++++++++++++----------------------
 tools/perf/util/thread.c    |   43 +++++++++++++++++++++++++++++--------------
 tools/perf/util/thread.h    |   15 ++++++++++++++-
 5 files changed, 88 insertions(+), 85 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 220e6e7..7bc0490 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -54,8 +54,7 @@ static bool			sample_id_all_avail		=   true;
 static bool			system_wide			=  false;
 static pid_t			target_pid			=     -1;
 static pid_t			target_tid			=     -1;
-static pid_t			*all_tids			=      NULL;
-static int			thread_num			=      0;
+static struct thread_map	*threads;
 static pid_t			child_pid			=     -1;
 static bool			no_inherit			=  false;
 static enum write_mode_t	write_mode			= WRITE_FORCE;
@@ -318,9 +317,9 @@ static void create_counter(struct perf_evsel *evsel, int cpu)
 retry_sample_id:
 	attr->sample_id_all = sample_id_all_avail ? 1 : 0;
 
-	for (thread_index = 0; thread_index < thread_num; thread_index++) {
+	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
 try_again:
-		FD(evsel, nr_cpu, thread_index) = sys_perf_event_open(attr, all_tids[thread_index], cpu, group_fd, 0);
+		FD(evsel, nr_cpu, thread_index) = sys_perf_event_open(attr, threads->map[thread_index], cpu, group_fd, 0);
 
 		if (FD(evsel, nr_cpu, thread_index) < 0) {
 			int err = errno;
@@ -653,7 +652,7 @@ static int __cmd_record(int argc, const char **argv)
 		}
 
 		if (!system_wide && target_tid == -1 && target_pid == -1)
-			all_tids[0] = child_pid;
+			threads->map[0] = child_pid;
 
 		close(child_ready_pipe[1]);
 		close(go_pipe[0]);
@@ -793,7 +792,7 @@ static int __cmd_record(int argc, const char **argv)
 
 				list_for_each_entry(pos, &evsel_list, node) {
 					for (thread = 0;
-						thread < thread_num;
+						thread < threads->nr;
 						thread++)
 						ioctl(FD(pos, i, thread),
 							PERF_EVENT_IOC_DISABLE);
@@ -910,21 +909,13 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		goto out_symbol_exit;
 	}
 
-	if (target_pid != -1) {
+	if (target_pid != -1)
 		target_tid = target_pid;
-		thread_num = find_all_tid(target_pid, &all_tids);
-		if (thread_num <= 0) {
-			fprintf(stderr, "Can't find all threads of pid %d\n",
-					target_pid);
-			usage_with_options(record_usage, record_options);
-		}
-	} else {
-		all_tids=malloc(sizeof(pid_t));
-		if (!all_tids)
-			goto out_symbol_exit;
 
-		all_tids[0] = target_tid;
-		thread_num = 1;
+	threads = thread_map__new(target_pid, target_tid);
+	if (threads == NULL) {
+		pr_err("Problems finding threads of monitor\n");
+		usage_with_options(record_usage, record_options);
 	}
 
 	cpus = cpu_map__new(cpu_list);
@@ -934,11 +925,11 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	}
 
 	list_for_each_entry(pos, &evsel_list, node) {
-		if (perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
+		if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 	}
-	event_array = malloc(
-		sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
+	event_array = malloc((sizeof(struct pollfd) * MAX_NR_CPUS *
+			      MAX_COUNTERS * threads->nr));
 	if (!event_array)
 		goto out_free_fd;
 
@@ -965,8 +956,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 out_free_event_array:
 	free(event_array);
 out_free_fd:
-	free(all_tids);
-	all_tids = NULL;
+	thread_map__delete(threads);
+	threads = NULL;
 out_symbol_exit:
 	symbol__exit();
 	return err;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3f4a431..6b9146c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -81,8 +81,7 @@ static bool			scale				=  true;
 static bool			no_aggr				= false;
 static pid_t			target_pid			= -1;
 static pid_t			target_tid			= -1;
-static pid_t			*all_tids			=  NULL;
-static int			thread_num			=  0;
+static struct thread_map	*threads;
 static pid_t			child_pid			= -1;
 static bool			null_run			=  false;
 static bool			big_num				=  true;
@@ -175,7 +174,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 		attr->enable_on_exec = 1;
 	}
 
-	return perf_evsel__open_per_thread(evsel, thread_num, all_tids);
+	return perf_evsel__open_per_thread(evsel, threads->nr, threads->map);
 }
 
 /*
@@ -200,7 +199,7 @@ static int read_counter_aggr(struct perf_evsel *counter)
 	u64 *count = counter->counts->aggr.values;
 	int i;
 
-	if (__perf_evsel__read(counter, cpus->nr, thread_num, scale) < 0)
+	if (__perf_evsel__read(counter, cpus->nr, threads->nr, scale) < 0)
 		return -1;
 
 	for (i = 0; i < 3; i++)
@@ -298,7 +297,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 		}
 
 		if (target_tid == -1 && target_pid == -1 && !system_wide)
-			all_tids[0] = child_pid;
+			threads->map[0] = child_pid;
 
 		/*
 		 * Wait for the child to be ready to exec.
@@ -353,7 +352,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 	} else {
 		list_for_each_entry(counter, &evsel_list, node) {
 			read_counter_aggr(counter);
-			perf_evsel__close_fd(counter, cpus->nr, thread_num);
+			perf_evsel__close_fd(counter, cpus->nr, threads->nr);
 		}
 	}
 
@@ -693,6 +692,15 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		}
 	}
 
+	if (target_pid != -1)
+		target_tid = target_pid;
+
+	threads = thread_map__new(target_pid, target_tid);
+	if (threads == NULL) {
+		pr_err("Problems finding threads of monitor\n");
+		usage_with_options(stat_usage, options);
+	}
+
 	if (system_wide)
 		cpus = cpu_map__new(cpu_list);
 	else
@@ -704,27 +712,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		return -1;
 	}
 
-	if (target_pid != -1) {
-		target_tid = target_pid;
-		thread_num = find_all_tid(target_pid, &all_tids);
-		if (thread_num <= 0) {
-			fprintf(stderr, "Can't find all threads of pid %d\n",
-					target_pid);
-			usage_with_options(stat_usage, options);
-		}
-	} else {
-		all_tids=malloc(sizeof(pid_t));
-		if (!all_tids)
-			return -ENOMEM;
-
-		all_tids[0] = target_tid;
-		thread_num = 1;
-	}
-
 	list_for_each_entry(pos, &evsel_list, node) {
 		if (perf_evsel__alloc_stat_priv(pos) < 0 ||
 		    perf_evsel__alloc_counts(pos, cpus->nr) < 0 ||
-		    perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
+		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 	}
 
@@ -752,5 +743,7 @@ out_free_fd:
 	list_for_each_entry(pos, &evsel_list, node)
 		perf_evsel__free_stat_priv(pos);
 out:
+	thread_map__delete(threads);
+	threads = NULL;
 	return status;
 }
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0e42666..1e67ab9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -68,8 +68,7 @@ static int			print_entries;
 
 static int			target_pid			=     -1;
 static int			target_tid			=     -1;
-static pid_t			*all_tids			=      NULL;
-static int			thread_num			=      0;
+static struct thread_map	*threads;
 static bool			inherit				=  false;
 static struct cpu_map		*cpus;
 static int			realtime_prio			=      0;
@@ -1200,7 +1199,7 @@ static void perf_session__mmap_read(struct perf_session *self)
 	for (i = 0; i < cpus->nr; i++) {
 		list_for_each_entry(counter, &evsel_list, node) {
 			for (thread_index = 0;
-				thread_index < thread_num;
+				thread_index < threads->nr;
 				thread_index++) {
 				perf_session__mmap_read_counter(self,
 					counter, i, thread_index);
@@ -1236,10 +1235,10 @@ static void start_counter(int i, struct perf_evsel *evsel)
 	attr->inherit		= (cpu < 0) && inherit;
 	attr->mmap		= 1;
 
-	for (thread_index = 0; thread_index < thread_num; thread_index++) {
+	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
 try_again:
 		FD(evsel, i, thread_index) = sys_perf_event_open(attr,
-				all_tids[thread_index], cpu, group_fd, 0);
+				threads->map[thread_index], cpu, group_fd, 0);
 
 		if (FD(evsel, i, thread_index) < 0) {
 			int err = errno;
@@ -1410,25 +1409,17 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	if (argc)
 		usage_with_options(top_usage, options);
 
-	if (target_pid != -1) {
+	if (target_pid != -1)
 		target_tid = target_pid;
-		thread_num = find_all_tid(target_pid, &all_tids);
-		if (thread_num <= 0) {
-			fprintf(stderr, "Can't find all threads of pid %d\n",
-				target_pid);
-			usage_with_options(top_usage, options);
-		}
-	} else {
-		all_tids=malloc(sizeof(pid_t));
-		if (!all_tids)
-			return -ENOMEM;
 
-		all_tids[0] = target_tid;
-		thread_num = 1;
+	threads = thread_map__new(target_pid, target_tid);
+	if (threads == NULL) {
+		pr_err("Problems finding threads of monitor\n");
+		usage_with_options(top_usage, options);
 	}
 
-	event_array = malloc(
-		sizeof(struct pollfd)*MAX_NR_CPUS*MAX_COUNTERS*thread_num);
+	event_array = malloc((sizeof(struct pollfd) *
+			      MAX_NR_CPUS * MAX_COUNTERS * threads->nr));
 	if (!event_array)
 		return -ENOMEM;
 
@@ -1468,8 +1459,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(top_usage, options);
 
 	list_for_each_entry(pos, &evsel_list, node) {
-		if (perf_evsel__alloc_mmap_per_thread(pos, cpus->nr, thread_num) < 0 ||
-		    perf_evsel__alloc_fd(pos, cpus->nr, thread_num) < 0)
+		if (perf_evsel__alloc_mmap_per_thread(pos, cpus->nr, threads->nr) < 0 ||
+		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 		/*
 		 * Fill in the ones not specifically initialized via -c:
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 8c72d88..00f4ead 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -16,35 +16,50 @@ static int filter(const struct dirent *dir)
 		return 1;
 }
 
-int find_all_tid(int pid, pid_t ** all_tid)
+struct thread_map *thread_map__new_by_pid(pid_t pid)
 {
+	struct thread_map *threads;
 	char name[256];
 	int items;
 	struct dirent **namelist = NULL;
-	int ret = 0;
 	int i;
 
 	sprintf(name, "/proc/%d/task", pid);
 	items = scandir(name, &namelist, filter, NULL);
 	if (items <= 0)
-                return -ENOENT;
-	*all_tid = malloc(sizeof(pid_t) * items);
-	if (!*all_tid) {
-		ret = -ENOMEM;
-		goto failure;
-	}
-
-	for (i = 0; i < items; i++)
-		(*all_tid)[i] = atoi(namelist[i]->d_name);
+                return NULL;
 
-	ret = items;
+	threads = malloc(sizeof(*threads) + sizeof(pid_t) * items);
+	if (threads != NULL) {
+		for (i = 0; i < items; i++)
+			threads->map[i] = atoi(namelist[i]->d_name);
+		threads->nr = items;
+	}
 
-failure:
 	for (i=0; i<items; i++)
 		free(namelist[i]);
 	free(namelist);
 
-	return ret;
+	return threads;
+}
+
+struct thread_map *thread_map__new_by_tid(pid_t tid)
+{
+	struct thread_map *threads = malloc(sizeof(*threads) + sizeof(pid_t));
+
+	if (threads != NULL) {
+		threads->map[0] = tid;
+		threads->nr	= 1;
+	}
+
+	return threads;
+}
+
+struct thread_map *thread_map__new(pid_t pid, pid_t tid)
+{
+	if (pid != -1)
+		return thread_map__new_by_pid(pid);
+	return thread_map__new_by_tid(tid);
 }
 
 static struct thread *thread__new(pid_t pid)
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 688500f..d757410 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -18,11 +18,24 @@ struct thread {
 	int			comm_len;
 };
 
+struct thread_map {
+	int nr;
+	int map[];
+};
+
 struct perf_session;
 
 void thread__delete(struct thread *self);
 
-int find_all_tid(int pid, pid_t ** all_tid);
+struct thread_map *thread_map__new_by_pid(pid_t pid);
+struct thread_map *thread_map__new_by_tid(pid_t tid);
+struct thread_map *thread_map__new(pid_t pid, pid_t tid);
+
+static inline void thread_map__delete(struct thread_map *threads)
+{
+	free(threads);
+}
+
 int thread__set_comm(struct thread *self, const char *comm);
 int thread__comm_len(struct thread *self);
 struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);

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

* [tip:perf/core] perf evsel: Use {cpu,thread}_map to shorten list of parameters
       [not found]             ` <new-submission>
                                 ` (669 preceding siblings ...)
  2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor all_tids " tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:25               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:25               ` [tip:perf/core] perf evsel: Auto allocate resources needed for some methods tip-bot for Arnaldo Carvalho de Melo
                                 ` (35 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  86bd5e8603b00b06189328c6d7034d2dc434d6bb
Gitweb:     http://git.kernel.org/tip/86bd5e8603b00b06189328c6d7034d2dc434d6bb
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 3 Jan 2011 23:09:46 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:24:36 -0200

perf evsel: Use {cpu,thread}_map to shorten list of parameters

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |    4 ++--
 tools/perf/util/evsel.c   |   24 +++++++++++++-----------
 tools/perf/util/evsel.h   |   11 +++++++----
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6b9146c..02b2d80 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -166,7 +166,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide)
-		return perf_evsel__open_per_cpu(evsel, cpus->nr, cpus->map);
+		return perf_evsel__open_per_cpu(evsel, cpus);
 
 	attr->inherit = !no_inherit;
 	if (target_pid == -1 && target_tid == -1) {
@@ -174,7 +174,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 		attr->enable_on_exec = 1;
 	}
 
-	return perf_evsel__open_per_thread(evsel, threads->nr, threads->map);
+	return perf_evsel__open_per_thread(evsel, threads);
 }
 
 /*
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e62cc5e..e44be52 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1,6 +1,8 @@
 #include "evsel.h"
 #include "../perf.h"
 #include "util.h"
+#include "cpumap.h"
+#include "thread.h"
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 
@@ -123,13 +125,13 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 	return 0;
 }
 
-int perf_evsel__open_per_cpu(struct perf_evsel *evsel, int ncpus, int *cpu_map)
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
 {
 	int cpu;
 
-	for (cpu = 0; cpu < ncpus; cpu++) {
+	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		FD(evsel, cpu, 0) = sys_perf_event_open(&evsel->attr, -1,
-							cpu_map[cpu], -1, 0);
+							cpus->map[cpu], -1, 0);
 		if (FD(evsel, cpu, 0) < 0)
 			goto out_close;
 	}
@@ -144,13 +146,13 @@ out_close:
 	return -1;
 }
 
-int perf_evsel__open_per_thread(struct perf_evsel *evsel, int nthreads, int *thread_map)
+int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads)
 {
 	int thread;
 
-	for (thread = 0; thread < nthreads; thread++) {
+	for (thread = 0; thread < threads->nr; thread++) {
 		FD(evsel, 0, thread) = sys_perf_event_open(&evsel->attr,
-							   thread_map[thread], -1, -1, 0);
+							   threads->map[thread], -1, -1, 0);
 		if (FD(evsel, 0, thread) < 0)
 			goto out_close;
 	}
@@ -165,11 +167,11 @@ out_close:
 	return -1;
 }
 
-int perf_evsel__open(struct perf_evsel *evsel, int ncpus, int nthreads,
-		     int *cpu_map, int *thread_map)
+int perf_evsel__open(struct perf_evsel *evsel, 
+		     struct cpu_map *cpus, struct thread_map *threads)
 {
-	if (nthreads < 0)
-		return perf_evsel__open_per_cpu(evsel, ncpus, cpu_map);
+	if (threads == NULL)
+		return perf_evsel__open_per_cpu(evsel, cpus);
 
-	return perf_evsel__open_per_thread(evsel, nthreads, thread_map);
+	return perf_evsel__open_per_thread(evsel, threads);
 }
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index a62fb55..863d78d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -34,6 +34,9 @@ struct perf_evsel {
 	void			*priv;
 };
 
+struct cpu_map;
+struct thread_map;
+
 struct perf_evsel *perf_evsel__new(u32 type, u64 config, int idx);
 void perf_evsel__delete(struct perf_evsel *evsel);
 
@@ -42,10 +45,10 @@ int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
-int perf_evsel__open_per_cpu(struct perf_evsel *evsel, int ncpus, int *cpu_map);
-int perf_evsel__open_per_thread(struct perf_evsel *evsel, int nthreads, int *thread_map);
-int perf_evsel__open(struct perf_evsel *evsel, int ncpus, int nthreads,
-		     int *cpu_map, int *thread_map);
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus);
+int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads);
+int perf_evsel__open(struct perf_evsel *evsel, 
+		     struct cpu_map *cpus, struct thread_map *threads);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\

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

* [tip:perf/core] perf evsel: Auto allocate resources needed for some methods
       [not found]             ` <new-submission>
                                 ` (670 preceding siblings ...)
  2011-01-04  8:25               ` [tip:perf/core] perf evsel: Use {cpu,thread}_map to shorten list of parameters tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:25               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-04  8:26               ` [tip:perf/core] perf test: Add test for counting open syscalls tip-bot for Arnaldo Carvalho de Melo
                                 ` (34 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  4eed11d5e24540dc133003b6e8f904cb747ac4bb
Gitweb:     http://git.kernel.org/tip/4eed11d5e24540dc133003b6e8f904cb747ac4bb
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 00:13:17 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:31:32 -0200

perf evsel: Auto allocate resources needed for some methods

While writing the first user of the routines created from the ad-hoc
routines in the existing builtins I noticed that the resulting set of
calls was too long, reduce it by doing some best effort allocations.

Tools that need to operate on multiple threads and cpus should pre-allocate
enough resources by explicitely calling the perf_evsel__alloc_{fd,counters}
methods.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e44be52..c95267e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -66,6 +66,9 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
 	if (FD(evsel, cpu, thread) < 0)
 		return -EINVAL;
 
+	if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1) < 0)
+		return -ENOMEM;
+
 	if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0)
 		return -errno;
 
@@ -129,6 +132,9 @@ int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
 {
 	int cpu;
 
+	if (evsel->fd == NULL && perf_evsel__alloc_fd(evsel, cpus->nr, 1) < 0)
+		return -1;
+
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		FD(evsel, cpu, 0) = sys_perf_event_open(&evsel->attr, -1,
 							cpus->map[cpu], -1, 0);
@@ -150,6 +156,9 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *thr
 {
 	int thread;
 
+	if (evsel->fd == NULL && perf_evsel__alloc_fd(evsel, 1, threads->nr))
+		return -1;
+
 	for (thread = 0; thread < threads->nr; thread++) {
 		FD(evsel, 0, thread) = sys_perf_event_open(&evsel->attr,
 							   threads->map[thread], -1, -1, 0);

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

* [tip:perf/core] perf test: Add test for counting open syscalls
       [not found]             ` <new-submission>
                                 ` (671 preceding siblings ...)
  2011-01-04  8:25               ` [tip:perf/core] perf evsel: Auto allocate resources needed for some methods tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-04  8:26               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-05 17:36               ` [tip:perf/core] perf test: Clarify some error reports in the open syscall test tip-bot for Arnaldo Carvalho de Melo
                                 ` (33 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-04  8:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, phan, tglx, mingo

Commit-ID:  d854861c4292a4e675a5d3bfd862c5f7421c81e8
Gitweb:     http://git.kernel.org/tip/d854861c4292a4e675a5d3bfd862c5f7421c81e8
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 00:16:20 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 Jan 2011 00:32:06 -0200

perf test: Add test for counting open syscalls

To test the use of the perf_evsel class on something other than
the tools from where we refactored code to create it.

It calls open() N times and then checks if the event created to
monitor it returns N events.

[acme@felicio linux]$ perf test
 1: vmlinux symtab matches kallsyms: Ok
 2: detect open syscall event: Ok
[acme@felicio linux]$

It does.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |   83 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index e0c3f47..6c99152 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -234,6 +234,85 @@ out:
 	return err;
 }
 
+#include "util/evsel.h"
+#include <sys/types.h>
+
+static int trace_event__id(const char *event_name)
+{
+	char *filename;
+	int err = -1, fd;
+
+	if (asprintf(&filename,
+		     "/sys/kernel/debug/tracing/events/syscalls/%s/id",
+		     event_name) < 0)
+		return -1;
+
+	fd = open(filename, O_RDONLY);
+	if (fd >= 0) {
+		char id[16];
+		if (read(fd, id, sizeof(id)) > 0)
+			err = atoi(id);
+		close(fd);
+	}
+
+	free(filename);
+	return err;
+}
+
+static int test__open_syscall_event(void)
+{
+	int err = -1, fd;
+	struct thread_map *threads;
+	struct perf_evsel *evsel;
+	unsigned int nr_open_calls = 111, i;
+	int id = trace_event__id("sys_enter_open");
+
+	if (id < 0) {
+		pr_debug("trace_event__id(\"sys_enter_open\") ");
+		return -1;
+	}
+
+	threads = thread_map__new(-1, getpid());
+	if (threads == NULL) {
+		pr_debug("thread_map__new ");
+		return -1;
+	}
+
+	evsel = perf_evsel__new(PERF_TYPE_TRACEPOINT, id, 0);
+	if (evsel == NULL) {
+		pr_debug("perf_evsel__new ");
+		goto out_thread_map_delete;
+	}
+
+	if (perf_evsel__open_per_thread(evsel, threads) < 0) {
+		pr_debug("perf_evsel__open_per_thread ");
+		goto out_evsel_delete;
+	}
+
+	for (i = 0; i < nr_open_calls; ++i) {
+		fd = open("/etc/passwd", O_RDONLY);
+		close(fd);
+	}
+
+	if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) {
+		pr_debug("perf_evsel__open_read_on_cpu ");
+		goto out_close_fd;
+	}
+
+	if (evsel->counts->cpu[0].val != nr_open_calls)
+		pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld ",
+			 nr_open_calls, evsel->counts->cpu[0].val);
+	
+	err = 0;
+out_close_fd:
+	perf_evsel__close_fd(evsel, 1, threads->nr);
+out_evsel_delete:
+	perf_evsel__delete(evsel);
+out_thread_map_delete:
+	thread_map__delete(threads);
+	return err;
+}
+
 static struct test {
 	const char *desc;
 	int (*func)(void);
@@ -243,6 +322,10 @@ static struct test {
 		.func = test__vmlinux_matches_kallsyms,
 	},
 	{
+		.desc = "detect open syscall event",
+		.func = test__open_syscall_event,
+	},
+	{
 		.func = NULL,
 	},
 };

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

* [tip:perf/core] perf test: Clarify some error reports in the open syscall test
       [not found]             ` <new-submission>
                                 ` (672 preceding siblings ...)
  2011-01-04  8:26               ` [tip:perf/core] perf test: Add test for counting open syscalls tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-05 17:36               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-05 17:37               ` [tip:perf/core] perf session: Warn about errors when processing pipe events too tip-bot for Arnaldo Carvalho de Melo
                                 ` (32 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-05 17:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  454a3bbe9b75eb8cbddffcf383fbb8e97ea78f52
Gitweb:     http://git.kernel.org/tip/454a3bbe9b75eb8cbddffcf383fbb8e97ea78f52
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 10:40:08 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Jan 2011 14:52:01 -0200

perf test: Clarify some error reports in the open syscall test

Rebooted my devel machine, first thing I ran was perf test, that expects
debugfs to be mounted, test fails. Be more clear about it.

Also add missing newlines and add more informative message when
sys_perf_event_open fails.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 6c99152..1c98434 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -268,24 +268,26 @@ static int test__open_syscall_event(void)
 	int id = trace_event__id("sys_enter_open");
 
 	if (id < 0) {
-		pr_debug("trace_event__id(\"sys_enter_open\") ");
+		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		return -1;
 	}
 
 	threads = thread_map__new(-1, getpid());
 	if (threads == NULL) {
-		pr_debug("thread_map__new ");
+		pr_debug("thread_map__new\n");
 		return -1;
 	}
 
 	evsel = perf_evsel__new(PERF_TYPE_TRACEPOINT, id, 0);
 	if (evsel == NULL) {
-		pr_debug("perf_evsel__new ");
+		pr_debug("perf_evsel__new\n");
 		goto out_thread_map_delete;
 	}
 
 	if (perf_evsel__open_per_thread(evsel, threads) < 0) {
-		pr_debug("perf_evsel__open_per_thread ");
+		pr_debug("failed to open counter: %s, "
+			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
+			 strerror(errno));
 		goto out_evsel_delete;
 	}
 
@@ -295,13 +297,15 @@ static int test__open_syscall_event(void)
 	}
 
 	if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) {
-		pr_debug("perf_evsel__open_read_on_cpu ");
+		pr_debug("perf_evsel__open_read_on_cpu\n");
 		goto out_close_fd;
 	}
 
-	if (evsel->counts->cpu[0].val != nr_open_calls)
-		pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld ",
+	if (evsel->counts->cpu[0].val != nr_open_calls) {
+		pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld\n",
 			 nr_open_calls, evsel->counts->cpu[0].val);
+		goto out_close_fd;
+	}
 	
 	err = 0;
 out_close_fd:

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

* [tip:perf/core] perf session: Warn about errors when processing pipe events too
       [not found]             ` <new-submission>
                                 ` (673 preceding siblings ...)
  2011-01-05 17:36               ` [tip:perf/core] perf test: Clarify some error reports in the open syscall test tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-05 17:37               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-05 17:37               ` [tip:perf/core] perf script: Use the default lost event handler tip-bot for Arnaldo Carvalho de Melo
                                 ` (31 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-05 17:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  1109599458c06256064213dc44ca5f5fa8ee3833
Gitweb:     http://git.kernel.org/tip/1109599458c06256064213dc44ca5f5fa8ee3833
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 16:25:15 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Jan 2011 14:53:10 -0200

perf session: Warn about errors when processing pipe events too

Just like we do at __perf_session__process_events

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |   57 ++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index b163dfd..6fb4694 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -838,6 +838,35 @@ static struct thread *perf_session__register_idle_thread(struct perf_session *se
 	return thread;
 }
 
+static void perf_session__warn_about_errors(const struct perf_session *session,
+					    const struct perf_event_ops *ops)
+{
+	if (ops->lost == event__process_lost &&
+	    session->hists.stats.total_lost != 0) {
+		ui__warning("Processed %Lu events and LOST %Lu!\n\n"
+			    "Check IO/CPU overload!\n\n",
+			    session->hists.stats.total_period,
+			    session->hists.stats.total_lost);
+	}
+
+	if (session->hists.stats.nr_unknown_events != 0) {
+		ui__warning("Found %u unknown events!\n\n"
+			    "Is this an older tool processing a perf.data "
+			    "file generated by a more recent tool?\n\n"
+			    "If that is not the case, consider "
+			    "reporting to linux-kernel@vger.kernel.org.\n\n",
+			    session->hists.stats.nr_unknown_events);
+	}
+
+ 	if (session->hists.stats.nr_invalid_chains != 0) {
+ 		ui__warning("Found invalid callchains!\n\n"
+ 			    "%u out of %u events were discarded for this reason.\n\n"
+ 			    "Consider reporting to linux-kernel@vger.kernel.org.\n\n",
+ 			    session->hists.stats.nr_invalid_chains,
+ 			    session->hists.stats.nr_events[PERF_RECORD_SAMPLE]);
+ 	}
+}
+
 #define session_done()	(*(volatile int *)(&session_done))
 volatile int session_done;
 
@@ -911,6 +940,7 @@ more:
 done:
 	err = 0;
 out_err:
+	perf_session__warn_about_errors(self, ops);
 	perf_session_free_sample_buffers(self);
 	return err;
 }
@@ -1023,32 +1053,7 @@ more:
 	flush_sample_queue(session, ops);
 out_err:
 	ui_progress__delete(progress);
-
-	if (ops->lost == event__process_lost &&
-	    session->hists.stats.total_lost != 0) {
-		ui__warning("Processed %Lu events and LOST %Lu!\n\n"
-			    "Check IO/CPU overload!\n\n",
-			    session->hists.stats.total_period,
-			    session->hists.stats.total_lost);
-	}
-
-	if (session->hists.stats.nr_unknown_events != 0) {
-		ui__warning("Found %u unknown events!\n\n"
-			    "Is this an older tool processing a perf.data "
-			    "file generated by a more recent tool?\n\n"
-			    "If that is not the case, consider "
-			    "reporting to linux-kernel@vger.kernel.org.\n\n",
-			    session->hists.stats.nr_unknown_events);
-	}
-
- 	if (session->hists.stats.nr_invalid_chains != 0) {
- 		ui__warning("Found invalid callchains!\n\n"
- 			    "%u out of %u events were discarded for this reason.\n\n"
- 			    "Consider reporting to linux-kernel@vger.kernel.org.\n\n",
- 			    session->hists.stats.nr_invalid_chains,
- 			    session->hists.stats.nr_events[PERF_RECORD_SAMPLE]);
- 	}
-
+	perf_session__warn_about_errors(session, ops);
 	perf_session_free_sample_buffers(session);
 	return err;
 }

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

* [tip:perf/core] perf script: Use the default lost event handler
       [not found]             ` <new-submission>
                                 ` (674 preceding siblings ...)
  2011-01-05 17:37               ` [tip:perf/core] perf session: Warn about errors when processing pipe events too tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-05 17:37               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-05 17:38               ` [tip:perf/core] perf script: Make some lists static tip-bot for Arnaldo Carvalho de Melo
                                 ` (30 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-05 17:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  6d8afb56300c53a250c6de0f973ef502e54aabf3
Gitweb:     http://git.kernel.org/tip/6d8afb56300c53a250c6de0f973ef502e54aabf3
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 16:27:30 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Jan 2011 14:53:43 -0200

perf script: Use the default lost event handler

That already does what was being done here. The warning is now unconditionally
given by __perf_session__process_pipe_events, just like for non pipe processing.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 43480fd..27d568d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -99,16 +99,6 @@ static int process_sample_event(event_t *event, struct sample_data *sample,
 	return 0;
 }
 
-static u64 nr_lost;
-
-static int process_lost_event(event_t *event, struct sample_data *sample __used,
-			      struct perf_session *session __used)
-{
-	nr_lost += event->lost.lost;
-
-	return 0;
-}
-
 static struct perf_event_ops event_ops = {
 	.sample	= process_sample_event,
 	.comm	= event__process_comm,
@@ -116,7 +106,6 @@ static struct perf_event_ops event_ops = {
 	.event_type = event__process_event_type,
 	.tracing_data = event__process_tracing_data,
 	.build_id = event__process_build_id,
-	.lost = process_lost_event,
 	.ordering_requires_timestamps = true,
 	.ordered_samples = true,
 };
@@ -136,10 +125,8 @@ static int __cmd_script(struct perf_session *session)
 
 	ret = perf_session__process_events(session, &event_ops);
 
-	if (debug_mode) {
+	if (debug_mode)
 		pr_err("Misordered timestamps: %llu\n", nr_unordered);
-		pr_err("Lost events: %llu\n", nr_lost);
-	}
 
 	return ret;
 }

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

* [tip:perf/core] perf script: Make some lists static
       [not found]             ` <new-submission>
                                 ` (675 preceding siblings ...)
  2011-01-05 17:37               ` [tip:perf/core] perf script: Use the default lost event handler tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-05 17:38               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-11 11:09               ` [tip:perf/urgent] perf sched: Fix allocation result check tip-bot for Arnaldo Carvalho de Melo
                                 ` (29 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-05 17:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  eccdfe2d245a882feacc4630c9bc29805e9929c8
Gitweb:     http://git.kernel.org/tip/eccdfe2d245a882feacc4630c9bc29805e9929c8
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 16:32:52 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Jan 2011 14:53:59 -0200

perf script: Make some lists static

Not accessed outside builtin-script, so make them static.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 27d568d..150a606 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -137,7 +137,7 @@ struct script_spec {
 	char			spec[0];
 };
 
-LIST_HEAD(script_specs);
+static LIST_HEAD(script_specs);
 
 static struct script_spec *script_spec__new(const char *spec,
 					    struct scripting_ops *ops)
@@ -319,7 +319,7 @@ struct script_desc {
 	char			*args;
 };
 
-LIST_HEAD(script_descs);
+static LIST_HEAD(script_descs);
 
 static struct script_desc *script_desc__new(const char *name)
 {

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

* [tip:perf/urgent] perf sched: Fix allocation result check
       [not found]             ` <new-submission>
                                 ` (676 preceding siblings ...)
  2011-01-05 17:38               ` [tip:perf/core] perf script: Make some lists static tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-11 11:09               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-11 11:10               ` [tip:perf/urgent] perf tools: Emit clearer message for sys_perf_event_open ENOENT return tip-bot for Arnaldo Carvalho de Melo
                                 ` (28 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-11 11:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, chris, fweisbec, tglx, mingo

Commit-ID:  e462dc553ea5e09d4713e7c35a11ed331dc6f369
Gitweb:     http://git.kernel.org/tip/e462dc553ea5e09d4713e7c35a11ed331dc6f369
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 10 Jan 2011 10:48:47 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jan 2011 10:48:47 -0200

perf sched: Fix allocation result check

Bug introduced in ce47dc56.

Reported-by: Mike Galbraith <efault@gmx.de>
Cc: Chris Samuel <chris@csamuel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 7a4ebeb..54024d2 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1861,7 +1861,7 @@ static int __cmd_record(int argc, const char **argv)
 	rec_argc = ARRAY_SIZE(record_args) + argc - 1;
 	rec_argv = calloc(rec_argc + 1, sizeof(char *));
 
-	if (rec_argv)
+	if (rec_argv == NULL)
 		return -ENOMEM;
 
 	for (i = 0; i < ARRAY_SIZE(record_args); i++)

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

* [tip:perf/urgent] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
       [not found]             ` <new-submission>
                                 ` (677 preceding siblings ...)
  2011-01-11 11:09               ` [tip:perf/urgent] perf sched: Fix allocation result check tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-11 11:10               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-11 11:11               ` [tip:perf/urgent] perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) tip-bot for Arnaldo Carvalho de Melo
                                 ` (27 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-11 11:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, daahern, mingo

Commit-ID:  aa7bc7ef73efc46d7c3a0e185eefaf85744aec98
Gitweb:     http://git.kernel.org/tip/aa7bc7ef73efc46d7c3a0e185eefaf85744aec98
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 10 Jan 2011 13:36:24 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jan 2011 13:36:24 -0200

perf tools: Emit clearer message for sys_perf_event_open ENOENT return

Improve sys_perf_event_open ENOENT return handling in top and record, just
like 5a3446b does for stat.

Cc: David Ahern <daahern@cisco.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    3 +++
 tools/perf/builtin-top.c    |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7bc0490..7069bd3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -331,6 +331,9 @@ try_again:
 			else if (err ==  ENODEV && cpu_list) {
 				die("No such device - did you specify"
 					" an out-of-range profile CPU?\n");
+			} else if (err == ENOENT) {
+				die("%s event is not supported. ",
+				     event_name(evsel));
 			} else if (err == EINVAL && sample_id_all_avail) {
 				/*
 				 * Old kernel, no attr->sample_id_type_all field
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1e67ab9..6ce4042 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1247,6 +1247,8 @@ try_again:
 				die("Permission error - are you root?\n"
 					"\t Consider tweaking"
 					" /proc/sys/kernel/perf_event_paranoid.\n");
+			if (err == ENOENT)
+				die("%s event is not supported. ", event_name(evsel));
 			/*
 			 * If it's cycles then fall back to hrtimer
 			 * based cpu-clock-tick sw counter, which

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

* [tip:perf/urgent] perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1)
       [not found]             ` <new-submission>
                                 ` (678 preceding siblings ...)
  2011-01-11 11:10               ` [tip:perf/urgent] perf tools: Emit clearer message for sys_perf_event_open ENOENT return tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-11 11:11               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-11 11:11               ` [tip:perf/urgent] perf session: Fix infinite loop in __perf_session__process_events tip-bot for Arnaldo Carvalho de Melo
                                 ` (26 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-11 11:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, paulus, linux-kernel, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  0252208eb52f6fe8731a47804eddc7ba93f60a87
Gitweb:     http://git.kernel.org/tip/0252208eb52f6fe8731a47804eddc7ba93f60a87
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 4 Jan 2011 11:55:27 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jan 2011 22:03:26 -0200

perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1)

And a test for it:

[acme@felicio linux]$ perf test
 1: vmlinux symtab matches kallsyms: Ok
 2: detect open syscall event: Ok
 3: detect open syscall event on all cpus: Ok
[acme@felicio linux]$

Translating C the test does:

1. generates different number of open syscalls on each CPU
   by using sched_setaffinity
2. Verifies that the expected number of events is generated
   on each CPU

It works as expected.

LKML-Reference: <new-submission>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |  110 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.c   |   82 ++++++++++++++++++++-------------
 2 files changed, 159 insertions(+), 33 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index e12753f..ed56961 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -234,6 +234,7 @@ out:
 	return err;
 }
 
+#include "util/cpumap.h"
 #include "util/evsel.h"
 #include <sys/types.h>
 
@@ -321,6 +322,111 @@ out_thread_map_delete:
 	return err;
 }
 
+#include <sched.h>
+
+static int test__open_syscall_event_on_all_cpus(void)
+{
+	int err = -1, fd, cpu;
+	struct thread_map *threads;
+	struct cpu_map *cpus;
+	struct perf_evsel *evsel;
+	struct perf_event_attr attr;
+	unsigned int nr_open_calls = 111, i;
+	cpu_set_t *cpu_set;
+	size_t cpu_set_size;
+	int id = trace_event__id("sys_enter_open");
+
+	if (id < 0) {
+		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
+		return -1;
+	}
+
+	threads = thread_map__new(-1, getpid());
+	if (threads == NULL) {
+		pr_debug("thread_map__new\n");
+		return -1;
+	}
+
+	cpus = cpu_map__new(NULL);
+	if (threads == NULL) {
+		pr_debug("thread_map__new\n");
+		return -1;
+	}
+
+	cpu_set = CPU_ALLOC(cpus->nr);
+
+	if (cpu_set == NULL)
+		goto out_thread_map_delete;
+
+	cpu_set_size = CPU_ALLOC_SIZE(cpus->nr);
+	CPU_ZERO_S(cpu_set_size, cpu_set);
+
+	memset(&attr, 0, sizeof(attr));
+	attr.type = PERF_TYPE_TRACEPOINT;
+	attr.config = id;
+	evsel = perf_evsel__new(&attr, 0);
+	if (evsel == NULL) {
+		pr_debug("perf_evsel__new\n");
+		goto out_cpu_free;
+	}
+
+	if (perf_evsel__open(evsel, cpus, threads) < 0) {
+		pr_debug("failed to open counter: %s, "
+			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
+			 strerror(errno));
+		goto out_evsel_delete;
+	}
+
+	for (cpu = 0; cpu < cpus->nr; ++cpu) {
+		unsigned int ncalls = nr_open_calls + cpu;
+
+		CPU_SET(cpu, cpu_set);
+		sched_setaffinity(0, cpu_set_size, cpu_set);
+		for (i = 0; i < ncalls; ++i) {
+			fd = open("/etc/passwd", O_RDONLY);
+			close(fd);
+		}
+		CPU_CLR(cpu, cpu_set);
+	}
+
+	/*
+	 * Here we need to explicitely preallocate the counts, as if
+	 * we use the auto allocation it will allocate just for 1 cpu,
+	 * as we start by cpu 0.
+	 */
+	if (perf_evsel__alloc_counts(evsel, cpus->nr) < 0) {
+		pr_debug("perf_evsel__alloc_counts(ncpus=%d)\n", cpus->nr);
+		goto out_close_fd;
+	}
+
+	for (cpu = 0; cpu < cpus->nr; ++cpu) {
+		unsigned int expected;
+
+		if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) {
+			pr_debug("perf_evsel__open_read_on_cpu\n");
+			goto out_close_fd;
+		}
+
+		expected = nr_open_calls + cpu;
+		if (evsel->counts->cpu[cpu].val != expected) {
+			pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %Ld\n",
+				 expected, cpu, evsel->counts->cpu[cpu].val);
+			goto out_close_fd;
+		}
+	}
+
+	err = 0;
+out_close_fd:
+	perf_evsel__close_fd(evsel, 1, threads->nr);
+out_evsel_delete:
+	perf_evsel__delete(evsel);
+out_cpu_free:
+	CPU_FREE(cpu_set);
+out_thread_map_delete:
+	thread_map__delete(threads);
+	return err;
+}
+
 static struct test {
 	const char *desc;
 	int (*func)(void);
@@ -334,6 +440,10 @@ static struct test {
 		.func = test__open_syscall_event,
 	},
 	{
+		.desc = "detect open syscall event on all cpus",
+		.func = test__open_syscall_event_on_all_cpus,
+	},
+	{
 		.func = NULL,
 	},
 };
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1a5591d..f5cfed6 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -127,59 +127,75 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 	return 0;
 }
 
-int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
+static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
+			      struct thread_map *threads)
 {
-	int cpu;
+	int cpu, thread;
 
-	if (evsel->fd == NULL && perf_evsel__alloc_fd(evsel, cpus->nr, 1) < 0)
+	if (evsel->fd == NULL &&
+	    perf_evsel__alloc_fd(evsel, cpus->nr, threads->nr) < 0)
 		return -1;
 
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
-		FD(evsel, cpu, 0) = sys_perf_event_open(&evsel->attr, -1,
-							cpus->map[cpu], -1, 0);
-		if (FD(evsel, cpu, 0) < 0)
-			goto out_close;
+		for (thread = 0; thread < threads->nr; thread++) {
+			FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
+								     threads->map[thread],
+								     cpus->map[cpu], -1, 0);
+			if (FD(evsel, cpu, thread) < 0)
+				goto out_close;
+		}
 	}
 
 	return 0;
 
 out_close:
-	while (--cpu >= 0) {
-		close(FD(evsel, cpu, 0));
-		FD(evsel, cpu, 0) = -1;
-	}
+	do {
+		while (--thread >= 0) {
+			close(FD(evsel, cpu, thread));
+			FD(evsel, cpu, thread) = -1;
+		}
+		thread = threads->nr;
+	} while (--cpu >= 0);
 	return -1;
 }
 
-int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads)
+static struct {
+	struct cpu_map map;
+	int cpus[1];
+} empty_cpu_map = {
+	.map.nr	= 1,
+	.cpus	= { -1, },
+};
+
+static struct {
+	struct thread_map map;
+	int threads[1];
+} empty_thread_map = {
+	.map.nr	 = 1,
+	.threads = { -1, },
+};
+
+int perf_evsel__open(struct perf_evsel *evsel,
+		     struct cpu_map *cpus, struct thread_map *threads)
 {
-	int thread;
-
-	if (evsel->fd == NULL && perf_evsel__alloc_fd(evsel, 1, threads->nr))
-		return -1;
 
-	for (thread = 0; thread < threads->nr; thread++) {
-		FD(evsel, 0, thread) = sys_perf_event_open(&evsel->attr,
-							   threads->map[thread], -1, -1, 0);
-		if (FD(evsel, 0, thread) < 0)
-			goto out_close;
+	if (cpus == NULL) {
+		/* Work around old compiler warnings about strict aliasing */
+		cpus = &empty_cpu_map.map;
 	}
 
-	return 0;
+	if (threads == NULL)
+		threads = &empty_thread_map.map;
 
-out_close:
-	while (--thread >= 0) {
-		close(FD(evsel, 0, thread));
-		FD(evsel, 0, thread) = -1;
-	}
-	return -1;
+	return __perf_evsel__open(evsel, cpus, threads);
 }
 
-int perf_evsel__open(struct perf_evsel *evsel, 
-		     struct cpu_map *cpus, struct thread_map *threads)
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
 {
-	if (threads == NULL)
-		return perf_evsel__open_per_cpu(evsel, cpus);
+	return __perf_evsel__open(evsel, cpus, &empty_thread_map.map);
+}
 
-	return perf_evsel__open_per_thread(evsel, threads);
+int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads)
+{
+	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads);
 }

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

* [tip:perf/urgent] perf session: Fix infinite loop in __perf_session__process_events
       [not found]             ` <new-submission>
                                 ` (679 preceding siblings ...)
  2011-01-11 11:11               ` [tip:perf/urgent] perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-11 11:11               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-12 10:51               ` [tip:perf/urgent] perf evsel: Fix order of event list deletion tip-bot for Arnaldo Carvalho de Melo
                                 ` (25 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-11 11:11 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	torvalds, peterz, efault, fweisbec, tglx, daahern, mingo

Commit-ID:  3d03e2ea74103a50c23d6ab1906cf73399c0dafb
Gitweb:     http://git.kernel.org/tip/3d03e2ea74103a50c23d6ab1906cf73399c0dafb
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 10 Jan 2011 21:37:57 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jan 2011 22:23:08 -0200

perf session: Fix infinite loop in __perf_session__process_events

In this if statement:

        if (head + event->header.size >= mmap_size) {
                if (mmaps[map_idx]) {
                        munmap(mmaps[map_idx], mmap_size);
                        mmaps[map_idx] = NULL;
                }

                page_offset = page_size * (head / page_size);
                file_offset += page_offset;
                head -= page_offset;
                goto remap;
        }

With, for instance, these values:

head=2992
event->header.size=48
mmap_size=3040

We end up endlessly looping back to remap. Off by one.

Problem introduced in 55b4462.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Ingo Molnar <mingo@elte.hu>
Reported-by: David Ahern <daahern@cisco.com>
Bisected-by: David Ahern <daahern@cisco.com>
Tested-by: David Ahern <daahern@cisco.com>
Cc: David Ahern <daahern@cisco.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 6fb4694..313dac2 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1007,7 +1007,7 @@ more:
 	if (size == 0)
 		size = 8;
 
-	if (head + event->header.size >= mmap_size) {
+	if (head + event->header.size > mmap_size) {
 		if (mmaps[map_idx]) {
 			munmap(mmaps[map_idx], mmap_size);
 			mmaps[map_idx] = NULL;

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

* [tip:perf/urgent] perf evsel: Fix order of event list deletion
       [not found]             ` <new-submission>
                                 ` (680 preceding siblings ...)
  2011-01-11 11:11               ` [tip:perf/urgent] perf session: Fix infinite loop in __perf_session__process_events tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-12 10:51               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-12 10:52               ` [tip:perf/urgent] perf top: Fix annotate segv tip-bot for Arnaldo Carvalho de Melo
                                 ` (24 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-12 10:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, trenn, mingo

Commit-ID:  bd3bfe9eda94d3c050830217c1e1c338808de5b2
Gitweb:     http://git.kernel.org/tip/bd3bfe9eda94d3c050830217c1e1c338808de5b2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 12:42:00 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 11 Jan 2011 12:51:03 -0200

perf evsel: Fix order of event list deletion

We need to defer calling perf_evsel_list__delete() till after atexit
registered routines, because we need to traverse the events being
recorded at that time at least on 'perf record'.

This fixes the problem reported by Thomas Renninger where cmd_record
called by cmd_timechart would not write the tracing data to the perf.data
file header because the evsel_list at atexit (control+C on 'perf timechart
record') time would be empty, being already deleted by run_builtin(),
and thus 'perf timechart' when trying to process such perf.data file would
die with:

"no trace data in the file"

Problem introduced in 70d544d.

Reported-by: Thomas Renninger <trenn@suse.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    1 +
 tools/perf/builtin-stat.c   |    1 +
 tools/perf/builtin-top.c    |    1 +
 tools/perf/perf.c           |    2 --
 4 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7069bd3..aa7ece3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -480,6 +480,7 @@ static void atexit_header(void)
 			process_buildids();
 		perf_header__write(&session->header, output, true);
 		perf_session__delete(session);
+		perf_evsel_list__delete();
 		symbol__exit();
 	}
 }
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c385a63..0ff11d9 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -743,6 +743,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 out_free_fd:
 	list_for_each_entry(pos, &evsel_list, node)
 		perf_evsel__free_stat_priv(pos);
+	perf_evsel_list__delete();
 out:
 	thread_map__delete(threads);
 	threads = NULL;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6ce4042..4b995ee 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1490,6 +1490,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 out_free_fd:
 	list_for_each_entry(pos, &evsel_list, node)
 		perf_evsel__free_mmap(pos);
+	perf_evsel_list__delete();
 
 	return status;
 }
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 5b1ecd6..595d0f4 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -286,8 +286,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 	status = p->fn(argc, argv, prefix);
 	exit_browser(status);
 
-	perf_evsel_list__delete();
-
 	if (status)
 		return status & 0xff;
 

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

* [tip:perf/urgent] perf top: Fix annotate segv
       [not found]             ` <new-submission>
                                 ` (681 preceding siblings ...)
  2011-01-12 10:51               ` [tip:perf/urgent] perf evsel: Fix order of event list deletion tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-12 10:52               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-12 10:52               ` [tip:perf/urgent] Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return" tip-bot for Arnaldo Carvalho de Melo
                                 ` (23 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-12 10:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, kirr, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  cc841580aa58ad7498b23e282859d07f8b721e24
Gitweb:     http://git.kernel.org/tip/cc841580aa58ad7498b23e282859d07f8b721e24
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 15:16:52 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 11 Jan 2011 16:56:16 -0200

perf top: Fix annotate segv

Before we had sym_counter, it was initialized to zero and we used that
as an index in the global attrs variable, now we have a list of evsel
entries, and sym_counter became sym_evsel, that remained initialized to
zero (NULL): b00m.

Fix it by initializing it to the first entry in the evsel list.

Bug-introduced: 69aad6f
Reported-by: Kirill Smelkov <kirr@mns.spb.ru>
Tested-by: Kirill Smelkov <kirr@mns.spb.ru>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Kirill Smelkov <kirr@mns.spb.ru>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4b995ee..568b195 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1473,6 +1473,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		pos->attr.sample_period = default_interval;
 	}
 
+	sym_evsel = list_entry(evsel_list.next, struct perf_evsel, node);
+
 	symbol_conf.priv_size = (sizeof(struct sym_entry) +
 				 (nr_counters + 1) * sizeof(unsigned long));
 

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

* [tip:perf/urgent] Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return"
       [not found]             ` <new-submission>
                                 ` (682 preceding siblings ...)
  2011-01-12 10:52               ` [tip:perf/urgent] perf top: Fix annotate segv tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-12 10:52               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-18  8:48               ` [tip:perf/urgent] perf tools: Fix handling of wildcards in tracepoint event selectors tip-bot for Arnaldo Carvalho de Melo
                                 ` (22 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-12 10:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, daahern, mingo

Commit-ID:  4ad9f594d7199c99f6b1b3ef88c64bd5920a4592
Gitweb:     http://git.kernel.org/tip/4ad9f594d7199c99f6b1b3ef88c64bd5920a4592
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 16:58:54 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 11 Jan 2011 17:31:26 -0200

Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return"

This reverts commit aa7bc7ef73efc46d7c3a0e185eefaf85744aec98.

It removed the fallback from hardware profiling to software profiling.
.e.g., in a VM with no PMU.

Reported-by: David Ahern <daahern@cisco.com>
Cc: David Ahern <daahern@cisco.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    3 ---
 tools/perf/builtin-top.c    |    2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index aa7ece3..1210e64 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -331,9 +331,6 @@ try_again:
 			else if (err ==  ENODEV && cpu_list) {
 				die("No such device - did you specify"
 					" an out-of-range profile CPU?\n");
-			} else if (err == ENOENT) {
-				die("%s event is not supported. ",
-				     event_name(evsel));
 			} else if (err == EINVAL && sample_id_all_avail) {
 				/*
 				 * Old kernel, no attr->sample_id_type_all field
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 568b195..05344c6 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1247,8 +1247,6 @@ try_again:
 				die("Permission error - are you root?\n"
 					"\t Consider tweaking"
 					" /proc/sys/kernel/perf_event_paranoid.\n");
-			if (err == ENOENT)
-				die("%s event is not supported. ", event_name(evsel));
 			/*
 			 * If it's cycles then fall back to hrtimer
 			 * based cpu-clock-tick sw counter, which

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

* [tip:perf/urgent] perf tools: Fix handling of wildcards in tracepoint event selectors
       [not found]             ` <new-submission>
                                 ` (683 preceding siblings ...)
  2011-01-12 10:52               ` [tip:perf/urgent] Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return" tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-18  8:48               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-18 19:06               ` [tip:perf/urgent] perf: Fix contexted inheritance tip-bot for Peter Zijlstra
                                 ` (21 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-18  8:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  dd9a9ad5e1e94894433110ccbf492ed60d75ffcb
Gitweb:     http://git.kernel.org/tip/dd9a9ad5e1e94894433110ccbf492ed60d75ffcb
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 17 Jan 2011 14:25:06 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 Jan 2011 15:26:07 -0200

perf tools: Fix handling of wildcards in tracepoint event selectors

It wasn't accounting the ':' when consuming bytes in the the event
selector string, so parse_events() would fail in this test:

                if (!(*str == 0 || *str == ',' || isspace(*str)))
                        return -1;

as *str would be pointing to '*', the last character in the '-e' arg in:

$ perf record -q -a -D -e sched:sched_* | perf script -i - -s perf-script.py

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5cb6f4b..1f4cfe5 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -555,7 +555,7 @@ static enum event_result parse_tracepoint_event(const char **strp,
 	if (evt_length >= MAX_EVENT_LENGTH)
 		return EVT_FAILED;
 	if (strpbrk(evt_name, "*?")) {
-		*strp += strlen(sys_name) + evt_length;
+		*strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
 		return parse_multiple_tracepoint_event(sys_name, evt_name,
 						       flags);
 	} else {

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

* [tip:perf/urgent] perf: Fix contexted inheritance
       [not found]             ` <new-submission>
                                 ` (684 preceding siblings ...)
  2011-01-18  8:48               ` [tip:perf/urgent] perf tools: Fix handling of wildcards in tracepoint event selectors tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-18 19:06               ` tip-bot for Peter Zijlstra
  2011-01-21 15:37               ` [tip:perf/urgent] perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat tip-bot for Peter Zijlstra
                                 ` (20 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2011-01-18 19:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, torvalds, a.p.zijlstra,
	paulmck, tglx, mingo

Commit-ID:  c5ed5145591774bd9a2960ba4ca45a02fc70aad1
Gitweb:     http://git.kernel.org/tip/c5ed5145591774bd9a2960ba4ca45a02fc70aad1
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 17 Jan 2011 13:45:37 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 18 Jan 2011 15:10:35 +0100

perf: Fix contexted inheritance

Linus reported that the RCU lockdep annotation bits triggered for this
rcu_dereference() because we're not holding rcu_read_lock().

Going over the code I cannot convince myself its correct:

 - holding a ref on the parent_ctx, doesn't avoid it being uncloned
   concurrently (as the comment says), so we can race with a free.

 - holding parent_ctx->mutex doesn't avoid the above free from taking
   place either, it would at best avoid parent_ctx from being freed.

I.e. the warning is correct. To fix the bug, serialize against the
unclone_ctx() call by extending the reach of the parent_ctx->lock.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index b782b7a..76be4c7 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -6494,7 +6494,6 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 
 	raw_spin_lock_irqsave(&parent_ctx->lock, flags);
 	parent_ctx->rotate_disable = 0;
-	raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
 
 	child_ctx = child->perf_event_ctxp[ctxn];
 
@@ -6502,12 +6501,11 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 		/*
 		 * Mark the child context as a clone of the parent
 		 * context, or of whatever the parent is a clone of.
-		 * Note that if the parent is a clone, it could get
-		 * uncloned at any point, but that doesn't matter
-		 * because the list of events and the generation
-		 * count can't have changed since we took the mutex.
+		 *
+		 * Note that if the parent is a clone, the holding of
+		 * parent_ctx->lock avoids it from being uncloned.
 		 */
-		cloned_ctx = rcu_dereference(parent_ctx->parent_ctx);
+		cloned_ctx = parent_ctx->parent_ctx;
 		if (cloned_ctx) {
 			child_ctx->parent_ctx = cloned_ctx;
 			child_ctx->parent_gen = parent_ctx->parent_gen;
@@ -6518,6 +6516,7 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
 		get_ctx(child_ctx->parent_ctx);
 	}
 
+	raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
 	mutex_unlock(&parent_ctx->mutex);
 
 	perf_unpin_context(parent_ctx);

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

* [tip:perf/urgent] perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat
       [not found]             ` <new-submission>
                                 ` (685 preceding siblings ...)
  2011-01-18 19:06               ` [tip:perf/urgent] perf: Fix contexted inheritance tip-bot for Peter Zijlstra
@ 2011-01-21 15:37               ` tip-bot for Peter Zijlstra
  2011-01-23 18:00               ` [tip:perf/urgent] perf test: Fix build on older glibcs tip-bot for Arnaldo Carvalho de Melo
                                 ` (19 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Peter Zijlstra @ 2011-01-21 15:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  547e9fd7d328af261f184bf66effc5033c886498
Gitweb:     http://git.kernel.org/tip/547e9fd7d328af261f184bf66effc5033c886498
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 19 Jan 2011 12:51:39 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 21 Jan 2011 16:32:42 +0100

perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat

Lockdep spotted:

	loop_1b_instruc/1899 is trying to acquire lock:
	 (event_mutex){+.+.+.}, at: [<ffffffff810e1908>] perf_trace_init+0x3b/0x2f7

	but task is already holding lock:
	 (&ctx->mutex){+.+.+.}, at: [<ffffffff810eb45b>] perf_event_init_context+0xc0/0x218

	which lock already depends on the new lock.

	the existing dependency chain (in reverse order) is:

	-> #3 (&ctx->mutex){+.+.+.}:
	-> #2 (cpu_hotplug.lock){+.+.+.}:
	-> #1 (module_mutex){+.+...}:
	-> #0 (event_mutex){+.+.+.}:

But because the deadlock would be cpuhotplug (cpu-event) vs fork
(task-event) it cannot, in fact, happen. We can annotate this by giving the
perf_event_context used for the cpuctx a different lock class from those
used by tasks.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 244ca3a..c5fa717 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5380,6 +5380,8 @@ free_dev:
 	goto out;
 }
 
+static struct lock_class_key cpuctx_mutex;
+
 int perf_pmu_register(struct pmu *pmu, char *name, int type)
 {
 	int cpu, ret;
@@ -5428,6 +5430,7 @@ skip_type:
 
 		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
 		__perf_event_init_context(&cpuctx->ctx);
+		lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex);
 		cpuctx->ctx.type = cpu_context;
 		cpuctx->ctx.pmu = pmu;
 		cpuctx->jiffies_interval = 1;

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

* [tip:perf/urgent] perf test: Fix build on older glibcs
       [not found]             ` <new-submission>
                                 ` (686 preceding siblings ...)
  2011-01-21 15:37               ` [tip:perf/urgent] perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat tip-bot for Peter Zijlstra
@ 2011-01-23 18:00               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-23 18:01               ` [tip:perf/urgent] perf tools: Add missing header, fixes build tip-bot for Arnaldo Carvalho de Melo
                                 ` (18 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-23 18:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, eric.dumazet,
	a.p.zijlstra, efault, fweisbec, tglx

Commit-ID:  57b84e53171ce672683faf1cab2e660965a6bdaf
Gitweb:     http://git.kernel.org/tip/57b84e53171ce672683faf1cab2e660965a6bdaf
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 22 Jan 2011 23:14:20 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 23:14:20 -0200

perf test: Fix build on older glibcs

Where we don't have CPU_ALLOC & friends. As the tools are being used in older
distros where the only allowed change are to replace the kernel, like RHEL4 and
5.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 02958d6..0e01834 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -332,8 +332,7 @@ static int test__open_syscall_event_on_all_cpus(void)
 	struct perf_evsel *evsel;
 	struct perf_event_attr attr;
 	unsigned int nr_open_calls = 111, i;
-	cpu_set_t *cpu_set;
-	size_t cpu_set_size;
+	cpu_set_t cpu_set;
 	int id = trace_event__id("sys_enter_open");
 
 	if (id < 0) {
@@ -353,13 +352,8 @@ static int test__open_syscall_event_on_all_cpus(void)
 		return -1;
 	}
 
-	cpu_set = CPU_ALLOC(cpus->nr);
 
-	if (cpu_set == NULL)
-		goto out_thread_map_delete;
-
-	cpu_set_size = CPU_ALLOC_SIZE(cpus->nr);
-	CPU_ZERO_S(cpu_set_size, cpu_set);
+	CPU_ZERO(&cpu_set);
 
 	memset(&attr, 0, sizeof(attr));
 	attr.type = PERF_TYPE_TRACEPOINT;
@@ -367,7 +361,7 @@ static int test__open_syscall_event_on_all_cpus(void)
 	evsel = perf_evsel__new(&attr, 0);
 	if (evsel == NULL) {
 		pr_debug("perf_evsel__new\n");
-		goto out_cpu_free;
+		goto out_thread_map_delete;
 	}
 
 	if (perf_evsel__open(evsel, cpus, threads) < 0) {
@@ -379,9 +373,19 @@ static int test__open_syscall_event_on_all_cpus(void)
 
 	for (cpu = 0; cpu < cpus->nr; ++cpu) {
 		unsigned int ncalls = nr_open_calls + cpu;
+		/*
+		 * XXX eventually lift this restriction in a way that
+		 * keeps perf building on older glibc installations
+		 * without CPU_ALLOC. 1024 cpus in 2010 still seems
+		 * a reasonable upper limit tho :-)
+		 */
+		if (cpus->map[cpu] >= CPU_SETSIZE) {
+			pr_debug("Ignoring CPU %d\n", cpus->map[cpu]);
+			continue;
+		}
 
-		CPU_SET_S(cpus->map[cpu], cpu_set_size, cpu_set);
-		if (sched_setaffinity(0, cpu_set_size, cpu_set) < 0) {
+		CPU_SET(cpus->map[cpu], &cpu_set);
+		if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) {
 			pr_debug("sched_setaffinity() failed on CPU %d: %s ",
 				 cpus->map[cpu],
 				 strerror(errno));
@@ -391,7 +395,7 @@ static int test__open_syscall_event_on_all_cpus(void)
 			fd = open("/etc/passwd", O_RDONLY);
 			close(fd);
 		}
-		CPU_CLR_S(cpus->map[cpu], cpu_set_size, cpu_set);
+		CPU_CLR(cpus->map[cpu], &cpu_set);
 	}
 
 	/*
@@ -407,6 +411,9 @@ static int test__open_syscall_event_on_all_cpus(void)
 	for (cpu = 0; cpu < cpus->nr; ++cpu) {
 		unsigned int expected;
 
+		if (cpus->map[cpu] >= CPU_SETSIZE)
+			continue;
+
 		if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) {
 			pr_debug("perf_evsel__open_read_on_cpu\n");
 			goto out_close_fd;
@@ -425,8 +432,6 @@ out_close_fd:
 	perf_evsel__close_fd(evsel, 1, threads->nr);
 out_evsel_delete:
 	perf_evsel__delete(evsel);
-out_cpu_free:
-	CPU_FREE(cpu_set);
 out_thread_map_delete:
 	thread_map__delete(threads);
 	return err;

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

* [tip:perf/urgent] perf tools: Add missing header, fixes build
       [not found]             ` <new-submission>
                                 ` (687 preceding siblings ...)
  2011-01-23 18:00               ` [tip:perf/urgent] perf test: Fix build on older glibcs tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-23 18:01               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build when using gcc 3.4.6 tip-bot for Arnaldo Carvalho de Melo
                                 ` (17 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-23 18:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	eric.dumazet, peterz, efault, fweisbec, tglx, mingo

Commit-ID:  a860a60818e48134c60315bf32f87575771e6602
Gitweb:     http://git.kernel.org/tip/a860a60818e48134c60315bf32f87575771e6602
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 22 Jan 2011 19:07:36 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:15:39 -0200

perf tools: Add missing header, fixes build

We need the definiton for __always_inline in bitops.h to fix the build
on distros where it isn't available or compiler.h doesn't get included
indirectly.

One of the fixes needed to build perf on RHEL4 systems, for instance.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/include/linux/bitops.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
index 8be0b96..305c848 100644
--- a/tools/perf/util/include/linux/bitops.h
+++ b/tools/perf/util/include/linux/bitops.h
@@ -2,6 +2,7 @@
 #define _PERF_LINUX_BITOPS_H_
 
 #include <linux/kernel.h>
+#include <linux/compiler.h>
 #include <asm/hweight.h>
 
 #define BITS_PER_LONG __WORDSIZE

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

* [tip:perf/urgent] perf tools: Fix build when using gcc 3.4.6
       [not found]             ` <new-submission>
                                 ` (688 preceding siblings ...)
  2011-01-23 18:01               ` [tip:perf/urgent] perf tools: Add missing header, fixes build tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-23 18:02               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build by checking if extra warnings are supported tip-bot for Arnaldo Carvalho de Melo
                                 ` (16 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-23 18:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	eric.dumazet, peterz, efault, fweisbec, tglx, mingo

Commit-ID:  5c7a66822c8b619966d9367594054778608fc5d1
Gitweb:     http://git.kernel.org/tip/5c7a66822c8b619966d9367594054778608fc5d1
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 22 Jan 2011 19:12:38 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:15:39 -0200

perf tools: Fix build when using gcc 3.4.6

[acme@localhost linux]$ make O=~acme/git/build/perf -C tools/perf
make: Entering directory `/home/acme/git/linux/tools/perf'
Makefile:526: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile:582: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    CC /home/acme/git/build/perf/builtin-annotate.o
In file included from builtin-annotate.c:23:
util/parse-events.h:26: warning: declaration of 'evsel_list' shadows a global declaration
util/parse-events.h:12: warning: shadowed declaration is here
make: *** [/home/acme/git/build/perf/builtin-annotate.o] Error 1
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@localhost linux]$ gcc --version | head -1
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-11)
[acme@localhost linux]$

Fix it by renaming the parameter to evlist.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index b82cafb..458e3ec 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -23,7 +23,7 @@ struct tracepoint_path {
 };
 
 extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
-extern bool have_tracepoints(struct list_head *evsel_list);
+extern bool have_tracepoints(struct list_head *evlist);
 
 extern int			nr_counters;
 

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

* [tip:perf/urgent] perf tools: Fix build by checking if extra warnings are supported
       [not found]             ` <new-submission>
                                 ` (689 preceding siblings ...)
  2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build when using gcc 3.4.6 tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-23 18:02               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:14               ` [tip:perf/core] perf evsel: Introduce perf_evlist tip-bot for Arnaldo Carvalho de Melo
                                 ` (15 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-23 18:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	eric.dumazet, peterz, efault, fweisbec, tglx, mingo

Commit-ID:  065bef5af620dcedeb6dc26fdc0b1739a3c9adef
Gitweb:     http://git.kernel.org/tip/065bef5af620dcedeb6dc26fdc0b1739a3c9adef
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 22 Jan 2011 19:29:53 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:29:53 -0200

perf tools: Fix build by checking if extra warnings are supported

The -Wstack-protector and -Wvolatile-register-var warnings, for
instance, are not supported by gcc 3.4.6.

So fix by doing the same check we already do for -fstack-protector-all.

With this and the other patches in this series, perf builds unmodified
on, for instance, RHEL4.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2b5387d..7141c42 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -204,13 +204,11 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstack-protector
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wvolatile-register-var
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
@@ -294,6 +292,13 @@ ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y)
 	CFLAGS := $(CFLAGS) -fstack-protector-all
 endif
 
+ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y)
+       CFLAGS := $(CFLAGS) -Wstack-protector
+endif
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y)
+       CFLAGS := $(CFLAGS) -Wvolatile-register-var
+endif
 
 ### --- END CONFIGURATION SECTION ---
 

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

* [tip:perf/core] perf evsel: Introduce perf_evlist
       [not found]             ` <new-submission>
                                 ` (690 preceding siblings ...)
  2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build by checking if extra warnings are supported tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:14               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:14               ` [tip:perf/core] perf evlist: Adopt the pollfd array tip-bot for Arnaldo Carvalho de Melo
                                 ` (14 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, paulus, linux-kernel, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  361c99a661a78ed22264649440e87fe4fe8da1f2
Gitweb:     http://git.kernel.org/tip/361c99a661a78ed22264649440e87fe4fe8da1f2
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 20:56:53 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:28 -0200

perf evsel: Introduce perf_evlist

Killing two more perf wide global variables: nr_counters and evsel_list
as a list_head.

There are more operations that will need more fields in perf_evlist,
like the pollfd for polling all the fds in a list of evsel instances.

Use option->value to pass the evsel_list to parse_{events,filters}.

LKML-Reference: <new-submission>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                  |    2 +
 tools/perf/builtin-record.c          |   47 ++++++++++++++++-----------
 tools/perf/builtin-stat.c            |   34 +++++++++++--------
 tools/perf/builtin-top.c             |   60 +++++++++++++++++++--------------
 tools/perf/util/evlist.c             |   53 ++++++++++++++++++++++++++++++
 tools/perf/util/evlist.h             |   19 +++++++++++
 tools/perf/util/header.c             |   17 ++++++----
 tools/perf/util/header.h             |    7 +++-
 tools/perf/util/include/linux/list.h |    1 +
 tools/perf/util/parse-events.c       |   51 +++++-----------------------
 tools/perf/util/parse-events.h       |    7 ----
 11 files changed, 180 insertions(+), 118 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7141c42..f20bc6f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -402,6 +402,7 @@ LIB_H += util/debug.h
 LIB_H += util/debugfs.h
 LIB_H += util/event.h
 LIB_H += util/evsel.h
+LIB_H += util/evlist.h
 LIB_H += util/exec_cmd.h
 LIB_H += util/types.h
 LIB_H += util/levenshtein.h
@@ -440,6 +441,7 @@ LIB_OBJS += $(OUTPUT)util/ctype.o
 LIB_OBJS += $(OUTPUT)util/debugfs.o
 LIB_OBJS += $(OUTPUT)util/environment.o
 LIB_OBJS += $(OUTPUT)util/event.o
+LIB_OBJS += $(OUTPUT)util/evlist.o
 LIB_OBJS += $(OUTPUT)util/evsel.o
 LIB_OBJS += $(OUTPUT)util/exec_cmd.o
 LIB_OBJS += $(OUTPUT)util/help.o
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b2f729f..252ace8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -18,6 +18,7 @@
 
 #include "util/header.h"
 #include "util/event.h"
+#include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/debug.h"
 #include "util/session.h"
@@ -66,6 +67,7 @@ static bool			sample_address			=  false;
 static bool			sample_time			=  false;
 static bool			no_buildid			=  false;
 static bool			no_buildid_cache		=  false;
+static struct perf_evlist	*evsel_list;
 
 static long			samples				=      0;
 static u64			bytes_written			=      0;
@@ -229,7 +231,8 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n
 	return h_attr;
 }
 
-static void create_counter(struct perf_evsel *evsel, int cpu)
+static void create_counter(struct perf_evlist *evlist,
+			   struct perf_evsel *evsel, int cpu)
 {
 	char *filter = evsel->filter;
 	struct perf_event_attr *attr = &evsel->attr;
@@ -263,7 +266,7 @@ static void create_counter(struct perf_evsel *evsel, int cpu)
 
 	attr->sample_type	|= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
 
-	if (nr_counters > 1)
+	if (evlist->nr_entries > 1)
 		attr->sample_type |= PERF_SAMPLE_ID;
 
 	/*
@@ -410,7 +413,7 @@ try_again:
 
 		if (evsel->idx || thread_index) {
 			struct perf_evsel *first;
-			first = list_entry(evsel_list.next, struct perf_evsel, node);
+			first = list_entry(evlist->entries.next, struct perf_evsel, node);
 			ret = ioctl(FD(evsel, nr_cpu, thread_index),
 				    PERF_EVENT_IOC_SET_OUTPUT,
 				    FD(first, nr_cpu, 0));
@@ -449,14 +452,14 @@ try_again:
 		sample_type = attr->sample_type;
 }
 
-static void open_counters(int cpu)
+static void open_counters(struct perf_evlist *evlist, int cpu)
 {
 	struct perf_evsel *pos;
 
 	group_fd = -1;
 
-	list_for_each_entry(pos, &evsel_list, node)
-		create_counter(pos, cpu);
+	list_for_each_entry(pos, &evlist->entries, node)
+		create_counter(evlist, pos, cpu);
 
 	nr_cpu++;
 }
@@ -481,9 +484,9 @@ static void atexit_header(void)
 
 		if (!no_buildid)
 			process_buildids();
-		perf_header__write(&session->header, output, true);
+		perf_header__write(&session->header, evsel_list, output, true);
 		perf_session__delete(session);
-		perf_evsel_list__delete();
+		perf_evlist__delete(evsel_list);
 		symbol__exit();
 	}
 }
@@ -611,7 +614,7 @@ static int __cmd_record(int argc, const char **argv)
 			goto out_delete_session;
 	}
 
-	if (have_tracepoints(&evsel_list))
+	if (have_tracepoints(&evsel_list->entries))
 		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
 
 	/*
@@ -674,10 +677,10 @@ static int __cmd_record(int argc, const char **argv)
 	}
 
 	if (!system_wide && no_inherit && !cpu_list) {
-		open_counters(-1);
+		open_counters(evsel_list, -1);
 	} else {
 		for (i = 0; i < cpus->nr; i++)
-			open_counters(cpus->map[i]);
+			open_counters(evsel_list, cpus->map[i]);
 	}
 
 	perf_session__set_sample_type(session, sample_type);
@@ -687,7 +690,8 @@ static int __cmd_record(int argc, const char **argv)
 		if (err < 0)
 			return err;
 	} else if (file_new) {
-		err = perf_header__write(&session->header, output, false);
+		err = perf_header__write(&session->header, evsel_list,
+					 output, false);
 		if (err < 0)
 			return err;
 	}
@@ -712,7 +716,7 @@ static int __cmd_record(int argc, const char **argv)
 			return err;
 		}
 
-		if (have_tracepoints(&evsel_list)) {
+		if (have_tracepoints(&evsel_list->entries)) {
 			/*
 			 * FIXME err <= 0 here actually means that
 			 * there were no tracepoints so its not really
@@ -721,7 +725,7 @@ static int __cmd_record(int argc, const char **argv)
 			 * return this more properly and also
 			 * propagate errors that now are calling die()
 			 */
-			err = event__synthesize_tracing_data(output, &evsel_list,
+			err = event__synthesize_tracing_data(output, evsel_list,
 							     process_synthesized_event,
 							     session);
 			if (err <= 0) {
@@ -797,7 +801,7 @@ static int __cmd_record(int argc, const char **argv)
 			for (i = 0; i < nr_cpu; i++) {
 				struct perf_evsel *pos;
 
-				list_for_each_entry(pos, &evsel_list, node) {
+				list_for_each_entry(pos, &evsel_list->entries, node) {
 					for (thread = 0;
 						thread < threads->nr;
 						thread++)
@@ -838,10 +842,10 @@ static const char * const record_usage[] = {
 static bool force, append_file;
 
 const struct option record_options[] = {
-	OPT_CALLBACK('e', "event", NULL, "event",
+	OPT_CALLBACK('e', "event", &evsel_list, "event",
 		     "event selector. use 'perf list' to list available events",
 		     parse_events),
-	OPT_CALLBACK(0, "filter", NULL, "filter",
+	OPT_CALLBACK(0, "filter", &evsel_list, "filter",
 		     "event filter", parse_filter),
 	OPT_INTEGER('p', "pid", &target_pid,
 		    "record events on existing process id"),
@@ -892,6 +896,10 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	int err = -ENOMEM;
 	struct perf_evsel *pos;
 
+	evsel_list = perf_evlist__new();
+	if (evsel_list == NULL)
+		return -ENOMEM;
+
 	argc = parse_options(argc, argv, record_options, record_usage,
 			    PARSE_OPT_STOP_AT_NON_OPTION);
 	if (!argc && target_pid == -1 && target_tid == -1 &&
@@ -913,7 +921,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	if (no_buildid_cache || no_buildid)
 		disable_buildid_cache();
 
-	if (list_empty(&evsel_list) && perf_evsel_list__create_default() < 0) {
+	if (evsel_list->nr_entries == 0 &&
+	    perf_evlist__add_default(evsel_list) < 0) {
 		pr_err("Not enough memory for event selector list\n");
 		goto out_symbol_exit;
 	}
@@ -933,7 +942,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		return -1;
 	}
 
-	list_for_each_entry(pos, &evsel_list, node) {
+	list_for_each_entry(pos, &evsel_list->entries, node) {
 		if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 		if (perf_header__push_event(pos->attr.config, event_name(pos)))
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a482a19..da90902 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -43,6 +43,7 @@
 #include "util/parse-options.h"
 #include "util/parse-events.h"
 #include "util/event.h"
+#include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/debug.h"
 #include "util/header.h"
@@ -71,6 +72,8 @@ static struct perf_event_attr default_attrs[] = {
 
 };
 
+struct perf_evlist		*evsel_list;
+
 static bool			system_wide			=  false;
 static struct cpu_map		*cpus;
 static int			run_idx				=  0;
@@ -309,7 +312,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	list_for_each_entry(counter, &evsel_list, node) {
+	list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (create_perf_stat_counter(counter) < 0) {
 			if (errno == -EPERM || errno == -EACCES) {
 				error("You may not have permission to collect %sstats.\n"
@@ -347,12 +350,12 @@ static int run_perf_stat(int argc __used, const char **argv)
 	update_stats(&walltime_nsecs_stats, t1 - t0);
 
 	if (no_aggr) {
-		list_for_each_entry(counter, &evsel_list, node) {
+		list_for_each_entry(counter, &evsel_list->entries, node) {
 			read_counter(counter);
 			perf_evsel__close_fd(counter, cpus->nr, 1);
 		}
 	} else {
-		list_for_each_entry(counter, &evsel_list, node) {
+		list_for_each_entry(counter, &evsel_list->entries, node) {
 			read_counter_aggr(counter);
 			perf_evsel__close_fd(counter, cpus->nr, threads->nr);
 		}
@@ -555,10 +558,10 @@ static void print_stat(int argc, const char **argv)
 	}
 
 	if (no_aggr) {
-		list_for_each_entry(counter, &evsel_list, node)
+		list_for_each_entry(counter, &evsel_list->entries, node)
 			print_counter(counter);
 	} else {
-		list_for_each_entry(counter, &evsel_list, node)
+		list_for_each_entry(counter, &evsel_list->entries, node)
 			print_counter_aggr(counter);
 	}
 
@@ -610,7 +613,7 @@ static int stat__set_big_num(const struct option *opt __used,
 }
 
 static const struct option options[] = {
-	OPT_CALLBACK('e', "event", NULL, "event",
+	OPT_CALLBACK('e', "event", &evsel_list, "event",
 		     "event selector. use 'perf list' to list available events",
 		     parse_events),
 	OPT_BOOLEAN('i', "no-inherit", &no_inherit,
@@ -648,6 +651,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 
 	setlocale(LC_ALL, "");
 
+	evsel_list = perf_evlist__new();
+	if (evsel_list == NULL)
+		return -ENOMEM;
+
 	argc = parse_options(argc, argv, options, stat_usage,
 		PARSE_OPT_STOP_AT_NON_OPTION);
 
@@ -679,17 +686,14 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(stat_usage, options);
 
 	/* Set attrs and nr_counters if no event is selected and !null_run */
-	if (!null_run && !nr_counters) {
+	if (!null_run && !evsel_list->nr_entries) {
 		size_t c;
 
-		nr_counters = ARRAY_SIZE(default_attrs);
-
 		for (c = 0; c < ARRAY_SIZE(default_attrs); ++c) {
-			pos = perf_evsel__new(&default_attrs[c],
-					      nr_counters);
+			pos = perf_evsel__new(&default_attrs[c], c);
 			if (pos == NULL)
 				goto out;
-			list_add(&pos->node, &evsel_list);
+			perf_evlist__add(evsel_list, pos);
 		}
 	}
 
@@ -713,7 +717,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 		return -1;
 	}
 
-	list_for_each_entry(pos, &evsel_list, node) {
+	list_for_each_entry(pos, &evsel_list->entries, node) {
 		if (perf_evsel__alloc_stat_priv(pos) < 0 ||
 		    perf_evsel__alloc_counts(pos, cpus->nr) < 0 ||
 		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
@@ -741,9 +745,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 	if (status != -1)
 		print_stat(argc, argv);
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list, node)
+	list_for_each_entry(pos, &evsel_list->entries, node)
 		perf_evsel__free_stat_priv(pos);
-	perf_evsel_list__delete();
+	perf_evlist__delete(evsel_list);
 out:
 	thread_map__delete(threads);
 	threads = NULL;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index b6998e0..216b62e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -21,6 +21,7 @@
 #include "perf.h"
 
 #include "util/color.h"
+#include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/session.h"
 #include "util/symbol.h"
@@ -60,6 +61,8 @@
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 
+struct perf_evlist		*evsel_list;
+
 static bool			system_wide			=  false;
 
 static int			default_interval		=      0;
@@ -267,7 +270,7 @@ static void __zero_source_counters(struct sym_entry *syme)
 
 	line = syme->src->lines;
 	while (line) {
-		for (i = 0; i < nr_counters; i++)
+		for (i = 0; i < evsel_list->nr_entries; i++)
 			line->count[i] = 0;
 		line = line->next;
 	}
@@ -414,7 +417,7 @@ static double sym_weight(const struct sym_entry *sym)
 	if (!display_weighted)
 		return weight;
 
-	for (counter = 1; counter < nr_counters-1; counter++)
+	for (counter = 1; counter < evsel_list->nr_entries - 1; counter++)
 		weight *= sym->count[counter];
 
 	weight /= (sym->count[counter] + 1);
@@ -501,7 +504,7 @@ static void print_sym_table(void)
 			rb_insert_active_sym(&tmp, syme);
 			sum_ksamples += syme->snap_count;
 
-			for (j = 0; j < nr_counters; j++)
+			for (j = 0; j < evsel_list->nr_entries; j++)
 				syme->count[j] = zero ? 0 : syme->count[j] * 7 / 8;
 		} else
 			list_remove_active_sym(syme);
@@ -535,9 +538,9 @@ static void print_sym_table(void)
 			esamples_percent);
 	}
 
-	if (nr_counters == 1 || !display_weighted) {
+	if (evsel_list->nr_entries == 1 || !display_weighted) {
 		struct perf_evsel *first;
-		first = list_entry(evsel_list.next, struct perf_evsel, node);
+		first = list_entry(evsel_list->entries.next, struct perf_evsel, node);
 		printf("%" PRIu64, (uint64_t)first->attr.sample_period);
 		if (freq)
 			printf("Hz ");
@@ -547,7 +550,7 @@ static void print_sym_table(void)
 
 	if (!display_weighted)
 		printf("%s", event_name(sym_evsel));
-	else list_for_each_entry(counter, &evsel_list, node) {
+	else list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (counter->idx)
 			printf("/");
 
@@ -606,7 +609,7 @@ static void print_sym_table(void)
 			sym_width = winsize.ws_col - dso_width - 29;
 	}
 	putchar('\n');
-	if (nr_counters == 1)
+	if (evsel_list->nr_entries == 1)
 		printf("             samples  pcnt");
 	else
 		printf("   weight    samples  pcnt");
@@ -615,7 +618,7 @@ static void print_sym_table(void)
 		printf("         RIP       ");
 	printf(" %-*.*s DSO\n", sym_width, sym_width, "function");
 	printf("   %s    _______ _____",
-	       nr_counters == 1 ? "      " : "______");
+	       evsel_list->nr_entries == 1 ? "      " : "______");
 	if (verbose)
 		printf(" ________________");
 	printf(" %-*.*s", sym_width, sym_width, graph_line);
@@ -634,7 +637,7 @@ static void print_sym_table(void)
 		pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) /
 					 sum_ksamples));
 
-		if (nr_counters == 1 || !display_weighted)
+		if (evsel_list->nr_entries == 1 || !display_weighted)
 			printf("%20.2f ", syme->weight);
 		else
 			printf("%9.1f %10ld ", syme->weight, syme->snap_count);
@@ -744,7 +747,7 @@ static void print_mapped_keys(void)
 	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)
+	if (evsel_list->nr_entries > 1)
 		fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", event_name(sym_evsel));
 
 	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", count_filter);
@@ -753,7 +756,7 @@ static void print_mapped_keys(void)
 	fprintf(stdout, "\t[s]     annotate symbol.                   \t(%s)\n", name?: "NULL");
 	fprintf(stdout, "\t[S]     stop annotation.\n");
 
-	if (nr_counters > 1)
+	if (evsel_list->nr_entries > 1)
 		fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
 
 	fprintf(stdout,
@@ -783,7 +786,7 @@ static int key_mapped(int c)
 			return 1;
 		case 'E':
 		case 'w':
-			return nr_counters > 1 ? 1 : 0;
+			return evsel_list->nr_entries > 1 ? 1 : 0;
 		default:
 			break;
 	}
@@ -831,22 +834,22 @@ static void handle_keypress(struct perf_session *session, int c)
 				signal(SIGWINCH, SIG_DFL);
 			break;
 		case 'E':
-			if (nr_counters > 1) {
+			if (evsel_list->nr_entries > 1) {
 				fprintf(stderr, "\nAvailable events:");
 
-				list_for_each_entry(sym_evsel, &evsel_list, node)
+				list_for_each_entry(sym_evsel, &evsel_list->entries, node)
 					fprintf(stderr, "\n\t%d %s", sym_evsel->idx, event_name(sym_evsel));
 
 				prompt_integer(&sym_counter, "Enter details event counter");
 
-				if (sym_counter >= nr_counters) {
-					sym_evsel = list_entry(evsel_list.next, struct perf_evsel, node);
+				if (sym_counter >= evsel_list->nr_entries) {
+					sym_evsel = list_entry(evsel_list->entries.next, struct perf_evsel, node);
 					sym_counter = 0;
 					fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(sym_evsel));
 					sleep(1);
 					break;
 				}
-				list_for_each_entry(sym_evsel, &evsel_list, node)
+				list_for_each_entry(sym_evsel, &evsel_list->entries, node)
 					if (sym_evsel->idx == sym_counter)
 						break;
 			} else sym_counter = 0;
@@ -1198,7 +1201,7 @@ static void perf_session__mmap_read(struct perf_session *self)
 	int i, thread_index;
 
 	for (i = 0; i < cpus->nr; i++) {
-		list_for_each_entry(counter, &evsel_list, node) {
+		list_for_each_entry(counter, &evsel_list->entries, node) {
 			for (thread_index = 0;
 				thread_index < threads->nr;
 				thread_index++) {
@@ -1312,7 +1315,7 @@ static int __cmd_top(void)
 
 	for (i = 0; i < cpus->nr; i++) {
 		group_fd = -1;
-		list_for_each_entry(counter, &evsel_list, node)
+		list_for_each_entry(counter, &evsel_list->entries, node)
 			start_counter(i, counter);
 	}
 
@@ -1354,7 +1357,7 @@ static const char * const top_usage[] = {
 };
 
 static const struct option options[] = {
-	OPT_CALLBACK('e', "event", NULL, "event",
+	OPT_CALLBACK('e', "event", &evsel_list, "event",
 		     "event selector. use 'perf list' to list available events",
 		     parse_events),
 	OPT_INTEGER('c', "count", &default_interval,
@@ -1404,6 +1407,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	struct perf_evsel *pos;
 	int status = -ENOMEM;
 
+	evsel_list = perf_evlist__new();
+	if (evsel_list == NULL)
+		return -ENOMEM;
+
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	argc = parse_options(argc, argv, options, top_usage, 0);
@@ -1431,7 +1438,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		cpu_list = NULL;
 	}
 
-	if (!nr_counters && perf_evsel_list__create_default() < 0) {
+	if (!evsel_list->nr_entries &&
+	    perf_evlist__add_default(evsel_list) < 0) {
 		pr_err("Not enough memory for event selector list\n");
 		return -ENOMEM;
 	}
@@ -1459,7 +1467,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	if (cpus == NULL)
 		usage_with_options(top_usage, options);
 
-	list_for_each_entry(pos, &evsel_list, node) {
+	list_for_each_entry(pos, &evsel_list->entries, node) {
 		if (perf_evsel__alloc_mmap_per_thread(pos, cpus->nr, threads->nr) < 0 ||
 		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
@@ -1472,10 +1480,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		pos->attr.sample_period = default_interval;
 	}
 
-	sym_evsel = list_entry(evsel_list.next, struct perf_evsel, node);
+	sym_evsel = list_entry(evsel_list->entries.next, struct perf_evsel, node);
 
 	symbol_conf.priv_size = (sizeof(struct sym_entry) +
-				 (nr_counters + 1) * sizeof(unsigned long));
+				 (evsel_list->nr_entries + 1) * sizeof(unsigned long));
 
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
 	if (symbol__init() < 0)
@@ -1489,9 +1497,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 
 	status = __cmd_top();
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list, node)
+	list_for_each_entry(pos, &evsel_list->entries, node)
 		perf_evsel__free_mmap(pos);
-	perf_evsel_list__delete();
+	perf_evlist__delete(evsel_list);
 
 	return status;
 }
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
new file mode 100644
index 0000000..7b4faec
--- /dev/null
+++ b/tools/perf/util/evlist.c
@@ -0,0 +1,53 @@
+#include "evlist.h"
+#include "evsel.h"
+#include "util.h"
+
+struct perf_evlist *perf_evlist__new(void)
+{
+	struct perf_evlist *evlist = zalloc(sizeof(*evlist));
+
+	if (evlist != NULL) {
+		INIT_LIST_HEAD(&evlist->entries);
+	}
+
+	return evlist;
+}
+
+static void perf_evlist__purge(struct perf_evlist *evlist)
+{
+	struct perf_evsel *pos, *n;
+
+	list_for_each_entry_safe(pos, n, &evlist->entries, node) {
+		list_del_init(&pos->node);
+		perf_evsel__delete(pos);
+	}
+
+	evlist->nr_entries = 0;
+}
+
+void perf_evlist__delete(struct perf_evlist *evlist)
+{
+	perf_evlist__purge(evlist);
+	free(evlist);
+}
+
+void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry)
+{
+	list_add_tail(&entry->node, &evlist->entries);
+	++evlist->nr_entries;
+}
+
+int perf_evlist__add_default(struct perf_evlist *evlist)
+{
+	struct perf_event_attr attr = {
+		.type = PERF_TYPE_HARDWARE,
+		.config = PERF_COUNT_HW_CPU_CYCLES,
+	};
+	struct perf_evsel *evsel = perf_evsel__new(&attr, 0);
+
+	if (evsel == NULL)
+		return -ENOMEM;
+
+	perf_evlist__add(evlist, evsel);
+	return 0;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
new file mode 100644
index 0000000..48db91a
--- /dev/null
+++ b/tools/perf/util/evlist.h
@@ -0,0 +1,19 @@
+#ifndef __PERF_EVLIST_H
+#define __PERF_EVLIST_H 1
+
+#include <linux/list.h>
+
+struct perf_evlist {
+	struct list_head entries;
+	int		 nr_entries;
+};
+
+struct perf_evsel;
+
+struct perf_evlist *perf_evlist__new(void);
+void perf_evlist__delete(struct perf_evlist *evlist);
+
+void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
+int perf_evlist__add_default(struct perf_evlist *evlist);
+
+#endif /* __PERF_EVLIST_H */
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index f6a929e7..f0138d4 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -8,6 +8,7 @@
 #include <linux/list.h>
 #include <linux/kernel.h>
 
+#include "evlist.h"
 #include "util.h"
 #include "header.h"
 #include "../perf.h"
@@ -428,7 +429,8 @@ static bool perf_session__read_build_ids(struct perf_session *self, bool with_hi
 	return ret;
 }
 
-static int perf_header__adds_write(struct perf_header *self, int fd)
+static int perf_header__adds_write(struct perf_header *self,
+				   struct perf_evlist *evlist, int fd)
 {
 	int nr_sections;
 	struct perf_session *session;
@@ -463,7 +465,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
 
 		/* Write trace info */
 		trace_sec->offset = lseek(fd, 0, SEEK_CUR);
-		read_tracing_data(fd, &evsel_list);
+		read_tracing_data(fd, &evlist->entries);
 		trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
 	}
 
@@ -513,7 +515,8 @@ int perf_header__write_pipe(int fd)
 	return 0;
 }
 
-int perf_header__write(struct perf_header *self, int fd, bool at_exit)
+int perf_header__write(struct perf_header *self, struct perf_evlist *evlist,
+		       int fd, bool at_exit)
 {
 	struct perf_file_header f_header;
 	struct perf_file_attr   f_attr;
@@ -566,7 +569,7 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit)
 	self->data_offset = lseek(fd, 0, SEEK_CUR);
 
 	if (at_exit) {
-		err = perf_header__adds_write(self, fd);
+		err = perf_header__adds_write(self, evlist, fd);
 		if (err < 0)
 			return err;
 	}
@@ -1133,7 +1136,7 @@ int event__process_event_type(event_t *self,
 	return 0;
 }
 
-int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
+int event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
 				   event__handler_t process,
 				   struct perf_session *session __unused)
 {
@@ -1144,7 +1147,7 @@ int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
 	memset(&ev, 0, sizeof(ev));
 
 	ev.tracing_data.header.type = PERF_RECORD_HEADER_TRACING_DATA;
-	size = read_tracing_data_size(fd, pattrs);
+	size = read_tracing_data_size(fd, &evlist->entries);
 	if (size <= 0)
 		return size;
 	aligned_size = ALIGN(size, sizeof(u64));
@@ -1154,7 +1157,7 @@ int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
 
 	process(&ev, NULL, session);
 
-	err = read_tracing_data(fd, pattrs);
+	err = read_tracing_data(fd, &evlist->entries);
 	write_padded(fd, NULL, 0, padding);
 
 	return aligned_size;
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 33f16be..65afd7f 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -65,8 +65,11 @@ struct perf_header {
 int perf_header__init(struct perf_header *self);
 void perf_header__exit(struct perf_header *self);
 
+struct perf_evlist;
+
 int perf_header__read(struct perf_session *session, int fd);
-int perf_header__write(struct perf_header *self, int fd, bool at_exit);
+int perf_header__write(struct perf_header *self, struct perf_evlist *evlist,
+		       int fd, bool at_exit);
 int perf_header__write_pipe(int fd);
 
 int perf_header__add_attr(struct perf_header *self,
@@ -113,7 +116,7 @@ int event__synthesize_event_types(event__handler_t process,
 int event__process_event_type(event_t *self,
 			      struct perf_session *session);
 
-int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
+int event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
 				   event__handler_t process,
 				   struct perf_session *session);
 int event__process_tracing_data(event_t *self,
diff --git a/tools/perf/util/include/linux/list.h b/tools/perf/util/include/linux/list.h
index f5ca26e..356c7e4 100644
--- a/tools/perf/util/include/linux/list.h
+++ b/tools/perf/util/include/linux/list.h
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
 #include "../../../../include/linux/list.h"
 
 #ifndef PERF_LIST_H
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 135f69b..d3086ce 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,6 +1,7 @@
 #include "../../../include/linux/hw_breakpoint.h"
 #include "util.h"
 #include "../perf.h"
+#include "evlist.h"
 #include "evsel.h"
 #include "parse-options.h"
 #include "parse-events.h"
@@ -11,10 +12,6 @@
 #include "header.h"
 #include "debugfs.h"
 
-int				nr_counters;
-
-LIST_HEAD(evsel_list);
-
 struct event_symbol {
 	u8		type;
 	u64		config;
@@ -778,8 +775,9 @@ modifier:
 	return ret;
 }
 
-int parse_events(const struct option *opt __used, const char *str, int unset __used)
+int parse_events(const struct option *opt, const char *str, int unset __used)
 {
+	struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
 	struct perf_event_attr attr;
 	enum event_result ret;
 
@@ -794,12 +792,10 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
 
 		if (ret != EVT_HANDLED_ALL) {
 			struct perf_evsel *evsel;
-			evsel = perf_evsel__new(&attr,
-						nr_counters);
+			evsel = perf_evsel__new(&attr, evlist->nr_entries);
 			if (evsel == NULL)
 				return -1;
-			list_add_tail(&evsel->node, &evsel_list);
-			++nr_counters;
+			perf_evlist__add(evlist, evsel);
 		}
 
 		if (*str == 0)
@@ -813,13 +809,14 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u
 	return 0;
 }
 
-int parse_filter(const struct option *opt __used, const char *str,
+int parse_filter(const struct option *opt, const char *str,
 		 int unset __used)
 {
+	struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
 	struct perf_evsel *last = NULL;
 
-	if (!list_empty(&evsel_list))
-		last = list_entry(evsel_list.prev, struct perf_evsel, node);
+	if (evlist->nr_entries > 0)
+		last = list_entry(evlist->entries.prev, struct perf_evsel, node);
 
 	if (last == NULL || last->attr.type != PERF_TYPE_TRACEPOINT) {
 		fprintf(stderr,
@@ -981,33 +978,3 @@ void print_events(void)
 
 	exit(129);
 }
-
-int perf_evsel_list__create_default(void)
-{
-	struct perf_evsel *evsel;
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof(attr));
-	attr.type = PERF_TYPE_HARDWARE;
-	attr.config = PERF_COUNT_HW_CPU_CYCLES;
-
-	evsel = perf_evsel__new(&attr, 0);
-
-	if (evsel == NULL)
-		return -ENOMEM;
-
-	list_add(&evsel->node, &evsel_list);
-	++nr_counters;
-	return 0;
-}
-
-void perf_evsel_list__delete(void)
-{
-	struct perf_evsel *pos, *n;
-
-	list_for_each_entry_safe(pos, n, &evsel_list, node) {
-		list_del_init(&pos->node);
-		perf_evsel__delete(pos);
-	}
-	nr_counters = 0;
-}
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 458e3ec..cf7e94a 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -9,11 +9,6 @@
 struct list_head;
 struct perf_evsel;
 
-extern struct list_head evsel_list;
-
-int perf_evsel_list__create_default(void);
-void perf_evsel_list__delete(void);
-
 struct option;
 
 struct tracepoint_path {
@@ -25,8 +20,6 @@ struct tracepoint_path {
 extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
 extern bool have_tracepoints(struct list_head *evlist);
 
-extern int			nr_counters;
-
 const char *event_name(struct perf_evsel *event);
 extern const char *__event_name(int type, u64 config);
 

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

* [tip:perf/core] perf evlist: Adopt the pollfd array
       [not found]             ` <new-submission>
                                 ` (691 preceding siblings ...)
  2011-01-26  7:14               ` [tip:perf/core] perf evsel: Introduce perf_evlist tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:14               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:14               ` [tip:perf/core] perf evsel: Support event groups tip-bot for Arnaldo Carvalho de Melo
                                 ` (13 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, paulus, linux-kernel, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  5c581041cf97aa7980b442de81ddea8273d6dcde
Gitweb:     http://git.kernel.org/tip/5c581041cf97aa7980b442de81ddea8273d6dcde
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 22:30:02 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:28 -0200

perf evlist: Adopt the pollfd array

Allocating just the space needed for nr_cpus * nr_threads * nr_evsels,
not the MAX_NR_CPUS and counters.

LKML-Reference: <new-submission>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   20 +++++++-------------
 tools/perf/builtin-top.c    |   26 +++++++++++---------------
 tools/perf/util/evlist.c    |    9 +++++++++
 tools/perf/util/evlist.h    |    6 ++++++
 4 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 252ace8..1614d89 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -72,9 +72,6 @@ static struct perf_evlist	*evsel_list;
 static long			samples				=      0;
 static u64			bytes_written			=      0;
 
-static struct pollfd		*event_array;
-
-static int			nr_poll				=      0;
 static int			nr_cpu				=      0;
 
 static int			file_new			=      1;
@@ -432,9 +429,9 @@ try_again:
 				exit(-1);
 			}
 
-			event_array[nr_poll].fd = FD(evsel, nr_cpu, thread_index);
-			event_array[nr_poll].events = POLLIN;
-			nr_poll++;
+			evlist->pollfd[evlist->nr_fds].fd = FD(evsel, nr_cpu, thread_index);
+			evlist->pollfd[evlist->nr_fds].events = POLLIN;
+			evlist->nr_fds++;
 		}
 
 		if (filter != NULL) {
@@ -793,7 +790,7 @@ static int __cmd_record(int argc, const char **argv)
 		if (hits == samples) {
 			if (done)
 				break;
-			err = poll(event_array, nr_poll, -1);
+			err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1);
 			waking++;
 		}
 
@@ -948,9 +945,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		if (perf_header__push_event(pos->attr.config, event_name(pos)))
 			goto out_free_fd;
 	}
-	event_array = malloc((sizeof(struct pollfd) * MAX_NR_CPUS *
-			      MAX_COUNTERS * threads->nr));
-	if (!event_array)
+
+	if (perf_evlist__alloc_pollfd(evsel_list, cpus->nr, threads->nr) < 0)
 		goto out_free_fd;
 
 	if (user_interval != ULLONG_MAX)
@@ -968,13 +964,11 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	} else {
 		fprintf(stderr, "frequency and count are zero, aborting\n");
 		err = -EINVAL;
-		goto out_free_event_array;
+		goto out_free_fd;
 	}
 
 	err = __cmd_record(argc, argv);
 
-out_free_event_array:
-	free(event_array);
 out_free_fd:
 	thread_map__delete(threads);
 	threads = NULL;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 216b62e..1bc4652 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1193,8 +1193,6 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
 	md->prev = old;
 }
 
-static struct pollfd *event_array;
-
 static void perf_session__mmap_read(struct perf_session *self)
 {
 	struct perf_evsel *counter;
@@ -1212,10 +1210,10 @@ static void perf_session__mmap_read(struct perf_session *self)
 	}
 }
 
-int nr_poll;
 int group_fd;
 
-static void start_counter(int i, struct perf_evsel *evsel)
+static void start_counter(int i, struct perf_evlist *evlist,
+			  struct perf_evsel *evsel)
 {
 	struct xyarray *mmap_array = evsel->priv;
 	struct mmap_data *mm;
@@ -1281,9 +1279,9 @@ try_again:
 		if (group && group_fd == -1)
 			group_fd = FD(evsel, i, thread_index);
 
-		event_array[nr_poll].fd = FD(evsel, i, thread_index);
-		event_array[nr_poll].events = POLLIN;
-		nr_poll++;
+		evlist->pollfd[evlist->nr_fds].fd = FD(evsel, i, thread_index);
+		evlist->pollfd[evlist->nr_fds].events = POLLIN;
+		evlist->nr_fds++;
 
 		mm = xyarray__entry(mmap_array, i, thread_index);
 		mm->prev = 0;
@@ -1316,11 +1314,11 @@ static int __cmd_top(void)
 	for (i = 0; i < cpus->nr; i++) {
 		group_fd = -1;
 		list_for_each_entry(counter, &evsel_list->entries, node)
-			start_counter(i, counter);
+			start_counter(i, evsel_list, counter);
 	}
 
 	/* Wait for a minimal set of events before starting the snapshot */
-	poll(&event_array[0], nr_poll, 100);
+	poll(evsel_list->pollfd, evsel_list->nr_fds, 100);
 
 	perf_session__mmap_read(session);
 
@@ -1345,7 +1343,7 @@ static int __cmd_top(void)
 		perf_session__mmap_read(session);
 
 		if (hits == samples)
-			ret = poll(event_array, nr_poll, 100);
+			ret = poll(evsel_list->pollfd, evsel_list->nr_fds, 100);
 	}
 
 	return 0;
@@ -1426,11 +1424,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(top_usage, options);
 	}
 
-	event_array = malloc((sizeof(struct pollfd) *
-			      MAX_NR_CPUS * MAX_COUNTERS * threads->nr));
-	if (!event_array)
-		return -ENOMEM;
-
 	/* CPU and PID are mutually exclusive */
 	if (target_tid > 0 && cpu_list) {
 		printf("WARNING: PID switch overriding CPU\n");
@@ -1480,6 +1473,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		pos->attr.sample_period = default_interval;
 	}
 
+	if (perf_evlist__alloc_pollfd(evsel_list, cpus->nr, threads->nr) < 0)
+		goto out_free_fd;
+
 	sym_evsel = list_entry(evsel_list->entries.next, struct perf_evsel, node);
 
 	symbol_conf.priv_size = (sizeof(struct sym_entry) +
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7b4faec..2abf949 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1,3 +1,4 @@
+#include <poll.h>
 #include "evlist.h"
 #include "evsel.h"
 #include "util.h"
@@ -28,6 +29,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
 void perf_evlist__delete(struct perf_evlist *evlist)
 {
 	perf_evlist__purge(evlist);
+	free(evlist->pollfd);
 	free(evlist);
 }
 
@@ -51,3 +53,10 @@ int perf_evlist__add_default(struct perf_evlist *evlist)
 	perf_evlist__add(evlist, evsel);
 	return 0;
 }
+
+int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads)
+{
+	int nfds = ncpus * nthreads * evlist->nr_entries;
+	evlist->pollfd = malloc(sizeof(struct pollfd) * nfds);
+	return evlist->pollfd != NULL ? 0 : -ENOMEM;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 48db91a..a7d7e12 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -3,9 +3,13 @@
 
 #include <linux/list.h>
 
+struct pollfd;
+
 struct perf_evlist {
 	struct list_head entries;
 	int		 nr_entries;
+	int		 nr_fds;
+	struct pollfd	 *pollfd;
 };
 
 struct perf_evsel;
@@ -16,4 +20,6 @@ void perf_evlist__delete(struct perf_evlist *evlist);
 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
 int perf_evlist__add_default(struct perf_evlist *evlist);
 
+int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads);
+
 #endif /* __PERF_EVLIST_H */

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

* [tip:perf/core] perf evsel: Support event groups
       [not found]             ` <new-submission>
                                 ` (692 preceding siblings ...)
  2011-01-26  7:14               ` [tip:perf/core] perf evlist: Adopt the pollfd array tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:14               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:15               ` [tip:perf/core] perf evsel: Allow specifying if the inherit bit should be set tip-bot for Arnaldo Carvalho de Melo
                                 ` (12 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  f08199d314458610d4ca52f8e86e0a4ec7a7bc54
Gitweb:     http://git.kernel.org/tip/f08199d314458610d4ca52f8e86e0a4ec7a7bc54
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 11 Jan 2011 23:42:19 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:28 -0200

perf evsel: Support event groups

The perf_evsel__open now have an extra boolean argument specifying if
event grouping is desired.

The first file descriptor created on a CPU becomes the group leader.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |    4 ++--
 tools/perf/builtin-test.c |    4 ++--
 tools/perf/util/evsel.c   |   27 +++++++++++++++++----------
 tools/perf/util/evsel.h   |   10 ++++++----
 4 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index da90902..b5fe522 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -169,7 +169,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide)
-		return perf_evsel__open_per_cpu(evsel, cpus);
+		return perf_evsel__open_per_cpu(evsel, cpus, false);
 
 	attr->inherit = !no_inherit;
 	if (target_pid == -1 && target_tid == -1) {
@@ -177,7 +177,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 		attr->enable_on_exec = 1;
 	}
 
-	return perf_evsel__open_per_thread(evsel, threads);
+	return perf_evsel__open_per_thread(evsel, threads, false);
 }
 
 /*
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 5dcdba6..4282d67 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -289,7 +289,7 @@ static int test__open_syscall_event(void)
 		goto out_thread_map_delete;
 	}
 
-	if (perf_evsel__open_per_thread(evsel, threads) < 0) {
+	if (perf_evsel__open_per_thread(evsel, threads, false) < 0) {
 		pr_debug("failed to open counter: %s, "
 			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
 			 strerror(errno));
@@ -364,7 +364,7 @@ static int test__open_syscall_event_on_all_cpus(void)
 		goto out_thread_map_delete;
 	}
 
-	if (perf_evsel__open(evsel, cpus, threads) < 0) {
+	if (perf_evsel__open(evsel, cpus, threads, false) < 0) {
 		pr_debug("failed to open counter: %s, "
 			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
 			 strerror(errno));
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f5cfed6..da473ec 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -128,7 +128,7 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 }
 
 static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
-			      struct thread_map *threads)
+			      struct thread_map *threads, bool group)
 {
 	int cpu, thread;
 
@@ -137,12 +137,18 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 		return -1;
 
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
+		int group_fd = -1;
+
 		for (thread = 0; thread < threads->nr; thread++) {
 			FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
 								     threads->map[thread],
-								     cpus->map[cpu], -1, 0);
+								     cpus->map[cpu],
+								     group_fd, 0);
 			if (FD(evsel, cpu, thread) < 0)
 				goto out_close;
+
+			if (group && group_fd == -1)
+				group_fd = FD(evsel, cpu, thread);
 		}
 	}
 
@@ -175,10 +181,9 @@ static struct {
 	.threads = { -1, },
 };
 
-int perf_evsel__open(struct perf_evsel *evsel,
-		     struct cpu_map *cpus, struct thread_map *threads)
+int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
+		     struct thread_map *threads, bool group)
 {
-
 	if (cpus == NULL) {
 		/* Work around old compiler warnings about strict aliasing */
 		cpus = &empty_cpu_map.map;
@@ -187,15 +192,17 @@ int perf_evsel__open(struct perf_evsel *evsel,
 	if (threads == NULL)
 		threads = &empty_thread_map.map;
 
-	return __perf_evsel__open(evsel, cpus, threads);
+	return __perf_evsel__open(evsel, cpus, threads, group);
 }
 
-int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus)
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
+			     struct cpu_map *cpus, bool group)
 {
-	return __perf_evsel__open(evsel, cpus, &empty_thread_map.map);
+	return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group);
 }
 
-int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads)
+int perf_evsel__open_per_thread(struct perf_evsel *evsel,
+				struct thread_map *threads, bool group)
 {
-	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads);
+	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group);
 }
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index b2d755f..0962b50 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -45,10 +45,12 @@ int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
-int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus);
-int perf_evsel__open_per_thread(struct perf_evsel *evsel, struct thread_map *threads);
-int perf_evsel__open(struct perf_evsel *evsel, 
-		     struct cpu_map *cpus, struct thread_map *threads);
+int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
+			     struct cpu_map *cpus, bool group);
+int perf_evsel__open_per_thread(struct perf_evsel *evsel,
+				struct thread_map *threads, bool group);
+int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
+		     struct thread_map *threads, bool group);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\

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

* [tip:perf/core] perf evsel: Allow specifying if the inherit bit should be set
       [not found]             ` <new-submission>
                                 ` (693 preceding siblings ...)
  2011-01-26  7:14               ` [tip:perf/core] perf evsel: Support event groups tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:15               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:15               ` [tip:perf/core] perf top: Use perf_evsel__open tip-bot for Arnaldo Carvalho de Melo
                                 ` (11 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  9d04f1781772e11bd58806391555fc23ebb54377
Gitweb:     http://git.kernel.org/tip/9d04f1781772e11bd58806391555fc23ebb54377
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 00:08:18 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf evsel: Allow specifying if the inherit bit should be set

As this is a per-cpu attribute, we can't set it up in advance and use it
for all the calls.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |    4 ++--
 tools/perf/builtin-test.c |    4 ++--
 tools/perf/util/evsel.c   |   16 +++++++++-------
 tools/perf/util/evsel.h   |    6 +++---
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index b5fe522..e2a2d02 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -169,7 +169,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 				    PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	if (system_wide)
-		return perf_evsel__open_per_cpu(evsel, cpus, false);
+		return perf_evsel__open_per_cpu(evsel, cpus, false, false);
 
 	attr->inherit = !no_inherit;
 	if (target_pid == -1 && target_tid == -1) {
@@ -177,7 +177,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 		attr->enable_on_exec = 1;
 	}
 
-	return perf_evsel__open_per_thread(evsel, threads, false);
+	return perf_evsel__open_per_thread(evsel, threads, false, false);
 }
 
 /*
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 4282d67..7287158 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -289,7 +289,7 @@ static int test__open_syscall_event(void)
 		goto out_thread_map_delete;
 	}
 
-	if (perf_evsel__open_per_thread(evsel, threads, false) < 0) {
+	if (perf_evsel__open_per_thread(evsel, threads, false, false) < 0) {
 		pr_debug("failed to open counter: %s, "
 			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
 			 strerror(errno));
@@ -364,7 +364,7 @@ static int test__open_syscall_event_on_all_cpus(void)
 		goto out_thread_map_delete;
 	}
 
-	if (perf_evsel__open(evsel, cpus, threads, false) < 0) {
+	if (perf_evsel__open(evsel, cpus, threads, false, false) < 0) {
 		pr_debug("failed to open counter: %s, "
 			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
 			 strerror(errno));
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index da473ec..82a0053 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -128,7 +128,7 @@ int __perf_evsel__read(struct perf_evsel *evsel,
 }
 
 static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
-			      struct thread_map *threads, bool group)
+			      struct thread_map *threads, bool group, bool inherit)
 {
 	int cpu, thread;
 
@@ -139,6 +139,8 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
 		int group_fd = -1;
 
+		evsel->attr.inherit = (cpus->map[cpu] < 0) && inherit;
+
 		for (thread = 0; thread < threads->nr; thread++) {
 			FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
 								     threads->map[thread],
@@ -182,7 +184,7 @@ static struct {
 };
 
 int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
-		     struct thread_map *threads, bool group)
+		     struct thread_map *threads, bool group, bool inherit)
 {
 	if (cpus == NULL) {
 		/* Work around old compiler warnings about strict aliasing */
@@ -192,17 +194,17 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 	if (threads == NULL)
 		threads = &empty_thread_map.map;
 
-	return __perf_evsel__open(evsel, cpus, threads, group);
+	return __perf_evsel__open(evsel, cpus, threads, group, inherit);
 }
 
 int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
-			     struct cpu_map *cpus, bool group)
+			     struct cpu_map *cpus, bool group, bool inherit)
 {
-	return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group);
+	return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group, inherit);
 }
 
 int perf_evsel__open_per_thread(struct perf_evsel *evsel,
-				struct thread_map *threads, bool group)
+				struct thread_map *threads, bool group, bool inherit)
 {
-	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group);
+	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group, inherit);
 }
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 0962b50..1594696 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -46,11 +46,11 @@ void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
 int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
-			     struct cpu_map *cpus, bool group);
+			     struct cpu_map *cpus, bool group, bool inherit);
 int perf_evsel__open_per_thread(struct perf_evsel *evsel,
-				struct thread_map *threads, bool group);
+				struct thread_map *threads, bool group, bool inherit);
 int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
-		     struct thread_map *threads, bool group);
+		     struct thread_map *threads, bool group, bool inherit);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\

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

* [tip:perf/core] perf top: Use perf_evsel__open
       [not found]             ` <new-submission>
                                 ` (694 preceding siblings ...)
  2011-01-26  7:15               ` [tip:perf/core] perf evsel: Allow specifying if the inherit bit should be set tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:15               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:15               ` [tip:perf/core] perf record: " tip-bot for Arnaldo Carvalho de Melo
                                 ` (10 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  72cb7013e08dec29631e0447f9496b7bacd3e14b
Gitweb:     http://git.kernel.org/tip/72cb7013e08dec29631e0447f9496b7bacd3e14b
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 10:52:47 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf top: Use perf_evsel__open

Now that it handles group_fd and inherit we can use it, sharing it with
stat.

Next step: 'perf record' should use, then move the mmap_array out of
->priv and into perf_evsel, with top and record sharing this, and at the
same time, write a 'perf test' stress test.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |   92 +++++++++++++++++++++-------------------------
 1 files changed, 42 insertions(+), 50 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1bc4652..15d89be 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1210,39 +1210,50 @@ static void perf_session__mmap_read(struct perf_session *self)
 	}
 }
 
-int group_fd;
-
 static void start_counter(int i, struct perf_evlist *evlist,
 			  struct perf_evsel *evsel)
 {
 	struct xyarray *mmap_array = evsel->priv;
 	struct mmap_data *mm;
-	struct perf_event_attr *attr;
-	int cpu = -1;
 	int thread_index;
 
-	if (target_tid == -1)
-		cpu = cpus->map[i];
-
-	attr = &evsel->attr;
+	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
+		assert(FD(evsel, i, thread_index) >= 0);
+		fcntl(FD(evsel, i, thread_index), F_SETFL, O_NONBLOCK);
 
-	attr->sample_type	= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+		evlist->pollfd[evlist->nr_fds].fd = FD(evsel, i, thread_index);
+		evlist->pollfd[evlist->nr_fds].events = POLLIN;
+		evlist->nr_fds++;
 
-	if (freq) {
-		attr->sample_type	|= PERF_SAMPLE_PERIOD;
-		attr->freq		= 1;
-		attr->sample_freq	= freq;
+		mm = xyarray__entry(mmap_array, i, thread_index);
+		mm->prev = 0;
+		mm->mask = mmap_pages*page_size - 1;
+		mm->base = mmap(NULL, (mmap_pages+1)*page_size,
+				PROT_READ, MAP_SHARED, FD(evsel, i, thread_index), 0);
+		if (mm->base == MAP_FAILED)
+			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 	}
+}
+
+static void start_counters(struct perf_evlist *evlist)
+{
+	struct perf_evsel *counter;
+	int i;
 
-	attr->inherit		= (cpu < 0) && inherit;
-	attr->mmap		= 1;
+	list_for_each_entry(counter, &evlist->entries, node) {
+		struct perf_event_attr *attr = &counter->attr;
 
-	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
-try_again:
-		FD(evsel, i, thread_index) = sys_perf_event_open(attr,
-				threads->map[thread_index], cpu, group_fd, 0);
+		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 (FD(evsel, i, thread_index) < 0) {
+		attr->mmap = 1;
+try_again:
+		if (perf_evsel__open(counter, cpus, threads, group, inherit) < 0) {
 			int err = errno;
 
 			if (err == EPERM || err == EACCES)
@@ -1254,8 +1265,8 @@ try_again:
 			 * 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_HW_CPU_CYCLES) {
+			if (attr->type == PERF_TYPE_HARDWARE &&
+			    attr->config == PERF_COUNT_HW_CPU_CYCLES) {
 
 				if (verbose)
 					warning(" ... trying to fall back to cpu-clock-ticks\n");
@@ -1265,39 +1276,24 @@ try_again:
 				goto try_again;
 			}
 			printf("\n");
-			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-					FD(evsel, i, thread_index), strerror(err));
+			error("sys_perf_event_open() syscall returned with %d "
+			      "(%s).  /bin/dmesg may provide additional information.\n",
+			      err, strerror(err));
 			die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 			exit(-1);
 		}
-		assert(FD(evsel, i, thread_index) >= 0);
-		fcntl(FD(evsel, i, thread_index), F_SETFL, O_NONBLOCK);
-
-		/*
-		 * First counter acts as the group leader:
-		 */
-		if (group && group_fd == -1)
-			group_fd = FD(evsel, i, thread_index);
-
-		evlist->pollfd[evlist->nr_fds].fd = FD(evsel, i, thread_index);
-		evlist->pollfd[evlist->nr_fds].events = POLLIN;
-		evlist->nr_fds++;
+	}
 
-		mm = xyarray__entry(mmap_array, i, thread_index);
-		mm->prev = 0;
-		mm->mask = mmap_pages*page_size - 1;
-		mm->base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ, MAP_SHARED, FD(evsel, i, thread_index), 0);
-		if (mm->base == MAP_FAILED)
-			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
+	for (i = 0; i < cpus->nr; i++) {
+		list_for_each_entry(counter, &evlist->entries, node)
+			start_counter(i, evsel_list, counter);
 	}
 }
 
 static int __cmd_top(void)
 {
 	pthread_t thread;
-	struct perf_evsel *counter;
-	int i, ret;
+	int ret;
 	/*
 	 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
 	 * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
@@ -1311,11 +1307,7 @@ static int __cmd_top(void)
 	else
 		event__synthesize_threads(event__process, session);
 
-	for (i = 0; i < cpus->nr; i++) {
-		group_fd = -1;
-		list_for_each_entry(counter, &evsel_list->entries, node)
-			start_counter(i, evsel_list, counter);
-	}
+	start_counters(evsel_list);
 
 	/* Wait for a minimal set of events before starting the snapshot */
 	poll(evsel_list->pollfd, evsel_list->nr_fds, 100);

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

* [tip:perf/core] perf record: Use perf_evsel__open
       [not found]             ` <new-submission>
                                 ` (695 preceding siblings ...)
  2011-01-26  7:15               ` [tip:perf/core] perf top: Use perf_evsel__open tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:15               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:16               ` [tip:perf/core] perf evsel: Introduce mmap support tip-bot for Arnaldo Carvalho de Melo
                                 ` (9 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  dd7927f4f8ee75b032ff15aeef4bda49719a443a
Gitweb:     http://git.kernel.org/tip/dd7927f4f8ee75b032ff15aeef4bda49719a443a
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 14:28:51 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf record: Use perf_evsel__open

Now its time to factor out the mmap handling bits into the perf_evsel
class.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |  233 +++++++++++++++++++++----------------------
 1 files changed, 113 insertions(+), 120 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 1614d89..ec43f2e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -72,8 +72,6 @@ static struct perf_evlist	*evsel_list;
 static long			samples				=      0;
 static u64			bytes_written			=      0;
 
-static int			nr_cpu				=      0;
-
 static int			file_new			=      1;
 static off_t			post_processing_offset;
 
@@ -208,8 +206,6 @@ static void sig_atexit(void)
 	kill(getpid(), signr);
 }
 
-static int group_fd;
-
 static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int nr)
 {
 	struct perf_header_attr *h_attr;
@@ -234,7 +230,6 @@ static void create_counter(struct perf_evlist *evlist,
 	char *filter = evsel->filter;
 	struct perf_event_attr *attr = &evsel->attr;
 	struct perf_header_attr *h_attr;
-	int track = !evsel->idx; /* only the first counter needs these */
 	int thread_index;
 	int ret;
 	struct {
@@ -243,19 +238,77 @@ static void create_counter(struct perf_evlist *evlist,
 		u64 time_running;
 		u64 id;
 	} read_data;
-	/*
- 	 * Check if parse_single_tracepoint_event has already asked for
- 	 * PERF_SAMPLE_TIME.
- 	 *
-	 * XXX this is kludgy but short term fix for problems introduced by
-	 * eac23d1c that broke 'perf script' by having different sample_types
-	 * when using multiple tracepoint events when we use a perf binary
-	 * that tries to use sample_id_all on an older kernel.
- 	 *
- 	 * We need to move counter creation to perf_session, support
- 	 * different sample_types, etc.
- 	 */
-	bool time_needed = attr->sample_type & PERF_SAMPLE_TIME;
+
+	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
+		h_attr = get_header_attr(attr, evsel->idx);
+		if (h_attr == NULL)
+			die("nomem\n");
+
+		if (!file_new) {
+			if (memcmp(&h_attr->attr, attr, sizeof(*attr))) {
+				fprintf(stderr, "incompatible append\n");
+				exit(-1);
+			}
+		}
+
+		if (read(FD(evsel, cpu, thread_index), &read_data, sizeof(read_data)) == -1) {
+			perror("Unable to read perf file descriptor");
+			exit(-1);
+		}
+
+		if (perf_header_attr__add_id(h_attr, read_data.id) < 0) {
+			pr_warning("Not enough memory to add id\n");
+			exit(-1);
+		}
+
+		assert(FD(evsel, cpu, thread_index) >= 0);
+		fcntl(FD(evsel, cpu, thread_index), F_SETFL, O_NONBLOCK);
+
+		if (evsel->idx || thread_index) {
+			struct perf_evsel *first;
+			first = list_entry(evlist->entries.next, struct perf_evsel, node);
+			ret = ioctl(FD(evsel, cpu, thread_index),
+				    PERF_EVENT_IOC_SET_OUTPUT,
+				    FD(first, cpu, 0));
+			if (ret) {
+				error("failed to set output: %d (%s)\n", errno,
+						strerror(errno));
+				exit(-1);
+			}
+		} else {
+			mmap_array[cpu].prev = 0;
+			mmap_array[cpu].mask = mmap_pages*page_size - 1;
+			mmap_array[cpu].base = mmap(NULL, (mmap_pages+1)*page_size,
+				PROT_READ | PROT_WRITE, MAP_SHARED, FD(evsel, cpu, thread_index), 0);
+			if (mmap_array[cpu].base == MAP_FAILED) {
+				error("failed to mmap with %d (%s)\n", errno, strerror(errno));
+				exit(-1);
+			}
+
+			evlist->pollfd[evlist->nr_fds].fd = FD(evsel, cpu, thread_index);
+			evlist->pollfd[evlist->nr_fds].events = POLLIN;
+			evlist->nr_fds++;
+		}
+
+		if (filter != NULL) {
+			ret = ioctl(FD(evsel, cpu, thread_index),
+				    PERF_EVENT_IOC_SET_FILTER, filter);
+			if (ret) {
+				error("failed to set filter with %d (%s)\n", errno,
+						strerror(errno));
+				exit(-1);
+			}
+		}
+	}
+
+	if (!sample_type)
+		sample_type = attr->sample_type;
+}
+
+static void config_attr(struct perf_evsel *evsel, struct perf_evlist *evlist)
+{
+	struct perf_event_attr *attr = &evsel->attr;
+	int track = !evsel->idx; /* only the first counter needs these */
 
 	attr->read_format	= PERF_FORMAT_TOTAL_TIME_ENABLED |
 				  PERF_FORMAT_TOTAL_TIME_RUNNING |
@@ -315,19 +368,39 @@ static void create_counter(struct perf_evlist *evlist,
 
 	attr->mmap		= track;
 	attr->comm		= track;
-	attr->inherit		= !no_inherit;
+
 	if (target_pid == -1 && target_tid == -1 && !system_wide) {
 		attr->disabled = 1;
 		attr->enable_on_exec = 1;
 	}
-retry_sample_id:
-	attr->sample_id_all = sample_id_all_avail ? 1 : 0;
+}
 
-	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
-try_again:
-		FD(evsel, nr_cpu, thread_index) = sys_perf_event_open(attr, threads->map[thread_index], cpu, group_fd, 0);
+static void open_counters(struct perf_evlist *evlist)
+{
+	struct perf_evsel *pos;
+	int cpu;
+
+	list_for_each_entry(pos, &evlist->entries, node) {
+		struct perf_event_attr *attr = &pos->attr;
+		/*
+		 * Check if parse_single_tracepoint_event has already asked for
+		 * PERF_SAMPLE_TIME.
+		 *
+		 * XXX this is kludgy but short term fix for problems introduced by
+		 * eac23d1c that broke 'perf script' by having different sample_types
+		 * when using multiple tracepoint events when we use a perf binary
+		 * that tries to use sample_id_all on an older kernel.
+		 *
+		 * We need to move counter creation to perf_session, support
+		 * different sample_types, etc.
+		 */
+		bool time_needed = attr->sample_type & PERF_SAMPLE_TIME;
 
-		if (FD(evsel, nr_cpu, thread_index) < 0) {
+		config_attr(pos, evlist);
+retry_sample_id:
+		attr->sample_id_all = sample_id_all_avail ? 1 : 0;
+try_again:
+		if (perf_evsel__open(pos, cpus, threads, group, !no_inherit) < 0) {
 			int err = errno;
 
 			if (err == EPERM || err == EACCES)
@@ -364,7 +437,7 @@ try_again:
 			}
 			printf("\n");
 			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-			      FD(evsel, nr_cpu, thread_index), strerror(err));
+			      err, strerror(err));
 
 #if defined(__i386__) || defined(__x86_64__)
 			if (attr->type == PERF_TYPE_HARDWARE && err == EOPNOTSUPP)
@@ -375,90 +448,13 @@ try_again:
 #endif
 
 			die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
-			exit(-1);
-		}
-
-		h_attr = get_header_attr(attr, evsel->idx);
-		if (h_attr == NULL)
-			die("nomem\n");
-
-		if (!file_new) {
-			if (memcmp(&h_attr->attr, attr, sizeof(*attr))) {
-				fprintf(stderr, "incompatible append\n");
-				exit(-1);
-			}
-		}
-
-		if (read(FD(evsel, nr_cpu, thread_index), &read_data, sizeof(read_data)) == -1) {
-			perror("Unable to read perf file descriptor");
-			exit(-1);
-		}
-
-		if (perf_header_attr__add_id(h_attr, read_data.id) < 0) {
-			pr_warning("Not enough memory to add id\n");
-			exit(-1);
-		}
-
-		assert(FD(evsel, nr_cpu, thread_index) >= 0);
-		fcntl(FD(evsel, nr_cpu, thread_index), F_SETFL, O_NONBLOCK);
-
-		/*
-		 * First counter acts as the group leader:
-		 */
-		if (group && group_fd == -1)
-			group_fd = FD(evsel, nr_cpu, thread_index);
-
-		if (evsel->idx || thread_index) {
-			struct perf_evsel *first;
-			first = list_entry(evlist->entries.next, struct perf_evsel, node);
-			ret = ioctl(FD(evsel, nr_cpu, thread_index),
-				    PERF_EVENT_IOC_SET_OUTPUT,
-				    FD(first, nr_cpu, 0));
-			if (ret) {
-				error("failed to set output: %d (%s)\n", errno,
-						strerror(errno));
-				exit(-1);
-			}
-		} else {
-			mmap_array[nr_cpu].prev = 0;
-			mmap_array[nr_cpu].mask = mmap_pages*page_size - 1;
-			mmap_array[nr_cpu].base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ | PROT_WRITE, MAP_SHARED, FD(evsel, nr_cpu, thread_index), 0);
-			if (mmap_array[nr_cpu].base == MAP_FAILED) {
-				error("failed to mmap with %d (%s)\n", errno, strerror(errno));
-				exit(-1);
-			}
-
-			evlist->pollfd[evlist->nr_fds].fd = FD(evsel, nr_cpu, thread_index);
-			evlist->pollfd[evlist->nr_fds].events = POLLIN;
-			evlist->nr_fds++;
-		}
-
-		if (filter != NULL) {
-			ret = ioctl(FD(evsel, nr_cpu, thread_index),
-				    PERF_EVENT_IOC_SET_FILTER, filter);
-			if (ret) {
-				error("failed to set filter with %d (%s)\n", errno,
-						strerror(errno));
-				exit(-1);
-			}
 		}
 	}
 
-	if (!sample_type)
-		sample_type = attr->sample_type;
-}
-
-static void open_counters(struct perf_evlist *evlist, int cpu)
-{
-	struct perf_evsel *pos;
-
-	group_fd = -1;
-
-	list_for_each_entry(pos, &evlist->entries, node)
-		create_counter(evlist, pos, cpu);
-
-	nr_cpu++;
+	for (cpu = 0; cpu < cpus->nr; ++cpu) {
+		list_for_each_entry(pos, &evlist->entries, node)
+			create_counter(evlist, pos, cpu);
+	}
 }
 
 static int process_buildids(void)
@@ -533,7 +529,7 @@ static void mmap_read_all(void)
 {
 	int i;
 
-	for (i = 0; i < nr_cpu; i++) {
+	for (i = 0; i < cpus->nr; i++) {
 		if (mmap_array[i].base)
 			mmap_read(&mmap_array[i]);
 	}
@@ -673,12 +669,7 @@ static int __cmd_record(int argc, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	if (!system_wide && no_inherit && !cpu_list) {
-		open_counters(evsel_list, -1);
-	} else {
-		for (i = 0; i < cpus->nr; i++)
-			open_counters(evsel_list, cpus->map[i]);
-	}
+	open_counters(evsel_list);
 
 	perf_session__set_sample_type(session, sample_type);
 
@@ -795,7 +786,7 @@ static int __cmd_record(int argc, const char **argv)
 		}
 
 		if (done) {
-			for (i = 0; i < nr_cpu; i++) {
+			for (i = 0; i < cpus->nr; i++) {
 				struct perf_evsel *pos;
 
 				list_for_each_entry(pos, &evsel_list->entries, node) {
@@ -933,11 +924,13 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(record_usage, record_options);
 	}
 
-	cpus = cpu_map__new(cpu_list);
-	if (cpus == NULL) {
-		perror("failed to parse CPUs map");
-		return -1;
-	}
+	if (target_tid != -1)
+		cpus = cpu_map__dummy_new();
+	else
+		cpus = cpu_map__new(cpu_list);
+
+	if (cpus == NULL)
+		usage_with_options(record_usage, record_options);
 
 	list_for_each_entry(pos, &evsel_list->entries, node) {
 		if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)

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

* [tip:perf/core] perf evsel: Introduce mmap support
       [not found]             ` <new-submission>
                                 ` (696 preceding siblings ...)
  2011-01-26  7:15               ` [tip:perf/core] perf record: " tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:16               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:16               ` [tip:perf/core] perf record: Use struct perf_mmap and helpers tip-bot for Arnaldo Carvalho de Melo
                                 ` (8 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  70082dd92c4b288bd723a77897e2b555f0e63113
Gitweb:     http://git.kernel.org/tip/70082dd92c4b288bd723a77897e2b555f0e63113
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 17:03:24 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf evsel: Introduce mmap support

Out of the code in 'perf top'. Record is next in line.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |   71 +++------------------------------------------
 tools/perf/perf.h        |   14 +++++++++
 tools/perf/util/evlist.c |    8 +++++
 tools/perf/util/evlist.h |    1 +
 tools/perf/util/evsel.c  |   71 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.h  |    8 +++++
 6 files changed, 107 insertions(+), 66 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 15d89be..7d723ad 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1095,43 +1095,12 @@ static void event__process_sample(const event_t *self,
 	}
 }
 
-struct mmap_data {
-	void			*base;
-	int			mask;
-	unsigned int		prev;
-};
-
-static int perf_evsel__alloc_mmap_per_thread(struct perf_evsel *evsel,
-					     int ncpus, int nthreads)
-{
-	evsel->priv = xyarray__new(ncpus, nthreads, sizeof(struct mmap_data));
-	return evsel->priv != NULL ? 0 : -ENOMEM;
-}
-
-static void perf_evsel__free_mmap(struct perf_evsel *evsel)
-{
-	xyarray__delete(evsel->priv);
-	evsel->priv = NULL;
-}
-
-static unsigned int mmap_read_head(struct mmap_data *md)
-{
-	struct perf_event_mmap_page *pc = md->base;
-	int head;
-
-	head = pc->data_head;
-	rmb();
-
-	return head;
-}
-
 static void perf_session__mmap_read_counter(struct perf_session *self,
 					    struct perf_evsel *evsel,
 					    int cpu, int thread_idx)
 {
-	struct xyarray *mmap_array = evsel->priv;
-	struct mmap_data *md = xyarray__entry(mmap_array, cpu, thread_idx);
-	unsigned int head = mmap_read_head(md);
+	struct perf_mmap *md = xyarray__entry(evsel->mmap, cpu, thread_idx);
+	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
 	unsigned char *data = md->base + page_size;
 	struct sample_data sample;
@@ -1210,35 +1179,9 @@ static void perf_session__mmap_read(struct perf_session *self)
 	}
 }
 
-static void start_counter(int i, struct perf_evlist *evlist,
-			  struct perf_evsel *evsel)
-{
-	struct xyarray *mmap_array = evsel->priv;
-	struct mmap_data *mm;
-	int thread_index;
-
-	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
-		assert(FD(evsel, i, thread_index) >= 0);
-		fcntl(FD(evsel, i, thread_index), F_SETFL, O_NONBLOCK);
-
-		evlist->pollfd[evlist->nr_fds].fd = FD(evsel, i, thread_index);
-		evlist->pollfd[evlist->nr_fds].events = POLLIN;
-		evlist->nr_fds++;
-
-		mm = xyarray__entry(mmap_array, i, thread_index);
-		mm->prev = 0;
-		mm->mask = mmap_pages*page_size - 1;
-		mm->base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ, MAP_SHARED, FD(evsel, i, thread_index), 0);
-		if (mm->base == MAP_FAILED)
-			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
-	}
-}
-
 static void start_counters(struct perf_evlist *evlist)
 {
 	struct perf_evsel *counter;
-	int i;
 
 	list_for_each_entry(counter, &evlist->entries, node) {
 		struct perf_event_attr *attr = &counter->attr;
@@ -1282,11 +1225,9 @@ try_again:
 			die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 			exit(-1);
 		}
-	}
 
-	for (i = 0; i < cpus->nr; i++) {
-		list_for_each_entry(counter, &evlist->entries, node)
-			start_counter(i, evsel_list, counter);
+		if (perf_evsel__mmap(counter, cpus, threads, mmap_pages, evlist) < 0)
+			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 	}
 }
 
@@ -1453,7 +1394,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(top_usage, options);
 
 	list_for_each_entry(pos, &evsel_list->entries, node) {
-		if (perf_evsel__alloc_mmap_per_thread(pos, cpus->nr, threads->nr) < 0 ||
+		if (perf_evsel__alloc_mmap(pos, cpus->nr, threads->nr) < 0 ||
 		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 		/*
@@ -1485,8 +1426,6 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 
 	status = __cmd_top();
 out_free_fd:
-	list_for_each_entry(pos, &evsel_list->entries, node)
-		perf_evsel__free_mmap(pos);
 	perf_evlist__delete(evsel_list);
 
 	return status;
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 95aaf56..5fb5e1f 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -94,6 +94,20 @@ void get_term_dimensions(struct winsize *ws);
 #include "util/types.h"
 #include <stdbool.h>
 
+struct perf_mmap {
+	void			*base;
+	int			mask;
+	unsigned int		prev;
+};
+
+static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
+{
+	struct perf_event_mmap_page *pc = mm->base;
+	int head = pc->data_head;
+	rmb();
+	return head;
+}
+
 /*
  * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
  * counters in the current task.
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 2abf949..6d41292 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -60,3 +60,11 @@ int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthread
 	evlist->pollfd = malloc(sizeof(struct pollfd) * nfds);
 	return evlist->pollfd != NULL ? 0 : -ENOMEM;
 }
+
+void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
+{
+	fcntl(fd, F_SETFL, O_NONBLOCK);
+	evlist->pollfd[evlist->nr_fds].fd = fd;
+	evlist->pollfd[evlist->nr_fds].events = POLLIN;
+	evlist->nr_fds++;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index a7d7e12..16bbfcb 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -21,5 +21,6 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
 int perf_evlist__add_default(struct perf_evlist *evlist);
 
 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads);
+void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
 
 #endif /* __PERF_EVLIST_H */
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 82a0053..f500695 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1,9 +1,13 @@
 #include "evsel.h"
+#include "evlist.h"
 #include "../perf.h"
 #include "util.h"
 #include "cpumap.h"
 #include "thread.h"
 
+#include <unistd.h>
+#include <sys/mman.h>
+
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 
 struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx)
@@ -49,10 +53,32 @@ void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
 		}
 }
 
+void perf_evsel__munmap(struct perf_evsel *evsel, int ncpus, int nthreads)
+{
+	struct perf_mmap *mm;
+	int cpu, thread;
+
+	for (cpu = 0; cpu < ncpus; cpu++)
+		for (thread = 0; thread < nthreads; ++thread) {
+			mm = xyarray__entry(evsel->mmap, cpu, thread);
+			if (mm->base != NULL) {
+				munmap(mm->base, evsel->mmap_len);
+				mm->base = NULL;
+			}
+		}
+}
+
+int perf_evsel__alloc_mmap(struct perf_evsel *evsel, int ncpus, int nthreads)
+{
+	evsel->mmap = xyarray__new(ncpus, nthreads, sizeof(struct perf_mmap));
+	return evsel->mmap != NULL ? 0 : -ENOMEM;
+}
+
 void perf_evsel__delete(struct perf_evsel *evsel)
 {
 	assert(list_empty(&evsel->node));
 	xyarray__delete(evsel->fd);
+	xyarray__delete(evsel->mmap);
 	free(evsel);
 }
 
@@ -208,3 +234,48 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel,
 {
 	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group, inherit);
 }
+
+int perf_evsel__mmap(struct perf_evsel *evsel, struct cpu_map *cpus,
+		     struct thread_map *threads, int pages,
+		     struct perf_evlist *evlist)
+{
+	unsigned int page_size = sysconf(_SC_PAGE_SIZE);
+	int mask = pages * page_size - 1, cpu;
+	struct perf_mmap *mm;
+	int thread;
+
+	if (evsel->mmap == NULL &&
+	    perf_evsel__alloc_mmap(evsel, cpus->nr, threads->nr) < 0)
+		return -ENOMEM;
+
+	evsel->mmap_len = (pages + 1) * page_size;
+
+	for (cpu = 0; cpu < cpus->nr; cpu++) {
+		for (thread = 0; thread < threads->nr; thread++) {
+			mm = xyarray__entry(evsel->mmap, cpu, thread);
+			mm->prev = 0;
+			mm->mask = mask;
+			mm->base = mmap(NULL, evsel->mmap_len, PROT_READ,
+					MAP_SHARED, FD(evsel, cpu, thread), 0);
+			if (mm->base == MAP_FAILED)
+				goto out_unmap;
+
+			if (evlist != NULL)
+				 perf_evlist__add_pollfd(evlist, FD(evsel, cpu, thread));
+		}
+	}
+
+	return 0;
+
+out_unmap:
+	do {
+		while (--thread >= 0) {
+			mm = xyarray__entry(evsel->mmap, cpu, thread);
+			munmap(mm->base, evsel->mmap_len);
+			mm->base = NULL;
+		}
+		thread = threads->nr;
+	} while (--cpu >= 0);
+
+	return -1;
+}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 1594696..c8fbef2 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -29,19 +29,23 @@ struct perf_evsel {
 	struct perf_event_attr	attr;
 	char			*filter;
 	struct xyarray		*fd;
+	struct xyarray		*mmap;
 	struct perf_counts	*counts;
+	size_t			mmap_len;
 	int			idx;
 	void			*priv;
 };
 
 struct cpu_map;
 struct thread_map;
+struct perf_evlist;
 
 struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx);
 void perf_evsel__delete(struct perf_evsel *evsel);
 
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
+int perf_evsel__alloc_mmap(struct perf_evsel *evsel, int ncpus, int nthreads);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
@@ -51,6 +55,10 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel,
 				struct thread_map *threads, bool group, bool inherit);
 int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 		     struct thread_map *threads, bool group, bool inherit);
+int perf_evsel__mmap(struct perf_evsel *evsel, struct cpu_map *cpus,
+		     struct thread_map *threads, int pages,
+		     struct perf_evlist *evlist);
+void perf_evsel__munmap(struct perf_evsel *evsel, int ncpus, int nthreads);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\

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

* [tip:perf/core] perf record: Use struct perf_mmap and helpers
       [not found]             ` <new-submission>
                                 ` (697 preceding siblings ...)
  2011-01-26  7:16               ` [tip:perf/core] perf evsel: Introduce mmap support tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:16               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:17               ` [tip:perf/core] perf record: Move perf_mmap__write_tail to perf.h tip-bot for Arnaldo Carvalho de Melo
                                 ` (7 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  744bd8aa3c8b43447f689a27872fa95e700b8a4f
Gitweb:     http://git.kernel.org/tip/744bd8aa3c8b43447f689a27872fa95e700b8a4f
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 17:07:28 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf record: Use struct perf_mmap and helpers

Paving the way to using perf_evsel->mmap, do this to reduce the patch
noise in the next ones.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   25 ++++---------------------
 1 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ec43f2e..d89e2f1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -78,26 +78,9 @@ static off_t			post_processing_offset;
 static struct perf_session	*session;
 static const char		*cpu_list;
 
-struct mmap_data {
-	void			*base;
-	unsigned int		mask;
-	unsigned int		prev;
-};
-
-static struct mmap_data		mmap_array[MAX_NR_CPUS];
-
-static unsigned long mmap_read_head(struct mmap_data *md)
-{
-	struct perf_event_mmap_page *pc = md->base;
-	long head;
-
-	head = pc->data_head;
-	rmb();
-
-	return head;
-}
+static struct perf_mmap		mmap_array[MAX_NR_CPUS];
 
-static void mmap_write_tail(struct mmap_data *md, unsigned long tail)
+static void mmap_write_tail(struct perf_mmap *md, unsigned long tail)
 {
 	struct perf_event_mmap_page *pc = md->base;
 
@@ -136,9 +119,9 @@ static int process_synthesized_event(event_t *event,
 	return 0;
 }
 
-static void mmap_read(struct mmap_data *md)
+static void mmap_read(struct perf_mmap *md)
 {
-	unsigned int head = mmap_read_head(md);
+	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
 	unsigned char *data = md->base + page_size;
 	unsigned long size;

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

* [tip:perf/core] perf record: Move perf_mmap__write_tail to perf.h
       [not found]             ` <new-submission>
                                 ` (698 preceding siblings ...)
  2011-01-26  7:16               ` [tip:perf/core] perf record: Use struct perf_mmap and helpers tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:17               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:17               ` [tip:perf/core] perf evlist: Move the mmap array from perf_evsel tip-bot for Arnaldo Carvalho de Melo
                                 ` (6 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  115d2d8963a426670ac3ce983fc4c4e001703943
Gitweb:     http://git.kernel.org/tip/115d2d8963a426670ac3ce983fc4c4e001703943
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 17:11:53 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf record: Move perf_mmap__write_tail to perf.h

Close to perf_mmap__read_head() and the perf_mmap struct definition.
This is useful for any recorder, and we will need it in 'perf test'.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   13 +------------
 tools/perf/perf.h           |   12 ++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d89e2f1..109f3b2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -80,17 +80,6 @@ static const char		*cpu_list;
 
 static struct perf_mmap		mmap_array[MAX_NR_CPUS];
 
-static void mmap_write_tail(struct perf_mmap *md, unsigned long tail)
-{
-	struct perf_event_mmap_page *pc = md->base;
-
-	/*
-	 * ensure all reads are done before we write the tail out.
-	 */
-	/* mb(); */
-	pc->data_tail = tail;
-}
-
 static void advance_output(size_t size)
 {
 	bytes_written += size;
@@ -165,7 +154,7 @@ static void mmap_read(struct perf_mmap *md)
 	write_output(buf, size);
 
 	md->prev = old;
-	mmap_write_tail(md, old);
+	perf_mmap__write_tail(md, old);
 }
 
 static volatile int done = 0;
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 5fb5e1f..a5fc660 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -108,6 +108,18 @@ static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
 	return head;
 }
 
+static inline void perf_mmap__write_tail(struct perf_mmap *md,
+					 unsigned long tail)
+{
+	struct perf_event_mmap_page *pc = md->base;
+
+	/*
+	 * ensure all reads are done before we write the tail out.
+	 */
+	/* mb(); */
+	pc->data_tail = tail;
+}
+
 /*
  * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
  * counters in the current task.

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

* [tip:perf/core] perf evlist: Move the mmap array from perf_evsel
       [not found]             ` <new-submission>
                                 ` (699 preceding siblings ...)
  2011-01-26  7:17               ` [tip:perf/core] perf record: Move perf_mmap__write_tail to perf.h tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:17               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:17               ` [tip:perf/core] perf record: Use perf_evlist__mmap tip-bot for Arnaldo Carvalho de Melo
                                 ` (5 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  70db7533caef02350ec8d6852e589491bca3a951
Gitweb:     http://git.kernel.org/tip/70db7533caef02350ec8d6852e589491bca3a951
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 12 Jan 2011 22:39:13 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:29 -0200

perf evlist: Move the mmap array from perf_evsel

Adopting the new model used in 'perf record', where we don't have a map
per thread per cpu, instead we have an mmap per cpu, established on the
first fd for that cpu and ask the kernel using the
PERF_EVENT_IOC_SET_OUTPUT ioctl to send events for the other fds on that
cpu for the one with the mmap.

The methods moved from perf_evsel to perf_evlist, but for easing review
they were modified in place, in evsel.c, the next patch will move the
migrated methods to evlist.c.

With this 'perf top' now uses the same mmap model used by 'perf record'
and the next patches will make 'perf record' use these new routines,
establishing a common codebase for both tools.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |   56 ++++++++--------
 tools/perf/util/evlist.c |   27 ++++++++
 tools/perf/util/evlist.h |    9 +++
 tools/perf/util/evsel.c  |  160 ++++++++++++++++++++++++++++++++++------------
 tools/perf/util/evsel.h  |   26 ++++++--
 5 files changed, 201 insertions(+), 77 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 7d723ad..df85c1f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -78,7 +78,7 @@ static struct cpu_map		*cpus;
 static int			realtime_prio			=      0;
 static bool			group				=  false;
 static unsigned int		page_size;
-static unsigned int		mmap_pages			=     16;
+static unsigned int		mmap_pages			=    128;
 static int			freq				=   1000; /* 1 KHz */
 
 static int			delay_secs			=      2;
@@ -991,8 +991,7 @@ static int symbol_filter(struct map *map, struct symbol *sym)
 
 static void event__process_sample(const event_t *self,
 				  struct sample_data *sample,
-				  struct perf_session *session,
-				  struct perf_evsel *evsel)
+				  struct perf_session *session)
 {
 	u64 ip = self->ip.ip;
 	struct sym_entry *syme;
@@ -1085,8 +1084,12 @@ static void event__process_sample(const event_t *self,
 
 	syme = symbol__priv(al.sym);
 	if (!syme->skip) {
-		syme->count[evsel->idx]++;
+		struct perf_evsel *evsel;
+
 		syme->origin = origin;
+		evsel = perf_evlist__id2evsel(evsel_list, sample->id);
+		assert(evsel != NULL);
+		syme->count[evsel->idx]++;
 		record_precise_ip(syme, evsel->idx, ip);
 		pthread_mutex_lock(&active_symbols_lock);
 		if (list_empty(&syme->node) || !syme->node.next)
@@ -1095,11 +1098,9 @@ static void event__process_sample(const event_t *self,
 	}
 }
 
-static void perf_session__mmap_read_counter(struct perf_session *self,
-					    struct perf_evsel *evsel,
-					    int cpu, int thread_idx)
+static void perf_session__mmap_read_cpu(struct perf_session *self, int cpu)
 {
-	struct perf_mmap *md = xyarray__entry(evsel->mmap, cpu, thread_idx);
+	struct perf_mmap *md = &evsel_list->mmap[cpu];
 	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
 	unsigned char *data = md->base + page_size;
@@ -1153,7 +1154,7 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
 
 		event__parse_sample(event, self, &sample);
 		if (event->header.type == PERF_RECORD_SAMPLE)
-			event__process_sample(event, &sample, self, evsel);
+			event__process_sample(event, &sample, self);
 		else
 			event__process(event, &sample, self);
 		old += size;
@@ -1164,19 +1165,10 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
 
 static void perf_session__mmap_read(struct perf_session *self)
 {
-	struct perf_evsel *counter;
-	int i, thread_index;
-
-	for (i = 0; i < cpus->nr; i++) {
-		list_for_each_entry(counter, &evsel_list->entries, node) {
-			for (thread_index = 0;
-				thread_index < threads->nr;
-				thread_index++) {
-				perf_session__mmap_read_counter(self,
-					counter, i, thread_index);
-			}
-		}
-	}
+	int i;
+
+	for (i = 0; i < cpus->nr; i++)
+		perf_session__mmap_read_cpu(self, i);
 }
 
 static void start_counters(struct perf_evlist *evlist)
@@ -1194,6 +1186,11 @@ static void start_counters(struct perf_evlist *evlist)
 			attr->sample_freq = freq;
 		}
 
+		if (evlist->nr_entries > 1) {
+			attr->sample_type |= PERF_SAMPLE_ID;
+			attr->read_format |= PERF_FORMAT_ID;
+		}
+
 		attr->mmap = 1;
 try_again:
 		if (perf_evsel__open(counter, cpus, threads, group, inherit) < 0) {
@@ -1225,15 +1222,16 @@ try_again:
 			die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 			exit(-1);
 		}
-
-		if (perf_evsel__mmap(counter, cpus, threads, mmap_pages, evlist) < 0)
-			die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 	}
+
+	if (perf_evlist__mmap(evlist, cpus, threads, mmap_pages, true) < 0)
+		die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 }
 
 static int __cmd_top(void)
 {
 	pthread_t thread;
+	struct perf_evsel *first;
 	int ret;
 	/*
 	 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
@@ -1249,6 +1247,8 @@ static int __cmd_top(void)
 		event__synthesize_threads(event__process, session);
 
 	start_counters(evsel_list);
+	first = list_entry(evsel_list->entries.next, struct perf_evsel, node);
+	perf_session__set_sample_type(session, first->attr.sample_type);
 
 	/* Wait for a minimal set of events before starting the snapshot */
 	poll(evsel_list->pollfd, evsel_list->nr_fds, 100);
@@ -1394,8 +1394,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		usage_with_options(top_usage, options);
 
 	list_for_each_entry(pos, &evsel_list->entries, node) {
-		if (perf_evsel__alloc_mmap(pos, cpus->nr, threads->nr) < 0 ||
-		    perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
+		if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0)
 			goto out_free_fd;
 		/*
 		 * Fill in the ones not specifically initialized via -c:
@@ -1406,7 +1405,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		pos->attr.sample_period = default_interval;
 	}
 
-	if (perf_evlist__alloc_pollfd(evsel_list, cpus->nr, threads->nr) < 0)
+	if (perf_evlist__alloc_pollfd(evsel_list, cpus->nr, threads->nr) < 0 ||
+	    perf_evlist__alloc_mmap(evsel_list, cpus->nr) < 0)
 		goto out_free_fd;
 
 	sym_evsel = list_entry(evsel_list->entries.next, struct perf_evsel, node);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6d41292..deb82a4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -3,11 +3,18 @@
 #include "evsel.h"
 #include "util.h"
 
+#include <linux/bitops.h>
+#include <linux/hash.h>
+
 struct perf_evlist *perf_evlist__new(void)
 {
 	struct perf_evlist *evlist = zalloc(sizeof(*evlist));
 
 	if (evlist != NULL) {
+		int i;
+
+		for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
+			INIT_HLIST_HEAD(&evlist->heads[i]);
 		INIT_LIST_HEAD(&evlist->entries);
 	}
 
@@ -29,6 +36,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
 void perf_evlist__delete(struct perf_evlist *evlist)
 {
 	perf_evlist__purge(evlist);
+	free(evlist->mmap);
 	free(evlist->pollfd);
 	free(evlist);
 }
@@ -68,3 +76,22 @@ void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
 	evlist->pollfd[evlist->nr_fds].events = POLLIN;
 	evlist->nr_fds++;
 }
+
+struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
+{
+	struct hlist_head *head;
+	struct hlist_node *pos;
+	struct perf_sample_id *sid;
+	int hash;
+
+	if (evlist->nr_entries == 1)
+		return list_entry(evlist->entries.next, struct perf_evsel, node);
+
+	hash = hash_64(id, PERF_EVLIST__HLIST_BITS);
+	head = &evlist->heads[hash];
+
+	hlist_for_each_entry(sid, pos, head, node)
+		if (sid->id == id)
+			return sid->evsel;
+	return NULL;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 16bbfcb..dbfcc79 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -2,13 +2,20 @@
 #define __PERF_EVLIST_H 1
 
 #include <linux/list.h>
+#include "../perf.h"
 
 struct pollfd;
 
+#define PERF_EVLIST__HLIST_BITS 8
+#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
+
 struct perf_evlist {
 	struct list_head entries;
+	struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
 	int		 nr_entries;
 	int		 nr_fds;
+	int		 mmap_len;
+	struct perf_mmap *mmap;
 	struct pollfd	 *pollfd;
 };
 
@@ -23,4 +30,6 @@ int perf_evlist__add_default(struct perf_evlist *evlist);
 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads);
 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
 
+struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
+
 #endif /* __PERF_EVLIST_H */
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f500695..ee49035 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -8,7 +8,11 @@
 #include <unistd.h>
 #include <sys/mman.h>
 
+#include <linux/bitops.h>
+#include <linux/hash.h>
+
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
+#define SID(e, x, y) xyarray__entry(e->id, x, y)
 
 struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx)
 {
@@ -29,6 +33,12 @@ int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
 	return evsel->fd != NULL ? 0 : -ENOMEM;
 }
 
+int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads)
+{
+	evsel->id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id));
+	return evsel->id != NULL ? 0 : -ENOMEM;
+}
+
 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus)
 {
 	evsel->counts = zalloc((sizeof(*evsel->counts) +
@@ -42,6 +52,12 @@ void perf_evsel__free_fd(struct perf_evsel *evsel)
 	evsel->fd = NULL;
 }
 
+void perf_evsel__free_id(struct perf_evsel *evsel)
+{
+	xyarray__delete(evsel->id);
+	evsel->id = NULL;
+}
+
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
 {
 	int cpu, thread;
@@ -53,32 +69,29 @@ void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
 		}
 }
 
-void perf_evsel__munmap(struct perf_evsel *evsel, int ncpus, int nthreads)
+void perf_evlist__munmap(struct perf_evlist *evlist, int ncpus)
 {
-	struct perf_mmap *mm;
-	int cpu, thread;
+	int cpu;
 
-	for (cpu = 0; cpu < ncpus; cpu++)
-		for (thread = 0; thread < nthreads; ++thread) {
-			mm = xyarray__entry(evsel->mmap, cpu, thread);
-			if (mm->base != NULL) {
-				munmap(mm->base, evsel->mmap_len);
-				mm->base = NULL;
-			}
+	for (cpu = 0; cpu < ncpus; cpu++) {
+		if (evlist->mmap[cpu].base != NULL) {
+			munmap(evlist->mmap[cpu].base, evlist->mmap_len);
+			evlist->mmap[cpu].base = NULL;
 		}
+	}
 }
 
-int perf_evsel__alloc_mmap(struct perf_evsel *evsel, int ncpus, int nthreads)
+int perf_evlist__alloc_mmap(struct perf_evlist *evlist, int ncpus)
 {
-	evsel->mmap = xyarray__new(ncpus, nthreads, sizeof(struct perf_mmap));
-	return evsel->mmap != NULL ? 0 : -ENOMEM;
+	evlist->mmap = zalloc(ncpus * sizeof(struct perf_mmap));
+	return evlist->mmap != NULL ? 0 : -ENOMEM;
 }
 
 void perf_evsel__delete(struct perf_evsel *evsel)
 {
 	assert(list_empty(&evsel->node));
 	xyarray__delete(evsel->fd);
-	xyarray__delete(evsel->mmap);
+	xyarray__delete(evsel->id);
 	free(evsel);
 }
 
@@ -235,47 +248,110 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel,
 	return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group, inherit);
 }
 
-int perf_evsel__mmap(struct perf_evsel *evsel, struct cpu_map *cpus,
-		     struct thread_map *threads, int pages,
-		     struct perf_evlist *evlist)
+static int __perf_evlist__mmap(struct perf_evlist *evlist, int cpu, int prot,
+			       int mask, int fd)
+{
+	evlist->mmap[cpu].prev = 0;
+	evlist->mmap[cpu].mask = mask;
+	evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot,
+				      MAP_SHARED, fd, 0);
+	if (evlist->mmap[cpu].base == MAP_FAILED)
+		return -1;
+
+	perf_evlist__add_pollfd(evlist, fd);
+	return 0;
+}
+
+static int perf_evlist__id_hash(struct perf_evlist *evlist, struct perf_evsel *evsel,
+			       int cpu, int thread, int fd)
+{
+	struct perf_sample_id *sid;
+	u64 read_data[4] = { 0, };
+	int hash, id_idx = 1; /* The first entry is the counter value */
+
+	if (!(evsel->attr.read_format & PERF_FORMAT_ID) ||
+	    read(fd, &read_data, sizeof(read_data)) == -1)
+		return -1;
+
+	if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
+		++id_idx;
+	if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
+		++id_idx;
+
+	sid = SID(evsel, cpu, thread);
+	sid->id = read_data[id_idx];
+	sid->evsel = evsel;
+	hash = hash_64(sid->id, PERF_EVLIST__HLIST_BITS);
+	hlist_add_head(&sid->node, &evlist->heads[hash]);
+	return 0;
+}
+
+/** perf_evlist__mmap - Create per cpu maps to receive events
+ *
+ * @evlist - list of events
+ * @cpus - cpu map being monitored
+ * @threads - threads map being monitored
+ * @pages - map length in pages
+ * @overwrite - overwrite older events?
+ *
+ * If overwrite is false the user needs to signal event consuption using:
+ *
+ *	struct perf_mmap *m = &evlist->mmap[cpu];
+ *	unsigned int head = perf_mmap__read_head(m);
+ *
+ *	perf_mmap__write_tail(m, head)
+ */
+int perf_evlist__mmap(struct perf_evlist *evlist, struct cpu_map *cpus,
+		      struct thread_map *threads, int pages, bool overwrite)
 {
 	unsigned int page_size = sysconf(_SC_PAGE_SIZE);
 	int mask = pages * page_size - 1, cpu;
-	struct perf_mmap *mm;
-	int thread;
+	struct perf_evsel *first_evsel, *evsel;
+	int thread, prot = PROT_READ | (overwrite ? 0 : PROT_WRITE);
 
-	if (evsel->mmap == NULL &&
-	    perf_evsel__alloc_mmap(evsel, cpus->nr, threads->nr) < 0)
+	if (evlist->mmap == NULL &&
+	    perf_evlist__alloc_mmap(evlist, cpus->nr) < 0)
 		return -ENOMEM;
 
-	evsel->mmap_len = (pages + 1) * page_size;
+	if (evlist->pollfd == NULL &&
+	    perf_evlist__alloc_pollfd(evlist, cpus->nr, threads->nr) < 0)
+		return -ENOMEM;
 
-	for (cpu = 0; cpu < cpus->nr; cpu++) {
-		for (thread = 0; thread < threads->nr; thread++) {
-			mm = xyarray__entry(evsel->mmap, cpu, thread);
-			mm->prev = 0;
-			mm->mask = mask;
-			mm->base = mmap(NULL, evsel->mmap_len, PROT_READ,
-					MAP_SHARED, FD(evsel, cpu, thread), 0);
-			if (mm->base == MAP_FAILED)
-				goto out_unmap;
-
-			if (evlist != NULL)
-				 perf_evlist__add_pollfd(evlist, FD(evsel, cpu, thread));
+	evlist->mmap_len = (pages + 1) * page_size;
+	first_evsel = list_entry(evlist->entries.next, struct perf_evsel, node);
+
+	list_for_each_entry(evsel, &evlist->entries, node) {
+		if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
+		    evsel->id == NULL &&
+		    perf_evsel__alloc_id(evsel, cpus->nr, threads->nr) < 0)
+			return -ENOMEM;
+
+		for (cpu = 0; cpu < cpus->nr; cpu++) {
+			for (thread = 0; thread < threads->nr; thread++) {
+				int fd = FD(evsel, cpu, thread);
+
+				if (evsel->idx || thread) {
+					if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT,
+						  FD(first_evsel, cpu, 0)) != 0)
+						goto out_unmap;
+				} else if (__perf_evlist__mmap(evlist, cpu, prot, mask, fd) < 0)
+					goto out_unmap;
+
+				if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
+				    perf_evlist__id_hash(evlist, evsel, cpu, thread, fd) < 0)
+					goto out_unmap;
+			}
 		}
 	}
 
 	return 0;
 
 out_unmap:
-	do {
-		while (--thread >= 0) {
-			mm = xyarray__entry(evsel->mmap, cpu, thread);
-			munmap(mm->base, evsel->mmap_len);
-			mm->base = NULL;
+	for (cpu = 0; cpu < cpus->nr; cpu++) {
+		if (evlist->mmap[cpu].base != NULL) {
+			munmap(evlist->mmap[cpu].base, evlist->mmap_len);
+			evlist->mmap[cpu].base = NULL;
 		}
-		thread = threads->nr;
-	} while (--cpu >= 0);
-
+	}
 	return -1;
 }
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index c8fbef2..667ee4e 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -24,14 +24,25 @@ struct perf_counts {
 	struct perf_counts_values cpu[];
 };
 
+struct perf_evsel;
+
+/*
+ * Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are
+ * more than one entry in the evlist.
+ */
+struct perf_sample_id {
+	struct hlist_node 	node;
+	u64		 	id;
+	struct perf_evsel	*evsel;
+};
+
 struct perf_evsel {
 	struct list_head	node;
 	struct perf_event_attr	attr;
 	char			*filter;
 	struct xyarray		*fd;
-	struct xyarray		*mmap;
+	struct xyarray		*id;
 	struct perf_counts	*counts;
-	size_t			mmap_len;
 	int			idx;
 	void			*priv;
 };
@@ -44,9 +55,11 @@ struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx);
 void perf_evsel__delete(struct perf_evsel *evsel);
 
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
+int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus);
-int perf_evsel__alloc_mmap(struct perf_evsel *evsel, int ncpus, int nthreads);
+int perf_evlist__alloc_mmap(struct perf_evlist *evlist, int ncpus);
 void perf_evsel__free_fd(struct perf_evsel *evsel);
+void perf_evsel__free_id(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
 int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
@@ -55,10 +68,9 @@ int perf_evsel__open_per_thread(struct perf_evsel *evsel,
 				struct thread_map *threads, bool group, bool inherit);
 int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 		     struct thread_map *threads, bool group, bool inherit);
-int perf_evsel__mmap(struct perf_evsel *evsel, struct cpu_map *cpus,
-		     struct thread_map *threads, int pages,
-		     struct perf_evlist *evlist);
-void perf_evsel__munmap(struct perf_evsel *evsel, int ncpus, int nthreads);
+int perf_evlist__mmap(struct perf_evlist *evlist, struct cpu_map *cpus,
+		      struct thread_map *threads, int pages, bool overwrite);
+void perf_evlist__munmap(struct perf_evlist *evlist, int ncpus);
 
 #define perf_evsel__match(evsel, t, c)		\
 	(evsel->attr.type == PERF_TYPE_##t &&	\

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

* [tip:perf/core] perf record: Use perf_evlist__mmap
       [not found]             ` <new-submission>
                                 ` (700 preceding siblings ...)
  2011-01-26  7:17               ` [tip:perf/core] perf evlist: Move the mmap array from perf_evsel tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:17               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:18               ` [tip:perf/core] perf tools: Add missing cpu_map__delete() tip-bot for Arnaldo Carvalho de Melo
                                 ` (4 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  0a27d7f9f417c0305f7efa70631764a53c7af219
Gitweb:     http://git.kernel.org/tip/0a27d7f9f417c0305f7efa70631764a53c7af219
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 14 Jan 2011 15:50:51 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:30 -0200

perf record: Use perf_evlist__mmap

There is more stuff that can go to the perf_ev{sel,list} layer, like
detecting if sample_id_all is available, etc, but lets try using this in
'perf test' first.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   59 ++++++++-----------------------------------
 1 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 109f3b2..45a3689 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -30,6 +30,7 @@
 #include <sys/mman.h>
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
+#define SID(e, x, y) xyarray__entry(e->id, x, y)
 
 enum write_mode_t {
 	WRITE_FORCE,
@@ -78,8 +79,6 @@ static off_t			post_processing_offset;
 static struct perf_session	*session;
 static const char		*cpu_list;
 
-static struct perf_mmap		mmap_array[MAX_NR_CPUS];
-
 static void advance_output(size_t size)
 {
 	bytes_written += size;
@@ -196,20 +195,14 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n
 	return h_attr;
 }
 
-static void create_counter(struct perf_evlist *evlist,
-			   struct perf_evsel *evsel, int cpu)
+static void create_counter(struct perf_evsel *evsel, int cpu)
 {
 	char *filter = evsel->filter;
 	struct perf_event_attr *attr = &evsel->attr;
 	struct perf_header_attr *h_attr;
+	struct perf_sample_id *sid;
 	int thread_index;
 	int ret;
-	struct {
-		u64 count;
-		u64 time_enabled;
-		u64 time_running;
-		u64 id;
-	} read_data;
 
 	for (thread_index = 0; thread_index < threads->nr; thread_index++) {
 		h_attr = get_header_attr(attr, evsel->idx);
@@ -223,45 +216,12 @@ static void create_counter(struct perf_evlist *evlist,
 			}
 		}
 
-		if (read(FD(evsel, cpu, thread_index), &read_data, sizeof(read_data)) == -1) {
-			perror("Unable to read perf file descriptor");
-			exit(-1);
-		}
-
-		if (perf_header_attr__add_id(h_attr, read_data.id) < 0) {
+		sid = SID(evsel, cpu, thread_index);
+		if (perf_header_attr__add_id(h_attr, sid->id) < 0) {
 			pr_warning("Not enough memory to add id\n");
 			exit(-1);
 		}
 
-		assert(FD(evsel, cpu, thread_index) >= 0);
-		fcntl(FD(evsel, cpu, thread_index), F_SETFL, O_NONBLOCK);
-
-		if (evsel->idx || thread_index) {
-			struct perf_evsel *first;
-			first = list_entry(evlist->entries.next, struct perf_evsel, node);
-			ret = ioctl(FD(evsel, cpu, thread_index),
-				    PERF_EVENT_IOC_SET_OUTPUT,
-				    FD(first, cpu, 0));
-			if (ret) {
-				error("failed to set output: %d (%s)\n", errno,
-						strerror(errno));
-				exit(-1);
-			}
-		} else {
-			mmap_array[cpu].prev = 0;
-			mmap_array[cpu].mask = mmap_pages*page_size - 1;
-			mmap_array[cpu].base = mmap(NULL, (mmap_pages+1)*page_size,
-				PROT_READ | PROT_WRITE, MAP_SHARED, FD(evsel, cpu, thread_index), 0);
-			if (mmap_array[cpu].base == MAP_FAILED) {
-				error("failed to mmap with %d (%s)\n", errno, strerror(errno));
-				exit(-1);
-			}
-
-			evlist->pollfd[evlist->nr_fds].fd = FD(evsel, cpu, thread_index);
-			evlist->pollfd[evlist->nr_fds].events = POLLIN;
-			evlist->nr_fds++;
-		}
-
 		if (filter != NULL) {
 			ret = ioctl(FD(evsel, cpu, thread_index),
 				    PERF_EVENT_IOC_SET_FILTER, filter);
@@ -423,9 +383,12 @@ try_again:
 		}
 	}
 
+	if (perf_evlist__mmap(evlist, cpus, threads, mmap_pages, false) < 0)
+		die("failed to mmap with %d (%s)\n", errno, strerror(errno));
+
 	for (cpu = 0; cpu < cpus->nr; ++cpu) {
 		list_for_each_entry(pos, &evlist->entries, node)
-			create_counter(evlist, pos, cpu);
+			create_counter(pos, cpu);
 	}
 }
 
@@ -502,8 +465,8 @@ static void mmap_read_all(void)
 	int i;
 
 	for (i = 0; i < cpus->nr; i++) {
-		if (mmap_array[i].base)
-			mmap_read(&mmap_array[i]);
+		if (evsel_list->mmap[i].base)
+			mmap_read(&evsel_list->mmap[i]);
 	}
 
 	if (perf_header__has_feat(&session->header, HEADER_TRACE_INFO))

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

* [tip:perf/core] perf tools: Add missing cpu_map__delete()
       [not found]             ` <new-submission>
                                 ` (701 preceding siblings ...)
  2011-01-26  7:17               ` [tip:perf/core] perf record: Use perf_evlist__mmap tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:18               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:18               ` [tip:perf/core] perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus tip-bot for Arnaldo Carvalho de Melo
                                 ` (3 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  915fce20ecf8f7ff4189d0fff42b62aebf6a57cc
Gitweb:     http://git.kernel.org/tip/915fce20ecf8f7ff4189d0fff42b62aebf6a57cc
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 14 Jan 2011 16:19:12 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:30 -0200

perf tools: Add missing cpu_map__delete()

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cpumap.c |    5 +++++
 tools/perf/util/cpumap.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 3ccaa10..6893eec 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -177,3 +177,8 @@ struct cpu_map *cpu_map__dummy_new(void)
 
 	return cpus;
 }
+
+void cpu_map__delete(struct cpu_map *map)
+{
+	free(map);
+}
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index f7a4f42..072c0a3 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -8,6 +8,6 @@ struct cpu_map {
 
 struct cpu_map *cpu_map__new(const char *cpu_list);
 struct cpu_map *cpu_map__dummy_new(void);
-void *cpu_map__delete(struct cpu_map *map);
+void cpu_map__delete(struct cpu_map *map);
 
 #endif /* __PERF_CPUMAP_H */

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

* [tip:perf/core] perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus
       [not found]             ` <new-submission>
                                 ` (702 preceding siblings ...)
  2011-01-26  7:18               ` [tip:perf/core] perf tools: Add missing cpu_map__delete() tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:18               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:19               ` [tip:perf/core] perf evlist: Steal mmap reading routine from 'perf top' tip-bot for Arnaldo Carvalho de Melo
                                 ` (2 subsequent siblings)
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  d2af9687c96f3864178de1860e6d83873aeef224
Gitweb:     http://git.kernel.org/tip/d2af9687c96f3864178de1860e6d83873aeef224
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 14 Jan 2011 16:24:49 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:30 -0200

perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus

We were bailing out after the first count mismatch, do it in all to see
if only some CPUs are not getting the expected number of events.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 7287158..7cc6b20 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -408,6 +408,8 @@ static int test__open_syscall_event_on_all_cpus(void)
 		goto out_close_fd;
 	}
 
+	err = 0;
+
 	for (cpu = 0; cpu < cpus->nr; ++cpu) {
 		unsigned int expected;
 
@@ -416,18 +418,18 @@ static int test__open_syscall_event_on_all_cpus(void)
 
 		if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) {
 			pr_debug("perf_evsel__open_read_on_cpu\n");
-			goto out_close_fd;
+			err = -1;
+			break;
 		}
 
 		expected = nr_open_calls + cpu;
 		if (evsel->counts->cpu[cpu].val != expected) {
 			pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n",
 				 expected, cpus->map[cpu], evsel->counts->cpu[cpu].val);
-			goto out_close_fd;
+			err = -1;
 		}
 	}
 
-	err = 0;
 out_close_fd:
 	perf_evsel__close_fd(evsel, 1, threads->nr);
 out_evsel_delete:

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

* [tip:perf/core] perf evlist: Steal mmap reading routine from 'perf top'
       [not found]             ` <new-submission>
                                 ` (703 preceding siblings ...)
  2011-01-26  7:18               ` [tip:perf/core] perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:19               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:19               ` [tip:perf/core] perf test: Add test for the evlist mmap routines tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:21               ` [tip:perf/core] perf top: Add native_safe_halt to skip symbols tip-bot for Arnaldo Carvalho de Melo
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  04391debc3e1195222a4dbb162ace6542dd89c1c
Gitweb:     http://git.kernel.org/tip/04391debc3e1195222a4dbb162ace6542dd89c1c
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 15 Jan 2011 10:40:59 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:30 -0200

perf evlist: Steal mmap reading routine from 'perf top'

Will be used in the upcoming 'perf test' entry for the evlist mmap
routines.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |   56 ++---------------------------------------
 tools/perf/util/evlist.c |   62 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evlist.h |    4 +++
 3 files changed, 69 insertions(+), 53 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index df85c1f..58352ad 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1100,67 +1100,17 @@ static void event__process_sample(const event_t *self,
 
 static void perf_session__mmap_read_cpu(struct perf_session *self, int cpu)
 {
-	struct perf_mmap *md = &evsel_list->mmap[cpu];
-	unsigned int head = perf_mmap__read_head(md);
-	unsigned int old = md->prev;
-	unsigned char *data = md->base + page_size;
 	struct sample_data sample;
-	int diff;
-
-	/*
-	 * 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.
-	 */
-	diff = head - old;
-	if (diff > md->mask / 2 || diff < 0) {
-		fprintf(stderr, "WARNING: failed to keep up with mmap data.\n");
-
-		/*
-		 * head points to a known good entry, start there.
-		 */
-		old = head;
-	}
-
-	for (; old != head;) {
-		event_t *event = (event_t *)&data[old & md->mask];
-
-		event_t event_copy;
-
-		size_t size = event->header.size;
-
-		/*
-		 * Event straddles the mmap boundary -- header should always
-		 * be inside due to u64 alignment of output.
-		 */
-		if ((old & md->mask) + size != ((old + size) & md->mask)) {
-			unsigned int offset = old;
-			unsigned int len = min(sizeof(*event), size), cpy;
-			void *dst = &event_copy;
-
-			do {
-				cpy = min(md->mask + 1 - (offset & md->mask), len);
-				memcpy(dst, &data[offset & md->mask], cpy);
-				offset += cpy;
-				dst += cpy;
-				len -= cpy;
-			} while (len);
-
-			event = &event_copy;
-		}
+	event_t *event;
 
+	while ((event = perf_evlist__read_on_cpu(evsel_list, cpu)) != NULL) {
 		event__parse_sample(event, self, &sample);
+
 		if (event->header.type == PERF_RECORD_SAMPLE)
 			event__process_sample(event, &sample, self);
 		else
 			event__process(event, &sample, self);
-		old += size;
 	}
-
-	md->prev = old;
 }
 
 static void perf_session__mmap_read(struct perf_session *self)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index deb82a4..4b3b84c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -95,3 +95,65 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
 			return sid->evsel;
 	return NULL;
 }
+
+event_t *perf_evlist__read_on_cpu(struct perf_evlist *evlist, int cpu)
+{
+	/* XXX Move this to perf.c, making it generally available */
+	unsigned int page_size = sysconf(_SC_PAGE_SIZE);
+	struct perf_mmap *md = &evlist->mmap[cpu];
+	unsigned int head = perf_mmap__read_head(md);
+	unsigned int old = md->prev;
+	unsigned char *data = md->base + page_size;
+	event_t *event = NULL;
+	int diff;
+
+	/*
+	 * 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.
+	 */
+	diff = head - old;
+	if (diff > md->mask / 2 || diff < 0) {
+		fprintf(stderr, "WARNING: failed to keep up with mmap data.\n");
+
+		/*
+		 * head points to a known good entry, start there.
+		 */
+		old = head;
+	}
+
+	if (old != head) {
+		size_t size;
+
+		event = (event_t *)&data[old & md->mask];
+		size = event->header.size;
+
+		/*
+		 * Event straddles the mmap boundary -- header should always
+		 * be inside due to u64 alignment of output.
+		 */
+		if ((old & md->mask) + size != ((old + size) & md->mask)) {
+			unsigned int offset = old;
+			unsigned int len = min(sizeof(*event), size), cpy;
+			void *dst = &evlist->event_copy;
+
+			do {
+				cpy = min(md->mask + 1 - (offset & md->mask), len);
+				memcpy(dst, &data[offset & md->mask], cpy);
+				offset += cpy;
+				dst += cpy;
+				len -= cpy;
+			} while (len);
+
+			event = &evlist->event_copy;
+		}
+
+		old += size;
+	}
+
+	md->prev = old;
+	return event;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index dbfcc79..2871206 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -3,6 +3,7 @@
 
 #include <linux/list.h>
 #include "../perf.h"
+#include "event.h"
 
 struct pollfd;
 
@@ -15,6 +16,7 @@ struct perf_evlist {
 	int		 nr_entries;
 	int		 nr_fds;
 	int		 mmap_len;
+	event_t		 event_copy;
 	struct perf_mmap *mmap;
 	struct pollfd	 *pollfd;
 };
@@ -32,4 +34,6 @@ void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
 
 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
 
+event_t *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);
+
 #endif /* __PERF_EVLIST_H */

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

* [tip:perf/core] perf test: Add test for the evlist mmap routines
       [not found]             ` <new-submission>
                                 ` (704 preceding siblings ...)
  2011-01-26  7:19               ` [tip:perf/core] perf evlist: Steal mmap reading routine from 'perf top' tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:19               ` tip-bot for Arnaldo Carvalho de Melo
  2011-01-26  7:21               ` [tip:perf/core] perf top: Add native_safe_halt to skip symbols tip-bot for Arnaldo Carvalho de Melo
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  de5fa3a8a05cd60f59622e88cfeb90416760d78e
Gitweb:     http://git.kernel.org/tip/de5fa3a8a05cd60f59622e88cfeb90416760d78e
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 15 Jan 2011 10:42:46 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:31 -0200

perf test: Add test for the evlist mmap routines

This test will generate random numbers of calls to some getpid syscalls,
then establish an mmap for a group of events that are created to monitor
these syscalls.

It will receive the events, using mmap, use its PERF_SAMPLE_ID generated
sample.id field to map back to its respective perf_evsel instance.

Then it checks if the number of syscalls reported as perf events by the
kernel corresponds to the number of syscalls made.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |  171 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 169 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 5a50e47..4fd3453 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -7,7 +7,9 @@
 
 #include "util/cache.h"
 #include "util/debug.h"
+#include "util/evlist.h"
 #include "util/parse-options.h"
+#include "util/parse-events.h"
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/thread.h"
@@ -238,14 +240,14 @@ out:
 #include "util/evsel.h"
 #include <sys/types.h>
 
-static int trace_event__id(const char *event_name)
+static int trace_event__id(const char *evname)
 {
 	char *filename;
 	int err = -1, fd;
 
 	if (asprintf(&filename,
 		     "/sys/kernel/debug/tracing/events/syscalls/%s/id",
-		     event_name) < 0)
+		     evname) < 0)
 		return -1;
 
 	fd = open(filename, O_RDONLY);
@@ -439,6 +441,167 @@ out_thread_map_delete:
 	return err;
 }
 
+/*
+ * This test will generate random numbers of calls to some getpid syscalls,
+ * then establish an mmap for a group of events that are created to monitor
+ * the syscalls.
+ *
+ * It will receive the events, using mmap, use its PERF_SAMPLE_ID generated
+ * sample.id field to map back to its respective perf_evsel instance.
+ *
+ * Then it checks if the number of syscalls reported as perf events by
+ * the kernel corresponds to the number of syscalls made.
+ */
+static int test__basic_mmap(void)
+{
+	int err = -1;
+	event_t *event;
+	struct thread_map *threads;
+	struct perf_session session;
+	struct cpu_map *cpus;
+	struct perf_evlist *evlist;
+	struct perf_event_attr attr = {
+		.type		= PERF_TYPE_TRACEPOINT,
+		.read_format	= PERF_FORMAT_ID,
+		.sample_type	= PERF_SAMPLE_ID,
+		.watermark	= 0,
+	};
+	cpu_set_t cpu_set;
+	const char *syscall_names[] = { "getsid", "getppid", "getpgrp",
+					"getpgid", };
+	pid_t (*syscalls[])(void) = { (void *)getsid, getppid, getpgrp,
+				      (void*)getpgid };
+#define nsyscalls ARRAY_SIZE(syscall_names)
+	int ids[nsyscalls];
+	unsigned int nr_events[nsyscalls],
+		     expected_nr_events[nsyscalls], i, j;
+	struct perf_evsel *evsels[nsyscalls], *evsel;
+
+	for (i = 0; i < nsyscalls; ++i) {
+		char name[64];
+
+		snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]);
+		ids[i] = trace_event__id(name);
+		if (ids[i] < 0) {
+			pr_debug("Is debugfs mounted on /sys/kernel/debug?\n");
+			return -1;
+		}
+		nr_events[i] = 0;
+		expected_nr_events[i] = random() % 257;
+	}
+
+	threads = thread_map__new(-1, getpid());
+	if (threads == NULL) {
+		pr_debug("thread_map__new\n");
+		return -1;
+	}
+
+	cpus = cpu_map__new(NULL);
+	if (threads == NULL) {
+		pr_debug("thread_map__new\n");
+		goto out_free_threads;
+	}
+
+	CPU_ZERO(&cpu_set);
+	CPU_SET(cpus->map[0], &cpu_set);
+	sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
+	if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) {
+		pr_debug("sched_setaffinity() failed on CPU %d: %s ",
+			 cpus->map[0], strerror(errno));
+		goto out_free_cpus;
+	}
+
+	evlist = perf_evlist__new();
+	if (threads == NULL) {
+		pr_debug("perf_evlist__new\n");
+		goto out_free_cpus;
+	}
+
+	/* anonymous union fields, can't be initialized above */
+	attr.wakeup_events = 1;
+	attr.sample_period = 1;
+
+	/*
+ 	 * FIXME: use evsel->attr.sample_type in event__parse_sample.
+ 	 * 	  This will nicely remove the requirement that we have
+ 	 * 	  all the events with the same sample_type.
+ 	 */
+	session.sample_type = attr.sample_type;
+
+	for (i = 0; i < nsyscalls; ++i) {
+		attr.config = ids[i];
+		evsels[i] = perf_evsel__new(&attr, i);
+		if (evsels[i] == NULL) {
+			pr_debug("perf_evsel__new\n");
+			goto out_free_evlist;
+		}
+
+		perf_evlist__add(evlist, evsels[i]);
+
+		if (perf_evsel__open(evsels[i], cpus, threads, false, false) < 0) {
+			pr_debug("failed to open counter: %s, "
+				 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
+				 strerror(errno));
+			goto out_close_fd;
+		}
+	}
+
+	if (perf_evlist__mmap(evlist, cpus, threads, 128, true) < 0) {
+		pr_debug("failed to mmap events: %d (%s)\n", errno,
+			 strerror(errno));
+		goto out_close_fd;
+	}
+
+	for (i = 0; i < nsyscalls; ++i)
+		for (j = 0; j < expected_nr_events[i]; ++j) {
+			int foo = syscalls[i]();
+			++foo;
+		}
+
+	while ((event = perf_evlist__read_on_cpu(evlist, 0)) != NULL) {
+		struct sample_data sample;
+
+		if (event->header.type != PERF_RECORD_SAMPLE) {
+			pr_debug("unexpected %s event\n",
+				 event__get_event_name(event->header.type));
+			goto out_munmap;
+		}
+
+		event__parse_sample(event, &session, &sample);
+		evsel = perf_evlist__id2evsel(evlist, sample.id);
+		if (evsel == NULL) {
+			pr_debug("event with id %" PRIu64
+				 " doesn't map to an evsel\n", sample.id);
+			goto out_munmap;
+		}
+		nr_events[evsel->idx]++;
+	}
+
+	list_for_each_entry(evsel, &evlist->entries, node) {
+		if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) {
+			pr_debug("expected %d %s events, got %d\n",
+				 expected_nr_events[evsel->idx],
+				 event_name(evsel), nr_events[evsel->idx]);
+			goto out_munmap;
+		}
+	}
+
+	err = 0;
+out_munmap:
+	perf_evlist__munmap(evlist, 1);
+out_close_fd:
+	for (i = 0; i < nsyscalls; ++i)
+		perf_evsel__close_fd(evsels[i], 1, threads->nr);
+out_free_evlist:
+	perf_evlist__delete(evlist);
+out_free_cpus:
+	cpu_map__delete(cpus);
+out_free_threads:
+	thread_map__delete(threads);
+	return err;
+#undef nsyscalls
+}
+
 static struct test {
 	const char *desc;
 	int (*func)(void);
@@ -456,6 +619,10 @@ static struct test {
 		.func = test__open_syscall_event_on_all_cpus,
 	},
 	{
+		.desc = "read samples using the mmap interface",
+		.func = test__basic_mmap,
+	},
+	{
 		.func = NULL,
 	},
 };

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

* [tip:perf/core] perf top: Add native_safe_halt to skip symbols
       [not found]             ` <new-submission>
                                 ` (705 preceding siblings ...)
  2011-01-26  7:19               ` [tip:perf/core] perf test: Add test for the evlist mmap routines tip-bot for Arnaldo Carvalho de Melo
@ 2011-01-26  7:21               ` tip-bot for Arnaldo Carvalho de Melo
  706 siblings, 0 replies; 1150+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2011-01-26  7:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, acme, hpa, mingo, tzanussi,
	peterz, efault, fweisbec, tglx, mingo

Commit-ID:  b0e8572f3b29c0760b66ba5627a6d5426c88c97d
Gitweb:     http://git.kernel.org/tip/b0e8572f3b29c0760b66ba5627a6d5426c88c97d
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sun, 16 Jan 2011 17:39:15 -0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 22 Jan 2011 19:56:31 -0200

perf top: Add native_safe_halt to skip symbols

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 58352ad..31fbaf3 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -933,6 +933,7 @@ repeat:
 /* Tag samples to be skipped. */
 static const char *skip_symbols[] = {
 	"default_idle",
+	"native_safe_halt",
 	"cpu_idle",
 	"enter_idle",
 	"exit_idle",

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

end of thread, other threads:[~2011-01-26  7:22 UTC | newest]

Thread overview: 1150+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 20:00     ` Ingo Molnar
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
     [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               ` [tip:tracing/tasks] tracing: fix trace_find_cmdline() Thomas Gleixner
2009-03-18  9:18               ` [tip:tracing/tasks] tracing: fix command line to pid reverse map Carsten Emde
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
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:perfcounters/core] perf_counter: round-robin per-CPU counters too 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
2009-05-04 17:34               ` [tip:perfcounters/core] perf_counter: convert perf_resource_mutex to a spinlock tip-bot for Ingo Molnar
     [not found]               ` <tip-48dd0fed90e2b1f1ba87401439b85942181c6df3@git.kernel.org>
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
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:x86/cleanups] x86: clean up arch/x86/kernel/tsc_sync.c a bit 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
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:perfcounters/core] perf_counter, x86: clean up throttling printk tip-bot for Mike Galbraith
2009-05-12 14:33               ` [tip:core/urgent] lockdep: increase MAX_LOCKDEP_ENTRIES 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
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:x86/urgent] xen: use header for EXPORT_SYMBOL_GPL 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
2009-05-15  8:42               ` [tip:perfcounters/core] perf_counter: x86: Fix throttling 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
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:perfcounters/core] perf_counter: x86: Fix up the amd NMI/INT throttle 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
2009-05-15 11:05                 ` Paul Mackerras
2009-05-15 11:23                   ` Peter Zijlstra
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:perfcounters/core] perf_counter: x86: Disallow interval of 1 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
2009-05-15  8:44               ` [tip:perfcounters/core] perf_counter: Remove ACPI quirk tip-bot for Ingo Molnar
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
2009-05-29  9:06                     ` Ingo Molnar
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:perfcounters/core] perf_counter: Fix context removal deadlock tip-bot for Ingo Molnar
2009-05-22 16:21               ` [tip:perfcounters/core] perf_counter tools: increase limits tip-bot for Ingo Molnar
2009-05-24  7:02               ` [tip:perfcounters/core] perf top: fix segfault tip-bot for Mike Galbraith
2009-05-25  3:39               ` [tip:perfcounters/core] perf_counter: Increase mmap limit tip-bot for Ingo Molnar
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:perfcounters/core] perf top: Reduce display overhead 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
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:perfcounters/core] perf_counter, x86: Fix APIC NMI programming 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
2009-05-26  7:57               ` [tip:perfcounters/core] perf_counter: Initialize ->oncpu properly tip-bot for Ingo Molnar
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:perfcounters/core] perf stat: Remove unused variable 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
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:perfcounters/core] perf stat: Convert to Git option parsing tip-bot for Ingo Molnar
2009-05-26 11:36               ` [tip:perfcounters/core] perf top: " 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
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:perfcounters/core] perf_counter: Implement dso__load using libelf 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
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: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:perfcounters/core] perf record: Convert to Git option parsing tip-bot for Ingo Molnar
2009-05-26 12:15               ` [tip:perfcounters/core] perf report: Add help/manpage 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
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:perfcounters/core] perf report: Fix ELF symbol parsing 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
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                   ` [PATCH 1/1 tip] " Peter Zijlstra
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:perfcounters/core] perf report: add counter for unknown events tip-bot for Ingo Molnar
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
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:perfcounters/core] perf_counter tools: Add built-in pager support 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
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:perfcounters/core] perf_counter: tools: /usr/lib/debug%s.debug support 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
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:perfcounters/core] perf_counter tools: report: Implement header output for --sort variants 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
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:perfcounters/core] perf_counter tools: Fix top symbol table dump typo 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
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:perfcounters/core] perf_counter tools: Split display into reading and printing 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
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:perfcounters/core] perf_counter: Robustify counter-free logic 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
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: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
2009-05-30  9:40                     ` Ingo Molnar
2009-05-30 11:27                       ` GeunSik Lim
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:perfcounters/core] perf_counter: Ammend cleanup in fork() fail 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
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: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
2009-05-30 15:37                     ` Jaswinder Singh Rajput
2009-05-30 16:38                     ` Sam Ravnborg
2009-05-30 17:23                       ` Ingo Molnar
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: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:43                   ` Ingo Molnar
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:perfcounters/core] perf_counter tools: Add string.[ch] 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
2009-06-02  9:03               ` [tip:perfcounters/core] perf_counter tools: Cleanup Makefile tip-bot for Mike Galbraith
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
2009-06-02 16:30                     ` Oleg Nesterov
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:perfcounters/core] perf_counter: tools: Better handle existing data files 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
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:perfcounters/core] x86: Fix atomic_long_xchg() on 64bit tip-bot for Peter Zijlstra
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:perfcounters/core] perf_counter: Rename various fields 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
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:perfcounters/core] perf_counter: Change data head from u32 to u64 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
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:perfcounters/core] perf_counter tools: Fix up the ABI shakeup tip-bot for Peter Zijlstra
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:perfcounters/core] perf report: Fix column width/alignment of dsos tip-bot for Ingo Molnar
2009-06-02 22:07               ` [tip:perfcounters/core] perf record: Add --append option tip-bot for Ingo Molnar
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:perfcounters/core] perf report: Print more info instead of <unknown> entries 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
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:perfcounters/core] perf_counter tools: Cover PLT symbols too 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
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
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:perfcounters/core] perf_counter: Add a comm hook for pure fork()s 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
2009-06-03 13:06               ` [tip:perfcounters/core] perf report: Fix comm sorting 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
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:perfcounters/core] perf record: Refine capture printout tip-bot for Ingo Molnar
2009-06-03 18:42               ` [tip:perfcounters/core] perf report: Display 100% correctly tip-bot for Ingo Molnar
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:perfcounters/core] perf report: Add front-entry cache for lookups 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
2009-06-03 19:21               ` [tip:perfcounters/core] perf_counter tools: Optimize harder tip-bot for Ingo Molnar
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:perfcounters/core] perf report: Clean up event processing 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
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:perfcounters/core] perf report: Fix rbtree bug 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
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: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
2009-06-04 13:09               ` [tip:perfcounters/core] perf report: Simplify symbol output 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
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: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
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:perfcounters/core] perf report: Bail out if there are unrecognized options/arguments tip-bot for Ingo Molnar
2009-06-04 15:39               ` [tip:perfcounters/core] perf stat: Update help text tip-bot for Ingo Molnar
2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Add fork event tip-bot for Peter Zijlstra
2009-06-04 16:00               ` [tip:perfcounters/core] perf_counter: Remove munmap stuff 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
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:perfcounters/core] perf record, top: Implement --freq 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
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: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
2009-06-05 15:02                     ` Arnaldo Carvalho de Melo
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:perfcounters/core] perf record/top: Clarify events/samples naming tip-bot for Ingo Molnar
2009-06-05 13:42               ` [tip:perfcounters/core] perf_counter tools: " tip-bot for Ingo Molnar
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:perfcounters/core] perf_counter: Change PERF_SAMPLE_CONFIG into PERF_SAMPLE_ID tip-bot for Peter Zijlstra
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:perfcounters/core] perf_counter: Fix frequency adjustment for < HZ 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
2009-06-05 18:46               ` [tip:perfcounters/core] perf record: Set frequency correctly 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
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
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:perfcounters/core] perf_counter tools: Add help for perf list tip-bot for Thomas Gleixner
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:perfcounters/core] perf_counter tools: Tidy up manpage details 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
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
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:perfcounters/core] perf_counter tools: Warning fixes on 32-bit 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
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:perfcounters/core] perf annotate: Fix command line help text 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
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:perfcounters/core] perf record: Fall back to cpu-clock-ticks if no PMU 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
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:perfcounters/core] perf stat: Print out instructins/cycle metric 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
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:perfcounters/core] perf_counter: Clean up x86 boot messages 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
2009-06-09  8:43                 ` Peter Zijlstra
2009-06-09 12:01                   ` Ingo Molnar
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
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:perfcounters/core] perf_counter: More aggressive frequency adjustment 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
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:perfcounters/core] perf_counter: Annotate exit ctx recursion 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
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:perfcounters/core] perf_counter: Accurate period data tip-bot for Peter Zijlstra
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:perfcounters/core] perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too 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
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:perfcounters/core] perf_counter: Add forward/backward attribute ABI compatibility 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
2009-06-13 14:49               ` [tip:perfcounters/core] perf stat: Reorganize output 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
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:core/urgent] lockdep: Select frame pointers on x86 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
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-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
2009-06-17  7:29                   ` Peter Zijlstra
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:perfcounters/core] perf record: Fix fast task-exit race 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
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
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: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:42                     ` Mathieu Desnoyers
2009-06-15 18:18                       ` Ingo Molnar
2009-06-15 17:11                 ` Linus Torvalds
2009-06-15 17:18                   ` Ingo Molnar
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:28                           ` Ingo Molnar
2009-06-15 18:42                             ` Mathieu Desnoyers
2009-06-15 18:47                               ` Ingo Molnar
2009-06-15 18:51                             ` Linus Torvalds
2009-06-15 19:16                               ` Mathieu Desnoyers
2009-06-15 18:38                           ` Mathieu Desnoyers
2009-06-15 18:50                             ` Ingo Molnar
2009-06-15 18:39                           ` H. Peter Anvin
2009-06-15 18:45                             ` Ingo Molnar
2009-06-15 18:55                               ` H. Peter Anvin
2009-06-15 19:02                                 ` Avi Kivity
2009-06-16  8:36                                   ` Ingo Molnar
2009-06-16  8:52                                     ` Avi Kivity
2009-06-16 10:50                                       ` Ingo Molnar
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
2009-06-15 19:39                               ` Mathieu Desnoyers
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:30                                   ` Ingo Molnar
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-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
2009-06-19 15:51                                             ` Mathieu Desnoyers
2009-06-19 16:16                                               ` Ingo Molnar
2009-06-16  8:42                                   ` Ingo Molnar
2009-06-16 15:21                                     ` H. Peter Anvin
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 20:59                                     ` Ingo Molnar
2009-06-15 21:04                                       ` H. Peter Anvin
2009-06-15 21:13                                         ` Ingo Molnar
2009-06-15 22:39                                     ` Linus Torvalds
2009-06-15 21:06                                   ` Jeremy Fitzhardinge
2009-06-15 18:08                       ` Ingo Molnar
2009-06-15 18:38                       ` H. Peter Anvin
2009-06-15 18:48                         ` Mathieu Desnoyers
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:11                                 ` H. Peter Anvin
2009-06-15 19:27                                   ` Mathieu Desnoyers
2009-06-15 19:32                                     ` H. Peter Anvin
2009-06-15 21:01                                       ` Ingo Molnar
2009-06-15 21:12                                         ` Mathieu Desnoyers
2009-06-15 21:16                                           ` Ingo Molnar
2009-06-15 21:34                                             ` Mathieu Desnoyers
2009-06-15 21:38                                               ` H. Peter Anvin
2009-06-15 21:54                                                 ` Mathieu Desnoyers
2009-06-15 22:21                                                   ` H. Peter Anvin
2009-06-15 22:30                                                     ` Mathieu Desnoyers
2009-06-15 22:36                                                       ` H. Peter Anvin
2009-06-15 22:49                                                         ` Mathieu Desnoyers
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 14:19                                                                 ` Mathieu Desnoyers
2009-06-16 15:22                                                                   ` H. Peter Anvin
2009-06-16 19:06                                                                     ` Mathieu Desnoyers
2009-06-16 20:26                                                                       ` H. Peter Anvin
2009-06-16 21:13                                                                         ` Mathieu Desnoyers
2009-06-16 22:37                                                                           ` H. Peter Anvin
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
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
2009-06-15 19:03                               ` Ingo Molnar
2009-06-15 19:07                                 ` Ingo Molnar
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
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:perfcounters/core] perf report: Fix 32-bit printf format 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
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:sched/urgent] sched, x86: Fix cpufreq + sched_clock() TSC scaling 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
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:perfcounters/core] perf_counter tools: Replace isprint() with issane() 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
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:perfcounters/core] perf report: Add validation of call-chain entries 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
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
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:perfcounters/core] perf_counter tools: Handle lost events 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
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:perfcounters/core] perf_counter: Update userspace callchain sampling uses 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
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:39                     ` Peter Zijlstra
2009-06-19 12:26                   ` Peter Zijlstra
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:perfcounters/core] perf_counter: Push perf_sample_data through the swcounter code tip-bot for Peter Zijlstra
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: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: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
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:perfcounters/urgent] perf_counter: Push inherit into perf_counter_alloc() 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
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:perfcounters/urgent] perf_counter tools: Rework the file format 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
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:perfcounters/urgent] perf_counter, x86: Add mmap counter read support tip-bot for Peter Zijlstra
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:perfcounters/urgent] perf_counter: Implement more accurate per task statistics tip-bot for Peter Zijlstra
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
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:perfcounters/urgent] perf-report: Add modes for inherited stats and no-samples 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
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: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
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-27 16:45                   ` Ingo Molnar
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:perfcounters/urgent] perf_counter tools: Add more warnings and fix/annotate them 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
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:timers/urgent] hrtimer: migration: always subtract base->offset 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
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:perfcounters/core] perf_counter: Clean up global vs counter enable 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
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
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:sched/urgent] sched: Account for vruntime wrapping 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
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:x86/urgent] x86: geode: Mark mfgpt irq IRQF_TIMER to prevent resume failure 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
2009-08-02 13:03               ` [tip:core/locking] lockdep: Fix BFS build tip-bot for Ingo Molnar
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
2009-08-02 19:39                     ` Andrew Morton
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
2009-08-02 20:46                       ` [tip:core/debug] debug lockups: Improve lockup detection Ingo Molnar
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:sched/core] sched: Add debug check to task_of() 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
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
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-06  1:26                         ` Paul E. McKenney
2009-08-06  2:51                           ` Gautham R Shenoy
2009-08-06 12:29                             ` Ingo Molnar
2009-08-06 13:59                               ` Paul E. McKenney
2009-08-08 14:57                           ` [tip:core/rcu] rcu: Add second " tip-bot for Paul E. McKenney
2009-08-08 15:01                             ` Ingo Molnar
2009-08-08 23:21                               ` Paul E. McKenney
2009-08-09 10:54                           ` tip-bot for Paul E. McKenney
2009-08-09 11:00                             ` Ingo Molnar
2009-08-09 11:10                               ` Ingo Molnar
2009-08-09 18:30                                 ` Paul E. McKenney
2009-08-09 19:23                                   ` Paul E. McKenney
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
2009-08-04  5:47                     ` Gautham R Shenoy
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
2009-08-04 11:37               ` [tip:perfcounters/core] perf top: Update man page tip-bot for Mike Galbraith
2009-08-04 11:37               ` [tip:perfcounters/urgent] perf_counter tools: Provide default bfd_demangle() function in case it's not around tip-bot for Ingo Molnar
2009-08-04 16:21               ` tip-bot for Ingo Molnar
2009-08-06 12:57               ` [tip:perfcounters/urgent] perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink tip-bot for Arnaldo Carvalho de Melo
2009-08-06 18:27               ` tip-bot for Arnaldo Carvalho de Melo
2009-08-11 11:33               ` [tip:perfcounters/urgent] perf_counter, x86: Fix lapic printk message tip-bot for Ingo Molnar
2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix generic cache events on P6-mobile CPUs tip-bot for Ingo Molnar
2009-08-11 11:34               ` [tip:perfcounters/urgent] perf_counter, x86: Fix/improve apic fallback tip-bot for Ingo Molnar
2009-08-11 16:23                 ` Johannes Stezenbach
2009-08-11 16:52                   ` Ingo Molnar
2009-08-12 12:18               ` tip-bot for Ingo Molnar
2009-08-12 15:51               ` [tip:irq/urgent] genirq: Prevent race between free_irq() and handle_IRQ_event() tip-bot for Thomas Gleixner
2009-08-13  8:39               ` [tip:perfcounters/core] perf_counter: Provide hw_perf_counter_setup_online() APIs tip-bot for Ingo Molnar
2009-08-13 22:05               ` [tip:tracing/core] tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures tip-bot for Ingo Molnar
2009-08-16  8:57               ` [tip:perfcounters/core] perf: Enable more compiler warnings tip-bot for Ingo Molnar
2009-08-16 12:46                 ` Frederic Weisbecker
2009-08-16 14:01                   ` Ingo Molnar
2009-08-16 14:06                     ` Frederic Weisbecker
2009-08-16 15:22                       ` Ingo Molnar
2009-08-16 12:53                 ` [PATCH] perf tools: Revert the -Wswitch-enum flag Frederic Weisbecker
2009-08-16 14:15                 ` [tip:perfcounters/core] perf: Enable more compiler warnings Frederic Weisbecker
2009-08-16 15:18                   ` Ingo Molnar
2009-08-16 15:52                     ` [PATCH] perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags Frederic Weisbecker
2009-08-16 16:00                       ` [tip:perfcounters/core] " tip-bot for Frederic Weisbecker
2009-08-16  9:18               ` [tip:perfcounters/core] perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2 tip-bot for Ingo Molnar
2009-08-17  8:46               ` [tip:perfcounters/urgent] perf: Rename perf-examples.txt to examples.txt tip-bot for Carlos R. Mafra
2009-08-18  9:15               ` [tip:perfcounters/core] perf tools: Remove obsolete defines tip-bot for Ingo Molnar
2009-08-18  9:39               ` [tip:perfcounters/urgent] perf_counter: Fix the PARISC build tip-bot for Ingo Molnar
2009-08-18 12:06               ` [tip:perfcounters/urgent] perf annotate: Fix segmentation fault tip-bot for Ingo Molnar
2009-08-21 11:07               ` [tip:tracing/urgent] tracing: Fix too large stack usage in do_one_initcall() tip-bot for Ingo Molnar
2009-08-21 11:14                 ` Ingo Molnar
2009-08-21 11:37                   ` Peter Zijlstra
2009-08-21 11:58                     ` Ingo Molnar
2009-08-21 17:48                   ` Andrew Morton
2009-08-21 18:13                     ` Linus Torvalds
2009-08-21 18:30                       ` Steven Rostedt
2009-08-21 19:02                       ` Ingo Molnar
2009-08-21 19:13                         ` Linus Torvalds
2009-08-21 19:19                           ` Linus Torvalds
2009-08-21 19:17                     ` Ingo Molnar
2009-08-21 19:37                       ` Steven Rostedt
2009-08-21 16:05                 ` Linus Torvalds
2009-08-21 16:22                   ` Ingo Molnar
2009-08-21 18:33                   ` Arjan van de Ven
2009-08-21 19:18               ` [tip:timers/core] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown tip-bot for Thomas Gleixner
2009-08-22 10:35                 ` Ingo Molnar
2009-08-22 21:14                   ` Martin Schwidefsky
2009-08-27 14:43               ` [tip:sched/clock] init: Move sched_clock_init after late_time_init tip-bot for Thomas Gleixner
2009-08-28 11:51               ` [tip:perfcounters/urgent] perf_counters: Increase paranoia level tip-bot for Ingo Molnar
2009-08-28 18:34               ` [tip:timers/core] clocksource: Resolve cpu hotplug dead lock with TSC unstable tip-bot for Thomas Gleixner
2009-08-31  8:19                 ` Martin Schwidefsky
2009-08-31 14:38                   ` Ingo Molnar
2009-08-31 15:59                   ` Thomas Gleixner
2009-09-03 18:17                     ` [boot crash] " Ingo Molnar
2009-09-03 18:21                       ` Ingo Molnar
2009-09-03 18:58                       ` Ingo Molnar
2009-09-08 21:43                         ` john stultz
2009-09-02  6:25               ` [tip:sched/core] sched: Add wait, sleep and iowait accounting tracepoints tip-bot for Peter Zijlstra
2009-09-02  7:01               ` tip-bot for Peter Zijlstra
2009-09-02  7:15               ` tip-bot for Peter Zijlstra
2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Clean up warnings list in the Makefile tip-bot for Ingo Molnar
2009-09-02 13:00               ` [tip:perfcounters/core] perf tools: Work around strict aliasing related warnings tip-bot for Ingo Molnar
2009-09-02 19:31               ` [tip:perfcounters/core] perf trace: Sample the CPU too tip-bot for Ingo Molnar
2009-09-02 21:44                 ` Frederic Weisbecker
2009-09-02 21:54                   ` Ingo Molnar
2009-09-03  1:52                     ` Frederic Weisbecker
2009-09-02 19:51               ` [tip:perfcounters/core] perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access tip-bot for Ingo Molnar
2009-09-03  1:11                 ` Li Zefan
2009-09-03  6:47                   ` Ingo Molnar
2009-09-03  6:46               ` tip-bot for Ingo Molnar
2009-09-03 11:09               ` [tip:perfcounters/core] perf trace: Sample timestamps as well tip-bot for Ingo Molnar
2009-09-03 13:48               ` tip-bot for Ingo Molnar
2009-09-03 14:27               ` [tip:perfcounters/core] perf trace: Fix parsing of perf.data tip-bot for Ingo Molnar
2009-09-03 14:27               ` [tip:perfcounters/core] perf tools: Seek to the end of the header area tip-bot for Ingo Molnar
2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Print out in nanoseconds tip-bot for Ingo Molnar
2009-09-03 14:28               ` [tip:perfcounters/core] perf trace: Fix read_string() tip-bot for Ingo Molnar
2009-09-03 16:55               ` [tip:perfcounters/core] perf_counter: Fix output-sharing error path tip-bot for Ingo Molnar
2009-09-04 10:25               ` [tip:sched/balancing] sched: Clean up topology.h tip-bot for Ingo Molnar
2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_BALANCE_NEWIDLE tip-bot for Ingo Molnar
2009-09-04 10:25               ` [tip:sched/balancing] sched: Turn on SD_WAKE_IDLE for 'close' domains tip-bot for Ingo Molnar
2009-09-04 15:42               ` [tip:perfcounters/core] perf stat: Change noise calculation to use stddev tip-bot for Peter Zijlstra
2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Remove the limit on repeat tip-bot for Peter Zijlstra
2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: Use stddev_mean in stead of stddev tip-bot for Peter Zijlstra
2009-09-04 15:43               ` [tip:perfcounters/core] perf stat: More advanced variance computation tip-bot for Peter Zijlstra
2009-09-04 18:34               ` [tip:perfcounters/core] perf stat: Clean up statistics calculations a bit more tip-bot for Peter Zijlstra
2009-09-07 20:37               ` [tip:sched/balancing] sched: Remove short cut from select_task_rq_fair() tip-bot for Peter Zijlstra
2009-09-07 20:37               ` [tip:sched/balancing] sched: Deal with low-load in wake_affine() tip-bot for Peter Zijlstra
2009-09-07 20:37               ` [tip:sched/balancing] sched: enable SD_WAKE_IDLE tip-bot for Peter Zijlstra
2009-09-08 11:19               ` [tip:sched/core] sched: Ensure that a child can't gain time over it's parent after fork() tip-bot for Mike Galbraith
2009-09-08 11:49                 ` Ingo Molnar
2009-09-08 11:53                   ` Jens Axboe
2009-09-08 12:42                     ` Mike Galbraith
2009-09-14 20:04               ` [tip:timers/core] clocksource: clocksource_select must be called with mutex locked tip-bot for Thomas Gleixner
2009-09-14 20:04               ` [tip:timers/core] clocksource: Delay clocksource down rating to late boot tip-bot for Thomas Gleixner
2009-09-15  8:22               ` [tip:timers/core] time: Prevent 32 bit overflow with set_normalized_timespec() tip-bot for Thomas Gleixner
2009-09-15  9:30               ` [tip:perfcounters/core] perf: Add 'perf sched' tool tip-bot for Ingo Molnar
2009-09-15  9:30               ` [tip:perfcounters/core] perf sched: Import schedbench.c tip-bot for Ingo Molnar
2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Implement the scheduling workload replay engine tip-bot for Ingo Molnar
2009-09-15  9:31               ` [tip:perfcounters/core] perf sched: Tighten up the code tip-bot for Ingo Molnar
2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Clean up latency and replay sub-commands tip-bot for Ingo Molnar
2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Display time in milliseconds, reorganize output tip-bot for Ingo Molnar
2009-09-15  9:32               ` [tip:perfcounters/core] perf sched: Add runtime stats tip-bot for Ingo Molnar
2009-09-15  9:33               ` [tip:perfcounters/core] perf sched: Output runtime and context switch totals tip-bot for Ingo Molnar
2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Add 'perf sched latency' and 'perf sched replay' tip-bot for Ingo Molnar
2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Finish latency => atom rename and misc cleanups tip-bot for Ingo Molnar
2009-09-15  9:34               ` [tip:perfcounters/core] perf sched: Clean up PID sorting logic tip-bot for Ingo Molnar
2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter: Allow mmap if paranoid checks are turned off tip-bot for Ingo Molnar
2009-09-15  9:35               ` [tip:perfcounters/core] perf sched: Add 'perf sched trace', improve documentation tip-bot for Ingo Molnar
2009-09-15  9:35               ` [tip:perfcounters/core] perf_counter, sched: Add sched_stat_runtime tracepoint tip-bot for Ingo Molnar
2009-09-15  9:36               ` [tip:perfcounters/core] perf tools: Implement counter output multiplexing tip-bot for Ingo Molnar
2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Fix 'perf sched latency' output on 32-bit systems tip-bot for Ingo Molnar
2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Print PIDs too tip-bot for mingo
2009-09-15  9:36               ` [tip:perfcounters/core] perf sched: Add support for sched:sched_stat_runtime events tip-bot for mingo
2009-09-16 10:19               ` [tip:sched/core] sched: Fix double_rq_lock() compile warning tip-bot for Peter Zijlstra
2009-09-16 10:19               ` [tip:sched/core] sched: Split WAKEUP_OVERLAP tip-bot for Peter Zijlstra
2009-09-16 10:19               ` [tip:sched/core] sched: Complete buddy switches tip-bot for Mike Galbraith
2009-09-16 10:19               ` [tip:sched/core] sched: Add come comments to the sched features tip-bot for Peter Zijlstra
2009-09-16 10:19               ` [tip:sched/core] sched: Move code around tip-bot for Peter Zijlstra
2009-09-16 10:20               ` [tip:sched/core] sched: Move sched_balance_self() into sched_fair.c tip-bot for Peter Zijlstra
2009-09-16 10:20               ` [tip:sched/core] sched: Hook sched_balance_self() into sched_class::select_task_rq() tip-bot for Peter Zijlstra
2009-09-16 10:20               ` [tip:sched/core] sched: Add TASK_WAKING tip-bot for Peter Zijlstra
2009-09-16 10:20               ` [tip:sched/core] sched: Merge select_task_rq_fair() and sched_balance_self() tip-bot for Peter Zijlstra
2009-09-16 10:21               ` [tip:sched/core] sched: Weaken SD_POWERSAVINGS_BALANCE tip-bot for Peter Zijlstra
2009-09-16 10:21               ` [tip:sched/core] sched: for_each_domain() vs RCU tip-bot for Peter Zijlstra
2009-09-16 10:21               ` [tip:sched/core] sched: Fix task affinity for select_task_rq_fair tip-bot for Peter Zijlstra
2009-09-16 10:21               ` [tip:sched/core] sched: Tweak wake_idx tip-bot for Peter Zijlstra
2009-09-16 10:21               ` [tip:sched/core] sched: Fix some domain tunings tip-bot for Peter Zijlstra
2009-09-16 10:22               ` [tip:sched/core] sched: Reduce forkexec_idx tip-bot for Peter Zijlstra
2009-09-16 10:22               ` [tip:sched/core] sched: Provide arch_scale_freq_power tip-bot for Peter Zijlstra
2009-09-16 10:22               ` [tip:sched/core] x86: Move APERF/MPERF into a X86_FEATURE tip-bot for Peter Zijlstra
2009-09-16 10:23               ` [tip:sched/core] x86: Add generic aperf/mperf code tip-bot for Peter Zijlstra
2009-09-16 10:23               ` [tip:sched/core] x86: sched: Provide arch implementations using aperf/mperf tip-bot for Peter Zijlstra
2009-09-16 10:23               ` [tip:sched/core] sched: Feature to disable APERF/MPERF cpu_power tip-bot for Peter Zijlstra
2009-09-16 10:23               ` [tip:sched/core] sched: Rename select_task_rq() argument tip-bot for Peter Zijlstra
2009-09-16 10:24               ` [tip:sched/core] sched: Rename sync arguments tip-bot for Peter Zijlstra
2009-09-16 10:24               ` [tip:sched/core] sched: Add WF_FORK tip-bot for Peter Zijlstra
2009-09-16 10:24               ` [tip:sched/core] sched: Fix sync wakeups again tip-bot for Peter Zijlstra
2009-09-16 10:24               ` [tip:sched/core] sched: Add a few SYNC hint knobs to play with tip-bot for Peter Zijlstra
2009-09-16 10:24               ` [tip:sched/core] sched: Add SD_PREFER_LOCAL tip-bot for Peter Zijlstra
2009-09-16 10:25               ` [tip:sched/core] sched: Implement a gentler fair-sleepers feature tip-bot for Ingo Molnar
2009-09-16 10:25               ` [tip:sched/core] sched: x86: Name old_perf in a unique way tip-bot for Peter Zijlstra
2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Account for lost events, increase default buffering tip-bot for Ingo Molnar
2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Sanity check context switch events tip-bot for Ingo Molnar
2009-09-16 10:25               ` [tip:perfcounters/core] perf sched: Make idle thread and comm/pid names more consistent tip-bot for Ingo Molnar
2009-09-16 12:36               ` [tip:x86/platform] x86: Move get/set_wallclock to x86_platform_ops tip-bot for Feng Tang
2009-09-16 14:45               ` [tip:perfcounters/core] perf sched: Add 'perf sched map' scheduling event map printout tip-bot for Ingo Molnar
2009-09-16 15:09               ` [tip:sched/core] sched: Optimize cgroup vs wakeup a bit tip-bot for Peter Zijlstra
2009-09-16 15:09               ` [tip:sched/core] sched: Clean up the load_idx selection in select_task_rq_fair tip-bot for Peter Zijlstra
2009-09-16 15:10               ` [tip:sched/core] sched: Rename flags to wake_flags tip-bot for Peter Zijlstra
2009-09-16 15:10               ` [tip:sched/core] sched: Disable wakeup balancing tip-bot for Peter Zijlstra
2009-09-16 18:50                 ` Peter Zijlstra
2009-09-16 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
2009-09-16 19:15               ` tip-bot for Ingo Molnar
2009-09-17  7:48               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
2009-09-17  7:49               ` [tip:sched/core] sched: Fix TASK_WAKING & loadaverage breakage tip-bot for Ingo Molnar
2009-09-17  7:54               ` tip-bot for Ingo Molnar
2009-09-17  7:54               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING, disable FAIR_SLEEPERS tip-bot for Peter Zijlstra
2009-09-17  8:12               ` [tip:sched/core] sched: Add new wakeup preemption mode: WAKEUP_RUNNING tip-bot for Peter Zijlstra
2009-09-17  8:18               ` tip-bot for Peter Zijlstra
2009-09-17  8:54               ` [tip:sched/core] sched: Stop buddies from hogging the system tip-bot for Peter Zijlstra
2009-09-17  8:54               ` [tip:sched/core] sched: Fix SD_POWERSAVING_BALANCE|SD_PREFER_LOCAL vs SD_WAKE_AFFINE tip-bot for Peter Zijlstra
2009-09-17 18:07               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
2009-09-17 19:34                 ` Arjan van de Ven
2009-09-17 19:45                   ` Ingo Molnar
2009-09-17 20:09                     ` Ingo Molnar
2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
2009-09-17 18:07               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
2009-09-17 18:07               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
2009-09-17 20:12               ` [tip:perfcounters/core] perf_counter: Do not throttle single swcounter events tip-bot for Peter Zijlstra
2009-09-17 20:13               ` [tip:perfcounters/core] perf_counter: Allow for a wakeup watermark tip-bot for Peter Zijlstra
2009-09-17 20:13               ` [tip:perfcounters/core] perf record: Disable profiling before draining the buffer tip-bot for Peter Zijlstra
2009-09-17 20:13               ` [tip:perfcounters/core] perf sched: Determine the number of CPUs automatically tip-bot for Ingo Molnar
2009-09-18 19:18               ` [tip:perfcounters/core] perf_counter: Fix up swcounter throttling tip-bot for Peter Zijlstra
2009-09-18 19:19               ` [tip:perfcounters/core] sched_clock: Make it NMI safe tip-bot for Peter Zijlstra
2009-09-19 15:16               ` [tip:sched/urgent] sched: Re-add lost cpu_allowed check to sched_fair.c::select_task_rq_fair() tip-bot for Mike Galbraith
2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename list_entry -> group_entry, counter_list -> group_list tip-bot for Ingo Molnar
2009-09-21 12:52               ` [tip:perfcounters/rename] perf_counter: Rename 'event' to event_id/hw_event tip-bot for Ingo Molnar
2009-09-21 12:53               ` [tip:perfcounters/rename] perf: Tidy up after the big rename tip-bot for Ingo Molnar
2009-09-22 13:34               ` [tip:core/printk] ratelimit: Use per ratelimit context locking tip-bot for Ingo Molnar
2009-09-22 13:34               ` [tip:core/printk] ratelimit: Fix/allow use in atomic contexts tip-bot for Ingo Molnar
2009-09-22 14:46                 ` Linus Torvalds
2009-09-22 13:34               ` [tip:perf/urgent] perf stat: Fix zero total printouts tip-bot for Ingo Molnar
2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Clean up thermal throttling state tracking code tip-bot for Ingo Molnar
2009-09-22 13:34               ` [tip:x86/urgent] x86: mce: Fix thermal throttling message storm tip-bot for Ingo Molnar
2009-09-22 14:26               ` [tip:core/printk] printk: Remove ratelimit.h from kernel.h tip-bot for Ingo Molnar
2009-09-25  8:49               ` [tip:perf/urgent] perf_event: Provide vmalloc() based mmap() backing tip-bot for Peter Zijlstra
2009-10-04  7:54               ` [tip:core/futexes] futex: Fix locking imbalance tip-bot for Thomas Gleixner
2009-10-04 15:48               ` [tip:core/urgent] " tip-bot for Thomas Gleixner
2009-10-05 19:11               ` tip-bot for Thomas Gleixner
2009-10-06 13:18               ` [tip:perf/core] perf tools: Default to 1 KHz auto-sampling freq events tip-bot for Ingo Molnar
2009-10-06 13:42               ` tip-bot for Ingo Molnar
2009-10-06 15:03               ` [tip:core/urgent] futex: Nullify robust lists after cleanup tip-bot for Peter Zijlstra
2009-10-06 15:54                 ` Anirban Sinha
2009-10-06 15:03               ` [tip:core/urgent] futex: Move exit_pi_state() call to release_mm() tip-bot for Thomas Gleixner
2009-10-12  7:13               ` [tip:perf/core] perf sched: Add -C option to measure on a specific CPU tip-bot for Mike Galbraith
2009-10-13 19:04               ` [tip:core/urgent] futex: Handle spurious wake up tip-bot for Thomas Gleixner
2009-10-15 10:46               ` [tip:perf/core] events: Harmonize event field names and print output names tip-bot for Ingo Molnar
2009-10-16  8:40               ` [tip:perf/urgent] perf tools: Bump version to 0.0.2 tip-bot for Ingo Molnar
2009-10-24  1:04               ` [tip:branch?] sched: Strengthen buddies and mitigate buddy induced latencies tip-bot for Mike Galbraith
2009-11-02  9:30               ` [tip:x86/urgent] x86: Fix printk message typo in mtrr cleanup code tip-bot for Dave Jones
2009-11-02 19:45               ` [tip:sched/urgent] sched: Disable SD_PREFER_LOCAL at node level tip-bot for Mike Galbraith
2009-11-03  7:03               ` tip-bot for Mike Galbraith
2009-11-04 19:33               ` [tip:sched/core] sched: Rate-limit newidle tip-bot for Mike Galbraith
2009-11-12 11:33               ` [tip:sched/urgent] sched: Fix/add missing update_rq_clock() calls tip-bot for Mike Galbraith
2009-11-13 19:49               ` [tip:timers/core] nohz: Type cast printk argument tip-bot for Thomas Gleixner
2009-11-13 19:50               ` [tip:timers/core] nohz: Track last do_timer() cpu tip-bot for Thomas Gleixner
2009-11-17 17:18               ` [tip:perf/urgent] perf annotate: Allocate history size correctly tip-bot for Nick Piggin
2009-11-23  7:15               ` [tip:tracing/core] ring-buffer benchmark: Run producer/consumer threads at nice +19 tip-bot for Ingo Molnar
2009-11-24 14:16                 ` Steven Rostedt
2009-11-24 14:20                   ` Steven Rostedt
2009-11-24 14:39                   ` Ingo Molnar
2009-11-24 15:01                     ` Steven Rostedt
2009-11-24 15:22                       ` Ingo Molnar
2009-11-24 15:40                         ` Steven Rostedt
2009-11-23 11:52               ` [tip:perf/core] perf events: Do not generate function trace entries in perf code tip-bot for Ingo Molnar
2009-11-23 11:53               ` [tip:tracing/core] tracing, function tracer: Clean up strstrip() usage tip-bot for Ingo Molnar
2009-11-24 14:15                 ` Steven Rostedt
2009-11-23 11:53               ` [tip:perf/core] perf_events: Optimize the swcounter hotpath tip-bot for Ingo Molnar
2009-11-26  8:15               ` [tip:x86/debug] x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details tip-bot for Ingo Molnar
2009-11-30  8:23               ` [tip:perf/scripting] perf scripting: Fix build tip-bot for Ingo Molnar
2009-12-06 20:27               ` [tip:sched/urgent] sched: Fix balance vs hotplug race tip-bot for Peter Zijlstra
2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove sysctl.sched_features tip-bot for Peter Zijlstra
2009-12-09  9:53               ` [tip:sched/urgent] sched: Consolidate select_task_rq() callers tip-bot for Peter Zijlstra
2009-12-09  9:53               ` [tip:sched/urgent] sched: Remove rq->clock coupling from set_task_cpu() tip-bot for Peter Zijlstra
2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up ttwu() rq locking tip-bot for Peter Zijlstra
2009-12-09  9:54               ` [tip:sched/urgent] sched: Sanitize fork() handling tip-bot for Peter Zijlstra
2009-12-09  9:54               ` [tip:sched/urgent] sched: Clean up check_preempt_wakeup() tip-bot for Peter Zijlstra
2009-12-09  9:55               ` [tip:sched/urgent] sched: Discard some old bits tip-bot for Peter Zijlstra
2009-12-09  9:55               ` [tip:sched/urgent] sched: Remove unnecessary RCU exclusion tip-bot for Peter Zijlstra
2009-12-10  8:43               ` [tip:sched/urgent] sched: Fix build warning in get_update_sysctl_factor() tip-bot for Mike Galbraith
2009-12-10 19:36               ` [tip:sched/urgent] sched: Remove forced2_migrations stats tip-bot for Ingo Molnar
2009-12-15  9:27               ` [tip:perf/diff] perf diff: Improve the help text tip-bot for Ingo Molnar
2009-12-15 14:30               ` tip-bot for Ingo Molnar
2009-12-28 10:07               ` [tip:perf/core] perf events: Remove arg from perf sched hooks tip-bot for Peter Zijlstra
2010-01-21 13:52               ` [tip:sched/core] sched: Move load balance code into sched_fair.c tip-bot for Peter Zijlstra
2010-01-21 13:52               ` [tip:sched/core] sched: Remove the sched_class load_balance methods tip-bot for Peter Zijlstra
2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator usage from load_balance_fair tip-bot for Peter Zijlstra
2010-01-21 13:52               ` [tip:sched/core] sched: Remove rq_iterator from move_one_task tip-bot for Peter Zijlstra
2010-01-21 13:53               ` [tip:sched/core] sched: Remove from fwd decls tip-bot for Peter Zijlstra
2010-01-21 13:53               ` [tip:sched/core] sched: Add a lock break for PREEMPT=y tip-bot for Peter Zijlstra
2010-01-21 13:53               ` [tip:sched/core] sched: Unify load_balance{,_newidle}() tip-bot for Peter Zijlstra
2010-01-21 13:53               ` [tip:sched/core] sched: Remove load_balance_newidle() tip-bot for Peter Zijlstra
2010-01-21 13:54               ` [tip:sched/core] sched: Assume *balance is valid tip-bot for Peter Zijlstra
2010-01-21 13:55               ` [tip:perf/urgent] perf: Change the is_software_event() definition tip-bot for Peter Zijlstra
2010-01-27 13:16               ` [tip:perf/core] perf: Reimplement frequency driven sampling tip-bot for Peter Zijlstra
2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Optimize x86_pmu_disable() tip-bot for Peter Zijlstra
2010-01-29  9:29               ` [tip:perf/core] perf, x86: Clean up event constraints code a bit tip-bot for Ingo Molnar
2010-01-29  9:29               ` [tip:perf/core] perf_event: x86: Deduplicate the disable code tip-bot for Peter Zijlstra
2010-01-31  8:30               ` [tip:perf/core] Revert "perf record: Intercept all events" tip-bot for Hitoshi Mitake
2010-02-04  9:52               ` [tip:x86/debug] x86_64: Print modules like i386 does tip-bot for Alexey Dobriyan
2010-02-04  9:56               ` [tip:perf/core] perf_events: Optimize perf_event_task_tick() tip-bot for Peter Zijlstra
2010-02-04  9:56               ` [tip:perf/core] perf_events, x86: Implement intel core solo/duo support tip-bot for Peter Zijlstra
2010-02-04  9:57               ` [tip:perf/core] bitops: Ensure the compile time HWEIGHT is only used for such tip-bot for Peter Zijlstra
2010-02-04 10:27                 ` [PATCH] bitops: Optimize hweight() by making use of compile-time evaluation Peter Zijlstra
2010-02-26 10:24               ` [tip:perf/core] perf_events: Report the MMAP pgoff value in bytes tip-bot for Peter Zijlstra
2010-02-26 10:25               ` [tip:perf/core] perf_events, x86: Remove superflous MSR writes tip-bot for Peter Zijlstra
2010-02-26 14:54               ` [tip:perf/core] perf_events, x86: Split PMU definitions into separate files tip-bot for Peter Zijlstra
2010-03-02 14:30               ` [tip:perf/nmi] nmi_watchdog: Tell the world we're active tip-bot for Peter Zijlstra
2010-03-02 14:30               ` [tip:perf/core] perf, x86: Restrict the ANY flag tip-bot for Peter Zijlstra
2010-03-02 14:31               ` [tip:perf/core] perf_events, x86: Fixup fixed counter constraints tip-bot for Peter Zijlstra
2010-03-02 16:26                 ` Stephane Eranian
2010-03-02 17:54                   ` Peter Zijlstra
2010-03-03  6:16                     ` Stephane Eranian
2010-03-09  8:21               ` [tip:perf/urgent] MAINTAINERS: Add Arnaldo as tools/perf/ co-maintainer tip-bot for Ingo Molnar
2010-03-10 13:10               ` [tip:perf/urgent] perf: Optimize perf_disable tip-bot for Peter Zijlstra
2010-03-10 13:10               ` [tip:perf/urgent] perf, x86, Do not user perf_disable from NMI context tip-bot for Peter Zijlstra
2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix x86_pmu_start tip-bot for Peter Zijlstra
2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Properly account n_added tip-bot for Peter Zijlstra
2010-03-10 13:12               ` [tip:perf/urgent] perf, x86: Fix double disable calls tip-bot for Peter Zijlstra
2010-03-10 13:13               ` [tip:perf/urgent] perf, x86: Fix double enable calls tip-bot for Peter Zijlstra
2010-03-10 13:13               ` [tip:perf/urgent] perf: Provide better condition for event rotation tip-bot for Peter Zijlstra
2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Avoid double disable on throttle vs ioctl(PERF_IOC_DISABLE) tip-bot for Peter Zijlstra
2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix pebs drains tip-bot for Peter Zijlstra
2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix PEBS enable/disable vs cpuc->enabled tip-bot for Peter Zijlstra
2010-03-10 13:22               ` [tip:perf/pebs] perf, x86: Fix LBR " tip-bot for Peter Zijlstra
2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Reorder intel_pmu_enable_all() tip-bot for Peter Zijlstra
2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Deal with multiple state bits for pebs-fmt1 tip-bot for Peter Zijlstra
2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Fix silly bug in intel_pmu_pebs_{enable,disable} tip-bot for Peter Zijlstra
2010-03-10 13:23               ` [tip:perf/pebs] perf, x86: Don't reset the LBR as frequently tip-bot for Peter Zijlstra
2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Remove checking_{wr,rd}msr() usage tip-bot for Peter Zijlstra
2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fixup the PEBS handler for Core2 cpus tip-bot for Peter Zijlstra
2010-03-10 13:24               ` [tip:perf/pebs] perf, x86: Fix LBR read-out tip-bot for Peter Zijlstra
2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Add INSTRUCTION_DECODER config flag tip-bot for Ingo Molnar
2010-03-10 13:25               ` [tip:perf/pebs] perf, x86: Fix the !CONFIG_CPU_SUP_INTEL build tip-bot for Ingo Molnar
2010-03-11 14:41               ` [tip:perf/urgent] perf, ppc: Fix compile error due to new cpu notifiers tip-bot for Peter Zijlstra
2010-03-11 14:41               ` [tip:sched/core] sched: Fix pick_next_highest_task_rt() for cgroups tip-bot for Peter Zijlstra
2010-04-02 19:10               ` [tip:perf/core] perf, x86: Fix __initconst vs const tip-bot for Peter Zijlstra
2010-04-02 19:10               ` [tip:perf/core] perf, x86: Add Nehalem programming quirk to Westmere tip-bot for Peter Zijlstra
2010-04-02 19:13               ` [tip:sched/core] sched: Fix TASK_WAKING vs fork deadlock tip-bot for Peter Zijlstra
2010-04-02 19:13               ` [tip:sched/core] sched: Optimize task_rq_lock() tip-bot for Peter Zijlstra
2010-04-02 19:13               ` [tip:sched/core] sched: Fix nr_uninterruptible count tip-bot for Peter Zijlstra
2010-04-02 19:14               ` [tip:sched/core] sched: Add enqueue/dequeue flags tip-bot for Peter Zijlstra
2010-04-23 10:50               ` [tip:sched/core] sched: Pre-compute cpumask_weight(sched_domain_span(sd)) tip-bot for Peter Zijlstra
2010-05-07 18:41               ` [tip:perf/core] perf: Annotate perf_event_read_group() vs perf_event_release_kernel() tip-bot for Peter Zijlstra
2010-05-07 18:43               ` [tip:perf/core] perf, x86: Remove PEBS SAMPLE_RAW support tip-bot for Peter Zijlstra
2010-05-07 18:43               ` [tip:perf/core] perf, x86: Consolidate some code repetition tip-bot for Peter Zijlstra
2010-05-07 18:44               ` [tip:perf/core] perf, x86: Improve the PEBS ABI tip-bot for Peter Zijlstra
2010-05-11  7:24               ` [tip:perf/core] Revert "perf: Fix exit() vs PERF_FORMAT_GROUP" tip-bot for Ingo Molnar
2010-05-17 21:09               ` [tip:perf/core] perf symbols: symbol inconsistency message should be done only at verbose=1 tip-bot for Arnaldo Carvalho de Melo
2010-05-17 22:33               ` [tip:perf/core] perf tools: Add mode to build without newt support tip-bot for Arnaldo Carvalho de Melo
2010-05-18 17:15               ` [tip:perf/core] perf/ftrace: Optimize perf/tracepoint interaction for single events tip-bot for Peter Zijlstra
2010-05-19  7:58                 ` Frederic Weisbecker
2010-05-19  8:18                   ` Peter Zijlstra
2010-05-19  8:23                     ` Frederic Weisbecker
2010-05-19  8:31                       ` Peter Zijlstra
2010-05-19  8:58                       ` Peter Zijlstra
2010-05-19  9:06                         ` Frederic Weisbecker
2010-05-19  9:12                           ` Peter Zijlstra
2010-05-19  9:13                             ` Frederic Weisbecker
2010-05-21 11:27                         ` [tip:perf/core] perf, trace: Optimize tracepoints by removing IRQ-disable from perf/tracepoint interaction tip-bot for Peter Zijlstra
2010-05-18 17:16               ` [tip:perf/core] perf: Disallow mmap() on per-task inherited events tip-bot for Peter Zijlstra
2010-05-18 17:16               ` [tip:perf/core] perf: Optimize the perf_output() path by removing IRQ-disables tip-bot for Peter Zijlstra
2010-05-18 17:17               ` [tip:perf/core] perf: Optimize the hotpath by converting the perf output buffer to local_t tip-bot for Peter Zijlstra
2010-05-18 17:17               ` [tip:perf/core] perf: Optimize perf_output_*() by avoiding local_xchg() tip-bot for Peter Zijlstra
2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races and clean up perf_event and perf_mmap_data interaction tip-bot for Peter Zijlstra
2010-05-31  7:19               ` [tip:perf/urgent] perf_events: Fix races in group composition tip-bot for Peter Zijlstra
2010-06-08 20:55               ` [tip:perf/core] perf: Fix signed comparison in perf_adjust_period() tip-bot for Peter Zijlstra
2010-06-08 20:55               ` [tip:sched/core] sched: Fix PROVE_RCU vs cpu_cgroup tip-bot for Peter Zijlstra
2010-06-08 20:55               ` [tip:perf/core] perf, x86: Small fix to cpuid10_edx tip-bot for Livio Soares
2010-06-09 10:14               ` [tip:perf/core] perf, trace: Inline perf_swevent_put_recursion_context() tip-bot for Peter Zijlstra
2010-06-09 10:15               ` [tip:perf/core] perf, trace: Remove superfluous rcu_read_lock() tip-bot for Peter Zijlstra
2010-06-09 10:16               ` [tip:perf/core] perf: Rename perf_mmap_data to perf_buffer tip-bot for Peter Zijlstra
2010-06-09 10:16               ` [tip:perf/core] perf: Simplify the ring-buffer logic: make perf_buffer_alloc() do everything needed tip-bot for Peter Zijlstra
2010-06-09 10:17               ` [tip:perf/core] arch: Implement local64_t tip-bot for Peter Zijlstra
2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event_count() tip-bot for Peter Zijlstra
2010-06-09 10:17               ` [tip:perf/core] perf: Add perf_event::child_count tip-bot for Peter Zijlstra
2010-06-09 10:18               ` [tip:perf/core] perf: Convert perf_event to local_t tip-bot for Peter Zijlstra
2010-06-09 10:18               ` [tip:perf/core] perf: Fix build breakage for architecutes without atomic64_t tip-bot for Peter Zijlstra
2010-07-17 11:12               ` [tip:sched/urgent] sched: Revert nohz_ratelimit() for now tip-bot for Peter Zijlstra
2010-07-18 10:33               ` [tip:perf/core] perf ui: Make END go to the last entry, not the top of the last page tip-bot for Arnaldo Carvalho de Melo
2010-07-18 10:34               ` [tip:perf/core] perf hists: Factor out duplicated code tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:49               ` [tip:perf/core] perf sort: Make column width code per hists instance tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:49               ` [tip:perf/core] perf ui: Restore SPACE as an alias to PGDN in annotate tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:49               ` [tip:perf/core] perf hist: Introduce routine to measure lenght of formatted entry tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:50               ` [tip:perf/core] perf ui: Consider the refreshed dimensions in ui_browser__show tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:50               ` [tip:perf/core] perf ui: Show the scroll bar over the left window frame tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:50               ` [tip:perf/core] perf ui: New hists tree widget tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:51               ` [tip:perf/core] perf report: Don't abbreviate file paths relative to the cwd tip-bot for Dave Martin
2010-08-02  7:51               ` [tip:perf/core] perf tools: Remove unneeded code for tracking the cwd in perf sessions tip-bot for Dave Martin
2010-08-02  7:51               ` [tip:perf/core] perf man pages: Fix cut'n'paste error tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:52               ` [tip:perf/core] perf record: Release resources at exit tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:52               ` [tip:perf/core] perf symbols: Precisely specify if dso->{long,short}_name should be freed tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:52               ` [tip:perf/core] perf tools: Factor out buildid reading and make it implicit in dso__load tip-bot for Dave Martin
2010-08-02  7:52               ` [tip:perf/core] perf tools: remove extra build-id check factored into dso__load tip-bot for Dave Martin
2010-08-02  7:53               ` [tip:perf/core] perf symbols: Improve debug image search when loading symbols tip-bot for Dave Martin
2010-08-02  7:53               ` [tip:perf/core] perf tui: Make CTRL+Z suspend perf tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:54               ` [tip:perf/core] perf tools: Release thread resources on PERF_RECORD_EXIT tip-bot for Arnaldo Carvalho de Melo
2010-08-02  7:54               ` [tip:perf/core] perf tools: Release session and symbol resources on exit tip-bot for Arnaldo Carvalho de Melo
2010-08-03  5:54               ` [tip:perf/core] perf session: Free the ref_reloc_sym memory at the right place tip-bot for Arnaldo Carvalho de Melo
2010-08-03  5:54               ` [tip:perf/core] perf session: Invalidate last_match when removing threads from rb_tree tip-bot for Arnaldo Carvalho de Melo
2010-08-03  5:55               ` [tip:perf/core] perf tools: Don't keep unreferenced maps when unmaps are detected tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:04               ` [tip:perf/core] perf symbols: Store the symbol binding tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:04               ` [tip:perf/core] perf ui: Add a map browser tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:04               ` [tip:perf/core] perf ui: Shorten ui_browser->refresh_entries to refresh tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:05               ` [tip:perf/core] perf hists: Handle verbose in hists__sort_list_width tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:05               ` [tip:perf/core] perf hists: Fixup addr snprintf width on 32 bit arches tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:05               ` [tip:perf/core] perf ui: Add search by name/addr to the map__browser tip-bot for Arnaldo Carvalho de Melo
2010-08-06 17:06               ` [tip:perf/core] perf report: Speed up exit path tip-bot for Arnaldo Carvalho de Melo
2010-08-07  7:01               ` [tip:perf/core] perf tui: Introduce list_head based generic ui_browser refresh routine tip-bot for Arnaldo Carvalho de Melo
2010-08-07  7:01               ` [tip:perf/core] perf ui: Start breaking down newt.c into multiple files tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:39               ` [tip:perf/core] perf ui: Shorten ui_browser member names tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_helpline routines to separate file in util/ui/ tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:40               ` [tip:perf/core] perf ui: Move ui_progress " tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:40               ` [tip:perf/core] perf ui: Move annotate browser to util/ui/browsers/ tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:41               ` [tip:perf/core] perf ui: Move map " tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:41               ` [tip:perf/core] perf ui: Move hists " tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:42               ` [tip:perf/core] perf ui: Complete the breakdown of util/newt.c tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:42               ` [tip:perf/core] perf annotate: Sort by hottest lines in the TUI tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:42               ` [tip:perf/core] perf ui: Make SPACE work as PGDN in all browsers tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:43               ` [tip:perf/core] perf annotate: Cycle thru sorted lines with samples tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:43               ` [tip:perf/core] perf ui browser: Add ui_browser__show counterpart: __hide tip-bot for Arnaldo Carvalho de Melo
2010-08-11  7:43               ` [tip:perf/core] perf ui hist browser: Fixup key bindings tip-bot for Arnaldo Carvalho de Melo
2010-08-12 20:03               ` [tip:perf/urgent] perf: Add back list_head data types tip-bot for Ingo Molnar
2010-08-16 17:32               ` [tip:perf/urgent] perf annotate tui: Fix exit and RIGHT keys handling tip-bot for Arnaldo Carvalho de Melo
2010-08-20 12:39               ` [tip:perf/core] perf ui browser: Abstract some more slang operations tip-bot for Arnaldo Carvalho de Melo
2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Return the exit key in all browsers tip-bot for Arnaldo Carvalho de Melo
2010-08-20 12:40               ` [tip:perf/core] perf ui browser: Add routines to compactly specify exit keys tip-bot for Arnaldo Carvalho de Melo
2010-08-21 20:18               ` [tip:perf/core] perf tools: Add --tui and --stdio to choose the UI tip-bot for Arnaldo Carvalho de Melo
2010-08-30  8:33               ` [tip:perf/core] perf hists: Fix hist_entry__init_have_children tip-bot for Arnaldo Carvalho de Melo
2010-08-30  8:34               ` [tip:perf/core] perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT() tip-bot for Arnaldo Carvalho de Melo
2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Init the has_children fields just once tip-bot for Arnaldo Carvalho de Melo
2010-08-30  8:34               ` [tip:perf/core] perf hists browser: Introduce "expand/collapse all callchains" action tip-bot for Arnaldo Carvalho de Melo
2010-09-09 19:45               ` [tip:perf/core] perf: Fix CPU hotplug tip-bot for Peter Zijlstra
2010-09-09 19:47               ` [tip:perf/core] perf: Deconstify struct pmu tip-bot for Peter Zijlstra
2010-09-09 19:47               ` [tip:perf/core] perf: Register PMU implementations tip-bot for Peter Zijlstra
2010-09-09 19:48               ` [tip:perf/core] perf: Unindent labels tip-bot for Peter Zijlstra
2010-09-09 19:48               ` [tip:perf/core] perf: Reduce perf_disable() usage tip-bot for Peter Zijlstra
2010-09-09 19:49               ` [tip:perf/core] perf: Per PMU disable tip-bot for Peter Zijlstra
2010-09-09 19:49               ` [tip:perf/core] perf: Default PMU ops tip-bot for Peter Zijlstra
2010-09-09 19:49               ` [tip:perf/core] perf: Shrink hw_perf_event tip-bot for Peter Zijlstra
2010-09-09 19:50               ` [tip:perf/core] perf: Rework the PMU methods tip-bot for Peter Zijlstra
2010-09-11  8:16                 ` Michael Cree
2010-09-11  8:16                   ` Michael Cree
2010-09-11  9:40                   ` Peter Zijlstra
2010-09-12  5:33                     ` Michael Cree
2010-09-12  5:37                       ` [PATCH] alpha: Fix HW performance counters to be stopped properly Michael Cree
2010-09-15 10:02                         ` [tip:perf/core] " tip-bot for Michael Cree
2010-09-13 12:15                       ` [tip:perf/core] perf: Rework the PMU methods Peter Zijlstra
2010-09-13 13:18                         ` Peter Zijlstra
2010-09-14 10:11                           ` Michael Cree
2010-09-14 14:07                             ` Peter Zijlstra
2010-09-15 20:25                               ` Michael Cree
2010-09-09 19:50               ` [tip:perf/core] perf: Remove the sysfs bits tip-bot for Peter Zijlstra
2010-09-09 19:50               ` [tip:perf/core] perf: Separate find_get_context() from event initialization tip-bot for Peter Zijlstra
2010-09-09 19:51               ` [tip:perf/core] perf: Remove the swevent hash-table from the cpu context tip-bot for Peter Zijlstra
2010-09-09 19:51               ` [tip:perf/core] perf: Per cpu-context rotation timer tip-bot for Peter Zijlstra
2010-09-09 19:51               ` [tip:perf/core] perf: Per-pmu-per-cpu contexts tip-bot for Peter Zijlstra
2010-09-10 14:54                 ` Frederic Weisbecker
2010-09-10 15:37                   ` Paul E. McKenney
2010-09-10 15:46                     ` Peter Zijlstra
2010-09-10 16:05                       ` Paul E. McKenney
2010-09-10 15:56                   ` Peter Zijlstra
2010-09-09 19:52               ` [tip:perf/core] perf: Move some code around tip-bot for Peter Zijlstra
2010-09-09 19:52               ` [tip:perf/core] perf: Clean up perf_event_context allocation tip-bot for Peter Zijlstra
2010-09-09 19:52               ` [tip:perf/core] perf: Multiple task contexts tip-bot for Peter Zijlstra
2010-09-09 19:53               ` [tip:perf/core] perf: Provide a separate task context for swevents tip-bot for Peter Zijlstra
2010-09-09 19:53               ` [tip:perf/core] perf: Optimize context ops tip-bot for Peter Zijlstra
2010-09-09 19:54               ` [tip:perf/core] perf: Fix up delayed_put_task_struct() tip-bot for Peter Zijlstra
2010-09-10 14:32               ` [tip:perf/core] perf: Ensure we call add_event_to_ctx() with the right locks held tip-bot for Peter Zijlstra
2010-09-10 15:48               ` [tip:perf/core] perf: Fix perf_init_event() tip-bot for Peter Zijlstra
2010-09-13 15:18               ` [tip:perf/core] perf: Sanitize the RCU logic tip-bot for Peter Zijlstra
2010-09-13 15:19               ` [tip:perf/core] perf: Fix free_event() tip-bot for Peter Zijlstra
2010-10-18 19:15               ` [tip:sched/core] sched: Unindent labels tip-bot for Peter Zijlstra
2010-10-18 19:22               ` [tip:perf/core] perf: Optimize sw events tip-bot for Peter Zijlstra
2010-10-18 19:22               ` [tip:perf/core] jump_label: Add COND_STMT(), reducer wrappery tip-bot for Peter Zijlstra
2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the failed-syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-counts script tip-bot for Arnaldo Carvalho de Melo
2010-10-26 10:22               ` [tip:perf/urgent] perf python scripting: print the syscall name on sctop tip-bot for Arnaldo Carvalho de Melo
2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Improve the syscalls-by-pid script tip-bot for Arnaldo Carvalho de Melo
2010-10-26 10:23               ` [tip:perf/urgent] perf python scripting: Support fedora 11 (audit 1.7.17) tip-bot for Arnaldo Carvalho de Melo
2010-10-27 11:01               ` [tip:perf/urgent] perf scripting: Shut up 'perf record' final status tip-bot for Arnaldo Carvalho de Melo
2010-10-27 11:01               ` [tip:perf/urgent] perf python scripting: Fixup cut'n'paste error in sctop script tip-bot for Arnaldo Carvalho de Melo
2010-10-27 11:02               ` [tip:perf/urgent] perf python scripting: Add futex-contention script tip-bot for Arnaldo Carvalho de Melo
2010-11-21 13:43               ` [tip:perf/core] perf tools: Change my maintainer address tip-bot for Arnaldo Carvalho de Melo
2010-11-23 10:22               ` [tip:sched/core] sched: Fix UP build breakage tip-bot for Peter Zijlstra
2010-11-23 10:22               ` [tip:sched/core] cpu: Remove incorrect BUG_ON tip-bot for Peter Zijlstra
2010-11-23 14:39                 ` Oleg Nesterov
2010-11-23 15:05                   ` Peter Zijlstra
2010-11-23 15:08                     ` Oleg Nesterov
2010-11-23 17:16                       ` Peter Zijlstra
2010-11-23 17:31                         ` Oleg Nesterov
2010-11-23 10:23               ` [tip:sched/core] sched: Add some clock info to sched_debug tip-bot for Peter Zijlstra
2010-11-23 19:51               ` [tip:perf/urgent] perf record: Handle restrictive permissions in /proc/{kallsyms,modules} tip-bot for Arnaldo Carvalho de Melo
2010-11-26 15:00               ` [tip:perf/core] perf: Fix inherit vs. context rotation bug tip-bot for Thomas Gleixner
2010-11-28  4:36                 ` Rakib Mullick
2010-11-26 15:01               ` [tip:perf/core] perf: Fix the software context switch counter tip-bot for Peter Zijlstra
2010-11-26 15:04               ` [tip:perf/core] perf: Ignore non-sampling overflows tip-bot for Peter Zijlstra
2010-11-26 19:20                 ` Francis Moreau
2010-11-28  8:33               ` [tip:perf/core] perf record: Add option to disable collecting build-ids tip-bot for Arnaldo Carvalho de Melo
2010-11-29 10:22                 ` Stephane Eranian
2010-11-29 15:14                   ` Arnaldo Carvalho de Melo
2010-11-28  8:34               ` [tip:perf/core] perf events: Default to using event__process_lost tip-bot for Arnaldo Carvalho de Melo
2010-12-07  7:06               ` [tip:perf/urgent] perf record: Fix eternal wait for stillborn child tip-bot for Arnaldo Carvalho de Melo
2010-12-08 20:39               ` [tip:perf/urgent] perf: Fix duplicate events with multiple-pmu vs software events tip-bot for Peter Zijlstra
2010-12-08 20:42               ` [tip:perf/core] perf, amd: Remove the nb lock tip-bot for Peter Zijlstra
2010-12-08 20:42               ` [tip:perf/core] perf: Stop all counters on reboot tip-bot for Peter Zijlstra
2010-12-09 23:39               ` [tip:perf/core] perf session: Remove unneeded dump_printf calls tip-bot for Arnaldo Carvalho de Melo
2010-12-16 12:31               ` [tip:perf/core] perf, x86: Detect broken BIOSes that corrupt the PMU tip-bot for Peter Zijlstra
2010-12-16 12:33               ` [tip:perf/core] perf, x86: Provide a PEBS capable cycle event tip-bot for Peter Zijlstra
2010-12-22 11:28               ` [tip:perf/urgent] perf buildid-list: Fix error return for success tip-bot for Arnaldo Carvalho de Melo
2010-12-25  8:57               ` [tip:perf/core] perf symbols: Improve kallsyms symbol end addr calculation tip-bot for Arnaldo Carvalho de Melo
2010-12-25  8:58               ` [tip:perf/core] perf test: Look forward for symbol aliases tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:19               ` [tip:perf/core] perf script: Finish the rename from trace to script tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:19               ` [tip:perf/core] perf record: Fix use of sample_id_all userspace with !sample_id_all kernels tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:19               ` [tip:perf/core] perf script: Fix event ordering settings to work with older kernels tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:21               ` [tip:perf/core] perf tools: Introduce event selectors tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:21               ` [tip:perf/core] perf evsel: Adopt MATCH_EVENT macro from 'stat' tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:22               ` [tip:perf/core] perf util: Move do_read from session to util tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:22               ` [tip:perf/core] perf evsel: Delete the event selectors at exit tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:23               ` [tip:perf/core] perf evsel: Steal the counter reading routines from stat tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:23               ` [tip:perf/core] perf evsel: Introduce per cpu and per thread open helpers tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor cpumap to hold nr and the map tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:24               ` [tip:perf/core] perf tools: Refactor all_tids " tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:25               ` [tip:perf/core] perf evsel: Use {cpu,thread}_map to shorten list of parameters tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:25               ` [tip:perf/core] perf evsel: Auto allocate resources needed for some methods tip-bot for Arnaldo Carvalho de Melo
2011-01-04  8:26               ` [tip:perf/core] perf test: Add test for counting open syscalls tip-bot for Arnaldo Carvalho de Melo
2011-01-05 17:36               ` [tip:perf/core] perf test: Clarify some error reports in the open syscall test tip-bot for Arnaldo Carvalho de Melo
2011-01-05 17:37               ` [tip:perf/core] perf session: Warn about errors when processing pipe events too tip-bot for Arnaldo Carvalho de Melo
2011-01-05 17:37               ` [tip:perf/core] perf script: Use the default lost event handler tip-bot for Arnaldo Carvalho de Melo
2011-01-05 17:38               ` [tip:perf/core] perf script: Make some lists static tip-bot for Arnaldo Carvalho de Melo
2011-01-11 11:09               ` [tip:perf/urgent] perf sched: Fix allocation result check tip-bot for Arnaldo Carvalho de Melo
2011-01-11 11:10               ` [tip:perf/urgent] perf tools: Emit clearer message for sys_perf_event_open ENOENT return tip-bot for Arnaldo Carvalho de Melo
2011-01-11 11:11               ` [tip:perf/urgent] perf evsel: Support perf_evsel__open(cpus > 1 && threads > 1) tip-bot for Arnaldo Carvalho de Melo
2011-01-11 11:11               ` [tip:perf/urgent] perf session: Fix infinite loop in __perf_session__process_events tip-bot for Arnaldo Carvalho de Melo
2011-01-12 10:51               ` [tip:perf/urgent] perf evsel: Fix order of event list deletion tip-bot for Arnaldo Carvalho de Melo
2011-01-12 10:52               ` [tip:perf/urgent] perf top: Fix annotate segv tip-bot for Arnaldo Carvalho de Melo
2011-01-12 10:52               ` [tip:perf/urgent] Revert "perf tools: Emit clearer message for sys_perf_event_open ENOENT return" tip-bot for Arnaldo Carvalho de Melo
2011-01-18  8:48               ` [tip:perf/urgent] perf tools: Fix handling of wildcards in tracepoint event selectors tip-bot for Arnaldo Carvalho de Melo
2011-01-18 19:06               ` [tip:perf/urgent] perf: Fix contexted inheritance tip-bot for Peter Zijlstra
2011-01-21 15:37               ` [tip:perf/urgent] perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat tip-bot for Peter Zijlstra
2011-01-23 18:00               ` [tip:perf/urgent] perf test: Fix build on older glibcs tip-bot for Arnaldo Carvalho de Melo
2011-01-23 18:01               ` [tip:perf/urgent] perf tools: Add missing header, fixes build tip-bot for Arnaldo Carvalho de Melo
2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build when using gcc 3.4.6 tip-bot for Arnaldo Carvalho de Melo
2011-01-23 18:02               ` [tip:perf/urgent] perf tools: Fix build by checking if extra warnings are supported tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:14               ` [tip:perf/core] perf evsel: Introduce perf_evlist tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:14               ` [tip:perf/core] perf evlist: Adopt the pollfd array tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:14               ` [tip:perf/core] perf evsel: Support event groups tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:15               ` [tip:perf/core] perf evsel: Allow specifying if the inherit bit should be set tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:15               ` [tip:perf/core] perf top: Use perf_evsel__open tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:15               ` [tip:perf/core] perf record: " tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:16               ` [tip:perf/core] perf evsel: Introduce mmap support tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:16               ` [tip:perf/core] perf record: Use struct perf_mmap and helpers tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:17               ` [tip:perf/core] perf record: Move perf_mmap__write_tail to perf.h tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:17               ` [tip:perf/core] perf evlist: Move the mmap array from perf_evsel tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:17               ` [tip:perf/core] perf record: Use perf_evlist__mmap tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:18               ` [tip:perf/core] perf tools: Add missing cpu_map__delete() tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:18               ` [tip:perf/core] perf test: Check counts on all cpus in test__open_syscall_event_on_all_cpus tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:19               ` [tip:perf/core] perf evlist: Steal mmap reading routine from 'perf top' tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:19               ` [tip:perf/core] perf test: Add test for the evlist mmap routines tip-bot for Arnaldo Carvalho de Melo
2011-01-26  7:21               ` [tip:perf/core] perf top: Add native_safe_halt to skip symbols tip-bot for Arnaldo Carvalho de Melo
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
2009-08-04 11:36           ` [tip:perfcounters/core] perf top: Improve interactive key handling tip-bot for 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
2009-11-12 10:07 [patch] sched: fix/add missing update_rq_clock() calls Mike Galbraith
2009-11-12 11:01 ` Peter Zijlstra
2009-11-12 11:27   ` Ingo Molnar
2009-11-12 11:29     ` Peter Zijlstra
2009-11-12 11:34       ` Ingo Molnar
2009-11-12 11:36         ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.