public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] sparc64: add function save_stack_trace_tsk()
@ 2008-11-12 13:47 Alexander Beregalov
  2008-11-12 14:13 ` Alexander Beregalov
  2008-11-12 21:49 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Beregalov @ 2008-11-12 13:47 UTC (permalink / raw)
  To: davem, sparclinux, linux-next, kenchen, mingo, adobriyan

Hi

Current -next does not build on sparc64:
  LD      .tmp_vmlinux1
  fs/built-in.o: In function `proc_pid_stack':
  /home/alexb/linux-2.6/fs/proc/base.c:360: undefined reference to
  `save_stack_trace_tsk'

---

  Add function save_stack_trace_tsk() on sparc64.


Signed-off-by: Alexander Beregalov <a.beregalov@gmail•com>
---

 arch/sparc64/kernel/stacktrace.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index 4e21d4a..a22eb8e 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -7,9 +7,9 @@
 
 #include "kstack.h"
 
-void save_stack_trace(struct stack_trace *trace)
+void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
-	struct thread_info *tp = task_thread_info(current);
+	struct thread_info *tp = task_thread_info(tsk);
 	unsigned long ksp, fp;
 
 	stack_trace_flush();
@@ -47,4 +47,10 @@ void save_stack_trace(struct stack_trace *trace)
 			trace->entries[trace->nr_entries++] = pc;
 	} while (trace->nr_entries < trace->max_entries);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
+
+inline void save_stack_trace(struct stack_trace *trace)
+{
+	save_stack_trace_tsk(current, trace);
+}
 EXPORT_SYMBOL_GPL(save_stack_trace);

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

* Re: [PATCH] sparc64: add function save_stack_trace_tsk()
  2008-11-12 13:47 [PATCH] sparc64: add function save_stack_trace_tsk() Alexander Beregalov
@ 2008-11-12 14:13 ` Alexander Beregalov
  2008-11-12 21:49 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Beregalov @ 2008-11-12 14:13 UTC (permalink / raw)
  To: davem, sparclinux, linux-next, kenchen, mingo, adobriyan

2008/11/12 Alexander Beregalov <a.beregalov@gmail•com>:
> Hi
>
> Current -next does not build on sparc64:
>  LD      .tmp_vmlinux1
>  fs/built-in.o: In function `proc_pid_stack':
>  /home/alexb/linux-2.6/fs/proc/base.c:360: undefined reference to
>  `save_stack_trace_tsk'
>
> ---
>
>  Add function save_stack_trace_tsk() on sparc64.
>
>
> Signed-off-by: Alexander Beregalov <a.beregalov@gmail•com>
> ---
No, it does not work, it is not so simple.

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

* Re: [PATCH] sparc64: add function save_stack_trace_tsk()
  2008-11-12 13:47 [PATCH] sparc64: add function save_stack_trace_tsk() Alexander Beregalov
  2008-11-12 14:13 ` Alexander Beregalov
@ 2008-11-12 21:49 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2008-11-12 21:49 UTC (permalink / raw)
  To: a.beregalov; +Cc: sparclinux, linux-next, kenchen, mingo, adobriyan

From: Alexander Beregalov <a.beregalov@gmail•com>
Date: Wed, 12 Nov 2008 16:47:49 +0300

> Current -next does not build on sparc64:
>   LD      .tmp_vmlinux1
>   fs/built-in.o: In function `proc_pid_stack':
>   /home/alexb/linux-2.6/fs/proc/base.c:360: undefined reference to
>   `save_stack_trace_tsk'
> 
> ---
> 
>   Add function save_stack_trace_tsk() on sparc64.
> 
> 
> Signed-off-by: Alexander Beregalov <a.beregalov@gmail•com>

This won't work as-is.

The save_stack_trace() function starts with the actual frame-pointer
register in the current cpu to start winding back the stack.  So
when 'tsk' is not 'current' nothing will be saved.  That's what this
bit of code is doing:

	__asm__ __volatile__(
		"mov	%%fp, %0"
		: "=r" (ksp)
	);

	fp = ksp + STACK_BIAS;

Also, "stack_trace_flush()" should only be run when current == tsk.

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

end of thread, other threads:[~2008-11-12 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 13:47 [PATCH] sparc64: add function save_stack_trace_tsk() Alexander Beregalov
2008-11-12 14:13 ` Alexander Beregalov
2008-11-12 21:49 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox