[PATCH 2/2] perf: Drop the skip argument from perf_arch_fetch_regs_caller

Previous thread: [PATCH][GIT PULL] tracing: Add __used annotation to event variable by Steven Rostedt on Tuesday, May 25, 2010 - 6:31 am. (3 messages)

Next thread: Re: [PATCH] Staging: vme: vme.c: fixed an EXPORT_SYMBOL warning by Greg KH on Tuesday, May 25, 2010 - 6:44 am. (5 messages)
From: Frederic Weisbecker
Date: Tuesday, May 25, 2010 - 6:45 am

Ingo,

Please pull the perf/core branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/core

Thanks,
	Frederic
---

Frederic Weisbecker (2):
      x86: Unify dumpstack.h and stacktrace.h
      perf: Drop the skip argument from perf_arch_fetch_regs_caller


 arch/powerpc/include/asm/perf_event.h |   12 +++++++
 arch/powerpc/kernel/misc.S            |   26 ---------------
 arch/sparc/include/asm/perf_event.h   |    8 +++++
 arch/sparc/kernel/helpers.S           |    6 ++--
 arch/x86/include/asm/perf_event.h     |   13 +++++++
 arch/x86/include/asm/stacktrace.h     |   49 ++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/perf_event.c      |   18 ----------
 arch/x86/kernel/dumpstack.c           |    1 -
 arch/x86/kernel/dumpstack.h           |   56 ---------------------------------
 arch/x86/kernel/dumpstack_32.c        |    2 -
 arch/x86/kernel/dumpstack_64.c        |    1 -
 arch/x86/kernel/stacktrace.c          |    7 ++--
 include/linux/perf_event.h            |   32 ++++--------------
 include/trace/ftrace.h                |    2 +-
 kernel/perf_event.c                   |    5 ---
 kernel/trace/trace_event_perf.c       |    2 -
 16 files changed, 97 insertions(+), 143 deletions(-)
--

From: Frederic Weisbecker
Date: Tuesday, May 25, 2010 - 6:45 am

arch/x86/include/asm/stacktrace.h and arch/x86/kernel/dumpstack.h
declare headers of objects that deal with the same topic.
Actually most of the files that include stacktrace.h also include
dumpstack.h

Although dumpstack.h seems more reserved for internals of stack
traces, those are quite often needed to define specialized stack
trace operations. And perf event arch headers are going to need
access to such low level operations anyway. So don't continue to
bother with dumpstack.h as it's not anymore about isolated deep
internals.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/stacktrace.h |   52 ++++++++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/perf_event.c  |    2 -
 arch/x86/kernel/dumpstack.c       |    1 -
 arch/x86/kernel/dumpstack.h       |   56 -------------------------------------
 arch/x86/kernel/dumpstack_32.c    |    2 -
 arch/x86/kernel/dumpstack_64.c    |    1 -
 arch/x86/kernel/stacktrace.c      |    7 ++--
 7 files changed, 56 insertions(+), 65 deletions(-)
 delete mode 100644 arch/x86/kernel/dumpstack.h

diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 4dab78e..a957463 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -1,6 +1,13 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *  Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
+ */
+
 #ifndef _ASM_X86_STACKTRACE_H
 #define _ASM_X86_STACKTRACE_H
 
+#include <linux/uaccess.h>
+
 extern int kstack_depth_to_print;
 
 struct thread_info;
@@ -42,4 +49,49 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
 		unsigned long *stack, unsigned long bp,
 		const struct stacktrace_ops *ops, void *data);
 
+#ifdef CONFIG_X86_32
+#define STACKSLOTS_PER_LINE 8
+#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
+#else
+#define STACKSLOTS_PER_LINE ...
From: Frederic Weisbecker
Date: Tuesday, May 25, 2010 - 6:45 am

Drop this argument now that we always want to rewind only to the
state of the first caller.
It means frame pointers are not necessary anymore to reliably get
the source of an event. But this also means we need this helper
to be a macro now, as an inline function is not an option since
we need to know when to provide a default implentation.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 arch/powerpc/include/asm/perf_event.h |   12 ++++++++++++
 arch/powerpc/kernel/misc.S            |   26 --------------------------
 arch/sparc/include/asm/perf_event.h   |    8 ++++++++
 arch/sparc/kernel/helpers.S           |    6 +++---
 arch/x86/include/asm/perf_event.h     |   13 +++++++++++++
 arch/x86/include/asm/stacktrace.h     |    7 ++-----
 arch/x86/kernel/cpu/perf_event.c      |   16 ----------------
 include/linux/perf_event.h            |   32 +++++++-------------------------
 include/trace/ftrace.h                |    2 +-
 kernel/perf_event.c                   |    5 -----
 kernel/trace/trace_event_perf.c       |    2 --
 11 files changed, 46 insertions(+), 83 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h
index e6d4ce6..5c16b89 100644
--- a/arch/powerpc/include/asm/perf_event.h
+++ b/arch/powerpc/include/asm/perf_event.h
@@ -21,3 +21,15 @@
 #ifdef CONFIG_FSL_EMB_PERF_EVENT
 #include <asm/perf_event_fsl_emb.h>
 #endif
+
+#ifdef CONFIG_PERF_EVENTS
+#include <asm/ptrace.h>
+#include <asm/reg.h>
+
+#define perf_arch_fetch_caller_regs(regs, __ip)			\
+	do {							\
+		(regs)->nip = __ip;				\
+		(regs)->gpr[1] = *(unsigned long *)__get_SP();	\
+		asm volatile("mfmsr %0" : "=r" ((regs)->msr));	\
+	} while (0)
+#endif
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index ...
Previous thread: [PATCH][GIT PULL] tracing: Add __used annotation to event variable by Steven Rostedt on Tuesday, May 25, 2010 - 6:31 am. (3 messages)

Next thread: Re: [PATCH] Staging: vme: vme.c: fixed an EXPORT_SYMBOL warning by Greg KH on Tuesday, May 25, 2010 - 6:44 am. (5 messages)