linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH -tip 4/9] power: add kernel_trap_sp()
@ 2009-03-19 21:10 Masami Hiramatsu
  2009-03-20  5:42 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2009-03-19 21:10 UTC (permalink / raw)
  To: Ingo Molnar, linuxppc-dev; +Cc: systemtap-ml, Steven Rostedt, LKML

Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
 arch/powerpc/include/asm/ptrace.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index c9c678f..0ac366c 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -83,6 +83,7 @@ struct pt_regs {

 #define instruction_pointer(regs) ((regs)->nip)
 #define user_stack_pointer(regs) ((regs)->gpr[1])
+#define kernel_trap_sp(regs) (user_stack_pointer(regs))
 #define regs_return_value(regs) ((regs)->gpr[3])

 #ifdef CONFIG_SMP
-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com

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

* Re: [RFC][PATCH -tip 4/9] power: add kernel_trap_sp()
  2009-03-19 21:10 [RFC][PATCH -tip 4/9] power: add kernel_trap_sp() Masami Hiramatsu
@ 2009-03-20  5:42 ` Benjamin Herrenschmidt
  2009-03-20  7:33   ` Ananth N Mavinakayanahalli
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-20  5:42 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: linuxppc-dev, Ingo Molnar, LKML, Steven Rostedt, systemtap-ml

On Thu, 2009-03-19 at 17:10 -0400, Masami Hiramatsu wrote:
> Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>

I haven't looked at the usage of it, but it's weird to have something
call "kernel_trap_sp" that returns the -user- stack pointer... is
this really what's expected here ?

> ---
>  arch/powerpc/include/asm/ptrace.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index c9c678f..0ac366c 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -83,6 +83,7 @@ struct pt_regs {
> 
>  #define instruction_pointer(regs) ((regs)->nip)
>  #define user_stack_pointer(regs) ((regs)->gpr[1])
> +#define kernel_trap_sp(regs) (user_stack_pointer(regs))
>  #define regs_return_value(regs) ((regs)->gpr[3])
> 
>  #ifdef CONFIG_SMP

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

* Re: [RFC][PATCH -tip 4/9] power: add kernel_trap_sp()
  2009-03-20  5:42 ` Benjamin Herrenschmidt
@ 2009-03-20  7:33   ` Ananth N Mavinakayanahalli
  2009-03-20 10:53     ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Ananth N Mavinakayanahalli @ 2009-03-20  7:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: LKML, Steven Rostedt, linuxppc-dev, systemtap-ml, Ingo Molnar,
	Masami Hiramatsu

On Fri, Mar 20, 2009 at 04:42:40PM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2009-03-19 at 17:10 -0400, Masami Hiramatsu wrote:
> > Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> 
> I haven't looked at the usage of it, but it's weird to have something
> call "kernel_trap_sp" that returns the -user- stack pointer... is
> this really what's expected here ?

In the current usage scenario, this gets called only with a pt_regs
snapshot from in kernel. user_stack_pointer() is a misnomer though;
all this macro needs is to return the stack pointer from the given
pt_regs.

Ananth

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

* Re: [RFC][PATCH -tip 4/9] power: add kernel_trap_sp()
  2009-03-20  7:33   ` Ananth N Mavinakayanahalli
@ 2009-03-20 10:53     ` Masami Hiramatsu
  0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2009-03-20 10:53 UTC (permalink / raw)
  To: ananth; +Cc: LKML, Steven Rostedt, linuxppc-dev, systemtap-ml, Ingo Molnar

Ananth N Mavinakayanahalli wrote:
> On Fri, Mar 20, 2009 at 04:42:40PM +1100, Benjamin Herrenschmidt wrote:
>> On Thu, 2009-03-19 at 17:10 -0400, Masami Hiramatsu wrote:
>>> Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.
>>>
>>> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
>> I haven't looked at the usage of it, but it's weird to have something
>> call "kernel_trap_sp" that returns the -user- stack pointer... is
>> this really what's expected here ?
> 
> In the current usage scenario, this gets called only with a pt_regs
> snapshot from in kernel. user_stack_pointer() is a misnomer though;
> all this macro needs is to return the stack pointer from the given
> pt_regs.

Indeed,
I expect kernel_trap_sp() returns the top of stack from pt_regs in the kernel.
Why I'm using user_stack_pointer() for kernel_trap_sp() is just that the
definitions of both are same...

Perhaps, should I define as below, even it is same as user_stack_pointer()?
#define kernel_trap_sp(regs) ((regs)->gpr[1])

Thank you,

> 
> Ananth
> --
> 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/

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com

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

end of thread, other threads:[~2009-03-20 10:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 21:10 [RFC][PATCH -tip 4/9] power: add kernel_trap_sp() Masami Hiramatsu
2009-03-20  5:42 ` Benjamin Herrenschmidt
2009-03-20  7:33   ` Ananth N Mavinakayanahalli
2009-03-20 10:53     ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).